diff --git a/packages/contracts/src/dispatched-command.ts b/packages/contracts/src/dispatched-command.ts index 5a3a770d7a..a442e95793 100644 --- a/packages/contracts/src/dispatched-command.ts +++ b/packages/contracts/src/dispatched-command.ts @@ -8,8 +8,8 @@ import type { CommandFlags } from './command-flags.ts'; * * - `kernel/contracts.ts` `DaemonRequest` — the WIRE shape, with `flags?: Record`, * because a process boundary cannot enforce a flag vocabulary. - * - `daemon/types.ts` `DaemonRequest` — the wire shape with `token`/`session` required, `flags` - * narrowed to `CommandFlags`, and `internal?: DaemonRequestInternal` carrying `SessionState` + * - `daemon/daemon-request.ts` `DaemonRequest` — `DaemonWireRequest` (`token`/`session` required, + * `flags` narrowed to `CommandFlags`) plus `internal?: DaemonRequestInternal` carrying `SessionState` * callbacks, the admitted lease and the resolved session scope. Server-private, which is why it * cannot move down here. * diff --git a/packages/contracts/src/session-action.ts b/packages/contracts/src/session-action.ts index cb6fab7c89..666bce9492 100644 --- a/packages/contracts/src/session-action.ts +++ b/packages/contracts/src/session-action.ts @@ -5,7 +5,8 @@ import type { MultiTargetAnnotationV1, TargetAnnotationV1 } from './target-annot // One recorded action in a session's script. // // `replay/` reads and writes these and the Maestro package exports them, so declaring the -// shape inside `daemon/types.ts` made both zones depend on the daemon server to describe a file +// shape inside the daemon's own session record made both zones depend on the daemon server to +// describe a file // format neither of them asks the daemon to produce. The daemon still owns the RECORDING — it is // the only thing that appends actions; this is only the shape they are appended in. // diff --git a/scripts/__tests__/help-conformance-sample-producers.ts b/scripts/__tests__/help-conformance-sample-producers.ts index 74d6496c57..1f3471a4b9 100644 --- a/scripts/__tests__/help-conformance-sample-producers.ts +++ b/scripts/__tests__/help-conformance-sample-producers.ts @@ -25,7 +25,7 @@ import { buildDeviceInUseBySessionError } from '../../src/daemon/session-recover import { buildDeviceClaimConflictError } from '../../src/daemon/device-claim-conflict.ts'; import { activateCompleteRefFrame, readRefMutationFrame } from '../../src/daemon/ref-frame.ts'; import { resolveRefStalenessWarning } from '../../src/daemon/session-snapshot.ts'; -import type { SessionState } from '../../src/daemon/types.ts'; +import type { SessionState } from '../../src/daemon/session-state.ts'; import { buildAppNotInstalledError } from '@agent-device/platform-apple/app-resolution'; import { presentConnectReadiness, diff --git a/scripts/depgraph/README.md b/scripts/depgraph/README.md index 11a81b77f7..8b1ad8b1b2 100644 --- a/scripts/depgraph/README.md +++ b/scripts/depgraph/README.md @@ -120,7 +120,7 @@ roots, exports, and named live-state symbols in `scripts/layering/architecture-o - `vocabulary` — the target is a declared contract facade root. - `capability` — the target is a declared capability root and the import names a declared export. -- `live-state-shape` — the edge names the exact `SessionState` type from `src/daemon/types.ts`. +- `live-state-shape` — the edge names the exact `SessionState` type from `src/daemon/session-state.ts`. - `live-state-authority` — the edge names the exact `SessionStore` class from `src/daemon/session-store.ts`. - `executable-policy` — the source is under a declared executable-policy root. diff --git a/scripts/depgraph/model.test.ts b/scripts/depgraph/model.test.ts index a5956c01a0..bcd2197c1f 100644 --- a/scripts/depgraph/model.test.ts +++ b/scripts/depgraph/model.test.ts @@ -42,26 +42,26 @@ function authorityFixture(): Map { "import { isSessionRecording } from './session-script-publication-capability.ts';", ].join('\n'), 'src/daemon/state-consumer.ts': [ - "import type { SessionState } from './types.ts';", + "import type { SessionState } from './session-state.ts';", "import { SessionStore } from './session-store.ts';", ].join('\n'), 'src/daemon/type-consumer.ts': "import type { SessionStore } from './session-store.ts';\n", 'src/snapshot/policy-consumer.ts': [ - "import type { SessionState } from '../daemon/types.ts';", - "import type { SessionRef } from '../daemon/types.ts';", + "import type { SessionState } from '../daemon/session-state.ts';", + "import type { SessionRef } from '../daemon/session-state.ts';", "import './ordinary-target.ts';", ].join('\n'), 'src/daemon/ordinary-consumer.ts': [ - "import { SessionState } from './session-state.ts';", + "import { SessionState } from './session-state-store.ts';", "import { createRequestRuntimeBindingsExtra } from './request-runtime-binding.ts';", ].join('\n'), - 'src/daemon/types.ts': + 'src/daemon/session-state.ts': 'export type SessionState = { name: string };\nexport type SessionRef = unknown;\n', 'src/daemon/session-store.ts': 'export class SessionStore {}\n', 'src/daemon/request-runtime-binding.ts': 'export function createRequestRuntimeBindings() {}\n', 'src/daemon/session-script-publication-capability.ts': 'export function isSessionRecording() {}\n', - 'src/daemon/session-state.ts': 'export const SessionState = 1;\n', + 'src/daemon/session-state-store.ts': 'export const SessionState = 1;\n', 'src/snapshot/ordinary-target.ts': 'export const ordinary = 1;\n', 'packages/contracts/src/facades/client.ts': 'export type ClientShape = string;\n', 'packages/contracts/src/facades/capture.ts': 'export type CaptureShape = string;\n', @@ -92,10 +92,13 @@ test('authority overlay uses declared roots and symbols, keeps kind separate, an graphEdge(graph, 'src/daemon/capability-consumer.ts', 'src/daemon/request-runtime-binding.ts'), { kind: 'value', labels: ['capability'] }, ); - assert.deepEqual(graphEdge(graph, 'src/daemon/state-consumer.ts', 'src/daemon/types.ts'), { - kind: 'type', - labels: ['live-state-shape'], - }); + assert.deepEqual( + graphEdge(graph, 'src/daemon/state-consumer.ts', 'src/daemon/session-state.ts'), + { + kind: 'type', + labels: ['live-state-shape'], + }, + ); assert.deepEqual( graphEdge(graph, 'src/daemon/state-consumer.ts', 'src/daemon/session-store.ts'), { kind: 'value', labels: ['live-state-authority'] }, @@ -109,7 +112,7 @@ test('authority overlay uses declared roots and symbols, keeps kind separate, an { kind: 'value', labels: ['executable-policy'] }, ); assert.deepEqual( - graphEdge(graph, 'src/daemon/ordinary-consumer.ts', 'src/daemon/session-state.ts'), + graphEdge(graph, 'src/daemon/ordinary-consumer.ts', 'src/daemon/session-state-store.ts'), { kind: 'value', labels: ['ordinary'] }, ); assert.deepEqual( @@ -119,13 +122,17 @@ test('authority overlay uses declared roots and symbols, keeps kind separate, an const stateEdges = resolveImportEdges(files, authorityWorkspaceTargets()).filter( (edge) => - edge.file === 'src/snapshot/policy-consumer.ts' && edge.target === 'src/daemon/types.ts', + edge.file === 'src/snapshot/policy-consumer.ts' && + edge.target === 'src/daemon/session-state.ts', ); assert.equal(stateEdges.length, 2, 'the fixture must exercise raw same-pair imports'); - assert.deepEqual(graphEdge(graph, 'src/snapshot/policy-consumer.ts', 'src/daemon/types.ts'), { - kind: 'type', - labels: ['live-state-shape', 'executable-policy'], - }); + assert.deepEqual( + graphEdge(graph, 'src/snapshot/policy-consumer.ts', 'src/daemon/session-state.ts'), + { + kind: 'type', + labels: ['live-state-shape', 'executable-policy'], + }, + ); assert.deepEqual(graph.edgeAuthorities.length, graph.edges.length); assert.deepEqual(Object.keys(graph.authorityCounts), AUTHORITY_LABELS); assert.deepEqual(graph.authorityCounts, { @@ -163,8 +170,8 @@ test('live-state labels follow shared declarations and reject lookalike targets' assert.deepEqual( authorityLabelsForEdge({ file: 'src/core/live-state-consumer.ts', - target: 'src/daemon/session-state.ts', - spec: './session-state.ts', + target: 'src/daemon/session-state-store.ts', + spec: './session-state-store.ts', dynamic: false, typeOnly: true, line: 1, diff --git a/scripts/layering/architecture-ownership.ts b/scripts/layering/architecture-ownership.ts index 42b6730e88..67fee19e8c 100644 --- a/scripts/layering/architecture-ownership.ts +++ b/scripts/layering/architecture-ownership.ts @@ -221,7 +221,7 @@ export const ARCHITECTURE_OWNERSHIP = { { name: 'session-state-shape', kind: 'live-state-shape', - root: 'src/daemon/types.ts', + root: 'src/daemon/session-state.ts', exports: ['SessionState'], }, { diff --git a/scripts/layering/check.ts b/scripts/layering/check.ts index d61b0def58..23a2a9db52 100644 --- a/scripts/layering/check.ts +++ b/scripts/layering/check.ts @@ -26,7 +26,7 @@ // merge-base (R9). R4 keeps the value graph acyclic, so these cycles are free at // runtime but bound what can be read in isolation. // - Across the DAEMON MODULARITY MIGRATION: R7 ownership pressure and external -// daemon/types.ts importers only shrink, R9 zone membership cannot grow or absorb +// daemon request/session-state importers only shrink, R9 zone membership cannot grow or absorb // engine files, and planned logical modules start with zero forbidden/internal imports (R10). // - Over the WORKSPACE PACKAGES: no root back-imports, no relative tunnelling past // an exports map, and every workspace specifier declared + exports-named (R11). @@ -50,6 +50,7 @@ import { pathToFileURL } from 'node:url'; import { fieldClassificationDrift, findSessionStateWrites, + sessionStateDeclarationFile, sessionStateFields, sessionStateFieldCount, SESSION_STATE_FIELD_OWNERS, @@ -233,19 +234,19 @@ function checkBackEdges(edges: readonly ResolvedImportEdge[]): LayeringViolation } function checkSessionStateOwnership(sources: ReadonlyMap): LayeringViolation[] { - const types = sources.get('src/daemon/types.ts'); - if (!types) { + const declarationFile = sessionStateDeclarationFile(sources); + if (!declarationFile) { return [ { rule: 'R7 session-state-ownership', - file: 'src/daemon/types.ts', + file: 'src/daemon/session-state.ts', line: 1, - message: 'daemon/types.ts is missing, so SessionState ownership cannot be checked.', + message: 'no daemon module declares SessionState, so its ownership cannot be checked.', }, ]; } - const fields = sessionStateFields(types); + const fields = sessionStateFields(sources.get(declarationFile)!); const writes = findSessionStateWrites(sources, fields); const violations: LayeringViolation[] = []; const seenOwners = new Map>(); diff --git a/scripts/layering/daemon-modularity.test.ts b/scripts/layering/daemon-modularity.test.ts index 1b9cef0212..5704f69a93 100644 --- a/scripts/layering/daemon-modularity.test.ts +++ b/scripts/layering/daemon-modularity.test.ts @@ -27,7 +27,7 @@ function importEdge(file: string, target: string): ResolvedImportEdge { function baselineDaemonTypesEdges(): ResolvedImportEdge[] { return DAEMON_MODULARITY_BASELINE.externalDaemonTypesImporters.map((file) => - importEdge(file, 'src/daemon/types.ts'), + importEdge(file, 'src/daemon/daemon-request.ts'), ); } @@ -105,11 +105,14 @@ test('R10 banks an R7 shrink with no edit anywhere', () => { ); }); -test('external daemon/types.ts importer membership changes require the baseline to change', () => { +test('external daemon request/session-state importer membership changes require the baseline to change', () => { const edges = resolveImportEdges( new Map([ - ['src/client/new-importer.ts', "import type { DaemonRequest } from '../daemon/types.ts';"], - ['src/daemon/types.ts', 'export type DaemonRequest = { command: string };'], + [ + 'src/client/new-importer.ts', + "import type { SessionState } from '../daemon/session-state.ts';", + ], + ['src/daemon/session-state.ts', 'export type SessionState = { name: string };'], ]), ); diff --git a/scripts/layering/daemon-modularity.ts b/scripts/layering/daemon-modularity.ts index d7a304e308..d1f8373966 100644 --- a/scripts/layering/daemon-modularity.ts +++ b/scripts/layering/daemon-modularity.ts @@ -21,6 +21,15 @@ export const DAEMON_MODULARITY_BASELINE = { ], } as const; +// The modules that own the daemon's dispatch vocabulary since #2338 split `daemon/types.ts`: +// the request shape, its wire-only half, and the live session record. All three are ratcheted +// together, so moving a symbol between them cannot reopen the boundary to a new outside zone. +const DAEMON_TYPE_MODULES: readonly string[] = [ + 'src/daemon/daemon-request.ts', + 'src/daemon/daemon-request-wire.ts', + 'src/daemon/session-state.ts', +]; + const ENGINE_FILE_PREFIXES = [ 'packages/ad-replay/src/', 'packages/maestro/src/', @@ -31,7 +40,7 @@ const ENGINE_FILE_PREFIXES = [ /** * Catches: the daemon modularity migration regressing quietly — a SessionState field losing * its owner, a logical module gaining a forbidden or internal import, or an external - * daemon/types.ts importer count creeping up — any of which erodes the wave-by-wave + * external daemon request/session-state importer count creeping up — any of which erodes the wave-by-wave * extraction #1478/#1478-P5 already paid for, and nothing enforces the wave order itself. * Evidence: 2316fd32c5 (#1487) pinned the migration contracts this ratchet grew from; * 6984a1e095 (#1852) fixed the R10 zone-listing message when the type-cycle ceiling trips. @@ -39,7 +48,7 @@ const ENGINE_FILE_PREFIXES = [ * below, not attributed separately). * Kill criterion: none enforced today; retire only by maintainer decision that the daemon * modularity measurements (SessionState field-owner counts, logical-module import policies and - * facades, the external daemon/types.ts importer list, per-zone cycle membership) no longer + * facades, the external daemon request/session-state importer list, per-zone cycle membership) no longer * matter. Every one is a count or an import edge the compiler accepts either way. */ export function checkDaemonModularityRatchets( @@ -204,7 +213,7 @@ function checkDaemonTypesImporters(edges: readonly ResolvedImportEdge[]): Layeri const allowed = new Set(DAEMON_MODULARITY_BASELINE.externalDaemonTypesImporters); const importers = new Map(); for (const edge of edges) { - if (edge.target !== 'src/daemon/types.ts' || edge.file.startsWith('src/daemon/')) continue; + if (!DAEMON_TYPE_MODULES.includes(edge.target) || edge.file.startsWith('src/daemon/')) continue; importers.set(edge.file, edge); } const violations = [...importers] @@ -214,7 +223,8 @@ function checkDaemonTypesImporters(edges: readonly ResolvedImportEdge[]): Layeri file, line: edge.line, message: - `external production imports of daemon/types.ts may only shrink from the recorded ${allowed.size}. ` + + `external production imports of the daemon request/session-state modules may only shrink ` + + `from the recorded ${allowed.size}. ` + 'Use an existing neutral contract; do not move DaemonRequest into contracts to satisfy this gate.', })); for (const file of allowed) { @@ -223,7 +233,7 @@ function checkDaemonTypesImporters(edges: readonly ResolvedImportEdge[]): Layeri rule: 'R10 daemon-modularity', file: 'scripts/layering/daemon-modularity.ts', line: 1, - message: `${file} no longer imports daemon/types.ts — delete it from externalDaemonTypesImporters in the same change so the dependency cannot return.`, + message: `${file} no longer imports a daemon request/session-state module — delete it from externalDaemonTypesImporters in the same change so the dependency cannot return.`, }); } return violations; @@ -309,7 +319,7 @@ export function daemonModularitySummary(reference: LayeringRatchets): string { return ( `R10 holds R7 at the merge-base's ${session.writerOwnedFields} writer-owned fields / ` + `${session.ownerFileClaims} owner claims, R9 at its ${reference.largestTypeCycle.length} files per zone, ` + - `${DAEMON_MODULARITY_BASELINE.externalDaemonTypesImporters.length} external daemon/types.ts importers, ` + + `${DAEMON_MODULARITY_BASELINE.externalDaemonTypesImporters.length} external daemon request/session-state importers, ` + 'and zero forbidden logical-module imports' ); } diff --git a/scripts/layering/model.test.ts b/scripts/layering/model.test.ts index c32594644a..773c06a8d3 100644 --- a/scripts/layering/model.test.ts +++ b/scripts/layering/model.test.ts @@ -414,7 +414,7 @@ test('every SessionState field is classified exactly once', () => { // R7 by being invisible to the scan, and the rule would silently stop covering part of the // type it claims to cover. const fields = sessionStateFields( - readFileSync(path.resolve(import.meta.dirname, '../../src/daemon/types.ts'), 'utf8'), + readFileSync(path.resolve(import.meta.dirname, '../../src/daemon/session-state.ts'), 'utf8'), ); assert.deepEqual(fieldClassificationDrift(fields), []); assert.equal( @@ -425,7 +425,7 @@ test('every SessionState field is classified exactly once', () => { test('classification drift is reported in all three directions', () => { const declared = sessionStateFields( - readFileSync(path.resolve(import.meta.dirname, '../../src/daemon/types.ts'), 'utf8'), + readFileSync(path.resolve(import.meta.dirname, '../../src/daemon/session-state.ts'), 'utf8'), ); // Unclassified: a field added to SessionState and to neither table. This is the case the diff --git a/scripts/layering/ratchet-reference.test.ts b/scripts/layering/ratchet-reference.test.ts index d4b2b361a4..daa081fb35 100644 --- a/scripts/layering/ratchet-reference.test.ts +++ b/scripts/layering/ratchet-reference.test.ts @@ -17,7 +17,7 @@ const SESSION_TYPES = [ function tree(extra: Record = {}) { return new Map([ - ['src/daemon/types.ts', SESSION_TYPES], + ['src/daemon/session-state.ts', SESSION_TYPES], ['src/daemon/session-snapshot.ts', 'session.snapshot = "a"; nextSession.snapshot = "b";'], ['src/daemon/ref-frame.ts', 'session.snapshot = undefined;'], ['src/daemon/handlers/trace-runtime.ts', 'session.trace ??= "t";'], diff --git a/scripts/layering/session-resource-ownership.ts b/scripts/layering/session-resource-ownership.ts index c359bd8000..230696adaf 100644 --- a/scripts/layering/session-resource-ownership.ts +++ b/scripts/layering/session-resource-ownership.ts @@ -18,10 +18,16 @@ type AstNode = Record; export const SESSION_RESOURCE_OWNERSHIP_RULE = 'R68 session-resource-ownership'; const RESOURCE_OWNERS: Readonly>> = { - appLog: new Set(['src/daemon/app-log-session-resource.ts', 'src/daemon/types.ts']), - appLogFailure: new Set(['src/daemon/app-log-session-resource.ts', 'src/daemon/types.ts']), - audioProbe: new Set(['src/daemon/audio-probe-session-resource.ts', 'src/daemon/types.ts']), - perfCapture: new Set(['src/daemon/perf-capture-session-resource.ts', 'src/daemon/types.ts']), + appLog: new Set(['src/daemon/app-log-session-resource.ts', 'src/daemon/session-state.ts']), + appLogFailure: new Set(['src/daemon/app-log-session-resource.ts', 'src/daemon/session-state.ts']), + audioProbe: new Set([ + 'src/daemon/audio-probe-session-resource.ts', + 'src/daemon/session-state.ts', + ]), + perfCapture: new Set([ + 'src/daemon/perf-capture-session-resource.ts', + 'src/daemon/session-state.ts', + ]), }; /** Durable session-resource records have one whole-record construction owner per domain. */ diff --git a/scripts/layering/session-state.ts b/scripts/layering/session-state.ts index 1c1f14528f..088628eab7 100644 --- a/scripts/layering/session-state.ts +++ b/scripts/layering/session-state.ts @@ -166,13 +166,30 @@ export function fieldClassificationDrift(fields: readonly string[]): FieldClassi return drift.sort((left, right) => left.field.localeCompare(right.field)); } +const SESSION_STATE_DECLARATION = /export type SessionState = \{([\s\S]*?)\n\};/; + +/** + * The daemon module that declares `SessionState`, found by the declaration rather than by a + * recorded path. `sessionStateWritePressure` below measures the merge-base tree with the same + * function, and that tree's declaration may still sit where this tree no longer has it — a + * path constant would silently measure such a tree as zero pressure and bank the headroom. + */ +export function sessionStateDeclarationFile( + sources: ReadonlyMap, +): string | undefined { + for (const [file, source] of sources) { + if (file.startsWith('src/daemon/') && SESSION_STATE_DECLARATION.test(source)) return file; + } + return undefined; +} + /** * Field names declared by `SessionState` itself, so the scan cannot be fooled by a daemon * module with an unrelated local named `session` (a provider session, a runner session). */ export function sessionStateFields(typesSource: string): string[] { - const declaration = /export type SessionState = \{([\s\S]*?)\n\};/.exec(typesSource); - if (!declaration) throw new Error('SessionState declaration not found in daemon/types.ts'); + const declaration = SESSION_STATE_DECLARATION.exec(typesSource); + if (!declaration) throw new Error('SessionState declaration not found'); return [...declaration[1]!.matchAll(/^ {2}([a-zA-Z][A-Za-z0-9]*)\??:/gm)].map( (match) => match[1]!, ); @@ -294,11 +311,12 @@ export type SessionStateWritePressure = Readonly<{ export function sessionStateWritePressure( sources: ReadonlyMap, ): SessionStateWritePressure { - const types = sources.get('src/daemon/types.ts'); - if (!types) return { writerOwnedFields: 0, ownerFileClaims: 0 }; - const writes = findSessionStateWrites(sources, sessionStateFields(types)).filter( - (write) => write.field !== '[computed]', - ); + const declarationFile = sessionStateDeclarationFile(sources); + if (!declarationFile) return { writerOwnedFields: 0, ownerFileClaims: 0 }; + const writes = findSessionStateWrites( + sources, + sessionStateFields(sources.get(declarationFile)!), + ).filter((write) => write.field !== '[computed]'); return { writerOwnedFields: new Set(writes.map((write) => write.field)).size, ownerFileClaims: new Set(writes.map((write) => `${write.field}\0${write.file}`)).size, diff --git a/src/__tests__/cli-remote-diagnostics.test.ts b/src/__tests__/cli-remote-diagnostics.test.ts index 24bf18219c..231bf20cd1 100644 --- a/src/__tests__/cli-remote-diagnostics.test.ts +++ b/src/__tests__/cli-remote-diagnostics.test.ts @@ -13,7 +13,7 @@ import { normalizeError, AppError } from '@agent-device/kernel/errors'; import { createDaemonHttpServer } from '../daemon/server/http-server.ts'; import { resolveSessionRequestLogPath } from '../daemon/session-store.ts'; import { safeSessionName } from '../daemon/session-paths.ts'; -import type { DaemonRequest, DaemonResponse } from '../daemon/types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon/daemon-request.ts'; import { runCliCapture, type CapturedCliRun } from './cli-capture.ts'; import { closeLoopbackServer, diff --git a/src/__tests__/daemon-client-progress.test.ts b/src/__tests__/daemon-client-progress.test.ts index 96b05feae9..d706bfceae 100644 --- a/src/__tests__/daemon-client-progress.test.ts +++ b/src/__tests__/daemon-client-progress.test.ts @@ -3,7 +3,7 @@ import assert from 'node:assert/strict'; import { EventEmitter } from 'node:events'; import type { Socket } from 'node:net'; import { test } from 'vitest'; -import type { DaemonRequest, DaemonResponse } from '../daemon/types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon/daemon-request.ts'; import { readDaemonSocketProgressResponse } from '../daemon/client/daemon-client-progress.ts'; import { AppError } from '@agent-device/kernel/errors'; diff --git a/src/__tests__/test-utils/replay-script-source.ts b/src/__tests__/test-utils/replay-script-source.ts index 2beeed7edc..f043da01c4 100644 --- a/src/__tests__/test-utils/replay-script-source.ts +++ b/src/__tests__/test-utils/replay-script-source.ts @@ -2,7 +2,7 @@ import fs from 'node:fs'; import type { ReplayScriptSourceBundle } from '@agent-device/contracts/replay'; import type { MaestroSourceReader } from '@agent-device/maestro'; import { resolveUserPath } from '@agent-device/host-kit/file'; -import type { DaemonRequest } from '../../daemon/types.ts'; +import type { DaemonRequest } from '../../daemon/daemon-request.ts'; import { loadReplayScriptSourceBundle } from '../../commands/replay/script-source-bundle.ts'; import { discoverReplaySourcePaths } from '../../commands/replay/source-discovery.ts'; diff --git a/src/__tests__/test-utils/screen-recording-live-handle.ts b/src/__tests__/test-utils/screen-recording-live-handle.ts index c79181782d..d09156efa0 100644 --- a/src/__tests__/test-utils/screen-recording-live-handle.ts +++ b/src/__tests__/test-utils/screen-recording-live-handle.ts @@ -5,7 +5,7 @@ import { import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import type { ScreenRecordingLiveSnapshot } from '@agent-device/contracts/screen-recording-runtime'; import { deviceIdentity } from '@agent-device/kernel/device'; -import type { SessionState } from '../../daemon/types.ts'; +import type { SessionState } from '../../daemon/session-state.ts'; type ScreenRecordingOverrides = Partial; diff --git a/src/__tests__/test-utils/session-factories.ts b/src/__tests__/test-utils/session-factories.ts index f7a6b95fd7..cc1809ec74 100644 --- a/src/__tests__/test-utils/session-factories.ts +++ b/src/__tests__/test-utils/session-factories.ts @@ -1,4 +1,4 @@ -import type { SessionState } from '../../daemon/types.ts'; +import type { SessionState } from '../../daemon/session-state.ts'; import type { SessionScriptPublicationState, SessionScriptRepairStatus, diff --git a/src/cli/replay-test/__tests__/session-test-reporter-values-maestro.test.ts b/src/cli/replay-test/__tests__/session-test-reporter-values-maestro.test.ts index e9c84c3038..ab0295cb84 100644 --- a/src/cli/replay-test/__tests__/session-test-reporter-values-maestro.test.ts +++ b/src/cli/replay-test/__tests__/session-test-reporter-values-maestro.test.ts @@ -41,7 +41,7 @@ import path from 'node:path'; import type { ReplaySuiteResult } from '@agent-device/contracts/replay'; import { handleSessionCommands } from '../../../daemon/handlers/__tests__/session-command-harness.ts'; import { SessionStore } from '../../../daemon/session-store.ts'; -import type { DaemonRequest, DaemonResponse } from '../../../daemon/types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../../daemon/daemon-request.ts'; import { withRequestProgressSink } from '@agent-device/host-kit/request'; import { getReplayTestReporterExitCode, diff --git a/src/cli/replay-test/__tests__/session-test-reporter-values.test.ts b/src/cli/replay-test/__tests__/session-test-reporter-values.test.ts index a9474d3581..b570ae62cb 100644 --- a/src/cli/replay-test/__tests__/session-test-reporter-values.test.ts +++ b/src/cli/replay-test/__tests__/session-test-reporter-values.test.ts @@ -25,7 +25,7 @@ import path from 'node:path'; import type { ReplaySuiteResult } from '@agent-device/contracts/replay'; import { handleSessionCommands } from '../../../daemon/handlers/__tests__/session-command-harness.ts'; import { SessionStore } from '../../../daemon/session-store.ts'; -import type { DaemonRequest, DaemonResponse } from '../../../daemon/types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../../daemon/daemon-request.ts'; import { withRequestProgressSink } from '@agent-device/host-kit/request'; import { withTestDeviceInventoryProvider as withDeviceInventoryProvider } from '../../../__tests__/test-utils/device-inventory-gateways.ts'; import type { DeviceInfo } from '@agent-device/kernel/device'; diff --git a/src/client/client-normalizers.ts b/src/client/client-normalizers.ts index 8708ad49b6..7dd9056a2f 100644 --- a/src/client/client-normalizers.ts +++ b/src/client/client-normalizers.ts @@ -17,11 +17,12 @@ import { isSerialAddressablePlatform, type AppleOS, } from '@agent-device/kernel/device'; +import type { SessionRuntimeHints } from '@agent-device/kernel/contracts'; import { AppError, type DaemonError } from '@agent-device/kernel/errors'; import { sanitizeErrorCause } from '@agent-device/kernel/redaction'; import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { leaseScopeFromOptions, leaseScopeToRequestMeta } from '../core/lease-scope.ts'; -import type { DaemonRequest, SessionRuntimeHints } from '../daemon/types.ts'; +import type { DaemonRequest } from '../daemon/daemon-request.ts'; import { asRecord, isRecord, diff --git a/src/core/command-descriptor/__tests__/parity.test.ts b/src/core/command-descriptor/__tests__/parity.test.ts index 151ad8d94b..6a4b452e1d 100644 --- a/src/core/command-descriptor/__tests__/parity.test.ts +++ b/src/core/command-descriptor/__tests__/parity.test.ts @@ -11,7 +11,7 @@ import { canRunReplayScopedAction, type DaemonCommandDescriptor, } from '../../../daemon/daemon-command-registry.ts'; -import type { DaemonRequest } from '../../../daemon/types.ts'; +import type { DaemonRequest } from '../../../daemon/daemon-request.ts'; import { deriveDaemonCommandDescriptors, deriveStructuredBatchCommandNames } from '../derive.ts'; import { commandDescriptors, diff --git a/src/core/command-descriptor/__tests__/ref-frame-effect.test.ts b/src/core/command-descriptor/__tests__/ref-frame-effect.test.ts index 95fbfa8fac..1ad1096d2c 100644 --- a/src/core/command-descriptor/__tests__/ref-frame-effect.test.ts +++ b/src/core/command-descriptor/__tests__/ref-frame-effect.test.ts @@ -6,7 +6,7 @@ import { DAEMON_COMMAND_DESCRIPTORS, resolveRefFrameEffect, } from '../../../daemon/daemon-command-registry.ts'; -import type { DaemonRequest } from '../../../daemon/types.ts'; +import type { DaemonRequest } from '../../../daemon/daemon-request.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/src/daemon/__tests__/app-log-session-resource.test.ts b/src/daemon/__tests__/app-log-session-resource.test.ts index bbc318f17e..9391cf7c4b 100644 --- a/src/daemon/__tests__/app-log-session-resource.test.ts +++ b/src/daemon/__tests__/app-log-session-resource.test.ts @@ -12,7 +12,7 @@ import { createAppLogAdmissionLedger } from '../app-log-admission-ledger.ts'; import { adoptStartedSessionAppLog } from '../app-log-session-resource.ts'; import { createNextAppLogFence } from '../app-log-start-preflight.ts'; import { appLogResourceStore } from '../app-log-resource-store.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; test('start persists open recovery truth before adopting the live handle', async () => { const context = makeContext(); diff --git a/src/daemon/__tests__/application-lifecycle-recovery.test.ts b/src/daemon/__tests__/application-lifecycle-recovery.test.ts index cb3f86e05f..db92d13f94 100644 --- a/src/daemon/__tests__/application-lifecycle-recovery.test.ts +++ b/src/daemon/__tests__/application-lifecycle-recovery.test.ts @@ -12,7 +12,7 @@ import type { PlatformRequestScope } from '@agent-device/contracts/platform-runt import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { unavailableDeploymentSnapshotAndShutdownOperationFacts } from '../../__tests__/test-utils/runtime-operation-facts.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; import { finalizeDaemonSessionApplicationLifecycle } from '../application-lifecycle-recovery.ts'; const localMechanics = vi.hoisted(() => ({ diff --git a/src/daemon/__tests__/daemon-command-registry.test.ts b/src/daemon/__tests__/daemon-command-registry.test.ts index ef297ce5e0..535e310218 100644 --- a/src/daemon/__tests__/daemon-command-registry.test.ts +++ b/src/daemon/__tests__/daemon-command-registry.test.ts @@ -17,7 +17,7 @@ import { resolveProviderDeviceResolutionIntent, usesSessionlessDefaultProviderDevice, } from '../daemon-command-registry.ts'; -import type { DaemonRequest } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; test('daemon command registry owns specialized handler routes', () => { assert.equal(getDaemonCommandRoute(INTERNAL_COMMANDS.humanControl), 'humanControl'); diff --git a/src/daemon/__tests__/daemon-request-wire.test.ts b/src/daemon/__tests__/daemon-request-wire.test.ts new file mode 100644 index 0000000000..f328e8062b --- /dev/null +++ b/src/daemon/__tests__/daemon-request-wire.test.ts @@ -0,0 +1,73 @@ +import { expect, test } from 'vitest'; +import type { DeviceLease } from '@agent-device/contracts/device'; +import type { DaemonRequest } from '../daemon-request.ts'; +import type { DaemonWireRequest } from '../daemon-request-wire.ts'; +import type { SessionState } from '../session-state.ts'; + +/** + * `DaemonWireRequest` is the shape a consumer may read without depending on the daemon's live + * session record — a journal, an archiver, anything that packages a request. That guarantee is + * structural, so it is checked structurally: the assignments below fail `tsc` (not this run) the + * moment the wire shape regains an `internal` key or grows a property path back to `SessionState` + * or `DeviceLease`. The runtime assertions keep the file honest as a test; `pnpm typecheck` is + * what enforces it. + */ + +type IsExactly = + (() => T extends A ? 1 : 2) extends () => T extends B ? 1 : 2 ? true : false; + +type IsAny = 0 extends 1 & T ? true : false; + +type Depth = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8; +type Prev = [never, 0, 1, 2, 3, 4, 5, 6, 7]; + +/** + * Every type reachable from `T` by reading a property, calling a signature, or indexing an array, + * bounded by `D` so a self-referential shape terminates. `any` short-circuits to `false` rather + * than matching everything, which would make the whole walk report `boolean`. + */ +type Walk = + IsAny extends true + ? false + : IsExactly extends true + ? true + : D extends 0 + ? false + : T extends (...args: infer A) => infer R + ? Walk | Walk + : T extends ReadonlyArray + ? Walk + : T extends object + ? { [K in keyof T]-?: Walk, Target, Prev[D]> }[keyof T] + : false; + +/** Whether any property path of `T` reaches `Target`. */ +type Reaches = true extends Walk ? true : false; + +const wireHasNoInternalKey: IsExactly, never> = true; +const wireCannotReachSessionState: IsExactly< + Reaches, + false +> = true; +const wireCannotReachDeviceLease: IsExactly, false> = true; + +// Positive controls: without these, a walk that simply never finds anything would pass above. +const requestHasInternalKey: IsExactly, 'internal'> = true; +const requestReachesSessionState: IsExactly, true> = true; +const requestReachesDeviceLease: IsExactly, true> = true; + +test('the wire request shape carries no daemon-only half', () => { + expect([wireHasNoInternalKey, wireCannotReachSessionState, wireCannotReachDeviceLease]).toEqual([ + true, + true, + true, + ]); +}); + +test('the daemon request shape does reach both, so the walk above can find them', () => { + expect([requestHasInternalKey, requestReachesSessionState, requestReachesDeviceLease]).toEqual([ + true, + true, + true, + ]); +}); diff --git a/src/daemon/__tests__/daemon-runtime-app-log.test.ts b/src/daemon/__tests__/daemon-runtime-app-log.test.ts index 91623160bf..ef0581f5d1 100644 --- a/src/daemon/__tests__/daemon-runtime-app-log.test.ts +++ b/src/daemon/__tests__/daemon-runtime-app-log.test.ts @@ -15,7 +15,7 @@ import { flushDaemonStartupDiagnostics, teardownDaemonSessionForShutdown, } from '../server/daemon-runtime.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; import { unavailableDeviceRuntimeGateway } from './test-device-runtime-gateway.ts'; test('daemon startup awaits app-log recovery after acquiring the lock and before opening servers', () => { diff --git a/src/daemon/__tests__/deferred-interaction-outcome.test.ts b/src/daemon/__tests__/deferred-interaction-outcome.test.ts index 56a2689ac1..1dbc8374c7 100644 --- a/src/daemon/__tests__/deferred-interaction-outcome.test.ts +++ b/src/daemon/__tests__/deferred-interaction-outcome.test.ts @@ -11,7 +11,7 @@ import { countDiagnosticEventsByPhase, withDiagnosticsScope, } from '@agent-device/host-kit/diagnostics'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; import { deliverySnapshot, makeSession, diff --git a/src/daemon/__tests__/direct-ios-selector.test.ts b/src/daemon/__tests__/direct-ios-selector.test.ts index ed236259cc..8bf0d3e5e2 100644 --- a/src/daemon/__tests__/direct-ios-selector.test.ts +++ b/src/daemon/__tests__/direct-ios-selector.test.ts @@ -2,7 +2,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { AppError } from '@agent-device/kernel/errors'; import { ANDROID_EMULATOR, IOS_SIMULATOR } from '../../__tests__/test-utils/device-fixtures.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; import { deriveDirectIosNodeSelector, isDirectIosSelectorFallbackError, diff --git a/src/daemon/__tests__/durable-capture-resource.fixtures.ts b/src/daemon/__tests__/durable-capture-resource.fixtures.ts index a925df9ed1..60e57cc0af 100644 --- a/src/daemon/__tests__/durable-capture-resource.fixtures.ts +++ b/src/daemon/__tests__/durable-capture-resource.fixtures.ts @@ -12,7 +12,7 @@ import { createDurableCaptureResourceStore, type DurableCaptureResourceStore, } from '@agent-device/capture-kit/durable-capture'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; export const testCaptureStore = createDurableCaptureResourceStore({ resourceKind: 'app-log', diff --git a/src/daemon/__tests__/generic-settle.test.ts b/src/daemon/__tests__/generic-settle.test.ts index 71f14008a3..06898dd425 100644 --- a/src/daemon/__tests__/generic-settle.test.ts +++ b/src/daemon/__tests__/generic-settle.test.ts @@ -6,7 +6,8 @@ import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; import { activateCompleteRefFrame, refFrameState } from '../ref-frame.ts'; import { setSessionSnapshot } from '../session-snapshot.ts'; import type { SessionStore } from '../session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; import { buildSnapshotState } from '../../core/snapshot-state.ts'; // #1638 `--settle` on the GENERIC daemon route (scroll/back): the settled diff, diff --git a/src/daemon/__tests__/http-server-artifacts.test.ts b/src/daemon/__tests__/http-server-artifacts.test.ts index 52adf08048..e085668512 100644 --- a/src/daemon/__tests__/http-server-artifacts.test.ts +++ b/src/daemon/__tests__/http-server-artifacts.test.ts @@ -8,7 +8,7 @@ import { listDownloadableArtifacts, trackDownloadableArtifact, } from '../artifact-tracking.ts'; -import type { DaemonResponse } from '../types.ts'; +import type { DaemonResponse } from '../daemon-request.ts'; import { runCmdSync, withCommandExecutorOverride } from '@agent-device/host-kit/command'; import { closeLoopbackServer, diff --git a/src/daemon/__tests__/http-server-rpc-validation.test.ts b/src/daemon/__tests__/http-server-rpc-validation.test.ts index 8975a4390e..1783cdf605 100644 --- a/src/daemon/__tests__/http-server-rpc-validation.test.ts +++ b/src/daemon/__tests__/http-server-rpc-validation.test.ts @@ -3,7 +3,7 @@ import assert from 'node:assert/strict'; import fs from 'node:fs'; import path from 'node:path'; import { createDaemonHttpServer } from '../server/http-server.ts'; -import type { DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import { cleanupUploadedArtifact, trackUploadedArtifact } from '../artifact-tracking.ts'; import { resolveInstallSource } from '../install-source-resolution.ts'; import { diff --git a/src/daemon/__tests__/http-server-tenant-trust.test.ts b/src/daemon/__tests__/http-server-tenant-trust.test.ts index c5f829994b..6980fbce7f 100644 --- a/src/daemon/__tests__/http-server-tenant-trust.test.ts +++ b/src/daemon/__tests__/http-server-tenant-trust.test.ts @@ -6,7 +6,7 @@ import { createDaemonHttpServer } from '../server/http-server.ts'; import { resolveSessionRequestLogPath } from '../session-store.ts'; import { safeSessionName } from '../session-paths.ts'; import { DAEMON_HTTP_TENANT_HEADER } from '@agent-device/contracts/daemon-http'; -import type { DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import { closeLoopbackServer, listenOnLoopback, diff --git a/src/daemon/__tests__/human-control-fixtures.ts b/src/daemon/__tests__/human-control-fixtures.ts index 8430d2537d..b5c2a9b5ff 100644 --- a/src/daemon/__tests__/human-control-fixtures.ts +++ b/src/daemon/__tests__/human-control-fixtures.ts @@ -1,7 +1,7 @@ import type { HumanControlHold, HumanControlHoldScope } from '@agent-device/contracts/client'; import type { DeviceLease } from '@agent-device/contracts/device'; import type { AllocateLeaseRequest } from '../lease-registry-scope.ts'; -import type { DaemonRequest } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; import { AppError } from '@agent-device/kernel/errors'; export const HUMAN_CONTROL_SCOPE: HumanControlHoldScope = { diff --git a/src/daemon/__tests__/install-source-resolution.test.ts b/src/daemon/__tests__/install-source-resolution.test.ts index 4cb0c62c7d..c67a83598f 100644 --- a/src/daemon/__tests__/install-source-resolution.test.ts +++ b/src/daemon/__tests__/install-source-resolution.test.ts @@ -3,7 +3,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { resolveInstallSource } from '../install-source-resolution.ts'; import { trackUploadedArtifact } from '../artifact-tracking.ts'; -import type { DaemonRequest } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; import { mkdtempForTestSync } from '../../__tests__/test-utils/tmp-dir.ts'; function makeRequest(meta?: DaemonRequest['meta']): DaemonRequest { diff --git a/src/daemon/__tests__/interaction-outcome-policy.test.ts b/src/daemon/__tests__/interaction-outcome-policy.test.ts index cd38b55960..4005e90eaa 100644 --- a/src/daemon/__tests__/interaction-outcome-policy.test.ts +++ b/src/daemon/__tests__/interaction-outcome-policy.test.ts @@ -8,7 +8,7 @@ import { markPendingInteractionOutcome, stripInternalInteractionFlags, } from '../interaction-outcome-policy.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; import { IOS_SIMULATOR } from '../../__tests__/test-utils/device-fixtures.ts'; test('classifyInteractionSurfaceChange treats identical surfaces as unchanged', () => { diff --git a/src/daemon/__tests__/is-runtime.test.ts b/src/daemon/__tests__/is-runtime.test.ts index 38a0bde852..a43d3309e5 100644 --- a/src/daemon/__tests__/is-runtime.test.ts +++ b/src/daemon/__tests__/is-runtime.test.ts @@ -10,7 +10,7 @@ import { import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; import { withTestDeviceInventory } from '../../__tests__/test-utils/device-inventory-gateways.ts'; import { makeSnapshotState } from '../../__tests__/test-utils/snapshot-builders.ts'; -import type { DaemonRequest } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; import { selectorCaptureFixture } from './selector-capture-fixture.ts'; const { mockRunAppleRunnerCommand } = vi.hoisted(() => ({ mockRunAppleRunnerCommand: vi.fn() })); diff --git a/src/daemon/__tests__/lease-context.test.ts b/src/daemon/__tests__/lease-context.test.ts index 20b53a34e0..28b2af8ee2 100644 --- a/src/daemon/__tests__/lease-context.test.ts +++ b/src/daemon/__tests__/lease-context.test.ts @@ -7,7 +7,7 @@ import { type SessionLease, } from '../lease-context.ts'; import { buildLeaseDiagnosticsContext } from '../../core/lease-scope.ts'; -import type { DaemonRequest } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; test('buildSessionLeaseFromRequest captures complete request lease scope', () => { const lease = buildSessionLeaseFromRequest({ diff --git a/src/daemon/__tests__/lease-lifecycle.test.ts b/src/daemon/__tests__/lease-lifecycle.test.ts index 84eea2f987..e6c3f6751c 100644 --- a/src/daemon/__tests__/lease-lifecycle.test.ts +++ b/src/daemon/__tests__/lease-lifecycle.test.ts @@ -9,7 +9,7 @@ import { releaseSessionLease, resolveSessionLeaseForRequest, } from '../lease-lifecycle.ts'; -import type { DaemonRequest } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; test('admitRequestLeaseForLockedScope heartbeats and stores admitted lease on the request', () => { let now = 1_000; diff --git a/src/daemon/__tests__/offscreen-target-probe.test.ts b/src/daemon/__tests__/offscreen-target-probe.test.ts index d08a255d01..9afc5c4abd 100644 --- a/src/daemon/__tests__/offscreen-target-probe.test.ts +++ b/src/daemon/__tests__/offscreen-target-probe.test.ts @@ -3,7 +3,7 @@ import assert from 'node:assert/strict'; import { AppError } from '@agent-device/kernel/errors'; import { IOS_SIMULATOR } from '../../__tests__/test-utils/device-fixtures.ts'; import { withAppleRunnerProvider } from '@agent-device/platform-apple/runner'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; const { mockRunAppleRunnerCommand } = vi.hoisted(() => ({ mockRunAppleRunnerCommand: vi.fn(), diff --git a/src/daemon/__tests__/post-gesture-no-effect-claim.test.ts b/src/daemon/__tests__/post-gesture-no-effect-claim.test.ts index 258bb9fefe..ba6eed22f3 100644 --- a/src/daemon/__tests__/post-gesture-no-effect-claim.test.ts +++ b/src/daemon/__tests__/post-gesture-no-effect-claim.test.ts @@ -18,7 +18,7 @@ import { markDeferredInteractionOutcome, } from '../deferred-interaction-outcome.ts'; import { formatGestureNoEffectWarning } from '../gesture-no-effect.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; import { chromeWithListSnapshot, makeSession, diff --git a/src/daemon/__tests__/post-gesture-stabilization-fixtures.ts b/src/daemon/__tests__/post-gesture-stabilization-fixtures.ts index 5e42d60333..ae24ca5fea 100644 --- a/src/daemon/__tests__/post-gesture-stabilization-fixtures.ts +++ b/src/daemon/__tests__/post-gesture-stabilization-fixtures.ts @@ -1,6 +1,6 @@ import { ANDROID_EMULATOR, IOS_SIMULATOR } from '../../__tests__/test-utils/device-fixtures.ts'; import { makeSnapshotState } from '../../__tests__/test-utils/snapshot-builders.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; /** * Shared fixtures for the deferred-interaction-outcome test cluster: diff --git a/src/daemon/__tests__/post-gesture-stabilization.test.ts b/src/daemon/__tests__/post-gesture-stabilization.test.ts index 3cdc90d20f..c08e194ad6 100644 --- a/src/daemon/__tests__/post-gesture-stabilization.test.ts +++ b/src/daemon/__tests__/post-gesture-stabilization.test.ts @@ -11,7 +11,7 @@ import { capturePostGestureStabilizedResult, markDeferredInteractionOutcome, } from '../deferred-interaction-outcome.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; import { chromeWithListSnapshot, deliverySnapshot, diff --git a/src/daemon/__tests__/providers-plugin-routing-parity.test.ts b/src/daemon/__tests__/providers-plugin-routing-parity.test.ts index 9ef989127c..5d5c273088 100644 --- a/src/daemon/__tests__/providers-plugin-routing-parity.test.ts +++ b/src/daemon/__tests__/providers-plugin-routing-parity.test.ts @@ -33,7 +33,7 @@ import { type PlatformProviderResolvers, } from '../../platform-runtime.ts'; import { resolvePlatformProviderRequestContext } from '../request-platform-provider-context.ts'; -import type { DaemonRequest } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; // 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/daemon/__tests__/ref-frame.test.ts b/src/daemon/__tests__/ref-frame.test.ts index 0fe1549042..e5476fc2db 100644 --- a/src/daemon/__tests__/ref-frame.test.ts +++ b/src/daemon/__tests__/ref-frame.test.ts @@ -9,10 +9,10 @@ import { refFrameEpoch, refFrameScope, refFrameState, - type RefFrame, type RefFrameAdmission, } from '../ref-frame.ts'; -import type { SessionState } from '../types.ts'; +import type { RefFrame } from '../ref-frame-slot.ts'; +import type { SessionState } from '../session-state.ts'; function session(overrides: Partial = {}): SessionState { return { @@ -148,7 +148,7 @@ test('expireRefFrame clears scoped-snapshot lineage at the seam (ADR 0014)', () assert.equal(s.snapshotScopeSource, undefined); }); -test('a frame cannot be constructed, edited, or derived outside ref-frame.ts', () => { +test('a frame cannot be constructed, edited, or derived outside ref-frame-slot.ts', () => { const frame = refFrame(session()); const rejectedByTsc = [ // @ts-expect-error the class value is not exported, so no literal is a frame diff --git a/src/daemon/__tests__/request-admission.test.ts b/src/daemon/__tests__/request-admission.test.ts index f0f79c8315..e4bfca61d0 100644 --- a/src/daemon/__tests__/request-admission.test.ts +++ b/src/daemon/__tests__/request-admission.test.ts @@ -3,7 +3,7 @@ import assert from 'node:assert/strict'; import { makeIosSession } from '../../__tests__/test-utils/session-factories.ts'; import { LeaseRegistry } from '../lease-registry.ts'; import { assertRequestLeaseAdmission } from '../request-admission.ts'; -import type { DaemonRequest } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; import type { ProviderAppCatalog } from '@agent-device/contracts/device'; const limrunAppCatalog: ProviderAppCatalog = { diff --git a/src/daemon/__tests__/request-diagnostics-http.test.ts b/src/daemon/__tests__/request-diagnostics-http.test.ts index 0102d2b9a1..34c89bb1ca 100644 --- a/src/daemon/__tests__/request-diagnostics-http.test.ts +++ b/src/daemon/__tests__/request-diagnostics-http.test.ts @@ -6,7 +6,7 @@ import path from 'node:path'; import { createDaemonHttpServer } from '../server/http-server.ts'; import { resolveSessionRequestLogPath } from '../session-store.ts'; import { safeSessionName } from '../session-paths.ts'; -import type { DaemonResponse } from '../types.ts'; +import type { DaemonResponse } from '../daemon-request.ts'; import { closeLoopbackServer, listenOnLoopback, diff --git a/src/daemon/__tests__/request-execution-scope.test.ts b/src/daemon/__tests__/request-execution-scope.test.ts index 44f8f8e2d1..a835a28dbd 100644 --- a/src/daemon/__tests__/request-execution-scope.test.ts +++ b/src/daemon/__tests__/request-execution-scope.test.ts @@ -20,7 +20,7 @@ import { prepareLockedRequestScope, } from '../request-execution-scope.ts'; import { resolveSessionRequestLogPath } from '../session-store.ts'; -import type { DaemonRequest } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; import { mkdtempForTestSync } from '../../__tests__/test-utils/tmp-dir.ts'; import { makeTestScreenRecordingResource } from '../../__tests__/test-utils/screen-recording-live-handle.ts'; import { handleSessionCloseCommands } from '../session-lifecycle/index.ts'; diff --git a/src/daemon/__tests__/request-finalization.test.ts b/src/daemon/__tests__/request-finalization.test.ts index 2a144eceaf..d79325ee44 100644 --- a/src/daemon/__tests__/request-finalization.test.ts +++ b/src/daemon/__tests__/request-finalization.test.ts @@ -1,6 +1,6 @@ import { test, expect } from 'vitest'; import { finalizeDaemonResponse } from '../request-finalization.ts'; -import type { DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import type { DaemonArtifactType } from '@agent-device/kernel/contracts'; test('finalizeDaemonResponse preserves handler error hints from details', () => { diff --git a/src/daemon/__tests__/request-handler-catalog.test.ts b/src/daemon/__tests__/request-handler-catalog.test.ts index 98ef6af80b..e655560aa5 100644 --- a/src/daemon/__tests__/request-handler-catalog.test.ts +++ b/src/daemon/__tests__/request-handler-catalog.test.ts @@ -22,7 +22,7 @@ import { unavailableBindExactDevice, unavailableInspectFacts, } from './test-device-runtime-gateway.ts'; -import type { DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import { mkdtempForTestSync } from '../../__tests__/test-utils/tmp-dir.ts'; import { createScreenRecordingAdmissionLedger } from '../screen-recording-admission-ledger.ts'; import { createAudioProbeAdmissionLedger } from '../audio-probe-admission-ledger.ts'; diff --git a/src/daemon/__tests__/request-handler-chain-provider-scope.test.ts b/src/daemon/__tests__/request-handler-chain-provider-scope.test.ts index e878380d04..091b464c03 100644 --- a/src/daemon/__tests__/request-handler-chain-provider-scope.test.ts +++ b/src/daemon/__tests__/request-handler-chain-provider-scope.test.ts @@ -21,7 +21,7 @@ import { import { createScreenRecordingAdmissionLedger } from '../screen-recording-admission-ledger.ts'; import { createAudioProbeAdmissionLedger } from '../audio-probe-admission-ledger.ts'; import { createPerfCaptureAdmissionLedger } from '../perf-capture-admission-ledger.ts'; -import type { DaemonRequest } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; import type { AndroidAdbExecutor } from '@agent-device/platform-android/mechanics'; function makeRequest(command: string, sessionName: string): DaemonRequest { diff --git a/src/daemon/__tests__/request-handler-chain.test.ts b/src/daemon/__tests__/request-handler-chain.test.ts index d8e64efe0d..4ed20e9cbc 100644 --- a/src/daemon/__tests__/request-handler-chain.test.ts +++ b/src/daemon/__tests__/request-handler-chain.test.ts @@ -6,7 +6,7 @@ import { INTERNAL_COMMANDS } from '../../command-catalog.ts'; import { LeaseRegistry } from '../lease-registry.ts'; import { runRequestHandlerChain } from '../request-handler-chain.ts'; import { getDaemonRouteOwnerFiles } from '../route-owner-files.ts'; -import type { DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import { LINUX_DEVICE } from '../../__tests__/test-utils/device-fixtures.ts'; import { makeIosSession, makeSession } from '../../__tests__/test-utils/session-factories.ts'; import { makeSnapshotState } from '../../__tests__/test-utils/snapshot-builders.ts'; diff --git a/src/daemon/__tests__/request-lock-identity-policy.test.ts b/src/daemon/__tests__/request-lock-identity-policy.test.ts index 1916a779f2..803f608f1c 100644 --- a/src/daemon/__tests__/request-lock-identity-policy.test.ts +++ b/src/daemon/__tests__/request-lock-identity-policy.test.ts @@ -2,7 +2,8 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { AppError } from '@agent-device/kernel/errors'; import { applyRequestLockPolicy } from '../request-lock-policy.ts'; -import type { DaemonRequest, SessionRef, SessionState } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; +import type { SessionRef, SessionState } from '../session-state.ts'; /** * One table for the device-identity half of the session lock. A device identity selector diff --git a/src/daemon/__tests__/request-lock-policy.test.ts b/src/daemon/__tests__/request-lock-policy.test.ts index e5c0642201..a56b5fdb6d 100644 --- a/src/daemon/__tests__/request-lock-policy.test.ts +++ b/src/daemon/__tests__/request-lock-policy.test.ts @@ -1,7 +1,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { applyRequestLockPolicy } from '../request-lock-policy.ts'; -import type { SessionRef, SessionState } from '../types.ts'; +import type { SessionRef, SessionState } from '../session-state.ts'; const IOS_SESSION: SessionState = { name: 'qa-ios', diff --git a/src/daemon/__tests__/request-platform-providers.test.ts b/src/daemon/__tests__/request-platform-providers.test.ts index 6fa9b42115..82095fc325 100644 --- a/src/daemon/__tests__/request-platform-providers.test.ts +++ b/src/daemon/__tests__/request-platform-providers.test.ts @@ -30,7 +30,7 @@ import type { PlatformProviderRequestContext, } from '@agent-device/contracts/platform-providers'; import { resolvePlatformProviderRequestContext } from '../request-platform-provider-context.ts'; -import type { DaemonRequest } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; const OTHER_IOS_SIMULATOR: DeviceInfo = { platform: 'apple', diff --git a/src/daemon/__tests__/request-recording-health.test.ts b/src/daemon/__tests__/request-recording-health.test.ts index ce7c9c3096..2893431ce7 100644 --- a/src/daemon/__tests__/request-recording-health.test.ts +++ b/src/daemon/__tests__/request-recording-health.test.ts @@ -1,5 +1,5 @@ import { test, expect, vi, beforeEach } from 'vitest'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; import { makeTestScreenRecordingResource } from '../../__tests__/test-utils/screen-recording-live-handle.ts'; vi.mock('@agent-device/platform-apple/runner/operations', () => ({ diff --git a/src/daemon/__tests__/request-router-android-modal.test.ts b/src/daemon/__tests__/request-router-android-modal.test.ts index 3c0aa0ca5c..f49af77108 100644 --- a/src/daemon/__tests__/request-router-android-modal.test.ts +++ b/src/daemon/__tests__/request-router-android-modal.test.ts @@ -13,7 +13,7 @@ import { gestureDeviceRuntimeGateway, gestureRuntimeSpies, } from './test-device-runtime-gateway.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; import { LeaseRegistry } from '../lease-registry.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; import { createProviderDeviceRuntimeRequestProviders } from '../../provider-device-runtime.ts'; diff --git a/src/daemon/__tests__/request-router-apps-admission.test.ts b/src/daemon/__tests__/request-router-apps-admission.test.ts index 716a38876f..7c45d7b0d4 100644 --- a/src/daemon/__tests__/request-router-apps-admission.test.ts +++ b/src/daemon/__tests__/request-router-apps-admission.test.ts @@ -6,7 +6,7 @@ import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform import { createTestDeviceInventoryGateways } from '../../__tests__/test-utils/device-inventory-gateways.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; import { LeaseRegistry } from '../lease-registry.ts'; -import type { DaemonRequest } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; import { createRequestHandler } from './test-device-runtime-gateway.ts'; function createAppsAdmissionHarness(apps: readonly string[] = []) { diff --git a/src/daemon/__tests__/request-router-cost.test.ts b/src/daemon/__tests__/request-router-cost.test.ts index 84c0700caa..c3d4bd732b 100644 --- a/src/daemon/__tests__/request-router-cost.test.ts +++ b/src/daemon/__tests__/request-router-cost.test.ts @@ -17,7 +17,8 @@ import { gestureRuntimeSpies, } from './test-device-runtime-gateway.ts'; import { emitDiagnostic } from '@agent-device/host-kit/diagnostics'; -import type { DaemonRequest, SessionState } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; import { LeaseRegistry } from '../lease-registry.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; import { commandRpcParamsSchema } from '@agent-device/kernel/contracts'; diff --git a/src/daemon/__tests__/request-router-lock-policy.test.ts b/src/daemon/__tests__/request-router-lock-policy.test.ts index 9e5e5dbb37..25487db97a 100644 --- a/src/daemon/__tests__/request-router-lock-policy.test.ts +++ b/src/daemon/__tests__/request-router-lock-policy.test.ts @@ -21,7 +21,7 @@ import { systemRuntimeSpies, } from './test-device-runtime-gateway.ts'; import { snapshotRuntimeFixture } from './snapshot-runtime-fixture.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; import { LeaseRegistry } from '../lease-registry.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; import type { DeviceRuntimeGateway } from '@agent-device/contracts/platform-runtime'; diff --git a/src/daemon/__tests__/request-router-recording-health.test.ts b/src/daemon/__tests__/request-router-recording-health.test.ts index bf8011a66e..3540b121bb 100644 --- a/src/daemon/__tests__/request-router-recording-health.test.ts +++ b/src/daemon/__tests__/request-router-recording-health.test.ts @@ -15,7 +15,7 @@ import { gestureDeviceRuntimeGateway, gestureRuntimeSpies, } from './test-device-runtime-gateway.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; import { LeaseRegistry } from '../lease-registry.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; import { makeTestScreenRecordingResource } from '../../__tests__/test-utils/screen-recording-live-handle.ts'; diff --git a/src/daemon/__tests__/request-router-repair-expired.test.ts b/src/daemon/__tests__/request-router-repair-expired.test.ts index 496b0edb14..65f71db864 100644 --- a/src/daemon/__tests__/request-router-repair-expired.test.ts +++ b/src/daemon/__tests__/request-router-repair-expired.test.ts @@ -16,7 +16,8 @@ import { mkdtempForTestSync } from '../../__tests__/test-utils/tmp-dir.ts'; vi.mock('../device-ready.ts', () => ({ ensureDeviceReady: vi.fn(async () => {}) })); import { createRequestHandler } from './test-device-runtime-gateway.ts'; -import type { DaemonRequest, SessionState } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { LeaseRegistry } from '../lease-registry.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; diff --git a/src/daemon/__tests__/request-router-response-level.test.ts b/src/daemon/__tests__/request-router-response-level.test.ts index cf2a2c0242..1d49b173a4 100644 --- a/src/daemon/__tests__/request-router-response-level.test.ts +++ b/src/daemon/__tests__/request-router-response-level.test.ts @@ -34,7 +34,8 @@ import { gestureRuntimeSpies, lifecycleDeviceRuntimeGateway, } from './test-device-runtime-gateway.ts'; -import type { DaemonRequest, SessionState } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; import { LeaseRegistry } from '../lease-registry.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; import { commandRpcParamsSchema } from '@agent-device/kernel/contracts'; diff --git a/src/daemon/__tests__/request-router-screenshot.test.ts b/src/daemon/__tests__/request-router-screenshot.test.ts index 4caf921917..c340463026 100644 --- a/src/daemon/__tests__/request-router-screenshot.test.ts +++ b/src/daemon/__tests__/request-router-screenshot.test.ts @@ -23,7 +23,8 @@ import { type ScreenshotRuntimeFixture, type ScreenshotRuntimeFixtureOptions, } from './screenshot-runtime-fixture.ts'; -import type { DaemonRequest, SessionState } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; import { LeaseRegistry } from '../lease-registry.ts'; import { attachRefs } from '@agent-device/kernel/snapshot'; import { PNG } from '@agent-device/capture-kit/png'; diff --git a/src/daemon/__tests__/request-router-session-address.test.ts b/src/daemon/__tests__/request-router-session-address.test.ts index 7ef2bc46b9..6a1b8bf2d6 100644 --- a/src/daemon/__tests__/request-router-session-address.test.ts +++ b/src/daemon/__tests__/request-router-session-address.test.ts @@ -31,7 +31,7 @@ import { ensureDeviceReady } from '../device-ready.ts'; import { awaitFixtureReadiness } from './application-lifecycle-runtime-fixture.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; import type { DeviceInfo } from '@agent-device/kernel/device'; -import type { DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; /** * The production route for the #2031/#1394 defect: a request without `--session` resolves the diff --git a/src/daemon/__tests__/request-router-typed-error.test.ts b/src/daemon/__tests__/request-router-typed-error.test.ts index 5c2222ac26..9ca4e583d2 100644 --- a/src/daemon/__tests__/request-router-typed-error.test.ts +++ b/src/daemon/__tests__/request-router-typed-error.test.ts @@ -19,7 +19,8 @@ import { lifecycleDeviceRuntimeGateway, systemRuntimeSpies, } from './test-device-runtime-gateway.ts'; -import type { DaemonRequest, SessionState } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; import { LeaseRegistry } from '../lease-registry.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; import { diff --git a/src/daemon/__tests__/request-save-script-policy.test.ts b/src/daemon/__tests__/request-save-script-policy.test.ts index 44f3103377..af4a6f978e 100644 --- a/src/daemon/__tests__/request-save-script-policy.test.ts +++ b/src/daemon/__tests__/request-save-script-policy.test.ts @@ -9,7 +9,7 @@ import { SAVE_SCRIPT_FLAG_OWNER_COMMANDS, unsupportedSaveScriptFlagResponse, } from '../request-save-script-policy.ts'; -import type { DaemonRequest } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; function request(command: string, flags: DaemonRequest['flags']): DaemonRequest { return { token: 'token', session: 'default', command, positionals: [], flags }; diff --git a/src/daemon/__tests__/request-save-script-transports.test.ts b/src/daemon/__tests__/request-save-script-transports.test.ts index 05e1492b4d..78a90663f4 100644 --- a/src/daemon/__tests__/request-save-script-transports.test.ts +++ b/src/daemon/__tests__/request-save-script-transports.test.ts @@ -23,7 +23,8 @@ import { createRequestHandler } from './test-device-runtime-gateway.ts'; import { SessionStore } from '../session-store.ts'; import { createDaemonHttpServer } from '../server/http-server.ts'; import { createSocketServer, listenNetServer } from '../server/transport.ts'; -import type { DaemonInvokeFn, DaemonResponse, SessionState } from '../types.ts'; +import type { DaemonInvokeFn, DaemonResponse } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; import { makeIosSession } from '../../__tests__/test-utils/session-factories.ts'; import { closeLoopbackServer, diff --git a/src/daemon/__tests__/response-views.test.ts b/src/daemon/__tests__/response-views.test.ts index 8aa9898410..2377300133 100644 --- a/src/daemon/__tests__/response-views.test.ts +++ b/src/daemon/__tests__/response-views.test.ts @@ -1,6 +1,6 @@ import { test, expect } from 'vitest'; import { RESPONSE_VIEWS } from '../response-views.ts'; -import type { DaemonResponseData } from '../types.ts'; +import type { DaemonResponseData } from '../daemon-request.ts'; const snapshotView = RESPONSE_VIEWS.snapshot; const screenshotView = RESPONSE_VIEWS.screenshot; diff --git a/src/daemon/__tests__/screen-recording-boundary-faults.test.ts b/src/daemon/__tests__/screen-recording-boundary-faults.test.ts index 915fea4d75..23d937ab23 100644 --- a/src/daemon/__tests__/screen-recording-boundary-faults.test.ts +++ b/src/daemon/__tests__/screen-recording-boundary-faults.test.ts @@ -22,7 +22,7 @@ import { createDurableCaptureAdmissionLedger } from '../durable-capture-admissio import { createDurableCaptureResource } from '../durable-capture-resource.ts'; import type { DurableCaptureResourceStore } from '@agent-device/capture-kit/durable-capture'; import { screenRecordingResourceStore } from '../screen-recording-resource-store.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; type ScreenRecordingStore = DurableCaptureResourceStore<'screen-recording'>; diff --git a/src/daemon/__tests__/screen-recording-session-resource.test.ts b/src/daemon/__tests__/screen-recording-session-resource.test.ts index f7152918d3..d078c70fde 100644 --- a/src/daemon/__tests__/screen-recording-session-resource.test.ts +++ b/src/daemon/__tests__/screen-recording-session-resource.test.ts @@ -10,7 +10,7 @@ import { finishLiveScreenRecording, } from '../screen-recording-session-resource.ts'; import { screenRecordingResourceStore } from '../screen-recording-resource-store.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; test('screen recording persists durable truth before adopting only handle and envelope', async () => { const sessionStore = makeSessionStore('screen-recording-session-resource-'); diff --git a/src/daemon/__tests__/screenshot-crop.test.ts b/src/daemon/__tests__/screenshot-crop.test.ts index 3e3aeb5de8..93baab9b42 100644 --- a/src/daemon/__tests__/screenshot-crop.test.ts +++ b/src/daemon/__tests__/screenshot-crop.test.ts @@ -15,7 +15,7 @@ import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { expect, test, vi } from 'vitest'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; import { buildScreenshotCropWarnings, cropScreenshotToSelector } from '../screenshot-crop.ts'; import { writeSolidPng } from './screenshot-runtime-fixture.ts'; diff --git a/src/daemon/__tests__/screenshot-runtime.test.ts b/src/daemon/__tests__/screenshot-runtime.test.ts index 8913fa1dfc..ea019f94c5 100644 --- a/src/daemon/__tests__/screenshot-runtime.test.ts +++ b/src/daemon/__tests__/screenshot-runtime.test.ts @@ -9,7 +9,8 @@ import { makeSession } from '../../__tests__/test-utils/session-factories.ts'; import type { GenericPlatformExecutionParams } from '../request-generic-dispatch.ts'; import { resolveScreenshotGenericExecution } from '../screenshot-runtime.ts'; import { screenshotRuntimeFixture } from './screenshot-runtime-fixture.ts'; -import type { DaemonRequest, SessionState } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; const unavailableCapture = Object.freeze({ available: false, diff --git a/src/daemon/__tests__/selector-recording.test.ts b/src/daemon/__tests__/selector-recording.test.ts index 320ac9b3da..ea319a2ff7 100644 --- a/src/daemon/__tests__/selector-recording.test.ts +++ b/src/daemon/__tests__/selector-recording.test.ts @@ -12,7 +12,7 @@ import path from 'node:path'; import { recordIfSession } from '../selector-recording.ts'; import { SessionStore } from '../session-store.ts'; import { makeIosSession } from '../../__tests__/test-utils/session-factories.ts'; -import type { DaemonRequest } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; import { mkdtempForTestSync } from '../../__tests__/test-utils/tmp-dir.ts'; function makeStore(): SessionStore { diff --git a/src/daemon/__tests__/selector-runtime.test.ts b/src/daemon/__tests__/selector-runtime.test.ts index dc4ba555c7..bf16d25932 100644 --- a/src/daemon/__tests__/selector-runtime.test.ts +++ b/src/daemon/__tests__/selector-runtime.test.ts @@ -3,7 +3,7 @@ import assert from 'node:assert/strict'; import { AppError } from '@agent-device/kernel/errors'; import { IOS_SIMULATOR } from '../../__tests__/test-utils/device-fixtures.ts'; import { withAppleRunnerProvider } from '@agent-device/platform-apple/runner'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; const { mockRunAppleRunnerCommand } = vi.hoisted(() => ({ mockRunAppleRunnerCommand: vi.fn(), diff --git a/src/daemon/__tests__/session-device-resolution.test.ts b/src/daemon/__tests__/session-device-resolution.test.ts index 2aeaeb8240..7bcd17844a 100644 --- a/src/daemon/__tests__/session-device-resolution.test.ts +++ b/src/daemon/__tests__/session-device-resolution.test.ts @@ -1,5 +1,5 @@ import { test, expect, vi, beforeEach } from 'vitest'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; import { resolveCommandDevice, diff --git a/src/daemon/__tests__/session-event-request.test.ts b/src/daemon/__tests__/session-event-request.test.ts index 3a40947945..1b3c42e5ea 100644 --- a/src/daemon/__tests__/session-event-request.test.ts +++ b/src/daemon/__tests__/session-event-request.test.ts @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import { buildRequestFinishedEvent, buildRequestStartedEvent } from '../session-event-log.ts'; -import type { DaemonRequest, DaemonResponseData } from '../types.ts'; +import type { DaemonRequest, DaemonResponseData } from '../daemon-request.ts'; function buildSuccessEvent( command: string, diff --git a/src/daemon/__tests__/session-routing.test.ts b/src/daemon/__tests__/session-routing.test.ts index 75f4f92b17..a297e16041 100644 --- a/src/daemon/__tests__/session-routing.test.ts +++ b/src/daemon/__tests__/session-routing.test.ts @@ -4,7 +4,8 @@ import fs from 'node:fs'; import path from 'node:path'; import { SessionStore } from '../session-store.ts'; import { resolveEffectiveSessionName, resolveSessionScope } from '../session-routing.ts'; -import type { DaemonRequest, SessionState } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; import { mkdtempForTestSync } from '../../__tests__/test-utils/tmp-dir.ts'; function makeSession(name: string): SessionState { diff --git a/src/daemon/__tests__/session-selector.test.ts b/src/daemon/__tests__/session-selector.test.ts index 6d35767881..961b9ffdda 100644 --- a/src/daemon/__tests__/session-selector.test.ts +++ b/src/daemon/__tests__/session-selector.test.ts @@ -2,7 +2,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { assertSessionSelectorMatches } from '../session-selector.ts'; import { AppError } from '@agent-device/kernel/errors'; -import type { SessionRef, SessionState } from '../types.ts'; +import type { SessionRef, SessionState } from '../session-state.ts'; function makeSession(overrides?: Partial): SessionState { return { diff --git a/src/daemon/__tests__/session-snapshot.test.ts b/src/daemon/__tests__/session-snapshot.test.ts index c3c2bd7b28..b0b64ef0f2 100644 --- a/src/daemon/__tests__/session-snapshot.test.ts +++ b/src/daemon/__tests__/session-snapshot.test.ts @@ -1,6 +1,6 @@ import { expect, test } from 'vitest'; import type { SnapshotState } from '@agent-device/kernel/snapshot'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; import { markSessionPartialRefsIssued, resolveRefStalenessWarning, diff --git a/src/daemon/__tests__/session-store.test.ts b/src/daemon/__tests__/session-store.test.ts index d0d5979460..37f757e85f 100644 --- a/src/daemon/__tests__/session-store.test.ts +++ b/src/daemon/__tests__/session-store.test.ts @@ -5,7 +5,7 @@ import os from 'node:os'; import path from 'node:path'; import { AppError } from '@agent-device/kernel/errors'; import { SessionStore } from '../session-store.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; import { buildRequestFinishedEvent } from '../session-event-log.ts'; import { HEAL_COMPLETE_SENTINEL } from '../session-script-writer.ts'; import { parseReplayScriptDetailed } from '@agent-device/ad-script'; diff --git a/src/daemon/__tests__/session-teardown.fixtures.ts b/src/daemon/__tests__/session-teardown.fixtures.ts index b052e20a8f..a042851556 100644 --- a/src/daemon/__tests__/session-teardown.fixtures.ts +++ b/src/daemon/__tests__/session-teardown.fixtures.ts @@ -5,7 +5,7 @@ import { createDurableResourceEnvelope } from '@agent-device/capture-kit'; import { WEB_DESKTOP_DEVICE } from '../../__tests__/test-utils/device-fixtures.ts'; import { screenRecordingResourceStore } from '../screen-recording-resource-store.ts'; import type { SessionStore } from '../session-store.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; export function makeRecordingSession(params: { name: string; diff --git a/src/daemon/__tests__/snapshot-custom-actions-platform-guard.test.ts b/src/daemon/__tests__/snapshot-custom-actions-platform-guard.test.ts index 129f6aae50..f8da105434 100644 --- a/src/daemon/__tests__/snapshot-custom-actions-platform-guard.test.ts +++ b/src/daemon/__tests__/snapshot-custom-actions-platform-guard.test.ts @@ -14,7 +14,7 @@ import type { DeviceInfo } from '@agent-device/kernel/device'; import { createRequestHandler } from './test-device-runtime-gateway.ts'; import { LeaseRegistry } from '../lease-registry.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; import type { DeviceRuntimeGateway } from '@agent-device/contracts/platform-runtime'; import { type PlatformRuntimeOperations, diff --git a/src/daemon/__tests__/snapshot-quality-latch.test.ts b/src/daemon/__tests__/snapshot-quality-latch.test.ts index f8da9217a5..1f7f00a852 100644 --- a/src/daemon/__tests__/snapshot-quality-latch.test.ts +++ b/src/daemon/__tests__/snapshot-quality-latch.test.ts @@ -14,7 +14,7 @@ import { import { dispatchSnapshotDiffViaRuntime } from '../snapshot-diff-runtime.ts'; import { dispatchSnapshotViaRuntime } from '../snapshot-runtime.ts'; import { SessionStore } from '../session-store.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; import { legacyDispatchCapture } from './legacy-snapshot-capture-fixture.ts'; import { snapshotRuntimeFixture } from './snapshot-runtime-fixture.ts'; diff --git a/src/daemon/__tests__/snapshot-runtime-binding.test.ts b/src/daemon/__tests__/snapshot-runtime-binding.test.ts index 7d6c81fdb0..e22112e463 100644 --- a/src/daemon/__tests__/snapshot-runtime-binding.test.ts +++ b/src/daemon/__tests__/snapshot-runtime-binding.test.ts @@ -9,7 +9,7 @@ import { admitAndBindSnapshotCapture, resolveBoundSnapshotCaptureRuntime, } from '../snapshot-runtime-binding.ts'; -import type { DaemonRequest } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; import { snapshotRuntimeFixture } from './snapshot-runtime-fixture.ts'; import { ensureDeviceReady } from '../device-ready.ts'; diff --git a/src/daemon/__tests__/system-surface-disclosure.test.ts b/src/daemon/__tests__/system-surface-disclosure.test.ts index 21641741f4..04d4921563 100644 --- a/src/daemon/__tests__/system-surface-disclosure.test.ts +++ b/src/daemon/__tests__/system-surface-disclosure.test.ts @@ -4,7 +4,7 @@ import { handleFindCommands } from '../interaction/index.ts'; import { getRuntimeBindings } from './interaction-get-runtime-fixture.ts'; import { dispatchFindReadOnlyViaRuntime } from '../selector-runtime.ts'; import { dispatchWaitViaRuntime } from '../wait-runtime.ts'; -import type { DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import { ANDROID_SYSTEM_SURFACE_DISCLOSURE } from '../../core/android-system-surface-disclosure.ts'; import { snapshotRuntimeFixture } from './snapshot-runtime-fixture.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; diff --git a/src/daemon/__tests__/test-device-runtime-gateway.ts b/src/daemon/__tests__/test-device-runtime-gateway.ts index d5f884bdec..4c1cd68ca1 100644 --- a/src/daemon/__tests__/test-device-runtime-gateway.ts +++ b/src/daemon/__tests__/test-device-runtime-gateway.ts @@ -22,7 +22,7 @@ import type { DeviceInfo } from '@agent-device/kernel/device'; import { applicationLifecycleRuntimeFixture } from './application-lifecycle-runtime-fixture.ts'; import { createUnavailableRuntimeFactsForTest } from '../../__tests__/test-utils/runtime-operation-facts.ts'; import { withClientReplayScriptSources } from '../../__tests__/test-utils/replay-script-source.ts'; -import type { DaemonInvokeFn } from '../types.ts'; +import type { DaemonInvokeFn } from '../daemon-request.ts'; import { clearAndroidObservationFixture } from './android-observation-fixture.ts'; import { platformResourceCleanup } from '../../platform-runtime-resource-cleanup.ts'; diff --git a/src/daemon/__tests__/wait-conditional-selector.test.ts b/src/daemon/__tests__/wait-conditional-selector.test.ts index a397f870e7..a24dafd1bc 100644 --- a/src/daemon/__tests__/wait-conditional-selector.test.ts +++ b/src/daemon/__tests__/wait-conditional-selector.test.ts @@ -23,7 +23,8 @@ import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; import { unavailableDeploymentSnapshotAndShutdownOperationFacts } from '../../__tests__/test-utils/runtime-operation-facts.ts'; import { handleSnapshotCommands } from '../handlers/snapshot.ts'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from '../request-runtime-binding.ts'; -import type { DaemonRequest, SessionState } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; const available = Object.freeze({ available: true } as const); const unavailable = Object.freeze({ diff --git a/src/daemon/__tests__/wait-runtime.test.ts b/src/daemon/__tests__/wait-runtime.test.ts index ea73b788d9..a558dab83b 100644 --- a/src/daemon/__tests__/wait-runtime.test.ts +++ b/src/daemon/__tests__/wait-runtime.test.ts @@ -26,7 +26,7 @@ import { unavailableDeploymentSnapshotAndShutdownOperationFacts } from '../../__ import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from '../request-runtime-binding.ts'; import { handleSnapshotCommands } from '../handlers/snapshot.ts'; import { resolveBoundSelectorCapture } from '../selector-capture-binding.ts'; -import type { DaemonRequest } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; const webDevice = { id: 'web', diff --git a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-email-regression.test.ts b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-email-regression.test.ts index 5099a86ab5..29706b2c1a 100644 --- a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-email-regression.test.ts +++ b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-email-regression.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; import { createDaemonMaestroRuntimePort } from '../daemon-runtime-port.ts'; import { makeBaseRequest, makeDependencies } from './daemon-runtime-port-fixtures.ts'; diff --git a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-fixtures.ts b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-fixtures.ts index d41891a1f4..cb8e9ad487 100644 --- a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-fixtures.ts +++ b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-fixtures.ts @@ -1,4 +1,4 @@ -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; import type { SnapshotNode, SnapshotState } from '@agent-device/kernel/snapshot'; import type { CreateDaemonMaestroRuntimeOperationsOptions } from '../daemon-runtime-port.ts'; diff --git a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-mutations.test.ts b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-mutations.test.ts index 7919511728..2331d50e03 100644 --- a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-mutations.test.ts +++ b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-mutations.test.ts @@ -1,6 +1,6 @@ import { expect, test } from 'vitest'; import type { MaestroRuntimeCommand } from '@agent-device/maestro'; -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; import { createDaemonMaestroRuntimePort } from '../daemon-runtime-port.ts'; import { MAESTRO_OBSERVATION_POLL_MS } from '../daemon-runtime-port-observation.ts'; import { makeBaseRequest, makeDependencies } from './daemon-runtime-port-fixtures.ts'; diff --git a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-observation-input.test.ts b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-observation-input.test.ts index f7c014ce86..a28c8d4d2a 100644 --- a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-observation-input.test.ts +++ b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-observation-input.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; import { createDaemonMaestroRuntimePort } from '../daemon-runtime-port.ts'; import { makeBaseRequest, makeDependencies } from './daemon-runtime-port-fixtures.ts'; diff --git a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-observation-recovery.test.ts b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-observation-recovery.test.ts index ec6fc8a07c..f00fcf17b7 100644 --- a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-observation-recovery.test.ts +++ b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-observation-recovery.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; import { createDaemonMaestroRuntimePort } from '../daemon-runtime-port.ts'; import { MAESTRO_OBSERVATION_POLL_MS } from '../daemon-runtime-port-observation.ts'; import { makeBaseRequest, makeDependencies } from './daemon-runtime-port-fixtures.ts'; diff --git a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-observation-scroll.test.ts b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-observation-scroll.test.ts index c5da2afa57..972b3ce473 100644 --- a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-observation-scroll.test.ts +++ b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-observation-scroll.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import type { DaemonInvokeFn, DaemonRequest } from '../../../types.ts'; +import type { DaemonInvokeFn, DaemonRequest } from '../../../daemon-request.ts'; import { createDaemonMaestroRuntimePort } from '../daemon-runtime-port.ts'; import { makeBaseRequest, makeDependencies } from './daemon-runtime-port-fixtures.ts'; diff --git a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-observation.test.ts b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-observation.test.ts index 790b4111cd..7b6b324881 100644 --- a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-observation.test.ts +++ b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-observation.test.ts @@ -5,7 +5,7 @@ import { inspectMaestroFlow, type MaestroObservation, } from '@agent-device/maestro'; -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; import { createDaemonMaestroRuntimePort } from '../daemon-runtime-port.ts'; import { MAESTRO_OBSERVATION_POLL_MS, diff --git a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-selector-fallback.test.ts b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-selector-fallback.test.ts index ed77dde969..1bb0521e88 100644 --- a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-selector-fallback.test.ts +++ b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-selector-fallback.test.ts @@ -1,7 +1,7 @@ import { INTERACTION_ERROR_REASONS } from '@agent-device/contracts/interaction-error'; import type { DaemonError } from '@agent-device/kernel/errors'; import { expect, test } from 'vitest'; -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; import { createDaemonMaestroRuntimePort } from '../daemon-runtime-port.ts'; import { makeBaseRequest, makeDependencies } from './daemon-runtime-port-fixtures.ts'; diff --git a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-snapshot-source.test.ts b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-snapshot-source.test.ts index 16d02bc252..d6c27f31e8 100644 --- a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-snapshot-source.test.ts +++ b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-snapshot-source.test.ts @@ -3,7 +3,7 @@ import { attachSnapshotClickabilityEvidence, readSnapshotClickabilityEvidence, } from '@agent-device/contracts/capture'; -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; import { MAESTRO_OBSERVATION_POLL_MS } from '../daemon-runtime-port-observation.ts'; import { createDaemonMaestroSnapshotSource } from '../daemon-runtime-port-snapshot-source.ts'; import { makeBaseRequest, makeDependencies } from './daemon-runtime-port-fixtures.ts'; diff --git a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-target-geometry.test.ts b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-target-geometry.test.ts index 54a27ae5f1..d6da21c60d 100644 --- a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-target-geometry.test.ts +++ b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-target-geometry.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; import { createDaemonMaestroRuntimePort } from '../daemon-runtime-port.ts'; import { makeBaseRequest, makeDependencies } from './daemon-runtime-port-fixtures.ts'; diff --git a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-target-refresh.test.ts b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-target-refresh.test.ts index 567f550395..b1a406752c 100644 --- a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-target-refresh.test.ts +++ b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-target-refresh.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import type { DaemonInvokeFn, DaemonRequest } from '../../../types.ts'; +import type { DaemonInvokeFn, DaemonRequest } from '../../../daemon-request.ts'; import { createDaemonMaestroRuntimePort } from '../daemon-runtime-port.ts'; import { makeBaseRequest, makeDependencies } from './daemon-runtime-port-fixtures.ts'; diff --git a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-targets.test.ts b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-targets.test.ts index 65b94aaa8e..970c9c9409 100644 --- a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-targets.test.ts +++ b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-targets.test.ts @@ -1,7 +1,7 @@ import { expect, test } from 'vitest'; import { promises as fs } from 'node:fs'; import { PNG } from '@agent-device/capture-kit/png'; -import type { DaemonInvokeFn, DaemonRequest } from '../../../types.ts'; +import type { DaemonInvokeFn, DaemonRequest } from '../../../daemon-request.ts'; import { createDaemonMaestroRuntimePort } from '../daemon-runtime-port.ts'; import { makeBaseRequest, makeDependencies } from './daemon-runtime-port-fixtures.ts'; diff --git a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port.test.ts b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port.test.ts index 353baf882d..9466ebb222 100644 --- a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port.test.ts +++ b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port.test.ts @@ -3,7 +3,7 @@ import path from 'node:path'; import { expect, test } from 'vitest'; import { noMaestroIncludeSources } from '../../../../__tests__/test-utils/replay-script-source.ts'; import { executeMaestroFlow, inspectMaestroFlow } from '@agent-device/maestro'; -import type { DaemonInvokeFn, DaemonRequest } from '../../../types.ts'; +import type { DaemonInvokeFn, DaemonRequest } from '../../../daemon-request.ts'; import { PNG } from '@agent-device/capture-kit/png'; import { emitDiagnostic, diff --git a/src/daemon/adapters/maestro/daemon-runtime-port-support.ts b/src/daemon/adapters/maestro/daemon-runtime-port-support.ts index 87bb3720d8..47cbaab074 100644 --- a/src/daemon/adapters/maestro/daemon-runtime-port-support.ts +++ b/src/daemon/adapters/maestro/daemon-runtime-port-support.ts @@ -12,7 +12,7 @@ import type { DaemonRequest, DaemonResponse, DaemonResponseData, -} from '../../types.ts'; +} from '../../daemon-request.ts'; import { AppError } from '@agent-device/kernel/errors'; import type { Rect } from '@agent-device/kernel/snapshot'; import type { DaemonMaestroRuntimeDependencies } from './daemon-runtime-port-observation.ts'; diff --git a/src/daemon/adapters/maestro/daemon-runtime-public-operation.ts b/src/daemon/adapters/maestro/daemon-runtime-public-operation.ts index 1aebedd820..72a0bb3016 100644 --- a/src/daemon/adapters/maestro/daemon-runtime-public-operation.ts +++ b/src/daemon/adapters/maestro/daemon-runtime-public-operation.ts @@ -3,7 +3,7 @@ import type { MaestroDispatchSelector, MaestroSinglePointerGestureInput, } from '@agent-device/maestro'; -import type { DaemonRequest } from '../../types.ts'; +import type { DaemonRequest } from '../../daemon-request.ts'; import type { Point, Rect } from '@agent-device/kernel/snapshot'; export type MaestroClickOptions = Pick< diff --git a/src/daemon/android-foreground-surface.ts b/src/daemon/android-foreground-surface.ts index 9a48c98434..1a84ab7eac 100644 --- a/src/daemon/android-foreground-surface.ts +++ b/src/daemon/android-foreground-surface.ts @@ -1,7 +1,7 @@ import type { AndroidObservationAdapter } from '@agent-device/contracts/android-observation'; import { AppError } from '@agent-device/kernel/errors'; import { isActiveProviderDevice } from '../provider-device-runtime.ts'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; export type AndroidEscapeSurface = { expectedPackage: string; diff --git a/src/daemon/android-snapshot-timeout-evidence.ts b/src/daemon/android-snapshot-timeout-evidence.ts index d08bb336d3..7e70c4ea27 100644 --- a/src/daemon/android-snapshot-timeout-evidence.ts +++ b/src/daemon/android-snapshot-timeout-evidence.ts @@ -1,7 +1,8 @@ import { promises as fs } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import type { DaemonResponse, SessionState } from './types.ts'; +import type { DaemonResponse } from './daemon-request.ts'; +import type { SessionState } from './session-state.ts'; import { emitDiagnostic } from '@agent-device/host-kit/diagnostics'; import { AppError, normalizeError } from '@agent-device/kernel/errors'; import { diff --git a/src/daemon/android-system-dialog.ts b/src/daemon/android-system-dialog.ts index daaa45b5e2..3bd079bd36 100644 --- a/src/daemon/android-system-dialog.ts +++ b/src/daemon/android-system-dialog.ts @@ -9,7 +9,7 @@ import { centerOfRect, type SnapshotNode } from '@agent-device/kernel/snapshot'; import { isSnapshotNodeInteractionBlocked } from '@agent-device/capture-kit/snapshot-occlusion'; import { expireRefFrame } from './ref-frame.ts'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; import { isActiveProviderDevice } from '../provider-device-runtime.ts'; const ANDROID_BLOCKING_MODAL_PATTERN = /\bis(?:n(?:'|'|')?t| not)\s+responding\b/i; diff --git a/src/daemon/app-log-session-resource.ts b/src/daemon/app-log-session-resource.ts index 429044c506..c7c134e686 100644 --- a/src/daemon/app-log-session-resource.ts +++ b/src/daemon/app-log-session-resource.ts @@ -12,7 +12,7 @@ import type { AppLogAdmissionLedger } from './app-log-admission-ledger.ts'; import { createDurableCaptureResource } from './durable-capture-resource.ts'; import { appLogResourceStore } from './app-log-resource-store.ts'; import type { SessionStore } from './session-store.ts'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; export type AppLogSessionSnapshot = Readonly<{ active: boolean; diff --git a/src/daemon/apple-runner-options.ts b/src/daemon/apple-runner-options.ts index 79cd1a9ce5..69dfc68acd 100644 --- a/src/daemon/apple-runner-options.ts +++ b/src/daemon/apple-runner-options.ts @@ -1,5 +1,5 @@ import type { AppleRunnerRequestOptions } from '@agent-device/contracts/apple-runner-request'; -import type { DaemonRequest } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; export type { AppleRunnerRequestOptions } from '@agent-device/contracts/apple-runner-request'; diff --git a/src/daemon/application-lifecycle-execution.ts b/src/daemon/application-lifecycle-execution.ts index a99c91e070..ee1ba79e47 100644 --- a/src/daemon/application-lifecycle-execution.ts +++ b/src/daemon/application-lifecycle-execution.ts @@ -1,6 +1,6 @@ import type { ApplicationLifecycleExecution } from '@agent-device/contracts/application-lifecycle-runtime'; import { resolveRunnerLogicalLeaseContext } from './lease-context.ts'; -import type { DaemonRequest } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; /** Builds the request-scoped context consumed by an already-admitted lifecycle binding. */ export function applicationLifecycleExecutionFromRequest( diff --git a/src/daemon/application-lifecycle-recovery.ts b/src/daemon/application-lifecycle-recovery.ts index 8a6e416f22..402ba9e0fe 100644 --- a/src/daemon/application-lifecycle-recovery.ts +++ b/src/daemon/application-lifecycle-recovery.ts @@ -16,7 +16,7 @@ import { import type { PlatformRequestScope } from '@agent-device/contracts/platform-runtime-host'; import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; import { AppError } from '@agent-device/kernel/errors'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from './request-runtime-binding.ts'; type SessionFinalization = Readonly<{ diff --git a/src/daemon/audio-probe-session-resource.ts b/src/daemon/audio-probe-session-resource.ts index 0e115aaa6d..46b82d2006 100644 --- a/src/daemon/audio-probe-session-resource.ts +++ b/src/daemon/audio-probe-session-resource.ts @@ -13,7 +13,7 @@ import { createDurableCaptureResource } from './durable-capture-resource.ts'; import type { AudioProbeAdmissionLedger } from './audio-probe-admission-ledger.ts'; import { audioProbeResourceStore } from './audio-probe-resource-store.ts'; import type { SessionStore } from './session-store.ts'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; export const audioProbeDurableResource = createDurableCaptureResource< 'audio-probe', diff --git a/src/daemon/client/__tests__/boundary-fault-acceptance.test.ts b/src/daemon/client/__tests__/boundary-fault-acceptance.test.ts index 943b1e54f6..52b6fdfdc8 100644 --- a/src/daemon/client/__tests__/boundary-fault-acceptance.test.ts +++ b/src/daemon/client/__tests__/boundary-fault-acceptance.test.ts @@ -6,7 +6,7 @@ import { AppError } from '@agent-device/kernel/errors'; import { assertRejectsAppError } from '../../../__tests__/test-utils/app-error.ts'; import { mkdtempForTestSync } from '../../../__tests__/test-utils/tmp-dir.ts'; import type { DaemonPaths } from '../../config.ts'; -import type { DaemonRequest } from '../../types.ts'; +import type { DaemonRequest } from '../../daemon-request.ts'; import { sendRequest } from '../daemon-client-transport.ts'; type ProcessDeathCommand = 'press' | 'fill' | 'snapshot' | 'screenshot' | 'open' | 'close'; diff --git a/src/daemon/client/__tests__/boundary-fault-transport.test.ts b/src/daemon/client/__tests__/boundary-fault-transport.test.ts index 867413af02..98ce4aa06e 100644 --- a/src/daemon/client/__tests__/boundary-fault-transport.test.ts +++ b/src/daemon/client/__tests__/boundary-fault-transport.test.ts @@ -12,7 +12,7 @@ import { } from '../../../__tests__/test-utils/loopback.ts'; import { mkdtempForTestSync } from '../../../__tests__/test-utils/tmp-dir.ts'; import type { DaemonPaths } from '../../config.ts'; -import type { DaemonRequest } from '../../types.ts'; +import type { DaemonRequest } from '../../daemon-request.ts'; import { sendRequest } from '../daemon-client-transport.ts'; const { mockRunCmdSync } = vi.hoisted(() => ({ mockRunCmdSync: vi.fn() })); diff --git a/src/daemon/client/__tests__/daemon-client-timeout-route.test.ts b/src/daemon/client/__tests__/daemon-client-timeout-route.test.ts index af956466d4..3f8870f671 100644 --- a/src/daemon/client/__tests__/daemon-client-timeout-route.test.ts +++ b/src/daemon/client/__tests__/daemon-client-timeout-route.test.ts @@ -40,7 +40,7 @@ vi.mock('@agent-device/host-kit/command', async () => { import { AppError } from '@agent-device/kernel/errors'; import { sendRequest } from '../daemon-client-transport.ts'; -import type { DaemonRequest } from '../../types.ts'; +import type { DaemonRequest } from '../../daemon-request.ts'; import type { DaemonInfo } from '../daemon-client-metadata.ts'; import type { DaemonPaths } from '../../config.ts'; diff --git a/src/daemon/client/daemon-client-lifecycle.ts b/src/daemon/client/daemon-client-lifecycle.ts index ab5b0ac92d..b67ba14079 100644 --- a/src/daemon/client/daemon-client-lifecycle.ts +++ b/src/daemon/client/daemon-client-lifecycle.ts @@ -4,7 +4,7 @@ import os from 'node:os'; import path from 'node:path'; import { AppError, normalizeError } from '@agent-device/kernel/errors'; import { readReplayDivergenceResume } from '@agent-device/contracts/divergence'; -import type { DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import { runCmdDetachedMonitored, type ExecDetachedExit, diff --git a/src/daemon/client/daemon-client-progress.ts b/src/daemon/client/daemon-client-progress.ts index b628fbaab1..d6c166e5a6 100644 --- a/src/daemon/client/daemon-client-progress.ts +++ b/src/daemon/client/daemon-client-progress.ts @@ -4,7 +4,7 @@ import type { RequestProgressEvent, RequestProgressSink } from '@agent-device/co import type http from 'node:http'; import type { Socket } from 'node:net'; import { AppError } from '@agent-device/kernel/errors'; -import type { DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import { consumeTextLines } from '@agent-device/host-kit/transport'; import { markDoctorProgressRendered } from './doctor-progress.ts'; import { diff --git a/src/daemon/client/daemon-client-rpc.ts b/src/daemon/client/daemon-client-rpc.ts index fe0a23297a..6bada6f385 100644 --- a/src/daemon/client/daemon-client-rpc.ts +++ b/src/daemon/client/daemon-client-rpc.ts @@ -6,7 +6,7 @@ import { } from '@agent-device/kernel/errors'; import { sanitizeErrorCause } from '@agent-device/kernel/redaction'; import { createRequestId } from '@agent-device/host-kit/diagnostics'; -import type { DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import { materializeRemoteArtifacts } from '../../remote/daemon-artifacts.ts'; import { localizeRemoteDaemonError } from '../../remote/remote-request-diagnostics.ts'; import type { DaemonInfo } from './daemon-client-metadata.ts'; diff --git a/src/daemon/client/daemon-client-transport.ts b/src/daemon/client/daemon-client-transport.ts index ba68466ee9..b386f32072 100644 --- a/src/daemon/client/daemon-client-transport.ts +++ b/src/daemon/client/daemon-client-transport.ts @@ -2,7 +2,7 @@ import type { RequestProgressSink } from '@agent-device/contracts/progress'; import net from 'node:net'; import { AppError } from '@agent-device/kernel/errors'; import { loadNodeHttpRequester, readNodeHttpResponseBody } from '@agent-device/host-kit/transport'; -import type { DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import { emitDiagnostic } from '@agent-device/host-kit/diagnostics'; import type { DaemonPaths, DaemonTransportPreference } from '../config.ts'; import { diff --git a/src/daemon/client/daemon-client.ts b/src/daemon/client/daemon-client.ts index 233b835c23..196eb0bb8e 100644 --- a/src/daemon/client/daemon-client.ts +++ b/src/daemon/client/daemon-client.ts @@ -2,7 +2,7 @@ import type { RequestProgressSink } from '@agent-device/contracts/progress'; import type { DaemonRequest as SharedDaemonRequest, DaemonResponse as SharedDaemonResponse, -} from '../types.ts'; +} from '../daemon-request.ts'; import type { AgentDeviceDaemonTransportContext } from '@agent-device/contracts/client'; import { AppError } from '@agent-device/kernel/errors'; import { diff --git a/src/daemon/context.ts b/src/daemon/context.ts index a25d659dda..fff02a0c00 100644 --- a/src/daemon/context.ts +++ b/src/daemon/context.ts @@ -7,7 +7,7 @@ import { } from '@agent-device/contracts/capture'; import { getDiagnosticsMeta } from '@agent-device/host-kit/diagnostics'; import { resolveRunnerLogicalLeaseContext } from './lease-context.ts'; -import type { DaemonRequest } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; export type DaemonCommandContext = DispatchContext & ScreenshotRuntimeFlags; diff --git a/src/daemon/daemon-command-registry.ts b/src/daemon/daemon-command-registry.ts index 2b35ca049f..8d76ccb2c7 100644 --- a/src/daemon/daemon-command-registry.ts +++ b/src/daemon/daemon-command-registry.ts @@ -11,7 +11,7 @@ import { resolveCommandDeviceClaimPolicy, } from '../core/command-descriptor/registry.ts'; import type { RefFrameEffect } from '@agent-device/contracts/replay'; -import type { DaemonRequest } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; export type { DaemonCommandDescriptor, DaemonCommandRoute, SessionCommandKind }; diff --git a/src/daemon/daemon-request-wire.ts b/src/daemon/daemon-request-wire.ts new file mode 100644 index 0000000000..086a5aa9ca --- /dev/null +++ b/src/daemon/daemon-request-wire.ts @@ -0,0 +1,38 @@ +import type { CommandFlags } from '@agent-device/contracts/command'; +import type { + LeaseBackend, + DaemonInstallSource as PublicDaemonInstallSource, + DaemonRequestMeta as PublicDaemonRequestMeta, + DaemonRequest as WireRequest, +} from '@agent-device/kernel/contracts'; +import type { PlatformSelector } from '@agent-device/kernel/device'; + +export type DaemonInstallSource = PublicDaemonInstallSource; + +/** + * Request metadata as a client may send it, with the two fields the daemon narrows past what the + * wire can express and the lease coordinates the router reads. Public throughout: nothing here + * names live session state. + */ +type DaemonRequestMeta = Omit & { + installSource?: DaemonInstallSource; + lockPlatform?: PlatformSelector; + leaseBackend?: LeaseBackend; + leaseProvider?: string; +}; + +/** + * A dispatched request with nothing daemon-private in it: `token` and `session` are required as + * they are by dispatch time, and `flags` is narrowed to the `CommandFlags` vocabulary the wire + * cannot enforce. There is no `internal` key and no property path to `SessionState` or + * `DeviceLease`, which is what lets a consumer read a request — its command, flags and public + * metadata — without depending on the daemon's live session record. `daemon-request.ts` adds the + * daemon-only half on top of this shape; a zone that only needs to classify a command takes + * `contracts/dispatched-command.ts` instead. + */ +export type DaemonWireRequest = Omit & { + token: string; + session: string; + flags?: CommandFlags; + meta?: DaemonRequestMeta; +}; diff --git a/src/daemon/daemon-request.ts b/src/daemon/daemon-request.ts new file mode 100644 index 0000000000..a1cebef2af --- /dev/null +++ b/src/daemon/daemon-request.ts @@ -0,0 +1,127 @@ +import type { GestureExecutionProfile } from '@agent-device/contracts/gesture-plan-types'; +import type { PreresolvedInteractionTarget } from '@agent-device/contracts/interaction'; +import type { DeviceLease } from '@agent-device/contracts/device'; +import type { + ReplayTargetGuardDenotation, + TargetAnnotationV1, +} from '@agent-device/contracts/replay'; +import type { + DaemonArtifact as PublicDaemonArtifact, + DaemonResponse as PublicDaemonResponse, + DaemonResponseData as PublicDaemonResponseData, +} from '@agent-device/kernel/contracts'; +import type { Rect } from '@agent-device/kernel/snapshot'; +import type { DaemonWireRequest } from './daemon-request-wire.ts'; +import type { SessionState } from './session-state.ts'; + +/** + * The daemon's own request and response vocabulary: the wire shape from `daemon-request-wire.ts` + * plus what only the daemon may see. A consumer that must stay free of live session state takes + * `DaemonWireRequest` directly. + */ + +export type DaemonArtifact = PublicDaemonArtifact; +export type DaemonResponseData = PublicDaemonResponseData; + +export type DaemonOpenLifecycle = { + beforeDispatch?: (session: SessionState) => Promise; +}; + +type DaemonRequestInternal = { + publicNetworkOnly?: true; + openLifecycle?: DaemonOpenLifecycle; + /** + * Request-owned capability used when a fresh replay discovers its device + * only inside the first open. The router retains that device's execution + * lock before dispatch and releases it after the outer replay finalizes. + */ + retainDeviceExecutionLock?: (deviceId: string) => Promise; + admittedLease?: DeviceLease; + /** + * Daemon-composed hierarchy capture used as operational evidence only. + * It must not issue or replace client ref authority. + */ + observationOnly?: true; + /** + * Implicit caller scope resolved before a nested dispatch replaces the + * public session name with its effective scoped key. + */ + resolvedSessionScope?: SessionState['sessionScope']; + /** Terminate the targeted app without ending the owning daemon session. */ + closeAppOnly?: boolean; + /** Provider-owned viewport already resolved while normalizing a nested gesture command. */ + gestureViewport?: Rect; + /** Maestro-compat execution profile for timed coordinate swipes projected to `gesture pan`. */ + gestureExecutionProfile?: GestureExecutionProfile; + /** + * ADR 0012 step 4 post-resolution guard: the verified target member's + * normalized local identity AND structural denotation (document order + + * sibling ordinal), set ONLY by the replay step loop when dispatching an + * annotated action whose pre-action verification passed. Interaction + * handlers thread it into command options as `expectedResolvedTarget`; + * dispatch's own resolution refuses (pre-action) when its winner differs in + * local identity OR structural position — the latter distinguishes a + * different same-identity duplicate. + */ + replayTargetGuard?: ReplayTargetGuardDenotation; + /** Dual-endpoint counterpart of replayTargetGuard for target-authored drag. */ + replayTargetGuards?: { + source: ReplayTargetGuardDenotation; + destination: ReplayTargetGuardDenotation; + }; + /** + * ADR 0012 / #1349 deferred (post-resolution) identity verification: the + * recorded `target-v1` landmark of an annotated selector `wait`, set ONLY + * by the replay step loop. The wait dispatch threads it into the polling + * loop as `recordedLandmark`; success then requires a selector match + * carrying this identity, and a timeout with rejected candidates surfaces + * the `WAIT_LANDMARK_MISMATCH_REASON` refusal the step loop converts into + * an identity-mismatch divergence. Never used by the generic pre-dispatch + * verification path — a wait's landmark may legitimately be absent when + * the step starts. + */ + replayLandmarkGuard?: TargetAnnotationV1; + /** + * ADR 0014 / #1654: the complete ref/node/tree target a mutating `find` + * resolved against its fresh capture. Its presence both marks the ref as + * find-owned (so admission/staleness policy is skipped) and supplies the node + * adopted by the interaction leaf. One payload keeps those decisions from + * becoming independently representable. The leaf still crosses the + * side-effect seam and expires the frame. + */ + findResolvedTarget?: PreresolvedInteractionTarget; + /** + * #1271 stage 2 (ADR 0012 decision 6 amendment): PROVENANCE — set by the + * replay runtime (`invokeResolvedReplayAction`, + * `session-replay-action-runtime.ts`) on every action it dispatches from a + * replay plan, annotated or not. It marks the action as AUTHORED (it came + * from the `.ad` under repair) rather than typed out-of-band by the agent + * mid-repair. + * + * The repair-segment exclusion keys off its ABSENCE: an authored + * `get`/`is`/`find`/`snapshot` step must survive into its own healed script + * (silently dropping it would make the heal quietly stop asserting what the + * original flow asserted), while an interactive diagnostic read used only to + * LOCATE the repair target must not. Command class alone cannot tell those + * apart — they are the same command — so provenance is the discriminator and + * `--record` is only for deliberately inserting an interactive read. + * + * Trustworthy because `internal` is daemon-only: `toDaemonRequest` + * (`server/http-server.ts`) never copies it off the wire, so no client can + * spoof authored provenance. Same channel as `replayTargetGuard` above. + */ + replayPlanStep?: boolean; +}; + +/** + * The server-side request: `DaemonWireRequest` plus what only the daemon may see. `internal` + * carries `SessionState` callbacks and the admitted lease — which is why this type stays in the + * daemon and why the wire half is declared separately. Zones below it that only need to classify + * a command take `contracts/dispatched-command.ts` instead. + */ +export type DaemonRequest = DaemonWireRequest & { + internal?: DaemonRequestInternal; +}; + +export type DaemonResponse = PublicDaemonResponse; +export type DaemonInvokeFn = (req: DaemonRequest) => Promise; diff --git a/src/daemon/deferred-interaction-outcome.ts b/src/daemon/deferred-interaction-outcome.ts index a7549cb1ab..9e95224e92 100644 --- a/src/daemon/deferred-interaction-outcome.ts +++ b/src/daemon/deferred-interaction-outcome.ts @@ -30,7 +30,7 @@ import { type InteractionRetryTap, } from './interaction-outcome-policy.ts'; import { runPostGestureStabilityLoop } from './post-gesture-stability.ts'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; /** * The deferred interaction outcome: the daemon's answer to "did that mutation diff --git a/src/daemon/device-claim-conflict.ts b/src/daemon/device-claim-conflict.ts index 83ec58ed36..0a1187161b 100644 --- a/src/daemon/device-claim-conflict.ts +++ b/src/daemon/device-claim-conflict.ts @@ -15,7 +15,7 @@ import { type DeviceClaimClassification, type InspectedDeviceClaim, } from './device-claim-inspection.ts'; -import type { DaemonResponse } from './types.ts'; +import type { DaemonResponse } from './daemon-request.ts'; import { errorResponse } from './response.ts'; export type DeviceClaimConflictReason = diff --git a/src/daemon/direct-ios-selector.ts b/src/daemon/direct-ios-selector.ts index 88e79d3da0..66eb092f91 100644 --- a/src/daemon/direct-ios-selector.ts +++ b/src/daemon/direct-ios-selector.ts @@ -2,7 +2,7 @@ import { isIosFamily } from '@agent-device/kernel/device'; import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { isActiveProviderDevice } from '../provider-device-runtime.ts'; import { isPostGestureStabilizationPending } from './deferred-interaction-outcome.ts'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; import { readSimpleSelectorTarget } from '@agent-device/selectors'; import { asAppError } from '@agent-device/kernel/errors'; import type { ElementSelectorTapOptions } from '@agent-device/contracts/interactor-types'; diff --git a/src/daemon/downloadable-artifact-http.ts b/src/daemon/downloadable-artifact-http.ts index aedf0755cc..fa71ff2b44 100644 --- a/src/daemon/downloadable-artifact-http.ts +++ b/src/daemon/downloadable-artifact-http.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import http from 'node:http'; import { normalizeError } from '@agent-device/kernel/errors'; -import type { DaemonRequest } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; import { cleanupDownloadableArtifact, listDownloadableArtifacts, diff --git a/src/daemon/durable-capture-resource.ts b/src/daemon/durable-capture-resource.ts index 55197928c6..c231c4e335 100644 --- a/src/daemon/durable-capture-resource.ts +++ b/src/daemon/durable-capture-resource.ts @@ -19,7 +19,7 @@ import type { DurableCaptureAdmissionLedger } from './durable-capture-admission- import { createNextDurableCaptureFence } from './durable-capture-start-preflight.ts'; import { safeSessionName } from './session-paths.ts'; import type { SessionStore } from './session-store.ts'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; import type { DurableSessionResourceKind } from './durable-session-resource-kinds.ts'; type AdoptStartedSessionCaptureParams = Omit< diff --git a/src/daemon/generic-runtime-execution.ts b/src/daemon/generic-runtime-execution.ts index dcfdeea635..e661015ace 100644 --- a/src/daemon/generic-runtime-execution.ts +++ b/src/daemon/generic-runtime-execution.ts @@ -5,7 +5,8 @@ import { resolveScreenshotGenericExecution } from './screenshot-runtime.ts'; import { resolveBoundScrollRuntime } from './scroll-runtime.ts'; import type { ScreenshotRuntimeBindings } from './screenshot-runtime-binding.ts'; import type { DaemonCommandContext } from './context.ts'; -import type { DaemonRequest, SessionState } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; +import type { SessionState } from './session-state.ts'; import { resolveBoundViewportRuntime } from './viewport-runtime.ts'; import { resolveBoundBackRuntime } from './back-runtime.ts'; import { resolveBoundHomeRuntime } from './home-runtime.ts'; diff --git a/src/daemon/generic-settle.ts b/src/daemon/generic-settle.ts index a880308a84..8363efd487 100644 --- a/src/daemon/generic-settle.ts +++ b/src/daemon/generic-settle.ts @@ -11,7 +11,8 @@ import { import type { BoundContextFromFlags } from './context.ts'; import { issueSettleRefs } from './session-snapshot.ts'; import type { SessionStore } from './session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from './types.ts'; +import type { DaemonRequest, DaemonResponse } from './daemon-request.ts'; +import type { SessionState } from './session-state.ts'; /** * `--settle` on the generic daemon route (#1638): `scroll` and `back` change diff --git a/src/daemon/handlers/__tests__/install-source.test.ts b/src/daemon/handlers/__tests__/install-source.test.ts index d9d3548842..173a0a9769 100644 --- a/src/daemon/handlers/__tests__/install-source.test.ts +++ b/src/daemon/handlers/__tests__/install-source.test.ts @@ -29,7 +29,8 @@ import type { InspectDeviceRuntimeFacts, } from '../../request-runtime-binding.ts'; import { SessionStore } from '../../session-store.ts'; -import type { DaemonRequest, SessionState } from '../../types.ts'; +import type { DaemonRequest } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { handleInstallFromSourceDeploymentCommand } from '../session-app-source-deployment.ts'; type SourceRuntimeOptions = Readonly<{ diff --git a/src/daemon/handlers/__tests__/lease-artifacts.test.ts b/src/daemon/handlers/__tests__/lease-artifacts.test.ts index 9306343ada..8067a4fdae 100644 --- a/src/daemon/handlers/__tests__/lease-artifacts.test.ts +++ b/src/daemon/handlers/__tests__/lease-artifacts.test.ts @@ -4,7 +4,7 @@ import type { CloudArtifactsQuery } from '@agent-device/contracts/observability' import type { DeviceLease } from '@agent-device/contracts/device'; import { AppError } from '@agent-device/kernel/errors'; import { makeSessionStore } from '../../../__tests__/test-utils/store-factory.ts'; -import type { DaemonRequest, DaemonResponse } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; import { handleLeaseCommands } from '../lease.ts'; import { LeaseRegistry } from '../../lease-registry.ts'; diff --git a/src/daemon/handlers/__tests__/react-native.test.ts b/src/daemon/handlers/__tests__/react-native.test.ts index 077ad999a1..68dbd0853f 100644 --- a/src/daemon/handlers/__tests__/react-native.test.ts +++ b/src/daemon/handlers/__tests__/react-native.test.ts @@ -3,7 +3,7 @@ import path from 'node:path'; import { handleReactNativeCommands } from '../react-native.ts'; import { captureSnapshot } from '../../snapshot-capture.ts'; import { SessionStore } from '../../session-store.ts'; -import type { SessionState } from '../../types.ts'; +import type { SessionState } from '../../session-state.ts'; import { mkdtempForTestSync } from '../../../__tests__/test-utils/tmp-dir.ts'; import { getRuntimeBindings, diff --git a/src/daemon/handlers/__tests__/record-runtime.fixtures.ts b/src/daemon/handlers/__tests__/record-runtime.fixtures.ts index 73e42af6f1..fc29d001c6 100644 --- a/src/daemon/handlers/__tests__/record-runtime.fixtures.ts +++ b/src/daemon/handlers/__tests__/record-runtime.fixtures.ts @@ -16,7 +16,7 @@ import { makeSessionStore } from '../../../__tests__/test-utils/store-factory.ts import { createScreenRecordingAdmissionLedger } from '../../screen-recording-admission-ledger.ts'; import { screenRecordingResourceStore } from '../../screen-recording-resource-store.ts'; import type { BindDeviceRuntime, BindExactDeviceRuntime } from '../../request-runtime-binding.ts'; -import type { SessionState } from '../../types.ts'; +import type { SessionState } from '../../session-state.ts'; import { handleRecordCommand } from '../record-runtime.ts'; type RuntimeOptions = { diff --git a/src/daemon/handlers/__tests__/session-appstate-input.test.ts b/src/daemon/handlers/__tests__/session-appstate-input.test.ts index 970e9a1f42..9f9becd5ec 100644 --- a/src/daemon/handlers/__tests__/session-appstate-input.test.ts +++ b/src/daemon/handlers/__tests__/session-appstate-input.test.ts @@ -8,7 +8,7 @@ import { makeSession, noopInvoke, } from './session-test-harness.ts'; -import type { SessionState } from '../../types.ts'; +import type { SessionState } from '../../session-state.ts'; import { handleSessionCommands } from './session-command-harness.ts'; test('appstate on iOS requires active session on selected device', async () => { diff --git a/src/daemon/handlers/__tests__/session-boot-shutdown-device-claims.test.ts b/src/daemon/handlers/__tests__/session-boot-shutdown-device-claims.test.ts index 219aa0ab6b..eefdd47d34 100644 --- a/src/daemon/handlers/__tests__/session-boot-shutdown-device-claims.test.ts +++ b/src/daemon/handlers/__tests__/session-boot-shutdown-device-claims.test.ts @@ -19,7 +19,7 @@ import { acquireDeviceClaim } from '../../device-claims.ts'; import { inspectDeviceClaims } from '../../device-claim-inspection.ts'; import { createRequestExecutionScope } from '../../request-execution-scope.ts'; import { handleSessionStateCommands } from '../session-state.ts'; -import type { DaemonRequest, DaemonResponse } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; // #1799: `boot`/`shutdown` route through a daemon that need not own the target // device. Two daemons on one host each keep their own state directory, so the diff --git a/src/daemon/handlers/__tests__/session-boot-shutdown.test.ts b/src/daemon/handlers/__tests__/session-boot-shutdown.test.ts index 21c67ba9f6..331247d2f0 100644 --- a/src/daemon/handlers/__tests__/session-boot-shutdown.test.ts +++ b/src/daemon/handlers/__tests__/session-boot-shutdown.test.ts @@ -9,7 +9,7 @@ import { makeSession, noopInvoke, } from './session-test-harness.ts'; -import type { SessionState } from '../../types.ts'; +import type { SessionState } from '../../session-state.ts'; import { handleSessionCommands, mockBindDeviceRuntime, diff --git a/src/daemon/handlers/__tests__/session-command-replay.test.ts b/src/daemon/handlers/__tests__/session-command-replay.test.ts index 5c8c54cf06..0565535069 100644 --- a/src/daemon/handlers/__tests__/session-command-replay.test.ts +++ b/src/daemon/handlers/__tests__/session-command-replay.test.ts @@ -4,7 +4,7 @@ import * as os from 'node:os'; import * as path from 'node:path'; import { makeSessionStore } from './session-test-harness.ts'; import { handleSessionCommands } from './session-command-harness.ts'; -import type { DaemonRequest } from '../../types.ts'; +import type { DaemonRequest } from '../../daemon-request.ts'; import { mkdtempForTestSync } from '../../../__tests__/test-utils/tmp-dir.ts'; import { replayScriptSourceBundleFor } from '../../../__tests__/test-utils/replay-script-source.ts'; diff --git a/src/daemon/handlers/__tests__/session-doctor-device.test.ts b/src/daemon/handlers/__tests__/session-doctor-device.test.ts index eaf04cb61d..53bd87a454 100644 --- a/src/daemon/handlers/__tests__/session-doctor-device.test.ts +++ b/src/daemon/handlers/__tests__/session-doctor-device.test.ts @@ -4,7 +4,7 @@ import { withTestDeviceInventoryProvider as withDeviceInventoryProvider } from ' import { AppError } from '@agent-device/kernel/errors'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { attachAdbFailureHint } from '@agent-device/platform-android/mechanics'; -import type { DaemonRequest } from '../../types.ts'; +import type { DaemonRequest } from '../../daemon-request.ts'; import { appendDeviceInventoryCheck } from '../session-doctor-device.ts'; import type { DoctorCheck } from '@agent-device/contracts/observability'; diff --git a/src/daemon/handlers/__tests__/session-doctor-warmup.test.ts b/src/daemon/handlers/__tests__/session-doctor-warmup.test.ts index 89fda2156e..57d14b1557 100644 --- a/src/daemon/handlers/__tests__/session-doctor-warmup.test.ts +++ b/src/daemon/handlers/__tests__/session-doctor-warmup.test.ts @@ -4,7 +4,7 @@ import { isActiveProviderDevice } from '../../../provider-device-runtime.ts'; import { handleDoctorCommand } from '../session-doctor.ts'; import { createHostDiagnostics } from '../../../platform-runtime-host-diagnostics.ts'; import { makeSessionStore } from '../../../__tests__/test-utils/store-factory.ts'; -import type { DaemonResponse } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; const { mockAppleRunnerWarmupCheck } = vi.hoisted(() => ({ mockAppleRunnerWarmupCheck: vi.fn(), diff --git a/src/daemon/handlers/__tests__/session-install-source-ref-frame.test.ts b/src/daemon/handlers/__tests__/session-install-source-ref-frame.test.ts index 714190288d..81a4a9cd2d 100644 --- a/src/daemon/handlers/__tests__/session-install-source-ref-frame.test.ts +++ b/src/daemon/handlers/__tests__/session-install-source-ref-frame.test.ts @@ -1,6 +1,7 @@ import { expect, test, vi } from 'vitest'; import type { InspectDeviceRuntimeFacts } from '../../request-runtime-binding.ts'; -import type { DaemonRequest, SessionState } from '../../types.ts'; +import type { DaemonRequest } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { makeSessionStore } from '../../../__tests__/test-utils/store-factory.ts'; import { handleSessionCommands, diff --git a/src/daemon/handlers/__tests__/session-push-ref-frame.test.ts b/src/daemon/handlers/__tests__/session-push-ref-frame.test.ts index 7e3d17b816..f8576d1661 100644 --- a/src/daemon/handlers/__tests__/session-push-ref-frame.test.ts +++ b/src/daemon/handlers/__tests__/session-push-ref-frame.test.ts @@ -1,6 +1,7 @@ import { expect, test, vi } from 'vitest'; import type { InspectDeviceRuntimeFacts } from '../../request-runtime-binding.ts'; -import type { DaemonRequest, SessionState } from '../../types.ts'; +import type { DaemonRequest } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { makeSessionStore } from '../../../__tests__/test-utils/store-factory.ts'; import { handleSessionCommands, diff --git a/src/daemon/handlers/__tests__/session-push.test.ts b/src/daemon/handlers/__tests__/session-push.test.ts index 28f2dd9ca0..39ef7e957f 100644 --- a/src/daemon/handlers/__tests__/session-push.test.ts +++ b/src/daemon/handlers/__tests__/session-push.test.ts @@ -6,7 +6,7 @@ import type { BindDeviceRuntime, } from '../../request-runtime-binding.ts'; -import type { DaemonRequest, DaemonResponse } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; import { makeSessionStore } from '../../../__tests__/test-utils/store-factory.ts'; import { mkdtempForTestSync } from '../../../__tests__/test-utils/tmp-dir.ts'; import { diff --git a/src/daemon/handlers/__tests__/session-reinstall.test.ts b/src/daemon/handlers/__tests__/session-reinstall.test.ts index e31767e50a..efaeebb5e1 100644 --- a/src/daemon/handlers/__tests__/session-reinstall.test.ts +++ b/src/daemon/handlers/__tests__/session-reinstall.test.ts @@ -8,7 +8,8 @@ import type { InspectDeviceRuntimeFacts, } from '../../request-runtime-binding.ts'; import { SessionStore } from '../../session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; vi.mock('../../../core/dispatch-resolve.ts', async (importOriginal) => { const actual = await importOriginal(); diff --git a/src/daemon/handlers/__tests__/session-relaunch-close.test.ts b/src/daemon/handlers/__tests__/session-relaunch-close.test.ts index 2b8be533ab..3c446dbef4 100644 --- a/src/daemon/handlers/__tests__/session-relaunch-close.test.ts +++ b/src/daemon/handlers/__tests__/session-relaunch-close.test.ts @@ -7,7 +7,7 @@ import { createTestDeviceInventoryGateways } from '../../../__tests__/test-utils import { makeSessionStore } from '../../../__tests__/test-utils/store-factory.ts'; import { makeSession } from '../../../__tests__/test-utils/session-factories.ts'; import { getResolveTargetDeviceMock } from '../../__tests__/request-router-dispatch-mocks.ts'; -import type { DaemonRequest } from '../../types.ts'; +import type { DaemonRequest } from '../../daemon-request.ts'; vi.mock('node:timers/promises', async (importOriginal) => { const actual = await importOriginal(); diff --git a/src/daemon/handlers/__tests__/session-runtime-command.test.ts b/src/daemon/handlers/__tests__/session-runtime-command.test.ts index 1c560d5614..a1e170d13c 100644 --- a/src/daemon/handlers/__tests__/session-runtime-command.test.ts +++ b/src/daemon/handlers/__tests__/session-runtime-command.test.ts @@ -1,7 +1,7 @@ import { expect, test } from 'vitest'; import os from 'node:os'; import path from 'node:path'; -import type { DaemonRequest } from '../../types.ts'; +import type { DaemonRequest } from '../../daemon-request.ts'; import { makeSession, makeSessionStore, diff --git a/src/daemon/handlers/__tests__/session-runtime-port-reverse.test.ts b/src/daemon/handlers/__tests__/session-runtime-port-reverse.test.ts index 267c37052c..5a4de4d74d 100644 --- a/src/daemon/handlers/__tests__/session-runtime-port-reverse.test.ts +++ b/src/daemon/handlers/__tests__/session-runtime-port-reverse.test.ts @@ -1,5 +1,5 @@ import { expect, test, vi } from 'vitest'; -import type { DaemonRequest } from '../../types.ts'; +import type { DaemonRequest } from '../../daemon-request.ts'; import { handlePortReverseCommand } from '../session-runtime-port-reverse.ts'; const baseRequest = { diff --git a/src/daemon/handlers/__tests__/session-script-publication.test.ts b/src/daemon/handlers/__tests__/session-script-publication.test.ts index ac03004402..c74bd2496f 100644 --- a/src/daemon/handlers/__tests__/session-script-publication.test.ts +++ b/src/daemon/handlers/__tests__/session-script-publication.test.ts @@ -11,7 +11,8 @@ import { } from '../../../__tests__/test-utils/session-factories.ts'; import type { TargetAnnotationV1 } from '@agent-device/contracts/replay'; import { SessionStore } from '../../session-store.ts'; -import type { DaemonRequest, SessionState } from '../../types.ts'; +import type { DaemonRequest } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { handleSessionScriptPublication } from '../session-script-publication.ts'; import { NO_SCRIPT_PUBLICATION, diff --git a/src/daemon/handlers/__tests__/session-selector-dispatch.test.ts b/src/daemon/handlers/__tests__/session-selector-dispatch.test.ts index df1e71091f..88d44f87c1 100644 --- a/src/daemon/handlers/__tests__/session-selector-dispatch.test.ts +++ b/src/daemon/handlers/__tests__/session-selector-dispatch.test.ts @@ -25,7 +25,7 @@ import { makeSession, noopInvoke, } from './session-test-harness.ts'; -import type { SessionState } from '../../types.ts'; +import type { SessionState } from '../../session-state.ts'; import { handleSessionCommands } from './session-command-harness.ts'; import { refFrameState } from '../../ref-frame.ts'; diff --git a/src/daemon/handlers/__tests__/session-test-harness.ts b/src/daemon/handlers/__tests__/session-test-harness.ts index a49cd6f8ad..bbff237357 100644 --- a/src/daemon/handlers/__tests__/session-test-harness.ts +++ b/src/daemon/handlers/__tests__/session-test-harness.ts @@ -91,7 +91,8 @@ vi.mock('../../materialized-path-registry.ts', async (importOriginal) => { import * as path from 'node:path'; import { cleanupRetainedMaterializedPathsForSession } from '../../materialized-path-registry.ts'; import { SessionStore } from '../../session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { resolveTargetDevice } from '../../../core/dispatch-resolve.ts'; import { ensureDeviceReady } from '../../device-ready.ts'; import { diff --git a/src/daemon/handlers/__tests__/session-trigger.test.ts b/src/daemon/handlers/__tests__/session-trigger.test.ts index 724ca4d752..8cbffef1b4 100644 --- a/src/daemon/handlers/__tests__/session-trigger.test.ts +++ b/src/daemon/handlers/__tests__/session-trigger.test.ts @@ -1,7 +1,7 @@ import { test, expect } from 'vitest'; import { handleSessionCommands } from './session-command-harness.ts'; -import type { DaemonRequest, DaemonResponse } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; import { makeSessionStore } from '../../../__tests__/test-utils/store-factory.ts'; const invoke = async (_req: DaemonRequest): Promise => { diff --git a/src/daemon/handlers/__tests__/snapshot-alert.test.ts b/src/daemon/handlers/__tests__/snapshot-alert.test.ts index 8fe104cdef..f759a84beb 100644 --- a/src/daemon/handlers/__tests__/snapshot-alert.test.ts +++ b/src/daemon/handlers/__tests__/snapshot-alert.test.ts @@ -1,6 +1,6 @@ import { test, expect, vi, beforeEach } from 'vitest'; import { AppError } from '@agent-device/kernel/errors'; -import type { SessionState } from '../../types.ts'; +import type { SessionState } from '../../session-state.ts'; import { SessionStore } from '../../session-store.ts'; import { handleSnapshotCommands as handleProductionSnapshotCommands } from '../snapshot.ts'; import { snapshotRuntimeFixture } from '../../__tests__/snapshot-runtime-fixture.ts'; diff --git a/src/daemon/handlers/__tests__/snapshot-handler.fixtures.ts b/src/daemon/handlers/__tests__/snapshot-handler.fixtures.ts index 37ab9141e8..d2625485e3 100644 --- a/src/daemon/handlers/__tests__/snapshot-handler.fixtures.ts +++ b/src/daemon/handlers/__tests__/snapshot-handler.fixtures.ts @@ -10,7 +10,8 @@ import type { } from '../../request-runtime-binding.ts'; import { snapshotRuntimeFixture } from '../../__tests__/snapshot-runtime-fixture.ts'; import { SessionStore } from '../../session-store.ts'; -import type { DaemonRequest, SessionState } from '../../types.ts'; +import type { DaemonRequest } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; export function makeSessionStore(): SessionStore { const root = mkdtempForTestSync('agent-device-snapshot-handler-'); diff --git a/src/daemon/handlers/__tests__/snapshot-handler.test.ts b/src/daemon/handlers/__tests__/snapshot-handler.test.ts index 522da36e59..abe4b572fd 100644 --- a/src/daemon/handlers/__tests__/snapshot-handler.test.ts +++ b/src/daemon/handlers/__tests__/snapshot-handler.test.ts @@ -10,7 +10,8 @@ import { handleSnapshotCommands as handleProductionSnapshotCommands } from '../s import { captureSnapshot } from '../../snapshot-capture.ts'; import { SessionStore } from '../../session-store.ts'; import { setActiveProviderDeviceRuntimes } from '../../../provider-device-runtime.ts'; -import type { DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { AppError } from '@agent-device/kernel/errors'; import { platformResourceCleanup } from '../../../platform-runtime-resource-cleanup.ts'; import { buildInteractionSurfaceSignature } from '../../interaction-outcome-policy.ts'; @@ -168,7 +169,6 @@ function assertAndroidTimeoutEvidencePayload(evidence: unknown) { expect(record.path).toEqual(expect.stringContaining('snapshot-timeout-overlay-refs.png')); expect(fs.existsSync(record.path as string)).toBe(true); expect(record.overlayRefsAnnotated).toBe(true); - expect(record.overlayRefs).toHaveLength(1); expect(record.overlayRefs).toEqual([expect.objectContaining({ ref: 'e1', label: 'Continue' })]); } diff --git a/src/daemon/handlers/__tests__/trace-runtime.test.ts b/src/daemon/handlers/__tests__/trace-runtime.test.ts index 815cc03c7d..d06b58c472 100644 --- a/src/daemon/handlers/__tests__/trace-runtime.test.ts +++ b/src/daemon/handlers/__tests__/trace-runtime.test.ts @@ -3,7 +3,8 @@ import path from 'node:path'; import { expect, test } from 'vitest'; import { mkdtempForTestSync } from '../../../__tests__/test-utils/tmp-dir.ts'; import { SessionStore } from '../../session-store.ts'; -import type { DaemonRequest, SessionState } from '../../types.ts'; +import type { DaemonRequest } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { handleTraceCommand } from '../trace-runtime.ts'; function fixture() { diff --git a/src/daemon/handlers/__tests__/wait-landmark-recording.test.ts b/src/daemon/handlers/__tests__/wait-landmark-recording.test.ts index 7c772b895d..11a26d2ca8 100644 --- a/src/daemon/handlers/__tests__/wait-landmark-recording.test.ts +++ b/src/daemon/handlers/__tests__/wait-landmark-recording.test.ts @@ -14,7 +14,7 @@ import { test, expect, vi, beforeEach } from 'vitest'; import { legacyDispatchCapture } from '../../__tests__/legacy-snapshot-capture-fixture.ts'; import { dispatchWaitViaRuntime } from '../../wait-runtime.ts'; -import type { DaemonRequest } from '../../types.ts'; +import type { DaemonRequest } from '../../daemon-request.ts'; import { WAIT_LANDMARK_MISMATCH_REASON } from '@agent-device/contracts/replay'; import type { TargetAnnotationV1 } from '@agent-device/contracts/replay'; import { snapshotRuntimeFixture } from '../../__tests__/snapshot-runtime-fixture.ts'; diff --git a/src/daemon/handlers/human-control.ts b/src/daemon/handlers/human-control.ts index 6ab31ba5f0..bdb73d4d2b 100644 --- a/src/daemon/handlers/human-control.ts +++ b/src/daemon/handlers/human-control.ts @@ -2,7 +2,7 @@ import { AppError } from '@agent-device/kernel/errors'; import { getRequestSignal } from '@agent-device/host-kit/request'; import { parseHumanControlHoldInput } from '../human-control-contract.ts'; import type { LeaseRegistry } from '../lease-registry.ts'; -import type { DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; export async function handleHumanControlCommand(params: { req: DaemonRequest; diff --git a/src/daemon/handlers/lease.ts b/src/daemon/handlers/lease.ts index d1ebaca284..8c5d1d050c 100644 --- a/src/daemon/handlers/lease.ts +++ b/src/daemon/handlers/lease.ts @@ -8,7 +8,7 @@ import type { AgentArtifactsResult, CloudArtifactProvider, } from '@agent-device/contracts/observability'; -import type { DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import type { LeaseRegistry } from '../lease-registry.ts'; import type { ReleaseLeaseRequest } from '../lease-registry-scope.ts'; import type { SessionStore } from '../session-store.ts'; diff --git a/src/daemon/handlers/react-native.ts b/src/daemon/handlers/react-native.ts index 0f720336e5..714d3d779d 100644 --- a/src/daemon/handlers/react-native.ts +++ b/src/daemon/handlers/react-native.ts @@ -14,7 +14,8 @@ import { successText } from '@agent-device/kernel/success-text'; import type { SnapshotQualityVerdict, SnapshotState } from '@agent-device/kernel/snapshot'; import { isSparseSnapshotQualityVerdict } from '@agent-device/capture-kit/snapshot-quality-verdict'; -import type { DaemonResponse, SessionState } from '../types.ts'; +import type { DaemonResponse } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; import { errorResponse, noActiveSessionError } from '../response.ts'; import { captureSnapshotForSession, diff --git a/src/daemon/handlers/record-runtime-request.ts b/src/daemon/handlers/record-runtime-request.ts index e940d47f26..af7c6f687a 100644 --- a/src/daemon/handlers/record-runtime-request.ts +++ b/src/daemon/handlers/record-runtime-request.ts @@ -6,7 +6,7 @@ import { } from '@agent-device/contracts/recording'; import { retiredScreenshotMaxSizeFlagError } from '@agent-device/contracts/capture'; import { AppError } from '@agent-device/kernel/errors'; -import type { DaemonRequest } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; import { hasExplicitSessionFlag } from '../session-routing.ts'; const IOS_DEVICE_RECORD_MIN_FPS = 1; diff --git a/src/daemon/handlers/record-runtime-response.ts b/src/daemon/handlers/record-runtime-response.ts index fae91d0c0d..a14e46300b 100644 --- a/src/daemon/handlers/record-runtime-response.ts +++ b/src/daemon/handlers/record-runtime-response.ts @@ -5,7 +5,7 @@ import type { ScreenRecordingLiveSnapshot, } from '@agent-device/contracts/screen-recording-runtime'; import type { RuntimeOperationUnavailability } from '@agent-device/contracts/platform-runtime'; -import type { DaemonArtifact, DaemonResponse } from '../types.ts'; +import type { DaemonArtifact, DaemonResponse } from '../daemon-request.ts'; import { deriveRecordingTelemetryPath } from '../../recording/telemetry.ts'; export function buildRecordingStartResponse( diff --git a/src/daemon/handlers/record-runtime.ts b/src/daemon/handlers/record-runtime.ts index 79b46c4abc..e909b00a98 100644 --- a/src/daemon/handlers/record-runtime.ts +++ b/src/daemon/handlers/record-runtime.ts @@ -23,7 +23,8 @@ import { createScreenRecordingRecoveryControl } from '../screen-recording-resour import { resolveSessionScope } from '../session-routing.ts'; import type { SessionStore } from '../session-store.ts'; import type { BindDeviceRuntime, BindExactDeviceRuntime } from '../request-runtime-binding.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; import { recordSessionAction } from '../session-action-recorder.ts'; import { missingAppSessionResponse, diff --git a/src/daemon/handlers/record-trace.ts b/src/daemon/handlers/record-trace.ts index ac15670170..5552981219 100644 --- a/src/daemon/handlers/record-trace.ts +++ b/src/daemon/handlers/record-trace.ts @@ -1,4 +1,4 @@ -import type { DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import { SessionStore } from '../session-store.ts'; import { handleRecordCommand } from './record-runtime.ts'; import type { BindDeviceRuntime, BindExactDeviceRuntime } from '../request-runtime-binding.ts'; diff --git a/src/daemon/handlers/session-app-deployment-route.ts b/src/daemon/handlers/session-app-deployment-route.ts index 73edf55c09..d994b4b07e 100644 --- a/src/daemon/handlers/session-app-deployment-route.ts +++ b/src/daemon/handlers/session-app-deployment-route.ts @@ -1,6 +1,6 @@ import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from '../request-runtime-binding.ts'; import { SessionStore } from '../session-store.ts'; -import type { DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import { handleAppDeploymentCommand, handlePushNotificationCommand, diff --git a/src/daemon/handlers/session-app-deployment.ts b/src/daemon/handlers/session-app-deployment.ts index ce7552856c..18b3d6d6b9 100644 --- a/src/daemon/handlers/session-app-deployment.ts +++ b/src/daemon/handlers/session-app-deployment.ts @@ -10,7 +10,8 @@ import { cleanupUploadedArtifact, prepareUploadedArtifact } from '../artifact-tr import { expireRefFrame } from '../ref-frame.ts'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from '../request-runtime-binding.ts'; import { SessionStore } from '../session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; import { resolvePayloadInput } from '../../core/payload-input.ts'; import { resolveDeployResultTarget } from '../result-serialization.ts'; import { withSuccessText } from '@agent-device/kernel/success-text'; diff --git a/src/daemon/handlers/session-app-source-deployment.ts b/src/daemon/handlers/session-app-source-deployment.ts index adca6983ad..bddc7600e9 100644 --- a/src/daemon/handlers/session-app-source-deployment.ts +++ b/src/daemon/handlers/session-app-source-deployment.ts @@ -15,7 +15,8 @@ import { expireRefFrame } from '../ref-frame.ts'; import { resolveInstallSource } from '../install-source-resolution.ts'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from '../request-runtime-binding.ts'; import { SessionStore } from '../session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; import { resolveInstallFromSourceResultTarget } from '../result-serialization.ts'; import { withSuccessText } from '@agent-device/kernel/success-text'; import { recordSessionAction } from '../session-action-recorder.ts'; diff --git a/src/daemon/handlers/session-batch.ts b/src/daemon/handlers/session-batch.ts index 1ec5d8595a..4b326796a8 100644 --- a/src/daemon/handlers/session-batch.ts +++ b/src/daemon/handlers/session-batch.ts @@ -1,5 +1,5 @@ import { type BatchInvoke, runBatch } from '../../core/batch.ts'; -import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../daemon-request.ts'; export async function runBatchCommands( req: DaemonRequest, diff --git a/src/daemon/handlers/session-clipboard.ts b/src/daemon/handlers/session-clipboard.ts index c58aa65f61..db26dc9075 100644 --- a/src/daemon/handlers/session-clipboard.ts +++ b/src/daemon/handlers/session-clipboard.ts @@ -11,7 +11,7 @@ import { publicPlatformString, type DeviceInfo } from '@agent-device/kernel/devi import { AppError } from '@agent-device/kernel/errors'; import { PUBLIC_COMMANDS } from '../../command-catalog.ts'; import { contextFromFlags, type DaemonCommandContext } from '../context.ts'; -import type { DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import type { SessionStore } from '../session-store.ts'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from '../request-runtime-binding.ts'; import { admitRuntimeUse, type RuntimeAdmissionBindings } from '../runtime-admission.ts'; diff --git a/src/daemon/handlers/session-command-input.ts b/src/daemon/handlers/session-command-input.ts index bfe10e079c..01dba87897 100644 --- a/src/daemon/handlers/session-command-input.ts +++ b/src/daemon/handlers/session-command-input.ts @@ -2,7 +2,7 @@ import type { LeaseLifecycleProvider, ProviderAppCatalog } from '@agent-device/c import type { HostDiagnostics } from '@agent-device/contracts/host-diagnostics'; import type { PlatformResourceCleanup } from '@agent-device/contracts/platform-resource-cleanup'; import type { PlatformRequestScope } from '@agent-device/contracts/platform-runtime-host'; -import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import type { AppLogAdmissionLedger } from '../app-log-admission-ledger.ts'; import type { AudioProbeAdmissionLedger } from '../audio-probe-admission-ledger.ts'; import type { DeviceClaimReconciler } from '../device-claims.ts'; diff --git a/src/daemon/handlers/session-doctor-app.ts b/src/daemon/handlers/session-doctor-app.ts index c03283c71e..9dc7299fc7 100644 --- a/src/daemon/handlers/session-doctor-app.ts +++ b/src/daemon/handlers/session-doctor-app.ts @@ -1,6 +1,6 @@ import { publicPlatformString, type DeviceInfo } from '@agent-device/kernel/device'; import { AppError, normalizeError } from '@agent-device/kernel/errors'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; import { appendDoctorCheck } from './session-doctor-output.ts'; import type { DoctorCheck } from '@agent-device/contracts/observability'; import type { InstalledAppInfo } from '@agent-device/contracts/app-inventory-runtime'; diff --git a/src/daemon/handlers/session-doctor-device.ts b/src/daemon/handlers/session-doctor-device.ts index 9961051b97..2ab09ed8d8 100644 --- a/src/daemon/handlers/session-doctor-device.ts +++ b/src/daemon/handlers/session-doctor-device.ts @@ -15,7 +15,8 @@ import { type PublicPlatform, } from '@agent-device/kernel/device'; import { normalizeError } from '@agent-device/kernel/errors'; -import type { DaemonRequest, SessionState } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; import type { DoctorCheck } from '@agent-device/contracts/observability'; import { appendDoctorCheck } from './session-doctor-output.ts'; diff --git a/src/daemon/handlers/session-doctor-options.ts b/src/daemon/handlers/session-doctor-options.ts index 6d9747673c..5fe1060028 100644 --- a/src/daemon/handlers/session-doctor-options.ts +++ b/src/daemon/handlers/session-doctor-options.ts @@ -1,7 +1,8 @@ import { detectProjectRuntimeKind } from '../../core/project-runtime.ts'; import { publicPlatformString } from '@agent-device/kernel/device'; import type { SessionStore } from '../session-store.ts'; -import type { DaemonRequest, SessionState } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; import type { DoctorOptions } from './session-doctor-types.ts'; import type { DoctorCheck, DoctorKind } from '@agent-device/contracts/observability'; diff --git a/src/daemon/handlers/session-doctor.ts b/src/daemon/handlers/session-doctor.ts index f14019e5af..3636e0520b 100644 --- a/src/daemon/handlers/session-doctor.ts +++ b/src/daemon/handlers/session-doctor.ts @@ -9,7 +9,8 @@ import { shouldPropagateDeviceInventoryProbeError, } from '../../request/device-inventory-context.ts'; import { readVersion } from '@agent-device/host-kit/version'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; import { SessionStore } from '../session-store.ts'; import { appendAppChecks, type DoctorAppInventory } from './session-doctor-app.ts'; import { diff --git a/src/daemon/handlers/session-prepare.ts b/src/daemon/handlers/session-prepare.ts index ac2688a9fe..2f0529b35c 100644 --- a/src/daemon/handlers/session-prepare.ts +++ b/src/daemon/handlers/session-prepare.ts @@ -4,7 +4,7 @@ import { PUBLIC_COMMANDS } from '../../command-catalog.ts'; import { PREPARE_REQUEST_TIMEOUT_MS } from '../../core/command-descriptor/timeout-policy.ts'; import { publicPlatformString, type DeviceInfo } from '@agent-device/kernel/device'; import { resolveRunnerLogicalLeaseContext } from '../lease-context.ts'; -import type { DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import { SessionStore } from '../session-store.ts'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from '../request-runtime-binding.ts'; import { admitRuntimeUse } from '../runtime-admission.ts'; diff --git a/src/daemon/handlers/session-replay-command.ts b/src/daemon/handlers/session-replay-command.ts index 4c0cdfce9d..2318fe64a3 100644 --- a/src/daemon/handlers/session-replay-command.ts +++ b/src/daemon/handlers/session-replay-command.ts @@ -1,5 +1,6 @@ import { AppError } from '@agent-device/kernel/errors'; -import type { DaemonRequest, SessionState } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; import type { SessionStore } from '../session-store.ts'; import type { LeaseRegistry } from '../lease-registry.ts'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from '../request-runtime-binding.ts'; diff --git a/src/daemon/handlers/session-replay-video-owner.ts b/src/daemon/handlers/session-replay-video-owner.ts index c941f37048..8f8d951eb7 100644 --- a/src/daemon/handlers/session-replay-video-owner.ts +++ b/src/daemon/handlers/session-replay-video-owner.ts @@ -2,7 +2,7 @@ import { handleRecordCommand } from './record-runtime.ts'; import type { BindDeviceRuntime, BindExactDeviceRuntime } from '../request-runtime-binding.ts'; import type { ScreenRecordingAdmissionLedger } from '../screen-recording-admission-ledger.ts'; import type { PlatformRequestScope } from '@agent-device/contracts/platform-runtime-host'; -import type { DaemonRequest } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; import type { SessionStore } from '../session-store.ts'; import type { ReplayTestVideoOwner } from '../replay/index.ts'; diff --git a/src/daemon/handlers/session-runtime-command.ts b/src/daemon/handlers/session-runtime-command.ts index 9675c34d20..4d1025f9be 100644 --- a/src/daemon/handlers/session-runtime-command.ts +++ b/src/daemon/handlers/session-runtime-command.ts @@ -1,4 +1,4 @@ -import type { DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import { publicPlatformString } from '@agent-device/kernel/device'; import { clearRuntimeHintsRuntimeUse } from '@agent-device/contracts/application-lifecycle-runtime-plan'; import { SessionStore } from '../session-store.ts'; diff --git a/src/daemon/handlers/session-runtime-port-reverse.ts b/src/daemon/handlers/session-runtime-port-reverse.ts index cd28c62ccb..eba71b723c 100644 --- a/src/daemon/handlers/session-runtime-port-reverse.ts +++ b/src/daemon/handlers/session-runtime-port-reverse.ts @@ -1,6 +1,6 @@ import type { ProviderPortReverseOptions } from '@agent-device/contracts/device'; import { configureProviderPortReverseRuntimeUse } from '@agent-device/contracts/application-lifecycle-runtime-plan'; -import type { DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import type { SessionStore } from '../session-store.ts'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from '../request-runtime-binding.ts'; import { admitRuntimeUse } from '../runtime-admission.ts'; diff --git a/src/daemon/handlers/session-script-publication.ts b/src/daemon/handlers/session-script-publication.ts index fea4d2549f..0a38a8ee6a 100644 --- a/src/daemon/handlers/session-script-publication.ts +++ b/src/daemon/handlers/session-script-publication.ts @@ -9,7 +9,8 @@ import { } from '../session-script-publication-capability.ts'; import { isRepairArmedSession } from '../session-replay-transaction.ts'; import { SessionStore } from '../session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; export function handleSessionScriptPublication(params: { req: DaemonRequest; diff --git a/src/daemon/handlers/session-selector-dispatch.ts b/src/daemon/handlers/session-selector-dispatch.ts index ae2611bb74..c0ded609f5 100644 --- a/src/daemon/handlers/session-selector-dispatch.ts +++ b/src/daemon/handlers/session-selector-dispatch.ts @@ -1,6 +1,7 @@ import { PUBLIC_COMMANDS } from '../../command-catalog.ts'; import type { DeviceInfo } from '@agent-device/kernel/device'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; import type { SessionStore } from '../session-store.ts'; import { contextFromFlags } from '../context.ts'; import { diff --git a/src/daemon/handlers/session-state.ts b/src/daemon/handlers/session-state.ts index 2102682ed9..dc170a0076 100644 --- a/src/daemon/handlers/session-state.ts +++ b/src/daemon/handlers/session-state.ts @@ -13,7 +13,7 @@ import { publicPlatformString, type DeviceInfo, } from '@agent-device/kernel/device'; -import type { DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import { SessionStore } from '../session-store.ts'; import { resolveAndroidSerialAllowlist } from '@agent-device/kernel/device-isolation'; import { diff --git a/src/daemon/handlers/session.ts b/src/daemon/handlers/session.ts index eb787ed9be..9397eb6f27 100644 --- a/src/daemon/handlers/session.ts +++ b/src/daemon/handlers/session.ts @@ -1,4 +1,4 @@ -import type { DaemonResponse } from '../types.ts'; +import type { DaemonResponse } from '../daemon-request.ts'; import { handleReleaseMaterializedPathsCommand } from './session-app-source-deployment.ts'; import { handleRuntimeCommand } from './session-runtime-command.ts'; import { handleKeyboardCommand, handleAppEventCommand } from './session-selector-dispatch.ts'; diff --git a/src/daemon/handlers/snapshot-alert.ts b/src/daemon/handlers/snapshot-alert.ts index 265f717277..0d71dcf3e0 100644 --- a/src/daemon/handlers/snapshot-alert.ts +++ b/src/daemon/handlers/snapshot-alert.ts @@ -12,7 +12,8 @@ import { } from '@agent-device/contracts/platform-runtime-operations'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { contextFromFlags } from '../context.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; import { SessionStore } from '../session-store.ts'; import { recordIfSession } from '../snapshot-session.ts'; import { parseTimeout } from '../../core/parse-timeout.ts'; diff --git a/src/daemon/handlers/snapshot-runtime-route.test.ts b/src/daemon/handlers/snapshot-runtime-route.test.ts index 4711f36af8..800c4542af 100644 --- a/src/daemon/handlers/snapshot-runtime-route.test.ts +++ b/src/daemon/handlers/snapshot-runtime-route.test.ts @@ -14,7 +14,7 @@ vi.mock('../snapshot-runtime.ts', () => ({ })); import { SessionStore } from '../session-store.ts'; -import type { DaemonRequest } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; import { handleSnapshotCommands } from './snapshot.ts'; beforeEach(() => { diff --git a/src/daemon/handlers/snapshot-settings.ts b/src/daemon/handlers/snapshot-settings.ts index 0be8483407..950788a76a 100644 --- a/src/daemon/handlers/snapshot-settings.ts +++ b/src/daemon/handlers/snapshot-settings.ts @@ -10,7 +10,8 @@ import { settingsRuntimeUse } from '@agent-device/contracts/platform-runtime-ope import type { BoundDeviceRuntime } from '@agent-device/contracts/platform-runtime'; import { contextFromFlags } from '../context.ts'; import { SessionStore } from '../session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; import { recordIfSession } from '../snapshot-session.ts'; import { errorResponse, type DaemonFailureResponse } from '../response.ts'; import { expireRefFrame } from '../ref-frame.ts'; diff --git a/src/daemon/handlers/snapshot.ts b/src/daemon/handlers/snapshot.ts index aef3bb55aa..02d4c507a4 100644 --- a/src/daemon/handlers/snapshot.ts +++ b/src/daemon/handlers/snapshot.ts @@ -1,4 +1,4 @@ -import type { DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import { SessionStore } from '../session-store.ts'; import { errorResponse } from '../response.ts'; import { handleAlertCommand } from './snapshot-alert.ts'; diff --git a/src/daemon/handlers/trace-runtime.ts b/src/daemon/handlers/trace-runtime.ts index da9fea818f..18b8f5ca7e 100644 --- a/src/daemon/handlers/trace-runtime.ts +++ b/src/daemon/handlers/trace-runtime.ts @@ -2,7 +2,8 @@ import fs from 'node:fs'; import path from 'node:path'; import type { TraceCommandResult } from '@agent-device/contracts/recording'; import { SessionStore } from '../session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; import { recordSessionAction } from '../session-action-recorder.ts'; import { errorResponse } from '../response.ts'; diff --git a/src/daemon/install-source-resolution.ts b/src/daemon/install-source-resolution.ts index c47980f727..f92cf4a803 100644 --- a/src/daemon/install-source-resolution.ts +++ b/src/daemon/install-source-resolution.ts @@ -1,7 +1,8 @@ import { AppError } from '@agent-device/kernel/errors'; import type { LocalInstallSource } from '@agent-device/kernel/contracts'; import { cleanupUploadedArtifact, prepareUploadedArtifact } from './artifact-tracking.ts'; -import type { DaemonInstallSource, DaemonRequest } from './types.ts'; +import type { DaemonInstallSource } from './daemon-request-wire.ts'; +import type { DaemonRequest } from './daemon-request.ts'; function assertUnsupportedInstallSource(source: never): never { throw new AppError( diff --git a/src/daemon/interaction-outcome-policy.ts b/src/daemon/interaction-outcome-policy.ts index 693e6211bf..d0a6abee62 100644 --- a/src/daemon/interaction-outcome-policy.ts +++ b/src/daemon/interaction-outcome-policy.ts @@ -5,7 +5,7 @@ import { collectKeyboardChromeRefs } from '../core/snapshot-chrome.ts'; import { emitDiagnostic } from '@agent-device/host-kit/diagnostics'; import { isViewportRootNode } from '@agent-device/contracts/snapshot'; import { contextFromFlags, type DaemonCommandContext } from './context.ts'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; const OUTCOME_RETRY_WINDOW_MS = 30_000; const OUTCOME_RETRY_ATTEMPTS = 2; diff --git a/src/daemon/interaction/internal/__tests__/find-handler-fixture.ts b/src/daemon/interaction/internal/__tests__/find-handler-fixture.ts index b76f7db5b7..8b1bc46f5b 100644 --- a/src/daemon/interaction/internal/__tests__/find-handler-fixture.ts +++ b/src/daemon/interaction/internal/__tests__/find-handler-fixture.ts @@ -1,5 +1,5 @@ import type { SessionStore } from '../../../session-store.ts'; -import type { DaemonRequest, DaemonResponse } from '../../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../../daemon-request.ts'; import { handleFindCommands } from '../find.ts'; import { getRuntimeBindings } from '../../../__tests__/interaction-get-runtime-fixture.ts'; diff --git a/src/daemon/interaction/internal/__tests__/find-single-bind.test.ts b/src/daemon/interaction/internal/__tests__/find-single-bind.test.ts index 262cd7708f..51f4707d27 100644 --- a/src/daemon/interaction/internal/__tests__/find-single-bind.test.ts +++ b/src/daemon/interaction/internal/__tests__/find-single-bind.test.ts @@ -1,5 +1,5 @@ import { test, expect, vi, beforeEach } from 'vitest'; -import type { DaemonResponse } from '../../../types.ts'; +import type { DaemonResponse } from '../../../daemon-request.ts'; import { makeSessionStore } from '../../../../__tests__/test-utils/store-factory.ts'; import { makeIosSession } from '../../../../__tests__/test-utils/session-factories.ts'; import { diff --git a/src/daemon/interaction/internal/__tests__/find.test.ts b/src/daemon/interaction/internal/__tests__/find.test.ts index 5dc2419455..dbe002eab7 100644 --- a/src/daemon/interaction/internal/__tests__/find.test.ts +++ b/src/daemon/interaction/internal/__tests__/find.test.ts @@ -2,7 +2,8 @@ import { test, expect, vi, beforeEach } from 'vitest'; import { handleFindCommands } from '../find.ts'; import { handleInteractionCommands } from '../../index.ts'; import type { CommandFlags } from '@agent-device/contracts/command'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../../daemon-request.ts'; +import type { SessionState } from '../../../session-state.ts'; import { buildSnapshotSignatures } from '../../../../snapshot/snapshot-freshness/index.ts'; import { makeSessionStore } from '../../../../__tests__/test-utils/store-factory.ts'; import { @@ -532,7 +533,6 @@ test('handleFindCommands ambiguous match lists snapshot-line candidates capped a expect(response.error.details?.matches).toBe(6); const candidates = response.error.details?.candidates; expect(Array.isArray(candidates)).toBe(true); - expect(candidates).toHaveLength(5); expect(candidates).toEqual([ '@e2 [button] "Follow"', '@e3 [button] "Follow"', diff --git a/src/daemon/interaction/internal/__tests__/interaction-ambiguity-publication.test.ts b/src/daemon/interaction/internal/__tests__/interaction-ambiguity-publication.test.ts index c10ca3ab2a..0938362438 100644 --- a/src/daemon/interaction/internal/__tests__/interaction-ambiguity-publication.test.ts +++ b/src/daemon/interaction/internal/__tests__/interaction-ambiguity-publication.test.ts @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import { AppError } from '@agent-device/kernel/errors'; -import type { SessionState } from '../../../types.ts'; +import type { SessionState } from '../../../session-state.ts'; import { admitRefMutation, refFrameScope } from '../../../ref-frame.ts'; import { markSessionPartialRefsIssued } from '../../../session-snapshot.ts'; import { publishInteractionAmbiguityCandidates } from '../interaction-ambiguity-publication.ts'; diff --git a/src/daemon/interaction/internal/__tests__/interaction-gesture-drag.test.ts b/src/daemon/interaction/internal/__tests__/interaction-gesture-drag.test.ts index f5fd49bbd8..50eed0ed2b 100644 --- a/src/daemon/interaction/internal/__tests__/interaction-gesture-drag.test.ts +++ b/src/daemon/interaction/internal/__tests__/interaction-gesture-drag.test.ts @@ -11,8 +11,9 @@ import { handleInteractionCommands } from '../../index.ts'; import { gestureRuntimeBindingsFixture } from './gesture-runtime-bindings.fixtures.ts'; const contextFromFlags = () => ({}); -const captureSnapshotForSession = async (session: import('../../../types.ts').SessionState) => - session.snapshot!; +const captureSnapshotForSession = async ( + session: import('../../../session-state.ts').SessionState, +) => session.snapshot!; let gestures = gestureRuntimeBindingsFixture(); beforeEach(() => { diff --git a/src/daemon/interaction/internal/__tests__/interaction-settle.test.ts b/src/daemon/interaction/internal/__tests__/interaction-settle.test.ts index d9ad3853d2..c89b9d78c7 100644 --- a/src/daemon/interaction/internal/__tests__/interaction-settle.test.ts +++ b/src/daemon/interaction/internal/__tests__/interaction-settle.test.ts @@ -3,7 +3,7 @@ import { legacyDispatchCapture } from '../../../__tests__/legacy-snapshot-captur import { test, expect, vi, beforeEach } from 'vitest'; import { createInteractionRuntime, handleInteractionCommands } from '../../index.ts'; import type { SessionStore } from '../../../session-store.ts'; -import type { SessionState } from '../../../types.ts'; +import type { SessionState } from '../../../session-state.ts'; import type { SnapshotBackend } from '@agent-device/kernel/snapshot'; import { buildSnapshotState } from '../../../../core/snapshot-state.ts'; import { setSessionSnapshot } from '../../../session-snapshot.ts'; diff --git a/src/daemon/interaction/internal/__tests__/interaction-target-evidence.test.ts b/src/daemon/interaction/internal/__tests__/interaction-target-evidence.test.ts index 7ea725ec41..8fe8eed467 100644 --- a/src/daemon/interaction/internal/__tests__/interaction-target-evidence.test.ts +++ b/src/daemon/interaction/internal/__tests__/interaction-target-evidence.test.ts @@ -12,7 +12,7 @@ import { authoringPublication, } from '../../../../__tests__/test-utils/session-factories.ts'; import { SessionScriptWriter } from '../../../session-script-writer.ts'; -import type { SessionState } from '../../../types.ts'; +import type { SessionState } from '../../../session-state.ts'; import { mkdtempForTestSync } from '../../../../__tests__/test-utils/tmp-dir.ts'; // ADR 0012 decision 3, daemon-routed recording: target-v1 evidence is diff --git a/src/daemon/interaction/internal/__tests__/interaction-touch-fixtures.ts b/src/daemon/interaction/internal/__tests__/interaction-touch-fixtures.ts index fd63f211a0..2922e7fd71 100644 --- a/src/daemon/interaction/internal/__tests__/interaction-touch-fixtures.ts +++ b/src/daemon/interaction/internal/__tests__/interaction-touch-fixtures.ts @@ -8,7 +8,7 @@ import { import { makeTestScreenRecordingResource } from '../../../../__tests__/test-utils/screen-recording-live-handle.ts'; import { activateCompleteRefFrame } from '../../../ref-frame.ts'; import type { SessionStore } from '../../../session-store.ts'; -import type { SessionState } from '../../../types.ts'; +import type { SessionState } from '../../../session-state.ts'; import { handleInteractionCommands } from '../../index.ts'; import { getRuntimeBindings } from '../../../__tests__/interaction-get-runtime-fixture.ts'; import { buildSnapshotState } from '../../../../core/snapshot-state.ts'; diff --git a/src/daemon/interaction/internal/find-match-resolution.ts b/src/daemon/interaction/internal/find-match-resolution.ts index a094742c87..487df3b697 100644 --- a/src/daemon/interaction/internal/find-match-resolution.ts +++ b/src/daemon/interaction/internal/find-match-resolution.ts @@ -8,7 +8,8 @@ import { SELECTOR_PIPELINE_POLICIES } from '../../../core/selector-pipeline-poli import type { SnapshotState } from '@agent-device/kernel/snapshot'; import { isRootInteractionContainer } from '../../../core/interaction-targeting.ts'; import { preferOnscreenMatches } from './find-match-ranking.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { errorResponse } from '../../response.ts'; import { buildAmbiguousMatchError } from '../../selector-match-errors.ts'; diff --git a/src/daemon/interaction/internal/find-target-capture.ts b/src/daemon/interaction/internal/find-target-capture.ts index 9d33a46c37..053f8b67f1 100644 --- a/src/daemon/interaction/internal/find-target-capture.ts +++ b/src/daemon/interaction/internal/find-target-capture.ts @@ -3,7 +3,8 @@ import type { BoundSelectorCapture } from '../../selector-capture-binding.ts'; import type { SnapshotQualityVerdict, SnapshotState } from '@agent-device/kernel/snapshot'; import { createSelectorCaptureRuntime } from '../../selector-capture-runtime.ts'; import { SessionStore } from '../../session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { errorResponse } from '../../response.ts'; /** The tree a mutating find resolves its target against, plus what the capture disclosed. */ diff --git a/src/daemon/interaction/internal/find.ts b/src/daemon/interaction/internal/find.ts index 78174ae904..4f196ee296 100644 --- a/src/daemon/interaction/internal/find.ts +++ b/src/daemon/interaction/internal/find.ts @@ -9,7 +9,8 @@ import { runNodePipelineStages } from '../../../core/selector-pipeline.ts'; import { SELECTOR_PIPELINE_POLICIES } from '../../../core/selector-pipeline-policy.ts'; import { centerOfRect, type SnapshotState } from '@agent-device/kernel/snapshot'; import { expireRefFrame } from '../../ref-frame.ts'; -import type { DaemonInvokeFn, DaemonRequest, DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { SessionStore } from '../../session-store.ts'; import { contextFromFlags } from '../../context.ts'; import { readCommandMessage, successText } from '@agent-device/kernel/success-text'; diff --git a/src/daemon/interaction/internal/interaction-android-escape.ts b/src/daemon/interaction/internal/interaction-android-escape.ts index b5016e3f48..4f923396be 100644 --- a/src/daemon/interaction/internal/interaction-android-escape.ts +++ b/src/daemon/interaction/internal/interaction-android-escape.ts @@ -1,7 +1,7 @@ import type { AndroidObservationAdapter } from '@agent-device/contracts/android-observation'; import { AppError } from '@agent-device/kernel/errors'; import { detectAndroidEscapeSurface } from '../../android-foreground-surface.ts'; -import type { SessionState } from '../../types.ts'; +import type { SessionState } from '../../session-state.ts'; /** * Post-press escape guard. Throws when the tap left the app for a genuine diff --git a/src/daemon/interaction/internal/interaction-common.ts b/src/daemon/interaction/internal/interaction-common.ts index 8b8f278095..246125fc43 100644 --- a/src/daemon/interaction/internal/interaction-common.ts +++ b/src/daemon/interaction/internal/interaction-common.ts @@ -1,6 +1,6 @@ import type { CommandFlags } from '@agent-device/contracts/command'; import type { SnapshotState } from '@agent-device/kernel/snapshot'; -import type { DaemonResponse } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; import { stripInternalInteractionFlags } from '../../interaction-outcome-policy.ts'; import { computeTargetEvidence, diff --git a/src/daemon/interaction/internal/interaction-flags.ts b/src/daemon/interaction/internal/interaction-flags.ts index ff94357d86..4e72352012 100644 --- a/src/daemon/interaction/internal/interaction-flags.ts +++ b/src/daemon/interaction/internal/interaction-flags.ts @@ -1,6 +1,6 @@ import type { CommandFlags } from '@agent-device/contracts/command'; import type { SettleParams } from '@agent-device/contracts/interaction'; -import type { DaemonResponse } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; import { interactionErrorResponse } from './interaction-response.ts'; export function settleFlagGuardResponse( diff --git a/src/daemon/interaction/internal/interaction-gesture.ts b/src/daemon/interaction/internal/interaction-gesture.ts index 5b846fdc00..086715c5e1 100644 --- a/src/daemon/interaction/internal/interaction-gesture.ts +++ b/src/daemon/interaction/internal/interaction-gesture.ts @@ -28,7 +28,8 @@ import { isActiveProviderDevice } from '../../../provider-device-runtime.ts'; import { sleep } from '@agent-device/host-kit/retry'; import { ensureAndroidBlockingSystemDialogReady } from '../../android-system-dialog.ts'; import { readRefMutationFrame } from '../../ref-frame.ts'; -import type { DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { assertRefMutationAdmitted } from './interaction-ref-policy.ts'; import { createInteractionRuntimeForRoute, diff --git a/src/daemon/interaction/internal/interaction-ios-tap-outcome.ts b/src/daemon/interaction/internal/interaction-ios-tap-outcome.ts index ac3b68318f..4a56c864d9 100644 --- a/src/daemon/interaction/internal/interaction-ios-tap-outcome.ts +++ b/src/daemon/interaction/internal/interaction-ios-tap-outcome.ts @@ -11,7 +11,7 @@ import { getRequestSignal } from '@agent-device/host-kit/request'; import { isLocalIosRunnerSession } from '../../direct-ios-selector.ts'; import { emitDiagnostic } from '@agent-device/host-kit/diagnostics'; import type { SessionStore } from '../../session-store.ts'; -import type { SessionState } from '../../types.ts'; +import type { SessionState } from '../../session-state.ts'; import type { BoundContextFromFlags, CaptureSnapshotForSession } from './types.ts'; const XCTEST_RECORDED_FAILURE = 'XCTEST_RECORDED_FAILURE'; diff --git a/src/daemon/interaction/internal/interaction-ref-policy.ts b/src/daemon/interaction/internal/interaction-ref-policy.ts index fc7d29f053..b0a4723ce5 100644 --- a/src/daemon/interaction/internal/interaction-ref-policy.ts +++ b/src/daemon/interaction/internal/interaction-ref-policy.ts @@ -1,5 +1,5 @@ import { AppError } from '@agent-device/kernel/errors'; -import type { DaemonResponse } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; import type { RefFrameRejectReason, RefMutationFrame } from '../../ref-frame.ts'; import { interactionErrorResponse } from './interaction-response.ts'; diff --git a/src/daemon/interaction/internal/interaction-response.ts b/src/daemon/interaction/internal/interaction-response.ts index d9dcfc61d7..345b6315f7 100644 --- a/src/daemon/interaction/internal/interaction-response.ts +++ b/src/daemon/interaction/internal/interaction-response.ts @@ -1,4 +1,4 @@ -import type { DaemonResponse } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; export function interactionErrorResponse( code: string, diff --git a/src/daemon/interaction/internal/interaction-runtime.ts b/src/daemon/interaction/internal/interaction-runtime.ts index 436e80dd6e..6e94bdcd96 100644 --- a/src/daemon/interaction/internal/interaction-runtime.ts +++ b/src/daemon/interaction/internal/interaction-runtime.ts @@ -27,7 +27,8 @@ import { markDeferredInteractionOutcome } from '../../deferred-interaction-outco import { isSessionRecording } from '../../session-script-publication-capability.ts'; import { recordTouchVisualizationEvent } from '../../recording-gestures.ts'; import type { SessionStore } from '../../session-store.ts'; -import type { DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import type { BoundTouchExecutor } from '../../touch-runtime.ts'; import type { BoundGestureExecutor } from '../../gesture-runtime.ts'; diff --git a/src/daemon/interaction/internal/interaction-touch-android-freshness.ts b/src/daemon/interaction/internal/interaction-touch-android-freshness.ts index 5b7e0acab2..47d0c02b41 100644 --- a/src/daemon/interaction/internal/interaction-touch-android-freshness.ts +++ b/src/daemon/interaction/internal/interaction-touch-android-freshness.ts @@ -1,6 +1,6 @@ import { emitDiagnostic } from '@agent-device/host-kit/diagnostics'; import { getActiveAndroidSnapshotFreshness } from '../../session-snapshot-freshness.ts'; -import type { SessionState } from '../../types.ts'; +import type { SessionState } from '../../session-state.ts'; import type { CaptureSnapshotForSession, InteractionRouteInput } from './types.ts'; /** diff --git a/src/daemon/interaction/internal/interaction-touch-android-readiness.ts b/src/daemon/interaction/internal/interaction-touch-android-readiness.ts index e1bc5f3ff5..77da08deca 100644 --- a/src/daemon/interaction/internal/interaction-touch-android-readiness.ts +++ b/src/daemon/interaction/internal/interaction-touch-android-readiness.ts @@ -2,7 +2,8 @@ import { ensureAndroidBlockingSystemDialogReady, type AndroidBlockingDialogReadinessResult, } from '../../android-system-dialog.ts'; -import type { DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { readRefMutationFrame } from '../../ref-frame.ts'; import { refMutationAdmissionResponse } from './interaction-ref-policy.ts'; import type { AndroidObservationAdapter } from '@agent-device/contracts/android-observation'; diff --git a/src/daemon/interaction/internal/interaction-touch-direct-ios-eligibility.ts b/src/daemon/interaction/internal/interaction-touch-direct-ios-eligibility.ts index b8844f2283..5b142f4f75 100644 --- a/src/daemon/interaction/internal/interaction-touch-direct-ios-eligibility.ts +++ b/src/daemon/interaction/internal/interaction-touch-direct-ios-eligibility.ts @@ -9,7 +9,7 @@ import { type DirectIosSelectorTarget, } from '../../direct-ios-selector.ts'; import { isSessionRecording } from '../../session-script-publication-capability.ts'; -import type { SessionState } from '../../types.ts'; +import type { SessionState } from '../../session-state.ts'; /** * Whether a Maestro-compatible click needs the direct iOS selector route. diff --git a/src/daemon/interaction/internal/interaction-touch-direct-ios.ts b/src/daemon/interaction/internal/interaction-touch-direct-ios.ts index b5cfd5a523..74f926da75 100644 --- a/src/daemon/interaction/internal/interaction-touch-direct-ios.ts +++ b/src/daemon/interaction/internal/interaction-touch-direct-ios.ts @@ -6,7 +6,8 @@ import { type DirectIosSelectorTarget, } from '../../direct-ios-selector.ts'; import { expireRefFrame } from '../../ref-frame.ts'; -import type { DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { finalizeTouchInteraction } from './interaction-runtime.ts'; import type { CaptureSnapshotForSession, InteractionRouteInput } from './types.ts'; import { corroborateIosTapFailure } from './interaction-ios-tap-outcome.ts'; diff --git a/src/daemon/interaction/internal/interaction-touch-fill.ts b/src/daemon/interaction/internal/interaction-touch-fill.ts index 9c07691c2a..80e9788b86 100644 --- a/src/daemon/interaction/internal/interaction-touch-fill.ts +++ b/src/daemon/interaction/internal/interaction-touch-fill.ts @@ -2,7 +2,8 @@ import type { CommandFlags } from '@agent-device/contracts/command'; import type { FillCommandResult, InteractionTarget } from '@agent-device/contracts/interaction'; import { issueSettleRefs, resolveRefStalenessWarning } from '../../session-snapshot.ts'; import { readRefMutationFrame } from '../../ref-frame.ts'; -import type { DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { isSessionRecording } from '../../session-script-publication-capability.ts'; import { assertRecordedFillParameterization } from './interaction-recorded-input.ts'; import { readSettleRequest, settleFlagGuardResponse } from './interaction-flags.ts'; diff --git a/src/daemon/interaction/internal/interaction-touch-policy.ts b/src/daemon/interaction/internal/interaction-touch-policy.ts index a5cccd2641..900eca4fe8 100644 --- a/src/daemon/interaction/internal/interaction-touch-policy.ts +++ b/src/daemon/interaction/internal/interaction-touch-policy.ts @@ -1,5 +1,6 @@ import { isMacOs } from '@agent-device/kernel/device'; -import type { DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { errorResponse } from '../../response.ts'; export function unsupportedMacOsDesktopSurfaceInteraction( diff --git a/src/daemon/interaction/internal/interaction-touch-prepare.ts b/src/daemon/interaction/internal/interaction-touch-prepare.ts index be9e0ac8e3..f55908757d 100644 --- a/src/daemon/interaction/internal/interaction-touch-prepare.ts +++ b/src/daemon/interaction/internal/interaction-touch-prepare.ts @@ -1,4 +1,4 @@ -import type { SessionState } from '../../types.ts'; +import type { SessionState } from '../../session-state.ts'; import { createBoundTouchExecutor, resolveBoundTouchRuntime, diff --git a/src/daemon/interaction/internal/interaction-touch-press-admission.ts b/src/daemon/interaction/internal/interaction-touch-press-admission.ts index 2b45a73052..03920a6a7f 100644 --- a/src/daemon/interaction/internal/interaction-touch-press-admission.ts +++ b/src/daemon/interaction/internal/interaction-touch-press-admission.ts @@ -8,7 +8,8 @@ import { import { publicPlatformString } from '@agent-device/kernel/device'; import { resolveRefStalenessWarning } from '../../session-snapshot.ts'; import { readRefMutationFrame } from '../../ref-frame.ts'; -import type { DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { refMutationAdmissionResponse } from './interaction-ref-policy.ts'; import { settleFlagGuardResponse } from './interaction-flags.ts'; import type { diff --git a/src/daemon/interaction/internal/interaction-touch-press.ts b/src/daemon/interaction/internal/interaction-touch-press.ts index 2441df3d9f..f5649912b6 100644 --- a/src/daemon/interaction/internal/interaction-touch-press.ts +++ b/src/daemon/interaction/internal/interaction-touch-press.ts @@ -5,7 +5,7 @@ import type { } from '@agent-device/contracts/interaction'; import type { resolveClickButton } from '@agent-device/contracts/click-button'; import type { ReplayTargetGuardDenotation } from '@agent-device/contracts/replay'; -import type { DaemonResponse } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; import { assertAndroidPressStayedInApp } from './interaction-android-escape.ts'; import { createInteractionRuntimeForRoute } from './interaction-runtime.ts'; import { readSettleRequest } from './interaction-flags.ts'; @@ -161,7 +161,7 @@ async function runTargetedTouchInteraction(params: { flags: CommandFlags | undefined; durationMs?: number; expectedResolvedTarget?: ReplayTargetGuardDenotation; - /** #1654: a mutating `find`'s already-resolved node; see daemon/types.ts. */ + /** #1654: a mutating `find`'s already-resolved node; see daemon/daemon-request.ts. */ preresolvedTarget?: PreresolvedInteractionTarget; }): Promise { const { runtime, command, target, sessionName, requestId, flags, expectedResolvedTarget } = diff --git a/src/daemon/interaction/internal/interaction-touch-reference-frame.ts b/src/daemon/interaction/internal/interaction-touch-reference-frame.ts index 35e48e05fb..b395297ab9 100644 --- a/src/daemon/interaction/internal/interaction-touch-reference-frame.ts +++ b/src/daemon/interaction/internal/interaction-touch-reference-frame.ts @@ -4,7 +4,7 @@ import type { GestureReferenceFrame } from '@agent-device/contracts/scroll-gestu import { emitDiagnostic } from '@agent-device/host-kit/diagnostics'; import type { SessionStore } from '../../session-store.ts'; import { getSnapshotReferenceFrame } from '../../touch-reference-frame.ts'; -import type { SessionState } from '../../types.ts'; +import type { SessionState } from '../../session-state.ts'; import type { BoundContextFromFlags, CaptureSnapshotForSession } from './types.ts'; import { isActiveProviderDevice } from '../../../provider-device-runtime.ts'; diff --git a/src/daemon/interaction/internal/interaction-touch-response.ts b/src/daemon/interaction/internal/interaction-touch-response.ts index 7019bfc5ea..08bcc20a05 100644 --- a/src/daemon/interaction/internal/interaction-touch-response.ts +++ b/src/daemon/interaction/internal/interaction-touch-response.ts @@ -17,7 +17,7 @@ import { } from '../../../core/interaction-response-data-transform.ts'; import { issueSettleRefs } from '../../session-snapshot.ts'; import type { RecordedTargetCapture } from '../../session-target-evidence.ts'; -import type { SessionState } from '../../types.ts'; +import type { SessionState } from '../../session-state.ts'; import type { CaptureSnapshotForSession, InteractionRouteInput } from './types.ts'; import { resolveDirectTouchReferenceFrameSafely } from './interaction-touch-reference-frame.ts'; import { readSnapshotNodesReferenceFrame } from '../../touch-reference-frame.ts'; diff --git a/src/daemon/interaction/internal/interaction-touch-runtime.ts b/src/daemon/interaction/internal/interaction-touch-runtime.ts index 6f15a93c4b..2278c48ee3 100644 --- a/src/daemon/interaction/internal/interaction-touch-runtime.ts +++ b/src/daemon/interaction/internal/interaction-touch-runtime.ts @@ -10,7 +10,8 @@ import { asAppError, normalizeError } from '@agent-device/kernel/errors'; import { readResolvedInteractionTarget } from '../../../core/interaction-outcome.ts'; import { markSessionPartialRefsIssued } from '../../session-snapshot.ts'; import { isSessionRecording } from '../../session-script-publication-capability.ts'; -import type { DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { publishInteractionAmbiguityCandidates } from './interaction-ambiguity-publication.ts'; import { createInteractionRuntimeForRoute, diff --git a/src/daemon/interaction/internal/interaction-touch-targets.ts b/src/daemon/interaction/internal/interaction-touch-targets.ts index 091ec97369..8845f55bd8 100644 --- a/src/daemon/interaction/internal/interaction-touch-targets.ts +++ b/src/daemon/interaction/internal/interaction-touch-targets.ts @@ -9,7 +9,7 @@ import { stripAtPrefix, type DecodedFillTarget, } from '../../../core/interaction-positionals.ts'; -import type { DaemonResponse } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; import { parseCoordinateTarget } from './interaction-targeting.ts'; import { errorResponse } from '../../response.ts'; import { parseVersionedRefPositional } from '../../ref-positionals.ts'; diff --git a/src/daemon/interaction/internal/interaction.ts b/src/daemon/interaction/internal/interaction.ts index e294f55ebe..e4630ce545 100644 --- a/src/daemon/interaction/internal/interaction.ts +++ b/src/daemon/interaction/internal/interaction.ts @@ -1,4 +1,5 @@ -import type { DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import type { CaptureSnapshotForSession, InteractionRouteInput } from './types.ts'; import { dispatchFillViaRuntime } from './interaction-touch-fill.ts'; import { dispatchTargetedTouchViaRuntime } from './interaction-touch-press.ts'; diff --git a/src/daemon/interaction/internal/types.ts b/src/daemon/interaction/internal/types.ts index e9070d7155..8ed80409f0 100644 --- a/src/daemon/interaction/internal/types.ts +++ b/src/daemon/interaction/internal/types.ts @@ -6,7 +6,8 @@ import type { CommandSessionStore } from '../../../runtime-contract.ts'; import type { DeferredInteractionOutcomeMark } from '../../deferred-interaction-outcome.ts'; import type { RecordActionEntry } from '../../session-action-recorder.ts'; import type { BoundContextFromFlags } from '../../context.ts'; -import type { DaemonInvokeFn, DaemonRequest, DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import type { BoundGestureExecutor } from '../../gesture-runtime.ts'; import type { BoundTouchExecutor } from '../../touch-runtime.ts'; import type { BoundSnapshotCapture } from '../../snapshot-runtime-binding.ts'; diff --git a/src/daemon/internal-observation.ts b/src/daemon/internal-observation.ts index c2965bc0cf..da6db39d92 100644 --- a/src/daemon/internal-observation.ts +++ b/src/daemon/internal-observation.ts @@ -1,7 +1,8 @@ import type { SnapshotState } from '@agent-device/kernel/snapshot'; -import { readSessionRuntimeRevision, refFrame, type RefFrame } from './ref-frame.ts'; +import { readSessionRuntimeRevision, refFrame } from './ref-frame.ts'; +import type { RefFrame } from './ref-frame-slot.ts'; import { markSessionPartialRefsIssued, setSessionSnapshot } from './session-snapshot.ts'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; declare const INTERNAL_OBSERVATION_EVIDENCE: unique symbol; diff --git a/src/daemon/lease-context.ts b/src/daemon/lease-context.ts index f96af5a390..15451f0317 100644 --- a/src/daemon/lease-context.ts +++ b/src/daemon/lease-context.ts @@ -1,4 +1,4 @@ -import type { DaemonRequest } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; import type { LeaseBackend } from '@agent-device/kernel/contracts'; import type { DeviceLease } from '@agent-device/contracts/device'; import type { RunnerLogicalLeaseContext } from '@agent-device/contracts/runner-lease-context'; diff --git a/src/daemon/lease-lifecycle.ts b/src/daemon/lease-lifecycle.ts index 8500da8232..2b62017808 100644 --- a/src/daemon/lease-lifecycle.ts +++ b/src/daemon/lease-lifecycle.ts @@ -13,7 +13,8 @@ import { assertRequestLeaseAdmissionPreflight, } from './request-admission.ts'; import type { SessionStore } from './session-store.ts'; -import type { DaemonRequest, SessionState } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; +import type { SessionState } from './session-state.ts'; import { providerSessionIdFromData } from './provider-session-ownership.ts'; export type ExpiredProviderLeaseRecovery = (lease: DeviceLease) => Promise; diff --git a/src/daemon/managed-device-allocation/command-horizon.ts b/src/daemon/managed-device-allocation/command-horizon.ts index db1c6034d1..70515d0798 100644 --- a/src/daemon/managed-device-allocation/command-horizon.ts +++ b/src/daemon/managed-device-allocation/command-horizon.ts @@ -6,7 +6,7 @@ import { DAEMON_SESSION_TEARDOWN_TIMEOUT_MS, SCREEN_RECORDING_SESSION_TEARDOWN_BUDGET_MS, } from '../session-teardown-budget.ts'; -import type { DaemonRequest } from '../types.ts'; +import type { DaemonRequest } from '../daemon-request.ts'; import type { ManagedCommandHorizon } from './lease-admission.ts'; const MANAGED_COMMAND_TEARDOWN_TIMEOUT_MS = diff --git a/src/daemon/offscreen-target-probe.ts b/src/daemon/offscreen-target-probe.ts index 34cfeb60e3..106bbd0670 100644 --- a/src/daemon/offscreen-target-probe.ts +++ b/src/daemon/offscreen-target-probe.ts @@ -2,7 +2,7 @@ import type { Rect, SnapshotNode } from '@agent-device/kernel/snapshot'; import { isConfirmedOnScreenProbe } from '@agent-device/capture-kit/mobile-snapshot-semantics'; import { deriveDirectIosNodeSelector, queryDirectIosSelector } from './direct-ios-selector.ts'; import type { AppleRunnerRequestOptions } from './apple-runner-options.ts'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; export async function confirmIosOffscreenTargetVisible(params: { session: SessionState; diff --git a/src/daemon/perf-capture-session-resource.ts b/src/daemon/perf-capture-session-resource.ts index 49d404112d..78a0f1e323 100644 --- a/src/daemon/perf-capture-session-resource.ts +++ b/src/daemon/perf-capture-session-resource.ts @@ -13,7 +13,7 @@ import { createDurableCaptureResource } from './durable-capture-resource.ts'; import type { PerfCaptureAdmissionLedger } from './perf-capture-admission-ledger.ts'; import { perfCaptureResourceStore } from './perf-capture-resource-store.ts'; import type { SessionStore } from './session-store.ts'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; export const perfCaptureDurableResource = createDurableCaptureResource< 'perf-capture', diff --git a/src/daemon/platform-request-scope.ts b/src/daemon/platform-request-scope.ts index 201a92e9c6..2d1cb412b2 100644 --- a/src/daemon/platform-request-scope.ts +++ b/src/daemon/platform-request-scope.ts @@ -6,7 +6,7 @@ import type { import { getRequestSignal, emitRequestProgress } from '@agent-device/host-kit/request'; import { emitDiagnostic } from '@agent-device/host-kit/diagnostics'; -import type { DaemonRequest } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; const processLifetimeSignal = new AbortController().signal; diff --git a/src/daemon/recording-gestures.ts b/src/daemon/recording-gestures.ts index 313f2ecd3e..3410c8fe0f 100644 --- a/src/daemon/recording-gestures.ts +++ b/src/daemon/recording-gestures.ts @@ -1,6 +1,6 @@ import { isIosFamily } from '@agent-device/kernel/device'; import type { RecordingGestureEvent } from '@agent-device/contracts/screen-recording-runtime'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; import type { SnapshotState } from '@agent-device/kernel/snapshot'; import { resolveGestureDurationMs, diff --git a/src/daemon/ref-frame-slot.ts b/src/daemon/ref-frame-slot.ts new file mode 100644 index 0000000000..3006dc8727 --- /dev/null +++ b/src/daemon/ref-frame-slot.ts @@ -0,0 +1,93 @@ +import type { SnapshotState } from '@agent-device/kernel/snapshot'; + +/** + * The ADR 0014 ref-frame VALUE, declared below both `session-state.ts` (which gives the session a + * slot to hold one) and `ref-frame.ts` (which decides which frame a session holds). Those two + * would otherwise have to import each other, and a type cycle makes every file in the loop + * unreadable in isolation. + * + * The lifetime rules, the admission matrix, and every `session.refFrame` write stay in + * `ref-frame.ts`. This module owns only the value: what a frame IS, and the three ways one comes + * into existence. + */ + +/** + * Issuance scope of the current frame: `all` for a complete namespace (a full + * interactive snapshot), or the bounded set of ref bodies a partial publication + * (`find`, settled diff, replay divergence) actually returned. + */ +export type RefFrameScope = 'all' | ReadonlySet; + +/** Lifecycle state of the current frame. */ +export type RefFrameState = 'active' | 'expired'; + +type RefFrameFields = Readonly<{ + state: RefFrameState; + scope: RefFrameScope; + tree: SnapshotState | undefined; + generation: number | undefined; +}>; + +/** + * One value, replaced whole by the transitions below. The class is not exported, so nothing + * outside this file can construct, edit, or derive a frame; its ECMAScript private field also + * makes the exported `RefFrame` nominal, so no object literal can stand in for one. + */ +class SessionRefFrame { + readonly #fields: RefFrameFields; + + constructor(fields: RefFrameFields) { + this.#fields = fields; + } + + get state(): RefFrameState { + return this.#fields.state; + } + + get scope(): RefFrameScope { + return this.#fields.scope; + } + + get tree(): SnapshotState | undefined { + return this.#fields.tree; + } + + get generation(): number | undefined { + return this.#fields.generation; + } + + /** Idempotent by identity: an expired frame is returned as is, so repeated expiry compares `===`. */ + static expire(frame: SessionRefFrame): SessionRefFrame { + if (frame.#fields.state === 'expired') return frame; + return new SessionRefFrame({ ...frame.#fields, state: 'expired' }); + } +} + +export type RefFrame = SessionRefFrame; + +/** + * The frame a session has before anything issues refs: complete authority over + * an empty namespace, deferring tree and epoch to the operational observation. + * A shared constant, so lineage identity is stable for a session that never + * reached a transition. + */ +export const PRISTINE_REF_FRAME: RefFrame = new SessionRefFrame({ + state: 'active', + scope: 'all', + tree: undefined, + generation: undefined, +}); + +/** The frame an issuance mints. Retention and epoch semantics are the caller's; see `ref-frame.ts`. */ +export function issuedRefFrame(fields: { + scope: RefFrameScope; + tree: SnapshotState | undefined; + generation: number | undefined; +}): RefFrame { + return new SessionRefFrame({ state: 'active', ...fields }); +} + +/** The expired counterpart of `frame`, or `frame` itself when it is already expired. */ +export function expiredRefFrame(frame: RefFrame): RefFrame { + return SessionRefFrame.expire(frame); +} diff --git a/src/daemon/ref-frame.ts b/src/daemon/ref-frame.ts index ddb018e457..bdb5e2e341 100644 --- a/src/daemon/ref-frame.ts +++ b/src/daemon/ref-frame.ts @@ -1,5 +1,13 @@ import type { SnapshotState } from '@agent-device/kernel/snapshot'; -import type { SessionState } from './types.ts'; +import { + expiredRefFrame, + issuedRefFrame, + PRISTINE_REF_FRAME, + type RefFrame, + type RefFrameScope, + type RefFrameState, +} from './ref-frame-slot.ts'; +import type { SessionState } from './session-state.ts'; const runtimeRevisions = new WeakMap(); @@ -9,8 +17,9 @@ const runtimeRevisions = new WeakMap(); * * A session owns at most one **ref frame**: the namespace whose refs a caller * may use to target a mutation. This module is the single owner of the frame's - * transitions and of the admission decision. The frame epoch reuses the existing - * `snapshotGeneration`/`refsGeneration` counter and the `@e12~s42` pin grammar + * transitions and of the admission decision; the frame value itself is declared in + * `ref-frame-slot.ts`, below this module and the session record. The frame epoch reuses + * the existing `snapshotGeneration`/`refsGeneration` counter and the `@e12~s42` pin grammar * for wire compatibility. * * The frame is expired at the device side-effect seam, carries a non-`all` @@ -21,16 +30,6 @@ const runtimeRevisions = new WeakMap(); * migration step 8 removed. */ -/** - * Issuance scope of the current frame: `all` for a complete namespace (a full - * interactive snapshot), or the bounded set of ref bodies a partial publication - * (`find`, settled diff, replay divergence) actually returned. - */ -export type RefFrameScope = 'all' | ReadonlySet; - -/** Lifecycle state of the current frame. */ -export type RefFrameState = 'active' | 'expired'; - /** * Typed admission-failure reasons, evaluated in this order so the caller can * distinguish "capture a complete snapshot" from "use the emitted pinned ref". @@ -45,69 +44,13 @@ export type RefFrameAdmission = | { admitted: true } | { admitted: false; reason: RefFrameRejectReason }; -type RefFrameFields = Readonly<{ - state: RefFrameState; - scope: RefFrameScope; - tree: SnapshotState | undefined; - generation: number | undefined; -}>; - -/** - * One value, replaced whole by this module's transitions. The class is not exported, so nothing - * outside this file can construct, edit, or derive a frame. - */ -class SessionRefFrame { - readonly #fields: RefFrameFields; - - constructor(fields: RefFrameFields) { - this.#fields = fields; - } - - get state(): RefFrameState { - return this.#fields.state; - } - - get scope(): RefFrameScope { - return this.#fields.scope; - } - - get tree(): SnapshotState | undefined { - return this.#fields.tree; - } - - get generation(): number | undefined { - return this.#fields.generation; - } - - /** Idempotent by identity: an expired frame is returned as is, so repeated expiry compares `===`. */ - static expire(frame: SessionRefFrame): SessionRefFrame { - if (frame.#fields.state === 'expired') return frame; - return new SessionRefFrame({ ...frame.#fields, state: 'expired' }); - } -} - -export type RefFrame = SessionRefFrame; - -/** - * The frame a session has before anything issues refs: complete authority over - * an empty namespace, deferring tree and epoch to the operational observation. - * A shared constant, so lineage identity is stable for a session that never - * reached a transition. - */ -const PRISTINE_FRAME = new SessionRefFrame({ - state: 'active', - scope: 'all', - tree: undefined, - generation: undefined, -}); - /** * The session's current frame, as one comparable value. Identity changes on * every transition and only on a transition, so a caller holding an earlier * frame can tell whether authority moved with a single `===`. */ export function refFrame(session: SessionState): RefFrame { - return session.refFrame ?? PRISTINE_FRAME; + return session.refFrame ?? PRISTINE_REF_FRAME; } /** @@ -146,7 +89,7 @@ export function refFrameTree(session: SessionState): SnapshotState | undefined { */ export function expireRefFrame(session: SessionState): void { advanceSessionRuntimeRevision(session); - session.refFrame = SessionRefFrame.expire(refFrame(session)); + session.refFrame = expiredRefFrame(refFrame(session)); session.snapshotScopeSource = undefined; } @@ -205,8 +148,7 @@ export function activatePartialRefFrame(session: SessionState, scope: ReadonlySe * namespace that authorized it. */ function activateRefFrame(session: SessionState, scope: RefFrameScope): void { - session.refFrame = new SessionRefFrame({ - state: 'active', + session.refFrame = issuedRefFrame({ scope, tree: session.snapshot, generation: session.snapshotGeneration, diff --git a/src/daemon/ref-positionals.ts b/src/daemon/ref-positionals.ts index 1b0518beaf..256347e771 100644 --- a/src/daemon/ref-positionals.ts +++ b/src/daemon/ref-positionals.ts @@ -1,5 +1,5 @@ import { REF_GRAMMAR_HINT, splitRefGenerationSuffix } from '@agent-device/kernel/snapshot'; -import type { DaemonResponse } from './types.ts'; +import type { DaemonResponse } from './daemon-request.ts'; import { errorResponse } from './response.ts'; /** diff --git a/src/daemon/ref-snapshot-flag-policy.ts b/src/daemon/ref-snapshot-flag-policy.ts index b4a69290bd..54b0db7ae2 100644 --- a/src/daemon/ref-snapshot-flag-policy.ts +++ b/src/daemon/ref-snapshot-flag-policy.ts @@ -1,5 +1,5 @@ import type { CommandFlags } from '@agent-device/contracts/command'; -import type { DaemonResponse } from './types.ts'; +import type { DaemonResponse } from './daemon-request.ts'; import { errorResponse } from './response.ts'; const REF_UNSUPPORTED_FLAG_MAP: ReadonlyArray<[keyof CommandFlags, string]> = [ diff --git a/src/daemon/replay-device-selection.ts b/src/daemon/replay-device-selection.ts index d6760cc286..fb84a9b255 100644 --- a/src/daemon/replay-device-selection.ts +++ b/src/daemon/replay-device-selection.ts @@ -9,7 +9,7 @@ import type { ResolveTargetDeviceOptions } from '../core/dispatch-resolve.ts'; import { isDeepLinkTarget, type CommandFlags } from '@agent-device/contracts/command'; import { readReplayScriptSourceFile } from './replay-script-source.ts'; import { appleSimulatorAppTargetForOpenTarget } from './open-device-selection.ts'; -import type { DaemonRequest } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; export type ReplayTargetDeviceResolution = { flags: CommandFlags; diff --git a/src/daemon/replay/__tests__/application.test.ts b/src/daemon/replay/__tests__/application.test.ts index 4277104252..ae70b63dd5 100644 --- a/src/daemon/replay/__tests__/application.test.ts +++ b/src/daemon/replay/__tests__/application.test.ts @@ -11,7 +11,7 @@ import { import { mkdtempForTestSync } from '../../../__tests__/test-utils/tmp-dir.ts'; import { makeIosSession } from '../../../__tests__/test-utils/session-factories.ts'; import { withClientReplayScriptSources } from '../../../__tests__/test-utils/replay-script-source.ts'; -import type { DaemonRequest, DaemonResponse } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; import { SessionStore } from '../../session-store.ts'; import { createReplaySession } from '../../handlers/session-replay-command.ts'; import { runReplayCommand, runReplayTestCommand } from '../index.ts'; diff --git a/src/daemon/replay/__tests__/replay-command-fixture.ts b/src/daemon/replay/__tests__/replay-command-fixture.ts index d6544ac396..f95fba76bf 100644 --- a/src/daemon/replay/__tests__/replay-command-fixture.ts +++ b/src/daemon/replay/__tests__/replay-command-fixture.ts @@ -1,5 +1,5 @@ import type { ReplayTestAttemptStepSink } from '@agent-device/replay-test'; -import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../../types.ts'; +import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; import type { SessionStore } from '../../session-store.ts'; import { createReplaySession } from '../../handlers/session-replay-command.ts'; import { runReplayCommand } from '../index.ts'; diff --git a/src/daemon/replay/__tests__/session-replay-runtime.fixtures.ts b/src/daemon/replay/__tests__/session-replay-runtime.fixtures.ts index 38d96fc397..d7d47319c0 100644 --- a/src/daemon/replay/__tests__/session-replay-runtime.fixtures.ts +++ b/src/daemon/replay/__tests__/session-replay-runtime.fixtures.ts @@ -6,7 +6,7 @@ import { } from '../../../__tests__/test-utils/session-factories.ts'; import { replayScriptSourceBundleFor } from '../../../__tests__/test-utils/replay-script-source.ts'; import type { SessionStore } from '../../session-store.ts'; -import type { DaemonRequest } from '../../types.ts'; +import type { DaemonRequest } from '../../daemon-request.ts'; export function writeReplayFile(root: string, lines: string[]): string { const filePath = path.join(root, 'flow.ad'); diff --git a/src/daemon/replay/internal/__tests__/session-replay-action-runtime.test.ts b/src/daemon/replay/internal/__tests__/session-replay-action-runtime.test.ts index 5811cf1212..53a4b726cc 100644 --- a/src/daemon/replay/internal/__tests__/session-replay-action-runtime.test.ts +++ b/src/daemon/replay/internal/__tests__/session-replay-action-runtime.test.ts @@ -2,7 +2,7 @@ import type { SessionAction } from '@agent-device/contracts/session'; import { expect, test } from 'vitest'; import { makeIosSession } from '../../../../__tests__/test-utils/session-factories.ts'; import { recordActionEntry } from '../../../session-action-recorder.ts'; -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; import { invokeReplayAction } from '../session-replay-action-runtime.ts'; import { resolveReplayAction } from '@agent-device/ad-script'; diff --git a/src/daemon/replay/internal/__tests__/session-replay-dispatch-selector-miss.test.ts b/src/daemon/replay/internal/__tests__/session-replay-dispatch-selector-miss.test.ts index 60f9eefb02..389cf6d287 100644 --- a/src/daemon/replay/internal/__tests__/session-replay-dispatch-selector-miss.test.ts +++ b/src/daemon/replay/internal/__tests__/session-replay-dispatch-selector-miss.test.ts @@ -34,7 +34,7 @@ import path from 'node:path'; import { runReplayForTest } from '../../__tests__/replay-command-fixture.ts'; import { SessionStore } from '../../../session-store.ts'; import { AppError } from '@agent-device/kernel/errors'; -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; import { captureSnapshotWithInteractor } from '../../../snapshot-interactor-capture.ts'; import { makeIosSession } from '../../../../__tests__/test-utils/session-factories.ts'; import { diff --git a/src/daemon/replay/internal/__tests__/session-replay-maestro-error-projection.test.ts b/src/daemon/replay/internal/__tests__/session-replay-maestro-error-projection.test.ts index 5918d76c52..60c652de4e 100644 --- a/src/daemon/replay/internal/__tests__/session-replay-maestro-error-projection.test.ts +++ b/src/daemon/replay/internal/__tests__/session-replay-maestro-error-projection.test.ts @@ -8,7 +8,7 @@ import { createReplaySession } from '../../../handlers/session-replay-command.ts import { makeIosSession } from '../../../../__tests__/test-utils/session-factories.ts'; import { maestroScriptSourceBundleFor } from '../../../../__tests__/test-utils/replay-script-source.ts'; import { mkdtempForTestSync } from '../../../../__tests__/test-utils/tmp-dir.ts'; -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; // A replay error raised before any step runs carries no `failure`, so the route // projects the normalized error directly instead of through the divergence diff --git a/src/daemon/replay/internal/__tests__/session-replay-maestro-session-address.test.ts b/src/daemon/replay/internal/__tests__/session-replay-maestro-session-address.test.ts index 86fef7487a..493a4360b9 100644 --- a/src/daemon/replay/internal/__tests__/session-replay-maestro-session-address.test.ts +++ b/src/daemon/replay/internal/__tests__/session-replay-maestro-session-address.test.ts @@ -8,7 +8,7 @@ import { createReplaySession } from '../../../handlers/session-replay-command.ts import { makeIosSession } from '../../../../__tests__/test-utils/session-factories.ts'; import { maestroScriptSourceBundleFor } from '../../../../__tests__/test-utils/replay-script-source.ts'; import { mkdtempForTestSync } from '../../../../__tests__/test-utils/tmp-dir.ts'; -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; // The Maestro replay route resolves the store key upstream and then validates the session's // selectors, so its conflict recovery must name that key too — an implicitly cwd-scoped session diff --git a/src/daemon/replay/internal/__tests__/session-replay-repair-acceptance.test.ts b/src/daemon/replay/internal/__tests__/session-replay-repair-acceptance.test.ts index 0f3d9be842..9b81993228 100644 --- a/src/daemon/replay/internal/__tests__/session-replay-repair-acceptance.test.ts +++ b/src/daemon/replay/internal/__tests__/session-replay-repair-acceptance.test.ts @@ -23,7 +23,7 @@ import { runReplayForTest } from '../../__tests__/replay-command-fixture.ts'; import { SessionStore } from '../../../session-store.ts'; import { captureSnapshotWithInteractor } from '../../../snapshot-interactor-capture.ts'; import { makeIosSession } from '../../../../__tests__/test-utils/session-factories.ts'; -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; import { parseReplayScriptDetailed } from '@agent-device/ad-script'; import { baseReplayRequest as baseReq, diff --git a/src/daemon/replay/internal/__tests__/session-replay-repair-empty-tail.test.ts b/src/daemon/replay/internal/__tests__/session-replay-repair-empty-tail.test.ts index 0c91b496a5..0aed12e68b 100644 --- a/src/daemon/replay/internal/__tests__/session-replay-repair-empty-tail.test.ts +++ b/src/daemon/replay/internal/__tests__/session-replay-repair-empty-tail.test.ts @@ -44,7 +44,7 @@ import { } from '../../../__tests__/legacy-snapshot-capture-fixture.ts'; import { makeIosSession } from '../../../../__tests__/test-utils/session-factories.ts'; import { repairSessionBoundary } from '../../../session-replay-transaction.ts'; -import type { SessionState } from '../../../types.ts'; +import type { SessionState } from '../../../session-state.ts'; import { baseReplayRequest as baseReq, writeReplayFile, diff --git a/src/daemon/replay/internal/__tests__/session-replay-repair-loop.test.ts b/src/daemon/replay/internal/__tests__/session-replay-repair-loop.test.ts index e1e0faac92..bfc89d7e76 100644 --- a/src/daemon/replay/internal/__tests__/session-replay-repair-loop.test.ts +++ b/src/daemon/replay/internal/__tests__/session-replay-repair-loop.test.ts @@ -34,7 +34,8 @@ import { NO_SCRIPT_PUBLICATION, scriptTargetPath, } from '../../../session-script-publication-state.ts'; -import type { DaemonRequest, SessionState } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; +import type { SessionState } from '../../../session-state.ts'; import { baseReplayRequest as baseReq, writeReplayFile, diff --git a/src/daemon/replay/internal/__tests__/session-replay-repair-transaction.test.ts b/src/daemon/replay/internal/__tests__/session-replay-repair-transaction.test.ts index 7ac8601c33..de2188f6f1 100644 --- a/src/daemon/replay/internal/__tests__/session-replay-repair-transaction.test.ts +++ b/src/daemon/replay/internal/__tests__/session-replay-repair-transaction.test.ts @@ -75,7 +75,8 @@ import { scriptTargetForce, } from '../../../session-script-publication-state.ts'; import { parseReplayScriptDetailed } from '@agent-device/ad-script'; -import type { DaemonRequest, SessionState } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; +import type { SessionState } from '../../../session-state.ts'; import { baseReplayRequest as baseReq, writeReplayFile, @@ -536,9 +537,8 @@ test('BLOCKER 2b/2c: a close whose commit FAILS (no-clobber) keeps the session f expect(fs.readFileSync(path.join(root, 'flow.healed.ad'), 'utf8')).toBe(before); // The rolled-back finalize `close` did not linger, so a retry does not // accumulate a duplicate `close` in the healed slice. - expect(sessionStore.get(sessionName)!.actions.filter((a) => a.command === 'close')).toHaveLength( - 0, - ); + const closeActions = sessionStore.get(sessionName)!.actions.filter((a) => a.command === 'close'); + expect(closeActions).toHaveLength(0); // Retry with an explicit path commits cleanly — exactly ONE terminal close. const retryPath = path.join(root, 'flow.promoted.ad'); diff --git a/src/daemon/replay/internal/__tests__/session-replay-repair.fixtures.ts b/src/daemon/replay/internal/__tests__/session-replay-repair.fixtures.ts index 44fb814e42..8f6281daf1 100644 --- a/src/daemon/replay/internal/__tests__/session-replay-repair.fixtures.ts +++ b/src/daemon/replay/internal/__tests__/session-replay-repair.fixtures.ts @@ -7,7 +7,7 @@ import { isSessionRecording } from '../../../session-script-publication-capabili * session.actions." This factory keeps the per-test mock declarative (a config * object, no inline branching) so each test body stays linear. */ -import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../../../types.ts'; +import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../../../daemon-request.ts'; import { SessionStore } from '../../../session-store.ts'; import { isInteractiveObservation } from '../../../session-action-recorder.ts'; import { makeIosSession } from '../../../../__tests__/test-utils/session-factories.ts'; diff --git a/src/daemon/replay/internal/__tests__/session-replay-resume.test.ts b/src/daemon/replay/internal/__tests__/session-replay-resume.test.ts index e7a1ef614c..74ab360220 100644 --- a/src/daemon/replay/internal/__tests__/session-replay-resume.test.ts +++ b/src/daemon/replay/internal/__tests__/session-replay-resume.test.ts @@ -3,7 +3,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import { buildReplayDivergenceResume } from '../session-replay-resume.ts'; import { stampPendingRecordAndHealWatermark } from '../../../session-replay-coordinator.ts'; -import type { SessionState } from '../../../types.ts'; +import type { SessionState } from '../../../session-state.ts'; import { makeIosSession } from '../../../../__tests__/test-utils/session-factories.ts'; function action(overrides: Partial = {}): SessionAction { diff --git a/src/daemon/replay/internal/__tests__/session-replay-runtime-failure.test.ts b/src/daemon/replay/internal/__tests__/session-replay-runtime-failure.test.ts index 44e0f07c6e..ed0b678769 100644 --- a/src/daemon/replay/internal/__tests__/session-replay-runtime-failure.test.ts +++ b/src/daemon/replay/internal/__tests__/session-replay-runtime-failure.test.ts @@ -12,7 +12,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { runReplayForTest } from '../../__tests__/replay-command-fixture.ts'; import { SessionStore } from '../../../session-store.ts'; -import type { DaemonResponse } from '../../../types.ts'; +import type { DaemonResponse } from '../../../daemon-request.ts'; import { makeIosSession } from '../../../../__tests__/test-utils/session-factories.ts'; import { formatReplayDivergenceReport } from '@agent-device/contracts/divergence'; import { maestroScriptSourceBundleFor } from '../../../../__tests__/test-utils/replay-script-source.ts'; diff --git a/src/daemon/replay/internal/__tests__/session-replay-runtime-keep-session.test.ts b/src/daemon/replay/internal/__tests__/session-replay-runtime-keep-session.test.ts index 1e5833723c..765b95e1c8 100644 --- a/src/daemon/replay/internal/__tests__/session-replay-runtime-keep-session.test.ts +++ b/src/daemon/replay/internal/__tests__/session-replay-runtime-keep-session.test.ts @@ -41,7 +41,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { runReplayForTest } from '../../__tests__/replay-command-fixture.ts'; import { SessionStore } from '../../../session-store.ts'; -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; import { makeIosSession } from '../../../../__tests__/test-utils/session-factories.ts'; import { baseReplayRequest as baseReq, diff --git a/src/daemon/replay/internal/__tests__/session-replay-runtime-maestro.test.ts b/src/daemon/replay/internal/__tests__/session-replay-runtime-maestro.test.ts index 7609ea5b16..c8376c984c 100644 --- a/src/daemon/replay/internal/__tests__/session-replay-runtime-maestro.test.ts +++ b/src/daemon/replay/internal/__tests__/session-replay-runtime-maestro.test.ts @@ -52,7 +52,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { Worker } from 'node:worker_threads'; import { PNG } from '@agent-device/capture-kit/png'; -import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../../../types.ts'; +import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../../../daemon-request.ts'; import { SessionStore } from '../../../session-store.ts'; import { runReplayForTest } from '../../__tests__/replay-command-fixture.ts'; import type { ReplayScriptSourceBundle } from '@agent-device/contracts/replay'; diff --git a/src/daemon/replay/internal/__tests__/session-replay-scenario.fixtures.ts b/src/daemon/replay/internal/__tests__/session-replay-scenario.fixtures.ts index 9bd0e1ff4d..211a35ed50 100644 --- a/src/daemon/replay/internal/__tests__/session-replay-scenario.fixtures.ts +++ b/src/daemon/replay/internal/__tests__/session-replay-scenario.fixtures.ts @@ -2,7 +2,7 @@ import path from 'node:path'; import { mkdtempForTestSync } from '../../../../__tests__/test-utils/tmp-dir.ts'; import { makeIosAppSession } from '../../../../__tests__/test-utils/session-factories.ts'; import { SessionStore } from '../../../session-store.ts'; -import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../../../types.ts'; +import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../../../daemon-request.ts'; import { runReplayForTest } from '../../__tests__/replay-command-fixture.ts'; import { baseReplayRequest, diff --git a/src/daemon/replay/internal/__tests__/session-test-infrastructure.test.ts b/src/daemon/replay/internal/__tests__/session-test-infrastructure.test.ts index 165c59b3cf..771c0c3c5e 100644 --- a/src/daemon/replay/internal/__tests__/session-test-infrastructure.test.ts +++ b/src/daemon/replay/internal/__tests__/session-test-infrastructure.test.ts @@ -2,7 +2,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { isReplayInfrastructureFailure } from '../session-test-infrastructure.ts'; import { ALLOCATOR_CLAIM_MISSING } from '../../../device-claim-conflict.ts'; -import type { DaemonResponse } from '../../../types.ts'; +import type { DaemonResponse } from '../../../daemon-request.ts'; import type { ReplaySuiteTestResult } from '@agent-device/contracts/replay'; test('isReplayInfrastructureFailure accepts shared boot diagnostic reasons', () => { diff --git a/src/daemon/replay/internal/__tests__/session-test-runner.test.ts b/src/daemon/replay/internal/__tests__/session-test-runner.test.ts index 3539bed3b2..d8d367af19 100644 --- a/src/daemon/replay/internal/__tests__/session-test-runner.test.ts +++ b/src/daemon/replay/internal/__tests__/session-test-runner.test.ts @@ -10,7 +10,7 @@ import { noopInvoke, assertInvalidArgsMessage, } from '../../../handlers/__tests__/session-test-harness.ts'; -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; import { handleSessionCommands } from '../../../handlers/__tests__/session-command-harness.ts'; import { mkdtempForTestSync } from '../../../../__tests__/test-utils/tmp-dir.ts'; diff --git a/src/daemon/replay/internal/__tests__/session-test-suite-command-flag-policy.test.ts b/src/daemon/replay/internal/__tests__/session-test-suite-command-flag-policy.test.ts index abb1688caa..27cfd9e70d 100644 --- a/src/daemon/replay/internal/__tests__/session-test-suite-command-flag-policy.test.ts +++ b/src/daemon/replay/internal/__tests__/session-test-suite-command-flag-policy.test.ts @@ -15,7 +15,7 @@ import type { ReplayTestCommand } from '../command-types.ts'; import { REPLAY_ONLY_TEST_FLAG_REJECTIONS } from '../session-replay-test-policy.ts'; import { replayCommandFamily } from '../../../../commands/replay/index.ts'; import { mkdtempForTestSync } from '../../../../__tests__/test-utils/tmp-dir.ts'; -import type { DaemonInvokeFn, DaemonRequest } from '../../../types.ts'; +import type { DaemonInvokeFn, DaemonRequest } from '../../../daemon-request.ts'; // --- ADR 0012 decision 4 / migration step 5: `--from` is replay-only --- diff --git a/src/daemon/replay/internal/__tests__/session-test-suite-command-remote-artifacts.test.ts b/src/daemon/replay/internal/__tests__/session-test-suite-command-remote-artifacts.test.ts index dff7ccbcc2..1f0c5a7975 100644 --- a/src/daemon/replay/internal/__tests__/session-test-suite-command-remote-artifacts.test.ts +++ b/src/daemon/replay/internal/__tests__/session-test-suite-command-remote-artifacts.test.ts @@ -17,7 +17,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { test } from 'vitest'; import type { ReplaySuiteResult } from '@agent-device/contracts/replay'; -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; import { attachRemoteReplayTestArtifacts } from '../test-command.ts'; import { mkdtempForTestSync } from '../../../../__tests__/test-utils/tmp-dir.ts'; diff --git a/src/daemon/replay/internal/__tests__/session-test-suite-command-video.test.ts b/src/daemon/replay/internal/__tests__/session-test-suite-command-video.test.ts index 847fc74a4d..ef1334b7f8 100644 --- a/src/daemon/replay/internal/__tests__/session-test-suite-command-video.test.ts +++ b/src/daemon/replay/internal/__tests__/session-test-suite-command-video.test.ts @@ -4,7 +4,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { beforeEach, test, vi } from 'vitest'; import { SessionStore } from '../../../session-store.ts'; -import type { DaemonRequest, DaemonResponse } from '../../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../../daemon-request.ts'; import { makeIosSession } from '../../../../__tests__/test-utils/session-factories.ts'; import { runReplayTestCommand } from '../../index.ts'; import { mkdtempForTestSync } from '../../../../__tests__/test-utils/tmp-dir.ts'; diff --git a/src/daemon/replay/internal/__tests__/session-test-suite-infrastructure.test.ts b/src/daemon/replay/internal/__tests__/session-test-suite-infrastructure.test.ts index b0f51d5edf..289183222f 100644 --- a/src/daemon/replay/internal/__tests__/session-test-suite-infrastructure.test.ts +++ b/src/daemon/replay/internal/__tests__/session-test-suite-infrastructure.test.ts @@ -3,7 +3,7 @@ import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { mkdtempForTestSync } from '../../../../__tests__/test-utils/tmp-dir.ts'; -import type { DaemonResponse } from '../../../types.ts'; +import type { DaemonResponse } from '../../../daemon-request.ts'; import { handleSessionCommands } from '../../../handlers/__tests__/session-command-harness.ts'; import { expectOkData, makeSessionStore } from './session-test-suite.fixtures.ts'; diff --git a/src/daemon/replay/internal/__tests__/session-test-suite.fixtures.ts b/src/daemon/replay/internal/__tests__/session-test-suite.fixtures.ts index 35b798c54f..d360e0699d 100644 --- a/src/daemon/replay/internal/__tests__/session-test-suite.fixtures.ts +++ b/src/daemon/replay/internal/__tests__/session-test-suite.fixtures.ts @@ -2,7 +2,7 @@ import { expect } from 'vitest'; import path from 'node:path'; import { mkdtempForTestSync } from '../../../../__tests__/test-utils/tmp-dir.ts'; import { SessionStore } from '../../../session-store.ts'; -import type { DaemonResponse, DaemonResponseData } from '../../../types.ts'; +import type { DaemonResponse, DaemonResponseData } from '../../../daemon-request.ts'; export function makeSessionStore(): SessionStore { const root = mkdtempForTestSync('agent-device-session-test-suite-'); diff --git a/src/daemon/replay/internal/__tests__/session-test-suite.test.ts b/src/daemon/replay/internal/__tests__/session-test-suite.test.ts index b8647bee38..326add5485 100644 --- a/src/daemon/replay/internal/__tests__/session-test-suite.test.ts +++ b/src/daemon/replay/internal/__tests__/session-test-suite.test.ts @@ -21,7 +21,7 @@ import { handleSessionCommands, mockInspectDeviceRuntimeFacts, } from '../../../handlers/__tests__/session-command-harness.ts'; -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; import { expectOkData, makeSessionStore } from './session-test-suite.fixtures.ts'; import { withRequestProgressSink, diff --git a/src/daemon/replay/internal/command-types.ts b/src/daemon/replay/internal/command-types.ts index 920fc5519e..630b7f84f6 100644 --- a/src/daemon/replay/internal/command-types.ts +++ b/src/daemon/replay/internal/command-types.ts @@ -1,5 +1,6 @@ import type { ReplayTestAttemptStepSink } from '@agent-device/replay-test'; -import type { DaemonInvokeFn, DaemonRequest, DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import type { ReplaySessionMutationStore as ReplaySessionMutationStoreCapability, ReplaySessionStore as ReplaySessionStoreCapability, diff --git a/src/daemon/replay/internal/native-command.ts b/src/daemon/replay/internal/native-command.ts index 681ec86941..703a8bcac4 100644 --- a/src/daemon/replay/internal/native-command.ts +++ b/src/daemon/replay/internal/native-command.ts @@ -1,5 +1,6 @@ import { asAppError } from '@agent-device/kernel/errors'; -import type { DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { errorResponse } from '../../response.ts'; import { runAdReplay } from '@agent-device/ad-replay'; import type { SnapshotTimingSample } from '@agent-device/contracts/capture'; diff --git a/src/daemon/replay/internal/session-replay-action-runtime.ts b/src/daemon/replay/internal/session-replay-action-runtime.ts index 618c99ea8e..65c39bcfbb 100644 --- a/src/daemon/replay/internal/session-replay-action-runtime.ts +++ b/src/daemon/replay/internal/session-replay-action-runtime.ts @@ -1,6 +1,6 @@ import type { SessionAction } from '@agent-device/contracts/session'; import type { CommandFlags } from '@agent-device/contracts/command'; -import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../../types.ts'; +import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; import { mergeParentFlags } from '../../../core/batch.ts'; import { AppError, normalizeError } from '@agent-device/kernel/errors'; import { diff --git a/src/daemon/replay/internal/session-replay-dispatch-narrowing.ts b/src/daemon/replay/internal/session-replay-dispatch-narrowing.ts index 59cbb25c1e..e8e5a10112 100644 --- a/src/daemon/replay/internal/session-replay-dispatch-narrowing.ts +++ b/src/daemon/replay/internal/session-replay-dispatch-narrowing.ts @@ -1,4 +1,4 @@ -import type { DaemonRequest, DaemonResponse } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; import type { AdReplayDispatchGuard, AdReplayDispatchOutcome, diff --git a/src/daemon/replay/internal/session-replay-divergence.ts b/src/daemon/replay/internal/session-replay-divergence.ts index 953ba65d35..5ff504265d 100644 --- a/src/daemon/replay/internal/session-replay-divergence.ts +++ b/src/daemon/replay/internal/session-replay-divergence.ts @@ -26,7 +26,7 @@ import { import { boundReplayDivergenceForSession } from './session-replay-divergence-publication.ts'; import type { ReplayReportAction } from './session-replay-report-action.ts'; import { rankAndDedupeReplaySuggestions } from './session-replay-suggestion-ranking.ts'; -import type { SessionState } from '../../types.ts'; +import type { SessionState } from '../../session-state.ts'; import { REPLAY_DIVERGENCE_SUGGESTION_LIMIT, createReplayDivergenceSanitizer, diff --git a/src/daemon/replay/internal/session-replay-maestro-failure.ts b/src/daemon/replay/internal/session-replay-maestro-failure.ts index dc9976e233..4e278be870 100644 --- a/src/daemon/replay/internal/session-replay-maestro-failure.ts +++ b/src/daemon/replay/internal/session-replay-maestro-failure.ts @@ -10,7 +10,8 @@ import { } from '@agent-device/contracts/divergence'; import { formatScriptArg } from '@agent-device/ad-script'; import { getRequestSignal } from '@agent-device/host-kit/request'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import type { ReplaySessionObservationStore, ReplaySessionStore } from './command-types.ts'; import type { ReplayReportAction } from './session-replay-report-action.ts'; import { rankAndDedupeReplaySuggestions } from './session-replay-suggestion-ranking.ts'; diff --git a/src/daemon/replay/internal/session-replay-maestro-response.ts b/src/daemon/replay/internal/session-replay-maestro-response.ts index d86d89ab4d..82bbf299c0 100644 --- a/src/daemon/replay/internal/session-replay-maestro-response.ts +++ b/src/daemon/replay/internal/session-replay-maestro-response.ts @@ -2,7 +2,7 @@ import type { ReplayCommandResult } from '@agent-device/contracts/replay'; import type { MaestroExecutionOutcome } from '@agent-device/maestro'; import { normalizeError } from '@agent-device/kernel/errors'; import { summarizeSnapshotTimingSamples } from '@agent-device/contracts/capture'; -import type { DaemonResponse } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; import { buildTypedMaestroFailureResponse } from './session-replay-maestro-failure.ts'; import type { ReplayCommand, ReplaySessionStore } from './command-types.ts'; diff --git a/src/daemon/replay/internal/session-replay-maestro-runtime.ts b/src/daemon/replay/internal/session-replay-maestro-runtime.ts index caa61ead7c..a086b502f4 100644 --- a/src/daemon/replay/internal/session-replay-maestro-runtime.ts +++ b/src/daemon/replay/internal/session-replay-maestro-runtime.ts @@ -18,7 +18,7 @@ import { } from '@agent-device/ad-script'; import { createDaemonMaestroRuntimePort } from '../../adapters/maestro/daemon-runtime-port.ts'; import type { DeviceInfo } from '@agent-device/kernel/device'; -import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../../types.ts'; +import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; import { assertSessionSelectorMatches } from '../../session-selector.ts'; import { errorResponse } from '../../response.ts'; import { buildReplayBuiltinVars } from './session-replay-vars.ts'; diff --git a/src/daemon/replay/internal/session-replay-runtime-artifacts.ts b/src/daemon/replay/internal/session-replay-runtime-artifacts.ts index bd7c0b549a..db820aae13 100644 --- a/src/daemon/replay/internal/session-replay-runtime-artifacts.ts +++ b/src/daemon/replay/internal/session-replay-runtime-artifacts.ts @@ -1,5 +1,5 @@ import fs from 'node:fs'; -import type { DaemonResponse } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; export function collectReplayActionArtifactPaths(response: DaemonResponse): string[] { const candidates = response.ok diff --git a/src/daemon/replay/internal/session-replay-runtime-engine-adapter.ts b/src/daemon/replay/internal/session-replay-runtime-engine-adapter.ts index 25ce4f9d44..c55bc1652e 100644 --- a/src/daemon/replay/internal/session-replay-runtime-engine-adapter.ts +++ b/src/daemon/replay/internal/session-replay-runtime-engine-adapter.ts @@ -1,5 +1,5 @@ import type { SessionAction } from '@agent-device/contracts/session'; -import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../../types.ts'; +import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; import { errorResponse } from '../../response.ts'; import { readReplaySelectorDisplayValue } from '@agent-device/selectors'; import type { ResponseLevel } from '@agent-device/kernel/contracts'; diff --git a/src/daemon/replay/internal/session-replay-runtime-failure-response.ts b/src/daemon/replay/internal/session-replay-runtime-failure-response.ts index d3bfd30d03..5279daf5e3 100644 --- a/src/daemon/replay/internal/session-replay-runtime-failure-response.ts +++ b/src/daemon/replay/internal/session-replay-runtime-failure-response.ts @@ -3,7 +3,7 @@ import { scrubReplayVarValues, type ReplayVarScrubEntry } from '@agent-device/co import { formatDivergenceActionLabel } from '@agent-device/ad-script'; import type { SnapshotDiagnosticsSummary } from '@agent-device/contracts/capture'; import { buildDisplayPositionals } from '../../session-event-action.ts'; -import type { DaemonResponse } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; export type ReplayFailureCause = Extract['error']; diff --git a/src/daemon/replay/internal/session-replay-runtime-failure.ts b/src/daemon/replay/internal/session-replay-runtime-failure.ts index ec3adb3bf3..6ff905dfdd 100644 --- a/src/daemon/replay/internal/session-replay-runtime-failure.ts +++ b/src/daemon/replay/internal/session-replay-runtime-failure.ts @@ -6,7 +6,7 @@ import { type SnapshotTimingSample, } from '@agent-device/contracts/capture'; import type { ReplayResumeStamper } from '../../session-replay-coordinator.ts'; -import type { DaemonRequest, DaemonResponse } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; import { buildReplayFailureDivergence } from './session-replay-divergence.ts'; import { buildReplayDivergenceFailureResponse, diff --git a/src/daemon/replay/internal/session-replay-runtime-plan.ts b/src/daemon/replay/internal/session-replay-runtime-plan.ts index 3f0809a8b6..20318f98b6 100644 --- a/src/daemon/replay/internal/session-replay-runtime-plan.ts +++ b/src/daemon/replay/internal/session-replay-runtime-plan.ts @@ -1,6 +1,7 @@ import type { SessionAction } from '@agent-device/contracts/session'; import type { CommandFlags } from '@agent-device/contracts/command'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import type { ReplayCoordinator } from '../../session-replay-coordinator.ts'; import type { ReplayCommand, ReplaySessionStore } from './command-types.ts'; import { errorResponse } from '../../response.ts'; diff --git a/src/daemon/replay/internal/session-replay-runtime-session.ts b/src/daemon/replay/internal/session-replay-runtime-session.ts index 0887699f20..e7cdb520ac 100644 --- a/src/daemon/replay/internal/session-replay-runtime-session.ts +++ b/src/daemon/replay/internal/session-replay-runtime-session.ts @@ -1,5 +1,5 @@ import fs from 'node:fs'; -import type { DaemonRequest, DaemonResponse } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; import type { ReplaySessionStore } from './command-types.ts'; import { expandSessionPath } from '../../session-paths.ts'; import { errorResponse, noActiveSessionError } from '../../response.ts'; diff --git a/src/daemon/replay/internal/session-replay-target-verification.ts b/src/daemon/replay/internal/session-replay-target-verification.ts index 9d1e34b581..2d98ef52de 100644 --- a/src/daemon/replay/internal/session-replay-target-verification.ts +++ b/src/daemon/replay/internal/session-replay-target-verification.ts @@ -30,7 +30,8 @@ import { } from '@agent-device/contracts/replay'; import { resolveTargetIdentityVerification } from '../../../core/command-descriptor/registry.ts'; import { parseWaitPositionals } from '../../../core/wait-positionals.ts'; -import type { DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import type { ReplayResumeStamper } from '../../session-replay-coordinator.ts'; import type { InternalObservationEvidence } from '../../internal-observation.ts'; import { boundedLocalIdentity } from '../../session-target-evidence.ts'; diff --git a/src/daemon/replay/internal/session-replay-vars.ts b/src/daemon/replay/internal/session-replay-vars.ts index 8611e09bc0..2fc328e711 100644 --- a/src/daemon/replay/internal/session-replay-vars.ts +++ b/src/daemon/replay/internal/session-replay-vars.ts @@ -1,5 +1,5 @@ import path from 'node:path'; -import type { DaemonRequest } from '../../types.ts'; +import type { DaemonRequest } from '../../daemon-request.ts'; import type { ReplayScriptMetadata } from '@agent-device/ad-script'; export function buildReplayBuiltinVars(params: { diff --git a/src/daemon/replay/internal/session-replay-video-recording.ts b/src/daemon/replay/internal/session-replay-video-recording.ts index 3fe2036920..7ef42e43c2 100644 --- a/src/daemon/replay/internal/session-replay-video-recording.ts +++ b/src/daemon/replay/internal/session-replay-video-recording.ts @@ -1,5 +1,5 @@ import path from 'node:path'; -import type { DaemonOpenLifecycle, DaemonRequest, DaemonResponse } from '../../types.ts'; +import type { DaemonOpenLifecycle, DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; import { emitDiagnostic } from '@agent-device/host-kit/diagnostics'; import { sleep } from '@agent-device/host-kit/retry'; diff --git a/src/daemon/replay/internal/session-test-infrastructure.ts b/src/daemon/replay/internal/session-test-infrastructure.ts index 0a9c81ff51..4e1c086048 100644 --- a/src/daemon/replay/internal/session-test-infrastructure.ts +++ b/src/daemon/replay/internal/session-test-infrastructure.ts @@ -1,5 +1,5 @@ import { isInfrastructureBootFailureReason } from '@agent-device/contracts/boot-failure'; -import type { DaemonResponse } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; import type { ReplaySuiteTestResult } from '@agent-device/contracts/replay'; import { isDeviceClaimConflictReason } from '../../device-claim-conflict.ts'; diff --git a/src/daemon/replay/internal/session-test-outcome.ts b/src/daemon/replay/internal/session-test-outcome.ts index 426ed38fba..1ce7843c0c 100644 --- a/src/daemon/replay/internal/session-test-outcome.ts +++ b/src/daemon/replay/internal/session-test-outcome.ts @@ -1,5 +1,5 @@ import { readSnapshotDiagnosticsSummary } from '@agent-device/contracts/capture'; -import type { DaemonResponse } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; import { isReplayInfrastructureFailure } from './session-test-infrastructure.ts'; import type { ReplayTestAttemptFailed, ReplayTestAttemptOutcome } from '@agent-device/replay-test'; diff --git a/src/daemon/replay/internal/test-command.ts b/src/daemon/replay/internal/test-command.ts index f635a8166e..1cc4c28ad3 100644 --- a/src/daemon/replay/internal/test-command.ts +++ b/src/daemon/replay/internal/test-command.ts @@ -6,7 +6,7 @@ import type { CommandFlags } from '@agent-device/contracts/command'; import type { ReplaySuiteResult, ReplayScriptSourceBundle } from '@agent-device/contracts/replay'; import { REPLAY_SCRIPT_SOURCE_REQUIRED_MESSAGE } from '../../replay-script-source.ts'; import type { ReplayScriptMetadata } from '@agent-device/ad-script'; -import type { DaemonRequest, DaemonResponse, DaemonResponseData } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse, DaemonResponseData } from '../../daemon-request.ts'; import { expandSessionPath } from '../../session-paths.ts'; import type { ReplayTestCommand } from './command-types.ts'; import { diff --git a/src/daemon/request-admission.ts b/src/daemon/request-admission.ts index c73ee17ed9..e57979140d 100644 --- a/src/daemon/request-admission.ts +++ b/src/daemon/request-admission.ts @@ -16,7 +16,8 @@ import { } from './lease-context.ts'; import { leaseScopeToHeartbeatRequest } from '../core/lease-scope.ts'; import type { LeaseRegistry } from './lease-registry.ts'; -import type { DaemonRequest, SessionState } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; +import type { SessionState } from './session-state.ts'; export function scopeRequestSession(req: DaemonRequest): DaemonRequest { const isolation = resolveSessionIsolationMode( diff --git a/src/daemon/request-binding.ts b/src/daemon/request-binding.ts index 216916743c..67a0102725 100644 --- a/src/daemon/request-binding.ts +++ b/src/daemon/request-binding.ts @@ -4,7 +4,8 @@ import { applyRequestLockPolicy } from './request-lock-policy.ts'; import { buildOpenTargetDeviceResolutionOptions } from './open-device-selection.ts'; import { buildReplayTargetDeviceResolution } from './replay-device-selection.ts'; import type { SessionStore } from './session-store.ts'; -import type { DaemonRequest, SessionRef } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; +import type { SessionRef } from './session-state.ts'; export type RequestExecutionLockKey = `session:${string}` | `device:${string}`; diff --git a/src/daemon/request-diagnostics-http.ts b/src/daemon/request-diagnostics-http.ts index 2282ccca71..fab73ea301 100644 --- a/src/daemon/request-diagnostics-http.ts +++ b/src/daemon/request-diagnostics-http.ts @@ -17,7 +17,7 @@ import fs from 'node:fs'; import http from 'node:http'; import { AppError, normalizeError, type DiagnosticsRecordRef } from '@agent-device/kernel/errors'; -import type { DaemonRequest } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; import { isSafeSessionSegment } from './session-paths.ts'; import { decodeUriSegment } from './http-request-target.ts'; import { isTenantOwnedSessionName } from './session-tenant-scope.ts'; diff --git a/src/daemon/request-execution-scope.ts b/src/daemon/request-execution-scope.ts index 57f3a83bdc..b6cc4852e6 100644 --- a/src/daemon/request-execution-scope.ts +++ b/src/daemon/request-execution-scope.ts @@ -42,7 +42,8 @@ import { resolveSessionRunnerLogPath, type SessionStore, } from './session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from './types.ts'; +import type { DaemonRequest, DaemonResponse } from './daemon-request.ts'; +import type { SessionState } from './session-state.ts'; import { teardownSessionResources } from './session-teardown.ts'; import { finalizeBoundSessionApplicationLifecycle } from './application-lifecycle-recovery.ts'; import { runtimeHintValues } from './session-runtime.ts'; diff --git a/src/daemon/request-finalization.ts b/src/daemon/request-finalization.ts index d2bad90c89..e55ad0cfec 100644 --- a/src/daemon/request-finalization.ts +++ b/src/daemon/request-finalization.ts @@ -5,7 +5,7 @@ import { flushDiagnosticsToSessionFile, getDiagnosticsMeta, } from '@agent-device/host-kit/diagnostics'; -import type { DaemonRequest, DaemonResponse, DaemonResponseData } from './types.ts'; +import type { DaemonRequest, DaemonResponse, DaemonResponseData } from './daemon-request.ts'; import type { DaemonArtifact, DaemonArtifactType } from '@agent-device/kernel/contracts'; export function finalizeDaemonResponse( diff --git a/src/daemon/request-generic-dispatch.ts b/src/daemon/request-generic-dispatch.ts index b31ee868fe..7ef33a765c 100644 --- a/src/daemon/request-generic-dispatch.ts +++ b/src/daemon/request-generic-dispatch.ts @@ -3,7 +3,8 @@ import type { SettleObservation } from '@agent-device/contracts/interaction'; import { commandSupportsSettleObservation } from '../core/command-descriptor/registry.ts'; import type { SessionStore } from './session-store.ts'; import type { DaemonCommandContext } from './context.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from './types.ts'; +import type { DaemonRequest, DaemonResponse } from './daemon-request.ts'; +import type { SessionState } from './session-state.ts'; import { ensureAndroidBlockingSystemDialogReady, recoverAndroidBlockingSystemDialog, diff --git a/src/daemon/request-handler-chain.ts b/src/daemon/request-handler-chain.ts index 9fc78cbac8..3842877b81 100644 --- a/src/daemon/request-handler-chain.ts +++ b/src/daemon/request-handler-chain.ts @@ -8,7 +8,7 @@ import type { DaemonCommandContext } from './context.ts'; import type { LeaseLifecycleProvider, ProviderAppCatalog } from '@agent-device/contracts/device'; import type { LeaseRegistry } from './lease-registry.ts'; import type { SessionStore } from './session-store.ts'; -import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from './types.ts'; +import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from './daemon-request.ts'; import type { BindDeviceRuntime, BindExactDeviceRuntime, diff --git a/src/daemon/request-lock-policy.ts b/src/daemon/request-lock-policy.ts index 616386d16b..c3b85a7089 100644 --- a/src/daemon/request-lock-policy.ts +++ b/src/daemon/request-lock-policy.ts @@ -1,6 +1,7 @@ import type { CommandFlags } from '@agent-device/contracts/command'; import { AppError } from '@agent-device/kernel/errors'; -import type { SessionRef, SessionState, DaemonRequest } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; +import type { SessionRef, SessionState } from './session-state.ts'; import { formatSessionSelectorConflict, listSessionSelectorConflicts, diff --git a/src/daemon/request-platform-provider-context.ts b/src/daemon/request-platform-provider-context.ts index bd260a911a..e710f8fd81 100644 --- a/src/daemon/request-platform-provider-context.ts +++ b/src/daemon/request-platform-provider-context.ts @@ -3,7 +3,8 @@ import { resolveTargetDevice } from '../core/dispatch-resolve.ts'; import { hasDeviceSelectionInput, hasExplicitDeviceSelector } from './device-selector-intent.ts'; import { buildOpenTargetDeviceResolutionOptions } from './open-device-selection.ts'; import { resolveProviderDeviceResolutionIntent } from './daemon-command-registry.ts'; -import type { DaemonRequest, SessionState } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; +import type { SessionState } from './session-state.ts'; /** * Resolves the daemon-owned part of the request-provider seam. diff --git a/src/daemon/request-progress-protocol.ts b/src/daemon/request-progress-protocol.ts index adbeaee3b3..692e292023 100644 --- a/src/daemon/request-progress-protocol.ts +++ b/src/daemon/request-progress-protocol.ts @@ -1,5 +1,5 @@ import type { RequestProgressEvent } from '@agent-device/contracts/progress'; -import type { DaemonRequest, DaemonResponse } from './types.ts'; +import type { DaemonRequest, DaemonResponse } from './daemon-request.ts'; export type DaemonProgressEnvelope = { type: 'progress'; diff --git a/src/daemon/request-recording-health.ts b/src/daemon/request-recording-health.ts index c00a1ed6ec..a22b5e1013 100644 --- a/src/daemon/request-recording-health.ts +++ b/src/daemon/request-recording-health.ts @@ -1,6 +1,6 @@ import { isIosFamily } from '@agent-device/kernel/device'; import { inspectAppleRunnerSession } from '../platform-runtime-apple-resources.ts'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; export async function refreshRecordingHealth(session: SessionState): Promise { if (!recordingRequiresRunnerHealth(session)) { diff --git a/src/daemon/request-router.ts b/src/daemon/request-router.ts index c124296726..377b8f0c13 100644 --- a/src/daemon/request-router.ts +++ b/src/daemon/request-router.ts @@ -17,7 +17,12 @@ import type { RequestPlatformProviderScope, RequestPlatformProviders, } from '@agent-device/contracts/platform-providers'; -import type { DaemonInvokeFn, DaemonRequest, DaemonResponse, DaemonResponseData } from './types.ts'; +import type { + DaemonInvokeFn, + DaemonRequest, + DaemonResponse, + DaemonResponseData, +} from './daemon-request.ts'; import { RESPONSE_VIEWS } from './response-views.ts'; import { SessionStore } from './session-store.ts'; import { errorResponse, noActiveSessionError } from './response.ts'; diff --git a/src/daemon/request-save-script-policy.ts b/src/daemon/request-save-script-policy.ts index a5d133d060..4c6d2c272c 100644 --- a/src/daemon/request-save-script-policy.ts +++ b/src/daemon/request-save-script-policy.ts @@ -5,7 +5,7 @@ import { getDiagnosticsMeta, } from '@agent-device/host-kit/diagnostics'; import { listSaveScriptFlagOwnerCommands, ownsSaveScriptFlag } from './daemon-command-registry.ts'; -import type { DaemonRequest, DaemonResponse } from './types.ts'; +import type { DaemonRequest, DaemonResponse } from './daemon-request.ts'; /** * #1478: the released `--save-script` flag owners, read from the command diff --git a/src/daemon/response-views.ts b/src/daemon/response-views.ts index bed06ee204..42435ec61e 100644 --- a/src/daemon/response-views.ts +++ b/src/daemon/response-views.ts @@ -1,6 +1,6 @@ import type { ResponseLevel } from '@agent-device/kernel/contracts'; import type { ScreenshotOverlayRef, SnapshotNode } from '@agent-device/kernel/snapshot'; -import type { DaemonResponseData } from './types.ts'; +import type { DaemonResponseData } from './daemon-request.ts'; /** * Phase 4 leveled response views. A view maps a command's `default` result data diff --git a/src/daemon/response.ts b/src/daemon/response.ts index ba43b48b6e..3480e9eb4c 100644 --- a/src/daemon/response.ts +++ b/src/daemon/response.ts @@ -1,4 +1,4 @@ -import type { DaemonResponse } from './types.ts'; +import type { DaemonResponse } from './daemon-request.ts'; export type DaemonFailureResponse = Extract; diff --git a/src/daemon/runtime-session.ts b/src/daemon/runtime-session.ts index 5d494faf0e..372c731ba3 100644 --- a/src/daemon/runtime-session.ts +++ b/src/daemon/runtime-session.ts @@ -1,7 +1,7 @@ import type { CommandSessionRecord, CommandSessionStore } from '../runtime-contract.ts'; import { emitDiagnostic } from '@agent-device/host-kit/diagnostics'; import { refFrameTree } from './ref-frame.ts'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; export type RuntimeSessionRecordOptions = { includeSnapshot?: boolean; diff --git a/src/daemon/screen-recording-session-resource.ts b/src/daemon/screen-recording-session-resource.ts index 9ff7d49b2e..0b4c5129c4 100644 --- a/src/daemon/screen-recording-session-resource.ts +++ b/src/daemon/screen-recording-session-resource.ts @@ -15,7 +15,7 @@ import { createDurableCaptureResource } from './durable-capture-resource.ts'; import type { ScreenRecordingAdmissionLedger } from './screen-recording-admission-ledger.ts'; import { screenRecordingResourceStore } from './screen-recording-resource-store.ts'; import type { SessionStore } from './session-store.ts'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; export const screenRecordingDurableResource = createDurableCaptureResource< 'screen-recording', diff --git a/src/daemon/screenshot-crop.ts b/src/daemon/screenshot-crop.ts index 2d0a5a02d9..8c4bfee3b1 100644 --- a/src/daemon/screenshot-crop.ts +++ b/src/daemon/screenshot-crop.ts @@ -19,7 +19,7 @@ import type { DaemonCommandContext } from './context.ts'; import { captureSnapshotData } from './snapshot-capture.ts'; import { runtimeExecutionFromContext } from './snapshot-runtime-capture-input.ts'; import type { BoundScreenshotRuntime } from './screenshot-runtime-binding.ts'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; export type ScreenshotCropOutcome = Readonly<{ partialIntersection: boolean }>; diff --git a/src/daemon/screenshot-runtime-binding.ts b/src/daemon/screenshot-runtime-binding.ts index 030ccf6d04..8d951231b7 100644 --- a/src/daemon/screenshot-runtime-binding.ts +++ b/src/daemon/screenshot-runtime-binding.ts @@ -22,7 +22,7 @@ import { type AdmittedRuntimePlan, } from './session-runtime-admission.ts'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from './request-runtime-binding.ts'; -import type { DaemonResponse } from './types.ts'; +import type { DaemonResponse } from './daemon-request.ts'; export type ScreenshotRuntimeBindings = Readonly<{ inspectFacts?: InspectDeviceRuntimeFacts; diff --git a/src/daemon/screenshot-runtime.ts b/src/daemon/screenshot-runtime.ts index 220d0313dd..1ea7f17949 100644 --- a/src/daemon/screenshot-runtime.ts +++ b/src/daemon/screenshot-runtime.ts @@ -37,7 +37,8 @@ import { } from './screenshot-runtime-binding.ts'; import { setSessionSnapshot } from './session-snapshot.ts'; import { SessionStore } from './session-store.ts'; -import type { DaemonRequest, SessionState } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; +import type { SessionState } from './session-state.ts'; /** * The `screenshot` leaf of the generic route. Argument policy is answered before any device work, diff --git a/src/daemon/selector-capture-binding.ts b/src/daemon/selector-capture-binding.ts index df6b024586..e3a74ee502 100644 --- a/src/daemon/selector-capture-binding.ts +++ b/src/daemon/selector-capture-binding.ts @@ -10,7 +10,8 @@ import type { } from '@agent-device/contracts/snapshot-runtime'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from './request-runtime-binding.ts'; import { admitAndBindSnapshotCapture } from './snapshot-runtime-binding.ts'; -import type { DaemonResponse, SessionState } from './types.ts'; +import type { DaemonResponse } from './daemon-request.ts'; +import type { SessionState } from './session-state.ts'; /** The selector commands that resolve their targets from the shared request-bound capture seam. */ export type SelectorCaptureCommand = 'find' | 'get' | 'is' | 'wait'; diff --git a/src/daemon/selector-capture-runtime.ts b/src/daemon/selector-capture-runtime.ts index 28dca84a5c..28eeb22e31 100644 --- a/src/daemon/selector-capture-runtime.ts +++ b/src/daemon/selector-capture-runtime.ts @@ -6,7 +6,8 @@ import { type SnapshotState, } from '@agent-device/kernel/snapshot'; import { isSparseSnapshotQualityVerdict } from '@agent-device/capture-kit/snapshot-quality-verdict'; -import type { DaemonRequest, SessionState } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; +import type { SessionState } from './session-state.ts'; import { SessionStore } from './session-store.ts'; import { captureSnapshot } from './snapshot-capture.ts'; import { setSessionSnapshot } from './session-snapshot.ts'; diff --git a/src/daemon/selector-match-errors.ts b/src/daemon/selector-match-errors.ts index f47cb0177b..0ea915981c 100644 --- a/src/daemon/selector-match-errors.ts +++ b/src/daemon/selector-match-errors.ts @@ -2,7 +2,7 @@ import type { FindLocator } from '@agent-device/selectors'; import type { SnapshotState } from '@agent-device/kernel/snapshot'; import { formatSnapshotLine } from '../snapshot/snapshot-lines.ts'; import type { ElementMatchCandidateDetails } from '@agent-device/kernel/errors'; -import type { DaemonResponse } from './types.ts'; +import type { DaemonResponse } from './daemon-request.ts'; import { errorResponse } from './response.ts'; // #1597: an agent reading an ambiguous-match error must be able to act on the diff --git a/src/daemon/selector-recording.ts b/src/daemon/selector-recording.ts index 43c415ed1a..292d9a5ea7 100644 --- a/src/daemon/selector-recording.ts +++ b/src/daemon/selector-recording.ts @@ -1,4 +1,4 @@ -import type { DaemonRequest } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import type { FindReadResult } from '@agent-device/contracts/interaction'; import { stripAndroidSystemChromeProvenanceFromNode } from '@agent-device/contracts/android-system-chrome'; diff --git a/src/daemon/selector-runtime-backend.test.ts b/src/daemon/selector-runtime-backend.test.ts index 08f6f6eeb6..20be9ff764 100644 --- a/src/daemon/selector-runtime-backend.test.ts +++ b/src/daemon/selector-runtime-backend.test.ts @@ -6,7 +6,7 @@ import type { } from '@agent-device/contracts/snapshot-runtime'; import { createSelectorRuntimeForDevice } from './selector-runtime-backend.ts'; import { SessionStore } from './session-store.ts'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; import { mkdtempForTestSync } from '../__tests__/test-utils/tmp-dir.ts'; import { makeSnapshotState } from '../__tests__/test-utils/snapshot-builders.ts'; diff --git a/src/daemon/selector-runtime-backend.ts b/src/daemon/selector-runtime-backend.ts index 8f2905186b..dc948107d4 100644 --- a/src/daemon/selector-runtime-backend.ts +++ b/src/daemon/selector-runtime-backend.ts @@ -14,7 +14,8 @@ import { contextFromFlags, type BoundContextFromFlags } from './context.ts'; import { readTextForNode } from './selector-text-runtime.ts'; import { setSessionSnapshot } from './session-snapshot.ts'; import { SessionStore } from './session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from './types.ts'; +import type { DaemonRequest, DaemonResponse } from './daemon-request.ts'; +import type { SessionState } from './session-state.ts'; import { createSelectorCaptureRuntime } from './selector-capture-runtime.ts'; import { buildRuntimeCaptureInput } from './snapshot-runtime-capture-input.ts'; import { diff --git a/src/daemon/selector-runtime.ts b/src/daemon/selector-runtime.ts index 3f17c8b51b..2e5c207f79 100644 --- a/src/daemon/selector-runtime.ts +++ b/src/daemon/selector-runtime.ts @@ -2,7 +2,7 @@ import { asAppError } from '@agent-device/kernel/errors'; import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { absenceCaptureOptionError } from '../core/absence-observation-errors.ts'; import { absenceCaptureOptionRefusal } from '../core/absence-observation.ts'; -import type { DaemonRequest, DaemonResponse } from './types.ts'; +import type { DaemonRequest, DaemonResponse } from './daemon-request.ts'; import { errorResponse } from './response.ts'; import { markSessionPartialRefsIssued, resolveRefStalenessWarning } from './session-snapshot.ts'; import { diff --git a/src/daemon/server/daemon-idle-reap.test.ts b/src/daemon/server/daemon-idle-reap.test.ts index 77de7a5341..2efee9bd79 100644 --- a/src/daemon/server/daemon-idle-reap.test.ts +++ b/src/daemon/server/daemon-idle-reap.test.ts @@ -4,7 +4,7 @@ import path from 'node:path'; import { afterEach, beforeEach, test, vi } from 'vitest'; import { makeIosSession } from '../../__tests__/test-utils/session-factories.ts'; import { SessionStore } from '../session-store.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; import { createDaemonIdleReap, hasActiveRecording, diff --git a/src/daemon/server/daemon-idle-reap.ts b/src/daemon/server/daemon-idle-reap.ts index 8cf63cfb62..a3300f8d46 100644 --- a/src/daemon/server/daemon-idle-reap.ts +++ b/src/daemon/server/daemon-idle-reap.ts @@ -1,6 +1,6 @@ import { emitDiagnostic } from '@agent-device/host-kit/diagnostics'; import type { SessionStore } from '../session-store.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; import { isUncommittedRepairSession } from '../session-replay-transaction.ts'; // Bounds the daemon's own lifetime when nothing is using it. Each diff --git a/src/daemon/server/daemon-runtime-device-claims.test.ts b/src/daemon/server/daemon-runtime-device-claims.test.ts index 60894e7fcb..97586767cc 100644 --- a/src/daemon/server/daemon-runtime-device-claims.test.ts +++ b/src/daemon/server/daemon-runtime-device-claims.test.ts @@ -14,7 +14,7 @@ vi.mock('../session-teardown.ts', async (importOriginal) => { import { SessionStore } from '../session-store.ts'; import { teardownSessionResources } from '../session-teardown.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; import { teardownDaemonSessionForShutdown } from './daemon-runtime.ts'; const mockTeardownSessionResources = vi.mocked(teardownSessionResources); diff --git a/src/daemon/server/daemon-runtime.ts b/src/daemon/server/daemon-runtime.ts index f48fa4dcd6..c9ec4512f4 100644 --- a/src/daemon/server/daemon-runtime.ts +++ b/src/daemon/server/daemon-runtime.ts @@ -25,7 +25,8 @@ import { resolveDaemonSessionTeardownTimeoutMs } from '../session-teardown-budge import { finalizeDaemonSessionApplicationLifecycle } from '../application-lifecycle-recovery.ts'; import { runtimeHintValues } from '../session-runtime.ts'; import { closeDaemonServers } from './server-shutdown.ts'; -import type { DaemonInvokeFn, SessionState } from '../types.ts'; +import type { DaemonInvokeFn } from '../daemon-request.ts'; +import type { SessionState } from '../session-state.ts'; import { createDaemonIdleReap } from './daemon-idle-reap.ts'; import { finalizeDaemonSessionLease } from './daemon-session-lease-finalizer.ts'; import { diff --git a/src/daemon/server/daemon-session-lease-finalizer.ts b/src/daemon/server/daemon-session-lease-finalizer.ts index ee01e540ce..ee50776e7f 100644 --- a/src/daemon/server/daemon-session-lease-finalizer.ts +++ b/src/daemon/server/daemon-session-lease-finalizer.ts @@ -2,7 +2,7 @@ import { leaseScopeToReleaseRequest } from '../../core/lease-scope.ts'; import { emitDiagnostic } from '@agent-device/host-kit/diagnostics'; import type { ExpiredProviderLeaseReleaser } from '../provider-lease-expiry.ts'; import type { LeaseRegistry } from '../lease-registry.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; export async function finalizeDaemonSessionLease(params: { session: SessionState; diff --git a/src/daemon/server/daemon-shutdown-claims.test.ts b/src/daemon/server/daemon-shutdown-claims.test.ts index 36796f0ecb..46a7a9219a 100644 --- a/src/daemon/server/daemon-shutdown-claims.test.ts +++ b/src/daemon/server/daemon-shutdown-claims.test.ts @@ -9,7 +9,7 @@ import { acquireDeviceClaim } from '../device-claims.ts'; import { resolveDeviceClaimPath } from '../device-claim-paths.ts'; import { inspectDeviceClaims } from '../device-claim-inspection.ts'; import { createDaemonShutdownClaimLedger } from './daemon-shutdown-claims.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; const setup = isolatedDeviceClaimStores('agent-device-shutdown-claim-ledger-'); diff --git a/src/daemon/server/daemon-shutdown-claims.ts b/src/daemon/server/daemon-shutdown-claims.ts index 126aab4b1a..274f3ac314 100644 --- a/src/daemon/server/daemon-shutdown-claims.ts +++ b/src/daemon/server/daemon-shutdown-claims.ts @@ -2,7 +2,7 @@ import { publicPlatformString } from '@agent-device/kernel/device'; import { emitDiagnostic } from '@agent-device/host-kit/diagnostics'; import { clearDeviceClaim, type DeviceClaimClearOutcome } from '../device-claims.ts'; import type { DeviceClaimRecord } from '../daemon-shutdown-report.ts'; -import type { SessionState } from '../types.ts'; +import type { SessionState } from '../session-state.ts'; export type DaemonShutdownClaims = { released: DeviceClaimRecord[]; diff --git a/src/daemon/server/http-server.ts b/src/daemon/server/http-server.ts index 008b4a4b3b..67a250f535 100644 --- a/src/daemon/server/http-server.ts +++ b/src/daemon/server/http-server.ts @@ -15,7 +15,8 @@ import type { LeaseBackend, } from '@agent-device/kernel/contracts'; import { commandRpcParamsSchema } from '@agent-device/kernel/contracts'; -import type { DaemonInstallSource, DaemonInvokeFn, DaemonRequest } from '../types.ts'; +import type { DaemonInstallSource } from '../daemon-request-wire.ts'; +import type { DaemonInvokeFn, DaemonRequest } from '../daemon-request.ts'; import { normalizeTenantId } from '../config.ts'; import { clearRequestAbortRegistration, diff --git a/src/daemon/server/transport.ts b/src/daemon/server/transport.ts index 57025767d1..cf09fa6528 100644 --- a/src/daemon/server/transport.ts +++ b/src/daemon/server/transport.ts @@ -1,7 +1,7 @@ import { AppError, normalizeError, createRequestCanceledError } from '@agent-device/kernel/errors'; import net from 'node:net'; import type { Server as HttpServer } from 'node:http'; -import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../types.ts'; +import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../daemon-request.ts'; import { clearRequestAbortRegistration, isRequestCanceled, diff --git a/src/daemon/session-action-recorder.ts b/src/daemon/session-action-recorder.ts index 977d0051d8..3e721577f0 100644 --- a/src/daemon/session-action-recorder.ts +++ b/src/daemon/session-action-recorder.ts @@ -2,7 +2,8 @@ import type { SessionAction } from '@agent-device/contracts/session'; import type { CommandFlags } from '@agent-device/contracts/command'; import { SCREENSHOT_ACTION_FLAG_KEYS } from '@agent-device/contracts/capture'; import { emitDiagnostic } from '@agent-device/host-kit/diagnostics'; -import type { DaemonRequest, SessionRuntimeHints, SessionState } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; +import type { SessionRuntimeHints, SessionState } from './session-state.ts'; import { applyRecordedSaveScriptFlags } from './session-script-publication-capability.ts'; import { repairSessionBoundary } from './session-replay-transaction.ts'; import type { MultiTargetAnnotationV1, TargetAnnotationV1 } from '@agent-device/contracts/replay'; diff --git a/src/daemon/session-device-resolution.ts b/src/daemon/session-device-resolution.ts index 9e469cfbec..b4e142b5ce 100644 --- a/src/daemon/session-device-resolution.ts +++ b/src/daemon/session-device-resolution.ts @@ -3,7 +3,8 @@ import { AppError } from '@agent-device/kernel/errors'; import { isActiveProviderDevice } from '../provider-device-runtime.ts'; import { inspectAppleRunnerSession } from '../platform-runtime-apple-resources.ts'; import { resolveTargetDevice } from '../core/dispatch-resolve.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from './types.ts'; +import type { DaemonRequest, DaemonResponse } from './daemon-request.ts'; +import type { SessionState } from './session-state.ts'; import { hasDeviceSelectionInput, hasExplicitDeviceSelector } from './device-selector-intent.ts'; import { listSessionSelectorConflicts } from './session-selector.ts'; import { errorResponse } from './response.ts'; diff --git a/src/daemon/session-event-action-presentation.ts b/src/daemon/session-event-action-presentation.ts index efe3dd69cf..370775345d 100644 --- a/src/daemon/session-event-action-presentation.ts +++ b/src/daemon/session-event-action-presentation.ts @@ -14,7 +14,7 @@ import { readSessionEventNumber, readSessionEventString, } from './session-event-request.ts'; -import type { DaemonRequest } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; const SCROLL_DIRECTIONS = ['up', 'down', 'left', 'right'] as const; const SCROLL_EDGES = ['top', 'bottom'] as const; diff --git a/src/daemon/session-event-log.ts b/src/daemon/session-event-log.ts index d81793c5d7..60de4c9982 100644 --- a/src/daemon/session-event-log.ts +++ b/src/daemon/session-event-log.ts @@ -6,7 +6,7 @@ import { AppError } from '@agent-device/kernel/errors'; import { redactDiagnosticData } from '@agent-device/kernel/redaction'; import { emitDiagnostic, getDiagnosticsMeta } from '@agent-device/host-kit/diagnostics'; import { isRecord } from '@agent-device/kernel/record'; -import type { DaemonRequest, DaemonResponse } from './types.ts'; +import type { DaemonRequest, DaemonResponse } from './daemon-request.ts'; import { buildActionDetails, buildActionSummary } from './session-event-action.ts'; import { buildRequestSuccessEventPresentation } from './session-event-request.ts'; import { scanEventLogLines } from './session-event-log-lines.ts'; diff --git a/src/daemon/session-event-request.ts b/src/daemon/session-event-request.ts index f3c5b8be3c..870a2bc3f0 100644 --- a/src/daemon/session-event-request.ts +++ b/src/daemon/session-event-request.ts @@ -1,6 +1,6 @@ import { PUBLIC_COMMANDS } from '../command-catalog.ts'; import { isRecord } from '@agent-device/kernel/record'; -import type { DaemonRequest, DaemonResponseData } from './types.ts'; +import type { DaemonRequest, DaemonResponseData } from './daemon-request.ts'; const EVENT_LIST_PREVIEW_LIMIT = 5; const EVENT_LIST_SUMMARY_LIMIT = 3; diff --git a/src/daemon/session-lifecycle/__tests__/application.test.ts b/src/daemon/session-lifecycle/__tests__/application.test.ts index 9d442336a0..8906291384 100644 --- a/src/daemon/session-lifecycle/__tests__/application.test.ts +++ b/src/daemon/session-lifecycle/__tests__/application.test.ts @@ -1,5 +1,5 @@ import { beforeEach, expect, test, vi } from 'vitest'; -import type { DaemonRequest, DaemonResponse } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; import { makeSessionStore } from '../../../__tests__/test-utils/store-factory.ts'; vi.mock('../../../request/device-inventory-context.ts', async (importOriginal) => { diff --git a/src/daemon/session-lifecycle/internal/__tests__/session-close-lifecycle-runtime.test.ts b/src/daemon/session-lifecycle/internal/__tests__/session-close-lifecycle-runtime.test.ts index a63f9e9481..a7028898d2 100644 --- a/src/daemon/session-lifecycle/internal/__tests__/session-close-lifecycle-runtime.test.ts +++ b/src/daemon/session-lifecycle/internal/__tests__/session-close-lifecycle-runtime.test.ts @@ -2,7 +2,8 @@ import { beforeEach, expect, test, vi } from 'vitest'; import os from 'node:os'; import path from 'node:path'; import { SessionStore } from '../../../session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../../daemon-request.ts'; +import type { SessionState } from '../../../session-state.ts'; import { activateCompleteRefFrame, readSessionRuntimeRevision, diff --git a/src/daemon/session-lifecycle/internal/__tests__/session-close-script.test.ts b/src/daemon/session-lifecycle/internal/__tests__/session-close-script.test.ts index b7fd6a3161..ec2b9a1aac 100644 --- a/src/daemon/session-lifecycle/internal/__tests__/session-close-script.test.ts +++ b/src/daemon/session-lifecycle/internal/__tests__/session-close-script.test.ts @@ -8,7 +8,7 @@ import { makeRepairCompleteSession, } from '../../../../__tests__/test-utils/session-factories.ts'; import { SessionStore } from '../../../session-store.ts'; -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; import { buildRetriableRepairCloseFailureResponse, commitRepairScriptBeforeClose, diff --git a/src/daemon/session-lifecycle/internal/__tests__/session-close-shutdown.fixtures.ts b/src/daemon/session-lifecycle/internal/__tests__/session-close-shutdown.fixtures.ts index ede2a18fbc..8b241646f7 100644 --- a/src/daemon/session-lifecycle/internal/__tests__/session-close-shutdown.fixtures.ts +++ b/src/daemon/session-lifecycle/internal/__tests__/session-close-shutdown.fixtures.ts @@ -3,7 +3,8 @@ import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { SessionStore } from '../../../session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../../daemon-request.ts'; +import type { SessionState } from '../../../session-state.ts'; import { AppError } from '@agent-device/kernel/errors'; import { mkdtempForTestSync } from '../../../../__tests__/test-utils/tmp-dir.ts'; diff --git a/src/daemon/session-lifecycle/internal/__tests__/session-devices-batch-runtime.test.ts b/src/daemon/session-lifecycle/internal/__tests__/session-devices-batch-runtime.test.ts index 506ac15b1d..51b72d0179 100644 --- a/src/daemon/session-lifecycle/internal/__tests__/session-devices-batch-runtime.test.ts +++ b/src/daemon/session-lifecycle/internal/__tests__/session-devices-batch-runtime.test.ts @@ -18,7 +18,7 @@ import { handleReleaseMaterializedPathsCommand } from '../../../handlers/session import { handleSessionCommands } from '../../../handlers/__tests__/session-command-harness.ts'; import { makeSessionStore } from '../../../../__tests__/test-utils/store-factory.ts'; import { makeSession } from '../../../../__tests__/test-utils/session-factories.ts'; -import type { DaemonRequest, DaemonResponse } from '../../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../../daemon-request.ts'; import { mkdtempForTestSync } from '../../../../__tests__/test-utils/tmp-dir.ts'; import { withTestDeviceInventory } from '../../../../__tests__/test-utils/device-inventory-gateways.ts'; import type { DeviceInfo } from '@agent-device/kernel/device'; diff --git a/src/daemon/session-lifecycle/internal/__tests__/session-inventory-appleos.test.ts b/src/daemon/session-lifecycle/internal/__tests__/session-inventory-appleos.test.ts index 376876e187..29dca832b9 100644 --- a/src/daemon/session-lifecycle/internal/__tests__/session-inventory-appleos.test.ts +++ b/src/daemon/session-lifecycle/internal/__tests__/session-inventory-appleos.test.ts @@ -12,7 +12,7 @@ vi.mock('../../../../request/device-inventory-context.ts', async (importOriginal import { handleSessionInventoryCommands } from '../inventory.ts'; import { listDeviceInventory } from '../../../../request/device-inventory-context.ts'; import { makeSessionStore } from '../../../../__tests__/test-utils/store-factory.ts'; -import type { DaemonRequest, DaemonResponse } from '../../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../../daemon-request.ts'; import type { AppleOS, DeviceInfo } from '@agent-device/kernel/device'; import { AppError } from '@agent-device/kernel/errors'; import { diff --git a/src/daemon/session-lifecycle/internal/__tests__/session-inventory-apps-runtime.test.ts b/src/daemon/session-lifecycle/internal/__tests__/session-inventory-apps-runtime.test.ts index f45a41f00f..9e54b04cb9 100644 --- a/src/daemon/session-lifecycle/internal/__tests__/session-inventory-apps-runtime.test.ts +++ b/src/daemon/session-lifecycle/internal/__tests__/session-inventory-apps-runtime.test.ts @@ -1,5 +1,5 @@ import { beforeEach, expect, test, vi } from 'vitest'; -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; import { makeSession, makeSessionStore } from '../../../handlers/__tests__/session-test-harness.ts'; import { handleSessionInventoryCommands } from '../inventory.ts'; import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; diff --git a/src/daemon/session-lifecycle/internal/__tests__/session-inventory-harmonyos.test.ts b/src/daemon/session-lifecycle/internal/__tests__/session-inventory-harmonyos.test.ts index 61014e3a21..9ef2745297 100644 --- a/src/daemon/session-lifecycle/internal/__tests__/session-inventory-harmonyos.test.ts +++ b/src/daemon/session-lifecycle/internal/__tests__/session-inventory-harmonyos.test.ts @@ -1,5 +1,5 @@ import { beforeEach, expect, test, vi } from 'vitest'; -import type { DaemonRequest, DaemonResponse } from '../../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../../daemon-request.ts'; import { makeSession, makeSessionStore } from '../../../handlers/__tests__/session-test-harness.ts'; import { handleSessionInventoryCommands } from '../inventory.ts'; import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; diff --git a/src/daemon/session-lifecycle/internal/__tests__/session-inventory-scoped-paths.test.ts b/src/daemon/session-lifecycle/internal/__tests__/session-inventory-scoped-paths.test.ts index 0fceb1baff..824e0758b3 100644 --- a/src/daemon/session-lifecycle/internal/__tests__/session-inventory-scoped-paths.test.ts +++ b/src/daemon/session-lifecycle/internal/__tests__/session-inventory-scoped-paths.test.ts @@ -2,7 +2,8 @@ import { test, expect } from 'vitest'; import path from 'node:path'; import { handleSessionInventoryCommands } from '../inventory.ts'; import { makeSessionStore } from '../../../../__tests__/test-utils/store-factory.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../../daemon-request.ts'; +import type { SessionState } from '../../../session-state.ts'; import { IOS_SIMULATOR } from '../../../../__tests__/test-utils/device-fixtures.ts'; import { resolveImplicitSessionScope } from '../../../session-routing.ts'; import { tenantScopedSessionName } from '../../../session-tenant-scope.ts'; diff --git a/src/daemon/session-lifecycle/internal/__tests__/session-open-device-in-use.test.ts b/src/daemon/session-lifecycle/internal/__tests__/session-open-device-in-use.test.ts index 3553224031..63c0988786 100644 --- a/src/daemon/session-lifecycle/internal/__tests__/session-open-device-in-use.test.ts +++ b/src/daemon/session-lifecycle/internal/__tests__/session-open-device-in-use.test.ts @@ -1,6 +1,6 @@ import { test, expect } from 'vitest'; import { buildDeviceInUseBySessionError } from '../../../session-recovery-hints.ts'; -import type { SessionRef } from '../../../types.ts'; +import type { SessionRef } from '../../../session-state.ts'; import { IOS_SIMULATOR } from '../../../../__tests__/test-utils/device-fixtures.ts'; // DEVICE_IN_USE named `SessionState.name`, and for an implicitly cwd-scoped session that is diff --git a/src/daemon/session-lifecycle/internal/__tests__/session-open-execution-runtime.test.ts b/src/daemon/session-lifecycle/internal/__tests__/session-open-execution-runtime.test.ts index cf9b65b9ee..c9fbcb0245 100644 --- a/src/daemon/session-lifecycle/internal/__tests__/session-open-execution-runtime.test.ts +++ b/src/daemon/session-lifecycle/internal/__tests__/session-open-execution-runtime.test.ts @@ -1,7 +1,7 @@ import { test, expect, vi, beforeEach } from 'vitest'; import os from 'node:os'; import path from 'node:path'; -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; import { AppError } from '@agent-device/kernel/errors'; const mockResolveTargetDevice = vi.hoisted(() => vi.fn()); diff --git a/src/daemon/session-lifecycle/internal/__tests__/session-open-existing.test.ts b/src/daemon/session-lifecycle/internal/__tests__/session-open-existing.test.ts index 21fe520c55..0566831d08 100644 --- a/src/daemon/session-lifecycle/internal/__tests__/session-open-existing.test.ts +++ b/src/daemon/session-lifecycle/internal/__tests__/session-open-existing.test.ts @@ -14,7 +14,7 @@ import { assertInvalidArgsMessage, withMockedPlatform, } from '../../../handlers/__tests__/session-test-harness.ts'; -import type { SessionState } from '../../../types.ts'; +import type { SessionState } from '../../../session-state.ts'; import { handleSessionCommands } from '../../../handlers/__tests__/session-command-harness.ts'; test('open web URL on iOS device session without active app falls back to Safari', async () => { diff --git a/src/daemon/session-lifecycle/internal/__tests__/session-open-foreground.test.ts b/src/daemon/session-lifecycle/internal/__tests__/session-open-foreground.test.ts index e15b08a282..a2039a45f6 100644 --- a/src/daemon/session-lifecycle/internal/__tests__/session-open-foreground.test.ts +++ b/src/daemon/session-lifecycle/internal/__tests__/session-open-foreground.test.ts @@ -5,7 +5,7 @@ const dispatchSnapshotViaRuntime = vi.hoisted(() => vi.fn()); vi.mock('../../../snapshot-runtime.ts', () => ({ dispatchSnapshotViaRuntime })); import { AppError } from '@agent-device/kernel/errors'; -import type { DaemonRequest, DaemonResponse } from '../../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../../daemon-request.ts'; import { composeOpenWithInitialSnapshot, resolveForegroundOpenRequest, diff --git a/src/daemon/session-lifecycle/internal/__tests__/session-open-runtime.fixtures.ts b/src/daemon/session-lifecycle/internal/__tests__/session-open-runtime.fixtures.ts index 5a0eb0fac5..baaab8db18 100644 --- a/src/daemon/session-lifecycle/internal/__tests__/session-open-runtime.fixtures.ts +++ b/src/daemon/session-lifecycle/internal/__tests__/session-open-runtime.fixtures.ts @@ -1,6 +1,7 @@ import path from 'node:path'; import { SessionStore } from '../../../session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../../daemon-request.ts'; +import type { SessionState } from '../../../session-state.ts'; import { mkdtempForTestSync } from '../../../../__tests__/test-utils/tmp-dir.ts'; export const noopInvoke = async (_req: DaemonRequest): Promise => ({ diff --git a/src/daemon/session-lifecycle/internal/__tests__/session-open-url-prewarm.test.ts b/src/daemon/session-lifecycle/internal/__tests__/session-open-url-prewarm.test.ts index 9b74784757..25fa02b6ea 100644 --- a/src/daemon/session-lifecycle/internal/__tests__/session-open-url-prewarm.test.ts +++ b/src/daemon/session-lifecycle/internal/__tests__/session-open-url-prewarm.test.ts @@ -55,7 +55,7 @@ import { createTestDeviceInventoryGateways } from '../../../../__tests__/test-ut import { makeSessionStore } from '../../../../__tests__/test-utils/store-factory.ts'; import { makeSession } from '../../../../__tests__/test-utils/session-factories.ts'; import { LeaseRegistry } from '../../../lease-registry.ts'; -import type { DaemonRequest } from '../../../types.ts'; +import type { DaemonRequest } from '../../../daemon-request.ts'; import { prepareIosRunner, prewarmAppleRunnerCache, diff --git a/src/daemon/session-lifecycle/internal/inventory.ts b/src/daemon/session-lifecycle/internal/inventory.ts index 132c46b30b..9084a77780 100644 --- a/src/daemon/session-lifecycle/internal/inventory.ts +++ b/src/daemon/session-lifecycle/internal/inventory.ts @@ -25,7 +25,8 @@ import { } from '../../device-claim-inspection.ts'; import { canonicalLocalDeviceKey } from '../../device-claim-paths.ts'; import { deviceClaimIdentity } from '../../device-claims.ts'; -import type { DaemonRequest, DaemonResponse, SessionRef } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; +import type { SessionRef } from '../../session-state.ts'; import { resolveSessionRunnerLogPath, SessionStore } from '../../session-store.ts'; import { requireSessionOrExplicitSelector, diff --git a/src/daemon/session-lifecycle/internal/session-close-lifecycle-teardown.ts b/src/daemon/session-lifecycle/internal/session-close-lifecycle-teardown.ts index d0c1c2649a..827446c908 100644 --- a/src/daemon/session-lifecycle/internal/session-close-lifecycle-teardown.ts +++ b/src/daemon/session-lifecycle/internal/session-close-lifecycle-teardown.ts @@ -1,6 +1,7 @@ import type { CloseApplicationFinalizationResult } from '@agent-device/contracts/application-lifecycle-runtime'; import type { TargetShutdownResult } from '@agent-device/contracts/device'; -import type { DaemonRequest, SessionState } from '../../types.ts'; +import type { DaemonRequest } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { SessionStore } from '../../session-store.ts'; import { cleanupRetainedMaterializedPathsForSession } from '../../materialized-path-registry.ts'; import { diff --git a/src/daemon/session-lifecycle/internal/session-close-runtime-admission.ts b/src/daemon/session-lifecycle/internal/session-close-runtime-admission.ts index e9d63e56c8..d70fd34a50 100644 --- a/src/daemon/session-lifecycle/internal/session-close-runtime-admission.ts +++ b/src/daemon/session-lifecycle/internal/session-close-runtime-admission.ts @@ -4,7 +4,7 @@ import { } from '@agent-device/contracts/application-lifecycle-runtime-plan'; import type { BoundDeviceRuntime } from '@agent-device/contracts/platform-runtime'; import type { DeviceInfo } from '@agent-device/kernel/device'; -import type { DaemonResponse } from '../../types.ts'; +import type { DaemonResponse } from '../../daemon-request.ts'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts, diff --git a/src/daemon/session-lifecycle/internal/session-close-script.ts b/src/daemon/session-lifecycle/internal/session-close-script.ts index 0001cb32d4..47fbfc88f2 100644 --- a/src/daemon/session-lifecycle/internal/session-close-script.ts +++ b/src/daemon/session-lifecycle/internal/session-close-script.ts @@ -2,7 +2,8 @@ import { AppError, normalizeError } from '@agent-device/kernel/errors'; import { successText } from '@agent-device/kernel/success-text'; import type { CommandFlags } from '@agent-device/contracts/command'; import type { SessionStore } from '../../session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { NO_SCRIPT_PUBLICATION, scriptTargetPath } from '../../session-script-publication-state.ts'; import { effectiveWriteForce, diff --git a/src/daemon/session-lifecycle/internal/session-close.ts b/src/daemon/session-lifecycle/internal/session-close.ts index ae30edb0da..4cf4a8fcb3 100644 --- a/src/daemon/session-lifecycle/internal/session-close.ts +++ b/src/daemon/session-lifecycle/internal/session-close.ts @@ -1,7 +1,8 @@ import { emitDiagnostic } from '@agent-device/host-kit/diagnostics'; import { AppError, normalizeError } from '@agent-device/kernel/errors'; import type { LeaseLifecycleProvider, TargetShutdownResult } from '@agent-device/contracts/device'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { SessionStore } from '../../session-store.ts'; import { successText, withSuccessText } from '@agent-device/kernel/success-text'; import { resolveCommandDevice } from '../../session-device-resolution.ts'; diff --git a/src/daemon/session-lifecycle/internal/session-open-execution.ts b/src/daemon/session-lifecycle/internal/session-open-execution.ts index ac1aeb2329..d48e272b30 100644 --- a/src/daemon/session-lifecycle/internal/session-open-execution.ts +++ b/src/daemon/session-lifecycle/internal/session-open-execution.ts @@ -10,7 +10,8 @@ import { import type { BoundDeviceRuntime } from '@agent-device/contracts/platform-runtime'; import type { SessionSurface } from '@agent-device/contracts/session'; import type { DeviceInfo } from '@agent-device/kernel/device'; -import type { DaemonRequest, DaemonResponse, SessionScope, SessionState } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; +import type { SessionScope, SessionState } from '../../session-state.ts'; import { abortAuthoringOnSecondOpen, armAuthoringOnOpen, diff --git a/src/daemon/session-lifecycle/internal/session-open-foreground.ts b/src/daemon/session-lifecycle/internal/session-open-foreground.ts index 42c4d847bb..43c7dbf78a 100644 --- a/src/daemon/session-lifecycle/internal/session-open-foreground.ts +++ b/src/daemon/session-lifecycle/internal/session-open-foreground.ts @@ -1,7 +1,7 @@ import { normalizeError, type NormalizedError } from '@agent-device/kernel/errors'; import { dispatchSnapshotViaRuntime } from '../../snapshot-runtime.ts'; import type { SessionStore } from '../../session-store.ts'; -import type { DaemonRequest, DaemonResponse } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts, diff --git a/src/daemon/session-lifecycle/internal/session-open-prepare.ts b/src/daemon/session-lifecycle/internal/session-open-prepare.ts index 6249344f3e..3c45c92088 100644 --- a/src/daemon/session-lifecycle/internal/session-open-prepare.ts +++ b/src/daemon/session-lifecycle/internal/session-open-prepare.ts @@ -3,12 +3,8 @@ import type { RuntimeHintsApplicationInput } from '@agent-device/contracts/appli import { openApplicationRuntimeUse } from '@agent-device/contracts/application-lifecycle-runtime-plan'; import type { BoundDeviceRuntime } from '@agent-device/contracts/platform-runtime'; import type { DeviceInfo } from '@agent-device/kernel/device'; -import type { - DaemonRequest, - DaemonResponse, - SessionRuntimeHints, - SessionState, -} from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; +import type { SessionRuntimeHints, SessionState } from '../../session-state.ts'; import { SessionStore } from '../../session-store.ts'; import { resolveRequestedOpenSurface, diff --git a/src/daemon/session-lifecycle/internal/session-open-surface.ts b/src/daemon/session-lifecycle/internal/session-open-surface.ts index b6ca1dd6c3..53a989b7e7 100644 --- a/src/daemon/session-lifecycle/internal/session-open-surface.ts +++ b/src/daemon/session-lifecycle/internal/session-open-surface.ts @@ -5,7 +5,7 @@ import { publicPlatformString, type DeviceInfo, } from '@agent-device/kernel/device'; -import type { SessionRuntimeHints, SessionScope, SessionState } from '../../types.ts'; +import type { SessionRuntimeHints, SessionScope, SessionState } from '../../session-state.ts'; import { successText } from '@agent-device/kernel/success-text'; import type { StartupPerfSample } from './session-startup-metrics.ts'; import type { DeviceSelectionResult } from '../../../core/device-selection-resolver.ts'; diff --git a/src/daemon/session-lifecycle/internal/session-open.ts b/src/daemon/session-lifecycle/internal/session-open.ts index becc581c41..dd7235f703 100644 --- a/src/daemon/session-lifecycle/internal/session-open.ts +++ b/src/daemon/session-lifecycle/internal/session-open.ts @@ -7,7 +7,8 @@ import { resolveOpenApplicationRuntimePlan, } from '@agent-device/contracts/application-lifecycle-runtime-plan'; import type { DeviceInfo } from '@agent-device/kernel/device'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { SessionStore } from '../../session-store.ts'; import { refreshSessionDeviceIfNeeded } from '../../session-device-resolution.ts'; import { withKeyedLock } from '@agent-device/kernel/keyed-lock'; diff --git a/src/daemon/session-observability/__tests__/application.test.ts b/src/daemon/session-observability/__tests__/application.test.ts index 411c46095b..9df912f31f 100644 --- a/src/daemon/session-observability/__tests__/application.test.ts +++ b/src/daemon/session-observability/__tests__/application.test.ts @@ -1,5 +1,5 @@ import { beforeEach, expect, test, vi } from 'vitest'; -import type { DaemonRequest, DaemonResponse } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; import { makeSessionStore } from '../../../__tests__/test-utils/store-factory.ts'; vi.mock('../index.ts', async (importOriginal) => { diff --git a/src/daemon/session-observability/internal/__tests__/session-audio.test.ts b/src/daemon/session-observability/internal/__tests__/session-audio.test.ts index cd7240954d..622c92cf78 100644 --- a/src/daemon/session-observability/internal/__tests__/session-audio.test.ts +++ b/src/daemon/session-observability/internal/__tests__/session-audio.test.ts @@ -31,7 +31,7 @@ import { import { createAudioProbeAdmissionLedger } from '../../../audio-probe-admission-ledger.ts'; import { audioProbeDurableResource } from '../../../audio-probe-session-resource.ts'; import type { SessionStore } from '../../../session-store.ts'; -import type { DaemonResponse } from '../../../types.ts'; +import type { DaemonResponse } from '../../../daemon-request.ts'; import { handleSessionObservabilityCommands } from '../../index.ts'; import { ANDROID_AUDIO_CONTRACT_EVIDENCE } from '../../__tests__/session-audio.coverage.ts'; diff --git a/src/daemon/session-observability/internal/session-audio.ts b/src/daemon/session-observability/internal/session-audio.ts index 6b15b92d63..14fa4d9d20 100644 --- a/src/daemon/session-observability/internal/session-audio.ts +++ b/src/daemon/session-observability/internal/session-audio.ts @@ -19,7 +19,8 @@ import type { InspectDeviceRuntimeFacts, } from '../../request-runtime-binding.ts'; import type { SessionStore } from '../../session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { errorResponse, type DaemonFailureResponse } from '../../response.ts'; type AudioParams = { diff --git a/src/daemon/session-observability/internal/session-network.ts b/src/daemon/session-observability/internal/session-network.ts index 8440ea57fd..a92d4557dd 100644 --- a/src/daemon/session-observability/internal/session-network.ts +++ b/src/daemon/session-observability/internal/session-network.ts @@ -7,7 +7,7 @@ import { NETWORK_INCLUDE_MODES, type NetworkIncludeMode } from '@agent-device/ke import { AppError, normalizeError } from '@agent-device/kernel/errors'; import type { BindDeviceRuntime } from '../../request-runtime-binding.ts'; import type { SessionStore } from '../../session-store.ts'; -import type { DaemonRequest, DaemonResponse } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; import { errorResponse, type DaemonFailureResponse } from '../../response.ts'; const NETWORK_ACTIONS = ['dump', 'log'] as const; diff --git a/src/daemon/session-observability/internal/session-observability.ts b/src/daemon/session-observability/internal/session-observability.ts index c4fb40fcb9..d49275613f 100644 --- a/src/daemon/session-observability/internal/session-observability.ts +++ b/src/daemon/session-observability/internal/session-observability.ts @@ -30,7 +30,8 @@ import type { InspectDeviceRuntimeFacts, } from '../../request-runtime-binding.ts'; import type { SessionStore } from '../../session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { errorResponse, type DaemonFailureResponse } from '../../response.ts'; import { handleAudioCommand } from './session-audio.ts'; import { handlePerfRuntimeCommand } from './session-perf-runtime.ts'; diff --git a/src/daemon/session-observability/internal/session-perf-runtime.ts b/src/daemon/session-observability/internal/session-perf-runtime.ts index cb3eb99f94..1cd14ba700 100644 --- a/src/daemon/session-observability/internal/session-perf-runtime.ts +++ b/src/daemon/session-observability/internal/session-perf-runtime.ts @@ -29,7 +29,8 @@ import type { InspectDeviceRuntimeFacts, } from '../../request-runtime-binding.ts'; import { SessionStore } from '../../session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../../types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../daemon-request.ts'; +import type { SessionState } from '../../session-state.ts'; import { recordSessionAction } from '../../session-action-recorder.ts'; import { errorResponse } from '../../response.ts'; import { diff --git a/src/daemon/session-recovery-hints.test.ts b/src/daemon/session-recovery-hints.test.ts index 2cc141f2ac..d28c68fb1a 100644 --- a/src/daemon/session-recovery-hints.test.ts +++ b/src/daemon/session-recovery-hints.test.ts @@ -1,6 +1,6 @@ import { test, expect } from 'vitest'; import { buildSessionRecoveryHint } from './session-recovery-hints.ts'; -import type { SessionRef, SessionState } from './types.ts'; +import type { SessionRef, SessionState } from './session-state.ts'; import { IOS_SIMULATOR } from '../__tests__/test-utils/device-fixtures.ts'; // The recovery hint's whole job is to hand back a command that works. For an implicitly diff --git a/src/daemon/session-recovery-hints.ts b/src/daemon/session-recovery-hints.ts index 62884922df..92b8ee126f 100644 --- a/src/daemon/session-recovery-hints.ts +++ b/src/daemon/session-recovery-hints.ts @@ -1,6 +1,7 @@ import type { DeviceInfo } from '@agent-device/kernel/device'; import { shellQuoteIfNeeded } from '@agent-device/host-kit/command'; -import type { DaemonResponse, SessionRef, SessionState } from './types.ts'; +import type { DaemonResponse } from './daemon-request.ts'; +import type { SessionRef, SessionState } from './session-state.ts'; import { errorResponse } from './response.ts'; export type SessionRecoveryContext = 'device-in-use' | 'selector-conflict'; diff --git a/src/daemon/session-replay-coordinator.ts b/src/daemon/session-replay-coordinator.ts index be7b10d6db..5dc21ef1ae 100644 --- a/src/daemon/session-replay-coordinator.ts +++ b/src/daemon/session-replay-coordinator.ts @@ -5,7 +5,8 @@ import { type ReplayDivergenceResume, type ReplayRepairHint, } from '@agent-device/contracts/divergence'; -import type { DaemonResponse, SessionRuntimeHints, SessionState } from './types.ts'; +import type { DaemonResponse } from './daemon-request.ts'; +import type { SessionRuntimeHints, SessionState } from './session-state.ts'; import { armRepairStep, isUncommittedRepairSession, diff --git a/src/daemon/session-replay-transaction.ts b/src/daemon/session-replay-transaction.ts index 6e631e53c9..faaa4aea94 100644 --- a/src/daemon/session-replay-transaction.ts +++ b/src/daemon/session-replay-transaction.ts @@ -1,4 +1,4 @@ -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; import { NO_SCRIPT_PUBLICATION, abortRepair, diff --git a/src/daemon/session-routing.ts b/src/daemon/session-routing.ts index 4e16f840a4..aee296e4ce 100644 --- a/src/daemon/session-routing.ts +++ b/src/daemon/session-routing.ts @@ -3,7 +3,8 @@ import crypto from 'node:crypto'; import fs from 'node:fs'; import path from 'node:path'; import { AppError } from '@agent-device/kernel/errors'; -import type { DaemonRequest, SessionScope, SessionState } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; +import type { SessionScope, SessionState } from './session-state.ts'; import { SessionStore } from './session-store.ts'; const DEFAULT_SESSION_NAME = 'default'; diff --git a/src/daemon/session-runtime-admission.ts b/src/daemon/session-runtime-admission.ts index bc0e611e71..fbfce9f8e8 100644 --- a/src/daemon/session-runtime-admission.ts +++ b/src/daemon/session-runtime-admission.ts @@ -7,7 +7,7 @@ import type { DeviceInfo } from '@agent-device/kernel/device'; import { AppError } from '@agent-device/kernel/errors'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from './request-runtime-binding.ts'; import type { SessionStore } from './session-store.ts'; -import type { DaemonRequest, DaemonResponse } from './types.ts'; +import type { DaemonRequest, DaemonResponse } from './daemon-request.ts'; import { errorResponse } from './response.ts'; export type RuntimeCommandHandlerParams = Readonly<{ diff --git a/src/daemon/session-runtime.ts b/src/daemon/session-runtime.ts index 52b68b84ad..4387a934e5 100644 --- a/src/daemon/session-runtime.ts +++ b/src/daemon/session-runtime.ts @@ -5,7 +5,8 @@ import { } from '@agent-device/contracts/application-lifecycle-runtime'; import { AppError, asAppError } from '@agent-device/kernel/errors'; import { publicPlatformString, type DeviceInfo } from '@agent-device/kernel/device'; -import type { DaemonRequest, SessionRuntimeHints, SessionState } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; +import type { SessionRuntimeHints, SessionState } from './session-state.ts'; import { SessionStore } from './session-store.ts'; import { trimRuntimeValue } from '../core/runtime-transport-hints.ts'; import { isAndroidEmulator, isIosSimulator } from './device-targets.ts'; diff --git a/src/daemon/session-script-publication-capability.ts b/src/daemon/session-script-publication-capability.ts index 51604edbad..64d355dc5c 100644 --- a/src/daemon/session-script-publication-capability.ts +++ b/src/daemon/session-script-publication-capability.ts @@ -1,5 +1,5 @@ import type { CommandFlags } from '@agent-device/contracts/command'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; import { NO_SCRIPT_PUBLICATION, abortAuthoring, diff --git a/src/daemon/session-script-writer.ts b/src/daemon/session-script-writer.ts index b427cf1b86..aaecb4766c 100644 --- a/src/daemon/session-script-writer.ts +++ b/src/daemon/session-script-writer.ts @@ -18,7 +18,7 @@ import { } from '@agent-device/ad-script'; import { expandSessionPath, safeSessionName } from './session-paths.ts'; import { publishFileSync } from '@agent-device/host-kit/file'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; import { NO_SCRIPT_PUBLICATION, commitRepair, diff --git a/src/daemon/session-selector.ts b/src/daemon/session-selector.ts index 4018b1df57..e1c25b29cc 100644 --- a/src/daemon/session-selector.ts +++ b/src/daemon/session-selector.ts @@ -1,6 +1,6 @@ import type { CommandFlags } from '@agent-device/contracts/command'; import { AppError } from '@agent-device/kernel/errors'; -import type { SessionRef, SessionState } from './types.ts'; +import type { SessionRef, SessionState } from './session-state.ts'; import { isIosFamily, isSerialAddressablePlatform, diff --git a/src/daemon/session-snapshot-freshness.ts b/src/daemon/session-snapshot-freshness.ts index 42b0fd03b6..c7c441796d 100644 --- a/src/daemon/session-snapshot-freshness.ts +++ b/src/daemon/session-snapshot-freshness.ts @@ -11,7 +11,7 @@ import { type SnapshotFreshnessMode, type SnapshotFreshnessWindow, } from '../snapshot/snapshot-freshness/index.ts'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; /** * Session binding for the neutral snapshot-freshness facet (#1983). diff --git a/src/daemon/session-snapshot.ts b/src/daemon/session-snapshot.ts index 14939cfe86..0f0bb71822 100644 --- a/src/daemon/session-snapshot.ts +++ b/src/daemon/session-snapshot.ts @@ -2,7 +2,7 @@ import { randomInt } from 'node:crypto'; import type { SettleObservation } from '@agent-device/contracts/interaction'; import type { SnapshotState } from '@agent-device/kernel/snapshot'; import { activatePartialRefFrame, refFrameEpoch, refFrameState } from './ref-frame.ts'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; /** * Warning attached to a read of an `@ref` argument once the ref frame has diff --git a/src/daemon/types.ts b/src/daemon/session-state.ts similarity index 64% rename from src/daemon/types.ts rename to src/daemon/session-state.ts index babdfafbb1..4f5185c992 100644 --- a/src/daemon/types.ts +++ b/src/daemon/session-state.ts @@ -1,157 +1,34 @@ import type { CommandFlags } from '@agent-device/contracts/command'; -import type { GestureExecutionProfile } from '@agent-device/contracts/gesture-plan-types'; -import type { PreresolvedInteractionTarget } from '@agent-device/contracts/interaction'; -import type { SessionAction, SessionSurface } from '@agent-device/contracts/session'; -import type { - LeaseBackend, - DaemonArtifact as PublicDaemonArtifact, - DaemonInstallSource as PublicDaemonInstallSource, - DaemonRequestMeta as PublicDaemonRequestMeta, - DaemonResponse as PublicDaemonResponse, - DaemonResponseData as PublicDaemonResponseData, - SessionRuntimeHints as PublicSessionRuntimeHints, - DaemonRequest as WireRequest, -} from '@agent-device/kernel/contracts'; -import type { DeviceInfo, PlatformSelector } from '@agent-device/kernel/device'; -import type { Rect, SnapshotState } from '@agent-device/kernel/snapshot'; -import type { SnapshotFreshnessWindow } from '../snapshot/snapshot-freshness/index.ts'; -// Type-only import; erased at runtime. ref-frame.ts imports SessionState from -// here, so this back-edge must stay type-only to avoid a runtime cycle. import type { SnapshotDiagnosticsState } from '@agent-device/contracts/capture'; -import type { DeviceLease } from '@agent-device/contracts/device'; import type { AppLogFailure, AppLogLiveHandle } from '@agent-device/contracts/app-log-runtime'; import type { AudioProbeLiveHandle } from '@agent-device/contracts/audio-probe-runtime'; +import type { DurableResourceEnvelope } from '@agent-device/contracts/durable-resource-envelope'; import type { PerfNativeCaptureLiveHandle, PerfProfileHandoff, } from '@agent-device/contracts/perf-runtime'; -import type { DurableResourceEnvelope } from '@agent-device/contracts/durable-resource-envelope'; import type { ScreenRecordingLiveHandle } from '@agent-device/contracts/screen-recording-runtime'; -import type { SessionScriptPublicationState } from './session-script-publication-state.ts'; +import type { SessionAction, SessionSurface } from '@agent-device/contracts/session'; import type { - ReplayTargetGuardDenotation, - TargetAnnotationV1, -} from '@agent-device/contracts/replay'; -import type { RefFrame } from './ref-frame.ts'; -export type DaemonInstallSource = PublicDaemonInstallSource; -export type SessionRuntimeHints = PublicSessionRuntimeHints; -export type DaemonArtifact = PublicDaemonArtifact; -export type DaemonResponseData = PublicDaemonResponseData; - -type DaemonRequestMeta = Omit & { - installSource?: DaemonInstallSource; - lockPlatform?: PlatformSelector; - leaseBackend?: LeaseBackend; - leaseProvider?: string; -}; - -export type DaemonOpenLifecycle = { - beforeDispatch?: (session: SessionState) => Promise; -}; - -type DaemonRequestInternal = { - publicNetworkOnly?: true; - openLifecycle?: DaemonOpenLifecycle; - /** - * Request-owned capability used when a fresh replay discovers its device - * only inside the first open. The router retains that device's execution - * lock before dispatch and releases it after the outer replay finalizes. - */ - retainDeviceExecutionLock?: (deviceId: string) => Promise; - admittedLease?: DeviceLease; - /** - * Daemon-composed hierarchy capture used as operational evidence only. - * It must not issue or replace client ref authority. - */ - observationOnly?: true; - /** - * Implicit caller scope resolved before a nested dispatch replaces the - * public session name with its effective scoped key. - */ - resolvedSessionScope?: SessionState['sessionScope']; - /** Terminate the targeted app without ending the owning daemon session. */ - closeAppOnly?: boolean; - /** Provider-owned viewport already resolved while normalizing a nested gesture command. */ - gestureViewport?: Rect; - /** Maestro-compat execution profile for timed coordinate swipes projected to `gesture pan`. */ - gestureExecutionProfile?: GestureExecutionProfile; - /** - * ADR 0012 step 4 post-resolution guard: the verified target member's - * normalized local identity AND structural denotation (document order + - * sibling ordinal), set ONLY by the replay step loop when dispatching an - * annotated action whose pre-action verification passed. Interaction - * handlers thread it into command options as `expectedResolvedTarget`; - * dispatch's own resolution refuses (pre-action) when its winner differs in - * local identity OR structural position — the latter distinguishes a - * different same-identity duplicate. - */ - replayTargetGuard?: ReplayTargetGuardDenotation; - /** Dual-endpoint counterpart of replayTargetGuard for target-authored drag. */ - replayTargetGuards?: { - source: ReplayTargetGuardDenotation; - destination: ReplayTargetGuardDenotation; - }; - /** - * ADR 0012 / #1349 deferred (post-resolution) identity verification: the - * recorded `target-v1` landmark of an annotated selector `wait`, set ONLY - * by the replay step loop. The wait dispatch threads it into the polling - * loop as `recordedLandmark`; success then requires a selector match - * carrying this identity, and a timeout with rejected candidates surfaces - * the `WAIT_LANDMARK_MISMATCH_REASON` refusal the step loop converts into - * an identity-mismatch divergence. Never used by the generic pre-dispatch - * verification path — a wait's landmark may legitimately be absent when - * the step starts. - */ - replayLandmarkGuard?: TargetAnnotationV1; - /** - * ADR 0014 / #1654: the complete ref/node/tree target a mutating `find` - * resolved against its fresh capture. Its presence both marks the ref as - * find-owned (so admission/staleness policy is skipped) and supplies the node - * adopted by the interaction leaf. One payload keeps those decisions from - * becoming independently representable. The leaf still crosses the - * side-effect seam and expires the frame. - */ - findResolvedTarget?: PreresolvedInteractionTarget; - /** - * #1271 stage 2 (ADR 0012 decision 6 amendment): PROVENANCE — set by the - * replay runtime (`invokeResolvedReplayAction`, - * `session-replay-action-runtime.ts`) on every action it dispatches from a - * replay plan, annotated or not. It marks the action as AUTHORED (it came - * from the `.ad` under repair) rather than typed out-of-band by the agent - * mid-repair. - * - * The repair-segment exclusion keys off its ABSENCE: an authored - * `get`/`is`/`find`/`snapshot` step must survive into its own healed script - * (silently dropping it would make the heal quietly stop asserting what the - * original flow asserted), while an interactive diagnostic read used only to - * LOCATE the repair target must not. Command class alone cannot tell those - * apart — they are the same command — so provenance is the discriminator and - * `--record` is only for deliberately inserting an interactive read. - * - * Trustworthy because `internal` is daemon-only: `toDaemonRequest` - * (`server/http-server.ts`) never copies it off the wire, so no client can - * spoof authored provenance. Same channel as `replayTargetGuard` above. - */ - replayPlanStep?: boolean; -}; + LeaseBackend, + SessionRuntimeHints as PublicSessionRuntimeHints, +} from '@agent-device/kernel/contracts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; +import type { SnapshotFreshnessWindow } from '../snapshot/snapshot-freshness/index.ts'; +import type { RefFrame } from './ref-frame-slot.ts'; +import type { SessionScriptPublicationState } from './session-script-publication-state.ts'; /** - * The server-side request: the wire shape plus what only the daemon may see. `token` and `session` - * are required by the time a request is dispatched, `flags` is narrowed to the `CommandFlags` - * vocabulary the wire cannot enforce, and `internal` carries `SessionState` callbacks and the - * admitted lease — which is why this type stays in the daemon. Zones below it that only need to - * classify a command take `contracts/dispatched-command.ts` instead. + * The daemon's live session record and the shapes only it holds. Mutable state owned by the + * session store and written through the modules R7 names in `scripts/layering/session-state.ts`; + * `ref-frame.ts` owns the `refFrame` slot whose value is declared in `ref-frame-slot.ts`. + * + * Nothing here belongs on the wire. The request half of a dispatch lives in `daemon-request.ts`, + * and its public-only shape in `daemon-request-wire.ts`. */ -export type DaemonRequest = Omit & { - token: string; - session: string; - flags?: CommandFlags; - meta?: DaemonRequestMeta; - internal?: DaemonRequestInternal; -}; -export type DaemonResponse = PublicDaemonResponse; -export type DaemonInvokeFn = (req: DaemonRequest) => Promise; +export type SessionRuntimeHints = PublicSessionRuntimeHints; /** * One node's contribution to an interaction-surface signature. Two comparisons @@ -400,6 +277,3 @@ export type SessionState = { }; appLogFailure?: AppLogFailure; }; - -// The recorded-action SHAPE lives in contracts/ so replay/ and compat/ can read a script -// without depending on the server; re-exported here for the daemon's own consumers. diff --git a/src/daemon/session-store.ts b/src/daemon/session-store.ts index aecac2d7c2..83b1985704 100644 --- a/src/daemon/session-store.ts +++ b/src/daemon/session-store.ts @@ -2,7 +2,7 @@ import path from 'node:path'; import fs from 'node:fs'; import { AppError, type DiagnosticsRecordRef } from '@agent-device/kernel/errors'; import { emitDiagnostic } from '@agent-device/host-kit/diagnostics'; -import type { SessionRef, SessionRuntimeHints, SessionState } from './types.ts'; +import type { SessionRef, SessionRuntimeHints, SessionState } from './session-state.ts'; import { recordActionEntry, type RecordActionEntry } from './session-action-recorder.ts'; import { expandSessionPath, isSafeSessionSegment, safeSessionName } from './session-paths.ts'; import { NO_SCRIPT_PUBLICATION, isRepairCommittable } from './session-script-publication-state.ts'; diff --git a/src/daemon/session-teardown-budget.ts b/src/daemon/session-teardown-budget.ts index 6caa3d5cb1..e111c1277d 100644 --- a/src/daemon/session-teardown-budget.ts +++ b/src/daemon/session-teardown-budget.ts @@ -1,4 +1,4 @@ -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; import { isWebSession } from './web-session-names.ts'; export const DAEMON_SESSION_TEARDOWN_TIMEOUT_MS = 5_000; diff --git a/src/daemon/session-teardown.ts b/src/daemon/session-teardown.ts index c173eb4895..a361fe6947 100644 --- a/src/daemon/session-teardown.ts +++ b/src/daemon/session-teardown.ts @@ -1,7 +1,7 @@ import { AppError } from '@agent-device/kernel/errors'; import { emitDiagnostic } from '@agent-device/host-kit/diagnostics'; import { cleanupRetainedMaterializedPathsForSession } from './materialized-path-registry.ts'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; import type { SessionStore } from './session-store.ts'; import { forceCleanupSessionAppLog } from './app-log-session-resource.ts'; import { appLogResourceStore } from './app-log-resource-store.ts'; diff --git a/src/daemon/snapshot-capture.ts b/src/daemon/snapshot-capture.ts index eee7de2142..efd2f5bc42 100644 --- a/src/daemon/snapshot-capture.ts +++ b/src/daemon/snapshot-capture.ts @@ -21,7 +21,7 @@ import type { SnapshotFreshnessMode } from '../snapshot/snapshot-freshness/index import { contextFromFlags } from './context.ts'; import { resolveDeferredInteractionOutcome } from './deferred-interaction-outcome.ts'; import { createInteractionRetryTap } from './interaction-retry-tap.ts'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from './request-runtime-binding.ts'; import { errorResponse, type DaemonFailureResponse } from './response.ts'; diff --git a/src/daemon/snapshot-command-runtime.ts b/src/daemon/snapshot-command-runtime.ts index 6acedf226c..62acd0245a 100644 --- a/src/daemon/snapshot-command-runtime.ts +++ b/src/daemon/snapshot-command-runtime.ts @@ -29,13 +29,8 @@ import { resolveBoundSnapshotCaptureRuntime, type SnapshotRuntimeRouteParams, } from './snapshot-runtime-binding.ts'; -import type { - DaemonRequest, - DaemonResponse, - DaemonResponseData, - SessionScope, - SessionState, -} from './types.ts'; +import type { DaemonRequest, DaemonResponse, DaemonResponseData } from './daemon-request.ts'; +import type { SessionScope, SessionState } from './session-state.ts'; export type SnapshotRuntimeRecord = | { kind: 'snapshot'; nodes: number; truncated: boolean | undefined } diff --git a/src/daemon/snapshot-diff-runtime.ts b/src/daemon/snapshot-diff-runtime.ts index 0286903c5c..1bd644ad44 100644 --- a/src/daemon/snapshot-diff-runtime.ts +++ b/src/daemon/snapshot-diff-runtime.ts @@ -1,6 +1,6 @@ import { dispatchSnapshotRuntimeCommand } from './snapshot-command-runtime.ts'; import type { SnapshotRuntimeRouteParams } from './snapshot-runtime-binding.ts'; -import type { DaemonResponse } from './types.ts'; +import type { DaemonResponse } from './daemon-request.ts'; /** Canonical `diff snapshot` route over one facts-first, request-bound capture runtime. */ export async function dispatchSnapshotDiffViaRuntime( diff --git a/src/daemon/snapshot-quality-latch.ts b/src/daemon/snapshot-quality-latch.ts index f8853fd262..a478631292 100644 --- a/src/daemon/snapshot-quality-latch.ts +++ b/src/daemon/snapshot-quality-latch.ts @@ -1,6 +1,7 @@ import type { SnapshotQualityVerdict } from '@agent-device/kernel/snapshot'; import { recoveredSnapshotQualityWarning } from '../snapshot/snapshot-presentation/quality-warnings.ts'; -import type { DaemonResponseData, SessionState } from './types.ts'; +import type { DaemonResponseData } from './daemon-request.ts'; +import type { SessionState } from './session-state.ts'; type RecoveredWarningLatch = NonNullable; diff --git a/src/daemon/snapshot-runtime-binding.ts b/src/daemon/snapshot-runtime-binding.ts index 87a8ac97bc..d00cc635fe 100644 --- a/src/daemon/snapshot-runtime-binding.ts +++ b/src/daemon/snapshot-runtime-binding.ts @@ -19,7 +19,8 @@ import { import type { DeviceReadyOptions } from './device-ready.ts'; import type { PlatformResourceCleanup } from '@agent-device/contracts/platform-resource-cleanup'; import { SessionStore } from './session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from './types.ts'; +import type { DaemonRequest, DaemonResponse } from './daemon-request.ts'; +import type { SessionState } from './session-state.ts'; import { admitRuntimePlan, requireRuntimeBinding, diff --git a/src/daemon/snapshot-runtime-capture-input.ts b/src/daemon/snapshot-runtime-capture-input.ts index 1a91199745..a84dbc4e14 100644 --- a/src/daemon/snapshot-runtime-capture-input.ts +++ b/src/daemon/snapshot-runtime-capture-input.ts @@ -4,7 +4,8 @@ import type { SnapshotRuntimeExecution, } from '@agent-device/contracts/snapshot-runtime'; import { contextFromFlags, type DaemonCommandContext } from './context.ts'; -import type { DaemonRequest, SessionState } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; +import type { SessionState } from './session-state.ts'; /** * The one place a daemon request becomes neutral capture intent. `snapshot` and `diff` build diff --git a/src/daemon/snapshot-runtime.ts b/src/daemon/snapshot-runtime.ts index 574191d5ca..4bbad4e0e4 100644 --- a/src/daemon/snapshot-runtime.ts +++ b/src/daemon/snapshot-runtime.ts @@ -3,7 +3,8 @@ import { copySnapshotClickabilityEvidence } from '@agent-device/contracts/captur import { dispatchSnapshotRuntimeCommand } from './snapshot-command-runtime.ts'; import { captureSparseFallbackScreenshot } from './sparse-fallback-screenshot.ts'; import type { SnapshotRuntimeRouteParams } from './snapshot-runtime-binding.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from './types.ts'; +import type { DaemonRequest, DaemonResponse } from './daemon-request.ts'; +import type { SessionState } from './session-state.ts'; export async function dispatchSnapshotViaRuntime( params: SnapshotRuntimeRouteParams, diff --git a/src/daemon/snapshot-session.ts b/src/daemon/snapshot-session.ts index b3dcaf785a..2d81fad88c 100644 --- a/src/daemon/snapshot-session.ts +++ b/src/daemon/snapshot-session.ts @@ -1,6 +1,7 @@ import { resolveTargetDevice } from '../core/dispatch-resolve.ts'; import type { PlatformResourceCleanup } from '@agent-device/contracts/platform-resource-cleanup'; -import type { DaemonRequest, SessionScope, SessionState } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; +import type { SessionScope, SessionState } from './session-state.ts'; import { isActiveProviderDevice } from '../provider-device-runtime.ts'; import { SessionStore } from './session-store.ts'; diff --git a/src/daemon/sparse-fallback-screenshot.ts b/src/daemon/sparse-fallback-screenshot.ts index b6a1bde400..3f2e916054 100644 --- a/src/daemon/sparse-fallback-screenshot.ts +++ b/src/daemon/sparse-fallback-screenshot.ts @@ -6,7 +6,8 @@ import { resolveBoundScreenshotRuntime, type ScreenshotRuntimeBindings, } from './screenshot-runtime-binding.ts'; -import type { DaemonRequest, SessionState } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; +import type { SessionState } from './session-state.ts'; export type SparseFallbackScreenshot = { path: string; diff --git a/src/daemon/system-surface-disclosure.ts b/src/daemon/system-surface-disclosure.ts index e3be4ddc34..76d822374a 100644 --- a/src/daemon/system-surface-disclosure.ts +++ b/src/daemon/system-surface-disclosure.ts @@ -1,6 +1,6 @@ import type { SnapshotState } from '@agent-device/kernel/snapshot'; import { systemSurfaceDisclosure } from '../core/android-system-surface-disclosure.ts'; -import type { DaemonResponse } from './types.ts'; +import type { DaemonResponse } from './daemon-request.ts'; /** * Append the occluding-system-surface disclosure to a selector-route response whose consumed diff --git a/src/daemon/upload-http.ts b/src/daemon/upload-http.ts index 130e80ae44..107f661187 100644 --- a/src/daemon/upload-http.ts +++ b/src/daemon/upload-http.ts @@ -1,6 +1,6 @@ import http from 'node:http'; import { AppError, normalizeError } from '@agent-device/kernel/errors'; -import type { DaemonRequest } from './types.ts'; +import type { DaemonRequest } from './daemon-request.ts'; import { trackUploadedArtifact } from './artifact-tracking.ts'; import { type BeginResumableUploadOptions, diff --git a/src/daemon/wait-conditional-selector.ts b/src/daemon/wait-conditional-selector.ts index 4381951a43..0df11e975a 100644 --- a/src/daemon/wait-conditional-selector.ts +++ b/src/daemon/wait-conditional-selector.ts @@ -6,7 +6,8 @@ import { buildRuntimeCaptureInput } from './snapshot-runtime-capture-input.ts'; import { recordIfSession, stripSelectorChain } from './selector-recording.ts'; import { isSessionRecording } from './session-script-publication-capability.ts'; import type { SessionStore } from './session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from './types.ts'; +import type { DaemonRequest, DaemonResponse } from './daemon-request.ts'; +import type { SessionState } from './session-state.ts'; /** * Tries the admitted owner's one-sided native observation for an immediate simple-selector wait. diff --git a/src/daemon/wait-current-surface.ts b/src/daemon/wait-current-surface.ts index eb1324d961..a58c38cd89 100644 --- a/src/daemon/wait-current-surface.ts +++ b/src/daemon/wait-current-surface.ts @@ -1,6 +1,7 @@ import { WAIT_REASONS } from '@agent-device/contracts/wait'; import type { SnapshotNode } from '@agent-device/kernel/snapshot'; -import type { DaemonRequest, DaemonResponse, SessionState } from './types.ts'; +import type { DaemonRequest, DaemonResponse } from './daemon-request.ts'; +import type { SessionState } from './session-state.ts'; import { captureSnapshot } from './snapshot-capture.ts'; import { errorResponse } from './response.ts'; import { normalizeType } from '@agent-device/contracts/snapshot'; diff --git a/src/daemon/wait-runtime.ts b/src/daemon/wait-runtime.ts index b017ef763a..2c1b0aad13 100644 --- a/src/daemon/wait-runtime.ts +++ b/src/daemon/wait-runtime.ts @@ -22,7 +22,8 @@ import { toDaemonResponse, } from './selector-runtime.ts'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from './request-runtime-binding.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from './types.ts'; +import type { DaemonRequest, DaemonResponse } from './daemon-request.ts'; +import type { SessionState } from './session-state.ts'; import { dispatchConditionalWaitSelector } from './wait-conditional-selector.ts'; import { maybeWaitTimeoutSurfaceResponse } from './wait-current-surface.ts'; import { withSystemSurfaceDisclosure } from './system-surface-disclosure.ts'; diff --git a/src/daemon/web-session-names.ts b/src/daemon/web-session-names.ts index c1585026c7..8cc944da63 100644 --- a/src/daemon/web-session-names.ts +++ b/src/daemon/web-session-names.ts @@ -1,5 +1,5 @@ import type { SessionStore } from './session-store.ts'; -import type { SessionState } from './types.ts'; +import type { SessionState } from './session-state.ts'; export function isWebSession(session: SessionState): boolean { return session.device.platform === 'web'; diff --git a/src/remote/daemon-artifacts.ts b/src/remote/daemon-artifacts.ts index 417dc5c59f..37b3a8a3ff 100644 --- a/src/remote/daemon-artifacts.ts +++ b/src/remote/daemon-artifacts.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { AppError } from '@agent-device/kernel/errors'; -import type { DaemonArtifact, DaemonRequest, DaemonResponse } from '../daemon/types.ts'; +import type { DaemonArtifact, DaemonRequest, DaemonResponse } from '../daemon/daemon-request.ts'; import { appendRecordingExtensionWhenMissing, recordingExtensionForPlatform, diff --git a/test/integration/nightly/concurrency-torture/bindings.ts b/test/integration/nightly/concurrency-torture/bindings.ts index 41a4b405b7..c53de7e391 100644 --- a/test/integration/nightly/concurrency-torture/bindings.ts +++ b/test/integration/nightly/concurrency-torture/bindings.ts @@ -20,7 +20,7 @@ import type { DeviceInfo } from '@agent-device/kernel/device'; import type { CommandFlags } from '@agent-device/contracts/command'; -import type { DaemonRequest } from '../../../../src/daemon/types.ts'; +import type { DaemonRequest } from '../../../../src/daemon/daemon-request.ts'; import type { SessionStore } from '../../../../src/daemon/session-store.ts'; import { resolveRequestExecutionLockKeys } from '../../../../src/daemon/request-binding.ts'; import { shouldLockSessionExecution } from '../../../../src/daemon/daemon-command-registry.ts'; diff --git a/test/integration/nightly/concurrency-torture/harness.ts b/test/integration/nightly/concurrency-torture/harness.ts index a5c0d74672..0c31e9adff 100644 --- a/test/integration/nightly/concurrency-torture/harness.ts +++ b/test/integration/nightly/concurrency-torture/harness.ts @@ -28,7 +28,7 @@ import path from 'node:path'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { LeaseRegistry } from '../../../../src/daemon/lease-registry.ts'; import { SessionStore } from '../../../../src/daemon/session-store.ts'; -import type { SessionState } from '../../../../src/daemon/types.ts'; +import type { SessionState } from '../../../../src/daemon/session-state.ts'; import { AppError } from '@agent-device/kernel/errors'; import { makePrng, type Prng } from './prng.ts'; diff --git a/test/integration/nightly/concurrency-torture/real-scope-serialization.ts b/test/integration/nightly/concurrency-torture/real-scope-serialization.ts index d88b553901..d63746b9b9 100644 --- a/test/integration/nightly/concurrency-torture/real-scope-serialization.ts +++ b/test/integration/nightly/concurrency-torture/real-scope-serialization.ts @@ -20,7 +20,7 @@ import { LeaseRegistry } from '../../../../src/daemon/lease-registry.ts'; import { SessionStore } from '../../../../src/daemon/session-store.ts'; import { withTestDeviceInventoryProvider as withDeviceInventoryProvider } from '../../../../src/__tests__/test-utils/device-inventory-gateways.ts'; import type { CommandFlags } from '@agent-device/contracts/command'; -import type { DaemonRequest } from '../../../../src/daemon/types.ts'; +import type { DaemonRequest } from '../../../../src/daemon/daemon-request.ts'; import { DEVICE_POOL } from './bindings.ts'; diff --git a/test/integration/provider-scenarios/cloud-webdriver-ios-text-entry.test.ts b/test/integration/provider-scenarios/cloud-webdriver-ios-text-entry.test.ts index 0dd4af972f..89205ab54b 100644 --- a/test/integration/provider-scenarios/cloud-webdriver-ios-text-entry.test.ts +++ b/test/integration/provider-scenarios/cloud-webdriver-ios-text-entry.test.ts @@ -6,7 +6,7 @@ import { } from '@agent-device/provider-webdriver'; import type { DeviceLease } from '@agent-device/contracts/device'; import { createProviderDeviceRuntimeRequestProviders } from '../../../src/provider-device-runtime.ts'; -import type { DaemonRequest } from '../../../src/daemon/types.ts'; +import type { DaemonRequest } from '../../../src/daemon/daemon-request.ts'; import { assertRpcOk } from './assertions.ts'; import { createProviderScenarioHarness, diff --git a/test/integration/provider-scenarios/cloud-webdriver-provider-regressions.test.ts b/test/integration/provider-scenarios/cloud-webdriver-provider-regressions.test.ts index 096b71529b..4c59bf7621 100644 --- a/test/integration/provider-scenarios/cloud-webdriver-provider-regressions.test.ts +++ b/test/integration/provider-scenarios/cloud-webdriver-provider-regressions.test.ts @@ -11,7 +11,7 @@ import type { CaptureSnapshotResult } from '@agent-device/contracts/client'; import type { DeviceLease } from '@agent-device/contracts/device'; import type { PlatformRuntimeHost } from '@agent-device/contracts/platform-runtime-operations'; import { createProviderDeviceRuntimeRequestProviders } from '../../../src/provider-device-runtime.ts'; -import type { DaemonRequest } from '../../../src/daemon/types.ts'; +import type { DaemonRequest } from '../../../src/daemon/daemon-request.ts'; import * as iosSnapshotRuntime from '../../../src/snapshot/ios-snapshot-runtime.ts'; import { createProviderScenarioHarness, diff --git a/test/integration/provider-scenarios/cloud-webdriver-runtime.test.ts b/test/integration/provider-scenarios/cloud-webdriver-runtime.test.ts index eedb75bb88..9390466034 100644 --- a/test/integration/provider-scenarios/cloud-webdriver-runtime.test.ts +++ b/test/integration/provider-scenarios/cloud-webdriver-runtime.test.ts @@ -10,7 +10,7 @@ import type { CloudArtifact } from '@agent-device/contracts/observability'; import type { DeviceLease } from '@agent-device/contracts/device'; import { createProviderDeviceRuntimeRequestProviders } from '../../../src/provider-device-runtime.ts'; import { createExpiredProviderLeaseReleaser } from '../../../src/daemon/provider-lease-expiry.ts'; -import type { DaemonRequest } from '../../../src/daemon/types.ts'; +import type { DaemonRequest } from '../../../src/daemon/daemon-request.ts'; import { assertRpcOk } from './assertions.ts'; import { createProviderScenarioHarness, diff --git a/test/integration/provider-scenarios/daemon-http-boundary-cancellation.test.ts b/test/integration/provider-scenarios/daemon-http-boundary-cancellation.test.ts index 5f1a600156..608b39c276 100644 --- a/test/integration/provider-scenarios/daemon-http-boundary-cancellation.test.ts +++ b/test/integration/provider-scenarios/daemon-http-boundary-cancellation.test.ts @@ -3,7 +3,7 @@ import http from 'node:http'; import { test } from 'vitest'; import { getRequestSignal } from '@agent-device/host-kit/request'; import { createDaemonHttpServer } from '../../../src/daemon/server/http-server.ts'; -import type { DaemonRequest, DaemonResponse } from '../../../src/daemon/types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../../src/daemon/daemon-request.ts'; import { closeLoopbackServer, listenOnLoopback, diff --git a/test/integration/provider-scenarios/daemon-http-disconnect.test.ts b/test/integration/provider-scenarios/daemon-http-disconnect.test.ts index 75ac7346bd..8f5a6f608b 100644 --- a/test/integration/provider-scenarios/daemon-http-disconnect.test.ts +++ b/test/integration/provider-scenarios/daemon-http-disconnect.test.ts @@ -3,7 +3,7 @@ import http from 'node:http'; import { test } from 'vitest'; import { getRequestSignal } from '@agent-device/host-kit/request'; import { createDaemonHttpServer } from '../../../src/daemon/server/http-server.ts'; -import type { DaemonRequest, DaemonResponse } from '../../../src/daemon/types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../../src/daemon/daemon-request.ts'; import { closeLoopbackServer, listenOnLoopback, diff --git a/test/integration/provider-scenarios/daemon-http-resumable-upload.test.ts b/test/integration/provider-scenarios/daemon-http-resumable-upload.test.ts index dc89f47e14..364bec9c68 100644 --- a/test/integration/provider-scenarios/daemon-http-resumable-upload.test.ts +++ b/test/integration/provider-scenarios/daemon-http-resumable-upload.test.ts @@ -8,7 +8,7 @@ import { prepareUploadedArtifact, } from '../../../src/daemon/artifact-tracking.ts'; import { createDaemonHttpServer } from '../../../src/daemon/server/http-server.ts'; -import type { DaemonResponse } from '../../../src/daemon/types.ts'; +import type { DaemonResponse } from '../../../src/daemon/daemon-request.ts'; import { closeLoopbackServer, listenOnLoopback, diff --git a/test/integration/provider-scenarios/daemon-http-server.test.ts b/test/integration/provider-scenarios/daemon-http-server.test.ts index 2fab8df73f..c984a6d64e 100644 --- a/test/integration/provider-scenarios/daemon-http-server.test.ts +++ b/test/integration/provider-scenarios/daemon-http-server.test.ts @@ -19,7 +19,7 @@ import { isRequestCanceled, } from '@agent-device/host-kit/request'; -import type { DaemonRequest, DaemonResponse } from '../../../src/daemon/types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../../src/daemon/daemon-request.ts'; import { closeLoopbackServer, listenOnLoopback, diff --git a/test/integration/provider-scenarios/daemon-transport.test.ts b/test/integration/provider-scenarios/daemon-transport.test.ts index 2520764e56..771607b477 100644 --- a/test/integration/provider-scenarios/daemon-transport.test.ts +++ b/test/integration/provider-scenarios/daemon-transport.test.ts @@ -2,7 +2,7 @@ import assert from 'node:assert/strict'; import http from 'node:http'; import net from 'node:net'; import { test } from 'vitest'; -import type { DaemonRequest, DaemonResponse } from '../../../src/daemon/types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../../src/daemon/daemon-request.ts'; import { createSocketServer, listenHttpServer, diff --git a/test/integration/provider-scenarios/harness.ts b/test/integration/provider-scenarios/harness.ts index 67969b76e7..de234bdf16 100644 --- a/test/integration/provider-scenarios/harness.ts +++ b/test/integration/provider-scenarios/harness.ts @@ -21,7 +21,8 @@ import type { AppleSimulatorScreenRecordingProcess } from '../../../src/platform import { trackDownloadableArtifact } from '../../../src/daemon/artifact-tracking.ts'; import { LeaseRegistry } from '../../../src/daemon/lease-registry.ts'; import { SessionStore } from '../../../src/daemon/session-store.ts'; -import type { DaemonRequest, DaemonResponse, SessionState } from '../../../src/daemon/types.ts'; +import type { DaemonRequest, DaemonResponse } from '../../../src/daemon/daemon-request.ts'; +import type { SessionState } from '../../../src/daemon/session-state.ts'; import { runCmdBackground } from '@agent-device/host-kit/command'; import { createOwnedProcessRecordStore } from '@agent-device/host-kit/process'; import { withClientReplayScriptSources } from '../../../src/__tests__/test-utils/replay-script-source.ts'; diff --git a/test/integration/provider-scenarios/provider-device-runtime.fixtures.ts b/test/integration/provider-scenarios/provider-device-runtime.fixtures.ts index b4f273219c..e9ef26fa01 100644 --- a/test/integration/provider-scenarios/provider-device-runtime.fixtures.ts +++ b/test/integration/provider-scenarios/provider-device-runtime.fixtures.ts @@ -44,7 +44,7 @@ import type { } from '@agent-device/contracts/platform-runtime-operations'; import { bindAdmittedProviderInteractorOperations } from '@agent-device/contracts/interactor-operation-catalog'; import { unavailableDeploymentSnapshotAndShutdownOperationFacts } from '../../../src/__tests__/test-utils/runtime-operation-facts.ts'; -import type { DaemonRequest } from '../../../src/daemon/types.ts'; +import type { DaemonRequest } from '../../../src/daemon/daemon-request.ts'; import { deviceShape, type DeviceInfo } from '@agent-device/kernel/device'; import { AppError } from '@agent-device/kernel/errors'; import { createProviderScenarioHarness } from './harness.ts'; diff --git a/test/integration/provider-scenarios/provider-ios-runner-transport.test.ts b/test/integration/provider-scenarios/provider-ios-runner-transport.test.ts index d2a158ae93..e762cc11e6 100644 --- a/test/integration/provider-scenarios/provider-ios-runner-transport.test.ts +++ b/test/integration/provider-scenarios/provider-ios-runner-transport.test.ts @@ -8,7 +8,7 @@ import type { ProviderDeviceRuntime, } from '@agent-device/contracts/device'; import type { Interactor, RunnerContext } from '@agent-device/contracts/interactor-types'; -import type { DaemonRequest } from '../../../src/daemon/types.ts'; +import type { DaemonRequest } from '../../../src/daemon/daemon-request.ts'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { applePlugin } from '@agent-device/platform-apple'; import type { diff --git a/test/integration/provider-scenarios/provider-ios-selector-runtime.test.ts b/test/integration/provider-scenarios/provider-ios-selector-runtime.test.ts index ddb401f009..9bc06ab5cd 100644 --- a/test/integration/provider-scenarios/provider-ios-selector-runtime.test.ts +++ b/test/integration/provider-scenarios/provider-ios-selector-runtime.test.ts @@ -9,7 +9,7 @@ import type { } from '@agent-device/contracts/device'; import type { Interactor, SnapshotResult } from '@agent-device/contracts/interactor-types'; import { providerRuntimeOwner } from '@agent-device/contracts/platform-runtime'; -import type { DaemonRequest } from '../../../src/daemon/types.ts'; +import type { DaemonRequest } from '../../../src/daemon/daemon-request.ts'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { assertRpcOk } from './assertions.ts'; import { createProviderScenarioHarness, withProviderScenarioResource } from './harness.ts'; diff --git a/test/integration/provider-scenarios/remote-test-artifacts-materialization.test.ts b/test/integration/provider-scenarios/remote-test-artifacts-materialization.test.ts index 1d504f1f0a..8f645c409c 100644 --- a/test/integration/provider-scenarios/remote-test-artifacts-materialization.test.ts +++ b/test/integration/provider-scenarios/remote-test-artifacts-materialization.test.ts @@ -9,7 +9,7 @@ import { cleanupDownloadableArtifact, trackDownloadableArtifact, } from '../../../src/daemon/artifact-tracking.ts'; -import type { DaemonRequest } from '../../../src/daemon/types.ts'; +import type { DaemonRequest } from '../../../src/daemon/daemon-request.ts'; import { createDaemonHttpServer } from '../../../src/daemon/server/http-server.ts'; import { attachRemoteReplayTestArtifacts } from '../../../src/daemon/replay/internal/test-command.ts'; import { diff --git a/test/integration/provider-scenarios/scenario.ts b/test/integration/provider-scenarios/scenario.ts index 0d67f9931c..63c4f4626c 100644 --- a/test/integration/provider-scenarios/scenario.ts +++ b/test/integration/provider-scenarios/scenario.ts @@ -1,5 +1,5 @@ import assert from 'node:assert/strict'; -import type { DaemonRequest } from '../../../src/daemon/types.ts'; +import type { DaemonRequest } from '../../../src/daemon/daemon-request.ts'; import type { ProviderScenarioHarness, ProviderScenarioRpcResult } from './harness.ts'; export type ProviderScenarioState = { diff --git a/test/output-economy/fixtures.ts b/test/output-economy/fixtures.ts index e2b62f9fea..3972d2fc2f 100644 --- a/test/output-economy/fixtures.ts +++ b/test/output-economy/fixtures.ts @@ -1,7 +1,7 @@ import type { CaptureSnapshotResult, CommandRequestResult } from '@agent-device/contracts/client'; import { AppError } from '@agent-device/kernel/errors'; import { attachRefs, type RawSnapshotNode } from '@agent-device/kernel/snapshot'; -import type { DaemonResponseData } from '../../src/daemon/types.ts'; +import type { DaemonResponseData } from '../../src/daemon/daemon-request.ts'; const SNAPSHOT_NODES: RawSnapshotNode[] = [ { diff --git a/test/output-economy/selection-fixtures.ts b/test/output-economy/selection-fixtures.ts index eeb4388e95..d45c1dce61 100644 --- a/test/output-economy/selection-fixtures.ts +++ b/test/output-economy/selection-fixtures.ts @@ -1,5 +1,5 @@ import type { DebugSymbolsResult } from '@agent-device/contracts/observability'; -import type { DaemonResponseData } from '../../src/daemon/types.ts'; +import type { DaemonResponseData } from '../../src/daemon/daemon-request.ts'; const requestBody = JSON.stringify({ cartId: 'cart-economy-fixture', diff --git a/test/wire-compat/closure-policy.ts b/test/wire-compat/closure-policy.ts index 3122e12192..20d565e028 100644 --- a/test/wire-compat/closure-policy.ts +++ b/test/wire-compat/closure-policy.ts @@ -43,11 +43,11 @@ export const WIRE_CLOSURE_WAIVERS: Readonly> = { 'Local detail bag behind AppError; the wire form is DaemonError.details, typed as Record and listed.', 'src/daemon/client/daemon-client-metadata.ts#DaemonInfo': 'Client-side record of where a daemon is listening (pid, ports, state dir). Never serialized into a request or response.', - 'src/daemon/types.ts#DaemonRequest': - 'Re-export alias of the listed kernel DaemonRequest; the declaration that fixes the shape is packages/kernel/src/contracts.ts#DaemonRequest.', - 'src/daemon/types.ts#DaemonResponse': + 'src/daemon/daemon-request.ts#DaemonRequest': + 'Server-side narrowing of the listed kernel DaemonRequest; the declaration that fixes the shape is packages/kernel/src/contracts.ts#DaemonRequest.', + 'src/daemon/daemon-request.ts#DaemonResponse': 'Re-export alias of the listed kernel DaemonResponse; the shape is fixed by packages/kernel/src/contracts.ts#DaemonResponse.', - 'src/daemon/types.ts#DaemonArtifact': + 'src/daemon/daemon-request.ts#DaemonArtifact': 'Re-export alias of the listed kernel DaemonArtifact; the shape is fixed by packages/kernel/src/contracts.ts#DaemonArtifact.', 'src/remote/upload-stream.ts#UploadStreamProgressOptions': 'Byte-progress callback options for local upload rendering. The bytes counted are digested through the request/response declarations; these options never cross the wire.',