diff --git a/packages/replay-port/package.json b/packages/replay-port/package.json index 1ef44a972e..98c90fadeb 100644 --- a/packages/replay-port/package.json +++ b/packages/replay-port/package.json @@ -10,9 +10,14 @@ "@agent-device/capture-kit": "workspace:*", "@agent-device/contracts": "workspace:*", "@agent-device/kernel": "workspace:*", + "@agent-device/replay-test": "workspace:*", "@agent-device/selectors": "workspace:*" }, "exports": { + "./command-types": { + "types": "./src/daemon-port/command-types.ts", + "default": "./src/daemon-port/command-types.ts" + }, "./repair-hint": { "types": "./src/daemon-port/repair-hint.ts", "default": "./src/daemon-port/repair-hint.ts" diff --git a/src/daemon/replay/internal/command-types.ts b/packages/replay-port/src/daemon-port/command-types.ts similarity index 100% rename from src/daemon/replay/internal/command-types.ts rename to packages/replay-port/src/daemon-port/command-types.ts diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 19585d69a2..a3236125e5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -518,6 +518,9 @@ importers: '@agent-device/kernel': specifier: workspace:* version: link:../kernel + '@agent-device/replay-test': + specifier: workspace:* + version: link:../replay-test '@agent-device/selectors': specifier: workspace:* version: link:../selectors diff --git a/scripts/layering/architecture-ownership.ts b/scripts/layering/architecture-ownership.ts index 86e3927f27..7f27e29558 100644 --- a/scripts/layering/architecture-ownership.ts +++ b/scripts/layering/architecture-ownership.ts @@ -14,12 +14,6 @@ export type LogicalModulePolicy = Readonly<{ const DAEMON_REPLAY_FACADE = { root: 'src/daemon/replay/index.ts', exports: [ - 'ReplayCoordinator', - 'ReplayDaemonDependencies', - 'ReplayResumeStamper', - 'ReplaySession', - 'ReplaySessionView', - 'ReplayTestVideoOwner', 'appTargetResolutionOptions', 'bindReplaySession', 'buildMaestroReplayTargetDeviceResolutionOptions', diff --git a/src/daemon/handlers/session-replay-command.ts b/src/daemon/handlers/session-replay-command.ts index 32c56297a7..276979ba5b 100644 --- a/src/daemon/handlers/session-replay-command.ts +++ b/src/daemon/handlers/session-replay-command.ts @@ -12,9 +12,11 @@ import { runReplayCommand, runReplayTestCommand, splitReplayCommandRequest, - type ReplayDaemonDependencies, - type ReplaySession, } from '../replay/index.ts'; +import type { + ReplayDaemonDependencies, + ReplaySession, +} from '@agent-device/replay-port/command-types'; import { createReplayCoordinator } from '../session-replay-coordinator.ts'; import { assertSessionSelectorMatches } from '../session-selector.ts'; import { resolveSessionScope } from '../session-routing.ts'; diff --git a/src/daemon/handlers/session-replay-video-owner.ts b/src/daemon/handlers/session-replay-video-owner.ts index e38026b272..fea6dc2e04 100644 --- a/src/daemon/handlers/session-replay-video-owner.ts +++ b/src/daemon/handlers/session-replay-video-owner.ts @@ -4,7 +4,7 @@ import { type ScreenRecordingAdmissionLedger } from '@agent-device/capture-kit/s import type { PlatformRequestScope } from '@agent-device/contracts/platform-runtime-host'; import type { DaemonRequest } from '../daemon-request.ts'; import type { SessionStore } from '../session-store.ts'; -import type { ReplayTestVideoOwner } from '../replay/index.ts'; +import type { ReplayTestVideoOwner } from '@agent-device/replay-port/command-types'; type ReplayRecordVideoRequest = Parameters[0]; diff --git a/src/daemon/replay/__tests__/application.test.ts b/src/daemon/replay/__tests__/application.test.ts index 4f36661832..c26bbf9730 100644 --- a/src/daemon/replay/__tests__/application.test.ts +++ b/src/daemon/replay/__tests__/application.test.ts @@ -23,7 +23,7 @@ import { runReplayTestCommand, splitReplayCommandRequest, } from '../index.ts'; -import type { ReplayCommand, ReplayTestCommand } from '../internal/command-types.ts'; +import type { ReplayCommand, ReplayTestCommand } from '@agent-device/replay-port/command-types'; import { captureSnapshotWithInteractor } from '../../snapshot-interactor-capture.ts'; import { legacyDispatchCapture, diff --git a/src/daemon/replay/__tests__/replay-command-fixture.ts b/src/daemon/replay/__tests__/replay-command-fixture.ts index e02ef4e852..e328861264 100644 --- a/src/daemon/replay/__tests__/replay-command-fixture.ts +++ b/src/daemon/replay/__tests__/replay-command-fixture.ts @@ -6,7 +6,7 @@ import { replayDaemonDependencies, } from '../../handlers/session-replay-command.ts'; import { replayInvokeOverDispatch, runReplayCommand, splitReplayCommandRequest } from '../index.ts'; -import type { ReplayCommand } from '../internal/command-types.ts'; +import type { ReplayCommand } from '@agent-device/replay-port/command-types'; export type ReplayCommandTestInput = Readonly<{ req: DaemonRequest; diff --git a/src/daemon/replay/index.ts b/src/daemon/replay/index.ts index 2cd8a74c82..1f9bcabd8a 100644 --- a/src/daemon/replay/index.ts +++ b/src/daemon/replay/index.ts @@ -1,14 +1,6 @@ /** Public replay application seam for daemon handlers and their admitted owner capabilities. */ export { runReplayCommand } from './internal/native-command.ts'; export { runReplayTestCommand } from './internal/test-command.ts'; -export type { - ReplayCoordinator, - ReplayDaemonDependencies, - ReplayResumeStamper, - ReplaySession, - ReplaySessionView, - ReplayTestVideoOwner, -} from './internal/command-types.ts'; export { bindReplaySession } from './internal/replay-session-binding.ts'; export { replayInvokeOverDispatch, diff --git a/src/daemon/replay/internal/__tests__/session-replay-maestro-request.test.ts b/src/daemon/replay/internal/__tests__/session-replay-maestro-request.test.ts index 8102fab292..0e45f0c04d 100644 --- a/src/daemon/replay/internal/__tests__/session-replay-maestro-request.test.ts +++ b/src/daemon/replay/internal/__tests__/session-replay-maestro-request.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import type { ReplayDispatchRequest } from '../command-types.ts'; +import type { ReplayDispatchRequest } from '@agent-device/replay-port/command-types'; import { maestroOperationDispatchRequest } from '../session-replay-maestro-request.ts'; const replay: ReplayDispatchRequest = { diff --git a/src/daemon/replay/internal/__tests__/session-test-command-trust.test.ts b/src/daemon/replay/internal/__tests__/session-test-command-trust.test.ts index c86186054c..2436218123 100644 --- a/src/daemon/replay/internal/__tests__/session-test-command-trust.test.ts +++ b/src/daemon/replay/internal/__tests__/session-test-command-trust.test.ts @@ -11,7 +11,7 @@ import { replayDaemonDependencies, } from '../../../handlers/session-replay-command.ts'; import { runReplayTestCommand } from '../../index.ts'; -import type { ReplayCommand, ReplayTestCommand } from '../command-types.ts'; +import type { ReplayCommand, ReplayTestCommand } from '@agent-device/replay-port/command-types'; import { replayScriptSourceBundleFor } from '../../../../__tests__/test-utils/replay-script-source.ts'; import { mkdtempForTestSync } from '../../../../__tests__/test-utils/tmp-dir.ts'; import type { DaemonInvokeFn, DaemonRequest } from '../../../daemon-request.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 9abe5a27cf..90a253a9b0 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 @@ -18,7 +18,7 @@ import { runReplayTestCommand, splitReplayCommandRequest, } from '../../index.ts'; -import type { ReplayTestCommand } from '../command-types.ts'; +import type { ReplayTestCommand } from '@agent-device/replay-port/command-types'; 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'; diff --git a/src/daemon/replay/internal/native-command.ts b/src/daemon/replay/internal/native-command.ts index 66c4542a33..50ba57430a 100644 --- a/src/daemon/replay/internal/native-command.ts +++ b/src/daemon/replay/internal/native-command.ts @@ -20,7 +20,7 @@ import type { ReplayCoordinator, ReplaySessionState, ReplaySessionStore, -} from './command-types.ts'; +} from '@agent-device/replay-port/command-types'; import { errorResponse, type DaemonResponse } from '@agent-device/kernel/contracts'; /** diff --git a/src/daemon/replay/internal/replay-dispatch-envelope.ts b/src/daemon/replay/internal/replay-dispatch-envelope.ts index 90fa070d3a..653b60890d 100644 --- a/src/daemon/replay/internal/replay-dispatch-envelope.ts +++ b/src/daemon/replay/internal/replay-dispatch-envelope.ts @@ -3,7 +3,11 @@ import type { DaemonWireRequest } from '@agent-device/contracts/command'; import type { ReplayDispatchOptions } from '@agent-device/contracts/replay'; import { stripUndefined } from '@agent-device/kernel/record'; import type { DaemonResponse } from '@agent-device/kernel/contracts'; -import type { ReplayCommand, ReplayDispatchRequest, ReplayInvoke } from './command-types.ts'; +import type { + ReplayCommand, + ReplayDispatchRequest, + ReplayInvoke, +} from '@agent-device/replay-port/command-types'; /** The request-private facts replay's own decisions read, as the daemon resolves them. */ export type ReplayPrivateAdmission = Readonly<{ diff --git a/src/daemon/replay/internal/replay-session-binding.ts b/src/daemon/replay/internal/replay-session-binding.ts index 04b8be3ba8..d7f2d66108 100644 --- a/src/daemon/replay/internal/replay-session-binding.ts +++ b/src/daemon/replay/internal/replay-session-binding.ts @@ -5,7 +5,7 @@ import type { ReplaySessionObservation, ReplaySessionState, ReplaySessionStore, -} from './command-types.ts'; +} from '@agent-device/replay-port/command-types'; /** * The live session record reached through the reads replay binds over. The daemon implements it diff --git a/src/daemon/replay/internal/session-replay-action-runtime.ts b/src/daemon/replay/internal/session-replay-action-runtime.ts index 3d19f06cc9..2af67a320d 100644 --- a/src/daemon/replay/internal/session-replay-action-runtime.ts +++ b/src/daemon/replay/internal/session-replay-action-runtime.ts @@ -4,7 +4,7 @@ import type { ReplayDaemonDependencies, ReplayDispatchRequest, ReplayInvoke, -} from './command-types.ts'; +} from '@agent-device/replay-port/command-types'; import { mergeParentFlags } from '@agent-device/command-registry/batch'; 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 ad9ea95306..41393349fd 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 { ReplayDispatchRequest } from './command-types.ts'; +import type { ReplayDispatchRequest } from '@agent-device/replay-port/command-types'; import type { AdReplayDispatchGuard, AdReplayDispatchOutcome, diff --git a/src/daemon/replay/internal/session-replay-divergence-publication.ts b/src/daemon/replay/internal/session-replay-divergence-publication.ts index d7105eae8a..a0af9451c0 100644 --- a/src/daemon/replay/internal/session-replay-divergence-publication.ts +++ b/src/daemon/replay/internal/session-replay-divergence-publication.ts @@ -5,7 +5,10 @@ import { redactDiagnosticData } from '@agent-device/kernel/redaction'; import { type ReplayDivergence } from '@agent-device/contracts/divergence'; import { boundReplayDivergence } from '@agent-device/ad-replay/divergence'; import type { ReplayObservationEvidence } from '@agent-device/contracts/replay'; -import type { ReplaySessionObservation, ReplaySessionStore } from './command-types.ts'; +import type { + ReplaySessionObservation, + ReplaySessionStore, +} from '@agent-device/replay-port/command-types'; /** * Daemon-owned replay projection and publication boundary. The response or diff --git a/src/daemon/replay/internal/session-replay-divergence.ts b/src/daemon/replay/internal/session-replay-divergence.ts index 613bbedf9f..569cf44a6e 100644 --- a/src/daemon/replay/internal/session-replay-divergence.ts +++ b/src/daemon/replay/internal/session-replay-divergence.ts @@ -21,7 +21,7 @@ import type { ReplaySessionObservation, ReplaySessionState, ReplaySessionStore, -} from './command-types.ts'; +} from '@agent-device/replay-port/command-types'; import type { ReplayObservationEvidence } from '@agent-device/contracts/replay'; import { boundReplayDivergenceForSession } from './session-replay-divergence-publication.ts'; diff --git a/src/daemon/replay/internal/session-replay-maestro-failure.ts b/src/daemon/replay/internal/session-replay-maestro-failure.ts index 1e1a4f713a..f545111e80 100644 --- a/src/daemon/replay/internal/session-replay-maestro-failure.ts +++ b/src/daemon/replay/internal/session-replay-maestro-failure.ts @@ -15,7 +15,7 @@ import type { ReplaySessionObservation, ReplaySessionState, ReplaySessionStore, -} from './command-types.ts'; +} from '@agent-device/replay-port/command-types'; import type { ReplayReportAction } from './session-replay-report-action.ts'; import { rankAndDedupeReplaySuggestions } from './session-replay-suggestion-ranking.ts'; import { diff --git a/src/daemon/replay/internal/session-replay-maestro-request.ts b/src/daemon/replay/internal/session-replay-maestro-request.ts index a95e077f2d..9c4ffcd615 100644 --- a/src/daemon/replay/internal/session-replay-maestro-request.ts +++ b/src/daemon/replay/internal/session-replay-maestro-request.ts @@ -4,7 +4,7 @@ import type { } from '@agent-device/maestro/daemon-runtime-port'; import type { ReplayDispatchOptions } from '@agent-device/contracts/replay'; import { stripUndefined } from '@agent-device/kernel/record'; -import type { ReplayDispatchRequest } from './command-types.ts'; +import type { ReplayDispatchRequest } from '@agent-device/replay-port/command-types'; /** * The daemon half of the Maestro runtime port. The port projects a flow step onto one public diff --git a/src/daemon/replay/internal/session-replay-maestro-response.ts b/src/daemon/replay/internal/session-replay-maestro-response.ts index c874cb0ac5..a72ee9bbfd 100644 --- a/src/daemon/replay/internal/session-replay-maestro-response.ts +++ b/src/daemon/replay/internal/session-replay-maestro-response.ts @@ -3,7 +3,7 @@ import type { MaestroExecutionOutcome } from '@agent-device/maestro'; import { normalizeError } from '@agent-device/kernel/errors'; import { summarizeSnapshotTimingSamples } from '@agent-device/contracts/capture'; import { buildTypedMaestroFailureResponse } from './session-replay-maestro-failure.ts'; -import type { ReplayCommand, ReplaySessionStore } from './command-types.ts'; +import type { ReplayCommand, ReplaySessionStore } from '@agent-device/replay-port/command-types'; import { type DaemonResponse } from '@agent-device/kernel/contracts'; type TypedMaestroSuccessResponseParams = Readonly<{ diff --git a/src/daemon/replay/internal/session-replay-maestro-runtime.ts b/src/daemon/replay/internal/session-replay-maestro-runtime.ts index 2e4235e628..8c4a46a5c8 100644 --- a/src/daemon/replay/internal/session-replay-maestro-runtime.ts +++ b/src/daemon/replay/internal/session-replay-maestro-runtime.ts @@ -30,7 +30,11 @@ import { REPLAY_SCRIPT_SOURCE_REQUIRED_MESSAGE, } from '@agent-device/replay-port/script-source'; import type { ReplayScriptSourceBundle } from '@agent-device/contracts/replay'; -import type { ReplayCommand, ReplayDispatchRequest, ReplaySessionStore } from './command-types.ts'; +import type { + ReplayCommand, + ReplayDispatchRequest, + ReplaySessionStore, +} from '@agent-device/replay-port/command-types'; import { errorResponse, type DaemonResponse, diff --git a/src/daemon/replay/internal/session-replay-resume.ts b/src/daemon/replay/internal/session-replay-resume.ts index fd738e6ec5..824545ce2d 100644 --- a/src/daemon/replay/internal/session-replay-resume.ts +++ b/src/daemon/replay/internal/session-replay-resume.ts @@ -1,6 +1,6 @@ import type { SessionAction } from '@agent-device/contracts/session'; import type { ReplayDivergenceResume, ReplayRepairHint } from '@agent-device/contracts/divergence'; -import type { ReplayResumeStamper } from './command-types.ts'; +import type { ReplayResumeStamper } from '@agent-device/replay-port/command-types'; /** * Builds the `resume` object and, through the caller's `ReplayResumeStamper` — the narrow 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 5f52681f95..3c6db1b2cc 100644 --- a/src/daemon/replay/internal/session-replay-runtime-engine-adapter.ts +++ b/src/daemon/replay/internal/session-replay-runtime-engine-adapter.ts @@ -7,7 +7,7 @@ import type { ReplayInvoke, ReplaySessionObservation, ReplaySessionStore, -} from './command-types.ts'; +} from '@agent-device/replay-port/command-types'; import { readReplaySelectorDisplayValue } from '@agent-device/selectors'; import { type DaemonResponse, diff --git a/src/daemon/replay/internal/session-replay-runtime-failure.ts b/src/daemon/replay/internal/session-replay-runtime-failure.ts index f5e951fedb..6c4978b54a 100644 --- a/src/daemon/replay/internal/session-replay-runtime-failure.ts +++ b/src/daemon/replay/internal/session-replay-runtime-failure.ts @@ -16,7 +16,7 @@ import type { ReplayResumeStamper, ReplaySessionObservation, ReplaySessionStore, -} from './command-types.ts'; +} from '@agent-device/replay-port/command-types'; import { type DaemonResponse } from '@agent-device/kernel/contracts'; export async function withReplayFailureDiagnostics(params: { diff --git a/src/daemon/replay/internal/session-replay-runtime-plan.ts b/src/daemon/replay/internal/session-replay-runtime-plan.ts index 605ca42827..1b361352a4 100644 --- a/src/daemon/replay/internal/session-replay-runtime-plan.ts +++ b/src/daemon/replay/internal/session-replay-runtime-plan.ts @@ -7,7 +7,7 @@ import type { ReplayDispatchRequest, ReplaySessionState, ReplaySessionStore, -} from './command-types.ts'; +} from '@agent-device/replay-port/command-types'; import { buildReplayScriptPlatformFlags } from './replay-script-selection.ts'; import { inspectAdReplay, diff --git a/src/daemon/replay/internal/session-replay-runtime-session.ts b/src/daemon/replay/internal/session-replay-runtime-session.ts index b08890a16e..bf4fb80db1 100644 --- a/src/daemon/replay/internal/session-replay-runtime-session.ts +++ b/src/daemon/replay/internal/session-replay-runtime-session.ts @@ -1,6 +1,10 @@ import fs from 'node:fs'; import type { DaemonWireRequest } from '@agent-device/contracts/command'; -import type { ReplayCoordinator, ReplaySessionStore, ReplaySessionView } from './command-types.ts'; +import type { + ReplayCoordinator, + ReplaySessionStore, + ReplaySessionView, +} from '@agent-device/replay-port/command-types'; import { expandSessionPath } from '@agent-device/host-kit/session-paths'; import { healedScriptSiblingPath } from './session-replay-heal.ts'; import { diff --git a/src/daemon/replay/internal/session-replay-target-verification.ts b/src/daemon/replay/internal/session-replay-target-verification.ts index b2689cc7bb..736aa9540d 100644 --- a/src/daemon/replay/internal/session-replay-target-verification.ts +++ b/src/daemon/replay/internal/session-replay-target-verification.ts @@ -45,7 +45,7 @@ import type { ReplaySessionObservation, ReplaySessionState, ReplaySessionStore, -} from './command-types.ts'; +} from '@agent-device/replay-port/command-types'; import { computeReplayRepairHint, type ReplayRepairHintCapture, diff --git a/src/daemon/replay/internal/session-replay-video-recording.ts b/src/daemon/replay/internal/session-replay-video-recording.ts index 875a28d35b..fd93dddef6 100644 --- a/src/daemon/replay/internal/session-replay-video-recording.ts +++ b/src/daemon/replay/internal/session-replay-video-recording.ts @@ -9,7 +9,7 @@ import type { ReplayRecordVideoRequest, ReplaySessionStore, ReplayTestVideoOwner, -} from './command-types.ts'; +} from '@agent-device/replay-port/command-types'; import { defaultRecordingPath, recordingExtensionForPlatform, diff --git a/src/daemon/replay/internal/test-command.ts b/src/daemon/replay/internal/test-command.ts index 3a70d6d372..0dee0c807a 100644 --- a/src/daemon/replay/internal/test-command.ts +++ b/src/daemon/replay/internal/test-command.ts @@ -11,7 +11,7 @@ import type { import { REPLAY_SCRIPT_SOURCE_REQUIRED_MESSAGE } from '@agent-device/replay-port/script-source'; import type { ReplayScriptMetadata } from '@agent-device/ad-script'; import { expandSessionPath } from '@agent-device/host-kit/session-paths'; -import type { ReplayCommand, ReplayTestCommand } from './command-types.ts'; +import type { ReplayCommand, ReplayTestCommand } from '@agent-device/replay-port/command-types'; import { runReplayTestSuite, type ReplayTestBindAttemptCancellation, diff --git a/src/daemon/session-replay-coordinator.ts b/src/daemon/session-replay-coordinator.ts index c99895c212..787fde430d 100644 --- a/src/daemon/session-replay-coordinator.ts +++ b/src/daemon/session-replay-coordinator.ts @@ -16,12 +16,12 @@ import { scriptTargetPath, type SessionScriptPublicationState, } from './session-script-publication-state.ts'; -import { - healedScriptSiblingPath, - type ReplayCoordinator, - type ReplayResumeStamper, - type ReplaySessionView, -} from './replay/index.ts'; +import { healedScriptSiblingPath } from './replay/index.ts'; +import type { + ReplayCoordinator, + ReplayResumeStamper, + ReplaySessionView, +} from '@agent-device/replay-port/command-types'; /** * `ReplayCoordinator` (#1478 P4b): the single daemon-owned gateway a native `.ad` replay request