Repository navigation
refactor(daemon): relocate the daemon client out of src/daemon #2342
Description
Activity
Seam inventory re-derived from the tree — six corrections
This issue was written against
mainat27a97ee; five merges later its "Remaining server and root seams" section no longer matches the tree. Following the precedent set in #2335's second comment, every entry below was re-derived onmainatbd08e6e, file by file, rather than carried over. Implemented in #2360.1.
core/replay-divergence.tsis missing from the listdaemon-client-lifecycle.ts:6importsreadReplayDivergenceResumefromsrc/core/replay-divergence.ts(513 lines). The issue namescore/lease-scope.tsfrom the RPC layer but not this one, so a reader working the list would conclude the client has a singlesrc/coreseam. It has two.2.
src/commands/management/output.tsis not a consumerThe Purpose section lists it "(via B)". B (#2349) deleted
doctor-progress.tsoutright, and nothing undersrc/commands/imports the client onmain. The four production consumers aresrc/cli.ts,src/agent-device-client.ts,src/cli/commands/proxy.tsandsrc/cli/injected-daemon-dispatch.ts(type-only).3. The size figure
9 files / 2,466 lines, not 2,416: 8 production modules totalling 2,386 lines plus the colocated
daemon-client-rpc.tstest (80). The__tests__/directory adds a further 3,862 lines that move with them.4. The consumer list omits everything that is not production
src/A relocation has to carry all of it, and it is the bulk of the diff: 9 files under
src/__tests__/(includingtest-utils/boundary-fault-matrix.ts, which stores client test paths as evidence strings),src/commands/batch/cli.test.ts, twotest/integration/*-e2elive harnesses, fourtest/wire-compat/gate files (surface.ts,closure-policy.ts,ledger.json,wire-mutations.test.ts),scripts/ios-snapshot-benchmark/cell-admission.ts,oxlint.config.ts,fallow-baselines/health.json,scripts/layering/model.ts, and ADR 0016.5.
DAEMON_MODULARITY_BASELINEinteracts with the move; the issue does not say soR10 counts external importers of the daemon request/session-state modules by the
src/daemon/path prefix. The client's fivedaemon-request.tsedges were invisible to it only because the client sat inside that prefix. Relocating makes them external — so the completion condition "check:layeringgreen (…DAEMON_MODULARITY_BASELINE)" is not free. #2360 records the five files in the list rather than widening the prefix: the set can only shrink, so a newsrc/daemon-client/module reachingsession-state.tsstill fails, which a prefix skip would not catch. Its size assertion now reads the recorded list instead of the literal2.6. The eager-closure condition needs a second extraction
"eager-closure budgets green for
src/cli.ts" is a no-growth rule, and the required tombstone-reader extraction adds one module to that closure. Removing the client'ssession-store.tsedge does not offset it, becausesrc/cli.ts:10importssession-store.tsdirectly for one pure path helper,resolveRemoteRequestDiagnosticsPath— as doessrc/remote/remote-request-diagnostics.ts:29. #2360 therefore also moves the four session-artifact path helpers tosrc/daemon/session-artifact-paths.ts.src/cli.tsdrops from 379 to 365 eagerly evaluated modules and no longer loads the daemon's session store at all.Confirmed as written
config.ts113,daemon-process.ts122,request-progress-protocol.ts48,core/lease-scope.ts258 (kernel-only) — all four line counts and the lease-scope characterisation hold.src/daemon/types.ts,src/daemon/code-signature*.ts,src/command-catalog.ts,src/core/command-descriptor/andclient/doctor-progress.tsare all gone fromsrc/daemonas the blockers promised.src/remote/daemon-artifacts.tsdoes import the daemon request types andrecording/output-path.ts;src/remote/remote-request-diagnostics.tsdoes importsession-store.ts. And the load-bearing premise holds: no file undersrc/daemon/imports the client — the only two mentions are comments in replay tests.
Generated by Claude Code
Part of #2335.
Purpose
src/daemon/client/(9 files, 2,416 lines; zonedaemon-client, rank 5) is the daemon's client, not the daemon. No daemon file imports it; its consumers aresrc/cli.ts,src/agent-device-client.ts,src/cli/commands/proxy.ts,src/commands/management/output.ts(via B) andsrc/cli/injected-daemon-dispatch.ts(type). Relocating it makessrc/daemonserver-only. This issue is a relocation; it does not promise a package.Remaining server and root seams (inventory to carry into the PR)
src/daemon/config.ts(113, pure over host-kit/kernel),src/daemon/daemon-process.ts(122, host-kit),src/daemon/request-progress-protocol.ts(48, imports the request types C splits).src/daemon/code-signature*.ts— moved by E.src/daemon/session-store.ts→findUnrecoveredRepairCommitFailurefromdaemon-client-lifecycle.ts:17: a disk reader of session artifacts, to be extracted below both client and store.src/core/lease-scope.ts(258, kernel-only) from the RPC layer.src/remote/daemon-artifacts.ts(imports daemon types andrecording/output-path.ts) andsrc/remote/remote-request-diagnostics.ts(importssession-store.ts).src/command-catalog.ts,core/command-descriptor/registry.ts,timeout-policy.ts— A's package.src/daemon/types.tswire types — C's request module.src/daemon/client/doctor-progress.ts— deleted by B.Required behavior
src/daemon-client/(zone name unchanged;targetDagZoneinscripts/layering/model.tsupdated from thesrc/daemon/client/prefix). Rank stays 5.src/daemon/*are reduced to the named shared kernel:config.ts,daemon-process.ts,request-progress-protocol.ts, the extracted session-artifact reader, and C's request module.test/integration/smoke-cliand the daemon lifecycle tests pass unchanged.Completion conditions
src/daemon/client/no longer exists;src/daemoncontains only server code plus the shared kernel modules listed above.src/daemonandsrc/remoteimport from the relocated client, each with its seam named; the list is the input to any later packaging decision.check:layeringgreen (R5, R6 type-inversion ratchet,DAEMON_MODULARITY_BASELINE), eager-closure budgets green forsrc/cli.ts.Dependencies
Blocked by A, B, C, E.