fix: 修复Agent Loop工具调用重复问题,移除web_fetch截断

- 新增工具调用缓存机制,避免重复调用相同工具+参数
- 新增同轮内重复检测和跨轮次重复检测,连续两轮相同调用自动终止循环
- TOOLS_USAGE_GUIDE 新增第8条严禁重复调用规则
- web_fetch 默认不截断(max_chars=0),返回完整内容
- 移除 tool-registry.ts executeTool 中重复的 logToolStart 调用
This commit is contained in:
thzxx
2026-04-17 10:28:12 +08:00
parent d53fe047e5
commit 5ee23387c0
3 changed files with 78 additions and 7 deletions
+1 -3
View File
@@ -160,7 +160,7 @@ export const TOOL_DEFINITIONS: ToolDefinition[] = [
required: ['url'],
properties: {
url: { type: 'string', description: 'URL to fetch (http/https).' },
max_chars: { type: 'integer', description: 'Max characters to return. Default: 10000.' },
max_chars: { type: 'integer', description: 'Max characters to return. Default: 0 (no limit, return full content).' },
extract_mode: { type: 'string', enum: ['text', 'markdown'], description: 'Extraction mode. Default: text.' }
}
}
@@ -409,8 +409,6 @@ export async function executeTool(toolName: string, args: Record<string, unknown
}
try {
logToolStart(toolName, JSON.stringify(args));
// run_command 走 workspace IPC
if (toolName === 'run_command') {
const command = args.command as string;