refactor: extract daemon client workspace package

Merged
TH
11h ago
+2277-1131

Summary

Extract daemon transport, request guards, lifecycle and launch identity into private @agent-device/daemon-client. Its single entry names APIs explicitly; lifecycle implementations stay lazy. Related: #3276.

Scope: 171 files, mainly moves and consumer rewiring. Fingerprints live in plugins; RPC envelopes live in contracts. Root composition tests retain real registered-daemon and MCP coverage.

Production observation and recorded-daemon tools now share one admission reader. Missing/foreign registrations retain nullable/not-running behavior. Present unreadable, corrupt or unusable records retain their metadata and fail with daemon-record-unreadable; unproven ownership keeps its refusal. Pinned clients retain binding-mismatch diagnostics. Benchmark refusals preserve cell-state and both errors if cleanup fails. PID/port decoding and error constructors each have one owner, without value cycles.

Rebased onto 3a218f573f after #4097, preserving both package configurations.

Review fixes document provider trimming and verbatim envelope forwarding, preserve the virtual drain's real exit/deadline checks, and compare shared build-output contents rather than directory timestamps.

Validation

Tested head: aac253f77ecb06fe10e850943fab631a1e5b5fb2.

  • pnpm check:affected --run --head HEAD: passed at the exact unchanged commit (run-GFwZPd). Entry closure remains 126; main merge-tree is clean.
  • Focused package/tooling, composed cleanup and owner-file bundle tests passed. Isolated regression experiments detect corrupt-to-absent admission, lost benchmark classification and in-place bundle overwrites; the old timestamp guard misses the overwrite. Static error imports grow closure from 126 to 130, so laziness is retained.
  • Earlier cross-build smoke remains attributed to bc137013e83a; no new manual device run. Fresh GitHub native lanes, Coverage and configured reviews must pass at this published head.