Skip to content

Commit 0ecfef1

Browse files
thymikeeclaude
andauthored
refactor(platforms): sink the shared src/platforms root files into their substrate homes (#2100)
* 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 * test: cover the family-owned parsers and the unsupported-interactor factories The settings parsers and the unsupported-interactor factory arrived without owning tests, so their branches rode on callers. Each now has one: the appearance/state parsers over every accepted spelling and their rejections, the attempt summarizer over its arg join and stderr budget, and both interactor factories over the whole operation surface and the per-instance label. Also drops the duplicate ./snapshot-desktop-projection export key that a rebase left in capture-kit's manifest, where JSON silently keeps the last, and the root-shape docblock the violation message already states. Co-Authored-By: Claude <[email protected]> Claude-Session: https://claude.ai/code/session_018VngeKZH6zBuJzNBk5YzUH * docs: keep tool directives only in the touched files Co-Authored-By: Claude <[email protected]> Claude-Session: https://claude.ai/code/session_018VngeKZH6zBuJzNBk5YzUH --------- Co-authored-by: Claude <[email protected]>
1 parent 7a6284b commit 0ecfef1

61 files changed

Lines changed: 571 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/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;

src/platforms/install-artifact-archive-context.ts renamed to packages/provision-kit/src/install-artifact-archive-context.ts

File renamed without changes.

0 commit comments

Comments
 (0)