/** * runAdversarialLoop — synchronous Round 1→N Artificer↔Evaluator adversarial * loop (RuleHost MVP, PRI-428, PRD Decision 11 multi-round). * * This is a SEPARATE execution entry point from the lease-based * InternalizationOrchestrator (which is single-step + successor-proposal). * It wraps real ArtificerRunner + EvaluatorRunner instances and drives the * cross-runner retry loop synchronously, injecting prior adversarial * failures into Round-2+ Artificer prompts. * * Design constraints: * - Does NOT modify InternalizationOrchestrator, BasePeerRunner, or the * lease-based execution model. * - Creates fresh task records per round (deterministic IDs) so the runners * can lease + run them through their normal pipeline. * - Every failure mode degrades to { decision: 'rejected' } with a * structured degradationReason — the loop never throws (ERR-018). * - PRD hard cap: maxRounds = 2. * * @see docs/plans/rulehost-mvp-activation.md Decision 11 multi-round pseudocode */ import type { ArtificerRunner } from './internalization/artificer-runner.js'; import type { EvaluatorRunner } from './internalization/evaluator-runner.js'; import type { RuntimeStateManager } from './store/runtime-state-manager.js'; import type { PIArtifactStore } from './internalization/pi-artifact.js'; import type { EvaluatorAdversarialResult } from './internalization/evaluator-output.js'; /** PRD hard cap on adversarial rounds. */ export declare const DEFAULT_MAX_ROUNDS = 2; export interface AdversarialLoopInput { readonly artificerRunner: ArtificerRunner; readonly evaluatorRunner: EvaluatorRunner; readonly stateManager: RuntimeStateManager; /** Shared artifact store (the same one both runners were constructed with). */ readonly artifactStore: PIArtifactStore; /** Succeeded scribe task the Round-1 Artificer depends on. */ readonly scribeTaskId: string; /** Max rounds (PRD cap = 2). Defaults to DEFAULT_MAX_ROUNDS. */ readonly maxRounds?: number; /** Correlation prefix for task IDs (default 'adversarial-loop'). */ readonly correlationId?: string; /** Channel for created tasks (default 'prompt'). */ readonly channel?: 'prompt' | 'code_tool_hook' | 'defer_archive'; } export interface AdversarialLoopResult { /** Final outcome. 'approved' = rule artifact written; 'rejected' = degraded. */ readonly decision: 'approved' | 'rejected'; /** Number of rounds actually executed (1..maxRounds). */ readonly rounds: number; /** The final evaluator task's ID (for lineage/telemetry lookup). */ readonly finalEvaluatorTaskId: string; /** Rule artifact ID when approved; null otherwise. */ readonly ruleArtifactId: string | null; /** Principle artifact ID (always present on the final evaluator task). */ readonly principleArtifactId: string | null; /** Adversarial result from the final round, when V2 path ran. */ readonly adversarialResult?: EvaluatorAdversarialResult; /** Structured reason when decision === 'rejected'. */ readonly degradationReason?: string; } /** * Run the multi-round adversarial loop. Never throws — all failure modes * return { decision: 'rejected', degradationReason }. */ export declare function runAdversarialLoop(input: AdversarialLoopInput): Promise; //# sourceMappingURL=adversarial-loop.d.ts.map