/** * S6 auto-recheck loop — host-side orchestration AFTER a BLOCK with a remediation_transaction. * * Default OFF. The frozen guardToolCall is unchanged; this wraps it. The guard never writes * artifacts: the host's applyFix applies the fix (honesty line). After applyFix true, artifacts * are re-resolved FRESH (resolve() from artifact-resolver when resolveInput is supplied, else * the host-updated call / rebind). * * recheck_scope is an OUTPUT on the BLOCK envelope (app remediation-transaction.js). The * preflight request does not accept a scope hint (measured SDK / authorizeChangeSet) — so * each attempt is a FULL re-preflight. Noted, not faked. * * Nothing here enters a fingerprint preimage (host orchestration only). */ import type { GuardConfig, GuardOutcome, ToolCallDescriptor, ExecuteFactory, GuardToolCallContext } from './types.js'; import type { RemediationTransactionView } from './remediation-loop-attestation.js'; import type { ResolveInput, ResolveConfig } from './artifact-resolver.js'; /** Hard cap on RE-preflights per original call. */ export declare const AUTO_RECHECK_MAX_CAP = 3; export type RecheckTrailEntry = { attempt: number; decision_id: string | null; fingerprint: string | null; execution_action: string | null; }; export type RecheckStopReason = 'no_progress' | 'apply_fix_declined' | 'apply_fix_threw' | 'exhausted'; export type RecheckObservation = { recheck_trail?: ReadonlyArray; /** 849 metric feed. Present only when the loop ran. value true iff a recheck landed allow-class. */ fixed_after_block?: { value: true | null; attempt_count: number | null; }; recheck_stop_reason?: RecheckStopReason; }; export type AutoRecheckApplyFixContext = { call: ToolCallDescriptor; attempt: number; outcome: GuardOutcome; }; export type AutoRecheckConfig = { /** * Bound on RE-preflights per original call. Allowed 1–3; values above 3 clamp to 3. * Values below 1 disable the loop. */ maxAttempts: number; /** * HOST applies the fix. The guard never writes artifacts. * false / throw → loop ends, original BLOCK stands. */ applyFix: (remediation: RemediationTransactionView, context: AutoRecheckApplyFixContext) => boolean | Promise; /** * Optional. After applyFix true, produce a fresh git snapshot for resolve() (CAP-202). * When absent, the loop re-runs `rebind` / uses artifacts the host attached on context.call. */ resolveInput?: () => ResolveInput | Promise; resolveConfig?: ResolveConfig; }; export declare function clampMaxAttempts(n: unknown): number; export declare function normalizeAutoRecheck(raw: unknown): AutoRecheckConfig | null; export type AutoRecheckLoopArgs = { call: ToolCallDescriptor; factory: ExecuteFactory; config: GuardConfig; callContext?: GuardToolCallContext; rebind: () => ToolCallDescriptor | Promise; /** Re-collect freshness VALUES from the FRESH call (full re-preflight). */ refreshContext?: (call: ToolCallDescriptor) => Promise; }; /** * First call is always a normal guardToolCall. The loop runs only when autoRecheck is * normalized (applyFix present, maxAttempts in 1–3) AND the outcome is BLOCK with a * remediation_transaction. */ export declare function runAutoRecheckLoop(args: AutoRecheckLoopArgs): Promise>; //# sourceMappingURL=auto-recheck.d.ts.map