Skip to content

Commit 086e30f

Browse files
committed
refactor(replay-port): keep the caller-path collector out of the daemon port
The replay source bundle loader and caller-side path discovery run on the client (#1802: the daemon opens no caller path), yet they sat under packages/replay-port/src/daemon-port/, where nothing stopped daemon code from importing them. Move script-source-bundle, source-discovery, and the request fixture to the replay-port source root, which stays outside the engine-prefix policy and the daemon-port zone; the subpath names are unchanged, so consumers and the CLI closure guard retarget by path only.
1 parent 56dd15c commit 086e30f

8 files changed

Lines changed: 10 additions & 13 deletions

File tree

‎packages/replay-port/package.json‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
"default": "./src/daemon-port/script-source.ts"
5454
},
5555
"./script-source-bundle": {
56-
"types": "./src/daemon-port/script-source-bundle.ts",
57-
"default": "./src/daemon-port/script-source-bundle.ts"
56+
"types": "./src/script-source-bundle.ts",
57+
"default": "./src/script-source-bundle.ts"
5858
},
5959
"./session-replay-action-runtime": {
6060
"types": "./src/daemon-port/session-replay-action-runtime.ts",
@@ -157,12 +157,12 @@
157157
"default": "./src/daemon-port/test-command.ts"
158158
},
159159
"./source-discovery": {
160-
"types": "./src/daemon-port/source-discovery.ts",
161-
"default": "./src/daemon-port/source-discovery.ts"
160+
"types": "./src/source-discovery.ts",
161+
"default": "./src/source-discovery.ts"
162162
},
163163
"./replay-script-source-fixtures": {
164-
"types": "./src/daemon-port/replay-script-source.fixtures.ts",
165-
"default": "./src/daemon-port/replay-script-source.fixtures.ts"
164+
"types": "./src/replay-script-source.fixtures.ts",
165+
"default": "./src/replay-script-source.fixtures.ts"
166166
}
167167
}
168168
}

packages/replay-port/src/daemon-port/__tests__/script-source-bundle.test.ts renamed to packages/replay-port/src/__tests__/script-source-bundle.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
loadReplayScriptSourceBundle,
66
REPLAY_SCRIPT_SOURCE_BUNDLE_MAX_BYTES,
77
} from '@agent-device/replay-port/script-source-bundle';
8-
import { mkdtempForTestSync } from '../../tmp-dir.fixtures.ts';
8+
import { mkdtempForTestSync } from '../tmp-dir.fixtures.ts';
99

1010
// #1802: the caller reads every script file a replay run needs and sends the text. These pin the
1111
// collection itself; that the daemon consumes only the result is pinned beside the replay handler.

packages/replay-port/src/daemon-port/__tests__/source-discovery.test.ts renamed to packages/replay-port/src/__tests__/source-discovery.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import os from 'node:os';
66
import path from 'node:path';
77
import { AppError } from '@agent-device/kernel/errors';
88
import { discoverReplaySourcePaths } from '@agent-device/replay-port/source-discovery';
9-
import { mkdtempForTestSync } from '../../tmp-dir.fixtures.ts';
9+
import { mkdtempForTestSync } from '../tmp-dir.fixtures.ts';
1010

1111
// #1802: path expansion, traversal ordering and file-type routing are CALLER work — `test`
1212
// inputs name files on the machine that typed the command. These pin the traversal itself;

packages/replay-port/src/daemon-port/replay-script-source.fixtures.ts renamed to packages/replay-port/src/replay-script-source.fixtures.ts

File renamed without changes.

packages/replay-port/src/daemon-port/script-source-bundle.ts renamed to packages/replay-port/src/script-source-bundle.ts

File renamed without changes.
File renamed without changes.

‎scripts/__tests__/eager-closure-budgets.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export const APPROVED_OVER_CEILING: Readonly<
135135
> = Object.freeze({
136136
// The single owner of the client-collected replay source bundles tests carry (#1802). Its
137137
// weight is the real collector it exists to share, not fixture code.
138-
'packages/replay-port/src/daemon-port/replay-script-source.fixtures.ts': {
138+
'packages/replay-port/src/replay-script-source.fixtures.ts': {
139139
issue: '#3517',
140140
reason:
141141
'Test-only request fixture whose whole contract is running the real client collector ' +

‎src/__tests__/cli-startup-import-closure.test.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,7 @@ test('the CLI startup import closure never evaluates the Maestro engine', () =>
121121
test('the replay command source closure keeps Maestro behind flow selection', () => {
122122
const replayEntry = path.join(srcRoot, 'commands/replay/index.ts');
123123
const replayClosure = eagerClosureOf(replayEntry);
124-
const sourceBundle = path.join(
125-
srcRoot,
126-
'../packages/replay-port/src/daemon-port/script-source-bundle.ts',
127-
);
124+
const sourceBundle = path.join(srcRoot, '../packages/replay-port/src/script-source-bundle.ts');
128125
const offenders: string[] = [];
129126

130127
expect(replayClosure).toContain(sourceBundle);

0 commit comments

Comments
 (0)