Skip to content

Commit bd08e6e

Browse files
thymikeeclaude
andauthored
refactor(contracts): move single-owner modules out of @agent-device/contracts (#2357)
* refactor(daemon): move root-only contracts vocabulary into its owning zone Six @agent-device/contracts modules had no consumer outside the root zones, so the shared vocabulary package carried types only the daemon and root composition ever read. Each one moves to the zone that owns it and every consumer switches to the owning module; no re-export stays behind at the old contracts path. - perf-runtime-plan, snapshot-timeout-evidence, platform-resource-cleanup -> src/daemon - daemon-owner-cleanup -> src/ - interaction-error -> src/core wait-runtime-plan stays in contracts: @agent-device/command-registry consumes it, so it is not root-only after the registry package landed. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SdXHhx9NkfH1PT4XjYe7tE * refactor(platform): move single-consumer contracts modules into their platform package Four modules in @agent-device/contracts had exactly one consuming package, so the shared vocabulary carried Android- and Apple-specific shapes no other zone could use. Each moves into the package that owns it, with every consumer switched to the owning module and no re-export left at the old contracts path. - android-helper-artifacts -> platform-android/src/helper-artifacts.ts - android-touch-plan -> platform-android/src/touch-plan-lowering.ts, which also retires the package-local touch-plan.ts re-export barrel that existed only to give the contracts module a local name - snapshot-presentation -> platform-android/src/snapshot-presentation-node.ts (renamed to keep the package's existing Android-specific snapshot-presentation.ts distinct) - apple-multitouch-support -> platform-apple/src/multitouch-support.ts APPLE_OS_DISPLAY_NAMES folds into gesture-admission.ts, its one remaining contracts caller, so both gesture refusals still share one copy of the wording without a new contracts subpath for a table its own doc calls non-public. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SdXHhx9NkfH1PT4XjYe7tE * refactor(core): move the replay divergence implementation into src/core replay-divergence.ts mixed the wire vocabulary every zone reads with the sanitizing, bounding and reporting implementation only root zones call. The ten value consumers are all root (daemon replay, the session replay coordinator, the daemon client lifecycle, the replay-test reporter, the command error projection, and the MCP tool error), so the implementation moves to src/core/replay-divergence.ts and carries its test unchanged. The types stay in contracts and keep the @agent-device/contracts/divergence subpath, which packages/ad-replay and packages/selectors type-import. ReplayVarScrubEntry follows the implementation: it is the sanitizer's own parameter shape, not part of the divergence wire report. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SdXHhx9NkfH1PT4XjYe7tE * chore(gates): shrink the contracts export surface by the moved subpaths The nine relocated modules no longer live in @agent-device/contracts, so its exports map drops their subpaths (118 -> 109) and scripts/layering/contracts-exports.snapshot.json is regenerated from the manifest, which is what R11 package-boundaries diffs the live surface against. The two resolution assertions naming the retired snapshot-presentation and snapshot-timeout-evidence subpaths go with them; interaction, snapshot and react-native-overlay still cover both the direct-module and facade shapes the assertions were there to prove. The property tests that needed fast-check left with snapshot-presentation and replay-divergence, so the dependency moves too: contracts drops it and platform-android declares it, as fallow's unused-devDependency check reports. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SdXHhx9NkfH1PT4XjYe7tE --------- Co-authored-by: Claude <[email protected]>
1 parent 2ec4e91 commit bd08e6e

76 files changed

Lines changed: 611 additions & 694 deletions

File tree

Some content is hidden

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

‎packages/contracts/package.json‎

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
"dependencies": {
88
"@agent-device/kernel": "workspace:*"
99
},
10-
"devDependencies": {
11-
"fast-check": "^4.9.0"
12-
},
1310
"exports": {
1411
"./alert-contract": {
1512
"types": "./src/alert-contract.ts",
@@ -23,10 +20,6 @@
2320
"types": "./src/android-clipboard-support.ts",
2421
"default": "./src/android-clipboard-support.ts"
2522
},
26-
"./android-helper-artifacts": {
27-
"types": "./src/android-helper-artifacts.ts",
28-
"default": "./src/android-helper-artifacts.ts"
29-
},
3023
"./android-input-ownership": {
3124
"types": "./src/android-input-ownership.ts",
3225
"default": "./src/android-input-ownership.ts"
@@ -43,10 +36,6 @@
4336
"types": "./src/android-system-chrome.ts",
4437
"default": "./src/android-system-chrome.ts"
4538
},
46-
"./android-touch-plan": {
47-
"types": "./src/android-touch-plan.ts",
48-
"default": "./src/android-touch-plan.ts"
49-
},
5039
"./app-deployment-runtime": {
5140
"types": "./src/app-deployment-runtime.ts",
5241
"default": "./src/app-deployment-runtime.ts"
@@ -75,10 +64,6 @@
7564
"types": "./src/app-switcher-runtime.ts",
7665
"default": "./src/app-switcher-runtime.ts"
7766
},
78-
"./apple-multitouch-support": {
79-
"types": "./src/apple-multitouch-support.ts",
80-
"default": "./src/apple-multitouch-support.ts"
81-
},
8267
"./apple-runner-request": {
8368
"types": "./src/apple-runner-request.ts",
8469
"default": "./src/apple-runner-request.ts"
@@ -167,10 +152,6 @@
167152
"types": "./src/daemon-http.ts",
168153
"default": "./src/daemon-http.ts"
169154
},
170-
"./daemon-owner-cleanup": {
171-
"types": "./src/daemon-owner-cleanup.ts",
172-
"default": "./src/daemon-owner-cleanup.ts"
173-
},
174155
"./device": {
175156
"types": "./src/facades/device.ts",
176157
"default": "./src/facades/device.ts"
@@ -239,10 +220,6 @@
239220
"types": "./src/interaction.ts",
240221
"default": "./src/interaction.ts"
241222
},
242-
"./interaction-error": {
243-
"types": "./src/interaction-error.ts",
244-
"default": "./src/interaction-error.ts"
245-
},
246223
"./is-predicate": {
247224
"types": "./src/is-predicate.ts",
248225
"default": "./src/is-predicate.ts"
@@ -323,10 +300,6 @@
323300
"types": "./src/perf-runtime-operation-builder.ts",
324301
"default": "./src/perf-runtime-operation-builder.ts"
325302
},
326-
"./perf-runtime-plan": {
327-
"types": "./src/perf-runtime-plan.ts",
328-
"default": "./src/perf-runtime-plan.ts"
329-
},
330303
"./platform-module": {
331304
"types": "./src/platform-module.ts",
332305
"default": "./src/platform-module.ts"
@@ -339,10 +312,6 @@
339312
"types": "./src/platform-providers.ts",
340313
"default": "./src/platform-providers.ts"
341314
},
342-
"./platform-resource-cleanup": {
343-
"types": "./src/platform-resource-cleanup.ts",
344-
"default": "./src/platform-resource-cleanup.ts"
345-
},
346315
"./platform-runtime": {
347316
"types": "./src/platform-runtime.ts",
348317
"default": "./src/platform-runtime.ts"
@@ -435,10 +404,6 @@
435404
"types": "./src/facades/snapshot.ts",
436405
"default": "./src/facades/snapshot.ts"
437406
},
438-
"./snapshot-presentation": {
439-
"types": "./src/snapshot-presentation.ts",
440-
"default": "./src/snapshot-presentation.ts"
441-
},
442407
"./snapshot-runtime": {
443408
"types": "./src/snapshot-runtime.ts",
444409
"default": "./src/snapshot-runtime.ts"
@@ -447,10 +412,6 @@
447412
"types": "./src/snapshot-scope.ts",
448413
"default": "./src/snapshot-scope.ts"
449414
},
450-
"./snapshot-timeout-evidence": {
451-
"types": "./src/snapshot-timeout-evidence.ts",
452-
"default": "./src/snapshot-timeout-evidence.ts"
453-
},
454415
"./startup-recovery-fence": {
455416
"types": "./src/startup-recovery-fence.ts",
456417
"default": "./src/startup-recovery-fence.ts"

‎packages/contracts/src/apple-os-display-names.ts‎

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
export {
2-
REPLAY_DIVERGENCE_DEFAULT_REF_LIMIT,
3-
REPLAY_DIVERGENCE_DIGEST_REF_LIMIT,
4-
REPLAY_DIVERGENCE_LEVEL_BYTE_LIMITS,
5-
REPLAY_DIVERGENCE_SUGGESTION_LIMIT,
6-
applyReplayDivergenceLevelCaps,
7-
boundReplayDivergence,
8-
createReplayDivergenceSanitizer,
9-
formatReplayDivergenceReport,
10-
measureReplayDivergenceBytes,
11-
readReplayDivergenceResume,
12-
sanitizeReplayDivergenceField,
13-
scrubReplayVarValues,
14-
truncateUtf8Field,
15-
} from '../replay-divergence.ts';
161
export type {
172
ReplayDivergence,
183
ReplayDivergenceCause,
@@ -30,5 +15,4 @@ export type {
3015
ReplayDivergenceTargetCandidate,
3116
ReplayDivergenceTargetIdentity,
3217
ReplayRepairHint,
33-
ReplayVarScrubEntry,
3418
} from '../replay-divergence.ts';

‎packages/contracts/src/gesture-admission.ts‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
11
import {
22
isApplePlatform,
33
resolveDeviceAppleOs,
4+
type AppleOS,
45
type DeviceInfo,
56
} from '@agent-device/kernel/device';
6-
import { APPLE_OS_DISPLAY_NAMES } from './apple-os-display-names.ts';
77
import type { GestureCommandInput } from './gesture-plan-types.ts';
88
import type { GestureRuntimeTier } from './gesture-tier.ts';
99

10+
/**
11+
* How each Apple OS names itself in agent-facing prose.
12+
*
13+
* Owned here because every subject that needs the wording is a gesture refusal: the refusal
14+
* subject below and the Apple adapter's own check (`packages/platform-apple/src/
15+
* multitouch-support.ts`). One table keeps both refusals spelling an OS the same way.
16+
*/
17+
export const APPLE_OS_DISPLAY_NAMES: Record<AppleOS, string> = {
18+
ios: 'iOS',
19+
ipados: 'iPadOS',
20+
tvos: 'tvOS',
21+
watchos: 'watchOS',
22+
visionos: 'visionOS',
23+
macos: 'macOS',
24+
};
25+
1026
/** The hint an owner states when it cannot preserve a target-authored drag's timing. */
1127
export const TARGET_AUTHORED_DRAG_UNSUPPORTED_HINT =
1228
'Target-authored drag requires an adapter that preserves source hold, timed movement, and destination hold; it is supported on Android touch devices and iOS/iPadOS.';

0 commit comments

Comments
 (0)