feat(tasks): 目标完成后支持主 agent 直投意图执行(goalless)
所有目标达成后,主 agent 经 add_intent 下发的意图可被 worker 直接执行、跑完 即止;planner 在任务无 open 目标时不再运行,避免其重判目标达成而 cancelExec 杀掉直投意图;frontier 抽干后任务回到 done。 - db: 新增 HasOpenGoal 谓词(零迁移,读现有 goal 状态) - engine: plannerLoop 加 goalless 门(无 open 目标则不进 planner,抽干则收尾) - tools: add_intent 成功后调 resumeTask 复活任务(仅主 agent 生效,planner 为 nil) - mainagent: 提示加入「目标达成后反问是否登记为正式目标」引导 - orchestration: reseedMainAgentPrompt 让旧库收到新提示(一次性,同构 reseedGoalsPrompt) 已知边角问题(paused/exhausted 意图的收官判据、零 goal 窗口、TOCTOU 等) 待后续讨论后再修。
This commit is contained in:
1 parent
43edb86720
commit
01018a2161
5 files changed
+71
-1
No files matched your search
@@ -857,6 +857,16 @@ WHERE exploration_id=$1 AND kind='intent' AND state IN ('open','running'))`, s.e
|
||||
return exists, err
|
||||
}
|
||||
|
||||
// HasOpenGoal reports whether this exploration still has any goal in state 'open'.
|
||||
// false ⇒ 所有目标已 met/abandoned(或本任务无目标)⇒ 进入 goalless(人工直投)分支:
|
||||
// planner 停跑,任务是否结束改由 frontier 是否抽干决定。met 与 abandoned 都算"已了结"。
|
||||
func (s *ExplorationStore) HasOpenGoal() (bool, error) {
|
||||
var exists bool
|
||||
err := s.db.QueryRow(`SELECT EXISTS(SELECT 1 FROM exploration_nodes
|
||||
WHERE exploration_id=$1 AND kind='goal' AND state='open')`, s.expID).Scan(&exists)
|
||||
return exists, err
|
||||
}
|
||||
|
||||
// ClaimIntent atomically moves an open intent to running. Returns true if claimed.
|
||||
func (s *ExplorationStore) ClaimIntent(id int64, owner string) (bool, error) {
|
||||
res, err := s.db.Exec(`UPDATE exploration_nodes SET state='running', owner=$1
|
||||
|
||||
Reference in new issue
Block a user