Fresh history cut from cynarAI/evoo antigravity-handoff/project-timeline (Voice First + project timeline). Brand docs/titles as evOo; keep @rakazo/* packages as tech debt. Excludes node_modules, caches, secrets, voice blobs.
17 lines
524 B
TypeScript
17 lines
524 B
TypeScript
import { type ToolCallStreak, trackToolCallStreak } from "@rakazo/core";
|
|
|
|
// Same tool, same arguments, this many times in a row means the agent is stuck, not paginating.
|
|
const MAX_CONSECUTIVE_IDENTICAL_TOOL_CALLS = 6;
|
|
|
|
export function advanceToolCallLoopGuard(
|
|
streak: ToolCallStreak,
|
|
name: string,
|
|
args: unknown,
|
|
): { streak: ToolCallStreak; stuck: boolean } {
|
|
const next = trackToolCallStreak(streak, name, args);
|
|
return {
|
|
streak: next,
|
|
stuck: next.count >= MAX_CONSECUTIVE_IDENTICAL_TOOL_CALLS,
|
|
};
|
|
}
|