feat(planner): 触发上下文带实际变动 + 心跳触发改为「定时巡检」措辞
把 planner 每轮的触发信号从「固定一句"图发生了变化"」升级为具体变动:
- 统一 TriggerEvent{Kind,IntentID,Detail} 累加器(替换原 doneIntents):
worker 结束→{done}, report_finding→{finding,摘要}。Task.NotifyDone/新增
NotifyFinding 记录, drainTriggers 消费, Plan 参数改为 []TriggerEvent。
- renderTriggers 渲染:worker 结束→哪个意图(摘要)+worker 输出结论(取 result/text
全文,截断800字);finding→哪个意图+finding 摘要。
- worker 回调 notify()→notifyFinding(intentID,summary),report_finding 落库带上下文。
- 时间/心跳触发(triggers 为空)不再谎称"图发生了变化",开场白改为「定时巡检」并
提示复查在跑意图(steer_work 纠偏/kill_work 止损),对齐心跳的飞行中监督职责。
This commit is contained in:
1 parent
8e31a75263
commit
678025f850
6 files changed
+151
-50
No files matched your search
+17
-2
@@ -73,12 +73,19 @@ type ToolSet struct {
|
||||
// re-planned promptly (currently: a new hint). nil = no wake (the hint is still
|
||||
// stored and read on the next round triggered by other events). debounced.
|
||||
notify func()
|
||||
// notifyFinding, if set, wakes the task's planner when this run reports a finding,
|
||||
// carrying (intentID, summary) so the round can spell out which intent found what.
|
||||
// Wired for workers; nil elsewhere → falls back to notify (bare wake).
|
||||
notifyFinding func(intentID int64, summary string)
|
||||
}
|
||||
|
||||
// SetNotify wires the planner-wake callback (see ToolSet.notify). Set by callers
|
||||
// that hold the task handle (main-agent chat, cross-task orchestration).
|
||||
func (t *ToolSet) SetNotify(fn func()) { t.notify = fn }
|
||||
|
||||
// SetNotifyFinding wires the finding-wake callback (see ToolSet.notifyFinding).
|
||||
func (t *ToolSet) SetNotifyFinding(fn func(int64, string)) { t.notifyFinding = fn }
|
||||
|
||||
// EnrichTrigger is the enrichment engine seen from the tool layer (see package
|
||||
// enrich). Kept as an interface here to avoid coupling agent → enrich.
|
||||
type EnrichTrigger interface {
|
||||
@@ -647,8 +654,16 @@ func (t *ToolSet) addFinding() actool.CoreTool {
|
||||
_ = t.ts.Link(intent, db.RelYields, id) // chain: intent -> finding
|
||||
}
|
||||
_, _ = t.ts.AddStandaloneFinding(t.taskID, id, a.VulnClass, a.Severity, a.Summary, a.Evidence, t.worker, anchors)
|
||||
if t.notify != nil {
|
||||
t.notify() // 确证漏洞落库 → 当场唤醒本任务 planner(不等 worker 收工,debounce 合并)
|
||||
// 确证漏洞落库 → 当场唤醒本任务 planner(不等 worker 收工,debounce 合并)。
|
||||
// 优先带上下文(哪个意图+finding摘要);intent 用工具参数,缺省回退到 owner 意图。
|
||||
if t.notifyFinding != nil {
|
||||
iid := pid(a.IntentID)
|
||||
if iid <= 0 {
|
||||
iid = t.ownerNode
|
||||
}
|
||||
t.notifyFinding(iid, a.Summary)
|
||||
} else if t.notify != nil {
|
||||
t.notify()
|
||||
}
|
||||
} else {
|
||||
// conversation context: no exploration store available, cannot record finding
|
||||
|
||||
Reference in new issue
Block a user