Skip to content

Commit b38b1f9

Browse files
authored
refactor(replay): bootstrap packages/replay-port with the builtin-vars leaf (#2663) (#2769)
* refactor(replay): move the builtin-vars leaf into a new packages/replay-port Bootstraps the daemon-side replay port at the destination decided in #2663. The self-contained builtin-vars module (type-only contracts/ad-script deps, no inbound daemon coupling) moves out; the two staying importers take the owning subpath directly. No compatibility re-export: src/daemon/replay keeps its facade for everything not yet moved. Part of #2663 * chore(gates): register packages/replay-port in the layering model, ownership table, and build Ranked spine rank 1 (with the engines it composes), a replay-port ownership policy forbidding src/daemon|providers|compat, the workspace dep + typecheck build entry, and the regenerated lockfile. Part of #2663
1 parent c32a09c commit b38b1f9

10 files changed

Lines changed: 52 additions & 3 deletions

File tree

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
"check:unit": "pnpm test:unit && pnpm check:tmpdir-leaks && pnpm test:smoke",
172172
"check": "pnpm check:tooling && pnpm check:fallow && pnpm check:unit",
173173
"prepack": "pnpm check:mcp-metadata && pnpm package:npm",
174-
"typecheck": "tsc -b packages/xml packages/kernel packages/contracts packages/device-selection packages/host-kit packages/capture-kit packages/managed-allocation packages/provision-kit packages/platform-apple packages/platform-android packages/platform-harmonyos packages/platform-vega packages/platform-linux packages/platform-web packages/ad-script packages/selectors packages/command-registry packages/session-journal packages/ad-replay packages/maestro packages/replay-test packages/provider-webdriver packages/provider-limrun && tsc -p tsconfig.json && tsc -p examples/sdk/tsconfig.json",
174+
"typecheck": "tsc -b packages/xml packages/kernel packages/contracts packages/device-selection packages/host-kit packages/capture-kit packages/managed-allocation packages/provision-kit packages/platform-apple packages/platform-android packages/platform-harmonyos packages/platform-vega packages/platform-linux packages/platform-web packages/ad-script packages/selectors packages/command-registry packages/session-journal packages/ad-replay packages/maestro packages/replay-port packages/replay-test packages/provider-webdriver packages/provider-limrun && tsc -p tsconfig.json && tsc -p examples/sdk/tsconfig.json",
175175
"test-app:install": "pnpm install --dir examples/test-app",
176176
"test-app:start": "pnpm --dir examples/test-app start",
177177
"test-app:ios": "pnpm --dir examples/test-app ios",
@@ -298,6 +298,7 @@
298298
"@agent-device/provider-limrun": "workspace:*",
299299
"@agent-device/provider-webdriver": "workspace:*",
300300
"@agent-device/provision-kit": "workspace:*",
301+
"@agent-device/replay-port": "workspace:*",
301302
"@agent-device/replay-test": "workspace:*",
302303
"@agent-device/selectors": "workspace:*",
303304
"@agent-device/session-journal": "workspace:*",

‎packages/replay-port/package.json‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "@agent-device/replay-port",
3+
"version": "0.0.0",
4+
"private": true,
5+
"sideEffects": false,
6+
"type": "module",
7+
"description": "Daemon-side replay port: the adapter over the ad-replay, ad-script and replay-test engines.",
8+
"dependencies": {
9+
"@agent-device/ad-script": "workspace:*",
10+
"@agent-device/contracts": "workspace:*"
11+
},
12+
"exports": {
13+
"./session-replay-vars": {
14+
"types": "./src/session-replay-vars.ts",
15+
"default": "./src/session-replay-vars.ts"
16+
}
17+
}
18+
}

src/daemon/replay/internal/__tests__/session-replay-builtin-vars.test.ts renamed to packages/replay-port/src/__tests__/session-replay-builtin-vars.test.ts

File renamed without changes.
File renamed without changes.

‎packages/replay-port/tsconfig.json‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"composite": true,
5+
"noEmit": false,
6+
"emitDeclarationOnly": true,
7+
"declaration": true,
8+
"declarationDir": "./dist-types",
9+
"rootDir": "./src"
10+
},
11+
"include": ["src"]
12+
}

‎pnpm-lock.yaml‎

Lines changed: 12 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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ export const LOGICAL_MODULE_POLICIES = [
142142
'packages/ad-replay/',
143143
],
144144
},
145+
{
146+
name: 'replay-port',
147+
roots: ['packages/replay-port/src/'],
148+
forbiddenTargetRoots: ['src/daemon/', 'src/providers/', 'src/compat/'],
149+
},
145150
{
146151
name: 'daemon-replay',
147152
roots: ['src/daemon/replay/'],

‎scripts/layering/model.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const TARGET_DAG_RANK = new Map([
5050
['contracts', 1],
5151
['device-selection', 1],
5252
['maestro', 1],
53+
['replay-port', 1],
5354
['replay-test', 1],
5455
['screenshot-diff', 1],
5556
['selectors', 1],

‎src/daemon/replay/internal/session-replay-maestro-runtime.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
} from '@agent-device/ad-script';
1818
import { createDaemonMaestroRuntimePort } from '@agent-device/maestro/daemon-runtime-port';
1919
import type { DeviceInfo } from '@agent-device/kernel/device';
20-
import { buildReplayBuiltinVars } from './session-replay-vars.ts';
20+
import { buildReplayBuiltinVars } from '@agent-device/replay-port/session-replay-vars';
2121
import { createMaestroReplayObserver } from './session-replay-maestro-observer.ts';
2222
import { maestroOperationDispatchRequest } from './session-replay-maestro-request.ts';
2323
import {

‎src/daemon/replay/internal/session-replay-runtime-plan.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
resolveReplayFormat,
2323
type ReplayScriptMetadata,
2424
} from '@agent-device/ad-script';
25-
import { buildReplayBuiltinVars } from './session-replay-vars.ts';
25+
import { buildReplayBuiltinVars } from '@agent-device/replay-port/session-replay-vars';
2626
import { runTypedMaestroReplay } from './session-replay-maestro-runtime.ts';
2727
import { errorResponse, type DaemonResponse } from '@agent-device/kernel/contracts';
2828

0 commit comments

Comments
 (0)