Repository navigation
refactor(move): move remaining daemon-only and shared core modules to their owners - #3400
Conversation
… owners The daemon stops importing src/core except at the composition root: - core/dispatch-context.ts -> src/daemon/dispatch-context.ts: its only importer is src/daemon/context.ts, so the daemon owns it. - core/interaction-response-data-transform.ts -> src/daemon/interaction/ internal/: only the daemon touch-response route imports it. - core/doctor-output.ts -> packages/host-kit/src/doctor-lines.ts: status-marker presentation shared by the daemon doctor handlers (static) and the CLI (dynamic); host-kit is the lowest package both can import, so it sits beside the markers it formats. - core/deploy-result-target.ts -> packages/contracts: the pure public-app-target precedence both the daemon deployment handlers and the CLI/MCP serializers render as "Installed: <target>". - core/interaction-outcome.ts -> packages/host-kit: the error-attached resolved-target side channel has an attach (commands) and a read (daemon) side; R18 keeps the mutable WeakMap lifecycle out of contracts, and host-kit owns the request-scoped mechanics seam. - core/status-markers.ts -> packages/host-kit: CLI/daemon shared presentation marker formatting; host-kit is the lowest package both can import. Tests move 1:1 with their sources; all consumers updated directly with no re-export shims.
…moves - packages/contracts exports ./deploy-result-target; contracts exports snapshot regenerated. - packages/host-kit exports ./doctor-lines, ./interaction-outcome and ./status-markers; R11 host-kit export pin extended. - R18 planted-ban message names @agent-device/host-kit/interaction-outcome as the WeakMap lifecycle owner instead of the retired src/core home.
Size Report
Startup median (7 runs, lower is better):
|
39a28a7 to
586a714
Compare
|
I found no problems in the code at 586a714. The diff is import-path rewires, package.json export entries and layering snapshots, and all 20 checks pass, including the layering, fallow and size jobs that cover those surfaces. There are no conflicts. I did not run the depgraph, eager-closure or fallow checks locally, so the numbers in the PR body (R4 0, R5 0, R6 11, eager closure 650/647) rest on CI and your report. I also did not run the moved tests, since they are pure renames and CI is green. I did not check that the doctor-lines dynamic import in |
|
#3393 split http-server.ts into http-authorization/http-rpc-envelope/ http-rpc-methods (daemon-server) and #3400 moved dispatch-context (daemon-core: pure flag vocabulary read by core's context.ts) and interaction-response-data-transform (daemon-execution, beside its touch-response consumer) into the daemon; the exhaustive manifest follows, verified upward-edge-free at the new head.
#3391) * chore(gates): add the daemon layer manifest and R81 daemon-layer rule Partition every production file under src/daemon/ into five local layers (core < resources < execution < sessions < server) with an exhaustive machine-readable manifest, and verify it: reject upward static value and type-only edges, report dynamic cross-layer edges without rejecting them, and fail on omitted, duplicated, or untracked manifest entries. No files move; the global spine rank stays 4 for all five layers. * chore(gates): R81 rejects a declared layer that owns no files An empty layer array kept a phantom position in the daemon layer order after its last file moved; reject it, and isolate the orphaned-file test from the empty-layer check. * chore(gates): layer the five daemon files main gained since the seed #3393 split http-server.ts into http-authorization/http-rpc-envelope/ http-rpc-methods (daemon-server) and #3400 moved dispatch-context (daemon-core: pure flag vocabulary read by core's context.ts) and interaction-response-data-transform (daemon-execution, beside its touch-response consumer) into the daemon; the exhaustive manifest follows, verified upward-edge-free at the new head.
Summary
PR 9 of the daemon-extraction plan. The daemon no longer imports
src/core/except through the composition root. Pure moves plus direct consumer rewires; no re-export shims, no behavior change. 26 files, ~55 changed lines.core/dispatch-context.ts→src/daemon/dispatch-context.ts— sole importer isdaemon/context.ts.core/interaction-response-data-transform.ts→src/daemon/interaction/internal/— sole importer is the daemon touch-response route.core/doctor-output.ts→@agent-device/host-kit/doctor-lines— presentation shared by the CLI (dynamic) and the daemon doctor handlers (static); the lowest common owner is host-kit, beside thestatus-markersit formats. Keepscommandsout ofdaemon/handlers(prevents a rank-3 → rank-4 inversion).core/deploy-result-target.ts→@agent-device/contracts/deploy-result-target— pure precedence vocabulary shared by daemon deployment handlers and CLI/MCP serializers.core/interaction-outcome.ts→@agent-device/host-kit/interaction-outcome— commands attach, daemon reads. The plan suggested contracts; R18's planted ban refuses mutable WeakMap lifecycle there, so it lands in host-kit, the shared mechanics seam below both. R18's message names the new owner.core/status-markers.ts→@agent-device/host-kit/status-markers— host-kit is the lowest package both CLI and daemon import.Remaining daemon → core edges:
daemon/server/daemon-runtime.ts → core/interactors.ts(composition root, leaves in PR 6) plus test-tree reads ofcore/interactors*/core/platform-plugin-registry. Graph scan confirms zero static/type/dynamic edges fromcommands/**orcli/**intodaemon/handlers/**.Validation
Commit
586a714.pnpm install --frozen-lockfile && pnpm build,pnpm format,pnpm check:quick,pnpm check:layering(312 pass),pnpm check:fallow --base origin/main(clean),pnpm check:affected --run(all runnable checks passed),pnpm vitest run scripts/__tests__/test-file-size-ratchet.test.ts(pass), moved tests discovered and green at new paths.Depgraph summary unchanged vs
origin/main: 1,817 files / 9,721 edges / 44 zones; R4 0, R5 0, R6 11; daemon.ts eager closure 650,daemon-runtime.tsbranch 647.Touches
packages/contracts/package.jsonas one self-contained./deploy-result-targetentry for a trivial rebase against #3394/#3395.