refactor(daemon): inject the command surface as a port

Merged
TH
2mo ago
+1170-38

Summary

Stacked on #3394. The daemon stops importing createCommandSurfaceAgentDevice: the composition root (src/daemon.ts) supplies it as the required createCommandSurface port, typed by CreateDaemonCommandSurface in @agent-device/contracts/daemon-command-surface. The port is an async factory kept behind await import in the executable, so the command surface loads on first request use — the daemon entry's eager closure stays at the merge-base's 470 modules. Threading path: RequestRouterDeps -> request-handler-chain params -> session/snapshot/find/interaction handlers -> generic dispatch -> execution runtimes (interaction, screenshot, selector, snapshot, sparse-fallback, generic-settle, session-open), whose four construction sites await the port. Behavior unchanged; the field stays required, so 146 test param-bag literals gained one line via a shared fixture (src/daemon/__tests__/command-surface-fixture.ts). No assertions changed except three exact-forward-shape tests that now include the port.

Diff budget: the production change is ~490 lines (29 files); the rest is the mechanical AST-codemod insertion of the required createCommandSurface fixture line into 146 test param bags, and splitting it out would leave an intermediate commit that does not type-check.

Validation

Commit 7c4f6b716 (stack rebased onto current main via #3394, then replayed). pnpm build, pnpm check:quick, pnpm check:layering, pnpm check:di-seams, test-file size ratchet, and pnpm check:affected --run pass on this head. Depgraph query: zero edges from daemon/** production nodes to command-runtime/** or commands/** nodes (jq on .tmp/depgraph/graph.json); the only edge into command-runtime/runtime-command-surface.ts originates from the daemon.ts executable (the dynamic-import seam).