refactor(daemon): add the single package entry and resolve its metadata consumers
Summary
Layer 2 of the daemon single-entrypoint stack (after #3616 and #3625): @agent-device/daemon gets its public API in one file, and the seven production subpaths collapse into it.
packages/daemon/src/index.tsis the package boundary: explicit named re-exports, noexport *. The one value isstartDaemonRuntime. The rest are types the composition and platform-runtime modules name (ComposeDaemonRuntimeDeps,DaemonRuntimeController,DaemonRuntimeDeps,DaemonRuntimeDepsInput,DaemonPlatformServices,PlatformOwnerLifecycle,PlatformResourceCleanup,DaemonRequest,DaemonInvokeFn).exportsdrops./server/daemon-runtime,./platform-owner-lifecycle,./platform-resource-cleanup,./platform-services,./daemon-request,./daemon-command-registryand./route-owner-files, and gains..src/daemon.ts,src/daemon-composition.tsandsrc/platform-runtime-*import@agent-device/daemon.- Metadata consumers resolved at their owner:
route-owner-fileswas tooling metadata keyed bycommand-registry's ownDaemonCommandRoute. It now sits beside the per-command claims in@agent-device/command-registry/owner-files(existing subpath). The scripts, the CLIcommand-explaintest,command-surface-metadata, andowner-files-no-leakread it there, so none of them depend on the daemon.daemon-command-registrystays daemon-owned: its queries takeDaemonRequest, and ~50 daemon modules use them. Its outside consumers no longer need it.scripts/depgraph/affected-run.tsandcommand-descriptor-parity.test.tsreadderiveDaemonCommandDescriptors(commandDescriptors).command-descriptor-ref-frame-effect.test.tstests the daemon query, so it moved topackages/daemon/src/core/__tests__/unchanged apart from its import.- The three
daemon-client-abort*.test.tsfiles declare a local(req: DaemonWireRequest) => Promise<DaemonResponse>instead of importingDaemonInvokeFn.
- R81 allows
packages/daemon/src/index.tsas the one production file at the daemon root, with a test. - Eager closure:
packages/daemon/src/index.tsis a new entry evaluating 372 modules, which isstartDaemonRuntime's server graph. It carries anAPPROVED_OVER_CEILINGrow (#3352).src/daemon.tsand every existing entry stay under the no-growth rule. The stale maestro row is removed, because #3623 is now in the merge-base and the gate requires it. - Docs: ADR 0033's export-surface section describes the single entry. ADR 0019 notes that
DaemonPlatformServicesis exported from it. ADR 0032 and AGENTS.md state no changed path.
Transitional testing subpaths
Two ./testing/* entries are added, each deleted with its consumers in the relocation layers:
./testing/server/daemon-runtime: the fourteardownDaemonSessionForShutdowntests undersrc/__tests__/daemon-composition/server../testing/daemon-command-registry:test/integration/nightly/concurrency-torture/bindings.ts, which deliberately consumes the production lock decision.
Subpath exports
| Package | Before | After |
|---|---|---|
daemon | 107 (7 production + 100 testing) | 103 (. + 100 testing + 2 transitional) |
command-registry | 21 | 21 (owner-files already existed) |
daemon-contracts, host-kit, test-kit, kernel | unchanged | unchanged |
Validation
On the pushed head: pnpm check:quick, pnpm check:layering, pnpm check:fallow, pnpm check:gate-manifest, pnpm check:production-exports, pnpm check:affected --run, pnpm format:check, and after pnpm build: check:bundle-owner-files, check:package, check:doc-prose. The wire-compat ledger is untouched.
Not in this PR: moving the ./testing/* consumers into the package (next layers). The handoff notes name two candidates that may need a decision there: the client abort tests, which run the real client against the real daemon transport, and the nightly concurrency-torture bindings.
š¤ Generated with Claude Code