feat(contracts,db): agent.plan / agent.propose_options, interaction events, proposeFirst replaces run mode

- agent_run_event gains plan_updated, options_proposed/resolved, approval_requested/resolved (migration 0040)
- AgentRunStartInput.proposeFirst; mode deprecated (plan_only maps to proposeFirst); mode dropped from AgentRun API
- POST /agent/runs/{id}/choice; agent.optionsTimeoutSec/optionsTimeoutAction/approvalTimeoutSec settings

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-28 21:07:01 +08:00
1 parent d931e75310
commit 74c2ed45aa
12 files changed
+379 -12

No files matched your search

+20
View File
@@ -137,6 +137,20 @@ export const AgentRuntimeSettings = z.object({
.number()
.min(0)
.max(24 * 30),
/** agent.propose_options 等用户选择的最长时间(秒);超时按 optionsTimeoutAction 处理 */
optionsTimeoutSec: z
.number()
.int()
.min(5)
.max(7 * 86400),
/** 方案选择超时:recommended = 自动选推荐项(没有推荐项时选第一个);stop = 不选,模型收尾 */
optionsTimeoutAction: z.enum(["recommended", "stop"]),
/** 会话内审批卡的有效期(秒);过期未批准的调用按拒绝处理 */
approvalTimeoutSec: z
.number()
.int()
.min(60)
.max(30 * 86400),
/** fake 模式脚本(JSON,FakeScript 的可序列化子集);null 用内置演示脚本 */
fakeScript: z.string().max(100_000).nullable(),
/**
@@ -350,6 +364,9 @@ export const DEFAULT_SETTINGS: GlobalSettings = {
investigateMaxToolCalls: 8,
goalPollSec: 60,
goalWaitHours: 72,
optionsTimeoutSec: 1800,
optionsTimeoutAction: "recommended",
approvalTimeoutSec: 86400,
fakeScript: null,
sessionDir: null,
},
@@ -607,6 +624,9 @@ export const SETTINGS_SECTIONS: readonly SettingsSectionDef[] = [
"agent.investigateMaxToolCalls",
"agent.goalPollSec",
"agent.goalWaitHours",
"agent.optionsTimeoutSec",
"agent.optionsTimeoutAction",
"agent.approvalTimeoutSec",
"agent.fakeScript",
"agent.sessionDir",
],