Skip to content

Commit 719b1d4

Browse files
committed
refactor(move): extract the daemon-contracts zone into packages/daemon-contracts
The ten files of the daemon-contracts zone (the nine root modules declared by ROOT_MODULE_ZONES plus src/daemon-contracts/daemon-diagnostics-scope.ts) move behind a workspace-package boundary with narrow per-file subpath exports. The shared daemon/client placement from #2559 and the #3288 zone declaration become physical: R11 and the package manifest hold the boundary where the per-file rows held it before. Consumers switch from relative specifiers to @agent-device/daemon-contracts/<file>; the tests move with their sources. Behavior is unchanged.
1 parent c2c09d4 commit 719b1d4

108 files changed

Lines changed: 302 additions & 138 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎examples/sdk/tsconfig.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
{ "path": "../../packages/capture-kit" },
4040
{ "path": "../../packages/command-registry" },
4141
{ "path": "../../packages/contracts" },
42+
{ "path": "../../packages/daemon-contracts" },
4243
{ "path": "../../packages/device-selection" },
4344
{ "path": "../../packages/host-kit" },
4445
{ "path": "../../packages/kernel" },

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@
293293
"@agent-device/capture-kit": "workspace:*",
294294
"@agent-device/command-registry": "workspace:*",
295295
"@agent-device/contracts": "workspace:*",
296+
"@agent-device/daemon-contracts": "workspace:*",
296297
"@agent-device/device-selection": "workspace:*",
297298
"@agent-device/host-kit": "workspace:*",
298299
"@agent-device/kernel": "workspace:*",

‎packages/contracts/src/request-progress.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Progress events the daemon streams to a connected client while a request runs.
33
*
4-
* These are wire values: `src/request-progress-protocol.ts` serializes them onto the
4+
* These are wire values: `packages/daemon-contracts/src/request-progress-protocol.ts` serializes them onto the
55
* response stream and the CLI reconstructs them before handing them to the replay-test
66
* reporter registry. They therefore belong to neither side — the daemon's request-global
77
* progress plumbing carries them, and the replay-test scheduler produces and interprets
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"name": "@agent-device/daemon-contracts",
3+
"version": "0.0.0",
4+
"private": true,
5+
"type": "module",
6+
"description": "On-disk and wire contracts a daemon process shares with its clients (#2559): state-dir and transport resolution, registration and ownership, process liveness, shutdown reports, the repair tombstone, progress-envelope framing, the diagnostics scope, and owner-cleanup vocabulary. Internal workspace package bundled into the published agent-device artifact.",
7+
"dependencies": {
8+
"@agent-device/command-registry": "workspace:*",
9+
"@agent-device/contracts": "workspace:*",
10+
"@agent-device/host-kit": "workspace:*",
11+
"@agent-device/kernel": "workspace:*"
12+
},
13+
"exports": {
14+
"./daemon-diagnostics-scope": {
15+
"types": "./src/daemon-diagnostics-scope.ts",
16+
"default": "./src/daemon-diagnostics-scope.ts"
17+
},
18+
"./daemon-owner-cleanup": {
19+
"types": "./src/daemon-owner-cleanup.ts",
20+
"default": "./src/daemon-owner-cleanup.ts"
21+
},
22+
"./daemon-policy-file": {
23+
"types": "./src/daemon-policy-file.ts",
24+
"default": "./src/daemon-policy-file.ts"
25+
},
26+
"./daemon-process": {
27+
"types": "./src/daemon-process.ts",
28+
"default": "./src/daemon-process.ts"
29+
},
30+
"./daemon-registration": {
31+
"types": "./src/daemon-registration.ts",
32+
"default": "./src/daemon-registration.ts"
33+
},
34+
"./daemon-registration-owner": {
35+
"types": "./src/daemon-registration-owner.ts",
36+
"default": "./src/daemon-registration-owner.ts"
37+
},
38+
"./daemon-resolution": {
39+
"types": "./src/daemon-resolution.ts",
40+
"default": "./src/daemon-resolution.ts"
41+
},
42+
"./daemon-shutdown-report": {
43+
"types": "./src/daemon-shutdown-report.ts",
44+
"default": "./src/daemon-shutdown-report.ts"
45+
},
46+
"./request-progress-protocol": {
47+
"types": "./src/request-progress-protocol.ts",
48+
"default": "./src/request-progress-protocol.ts"
49+
},
50+
"./session-repair-tombstone": {
51+
"types": "./src/session-repair-tombstone.ts",
52+
"default": "./src/session-repair-tombstone.ts"
53+
}
54+
}
55+
}

src/daemon-contracts/daemon-diagnostics-scope.test.ts renamed to packages/daemon-contracts/src/daemon-diagnostics-scope.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import path from 'node:path';
44
import { afterEach, beforeEach, test } from 'vitest';
55
import { emitDiagnostic } from '@agent-device/host-kit/diagnostics';
66
import { withDaemonDiagnosticsScope } from './daemon-diagnostics-scope.ts';
7-
import { mkdtempForTestSync } from '../__tests__/test-utils/tmp-dir.ts';
7+
import { mkdtempForTestSync } from './tmp-dir.fixtures.ts';
88

99
let dir: string;
1010
let logPath: string;
File renamed without changes.

src/daemon-owner-cleanup.ts renamed to packages/daemon-contracts/src/daemon-owner-cleanup.ts

File renamed without changes.

src/__tests__/daemon-policy-file.test.ts renamed to packages/daemon-contracts/src/daemon-policy-file.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import path from 'node:path';
44
import { expect, test } from 'vitest';
55
import { commandDescriptors } from '@agent-device/command-registry/registry';
66
import type { CommandDescriptor } from '@agent-device/command-registry/types';
7-
import { mkdtempForTestSync } from './test-utils/tmp-dir.ts';
8-
import { DAEMON_POLICY_ENV, loadDaemonPolicy, parseDaemonPolicy } from '../daemon-policy-file.ts';
7+
import { mkdtempForTestSync } from './tmp-dir.fixtures.ts';
8+
import { DAEMON_POLICY_ENV, loadDaemonPolicy, parseDaemonPolicy } from './daemon-policy-file.ts';
99

1010
const SOURCE = '/etc/agent-device/policy.json';
1111

src/daemon-policy-file.ts renamed to packages/daemon-contracts/src/daemon-policy-file.ts

File renamed without changes.

src/__tests__/daemon-process-takeover.test.ts renamed to packages/daemon-contracts/src/daemon-process-takeover.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import os from 'node:os';
66
import path from 'node:path';
77
import { afterEach, test } from 'vitest';
88
import { isProcessAlive, readProcessStartTime } from '@agent-device/host-kit/process';
9-
import { isAgentDeviceDaemonProcess, stopDaemonProcess } from '../daemon-process.ts';
9+
import { isAgentDeviceDaemonProcess, stopDaemonProcess } from './daemon-process.ts';
1010

1111
const TAKEOVER_TIMEOUTS = { termTimeoutMs: 5_000, killTimeoutMs: 2_000 };
1212
const spawnedChildren: { child: ChildProcess; exited: Promise<void> }[] = [];

0 commit comments

Comments
 (0)