refactor(mcp): project system family output schemas from their owning module
Summary
Moves the 10 hand-authored MCP outputSchema entries for the system-family commands (back, home, orientation, app-switcher, fold, action-button, tv-remote, clipboard, appstate, keyboard) out of src/mcp/command-output-schemas.ts into a SYSTEM_COMMAND_OUTPUT_SCHEMAS map exported from the owning module, src/commands/system/index.ts, registered in PROJECTED_FAMILIES per the #2810 projection seam. Each family's schemas live next to the command they describe instead of in one large hand-authored file.
Test coverage for these schemas moves out of the legacy aggregations into a colocated command-tools-system-schemas.test.ts, including a reference-equality proof that the composed map holds the module's own object (not a copy) for every entry, and a bidirectional ownership check (module <-> registry) after review.
constSchema is now shared from src/commands/command-input.ts instead of being duplicated between this module and command-output-schemas.ts. FOLD_SCREEN_COORDINATE_SPACE's declaration moved to device-rotation.ts, which this module already loads through the @agent-device/contracts/device facade, so importing it no longer pulls fold-runtime.ts into the CLI's eager module closure; fold-runtime.ts still exports the same value on its published subpath (type-checked against the new declaration) for existing external consumers.
Part of #2819. 8 files touched, no behavior change.
Validation
Tested at c02b2c766e3b769eafcc4b8b0e57d08329b315ee.
pnpm check:affected --run: 554 test files / 4260 tests passed, all runnable checks passed (format, lint, typecheck, layering, fallow, build, vitest-related).- Not device-facing (pure MCP schema move); the issue's required proof is a byte-identical published-schema comparison instead. Dumped
COMMAND_OUTPUT_SCHEMASfor all 10 migrated commands via a small Node script importingsrc/mcp/command-output-schemas.tsdirectly (Node 26 native TS), once onorigin/mainand once on this head:diff before.json after.jsonprinted no differences ("IDENTICAL") -- the composed map is unchanged for all 10 keys. - Mutation check: temporarily made
fold's spread entry a shallow copy instead of referencing the module's own object; this failed both the reference-equality test and the extended disjointness test, confirming the tests guard the "not a copy" invariant. Reverted before committing. - Coverage: the CI Coverage job failed on the previous head because
src/commands/system/index.tsimportedFOLD_SCREEN_COORDINATE_SPACEfrom@agent-device/contracts/fold-runtime, a module the CLI closure did not otherwise load (295 -> 296 modules,eager-closure-budgets.test.ts). Fixed by relocating the declaration todevice-rotation.ts(already loaded via thedevicefacade);fold-runtime.tsstill exports the constant as a literal (not a re-export) so its own published subpath's closure does not grow either, and a type-only import of the newFoldScreenCoordinateSpacealias makes any drift between the two a compile error.pnpm check:affected --runpasses the closure gate locally and Coverage is green on this head. - Compatibility: an automated review flagged that the first version of this fix dropped
FOLD_SCREEN_COORDINATE_SPACEfrom the released@agent-device/contracts/fold-runtimesubpath (in npm since v0.21.9), which would have broken existing importers. Fixed as described above -- the value ships from both subpaths, type-locked to one declaration.
No unresolved risk.