feat: spawn_task 补 seed_first_intent + 破坏性/外泄 gating 移入可删除的 DB 拦截规则

- spawn_task 新增 seed_first_intent 参数(默认 false),与 HTTP createTask 对齐;
  简单任务可开启直接下发一条种子意图开跑测试
- guard.go 删除写死的 reDestructive/reExfil gating,preToolUse 仅记审计后走拦截规则
- db 新增 seedDefaultInterceptRulesV2:破坏性系统命令(默认开)/数据外泄管道(默认关)
  以普通[内置]规则 seed,可禁用可删除;独立 v2 迁移标志兼容老库
This commit is contained in:
Autumn-27 committed 2026-08-15 05:30:47 -04:00
1 parent 80fcf528dc
commit a94ce679a6
4 files changed
+84 -48

No files matched your search

+4 -2
View File
@@ -240,6 +240,7 @@ func (s *Server) toolSpawnTask() actool.CoreTool {
"llm_profile_id": map[string]any{"type": "integer", "description": "可选:指定本子任务 planner/worker 用的 LLM 配置 id(见 list_llm_profiles);留空则继承父任务、再回退全局激活配置"},
"timeout_seconds": map[string]any{"type": "integer", "description": "可选:任务级超时(秒)。到点后触发优雅收尾并进入 timeout 终态;留空或 0 = 不限时"},
"plan_heartbeat_seconds": map[string]any{"type": "integer", "description": "可选:planner 心跳触发间隔(秒)。距上轮规划结束/任务开始满该值且期间无触发 → 触发一轮规划(兜底死锁 + 唤醒去监督飞行中的 worker)。留空或 0 = 默认 600(10min);"},
"seed_first_intent": map[string]any{"type": "boolean", "description": "可选:对于简单任务可开启,创建时直接下发一条种子意图(内容=描述+目标)让 worker 免等首轮 planner 直接开跑测试;默认 false(走标准先规划再执行)。"},
}, "description", "goal"),
func(_ context.Context, in json.RawMessage) (actool.Result, error) {
var a struct {
@@ -247,6 +248,7 @@ func (s *Server) toolSpawnTask() actool.CoreTool {
LLMProfileID json.RawMessage `json:"llm_profile_id"`
TimeoutSeconds int `json:"timeout_seconds"`
PlanHeartbeatSeconds int `json:"plan_heartbeat_seconds"`
SeedFirstIntent bool `json:"seed_first_intent"`
}
_ = json.Unmarshal(in, &a)
if strings.TrimSpace(a.Description) == "" {
@@ -282,8 +284,8 @@ func (s *Server) toolSpawnTask() actool.CoreTool {
}
// 共享的建后流程,与 HTTP 建任务(server.go createTask)复用同一段 launchTask:
// seed + 后台可见地做目标分解(第0轮/LLM步骤/逐条goal) + engine.Run。
// spawn_task 不暴露 seed_first_intent:工具创建的任务一律走标准先规划再执行(false)。
s.launchTask(t, a.Description+" "+a.Goal, false)
// seed_first_intent 默认 false(标准先规划再执行);简单任务可开启直接下发一 work 测试。
s.launchTask(t, a.Description+" "+a.Goal, a.SeedFirstIntent)
return actool.Text(fmt.Sprintf("task created: %s", t.ID)), nil
})
}