agent-device
Version:
Open source device layer for AI coding agents: a CLI, MCP server, and typed Node.js API to control mobile, web, TV, and desktop apps on devices and simulators, locally or in the cloud.
671 lines • 28.9 kB
TypeScript
import { B as SnapshotNode, D as PublicPlatform, F as Rect, G as SnapshotQualityVerdict, L as SnapshotCaptureScale, N as PresentedSurface, T as Platform, U as SnapshotPresentation, W as SnapshotQualityNote, h as ResponseCost, j as IosTargetActivation, q as SnapshotViewportSize, z as SnapshotKeyboardBandFact } from "./sdk-contracts.js";
//#region packages/contracts/src/snapshot-producers.d.ts
/**
* Every acquisition that can produce a snapshot tree, named for the source and never for the
* platform: one platform channel can be fed by several producers with different guarantees, and
* one producer can feed more than one channel (`appium-source` answers for WebDriver iOS and
* Android). Sharing a parser does not make two sources one producer.
*/
type SnapshotProducer = 'apple-runner' | 'simulator-ax-bridge' | 'appium-source' | 'revyl-ios-tree' | 'revyl-android-tree' | 'android-uiautomator' | 'cdp-dom' | 'harmonyos-uitest' | 'macos-helper' | 'linux-atspi' | 'agent-browser';
/**
* The closed backend vocabulary. A registry row may name only these channels, so a typo in a row
* fails to compile instead of becoming a new backend.
*/
declare const SNAPSHOT_BACKENDS: {
readonly xctest: true;
readonly android: true;
readonly 'harmonyos-arkui': true;
readonly 'macos-helper': true;
readonly 'linux-atspi': true;
readonly web: true;
};
type SnapshotBackend = keyof typeof SNAPSHOT_BACKENDS;
/**
* The one table of producer facts. Every other producer-keyed fact derives from it: the provenance
* pairs below, the iOS producer subsets (`ios-snapshot.ts`), truncation, residue,
* quiet time, ref minting, and producer warning dispatch. A new producer adds a row here and stamps
* its served identity through {@link stampSnapshotIdentity}.
*/
declare const SNAPSHOT_PRODUCERS: {
readonly 'apple-runner': {
readonly channels: readonly ["xctest"];
readonly truncation: 'available';
readonly residue: 'source-measured';
readonly quietMs: 500;
readonly refs: 'dense';
readonly sparseRootWarning: 'xctest-query';
};
readonly 'simulator-ax-bridge': {
readonly channels: readonly ["xctest"];
readonly truncation: 'available';
readonly residue: 'source-measured';
readonly quietMs: 300;
readonly refs: 'dense';
readonly sparseRootWarning: 'none';
};
readonly 'appium-source': {
readonly channels: readonly ["xctest", "android"];
readonly truncation: 'unavailable';
readonly residue: 'provider-derived';
readonly quietMs: 500;
readonly refs: 'dense';
readonly sparseRootWarning: 'appium-page-source';
};
readonly 'revyl-ios-tree': {
readonly channels: readonly ["xctest"];
readonly truncation: 'unavailable';
readonly residue: 'provider-derived';
readonly quietMs: 500;
readonly refs: 'dense';
readonly sparseRootWarning: 'none';
};
readonly 'revyl-android-tree': {
readonly channels: readonly ["android"];
readonly truncation: 'unavailable';
readonly residue: 'provider-derived';
readonly quietMs: 500;
readonly refs: 'dense';
readonly sparseRootWarning: 'none';
};
readonly 'android-uiautomator': {
readonly channels: readonly ["android"];
readonly truncation: 'available';
readonly residue: 'source-measured';
readonly quietMs: 500;
readonly refs: 'dense';
readonly sparseRootWarning: 'none';
};
readonly 'cdp-dom': {
readonly channels: readonly ["android"];
readonly truncation: 'available';
readonly residue: 'source-measured';
readonly quietMs: 500;
readonly refs: 'dense';
readonly sparseRootWarning: 'none';
};
readonly 'harmonyos-uitest': {
readonly channels: readonly ["harmonyos-arkui"];
readonly truncation: 'available';
readonly residue: 'source-measured';
readonly quietMs: 500;
readonly refs: 'dense';
readonly sparseRootWarning: 'none';
};
readonly 'macos-helper': {
readonly channels: readonly ["macos-helper"];
readonly truncation: 'available';
readonly residue: 'source-measured';
readonly quietMs: 500;
readonly refs: 'dense';
readonly sparseRootWarning: 'none';
};
readonly 'linux-atspi': {
readonly channels: readonly ["linux-atspi"];
readonly truncation: 'available';
readonly residue: 'source-measured';
readonly quietMs: 500;
readonly refs: 'dense';
readonly sparseRootWarning: 'none';
};
readonly 'agent-browser': {
readonly channels: readonly ["web"];
readonly truncation: 'available';
readonly residue: 'source-measured';
readonly quietMs: 500;
readonly refs: 'backend-issued';
readonly sparseRootWarning: 'none';
};
};
type SnapshotProducerRegistry = typeof SNAPSHOT_PRODUCERS;
type ProducerChannel<Producer extends SnapshotProducer> = SnapshotProducerRegistry[Producer]['channels'][number];
type ProducerOnChannel<Backend extends SnapshotBackend> = { [Producer in SnapshotProducer]: Backend extends ProducerChannel<Producer> ? Producer : never; }[SnapshotProducer];
/**
* The channel↔producer pairs that can actually occur, derived from {@link SNAPSHOT_PRODUCERS}.
* `xctest` trees come from the local Apple runner, the Simulator AX bridge, Appium page-source XML,
* or a cloud provider's AX element tree (Revyl), and only the runner's output has been through its
* presentation (clip fold, effective geometry, scope). Logic that assumes those guarantees must key
* on the producer, never on the channel alone.
*
* Every carrier embeds the pair atomically, so a cross-channel pair does not compile.
*/
type SnapshotProvenance = { [Backend in SnapshotBackend]: {
backend: Backend;
producer: ProducerOnChannel<Backend>;
}; }[SnapshotBackend];
//#endregion
//#region packages/contracts/src/snapshot-model.d.ts
type OptionalProducerProvenance<Pair> = Pair extends {
backend: infer Backend;
producer: infer Producer;
} ? {
backend: Backend;
producer?: Producer;
} : never;
/**
* The provenance carrier for {@link SnapshotState}: the producer may be absent (a client-side
* fallback that rebuilds a state from a bare backend result knows the channel and nothing more),
* but a present pair still has to come from the {@link SnapshotProvenance} table — the channel
* may not carry a foreign producer.
*/
type SnapshotStateProvenance = OptionalProducerProvenance<SnapshotProvenance> | {
backend?: undefined;
producer?: undefined;
};
type SnapshotState = {
nodes: SnapshotNode[];
createdAt: number;
truncated?: boolean;
snapshotQuality?: SnapshotQualityVerdict;
snapshotQualityNotes?: SnapshotQualityNote[];
comparisonSafe?: boolean;
presentationKey?: string;
/** The presentation this capture was taken with; absent means the default full tree. */
presentation?: SnapshotPresentation;
/** Opaque equality key for iOS acquisition and presentation lineage. */
comparisonKey?: string;
/**
* Android: the capture is an occluding system surface (notification shade, quick settings)
* rather than app content. Consumers that surface this tree to the agent must disclose the
* occlusion (see `@agent-device/contracts/android-system-surface-disclosure`).
*/
systemSurfaceOnly?: boolean;
/**
* Android: the producer proved this capture a complete read of the current hierarchy, taken after
* it cleared the platform node cache. Absent proves nothing.
*/
freshTraversal?: true;
/**
* iOS: the bundle id of the in-place system surface this capture describes (a web sign-in sheet
* presented over the app, #2438). Two captures that disagree here describe different surfaces and
* must never be compared as the same presentation; consumers that surface the tree disclose it.
*/
iosSystemSurfaceBundleId?: string;
/**
* iOS: whether this capture read a modal presentation over the app's own content (#3565), decided
* on the acquired tree before interactive filtering, compaction, depth, or scope, so every view of
* one screen carries one value. `'absent'` is read, never defaulted; an unreadable or unexplained
* capture answers `'unknown'`. Settle's presented-surface confirmation arms on this fact.
*/
presentedSurface?: PresentedSurface;
/**
* iOS and Android: keyboard observations made during acquisition. Measured and derived frames
* take precedence over reconstruction from the presented tree. Visibility-only and unknown facts
* carry no band; missing nodes or an omitted fact never establish absence.
*/
keyboard?: SnapshotKeyboardBandFact;
/**
* The box these rects are measured in, as the producer measured it (#3182). The state is the carrier
* the response reads, so the stored tree and the published `viewport` are one fact rather than two:
* a consumer of a stored capture — a later diff, a re-read of the session's tree — gets the box the
* producer measured instead of inferring one from the largest rect still on screen.
*/
viewport?: SnapshotViewportSize;
/**
* Screenshot pixels per rect unit, when the producer published one (a TV app page's CSS px). The
* state carries it beside `viewport` so every projection of a stored tree onto a capture uses the
* producer's scale. See {@link SnapshotCaptureScale}.
*/
captureScale?: SnapshotCaptureScale;
/**
* iOS: this capture's own command found the session app out of foreground and the runner
* activated it before answering, so an earlier observation in the session described whatever held
* the foreground instead (#2682). Consumers that surface this tree disclose the repair.
*/
targetActivation?: IosTargetActivation;
/** What post-gesture stabilization proved about the gesture before this capture. */
postGestureOutcome?: PostGestureOutcome;
} & SnapshotStateProvenance;
/** The gesture a post-gesture outcome fact names: the command and its positionals. */
type PostGestureAction = {
action: string;
positionals: string[];
};
/**
* `unsettled`: the surface was still changing when the stabilization deadline expired.
* `no-effect`: the settled surface still matches the pre-gesture tree (#1600).
* `loading`: an app launch's budget expired before its tree showed a first screen; the tree may be
* a launch or loading surface.
*/
type PostGestureOutcome = {
kind: 'unsettled' | 'no-effect' | 'loading';
gesture: PostGestureAction;
};
//#endregion
//#region packages/contracts/src/click-button.d.ts
declare const CLICK_BUTTONS: readonly ['primary', 'secondary', 'middle'];
type ClickButton = (typeof CLICK_BUTTONS)[number];
//#endregion
//#region packages/contracts/src/fill-evidence.d.ts
/**
* The evidence a `fill` carries when it changed a field but could not confirm the text it sent.
* Both the fill response and `Interactor.fill`'s return need these shapes, so they sit below both
* of those modules rather than in either. This is the cross-language shape, not a platform's probing:
* `packages/platform-android/src/fill-verification.ts` builds Android's copy of it, and the Apple
* runner's `RunnerTests+TextEntryConfirmation.swift` builds the iOS one.
*/
/** The field a fill aimed at, as the platform that performed it names it. */
type FillVerificationTarget = {
resourceId: string | null;
className: string | null;
packageName: string | null;
rect: Rect;
};
/**
* Target-bound read-back evidence when a fill could not confirm the requested text. The observed
* value may reflect app-owned formatting or altered input; this evidence makes no correctness
* claim. Bound to the {@link FillVerificationTarget} it was collected against so a different
* field cannot borrow the observation.
*/
type FillUnconfirmedVerification = {
verification: 'unconfirmed';
requested: string;
before: string | null;
after: string | null;
target: FillVerificationTarget;
};
//#endregion
//#region packages/contracts/src/interaction.d.ts
/** The decisive criterion separating a resolveSelectorChain winner from its strongest runner-up (ADR 0012). */
type DisambiguationTiebreak = 'visible' | 'deepest' | 'smallest-area' | 'structural-equivalence';
/**
* A disambiguation winner or losing alternative. `diagnosticRef` is an opaque,
* non-`@` token — never a snapshot ref, never issued via `refsGeneration`,
* never pinnable or usable as an `@ref` target. Strings are UTF-8 truncated
* to 256 bytes.
*/
type ResolutionDiagnosticEntry = {
diagnosticRef: string;
role?: string;
label?: string;
};
/**
* ADR 0012 decision 2: pre-action disclosure of how the acting path resolved
* its target, including each endpoint of a target-authored drag. Never ref-issuing.
* `direct-ios`/`not-observed` = the XCTest fast path has no daemon tree to
* report from; `ref`/`label-fallback` = a stale `@ref` recovered via
* first-match label lookup, never exact ref provenance. On the native-ref
* path the daemon preflight finds that label match, but the backend still
* dispatches the original ref; `alternatives` holds
* at most 5 losing candidates, winner excluded.
*/
type ResolutionDisclosure = {
source: 'runtime';
phase: 'pre-action';
kind: 'unique';
} | {
source: 'runtime';
phase: 'pre-action';
kind: 'disambiguated';
matchCount: number;
winnerDiagnostic: ResolutionDiagnosticEntry;
tiebreak: DisambiguationTiebreak;
alternatives: ResolutionDiagnosticEntry[];
} | {
source: 'ref';
phase: 'pre-action';
kind: 'exact';
} | {
source: 'ref';
phase: 'pre-action';
kind: 'label-fallback';
} | {
source: 'direct-ios';
kind: 'not-observed';
};
/**
* A post-action capture that describes a DIFFERENT surface than the pre-action baseline (#2438): an
* in-place iOS system surface (a web sign-in or Apple Pay sheet, hosted out of the app's process)
* was presented over the app, or left it. `from`/`to` name the two surfaces — a host bundle id, or
* `APP_SURFACE` (`@agent-device/contracts/ios-system-surface`) for ordinary app content.
*
* Its presence IS the refusal of a same-surface claim: the two captures are not one presentation,
* so `--verify` reports `changedFromBefore` from this transition instead of from a digest
* comparison across it, and `--settle` attaches no settled diff (and therefore no refs) across it.
*/
type PostActionSurfaceChange = {
from: string;
to: string;
/** The one agent-facing sentence for this transition (`@agent-device/contracts/ios-system-surface`). */
disclosure: string;
};
/**
* Opt-in (`--verify`) cheap post-condition evidence for mutating interaction
* commands (#1047). `digest`/`nodeCount`/`interactiveNodeCount` describe a single
* capture taken right after the action in the pre-action capture's view (interactive-only
* by default, #4486); `changedFromBefore` compares that digest against the pre-action
* capture the resolution path already held, so no extra device round trip is spent beyond
* the one verify capture.
* `changedFromBefore: false` is evidence, not failure — the command still
* succeeded.
*
* The field is ABSENT when no pre-action baseline was captured, so "no comparison
* was made" stays distinguishable from "nothing changed": a missing baseline must
* not read as an unchanged screen, because a coordinate tap that landed on
* nothing would otherwise report the same verdict as one that changed nothing.
*
* When `surfaceChange` is present the two captures describe different surfaces, so the digest
* comparison is not made at all: `changedFromBefore` then reports that transition, which replaced
* the whole observed surface.
*/
type InteractionEvidence = {
foregroundApp?: string;
nodeCount: number;
interactiveNodeCount: number;
digest: string;
changedFromBefore?: boolean;
surfaceChange?: PostActionSurfaceChange;
};
type SettleDiffLine = {
kind: 'added' | 'removed';
text: string;
/**
* Plain ref body (`e12`) for ADDED lines: minted from the settled tree that
* became the stored session snapshot, so it is immediately actionable and
* lets the MCP layer pin it at `refsGeneration`. Removed lines never carry
* one — their refs name nodes of the replaced tree.
*/
ref?: string;
};
/**
* One still-present, actionable element on the settled tree, surfaced by the
* unchanged-interactive tail (see `SettleObservation.tail`).
*/
type SettleTailEntry = {
ref: string;
role: string;
label?: string;
};
type SettleObservation = {
settled: boolean;
waitedMs: number;
captures: number;
quietMs: number;
timeoutMs: number;
/**
* The session's snapshot generation after the settled tree became the stored
* snapshot (#1076 versioned refs). Attached by the daemon response layer
* when `diff` is present: added lines carry refs minted from that tree, so
* the response is ref-issuing — the MCP layer merges per-ref pins from it
* exactly like snapshot/find responses.
*/
refsGeneration?: number;
/**
* Digest response view only: capped added-line refs preserved without the
* verbose diff line text, so MCP can still pin refs when `diff.lines` is
* intentionally omitted.
*/
refs?: Array<{
ref: string;
}>;
/**
* Present when the settled capture describes a different surface than the pre-action baseline
* (#2438). The settled tree then replaced the whole surface rather than changing within one, so
* `diff` is omitted: its lines (and their refs) would present a surface replacement as an
* in-surface change. `hint` says what to do instead.
*/
surfaceChange?: PostActionSurfaceChange;
/**
* Present only for `settled: true` observations that stored the settled tree, and never across a
* `surfaceChange` — a diff describes change WITHIN one surface.
*/
diff?: {
summary: {
additions: number;
removals: number;
unchanged: number;
};
lines: SettleDiffLine[];
/** Present (true) when lines were capped to the response bound. */
truncated?: boolean;
};
/**
* Unchanged interactive refs tail: benchmarks (July 2026) showed 27% of
* `--settle` actions were followed by a fallback `snapshot -i` because a
* change-only diff omits refs for elements that did not change — after a
* modal dismiss the diff shows only removals, and the next button to press
* (already on screen, untouched) is absent from the response. `tail` lists
* the settled tree's remaining uncovered interactive elements (excluding
* structural application/window chrome and the keyboard window's chrome)
* so the response stays actionable without that extra round trip. Attached
* ONLY when `diff` carries zero added-line refs naming a NEW target (the
* modal-dismiss/toast-only/fill signature) — a diff whose added refs hand
* the next target already pays its way, so the tail would be pure byte
* cost. Keyboard-chrome refs and self-echo refs (added lines whose node
* contains the action point: the acted-on element re-describing itself,
* e.g. a filled field re-labeled with its new value) do not count as new
* targets. Refs already present on `diff`'s added lines are excluded.
* Capped; `tailTruncated` marks when candidates exceeded the cap.
*/
tail?: SettleTailEntry[];
tailTruncated?: true;
hint?: string;
};
/**
* Public daemon response data shared by press/click/fill/longpress.
* `buildInteractionResponseData` emits this shape (ADR 0011 Layer 2):
* `targetKind` discriminates the resolved target, identity fields are FLAT
* (`ref`, `selector`, `x`, `y`), and per-command extras ride alongside.
*/
type TouchResponseDataBase = {
message?: string;
warning?: string;
x?: number;
y?: number;
referenceWidth?: number;
referenceHeight?: number;
evidence?: InteractionEvidence;
settle?: SettleObservation;
resolution?: ResolutionDisclosure;
cost?: ResponseCost;
/** Direct iOS Maestro coordinate-fallback signals. */
maestroNonHittableCoordinateFallbackAllowed?: boolean;
maestroNonHittableCoordinateFallbackUsed?: boolean;
maestroFallbackReason?: 'non-hittable-coordinate';
};
type TouchResponsePoint = TouchResponseDataBase & {
targetKind: 'point';
x: number;
y: number;
};
type TouchResponseRef = TouchResponseDataBase & {
targetKind: 'ref';
ref: string;
refLabel?: string;
selectorChain?: string[];
targetHittable?: boolean;
hint?: string;
};
type TouchResponseSelector = TouchResponseDataBase & {
targetKind: 'selector';
selector: string;
selectorChain?: string[];
refLabel?: string;
targetHittable?: boolean;
hint?: string;
};
type TouchPressExtras = {
button?: ClickButton;
count?: number;
intervalMs?: number;
holdMs?: number;
jitterPx?: number;
doubleTap?: boolean;
};
type PressCommandResponseData = (TouchResponsePoint & TouchPressExtras) | (TouchResponseRef & TouchPressExtras) | (TouchResponseSelector & TouchPressExtras);
type ClickCommandResponseData = PressCommandResponseData;
type TouchFillExtras = {
text: string;
delayMs?: number;
} & ({
verification?: never;
requested?: never;
before?: never;
after?: never;
target?: never;
} | FillUnconfirmedVerification);
type FillCommandResponseData = (TouchResponsePoint & TouchFillExtras) | (TouchResponseRef & TouchFillExtras) | (TouchResponseSelector & TouchFillExtras);
type TouchLongPressExtras = {
durationMs?: number;
gesture: 'longpress';
};
type LongPressCommandResponseData = (TouchResponsePoint & TouchLongPressExtras) | (TouchResponseRef & TouchLongPressExtras) | (TouchResponseSelector & TouchLongPressExtras);
type TouchHoverExtras = {
gesture: 'hover';
};
type HoverCommandResponseData = (TouchResponsePoint & TouchHoverExtras) | (TouchResponseRef & TouchHoverExtras) | (TouchResponseSelector & TouchHoverExtras);
/**
* Daemon response data for the `find` command. Read-only actions (`exists`,
* `wait`, `get_text`, `get_attrs`) may issue a pinnable ref with
* `refsGeneration`; mutating actions (`click`, `fill`, `focus`, `type`) carry
* `ref` as diagnostic pre-action identity and intentionally omit `refsGeneration`
* (ADR 0014). The shape is intentionally a flat, optional-field record because
* the action positional changes which fields are present.
*/
type FindCommandResponseData = {
ref?: string;
refsGeneration?: number;
found?: true;
waitedMs?: number;
text?: string;
node?: SnapshotNode;
/** Every match of the read-only `list` action (#1625), each ref pinnable at `refsGeneration`. A
* match on content the capture's producer issued no ref for carries none: readable, not pinnable. */
matches?: Array<{
ref?: string;
node: SnapshotNode;
}>;
locator?: string;
query?: string;
x?: number;
y?: number;
message?: string;
settle?: SettleObservation;
cost?: ResponseCost;
};
//#endregion
//#region packages/selectors/src/internal/parse.d.ts
type SelectorKey = 'id' | 'role' | 'text' | 'label' | 'value' | 'appname' | 'windowtitle' | 'visible' | 'hidden' | 'editable' | 'selected' | 'checked' | 'focused' | 'enabled' | 'hittable';
type SelectorTerm = {
key: SelectorKey;
value: string | boolean;
};
type Selector = {
raw: string;
terms: SelectorTerm[];
};
type SelectorChain = {
raw: string;
selectors: Selector[];
};
declare function parseSelectorChain(expression: string): SelectorChain;
declare function tryParseSelectorChain(expression: string): SelectorChain | null;
declare function isSelectorToken(token: string): boolean;
//#endregion
//#region packages/selectors/src/internal/public-resolution-types.d.ts
/** One per-alternative diagnostic returned by selector resolution. */
type SelectorDiagnostics = {
selector: string;
matches: number;
};
/**
* The disclosure for an ambiguous selector that was resolved by the heuristic;
* present only when the heuristic picked among N>1 matches (ADR 0012).
*/
type SelectorDisambiguationDisclosure<TNode extends SnapshotNode = SnapshotNode> = {
matchCount: number;
tiebreak: DisambiguationTiebreak;
/** Every losing matched node, document order, uncapped (response layer caps). */
alternatives: TNode[];
};
/**
* The options every selector lookup takes. Stated once here rather than inline
* per function so a façade wrapper and the parser-side function it forwards to
* cannot drift apart.
*/
type SelectorMatchOptions = {
platform: Platform | PublicPlatform;
requireRect?: boolean;
};
/** {@link SelectorMatchOptions} plus the uniqueness policy resolution adds. */
type SelectorResolutionOptions = SelectorMatchOptions & {
requireUnique?: boolean;
disambiguateAmbiguous?: boolean;
};
//#endregion
//#region packages/selectors/src/internal/resolve.d.ts
/**
* The parser-side twin of the façade's `SelectorResolution`: identical except
* that the winning alternative is the `Selector` node itself, which the façade
* flattens to its `raw` text before any consumer sees it. Only the fields that
* differ are restated; everything else is shared with
* `public-resolution-types.ts`.
*/
type AstSelectorResolution = {
node: SnapshotNode;
selector: Selector;
selectorIndex: number;
matches: number;
diagnostics: SelectorDiagnostics[];
disambiguation?: SelectorDisambiguationDisclosure;
};
declare function resolveSelectorChain(nodes: SnapshotState['nodes'], chain: SelectorChain, options: SelectorResolutionOptions): AstSelectorResolution | null;
/** The parser-side twin of the façade's `SelectorChainMatchList`. */
type AstSelectorChainMatchList = {
selector: Selector;
selectorIndex: number;
matchedNodes: SnapshotNode[];
};
/**
* Every node the winning chain alternative matches, in snapshot order, plus
* that alternative and its index; `null` when no alternative matches.
*
* "Winning" is the SAME alternative `findSelectorChainMatch` picks — the first
* with at least one match — decoupled from uniqueness and disambiguation:
* several matches are reported, never refused or narrowed to one. That is NOT
* always what `resolveSelectorChain` names: under its default
* `requireUnique: true` it skips an ambiguous alternative and resolves from a
* later one, so the indices agree when it passes `requireUnique: false`, when
* the first matching alternative is unique, or when `disambiguateAmbiguous:
* true` resolves that alternative in place (see `firstMatch` vs `matchedNodes`
* above). Published through `agent-device/selectors` (#3180) so a consumer
* applies its OWN strictness to the same matched-node domain the daemon
* resolves against, instead of reimplementing term matching.
*
* ADR 0012 migration step 4 kept this mirroring `analyzeSelectorMatches`'s
* alternate-selection exactly, so a replay-time verifier computes `matchCount`
* and the recorded-identity set over the SAME domain resolution itself used.
*/
declare function listSelectorChainMatches(nodes: SnapshotState['nodes'], chain: SelectorChain, options: SelectorMatchOptions): AstSelectorChainMatchList | null;
/**
* A first-match lookup used by existence checks. No façade twin: the root
* façade resolves through the policy interface only, so this shape reaches
* consumers via the published `./ast` surface alone (#1630).
*/
type AstSelectorChainMatch = {
selectorIndex: number;
selector: Selector;
matches: number;
diagnostics: SelectorDiagnostics[];
};
declare function findSelectorChainMatch(nodes: SnapshotState['nodes'], chain: SelectorChain, options: SelectorMatchOptions): AstSelectorChainMatch | null;
//#endregion
//#region packages/selectors/src/internal/node.d.ts
declare function isNodeVisible(node: SnapshotNode): boolean;
/**
* False for a disabled node. Otherwise the node's published `editable` fact decides, and the
* platform type decides only when the snapshot carries no such fact.
*/
declare function isNodeEditable(node: SnapshotNode, platform: Platform | PublicPlatform): boolean;
//#endregion
//#region packages/selectors/src/ast.d.ts
/**
* The published signature takes a parsed chain or the raw text it came from;
* the engine only ever needs the text. Kept here rather than widening
* `internal/resolve.ts` back to a union, so the compatibility obligation sits
* at the boundary that owes it.
*/
declare function formatSelectorFailure(chain: SelectorChain | string, diagnostics: SelectorDiagnostics[], options: {
unique?: boolean;
}): string;
//#endregion
export { SnapshotProvenance as C, SnapshotProducerRegistry as S, PressCommandResponseData as _, listSelectorChainMatches as a, PostGestureOutcome as b, SelectorChain as c, tryParseSelectorChain as d, ClickCommandResponseData as f, LongPressCommandResponseData as g, HoverCommandResponseData as h, findSelectorChainMatch as i, isSelectorToken as l, FindCommandResponseData as m, isNodeEditable as n, resolveSelectorChain as o, FillCommandResponseData as p, isNodeVisible as r, SelectorDiagnostics as s, formatSelectorFailure as t, parseSelectorChain as u, SettleObservation as v, SnapshotState as x, ClickButton as y };