Repository navigation
refactor(contracts): move the command-runtime contracts the daemon reads into @agent-device/contracts - #3394
Conversation
Size Report
Startup median (7 runs, lower is better):
|
6255546 to
8b8f171
Compare
There was a problem hiding this comment.
All reported issues were addressed across 92 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
|
I found no code problems in 8b8f171, and all 19 checks pass at that head, including the layering and eager-closure gates this move exercises. There are no conflicts, and nothing blocks merge. Not blocking: the three-line header comment in https://github.com/callstack/agent-device/blob/8b8f171/src/sdk/io.ts#L1 narrates the move, which AGENTS.md keeps out of implementation comments. You can drop it or cut it to one line saying the entry re-exports the contracts artifact-adapter vocabulary. Take it or leave it. Could this be smaller? I looked and found nothing. The production change is net +33 lines, mostly import repointing, and the move is the smallest way to remove the daemon's type edges into the command-runtime code in src/. The only extra seam is the sdk/io.ts re-export, which the public entry needs. One open thread still applies: the cubic-dev-ai P2 on command-policy.test.ts (#3394 (comment)). The test never asserts I did not run |
Address #3394 review: assert restrictedCommandPolicy() refuses local output paths, and cut the src/sdk/io.ts header to what the entry exports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8b8f171 to
8b1743c
Compare
|
Rebased onto main (picks up #3393/#3373; eager-closure budgets, layering and the size ratchet pass on the rebased tree) and addressed the review in 8b1743c:
|
Address #3394 review: assert restrictedCommandPolicy() refuses local output paths, and cut the src/sdk/io.ts header to what the entry exports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8b1743c to
aa31c38
Compare
|
The code looks good at aa31c38, and both items from the earlier review (#3394 (comment)) are fixed. The change since 8b8f171 is one test assertion and a one-line comment. All 19 of 19 checks pass at this commit, and I know of no conflicts. I did not run the layering, eager-closure or size gates locally, so for the rebased tree I rely on your statement and the green CI. I also did not build or inspect the emitted dist io.d.ts. The one cubic-dev-ai P2 thread is fixed at head, since packages/contracts/src/command-policy.test.ts:8 now asserts that restrictedCommandPolicy().allowLocalOutputPaths is false, so you can resolve it: #3394 (comment). Nothing else stands between this PR and merge. |
|
Closing verification at head
Heads-up (not this PR): |
…ads into @agent-device/contracts Lift the pure declarations out of the root command-runtime zone so no daemon file type-imports it: the backend surface (src/backend.ts), the runtime vocabulary (src/runtime-contract.ts), the artifact-adapter vocabulary (split from src/io.ts, whose node:fs implementation stays), the routed snapshot-option flags (src/backend-snapshot-options.ts), and the local/restricted CommandPolicy presets (from src/command-runtime/runtime-factory.ts). The io.ts type/impl split keeps the published agent-device/io surface unchanged through the public src/sdk/io.ts entry. Consumers now import the vocabulary from @agent-device/contracts directly.
…contracts Delete the moved modules' ROOT_MODULE_ZONES rows (command-runtime keeps src/io.ts and src/runtime.ts), pin the contracts exports snapshot for the five new subpaths (generate-contracts-exports-snapshot.ts), refresh the root-module and tracked-sources path examples, drop the retired src/runtime.ts re-export suppressions from .fallowrc, and drop the retired src/backend*.ts clause from ADR 0019's not-migration-target list.
Address #3394 review: assert restrictedCommandPolicy() refuses local output paths, and cut the src/sdk/io.ts header to what the entry exports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aa31c38 to
c28b046
Compare
|
Summary
Daemon-extraction PR 4a. Moves the pure command-runtime contracts the daemon reads out of the root
command-runtimezone into@agent-device/contracts(new narrow subpaths./backend,./runtime-contract,./artifact-adapter,./backend-snapshot-options,./command-policy), so no daemon file keeps a type edge intosrc/command runtime. Value imports ofcreateCommandSurfaceAgentDevicestay for PR 4b.Moved declarations (no behavior change): the backend surface (
src/backend.ts, R093 rename), the runtime vocabulary (src/runtime-contract.ts, R097), the artifact-adapter vocabulary split fromsrc/io.ts(the node:fs implementation stays; the publishedagent-device/iosurface is unchanged via the publicsrc/sdk/io.tsentry),snapshotOptionsToFlags(src/backend-snapshot-options.ts, R100, test included), and theCommandPolicypresets (fromsrc/command-runtime/runtime-factory.ts, test added at the new owner). 78 consumer files repointed: 66 undersrc/outside the daemon, 11 daemon files, 1test/harness.Owner rationale: R18 holds contracts to vocabulary free of host/process/timer mechanics — these declarations are pure types plus literal/pure functions (contracts already carries pure functions like
screenshotFlagsFromOptionsand depends only on kernel), and contracts sits below the daemon on the spine, so no new package is justified. No existing contracts export changed shape; only five subpaths were added (export snapshot pinned viagenerate-contracts-exports-snapshot.ts). Known debt the move makes visible:BackendSnapshotResulthere vssnapshot-types.ts(different producer/client shapes; unifying is behavior change, not a move).Remaining daemon → command-runtime edges (
pnpm depgraph): exactly 4 value edges, allcreateCommandSurfaceAgentDevice→command-runtime/runtime-command-surface.ts, frominteraction/internal/interaction-runtime.ts,screenshot-runtime.ts,selector-runtime-backend.ts,snapshot-command-runtime.ts.Validation
Tested commit
8b8f1714e. Serially, all pass:pnpm install --frozen-lockfile && pnpm build,pnpm format,pnpm check:quick,pnpm check:layering,pnpm check:di-seams,pnpm build, pluspnpm check:daemon-wire-compat,pnpm check:gate-manifest,pnpm check:production-exports, andpnpm check:affected --run(449 related test files passed, including the moved backend-snapshot-options.test.ts and the new command-policy.test.ts at their paths).depgraph summary diff: 1817→1819 files, 9721→9730 edges; R4 0→0, R5 0→0, R6 11→11;
src/daemon.tseager closure 650→651 (ADR 0027 pure-split tolerance; eager-closure gate green); zone SCCs 0→0. Unresolved risks: none local; provider-integration/coverage lanes are CI-owned and were selected bycheck:affected.