Repository navigation
Description
Part of #1345.
Context
Split from #1374 on 2026-10-24; the ruling below was made there.
The SDK's only source use of @schlessera/brain-ui-kit is the link policy in the show_block bridge tool: classifyLink and refusalSentence from @schlessera/brain-ui-kit/links (packages/ui-sdk/src/server/bridge-tools/show-block.ts:1). The kit's /links entry only re-exports @schlessera/brain-render-template/links (packages/ui-kit/src/links.ts:1-2), so the SDK reaches render-template through the kit. For that one import the SDK declares a runtime dependency on the kit (packages/ui-sdk/package.json:105), and the allowed-edge table records it (tests/allowed-edges.ts:75-78). Comments still name the kit as the policy's home (packages/ui-sdk/src/tool-contracts/blocks.ts:34, :423).
What that edge costs (from the 2026-10-22 review on #1374):
- React peer leak.
packages/ui-kit/package.jsondeclaresreactandreact-domas required peers and depends onlucide-react. Through the SDK's dependency on the kit, a server-only consumer such as a backend inherits a required React peer, contradicting the SDK README's statement that its own optionalreactpeer "is only exercised by./client". - Workspace cycle.
packages/ui-kit/package.jsondevDepends on@schlessera/brain-ui-sdk, so the manifests form ui-sdk → ui-kit → (dev) ui-sdk. Removing the SDK's runtime edge removes the cycle.
Maintainer decision — link-policy A (2026-10-09, on #1374)
The SDK imports directly from the public @schlessera/brain-render-template/links entry. The policy already lives there; do not copy or reimplement it. Approve SDK→render-template and remove SDK→ui-kit once all SDK uses of the kit are migrated. Update the dependency manifest and allowed-edge gate together. Keep the kit's public /links compatibility export, and preserve identical show_block/link/tracker validation and rendering verdicts. Correct stale ownership comments; no behavior or policy change is approved.
Scope
- Import
classifyLinkandrefusalSentencefrom@schlessera/brain-render-template/linksinshow-block.ts, and any other SDK use of the kit. - Add
@schlessera/brain-render-templateto the SDK'sdependencies, remove@schlessera/brain-ui-kit, and updatetests/allowed-edges.tsin the same change. - Correct the stale comments in
packages/ui-sdk/src/tool-contracts/blocks.ts.
Out of scope
- The kit's
/linkscompatibility export (stays). - The kit's devDependency on the SDK (it stops being a cycle once this lands; removing it is not required here).
- Any link, tracker or
show_blockpolicy change. Web-search (backends: pi owns its web-search configuration helpers behind a public Settings adapter #1374), geo aliases (ui-sdk: remove the geo compatibility aliases from the SDK's public server entry #2770).
Acceptance criteria
-
git grep -n 'brain-ui-kit' -- packages/ui-sdk/src packages/ui-sdk/package.jsonreturns no import and no dependency. -
tests/allowed-edges.tslists@schlessera/brain-render-templateand not@schlessera/brain-ui-kitfor the SDK, andbun run test tests/dependency-edges.test.tspasses. - No package in the SDK's runtime
dependenciesdeclares a requiredreactorreact-dompeer. - Real
show_blockhandler and card fixtures keep the same accepted/refused link and tracker verdicts, including nonempty refusal controls. - A mutation that points
show-block.tsat a divergent policy fails the agreement assertion, recorded in the PR. - A packed install of the SDK resolves its server handlers and browser/worker entries without the kit.
Verification
git grep -n 'brain-ui-kit' -- packages/ui-sdk/src packages/ui-sdk/package.json
bun run test packages/ui-sdk tests/dependency-edges.test.ts
bun run typecheckContract impact
None on exports, wire or schemas. The SDK's published dependency set changes (render-template replaces ui-kit, dropping a transitive required React peer); record it in a minor changeset.
2026-10-24: filed from #1374's split, folding in the 2026-10-22 review's React-peer and cycle findings and its suggested criteria.
Activity