Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/replay-port/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"@agent-device/capture-kit": "workspace:*",
"@agent-device/contracts": "workspace:*",
"@agent-device/kernel": "workspace:*",
"@agent-device/maestro": "workspace:*",
"@agent-device/replay-test": "workspace:*",
"@agent-device/selectors": "workspace:*"
},
Expand All @@ -22,10 +23,18 @@
"types": "./src/daemon-port/repair-hint.ts",
"default": "./src/daemon-port/repair-hint.ts"
},
"./replay-dispatch-envelope": {
"types": "./src/daemon-port/replay-dispatch-envelope.ts",
"default": "./src/daemon-port/replay-dispatch-envelope.ts"
},
"./script-source": {
"types": "./src/daemon-port/script-source.ts",
"default": "./src/daemon-port/script-source.ts"
},
"./session-replay-maestro-request": {
"types": "./src/daemon-port/session-replay-maestro-request.ts",
"default": "./src/daemon-port/session-replay-maestro-request.ts"
},
"./session-replay-vars": {
"types": "./src/session-replay-vars.ts",
"default": "./src/session-replay-vars.ts"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { expect, test } from 'vitest';
import type { DaemonRequest } from '../../../daemon-request.ts';
import type { ReplayDispatchOptions } from '@agent-device/contracts/replay';
import type { ReplayPrivateAdmission, ReplayRequest } from '../replay-dispatch-envelope.ts';
import { replayInvokeOverDispatch } from '../replay-dispatch-envelope.ts';

type TestRequest = ReplayRequest<ReplayPrivateAdmission & ReplayDispatchOptions>;

test('replayInvokeOverDispatch re-attaches the originating private half, then folds the dispatch bag over it', async () => {
const base: DaemonRequest = {
const base: TestRequest = {
token: 'token',
session: 'default',
command: 'replay',
Expand All @@ -16,7 +19,7 @@ test('replayInvokeOverDispatch re-attaches the originating private half, then fo
},
},
};
const invoked: DaemonRequest[] = [];
const invoked: TestRequest[] = [];
const invoke = replayInvokeOverDispatch(async (request) => {
invoked.push(request);
return { ok: true, data: {} };
Expand Down Expand Up @@ -50,7 +53,7 @@ test('replayInvokeOverDispatch re-attaches the originating private half, then fo
});

test('replayInvokeOverDispatch sends no private half when neither side carries one', async () => {
const invoked: DaemonRequest[] = [];
const invoked: TestRequest[] = [];
const invoke = replayInvokeOverDispatch(
async (request) => {
invoked.push(request);
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions scripts/layering/architecture-ownership.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ const DAEMON_REPLAY_FACADE = {
'buildReplayScriptPlatformFlags',
'healedScriptSiblingPath',
'readScriptReplaySelection',
'replayInvokeOverDispatch',
'runReplayCommand',
'runReplayTestCommand',
'splitReplayCommandRequest',
],
} as const;

Expand Down
6 changes: 2 additions & 4 deletions src/daemon/handlers/session-replay-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ import { bindInternalObservationAuthority } from '../internal-observation.ts';
import type { LeaseRegistry } from '../lease-registry.ts';
import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from '../request-runtime-binding.ts';
import type { PlatformResourceCleanup } from '../platform-resource-cleanup.ts';
import { bindReplaySession, runReplayCommand, runReplayTestCommand } from '../replay/index.ts';
import {
bindReplaySession,
replayInvokeOverDispatch,
runReplayCommand,
runReplayTestCommand,
splitReplayCommandRequest,
} from '../replay/index.ts';
} from '@agent-device/replay-port/replay-dispatch-envelope';
import type {
ReplayDaemonDependencies,
ReplaySession,
Expand Down
5 changes: 2 additions & 3 deletions src/daemon/replay/__tests__/application.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ import {
createReplaySession,
replayDaemonDependencies,
} from '../../handlers/session-replay-command.ts';
import { runReplayCommand, runReplayTestCommand } from '../index.ts';
import {
replayInvokeOverDispatch,
runReplayCommand,
runReplayTestCommand,
splitReplayCommandRequest,
} from '../index.ts';
} from '@agent-device/replay-port/replay-dispatch-envelope';
import type { ReplayCommand, ReplayTestCommand } from '@agent-device/replay-port/command-types';
import { captureSnapshotWithInteractor } from '../../snapshot-interactor-capture.ts';
import {
Expand Down
6 changes: 5 additions & 1 deletion src/daemon/replay/__tests__/replay-command-fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import {
createReplaySession,
replayDaemonDependencies,
} from '../../handlers/session-replay-command.ts';
import { replayInvokeOverDispatch, runReplayCommand, splitReplayCommandRequest } from '../index.ts';
import { runReplayCommand } from '../index.ts';
import {
replayInvokeOverDispatch,
splitReplayCommandRequest,
} from '@agent-device/replay-port/replay-dispatch-envelope';
import type { ReplayCommand } from '@agent-device/replay-port/command-types';

export type ReplayCommandTestInput = Readonly<{
Expand Down
4 changes: 0 additions & 4 deletions src/daemon/replay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
export { runReplayCommand } from './internal/native-command.ts';
export { runReplayTestCommand } from './internal/test-command.ts';
export { bindReplaySession } from './internal/replay-session-binding.ts';
export {
replayInvokeOverDispatch,
splitReplayCommandRequest,
} from './internal/replay-dispatch-envelope.ts';
export { healedScriptSiblingPath } from './internal/session-replay-heal.ts';
export {
appTargetResolutionOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import {
createReplaySession,
replayDaemonDependencies,
} from '../../../handlers/session-replay-command.ts';
import { runReplayTestCommand } from '../../index.ts';
import {
replayInvokeOverDispatch,
runReplayTestCommand,
splitReplayCommandRequest,
} from '../../index.ts';
} from '@agent-device/replay-port/replay-dispatch-envelope';
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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { beforeEach, test, vi } from 'vitest';
import { SessionStore } from '../../../session-store.ts';
import type { DaemonRequest, DaemonResponse } from '../../../daemon-request.ts';
import { makeIosSession } from '../../../../__tests__/test-utils/session-factories.ts';
import { runReplayTestCommand } from '../../index.ts';
import {
replayInvokeOverDispatch,
runReplayTestCommand,
splitReplayCommandRequest,
} from '../../index.ts';
} from '@agent-device/replay-port/replay-dispatch-envelope';
import { mkdtempForTestSync } from '../../../../__tests__/test-utils/tmp-dir.ts';
import { replayScriptSourceBundleFor } from '../../../../__tests__/test-utils/replay-script-source.ts';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { createDaemonMaestroRuntimePort } from '@agent-device/maestro/daemon-run
import type { DeviceInfo } from '@agent-device/kernel/device';
import { buildReplayBuiltinVars } from '@agent-device/replay-port/session-replay-vars';
import { createMaestroReplayObserver } from './session-replay-maestro-observer.ts';
import { maestroOperationDispatchRequest } from './session-replay-maestro-request.ts';
import { maestroOperationDispatchRequest } from '@agent-device/replay-port/session-replay-maestro-request';
import {
buildTypedMaestroReplayErrorResponse,
buildTypedMaestroSuccessResponse,
Expand Down
Loading