mirror of
https://github.com/callstack/agent-device.git
synced 2026-09-14 20:06:34 +08:00
3937036e5e
* feat: support --settle on scroll and back (#1638) Scroll-then-observe and back-then-observe are legitimate agent pairs, but the post-action observation registry never grew past the touch commands, so `--settle` on either was rejected with INVALID_ARGS — burning a tool call each in AppControlBench's bsky-16. Both commands now carry the `settle` descriptor trait, and every surface derives from it rather than a hand list: CLI allowed flags, MCP/SDK input fields, the flag-sourced timeout envelope, and MCP ref-pinning. The CLI flag/metadata helpers moved out of the interaction family into post-action-observation-grammar.ts (back is a system command), and SETTLE_REF_ISSUING_TOOLS became a derivation — a hand list would have silently stopped pinning the new commands' refs. settleAfterInteraction and the new settleObservationCommand are two entry points over one engine: same loop, storage, hints, and diff bounds, with the target-less path supplying its own baseline and no proximity point. The daemon reaches that command through the runtime surface, never by importing `commands/` (R2) — the same seam the touch handlers use for press/fill — and generic-settle.ts is loaded through a lazy `await import` returning a closure, so the interaction runtime subgraph stays out of this dispatcher's static graph (a static edge folded ~18 files into the daemon-server type cycle; R10 caught it). Both of generic-settle's orderings are load-bearing and tested: the baseline is frozen before dispatch (and before the Android dialog preflight), and the observation runs after markDeferredInteractionOutcome so settle's first capture folds in the #1542 stabilization rather than racing it. The ADR 0014 "a settled diff publishes refs" rule moved to settle-ref-issuance.ts, shared by both routes. One divergence is deliberate: scroll/back resolve no element, so the diff baseline is the session's STORED pre-action tree — "settled tree vs the last tree you observed" — not press's freshly resolved pre-action capture. Both commands also switch to preserve-daemon on timeout, which changes the non-settle path too: with --settle their dominant hang mode is now a wedged accessibility bridge, and a timed-out capture must not reset the daemon and lose every session (#1105). The reviewed-set gate records it. Live-validated on an iOS 26.2 simulator (Settings): scroll --settle settled in 1786ms with a +6/-6 diff carrying fresh refs; back --settle in 771ms with +15/-6. Alternating cost runs, one call vs the pair it replaces: scroll 2.9-3.0s vs 5.3-5.6s, back 3.1-3.2s vs 4.7-5.1s. Those include the #1627 deep-capture extension. * fix: render settled-diff refs paste-ready in CLI output A settled diff activates a PARTIAL ref frame (ADR 0014), which admits only the pinned `@eN~s<gen>` form of the refs it issued. The unchanged-interactive tail already rendered that way, but the diff's own added lines rendered the bare `@eN` embedded in the snapshot line — so a CLI caller who copied the ref the diff just handed them got `plain_ref_requires_complete_frame` and had to append the generation by hand. Added lines now render pinned when the response carries `refsGeneration`, exactly like the tail. Removed lines render verbatim: they name elements that just left the screen, and `SettleDiffLine` never gives them a ref. This is not new to scroll/back — press/click/fill/longpress had the same gap since #1101. MCP was never affected: its ref-pin store rewrites plain refs on the way in, which is why the model never sees a suffix. Live: `scroll down --settle` now emits `+ @e14~s218078 [cell] "Game Center"`, and `press @e14~s218078` copied straight out of that line taps successfully. * test: record the pinned-diff-ref bytes in the output-economy baseline Rendering added diff-line refs pinned costs 8 bytes in the two settle CLI text samples (two `~s<gen>` suffixes). The output-economy baseline is the tripwire for exactly this, so the increase takes an explicit reviewed waiver rather than a silent baseline bump — the same one the settled TAIL's pins already carry, for the same ADR 0014 reason. Only `bytes` moves: lines, refs, hints, and shape are unchanged, which is the evidence that this is a suffix on existing refs and not a new payload. Caught by CI, not locally: `pnpm test:unit` runs unit-core and subprocess-stub only, while the Coverage lane runs every vitest project. * test: prove the generic settle degrades when its runtime cannot be built `createGenericSettleRuntime` catches and returns undefined so an observation that cannot even start does not fail an action that already succeeded. That was a claim in a docstring with nothing behind it — the one changed line the coverage gate reported uncovered (95/96). The test puts the session in the state the catch exists for: the router handed us a session that is no longer in the store, so building the settle runtime throws SESSION_NOT_FOUND. The response keeps its scroll result and simply carries no settle payload. Removing the try/catch fails it. * build: teach fallow that vi.mock reaches pinOwnProcessStartTime dynamically Not from this PR: #1642 added `pinOwnProcessStartTime` on main, and its three consumers reach it the only way a Vitest module mock can — `vi.mock(path, async (importOriginal) => (await import('...')).pinOwnProcessStartTime(...))`. Dependency analysis cannot follow that dynamic import to a consumer, so the export reads as dead the moment any PR pulls that file into its audit scope. This PR is the one that did. The entry records the consumers by path and the reason, matching the daemon route-handler entry directly above it, which exists for the same dynamic-`import()` limitation. * refactor: adopt the best of the parallel #1653 implementation Two sessions independently built #1638 (PR #1650 and PR #1653) and converged on the same architecture — trait in the registry, one engine with two entry points, runtime-command seam, lazy import, preserve-daemon, stored-baseline honesty. #1650 continues; this folds in what #1653 did better: - The agent-facing help core loop (cli-help.ts) now names scroll and back as settle-capable. Without this, the benchmarked closed-grammar help line kept instructing agents that --settle is only for press/click/fill/longpress — actively steering the AppControlBench models away from what #1638 shipped. - issueSettleRefs moves into session-snapshot.ts, beside the partial-frame primitive it wraps, deleting the single-function settle-ref-issuance module. - Their seam tests: back reader→writer settle plumbing, back CLI settle rendering, and a trait-less generic command (home) ignoring a stray settle flag rather than observing or rejecting. What #1650 had that #1653 lacked, for the record: the SETTLE_REF_ISSUING_TOOLS registry derivation (without it, MCP never pins a scroll/back settle diff's refs and the partial frame rejects every follow-up), BackCommandResult.settle in contracts, back's MCP output schema, paste-ready pinned diff refs, and the docs/changelog/baseline surfaces. * bench: help-conformance case for settled scroll-to-find planning The #1638 extension of the closed --settle grammar to scroll/back is the feature's entire payoff — collapsing scroll-then-observe into one call — and the closed command list is an enumerated N whose enumerator is this bench. The regex over the help text proves the sentence exists; this case checks whether a model plans differently because of it. One focused case, deliberately not coached: a pinned visible-first snapshot (rendered by formatSnapshotText, pinned by the sample-producers gate) whose wanted row is summarized off-screen with no ref anywhere in the output. The tempting pre-#1638 plan is `scroll` plus a separate `snapshot -i`; acceptance is the single settled call. Scoring was verified against eight plan shapes in both directions before recording. Model-backed record (claude-haiku-4-5, 3 trials, current help): 0/3 — but the decomposition is the finding. Settle eligibility GENERALIZED (3/3 trials put --settle on scroll unprompted; the mutation-suffix framing concern did not materialize) and the two-call habit is residual (1/3). All three trials failed on `scroll @e3 down --settle` — the pre-existing #1366 scroll-takes-no-target confusion, which the live CLI recovers with a dedicated hint but a single-shot bench cannot. The recorded gap is therefore a first-30 doc gap (nothing teaches that scroll takes no target), not a settle-eligibility gap; tuning the case until it passes would just delete the evidence.
215 lines
12 KiB
JSON
215 lines
12 KiB
JSON
{
|
|
"$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",
|
|
"src/sdk/metro.ts",
|
|
"src/sdk/remote-config.ts",
|
|
"src/sdk/install-source.ts",
|
|
"src/sdk/android-adb.ts",
|
|
"src/sdk/contracts.ts",
|
|
"src/sdk/selectors.ts",
|
|
"src/sdk/finders.ts",
|
|
"src/bin.ts",
|
|
"src/client/companion-tunnel.ts",
|
|
"src/daemon.ts",
|
|
"src/utils/png-worker.ts",
|
|
"scripts/patch-xcuitest-runner-icon.ts",
|
|
"scripts/runner-request-count/run.ts",
|
|
"scripts/lib/contention-retry-run.ts",
|
|
"scripts/vitest-runner-timeout-setup.ts",
|
|
"test/contention-retry-fixtures/vitest.fixture.config.ts",
|
|
"test/contention-retry-fixtures/timeout-provenance.fixture.ts",
|
|
// #1596 regression fixture: runs as a real `node --experimental-strip-types`
|
|
// subprocess (test/integration/daemon-replace-exit-flush.test.ts), so
|
|
// dependency analysis cannot follow the runCmdSync string path to it.
|
|
"test/integration/support/exit-after-flush.ts",
|
|
"src/utils/update-check-entry.ts",
|
|
"examples/sdk/client-session.ts",
|
|
"examples/sdk/metro-runtime.ts",
|
|
"examples/sdk/contracts-result.ts",
|
|
"examples/sdk/batch-orchestration.ts",
|
|
"test/scripts/metro-prepare-packaged-smoke.mjs",
|
|
"test/integration/*.test.ts",
|
|
"website/docs/404.mdx",
|
|
"website/rspress.config.ts"
|
|
],
|
|
"ignorePatterns": [
|
|
"examples/test-app/**",
|
|
"scripts/perf/**",
|
|
"scripts/layering/**",
|
|
"scripts/maestro-conformance/corpus/**",
|
|
"apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests.xctestplan",
|
|
"scripts/write-xcuitest-cache-metadata.mjs",
|
|
"scripts/help-conformance-sample-outputs.d.mts"
|
|
],
|
|
"ignoreDependencies": [
|
|
"@theme",
|
|
// @agent-device/maestro owns the source import, while the published root
|
|
// build externalizes yaml and retains runtime imports in packed chunks.
|
|
"yaml",
|
|
// @agent-device/provider-limrun owns the source import, while the published
|
|
// root build externalizes @limrun/api and retains runtime imports in packed chunks.
|
|
"@limrun/api",
|
|
// Packaging linters with no importable API surface here: scripts/check-package.ts runs their
|
|
// `node_modules/.bin` shims as subprocesses, which dependency analysis cannot follow to an import.
|
|
"publint",
|
|
"@arethetypeswrong/cli"
|
|
],
|
|
"ignoreExports": [
|
|
{
|
|
"comment": "Daemon route handlers are reached only through the dynamic `import()` table in request-handler-chain.ts, which --production analysis cannot follow to a consumer.",
|
|
"file": "src/daemon/handlers/{lease,session,snapshot,react-native,record-trace,find,interaction}.ts",
|
|
"exports": [
|
|
"handleLeaseCommands",
|
|
"handleSessionCommands",
|
|
"handleSnapshotCommands",
|
|
"handleReactNativeCommands",
|
|
"handleRecordTraceCommands",
|
|
"handleFindCommands",
|
|
"handleInteractionCommands"
|
|
]
|
|
},
|
|
{
|
|
"comment": "Published package surface (see package.json#exports); consumed by SDK users, not internally.",
|
|
"file": "src/sdk/*.ts",
|
|
"exports": ["*"]
|
|
},
|
|
{
|
|
"comment": "#1642: its three consumers (src/__tests__/cli-device-status.test.ts, src/daemon/__tests__/device-claims.test.ts, src/daemon/__tests__/device-claim-prune.test.ts) all reach it the only way a Vitest module mock can — `vi.mock(path, async (importOriginal) => (await import('...host-process-mock.ts')).pinOwnProcessStartTime(importOriginal))`. Dependency analysis cannot follow that dynamic import to a consumer, the same limitation the daemon route-handler entry above records.",
|
|
"file": "src/__tests__/test-utils/host-process-mock.ts",
|
|
"exports": ["pinOwnProcessStartTime"]
|
|
},
|
|
{
|
|
"comment": "Tool config default exports, loaded by the tool rather than imported.",
|
|
"file": "{tsdown.config.ts,vitest.mutation.config.ts,website/rspress.config.ts}",
|
|
"exports": ["default"]
|
|
},
|
|
{
|
|
"comment": "Type-level `AssertTrue<...>` registry-totality guards. Exported only so `noUnusedLocals` keeps them alive; a consumer would defeat the point.",
|
|
"file": "{src/core/command-descriptor/registry.ts,src/core/interactors/register-builtins.ts,src/core/platform-descriptor/registry.ts,src/daemon/request-platform-providers.ts}",
|
|
"exports": [
|
|
"CommandOwnerFileClaimsAreComplete",
|
|
"BuiltinPluginsCoverAllPlatforms",
|
|
"PlatformDescriptorsAreTotal",
|
|
"GatedKeysAreResolverKeys"
|
|
]
|
|
},
|
|
{
|
|
"comment": "Contention retry lane (#1419): the reporter default is loaded by Vitest from a `--reporter=<path>` string, and SUBPROCESS_STUB_TESTS is consumed by vitest.config.ts \u2014 a tool config outside --production analysis.",
|
|
"file": "scripts/lib/{contention-retry.ts,contention-retry-reporter.ts}",
|
|
"exports": ["default", "SUBPROCESS_STUB_TESTS"]
|
|
},
|
|
{
|
|
"comment": "Contention retry gate fixtures (#1419): the config default is loaded by the child `vitest run --config` the gate test spawns.",
|
|
"file": "test/contention-retry-fixtures/vitest.fixture.config.ts",
|
|
"exports": ["default"]
|
|
},
|
|
{
|
|
"comment": "Mutation-lane seam: readTestScope is consumed by vitest.mutation.config.ts, a tool config outside --production analysis.",
|
|
"file": "scripts/mutation/test-scope.ts",
|
|
"exports": ["readTestScope"]
|
|
},
|
|
{
|
|
"comment": "Mutation-lane completeness gate: ownedTestFiles enumerates the whole derived ownership map, which only the assertion in ownership.test.ts consumes — a production consumer would defeat the point.",
|
|
"file": "scripts/mutation/ownership.ts",
|
|
"exports": ["ownedTestFiles"]
|
|
},
|
|
{
|
|
"comment": "ADR 0010 shared-hint pin: the facade re-export's only consumer is src/__tests__/is-argument-surface-parity.test.ts, which asserts the daemon and CLI `is` surfaces raise the SAME hint text. The constant is live inside the package (predicates.ts raises it); a production consumer of the re-export would defeat the point, since it exists so neither surface copies the string.",
|
|
"file": "packages/selectors/src/index.ts",
|
|
"exports": ["IS_PREDICATE_USAGE_HINT"]
|
|
},
|
|
{
|
|
"comment": "Help-benchmark conformance seams: helpTopicIds feeds the topic-coverage gate and PRIVATE_AX_RECOVERY_SAMPLE feeds the bench sample producers; both consumers are test-tree files outside --production analysis.",
|
|
"file": "{src/cli/parser/cli-help.ts,scripts/help-conformance-sample-outputs.mjs}",
|
|
"exports": ["helpTopicIds", "PRIVATE_AX_RECOVERY_SAMPLE"]
|
|
},
|
|
{
|
|
"comment": "#1458: getSessionCommandKind's former production consumer (the session.ts if-chain) was replaced by SESSION_COMMAND_HANDLER_IMPLS, which encodes command-kind groupings directly via shared handler references instead of a kind lookup. The accessor and its SessionCommandKind classification remain covered by daemon-command-registry.test.ts, a test-tree file outside --production analysis.",
|
|
"file": "src/daemon/daemon-command-registry.ts",
|
|
"exports": ["getSessionCommandKind"]
|
|
},
|
|
{
|
|
"comment": "Workspace-package symbols whose only consumers are test-tree files, which --production analysis does not see. Each import is the package specifier, so the façade entry is load-bearing: parseTargetAnnotationV1Payload/TARGET_ANNOTATION_MAX_FIELD_BYTES from src/daemon/__tests__/session-target-evidence.test.ts, MAESTRO_COMPAT_* from src/cli/parser/__tests__/maestro-support-matrix.test.ts.",
|
|
"file": "packages/{ad-script,maestro}/src/index.ts",
|
|
"exports": [
|
|
"parseTargetAnnotationV1Payload",
|
|
"TARGET_ANNOTATION_MAX_FIELD_BYTES",
|
|
"MAESTRO_COMPAT_LIMITATIONS",
|
|
"MAESTRO_COMPAT_SUPPORTED_CAPABILITIES"
|
|
]
|
|
},
|
|
{
|
|
"comment": "Deliberately kept off the @agent-device/maestro façade (index.test.ts asserts its absence) and consumed only by the conformance harness under packages/maestro/test/.",
|
|
"file": "packages/maestro/src/internal/program-ir-command-parser.ts",
|
|
"exports": ["SUPPORTED_MAESTRO_COMMAND_NAMES"]
|
|
},
|
|
{
|
|
"comment": "Published type surface: re-exported by src/sdk/limrun.ts to agent-device/limrun, where test/integration/limrun-public-types.test.ts pins that consumers can import it. Its only importer compiles in a temp checkout, so no static in-repo edge reaches it — the same reason src/sdk/*.ts is exempt above.",
|
|
"file": "packages/provider-limrun/src/index.ts",
|
|
"exports": ["LimrunIosCommandExecution"]
|
|
},
|
|
{
|
|
"comment": "Converting the contracts façades from `export *` to explicit named re-exports (the pin-table retirement) made these individually visible to --production analysis for the first time; a bare star previously hid them from this exact check. GESTURE_INITIAL_ANGLE_DEGREES/GESTURE_SAMPLE_INTERVAL_MS/INTERACTION_GUARANTEES/INTERACTION_PATH_IDS/parseAndroidInputMethodPackage/isRecordingExportQuality have same-package test-tree consumers (invisible to --production, mirroring the packages/{ad-script,maestro} entry above); the rest currently have none. Kept rather than narrowed here so the façade's re-export surface stays byte-identical to the symbol set the retired pin table asserted — narrowing the surface is a follow-up with its own review, not a side effect of this mechanical conversion. The last five (COORDINATE_GESTURE_KINDS, normalizePublicGesture, DEFAULT_DRAG_*) are #1567's drag vocabulary, surfaced the same way by the same conversion and kept for the same reason.",
|
|
"file": "packages/contracts/src/facades/{client,command,divergence,interaction,platform,recording}.ts",
|
|
"exports": [
|
|
"isRecord",
|
|
"IOS_SAFARI_BUNDLE_ID",
|
|
"REPLAY_DIVERGENCE_DEFAULT_REF_LIMIT",
|
|
"REPLAY_DIVERGENCE_DIGEST_REF_LIMIT",
|
|
"REPLAY_DIVERGENCE_LEVEL_BYTE_LIMITS",
|
|
"applyReplayDivergenceLevelCaps",
|
|
"measureReplayDivergenceBytes",
|
|
"sanitizeReplayDivergenceField",
|
|
"truncateUtf8Field",
|
|
"GESTURE_DURATION_MAX_MS",
|
|
"GESTURE_INITIAL_ANGLE_DEGREES",
|
|
"GESTURE_SAMPLE_INTERVAL_MS",
|
|
"INTERACTION_GUARANTEES",
|
|
"INTERACTION_PATH_IDS",
|
|
"buildSwipePresetGesturePlan",
|
|
"clampGestureCoordinate",
|
|
"gestureDirectionDelta",
|
|
"parseAndroidInputMethodPackage",
|
|
"isRecordingExportQuality",
|
|
"COORDINATE_GESTURE_KINDS",
|
|
"normalizePublicGesture",
|
|
"DEFAULT_DRAG_DESTINATION_HOLD_MS",
|
|
"DEFAULT_DRAG_MOVE_MS",
|
|
"DEFAULT_DRAG_SOURCE_HOLD_MS"
|
|
]
|
|
}
|
|
],
|
|
"usedClassMembers": ["name", "listActiveLeases", "delete", "values", "elapsedMs", "isExpired"],
|
|
"rules": {
|
|
"unused-types": "error",
|
|
"duplicate-exports": "off"
|
|
},
|
|
"overrides": [
|
|
{
|
|
"comment": "unused-types counts importers, not signature reachability. A façade names every type its re-exported functions/values put in a public signature, and callers use those types structurally without ever importing the name — the same false-positive shape already fixed for other workspace-package façades. unused-exports (a VALUE check) stays on for this glob; that is what would catch a real leak.",
|
|
"files": ["packages/contracts/src/facades/*.ts"],
|
|
"rules": {
|
|
"unused-types": "off"
|
|
}
|
|
}
|
|
],
|
|
"production": {
|
|
"dupes": true
|
|
},
|
|
"publicPackages": ["agent-device"],
|
|
"audit": {
|
|
"deadCodeBaseline": "fallow-baselines/dead-code.json",
|
|
"healthBaseline": "fallow-baselines/health.json"
|
|
},
|
|
"includeEntryExports": true,
|
|
"ignoreExportsUsedInFile": {
|
|
"type": true,
|
|
"interface": true
|
|
}
|
|
}
|