Skip to content

backends: move the Claude-only SDK helpers bashCommand and loadedSdkIdentity into the Claude backend #1372

Open

Description

@schlessera

Part of #1345.

Context

Delivered prerequisite outputs: #1399 (merged in #1461).

Ruled 2026-10-09 (maintainer): a helper only one backend imports belongs in that backend. The binding inventory applies that rule here (docs/decisions/backend-authoring-toolkit.md:41).

What the ruling still requires on a6b945b, with every consumer outside packages/ui-sdk:

Name Exported from Imported by Status
bashCommand SDK /internal (packages/ui-sdk/src/internal.ts:7) Claude only: packages/ui-backend-claude/src/input-rewrite-hooks.ts:2, src/tool-policy.ts:3 single-backend → moves here (the inventory assigns it to this issue, backend-authoring-toolkit.md:41)
loadedSdkIdentity SDK /internal (internal.ts:9) Claude only: packages/ui-backend-claude/src/runtime-probe.ts:18 single-backend → moves here
VERSION_PROBE_TIMEOUT_MS SDK /internal (internal.ts:14) Claude (src/runtime-probe.ts:26, src/turn-runner.ts:18) and the host (packages/ui-server/src/brain/client.ts:5) host plus one backend → not single-backend; classified in #2772
claudeMaskFilename, claudeReportedMaskPath, piMaskFilename, piReportedMaskPath SDK /internal (internal.ts:12) each backend its own pair (packages/ui-backend-claude/src/mask-tool.ts:9-10, packages/ui-backend-pi/src/bridge-tools.ts:39-40) and the host both filename rules (packages/ui-server/src/brain/mask-application.ts:6, :79) host plus one backend each → classified in #2772

The body previously said the four mask helpers "are public" in /server and required their absence from the /server api-report. That is already true: they are only in /internal (packages/ui-sdk/src/internal.ts:12), and packages/ui-sdk/tests/backend-toolkit.test.ts:22-28 already asserts the ordinary entries exclude them. That criterion was satisfied without this issue; it is replaced below by ownership checks.

Scope

  • Move bashCommand and loadedSdkIdentity into packages/ui-backend-claude (source, with their unit tests), import them locally there, and remove them from packages/ui-sdk/src/internal.ts and any SDK source left unused.
  • Update the bashCommand row of docs/decisions/backend-authoring-toolkit.md (:41), record loadedSdkIdentity's move beside it, and update the affected API reports.

Out of scope

Acceptance criteria

  • git grep -nE '\b(bashCommand|loadedSdkIdentity)\b' -- packages/ui-sdk/src returns nothing.
  • git grep -nE 'import .*\b(bashCommand|loadedSdkIdentity)\b.*brain-ui-sdk' -- packages returns nothing; Claude imports them from its own source.
  • api-report/ui-sdk.txt no longer lists either name; no public .//server//client//protocol entry changes.
  • packages/ui-sdk/tests/backend-toolkit.test.ts still passes, and the moved helpers' tests run in packages/ui-backend-claude unchanged in their assertions.
  • Claude's hook, lock-selection and runtime-probe tests pass unchanged.

Verification

git grep -nE '\b(bashCommand|loadedSdkIdentity)\b' -- packages
bun run test packages/ui-sdk packages/ui-backend-claude
bun run api-report
bun run typecheck

Contract impact

None. Both names leave SDK /internal only, which is not a supported entry; no public name is removed, so no CONTRACT: commit and no breaking label. A patch changeset for the affected packages if their declaration output changes.

2026-10-24: rewrote around the remaining backend ownership moves. Added bashCommand (assigned here by the toolkit inventory); recorded that the mask helpers are already internal-only, so the public-removal criterion was satisfied; moved VERSION_PROBE_TIMEOUT_MS and the mask helpers to #2772 because the host imports them too; removed contract and breaking because no supported public entry loses a name.

Activity

  1. added
    type: refactor
    area: ui-sdk
    area: backends
    priority: p3
    needs: decision
    contract
    breaking
    on Oct 9, 2026
  2. changed the title [-]ui-sdk: move the Claude and pi mask filename helpers out of the public server entry[/-] [+]ui-sdk: move single-backend helpers out of the SDK and into their backend[/+] on Oct 9, 2026
  3. added
    blocked
    agent-ready
    and removed
    needs: decision
    blocked
    on Oct 9, 2026
  4. schlessera commented on Oct 10, 2026

    @schlessera
    OwnerAuthor

    Unblocked: #1399 merged in #1461 (02fd0b9). The helpers both backends import are now public on @schlessera/brain-ui-sdk/server. execWrapperSpawnOptions (host + pi), bashCommand (Claude only), SUBPROCESS_ENV (host only), GIT_LOCK_KEY and canonicalModelId stay in /internal; see the inventory in docs/decisions/backend-authoring-toolkit.md.

  5. added
    priority: p2
    and removed
    priority: p3
    on Oct 21, 2026
  6. schlessera commented on Oct 21, 2026

    @schlessera
    OwnerAuthor

    2026-10-21 dependency-priority reconciliation: #1400 explicitly waits for this helper move and has priority p2. Raised this blocker from p3 to p2 under the repository rule that a blocker must have at least the priority of the work it blocks. This preserves the approved scope, readiness, assignment and release attribution; no implementation or new schedule is claimed.

  7. changed the title [-]ui-sdk: move single-backend helpers out of the SDK and into their backend[/-] [+]backends: move the Claude-only SDK helpers bashCommand and loadedSdkIdentity into the Claude backend[/+] on Oct 24, 2026
  8. removed
    area: ui-sdk
    contract
    breaking
    on Oct 24, 2026
  9. schlessera commented on Oct 24, 2026

    @schlessera
    OwnerAuthor

    2026-10-24: body rewritten against a6b945b.

    • The four mask helpers are not public: they are exported only from SDK /internal (packages/ui-sdk/src/internal.ts:12), and packages/ui-sdk/tests/backend-toolkit.test.ts:22-28 already asserts the ordinary entries exclude them. The old "absent from /server" criterion was already met.
    • They are also not single-backend: the host imports both filename rules (packages/ui-server/src/brain/mask-application.ts:6, :79). VERSION_PROBE_TIMEOUT_MS likewise has a host consumer (packages/ui-server/src/brain/client.ts:5). The 2026-10-09 single-backend rule does not settle host-plus-one-backend helpers, so both moved to ui-sdk: classify the SDK helpers that only the host and one backend import #2772, which asks for that classification.
    • Added bashCommand, which docs/decisions/backend-authoring-toolkit.md:41 assigns to this issue.
    • Removed contract and breaking: the remaining moves take names out of SDK /internal only, and no supported public entry loses a name.

    Removed body lines, kept as history: "2026-10-09: sequenced against the other code-quality issues to avoid overlapping edits; see the epic's planned-order comment." / "Updated 2026-10-12: removed completed blocker declarations, retained delivered-output context and all remaining prerequisites; readiness and existing rulings preserved."

  10. added
    area: ui-sdk
    on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyarea: backendsarea: ui-sdkpriority: p2type: refactor

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions