refactor(daemon): move wire request and response types out of the daemon package

TH
4h ago
+592-735

Summary

Step L1 of the daemon single-entrypoint stack: the wire request/response types leave @agent-device/daemon, and src/daemon-client no longer imports the daemon package at all.

  • src/daemon-client, src/client, src/remote and the CLI's wire-typed code use DaemonWireRequest from @agent-device/contracts/command and DaemonResponse/DaemonArtifact/DaemonResponseData from @agent-device/kernel/contracts.
  • packages/daemon/src/core/daemon-request.ts keeps only the daemon's own DaemonRequest (wire request plus internal) and DaemonInvokeFn; the response aliases are gone and daemon internals import from kernel.
  • R78 (daemon-client-entry) bans any src/daemon-client → daemon-package edge; R10 (daemon-modularity) bans any production importer of daemon-request.ts/session-state.ts outside the daemon. Both inventories were empty after the move, so both rules became flat bans.
  • Wire-compat ledger: changed digests are acked as compile-time type-name moves only (no serialized field changed); DaemonWireRequest/DaemonWireRequestMeta are waived in the closure policy as narrowings of the listed kernel types.

Not in this PR

The CLI and remote code still import value/type modules from the daemon package (session-artifact-paths, daemon-stop, the device-claim modules, platform-request-scope, DaemonCommandRoute). Moving those, and banning @agent-device/daemon under src/cli*, src/client, src/remote and src/daemon-client, is the next layer (L1b, #3625), stacked on this branch (stack #3626).

Two commits: the implementation, then the enforcement edits (chore(gates): …).

Validation

On head 7d007f5cf: pnpm format:check, pnpm typecheck, pnpm lint, pnpm check:layering, pnpm check:daemon-wire-compat and pnpm check:affected --run pass. One check:affected run hit a process-spawn timing failure in src/__tests__/daemon-registration-owner.test.ts (untouched by this diff); it passes in isolation twice and in the full rerun. No device-facing behavior changes.

šŸ¤– Generated with Claude Code