Repository navigation
Description
Context
@schlessera/brain-ui-sdk/internal (packages/ui-sdk/src/internal.ts, 96 lines, 227 names) exists only so first-party packages in the same product group can share code (docs/decisions/public-export-boundary.md; the 2026-10-09 ruling on #1345). At dcf5341aa, 68 of those 227 names have no importer outside ui-sdk. ui-sdk's own tests import these symbols from their source modules (for example packages/ui-sdk/tests/outward-actions.test.ts:2 imports classifyOutwardCall and outwardTarget from ../src/server/outward-actions), so the re-exports serve nobody. They still add rows to api-report/ui-sdk.txt and to the dist-types check, and they make ./internal look like a wider dependency surface than it is.
Three more names in ./internal/client (packages/ui-sdk/src/internal-client.ts) have no importer outside ui-sdk either: isShareTargetRequest, ShareTargetError, LinkEdit.
How the list was produced: take every name listed under export "./internal" in api-report/ui-sdk.txt, then run, for each name,
git grep -lw -- "$NAME" -- packages tests scripts website template evals experiments \
':!packages/ui-sdk/**' ':!api-report/**' ':!**/*.md'and keep the names with no hit. A whole-word match anywhere, including a relative import from another package's tests, counts as a use, so the list errs towards keeping names.
The 68 names
ARCHIVING_UPDATE_REASON, brainGitSync, BUILTIN_OUTWARD_MCP_DESCRIPTORS, classifyOutwardCall, createWorkerStartupView, DEFAULT_MAINTENANCE_TEMP_BUDGET_BYTES, DEFAULT_MAINTENANCE_TEMP_BYTES, DEFAULT_OUTPUT_STAGING_BYTES, DEFAULT_WORKER_STATE_BYTES, describeLimitHits, EgressProxyOptions, InferenceRelayOptions, linkedTurnTempPaths, MaintenanceEnvelope, MaintenanceResult, MAINTENANCE_TEMP_BUDGET_ENV, MAINTENANCE_TEMP_BYTES_ENV, MaintenanceWorker, MAX_INFERENCE_REQUEST_BYTES, NativeBrainDeltaCandidate, NativeBrainDeltaError, NativeBrainRootIdentity, NativeFileVersion, OUTPUT_STAGING_BUDGET_ENV, OUTPUT_STAGING_BYTES_ENV, OutwardClassification, OutwardPlan, outwardTarget, PrepareWorkerSandboxOptions, probeMaintenanceWorker, PROMOTED_SCRATCH_DIR, PROMOTION_FILE_MAX_BYTES, PROMOTION_TURN_MAX_BYTES, PROMOTION_TURN_MAX_FILES, purgeTurnTemp, ReplayReceipt, resolveOutputStagingLimits, RestrictedEnvelope, SessionPromptFacts, STALE_NATIVE_WRITE, TURN_TEMP_BUDGET_ENV, TURN_TEMP_BYTES_ENV, turnTempFullMessage, turnTempPath, TurnTempPromoterOptions, TurnTempPurgeResult, TurnTempSpace, turnTempUsage, TURN_TEMP_WARN_RATIO, validWorkerStateBytes, VisibleOutwardAction, WorkerArea, WorkerAreaName, WORKER_AREAS, WorkerCommandRule, WORKER_EGRESS_SOCKET, WorkerHome, WorkerHostProbeOptions, WORKER_INFERENCE_DIR, WorkerLimitHit, WORKER_LIMITS_ENV, WorkerMount, WorkerOutputStorage, WorkerOutwardRule, WorkerProfile, WORKER_STATE_BUDGET_ENV, WorkerStateConfigError, WORKER_STATE_PAGE
This is narrower than #1401, which deletes whole ./internal entry points nobody imports. ui-sdk's ./internal entry stays: ui-server and both backends use the other 159 names.
Scope
- Remove the 68 names from
packages/ui-sdk/src/internal.ts, and the three frominternal-client.ts. Each symbol stays exported from its source module if ui-sdk code or tests still import it there. - Regenerate
api-report/ui-sdk.txt.
Out of scope
- Deleting the underlying functions, constants or types; many are used inside ui-sdk.
- Names moved by backends: move the Claude-only SDK helpers bashCommand and loadedSdkIdentity into the Claude backend #1372 (
loadedSdkIdentity,VERSION_PROBE_TIMEOUT_MS). - Public entries (
.,./server,./client,./protocol). - Other packages'
./internalentries (packages: delete internal entry points that no other package uses #1401).
Acceptance criteria
- For each of the 71 listed names, the PR records its grep result at its base and whether removing it keeps declaration emit clean in every package that imports
./internalor./internal/client. The PR removes each name that has no importer, does not reach an emitted declaration and is not imported by an open PR. It keeps every other name and names the reason. The per-name output is attached to the PR. Names that entered./internalafter the review are ui-sdk: 15 more internal entry names have no outside importer after #2534 #3412's. -
api-report/ui-sdk.txtno longer lists the 71 removed names under./internalor./internal/client. -
bun run typecheck,bun run testandtests/api-surface.test.tspass.
Verification
bun run typecheck
bun run test packages/ui-sdk packages/ui-server packages/ui-backend-claude packages/ui-backend-pi
bun run test tests/api-surface.test.tsContract impact
None. Internal entries carry no compatibility promise (docs/decisions/public-export-boundary.md).
Found by a repository review on 2026-10-22.
2026-11-03: corrected the first acceptance criterion. A grep miss is not enough. WorkerOutputStorage, SessionPromptFacts and LinkEdit have no grep hit, but ui-server, the Claude backend and ui-react reach them through inferred return types, and removing them breaks those packages' declaration emit (TS2742). At the PR base, NativeBrainDeltaCandidate has an importer in ui-server, and open PR #3393 adds an import of MaintenanceResult. Names that became consumer-less after the review moved to #3412, so the original "every name still exported" criterion no longer bounds this issue.
Blocked by #3417
Activity
schlessera commentedon Nov 2, 2026
Claiming (claim-2534-1793663600). Branch
chore/2534-ui-sdk-internal-names, based onepic/2542-dead-codeatac3cab77a; the PR targets the epic integration branch.schlessera commentedon Nov 3, 2026
Unblocked: #3417 is closed, so
scripts/sync-project.tsis removing theblockedlabel.schlessera commentedon Nov 3, 2026
Blocker #3417 is closed; its fix, #3426, merged to main as
9a0fc4889. #3417 was this issue's only blocker, soblockedis removed. PR #3413 is refreshed ontoepic/2542-dead-code(d6a36882f) andorigin/main(559fe7b41), now at head03cdfcb71. The refresh also fixes the epic's unused-export gate against main's new code. Typecheck, build, lint, 154 focused tests andcheck:pr --base origin/epic/2542-dead-codepass (1346 pass, 0 fail), and a fresh ready proof is requested.chore(ui-sdk): drop 66 internal re-exports no other package uses (#3413)
Merge pull request #3570 from schlessera/epic/2542-dead-code