/** * AgentDebate — Adversarial multi-agent debate and self-critique. * * A proposer agent generates a proposal, then one or more critic agents * challenge it across configurable rounds. The debate continues until * consensus, a round limit, or a confidence threshold is met. * * @module AgentDebate */ /** A single turn in a debate */ export interface DebateTurn { round: number; role: 'proposer' | 'critic'; agentId: string; content: string; confidence: number; timestamp: number; } /** Configuration for a debate session */ export interface DebateConfig { /** Maximum number of debate rounds (default 3) */ maxRounds?: number; /** Confidence threshold to accept a proposal without further critique (0-100, default 85) */ acceptanceThreshold?: number; /** Minimum confidence from all critics to reach consensus (0-100, default 70) */ consensusThreshold?: number; /** Timeout per turn in ms (default 30000) */ turnTimeoutMs?: number; } /** Final outcome of a debate */ export interface DebateOutcome { /** Whether the proposal was accepted */ accepted: boolean; /** Reason for acceptance or rejection */ reason: 'consensus' | 'threshold' | 'max_rounds' | 'proposer_withdrew'; /** The final (possibly revised) proposal */ finalProposal: string; /** Confidence of the final proposal */ finalConfidence: number; /** Full debate transcript */ transcript: DebateTurn[]; /** Number of rounds conducted */ rounds: number; /** Total duration in ms */ durationMs: number; } /** Critique result from a critic agent */ export interface CritiqueResult { /** The critique text */ critique: string; /** Critic's confidence in the proposal (0-100, higher = more approving) */ confidence: number; /** Whether the critic approves the proposal as-is */ approves: boolean; } /** Revised proposal from the proposer after critique */ export interface RevisionResult { /** The revised proposal */ proposal: string; /** Proposer's confidence in the revised version */ confidence: number; /** Whether the proposer wants to withdraw (give up) */ withdrawn: boolean; } /** * Function that a proposer calls to generate or revise a proposal. * Round 0 = initial proposal. Round > 0 = revision after critique. */ export type ProposerFn = (instruction: string, previousCritiques: DebateTurn[], round: number) => Promise; /** * Function that a critic calls to evaluate a proposal. */ export type CriticFn = (proposal: string, instruction: string, round: number) => Promise; /** * Orchestrate a multi-round adversarial debate. * * @example * ```ts * const debate = new AgentDebate({ * proposer: { agentId: 'writer', fn: writerFn }, * critics: [ * { agentId: 'reviewer', fn: reviewerFn }, * { agentId: 'security-checker', fn: securityFn }, * ], * config: { maxRounds: 3, acceptanceThreshold: 90 }, * }); * * const outcome = await debate.run('Write a secure login handler'); * if (outcome.accepted) { * console.log('Final proposal:', outcome.finalProposal); * } * ``` */ export declare class AgentDebate { private proposer; private critics; private config; constructor(options: { proposer: { agentId: string; fn: ProposerFn; }; critics: Array<{ agentId: string; fn: CriticFn; }>; config?: DebateConfig; }); /** * Run the full debate for a given instruction. */ run(instruction: string): Promise; private withTimeout; } //# sourceMappingURL=agent-debate.d.ts.map