Skip to content

Commit ad6cbf0

Browse files
committed
refactor(replay): move dispatch projections into replay-port
1 parent f1fc364 commit ad6cbf0

14 files changed

Lines changed: 33 additions & 23 deletions

‎packages/replay-port/package.json‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"@agent-device/capture-kit": "workspace:*",
1111
"@agent-device/contracts": "workspace:*",
1212
"@agent-device/kernel": "workspace:*",
13+
"@agent-device/maestro": "workspace:*",
1314
"@agent-device/replay-test": "workspace:*",
1415
"@agent-device/selectors": "workspace:*"
1516
},
@@ -29,6 +30,14 @@
2930
"./session-replay-vars": {
3031
"types": "./src/session-replay-vars.ts",
3132
"default": "./src/session-replay-vars.ts"
33+
},
34+
"./replay-dispatch-envelope": {
35+
"types": "./src/daemon-port/replay-dispatch-envelope.ts",
36+
"default": "./src/daemon-port/replay-dispatch-envelope.ts"
37+
},
38+
"./session-replay-maestro-request": {
39+
"types": "./src/daemon-port/session-replay-maestro-request.ts",
40+
"default": "./src/daemon-port/session-replay-maestro-request.ts"
3241
}
3342
}
3443
}

src/daemon/replay/internal/__tests__/replay-dispatch-envelope.test.ts renamed to packages/replay-port/src/daemon-port/__tests__/replay-dispatch-envelope.test.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import { expect, test } from 'vitest';
2-
import type { DaemonRequest } from '../../../daemon-request.ts';
2+
import type { ReplayDispatchOptions } from '@agent-device/contracts/replay';
3+
import type { ReplayPrivateAdmission, ReplayRequest } from '../replay-dispatch-envelope.ts';
34
import { replayInvokeOverDispatch } from '../replay-dispatch-envelope.ts';
45

6+
type TestRequest = ReplayRequest<ReplayPrivateAdmission & ReplayDispatchOptions>;
7+
58
test('replayInvokeOverDispatch re-attaches the originating private half, then folds the dispatch bag over it', async () => {
6-
const base: DaemonRequest = {
9+
const base: TestRequest = {
710
token: 'token',
811
session: 'default',
912
command: 'replay',
@@ -16,7 +19,7 @@ test('replayInvokeOverDispatch re-attaches the originating private half, then fo
1619
},
1720
},
1821
};
19-
const invoked: DaemonRequest[] = [];
22+
const invoked: TestRequest[] = [];
2023
const invoke = replayInvokeOverDispatch(async (request) => {
2124
invoked.push(request);
2225
return { ok: true, data: {} };
@@ -50,7 +53,7 @@ test('replayInvokeOverDispatch re-attaches the originating private half, then fo
5053
});
5154

5255
test('replayInvokeOverDispatch sends no private half when neither side carries one', async () => {
53-
const invoked: DaemonRequest[] = [];
56+
const invoked: TestRequest[] = [];
5457
const invoke = replayInvokeOverDispatch(
5558
async (request) => {
5659
invoked.push(request);

src/daemon/replay/internal/__tests__/session-replay-maestro-request.test.ts renamed to packages/replay-port/src/daemon-port/__tests__/session-replay-maestro-request.test.ts

File renamed without changes.

src/daemon/replay/internal/replay-dispatch-envelope.ts renamed to packages/replay-port/src/daemon-port/replay-dispatch-envelope.ts

File renamed without changes.

src/daemon/replay/internal/session-replay-maestro-request.ts renamed to packages/replay-port/src/daemon-port/session-replay-maestro-request.ts

File renamed without changes.

‎pnpm-lock.yaml‎

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎scripts/layering/architecture-ownership.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ const DAEMON_REPLAY_FACADE = {
2020
'buildReplayScriptPlatformFlags',
2121
'healedScriptSiblingPath',
2222
'readScriptReplaySelection',
23-
'replayInvokeOverDispatch',
2423
'runReplayCommand',
2524
'runReplayTestCommand',
26-
'splitReplayCommandRequest',
2725
],
2826
} as const;
2927

‎src/daemon/handlers/session-replay-command.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ import { bindInternalObservationAuthority } from '../internal-observation.ts';
66
import type { LeaseRegistry } from '../lease-registry.ts';
77
import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from '../request-runtime-binding.ts';
88
import type { PlatformResourceCleanup } from '../platform-resource-cleanup.ts';
9+
import { bindReplaySession, runReplayCommand, runReplayTestCommand } from '../replay/index.ts';
910
import {
10-
bindReplaySession,
1111
replayInvokeOverDispatch,
12-
runReplayCommand,
13-
runReplayTestCommand,
1412
splitReplayCommandRequest,
15-
} from '../replay/index.ts';
13+
} from '@agent-device/replay-port/replay-dispatch-envelope';
1614
import type {
1715
ReplayDaemonDependencies,
1816
ReplaySession,

‎src/daemon/replay/__tests__/application.test.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@ import {
1717
createReplaySession,
1818
replayDaemonDependencies,
1919
} from '../../handlers/session-replay-command.ts';
20+
import { runReplayCommand, runReplayTestCommand } from '../index.ts';
2021
import {
2122
replayInvokeOverDispatch,
22-
runReplayCommand,
23-
runReplayTestCommand,
2423
splitReplayCommandRequest,
25-
} from '../index.ts';
24+
} from '@agent-device/replay-port/replay-dispatch-envelope';
2625
import type { ReplayCommand, ReplayTestCommand } from '@agent-device/replay-port/command-types';
2726
import { captureSnapshotWithInteractor } from '../../snapshot-interactor-capture.ts';
2827
import {

‎src/daemon/replay/__tests__/replay-command-fixture.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import {
55
createReplaySession,
66
replayDaemonDependencies,
77
} from '../../handlers/session-replay-command.ts';
8-
import { replayInvokeOverDispatch, runReplayCommand, splitReplayCommandRequest } from '../index.ts';
8+
import { runReplayCommand } from '../index.ts';
9+
import {
10+
replayInvokeOverDispatch,
11+
splitReplayCommandRequest,
12+
} from '@agent-device/replay-port/replay-dispatch-envelope';
913
import type { ReplayCommand } from '@agent-device/replay-port/command-types';
1014

1115
export type ReplayCommandTestInput = Readonly<{

0 commit comments

Comments
 (0)