/** * Capture Agent — Action Verifier * * Post-action validation: diff AKTree before/after an action * to detect whether the action had a real effect or was intercepted. */ import type { RuntimeAdapter } from './execution-types.js'; export interface ActionVerification { /** Whether the action caused a detectable change */ hadEffect: boolean; /** What changed */ changes: ActionChange[]; /** Summary for logging */ summary: string; /** * AUT-240 (decision 2): the after-state was unreadable even after a settle + * retry, so the effect was assumed as a last resort. The capture this taints * is flagged low-confidence rather than failed. */ lowConfidence?: boolean; } export type ActionChangeKind = 'url_changed' | 'tree_structure_changed' | 'node_appeared' | 'node_disappeared' | 'node_state_changed' | 'scroll_changed' | 'overlay_changed' | 'no_change'; export interface ActionChange { kind: ActionChangeKind; detail: string; } /** * Captures AKTree state before and after an action to detect changes. */ /** * F2: outcome of a SET_THEME / SET_LOCALE effect probe. These opcodes used to * report clean success even when the app ignored the requested theme/locale * (e.g. an app that themes via a `class`/`data-theme`/storage key but never * reads `prefers-color-scheme`). The probe reads back an observable signal from * the live AKTree — node styling for theme, visible text for locale — and, when * no change is observed (or the signal can't be read), flags the result * low-confidence. It NEVER hard-fails: a missing signal only downgrades trust. */ export interface ThemeLocaleEffectResult { /** Whether a deterministic, observable change confirmed the effect applied. */ observed: boolean; /** Human-readable reason for logging / low-confidence attribution. */ summary: string; } export declare class ActionVerifier { private beforeTree; private beforeUrl; /** F2: pre-action signal for SET_THEME (style) / SET_LOCALE (text). */ private themeLocaleBaseline; captureBeforeState(adapter: RuntimeAdapter): Promise; verifyAfterAction(adapter: RuntimeAdapter): Promise; /** * F2: capture the pre-action signal for a SET_THEME / SET_LOCALE effect probe. * `theme` reads aggregate visible node styling (background/foreground colors); * `locale` reads aggregate visible text. Best-effort: a failed AKTree read * leaves the baseline null, and `verifyThemeLocaleEffect` then reports the * effect unverifiable (low-confidence) rather than asserting success. */ captureThemeLocaleBaseline(adapter: RuntimeAdapter, kind: 'theme' | 'locale'): Promise; /** * F2: compare the post-action signal against the baseline captured by * `captureThemeLocaleBaseline`. Returns `observed:true` only when a real, * deterministic change is seen. A missing baseline, an unreadable after-tree, * or an unchanged signal all return `observed:false` so the caller flags the * capture low-confidence. NEVER throws and NEVER signals a hard failure. */ verifyThemeLocaleEffect(adapter: RuntimeAdapter, kind: 'theme' | 'locale'): Promise; }