diff --git a/docs/adr/0019-request-bound-platform-runtime.md b/docs/adr/0019-request-bound-platform-runtime.md index 7ef18c7afc..594331708b 100644 --- a/docs/adr/0019-request-bound-platform-runtime.md +++ b/docs/adr/0019-request-bound-platform-runtime.md @@ -841,7 +841,7 @@ therefore structurally enforced rather than periodically measured. Some request-path work asks the host machine something without ever taking a device runtime: concrete local readiness, boot-time and runner-session observation, and open-target classification. Those asks now cross the daemon boundary as one required dependency, -`DaemonPlatformServices` (`packages/daemon/src/core/platform-services.ts`), assembled by the daemon runtime's +`DaemonPlatformServices` (`packages/daemon/src/core/platform-services.ts`, exported from the package entry `@agent-device/daemon`), assembled by the daemon runtime's root-composition module in `src/daemon-composition.ts` — which reaches the concrete adapters through `src/platform-runtime-daemon-services.ts` behind a function-scoped `await import` — and threaded composition → `startDaemonRuntime` deps → `RequestRouterDeps` → the request execution diff --git a/docs/adr/0033-collocation-decision-table.md b/docs/adr/0033-collocation-decision-table.md index 64496a5e68..dd0a854062 100644 --- a/docs/adr/0033-collocation-decision-table.md +++ b/docs/adr/0033-collocation-decision-table.md @@ -192,20 +192,25 @@ files have no seam (published facade, public-type collision, root dependency fac ## The daemon package's export surface -`@agent-device/daemon` publishes a façade, not importer reach: one named subpath per -production/script consumer — a subpath that only tests import is not production surface. -Everything else a root test reaches lives under the `./testing/` namespace: named -`./testing/` entries for production modules tests drive, named `./testing/` -entries, and, per fixture folder, a `./testing//*` pattern whose target template -reconstructs the source path. Never a wildcard that also exposes production modules. R11 -refuses any `./testing/` import from a non-test file, so root production code cannot import -a module the package publishes for tests (a package test double reached through the -boundary is production code depending on a fake), and root production imports are limited -to the named production surface. The exports keys stay exact except the per-folder fixture -patterns; `resolveWorkspaceSpecifier` (layering model) owns Node's exports semantics — the -layering edges, the depgraph, mutation ownership, and R11's named-surface check call it, and -the Stryker alias table orders its Vite first-match list to resolve in exactly its order — -so every lane gives a specifier the module id Node's exports resolution gives it. +`@agent-device/daemon` has one entry, `.`, which is `packages/daemon/src/index.ts`: explicit named +re-exports of what the daemon process root uses (`startDaemonRuntime` and the types its +composition and platform-runtime modules name), no `export *`. It is the package boundary, the +one place a barrel is allowed; the layer folders hold no barrel. A value import of the package +evaluates the daemon server graph, so root code that needs only command metadata reads it from +its owner: the route owner-file claims sit beside the per-command claims in +`@agent-device/command-registry/owner-files`, and the wire request and response types come from +`@agent-device/contracts/command` and `@agent-device/kernel/contracts`. + +Root tests that still drive daemon internals reach them through transitional `./testing/` +entries: named `./testing/` entries for production modules, named `./testing/` +entries, and per fixture folder a `./testing//*` pattern. Each batch of tests that moves into +`packages/daemon/src`, where they import their subject relatively, deletes the entries it frees. +R11 refuses any `./testing/` import from a non-test file, so root production code cannot import +a module the package publishes for tests (a package test double reached through the boundary is +production code depending on a fake). `resolveWorkspaceSpecifier` (layering model) owns Node's +exports semantics — the layering edges, the depgraph, mutation ownership, and R11's named-surface +check call it, and the Stryker alias table orders its Vite first-match list to resolve in exactly +its order — so every lane gives a specifier the module id Node's exports resolution gives it. ## Refuted alternatives diff --git a/packages/command-registry/src/owner-files.ts b/packages/command-registry/src/owner-files.ts index 796acfac11..d589ee36e4 100644 --- a/packages/command-registry/src/owner-files.ts +++ b/packages/command-registry/src/owner-files.ts @@ -1,3 +1,4 @@ +import type { DaemonCommandRoute } from './daemon-command-descriptor.ts'; import { RAW_COMMAND_DESCRIPTORS, type Command } from './registry.ts'; /** @@ -46,3 +47,28 @@ export const COMMAND_OWNER_FILES = buildOwnerFiles(RAW_COMMAND_DESCRIPTORS) sati export function ownerFilesForCommand(command: Command): readonly [string, ...string[]] { return COMMAND_OWNER_FILES[command]; } + +/** + * Development-only owner-file navigation claims for each daemon route. The route's runtime + * binding is its lazy loader in the daemon's handler table; this map is tooling metadata only + * `explain:command` reads, so it lives with the command claims above and the bundler drops it. + * + * `satisfies Record` keeps the map complete: adding or renaming a + * route is a compile error until this map matches. The daemon's `request-handler-chain` parity + * test asserts each path still points at the module that route's loader imports. + */ +const DAEMON_ROUTE_OWNER_FILES = { + humanControl: 'packages/daemon/src/sessions/handlers/human-control.ts', + lease: 'packages/daemon/src/sessions/handlers/lease.ts', + session: 'packages/daemon/src/sessions/handlers/session.ts', + snapshot: 'packages/daemon/src/sessions/handlers/snapshot.ts', + reactNative: 'packages/daemon/src/execution/handlers/react-native.ts', + recordTrace: 'packages/daemon/src/sessions/handlers/record-trace.ts', + find: 'packages/daemon/src/execution/interaction/index.ts', + interaction: 'packages/daemon/src/execution/interaction/index.ts', + generic: 'packages/daemon/src/execution/request-generic-dispatch.ts', +} as const satisfies Record; + +export function getDaemonRouteOwnerFiles(): Record { + return { ...DAEMON_ROUTE_OWNER_FILES }; +} diff --git a/packages/daemon/package.json b/packages/daemon/package.json index e42d31d98c..dddd2e3edb 100644 --- a/packages/daemon/package.json +++ b/packages/daemon/package.json @@ -31,33 +31,9 @@ "yaml": "^2.9.0" }, "exports": { - "./daemon-command-registry": { - "types": "./src/core/daemon-command-registry.ts", - "default": "./src/core/daemon-command-registry.ts" - }, - "./daemon-request": { - "types": "./src/core/daemon-request.ts", - "default": "./src/core/daemon-request.ts" - }, - "./platform-owner-lifecycle": { - "types": "./src/core/platform-owner-lifecycle.ts", - "default": "./src/core/platform-owner-lifecycle.ts" - }, - "./platform-resource-cleanup": { - "types": "./src/core/platform-resource-cleanup.ts", - "default": "./src/core/platform-resource-cleanup.ts" - }, - "./platform-services": { - "types": "./src/core/platform-services.ts", - "default": "./src/core/platform-services.ts" - }, - "./route-owner-files": { - "types": "./src/sessions/route-owner-files.ts", - "default": "./src/sessions/route-owner-files.ts" - }, - "./server/daemon-runtime": { - "types": "./src/server/http/daemon-runtime.ts", - "default": "./src/server/http/daemon-runtime.ts" + ".": { + "types": "./src/index.ts", + "default": "./src/index.ts" }, "./testing/__tests__/android-observation-fixture": { "types": "./src/__tests__/support/android-observation-fixture.ts", @@ -187,6 +163,10 @@ "types": "./src/core/context.ts", "default": "./src/core/context.ts" }, + "./testing/daemon-command-registry": { + "types": "./src/core/daemon-command-registry.ts", + "default": "./src/core/daemon-command-registry.ts" + }, "./testing/deferred-interaction-outcome": { "types": "./src/core/deferred-interaction-outcome.ts", "default": "./src/core/deferred-interaction-outcome.ts" @@ -363,6 +343,10 @@ "types": "./src/execution/selector-runtime-backend.ts", "default": "./src/execution/selector-runtime-backend.ts" }, + "./testing/server/daemon-runtime": { + "types": "./src/server/http/daemon-runtime.ts", + "default": "./src/server/http/daemon-runtime.ts" + }, "./testing/server/http-server": { "types": "./src/server/http/http-server.ts", "default": "./src/server/http/http-server.ts" diff --git a/src/__tests__/command-descriptor-ref-frame-effect.test.ts b/packages/daemon/src/core/__tests__/command-descriptor-ref-frame-effect.test.ts similarity index 97% rename from src/__tests__/command-descriptor-ref-frame-effect.test.ts rename to packages/daemon/src/core/__tests__/command-descriptor-ref-frame-effect.test.ts index 1c9736bfe3..aace09dc82 100644 --- a/src/__tests__/command-descriptor-ref-frame-effect.test.ts +++ b/packages/daemon/src/core/__tests__/command-descriptor-ref-frame-effect.test.ts @@ -3,10 +3,7 @@ import type { RefFrameEffect } from '@agent-device/contracts/replay'; import assert from 'node:assert/strict'; import { test } from 'vitest'; import { PUBLIC_COMMANDS } from '@agent-device/command-registry/catalog'; -import { - DAEMON_COMMAND_DESCRIPTORS, - resolveRefFrameEffect, -} from '@agent-device/daemon/daemon-command-registry'; +import { DAEMON_COMMAND_DESCRIPTORS, resolveRefFrameEffect } from '../daemon-command-registry.ts'; // ADR 0014 migration step 2: the ref-frame-effect classification is an // honesty/completeness guard. Every command that reaches a session-owning daemon diff --git a/packages/daemon/src/index.ts b/packages/daemon/src/index.ts new file mode 100644 index 0000000000..b7ef46715a --- /dev/null +++ b/packages/daemon/src/index.ts @@ -0,0 +1,11 @@ +export { startDaemonRuntime } from './server/http/daemon-runtime.ts'; +export type { + ComposeDaemonRuntimeDeps, + DaemonRuntimeController, + DaemonRuntimeDeps, + DaemonRuntimeDepsInput, +} from './server/http/daemon-runtime.ts'; +export type { DaemonInvokeFn, DaemonRequest } from './core/daemon-request.ts'; +export type { DaemonPlatformServices } from './core/platform-services.ts'; +export type { PlatformOwnerLifecycle } from './core/platform-owner-lifecycle.ts'; +export type { PlatformResourceCleanup } from './core/platform-resource-cleanup.ts'; diff --git a/packages/daemon/src/sessions/route-owner-files.ts b/packages/daemon/src/sessions/route-owner-files.ts deleted file mode 100644 index 071ea5808a..0000000000 --- a/packages/daemon/src/sessions/route-owner-files.ts +++ /dev/null @@ -1,33 +0,0 @@ -import type { DaemonCommandRoute } from './request-handler-chain.ts'; - -/** - * Development-only owner-file navigation claims for each daemon route (ADR 0008 - * follow-up, https://github.com/callstack/agent-device/issues/1178). - * - * Each route's runtime binding is its lazy `load` loader in - * {@link DAEMON_ROUTE_HANDLERS}; the owner-file path is pure tooling metadata - * that only `explain:command` consumes. Keeping it inline on the route object - * shipped these strings in `dist/src/internal/daemon.js`, so — like the - * per-command claims in `@agent-device/command-registry/owner-files` — they live here in - * a module the production import graph never reaches, and the bundler drops them. - * - * `satisfies Record` keeps the map complete: adding - * or renaming a route in {@link DAEMON_ROUTE_HANDLERS} is a compile error until - * this map matches. The `request-handler-chain` parity test additionally asserts - * each path still points at the module that route's loader imports. - */ -const DAEMON_ROUTE_OWNER_FILES = { - humanControl: 'packages/daemon/src/sessions/handlers/human-control.ts', - lease: 'packages/daemon/src/sessions/handlers/lease.ts', - session: 'packages/daemon/src/sessions/handlers/session.ts', - snapshot: 'packages/daemon/src/sessions/handlers/snapshot.ts', - reactNative: 'packages/daemon/src/execution/handlers/react-native.ts', - recordTrace: 'packages/daemon/src/sessions/handlers/record-trace.ts', - find: 'packages/daemon/src/execution/interaction/index.ts', - interaction: 'packages/daemon/src/execution/interaction/index.ts', - generic: 'packages/daemon/src/execution/request-generic-dispatch.ts', -} as const satisfies Record; - -export function getDaemonRouteOwnerFiles(): Record { - return { ...DAEMON_ROUTE_OWNER_FILES }; -} diff --git a/scripts/__tests__/eager-closure-budgets.ts b/scripts/__tests__/eager-closure-budgets.ts index 01a719f264..ad72b09238 100644 --- a/scripts/__tests__/eager-closure-budgets.ts +++ b/scripts/__tests__/eager-closure-budgets.ts @@ -132,7 +132,14 @@ export const NEW_ENTRY_CEILINGS: Readonly> = Objec */ export const APPROVED_OVER_CEILING: Readonly< Record -> = Object.freeze({}); +> = Object.freeze({ + 'packages/daemon/src/index.ts': { + issue: '#3352', + reason: + "The daemon package's one public entry. Its only value export is `startDaemonRuntime`, so its closure is the server graph that `src/daemon.ts` loads on every daemon start; the other exports are types. `src/daemon.ts` stays under the no-growth rule, and no CLI-process entry reaches the package (R78).", + owner: 'thymikee', + }, +}); /** The category is a function of the path, never a hand-written column. */ export function entryCategoryOf(entryFile: string): EntryCategory { diff --git a/scripts/check-bundle-owner-files.ts b/scripts/check-bundle-owner-files.ts index 1fceefb948..30d52b0280 100644 --- a/scripts/check-bundle-owner-files.ts +++ b/scripts/check-bundle-owner-files.ts @@ -1,7 +1,9 @@ import fs from 'node:fs'; import path from 'node:path'; -import { COMMAND_OWNER_FILES } from '@agent-device/command-registry/owner-files'; -import { getDaemonRouteOwnerFiles } from '@agent-device/daemon/route-owner-files'; +import { + COMMAND_OWNER_FILES, + getDaemonRouteOwnerFiles, +} from '@agent-device/command-registry/owner-files'; import { walkFiles } from './lib/walk-files.ts'; const repoRoot = path.resolve(import.meta.dirname, '..'); diff --git a/scripts/depgraph/affected-run.ts b/scripts/depgraph/affected-run.ts index 001591e206..0bd29c74d8 100644 --- a/scripts/depgraph/affected-run.ts +++ b/scripts/depgraph/affected-run.ts @@ -19,11 +19,12 @@ import fs from 'node:fs'; import path from 'node:path'; import { pathToFileURL } from 'node:url'; import { PUBLIC_COMMANDS } from '@agent-device/command-registry/catalog'; +import { deriveDaemonCommandDescriptors } from '@agent-device/command-registry/derive'; +import { commandDescriptors } from '@agent-device/command-registry/registry'; import { INTERACTION_DISPATCH_PATHS, type InteractionPathId, } from '@agent-device/contracts/interaction-guarantees'; -import { DAEMON_COMMAND_DESCRIPTORS } from '@agent-device/daemon/daemon-command-registry'; import { parseArgs } from 'node:util'; import { selectChecks, type CheckPlan } from '../check-affected/model.ts'; import { @@ -141,19 +142,19 @@ function commandChains(repoRoot: string): CommandChain[] { const source = fs.readFileSync(path.join(repoRoot, HANDLER_CHAIN_FILE), 'utf8'); const routeEntries = parseRouteEntries(source, HANDLER_CHAIN_FILE); const publicCommands = new Set(Object.values(PUBLIC_COMMANDS)); - return DAEMON_COMMAND_DESCRIPTORS.filter((descriptor) => - publicCommands.has(descriptor.command), - ).map((descriptor) => { - const entry = routeEntries.get(descriptor.route); - if (!entry) { - throw new Error( - `no handler entry for daemon route "${descriptor.route}" — the route table in ` + - `${HANDLER_CHAIN_FILE} changed shape; update parseRouteEntries in ` + - `scripts/depgraph/affected-run.ts.`, - ); - } - return { command: descriptor.command, route: descriptor.route, entry }; - }); + return deriveDaemonCommandDescriptors(commandDescriptors) + .filter((descriptor) => publicCommands.has(descriptor.command)) + .map((descriptor) => { + const entry = routeEntries.get(descriptor.route); + if (!entry) { + throw new Error( + `no handler entry for daemon route "${descriptor.route}" — the route table in ` + + `${HANDLER_CHAIN_FILE} changed shape; update parseRouteEntries in ` + + `scripts/depgraph/affected-run.ts.`, + ); + } + return { command: descriptor.command, route: descriptor.route, entry }; + }); } /** Flatten the ADR 0011 matrix into one row per (path, guarantee) cell that names a module. */ diff --git a/scripts/explain-command.ts b/scripts/explain-command.ts index 52e334e629..df1588462d 100644 --- a/scripts/explain-command.ts +++ b/scripts/explain-command.ts @@ -2,7 +2,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { explainCommand, formatCommandExplanation } from '../src/cli/command-explain.ts'; -import { getDaemonRouteOwnerFiles } from '@agent-device/daemon/route-owner-files'; +import { getDaemonRouteOwnerFiles } from '@agent-device/command-registry/owner-files'; const repoRoot = path.resolve(import.meta.dirname, '..'); export type ExplainCommandCliResult = { diff --git a/scripts/layering/daemon-layers.test.ts b/scripts/layering/daemon-layers.test.ts index 9d5fff33af..fef51ec8d5 100644 --- a/scripts/layering/daemon-layers.test.ts +++ b/scripts/layering/daemon-layers.test.ts @@ -8,6 +8,7 @@ import { resolveImportEdges, type ResolvedImportEdge } from './model.ts'; import { checkDaemonLayers, DAEMON_LAYER_ORDER, + DAEMON_PACKAGE_ENTRY, DAEMON_ROOT, daemonLayerOf, } from './daemon-layers.ts'; @@ -34,7 +35,7 @@ test('every tracked daemon production file resolves to a layer folder, and no st const daemonFiles = listSourceFiles().filter((file) => file.startsWith(`${DAEMON_ROOT}/`)); assert.ok(daemonFiles.length > 0, 'expected daemon production files to scan'); assert.deepEqual( - daemonFiles.filter((file) => daemonLayerOf(file) === null), + daemonFiles.filter((file) => file !== DAEMON_PACKAGE_ENTRY && daemonLayerOf(file) === null), [], ); @@ -144,6 +145,14 @@ test('a production file at the daemon root fails: the folder is the declaration' assert.match(violations[1]!.message, /does not start with one/); }); +test('the package entry is the one root file that needs no layer folder', () => { + assert.deepEqual( + checkDaemonLayers([...FIXTURE_FILES, DAEMON_PACKAGE_ENTRY], [], () => {}), + [], + ); + assert.equal(DAEMON_PACKAGE_ENTRY, `${DAEMON_ROOT}/index.ts`); +}); + test('tests and test support carry no layer and never trip the folder claim', () => { const testSide = [ `${DAEMON_ROOT}/core/__tests__/thing.test.ts`, diff --git a/scripts/layering/daemon-layers.ts b/scripts/layering/daemon-layers.ts index d9c2fa4d76..f95c1c2a8e 100644 --- a/scripts/layering/daemon-layers.ts +++ b/scripts/layering/daemon-layers.ts @@ -9,8 +9,8 @@ // only direction claim over the daemon's interior. Dynamic imports crossing layers are reported // explicitly, never rejected: the route loaders in `request-handler-chain.ts` defer exactly the // handlers the eager closure must not carry, and R5 made the same dynamic-vs-static decision -// (#3280). An unknown first segment (or a production file sitting at the daemon root) fails, -// so a new file cannot enter the zone without picking a layer. +// (#3280). An unknown first segment (or a production file sitting at the daemon root, bar the +// package entry `index.ts`) fails, so a new file cannot enter the zone without picking a layer. // Evidence: #3391 landed the partition; PR 10 moved each layer into its folder and re-measured // the zero upward static value-or-type edge claim against the moved graph. // Cost: attributed to the R81 rule registration in check.ts; not a standalone CI job. @@ -27,6 +27,12 @@ export const DAEMON_ROOT = DAEMON_SOURCE_ROOT.slice(0, -1); /** The daemon-local order, lowest first. The global spine rank stays 4 for all five layers. */ export const DAEMON_LAYER_ORDER = ['core', 'resources', 'execution', 'sessions', 'server'] as const; +/** + * The package boundary: the one production file allowed at the daemon root, because it declares + * the public API rather than belonging to a layer. + */ +export const DAEMON_PACKAGE_ENTRY = `${DAEMON_SOURCE_ROOT}index.ts`; + export type DaemonLayer = (typeof DAEMON_LAYER_ORDER)[number]; function isDaemonLayer(segment: string): segment is DaemonLayer { @@ -99,7 +105,7 @@ export function checkDaemonLayers( for (const file of trackedDaemonProductionFiles) { // The context's scan names every tracked TS file in the zone; tests and test support mirror // their source module by convention and carry no folder claim. - if (!isProductionSourceFile(file)) continue; + if (!isProductionSourceFile(file) || file === DAEMON_PACKAGE_ENTRY) continue; if (daemonLayerOf(file) === null) { const rest = path.relative(DAEMON_ROOT, file); violations.push({ diff --git a/src/__tests__/command-descriptor-parity.test.ts b/src/__tests__/command-descriptor-parity.test.ts index 84728493ae..c7716e1a5d 100644 --- a/src/__tests__/command-descriptor-parity.test.ts +++ b/src/__tests__/command-descriptor-parity.test.ts @@ -6,7 +6,6 @@ import { listCliCommandNames, PUBLIC_COMMANDS, } from '@agent-device/command-registry/catalog'; -import { canRunReplayScopedAction } from '@agent-device/daemon/daemon-command-registry'; import { deriveDaemonCommandDescriptors, deriveStructuredBatchCommandNames, @@ -134,6 +133,9 @@ test('structured-batch allowlist is built from descriptors', () => { // #1310: every raw descriptor explicitly decides recording; the daemon // replayScopedAction trait and MCP schema projection are both derived from it. test('recordsSessionAction is explicit on every raw descriptor and drives daemon replay policy', () => { + const derivedDaemonCommands = new Map( + deriveDaemonCommandDescriptors(commandDescriptors).map((daemon) => [daemon.command, daemon]), + ); for (const descriptor of RAW_COMMAND_DESCRIPTORS) { assert.equal( typeof descriptor.recordsSessionAction, @@ -167,7 +169,7 @@ test('recordsSessionAction is explicit on every raw descriptor and drives daemon if (!('daemon' in descriptor)) continue; assert.equal( resolveCommandRecordsSessionAction(descriptor.name), - canRunReplayScopedAction(descriptor.name), + derivedDaemonCommands.get(descriptor.name)?.replayScopedAction === true, `${descriptor.name} recordsSessionAction matches daemon replayScopedAction`, ); } diff --git a/src/__tests__/daemon-composition-assembly.test.ts b/src/__tests__/daemon-composition-assembly.test.ts index ba75e5eaa7..8acef2f597 100644 --- a/src/__tests__/daemon-composition-assembly.test.ts +++ b/src/__tests__/daemon-composition-assembly.test.ts @@ -7,7 +7,7 @@ import { WEB_DESKTOP_DEVICE } from '@agent-device/test-kit/device-fixtures'; import { mkdtempForTestSync } from '@agent-device/test-kit/tmp-dir'; import { createDaemonRuntimeDeps } from '../daemon-composition.ts'; import { startDaemonRuntimeFixture } from './daemon-composition/daemon-runtime-fixture.ts'; -import type { DaemonRuntimeDepsInput } from '@agent-device/daemon/server/daemon-runtime'; +import type { DaemonRuntimeDepsInput } from '@agent-device/daemon'; // The server builds its own store, so capture that instance the same way the shutdown tests do: // the proof is about the store the server hands to the composition callbacks, not one the test diff --git a/src/__tests__/daemon-composition/daemon-runtime-fixture.ts b/src/__tests__/daemon-composition/daemon-runtime-fixture.ts index 2c5770c56b..7c3431d896 100644 --- a/src/__tests__/daemon-composition/daemon-runtime-fixture.ts +++ b/src/__tests__/daemon-composition/daemon-runtime-fixture.ts @@ -3,7 +3,7 @@ import { startDaemonRuntime, type ComposeDaemonRuntimeDeps, type DaemonRuntimeController, -} from '@agent-device/daemon/server/daemon-runtime'; +} from '@agent-device/daemon'; type WritableOutput = { write: (chunk: string) => unknown }; diff --git a/src/__tests__/daemon-composition/generic-settle.test.ts b/src/__tests__/daemon-composition/generic-settle.test.ts index 002eaee8b3..121db28a3e 100644 --- a/src/__tests__/daemon-composition/generic-settle.test.ts +++ b/src/__tests__/daemon-composition/generic-settle.test.ts @@ -24,7 +24,7 @@ import { } from '@agent-device/daemon/testing/ref-frame'; import { setSessionSnapshot } from '@agent-device/daemon/testing/session-snapshot'; import type { SessionStore } from '@agent-device/daemon/testing/session-store'; -import type { DaemonRequest } from '@agent-device/daemon/daemon-request'; +import type { DaemonRequest } from '@agent-device/daemon'; import type { SessionRef, SessionState } from '@agent-device/daemon/testing/session-state'; import { buildSnapshotState } from '@agent-device/capture-kit/snapshot-state'; import { selectorCaptureFixture } from '@agent-device/daemon/testing/__tests__/selector-capture-fixture'; diff --git a/src/__tests__/daemon-composition/handlers/lease-provider-credentials.test.ts b/src/__tests__/daemon-composition/handlers/lease-provider-credentials.test.ts index 986be0065a..401815d005 100644 --- a/src/__tests__/daemon-composition/handlers/lease-provider-credentials.test.ts +++ b/src/__tests__/daemon-composition/handlers/lease-provider-credentials.test.ts @@ -4,7 +4,7 @@ import path from 'node:path'; import { test } from 'vitest'; import { handleLeaseCommands } from '@agent-device/daemon/testing/handlers/lease'; import { LeaseRegistry } from '@agent-device/daemon/testing/lease-registry'; -import type { DaemonRequest } from '@agent-device/daemon/daemon-request'; +import type { DaemonRequest } from '@agent-device/daemon'; import { makeSessionStore } from '@agent-device/daemon/testing/__tests__/support/store-factory'; import { AppError } from '@agent-device/kernel/errors'; import { diff --git a/src/__tests__/daemon-composition/handlers/session-close-runner-retention.test.ts b/src/__tests__/daemon-composition/handlers/session-close-runner-retention.test.ts index 58df3d58a6..727bc0aa4a 100644 --- a/src/__tests__/daemon-composition/handlers/session-close-runner-retention.test.ts +++ b/src/__tests__/daemon-composition/handlers/session-close-runner-retention.test.ts @@ -6,7 +6,7 @@ import { createTestDeviceInventoryGateways } from '@agent-device/device-selectio import { makeSessionStore } from '@agent-device/daemon/testing/__tests__/support/store-factory'; import { makeSession } from '@agent-device/daemon/testing/__tests__/support/session-factories'; import { getResolveTargetDeviceMock } from '@agent-device/daemon/testing/__tests__/request-router-dispatch-mocks'; -import type { DaemonRequest } from '@agent-device/daemon/daemon-request'; +import type { DaemonRequest } from '@agent-device/daemon'; import { platformResourceCleanup } from '../../../platform-runtime-resource-cleanup.ts'; // The runner-retention decision is the real `PlatformResourceCleanup` rule (a booted simulator diff --git a/src/__tests__/daemon-composition/handlers/session-relaunch-close.test.ts b/src/__tests__/daemon-composition/handlers/session-relaunch-close.test.ts index 6f618b1828..d44fae6348 100644 --- a/src/__tests__/daemon-composition/handlers/session-relaunch-close.test.ts +++ b/src/__tests__/daemon-composition/handlers/session-relaunch-close.test.ts @@ -11,7 +11,7 @@ import { createTestDeviceInventoryGateways } from '@agent-device/device-selectio import { makeSessionStore } from '@agent-device/daemon/testing/__tests__/support/store-factory'; import { makeSession } from '@agent-device/daemon/testing/__tests__/support/session-factories'; import { getResolveTargetDeviceMock } from '@agent-device/daemon/testing/__tests__/request-router-dispatch-mocks'; -import type { DaemonRequest } from '@agent-device/daemon/daemon-request'; +import type { DaemonRequest } from '@agent-device/daemon'; vi.mock('node:timers/promises', async (importOriginal) => { const actual = await importOriginal(); diff --git a/src/__tests__/daemon-composition/handlers/wait-landmark-recording.test.ts b/src/__tests__/daemon-composition/handlers/wait-landmark-recording.test.ts index 27ee6398c4..1129c476cc 100644 --- a/src/__tests__/daemon-composition/handlers/wait-landmark-recording.test.ts +++ b/src/__tests__/daemon-composition/handlers/wait-landmark-recording.test.ts @@ -14,7 +14,7 @@ import { test, expect, vi, beforeEach } from 'vitest'; import { legacyDispatchCapture } from '@agent-device/daemon/testing/__tests__/legacy-snapshot-capture-fixture'; import { dispatchWaitViaRuntime } from '@agent-device/daemon/testing/wait-runtime'; -import type { DaemonRequest } from '@agent-device/daemon/daemon-request'; +import type { DaemonRequest } from '@agent-device/daemon'; import { WAIT_LANDMARK_MISMATCH_REASON } from '@agent-device/contracts/replay'; import type { TargetAnnotationV1 } from '@agent-device/contracts/replay'; import { snapshotRuntimeFixture } from '@agent-device/daemon/testing/__tests__/snapshot-runtime-fixture'; diff --git a/src/__tests__/daemon-composition/interaction/find-production-route.test.ts b/src/__tests__/daemon-composition/interaction/find-production-route.test.ts index 4c8af2fe6d..4e514e59d8 100644 --- a/src/__tests__/daemon-composition/interaction/find-production-route.test.ts +++ b/src/__tests__/daemon-composition/interaction/find-production-route.test.ts @@ -2,7 +2,7 @@ import type { DaemonResponse } from '@agent-device/kernel/contracts'; import { test, expect, vi, beforeEach } from 'vitest'; import { handleInteractionCommands } from '@agent-device/daemon/testing/interaction/index'; import type { CommandFlags } from '@agent-device/contracts/command'; -import type { DaemonRequest } from '@agent-device/daemon/daemon-request'; +import type { DaemonRequest } from '@agent-device/daemon'; import { makeSessionStore } from '@agent-device/daemon/testing/__tests__/support/store-factory'; import { makeIosSession as makeSession } from '@agent-device/daemon/testing/__tests__/support/session-factories'; import { testCreateCommandSurface } from '../command-surface-fixture.ts'; diff --git a/src/__tests__/daemon-composition/is-runtime.test.ts b/src/__tests__/daemon-composition/is-runtime.test.ts index 9d8e126599..7f83e37515 100644 --- a/src/__tests__/daemon-composition/is-runtime.test.ts +++ b/src/__tests__/daemon-composition/is-runtime.test.ts @@ -12,7 +12,7 @@ import { makeSessionStore } from '@agent-device/daemon/testing/__tests__/support import { withTestDeviceInventory } from '@agent-device/device-selection/inventory-gateways-fixtures'; import { makeSnapshotState } from '@agent-device/selectors/snapshot-geometry-fixtures'; import type { PostGestureOutcome } from '@agent-device/kernel/snapshot'; -import type { DaemonRequest } from '@agent-device/daemon/daemon-request'; +import type { DaemonRequest } from '@agent-device/daemon'; import { selectorCaptureFixture } from '@agent-device/daemon/testing/__tests__/selector-capture-fixture'; import { markDeferredInteractionOutcome } from '@agent-device/daemon/testing/deferred-interaction-outcome'; import { formatPostGestureOutcomeWarning } from '@agent-device/capture-kit/post-gesture-stability'; diff --git a/src/__tests__/daemon-composition/platform-services-fixture.ts b/src/__tests__/daemon-composition/platform-services-fixture.ts index f3b9e3a2e0..f88ebf7653 100644 --- a/src/__tests__/daemon-composition/platform-services-fixture.ts +++ b/src/__tests__/daemon-composition/platform-services-fixture.ts @@ -1,7 +1,7 @@ import { type ClaimRecoveryGatewayFactory } from '@agent-device/daemon-contracts/device-claim-recovery'; import { createDaemonPlatformServices } from '../../platform-runtime-daemon-services.ts'; import { createClaimRecoveryGateway } from '../../platform-runtime-claim-recovery.ts'; -import type { DaemonPlatformServices } from '@agent-device/daemon/platform-services'; +import type { DaemonPlatformServices } from '@agent-device/daemon'; /** * The port the production composition root builds, handed to a test the same way the shared router diff --git a/src/__tests__/daemon-composition/providers-plugin-routing-parity.test.ts b/src/__tests__/daemon-composition/providers-plugin-routing-parity.test.ts index c6dba82ab4..3a434e3795 100644 --- a/src/__tests__/daemon-composition/providers-plugin-routing-parity.test.ts +++ b/src/__tests__/daemon-composition/providers-plugin-routing-parity.test.ts @@ -33,7 +33,7 @@ import { type PlatformProviderResolvers, } from '../../platform-runtime.ts'; import { resolvePlatformProviderRequestContext } from '@agent-device/daemon/testing/request-platform-provider-context'; -import type { DaemonRequest } from '@agent-device/daemon/daemon-request'; +import type { DaemonRequest } from '@agent-device/daemon'; // Phase 3 step b.3 (issue #974) parity gate for the request-scope provider // facet. The per-platform GATE that each descriptor in the root-owned provider composition diff --git a/src/__tests__/daemon-composition/replay-suite/session-test-suite-command-flag-policy.test.ts b/src/__tests__/daemon-composition/replay-suite/session-test-suite-command-flag-policy.test.ts index 06c44ce728..76ed11faaa 100644 --- a/src/__tests__/daemon-composition/replay-suite/session-test-suite-command-flag-policy.test.ts +++ b/src/__tests__/daemon-composition/replay-suite/session-test-suite-command-flag-policy.test.ts @@ -22,7 +22,7 @@ import type { ReplayTestCommand } from '@agent-device/replay-port/command-types' import { REPLAY_ONLY_TEST_FLAG_REJECTIONS } from '@agent-device/replay-port/session-replay-test-policy'; import { replayCommandFamily } from '../../../commands/replay/index.ts'; import { mkdtempForTestSync } from '@agent-device/test-kit/tmp-dir'; -import type { DaemonInvokeFn, DaemonRequest } from '@agent-device/daemon/daemon-request'; +import type { DaemonInvokeFn, DaemonRequest } from '@agent-device/daemon'; // --- ADR 0012 decision 4 / migration step 5: `--from` is replay-only --- diff --git a/src/__tests__/daemon-composition/request-dispatch-disclosure.test.ts b/src/__tests__/daemon-composition/request-dispatch-disclosure.test.ts index 0fe5e2f30d..614270d132 100644 --- a/src/__tests__/daemon-composition/request-dispatch-disclosure.test.ts +++ b/src/__tests__/daemon-composition/request-dispatch-disclosure.test.ts @@ -32,7 +32,7 @@ import { } from '@agent-device/daemon/testing/__tests__/support/session-factories'; import { makeSessionStore } from '@agent-device/daemon/testing/__tests__/support/store-factory'; import { mkdtempForTestSync } from '@agent-device/test-kit/tmp-dir'; -import type { DaemonRequest } from '@agent-device/daemon/daemon-request'; +import type { DaemonRequest } from '@agent-device/daemon'; import { discloseRequestDispatch } from '@agent-device/daemon/testing/request-dispatch-disclosure'; import { createRequestDispatchLedger } from '@agent-device/daemon/testing/request-dispatch-ledger'; import { LeaseRegistry } from '@agent-device/daemon/testing/lease-registry'; diff --git a/src/__tests__/daemon-composition/request-handler-chain.test.ts b/src/__tests__/daemon-composition/request-handler-chain.test.ts index 845030aa2d..479a7df83d 100644 --- a/src/__tests__/daemon-composition/request-handler-chain.test.ts +++ b/src/__tests__/daemon-composition/request-handler-chain.test.ts @@ -7,8 +7,8 @@ import { test } from 'vitest'; import { INTERNAL_COMMANDS } from '@agent-device/command-registry/catalog'; import { LeaseRegistry } from '@agent-device/daemon/testing/lease-registry'; import { runRequestHandlerChain } from '@agent-device/daemon/testing/request-handler-chain'; -import { getDaemonRouteOwnerFiles } from '@agent-device/daemon/route-owner-files'; -import type { DaemonRequest } from '@agent-device/daemon/daemon-request'; +import { getDaemonRouteOwnerFiles } from '@agent-device/command-registry/owner-files'; +import type { DaemonRequest } from '@agent-device/daemon'; import { LINUX_DEVICE } from '@agent-device/test-kit/device-fixtures'; import { makeIosSession, diff --git a/src/__tests__/daemon-composition/request-platform-providers.test.ts b/src/__tests__/daemon-composition/request-platform-providers.test.ts index ee51de6a8a..736db9cb09 100644 --- a/src/__tests__/daemon-composition/request-platform-providers.test.ts +++ b/src/__tests__/daemon-composition/request-platform-providers.test.ts @@ -31,7 +31,7 @@ import type { PlatformProviderRequestContext, } from '@agent-device/contracts/platform-providers'; import { resolvePlatformProviderRequestContext } from '@agent-device/daemon/testing/request-platform-provider-context'; -import type { DaemonRequest } from '@agent-device/daemon/daemon-request'; +import type { DaemonRequest } from '@agent-device/daemon'; const OTHER_IOS_SIMULATOR: DeviceInfo = { platform: 'apple', diff --git a/src/__tests__/daemon-composition/request-router-fill-text-stdin.test.ts b/src/__tests__/daemon-composition/request-router-fill-text-stdin.test.ts index 6a611a10b7..5433c33582 100644 --- a/src/__tests__/daemon-composition/request-router-fill-text-stdin.test.ts +++ b/src/__tests__/daemon-composition/request-router-fill-text-stdin.test.ts @@ -9,7 +9,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { createTestDeviceInventoryGateways } from '@agent-device/device-selection/inventory-gateways-fixtures'; import type { WebProvider } from '@agent-device/platform-web'; -import type { DaemonRequest } from '@agent-device/daemon/daemon-request'; +import type { DaemonRequest } from '@agent-device/daemon'; import type { SessionState } from '@agent-device/daemon/testing/session-state'; import { createRequestHandler } from '@agent-device/daemon/testing/__tests__/test-device-runtime-gateway'; import { LeaseRegistry } from '@agent-device/daemon/testing/lease-registry'; diff --git a/src/__tests__/daemon-composition/request-router-macos-app-lease.test.ts b/src/__tests__/daemon-composition/request-router-macos-app-lease.test.ts index f239dd2137..bd89a67191 100644 --- a/src/__tests__/daemon-composition/request-router-macos-app-lease.test.ts +++ b/src/__tests__/daemon-composition/request-router-macos-app-lease.test.ts @@ -6,7 +6,7 @@ import { MACOS_DEVICE } from '@agent-device/test-kit/device-fixtures'; import { makeSessionStore } from '@agent-device/daemon/testing/__tests__/support/store-factory'; import { makeMacOsSession } from '@agent-device/daemon/testing/__tests__/support/session-factories'; import { mkdtempForTestSync } from '@agent-device/test-kit/tmp-dir'; -import type { DaemonRequest } from '@agent-device/daemon/daemon-request'; +import type { DaemonRequest } from '@agent-device/daemon'; import { LeaseRegistry } from '@agent-device/daemon/testing/lease-registry'; import { createRequestHandler } from '@agent-device/daemon/testing/__tests__/test-device-runtime-gateway'; import { screenshotRuntimeFixture } from '@agent-device/daemon/testing/__tests__/screenshot-runtime-fixture'; diff --git a/src/__tests__/daemon-composition/request-router-screenshot.test.ts b/src/__tests__/daemon-composition/request-router-screenshot.test.ts index 56e14858db..2aa569a0cf 100644 --- a/src/__tests__/daemon-composition/request-router-screenshot.test.ts +++ b/src/__tests__/daemon-composition/request-router-screenshot.test.ts @@ -23,7 +23,7 @@ import { type ScreenshotRuntimeFixture, type ScreenshotRuntimeFixtureOptions, } from '@agent-device/daemon/testing/__tests__/screenshot-runtime-fixture'; -import type { DaemonRequest } from '@agent-device/daemon/daemon-request'; +import type { DaemonRequest } from '@agent-device/daemon'; import type { SessionState } from '@agent-device/daemon/testing/session-state'; import { LeaseRegistry } from '@agent-device/daemon/testing/lease-registry'; import { attachRefs } from '@agent-device/kernel/snapshot'; diff --git a/src/__tests__/daemon-composition/screenshot-runtime.test.ts b/src/__tests__/daemon-composition/screenshot-runtime.test.ts index 3fd95cf7c3..975285885c 100644 --- a/src/__tests__/daemon-composition/screenshot-runtime.test.ts +++ b/src/__tests__/daemon-composition/screenshot-runtime.test.ts @@ -13,7 +13,7 @@ import { screenshotRuntimeFixture, writeSolidPng, } from '@agent-device/daemon/testing/__tests__/screenshot-runtime-fixture'; -import type { DaemonRequest } from '@agent-device/daemon/daemon-request'; +import type { DaemonRequest } from '@agent-device/daemon'; import type { SessionState } from '@agent-device/daemon/testing/session-state'; import { mkdtempForTestSync } from '@agent-device/test-kit/tmp-dir'; import { testCreateCommandSurface } from './command-surface-fixture.ts'; diff --git a/src/__tests__/daemon-composition/selector-runtime-ambiguity-issuance.test.ts b/src/__tests__/daemon-composition/selector-runtime-ambiguity-issuance.test.ts index 9d7a63b01b..427b556645 100644 --- a/src/__tests__/daemon-composition/selector-runtime-ambiguity-issuance.test.ts +++ b/src/__tests__/daemon-composition/selector-runtime-ambiguity-issuance.test.ts @@ -4,7 +4,7 @@ import { attachRefs } from '@agent-device/kernel/snapshot'; import { makeSessionStore } from '@agent-device/daemon/testing/__tests__/support/store-factory'; import { selectorCaptureFixture } from '@agent-device/daemon/testing/__tests__/selector-capture-fixture'; import { refFrameScope, refFrameState } from '@agent-device/daemon/testing/ref-frame'; -import type { DaemonRequest } from '@agent-device/daemon/daemon-request'; +import type { DaemonRequest } from '@agent-device/daemon'; import { dispatchIsViaRuntime } from '@agent-device/daemon/testing/selector-runtime'; import { IOS_SIMULATOR } from '@agent-device/test-kit/device-fixtures'; import { diff --git a/src/__tests__/daemon-composition/server/daemon-runtime-lifecycle-shutdown.test.ts b/src/__tests__/daemon-composition/server/daemon-runtime-lifecycle-shutdown.test.ts index 8585f3a120..c8d32e471a 100644 --- a/src/__tests__/daemon-composition/server/daemon-runtime-lifecycle-shutdown.test.ts +++ b/src/__tests__/daemon-composition/server/daemon-runtime-lifecycle-shutdown.test.ts @@ -52,7 +52,7 @@ const shutdownProbe = vi.hoisted(() => ({ store: undefined as import('@agent-device/daemon/testing/session-store').SessionStore | undefined, drain: undefined as (() => Promise) | undefined, finalize: vi.fn(async () => {}), - dispatch: undefined as import('@agent-device/daemon/daemon-request').DaemonInvokeFn | undefined, + dispatch: undefined as import('@agent-device/daemon').DaemonInvokeFn | undefined, closeTimeout: undefined as number | undefined, })); vi.mock('@agent-device/daemon/testing/session-store', async (importOriginal) => { @@ -142,7 +142,7 @@ import { } from '@agent-device/daemon/testing/__tests__/support/device-claim-store'; import { sendRequest } from '../../../daemon-client/daemon-client-transport.ts'; import { resolveDaemonPaths } from '@agent-device/daemon-contracts/daemon-resolution'; -import { teardownDaemonSessionForShutdown } from '@agent-device/daemon/server/daemon-runtime'; +import { teardownDaemonSessionForShutdown } from '@agent-device/daemon/testing/server/daemon-runtime'; import { startDaemonRuntimeFixture } from '../daemon-runtime-fixture.ts'; import { makeIosSession } from '@agent-device/daemon/testing/__tests__/support/session-factories'; import { makeSessionStore } from '@agent-device/daemon/testing/__tests__/support/store-factory'; diff --git a/src/__tests__/daemon-composition/server/daemon-runtime-recording-teardown.test.ts b/src/__tests__/daemon-composition/server/daemon-runtime-recording-teardown.test.ts index 6ef487f6a2..9af7481163 100644 --- a/src/__tests__/daemon-composition/server/daemon-runtime-recording-teardown.test.ts +++ b/src/__tests__/daemon-composition/server/daemon-runtime-recording-teardown.test.ts @@ -5,7 +5,7 @@ import { mkdtempForTestSync } from '@agent-device/test-kit/tmp-dir'; import { platformResourceCleanup } from '../../../platform-runtime-resource-cleanup.ts'; import { SessionStore } from '@agent-device/daemon/testing/session-store'; import { makeRecordingSession } from '@agent-device/daemon/testing/__tests__/session-teardown.fixtures'; -import { teardownDaemonSessionForShutdown } from '@agent-device/daemon/server/daemon-runtime'; +import { teardownDaemonSessionForShutdown } from '@agent-device/daemon/testing/server/daemon-runtime'; afterEach(() => { vi.useRealTimers(); diff --git a/src/__tests__/daemon-composition/server/daemon-runtime-snapshot-shutdown.test.ts b/src/__tests__/daemon-composition/server/daemon-runtime-snapshot-shutdown.test.ts index ba2b4a45ab..e51c4db8ac 100644 --- a/src/__tests__/daemon-composition/server/daemon-runtime-snapshot-shutdown.test.ts +++ b/src/__tests__/daemon-composition/server/daemon-runtime-snapshot-shutdown.test.ts @@ -12,7 +12,7 @@ import { snapshotRuntimeFixture } from '@agent-device/daemon/testing/__tests__/s import { platformResourceCleanup } from '../../../platform-runtime-resource-cleanup.ts'; import { DAEMON_SESSION_TEARDOWN_TIMEOUT_MS } from '@agent-device/daemon/testing/session-teardown-budget'; import { dispatchSnapshotViaRuntime } from '@agent-device/daemon/testing/snapshot-runtime'; -import { teardownDaemonSessionForShutdown } from '@agent-device/daemon/server/daemon-runtime'; +import { teardownDaemonSessionForShutdown } from '@agent-device/daemon/testing/server/daemon-runtime'; import { testCreateCommandSurface } from '../command-surface-fixture.ts'; vi.mock('@agent-device/device-selection/dispatch-resolve', () => ({ diff --git a/src/__tests__/daemon-composition/server/daemon-runtime-web-close-teardown.test.ts b/src/__tests__/daemon-composition/server/daemon-runtime-web-close-teardown.test.ts index fafe5c7661..b8894e1c06 100644 --- a/src/__tests__/daemon-composition/server/daemon-runtime-web-close-teardown.test.ts +++ b/src/__tests__/daemon-composition/server/daemon-runtime-web-close-teardown.test.ts @@ -12,7 +12,7 @@ import { platformResourceCleanup } from '../../../platform-runtime-resource-clea import { runCmd } from '@agent-device/host-kit/command'; import { SessionStore } from '@agent-device/daemon/testing/session-store'; import { makeWebSession } from '@agent-device/daemon/testing/__tests__/session-teardown.fixtures'; -import { teardownDaemonSessionForShutdown } from '@agent-device/daemon/server/daemon-runtime'; +import { teardownDaemonSessionForShutdown } from '@agent-device/daemon/testing/server/daemon-runtime'; const mockRunCmd = vi.mocked(runCmd); diff --git a/src/__tests__/daemon-composition/session-lifecycle/session-close-runtime-hints.test.ts b/src/__tests__/daemon-composition/session-lifecycle/session-close-runtime-hints.test.ts index 8b433816dc..f75ec42e6f 100644 --- a/src/__tests__/daemon-composition/session-lifecycle/session-close-runtime-hints.test.ts +++ b/src/__tests__/daemon-composition/session-lifecycle/session-close-runtime-hints.test.ts @@ -2,7 +2,7 @@ import type { DaemonResponse } from '@agent-device/kernel/contracts'; import { beforeEach, expect, test, vi } from 'vitest'; import path from 'node:path'; import { SessionStore } from '@agent-device/daemon/testing/session-store'; -import type { DaemonRequest } from '@agent-device/daemon/daemon-request'; +import type { DaemonRequest } from '@agent-device/daemon'; import type { SessionState } from '@agent-device/daemon/testing/session-state'; import { fakeCreateCommandSurface } from '@agent-device/daemon/testing/__tests__/support/command-surface-fake'; diff --git a/src/__tests__/daemon-composition/session-lifecycle/session-open-url-prewarm.test.ts b/src/__tests__/daemon-composition/session-lifecycle/session-open-url-prewarm.test.ts index 3ebd57cafe..a02ea758eb 100644 --- a/src/__tests__/daemon-composition/session-lifecycle/session-open-url-prewarm.test.ts +++ b/src/__tests__/daemon-composition/session-lifecycle/session-open-url-prewarm.test.ts @@ -56,7 +56,7 @@ import { createTestDeviceInventoryGateways } from '@agent-device/device-selectio import { makeSessionStore } from '@agent-device/daemon/testing/__tests__/support/store-factory'; import { makeSession } from '@agent-device/daemon/testing/__tests__/support/session-factories'; import { LeaseRegistry } from '@agent-device/daemon/testing/lease-registry'; -import type { DaemonRequest } from '@agent-device/daemon/daemon-request'; +import type { DaemonRequest } from '@agent-device/daemon'; import { prepareIosRunner, prewarmAppleRunnerCache, diff --git a/src/__tests__/daemon-composition/wait-runtime.test.ts b/src/__tests__/daemon-composition/wait-runtime.test.ts index 02e006972a..d0c7e28cc4 100644 --- a/src/__tests__/daemon-composition/wait-runtime.test.ts +++ b/src/__tests__/daemon-composition/wait-runtime.test.ts @@ -31,7 +31,7 @@ import type { import { handleSnapshotCommands } from '@agent-device/daemon/testing/handlers/snapshot'; import { resolveBoundSelectorCapture } from '@agent-device/daemon/testing/selector-capture-binding'; import { dispatchGetViaRuntime } from '@agent-device/daemon/testing/selector-runtime'; -import type { DaemonRequest } from '@agent-device/daemon/daemon-request'; +import type { DaemonRequest } from '@agent-device/daemon'; import { testCreateCommandSurface } from './command-surface-fixture.ts'; const webDevice = { diff --git a/src/__tests__/daemon-entrypoint.test.ts b/src/__tests__/daemon-entrypoint.test.ts index 5da1ba2721..326f5164e3 100644 --- a/src/__tests__/daemon-entrypoint.test.ts +++ b/src/__tests__/daemon-entrypoint.test.ts @@ -7,7 +7,7 @@ import path from 'node:path'; import { test } from 'vitest'; import { resolveDaemonPaths } from '@agent-device/daemon-contracts/daemon-resolution'; import { startDaemonRuntimeFixture } from './daemon-composition/daemon-runtime-fixture.ts'; -import type { DaemonRuntimeController } from '@agent-device/daemon/server/daemon-runtime'; +import type { DaemonRuntimeController } from '@agent-device/daemon'; import { cleanupDownloadableArtifact, trackDownloadableArtifact, diff --git a/src/cli/__tests__/command-explain.test.ts b/src/cli/__tests__/command-explain.test.ts index 2f72527b10..3c504c2cf5 100644 --- a/src/cli/__tests__/command-explain.test.ts +++ b/src/cli/__tests__/command-explain.test.ts @@ -4,8 +4,10 @@ import path from 'node:path'; import { describe, expect, test } from 'vitest'; import { runExplainCommandCli } from '../../../scripts/explain-command.ts'; import { commandDescriptors } from '@agent-device/command-registry/registry'; -import { ownerFilesForCommand } from '@agent-device/command-registry/owner-files'; -import { getDaemonRouteOwnerFiles } from '@agent-device/daemon/route-owner-files'; +import { + ownerFilesForCommand, + getDaemonRouteOwnerFiles, +} from '@agent-device/command-registry/owner-files'; import { explainCommand as explainCommandFromMetadata, formatCommandExplanation, diff --git a/src/commands/__tests__/command-surface-metadata.test.ts b/src/commands/__tests__/command-surface-metadata.test.ts index 4784c99cdc..dc9871b768 100644 --- a/src/commands/__tests__/command-surface-metadata.test.ts +++ b/src/commands/__tests__/command-surface-metadata.test.ts @@ -22,7 +22,7 @@ import { import { listExecutableCommandNames } from '../command-surface.ts'; import { helpBody, mcpBody } from '@agent-device/command-registry/command-text'; import { explainCommand } from '../../cli/command-explain.ts'; -import { getDaemonRouteOwnerFiles } from '@agent-device/daemon/route-owner-files'; +import { getDaemonRouteOwnerFiles } from '@agent-device/command-registry/owner-files'; test('MCP exposed command names have metadata and executable command definitions', () => { const mcpExposedNames = listMcpExposedCommandNames().sort(); diff --git a/src/daemon-client/__tests__/daemon-client-abort-default-transport.test.ts b/src/daemon-client/__tests__/daemon-client-abort-default-transport.test.ts index 4a98d54da8..9cb55401b0 100644 --- a/src/daemon-client/__tests__/daemon-client-abort-default-transport.test.ts +++ b/src/daemon-client/__tests__/daemon-client-abort-default-transport.test.ts @@ -24,7 +24,6 @@ import { isRequestCanceledError } from '@agent-device/kernel/errors'; import { getRequestSignal, isRequestCanceled } from '@agent-device/host-kit/request'; import { readProcessStartTime } from '@agent-device/host-kit/process'; import { readVersion } from '@agent-device/host-kit/version'; -import type { DaemonInvokeFn } from '@agent-device/daemon/daemon-request'; import { createDaemonHttpServer } from '@agent-device/daemon/testing/server/http-server'; import { createSocketServer, listenNetServer } from '@agent-device/daemon/testing/server/transport'; import { createAgentDeviceClient } from '../../agent-device-client.ts'; @@ -38,13 +37,15 @@ import { } from '@agent-device/test-kit/loopback'; import { mkdtempForTestSync } from '@agent-device/test-kit/tmp-dir'; +type WireInvokeFn = (req: DaemonWireRequest) => Promise; + const TOKEN = 'default-transport-abort-token'; type SeenRequest = { started: boolean; canceled: boolean[]; requestId?: string }; // `wait` is the long request the caller abandons; it never answers on its own, so only the client's // disconnect ends it — through the daemon's own request-scoped cancellation. -function hangingWaitHandler(seen: SeenRequest): DaemonInvokeFn { +function hangingWaitHandler(seen: SeenRequest): WireInvokeFn { return async (req: DaemonWireRequest): Promise => { const requestId = req.meta?.requestId; seen.started = true; @@ -94,7 +95,7 @@ async function waitFor(condition: () => boolean, what: string): Promise { async function runDefaultTransportAbort( t: SkippableTestContext, transport: 'socket' | 'http', - serve: (handleRequest: DaemonInvokeFn) => Promise<{ + serve: (handleRequest: WireInvokeFn) => Promise<{ server: Parameters[0]; port: number; destroyConnections?: () => void; diff --git a/src/daemon-client/__tests__/daemon-client-abort-timeout.test.ts b/src/daemon-client/__tests__/daemon-client-abort-timeout.test.ts index 2a7f4a00c3..1ae35cedef 100644 --- a/src/daemon-client/__tests__/daemon-client-abort-timeout.test.ts +++ b/src/daemon-client/__tests__/daemon-client-abort-timeout.test.ts @@ -18,7 +18,6 @@ import { DAEMON_HTTP_INSTANCE_MISMATCH_HEADER } from '@agent-device/contracts/da import { test, vi } from 'vitest'; import { AppError, isRequestCanceledError } from '@agent-device/kernel/errors'; import { getRequestSignal } from '@agent-device/host-kit/request'; -import type { DaemonInvokeFn } from '@agent-device/daemon/daemon-request'; import { createSocketServer, listenNetServer } from '@agent-device/daemon/testing/server/transport'; import { sendRequest } from '../daemon-client-transport.ts'; import { resolveDaemonPaths } from '@agent-device/daemon-contracts/daemon-resolution'; @@ -31,6 +30,8 @@ import { } from '@agent-device/test-kit/loopback'; import { mkdtempForTestSync } from '@agent-device/test-kit/tmp-dir'; +type WireInvokeFn = (req: DaemonWireRequest) => Promise; + const { handleRequestTimeoutCalls } = vi.hoisted(() => ({ handleRequestTimeoutCalls: [] as unknown[], })); @@ -51,7 +52,7 @@ const OUTLIVE_MS = 80; // A request the daemon never answers: the only things that can end it are the client's abort and // the transport's own budget, which is what makes the timer's fate observable. -function hangingHandler(): DaemonInvokeFn { +function hangingHandler(): WireInvokeFn { return async (req: DaemonWireRequest): Promise => { const signal = getRequestSignal(req.meta?.requestId); return await new Promise((_resolve, reject) => { diff --git a/src/daemon-client/__tests__/daemon-client-abort.test.ts b/src/daemon-client/__tests__/daemon-client-abort.test.ts index 5bce33d414..7802705368 100644 --- a/src/daemon-client/__tests__/daemon-client-abort.test.ts +++ b/src/daemon-client/__tests__/daemon-client-abort.test.ts @@ -14,7 +14,6 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import { isRequestCanceledError } from '@agent-device/kernel/errors'; import { getRequestSignal, isRequestCanceled } from '@agent-device/host-kit/request'; -import type { DaemonInvokeFn } from '@agent-device/daemon/daemon-request'; import { createDaemonHttpServer } from '@agent-device/daemon/testing/server/http-server'; import { createSocketServer, listenNetServer } from '@agent-device/daemon/testing/server/transport'; import { sendRequest } from '../daemon-client-transport.ts'; @@ -27,6 +26,8 @@ import { } from '@agent-device/test-kit/loopback'; import { mkdtempForTestSync } from '@agent-device/test-kit/tmp-dir'; +type WireInvokeFn = (req: DaemonWireRequest) => Promise; + const TOKEN = 'abort-signal-token'; const STATE_PATHS = resolveDaemonPaths(mkdtempForTestSync('agent-device-client-abort-')); @@ -40,7 +41,7 @@ type SeenRequest = { // `wait` models the long request the caller abandons; every other command answers immediately, so // the same handler also proves the daemon still serves requests after one was canceled. -function canceledAwareHandler(seen: SeenRequest): DaemonInvokeFn { +function canceledAwareHandler(seen: SeenRequest): WireInvokeFn { return async (req: DaemonWireRequest): Promise => { const requestId = req.meta?.requestId; seen.requestId = requestId; diff --git a/src/daemon-composition.ts b/src/daemon-composition.ts index 0d7a00bfec..83cc6392a4 100644 --- a/src/daemon-composition.ts +++ b/src/daemon-composition.ts @@ -39,10 +39,7 @@ import { import { emitDiagnostic } from '@agent-device/host-kit/diagnostics'; import type { AgentDeviceRuntimeConfig } from '@agent-device/contracts/runtime-contract'; import type { DeviceInfo } from '@agent-device/kernel/device'; -import type { - ComposeDaemonRuntimeDeps, - DaemonRuntimeDeps, -} from '@agent-device/daemon/server/daemon-runtime'; +import type { ComposeDaemonRuntimeDeps, DaemonRuntimeDeps } from '@agent-device/daemon'; /** * Best-effort startup cleanup of managed-agent-browser orphans left by a previous daemon. It runs diff --git a/src/daemon.ts b/src/daemon.ts index c7ca9eef94..d6d1acafd8 100644 --- a/src/daemon.ts +++ b/src/daemon.ts @@ -1,5 +1,5 @@ import { asAppError } from '@agent-device/kernel/errors'; -import { startDaemonRuntime } from '@agent-device/daemon/server/daemon-runtime'; +import { startDaemonRuntime } from '@agent-device/daemon'; // The root's composition enters as a factory behind a function-scoped `await import`: the server // calls it before it acquires the registration, so startup order is unchanged, and the eager diff --git a/src/platform-runtime-daemon-lifecycle.ts b/src/platform-runtime-daemon-lifecycle.ts index 7a6433aef6..8f8d6e792c 100644 --- a/src/platform-runtime-daemon-lifecycle.ts +++ b/src/platform-runtime-daemon-lifecycle.ts @@ -1,4 +1,4 @@ -import type { PlatformOwnerLifecycle } from '@agent-device/daemon/platform-owner-lifecycle'; +import type { PlatformOwnerLifecycle } from '@agent-device/daemon'; import { configureAppleRunnerDeviceClaimAuthorityProbe, configureAppleRunnerLeaseOwnerStateDir, diff --git a/src/platform-runtime-daemon-services.ts b/src/platform-runtime-daemon-services.ts index ad29bbcee2..1a1c13ef4e 100644 --- a/src/platform-runtime-daemon-services.ts +++ b/src/platform-runtime-daemon-services.ts @@ -6,7 +6,7 @@ import { resolveSessionAppBundleIdForTarget, validateOpenRelaunchTarget, } from './platform-runtime-open-target.ts'; -import type { DaemonPlatformServices } from '@agent-device/daemon/platform-services'; +import type { DaemonPlatformServices } from '@agent-device/daemon'; /** * Root composition of the daemon's platform-services port (ADR 0019 section 11). Each member is diff --git a/src/platform-runtime-resource-cleanup.ts b/src/platform-runtime-resource-cleanup.ts index 0a83a827a7..890bdbc27a 100644 --- a/src/platform-runtime-resource-cleanup.ts +++ b/src/platform-runtime-resource-cleanup.ts @@ -1,6 +1,6 @@ import type { DeviceInfo } from '@agent-device/kernel/device'; import { isIosFamily } from '@agent-device/kernel/device'; -import type { PlatformResourceCleanup } from '@agent-device/daemon/platform-resource-cleanup'; +import type { PlatformResourceCleanup } from '@agent-device/daemon'; import { emitDiagnostic, type ResourceDiagnostic } from '@agent-device/host-kit/diagnostics'; import { type OwnedProcessRecordStore } from '@agent-device/host-kit/process'; import { loadAndroidMechanics } from './platform-runtime-android-mechanics.ts'; diff --git a/test/integration/nightly/concurrency-torture/bindings.ts b/test/integration/nightly/concurrency-torture/bindings.ts index c2f18b0842..848fd87d28 100644 --- a/test/integration/nightly/concurrency-torture/bindings.ts +++ b/test/integration/nightly/concurrency-torture/bindings.ts @@ -23,7 +23,7 @@ import type { DeviceInfo } from '@agent-device/kernel/device'; import type { SessionRef } from '@agent-device/daemon/testing/session-state'; import type { SessionStore } from '@agent-device/daemon/testing/session-store'; import { resolveRequestExecutionLockPlan } from '@agent-device/daemon/testing/request-binding'; -import { shouldLockSessionExecution } from '@agent-device/daemon/daemon-command-registry'; +import { shouldLockSessionExecution } from '@agent-device/daemon/testing/daemon-command-registry'; import { PUBLIC_COMMANDS } from '@agent-device/command-registry/catalog'; import { withTestDeviceInventoryProvider as withDeviceInventoryProvider } from '@agent-device/device-selection/inventory-gateways-fixtures'; diff --git a/test/integration/provider-scenarios/daemon-transport.test.ts b/test/integration/provider-scenarios/daemon-transport.test.ts index bc303cf3fa..3a51e5510c 100644 --- a/test/integration/provider-scenarios/daemon-transport.test.ts +++ b/test/integration/provider-scenarios/daemon-transport.test.ts @@ -1,4 +1,4 @@ -import type { DaemonRequest } from '@agent-device/daemon/daemon-request'; +import type { DaemonRequest } from '@agent-device/daemon'; import type { DaemonResponse } from '@agent-device/kernel/contracts'; import assert from 'node:assert/strict'; import http from 'node:http'; diff --git a/test/integration/provider-scenarios/harness.ts b/test/integration/provider-scenarios/harness.ts index e5787e352e..873d2fa790 100644 --- a/test/integration/provider-scenarios/harness.ts +++ b/test/integration/provider-scenarios/harness.ts @@ -26,7 +26,7 @@ import type { AppleSimulatorScreenRecordingProcess } from '../../../src/platform import { trackDownloadableArtifact } from '@agent-device/daemon/testing/artifact-tracking'; import { LeaseRegistry } from '@agent-device/daemon/testing/lease-registry'; import { SessionStore } from '@agent-device/daemon/testing/session-store'; -import type { DaemonInvokeFn } from '@agent-device/daemon/daemon-request'; +import type { DaemonInvokeFn } from '@agent-device/daemon'; import type { SessionState } from '@agent-device/daemon/testing/session-state'; import { runCmdBackground } from '@agent-device/host-kit/command'; import { createOwnedProcessRecordStore } from '@agent-device/host-kit/process'; diff --git a/test/output-economy/owner-files-no-leak.test.ts b/test/output-economy/owner-files-no-leak.test.ts index 415e954c35..38824a9734 100644 --- a/test/output-economy/owner-files-no-leak.test.ts +++ b/test/output-economy/owner-files-no-leak.test.ts @@ -2,8 +2,10 @@ import { describe, expect, test } from 'vitest'; import fs from 'node:fs'; import path from 'node:path'; import { runCmdSync } from '@agent-device/host-kit/command'; -import { COMMAND_OWNER_FILES } from '@agent-device/command-registry/owner-files'; -import { getDaemonRouteOwnerFiles } from '@agent-device/daemon/route-owner-files'; +import { + COMMAND_OWNER_FILES, + getDaemonRouteOwnerFiles, +} from '@agent-device/command-registry/owner-files'; const repoRoot = path.resolve(import.meta.dirname, '../..'); const distPath = path.join(repoRoot, 'dist/src');