feat(core): 实现 Doom Loop 检测和软性 maxSteps 限制
- 新增 doom-loop.ts: 实现 Doom Loop 检测器,检测连续 3 次相同工具调用 - 修改 agent.ts: 集成检测器,添加 onDoomLoop 回调,动态 maxSteps - 修改 registry.ts: 默认 maxSteps 从 10 改为 50 - 更新 index.ts: 导出新模块 参考 OpenCode/OpenHands 等开源项目的多层防御策略
This commit is contained in:
@@ -1,5 +1,14 @@
|
||||
export { Agent } from './core/agent.js';
|
||||
export type { AgentChatOptions, ToolStartInfo, ToolEndInfo } from './core/agent.js';
|
||||
export type { AgentChatOptions, ToolStartInfo, ToolEndInfo, DoomLoopInfo } from './core/agent.js';
|
||||
|
||||
// Doom Loop Detection
|
||||
export {
|
||||
createDoomLoopDetector,
|
||||
DOOM_LOOP_THRESHOLD,
|
||||
DOOM_LOOP_WARNING,
|
||||
MAX_STEPS_WARNING,
|
||||
} from './core/doom-loop.js';
|
||||
export type { DoomLoopDetector } from './core/doom-loop.js';
|
||||
export { toolRegistry, todoManager, initTaskContext, updateTaskDescription, updateSkillDescription } from './tools/index.js';
|
||||
export { loadConfig, saveConfig, getConfig, loadVisionConfig, ConfigurationError } from './utils/config.js';
|
||||
export type { VisionConfig } from './utils/config.js';
|
||||
|
||||
Reference in New Issue
Block a user