From 40229b2c641dfc415bd852853357307b9f57c590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Sat, 22 Aug 2026 14:16:27 +0200 Subject: [PATCH 1/2] perf(contracts): granularize entry surfaces so hub importers stop evaluating the facade clump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `@agent-device/contracts/platform` unions 32 vocabulary modules and `/interaction` another 18. A file that value-imports either evaluates the whole union to reach one function, and because permanent hubs sat behind them — `command-descriptor/registry.ts`, `core/capabilities.ts`, `interactors/register-builtins.ts`, `command-descriptor/platform-execution-entry.ts` — that union rode into roughly half the unit suite's test graphs. Give every vocabulary module its own entry subpath and move all value-importers onto the module that owns the symbol. Type-only importers are left alone: `import type` is erased, so it already evaluated nothing. Measured with the #1950 eager-import-closure walker over all 974 unit-core test files, against base e5bfde3d1: aggregate eager module evaluations 143,248 -> 129,738 (-9.4%) facades/platform.ts carried by 466 -> 1 test graphs facades/interaction.ts carried by 451 -> 0 test graphs registry.ts 105 -> 66 capabilities.ts 113 -> 76 register-builtins.ts 111 -> 73 platform-execution-entry.ts 43 -> 3 dispatch.ts 134 -> 100 Three gate adjustments the split forces: - R11's pinned contracts subpath list grows to the new entries, and the resolver test's "must not resolve" example moves to `./clipboard`, since `./gesture-plan` is now a real entry. - R16 anchored the record-runtime join on the literal `contracts/platform` specifier. It now accepts any contracts entry — the assertion's provenance is what the rule pins, not which subpath carried it. - `gesture-plan.ts` became an entry target, and the no-bare-star rule rejects the `export * from './gesture-plan-types.ts'` it carried. Its one internal consumer now imports the owning module directly. Both facades keep their type re-exports for the ~490 type-only importers, so every symbol on them now reads as value-unused; one fallow entry records that and names retiring them as the follow-up. Closes #1959 --- .fallowrc.json | 5 + packages/ad-script/src/internal/script.ts | 2 +- .../capture-kit/src/app-log-live-handle.ts | 12 +- .../src/app-log-pid-runtime.test.ts | 10 +- .../capture-kit/src/app-log-pid-runtime.ts | 2 +- .../capture-kit/src/app-log-runtime.test.ts | 16 +- packages/capture-kit/src/app-log-runtime.ts | 27 +- .../src/durable-resource-envelope.ts | 18 +- .../src/screen-recording-live-handle.ts | 14 +- packages/contracts/package.json | 258 ++++++++++++++++-- packages/contracts/src/client-gesture.ts | 2 +- packages/contracts/src/gesture-plan.ts | 2 - packages/maestro/src/internal/export-flow.ts | 2 +- .../src/internal/runtime-port-geometry.ts | 2 +- packages/platform-android/src/lifecycle.ts | 4 +- .../platform-android/src/logs/descriptor.ts | 2 +- .../src/recording/chunks.test.ts | 2 +- .../src/recording/launch-boundary.test.ts | 2 +- .../src/recording/launch.test.ts | 2 +- .../src/recording/manifest.ts | 2 +- .../src/recording/recovery-cleanup.test.ts | 2 +- .../src/recording/recovery.test.ts | 2 +- .../src/recording/runtime.test.ts | 2 +- .../platform-android/src/recording/runtime.ts | 6 +- .../recording/start-reconciliation.test.ts | 2 +- packages/platform-android/src/runtime.ts | 28 +- packages/platform-apple/src/lifecycle.ts | 4 +- .../platform-apple/src/logs/descriptor.ts | 2 +- packages/platform-apple/src/logs/runtime.ts | 2 +- .../platform-apple/src/logs/start.test.ts | 2 +- packages/platform-apple/src/logs/start.ts | 2 +- .../src/recording/recovery.test.ts | 2 +- .../platform-apple/src/recording/recovery.ts | 2 +- .../src/recording/runtime.test.ts | 2 +- .../platform-apple/src/recording/runtime.ts | 2 +- .../platform-apple/src/runtime-snapshot.ts | 2 +- packages/platform-apple/src/runtime.ts | 26 +- packages/platform-harmonyos/src/lifecycle.ts | 2 +- .../platform-harmonyos/src/logs/descriptor.ts | 2 +- .../src/recording/recovery.test.ts | 2 +- .../src/recording/recovery.ts | 2 +- .../src/recording/runtime.test.ts | 2 +- .../src/recording/runtime.ts | 2 +- packages/platform-harmonyos/src/runtime.ts | 26 +- packages/platform-linux/src/lifecycle.ts | 2 +- packages/platform-linux/src/runtime.ts | 27 +- packages/platform-vega/src/lifecycle.ts | 2 +- packages/platform-vega/src/runtime.ts | 7 +- packages/platform-web/src/lifecycle.ts | 2 +- .../src/recording/runtime.test.ts | 2 +- .../platform-web/src/recording/runtime.ts | 6 +- packages/platform-web/src/runtime.ts | 27 +- .../provider-limrun/src/app-log-descriptor.ts | 2 +- .../provider-limrun/src/app-log-poller.ts | 2 +- .../provider-limrun/src/app-log-reconnect.ts | 2 +- .../src/app-log-runtime.test.ts | 4 +- .../provider-limrun/src/app-log-runtime.ts | 17 +- .../src/interaction-operations.ts | 10 +- packages/provider-limrun/src/lifecycle.ts | 2 +- packages/provider-limrun/src/runtime.ts | 2 +- packages/provider-webdriver/src/lifecycle.ts | 2 +- .../src/platform-runtime.test.ts | 2 +- .../src/platform-runtime.ts | 48 ++-- packages/provider-webdriver/src/runtime.ts | 2 +- .../src/webdriver-interactor.test.ts | 2 +- .../src/webdriver-interactor.ts | 2 +- scripts/layering/package-boundaries.test.ts | 57 +++- .../record-runtime-registry-policy.ts | 9 +- src/__tests__/contracts-entry-closure.test.ts | 95 +++++++ .../apple-os-capability-table-parity.test.ts | 2 +- .../interaction-contract-coverage.test.ts | 2 +- .../contracts/interaction-guarantees.test.ts | 2 +- .../test-utils/device-inventory-gateways.ts | 2 +- .../test-utils/property-arbitraries.ts | 5 +- .../test-utils/runtime-operation-facts.ts | 12 +- .../screen-recording-live-handle.ts | 6 +- src/commands/capture/alert.ts | 2 +- src/commands/interaction/gesture.ts | 2 +- src/commands/interaction/interactions.ts | 2 +- src/commands/interaction/metadata.ts | 22 +- .../interaction/runtime/gesture-command.ts | 2 +- src/commands/interaction/runtime/gestures.ts | 10 +- .../interaction/runtime/resolution.test.ts | 2 +- .../interaction/runtime/resolution.ts | 2 +- .../interaction/runtime/selector-read.ts | 2 +- .../interaction/runtime/selector-wait.ts | 2 +- .../interaction/runtime/wait-polling.ts | 4 +- src/commands/system/index.ts | 8 +- src/commands/system/navigation-projection.ts | 20 +- src/commands/system/runtime/system.ts | 2 +- .../__tests__/gesture-capabilities.test.ts | 2 +- src/core/__tests__/gesture-plan-test-utils.ts | 10 +- .../__tests__/gesture-plan-viewport.test.ts | 5 +- src/core/__tests__/gesture-plan.test.ts | 4 +- .../snapshot-chrome-android-statusbar.test.ts | 2 +- src/core/capabilities.ts | 2 +- ...cation-lifecycle-runtime-execution.test.ts | 2 +- .../__tests__/apps-runtime-execution.test.ts | 2 +- .../appstate-runtime-execution.test.ts | 5 +- .../__tests__/boot-runtime-execution.test.ts | 2 +- .../__tests__/find-runtime-execution.test.ts | 2 +- .../__tests__/focus-runtime-execution.test.ts | 2 +- .../__tests__/logs-runtime-execution.test.ts | 2 +- .../network-runtime-execution.test.ts | 5 +- .../__tests__/platform-execution.test.ts | 2 +- .../record-runtime-execution.test.ts | 6 +- .../screenshot-runtime-execution.test.ts | 2 +- .../shutdown-runtime-execution.test.ts | 2 +- .../snapshot-runtime-execution.test.ts | 2 +- .../__tests__/type-runtime-execution.test.ts | 2 +- .../viewport-runtime-execution.test.ts | 2 +- .../__tests__/wait-runtime-execution.test.ts | 6 +- .../platform-execution-entry.ts | 2 +- src/core/command-descriptor/registry.ts | 36 +-- src/core/device-inventory-context.ts | 12 +- src/core/dispatch-interactions.ts | 23 +- src/core/dispatch.ts | 2 +- src/core/fill-backend-result.ts | 2 +- src/core/interactors/linux.ts | 2 +- src/core/interactors/register-builtins.ts | 2 +- src/core/snapshot-chrome.ts | 4 +- .../app-log-resource-recovery.test.ts | 11 +- .../__tests__/app-log-resource-store.test.ts | 2 +- .../app-log-session-resource.test.ts | 3 +- .../__tests__/app-log-start-preflight.test.ts | 2 +- .../application-lifecycle-recovery.test.ts | 14 +- .../__tests__/daemon-runtime-app-log.test.ts | 2 +- .../__tests__/device-claim-admission.test.ts | 2 +- .../device-claim-reconciliation.test.ts | 8 +- ...durable-capture-recovery-authority.test.ts | 3 +- .../durable-capture-resource-fence.test.ts | 2 +- .../durable-capture-resource-recovery.test.ts | 2 +- .../durable-capture-resource-store.test.ts | 2 +- .../durable-capture-resource.fixtures.ts | 10 +- .../filesystem-boundary-faults.test.ts | 2 +- src/daemon/__tests__/focus-runtime.test.ts | 14 +- .../request-router-lock-policy.test.ts | 6 +- ...request-router-record-runtime-lock.test.ts | 12 +- .../request-runtime-binding-router.test.ts | 8 +- .../__tests__/request-runtime-binding.test.ts | 14 +- .../screen-recording-boundary-faults.test.ts | 15 +- ...screen-recording-resource-recovery.test.ts | 8 +- .../screen-recording-session-resource.test.ts | 8 +- .../__tests__/screenshot-runtime-fixture.ts | 18 +- .../__tests__/selector-capture-fixture.ts | 12 +- ...shot-custom-actions-platform-guard.test.ts | 6 +- .../__tests__/snapshot-diff-runtime.test.ts | 12 +- .../__tests__/snapshot-runtime-fixture.ts | 14 +- .../__tests__/test-device-runtime-gateway.ts | 10 +- .../__tests__/type-text-runtime.test.ts | 16 +- src/daemon/__tests__/viewport-runtime.test.ts | 14 +- .../wait-conditional-selector.test.ts | 14 +- src/daemon/__tests__/wait-runtime.test.ts | 20 +- ...mon-runtime-port-selector-fallback.test.ts | 2 +- .../daemon-runtime-public-operation.test.ts | 8 +- .../adapters/maestro/daemon-runtime-tap.ts | 2 +- src/daemon/app-log-resource-recovery.ts | 15 +- src/daemon/application-lifecycle-recovery.ts | 18 +- src/daemon/apps-runtime.ts | 10 +- src/daemon/audio-probe.ts | 4 +- src/daemon/context.ts | 2 +- .../durable-capture-resource-adoption.ts | 8 +- .../durable-capture-resource-recovery.ts | 2 +- .../durable-capture-resource-transitions.ts | 4 +- src/daemon/focus-runtime.ts | 3 +- .../application-lifecycle-runtime-harness.ts | 12 +- .../handlers/__tests__/install-source.test.ts | 18 +- .../interaction-get-runtime-fixture.ts | 24 +- .../__tests__/interaction-read.test.ts | 4 +- .../handlers/__tests__/interaction.test.ts | 2 +- .../__tests__/network-runtime-harness.ts | 13 +- .../__tests__/record-runtime.fixtures.ts | 16 +- .../session-capabilities.fixtures.ts | 14 +- .../__tests__/session-capabilities.test.ts | 14 +- .../session-close-shutdown.fixtures.ts | 8 +- .../__tests__/session-command-harness.ts | 32 ++- .../session-doctor-app-runtime.test.ts | 8 +- .../session-inventory-apps-runtime.test.ts | 8 +- .../session-inventory-harmonyos.test.ts | 8 +- .../handlers/__tests__/session-logs.test.ts | 12 +- .../session-network-runtime-parity.test.ts | 2 +- .../session-runtime-admission.test.ts | 2 +- .../handlers/__tests__/session-state.test.ts | 14 +- .../__tests__/session-test-harness.ts | 3 +- .../session-test-suite-command-video.test.ts | 6 +- src/daemon/handlers/find.ts | 8 +- src/daemon/handlers/interaction-gesture.ts | 17 +- .../interaction-touch-press-admission.ts | 2 +- src/daemon/handlers/record-runtime.ts | 8 +- src/daemon/handlers/session-app-deployment.ts | 4 +- .../handlers/session-app-source-deployment.ts | 2 +- .../session-close-runtime-admission.ts | 4 +- src/daemon/handlers/session-doctor.ts | 8 +- .../session-install-capability-projection.ts | 8 +- src/daemon/handlers/session-inventory.ts | 18 +- src/daemon/handlers/session-network.ts | 4 +- src/daemon/handlers/session-observability.ts | 12 +- src/daemon/handlers/session-open-execution.ts | 4 +- src/daemon/handlers/session-open-prepare.ts | 8 +- src/daemon/handlers/session-open.ts | 2 +- src/daemon/handlers/session-prepare.ts | 6 +- .../handlers/session-replay-action-runtime.ts | 2 +- .../handlers/session-replay-divergence.ts | 2 +- .../handlers/session-replay-target-token.ts | 2 +- .../handlers/session-runtime-command.ts | 2 +- .../handlers/session-runtime-port-reverse.ts | 2 +- src/daemon/handlers/session-runtime.ts | 4 +- src/daemon/handlers/session-state.ts | 6 +- src/daemon/handlers/snapshot-alert.ts | 4 +- src/daemon/recording-gestures.ts | 6 +- src/daemon/request-runtime-binding.ts | 12 +- .../screen-recording-resource-recovery.ts | 18 +- src/daemon/screen-recording-resource-store.ts | 2 +- src/daemon/screenshot-runtime-binding.ts | 20 +- src/daemon/selector-capture-binding.ts | 18 +- src/daemon/selector-recording.ts | 2 +- src/daemon/selector-runtime.ts | 2 +- .../daemon-runtime-recording-teardown.test.ts | 10 +- .../session-event-action-presentation.ts | 3 +- src/daemon/session-event-action.ts | 4 +- .../session-script-active-publication.ts | 2 +- src/daemon/session-script-writer.ts | 2 +- src/daemon/snapshot-runtime-binding.ts | 14 +- src/daemon/snapshot-runtime.ts | 2 +- src/daemon/snapshot-state.ts | 2 +- src/daemon/touch-reference-frame.ts | 4 +- src/daemon/type-text-runtime.ts | 10 +- src/daemon/viewport-runtime.ts | 2 +- src/daemon/wait-current-surface.ts | 2 +- src/platform-runtime-device-inventory.test.ts | 10 +- src/platform-runtime-device-inventory.ts | 24 +- src/platform-runtime-gateway.fixtures.ts | 4 +- src/platform-runtime-gateway.test.ts | 13 +- src/platform-runtime-gateway.ts | 30 +- src/platform-runtime.ts | 22 +- .../__tests__/ime-lifecycle-race.test.ts | 2 +- .../android/__tests__/ime-lifecycle.test.ts | 2 +- .../android/__tests__/input-ownership.test.ts | 2 +- .../android/__tests__/touch-executor.test.ts | 2 +- .../__tests__/touch-helper.fixtures.ts | 2 +- .../android/__tests__/touch-helper.test.ts | 2 +- .../android/__tests__/touch-plan.test.ts | 7 +- src/platforms/android/alert.ts | 2 +- src/platforms/android/device-input-state.ts | 4 +- src/platforms/android/fill-verification.ts | 2 +- src/platforms/android/ime-lifecycle.ts | 2 +- src/platforms/android/input-actions.ts | 15 +- .../android/snapshot-content-recovery.ts | 8 +- src/platforms/android/touch-plan.ts | 14 +- src/platforms/android/ui-hierarchy.ts | 2 +- .../apple/core/__tests__/interactions.test.ts | 3 +- src/platforms/apple/core/scroll.ts | 8 +- src/platforms/apple/interactions.ts | 24 +- src/platforms/apple/interactor.ts | 2 +- src/platforms/apple/plugin.ts | 2 +- src/platforms/audio-probe-backend.ts | 2 +- src/platforms/harmonyos/input-actions.ts | 8 +- src/platforms/vega/input-actions.ts | 2 +- .../web/agent-browser-audio-probe.ts | 5 +- 259 files changed, 1355 insertions(+), 850 deletions(-) create mode 100644 src/__tests__/contracts-entry-closure.test.ts diff --git a/.fallowrc.json b/.fallowrc.json index 5cfedf379a..f37f0e9596 100644 --- a/.fallowrc.json +++ b/.fallowrc.json @@ -169,6 +169,11 @@ "file": "packages/provider-limrun/src/index.ts", "exports": ["LimrunIosCommandExecution"] }, + { + "comment": "#1959 gave every contracts vocabulary module its own entry subpath and moved all ~230 value-importers onto them, so `./platform` and `./interaction` now carry zero value consumers — every re-export on them reads as unused. They stay as the compatibility surface for the ~490 type-only importers the granularization deliberately left alone (type imports are erased, so they cost nothing to load). Scoped to these two façades rather than listed symbol-by-symbol because the property is per-file: nothing on them is value-consumed any more. Retiring them entirely — moving the type-only importers too and deleting the files — is the follow-up that makes this entry unnecessary.", + "file": "packages/contracts/src/facades/{platform,interaction}.ts", + "exports": ["*"] + }, { "comment": "Converting the contracts façades from `export *` to explicit named re-exports (the pin-table retirement) made these individually visible to --production analysis for the first time; a bare star previously hid them from this exact check. GESTURE_INITIAL_ANGLE_DEGREES/GESTURE_SAMPLE_INTERVAL_MS/INTERACTION_GUARANTEES/INTERACTION_PATH_IDS/parseAndroidInputMethodPackage/isRecordingExportQuality have same-package test-tree consumers (invisible to --production, mirroring the packages/{ad-script,maestro} entry above); the rest currently have none. Kept rather than narrowed here so the façade's re-export surface stays byte-identical to the symbol set the retired pin table asserted — narrowing the surface is a follow-up with its own review, not a side effect of this mechanical conversion. The last five (COORDINATE_GESTURE_KINDS, normalizePublicGesture, DEFAULT_DRAG_*) are #1567's drag vocabulary, surfaced the same way by the same conversion and kept for the same reason.", "file": "packages/contracts/src/facades/{client,command,divergence,interaction,platform,recording}.ts", diff --git a/packages/ad-script/src/internal/script.ts b/packages/ad-script/src/internal/script.ts index 4c6e74af9d..14824602e8 100644 --- a/packages/ad-script/src/internal/script.ts +++ b/packages/ad-script/src/internal/script.ts @@ -1,6 +1,6 @@ import { AppError } from '@agent-device/kernel/errors'; import { recordingQualityInputToExportQuality } from '@agent-device/contracts/recording'; -import { describeReplayGestureArityError } from '@agent-device/contracts/interaction'; +import { describeReplayGestureArityError } from '@agent-device/contracts/gesture-normalization'; import { RETIRED_SCREENSHOT_MAX_SIZE, readScreenshotScriptFlag, diff --git a/packages/capture-kit/src/app-log-live-handle.ts b/packages/capture-kit/src/app-log-live-handle.ts index a21fab0eb8..0e7e2f252d 100644 --- a/packages/capture-kit/src/app-log-live-handle.ts +++ b/packages/capture-kit/src/app-log-live-handle.ts @@ -1,12 +1,14 @@ import { AppError } from '@agent-device/kernel/errors'; +import type { + AppLogCompletion, + AppLogLiveHandle, + AppLogLiveSnapshot, +} from '@agent-device/contracts/app-log-runtime'; import { - isConfirmedCleanup, - type AppLogCompletion, - type AppLogLiveHandle, - type AppLogLiveSnapshot, type CleanupOutcome, type FinishOutcome, -} from '@agent-device/contracts/platform'; + isConfirmedCleanup, +} from '@agent-device/contracts/durable-resource'; type AppLogLiveHandleImplementation = Readonly<{ inspect(): AppLogLiveSnapshot; diff --git a/packages/capture-kit/src/app-log-pid-runtime.test.ts b/packages/capture-kit/src/app-log-pid-runtime.test.ts index ed028093e1..ef3294a185 100644 --- a/packages/capture-kit/src/app-log-pid-runtime.test.ts +++ b/packages/capture-kit/src/app-log-pid-runtime.test.ts @@ -1,10 +1,10 @@ import type { DeviceInfo } from '@agent-device/kernel/device'; import { expect, test, vi } from 'vitest'; -import { - type AppLogBackgroundProcess, - type AppLogRuntimeHost, - type DurableDescriptorCodec, -} from '@agent-device/contracts/platform'; +import type { + AppLogBackgroundProcess, + AppLogRuntimeHost, +} from '@agent-device/contracts/app-log-runtime'; +import type { DurableDescriptorCodec } from '@agent-device/contracts/durable-resource-envelope'; import { createDurableResourceEnvelope, encodeDurableDescriptor, diff --git a/packages/capture-kit/src/app-log-pid-runtime.ts b/packages/capture-kit/src/app-log-pid-runtime.ts index ab291b385d..f022a2cb44 100644 --- a/packages/capture-kit/src/app-log-pid-runtime.ts +++ b/packages/capture-kit/src/app-log-pid-runtime.ts @@ -16,7 +16,7 @@ import type { RuntimeFacts, RuntimeOwnerRef, } from '@agent-device/contracts/platform'; -import { localRuntimeOwner, sameRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner, sameRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import type { LogBackend } from '@agent-device/contracts/observability'; import { createAppLogRecoveryOperations, createAppLogStartResult } from './app-log-runtime.ts'; import { diff --git a/packages/capture-kit/src/app-log-runtime.test.ts b/packages/capture-kit/src/app-log-runtime.test.ts index 0c57dc4e56..ef1989af65 100644 --- a/packages/capture-kit/src/app-log-runtime.test.ts +++ b/packages/capture-kit/src/app-log-runtime.test.ts @@ -1,14 +1,14 @@ import assert from 'node:assert/strict'; import { test, vi } from 'vitest'; import { AppError } from '@agent-device/kernel/errors'; -import { - type AppLogCompletion, - type AppLogBackgroundProcessRequest, - type AppLogProcessOwnership, - type AppLogProcessTransport, - type AppLogRuntimeHost, - type DurableDescriptorCodec, -} from '@agent-device/contracts/platform'; +import type { + AppLogBackgroundProcessRequest, + AppLogCompletion, + AppLogProcessOwnership, + AppLogProcessTransport, + AppLogRuntimeHost, +} from '@agent-device/contracts/app-log-runtime'; +import type { DurableDescriptorCodec } from '@agent-device/contracts/durable-resource-envelope'; import { APP_LOG_ENVELOPE_FIXTURE } from './durable-resource-envelope.fixtures.ts'; import { createAppLogLiveHandle } from './app-log-live-handle.ts'; import { diff --git a/packages/capture-kit/src/app-log-runtime.ts b/packages/capture-kit/src/app-log-runtime.ts index 5075bab4ec..0ef38dc441 100644 --- a/packages/capture-kit/src/app-log-runtime.ts +++ b/packages/capture-kit/src/app-log-runtime.ts @@ -1,16 +1,17 @@ -import { - PendingTransferGuard, - type AppLogCompletion, - type AppLogLiveHandle, - type AppLogProcessMarkerReadOutcome, - type AppLogRuntimeOperations, - type AppLogStartResult, - type CleanupOutcome, - type DurableDescriptorCodec, - type DurableResourceEnvelope, - type ReattachOutcome, - type ResourceOwnershipFence, -} from '@agent-device/contracts/platform'; +import type { + AppLogCompletion, + AppLogLiveHandle, + AppLogProcessMarkerReadOutcome, + AppLogRuntimeOperations, + AppLogStartResult, +} from '@agent-device/contracts/app-log-runtime'; +import { PendingTransferGuard } from '@agent-device/contracts/async-lifecycle'; +import type { CleanupOutcome, ReattachOutcome } from '@agent-device/contracts/durable-resource'; +import type { + DurableDescriptorCodec, + DurableResourceEnvelope, +} from '@agent-device/contracts/durable-resource-envelope'; +import type { ResourceOwnershipFence } from '@agent-device/contracts/platform-runtime'; import { decodeDurableDescriptor } from './durable-descriptor-codec.ts'; const APP_LOG_RESOURCE_KIND = 'app-log' as const; diff --git a/packages/capture-kit/src/durable-resource-envelope.ts b/packages/capture-kit/src/durable-resource-envelope.ts index a3d34aac6b..b7629b3cf4 100644 --- a/packages/capture-kit/src/durable-resource-envelope.ts +++ b/packages/capture-kit/src/durable-resource-envelope.ts @@ -9,17 +9,19 @@ import { type Platform, } from '@agent-device/kernel/device'; import type { JsonObject } from '@agent-device/contracts/client'; +import type { + DurableDescriptorCodec, + DurableEnvelopeDecodeOutcome, + DurableResourceEnvelope, + DurableResourceLifecycleState, + EncodedDurableDescriptor, +} from '@agent-device/contracts/durable-resource-envelope'; import { - localRuntimeOwner, - providerRuntimeOwner, - type DurableDescriptorCodec, - type DurableEnvelopeDecodeOutcome, - type DurableResourceEnvelope, - type DurableResourceLifecycleState, - type EncodedDurableDescriptor, type ResourceOwnershipFence, type RuntimeOwnerRef, -} from '@agent-device/contracts/platform'; + localRuntimeOwner, + providerRuntimeOwner, +} from '@agent-device/contracts/platform-runtime'; import { freezeJsonObject, isBoundedJsonObject } from './durable-json.ts'; const DURABLE_RESOURCE_ENVELOPE_VERSION = 1 as const; diff --git a/packages/capture-kit/src/screen-recording-live-handle.ts b/packages/capture-kit/src/screen-recording-live-handle.ts index f0e3f0058e..b4c6f5bae4 100644 --- a/packages/capture-kit/src/screen-recording-live-handle.ts +++ b/packages/capture-kit/src/screen-recording-live-handle.ts @@ -1,13 +1,15 @@ import { AppError } from '@agent-device/kernel/errors'; import { - isConfirmedCleanup, type CleanupOutcome, type FinishOutcome, - type RecordingGestureEvent, - type ScreenRecordingCompletion, - type ScreenRecordingLiveHandle, - type ScreenRecordingLiveSnapshot, -} from '@agent-device/contracts/platform'; + isConfirmedCleanup, +} from '@agent-device/contracts/durable-resource'; +import type { + RecordingGestureEvent, + ScreenRecordingCompletion, + ScreenRecordingLiveHandle, + ScreenRecordingLiveSnapshot, +} from '@agent-device/contracts/screen-recording-runtime'; import type { GestureReferenceFrame } from '@agent-device/contracts/interaction'; type ScreenRecordingLiveHandleImplementation = Readonly<{ diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 009add237d..5de41a7937 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -8,6 +8,82 @@ "@agent-device/kernel": "workspace:*" }, "exports": { + "./alert-contract": { + "types": "./src/alert-contract.ts", + "default": "./src/alert-contract.ts" + }, + "./android-input-ownership": { + "types": "./src/android-input-ownership.ts", + "default": "./src/android-input-ownership.ts" + }, + "./android-snapshot-quality": { + "types": "./src/android-snapshot-quality.ts", + "default": "./src/android-snapshot-quality.ts" + }, + "./android-system-chrome": { + "types": "./src/android-system-chrome.ts", + "default": "./src/android-system-chrome.ts" + }, + "./app-deployment-runtime": { + "types": "./src/app-deployment-runtime.ts", + "default": "./src/app-deployment-runtime.ts" + }, + "./app-deployment-runtime-plan": { + "types": "./src/app-deployment-runtime-plan.ts", + "default": "./src/app-deployment-runtime-plan.ts" + }, + "./app-inventory-runtime": { + "types": "./src/app-inventory-runtime.ts", + "default": "./src/app-inventory-runtime.ts" + }, + "./app-log-runtime": { + "types": "./src/app-log-runtime.ts", + "default": "./src/app-log-runtime.ts" + }, + "./app-state-runtime": { + "types": "./src/app-state-runtime.ts", + "default": "./src/app-state-runtime.ts" + }, + "./apple-multitouch-support": { + "types": "./src/apple-multitouch-support.ts", + "default": "./src/apple-multitouch-support.ts" + }, + "./application-lifecycle-interaction": { + "types": "./src/application-lifecycle-interaction.ts", + "default": "./src/application-lifecycle-interaction.ts" + }, + "./application-lifecycle-runtime": { + "types": "./src/application-lifecycle-runtime.ts", + "default": "./src/application-lifecycle-runtime.ts" + }, + "./application-lifecycle-runtime-plan": { + "types": "./src/application-lifecycle-runtime-plan.ts", + "default": "./src/application-lifecycle-runtime-plan.ts" + }, + "./async-lifecycle": { + "types": "./src/async-lifecycle.ts", + "default": "./src/async-lifecycle.ts" + }, + "./audio-probe-result": { + "types": "./src/audio-probe-result.ts", + "default": "./src/audio-probe-result.ts" + }, + "./audio-probe-support": { + "types": "./src/audio-probe-support.ts", + "default": "./src/audio-probe-support.ts" + }, + "./back-mode": { + "types": "./src/back-mode.ts", + "default": "./src/back-mode.ts" + }, + "./capture": { + "types": "./src/facades/capture.ts", + "default": "./src/facades/capture.ts" + }, + "./click-button": { + "types": "./src/click-button.ts", + "default": "./src/click-button.ts" + }, "./client": { "types": "./src/facades/client.ts", "default": "./src/facades/client.ts" @@ -16,38 +92,130 @@ "types": "./src/facades/command.ts", "default": "./src/facades/command.ts" }, + "./command-platform-execution": { + "types": "./src/command-platform-execution.ts", + "default": "./src/command-platform-execution.ts" + }, "./device": { "types": "./src/facades/device.ts", "default": "./src/facades/device.ts" }, + "./device-readiness-runtime": { + "types": "./src/device-readiness-runtime.ts", + "default": "./src/device-readiness-runtime.ts" + }, + "./device-shutdown-runtime": { + "types": "./src/device-shutdown-runtime.ts", + "default": "./src/device-shutdown-runtime.ts" + }, + "./divergence": { + "types": "./src/facades/divergence.ts", + "default": "./src/facades/divergence.ts" + }, + "./durable-resource": { + "types": "./src/durable-resource.ts", + "default": "./src/durable-resource.ts" + }, + "./durable-resource-envelope": { + "types": "./src/durable-resource-envelope.ts", + "default": "./src/durable-resource-envelope.ts" + }, + "./element-text-runtime": { + "types": "./src/element-text-runtime.ts", + "default": "./src/element-text-runtime.ts" + }, + "./focus-runtime": { + "types": "./src/focus-runtime.ts", + "default": "./src/focus-runtime.ts" + }, + "./gesture-input": { + "types": "./src/gesture-input.ts", + "default": "./src/gesture-input.ts" + }, + "./gesture-normalization": { + "types": "./src/gesture-normalization.ts", + "default": "./src/gesture-normalization.ts" + }, + "./gesture-plan": { + "types": "./src/gesture-plan.ts", + "default": "./src/gesture-plan.ts" + }, + "./gesture-plan-types": { + "types": "./src/gesture-plan-types.ts", + "default": "./src/gesture-plan-types.ts" + }, "./interaction": { "types": "./src/facades/interaction.ts", "default": "./src/facades/interaction.ts" }, - "./capture": { - "types": "./src/facades/capture.ts", - "default": "./src/facades/capture.ts" + "./interaction-error": { + "types": "./src/interaction-error.ts", + "default": "./src/interaction-error.ts" + }, + "./interaction-guarantees": { + "types": "./src/interaction-guarantees.ts", + "default": "./src/interaction-guarantees.ts" + }, + "./interactor-types": { + "types": "./src/interactor-types.ts", + "default": "./src/interactor-types.ts" + }, + "./logs-runtime-plan": { + "types": "./src/logs-runtime-plan.ts", + "default": "./src/logs-runtime-plan.ts" + }, + "./navigation": { + "types": "./src/navigation.ts", + "default": "./src/navigation.ts" + }, + "./network-runtime": { + "types": "./src/network-runtime.ts", + "default": "./src/network-runtime.ts" + }, + "./network-runtime-plan": { + "types": "./src/network-runtime-plan.ts", + "default": "./src/network-runtime-plan.ts" + }, + "./observability": { + "types": "./src/facades/observability.ts", + "default": "./src/facades/observability.ts" }, "./platform": { "types": "./src/facades/platform.ts", "default": "./src/facades/platform.ts" }, - "./settings": { - "types": "./src/settings.ts", - "default": "./src/settings.ts" + "./platform-module": { + "types": "./src/platform-module.ts", + "default": "./src/platform-module.ts" }, - "./session": { - "types": "./src/facades/session.ts", - "default": "./src/facades/session.ts" + "./platform-runtime": { + "types": "./src/platform-runtime.ts", + "default": "./src/platform-runtime.ts" + }, + "./platform-runtime-host": { + "types": "./src/platform-runtime-host.ts", + "default": "./src/platform-runtime-host.ts" + }, + "./platform-runtime-operations": { + "types": "./src/platform-runtime-operations.ts", + "default": "./src/platform-runtime-operations.ts" + }, + "./platform-runtime-unavailable": { + "types": "./src/platform-runtime-unavailable.ts", + "default": "./src/platform-runtime-unavailable.ts" + }, + "./progress": { + "types": "./src/facades/progress.ts", + "default": "./src/facades/progress.ts" + }, + "./record-runtime-cutover": { + "types": "./src/record-runtime-cutover.ts", + "default": "./src/record-runtime-cutover.ts" }, "./recording": { "types": "./src/facades/recording.ts", "default": "./src/facades/recording.ts" }, - "./observability": { - "types": "./src/facades/observability.ts", - "default": "./src/facades/observability.ts" - }, "./remote": { "types": "./src/facades/remote.ts", "default": "./src/facades/remote.ts" @@ -56,17 +224,69 @@ "types": "./src/facades/replay.ts", "default": "./src/facades/replay.ts" }, + "./screen-recording-runtime": { + "types": "./src/screen-recording-runtime.ts", + "default": "./src/screen-recording-runtime.ts" + }, + "./screen-recording-runtime-plan": { + "types": "./src/screen-recording-runtime-plan.ts", + "default": "./src/screen-recording-runtime-plan.ts" + }, + "./screenshot-runtime": { + "types": "./src/screenshot-runtime.ts", + "default": "./src/screenshot-runtime.ts" + }, + "./scroll-command": { + "types": "./src/scroll-command.ts", + "default": "./src/scroll-command.ts" + }, + "./scroll-gesture": { + "types": "./src/scroll-gesture.ts", + "default": "./src/scroll-gesture.ts" + }, + "./selector-observation-runtime": { + "types": "./src/selector-observation-runtime.ts", + "default": "./src/selector-observation-runtime.ts" + }, + "./session": { + "types": "./src/facades/session.ts", + "default": "./src/facades/session.ts" + }, + "./settings": { + "types": "./src/settings.ts", + "default": "./src/settings.ts" + }, "./snapshot": { "types": "./src/facades/snapshot.ts", "default": "./src/facades/snapshot.ts" }, - "./divergence": { - "types": "./src/facades/divergence.ts", - "default": "./src/facades/divergence.ts" + "./snapshot-runtime": { + "types": "./src/snapshot-runtime.ts", + "default": "./src/snapshot-runtime.ts" }, - "./progress": { - "types": "./src/facades/progress.ts", - "default": "./src/facades/progress.ts" + "./startup-recovery-fence": { + "types": "./src/startup-recovery-fence.ts", + "default": "./src/startup-recovery-fence.ts" + }, + "./tv-remote": { + "types": "./src/tv-remote.ts", + "default": "./src/tv-remote.ts" + }, + "./type-text-runtime": { + "types": "./src/type-text-runtime.ts", + "default": "./src/type-text-runtime.ts" + }, + "./viewport-runtime": { + "types": "./src/viewport-runtime.ts", + "default": "./src/viewport-runtime.ts" + }, + "./wait": { + "types": "./src/wait.ts", + "default": "./src/wait.ts" + }, + "./wait-runtime-plan": { + "types": "./src/wait-runtime-plan.ts", + "default": "./src/wait-runtime-plan.ts" } } } diff --git a/packages/contracts/src/client-gesture.ts b/packages/contracts/src/client-gesture.ts index 48a796ff42..8206c6e769 100644 --- a/packages/contracts/src/client-gesture.ts +++ b/packages/contracts/src/client-gesture.ts @@ -1,7 +1,7 @@ // The public API vocabulary for the gesture and text-entry commands. import type { ClickButton } from './click-button.ts'; -import type { GesturePointerCount } from './gesture-plan.ts'; +import type { GesturePointerCount } from './gesture-plan-types.ts'; import type { ScrollDirection, ScrollInputDirection, diff --git a/packages/contracts/src/gesture-plan.ts b/packages/contracts/src/gesture-plan.ts index 5ae2b9e8ad..d992643c0f 100644 --- a/packages/contracts/src/gesture-plan.ts +++ b/packages/contracts/src/gesture-plan.ts @@ -23,8 +23,6 @@ import type { SinglePointerTrajectory, } from './gesture-plan-types.ts'; -export * from './gesture-plan-types.ts'; - export const GESTURE_SAMPLE_INTERVAL_MS = 16; export const GESTURE_INITIAL_ANGLE_DEGREES = -90; const GESTURE_FLING_DEFAULT_DISTANCE = 180; diff --git a/packages/maestro/src/internal/export-flow.ts b/packages/maestro/src/internal/export-flow.ts index ddbe277015..c3924cdd6a 100644 --- a/packages/maestro/src/internal/export-flow.ts +++ b/packages/maestro/src/internal/export-flow.ts @@ -1,5 +1,5 @@ import type { SessionAction } from '@agent-device/contracts/session'; -import { GESTURE_FLING_DURATION_MS } from '@agent-device/contracts/interaction'; +import { GESTURE_FLING_DURATION_MS } from '@agent-device/contracts/gesture-plan'; import { AppError } from '@agent-device/kernel/errors'; import { selectorContainsKey } from '@agent-device/selectors'; import { formatMaestroPoint } from './export-points.ts'; diff --git a/packages/maestro/src/internal/runtime-port-geometry.ts b/packages/maestro/src/internal/runtime-port-geometry.ts index 300e0f430a..27d7ca51f0 100644 --- a/packages/maestro/src/internal/runtime-port-geometry.ts +++ b/packages/maestro/src/internal/runtime-port-geometry.ts @@ -1,5 +1,5 @@ import { AppError } from '@agent-device/kernel/errors'; -import { buildInPageSwipeGesturePlan } from '@agent-device/contracts/interaction'; +import { buildInPageSwipeGesturePlan } from '@agent-device/contracts/scroll-gesture'; import { isPositiveFiniteRect } from '@agent-device/kernel/rect'; import type { Rect, SnapshotState } from '@agent-device/kernel/snapshot'; import { pointInsideRect } from './shared.ts'; diff --git a/packages/platform-android/src/lifecycle.ts b/packages/platform-android/src/lifecycle.ts index 559857b4fe..2486ceb516 100644 --- a/packages/platform-android/src/lifecycle.ts +++ b/packages/platform-android/src/lifecycle.ts @@ -7,10 +7,10 @@ import type { import { bindLocalApplicationLifecycleInteractor, followUpRuntimeLaunchUrl, - hasRuntimeTransportHintValues, invokeApplicationClose, invokeApplicationOpen, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/application-lifecycle-interaction'; +import { hasRuntimeTransportHintValues } from '@agent-device/contracts/application-lifecycle-runtime'; import { ensureAndroidReady } from './readiness/runtime.ts'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { AppError } from '@agent-device/kernel/errors'; diff --git a/packages/platform-android/src/logs/descriptor.ts b/packages/platform-android/src/logs/descriptor.ts index 1551c77e13..1974075a1b 100644 --- a/packages/platform-android/src/logs/descriptor.ts +++ b/packages/platform-android/src/logs/descriptor.ts @@ -4,7 +4,7 @@ import type { DurableResourceEnvelope, RuntimeOwnerRef, } from '@agent-device/contracts/platform'; -import { APP_LOG_RESOURCE_KIND } from '@agent-device/contracts/platform'; +import { APP_LOG_RESOURCE_KIND } from '@agent-device/contracts/app-log-runtime'; import { createDurableResourceEnvelope, encodeDurableDescriptor } from '@agent-device/capture-kit'; export type AndroidAppLogDescriptor = Readonly<{ diff --git a/packages/platform-android/src/recording/chunks.test.ts b/packages/platform-android/src/recording/chunks.test.ts index a66f6adcda..e65c3476cf 100644 --- a/packages/platform-android/src/recording/chunks.test.ts +++ b/packages/platform-android/src/recording/chunks.test.ts @@ -1,5 +1,5 @@ import { expect, test, vi } from 'vitest'; -import { localRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { androidRecordingDevice, recordingHost, diff --git a/packages/platform-android/src/recording/launch-boundary.test.ts b/packages/platform-android/src/recording/launch-boundary.test.ts index 62e567c34e..5c39dcf055 100644 --- a/packages/platform-android/src/recording/launch-boundary.test.ts +++ b/packages/platform-android/src/recording/launch-boundary.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import { localRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { androidRecordingDevice, recordingHost, diff --git a/packages/platform-android/src/recording/launch.test.ts b/packages/platform-android/src/recording/launch.test.ts index 67f3c06c19..9b0105efb5 100644 --- a/packages/platform-android/src/recording/launch.test.ts +++ b/packages/platform-android/src/recording/launch.test.ts @@ -1,6 +1,6 @@ import { expect, test } from 'vitest'; import type { AndroidScreenRecordingTransport } from '@agent-device/contracts/platform'; -import { localRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { androidRecordingDevice, recordingHost, diff --git a/packages/platform-android/src/recording/manifest.ts b/packages/platform-android/src/recording/manifest.ts index cf3a251324..50902ce141 100644 --- a/packages/platform-android/src/recording/manifest.ts +++ b/packages/platform-android/src/recording/manifest.ts @@ -4,7 +4,7 @@ import type { ScreenRecordingRuntimeOperations, ScreenRecordingStartInput, } from '@agent-device/contracts/platform'; -import { SCREEN_RECORDING_RESOURCE_KIND } from '@agent-device/contracts/platform'; +import { SCREEN_RECORDING_RESOURCE_KIND } from '@agent-device/contracts/screen-recording-runtime'; import { completionMatchesDescriptor, isValidAndroidRecordingDescriptor, diff --git a/packages/platform-android/src/recording/recovery-cleanup.test.ts b/packages/platform-android/src/recording/recovery-cleanup.test.ts index 727d9a438e..c1157217f1 100644 --- a/packages/platform-android/src/recording/recovery-cleanup.test.ts +++ b/packages/platform-android/src/recording/recovery-cleanup.test.ts @@ -1,5 +1,5 @@ import { expect, test, vi } from 'vitest'; -import { localRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { androidRecordingDevice, recordingHost, recordingInput } from './fixtures.ts'; import { bindAndroidScreenRecordingRuntime } from './runtime.ts'; diff --git a/packages/platform-android/src/recording/recovery.test.ts b/packages/platform-android/src/recording/recovery.test.ts index 8183106dc5..0353d7ecb9 100644 --- a/packages/platform-android/src/recording/recovery.test.ts +++ b/packages/platform-android/src/recording/recovery.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import { localRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { androidRecordingDevice, recordingHost, recordingInput } from './fixtures.ts'; import { bindAndroidScreenRecordingRuntime } from './runtime.ts'; diff --git a/packages/platform-android/src/recording/runtime.test.ts b/packages/platform-android/src/recording/runtime.test.ts index 4f0e1853bf..f40d971481 100644 --- a/packages/platform-android/src/recording/runtime.test.ts +++ b/packages/platform-android/src/recording/runtime.test.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { expect, test, vi } from 'vitest'; -import { localRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { androidRecordingDevice, recordingHost, diff --git a/packages/platform-android/src/recording/runtime.ts b/packages/platform-android/src/recording/runtime.ts index 330938fdad..fbe1522a58 100644 --- a/packages/platform-android/src/recording/runtime.ts +++ b/packages/platform-android/src/recording/runtime.ts @@ -6,10 +6,8 @@ import type { ScreenRecordingRuntimeOperations, ScreenRecordingStartInput, } from '@agent-device/contracts/platform'; -import { - PendingTransferGuard, - SCREEN_RECORDING_RESOURCE_KIND, -} from '@agent-device/contracts/platform'; +import { PendingTransferGuard } from '@agent-device/contracts/async-lifecycle'; +import { SCREEN_RECORDING_RESOURCE_KIND } from '@agent-device/contracts/screen-recording-runtime'; import { createDurableResourceEnvelope, createScreenRecordingLiveHandle, diff --git a/packages/platform-android/src/recording/start-reconciliation.test.ts b/packages/platform-android/src/recording/start-reconciliation.test.ts index 0ab1bf3c36..da71ece0e3 100644 --- a/packages/platform-android/src/recording/start-reconciliation.test.ts +++ b/packages/platform-android/src/recording/start-reconciliation.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import { localRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { androidRecordingDevice, recordingHost, diff --git a/packages/platform-android/src/runtime.ts b/packages/platform-android/src/runtime.ts index 1f326a0fae..baf8e3413e 100644 --- a/packages/platform-android/src/runtime.ts +++ b/packages/platform-android/src/runtime.ts @@ -9,20 +9,30 @@ import type { import { applicationLifecycleOperationFacts, availableApplicationLifecycleOperations, - bindLocalFocusInteractor, - bindLocalScreenshotInteractor, - bindLocalTypeTextInteractor, +} from '@agent-device/contracts/application-lifecycle-runtime'; +import { bindElementTextRuntime, - bindLocalSnapshotInteractor, elementTextRuntimeOperationFacts, +} from '@agent-device/contracts/element-text-runtime'; +import { + bindLocalFocusInteractor, focusRuntimeOperationFacts, - typeTextRuntimeOperationFacts, - localRuntimeOwner, +} from '@agent-device/contracts/focus-runtime'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; +import { + bindLocalScreenshotInteractor, screenshotRuntimeOperationFacts, - selectorObservationRuntimeOperationFacts, +} from '@agent-device/contracts/screenshot-runtime'; +import { selectorObservationRuntimeOperationFacts } from '@agent-device/contracts/selector-observation-runtime'; +import { + bindLocalSnapshotInteractor, snapshotRuntimeOperationFacts, - viewportRuntimeOperationFacts, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/snapshot-runtime'; +import { + bindLocalTypeTextInteractor, + typeTextRuntimeOperationFacts, +} from '@agent-device/contracts/type-text-runtime'; +import { viewportRuntimeOperationFacts } from '@agent-device/contracts/viewport-runtime'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { createAndroidAppLogRuntime } from './logs/runtime.ts'; import { dumpAndroidNetworkTraffic } from './network/runtime.ts'; diff --git a/packages/platform-apple/src/lifecycle.ts b/packages/platform-apple/src/lifecycle.ts index 98f696f107..6a994c5bb5 100644 --- a/packages/platform-apple/src/lifecycle.ts +++ b/packages/platform-apple/src/lifecycle.ts @@ -10,10 +10,10 @@ import type { } from '@agent-device/contracts/platform'; import { bindLocalApplicationLifecycleInteractor, - hasRuntimeTransportHintValues, invokeApplicationClose, invokeApplicationOpen, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/application-lifecycle-interaction'; +import { hasRuntimeTransportHintValues } from '@agent-device/contracts/application-lifecycle-runtime'; import { isDeepLinkTarget } from '@agent-device/contracts/command'; import { ensureAppleReady } from './readiness/runtime.ts'; import { isApplePlatform, isIosFamily, type DeviceInfo } from '@agent-device/kernel/device'; diff --git a/packages/platform-apple/src/logs/descriptor.ts b/packages/platform-apple/src/logs/descriptor.ts index 2d5c8ea57c..d1777dc498 100644 --- a/packages/platform-apple/src/logs/descriptor.ts +++ b/packages/platform-apple/src/logs/descriptor.ts @@ -4,7 +4,7 @@ import type { DurableResourceEnvelope, RuntimeOwnerRef, } from '@agent-device/contracts/platform'; -import { APP_LOG_RESOURCE_KIND } from '@agent-device/contracts/platform'; +import { APP_LOG_RESOURCE_KIND } from '@agent-device/contracts/app-log-runtime'; import { createDurableResourceEnvelope, encodeDurableDescriptor } from '@agent-device/capture-kit'; export type AppleAppLogDescriptor = Readonly<{ diff --git a/packages/platform-apple/src/logs/runtime.ts b/packages/platform-apple/src/logs/runtime.ts index 70d234fbe8..de7f9128c8 100644 --- a/packages/platform-apple/src/logs/runtime.ts +++ b/packages/platform-apple/src/logs/runtime.ts @@ -13,7 +13,7 @@ import { createAppLogRecoveryOperations, reattachCleanupOnlyAppLogProcess, } from '@agent-device/capture-kit'; -import { localRuntimeOwner, sameRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner, sameRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { APPLE_XCTEST_LOGS_HINT, backendForAppleDevice } from './backend.ts'; import { appleAppLogDescriptorCodec } from './descriptor.ts'; import { doctorAppleAppLogs } from './doctor.ts'; diff --git a/packages/platform-apple/src/logs/start.test.ts b/packages/platform-apple/src/logs/start.test.ts index 8fcf5e68dc..78b4f8ad4f 100644 --- a/packages/platform-apple/src/logs/start.test.ts +++ b/packages/platform-apple/src/logs/start.test.ts @@ -1,4 +1,4 @@ -import { localRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { expect, test, vi } from 'vitest'; import { startAppleAppLogs } from './start.ts'; import { appleDevice, hostFixture } from './runtime.fixtures.ts'; diff --git a/packages/platform-apple/src/logs/start.ts b/packages/platform-apple/src/logs/start.ts index 284b3adb39..5116f887de 100644 --- a/packages/platform-apple/src/logs/start.ts +++ b/packages/platform-apple/src/logs/start.ts @@ -11,7 +11,7 @@ import type { RuntimeOwnerRef, } from '@agent-device/contracts/platform'; import type { LogBackend } from '@agent-device/contracts/observability'; -import { AsyncCleanupStack } from '@agent-device/contracts/platform'; +import { AsyncCleanupStack } from '@agent-device/contracts/async-lifecycle'; import { assertAppLogSessionArtifacts, createAppLogLiveHandleFromFinish, diff --git a/packages/platform-apple/src/recording/recovery.test.ts b/packages/platform-apple/src/recording/recovery.test.ts index 9fd9a44304..3c64cf26c8 100644 --- a/packages/platform-apple/src/recording/recovery.test.ts +++ b/packages/platform-apple/src/recording/recovery.test.ts @@ -1,5 +1,5 @@ import { expect, test, vi } from 'vitest'; -import { localRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { createAppleScreenRecordingOperations } from './runtime.ts'; import { appleRecordingHost, diff --git a/packages/platform-apple/src/recording/recovery.ts b/packages/platform-apple/src/recording/recovery.ts index f28daf87d5..3432292e91 100644 --- a/packages/platform-apple/src/recording/recovery.ts +++ b/packages/platform-apple/src/recording/recovery.ts @@ -7,7 +7,7 @@ import type { ScreenRecordingRuntimeHost, ScreenRecordingStartInput, } from '@agent-device/contracts/platform'; -import { SCREEN_RECORDING_RESOURCE_KIND } from '@agent-device/contracts/platform'; +import { SCREEN_RECORDING_RESOURCE_KIND } from '@agent-device/contracts/screen-recording-runtime'; import { createDurableResourceEnvelope, encodeDurableDescriptor } from '@agent-device/capture-kit'; export type AppleScreenRecordingOperationHost = Readonly<{ diff --git a/packages/platform-apple/src/recording/runtime.test.ts b/packages/platform-apple/src/recording/runtime.test.ts index 29a3dbcbcd..178e1efbe8 100644 --- a/packages/platform-apple/src/recording/runtime.test.ts +++ b/packages/platform-apple/src/recording/runtime.test.ts @@ -2,7 +2,7 @@ import assert from 'node:assert/strict'; import { expect, test, vi } from 'vitest'; import type { AppleScreenRecordingRunnerRequest } from '@agent-device/contracts/platform'; import type { DeviceInfo } from '@agent-device/kernel/device'; -import { localRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { createAppleScreenRecordingOperations, appleScreenRecordingFacts } from './runtime.ts'; import { appleRecordingHost as appleHost, diff --git a/packages/platform-apple/src/recording/runtime.ts b/packages/platform-apple/src/recording/runtime.ts index 881a96fcd8..cd874844dc 100644 --- a/packages/platform-apple/src/recording/runtime.ts +++ b/packages/platform-apple/src/recording/runtime.ts @@ -8,7 +8,7 @@ import type { ScreenRecordingRuntimeOperations, ScreenRecordingStartInput, } from '@agent-device/contracts/platform'; -import { PendingTransferGuard } from '@agent-device/contracts/platform'; +import { PendingTransferGuard } from '@agent-device/contracts/async-lifecycle'; import { createScreenRecordingLiveHandle } from '@agent-device/capture-kit'; import { completeAppleRecording as completion } from './completion.ts'; import { diff --git a/packages/platform-apple/src/runtime-snapshot.ts b/packages/platform-apple/src/runtime-snapshot.ts index d61d5095a0..0165ddd95e 100644 --- a/packages/platform-apple/src/runtime-snapshot.ts +++ b/packages/platform-apple/src/runtime-snapshot.ts @@ -10,7 +10,7 @@ import type { import { bindLocalSnapshotInteractor, captureSnapshotSignal, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/snapshot-runtime'; import { isMacOs, type DeviceInfo } from '@agent-device/kernel/device'; /** Apple-owned selection between app snapshots and explicit macOS surface snapshots. */ diff --git a/packages/platform-apple/src/runtime.ts b/packages/platform-apple/src/runtime.ts index 47f71cbcd5..91512a4f1d 100644 --- a/packages/platform-apple/src/runtime.ts +++ b/packages/platform-apple/src/runtime.ts @@ -9,19 +9,27 @@ import type { import { applicationLifecycleOperationFacts, availableApplicationLifecycleOperations, - bindLocalFocusInteractor, - bindLocalScreenshotInteractor, - bindLocalTypeTextInteractor, +} from '@agent-device/contracts/application-lifecycle-runtime'; +import { bindElementTextRuntime, elementTextRuntimeOperationFacts, +} from '@agent-device/contracts/element-text-runtime'; +import { + bindLocalFocusInteractor, focusRuntimeOperationFacts, - typeTextRuntimeOperationFacts, - localRuntimeOwner, +} from '@agent-device/contracts/focus-runtime'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; +import { + bindLocalScreenshotInteractor, screenshotRuntimeOperationFacts, - selectorObservationRuntimeOperationFacts, - snapshotRuntimeOperationFacts, - viewportRuntimeOperationFacts, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/screenshot-runtime'; +import { selectorObservationRuntimeOperationFacts } from '@agent-device/contracts/selector-observation-runtime'; +import { snapshotRuntimeOperationFacts } from '@agent-device/contracts/snapshot-runtime'; +import { + bindLocalTypeTextInteractor, + typeTextRuntimeOperationFacts, +} from '@agent-device/contracts/type-text-runtime'; +import { viewportRuntimeOperationFacts } from '@agent-device/contracts/viewport-runtime'; import { isIosFamily, isMacOs, diff --git a/packages/platform-harmonyos/src/lifecycle.ts b/packages/platform-harmonyos/src/lifecycle.ts index e012ede9c6..9cfe486bb9 100644 --- a/packages/platform-harmonyos/src/lifecycle.ts +++ b/packages/platform-harmonyos/src/lifecycle.ts @@ -5,7 +5,7 @@ import type { import { bindDirectApplicationLifecycle, bindLocalApplicationLifecycleInteractor, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/application-lifecycle-interaction'; import type { DeviceInfo } from '@agent-device/kernel/device'; type HarmonyLifecycleParams = Readonly<{ diff --git a/packages/platform-harmonyos/src/logs/descriptor.ts b/packages/platform-harmonyos/src/logs/descriptor.ts index b6eec5d29d..d35c38db32 100644 --- a/packages/platform-harmonyos/src/logs/descriptor.ts +++ b/packages/platform-harmonyos/src/logs/descriptor.ts @@ -4,7 +4,7 @@ import type { DurableResourceEnvelope, RuntimeOwnerRef, } from '@agent-device/contracts/platform'; -import { APP_LOG_RESOURCE_KIND } from '@agent-device/contracts/platform'; +import { APP_LOG_RESOURCE_KIND } from '@agent-device/contracts/app-log-runtime'; import { createDurableResourceEnvelope, encodeDurableDescriptor } from '@agent-device/capture-kit'; export type HarmonyAppLogDescriptor = Readonly<{ diff --git a/packages/platform-harmonyos/src/recording/recovery.test.ts b/packages/platform-harmonyos/src/recording/recovery.test.ts index 0eff6db355..2857d0e4d6 100644 --- a/packages/platform-harmonyos/src/recording/recovery.test.ts +++ b/packages/platform-harmonyos/src/recording/recovery.test.ts @@ -1,5 +1,5 @@ import { expect, test, vi } from 'vitest'; -import { localRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { createHarmonyScreenRecordingOperations } from './runtime.ts'; import { harmonyCommandSuccess, diff --git a/packages/platform-harmonyos/src/recording/recovery.ts b/packages/platform-harmonyos/src/recording/recovery.ts index 13585d551a..5cc2a69b55 100644 --- a/packages/platform-harmonyos/src/recording/recovery.ts +++ b/packages/platform-harmonyos/src/recording/recovery.ts @@ -5,7 +5,7 @@ import type { RuntimeOwnerRef, ScreenRecordingStartInput, } from '@agent-device/contracts/platform'; -import { SCREEN_RECORDING_RESOURCE_KIND } from '@agent-device/contracts/platform'; +import { SCREEN_RECORDING_RESOURCE_KIND } from '@agent-device/contracts/screen-recording-runtime'; import { createDurableResourceEnvelope, encodeDurableDescriptor } from '@agent-device/capture-kit'; export type HarmonyRecordingDescriptor = Readonly<{ diff --git a/packages/platform-harmonyos/src/recording/runtime.test.ts b/packages/platform-harmonyos/src/recording/runtime.test.ts index 92ca12830d..41fd6e625f 100644 --- a/packages/platform-harmonyos/src/recording/runtime.test.ts +++ b/packages/platform-harmonyos/src/recording/runtime.test.ts @@ -3,7 +3,7 @@ import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { expect, test, vi } from 'vitest'; -import { localRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { createHarmonyScreenRecordingOperations, harmonyScreenRecordingFacts } from './runtime.ts'; import { harmonyCommandSuccess as success, diff --git a/packages/platform-harmonyos/src/recording/runtime.ts b/packages/platform-harmonyos/src/recording/runtime.ts index c08abc68a8..e125158356 100644 --- a/packages/platform-harmonyos/src/recording/runtime.ts +++ b/packages/platform-harmonyos/src/recording/runtime.ts @@ -10,7 +10,7 @@ import type { ScreenRecordingRuntimeOperations, ScreenRecordingStartInput, } from '@agent-device/contracts/platform'; -import { PendingTransferGuard } from '@agent-device/contracts/platform'; +import { PendingTransferGuard } from '@agent-device/contracts/async-lifecycle'; import { createScreenRecordingCompletion, createScreenRecordingLiveHandle, diff --git a/packages/platform-harmonyos/src/runtime.ts b/packages/platform-harmonyos/src/runtime.ts index 6b0b0a3fb4..1d817d93a7 100644 --- a/packages/platform-harmonyos/src/runtime.ts +++ b/packages/platform-harmonyos/src/runtime.ts @@ -8,19 +8,27 @@ import type { import { applicationLifecycleOperationFacts, availableApplicationLifecycleOperations, +} from '@agent-device/contracts/application-lifecycle-runtime'; +import { elementTextRuntimeOperationFacts } from '@agent-device/contracts/element-text-runtime'; +import { bindLocalFocusInteractor, - bindLocalScreenshotInteractor, - bindLocalTypeTextInteractor, - bindLocalSnapshotInteractor, - elementTextRuntimeOperationFacts, focusRuntimeOperationFacts, - typeTextRuntimeOperationFacts, - localRuntimeOwner, +} from '@agent-device/contracts/focus-runtime'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; +import { + bindLocalScreenshotInteractor, screenshotRuntimeOperationFacts, - selectorObservationRuntimeOperationFacts, +} from '@agent-device/contracts/screenshot-runtime'; +import { selectorObservationRuntimeOperationFacts } from '@agent-device/contracts/selector-observation-runtime'; +import { + bindLocalSnapshotInteractor, snapshotRuntimeOperationFacts, - viewportRuntimeOperationFacts, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/snapshot-runtime'; +import { + bindLocalTypeTextInteractor, + typeTextRuntimeOperationFacts, +} from '@agent-device/contracts/type-text-runtime'; +import { viewportRuntimeOperationFacts } from '@agent-device/contracts/viewport-runtime'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { createHarmonyAppLogRuntime } from './logs/runtime.ts'; import { diff --git a/packages/platform-linux/src/lifecycle.ts b/packages/platform-linux/src/lifecycle.ts index 7e779d7367..fb2e487c90 100644 --- a/packages/platform-linux/src/lifecycle.ts +++ b/packages/platform-linux/src/lifecycle.ts @@ -5,7 +5,7 @@ import type { import { bindDirectApplicationLifecycle, bindLocalApplicationLifecycleInteractor, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/application-lifecycle-interaction'; import type { DeviceInfo } from '@agent-device/kernel/device'; type LinuxLifecycleParams = Readonly<{ diff --git a/packages/platform-linux/src/runtime.ts b/packages/platform-linux/src/runtime.ts index 01e6558b58..9730cd3381 100644 --- a/packages/platform-linux/src/runtime.ts +++ b/packages/platform-linux/src/runtime.ts @@ -10,20 +10,29 @@ import type { import { applicationLifecycleOperationFacts, availableApplicationLifecycleOperations, - bindLocalFocusInteractor, - bindLocalScreenshotInteractor, - bindLocalTypeTextInteractor, +} from '@agent-device/contracts/application-lifecycle-runtime'; +import { bindElementTextRuntime, - captureSnapshotSignal, - createUnavailablePlatformRuntimeFacts, elementTextRuntimeOperationFacts, +} from '@agent-device/contracts/element-text-runtime'; +import { + bindLocalFocusInteractor, focusRuntimeOperationFacts, - typeTextRuntimeOperationFacts, - localRuntimeOwner, - sameRuntimeOwner, +} from '@agent-device/contracts/focus-runtime'; +import { localRuntimeOwner, sameRuntimeOwner } from '@agent-device/contracts/platform-runtime'; +import { createUnavailablePlatformRuntimeFacts } from '@agent-device/contracts/platform-runtime-unavailable'; +import { + bindLocalScreenshotInteractor, screenshotRuntimeOperationFacts, +} from '@agent-device/contracts/screenshot-runtime'; +import { + captureSnapshotSignal, snapshotRuntimeOperationFacts, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/snapshot-runtime'; +import { + bindLocalTypeTextInteractor, + typeTextRuntimeOperationFacts, +} from '@agent-device/contracts/type-text-runtime'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { AppError } from '@agent-device/kernel/errors'; import { bindLinuxApplicationLifecycle } from './lifecycle.ts'; diff --git a/packages/platform-vega/src/lifecycle.ts b/packages/platform-vega/src/lifecycle.ts index 6890f154dc..313a201f52 100644 --- a/packages/platform-vega/src/lifecycle.ts +++ b/packages/platform-vega/src/lifecycle.ts @@ -5,7 +5,7 @@ import type { import { bindDirectApplicationLifecycle, bindLocalApplicationLifecycleInteractor, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/application-lifecycle-interaction'; import type { DeviceInfo } from '@agent-device/kernel/device'; type VegaLifecycleParams = Readonly<{ diff --git a/packages/platform-vega/src/runtime.ts b/packages/platform-vega/src/runtime.ts index c071e08f39..7669d39ef0 100644 --- a/packages/platform-vega/src/runtime.ts +++ b/packages/platform-vega/src/runtime.ts @@ -9,10 +9,9 @@ import type { import { applicationLifecycleOperationFacts, availableApplicationLifecycleOperations, - createUnavailablePlatformRuntimeFacts, - localRuntimeOwner, - sameRuntimeOwner, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/application-lifecycle-runtime'; +import { localRuntimeOwner, sameRuntimeOwner } from '@agent-device/contracts/platform-runtime'; +import { createUnavailablePlatformRuntimeFacts } from '@agent-device/contracts/platform-runtime-unavailable'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { AppError } from '@agent-device/kernel/errors'; import { bindVegaApplicationLifecycle } from './lifecycle.ts'; diff --git a/packages/platform-web/src/lifecycle.ts b/packages/platform-web/src/lifecycle.ts index 83b24ccf82..933621a9cd 100644 --- a/packages/platform-web/src/lifecycle.ts +++ b/packages/platform-web/src/lifecycle.ts @@ -5,7 +5,7 @@ import type { import { bindDirectApplicationLifecycle, bindLocalApplicationLifecycleInteractor, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/application-lifecycle-interaction'; import type { DeviceInfo } from '@agent-device/kernel/device'; type WebLifecycleParams = Readonly<{ diff --git a/packages/platform-web/src/recording/runtime.test.ts b/packages/platform-web/src/recording/runtime.test.ts index e04ab86590..c0dba73e3e 100644 --- a/packages/platform-web/src/recording/runtime.test.ts +++ b/packages/platform-web/src/recording/runtime.test.ts @@ -3,7 +3,7 @@ import { join } from 'node:path'; import { tmpdir } from 'node:os'; import { expect, test, vi } from 'vitest'; import type { ScreenRecordingRuntimeHost } from '@agent-device/contracts/platform'; -import { localRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { bindWebScreenRecordingRuntime } from './runtime.ts'; const device = { diff --git a/packages/platform-web/src/recording/runtime.ts b/packages/platform-web/src/recording/runtime.ts index 94605e04ce..ae382e91f8 100644 --- a/packages/platform-web/src/recording/runtime.ts +++ b/packages/platform-web/src/recording/runtime.ts @@ -7,10 +7,8 @@ import type { ScreenRecordingRuntimeOperations, ScreenRecordingStartInput, } from '@agent-device/contracts/platform'; -import { - PendingTransferGuard, - SCREEN_RECORDING_RESOURCE_KIND, -} from '@agent-device/contracts/platform'; +import { PendingTransferGuard } from '@agent-device/contracts/async-lifecycle'; +import { SCREEN_RECORDING_RESOURCE_KIND } from '@agent-device/contracts/screen-recording-runtime'; import { assertScreenRecordingOptionsSupported, createScreenRecordingCompletion, diff --git a/packages/platform-web/src/runtime.ts b/packages/platform-web/src/runtime.ts index c14e9086fc..9631816b46 100644 --- a/packages/platform-web/src/runtime.ts +++ b/packages/platform-web/src/runtime.ts @@ -8,20 +8,27 @@ import type { import { applicationLifecycleOperationFacts, availableApplicationLifecycleOperations, +} from '@agent-device/contracts/application-lifecycle-runtime'; +import { elementTextRuntimeOperationFacts } from '@agent-device/contracts/element-text-runtime'; +import { bindLocalFocusInteractor, - bindLocalScreenshotInteractor, - bindLocalTypeTextInteractor, - bindLocalSnapshotInteractor, - elementTextRuntimeOperationFacts, focusRuntimeOperationFacts, - typeTextRuntimeOperationFacts, - localRuntimeOwner, +} from '@agent-device/contracts/focus-runtime'; +import { localRuntimeOwner, sameRuntimeOwner } from '@agent-device/contracts/platform-runtime'; +import { + bindLocalScreenshotInteractor, screenshotRuntimeOperationFacts, - selectorObservationRuntimeOperationFacts, +} from '@agent-device/contracts/screenshot-runtime'; +import { selectorObservationRuntimeOperationFacts } from '@agent-device/contracts/selector-observation-runtime'; +import { + bindLocalSnapshotInteractor, snapshotRuntimeOperationFacts, - sameRuntimeOwner, - viewportRuntimeOperationFacts, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/snapshot-runtime'; +import { + bindLocalTypeTextInteractor, + typeTextRuntimeOperationFacts, +} from '@agent-device/contracts/type-text-runtime'; +import { viewportRuntimeOperationFacts } from '@agent-device/contracts/viewport-runtime'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { AppError } from '@agent-device/kernel/errors'; import { bindWebScreenRecordingRuntime } from './recording/runtime.ts'; diff --git a/packages/provider-limrun/src/app-log-descriptor.ts b/packages/provider-limrun/src/app-log-descriptor.ts index ef28144e53..495d1d6717 100644 --- a/packages/provider-limrun/src/app-log-descriptor.ts +++ b/packages/provider-limrun/src/app-log-descriptor.ts @@ -4,7 +4,7 @@ import type { DurableResourceEnvelope, RuntimeOwnerRef, } from '@agent-device/contracts/platform'; -import { APP_LOG_RESOURCE_KIND } from '@agent-device/contracts/platform'; +import { APP_LOG_RESOURCE_KIND } from '@agent-device/contracts/app-log-runtime'; import { createDurableResourceEnvelope, encodeDurableDescriptor } from '@agent-device/capture-kit'; export type LimrunAppLogDescriptor = Readonly<{ diff --git a/packages/provider-limrun/src/app-log-poller.ts b/packages/provider-limrun/src/app-log-poller.ts index b031568780..43d2308751 100644 --- a/packages/provider-limrun/src/app-log-poller.ts +++ b/packages/provider-limrun/src/app-log-poller.ts @@ -5,7 +5,7 @@ import type { AppLogRuntimeHost, FinishOutcome, } from '@agent-device/contracts/platform'; -import { AsyncCleanupStack } from '@agent-device/contracts/platform'; +import { AsyncCleanupStack } from '@agent-device/contracts/async-lifecycle'; import { createAppLogLiveHandleFromFinish } from '@agent-device/capture-kit'; import type { LogBackend } from '@agent-device/contracts/observability'; import { awaitLimrunOperation } from './request-cancellation.ts'; diff --git a/packages/provider-limrun/src/app-log-reconnect.ts b/packages/provider-limrun/src/app-log-reconnect.ts index 9cfaa9e170..a9fd2f2fd9 100644 --- a/packages/provider-limrun/src/app-log-reconnect.ts +++ b/packages/provider-limrun/src/app-log-reconnect.ts @@ -2,7 +2,7 @@ import type Limrun from '@limrun/api'; import { NotFoundError } from '@limrun/api'; import { createInstanceClient as createAndroidInstanceClient } from '@limrun/api/instance-client'; import { createInstanceClient as createIosInstanceClient } from '@limrun/api/ios-client'; -import { AsyncCleanupStack } from '@agent-device/contracts/platform'; +import { AsyncCleanupStack } from '@agent-device/contracts/async-lifecycle'; import type { LimrunAppLogDescriptor } from './app-log-descriptor.ts'; import type { LimrunAppLogReader } from './app-log-poller.ts'; import type { LimrunAppLogReconnectOutcome } from './app-log-runtime.ts'; diff --git a/packages/provider-limrun/src/app-log-runtime.test.ts b/packages/provider-limrun/src/app-log-runtime.test.ts index 7ec5747589..b7224d82d0 100644 --- a/packages/provider-limrun/src/app-log-runtime.test.ts +++ b/packages/provider-limrun/src/app-log-runtime.test.ts @@ -1,9 +1,9 @@ +import { narrowDeviceBinding } from '@agent-device/contracts/platform-runtime'; import { appStateUse, appsRuntimeUse, bootTargetUse, - narrowDeviceBinding, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/platform-runtime-operations'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { expect, test, vi } from 'vitest'; import { createLimrunAppLogEnvelope } from './app-log-descriptor.ts'; diff --git a/packages/provider-limrun/src/app-log-runtime.ts b/packages/provider-limrun/src/app-log-runtime.ts index e6a78c47df..f6e45ad071 100644 --- a/packages/provider-limrun/src/app-log-runtime.ts +++ b/packages/provider-limrun/src/app-log-runtime.ts @@ -25,15 +25,14 @@ import { import { applicationLifecycleOperationFacts, availableApplicationLifecycleOperations, - createUnavailablePlatformRuntimeFacts, - providerRuntimeOwner, - sameRuntimeOwner, - screenshotRuntimeOperationFacts, - elementTextRuntimeOperationFacts, - selectorObservationRuntimeOperationFacts, - snapshotRuntimeOperationFacts, - viewportRuntimeOperationFacts, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/application-lifecycle-runtime'; +import { elementTextRuntimeOperationFacts } from '@agent-device/contracts/element-text-runtime'; +import { providerRuntimeOwner, sameRuntimeOwner } from '@agent-device/contracts/platform-runtime'; +import { createUnavailablePlatformRuntimeFacts } from '@agent-device/contracts/platform-runtime-unavailable'; +import { screenshotRuntimeOperationFacts } from '@agent-device/contracts/screenshot-runtime'; +import { selectorObservationRuntimeOperationFacts } from '@agent-device/contracts/selector-observation-runtime'; +import { snapshotRuntimeOperationFacts } from '@agent-device/contracts/snapshot-runtime'; +import { viewportRuntimeOperationFacts } from '@agent-device/contracts/viewport-runtime'; import { createLimrunAppLogEnvelope, limrunAppLogDescriptorCodec, diff --git a/packages/provider-limrun/src/interaction-operations.ts b/packages/provider-limrun/src/interaction-operations.ts index 5f9247ffc7..e4a21abf41 100644 --- a/packages/provider-limrun/src/interaction-operations.ts +++ b/packages/provider-limrun/src/interaction-operations.ts @@ -1,11 +1,13 @@ import { bindProviderFocusInteractor, - bindProviderScreenshotInteractor, - bindProviderSnapshotInteractor, - bindProviderTypeTextInteractor, focusRuntimeOperationFacts, +} from '@agent-device/contracts/focus-runtime'; +import { bindProviderScreenshotInteractor } from '@agent-device/contracts/screenshot-runtime'; +import { bindProviderSnapshotInteractor } from '@agent-device/contracts/snapshot-runtime'; +import { + bindProviderTypeTextInteractor, typeTextRuntimeOperationFacts, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/type-text-runtime'; import type { Interactor, RunnerContext } from '@agent-device/contracts/interaction'; import type { RuntimeOperationUnavailability } from '@agent-device/contracts/platform'; import type { DeviceInfo } from '@agent-device/kernel/device'; diff --git a/packages/provider-limrun/src/lifecycle.ts b/packages/provider-limrun/src/lifecycle.ts index f4ae328f7e..259a219bf9 100644 --- a/packages/provider-limrun/src/lifecycle.ts +++ b/packages/provider-limrun/src/lifecycle.ts @@ -2,7 +2,7 @@ import type { ApplicationLifecycleRuntimeOperations } from '@agent-device/contra import { bindDirectApplicationLifecycle, bindProviderApplicationLifecycleInteractor, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/application-lifecycle-interaction'; import type { Interactor, RunnerContext } from '@agent-device/contracts/interaction'; import type { ProviderPortReverseOptions } from '@agent-device/contracts/device'; import type { DeviceInfo } from '@agent-device/kernel/device'; diff --git a/packages/provider-limrun/src/runtime.ts b/packages/provider-limrun/src/runtime.ts index e47a6173ca..81f4e37e48 100644 --- a/packages/provider-limrun/src/runtime.ts +++ b/packages/provider-limrun/src/runtime.ts @@ -39,7 +39,7 @@ import type { PlatformRuntimeOwner, PlatformRuntimeProviderModule, } from '@agent-device/contracts/platform'; -import { providerRuntimeOwner } from '@agent-device/contracts/platform'; +import { providerRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import type { LimrunAppLogDescriptor } from './app-log-descriptor.ts'; import type { LimrunAppLogReader } from './app-log-poller.ts'; import { buildLimrunClientOptions, LIMRUN_CLIENT_HEADER } from './client-options.ts'; diff --git a/packages/provider-webdriver/src/lifecycle.ts b/packages/provider-webdriver/src/lifecycle.ts index 8540dd2a82..026e983c7e 100644 --- a/packages/provider-webdriver/src/lifecycle.ts +++ b/packages/provider-webdriver/src/lifecycle.ts @@ -2,7 +2,7 @@ import type { ApplicationLifecycleRuntimeOperations } from '@agent-device/contra import { bindDirectApplicationLifecycle, bindProviderApplicationLifecycleInteractor, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/application-lifecycle-interaction'; import type { Interactor, RunnerContext } from '@agent-device/contracts/interaction'; import type { DeviceInfo } from '@agent-device/kernel/device'; diff --git a/packages/provider-webdriver/src/platform-runtime.test.ts b/packages/provider-webdriver/src/platform-runtime.test.ts index 1d9d26f017..794c2459fe 100644 --- a/packages/provider-webdriver/src/platform-runtime.test.ts +++ b/packages/provider-webdriver/src/platform-runtime.test.ts @@ -1,6 +1,6 @@ import { expect, test, vi } from 'vitest'; import type { PlatformRuntimeHost } from '@agent-device/contracts/platform'; -import { providerRuntimeOwner } from '@agent-device/contracts/platform'; +import { providerRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import type { DeviceInfo } from '@agent-device/kernel/device'; import type { Interactor } from '@agent-device/contracts/interaction'; import { createWebDriverPlatformRuntimeOwner } from './platform-runtime.ts'; diff --git a/packages/provider-webdriver/src/platform-runtime.ts b/packages/provider-webdriver/src/platform-runtime.ts index dfdcf76596..1db4051e60 100644 --- a/packages/provider-webdriver/src/platform-runtime.ts +++ b/packages/provider-webdriver/src/platform-runtime.ts @@ -1,30 +1,44 @@ +import type { + AppDeploymentInput, + DeployMaterializedAppInput, + MaterializeAppSourceInput, + MaterializedAppSource, +} from '@agent-device/contracts/app-deployment-runtime'; import { applicationLifecycleOperationFacts, availableApplicationLifecycleOperations, +} from '@agent-device/contracts/application-lifecycle-runtime'; +import { bindProviderFocusInteractor, - bindProviderScreenshotInteractor, - bindProviderTypeTextInteractor, - bindProviderSnapshotInteractor, - createUnavailablePlatformRuntimeFacts, - sameRuntimeOwner, focusRuntimeOperationFacts, - screenshotRuntimeOperationFacts, - typeTextRuntimeOperationFacts, - snapshotRuntimeOperationFacts, - viewportRuntimeOperationFacts, - type AppDeploymentInput, - type DeployMaterializedAppInput, +} from '@agent-device/contracts/focus-runtime'; +import { type DeviceBinding, - type MaterializeAppSourceInput, - type MaterializedAppSource, - type PlatformRuntimeHost, - type PlatformRuntimeOperations, - type PlatformRuntimeOwner, type RuntimeFacts, type RuntimeOperationFact, type RuntimeOperationUnavailability, type RuntimeOwnerRef, -} from '@agent-device/contracts/platform'; + sameRuntimeOwner, +} from '@agent-device/contracts/platform-runtime'; +import type { + PlatformRuntimeHost, + PlatformRuntimeOperations, + PlatformRuntimeOwner, +} from '@agent-device/contracts/platform-runtime-operations'; +import { createUnavailablePlatformRuntimeFacts } from '@agent-device/contracts/platform-runtime-unavailable'; +import { + bindProviderScreenshotInteractor, + screenshotRuntimeOperationFacts, +} from '@agent-device/contracts/screenshot-runtime'; +import { + bindProviderSnapshotInteractor, + snapshotRuntimeOperationFacts, +} from '@agent-device/contracts/snapshot-runtime'; +import { + bindProviderTypeTextInteractor, + typeTextRuntimeOperationFacts, +} from '@agent-device/contracts/type-text-runtime'; +import { viewportRuntimeOperationFacts } from '@agent-device/contracts/viewport-runtime'; import type { Interactor, RunnerContext } from '@agent-device/contracts/interaction'; import { readRecentNetworkTrafficFromText } from '@agent-device/capture-kit'; import type { DeviceInfo } from '@agent-device/kernel/device'; diff --git a/packages/provider-webdriver/src/runtime.ts b/packages/provider-webdriver/src/runtime.ts index 34d3d7a56e..d7977ce9fd 100644 --- a/packages/provider-webdriver/src/runtime.ts +++ b/packages/provider-webdriver/src/runtime.ts @@ -17,7 +17,7 @@ import type { PlatformRuntimeOwner, PlatformRuntimeProviderModule, } from '@agent-device/contracts/platform'; -import { providerRuntimeOwner } from '@agent-device/contracts/platform'; +import { providerRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { createCloudWebDriverCapabilities, diff --git a/packages/provider-webdriver/src/webdriver-interactor.test.ts b/packages/provider-webdriver/src/webdriver-interactor.test.ts index 56a4355eba..c26da0b623 100644 --- a/packages/provider-webdriver/src/webdriver-interactor.test.ts +++ b/packages/provider-webdriver/src/webdriver-interactor.test.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { test, vi } from 'vitest'; -import { buildGesturePlan } from '@agent-device/contracts/interaction'; +import { buildGesturePlan } from '@agent-device/contracts/gesture-plan'; import { AppError } from '@agent-device/kernel/errors'; import { createCloudWebDriverCapabilities } from './capabilities.ts'; import type { WebDriverClient, W3CActionSequence } from './webdriver-client.ts'; diff --git a/packages/provider-webdriver/src/webdriver-interactor.ts b/packages/provider-webdriver/src/webdriver-interactor.ts index 7867ff6762..0b699483d7 100644 --- a/packages/provider-webdriver/src/webdriver-interactor.ts +++ b/packages/provider-webdriver/src/webdriver-interactor.ts @@ -10,7 +10,7 @@ import type { SnapshotResult, TvRemoteButton, } from '@agent-device/contracts/interaction'; -import { buildScrollGesturePlan } from '@agent-device/contracts/interaction'; +import { buildScrollGesturePlan } from '@agent-device/contracts/scroll-gesture'; import type { SettingOptions } from '@agent-device/contracts/settings'; import { AppError } from '@agent-device/kernel/errors'; import { diff --git a/scripts/layering/package-boundaries.test.ts b/scripts/layering/package-boundaries.test.ts index 7fbca25b08..3ad04b6203 100644 --- a/scripts/layering/package-boundaries.test.ts +++ b/scripts/layering/package-boundaries.test.ts @@ -44,21 +44,76 @@ const contracts: WorkspacePackage = { const ALL = [kernel, contracts]; const CONTRACT_EXPORTS = [ + '@agent-device/contracts/alert-contract', + '@agent-device/contracts/android-input-ownership', + '@agent-device/contracts/android-snapshot-quality', + '@agent-device/contracts/android-system-chrome', + '@agent-device/contracts/app-deployment-runtime', + '@agent-device/contracts/app-deployment-runtime-plan', + '@agent-device/contracts/app-inventory-runtime', + '@agent-device/contracts/app-log-runtime', + '@agent-device/contracts/app-state-runtime', + '@agent-device/contracts/apple-multitouch-support', + '@agent-device/contracts/application-lifecycle-interaction', + '@agent-device/contracts/application-lifecycle-runtime', + '@agent-device/contracts/application-lifecycle-runtime-plan', + '@agent-device/contracts/async-lifecycle', + '@agent-device/contracts/audio-probe-result', + '@agent-device/contracts/audio-probe-support', + '@agent-device/contracts/back-mode', '@agent-device/contracts/capture', + '@agent-device/contracts/click-button', '@agent-device/contracts/client', '@agent-device/contracts/command', + '@agent-device/contracts/command-platform-execution', '@agent-device/contracts/device', + '@agent-device/contracts/device-readiness-runtime', + '@agent-device/contracts/device-shutdown-runtime', '@agent-device/contracts/divergence', + '@agent-device/contracts/durable-resource', + '@agent-device/contracts/durable-resource-envelope', + '@agent-device/contracts/element-text-runtime', + '@agent-device/contracts/focus-runtime', + '@agent-device/contracts/gesture-input', + '@agent-device/contracts/gesture-normalization', + '@agent-device/contracts/gesture-plan', + '@agent-device/contracts/gesture-plan-types', '@agent-device/contracts/interaction', + '@agent-device/contracts/interaction-error', + '@agent-device/contracts/interaction-guarantees', + '@agent-device/contracts/interactor-types', + '@agent-device/contracts/logs-runtime-plan', + '@agent-device/contracts/navigation', + '@agent-device/contracts/network-runtime', + '@agent-device/contracts/network-runtime-plan', '@agent-device/contracts/observability', '@agent-device/contracts/platform', + '@agent-device/contracts/platform-module', + '@agent-device/contracts/platform-runtime', + '@agent-device/contracts/platform-runtime-host', + '@agent-device/contracts/platform-runtime-operations', + '@agent-device/contracts/platform-runtime-unavailable', '@agent-device/contracts/progress', + '@agent-device/contracts/record-runtime-cutover', '@agent-device/contracts/recording', '@agent-device/contracts/remote', '@agent-device/contracts/replay', + '@agent-device/contracts/screen-recording-runtime', + '@agent-device/contracts/screen-recording-runtime-plan', + '@agent-device/contracts/screenshot-runtime', + '@agent-device/contracts/scroll-command', + '@agent-device/contracts/scroll-gesture', + '@agent-device/contracts/selector-observation-runtime', '@agent-device/contracts/session', '@agent-device/contracts/settings', '@agent-device/contracts/snapshot', + '@agent-device/contracts/snapshot-runtime', + '@agent-device/contracts/startup-recovery-fence', + '@agent-device/contracts/tv-remote', + '@agent-device/contracts/type-text-runtime', + '@agent-device/contracts/viewport-runtime', + '@agent-device/contracts/wait', + '@agent-device/contracts/wait-runtime-plan', ] as const; function rules(violations: { rule: string }[]): string[] { @@ -540,7 +595,7 @@ test('Node resolution enforces the exports map at runtime', () => { '@agent-device/kernel/src/errors.ts', '@agent-device/kernel/internal-not-exported', '@agent-device/kernel', - '@agent-device/contracts/gesture-plan', + '@agent-device/contracts/clipboard', '@agent-device/contracts/src/gesture-plan.ts', '@agent-device/contracts', '@agent-device/contracts/src/snapshot-text.ts', diff --git a/scripts/layering/record-runtime-registry-policy.ts b/scripts/layering/record-runtime-registry-policy.ts index 0168ea3346..855046517f 100644 --- a/scripts/layering/record-runtime-registry-policy.ts +++ b/scripts/layering/record-runtime-registry-policy.ts @@ -31,7 +31,14 @@ function importedRecordRuntimeAssertionName(node: unknown): string | undefined { visitAst(node, (candidate) => { if (candidate.type !== 'ImportDeclaration') return; const source = candidate.source as Record | undefined; - if (source?.type !== 'Literal' || source.value !== '@agent-device/contracts/platform') return; + // Any contracts entry, not one named subpath: the assertion's provenance is what + // this rule pins, and #1959 splits that vocabulary across per-module entries. + if ( + source?.type !== 'Literal' || + !String(source.value).startsWith('@agent-device/contracts/') + ) { + return; + } const specifiers = candidate.specifiers as readonly Record[] | undefined; const assertion = specifiers?.find((specifier) => { const imported = specifier.imported as Record | undefined; diff --git a/src/__tests__/contracts-entry-closure.test.ts b/src/__tests__/contracts-entry-closure.test.ts new file mode 100644 index 0000000000..3805c5a771 --- /dev/null +++ b/src/__tests__/contracts-entry-closure.test.ts @@ -0,0 +1,95 @@ +import { expect, test } from 'vitest'; +import fs from 'node:fs'; +import path from 'node:path'; +import { eagerClosureOf, eagerlyEvaluatedModules } from './eager-import-closure.fixtures.ts'; + +/** + * `@agent-device/contracts/platform` and `/interaction` union 32 and 18 vocabulary + * modules. A file that value-imports either one evaluates the whole union to reach a + * single function, and because permanent hubs sat behind them (#1959) that union rode + * into ~470 of the suite's ~970 test graphs. + * + * Every one of those modules now has its own entry subpath, so the narrow import is + * always available. These two tests keep it that way from both directions: the first + * pins the four hubs the issue named, and the second closes the general case so the + * clump cannot re-form behind a hub nobody thought to list. + * + * Type-only importers are untouched and stay legal — `import type` is erased, so it + * evaluates nothing. That is the same distinction the walker itself draws, which is + * why this reads the AST through it rather than matching specifier text. + */ + +const repoRoot = path.resolve(import.meta.dirname, '../..'); +const CLUMP_ENTRIES = [ + '@agent-device/contracts/platform', + '@agent-device/contracts/interaction', +] as const; +const CLUMP_FACADES = [ + 'packages/contracts/src/facades/platform.ts', + 'packages/contracts/src/facades/interaction.ts', +].map((file) => path.resolve(repoRoot, file)); + +const HUBS = [ + 'src/core/command-descriptor/registry.ts', + 'src/core/capabilities.ts', + 'src/core/interactors/register-builtins.ts', + 'src/core/command-descriptor/platform-execution-entry.ts', +]; + +function sourceFiles(): string[] { + const found: string[] = []; + const walk = (dir: string): void => { + for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { + const full = path.join(dir, entry.name); + if (entry.isDirectory()) { + if (entry.name !== 'node_modules') walk(full); + } else if (entry.name.endsWith('.ts')) found.push(full); + } + }; + walk(path.join(repoRoot, 'src')); + for (const pkg of fs.readdirSync(path.join(repoRoot, 'packages'))) { + const src = path.join(repoRoot, 'packages', pkg, 'src'); + if (fs.existsSync(src)) walk(src); + } + return found; +} + +test('the hubs behind the contracts clump never evaluate either wide facade', () => { + const offenders = HUBS.flatMap((hub) => { + const carried = eagerClosureOf(path.resolve(repoRoot, hub)).filter((file) => + CLUMP_FACADES.includes(file), + ); + return carried.map((file) => `${hub} -> ${path.relative(repoRoot, file)}`); + }); + + expect( + offenders, + 'These hubs sit in hundreds of test graphs, so whatever they evaluate, the suite pays for ' + + 'everywhere. Import the symbol from the vocabulary module that owns it ' + + '(@agent-device/contracts/) instead of the wide facade.', + ).toEqual([]); +}); + +test('no source file value-imports the wide contracts facades', () => { + const offenders: string[] = []; + let narrowEntryImports = 0; + for (const file of sourceFiles()) { + for (const specifier of eagerlyEvaluatedModules(file, fs.readFileSync(file, 'utf8'))) { + if (CLUMP_ENTRIES.includes(specifier as (typeof CLUMP_ENTRIES)[number])) { + offenders.push(`${path.relative(repoRoot, file)} -> ${specifier}`); + } else if (specifier.startsWith('@agent-device/contracts/')) { + narrowEntryImports += 1; + } + } + } + + // Non-vacuity: a walker that returned nothing would pass the assertion below while + // proving nothing, so require that it still sees the narrow imports that replaced these. + expect(narrowEntryImports).toBeGreaterThan(100); + expect( + offenders.sort(), + 'Value-importing these facades evaluates every module they re-export from. Each of those ' + + 'modules has its own entry subpath in packages/contracts/package.json — import from that. ' + + '`import type` from the facades stays fine: it is erased, so it evaluates nothing.', + ).toEqual([]); +}); diff --git a/src/__tests__/contracts/apple-os-capability-table-parity.test.ts b/src/__tests__/contracts/apple-os-capability-table-parity.test.ts index 8f7d8b34a4..265a2302c8 100644 --- a/src/__tests__/contracts/apple-os-capability-table-parity.test.ts +++ b/src/__tests__/contracts/apple-os-capability-table-parity.test.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; -import { isAudioProbeSupportedDevice } from '@agent-device/contracts/platform'; +import { isAudioProbeSupportedDevice } from '@agent-device/contracts/audio-probe-support'; import { isIosFamily, isMacOs, diff --git a/src/__tests__/contracts/interaction-contract-coverage.test.ts b/src/__tests__/contracts/interaction-contract-coverage.test.ts index 1f9378f683..7918d5b833 100644 --- a/src/__tests__/contracts/interaction-contract-coverage.test.ts +++ b/src/__tests__/contracts/interaction-contract-coverage.test.ts @@ -4,7 +4,7 @@ import { INTERACTION_DISPATCH_PATHS, INTERACTION_GUARANTEES, INTERACTION_PATH_IDS, -} from '@agent-device/contracts/interaction'; +} from '@agent-device/contracts/interaction-guarantees'; import { CONTRACT_COVERAGE } from '../../../test/integration/interaction-contract/index.ts'; // ADR 0011 Layer-3 root gate: the contract scenario suite is registry-driven. Every diff --git a/src/__tests__/contracts/interaction-guarantees.test.ts b/src/__tests__/contracts/interaction-guarantees.test.ts index edffe8aa28..fb7833b13e 100644 --- a/src/__tests__/contracts/interaction-guarantees.test.ts +++ b/src/__tests__/contracts/interaction-guarantees.test.ts @@ -7,7 +7,7 @@ import { INTERACTION_DISPATCH_PATHS, INTERACTION_GUARANTEES, INTERACTION_PATH_IDS, -} from '@agent-device/contracts/interaction'; +} from '@agent-device/contracts/interaction-guarantees'; // ADR 0011 Layer-1 root gate: the matrix must stay complete (typed) AND honest // (referenced implementations exist, waivers carry reasons). A cell that diff --git a/src/__tests__/test-utils/device-inventory-gateways.ts b/src/__tests__/test-utils/device-inventory-gateways.ts index 57ab0b8fcb..e763336105 100644 --- a/src/__tests__/test-utils/device-inventory-gateways.ts +++ b/src/__tests__/test-utils/device-inventory-gateways.ts @@ -10,7 +10,7 @@ import type { InventoryPlatformModule, PlatformRequestScope, } from '@agent-device/contracts/platform'; -import { createPlatformModuleRegistry } from '@agent-device/contracts/platform'; +import { createPlatformModuleRegistry } from '@agent-device/contracts/platform-module'; import type { DeviceInfo, Platform } from '@agent-device/kernel/device'; import { withDeviceInventoryContext } from '../../core/device-inventory-context.ts'; import { createComposedDeviceInventoryGateways } from '../../platform-runtime-device-inventory.ts'; diff --git a/src/__tests__/test-utils/property-arbitraries.ts b/src/__tests__/test-utils/property-arbitraries.ts index 0e283c5470..4dada8f5f0 100644 --- a/src/__tests__/test-utils/property-arbitraries.ts +++ b/src/__tests__/test-utils/property-arbitraries.ts @@ -1,9 +1,8 @@ import { COORDINATE_GESTURE_KINDS, - SCROLL_DIRECTIONS, - SWIPE_PRESETS, type GesturePayload, -} from '@agent-device/contracts/interaction'; +} from '@agent-device/contracts/gesture-input'; +import { SCROLL_DIRECTIONS, SWIPE_PRESETS } from '@agent-device/contracts/scroll-gesture'; import { attachRefs, type Point, diff --git a/src/__tests__/test-utils/runtime-operation-facts.ts b/src/__tests__/test-utils/runtime-operation-facts.ts index a0eb209a30..196509a8f9 100644 --- a/src/__tests__/test-utils/runtime-operation-facts.ts +++ b/src/__tests__/test-utils/runtime-operation-facts.ts @@ -1,10 +1,8 @@ -import { - applicationLifecycleOperationFacts, - screenshotRuntimeOperationFacts, - elementTextRuntimeOperationFacts, - snapshotRuntimeOperationFacts, - type RuntimeOperationFact, -} from '@agent-device/contracts/platform'; +import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; +import { elementTextRuntimeOperationFacts } from '@agent-device/contracts/element-text-runtime'; +import type { RuntimeOperationFact } from '@agent-device/contracts/platform-runtime'; +import { screenshotRuntimeOperationFacts } from '@agent-device/contracts/screenshot-runtime'; +import { snapshotRuntimeOperationFacts } from '@agent-device/contracts/snapshot-runtime'; const unavailable: RuntimeOperationFact = Object.freeze({ available: false, diff --git a/src/__tests__/test-utils/screen-recording-live-handle.ts b/src/__tests__/test-utils/screen-recording-live-handle.ts index 1e97a6822a..c79181782d 100644 --- a/src/__tests__/test-utils/screen-recording-live-handle.ts +++ b/src/__tests__/test-utils/screen-recording-live-handle.ts @@ -2,10 +2,8 @@ import { createDurableResourceEnvelope, createScreenRecordingLiveHandle, } from '@agent-device/capture-kit'; -import { - localRuntimeOwner, - type ScreenRecordingLiveSnapshot, -} from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; +import type { ScreenRecordingLiveSnapshot } from '@agent-device/contracts/screen-recording-runtime'; import { deviceIdentity } from '@agent-device/kernel/device'; import type { SessionState } from '../../daemon/types.ts'; diff --git a/src/commands/capture/alert.ts b/src/commands/capture/alert.ts index 679ee7794f..0c229afe84 100644 --- a/src/commands/capture/alert.ts +++ b/src/commands/capture/alert.ts @@ -1,4 +1,4 @@ -import { ALERT_ACTIONS, type AlertAction } from '@agent-device/contracts/interaction'; +import { ALERT_ACTIONS, type AlertAction } from '@agent-device/contracts/alert-contract'; import { PUBLIC_COMMANDS } from '../../command-catalog.ts'; import type { AlertCommandOptions } from '@agent-device/contracts/client'; import { compactRecord, enumField, integerField } from '../command-input.ts'; diff --git a/src/commands/interaction/gesture.ts b/src/commands/interaction/gesture.ts index 9bdf7d4fe1..e515c25998 100644 --- a/src/commands/interaction/gesture.ts +++ b/src/commands/interaction/gesture.ts @@ -4,7 +4,7 @@ import type { CliFlags } from '@agent-device/contracts/command'; import { commonInputFromFlags, request } from '../cli-grammar/common.ts'; import type { CliReader, DaemonWriter } from '../cli-grammar/types.ts'; import { readGestureInput } from './metadata.ts'; -import { gesturePayloadFromPositionals } from '@agent-device/contracts/interaction'; +import { gesturePayloadFromPositionals } from '@agent-device/contracts/gesture-normalization'; export const gestureCliReaders = { gesture: gestureInputFromCli, diff --git a/src/commands/interaction/interactions.ts b/src/commands/interaction/interactions.ts index 1750d32c97..1543f6e4e7 100644 --- a/src/commands/interaction/interactions.ts +++ b/src/commands/interaction/interactions.ts @@ -8,7 +8,7 @@ import type { import { assertNoRemovedSwipeInput, swipePayloadFromPositionals, -} from '@agent-device/contracts/interaction'; +} from '@agent-device/contracts/gesture-normalization'; import { AppError } from '@agent-device/kernel/errors'; import { PUBLIC_COMMANDS } from '../../command-catalog.ts'; import { diff --git a/src/commands/interaction/metadata.ts b/src/commands/interaction/metadata.ts index 2625240799..c8c4537a87 100644 --- a/src/commands/interaction/metadata.ts +++ b/src/commands/interaction/metadata.ts @@ -1,21 +1,23 @@ +import { CLICK_BUTTONS } from '@agent-device/contracts/click-button'; import { - CLICK_BUTTONS, + type DragGesturePayload, + type FlingGesturePayload, GESTURE_KINDS, + type PanGesturePayload, + type PinchGesturePayload, + type RotateGesturePayload, + type SwipeGesturePayload, + type TransformGesturePayload, readGesturePayload, +} from '@agent-device/contracts/gesture-input'; +import { SCROLL_DURATION_MAX_MS } from '@agent-device/contracts/scroll-command'; +import { SCROLL_DIRECTIONS, - SCROLL_DURATION_MAX_MS, SWIPE_PATTERNS, SWIPE_PAUSE_MAX_MS, SWIPE_PRESETS, SWIPE_REPETITION_MAX, - type FlingGesturePayload, - type DragGesturePayload, - type PanGesturePayload, - type PinchGesturePayload, - type RotateGesturePayload, - type SwipeGesturePayload, - type TransformGesturePayload, -} from '@agent-device/contracts/interaction'; +} from '@agent-device/contracts/scroll-gesture'; import { FIND_LOCATORS } from '@agent-device/selectors'; import { defineCommandMetadata } from '../command-contract.ts'; import { diff --git a/src/commands/interaction/runtime/gesture-command.ts b/src/commands/interaction/runtime/gesture-command.ts index 4a542b92a8..12cbe52335 100644 --- a/src/commands/interaction/runtime/gesture-command.ts +++ b/src/commands/interaction/runtime/gesture-command.ts @@ -4,7 +4,7 @@ import type { GestureIntent, GestureSemanticInput, } from '@agent-device/contracts/interaction'; -import { buildGesturePlan } from '@agent-device/contracts/interaction'; +import { buildGesturePlan } from '@agent-device/contracts/gesture-plan'; import type { Point } from '@agent-device/kernel/snapshot'; import { AppError } from '@agent-device/kernel/errors'; import { successText } from '../../../utils/success-text.ts'; diff --git a/src/commands/interaction/runtime/gestures.ts b/src/commands/interaction/runtime/gestures.ts index 30d68c778f..bc57edc63c 100644 --- a/src/commands/interaction/runtime/gestures.ts +++ b/src/commands/interaction/runtime/gestures.ts @@ -7,13 +7,15 @@ import type { ScrollInputDirection, } from '@agent-device/contracts/interaction'; import { - assertExclusiveScrollDistanceInputs, buildDragGesturePlan, + singlePointerPlanEndpoints, +} from '@agent-device/contracts/gesture-plan'; +import { + assertExclusiveScrollDistanceInputs, honoredScrollDurationMs, normalizeScrollDurationMs, resolveScrollExecutionOptions, - singlePointerPlanEndpoints, -} from '@agent-device/contracts/interaction'; +} from '@agent-device/contracts/scroll-command'; import { AppError } from '@agent-device/kernel/errors'; import { SELECTOR_PIPELINE_POLICIES } from '../../../core/selector-pipeline-policy.ts'; import type { Point, Rect, SnapshotNode } from '@agent-device/kernel/snapshot'; @@ -130,7 +132,7 @@ export type GestureDirection = ScrollDirection; export { SCROLL_INPUT_DIRECTIONS, type ScrollInputDirection, -} from '@agent-device/contracts/interaction'; +} from '@agent-device/contracts/scroll-gesture'; export type ScrollTarget = | InteractionTarget diff --git a/src/commands/interaction/runtime/resolution.test.ts b/src/commands/interaction/runtime/resolution.test.ts index aa744b95c1..74956e7ae4 100644 --- a/src/commands/interaction/runtime/resolution.test.ts +++ b/src/commands/interaction/runtime/resolution.test.ts @@ -10,7 +10,7 @@ import { import { resolveRecordedTarget } from '@agent-device/selectors'; import { makeSnapshotState } from '../../../__tests__/test-utils/snapshot-builders.ts'; import type { Point } from '@agent-device/kernel/snapshot'; -import { INTERACTION_ERROR_REASONS } from '@agent-device/contracts/interaction'; +import { INTERACTION_ERROR_REASONS } from '@agent-device/contracts/interaction-error'; import { clickRefE2, coveredByTabBarSnapshot, diff --git a/src/commands/interaction/runtime/resolution.ts b/src/commands/interaction/runtime/resolution.ts index 0ad6524152..741a7d145c 100644 --- a/src/commands/interaction/runtime/resolution.ts +++ b/src/commands/interaction/runtime/resolution.ts @@ -48,7 +48,7 @@ import type { ResolutionDisclosure, ResolvedInteractionTarget, } from '@agent-device/contracts/interaction'; -import { INTERACTION_ERROR_REASONS } from '@agent-device/contracts/interaction'; +import { INTERACTION_ERROR_REASONS } from '@agent-device/contracts/interaction-error'; import type { BackendActionResult, BackendCommandContext, diff --git a/src/commands/interaction/runtime/selector-read.ts b/src/commands/interaction/runtime/selector-read.ts index 2990e51a42..a074724c6b 100644 --- a/src/commands/interaction/runtime/selector-read.ts +++ b/src/commands/interaction/runtime/selector-read.ts @@ -28,7 +28,7 @@ import type { ResolvedTarget, SelectorTarget, } from '@agent-device/contracts/interaction'; -import { INTERACTION_ERROR_REASONS } from '@agent-device/contracts/interaction'; +import { INTERACTION_ERROR_REASONS } from '@agent-device/contracts/interaction-error'; import type { RuntimeCommand } from '../../runtime-types.ts'; import { assertExpectedResolvedTarget, type ExpectedResolvedTarget } from './resolution.ts'; import { diff --git a/src/commands/interaction/runtime/selector-wait.ts b/src/commands/interaction/runtime/selector-wait.ts index 2b72e560e0..38ef28f0bf 100644 --- a/src/commands/interaction/runtime/selector-wait.ts +++ b/src/commands/interaction/runtime/selector-wait.ts @@ -1,5 +1,5 @@ import { AppError } from '@agent-device/kernel/errors'; -import { WAIT_REASONS } from '@agent-device/contracts/interaction'; +import { WAIT_REASONS } from '@agent-device/contracts/wait'; import { findNodeByRef, normalizeRef, type SnapshotNode } from '@agent-device/kernel/snapshot'; import { annotationLocalIdentity, readNodeLocalIdentity } from '@agent-device/ad-script'; import { diff --git a/src/commands/interaction/runtime/wait-polling.ts b/src/commands/interaction/runtime/wait-polling.ts index be817b8a8a..bdc1f04c8e 100644 --- a/src/commands/interaction/runtime/wait-polling.ts +++ b/src/commands/interaction/runtime/wait-polling.ts @@ -1,6 +1,6 @@ import { AppError } from '@agent-device/kernel/errors'; -import { WAIT_REASONS } from '@agent-device/contracts/interaction'; -import { isUnreadableCaptureContentError } from '@agent-device/contracts/platform'; +import { WAIT_REASONS } from '@agent-device/contracts/wait'; +import { isUnreadableCaptureContentError } from '@agent-device/contracts/android-snapshot-quality'; import { selectorPollBudget } from '../../../core/selector-pipeline.ts'; import { SELECTOR_PIPELINE_POLICIES, diff --git a/src/commands/system/index.ts b/src/commands/system/index.ts index 054a073052..0dfebf0169 100644 --- a/src/commands/system/index.ts +++ b/src/commands/system/index.ts @@ -1,13 +1,13 @@ import type { ClipboardCommandOptions } from '@agent-device/contracts/client'; import { DEVICE_ROTATIONS, parseDeviceRotation } from '@agent-device/contracts/device'; import type { BackMode } from '@agent-device/contracts/interaction'; +import { BACK_MODES } from '@agent-device/contracts/back-mode'; import { - BACK_MODES, - parseTvRemoteButton, - TV_REMOTE_BUTTON_USAGE, TV_REMOTE_BUTTONS, + TV_REMOTE_BUTTON_USAGE, + parseTvRemoteButton, tvRemoteDurationMode, -} from '@agent-device/contracts/interaction'; +} from '@agent-device/contracts/tv-remote'; import { AppError } from '@agent-device/kernel/errors'; import type { CommandSchemaOverride } from '../../cli-schema/types.ts'; import { diff --git a/src/commands/system/navigation-projection.ts b/src/commands/system/navigation-projection.ts index 56ab54b854..61a0e9669e 100644 --- a/src/commands/system/navigation-projection.ts +++ b/src/commands/system/navigation-projection.ts @@ -1,15 +1,13 @@ import { DEVICE_ROTATIONS, type DeviceRotation } from '@agent-device/contracts/device'; -import { - BACK_MODES, - TV_REMOTE_BUTTONS, - type AppSwitcherCommandResult, - type BackCommandResult, - type HomeCommandResult, - type OrientationCommandResult, - type TvRemoteCommandResult, - type BackMode, - type TvRemoteButton, -} from '@agent-device/contracts/interaction'; +import { BACK_MODES, type BackMode } from '@agent-device/contracts/back-mode'; +import type { + AppSwitcherCommandResult, + BackCommandResult, + HomeCommandResult, + OrientationCommandResult, + TvRemoteCommandResult, +} from '@agent-device/contracts/navigation'; +import { TV_REMOTE_BUTTONS, type TvRemoteButton } from '@agent-device/contracts/tv-remote'; import type { SettleCommandOptions } from '@agent-device/contracts/client'; import type { ExecutableCommandProjection } from '../command-contract.ts'; diff --git a/src/commands/system/runtime/system.ts b/src/commands/system/runtime/system.ts index 1473a3fef7..c3f8f8fed0 100644 --- a/src/commands/system/runtime/system.ts +++ b/src/commands/system/runtime/system.ts @@ -8,7 +8,7 @@ import type { } from '../../../backend.ts'; import type { CommandContext } from '../../../runtime-contract.ts'; import type { BackMode } from '@agent-device/contracts/interaction'; -import { parseTvRemoteButton } from '@agent-device/contracts/interaction'; +import { parseTvRemoteButton } from '@agent-device/contracts/tv-remote'; import { AppError } from '@agent-device/kernel/errors'; import { successText } from '../../../utils/success-text.ts'; import { requireIntInRange } from '../../../utils/validation.ts'; diff --git a/src/core/__tests__/gesture-capabilities.test.ts b/src/core/__tests__/gesture-capabilities.test.ts index 28e37b767e..ab9962c883 100644 --- a/src/core/__tests__/gesture-capabilities.test.ts +++ b/src/core/__tests__/gesture-capabilities.test.ts @@ -7,7 +7,7 @@ import type { import { normalizePublicGesture, normalizePublicSwipeMotion, -} from '@agent-device/contracts/interaction'; +} from '@agent-device/contracts/gesture-normalization'; import { requireGestureSupported } from '../capabilities.ts'; import { AppError } from '@agent-device/kernel/errors'; import type { DeviceInfo } from '@agent-device/kernel/device'; diff --git a/src/core/__tests__/gesture-plan-test-utils.ts b/src/core/__tests__/gesture-plan-test-utils.ts index bd4df18c52..fca81fc7a9 100644 --- a/src/core/__tests__/gesture-plan-test-utils.ts +++ b/src/core/__tests__/gesture-plan-test-utils.ts @@ -1,10 +1,10 @@ import assert from 'node:assert/strict'; import type { Point, Rect } from '@agent-device/kernel/snapshot'; -import { - buildGesturePlan, - type GesturePlan, - type MultiTouchGesturePlan, -} from '@agent-device/contracts/interaction'; +import { buildGesturePlan } from '@agent-device/contracts/gesture-plan'; +import type { + GesturePlan, + MultiTouchGesturePlan, +} from '@agent-device/contracts/gesture-plan-types'; export const PORTRAIT: Rect = { x: 0, y: 0, width: 390, height: 844 }; export const LANDSCAPE: Rect = { x: 0, y: 0, width: 844, height: 390 }; diff --git a/src/core/__tests__/gesture-plan-viewport.test.ts b/src/core/__tests__/gesture-plan-viewport.test.ts index 79151d98d7..4394c21910 100644 --- a/src/core/__tests__/gesture-plan-viewport.test.ts +++ b/src/core/__tests__/gesture-plan-viewport.test.ts @@ -1,9 +1,8 @@ import { - buildGesturePlan, - GESTURE_SAMPLE_INTERVAL_MS, gesturePayloadFromPositionals, normalizePublicGesture, -} from '@agent-device/contracts/interaction'; +} from '@agent-device/contracts/gesture-normalization'; +import { GESTURE_SAMPLE_INTERVAL_MS, buildGesturePlan } from '@agent-device/contracts/gesture-plan'; import { PUBLIC_PLATFORMS } from '@agent-device/kernel/device'; import { AppError } from '@agent-device/kernel/errors'; import fc from 'fast-check'; diff --git a/src/core/__tests__/gesture-plan.test.ts b/src/core/__tests__/gesture-plan.test.ts index 5fc71465a7..2c9ab66437 100644 --- a/src/core/__tests__/gesture-plan.test.ts +++ b/src/core/__tests__/gesture-plan.test.ts @@ -1,9 +1,9 @@ import assert from 'node:assert/strict'; import { describe, test } from 'vitest'; import { - buildGesturePlan, GESTURE_INITIAL_ANGLE_DEGREES, -} from '@agent-device/contracts/interaction'; + buildGesturePlan, +} from '@agent-device/contracts/gesture-plan'; import { centroid, distance, diff --git a/src/core/__tests__/snapshot-chrome-android-statusbar.test.ts b/src/core/__tests__/snapshot-chrome-android-statusbar.test.ts index 13d3df2f55..84e56e6800 100644 --- a/src/core/__tests__/snapshot-chrome-android-statusbar.test.ts +++ b/src/core/__tests__/snapshot-chrome-android-statusbar.test.ts @@ -8,7 +8,7 @@ import { walkInteractiveOnlyAndroidFixture, walkNonRawAndroidFixture, } from '../../__tests__/test-utils/android-ui-hierarchy-fixtures.ts'; -import { isAndroidSystemChromeWindowResourceId } from '@agent-device/contracts/platform'; +import { isAndroidSystemChromeWindowResourceId } from '@agent-device/contracts/android-system-chrome'; /** * The `walk*AndroidFixture` helpers run a real `--raw` device capture through diff --git a/src/core/capabilities.ts b/src/core/capabilities.ts index 9b801bd0c1..256f2a9fed 100644 --- a/src/core/capabilities.ts +++ b/src/core/capabilities.ts @@ -8,7 +8,7 @@ import type { GestureCommandInput, GestureSemanticInput, } from '@agent-device/contracts/interaction'; -import { assertAppleMultiTouchSupported } from '@agent-device/contracts/platform'; +import { assertAppleMultiTouchSupported } from '@agent-device/contracts/apple-multitouch-support'; // Populate the PlatformPlugin registry once at module load (idempotent; registers // only lazy closures, so no leaf code is imported and CLI cold-start is unaffected diff --git a/src/core/command-descriptor/__tests__/application-lifecycle-runtime-execution.test.ts b/src/core/command-descriptor/__tests__/application-lifecycle-runtime-execution.test.ts index 209ec3d6f1..7e728a9a89 100644 --- a/src/core/command-descriptor/__tests__/application-lifecycle-runtime-execution.test.ts +++ b/src/core/command-descriptor/__tests__/application-lifecycle-runtime-execution.test.ts @@ -2,7 +2,7 @@ import { closeApplicationRuntimePlanUses, closeApplicationRuntimeUse, closeApplicationWithRuntimeHintClearUse, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/application-lifecycle-runtime-plan'; import { expect, test } from 'vitest'; import { commandDescriptors } from '../registry.ts'; diff --git a/src/core/command-descriptor/__tests__/apps-runtime-execution.test.ts b/src/core/command-descriptor/__tests__/apps-runtime-execution.test.ts index 27e11a8fdd..eccd932b25 100644 --- a/src/core/command-descriptor/__tests__/apps-runtime-execution.test.ts +++ b/src/core/command-descriptor/__tests__/apps-runtime-execution.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import { appsRuntimeUse } from '@agent-device/contracts/platform'; +import { appsRuntimeUse } from '@agent-device/contracts/platform-runtime-operations'; import { commandDescriptors } from '../registry.ts'; test('apps declares the complete request-scoped runtime use', () => { diff --git a/src/core/command-descriptor/__tests__/appstate-runtime-execution.test.ts b/src/core/command-descriptor/__tests__/appstate-runtime-execution.test.ts index 780e4d0ff5..18933aafc3 100644 --- a/src/core/command-descriptor/__tests__/appstate-runtime-execution.test.ts +++ b/src/core/command-descriptor/__tests__/appstate-runtime-execution.test.ts @@ -1,4 +1,7 @@ -import { appStateRuntimeUses, appStateUse } from '@agent-device/contracts/platform'; +import { + appStateRuntimeUses, + appStateUse, +} from '@agent-device/contracts/platform-runtime-operations'; import { expect, test } from 'vitest'; import { commandDescriptors } from '../registry.ts'; diff --git a/src/core/command-descriptor/__tests__/boot-runtime-execution.test.ts b/src/core/command-descriptor/__tests__/boot-runtime-execution.test.ts index 95714954dd..04391b610d 100644 --- a/src/core/command-descriptor/__tests__/boot-runtime-execution.test.ts +++ b/src/core/command-descriptor/__tests__/boot-runtime-execution.test.ts @@ -2,7 +2,7 @@ import { bootTargetHeadlessUse, bootTargetUse, deviceBootRuntimeUses, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/platform-runtime-operations'; import { expect, test } from 'vitest'; import { commandDescriptors } from '../registry.ts'; diff --git a/src/core/command-descriptor/__tests__/find-runtime-execution.test.ts b/src/core/command-descriptor/__tests__/find-runtime-execution.test.ts index cfba8a76d7..acbeee88a5 100644 --- a/src/core/command-descriptor/__tests__/find-runtime-execution.test.ts +++ b/src/core/command-descriptor/__tests__/find-runtime-execution.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import { findRuntimePlanUses } from '@agent-device/contracts/platform'; +import { findRuntimePlanUses } from '@agent-device/contracts/platform-runtime-operations'; import { commandDescriptors } from '../registry.ts'; import { BASE_COMMAND_CAPABILITY_MATRIX } from '../../capabilities.ts'; diff --git a/src/core/command-descriptor/__tests__/focus-runtime-execution.test.ts b/src/core/command-descriptor/__tests__/focus-runtime-execution.test.ts index bb2332adbe..0c93bb596d 100644 --- a/src/core/command-descriptor/__tests__/focus-runtime-execution.test.ts +++ b/src/core/command-descriptor/__tests__/focus-runtime-execution.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import { focusRuntimeUse } from '@agent-device/contracts/platform'; +import { focusRuntimeUse } from '@agent-device/contracts/platform-runtime-operations'; import { commandDescriptors } from '../registry.ts'; import { BASE_COMMAND_CAPABILITY_MATRIX, diff --git a/src/core/command-descriptor/__tests__/logs-runtime-execution.test.ts b/src/core/command-descriptor/__tests__/logs-runtime-execution.test.ts index 3f8736d352..bfccc60a99 100644 --- a/src/core/command-descriptor/__tests__/logs-runtime-execution.test.ts +++ b/src/core/command-descriptor/__tests__/logs-runtime-execution.test.ts @@ -1,4 +1,4 @@ -import { appLogRuntimePlanUses } from '@agent-device/contracts/platform'; +import { appLogRuntimePlanUses } from '@agent-device/contracts/logs-runtime-plan'; import { expect, test } from 'vitest'; import { commandDescriptors } from '../registry.ts'; diff --git a/src/core/command-descriptor/__tests__/network-runtime-execution.test.ts b/src/core/command-descriptor/__tests__/network-runtime-execution.test.ts index 41133f58da..3139d8783a 100644 --- a/src/core/command-descriptor/__tests__/network-runtime-execution.test.ts +++ b/src/core/command-descriptor/__tests__/network-runtime-execution.test.ts @@ -1,4 +1,7 @@ -import { networkDumpUse, resolveNetworkRuntimePlan } from '@agent-device/contracts/platform'; +import { + networkDumpUse, + resolveNetworkRuntimePlan, +} from '@agent-device/contracts/network-runtime-plan'; import { expect, test } from 'vitest'; import { commandDescriptors } from '../registry.ts'; diff --git a/src/core/command-descriptor/__tests__/platform-execution.test.ts b/src/core/command-descriptor/__tests__/platform-execution.test.ts index 2bd4e8e1e7..9dcd4b9715 100644 --- a/src/core/command-descriptor/__tests__/platform-execution.test.ts +++ b/src/core/command-descriptor/__tests__/platform-execution.test.ts @@ -1,4 +1,4 @@ -import { inventoryUse } from '@agent-device/contracts/platform'; +import { inventoryUse } from '@agent-device/contracts/platform-module'; import { describe, expect, test } from 'vitest'; import { commandDescriptors } from '../registry.ts'; import { deriveDaemonCommandDescriptors } from '../derive.ts'; diff --git a/src/core/command-descriptor/__tests__/record-runtime-execution.test.ts b/src/core/command-descriptor/__tests__/record-runtime-execution.test.ts index 060e20a7ca..53e784ffae 100644 --- a/src/core/command-descriptor/__tests__/record-runtime-execution.test.ts +++ b/src/core/command-descriptor/__tests__/record-runtime-execution.test.ts @@ -1,8 +1,6 @@ import { expect, test } from 'vitest'; -import { - assertRecordRuntimeExecution, - screenRecordingRuntimePlanUses, -} from '@agent-device/contracts/platform'; +import { assertRecordRuntimeExecution } from '@agent-device/contracts/record-runtime-cutover'; +import { screenRecordingRuntimePlanUses } from '@agent-device/contracts/screen-recording-runtime-plan'; import { commandDescriptors } from '../registry.ts'; test('record descriptor declares exactly the distinct uses selected by all three plans', () => { diff --git a/src/core/command-descriptor/__tests__/screenshot-runtime-execution.test.ts b/src/core/command-descriptor/__tests__/screenshot-runtime-execution.test.ts index 98d5b9f2fa..504609015b 100644 --- a/src/core/command-descriptor/__tests__/screenshot-runtime-execution.test.ts +++ b/src/core/command-descriptor/__tests__/screenshot-runtime-execution.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import { screenshotRuntimePlanUses } from '@agent-device/contracts/platform'; +import { screenshotRuntimePlanUses } from '@agent-device/contracts/platform-runtime-operations'; import { commandDescriptors } from '../registry.ts'; test('screenshot descriptor declares its complete runtime uses with no legacy projection', () => { diff --git a/src/core/command-descriptor/__tests__/shutdown-runtime-execution.test.ts b/src/core/command-descriptor/__tests__/shutdown-runtime-execution.test.ts index e6603e7e4c..5f7f1360a0 100644 --- a/src/core/command-descriptor/__tests__/shutdown-runtime-execution.test.ts +++ b/src/core/command-descriptor/__tests__/shutdown-runtime-execution.test.ts @@ -1,6 +1,6 @@ import { readFileSync } from 'node:fs'; import { expect, test } from 'vitest'; -import { shutdownTargetUse } from '@agent-device/contracts/platform'; +import { shutdownTargetUse } from '@agent-device/contracts/platform-runtime-operations'; import { commandDescriptors } from '../registry.ts'; const sessionStateSource = readFileSync( diff --git a/src/core/command-descriptor/__tests__/snapshot-runtime-execution.test.ts b/src/core/command-descriptor/__tests__/snapshot-runtime-execution.test.ts index 92d26488eb..6461897923 100644 --- a/src/core/command-descriptor/__tests__/snapshot-runtime-execution.test.ts +++ b/src/core/command-descriptor/__tests__/snapshot-runtime-execution.test.ts @@ -1,4 +1,4 @@ -import { snapshotRuntimePlanUses } from '@agent-device/contracts/platform'; +import { snapshotRuntimePlanUses } from '@agent-device/contracts/platform-runtime-operations'; import { expect, test } from 'vitest'; import { commandDescriptors } from '../registry.ts'; diff --git a/src/core/command-descriptor/__tests__/type-runtime-execution.test.ts b/src/core/command-descriptor/__tests__/type-runtime-execution.test.ts index edf54dd5cc..ca84d4458c 100644 --- a/src/core/command-descriptor/__tests__/type-runtime-execution.test.ts +++ b/src/core/command-descriptor/__tests__/type-runtime-execution.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import { typeTextRuntimeUse } from '@agent-device/contracts/platform'; +import { typeTextRuntimeUse } from '@agent-device/contracts/platform-runtime-operations'; import { commandDescriptors } from '../registry.ts'; import { BASE_COMMAND_CAPABILITY_MATRIX, isCommandSupportedOnDevice } from '../../capabilities.ts'; diff --git a/src/core/command-descriptor/__tests__/viewport-runtime-execution.test.ts b/src/core/command-descriptor/__tests__/viewport-runtime-execution.test.ts index f70e0eeb90..c7ad6e47f6 100644 --- a/src/core/command-descriptor/__tests__/viewport-runtime-execution.test.ts +++ b/src/core/command-descriptor/__tests__/viewport-runtime-execution.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import { viewportRuntimeUse } from '@agent-device/contracts/platform'; +import { viewportRuntimeUse } from '@agent-device/contracts/platform-runtime-operations'; import { commandDescriptors } from '../registry.ts'; test('viewport descriptor declares its complete runtime use with no legacy projection', () => { diff --git a/src/core/command-descriptor/__tests__/wait-runtime-execution.test.ts b/src/core/command-descriptor/__tests__/wait-runtime-execution.test.ts index 8dadc591c0..ed14cf6fb6 100644 --- a/src/core/command-descriptor/__tests__/wait-runtime-execution.test.ts +++ b/src/core/command-descriptor/__tests__/wait-runtime-execution.test.ts @@ -1,8 +1,6 @@ import { expect, test } from 'vitest'; -import { - waitSelectorCaptureRuntimePlanUses, - waitObservesDevice, -} from '@agent-device/contracts/platform'; +import { waitSelectorCaptureRuntimePlanUses } from '@agent-device/contracts/platform-runtime-operations'; +import { waitObservesDevice } from '@agent-device/contracts/wait-runtime-plan'; import { commandDescriptors } from '../registry.ts'; test('wait descriptor declares its complete runtime use with no capability bucket', () => { diff --git a/src/core/command-descriptor/platform-execution-entry.ts b/src/core/command-descriptor/platform-execution-entry.ts index 46b5c30663..ffa8f33829 100644 --- a/src/core/command-descriptor/platform-execution-entry.ts +++ b/src/core/command-descriptor/platform-execution-entry.ts @@ -1,7 +1,7 @@ import { assertCommandPlatformExecution, type CommandPlatformExecution, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/command-platform-execution'; /** * Structural on purpose: the gate must see an *absent* discriminator, and the diff --git a/src/core/command-descriptor/registry.ts b/src/core/command-descriptor/registry.ts index 091a4183ec..fe85766a89 100644 --- a/src/core/command-descriptor/registry.ts +++ b/src/core/command-descriptor/registry.ts @@ -15,31 +15,35 @@ import { resolvePostActionObservationSupport } from './post-action-observation.t import type { PostActionObservationSupport } from './post-action-observation.ts'; import { deployAppUse, - appLogRuntimePlanUses, - appsRuntimeUse, - appStateRuntimeUses, - assertRecordRuntimeExecution, - deviceBootRuntimeUses, - inventoryUse, - networkDumpUse, readyMaterializeAndDeployAppUse, readySendPushNotificationUse, - openApplicationRuntimePlanUses, +} from '@agent-device/contracts/app-deployment-runtime-plan'; +import { closeApplicationRuntimePlanUses, - selectorCaptureRuntimePlanUses, - selectorTextCaptureRuntimePlanUses, - waitSelectorCaptureRuntimePlanUses, - snapshotRuntimePlanUses, + openApplicationRuntimePlanUses, prepareAppleRunnerRuntimeUse, runtimeCommandRuntimePlanUses, - screenRecordingRuntimePlanUses, - screenshotRuntimePlanUses, - shutdownTargetUse, +} from '@agent-device/contracts/application-lifecycle-runtime-plan'; +import { appLogRuntimePlanUses } from '@agent-device/contracts/logs-runtime-plan'; +import { networkDumpUse } from '@agent-device/contracts/network-runtime-plan'; +import { inventoryUse } from '@agent-device/contracts/platform-module'; +import { + appsRuntimeUse, + appStateRuntimeUses, + deviceBootRuntimeUses, findRuntimePlanUses, focusRuntimeUse, + screenshotRuntimePlanUses, + selectorCaptureRuntimePlanUses, + selectorTextCaptureRuntimePlanUses, + shutdownTargetUse, + snapshotRuntimePlanUses, typeTextRuntimeUse, viewportRuntimeUse, -} from '@agent-device/contracts/platform'; + waitSelectorCaptureRuntimePlanUses, +} from '@agent-device/contracts/platform-runtime-operations'; +import { assertRecordRuntimeExecution } from '@agent-device/contracts/record-runtime-cutover'; +import { screenRecordingRuntimePlanUses } from '@agent-device/contracts/screen-recording-runtime-plan'; import { readDeclaredPlatformExecution } from './platform-execution-entry.ts'; import type { CommandCatalogGroup, diff --git a/src/core/device-inventory-context.ts b/src/core/device-inventory-context.ts index 41d62115bc..75c0dba19b 100644 --- a/src/core/device-inventory-context.ts +++ b/src/core/device-inventory-context.ts @@ -1,11 +1,11 @@ import { AppError, isRequestCanceledError } from '@agent-device/kernel/errors'; import type { DeviceInventoryRequest } from '@agent-device/contracts/device'; -import { - type DeviceInventoryDiscovery, - type DeviceInventoryGateway, - type PlatformRequestScope, - type ProviderAwareDeviceInventoryGateway, -} from '@agent-device/contracts/platform'; +import type { + DeviceInventoryDiscovery, + DeviceInventoryGateway, + ProviderAwareDeviceInventoryGateway, +} from '@agent-device/contracts/platform-module'; +import type { PlatformRequestScope } from '@agent-device/contracts/platform-runtime-host'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { AsyncLocalStorage } from 'node:async_hooks'; diff --git a/src/core/dispatch-interactions.ts b/src/core/dispatch-interactions.ts index 6d790e87f6..9bfebb4e98 100644 --- a/src/core/dispatch-interactions.ts +++ b/src/core/dispatch-interactions.ts @@ -1,19 +1,22 @@ import { - assertExclusiveScrollDistanceInputs, + type ClickButton, getClickButtonValidationError, - honoredScrollDurationMs, - MAESTRO_NON_HITTABLE_FALLBACK_MESSAGE, - normalizeScrollDurationMs, - parseScrollDirection, - resolveScrollExecutionOptions, resolveClickButton, - type ClickButton, +} from '@agent-device/contracts/click-button'; +import { type Interactor, + MAESTRO_NON_HITTABLE_FALLBACK_MESSAGE, type RunnerCallOptions, - type ScrollCommandOptions, - type ScrollDirection, +} from '@agent-device/contracts/interactor-types'; +import { type ResolvedScrollExecutionOptions, -} from '@agent-device/contracts/interaction'; + type ScrollCommandOptions, + assertExclusiveScrollDistanceInputs, + honoredScrollDurationMs, + normalizeScrollDurationMs, + resolveScrollExecutionOptions, +} from '@agent-device/contracts/scroll-command'; +import { type ScrollDirection, parseScrollDirection } from '@agent-device/contracts/scroll-gesture'; import { readFillBackendResult } from './fill-backend-result.ts'; import { isIosFamily, diff --git a/src/core/dispatch.ts b/src/core/dispatch.ts index b71fbb31a4..19525d7491 100644 --- a/src/core/dispatch.ts +++ b/src/core/dispatch.ts @@ -1,6 +1,6 @@ import { parseDeviceRotation } from '@agent-device/contracts/device'; import type { GesturePlan, Interactor, RunnerContext } from '@agent-device/contracts/interaction'; -import { parseTvRemoteButton } from '@agent-device/contracts/interaction'; +import { parseTvRemoteButton } from '@agent-device/contracts/tv-remote'; import { isIosFamily, type DeviceInfo } from '@agent-device/kernel/device'; import { AppError } from '@agent-device/kernel/errors'; import type { Rect } from '@agent-device/kernel/snapshot'; diff --git a/src/core/fill-backend-result.ts b/src/core/fill-backend-result.ts index fbbce054c7..5182010742 100644 --- a/src/core/fill-backend-result.ts +++ b/src/core/fill-backend-result.ts @@ -3,7 +3,7 @@ import { type CloudTextEntryReadiness, type FillBackendResult, type FillVerificationTarget, -} from '@agent-device/contracts/interaction'; +} from '@agent-device/contracts/interactor-types'; type RawUnconfirmedVerification = Record & { requested: string; diff --git a/src/core/interactors/linux.ts b/src/core/interactors/linux.ts index 5d7f21f167..244ede70ee 100644 --- a/src/core/interactors/linux.ts +++ b/src/core/interactors/linux.ts @@ -17,7 +17,7 @@ import { swipeLinux, typeLinux, } from '../../platforms/linux/input-actions.ts'; -import { singlePointerPlanEndpoints } from '@agent-device/contracts/interaction'; +import { singlePointerPlanEndpoints } from '@agent-device/contracts/gesture-plan'; import { screenshotLinux } from '../../platforms/linux/screenshot.ts'; import { captureLinuxSurfaceSnapshot } from '../../snapshot/snapshot-desktop-surface.ts'; import type { Interactor } from '@agent-device/contracts/interaction'; diff --git a/src/core/interactors/register-builtins.ts b/src/core/interactors/register-builtins.ts index ba5fcfb65b..d8ba145f51 100644 --- a/src/core/interactors/register-builtins.ts +++ b/src/core/interactors/register-builtins.ts @@ -4,7 +4,7 @@ import { registerPlatformPlugin } from '../platform-plugin-registry.ts'; import { applePlugin } from '../../platforms/apple/plugin.ts'; import { vegaPlugin } from '../../platforms/vega/plugin.ts'; import { PUBLIC_COMMANDS } from '../../command-catalog.ts'; -import { isAudioProbeSupportedDevice } from '@agent-device/contracts/platform'; +import { isAudioProbeSupportedDevice } from '@agent-device/contracts/audio-probe-support'; import type { Platform, DeviceInfo } from '@agent-device/kernel/device'; // The builtin-plugin wiring lives at the interactor seam (src/core/interactors/) — diff --git a/src/core/snapshot-chrome.ts b/src/core/snapshot-chrome.ts index b7d8f14e60..0cbf915b62 100644 --- a/src/core/snapshot-chrome.ts +++ b/src/core/snapshot-chrome.ts @@ -1,9 +1,9 @@ +import { isAndroidInputMethodNode } from '@agent-device/contracts/android-input-ownership'; import { ANDROID_SYSTEM_CHROME_PACKAGE, hasAndroidSystemChromeProvenance, - isAndroidInputMethodNode, isAndroidSystemChromeWindowResourceId, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/android-system-chrome'; import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { normalizeType } from '@agent-device/contracts/snapshot'; diff --git a/src/daemon/__tests__/app-log-resource-recovery.test.ts b/src/daemon/__tests__/app-log-resource-recovery.test.ts index 98f0abc649..a86192fdeb 100644 --- a/src/daemon/__tests__/app-log-resource-recovery.test.ts +++ b/src/daemon/__tests__/app-log-resource-recovery.test.ts @@ -1,15 +1,14 @@ import fs from 'node:fs'; import path from 'node:path'; import { expect, test, vi } from 'vitest'; +import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; +import type { CleanupOutcome, ReattachOutcome } from '@agent-device/contracts/durable-resource'; import { - applicationLifecycleOperationFacts, - localRuntimeOwner, - type CleanupOutcome, type DeviceBinding, type DeviceRuntimeGateway, - type PlatformRuntimeOperations, - type ReattachOutcome, -} from '@agent-device/contracts/platform'; + localRuntimeOwner, +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; import { createDurableResourceEnvelope } from '@agent-device/capture-kit'; import { createTestAppLogLiveHandle } from '../../__tests__/test-utils/app-log-live-handle.ts'; import { unavailableDeploymentSnapshotAndShutdownOperationFacts } from '../../__tests__/test-utils/runtime-operation-facts.ts'; diff --git a/src/daemon/__tests__/app-log-resource-store.test.ts b/src/daemon/__tests__/app-log-resource-store.test.ts index 04b66090c0..a305e11050 100644 --- a/src/daemon/__tests__/app-log-resource-store.test.ts +++ b/src/daemon/__tests__/app-log-resource-store.test.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { expect, test } from 'vitest'; -import { localRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { createDurableResourceEnvelope } from '@agent-device/capture-kit'; import { mkdtempForTestSync } from '../../__tests__/test-utils/tmp-dir.ts'; import { appLogResourceStore } from '../app-log-resource-store.ts'; diff --git a/src/daemon/__tests__/app-log-session-resource.test.ts b/src/daemon/__tests__/app-log-session-resource.test.ts index 9a266aae0f..bbc318f17e 100644 --- a/src/daemon/__tests__/app-log-session-resource.test.ts +++ b/src/daemon/__tests__/app-log-session-resource.test.ts @@ -1,7 +1,8 @@ import fs from 'node:fs'; import path from 'node:path'; import { expect, test, vi } from 'vitest'; -import { localRuntimeOwner, type CleanupOutcome } from '@agent-device/contracts/platform'; +import type { CleanupOutcome } from '@agent-device/contracts/durable-resource'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { createAppLogStartResult, createDurableResourceEnvelope } from '@agent-device/capture-kit'; import { createTestAppLogLiveHandle } from '../../__tests__/test-utils/app-log-live-handle.ts'; import { AppError } from '@agent-device/kernel/errors'; diff --git a/src/daemon/__tests__/app-log-start-preflight.test.ts b/src/daemon/__tests__/app-log-start-preflight.test.ts index 0edd2fe1b7..cc29685572 100644 --- a/src/daemon/__tests__/app-log-start-preflight.test.ts +++ b/src/daemon/__tests__/app-log-start-preflight.test.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { expect, test } from 'vitest'; -import { localRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { createDurableResourceEnvelope } from '@agent-device/capture-kit'; import { deviceIdentity, type DeviceInfo } from '@agent-device/kernel/device'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; diff --git a/src/daemon/__tests__/application-lifecycle-recovery.test.ts b/src/daemon/__tests__/application-lifecycle-recovery.test.ts index 1d2bbece67..1d4d9e0fb6 100644 --- a/src/daemon/__tests__/application-lifecycle-recovery.test.ts +++ b/src/daemon/__tests__/application-lifecycle-recovery.test.ts @@ -1,15 +1,15 @@ import { expect, test, vi } from 'vitest'; +import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; import { - applicationLifecycleOperationFacts, - localRuntimeOwner, - providerRuntimeOwner, type DeviceBinding, type DeviceRuntimeGateway, - type PlatformRequestScope, - type PlatformRuntimeOperations, - type RuntimeOperationFact, type RuntimeFacts, -} from '@agent-device/contracts/platform'; + type RuntimeOperationFact, + localRuntimeOwner, + providerRuntimeOwner, +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRequestScope } from '@agent-device/contracts/platform-runtime-host'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { unavailableDeploymentSnapshotAndShutdownOperationFacts } from '../../__tests__/test-utils/runtime-operation-facts.ts'; import type { SessionState } from '../types.ts'; diff --git a/src/daemon/__tests__/daemon-runtime-app-log.test.ts b/src/daemon/__tests__/daemon-runtime-app-log.test.ts index e2b92bdee3..91623160bf 100644 --- a/src/daemon/__tests__/daemon-runtime-app-log.test.ts +++ b/src/daemon/__tests__/daemon-runtime-app-log.test.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { expect, test, vi } from 'vitest'; -import { localRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { createDurableResourceEnvelope } from '@agent-device/capture-kit'; import { createTestAppLogLiveHandle } from '../../__tests__/test-utils/app-log-live-handle.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; diff --git a/src/daemon/__tests__/device-claim-admission.test.ts b/src/daemon/__tests__/device-claim-admission.test.ts index 568cb719cf..8540a0740c 100644 --- a/src/daemon/__tests__/device-claim-admission.test.ts +++ b/src/daemon/__tests__/device-claim-admission.test.ts @@ -1,7 +1,7 @@ import { expect, test } from 'vitest'; import fs from 'node:fs'; import path from 'node:path'; -import { localRuntimeOwner, providerRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner, providerRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { asAppError } from '@agent-device/kernel/errors'; import { ANDROID_EMULATOR } from '../../__tests__/test-utils/device-fixtures.ts'; import { diff --git a/src/daemon/__tests__/device-claim-reconciliation.test.ts b/src/daemon/__tests__/device-claim-reconciliation.test.ts index a3da865446..0bf97edd0b 100644 --- a/src/daemon/__tests__/device-claim-reconciliation.test.ts +++ b/src/daemon/__tests__/device-claim-reconciliation.test.ts @@ -2,12 +2,12 @@ import fs from 'node:fs'; import path from 'node:path'; import { expect, test, vi } from 'vitest'; import { createDurableResourceEnvelope } from '@agent-device/capture-kit'; +import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; import { - applicationLifecycleOperationFacts, - localRuntimeOwner, type DeviceRuntimeGateway, - type PlatformRuntimeOperations, -} from '@agent-device/contracts/platform'; + localRuntimeOwner, +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; import { createTestAppLogLiveHandle } from '../../__tests__/test-utils/app-log-live-handle.ts'; import { unavailableDeploymentSnapshotAndShutdownOperationFacts } from '../../__tests__/test-utils/runtime-operation-facts.ts'; import { mkdtempForTestSync } from '../../__tests__/test-utils/tmp-dir.ts'; diff --git a/src/daemon/__tests__/durable-capture-recovery-authority.test.ts b/src/daemon/__tests__/durable-capture-recovery-authority.test.ts index fc96ba023f..8e6b017e40 100644 --- a/src/daemon/__tests__/durable-capture-recovery-authority.test.ts +++ b/src/daemon/__tests__/durable-capture-recovery-authority.test.ts @@ -1,6 +1,7 @@ import { expect, test, vi } from 'vitest'; import { createDurableResourceEnvelope } from '@agent-device/capture-kit'; -import { localRuntimeOwner, type AppLogLiveHandle } from '@agent-device/contracts/platform'; +import type { AppLogLiveHandle } from '@agent-device/contracts/app-log-runtime'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { createTestAppLogLiveHandle } from '../../__tests__/test-utils/app-log-live-handle.ts'; import { acquireDurableCaptureRecoveryAuthorityBeforeDeadline, diff --git a/src/daemon/__tests__/durable-capture-resource-fence.test.ts b/src/daemon/__tests__/durable-capture-resource-fence.test.ts index edba2e5253..63b20b0b46 100644 --- a/src/daemon/__tests__/durable-capture-resource-fence.test.ts +++ b/src/daemon/__tests__/durable-capture-resource-fence.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; import { expect, test, vi } from 'vitest'; -import { localRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { createDurableResourceEnvelope } from '@agent-device/capture-kit'; import { mkdtempForTestSync } from '../../__tests__/test-utils/tmp-dir.ts'; import { withDurableCaptureResourceFence } from '../durable-capture-resource-fence.ts'; diff --git a/src/daemon/__tests__/durable-capture-resource-recovery.test.ts b/src/daemon/__tests__/durable-capture-resource-recovery.test.ts index 8d6d5d530f..20085195de 100644 --- a/src/daemon/__tests__/durable-capture-resource-recovery.test.ts +++ b/src/daemon/__tests__/durable-capture-resource-recovery.test.ts @@ -1,7 +1,7 @@ import path from 'node:path'; import { expect, test, vi } from 'vitest'; import { createDurableResourceEnvelope } from '@agent-device/capture-kit'; -import { localRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; import { appLogDurableResource } from '../app-log-session-resource.ts'; diff --git a/src/daemon/__tests__/durable-capture-resource-store.test.ts b/src/daemon/__tests__/durable-capture-resource-store.test.ts index bd17dc714a..2563e7680c 100644 --- a/src/daemon/__tests__/durable-capture-resource-store.test.ts +++ b/src/daemon/__tests__/durable-capture-resource-store.test.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { expect, test } from 'vitest'; -import { localRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { createDurableResourceEnvelope } from '@agent-device/capture-kit'; import { mkdtempForTestSync } from '../../__tests__/test-utils/tmp-dir.ts'; import { createDurableCaptureResourceStore } from '../durable-capture-resource-store.ts'; diff --git a/src/daemon/__tests__/durable-capture-resource.fixtures.ts b/src/daemon/__tests__/durable-capture-resource.fixtures.ts index bef36fdd50..946b23a3de 100644 --- a/src/daemon/__tests__/durable-capture-resource.fixtures.ts +++ b/src/daemon/__tests__/durable-capture-resource.fixtures.ts @@ -1,11 +1,7 @@ import { vi } from 'vitest'; -import { - localRuntimeOwner, - type AppLogCompletion, - type AppLogLiveHandle, - type CleanupOutcome, - type FinishOutcome, -} from '@agent-device/contracts/platform'; +import type { AppLogCompletion, AppLogLiveHandle } from '@agent-device/contracts/app-log-runtime'; +import type { CleanupOutcome, FinishOutcome } from '@agent-device/contracts/durable-resource'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { createAppLogStartResult, createDurableResourceEnvelope } from '@agent-device/capture-kit'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; diff --git a/src/daemon/__tests__/filesystem-boundary-faults.test.ts b/src/daemon/__tests__/filesystem-boundary-faults.test.ts index bb9184f6f2..f8a7a852b4 100644 --- a/src/daemon/__tests__/filesystem-boundary-faults.test.ts +++ b/src/daemon/__tests__/filesystem-boundary-faults.test.ts @@ -2,7 +2,7 @@ import assert from 'node:assert/strict'; import crypto from 'node:crypto'; import path from 'node:path'; import { afterEach, vi } from 'vitest'; -import { localRuntimeOwner } from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { createDurableResourceEnvelope } from '@agent-device/capture-kit'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { acquireDeviceClaim } from '../device-claims.ts'; diff --git a/src/daemon/__tests__/focus-runtime.test.ts b/src/daemon/__tests__/focus-runtime.test.ts index 236f13c53c..f8e86b0f17 100644 --- a/src/daemon/__tests__/focus-runtime.test.ts +++ b/src/daemon/__tests__/focus-runtime.test.ts @@ -1,15 +1,17 @@ import { expect, test, vi } from 'vitest'; +import { focusRuntimeOperationFacts } from '@agent-device/contracts/focus-runtime'; import { - focusRuntimeOperationFacts, - focusRuntimeUse, - localRuntimeOwner, - narrowDeviceBinding, type DeviceBinding, type DeviceRuntimeGateway, - type PlatformRuntimeOperations, type RuntimeFacts, type RuntimeOperationFact, -} from '@agent-device/contracts/platform'; + localRuntimeOwner, + narrowDeviceBinding, +} from '@agent-device/contracts/platform-runtime'; +import { + type PlatformRuntimeOperations, + focusRuntimeUse, +} from '@agent-device/contracts/platform-runtime-operations'; import { deviceShape } from '@agent-device/kernel/device'; import { makeSession } from '../../__tests__/test-utils/session-factories.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; diff --git a/src/daemon/__tests__/request-router-lock-policy.test.ts b/src/daemon/__tests__/request-router-lock-policy.test.ts index f33551ba4c..a78c0750c5 100644 --- a/src/daemon/__tests__/request-router-lock-policy.test.ts +++ b/src/daemon/__tests__/request-router-lock-policy.test.ts @@ -25,11 +25,11 @@ import { snapshotRuntimeFixture } from './snapshot-runtime-fixture.ts'; import type { SessionState } from '../types.ts'; import { LeaseRegistry } from '../lease-registry.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; +import type { DeviceRuntimeGateway } from '@agent-device/contracts/platform-runtime'; import { - snapshotRuntimePlanUses, - type DeviceRuntimeGateway, type PlatformRuntimeOperations, -} from '@agent-device/contracts/platform'; + snapshotRuntimePlanUses, +} from '@agent-device/contracts/platform-runtime-operations'; const mockDispatch = vi.mocked(dispatchCommand); diff --git a/src/daemon/__tests__/request-router-record-runtime-lock.test.ts b/src/daemon/__tests__/request-router-record-runtime-lock.test.ts index dfcd59bfd6..aa523fc980 100644 --- a/src/daemon/__tests__/request-router-record-runtime-lock.test.ts +++ b/src/daemon/__tests__/request-router-record-runtime-lock.test.ts @@ -1,13 +1,13 @@ import { expect, test, vi } from 'vitest'; +import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; +import { PendingTransferGuard } from '@agent-device/contracts/async-lifecycle'; import { - applicationLifecycleOperationFacts, - localRuntimeOwner, - PendingTransferGuard, type DeviceBinding, type DeviceRuntimeGateway, - type PlatformRuntimeOperations, - type ScreenRecordingLiveHandle, -} from '@agent-device/contracts/platform'; + localRuntimeOwner, +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; +import type { ScreenRecordingLiveHandle } from '@agent-device/contracts/screen-recording-runtime'; import { createDurableResourceEnvelope } from '@agent-device/capture-kit'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { createTestDeviceInventoryGateways } from '../../__tests__/test-utils/device-inventory-gateways.ts'; diff --git a/src/daemon/__tests__/request-runtime-binding-router.test.ts b/src/daemon/__tests__/request-runtime-binding-router.test.ts index 27bfd3c554..19253287fa 100644 --- a/src/daemon/__tests__/request-runtime-binding-router.test.ts +++ b/src/daemon/__tests__/request-runtime-binding-router.test.ts @@ -1,12 +1,12 @@ import fs from 'node:fs'; import { expect, test, vi } from 'vitest'; +import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; import { - applicationLifecycleOperationFacts, - localRuntimeOwner, type DeviceBinding, type DeviceRuntimeGateway, - type PlatformRuntimeOperations, -} from '@agent-device/contracts/platform'; + localRuntimeOwner, +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; import { createAppLogStartResult, createDurableResourceEnvelope } from '@agent-device/capture-kit'; import { createTestAppLogLiveHandle } from '../../__tests__/test-utils/app-log-live-handle.ts'; import { createTestDeviceInventoryGateways } from '../../__tests__/test-utils/device-inventory-gateways.ts'; diff --git a/src/daemon/__tests__/request-runtime-binding.test.ts b/src/daemon/__tests__/request-runtime-binding.test.ts index e05d624a6c..f36b545167 100644 --- a/src/daemon/__tests__/request-runtime-binding.test.ts +++ b/src/daemon/__tests__/request-runtime-binding.test.ts @@ -1,15 +1,17 @@ import { expect, test, vi } from 'vitest'; +import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; import { - applicationLifecycleOperationFacts, appLogAdmissionUse, - localRuntimeOwner, - networkDumpUse, resolveLogsRuntimePlan, - screenRecordingRecoveryUse, +} from '@agent-device/contracts/logs-runtime-plan'; +import { networkDumpUse } from '@agent-device/contracts/network-runtime-plan'; +import { type DeviceBinding, type DeviceRuntimeGateway, - type PlatformRuntimeOperations, -} from '@agent-device/contracts/platform'; + localRuntimeOwner, +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; +import { screenRecordingRecoveryUse } from '@agent-device/contracts/screen-recording-runtime-plan'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { unavailableDeploymentSnapshotAndShutdownOperationFacts } from '../../__tests__/test-utils/runtime-operation-facts.ts'; import { createDurableResourceEnvelope } from '@agent-device/capture-kit'; diff --git a/src/daemon/__tests__/screen-recording-boundary-faults.test.ts b/src/daemon/__tests__/screen-recording-boundary-faults.test.ts index c21ab70241..c02f489880 100644 --- a/src/daemon/__tests__/screen-recording-boundary-faults.test.ts +++ b/src/daemon/__tests__/screen-recording-boundary-faults.test.ts @@ -4,14 +4,13 @@ import { createDurableResourceEnvelope, createScreenRecordingLiveHandle, } from '@agent-device/capture-kit'; -import { - localRuntimeOwner, - PendingTransferGuard, - type CleanupOutcome, - type ReattachOutcome, - type ScreenRecordingCompletion, - type ScreenRecordingLiveHandle, -} from '@agent-device/contracts/platform'; +import { PendingTransferGuard } from '@agent-device/contracts/async-lifecycle'; +import type { CleanupOutcome, ReattachOutcome } from '@agent-device/contracts/durable-resource'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; +import type { + ScreenRecordingCompletion, + ScreenRecordingLiveHandle, +} from '@agent-device/contracts/screen-recording-runtime'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { AppError } from '@agent-device/kernel/errors'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; diff --git a/src/daemon/__tests__/screen-recording-resource-recovery.test.ts b/src/daemon/__tests__/screen-recording-resource-recovery.test.ts index 4ac64cf750..7acac80aa0 100644 --- a/src/daemon/__tests__/screen-recording-resource-recovery.test.ts +++ b/src/daemon/__tests__/screen-recording-resource-recovery.test.ts @@ -1,11 +1,11 @@ import path from 'node:path'; import { expect, test, vi } from 'vitest'; +import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; import { - applicationLifecycleOperationFacts, - localRuntimeOwner, type DeviceRuntimeGateway, - type PlatformRuntimeOperations, -} from '@agent-device/contracts/platform'; + localRuntimeOwner, +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; import { makeTestScreenRecordingResource } from '../../__tests__/test-utils/screen-recording-live-handle.ts'; import { unavailableDeploymentSnapshotAndShutdownOperationFacts } from '../../__tests__/test-utils/runtime-operation-facts.ts'; import { mkdtempForTestSync } from '../../__tests__/test-utils/tmp-dir.ts'; diff --git a/src/daemon/__tests__/screen-recording-session-resource.test.ts b/src/daemon/__tests__/screen-recording-session-resource.test.ts index 00acc46bb0..f7152918d3 100644 --- a/src/daemon/__tests__/screen-recording-session-resource.test.ts +++ b/src/daemon/__tests__/screen-recording-session-resource.test.ts @@ -1,9 +1,7 @@ import { expect, test, vi } from 'vitest'; -import { - localRuntimeOwner, - PendingTransferGuard, - type ScreenRecordingLiveHandle, -} from '@agent-device/contracts/platform'; +import { PendingTransferGuard } from '@agent-device/contracts/async-lifecycle'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; +import type { ScreenRecordingLiveHandle } from '@agent-device/contracts/screen-recording-runtime'; import { createDurableResourceEnvelope } from '@agent-device/capture-kit'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; import { createScreenRecordingAdmissionLedger } from '../screen-recording-admission-ledger.ts'; diff --git a/src/daemon/__tests__/screenshot-runtime-fixture.ts b/src/daemon/__tests__/screenshot-runtime-fixture.ts index d41e0eee75..b10daced2c 100644 --- a/src/daemon/__tests__/screenshot-runtime-fixture.ts +++ b/src/daemon/__tests__/screenshot-runtime-fixture.ts @@ -1,16 +1,20 @@ import { + type DeviceRuntimeGateway, + type RuntimeFacts, + type RuntimeOperationFact, localRuntimeOwner, narrowDeviceBinding, - screenshotRuntimeOperationFacts, - snapshotRuntimeOperationFacts, +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; +import { type CaptureScreenshotInput, + screenshotRuntimeOperationFacts, +} from '@agent-device/contracts/screenshot-runtime'; +import { type CaptureSnapshotInput, - type DeviceRuntimeGateway, - type PlatformRuntimeOperations, - type RuntimeFacts, - type RuntimeOperationFact, type SnapshotResult, -} from '@agent-device/contracts/platform'; + snapshotRuntimeOperationFacts, +} from '@agent-device/contracts/snapshot-runtime'; import { deviceShape, type DeviceInfo } from '@agent-device/kernel/device'; import fs from 'node:fs'; import { vi, type Mock } from 'vitest'; diff --git a/src/daemon/__tests__/selector-capture-fixture.ts b/src/daemon/__tests__/selector-capture-fixture.ts index 71fe9037f5..65eccf84f8 100644 --- a/src/daemon/__tests__/selector-capture-fixture.ts +++ b/src/daemon/__tests__/selector-capture-fixture.ts @@ -1,14 +1,16 @@ import { + type RuntimeFacts, + type RuntimeOperationFact, localRuntimeOwner, narrowDeviceBinding, providerRuntimeOwner, - snapshotRuntimeOperationFacts, +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; +import { type CaptureSnapshotInput, - type PlatformRuntimeOperations, - type RuntimeFacts, - type RuntimeOperationFact, type SnapshotResult, -} from '@agent-device/contracts/platform'; + snapshotRuntimeOperationFacts, +} from '@agent-device/contracts/snapshot-runtime'; import { deviceShape, type DeviceInfo } from '@agent-device/kernel/device'; import { isActiveProviderDevice } from '../../provider-device-runtime.ts'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from '../request-runtime-binding.ts'; diff --git a/src/daemon/__tests__/snapshot-custom-actions-platform-guard.test.ts b/src/daemon/__tests__/snapshot-custom-actions-platform-guard.test.ts index 619925a027..129f6aae50 100644 --- a/src/daemon/__tests__/snapshot-custom-actions-platform-guard.test.ts +++ b/src/daemon/__tests__/snapshot-custom-actions-platform-guard.test.ts @@ -15,11 +15,11 @@ import { createRequestHandler } from './test-device-runtime-gateway.ts'; import { LeaseRegistry } from '../lease-registry.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; import type { SessionState } from '../types.ts'; +import type { DeviceRuntimeGateway } from '@agent-device/contracts/platform-runtime'; import { - captureSnapshotUse, - type DeviceRuntimeGateway, type PlatformRuntimeOperations, -} from '@agent-device/contracts/platform'; + captureSnapshotUse, +} from '@agent-device/contracts/platform-runtime-operations'; import { snapshotRuntimeFixture } from './snapshot-runtime-fixture.ts'; function snapshotDeviceRuntimeGateway(): DeviceRuntimeGateway { diff --git a/src/daemon/__tests__/snapshot-diff-runtime.test.ts b/src/daemon/__tests__/snapshot-diff-runtime.test.ts index 35f687c593..97792a2aaa 100644 --- a/src/daemon/__tests__/snapshot-diff-runtime.test.ts +++ b/src/daemon/__tests__/snapshot-diff-runtime.test.ts @@ -1,14 +1,16 @@ import { expect, test, vi } from 'vitest'; import { + type DeviceBinding, + type RuntimeFacts, localRuntimeOwner, narrowDeviceBinding, - snapshotRuntimeOperationFacts, +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; +import { type CaptureSnapshotInput, - type DeviceBinding, - type PlatformRuntimeOperations, - type RuntimeFacts, type SnapshotResult, -} from '@agent-device/contracts/platform'; + snapshotRuntimeOperationFacts, +} from '@agent-device/contracts/snapshot-runtime'; import { deviceShape } from '@agent-device/kernel/device'; import { makeAndroidSession } from '../../__tests__/test-utils/session-factories.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; diff --git a/src/daemon/__tests__/snapshot-runtime-fixture.ts b/src/daemon/__tests__/snapshot-runtime-fixture.ts index 29da54ce75..e86693a385 100644 --- a/src/daemon/__tests__/snapshot-runtime-fixture.ts +++ b/src/daemon/__tests__/snapshot-runtime-fixture.ts @@ -1,15 +1,19 @@ import { + type RuntimeFacts, localRuntimeOwner, narrowDeviceBinding, providerRuntimeOwner, - screenshotRuntimeOperationFacts, - snapshotRuntimeOperationFacts, +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; +import { type CaptureScreenshotInput, + screenshotRuntimeOperationFacts, +} from '@agent-device/contracts/screenshot-runtime'; +import { type CaptureSnapshotInput, - type PlatformRuntimeOperations, - type RuntimeFacts, type SnapshotResult, -} from '@agent-device/contracts/platform'; + snapshotRuntimeOperationFacts, +} from '@agent-device/contracts/snapshot-runtime'; import { deviceShape, isIosFamily, type DeviceInfo } from '@agent-device/kernel/device'; import { dispatchCommand, type DispatchContext } from '../../core/dispatch.ts'; import { getRequestSignal } from '../../request/cancel.ts'; diff --git a/src/daemon/__tests__/test-device-runtime-gateway.ts b/src/daemon/__tests__/test-device-runtime-gateway.ts index a815995256..d1826d520a 100644 --- a/src/daemon/__tests__/test-device-runtime-gateway.ts +++ b/src/daemon/__tests__/test-device-runtime-gateway.ts @@ -1,12 +1,14 @@ import { + type ApplicationLifecycleOperationFacts, applicationLifecycleOperationFacts, availableApplicationLifecycleOperations, +} from '@agent-device/contracts/application-lifecycle-runtime'; +import { + type DeviceRuntimeGateway, localRuntimeOwner, narrowDeviceBinding, - type ApplicationLifecycleOperationFacts, - type DeviceRuntimeGateway, - type PlatformRuntimeOperations, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; import { createRequestHandler as createProductionRequestHandler, type RequestRouterDeps, diff --git a/src/daemon/__tests__/type-text-runtime.test.ts b/src/daemon/__tests__/type-text-runtime.test.ts index a70d850cdf..a6ff457b32 100644 --- a/src/daemon/__tests__/type-text-runtime.test.ts +++ b/src/daemon/__tests__/type-text-runtime.test.ts @@ -1,15 +1,19 @@ import { expect, test, vi } from 'vitest'; import { - localRuntimeOwner, - narrowDeviceBinding, - typeTextRuntimeOperationFacts, - typeTextRuntimeUse, type DeviceBinding, - type PlatformRuntimeOperations, type RuntimeFacts, type RuntimeOperationFact, + localRuntimeOwner, + narrowDeviceBinding, +} from '@agent-device/contracts/platform-runtime'; +import { + type PlatformRuntimeOperations, + typeTextRuntimeUse, +} from '@agent-device/contracts/platform-runtime-operations'; +import { type TypeTextInput, -} from '@agent-device/contracts/platform'; + typeTextRuntimeOperationFacts, +} from '@agent-device/contracts/type-text-runtime'; import { deviceShape } from '@agent-device/kernel/device'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from '../request-runtime-binding.ts'; import { resolveBoundTypeTextRuntime } from '../type-text-runtime.ts'; diff --git a/src/daemon/__tests__/viewport-runtime.test.ts b/src/daemon/__tests__/viewport-runtime.test.ts index 0fd1c502f8..09170bc407 100644 --- a/src/daemon/__tests__/viewport-runtime.test.ts +++ b/src/daemon/__tests__/viewport-runtime.test.ts @@ -1,15 +1,17 @@ import { expect, test, vi } from 'vitest'; import { - localRuntimeOwner, - narrowDeviceBinding, - viewportRuntimeOperationFacts, - viewportRuntimeUse, type DeviceBinding, type DeviceRuntimeGateway, - type PlatformRuntimeOperations, type RuntimeFacts, type RuntimeOperationFact, -} from '@agent-device/contracts/platform'; + localRuntimeOwner, + narrowDeviceBinding, +} from '@agent-device/contracts/platform-runtime'; +import { + type PlatformRuntimeOperations, + viewportRuntimeUse, +} from '@agent-device/contracts/platform-runtime-operations'; +import { viewportRuntimeOperationFacts } from '@agent-device/contracts/viewport-runtime'; import { deviceShape } from '@agent-device/kernel/device'; import { makeSession } from '../../__tests__/test-utils/session-factories.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; diff --git a/src/daemon/__tests__/wait-conditional-selector.test.ts b/src/daemon/__tests__/wait-conditional-selector.test.ts index a007e1117a..f6fb86abab 100644 --- a/src/daemon/__tests__/wait-conditional-selector.test.ts +++ b/src/daemon/__tests__/wait-conditional-selector.test.ts @@ -1,15 +1,17 @@ import { expect, test, vi } from 'vitest'; import { - localRuntimeOwner, - narrowDeviceBinding, - snapshotRuntimeOperationFacts, type DeviceBinding, - type FindSelectorInput, - type PlatformRuntimeOperations, type RuntimeFacts, type RuntimeOperationFact, + localRuntimeOwner, + narrowDeviceBinding, +} from '@agent-device/contracts/platform-runtime'; +import { + type PlatformRuntimeOperations, waitSelectorCaptureRuntimePlanUses, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/platform-runtime-operations'; +import type { FindSelectorInput } from '@agent-device/contracts/selector-observation-runtime'; +import { snapshotRuntimeOperationFacts } from '@agent-device/contracts/snapshot-runtime'; import { deviceShape } from '@agent-device/kernel/device'; import { IOS_SIMULATOR } from '../../__tests__/test-utils/device-fixtures.ts'; import { diff --git a/src/daemon/__tests__/wait-runtime.test.ts b/src/daemon/__tests__/wait-runtime.test.ts index 221baec718..cd1bdc4be8 100644 --- a/src/daemon/__tests__/wait-runtime.test.ts +++ b/src/daemon/__tests__/wait-runtime.test.ts @@ -1,19 +1,23 @@ import { expect, test, vi } from 'vitest'; -import { WAIT_REASONS } from '@agent-device/contracts/interaction'; +import { WAIT_REASONS } from '@agent-device/contracts/wait'; import { + type DeviceBinding, + type RuntimeFacts, + type RuntimeOperationFact, localRuntimeOwner, narrowDeviceBinding, providerRuntimeOwner, - snapshotRuntimeOperationFacts, - type CaptureSnapshotInput, - type DeviceBinding, +} from '@agent-device/contracts/platform-runtime'; +import { type PlatformRuntimeOperations, - type RuntimeFacts, - type RuntimeOperationFact, waitSelectorCaptureRuntimePlanUses, - type FindTextInput, +} from '@agent-device/contracts/platform-runtime-operations'; +import type { FindTextInput } from '@agent-device/contracts/selector-observation-runtime'; +import { + type CaptureSnapshotInput, type SnapshotResult, -} from '@agent-device/contracts/platform'; + snapshotRuntimeOperationFacts, +} from '@agent-device/contracts/snapshot-runtime'; import { deviceShape, type DeviceInfo } from '@agent-device/kernel/device'; import { makeSession } from '../../__tests__/test-utils/session-factories.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; diff --git a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-selector-fallback.test.ts b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-selector-fallback.test.ts index b960e86967..ed77dde969 100644 --- a/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-selector-fallback.test.ts +++ b/src/daemon/adapters/maestro/__tests__/daemon-runtime-port-selector-fallback.test.ts @@ -1,4 +1,4 @@ -import { INTERACTION_ERROR_REASONS } from '@agent-device/contracts/interaction'; +import { INTERACTION_ERROR_REASONS } from '@agent-device/contracts/interaction-error'; import type { DaemonError } from '@agent-device/kernel/errors'; import { expect, test } from 'vitest'; import type { DaemonRequest } from '../../../types.ts'; diff --git a/src/daemon/adapters/maestro/__tests__/daemon-runtime-public-operation.test.ts b/src/daemon/adapters/maestro/__tests__/daemon-runtime-public-operation.test.ts index aff939628e..d197db08b8 100644 --- a/src/daemon/adapters/maestro/__tests__/daemon-runtime-public-operation.test.ts +++ b/src/daemon/adapters/maestro/__tests__/daemon-runtime-public-operation.test.ts @@ -1,8 +1,6 @@ -import { - buildGesturePlan, - normalizePublicGesture, - readGesturePayload, -} from '@agent-device/contracts/interaction'; +import { readGesturePayload } from '@agent-device/contracts/gesture-input'; +import { normalizePublicGesture } from '@agent-device/contracts/gesture-normalization'; +import { buildGesturePlan } from '@agent-device/contracts/gesture-plan'; import assert from 'node:assert/strict'; import { describe, expect, test } from 'vitest'; import { diff --git a/src/daemon/adapters/maestro/daemon-runtime-tap.ts b/src/daemon/adapters/maestro/daemon-runtime-tap.ts index 29f2c380f9..2220521584 100644 --- a/src/daemon/adapters/maestro/daemon-runtime-tap.ts +++ b/src/daemon/adapters/maestro/daemon-runtime-tap.ts @@ -1,5 +1,5 @@ import { AppError, asAppError } from '@agent-device/kernel/errors'; -import { INTERACTION_ERROR_REASONS } from '@agent-device/contracts/interaction'; +import { INTERACTION_ERROR_REASONS } from '@agent-device/contracts/interaction-error'; import type { Rect } from '@agent-device/kernel/snapshot'; import { MAESTRO_RUNTIME_ADAPTER_POLICY, diff --git a/src/daemon/app-log-resource-recovery.ts b/src/daemon/app-log-resource-recovery.ts index 92719aed04..866dd4aab7 100644 --- a/src/daemon/app-log-resource-recovery.ts +++ b/src/daemon/app-log-resource-recovery.ts @@ -1,13 +1,14 @@ +import type { AppLogCompletion, AppLogLiveHandle } from '@agent-device/contracts/app-log-runtime'; +import type { DurableResourceEnvelope } from '@agent-device/contracts/durable-resource-envelope'; import { - defineUse, - narrowDeviceBinding, - type AppLogCompletion, - type AppLogLiveHandle, type DeviceRuntimeGateway, - type DurableResourceEnvelope, - type PlatformRequestScope, + narrowDeviceBinding, +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRequestScope } from '@agent-device/contracts/platform-runtime-host'; +import { type PlatformRuntimeOperations, -} from '@agent-device/contracts/platform'; + defineUse, +} from '@agent-device/contracts/platform-runtime-operations'; import { appLogDurableResource } from './app-log-session-resource.ts'; import { acquireExactDurableCaptureRecoveryControl } from './durable-capture-runtime-recovery.ts'; import type { DurableCaptureRecoveryControl } from './durable-capture-recovery-authority.ts'; diff --git a/src/daemon/application-lifecycle-recovery.ts b/src/daemon/application-lifecycle-recovery.ts index de00dc944a..8a6e416f22 100644 --- a/src/daemon/application-lifecycle-recovery.ts +++ b/src/daemon/application-lifecycle-recovery.ts @@ -1,16 +1,20 @@ import { - finalizeApplicationCloseWithRuntimeHintClearUse, - finalizeApplicationCloseRuntimeUse, + type RuntimeHintValues, hasRuntimeTransportHintValues, - narrowDeviceBinding, +} from '@agent-device/contracts/application-lifecycle-runtime'; +import { + finalizeApplicationCloseRuntimeUse, + finalizeApplicationCloseWithRuntimeHintClearUse, +} from '@agent-device/contracts/application-lifecycle-runtime-plan'; +import { type DeviceBinding, type DeviceRuntimeGateway, - type PlatformRequestScope, - type PlatformRuntimeOperations, type RuntimeFacts, - type RuntimeHintValues, type RuntimeOperationKey, -} from '@agent-device/contracts/platform'; + narrowDeviceBinding, +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRequestScope } from '@agent-device/contracts/platform-runtime-host'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; import { AppError } from '@agent-device/kernel/errors'; import type { SessionState } from './types.ts'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from './request-runtime-binding.ts'; diff --git a/src/daemon/apps-runtime.ts b/src/daemon/apps-runtime.ts index b6000acdcb..96d21600ae 100644 --- a/src/daemon/apps-runtime.ts +++ b/src/daemon/apps-runtime.ts @@ -1,10 +1,8 @@ import type { AppsFilter } from '@agent-device/contracts/device'; -import { - appsRuntimeUse, - type BoundDeviceRuntime, - type EnsureReadyInput, - type InstalledAppInfo, -} from '@agent-device/contracts/platform'; +import type { InstalledAppInfo } from '@agent-device/contracts/app-inventory-runtime'; +import type { EnsureReadyInput } from '@agent-device/contracts/device-readiness-runtime'; +import type { BoundDeviceRuntime } from '@agent-device/contracts/platform-runtime'; +import { appsRuntimeUse } from '@agent-device/contracts/platform-runtime-operations'; import type { DeviceInfo } from '@agent-device/kernel/device'; export function ensureAppsRuntimeReady( diff --git a/src/daemon/audio-probe.ts b/src/daemon/audio-probe.ts index e5da65cb88..fe97984ad2 100644 --- a/src/daemon/audio-probe.ts +++ b/src/daemon/audio-probe.ts @@ -1,10 +1,10 @@ import fs from 'node:fs/promises'; import path from 'node:path'; import { + type AudioProbeResult, emptyAudioProbeResult, normalizeAudioProbeRecord, - type AudioProbeResult, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/audio-probe-result'; import type { HostAudioProbeBackend } from '../platforms/audio-probe-backend.ts'; import { AppError } from '@agent-device/kernel/errors'; import { sleep } from '../utils/timeouts.ts'; diff --git a/src/daemon/context.ts b/src/daemon/context.ts index 5ad1b0235a..b10991c290 100644 --- a/src/daemon/context.ts +++ b/src/daemon/context.ts @@ -1,6 +1,6 @@ import type { CommandFlags } from '@agent-device/contracts/command'; import type { DispatchContext } from '../core/dispatch-context.ts'; -import { resolveClickButton } from '@agent-device/contracts/interaction'; +import { resolveClickButton } from '@agent-device/contracts/click-button'; import { screenshotFlagsFromOptions, type ScreenshotRuntimeFlags, diff --git a/src/daemon/durable-capture-resource-adoption.ts b/src/daemon/durable-capture-resource-adoption.ts index 5d65c86ea2..1d84f77752 100644 --- a/src/daemon/durable-capture-resource-adoption.ts +++ b/src/daemon/durable-capture-resource-adoption.ts @@ -1,10 +1,10 @@ +import type { LiveResourceHandle } from '@agent-device/contracts/durable-resource'; +import type { DurableResourceEnvelope } from '@agent-device/contracts/durable-resource-envelope'; import { - runtimeOwnerKey, - type DurableResourceEnvelope, - type LiveResourceHandle, type ResourceOwnershipFence, type RuntimeOwnerRef, -} from '@agent-device/contracts/platform'; + runtimeOwnerKey, +} from '@agent-device/contracts/platform-runtime'; import { createDurableResourceEnvelope, decodeDurableResourceEnvelope, diff --git a/src/daemon/durable-capture-resource-recovery.ts b/src/daemon/durable-capture-resource-recovery.ts index fa4316997f..07b4c0755d 100644 --- a/src/daemon/durable-capture-resource-recovery.ts +++ b/src/daemon/durable-capture-resource-recovery.ts @@ -5,7 +5,7 @@ import type { PlatformRequestScope, ResourceUnreattachableReason, } from '@agent-device/contracts/platform'; -import { isConfirmedCleanup } from '@agent-device/contracts/platform'; +import { isConfirmedCleanup } from '@agent-device/contracts/durable-resource'; import { emitDiagnostic } from '../utils/diagnostics.ts'; import { acquireDurableCaptureRecoveryAuthorityBeforeDeadline, diff --git a/src/daemon/durable-capture-resource-transitions.ts b/src/daemon/durable-capture-resource-transitions.ts index 4dda94cd65..6e6368de92 100644 --- a/src/daemon/durable-capture-resource-transitions.ts +++ b/src/daemon/durable-capture-resource-transitions.ts @@ -1,9 +1,9 @@ import { - isConfirmedCleanup, type CleanupOutcome, type FinishOutcome, type LiveResourceHandle, -} from '@agent-device/contracts/platform'; + isConfirmedCleanup, +} from '@agent-device/contracts/durable-resource'; import { AppError } from '@agent-device/kernel/errors'; import { emitDiagnostic } from '../utils/diagnostics.ts'; import { diff --git a/src/daemon/focus-runtime.ts b/src/daemon/focus-runtime.ts index 80aca77d1f..8a28a576ca 100644 --- a/src/daemon/focus-runtime.ts +++ b/src/daemon/focus-runtime.ts @@ -1,4 +1,5 @@ -import { focusRuntimeUse, type FocusPointInput } from '@agent-device/contracts/platform'; +import type { FocusPointInput } from '@agent-device/contracts/focus-runtime'; +import { focusRuntimeUse } from '@agent-device/contracts/platform-runtime-operations'; import type { DeviceInfo } from '@agent-device/kernel/device'; import type { Point } from '@agent-device/kernel/snapshot'; import { successText } from '../utils/success-text.ts'; diff --git a/src/daemon/handlers/__tests__/application-lifecycle-runtime-harness.ts b/src/daemon/handlers/__tests__/application-lifecycle-runtime-harness.ts index 812b382633..6acc8cd264 100644 --- a/src/daemon/handlers/__tests__/application-lifecycle-runtime-harness.ts +++ b/src/daemon/handlers/__tests__/application-lifecycle-runtime-harness.ts @@ -1,15 +1,17 @@ import { - applicationLifecycleOperationFacts, bindProviderApplicationLifecycleInteractor, invokeApplicationClose, invokeApplicationOpen, +} from '@agent-device/contracts/application-lifecycle-interaction'; +import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; +import { + type DeviceBinding, + type RuntimeFacts, localRuntimeOwner, narrowDeviceBinding, providerRuntimeOwner, - type DeviceBinding, - type PlatformRuntimeOperations, - type RuntimeFacts, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; import { unavailableDeploymentSnapshotAndShutdownOperationFacts } from '../../../__tests__/test-utils/runtime-operation-facts.ts'; import { deviceShape, type DeviceInfo } from '@agent-device/kernel/device'; import { vi } from 'vitest'; diff --git a/src/daemon/handlers/__tests__/install-source.test.ts b/src/daemon/handlers/__tests__/install-source.test.ts index 910f8f4e24..2f0f331947 100644 --- a/src/daemon/handlers/__tests__/install-source.test.ts +++ b/src/daemon/handlers/__tests__/install-source.test.ts @@ -1,18 +1,20 @@ import { readFileSync } from 'node:fs'; import path from 'node:path'; import { expect, test, vi } from 'vitest'; +import type { + AppDeploymentResult, + MaterializedAppSource, +} from '@agent-device/contracts/app-deployment-runtime'; import { + type DeviceBinding, + type RuntimeFacts, localRuntimeOwner, narrowDeviceBinding, providerRuntimeOwner, - screenshotRuntimeOperationFacts, - snapshotRuntimeOperationFacts, - type AppDeploymentResult, - type DeviceBinding, - type MaterializedAppSource, - type PlatformRuntimeOperations, - type RuntimeFacts, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; +import { screenshotRuntimeOperationFacts } from '@agent-device/contracts/screenshot-runtime'; +import { snapshotRuntimeOperationFacts } from '@agent-device/contracts/snapshot-runtime'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { AppError } from '@agent-device/kernel/errors'; import { mkdtempForTestSync } from '../../../__tests__/test-utils/tmp-dir.ts'; diff --git a/src/daemon/handlers/__tests__/interaction-get-runtime-fixture.ts b/src/daemon/handlers/__tests__/interaction-get-runtime-fixture.ts index 3140a1e665..e5117d8ce6 100644 --- a/src/daemon/handlers/__tests__/interaction-get-runtime-fixture.ts +++ b/src/daemon/handlers/__tests__/interaction-get-runtime-fixture.ts @@ -1,19 +1,21 @@ import { vi } from 'vitest'; import type { TypeTextBackendResult } from '@agent-device/contracts/interaction'; +import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; +import type { + ElementTextReadOutcome, + ReadTextAtPointInput, +} from '@agent-device/contracts/element-text-runtime'; +import type { FocusPointInput } from '@agent-device/contracts/focus-runtime'; import { - createUnavailablePlatformRuntimeFacts, - localRuntimeOwner, - narrowDeviceBinding, - applicationLifecycleOperationFacts, - type CaptureSnapshotInput, type DeviceBinding, - type PlatformRuntimeOperations, - type ElementTextReadOutcome, - type FocusPointInput, - type TypeTextInput, - type ReadTextAtPointInput, type RuntimeFacts, -} from '@agent-device/contracts/platform'; + localRuntimeOwner, + narrowDeviceBinding, +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; +import { createUnavailablePlatformRuntimeFacts } from '@agent-device/contracts/platform-runtime-unavailable'; +import type { CaptureSnapshotInput } from '@agent-device/contracts/snapshot-runtime'; +import type { TypeTextInput } from '@agent-device/contracts/type-text-runtime'; import type { DeviceInfo } from '@agent-device/kernel/device'; import type { BindDeviceRuntime, diff --git a/src/daemon/handlers/__tests__/interaction-read.test.ts b/src/daemon/handlers/__tests__/interaction-read.test.ts index 46f808ea9d..f19c55badc 100644 --- a/src/daemon/handlers/__tests__/interaction-read.test.ts +++ b/src/daemon/handlers/__tests__/interaction-read.test.ts @@ -1,10 +1,10 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { - elementTextRead, type ElementTextReadOutcome, type ReadTextAtPointInput, -} from '@agent-device/contracts/platform'; + elementTextRead, +} from '@agent-device/contracts/element-text-runtime'; import { readTextForNode } from '../interaction-read.ts'; /** diff --git a/src/daemon/handlers/__tests__/interaction.test.ts b/src/daemon/handlers/__tests__/interaction.test.ts index 4b30900b9c..b9ef9411c2 100644 --- a/src/daemon/handlers/__tests__/interaction.test.ts +++ b/src/daemon/handlers/__tests__/interaction.test.ts @@ -57,7 +57,7 @@ vi.mock('../../../platforms/apple/core/runner/runner-client.ts', async (importOr }; }); -import { elementTextRead } from '@agent-device/contracts/platform'; +import { elementTextRead } from '@agent-device/contracts/element-text-runtime'; import { elementReadFixtureState, getRuntimeBindings, diff --git a/src/daemon/handlers/__tests__/network-runtime-harness.ts b/src/daemon/handlers/__tests__/network-runtime-harness.ts index 1bf5b1487a..bf369df10e 100644 --- a/src/daemon/handlers/__tests__/network-runtime-harness.ts +++ b/src/daemon/handlers/__tests__/network-runtime-harness.ts @@ -1,14 +1,13 @@ import { vi } from 'vitest'; +import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; +import type { NetworkDumpInput, NetworkDumpResult } from '@agent-device/contracts/network-runtime'; import { - applicationLifecycleOperationFacts, - localRuntimeOwner, - narrowDeviceBinding, - type NetworkDumpInput, - type NetworkDumpResult, - type PlatformRuntimeOperations, type RuntimeOperationFact, type RuntimeOwnerRef, -} from '@agent-device/contracts/platform'; + localRuntimeOwner, + narrowDeviceBinding, +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; import { unavailableDeploymentSnapshotAndShutdownOperationFacts } from '../../../__tests__/test-utils/runtime-operation-facts.ts'; import type { DeviceInfo } from '@agent-device/kernel/device'; import type { BindDeviceRuntime } from '../../request-runtime-binding.ts'; diff --git a/src/daemon/handlers/__tests__/record-runtime.fixtures.ts b/src/daemon/handlers/__tests__/record-runtime.fixtures.ts index 8737a987d7..73e42af6f1 100644 --- a/src/daemon/handlers/__tests__/record-runtime.fixtures.ts +++ b/src/daemon/handlers/__tests__/record-runtime.fixtures.ts @@ -1,15 +1,15 @@ import { expect, vi } from 'vitest'; +import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; +import { PendingTransferGuard } from '@agent-device/contracts/async-lifecycle'; +import type { CleanupOutcome } from '@agent-device/contracts/durable-resource'; import { - applicationLifecycleOperationFacts, - localRuntimeOwner, - narrowDeviceBinding, - PendingTransferGuard, - type CleanupOutcome, type DeviceBinding, - type PlatformRuntimeOperations, type RuntimeOperationUnavailability, - type ScreenRecordingLiveHandle, -} from '@agent-device/contracts/platform'; + localRuntimeOwner, + narrowDeviceBinding, +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; +import type { ScreenRecordingLiveHandle } from '@agent-device/contracts/screen-recording-runtime'; import { unavailableDeploymentSnapshotAndShutdownOperationFacts } from '../../../__tests__/test-utils/runtime-operation-facts.ts'; import { createDurableResourceEnvelope } from '@agent-device/capture-kit'; import { makeSessionStore } from '../../../__tests__/test-utils/store-factory.ts'; diff --git a/src/daemon/handlers/__tests__/session-capabilities.fixtures.ts b/src/daemon/handlers/__tests__/session-capabilities.fixtures.ts index 6b646a26c3..6ba4f233a5 100644 --- a/src/daemon/handlers/__tests__/session-capabilities.fixtures.ts +++ b/src/daemon/handlers/__tests__/session-capabilities.fixtures.ts @@ -1,15 +1,15 @@ import { deviceShape, type DeviceInfo } from '@agent-device/kernel/device'; import { - localRuntimeOwner, - narrowDeviceBinding, - providerRuntimeOwner, - screenshotRuntimeOperationFacts, - snapshotRuntimeOperationFacts, type DeviceBinding, - type PlatformRuntimeOperations, type RuntimeFacts, type RuntimeProviderMode, -} from '@agent-device/contracts/platform'; + localRuntimeOwner, + narrowDeviceBinding, + providerRuntimeOwner, +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; +import { screenshotRuntimeOperationFacts } from '@agent-device/contracts/screenshot-runtime'; +import { snapshotRuntimeOperationFacts } from '@agent-device/contracts/snapshot-runtime'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts, diff --git a/src/daemon/handlers/__tests__/session-capabilities.test.ts b/src/daemon/handlers/__tests__/session-capabilities.test.ts index db187241da..e30e105e0e 100644 --- a/src/daemon/handlers/__tests__/session-capabilities.test.ts +++ b/src/daemon/handlers/__tests__/session-capabilities.test.ts @@ -11,17 +11,17 @@ import { makeSessionStore } from '../../../__tests__/test-utils/store-factory.ts import { withTestDeviceInventoryProvider as withTargetDeviceResolutionScope } from '../../../__tests__/test-utils/device-inventory-gateways.ts'; import { unavailableDeploymentSnapshotAndShutdownOperationFacts } from '../../../__tests__/test-utils/runtime-operation-facts.ts'; import type { DeviceInfo } from '@agent-device/kernel/device'; +import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; import { - applicationLifecycleOperationFacts, - localRuntimeOwner, - narrowDeviceBinding, - providerRuntimeOwner, - screenshotRuntimeOperationFacts, type DeviceBinding, - type PlatformRuntimeOperations, type RuntimeOperationFact, type RuntimeProviderMode, -} from '@agent-device/contracts/platform'; + localRuntimeOwner, + narrowDeviceBinding, + providerRuntimeOwner, +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; +import { screenshotRuntimeOperationFacts } from '@agent-device/contracts/screenshot-runtime'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts, diff --git a/src/daemon/handlers/__tests__/session-close-shutdown.fixtures.ts b/src/daemon/handlers/__tests__/session-close-shutdown.fixtures.ts index aa44b4c4db..8a4edf46a5 100644 --- a/src/daemon/handlers/__tests__/session-close-shutdown.fixtures.ts +++ b/src/daemon/handlers/__tests__/session-close-shutdown.fixtures.ts @@ -68,13 +68,13 @@ import { acquireDeviceClaim } from '../../device-claims.ts'; import { inspectDeviceClaims } from '../../device-claim-inspection.ts'; import { flushDiagnosticsToSessionFile, withDiagnosticsScope } from '../../../utils/diagnostics.ts'; import { + type DeviceBinding, localRuntimeOwner, narrowDeviceBinding, providerRuntimeOwner, - type DeviceBinding, - type PlatformRuntimeOperations, - type ScreenRecordingLiveHandle, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; +import type { ScreenRecordingLiveHandle } from '@agent-device/contracts/screen-recording-runtime'; import { createDurableResourceEnvelope } from '@agent-device/capture-kit'; import { screenRecordingResourceStore } from '../../screen-recording-resource-store.ts'; import { lifecycleRuntimeFacts } from './application-lifecycle-runtime-harness.ts'; diff --git a/src/daemon/handlers/__tests__/session-command-harness.ts b/src/daemon/handlers/__tests__/session-command-harness.ts index aa4684886b..d9fe8876c8 100644 --- a/src/daemon/handlers/__tests__/session-command-harness.ts +++ b/src/daemon/handlers/__tests__/session-command-harness.ts @@ -2,25 +2,27 @@ import { handleSessionCommands as handleProductionSessionCommands, type SessionCommandInput, } from '../session.ts'; +import type { + AppDeploymentInput, + AppDeploymentResult, + DeployMaterializedAppInput, + MaterializeAppSourceInput, + MaterializedAppSource, + PushNotificationInput, + PushNotificationResult, +} from '@agent-device/contracts/app-deployment-runtime'; +import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; +import type { EnsureReadyInput } from '@agent-device/contracts/device-readiness-runtime'; import { - applicationLifecycleOperationFacts, - localRuntimeOwner, - narrowDeviceBinding, - screenshotRuntimeOperationFacts, - snapshotRuntimeOperationFacts, - type AppDeploymentInput, - type AppDeploymentResult, type DeviceBinding, type DeviceRuntimeGateway, - type DeployMaterializedAppInput, - type EnsureReadyInput, - type MaterializeAppSourceInput, - type MaterializedAppSource, - type PlatformRuntimeOperations, - type PushNotificationInput, - type PushNotificationResult, type RuntimeFacts, -} from '@agent-device/contracts/platform'; + localRuntimeOwner, + narrowDeviceBinding, +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; +import { screenshotRuntimeOperationFacts } from '@agent-device/contracts/screenshot-runtime'; +import { snapshotRuntimeOperationFacts } from '@agent-device/contracts/snapshot-runtime'; import type { TargetShutdownResult } from '@agent-device/contracts/device'; import { deviceShape, isIosFamily, type DeviceInfo } from '@agent-device/kernel/device'; import { beforeEach, vi } from 'vitest'; diff --git a/src/daemon/handlers/__tests__/session-doctor-app-runtime.test.ts b/src/daemon/handlers/__tests__/session-doctor-app-runtime.test.ts index 8539363759..00be1a563a 100644 --- a/src/daemon/handlers/__tests__/session-doctor-app-runtime.test.ts +++ b/src/daemon/handlers/__tests__/session-doctor-app-runtime.test.ts @@ -6,13 +6,13 @@ import type { BindDeviceRuntime, InspectDeviceRuntimeFacts, } from '../../request-runtime-binding.ts'; +import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; import { - applicationLifecycleOperationFacts, + type RuntimeFacts, localRuntimeOwner, narrowDeviceBinding, - type PlatformRuntimeOperations, - type RuntimeFacts, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; import { unavailableDeploymentSnapshotAndShutdownOperationFacts } from '../../../__tests__/test-utils/runtime-operation-facts.ts'; import { handleDoctorCommand } from '../session-doctor.ts'; diff --git a/src/daemon/handlers/__tests__/session-inventory-apps-runtime.test.ts b/src/daemon/handlers/__tests__/session-inventory-apps-runtime.test.ts index 08c21647c9..2f71c204a2 100644 --- a/src/daemon/handlers/__tests__/session-inventory-apps-runtime.test.ts +++ b/src/daemon/handlers/__tests__/session-inventory-apps-runtime.test.ts @@ -2,13 +2,13 @@ import { beforeEach, expect, test, vi } from 'vitest'; import type { DaemonRequest } from '../../types.ts'; import { makeSession, makeSessionStore } from './session-test-harness.ts'; import { handleSessionInventoryCommands } from '../session-inventory.ts'; +import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; import { - applicationLifecycleOperationFacts, + type RuntimeFacts, localRuntimeOwner, narrowDeviceBinding, - type PlatformRuntimeOperations, - type RuntimeFacts, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; import { unavailableDeploymentSnapshotAndShutdownOperationFacts } from '../../../__tests__/test-utils/runtime-operation-facts.ts'; import type { BindDeviceRuntime, diff --git a/src/daemon/handlers/__tests__/session-inventory-harmonyos.test.ts b/src/daemon/handlers/__tests__/session-inventory-harmonyos.test.ts index 75d62876b1..ad32ffc4b0 100644 --- a/src/daemon/handlers/__tests__/session-inventory-harmonyos.test.ts +++ b/src/daemon/handlers/__tests__/session-inventory-harmonyos.test.ts @@ -2,13 +2,13 @@ import { beforeEach, expect, test, vi } from 'vitest'; import type { DaemonRequest, DaemonResponse } from '../../types.ts'; import { makeSession, makeSessionStore } from './session-test-harness.ts'; import { handleSessionInventoryCommands } from '../session-inventory.ts'; +import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; import { - applicationLifecycleOperationFacts, + type RuntimeFacts, localRuntimeOwner, narrowDeviceBinding, - type PlatformRuntimeOperations, - type RuntimeFacts, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; import { unavailableDeploymentSnapshotAndShutdownOperationFacts } from '../../../__tests__/test-utils/runtime-operation-facts.ts'; import type { BindDeviceRuntime, diff --git a/src/daemon/handlers/__tests__/session-logs.test.ts b/src/daemon/handlers/__tests__/session-logs.test.ts index 8822a7d19a..cd4a4e6829 100644 --- a/src/daemon/handlers/__tests__/session-logs.test.ts +++ b/src/daemon/handlers/__tests__/session-logs.test.ts @@ -1,13 +1,13 @@ import { beforeEach, expect, test, vi } from 'vitest'; +import type { AppLogRuntimeOperations } from '@agent-device/contracts/app-log-runtime'; +import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; +import type { CleanupOutcome } from '@agent-device/contracts/durable-resource'; import { - applicationLifecycleOperationFacts, + type DeviceBinding, localRuntimeOwner, narrowDeviceBinding, - type AppLogRuntimeOperations, - type CleanupOutcome, - type DeviceBinding, - type PlatformRuntimeOperations, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; import { unavailableDeploymentSnapshotAndShutdownOperationFacts } from '../../../__tests__/test-utils/runtime-operation-facts.ts'; import { createAppLogStartResult, createDurableResourceEnvelope } from '@agent-device/capture-kit'; import { createTestAppLogLiveHandle } from '../../../__tests__/test-utils/app-log-live-handle.ts'; diff --git a/src/daemon/handlers/__tests__/session-network-runtime-parity.test.ts b/src/daemon/handlers/__tests__/session-network-runtime-parity.test.ts index d3e6e5929b..18e0beb895 100644 --- a/src/daemon/handlers/__tests__/session-network-runtime-parity.test.ts +++ b/src/daemon/handlers/__tests__/session-network-runtime-parity.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; import { expect, test } from 'vitest'; -import { providerRuntimeOwner } from '@agent-device/contracts/platform'; +import { providerRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import type { BindDeviceRuntime } from '../../request-runtime-binding.ts'; import { handleSessionCommands } from './session-command-harness.ts'; import { diff --git a/src/daemon/handlers/__tests__/session-runtime-admission.test.ts b/src/daemon/handlers/__tests__/session-runtime-admission.test.ts index 2e00b1c717..79bde1e812 100644 --- a/src/daemon/handlers/__tests__/session-runtime-admission.test.ts +++ b/src/daemon/handlers/__tests__/session-runtime-admission.test.ts @@ -1,4 +1,4 @@ -import { resolveSnapshotRuntimePlan } from '@agent-device/contracts/platform'; +import { resolveSnapshotRuntimePlan } from '@agent-device/contracts/platform-runtime-operations'; import { expect, test } from 'vitest'; import { ANDROID_EMULATOR, IOS_SIMULATOR } from '../../../__tests__/test-utils/device-fixtures.ts'; import { snapshotRuntimeFixture } from '../../__tests__/snapshot-runtime-fixture.ts'; diff --git a/src/daemon/handlers/__tests__/session-state.test.ts b/src/daemon/handlers/__tests__/session-state.test.ts index 95f9b21bec..1f671311a7 100644 --- a/src/daemon/handlers/__tests__/session-state.test.ts +++ b/src/daemon/handlers/__tests__/session-state.test.ts @@ -4,16 +4,18 @@ import { handleSessionStateCommands } from '../session-state.ts'; import { makeSessionStore } from '../../../__tests__/test-utils/store-factory.ts'; import { withTestDeviceInventory } from '../../../__tests__/test-utils/device-inventory-gateways.ts'; import { unavailableDeploymentSnapshotAndShutdownOperationFacts } from '../../../__tests__/test-utils/runtime-operation-facts.ts'; +import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; import { - appStateUse, - applicationLifecycleOperationFacts, - createUnavailablePlatformRuntimeFacts, + type DeviceBinding, + type RuntimeFacts, localRuntimeOwner, narrowDeviceBinding, - type DeviceBinding, +} from '@agent-device/contracts/platform-runtime'; +import { type PlatformRuntimeOperations, - type RuntimeFacts, -} from '@agent-device/contracts/platform'; + appStateUse, +} from '@agent-device/contracts/platform-runtime-operations'; +import { createUnavailablePlatformRuntimeFacts } from '@agent-device/contracts/platform-runtime-unavailable'; import { deviceShape, type DeviceInfo } from '@agent-device/kernel/device'; import type { BindDeviceRuntime } from '../../request-runtime-binding.ts'; diff --git a/src/daemon/handlers/__tests__/session-test-harness.ts b/src/daemon/handlers/__tests__/session-test-harness.ts index 4d0b882b60..8e7a6c083f 100644 --- a/src/daemon/handlers/__tests__/session-test-harness.ts +++ b/src/daemon/handlers/__tests__/session-test-harness.ts @@ -1,7 +1,8 @@ import { isMacOs } from '@agent-device/kernel/device'; import { expect, vi, beforeEach } from 'vitest'; import { mkdtempForTestSync } from '../../../__tests__/test-utils/tmp-dir.ts'; -import { localRuntimeOwner, type AppLogLiveState } from '@agent-device/contracts/platform'; +import type { AppLogLiveState } from '@agent-device/contracts/app-log-runtime'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import { createDurableResourceEnvelope } from '@agent-device/capture-kit'; import { createTestAppLogLiveHandle } from '../../../__tests__/test-utils/app-log-live-handle.ts'; import type { LogBackend } from '@agent-device/contracts/observability'; diff --git a/src/daemon/handlers/__tests__/session-test-suite-command-video.test.ts b/src/daemon/handlers/__tests__/session-test-suite-command-video.test.ts index 3fef937eee..14a786fe40 100644 --- a/src/daemon/handlers/__tests__/session-test-suite-command-video.test.ts +++ b/src/daemon/handlers/__tests__/session-test-suite-command-video.test.ts @@ -21,10 +21,8 @@ import { import { createScreenRecordingAdmissionLedger } from '../../screen-recording-admission-ledger.ts'; import type { RecordRuntimeHandlerParams } from '../record-runtime.ts'; import { createDurableResourceEnvelope } from '@agent-device/capture-kit'; -import { - localRuntimeOwner, - type ScreenRecordingLiveHandle, -} from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; +import type { ScreenRecordingLiveHandle } from '@agent-device/contracts/screen-recording-runtime'; const recordRuntimeMocks = vi.hoisted(() => ({ handleRecordCommand: vi.fn(), diff --git a/src/daemon/handlers/find.ts b/src/daemon/handlers/find.ts index 9d8dd9f411..0b2400f6df 100644 --- a/src/daemon/handlers/find.ts +++ b/src/daemon/handlers/find.ts @@ -22,11 +22,9 @@ import { executeFocusPoint } from '../focus-runtime.ts'; import { executeBoundTypeText } from '../type-text-runtime.ts'; import { dispatchFindReadOnlyViaRuntime } from '../selector-runtime.ts'; import { admitAndBindSnapshotCapture } from '../snapshot-runtime-binding.ts'; -import { - resolveSelectorCaptureRuntimePlan, - type FocusPointInput, - type TypeTextRuntimeOperations, -} from '@agent-device/contracts/platform'; +import type { FocusPointInput } from '@agent-device/contracts/focus-runtime'; +import { resolveSelectorCaptureRuntimePlan } from '@agent-device/contracts/platform-runtime-operations'; +import type { TypeTextRuntimeOperations } from '@agent-device/contracts/type-text-runtime'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from '../request-runtime-binding.ts'; import { createFindTargetCapture, sparseFindSnapshotResponse } from './find-target-capture.ts'; import { isSparseSnapshotQualityVerdict } from '../../snapshot-quality/verdict.ts'; diff --git a/src/daemon/handlers/interaction-gesture.ts b/src/daemon/handlers/interaction-gesture.ts index 88a82c3a6a..b572f418e9 100644 --- a/src/daemon/handlers/interaction-gesture.ts +++ b/src/daemon/handlers/interaction-gesture.ts @@ -1,19 +1,22 @@ import { readOptionalInteger } from '@agent-device/contracts/command'; +import { type GesturePayload, readGesturePayload } from '@agent-device/contracts/gesture-input'; import { + type SwipePayload, assertNoRemovedSwipeInput, - GESTURE_FLING_DURATION_MS, gesturePayloadToPositionals, normalizeGestureCommandInput, normalizePublicSwipeMotion, - readGesturePayload, +} from '@agent-device/contracts/gesture-normalization'; +import { GESTURE_FLING_DURATION_MS } from '@agent-device/contracts/gesture-plan'; +import type { + GestureCommandInput, + GestureExecutionProfile, +} from '@agent-device/contracts/gesture-plan-types'; +import { SWIPE_PAUSE_MAX_MS, SWIPE_REPETITION_MAX, SWIPE_SERIES_MAX_SCHEDULED_DURATION_MS, - type GestureExecutionProfile, - type GesturePayload, - type GestureCommandInput, - type SwipePayload, -} from '@agent-device/contracts/interaction'; +} from '@agent-device/contracts/scroll-gesture'; import { AppError, normalizeError } from '@agent-device/kernel/errors'; import { REF_GRAMMAR_HINT, diff --git a/src/daemon/handlers/interaction-touch-press-admission.ts b/src/daemon/handlers/interaction-touch-press-admission.ts index 66a18d572e..a68310b3b8 100644 --- a/src/daemon/handlers/interaction-touch-press-admission.ts +++ b/src/daemon/handlers/interaction-touch-press-admission.ts @@ -4,7 +4,7 @@ import { buttonTag, getClickButtonValidationError, resolveClickButton, -} from '@agent-device/contracts/interaction'; +} from '@agent-device/contracts/click-button'; import { publicPlatformString } from '@agent-device/kernel/device'; import { resolveRefStalenessWarning } from '../session-snapshot.ts'; import type { DaemonResponse, SessionState } from '../types.ts'; diff --git a/src/daemon/handlers/record-runtime.ts b/src/daemon/handlers/record-runtime.ts index f6f0fb86a4..91d5b73c39 100644 --- a/src/daemon/handlers/record-runtime.ts +++ b/src/daemon/handlers/record-runtime.ts @@ -1,12 +1,12 @@ import path from 'node:path'; +import type { PlatformRequestScope } from '@agent-device/contracts/platform-runtime-host'; +import type { ScreenRecordingStartInput } from '@agent-device/contracts/screen-recording-runtime'; import { resolveScreenRecordingRuntimePlan, screenRecordingAdmissionUse, - screenRecordingStartUse, screenRecordingRecoveryUse, - type PlatformRequestScope, - type ScreenRecordingStartInput, -} from '@agent-device/contracts/platform'; + screenRecordingStartUse, +} from '@agent-device/contracts/screen-recording-runtime-plan'; import { isWholeScreenRecordingScope } from '@agent-device/contracts/recording'; import { deviceIdentity, sameDeviceIdentity } from '@agent-device/kernel/device'; import { AppError, normalizeError } from '@agent-device/kernel/errors'; diff --git a/src/daemon/handlers/session-app-deployment.ts b/src/daemon/handlers/session-app-deployment.ts index 211dfeca85..adde3e6aed 100644 --- a/src/daemon/handlers/session-app-deployment.ts +++ b/src/daemon/handlers/session-app-deployment.ts @@ -1,9 +1,9 @@ import fs from 'node:fs'; +import type { AppDeploymentResult } from '@agent-device/contracts/app-deployment-runtime'; import { deployAppUse, readySendPushNotificationUse, - type AppDeploymentResult, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/app-deployment-runtime-plan'; import { isIosFamily, publicPlatformString } from '@agent-device/kernel/device'; import { readNotificationPayload } from '../../core/dispatch-payload.ts'; import { cleanupUploadedArtifact, prepareUploadedArtifact } from '../artifact-tracking.ts'; diff --git a/src/daemon/handlers/session-app-source-deployment.ts b/src/daemon/handlers/session-app-source-deployment.ts index 848832263b..043dbf74eb 100644 --- a/src/daemon/handlers/session-app-source-deployment.ts +++ b/src/daemon/handlers/session-app-source-deployment.ts @@ -1,6 +1,6 @@ import type { AppDeploymentResult, MaterializedAppSource } from '@agent-device/contracts/platform'; import type { CommandFlags } from '@agent-device/contracts/command'; -import { readyMaterializeAndDeployAppUse } from '@agent-device/contracts/platform'; +import { readyMaterializeAndDeployAppUse } from '@agent-device/contracts/app-deployment-runtime-plan'; import { isIosFamily } from '@agent-device/kernel/device'; import { AppError, normalizeError } from '@agent-device/kernel/errors'; import { diff --git a/src/daemon/handlers/session-close-runtime-admission.ts b/src/daemon/handlers/session-close-runtime-admission.ts index b673d1e008..8adaa4ea0e 100644 --- a/src/daemon/handlers/session-close-runtime-admission.ts +++ b/src/daemon/handlers/session-close-runtime-admission.ts @@ -1,8 +1,8 @@ import { closeApplicationRuntimeUse, closeApplicationWithRuntimeHintClearUse, - type BoundDeviceRuntime, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/application-lifecycle-runtime-plan'; +import type { BoundDeviceRuntime } from '@agent-device/contracts/platform-runtime'; import type { DeviceInfo } from '@agent-device/kernel/device'; import type { DaemonResponse } from '../types.ts'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from '../request-runtime-binding.ts'; diff --git a/src/daemon/handlers/session-doctor.ts b/src/daemon/handlers/session-doctor.ts index a086dd8211..9645bd6bce 100644 --- a/src/daemon/handlers/session-doctor.ts +++ b/src/daemon/handlers/session-doctor.ts @@ -36,11 +36,9 @@ import { } from '../../platforms/apple/core/runner/runner-client.ts'; import { appendWebBrowserLifecycleCheck } from './session-doctor-web.ts'; import { resolveAndroidSerialAllowlist } from '../../utils/device-isolation.ts'; -import { - appsRuntimeUse, - type BoundDeviceRuntime, - type InstalledAppInfo, -} from '@agent-device/contracts/platform'; +import type { InstalledAppInfo } from '@agent-device/contracts/app-inventory-runtime'; +import type { BoundDeviceRuntime } from '@agent-device/contracts/platform-runtime'; +import { appsRuntimeUse } from '@agent-device/contracts/platform-runtime-operations'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from '../request-runtime-binding.ts'; import { ensureAppsRuntimeReady, listAppsFromRuntime } from '../apps-runtime.ts'; diff --git a/src/daemon/handlers/session-install-capability-projection.ts b/src/daemon/handlers/session-install-capability-projection.ts index ae81903a11..cd299cd2fa 100644 --- a/src/daemon/handlers/session-install-capability-projection.ts +++ b/src/daemon/handlers/session-install-capability-projection.ts @@ -1,9 +1,9 @@ import { INTERNAL_COMMANDS, PUBLIC_COMMANDS } from '../../command-catalog.ts'; import { commandDescriptors } from '../../core/command-descriptor/registry.ts'; -import { - type RuntimeOperationFact, - type RuntimeUseDeclaration, -} from '@agent-device/contracts/platform'; +import type { + RuntimeOperationFact, + RuntimeUseDeclaration, +} from '@agent-device/contracts/platform-runtime'; import type { InspectDeviceRuntimeFacts } from '../request-runtime-binding.ts'; type InstallFamilyRuntimeUse = RuntimeUseDeclaration; diff --git a/src/daemon/handlers/session-inventory.ts b/src/daemon/handlers/session-inventory.ts index 5abc002e78..2c5bbf3848 100644 --- a/src/daemon/handlers/session-inventory.ts +++ b/src/daemon/handlers/session-inventory.ts @@ -25,16 +25,18 @@ import { } from './session-device-utils.ts'; import { errorResponse } from './response.ts'; import { resolveImplicitSessionScope, sessionMatchesScope } from '../session-routing.ts'; +import { appLogAdmissionUse } from '@agent-device/contracts/logs-runtime-plan'; +import { networkAdmissionUse } from '@agent-device/contracts/network-runtime-plan'; +import type { + BoundDeviceRuntime, + RuntimeFacts, + RuntimeOperationKey, +} from '@agent-device/contracts/platform-runtime'; import { - appLogAdmissionUse, - appsRuntimeUse, - networkAdmissionUse, - screenRecordingAdmissionUse, type PlatformRuntimeOperations, - type RuntimeFacts, - type BoundDeviceRuntime, - type RuntimeOperationKey, -} from '@agent-device/contracts/platform'; + appsRuntimeUse, +} from '@agent-device/contracts/platform-runtime-operations'; +import { screenRecordingAdmissionUse } from '@agent-device/contracts/screen-recording-runtime-plan'; import { ensureAppsRuntimeReady, listAppsFromRuntime } from '../apps-runtime.ts'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from '../request-runtime-binding.ts'; import { installFamilyCapabilityAvailable } from './session-install-capability-projection.ts'; diff --git a/src/daemon/handlers/session-network.ts b/src/daemon/handlers/session-network.ts index 657b27d7ca..d9bb32a63f 100644 --- a/src/daemon/handlers/session-network.ts +++ b/src/daemon/handlers/session-network.ts @@ -1,8 +1,8 @@ +import type { NetworkDumpResult } from '@agent-device/contracts/network-runtime'; import { networkAdmissionUse, resolveNetworkRuntimePlan, - type NetworkDumpResult, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/network-runtime-plan'; import { NETWORK_INCLUDE_MODES, type NetworkIncludeMode } from '@agent-device/kernel/contracts'; import { AppError, normalizeError } from '@agent-device/kernel/errors'; import type { BindDeviceRuntime } from '../request-runtime-binding.ts'; diff --git a/src/daemon/handlers/session-observability.ts b/src/daemon/handlers/session-observability.ts index 9b4713106a..124215eb56 100644 --- a/src/daemon/handlers/session-observability.ts +++ b/src/daemon/handlers/session-observability.ts @@ -12,14 +12,16 @@ import { type PerfArea, type PerfKind, } from '@agent-device/contracts/observability'; +import type { + AppLogFailure, + AppLogRuntimeOperations, +} from '@agent-device/contracts/app-log-runtime'; import { + type LogsRuntimePlan, appLogAdmissionUse, resolveLogsRuntimePlan, - type AppLogFailure, - type AppLogRuntimeOperations, - type LogsRuntimePlan, - type RuntimeOwnerRef, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/logs-runtime-plan'; +import type { RuntimeOwnerRef } from '@agent-device/contracts/platform-runtime'; import { uniqueStrings } from '@agent-device/kernel/collections'; import { AppError, normalizeError } from '@agent-device/kernel/errors'; import type { AndroidAdbExecutor } from '../../platforms/android/adb-executor.ts'; diff --git a/src/daemon/handlers/session-open-execution.ts b/src/daemon/handlers/session-open-execution.ts index f5fc227218..862cdc860c 100644 --- a/src/daemon/handlers/session-open-execution.ts +++ b/src/daemon/handlers/session-open-execution.ts @@ -2,8 +2,8 @@ import { openApplicationRuntimeUse, openApplicationWithRuntimeHintApplyUse, openApplicationWithRuntimeHintClearUse, - type BoundDeviceRuntime, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/application-lifecycle-runtime-plan'; +import type { BoundDeviceRuntime } from '@agent-device/contracts/platform-runtime'; import type { SessionSurface } from '@agent-device/contracts/session'; import type { DeviceInfo } from '@agent-device/kernel/device'; import type { DaemonRequest, DaemonResponse, SessionState } from '../types.ts'; diff --git a/src/daemon/handlers/session-open-prepare.ts b/src/daemon/handlers/session-open-prepare.ts index c3525bfb10..83081aae94 100644 --- a/src/daemon/handlers/session-open-prepare.ts +++ b/src/daemon/handlers/session-open-prepare.ts @@ -1,9 +1,7 @@ import { isDeepLinkTarget } from '@agent-device/contracts/command'; -import { - openApplicationRuntimeUse, - type BoundDeviceRuntime, - type RuntimeHintsApplicationInput, -} from '@agent-device/contracts/platform'; +import type { RuntimeHintsApplicationInput } from '@agent-device/contracts/application-lifecycle-runtime'; +import { openApplicationRuntimeUse } from '@agent-device/contracts/application-lifecycle-runtime-plan'; +import type { BoundDeviceRuntime } from '@agent-device/contracts/platform-runtime'; import type { DeviceInfo } from '@agent-device/kernel/device'; import type { DaemonRequest, DaemonResponse, SessionRuntimeHints, SessionState } from '../types.ts'; import { SessionStore } from '../session-store.ts'; diff --git a/src/daemon/handlers/session-open.ts b/src/daemon/handlers/session-open.ts index 26b99ffb86..3b36d056b4 100644 --- a/src/daemon/handlers/session-open.ts +++ b/src/daemon/handlers/session-open.ts @@ -5,7 +5,7 @@ import { openApplicationWithRuntimeHintApplyUse, openApplicationWithRuntimeHintClearUse, resolveOpenApplicationRuntimePlan, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/application-lifecycle-runtime-plan'; import type { DeviceInfo } from '@agent-device/kernel/device'; import type { DaemonRequest, DaemonResponse, SessionState } from '../types.ts'; import { SessionStore } from '../session-store.ts'; diff --git a/src/daemon/handlers/session-prepare.ts b/src/daemon/handlers/session-prepare.ts index 19264b40c9..8e0d31bbbb 100644 --- a/src/daemon/handlers/session-prepare.ts +++ b/src/daemon/handlers/session-prepare.ts @@ -1,7 +1,5 @@ -import { - prepareAppleRunnerRuntimeUse, - type BoundDeviceRuntime, -} from '@agent-device/contracts/platform'; +import { prepareAppleRunnerRuntimeUse } from '@agent-device/contracts/application-lifecycle-runtime-plan'; +import type { BoundDeviceRuntime } from '@agent-device/contracts/platform-runtime'; import { PUBLIC_COMMANDS } from '../../command-catalog.ts'; import { PREPARE_REQUEST_TIMEOUT_MS } from '../../core/command-descriptor/timeout-policy.ts'; import { publicPlatformString, type DeviceInfo } from '@agent-device/kernel/device'; diff --git a/src/daemon/handlers/session-replay-action-runtime.ts b/src/daemon/handlers/session-replay-action-runtime.ts index f3b87a0259..2a08f2700a 100644 --- a/src/daemon/handlers/session-replay-action-runtime.ts +++ b/src/daemon/handlers/session-replay-action-runtime.ts @@ -6,7 +6,7 @@ import { AppError, normalizeError } from '@agent-device/kernel/errors'; import { gesturePayloadFromPositionals, swipePayloadFromPositionals, -} from '@agent-device/contracts/interaction'; +} from '@agent-device/contracts/gesture-normalization'; import { buildDisplayPositionals } from '../session-event-action.ts'; import { appendReplayTraceEvent } from './session-replay-trace.ts'; import { inferFillText } from '../action-utils.ts'; diff --git a/src/daemon/handlers/session-replay-divergence.ts b/src/daemon/handlers/session-replay-divergence.ts index 6d9fc73118..f760eba2ce 100644 --- a/src/daemon/handlers/session-replay-divergence.ts +++ b/src/daemon/handlers/session-replay-divergence.ts @@ -1,7 +1,7 @@ import type { SessionAction } from '@agent-device/contracts/session'; import type { CommandFlags } from '@agent-device/contracts/command'; import { sleep } from '../../utils/timeouts.ts'; -import { isUnreadableCaptureContentError } from '@agent-device/contracts/platform'; +import { isUnreadableCaptureContentError } from '@agent-device/contracts/android-snapshot-quality'; import { isSparseSnapshotQualityVerdict } from '../../snapshot-quality/verdict.ts'; import { displayLabel, formatRole } from '../../snapshot/snapshot-lines.ts'; import type { ResponseLevel } from '@agent-device/kernel/contracts'; diff --git a/src/daemon/handlers/session-replay-target-token.ts b/src/daemon/handlers/session-replay-target-token.ts index 5bb5fa1cfd..216cc55890 100644 --- a/src/daemon/handlers/session-replay-target-token.ts +++ b/src/daemon/handlers/session-replay-target-token.ts @@ -1,6 +1,6 @@ import type { SessionAction } from '@agent-device/contracts/session'; import { isTouchTargetCommand } from '@agent-device/ad-script'; -import { dragGesturePayloadFromPositionals } from '@agent-device/contracts/interaction'; +import { dragGesturePayloadFromPositionals } from '@agent-device/contracts/gesture-normalization'; import { readSelectorExpression } from '@agent-device/selectors'; /** Returns the resolved-target token carried by an eligible replay action. */ diff --git a/src/daemon/handlers/session-runtime-command.ts b/src/daemon/handlers/session-runtime-command.ts index 734a486280..f2d17c55f5 100644 --- a/src/daemon/handlers/session-runtime-command.ts +++ b/src/daemon/handlers/session-runtime-command.ts @@ -1,6 +1,6 @@ import type { DaemonRequest, DaemonResponse } from '../types.ts'; import { publicPlatformString } from '@agent-device/kernel/device'; -import { clearRuntimeHintsRuntimeUse } from '@agent-device/contracts/platform'; +import { clearRuntimeHintsRuntimeUse } from '@agent-device/contracts/application-lifecycle-runtime-plan'; import { SessionStore } from '../session-store.ts'; import { errorResponse } from './response.ts'; import { expireRefFrame } from '../ref-frame.ts'; diff --git a/src/daemon/handlers/session-runtime-port-reverse.ts b/src/daemon/handlers/session-runtime-port-reverse.ts index dcb3768e59..7e787e9dd1 100644 --- a/src/daemon/handlers/session-runtime-port-reverse.ts +++ b/src/daemon/handlers/session-runtime-port-reverse.ts @@ -1,5 +1,5 @@ import type { ProviderPortReverseOptions } from '@agent-device/contracts/device'; -import { configureProviderPortReverseRuntimeUse } from '@agent-device/contracts/platform'; +import { configureProviderPortReverseRuntimeUse } from '@agent-device/contracts/application-lifecycle-runtime-plan'; import type { DaemonRequest, DaemonResponse } from '../types.ts'; import type { SessionStore } from '../session-store.ts'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from '../request-runtime-binding.ts'; diff --git a/src/daemon/handlers/session-runtime.ts b/src/daemon/handlers/session-runtime.ts index 7c8a0fff72..5da503b3f8 100644 --- a/src/daemon/handlers/session-runtime.ts +++ b/src/daemon/handlers/session-runtime.ts @@ -1,8 +1,8 @@ import type { CommandFlags } from '@agent-device/contracts/command'; import { - hasRuntimeTransportHintValues, type RuntimeHintValues, -} from '@agent-device/contracts/platform'; + hasRuntimeTransportHintValues, +} from '@agent-device/contracts/application-lifecycle-runtime'; import { AppError, asAppError } from '@agent-device/kernel/errors'; import { publicPlatformString, type DeviceInfo } from '@agent-device/kernel/device'; import type { DaemonRequest, SessionRuntimeHints, SessionState } from '../types.ts'; diff --git a/src/daemon/handlers/session-state.ts b/src/daemon/handlers/session-state.ts index 798a59152e..7fa1eff83e 100644 --- a/src/daemon/handlers/session-state.ts +++ b/src/daemon/handlers/session-state.ts @@ -1,11 +1,11 @@ import { AppError, asAppError } from '@agent-device/kernel/errors'; import type { TargetShutdownResult } from '@agent-device/contracts/device'; +import type { RuntimeOperationFact } from '@agent-device/contracts/platform-runtime'; import { - resolveDeviceReadinessRuntimePlan, appStateUse, + resolveDeviceReadinessRuntimePlan, shutdownTargetUse, - type RuntimeOperationFact, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/platform-runtime-operations'; import { isApplePlatform, isIosFamily, diff --git a/src/daemon/handlers/snapshot-alert.ts b/src/daemon/handlers/snapshot-alert.ts index c63c0756b0..fc8b3e8316 100644 --- a/src/daemon/handlers/snapshot-alert.ts +++ b/src/daemon/handlers/snapshot-alert.ts @@ -2,9 +2,9 @@ import { isIosFamily, isMacOs } from '@agent-device/kernel/device'; import { ALERT_ACTION_RETRY_MS, ALERT_POLL_INTERVAL_MS as POLL_INTERVAL_MS, - DEFAULT_ALERT_TIMEOUT_MS as DEFAULT_TIMEOUT_MS, type AlertAction, -} from '@agent-device/contracts/interaction'; + DEFAULT_ALERT_TIMEOUT_MS as DEFAULT_TIMEOUT_MS, +} from '@agent-device/contracts/alert-contract'; import { sleep } from '../../utils/timeouts.ts'; import { runAppleRunnerCommand } from '../../platforms/apple/core/runner/runner-client.ts'; import { runMacOsAlertAction } from '../../platforms/apple/os/macos/helper.ts'; diff --git a/src/daemon/recording-gestures.ts b/src/daemon/recording-gestures.ts index 6bc560a277..a3e92705a2 100644 --- a/src/daemon/recording-gestures.ts +++ b/src/daemon/recording-gestures.ts @@ -8,12 +8,12 @@ import { resolveTapVisualizationOffsetMs, } from './recording-timing.ts'; import { emitDiagnostic } from '../utils/diagnostics.ts'; +import { DEFAULT_MOBILE_SCROLL_DURATION_MS } from '@agent-device/contracts/scroll-command'; import { - buildScrollGesturePlan, - DEFAULT_MOBILE_SCROLL_DURATION_MS, type ScrollDirection, type SwipePattern, -} from '@agent-device/contracts/interaction'; + buildScrollGesturePlan, +} from '@agent-device/contracts/scroll-gesture'; import { getSnapshotReferenceFrame, type TouchReferenceFrame as ReferenceFrame, diff --git a/src/daemon/request-runtime-binding.ts b/src/daemon/request-runtime-binding.ts index ec3108e0d7..b17f465b84 100644 --- a/src/daemon/request-runtime-binding.ts +++ b/src/daemon/request-runtime-binding.ts @@ -1,18 +1,18 @@ import { deviceIdentity, deviceIdentityKey, type DeviceInfo } from '@agent-device/kernel/device'; +import { AsyncCleanupStack } from '@agent-device/contracts/async-lifecycle'; import { - AsyncCleanupStack, - narrowDeviceBinding, type BoundDeviceRuntime, type DeviceBinding, type DeviceRuntimeGateway, - type PlatformRuntimeOperations, - type PlatformRequestScope, type ResourceOwnershipFence, + type RuntimeFacts, type RuntimeOperationKey, type RuntimeOwnerRef, - type RuntimeFacts, type RuntimeUse, -} from '@agent-device/contracts/platform'; + narrowDeviceBinding, +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRequestScope } from '@agent-device/contracts/platform-runtime-host'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; export type BindDeviceRuntime = < const Required extends readonly RuntimeOperationKey[], diff --git a/src/daemon/screen-recording-resource-recovery.ts b/src/daemon/screen-recording-resource-recovery.ts index 279a77afe9..fe313a241a 100644 --- a/src/daemon/screen-recording-resource-recovery.ts +++ b/src/daemon/screen-recording-resource-recovery.ts @@ -1,14 +1,16 @@ +import type { DurableResourceEnvelope } from '@agent-device/contracts/durable-resource-envelope'; import { - narrowDeviceBinding, - screenRecordingRecoveryUse, type BoundDeviceRuntime, type DeviceRuntimeGateway, - type DurableResourceEnvelope, - type PlatformRequestScope, - type PlatformRuntimeOperations, - type ScreenRecordingCompletion, - type ScreenRecordingLiveHandle, -} from '@agent-device/contracts/platform'; + narrowDeviceBinding, +} from '@agent-device/contracts/platform-runtime'; +import type { PlatformRequestScope } from '@agent-device/contracts/platform-runtime-host'; +import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations'; +import type { + ScreenRecordingCompletion, + ScreenRecordingLiveHandle, +} from '@agent-device/contracts/screen-recording-runtime'; +import { screenRecordingRecoveryUse } from '@agent-device/contracts/screen-recording-runtime-plan'; import type { DurableCaptureRecoveryControl } from './durable-capture-recovery-authority.ts'; import { acquireExactDurableCaptureRecoveryControl } from './durable-capture-runtime-recovery.ts'; import type { DurableCaptureRecoveryDiagnostic } from './durable-capture-resource-recovery.ts'; diff --git a/src/daemon/screen-recording-resource-store.ts b/src/daemon/screen-recording-resource-store.ts index f33de339b5..3fff95c8ae 100644 --- a/src/daemon/screen-recording-resource-store.ts +++ b/src/daemon/screen-recording-resource-store.ts @@ -1,4 +1,4 @@ -import { SCREEN_RECORDING_RESOURCE_KIND } from '@agent-device/contracts/platform'; +import { SCREEN_RECORDING_RESOURCE_KIND } from '@agent-device/contracts/screen-recording-runtime'; import { createDurableCaptureResourceStore } from './durable-capture-resource-store.ts'; export const screenRecordingResourceStore = createDurableCaptureResourceStore({ diff --git a/src/daemon/screenshot-runtime-binding.ts b/src/daemon/screenshot-runtime-binding.ts index ce69a66ef3..d32fd0be53 100644 --- a/src/daemon/screenshot-runtime-binding.ts +++ b/src/daemon/screenshot-runtime-binding.ts @@ -1,13 +1,17 @@ +import type { RuntimeOperationFact } from '@agent-device/contracts/platform-runtime'; import { - resolveScreenshotRuntimePlan, - type CaptureScreenshotInput, - type CaptureSnapshotInput, - type RuntimeOperationFact, - type ScreenshotRuntimeOperations, type ScreenshotRuntimePlan, - type SnapshotResult, - type SnapshotRuntimeOperations, -} from '@agent-device/contracts/platform'; + resolveScreenshotRuntimePlan, +} from '@agent-device/contracts/platform-runtime-operations'; +import type { + CaptureScreenshotInput, + ScreenshotRuntimeOperations, +} from '@agent-device/contracts/screenshot-runtime'; +import type { + CaptureSnapshotInput, + SnapshotResult, + SnapshotRuntimeOperations, +} from '@agent-device/contracts/snapshot-runtime'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { errorResponse } from './handlers/response.ts'; import { diff --git a/src/daemon/selector-capture-binding.ts b/src/daemon/selector-capture-binding.ts index 915d7b6e79..e9375d03de 100644 --- a/src/daemon/selector-capture-binding.ts +++ b/src/daemon/selector-capture-binding.ts @@ -1,11 +1,13 @@ -import { - resolveSelectorCaptureRuntimePlan, - type CaptureSnapshotInput, - type ElementTextRuntimeOperations, - type FindTextRuntimeOperations, - type FindSelectorRuntimeOperations, - type SnapshotResult, -} from '@agent-device/contracts/platform'; +import type { ElementTextRuntimeOperations } from '@agent-device/contracts/element-text-runtime'; +import { resolveSelectorCaptureRuntimePlan } from '@agent-device/contracts/platform-runtime-operations'; +import type { + FindSelectorRuntimeOperations, + FindTextRuntimeOperations, +} from '@agent-device/contracts/selector-observation-runtime'; +import type { + CaptureSnapshotInput, + SnapshotResult, +} from '@agent-device/contracts/snapshot-runtime'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from './request-runtime-binding.ts'; import { admitAndBindSnapshotCapture } from './snapshot-runtime-binding.ts'; import type { DaemonResponse, SessionState } from './types.ts'; diff --git a/src/daemon/selector-recording.ts b/src/daemon/selector-recording.ts index cc79138347..e319960b16 100644 --- a/src/daemon/selector-recording.ts +++ b/src/daemon/selector-recording.ts @@ -1,7 +1,7 @@ import type { DaemonRequest } from './types.ts'; import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import type { FindReadResult } from '@agent-device/contracts/interaction'; -import { stripAndroidSystemChromeProvenanceFromNode } from '@agent-device/contracts/platform'; +import { stripAndroidSystemChromeProvenanceFromNode } from '@agent-device/contracts/android-system-chrome'; import { SessionStore } from './session-store.ts'; import { isInteractiveObservation } from './session-action-recorder.ts'; import { isSessionRecording } from './session-script-publication-capability.ts'; diff --git a/src/daemon/selector-runtime.ts b/src/daemon/selector-runtime.ts index a7ddd1a987..800efc2dc6 100644 --- a/src/daemon/selector-runtime.ts +++ b/src/daemon/selector-runtime.ts @@ -1,4 +1,4 @@ -import { waitObservesDevice } from '@agent-device/contracts/platform'; +import { waitObservesDevice } from '@agent-device/contracts/wait-runtime-plan'; import { parseWaitPositionals } from '../core/wait-positionals.ts'; import type { WaitParsed } from '../core/wait-positionals.ts'; import { AppError, asAppError } from '@agent-device/kernel/errors'; diff --git a/src/daemon/server/daemon-runtime-recording-teardown.test.ts b/src/daemon/server/daemon-runtime-recording-teardown.test.ts index a7ffd767c1..892bae6e55 100644 --- a/src/daemon/server/daemon-runtime-recording-teardown.test.ts +++ b/src/daemon/server/daemon-runtime-recording-teardown.test.ts @@ -1,10 +1,10 @@ import path from 'node:path'; import { afterEach, expect, test, vi } from 'vitest'; -import { - localRuntimeOwner, - type ScreenRecordingCompletion, - type ScreenRecordingLiveHandle, -} from '@agent-device/contracts/platform'; +import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime'; +import type { + ScreenRecordingCompletion, + ScreenRecordingLiveHandle, +} from '@agent-device/contracts/screen-recording-runtime'; import { createDurableResourceEnvelope } from '@agent-device/capture-kit'; import { mkdtempForTestSync } from '../../__tests__/test-utils/tmp-dir.ts'; import { screenRecordingResourceStore } from '../screen-recording-resource-store.ts'; diff --git a/src/daemon/session-event-action-presentation.ts b/src/daemon/session-event-action-presentation.ts index b3cd278d78..eb4c956145 100644 --- a/src/daemon/session-event-action-presentation.ts +++ b/src/daemon/session-event-action-presentation.ts @@ -1,6 +1,7 @@ import type { SessionAction } from '@agent-device/contracts/session'; import { DEVICE_ROTATIONS } from '@agent-device/contracts/device'; -import { BACK_MODES, TV_REMOTE_BUTTONS } from '@agent-device/contracts/interaction'; +import { BACK_MODES } from '@agent-device/contracts/back-mode'; +import { TV_REMOTE_BUTTONS } from '@agent-device/contracts/tv-remote'; import { PUBLIC_COMMANDS } from '../command-catalog.ts'; import { isKeyboardAction } from '../utils/keyboard-actions.ts'; import { diff --git a/src/daemon/session-event-action.ts b/src/daemon/session-event-action.ts index fec09b5707..b9a64e28e7 100644 --- a/src/daemon/session-event-action.ts +++ b/src/daemon/session-event-action.ts @@ -1,4 +1,6 @@ -import { BACK_MODES, CLICK_BUTTONS, SWIPE_PATTERNS } from '@agent-device/contracts/interaction'; +import { BACK_MODES } from '@agent-device/contracts/back-mode'; +import { CLICK_BUTTONS } from '@agent-device/contracts/click-button'; +import { SWIPE_PATTERNS } from '@agent-device/contracts/scroll-gesture'; import { RECORDING_SCOPE_VALUES } from '@agent-device/contracts/recording'; import { SESSION_SURFACES, type SessionAction } from '@agent-device/contracts/session'; import { DEVICE_TARGETS, PLATFORM_SELECTORS, PUBLIC_PLATFORMS } from '@agent-device/kernel/device'; diff --git a/src/daemon/session-script-active-publication.ts b/src/daemon/session-script-active-publication.ts index 34051cbc9e..303d457c68 100644 --- a/src/daemon/session-script-active-publication.ts +++ b/src/daemon/session-script-active-publication.ts @@ -3,7 +3,7 @@ import { resolveCommandRecordingEffect } from '../core/command-descriptor/regist import { parseWaitPositionals } from '../core/wait-positionals.ts'; import { AppError } from '@agent-device/kernel/errors'; import { isTouchTargetCommand } from '@agent-device/ad-script'; -import { dragGesturePayloadFromPositionals } from '@agent-device/contracts/interaction'; +import { dragGesturePayloadFromPositionals } from '@agent-device/contracts/gesture-normalization'; import { isValidSelectorExpression } from '@agent-device/selectors'; export function validateActivePublicationActions(actions: SessionAction[]): void { diff --git a/src/daemon/session-script-writer.ts b/src/daemon/session-script-writer.ts index ea5022693d..1eb5bbbf3f 100644 --- a/src/daemon/session-script-writer.ts +++ b/src/daemon/session-script-writer.ts @@ -2,7 +2,7 @@ import type { SessionAction } from '@agent-device/contracts/session'; import fs from 'node:fs'; import path from 'node:path'; import { publicPlatformString } from '@agent-device/kernel/device'; -import { dragGesturePayloadFromPositionals } from '@agent-device/contracts/interaction'; +import { dragGesturePayloadFromPositionals } from '@agent-device/contracts/gesture-normalization'; import { inferFillText } from './action-utils.ts'; import { emitDiagnostic } from '../utils/diagnostics.ts'; import { AppError } from '@agent-device/kernel/errors'; diff --git a/src/daemon/snapshot-runtime-binding.ts b/src/daemon/snapshot-runtime-binding.ts index 041cb32a03..aa3ad8ecf6 100644 --- a/src/daemon/snapshot-runtime-binding.ts +++ b/src/daemon/snapshot-runtime-binding.ts @@ -1,12 +1,14 @@ +import type { RuntimeOperationFact } from '@agent-device/contracts/platform-runtime'; import { - resolveSnapshotRuntimePlan, - type CaptureSnapshotInput, - type RuntimeOperationFact, type SelectorCaptureRuntimePlan, - type SnapshotResult, - type SnapshotRuntimeOperations, type SnapshotRuntimePlan, -} from '@agent-device/contracts/platform'; + resolveSnapshotRuntimePlan, +} from '@agent-device/contracts/platform-runtime-operations'; +import type { + CaptureSnapshotInput, + SnapshotResult, + SnapshotRuntimeOperations, +} from '@agent-device/contracts/snapshot-runtime'; import { buildIosOpenCommandHint } from './ios-app-session-hint.ts'; import { buildRuntimeCaptureInput } from './snapshot-runtime-capture-input.ts'; import type { BindDeviceRuntime, InspectDeviceRuntimeFacts } from './request-runtime-binding.ts'; diff --git a/src/daemon/snapshot-runtime.ts b/src/daemon/snapshot-runtime.ts index c12a26d8af..574191d5ca 100644 --- a/src/daemon/snapshot-runtime.ts +++ b/src/daemon/snapshot-runtime.ts @@ -1,4 +1,4 @@ -import { stripAndroidSystemChromeProvenance } from '@agent-device/contracts/platform'; +import { stripAndroidSystemChromeProvenance } from '@agent-device/contracts/android-system-chrome'; import { copySnapshotClickabilityEvidence } from '@agent-device/contracts/capture'; import { dispatchSnapshotRuntimeCommand } from './snapshot-command-runtime.ts'; import { captureSparseFallbackScreenshot } from './sparse-fallback-screenshot.ts'; diff --git a/src/daemon/snapshot-state.ts b/src/daemon/snapshot-state.ts index b0eef02863..9d5e14ed7d 100644 --- a/src/daemon/snapshot-state.ts +++ b/src/daemon/snapshot-state.ts @@ -1,6 +1,6 @@ import type { CommandFlags } from '@agent-device/contracts/command'; import { snapshotCaptureAnnotationsFrom } from '@agent-device/contracts/capture'; -import { isAndroidInputMethodNode } from '@agent-device/contracts/platform'; +import { isAndroidInputMethodNode } from '@agent-device/contracts/android-input-ownership'; import { attachRefs, buildSnapshotPresentationKey, diff --git a/src/daemon/touch-reference-frame.ts b/src/daemon/touch-reference-frame.ts index eed4c8fb27..949e5564e2 100644 --- a/src/daemon/touch-reference-frame.ts +++ b/src/daemon/touch-reference-frame.ts @@ -1,7 +1,7 @@ import { - inferGestureReferenceFrame, type GestureReferenceFrame, -} from '@agent-device/contracts/interaction'; + inferGestureReferenceFrame, +} from '@agent-device/contracts/scroll-gesture'; import type { SnapshotState } from '@agent-device/kernel/snapshot'; export type TouchReferenceFrame = GestureReferenceFrame; diff --git a/src/daemon/type-text-runtime.ts b/src/daemon/type-text-runtime.ts index e34ef8c143..d1caf430ff 100644 --- a/src/daemon/type-text-runtime.ts +++ b/src/daemon/type-text-runtime.ts @@ -1,8 +1,8 @@ -import { - typeTextRuntimeUse, - type TypeTextInput, - type TypeTextRuntimeOperations, -} from '@agent-device/contracts/platform'; +import { typeTextRuntimeUse } from '@agent-device/contracts/platform-runtime-operations'; +import type { + TypeTextInput, + TypeTextRuntimeOperations, +} from '@agent-device/contracts/type-text-runtime'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { AppError } from '@agent-device/kernel/errors'; import { successText } from '../utils/success-text.ts'; diff --git a/src/daemon/viewport-runtime.ts b/src/daemon/viewport-runtime.ts index 838d548db9..2c99d977d2 100644 --- a/src/daemon/viewport-runtime.ts +++ b/src/daemon/viewport-runtime.ts @@ -1,5 +1,5 @@ import { readViewportDimensions } from '@agent-device/contracts/capture'; -import { viewportRuntimeUse } from '@agent-device/contracts/platform'; +import { viewportRuntimeUse } from '@agent-device/contracts/platform-runtime-operations'; import type { DeviceInfo } from '@agent-device/kernel/device'; import type { ResolvedGenericExecution } from './request-generic-dispatch.ts'; import { admitRuntimeUse, type RuntimeAdmissionBindings } from './runtime-admission.ts'; diff --git a/src/daemon/wait-current-surface.ts b/src/daemon/wait-current-surface.ts index 1ea7098d6c..9509466712 100644 --- a/src/daemon/wait-current-surface.ts +++ b/src/daemon/wait-current-surface.ts @@ -1,4 +1,4 @@ -import { WAIT_REASONS } from '@agent-device/contracts/interaction'; +import { WAIT_REASONS } from '@agent-device/contracts/wait'; import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import type { DaemonRequest, DaemonResponse, SessionState } from './types.ts'; import { captureSnapshot } from './handlers/snapshot-capture.ts'; diff --git a/src/platform-runtime-device-inventory.test.ts b/src/platform-runtime-device-inventory.test.ts index e0dfaa5765..cf00729aec 100644 --- a/src/platform-runtime-device-inventory.test.ts +++ b/src/platform-runtime-device-inventory.test.ts @@ -3,12 +3,14 @@ import type { ProviderDeviceInventorySource, } from '@agent-device/contracts/device'; import { - createPlatformModuleRegistry, - type DeviceInventoryHost, type DeviceInventorySource, type InventoryPlatformModule, - type PlatformRequestScope, -} from '@agent-device/contracts/platform'; + createPlatformModuleRegistry, +} from '@agent-device/contracts/platform-module'; +import type { + DeviceInventoryHost, + PlatformRequestScope, +} from '@agent-device/contracts/platform-runtime-host'; import { PLATFORMS, type DeviceInfo, type Platform } from '@agent-device/kernel/device'; import { describe, expect, test, vi } from 'vitest'; import { createComposedDeviceInventoryGateways } from './platform-runtime-device-inventory.ts'; diff --git a/src/platform-runtime-device-inventory.ts b/src/platform-runtime-device-inventory.ts index 16ee8381f8..906e88f85c 100644 --- a/src/platform-runtime-device-inventory.ts +++ b/src/platform-runtime-device-inventory.ts @@ -4,17 +4,19 @@ import { projectProviderDeviceInventoryRequest, type ProviderDeviceInventorySource, } from '@agent-device/contracts/device'; -import { - type ComposedDeviceInventoryGateways, - type DeviceInventoryGateway, - type DeviceInventoryHost, - type DeviceInventoryHostFor, - type DeviceInventorySource, - type InventoryPlatformModule, - type PlatformModuleRegistry, - type PlatformRequestScope, - type ProviderAwareDeviceInventoryGateway, -} from '@agent-device/contracts/platform'; +import type { + ComposedDeviceInventoryGateways, + DeviceInventoryGateway, + DeviceInventorySource, + InventoryPlatformModule, + PlatformModuleRegistry, + ProviderAwareDeviceInventoryGateway, +} from '@agent-device/contracts/platform-module'; +import type { + DeviceInventoryHost, + DeviceInventoryHostFor, + PlatformRequestScope, +} from '@agent-device/contracts/platform-runtime-host'; import { isApplePlatform, type DeviceInfo, diff --git a/src/platform-runtime-gateway.fixtures.ts b/src/platform-runtime-gateway.fixtures.ts index 6be191c90d..ea3b4ab901 100644 --- a/src/platform-runtime-gateway.fixtures.ts +++ b/src/platform-runtime-gateway.fixtures.ts @@ -13,8 +13,8 @@ import type { import { applicationLifecycleOperationFacts, availableApplicationLifecycleOperations, - providerRuntimeOwner, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/application-lifecycle-runtime'; +import { providerRuntimeOwner } from '@agent-device/contracts/platform-runtime'; import type { DeviceInfo } from '@agent-device/kernel/device'; import type { LimrunRuntimeDependencies } from '@agent-device/provider-limrun'; import { unavailableDeploymentSnapshotAndShutdownOperationFacts } from './__tests__/test-utils/runtime-operation-facts.ts'; diff --git a/src/platform-runtime-gateway.test.ts b/src/platform-runtime-gateway.test.ts index 5661eea4c4..83915a4444 100644 --- a/src/platform-runtime-gateway.test.ts +++ b/src/platform-runtime-gateway.test.ts @@ -4,14 +4,11 @@ import type { PlatformRuntimeOperations, PlatformRuntimeOwner, } from '@agent-device/contracts/platform'; -import { - applicationLifecycleOperationFacts, - createUnavailablePlatformRuntimeFacts, - localRuntimeOwner, - providerRuntimeOwner, - screenshotRuntimeOperationFacts, - viewportRuntimeOperationFacts, -} from '@agent-device/contracts/platform'; +import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; +import { localRuntimeOwner, providerRuntimeOwner } from '@agent-device/contracts/platform-runtime'; +import { createUnavailablePlatformRuntimeFacts } from '@agent-device/contracts/platform-runtime-unavailable'; +import { screenshotRuntimeOperationFacts } from '@agent-device/contracts/screenshot-runtime'; +import { viewportRuntimeOperationFacts } from '@agent-device/contracts/viewport-runtime'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { createLimrunRuntime } from '@agent-device/provider-limrun'; import { describe, expect, test, vi } from 'vitest'; diff --git a/src/platform-runtime-gateway.ts b/src/platform-runtime-gateway.ts index 76eeaedcf6..a3a2a6e24a 100644 --- a/src/platform-runtime-gateway.ts +++ b/src/platform-runtime-gateway.ts @@ -1,22 +1,26 @@ import type { ProviderDeviceRuntime } from '@agent-device/contracts/device'; +import { applicationLifecycleOperationFacts } from '@agent-device/contracts/application-lifecycle-runtime'; import { - applicationLifecycleOperationFacts, - createUnavailablePlatformRuntimeBinding, - createUnavailablePlatformRuntimeFacts, - providerRuntimeOwner, - runStartupRecoveryFence, - runtimeOwnerKey, - sameRuntimeOwner, type DeviceBinding, type DeviceBindingRequest, type DeviceRuntimeGateway, - type PlatformRuntimeHost, - type PlatformRuntimeModule, - type PlatformRuntimeOperations, - type PlatformRuntimeOwner, - type PlatformRuntimeProviderModule, type RuntimeOwnerRef, -} from '@agent-device/contracts/platform'; + providerRuntimeOwner, + runtimeOwnerKey, + sameRuntimeOwner, +} from '@agent-device/contracts/platform-runtime'; +import type { + PlatformRuntimeHost, + PlatformRuntimeModule, + PlatformRuntimeOperations, + PlatformRuntimeOwner, + PlatformRuntimeProviderModule, +} from '@agent-device/contracts/platform-runtime-operations'; +import { + createUnavailablePlatformRuntimeBinding, + createUnavailablePlatformRuntimeFacts, +} from '@agent-device/contracts/platform-runtime-unavailable'; +import { runStartupRecoveryFence } from '@agent-device/contracts/startup-recovery-fence'; import { deviceIdentity, deviceShape, diff --git a/src/platform-runtime.ts b/src/platform-runtime.ts index a381cb1740..9abd7d4539 100644 --- a/src/platform-runtime.ts +++ b/src/platform-runtime.ts @@ -2,17 +2,21 @@ import type { ProviderDeviceInventorySource, ProviderDeviceRuntime, } from '@agent-device/contracts/device'; +import type { AppLogSessionArtifacts } from '@agent-device/contracts/app-log-runtime'; +import type { + AppStateRuntimeHost, + AppStateRuntimeResult, +} from '@agent-device/contracts/app-state-runtime'; +import type { DeviceShutdownRuntimeDependencies } from '@agent-device/contracts/device-shutdown-runtime'; import { - createPlatformModuleRegistry, - type AppLogSessionArtifacts, - type AppStateRuntimeHost, - type AppStateRuntimeResult, type ComposedDeviceInventoryGateways, - type DeviceRuntimeGateway, - type DeviceShutdownRuntimeDependencies, - type PlatformRuntimeModule, - type PlatformRuntimeOperations, -} from '@agent-device/contracts/platform'; + createPlatformModuleRegistry, +} from '@agent-device/contracts/platform-module'; +import type { DeviceRuntimeGateway } from '@agent-device/contracts/platform-runtime'; +import type { + PlatformRuntimeModule, + PlatformRuntimeOperations, +} from '@agent-device/contracts/platform-runtime-operations'; import { inventoryModule as appleInventoryModule, loadShutdownRuntime as loadAppleShutdownRuntime, diff --git a/src/platforms/android/__tests__/ime-lifecycle-race.test.ts b/src/platforms/android/__tests__/ime-lifecycle-race.test.ts index 05394783c6..837c8da6e6 100644 --- a/src/platforms/android/__tests__/ime-lifecycle-race.test.ts +++ b/src/platforms/android/__tests__/ime-lifecycle-race.test.ts @@ -11,7 +11,7 @@ import { import { resetStartupRecoveryFencesForTests, runStartupRecoveryFence, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/startup-recovery-fence'; const HELPER_SERVICE = 'com.callstack.agentdevice.imehelper/.TestInputMethodService'; const LATIN_IME = 'com.google.android.inputmethod.latin/.LatinIME'; diff --git a/src/platforms/android/__tests__/ime-lifecycle.test.ts b/src/platforms/android/__tests__/ime-lifecycle.test.ts index c9a6c69e1c..132ef0f055 100644 --- a/src/platforms/android/__tests__/ime-lifecycle.test.ts +++ b/src/platforms/android/__tests__/ime-lifecycle.test.ts @@ -48,7 +48,7 @@ import { import { resetStartupRecoveryFencesForTests, runStartupRecoveryFence, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/startup-recovery-fence'; import { readAndroidTestImeRecoveryMarkers, writeAndroidTestImeRecoveryMarker, diff --git a/src/platforms/android/__tests__/input-ownership.test.ts b/src/platforms/android/__tests__/input-ownership.test.ts index 09226767ff..2ccaf3c194 100644 --- a/src/platforms/android/__tests__/input-ownership.test.ts +++ b/src/platforms/android/__tests__/input-ownership.test.ts @@ -5,7 +5,7 @@ import { isAndroidInputMethodNode, parseAndroidInputMethodPackage, readAndroidActiveInputMethodPackage, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/android-input-ownership'; test('classifies raw snapshot nodes through the node-shaped IME predicate', () => { assert.equal( diff --git a/src/platforms/android/__tests__/touch-executor.test.ts b/src/platforms/android/__tests__/touch-executor.test.ts index cfac48b123..bdb54b9aaf 100644 --- a/src/platforms/android/__tests__/touch-executor.test.ts +++ b/src/platforms/android/__tests__/touch-executor.test.ts @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import { ANDROID_EMULATOR } from '../../../__tests__/test-utils/device-fixtures.ts'; -import { buildGesturePlan } from '@agent-device/contracts/interaction'; +import { buildGesturePlan } from '@agent-device/contracts/gesture-plan'; import { withAndroidAdbProvider } from '../adb-executor.ts'; import { executeAndroidTouchPlan, readAndroidGestureViewport } from '../touch-executor.ts'; diff --git a/src/platforms/android/__tests__/touch-helper.fixtures.ts b/src/platforms/android/__tests__/touch-helper.fixtures.ts index a26e4a2a9b..bbf3b05751 100644 --- a/src/platforms/android/__tests__/touch-helper.fixtures.ts +++ b/src/platforms/android/__tests__/touch-helper.fixtures.ts @@ -1,5 +1,5 @@ import { ANDROID_EMULATOR } from '../../../__tests__/test-utils/device-fixtures.ts'; -import { buildGesturePlan } from '@agent-device/contracts/interaction'; +import { buildGesturePlan } from '@agent-device/contracts/gesture-plan'; import type { DeviceInfo } from '@agent-device/kernel/device'; import type { AndroidAdbExecutor } from '../adb-executor.ts'; import type { AndroidLongPressTouchPlan } from '../touch-plan.ts'; diff --git a/src/platforms/android/__tests__/touch-helper.test.ts b/src/platforms/android/__tests__/touch-helper.test.ts index 2a5bd4c2b8..1c1ebd9672 100644 --- a/src/platforms/android/__tests__/touch-helper.test.ts +++ b/src/platforms/android/__tests__/touch-helper.test.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { afterEach, beforeEach, test, vi } from 'vitest'; -import { buildGesturePlan } from '@agent-device/contracts/interaction'; +import { buildGesturePlan } from '@agent-device/contracts/gesture-plan'; import { AppError } from '@agent-device/kernel/errors'; import { withAndroidAdbProvider } from '../adb-executor.ts'; import { resetAndroidSnapshotHelperSessions } from '../snapshot-helper-session.ts'; diff --git a/src/platforms/android/__tests__/touch-plan.test.ts b/src/platforms/android/__tests__/touch-plan.test.ts index 004cf779c0..b511b0b89f 100644 --- a/src/platforms/android/__tests__/touch-plan.test.ts +++ b/src/platforms/android/__tests__/touch-plan.test.ts @@ -1,10 +1,7 @@ import assert from 'node:assert/strict'; import { expectTypeOf, test } from 'vitest'; -import { - buildDragGesturePlan, - buildGesturePlan, - type SinglePointerGesturePlan, -} from '@agent-device/contracts/interaction'; +import { buildDragGesturePlan, buildGesturePlan } from '@agent-device/contracts/gesture-plan'; +import type { SinglePointerGesturePlan } from '@agent-device/contracts/gesture-plan-types'; import { lowerAndroidTouchPlan, type AndroidLoweredTouchPlan } from '../touch-plan.ts'; import { longPressPlan } from './touch-helper.fixtures.ts'; diff --git a/src/platforms/android/alert.ts b/src/platforms/android/alert.ts index f621e8c5b0..0d138908aa 100644 --- a/src/platforms/android/alert.ts +++ b/src/platforms/android/alert.ts @@ -3,7 +3,7 @@ import { ALERT_ACTION_RETRY_MS, ALERT_POLL_INTERVAL_MS, DEFAULT_ALERT_TIMEOUT_MS, -} from '@agent-device/contracts/interaction'; +} from '@agent-device/contracts/alert-contract'; import { AppError } from '@agent-device/kernel/errors'; import { withDiagnosticTimer } from '../../utils/diagnostics.ts'; import { successText } from '../../utils/success-text.ts'; diff --git a/src/platforms/android/device-input-state.ts b/src/platforms/android/device-input-state.ts index cec37ffd6a..362cc8bb66 100644 --- a/src/platforms/android/device-input-state.ts +++ b/src/platforms/android/device-input-state.ts @@ -9,12 +9,12 @@ import { type AndroidAdbExecutor, } from './adb-executor.ts'; import { + type AndroidInputOwner, classifyAndroidInputOwner, isFallbackAndroidInputMethodPackage, isFallbackAndroidInputMethodResource, readAndroidActiveInputMethodPackage, - type AndroidInputOwner, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/android-input-ownership'; const ANDROID_INPUT_TYPE_CLASS_MASK = 0x0000000f; const ANDROID_INPUT_TYPE_CLASS_TEXT = 0x00000001; diff --git a/src/platforms/android/fill-verification.ts b/src/platforms/android/fill-verification.ts index e4d8049c06..f4a6fcd662 100644 --- a/src/platforms/android/fill-verification.ts +++ b/src/platforms/android/fill-verification.ts @@ -11,7 +11,7 @@ import { } from './fill-diagnostics.ts'; import { sleep } from './adb.ts'; import { getAndroidKeyboardState } from './device-input-state.ts'; -import { isAndroidInputMethodOwnedNode } from '@agent-device/contracts/platform'; +import { isAndroidInputMethodOwnedNode } from '@agent-device/contracts/android-input-ownership'; import { captureAndroidUiHierarchyXml } from './snapshot.ts'; import { androidUiNodes, type AndroidUiNodeMetadata } from './ui-hierarchy.ts'; import type { diff --git a/src/platforms/android/ime-lifecycle.ts b/src/platforms/android/ime-lifecycle.ts index bc89d9a672..d5a97cb53e 100644 --- a/src/platforms/android/ime-lifecycle.ts +++ b/src/platforms/android/ime-lifecycle.ts @@ -16,7 +16,7 @@ import { readAndroidTestImeRecoveryMarkers, writeAndroidTestImeRecoveryMarker, } from './ime-recovery-marker.ts'; -import { waitForStartupRecoveryFence } from '@agent-device/contracts/platform'; +import { waitForStartupRecoveryFence } from '@agent-device/contracts/startup-recovery-fence'; // Previous-IME record lives on the device (a custom `settings secure` key), not in a host-side // file, so any daemon/state-dir can recover it. diff --git a/src/platforms/android/input-actions.ts b/src/platforms/android/input-actions.ts index daab592f20..d9eb7a8872 100644 --- a/src/platforms/android/input-actions.ts +++ b/src/platforms/android/input-actions.ts @@ -1,14 +1,13 @@ import { DEVICE_ROTATION_SURFACE_INDEX, type DeviceRotation } from '@agent-device/contracts/device'; +import { buildGesturePlan } from '@agent-device/contracts/gesture-plan'; +import { GESTURE_DURATION_MIN_MS } from '@agent-device/contracts/gesture-plan-types'; +import type { FillUnconfirmedVerification } from '@agent-device/contracts/interactor-types'; +import { DEFAULT_MOBILE_SCROLL_DURATION_MS } from '@agent-device/contracts/scroll-command'; import { - buildGesturePlan, - buildScrollGesturePlan, - DEFAULT_MOBILE_SCROLL_DURATION_MS, - GESTURE_DURATION_MIN_MS, - toAndroidTvRemoteKeyevent, - type FillUnconfirmedVerification, type ScrollDirection, - type TvRemoteButton, -} from '@agent-device/contracts/interaction'; + buildScrollGesturePlan, +} from '@agent-device/contracts/scroll-gesture'; +import { type TvRemoteButton, toAndroidTvRemoteKeyevent } from '@agent-device/contracts/tv-remote'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { AppError } from '@agent-device/kernel/errors'; import { emitDiagnostic } from '../../utils/diagnostics.ts'; diff --git a/src/platforms/android/snapshot-content-recovery.ts b/src/platforms/android/snapshot-content-recovery.ts index 93f19d69ee..9adbf3fdb2 100644 --- a/src/platforms/android/snapshot-content-recovery.ts +++ b/src/platforms/android/snapshot-content-recovery.ts @@ -1,8 +1,6 @@ -import { - hasAndroidSystemChromeProvenance, - isAndroidInputMethodOwnedNode, - type AndroidContentRecoveryReason, -} from '@agent-device/contracts/platform'; +import { isAndroidInputMethodOwnedNode } from '@agent-device/contracts/android-input-ownership'; +import type { AndroidContentRecoveryReason } from '@agent-device/contracts/android-snapshot-quality'; +import { hasAndroidSystemChromeProvenance } from '@agent-device/contracts/android-system-chrome'; import { classifyAndroidAlertIdentifier } from './alert-detection.ts'; import type { AndroidSnapshotBackendMetadata } from './snapshot-types.ts'; import { androidUiNodes, type AndroidUiNodeMetadata } from './ui-hierarchy.ts'; diff --git a/src/platforms/android/touch-plan.ts b/src/platforms/android/touch-plan.ts index 3321e2b65e..20a6214259 100644 --- a/src/platforms/android/touch-plan.ts +++ b/src/platforms/android/touch-plan.ts @@ -1,12 +1,14 @@ import { interpolateGesturePoint, sampleGestureOffsets, - type GesturePlan, - type MultiTouchGesturePlan, - type PointerTrajectory, - type PointerTrajectorySample, - type SinglePointerGesturePlan, -} from '@agent-device/contracts/interaction'; +} from '@agent-device/contracts/gesture-plan'; +import type { + GesturePlan, + MultiTouchGesturePlan, + PointerTrajectory, + PointerTrajectorySample, + SinglePointerGesturePlan, +} from '@agent-device/contracts/gesture-plan-types'; import type { Rect } from '@agent-device/kernel/snapshot'; export type AndroidLongPressTouchPlan = { diff --git a/src/platforms/android/ui-hierarchy.ts b/src/platforms/android/ui-hierarchy.ts index 020b106f50..4b38767f47 100644 --- a/src/platforms/android/ui-hierarchy.ts +++ b/src/platforms/android/ui-hierarchy.ts @@ -15,7 +15,7 @@ export type { AndroidUiHierarchy } from './ui-hierarchy-node.ts'; import { type AndroidSystemChromeProvenance, isAndroidSystemChromeWindowResourceId, -} from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/android-system-chrome'; type AndroidRawSnapshotNode = RawSnapshotNode & AndroidSystemChromeProvenance; diff --git a/src/platforms/apple/core/__tests__/interactions.test.ts b/src/platforms/apple/core/__tests__/interactions.test.ts index 9a05e78d02..c155d95f3c 100644 --- a/src/platforms/apple/core/__tests__/interactions.test.ts +++ b/src/platforms/apple/core/__tests__/interactions.test.ts @@ -5,7 +5,8 @@ import path from 'node:path'; import { iosRunnerOverrides, performGestureApple } from '../../interactions.ts'; import { runAppleRunnerCommand } from '../runner/runner-client.ts'; import { AppError } from '@agent-device/kernel/errors'; -import { TEXT_ENTRY_ROUTES, type GesturePlan } from '@agent-device/contracts/interaction'; +import type { GesturePlan } from '@agent-device/contracts/gesture-plan-types'; +import { TEXT_ENTRY_ROUTES } from '@agent-device/contracts/interactor-types'; import { requireGestureSupported } from '../../../../core/capabilities.ts'; import { IOS_TEST_DEVICE, diff --git a/src/platforms/apple/core/scroll.ts b/src/platforms/apple/core/scroll.ts index a8aabe7152..daeb70dd49 100644 --- a/src/platforms/apple/core/scroll.ts +++ b/src/platforms/apple/core/scroll.ts @@ -1,11 +1,13 @@ import { - buildScrollGesturePlan, DEFAULT_IOS_SCROLL_AMOUNT, DEFAULT_IOS_SCROLL_DURATION_MS, - type ScrollDirection, type ScrollExecutionOptions, type ScrollReleaseBehavior, -} from '@agent-device/contracts/interaction'; +} from '@agent-device/contracts/scroll-command'; +import { + type ScrollDirection, + buildScrollGesturePlan, +} from '@agent-device/contracts/scroll-gesture'; export type NormalizedScrollOptions = { amount?: number; diff --git a/src/platforms/apple/interactions.ts b/src/platforms/apple/interactions.ts index bd0d26db19..0afa3e46cb 100644 --- a/src/platforms/apple/interactions.ts +++ b/src/platforms/apple/interactions.ts @@ -1,19 +1,23 @@ +import type { BackMode } from '@agent-device/contracts/back-mode'; +import { singlePointerPlanEndpoints } from '@agent-device/contracts/gesture-plan'; +import type { GesturePlan } from '@agent-device/contracts/gesture-plan-types'; import { - assertScrollGestureInput, - normalizeScrollDurationMs, - SCROLL_DURATION_MAX_MS, - singlePointerPlanEndpoints, - TEXT_ENTRY_ROUTES, - type BackMode, - type GesturePlan, type Interactor, type RunnerCallOptions, type RunnerContext, - type ScrollDirection, + TEXT_ENTRY_ROUTES, type TextEntryRoute, type TypeTextBackendResult, -} from '@agent-device/contracts/interaction'; -import { assertAppleMultiTouchSupported } from '@agent-device/contracts/platform'; +} from '@agent-device/contracts/interactor-types'; +import { + SCROLL_DURATION_MAX_MS, + normalizeScrollDurationMs, +} from '@agent-device/contracts/scroll-command'; +import { + type ScrollDirection, + assertScrollGestureInput, +} from '@agent-device/contracts/scroll-gesture'; +import { assertAppleMultiTouchSupported } from '@agent-device/contracts/apple-multitouch-support'; import { isIosFamily, isMacOs, isTvOsDevice, type DeviceInfo } from '@agent-device/kernel/device'; import { AppError } from '@agent-device/kernel/errors'; import { runAppleRunnerCommand } from './core/runner/runner-client.ts'; diff --git a/src/platforms/apple/interactor.ts b/src/platforms/apple/interactor.ts index 62b44ef151..fe293f2d80 100644 --- a/src/platforms/apple/interactor.ts +++ b/src/platforms/apple/interactor.ts @@ -18,7 +18,7 @@ import { type AppleRunnerCommandExecutor, type AppleRunnerProvider, } from './core/runner/runner-provider.ts'; -import { toAppleTvRemoteButton } from '@agent-device/contracts/interaction'; +import { toAppleTvRemoteButton } from '@agent-device/contracts/tv-remote'; import type { SessionSurface } from '@agent-device/contracts/session'; import { DEVICE_ROTATIONS, type DeviceRotation } from '@agent-device/contracts/device'; import { normalizeSnapshotScope } from '@agent-device/contracts/snapshot'; diff --git a/src/platforms/apple/plugin.ts b/src/platforms/apple/plugin.ts index a77c4704ca..d992087ecf 100644 --- a/src/platforms/apple/plugin.ts +++ b/src/platforms/apple/plugin.ts @@ -1,7 +1,7 @@ import { appleOsCapabilities } from './capabilities.ts'; import type { PlatformPlugin } from '@agent-device/contracts/platform'; import { PUBLIC_COMMANDS } from '../../command-catalog.ts'; -import { isAudioProbeSupportedDevice } from '@agent-device/contracts/platform'; +import { isAudioProbeSupportedDevice } from '@agent-device/contracts/audio-probe-support'; import { isTvOsDevice, resolveDeviceAppleOs, type DeviceInfo } from '@agent-device/kernel/device'; import type { RunnerContext } from '@agent-device/contracts/interaction'; diff --git a/src/platforms/audio-probe-backend.ts b/src/platforms/audio-probe-backend.ts index b105a587c2..e34ae8daee 100644 --- a/src/platforms/audio-probe-backend.ts +++ b/src/platforms/audio-probe-backend.ts @@ -1,5 +1,5 @@ import type { AudioProbeSource } from '@agent-device/contracts/platform'; -import { isHostSystemAudioProbeDevice } from '@agent-device/contracts/platform'; +import { isHostSystemAudioProbeDevice } from '@agent-device/contracts/audio-probe-support'; import type { DeviceInfo } from '@agent-device/kernel/device'; import type { ExecBackgroundResult } from '../utils/exec.ts'; diff --git a/src/platforms/harmonyos/input-actions.ts b/src/platforms/harmonyos/input-actions.ts index 1be441bef8..38e235aff2 100644 --- a/src/platforms/harmonyos/input-actions.ts +++ b/src/platforms/harmonyos/input-actions.ts @@ -1,10 +1,10 @@ import type { DeviceRotation } from '@agent-device/contracts/device'; +import type { GesturePlan } from '@agent-device/contracts/gesture-plan-types'; +import { DEFAULT_MOBILE_SCROLL_DURATION_MS } from '@agent-device/contracts/scroll-command'; import { - buildScrollGesturePlan, - DEFAULT_MOBILE_SCROLL_DURATION_MS, - type GesturePlan, type ScrollDirection, -} from '@agent-device/contracts/interaction'; + buildScrollGesturePlan, +} from '@agent-device/contracts/scroll-gesture'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { AppError } from '@agent-device/kernel/errors'; import { sleep } from '../../utils/timeouts.ts'; diff --git a/src/platforms/vega/input-actions.ts b/src/platforms/vega/input-actions.ts index 6dec8dc144..92937f2829 100644 --- a/src/platforms/vega/input-actions.ts +++ b/src/platforms/vega/input-actions.ts @@ -1,4 +1,4 @@ -import { toVegaTvRemoteKey, type TvRemoteButton } from '@agent-device/contracts/interaction'; +import { type TvRemoteButton, toVegaTvRemoteKey } from '@agent-device/contracts/tv-remote'; import type { DeviceInfo } from '@agent-device/kernel/device'; import { requireExecSuccess } from '../../utils/exec.ts'; import { resolveVegaToolProvider } from './tool-provider.ts'; diff --git a/src/platforms/web/agent-browser-audio-probe.ts b/src/platforms/web/agent-browser-audio-probe.ts index 5eaf7fa7ea..f1cbeedb0c 100644 --- a/src/platforms/web/agent-browser-audio-probe.ts +++ b/src/platforms/web/agent-browser-audio-probe.ts @@ -1,4 +1,7 @@ -import { normalizeAudioProbeRecord, type AudioProbeResult } from '@agent-device/contracts/platform'; +import { + type AudioProbeResult, + normalizeAudioProbeRecord, +} from '@agent-device/contracts/audio-probe-result'; import { isJsonObject, type JsonObject } from './json-utils.ts'; import type { WebAudioProbeOptions, WebAudioProbeResult } from './provider.ts'; From 391f299069d054d18264846d5e2f998d3735e52e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Sat, 22 Aug 2026 14:45:33 +0200 Subject: [PATCH 2/2] test(contracts): text-filter the facade scan before parsing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The repo-wide scan parsed all ~3000 sources, which the coverage lane's instrumentation pushed past both the 5s test timeout and the 2.5s slow-test budget. A file that never names the specifier cannot import it, so filter on the text first and parse only the ~490 candidates. Non-vacuity moves with it: instead of counting narrow imports across every file, require that the surviving type-only importers were seen and classified as erased — which an empty scan cannot satisfy. --- src/__tests__/contracts-entry-closure.test.ts | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/__tests__/contracts-entry-closure.test.ts b/src/__tests__/contracts-entry-closure.test.ts index 3805c5a771..4e4fce3868 100644 --- a/src/__tests__/contracts-entry-closure.test.ts +++ b/src/__tests__/contracts-entry-closure.test.ts @@ -72,20 +72,23 @@ test('the hubs behind the contracts clump never evaluate either wide facade', () test('no source file value-imports the wide contracts facades', () => { const offenders: string[] = []; - let narrowEntryImports = 0; + let typeOnlyImporters = 0; for (const file of sourceFiles()) { - for (const specifier of eagerlyEvaluatedModules(file, fs.readFileSync(file, 'utf8'))) { - if (CLUMP_ENTRIES.includes(specifier as (typeof CLUMP_ENTRIES)[number])) { - offenders.push(`${path.relative(repoRoot, file)} -> ${specifier}`); - } else if (specifier.startsWith('@agent-device/contracts/')) { - narrowEntryImports += 1; - } + const source = fs.readFileSync(file, 'utf8'); + // Text-filter before parsing: a file that never names the specifier cannot import + // it, and parsing all ~3000 sources costs more than the unit lane's budget allows. + const mentions = CLUMP_ENTRIES.filter((entry) => source.includes(`${entry}'`)); + if (mentions.length === 0) continue; + const evaluated = new Set(eagerlyEvaluatedModules(file, source)); + for (const entry of mentions) { + if (evaluated.has(entry)) offenders.push(`${path.relative(repoRoot, file)} -> ${entry}`); + else typeOnlyImporters += 1; } } - // Non-vacuity: a walker that returned nothing would pass the assertion below while - // proving nothing, so require that it still sees the narrow imports that replaced these. - expect(narrowEntryImports).toBeGreaterThan(100); + // Non-vacuity: an empty offender list also describes a scan that parsed nothing, so + // require that the surviving type-only importers were seen and classified as erased. + expect(typeOnlyImporters).toBeGreaterThan(300); expect( offenders.sort(), 'Value-importing these facades evaluates every module they re-export from. Each of those ' +