/** * Session-scoped arming rules: a preparation (editing files matching globs) arms a * command pattern for a window; while armed, matching commands fire the rule's action. * * The tracker is in-memory per session. State lives for the rule's window within a session; * it is cleared when the session starts anew (session_start) and expires per `for`. It * survives across agent runs within the same session (the Scenario B case: edit in one * turn, reconcile in the next). No cross-session persistence. * * The armed check is deterministic: it fires whether or not Jev is available. If Jev * is available, armed-rule names ride as context so the judge can weigh them, but the * action never depends on Jev. */ import type { ArmingRule } from "./config.js"; /** Ids of rules whose regex or duration could not be compiled; surfaced via the one-time notice channel. */ export declare function unparseableArmingRules(rules: readonly ArmingRule[]): string[]; export type NowFn = () => number; /** * In-memory arming state for one session. * * `arm` is called on write/edit calls whose `input.path` matches a rule's `when.edited` globs. * `checkArmed` is called on command calls to see if any armed rule's `arms.command` regex matches. * `reset` clears all state (called on `agent_end`). */ export declare class ArmingTracker { private readonly armed; private compiled; private now; constructor(rules: readonly ArmingRule[], now?: NowFn); /** Set the clock function (for testing with injectable time). */ setNow(now: NowFn): void; /** Update the compiled rules from config; recompiles only when the reference changes. */ private lastRulesRef; updateRules(rules: readonly ArmingRule[]): void; /** * Record a write/edit call. If the tool is in a rule's `when.tools` (default ["write","edit"]) * and the path matches a `when.edited` glob, arm (or refresh) that rule. * Returns the ids of rules that were armed or refreshed by this call. */ arm(tool: string, path: string | undefined, cwd: string, sinkTargets?: readonly string[]): string[]; /** * Check whether any armed rule's command regex matches the given command. * Returns the matching rules (with their compiled config) for the extension to act on. * Expired rules are pruned first. */ checkArmed(command: string): { id: string; action: ArmingRule["action"]; message?: string; armedByPaths: string[]; }[]; /** Names of currently armed rules (for Jev context). */ armedRuleIds(): string[]; /** Human-readable status line for `/warden status`. */ statusLine(): string; /** Clear all arming state (called on session_start). */ reset(): void; /** Remove expired entries. */ private prune; }