/** * Doom-loop detector — TS port of `forge_app::hooks::doom_loop::DoomLoopDetector`. * * Tracks tool call signatures per opencode session and triggers a reminder * when a repeating pattern dominates the tail of the sequence. * * Detects two shapes of loop (both in `checkRepeatingPattern`): * - [A,A,A,A] → pattern length 1 repeated threshold times * - [A,B,C,A,B,C,A,B,C]→ pattern length 3 repeated threshold times */ export interface ToolSignature { name: string; argsHash: string; } export declare class DoomLoopDetector { private readonly threshold; private readonly perSession; private readonly alreadyWarned; constructor(threshold?: number); record(sessionId: string, signature: ToolSignature): void; reset(sessionId: string): void; /** * Returns the number of consecutive pattern repetitions at the tail when a * loop is detected, otherwise null. Matches the forgecode Rust algorithm. */ detect(sessionId: string): number | null; private countRecentRepetitions; reminder(count: number): Promise; hasWarned(sessionId: string): boolean; markWarned(sessionId: string): void; } export declare function signatureOf(name: string, args: unknown): ToolSignature; //# sourceMappingURL=doom-loop.d.ts.map