From 76453add718e062020e8fcd8548409786ee66023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 30 Jul 2026 12:12:46 +0200 Subject: [PATCH] refactor: pnpm workspace + @agent-device/kernel pilot (#1490 W0) (#1494) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: pnpm workspace + @agent-device/kernel pilot (#1490 W0) Extend the workspace with packages/* and move the kernel behind an enforced public API: packages/kernel with nine consumer-earned subpath exports (errors, device, snapshot, contracts, collections, rect, redaction, daemon-error, bounds — the last absorbed from utils as Rect vocabulary). Every kernel import repo-wide becomes the @agent-device/kernel/ specifier; kernel tests move to src/__tests__/kernel/ and exercise the package surface. The root declares the package in devDependencies (workspace:*), tsdown bundles it (noExternal) so the published artifact and its runtime dependency manifest are unchanged. Gate rewiring in the same change, per the W0 brief: - R1 kernel-sink retires (physically subsumed); new R11 package-boundaries guards no-root-back-imports, relative tunnelling past exports maps, undeclared workspace deps, and non-exported subpaths, with runtime resolution pins via import.meta.resolve. - resolveImportEdges and mutation ownership follow workspace specifiers through exports maps, keeping R4 cycle checks, depgraph, and derived test ownership connected across the seam (kernel-errors still owns 495 tests). listSourceFiles includes packages/*/src. - kernel becomes an unranked zone; mutation registry, stryker mutate globs, and the mutation-affected workflow path filter move to packages/kernel/src/errors.ts. - check:affected gains packages/ ownership (manifests fail open); vitest and coverage include packages/*/src; fallow ignores packages/** (its resolver cannot follow workspace specifiers). - The affected-selector CI job installs dependencies: its closure now crosses workspace specifiers, and the R8 relative exception is unsafe for production src files (Node ESM does not realpath, so dual specifier/relative loads would instantiate modules twice). The R8 zero-dep set is pinned empty with that rationale. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01FUv7bvbWNryuXgSBuqTtep * fix: address W0 review — mutation sandbox, exports-map resolution, tsc -b Review findings on #1494, all five: 1. contracts-schema-public.test.ts reads the kernel source at its packages/ path (fs access invisible to the codemod and typecheck). 2. Mutation lane: Stryker sandboxes the tree but pnpm's node_modules symlink resolves @agent-device/* back to the real repo, so mutants in the sandbox never load and vitest.related finds no tests. vitest.mutation.config.ts now aliases each EXPORTED specifier to its source (derived from exports maps, never a wildcard), keeping resolution inside the mutated tree. Validated: kernel-errors module runs end to end (dry run 3,984 tests, mutants killed, exit 0). 3. Layering/depgraph resolve workspace specifiers through the exports-derived map (workspaceSpecifierTargets) instead of reconstructing paths, so '.'-facade packages resolve; the positional fallback remains only for map-less fixtures (P0 pin). 4. Per-package project references implemented: packages/kernel is composite (emitDeclarationOnly -> dist-types, gitignored), the root references it, and typecheck becomes tsc -b — probed to catch type errors on both sides under TypeScript 7 native. 5. R11's relative-route exception now requires membership in an actual R8 zero-dep job closure (zeroDepClosureFiles walks entries), not mere scripts/ placement — closing the dual-instantiation bypass. Also from review discussion: daemon-error moves out of the kernel package to src/client/ — its consumers (cli, client facade) rehydrate wire DaemonErrors client-side; the daemon only produces them. Kernel drops to 8 exported subpaths before any of them ship. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01FUv7bvbWNryuXgSBuqTtep * refactor: one exports-map reader for mutation alias and ownership Fallow flagged workspaceExportAliases (cognitive 15, CRAP 90). The manifest-reading logic already exists as workspaceSpecifierTargets in scripts/layering/package-boundaries.ts, so both the Stryker sandbox alias table and the mutation ownership walker now consume it instead of carrying near-clones. Behavior unchanged; mutation suite 45/45 and changed-code fallow green. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01FUv7bvbWNryuXgSBuqTtep * fix: composite kernel without a root references edge FreeRange runs plain `tsc -p tsconfig.json`, and a root `references` entry makes non-build-mode TypeScript demand the referenced project's built declarations (TS6305) — a standing "build first" tax on every plain -p consumer (fr, editors). Keep the per-package composite project and build it in typecheck (`tsc -b packages/kernel` before the root and examples/sdk passes), but drop the root references edge: root consumption resolves through exports to source, identical to runtime and to the bundler. Probed: plain -p green with no prebuilt output; kernel-side type errors still caught by its own build. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01FUv7bvbWNryuXgSBuqTtep * fix: R11 uses the layering parser; mutation config is a fallow entry Review blockers on #1494: - R11's private single-quote regex could miss a double-quoted or re-export route into packages/*/src. specifierSites now delegates to the layering model's parseImports (both quote styles, side-effect imports, re-exports, dynamic imports), with direct regressions for each formerly-invisible form. - vitest.mutation.config.ts becomes a declared fallow entry instead of a tolerated unused-file finding: the full-repo audit now reports it reachable (unused files 2 -> 1; the remainder predates this PR). FreeRange clean-checkout evidence: with packages/kernel/dist-types and every *.tsbuildinfo deleted, `pnpm check:freerange` reports 0 findings on this head — the TS6305 topology died with the root references edge in the previous commit; check:freerange has no build precondition. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01FUv7bvbWNryuXgSBuqTtep --------- Co-authored-by: Claude --- .fallowrc.json | 2 + .github/workflows/ci.yml | 12 +- .github/workflows/mutation-affected.yml | 2 +- .gitignore | 4 + AGENTS.md | 6 +- CONTEXT.md | 4 +- docs/agents/testing.md | 3 +- package.json | 5 +- packages/kernel/package.json | 41 +++ {src/utils => packages/kernel/src}/bounds.ts | 2 +- .../kernel/src}/collections.ts | 0 .../kernel/src}/contracts.ts | 0 {src/kernel => packages/kernel/src}/device.ts | 0 {src/kernel => packages/kernel/src}/errors.ts | 0 {src/kernel => packages/kernel/src}/rect.ts | 0 .../kernel/src}/redaction.ts | 0 .../kernel/src}/snapshot.ts | 0 packages/kernel/tsconfig.json | 12 + pnpm-lock.yaml | 5 + pnpm-workspace.yaml | 1 + ...onformance-error-recovery-coverage.test.ts | 2 +- .../help-conformance-sample-producers.ts | 2 +- scripts/check-affected/model.test.ts | 21 ++ scripts/check-affected/model.ts | 37 +- scripts/depgraph/load.ts | 3 +- scripts/depgraph/model.test.ts | 12 +- scripts/fuzz/invariant.ts | 2 +- scripts/fuzz/self-check-targets.ts | 2 +- scripts/layering/check.ts | 53 ++- scripts/layering/model.test.ts | 17 +- scripts/layering/model.ts | 35 +- scripts/layering/package-boundaries.test.ts | 202 +++++++++++ scripts/layering/package-boundaries.ts | 322 ++++++++++++++++++ scripts/layering/zero-dep-jobs.ts | 35 +- scripts/layering/zone-policy.test.ts | 51 +-- scripts/layering/zone-policy.ts | 23 +- scripts/maestro-conformance/verify.ts | 2 +- scripts/mutation/envelope.test.ts | 10 +- scripts/mutation/modules.test.ts | 8 +- scripts/mutation/modules.ts | 4 +- scripts/mutation/ownership.test.ts | 13 +- scripts/mutation/ownership.ts | 28 +- scripts/mutation/ratchet.test.ts | 4 +- scripts/mutation/test-scope.test.ts | 2 +- src/__tests__/cli-client-commands.test.ts | 2 +- src/__tests__/cli-close.test.ts | 2 +- src/__tests__/client-metro.test.ts | 2 +- src/__tests__/client-normalizers.test.ts | 2 +- src/__tests__/client.test.ts | 8 +- src/__tests__/contracts-schema-public.test.ts | 4 +- src/__tests__/daemon-client-progress.test.ts | 2 +- src/__tests__/daemon-error.test.ts | 6 +- src/__tests__/finders-public.test.ts | 2 +- .../kernel}/errors-code-policy.test.ts | 2 +- .../kernel}/errors-message.test.ts | 2 +- .../kernel}/errors-metadata.test.ts | 2 +- .../kernel}/platform-collapse-parity.test.ts | 4 +- .../kernel}/snapshot-ref-grammar.test.ts | 4 +- src/__tests__/limrun-runtime.test.ts | 2 +- src/__tests__/provider-device-runtime.test.ts | 2 +- src/__tests__/remote-connection.test.ts | 2 +- src/__tests__/selectors-public.test.ts | 2 +- .../android-ui-hierarchy-fixtures.ts | 2 +- src/__tests__/test-utils/device-fixtures.ts | 2 +- src/__tests__/test-utils/mocked-binaries.ts | 2 +- .../test-utils/property-arbitraries.ts | 2 +- src/__tests__/test-utils/snapshot-builders.ts | 6 +- src/agent-device-client.ts | 6 +- src/backend.ts | 11 +- src/cli-schema/cli-config.ts | 2 +- src/cli-schema/command-schema.ts | 2 +- src/cli-schema/option-schema.test.ts | 2 +- src/cli.ts | 6 +- src/cli/__tests__/auth-session.test.ts | 2 +- src/cli/auth-session.ts | 2 +- src/cli/batch-steps.ts | 4 +- src/cli/cloud-response.ts | 2 +- src/cli/commands/__tests__/generic.test.ts | 2 +- src/cli/commands/__tests__/screenshot.test.ts | 2 +- src/cli/commands/agent-cdp.ts | 4 +- src/cli/commands/auth.ts | 2 +- src/cli/commands/connection-runtime.ts | 6 +- src/cli/commands/connection.ts | 4 +- src/cli/commands/daemon.ts | 2 +- src/cli/commands/device.ts | 2 +- src/cli/commands/generic.ts | 2 +- src/cli/commands/proxy.ts | 2 +- src/cli/commands/react-devtools.ts | 2 +- src/cli/commands/replay.ts | 2 +- src/cli/commands/screenshot.ts | 4 +- src/cli/commands/web.ts | 2 +- src/cli/connection/cloud-profile.ts | 2 +- src/cli/connection/cloud-webdriver-profile.ts | 4 +- src/cli/connection/generated-config.ts | 2 +- src/cli/connection/limrun-profile.ts | 2 +- src/cli/connection/proxy-profile.ts | 2 +- .../__tests__/args-parse-interaction.test.ts | 2 +- .../parser/__tests__/args-validation.test.ts | 2 +- .../__tests__/cli-help-command-usage.test.ts | 2 +- .../__tests__/command-suggestions.test.ts | 2 +- src/cli/parser/args.ts | 2 +- src/client/client-normalizers.ts | 6 +- src/client/client-types.ts | 2 +- src/{kernel => client}/daemon-error.ts | 4 +- src/cloud-webdriver/aws-device-farm.ts | 2 +- src/cloud-webdriver/browserstack.ts | 2 +- src/cloud-webdriver/provider-definitions.ts | 4 +- src/cloud-webdriver/runtime.ts | 6 +- src/cloud-webdriver/webdriver-client.ts | 2 +- src/cloud-webdriver/webdriver-interactor.ts | 2 +- src/cloud-webdriver/webdriver-scroll-frame.ts | 2 +- src/cloud-webdriver/webdriver-source.ts | 6 +- src/commands/batch/metadata.ts | 4 +- src/commands/batch/projection.ts | 2 +- src/commands/batch/public.test.ts | 2 +- src/commands/capture/alert.ts | 2 +- src/commands/capture/diff.ts | 2 +- src/commands/capture/output.test.ts | 2 +- .../capture/runtime/diff-screenshot.ts | 2 +- src/commands/capture/runtime/screenshot.ts | 2 +- .../runtime/snapshot-unchanged.test.ts | 2 +- .../capture/runtime/snapshot-unchanged.ts | 2 +- src/commands/capture/runtime/snapshot.ts | 4 +- src/commands/capture/settings.ts | 2 +- src/commands/capture/wait.ts | 2 +- src/commands/cli-grammar/common.ts | 2 +- .../cli-grammar/flag-definitions-action.ts | 2 +- .../cli-grammar/flag-definitions-target.ts | 2 +- .../cli-grammar/flag-registry.test.ts | 2 +- src/commands/command-input.ts | 4 +- src/commands/command-projection.ts | 2 +- src/commands/debugging/index.ts | 2 +- src/commands/interaction/interactions.test.ts | 2 +- src/commands/interaction/interactions.ts | 2 +- .../runtime/__tests__/test-utils/index.ts | 2 +- .../interaction/runtime/gesture-command.ts | 4 +- .../interaction/runtime/gestures.test.ts | 2 +- src/commands/interaction/runtime/gestures.ts | 4 +- .../interaction/runtime/interactions.test.ts | 2 +- .../interaction/runtime/interactions.ts | 4 +- .../runtime/post-action-observation.ts | 2 +- .../interaction/runtime/resolution.test.ts | 2 +- .../interaction/runtime/resolution.ts | 6 +- .../runtime/selector-read-shared.ts | 6 +- .../interaction/runtime/selector-read.test.ts | 2 +- .../interaction/runtime/selector-read.ts | 6 +- .../interaction/runtime/settle.test.ts | 2 +- src/commands/interaction/runtime/settle.ts | 2 +- .../interaction/runtime/stable-capture.ts | 2 +- src/commands/interaction/runtime/viewport.ts | 4 +- src/commands/interaction/selectors.ts | 2 +- src/commands/io-policy.ts | 2 +- src/commands/management/app.test.ts | 2 +- src/commands/management/install.ts | 4 +- src/commands/management/runtime/admin.ts | 2 +- src/commands/management/runtime/apps.ts | 2 +- src/commands/management/session.test.ts | 2 +- src/commands/management/session.ts | 2 +- src/commands/metro/index.ts | 2 +- src/commands/metro/prepare-kind.ts | 2 +- src/commands/observability/index.ts | 4 +- src/commands/observability/output.ts | 2 +- .../observability/runtime/diagnostics.ts | 2 +- src/commands/perf/index.ts | 2 +- src/commands/react-native/index.ts | 2 +- src/commands/recording/index.ts | 2 +- src/commands/recording/runtime/recording.ts | 2 +- src/commands/runtime-hints.ts | 2 +- src/commands/system/index.ts | 2 +- src/commands/system/runtime/system.ts | 2 +- src/commands/text.ts | 2 +- src/compat/__tests__/replay-input.test.ts | 2 +- .../__tests__/daemon-runtime-port-fixtures.ts | 2 +- src/compat/maestro/__tests__/engine.test.ts | 2 +- .../maestro/__tests__/export-flow.test.ts | 2 +- .../maestro/__tests__/run-script.test.ts | 2 +- .../__tests__/runtime-target-fixtures.ts | 2 +- src/compat/maestro/compatibility-errors.ts | 2 +- .../daemon-runtime-port-observation.ts | 6 +- .../daemon-runtime-port-snapshot-source.ts | 4 +- .../maestro/daemon-runtime-port-support.ts | 4 +- src/compat/maestro/daemon-runtime-port.ts | 4 +- .../daemon-runtime-public-operation.ts | 2 +- src/compat/maestro/engine-context.ts | 2 +- src/compat/maestro/engine-expression.ts | 2 +- src/compat/maestro/engine-flow.ts | 2 +- src/compat/maestro/export-flow.ts | 2 +- src/compat/maestro/program-ir-parser.ts | 2 +- src/compat/maestro/program-ir-values.ts | 2 +- src/compat/maestro/replay-plan-compilation.ts | 2 +- src/compat/maestro/replay-plan-execution.ts | 2 +- src/compat/maestro/replay-plan-resume.ts | 2 +- .../maestro/replay-plan-step-execution.ts | 2 +- src/compat/maestro/replay-plan-types.ts | 2 +- src/compat/maestro/run-script-execution.ts | 2 +- src/compat/maestro/runtime-port-commands.ts | 2 +- src/compat/maestro/runtime-port-geometry.ts | 6 +- .../maestro/runtime-port-observation.ts | 2 +- src/compat/maestro/runtime-port-types.ts | 2 +- src/compat/maestro/runtime-target-policy.ts | 2 +- src/compat/maestro/runtime-target-ranking.ts | 4 +- src/compat/maestro/runtime-targets.ts | 2 +- .../maestro/wait-for-animation-to-end.ts | 2 +- src/compat/replay-input.ts | 2 +- .../apple-os-capability-table-parity.test.ts | 2 +- .../__tests__/platform-plugin-parity.test.ts | 4 +- src/contracts/android-system-chrome.ts | 2 +- src/contracts/app-inventory.ts | 2 +- src/contracts/apple-multitouch-support.ts | 4 +- src/contracts/audio-probe-support.ts | 4 +- src/contracts/batch-contract.ts | 4 +- src/contracts/batch-step.ts | 2 +- src/contracts/cli-flags.ts | 4 +- src/contracts/click-button.ts | 2 +- src/contracts/client-app.ts | 4 +- src/contracts/client-capture.ts | 6 +- src/contracts/client-connection.ts | 4 +- src/contracts/client-device-view.ts | 7 +- src/contracts/client-lease.ts | 2 +- src/contracts/client-observability.ts | 2 +- src/contracts/client-replay.ts | 2 +- src/contracts/client-request.ts | 2 +- src/contracts/cloud-artifacts.ts | 2 +- src/contracts/command-flags.ts | 2 +- src/contracts/device-inventory.test.ts | 2 +- src/contracts/device-inventory.ts | 2 +- src/contracts/device-provider.ts | 4 +- src/contracts/device-rotation.ts | 2 +- src/contracts/device.ts | 7 +- src/contracts/dispatched-command.ts | 2 +- src/contracts/doctor.ts | 2 +- src/contracts/gesture-input.ts | 4 +- src/contracts/gesture-normalization.ts | 4 +- src/contracts/gesture-plan-types.ts | 2 +- src/contracts/gesture-plan.ts | 6 +- src/contracts/input-validation.ts | 2 +- src/contracts/interaction-guarantees.ts | 2 +- src/contracts/interaction.ts | 4 +- src/contracts/interactor-types.ts | 2 +- src/contracts/metro.ts | 2 +- src/contracts/platform-plugin.ts | 4 +- src/contracts/prepare.ts | 2 +- src/contracts/recording.ts | 2 +- src/contracts/remote-config-fields.ts | 2 +- src/contracts/replay.ts | 2 +- src/contracts/result-serialization.ts | 2 +- src/contracts/screenshot.ts | 2 +- src/contracts/scroll-command.ts | 2 +- src/contracts/scroll-gesture.test.ts | 2 +- src/contracts/scroll-gesture.ts | 4 +- src/contracts/session-action.ts | 2 +- src/contracts/snapshot-diagnostics.ts | 4 +- src/contracts/target-shutdown-contract.ts | 2 +- src/contracts/tv-remote.ts | 2 +- src/core/__tests__/app-events.test.ts | 2 +- src/core/__tests__/batch.test.ts | 2 +- src/core/__tests__/capabilities.test.ts | 2 +- .../capability-plugin-routing-parity.test.ts | 2 +- .../__tests__/dispatch-interactions.test.ts | 2 +- src/core/__tests__/dispatch-open.test.ts | 4 +- src/core/__tests__/dispatch-push.test.ts | 2 +- src/core/__tests__/dispatch-resolve.test.ts | 4 +- src/core/__tests__/dispatch-scroll.test.ts | 2 +- src/core/__tests__/dispatch-series.test.ts | 4 +- src/core/__tests__/dispatch-target.test.ts | 2 +- .../dispatch-trigger-app-event.test.ts | 2 +- src/core/__tests__/dispatch-tv-remote.test.ts | 2 +- src/core/__tests__/dispatch-type.test.ts | 2 +- .../__tests__/gesture-capabilities.test.ts | 4 +- src/core/__tests__/gesture-plan-test-utils.ts | 2 +- .../__tests__/gesture-plan-viewport.test.ts | 4 +- .../snapshot-chrome-android-statusbar.test.ts | 2 +- src/core/__tests__/snapshot-chrome.test.ts | 2 +- src/core/__tests__/web-interactor.test.ts | 2 +- src/core/app-events.ts | 9 +- src/core/batch-policy.ts | 2 +- src/core/batch.ts | 4 +- src/core/capabilities.ts | 4 +- src/core/dispatch-context.ts | 2 +- src/core/dispatch-interactions.ts | 4 +- src/core/dispatch-payload.ts | 2 +- src/core/dispatch-resolve.ts | 4 +- src/core/dispatch-series.ts | 2 +- src/core/dispatch.ts | 6 +- src/core/interaction-positionals.ts | 2 +- src/core/interaction-targeting.ts | 4 +- src/core/interactors.ts | 4 +- src/core/interactors/android.ts | 2 +- src/core/interactors/linux.ts | 2 +- src/core/interactors/register-builtins.ts | 2 +- src/core/interactors/web.ts | 2 +- src/core/lease-scope.ts | 2 +- src/core/platform-inventory.test.ts | 2 +- src/core/platform-inventory.ts | 2 +- src/core/press-retarget.test.ts | 2 +- src/core/press-retarget.ts | 2 +- src/core/react-native-overlay.ts | 4 +- src/core/snapshot-chrome.ts | 2 +- src/core/viewport-dimension.ts | 2 +- src/daemon.ts | 2 +- src/daemon/__tests__/app-log.test.ts | 4 +- .../applog-plugin-routing-parity.test.ts | 2 +- src/daemon/__tests__/device-claims.test.ts | 2 +- src/daemon/__tests__/device-ready.test.ts | 2 +- .../__tests__/direct-ios-selector.test.ts | 2 +- .../interaction-outcome-policy.test.ts | 2 +- .../__tests__/internal-observation.test.ts | 2 +- .../materialized-path-registry.test.ts | 2 +- .../perf-plugin-routing-parity.test.ts | 4 +- .../providers-plugin-routing-parity.test.ts | 2 +- .../recording-plugin-routing-parity.test.ts | 2 +- .../__tests__/request-finalization.test.ts | 2 +- .../request-platform-providers.test.ts | 2 +- .../request-router-android-perf.test.ts | 2 +- ...est-router-android-snapshot-helper.test.ts | 2 +- .../__tests__/request-router-cost.test.ts | 2 +- .../__tests__/request-router-open.test.ts | 4 +- .../request-router-repair-expired.test.ts | 2 +- .../request-router-response-level.test.ts | 2 +- .../request-router-screenshot.test.ts | 2 +- .../request-router-typed-error.test.ts | 2 +- src/daemon/__tests__/resumable-upload.test.ts | 2 +- src/daemon/__tests__/runtime-hints.test.ts | 4 +- .../selector-capture-runtime.test.ts | 2 +- src/daemon/__tests__/session-selector.test.ts | 2 +- src/daemon/__tests__/session-snapshot.test.ts | 2 +- .../__tests__/session-target-evidence.test.ts | 2 +- .../__tests__/snapshot-processing.test.ts | 2 +- src/daemon/__tests__/target-shutdown.test.ts | 2 +- .../__tests__/tenant-owned-entry.test.ts | 2 +- src/daemon/android-snapshot-freshness.ts | 2 +- .../android-snapshot-timeout-evidence.ts | 4 +- src/daemon/android-system-dialog.ts | 4 +- src/daemon/app-log-android.ts | 2 +- src/daemon/app-log-doctor.ts | 2 +- src/daemon/app-log-ios.ts | 2 +- src/daemon/app-log.ts | 4 +- src/daemon/apple-runner-options.ts | 2 +- src/daemon/artifact-archive.ts | 2 +- src/daemon/artifact-download.ts | 2 +- src/daemon/artifact-tracking.ts | 4 +- src/daemon/audio-probe.ts | 2 +- src/daemon/client/daemon-client-lifecycle.ts | 2 +- src/daemon/client/daemon-client-progress.ts | 2 +- src/daemon/client/daemon-client-rpc.ts | 2 +- src/daemon/client/daemon-client-timeout.ts | 2 +- src/daemon/client/daemon-client-transport.ts | 2 +- src/daemon/client/daemon-client.ts | 2 +- src/daemon/config.ts | 2 +- src/daemon/daemon-stop.ts | 2 +- src/daemon/device-claim-inspection.ts | 2 +- src/daemon/device-claims.ts | 2 +- src/daemon/device-ready.ts | 2 +- src/daemon/device-targets.ts | 2 +- src/daemon/direct-ios-selector.ts | 4 +- src/daemon/downloadable-artifact-http.ts | 2 +- ...interaction-android-recovery-abort.test.ts | 2 +- .../__tests__/interaction-common.test.ts | 2 +- .../__tests__/interaction-read.test.ts | 2 +- .../__tests__/interaction-settle.test.ts | 2 +- .../interaction-target-evidence.test.ts | 2 +- .../handlers/__tests__/interaction.test.ts | 4 +- .../session-appstate-input-perf.test.ts | 2 +- .../__tests__/session-boot-shutdown.test.ts | 2 +- .../__tests__/session-capabilities.test.ts | 2 +- .../__tests__/session-close-script.test.ts | 2 +- .../__tests__/session-close-shutdown.test.ts | 2 +- .../__tests__/session-device-claims.test.ts | 4 +- .../__tests__/session-doctor-device.test.ts | 4 +- .../__tests__/session-doctor-warmup.test.ts | 2 +- .../session-inventory-appleos.test.ts | 2 +- .../handlers/__tests__/session-logs.test.ts | 2 +- .../__tests__/session-observability.test.ts | 2 +- .../__tests__/session-open-existing.test.ts | 2 +- .../__tests__/session-open-runtime.test.ts | 2 +- .../__tests__/session-open-surface.test.ts | 2 +- .../__tests__/session-open-target.test.ts | 2 +- .../session-open-url-prewarm.test.ts | 2 +- ...sion-replay-dispatch-selector-miss.test.ts | 2 +- ...sion-replay-divergence-publication.test.ts | 2 +- .../session-replay-divergence.test.ts | 4 +- .../session-replay-maestro-failure.test.ts | 2 +- .../session-replay-repair-hint.test.ts | 2 +- .../session-replay-repair-transaction.test.ts | 2 +- ...n-replay-target-classification-fixtures.ts | 2 +- ...ssion-replay-target-classification.test.ts | 2 +- .../session-replay-target-guard.test.ts | 2 +- ...replay-target-verification-runtime.test.ts | 2 +- .../session-state-boot-warmup.test.ts | 2 +- .../__tests__/session-test-discovery.test.ts | 2 +- .../__tests__/session-test-harness.ts | 2 +- .../__tests__/session-test-suite.test.ts | 2 +- .../__tests__/snapshot-handler.test.ts | 4 +- .../__tests__/snapshot-scoped-refs.test.ts | 2 +- src/daemon/handlers/find.ts | 2 +- src/daemon/handlers/install-source.ts | 4 +- .../handlers/interaction-android-escape.ts | 2 +- src/daemon/handlers/interaction-common.ts | 2 +- src/daemon/handlers/interaction-gesture.ts | 4 +- src/daemon/handlers/interaction-read.ts | 4 +- .../handlers/interaction-recorded-input.ts | 2 +- src/daemon/handlers/interaction-runtime.ts | 6 +- src/daemon/handlers/interaction-snapshot.ts | 2 +- .../handlers/interaction-touch-policy.ts | 2 +- .../interaction-touch-reference-frame.ts | 2 +- .../handlers/interaction-touch-targets.ts | 2 +- src/daemon/handlers/interaction-touch.ts | 4 +- src/daemon/handlers/interaction.ts | 2 +- src/daemon/handlers/lease.ts | 2 +- src/daemon/handlers/react-native.ts | 4 +- src/daemon/handlers/record-trace-ios.ts | 2 +- src/daemon/handlers/record-trace-recording.ts | 2 +- src/daemon/handlers/response.ts | 2 +- src/daemon/handlers/session-audio.ts | 2 +- src/daemon/handlers/session-close-script.ts | 2 +- src/daemon/handlers/session-close.ts | 4 +- src/daemon/handlers/session-deploy.ts | 2 +- src/daemon/handlers/session-device-utils.ts | 4 +- src/daemon/handlers/session-doctor-android.ts | 4 +- src/daemon/handlers/session-doctor-app.ts | 4 +- src/daemon/handlers/session-doctor-device.ts | 4 +- src/daemon/handlers/session-doctor-options.ts | 2 +- .../handlers/session-doctor-toolchain.ts | 2 +- src/daemon/handlers/session-doctor.ts | 2 +- src/daemon/handlers/session-inventory.ts | 4 +- src/daemon/handlers/session-native-perf.ts | 2 +- src/daemon/handlers/session-observability.ts | 6 +- .../handlers/session-open-launch-url.ts | 2 +- src/daemon/handlers/session-open-prepare.ts | 4 +- src/daemon/handlers/session-open-surface.ts | 4 +- src/daemon/handlers/session-open-target.ts | 7 +- src/daemon/handlers/session-open.ts | 2 +- src/daemon/handlers/session-perf-xctrace.ts | 4 +- src/daemon/handlers/session-perf.ts | 4 +- .../handlers/session-replay-action-runtime.ts | 2 +- .../session-replay-divergence-publication.ts | 4 +- .../handlers/session-replay-divergence.ts | 4 +- src/daemon/handlers/session-replay-heal.ts | 2 +- .../session-replay-maestro-failure.ts | 4 +- .../session-replay-maestro-observer.ts | 2 +- .../session-replay-maestro-response.ts | 2 +- .../session-replay-maestro-runtime.ts | 4 +- .../handlers/session-replay-repair-hint.ts | 2 +- src/daemon/handlers/session-replay-runtime.ts | 4 +- .../session-replay-target-classification.ts | 4 +- .../session-replay-target-verification.ts | 4 +- src/daemon/handlers/session-replay-trace.ts | 2 +- .../handlers/session-runtime-command.ts | 2 +- src/daemon/handlers/session-runtime.ts | 4 +- .../handlers/session-script-publication.ts | 2 +- src/daemon/handlers/session-state.ts | 4 +- src/daemon/handlers/session-test-discovery.ts | 4 +- src/daemon/handlers/session-test-runtime.ts | 2 +- src/daemon/handlers/session-test-sharding.ts | 4 +- src/daemon/handlers/session-test.ts | 2 +- src/daemon/handlers/session.ts | 4 +- src/daemon/handlers/snapshot-alert.ts | 4 +- src/daemon/handlers/snapshot-capture.ts | 4 +- src/daemon/handlers/snapshot-session.ts | 2 +- src/daemon/handlers/snapshot-settings.ts | 2 +- .../handlers/system-surface-disclosure.ts | 2 +- src/daemon/http-errors.ts | 2 +- src/daemon/install-source-resolution.ts | 2 +- src/daemon/interaction-outcome-policy.ts | 4 +- src/daemon/internal-observation.ts | 2 +- src/daemon/lease-context.ts | 2 +- src/daemon/lease-registry.ts | 4 +- src/daemon/network-log.ts | 2 +- src/daemon/post-gesture-stabilization.ts | 4 +- src/daemon/recording-gestures.ts | 4 +- src/daemon/recording-provider.ts | 2 +- src/daemon/request-admission.ts | 2 +- src/daemon/request-execution-scope.ts | 4 +- src/daemon/request-finalization.ts | 4 +- src/daemon/request-generic-dispatch.ts | 2 +- src/daemon/request-handler-chain.ts | 2 +- src/daemon/request-lock-policy.ts | 8 +- src/daemon/request-platform-providers.ts | 2 +- src/daemon/request-recording-health.ts | 2 +- src/daemon/request-router.ts | 4 +- src/daemon/response-views.ts | 4 +- src/daemon/resumable-upload.ts | 2 +- src/daemon/runtime-artifacts.ts | 2 +- src/daemon/runtime-hints.ts | 4 +- src/daemon/screenshot-overlay-android.ts | 2 +- src/daemon/screenshot-overlay-rects.ts | 4 +- src/daemon/screenshot-overlay.ts | 2 +- src/daemon/screenshot-runtime.ts | 4 +- src/daemon/selector-capture-runtime.ts | 2 +- src/daemon/selector-recording.ts | 2 +- src/daemon/selector-runtime-backend.ts | 4 +- src/daemon/selector-runtime.ts | 4 +- src/daemon/server/daemon-runtime.ts | 2 +- src/daemon/server/http-server.ts | 6 +- src/daemon/server/transport.ts | 2 +- src/daemon/session-event-action.ts | 2 +- src/daemon/session-event-log.ts | 4 +- .../session-script-active-publication.ts | 2 +- src/daemon/session-script-writer.ts | 4 +- src/daemon/session-selector.ts | 4 +- src/daemon/session-snapshot.ts | 2 +- src/daemon/session-target-evidence.ts | 2 +- src/daemon/session-teardown.ts | 4 +- .../snapshot-presentation/ios/actions.ts | 2 +- src/daemon/snapshot-presentation/ios/index.ts | 2 +- src/daemon/snapshot-presentation/ios/noise.ts | 4 +- .../ios/presentation.test.ts | 2 +- src/daemon/snapshot-presentation/ios/rows.ts | 2 +- .../snapshot-presentation/ios/scroll.ts | 2 +- .../snapshot-presentation/ios/web.test.ts | 2 +- src/daemon/snapshot-presentation/ios/web.ts | 2 +- src/daemon/snapshot-presentation/tree.ts | 2 +- src/daemon/snapshot-runtime.ts | 4 +- src/daemon/target-shutdown.ts | 4 +- src/daemon/tenant-owned-entry.ts | 2 +- src/daemon/touch-reference-frame.ts | 2 +- src/daemon/types.ts | 6 +- src/daemon/upload-http.ts | 2 +- src/daemon/upload.ts | 2 +- src/daemon/wait-current-surface.ts | 2 +- src/finders.ts | 2 +- src/io.ts | 4 +- src/mcp/__tests__/command-tools.test.ts | 2 +- src/mcp/command-output-schemas.ts | 2 +- src/mcp/command-tools.ts | 4 +- src/mcp/mcp-output-schemas.ts | 2 +- src/mcp/router.ts | 4 +- src/mcp/server.ts | 2 +- src/mcp/tool-error.ts | 2 +- src/mcp/tool-ref-pins.ts | 2 +- src/metro/client-metro.ts | 2 +- src/metro/metro-reload-endpoints.ts | 2 +- src/metro/metro-types.ts | 2 +- src/metro/metro.ts | 2 +- .../__tests__/boot-diagnostics.test.ts | 2 +- .../android/__tests__/adb-executor.test.ts | 2 +- .../android/__tests__/alert-detection.test.ts | 2 +- .../__tests__/app-lifecycle-install.test.ts | 4 +- .../__tests__/app-lifecycle-open.test.ts | 4 +- .../__tests__/device-input-state.test.ts | 2 +- .../android/__tests__/devices.test.ts | 2 +- .../__tests__/input-actions-fill.test.ts | 2 +- .../android/__tests__/input-actions.test.ts | 2 +- .../android/__tests__/logcat.test.ts | 2 +- .../android/__tests__/notifications.test.ts | 2 +- .../android/__tests__/settings.test.ts | 4 +- .../android/__tests__/snapshot-helper.test.ts | 2 +- .../android/__tests__/snapshot.test.ts | 4 +- .../__tests__/touch-helper-session.test.ts | 4 +- .../__tests__/touch-helper.fixtures.ts | 2 +- .../android/__tests__/touch-helper.test.ts | 2 +- src/platforms/android/adb-executor.ts | 6 +- src/platforms/android/adb.ts | 2 +- src/platforms/android/alert-detection.ts | 2 +- src/platforms/android/alert.ts | 4 +- src/platforms/android/app-control.ts | 2 +- src/platforms/android/app-lifecycle.ts | 4 +- src/platforms/android/device-input-state.ts | 4 +- src/platforms/android/devices.ts | 4 +- src/platforms/android/fill-diagnostics.ts | 2 +- src/platforms/android/fill-verification.ts | 4 +- src/platforms/android/gesture-viewport.ts | 4 +- .../android/helper-package-install.ts | 2 +- src/platforms/android/ime-helper.ts | 4 +- src/platforms/android/ime-lifecycle.ts | 4 +- src/platforms/android/input-actions.ts | 4 +- .../android/instrumentation-helper.ts | 2 +- src/platforms/android/logcat.ts | 2 +- src/platforms/android/notifications.ts | 4 +- src/platforms/android/perf-frame-parser.ts | 2 +- src/platforms/android/perf-frame.ts | 4 +- .../android/perf-native-artifacts.ts | 4 +- src/platforms/android/perf-native-errors.ts | 2 +- src/platforms/android/perf-native-perfetto.ts | 4 +- src/platforms/android/perf-native-process.ts | 2 +- .../android/perf-native-simpleperf.ts | 4 +- src/platforms/android/perf-native-summary.ts | 2 +- src/platforms/android/perf.ts | 4 +- src/platforms/android/screenshot.ts | 4 +- src/platforms/android/settings.ts | 4 +- .../android/snapshot-helper-artifact.ts | 2 +- .../android/snapshot-helper-capture.ts | 2 +- .../android/snapshot-helper-install.ts | 2 +- .../android/snapshot-helper-session.ts | 4 +- src/platforms/android/snapshot.ts | 6 +- src/platforms/android/touch-executor.ts | 4 +- src/platforms/android/touch-helper.ts | 6 +- src/platforms/android/touch-plan.ts | 2 +- src/platforms/android/ui-hierarchy.ts | 4 +- src/platforms/appearance.ts | 2 +- .../interactor-runner-provider.test.ts | 2 +- .../__tests__/screenshot-backend.test.ts | 2 +- .../apple/__tests__/watchos-sentinel.test.ts | 4 +- src/platforms/apple/capabilities.ts | 2 +- .../core/__tests__/app-launch-close.test.ts | 2 +- .../core/__tests__/app-resolution.test.ts | 2 +- .../core/__tests__/apple-core-stub-helpers.ts | 2 +- .../__tests__/apple-runner-platform.test.ts | 2 +- .../apple/core/__tests__/apps.test.ts | 4 +- .../core/__tests__/debug-symbols.test.ts | 2 +- .../apple/core/__tests__/devices.test.ts | 2 +- .../apple/core/__tests__/interactions.test.ts | 2 +- .../core/__tests__/launch-diagnostics.test.ts | 2 +- .../apple/core/__tests__/perf.test.ts | 4 +- .../__tests__/physical-device-control.test.ts | 2 +- .../physical-device-screenshot.test.ts | 2 +- .../core/__tests__/runner-adoption.test.ts | 2 +- .../core/__tests__/runner-cache-probe.test.ts | 2 +- .../__tests__/runner-client-relaunch.test.ts | 2 +- .../core/__tests__/runner-client.test.ts | 4 +- .../__tests__/runner-command-retry.test.ts | 2 +- .../__tests__/runner-recycle-ledger.test.ts | 2 +- .../core/__tests__/runner-sequence.test.ts | 2 +- .../core/__tests__/runner-session.test.ts | 2 +- .../core/__tests__/runner-transport.test.ts | 4 +- .../core/__tests__/runner-xctestrun.test.ts | 2 +- .../core/__tests__/screenshot-density.test.ts | 2 +- .../apple/core/__tests__/screenshot.test.ts | 2 +- .../apple/core/__tests__/simctl.test.ts | 2 +- .../__tests__/simulator-booted-memo.test.ts | 2 +- .../apple/core/__tests__/simulator.test.ts | 2 +- src/platforms/apple/core/app-device-io.ts | 2 +- src/platforms/apple/core/app-install.ts | 4 +- src/platforms/apple/core/app-launch.ts | 4 +- src/platforms/apple/core/app-resolution.ts | 4 +- src/platforms/apple/core/app-settings.ts | 4 +- .../apple/core/apple-runner-platform.ts | 4 +- src/platforms/apple/core/apps-simctl.ts | 2 +- src/platforms/apple/core/debug-symbols.ts | 2 +- .../apple/core/debug-symbols/dsym.ts | 2 +- .../apple/core/debug-symbols/symbolication.ts | 2 +- .../apple/core/debug-symbols/utils.ts | 2 +- src/platforms/apple/core/devicectl.ts | 4 +- src/platforms/apple/core/devices.ts | 4 +- src/platforms/apple/core/install-artifact.ts | 2 +- .../apple/core/launch-diagnostics.ts | 4 +- src/platforms/apple/core/perf-xctrace.ts | 6 +- src/platforms/apple/core/perf.ts | 6 +- .../apple/core/physical-device-apps.ts | 2 +- .../apple/core/physical-device-control.ts | 4 +- .../apple/core/physical-device-coredevice.ts | 4 +- .../apple/core/physical-device-files.ts | 4 +- .../apple/core/physical-device-screenshot.ts | 4 +- .../apple/core/runner/runner-adoption.ts | 2 +- .../apple/core/runner/runner-artifact-env.ts | 2 +- .../apple/core/runner/runner-artifact.ts | 4 +- .../core/runner/runner-cache-metadata.ts | 2 +- .../apple/core/runner/runner-cache.ts | 2 +- .../apple/core/runner/runner-client.ts | 2 +- .../core/runner/runner-command-recovery.ts | 4 +- .../apple/core/runner/runner-command-route.ts | 2 +- .../apple/core/runner/runner-contract.ts | 2 +- .../apple/core/runner/runner-device-set.ts | 4 +- .../apple/core/runner/runner-disposal.ts | 2 +- .../core/runner/runner-failure-diagnostics.ts | 2 +- src/platforms/apple/core/runner/runner-io.ts | 2 +- .../apple/core/runner/runner-lease.ts | 2 +- .../apple/core/runner/runner-lifecycle.ts | 4 +- .../core/runner/runner-macos-products.ts | 4 +- .../apple/core/runner/runner-provider.ts | 2 +- .../core/runner/runner-recycle-ledger.ts | 2 +- .../apple/core/runner/runner-sequence.ts | 2 +- .../apple/core/runner/runner-session-types.ts | 2 +- .../apple/core/runner/runner-session.ts | 4 +- .../apple/core/runner/runner-transport.ts | 4 +- .../core/runner/runner-usbmux-protocol.ts | 2 +- .../apple/core/runner/runner-usbmux.ts | 2 +- .../apple/core/screenshot-status-bar.ts | 4 +- src/platforms/apple/core/screenshot.ts | 4 +- src/platforms/apple/core/simctl.ts | 2 +- src/platforms/apple/core/simulator.ts | 4 +- src/platforms/apple/core/tool-diagnostics.ts | 2 +- src/platforms/apple/interactions.ts | 4 +- src/platforms/apple/interactor.ts | 6 +- src/platforms/apple/os/macos/apps.ts | 4 +- src/platforms/apple/os/macos/audio-probe.ts | 2 +- .../apple/os/macos/desktop-scroll.ts | 2 +- src/platforms/apple/os/macos/devices.ts | 2 +- src/platforms/apple/os/macos/helper.ts | 2 +- src/platforms/apple/os/macos/host-provider.ts | 2 +- src/platforms/apple/plugin.ts | 2 +- src/platforms/audio-probe-backend.ts | 2 +- src/platforms/boot-diagnostics.ts | 2 +- src/platforms/install-source.ts | 2 +- .../linux/__tests__/atspi-bridge.test.ts | 2 +- .../linux/__tests__/clipboard.test.ts | 2 +- src/platforms/linux/accessibility-types.ts | 2 +- src/platforms/linux/atspi-bridge.ts | 4 +- src/platforms/linux/devices.ts | 2 +- src/platforms/linux/linux-env.ts | 2 +- src/platforms/linux/snapshot.ts | 2 +- src/platforms/linux/tool-provider.ts | 2 +- src/platforms/permission-utils.ts | 2 +- src/platforms/setting-state.ts | 2 +- src/platforms/unsupported-interactor.ts | 2 +- src/platforms/vega/__tests__/devices.test.ts | 2 +- .../vega/__tests__/input-actions.test.ts | 2 +- .../vega/__tests__/interactor.test.ts | 4 +- src/platforms/vega/__tests__/plugin.test.ts | 2 +- src/platforms/vega/app-lifecycle.ts | 2 +- src/platforms/vega/devices.ts | 4 +- src/platforms/vega/input-actions.ts | 2 +- src/platforms/vega/interactor.ts | 4 +- src/platforms/vega/plugin.ts | 2 +- .../web/agent-browser-provider.test.ts | 4 +- src/platforms/web/agent-browser-provider.ts | 4 +- src/platforms/web/agent-browser-snapshot.ts | 2 +- src/platforms/web/agent-browser-tool.test.ts | 2 +- src/platforms/web/agent-browser-tool.ts | 2 +- src/platforms/web/provider.ts | 2 +- src/provider-device-runtime.ts | 4 +- src/providers/limrun/android.ts | 4 +- src/providers/limrun/device-session.test.ts | 2 +- src/providers/limrun/device-session.ts | 2 +- src/providers/limrun/device.ts | 2 +- src/providers/limrun/ios.ts | 4 +- src/providers/limrun/runtime.ts | 4 +- src/providers/limrun/snapshot.ts | 2 +- src/recording/__tests__/overlay.test.ts | 2 +- src/recording/output-path.ts | 2 +- src/recording/overlay.ts | 2 +- src/remote/daemon-artifacts.ts | 2 +- src/remote/daemon-proxy.ts | 2 +- src/remote/remote-config-core.ts | 2 +- src/remote/remote-config-schema.ts | 6 +- src/remote/remote-connection-state.ts | 4 +- src/remote/upload-client-artifact.ts | 2 +- src/remote/upload-client.ts | 2 +- src/remote/upload-stream.ts | 2 +- src/replay/__tests__/script.test.ts | 2 +- src/replay/__tests__/target-identity.test.ts | 2 +- src/replay/__tests__/vars.test.ts | 2 +- src/replay/divergence.ts | 4 +- src/replay/recorded-input.ts | 2 +- src/replay/script-utils.ts | 2 +- src/replay/script.ts | 6 +- src/replay/target-evidence-tree.ts | 2 +- src/replay/target-identity-node.ts | 2 +- src/replay/target-identity.ts | 2 +- .../test/reporters/__tests__/custom.test.ts | 2 +- src/replay/test/reporters/custom.ts | 2 +- src/replay/test/reporters/junit.ts | 2 +- src/replay/test/reporters/spec.ts | 2 +- src/replay/vars.ts | 2 +- src/request/cancel.test.ts | 2 +- src/request/cancel.ts | 2 +- src/runtime-contract.ts | 2 +- .../screenshot-diff-non-text.ts | 2 +- src/screenshot-diff/screenshot-diff-ocr.ts | 2 +- .../screenshot-diff-overlay-matches.ts | 2 +- .../screenshot-diff-regions.ts | 2 +- src/screenshot-diff/screenshot-diff.ts | 2 +- src/sdk/contracts.ts | 4 +- src/sdk/index.ts | 8 +- .../is-argument-surface-parity.test.ts | 2 +- src/selectors/build.test.ts | 2 +- src/selectors/build.ts | 4 +- src/selectors/find.test.ts | 2 +- src/selectors/find.ts | 4 +- src/selectors/index.test.ts | 2 +- src/selectors/match.ts | 4 +- src/selectors/node.ts | 4 +- src/selectors/parse.ts | 2 +- src/selectors/predicates.test.ts | 2 +- src/selectors/predicates.ts | 6 +- src/selectors/resolve.ts | 4 +- .../__tests__/snapshot-label-dedup.test.ts | 2 +- .../__tests__/tap-point-policy-parity.test.ts | 2 +- src/snapshot/android-input-method-overlays.ts | 2 +- src/snapshot/mobile-snapshot-semantics.ts | 2 +- src/snapshot/snapshot-diff.ts | 2 +- src/snapshot/snapshot-label-dedup.ts | 2 +- src/snapshot/snapshot-lines.ts | 2 +- src/snapshot/snapshot-occlusion.ts | 4 +- src/snapshot/snapshot-processing.ts | 4 +- src/snapshot/snapshot-quality.ts | 4 +- src/snapshot/snapshot-tree.ts | 2 +- src/snapshot/snapshot-visibility.ts | 2 +- src/snapshot/system-surface-disclosure.ts | 2 +- .../__tests__/daemon-client-lifecycle.test.ts | 2 +- src/utils/__tests__/device.test.ts | 6 +- src/utils/__tests__/exec.test.ts | 2 +- src/utils/__tests__/interactors.test.ts | 4 +- .../mobile-snapshot-semantics.test.ts | 2 +- src/utils/__tests__/output.test.ts | 2 +- src/utils/__tests__/png-size.test.ts | 2 +- src/utils/__tests__/png-worker-client.test.ts | 2 +- src/utils/__tests__/process-lock.test.ts | 2 +- .../__tests__/repeated-nav-subtree.test.ts | 2 +- .../__tests__/snapshot-processing.test.ts | 2 +- .../__tests__/snapshot-visibility.test.ts | 2 +- .../android-helper-presentation/geometry.ts | 2 +- .../android-helper-presentation/labels.ts | 2 +- .../android-helper-presentation/predicates.ts | 2 +- .../structural-noise.ts | 2 +- src/utils/android-helper-presentation/tree.ts | 2 +- .../android-helper-snapshot-presentation.ts | 2 +- src/utils/diagnostics.ts | 2 +- src/utils/exec.ts | 2 +- src/utils/install-source-config.ts | 4 +- src/utils/location-coordinates.ts | 2 +- src/utils/node-http.ts | 2 +- src/utils/output.ts | 4 +- src/utils/parsing.ts | 6 +- src/utils/payload-input.ts | 2 +- src/utils/png-resize.ts | 2 +- src/utils/png-size.ts | 2 +- src/utils/png-worker-client.ts | 2 +- src/utils/png-worker-contract.ts | 2 +- src/utils/png-worker.ts | 2 +- src/utils/png.ts | 2 +- src/utils/process-lock.ts | 2 +- src/utils/rect-center.ts | 2 +- src/utils/rect-visibility.ts | 2 +- src/utils/repeated-nav-subtree.ts | 2 +- src/utils/retry.ts | 2 +- src/utils/runtime-transport.ts | 4 +- src/utils/screenshot-density.ts | 4 +- src/utils/screenshot-geometry.ts | 2 +- src/utils/screenshot-result.ts | 2 +- src/utils/scroll-edge-state-fixtures.ts | 4 +- ...roll-edge-state-pass-orchestration.test.ts | 2 +- src/utils/scroll-edge-state-scope.test.ts | 2 +- ...croll-edge-state-target-resolution.test.ts | 2 +- src/utils/scroll-edge-state.ts | 4 +- src/utils/session-binding.ts | 4 +- src/utils/source-value.ts | 2 +- src/utils/string-enum.ts | 2 +- src/utils/swift-cache.ts | 2 +- src/utils/validation.ts | 2 +- src/utils/video.ts | 2 +- stryker.config.json | 2 +- .../direct-ios-selector.contract.test.ts | 2 +- .../interaction-contract/fixtures.ts | 2 +- .../maestro-fallback.contract.test.ts | 2 +- .../native-ref.contract.test.ts | 2 +- .../interaction-contract/runtime-harness.ts | 2 +- .../runtime-ref.contract.test.ts | 2 +- .../runtime-selector.contract.test.ts | 2 +- .../nightly/concurrency-torture/bindings.ts | 2 +- .../nightly/concurrency-torture/harness.ts | 4 +- .../android-tv-remote.test.ts | 2 +- .../daemon-http-server.test.ts | 2 +- .../provider-scenarios/fixtures.ts | 2 +- ...teraction-direct-selector-fallback.test.ts | 2 +- .../provider-scenarios/ios-world.ts | 2 +- .../provider-scenarios/linux-world.ts | 2 +- .../provider-device-runtime.test.ts | 2 +- .../provider-ios-runner-transport.test.ts | 2 +- .../provider-ios-selector-runtime.test.ts | 2 +- .../remote-daemon-client.test.ts | 2 +- .../remote-proxy-artifact-tenant.test.ts | 2 +- .../provider-scenarios/transcript.ts | 2 +- .../provider-scenarios/vega-tv-remote.test.ts | 2 +- .../provider-scenarios/web-world.ts | 2 +- test/output-economy/fixtures.ts | 4 +- .../output-economy.baseline.test.ts | 2 +- test/output-economy/render-fixtures.ts | 2 +- test/output-economy/routine-workflow.ts | 2 +- test/replay-compat/corpus.test.ts | 2 +- test/replay-compat/manifest.ts | 2 +- tsconfig.lib.json | 6 +- tsdown.config.ts | 23 +- vitest.config.ts | 3 +- vitest.mutation.config.ts | 18 + 865 files changed, 2022 insertions(+), 1224 deletions(-) create mode 100644 packages/kernel/package.json rename {src/utils => packages/kernel/src}/bounds.ts (89%) rename {src/kernel => packages/kernel/src}/collections.ts (100%) rename {src/kernel => packages/kernel/src}/contracts.ts (100%) rename {src/kernel => packages/kernel/src}/device.ts (100%) rename {src/kernel => packages/kernel/src}/errors.ts (100%) rename {src/kernel => packages/kernel/src}/rect.ts (100%) rename {src/kernel => packages/kernel/src}/redaction.ts (100%) rename {src/kernel => packages/kernel/src}/snapshot.ts (100%) create mode 100644 packages/kernel/tsconfig.json create mode 100644 scripts/layering/package-boundaries.test.ts create mode 100644 scripts/layering/package-boundaries.ts rename src/{kernel/__tests__ => __tests__/kernel}/errors-code-policy.test.ts (99%) rename src/{kernel/__tests__ => __tests__/kernel}/errors-message.test.ts (99%) rename src/{kernel/__tests__ => __tests__/kernel}/errors-metadata.test.ts (99%) rename src/{kernel/__tests__ => __tests__/kernel}/platform-collapse-parity.test.ts (98%) rename src/{kernel/__tests__ => __tests__/kernel}/snapshot-ref-grammar.test.ts (94%) rename src/{kernel => client}/daemon-error.ts (69%) diff --git a/.fallowrc.json b/.fallowrc.json index a195a74c8..0faeb7e8a 100644 --- a/.fallowrc.json +++ b/.fallowrc.json @@ -2,6 +2,7 @@ "$schema": "https://raw.githubusercontent.com/fallow-rs/fallow/main/schema.json", "entry": [ "tsdown.config.ts", + "vitest.mutation.config.ts", "src/sdk/index.ts", "src/sdk/io.ts", "src/sdk/artifacts.ts", @@ -33,6 +34,7 @@ "website/rspress.config.ts" ], "ignorePatterns": [ + "packages/**", "examples/test-app/**", "scripts/perf/**", "scripts/layering/**", diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37b354937..416d2e37a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -124,16 +124,16 @@ jobs: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + # The selector's entry closure reaches `@agent-device/kernel` workspace + # specifiers through src/utils/exec.ts and diagnostics.ts (#1490 W0), and + # workspace package resolution needs the pnpm link in node_modules. The + # R8 relative-import exception is reserved for scripts, not production + # src files, so this job installs dependencies instead. - name: Setup toolchain uses: ./.github/actions/setup-node-pnpm - with: - install-deps: false # The selector is fail-open and advisory (GitHub CI stays authoritative), - # so the gate only guards the derivation model. Invoked with no deps, - # mirroring the layering guard. R8 (scripts/layering/zero-dep-jobs.ts) - # resolves this bare pnpm script name back to package.json's own command - # to find its entry scripts, so this is not a `pnpm install` for the job. + # so the gate only guards the derivation model. - name: Check affected-selector model run: pnpm check:affected:test diff --git a/.github/workflows/mutation-affected.yml b/.github/workflows/mutation-affected.yml index 1adff6ead..3d80c0454 100644 --- a/.github/workflows/mutation-affected.yml +++ b/.github/workflows/mutation-affected.yml @@ -25,7 +25,7 @@ on: # Kernel sources, every src test (ownership is derived, so any test may own # a kernel — `select` decides, not this filter), and the lane's own tooling. # scripts/mutation/workflow.test.ts asserts this covers the registry. - - 'src/kernel/errors.ts' + - 'packages/kernel/src/errors.ts' - 'src/daemon/ref-frame.ts' - 'src/commands/interaction/runtime/settle.ts' - 'src/utils/scroll-edge-state.ts' diff --git a/.gitignore b/.gitignore index d0af94b2f..eb1709a62 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,7 @@ android/snapshot-helper/build/ android/snapshot-helper/dist/ android/ime-helper/build/ android/ime-helper/dist/ + +# Workspace package declaration output (tsc -b project references) +packages/*/dist-types/ +*.tsbuildinfo diff --git a/AGENTS.md b/AGENTS.md index 201916503..064ed253f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -93,12 +93,12 @@ the new thing — never to suppress or allowlist it. - `keyboard dismiss` is the iOS keyboard dismissal path. It may tap safe native controls such as `Done`, but must not fall back to system back navigation. - Do not remove shared snapshot/session model behavior without full migration. -- Apple-family target changes keep `src/kernel/device.ts`, `src/core/capabilities.ts`, +- Apple-family target changes keep `packages/kernel/src/device.ts`, `src/core/capabilities.ts`, `src/core/dispatch-resolve.ts`, `src/platforms/apple/core/devices.ts`, and `src/platforms/apple/core/runner/runner-xctestrun.ts` in sync. - iOS simulator-set scoping is iOS-specific: `iosSimulatorDeviceSet` must not hide the host macOS desktop target when `--platform macos` or `--target desktop` is requested. -- Use `inferFillText` (`src/daemon/action-utils.ts`), `uniqueStrings` (`src/kernel/collections.ts`), +- Use `inferFillText` (`src/daemon/action-utils.ts`), `uniqueStrings` (`@agent-device/kernel/collections`), and `evaluateIsPredicate` (`src/selectors/predicates.ts`) rather than reimplementing them. - Do not update `skills/**/SKILL.md` for command behavior or workflow guidance unless the user asks. Skills are thin routers to versioned CLI help; they must not carry behavior details. @@ -188,7 +188,7 @@ connect errors, retry policy, or command typing, start in and must not duplicate backend logic. App/device logs stay in `app.log`; Apple runner and `xcodebuild` subprocess output belongs in the session-scoped `runner.log`. Preserve the external grep/tail workflow documented in help/skills. -- Normalize user-facing failures via `normalizeError` (`src/kernel/errors.ts`). Payload contract: +- Normalize user-facing failures via `normalizeError` (`@agent-device/kernel/errors`). Payload contract: `code`, `message`, `hint`, `diagnosticId`, `logPath`, `details`. Preserve `hint`, `diagnosticId`, and `logPath` when wrapping or rethrowing. Errors say what failed, why when known, and how to recover — recovery steps go in `hint` when the action is not obvious. diff --git a/CONTEXT.md b/CONTEXT.md index 04c1a3fb6..2b06b6303 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -252,7 +252,7 @@ The perfect-shape refactor is complete and merged. Its end-state: - Apple platform model. Internally `Platform` is `apple` (plus `android`/`vega`/`linux`/`web`) with an `appleOs` discriminant (`ios | ipados | tvos | watchos | visionos | macos`); the shared Apple engine lives under `src/platforms/apple/core/` with per-OS leaves under `src/platforms/apple/os//`. - The public wire stays non-breaking: `PUBLIC_PLATFORMS` (`src/kernel/device.ts`) still emits + The public wire stays non-breaking: `PUBLIC_PLATFORMS` (`packages/kernel/src/device.ts`) still emits `ios`/`macos` leaf output. See [ADR 0009](docs/adr/0009-apple-platform-consolidation.md). - Vega platform model. Initial Vega OS support is deliberately **VVD-only**: discovery returns `VirtualDevice`, and platform capability admission rejects physical Fire TV devices until durable @@ -270,7 +270,7 @@ The perfect-shape refactor is complete and merged. Its end-state: it ranks an explicit target spine — as rank groups, lowest (kernel sink) to highest, where `A ◄ B` means B may not be outranked by A (the back-edge order the gate rejects), NOT that every displayed import exists: - `kernel ◄ { contracts, request, selectors, platforms, utils, replay, recording, snapshot, screenshot-diff, cloud-webdriver } ◄ { core, providers } ◄ { commands, cli-schema, mcp } ◄ { client, daemon-server, compat, remote, metro, sdk } ◄ daemon-client ◄ cli` — + `{ contracts, request, selectors, platforms, utils, replay, recording, snapshot, screenshot-diff, cloud-webdriver } ◄ { core, providers } ◄ { commands, cli-schema, mcp } ◄ { client, daemon-server, compat, remote, metro, sdk } ◄ daemon-client ◄ cli` (the former rank-0 kernel zone lives in `packages/kernel` since #1490 W0; R11 package-boundaries owns that seam, and R1 kernel-sink is retired as physically subsumed) — and rejects every back-edge within it. Only `(root)` is unranked (`UNRANKED_ZONES` in `scripts/layering/model.ts`): it holds the entrypoints and the composition roots that wire the command surface into the daemon, and R2 forbids `daemon/` from importing `commands/`, so those diff --git a/docs/agents/testing.md b/docs/agents/testing.md index 4a5e862fa..ec1086887 100644 --- a/docs/agents/testing.md +++ b/docs/agents/testing.md @@ -28,7 +28,8 @@ The mapping it encodes, for when you need to run a gate directly or reason about | Help benchmark cases (`scripts/help-conformance-*.mjs`) | `pnpm exec vitest run scripts/__tests__` (deterministic gates); model-backed: `pnpm bench:help-conformance` (paid LLM calls, local only) | | `.ad` grammar (`src/replay/script.ts`, gesture arity, replay vars) | `pnpm exec vitest run --project unit-core test/replay-compat` — the frozen replay-compat corpus asserts which released script surfaces still parse; a flipped verdict is edited in `test/replay-compat/manifest.ts`, never in the script. Adding or re-pinning a corpus entry also runs `pnpm check:replay-compat`, which re-derives each entry from its release tag in git history | | Anything in `src/`, `test/` | `pnpm format` (`skills/` is Markdown-only guidance: oxfmt ignores `**/*.md`, and the affected-check selector classifies it docs-only) | -| A decision kernel or its tests (`src/kernel/errors.ts`, `src/daemon/ref-frame.ts`, `src/commands/interaction/runtime/settle.ts`, `src/utils/scroll-edge-state.ts`, `src/selectors/`) | `pnpm mutation:affected --base origin/main` (minutes; GitHub runs it per PR — see the mutation ratchet section) | +| Workspace package source (`packages/*/src/**`) | Root format/lint/typecheck plus layering (R11 package-boundaries); Vitest resolves affected tests through the module graph; package manifests/tsconfigs fail open to the full set | +| A decision kernel or its tests (`packages/kernel/src/errors.ts`, `src/daemon/ref-frame.ts`, `src/commands/interaction/runtime/settle.ts`, `src/utils/scroll-edge-state.ts`, `src/selectors/`) | `pnpm mutation:affected --base origin/main` (minutes; GitHub runs it per PR — see the mutation ratchet section) | Two traps worth naming: diff --git a/package.json b/package.json index c1c3cf9b6..f1af197bd 100644 --- a/package.json +++ b/package.json @@ -129,7 +129,7 @@ "check:affected:test": "node --experimental-strip-types --test scripts/check-affected/model.test.ts scripts/check-affected/run.test.ts", "check:coverage-changed": "node --experimental-strip-types scripts/coverage-changed/run.ts", "check:coverage-changed:test": "node --experimental-strip-types --test scripts/coverage-changed/model.test.ts scripts/coverage-changed/run.test.ts", - "check:layering": "node --experimental-strip-types --test scripts/layering/model.test.ts scripts/layering/zone-policy.test.ts scripts/layering/daemon-modularity.test.ts && node --experimental-strip-types scripts/layering/check.ts", + "check:layering": "node --experimental-strip-types --test scripts/layering/model.test.ts scripts/layering/zone-policy.test.ts scripts/layering/daemon-modularity.test.ts scripts/layering/package-boundaries.test.ts && node --experimental-strip-types scripts/layering/check.ts", "depgraph": "node --experimental-strip-types scripts/depgraph/build.ts", "depgraph:test": "node --experimental-strip-types --test scripts/depgraph/model.test.ts scripts/depgraph/affected.test.ts", "check:production-exports": "fallow dead-code --config fallow-production-exports.json --production --unused-exports --fail-on-issues", @@ -145,7 +145,7 @@ "check:unit": "pnpm check:contention-retry && pnpm test:unit && pnpm test:smoke", "check": "pnpm check:tooling && pnpm check:fallow && pnpm check:unit", "prepack": "pnpm check:mcp-metadata && pnpm package:npm", - "typecheck": "tsc -p tsconfig.json && tsc -p examples/sdk/tsconfig.json", + "typecheck": "tsc -b packages/kernel && tsc -p tsconfig.json && tsc -p examples/sdk/tsconfig.json", "test-app:install": "pnpm install --dir examples/test-app", "test-app:start": "pnpm --dir examples/test-app start", "test-app:ios": "pnpm --dir examples/test-app ios", @@ -244,6 +244,7 @@ "yaml": "^2.9.0" }, "devDependencies": { + "@agent-device/kernel": "workspace:*", "@chenglou/freerange": "^0.0.1", "@stryker-mutator/core": "9.6.1", "@stryker-mutator/vitest-runner": "9.6.1", diff --git a/packages/kernel/package.json b/packages/kernel/package.json new file mode 100644 index 000000000..4c9c460cc --- /dev/null +++ b/packages/kernel/package.json @@ -0,0 +1,41 @@ +{ + "name": "@agent-device/kernel", + "version": "0.0.0", + "private": true, + "type": "module", + "description": "Foundational vocabulary for agent-device: errors, device identity, snapshot model, shared contracts. Internal workspace package bundled into the published agent-device artifact.", + "exports": { + "./errors": { + "types": "./src/errors.ts", + "default": "./src/errors.ts" + }, + "./device": { + "types": "./src/device.ts", + "default": "./src/device.ts" + }, + "./snapshot": { + "types": "./src/snapshot.ts", + "default": "./src/snapshot.ts" + }, + "./contracts": { + "types": "./src/contracts.ts", + "default": "./src/contracts.ts" + }, + "./collections": { + "types": "./src/collections.ts", + "default": "./src/collections.ts" + }, + "./rect": { + "types": "./src/rect.ts", + "default": "./src/rect.ts" + }, + "./redaction": { + "types": "./src/redaction.ts", + "default": "./src/redaction.ts" + }, + "./bounds": { + "types": "./src/bounds.ts", + "default": "./src/bounds.ts" + } + } +} diff --git a/src/utils/bounds.ts b/packages/kernel/src/bounds.ts similarity index 89% rename from src/utils/bounds.ts rename to packages/kernel/src/bounds.ts index 0b68e77d5..3cb266a9e 100644 --- a/src/utils/bounds.ts +++ b/packages/kernel/src/bounds.ts @@ -1,4 +1,4 @@ -import type { Rect } from '../kernel/snapshot.ts'; +import type { Rect } from './snapshot.ts'; export function parseBounds(bounds: string | null): Rect | undefined { if (!bounds) return undefined; diff --git a/src/kernel/collections.ts b/packages/kernel/src/collections.ts similarity index 100% rename from src/kernel/collections.ts rename to packages/kernel/src/collections.ts diff --git a/src/kernel/contracts.ts b/packages/kernel/src/contracts.ts similarity index 100% rename from src/kernel/contracts.ts rename to packages/kernel/src/contracts.ts diff --git a/src/kernel/device.ts b/packages/kernel/src/device.ts similarity index 100% rename from src/kernel/device.ts rename to packages/kernel/src/device.ts diff --git a/src/kernel/errors.ts b/packages/kernel/src/errors.ts similarity index 100% rename from src/kernel/errors.ts rename to packages/kernel/src/errors.ts diff --git a/src/kernel/rect.ts b/packages/kernel/src/rect.ts similarity index 100% rename from src/kernel/rect.ts rename to packages/kernel/src/rect.ts diff --git a/src/kernel/redaction.ts b/packages/kernel/src/redaction.ts similarity index 100% rename from src/kernel/redaction.ts rename to packages/kernel/src/redaction.ts diff --git a/src/kernel/snapshot.ts b/packages/kernel/src/snapshot.ts similarity index 100% rename from src/kernel/snapshot.ts rename to packages/kernel/src/snapshot.ts diff --git a/packages/kernel/tsconfig.json b/packages/kernel/tsconfig.json new file mode 100644 index 000000000..935c871a4 --- /dev/null +++ b/packages/kernel/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "composite": true, + "noEmit": false, + "emitDeclarationOnly": true, + "declaration": true, + "declarationDir": "./dist-types", + "rootDir": "./src" + }, + "include": ["src"] +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 42b0c0f46..cb2267766 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -21,6 +21,9 @@ importers: specifier: ^2.9.0 version: 2.9.0 devDependencies: + '@agent-device/kernel': + specifier: workspace:* + version: link:packages/kernel '@chenglou/freerange': specifier: ^0.0.1 version: 0.0.1 @@ -64,6 +67,8 @@ importers: specifier: ^4.1.8 version: 4.1.8(@types/node@22.19.21)(@vitest/coverage-v8@4.1.8)(vite@8.0.16(@types/node@22.19.21)(yaml@2.9.0)) + packages/kernel: {} + website: devDependencies: '@callstack/rspress-preset': diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index d45982f8a..647a42c79 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,5 +1,6 @@ packages: - 'website' + - 'packages/*' # Keep non-interactive checks from downloading tooling or reinstalling dependencies implicitly. pmOnFail: warn verifyDepsBeforeRun: warn diff --git a/scripts/__tests__/help-conformance-error-recovery-coverage.test.ts b/scripts/__tests__/help-conformance-error-recovery-coverage.test.ts index c907382f0..3a1f6ac99 100644 --- a/scripts/__tests__/help-conformance-error-recovery-coverage.test.ts +++ b/scripts/__tests__/help-conformance-error-recovery-coverage.test.ts @@ -8,7 +8,7 @@ import { defaultHintForCode, KNOWN_APP_ERROR_CODES, retriableForErrorCode, -} from '../../src/kernel/errors.ts'; +} from '@agent-device/kernel/errors'; // "What enumerates N" for the error surface. The benchmark's recovery quizzes // (a pinned rendered error plus "what command runs next?") are keyed to the diff --git a/scripts/__tests__/help-conformance-sample-producers.ts b/scripts/__tests__/help-conformance-sample-producers.ts index 02bcabbdc..ff2166345 100644 --- a/scripts/__tests__/help-conformance-sample-producers.ts +++ b/scripts/__tests__/help-conformance-sample-producers.ts @@ -18,7 +18,7 @@ import { buildDeviceInUseBySessionError } from '../../src/daemon/handlers/sessio import { resolveRefStalenessWarning } from '../../src/daemon/session-snapshot.ts'; import type { SessionState } from '../../src/daemon/types.ts'; import { buildAppNotInstalledError } from '../../src/platforms/apple/core/app-resolution.ts'; -import { AppError, normalizeError } from '../../src/kernel/errors.ts'; +import { AppError, normalizeError } from '@agent-device/kernel/errors'; import type { SnapshotQualityVerdict } from '../../src/snapshot/snapshot-quality.ts'; import { renderSnapshotQualityWarnings } from '../../src/snapshot/snapshot-quality.ts'; import { formatSnapshotText, printHumanError } from '../../src/utils/output.ts'; diff --git a/scripts/check-affected/model.test.ts b/scripts/check-affected/model.test.ts index e1db1cbd1..7563c8854 100644 --- a/scripts/check-affected/model.test.ts +++ b/scripts/check-affected/model.test.ts @@ -140,6 +140,27 @@ test('skills guidance change is docs-only', () => { assert.deepEqual(result.checks, []); }); +test('workspace package source selects static gates, layering, and the build', () => { + const result = plan(['packages/kernel/src/errors.ts']); + assert.equal(result.failOpen, false); + for (const id of [ + 'format', + 'lint', + 'typecheck', + 'layering', + 'build', + 'vitest-related', + ] as const) { + assert.ok(result.checks.includes(id), `expected ${id}`); + } +}); + +test('a workspace package manifest fails open — it rewires resolution globally', () => { + const result = plan(['packages/kernel/package.json']); + assert.equal(result.failOpen, true); + assert.equal(result.failOpenReasons[0]?.rule, 'workflow-tooling'); +}); + test('workflow/tooling and selector-owning changes fail open', () => { assert.equal(plan(['.github/workflows/ci.yml']).failOpenReasons[0]?.rule, 'workflow-tooling'); assert.equal(plan(['package.json']).failOpenReasons[0]?.rule, 'workflow-tooling'); diff --git a/scripts/check-affected/model.ts b/scripts/check-affected/model.ts index 3aee60e38..fda1e377b 100644 --- a/scripts/check-affected/model.ts +++ b/scripts/check-affected/model.ts @@ -120,7 +120,15 @@ function isSelectorOwning(file: string): boolean { } function isWorkflowTooling(file: string): boolean { - return file.startsWith('.github/') || file.startsWith('scripts/') || ROOT_TOOLING.has(file); + // A workspace package manifest or tsconfig rewires module resolution for + // every consumer, so it fails open like root tooling does. + const packageTooling = /^packages\/[^/]+\/(?:package\.json|tsconfig\.json)$/.test(file); + return ( + file.startsWith('.github/') || + file.startsWith('scripts/') || + packageTooling || + ROOT_TOOLING.has(file) + ); } function isDocs(file: string): boolean { @@ -216,6 +224,32 @@ const vitestRelatedOwnership: OwnershipRule = ({ file, isTs, underSrc, underTest ] : []; +// Workspace package source (#1490 W0): bundled into the published artifact, +// type-checked in the root graph, covered by Vitest's module graph, and +// guarded by layering R11. Fallow deliberately ignores packages/** (its +// resolver cannot follow workspace specifiers), so fallow is not selected. +const workspacePackageOwnership: OwnershipRule = ({ file, isTs }) => { + if (!isTs || !/^packages\/[^/]+\/src\//.test(file)) return []; + const selections = [ + reason('format', file, 'gate:format', 'oxfmt covers packages/'), + reason('lint', file, 'gate:lint', 'oxlint covers packages/'), + reason('typecheck', file, 'gate:typecheck', 'tsc includes packages/'), + reason('layering', file, 'package-src', 'layering R11 guards workspace package boundaries'), + reason( + 'vitest-related', + file, + 'vitest:related', + 'Vitest resolves affected tests through its static module graph', + ), + ]; + if (!isTestPath(file)) { + selections.push( + reason('build', file, 'package-src', 'package source is bundled into the published artifact'), + ); + } + return selections; +}; + const nodeIntegrationOwnership: OwnershipRule = ({ file }) => isNodeIntegrationPath(file) ? [reason('integration-node', file, 'node-integration', 'node --test integration smoke')] @@ -314,6 +348,7 @@ const OWNERSHIP_RULES: readonly OwnershipRule[] = [ staticTsGates, srcProdGate, vitestRelatedOwnership, + workspacePackageOwnership, nodeIntegrationOwnership, testAppOwnership, replayCompatOwnership, diff --git a/scripts/depgraph/load.ts b/scripts/depgraph/load.ts index de13e1e6c..2c61b7385 100644 --- a/scripts/depgraph/load.ts +++ b/scripts/depgraph/load.ts @@ -5,11 +5,12 @@ import fs from 'node:fs'; import path from 'node:path'; import { listSourceFiles } from '../layering/check.ts'; import { resolveImportEdges } from '../layering/model.ts'; +import { workspaceSpecifierTargets } from '../layering/package-boundaries.ts'; import { buildGraph, type GraphData } from './model.ts'; export function loadGraph(repoRoot: string): GraphData { const sources = new Map( listSourceFiles().map((file) => [file, fs.readFileSync(path.join(repoRoot, file), 'utf8')]), ); - return buildGraph(sources, resolveImportEdges(sources)); + return buildGraph(sources, resolveImportEdges(sources, workspaceSpecifierTargets(repoRoot))); } diff --git a/scripts/depgraph/model.test.ts b/scripts/depgraph/model.test.ts index c7186f367..c2a0cb9e5 100644 --- a/scripts/depgraph/model.test.ts +++ b/scripts/depgraph/model.test.ts @@ -133,16 +133,16 @@ test('collectCycles separates gate-rejected value cycles from type-only and dyna test('buildGraph reports zone membership, degrees, and cross-zone edge counts', () => { const files = sources({ - 'src/kernel/errors.ts': 'export const fail = 1;\n', - 'src/core/interactors/tap.ts': "import { fail } from '../../kernel/errors.ts';\n", + 'packages/kernel/src/errors.ts': 'export const fail = 1;\n', + 'src/core/interactors/tap.ts': "import { fail } from '@agent-device/kernel/errors';\n", 'src/commands/tap.ts': [ - "import { fail } from '../kernel/errors.ts';", + "import { fail } from '@agent-device/kernel/errors';", "import '../core/interactors/tap.ts';", ].join('\n'), }); const graph = buildGraph(files, resolveImportEdges(files)); - const kernel = graph.nodes.find((node) => node.id === 'src/kernel/errors.ts')!; + const kernel = graph.nodes.find((node) => node.id === 'packages/kernel/src/errors.ts')!; assert.equal(kernel.zone, 'kernel'); assert.equal(kernel.fanIn, 2); assert.equal(kernel.fanOut, 0); @@ -156,8 +156,8 @@ test('buildGraph reports zone membership, degrees, and cross-zone edge counts', ['commands -> core (1)', 'commands -> kernel (1)', 'core -> kernel (1)'], ); assert.deepEqual( - graph.zones.map((zone) => zone.classification), - ['ranked', 'ranked', 'ranked'], + graph.zones.map((zone) => `${zone.id}:${zone.classification}`), + ['kernel:unranked', 'core:ranked', 'commands:ranked'], ); }); diff --git a/scripts/fuzz/invariant.ts b/scripts/fuzz/invariant.ts index 7935b764b..e8984e8af 100644 --- a/scripts/fuzz/invariant.ts +++ b/scripts/fuzz/invariant.ts @@ -8,7 +8,7 @@ // 3. the case terminates — enforced by the harness watchdog, not by this module, because // synchronous parsers cannot be interrupted from inside their own tick. -import { AppError, normalizeError } from '../../src/kernel/errors.ts'; +import { AppError, normalizeError } from '@agent-device/kernel/errors'; import type { FuzzTarget, FuzzTargetName } from './target-types.ts'; export type FuzzFailureKind = 'untyped-throw' | 'empty-hint' | 'hang'; diff --git a/scripts/fuzz/self-check-targets.ts b/scripts/fuzz/self-check-targets.ts index 3aa51ab7f..65b1e4269 100644 --- a/scripts/fuzz/self-check-targets.ts +++ b/scripts/fuzz/self-check-targets.ts @@ -6,7 +6,7 @@ // deliberately kept out of FUZZ_TARGETS: only the registry resolves them by name, so a normal // run never sees them and no production module gains a test-only seam. -import { AppError } from '../../src/kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { FuzzTarget, SelfCheckTargetName } from './target-types.ts'; const SEEDS = ['self-check']; diff --git a/scripts/layering/check.ts b/scripts/layering/check.ts index 44a735a8b..814ca2f63 100644 --- a/scripts/layering/check.ts +++ b/scripts/layering/check.ts @@ -1,15 +1,17 @@ // Import-direction lint — enforces the folder DAG established by the Phase-5 // folder moves (see CONTEXT.md, "Architecture: folder DAG + layering lint"). // -// Ranked target spine, as rank groups lowest (kernel sink) to highest. `A ◄ B` means B may not +// Ranked target spine, as rank groups lowest to highest. `A ◄ B` means B may not // be outranked by A (the back-edge order the gate rejects), NOT that every displayed import exists: -// kernel ◄ { contracts, request, selectors, platforms } ◄ core ◄ { commands, cli-schema } +// { contracts, request, selectors, platforms } ◄ core ◄ { commands, cli-schema } // ◄ { client, daemon-server } ◄ daemon-client ◄ cli -// (authoritative ranks: `TARGET_DAG_RANK` in model.ts) +// (authoritative ranks: `TARGET_DAG_RANK` in model.ts. The former rank-0 kernel +// zone lives in packages/kernel since #1490 W0; R11 owns its boundary.) // // This gate enforces five things, across four scopes: -// - GLOBALLY, across every production source file: the R1-R3 move rules and -// rejection of all production static value-import cycles (R4). +// - GLOBALLY, across every production source file: the R2-R3 move rules and +// rejection of all production static value-import cycles (R4). R1 kernel-sink +// retired with the kernel's move to packages/kernel (#1490 W0). // - Over the RANKED SPINE only: rejection of every spine back-edge (R5), i.e. // an import whose source zone outranks its target zone, plus a ratchet on the // same inversion measured over TYPE-ONLY edges (R6). @@ -24,6 +26,8 @@ // - Across the DAEMON MODULARITY MIGRATION: R7 ownership pressure and external // daemon/types.ts importers only shrink, R9 zone membership cannot grow or absorb // engine files, and planned logical modules start with zero forbidden/internal imports (R10). +// - Over the WORKSPACE PACKAGES: no root back-imports, no relative tunnelling past +// an exports map, and every workspace specifier declared + exports-named (R11). // Only `(root)` is unranked (see `UNRANKED_ZONES` in model.ts): it holds the // entrypoints and the composition roots that wire the command surface into the // daemon, which R2 forbids the daemon from importing, so they sit outside the @@ -41,7 +45,7 @@ import { SESSION_STATE_FIELD_OWNERS, STORE_OWNED_SESSION_STATE_FIELDS, } from './session-state.ts'; -import { uninstallableImports, zeroDepJobs } from './zero-dep-jobs.ts'; +import { uninstallableImports, zeroDepClosureFiles, zeroDepJobs } from './zero-dep-jobs.ts'; import { backEdgePair, findValueImportCycles, @@ -57,6 +61,11 @@ import { daemonModularitySummary, TYPE_CYCLE_BASELINE, } from './daemon-modularity.ts'; +import { + checkPackageBoundaries, + packageBoundariesSummary, + workspaceSpecifierTargets, +} from './package-boundaries.ts'; import { policyLead, policyViolation, ZONE_POLICIES } from './zone-policy.ts'; const repoRoot = execFileSync('git', ['rev-parse', '--show-toplevel'], { @@ -67,10 +76,17 @@ export function listSourceFiles(): string[] { // `src/**/*.ts` only matches nested files; root-level `src/*.ts` (e.g. // src/cli.ts, src/command-catalog.ts) needs its own pathspec or it silently // drops out of cycle/back-edge analysis. - const out = execFileSync('git', ['ls-files', 'src/*.ts', 'src/**/*.ts'], { - cwd: repoRoot, - encoding: 'utf8', - }); + // Workspace package sources are production files too (#1490 W0): R4 cycle + // rejection and the zone staleness guard must see them, and workspace + // specifiers resolve across the seam in resolveTargetFile. + const out = execFileSync( + 'git', + ['ls-files', 'src/*.ts', 'src/**/*.ts', 'packages/*/src/*.ts', 'packages/*/src/**/*.ts'], + { + cwd: repoRoot, + encoding: 'utf8', + }, + ); return out.split('\n').filter(Boolean).filter(isProductionSourceFile); } @@ -354,7 +370,7 @@ function checkSessionStateOwnership(sources: ReadonlyMap): Layer // R8: a CI job that runs with `install-deps: false` has no `node_modules`, so every script it // reaches must import only Node builtins and other repo files. Locally the opposite is true — // `node_modules` is always present — which is why this needs a gate rather than a convention. -function checkZeroDepJobs(): LayeringViolation[] { +function repoZeroDepJobs() { const workflows = readSources( execFileSync('git', ['ls-files', '.github/workflows/*.yml'], { cwd: repoRoot, @@ -367,9 +383,12 @@ function checkZeroDepJobs(): LayeringViolation[] { scripts?: Record; }; const packageScripts = new Map(Object.entries(packageJson.scripts ?? {})); + return zeroDepJobs(workflows, fileExists, packageScripts); +} +function checkZeroDepJobs(): LayeringViolation[] { const violations: LayeringViolation[] = []; - for (const job of zeroDepJobs(workflows, fileExists, packageScripts)) { + for (const job of repoZeroDepJobs()) { // Fail closed: a zero-dep job whose commands the entry scan cannot recognize would // otherwise be silently exempt from the rule it is the whole reason for. if (job.entries.length === 0) { @@ -417,13 +436,13 @@ function report( ): number { if (violations.length === 0) { process.stdout.write( - `Layering guard: OK — ${files.length} source files satisfy R1-R3 and contain no ` + + `Layering guard: OK — ${files.length} source files satisfy R2-R3 and contain no ` + `value-import cycles (both checked globally); the ranked target spine contains no ` + `back-edges (only the composition root is unranked), and its type-only ` + `inversions match the R6 ratchet (${Object.values(TYPE_INVERSION_BASELINE).reduce((sum, count) => sum + count, 0)} remaining); ` + `all ${sessionStateFieldCount()} SessionState fields are classified and every write is ` + `inside its declared owner (R7); every zero-dep CI job resolves without ` + - `node_modules (R8); ${typeCycleNote(typeCycle)}; and ${daemonModularitySummary()}.\n`, + `node_modules (R8); ${typeCycleNote(typeCycle)}; ${daemonModularitySummary()}; and ${packageBoundariesSummary(repoRoot)}.\n`, ); return 0; } @@ -452,7 +471,7 @@ function report( export function main(): number { const sourceFiles = listSourceFiles(); const sources = readSources(sourceFiles); - const edges = resolveImportEdges(sources); + const edges = resolveImportEdges(sources, workspaceSpecifierTargets(repoRoot)); // Computed once and threaded: the rule and the success line must report the same number. const typeCycleMembers = largestTypeCycleMembers(edges); const typeCycle = typeCycleMembers.length; @@ -464,6 +483,10 @@ export function main(): number { ...checkSessionStateOwnership(sources), ...checkDaemonModularityRatchets(edges, typeCycleMembers), ...checkZeroDepJobs(), + ...checkPackageBoundaries( + repoRoot, + zeroDepClosureFiles(repoZeroDepJobs(), readSourceOrNull, fileExists), + ), ]; return report(sourceFiles, violations, typeCycle); } diff --git a/scripts/layering/model.test.ts b/scripts/layering/model.test.ts index 1ac31f869..5afdc1123 100644 --- a/scripts/layering/model.test.ts +++ b/scripts/layering/model.test.ts @@ -119,7 +119,7 @@ test('type-only edges are ranked by R6 and ignored by R5, and vice versa', () => ['src/client/client-types.ts', 'export type Shape = { a: 1 };'], ['src/contracts/value.ts', "import '../core/logic.ts';"], ['src/core/logic.ts', 'export const logic = true;'], - ['src/kernel/lazy.ts', "void import('../commands/surface.ts');"], + ['src/contracts/lazy.ts', "void import('../commands/surface.ts');"], ]), ); @@ -144,7 +144,7 @@ test('ranked and unranked zones are disjoint and both non-empty', () => { }); test('classifyZone separates the ranked spine from intentionally-unranked zones', () => { - assert.equal(classifyZone('kernel'), 'ranked'); + assert.equal(classifyZone('contracts'), 'ranked'); assert.equal(classifyZone('daemon-server'), 'ranked'); assert.equal(classifyZone('(root)'), 'unranked'); assert.equal(classifyZone('utils'), 'ranked'); @@ -529,7 +529,18 @@ test("the repo's own zero-dep jobs resolve without node_modules", () => { exists, packageScripts, ); - assert.ok(jobs.length > 0, 'expected ci.yml to still declare at least one zero-dep job'); + // #1490 W0 removed the last zero-dep job: affected-selector's entry closure + // reaches `@agent-device/kernel` workspace specifiers through src/utils, and + // the R8 relative-import exception is unsafe for production src files (Node's + // ESM loader does not realpath, so a file loaded both relatively and via its + // package specifier would instantiate twice in one process — duplicate + // AppError, broken instanceof). Pin the empty set deliberately: a NEW + // zero-dep job re-engages R8 automatically and must update this expectation. + assert.deepEqual( + jobs.map((job) => job.job), + [], + 'zero-dep jobs changed: verify the new job satisfies R8 and update this pin', + ); for (const job of jobs) { assert.ok(job.entries.length > 0, `${job.job} must name an entry script`); assert.deepEqual( diff --git a/scripts/layering/model.ts b/scripts/layering/model.ts index 40dc4224a..0c58dc79f 100644 --- a/scripts/layering/model.ts +++ b/scripts/layering/model.ts @@ -31,7 +31,6 @@ export type BackEdgeMap = Record; // ranked here or listed as unranked — `unclassifiedZones` and `model.test.ts` guard // that no zone is silently unclassified. const TARGET_DAG_RANK = new Map([ - ['kernel', 0], ['cloud-webdriver', 1], ['contracts', 1], ['platforms', 1], @@ -79,7 +78,10 @@ export function zoneRank(zone: string): number | null { // invent an order the architecture had not committed to. Once `utils` joined the spine and // `(root)` was emptied of shared contracts, every one of them turned out to have a // consistent rank already — so the order was there, just unasserted. -export const UNRANKED_ZONES: ReadonlySet = new Set(['(root)']); +// 'kernel' is unranked because it is no longer a src/ zone at all: it lives in +// packages/kernel (#1490 W0), R11 package-boundaries owns that seam, and its +// zone name only appears in graphs that follow workspace specifiers. +export const UNRANKED_ZONES: ReadonlySet = new Set(['(root)', 'kernel']); export type ZoneClassification = 'ranked' | 'unranked' | 'unclassified'; @@ -156,6 +158,8 @@ export function parseImports(source: string): ImportEdge[] { } export function topFolder(file: string): string { + const packageMatch = /^packages\/([^/]+)\//.exec(file); + if (packageMatch) return packageMatch[1]!; const match = /^src\/([^/]+)\//.exec(file); return match ? match[1]! : '(root)'; } @@ -183,7 +187,27 @@ function resolveTargetFile( fromFile: string, spec: string, sourceFiles: ReadonlySet, + workspaceExportTargets?: ReadonlyMap, ): string | null { + if (spec.startsWith('@agent-device/')) { + // Workspace specifier (#1490 W0). Real runs pass the exports-derived map + // (workspaceSpecifierTargets), which is authoritative — it handles '.' + // facade exports and any source layout. The positional fallback exists + // only for map-less fixtures (the P0-pinned depgraph contract) and cannot + // resolve a bare facade specifier by construction. + if (workspaceExportTargets) { + const target = workspaceExportTargets.get(spec); + return target !== undefined && sourceFiles.has(target) ? target : null; + } + const [name, ...subParts] = spec.slice('@agent-device/'.length).split('/'); + const sub = subParts.join('/'); + if (!name || !sub) return null; + return ( + [`packages/${name}/src/${sub}.ts`, `src/${name}/${sub}.ts`].find((candidate) => + sourceFiles.has(candidate), + ) ?? null + ); + } if (!spec.startsWith('.')) return null; const resolved = path.posix.normalize(path.posix.join(path.posix.dirname(fromFile), spec)); if (!resolved.startsWith('src/')) return null; @@ -196,12 +220,15 @@ function resolveTargetFile( return candidates.find((candidate) => sourceFiles.has(candidate)) ?? null; } -export function resolveImportEdges(sources: ReadonlyMap): ResolvedImportEdge[] { +export function resolveImportEdges( + sources: ReadonlyMap, + workspaceExportTargets?: ReadonlyMap, +): ResolvedImportEdge[] { const sourceFiles = new Set(sources.keys()); const edges: ResolvedImportEdge[] = []; for (const [file, source] of sources) { for (const edge of parseImports(source)) { - const target = resolveTargetFile(file, edge.spec, sourceFiles); + const target = resolveTargetFile(file, edge.spec, sourceFiles, workspaceExportTargets); if (!target) continue; edges.push({ ...edge, diff --git a/scripts/layering/package-boundaries.test.ts b/scripts/layering/package-boundaries.test.ts new file mode 100644 index 000000000..92b9e8fd2 --- /dev/null +++ b/scripts/layering/package-boundaries.test.ts @@ -0,0 +1,202 @@ +// R11 package-boundaries fires on every bypass and holds on the one exception. +// Necessary for the same reason as zone-policy.test.ts: the real tree is clean, +// so a rule that stopped matching would look exactly like a rule being obeyed. + +import assert from 'node:assert/strict'; +import path from 'node:path'; +import { test } from 'node:test'; +import { + checkPackageBoundaries, + checkPackageInternalSites, + checkRootSites, + readWorkspacePackages, + rootWorkspaceDependencyNames, + specifierSites, + type WorkspacePackage, +} from './package-boundaries.ts'; + +const kernel: WorkspacePackage = { + dir: 'packages/kernel', + name: '@agent-device/kernel', + exportTargets: new Map([ + ['@agent-device/kernel/errors', 'packages/kernel/src/errors.ts'], + ['@agent-device/kernel/device', 'packages/kernel/src/device.ts'], + ]), + workspaceDependencies: new Set(), +}; + +const contracts: WorkspacePackage = { + dir: 'packages/contracts', + name: '@agent-device/contracts', + exportTargets: new Map([ + ['@agent-device/contracts/gesture', 'packages/contracts/src/gesture.ts'], + ]), + workspaceDependencies: new Set(['@agent-device/kernel']), +}; + +const ALL = [kernel, contracts]; + +function rules(violations: { rule: string }[]): string[] { + return violations.map((violation) => violation.rule); +} + +test('specifier sites carry 1-based lines for static and dynamic imports', () => { + const sites = specifierSites( + 'src/a.ts', + ["import { x } from './b.ts';", '', "void import('../c.ts');"].join('\n'), + ); + assert.deepEqual( + sites.map(({ specifier, line }) => `${line}:${specifier}`), + ['1:./b.ts', '3:../c.ts'], + ); +}); + +test('double-quoted and re-export routes into packages are not invisible to R11', () => { + // The scanner is the layering parser, so quote style and statement form + // cannot carve out a bypass: a double-quoted import, a re-export, and a + // double-quoted dynamic import into packages/*/src all reach the rule. + const doubleQuoted = specifierSites( + 'src/utils/exec.ts', + 'import { AppError } from "../../packages/kernel/src/errors.ts";', + ); + assert.equal(checkRootSites(doubleQuoted, ALL, new Set([kernel.name]), new Set()).length, 1); + + const reExport = specifierSites( + 'src/utils/exec.ts', + 'export { AppError } from "../../packages/kernel/src/errors.ts";', + ); + assert.equal(checkRootSites(reExport, ALL, new Set([kernel.name]), new Set()).length, 1); + + const dynamic = specifierSites( + 'src/utils/exec.ts', + 'void import("../../packages/kernel/src/errors.ts");', + ); + assert.equal(checkRootSites(dynamic, ALL, new Set([kernel.name]), new Set()).length, 1); + + const packageEscape = specifierSites( + 'packages/kernel/src/errors.ts', + 'export * from "../../../src/utils/exec.ts";', + ); + assert.equal(checkPackageInternalSites(kernel, packageEscape, ALL).length, 1); +}); + +test('a package file importing root src is a violation', () => { + const sites = specifierSites( + 'packages/kernel/src/errors.ts', + "import { helper } from '../../../src/utils/exec.ts';", + ); + assert.deepEqual(rules(checkPackageInternalSites(kernel, sites, ALL)), [ + 'R11 package-boundaries', + ]); +}); + +test('intra-package relative imports hold', () => { + const sites = specifierSites( + 'packages/kernel/src/daemon-error.ts', + "import { AppError } from './errors.ts';", + ); + assert.deepEqual(checkPackageInternalSites(kernel, sites, ALL), []); +}); + +test('a cross-package import needs a workspace:* declaration and an exported subpath', () => { + const declared = specifierSites( + 'packages/contracts/src/gesture.ts', + "import { AppError } from '@agent-device/kernel/errors';", + ); + assert.deepEqual(checkPackageInternalSites(contracts, declared, ALL), []); + + const undeclared = specifierSites( + 'packages/kernel/src/errors.ts', + "import { g } from '@agent-device/contracts/gesture';", + ); + assert.equal(checkPackageInternalSites(kernel, undeclared, ALL).length, 1); + + const deep = specifierSites( + 'packages/contracts/src/gesture.ts', + "import { internal } from '@agent-device/kernel/internal/secret';", + ); + assert.equal(checkPackageInternalSites(contracts, deep, ALL).length, 1); +}); + +test('a root src file tunnelling into packages/*/src relatively is a violation', () => { + const sites = specifierSites( + 'src/utils/exec.ts', + "import { AppError } from '../../packages/kernel/src/errors.ts';", + ); + const violations = checkRootSites(sites, ALL, new Set([kernel.name]), new Set()); + assert.deepEqual(rules(violations), ['R11 package-boundaries']); + assert.match(violations[0]!.message, /instantiate the module twice/); +}); + +test('the R8 exception requires zero-dep closure membership AND an exports-named target', () => { + const closure = new Set(['scripts/some-tool/run.ts']); + const allowed = specifierSites( + 'scripts/some-tool/run.ts', + "import { AppError } from '../../packages/kernel/src/errors.ts';", + ); + assert.deepEqual(checkRootSites(allowed, ALL, new Set([kernel.name]), closure), []); + + // Same import, but the file is NOT in any zero-dep closure: scripts/ + // placement alone proves nothing about dual instantiation. + assert.equal(checkRootSites(allowed, ALL, new Set([kernel.name]), new Set()).length, 1); + + const nonExported = specifierSites( + 'scripts/some-tool/run.ts', + "import { hidden } from '../../packages/kernel/src/internal.ts';", + ); + assert.equal(checkRootSites(nonExported, ALL, new Set([kernel.name]), closure).length, 1); +}); + +test('root workspace specifiers need a root workspace:* entry and an exported subpath', () => { + const fine = specifierSites( + 'src/cli.ts', + "import { AppError } from '@agent-device/kernel/errors';", + ); + assert.deepEqual(checkRootSites(fine, ALL, new Set([kernel.name])), []); + + const undeclared = checkRootSites(fine, ALL, new Set()); + assert.equal(undeclared.length, 1); + assert.match(undeclared[0]!.message, /workspace:\*/); + + const deep = specifierSites( + 'src/cli.ts', + "import { x } from '@agent-device/kernel/src/errors.ts';", + ); + assert.equal(checkRootSites(deep, ALL, new Set([kernel.name]), new Set()).length, 1); + + const unknown = specifierSites('src/cli.ts', "import { x } from '@agent-device/nope/thing';"); + assert.equal(checkRootSites(unknown, ALL, new Set([kernel.name]), new Set()).length, 1); +}); + +test('the real tree parses, declares, and passes R11', () => { + const repoRoot = path.resolve(import.meta.dirname, '../..'); + const packages = readWorkspacePackages(repoRoot); + assert.ok(packages.length >= 1, 'expected at least the kernel package'); + const kernelPackage = packages.find((pkg) => pkg.name === '@agent-device/kernel'); + assert.ok(kernelPackage, 'kernel package must exist'); + assert.ok(kernelPackage.exportTargets.size >= 8, 'kernel exports its vocabulary subpaths'); + assert.ok( + rootWorkspaceDependencyNames(repoRoot).has('@agent-device/kernel'), + 'root must declare the kernel workspace dependency', + ); + assert.deepEqual(checkPackageBoundaries(repoRoot, new Set()), []); +}); + +test('Node resolution enforces the exports map at runtime', () => { + // Real resolver, not the gate's model: a deep import is a resolution error, + // and the legal subpath realpaths OUTSIDE node_modules (pnpm symlink), which + // is what lets --experimental-strip-types load package sources in dev. + const resolved = import.meta.resolve('@agent-device/kernel/errors'); + assert.ok(resolved.endsWith('packages/kernel/src/errors.ts'), resolved); + for (const deep of [ + '@agent-device/kernel/src/errors.ts', + '@agent-device/kernel/internal-not-exported', + '@agent-device/kernel', + ]) { + assert.throws( + () => import.meta.resolve(deep), + /ERR_PACKAGE_PATH_NOT_EXPORTED|Package subpath|No "exports" main/, + `${deep} must not resolve`, + ); + } +}); diff --git a/scripts/layering/package-boundaries.ts b/scripts/layering/package-boundaries.ts new file mode 100644 index 000000000..e3727464e --- /dev/null +++ b/scripts/layering/package-boundaries.ts @@ -0,0 +1,322 @@ +// R11 package-boundaries: the workspace rules of #1490, as data the gate walks. +// +// Package resolution already makes a deep `@agent-device/*` specifier a runtime +// resolution error; these checks close the bypasses resolution alone cannot see: +// a package reaching back into root `src/`, a root file tunnelling into +// `packages/*/src` with a relative path, an import of a workspace package the +// manifest never declared, and a specifier subpath the owning `exports` map +// does not name. +// +// The single tolerated relative route into a package is an R8 zero-dep script +// importing an exports-named source target. That exception is exactly +// co-extensive with safety: Node's ESM loader does not realpath specifiers, so +// a module loaded BOTH relatively and via its package specifier instantiates +// twice in one process (duplicate AppError, broken instanceof). A zero-dep +// closure can never coexist with specifier loads — no node_modules — which is +// the only reason the exception exists at all. Production src/test files never +// qualify. + +import fs from 'node:fs'; +import path from 'node:path'; +import { parseImports } from './model.ts'; + +export type PackageBoundaryViolation = { + rule: string; + file: string; + line: number; + message: string; +}; + +export type WorkspacePackage = { + /** Repo-relative package dir, e.g. `packages/kernel`. */ + dir: string; + name: string; + /** Full import specifier -> repo-relative source target, from `exports`. */ + exportTargets: ReadonlyMap; + /** Declared `workspace:*` dependencies on sibling internal packages. */ + workspaceDependencies: ReadonlySet; +}; + +export type SpecifierSite = { + file: string; + line: number; + specifier: string; +}; + +/** + * Every import specifier in `source`, with its 1-based line — through the + * layering model's own parser, so static/dynamic/side-effect/re-export sites + * and both quote styles are covered by one scanner instead of a private regex + * that silently missed double-quoted routes. + */ +export function specifierSites(file: string, source: string): SpecifierSite[] { + return parseImports(source).map((edge) => ({ file, line: edge.line, specifier: edge.spec })); +} + +export function readWorkspacePackages(repoRoot: string): WorkspacePackage[] { + const packagesDir = path.join(repoRoot, 'packages'); + if (!fs.existsSync(packagesDir)) return []; + const packages: WorkspacePackage[] = []; + for (const entry of fs.readdirSync(packagesDir).sort()) { + const manifestPath = path.join(packagesDir, entry, 'package.json'); + if (!fs.existsSync(manifestPath)) continue; + const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8')) as { + name?: string; + private?: boolean; + exports?: Record; + dependencies?: Record; + }; + if (!manifest.name) continue; + const exportTargets = new Map(); + for (const [subpath, target] of Object.entries(manifest.exports ?? {})) { + const targetFile = typeof target === 'string' ? target : target.default; + if (!targetFile) continue; + exportTargets.set( + path.posix.join(manifest.name, subpath), + path.posix.join('packages', entry, path.posix.normalize(targetFile)), + ); + } + const workspaceDependencies = new Set( + Object.entries(manifest.dependencies ?? {}) + .filter(([, range]) => range.startsWith('workspace:')) + .map(([name]) => name), + ); + packages.push({ + dir: `packages/${entry}`, + name: manifest.name, + exportTargets, + workspaceDependencies, + }); + } + return packages; +} + +function packageByName(packages: readonly WorkspacePackage[], name: string) { + return packages.find((pkg) => pkg.name === name); +} + +function specifierPackageName(specifier: string): string | undefined { + const match = /^(@[^/]+\/[^/]+)/.exec(specifier); + return match?.[1]; +} + +/** + * Rules for files INSIDE a package: no relative escape past the package dir, + * and any sibling-package import must be declared `workspace:*` and name an + * exported subpath. + */ +export function checkPackageInternalSites( + pkg: WorkspacePackage, + sites: readonly SpecifierSite[], + allPackages: readonly WorkspacePackage[], +): PackageBoundaryViolation[] { + const violations: PackageBoundaryViolation[] = []; + for (const site of sites) { + if (site.specifier.startsWith('.')) { + const resolved = path.posix.normalize( + path.posix.join(path.posix.dirname(site.file), site.specifier), + ); + if (!resolved.startsWith(`${pkg.dir}/`)) { + violations.push({ + rule: 'R11 package-boundaries', + file: site.file, + line: site.line, + message: + `'${site.specifier}' escapes ${pkg.dir}/ — a workspace package may not reach root ` + + `code. Depend on another package's specifier, or move the shared code below this package.`, + }); + } + continue; + } + const name = specifierPackageName(site.specifier); + if (!name || !name.startsWith('@agent-device/')) continue; + const target = packageByName(allPackages, name); + if (!target) { + violations.push({ + rule: 'R11 package-boundaries', + file: site.file, + line: site.line, + message: `'${site.specifier}' names an unknown workspace package.`, + }); + continue; + } + if (!pkg.workspaceDependencies.has(name)) { + violations.push({ + rule: 'R11 package-boundaries', + file: site.file, + line: site.line, + message: + `${pkg.name} imports '${site.specifier}' without declaring "${name}": "workspace:*" ` + + `in ${pkg.dir}/package.json dependencies.`, + }); + } + if (!target.exportTargets.has(site.specifier)) { + violations.push({ + rule: 'R11 package-boundaries', + file: site.file, + line: site.line, + message: + `'${site.specifier}' is not named by ${target.dir}/package.json#exports — import an ` + + `exported subpath or earn a new one with a real consumer.`, + }); + } + } + return violations; +} + +/** + * Rules for files OUTSIDE packages/ (src, test, scripts): workspace specifiers + * must be root-declared and exports-named; relative paths into `packages/·/src` + * are forbidden except the R8 zero-dep exception — a `scripts/` file importing + * an exports-named source target. + */ +export function checkRootSites( + sites: readonly SpecifierSite[], + packages: readonly WorkspacePackage[], + rootWorkspaceDependencies: ReadonlySet, + zeroDepClosureFiles: ReadonlySet, +): PackageBoundaryViolation[] { + const violations: PackageBoundaryViolation[] = []; + const exportedSources = new Set(packages.flatMap((pkg) => [...pkg.exportTargets.values()])); + for (const site of sites) { + if (site.specifier.startsWith('.')) { + const resolved = path.posix.normalize( + path.posix.join(path.posix.dirname(site.file), site.specifier), + ); + if (!/^packages\/[^/]+\//.test(resolved)) continue; + // The R8 exception requires BOTH membership in an actual zero-dep job + // closure (no node_modules -> no coexisting specifier loads -> no dual + // instantiation) AND an exports-named target. `scripts/` placement alone + // proves neither. + const inZeroDepClosure = zeroDepClosureFiles.has(site.file); + if (inZeroDepClosure && exportedSources.has(resolved)) continue; + violations.push({ + rule: 'R11 package-boundaries', + file: site.file, + line: site.line, + message: inZeroDepClosure + ? `'${site.specifier}' targets a non-exported package source — the R8 exception only ` + + `covers files named by the package's exports map.` + : `'${site.specifier}' bypasses the package boundary — import the package specifier ` + + `instead. The relative route is reserved for files inside an R8 zero-dep job ` + + `closure; anywhere else, dual specifier/relative loads would instantiate the ` + + `module twice.`, + }); + continue; + } + const name = specifierPackageName(site.specifier); + if (!name || !name.startsWith('@agent-device/')) continue; + const target = packageByName(packages, name); + if (!target) { + violations.push({ + rule: 'R11 package-boundaries', + file: site.file, + line: site.line, + message: `'${site.specifier}' names an unknown workspace package.`, + }); + continue; + } + if (!rootWorkspaceDependencies.has(name)) { + violations.push({ + rule: 'R11 package-boundaries', + file: site.file, + line: site.line, + message: + `'${site.specifier}' is used but "${name}" is not a "workspace:*" entry in the root ` + + `package.json devDependencies.`, + }); + } + if (!target.exportTargets.has(site.specifier)) { + violations.push({ + rule: 'R11 package-boundaries', + file: site.file, + line: site.line, + message: + `'${site.specifier}' is not named by ${target.dir}/package.json#exports — deep imports ` + + `into package internals are a resolution error; import an exported subpath.`, + }); + } + } + return violations; +} + +/** Root-manifest `workspace:*` names, from dependencies + devDependencies. */ +export function rootWorkspaceDependencyNames(repoRoot: string): Set { + const manifest = JSON.parse(fs.readFileSync(path.join(repoRoot, 'package.json'), 'utf8')) as { + dependencies?: Record; + devDependencies?: Record; + }; + return new Set( + Object.entries({ ...manifest.dependencies, ...manifest.devDependencies }) + .filter(([, range]) => range.startsWith('workspace:')) + .map(([name]) => name), + ); +} + +function walkTsFiles(repoRoot: string, relativeDir: string): string[] { + const absolute = path.join(repoRoot, relativeDir); + if (!fs.existsSync(absolute)) return []; + const files: string[] = []; + const queue = [absolute]; + while (queue.length > 0) { + const dir = queue.pop()!; + for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { + const full = path.join(dir, entry.name); + if (entry.isDirectory()) { + if (entry.name !== 'node_modules' && entry.name !== 'dist-types') queue.push(full); + } else if (entry.name.endsWith('.ts') && !entry.name.endsWith('.d.ts')) { + files.push(path.relative(repoRoot, full).replaceAll(path.sep, '/')); + } + } + } + return files.sort(); +} + +/** Flat `specifier -> repo-relative source` map across all workspace packages. */ +export function workspaceSpecifierTargets(repoRoot: string): Map { + const targets = new Map(); + for (const pkg of readWorkspacePackages(repoRoot)) { + for (const [specifier, target] of pkg.exportTargets) targets.set(specifier, target); + } + return targets; +} + +/** The real-tree R11 run used by check.ts. */ +export function checkPackageBoundaries( + repoRoot: string, + zeroDepClosure: ReadonlySet, +): PackageBoundaryViolation[] { + const packages = readWorkspacePackages(repoRoot); + if (packages.length === 0) return []; + const rootDependencies = rootWorkspaceDependencyNames(repoRoot); + const violations: PackageBoundaryViolation[] = []; + for (const pkg of packages) { + for (const file of walkTsFiles(repoRoot, pkg.dir)) { + const source = fs.readFileSync(path.join(repoRoot, file), 'utf8'); + violations.push(...checkPackageInternalSites(pkg, specifierSites(file, source), packages)); + } + } + for (const root of ['src', 'test', 'scripts']) { + for (const file of walkTsFiles(repoRoot, root)) { + // Gate tests under scripts/ carry import syntax inside fixture strings + // (same reason R8 parses module records instead of scanning lines); + // src/ and test/ suites stay covered — they import packages for real. + if (root === 'scripts' && file.endsWith('.test.ts')) continue; + const source = fs.readFileSync(path.join(repoRoot, file), 'utf8'); + violations.push( + ...checkRootSites(specifierSites(file, source), packages, rootDependencies, zeroDepClosure), + ); + } + } + return violations; +} + +/** Success-line fragment for check.ts's report. */ +export function packageBoundariesSummary(repoRoot: string): string { + const packages = readWorkspacePackages(repoRoot); + const exported = packages.reduce((sum, pkg) => sum + pkg.exportTargets.size, 0); + return ( + `R11 holds ${packages.length} workspace package(s) behind ${exported} exported subpath(s) ` + + `with zero root back-imports` + ); +} diff --git a/scripts/layering/zero-dep-jobs.ts b/scripts/layering/zero-dep-jobs.ts index 3af9bc985..ddac7d741 100644 --- a/scripts/layering/zero-dep-jobs.ts +++ b/scripts/layering/zero-dep-jobs.ts @@ -220,11 +220,11 @@ function resolveRelative( * A relative import that resolves to nothing is left alone — that is a broken import, which * typecheck reports far better than this can. */ -export function uninstallableImports( +function walkJobClosure( job: ZeroDepJob, readSource: (file: string) => string | null, fileExists: (file: string) => boolean, -): UninstallableImport[] { +): { visited: Set; found: UninstallableImport[] } { const found: UninstallableImport[] = []; const visited = new Set(); const queue = [...job.entries]; @@ -246,6 +246,33 @@ export function uninstallableImports( found.push({ workflow: job.workflow, job: job.job, file, line, spec }); } } - - return found.sort((left, right) => left.file.localeCompare(right.file) || left.line - right.line); + return { visited, found }; +} + +export function uninstallableImports( + job: ZeroDepJob, + readSource: (file: string) => string | null, + fileExists: (file: string) => boolean, +): UninstallableImport[] { + return walkJobClosure(job, readSource, fileExists).found.sort( + (left, right) => left.file.localeCompare(right.file) || left.line - right.line, + ); +} + +/** + * Every repo file reachable from a zero-dep job's entries. R11 grants its + * relative-into-packages exception ONLY to these files: a zero-dep closure can + * never coexist with specifier loads (no node_modules), which is what makes a + * relative package-source import safe from dual instantiation. + */ +export function zeroDepClosureFiles( + jobs: readonly ZeroDepJob[], + readSource: (file: string) => string | null, + fileExists: (file: string) => boolean, +): Set { + const files = new Set(); + for (const job of jobs) { + for (const file of walkJobClosure(job, readSource, fileExists).visited) files.add(file); + } + return files; } diff --git a/scripts/layering/zone-policy.test.ts b/scripts/layering/zone-policy.test.ts index 3f4854bda..d9b15b804 100644 --- a/scripts/layering/zone-policy.test.ts +++ b/scripts/layering/zone-policy.test.ts @@ -1,8 +1,8 @@ import assert from 'node:assert/strict'; import { test } from 'node:test'; -import { policyLead, policyViolation, ZONE_POLICIES, type ZonePolicy } from './zone-policy.ts'; +import { policyLead, policyViolation, ZONE_POLICIES } from './zone-policy.ts'; -// R1-R3 were three predicate functions with no unit test for eight months: the only thing +// R2-R3 (and the retired R1) were predicate functions with no unit test for eight months: the only thing // exercising them was the real tree, which is clean, so a rule that had silently stopped matching // would have looked exactly like a rule that was being obeyed. These tests assert each boundary // fires AND each documented exemption holds, so the table cannot quietly become decoration. @@ -28,33 +28,8 @@ function firing(e: ReturnType): string[] { return ZONE_POLICIES.filter((policy) => policyViolation(policy, e) !== null).map((p) => p.rule); } -function policiesFor(rule: string): ZonePolicy[] { - return ZONE_POLICIES.filter((policy) => policy.rule === rule); -} - -test('R1 kernel-sink closes every kernel out-edge except a type-only contracts re-export', () => { - // The one open door. - assert.deepEqual( - firing(edge('src/kernel/errors.ts', 'kernel', 'contracts', { typeOnly: true })), - [], - ); - - // Same target, value import: closed. A runtime edge out of the sink is the thing R1 exists for. - assert.deepEqual(firing(edge('src/kernel/errors.ts', 'kernel', 'contracts')), ['R1 kernel-sink']); - - // Any other target is closed to BOTH kinds — unlike R3, R1 does not tolerate type-only, because - // "kernel is declared in terms of utils" is still a claim that kernel is not the sink. - for (const kind of [{}, { typeOnly: true }, { dynamic: true }]) { - assert.deepEqual( - firing(edge('src/kernel/errors.ts', 'kernel', 'utils', kind)), - ['R1 kernel-sink'], - `kernel -> utils ${JSON.stringify(kind)} must violate R1`, - ); - } -}); - test('R2 commands-floor closes the four zones below the command surface, whatever the kind', () => { - for (const zone of ['kernel', 'platforms', 'core', 'daemon']) { + for (const zone of ['platforms', 'core', 'daemon']) { for (const kind of [{}, { typeOnly: true }, { dynamic: true }]) { assert.ok( firing(edge(`src/${zone}/thing.ts`, zone, 'commands', kind)).includes('R2 commands-floor'), @@ -98,9 +73,12 @@ test('every policy carries a hint, and the lead names the kind it rejected', () assert.ok(policy.hint.length > 20, `${policy.rule} needs an actionable hint`); } - assert.match(policyLead(edge('a', 'kernel', 'utils')), /kernel\/ must not import utils\//); assert.match( - policyLead(edge('a', 'kernel', 'commands', { typeOnly: true })), + policyLead(edge('a', 'platforms', 'commands')), + /platforms\/ must not import commands\//, + ); + assert.match( + policyLead(edge('a', 'core', 'commands', { typeOnly: true })), /must not type-only import commands\//, ); assert.match( @@ -120,16 +98,3 @@ test('a policy states its scope with exactly one of `to` or `exceptTo`', () => { ); } }); - -test('R1 is two policies, so the single open door stays visible', () => { - // Collapsing these into one entry with a special case is what made the original predicate hard - // to read. If someone merges them, this fails and says why. - const r1 = policiesFor('R1 kernel-sink'); - assert.equal(r1.length, 2); - assert.deepEqual( - r1.find((p) => p.to)?.tolerates, - ['type-only'], - 'the contracts door is type-only', - ); - assert.equal(r1.find((p) => p.exceptTo)?.tolerates, undefined, 'every other target is closed'); -}); diff --git a/scripts/layering/zone-policy.ts b/scripts/layering/zone-policy.ts index f13e43ceb..c1fba9da7 100644 --- a/scripts/layering/zone-policy.ts +++ b/scripts/layering/zone-policy.ts @@ -43,29 +43,14 @@ export type ZonePolicy = { /** * The policy table. Order is presentation only — every policy is evaluated against every edge. * - * R1 is two entries rather than one with a special case, because "kernel may import contracts - * type-only" and "kernel may import nothing else at all" are genuinely two statements. Writing - * them separately is what makes the single open door visible. + * R1 kernel-sink retired 2026-07-30 (#1490 W0): the kernel moved to + * packages/kernel, where package resolution and R11 package-boundaries enforce + * the sink property physically — a package cannot import root src at all. */ export const ZONE_POLICIES: readonly ZonePolicy[] = [ - { - rule: 'R1 kernel-sink', - from: ['kernel'], - to: ['contracts'], - tolerates: ['type-only'], - hint: 'The only allowed kernel out-edge is a type-only re-export from contracts/.', - }, - { - rule: 'R1 kernel-sink', - from: ['kernel'], - exceptTo: ['contracts'], - hint: - 'kernel is the sink of the import DAG: everything may depend on it and it may depend on ' + - 'nothing. The only allowed kernel out-edge is a type-only re-export from contracts/.', - }, { rule: 'R2 commands-floor', - from: ['kernel', 'platforms', 'core', 'daemon'], + from: ['platforms', 'core', 'daemon'], to: ['commands'], hint: 'commands/ is the command surface, above these zones. Depend on shared kernel/contracts ' + diff --git a/scripts/maestro-conformance/verify.ts b/scripts/maestro-conformance/verify.ts index a6e01aab0..71169e5bd 100644 --- a/scripts/maestro-conformance/verify.ts +++ b/scripts/maestro-conformance/verify.ts @@ -13,7 +13,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; -import { AppError } from '../../src/kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { MaestroProgram } from '../../src/compat/maestro/program-ir.ts'; import { parseMaestroProgram } from '../../src/compat/maestro/program-ir-parser.ts'; import { SUPPORTED_MAESTRO_COMMAND_NAMES } from '../../src/compat/maestro/program-ir-command-parser.ts'; diff --git a/scripts/mutation/envelope.test.ts b/scripts/mutation/envelope.test.ts index ef5e61568..8f28c0b35 100644 --- a/scripts/mutation/envelope.test.ts +++ b/scripts/mutation/envelope.test.ts @@ -100,7 +100,9 @@ test('merging shard reports ignores the envelope sitting beside them', () => { path.join(shards, 'mutation.json'), JSON.stringify({ files: { - 'src/kernel/errors.ts': { mutants: [{ status: 'Killed' }, { status: 'Survived' }] }, + 'packages/kernel/src/errors.ts': { + mutants: [{ status: 'Killed' }, { status: 'Survived' }], + }, }, }), ); @@ -177,7 +179,7 @@ test('an incomplete shard set fails instead of scoring the missing module as zer fs.writeFileSync( path.join(shards, 'mutation.json'), JSON.stringify({ - files: { 'src/kernel/errors.ts': { mutants: [{ status: 'Killed' }] } }, + files: { 'packages/kernel/src/errors.ts': { mutants: [{ status: 'Killed' }] } }, }), ); const result = runMutation([ @@ -239,7 +241,9 @@ test('--fail-envelope downgrades a passing envelope when a later step fails', () fs.writeFileSync( path.join(shards, 'mutation.json'), JSON.stringify({ - files: { 'src/kernel/errors.ts': { mutants: [{ status: 'Killed' }, { status: 'Killed' }] } }, + files: { + 'packages/kernel/src/errors.ts': { mutants: [{ status: 'Killed' }, { status: 'Killed' }] }, + }, }), ); const passing = runMutation([ diff --git a/scripts/mutation/modules.test.ts b/scripts/mutation/modules.test.ts index 046c04d2e..bb7b74b4b 100644 --- a/scripts/mutation/modules.test.ts +++ b/scripts/mutation/modules.test.ts @@ -26,13 +26,13 @@ test('every enumerated kernel path exists', () => { }); test('changed sources map onto the module that owns them', () => { - assert.equal(moduleForFile('src/kernel/errors.ts'), 'kernel-errors'); + assert.equal(moduleForFile('packages/kernel/src/errors.ts'), 'kernel-errors'); assert.equal(moduleForFile('./src/daemon/ref-frame.ts'), 'daemon-ref-frame'); assert.equal(moduleForFile('src/selectors/parse.ts'), 'selectors'); // Selector tests live under the owned prefix; every other kernel's tests are // attributed by ownership.ts, not by this path match. assert.equal(moduleForFile('src/selectors/__tests__/resolve.test.ts'), 'selectors'); - assert.equal(moduleForFile('src/kernel/rect.ts'), undefined); + assert.equal(moduleForFile('packages/kernel/src/rect.ts'), undefined); assert.equal(moduleForFile('README.md'), undefined); }); @@ -41,7 +41,7 @@ test('affected selection is deduplicated and registry-ordered', () => { affectedModules([ 'src/selectors/parse.ts', 'src/selectors/match.ts', - 'src/kernel/errors.ts', + 'packages/kernel/src/errors.ts', 'docs/agents/testing.md', ]), ['kernel-errors', 'selectors'], @@ -51,7 +51,7 @@ test('affected selection is deduplicated and registry-ordered', () => { test('mutate globs default to every module and narrow on request', () => { assert.deepEqual(mutateGlobs(), mutateGlobs(ALL_MODULE_IDS)); - assert.deepEqual(mutateGlobs(['kernel-errors']), ['src/kernel/errors.ts']); + assert.deepEqual(mutateGlobs(['kernel-errors']), ['packages/kernel/src/errors.ts']); }); // One job per module is only affordable while a module fits the lane's budget; diff --git a/scripts/mutation/modules.ts b/scripts/mutation/modules.ts index df398b658..0c36a6e00 100644 --- a/scripts/mutation/modules.ts +++ b/scripts/mutation/modules.ts @@ -41,8 +41,8 @@ export const KERNEL_MODULES: readonly KernelModule[] = [ { id: 'kernel-errors', label: 'Error retriability + hints', - mutate: ['src/kernel/errors.ts'], - owns: ['src/kernel/errors.ts'], + mutate: ['packages/kernel/src/errors.ts'], + owns: ['packages/kernel/src/errors.ts'], }, { id: 'daemon-ref-frame', diff --git a/scripts/mutation/ownership.test.ts b/scripts/mutation/ownership.test.ts index 40582d37d..2ff3b61e5 100644 --- a/scripts/mutation/ownership.test.ts +++ b/scripts/mutation/ownership.test.ts @@ -16,7 +16,7 @@ const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../ test('a kernel is owned by the mirrored test that imports it directly', () => { const deriver = ownershipDeriver(repoRoot); - assert.deepEqual(deriver.ownersOf('src/kernel/__tests__/errors-code-policy.test.ts'), [ + assert.deepEqual(deriver.ownersOf('src/__tests__/kernel/errors-code-policy.test.ts'), [ 'kernel-errors', ]); assert.ok( @@ -30,7 +30,7 @@ test('a kernel is owned by the mirrored test that imports it directly', () => { }); // The omission that hand-listed ownership could not see: this test asserts over -// normalizeError without importing src/kernel/errors.ts itself. +// normalizeError without importing packages/kernel/src/errors.ts itself. test('a kernel is owned by tests that reach it indirectly', () => { const deriver = ownershipDeriver(repoRoot); assert.ok( @@ -71,10 +71,13 @@ test('ownership is complete: every test reaching a kernel owns it', () => { }); test('non-kernel sources and non-tests are not owned', () => { - assert.deepEqual(derivedAffectedModules(['README.md', 'src/kernel/rect.ts'], repoRoot), []); - assert.ok(!isTestFile('src/kernel/errors.ts')); + assert.deepEqual( + derivedAffectedModules(['README.md', 'packages/kernel/src/rect.ts'], repoRoot), + [], + ); + assert.ok(!isTestFile('packages/kernel/src/errors.ts')); assert.ok(!isTestFile('scripts/mutation/ownership.test.ts')); - assert.ok(isTestFile('src/kernel/__tests__/errors-code-policy.test.ts')); + assert.ok(isTestFile('src/__tests__/kernel/errors-code-policy.test.ts')); }); test('derived selection unions source ownership with test reachability', () => { diff --git a/scripts/mutation/ownership.ts b/scripts/mutation/ownership.ts index 571c71e1c..1045e0d31 100644 --- a/scripts/mutation/ownership.ts +++ b/scripts/mutation/ownership.ts @@ -21,6 +21,7 @@ import fs from 'node:fs'; import path from 'node:path'; +import { workspaceSpecifierTargets } from '../layering/package-boundaries.ts'; import { walkFiles } from '../lib/walk-files.ts'; import { affectedModules, @@ -37,18 +38,41 @@ export function isTestFile(filePath: string): boolean { return normalized.startsWith('src/') && normalized.endsWith('.test.ts'); } -/** Repository-relative modules a file imports, following relative specifiers only. */ +/** + * Workspace package specifiers resolved through the shared exports-map reader + * (scripts/layering/package-boundaries.ts) — never hand-listed. Without this + * the graph walk stops at every `@agent-device/*` edge and a kernel living in + * `packages/` silently loses all of its owned tests. + */ +let cachedExportTargets: { repoRoot: string; targets: Map } | undefined; + +function exportTargetsFor(repoRoot: string): Map { + if (cachedExportTargets?.repoRoot !== repoRoot) { + cachedExportTargets = { repoRoot, targets: workspaceSpecifierTargets(repoRoot) }; + } + return cachedExportTargets.targets; +} + +/** + * Repository-relative modules a file imports: relative specifiers plus + * workspace package specifiers resolved through their `exports` maps. + */ function importsOf(file: string, repoRoot: string, cache: Map): string[] { const cached = cache.get(file); if (cached) return cached; const absolute = path.join(repoRoot, file); const text = fs.existsSync(absolute) ? fs.readFileSync(absolute, 'utf8') : ''; - const specifiers = [...text.matchAll(/(?:from|import)\s*\(?\s*'(?\.[^']+)'/g)].map( + const specifiers = [...text.matchAll(/(?:from|import)\s*\(?\s*'(?[.@][^']+)'/g)].map( (match) => match.groups!.spec, ); + const exportTargets = exportTargetsFor(repoRoot); const resolved = [ ...new Set( specifiers.flatMap((specifier) => { + if (specifier.startsWith('@')) { + const target = exportTargets.get(specifier); + return target && fs.existsSync(path.join(repoRoot, target)) ? [target] : []; + } const base = path.posix.normalize(path.posix.join(path.posix.dirname(file), specifier)); return [base, `${base}.ts`, `${base}/index.ts`].filter((candidate) => fs.existsSync(path.join(repoRoot, candidate)), diff --git a/scripts/mutation/ratchet.test.ts b/scripts/mutation/ratchet.test.ts index 40dd3a92b..4c9d9e3de 100644 --- a/scripts/mutation/ratchet.test.ts +++ b/scripts/mutation/ratchet.test.ts @@ -22,7 +22,7 @@ const NOW = '2026-07-27T00:00:00.000Z'; function mutants(statuses: readonly string[]): StrykerReport { return { files: { - 'src/kernel/errors.ts': { + 'packages/kernel/src/errors.ts': { mutants: statuses.map((status, index) => ({ status, mutatorName: 'ConditionalExpression', @@ -83,7 +83,7 @@ test('a lowered score is a regression, and gating makes it fail with its survivo const markdown = renderReport(result, baseline, PROVENANCE); assert.match(markdown, /Surviving mutants:/); - assert.match(markdown, /`src\/kernel\/errors\.ts:2` ConditionalExpression/); + assert.match(markdown, /`packages\/kernel\/src\/errors\.ts:2` ConditionalExpression/); assert.match(markdown, /scores may only rise/); }); diff --git a/scripts/mutation/test-scope.test.ts b/scripts/mutation/test-scope.test.ts index 271f9e645..665f27d99 100644 --- a/scripts/mutation/test-scope.test.ts +++ b/scripts/mutation/test-scope.test.ts @@ -8,7 +8,7 @@ const repoRoot = path.resolve(import.meta.dirname, '../..'); test('mutate globs expand to real kernel sources and exclude selector tests', () => { const files = expandMutateFiles(mutateGlobs(), repoRoot); - assert.ok(files.includes('src/kernel/errors.ts')); + assert.ok(files.includes('packages/kernel/src/errors.ts')); assert.ok(files.some((file) => file.startsWith('src/selectors/'))); assert.deepEqual( files.filter((file) => file.endsWith('.test.ts')), diff --git a/src/__tests__/cli-client-commands.test.ts b/src/__tests__/cli-client-commands.test.ts index f4c0d8a07..ec98ea3fc 100644 --- a/src/__tests__/cli-client-commands.test.ts +++ b/src/__tests__/cli-client-commands.test.ts @@ -14,7 +14,7 @@ import type { MetroReloadOptions, } from '../agent-device-client.ts'; import type { SettingsUpdateOptions } from '../contracts/client-settings.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { resolveCliOptions } from '../cli/resolve-cli-options.ts'; test('install-from-source forwards URL and repeated headers to client.apps.installFromSource', async () => { diff --git a/src/__tests__/cli-close.test.ts b/src/__tests__/cli-close.test.ts index d38276219..31cc99e45 100644 --- a/src/__tests__/cli-close.test.ts +++ b/src/__tests__/cli-close.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { runCliCapture, type CapturedCliRun } from './cli-capture.ts'; function runCliWithDaemonStartupFailure(argv: string[]): Promise { diff --git a/src/__tests__/client-metro.test.ts b/src/__tests__/client-metro.test.ts index b2864b47a..0c57ef6dc 100644 --- a/src/__tests__/client-metro.test.ts +++ b/src/__tests__/client-metro.test.ts @@ -13,7 +13,7 @@ import { resolveMetroReloadEndpoints } from '../metro/metro-reload-endpoints.ts' import { createAgentDeviceClient } from '../agent-device-client.ts'; import { readMetroSessionHints } from '../metro/metro-session-hints.ts'; import { resolveDaemonPaths } from '../daemon/config.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { isProcessAlive, waitForProcessExit } from '../utils/host-process.ts'; const TEST_TOKEN = 'agent-device-proxy-test-token'; diff --git a/src/__tests__/client-normalizers.test.ts b/src/__tests__/client-normalizers.test.ts index 4f32ddd04..25005044c 100644 --- a/src/__tests__/client-normalizers.test.ts +++ b/src/__tests__/client-normalizers.test.ts @@ -5,7 +5,7 @@ import { normalizeOpenDevice, normalizeSession, } from '../client/client-normalizers.ts'; -import { PUBLIC_PLATFORMS } from '../kernel/device.ts'; +import { PUBLIC_PLATFORMS } from '@agent-device/kernel/device'; test('normalizeOpenDevice accepts exactly the canonical leaf platforms', () => { for (const platform of PUBLIC_PLATFORMS) { diff --git a/src/__tests__/client.test.ts b/src/__tests__/client.test.ts index 474d97c9d..1c654889b 100644 --- a/src/__tests__/client.test.ts +++ b/src/__tests__/client.test.ts @@ -27,8 +27,12 @@ import { } from '../agent-device-client.ts'; import { runCommand } from '../commands/command-surface.ts'; import type { CommandResult } from '../core/command-descriptor/command-result.ts'; -import type { DaemonRequest, DaemonResponse, DaemonResponseData } from '../kernel/contracts.ts'; -import { AppError } from '../kernel/errors.ts'; +import type { + DaemonRequest, + DaemonResponse, + DaemonResponseData, +} from '@agent-device/kernel/contracts'; +import { AppError } from '@agent-device/kernel/errors'; // Isolated so open/close metro-session-hint file writes never touch the real state dir. const TEST_STATE_DIR = mkdtempSync(path.join(os.tmpdir(), 'agent-device-client-test-')); diff --git a/src/__tests__/contracts-schema-public.test.ts b/src/__tests__/contracts-schema-public.test.ts index 19d9b4961..30c3d537d 100644 --- a/src/__tests__/contracts-schema-public.test.ts +++ b/src/__tests__/contracts-schema-public.test.ts @@ -22,7 +22,7 @@ import { type AppErrorCode, type Rect, type SnapshotNode, -} from '../kernel/contracts.ts'; +} from '@agent-device/kernel/contracts'; const invalidArgsCode = 'INVALID_ARGS' satisfies AppErrorCode; const rect = { x: 1, y: 2, width: 3, height: 4 } satisfies Rect; @@ -36,7 +36,7 @@ const node = { test('public contracts error helpers do not load diagnostics module', () => { const errorsSource = fs.readFileSync( - path.join(import.meta.dirname, '..', 'kernel', 'errors.ts'), + path.join(import.meta.dirname, '..', '..', 'packages', 'kernel', 'src', 'errors.ts'), 'utf8', ); diff --git a/src/__tests__/daemon-client-progress.test.ts b/src/__tests__/daemon-client-progress.test.ts index 98ed210f9..8fe015a07 100644 --- a/src/__tests__/daemon-client-progress.test.ts +++ b/src/__tests__/daemon-client-progress.test.ts @@ -5,7 +5,7 @@ import { test } from 'vitest'; import type { DaemonRequest, DaemonResponse } from '../daemon/types.ts'; import type { RequestProgressEvent } from '../request/progress.ts'; import { readDaemonSocketProgressResponse } from '../daemon/client/daemon-client-progress.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; type MockSocket = EventEmitter & { ended: boolean; diff --git a/src/__tests__/daemon-error.test.ts b/src/__tests__/daemon-error.test.ts index d610e0e53..832d49401 100644 --- a/src/__tests__/daemon-error.test.ts +++ b/src/__tests__/daemon-error.test.ts @@ -1,8 +1,8 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import { throwDaemonError } from '../kernel/daemon-error.ts'; -import { AppError, normalizeError } from '../kernel/errors.ts'; -import type { DaemonError } from '../kernel/contracts.ts'; +import { throwDaemonError } from '../client/daemon-error.ts'; +import { AppError, normalizeError } from '@agent-device/kernel/errors'; +import type { DaemonError } from '@agent-device/kernel/contracts'; // ADR 0012 migration step 2: "the Node client rejects with AppError retaining // details.divergence" — this is the single conversion point (every diff --git a/src/__tests__/finders-public.test.ts b/src/__tests__/finders-public.test.ts index 215176d46..1684ba3a9 100644 --- a/src/__tests__/finders-public.test.ts +++ b/src/__tests__/finders-public.test.ts @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import { findBestMatchesByLocator, parseFindArgs } from '../finders.ts'; -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; function makeNode(ref: string, label?: string): SnapshotNode { return { diff --git a/src/kernel/__tests__/errors-code-policy.test.ts b/src/__tests__/kernel/errors-code-policy.test.ts similarity index 99% rename from src/kernel/__tests__/errors-code-policy.test.ts rename to src/__tests__/kernel/errors-code-policy.test.ts index bcb0017a9..3f2f2a7b3 100644 --- a/src/kernel/__tests__/errors-code-policy.test.ts +++ b/src/__tests__/kernel/errors-code-policy.test.ts @@ -11,7 +11,7 @@ import { retriableForErrorCode, toAppErrorCode, type KnownAppErrorCode, -} from '../errors.ts'; +} from '@agent-device/kernel/errors'; test('toAppErrorCode falls back when code is missing or empty', () => { assert.equal(toAppErrorCode(undefined), 'COMMAND_FAILED'); diff --git a/src/kernel/__tests__/errors-message.test.ts b/src/__tests__/kernel/errors-message.test.ts similarity index 99% rename from src/kernel/__tests__/errors-message.test.ts rename to src/__tests__/kernel/errors-message.test.ts index f9645c94a..fb9de1ffa 100644 --- a/src/kernel/__tests__/errors-message.test.ts +++ b/src/__tests__/kernel/errors-message.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import { AppError, normalizeError } from '../errors.ts'; +import { AppError, normalizeError } from '@agent-device/kernel/errors'; // maybeEnrichCommandFailedMessage / firstStderrLine: how normalizeError turns a // raw process-exit stderr blob into (or leaves alone) the reported message. diff --git a/src/kernel/__tests__/errors-metadata.test.ts b/src/__tests__/kernel/errors-metadata.test.ts similarity index 99% rename from src/kernel/__tests__/errors-metadata.test.ts rename to src/__tests__/kernel/errors-metadata.test.ts index 217099791..093ecd947 100644 --- a/src/kernel/__tests__/errors-metadata.test.ts +++ b/src/__tests__/kernel/errors-metadata.test.ts @@ -6,7 +6,7 @@ import { KNOWN_APP_ERROR_CODES, normalizeError, retriableForErrorCode, -} from '../errors.ts'; +} from '@agent-device/kernel/errors'; // hint/diagnosticId/logPath/retriable/supportedOn: what normalizeError lifts // out of details onto the wire shape, and what it strips back out. diff --git a/src/kernel/__tests__/platform-collapse-parity.test.ts b/src/__tests__/kernel/platform-collapse-parity.test.ts similarity index 98% rename from src/kernel/__tests__/platform-collapse-parity.test.ts rename to src/__tests__/kernel/platform-collapse-parity.test.ts index 07f122833..3ecee487e 100644 --- a/src/kernel/__tests__/platform-collapse-parity.test.ts +++ b/src/__tests__/kernel/platform-collapse-parity.test.ts @@ -9,7 +9,7 @@ import { publicPlatformString, resolveDevice, type DeviceInfo, -} from '../device.ts'; +} from '@agent-device/kernel/device'; import { ANDROID_EMULATOR, IOS_DEVICE, @@ -20,7 +20,7 @@ import { TVOS_SIMULATOR, VISIONOS_SIMULATOR, WEB_DESKTOP_DEVICE, -} from '../../__tests__/test-utils/device-fixtures.ts'; +} from '../test-utils/device-fixtures.ts'; import { readReplayScriptMetadata } from '../../replay/script.ts'; // Parity gate for the ios/macos -> apple Platform collapse (issue #979, approach b). diff --git a/src/kernel/__tests__/snapshot-ref-grammar.test.ts b/src/__tests__/kernel/snapshot-ref-grammar.test.ts similarity index 94% rename from src/kernel/__tests__/snapshot-ref-grammar.test.ts rename to src/__tests__/kernel/snapshot-ref-grammar.test.ts index f21612ecb..ad9ba92cc 100644 --- a/src/kernel/__tests__/snapshot-ref-grammar.test.ts +++ b/src/__tests__/kernel/snapshot-ref-grammar.test.ts @@ -1,7 +1,7 @@ import fc from 'fast-check'; import { expect, test } from 'vitest'; -import { formatRef, PROPERTY_RUNS, refArb } from '../../__tests__/test-utils/index.ts'; -import { normalizeRef, splitRefGenerationSuffix } from '../snapshot.ts'; +import { formatRef, PROPERTY_RUNS, refArb } from '../test-utils/index.ts'; +import { normalizeRef, splitRefGenerationSuffix } from '@agent-device/kernel/snapshot'; // #1076 versioned refs: `~s` is accepted INPUT on every ref parse // site; node lookup strips it, and callers that care read the generation. diff --git a/src/__tests__/limrun-runtime.test.ts b/src/__tests__/limrun-runtime.test.ts index b373c2a7f..66f4df5db 100644 --- a/src/__tests__/limrun-runtime.test.ts +++ b/src/__tests__/limrun-runtime.test.ts @@ -6,7 +6,7 @@ import { afterEach, test, vi } from 'vitest'; import { LimrunRuntime } from '../sdk/limrun.ts'; import { createExpiredProviderLeaseReleaser } from '../daemon/provider-lease-expiry.ts'; import type { SimulatorLease } from '../daemon/lease-registry.ts'; -import type { DeviceInfo } from '../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { runCmd } from '../utils/exec.ts'; import { readVersion } from '../utils/version.ts'; diff --git a/src/__tests__/provider-device-runtime.test.ts b/src/__tests__/provider-device-runtime.test.ts index 6748bc007..831f29258 100644 --- a/src/__tests__/provider-device-runtime.test.ts +++ b/src/__tests__/provider-device-runtime.test.ts @@ -10,7 +10,7 @@ import { } from '../provider-device-runtime.ts'; import type { Interactor } from '../contracts/interactor-types.ts'; import type { SimulatorLease } from '../daemon/lease-registry.ts'; -import type { DeviceInfo } from '../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; afterEach(() => { setActiveProviderDeviceRuntimes([]); diff --git a/src/__tests__/remote-connection.test.ts b/src/__tests__/remote-connection.test.ts index 30ab9810b..b2434d1e1 100644 --- a/src/__tests__/remote-connection.test.ts +++ b/src/__tests__/remote-connection.test.ts @@ -25,7 +25,7 @@ import { PROXY_REMOTE_LEASE_TTL_MS, } from '../cli/commands/connection-runtime.ts'; import { stopMetroCompanion } from '../metro/client-metro-companion.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { hashRemoteConfigFile, readActiveConnectionState, diff --git a/src/__tests__/selectors-public.test.ts b/src/__tests__/selectors-public.test.ts index 24d1ae62f..76ba389e5 100644 --- a/src/__tests__/selectors-public.test.ts +++ b/src/__tests__/selectors-public.test.ts @@ -12,7 +12,7 @@ import { type SelectorChain, type SelectorDiagnostics, } from '../sdk/selectors.ts'; -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; const nodes: SnapshotNode[] = [ { diff --git a/src/__tests__/test-utils/android-ui-hierarchy-fixtures.ts b/src/__tests__/test-utils/android-ui-hierarchy-fixtures.ts index 5e4e55d60..a96052a86 100644 --- a/src/__tests__/test-utils/android-ui-hierarchy-fixtures.ts +++ b/src/__tests__/test-utils/android-ui-hierarchy-fixtures.ts @@ -7,7 +7,7 @@ import { buildUiHierarchySnapshot, type AndroidUiHierarchy, } from '../../platforms/android/ui-hierarchy.ts'; -import type { RawSnapshotNode } from '../../kernel/snapshot.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; /** * Reconstructs the `AndroidUiHierarchy` tree `buildUiHierarchySnapshot` expects diff --git a/src/__tests__/test-utils/device-fixtures.ts b/src/__tests__/test-utils/device-fixtures.ts index ce69fe147..9e32c2f57 100644 --- a/src/__tests__/test-utils/device-fixtures.ts +++ b/src/__tests__/test-utils/device-fixtures.ts @@ -1,4 +1,4 @@ -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; export const ANDROID_EMULATOR: DeviceInfo = { platform: 'android', diff --git a/src/__tests__/test-utils/mocked-binaries.ts b/src/__tests__/test-utils/mocked-binaries.ts index ee4779bd8..b4f521961 100644 --- a/src/__tests__/test-utils/mocked-binaries.ts +++ b/src/__tests__/test-utils/mocked-binaries.ts @@ -1,7 +1,7 @@ import { promises as fs } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { ANDROID_EMULATOR } from './device-fixtures.ts'; /** diff --git a/src/__tests__/test-utils/property-arbitraries.ts b/src/__tests__/test-utils/property-arbitraries.ts index 765f746b6..e029e0fac 100644 --- a/src/__tests__/test-utils/property-arbitraries.ts +++ b/src/__tests__/test-utils/property-arbitraries.ts @@ -2,7 +2,7 @@ import fc from 'fast-check'; import { INTERNAL_COMMANDS, PUBLIC_COMMANDS } from '../../command-catalog.ts'; import { GESTURE_KINDS, type GesturePayload } from '../../contracts/gesture-input.ts'; import { SCROLL_DIRECTIONS, SWIPE_PRESETS } from '../../contracts/scroll-gesture.ts'; -import type { Point, RawSnapshotNode, Rect } from '../../kernel/snapshot.ts'; +import type { Point, RawSnapshotNode, Rect } from '@agent-device/kernel/snapshot'; import { SELECTOR_KEY_NAMES, type SelectorKey, type SelectorTerm } from '../../selectors/parse.ts'; /** diff --git a/src/__tests__/test-utils/snapshot-builders.ts b/src/__tests__/test-utils/snapshot-builders.ts index 89eb96099..9fb822388 100644 --- a/src/__tests__/test-utils/snapshot-builders.ts +++ b/src/__tests__/test-utils/snapshot-builders.ts @@ -1,4 +1,8 @@ -import { attachRefs, type RawSnapshotNode, type SnapshotState } from '../../kernel/snapshot.ts'; +import { + attachRefs, + type RawSnapshotNode, + type SnapshotState, +} from '@agent-device/kernel/snapshot'; export function buildNodes(raw: RawSnapshotNode[]) { return attachRefs(raw); diff --git a/src/agent-device-client.ts b/src/agent-device-client.ts index fc932eef0..c675341d8 100644 --- a/src/agent-device-client.ts +++ b/src/agent-device-client.ts @@ -14,7 +14,7 @@ import { } from './commands/command-projection.ts'; import { systemCommandFamily } from './commands/system/index.ts'; import { buildRequestFlags } from './commands/command-flags.ts'; -import { throwDaemonError } from './kernel/daemon-error.ts'; +import { throwDaemonError } from './client/daemon-error.ts'; import { buildMeta, normalizeDeployResult, @@ -79,13 +79,13 @@ import { isNonDefaultResponseLevel, type ResponseLevel, type SessionRuntimeHints, -} from './kernel/contracts.ts'; +} from '@agent-device/kernel/contracts'; import { readSerializedSnapshotCaptureAnnotations } from './contracts/snapshot-capture-annotations.ts'; import { readSnapshotDiagnosticsSummary } from './contracts/snapshot-diagnostics.ts'; import type { CommandFlags } from './core/dispatch-context.ts'; import type { AgentArtifactsResult } from './contracts/cloud-artifacts.ts'; import type { ProjectedNavigationCommandClient } from './commands/system/navigation-projection.ts'; -import { AppError } from './kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; type ProjectedSystemCommandClient = ProjectedNavigationCommandClient & Pick; diff --git a/src/backend.ts b/src/backend.ts index 84de1c752..91cc1c27f 100644 --- a/src/backend.ts +++ b/src/backend.ts @@ -7,9 +7,14 @@ import type { SnapshotNode, SnapshotOptions, SnapshotState, -} from './kernel/snapshot.ts'; -import type { NetworkIncludeMode } from './kernel/contracts.ts'; -import type { DeviceTarget, Platform, PlatformSelector, PublicPlatform } from './kernel/device.ts'; +} from '@agent-device/kernel/snapshot'; +import type { NetworkIncludeMode } from '@agent-device/kernel/contracts'; +import type { + DeviceTarget, + Platform, + PlatformSelector, + PublicPlatform, +} from '@agent-device/kernel/device'; import type { BackMode } from './contracts/back-mode.ts'; import type { RepeatedInput } from './commands/command-input.ts'; import type { ClickButton } from './contracts/click-button.ts'; diff --git a/src/cli-schema/cli-config.ts b/src/cli-schema/cli-config.ts index a9c8e7f5f..e61fede63 100644 --- a/src/cli-schema/cli-config.ts +++ b/src/cli-schema/cli-config.ts @@ -1,6 +1,6 @@ import fs from 'node:fs'; import path from 'node:path'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { mergeDefinedFlags } from '../utils/merge-flags.ts'; import { type CliFlags, type FlagKey } from '../commands/cli-grammar/flag-types.ts'; import { expandUserHomePath, resolveUserPath } from '../utils/path-resolution.ts'; diff --git a/src/cli-schema/command-schema.ts b/src/cli-schema/command-schema.ts index 44682ad03..ec5ea0852 100644 --- a/src/cli-schema/command-schema.ts +++ b/src/cli-schema/command-schema.ts @@ -12,7 +12,7 @@ import { type FlagDefinition, type FlagKey, } from '../commands/cli-grammar/flag-types.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export type { CliFlags, FlagDefinition, FlagKey }; export type { CommandSchema }; diff --git a/src/cli-schema/option-schema.test.ts b/src/cli-schema/option-schema.test.ts index 59d0609e8..6835278b2 100644 --- a/src/cli-schema/option-schema.test.ts +++ b/src/cli-schema/option-schema.test.ts @@ -7,7 +7,7 @@ import { parseOptionValueFromSource, resolveSourceValueDefinition, } from './option-schema.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { REMOTE_CONFIG_FIELD_SPECS, getRemoteConfigEnvNames, diff --git a/src/cli.ts b/src/cli.ts index e8ca46733..eb192ed3d 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -1,7 +1,7 @@ import { parseRawArgs, usage, usageForCommand } from './cli/parser/args.ts'; import { suggestCommandFor } from './cli/parser/command-suggestions.ts'; -import { asAppError, AppError, normalizeError } from './kernel/errors.ts'; -import { throwDaemonError } from './kernel/daemon-error.ts'; +import { asAppError, AppError, normalizeError } from '@agent-device/kernel/errors'; +import { throwDaemonError } from './client/daemon-error.ts'; import { printHumanError, printJson } from './utils/output.ts'; import { readVersion } from './utils/version.ts'; import { pathToFileURL } from 'node:url'; @@ -38,7 +38,7 @@ import { import { resolveRemoteAuthForCli } from './cli/auth-session.ts'; import type { FlagKey } from './commands/cli-grammar/flag-types.ts'; import type { CliFlags } from './contracts/cli-flags.ts'; -import type { SessionRuntimeHints } from './kernel/contracts.ts'; +import type { SessionRuntimeHints } from '@agent-device/kernel/contracts'; import { INTERNAL_COMMANDS, isKnownCliCommandName } from './command-catalog.ts'; type CliDeps = { diff --git a/src/cli/__tests__/auth-session.test.ts b/src/cli/__tests__/auth-session.test.ts index c477e5aa1..b79505d81 100644 --- a/src/cli/__tests__/auth-session.test.ts +++ b/src/cli/__tests__/auth-session.test.ts @@ -12,7 +12,7 @@ import { summarizeCliSession, writeCliSession, } from '../auth-session.ts'; -import { normalizeError } from '../../kernel/errors.ts'; +import { normalizeError } from '@agent-device/kernel/errors'; const baseFlags = { json: false, diff --git a/src/cli/auth-session.ts b/src/cli/auth-session.ts index 2a4a82957..11135570f 100644 --- a/src/cli/auth-session.ts +++ b/src/cli/auth-session.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { runCmd } from '../utils/exec.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { CliFlags } from '../contracts/cli-flags.ts'; import type { EnvMap } from '../utils/env-map.ts'; import { readCloudJsonResponse } from './cloud-response.ts'; diff --git a/src/cli/batch-steps.ts b/src/cli/batch-steps.ts index 4591daff6..82c466fd5 100644 --- a/src/cli/batch-steps.ts +++ b/src/cli/batch-steps.ts @@ -1,10 +1,10 @@ import type { BatchStep } from '../contracts/client-replay.ts'; -import { type SessionRuntimeHints } from '../kernel/contracts.ts'; +import { type SessionRuntimeHints } from '@agent-device/kernel/contracts'; import { parseBatchStepRuntime } from '../contracts/batch-contract.ts'; import { readInputFromCli } from '../commands/cli-grammar.ts'; import { isCommandName, type CommandName } from '../commands/command-metadata.ts'; import type { CliFlags } from '../contracts/cli-flags.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { isRecord } from '../utils/parsing.ts'; import { assertCommandPositionalArity } from '../cli-schema/command-schema.ts'; diff --git a/src/cli/cloud-response.ts b/src/cli/cloud-response.ts index 444a6048f..6afa2302b 100644 --- a/src/cli/cloud-response.ts +++ b/src/cli/cloud-response.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export async function readCloudJsonResponse( response: Response, diff --git a/src/cli/commands/__tests__/generic.test.ts b/src/cli/commands/__tests__/generic.test.ts index 219761fca..2cb9758cd 100644 --- a/src/cli/commands/__tests__/generic.test.ts +++ b/src/cli/commands/__tests__/generic.test.ts @@ -1,7 +1,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { createAgentDeviceClient } from '../../../agent-device-client.ts'; -import type { DaemonResponse } from '../../../kernel/contracts.ts'; +import type { DaemonResponse } from '@agent-device/kernel/contracts'; import type { CliFlags } from '../../../contracts/cli-flags.ts'; import type { ClientBackedCliCommandName } from '../client-backed.ts'; import { runGenericClientBackedCommand } from '../generic.ts'; diff --git a/src/cli/commands/__tests__/screenshot.test.ts b/src/cli/commands/__tests__/screenshot.test.ts index 907e102e4..695792553 100644 --- a/src/cli/commands/__tests__/screenshot.test.ts +++ b/src/cli/commands/__tests__/screenshot.test.ts @@ -1,7 +1,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { createAgentDeviceClient } from '../../../agent-device-client.ts'; -import type { DaemonResponse } from '../../../kernel/contracts.ts'; +import type { DaemonResponse } from '@agent-device/kernel/contracts'; import type { CliFlags } from '../../../contracts/cli-flags.ts'; import { screenshotCommand } from '../screenshot.ts'; diff --git a/src/cli/commands/agent-cdp.ts b/src/cli/commands/agent-cdp.ts index df5fa7a6a..dfd3b70f3 100644 --- a/src/cli/commands/agent-cdp.ts +++ b/src/cli/commands/agent-cdp.ts @@ -1,7 +1,7 @@ import { runCmdStreaming } from '../../utils/exec.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { isRemoteBridgeBackend } from './remote-bridge.ts'; -import type { SessionRuntimeHints } from '../../kernel/contracts.ts'; +import type { SessionRuntimeHints } from '@agent-device/kernel/contracts'; import type { CliFlags } from '../../contracts/cli-flags.ts'; const AGENT_CDP_VERSION = '1.6.1'; diff --git a/src/cli/commands/auth.ts b/src/cli/commands/auth.ts index b9ed629ec..785384cc6 100644 --- a/src/cli/commands/auth.ts +++ b/src/cli/commands/auth.ts @@ -1,5 +1,5 @@ import { resolveDaemonPaths } from '../../daemon/config.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { loginWithDeviceAuth, removeCliSession, summarizeCliSession } from '../auth-session.ts'; import { writeCommandOutput } from './shared.ts'; import type { ClientCommandHandler } from './router-types.ts'; diff --git a/src/cli/commands/connection-runtime.ts b/src/cli/commands/connection-runtime.ts index 0c56481f1..39b49cf7f 100644 --- a/src/cli/commands/connection-runtime.ts +++ b/src/cli/commands/connection-runtime.ts @@ -8,7 +8,7 @@ import { publicPlatformString, resolveDevice, type DeviceInfo, -} from '../../kernel/device.ts'; +} from '@agent-device/kernel/device'; import { shouldAgentCdpUseRemoteBridgeUrl } from './agent-cdp.ts'; import type { MetroBridgeScope } from '../../client/client-companion-tunnel-contract.ts'; import { @@ -22,8 +22,8 @@ import { } from '../../remote/remote-connection-state.ts'; import { profileToCliFlags } from '../remote-config-flags.ts'; import type { BatchStep } from '../../contracts/client-replay.ts'; -import { AppError } from '../../kernel/errors.ts'; -import type { LeaseBackend, SessionRuntimeHints } from '../../kernel/contracts.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { LeaseBackend, SessionRuntimeHints } from '@agent-device/kernel/contracts'; import type { CliFlags } from '../../contracts/cli-flags.ts'; import type { AgentDeviceClient, Lease } from '../../agent-device-client.ts'; import type { CloudProviderSessionResult } from '../../contracts/cloud-artifacts.ts'; diff --git a/src/cli/commands/connection.ts b/src/cli/commands/connection.ts index fe546eb18..0421ca617 100644 --- a/src/cli/commands/connection.ts +++ b/src/cli/commands/connection.ts @@ -13,7 +13,7 @@ import { type RemoteConnectionState, type RemoteConnectionRequestMetadata, } from '../../remote/remote-connection-state.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { resolveCloudConnectProfile } from '../connection/cloud-profile.ts'; import { connectProviderNamesForError, @@ -35,7 +35,7 @@ import { stopReactDevtoolsCleanup, } from './connection-runtime.ts'; import { writeCommandOutput } from './shared.ts'; -import type { LeaseBackend } from '../../kernel/contracts.ts'; +import type { LeaseBackend } from '@agent-device/kernel/contracts'; import type { CliFlags } from '../../contracts/cli-flags.ts'; import type { ClientCommandHandler } from './router-types.ts'; diff --git a/src/cli/commands/daemon.ts b/src/cli/commands/daemon.ts index d5ffd3a46..53af4c08a 100644 --- a/src/cli/commands/daemon.ts +++ b/src/cli/commands/daemon.ts @@ -5,7 +5,7 @@ import { type DaemonStopResult, } from '../../daemon/daemon-stop.ts'; import { readDaemonShutdownReport } from '../../daemon/daemon-shutdown-report.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { writeCommandOutput } from './shared.ts'; import type { ClientCommandHandler } from './router-types.ts'; diff --git a/src/cli/commands/device.ts b/src/cli/commands/device.ts index b1c6580d0..19e323612 100644 --- a/src/cli/commands/device.ts +++ b/src/cli/commands/device.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { inspectDeviceClaims, type InspectedDeviceClaim, diff --git a/src/cli/commands/generic.ts b/src/cli/commands/generic.ts index d688ce166..066de6e34 100644 --- a/src/cli/commands/generic.ts +++ b/src/cli/commands/generic.ts @@ -5,7 +5,7 @@ import type { CliOutput } from '../../commands/command-contract.ts'; import type { ReplaySuiteResult } from '../../contracts/replay.ts'; import type { CliFlags } from '../../contracts/cli-flags.ts'; import { readCommandMessage } from '../../utils/success-text.ts'; -import { isNonDefaultResponseLevel } from '../../kernel/contracts.ts'; +import { isNonDefaultResponseLevel } from '@agent-device/kernel/contracts'; import { writeCommandOutput } from './shared.ts'; import type { ClientBackedCliCommandName } from './client-backed.ts'; import type { ClientCommandParams } from './router-types.ts'; diff --git a/src/cli/commands/proxy.ts b/src/cli/commands/proxy.ts index 176b79ea2..392b54edc 100644 --- a/src/cli/commands/proxy.ts +++ b/src/cli/commands/proxy.ts @@ -5,7 +5,7 @@ import { ensureDaemon, resolveClientSettings, } from '../../daemon/client/daemon-client-lifecycle.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { colorize, supportsColor } from '../../utils/output.ts'; import type { CliFlags } from '../../contracts/cli-flags.ts'; import { writeCommandOutput } from './shared.ts'; diff --git a/src/cli/commands/react-devtools.ts b/src/cli/commands/react-devtools.ts index c665420af..4091222eb 100644 --- a/src/cli/commands/react-devtools.ts +++ b/src/cli/commands/react-devtools.ts @@ -3,7 +3,7 @@ import { ensureReactDevtoolsCompanion, stopReactDevtoolsCompanion, } from '../../client/client-react-devtools-companion.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { isRemoteBridgeBackend } from './remote-bridge.ts'; import type { CliFlags } from '../../contracts/cli-flags.ts'; diff --git a/src/cli/commands/replay.ts b/src/cli/commands/replay.ts index 635fb8506..d6ab206b3 100644 --- a/src/cli/commands/replay.ts +++ b/src/cli/commands/replay.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { exportReplayScriptToMaestro } from '../../compat/maestro/export-flow.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { resolveUserPath } from '../../utils/path-resolution.ts'; import { writeCommandOutput } from './shared.ts'; import type { ClientCommandHandler } from './router-types.ts'; diff --git a/src/cli/commands/screenshot.ts b/src/cli/commands/screenshot.ts index d51ecd680..e98f56217 100644 --- a/src/cli/commands/screenshot.ts +++ b/src/cli/commands/screenshot.ts @@ -1,6 +1,6 @@ import { formatScreenshotDiffText, formatSnapshotDiffText } from '../../utils/output.ts'; -import { AppError } from '../../kernel/errors.ts'; -import { isNonDefaultResponseLevel } from '../../kernel/contracts.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import { isNonDefaultResponseLevel } from '@agent-device/kernel/contracts'; import { resolveUserPath } from '../../utils/path-resolution.ts'; import type { AgentDeviceBackend } from '../../backend.ts'; import type { AgentDeviceClient, CaptureScreenshotResult } from '../../agent-device-client.ts'; diff --git a/src/cli/commands/web.ts b/src/cli/commands/web.ts index 4ad42aa3d..e6ca25e8e 100644 --- a/src/cli/commands/web.ts +++ b/src/cli/commands/web.ts @@ -1,5 +1,5 @@ import type { AgentBrowserToolStatus } from '../../platforms/web/agent-browser-tool.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { CliFlags } from '../../contracts/cli-flags.ts'; import { printJson } from '../../utils/output.ts'; diff --git a/src/cli/connection/cloud-profile.ts b/src/cli/connection/cloud-profile.ts index 81d67e1ea..afc1f0845 100644 --- a/src/cli/connection/cloud-profile.ts +++ b/src/cli/connection/cloud-profile.ts @@ -1,5 +1,5 @@ import type { RemoteConfigProfile } from '../../remote/remote-config-schema.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { CliFlags } from '../../contracts/cli-flags.ts'; import type { EnvMap } from '../../utils/env-map.ts'; import { resolveCloudAccessForConnect } from '../auth-session.ts'; diff --git a/src/cli/connection/cloud-webdriver-profile.ts b/src/cli/connection/cloud-webdriver-profile.ts index f57bc8adf..a25691836 100644 --- a/src/cli/connection/cloud-webdriver-profile.ts +++ b/src/cli/connection/cloud-webdriver-profile.ts @@ -1,8 +1,8 @@ import { CLOUD_WEBDRIVER_PROVIDERS } from '../../cloud-webdriver/providers.ts'; import type { CloudWebDriverKnownProviderName } from '../../cloud-webdriver/providers.ts'; import type { RemoteConfigProfile } from '../../remote/remote-config-schema.ts'; -import { AppError } from '../../kernel/errors.ts'; -import type { PlatformSelector } from '../../kernel/device.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { PlatformSelector } from '@agent-device/kernel/device'; import type { CliFlags } from '../../contracts/cli-flags.ts'; import type { EnvMap } from '../../utils/env-map.ts'; import { readMetroProfileFields } from './profile-fields.ts'; diff --git a/src/cli/connection/generated-config.ts b/src/cli/connection/generated-config.ts index 85144c4e7..15e0805ad 100644 --- a/src/cli/connection/generated-config.ts +++ b/src/cli/connection/generated-config.ts @@ -6,7 +6,7 @@ import type { RemoteConfigProfile, ResolvedRemoteConfigProfile, } from '../../remote/remote-config-schema.ts'; -import { AppError, asAppError } from '../../kernel/errors.ts'; +import { AppError, asAppError } from '@agent-device/kernel/errors'; import type { EnvMap } from '../../utils/env-map.ts'; import type { CliFlags } from '../../contracts/cli-flags.ts'; import { profileToCliFlags } from '../remote-config-flags.ts'; diff --git a/src/cli/connection/limrun-profile.ts b/src/cli/connection/limrun-profile.ts index fca502e7f..4a09c4115 100644 --- a/src/cli/connection/limrun-profile.ts +++ b/src/cli/connection/limrun-profile.ts @@ -1,6 +1,6 @@ import { resolveDaemonPaths } from '../../daemon/config.ts'; import type { RemoteConfigProfile } from '../../remote/remote-config-schema.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { CliFlags } from '../../contracts/cli-flags.ts'; import type { EnvMap } from '../../utils/env-map.ts'; import { readMetroProfileFields } from './profile-fields.ts'; diff --git a/src/cli/connection/proxy-profile.ts b/src/cli/connection/proxy-profile.ts index 2583fe3ee..68446eb82 100644 --- a/src/cli/connection/proxy-profile.ts +++ b/src/cli/connection/proxy-profile.ts @@ -1,5 +1,5 @@ import type { RemoteConfigProfile } from '../../remote/remote-config-schema.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { CliFlags } from '../../contracts/cli-flags.ts'; import type { EnvMap } from '../../utils/env-map.ts'; import { readMetroProfileFields } from './profile-fields.ts'; diff --git a/src/cli/parser/__tests__/args-parse-interaction.test.ts b/src/cli/parser/__tests__/args-parse-interaction.test.ts index 486bf8c69..9fbe69fe3 100644 --- a/src/cli/parser/__tests__/args-parse-interaction.test.ts +++ b/src/cli/parser/__tests__/args-parse-interaction.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { parseArgs } from '../args.ts'; test('parseArgs accepts clipboard subcommands', () => { diff --git a/src/cli/parser/__tests__/args-validation.test.ts b/src/cli/parser/__tests__/args-validation.test.ts index b677918a8..6786f0995 100644 --- a/src/cli/parser/__tests__/args-validation.test.ts +++ b/src/cli/parser/__tests__/args-validation.test.ts @@ -1,7 +1,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { parseArgs } from '../args.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { listCliCommandNames } from '../../../command-catalog.ts'; import { getCliCommandSchema } from '../../../cli-schema/command-schema.ts'; diff --git a/src/cli/parser/__tests__/cli-help-command-usage.test.ts b/src/cli/parser/__tests__/cli-help-command-usage.test.ts index 1d0c97226..46211f8db 100644 --- a/src/cli/parser/__tests__/cli-help-command-usage.test.ts +++ b/src/cli/parser/__tests__/cli-help-command-usage.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { usageForCommand } from '../args.ts'; test('usageForCommand documents open --launch-args', async () => { diff --git a/src/cli/parser/__tests__/command-suggestions.test.ts b/src/cli/parser/__tests__/command-suggestions.test.ts index e42ba5c79..3d5589e8c 100644 --- a/src/cli/parser/__tests__/command-suggestions.test.ts +++ b/src/cli/parser/__tests__/command-suggestions.test.ts @@ -2,7 +2,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import { isKnownCliCommandName } from '../../../command-catalog.ts'; import { keyboardCliReader } from '../../../commands/system/index.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { parseArgs } from '../args.ts'; import type { CliFlags } from '../../../contracts/cli-flags.ts'; import { listCommandAliasSuggestionEntries, suggestCommandFor } from '../command-suggestions.ts'; diff --git a/src/cli/parser/args.ts b/src/cli/parser/args.ts index 92a0709c1..4346efbec 100644 --- a/src/cli/parser/args.ts +++ b/src/cli/parser/args.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { mergeDefinedFlags } from '../../utils/merge-flags.ts'; import { applyCommandDefaults, diff --git a/src/client/client-normalizers.ts b/src/client/client-normalizers.ts index c9d0415a2..998d74bcf 100644 --- a/src/client/client-normalizers.ts +++ b/src/client/client-normalizers.ts @@ -1,6 +1,6 @@ import type { DaemonRequest, SessionRuntimeHints } from '../daemon/types.ts'; -import { AppError, type NormalizedError } from '../kernel/errors.ts'; -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import { AppError, type NormalizedError } from '@agent-device/kernel/errors'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { buildAppIdentifiers, buildDeviceIdentifiers } from '../contracts/result-serialization.ts'; import { isAppleOs, @@ -8,7 +8,7 @@ import { isPublicPlatform, isSerialAddressablePlatform, type AppleOS, -} from '../kernel/device.ts'; +} from '@agent-device/kernel/device'; import { leaseScopeFromOptions, leaseScopeToRequestMeta } from '../core/lease-scope.ts'; import type { AppDeployResult, diff --git a/src/client/client-types.ts b/src/client/client-types.ts index 0e1a8bf9f..ebf76ff0f 100644 --- a/src/client/client-types.ts +++ b/src/client/client-types.ts @@ -57,7 +57,7 @@ export type { AppsFilter } from '../contracts/app-inventory.ts'; // fallow-ignore-next-line unused-type export type { AlertAction } from '../contracts/alert-contract.ts'; // fallow-ignore-next-line unused-type -export type { AppleOS } from '../kernel/device.ts'; +export type { AppleOS } from '@agent-device/kernel/device'; // fallow-ignore-next-line unused-type export type { JsonObject } from '../contracts/json.ts'; diff --git a/src/kernel/daemon-error.ts b/src/client/daemon-error.ts similarity index 69% rename from src/kernel/daemon-error.ts rename to src/client/daemon-error.ts index d7e05844f..b8a2aacc6 100644 --- a/src/kernel/daemon-error.ts +++ b/src/client/daemon-error.ts @@ -1,5 +1,5 @@ -import { AppError, toAppErrorCode } from './errors.ts'; -import type { DaemonError } from './contracts.ts'; +import { AppError, toAppErrorCode } from '@agent-device/kernel/errors'; +import type { DaemonError } from '@agent-device/kernel/contracts'; export function throwDaemonError(error: DaemonError): never { throw new AppError(toAppErrorCode(error.code), error.message, { diff --git a/src/cloud-webdriver/aws-device-farm.ts b/src/cloud-webdriver/aws-device-farm.ts index 49549a0ac..2892a635d 100644 --- a/src/cloud-webdriver/aws-device-farm.ts +++ b/src/cloud-webdriver/aws-device-farm.ts @@ -19,7 +19,7 @@ import type { DeviceLease } from '../contracts/device-provider.ts'; import type { ProviderDeviceRuntime } from '../provider-device-runtime.ts'; import { runCmd } from '../utils/exec.ts'; import { sleep } from '../utils/timeouts.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { CLOUD_WEBDRIVER_PROVIDERS } from './providers.ts'; import { resolveLeaseValue, type LeaseValue } from './webdriver-utils.ts'; diff --git a/src/cloud-webdriver/browserstack.ts b/src/cloud-webdriver/browserstack.ts index 559b307bf..d83b448f4 100644 --- a/src/cloud-webdriver/browserstack.ts +++ b/src/cloud-webdriver/browserstack.ts @@ -14,7 +14,7 @@ import { } from './runtime.ts'; import type { ProviderDeviceRuntime } from '../provider-device-runtime.ts'; import type { DeviceLease } from '../contracts/device-provider.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { CLOUD_WEBDRIVER_PROVIDERS } from './providers.ts'; import { agentDeviceRequestHeaders } from './request-headers.ts'; import { cloudArtifactsReadyOrPending } from './artifact-results.ts'; diff --git a/src/cloud-webdriver/provider-definitions.ts b/src/cloud-webdriver/provider-definitions.ts index 277231c2c..8b190e322 100644 --- a/src/cloud-webdriver/provider-definitions.ts +++ b/src/cloud-webdriver/provider-definitions.ts @@ -1,8 +1,8 @@ import fs from 'node:fs'; import path from 'node:path'; import type { CloudArtifactsResult } from '../contracts/cloud-artifacts.ts'; -import type { DaemonRequest } from '../kernel/contracts.ts'; -import { AppError } from '../kernel/errors.ts'; +import type { DaemonRequest } from '@agent-device/kernel/contracts'; +import { AppError } from '@agent-device/kernel/errors'; import type { ProviderDeviceRuntime } from '../provider-device-runtime.ts'; import { AWS_DEVICE_FARM_CAPABILITY_OVERRIDES, diff --git a/src/cloud-webdriver/runtime.ts b/src/cloud-webdriver/runtime.ts index 4fdab0e0e..f4fa3b178 100644 --- a/src/cloud-webdriver/runtime.ts +++ b/src/cloud-webdriver/runtime.ts @@ -9,7 +9,7 @@ import type { LeaseLifecycleProvider, } from '../contracts/device-provider.ts'; import type { Interactor } from '../contracts/interactor-types.ts'; -import type { DaemonRequest } from '../kernel/contracts.ts'; +import type { DaemonRequest } from '@agent-device/kernel/contracts'; import type { ProviderDeviceInstallOptions, ProviderDeviceInstallResult, @@ -19,8 +19,8 @@ import { deviceFieldsFromPublicPlatform, publicPlatformString, type DeviceInfo, -} from '../kernel/device.ts'; -import { AppError } from '../kernel/errors.ts'; +} from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { unavailableCloudArtifactsResult } from './artifact-results.ts'; import { capabilitySupported, diff --git a/src/cloud-webdriver/webdriver-client.ts b/src/cloud-webdriver/webdriver-client.ts index 6d3de81d6..6401505e1 100644 --- a/src/cloud-webdriver/webdriver-client.ts +++ b/src/cloud-webdriver/webdriver-client.ts @@ -1,5 +1,5 @@ import fs from 'node:fs/promises'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { sleep } from '../utils/timeouts.ts'; import { agentDeviceRequestHeaders } from './request-headers.ts'; import { basicAuthHeader, trimLeadingSlash, withTrailingSlash } from './webdriver-utils.ts'; diff --git a/src/cloud-webdriver/webdriver-interactor.ts b/src/cloud-webdriver/webdriver-interactor.ts index 6694e2abe..91775401a 100644 --- a/src/cloud-webdriver/webdriver-interactor.ts +++ b/src/cloud-webdriver/webdriver-interactor.ts @@ -10,7 +10,7 @@ import type { ScrollDirection } from '../contracts/scroll-gesture.ts'; import type { GesturePlan } from '../contracts/gesture-plan.ts'; import type { TvRemoteButton } from '../contracts/tv-remote.ts'; import type { SettingOptions } from '../platforms/permission-utils.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { buildScrollGesturePlan } from '../contracts/scroll-gesture.ts'; import { capabilitySupported, diff --git a/src/cloud-webdriver/webdriver-scroll-frame.ts b/src/cloud-webdriver/webdriver-scroll-frame.ts index 2942b3cf2..c97728cf1 100644 --- a/src/cloud-webdriver/webdriver-scroll-frame.ts +++ b/src/cloud-webdriver/webdriver-scroll-frame.ts @@ -1,4 +1,4 @@ -import type { RawSnapshotNode } from '../kernel/snapshot.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; import type { WebDriverWindowRect } from './webdriver-client.ts'; import { parseWebDriverSource } from './webdriver-source.ts'; diff --git a/src/cloud-webdriver/webdriver-source.ts b/src/cloud-webdriver/webdriver-source.ts index 72738a5b5..a5b8065a3 100644 --- a/src/cloud-webdriver/webdriver-source.ts +++ b/src/cloud-webdriver/webdriver-source.ts @@ -1,6 +1,6 @@ -import type { RawSnapshotNode } from '../kernel/snapshot.ts'; -import { AppError } from '../kernel/errors.ts'; -import { parseBounds } from '../utils/bounds.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; +import { AppError } from '@agent-device/kernel/errors'; +import { parseBounds } from '@agent-device/kernel/bounds'; import { parseXmlDocumentSync, type XmlNode } from '../utils/xml.ts'; export function parseWebDriverSource(source: string): RawSnapshotNode[] { diff --git a/src/commands/batch/metadata.ts b/src/commands/batch/metadata.ts index 23fbd8890..5c3b7b073 100644 --- a/src/commands/batch/metadata.ts +++ b/src/commands/batch/metadata.ts @@ -6,8 +6,8 @@ import { readBatchStepInputObject, readBatchStepRecord, } from '../../contracts/batch-contract.ts'; -import { AppError } from '../../kernel/errors.ts'; -import { type SessionRuntimeHints } from '../../kernel/contracts.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import { type SessionRuntimeHints } from '@agent-device/kernel/contracts'; import { STRUCTURED_BATCH_COMMAND_NAMES, readStructuredBatchCommandName, diff --git a/src/commands/batch/projection.ts b/src/commands/batch/projection.ts index d67c9cc6b..e19c2d305 100644 --- a/src/commands/batch/projection.ts +++ b/src/commands/batch/projection.ts @@ -9,7 +9,7 @@ import { readBatchStepRecord, } from '../../contracts/batch-contract.ts'; import type { DaemonBatchStep } from '../../core/batch.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { request } from '../cli-grammar/common.ts'; import type { CommandInput, DaemonCommandRequest, DaemonWriter } from '../cli-grammar/types.ts'; import { buildRequestFlags } from '../command-flags.ts'; diff --git a/src/commands/batch/public.test.ts b/src/commands/batch/public.test.ts index ac2ba8bd4..2ee92b79c 100644 --- a/src/commands/batch/public.test.ts +++ b/src/commands/batch/public.test.ts @@ -1,7 +1,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { runBatch } from '../../sdk/batch.ts'; -import type { DaemonRequest } from '../../kernel/contracts.ts'; +import type { DaemonRequest } from '@agent-device/kernel/contracts'; test('public batch entrypoint exports daemon-compatible orchestration helpers', async () => { const seenCommands: string[] = []; diff --git a/src/commands/capture/alert.ts b/src/commands/capture/alert.ts index ca6051fa0..874b65af1 100644 --- a/src/commands/capture/alert.ts +++ b/src/commands/capture/alert.ts @@ -13,7 +13,7 @@ import type { CliReader, DaemonWriter } from '../cli-grammar/types.ts'; import { defineCommandFacet } from '../family/types.ts'; import { defineFieldCommandMetadata } from '../field-command-contract.ts'; import { messageOutput } from '../output-common.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; const ALERT_COMMAND_NAME = 'alert'; diff --git a/src/commands/capture/diff.ts b/src/commands/capture/diff.ts index 9bd4658b9..0bf1edaaa 100644 --- a/src/commands/capture/diff.ts +++ b/src/commands/capture/diff.ts @@ -1,6 +1,6 @@ import { PUBLIC_COMMANDS } from '../../command-catalog.ts'; import { SNAPSHOT_FLAGS } from '../cli-grammar/flag-groups.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { booleanField, integerField, diff --git a/src/commands/capture/output.test.ts b/src/commands/capture/output.test.ts index a59d083b6..972f537f9 100644 --- a/src/commands/capture/output.test.ts +++ b/src/commands/capture/output.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import { attachRefs, type RawSnapshotNode } from '../../kernel/snapshot.ts'; +import { attachRefs, type RawSnapshotNode } from '@agent-device/kernel/snapshot'; import type { CaptureSnapshotResult } from '../../contracts/client-capture.ts'; import { snapshotCliOutput } from './output.ts'; diff --git a/src/commands/capture/runtime/diff-screenshot.ts b/src/commands/capture/runtime/diff-screenshot.ts index d961b45bb..1a9fc4417 100644 --- a/src/commands/capture/runtime/diff-screenshot.ts +++ b/src/commands/capture/runtime/diff-screenshot.ts @@ -9,7 +9,7 @@ import type { ResolvedInputFile, } from '../../../io.ts'; import type { AgentDeviceRuntime, CommandContext } from '../../../runtime-contract.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { compareScreenshots, type ScreenshotDiffResult, diff --git a/src/commands/capture/runtime/screenshot.ts b/src/commands/capture/runtime/screenshot.ts index 4bb54d20f..dc79f67f1 100644 --- a/src/commands/capture/runtime/screenshot.ts +++ b/src/commands/capture/runtime/screenshot.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { successText } from '../../../utils/success-text.ts'; import { resizePngFileToMaxSize } from '../../../utils/png-resize.ts'; import type { ArtifactDescriptor } from '../../../io.ts'; diff --git a/src/commands/capture/runtime/snapshot-unchanged.test.ts b/src/commands/capture/runtime/snapshot-unchanged.test.ts index 9384b533f..0fc4ed00b 100644 --- a/src/commands/capture/runtime/snapshot-unchanged.test.ts +++ b/src/commands/capture/runtime/snapshot-unchanged.test.ts @@ -3,7 +3,7 @@ import { buildUnchangedSnapshotMetadata, ensureSnapshotPresentationKey, } from './snapshot-unchanged.ts'; -import type { SnapshotState } from '../../../kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; function snapshot( label: string, diff --git a/src/commands/capture/runtime/snapshot-unchanged.ts b/src/commands/capture/runtime/snapshot-unchanged.ts index 5ed89d0a8..14af191b8 100644 --- a/src/commands/capture/runtime/snapshot-unchanged.ts +++ b/src/commands/capture/runtime/snapshot-unchanged.ts @@ -4,7 +4,7 @@ import { type SnapshotNode, type SnapshotState, type SnapshotUnchanged, -} from '../../../kernel/snapshot.ts'; +} from '@agent-device/kernel/snapshot'; type SnapshotIdentity = { previousAppBundleId?: string; diff --git a/src/commands/capture/runtime/snapshot.ts b/src/commands/capture/runtime/snapshot.ts index fa81a0ea9..6fa300a00 100644 --- a/src/commands/capture/runtime/snapshot.ts +++ b/src/commands/capture/runtime/snapshot.ts @@ -9,7 +9,7 @@ import { type SnapshotCaptureAnnotations, } from '../../../contracts/snapshot-capture-annotations.ts'; import { renderSnapshotQualityWarnings } from '../../../snapshot/snapshot-quality.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { buildSnapshotDiff, countSnapshotComparableLines, @@ -19,7 +19,7 @@ import type { SnapshotState, SnapshotUnchanged, SnapshotVisibility, -} from '../../../kernel/snapshot.ts'; +} from '@agent-device/kernel/snapshot'; import { buildSnapshotVisibility } from '../../../snapshot/snapshot-visibility.ts'; import { ANDROID_SYSTEM_SURFACE_DISCLOSURE } from '../../../snapshot/system-surface-disclosure.ts'; import { formatReactNativeOverlayWarning } from '../../react-native/overlay.ts'; diff --git a/src/commands/capture/settings.ts b/src/commands/capture/settings.ts index f4586d885..350169726 100644 --- a/src/commands/capture/settings.ts +++ b/src/commands/capture/settings.ts @@ -3,7 +3,7 @@ import type { SettingsUpdateOptions } from '../../contracts/client-settings.ts'; import { SETTINGS_USAGE_OVERRIDE } from '../../contracts/settings-contract.ts'; import type { CommandSchemaOverride } from '../../cli-schema/types.ts'; import type { CliFlags } from '../../contracts/cli-flags.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { readLocationCoordinate } from '../../utils/location-coordinates.ts'; import { defineExecutableCommand } from '../command-contract.ts'; import { enumField, numberField, requiredField, stringField } from '../command-input.ts'; diff --git a/src/commands/capture/wait.ts b/src/commands/capture/wait.ts index 552921967..914e77805 100644 --- a/src/commands/capture/wait.ts +++ b/src/commands/capture/wait.ts @@ -3,7 +3,7 @@ import type { WaitCommandOptions } from '../../contracts/client-system.ts'; import { parseWaitPositionals } from '../../core/wait-positionals.ts'; import { SELECTOR_SNAPSHOT_FLAGS } from '../cli-grammar/flag-groups.ts'; import { type CliFlags } from '../cli-grammar/flag-types.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { tryParseSelectorChain } from '../../selectors/parse.ts'; import { booleanField, diff --git a/src/commands/cli-grammar/common.ts b/src/commands/cli-grammar/common.ts index 4d862bf20..919303998 100644 --- a/src/commands/cli-grammar/common.ts +++ b/src/commands/cli-grammar/common.ts @@ -7,7 +7,7 @@ import { SELECTOR_EXPRESSION_REQUIRED_MESSAGE, } from '../../selectors/arguments.ts'; import type { CliFlags } from '../../contracts/cli-flags.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { compactRecord, type SelectorSnapshotInput } from '../command-input.ts'; import type { DaemonWriter, diff --git a/src/commands/cli-grammar/flag-definitions-action.ts b/src/commands/cli-grammar/flag-definitions-action.ts index 45bb82d94..de93bbd73 100644 --- a/src/commands/cli-grammar/flag-definitions-action.ts +++ b/src/commands/cli-grammar/flag-definitions-action.ts @@ -1,4 +1,4 @@ -import { RESPONSE_LEVELS } from '../../kernel/contracts.ts'; +import { RESPONSE_LEVELS } from '@agent-device/kernel/contracts'; import { RECORDING_SCOPE_VALUES } from '../../contracts/recording-scope.ts'; import type { FlagDefinition } from './flag-types.ts'; diff --git a/src/commands/cli-grammar/flag-definitions-target.ts b/src/commands/cli-grammar/flag-definitions-target.ts index ddaa66e9c..38c62b39b 100644 --- a/src/commands/cli-grammar/flag-definitions-target.ts +++ b/src/commands/cli-grammar/flag-definitions-target.ts @@ -1,5 +1,5 @@ import { SESSION_SURFACES } from '../../contracts/session-surface.ts'; -import { PLATFORM_SELECTORS } from '../../kernel/device.ts'; +import { PLATFORM_SELECTORS } from '@agent-device/kernel/device'; import { PERF_KIND_VALUES } from '../../contracts/perf.ts'; import type { FlagDefinition } from './flag-types.ts'; diff --git a/src/commands/cli-grammar/flag-registry.test.ts b/src/commands/cli-grammar/flag-registry.test.ts index 5b6e3d212..6a96bf3e6 100644 --- a/src/commands/cli-grammar/flag-registry.test.ts +++ b/src/commands/cli-grammar/flag-registry.test.ts @@ -1,7 +1,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { getFlagDefinition } from './flag-registry.ts'; -import { PLATFORM_SELECTORS } from '../../kernel/device.ts'; +import { PLATFORM_SELECTORS } from '@agent-device/kernel/device'; test('--platform enumValues are derived from the canonical PLATFORM_SELECTORS tuple', () => { const platformFlag = getFlagDefinition('--platform'); diff --git a/src/commands/command-input.ts b/src/commands/command-input.ts index 037fad019..20c10769d 100644 --- a/src/commands/command-input.ts +++ b/src/commands/command-input.ts @@ -8,9 +8,9 @@ import { PLATFORM_SELECTORS, type DeviceTarget, type PlatformSelector, -} from '../kernel/device.ts'; +} from '@agent-device/kernel/device'; import type { JsonSchema } from './command-contract.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { readOptionalInteger as optionalInteger } from '../contracts/input-validation.ts'; const INTERACTION_TARGET_KINDS = ['ref', 'selector', 'point'] as const; diff --git a/src/commands/command-projection.ts b/src/commands/command-projection.ts index e131b3334..563c729c4 100644 --- a/src/commands/command-projection.ts +++ b/src/commands/command-projection.ts @@ -3,7 +3,7 @@ import type { CommandInput, DaemonCommandRequest, DaemonWriter } from './cli-gra import { findCommandMetadata } from './command-metadata.ts'; import { readMetadataCommandFlags } from './command-flags.ts'; import { listCommandFamilyDaemonWriters } from './family/registry.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; const daemonWriters: Record = { ...listCommandFamilyDaemonWriters(), diff --git a/src/commands/debugging/index.ts b/src/commands/debugging/index.ts index 4d6d726bb..e3565e25f 100644 --- a/src/commands/debugging/index.ts +++ b/src/commands/debugging/index.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { CommandSchemaOverride } from '../../cli-schema/types.ts'; import { enumField, requiredField, stringField } from '../command-input.ts'; import { defineCommandFacet, defineCommandFamilyFromFacets } from '../family/types.ts'; diff --git a/src/commands/interaction/interactions.test.ts b/src/commands/interaction/interactions.test.ts index 8e6b06719..56ec1a813 100644 --- a/src/commands/interaction/interactions.test.ts +++ b/src/commands/interaction/interactions.test.ts @@ -1,6 +1,6 @@ import { expect, test } from 'vitest'; import { interactionCliReaders, interactionDaemonWriters } from './interactions.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { CliFlags } from '../../contracts/cli-flags.ts'; const BASE_FLAGS: CliFlags = { json: false, help: false, version: false }; diff --git a/src/commands/interaction/interactions.ts b/src/commands/interaction/interactions.ts index 0234b681f..a4cc9f3b3 100644 --- a/src/commands/interaction/interactions.ts +++ b/src/commands/interaction/interactions.ts @@ -9,7 +9,7 @@ import { readFillTargetFromPositionals, readInteractionTargetFromPositionals, } from '../../core/interaction-positionals.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { assertNoRemovedSwipeInput, swipePayloadFromPositionals, diff --git a/src/commands/interaction/runtime/__tests__/test-utils/index.ts b/src/commands/interaction/runtime/__tests__/test-utils/index.ts index fcd5d247b..c7f0fe479 100644 --- a/src/commands/interaction/runtime/__tests__/test-utils/index.ts +++ b/src/commands/interaction/runtime/__tests__/test-utils/index.ts @@ -1,6 +1,6 @@ import type { AgentDeviceBackend, BackendSnapshotResult } from '../../../../../backend.ts'; import { createLocalArtifactAdapter } from '../../../../../io.ts'; -import type { SnapshotState } from '../../../../../kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; import { createAgentDevice, createMemorySessionStore, diff --git a/src/commands/interaction/runtime/gesture-command.ts b/src/commands/interaction/runtime/gesture-command.ts index d0de9b702..03dd50cc6 100644 --- a/src/commands/interaction/runtime/gesture-command.ts +++ b/src/commands/interaction/runtime/gesture-command.ts @@ -1,8 +1,8 @@ import type { AgentDeviceRuntime, CommandContext } from '../../../runtime-contract.ts'; import type { GestureIntent, GestureSemanticInput } from '../../../contracts/gesture-plan-types.ts'; import { buildGesturePlan } from '../../../contracts/gesture-plan.ts'; -import type { Point, Rect } from '../../../kernel/snapshot.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import type { Point, Rect } from '@agent-device/kernel/snapshot'; +import { AppError } from '@agent-device/kernel/errors'; import { successText } from '../../../utils/success-text.ts'; import { toBackendContext } from '../../runtime-common.ts'; import { diff --git a/src/commands/interaction/runtime/gestures.test.ts b/src/commands/interaction/runtime/gestures.test.ts index 3b95e8460..47379141a 100644 --- a/src/commands/interaction/runtime/gestures.test.ts +++ b/src/commands/interaction/runtime/gestures.test.ts @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import { ref, selector } from './selector-read.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { createInteractionDevice, runtimeScrollSnapshot, diff --git a/src/commands/interaction/runtime/gestures.ts b/src/commands/interaction/runtime/gestures.ts index 46652f82f..2339c2cc8 100644 --- a/src/commands/interaction/runtime/gestures.ts +++ b/src/commands/interaction/runtime/gestures.ts @@ -1,5 +1,5 @@ -import { AppError } from '../../../kernel/errors.ts'; -import type { Point } from '../../../kernel/snapshot.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { Point } from '@agent-device/kernel/snapshot'; import { assertExclusiveScrollDistanceInputs, honoredScrollDurationMs, diff --git a/src/commands/interaction/runtime/interactions.test.ts b/src/commands/interaction/runtime/interactions.test.ts index 8387aad70..651af4758 100644 --- a/src/commands/interaction/runtime/interactions.test.ts +++ b/src/commands/interaction/runtime/interactions.test.ts @@ -8,7 +8,7 @@ import { createMemorySessionStore, localCommandPolicy, } from '../../../runtime.ts'; -import type { Point } from '../../../kernel/snapshot.ts'; +import type { Point } from '@agent-device/kernel/snapshot'; import { makeSnapshotState } from '../../../__tests__/test-utils/index.ts'; import { coveredByTabBarSnapshot, diff --git a/src/commands/interaction/runtime/interactions.ts b/src/commands/interaction/runtime/interactions.ts index 397c041ca..91ab00757 100644 --- a/src/commands/interaction/runtime/interactions.ts +++ b/src/commands/interaction/runtime/interactions.ts @@ -1,8 +1,8 @@ -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { ClickButton } from '../../../contracts/click-button.ts'; import type { AgentDeviceRuntime, CommandContext } from '../../../runtime-contract.ts'; import { isFillableType } from '../../../snapshot/snapshot-processing.ts'; -import type { Point } from '../../../kernel/snapshot.ts'; +import type { Point } from '@agent-device/kernel/snapshot'; import { requireIntInRange } from '../../../utils/validation.ts'; import { successText } from '../../../utils/success-text.ts'; import { findMistargetedTypeRefToken } from '../../../utils/type-target-warning.ts'; diff --git a/src/commands/interaction/runtime/post-action-observation.ts b/src/commands/interaction/runtime/post-action-observation.ts index a070294a6..c807e79e0 100644 --- a/src/commands/interaction/runtime/post-action-observation.ts +++ b/src/commands/interaction/runtime/post-action-observation.ts @@ -1,4 +1,4 @@ -import type { SnapshotNode } from '../../../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import type { AgentDeviceRuntime, CommandContext } from '../../../runtime-contract.ts'; import { summarizeAxEvidence } from '../../../utils/ax-digest.ts'; import type { diff --git a/src/commands/interaction/runtime/resolution.test.ts b/src/commands/interaction/runtime/resolution.test.ts index a522ba218..b3a09482d 100644 --- a/src/commands/interaction/runtime/resolution.test.ts +++ b/src/commands/interaction/runtime/resolution.test.ts @@ -6,7 +6,7 @@ import { resolveActionableTouchResolution } from '../../../core/interaction-targ import { tryResolveRefNode } from './resolution.ts'; import { parseSelectorChain, resolveSelectorChain } from '../../../selectors/index.ts'; import { makeSnapshotState } from '../../../__tests__/test-utils/index.ts'; -import type { Point } from '../../../kernel/snapshot.ts'; +import type { Point } from '@agent-device/kernel/snapshot'; import { clickRefE2, coveredByTabBarSnapshot, diff --git a/src/commands/interaction/runtime/resolution.ts b/src/commands/interaction/runtime/resolution.ts index cd61f1774..1bb4f369c 100644 --- a/src/commands/interaction/runtime/resolution.ts +++ b/src/commands/interaction/runtime/resolution.ts @@ -1,6 +1,6 @@ -import { AppError } from '../../../kernel/errors.ts'; -import type { Point, SnapshotNode, SnapshotState } from '../../../kernel/snapshot.ts'; -import { findNodeByRef, normalizeRef } from '../../../kernel/snapshot.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { Point, SnapshotNode, SnapshotState } from '@agent-device/kernel/snapshot'; +import { findNodeByRef, normalizeRef } from '@agent-device/kernel/snapshot'; import { resolveRectCenter } from '../../../utils/rect-center.ts'; import type { AgentDeviceRuntime, diff --git a/src/commands/interaction/runtime/selector-read-shared.ts b/src/commands/interaction/runtime/selector-read-shared.ts index e56213fed..fd53f8960 100644 --- a/src/commands/interaction/runtime/selector-read-shared.ts +++ b/src/commands/interaction/runtime/selector-read-shared.ts @@ -3,9 +3,9 @@ import type { CommandContext, CommandSessionRecord, } from '../../../runtime-contract.ts'; -import { AppError } from '../../../kernel/errors.ts'; -import type { SnapshotNode, SnapshotState } from '../../../kernel/snapshot.ts'; -import { findNodeByRef, normalizeRef } from '../../../kernel/snapshot.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { SnapshotNode, SnapshotState } from '@agent-device/kernel/snapshot'; +import { findNodeByRef, normalizeRef } from '@agent-device/kernel/snapshot'; import { isSparseSnapshotQualityVerdict } from '../../../snapshot/snapshot-quality.ts'; import { extractReadableText } from '../../../utils/text-surface.ts'; import { now, toBackendContext } from '../../runtime-common.ts'; diff --git a/src/commands/interaction/runtime/selector-read.test.ts b/src/commands/interaction/runtime/selector-read.test.ts index 79e8811b2..74fb39095 100644 --- a/src/commands/interaction/runtime/selector-read.test.ts +++ b/src/commands/interaction/runtime/selector-read.test.ts @@ -17,7 +17,7 @@ import { } from './__tests__/test-utils/index.ts'; import { computeTargetEvidence } from '../../../daemon/session-target-evidence.ts'; import { WAIT_LANDMARK_MISMATCH_REASON } from '../../../replay/target-identity-node.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; test('runtime get reads text from a selector target', async () => { const snapshot = selectorReadSnapshot(); diff --git a/src/commands/interaction/runtime/selector-read.ts b/src/commands/interaction/runtime/selector-read.ts index 49f847a42..3891ad11a 100644 --- a/src/commands/interaction/runtime/selector-read.ts +++ b/src/commands/interaction/runtime/selector-read.ts @@ -5,15 +5,15 @@ import { type FindAction, type FindLocator, } from '../../../selectors/find.ts'; -import type { SnapshotNode } from '../../../kernel/snapshot.ts'; -import { findNodeByRef, normalizeRef } from '../../../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; +import { findNodeByRef, normalizeRef } from '@agent-device/kernel/snapshot'; import { isSparseSnapshotQualityVerdict, isUnreadableCaptureContentError, type SnapshotQualityVerdict, } from '../../../snapshot/snapshot-quality.ts'; import type { AgentDeviceRuntime, CommandContext } from '../../../runtime-contract.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { parseSelectorChain, type SelectorChain } from '../../../selectors/parse.ts'; import { findSelectorChainMatch, diff --git a/src/commands/interaction/runtime/settle.test.ts b/src/commands/interaction/runtime/settle.test.ts index 7ff2978d8..f34cfaf9d 100644 --- a/src/commands/interaction/runtime/settle.test.ts +++ b/src/commands/interaction/runtime/settle.test.ts @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import type { AgentDeviceBackend, BackendSnapshotResult } from '../../../backend.ts'; -import type { SnapshotState } from '../../../kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; import { createLocalArtifactAdapter } from '../../../io.ts'; import { createAgentDevice, diff --git a/src/commands/interaction/runtime/settle.ts b/src/commands/interaction/runtime/settle.ts index 28117d5e7..bd103393b 100644 --- a/src/commands/interaction/runtime/settle.ts +++ b/src/commands/interaction/runtime/settle.ts @@ -1,4 +1,4 @@ -import type { Point, SnapshotNode } from '../../../kernel/snapshot.ts'; +import type { Point, SnapshotNode } from '@agent-device/kernel/snapshot'; import type { AgentDeviceRuntime, CommandContext, diff --git a/src/commands/interaction/runtime/stable-capture.ts b/src/commands/interaction/runtime/stable-capture.ts index 68c00dfd2..6aef76032 100644 --- a/src/commands/interaction/runtime/stable-capture.ts +++ b/src/commands/interaction/runtime/stable-capture.ts @@ -1,4 +1,4 @@ -import type { SnapshotNode, SnapshotQualityVerdict } from '../../../kernel/snapshot.ts'; +import type { SnapshotNode, SnapshotQualityVerdict } from '@agent-device/kernel/snapshot'; import type { AgentDeviceRuntime, CommandContext } from '../../../runtime-contract.ts'; import { now, sleep } from '../../runtime-common.ts'; import { diff --git a/src/commands/interaction/runtime/viewport.ts b/src/commands/interaction/runtime/viewport.ts index 2642dc720..9e752f6f8 100644 --- a/src/commands/interaction/runtime/viewport.ts +++ b/src/commands/interaction/runtime/viewport.ts @@ -1,5 +1,5 @@ -import { AppError } from '../../../kernel/errors.ts'; -import type { Rect, SnapshotNode, SnapshotState } from '../../../kernel/snapshot.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { Rect, SnapshotNode, SnapshotState } from '@agent-device/kernel/snapshot'; import { isNodeVisibleInEffectiveViewport } from '../../../snapshot/mobile-snapshot-semantics.ts'; export function resolveVisibleSnapshotViewport( diff --git a/src/commands/interaction/selectors.ts b/src/commands/interaction/selectors.ts index 4b8a705ee..61d4fad7c 100644 --- a/src/commands/interaction/selectors.ts +++ b/src/commands/interaction/selectors.ts @@ -1,7 +1,7 @@ import { PUBLIC_COMMANDS } from '../../command-catalog.ts'; import type { FindOptions, IsOptions } from '../../contracts/client-selector-read.ts'; import type { CliFlags } from '../../contracts/cli-flags.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { checkIsPredicate, normalizeIsPositionals } from '../../selectors/predicates.ts'; import { direct, diff --git a/src/commands/io-policy.ts b/src/commands/io-policy.ts index bba7d62b9..3240ce83b 100644 --- a/src/commands/io-policy.ts +++ b/src/commands/io-policy.ts @@ -9,7 +9,7 @@ import type { TemporaryFile, } from '../io.ts'; import type { AgentDeviceRuntime } from '../runtime-contract.ts'; -import { AppError, asAppError } from '../kernel/errors.ts'; +import { AppError, asAppError } from '@agent-device/kernel/errors'; export async function resolveCommandInput( runtime: AgentDeviceRuntime, diff --git a/src/commands/management/app.test.ts b/src/commands/management/app.test.ts index 72170a7fc..c93cab9da 100644 --- a/src/commands/management/app.test.ts +++ b/src/commands/management/app.test.ts @@ -6,7 +6,7 @@ import path from 'node:path'; import type { CliFlags } from '../../contracts/cli-flags.ts'; import { parseArgs } from '../../cli/parser/args.ts'; import { createAgentDeviceClient } from '../../agent-device-client.ts'; -import type { DaemonRequest, DaemonResponse } from '../../kernel/contracts.ts'; +import type { DaemonRequest, DaemonResponse } from '@agent-device/kernel/contracts'; import { readMetroSessionHints, writeMetroSessionHints } from '../../metro/metro-session-hints.ts'; import { openCommandFacet } from './app.ts'; diff --git a/src/commands/management/install.ts b/src/commands/management/install.ts index d15f09db2..6a796940a 100644 --- a/src/commands/management/install.ts +++ b/src/commands/management/install.ts @@ -1,8 +1,8 @@ import { INTERNAL_COMMANDS, PUBLIC_COMMANDS } from '../../command-catalog.ts'; -import type { DaemonInstallSource } from '../../kernel/contracts.ts'; +import type { DaemonInstallSource } from '@agent-device/kernel/contracts'; import type { CliFlags } from '../../contracts/cli-flags.ts'; import type { CommandSchemaOverride } from '../../cli-schema/types.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { parseGitHubActionsArtifactInstallSourceSpec } from '../../utils/install-source-config.ts'; import { booleanField, diff --git a/src/commands/management/runtime/admin.ts b/src/commands/management/runtime/admin.ts index 168238c5e..625e74f6b 100644 --- a/src/commands/management/runtime/admin.ts +++ b/src/commands/management/runtime/admin.ts @@ -7,7 +7,7 @@ import type { BackendInstallSource, } from '../../../backend.ts'; import type { AgentDeviceRuntime, CommandContext } from '../../../runtime-contract.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { successText } from '../../../utils/success-text.ts'; import { toBackendResult, diff --git a/src/commands/management/runtime/apps.ts b/src/commands/management/runtime/apps.ts index 80c63c136..c0cace467 100644 --- a/src/commands/management/runtime/apps.ts +++ b/src/commands/management/runtime/apps.ts @@ -10,7 +10,7 @@ import type { JsonObject } from '../../../contracts/json.ts'; import type { FileInputRef } from '../../../io.ts'; import type { AgentDeviceRuntime, CommandContext } from '../../../runtime-contract.ts'; import { assertResolvedAppsFilter } from '../app-inventory-contract.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { successText } from '../../../utils/success-text.ts'; import { resolveCommandInput } from '../../io-policy.ts'; import { diff --git a/src/commands/management/session.test.ts b/src/commands/management/session.test.ts index 42c9168e3..ad8ea2222 100644 --- a/src/commands/management/session.test.ts +++ b/src/commands/management/session.test.ts @@ -2,7 +2,7 @@ import { expect, test } from 'vitest'; import { createAgentDeviceClient } from '../../agent-device-client.ts'; import { parseArgs } from '../../cli/parser/args.ts'; import { buildCommandUsageText } from '../../cli/parser/cli-help.ts'; -import type { DaemonRequest, DaemonResponse } from '../../kernel/contracts.ts'; +import type { DaemonRequest, DaemonResponse } from '@agent-device/kernel/contracts'; import type { CliFlags } from '../../contracts/cli-flags.ts'; import { sessionCommandFacet } from './session.ts'; diff --git a/src/commands/management/session.ts b/src/commands/management/session.ts index 93832a8ec..9f1926e9d 100644 --- a/src/commands/management/session.ts +++ b/src/commands/management/session.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { CommandSchemaOverride } from '../../cli-schema/types.ts'; import { booleanField, enumField, stringField } from '../command-input.ts'; import { defineExecutableCommand } from '../command-contract.ts'; diff --git a/src/commands/metro/index.ts b/src/commands/metro/index.ts index 8248cbe1a..7d98750a4 100644 --- a/src/commands/metro/index.ts +++ b/src/commands/metro/index.ts @@ -4,7 +4,7 @@ import type { MetroReloadOptions, MetroReloadResult, } from '../../contracts/metro.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { CommandSchemaOverride } from '../../cli-schema/types.ts'; import { booleanField, diff --git a/src/commands/metro/prepare-kind.ts b/src/commands/metro/prepare-kind.ts index 9983add56..2a088c2d5 100644 --- a/src/commands/metro/prepare-kind.ts +++ b/src/commands/metro/prepare-kind.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { MetroPrepareKind } from '../../contracts/metro.ts'; const METRO_PREPARE_KIND_VALUES: readonly MetroPrepareKind[] = [ diff --git a/src/commands/observability/index.ts b/src/commands/observability/index.ts index 17962ddef..d0a89d193 100644 --- a/src/commands/observability/index.ts +++ b/src/commands/observability/index.ts @@ -4,8 +4,8 @@ import type { LogsOptions, NetworkOptions, } from '../../contracts/client-observability.ts'; -import { NETWORK_INCLUDE_MODES, type NetworkIncludeMode } from '../../kernel/contracts.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { NETWORK_INCLUDE_MODES, type NetworkIncludeMode } from '@agent-device/kernel/contracts'; +import { AppError } from '@agent-device/kernel/errors'; import { parseStringMember } from '../../utils/string-enum.ts'; import type { CommandSchemaOverride } from '../../cli-schema/types.ts'; import { defineCommandFacet, defineCommandFamilyFromFacets } from '../family/types.ts'; diff --git a/src/commands/observability/output.ts b/src/commands/observability/output.ts index aa3c5febf..2e54e0c4e 100644 --- a/src/commands/observability/output.ts +++ b/src/commands/observability/output.ts @@ -1,5 +1,5 @@ import type { BackendNetworkEntry } from '../../backend.ts'; -import type { NetworkIncludeMode } from '../../kernel/contracts.ts'; +import type { NetworkIncludeMode } from '@agent-device/kernel/contracts'; import type { NetworkEntry } from '../../contracts/network-log.ts'; import type { CliOutput } from '../command-contract.ts'; import { resultOutput, type CliOutputFormatter } from '../output-common.ts'; diff --git a/src/commands/observability/runtime/diagnostics.ts b/src/commands/observability/runtime/diagnostics.ts index f98304144..f5d0190d8 100644 --- a/src/commands/observability/runtime/diagnostics.ts +++ b/src/commands/observability/runtime/diagnostics.ts @@ -8,7 +8,7 @@ import type { BackendReadLogsOptions, } from '../../../backend.ts'; import type { AgentDeviceRuntime, CommandContext } from '../../../runtime-contract.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { requireIntInRange } from '../../../utils/validation.ts'; import { formatLogsResult, formatNetworkResult, formatPerfResult } from './diagnostics-format.ts'; import type { diff --git a/src/commands/perf/index.ts b/src/commands/perf/index.ts index 37cc585b3..9fe8d9e15 100644 --- a/src/commands/perf/index.ts +++ b/src/commands/perf/index.ts @@ -1,5 +1,5 @@ import type { PerfOptions } from '../../contracts/client-observability.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { CommandSchemaOverride } from '../../cli-schema/types.ts'; import { enumField, stringField } from '../command-input.ts'; import { defineCommandFacet, defineCommandFamilyFromFacets } from '../family/types.ts'; diff --git a/src/commands/react-native/index.ts b/src/commands/react-native/index.ts index befbb4b7c..a0c38efac 100644 --- a/src/commands/react-native/index.ts +++ b/src/commands/react-native/index.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { CommandSchemaOverride } from '../../cli-schema/types.ts'; import { defineCommandFacet, defineCommandFamilyFromFacets } from '../family/types.ts'; import { defineExecutableCommand } from '../command-contract.ts'; diff --git a/src/commands/recording/index.ts b/src/commands/recording/index.ts index 2cfbe79e2..180e3c7dc 100644 --- a/src/commands/recording/index.ts +++ b/src/commands/recording/index.ts @@ -1,7 +1,7 @@ import type { RecordOptions } from '../../contracts/client-observability.ts'; import { RECORDING_EXPORT_QUALITIES } from '../../contracts/recording-export-quality.ts'; import { RECORDING_SCOPE_VALUES } from '../../contracts/recording-scope.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { CommandSchemaOverride } from '../../cli-schema/types.ts'; import { defineCommandFacet, defineCommandFamilyFromFacets } from '../family/types.ts'; import { defineExecutableCommand } from '../command-contract.ts'; diff --git a/src/commands/recording/runtime/recording.ts b/src/commands/recording/runtime/recording.ts index 4f84a2b2d..9042dac5d 100644 --- a/src/commands/recording/runtime/recording.ts +++ b/src/commands/recording/runtime/recording.ts @@ -6,7 +6,7 @@ import type { } from '../../../backend.ts'; import type { ArtifactDescriptor, FileOutputRef } from '../../../io.ts'; import type { CommandContext } from '../../../runtime-contract.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { successText } from '../../../utils/success-text.ts'; import { requireIntInRange } from '../../../utils/validation.ts'; import { diff --git a/src/commands/runtime-hints.ts b/src/commands/runtime-hints.ts index 9eb7bff8f..a9b118459 100644 --- a/src/commands/runtime-hints.ts +++ b/src/commands/runtime-hints.ts @@ -1,4 +1,4 @@ -import type { SessionRuntimeHints } from '../kernel/contracts.ts'; +import type { SessionRuntimeHints } from '@agent-device/kernel/contracts'; export type CommandRuntimeHintInput = Pick< SessionRuntimeHints, diff --git a/src/commands/system/index.ts b/src/commands/system/index.ts index 47b27a8da..fabee3a6e 100644 --- a/src/commands/system/index.ts +++ b/src/commands/system/index.ts @@ -8,7 +8,7 @@ import { TV_REMOTE_BUTTONS, tvRemoteDurationMode, } from '../../contracts/tv-remote.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { CommandSchemaOverride } from '../../cli-schema/types.ts'; import { defineCommandFacet, diff --git a/src/commands/system/runtime/system.ts b/src/commands/system/runtime/system.ts index 43feba39e..f97aa4188 100644 --- a/src/commands/system/runtime/system.ts +++ b/src/commands/system/runtime/system.ts @@ -9,7 +9,7 @@ import type { import type { CommandContext } from '../../../runtime-contract.ts'; import type { BackMode } from '../../../contracts/back-mode.ts'; import { parseTvRemoteButton } from '../../../contracts/tv-remote.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { successText } from '../../../utils/success-text.ts'; import { requireIntInRange } from '../../../utils/validation.ts'; import { isKeyboardAction } from '../../../utils/keyboard-actions.ts'; diff --git a/src/commands/text.ts b/src/commands/text.ts index 0ae4bd7f8..b482517ac 100644 --- a/src/commands/text.ts +++ b/src/commands/text.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export function normalizeOptionalText( value: string | undefined, diff --git a/src/compat/__tests__/replay-input.test.ts b/src/compat/__tests__/replay-input.test.ts index 3931d049e..44928635a 100644 --- a/src/compat/__tests__/replay-input.test.ts +++ b/src/compat/__tests__/replay-input.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { parseReplayInput } from '../replay-input.ts'; test('parseReplayInput keeps .ad parsing generic for Maestro suites', () => { diff --git a/src/compat/maestro/__tests__/daemon-runtime-port-fixtures.ts b/src/compat/maestro/__tests__/daemon-runtime-port-fixtures.ts index 52ca71d87..33691489f 100644 --- a/src/compat/maestro/__tests__/daemon-runtime-port-fixtures.ts +++ b/src/compat/maestro/__tests__/daemon-runtime-port-fixtures.ts @@ -1,5 +1,5 @@ import type { DaemonRequest } from '../../../daemon/types.ts'; -import type { SnapshotNode, SnapshotState } from '../../../kernel/snapshot.ts'; +import type { SnapshotNode, SnapshotState } from '@agent-device/kernel/snapshot'; import type { CreateDaemonMaestroRuntimeOperationsOptions } from '../daemon-runtime-port.ts'; export function makeSnapshot( diff --git a/src/compat/maestro/__tests__/engine.test.ts b/src/compat/maestro/__tests__/engine.test.ts index f8ec27ddd..687acd37c 100644 --- a/src/compat/maestro/__tests__/engine.test.ts +++ b/src/compat/maestro/__tests__/engine.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test, vi } from 'vitest'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { maestroTestFailure } from '../compatibility-errors.ts'; import { parseMaestroProgram } from '../program-ir-parser.ts'; import type { diff --git a/src/compat/maestro/__tests__/export-flow.test.ts b/src/compat/maestro/__tests__/export-flow.test.ts index 93999b16b..4b9dcd5af 100644 --- a/src/compat/maestro/__tests__/export-flow.test.ts +++ b/src/compat/maestro/__tests__/export-flow.test.ts @@ -1,6 +1,6 @@ import { parseAllDocuments } from 'yaml'; import { describe, expect, test } from 'vitest'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { exportReplayScriptToMaestro } from '../export-flow.ts'; import { parseMaestroProgram } from '../program-ir-parser.ts'; diff --git a/src/compat/maestro/__tests__/run-script.test.ts b/src/compat/maestro/__tests__/run-script.test.ts index 39e2e0845..b3b94369a 100644 --- a/src/compat/maestro/__tests__/run-script.test.ts +++ b/src/compat/maestro/__tests__/run-script.test.ts @@ -2,7 +2,7 @@ import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { expect, test } from 'vitest'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { executeRunScriptFile } from '../run-script-execution.ts'; test('executeRunScriptFile exposes env and serializes output values', () => { diff --git a/src/compat/maestro/__tests__/runtime-target-fixtures.ts b/src/compat/maestro/__tests__/runtime-target-fixtures.ts index f10d9f4d8..f5adf0fa3 100644 --- a/src/compat/maestro/__tests__/runtime-target-fixtures.ts +++ b/src/compat/maestro/__tests__/runtime-target-fixtures.ts @@ -1,4 +1,4 @@ -import type { SnapshotNode, SnapshotState } from '../../../kernel/snapshot.ts'; +import type { SnapshotNode, SnapshotState } from '@agent-device/kernel/snapshot'; export type SnapshotNodeFixture = Omit & { ref?: string }; diff --git a/src/compat/maestro/compatibility-errors.ts b/src/compat/maestro/compatibility-errors.ts index 5f54cb0c6..5238a53fc 100644 --- a/src/compat/maestro/compatibility-errors.ts +++ b/src/compat/maestro/compatibility-errors.ts @@ -1,4 +1,4 @@ -import { AppError, type AppErrorDetails } from '../../kernel/errors.ts'; +import { AppError, type AppErrorDetails } from '@agent-device/kernel/errors'; const MAESTRO_TEST_FAILURE_REASON = 'maestro-test-failure'; diff --git a/src/compat/maestro/daemon-runtime-port-observation.ts b/src/compat/maestro/daemon-runtime-port-observation.ts index 1a9d66641..1704df11a 100644 --- a/src/compat/maestro/daemon-runtime-port-observation.ts +++ b/src/compat/maestro/daemon-runtime-port-observation.ts @@ -4,9 +4,9 @@ import { getSnapshotReferenceFrame, type TouchReferenceFrame, } from '../../daemon/touch-reference-frame.ts'; -import { AppError } from '../../kernel/errors.ts'; -import { isPositiveFiniteRect, rectContains } from '../../kernel/rect.ts'; -import type { Rect, SnapshotState } from '../../kernel/snapshot.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import { isPositiveFiniteRect, rectContains } from '@agent-device/kernel/rect'; +import type { Rect, SnapshotState } from '@agent-device/kernel/snapshot'; import type { MaestroObservation, MaestroObservationCondition, diff --git a/src/compat/maestro/daemon-runtime-port-snapshot-source.ts b/src/compat/maestro/daemon-runtime-port-snapshot-source.ts index e2ac0ba1d..7b33ed82f 100644 --- a/src/compat/maestro/daemon-runtime-port-snapshot-source.ts +++ b/src/compat/maestro/daemon-runtime-port-snapshot-source.ts @@ -1,5 +1,5 @@ -import { AppError } from '../../kernel/errors.ts'; -import type { SnapshotState } from '../../kernel/snapshot.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; import type { MaestroObservationIdentity } from './engine-types.ts'; import { MAESTRO_DEFAULT_SETTLE_TIMEOUT_MS } from './compatibility-policy.ts'; import { diff --git a/src/compat/maestro/daemon-runtime-port-support.ts b/src/compat/maestro/daemon-runtime-port-support.ts index e2389082f..dd31a5f59 100644 --- a/src/compat/maestro/daemon-runtime-port-support.ts +++ b/src/compat/maestro/daemon-runtime-port-support.ts @@ -6,7 +6,7 @@ import type { DaemonResponse, DaemonResponseData, } from '../../daemon/types.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { MaestroPlatform } from './program-ir.ts'; import type { MaestroObservation } from './engine-types.ts'; import type { @@ -15,7 +15,7 @@ import type { MaestroTargetMatch, MaestroTargetQuery, } from './runtime-port-types.ts'; -import type { Rect } from '../../kernel/snapshot.ts'; +import type { Rect } from '@agent-device/kernel/snapshot'; import type { DaemonMaestroRuntimeDependencies } from './daemon-runtime-port-observation.ts'; import { stripUndefined } from '../../utils/parsing.ts'; import { diff --git a/src/compat/maestro/daemon-runtime-port.ts b/src/compat/maestro/daemon-runtime-port.ts index 0fa830264..e350255e5 100644 --- a/src/compat/maestro/daemon-runtime-port.ts +++ b/src/compat/maestro/daemon-runtime-port.ts @@ -1,5 +1,5 @@ -import { AppError, asAppError } from '../../kernel/errors.ts'; -import type { Rect } from '../../kernel/snapshot.ts'; +import { AppError, asAppError } from '@agent-device/kernel/errors'; +import type { Rect } from '@agent-device/kernel/snapshot'; import { emitDiagnostic, registerDiagnosticSensitiveValue } from '../../utils/diagnostics.ts'; import { stripUndefined } from '../../utils/parsing.ts'; import { executeRunScriptFile } from './run-script-execution.ts'; diff --git a/src/compat/maestro/daemon-runtime-public-operation.ts b/src/compat/maestro/daemon-runtime-public-operation.ts index 93b7ffc9b..778807e34 100644 --- a/src/compat/maestro/daemon-runtime-public-operation.ts +++ b/src/compat/maestro/daemon-runtime-public-operation.ts @@ -1,6 +1,6 @@ import type { CommandFlags } from '../../core/dispatch.ts'; import type { DaemonRequest } from '../../daemon/types.ts'; -import type { Point, Rect } from '../../kernel/snapshot.ts'; +import type { Point, Rect } from '@agent-device/kernel/snapshot'; import type { MaestroDispatchSelector, MaestroSinglePointerGestureInput, diff --git a/src/compat/maestro/engine-context.ts b/src/compat/maestro/engine-context.ts index ba85739cc..104d4c05a 100644 --- a/src/compat/maestro/engine-context.ts +++ b/src/compat/maestro/engine-context.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { MaestroObservation } from './engine-types.ts'; export type MaestroExecutionContext = ReturnType; diff --git a/src/compat/maestro/engine-expression.ts b/src/compat/maestro/engine-expression.ts index 07cb647f2..c82964e24 100644 --- a/src/compat/maestro/engine-expression.ts +++ b/src/compat/maestro/engine-expression.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { MaestroExecutionContext } from './engine-context.ts'; import type { MaestroPlatform } from './program-ir.ts'; diff --git a/src/compat/maestro/engine-flow.ts b/src/compat/maestro/engine-flow.ts index 6cb0e1953..365a4e2f4 100644 --- a/src/compat/maestro/engine-flow.ts +++ b/src/compat/maestro/engine-flow.ts @@ -1,5 +1,5 @@ import path from 'node:path'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { createRequestCanceledError } from '../../request/cancel.ts'; import { MAESTRO_NUMERIC_FIELD_CONSTRAINTS, diff --git a/src/compat/maestro/export-flow.ts b/src/compat/maestro/export-flow.ts index 03554d308..165880e3f 100644 --- a/src/compat/maestro/export-flow.ts +++ b/src/compat/maestro/export-flow.ts @@ -2,7 +2,7 @@ import type { SessionAction } from '../../contracts/session-action.ts'; import { GESTURE_FLING_DURATION_MS } from '../../contracts/gesture-plan.ts'; import { parseSelectorChain, type Selector } from '../../selectors/index.ts'; import type { SelectorTerm } from '../../selectors/parse.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { parseReplayScriptDetailed, readReplayScriptMetadata, diff --git a/src/compat/maestro/program-ir-parser.ts b/src/compat/maestro/program-ir-parser.ts index a8fb05192..585b5f089 100644 --- a/src/compat/maestro/program-ir-parser.ts +++ b/src/compat/maestro/program-ir-parser.ts @@ -1,5 +1,5 @@ import { isMap, isSeq, LineCounter, parseAllDocuments, type Node } from 'yaml'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { stripUndefined } from '../../utils/parsing.ts'; import type { MaestroProgram, diff --git a/src/compat/maestro/program-ir-values.ts b/src/compat/maestro/program-ir-values.ts index eb632dd42..678a55711 100644 --- a/src/compat/maestro/program-ir-values.ts +++ b/src/compat/maestro/program-ir-values.ts @@ -1,5 +1,5 @@ import { isMap, isNode, isScalar, isSeq, LineCounter, type Node } from 'yaml'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { stripUndefined } from '../../utils/parsing.ts'; import type { MaestroOptionalCommand, MaestroScalar, MaestroSourceLocation } from './program-ir.ts'; diff --git a/src/compat/maestro/replay-plan-compilation.ts b/src/compat/maestro/replay-plan-compilation.ts index 2a73013b4..e55ca10e0 100644 --- a/src/compat/maestro/replay-plan-compilation.ts +++ b/src/compat/maestro/replay-plan-compilation.ts @@ -2,7 +2,7 @@ import { computeMaestroReplayPlanDigest } from './replay-plan-digest.ts'; import type { MaestroProgram } from './program-ir.ts'; import { compileMaestroReplayPlanSteps } from './replay-plan-steps.ts'; import type { MaestroReplayPlan, MaestroReplayPlanOptions } from './replay-plan-types.ts'; -import type { SessionRuntimeHints } from '../../kernel/contracts.ts'; +import type { SessionRuntimeHints } from '@agent-device/kernel/contracts'; import { stripUndefined } from '../../utils/parsing.ts'; export async function compileMaestroReplayPlan( diff --git a/src/compat/maestro/replay-plan-execution.ts b/src/compat/maestro/replay-plan-execution.ts index d44903751..f2a45b789 100644 --- a/src/compat/maestro/replay-plan-execution.ts +++ b/src/compat/maestro/replay-plan-execution.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { createMaestroExecutionContext } from './engine-context.ts'; import { checkpointMaestroCancellation } from './engine-flow.ts'; import { DEFAULT_MAESTRO_COMPATIBILITY_TIMING_POLICY } from './compatibility-policy.ts'; diff --git a/src/compat/maestro/replay-plan-resume.ts b/src/compat/maestro/replay-plan-resume.ts index c89aa73f6..3afe0671d 100644 --- a/src/compat/maestro/replay-plan-resume.ts +++ b/src/compat/maestro/replay-plan-resume.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { MaestroReplayPlan, MaestroReplayResumePreflight, diff --git a/src/compat/maestro/replay-plan-step-execution.ts b/src/compat/maestro/replay-plan-step-execution.ts index 349ecac04..7ff9feef5 100644 --- a/src/compat/maestro/replay-plan-step-execution.ts +++ b/src/compat/maestro/replay-plan-step-execution.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { stripUndefined } from '../../utils/parsing.ts'; import { isMaestroTestFailure, maestroTestFailure } from './compatibility-errors.ts'; import { diff --git a/src/compat/maestro/replay-plan-types.ts b/src/compat/maestro/replay-plan-types.ts index 4cf9b6e89..7e4c898ce 100644 --- a/src/compat/maestro/replay-plan-types.ts +++ b/src/compat/maestro/replay-plan-types.ts @@ -1,7 +1,7 @@ import type { MaestroProgramLoader } from './program-loader.ts'; import type { MaestroPlatform, MaestroSourceLocation } from './program-ir.ts'; import type { MaestroControlCommandDescriptor, MaestroRuntimeCommand } from './engine-types.ts'; -import type { SessionRuntimeHints } from '../../kernel/contracts.ts'; +import type { SessionRuntimeHints } from '@agent-device/kernel/contracts'; export type MaestroReplayPlanScope = Readonly>; diff --git a/src/compat/maestro/run-script-execution.ts b/src/compat/maestro/run-script-execution.ts index acda0af0e..a0ad97948 100644 --- a/src/compat/maestro/run-script-execution.ts +++ b/src/compat/maestro/run-script-execution.ts @@ -1,6 +1,6 @@ import fs from 'node:fs'; import vm from 'node:vm'; -import { AppError, normalizeError } from '../../kernel/errors.ts'; +import { AppError, normalizeError } from '@agent-device/kernel/errors'; import { runCmdSync } from '../../utils/exec.ts'; import { stripUndefined } from '../../utils/parsing.ts'; diff --git a/src/compat/maestro/runtime-port-commands.ts b/src/compat/maestro/runtime-port-commands.ts index 35681ddf2..c090af1f7 100644 --- a/src/compat/maestro/runtime-port-commands.ts +++ b/src/compat/maestro/runtime-port-commands.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { pointInsideRect } from '../../utils/rect-center.ts'; import { stripUndefined } from '../../utils/parsing.ts'; import { diff --git a/src/compat/maestro/runtime-port-geometry.ts b/src/compat/maestro/runtime-port-geometry.ts index 6961f2f5d..aff57f249 100644 --- a/src/compat/maestro/runtime-port-geometry.ts +++ b/src/compat/maestro/runtime-port-geometry.ts @@ -1,7 +1,7 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { buildInPageSwipeGesturePlan } from '../../contracts/scroll-gesture.ts'; -import { isPositiveFiniteRect } from '../../kernel/rect.ts'; -import type { Rect, SnapshotState } from '../../kernel/snapshot.ts'; +import { isPositiveFiniteRect } from '@agent-device/kernel/rect'; +import type { Rect, SnapshotState } from '@agent-device/kernel/snapshot'; import { findLargestViewportRect, findNearestScrollableContainer, diff --git a/src/compat/maestro/runtime-port-observation.ts b/src/compat/maestro/runtime-port-observation.ts index 288072a5c..23b50efaf 100644 --- a/src/compat/maestro/runtime-port-observation.ts +++ b/src/compat/maestro/runtime-port-observation.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { maestroTestFailure } from './compatibility-errors.ts'; import type { MaestroObservation, diff --git a/src/compat/maestro/runtime-port-types.ts b/src/compat/maestro/runtime-port-types.ts index 50d1ef64f..3b2b9c944 100644 --- a/src/compat/maestro/runtime-port-types.ts +++ b/src/compat/maestro/runtime-port-types.ts @@ -1,4 +1,4 @@ -import type { Point, Rect } from '../../kernel/snapshot.ts'; +import type { Point, Rect } from '@agent-device/kernel/snapshot'; import type { MaestroDirection, MaestroGestureTarget, diff --git a/src/compat/maestro/runtime-target-policy.ts b/src/compat/maestro/runtime-target-policy.ts index 2fec0db0f..24ef8181f 100644 --- a/src/compat/maestro/runtime-target-policy.ts +++ b/src/compat/maestro/runtime-target-policy.ts @@ -1,5 +1,5 @@ import type { MaestroSelector } from './program-ir.ts'; -import type { SnapshotNode, SnapshotState } from '../../kernel/snapshot.ts'; +import type { SnapshotNode, SnapshotState } from '@agent-device/kernel/snapshot'; import { evaluateIsPredicate } from '../../selectors/predicates.ts'; import { normalizeText } from '../../selectors/find.ts'; import { matchesMaestroRegex } from './selector-regex.ts'; diff --git a/src/compat/maestro/runtime-target-ranking.ts b/src/compat/maestro/runtime-target-ranking.ts index b520dd9f8..791a47f58 100644 --- a/src/compat/maestro/runtime-target-ranking.ts +++ b/src/compat/maestro/runtime-target-ranking.ts @@ -1,5 +1,5 @@ -import type { Rect, SnapshotNode, SnapshotState } from '../../kernel/snapshot.ts'; -import { isPositiveFiniteRect } from '../../kernel/rect.ts'; +import type { Rect, SnapshotNode, SnapshotState } from '@agent-device/kernel/snapshot'; +import { isPositiveFiniteRect } from '@agent-device/kernel/rect'; import { buildSnapshotNodeByIndex, isDescendantOfSnapshotNode, diff --git a/src/compat/maestro/runtime-targets.ts b/src/compat/maestro/runtime-targets.ts index bb112f4ad..b85a99329 100644 --- a/src/compat/maestro/runtime-targets.ts +++ b/src/compat/maestro/runtime-targets.ts @@ -3,7 +3,7 @@ import { type Rect, type SnapshotNode, type SnapshotState, -} from '../../kernel/snapshot.ts'; +} from '@agent-device/kernel/snapshot'; import { buildIosInteractiveSnapshotPresentation, type IosInteractiveSnapshotPresentation, diff --git a/src/compat/maestro/wait-for-animation-to-end.ts b/src/compat/maestro/wait-for-animation-to-end.ts index 5dc191d8d..ee8db1e97 100644 --- a/src/compat/maestro/wait-for-animation-to-end.ts +++ b/src/compat/maestro/wait-for-animation-to-end.ts @@ -1,5 +1,5 @@ import path from 'node:path'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { captureMaestroScreenshot, compareMaestroScreenshotFiles, diff --git a/src/compat/replay-input.ts b/src/compat/replay-input.ts index de7497651..b488f5097 100644 --- a/src/compat/replay-input.ts +++ b/src/compat/replay-input.ts @@ -1,5 +1,5 @@ import type { CommandFlags } from '../core/dispatch.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { parseReplayScriptDetailed, readReplayScriptMetadata, diff --git a/src/contracts/__tests__/apple-os-capability-table-parity.test.ts b/src/contracts/__tests__/apple-os-capability-table-parity.test.ts index 406e8deec..36f334d3c 100644 --- a/src/contracts/__tests__/apple-os-capability-table-parity.test.ts +++ b/src/contracts/__tests__/apple-os-capability-table-parity.test.ts @@ -11,7 +11,7 @@ import { type DeviceInfo, type DeviceKind, type DeviceTarget, -} from '../../kernel/device.ts'; +} from '@agent-device/kernel/device'; import { ANDROID_EMULATOR, ANDROID_TV_DEVICE, diff --git a/src/contracts/__tests__/platform-plugin-parity.test.ts b/src/contracts/__tests__/platform-plugin-parity.test.ts index 34885741b..ff9e62b3a 100644 --- a/src/contracts/__tests__/platform-plugin-parity.test.ts +++ b/src/contracts/__tests__/platform-plugin-parity.test.ts @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; -import { PLATFORMS, type Platform } from '../../kernel/device.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { PLATFORMS, type Platform } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { getPlugin, registeredPlatforms, diff --git a/src/contracts/android-system-chrome.ts b/src/contracts/android-system-chrome.ts index b8ce37e23..5645abd34 100644 --- a/src/contracts/android-system-chrome.ts +++ b/src/contracts/android-system-chrome.ts @@ -1,4 +1,4 @@ -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; /** * Android status-bar/navigation-bar chrome identity, shared by the settle-chrome diff --git a/src/contracts/app-inventory.ts b/src/contracts/app-inventory.ts index 9886498e0..104e67298 100644 --- a/src/contracts/app-inventory.ts +++ b/src/contracts/app-inventory.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export type AppsFilter = 'user-installed' | 'all'; diff --git a/src/contracts/apple-multitouch-support.ts b/src/contracts/apple-multitouch-support.ts index f115a57be..d35f6b160 100644 --- a/src/contracts/apple-multitouch-support.ts +++ b/src/contracts/apple-multitouch-support.ts @@ -3,8 +3,8 @@ import { resolveDeviceAppleOs, type AppleOS, type DeviceInfo, -} from '../kernel/device.ts'; -import { AppError } from '../kernel/errors.ts'; +} from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import type { GesturePlan } from './gesture-plan-types.ts'; const APPLE_OS_DISPLAY_NAMES: Record = { diff --git a/src/contracts/audio-probe-support.ts b/src/contracts/audio-probe-support.ts index 07fe80175..05650bbc6 100644 --- a/src/contracts/audio-probe-support.ts +++ b/src/contracts/audio-probe-support.ts @@ -1,5 +1,5 @@ -import { isIosFamily, isMacOs } from '../kernel/device.ts'; -import type { DeviceInfo } from '../kernel/device.ts'; +import { isIosFamily, isMacOs } from '@agent-device/kernel/device'; +import type { DeviceInfo } from '@agent-device/kernel/device'; export function isHostSystemAudioProbeDevice(device: DeviceInfo): boolean { return ( diff --git a/src/contracts/batch-contract.ts b/src/contracts/batch-contract.ts index bf33f97e2..9466aff17 100644 --- a/src/contracts/batch-contract.ts +++ b/src/contracts/batch-contract.ts @@ -1,5 +1,5 @@ -import { daemonRuntimeSchema, type SessionRuntimeHints } from '../kernel/contracts.ts'; -import { AppError } from '../kernel/errors.ts'; +import { daemonRuntimeSchema, type SessionRuntimeHints } from '@agent-device/kernel/contracts'; +import { AppError } from '@agent-device/kernel/errors'; import { isRecord } from '../utils/parsing.ts'; export const DEFAULT_BATCH_MAX_STEPS = 100; diff --git a/src/contracts/batch-step.ts b/src/contracts/batch-step.ts index 126e70ba6..2c2c281e3 100644 --- a/src/contracts/batch-step.ts +++ b/src/contracts/batch-step.ts @@ -1,4 +1,4 @@ -import type { SessionRuntimeHints } from '../kernel/contracts.ts'; +import type { SessionRuntimeHints } from '@agent-device/kernel/contracts'; /** * One step of a daemon batch, as submitted. diff --git a/src/contracts/cli-flags.ts b/src/contracts/cli-flags.ts index d44b6a95c..fd1d7a75a 100644 --- a/src/contracts/cli-flags.ts +++ b/src/contracts/cli-flags.ts @@ -3,7 +3,7 @@ import type { RecordingExportQuality } from './recording-export-quality.ts'; import type { BackMode } from './back-mode.ts'; import type { ClickButton } from './click-button.ts'; import type { SwipePattern } from './scroll-gesture.ts'; -import type { DeviceTarget, PlatformSelector } from '../kernel/device.ts'; +import type { DeviceTarget, PlatformSelector } from '@agent-device/kernel/device'; import type { DaemonInstallSource, DaemonServerMode, @@ -13,7 +13,7 @@ import type { ResponseLevel, SessionIsolationMode, SessionRuntimeHints, -} from '../kernel/contracts.ts'; +} from '@agent-device/kernel/contracts'; import type { CloudProviderProfileFields, RemoteConfigMetroOptions, diff --git a/src/contracts/click-button.ts b/src/contracts/click-button.ts index 75ab09eb6..f369bf720 100644 --- a/src/contracts/click-button.ts +++ b/src/contracts/click-button.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export const CLICK_BUTTONS = ['primary', 'secondary', 'middle'] as const; export type ClickButton = (typeof CLICK_BUTTONS)[number]; diff --git a/src/contracts/client-app.ts b/src/contracts/client-app.ts index 838d17dcd..4a91b3266 100644 --- a/src/contracts/client-app.ts +++ b/src/contracts/client-app.ts @@ -4,8 +4,8 @@ import type { AppsFilter } from './app-inventory.ts'; import type { JsonObject } from './json.ts'; import type { SessionSurface } from './session-surface.ts'; import type { TargetShutdownResult } from './target-shutdown-contract.ts'; -import type { DaemonInstallSource, SessionRuntimeHints } from '../kernel/contracts.ts'; -import type { PublicPlatform } from '../kernel/device.ts'; +import type { DaemonInstallSource, SessionRuntimeHints } from '@agent-device/kernel/contracts'; +import type { PublicPlatform } from '@agent-device/kernel/device'; import type { AgentDeviceIdentifiers, AgentDeviceRequestOverrides, diff --git a/src/contracts/client-capture.ts b/src/contracts/client-capture.ts index bdd871268..e7de8dc80 100644 --- a/src/contracts/client-capture.ts +++ b/src/contracts/client-capture.ts @@ -3,7 +3,11 @@ import type { SessionSurface } from './session-surface.ts'; import type { PublicSnapshotCaptureAnnotations } from './snapshot-capture-annotations.ts'; import type { SnapshotDiagnosticsSummary } from './snapshot-diagnostics.ts'; -import type { SnapshotNode, SnapshotUnchanged, SnapshotVisibility } from '../kernel/snapshot.ts'; +import type { + SnapshotNode, + SnapshotUnchanged, + SnapshotVisibility, +} from '@agent-device/kernel/snapshot'; import type { ScreenshotResultData } from '../utils/screenshot-result.ts'; import type { AgentDeviceIdentifiers, diff --git a/src/contracts/client-connection.ts b/src/contracts/client-connection.ts index 0675f152a..15d751418 100644 --- a/src/contracts/client-connection.ts +++ b/src/contracts/client-connection.ts @@ -8,8 +8,8 @@ import type { ResponseLevel, SessionIsolationMode, SessionRuntimeHints, -} from '../kernel/contracts.ts'; -import type { DeviceTarget, PlatformSelector } from '../kernel/device.ts'; +} from '@agent-device/kernel/contracts'; +import type { DeviceTarget, PlatformSelector } from '@agent-device/kernel/device'; import type { CloudProviderProfileFields, RemoteConnectionProfileFields, diff --git a/src/contracts/client-device-view.ts b/src/contracts/client-device-view.ts index 9d55ed5bb..72ad5e0fd 100644 --- a/src/contracts/client-device-view.ts +++ b/src/contracts/client-device-view.ts @@ -1,6 +1,11 @@ // The public API vocabulary for what a device and an open session look like to a client. -import type { AppleOS, DeviceKind, DeviceTarget, PublicPlatform } from '../kernel/device.ts'; +import type { + AppleOS, + DeviceKind, + DeviceTarget, + PublicPlatform, +} from '@agent-device/kernel/device'; import type { AgentDeviceIdentifiers, DeviceCommandBaseOptions } from './client-connection.ts'; export type AgentDeviceDevice = { diff --git a/src/contracts/client-lease.ts b/src/contracts/client-lease.ts index 019d6db1e..fb27fba66 100644 --- a/src/contracts/client-lease.ts +++ b/src/contracts/client-lease.ts @@ -1,6 +1,6 @@ // The public API vocabulary for device lease allocation and cloud artifacts. -import type { LeaseBackend } from '../kernel/contracts.ts'; +import type { LeaseBackend } from '@agent-device/kernel/contracts'; import type { AgentDeviceRequestOverrides, AgentDeviceSelectionOptions, diff --git a/src/contracts/client-observability.ts b/src/contracts/client-observability.ts index 780eafa85..41754c457 100644 --- a/src/contracts/client-observability.ts +++ b/src/contracts/client-observability.ts @@ -4,7 +4,7 @@ import type { LogAction } from './logs.ts'; import type { PerfAction, PerfArea, PerfKind, PerfSubject } from './perf.ts'; import type { RecordingExportQuality } from './recording-export-quality.ts'; import type { RecordingScope } from './recording-scope.ts'; -import type { NetworkIncludeMode } from '../kernel/contracts.ts'; +import type { NetworkIncludeMode } from '@agent-device/kernel/contracts'; import type { AgentDeviceRequestOverrides, DeviceCommandBaseOptions } from './client-connection.ts'; export type PerfOptions = DeviceCommandBaseOptions & { diff --git a/src/contracts/client-replay.ts b/src/contracts/client-replay.ts index eaf5b1f16..cf6d6ea4a 100644 --- a/src/contracts/client-replay.ts +++ b/src/contracts/client-replay.ts @@ -1,6 +1,6 @@ // The public API vocabulary for replay and batch execution. -import type { SessionRuntimeHints } from '../kernel/contracts.ts'; +import type { SessionRuntimeHints } from '@agent-device/kernel/contracts'; import type { AgentDeviceRequestOverrides, AgentDeviceSelectionOptions, diff --git a/src/contracts/client-request.ts b/src/contracts/client-request.ts index 85be9ec15..01527eb71 100644 --- a/src/contracts/client-request.ts +++ b/src/contracts/client-request.ts @@ -13,7 +13,7 @@ import type { DaemonResponseData, NetworkIncludeMode, SessionRuntimeHints, -} from '../kernel/contracts.ts'; +} from '@agent-device/kernel/contracts'; import type { DaemonBatchStep } from './batch-step.ts'; import type { AgentDeviceClientConfig, AgentDeviceSelectionOptions } from './client-connection.ts'; diff --git a/src/contracts/cloud-artifacts.ts b/src/contracts/cloud-artifacts.ts index 671921198..f52ce456f 100644 --- a/src/contracts/cloud-artifacts.ts +++ b/src/contracts/cloud-artifacts.ts @@ -1,4 +1,4 @@ -import type { DaemonArtifactType } from '../kernel/contracts.ts'; +import type { DaemonArtifactType } from '@agent-device/kernel/contracts'; const CLOUD_ARTIFACT_KINDS = [ 'video', diff --git a/src/contracts/command-flags.ts b/src/contracts/command-flags.ts index 53d297966..f0e8367a2 100644 --- a/src/contracts/command-flags.ts +++ b/src/contracts/command-flags.ts @@ -1,6 +1,6 @@ import type { CliFlags, DaemonExcludedCliFlag } from './cli-flags.ts'; import type { DaemonBatchStep } from './batch-step.ts'; -import type { Point } from '../kernel/snapshot.ts'; +import type { Point } from '@agent-device/kernel/snapshot'; // The flag vocabulary a dispatched command is stated in terms of. // diff --git a/src/contracts/device-inventory.test.ts b/src/contracts/device-inventory.test.ts index b32bf8ee8..32b39be06 100644 --- a/src/contracts/device-inventory.test.ts +++ b/src/contracts/device-inventory.test.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; -import type { DeviceInfo } from '../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { countDeviceInventoryByGroup, LOCAL_DEVICE_INVENTORY_PLATFORM_SELECTORS, diff --git a/src/contracts/device-inventory.ts b/src/contracts/device-inventory.ts index 8dccac2e3..34e62aa2d 100644 --- a/src/contracts/device-inventory.ts +++ b/src/contracts/device-inventory.ts @@ -4,7 +4,7 @@ import { type DeviceInfo, type DeviceTarget, type PlatformSelector, -} from '../kernel/device.ts'; +} from '@agent-device/kernel/device'; export const LOCAL_DEVICE_INVENTORY_PLATFORM_SELECTORS = [ 'android', diff --git a/src/contracts/device-provider.ts b/src/contracts/device-provider.ts index be8ea643c..51894623e 100644 --- a/src/contracts/device-provider.ts +++ b/src/contracts/device-provider.ts @@ -5,8 +5,8 @@ // daemon in the spine, the shapes have to be declared below both — here — rather than // inside the daemon module that happens to consume them first. -import type { DeviceInfo } from '../kernel/device.ts'; -import type { DaemonRequest, LeaseBackend } from '../kernel/contracts.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import type { DaemonRequest, LeaseBackend } from '@agent-device/kernel/contracts'; import type { DeviceInventoryRequest } from './device-inventory.ts'; export type DeviceLease = { diff --git a/src/contracts/device-rotation.ts b/src/contracts/device-rotation.ts index bc9a9f76a..5ef754e3a 100644 --- a/src/contracts/device-rotation.ts +++ b/src/contracts/device-rotation.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export const DEVICE_ROTATIONS = [ 'portrait', diff --git a/src/contracts/device.ts b/src/contracts/device.ts index 09ea4d07b..1eafce36c 100644 --- a/src/contracts/device.ts +++ b/src/contracts/device.ts @@ -1,4 +1,9 @@ -import type { AppleOS, DeviceKind, DeviceTarget, PublicPlatform } from '../kernel/device.ts'; +import type { + AppleOS, + DeviceKind, + DeviceTarget, + PublicPlatform, +} from '@agent-device/kernel/device'; import type { TargetShutdownResult } from './target-shutdown-contract.ts'; /** diff --git a/src/contracts/dispatched-command.ts b/src/contracts/dispatched-command.ts index 3ab79a085..5a3a770d7 100644 --- a/src/contracts/dispatched-command.ts +++ b/src/contracts/dispatched-command.ts @@ -1,4 +1,4 @@ -import type { DaemonRequest as WireRequest } from '../kernel/contracts.ts'; +import type { DaemonRequest as WireRequest } from '@agent-device/kernel/contracts'; import type { CommandFlags } from './command-flags.ts'; /** diff --git a/src/contracts/doctor.ts b/src/contracts/doctor.ts index 9a2d78c19..438112afd 100644 --- a/src/contracts/doctor.ts +++ b/src/contracts/doctor.ts @@ -1,4 +1,4 @@ -import type { DeviceTarget, PlatformSelector } from '../kernel/device.ts'; +import type { DeviceTarget, PlatformSelector } from '@agent-device/kernel/device'; export type DoctorStatus = 'pass' | 'warn' | 'fail' | 'info'; diff --git a/src/contracts/gesture-input.ts b/src/contracts/gesture-input.ts index e7a144ccb..ad9fb6224 100644 --- a/src/contracts/gesture-input.ts +++ b/src/contracts/gesture-input.ts @@ -1,5 +1,5 @@ -import { AppError } from '../kernel/errors.ts'; -import type { Point } from '../kernel/snapshot.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { Point } from '@agent-device/kernel/snapshot'; import { readOptionalInteger } from './input-validation.ts'; import { SCROLL_DIRECTIONS, diff --git a/src/contracts/gesture-normalization.ts b/src/contracts/gesture-normalization.ts index de3f10f96..73e26f96c 100644 --- a/src/contracts/gesture-normalization.ts +++ b/src/contracts/gesture-normalization.ts @@ -1,5 +1,5 @@ -import type { Point } from '../kernel/snapshot.ts'; -import { AppError } from '../kernel/errors.ts'; +import type { Point } from '@agent-device/kernel/snapshot'; +import { AppError } from '@agent-device/kernel/errors'; import { readGesturePayload, type GESTURE_KINDS, type GesturePayload } from './gesture-input.ts'; import type { GestureSemanticInput } from './gesture-plan-types.ts'; diff --git a/src/contracts/gesture-plan-types.ts b/src/contracts/gesture-plan-types.ts index 6e0cb389e..94bf7f7dd 100644 --- a/src/contracts/gesture-plan-types.ts +++ b/src/contracts/gesture-plan-types.ts @@ -1,4 +1,4 @@ -import type { Point, Rect } from '../kernel/snapshot.ts'; +import type { Point, Rect } from '@agent-device/kernel/snapshot'; import type { ScrollDirection, SwipePreset } from './scroll-gesture.ts'; export type GesturePointerCount = 1 | 2; diff --git a/src/contracts/gesture-plan.ts b/src/contracts/gesture-plan.ts index 6e4dac137..2115b2f17 100644 --- a/src/contracts/gesture-plan.ts +++ b/src/contracts/gesture-plan.ts @@ -1,6 +1,6 @@ -import { AppError } from '../kernel/errors.ts'; -import type { PublicPlatform } from '../kernel/device.ts'; -import type { Point, Rect } from '../kernel/snapshot.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { PublicPlatform } from '@agent-device/kernel/device'; +import type { Point, Rect } from '@agent-device/kernel/snapshot'; import { buildSwipePresetGesturePlan, gestureDirectionDelta, diff --git a/src/contracts/input-validation.ts b/src/contracts/input-validation.ts index 86d64259f..169f1c53e 100644 --- a/src/contracts/input-validation.ts +++ b/src/contracts/input-validation.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export function readOptionalInteger( record: Record, diff --git a/src/contracts/interaction-guarantees.ts b/src/contracts/interaction-guarantees.ts index 4e91e679e..8b82578f9 100644 --- a/src/contracts/interaction-guarantees.ts +++ b/src/contracts/interaction-guarantees.ts @@ -364,7 +364,7 @@ export const INTERACTION_DISPATCH_PATHS: Record { assert.throws( diff --git a/src/core/__tests__/batch.test.ts b/src/core/__tests__/batch.test.ts index 386deec4f..82c6d8672 100644 --- a/src/core/__tests__/batch.test.ts +++ b/src/core/__tests__/batch.test.ts @@ -6,7 +6,7 @@ import { type BatchRequest, type DaemonBatchStep, } from '../batch.ts'; -import type { DaemonResponse, ResponseLevel } from '../../kernel/contracts.ts'; +import type { DaemonResponse, ResponseLevel } from '@agent-device/kernel/contracts'; test('validateAndNormalizeBatchSteps rejects unknown top-level step fields', () => { assert.throws( diff --git a/src/core/__tests__/capabilities.test.ts b/src/core/__tests__/capabilities.test.ts index 19dcf72a1..91f0031c0 100644 --- a/src/core/__tests__/capabilities.test.ts +++ b/src/core/__tests__/capabilities.test.ts @@ -1,7 +1,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { isCommandSupportedOnDevice, unsupportedHintForDevice } from '../capabilities.ts'; -import { matchesPlatformSelector, type DeviceInfo } from '../../kernel/device.ts'; +import { matchesPlatformSelector, type DeviceInfo } from '@agent-device/kernel/device'; import { WEB_DESKTOP_DEVICE } from '../../__tests__/test-utils/index.ts'; const iosSimulator: DeviceInfo = { diff --git a/src/core/__tests__/capability-plugin-routing-parity.test.ts b/src/core/__tests__/capability-plugin-routing-parity.test.ts index c2f7520e2..e0ac0d119 100644 --- a/src/core/__tests__/capability-plugin-routing-parity.test.ts +++ b/src/core/__tests__/capability-plugin-routing-parity.test.ts @@ -9,7 +9,7 @@ import { type DeviceKind, type DeviceTarget, type Platform, -} from '../../kernel/device.ts'; +} from '@agent-device/kernel/device'; import { ANDROID_EMULATOR, ANDROID_TV_DEVICE, diff --git a/src/core/__tests__/dispatch-interactions.test.ts b/src/core/__tests__/dispatch-interactions.test.ts index c8a5734f8..50f18422c 100644 --- a/src/core/__tests__/dispatch-interactions.test.ts +++ b/src/core/__tests__/dispatch-interactions.test.ts @@ -14,7 +14,7 @@ vi.mock('../../platforms/apple/core/runner/runner-client.ts', async (importOrigi import { handlePressCommand } from '../dispatch-interactions.ts'; import type { Interactor } from '../../contracts/interactor-types.ts'; import type { RunnerCommand } from '../../platforms/apple/core/runner/runner-contract.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { ANDROID_EMULATOR, IOS_SIMULATOR } from '../../__tests__/test-utils/device-fixtures.ts'; vi.mock('../../platforms/apple/os/macos/helper.ts', async (importOriginal) => { diff --git a/src/core/__tests__/dispatch-open.test.ts b/src/core/__tests__/dispatch-open.test.ts index 1fe0af502..127c2e331 100644 --- a/src/core/__tests__/dispatch-open.test.ts +++ b/src/core/__tests__/dispatch-open.test.ts @@ -1,8 +1,8 @@ import { beforeEach, test, vi } from 'vitest'; import assert from 'node:assert/strict'; import { dispatchCommand } from '../dispatch.ts'; -import { AppError } from '../../kernel/errors.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { openIosApp, setIosSetting } from '../../platforms/apple/core/apps.ts'; import { openAndroidApp } from '../../platforms/android/app-lifecycle.ts'; import { setAndroidSetting } from '../../platforms/android/settings.ts'; diff --git a/src/core/__tests__/dispatch-push.test.ts b/src/core/__tests__/dispatch-push.test.ts index 05e5e1466..b988b2f46 100644 --- a/src/core/__tests__/dispatch-push.test.ts +++ b/src/core/__tests__/dispatch-push.test.ts @@ -4,7 +4,7 @@ import { promises as fs } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { dispatchCommand } from '../dispatch.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { ANDROID_EMULATOR } from '../../__tests__/test-utils/device-fixtures.ts'; test('dispatch push reports missing payload file as INVALID_ARGS', async () => { diff --git a/src/core/__tests__/dispatch-resolve.test.ts b/src/core/__tests__/dispatch-resolve.test.ts index 6e7c52a8d..fe1512eb3 100644 --- a/src/core/__tests__/dispatch-resolve.test.ts +++ b/src/core/__tests__/dispatch-resolve.test.ts @@ -58,8 +58,8 @@ import { withDeviceInventoryProvider, withResolveTargetDeviceCacheScope, } from '../dispatch-resolve.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; -import { AppError } from '../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; const physical: DeviceInfo = { platform: 'apple', diff --git a/src/core/__tests__/dispatch-scroll.test.ts b/src/core/__tests__/dispatch-scroll.test.ts index bf793b2e4..ba54a8a9f 100644 --- a/src/core/__tests__/dispatch-scroll.test.ts +++ b/src/core/__tests__/dispatch-scroll.test.ts @@ -2,7 +2,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { dispatchCommand } from '../dispatch.ts'; import { handleLongPressCommand, handleScrollCommand } from '../dispatch-interactions.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { Interactor } from '../../contracts/interactor-types.ts'; import { IOS_SIMULATOR } from '../../__tests__/test-utils/device-fixtures.ts'; diff --git a/src/core/__tests__/dispatch-series.test.ts b/src/core/__tests__/dispatch-series.test.ts index 19fa04c22..a6322e16f 100644 --- a/src/core/__tests__/dispatch-series.test.ts +++ b/src/core/__tests__/dispatch-series.test.ts @@ -5,8 +5,8 @@ import { shouldUseIosPressSequence, chunkRunnerSequenceStepsByBudget, } from '../dispatch-series.ts'; -import { AppError } from '../../kernel/errors.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { DeviceInfo } from '@agent-device/kernel/device'; const iosDevice: DeviceInfo = { platform: 'apple', id: 'test', name: 'iPhone', kind: 'simulator' }; const androidDevice: DeviceInfo = { diff --git a/src/core/__tests__/dispatch-target.test.ts b/src/core/__tests__/dispatch-target.test.ts index 55f9a28c2..ac260058d 100644 --- a/src/core/__tests__/dispatch-target.test.ts +++ b/src/core/__tests__/dispatch-target.test.ts @@ -1,7 +1,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { resolveTargetDevice } from '../dispatch.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; test('resolveTargetDevice requires platform when target selector is provided', async () => { await assert.rejects( diff --git a/src/core/__tests__/dispatch-trigger-app-event.test.ts b/src/core/__tests__/dispatch-trigger-app-event.test.ts index 6cdbbe8bc..98f8cc1a6 100644 --- a/src/core/__tests__/dispatch-trigger-app-event.test.ts +++ b/src/core/__tests__/dispatch-trigger-app-event.test.ts @@ -4,7 +4,7 @@ import { promises as fs } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { dispatchCommand } from '../dispatch.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { ANDROID_EMULATOR, IOS_DEVICE, diff --git a/src/core/__tests__/dispatch-tv-remote.test.ts b/src/core/__tests__/dispatch-tv-remote.test.ts index 1ae482c56..6348e3123 100644 --- a/src/core/__tests__/dispatch-tv-remote.test.ts +++ b/src/core/__tests__/dispatch-tv-remote.test.ts @@ -9,7 +9,7 @@ vi.mock('../../platforms/apple/core/runner/runner-client.ts', async (importOrigi }); import { dispatchCommand } from '../dispatch.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { runAppleRunnerCommand } from '../../platforms/apple/core/runner/runner-client.ts'; import { ANDROID_EMULATOR, diff --git a/src/core/__tests__/dispatch-type.test.ts b/src/core/__tests__/dispatch-type.test.ts index 06510e4ca..159569c44 100644 --- a/src/core/__tests__/dispatch-type.test.ts +++ b/src/core/__tests__/dispatch-type.test.ts @@ -1,7 +1,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { dispatchCommand } from '../dispatch.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { ANDROID_EMULATOR } from '../../__tests__/test-utils/device-fixtures.ts'; test('dispatch type rejects ref-shaped first positional with a repair hint', async () => { diff --git a/src/core/__tests__/gesture-capabilities.test.ts b/src/core/__tests__/gesture-capabilities.test.ts index bb10df868..3434f90aa 100644 --- a/src/core/__tests__/gesture-capabilities.test.ts +++ b/src/core/__tests__/gesture-capabilities.test.ts @@ -6,8 +6,8 @@ import { normalizePublicSwipeMotion, } from '../../contracts/gesture-normalization.ts'; import { requireGestureSupported } from '../capabilities.ts'; -import { AppError } from '../../kernel/errors.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { DeviceInfo } from '@agent-device/kernel/device'; const oneFingerPan: GestureSemanticInput = { intent: 'pan', diff --git a/src/core/__tests__/gesture-plan-test-utils.ts b/src/core/__tests__/gesture-plan-test-utils.ts index 4ee203c8f..8607738f4 100644 --- a/src/core/__tests__/gesture-plan-test-utils.ts +++ b/src/core/__tests__/gesture-plan-test-utils.ts @@ -1,5 +1,5 @@ import assert from 'node:assert/strict'; -import type { Point, Rect } from '../../kernel/snapshot.ts'; +import type { Point, Rect } from '@agent-device/kernel/snapshot'; import { buildGesturePlan, type GesturePlan, diff --git a/src/core/__tests__/gesture-plan-viewport.test.ts b/src/core/__tests__/gesture-plan-viewport.test.ts index cf4b7b81f..4d4c983cb 100644 --- a/src/core/__tests__/gesture-plan-viewport.test.ts +++ b/src/core/__tests__/gesture-plan-viewport.test.ts @@ -6,8 +6,8 @@ import { gesturePayloadFromPositionals, normalizePublicGesture, } from '../../contracts/gesture-normalization.ts'; -import { PUBLIC_PLATFORMS } from '../../kernel/device.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { PUBLIC_PLATFORMS } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { COMPACT_VIEWPORTS, gestureInViewportArb, diff --git a/src/core/__tests__/snapshot-chrome-android-statusbar.test.ts b/src/core/__tests__/snapshot-chrome-android-statusbar.test.ts index 0aa127e96..02d1d2bf8 100644 --- a/src/core/__tests__/snapshot-chrome-android-statusbar.test.ts +++ b/src/core/__tests__/snapshot-chrome-android-statusbar.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import { attachRefs, type RawSnapshotNode, type SnapshotNode } from '../../kernel/snapshot.ts'; +import { attachRefs, type RawSnapshotNode, type SnapshotNode } from '@agent-device/kernel/snapshot'; import { collectSettleChromeRefs, withoutSettleChrome } from '../snapshot-chrome.ts'; import { ANDROID_IME_CAPTURE_RAW_NODES, diff --git a/src/core/__tests__/snapshot-chrome.test.ts b/src/core/__tests__/snapshot-chrome.test.ts index ce626c2c8..0edae38f5 100644 --- a/src/core/__tests__/snapshot-chrome.test.ts +++ b/src/core/__tests__/snapshot-chrome.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import { attachRefs, type RawSnapshotNode, type SnapshotNode } from '../../kernel/snapshot.ts'; +import { attachRefs, type RawSnapshotNode, type SnapshotNode } from '@agent-device/kernel/snapshot'; import { collectSettleChromeRefs } from '../snapshot-chrome.ts'; function refFor(nodes: SnapshotNode[], label: string): string { diff --git a/src/core/__tests__/web-interactor.test.ts b/src/core/__tests__/web-interactor.test.ts index 01c8e78f0..268990eeb 100644 --- a/src/core/__tests__/web-interactor.test.ts +++ b/src/core/__tests__/web-interactor.test.ts @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import { createWebInteractor } from '../interactors/web.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { withWebProvider, type WebProvider } from '../../platforms/web/provider.ts'; test('web interactor delegates first-slice operations to the scoped provider', async () => { diff --git a/src/core/app-events.ts b/src/core/app-events.ts index 1e84dc888..9f568236e 100644 --- a/src/core/app-events.ts +++ b/src/core/app-events.ts @@ -1,5 +1,10 @@ -import { isIosFamily, isMacOs, publicPlatformString, type DeviceInfo } from '../kernel/device.ts'; -import { AppError } from '../kernel/errors.ts'; +import { + isIosFamily, + isMacOs, + publicPlatformString, + type DeviceInfo, +} from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import type { JsonObject } from '../contracts/json.ts'; type AppEventDevice = Pick; diff --git a/src/core/batch-policy.ts b/src/core/batch-policy.ts index fb7377f76..9d78a1ed8 100644 --- a/src/core/batch-policy.ts +++ b/src/core/batch-policy.ts @@ -1,6 +1,6 @@ import { deriveStructuredBatchCommandNames } from './command-descriptor/derive.ts'; import { commandDescriptors } from './command-descriptor/registry.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; /** * The exact set of command names exposed through `batch`, as a narrow union. diff --git a/src/core/batch.ts b/src/core/batch.ts index ad9a4ed2c..3f6032bb1 100644 --- a/src/core/batch.ts +++ b/src/core/batch.ts @@ -7,8 +7,8 @@ import { type DaemonResponse, type ResponseLevel, isNonDefaultResponseLevel, -} from '../kernel/contracts.ts'; -import { AppError, asAppError } from '../kernel/errors.ts'; +} from '@agent-device/kernel/contracts'; +import { AppError, asAppError } from '@agent-device/kernel/errors'; import { isRecord } from '../utils/parsing.ts'; import { DEFAULT_BATCH_MAX_STEPS, diff --git a/src/core/capabilities.ts b/src/core/capabilities.ts index 9d1f88777..8df9f4228 100644 --- a/src/core/capabilities.ts +++ b/src/core/capabilities.ts @@ -2,8 +2,8 @@ import { deriveCapabilityMatrix } from './command-descriptor/derive.ts'; import { commandDescriptors } from './command-descriptor/registry.ts'; import { tryGetPlugin } from '../contracts/platform-plugin.ts'; import { registerBuiltinPlatformPlugins } from './interactors/register-builtins.ts'; -import type { DeviceInfo } from '../kernel/device.ts'; -import { AppError } from '../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import type { GestureSemanticInput } from '../contracts/gesture-plan-types.ts'; import { assertAppleMultiTouchSupported } from '../contracts/apple-multitouch-support.ts'; diff --git a/src/core/dispatch-context.ts b/src/core/dispatch-context.ts index 714a9c6b9..c22040afe 100644 --- a/src/core/dispatch-context.ts +++ b/src/core/dispatch-context.ts @@ -9,7 +9,7 @@ import type { ElementSelectorKey } from '../contracts/interactor-types.ts'; import type { SwipePattern } from '../contracts/scroll-gesture.ts'; import type { SessionSurface } from '../contracts/session-surface.ts'; import type { RunnerLogicalLeaseContext } from '../contracts/runner-lease-context.ts'; -import type { Point } from '../kernel/snapshot.ts'; +import type { Point } from '@agent-device/kernel/snapshot'; export type DispatchContext = ScreenshotDispatchFlags & { requestId?: string; diff --git a/src/core/dispatch-interactions.ts b/src/core/dispatch-interactions.ts index 6f824d02f..718cdab41 100644 --- a/src/core/dispatch-interactions.ts +++ b/src/core/dispatch-interactions.ts @@ -1,11 +1,11 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { isIosFamily, isMacOs, isTvOsDevice, publicPlatformString, type DeviceInfo, -} from '../kernel/device.ts'; +} from '@agent-device/kernel/device'; import { successText, withSuccessText } from '../utils/success-text.ts'; import { findMistargetedTypeRefToken } from '../utils/type-target-warning.ts'; import { parseScrollDirection, type ScrollDirection } from '../contracts/scroll-gesture.ts'; diff --git a/src/core/dispatch-payload.ts b/src/core/dispatch-payload.ts index 72a03fac6..7abe6f776 100644 --- a/src/core/dispatch-payload.ts +++ b/src/core/dispatch-payload.ts @@ -1,5 +1,5 @@ import { promises as fs } from 'node:fs'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { resolvePayloadInput } from '../utils/payload-input.ts'; import type { JsonObject } from '../contracts/json.ts'; diff --git a/src/core/dispatch-resolve.ts b/src/core/dispatch-resolve.ts index a8301cef4..69b213434 100644 --- a/src/core/dispatch-resolve.ts +++ b/src/core/dispatch-resolve.ts @@ -1,6 +1,6 @@ import type { DeviceInventoryProvider } from '../contracts/device-provider.ts'; import { AsyncLocalStorage } from 'node:async_hooks'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { isApplePlatform, isIosFamily, @@ -10,7 +10,7 @@ import { type DeviceInfo, type DeviceTarget, type PlatformSelector, -} from '../kernel/device.ts'; +} from '@agent-device/kernel/device'; import { withDiagnosticTimer } from '../utils/diagnostics.ts'; import { resolveAndroidSerialAllowlist, diff --git a/src/core/dispatch-series.ts b/src/core/dispatch-series.ts index 827319dff..1e662dce4 100644 --- a/src/core/dispatch-series.ts +++ b/src/core/dispatch-series.ts @@ -1,4 +1,4 @@ -import { isApplePlatform, type DeviceInfo } from '../kernel/device.ts'; +import { isApplePlatform, type DeviceInfo } from '@agent-device/kernel/device'; import { sleep } from '../utils/timeouts.ts'; export { requireIntInRange } from '../utils/validation.ts'; diff --git a/src/core/dispatch.ts b/src/core/dispatch.ts index b54d84f29..459065301 100644 --- a/src/core/dispatch.ts +++ b/src/core/dispatch.ts @@ -1,7 +1,7 @@ import { promises as fs } from 'node:fs'; import pathModule from 'node:path'; -import { AppError } from '../kernel/errors.ts'; -import { isIosFamily, type DeviceInfo } from '../kernel/device.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import { isIosFamily, type DeviceInfo } from '@agent-device/kernel/device'; import { getInteractor } from './interactors.ts'; import type { Interactor, RunnerContext } from '../contracts/interactor-types.ts'; import { isDeepLinkTarget } from '../contracts/open-target.ts'; @@ -32,7 +32,7 @@ import { parseTvRemoteButton } from '../contracts/tv-remote.ts'; import { readViewportDimension } from './viewport-dimension.ts'; import type { DescriptorDispatchCommandName } from './command-descriptor/registry.ts'; import type { GesturePlan } from '../contracts/gesture-plan-types.ts'; -import type { Rect } from '../kernel/snapshot.ts'; +import type { Rect } from '@agent-device/kernel/snapshot'; export { resolveTargetDevice } from './dispatch-resolve.ts'; export type { CommandFlags, DispatchContext } from './dispatch-context.ts'; diff --git a/src/core/interaction-positionals.ts b/src/core/interaction-positionals.ts index 30c2e3982..f9ff6ce7b 100644 --- a/src/core/interaction-positionals.ts +++ b/src/core/interaction-positionals.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { detectUnknownSelectorKeyToken, isRoleHintWord, diff --git a/src/core/interaction-targeting.ts b/src/core/interaction-targeting.ts index 25b9d476d..f3a6cfc7c 100644 --- a/src/core/interaction-targeting.ts +++ b/src/core/interaction-targeting.ts @@ -1,5 +1,5 @@ -import type { Rect, SnapshotNode } from '../kernel/snapshot.ts'; -import { centerOfRect } from '../kernel/snapshot.ts'; +import type { Rect, SnapshotNode } from '@agent-device/kernel/snapshot'; +import { centerOfRect } from '@agent-device/kernel/snapshot'; import { containsPoint, pickLargestRect } from '../utils/rect-visibility.ts'; import { findNearestHittableAncestor, normalizeType } from '../snapshot/snapshot-processing.ts'; import { isSnapshotNodeInteractionBlocked } from '../snapshot/snapshot-occlusion.ts'; diff --git a/src/core/interactors.ts b/src/core/interactors.ts index 47ab44a1f..d7a00658a 100644 --- a/src/core/interactors.ts +++ b/src/core/interactors.ts @@ -1,5 +1,5 @@ -import { publicPlatformString, type DeviceInfo } from '../kernel/device.ts'; -import { AppError } from '../kernel/errors.ts'; +import { publicPlatformString, type DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { getProviderDeviceInteractor, isActiveProviderDevice } from '../provider-device-runtime.ts'; import type { Interactor, RunnerContext } from '../contracts/interactor-types.ts'; import { getPlugin } from '../contracts/platform-plugin.ts'; diff --git a/src/core/interactors/android.ts b/src/core/interactors/android.ts index 9c06992c5..23129754a 100644 --- a/src/core/interactors/android.ts +++ b/src/core/interactors/android.ts @@ -33,7 +33,7 @@ import { snapshotAndroid } from '../../platforms/android/snapshot.ts'; import { screenshotAndroid } from '../../platforms/android/screenshot.ts'; import { withDiagnosticTimer } from '../../utils/diagnostics.ts'; import { withMethodScope } from '../../utils/method-scope.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import type { Interactor } from '../../contracts/interactor-types.ts'; import { snapshotCaptureAnnotationsFrom } from '../../contracts/snapshot-capture-annotations.ts'; diff --git a/src/core/interactors/linux.ts b/src/core/interactors/linux.ts index c5a1687de..fceb98ea7 100644 --- a/src/core/interactors/linux.ts +++ b/src/core/interactors/linux.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { withDiagnosticTimer } from '../../utils/diagnostics.ts'; import { backLinux, diff --git a/src/core/interactors/register-builtins.ts b/src/core/interactors/register-builtins.ts index c4bff9c46..daadbf19a 100644 --- a/src/core/interactors/register-builtins.ts +++ b/src/core/interactors/register-builtins.ts @@ -7,7 +7,7 @@ import { WEB_DESKTOP_DEVICE, type DeviceInventoryRequest, } from '../../contracts/device-inventory.ts'; -import type { Platform, DeviceInfo } from '../../kernel/device.ts'; +import type { Platform, DeviceInfo } from '@agent-device/kernel/device'; import { resolveAndroidDiscoverySerialAllowlist } from '../platform-inventory.ts'; // The builtin-plugin wiring lives at the interactor seam (src/core/interactors/) — diff --git a/src/core/interactors/web.ts b/src/core/interactors/web.ts index 76a4c8058..bb486f429 100644 --- a/src/core/interactors/web.ts +++ b/src/core/interactors/web.ts @@ -1,5 +1,5 @@ import type { Interactor } from '../../contracts/interactor-types.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { withDiagnosticTimer } from '../../utils/diagnostics.ts'; import { resolveWebProvider } from '../../platforms/web/provider.ts'; import { createUnsupportedInteractor } from '../../platforms/unsupported-interactor.ts'; diff --git a/src/core/lease-scope.ts b/src/core/lease-scope.ts index acd33de2a..36ba9212f 100644 --- a/src/core/lease-scope.ts +++ b/src/core/lease-scope.ts @@ -1,4 +1,4 @@ -import type { LeaseBackend } from '../kernel/contracts.ts'; +import type { LeaseBackend } from '@agent-device/kernel/contracts'; import { stripUndefined } from '../utils/parsing.ts'; const PROXY_LEASE_PROVIDER = 'proxy'; diff --git a/src/core/platform-inventory.test.ts b/src/core/platform-inventory.test.ts index 911480d19..d6b85bf02 100644 --- a/src/core/platform-inventory.test.ts +++ b/src/core/platform-inventory.test.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { test, vi } from 'vitest'; -import type { DeviceInfo } from '../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; const { listVegaDevices } = vi.hoisted(() => ({ listVegaDevices: vi.fn(), diff --git a/src/core/platform-inventory.ts b/src/core/platform-inventory.ts index 6f344b869..9c8027035 100644 --- a/src/core/platform-inventory.ts +++ b/src/core/platform-inventory.ts @@ -1,4 +1,4 @@ -import { type DeviceInfo } from '../kernel/device.ts'; +import { type DeviceInfo } from '@agent-device/kernel/device'; import { LOCAL_DEVICE_INVENTORY_PLATFORM_SELECTORS, shouldUseHostMacFastPath, diff --git a/src/core/press-retarget.test.ts b/src/core/press-retarget.test.ts index 8c2994fdf..f070cfc5c 100644 --- a/src/core/press-retarget.test.ts +++ b/src/core/press-retarget.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { buildNodes } from '../__tests__/test-utils/snapshot-builders.ts'; import { computeTargetEvidence } from '../daemon/session-target-evidence.ts'; import { buildSelectorChainForNode } from '../selectors/build.ts'; diff --git a/src/core/press-retarget.ts b/src/core/press-retarget.ts index 57acbc787..0c1894066 100644 --- a/src/core/press-retarget.ts +++ b/src/core/press-retarget.ts @@ -12,7 +12,7 @@ * `recordingTarget` — consumed exclusively at the recording boundary * (`interaction-touch-response.ts`), never in the wire response. */ -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { containsPoint } from '../utils/rect-visibility.ts'; import { resolveRectCenter } from '../utils/rect-center.ts'; import { diff --git a/src/core/react-native-overlay.ts b/src/core/react-native-overlay.ts index 184f4abda..e993ccb84 100644 --- a/src/core/react-native-overlay.ts +++ b/src/core/react-native-overlay.ts @@ -4,8 +4,8 @@ import { type RawSnapshotNode, type Rect, type SnapshotNode, -} from '../kernel/snapshot.ts'; -import { rectArea } from '../kernel/rect.ts'; +} from '@agent-device/kernel/snapshot'; +import { rectArea } from '@agent-device/kernel/rect'; type ReactNativeOverlayNode = Pick< RawSnapshotNode, diff --git a/src/core/snapshot-chrome.ts b/src/core/snapshot-chrome.ts index 669b4314e..d3914be1d 100644 --- a/src/core/snapshot-chrome.ts +++ b/src/core/snapshot-chrome.ts @@ -3,7 +3,7 @@ import { hasAndroidSystemChromeProvenance, isAndroidSystemChromeWindowResourceId, } from '../contracts/android-system-chrome.ts'; -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { isAndroidInputMethodSnapshotNode } from '../snapshot/android-input-method-overlays.ts'; import { normalizeType } from '../utils/text-surface.ts'; diff --git a/src/core/viewport-dimension.ts b/src/core/viewport-dimension.ts index f9de3e81a..7819f8ea3 100644 --- a/src/core/viewport-dimension.ts +++ b/src/core/viewport-dimension.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export function readViewportDimension( value: string | undefined, diff --git a/src/daemon.ts b/src/daemon.ts index bb995e5c9..facd1dbf0 100644 --- a/src/daemon.ts +++ b/src/daemon.ts @@ -1,5 +1,5 @@ import { startDaemonRuntime } from './daemon/server/daemon-runtime.ts'; -import { asAppError } from './kernel/errors.ts'; +import { asAppError } from '@agent-device/kernel/errors'; void startDaemonRuntime().catch((error) => { const appErr = asAppError(error); diff --git a/src/daemon/__tests__/app-log.test.ts b/src/daemon/__tests__/app-log.test.ts index c5f77b733..795470068 100644 --- a/src/daemon/__tests__/app-log.test.ts +++ b/src/daemon/__tests__/app-log.test.ts @@ -4,8 +4,8 @@ import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { finished } from 'node:stream/promises'; -import type { DeviceInfo } from '../../kernel/device.ts'; -import { AppError } from '../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { withAppleToolProvider } from '../../platforms/apple/core/tool-provider.ts'; import type { ExecResult } from '../../utils/exec.ts'; import { runAppLogDoctor, rotateAppLogIfNeeded } from '../app-log.ts'; diff --git a/src/daemon/__tests__/applog-plugin-routing-parity.test.ts b/src/daemon/__tests__/applog-plugin-routing-parity.test.ts index 21e913902..2b97452a6 100644 --- a/src/daemon/__tests__/applog-plugin-routing-parity.test.ts +++ b/src/daemon/__tests__/applog-plugin-routing-parity.test.ts @@ -8,7 +8,7 @@ import { type DeviceInfo, type DeviceKind, type DeviceTarget, -} from '../../kernel/device.ts'; +} from '@agent-device/kernel/device'; import { ANDROID_EMULATOR, ANDROID_TV_DEVICE, diff --git a/src/daemon/__tests__/device-claims.test.ts b/src/daemon/__tests__/device-claims.test.ts index 17c246f24..0901342c9 100644 --- a/src/daemon/__tests__/device-claims.test.ts +++ b/src/daemon/__tests__/device-claims.test.ts @@ -10,7 +10,7 @@ import { clearAdvisoryDeviceClaim, } from '../device-claims.ts'; import { inspectDeviceClaims } from '../device-claim-inspection.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; const device: DeviceInfo = { platform: 'android', diff --git a/src/daemon/__tests__/device-ready.test.ts b/src/daemon/__tests__/device-ready.test.ts index 5a71bc5d3..75bec2d6f 100644 --- a/src/daemon/__tests__/device-ready.test.ts +++ b/src/daemon/__tests__/device-ready.test.ts @@ -1,6 +1,6 @@ import { afterEach, beforeEach, expect, test, vi } from 'vitest'; import { promises as fs } from 'node:fs'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; vi.mock('../../utils/exec.ts', () => ({ runCmd: vi.fn(), diff --git a/src/daemon/__tests__/direct-ios-selector.test.ts b/src/daemon/__tests__/direct-ios-selector.test.ts index 3f6a3d194..a944933ec 100644 --- a/src/daemon/__tests__/direct-ios-selector.test.ts +++ b/src/daemon/__tests__/direct-ios-selector.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { isDirectIosSelectorFallbackError } from '../direct-ios-selector.ts'; test('runner ELEMENT_OFFSCREEN delegates normally but stays typed for Maestro replay', () => { diff --git a/src/daemon/__tests__/interaction-outcome-policy.test.ts b/src/daemon/__tests__/interaction-outcome-policy.test.ts index 7a866efbd..a1049455f 100644 --- a/src/daemon/__tests__/interaction-outcome-policy.test.ts +++ b/src/daemon/__tests__/interaction-outcome-policy.test.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; -import type { SnapshotState } from '../../kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; import { buildInteractionSurfaceSignature, classifyInteractionSurfaceChange, diff --git a/src/daemon/__tests__/internal-observation.test.ts b/src/daemon/__tests__/internal-observation.test.ts index e57931726..29923869a 100644 --- a/src/daemon/__tests__/internal-observation.test.ts +++ b/src/daemon/__tests__/internal-observation.test.ts @@ -2,7 +2,7 @@ import os from 'node:os'; import path from 'node:path'; import { expect, test } from 'vitest'; import { makeIosSession } from '../../__tests__/test-utils/session-factories.ts'; -import type { SnapshotState } from '../../kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; import { bindInternalObservationAuthority } from '../internal-observation.ts'; import { expireRefFrame } from '../ref-frame.ts'; import { markSessionPartialRefsIssued, setSessionSnapshot } from '../session-snapshot.ts'; diff --git a/src/daemon/__tests__/materialized-path-registry.test.ts b/src/daemon/__tests__/materialized-path-registry.test.ts index 75ab74a72..dc02d31b9 100644 --- a/src/daemon/__tests__/materialized-path-registry.test.ts +++ b/src/daemon/__tests__/materialized-path-registry.test.ts @@ -3,7 +3,7 @@ import assert from 'node:assert/strict'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { cleanupRetainedMaterializedPaths, cleanupRetainedMaterializedPathsForSession, diff --git a/src/daemon/__tests__/perf-plugin-routing-parity.test.ts b/src/daemon/__tests__/perf-plugin-routing-parity.test.ts index e889cbf32..b0e31c3d8 100644 --- a/src/daemon/__tests__/perf-plugin-routing-parity.test.ts +++ b/src/daemon/__tests__/perf-plugin-routing-parity.test.ts @@ -1,7 +1,7 @@ import type { PerfMetricsSamplerTag } from '../../contracts/perf.ts'; import assert from 'node:assert/strict'; import { test } from 'vitest'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { isIosFamily, isMacOs, @@ -10,7 +10,7 @@ import { type DeviceInfo, type DeviceKind, type DeviceTarget, -} from '../../kernel/device.ts'; +} from '@agent-device/kernel/device'; import type { AndroidAdbExecutor } from '../../platforms/android/adb-executor.ts'; import { ANDROID_EMULATOR, diff --git a/src/daemon/__tests__/providers-plugin-routing-parity.test.ts b/src/daemon/__tests__/providers-plugin-routing-parity.test.ts index b4f0cca69..b6a5ff0b2 100644 --- a/src/daemon/__tests__/providers-plugin-routing-parity.test.ts +++ b/src/daemon/__tests__/providers-plugin-routing-parity.test.ts @@ -8,7 +8,7 @@ import { type DeviceInfo, type DeviceKind, type DeviceTarget, -} from '../../kernel/device.ts'; +} from '@agent-device/kernel/device'; import { ANDROID_EMULATOR, ANDROID_TV_DEVICE, diff --git a/src/daemon/__tests__/recording-plugin-routing-parity.test.ts b/src/daemon/__tests__/recording-plugin-routing-parity.test.ts index ab22ba53f..d1ab57c26 100644 --- a/src/daemon/__tests__/recording-plugin-routing-parity.test.ts +++ b/src/daemon/__tests__/recording-plugin-routing-parity.test.ts @@ -9,7 +9,7 @@ import { type DeviceInfo, type DeviceKind, type DeviceTarget, -} from '../../kernel/device.ts'; +} from '@agent-device/kernel/device'; import { ANDROID_EMULATOR, ANDROID_TV_DEVICE, diff --git a/src/daemon/__tests__/request-finalization.test.ts b/src/daemon/__tests__/request-finalization.test.ts index 57c794159..61d5af796 100644 --- a/src/daemon/__tests__/request-finalization.test.ts +++ b/src/daemon/__tests__/request-finalization.test.ts @@ -1,7 +1,7 @@ import { test, expect } from 'vitest'; import { finalizeDaemonResponse } from '../request-finalization.ts'; import type { DaemonRequest, DaemonResponse } from '../types.ts'; -import type { DaemonArtifactType } from '../../kernel/contracts.ts'; +import type { DaemonArtifactType } from '@agent-device/kernel/contracts'; test('finalizeDaemonResponse preserves handler error hints from details', () => { const req: DaemonRequest = { diff --git a/src/daemon/__tests__/request-platform-providers.test.ts b/src/daemon/__tests__/request-platform-providers.test.ts index 40050fd5f..e09cf3bfc 100644 --- a/src/daemon/__tests__/request-platform-providers.test.ts +++ b/src/daemon/__tests__/request-platform-providers.test.ts @@ -14,7 +14,7 @@ import { runXcrun, } from '../../platforms/apple/core/tool-provider.ts'; import { resolveWebProvider, type WebProvider } from '../../platforms/web/provider.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { withRequestPlatformProviderScope } from '../request-platform-providers.ts'; import type { DaemonRequest } from '../types.ts'; diff --git a/src/daemon/__tests__/request-router-android-perf.test.ts b/src/daemon/__tests__/request-router-android-perf.test.ts index 961c9197e..f41c45080 100644 --- a/src/daemon/__tests__/request-router-android-perf.test.ts +++ b/src/daemon/__tests__/request-router-android-perf.test.ts @@ -2,7 +2,7 @@ import { expect, test } from 'vitest'; import { createRequestHandler } from '../request-router.ts'; import { LeaseRegistry } from '../lease-registry.ts'; import { SessionStore } from '../session-store.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { AndroidAdbExecutor, AndroidAdbProvider, diff --git a/src/daemon/__tests__/request-router-android-snapshot-helper.test.ts b/src/daemon/__tests__/request-router-android-snapshot-helper.test.ts index 84f3c7d7d..5be75ef70 100644 --- a/src/daemon/__tests__/request-router-android-snapshot-helper.test.ts +++ b/src/daemon/__tests__/request-router-android-snapshot-helper.test.ts @@ -2,7 +2,7 @@ import { beforeEach, expect, test } from 'vitest'; import { createRequestHandler } from '../request-router.ts'; import { LeaseRegistry } from '../lease-registry.ts'; import { SessionStore } from '../session-store.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { resetAndroidSnapshotHelperInstallCache } from '../../platforms/android/snapshot-helper-install.ts'; import { ANDROID_SNAPSHOT_HELPER_FIXTURE_ARTIFACT } from '../../__tests__/test-utils/index.ts'; import type { AndroidAdbProvider } from '../../platforms/android/adb-executor.ts'; diff --git a/src/daemon/__tests__/request-router-cost.test.ts b/src/daemon/__tests__/request-router-cost.test.ts index 89345c661..c6529f61a 100644 --- a/src/daemon/__tests__/request-router-cost.test.ts +++ b/src/daemon/__tests__/request-router-cost.test.ts @@ -21,7 +21,7 @@ import { emitDiagnostic } from '../../utils/diagnostics.ts'; import type { DaemonRequest, SessionState } from '../types.ts'; import { LeaseRegistry } from '../lease-registry.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; -import { commandRpcParamsSchema } from '../../kernel/contracts.ts'; +import { commandRpcParamsSchema } from '@agent-device/kernel/contracts'; const mockDispatch = vi.mocked(dispatchCommand); diff --git a/src/daemon/__tests__/request-router-open.test.ts b/src/daemon/__tests__/request-router-open.test.ts index b9b5902e7..127172a67 100644 --- a/src/daemon/__tests__/request-router-open.test.ts +++ b/src/daemon/__tests__/request-router-open.test.ts @@ -15,8 +15,8 @@ import { createRequestHandler } from '../request-router.ts'; import { resolveRequestExecutionLockKeys } from '../request-binding.ts'; import { LeaseRegistry } from '../lease-registry.ts'; import { ensureDeviceReady } from '../device-ready.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; -import { AppError } from '../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; const mockDispatch = vi.mocked(dispatchCommand); diff --git a/src/daemon/__tests__/request-router-repair-expired.test.ts b/src/daemon/__tests__/request-router-repair-expired.test.ts index 7d2596d87..6d56ceb23 100644 --- a/src/daemon/__tests__/request-router-repair-expired.test.ts +++ b/src/daemon/__tests__/request-router-repair-expired.test.ts @@ -15,7 +15,7 @@ vi.mock('../device-ready.ts', () => ({ ensureDeviceReady: vi.fn(async () => {}) import { createRequestHandler } from '../request-router.ts'; import type { DaemonRequest, SessionState } from '../types.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { LeaseRegistry } from '../lease-registry.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; import { parseReplayInput } from '../../compat/replay-input.ts'; diff --git a/src/daemon/__tests__/request-router-response-level.test.ts b/src/daemon/__tests__/request-router-response-level.test.ts index df99218ee..58d8f395a 100644 --- a/src/daemon/__tests__/request-router-response-level.test.ts +++ b/src/daemon/__tests__/request-router-response-level.test.ts @@ -36,7 +36,7 @@ import { createRequestHandler } from '../request-router.ts'; import type { DaemonRequest, SessionState } from '../types.ts'; import { LeaseRegistry } from '../lease-registry.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; -import { commandRpcParamsSchema } from '../../kernel/contracts.ts'; +import { commandRpcParamsSchema } from '@agent-device/kernel/contracts'; const mockDispatch = vi.mocked(dispatchCommand); diff --git a/src/daemon/__tests__/request-router-screenshot.test.ts b/src/daemon/__tests__/request-router-screenshot.test.ts index 73af0e588..8c8bf68f9 100644 --- a/src/daemon/__tests__/request-router-screenshot.test.ts +++ b/src/daemon/__tests__/request-router-screenshot.test.ts @@ -21,7 +21,7 @@ import { createRequestHandler } from '../request-router.ts'; import { dispatchScreenshotViaRuntime } from '../screenshot-runtime.ts'; import type { SessionState } from '../types.ts'; import { LeaseRegistry } from '../lease-registry.ts'; -import { attachRefs } from '../../kernel/snapshot.ts'; +import { attachRefs } from '@agent-device/kernel/snapshot'; import { PNG } from '../../utils/png.ts'; import { ANDROID_EMULATOR, IOS_SIMULATOR } from '../../__tests__/test-utils/device-fixtures.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; diff --git a/src/daemon/__tests__/request-router-typed-error.test.ts b/src/daemon/__tests__/request-router-typed-error.test.ts index f475cf750..11842047e 100644 --- a/src/daemon/__tests__/request-router-typed-error.test.ts +++ b/src/daemon/__tests__/request-router-typed-error.test.ts @@ -21,7 +21,7 @@ import { createRequestHandler } from '../request-router.ts'; import type { DaemonRequest, SessionState } from '../types.ts'; import { LeaseRegistry } from '../lease-registry.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; -import { AppError, retriableForErrorCode } from '../../kernel/errors.ts'; +import { AppError, retriableForErrorCode } from '@agent-device/kernel/errors'; import { supportedPlatformsForCommand } from '../../core/capabilities.ts'; const mockDispatch = vi.mocked(dispatchCommand); diff --git a/src/daemon/__tests__/resumable-upload.test.ts b/src/daemon/__tests__/resumable-upload.test.ts index 07eb7a276..5e7666d2d 100644 --- a/src/daemon/__tests__/resumable-upload.test.ts +++ b/src/daemon/__tests__/resumable-upload.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { finalizeResumableUpload } from '../resumable-upload.ts'; test('finalizing an unknown upload reports expiry with a recovery hint', async () => { diff --git a/src/daemon/__tests__/runtime-hints.test.ts b/src/daemon/__tests__/runtime-hints.test.ts index e55968a09..86d3922de 100644 --- a/src/daemon/__tests__/runtime-hints.test.ts +++ b/src/daemon/__tests__/runtime-hints.test.ts @@ -3,11 +3,11 @@ import assert from 'node:assert/strict'; import { promises as fs } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { applyRuntimeHintsToApp, clearRuntimeHintsFromApp } from '../runtime-hints.ts'; import { applyDeviceDefaultMetroHost } from '../handlers/session-runtime.ts'; import { resolveRuntimeTransportHints } from '../../utils/runtime-transport.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; const LEGACY_PREFS_PATH = 'shared_prefs/ReactNativeDevPrefs.xml'; diff --git a/src/daemon/__tests__/selector-capture-runtime.test.ts b/src/daemon/__tests__/selector-capture-runtime.test.ts index 3ad9b037b..37834df20 100644 --- a/src/daemon/__tests__/selector-capture-runtime.test.ts +++ b/src/daemon/__tests__/selector-capture-runtime.test.ts @@ -1,6 +1,6 @@ import { beforeEach, expect, test, vi } from 'vitest'; import { dispatchCommand } from '../../core/dispatch.ts'; -import { buildSnapshotPresentationKey } from '../../kernel/snapshot.ts'; +import { buildSnapshotPresentationKey } from '@agent-device/kernel/snapshot'; import { makeIosSession } from '../../__tests__/test-utils/index.ts'; import { makeSessionStore } from '../../__tests__/test-utils/store-factory.ts'; import { createSelectorCaptureRuntime } from '../selector-capture-runtime.ts'; diff --git a/src/daemon/__tests__/session-selector.test.ts b/src/daemon/__tests__/session-selector.test.ts index c577e7595..7a3810b13 100644 --- a/src/daemon/__tests__/session-selector.test.ts +++ b/src/daemon/__tests__/session-selector.test.ts @@ -1,7 +1,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { assertSessionSelectorMatches } from '../session-selector.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { SessionState } from '../types.ts'; function makeSession(overrides?: Partial): SessionState { diff --git a/src/daemon/__tests__/session-snapshot.test.ts b/src/daemon/__tests__/session-snapshot.test.ts index 10b88d060..9115644bb 100644 --- a/src/daemon/__tests__/session-snapshot.test.ts +++ b/src/daemon/__tests__/session-snapshot.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import type { SnapshotState } from '../../kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; import type { SessionState } from '../types.ts'; import { markSessionPartialRefsIssued, diff --git a/src/daemon/__tests__/session-target-evidence.test.ts b/src/daemon/__tests__/session-target-evidence.test.ts index 40db36c18..343f118a1 100644 --- a/src/daemon/__tests__/session-target-evidence.test.ts +++ b/src/daemon/__tests__/session-target-evidence.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import type { RawSnapshotNode, SnapshotNode } from '../../kernel/snapshot.ts'; +import type { RawSnapshotNode, SnapshotNode } from '@agent-device/kernel/snapshot'; import { computeTargetEvidence } from '../session-target-evidence.ts'; import { parseTargetAnnotationV1Payload, diff --git a/src/daemon/__tests__/snapshot-processing.test.ts b/src/daemon/__tests__/snapshot-processing.test.ts index 908da09e7..c7c6f2fa3 100644 --- a/src/daemon/__tests__/snapshot-processing.test.ts +++ b/src/daemon/__tests__/snapshot-processing.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import { attachRefs } from '../../kernel/snapshot.ts'; +import { attachRefs } from '@agent-device/kernel/snapshot'; import { extractNodeReadText, findNearestHittableAncestor, diff --git a/src/daemon/__tests__/target-shutdown.test.ts b/src/daemon/__tests__/target-shutdown.test.ts index c1bd5053d..2954461cb 100644 --- a/src/daemon/__tests__/target-shutdown.test.ts +++ b/src/daemon/__tests__/target-shutdown.test.ts @@ -1,5 +1,5 @@ import { beforeEach, expect, test, vi } from 'vitest'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; vi.mock('../../platforms/apple/core/simulator.ts', async (importOriginal) => { const actual = await importOriginal(); diff --git a/src/daemon/__tests__/tenant-owned-entry.test.ts b/src/daemon/__tests__/tenant-owned-entry.test.ts index 496ce36d6..fbc7ee201 100644 --- a/src/daemon/__tests__/tenant-owned-entry.test.ts +++ b/src/daemon/__tests__/tenant-owned-entry.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { expiredTenantOwnedEntryError, requireTenantOwnedEntry, diff --git a/src/daemon/android-snapshot-freshness.ts b/src/daemon/android-snapshot-freshness.ts index 2f5ecf7c7..2e94aae1f 100644 --- a/src/daemon/android-snapshot-freshness.ts +++ b/src/daemon/android-snapshot-freshness.ts @@ -1,4 +1,4 @@ -import type { SnapshotState } from '../kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; import type { AndroidSnapshotFreshness, SessionState } from './types.ts'; export type { AndroidSnapshotFreshness } from './types.ts'; diff --git a/src/daemon/android-snapshot-timeout-evidence.ts b/src/daemon/android-snapshot-timeout-evidence.ts index 918699aed..10d9fd35a 100644 --- a/src/daemon/android-snapshot-timeout-evidence.ts +++ b/src/daemon/android-snapshot-timeout-evidence.ts @@ -4,8 +4,8 @@ import path from 'node:path'; import type { DaemonResponse, SessionState } from './types.ts'; import { dispatchCommand } from '../core/dispatch.ts'; import { emitDiagnostic } from '../utils/diagnostics.ts'; -import { normalizeError, type NormalizedError } from '../kernel/errors.ts'; -import type { ScreenshotOverlayRef } from '../kernel/snapshot.ts'; +import { normalizeError, type NormalizedError } from '@agent-device/kernel/errors'; +import type { ScreenshotOverlayRef } from '@agent-device/kernel/snapshot'; import { contextFromFlags } from './context.ts'; import { annotateScreenshotWithRefs } from './screenshot-overlay.ts'; diff --git a/src/daemon/android-system-dialog.ts b/src/daemon/android-system-dialog.ts index c02d675a3..03cd31d40 100644 --- a/src/daemon/android-system-dialog.ts +++ b/src/daemon/android-system-dialog.ts @@ -7,8 +7,8 @@ import { import { snapshotAndroid } from '../platforms/android/snapshot.ts'; import { runAndroidAdb } from '../platforms/android/adb.ts'; import { emitDiagnostic } from '../utils/diagnostics.ts'; -import { AppError } from '../kernel/errors.ts'; -import { centerOfRect, attachRefs, type SnapshotNode } from '../kernel/snapshot.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import { centerOfRect, attachRefs, type SnapshotNode } from '@agent-device/kernel/snapshot'; import { sleep } from '../utils/timeouts.ts'; import { pruneGroupNodes } from '../snapshot/snapshot-processing.ts'; import { expireRefFrame } from './ref-frame.ts'; diff --git a/src/daemon/app-log-android.ts b/src/daemon/app-log-android.ts index f172ee20a..0fe0c8541 100644 --- a/src/daemon/app-log-android.ts +++ b/src/daemon/app-log-android.ts @@ -9,7 +9,7 @@ import { captureAndroidLogcatWithAdb, streamAndroidLogcatWithAdb, } from '../platforms/android/logcat.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { clearPidFile, readStoredAppLogProcessMeta, diff --git a/src/daemon/app-log-doctor.ts b/src/daemon/app-log-doctor.ts index 145df7a38..b3bd1509b 100644 --- a/src/daemon/app-log-doctor.ts +++ b/src/daemon/app-log-doctor.ts @@ -1,4 +1,4 @@ -import { isIosFamily, isMacOs, type DeviceInfo } from '../kernel/device.ts'; +import { isIosFamily, isMacOs, type DeviceInfo } from '@agent-device/kernel/device'; import { runXcrun } from '../platforms/apple/core/tool-provider.ts'; import { runAndroidAdb } from '../platforms/android/adb.ts'; import { runCmd } from '../utils/exec.ts'; diff --git a/src/daemon/app-log-ios.ts b/src/daemon/app-log-ios.ts index f8e6edce6..27c236acb 100644 --- a/src/daemon/app-log-ios.ts +++ b/src/daemon/app-log-ios.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { buildSimctlArgs } from '../platforms/apple/core/simctl.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { runCmd, runCmdBackground } from '../utils/exec.ts'; import { runXcrun } from '../platforms/apple/core/tool-provider.ts'; import { diff --git a/src/daemon/app-log.ts b/src/daemon/app-log.ts index b95092f22..3bb12e4ce 100644 --- a/src/daemon/app-log.ts +++ b/src/daemon/app-log.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; -import { isIosFamily, isMacOs, type DeviceInfo } from '../kernel/device.ts'; -import { AppError } from '../kernel/errors.ts'; +import { isIosFamily, isMacOs, type DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { tryGetPlugin } from '../contracts/platform-plugin.ts'; import { registerBuiltinPlatformPlugins } from '../core/interactors/register-builtins.ts'; import { createScopedProvider } from '../utils/scoped-provider.ts'; diff --git a/src/daemon/apple-runner-options.ts b/src/daemon/apple-runner-options.ts index 005be947a..4215d15f4 100644 --- a/src/daemon/apple-runner-options.ts +++ b/src/daemon/apple-runner-options.ts @@ -2,7 +2,7 @@ import { isDeepLinkTarget } from '../contracts/open-target.ts'; import type { SessionSurface } from '../contracts/session-surface.ts'; import type { AppleRunnerLifecycleOptions } from '../platforms/apple/core/runner/runner-provider.ts'; import { prewarmAppleRunnerCache } from '../platforms/apple/core/runner/runner-client.ts'; -import { isIosFamily, type DeviceInfo } from '../kernel/device.ts'; +import { isIosFamily, type DeviceInfo } from '@agent-device/kernel/device'; import { isActiveProviderDevice } from '../provider-device-runtime.ts'; import { contextFromFlags } from './context.ts'; import type { DaemonRequest } from './types.ts'; diff --git a/src/daemon/artifact-archive.ts b/src/daemon/artifact-archive.ts index ab2108530..8cda6a8f8 100644 --- a/src/daemon/artifact-archive.ts +++ b/src/daemon/artifact-archive.ts @@ -1,6 +1,6 @@ import fs from 'node:fs'; import path from 'node:path'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { runCmd } from '../utils/exec.ts'; export async function extractTarInstallableArtifact(params: { diff --git a/src/daemon/artifact-download.ts b/src/daemon/artifact-download.ts index 62a4323c7..723ecefba 100644 --- a/src/daemon/artifact-download.ts +++ b/src/daemon/artifact-download.ts @@ -4,7 +4,7 @@ import path from 'node:path'; import { once } from 'node:events'; import { Transform } from 'node:stream'; import { pipeline } from 'node:stream/promises'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; const MAX_ARTIFACT_BYTES = 2 * 1024 * 1024 * 1024; // 2 GB const TEMP_PREFIX = 'agent-device-artifact-'; diff --git a/src/daemon/artifact-tracking.ts b/src/daemon/artifact-tracking.ts index fffbc91e7..df4044003 100644 --- a/src/daemon/artifact-tracking.ts +++ b/src/daemon/artifact-tracking.ts @@ -2,8 +2,8 @@ import crypto from 'node:crypto'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import { AppError } from '../kernel/errors.ts'; -import type { DaemonArtifactType } from '../kernel/contracts.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { DaemonArtifactType } from '@agent-device/kernel/contracts'; import { runCmd } from '../utils/exec.ts'; import { expiredTenantOwnedEntryError, diff --git a/src/daemon/audio-probe.ts b/src/daemon/audio-probe.ts index 31a19cf56..5944fff9b 100644 --- a/src/daemon/audio-probe.ts +++ b/src/daemon/audio-probe.ts @@ -6,7 +6,7 @@ import { type AudioProbeResult, } from '../contracts/audio-probe-result.ts'; import type { HostAudioProbeBackend } from '../platforms/audio-probe-backend.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { sleep } from '../utils/timeouts.ts'; import type { SessionStore } from './session-store.ts'; import type { SessionState } from './types.ts'; diff --git a/src/daemon/client/daemon-client-lifecycle.ts b/src/daemon/client/daemon-client-lifecycle.ts index 07804b5fa..3555cc885 100644 --- a/src/daemon/client/daemon-client-lifecycle.ts +++ b/src/daemon/client/daemon-client-lifecycle.ts @@ -2,7 +2,7 @@ import fs from 'node:fs'; import net from 'node:net'; import os from 'node:os'; import path from 'node:path'; -import { AppError, normalizeError } from '../../kernel/errors.ts'; +import { AppError, normalizeError } from '@agent-device/kernel/errors'; import type { DaemonRequest, DaemonResponse } from '../types.ts'; import { runCmdDetachedMonitored, type ExecDetachedExit } from '../../utils/exec.ts'; import { findProjectRoot, readVersion } from '../../utils/version.ts'; diff --git a/src/daemon/client/daemon-client-progress.ts b/src/daemon/client/daemon-client-progress.ts index 06030030f..c1aa1e000 100644 --- a/src/daemon/client/daemon-client-progress.ts +++ b/src/daemon/client/daemon-client-progress.ts @@ -1,6 +1,6 @@ import http from 'node:http'; import type { Socket } from 'node:net'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { DaemonRequest, DaemonResponse } from '../types.ts'; import type { RequestProgressEvent, RequestProgressSink } from '../../request/progress.ts'; import { consumeTextLines } from '../../utils/line-stream.ts'; diff --git a/src/daemon/client/daemon-client-rpc.ts b/src/daemon/client/daemon-client-rpc.ts index 81343cb9e..7fd1766ac 100644 --- a/src/daemon/client/daemon-client-rpc.ts +++ b/src/daemon/client/daemon-client-rpc.ts @@ -1,4 +1,4 @@ -import { AppError, toAppErrorCode } from '../../kernel/errors.ts'; +import { AppError, toAppErrorCode } from '@agent-device/kernel/errors'; import { createRequestId } from '../../utils/diagnostics.ts'; import type { DaemonRequest, DaemonResponse } from '../types.ts'; import { materializeRemoteArtifacts } from '../../remote/daemon-artifacts.ts'; diff --git a/src/daemon/client/daemon-client-timeout.ts b/src/daemon/client/daemon-client-timeout.ts index c2f4916b4..da71ddd84 100644 --- a/src/daemon/client/daemon-client-timeout.ts +++ b/src/daemon/client/daemon-client-timeout.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { runCmdSync } from '../../utils/exec.ts'; import { emitDiagnostic } from '../../utils/diagnostics.ts'; import { isAgentDeviceDaemonProcess } from '../daemon-process.ts'; diff --git a/src/daemon/client/daemon-client-transport.ts b/src/daemon/client/daemon-client-transport.ts index e73277ade..e7b604e18 100644 --- a/src/daemon/client/daemon-client-transport.ts +++ b/src/daemon/client/daemon-client-transport.ts @@ -1,7 +1,7 @@ import net from 'node:net'; import http from 'node:http'; import https from 'node:https'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { readNodeHttpResponseBody } from '../../utils/node-http.ts'; import type { DaemonRequest, DaemonResponse } from '../types.ts'; import { emitDiagnostic } from '../../utils/diagnostics.ts'; diff --git a/src/daemon/client/daemon-client.ts b/src/daemon/client/daemon-client.ts index fb46efd7b..6ca84684d 100644 --- a/src/daemon/client/daemon-client.ts +++ b/src/daemon/client/daemon-client.ts @@ -3,7 +3,7 @@ import type { DaemonResponse as SharedDaemonResponse, } from '../types.ts'; import type { RequestProgressSink } from '../../request/progress.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { createRequestId, emitDiagnostic, withDiagnosticTimer } from '../../utils/diagnostics.ts'; import { INTERNAL_COMMANDS, PUBLIC_COMMANDS } from '../../command-catalog.ts'; import { prepareRemoteRequestArtifacts } from '../../remote/daemon-artifacts.ts'; diff --git a/src/daemon/config.ts b/src/daemon/config.ts index dbf58eec9..53ed43842 100644 --- a/src/daemon/config.ts +++ b/src/daemon/config.ts @@ -9,7 +9,7 @@ import type { DaemonServerMode, DaemonTransportPreference, SessionIsolationMode, -} from '../kernel/contracts.ts'; +} from '@agent-device/kernel/contracts'; export type { DaemonServerMode, DaemonTransportPreference, SessionIsolationMode }; export type DaemonPaths = { diff --git a/src/daemon/daemon-stop.ts b/src/daemon/daemon-stop.ts index 815405916..6505f60e1 100644 --- a/src/daemon/daemon-stop.ts +++ b/src/daemon/daemon-stop.ts @@ -1,5 +1,5 @@ import fs from 'node:fs'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { isAgentDeviceDaemonProcess, trySignalProcess } from './daemon-process.ts'; import { isProcessAlive, waitForProcessExit } from '../utils/host-process.ts'; import { sleep } from '../utils/timeouts.ts'; diff --git a/src/daemon/device-claim-inspection.ts b/src/daemon/device-claim-inspection.ts index eae73527e..6512bb8e9 100644 --- a/src/daemon/device-claim-inspection.ts +++ b/src/daemon/device-claim-inspection.ts @@ -4,7 +4,7 @@ import { deviceFieldsFromPublicPlatform, matchesPlatformSelector, type PlatformSelector, -} from '../kernel/device.ts'; +} from '@agent-device/kernel/device'; import { classifyOwnerLiveness, type OwnerLiveness } from '../utils/owner-identity.ts'; import { resolveDeviceClaimRoot } from './device-claim-paths.ts'; import type { DeviceClaim } from './device-claims.ts'; diff --git a/src/daemon/device-claims.ts b/src/daemon/device-claims.ts index 2d9af8677..2d7eb1c62 100644 --- a/src/daemon/device-claims.ts +++ b/src/daemon/device-claims.ts @@ -1,7 +1,7 @@ import crypto from 'node:crypto'; import fs from 'node:fs'; import path from 'node:path'; -import { publicPlatformString, type DeviceInfo } from '../kernel/device.ts'; +import { publicPlatformString, type DeviceInfo } from '@agent-device/kernel/device'; import { emitDiagnostic } from '../utils/diagnostics.ts'; import { acquireProcessLock } from '../utils/process-lock.ts'; import { ownerIdentityMatches, readCurrentOwnerIdentity } from '../utils/owner-identity.ts'; diff --git a/src/daemon/device-ready.ts b/src/daemon/device-ready.ts index 6828a8471..04411b56f 100644 --- a/src/daemon/device-ready.ts +++ b/src/daemon/device-ready.ts @@ -1,4 +1,4 @@ -import { isIosFamily, type DeviceInfo } from '../kernel/device.ts'; +import { isIosFamily, type DeviceInfo } from '@agent-device/kernel/device'; import { resolveIosPhysicalDeviceControl } from '../platforms/apple/core/physical-device-control.ts'; import { isActiveProviderDevice } from '../provider-device-runtime.ts'; import { createTtlMemo } from '../utils/ttl-memo.ts'; diff --git a/src/daemon/device-targets.ts b/src/daemon/device-targets.ts index 91b0b714f..76551b008 100644 --- a/src/daemon/device-targets.ts +++ b/src/daemon/device-targets.ts @@ -1,4 +1,4 @@ -import { isIosFamily, type DeviceInfo } from '../kernel/device.ts'; +import { isIosFamily, type DeviceInfo } from '@agent-device/kernel/device'; export function isIosSimulator(device: DeviceInfo): boolean { return isIosFamily(device) && device.kind === 'simulator'; diff --git a/src/daemon/direct-ios-selector.ts b/src/daemon/direct-ios-selector.ts index 093517127..f07e0c553 100644 --- a/src/daemon/direct-ios-selector.ts +++ b/src/daemon/direct-ios-selector.ts @@ -1,8 +1,8 @@ -import { isIosFamily } from '../kernel/device.ts'; +import { isIosFamily } from '@agent-device/kernel/device'; import { isActiveProviderDevice } from '../provider-device-runtime.ts'; import type { SessionState } from './types.ts'; import { tryParseSelectorChain } from '../selectors/index.ts'; -import { asAppError } from '../kernel/errors.ts'; +import { asAppError } from '@agent-device/kernel/errors'; import type { ElementSelectorTapOptions } from '../contracts/interactor-types.ts'; export type DirectIosSelectorTarget = ElementSelectorTapOptions & { raw: string }; diff --git a/src/daemon/downloadable-artifact-http.ts b/src/daemon/downloadable-artifact-http.ts index 979ee3cc4..49e6b501c 100644 --- a/src/daemon/downloadable-artifact-http.ts +++ b/src/daemon/downloadable-artifact-http.ts @@ -1,6 +1,6 @@ import fs from 'node:fs'; import http from 'node:http'; -import { normalizeError } from '../kernel/errors.ts'; +import { normalizeError } from '@agent-device/kernel/errors'; import type { DaemonRequest } from './types.ts'; import { cleanupDownloadableArtifact, diff --git a/src/daemon/handlers/__tests__/interaction-android-recovery-abort.test.ts b/src/daemon/handlers/__tests__/interaction-android-recovery-abort.test.ts index 7c5a8d07c..16917bbd9 100644 --- a/src/daemon/handlers/__tests__/interaction-android-recovery-abort.test.ts +++ b/src/daemon/handlers/__tests__/interaction-android-recovery-abort.test.ts @@ -40,7 +40,7 @@ vi.mock('../../android-system-dialog.ts', async (importOriginal) => { import { handleInteractionCommands } from '../interaction.ts'; import { dispatchCommand } from '../../../core/dispatch.ts'; -import { attachRefs } from '../../../kernel/snapshot.ts'; +import { attachRefs } from '@agent-device/kernel/snapshot'; import { makeAndroidSession } from '../../../__tests__/test-utils/session-factories.ts'; import { makeSessionStore } from '../../../__tests__/test-utils/store-factory.ts'; diff --git a/src/daemon/handlers/__tests__/interaction-common.test.ts b/src/daemon/handlers/__tests__/interaction-common.test.ts index e46c6dc96..12a62bacc 100644 --- a/src/daemon/handlers/__tests__/interaction-common.test.ts +++ b/src/daemon/handlers/__tests__/interaction-common.test.ts @@ -1,7 +1,7 @@ import { beforeEach, expect, test, vi } from 'vitest'; import { makeIosSession } from '../../../__tests__/test-utils/session-factories.ts'; import { makeSessionStore } from '../../../__tests__/test-utils/store-factory.ts'; -import { attachRefs, type RawSnapshotNode } from '../../../kernel/snapshot.ts'; +import { attachRefs, type RawSnapshotNode } from '@agent-device/kernel/snapshot'; import type { CommandFlags } from '../../../core/dispatch.ts'; import { handleInteractionCommands } from '../interaction.ts'; import { finalizeTouchInteraction } from '../interaction-common.ts'; diff --git a/src/daemon/handlers/__tests__/interaction-read.test.ts b/src/daemon/handlers/__tests__/interaction-read.test.ts index af2d4024d..6f5414bbd 100644 --- a/src/daemon/handlers/__tests__/interaction-read.test.ts +++ b/src/daemon/handlers/__tests__/interaction-read.test.ts @@ -1,5 +1,5 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; -import type { SnapshotNode } from '../../../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; vi.mock('../../../core/dispatch.ts', async (importOriginal) => { const actual = await importOriginal(); diff --git a/src/daemon/handlers/__tests__/interaction-settle.test.ts b/src/daemon/handlers/__tests__/interaction-settle.test.ts index a4018d432..21cf1928b 100644 --- a/src/daemon/handlers/__tests__/interaction-settle.test.ts +++ b/src/daemon/handlers/__tests__/interaction-settle.test.ts @@ -3,7 +3,7 @@ import { handleInteractionCommands } from '../interaction.ts'; import type { SessionStore } from '../../session-store.ts'; import type { SessionState } from '../../types.ts'; import type { CommandFlags } from '../../../core/dispatch.ts'; -import type { SnapshotBackend } from '../../../kernel/snapshot.ts'; +import type { SnapshotBackend } from '@agent-device/kernel/snapshot'; import { buildSnapshotState } from '../snapshot-capture.ts'; import { setSessionSnapshot } from '../../session-snapshot.ts'; import { activateCompleteRefFrame } from '../../ref-frame.ts'; diff --git a/src/daemon/handlers/__tests__/interaction-target-evidence.test.ts b/src/daemon/handlers/__tests__/interaction-target-evidence.test.ts index 16e5d5123..da3b5a5bc 100644 --- a/src/daemon/handlers/__tests__/interaction-target-evidence.test.ts +++ b/src/daemon/handlers/__tests__/interaction-target-evidence.test.ts @@ -3,7 +3,7 @@ import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { handleInteractionCommands } from '../interaction.ts'; -import { attachRefs, type RawSnapshotNode } from '../../../kernel/snapshot.ts'; +import { attachRefs, type RawSnapshotNode } from '@agent-device/kernel/snapshot'; import { makeSessionStore } from '../../../__tests__/test-utils/store-factory.ts'; import { makeIosSession } from '../../../__tests__/test-utils/session-factories.ts'; import { SessionScriptWriter } from '../../session-script-writer.ts'; diff --git a/src/daemon/handlers/__tests__/interaction.test.ts b/src/daemon/handlers/__tests__/interaction.test.ts index 8450fbbf8..e11797687 100644 --- a/src/daemon/handlers/__tests__/interaction.test.ts +++ b/src/daemon/handlers/__tests__/interaction.test.ts @@ -3,8 +3,8 @@ import { handleInteractionCommands } from '../interaction.ts'; import type { SessionStore } from '../../session-store.ts'; import type { SessionState } from '../../types.ts'; import type { CommandFlags } from '../../../core/dispatch.ts'; -import { attachRefs, type SnapshotBackend } from '../../../kernel/snapshot.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { attachRefs, type SnapshotBackend } from '@agent-device/kernel/snapshot'; +import { AppError } from '@agent-device/kernel/errors'; import { buildSnapshotState } from '../snapshot-capture.ts'; import { setSessionSnapshot, STALE_SNAPSHOT_REFS_WARNING } from '../../session-snapshot.ts'; import { activateCompleteRefFrame, expireRefFrame } from '../../ref-frame.ts'; diff --git a/src/daemon/handlers/__tests__/session-appstate-input-perf.test.ts b/src/daemon/handlers/__tests__/session-appstate-input-perf.test.ts index d2c344ae0..03c034f1f 100644 --- a/src/daemon/handlers/__tests__/session-appstate-input-perf.test.ts +++ b/src/daemon/handlers/__tests__/session-appstate-input-perf.test.ts @@ -2,7 +2,7 @@ import { test, expect, vi } from 'vitest'; import * as fs from 'node:fs'; import * as os from 'node:os'; import * as path from 'node:path'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { mockDispatch, mockResolveTargetDevice, diff --git a/src/daemon/handlers/__tests__/session-boot-shutdown.test.ts b/src/daemon/handlers/__tests__/session-boot-shutdown.test.ts index 63ba4e696..fc8f4c8f7 100644 --- a/src/daemon/handlers/__tests__/session-boot-shutdown.test.ts +++ b/src/daemon/handlers/__tests__/session-boot-shutdown.test.ts @@ -1,7 +1,7 @@ import { test, expect } from 'vitest'; import * as os from 'node:os'; import * as path from 'node:path'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { mockResolveTargetDevice, mockEnsureDeviceReady, diff --git a/src/daemon/handlers/__tests__/session-capabilities.test.ts b/src/daemon/handlers/__tests__/session-capabilities.test.ts index f9f740d1d..08dc3e4dd 100644 --- a/src/daemon/handlers/__tests__/session-capabilities.test.ts +++ b/src/daemon/handlers/__tests__/session-capabilities.test.ts @@ -4,7 +4,7 @@ import os from 'node:os'; import { PUBLIC_COMMANDS } from '../../../command-catalog.ts'; import { makeAndroidSession, makeSessionStore } from '../../../__tests__/test-utils/index.ts'; import { withTargetDeviceResolutionScope } from '../../../core/dispatch-resolve.ts'; -import type { DeviceInfo } from '../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { handleSessionCommands } from '../session.ts'; function assertAndroidCapabilityHonesty(availableCommands: unknown): void { diff --git a/src/daemon/handlers/__tests__/session-close-script.test.ts b/src/daemon/handlers/__tests__/session-close-script.test.ts index 221fb67be..c14c00780 100644 --- a/src/daemon/handlers/__tests__/session-close-script.test.ts +++ b/src/daemon/handlers/__tests__/session-close-script.test.ts @@ -2,7 +2,7 @@ import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { afterEach, expect, test, vi } from 'vitest'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { makeIosSession } from '../../../__tests__/test-utils/session-factories.ts'; import { SessionStore } from '../../session-store.ts'; import type { DaemonRequest } from '../../types.ts'; diff --git a/src/daemon/handlers/__tests__/session-close-shutdown.test.ts b/src/daemon/handlers/__tests__/session-close-shutdown.test.ts index f709d33e6..7434422c9 100644 --- a/src/daemon/handlers/__tests__/session-close-shutdown.test.ts +++ b/src/daemon/handlers/__tests__/session-close-shutdown.test.ts @@ -4,7 +4,7 @@ import os from 'node:os'; import path from 'node:path'; import { SessionStore } from '../../session-store.ts'; import type { DaemonRequest, DaemonResponse, SessionState } from '../../types.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; vi.mock('../../../platforms/apple/core/simulator.ts', async (importOriginal) => { const actual = diff --git a/src/daemon/handlers/__tests__/session-device-claims.test.ts b/src/daemon/handlers/__tests__/session-device-claims.test.ts index 9a5763874..eeb206d12 100644 --- a/src/daemon/handlers/__tests__/session-device-claims.test.ts +++ b/src/daemon/handlers/__tests__/session-device-claims.test.ts @@ -34,9 +34,9 @@ import { LeaseRegistry } from '../../lease-registry.ts'; import { SessionStore } from '../../session-store.ts'; import { handleCloseCommand } from '../session-close.ts'; import { handleOpenCommand } from '../session-open.ts'; -import type { DeviceInfo } from '../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import type { SessionState } from '../../types.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; const mockDispatch = vi.mocked(dispatchCommand); const mockResolveTargetDevice = vi.mocked(resolveTargetDevice); diff --git a/src/daemon/handlers/__tests__/session-doctor-device.test.ts b/src/daemon/handlers/__tests__/session-doctor-device.test.ts index 974da3a80..6d904ecc4 100644 --- a/src/daemon/handlers/__tests__/session-doctor-device.test.ts +++ b/src/daemon/handlers/__tests__/session-doctor-device.test.ts @@ -1,8 +1,8 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import { withDeviceInventoryProvider } from '../../../core/dispatch-resolve.ts'; -import { AppError } from '../../../kernel/errors.ts'; -import type { DeviceInfo } from '../../../kernel/device.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { attachAdbFailureHint } from '../../../platforms/android/adb-executor.ts'; import type { DaemonRequest } from '../../types.ts'; import { appendDeviceInventoryCheck } from '../session-doctor-device.ts'; diff --git a/src/daemon/handlers/__tests__/session-doctor-warmup.test.ts b/src/daemon/handlers/__tests__/session-doctor-warmup.test.ts index 165348d1d..195e95855 100644 --- a/src/daemon/handlers/__tests__/session-doctor-warmup.test.ts +++ b/src/daemon/handlers/__tests__/session-doctor-warmup.test.ts @@ -1,5 +1,5 @@ import { beforeEach, expect, test, vi } from 'vitest'; -import type { DeviceInfo } from '../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { hasCachedAppleRunnerArtifact, prewarmAppleRunnerCache, diff --git a/src/daemon/handlers/__tests__/session-inventory-appleos.test.ts b/src/daemon/handlers/__tests__/session-inventory-appleos.test.ts index b21458478..ab01a1c13 100644 --- a/src/daemon/handlers/__tests__/session-inventory-appleos.test.ts +++ b/src/daemon/handlers/__tests__/session-inventory-appleos.test.ts @@ -12,7 +12,7 @@ import { handleSessionInventoryCommands } from '../session-inventory.ts'; import { listDeviceInventory } from '../../../core/dispatch-resolve.ts'; import { makeSessionStore } from '../../../__tests__/test-utils/store-factory.ts'; import type { DaemonRequest, DaemonResponse } from '../../types.ts'; -import type { AppleOS, DeviceInfo } from '../../../kernel/device.ts'; +import type { AppleOS, DeviceInfo } from '@agent-device/kernel/device'; import { ANDROID_EMULATOR, IOS_SIMULATOR, diff --git a/src/daemon/handlers/__tests__/session-logs.test.ts b/src/daemon/handlers/__tests__/session-logs.test.ts index 37b79e279..e267f7135 100644 --- a/src/daemon/handlers/__tests__/session-logs.test.ts +++ b/src/daemon/handlers/__tests__/session-logs.test.ts @@ -1,7 +1,7 @@ import { test, expect } from 'vitest'; import * as os from 'node:os'; import * as path from 'node:path'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { IOS_DEVICE_CONSOLE_CAPTURE_UNSUPPORTED, IOS_DEVICE_CONSOLE_CAPTURE_UNSUPPORTED_NOTE, diff --git a/src/daemon/handlers/__tests__/session-observability.test.ts b/src/daemon/handlers/__tests__/session-observability.test.ts index b1b1c9220..34958406d 100644 --- a/src/daemon/handlers/__tests__/session-observability.test.ts +++ b/src/daemon/handlers/__tests__/session-observability.test.ts @@ -6,7 +6,7 @@ import { beforeEach, test, vi } from 'vitest'; import type { AndroidAdbExecutor } from '../../../platforms/android/adb-executor.ts'; import { makeSessionStore } from '../../../__tests__/test-utils/store-factory.ts'; import { makeAndroidSession, makeIosSession } from '../../../__tests__/test-utils/index.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { AppleXctracePerfCapture } from '../../../platforms/apple/core/perf-xctrace.ts'; import type { DaemonResponse } from '../../types.ts'; diff --git a/src/daemon/handlers/__tests__/session-open-existing.test.ts b/src/daemon/handlers/__tests__/session-open-existing.test.ts index fc0426a2d..098577123 100644 --- a/src/daemon/handlers/__tests__/session-open-existing.test.ts +++ b/src/daemon/handlers/__tests__/session-open-existing.test.ts @@ -2,7 +2,7 @@ import { test, expect } from 'vitest'; import * as os from 'node:os'; import * as path from 'node:path'; import { buildSnapshotSignatures } from '../../android-snapshot-freshness.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { mockDispatch, mockResolveTargetDevice, diff --git a/src/daemon/handlers/__tests__/session-open-runtime.test.ts b/src/daemon/handlers/__tests__/session-open-runtime.test.ts index 14b3ed902..bf0049754 100644 --- a/src/daemon/handlers/__tests__/session-open-runtime.test.ts +++ b/src/daemon/handlers/__tests__/session-open-runtime.test.ts @@ -4,7 +4,7 @@ import os from 'node:os'; import path from 'node:path'; import { SessionStore } from '../../session-store.ts'; import type { DaemonRequest, DaemonResponse, SessionState } from '../../types.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; vi.mock('../../../core/dispatch.ts', async (importOriginal) => { const actual = await importOriginal(); diff --git a/src/daemon/handlers/__tests__/session-open-surface.test.ts b/src/daemon/handlers/__tests__/session-open-surface.test.ts index ef9cd5555..6635b1bff 100644 --- a/src/daemon/handlers/__tests__/session-open-surface.test.ts +++ b/src/daemon/handlers/__tests__/session-open-surface.test.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { buildOpenResult, resolveRequestedOpenSurface } from '../session-open-surface.ts'; test('resolveRequestedOpenSurface rejects surface flag on iOS', () => { diff --git a/src/daemon/handlers/__tests__/session-open-target.test.ts b/src/daemon/handlers/__tests__/session-open-target.test.ts index 9b2137d8d..3ce83b30d 100644 --- a/src/daemon/handlers/__tests__/session-open-target.test.ts +++ b/src/daemon/handlers/__tests__/session-open-target.test.ts @@ -1,5 +1,5 @@ import { beforeEach, expect, test, vi } from 'vitest'; -import type { DeviceInfo } from '../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { isActiveProviderDevice } from '../../../provider-device-runtime.ts'; import { IOS_SIMULATOR } from '../../../__tests__/test-utils/device-fixtures.ts'; import { getAndroidAppState } from '../../../platforms/android/app-lifecycle.ts'; diff --git a/src/daemon/handlers/__tests__/session-open-url-prewarm.test.ts b/src/daemon/handlers/__tests__/session-open-url-prewarm.test.ts index 9cca63c2e..41a6fc483 100644 --- a/src/daemon/handlers/__tests__/session-open-url-prewarm.test.ts +++ b/src/daemon/handlers/__tests__/session-open-url-prewarm.test.ts @@ -1,7 +1,7 @@ import { test, expect, vi } from 'vitest'; import * as os from 'node:os'; import * as path from 'node:path'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { mockDispatch, mockResolveTargetDevice, diff --git a/src/daemon/handlers/__tests__/session-replay-dispatch-selector-miss.test.ts b/src/daemon/handlers/__tests__/session-replay-dispatch-selector-miss.test.ts index fc2cd36b3..6faa66b68 100644 --- a/src/daemon/handlers/__tests__/session-replay-dispatch-selector-miss.test.ts +++ b/src/daemon/handlers/__tests__/session-replay-dispatch-selector-miss.test.ts @@ -31,7 +31,7 @@ import os from 'node:os'; import path from 'node:path'; import { runReplayScriptFile } from '../session-replay-runtime.ts'; import { SessionStore } from '../../session-store.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { dispatchCommand } from '../../../core/dispatch.ts'; import { makeIosSession } from '../../../__tests__/test-utils/session-factories.ts'; import { diff --git a/src/daemon/handlers/__tests__/session-replay-divergence-publication.test.ts b/src/daemon/handlers/__tests__/session-replay-divergence-publication.test.ts index 39401a3de..8edef1d92 100644 --- a/src/daemon/handlers/__tests__/session-replay-divergence-publication.test.ts +++ b/src/daemon/handlers/__tests__/session-replay-divergence-publication.test.ts @@ -10,7 +10,7 @@ vi.mock('../../../core/dispatch.ts', async (importOriginal) => { import { dispatchCommand } from '../../../core/dispatch.ts'; import { makeIosSession } from '../../../__tests__/test-utils/session-factories.ts'; -import type { SnapshotState } from '../../../kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; import type { ReplayDivergence } from '../../../replay/divergence.ts'; import { bindInternalObservationAuthority } from '../../internal-observation.ts'; import { expireRefFrame } from '../../ref-frame.ts'; diff --git a/src/daemon/handlers/__tests__/session-replay-divergence.test.ts b/src/daemon/handlers/__tests__/session-replay-divergence.test.ts index 33dff3b8b..5c0330058 100644 --- a/src/daemon/handlers/__tests__/session-replay-divergence.test.ts +++ b/src/daemon/handlers/__tests__/session-replay-divergence.test.ts @@ -22,8 +22,8 @@ vi.mock('../../../utils/timeouts.ts', async (importOriginal) => { }); import { dispatchCommand } from '../../../core/dispatch.ts'; -import type { RawSnapshotNode } from '../../../kernel/snapshot.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; +import { AppError } from '@agent-device/kernel/errors'; import { makeAndroidSession, makeIosSession, diff --git a/src/daemon/handlers/__tests__/session-replay-maestro-failure.test.ts b/src/daemon/handlers/__tests__/session-replay-maestro-failure.test.ts index 912b447bd..fcd6274a3 100644 --- a/src/daemon/handlers/__tests__/session-replay-maestro-failure.test.ts +++ b/src/daemon/handlers/__tests__/session-replay-maestro-failure.test.ts @@ -18,7 +18,7 @@ import { makeIosSession } from '../../../__tests__/test-utils/session-factories. import { baseReplayRequest as baseReq } from './session-replay-runtime.fixtures.ts'; import type { MaestroCommand } from '../../../compat/maestro/program-ir.ts'; import type { MaestroReplayPlan } from '../../../compat/maestro/replay-plan-types.ts'; -import type { SnapshotNode } from '../../../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; const mockDispatchCommand = vi.mocked(dispatchCommand); diff --git a/src/daemon/handlers/__tests__/session-replay-repair-hint.test.ts b/src/daemon/handlers/__tests__/session-replay-repair-hint.test.ts index 43aa9d0d6..081771a8f 100644 --- a/src/daemon/handlers/__tests__/session-replay-repair-hint.test.ts +++ b/src/daemon/handlers/__tests__/session-replay-repair-hint.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import type { RawSnapshotNode, SnapshotNode } from '../../../kernel/snapshot.ts'; +import type { RawSnapshotNode, SnapshotNode } from '@agent-device/kernel/snapshot'; import type { TargetAnnotationV1 } from '../../../replay/target-identity.ts'; import { computeReplayRepairHint, diff --git a/src/daemon/handlers/__tests__/session-replay-repair-transaction.test.ts b/src/daemon/handlers/__tests__/session-replay-repair-transaction.test.ts index 25fa18f85..5f39f2318 100644 --- a/src/daemon/handlers/__tests__/session-replay-repair-transaction.test.ts +++ b/src/daemon/handlers/__tests__/session-replay-repair-transaction.test.ts @@ -61,7 +61,7 @@ import { handleCloseCommand } from '../session-close.ts'; import { SessionStore } from '../../session-store.ts'; import { LeaseRegistry } from '../../lease-registry.ts'; import { dispatchCommand } from '../../../core/dispatch.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { makeIosSession } from '../../../__tests__/test-utils/session-factories.ts'; import { HEAL_COMPLETE_SENTINEL } from '../../session-script-writer.ts'; import { parseReplayScriptDetailed } from '../../../replay/script.ts'; diff --git a/src/daemon/handlers/__tests__/session-replay-target-classification-fixtures.ts b/src/daemon/handlers/__tests__/session-replay-target-classification-fixtures.ts index f75f8378a..c1f2639a6 100644 --- a/src/daemon/handlers/__tests__/session-replay-target-classification-fixtures.ts +++ b/src/daemon/handlers/__tests__/session-replay-target-classification-fixtures.ts @@ -1,5 +1,5 @@ import assert from 'node:assert/strict'; -import type { RawSnapshotNode, SnapshotNode } from '../../../kernel/snapshot.ts'; +import type { RawSnapshotNode, SnapshotNode } from '@agent-device/kernel/snapshot'; import { computeTargetEvidence } from '../../session-target-evidence.ts'; import type { TargetAnnotationV1 } from '../../../replay/target-identity.ts'; diff --git a/src/daemon/handlers/__tests__/session-replay-target-classification.test.ts b/src/daemon/handlers/__tests__/session-replay-target-classification.test.ts index a3f43fa05..7ad0a6625 100644 --- a/src/daemon/handlers/__tests__/session-replay-target-classification.test.ts +++ b/src/daemon/handlers/__tests__/session-replay-target-classification.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import type { RawSnapshotNode, SnapshotNode } from '../../../kernel/snapshot.ts'; +import type { RawSnapshotNode, SnapshotNode } from '@agent-device/kernel/snapshot'; import type { TargetAnnotationV1 } from '../../../replay/target-identity.ts'; import { computeTargetEvidence } from '../../session-target-evidence.ts'; import { buildSelectorChainForNode } from '../../../selectors/build.ts'; diff --git a/src/daemon/handlers/__tests__/session-replay-target-guard.test.ts b/src/daemon/handlers/__tests__/session-replay-target-guard.test.ts index fba087f50..065e766aa 100644 --- a/src/daemon/handlers/__tests__/session-replay-target-guard.test.ts +++ b/src/daemon/handlers/__tests__/session-replay-target-guard.test.ts @@ -5,7 +5,7 @@ // PRE-ACTION in that case instead of tapping a different element. import { test } from 'vitest'; import assert from 'node:assert/strict'; -import type { SnapshotNode, SnapshotState } from '../../../kernel/snapshot.ts'; +import type { SnapshotNode, SnapshotState } from '@agent-device/kernel/snapshot'; import type { TargetAnnotationV1 } from '../../../replay/target-identity.ts'; import { readNodeLocalIdentity, diff --git a/src/daemon/handlers/__tests__/session-replay-target-verification-runtime.test.ts b/src/daemon/handlers/__tests__/session-replay-target-verification-runtime.test.ts index efd781140..f35b25b7a 100644 --- a/src/daemon/handlers/__tests__/session-replay-target-verification-runtime.test.ts +++ b/src/daemon/handlers/__tests__/session-replay-target-verification-runtime.test.ts @@ -30,7 +30,7 @@ import { runReplayScriptFile } from '../session-replay-runtime.ts'; import { SessionStore } from '../../session-store.ts'; import type { DaemonRequest } from '../../types.ts'; import { dispatchCommand } from '../../../core/dispatch.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { makeIosSession } from '../../../__tests__/test-utils/session-factories.ts'; const mockDispatchCommand = vi.mocked(dispatchCommand); diff --git a/src/daemon/handlers/__tests__/session-state-boot-warmup.test.ts b/src/daemon/handlers/__tests__/session-state-boot-warmup.test.ts index b232d6529..70d6d1813 100644 --- a/src/daemon/handlers/__tests__/session-state-boot-warmup.test.ts +++ b/src/daemon/handlers/__tests__/session-state-boot-warmup.test.ts @@ -1,5 +1,5 @@ import { beforeEach, expect, test, vi } from 'vitest'; -import type { DeviceInfo } from '../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { prewarmAppleRunnerCache } from '../../../platforms/apple/core/runner/runner-client.ts'; import { resolveCommandDevice } from '../session-device-utils.ts'; import { ensureDeviceReady } from '../../device-ready.ts'; diff --git a/src/daemon/handlers/__tests__/session-test-discovery.test.ts b/src/daemon/handlers/__tests__/session-test-discovery.test.ts index c70a4ef32..d58dc889c 100644 --- a/src/daemon/handlers/__tests__/session-test-discovery.test.ts +++ b/src/daemon/handlers/__tests__/session-test-discovery.test.ts @@ -3,7 +3,7 @@ import assert from 'node:assert/strict'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { discoverReplayTestEntries } from '../session-test-discovery.ts'; test('discoverReplayTestEntries expands directories in deterministic path order', () => { diff --git a/src/daemon/handlers/__tests__/session-test-harness.ts b/src/daemon/handlers/__tests__/session-test-harness.ts index 2dabac8fb..a5f747201 100644 --- a/src/daemon/handlers/__tests__/session-test-harness.ts +++ b/src/daemon/handlers/__tests__/session-test-harness.ts @@ -1,4 +1,4 @@ -import { isMacOs } from '../../../kernel/device.ts'; +import { isMacOs } from '@agent-device/kernel/device'; import { expect, vi, beforeEach } from 'vitest'; vi.mock('../../../core/dispatch.ts', async (importOriginal) => { diff --git a/src/daemon/handlers/__tests__/session-test-suite.test.ts b/src/daemon/handlers/__tests__/session-test-suite.test.ts index 001d0cff8..7816798b0 100644 --- a/src/daemon/handlers/__tests__/session-test-suite.test.ts +++ b/src/daemon/handlers/__tests__/session-test-suite.test.ts @@ -30,7 +30,7 @@ import { registerRequestAbort, } from '../../../request/cancel.ts'; import { withDeviceInventoryProvider } from '../../../core/dispatch-resolve.ts'; -import type { DeviceInfo } from '../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { makeAndroidSession } from '../../../__tests__/test-utils/index.ts'; function makeSessionStore(): SessionStore { diff --git a/src/daemon/handlers/__tests__/snapshot-handler.test.ts b/src/daemon/handlers/__tests__/snapshot-handler.test.ts index 0688307c9..09429198b 100644 --- a/src/daemon/handlers/__tests__/snapshot-handler.test.ts +++ b/src/daemon/handlers/__tests__/snapshot-handler.test.ts @@ -8,10 +8,10 @@ import { withSessionlessRunnerCleanup } from '../snapshot-session.ts'; import { captureSnapshot } from '../snapshot-capture.ts'; import { SessionStore } from '../../session-store.ts'; import type { DaemonResponse, SessionState } from '../../types.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { buildSnapshotSignatures } from '../../android-snapshot-freshness.ts'; import { buildInteractionSurfaceSignature } from '../../interaction-outcome-policy.ts'; -import { buildSnapshotPresentationKey } from '../../../kernel/snapshot.ts'; +import { buildSnapshotPresentationKey } from '@agent-device/kernel/snapshot'; import { snapshotCliOutput } from '../../../commands/capture/output.ts'; import type { CaptureSnapshotResult } from '../../../contracts/client-capture.ts'; diff --git a/src/daemon/handlers/__tests__/snapshot-scoped-refs.test.ts b/src/daemon/handlers/__tests__/snapshot-scoped-refs.test.ts index cf773bcc3..874fac523 100644 --- a/src/daemon/handlers/__tests__/snapshot-scoped-refs.test.ts +++ b/src/daemon/handlers/__tests__/snapshot-scoped-refs.test.ts @@ -1,6 +1,6 @@ import { beforeEach, expect, test, vi } from 'vitest'; import { handleSnapshotCommands } from '../snapshot.ts'; -import type { RawSnapshotNode, SnapshotState } from '../../../kernel/snapshot.ts'; +import type { RawSnapshotNode, SnapshotState } from '@agent-device/kernel/snapshot'; import { dispatchCommand } from '../../../core/dispatch.ts'; import { makeAndroidSession } from '../../../__tests__/test-utils/index.ts'; import { makeSessionStore } from '../../../__tests__/test-utils/store-factory.ts'; diff --git a/src/daemon/handlers/find.ts b/src/daemon/handlers/find.ts index 485f9b109..39c6a5a7f 100644 --- a/src/daemon/handlers/find.ts +++ b/src/daemon/handlers/find.ts @@ -6,7 +6,7 @@ import { parseFindSelectorExpression, type FindLocator, } from '../../selectors/find.ts'; -import { centerOfRect, type SnapshotState } from '../../kernel/snapshot.ts'; +import { centerOfRect, type SnapshotState } from '@agent-device/kernel/snapshot'; import { expireRefFrame } from '../ref-frame.ts'; import type { DaemonInvokeFn, DaemonRequest, DaemonResponse, SessionState } from '../types.ts'; import { SessionStore } from '../session-store.ts'; diff --git a/src/daemon/handlers/install-source.ts b/src/daemon/handlers/install-source.ts index 1a672aae3..fdf478a94 100644 --- a/src/daemon/handlers/install-source.ts +++ b/src/daemon/handlers/install-source.ts @@ -1,4 +1,4 @@ -import { isIosFamily } from '../../kernel/device.ts'; +import { isIosFamily } from '@agent-device/kernel/device'; import { installProviderDeviceInstallablePath, type ProviderDeviceInstallResult, @@ -16,7 +16,7 @@ import { SessionStore } from '../session-store.ts'; import type { DaemonRequest, DaemonResponse, SessionState } from '../types.ts'; import { resolveInstallFromSourceResultTarget } from '../../contracts/result-serialization.ts'; -import { AppError, normalizeError } from '../../kernel/errors.ts'; +import { AppError, normalizeError } from '@agent-device/kernel/errors'; import { withSuccessText } from '../../utils/success-text.ts'; import { requireCommandSupported } from './response.ts'; import { recordSessionAction } from './handler-utils.ts'; diff --git a/src/daemon/handlers/interaction-android-escape.ts b/src/daemon/handlers/interaction-android-escape.ts index 9519f84f0..1fbfd50e1 100644 --- a/src/daemon/handlers/interaction-android-escape.ts +++ b/src/daemon/handlers/interaction-android-escape.ts @@ -1,5 +1,5 @@ import { getAndroidAppState } from '../../platforms/android/app-lifecycle.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { SessionState } from '../types.ts'; export type AndroidEscapeSurface = { diff --git a/src/daemon/handlers/interaction-common.ts b/src/daemon/handlers/interaction-common.ts index a90bf823d..74f6b0ab8 100644 --- a/src/daemon/handlers/interaction-common.ts +++ b/src/daemon/handlers/interaction-common.ts @@ -1,5 +1,5 @@ import type { CommandFlags } from '../../core/dispatch.ts'; -import type { SnapshotState } from '../../kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; import type { DaemonCommandContext } from '../context.ts'; import { recordTouchVisualizationEvent } from '../recording-gestures.ts'; import type { DaemonRequest, DaemonResponse, SessionState } from '../types.ts'; diff --git a/src/daemon/handlers/interaction-gesture.ts b/src/daemon/handlers/interaction-gesture.ts index cb163161a..5555ddb2d 100644 --- a/src/daemon/handlers/interaction-gesture.ts +++ b/src/daemon/handlers/interaction-gesture.ts @@ -13,9 +13,9 @@ import { SWIPE_REPETITION_MAX, SWIPE_SERIES_MAX_SCHEDULED_DURATION_MS, } from '../../contracts/scroll-gesture.ts'; -import { AppError, normalizeError } from '../../kernel/errors.ts'; +import { AppError, normalizeError } from '@agent-device/kernel/errors'; import { readOptionalInteger } from '../../contracts/input-validation.ts'; -import type { Point } from '../../kernel/snapshot.ts'; +import type { Point } from '@agent-device/kernel/snapshot'; import type { GestureSemanticInput } from '../../contracts/gesture-plan-types.ts'; import { isActiveProviderDevice } from '../../provider-device-runtime.ts'; import { sleep } from '../../utils/timeouts.ts'; diff --git a/src/daemon/handlers/interaction-read.ts b/src/daemon/handlers/interaction-read.ts index 3ef09a851..b1b30300f 100644 --- a/src/daemon/handlers/interaction-read.ts +++ b/src/daemon/handlers/interaction-read.ts @@ -1,9 +1,9 @@ -import { isIosFamily } from '../../kernel/device.ts'; +import { isIosFamily } from '@agent-device/kernel/device'; import { dispatchCommand, type CommandFlags } from '../../core/dispatch.ts'; import { emitDiagnostic } from '../../utils/diagnostics.ts'; import { extractNodeReadText } from '../../snapshot/snapshot-processing.ts'; import type { SessionState } from '../types.ts'; -import type { SnapshotNode } from '../../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { prefersValueForReadableText } from '../../utils/text-surface.ts'; import type { ContextFromFlags } from './interaction-common.ts'; import { resolveRectCenter } from './interaction-targeting.ts'; diff --git a/src/daemon/handlers/interaction-recorded-input.ts b/src/daemon/handlers/interaction-recorded-input.ts index b7e0c76e8..79b7269e3 100644 --- a/src/daemon/handlers/interaction-recorded-input.ts +++ b/src/daemon/handlers/interaction-recorded-input.ts @@ -1,5 +1,5 @@ import type { CommandFlags } from '../../core/dispatch.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { validateRecordedInputVariableName } from '../../replay/recorded-input.ts'; import type { SessionState } from '../types.ts'; diff --git a/src/daemon/handlers/interaction-runtime.ts b/src/daemon/handlers/interaction-runtime.ts index ef88e26f9..d13f5ea3e 100644 --- a/src/daemon/handlers/interaction-runtime.ts +++ b/src/daemon/handlers/interaction-runtime.ts @@ -3,14 +3,14 @@ import { dispatchGesturePlan, dispatchGestureViewport, } from '../../core/dispatch.ts'; -import { publicPlatformString } from '../../kernel/device.ts'; +import { publicPlatformString } from '@agent-device/kernel/device'; import type { AgentDeviceBackend, BackendActionResult, BackendSnapshotResult, } from '../../backend.ts'; import { createAgentDevice } from '../../runtime.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { SessionState } from '../types.ts'; import { setSessionSnapshot } from '../session-snapshot.ts'; import { expireRefFrame } from '../ref-frame.ts'; @@ -21,7 +21,7 @@ import { createDaemonRuntimeSessionStore } from '../runtime-session.ts'; import { resolveWebProvider, type WebProvider } from '../../platforms/web/provider.ts'; import { stripAtPrefix } from './interaction-touch-targets.ts'; import { NO_ACTIVE_SESSION_MESSAGE } from './response.ts'; -import type { Rect } from '../../kernel/snapshot.ts'; +import type { Rect } from '@agent-device/kernel/snapshot'; type InteractionRuntimeParams = InteractionHandlerParams & { captureSnapshotForSession: CaptureSnapshotForSession; diff --git a/src/daemon/handlers/interaction-snapshot.ts b/src/daemon/handlers/interaction-snapshot.ts index bd4dae569..8c248b0a7 100644 --- a/src/daemon/handlers/interaction-snapshot.ts +++ b/src/daemon/handlers/interaction-snapshot.ts @@ -1,7 +1,7 @@ import type { CommandFlags } from '../../core/dispatch.ts'; import type { SessionStore } from '../session-store.ts'; import type { SessionState } from '../types.ts'; -import type { SnapshotState } from '../../kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; import type { ContextFromFlags } from './interaction-common.ts'; import { captureSnapshot } from './snapshot-capture.ts'; import { setSessionSnapshot } from '../session-snapshot.ts'; diff --git a/src/daemon/handlers/interaction-touch-policy.ts b/src/daemon/handlers/interaction-touch-policy.ts index 95ae31279..ba73ee4ff 100644 --- a/src/daemon/handlers/interaction-touch-policy.ts +++ b/src/daemon/handlers/interaction-touch-policy.ts @@ -1,4 +1,4 @@ -import { isMacOs } from '../../kernel/device.ts'; +import { isMacOs } from '@agent-device/kernel/device'; import type { DaemonResponse, SessionState } from '../types.ts'; import { errorResponse } from './response.ts'; diff --git a/src/daemon/handlers/interaction-touch-reference-frame.ts b/src/daemon/handlers/interaction-touch-reference-frame.ts index 7518a38de..731cf23ea 100644 --- a/src/daemon/handlers/interaction-touch-reference-frame.ts +++ b/src/daemon/handlers/interaction-touch-reference-frame.ts @@ -1,6 +1,6 @@ import type { CommandFlags } from '../../core/dispatch.ts'; import type { GestureReferenceFrame } from '../../contracts/scroll-gesture.ts'; -import type { SnapshotNode } from '../../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { getAndroidScreenSize } from '../../platforms/android/input-actions.ts'; import { emitDiagnostic } from '../../utils/diagnostics.ts'; import type { SessionStore } from '../session-store.ts'; diff --git a/src/daemon/handlers/interaction-touch-targets.ts b/src/daemon/handlers/interaction-touch-targets.ts index 2e2e0c283..7dc12d44a 100644 --- a/src/daemon/handlers/interaction-touch-targets.ts +++ b/src/daemon/handlers/interaction-touch-targets.ts @@ -9,7 +9,7 @@ import { type DecodedFillTarget, } from '../../core/interaction-positionals.ts'; import type { DaemonResponse } from '../types.ts'; -import { REF_GRAMMAR_HINT, splitRefGenerationSuffix } from '../../kernel/snapshot.ts'; +import { REF_GRAMMAR_HINT, splitRefGenerationSuffix } from '@agent-device/kernel/snapshot'; import { parseCoordinateTarget } from './interaction-targeting.ts'; import { errorResponse } from './response.ts'; diff --git a/src/daemon/handlers/interaction-touch.ts b/src/daemon/handlers/interaction-touch.ts index a2fe17daf..c89e4ff2b 100644 --- a/src/daemon/handlers/interaction-touch.ts +++ b/src/daemon/handlers/interaction-touch.ts @@ -3,7 +3,7 @@ import { transformInteractionResponseData, type InteractionResponseDataTransformCommand, } from '../../core/interaction-response-data-transform.ts'; -import { isApplePlatform, publicPlatformString } from '../../kernel/device.ts'; +import { isApplePlatform, publicPlatformString } from '@agent-device/kernel/device'; import { normalizeAppleRunnerResultForResponse } from '../../platforms/apple/core/runner/runner-result-response-normalization.ts'; import { buttonTag, @@ -16,7 +16,7 @@ import type { LongPressCommandResult, PressCommandResult, } from '../../contracts/interaction.ts'; -import { asAppError, normalizeError } from '../../kernel/errors.ts'; +import { asAppError, normalizeError } from '@agent-device/kernel/errors'; import type { ReplayTargetGuardDenotation } from '../../replay/target-identity-node.ts'; import type { DaemonResponse, SessionState } from '../types.ts'; import { finalizeTouchInteraction, type InteractionHandlerParams } from './interaction-common.ts'; diff --git a/src/daemon/handlers/interaction.ts b/src/daemon/handlers/interaction.ts index b331fffdc..58050e21d 100644 --- a/src/daemon/handlers/interaction.ts +++ b/src/daemon/handlers/interaction.ts @@ -8,7 +8,7 @@ import { createInteractionRuntime } from './interaction-runtime.ts'; import { finalizeTouchInteraction } from './interaction-common.ts'; import { errorResponse, noActiveSessionError, requireCommandSupported } from './response.ts'; import { PUBLIC_COMMANDS } from '../../command-catalog.ts'; -import { normalizeError } from '../../kernel/errors.ts'; +import { normalizeError } from '@agent-device/kernel/errors'; import { successText } from '../../utils/success-text.ts'; import { ensureAndroidBlockingSystemDialogReady, diff --git a/src/daemon/handlers/lease.ts b/src/daemon/handlers/lease.ts index 4ad5dc3a1..3156bc2e7 100644 --- a/src/daemon/handlers/lease.ts +++ b/src/daemon/handlers/lease.ts @@ -17,7 +17,7 @@ import { leaseScopeToHeartbeatRequest, leaseScopeToReleaseRequest, } from '../../core/lease-scope.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { listDownloadableArtifacts } from '../artifact-tracking.ts'; type LeaseHandlerArgs = { diff --git a/src/daemon/handlers/react-native.ts b/src/daemon/handlers/react-native.ts index 773b377fb..c3a0f6c85 100644 --- a/src/daemon/handlers/react-native.ts +++ b/src/daemon/handlers/react-native.ts @@ -4,10 +4,10 @@ import { analyzeReactNativeOverlay, type ReactNativeOverlayDismissTarget, } from '../../core/react-native-overlay.ts'; -import { normalizeError } from '../../kernel/errors.ts'; +import { normalizeError } from '@agent-device/kernel/errors'; import { stripUndefined } from '../../utils/parsing.ts'; import { successText } from '../../utils/success-text.ts'; -import type { SnapshotState } from '../../kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; import { isSparseSnapshotQualityVerdict, type SnapshotQualityVerdict, diff --git a/src/daemon/handlers/record-trace-ios.ts b/src/daemon/handlers/record-trace-ios.ts index 1b0ee354b..86cff2fe3 100644 --- a/src/daemon/handlers/record-trace-ios.ts +++ b/src/daemon/handlers/record-trace-ios.ts @@ -1,4 +1,4 @@ -import { isIosFamily } from '../../kernel/device.ts'; +import { isIosFamily } from '@agent-device/kernel/device'; import { SessionStore } from '../session-store.ts'; import type { DaemonRequest, DaemonResponse, SessionState } from '../types.ts'; import { emitDiagnostic } from '../../utils/diagnostics.ts'; diff --git a/src/daemon/handlers/record-trace-recording.ts b/src/daemon/handlers/record-trace-recording.ts index 398a01dce..6f151c60e 100644 --- a/src/daemon/handlers/record-trace-recording.ts +++ b/src/daemon/handlers/record-trace-recording.ts @@ -1,6 +1,6 @@ import fs from 'node:fs'; import path from 'node:path'; -import { AppError, toAppErrorCode } from '../../kernel/errors.ts'; +import { AppError, toAppErrorCode } from '@agent-device/kernel/errors'; import { sleep } from '../../utils/timeouts.ts'; import { resolveTargetDevice } from '../../core/dispatch.ts'; import { ensureDeviceReady } from '../device-ready.ts'; diff --git a/src/daemon/handlers/response.ts b/src/daemon/handlers/response.ts index d2c18179b..94eb6508e 100644 --- a/src/daemon/handlers/response.ts +++ b/src/daemon/handlers/response.ts @@ -1,5 +1,5 @@ import { isCommandSupportedOnDevice, unsupportedHintForDevice } from '../../core/capabilities.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import type { DaemonResponse } from '../types.ts'; export type DaemonFailureResponse = Extract; diff --git a/src/daemon/handlers/session-audio.ts b/src/daemon/handlers/session-audio.ts index 3282a44ff..a3049d7fb 100644 --- a/src/daemon/handlers/session-audio.ts +++ b/src/daemon/handlers/session-audio.ts @@ -1,5 +1,5 @@ import { isCommandSupportedOnDevice } from '../../core/capabilities.ts'; -import { normalizeError } from '../../kernel/errors.ts'; +import { normalizeError } from '@agent-device/kernel/errors'; import { resolveHostAudioProbeBackend, type HostAudioProbeBackend, diff --git a/src/daemon/handlers/session-close-script.ts b/src/daemon/handlers/session-close-script.ts index 338ba4244..560fa2a16 100644 --- a/src/daemon/handlers/session-close-script.ts +++ b/src/daemon/handlers/session-close-script.ts @@ -1,4 +1,4 @@ -import { AppError, normalizeError } from '../../kernel/errors.ts'; +import { AppError, normalizeError } from '@agent-device/kernel/errors'; import { successText } from '../../utils/success-text.ts'; import type { SessionStore } from '../session-store.ts'; import type { DaemonRequest, DaemonResponse, SessionState } from '../types.ts'; diff --git a/src/daemon/handlers/session-close.ts b/src/daemon/handlers/session-close.ts index ee1c570c5..d45a2ac08 100644 --- a/src/daemon/handlers/session-close.ts +++ b/src/daemon/handlers/session-close.ts @@ -1,7 +1,7 @@ import { emitDiagnostic } from '../../utils/diagnostics.ts'; -import { AppError, normalizeError } from '../../kernel/errors.ts'; +import { AppError, normalizeError } from '@agent-device/kernel/errors'; import { scheduleIosRunnerIdleStop } from '../../platforms/apple/core/runner/runner-client.ts'; -import { isApplePlatform, type DeviceInfo } from '../../kernel/device.ts'; +import { isApplePlatform, type DeviceInfo } from '@agent-device/kernel/device'; import { isActiveProviderDevice } from '../../provider-device-runtime.ts'; import { dispatchCommand } from '../../core/dispatch.ts'; import { contextFromFlags } from '../context.ts'; diff --git a/src/daemon/handlers/session-deploy.ts b/src/daemon/handlers/session-deploy.ts index 031fc6d03..9ef9cfc2e 100644 --- a/src/daemon/handlers/session-deploy.ts +++ b/src/daemon/handlers/session-deploy.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import { installProviderDeviceApp } from '../../provider-device-runtime.ts'; import { cleanupUploadedArtifact, prepareUploadedArtifact } from '../artifact-tracking.ts'; -import { isIosFamily, type DeviceInfo } from '../../kernel/device.ts'; +import { isIosFamily, type DeviceInfo } from '@agent-device/kernel/device'; import type { DaemonRequest, DaemonResponse } from '../types.ts'; import { SessionStore } from '../session-store.ts'; import { recordSessionAction } from './handler-utils.ts'; diff --git a/src/daemon/handlers/session-device-utils.ts b/src/daemon/handlers/session-device-utils.ts index 60e061c3b..1296811ce 100644 --- a/src/daemon/handlers/session-device-utils.ts +++ b/src/daemon/handlers/session-device-utils.ts @@ -1,5 +1,5 @@ -import { isIosFamily, type DeviceInfo } from '../../kernel/device.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { isIosFamily, type DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { isActiveProviderDevice } from '../../provider-device-runtime.ts'; import { ensureDeviceReady } from '../device-ready.ts'; import { getRunnerSessionSnapshot } from '../../platforms/apple/core/runner/runner-client.ts'; diff --git a/src/daemon/handlers/session-doctor-android.ts b/src/daemon/handlers/session-doctor-android.ts index 6e9e16bdd..303710ed2 100644 --- a/src/daemon/handlers/session-doctor-android.ts +++ b/src/daemon/handlers/session-doctor-android.ts @@ -8,8 +8,8 @@ import { ANDROID_TEST_IME_SETTINGS_KEYS, } from '../../platforms/android/ime-lifecycle.ts'; import { resolveAndroidImeHelperArtifact } from '../../platforms/android/ime-helper.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; -import { normalizeError } from '../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { normalizeError } from '@agent-device/kernel/errors'; import { appendDoctorCheck } from './session-doctor-output.ts'; import type { DoctorCheck } from '../../contracts/doctor.ts'; diff --git a/src/daemon/handlers/session-doctor-app.ts b/src/daemon/handlers/session-doctor-app.ts index 3df740114..dc6d17042 100644 --- a/src/daemon/handlers/session-doctor-app.ts +++ b/src/daemon/handlers/session-doctor-app.ts @@ -3,8 +3,8 @@ import { isMacOs, publicPlatformString, type DeviceInfo, -} from '../../kernel/device.ts'; -import { AppError, normalizeError } from '../../kernel/errors.ts'; +} from '@agent-device/kernel/device'; +import { AppError, normalizeError } from '@agent-device/kernel/errors'; import type { SessionState } from '../types.ts'; import { appendDoctorCheck } from './session-doctor-output.ts'; import type { DoctorCheck } from '../../contracts/doctor.ts'; diff --git a/src/daemon/handlers/session-doctor-device.ts b/src/daemon/handlers/session-doctor-device.ts index 44002d6c7..0fe91f5ce 100644 --- a/src/daemon/handlers/session-doctor-device.ts +++ b/src/daemon/handlers/session-doctor-device.ts @@ -15,8 +15,8 @@ import { type DeviceTarget, type PlatformSelector, type PublicPlatform, -} from '../../kernel/device.ts'; -import { normalizeError } from '../../kernel/errors.ts'; +} from '@agent-device/kernel/device'; +import { normalizeError } from '@agent-device/kernel/errors'; import type { DaemonRequest, SessionState } from '../types.ts'; import type { DoctorCheck } from '../../contracts/doctor.ts'; import { appendDoctorCheck } from './session-doctor-output.ts'; diff --git a/src/daemon/handlers/session-doctor-options.ts b/src/daemon/handlers/session-doctor-options.ts index f4d711983..a2b148e1d 100644 --- a/src/daemon/handlers/session-doctor-options.ts +++ b/src/daemon/handlers/session-doctor-options.ts @@ -1,5 +1,5 @@ import { detectProjectRuntimeKind } from '../../utils/project-runtime.ts'; -import { publicPlatformString } from '../../kernel/device.ts'; +import { publicPlatformString } from '@agent-device/kernel/device'; import type { SessionStore } from '../session-store.ts'; import type { DaemonRequest, SessionState } from '../types.ts'; import type { DoctorOptions } from './session-doctor-types.ts'; diff --git a/src/daemon/handlers/session-doctor-toolchain.ts b/src/daemon/handlers/session-doctor-toolchain.ts index 443f2d9db..87313e237 100644 --- a/src/daemon/handlers/session-doctor-toolchain.ts +++ b/src/daemon/handlers/session-doctor-toolchain.ts @@ -1,6 +1,6 @@ import { access } from 'node:fs/promises'; import path from 'node:path'; -import type { PlatformSelector } from '../../kernel/device.ts'; +import type { PlatformSelector } from '@agent-device/kernel/device'; import { runCmd } from '../../utils/exec.ts'; import { appendDoctorCheck } from './session-doctor-output.ts'; import type { DoctorCheck } from '../../contracts/doctor.ts'; diff --git a/src/daemon/handlers/session-doctor.ts b/src/daemon/handlers/session-doctor.ts index 2814bf311..d16542407 100644 --- a/src/daemon/handlers/session-doctor.ts +++ b/src/daemon/handlers/session-doctor.ts @@ -1,7 +1,7 @@ import path from 'node:path'; import { PUBLIC_COMMANDS } from '../../command-catalog.ts'; import type { AndroidAdbExecutor } from '../../platforms/android/adb-executor.ts'; -import { isIosFamily, publicPlatformString, type DeviceInfo } from '../../kernel/device.ts'; +import { isIosFamily, publicPlatformString, type DeviceInfo } from '@agent-device/kernel/device'; import { emitRequestProgress } from '../../request/progress.ts'; import { isActiveProviderDevice } from '../../provider-device-runtime.ts'; import { readVersion } from '../../utils/version.ts'; diff --git a/src/daemon/handlers/session-inventory.ts b/src/daemon/handlers/session-inventory.ts index 755d5398b..9532f9ead 100644 --- a/src/daemon/handlers/session-inventory.ts +++ b/src/daemon/handlers/session-inventory.ts @@ -1,7 +1,7 @@ import { isCommandSupportedOnDevice, listCapabilityCommands } from '../../core/capabilities.ts'; import { listDeviceInventory } from '../../core/dispatch-resolve.ts'; import { assertResolvedAppsFilter } from '../../contracts/app-inventory.ts'; -import { asAppError } from '../../kernel/errors.ts'; +import { asAppError } from '@agent-device/kernel/errors'; import { isApplePlatform, isMacOs, @@ -10,7 +10,7 @@ import { resolveAppleSimulatorSetPathForSelector, type DeviceInfo, type PlatformSelector, -} from '../../kernel/device.ts'; +} from '@agent-device/kernel/device'; import { resolveAndroidSerialAllowlist, resolveIosSimulatorDeviceSetPath, diff --git a/src/daemon/handlers/session-native-perf.ts b/src/daemon/handlers/session-native-perf.ts index 32576539f..843ab82d6 100644 --- a/src/daemon/handlers/session-native-perf.ts +++ b/src/daemon/handlers/session-native-perf.ts @@ -15,7 +15,7 @@ import { type AndroidNativePerfKind, type AndroidNativePerfSession, } from '../../platforms/android/perf.ts'; -import { AppError, normalizeError } from '../../kernel/errors.ts'; +import { AppError, normalizeError } from '@agent-device/kernel/errors'; import { SessionStore } from '../session-store.ts'; import type { DaemonRequest, DaemonResponse, SessionState } from '../types.ts'; import { errorResponse, type DaemonFailureResponse } from './response.ts'; diff --git a/src/daemon/handlers/session-observability.ts b/src/daemon/handlers/session-observability.ts index aec49ca24..892fc7af0 100644 --- a/src/daemon/handlers/session-observability.ts +++ b/src/daemon/handlers/session-observability.ts @@ -11,7 +11,7 @@ import { type PerfArea, type PerfKind, } from '../../contracts/perf.ts'; -import { AppError, normalizeError } from '../../kernel/errors.ts'; +import { AppError, normalizeError } from '@agent-device/kernel/errors'; import { resolveWebProvider } from '../../platforms/web/provider.ts'; import type { AndroidAdbExecutor } from '../../platforms/android/adb-executor.ts'; import type { DaemonRequest, DaemonResponse, DaemonResponseData, SessionState } from '../types.ts'; @@ -38,8 +38,8 @@ import { handleNativePerfCommand as handleAndroidNativePerfCommand } from './ses import { errorResponse, requireCommandSupported, type DaemonFailureResponse } from './response.ts'; import { handleAudioCommand } from './session-audio.ts'; import { handleNativePerfCommand as handleAppleNativePerfCommand } from './session-perf-xctrace.ts'; -import { NETWORK_INCLUDE_MODES, type NetworkIncludeMode } from '../../kernel/contracts.ts'; -import { uniqueStrings } from '../../kernel/collections.ts'; +import { NETWORK_INCLUDE_MODES, type NetworkIncludeMode } from '@agent-device/kernel/contracts'; +import { uniqueStrings } from '@agent-device/kernel/collections'; import { LOG_ACTION_VALUES as LOG_ACTIONS, type LogAction as LogsAction, diff --git a/src/daemon/handlers/session-open-launch-url.ts b/src/daemon/handlers/session-open-launch-url.ts index 1c540a358..8bbee5c6b 100644 --- a/src/daemon/handlers/session-open-launch-url.ts +++ b/src/daemon/handlers/session-open-launch-url.ts @@ -1,6 +1,6 @@ import { isDeepLinkTarget } from '../../contracts/open-target.ts'; import { dispatchCommand } from '../../core/dispatch.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import type { DaemonRequest, SessionRuntimeHints } from '../types.ts'; import { contextFromFlags } from '../context.ts'; diff --git a/src/daemon/handlers/session-open-prepare.ts b/src/daemon/handlers/session-open-prepare.ts index 9ef03f8c1..42d8d6d87 100644 --- a/src/daemon/handlers/session-open-prepare.ts +++ b/src/daemon/handlers/session-open-prepare.ts @@ -1,6 +1,6 @@ import { isDeepLinkTarget } from '../../contracts/open-target.ts'; import { ensureDeviceReady } from '../device-ready.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import type { DaemonRequest, DaemonResponse, SessionRuntimeHints, SessionState } from '../types.ts'; import { SessionStore } from '../session-store.ts'; import { @@ -15,7 +15,7 @@ import { resolveAndroidPackageForOpen, resolveSessionAppBundleIdForTarget, } from './session-open-target.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { errorResponse } from './response.ts'; import { resolveMacOsSurfaceAppState, diff --git a/src/daemon/handlers/session-open-surface.ts b/src/daemon/handlers/session-open-surface.ts index a20f6055f..c98c9f074 100644 --- a/src/daemon/handlers/session-open-surface.ts +++ b/src/daemon/handlers/session-open-surface.ts @@ -6,9 +6,9 @@ import { isSerialAddressablePlatform, publicPlatformString, type DeviceInfo, -} from '../../kernel/device.ts'; +} from '@agent-device/kernel/device'; import type { SessionRuntimeHints, SessionState } from '../types.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { successText } from '../../utils/success-text.ts'; import type { StartupPerfSample } from './session-startup-metrics.ts'; diff --git a/src/daemon/handlers/session-open-target.ts b/src/daemon/handlers/session-open-target.ts index 59b19eae9..c36b8f89c 100644 --- a/src/daemon/handlers/session-open-target.ts +++ b/src/daemon/handlers/session-open-target.ts @@ -3,7 +3,12 @@ import { isWebUrl, resolveIosDeviceDeepLinkBundleId, } from '../../contracts/open-target.ts'; -import { isIosFamily, isMacOs, isApplePlatform, type DeviceInfo } from '../../kernel/device.ts'; +import { + isIosFamily, + isMacOs, + isApplePlatform, + type DeviceInfo, +} from '@agent-device/kernel/device'; import { isActiveProviderDevice } from '../../provider-device-runtime.ts'; async function resolveIosBundleIdForOpen( diff --git a/src/daemon/handlers/session-open.ts b/src/daemon/handlers/session-open.ts index 572f91645..9999fe422 100644 --- a/src/daemon/handlers/session-open.ts +++ b/src/daemon/handlers/session-open.ts @@ -13,7 +13,7 @@ import { createAppleRunnerCacheColdBootPrewarmForOpen, } from '../apple-runner-options.ts'; import { applyRuntimeHintsToApp } from '../runtime-hints.ts'; -import { isApplePlatform, isIosFamily, type DeviceInfo } from '../../kernel/device.ts'; +import { isApplePlatform, isIosFamily, type DeviceInfo } from '@agent-device/kernel/device'; import type { DaemonRequest, DaemonResponse, SessionRuntimeHints, SessionState } from '../types.ts'; import { resolveSessionRequestLogPath, diff --git a/src/daemon/handlers/session-perf-xctrace.ts b/src/daemon/handlers/session-perf-xctrace.ts index 36fce743a..5de86078f 100644 --- a/src/daemon/handlers/session-perf-xctrace.ts +++ b/src/daemon/handlers/session-perf-xctrace.ts @@ -1,5 +1,5 @@ -import { asAppError, normalizeError } from '../../kernel/errors.ts'; -import { isApplePlatform } from '../../kernel/device.ts'; +import { asAppError, normalizeError } from '@agent-device/kernel/errors'; +import { isApplePlatform } from '@agent-device/kernel/device'; import type { DaemonRequest, DaemonResponse, SessionState } from '../types.ts'; import { SessionStore } from '../session-store.ts'; import { diff --git a/src/daemon/handlers/session-perf.ts b/src/daemon/handlers/session-perf.ts index 28008c42b..56a3d792f 100644 --- a/src/daemon/handlers/session-perf.ts +++ b/src/daemon/handlers/session-perf.ts @@ -1,7 +1,7 @@ import path from 'node:path'; import type { SessionAction, SessionState } from '../types.ts'; -import { AppError, normalizeError } from '../../kernel/errors.ts'; -import { isApplePlatform, publicPlatformString } from '../../kernel/device.ts'; +import { AppError, normalizeError } from '@agent-device/kernel/errors'; +import { isApplePlatform, publicPlatformString } from '@agent-device/kernel/device'; import { tryGetPlugin } from '../../contracts/platform-plugin.ts'; import { registerBuiltinPlatformPlugins } from '../../core/interactors/register-builtins.ts'; import type { AndroidAdbExecutor } from '../../platforms/android/adb-executor.ts'; diff --git a/src/daemon/handlers/session-replay-action-runtime.ts b/src/daemon/handlers/session-replay-action-runtime.ts index 4689e2502..581916d11 100644 --- a/src/daemon/handlers/session-replay-action-runtime.ts +++ b/src/daemon/handlers/session-replay-action-runtime.ts @@ -2,7 +2,7 @@ import type { CommandFlags } from '../../core/dispatch.ts'; import { resolveReplayAction, type ReplayVarScope } from '../../replay/vars.ts'; import type { DaemonInvokeFn, DaemonRequest, DaemonResponse, SessionAction } from '../types.ts'; import { mergeParentFlags } from '../../core/batch.ts'; -import { AppError, normalizeError } from '../../kernel/errors.ts'; +import { AppError, normalizeError } from '@agent-device/kernel/errors'; import { gesturePayloadFromPositionals, swipePayloadFromPositionals, diff --git a/src/daemon/handlers/session-replay-divergence-publication.ts b/src/daemon/handlers/session-replay-divergence-publication.ts index 3240df3a1..4862d6d09 100644 --- a/src/daemon/handlers/session-replay-divergence-publication.ts +++ b/src/daemon/handlers/session-replay-divergence-publication.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; -import type { ResponseLevel } from '../../kernel/contracts.ts'; -import { redactDiagnosticData } from '../../kernel/redaction.ts'; +import type { ResponseLevel } from '@agent-device/kernel/contracts'; +import { redactDiagnosticData } from '@agent-device/kernel/redaction'; import { boundReplayDivergence, type ReplayDivergence } from '../../replay/divergence.ts'; import { bindInternalObservationAuthority, diff --git a/src/daemon/handlers/session-replay-divergence.ts b/src/daemon/handlers/session-replay-divergence.ts index b7a3c22ca..75ed88425 100644 --- a/src/daemon/handlers/session-replay-divergence.ts +++ b/src/daemon/handlers/session-replay-divergence.ts @@ -5,8 +5,8 @@ import { } from '../../snapshot/snapshot-quality.ts'; import { displayLabel, formatRole } from '../../snapshot/snapshot-lines.ts'; import type { CommandFlags } from '../../core/dispatch.ts'; -import type { DaemonError, ResponseLevel } from '../../kernel/contracts.ts'; -import type { SnapshotNode } from '../../kernel/snapshot.ts'; +import type { DaemonError, ResponseLevel } from '@agent-device/kernel/contracts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { captureSnapshot } from './snapshot-capture.ts'; import { buildSelectorChainForNode, diff --git a/src/daemon/handlers/session-replay-heal.ts b/src/daemon/handlers/session-replay-heal.ts index 8fd6d054b..ed6a58d88 100644 --- a/src/daemon/handlers/session-replay-heal.ts +++ b/src/daemon/handlers/session-replay-heal.ts @@ -1,5 +1,5 @@ import { splitIsSelectorArgs, splitSelectorFromArgs } from '../../selectors/index.ts'; -import { uniqueStrings } from '../../kernel/collections.ts'; +import { uniqueStrings } from '@agent-device/kernel/collections'; import type { ReplayReportAction } from './session-replay-report-action.ts'; import { isTouchTargetCommand } from '../../replay/script-utils.ts'; diff --git a/src/daemon/handlers/session-replay-maestro-failure.ts b/src/daemon/handlers/session-replay-maestro-failure.ts index 0f29d2e47..557a35d45 100644 --- a/src/daemon/handlers/session-replay-maestro-failure.ts +++ b/src/daemon/handlers/session-replay-maestro-failure.ts @@ -8,8 +8,8 @@ import { evaluateMaestroReplayResume } from '../../compat/maestro/replay-plan.ts import type { MaestroReplayPlan } from '../../compat/maestro/replay-plan-types.ts'; import { matchesMaestroTypedSelector } from '../../compat/maestro/runtime-target-policy.ts'; import { rankMaestroCandidates } from '../../compat/maestro/runtime-target-ranking.ts'; -import type { DaemonError } from '../../kernel/contracts.ts'; -import type { SnapshotNode } from '../../kernel/snapshot.ts'; +import type { DaemonError } from '@agent-device/kernel/contracts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { REPLAY_DIVERGENCE_SUGGESTION_LIMIT, createReplayDivergenceSanitizer, diff --git a/src/daemon/handlers/session-replay-maestro-observer.ts b/src/daemon/handlers/session-replay-maestro-observer.ts index bd843b180..08074c6ab 100644 --- a/src/daemon/handlers/session-replay-maestro-observer.ts +++ b/src/daemon/handlers/session-replay-maestro-observer.ts @@ -4,7 +4,7 @@ import type { MaestroEngineObserver, MaestroRuntimeMetrics, } from '../../compat/maestro/engine-types.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { emitRequestProgress, readReplayTestActionProgress } from '../../request/progress.ts'; import { stripUndefined } from '../../utils/parsing.ts'; import type { MaestroFailedEngineEvent } from './session-replay-maestro-failure.ts'; diff --git a/src/daemon/handlers/session-replay-maestro-response.ts b/src/daemon/handlers/session-replay-maestro-response.ts index 30fda267c..cddc050b0 100644 --- a/src/daemon/handlers/session-replay-maestro-response.ts +++ b/src/daemon/handlers/session-replay-maestro-response.ts @@ -1,6 +1,6 @@ import type { ReplayCommandResult } from '../../contracts/replay.ts'; import type { MaestroReplayPlan } from '../../compat/maestro/replay-plan-types.ts'; -import { normalizeError } from '../../kernel/errors.ts'; +import { normalizeError } from '@agent-device/kernel/errors'; import { summarizeSnapshotTimingSamples } from '../../contracts/snapshot-diagnostics.ts'; import type { DaemonRequest, DaemonResponse } from '../types.ts'; import { SessionStore } from '../session-store.ts'; diff --git a/src/daemon/handlers/session-replay-maestro-runtime.ts b/src/daemon/handlers/session-replay-maestro-runtime.ts index 0fafe3a86..30360597c 100644 --- a/src/daemon/handlers/session-replay-maestro-runtime.ts +++ b/src/daemon/handlers/session-replay-maestro-runtime.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { setTimeout as sleep } from 'node:timers/promises'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { dispatchGestureViewport, resolveTargetDevice, @@ -25,7 +25,7 @@ import { } from '../../compat/maestro/replay-plan.ts'; import type { MaestroPlatform, MaestroProgram } from '../../compat/maestro/program-ir.ts'; import type { MaestroReplayPlan } from '../../compat/maestro/replay-plan-types.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../types.ts'; import { assertSessionSelectorMatches } from '../session-selector.ts'; import { SessionStore } from '../session-store.ts'; diff --git a/src/daemon/handlers/session-replay-repair-hint.ts b/src/daemon/handlers/session-replay-repair-hint.ts index c7876a53e..c31bf07f8 100644 --- a/src/daemon/handlers/session-replay-repair-hint.ts +++ b/src/daemon/handlers/session-replay-repair-hint.ts @@ -21,7 +21,7 @@ * — not a flat identity-string search. */ -import type { SnapshotNode } from '../../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import type { ReplayDivergenceKind, ReplayRepairHint } from '../../replay/divergence.ts'; import { matchesAncestryPrefix, diff --git a/src/daemon/handlers/session-replay-runtime.ts b/src/daemon/handlers/session-replay-runtime.ts index 0712379ee..0119d2d55 100644 --- a/src/daemon/handlers/session-replay-runtime.ts +++ b/src/daemon/handlers/session-replay-runtime.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { parseReplayInput } from '../../compat/replay-input.ts'; -import { asAppError } from '../../kernel/errors.ts'; +import { asAppError } from '@agent-device/kernel/errors'; import type { DaemonInvokeFn, DaemonRequest, @@ -24,7 +24,7 @@ import type { TargetAnnotationV1 } from '../../replay/target-identity.ts'; import { errorResponse, noActiveSessionError } from './response.ts'; import { invokeReplayAction } from './session-replay-action-runtime.ts'; import { tryParseSelectorChain } from '../../selectors/index.ts'; -import type { ResponseLevel } from '../../kernel/contracts.ts'; +import type { ResponseLevel } from '@agent-device/kernel/contracts'; import { buildReplayVarScope, collectReplayShellEnv, diff --git a/src/daemon/handlers/session-replay-target-classification.ts b/src/daemon/handlers/session-replay-target-classification.ts index 3e8404feb..710228227 100644 --- a/src/daemon/handlers/session-replay-target-classification.ts +++ b/src/daemon/handlers/session-replay-target-classification.ts @@ -31,8 +31,8 @@ * against constructed `SnapshotNode` trees. */ -import type { Platform, PublicPlatform } from '../../kernel/device.ts'; -import { findNodeByRef, normalizeRef, type SnapshotNode } from '../../kernel/snapshot.ts'; +import type { Platform, PublicPlatform } from '@agent-device/kernel/device'; +import { findNodeByRef, normalizeRef, type SnapshotNode } from '@agent-device/kernel/snapshot'; import { findNodeByLabel } from '../../snapshot/snapshot-processing.ts'; import { matchesSelector } from '../../selectors/match.ts'; import { diff --git a/src/daemon/handlers/session-replay-target-verification.ts b/src/daemon/handlers/session-replay-target-verification.ts index 388144203..119459882 100644 --- a/src/daemon/handlers/session-replay-target-verification.ts +++ b/src/daemon/handlers/session-replay-target-verification.ts @@ -1,5 +1,5 @@ -import type { ResponseLevel, DaemonError } from '../../kernel/contracts.ts'; -import type { SnapshotNode } from '../../kernel/snapshot.ts'; +import type { ResponseLevel, DaemonError } from '@agent-device/kernel/contracts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { displayLabel, formatRole } from '../../snapshot/snapshot-lines.ts'; import { formatDivergenceActionLabel } from '../../replay/script-utils.ts'; import { diff --git a/src/daemon/handlers/session-replay-trace.ts b/src/daemon/handlers/session-replay-trace.ts index 3e85a4e48..2feb38db9 100644 --- a/src/daemon/handlers/session-replay-trace.ts +++ b/src/daemon/handlers/session-replay-trace.ts @@ -1,5 +1,5 @@ import fs from 'node:fs'; -import { redactDiagnosticData } from '../../kernel/redaction.ts'; +import { redactDiagnosticData } from '@agent-device/kernel/redaction'; import { emitDiagnostic } from '../../utils/diagnostics.ts'; export function appendReplayTraceEvent( diff --git a/src/daemon/handlers/session-runtime-command.ts b/src/daemon/handlers/session-runtime-command.ts index c838aa034..121a8ca9c 100644 --- a/src/daemon/handlers/session-runtime-command.ts +++ b/src/daemon/handlers/session-runtime-command.ts @@ -1,5 +1,5 @@ import type { DaemonRequest, DaemonResponse } from '../types.ts'; -import { publicPlatformString } from '../../kernel/device.ts'; +import { publicPlatformString } from '@agent-device/kernel/device'; import { SessionStore } from '../session-store.ts'; import { clearRuntimeHintsFromApp, hasRuntimeTransportHints } from '../runtime-hints.ts'; import { errorResponse } from './response.ts'; diff --git a/src/daemon/handlers/session-runtime.ts b/src/daemon/handlers/session-runtime.ts index 881b10d48..90937d797 100644 --- a/src/daemon/handlers/session-runtime.ts +++ b/src/daemon/handlers/session-runtime.ts @@ -1,5 +1,5 @@ -import { AppError, asAppError } from '../../kernel/errors.ts'; -import { publicPlatformString, type DeviceInfo } from '../../kernel/device.ts'; +import { AppError, asAppError } from '@agent-device/kernel/errors'; +import { publicPlatformString, type DeviceInfo } from '@agent-device/kernel/device'; import type { CommandFlags } from '../../core/dispatch.ts'; import type { DaemonRequest, SessionRuntimeHints, SessionState } from '../types.ts'; import { SessionStore } from '../session-store.ts'; diff --git a/src/daemon/handlers/session-script-publication.ts b/src/daemon/handlers/session-script-publication.ts index ecf8687ab..8dd2daaa4 100644 --- a/src/daemon/handlers/session-script-publication.ts +++ b/src/daemon/handlers/session-script-publication.ts @@ -1,5 +1,5 @@ import { INTERNAL_COMMANDS } from '../../command-catalog.ts'; -import { AppError, normalizeError } from '../../kernel/errors.ts'; +import { AppError, normalizeError } from '@agent-device/kernel/errors'; import { successText } from '../../utils/success-text.ts'; import { applySaveScriptRetarget } from '../session-action-recorder.ts'; import { expandSessionPath } from '../session-paths.ts'; diff --git a/src/daemon/handlers/session-state.ts b/src/daemon/handlers/session-state.ts index 697074968..d1ec6c892 100644 --- a/src/daemon/handlers/session-state.ts +++ b/src/daemon/handlers/session-state.ts @@ -1,11 +1,11 @@ -import { asAppError } from '../../kernel/errors.ts'; +import { asAppError } from '@agent-device/kernel/errors'; import { isApplePlatform, isIosFamily, isMacOs, publicPlatformString, type DeviceInfo, -} from '../../kernel/device.ts'; +} from '@agent-device/kernel/device'; import type { DaemonRequest, DaemonResponse } from '../types.ts'; import { SessionStore } from '../session-store.ts'; import { ensureDeviceReady } from '../device-ready.ts'; diff --git a/src/daemon/handlers/session-test-discovery.ts b/src/daemon/handlers/session-test-discovery.ts index d6d63fcf8..110a63c1a 100644 --- a/src/daemon/handlers/session-test-discovery.ts +++ b/src/daemon/handlers/session-test-discovery.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; -import { AppError } from '../../kernel/errors.ts'; -import { isApplePlatform, type PlatformSelector } from '../../kernel/device.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import { isApplePlatform, type PlatformSelector } from '@agent-device/kernel/device'; import { resolveRequestTrackingId } from '../../request/cancel.ts'; import { SessionStore } from '../session-store.ts'; import { readReplayScriptMetadata, type ReplayScriptMetadata } from '../../replay/script.ts'; diff --git a/src/daemon/handlers/session-test-runtime.ts b/src/daemon/handlers/session-test-runtime.ts index 5b4a81d1c..cfd98103f 100644 --- a/src/daemon/handlers/session-test-runtime.ts +++ b/src/daemon/handlers/session-test-runtime.ts @@ -2,7 +2,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { setTimeout as sleep } from 'node:timers/promises'; import { emitDiagnostic } from '../../utils/diagnostics.ts'; -import { normalizeError } from '../../kernel/errors.ts'; +import { normalizeError } from '@agent-device/kernel/errors'; import { clearRequestCanceled, getRequestSignal, diff --git a/src/daemon/handlers/session-test-sharding.ts b/src/daemon/handlers/session-test-sharding.ts index 4920ed5e0..967802ad3 100644 --- a/src/daemon/handlers/session-test-sharding.ts +++ b/src/daemon/handlers/session-test-sharding.ts @@ -8,8 +8,8 @@ import { matchesPlatformSelector, resolveAppleSimulatorSetPathForSelector, type DeviceInfo, -} from '../../kernel/device.ts'; -import { AppError } from '../../kernel/errors.ts'; +} from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import type { CommandFlags } from '../../core/dispatch.ts'; export type ReplayTestShardMode = 'all' | 'split'; diff --git a/src/daemon/handlers/session-test.ts b/src/daemon/handlers/session-test.ts index 7590d5059..10db76ade 100644 --- a/src/daemon/handlers/session-test.ts +++ b/src/daemon/handlers/session-test.ts @@ -1,4 +1,4 @@ -import { asAppError, normalizeError } from '../../kernel/errors.ts'; +import { asAppError, normalizeError } from '@agent-device/kernel/errors'; import { errorResponse } from './response.ts'; import type { DaemonRequest, DaemonResponse } from '../types.ts'; import type { diff --git a/src/daemon/handlers/session.ts b/src/daemon/handlers/session.ts index 2d13563cb..c982da220 100644 --- a/src/daemon/handlers/session.ts +++ b/src/daemon/handlers/session.ts @@ -6,8 +6,8 @@ import { prepareIosRunner, type PrepareIosRunnerResult, } from '../../platforms/apple/core/runner/runner-client.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; -import { publicPlatformString } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { publicPlatformString } from '@agent-device/kernel/device'; import type { DaemonInvokeFn, DaemonRequest, DaemonResponse, SessionState } from '../types.ts'; import { SessionStore } from '../session-store.ts'; import { contextFromFlags } from '../context.ts'; diff --git a/src/daemon/handlers/snapshot-alert.ts b/src/daemon/handlers/snapshot-alert.ts index 1ae4a65cb..4336a6f75 100644 --- a/src/daemon/handlers/snapshot-alert.ts +++ b/src/daemon/handlers/snapshot-alert.ts @@ -1,4 +1,4 @@ -import { isIosFamily, isMacOs } from '../../kernel/device.ts'; +import { isIosFamily, isMacOs } from '@agent-device/kernel/device'; import { ALERT_ACTION_RETRY_MS, ALERT_POLL_INTERVAL_MS as POLL_INTERVAL_MS, @@ -9,7 +9,7 @@ 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'; import { handleAndroidAlert } from '../../platforms/android/alert.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { DaemonRequest, DaemonResponse, SessionState } from '../types.ts'; import { SessionStore } from '../session-store.ts'; import { buildAppleRunnerRequestOptions } from '../apple-runner-options.ts'; diff --git a/src/daemon/handlers/snapshot-capture.ts b/src/daemon/handlers/snapshot-capture.ts index d05f53ff8..61eeee3a5 100644 --- a/src/daemon/handlers/snapshot-capture.ts +++ b/src/daemon/handlers/snapshot-capture.ts @@ -1,5 +1,5 @@ import { dispatchCommand, type CommandFlags } from '../../core/dispatch.ts'; -import { isMacOs, isMobilePlatform, publicPlatformString } from '../../kernel/device.ts'; +import { isMacOs, isMobilePlatform, publicPlatformString } from '@agent-device/kernel/device'; import { sleep } from '../../utils/timeouts.ts'; import { runMacOsSnapshotAction } from '../../platforms/apple/os/macos/helper.ts'; import { snapshotLinux } from '../../platforms/linux/snapshot.ts'; @@ -12,7 +12,7 @@ import { type RawSnapshotNode, type SnapshotBackend, type SnapshotState, -} from '../../kernel/snapshot.ts'; +} from '@agent-device/kernel/snapshot'; import { annotateCoveredSnapshotNodes } from '../../snapshot/snapshot-occlusion.ts'; import { normalizeSnapshotTree } from '../../snapshot/snapshot-tree.ts'; import { isAndroidInputMethodSnapshotNode } from '../../snapshot/android-input-method-overlays.ts'; diff --git a/src/daemon/handlers/snapshot-session.ts b/src/daemon/handlers/snapshot-session.ts index a10c66f95..692412bd1 100644 --- a/src/daemon/handlers/snapshot-session.ts +++ b/src/daemon/handlers/snapshot-session.ts @@ -1,4 +1,4 @@ -import { isIosFamily } from '../../kernel/device.ts'; +import { isIosFamily } from '@agent-device/kernel/device'; import { resolveTargetDevice } from '../../core/dispatch.ts'; import { resolveRunnerAppBundleId, diff --git a/src/daemon/handlers/snapshot-settings.ts b/src/daemon/handlers/snapshot-settings.ts index 079f273b5..c5d80e342 100644 --- a/src/daemon/handlers/snapshot-settings.ts +++ b/src/daemon/handlers/snapshot-settings.ts @@ -1,4 +1,4 @@ -import { isMacOs } from '../../kernel/device.ts'; +import { isMacOs } from '@agent-device/kernel/device'; import { getUnsupportedMacOsSettingMessage, isMacOsSettingSupported, diff --git a/src/daemon/handlers/system-surface-disclosure.ts b/src/daemon/handlers/system-surface-disclosure.ts index 0a859f94b..5701fb7ea 100644 --- a/src/daemon/handlers/system-surface-disclosure.ts +++ b/src/daemon/handlers/system-surface-disclosure.ts @@ -1,4 +1,4 @@ -import type { SnapshotState } from '../../kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; import { systemSurfaceDisclosure } from '../../snapshot/system-surface-disclosure.ts'; import type { DaemonResponse } from '../types.ts'; diff --git a/src/daemon/http-errors.ts b/src/daemon/http-errors.ts index f119cacb0..eba4c469a 100644 --- a/src/daemon/http-errors.ts +++ b/src/daemon/http-errors.ts @@ -1,5 +1,5 @@ import type http from 'node:http'; -import { normalizeError } from '../kernel/errors.ts'; +import { normalizeError } from '@agent-device/kernel/errors'; export type NormalizedHttpError = ReturnType; diff --git a/src/daemon/install-source-resolution.ts b/src/daemon/install-source-resolution.ts index 5716678da..96c1bc88e 100644 --- a/src/daemon/install-source-resolution.ts +++ b/src/daemon/install-source-resolution.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { MaterializeInstallSource } from '../platforms/install-source.ts'; import { cleanupUploadedArtifact, prepareUploadedArtifact } from './artifact-tracking.ts'; import type { DaemonInstallSource, DaemonRequest } from './types.ts'; diff --git a/src/daemon/interaction-outcome-policy.ts b/src/daemon/interaction-outcome-policy.ts index 95b2ec81b..5ae02b3d8 100644 --- a/src/daemon/interaction-outcome-policy.ts +++ b/src/daemon/interaction-outcome-policy.ts @@ -1,6 +1,6 @@ import { dispatchCommand, type CommandFlags } from '../core/dispatch.ts'; -import { isMobilePlatform } from '../kernel/device.ts'; -import type { SnapshotNode, SnapshotState } from '../kernel/snapshot.ts'; +import { isMobilePlatform } from '@agent-device/kernel/device'; +import type { SnapshotNode, SnapshotState } from '@agent-device/kernel/snapshot'; import { emitDiagnostic } from '../utils/diagnostics.ts'; import { contextFromFlags } from './context.ts'; import type { SessionState } from './types.ts'; diff --git a/src/daemon/internal-observation.ts b/src/daemon/internal-observation.ts index c5bca9195..6480b2f40 100644 --- a/src/daemon/internal-observation.ts +++ b/src/daemon/internal-observation.ts @@ -1,4 +1,4 @@ -import type { SnapshotState } from '../kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; import { readSessionRuntimeRevision } from './ref-frame.ts'; import { markSessionPartialRefsIssued, setSessionSnapshot } from './session-snapshot.ts'; import { SessionStore } from './session-store.ts'; diff --git a/src/daemon/lease-context.ts b/src/daemon/lease-context.ts index 7356efaa7..fd1a0635b 100644 --- a/src/daemon/lease-context.ts +++ b/src/daemon/lease-context.ts @@ -1,5 +1,5 @@ import type { DaemonRequest } from './types.ts'; -import type { LeaseBackend } from '../kernel/contracts.ts'; +import type { LeaseBackend } from '@agent-device/kernel/contracts'; import type { DeviceLease } from '../contracts/device-provider.ts'; import type { RunnerLogicalLeaseContext } from '../contracts/runner-lease-context.ts'; import { stripUndefined } from '../utils/parsing.ts'; diff --git a/src/daemon/lease-registry.ts b/src/daemon/lease-registry.ts index d9cf14889..98d4f157b 100644 --- a/src/daemon/lease-registry.ts +++ b/src/daemon/lease-registry.ts @@ -1,7 +1,7 @@ import type { DeviceLease } from '../contracts/device-provider.ts'; import crypto from 'node:crypto'; -import type { LeaseBackend } from '../kernel/contracts.ts'; -import { AppError } from '../kernel/errors.ts'; +import type { LeaseBackend } from '@agent-device/kernel/contracts'; +import { AppError } from '@agent-device/kernel/errors'; import { normalizeTenantId } from './config.ts'; export type SimulatorLease = DeviceLease; diff --git a/src/daemon/network-log.ts b/src/daemon/network-log.ts index a8e9968a5..e1fd5ff3e 100644 --- a/src/daemon/network-log.ts +++ b/src/daemon/network-log.ts @@ -18,7 +18,7 @@ const ANDROID_NEARBY_LINE_RADIUS = 5; const ANDROID_PACKET_SCAN_RADIUS = 12; const NETWORK_LOG_MEMORY_PATH = ''; -import type { NetworkIncludeMode } from '../kernel/contracts.ts'; +import type { NetworkIncludeMode } from '@agent-device/kernel/contracts'; import type { LogBackend } from '../contracts/logs.ts'; import type { NetworkEntry } from '../contracts/network-log.ts'; export type { NetworkIncludeMode }; diff --git a/src/daemon/post-gesture-stabilization.ts b/src/daemon/post-gesture-stabilization.ts index ece306ba3..3c976183d 100644 --- a/src/daemon/post-gesture-stabilization.ts +++ b/src/daemon/post-gesture-stabilization.ts @@ -1,7 +1,7 @@ import { emitDiagnostic } from '../utils/diagnostics.ts'; -import { isMobilePlatform } from '../kernel/device.ts'; +import { isMobilePlatform } from '@agent-device/kernel/device'; import type { CommandFlags } from '../core/dispatch.ts'; -import type { SnapshotState } from '../kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; import { sleep } from '../utils/timeouts.ts'; import { areInteractionSurfaceSignaturesStable, diff --git a/src/daemon/recording-gestures.ts b/src/daemon/recording-gestures.ts index d010d46e1..e8bae604b 100644 --- a/src/daemon/recording-gestures.ts +++ b/src/daemon/recording-gestures.ts @@ -1,6 +1,6 @@ -import { isIosFamily } from '../kernel/device.ts'; +import { isIosFamily } from '@agent-device/kernel/device'; import type { RecordingGestureEvent, SessionState } from './types.ts'; -import type { SnapshotState } from '../kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; import { resolveGestureDurationMs, resolveGestureOffsetMs, diff --git a/src/daemon/recording-provider.ts b/src/daemon/recording-provider.ts index ec0fe2f62..f32418b40 100644 --- a/src/daemon/recording-provider.ts +++ b/src/daemon/recording-provider.ts @@ -1,5 +1,5 @@ import { buildSimctlArgsForDevice } from '../platforms/apple/core/simctl.ts'; -import type { DeviceInfo } from '../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { runCmdBackground, type ExecBackgroundResult, type ExecResult } from '../utils/exec.ts'; import { createScopedProvider } from '../utils/scoped-provider.ts'; diff --git a/src/daemon/request-admission.ts b/src/daemon/request-admission.ts index d1a1e6ac3..96341f459 100644 --- a/src/daemon/request-admission.ts +++ b/src/daemon/request-admission.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { normalizeTenantId, resolveSessionIsolationMode } from './config.ts'; import { isLeaseAdmissionExempt } from './daemon-command-registry.ts'; import { diff --git a/src/daemon/request-execution-scope.ts b/src/daemon/request-execution-scope.ts index 5b8296fb7..5455a0fc7 100644 --- a/src/daemon/request-execution-scope.ts +++ b/src/daemon/request-execution-scope.ts @@ -1,12 +1,12 @@ import type { CommandFlags } from '../core/dispatch.ts'; -import type { DaemonArtifactType } from '../kernel/contracts.ts'; +import type { DaemonArtifactType } from '@agent-device/kernel/contracts'; import { emitDiagnostic, getDiagnosticsMeta, updateDiagnosticsScope, } from '../utils/diagnostics.ts'; import { applyCommandDefaults } from '../cli-schema/command-schema.ts'; -import { normalizeError } from '../kernel/errors.ts'; +import { normalizeError } from '@agent-device/kernel/errors'; import type { DaemonCommandContext } from './context.ts'; import { contextFromFlags as contextFromFlagsWithLog } from './context.ts'; import { assertSessionSelectorMatches } from './session-selector.ts'; diff --git a/src/daemon/request-finalization.ts b/src/daemon/request-finalization.ts index db929303e..1fb761e9c 100644 --- a/src/daemon/request-finalization.ts +++ b/src/daemon/request-finalization.ts @@ -1,12 +1,12 @@ import path from 'node:path'; -import { AppError, normalizeError, toAppErrorCode } from '../kernel/errors.ts'; +import { AppError, normalizeError, toAppErrorCode } from '@agent-device/kernel/errors'; import { emitDiagnostic, flushDiagnosticsToSessionFile, getDiagnosticsMeta, } from '../utils/diagnostics.ts'; import type { DaemonRequest, DaemonResponse, DaemonResponseData } from './types.ts'; -import type { DaemonArtifact, DaemonArtifactType } from '../kernel/contracts.ts'; +import type { DaemonArtifact, DaemonArtifactType } from '@agent-device/kernel/contracts'; export function finalizeDaemonResponse( req: DaemonRequest, diff --git a/src/daemon/request-generic-dispatch.ts b/src/daemon/request-generic-dispatch.ts index 9e3a3ce7a..900a932ad 100644 --- a/src/daemon/request-generic-dispatch.ts +++ b/src/daemon/request-generic-dispatch.ts @@ -23,7 +23,7 @@ import { recordTouchVisualizationEvent, } from './recording-gestures.ts'; import { markPostGestureStabilization } from './post-gesture-stabilization.ts'; -import { normalizeError } from '../kernel/errors.ts'; +import { normalizeError } from '@agent-device/kernel/errors'; import { expireRefFrame } from './ref-frame.ts'; import { resolveRefFrameEffect, diff --git a/src/daemon/request-handler-chain.ts b/src/daemon/request-handler-chain.ts index d31d5dc8c..2c69bb629 100644 --- a/src/daemon/request-handler-chain.ts +++ b/src/daemon/request-handler-chain.ts @@ -1,7 +1,7 @@ import type { CommandFlags } from '../core/dispatch.ts'; import type { CloudArtifactProvider } from '../contracts/cloud-artifacts.ts'; import type { AndroidAdbExecutor } from '../platforms/android/adb-executor.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { getDaemonCommandRoute } from './daemon-command-registry.ts'; import * as genericRequestHandlerModule from './request-generic-dispatch.ts'; import type { DaemonCommandContext } from './context.ts'; diff --git a/src/daemon/request-lock-policy.ts b/src/daemon/request-lock-policy.ts index 7a9cf60c6..7513643c9 100644 --- a/src/daemon/request-lock-policy.ts +++ b/src/daemon/request-lock-policy.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { CommandFlags } from '../core/dispatch.ts'; import type { SessionState, DaemonRequest } from './types.ts'; import { @@ -7,7 +7,11 @@ import { type SessionSelectorConflict, type SessionSelectorConflictKey, } from './session-selector.ts'; -import { isApplePlatform, publicPlatformString, type PlatformSelector } from '../kernel/device.ts'; +import { + isApplePlatform, + publicPlatformString, + type PlatformSelector, +} from '@agent-device/kernel/device'; import { buildSessionRecoveryHint, describeSessionDevice } from './session-recovery-hints.ts'; import { shellQuoteIfNeeded } from '../utils/shell-quote.ts'; import { hasLockableDeviceSelector, hasSelectorValue } from './device-selector-intent.ts'; diff --git a/src/daemon/request-platform-providers.ts b/src/daemon/request-platform-providers.ts index 4c1d42b4e..b83f86cec 100644 --- a/src/daemon/request-platform-providers.ts +++ b/src/daemon/request-platform-providers.ts @@ -14,7 +14,7 @@ import type { import type { LinuxToolProvider } from '../platforms/linux/tool-provider.ts'; import type { VegaToolProvider } from '../platforms/vega/tool-provider.ts'; import type { WebProvider } from '../platforms/web/provider.ts'; -import type { DeviceInfo } from '../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import type { AppLogProvider } from './app-log.ts'; import { hasExplicitDeviceSelector } from './device-selector-intent.ts'; import type { RecordingProvider } from './recording-provider.ts'; diff --git a/src/daemon/request-recording-health.ts b/src/daemon/request-recording-health.ts index 612906b5c..37d4b7f3d 100644 --- a/src/daemon/request-recording-health.ts +++ b/src/daemon/request-recording-health.ts @@ -1,4 +1,4 @@ -import { isIosFamily } from '../kernel/device.ts'; +import { isIosFamily } from '@agent-device/kernel/device'; import { getRunnerSessionSnapshot } from '../platforms/apple/core/runner/runner-client.ts'; import type { SessionState } from './types.ts'; diff --git a/src/daemon/request-router.ts b/src/daemon/request-router.ts index 22568f1ea..7a8ae752f 100644 --- a/src/daemon/request-router.ts +++ b/src/daemon/request-router.ts @@ -3,10 +3,10 @@ import type { DeviceInventoryProvider, LeaseLifecycleProvider, } from '../contracts/device-provider.ts'; -import { AppError, normalizeError, retriableForErrorCode } from '../kernel/errors.ts'; +import { AppError, normalizeError, retriableForErrorCode } from '@agent-device/kernel/errors'; import { supportedPlatformsForCommand } from '../core/capabilities.ts'; import { timingSafeStringEqual } from '../utils/timing-safe-equal.ts'; -import type { DaemonArtifactType, DaemonError, ResponseCost } from '../kernel/contracts.ts'; +import type { DaemonArtifactType, DaemonError, ResponseCost } from '@agent-device/kernel/contracts'; import type { CloudArtifactProvider } from '../contracts/cloud-artifacts.ts'; import type { DaemonInvokeFn, DaemonRequest, DaemonResponse, DaemonResponseData } from './types.ts'; import { RESPONSE_VIEWS } from './response-views.ts'; diff --git a/src/daemon/response-views.ts b/src/daemon/response-views.ts index f7d31b641..7b1537b0a 100644 --- a/src/daemon/response-views.ts +++ b/src/daemon/response-views.ts @@ -1,5 +1,5 @@ -import type { ResponseLevel } from '../kernel/contracts.ts'; -import type { ScreenshotOverlayRef, SnapshotNode } from '../kernel/snapshot.ts'; +import type { ResponseLevel } from '@agent-device/kernel/contracts'; +import type { ScreenshotOverlayRef, SnapshotNode } from '@agent-device/kernel/snapshot'; import type { DaemonResponseData } from './types.ts'; /** diff --git a/src/daemon/resumable-upload.ts b/src/daemon/resumable-upload.ts index 97cf0c22b..e582383c3 100644 --- a/src/daemon/resumable-upload.ts +++ b/src/daemon/resumable-upload.ts @@ -3,7 +3,7 @@ import fs from 'node:fs'; import path from 'node:path'; import type { IncomingMessage } from 'node:http'; import { pipeline } from 'node:stream/promises'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { extractTarInstallableArtifact } from './artifact-archive.ts'; import { requireTenantOwnedEntry, type TenantOwnedResourceKind } from './tenant-owned-entry.ts'; import { diff --git a/src/daemon/runtime-artifacts.ts b/src/daemon/runtime-artifacts.ts index aacbd06e5..4ac008d2b 100644 --- a/src/daemon/runtime-artifacts.ts +++ b/src/daemon/runtime-artifacts.ts @@ -1,5 +1,5 @@ import type { ArtifactAdapter } from '../io.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export function createUnsupportedArtifactAdapter( label: string, diff --git a/src/daemon/runtime-hints.ts b/src/daemon/runtime-hints.ts index 5b51cba74..c4a74ad57 100644 --- a/src/daemon/runtime-hints.ts +++ b/src/daemon/runtime-hints.ts @@ -1,5 +1,5 @@ -import { isIosFamily, type DeviceInfo } from '../kernel/device.ts'; -import { AppError, asAppError } from '../kernel/errors.ts'; +import { isIosFamily, type DeviceInfo } from '@agent-device/kernel/device'; +import { AppError, asAppError } from '@agent-device/kernel/errors'; import { execFailureDetails, type ExecResult } from '../utils/exec.ts'; import type { SessionRuntimeHints } from './types.ts'; import { diff --git a/src/daemon/screenshot-overlay-android.ts b/src/daemon/screenshot-overlay-android.ts index 43efbab24..584235b1a 100644 --- a/src/daemon/screenshot-overlay-android.ts +++ b/src/daemon/screenshot-overlay-android.ts @@ -1,4 +1,4 @@ -import type { Rect, SnapshotNode } from '../kernel/snapshot.ts'; +import type { Rect, SnapshotNode } from '@agent-device/kernel/snapshot'; import { normalizeType } from '../snapshot/snapshot-processing.ts'; import { hasPositiveRect, rectContains, unionRects } from './screenshot-overlay-rects.ts'; diff --git a/src/daemon/screenshot-overlay-rects.ts b/src/daemon/screenshot-overlay-rects.ts index 9b02e98dd..24a9dea59 100644 --- a/src/daemon/screenshot-overlay-rects.ts +++ b/src/daemon/screenshot-overlay-rects.ts @@ -1,5 +1,5 @@ -import type { Rect } from '../kernel/snapshot.ts'; -import { rectContains } from '../kernel/rect.ts'; +import type { Rect } from '@agent-device/kernel/snapshot'; +import { rectContains } from '@agent-device/kernel/rect'; export { rectContains }; diff --git a/src/daemon/screenshot-overlay.ts b/src/daemon/screenshot-overlay.ts index 1f4a88c15..b358fff9f 100644 --- a/src/daemon/screenshot-overlay.ts +++ b/src/daemon/screenshot-overlay.ts @@ -5,7 +5,7 @@ import { type ScreenshotOverlayRef, type SnapshotNode, type SnapshotState, -} from '../kernel/snapshot.ts'; +} from '@agent-device/kernel/snapshot'; import type { PNG } from '../utils/png.ts'; import { decodePngAsync, encodePngAsync } from '../utils/png-worker-client.ts'; import { analyzeReactNativeOverlay } from '../core/react-native-overlay.ts'; diff --git a/src/daemon/screenshot-runtime.ts b/src/daemon/screenshot-runtime.ts index ada8fb24a..f0d0be199 100644 --- a/src/daemon/screenshot-runtime.ts +++ b/src/daemon/screenshot-runtime.ts @@ -1,4 +1,4 @@ -import { isIosFamily, publicPlatformString } from '../kernel/device.ts'; +import { isIosFamily, publicPlatformString } from '@agent-device/kernel/device'; import { promises as fs } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; @@ -7,7 +7,7 @@ import type { ArtifactAdapter } from '../io.ts'; import { createAgentDevice, localCommandPolicy } from '../runtime.ts'; import { dispatchCommand } from '../core/dispatch.ts'; import { screenshotFlagsFromOptions, screenshotOptionsFromFlags } from '../contracts/screenshot.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { readScreenshotResultData } from '../utils/screenshot-result.ts'; import type { DaemonCommandContext } from './context.ts'; import type { SessionState } from './types.ts'; diff --git a/src/daemon/selector-capture-runtime.ts b/src/daemon/selector-capture-runtime.ts index 301d21cec..6d56b1109 100644 --- a/src/daemon/selector-capture-runtime.ts +++ b/src/daemon/selector-capture-runtime.ts @@ -4,7 +4,7 @@ import { buildSnapshotPresentationKey, snapshotPresentationOptionsFromFlags, type SnapshotState, -} from '../kernel/snapshot.ts'; +} from '@agent-device/kernel/snapshot'; import { isSparseSnapshotQualityVerdict } from '../snapshot/snapshot-quality.ts'; import type { DaemonRequest, SessionState } from './types.ts'; import { SessionStore } from './session-store.ts'; diff --git a/src/daemon/selector-recording.ts b/src/daemon/selector-recording.ts index 00c1143bb..211c350cc 100644 --- a/src/daemon/selector-recording.ts +++ b/src/daemon/selector-recording.ts @@ -1,5 +1,5 @@ import type { DaemonRequest } from './types.ts'; -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { stripAndroidSystemChromeProvenanceFromNode } from '../contracts/android-system-chrome.ts'; import { SessionStore } from './session-store.ts'; import { isInteractiveObservation } from './session-action-recorder.ts'; diff --git a/src/daemon/selector-runtime-backend.ts b/src/daemon/selector-runtime-backend.ts index 6cb9c997c..a025aab75 100644 --- a/src/daemon/selector-runtime-backend.ts +++ b/src/daemon/selector-runtime-backend.ts @@ -5,9 +5,9 @@ import type { } from '../backend.ts'; import { resolveTargetDevice, type CommandFlags } from '../core/dispatch.ts'; import { createAgentDevice } from '../runtime.ts'; -import { isMacOs, isApplePlatform, publicPlatformString } from '../kernel/device.ts'; +import { isMacOs, isApplePlatform, publicPlatformString } from '@agent-device/kernel/device'; import { noActiveSessionError, requireCommandSupported } from './handlers/response.ts'; -import type { SnapshotState, SnapshotNode } from '../kernel/snapshot.ts'; +import type { SnapshotState, SnapshotNode } from '@agent-device/kernel/snapshot'; import { findNodeByLabel } from '../snapshot/snapshot-processing.ts'; import { runAppleRunnerCommand } from '../platforms/apple/core/runner/runner-client.ts'; import { buildAppleRunnerRequestOptions } from './apple-runner-options.ts'; diff --git a/src/daemon/selector-runtime.ts b/src/daemon/selector-runtime.ts index 0a4d8e6b7..e1d379b48 100644 --- a/src/daemon/selector-runtime.ts +++ b/src/daemon/selector-runtime.ts @@ -1,7 +1,7 @@ import { parseWaitPositionals } from '../core/wait-positionals.ts'; import type { WaitParsed } from '../core/wait-positionals.ts'; -import { AppError, asAppError, normalizeError } from '../kernel/errors.ts'; -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import { AppError, asAppError, normalizeError } from '@agent-device/kernel/errors'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { runAppleRunnerCommand } from '../platforms/apple/core/runner/runner-client.ts'; import { buildAppleRunnerRequestOptions } from './apple-runner-options.ts'; import type { DaemonRequest, DaemonResponse, SessionState } from './types.ts'; diff --git a/src/daemon/server/daemon-runtime.ts b/src/daemon/server/daemon-runtime.ts index ebcd3d981..6a40cd1fe 100644 --- a/src/daemon/server/daemon-runtime.ts +++ b/src/daemon/server/daemon-runtime.ts @@ -1,5 +1,5 @@ import crypto from 'node:crypto'; -import { asAppError, AppError } from '../../kernel/errors.ts'; +import { asAppError, AppError } from '@agent-device/kernel/errors'; import { SessionStore } from '../session-store.ts'; import { cleanupStaleAppLogProcesses } from '../app-log-process.ts'; import { resolveDaemonPaths, resolveDaemonServerMode } from '../config.ts'; diff --git a/src/daemon/server/http-server.ts b/src/daemon/server/http-server.ts index b04b8bdc5..d62cc9136 100644 --- a/src/daemon/server/http-server.ts +++ b/src/daemon/server/http-server.ts @@ -1,5 +1,5 @@ import http, { type IncomingHttpHeaders } from 'node:http'; -import { AppError, normalizeError, toAppErrorCode } from '../../kernel/errors.ts'; +import { AppError, normalizeError, toAppErrorCode } from '@agent-device/kernel/errors'; import { emitDiagnostic } from '../../utils/diagnostics.ts'; import { timingSafeStringEqual } from '../../utils/timing-safe-equal.ts'; import type { @@ -7,8 +7,8 @@ import type { JsonRpcId, JsonRpcRequestEnvelope, LeaseBackend, -} from '../../kernel/contracts.ts'; -import { commandRpcParamsSchema } from '../../kernel/contracts.ts'; +} from '@agent-device/kernel/contracts'; +import { commandRpcParamsSchema } from '@agent-device/kernel/contracts'; import type { DaemonInstallSource, DaemonInvokeFn, DaemonRequest } from '../types.ts'; import { normalizeTenantId } from '../config.ts'; import { diff --git a/src/daemon/server/transport.ts b/src/daemon/server/transport.ts index 52d315e6e..9b93451f1 100644 --- a/src/daemon/server/transport.ts +++ b/src/daemon/server/transport.ts @@ -1,6 +1,6 @@ import net from 'node:net'; import type { Server as HttpServer } from 'node:http'; -import { AppError, normalizeError } from '../../kernel/errors.ts'; +import { AppError, normalizeError } from '@agent-device/kernel/errors'; import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../types.ts'; import { clearRequestAbortRegistration, diff --git a/src/daemon/session-event-action.ts b/src/daemon/session-event-action.ts index bfdc8dc7a..494a38867 100644 --- a/src/daemon/session-event-action.ts +++ b/src/daemon/session-event-action.ts @@ -4,7 +4,7 @@ import { RECORDING_SCOPE_VALUES } from '../contracts/recording-scope.ts'; import { SESSION_SURFACES } from '../contracts/session-surface.ts'; import { SWIPE_PATTERNS } from '../contracts/scroll-gesture.ts'; import { CLICK_BUTTONS } from '../contracts/click-button.ts'; -import { DEVICE_TARGETS, PLATFORM_SELECTORS, PUBLIC_PLATFORMS } from '../kernel/device.ts'; +import { DEVICE_TARGETS, PLATFORM_SELECTORS, PUBLIC_PLATFORMS } from '@agent-device/kernel/device'; import type { SessionAction } from './types.ts'; import { buildInstallActionSummary, diff --git a/src/daemon/session-event-log.ts b/src/daemon/session-event-log.ts index 5691d76d2..01a83be77 100644 --- a/src/daemon/session-event-log.ts +++ b/src/daemon/session-event-log.ts @@ -2,8 +2,8 @@ import fs from 'node:fs'; import path from 'node:path'; import { StringDecoder } from 'node:string_decoder'; import { PUBLIC_COMMANDS } from '../command-catalog.ts'; -import { AppError } from '../kernel/errors.ts'; -import { redactDiagnosticData } from '../kernel/redaction.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import { redactDiagnosticData } from '@agent-device/kernel/redaction'; import { emitDiagnostic, getDiagnosticsMeta } from '../utils/diagnostics.ts'; import { isRecord } from '../utils/parsing.ts'; import type { DaemonRequest, DaemonResponse, SessionAction } from './types.ts'; diff --git a/src/daemon/session-script-active-publication.ts b/src/daemon/session-script-active-publication.ts index 8feff351f..61e599086 100644 --- a/src/daemon/session-script-active-publication.ts +++ b/src/daemon/session-script-active-publication.ts @@ -1,6 +1,6 @@ import { resolveCommandRecordingEffect } from '../core/command-descriptor/registry.ts'; import { parseWaitPositionals } from '../core/wait-positionals.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { isTouchTargetCommand } from '../replay/script-utils.ts'; import { tryParseSelectorChain } from '../selectors/parse.ts'; import type { SessionAction } from './types.ts'; diff --git a/src/daemon/session-script-writer.ts b/src/daemon/session-script-writer.ts index a8cfb3625..72dcee630 100644 --- a/src/daemon/session-script-writer.ts +++ b/src/daemon/session-script-writer.ts @@ -1,9 +1,9 @@ import fs from 'node:fs'; import path from 'node:path'; -import { publicPlatformString } from '../kernel/device.ts'; +import { publicPlatformString } from '@agent-device/kernel/device'; import { inferFillText } from './action-utils.ts'; import { emitDiagnostic } from '../utils/diagnostics.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { formatPortableActionLine, formatTargetAnnotationLines, diff --git a/src/daemon/session-selector.ts b/src/daemon/session-selector.ts index 63a4faa24..9801817d8 100644 --- a/src/daemon/session-selector.ts +++ b/src/daemon/session-selector.ts @@ -1,11 +1,11 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { CommandFlags } from '../core/dispatch.ts'; import type { SessionState } from './types.ts'; import { isIosFamily, isSerialAddressablePlatform, matchesPlatformSelector, -} from '../kernel/device.ts'; +} from '@agent-device/kernel/device'; import { parseSerialAllowlist } from '../utils/device-isolation.ts'; import { buildSessionRecoveryHint, describeSessionDevice } from './session-recovery-hints.ts'; diff --git a/src/daemon/session-snapshot.ts b/src/daemon/session-snapshot.ts index 9e8271b89..8e77f6f31 100644 --- a/src/daemon/session-snapshot.ts +++ b/src/daemon/session-snapshot.ts @@ -1,5 +1,5 @@ import { randomInt } from 'node:crypto'; -import type { SnapshotState } from '../kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; import { activatePartialRefFrame, refFrameEpoch, refFrameState } from './ref-frame.ts'; import type { SessionState } from './types.ts'; diff --git a/src/daemon/session-target-evidence.ts b/src/daemon/session-target-evidence.ts index 8cad1e6f4..cd9a42ecd 100644 --- a/src/daemon/session-target-evidence.ts +++ b/src/daemon/session-target-evidence.ts @@ -14,7 +14,7 @@ * identically by definition" (decision 3, "Record-time write"). */ -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { resolveRectCenter } from '../utils/rect-center.ts'; import { findNearestScrollableContainer } from './snapshot-presentation/tree.ts'; import { diff --git a/src/daemon/session-teardown.ts b/src/daemon/session-teardown.ts index f6b7ab2f6..f6044cc2b 100644 --- a/src/daemon/session-teardown.ts +++ b/src/daemon/session-teardown.ts @@ -1,6 +1,6 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { emitDiagnostic } from '../utils/diagnostics.ts'; -import { isMacOs, isApplePlatform } from '../kernel/device.ts'; +import { isMacOs, isApplePlatform } from '@agent-device/kernel/device'; import { runMacOsAlertAction } from '../platforms/apple/os/macos/helper.ts'; import { stopAppLog } from './app-log.ts'; import { stopIosRunnerSession } from '../platforms/apple/core/runner/runner-client.ts'; diff --git a/src/daemon/snapshot-presentation/ios/actions.ts b/src/daemon/snapshot-presentation/ios/actions.ts index 7e0154f1e..7ef6a5349 100644 --- a/src/daemon/snapshot-presentation/ios/actions.ts +++ b/src/daemon/snapshot-presentation/ios/actions.ts @@ -1,4 +1,4 @@ -import type { RawSnapshotNode } from '../../../kernel/snapshot.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; import { normalizeType } from '../../../snapshot/snapshot-processing.ts'; import { findLargestViewportRect, diff --git a/src/daemon/snapshot-presentation/ios/index.ts b/src/daemon/snapshot-presentation/ios/index.ts index b654eb3fa..ff8f0343b 100644 --- a/src/daemon/snapshot-presentation/ios/index.ts +++ b/src/daemon/snapshot-presentation/ios/index.ts @@ -1,4 +1,4 @@ -import type { RawSnapshotNode } from '../../../kernel/snapshot.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; import { collectIosImplicitScrollableActions } from './actions.ts'; import { collectIosPresentationNoiseSuppression } from './noise.ts'; import { collectIosRowPresentation } from './rows.ts'; diff --git a/src/daemon/snapshot-presentation/ios/noise.ts b/src/daemon/snapshot-presentation/ios/noise.ts index 3bfa25f2a..3fc747d4e 100644 --- a/src/daemon/snapshot-presentation/ios/noise.ts +++ b/src/daemon/snapshot-presentation/ios/noise.ts @@ -1,5 +1,5 @@ -import type { RawSnapshotNode } from '../../../kernel/snapshot.ts'; -import { rectArea, rectContains } from '../../../kernel/rect.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; +import { rectArea, rectContains } from '@agent-device/kernel/rect'; import { isReactNativeCollapsedWarningWrapperCandidate, isReactNativeCollapsedWarningWrapperWithVisibleBanner, diff --git a/src/daemon/snapshot-presentation/ios/presentation.test.ts b/src/daemon/snapshot-presentation/ios/presentation.test.ts index f1174d4d7..37dea907b 100644 --- a/src/daemon/snapshot-presentation/ios/presentation.test.ts +++ b/src/daemon/snapshot-presentation/ios/presentation.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import { attachRefs, type RawSnapshotNode } from '../../../kernel/snapshot.ts'; +import { attachRefs, type RawSnapshotNode } from '@agent-device/kernel/snapshot'; import { buildSnapshotVisibility } from '../../../snapshot/snapshot-visibility.ts'; import { presentIosInteractiveSnapshot } from './index.ts'; diff --git a/src/daemon/snapshot-presentation/ios/rows.ts b/src/daemon/snapshot-presentation/ios/rows.ts index b6d207f3d..aa10b3a17 100644 --- a/src/daemon/snapshot-presentation/ios/rows.ts +++ b/src/daemon/snapshot-presentation/ios/rows.ts @@ -1,4 +1,4 @@ -import type { RawSnapshotNode } from '../../../kernel/snapshot.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; import { normalizeType } from '../../../snapshot/snapshot-processing.ts'; import { areRectsApproximatelyEqual, diff --git a/src/daemon/snapshot-presentation/ios/scroll.ts b/src/daemon/snapshot-presentation/ios/scroll.ts index 71feb88ea..42e412cf6 100644 --- a/src/daemon/snapshot-presentation/ios/scroll.ts +++ b/src/daemon/snapshot-presentation/ios/scroll.ts @@ -1,4 +1,4 @@ -import type { RawSnapshotNode } from '../../../kernel/snapshot.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; import { inferVerticalScrollIndicatorDirections, isSystemScrollIndicatorLabel, diff --git a/src/daemon/snapshot-presentation/ios/web.test.ts b/src/daemon/snapshot-presentation/ios/web.test.ts index 469f5c88f..879872781 100644 --- a/src/daemon/snapshot-presentation/ios/web.test.ts +++ b/src/daemon/snapshot-presentation/ios/web.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import type { RawSnapshotNode } from '../../../kernel/snapshot.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; import { presentIosInteractiveSnapshot } from './index.ts'; test('projects iOS WebKit heading and text wrappers to semantic roles', () => { diff --git a/src/daemon/snapshot-presentation/ios/web.ts b/src/daemon/snapshot-presentation/ios/web.ts index 4a9683f18..124b155dc 100644 --- a/src/daemon/snapshot-presentation/ios/web.ts +++ b/src/daemon/snapshot-presentation/ios/web.ts @@ -1,4 +1,4 @@ -import type { RawSnapshotNode } from '../../../kernel/snapshot.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; import { normalizeType } from '../../../snapshot/snapshot-processing.ts'; import { findNearestAncestor, mergeReplacement, type SnapshotTreeRuleContext } from '../tree.ts'; diff --git a/src/daemon/snapshot-presentation/tree.ts b/src/daemon/snapshot-presentation/tree.ts index 6b0435a49..d9a037db2 100644 --- a/src/daemon/snapshot-presentation/tree.ts +++ b/src/daemon/snapshot-presentation/tree.ts @@ -1,4 +1,4 @@ -import type { RawSnapshotNode } from '../../kernel/snapshot.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; import { normalizeType } from '../../snapshot/snapshot-processing.ts'; export { areRectsApproximatelyEqual } from '../../utils/rect-center.ts'; diff --git a/src/daemon/snapshot-runtime.ts b/src/daemon/snapshot-runtime.ts index 9afa3c5ca..e838389bc 100644 --- a/src/daemon/snapshot-runtime.ts +++ b/src/daemon/snapshot-runtime.ts @@ -1,8 +1,8 @@ -import { isIosFamily, publicPlatformString } from '../kernel/device.ts'; +import { isIosFamily, publicPlatformString } from '@agent-device/kernel/device'; import type { AgentDeviceBackend, BackendSnapshotResult } from '../backend.ts'; import type { CommandSessionRecord } from '../runtime.ts'; import { createAgentDevice } from '../runtime.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { SnapshotDiffSummary } from '../snapshot/snapshot-diff.ts'; import type { DaemonRequest, DaemonResponse, DaemonResponseData, SessionState } from './types.ts'; import { SessionStore } from './session-store.ts'; diff --git a/src/daemon/target-shutdown.ts b/src/daemon/target-shutdown.ts index 94ad42899..2fad2a2eb 100644 --- a/src/daemon/target-shutdown.ts +++ b/src/daemon/target-shutdown.ts @@ -1,8 +1,8 @@ import { runAndroidAdb } from '../platforms/android/adb.ts'; import { getSimulatorState, shutdownSimulator } from '../platforms/apple/core/simulator.ts'; import type { TargetShutdownResult } from '../contracts/target-shutdown-contract.ts'; -import type { DeviceInfo } from '../kernel/device.ts'; -import { normalizeError } from '../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { normalizeError } from '@agent-device/kernel/errors'; import { isAndroidEmulator, isIosSimulator } from './device-targets.ts'; export type DeviceTargetShutdownResult = TargetShutdownResult; diff --git a/src/daemon/tenant-owned-entry.ts b/src/daemon/tenant-owned-entry.ts index ed6bcbe56..5367ca2a7 100644 --- a/src/daemon/tenant-owned-entry.ts +++ b/src/daemon/tenant-owned-entry.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; type TenantOwnedEntry = { tenantId?: string }; diff --git a/src/daemon/touch-reference-frame.ts b/src/daemon/touch-reference-frame.ts index 7554b72b5..2c69d5544 100644 --- a/src/daemon/touch-reference-frame.ts +++ b/src/daemon/touch-reference-frame.ts @@ -2,7 +2,7 @@ import { inferGestureReferenceFrame, type GestureReferenceFrame, } from '../contracts/scroll-gesture.ts'; -import type { SnapshotState } from '../kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; export type TouchReferenceFrame = GestureReferenceFrame; diff --git a/src/daemon/types.ts b/src/daemon/types.ts index 776ca2bdf..183729c20 100644 --- a/src/daemon/types.ts +++ b/src/daemon/types.ts @@ -7,16 +7,16 @@ import type { DaemonInstallSource as PublicDaemonInstallSource, LeaseBackend, SessionRuntimeHints as PublicSessionRuntimeHints, -} from '../kernel/contracts.ts'; +} from '@agent-device/kernel/contracts'; import type { CommandFlags } from '../contracts/command-flags.ts'; import type { GestureReferenceFrame, ScrollDirection } from '../contracts/scroll-gesture.ts'; import type { LogBackend } from '../contracts/logs.ts'; import type { SessionSurface } from '../contracts/session-surface.ts'; import type { RecordingExportQuality } from '../contracts/recording-export-quality.ts'; import type { RecordingScope } from '../contracts/recording-scope.ts'; -import type { DeviceInfo, Platform, PlatformSelector } from '../kernel/device.ts'; +import type { DeviceInfo, Platform, PlatformSelector } from '@agent-device/kernel/device'; import type { ExecBackgroundResult, ExecResult } from '../utils/exec.ts'; -import type { Rect, SnapshotState } from '../kernel/snapshot.ts'; +import type { Rect, SnapshotState } from '@agent-device/kernel/snapshot'; import type { GestureExecutionProfile } from '../contracts/gesture-plan-types.ts'; // Type-only import; erased at runtime. ref-frame.ts imports SessionState from // here, so this back-edge must stay type-only to avoid a runtime cycle. diff --git a/src/daemon/upload-http.ts b/src/daemon/upload-http.ts index d922c8128..5ba1e2014 100644 --- a/src/daemon/upload-http.ts +++ b/src/daemon/upload-http.ts @@ -1,5 +1,5 @@ import http from 'node:http'; -import { AppError, normalizeError } from '../kernel/errors.ts'; +import { AppError, normalizeError } from '@agent-device/kernel/errors'; import type { DaemonRequest } from './types.ts'; import { trackUploadedArtifact } from './artifact-tracking.ts'; import { diff --git a/src/daemon/upload.ts b/src/daemon/upload.ts index aee0c8572..04a350a6e 100644 --- a/src/daemon/upload.ts +++ b/src/daemon/upload.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; import type { IncomingMessage } from 'node:http'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { extractTarInstallableArtifact } from './artifact-archive.ts'; import { createArtifactTempDir, diff --git a/src/daemon/wait-current-surface.ts b/src/daemon/wait-current-surface.ts index 7563067ae..34277517a 100644 --- a/src/daemon/wait-current-surface.ts +++ b/src/daemon/wait-current-surface.ts @@ -1,4 +1,4 @@ -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import type { DaemonRequest, DaemonResponse, SessionState } from './types.ts'; import { captureSnapshot } from './handlers/snapshot-capture.ts'; import { errorResponse } from './handlers/response.ts'; diff --git a/src/finders.ts b/src/finders.ts index f120103c1..67f7de108 100644 --- a/src/finders.ts +++ b/src/finders.ts @@ -4,7 +4,7 @@ import { findBestMatchesByLocator as findBestMatchesByLocatorInternal, type FindLocator, } from './selectors/find.ts'; -import type { SnapshotNode } from './kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; export type FindMatchOptions = { requireRect?: boolean; diff --git a/src/io.ts b/src/io.ts index 446387a5e..714e4dc65 100644 --- a/src/io.ts +++ b/src/io.ts @@ -1,8 +1,8 @@ import { promises as fs } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import { AppError } from './kernel/errors.ts'; -import type { DaemonArtifactType } from './kernel/contracts.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { DaemonArtifactType } from '@agent-device/kernel/contracts'; export type FileInputRef = | { diff --git a/src/mcp/__tests__/command-tools.test.ts b/src/mcp/__tests__/command-tools.test.ts index 536f47bbe..2d547af6a 100644 --- a/src/mcp/__tests__/command-tools.test.ts +++ b/src/mcp/__tests__/command-tools.test.ts @@ -4,7 +4,7 @@ import type { AgentDeviceClient } from '../../client/client-types.ts'; import { createCommandToolExecutor, listCommandTools } from '../command-tools.ts'; import { resolveCommandRecordsSessionAction } from '../../core/command-descriptor/registry.ts'; import { COMMAND_OUTPUT_SCHEMAS } from '../command-output-schemas.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { NAVIGATION_COMMAND_PROJECTIONS } from '../../commands/system/navigation-projection.ts'; import { validateAgainstSchema } from './output-schema-validator.ts'; diff --git a/src/mcp/command-output-schemas.ts b/src/mcp/command-output-schemas.ts index 802c343cc..98b8f51de 100644 --- a/src/mcp/command-output-schemas.ts +++ b/src/mcp/command-output-schemas.ts @@ -3,7 +3,7 @@ import { projectedSystemCommandOutputSchemas } from '../commands/system/index.ts import type { CommandResultMap } from '../core/command-descriptor/command-result.ts'; import { booleanSchema, looseObjectSchema, stringSchema } from '../commands/command-input.ts'; import { SESSION_SURFACES } from '../contracts/session-surface.ts'; -import { DEVICE_TARGETS, PUBLIC_PLATFORMS } from '../kernel/device.ts'; +import { DEVICE_TARGETS, PUBLIC_PLATFORMS } from '@agent-device/kernel/device'; /** * Registry of per-command MCP `outputSchema`s, keyed by the daemon command diff --git a/src/mcp/command-tools.ts b/src/mcp/command-tools.ts index bd5a89961..01ad92024 100644 --- a/src/mcp/command-tools.ts +++ b/src/mcp/command-tools.ts @@ -2,7 +2,7 @@ import type { AgentDeviceClientConfig } from '../contracts/client-connection.ts' import type { AgentDeviceClient } from '../client/client-types.ts'; import type { JsonSchema } from '../commands/command-contract.ts'; import type { CommandExecutionResult } from '../commands/command-surface.ts'; -import { RESPONSE_LEVELS, type ResponseLevel } from '../kernel/contracts.ts'; +import { RESPONSE_LEVELS, type ResponseLevel } from '@agent-device/kernel/contracts'; import { formatCliOutput } from '../commands/cli-output.ts'; import { findCommandMetadata, @@ -12,7 +12,7 @@ import { } from '../commands/command-metadata.ts'; import { resolveCommandRecordsSessionAction } from '../core/command-descriptor/registry.ts'; import { MCP_COMMAND_OUTPUT_SCHEMAS } from './mcp-output-schemas.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { formatToolErrorText, normalizeToolError } from './tool-error.ts'; import { resolveMcpConfigDefaults } from './tool-input-config.ts'; import { projectStructuredContent } from './tool-result.ts'; diff --git a/src/mcp/mcp-output-schemas.ts b/src/mcp/mcp-output-schemas.ts index 712e8ffbb..4d40800cf 100644 --- a/src/mcp/mcp-output-schemas.ts +++ b/src/mcp/mcp-output-schemas.ts @@ -1,5 +1,5 @@ import type { JsonSchema } from '../commands/command-contract.ts'; -import { DEVICE_TARGETS, PUBLIC_PLATFORMS } from '../kernel/device.ts'; +import { DEVICE_TARGETS, PUBLIC_PLATFORMS } from '@agent-device/kernel/device'; import { COMMAND_OUTPUT_SCHEMAS, DEVICE_KINDS } from './command-output-schemas.ts'; const MCP_COLLECTION_OUTPUT_SCHEMAS = { diff --git a/src/mcp/router.ts b/src/mcp/router.ts index 5c41feb88..f3e154786 100644 --- a/src/mcp/router.ts +++ b/src/mcp/router.ts @@ -1,7 +1,7 @@ import { listCommandTools, commandToolExecutor, type ToolResult } from './command-tools.ts'; import { readVersion } from '../utils/version.ts'; -import type { JsonRpcId, JsonRpcRequestEnvelope } from '../kernel/contracts.ts'; -import { AppError } from '../kernel/errors.ts'; +import type { JsonRpcId, JsonRpcRequestEnvelope } from '@agent-device/kernel/contracts'; +import { AppError } from '@agent-device/kernel/errors'; import { formatToolErrorText, normalizeToolError } from './tool-error.ts'; const MCP_SERVER_NAME = 'agent-device'; diff --git a/src/mcp/server.ts b/src/mcp/server.ts index 09a7b0c15..fb748b9d1 100644 --- a/src/mcp/server.ts +++ b/src/mcp/server.ts @@ -1,5 +1,5 @@ import { handleMcpMessage, type JsonRpcMessage } from './router.ts'; -import { jsonRpcRequestSchema, type JsonRpcId } from '../kernel/contracts.ts'; +import { jsonRpcRequestSchema, type JsonRpcId } from '@agent-device/kernel/contracts'; type JsonRpcResponse = Awaited>>; type MessageSink = (payload: unknown) => void; diff --git a/src/mcp/tool-error.ts b/src/mcp/tool-error.ts index 3b8a067b7..9145409ed 100644 --- a/src/mcp/tool-error.ts +++ b/src/mcp/tool-error.ts @@ -1,4 +1,4 @@ -import { normalizeError, type NormalizedError } from '../kernel/errors.ts'; +import { normalizeError, type NormalizedError } from '@agent-device/kernel/errors'; import { formatReplayDivergenceReport } from '../replay/divergence.ts'; /** diff --git a/src/mcp/tool-ref-pins.ts b/src/mcp/tool-ref-pins.ts index 4931694e4..9d9d54822 100644 --- a/src/mcp/tool-ref-pins.ts +++ b/src/mcp/tool-ref-pins.ts @@ -1,4 +1,4 @@ -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import type { CommandName } from '../commands/command-metadata.ts'; import type { CommandExecutionResult } from '../commands/command-surface.ts'; import { asOptionalRecord } from '../utils/parsing.ts'; diff --git a/src/metro/client-metro.ts b/src/metro/client-metro.ts index b73538f88..2d41df600 100644 --- a/src/metro/client-metro.ts +++ b/src/metro/client-metro.ts @@ -18,7 +18,7 @@ import type { MetroBridgeRuntimePayload, MetroRuntimeHints, } from './metro-types.ts'; -import { AppError, asAppError } from '../kernel/errors.ts'; +import { AppError, asAppError } from '@agent-device/kernel/errors'; import { runCmdSync, runCmdDetached } from '../utils/exec.ts'; import { resolveUserPath } from '../utils/path-resolution.ts'; import { waitForProcessExit } from '../utils/host-process.ts'; diff --git a/src/metro/metro-reload-endpoints.ts b/src/metro/metro-reload-endpoints.ts index b4ad13e91..d7909d27e 100644 --- a/src/metro/metro-reload-endpoints.ts +++ b/src/metro/metro-reload-endpoints.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { MetroRuntimeHints } from './metro-types.ts'; import { resolveRuntimeTransportHints, diff --git a/src/metro/metro-types.ts b/src/metro/metro-types.ts index 4c0a51def..0aaa57c65 100644 --- a/src/metro/metro-types.ts +++ b/src/metro/metro-types.ts @@ -1,4 +1,4 @@ -import type { SessionRuntimeHints } from '../kernel/contracts.ts'; +import type { SessionRuntimeHints } from '@agent-device/kernel/contracts'; /** Re-export of {@link SessionRuntimeHints} under the Metro-specific alias used by public API consumers. */ export type MetroRuntimeHints = SessionRuntimeHints; diff --git a/src/metro/metro.ts b/src/metro/metro.ts index 8cd6f0d73..73d31203c 100644 --- a/src/metro/metro.ts +++ b/src/metro/metro.ts @@ -1,4 +1,4 @@ -import type { SessionRuntimeHints } from '../kernel/contracts.ts'; +import type { SessionRuntimeHints } from '@agent-device/kernel/contracts'; import { stopMetroCompanion } from './client-metro-companion.ts'; import { resolveRuntimeTransportHints } from '../utils/runtime-transport.ts'; diff --git a/src/platforms/__tests__/boot-diagnostics.test.ts b/src/platforms/__tests__/boot-diagnostics.test.ts index 0e87d9195..855da96f6 100644 --- a/src/platforms/__tests__/boot-diagnostics.test.ts +++ b/src/platforms/__tests__/boot-diagnostics.test.ts @@ -1,7 +1,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { bootFailureHint, classifyBootFailure } from '../boot-diagnostics.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; test('classifyBootFailure maps timeout errors', () => { const reason = classifyBootFailure({ diff --git a/src/platforms/android/__tests__/adb-executor.test.ts b/src/platforms/android/__tests__/adb-executor.test.ts index 2fc4f1637..0ab7aceaa 100644 --- a/src/platforms/android/__tests__/adb-executor.test.ts +++ b/src/platforms/android/__tests__/adb-executor.test.ts @@ -32,7 +32,7 @@ import { type AndroidAdbProvider, } from '../adb-executor.ts'; import { runCmd, runCmdBackground } from '../../../utils/exec.ts'; -import { AppError, normalizeError } from '../../../kernel/errors.ts'; +import { AppError, normalizeError } from '@agent-device/kernel/errors'; const mockRunCmd = vi.mocked(runCmd); const mockRunCmdBackground = vi.mocked(runCmdBackground); diff --git a/src/platforms/android/__tests__/alert-detection.test.ts b/src/platforms/android/__tests__/alert-detection.test.ts index 4ab4985fd..00f193962 100644 --- a/src/platforms/android/__tests__/alert-detection.test.ts +++ b/src/platforms/android/__tests__/alert-detection.test.ts @@ -1,7 +1,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { chooseAndroidAlertButton, findAndroidAlertCandidate } from '../alert-detection.ts'; -import type { RawSnapshotNode } from '../../../kernel/snapshot.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; test('chooseAndroidAlertButton prefers platform ids over ambiguous labels', () => { const candidate = findAndroidAlertCandidate([ diff --git a/src/platforms/android/__tests__/app-lifecycle-install.test.ts b/src/platforms/android/__tests__/app-lifecycle-install.test.ts index 82aa951e8..db20dce31 100644 --- a/src/platforms/android/__tests__/app-lifecycle-install.test.ts +++ b/src/platforms/android/__tests__/app-lifecycle-install.test.ts @@ -12,8 +12,8 @@ import { resolveAndroidApp, } from '../app-lifecycle.ts'; import { withAndroidAdbProvider } from '../adb-executor.ts'; -import type { DeviceInfo } from '../../../kernel/device.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { withScriptedAdb } from '../../../__tests__/test-utils/mocked-binaries.ts'; test('parseAndroidLaunchComponent extracts final resolved component', () => { diff --git a/src/platforms/android/__tests__/app-lifecycle-open.test.ts b/src/platforms/android/__tests__/app-lifecycle-open.test.ts index 4d71829af..e11074b05 100644 --- a/src/platforms/android/__tests__/app-lifecycle-open.test.ts +++ b/src/platforms/android/__tests__/app-lifecycle-open.test.ts @@ -3,8 +3,8 @@ import assert from 'node:assert/strict'; import { promises as fs } from 'node:fs'; import { closeAndroidApp, openAndroidApp } from '../app-lifecycle.ts'; import { withAndroidAdbProvider } from '../adb-executor.ts'; -import type { DeviceInfo } from '../../../kernel/device.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { withScriptedAdb } from '../../../__tests__/test-utils/mocked-binaries.ts'; test('openAndroidApp rejects activity override for deep link URLs', async () => { diff --git a/src/platforms/android/__tests__/device-input-state.test.ts b/src/platforms/android/__tests__/device-input-state.test.ts index 986923f60..993d614d7 100644 --- a/src/platforms/android/__tests__/device-input-state.test.ts +++ b/src/platforms/android/__tests__/device-input-state.test.ts @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import type { AndroidAdbExecutor } from '../adb-executor.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { promises as fs } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; diff --git a/src/platforms/android/__tests__/devices.test.ts b/src/platforms/android/__tests__/devices.test.ts index 635cc086a..df77b1379 100644 --- a/src/platforms/android/__tests__/devices.test.ts +++ b/src/platforms/android/__tests__/devices.test.ts @@ -11,7 +11,7 @@ vi.mock('../../../utils/exec.ts', async (importOriginal) => { const execActual = await vi.importActual('../../../utils/exec.ts'); -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { runCmdDetached, withCommandExecutorOverride } from '../../../utils/exec.ts'; import type { CommandExecutorOverride, ExecResult } from '../../../utils/exec.ts'; import { diff --git a/src/platforms/android/__tests__/input-actions-fill.test.ts b/src/platforms/android/__tests__/input-actions-fill.test.ts index 60db310a9..936c2d7a1 100644 --- a/src/platforms/android/__tests__/input-actions-fill.test.ts +++ b/src/platforms/android/__tests__/input-actions-fill.test.ts @@ -5,7 +5,7 @@ import { ANDROID_SNAPSHOT_HELPER_FIXTURE_ARTIFACT, createAndroidSnapshotHelperExecutor, } from '../../../__tests__/test-utils/index.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { fillAndroid, typeAndroid } from '../input-actions.ts'; import { withAndroidAdbProvider, type AndroidAdbExecutor } from '../adb-executor.ts'; import { diff --git a/src/platforms/android/__tests__/input-actions.test.ts b/src/platforms/android/__tests__/input-actions.test.ts index d17157bf6..083d8fd26 100644 --- a/src/platforms/android/__tests__/input-actions.test.ts +++ b/src/platforms/android/__tests__/input-actions.test.ts @@ -8,7 +8,7 @@ import { setAndroidOrientation, typeAndroid, } from '../input-actions.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { withScriptedAdb } from '../../../__tests__/test-utils/mocked-binaries.ts'; import { ANDROID_EMULATOR, diff --git a/src/platforms/android/__tests__/logcat.test.ts b/src/platforms/android/__tests__/logcat.test.ts index 988c1c71d..4bcd0e8c2 100644 --- a/src/platforms/android/__tests__/logcat.test.ts +++ b/src/platforms/android/__tests__/logcat.test.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { streamAndroidLogcatWithAdb } from '../logcat.ts'; test('streamAndroidLogcatWithAdb reports unsupported providers without spawn', () => { diff --git a/src/platforms/android/__tests__/notifications.test.ts b/src/platforms/android/__tests__/notifications.test.ts index 2193062bd..ebe37cde5 100644 --- a/src/platforms/android/__tests__/notifications.test.ts +++ b/src/platforms/android/__tests__/notifications.test.ts @@ -4,7 +4,7 @@ import { promises as fs } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { pushAndroidNotification } from '../notifications.ts'; -import type { DeviceInfo } from '../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; test('pushAndroidNotification broadcasts action with typed extras', async () => { const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'agent-device-android-push-test-')); diff --git a/src/platforms/android/__tests__/settings.test.ts b/src/platforms/android/__tests__/settings.test.ts index d93bb71b9..ef7dbe6ab 100644 --- a/src/platforms/android/__tests__/settings.test.ts +++ b/src/platforms/android/__tests__/settings.test.ts @@ -4,8 +4,8 @@ import { promises as fs } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { setAndroidSetting } from '../settings.ts'; -import type { DeviceInfo } from '../../../kernel/device.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { withScriptedAdb } from '../../../__tests__/test-utils/mocked-binaries.ts'; test('setAndroidSetting appearance toggle flips current mode', async () => { diff --git a/src/platforms/android/__tests__/snapshot-helper.test.ts b/src/platforms/android/__tests__/snapshot-helper.test.ts index a3f28fade..c9bae04a4 100644 --- a/src/platforms/android/__tests__/snapshot-helper.test.ts +++ b/src/platforms/android/__tests__/snapshot-helper.test.ts @@ -13,7 +13,7 @@ import { forgetAndroidSnapshotHelperInstall, resetAndroidSnapshotHelperInstallCache, } from '../snapshot-helper-install.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { parseAndroidSnapshotHelperManifest } from '../snapshot-helper-artifact.ts'; import { verifyAndroidHelperApkChecksum } from '../helper-package-install.ts'; import type { diff --git a/src/platforms/android/__tests__/snapshot.test.ts b/src/platforms/android/__tests__/snapshot.test.ts index dc46e018c..dddd49f35 100644 --- a/src/platforms/android/__tests__/snapshot.test.ts +++ b/src/platforms/android/__tests__/snapshot.test.ts @@ -19,9 +19,9 @@ vi.mock('../adb.ts', async (importOriginal) => { import { screenshotAndroid } from '../screenshot.ts'; import { snapshotAndroid } from '../snapshot.ts'; import { buildUiHierarchySnapshot, parseUiHierarchyTree } from '../ui-hierarchy.ts'; -import type { DeviceInfo } from '../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { flushDiagnosticsToSessionFile, withDiagnosticsScope } from '../../../utils/diagnostics.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { runCmd } from '../../../utils/exec.ts'; import { sleep } from '../adb.ts'; import { resetAndroidSnapshotHelperInstallCache } from '../snapshot-helper-install.ts'; diff --git a/src/platforms/android/__tests__/touch-helper-session.test.ts b/src/platforms/android/__tests__/touch-helper-session.test.ts index 7b6a8367b..2c040d876 100644 --- a/src/platforms/android/__tests__/touch-helper-session.test.ts +++ b/src/platforms/android/__tests__/touch-helper-session.test.ts @@ -10,8 +10,8 @@ import { EventEmitter } from 'node:events'; import net from 'node:net'; import { PassThrough } from 'node:stream'; import { afterEach, beforeEach, test, vi } from 'vitest'; -import type { DeviceInfo } from '../../../kernel/device.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { withAndroidAdbProvider, type AndroidAdbProcess, diff --git a/src/platforms/android/__tests__/touch-helper.fixtures.ts b/src/platforms/android/__tests__/touch-helper.fixtures.ts index 3b6c2fa36..5206a3417 100644 --- a/src/platforms/android/__tests__/touch-helper.fixtures.ts +++ b/src/platforms/android/__tests__/touch-helper.fixtures.ts @@ -1,6 +1,6 @@ import { ANDROID_EMULATOR } from '../../../__tests__/test-utils/index.ts'; import { buildGesturePlan } from '../../../contracts/gesture-plan.ts'; -import type { DeviceInfo } from '../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import type { AndroidAdbExecutor } from '../adb-executor.ts'; import type { AndroidTouchPlan } 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 6ffce4a1e..e84e67195 100644 --- a/src/platforms/android/__tests__/touch-helper.test.ts +++ b/src/platforms/android/__tests__/touch-helper.test.ts @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import { afterEach, beforeEach, test, vi } from 'vitest'; import { buildGesturePlan } from '../../../contracts/gesture-plan.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { withAndroidAdbProvider } from '../adb-executor.ts'; import { resetAndroidSnapshotHelperSessions } from '../snapshot-helper-session.ts'; import { diff --git a/src/platforms/android/adb-executor.ts b/src/platforms/android/adb-executor.ts index ba55aa54c..2167f7be1 100644 --- a/src/platforms/android/adb-executor.ts +++ b/src/platforms/android/adb-executor.ts @@ -1,7 +1,7 @@ import { AsyncLocalStorage } from 'node:async_hooks'; import type { Readable, Writable } from 'node:stream'; -import type { DeviceInfo } from '../../kernel/device.ts'; -import type { Rect } from '../../kernel/snapshot.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import type { Rect } from '@agent-device/kernel/snapshot'; import type { AndroidSnapshotHelperArtifact } from './snapshot-helper-types.ts'; import type { AndroidProviderTouchPlan } from './touch-plan.ts'; import { @@ -16,7 +16,7 @@ import { type ExecOptions, type ExecResult, } from '../../utils/exec.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export type AndroidAdbExecutorOptions = Pick< ExecOptions, diff --git a/src/platforms/android/adb.ts b/src/platforms/android/adb.ts index 086e3453e..2ef8ad8e6 100644 --- a/src/platforms/android/adb.ts +++ b/src/platforms/android/adb.ts @@ -1,4 +1,4 @@ -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { resolveAndroidAdbExecutor, type AndroidAdbExecutorOptions, diff --git a/src/platforms/android/alert-detection.ts b/src/platforms/android/alert-detection.ts index 2f0f41a52..88cad1500 100644 --- a/src/platforms/android/alert-detection.ts +++ b/src/platforms/android/alert-detection.ts @@ -1,4 +1,4 @@ -import { centerOfRect, type RawSnapshotNode } from '../../kernel/snapshot.ts'; +import { centerOfRect, type RawSnapshotNode } from '@agent-device/kernel/snapshot'; import type { AlertInfo, AlertSource } from '../../contracts/alert-contract.ts'; type AndroidAlertButtonRole = 'accept' | 'dismiss' | 'neutral'; diff --git a/src/platforms/android/alert.ts b/src/platforms/android/alert.ts index 6abfd4e84..837848402 100644 --- a/src/platforms/android/alert.ts +++ b/src/platforms/android/alert.ts @@ -4,11 +4,11 @@ import { ALERT_POLL_INTERVAL_MS, DEFAULT_ALERT_TIMEOUT_MS, } from '../../contracts/alert-contract.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { withDiagnosticTimer } from '../../utils/diagnostics.ts'; import { successText } from '../../utils/success-text.ts'; import { sleep } from '../../utils/timeouts.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { chooseAndroidAlertButton, findAndroidAlertCandidate, diff --git a/src/platforms/android/app-control.ts b/src/platforms/android/app-control.ts index e5e303481..206e39116 100644 --- a/src/platforms/android/app-control.ts +++ b/src/platforms/android/app-control.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { AndroidAdbExecutor } from './adb-executor.ts'; import { isAmStartError, parseAndroidLaunchComponent } from './app-lifecycle.ts'; diff --git a/src/platforms/android/app-lifecycle.ts b/src/platforms/android/app-lifecycle.ts index 267acdba0..bdfaaf23c 100644 --- a/src/platforms/android/app-lifecycle.ts +++ b/src/platforms/android/app-lifecycle.ts @@ -2,10 +2,10 @@ import { promises as fs } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { resolveFileOverridePath, runCmd, whichCmd } from '../../utils/exec.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { sleep } from '../../utils/timeouts.ts'; import type { AppsFilter } from '../../contracts/app-inventory.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { isDeepLinkTarget } from '../../contracts/open-target.ts'; import { createAppResolutionCache, type AppResolutionCacheScope } from '../app-resolution-cache.ts'; import { waitForAndroidBoot } from './devices.ts'; diff --git a/src/platforms/android/device-input-state.ts b/src/platforms/android/device-input-state.ts index 74f21cbc8..f00248d1b 100644 --- a/src/platforms/android/device-input-state.ts +++ b/src/platforms/android/device-input-state.ts @@ -1,6 +1,6 @@ import { emitDiagnostic } from '../../utils/diagnostics.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; -import { AppError } from '../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { isClipboardShellUnsupported, sleep } from './adb.ts'; import { androidAdbResultError, diff --git a/src/platforms/android/devices.ts b/src/platforms/android/devices.ts index f66c98d0a..6950cdc25 100644 --- a/src/platforms/android/devices.ts +++ b/src/platforms/android/devices.ts @@ -1,8 +1,8 @@ import { requireExecSuccess, runCmd, runCmdDetached, whichCmd } from '../../utils/exec.ts'; import type { ExecResult } from '../../utils/exec.ts'; import { sleep } from '../../utils/timeouts.ts'; -import { AppError, asAppError } from '../../kernel/errors.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import { AppError, asAppError } from '@agent-device/kernel/errors'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { Deadline, retryWithPolicy } from '../../utils/retry.ts'; import { resolveAndroidSerialAllowlist } from '../../utils/device-isolation.ts'; import { bootFailureHint, classifyBootFailure } from '../boot-diagnostics.ts'; diff --git a/src/platforms/android/fill-diagnostics.ts b/src/platforms/android/fill-diagnostics.ts index e8d18a52c..962bbaa0f 100644 --- a/src/platforms/android/fill-diagnostics.ts +++ b/src/platforms/android/fill-diagnostics.ts @@ -1,4 +1,4 @@ -import type { Rect } from '../../kernel/snapshot.ts'; +import type { Rect } from '@agent-device/kernel/snapshot'; export type AndroidFillVerificationNode = { text: string | null; diff --git a/src/platforms/android/fill-verification.ts b/src/platforms/android/fill-verification.ts index 4bdedb5ac..4f9eaf708 100644 --- a/src/platforms/android/fill-verification.ts +++ b/src/platforms/android/fill-verification.ts @@ -1,6 +1,6 @@ -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { emitDiagnostic } from '../../utils/diagnostics.ts'; -import type { Rect } from '../../kernel/snapshot.ts'; +import type { Rect } from '@agent-device/kernel/snapshot'; import { buildFillFailureDetails, isSensitiveFillDiagnosticNode, diff --git a/src/platforms/android/gesture-viewport.ts b/src/platforms/android/gesture-viewport.ts index 5f8b10b13..1131da493 100644 --- a/src/platforms/android/gesture-viewport.ts +++ b/src/platforms/android/gesture-viewport.ts @@ -1,5 +1,5 @@ -import { AppError } from '../../kernel/errors.ts'; -import type { Rect } from '../../kernel/snapshot.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { Rect } from '@agent-device/kernel/snapshot'; export function validateAndroidGestureViewport(viewport: Rect): Rect { if ( diff --git a/src/platforms/android/helper-package-install.ts b/src/platforms/android/helper-package-install.ts index beb4815db..8e887db0a 100644 --- a/src/platforms/android/helper-package-install.ts +++ b/src/platforms/android/helper-package-install.ts @@ -2,7 +2,7 @@ import crypto from 'node:crypto'; import fs from 'node:fs/promises'; import os from 'node:os'; import path from 'node:path'; -import { AppError, normalizeError } from '../../kernel/errors.ts'; +import { AppError, normalizeError } from '@agent-device/kernel/errors'; import { findProjectRoot, readVersion } from '../../utils/version.ts'; import { androidAdbResultError, diff --git a/src/platforms/android/ime-helper.ts b/src/platforms/android/ime-helper.ts index 531df3a1f..b41bf4be7 100644 --- a/src/platforms/android/ime-helper.ts +++ b/src/platforms/android/ime-helper.ts @@ -1,5 +1,5 @@ -import { AppError } from '../../kernel/errors.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { androidAdbResultError, type AndroidAdbExecutor } from './adb-executor.ts'; import { readAndroidHelperManifestInteger, diff --git a/src/platforms/android/ime-lifecycle.ts b/src/platforms/android/ime-lifecycle.ts index 77d2975e4..b296d9cb9 100644 --- a/src/platforms/android/ime-lifecycle.ts +++ b/src/platforms/android/ime-lifecycle.ts @@ -1,7 +1,7 @@ import fs from 'node:fs/promises'; import path from 'node:path'; -import type { DeviceInfo } from '../../kernel/device.ts'; -import { normalizeError } from '../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { normalizeError } from '@agent-device/kernel/errors'; import { emitDiagnostic } from '../../utils/diagnostics.ts'; import { runCmd } from '../../utils/exec.ts'; import { resolveAndroidAdbExecutor, resolveAndroidAdbProvider } from './adb-executor.ts'; diff --git a/src/platforms/android/input-actions.ts b/src/platforms/android/input-actions.ts index 3a4886ca9..cb7c28446 100644 --- a/src/platforms/android/input-actions.ts +++ b/src/platforms/android/input-actions.ts @@ -1,5 +1,5 @@ -import { AppError } from '../../kernel/errors.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { emitDiagnostic } from '../../utils/diagnostics.ts'; import type { DeviceRotation } from '../../contracts/device-rotation.ts'; import { buildGesturePlan, GESTURE_DURATION_MIN_MS } from '../../contracts/gesture-plan.ts'; diff --git a/src/platforms/android/instrumentation-helper.ts b/src/platforms/android/instrumentation-helper.ts index 7a0c4f78e..d828abe8b 100644 --- a/src/platforms/android/instrumentation-helper.ts +++ b/src/platforms/android/instrumentation-helper.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; // Shared primitives for the Android instrumentation helpers (snapshot + multi-touch). // Both helpers drive `am instrument -w` and parse the resulting diff --git a/src/platforms/android/logcat.ts b/src/platforms/android/logcat.ts index aa06328d0..09423701f 100644 --- a/src/platforms/android/logcat.ts +++ b/src/platforms/android/logcat.ts @@ -1,5 +1,5 @@ import fs from 'node:fs'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { androidAdbResultError, type AndroidAdbExecutor, diff --git a/src/platforms/android/notifications.ts b/src/platforms/android/notifications.ts index d60571cf3..800590428 100644 --- a/src/platforms/android/notifications.ts +++ b/src/platforms/android/notifications.ts @@ -1,5 +1,5 @@ -import { AppError } from '../../kernel/errors.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { runAndroidAdb } from './adb.ts'; type AndroidBroadcastPayload = { diff --git a/src/platforms/android/perf-frame-parser.ts b/src/platforms/android/perf-frame-parser.ts index 93a482da6..3017c37e9 100644 --- a/src/platforms/android/perf-frame-parser.ts +++ b/src/platforms/android/perf-frame-parser.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { roundPercent } from '../perf-utils.ts'; import { parseNumericToken } from './perf-parsing.ts'; import { diff --git a/src/platforms/android/perf-frame.ts b/src/platforms/android/perf-frame.ts index 56dc03963..77c25156f 100644 --- a/src/platforms/android/perf-frame.ts +++ b/src/platforms/android/perf-frame.ts @@ -1,5 +1,5 @@ -import type { DeviceInfo } from '../../kernel/device.ts'; -import { AppError } from '../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { resolveAndroidAdbExecutor, type AndroidAdbExecutor } from './adb-executor.ts'; import { parseAndroidFramePerfSample, type AndroidFramePerfSample } from './perf-frame-parser.ts'; diff --git a/src/platforms/android/perf-native-artifacts.ts b/src/platforms/android/perf-native-artifacts.ts index 287998d25..3f04bc684 100644 --- a/src/platforms/android/perf-native-artifacts.ts +++ b/src/platforms/android/perf-native-artifacts.ts @@ -1,7 +1,7 @@ import { promises as fs } from 'node:fs'; import path from 'node:path'; -import type { DeviceInfo } from '../../kernel/device.ts'; -import { AppError } from '../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { sleep } from '../../utils/timeouts.ts'; import type { AndroidAdbExecutor } from './adb-executor.ts'; import { resolveAndroidAdbExecutor } from './adb-executor.ts'; diff --git a/src/platforms/android/perf-native-errors.ts b/src/platforms/android/perf-native-errors.ts index a5a69dc1c..b29badd87 100644 --- a/src/platforms/android/perf-native-errors.ts +++ b/src/platforms/android/perf-native-errors.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { AndroidNativePerfKind } from './perf-native-types.ts'; export function annotateAndroidNativePerfError( diff --git a/src/platforms/android/perf-native-perfetto.ts b/src/platforms/android/perf-native-perfetto.ts index da6238f21..fed2ed5c9 100644 --- a/src/platforms/android/perf-native-perfetto.ts +++ b/src/platforms/android/perf-native-perfetto.ts @@ -1,5 +1,5 @@ -import type { DeviceInfo } from '../../kernel/device.ts'; -import { AppError } from '../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { resolveAndroidAdbExecutor, type AndroidAdbExecutor } from './adb-executor.ts'; import { buildAndroidNativeRemotePath, diff --git a/src/platforms/android/perf-native-process.ts b/src/platforms/android/perf-native-process.ts index 0c1dedfd1..f380918dd 100644 --- a/src/platforms/android/perf-native-process.ts +++ b/src/platforms/android/perf-native-process.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { AndroidAdbExecutor } from './adb-executor.ts'; import { buildAndroidNativeToolUnavailableHint } from './perf-native-errors.ts'; import { ANDROID_PERF_TIMEOUT_MS, type AndroidNativePerfKind } from './perf-native-types.ts'; diff --git a/src/platforms/android/perf-native-simpleperf.ts b/src/platforms/android/perf-native-simpleperf.ts index d66939cbf..e470a27c4 100644 --- a/src/platforms/android/perf-native-simpleperf.ts +++ b/src/platforms/android/perf-native-simpleperf.ts @@ -1,5 +1,5 @@ -import type { DeviceInfo } from '../../kernel/device.ts'; -import { AppError } from '../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { resolveAndroidAdbExecutor, type AndroidAdbExecutor } from './adb-executor.ts'; import { buildAndroidNativeRemotePath, diff --git a/src/platforms/android/perf-native-summary.ts b/src/platforms/android/perf-native-summary.ts index 72d0fc276..5a5d348a2 100644 --- a/src/platforms/android/perf-native-summary.ts +++ b/src/platforms/android/perf-native-summary.ts @@ -1,4 +1,4 @@ -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { sampleAndroidFramePerf } from './perf-frame.ts'; import type { AndroidNativePerfFrameHealthSummary, diff --git a/src/platforms/android/perf.ts b/src/platforms/android/perf.ts index c421bcd67..0effd7fb7 100644 --- a/src/platforms/android/perf.ts +++ b/src/platforms/android/perf.ts @@ -1,7 +1,7 @@ import { promises as fs } from 'node:fs'; import path from 'node:path'; -import type { DeviceInfo } from '../../kernel/device.ts'; -import { AppError } from '../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { requireExecSuccess } from '../../utils/exec.ts'; import { splitNonEmptyTrimmedLines } from '../../utils/parsing.ts'; import { diff --git a/src/platforms/android/screenshot.ts b/src/platforms/android/screenshot.ts index 85795c5b6..e5d2dd6b6 100644 --- a/src/platforms/android/screenshot.ts +++ b/src/platforms/android/screenshot.ts @@ -1,6 +1,6 @@ import { promises as fs } from 'node:fs'; -import { AppError } from '../../kernel/errors.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { runAndroidAdb, sleep } from './adb.ts'; // PNG file signature: 0x89 P N G \r \n 0x1A \n diff --git a/src/platforms/android/settings.ts b/src/platforms/android/settings.ts index 76371b7bb..872a11f1c 100644 --- a/src/platforms/android/settings.ts +++ b/src/platforms/android/settings.ts @@ -1,5 +1,5 @@ -import { AppError } from '../../kernel/errors.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { requireLocationCoordinates } from '../../utils/location-coordinates.ts'; import { summarizeCommandAttemptFailures, diff --git a/src/platforms/android/snapshot-helper-artifact.ts b/src/platforms/android/snapshot-helper-artifact.ts index 27de6c444..d091521d7 100644 --- a/src/platforms/android/snapshot-helper-artifact.ts +++ b/src/platforms/android/snapshot-helper-artifact.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { readAndroidHelperManifestInteger, readAndroidHelperManifestLiteral, diff --git a/src/platforms/android/snapshot-helper-capture.ts b/src/platforms/android/snapshot-helper-capture.ts index 6c668168b..8d5e7554c 100644 --- a/src/platforms/android/snapshot-helper-capture.ts +++ b/src/platforms/android/snapshot-helper-capture.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { execFailureDetails } from '../../utils/exec.ts'; import { parseInstrumentationRecords, diff --git a/src/platforms/android/snapshot-helper-install.ts b/src/platforms/android/snapshot-helper-install.ts index ada996675..b08c44b01 100644 --- a/src/platforms/android/snapshot-helper-install.ts +++ b/src/platforms/android/snapshot-helper-install.ts @@ -1,4 +1,4 @@ -import { asAppError, type AppError } from '../../kernel/errors.ts'; +import { asAppError, type AppError } from '@agent-device/kernel/errors'; import { readAndroidSnapshotHelperInstallOptions } from './snapshot-helper-artifact.ts'; import { inspectInstalledAndroidHelper, diff --git a/src/platforms/android/snapshot-helper-session.ts b/src/platforms/android/snapshot-helper-session.ts index d6062552a..a3ea61ddf 100644 --- a/src/platforms/android/snapshot-helper-session.ts +++ b/src/platforms/android/snapshot-helper-session.ts @@ -1,7 +1,7 @@ import net from 'node:net'; import type { AndroidAdbProcess } from './adb-executor.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; -import { AppError } from '../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { emitDiagnostic } from '../../utils/diagnostics.ts'; import { ANDROID_SNAPSHOT_HELPER_OUTPUT_FORMAT, diff --git a/src/platforms/android/snapshot.ts b/src/platforms/android/snapshot.ts index 6f49f5727..be0dd3598 100644 --- a/src/platforms/android/snapshot.ts +++ b/src/platforms/android/snapshot.ts @@ -5,16 +5,16 @@ import { normalizeError, toAppErrorCode, type NormalizedError, -} from '../../kernel/errors.ts'; +} from '@agent-device/kernel/errors'; import { emitDiagnostic, withDiagnosticTimer } from '../../utils/diagnostics.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { findProjectRoot, readVersion } from '../../utils/version.ts'; import { attachRefs, type HiddenContentHint, type RawSnapshotNode, type SnapshotOptions, -} from '../../kernel/snapshot.ts'; +} from '@agent-device/kernel/snapshot'; import { deriveMobileSnapshotHiddenContentHints } from '../../snapshot/mobile-snapshot-semantics.ts'; import { buildUiHierarchySnapshot, diff --git a/src/platforms/android/touch-executor.ts b/src/platforms/android/touch-executor.ts index 308755b83..f96658c2e 100644 --- a/src/platforms/android/touch-executor.ts +++ b/src/platforms/android/touch-executor.ts @@ -1,5 +1,5 @@ -import type { DeviceInfo } from '../../kernel/device.ts'; -import type { Rect } from '../../kernel/snapshot.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import type { Rect } from '@agent-device/kernel/snapshot'; import { resolveAndroidTouchProvider } from './adb-executor.ts'; import { executeAndroidTouchHelperPlan, readAndroidTouchHelperViewport } from './touch-helper.ts'; import { validateAndroidGestureViewport } from './gesture-viewport.ts'; diff --git a/src/platforms/android/touch-helper.ts b/src/platforms/android/touch-helper.ts index 7820cc092..6484090d1 100644 --- a/src/platforms/android/touch-helper.ts +++ b/src/platforms/android/touch-helper.ts @@ -1,7 +1,7 @@ import type { PointerTrajectory } from '../../contracts/gesture-plan.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; -import type { Rect } from '../../kernel/snapshot.ts'; -import { AppError } from '../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import type { Rect } from '@agent-device/kernel/snapshot'; +import { AppError } from '@agent-device/kernel/errors'; import { execFailureDetails } from '../../utils/exec.ts'; import { emitDiagnostic, withDiagnosticTimer } from '../../utils/diagnostics.ts'; import { resolveAndroidAdbProvider, type AndroidAdbExecutor } from './adb-executor.ts'; diff --git a/src/platforms/android/touch-plan.ts b/src/platforms/android/touch-plan.ts index cc87e86a3..c6c3ee422 100644 --- a/src/platforms/android/touch-plan.ts +++ b/src/platforms/android/touch-plan.ts @@ -1,5 +1,5 @@ import type { GesturePlan, PointerTrajectory } from '../../contracts/gesture-plan.ts'; -import type { Rect } from '../../kernel/snapshot.ts'; +import type { Rect } from '@agent-device/kernel/snapshot'; export type AndroidLongPressTouchPlan = { topology: 'single'; diff --git a/src/platforms/android/ui-hierarchy.ts b/src/platforms/android/ui-hierarchy.ts index 8d1675024..dc4eb5624 100644 --- a/src/platforms/android/ui-hierarchy.ts +++ b/src/platforms/android/ui-hierarchy.ts @@ -1,5 +1,5 @@ -import type { RawSnapshotNode, Rect, SnapshotOptions } from '../../kernel/snapshot.ts'; -import { parseBounds } from '../../utils/bounds.ts'; +import type { RawSnapshotNode, Rect, SnapshotOptions } from '@agent-device/kernel/snapshot'; +import { parseBounds } from '@agent-device/kernel/bounds'; import { isScrollableType } from '../../utils/scrollable.ts'; import { intersectArea } from '../../utils/screenshot-geometry.ts'; import { diff --git a/src/platforms/appearance.ts b/src/platforms/appearance.ts index 625c6abad..4363bc04d 100644 --- a/src/platforms/appearance.ts +++ b/src/platforms/appearance.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export type AppearanceAction = 'light' | 'dark' | 'toggle'; diff --git a/src/platforms/apple/__tests__/interactor-runner-provider.test.ts b/src/platforms/apple/__tests__/interactor-runner-provider.test.ts index 819941d0b..b4e1a7762 100644 --- a/src/platforms/apple/__tests__/interactor-runner-provider.test.ts +++ b/src/platforms/apple/__tests__/interactor-runner-provider.test.ts @@ -2,7 +2,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import { IOS_SIMULATOR } from '../../../__tests__/test-utils/index.ts'; import { createAppleInteractor } from '../interactor.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { GesturePlan } from '../../../contracts/gesture-plan-types.ts'; import type { Interactor, RunnerContext } from '../../../contracts/interactor-types.ts'; import type { diff --git a/src/platforms/apple/__tests__/screenshot-backend.test.ts b/src/platforms/apple/__tests__/screenshot-backend.test.ts index fe21b33bd..6cbc9569c 100644 --- a/src/platforms/apple/__tests__/screenshot-backend.test.ts +++ b/src/platforms/apple/__tests__/screenshot-backend.test.ts @@ -1,5 +1,5 @@ import { beforeEach, expect, test, vi } from 'vitest'; -import type { DeviceInfo } from '../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; vi.mock('../core/screenshot.ts', async (importOriginal) => { const actual = await importOriginal(); diff --git a/src/platforms/apple/__tests__/watchos-sentinel.test.ts b/src/platforms/apple/__tests__/watchos-sentinel.test.ts index 9d5064562..3f5b8f26a 100644 --- a/src/platforms/apple/__tests__/watchos-sentinel.test.ts +++ b/src/platforms/apple/__tests__/watchos-sentinel.test.ts @@ -1,8 +1,8 @@ import { test, expect } from 'vitest'; import { createAppleInteractor } from '../interactor.ts'; -import type { DeviceInfo } from '../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import type { RunnerContext } from '../../../contracts/interactor-types.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; // watchOS is an explicit unsupported sentinel: XCUITest cannot drive watchOS UI, // so a `appleOs: 'watchos'` device must be rejected at interactor creation (the diff --git a/src/platforms/apple/capabilities.ts b/src/platforms/apple/capabilities.ts index 4e54e5312..da2ea6b11 100644 --- a/src/platforms/apple/capabilities.ts +++ b/src/platforms/apple/capabilities.ts @@ -3,7 +3,7 @@ import { resolveDeviceAppleOs, type AppleOS, type DeviceInfo, -} from '../../kernel/device.ts'; +} from '@agent-device/kernel/device'; // --------------------------------------------------------------------------- // Per-`AppleOS` capability data table (ADR-0009 "per-AppleOS capability table"). diff --git a/src/platforms/apple/core/__tests__/app-launch-close.test.ts b/src/platforms/apple/core/__tests__/app-launch-close.test.ts index eafd776f5..0ba27eeaf 100644 --- a/src/platforms/apple/core/__tests__/app-launch-close.test.ts +++ b/src/platforms/apple/core/__tests__/app-launch-close.test.ts @@ -4,7 +4,7 @@ import { promises as fs } from 'node:fs'; import { test } from 'vitest'; import { IOS_DEVICE } from '../../../../__tests__/test-utils/index.ts'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { closeIosApp } from '../app-launch.ts'; import { createLocalAppleToolProvider, withAppleToolProvider } from '../tool-provider.ts'; diff --git a/src/platforms/apple/core/__tests__/app-resolution.test.ts b/src/platforms/apple/core/__tests__/app-resolution.test.ts index e3803ea77..d7103f1bc 100644 --- a/src/platforms/apple/core/__tests__/app-resolution.test.ts +++ b/src/platforms/apple/core/__tests__/app-resolution.test.ts @@ -6,7 +6,7 @@ const { mockRunSimctl } = vi.hoisted(() => ({ mockRunSimctl: vi.fn() })); vi.mock('../apps-simctl.ts', () => ({ runSimctl: mockRunSimctl })); import { findIosSimulatorInstalledApp } from '../app-resolution.ts'; -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; const bootedSimulator: DeviceInfo = { platform: 'apple', diff --git a/src/platforms/apple/core/__tests__/apple-core-stub-helpers.ts b/src/platforms/apple/core/__tests__/apple-core-stub-helpers.ts index 5d28779cb..55811d2b3 100644 --- a/src/platforms/apple/core/__tests__/apple-core-stub-helpers.ts +++ b/src/platforms/apple/core/__tests__/apple-core-stub-helpers.ts @@ -1,7 +1,7 @@ import { promises as fs } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; export const IOS_TEST_DEVICE: DeviceInfo = { platform: 'apple', diff --git a/src/platforms/apple/core/__tests__/apple-runner-platform.test.ts b/src/platforms/apple/core/__tests__/apple-runner-platform.test.ts index 93bbf740e..60dd518aa 100644 --- a/src/platforms/apple/core/__tests__/apple-runner-platform.test.ts +++ b/src/platforms/apple/core/__tests__/apple-runner-platform.test.ts @@ -6,7 +6,7 @@ import { resolveRunnerSdkName, resolveRunnerXctestrunHints, } from '../apple-runner-platform.ts'; -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; function iosSim(overrides: Partial = {}): DeviceInfo { return { diff --git a/src/platforms/apple/core/__tests__/apps.test.ts b/src/platforms/apple/core/__tests__/apps.test.ts index bfc221f20..613c38095 100644 --- a/src/platforms/apple/core/__tests__/apps.test.ts +++ b/src/platforms/apple/core/__tests__/apps.test.ts @@ -42,8 +42,8 @@ import { withMockedMacOsHelper } from './macos-helper-test-utils.ts'; import { quitMacOsApp, resolveMacOsHelperPackageRootFrom } from '../../os/macos/helper.ts'; import { ensureBootedSimulator } from '../simulator.ts'; import { IOS_DEVICE_INSTALL_TIMEOUT_MS, IOS_SIMULATOR_TERMINATE_TIMEOUT_MS } from '../config.ts'; -import type { DeviceInfo } from '../../../../kernel/device.ts'; -import { AppError } from '../../../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { runCmd } from '../../../../utils/exec.ts'; import { retryWithPolicy } from '../../../../utils/retry.ts'; import { PNG } from '../../../../utils/png.ts'; diff --git a/src/platforms/apple/core/__tests__/debug-symbols.test.ts b/src/platforms/apple/core/__tests__/debug-symbols.test.ts index 8ca94a231..f6cb0f214 100644 --- a/src/platforms/apple/core/__tests__/debug-symbols.test.ts +++ b/src/platforms/apple/core/__tests__/debug-symbols.test.ts @@ -4,7 +4,7 @@ import os from 'node:os'; import path from 'node:path'; import { test } from 'vitest'; import { symbolicateCrashArtifact } from '../debug-symbols.ts'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { withCommandExecutorOverride } from '../../../../utils/exec.ts'; const UUID = 'ABCDEFAB-CDEF-ABCD-EFAB-CDEFABCDEFAB'; diff --git a/src/platforms/apple/core/__tests__/devices.test.ts b/src/platforms/apple/core/__tests__/devices.test.ts index f935e2de5..a5979c429 100644 --- a/src/platforms/apple/core/__tests__/devices.test.ts +++ b/src/platforms/apple/core/__tests__/devices.test.ts @@ -1,4 +1,4 @@ -import { isIosFamily } from '../../../../kernel/device.ts'; +import { isIosFamily } from '@agent-device/kernel/device'; import { beforeEach, test } from 'vitest'; import assert from 'node:assert/strict'; import { promises as fs } from 'node:fs'; diff --git a/src/platforms/apple/core/__tests__/interactions.test.ts b/src/platforms/apple/core/__tests__/interactions.test.ts index 3fcca5da4..789446b96 100644 --- a/src/platforms/apple/core/__tests__/interactions.test.ts +++ b/src/platforms/apple/core/__tests__/interactions.test.ts @@ -2,7 +2,7 @@ import { beforeEach, test, vi } from 'vitest'; import assert from 'node:assert/strict'; import { iosRunnerOverrides, performGestureApple } from '../../interactions.ts'; import { runAppleRunnerCommand } from '../runner/runner-client.ts'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { GesturePlan } from '../../../../contracts/gesture-plan.ts'; import { requireGestureSupported } from '../../../../core/capabilities.ts'; import { diff --git a/src/platforms/apple/core/__tests__/launch-diagnostics.test.ts b/src/platforms/apple/core/__tests__/launch-diagnostics.test.ts index 57c28c1cc..12c5c59a8 100644 --- a/src/platforms/apple/core/__tests__/launch-diagnostics.test.ts +++ b/src/platforms/apple/core/__tests__/launch-diagnostics.test.ts @@ -5,7 +5,7 @@ import { classifyLaunchFailure, launchFailureHint, } from '../launch-diagnostics.ts'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; test('isSimulatorLaunchFBSError identifies FBS code=4 errors', () => { const error = new AppError('COMMAND_FAILED', 'xcrun exited with code 4', { diff --git a/src/platforms/apple/core/__tests__/perf.test.ts b/src/platforms/apple/core/__tests__/perf.test.ts index c96793ea2..b427d9789 100644 --- a/src/platforms/apple/core/__tests__/perf.test.ts +++ b/src/platforms/apple/core/__tests__/perf.test.ts @@ -28,8 +28,8 @@ import { } from '../perf-xctrace.ts'; import { parseAppleFramePerfSample } from '../perf-frame.ts'; import { runCmd, runCmdBackground } from '../../../../utils/exec.ts'; -import type { DeviceInfo } from '../../../../kernel/device.ts'; -import { AppError } from '../../../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; const mockRunCmd = vi.mocked(runCmd); const mockRunCmdBackground = vi.mocked(runCmdBackground); diff --git a/src/platforms/apple/core/__tests__/physical-device-control.test.ts b/src/platforms/apple/core/__tests__/physical-device-control.test.ts index 9d88f36fd..1e401fce7 100644 --- a/src/platforms/apple/core/__tests__/physical-device-control.test.ts +++ b/src/platforms/apple/core/__tests__/physical-device-control.test.ts @@ -4,7 +4,7 @@ import os from 'node:os'; import path from 'node:path'; import { test } from 'vitest'; import { IOS_DEVICE as SHARED_IOS_DEVICE } from '../../../../__tests__/test-utils/index.ts'; -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { createAppleInteractor } from '../../interactor.ts'; import { installIosApp } from '../app-install.ts'; import { closeIosApp, openIosApp } from '../app-launch.ts'; diff --git a/src/platforms/apple/core/__tests__/physical-device-screenshot.test.ts b/src/platforms/apple/core/__tests__/physical-device-screenshot.test.ts index 62b823568..ff2c764a3 100644 --- a/src/platforms/apple/core/__tests__/physical-device-screenshot.test.ts +++ b/src/platforms/apple/core/__tests__/physical-device-screenshot.test.ts @@ -1,7 +1,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { shouldFallbackToRunnerForIosScreenshot } from '../physical-device-screenshot.ts'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; test('shouldFallbackToRunnerForIosScreenshot detects removed devicectl subcommand output', () => { const error = new AppError('COMMAND_FAILED', 'Failed to capture iOS screenshot', { diff --git a/src/platforms/apple/core/__tests__/runner-adoption.test.ts b/src/platforms/apple/core/__tests__/runner-adoption.test.ts index 51d3c00f3..7905dec2c 100644 --- a/src/platforms/apple/core/__tests__/runner-adoption.test.ts +++ b/src/platforms/apple/core/__tests__/runner-adoption.test.ts @@ -2,7 +2,7 @@ import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { afterEach, beforeEach, expect, test, vi } from 'vitest'; -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { buildDetachedRunnerLease, buildRunnerLease, diff --git a/src/platforms/apple/core/__tests__/runner-cache-probe.test.ts b/src/platforms/apple/core/__tests__/runner-cache-probe.test.ts index 0a7c0e83f..018c120ef 100644 --- a/src/platforms/apple/core/__tests__/runner-cache-probe.test.ts +++ b/src/platforms/apple/core/__tests__/runner-cache-probe.test.ts @@ -12,7 +12,7 @@ vi.mock('../../../../utils/exec.ts', async () => { return { ...actual, runCmdSync: mockRunCmdSync }; }); -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { hasCachedAppleRunnerArtifact } from '../runner/runner-xctestrun.ts'; const simulator: DeviceInfo = { diff --git a/src/platforms/apple/core/__tests__/runner-client-relaunch.test.ts b/src/platforms/apple/core/__tests__/runner-client-relaunch.test.ts index a1b3aed05..c367b2c41 100644 --- a/src/platforms/apple/core/__tests__/runner-client-relaunch.test.ts +++ b/src/platforms/apple/core/__tests__/runner-client-relaunch.test.ts @@ -10,7 +10,7 @@ vi.mock('../runner/runner-session.ts', async (importOriginal) => ({ stopIosRunnerSession: mockStopIosRunnerSession, })); -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { type AppleRunnerCommandExecutor, withAppleRunnerProvider, diff --git a/src/platforms/apple/core/__tests__/runner-client.test.ts b/src/platforms/apple/core/__tests__/runner-client.test.ts index 23a91e996..78ad7e56a 100644 --- a/src/platforms/apple/core/__tests__/runner-client.test.ts +++ b/src/platforms/apple/core/__tests__/runner-client.test.ts @@ -39,7 +39,7 @@ vi.mock('../../../../utils/host-process.ts', async (importOriginal) => { return { ...actual, readProcessStartTime: vi.fn(() => 'test-process-start') }; }); -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { type RequestProgressEvent, withRequestProgressSink, @@ -49,7 +49,7 @@ import { flushDiagnosticsToSessionFile, withDiagnosticsScope, } from '../../../../utils/diagnostics.ts'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { isReadOnlyRunnerCommand } from '../runner/runner-command-traits.ts'; import { isRetryableRunnerError, diff --git a/src/platforms/apple/core/__tests__/runner-command-retry.test.ts b/src/platforms/apple/core/__tests__/runner-command-retry.test.ts index 6a22bdd5f..c03a61dc2 100644 --- a/src/platforms/apple/core/__tests__/runner-command-retry.test.ts +++ b/src/platforms/apple/core/__tests__/runner-command-retry.test.ts @@ -2,7 +2,7 @@ import { beforeEach, test, vi } from 'vitest'; import assert from 'node:assert/strict'; import { IOS_SIMULATOR } from '../../../../__tests__/test-utils/index.ts'; import { clearRequestCanceled, markRequestCanceled } from '../../../../request/cancel.ts'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { Deadline } from '../../../../utils/retry.ts'; import type { RunnerSession } from '../runner/runner-session-types.ts'; diff --git a/src/platforms/apple/core/__tests__/runner-recycle-ledger.test.ts b/src/platforms/apple/core/__tests__/runner-recycle-ledger.test.ts index 4bfdaf987..c8d7f1c37 100644 --- a/src/platforms/apple/core/__tests__/runner-recycle-ledger.test.ts +++ b/src/platforms/apple/core/__tests__/runner-recycle-ledger.test.ts @@ -1,6 +1,6 @@ import { beforeEach, test } from 'vitest'; import assert from 'node:assert/strict'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { buildRunnerRecycleBudgetExhaustedError, commitRunnerRecycle, diff --git a/src/platforms/apple/core/__tests__/runner-sequence.test.ts b/src/platforms/apple/core/__tests__/runner-sequence.test.ts index 031b06c0b..807d8805d 100644 --- a/src/platforms/apple/core/__tests__/runner-sequence.test.ts +++ b/src/platforms/apple/core/__tests__/runner-sequence.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { MAX_RUNNER_SEQUENCE_STEPS, SEQUENCEABLE_RUNNER_STEP_KINDS, diff --git a/src/platforms/apple/core/__tests__/runner-session.test.ts b/src/platforms/apple/core/__tests__/runner-session.test.ts index aa102a3b1..a401e900c 100644 --- a/src/platforms/apple/core/__tests__/runner-session.test.ts +++ b/src/platforms/apple/core/__tests__/runner-session.test.ts @@ -9,7 +9,7 @@ import { type RequestProgressEvent, withRequestProgressSink, } from '../../../../request/progress.ts'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { flushDiagnosticsToSessionFile, withDiagnosticsScope, diff --git a/src/platforms/apple/core/__tests__/runner-transport.test.ts b/src/platforms/apple/core/__tests__/runner-transport.test.ts index 084c617bc..86c4399d3 100644 --- a/src/platforms/apple/core/__tests__/runner-transport.test.ts +++ b/src/platforms/apple/core/__tests__/runner-transport.test.ts @@ -1,9 +1,9 @@ import fs from 'node:fs'; import { afterEach, beforeEach, test, vi } from 'vitest'; import assert from 'node:assert/strict'; -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import type { ExecBackgroundResult } from '../../../../utils/exec.ts'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { RunnerSession } from '../runner/runner-session-types.ts'; const { mockRunCmd, mockUsbmuxPostCommand } = vi.hoisted(() => ({ diff --git a/src/platforms/apple/core/__tests__/runner-xctestrun.test.ts b/src/platforms/apple/core/__tests__/runner-xctestrun.test.ts index b3f01f922..bf7d16462 100644 --- a/src/platforms/apple/core/__tests__/runner-xctestrun.test.ts +++ b/src/platforms/apple/core/__tests__/runner-xctestrun.test.ts @@ -22,7 +22,7 @@ vi.mock('../../../../utils/exec.ts', async () => { return { ...actual, runCmdSync: mockRunCmdSync }; }); -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { withCommandExecutorOverride } from '../../../../utils/exec.ts'; import { findXctestrun, scoreXctestrunCandidate } from '../runner/runner-artifact.ts'; import { resolveXcodebuildSimulatorDeviceSetPath } from '../runner/runner-device-set.ts'; diff --git a/src/platforms/apple/core/__tests__/screenshot-density.test.ts b/src/platforms/apple/core/__tests__/screenshot-density.test.ts index 5726239c3..131fc625e 100644 --- a/src/platforms/apple/core/__tests__/screenshot-density.test.ts +++ b/src/platforms/apple/core/__tests__/screenshot-density.test.ts @@ -3,7 +3,7 @@ import assert from 'node:assert/strict'; import { promises as fs } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { PNG } from '../../../../utils/png.ts'; import { screenshotIos } from '../screenshot.ts'; import { createLocalAppleToolProvider, withAppleToolProvider } from '../tool-provider.ts'; diff --git a/src/platforms/apple/core/__tests__/screenshot.test.ts b/src/platforms/apple/core/__tests__/screenshot.test.ts index 33dd1a7dc..b2f96cae3 100644 --- a/src/platforms/apple/core/__tests__/screenshot.test.ts +++ b/src/platforms/apple/core/__tests__/screenshot.test.ts @@ -57,7 +57,7 @@ import { ensureBootedSimulator, openIosSimulatorApp } from '../simulator.ts'; import { prepareSimulatorStatusBarForScreenshot } from '../screenshot-status-bar.ts'; import { runAppleRunnerCommand } from '../runner/runner-client.ts'; import { withDiagnosticsScope } from '../../../../utils/diagnostics.ts'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { runCmd } from '../../../../utils/exec.ts'; import { retryWithPolicy } from '../../../../utils/retry.ts'; import { IOS_TEST_SIMULATOR, MACOS_TEST_DEVICE } from './apple-core-stub-helpers.ts'; diff --git a/src/platforms/apple/core/__tests__/simctl.test.ts b/src/platforms/apple/core/__tests__/simctl.test.ts index e3fb3730c..cc37aa8a6 100644 --- a/src/platforms/apple/core/__tests__/simctl.test.ts +++ b/src/platforms/apple/core/__tests__/simctl.test.ts @@ -1,7 +1,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { buildSimctlArgs, buildSimctlArgsForDevice } from '../simctl.ts'; -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; const IOS_SIMULATOR: DeviceInfo = { platform: 'apple', diff --git a/src/platforms/apple/core/__tests__/simulator-booted-memo.test.ts b/src/platforms/apple/core/__tests__/simulator-booted-memo.test.ts index c2192b17f..d37abdeef 100644 --- a/src/platforms/apple/core/__tests__/simulator-booted-memo.test.ts +++ b/src/platforms/apple/core/__tests__/simulator-booted-memo.test.ts @@ -1,5 +1,5 @@ import { afterEach, beforeEach, expect, test, vi } from 'vitest'; -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { ensureBootedSimulator, markSimulatorBooted, diff --git a/src/platforms/apple/core/__tests__/simulator.test.ts b/src/platforms/apple/core/__tests__/simulator.test.ts index 0419c4b99..719589d6d 100644 --- a/src/platforms/apple/core/__tests__/simulator.test.ts +++ b/src/platforms/apple/core/__tests__/simulator.test.ts @@ -2,7 +2,7 @@ import { beforeEach, test, vi } from 'vitest'; import assert from 'node:assert/strict'; import { ensureBootedSimulator, openIosSimulatorApp } from '../simulator.ts'; import { IOS_SIMULATOR_FOCUS_TIMEOUT_MS } from '../config.ts'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { runCmd } from '../../../../utils/exec.ts'; import { IOS_TEST_SIMULATOR } from './apple-core-stub-helpers.ts'; diff --git a/src/platforms/apple/core/app-device-io.ts b/src/platforms/apple/core/app-device-io.ts index 8c3e008ee..ea9e70376 100644 --- a/src/platforms/apple/core/app-device-io.ts +++ b/src/platforms/apple/core/app-device-io.ts @@ -1,7 +1,7 @@ import { promises as fs } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import { isMacOs, type DeviceInfo } from '../../../kernel/device.ts'; +import { isMacOs, type DeviceInfo } from '@agent-device/kernel/device'; import { requireExecSuccess } from '../../../utils/exec.ts'; import { ensureBootedSimulator, requireSimulatorDevice } from './simulator.ts'; import { readMacOsClipboardText, writeMacOsClipboardText } from '../os/macos/apps.ts'; diff --git a/src/platforms/apple/core/app-install.ts b/src/platforms/apple/core/app-install.ts index e87d55bc1..df54c2ade 100644 --- a/src/platforms/apple/core/app-install.ts +++ b/src/platforms/apple/core/app-install.ts @@ -1,5 +1,5 @@ -import type { DeviceInfo } from '../../../kernel/device.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { execFailureDetails } from '../../../utils/exec.ts'; import { prepareIosInstallArtifact } from './install-artifact.ts'; import { ensureBootedSimulator } from './simulator.ts'; diff --git a/src/platforms/apple/core/app-launch.ts b/src/platforms/apple/core/app-launch.ts index 5b9c60f4f..cae20e6c6 100644 --- a/src/platforms/apple/core/app-launch.ts +++ b/src/platforms/apple/core/app-launch.ts @@ -1,7 +1,7 @@ import { promises as fs } from 'node:fs'; import path from 'node:path'; -import { isIosFamily, isMacOs, type DeviceInfo } from '../../../kernel/device.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { isIosFamily, isMacOs, type DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { emitDiagnostic } from '../../../utils/diagnostics.ts'; import { execFailureDetails } from '../../../utils/exec.ts'; import { diff --git a/src/platforms/apple/core/app-resolution.ts b/src/platforms/apple/core/app-resolution.ts index 93466392b..ec52e594e 100644 --- a/src/platforms/apple/core/app-resolution.ts +++ b/src/platforms/apple/core/app-resolution.ts @@ -1,7 +1,7 @@ import path from 'node:path'; import { fileURLToPath } from 'node:url'; -import { isIosFamily, isMacOs, type DeviceInfo } from '../../../kernel/device.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { isIosFamily, isMacOs, type DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import type { AppsFilter } from '../../../contracts/app-inventory.ts'; import { createAppResolutionCache, diff --git a/src/platforms/apple/core/app-settings.ts b/src/platforms/apple/core/app-settings.ts index 7069125dd..4ed9b4dec 100644 --- a/src/platforms/apple/core/app-settings.ts +++ b/src/platforms/apple/core/app-settings.ts @@ -1,7 +1,7 @@ import { promises as fs } from 'node:fs'; import path from 'node:path'; -import { isIosFamily, isMacOs, type DeviceInfo } from '../../../kernel/device.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { isIosFamily, isMacOs, type DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { requireLocationCoordinates } from '../../../utils/location-coordinates.ts'; import { requireExecSuccess } from '../../../utils/exec.ts'; import { resolveIosSimulatorDeviceSetPath } from '../../../utils/device-isolation.ts'; diff --git a/src/platforms/apple/core/apple-runner-platform.ts b/src/platforms/apple/core/apple-runner-platform.ts index 0fec985d8..481547af7 100644 --- a/src/platforms/apple/core/apple-runner-platform.ts +++ b/src/platforms/apple/core/apple-runner-platform.ts @@ -1,10 +1,10 @@ -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { isMacOs, isApplePlatform, resolveApplePlatformName, type DeviceInfo, -} from '../../../kernel/device.ts'; +} from '@agent-device/kernel/device'; export type RunnerApplePlatformName = 'iOS' | 'tvOS' | 'macOS' | 'visionOS'; diff --git a/src/platforms/apple/core/apps-simctl.ts b/src/platforms/apple/core/apps-simctl.ts index 0ab04784f..c5e0d04ab 100644 --- a/src/platforms/apple/core/apps-simctl.ts +++ b/src/platforms/apple/core/apps-simctl.ts @@ -1,4 +1,4 @@ -import type { DeviceInfo } from '../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { buildSimctlArgsForDevice } from './simctl.ts'; import { runXcrun } from './tool-provider.ts'; diff --git a/src/platforms/apple/core/debug-symbols.ts b/src/platforms/apple/core/debug-symbols.ts index b8e6326ec..eade8afbc 100644 --- a/src/platforms/apple/core/debug-symbols.ts +++ b/src/platforms/apple/core/debug-symbols.ts @@ -5,7 +5,7 @@ import { matchImagesToDsyms, readDsymPaths, readDsymSlices } from './debug-symbo import { summarizeCrashArtifact } from './debug-symbols/report.ts'; import { resolveAppleTools, symbolicateAddresses } from './debug-symbols/symbolication.ts'; import type { DebugSymbolsOptions, DebugSymbolsResult } from '../../../contracts/debug-symbols.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; const MAX_CRASH_ARTIFACT_BYTES = 64 * 1024 * 1024; diff --git a/src/platforms/apple/core/debug-symbols/dsym.ts b/src/platforms/apple/core/debug-symbols/dsym.ts index 5c5d71b6a..331727ace 100644 --- a/src/platforms/apple/core/debug-symbols/dsym.ts +++ b/src/platforms/apple/core/debug-symbols/dsym.ts @@ -3,7 +3,7 @@ import path from 'node:path'; import type { AppleImage, DsymMatch, DsymSlice } from './types.ts'; import { normalizeUuid, unique } from './utils.ts'; import { requireExecSuccess, runCmd } from '../../../../utils/exec.ts'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; const MAX_SEARCH_ENTRIES = 10_000; const MAX_DSYM_CANDIDATES = 200; diff --git a/src/platforms/apple/core/debug-symbols/symbolication.ts b/src/platforms/apple/core/debug-symbols/symbolication.ts index fc889f9a3..1045b703b 100644 --- a/src/platforms/apple/core/debug-symbols/symbolication.ts +++ b/src/platforms/apple/core/debug-symbols/symbolication.ts @@ -1,7 +1,7 @@ import type { DsymMatch, SymbolicatedAddress, SymbolicationGroup } from './types.ts'; import { addressKey, hex, unique } from './utils.ts'; import { requireExecSuccess, runCmd } from '../../../../utils/exec.ts'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export async function symbolicateAddresses( addresses: SymbolicatedAddress[], diff --git a/src/platforms/apple/core/debug-symbols/utils.ts b/src/platforms/apple/core/debug-symbols/utils.ts index 26cfc8744..bba3ab3ed 100644 --- a/src/platforms/apple/core/debug-symbols/utils.ts +++ b/src/platforms/apple/core/debug-symbols/utils.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { isRecord } from '../../../../utils/parsing.ts'; const UUID_RE = /^[0-9a-fA-F-]{32,36}$/; diff --git a/src/platforms/apple/core/devicectl.ts b/src/platforms/apple/core/devicectl.ts index bfa0cc50e..b6254dec3 100644 --- a/src/platforms/apple/core/devicectl.ts +++ b/src/platforms/apple/core/devicectl.ts @@ -2,8 +2,8 @@ import { promises as fs } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import type { DeviceInfo } from '../../../kernel/device.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { execFailureDetails } from '../../../utils/exec.ts'; import { IOS_DEVICECTL_TIMEOUT_MS } from './config.ts'; diff --git a/src/platforms/apple/core/devices.ts b/src/platforms/apple/core/devices.ts index 3979be3c7..b74ee7b8b 100644 --- a/src/platforms/apple/core/devices.ts +++ b/src/platforms/apple/core/devices.ts @@ -1,14 +1,14 @@ import { promises as fs } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { isIosFamily, sortAppleDevicesForSelection, type AppleOS, type DeviceInfo, type DeviceTarget, -} from '../../../kernel/device.ts'; +} from '@agent-device/kernel/device'; import { resolveIosSimulatorDeviceSetPath } from '../../../utils/device-isolation.ts'; import { buildHostMacDevice } from '../os/macos/devices.ts'; import { buildSimctlArgs } from './simctl.ts'; diff --git a/src/platforms/apple/core/install-artifact.ts b/src/platforms/apple/core/install-artifact.ts index b8fce5745..30c2bcf49 100644 --- a/src/platforms/apple/core/install-artifact.ts +++ b/src/platforms/apple/core/install-artifact.ts @@ -2,7 +2,7 @@ import { promises as fs } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { readInfoPlistString } from './plist.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { runCmd } from '../../../utils/exec.ts'; import { isTrustedInstallSourceUrl, diff --git a/src/platforms/apple/core/launch-diagnostics.ts b/src/platforms/apple/core/launch-diagnostics.ts index e0fe48c78..076ed32a1 100644 --- a/src/platforms/apple/core/launch-diagnostics.ts +++ b/src/platforms/apple/core/launch-diagnostics.ts @@ -1,5 +1,5 @@ -import { AppError } from '../../../kernel/errors.ts'; -import type { DeviceInfo } from '../../../kernel/device.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { buildSimctlArgsForDevice } from './simctl.ts'; import { runAppleToolCommand, runXcrun } from './tool-provider.ts'; diff --git a/src/platforms/apple/core/perf-xctrace.ts b/src/platforms/apple/core/perf-xctrace.ts index 95eccbc14..1445e0dcc 100644 --- a/src/platforms/apple/core/perf-xctrace.ts +++ b/src/platforms/apple/core/perf-xctrace.ts @@ -8,8 +8,8 @@ import { publicPlatformString, type DeviceInfo, type PublicPlatform, -} from '../../../kernel/device.ts'; -import { AppError } from '../../../kernel/errors.ts'; +} from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { execFailureDetails, requireExecSuccess, @@ -17,7 +17,7 @@ import { type ExecBackgroundResult, type ExecResult, } from '../../../utils/exec.ts'; -import { uniqueStrings } from '../../../kernel/collections.ts'; +import { uniqueStrings } from '@agent-device/kernel/collections'; import { findAllXmlNodes } from './perf-xml.ts'; import { isRetryableIosDeviceTraceRecordFailure, diff --git a/src/platforms/apple/core/perf.ts b/src/platforms/apple/core/perf.ts index a8f2653e5..969c342e2 100644 --- a/src/platforms/apple/core/perf.ts +++ b/src/platforms/apple/core/perf.ts @@ -8,12 +8,12 @@ import { publicPlatformString, type DeviceInfo, type PublicPlatform, -} from '../../../kernel/device.ts'; -import { AppError } from '../../../kernel/errors.ts'; +} from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { execFailureDetails, requireExecSuccess, type ExecResult } from '../../../utils/exec.ts'; import { splitNonEmptyTrimmedLines } from '../../../utils/parsing.ts'; import { roundPercent } from '../../perf-utils.ts'; -import { uniqueStrings } from '../../../kernel/collections.ts'; +import { uniqueStrings } from '@agent-device/kernel/collections'; import { IOS_DEVICECTL_DEFAULT_HINT, resolveIosDevicectlHint } from './devicectl.ts'; import type { IosDeviceProcessInfo } from './app-info.ts'; import { resolveIosPhysicalDeviceControl } from './physical-device-control.ts'; diff --git a/src/platforms/apple/core/physical-device-apps.ts b/src/platforms/apple/core/physical-device-apps.ts index bbbb478d8..0f98cb825 100644 --- a/src/platforms/apple/core/physical-device-apps.ts +++ b/src/platforms/apple/core/physical-device-apps.ts @@ -1,5 +1,5 @@ import type { AppsFilter } from '../../../contracts/app-inventory.ts'; -import type { DeviceInfo } from '../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { IOS_DEVICE_INSTALL_TIMEOUT_MS } from './config.ts'; import { listIosDeviceApps, diff --git a/src/platforms/apple/core/physical-device-control.ts b/src/platforms/apple/core/physical-device-control.ts index 0a1994e67..31a815fcb 100644 --- a/src/platforms/apple/core/physical-device-control.ts +++ b/src/platforms/apple/core/physical-device-control.ts @@ -1,5 +1,5 @@ -import type { DeviceInfo } from '../../../kernel/device.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { execFailureDetails } from '../../../utils/exec.ts'; import type { AppsFilter } from '../../../contracts/app-inventory.ts'; import type { IosAppInfo, IosDeviceAppProcesses } from './app-info.ts'; diff --git a/src/platforms/apple/core/physical-device-coredevice.ts b/src/platforms/apple/core/physical-device-coredevice.ts index 6784c57f3..5d538424c 100644 --- a/src/platforms/apple/core/physical-device-coredevice.ts +++ b/src/platforms/apple/core/physical-device-coredevice.ts @@ -1,8 +1,8 @@ import { promises as fs } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import type { DeviceInfo } from '../../../kernel/device.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { execFailureDetails } from '../../../utils/exec.ts'; import { IOS_DEVICECTL_DEFAULT_HINT, diff --git a/src/platforms/apple/core/physical-device-files.ts b/src/platforms/apple/core/physical-device-files.ts index b1ddb86a5..fc9d1284f 100644 --- a/src/platforms/apple/core/physical-device-files.ts +++ b/src/platforms/apple/core/physical-device-files.ts @@ -1,5 +1,5 @@ -import type { DeviceInfo } from '../../../kernel/device.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { Deadline } from '../../../utils/retry.ts'; import { IOS_RUNNER_SCREENSHOT_COPY_TIMEOUT_MS } from './config.ts'; import { IOS_RUNNER_CONTAINER_BUNDLE_IDS } from './runner/runner-cache-metadata.ts'; diff --git a/src/platforms/apple/core/physical-device-screenshot.ts b/src/platforms/apple/core/physical-device-screenshot.ts index fbf8697a1..00363fe2e 100644 --- a/src/platforms/apple/core/physical-device-screenshot.ts +++ b/src/platforms/apple/core/physical-device-screenshot.ts @@ -1,6 +1,6 @@ import { promises as fs } from 'node:fs'; -import type { DeviceInfo } from '../../../kernel/device.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { emitDiagnostic } from '../../../utils/diagnostics.ts'; import { runIosDevicectl } from './devicectl.ts'; import { copyCoreDeviceRunnerFile } from './physical-device-files.ts'; diff --git a/src/platforms/apple/core/runner/runner-adoption.ts b/src/platforms/apple/core/runner/runner-adoption.ts index 4350aa55f..b503a0ffb 100644 --- a/src/platforms/apple/core/runner/runner-adoption.ts +++ b/src/platforms/apple/core/runner/runner-adoption.ts @@ -3,7 +3,7 @@ import { resolveIosSimulatorDeviceSetPath } from '../../../../utils/device-isola import { emitDiagnostic } from '../../../../utils/diagnostics.ts'; import { isProcessAlive } from '../../../../utils/host-process.ts'; import { parseBooleanLiteral } from '../../../../utils/source-value.ts'; -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import type { ExecResult } from '../../../../utils/exec.ts'; import { sendRunnerCommandOnce } from './runner-transport.ts'; import { withRunnerCommandId } from './runner-contract.ts'; diff --git a/src/platforms/apple/core/runner/runner-artifact-env.ts b/src/platforms/apple/core/runner/runner-artifact-env.ts index 7b276e8d2..a6925a02a 100644 --- a/src/platforms/apple/core/runner/runner-artifact-env.ts +++ b/src/platforms/apple/core/runner/runner-artifact-env.ts @@ -1,6 +1,6 @@ import fs from 'node:fs'; import path from 'node:path'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { DefinedEnvMap as EnvMap } from '../../../../utils/env-map.ts'; import { requireExecSuccess } from '../../../../utils/exec.ts'; import { runAppleToolCommand } from '../tool-provider.ts'; diff --git a/src/platforms/apple/core/runner/runner-artifact.ts b/src/platforms/apple/core/runner/runner-artifact.ts index 0fd896758..0c27dc702 100644 --- a/src/platforms/apple/core/runner/runner-artifact.ts +++ b/src/platforms/apple/core/runner/runner-artifact.ts @@ -2,9 +2,9 @@ import fs from 'node:fs'; import crypto from 'node:crypto'; import os from 'node:os'; import path from 'node:path'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { runCmdStreaming, type ExecBackgroundResult } from '../../../../utils/exec.ts'; -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { withKeyedLock } from '../../../../utils/keyed-lock.ts'; import { isRequestCanceledError } from '../../../../request/cancel.ts'; import { emitRequestProgress } from '../../../../request/progress.ts'; diff --git a/src/platforms/apple/core/runner/runner-cache-metadata.ts b/src/platforms/apple/core/runner/runner-cache-metadata.ts index 140774c6e..2f4442b9c 100644 --- a/src/platforms/apple/core/runner/runner-cache-metadata.ts +++ b/src/platforms/apple/core/runner/runner-cache-metadata.ts @@ -2,7 +2,7 @@ import crypto from 'node:crypto'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import { isMacOs, type DeviceInfo } from '../../../../kernel/device.ts'; +import { isMacOs, type DeviceInfo } from '@agent-device/kernel/device'; import { runCmdSync } from '../../../../utils/exec.ts'; import { isEnvTruthy } from '../../../../utils/retry.ts'; import { createTtlMemo } from '../../../../utils/ttl-memo.ts'; diff --git a/src/platforms/apple/core/runner/runner-cache.ts b/src/platforms/apple/core/runner/runner-cache.ts index 832577abc..035920aad 100644 --- a/src/platforms/apple/core/runner/runner-cache.ts +++ b/src/platforms/apple/core/runner/runner-cache.ts @@ -1,6 +1,6 @@ import fs from 'node:fs'; import path from 'node:path'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { emitDiagnostic } from '../../../../utils/diagnostics.ts'; import { readProcessStartTime } from '../../../../utils/host-process.ts'; import { acquireProcessLock, type ProcessLockOwner } from '../../../../utils/process-lock.ts'; diff --git a/src/platforms/apple/core/runner/runner-client.ts b/src/platforms/apple/core/runner/runner-client.ts index bac49df78..cb80decfe 100644 --- a/src/platforms/apple/core/runner/runner-client.ts +++ b/src/platforms/apple/core/runner/runner-client.ts @@ -1,5 +1,5 @@ import { retryWithPolicy } from '../../../../utils/retry.ts'; -import { isIosFamily, type DeviceInfo } from '../../../../kernel/device.ts'; +import { isIosFamily, type DeviceInfo } from '@agent-device/kernel/device'; import { emitDiagnostic } from '../../../../utils/diagnostics.ts'; import { stopIosRunnerSession, diff --git a/src/platforms/apple/core/runner/runner-command-recovery.ts b/src/platforms/apple/core/runner/runner-command-recovery.ts index 2c99d1e26..ccdea3a36 100644 --- a/src/platforms/apple/core/runner/runner-command-recovery.ts +++ b/src/platforms/apple/core/runner/runner-command-recovery.ts @@ -1,5 +1,5 @@ -import { AppError, toAppErrorCode } from '../../../../kernel/errors.ts'; -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import { AppError, toAppErrorCode } from '@agent-device/kernel/errors'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { emitDiagnostic } from '../../../../utils/diagnostics.ts'; import type { RunnerCommand } from './runner-contract.ts'; import { isReadOnlyRunnerCommand } from './runner-command-traits.ts'; diff --git a/src/platforms/apple/core/runner/runner-command-route.ts b/src/platforms/apple/core/runner/runner-command-route.ts index d850e440b..8b64be4fc 100644 --- a/src/platforms/apple/core/runner/runner-command-route.ts +++ b/src/platforms/apple/core/runner/runner-command-route.ts @@ -1,4 +1,4 @@ -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { resolveIosPhysicalDeviceControl } from '../physical-device-control.ts'; const RUNNER_DEVICE_TUNNEL_IP_CACHE_TTL_MS = 30_000; diff --git a/src/platforms/apple/core/runner/runner-contract.ts b/src/platforms/apple/core/runner/runner-contract.ts index 437e667a8..181926bb9 100644 --- a/src/platforms/apple/core/runner/runner-contract.ts +++ b/src/platforms/apple/core/runner/runner-contract.ts @@ -1,5 +1,5 @@ import crypto from 'node:crypto'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { ClickButton } from '../../../../contracts/click-button.ts'; import type { DeviceRotation } from '../../../../contracts/device-rotation.ts'; import type { ScrollDirection } from '../../../../contracts/scroll-gesture.ts'; diff --git a/src/platforms/apple/core/runner/runner-device-set.ts b/src/platforms/apple/core/runner/runner-device-set.ts index 39a3c27c9..1f790c434 100644 --- a/src/platforms/apple/core/runner/runner-device-set.ts +++ b/src/platforms/apple/core/runner/runner-device-set.ts @@ -1,8 +1,8 @@ import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import { AppError } from '../../../../kernel/errors.ts'; -import { isIosFamily, type DeviceInfo } from '../../../../kernel/device.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import { isIosFamily, type DeviceInfo } from '@agent-device/kernel/device'; import { resolveIosSimulatorDeviceSetPath } from '../../../../utils/device-isolation.ts'; import { emitDiagnostic } from '../../../../utils/diagnostics.ts'; import { readProcessStartTime } from '../../../../utils/host-process.ts'; diff --git a/src/platforms/apple/core/runner/runner-disposal.ts b/src/platforms/apple/core/runner/runner-disposal.ts index f6d95cf9d..36b35cbf0 100644 --- a/src/platforms/apple/core/runner/runner-disposal.ts +++ b/src/platforms/apple/core/runner/runner-disposal.ts @@ -1,5 +1,5 @@ import { emitDiagnostic } from '../../../../utils/diagnostics.ts'; -import { isMacOs, type DeviceInfo } from '../../../../kernel/device.ts'; +import { isMacOs, type DeviceInfo } from '@agent-device/kernel/device'; import { isProcessAlive, isProcessGroupAlive, diff --git a/src/platforms/apple/core/runner/runner-failure-diagnostics.ts b/src/platforms/apple/core/runner/runner-failure-diagnostics.ts index c0a9619e2..1369cac27 100644 --- a/src/platforms/apple/core/runner/runner-failure-diagnostics.ts +++ b/src/platforms/apple/core/runner/runner-failure-diagnostics.ts @@ -1,6 +1,6 @@ import fs from 'node:fs/promises'; import type { FileHandle } from 'node:fs/promises'; -import { AppError, type AppErrorCode } from '../../../../kernel/errors.ts'; +import { AppError, type AppErrorCode } from '@agent-device/kernel/errors'; const RUNNER_LOG_TAIL_BYTES = 64 * 1024; diff --git a/src/platforms/apple/core/runner/runner-io.ts b/src/platforms/apple/core/runner/runner-io.ts index 1c1094a47..a4e3798ea 100644 --- a/src/platforms/apple/core/runner/runner-io.ts +++ b/src/platforms/apple/core/runner/runner-io.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; import net from 'node:net'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export async function getFreePort(): Promise { return await new Promise((resolve, reject) => { diff --git a/src/platforms/apple/core/runner/runner-lease.ts b/src/platforms/apple/core/runner/runner-lease.ts index d9b316ede..944eca83f 100644 --- a/src/platforms/apple/core/runner/runner-lease.ts +++ b/src/platforms/apple/core/runner/runner-lease.ts @@ -3,7 +3,7 @@ import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { emitDiagnostic } from '../../../../utils/diagnostics.ts'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { acquireProcessLock } from '../../../../utils/process-lock.ts'; import { readProcessStartTime } from '../../../../utils/host-process.ts'; import { classifyOwnerLiveness } from '../../../../utils/owner-identity.ts'; diff --git a/src/platforms/apple/core/runner/runner-lifecycle.ts b/src/platforms/apple/core/runner/runner-lifecycle.ts index a259c0fd4..dedab8555 100644 --- a/src/platforms/apple/core/runner/runner-lifecycle.ts +++ b/src/platforms/apple/core/runner/runner-lifecycle.ts @@ -1,5 +1,5 @@ -import { AppError, asAppError } from '../../../../kernel/errors.ts'; -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import { AppError, asAppError } from '@agent-device/kernel/errors'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { emitDiagnostic } from '../../../../utils/diagnostics.ts'; import { getRequestSignal, isRequestCanceledError } from '../../../../request/cancel.ts'; import { RUNNER_COMMAND_TIMEOUT_MS, RUNNER_STARTUP_TIMEOUT_MS } from './runner-transport.ts'; diff --git a/src/platforms/apple/core/runner/runner-macos-products.ts b/src/platforms/apple/core/runner/runner-macos-products.ts index fd35078ef..b3e177df2 100644 --- a/src/platforms/apple/core/runner/runner-macos-products.ts +++ b/src/platforms/apple/core/runner/runner-macos-products.ts @@ -1,6 +1,6 @@ import fs from 'node:fs'; -import { isMacOs, type DeviceInfo } from '../../../../kernel/device.ts'; -import { AppError, asAppError } from '../../../../kernel/errors.ts'; +import { isMacOs, type DeviceInfo } from '@agent-device/kernel/device'; +import { AppError, asAppError } from '@agent-device/kernel/errors'; import { runAppleToolCommand } from '../tool-provider.ts'; const RUNNER_PRODUCT_REPAIR_FAILURE_REASONS = new Set([ diff --git a/src/platforms/apple/core/runner/runner-provider.ts b/src/platforms/apple/core/runner/runner-provider.ts index ee5a79273..7f2f5a3c5 100644 --- a/src/platforms/apple/core/runner/runner-provider.ts +++ b/src/platforms/apple/core/runner/runner-provider.ts @@ -1,6 +1,6 @@ import { AsyncLocalStorage } from 'node:async_hooks'; import type { RunnerLogicalLeaseContext } from '../../../../contracts/runner-lease-context.ts'; -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import type { Deadline } from '../../../../utils/retry.ts'; import type { RunnerCommand } from './runner-contract.ts'; import type { diff --git a/src/platforms/apple/core/runner/runner-recycle-ledger.ts b/src/platforms/apple/core/runner/runner-recycle-ledger.ts index 1499baaab..e970c7f06 100644 --- a/src/platforms/apple/core/runner/runner-recycle-ledger.ts +++ b/src/platforms/apple/core/runner/runner-recycle-ledger.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { emitDiagnostic } from '../../../../utils/diagnostics.ts'; import type { RunnerCommand } from './runner-contract.ts'; diff --git a/src/platforms/apple/core/runner/runner-sequence.ts b/src/platforms/apple/core/runner/runner-sequence.ts index 2d5311c52..2938a1c7b 100644 --- a/src/platforms/apple/core/runner/runner-sequence.ts +++ b/src/platforms/apple/core/runner/runner-sequence.ts @@ -1,4 +1,4 @@ -import { AppError, toAppErrorCode } from '../../../../kernel/errors.ts'; +import { AppError, toAppErrorCode } from '@agent-device/kernel/errors'; import type { RunnerCommand, RunnerSequenceStep } from './runner-contract.ts'; export const SEQUENCEABLE_RUNNER_STEP_KINDS = ['tap', 'doubleTap', 'longPress'] as const; diff --git a/src/platforms/apple/core/runner/runner-session-types.ts b/src/platforms/apple/core/runner/runner-session-types.ts index 8d141ba47..9886c1ae1 100644 --- a/src/platforms/apple/core/runner/runner-session-types.ts +++ b/src/platforms/apple/core/runner/runner-session-types.ts @@ -1,6 +1,6 @@ import type { RunnerLogicalLeaseContext } from '../../../../contracts/runner-lease-context.ts'; import type { ExecResult } from '../../../../utils/exec.ts'; -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import type { RunnerXctestrunArtifact } from './runner-xctestrun.ts'; import type { RunnerLease } from './runner-lease.ts'; diff --git a/src/platforms/apple/core/runner/runner-session.ts b/src/platforms/apple/core/runner/runner-session.ts index 28da5efb5..a01818bb6 100644 --- a/src/platforms/apple/core/runner/runner-session.ts +++ b/src/platforms/apple/core/runner/runner-session.ts @@ -1,4 +1,4 @@ -import { AppError, toAppErrorCode } from '../../../../kernel/errors.ts'; +import { AppError, toAppErrorCode } from '@agent-device/kernel/errors'; import { runCmdBackground, type ExecResult, @@ -6,7 +6,7 @@ import { } from '../../../../utils/exec.ts'; import { withKeyedLock } from '../../../../utils/keyed-lock.ts'; import { Deadline } from '../../../../utils/retry.ts'; -import { isIosFamily, isApplePlatform, type DeviceInfo } from '../../../../kernel/device.ts'; +import { isIosFamily, isApplePlatform, type DeviceInfo } from '@agent-device/kernel/device'; import type { RunnerLogicalLeaseContext } from '../../../../contracts/runner-lease-context.ts'; import type { AppleRunnerLifecycleOptions } from './runner-provider.ts'; import { emitRequestProgress } from '../../../../request/progress.ts'; diff --git a/src/platforms/apple/core/runner/runner-transport.ts b/src/platforms/apple/core/runner/runner-transport.ts index a413d5c9c..30182e311 100644 --- a/src/platforms/apple/core/runner/runner-transport.ts +++ b/src/platforms/apple/core/runner/runner-transport.ts @@ -1,8 +1,8 @@ import { createRequestCanceledError, isRequestCanceledError } from '../../../../request/cancel.ts'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { requireExecSuccess } from '../../../../utils/exec.ts'; import { Deadline, retryWithPolicy } from '../../../../utils/retry.ts'; -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { classifyBootFailure, bootFailureHint } from '../../../boot-diagnostics.ts'; import { buildSimctlArgsForDevice } from '../simctl.ts'; import { runXcrun } from '../tool-provider.ts'; diff --git a/src/platforms/apple/core/runner/runner-usbmux-protocol.ts b/src/platforms/apple/core/runner/runner-usbmux-protocol.ts index e938bd461..c5ebb93c1 100644 --- a/src/platforms/apple/core/runner/runner-usbmux-protocol.ts +++ b/src/platforms/apple/core/runner/runner-usbmux-protocol.ts @@ -1,5 +1,5 @@ import net, { type Socket } from 'node:net'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { createRequestCanceledError } from '../../../../request/cancel.ts'; import { Deadline } from '../../../../utils/retry.ts'; import { parseXmlDocumentSync, type XmlNode } from '../../../../utils/xml.ts'; diff --git a/src/platforms/apple/core/runner/runner-usbmux.ts b/src/platforms/apple/core/runner/runner-usbmux.ts index 676d5a8b1..06839073e 100644 --- a/src/platforms/apple/core/runner/runner-usbmux.ts +++ b/src/platforms/apple/core/runner/runner-usbmux.ts @@ -1,6 +1,6 @@ import http, { type IncomingMessage } from 'node:http'; import { type Socket } from 'node:net'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { createRequestCanceledError } from '../../../../request/cancel.ts'; import { Deadline } from '../../../../utils/retry.ts'; import type { RunnerCommand } from './runner-contract.ts'; diff --git a/src/platforms/apple/core/screenshot-status-bar.ts b/src/platforms/apple/core/screenshot-status-bar.ts index 67cc3e13a..096a0de42 100644 --- a/src/platforms/apple/core/screenshot-status-bar.ts +++ b/src/platforms/apple/core/screenshot-status-bar.ts @@ -1,6 +1,6 @@ -import type { DeviceInfo } from '../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { emitDiagnostic } from '../../../utils/diagnostics.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { requireExecSuccess, type ExecOptions } from '../../../utils/exec.ts'; import { runSimctlForDevice } from './simctl.ts'; import { extractAppleToolErrorMeta } from './tool-diagnostics.ts'; diff --git a/src/platforms/apple/core/screenshot.ts b/src/platforms/apple/core/screenshot.ts index aac88709d..6abe60350 100644 --- a/src/platforms/apple/core/screenshot.ts +++ b/src/platforms/apple/core/screenshot.ts @@ -1,8 +1,8 @@ import { promises as fs } from 'node:fs'; import path from 'node:path'; -import { isMacOs, type DeviceInfo } from '../../../kernel/device.ts'; +import { isMacOs, type DeviceInfo } from '@agent-device/kernel/device'; import { emitDiagnostic } from '../../../utils/diagnostics.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { ExecOptions } from '../../../utils/exec.ts'; import { resizePngFile } from '../../../utils/png-resize.ts'; import { readPngSize } from '../../../utils/png-size.ts'; diff --git a/src/platforms/apple/core/simctl.ts b/src/platforms/apple/core/simctl.ts index 5b4ef78cb..91c2052f4 100644 --- a/src/platforms/apple/core/simctl.ts +++ b/src/platforms/apple/core/simctl.ts @@ -1,4 +1,4 @@ -import { isIosFamily, type DeviceInfo } from '../../../kernel/device.ts'; +import { isIosFamily, type DeviceInfo } from '@agent-device/kernel/device'; import type { ExecOptions, ExecResult } from '../../../utils/exec.ts'; import { resolveIosSimulatorDeviceSetPath } from '../../../utils/device-isolation.ts'; import { runXcrun } from './tool-provider.ts'; diff --git a/src/platforms/apple/core/simulator.ts b/src/platforms/apple/core/simulator.ts index 2403588de..0d6cecf0b 100644 --- a/src/platforms/apple/core/simulator.ts +++ b/src/platforms/apple/core/simulator.ts @@ -1,5 +1,5 @@ -import type { DeviceInfo } from '../../../kernel/device.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { execFailureDetails, requireExecSuccess } from '../../../utils/exec.ts'; import { Deadline, retryWithPolicy } from '../../../utils/retry.ts'; import { createTtlMemo } from '../../../utils/ttl-memo.ts'; diff --git a/src/platforms/apple/core/tool-diagnostics.ts b/src/platforms/apple/core/tool-diagnostics.ts index 05853d568..a4fde3717 100644 --- a/src/platforms/apple/core/tool-diagnostics.ts +++ b/src/platforms/apple/core/tool-diagnostics.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export function extractAppleToolErrorMeta(error: unknown): Record { if (!(error instanceof AppError)) { diff --git a/src/platforms/apple/interactions.ts b/src/platforms/apple/interactions.ts index 1ccb9b6c9..873f2c38c 100644 --- a/src/platforms/apple/interactions.ts +++ b/src/platforms/apple/interactions.ts @@ -1,10 +1,10 @@ -import { isIosFamily, isMacOs, isTvOsDevice, type DeviceInfo } from '../../kernel/device.ts'; +import { isIosFamily, isMacOs, isTvOsDevice, type DeviceInfo } from '@agent-device/kernel/device'; import { assertScrollGestureInput, type ScrollDirection } from '../../contracts/scroll-gesture.ts'; import { normalizeScrollDurationMs, SCROLL_DURATION_MAX_MS, } from '../../contracts/scroll-command.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { singlePointerPlanEndpoints, type GesturePlan } from '../../contracts/gesture-plan.ts'; import { assertAppleMultiTouchSupported } from '../../contracts/apple-multitouch-support.ts'; import { runAppleRunnerCommand } from './core/runner/runner-client.ts'; diff --git a/src/platforms/apple/interactor.ts b/src/platforms/apple/interactor.ts index 04ab7f9fd..62a64c487 100644 --- a/src/platforms/apple/interactor.ts +++ b/src/platforms/apple/interactor.ts @@ -20,10 +20,10 @@ import { import { toAppleTvRemoteButton } from '../../contracts/tv-remote.ts'; import { DEVICE_ROTATIONS, type DeviceRotation } from '../../contracts/device-rotation.ts'; import { withDiagnosticTimer } from '../../utils/diagnostics.ts'; -import { isMacOs, isTvOsDevice, type DeviceInfo } from '../../kernel/device.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { isMacOs, isTvOsDevice, type DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { withMethodScope } from '../../utils/method-scope.ts'; -import type { RawSnapshotNode } from '../../kernel/snapshot.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; import type { Interactor, RunnerCallOptions, diff --git a/src/platforms/apple/os/macos/apps.ts b/src/platforms/apple/os/macos/apps.ts index afccfe25d..87be00ad6 100644 --- a/src/platforms/apple/os/macos/apps.ts +++ b/src/platforms/apple/os/macos/apps.ts @@ -1,7 +1,7 @@ import type { AppsFilter } from '../../../../contracts/app-inventory.ts'; import { isDeepLinkTarget } from '../../../../contracts/open-target.ts'; -import type { DeviceInfo } from '../../../../kernel/device.ts'; -import { AppError } from '../../../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { parseAppearanceAction } from '../../../appearance.ts'; import { createAppResolutionCache, diff --git a/src/platforms/apple/os/macos/audio-probe.ts b/src/platforms/apple/os/macos/audio-probe.ts index 714a21aaf..1007ba7bd 100644 --- a/src/platforms/apple/os/macos/audio-probe.ts +++ b/src/platforms/apple/os/macos/audio-probe.ts @@ -1,4 +1,4 @@ -import { isIosFamily, type DeviceInfo } from '../../../../kernel/device.ts'; +import { isIosFamily, type DeviceInfo } from '@agent-device/kernel/device'; import type { HostAudioProbeBackend } from '../../../audio-probe-backend.ts'; import { startMacOsAudioProbeProcess } from './helper.ts'; diff --git a/src/platforms/apple/os/macos/desktop-scroll.ts b/src/platforms/apple/os/macos/desktop-scroll.ts index dc1b37654..5c6a05e1e 100644 --- a/src/platforms/apple/os/macos/desktop-scroll.ts +++ b/src/platforms/apple/os/macos/desktop-scroll.ts @@ -1,4 +1,4 @@ -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import type { RunnerCallOptions, RunnerContext } from '../../../../contracts/interactor-types.ts'; import type { ScrollDirection } from '../../../../contracts/scroll-gesture.ts'; import type { RunnerCommand } from '../../core/runner/runner-contract.ts'; diff --git a/src/platforms/apple/os/macos/devices.ts b/src/platforms/apple/os/macos/devices.ts index 6df117fd7..354c2a58e 100644 --- a/src/platforms/apple/os/macos/devices.ts +++ b/src/platforms/apple/os/macos/devices.ts @@ -1,5 +1,5 @@ import os from 'node:os'; -import type { DeviceInfo } from '../../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; const HOST_MAC_DEVICE_ID = 'host-macos-local'; diff --git a/src/platforms/apple/os/macos/helper.ts b/src/platforms/apple/os/macos/helper.ts index e98ee0e1b..9e1ac2830 100644 --- a/src/platforms/apple/os/macos/helper.ts +++ b/src/platforms/apple/os/macos/helper.ts @@ -3,7 +3,7 @@ import { createHash } from 'node:crypto'; import os from 'node:os'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { resolveExecutableOverridePath, runCmdBackground, diff --git a/src/platforms/apple/os/macos/host-provider.ts b/src/platforms/apple/os/macos/host-provider.ts index 860ac6464..66c65c923 100644 --- a/src/platforms/apple/os/macos/host-provider.ts +++ b/src/platforms/apple/os/macos/host-provider.ts @@ -2,7 +2,7 @@ import { promises as fs } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import type { AppsFilter } from '../../../../contracts/app-inventory.ts'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { requireExecSuccess } from '../../../../utils/exec.ts'; import { filterAppleAppsByBundlePrefix } from '../../core/app-filter.ts'; import type { IosAppInfo } from '../../core/app-info.ts'; diff --git a/src/platforms/apple/plugin.ts b/src/platforms/apple/plugin.ts index cfd291d33..81bea527b 100644 --- a/src/platforms/apple/plugin.ts +++ b/src/platforms/apple/plugin.ts @@ -11,7 +11,7 @@ import { isTvOsDevice, resolveDeviceAppleOs, type DeviceInfo, -} from '../../kernel/device.ts'; +} from '@agent-device/kernel/device'; import type { RunnerContext } from '../../contracts/interactor-types.ts'; // --------------------------------------------------------------------------- diff --git a/src/platforms/audio-probe-backend.ts b/src/platforms/audio-probe-backend.ts index d52436e0f..9e9ea2a46 100644 --- a/src/platforms/audio-probe-backend.ts +++ b/src/platforms/audio-probe-backend.ts @@ -1,6 +1,6 @@ import type { AudioProbeSource } from '../contracts/audio-probe-result.ts'; import { isHostSystemAudioProbeDevice } from '../contracts/audio-probe-support.ts'; -import type { DeviceInfo } from '../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import type { ExecBackgroundResult } from '../utils/exec.ts'; export type HostAudioProbeStartOptions = { diff --git a/src/platforms/boot-diagnostics.ts b/src/platforms/boot-diagnostics.ts index ec64b4e2c..8d81d5749 100644 --- a/src/platforms/boot-diagnostics.ts +++ b/src/platforms/boot-diagnostics.ts @@ -1,4 +1,4 @@ -import { asAppError } from '../kernel/errors.ts'; +import { asAppError } from '@agent-device/kernel/errors'; export type BootFailureReason = | 'IOS_BOOT_TIMEOUT' diff --git a/src/platforms/install-source.ts b/src/platforms/install-source.ts index ffcaf33e1..91a4feef9 100644 --- a/src/platforms/install-source.ts +++ b/src/platforms/install-source.ts @@ -5,7 +5,7 @@ import os from 'node:os'; import path from 'node:path'; import { Readable } from 'node:stream'; import { pipeline } from 'node:stream/promises'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { runCmd } from '../utils/exec.ts'; import { expandUserHomePath } from '../utils/path-resolution.ts'; diff --git a/src/platforms/linux/__tests__/atspi-bridge.test.ts b/src/platforms/linux/__tests__/atspi-bridge.test.ts index 87e0fa07d..16f30ed05 100644 --- a/src/platforms/linux/__tests__/atspi-bridge.test.ts +++ b/src/platforms/linux/__tests__/atspi-bridge.test.ts @@ -8,7 +8,7 @@ vi.mock('../../../utils/exec.ts', async (importOriginal) => { import { captureAccessibilityTree } from '../atspi-bridge.ts'; import { runCmd, whichCmd } from '../../../utils/exec.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; const mockRunCmd = vi.mocked(runCmd); const mockWhichCmd = vi.mocked(whichCmd); diff --git a/src/platforms/linux/__tests__/clipboard.test.ts b/src/platforms/linux/__tests__/clipboard.test.ts index 0e81a1589..2712c1c9a 100644 --- a/src/platforms/linux/__tests__/clipboard.test.ts +++ b/src/platforms/linux/__tests__/clipboard.test.ts @@ -8,7 +8,7 @@ vi.mock('../../../utils/exec.ts', async (importOriginal) => { import { runCmd, whichCmd } from '../../../utils/exec.ts'; import { readLinuxClipboard, writeLinuxClipboard } from '../clipboard.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; const mockRunCmd = vi.mocked(runCmd); const mockWhichCmd = vi.mocked(whichCmd); diff --git a/src/platforms/linux/accessibility-types.ts b/src/platforms/linux/accessibility-types.ts index 804e8a0d6..69e23f4a3 100644 --- a/src/platforms/linux/accessibility-types.ts +++ b/src/platforms/linux/accessibility-types.ts @@ -1,4 +1,4 @@ -import type { RawSnapshotNode } from '../../kernel/snapshot.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; export type LinuxSnapshotSurface = 'desktop' | 'frontmost-app'; diff --git a/src/platforms/linux/atspi-bridge.ts b/src/platforms/linux/atspi-bridge.ts index e0b45ea92..22ed0ec43 100644 --- a/src/platforms/linux/atspi-bridge.ts +++ b/src/platforms/linux/atspi-bridge.ts @@ -11,8 +11,8 @@ import path from 'node:path'; import fs from 'node:fs'; import { fileURLToPath } from 'node:url'; -import { AppError } from '../../kernel/errors.ts'; -import type { RawSnapshotNode, Rect } from '../../kernel/snapshot.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { RawSnapshotNode, Rect } from '@agent-device/kernel/snapshot'; import { normalizeAtspiRole } from './role-map.ts'; import { resolveLinuxToolProvider, runLinuxToolCommand } from './tool-provider.ts'; import type { diff --git a/src/platforms/linux/devices.ts b/src/platforms/linux/devices.ts index 6068babfa..c090d16bc 100644 --- a/src/platforms/linux/devices.ts +++ b/src/platforms/linux/devices.ts @@ -1,5 +1,5 @@ import { hostname } from 'node:os'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; export async function listLinuxDevices(): Promise { if (process.platform !== 'linux') { diff --git a/src/platforms/linux/linux-env.ts b/src/platforms/linux/linux-env.ts index edfebcef8..dfa254f41 100644 --- a/src/platforms/linux/linux-env.ts +++ b/src/platforms/linux/linux-env.ts @@ -5,7 +5,7 @@ * (press, type, scroll…) does not re-run `which` on every call. */ -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { resolveLinuxToolProvider, type LinuxToolProvider } from './tool-provider.ts'; export type DisplayServer = 'wayland' | 'x11'; diff --git a/src/platforms/linux/snapshot.ts b/src/platforms/linux/snapshot.ts index 4706e2a4e..740eae653 100644 --- a/src/platforms/linux/snapshot.ts +++ b/src/platforms/linux/snapshot.ts @@ -1,4 +1,4 @@ -import type { RawSnapshotNode } from '../../kernel/snapshot.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; import { captureAccessibilityTree, type SnapshotSurface } from './atspi-bridge.ts'; import type { SessionSurface } from '../../contracts/session-surface.ts'; import { emitDiagnostic } from '../../utils/diagnostics.ts'; diff --git a/src/platforms/linux/tool-provider.ts b/src/platforms/linux/tool-provider.ts index 9ff330839..12c64cdd1 100644 --- a/src/platforms/linux/tool-provider.ts +++ b/src/platforms/linux/tool-provider.ts @@ -1,6 +1,6 @@ import { runCmd, whichCmd, type ExecOptions, type ExecResult } from '../../utils/exec.ts'; import { emitDiagnostic } from '../../utils/diagnostics.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { createScopedProvider } from '../../utils/scoped-provider.ts'; import { sleep } from '../../utils/timeouts.ts'; import type { ClickButton } from '../../contracts/click-button.ts'; diff --git a/src/platforms/permission-utils.ts b/src/platforms/permission-utils.ts index c02a07c00..666a16125 100644 --- a/src/platforms/permission-utils.ts +++ b/src/platforms/permission-utils.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export type PermissionAction = 'grant' | 'deny' | 'reset'; export type PermissionTarget = diff --git a/src/platforms/setting-state.ts b/src/platforms/setting-state.ts index 2729f381a..a94e0caa5 100644 --- a/src/platforms/setting-state.ts +++ b/src/platforms/setting-state.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export function parseSettingState(state: string): boolean { const normalized = state.toLowerCase(); diff --git a/src/platforms/unsupported-interactor.ts b/src/platforms/unsupported-interactor.ts index 45a3e556c..6be13604d 100644 --- a/src/platforms/unsupported-interactor.ts +++ b/src/platforms/unsupported-interactor.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { Interactor } from '../contracts/interactor-types.ts'; export function createUnsupportedInteractor(platformLabel: string): Interactor { diff --git a/src/platforms/vega/__tests__/devices.test.ts b/src/platforms/vega/__tests__/devices.test.ts index 80f09dda5..647be729d 100644 --- a/src/platforms/vega/__tests__/devices.test.ts +++ b/src/platforms/vega/__tests__/devices.test.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { listVegaDevices, parseVegaDeviceList } from '../devices.ts'; import { createLocalVegaToolProvider, withVegaToolProvider } from '../tool-provider.ts'; diff --git a/src/platforms/vega/__tests__/input-actions.test.ts b/src/platforms/vega/__tests__/input-actions.test.ts index df36998eb..bf77a91e7 100644 --- a/src/platforms/vega/__tests__/input-actions.test.ts +++ b/src/platforms/vega/__tests__/input-actions.test.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { pressVegaTvRemote } from '../input-actions.ts'; import { createLocalVegaToolProvider, withVegaToolProvider } from '../tool-provider.ts'; diff --git a/src/platforms/vega/__tests__/interactor.test.ts b/src/platforms/vega/__tests__/interactor.test.ts index 53d2d95dd..95644ccbe 100644 --- a/src/platforms/vega/__tests__/interactor.test.ts +++ b/src/platforms/vega/__tests__/interactor.test.ts @@ -1,8 +1,8 @@ import assert from 'node:assert/strict'; import { beforeEach, test, vi } from 'vitest'; import type { Interactor } from '../../../contracts/interactor-types.ts'; -import { AppError } from '../../../kernel/errors.ts'; -import type { DeviceInfo } from '../../../kernel/device.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { createVegaInteractor } from '../interactor.ts'; import { pressVegaTvRemote } from '../input-actions.ts'; import { closeVegaApp, openVegaApp, openVegaDevice } from '../app-lifecycle.ts'; diff --git a/src/platforms/vega/__tests__/plugin.test.ts b/src/platforms/vega/__tests__/plugin.test.ts index b9f03bc81..3f613b1da 100644 --- a/src/platforms/vega/__tests__/plugin.test.ts +++ b/src/platforms/vega/__tests__/plugin.test.ts @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import { beforeEach, test, vi } from 'vitest'; import { PUBLIC_COMMANDS } from '../../../command-catalog.ts'; -import type { DeviceInfo } from '../../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { listVegaDevices } from '../devices.ts'; import { vegaPlugin } from '../plugin.ts'; diff --git a/src/platforms/vega/app-lifecycle.ts b/src/platforms/vega/app-lifecycle.ts index 877cdbb63..67d734bff 100644 --- a/src/platforms/vega/app-lifecycle.ts +++ b/src/platforms/vega/app-lifecycle.ts @@ -1,4 +1,4 @@ -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { requireExecSuccess, type ExecOptions } from '../../utils/exec.ts'; import { resolveVegaToolProvider } from './tool-provider.ts'; diff --git a/src/platforms/vega/devices.ts b/src/platforms/vega/devices.ts index 02aacaff2..d35d0135d 100644 --- a/src/platforms/vega/devices.ts +++ b/src/platforms/vega/devices.ts @@ -1,5 +1,5 @@ -import { AppError } from '../../kernel/errors.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import { AppError } from '@agent-device/kernel/errors'; +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/vega/input-actions.ts b/src/platforms/vega/input-actions.ts index 485cd7a27..57aebd37f 100644 --- a/src/platforms/vega/input-actions.ts +++ b/src/platforms/vega/input-actions.ts @@ -1,5 +1,5 @@ import { toVegaTvRemoteKey, type TvRemoteButton } from '../../contracts/tv-remote.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +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/vega/interactor.ts b/src/platforms/vega/interactor.ts index c35546256..f46bbbaee 100644 --- a/src/platforms/vega/interactor.ts +++ b/src/platforms/vega/interactor.ts @@ -1,7 +1,7 @@ import { isDeepLinkTarget } from '../../contracts/open-target.ts'; import type { Interactor, RunnerContext } from '../../contracts/interactor-types.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; -import { AppError } from '../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import { createUnsupportedInteractor } from '../unsupported-interactor.ts'; import { closeVegaApp, openVegaApp, openVegaDevice } from './app-lifecycle.ts'; import { pressVegaTvRemote } from './input-actions.ts'; diff --git a/src/platforms/vega/plugin.ts b/src/platforms/vega/plugin.ts index 274a30ed0..f1bba3378 100644 --- a/src/platforms/vega/plugin.ts +++ b/src/platforms/vega/plugin.ts @@ -2,7 +2,7 @@ import { PUBLIC_COMMANDS } from '../../command-catalog.ts'; import type { DeviceInventoryRequest } from '../../contracts/device-inventory.ts'; import type { Interactor, RunnerContext } from '../../contracts/interactor-types.ts'; import type { PlatformPlugin } from '../../contracts/platform-plugin.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; const VEGA_VVD_ONLY_COMMANDS = [ PUBLIC_COMMANDS.open, diff --git a/src/platforms/web/agent-browser-provider.test.ts b/src/platforms/web/agent-browser-provider.test.ts index be7e74421..9a248e8ff 100644 --- a/src/platforms/web/agent-browser-provider.test.ts +++ b/src/platforms/web/agent-browser-provider.test.ts @@ -19,13 +19,13 @@ vi.mock('./agent-browser-lifecycle.ts', async (importOriginal) => { import { createAgentBrowserWebProvider } from './agent-browser-provider.ts'; import type { WebSnapshotResult } from './provider.ts'; import { withCommandExecutorOverride, type ExecResult } from '../../utils/exec.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { buildSelectorChainForNode, parseSelectorChain, resolveSelectorChain, } from '../../selectors/index.ts'; -import { attachRefs } from '../../kernel/snapshot.ts'; +import { attachRefs } from '@agent-device/kernel/snapshot'; import { installFakeManagedAgentBrowser } from './__tests__/test-utils.ts'; type AgentBrowserCall = { diff --git a/src/platforms/web/agent-browser-provider.ts b/src/platforms/web/agent-browser-provider.ts index 7cdca2876..81e1e0d7d 100644 --- a/src/platforms/web/agent-browser-provider.ts +++ b/src/platforms/web/agent-browser-provider.ts @@ -1,8 +1,8 @@ import { execFailureDetails, runCmd } from '../../utils/exec.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { emitDiagnostic } from '../../utils/diagnostics.ts'; import { sleep } from '../../utils/timeouts.ts'; -import type { Rect } from '../../kernel/snapshot.ts'; +import type { Rect } from '@agent-device/kernel/snapshot'; import { buildAudioProbeEvalScript, normalizeAgentBrowserAudioProbeResult, diff --git a/src/platforms/web/agent-browser-snapshot.ts b/src/platforms/web/agent-browser-snapshot.ts index a930cd931..525e2c265 100644 --- a/src/platforms/web/agent-browser-snapshot.ts +++ b/src/platforms/web/agent-browser-snapshot.ts @@ -1,4 +1,4 @@ -import type { RawSnapshotNode, Rect } from '../../kernel/snapshot.ts'; +import type { RawSnapshotNode, Rect } from '@agent-device/kernel/snapshot'; import { isJsonObject, readBooleanProperty, diff --git a/src/platforms/web/agent-browser-tool.test.ts b/src/platforms/web/agent-browser-tool.test.ts index ea25029d6..d1947c376 100644 --- a/src/platforms/web/agent-browser-tool.test.ts +++ b/src/platforms/web/agent-browser-tool.test.ts @@ -5,7 +5,7 @@ import path from 'node:path'; import { test } from 'vitest'; import { resolveAgentBrowserTool } from './agent-browser-tool.ts'; import { installFakeManagedAgentBrowser } from './__tests__/test-utils.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; test('managed agent-browser tool reports actionable guidance when install is missing', async () => { const stateDir = fs.mkdtempSync(path.join(os.tmpdir(), 'agent-device-web-tool-')); diff --git a/src/platforms/web/agent-browser-tool.ts b/src/platforms/web/agent-browser-tool.ts index acfee649d..3dac1e61e 100644 --- a/src/platforms/web/agent-browser-tool.ts +++ b/src/platforms/web/agent-browser-tool.ts @@ -3,7 +3,7 @@ import crypto from 'node:crypto'; import os from 'node:os'; import path from 'node:path'; import { runCmd } from '../../utils/exec.ts'; -import { AppError, asAppError } from '../../kernel/errors.ts'; +import { AppError, asAppError } from '@agent-device/kernel/errors'; import { acquireProcessLock } from '../../utils/process-lock.ts'; import { readProcessStartTime } from '../../utils/host-process.ts'; import { diff --git a/src/platforms/web/provider.ts b/src/platforms/web/provider.ts index df488d115..68a17db05 100644 --- a/src/platforms/web/provider.ts +++ b/src/platforms/web/provider.ts @@ -1,7 +1,7 @@ import type { ScrollDirection } from '../../contracts/scroll-gesture.ts'; import type { SessionSurface } from '../../contracts/session-surface.ts'; import { createScopedProvider } from '../../utils/scoped-provider.ts'; -import type { RawSnapshotNode } from '../../kernel/snapshot.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; import type { BackendDumpNetworkOptions, BackendDumpNetworkResult } from '../../backend.ts'; import type { AudioProbeResult } from '../../contracts/audio-probe-result.ts'; import { createAgentBrowserWebProvider } from './agent-browser-provider.ts'; diff --git a/src/provider-device-runtime.ts b/src/provider-device-runtime.ts index 9f8235fda..8b30a7fe1 100644 --- a/src/provider-device-runtime.ts +++ b/src/provider-device-runtime.ts @@ -16,8 +16,8 @@ import type { AppleRunnerCommandExecutor, AppleRunnerProvider, } from './platforms/apple/core/runner/runner-provider.ts'; -import { publicPlatformString, type DeviceInfo } from './kernel/device.ts'; -import { AppError } from './kernel/errors.ts'; +import { publicPlatformString, type DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; export type ProviderDeviceInstallResult = { bundleId?: string; diff --git a/src/providers/limrun/android.ts b/src/providers/limrun/android.ts index 1ecb30f6a..a872c4fa3 100644 --- a/src/providers/limrun/android.ts +++ b/src/providers/limrun/android.ts @@ -7,8 +7,8 @@ import { import { createAndroidInteractor } from '../../core/interactors/android.ts'; import type { Interactor } from '../../contracts/interactor-types.ts'; import type { DeviceLease } from '../../contracts/device-provider.ts'; -import { AppError } from '../../kernel/errors.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { type AndroidAdbExecutorOptions, type AndroidAdbExecutorResult, diff --git a/src/providers/limrun/device-session.test.ts b/src/providers/limrun/device-session.test.ts index dedd3cc96..1bb41b828 100644 --- a/src/providers/limrun/device-session.test.ts +++ b/src/providers/limrun/device-session.test.ts @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import { test, vi } from 'vitest'; import type { DeviceLease } from '../../contracts/device-provider.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import type { AndroidAdbExecutor, AndroidAdbProvider, diff --git a/src/providers/limrun/device-session.ts b/src/providers/limrun/device-session.ts index 6a4d12791..898533c87 100644 --- a/src/providers/limrun/device-session.ts +++ b/src/providers/limrun/device-session.ts @@ -1,6 +1,6 @@ import type { Interactor } from '../../contracts/interactor-types.ts'; import { resolveAppsFilter, type AppsFilter } from '../../contracts/app-inventory.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import type { AndroidAdbProvider } from '../../platforms/android/adb-executor.ts'; import type { AndroidKeyboardDismissResult, diff --git a/src/providers/limrun/device.ts b/src/providers/limrun/device.ts index 97fc7772a..a7d6011d7 100644 --- a/src/providers/limrun/device.ts +++ b/src/providers/limrun/device.ts @@ -1,5 +1,5 @@ import type { DeviceLease } from '../../contracts/device-provider.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; export type LimrunPlatform = 'ios' | 'android'; diff --git a/src/providers/limrun/ios.ts b/src/providers/limrun/ios.ts index 4c4b419db..e6b817200 100644 --- a/src/providers/limrun/ios.ts +++ b/src/providers/limrun/ios.ts @@ -14,8 +14,8 @@ import type { SnapshotResult, } from '../../contracts/interactor-types.ts'; import type { DeviceLease } from '../../contracts/device-provider.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; -import { AppError } from '../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import type { ProviderDeviceInstallOptions, ProviderDeviceInstallResult, diff --git a/src/providers/limrun/runtime.ts b/src/providers/limrun/runtime.ts index 6b0a66529..77e7f61ac 100644 --- a/src/providers/limrun/runtime.ts +++ b/src/providers/limrun/runtime.ts @@ -5,8 +5,8 @@ import type { DeviceLease, LeaseLifecycleProvider, } from '../../contracts/device-provider.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; -import { AppError } from '../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import type { ProviderDeviceInstallOptions, ProviderDeviceInstallResult, diff --git a/src/providers/limrun/snapshot.ts b/src/providers/limrun/snapshot.ts index fe65740f1..f896d6c46 100644 --- a/src/providers/limrun/snapshot.ts +++ b/src/providers/limrun/snapshot.ts @@ -1,6 +1,6 @@ import fs from 'node:fs'; import path from 'node:path'; -import type { RawSnapshotNode } from '../../kernel/snapshot.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; type LimrunSelector = { key: 'id' | 'label' | 'text' | 'value'; value: string }; diff --git a/src/recording/__tests__/overlay.test.ts b/src/recording/__tests__/overlay.test.ts index 348c9a634..da8c90881 100644 --- a/src/recording/__tests__/overlay.test.ts +++ b/src/recording/__tests__/overlay.test.ts @@ -32,7 +32,7 @@ import { overlayRecordingTouches, resizeRecording, } from '../overlay.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { runCmd } from '../../utils/exec.ts'; function helperScriptArgs(): string[] { diff --git a/src/recording/output-path.ts b/src/recording/output-path.ts index 60d6cc256..17cf1fc0b 100644 --- a/src/recording/output-path.ts +++ b/src/recording/output-path.ts @@ -1,5 +1,5 @@ import path from 'node:path'; -import type { Platform, PlatformSelector } from '../kernel/device.ts'; +import type { Platform, PlatformSelector } from '@agent-device/kernel/device'; const DEFAULT_RECORDING_EXTENSION = '.mp4'; export const WEB_RECORDING_EXTENSION = '.webm'; diff --git a/src/recording/overlay.ts b/src/recording/overlay.ts index 04fb6da0a..2d75241fc 100644 --- a/src/recording/overlay.ts +++ b/src/recording/overlay.ts @@ -2,7 +2,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { runCmd } from '../utils/exec.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { buildSwiftToolEnv, compileSwiftSourceFile } from '../utils/swift-cache.ts'; import { findProjectRoot } from '../utils/version.ts'; import { waitForPlayableVideo, waitForStableFile } from '../utils/video.ts'; diff --git a/src/remote/daemon-artifacts.ts b/src/remote/daemon-artifacts.ts index 1fc2e851c..41c335894 100644 --- a/src/remote/daemon-artifacts.ts +++ b/src/remote/daemon-artifacts.ts @@ -3,7 +3,7 @@ import http from 'node:http'; import https from 'node:https'; import path from 'node:path'; import { pipeline } from 'node:stream/promises'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { DaemonArtifact, DaemonRequest, DaemonResponse } from '../daemon/types.ts'; import { buildDaemonHttpAuthHeaders, diff --git a/src/remote/daemon-proxy.ts b/src/remote/daemon-proxy.ts index 030164a76..33263b90d 100644 --- a/src/remote/daemon-proxy.ts +++ b/src/remote/daemon-proxy.ts @@ -2,7 +2,7 @@ import http, { type IncomingMessage, type ServerResponse } from 'node:http'; import { Readable } from 'node:stream'; import { pipeline } from 'node:stream/promises'; import { randomUUID } from 'node:crypto'; -import { AppError, normalizeError } from '../kernel/errors.ts'; +import { AppError, normalizeError } from '@agent-device/kernel/errors'; import { readNodeHttpRequestBody } from '../utils/node-http.ts'; import { timingSafeStringEqual } from '../utils/timing-safe-equal.ts'; import { diff --git a/src/remote/remote-config-core.ts b/src/remote/remote-config-core.ts index fc8ce4570..948e53ce7 100644 --- a/src/remote/remote-config-core.ts +++ b/src/remote/remote-config-core.ts @@ -8,7 +8,7 @@ import { type RemoteConfigProfileOptions, type ResolvedRemoteConfigProfile, } from './remote-config-schema.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { resolveUserPath } from '../utils/path-resolution.ts'; import { parseSourceValue } from '../utils/source-value.ts'; diff --git a/src/remote/remote-config-schema.ts b/src/remote/remote-config-schema.ts index 02bcd9032..5e25f1821 100644 --- a/src/remote/remote-config-schema.ts +++ b/src/remote/remote-config-schema.ts @@ -7,7 +7,11 @@ import type { // re-exported here because this module is where consumers already import it from. export type { RemoteConnectionProfileFields } from '../contracts/remote-config-fields.ts'; import { buildPrimaryEnvVarName } from '../utils/source-value.ts'; -import { PLATFORM_SELECTORS, type DeviceTarget, type PlatformSelector } from '../kernel/device.ts'; +import { + PLATFORM_SELECTORS, + type DeviceTarget, + type PlatformSelector, +} from '@agent-device/kernel/device'; export type RemoteConfigProfile = RemoteConfigMetroOptions & CloudProviderProfileFields & diff --git a/src/remote/remote-connection-state.ts b/src/remote/remote-connection-state.ts index 498622ede..851854807 100644 --- a/src/remote/remote-connection-state.ts +++ b/src/remote/remote-connection-state.ts @@ -2,10 +2,10 @@ import crypto from 'node:crypto'; import fs from 'node:fs'; import path from 'node:path'; import { resolveRemoteConfigPath, resolveRemoteConfigProfile } from './remote-config-core.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { emitDiagnostic } from '../utils/diagnostics.ts'; import type { CliFlags } from '../contracts/cli-flags.ts'; -import type { LeaseBackend, SessionRuntimeHints } from '../kernel/contracts.ts'; +import type { LeaseBackend, SessionRuntimeHints } from '@agent-device/kernel/contracts'; import { leaseScopeFromOptions, leaseScopeToCommandFlags, diff --git a/src/remote/upload-client-artifact.ts b/src/remote/upload-client-artifact.ts index c6a13c8d0..c0d6dfd10 100644 --- a/src/remote/upload-client-artifact.ts +++ b/src/remote/upload-client-artifact.ts @@ -4,7 +4,7 @@ import os from 'node:os'; import path from 'node:path'; import { Writable } from 'node:stream'; import { pipeline } from 'node:stream/promises'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { runCmd } from '../utils/exec.ts'; const ARTIFACT_HASH_ALGORITHM = 'sha256'; diff --git a/src/remote/upload-client.ts b/src/remote/upload-client.ts index 90721e6bb..caa8c6c42 100644 --- a/src/remote/upload-client.ts +++ b/src/remote/upload-client.ts @@ -1,5 +1,5 @@ import { randomUUID } from 'node:crypto'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { buildDaemonHttpAuthHeaders } from '../daemon/http-contract.ts'; import { prepareUploadArtifact, type PreparedUploadArtifact } from './upload-client-artifact.ts'; import { isRetryableUploadStreamError, streamFileToHttpRequest } from './upload-stream.ts'; diff --git a/src/remote/upload-stream.ts b/src/remote/upload-stream.ts index 2d3fd9933..8e9b95147 100644 --- a/src/remote/upload-stream.ts +++ b/src/remote/upload-stream.ts @@ -3,7 +3,7 @@ import http, { type IncomingHttpHeaders } from 'node:http'; import https from 'node:https'; import path from 'node:path'; import { pipeline } from 'node:stream/promises'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { readNodeHttpResponseBody } from '../utils/node-http.ts'; import { createUploadProgressTransform, diff --git a/src/replay/__tests__/script.test.ts b/src/replay/__tests__/script.test.ts index b2434aa7f..62fe0bae5 100644 --- a/src/replay/__tests__/script.test.ts +++ b/src/replay/__tests__/script.test.ts @@ -2,7 +2,7 @@ import fc from 'fast-check'; import { test } from 'vitest'; import assert from 'node:assert/strict'; import { PROPERTY_RUNS, replayScriptArb } from '../../__tests__/test-utils/index.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { parseReplayScriptDetailed, readReplayScriptMetadata, diff --git a/src/replay/__tests__/target-identity.test.ts b/src/replay/__tests__/target-identity.test.ts index c0966da52..052c78f49 100644 --- a/src/replay/__tests__/target-identity.test.ts +++ b/src/replay/__tests__/target-identity.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { formatTargetAnnotationCommentLine, matchesAncestryPrefix, diff --git a/src/replay/__tests__/vars.test.ts b/src/replay/__tests__/vars.test.ts index 98d814520..0410ec315 100644 --- a/src/replay/__tests__/vars.test.ts +++ b/src/replay/__tests__/vars.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { buildReplayVarScope, collectReplayShellEnv, diff --git a/src/replay/divergence.ts b/src/replay/divergence.ts index e93fbe155..d08c78214 100644 --- a/src/replay/divergence.ts +++ b/src/replay/divergence.ts @@ -1,5 +1,5 @@ -import type { ResponseLevel } from '../kernel/contracts.ts'; -import { redactDiagnosticData } from '../kernel/redaction.ts'; +import type { ResponseLevel } from '@agent-device/kernel/contracts'; +import { redactDiagnosticData } from '@agent-device/kernel/redaction'; /** * ADR 0012 migration steps 2 + 4: structured replay divergence report. diff --git a/src/replay/recorded-input.ts b/src/replay/recorded-input.ts index febd71740..e92bda2f6 100644 --- a/src/replay/recorded-input.ts +++ b/src/replay/recorded-input.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { REPLAY_VAR_KEY_RE } from './vars.ts'; const RECORDED_INPUT_PLACEHOLDER_RE = /^\$\{([A-Z_][A-Z0-9_]*)\}$/; diff --git a/src/replay/script-utils.ts b/src/replay/script-utils.ts index f50123020..797a1988b 100644 --- a/src/replay/script-utils.ts +++ b/src/replay/script-utils.ts @@ -1,6 +1,6 @@ import type { SessionAction } from '../contracts/session-action.ts'; import { appendScreenshotScriptFlags } from '../contracts/screenshot.ts'; -import { splitRefGenerationSuffix } from '../kernel/snapshot.ts'; +import { splitRefGenerationSuffix } from '@agent-device/kernel/snapshot'; /** * #1076 versioned refs: a recorded ref positional may carry a `~s` diff --git a/src/replay/script.ts b/src/replay/script.ts index fb58399d7..6729b53c9 100644 --- a/src/replay/script.ts +++ b/src/replay/script.ts @@ -1,9 +1,9 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { recordingQualityInputToExportQuality } from '../contracts/recording-export-quality.ts'; import { describeReplayGestureArityError } from '../contracts/gesture-normalization.ts'; import { readScreenshotScriptFlag } from '../contracts/screenshot.ts'; -import type { DeviceTarget, PlatformSelector } from '../kernel/device.ts'; -import { PLATFORM_SELECTORS } from '../kernel/device.ts'; +import type { DeviceTarget, PlatformSelector } from '@agent-device/kernel/device'; +import { PLATFORM_SELECTORS } from '@agent-device/kernel/device'; import { parseReplayOpenFlags } from './open-script.ts'; import type { SessionAction } from '../contracts/session-action.ts'; import { diff --git a/src/replay/target-evidence-tree.ts b/src/replay/target-evidence-tree.ts index 0ceb15c12..72671d836 100644 --- a/src/replay/target-evidence-tree.ts +++ b/src/replay/target-evidence-tree.ts @@ -9,7 +9,7 @@ * daemon. */ -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { readNodeLocalIdentity } from './target-identity-node.ts'; import { matchesAncestryPrefix, diff --git a/src/replay/target-identity-node.ts b/src/replay/target-identity-node.ts index 1f2881d30..c537a7eef 100644 --- a/src/replay/target-identity-node.ts +++ b/src/replay/target-identity-node.ts @@ -10,7 +10,7 @@ * `target-identity.ts` so that module stays tree-agnostic. */ -import type { RawSnapshotNode } from '../kernel/snapshot.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; import { normalizeType } from '../snapshot/snapshot-processing.ts'; import { normalizeIdentifierField, diff --git a/src/replay/target-identity.ts b/src/replay/target-identity.ts index 644244aed..068586bad 100644 --- a/src/replay/target-identity.ts +++ b/src/replay/target-identity.ts @@ -8,7 +8,7 @@ * enforces parsed evidence at replay time until step 4. */ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; const TARGET_ANNOTATION_TAG = 'agent-device:target-v1'; // Captures the rest of the line verbatim: a line claiming the tag with a diff --git a/src/replay/test/reporters/__tests__/custom.test.ts b/src/replay/test/reporters/__tests__/custom.test.ts index 88772369d..5cd52f2b4 100644 --- a/src/replay/test/reporters/__tests__/custom.test.ts +++ b/src/replay/test/reporters/__tests__/custom.test.ts @@ -3,7 +3,7 @@ import fs from 'node:fs/promises'; import os from 'node:os'; import path from 'node:path'; import { test } from 'vitest'; -import { AppError } from '../../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { createCustomReplayTestReporter } from '../custom.ts'; test.each([ diff --git a/src/replay/test/reporters/custom.ts b/src/replay/test/reporters/custom.ts index 4309c9839..beef6c6ec 100644 --- a/src/replay/test/reporters/custom.ts +++ b/src/replay/test/reporters/custom.ts @@ -1,7 +1,7 @@ import os from 'node:os'; import path from 'node:path'; import { pathToFileURL } from 'node:url'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { ReplayTestReporter, ReplayTestReporterFactory } from './types.ts'; import type { ReplayTestReporterSpec } from './spec.ts'; diff --git a/src/replay/test/reporters/junit.ts b/src/replay/test/reporters/junit.ts index 8d0f410fa..a03fc6f25 100644 --- a/src/replay/test/reporters/junit.ts +++ b/src/replay/test/reporters/junit.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; import type { ReplaySuiteResult, ReplaySuiteTestResult } from '../../../contracts/replay.ts'; -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { ReplayTestReporter } from './types.ts'; import { appendOptionalLine, diff --git a/src/replay/test/reporters/spec.ts b/src/replay/test/reporters/spec.ts index 728fbed51..824a8a48f 100644 --- a/src/replay/test/reporters/spec.ts +++ b/src/replay/test/reporters/spec.ts @@ -1,4 +1,4 @@ -import { AppError } from '../../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export type ReplayTestReporterSpec = | { diff --git a/src/replay/vars.ts b/src/replay/vars.ts index 07c8f7c4c..ef54ad551 100644 --- a/src/replay/vars.ts +++ b/src/replay/vars.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { SessionAction } from '../contracts/session-action.ts'; export type ReplayVarScope = { diff --git a/src/request/cancel.test.ts b/src/request/cancel.test.ts index 9bb78873c..f9950f965 100644 --- a/src/request/cancel.test.ts +++ b/src/request/cancel.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { createRequestCanceledError, isRequestCanceledError, diff --git a/src/request/cancel.ts b/src/request/cancel.ts index b29a336e7..a24f8c69f 100644 --- a/src/request/cancel.ts +++ b/src/request/cancel.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; const canceledRequestIds = new Set(); const requestAbortControllers = new Map(); diff --git a/src/runtime-contract.ts b/src/runtime-contract.ts index b440e3d69..34ab99259 100644 --- a/src/runtime-contract.ts +++ b/src/runtime-contract.ts @@ -1,6 +1,6 @@ import type { AgentDeviceBackend } from './backend.ts'; import type { ArtifactAdapter } from './io.ts'; -import type { SnapshotState } from './kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; export type CommandPolicy = { allowLocalInputPaths: boolean; diff --git a/src/screenshot-diff/screenshot-diff-non-text.ts b/src/screenshot-diff/screenshot-diff-non-text.ts index 31de82df8..4f4912d29 100644 --- a/src/screenshot-diff/screenshot-diff-non-text.ts +++ b/src/screenshot-diff/screenshot-diff-non-text.ts @@ -1,4 +1,4 @@ -import type { Rect } from '../kernel/snapshot.ts'; +import type { Rect } from '@agent-device/kernel/snapshot'; import { findConnectedMaskComponents } from './screenshot-diff-components.ts'; import type { ScreenshotOcrAnalysis, ScreenshotOcrBlock } from './screenshot-diff-ocr.ts'; import type { ScreenshotDiffRegion } from './screenshot-diff-regions.ts'; diff --git a/src/screenshot-diff/screenshot-diff-ocr.ts b/src/screenshot-diff/screenshot-diff-ocr.ts index 81bdfd217..cf4fb61a1 100644 --- a/src/screenshot-diff/screenshot-diff-ocr.ts +++ b/src/screenshot-diff/screenshot-diff-ocr.ts @@ -1,4 +1,4 @@ -import type { Rect } from '../kernel/snapshot.ts'; +import type { Rect } from '@agent-device/kernel/snapshot'; import { runCmd, whichCmd } from '../utils/exec.ts'; export type MovementRange = { min: number; max: number }; diff --git a/src/screenshot-diff/screenshot-diff-overlay-matches.ts b/src/screenshot-diff/screenshot-diff-overlay-matches.ts index f37f14024..4c1ea70b5 100644 --- a/src/screenshot-diff/screenshot-diff-overlay-matches.ts +++ b/src/screenshot-diff/screenshot-diff-overlay-matches.ts @@ -2,7 +2,7 @@ import type { ScreenshotDiffRegion, ScreenshotDiffRegionOverlayMatch, } from './screenshot-diff-regions.ts'; -import type { Rect, ScreenshotOverlayRef } from '../kernel/snapshot.ts'; +import type { Rect, ScreenshotOverlayRef } from '@agent-device/kernel/snapshot'; import { intersectArea } from '../utils/screenshot-geometry.ts'; const MAX_MATCHES_PER_REGION = 3; diff --git a/src/screenshot-diff/screenshot-diff-regions.ts b/src/screenshot-diff/screenshot-diff-regions.ts index a55f7262b..1a45d6a37 100644 --- a/src/screenshot-diff/screenshot-diff-regions.ts +++ b/src/screenshot-diff/screenshot-diff-regions.ts @@ -1,5 +1,5 @@ import type { PNG } from '../utils/png.ts'; -import type { Rect } from '../kernel/snapshot.ts'; +import type { Rect } from '@agent-device/kernel/snapshot'; import { normalizedRect, type NormalizedRect } from '../utils/screenshot-geometry.ts'; import { findConnectedMaskComponents } from './screenshot-diff-components.ts'; import { splitLargeDiffRegions } from './screenshot-diff-region-split.ts'; diff --git a/src/screenshot-diff/screenshot-diff.ts b/src/screenshot-diff/screenshot-diff.ts index fbc50016f..fdd00c723 100644 --- a/src/screenshot-diff/screenshot-diff.ts +++ b/src/screenshot-diff/screenshot-diff.ts @@ -1,6 +1,6 @@ import { promises as fs } from 'node:fs'; import path from 'node:path'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { PNG } from '../utils/png.ts'; import { computeScreenshotDiffPixelsAsync, diff --git a/src/sdk/contracts.ts b/src/sdk/contracts.ts index 7a954e834..0e80ce0b1 100644 --- a/src/sdk/contracts.ts +++ b/src/sdk/contracts.ts @@ -8,6 +8,6 @@ export type { JsonRpcRequestEnvelope, LeaseBackend, SessionRuntimeHints, -} from '../kernel/contracts.ts'; +} from '@agent-device/kernel/contracts'; -export { centerOfRect, defaultHintForCode, normalizeError } from '../kernel/contracts.ts'; +export { centerOfRect, defaultHintForCode, normalizeError } from '@agent-device/kernel/contracts'; diff --git a/src/sdk/index.ts b/src/sdk/index.ts index b82eb1364..b8689a612 100644 --- a/src/sdk/index.ts +++ b/src/sdk/index.ts @@ -1,4 +1,8 @@ export { createAgentDeviceClient } from '../agent-device-client.ts'; export { createLocalArtifactAdapter } from '../io.ts'; -export { AppError, isAgentDeviceError, normalizeAgentDeviceError } from '../kernel/errors.ts'; -export { centerOfRect } from '../kernel/snapshot.ts'; +export { + AppError, + isAgentDeviceError, + normalizeAgentDeviceError, +} from '@agent-device/kernel/errors'; +export { centerOfRect } from '@agent-device/kernel/snapshot'; diff --git a/src/selectors/__tests__/is-argument-surface-parity.test.ts b/src/selectors/__tests__/is-argument-surface-parity.test.ts index 443a8283f..f7d03364e 100644 --- a/src/selectors/__tests__/is-argument-surface-parity.test.ts +++ b/src/selectors/__tests__/is-argument-surface-parity.test.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { checkIsArgs } from '../arguments.ts'; import { checkIsPredicate, IS_PREDICATE_USAGE_HINT } from '../predicates.ts'; import { readInputFromCli } from '../../commands/cli-grammar.ts'; diff --git a/src/selectors/build.test.ts b/src/selectors/build.test.ts index ca2983a62..96a7cee9c 100644 --- a/src/selectors/build.test.ts +++ b/src/selectors/build.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { buildNodes } from '../__tests__/test-utils/snapshot-builders.ts'; import { computeTargetEvidence } from '../daemon/session-target-evidence.ts'; import { buildSelectorChainForNode } from './build.ts'; diff --git a/src/selectors/build.ts b/src/selectors/build.ts index 543915254..3b17cc206 100644 --- a/src/selectors/build.ts +++ b/src/selectors/build.ts @@ -1,5 +1,5 @@ -import type { Platform, PublicPlatform } from '../kernel/device.ts'; -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { Platform, PublicPlatform } from '@agent-device/kernel/device'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { isNodeVisible } from './node.ts'; import { extractNodeText, normalizeType } from '../snapshot/snapshot-processing.ts'; import { idMatchCountInTree, readNodeLocalIdentity } from '../replay/target-identity-node.ts'; diff --git a/src/selectors/find.test.ts b/src/selectors/find.test.ts index b24634286..2e1ef2f42 100644 --- a/src/selectors/find.test.ts +++ b/src/selectors/find.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { findBestMatchesByLocator } from './find.ts'; function makeNode(ref: string, label?: string, identifier?: string): SnapshotNode { diff --git a/src/selectors/find.ts b/src/selectors/find.ts index c0402e39a..91bb7df9e 100644 --- a/src/selectors/find.ts +++ b/src/selectors/find.ts @@ -1,5 +1,5 @@ -import type { SnapshotNode } from '../kernel/snapshot.ts'; -import { AppError } from '../kernel/errors.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; +import { AppError } from '@agent-device/kernel/errors'; import { tryParseSelectorChain, type SelectorChain } from './parse.ts'; export const FIND_LOCATORS = ['any', 'text', 'label', 'value', 'role', 'id'] as const; diff --git a/src/selectors/index.test.ts b/src/selectors/index.test.ts index 0a302e4c9..4582ad3d8 100644 --- a/src/selectors/index.test.ts +++ b/src/selectors/index.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import type { SnapshotState } from '../kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; import { findSelectorChainMatch, parseSelectorChain, diff --git a/src/selectors/match.ts b/src/selectors/match.ts index 3804c197d..b889811a3 100644 --- a/src/selectors/match.ts +++ b/src/selectors/match.ts @@ -1,5 +1,5 @@ -import type { Platform, PublicPlatform } from '../kernel/device.ts'; -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { Platform, PublicPlatform } from '@agent-device/kernel/device'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { isNodeEditable, isNodeVisible } from './node.ts'; import { extractNodeText, normalizeType } from '../snapshot/snapshot-processing.ts'; import { normalizeText } from './find.ts'; diff --git a/src/selectors/node.ts b/src/selectors/node.ts index d8234d9c3..733a598e4 100644 --- a/src/selectors/node.ts +++ b/src/selectors/node.ts @@ -1,5 +1,5 @@ -import type { Platform, PublicPlatform } from '../kernel/device.ts'; -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { Platform, PublicPlatform } from '@agent-device/kernel/device'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { isFillableType } from '../snapshot/snapshot-processing.ts'; export function isNodeVisible(node: SnapshotNode): boolean { diff --git a/src/selectors/parse.ts b/src/selectors/parse.ts index 5b44bc8c6..157a259f5 100644 --- a/src/selectors/parse.ts +++ b/src/selectors/parse.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export type SelectorKey = | 'id' diff --git a/src/selectors/predicates.test.ts b/src/selectors/predicates.test.ts index 383337dfc..c6d02ea41 100644 --- a/src/selectors/predicates.test.ts +++ b/src/selectors/predicates.test.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { evaluateIsPredicate, normalizeIsPositionals } from './predicates.ts'; test('normalizeIsPositionals keeps canonical predicate-first arguments untouched', () => { diff --git a/src/selectors/predicates.ts b/src/selectors/predicates.ts index b57320683..fcc28e9a5 100644 --- a/src/selectors/predicates.ts +++ b/src/selectors/predicates.ts @@ -1,8 +1,8 @@ import { refuse, type SelectorArgumentRefusal } from './argument-refusal.ts'; -import type { Platform, PublicPlatform } from '../kernel/device.ts'; -import type { SnapshotState } from '../kernel/snapshot.ts'; -import { isPositiveFiniteRect } from '../kernel/rect.ts'; +import type { Platform, PublicPlatform } from '@agent-device/kernel/device'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; +import { isPositiveFiniteRect } from '@agent-device/kernel/rect'; import { isNodeVisibleInEffectiveViewport } from '../snapshot/mobile-snapshot-semantics.ts'; import { isNodeEditable, isNodeVisible } from './node.ts'; import { tryParseSelectorChain } from './parse.ts'; diff --git a/src/selectors/resolve.ts b/src/selectors/resolve.ts index 6d466f90b..2bdc34122 100644 --- a/src/selectors/resolve.ts +++ b/src/selectors/resolve.ts @@ -1,6 +1,6 @@ -import type { Platform, PublicPlatform } from '../kernel/device.ts'; +import type { Platform, PublicPlatform } from '@agent-device/kernel/device'; import type { DisambiguationTiebreak } from '../contracts/interaction.ts'; -import type { SnapshotNode, SnapshotState } from '../kernel/snapshot.ts'; +import type { SnapshotNode, SnapshotState } from '@agent-device/kernel/snapshot'; import { isNodeVisibleOnScreen } from '../snapshot/mobile-snapshot-semantics.ts'; import { buildSnapshotNodeMap } from '../snapshot/snapshot-tree.ts'; import { matchesSelector } from './match.ts'; diff --git a/src/snapshot/__tests__/snapshot-label-dedup.test.ts b/src/snapshot/__tests__/snapshot-label-dedup.test.ts index e4e9c409c..7df61facc 100644 --- a/src/snapshot/__tests__/snapshot-label-dedup.test.ts +++ b/src/snapshot/__tests__/snapshot-label-dedup.test.ts @@ -1,7 +1,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { dedupeInheritedSnapshotLabels } from '../snapshot-label-dedup.ts'; -import { attachRefs, type RawSnapshotNode } from '../../kernel/snapshot.ts'; +import { attachRefs, type RawSnapshotNode } from '@agent-device/kernel/snapshot'; function nodes(raw: RawSnapshotNode[]) { return attachRefs(raw); diff --git a/src/snapshot/__tests__/tap-point-policy-parity.test.ts b/src/snapshot/__tests__/tap-point-policy-parity.test.ts index e10a03a05..f428029c3 100644 --- a/src/snapshot/__tests__/tap-point-policy-parity.test.ts +++ b/src/snapshot/__tests__/tap-point-policy-parity.test.ts @@ -3,7 +3,7 @@ import assert from 'node:assert/strict'; import fs from 'node:fs'; import path from 'node:path'; import { isTapPointInsideViewport } from '../mobile-snapshot-semantics.ts'; -import type { Rect } from '../../kernel/snapshot.ts'; +import type { Rect } from '@agent-device/kernel/snapshot'; // ADR 0011 Layer 2 golden parity table: the SAME JSON is asserted against the // Swift twin (TapPointPolicy in apple/runner/AgentDeviceRunner/ diff --git a/src/snapshot/android-input-method-overlays.ts b/src/snapshot/android-input-method-overlays.ts index bfb85127b..5f2e63cd1 100644 --- a/src/snapshot/android-input-method-overlays.ts +++ b/src/snapshot/android-input-method-overlays.ts @@ -1,5 +1,5 @@ import { classifyAndroidInputOwnership } from '../contracts/android-input-ownership.ts'; -import type { RawSnapshotNode } from '../kernel/snapshot.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; export function isAndroidInputMethodSnapshotNode( node: Pick | undefined, diff --git a/src/snapshot/mobile-snapshot-semantics.ts b/src/snapshot/mobile-snapshot-semantics.ts index f311db753..efa94323f 100644 --- a/src/snapshot/mobile-snapshot-semantics.ts +++ b/src/snapshot/mobile-snapshot-semantics.ts @@ -4,7 +4,7 @@ import { resolveViewportRect, } from '../utils/rect-visibility.ts'; import { inferVerticalScrollIndicatorDirections } from '../utils/scroll-indicator.ts'; -import type { HiddenContentHint, Rect, SnapshotNode } from '../kernel/snapshot.ts'; +import type { HiddenContentHint, Rect, SnapshotNode } from '@agent-device/kernel/snapshot'; import { buildSnapshotNodeMap, displayNodeLabel } from './snapshot-tree.ts'; import { isScrollableNodeLike } from '../utils/scrollable.ts'; diff --git a/src/snapshot/snapshot-diff.ts b/src/snapshot/snapshot-diff.ts index 991e106f0..6508f43c0 100644 --- a/src/snapshot/snapshot-diff.ts +++ b/src/snapshot/snapshot-diff.ts @@ -1,4 +1,4 @@ -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { buildSnapshotDisplayLines, displayLabel, diff --git a/src/snapshot/snapshot-label-dedup.ts b/src/snapshot/snapshot-label-dedup.ts index ad6779a0e..c45c12190 100644 --- a/src/snapshot/snapshot-label-dedup.ts +++ b/src/snapshot/snapshot-label-dedup.ts @@ -1,4 +1,4 @@ -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { buildSnapshotNodeMap } from './snapshot-tree.ts'; /** diff --git a/src/snapshot/snapshot-lines.ts b/src/snapshot/snapshot-lines.ts index 30a0a8a88..449892ecb 100644 --- a/src/snapshot/snapshot-lines.ts +++ b/src/snapshot/snapshot-lines.ts @@ -1,5 +1,5 @@ import { isSystemScrollIndicatorLabel } from '../utils/scroll-indicator.ts'; -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { buildTextPreview, describeTextSurface, trimText } from '../utils/text-surface.ts'; type SnapshotDisplayLine = { diff --git a/src/snapshot/snapshot-occlusion.ts b/src/snapshot/snapshot-occlusion.ts index 522907ece..b969be51f 100644 --- a/src/snapshot/snapshot-occlusion.ts +++ b/src/snapshot/snapshot-occlusion.ts @@ -1,5 +1,5 @@ -import type { RawSnapshotNode, Rect } from '../kernel/snapshot.ts'; -import { centerOfRect } from '../kernel/snapshot.ts'; +import type { RawSnapshotNode, Rect } from '@agent-device/kernel/snapshot'; +import { centerOfRect } from '@agent-device/kernel/snapshot'; import { areRectsApproximatelyEqual, normalizeRect } from '../utils/rect-center.ts'; import { containsPoint } from '../utils/rect-visibility.ts'; import { normalizeType } from '../utils/text-surface.ts'; diff --git a/src/snapshot/snapshot-processing.ts b/src/snapshot/snapshot-processing.ts index 67e15e5fc..0bd26b30a 100644 --- a/src/snapshot/snapshot-processing.ts +++ b/src/snapshot/snapshot-processing.ts @@ -1,5 +1,5 @@ -import type { Platform, PublicPlatform } from '../kernel/device.ts'; -import type { RawSnapshotNode, SnapshotNode, SnapshotState } from '../kernel/snapshot.ts'; +import type { Platform, PublicPlatform } from '@agent-device/kernel/device'; +import type { RawSnapshotNode, SnapshotNode, SnapshotState } from '@agent-device/kernel/snapshot'; import { extractReadableText, normalizeType } from '../utils/text-surface.ts'; export { normalizeType }; diff --git a/src/snapshot/snapshot-quality.ts b/src/snapshot/snapshot-quality.ts index aba46c7a8..d10e487c6 100644 --- a/src/snapshot/snapshot-quality.ts +++ b/src/snapshot/snapshot-quality.ts @@ -1,8 +1,8 @@ -import type { SnapshotNode, SnapshotQualityVerdict } from '../kernel/snapshot.ts'; +import type { SnapshotNode, SnapshotQualityVerdict } from '@agent-device/kernel/snapshot'; // The type lives in snapshot.ts (the foundational type module) to avoid a cyclic // import with SnapshotNode; re-exported here so existing callers are unaffected. -export type { SnapshotQualityVerdict } from '../kernel/snapshot.ts'; +export type { SnapshotQualityVerdict } from '@agent-device/kernel/snapshot'; const SNAPSHOT_QUALITY_STATES = new Set([ 'healthy', diff --git a/src/snapshot/snapshot-tree.ts b/src/snapshot/snapshot-tree.ts index 14c2dd26a..c8aac2fed 100644 --- a/src/snapshot/snapshot-tree.ts +++ b/src/snapshot/snapshot-tree.ts @@ -1,4 +1,4 @@ -import type { RawSnapshotNode, SnapshotNode } from '../kernel/snapshot.ts'; +import type { RawSnapshotNode, SnapshotNode } from '@agent-device/kernel/snapshot'; export function normalizeSnapshotTree(nodes: RawSnapshotNode[]): RawSnapshotNode[] { const originalToNormalizedIndex = new Map(); diff --git a/src/snapshot/snapshot-visibility.ts b/src/snapshot/snapshot-visibility.ts index 347ae611d..b9dc1dc47 100644 --- a/src/snapshot/snapshot-visibility.ts +++ b/src/snapshot/snapshot-visibility.ts @@ -3,7 +3,7 @@ import { usesMobileSnapshotPresentation, type SnapshotState, type SnapshotVisibility, -} from '../kernel/snapshot.ts'; +} from '@agent-device/kernel/snapshot'; export function buildSnapshotVisibility(params: { nodes: SnapshotState['nodes']; diff --git a/src/snapshot/system-surface-disclosure.ts b/src/snapshot/system-surface-disclosure.ts index 596eea663..a85f086ee 100644 --- a/src/snapshot/system-surface-disclosure.ts +++ b/src/snapshot/system-surface-disclosure.ts @@ -1,4 +1,4 @@ -import type { SnapshotState } from '../kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; /** * The one agent-facing explanation for an Android capture that faithfully shows an occluding diff --git a/src/utils/__tests__/daemon-client-lifecycle.test.ts b/src/utils/__tests__/daemon-client-lifecycle.test.ts index ed214d9fa..85485b700 100644 --- a/src/utils/__tests__/daemon-client-lifecycle.test.ts +++ b/src/utils/__tests__/daemon-client-lifecycle.test.ts @@ -36,7 +36,7 @@ import { listenOnLoopback, supportsLoopbackBind, } from '../../__tests__/test-utils/index.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { runCmdDetachedMonitored, runCmdSync } from '../exec.ts'; import { readProcessStartTime } from '../host-process.ts'; import { shellQuoteIfNeeded } from '../shell-quote.ts'; diff --git a/src/utils/__tests__/device.test.ts b/src/utils/__tests__/device.test.ts index 5da8fa59e..657ca9bc6 100644 --- a/src/utils/__tests__/device.test.ts +++ b/src/utils/__tests__/device.test.ts @@ -8,15 +8,15 @@ import { resolveApplePlatformName, resolveAppleSimulatorSetPathForSelector, resolveDevice, -} from '../../kernel/device.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; +} from '@agent-device/kernel/device'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { ANDROID_TV_DEVICE, IOS_SIMULATOR, MACOS_DEVICE, TVOS_SIMULATOR, } from '../../__tests__/test-utils/device-fixtures.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; test('isTvOsDevice selects only the Apple tvOS leaf, not any TV target', () => { assert.equal(isTvOsDevice(TVOS_SIMULATOR), true); diff --git a/src/utils/__tests__/exec.test.ts b/src/utils/__tests__/exec.test.ts index 5db5c6e23..c9c222125 100644 --- a/src/utils/__tests__/exec.test.ts +++ b/src/utils/__tests__/exec.test.ts @@ -15,7 +15,7 @@ import { whichCmd, type ExecResult, } from '../exec.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; test('runCmd enforces timeoutMs and rejects with COMMAND_FAILED', async () => { await assert.rejects( diff --git a/src/utils/__tests__/interactors.test.ts b/src/utils/__tests__/interactors.test.ts index 3ab6b589f..c07a72b61 100644 --- a/src/utils/__tests__/interactors.test.ts +++ b/src/utils/__tests__/interactors.test.ts @@ -1,8 +1,8 @@ import { afterEach, beforeEach, test, vi } from 'vitest'; import assert from 'node:assert/strict'; import type { RunnerCommand } from '../../platforms/apple/core/runner/runner-client.ts'; -import type { DeviceInfo } from '../../kernel/device.ts'; -import { AppError } from '../../kernel/errors.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import type { Interactor, RunnerContext } from '../../contracts/interactor-types.ts'; import { setActiveProviderDeviceRuntimes, diff --git a/src/utils/__tests__/mobile-snapshot-semantics.test.ts b/src/utils/__tests__/mobile-snapshot-semantics.test.ts index 2b989b376..38b9803b0 100644 --- a/src/utils/__tests__/mobile-snapshot-semantics.test.ts +++ b/src/utils/__tests__/mobile-snapshot-semantics.test.ts @@ -5,7 +5,7 @@ import { classifyOffscreenScrollDirection, isNodeVisibleInEffectiveViewport, } from '../../snapshot/mobile-snapshot-semantics.ts'; -import type { SnapshotNode } from '../../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; test('mobile presentation keeps only visible nodes and adds off-screen summary fallback', () => { const nodes: SnapshotNode[] = [ diff --git a/src/utils/__tests__/output.test.ts b/src/utils/__tests__/output.test.ts index 3f58409b0..a65d8ea01 100644 --- a/src/utils/__tests__/output.test.ts +++ b/src/utils/__tests__/output.test.ts @@ -10,7 +10,7 @@ import { } from '../output.ts'; import { formatRole, formatSnapshotLine } from '../../snapshot/snapshot-lines.ts'; import { normalizedRect } from '../screenshot-geometry.ts'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; function captureStderr(run: () => void): string { const original = process.stderr.write.bind(process.stderr); diff --git a/src/utils/__tests__/png-size.test.ts b/src/utils/__tests__/png-size.test.ts index 3083fb10c..d80ebbf2a 100644 --- a/src/utils/__tests__/png-size.test.ts +++ b/src/utils/__tests__/png-size.test.ts @@ -3,7 +3,7 @@ import assert from 'node:assert/strict'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { PNG } from '../png.ts'; import { readPngSize } from '../png-size.ts'; diff --git a/src/utils/__tests__/png-worker-client.test.ts b/src/utils/__tests__/png-worker-client.test.ts index 1a20a3570..f8481d073 100644 --- a/src/utils/__tests__/png-worker-client.test.ts +++ b/src/utils/__tests__/png-worker-client.test.ts @@ -1,6 +1,6 @@ import { afterAll, test } from 'vitest'; import assert from 'node:assert/strict'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { PNG } from '../png-codec.ts'; import { computePngRgbDifferenceAsync, diff --git a/src/utils/__tests__/process-lock.test.ts b/src/utils/__tests__/process-lock.test.ts index be79e0d32..2f7ad17ca 100644 --- a/src/utils/__tests__/process-lock.test.ts +++ b/src/utils/__tests__/process-lock.test.ts @@ -3,7 +3,7 @@ import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { afterEach, beforeEach, test } from 'vitest'; -import { AppError } from '../../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { acquireProcessLock, type ProcessLockOwner } from '../process-lock.ts'; import { readProcessStartTime } from '../host-process.ts'; diff --git a/src/utils/__tests__/repeated-nav-subtree.test.ts b/src/utils/__tests__/repeated-nav-subtree.test.ts index 70ead2659..eb471475e 100644 --- a/src/utils/__tests__/repeated-nav-subtree.test.ts +++ b/src/utils/__tests__/repeated-nav-subtree.test.ts @@ -1,7 +1,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { detectPossibleRepeatedNavSubtree } from '../repeated-nav-subtree.ts'; -import type { SnapshotNode } from '../../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; test('detectPossibleRepeatedNavSubtree warns for overlapping duplicate rows', () => { const nodes = makeNodes(24, (index) => ({ diff --git a/src/utils/__tests__/snapshot-processing.test.ts b/src/utils/__tests__/snapshot-processing.test.ts index 61a1353a0..499edd32f 100644 --- a/src/utils/__tests__/snapshot-processing.test.ts +++ b/src/utils/__tests__/snapshot-processing.test.ts @@ -5,7 +5,7 @@ import { findNearestAncestor, findSnapshotAncestor, } from '../../snapshot/snapshot-processing.ts'; -import type { SnapshotNode } from '../../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; test('findSnapshotAncestor walks non-contiguous parent indexes until resolver returns a value', () => { const nodes: SnapshotNode[] = [ diff --git a/src/utils/__tests__/snapshot-visibility.test.ts b/src/utils/__tests__/snapshot-visibility.test.ts index 3a1b5642e..094fadaea 100644 --- a/src/utils/__tests__/snapshot-visibility.test.ts +++ b/src/utils/__tests__/snapshot-visibility.test.ts @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import { buildSnapshotVisibility } from '../../snapshot/snapshot-visibility.ts'; -import type { SnapshotNode } from '../../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; const FULLSCREEN_ROOT = { x: 0, y: 0, width: 390, height: 844 }; const OFFSCREEN_RECT = { x: 0, y: 1200, width: 120, height: 44 }; diff --git a/src/utils/android-helper-presentation/geometry.ts b/src/utils/android-helper-presentation/geometry.ts index b97a48b31..b23ee022c 100644 --- a/src/utils/android-helper-presentation/geometry.ts +++ b/src/utils/android-helper-presentation/geometry.ts @@ -1,4 +1,4 @@ -import type { Rect } from '../../kernel/snapshot.ts'; +import type { Rect } from '@agent-device/kernel/snapshot'; export function hasRenderableArea(rect: Rect): boolean { return rect.width > 0 && rect.height > 0; diff --git a/src/utils/android-helper-presentation/labels.ts b/src/utils/android-helper-presentation/labels.ts index 03e8b732b..b95e47a41 100644 --- a/src/utils/android-helper-presentation/labels.ts +++ b/src/utils/android-helper-presentation/labels.ts @@ -1,4 +1,4 @@ -import type { SnapshotNode } from '../../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { displayNodeLabel } from '../../snapshot/snapshot-tree.ts'; export function visibleNodeLabel(node: SnapshotNode): string { diff --git a/src/utils/android-helper-presentation/predicates.ts b/src/utils/android-helper-presentation/predicates.ts index 4ba099e7d..2a8aa5243 100644 --- a/src/utils/android-helper-presentation/predicates.ts +++ b/src/utils/android-helper-presentation/predicates.ts @@ -1,4 +1,4 @@ -import type { SnapshotNode } from '../../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; export function isRootNode(node: SnapshotNode): boolean { return typeof node.parentIndex !== 'number'; diff --git a/src/utils/android-helper-presentation/structural-noise.ts b/src/utils/android-helper-presentation/structural-noise.ts index b1fc42157..f73e83739 100644 --- a/src/utils/android-helper-presentation/structural-noise.ts +++ b/src/utils/android-helper-presentation/structural-noise.ts @@ -1,4 +1,4 @@ -import type { SnapshotNode } from '../../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { areSameVisualRow, hasRenderableArea, isRectContainedBy } from './geometry.ts'; import { normalizeStructuralNodeLabel, visibleNodeLabel } from './labels.ts'; import { isEditableNode, isRootNode } from './predicates.ts'; diff --git a/src/utils/android-helper-presentation/tree.ts b/src/utils/android-helper-presentation/tree.ts index 23183601c..5a0f390e1 100644 --- a/src/utils/android-helper-presentation/tree.ts +++ b/src/utils/android-helper-presentation/tree.ts @@ -1,4 +1,4 @@ -import type { SnapshotNode } from '../../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; export function findAncestor( node: SnapshotNode, diff --git a/src/utils/android-helper-snapshot-presentation.ts b/src/utils/android-helper-snapshot-presentation.ts index 33c32e4cf..9c0ed0a87 100644 --- a/src/utils/android-helper-snapshot-presentation.ts +++ b/src/utils/android-helper-snapshot-presentation.ts @@ -1,4 +1,4 @@ -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { hasRenderableArea } from './android-helper-presentation/geometry.ts'; import { isRootNode, isScrollableNode } from './android-helper-presentation/predicates.ts'; import { diff --git a/src/utils/diagnostics.ts b/src/utils/diagnostics.ts index dc0839d17..c8475f9b7 100644 --- a/src/utils/diagnostics.ts +++ b/src/utils/diagnostics.ts @@ -3,7 +3,7 @@ import crypto from 'node:crypto'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import { redactDiagnosticData } from '../kernel/redaction.ts'; +import { redactDiagnosticData } from '@agent-device/kernel/redaction'; type DiagnosticLevel = 'info' | 'warn' | 'error' | 'debug'; diff --git a/src/utils/exec.ts b/src/utils/exec.ts index 9b40b324e..cdb05148e 100644 --- a/src/utils/exec.ts +++ b/src/utils/exec.ts @@ -5,7 +5,7 @@ import path from 'node:path'; import { spawn, spawnSync, type ChildProcess, type StdioOptions } from 'node:child_process'; import { Readable } from 'node:stream'; import { pipeline } from 'node:stream/promises'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { emitDiagnostic, getDiagnosticsMeta, updateDiagnosticsScope } from './diagnostics.ts'; import { parseBooleanLiteral } from './source-value.ts'; diff --git a/src/utils/install-source-config.ts b/src/utils/install-source-config.ts index a76906276..cf3270234 100644 --- a/src/utils/install-source-config.ts +++ b/src/utils/install-source-config.ts @@ -1,5 +1,5 @@ -import type { DaemonInstallSource } from '../kernel/contracts.ts'; -import { AppError } from '../kernel/errors.ts'; +import type { DaemonInstallSource } from '@agent-device/kernel/contracts'; +import { AppError } from '@agent-device/kernel/errors'; export function parseGitHubActionsArtifactInstallSourceSpec( spec: string, diff --git a/src/utils/location-coordinates.ts b/src/utils/location-coordinates.ts index 8cc376ce5..af4cc41fb 100644 --- a/src/utils/location-coordinates.ts +++ b/src/utils/location-coordinates.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export type LocationCoordinateLabel = 'latitude' | 'longitude'; diff --git a/src/utils/node-http.ts b/src/utils/node-http.ts index 02fa49da6..de8663b5f 100644 --- a/src/utils/node-http.ts +++ b/src/utils/node-http.ts @@ -1,5 +1,5 @@ import type { IncomingMessage } from 'node:http'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export function readNodeHttpResponseBody(res: IncomingMessage): Promise { return new Promise((resolve, reject) => { diff --git a/src/utils/output.ts b/src/utils/output.ts index 6d785272b..d6a4c186c 100644 --- a/src/utils/output.ts +++ b/src/utils/output.ts @@ -3,7 +3,7 @@ import { buildAndroidHelperPresentationInput, type AndroidHelperPresentationInput, } from './android-helper-snapshot-presentation.ts'; -import { AppError, normalizeError, type NormalizedError } from '../kernel/errors.ts'; +import { AppError, normalizeError, type NormalizedError } from '@agent-device/kernel/errors'; import { detectPossibleRepeatedNavSubtree } from './repeated-nav-subtree.ts'; import { formatReplayDivergenceReport } from '../replay/divergence.ts'; import { buildSnapshotDisplayLines, formatSnapshotLine } from '../snapshot/snapshot-lines.ts'; @@ -14,7 +14,7 @@ import { type SnapshotNode, type SnapshotUnchanged, type SnapshotVisibility, -} from '../kernel/snapshot.ts'; +} from '@agent-device/kernel/snapshot'; import type { MovementRange } from '../screenshot-diff/screenshot-diff-ocr.ts'; import type { ScreenshotDiffResult } from '../screenshot-diff/screenshot-diff.ts'; import type { ScreenshotDiffRegion } from '../screenshot-diff/screenshot-diff-regions.ts'; diff --git a/src/utils/parsing.ts b/src/utils/parsing.ts index 7789ab0dd..58264af18 100644 --- a/src/utils/parsing.ts +++ b/src/utils/parsing.ts @@ -1,6 +1,6 @@ -import { AppError } from '../kernel/errors.ts'; -import type { DeviceKind, DeviceTarget, PublicPlatform } from '../kernel/device.ts'; -import type { Point, Rect } from '../kernel/snapshot.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { DeviceKind, DeviceTarget, PublicPlatform } from '@agent-device/kernel/device'; +import type { Point, Rect } from '@agent-device/kernel/snapshot'; function readRequired( record: Record, diff --git a/src/utils/payload-input.ts b/src/utils/payload-input.ts index a8525ef2a..e0d2fdbc8 100644 --- a/src/utils/payload-input.ts +++ b/src/utils/payload-input.ts @@ -1,5 +1,5 @@ import fs from 'node:fs'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; function looksLikeInlineJson(value: string): boolean { const trimmed = value.trim(); diff --git a/src/utils/png-resize.ts b/src/utils/png-resize.ts index 493fae1b1..a8955f638 100644 --- a/src/utils/png-resize.ts +++ b/src/utils/png-resize.ts @@ -1,5 +1,5 @@ import { promises as fs } from 'node:fs'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { PNG } from './png-codec.ts'; import { decodePngAsync, encodePngAsync } from './png-worker-client.ts'; diff --git a/src/utils/png-size.ts b/src/utils/png-size.ts index 849cb8437..267c1bb12 100644 --- a/src/utils/png-size.ts +++ b/src/utils/png-size.ts @@ -1,5 +1,5 @@ import { promises as fs } from 'node:fs'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export async function readPngSize(filePath: string): Promise<{ width: number; height: number }> { const file = await fs.open(filePath, 'r'); diff --git a/src/utils/png-worker-client.ts b/src/utils/png-worker-client.ts index 77938add2..c2775624d 100644 --- a/src/utils/png-worker-client.ts +++ b/src/utils/png-worker-client.ts @@ -1,6 +1,6 @@ import { Worker } from 'node:worker_threads'; import { emitDiagnostic } from './diagnostics.ts'; -import { AppError, toAppErrorCode } from '../kernel/errors.ts'; +import { AppError, toAppErrorCode } from '@agent-device/kernel/errors'; import { resolveInternalEntryModulePath } from './internal-entry.ts'; import { PNG } from './png-codec.ts'; import { decodePng } from './png.ts'; diff --git a/src/utils/png-worker-contract.ts b/src/utils/png-worker-contract.ts index 94f44fecd..3d0a76363 100644 --- a/src/utils/png-worker-contract.ts +++ b/src/utils/png-worker-contract.ts @@ -1,4 +1,4 @@ -import type { NormalizedError } from '../kernel/errors.ts'; +import type { NormalizedError } from '@agent-device/kernel/errors'; import type { ScreenshotDiffPixelsJob, ScreenshotDiffPixelsResult, diff --git a/src/utils/png-worker.ts b/src/utils/png-worker.ts index ca8940e3e..86f74209e 100644 --- a/src/utils/png-worker.ts +++ b/src/utils/png-worker.ts @@ -1,5 +1,5 @@ import { parentPort } from 'node:worker_threads'; -import { normalizeError } from '../kernel/errors.ts'; +import { normalizeError } from '@agent-device/kernel/errors'; import { PNG } from './png-codec.ts'; import { decodePng } from './png.ts'; import { computeScreenshotDiffPixels } from './screenshot-diff-pixels.ts'; diff --git a/src/utils/png.ts b/src/utils/png.ts index d708d9b5b..d6f8f05a7 100644 --- a/src/utils/png.ts +++ b/src/utils/png.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { PNG } from './png-codec.ts'; export { PNG }; diff --git a/src/utils/process-lock.ts b/src/utils/process-lock.ts index 1c6138741..a5c651d6a 100644 --- a/src/utils/process-lock.ts +++ b/src/utils/process-lock.ts @@ -1,6 +1,6 @@ import fs from 'node:fs'; import path from 'node:path'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { isProcessAlive, readProcessStartTime } from './host-process.ts'; import { sleep } from './timeouts.ts'; diff --git a/src/utils/rect-center.ts b/src/utils/rect-center.ts index ea2c17924..5663b42d1 100644 --- a/src/utils/rect-center.ts +++ b/src/utils/rect-center.ts @@ -1,4 +1,4 @@ -import { centerOfRect, type Point, type Rect } from '../kernel/snapshot.ts'; +import { centerOfRect, type Point, type Rect } from '@agent-device/kernel/snapshot'; const RECT_COMPARE_FIELDS = ['x', 'y', 'width', 'height'] as const; const RECT_EQUALITY_TOLERANCE = 0.5; diff --git a/src/utils/rect-visibility.ts b/src/utils/rect-visibility.ts index 005db3b9d..063a6dc4c 100644 --- a/src/utils/rect-visibility.ts +++ b/src/utils/rect-visibility.ts @@ -1,4 +1,4 @@ -import { centerOfRect, type RawSnapshotNode, type Rect } from '../kernel/snapshot.ts'; +import { centerOfRect, type RawSnapshotNode, type Rect } from '@agent-device/kernel/snapshot'; export function resolveViewportRect(nodes: RawSnapshotNode[], targetRect: Rect): Rect | null { const targetCenter = centerOfRect(targetRect); diff --git a/src/utils/repeated-nav-subtree.ts b/src/utils/repeated-nav-subtree.ts index b494b850f..acd6c3122 100644 --- a/src/utils/repeated-nav-subtree.ts +++ b/src/utils/repeated-nav-subtree.ts @@ -1,4 +1,4 @@ -import type { Rect, SnapshotNode } from '../kernel/snapshot.ts'; +import type { Rect, SnapshotNode } from '@agent-device/kernel/snapshot'; import { normalizeRepeatedNodeLabel } from '../snapshot/snapshot-label-signals.ts'; import { displayNodeLabel } from '../snapshot/snapshot-tree.ts'; diff --git a/src/utils/retry.ts b/src/utils/retry.ts index 797f58d17..95ee8c754 100644 --- a/src/utils/retry.ts +++ b/src/utils/retry.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { emitDiagnostic } from './diagnostics.ts'; type RetryPolicy = { diff --git a/src/utils/runtime-transport.ts b/src/utils/runtime-transport.ts index 8202fc4b4..dbebd9a60 100644 --- a/src/utils/runtime-transport.ts +++ b/src/utils/runtime-transport.ts @@ -1,6 +1,6 @@ import { URL } from 'node:url'; -import type { SessionRuntimeHints } from '../kernel/contracts.ts'; -import { AppError } from '../kernel/errors.ts'; +import type { SessionRuntimeHints } from '@agent-device/kernel/contracts'; +import { AppError } from '@agent-device/kernel/errors'; export type ResolvedRuntimeTransport = { host: string; diff --git a/src/utils/screenshot-density.ts b/src/utils/screenshot-density.ts index 638655c1a..523ecf8fb 100644 --- a/src/utils/screenshot-density.ts +++ b/src/utils/screenshot-density.ts @@ -1,5 +1,5 @@ -import { isIosFamily, type DeviceInfo } from '../kernel/device.ts'; -import { AppError } from '../kernel/errors.ts'; +import { isIosFamily, type DeviceInfo } from '@agent-device/kernel/device'; +import { AppError } from '@agent-device/kernel/errors'; import type { ScreenshotResultData } from './screenshot-result.ts'; import { readPngSize } from './png-size.ts'; diff --git a/src/utils/screenshot-geometry.ts b/src/utils/screenshot-geometry.ts index ab752bbef..6341801c2 100644 --- a/src/utils/screenshot-geometry.ts +++ b/src/utils/screenshot-geometry.ts @@ -1,4 +1,4 @@ -import type { Point, Rect } from '../kernel/snapshot.ts'; +import type { Point, Rect } from '@agent-device/kernel/snapshot'; export type ImageDimensions = { width: number; height: number }; diff --git a/src/utils/screenshot-result.ts b/src/utils/screenshot-result.ts index a9fcabb67..a9854af72 100644 --- a/src/utils/screenshot-result.ts +++ b/src/utils/screenshot-result.ts @@ -1,4 +1,4 @@ -import type { ScreenshotOverlayRef } from '../kernel/snapshot.ts'; +import type { ScreenshotOverlayRef } from '@agent-device/kernel/snapshot'; import { isRecord, parsePoint, parseRect } from './parsing.ts'; export type ScreenshotResultData = { diff --git a/src/utils/scroll-edge-state-fixtures.ts b/src/utils/scroll-edge-state-fixtures.ts index b29cca18e..6add41193 100644 --- a/src/utils/scroll-edge-state-fixtures.ts +++ b/src/utils/scroll-edge-state-fixtures.ts @@ -3,8 +3,8 @@ import { type ScrollEdgeState, type ScrollEdgeTarget, } from './scroll-edge-state.ts'; -import { AppError } from '../kernel/errors.ts'; -import type { RawSnapshotNode, SnapshotNode } from '../kernel/snapshot.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import type { RawSnapshotNode, SnapshotNode } from '@agent-device/kernel/snapshot'; export function windowRoot(): SnapshotNode { return { diff --git a/src/utils/scroll-edge-state-pass-orchestration.test.ts b/src/utils/scroll-edge-state-pass-orchestration.test.ts index b74fbe498..897e694d7 100644 --- a/src/utils/scroll-edge-state-pass-orchestration.test.ts +++ b/src/utils/scroll-edge-state-pass-orchestration.test.ts @@ -5,7 +5,7 @@ import { formatScrollEdgeMessage, runScrollEdgePasses, } from './scroll-edge-state.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { captureThrows, scrollSnapshot, windowRoot } from './scroll-edge-state-fixtures.ts'; // --------------------------------------------------------------------------- diff --git a/src/utils/scroll-edge-state-scope.test.ts b/src/utils/scroll-edge-state-scope.test.ts index e19bf5fd5..c6f49d0a9 100644 --- a/src/utils/scroll-edge-state-scope.test.ts +++ b/src/utils/scroll-edge-state-scope.test.ts @@ -1,7 +1,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import { captureScrollEdgeState } from './scroll-edge-state.ts'; -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { capture, scopeFor, scrollNode, windowRoot } from './scroll-edge-state-fixtures.ts'; // --------------------------------------------------------------------------- diff --git a/src/utils/scroll-edge-state-target-resolution.test.ts b/src/utils/scroll-edge-state-target-resolution.test.ts index e91a107f3..64786e9a1 100644 --- a/src/utils/scroll-edge-state-target-resolution.test.ts +++ b/src/utils/scroll-edge-state-target-resolution.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import type { SnapshotNode } from '../kernel/snapshot.ts'; +import type { SnapshotNode } from '@agent-device/kernel/snapshot'; import { capture, scrollNode, windowRoot } from './scroll-edge-state-fixtures.ts'; // --------------------------------------------------------------------------- diff --git a/src/utils/scroll-edge-state.ts b/src/utils/scroll-edge-state.ts index 7468b924d..962526d25 100644 --- a/src/utils/scroll-edge-state.ts +++ b/src/utils/scroll-edge-state.ts @@ -2,7 +2,7 @@ import { deriveMobileSnapshotHiddenContentHints, isNodeVisibleInEffectiveViewport, } from '../snapshot/mobile-snapshot-semantics.ts'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { isScrollableNodeLike } from './scrollable.ts'; import type { ScrollDirection } from '../contracts/scroll-gesture.ts'; import type { @@ -10,7 +10,7 @@ import type { Point, RawSnapshotNode, SnapshotNode, -} from '../kernel/snapshot.ts'; +} from '@agent-device/kernel/snapshot'; export type ScrollEdge = 'top' | 'bottom'; diff --git a/src/utils/session-binding.ts b/src/utils/session-binding.ts index 0fa0187f8..b94ff1063 100644 --- a/src/utils/session-binding.ts +++ b/src/utils/session-binding.ts @@ -1,6 +1,6 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import type { CliFlags } from '../contracts/cli-flags.ts'; -import type { DaemonLockPolicy } from '../kernel/contracts.ts'; +import type { DaemonLockPolicy } from '@agent-device/kernel/contracts'; export type BindingSettings = { defaultPlatform?: CliFlags['platform']; diff --git a/src/utils/source-value.ts b/src/utils/source-value.ts index b92a4b612..305d9546d 100644 --- a/src/utils/source-value.ts +++ b/src/utils/source-value.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export type SourceValueDefinition = { type: 'boolean' | 'int' | 'enum' | 'string' | 'booleanOrString'; diff --git a/src/utils/string-enum.ts b/src/utils/string-enum.ts index 9d1b7d3ec..d8d7a1bed 100644 --- a/src/utils/string-enum.ts +++ b/src/utils/string-enum.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; /** * Membership guard for an `as const` string tuple (the single source of truth for diff --git a/src/utils/swift-cache.ts b/src/utils/swift-cache.ts index ef986d9ce..e1ce0c7d5 100644 --- a/src/utils/swift-cache.ts +++ b/src/utils/swift-cache.ts @@ -2,7 +2,7 @@ import { createHash } from 'node:crypto'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { runCmd } from './exec.ts'; import { acquireProcessLock } from './process-lock.ts'; import { readProcessStartTime } from './host-process.ts'; diff --git a/src/utils/validation.ts b/src/utils/validation.ts index 55517f773..cb0d98fc7 100644 --- a/src/utils/validation.ts +++ b/src/utils/validation.ts @@ -1,4 +1,4 @@ -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; export function requireIntInRange(value: number, name: string, min: number, max: number): number { if (!Number.isFinite(value) || !Number.isInteger(value) || value < min || value > max) { diff --git a/src/utils/video.ts b/src/utils/video.ts index a5a9fe7d3..0d9524f71 100644 --- a/src/utils/video.ts +++ b/src/utils/video.ts @@ -1,5 +1,5 @@ import fs from 'node:fs'; -import { AppError } from '../kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { runCmd } from './exec.ts'; import { buildSwiftToolEnv, compileSwiftSourceText } from './swift-cache.ts'; import { sleep } from './timeouts.ts'; diff --git a/stryker.config.json b/stryker.config.json index 8768e845e..8513737ee 100644 --- a/stryker.config.json +++ b/stryker.config.json @@ -30,7 +30,7 @@ "break": null }, "mutate": [ - "src/kernel/errors.ts", + "packages/kernel/src/errors.ts", "src/daemon/ref-frame.ts", "src/commands/interaction/runtime/settle.ts", "src/utils/scroll-edge-state.ts", diff --git a/test/integration/interaction-contract/direct-ios-selector.contract.test.ts b/test/integration/interaction-contract/direct-ios-selector.contract.test.ts index 0ce303d69..bf971a063 100644 --- a/test/integration/interaction-contract/direct-ios-selector.contract.test.ts +++ b/test/integration/interaction-contract/direct-ios-selector.contract.test.ts @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import type { InteractionGuarantee } from '../../../src/contracts/interaction-guarantees.ts'; -import { AppError } from '../../../src/kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { assertRpcError, assertRpcOk } from '../provider-scenarios/assertions.ts'; import { scenarioName } from './coverage-manifest.ts'; import { DIRECT_IOS_SELECTOR_COVERAGE } from './direct-ios-selector.coverage.ts'; diff --git a/test/integration/interaction-contract/fixtures.ts b/test/integration/interaction-contract/fixtures.ts index 6aca9d2fe..7b6769a97 100644 --- a/test/integration/interaction-contract/fixtures.ts +++ b/test/integration/interaction-contract/fixtures.ts @@ -1,4 +1,4 @@ -import type { SnapshotState } from '../../../src/kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; import { makeSnapshotState } from '../../../src/__tests__/test-utils/index.ts'; /** diff --git a/test/integration/interaction-contract/maestro-fallback.contract.test.ts b/test/integration/interaction-contract/maestro-fallback.contract.test.ts index e4823d643..31e79a896 100644 --- a/test/integration/interaction-contract/maestro-fallback.contract.test.ts +++ b/test/integration/interaction-contract/maestro-fallback.contract.test.ts @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import type { InteractionGuarantee } from '../../../src/contracts/interaction-guarantees.ts'; -import { AppError } from '../../../src/kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { assertRpcError, assertRpcOk } from '../provider-scenarios/assertions.ts'; import { scenarioName } from './coverage-manifest.ts'; import { MAESTRO_FALLBACK_COVERAGE } from './maestro-fallback.coverage.ts'; diff --git a/test/integration/interaction-contract/native-ref.contract.test.ts b/test/integration/interaction-contract/native-ref.contract.test.ts index ecd75591a..5365e6780 100644 --- a/test/integration/interaction-contract/native-ref.contract.test.ts +++ b/test/integration/interaction-contract/native-ref.contract.test.ts @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import type { InteractionGuarantee } from '../../../src/contracts/interaction-guarantees.ts'; -import type { SnapshotState } from '../../../src/kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; import { ref } from '../../../src/commands/interaction/runtime/selector-read.ts'; import { scenarioName } from './coverage-manifest.ts'; import { buildInteractionResponseData } from '../../../src/daemon/handlers/interaction-touch-response.ts'; diff --git a/test/integration/interaction-contract/runtime-harness.ts b/test/integration/interaction-contract/runtime-harness.ts index 322c13691..74600ef17 100644 --- a/test/integration/interaction-contract/runtime-harness.ts +++ b/test/integration/interaction-contract/runtime-harness.ts @@ -1,5 +1,5 @@ import type { AgentDeviceBackend } from '../../../src/backend.ts'; -import type { SnapshotState } from '../../../src/kernel/snapshot.ts'; +import type { SnapshotState } from '@agent-device/kernel/snapshot'; import { createLocalArtifactAdapter } from '../../../src/io.ts'; import { createAgentDevice, diff --git a/test/integration/interaction-contract/runtime-ref.contract.test.ts b/test/integration/interaction-contract/runtime-ref.contract.test.ts index e43091346..4d3118ac5 100644 --- a/test/integration/interaction-contract/runtime-ref.contract.test.ts +++ b/test/integration/interaction-contract/runtime-ref.contract.test.ts @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import type { InteractionGuarantee } from '../../../src/contracts/interaction-guarantees.ts'; -import type { Point } from '../../../src/kernel/snapshot.ts'; +import type { Point } from '@agent-device/kernel/snapshot'; import { ref } from '../../../src/commands/interaction/runtime/selector-read.ts'; import { assertRpcOk } from '../provider-scenarios/assertions.ts'; import { scenarioName, scenarioNames } from './coverage-manifest.ts'; diff --git a/test/integration/interaction-contract/runtime-selector.contract.test.ts b/test/integration/interaction-contract/runtime-selector.contract.test.ts index 69bb59bfd..6fade22f9 100644 --- a/test/integration/interaction-contract/runtime-selector.contract.test.ts +++ b/test/integration/interaction-contract/runtime-selector.contract.test.ts @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import type { InteractionGuarantee } from '../../../src/contracts/interaction-guarantees.ts'; -import type { Point } from '../../../src/kernel/snapshot.ts'; +import type { Point } from '@agent-device/kernel/snapshot'; import { selector } from '../../../src/commands/interaction/runtime/selector-read.ts'; import { assertRpcOk } from '../provider-scenarios/assertions.ts'; import { scenarioName, scenarioNames } from './coverage-manifest.ts'; diff --git a/test/integration/nightly/concurrency-torture/bindings.ts b/test/integration/nightly/concurrency-torture/bindings.ts index 0105cedee..9bcb01d9e 100644 --- a/test/integration/nightly/concurrency-torture/bindings.ts +++ b/test/integration/nightly/concurrency-torture/bindings.ts @@ -18,7 +18,7 @@ // (by the deterministic scheduler) because `withKeyedLock`'s native microtask // hand-off cannot be reproduced from a seed. -import type { DeviceInfo } from '../../../../src/kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import type { CommandFlags } from '../../../../src/core/dispatch-context.ts'; import type { DaemonRequest } from '../../../../src/daemon/types.ts'; import type { SessionStore } from '../../../../src/daemon/session-store.ts'; diff --git a/test/integration/nightly/concurrency-torture/harness.ts b/test/integration/nightly/concurrency-torture/harness.ts index 0a1af6f3e..f6fcc4d79 100644 --- a/test/integration/nightly/concurrency-torture/harness.ts +++ b/test/integration/nightly/concurrency-torture/harness.ts @@ -25,11 +25,11 @@ import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import type { DeviceInfo } from '../../../../src/kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { LeaseRegistry } from '../../../../src/daemon/lease-registry.ts'; import { SessionStore } from '../../../../src/daemon/session-store.ts'; import type { SessionState } from '../../../../src/daemon/types.ts'; -import { AppError } from '../../../../src/kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { makePrng, type Prng } from './prng.ts'; import { diff --git a/test/integration/provider-scenarios/android-tv-remote.test.ts b/test/integration/provider-scenarios/android-tv-remote.test.ts index f6b0f8dd6..7844c8431 100644 --- a/test/integration/provider-scenarios/android-tv-remote.test.ts +++ b/test/integration/provider-scenarios/android-tv-remote.test.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; -import type { DeviceInfo } from '../../../src/kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import type { AndroidAdbProvider } from '../../../src/platforms/android/adb-executor.ts'; import { assertCommandCall } from './assertions.ts'; import { createProviderScenarioHarness, withProviderScenarioResource } from './harness.ts'; diff --git a/test/integration/provider-scenarios/daemon-http-server.test.ts b/test/integration/provider-scenarios/daemon-http-server.test.ts index 34882f863..572e7c376 100644 --- a/test/integration/provider-scenarios/daemon-http-server.test.ts +++ b/test/integration/provider-scenarios/daemon-http-server.test.ts @@ -5,7 +5,7 @@ import http from 'node:http'; import os from 'node:os'; import path from 'node:path'; import { test } from 'vitest'; -import { AppError } from '../../../src/kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { cleanupUploadedArtifact, prepareUploadedArtifact, diff --git a/test/integration/provider-scenarios/fixtures.ts b/test/integration/provider-scenarios/fixtures.ts index b6d56e891..21215af79 100644 --- a/test/integration/provider-scenarios/fixtures.ts +++ b/test/integration/provider-scenarios/fixtures.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import type { DeviceInfo } from '../../../src/kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; export const PROVIDER_SCENARIO_ANDROID: DeviceInfo = { platform: 'android', diff --git a/test/integration/provider-scenarios/interaction-direct-selector-fallback.test.ts b/test/integration/provider-scenarios/interaction-direct-selector-fallback.test.ts index d752213b6..76e13a508 100644 --- a/test/integration/provider-scenarios/interaction-direct-selector-fallback.test.ts +++ b/test/integration/provider-scenarios/interaction-direct-selector-fallback.test.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; -import { AppError } from '../../../src/kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { assertRpcError, assertRpcOk } from './assertions.ts'; import { PROVIDER_SCENARIO_IOS_SIMULATOR } from './fixtures.ts'; import { diff --git a/test/integration/provider-scenarios/ios-world.ts b/test/integration/provider-scenarios/ios-world.ts index c630fc3ae..8809718b0 100644 --- a/test/integration/provider-scenarios/ios-world.ts +++ b/test/integration/provider-scenarios/ios-world.ts @@ -2,7 +2,7 @@ import fs from 'node:fs'; import path from 'node:path'; import type { DeviceInventoryRequest } from '../../../src/core/dispatch-resolve.ts'; import { buildGesturePlan } from '../../../src/contracts/gesture-plan.ts'; -import type { RawSnapshotNode } from '../../../src/kernel/snapshot.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; import type { ProviderScenarioTranscript } from './transcript.ts'; import { createDemoIosApp, diff --git a/test/integration/provider-scenarios/linux-world.ts b/test/integration/provider-scenarios/linux-world.ts index 3767fa76c..f51235da7 100644 --- a/test/integration/provider-scenarios/linux-world.ts +++ b/test/integration/provider-scenarios/linux-world.ts @@ -2,7 +2,7 @@ import fs from 'node:fs'; import assert from 'node:assert/strict'; import { listLinuxDevices } from '../../../src/platforms/linux/devices.ts'; import { createLocalLinuxToolProvider } from '../../../src/platforms/linux/tool-provider.ts'; -import type { DeviceInfo } from '../../../src/kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { validPng } from './assertions.ts'; import { PROVIDER_SCENARIO_LINUX } from './fixtures.ts'; import { diff --git a/test/integration/provider-scenarios/provider-device-runtime.test.ts b/test/integration/provider-scenarios/provider-device-runtime.test.ts index d328280b3..7334c7791 100644 --- a/test/integration/provider-scenarios/provider-device-runtime.test.ts +++ b/test/integration/provider-scenarios/provider-device-runtime.test.ts @@ -14,7 +14,7 @@ import type { } from '../../../src/contracts/device-provider.ts'; import type { Interactor, SnapshotResult } from '../../../src/contracts/interactor-types.ts'; import type { DaemonRequest } from '../../../src/daemon/types.ts'; -import type { DeviceInfo } from '../../../src/kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { assertRpcError, assertRpcOk } from './assertions.ts'; import { createProviderScenarioHarness, diff --git a/test/integration/provider-scenarios/provider-ios-runner-transport.test.ts b/test/integration/provider-scenarios/provider-ios-runner-transport.test.ts index 0d30a652d..7d4890896 100644 --- a/test/integration/provider-scenarios/provider-ios-runner-transport.test.ts +++ b/test/integration/provider-scenarios/provider-ios-runner-transport.test.ts @@ -11,7 +11,7 @@ import type { } from '../../../src/contracts/device-provider.ts'; import type { Interactor, RunnerContext } from '../../../src/contracts/interactor-types.ts'; import type { DaemonRequest } from '../../../src/daemon/types.ts'; -import type { DeviceInfo } from '../../../src/kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { createAppleInteractor } from '../../../src/platforms/apple/interactor.ts'; import type { RunnerCommand } from '../../../src/platforms/apple/core/runner/runner-contract.ts'; import type { diff --git a/test/integration/provider-scenarios/provider-ios-selector-runtime.test.ts b/test/integration/provider-scenarios/provider-ios-selector-runtime.test.ts index 32e85d864..1a6dfae44 100644 --- a/test/integration/provider-scenarios/provider-ios-selector-runtime.test.ts +++ b/test/integration/provider-scenarios/provider-ios-selector-runtime.test.ts @@ -11,7 +11,7 @@ import type { } from '../../../src/contracts/device-provider.ts'; import type { Interactor, SnapshotResult } from '../../../src/contracts/interactor-types.ts'; import type { DaemonRequest } from '../../../src/daemon/types.ts'; -import type { DeviceInfo } from '../../../src/kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import { assertRpcOk } from './assertions.ts'; import { createProviderScenarioHarness, withProviderScenarioResource } from './harness.ts'; diff --git a/test/integration/provider-scenarios/remote-daemon-client.test.ts b/test/integration/provider-scenarios/remote-daemon-client.test.ts index dfea76fbf..d91c42a53 100644 --- a/test/integration/provider-scenarios/remote-daemon-client.test.ts +++ b/test/integration/provider-scenarios/remote-daemon-client.test.ts @@ -7,7 +7,7 @@ import { test } from 'vitest'; import { createAgentDeviceClient } from '../../../src/agent-device-client.ts'; import { prepareRemoteRequestArtifacts } from '../../../src/remote/daemon-artifacts.ts'; import { createDaemonProxyServer } from '../../../src/remote/daemon-proxy.ts'; -import { normalizeAgentDeviceError } from '../../../src/kernel/errors.ts'; +import { normalizeAgentDeviceError } from '@agent-device/kernel/errors'; import { closeLoopbackServer, listenOnLoopback, diff --git a/test/integration/provider-scenarios/remote-proxy-artifact-tenant.test.ts b/test/integration/provider-scenarios/remote-proxy-artifact-tenant.test.ts index 6d6213ae8..a03497add 100644 --- a/test/integration/provider-scenarios/remote-proxy-artifact-tenant.test.ts +++ b/test/integration/provider-scenarios/remote-proxy-artifact-tenant.test.ts @@ -10,7 +10,7 @@ import { } from '../../../src/daemon/artifact-tracking.ts'; import { finalizeDaemonResponse } from '../../../src/daemon/request-finalization.ts'; import { createDaemonHttpServer } from '../../../src/daemon/server/http-server.ts'; -import { normalizeAgentDeviceError } from '../../../src/kernel/errors.ts'; +import { normalizeAgentDeviceError } from '@agent-device/kernel/errors'; import { downloadRemoteArtifact } from '../../../src/remote/daemon-artifacts.ts'; import { createDaemonProxyServer } from '../../../src/remote/daemon-proxy.ts'; import { diff --git a/test/integration/provider-scenarios/transcript.ts b/test/integration/provider-scenarios/transcript.ts index 00313ac14..38d74bc2b 100644 --- a/test/integration/provider-scenarios/transcript.ts +++ b/test/integration/provider-scenarios/transcript.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { isDeepStrictEqual } from 'node:util'; -import type { Platform } from '../../../src/kernel/device.ts'; +import type { Platform } from '@agent-device/kernel/device'; export interface ProviderScenarioProviderScope { deviceId?: string; diff --git a/test/integration/provider-scenarios/vega-tv-remote.test.ts b/test/integration/provider-scenarios/vega-tv-remote.test.ts index ed556bbcb..e2086afef 100644 --- a/test/integration/provider-scenarios/vega-tv-remote.test.ts +++ b/test/integration/provider-scenarios/vega-tv-remote.test.ts @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import type { VegaTvRemoteKey } from '../../../src/contracts/tv-remote.ts'; -import type { DeviceInfo } from '../../../src/kernel/device.ts'; +import type { DeviceInfo } from '@agent-device/kernel/device'; import type { VegaToolProvider } from '../../../src/platforms/vega/tool-provider.ts'; import { assertRpcOk } from './assertions.ts'; import { createProviderScenarioHarness, withProviderScenarioResource } from './harness.ts'; diff --git a/test/integration/provider-scenarios/web-world.ts b/test/integration/provider-scenarios/web-world.ts index ac755fdd1..5112ee29f 100644 --- a/test/integration/provider-scenarios/web-world.ts +++ b/test/integration/provider-scenarios/web-world.ts @@ -1,6 +1,6 @@ import fs from 'node:fs'; import type { WebProvider } from '../../../src/platforms/web/provider.ts'; -import type { RawSnapshotNode } from '../../../src/kernel/snapshot.ts'; +import type { RawSnapshotNode } from '@agent-device/kernel/snapshot'; import { validPng } from './assertions.ts'; import { PROVIDER_SCENARIO_WEB } from './fixtures.ts'; import { createProviderScenarioHarness, type ProviderScenarioHarness } from './harness.ts'; diff --git a/test/output-economy/fixtures.ts b/test/output-economy/fixtures.ts index 3d98a6f64..f12197d3d 100644 --- a/test/output-economy/fixtures.ts +++ b/test/output-economy/fixtures.ts @@ -1,8 +1,8 @@ import type { CaptureSnapshotResult } from '../../src/contracts/client-capture.ts'; import type { CommandRequestResult } from '../../src/contracts/client-request.ts'; import type { DaemonResponseData } from '../../src/daemon/types.ts'; -import { AppError } from '../../src/kernel/errors.ts'; -import { attachRefs, type RawSnapshotNode } from '../../src/kernel/snapshot.ts'; +import { AppError } from '@agent-device/kernel/errors'; +import { attachRefs, type RawSnapshotNode } from '@agent-device/kernel/snapshot'; const SNAPSHOT_NODES: RawSnapshotNode[] = [ { diff --git a/test/output-economy/output-economy.baseline.test.ts b/test/output-economy/output-economy.baseline.test.ts index ebce9ca15..a798739a9 100644 --- a/test/output-economy/output-economy.baseline.test.ts +++ b/test/output-economy/output-economy.baseline.test.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { describe, expect, test } from 'vitest'; -import { defaultHintForCode, retriableForErrorCode } from '../../src/kernel/errors.ts'; +import { defaultHintForCode, retriableForErrorCode } from '@agent-device/kernel/errors'; import { runCmdSync } from '../../src/utils/exec.ts'; import { findEconomyBudgetIncreases, diff --git a/test/output-economy/render-fixtures.ts b/test/output-economy/render-fixtures.ts index f0a03e6ec..27332a53c 100644 --- a/test/output-economy/render-fixtures.ts +++ b/test/output-economy/render-fixtures.ts @@ -2,7 +2,7 @@ import { snapshotCliOutput } from '../../src/commands/capture/output.ts'; import { interactionCliOutputFormatters } from '../../src/commands/interaction/output.ts'; import type { AgentDeviceClient } from '../../src/client/client-types.ts'; import { RESPONSE_VIEWS } from '../../src/daemon/response-views.ts'; -import { normalizeError } from '../../src/kernel/errors.ts'; +import { normalizeError } from '@agent-device/kernel/errors'; import { createCommandToolExecutor } from '../../src/mcp/command-tools.ts'; import type { EconomySample } from './economy-metrics.ts'; import { renderRoutineWorkflow } from './routine-workflow.ts'; diff --git a/test/output-economy/routine-workflow.ts b/test/output-economy/routine-workflow.ts index 4cab0b070..1213fcd09 100644 --- a/test/output-economy/routine-workflow.ts +++ b/test/output-economy/routine-workflow.ts @@ -1,6 +1,6 @@ import type { CommandRequestResult } from '../../src/contracts/client-request.ts'; import type { AgentDeviceClient } from '../../src/client/client-types.ts'; -import { AppError, normalizeError, type NormalizedError } from '../../src/kernel/errors.ts'; +import { AppError, normalizeError, type NormalizedError } from '@agent-device/kernel/errors'; import { snapshotCliOutput } from '../../src/commands/capture/output.ts'; import { interactionCliOutputFormatters } from '../../src/commands/interaction/output.ts'; import { createCommandToolExecutor } from '../../src/mcp/command-tools.ts'; diff --git a/test/replay-compat/corpus.test.ts b/test/replay-compat/corpus.test.ts index c7f2bcf74..44697a092 100644 --- a/test/replay-compat/corpus.test.ts +++ b/test/replay-compat/corpus.test.ts @@ -4,7 +4,7 @@ import { readdirSync, readFileSync } from 'node:fs'; import { join } from 'node:path'; import { fileURLToPath } from 'node:url'; import { parseReplayInput } from '../../src/compat/replay-input.ts'; -import { AppError } from '../../src/kernel/errors.ts'; +import { AppError } from '@agent-device/kernel/errors'; import { REPLAY_COMPAT_CORPUS, REPLAY_COMPAT_RELEASED_TAGS, diff --git a/test/replay-compat/manifest.ts b/test/replay-compat/manifest.ts index d59bc5b8a..449c047a4 100644 --- a/test/replay-compat/manifest.ts +++ b/test/replay-compat/manifest.ts @@ -8,7 +8,7 @@ * `README.md`. */ -import type { AppErrorCode } from '../../src/kernel/errors.ts'; +import type { AppErrorCode } from '@agent-device/kernel/errors'; /** * Every release tag the corpus draws from. `pnpm check:replay-compat` verifies diff --git a/tsconfig.lib.json b/tsconfig.lib.json index 1664c6ccc..78766f4b0 100644 --- a/tsconfig.lib.json +++ b/tsconfig.lib.json @@ -1,11 +1,11 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "rootDir": "./src", + "rootDir": ".", "noEmit": false, "declaration": false, "emitDeclarationOnly": false }, - "include": ["src"], - "exclude": ["src/**/__tests__/**"] + "include": ["src", "packages"], + "exclude": ["src/**/__tests__/**", "packages/*/src/**/__tests__/**"] } diff --git a/tsdown.config.ts b/tsdown.config.ts index c3ddd9b89..bd3ef5866 100644 --- a/tsdown.config.ts +++ b/tsdown.config.ts @@ -13,12 +13,24 @@ const packageJson = JSON.parse( const publicSdkChunkGroups = [ [ 'sdk-contracts', - /src[\\/]kernel[\\/]contracts\.d\.[cm]?ts$/, - /src[\\/]kernel[\\/]contracts\.ts$/, + /packages[\\/]kernel[\\/]src[\\/]contracts\.d\.[cm]?ts$/, + /packages[\\/]kernel[\\/]src[\\/]contracts\.ts$/, + ], + [ + 'sdk-errors', + /packages[\\/]kernel[\\/]src[\\/]errors\.d\.[cm]?ts$/, + /packages[\\/]kernel[\\/]src[\\/]errors\.ts$/, + ], + [ + 'sdk-device', + /packages[\\/]kernel[\\/]src[\\/]device\.d\.[cm]?ts$/, + /packages[\\/]kernel[\\/]src[\\/]device\.ts$/, + ], + [ + 'sdk-snapshot', + /packages[\\/]kernel[\\/]src[\\/]snapshot\.d\.[cm]?ts$/, + /packages[\\/]kernel[\\/]src[\\/]snapshot\.ts$/, ], - ['sdk-errors', /src[\\/]kernel[\\/]errors\.d\.[cm]?ts$/, /src[\\/]kernel[\\/]errors\.ts$/], - ['sdk-device', /src[\\/]kernel[\\/]device\.d\.[cm]?ts$/, /src[\\/]kernel[\\/]device\.ts$/], - ['sdk-snapshot', /src[\\/]kernel[\\/]snapshot\.d\.[cm]?ts$/, /src[\\/]kernel[\\/]snapshot\.ts$/], ['sdk-io', /src[\\/]io\.d\.[cm]?ts$/, /src[\\/]io\.ts$/], ['sdk-batch', /src[\\/]batch-policy\.d\.[cm]?ts$/, /src[\\/]batch-policy\.ts$/], ['sdk-batch-runner', /src[\\/]core[\\/]batch\.d\.[cm]?ts$/, /src[\\/]core[\\/]batch\.ts$/], @@ -61,6 +73,7 @@ export default defineConfig({ 'internal/png-worker': 'src/utils/png-worker.ts', 'internal/update-check-entry': 'src/utils/update-check-entry.ts', }, + noExternal: [/^@agent-device\//], format: 'esm', platform: 'node', target: 'es2022', diff --git a/vitest.config.ts b/vitest.config.ts index 9745c9282..851d80722 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -53,6 +53,7 @@ export default defineConfig({ // unit suite without waking every ad-hoc *.test.ts under scripts/. include: [ 'src/**/*.test.ts', + 'packages/*/src/**/*.test.ts', 'scripts/__tests__/help-conformance-bench.test.ts', 'scripts/__tests__/help-conformance-error-recovery-coverage.test.ts', 'scripts/__tests__/help-conformance-sample-outputs.test.ts', @@ -114,7 +115,7 @@ export default defineConfig({ statements: 78, lines: 80, }, - include: ['src/**/*.ts'], + include: ['src/**/*.ts', 'packages/*/src/**/*.ts'], exclude: [ 'src/**/*.test.ts', 'src/**/__tests__/**', diff --git a/vitest.mutation.config.ts b/vitest.mutation.config.ts index 8f8cd7b87..9e464e91d 100644 --- a/vitest.mutation.config.ts +++ b/vitest.mutation.config.ts @@ -1,11 +1,26 @@ import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { defineConfig } from 'vitest/config'; +import { workspaceSpecifierTargets } from './scripts/layering/package-boundaries.ts'; import { readTestScope, threadHostileTestFiles } from './scripts/mutation/test-scope.ts'; import { SUBPROCESS_STUB_TESTS } from './vitest.config.ts'; const repoRoot = path.dirname(fileURLToPath(import.meta.url)); +// Workspace-package aliases for the Stryker sandbox (#1490 W0). Stryker copies +// the tree into .stryker-tmp and symlinks node_modules back to the real repo, +// so a `@agent-device/*` specifier resolved through pnpm's link escapes the +// sandbox: mutants written into the sandbox copy never load, and +// `vitest related` finds no tests for a mutated package file. Aliasing each +// EXPORTED specifier to its source file — resolved relative to this config, +// which Stryker copies into the sandbox — keeps resolution inside the mutated +// tree. Entries come from the shared exports-map reader, never a wildcard, so +// this cannot resolve package internals the boundary forbids (R11). +const workspaceAliases = [...workspaceSpecifierTargets(repoRoot)].map(([find, target]) => ({ + find, + replacement: path.join(repoRoot, target), +})); + // Test scope for the decision-kernel mutation lane (issue #1415). // // `scripts/mutation/run.ts` derives the per-run scope from Vitest's module graph @@ -18,6 +33,9 @@ const repoRoot = path.dirname(fileURLToPath(import.meta.url)); const scope = readTestScope(); export default defineConfig({ + resolve: { + alias: workspaceAliases, + }, test: { include: scope ?? ['src/**/*.test.ts'], exclude: [...SUBPROCESS_STUB_TESTS, ...threadHostileTestFiles(repoRoot), '**/node_modules/**'],