Reduce unsafe casts at browser and third-party integration boundaries.
Several integration points rely on as any or unknown as casts (terminal internals, speech recognition, add-on internals, generic trigger props). This spec introduces typed adapters and narrow interfaces to improve maintainability and make type errors actionable.
This workstream owns:
packages/app/src/components/terminal.tsxpackages/app/src/utils/speech.tspackages/app/src/addons/serialize.tspackages/app/src/components/dialog-select-model.tsxpackages/app/src/utils/** related to adapter typingThis workstream must not edit:
components/dialog-select-server.tsx, components/status-popover.tsx, context/server.tsx (spec 14)components/prompt-input.tsx (spec 11)as any appears in serialize.ts and speech.ts.unknown as casts in terminal.tsx for option/disposable access.dialog-select-model.tsx use as any spread.windowisDisposable(value): value is { dispose(): void }hasSetOption(value): value is { setOption(...): void }setOption, disposal cleanups) to typed guards.serialize.ts as any internals with explicit local interface.dialog-select-model.tsx as any trigger props cast via stricter generic typing.as any remains in the scoped files (or document unavoidable cases inline).unknown as usage in scoped files is minimized and justified.bun run typecheck (from packages/app).e2e/terminal/terminal.spec.tse2e/models/model-picker.spec.ts