feat: 工具执行超时可配置 + 修复硬编码盖过工具自定义超时的 bug

1. 新增 agent.toolExecutionTimeoutMs 配置(默认 120s,范围 10~600s),AgentSettings 加输入框

2. 修复 engine.ts 硬编码 120s 会盖过 delegate-task(5min)/web-search(5min) 等工具自定义 timeoutMs 的 bug:改为取 max(配置值, tool.timeoutMs)

3. main.ts 启动时从 ConfigService 加载;handlers.ts 监听 config:set 即时更新
This commit is contained in:
thzxx
2026-07-12 14:51:12 +08:00
parent 6d31498e6a
commit 3858f5ede3
5 changed files with 27 additions and 4 deletions
+2
View File
@@ -228,6 +228,7 @@ async function initialize(): Promise<void> {
const agentTimeout = configService.get<number>('agent.totalTimeoutMs');
const agentThinkingEnabled = configService.get<boolean>('agent.enableThinking');
const agentThinkingEffort = configService.get<string>('agent.thinkingEffort') as 'low' | 'medium' | 'high' | 'max' | null;
const toolExecTimeout = configService.get<number>('agent.toolExecutionTimeoutMs');
const agentLoop = new AgentLoopEngine(
{
maxIterations: agentMaxIter ?? 20,
@@ -235,6 +236,7 @@ async function initialize(): Promise<void> {
contextLength: ollamaNumCtx ?? undefined,
thinkingEnabled: agentThinkingEnabled ?? true,
thinkingEffort: agentThinkingEffort ?? 'high',
toolExecutionTimeoutMs: toolExecTimeout ?? 120_000,
},
adapter, toolRegistry, preToolHooks, postToolHooks,
);