Skip to content

Commit e9754ae

Browse files
committed
refactor(platforms): sink the shared src/platforms root files into their substrate homes (#2082 W3)
The shared files left directly under src/platforms move onto a declared owner: provisioning mechanics (install-source family, toolchain probing, boot-failure classification, app-resolution caching) form @agent-device/provision-kit above capture-kit; host mechanics resolve to host-kit's seams; kernel takes the pure numeric helpers; contracts keeps vocabulary only. Settings parsing, command-attempt rendering, and the unsupported-interactor factory stay with their families rather than pooling in a substrate package: android and apple settings each own their parsing, and the unsupported-interactor factory lives in root core with a vega-local copy. A platforms-root-shape rule rejects any new shared file or directory appearing directly under src/platforms, and the provision-kit direction gates (no platform imports in, no capture-kit importer) are planted red. Co-Authored-By: Claude <[email protected]> Claude-Session: https://claude.ai/code/session_018VngeKZH6zBuJzNBk5YzUH
1 parent 50b9ac6 commit e9754ae

58 files changed

Lines changed: 378 additions & 86 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/adr/0019-request-bound-platform-runtime.md‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,12 @@ selection, R11/R13 package enumeration, and the composite typecheck project list
153153
> screenshot density and pixel diffing, snapshot occlusion, mobile snapshot semantics,
154154
> quality verdicts and backend capability tables. Snapshot *behavior* is capture domain, not
155155
> contracts vocabulary, and host mechanics are host-kit's, not capture-kit's.
156-
> - `@agent-device/provision-kit` owns provisioning mechanics — install-artifact acquisition
157-
> (local paths, archives, guarded network downloads) and host toolchain probing.
156+
> - `@agent-device/provision-kit` owns the provisioning domain — everything that gets a device
157+
> and app ready to run: install-artifact acquisition (local paths, archives, guarded network
158+
> downloads), host toolchain readiness probing, device boot-failure classification, and
159+
> app-resolution caching. Platform packages may import provision-kit; provision-kit may not
160+
> import a platform package or be imported by capture-kit (both directions planted red in the
161+
> layering suite).
158162
> - The enforced direction is `kernel < contracts < host-kit < capture-kit < provision-kit <
159163
> platform/provider/daemon`.
160164
> - Contracts stays vocabulary, plan models, and pure classification with no process,

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
"check:unit": "pnpm test:unit && pnpm check:tmpdir-leaks && pnpm test:smoke",
162162
"check": "pnpm check:tooling && pnpm check:fallow && pnpm check:unit",
163163
"prepack": "pnpm check:mcp-metadata && pnpm package:npm",
164-
"typecheck": "tsc -b packages/xml packages/kernel packages/contracts packages/host-kit packages/capture-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/ad-replay packages/maestro packages/replay-test packages/provider-webdriver packages/provider-limrun && tsc -p tsconfig.json && tsc -p examples/sdk/tsconfig.json",
164+
"typecheck": "tsc -b packages/xml packages/kernel packages/contracts packages/host-kit packages/capture-kit 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/ad-replay packages/maestro packages/replay-test packages/provider-webdriver packages/provider-limrun && tsc -p tsconfig.json && tsc -p examples/sdk/tsconfig.json",
165165
"test-app:install": "pnpm install --dir examples/test-app",
166166
"test-app:start": "pnpm --dir examples/test-app start",
167167
"test-app:ios": "pnpm --dir examples/test-app ios",
@@ -289,6 +289,7 @@
289289
"@agent-device/platform-web": "workspace:*",
290290
"@agent-device/provider-limrun": "workspace:*",
291291
"@agent-device/provider-webdriver": "workspace:*",
292+
"@agent-device/provision-kit": "workspace:*",
292293
"@agent-device/replay-test": "workspace:*",
293294
"@agent-device/selectors": "workspace:*",
294295
"@agent-device/xml": "workspace:*",

‎packages/capture-kit/package.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
"types": "./src/snapshot-desktop-projection.ts",
5151
"default": "./src/snapshot-desktop-projection.ts"
5252
},
53+
"./snapshot-desktop-projection": {
54+
"types": "./src/snapshot-desktop-projection.ts",
55+
"default": "./src/snapshot-desktop-projection.ts"
56+
},
5357
"./snapshot-occlusion": {
5458
"types": "./src/snapshot-occlusion.ts",
5559
"default": "./src/snapshot-occlusion.ts"

‎packages/kernel/package.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
"types": "./src/location-coordinates.ts",
3838
"default": "./src/location-coordinates.ts"
3939
},
40+
"./numeric": {
41+
"types": "./src/numeric.ts",
42+
"default": "./src/numeric.ts"
43+
},
4044
"./record": {
4145
"types": "./src/record.ts",
4246
"default": "./src/record.ts"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "@agent-device/provision-kit",
3+
"version": "0.0.0",
4+
"private": true,
5+
"type": "module",
6+
"description": "Private provisioning mechanics shared by platform runtimes and daemon orchestration: install-artifact acquisition (local paths, archives, guarded network downloads) and host toolchain probing. Internal workspace package bundled into the published agent-device artifact.",
7+
"dependencies": {
8+
"@agent-device/contracts": "workspace:*",
9+
"@agent-device/host-kit": "workspace:*",
10+
"@agent-device/kernel": "workspace:*",
11+
"ipaddr.js": "^2.5.0",
12+
"undici": "7.29.0"
13+
},
14+
"exports": {
15+
"./app-resolution-cache": {
16+
"types": "./src/app-resolution-cache.ts",
17+
"default": "./src/app-resolution-cache.ts"
18+
},
19+
"./boot-diagnostics": {
20+
"types": "./src/boot-diagnostics.ts",
21+
"default": "./src/boot-diagnostics.ts"
22+
},
23+
"./install-artifact-archive-context": {
24+
"types": "./src/install-artifact-archive-context.ts",
25+
"default": "./src/install-artifact-archive-context.ts"
26+
},
27+
"./install-source": {
28+
"types": "./src/install-source.ts",
29+
"default": "./src/install-source.ts"
30+
},
31+
"./install-source-network": {
32+
"types": "./src/install-source-network.ts",
33+
"default": "./src/install-source-network.ts"
34+
},
35+
"./install-source-network-transport": {
36+
"types": "./src/install-source-network-transport.ts",
37+
"default": "./src/install-source-network-transport.ts"
38+
},
39+
"./toolchain-probe": {
40+
"types": "./src/toolchain-probe.ts",
41+
"default": "./src/toolchain-probe.ts"
42+
}
43+
}
44+
}

src/platforms/__tests__/app-resolution-cache.test.ts renamed to packages/provision-kit/src/app-resolution-cache.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { test } from 'vitest';
22
import assert from 'node:assert/strict';
3-
import { createAppResolutionCache } from '../app-resolution-cache.ts';
3+
import { createAppResolutionCache } from './app-resolution-cache.ts';
44

55
test('app resolution cache returns values until the expiry boundary', () => {
66
let nowMs = 1_000;
File renamed without changes.

src/platforms/__tests__/boot-diagnostics.test.ts renamed to packages/provision-kit/src/boot-diagnostics.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
bootFailureHint,
55
classifyBootFailure,
66
isInfrastructureBootFailureReason,
7-
} from '../boot-diagnostics.ts';
7+
} from './boot-diagnostics.ts';
88
import { AppError } from '@agent-device/kernel/errors';
99

1010
test('classifyBootFailure maps timeout errors', () => {

src/platforms/boot-diagnostics.ts renamed to packages/provision-kit/src/boot-diagnostics.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type BootDiagnosticContext = {
1414
phase?: 'boot' | 'connect' | 'transport';
1515
};
1616

17+
// fallow-ignore-next-line complexity
1718
export function classifyBootFailure(input: {
1819
error?: unknown;
1920
message?: string;

0 commit comments

Comments
 (0)