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
+13
View File
@@ -369,6 +369,7 @@ function AgentSettings() {
const [thinking, setThinking] = useConfig('agent.enableThinking', true);
const [thinkingEffort, setThinkingEffort] = useConfig('agent.thinkingEffort', 'high');
const [confirmTimeout, setConfirmTimeout] = useConfig('agent.confirmationTimeoutMs', 120000);
const [toolExecTimeout, setToolExecTimeout] = useConfig('agent.toolExecutionTimeoutMs', 120000);
const MAX_ITER_OPTIONS = [10, 20, 50, 85, 128, 256, 512];
@@ -394,6 +395,18 @@ function AgentSettings() {
}}
slotProps={{ htmlInput: { min: 120, max: 3600, step: 30 } }}
/>
<TextField
size="small"
label="工具执行超时(秒)"
type="number"
value={toolExecTimeout / 1000}
onChange={(e) => {
const v = Number(e.target.value);
if (v >= 10 && v <= 600) setToolExecTimeout(v * 1000);
}}
slotProps={{ htmlInput: { min: 10, max: 600, step: 10 } }}
helperText="单个工具执行的最大时长,超时自动终止(10~600 秒)"
/>
<TextField
size="small"
label="工具确认超时(秒)"