@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
31 lines • 1.28 kB
TypeScript
import type { ToolCallRecord } from "./tracker.ts";
export type LoopGuardDetection = {
readonly kind: "identical";
readonly toolName: string;
readonly count: number;
readonly fingerprint: string;
} | {
readonly kind: "similar";
readonly toolName: string;
readonly count: number;
readonly similarity: number;
readonly fingerprint: string;
} | {
readonly kind: "cycle";
readonly period: number;
readonly count: number;
readonly cycleTools: readonly string[];
readonly fingerprint: string;
};
export type LoopGuardKind = LoopGuardDetection["kind"];
export declare function detectIdenticalRun(records: readonly ToolCallRecord[]): LoopGuardDetection | undefined;
export declare function detectSimilarRun(records: readonly ToolCallRecord[]): LoopGuardDetection | undefined;
export declare function detectCycle(records: readonly ToolCallRecord[]): LoopGuardDetection | undefined;
export declare class NoticeGate {
private entries;
admit(detection: LoopGuardDetection): boolean;
prune(active: ReadonlyMap<LoopGuardKind, string>): void;
reset(): void;
}
export declare function detectLoop(records: readonly ToolCallRecord[], gate: NoticeGate): LoopGuardDetection | undefined;
//# sourceMappingURL=detectors.d.ts.map