guard

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewArchitectStopGuard

func NewArchitectStopGuard(st *store.Store, onBlock BlockHook) agentcore.StopGuard

NewArchitectStopGuard 要求 architect 本轮至少落盘一次 save_foundation。

func NewEditorStopGuard

func NewEditorStopGuard(st *store.Store, task string, onBlock BlockHook) agentcore.StopGuard

NewEditorStopGuard 要求 editor 本轮落盘与"任务"匹配的产物后才能结束。

任务感知:被派去生成摘要时,仅 save_review(复核)不算完成——必须产出对应摘要。 否则"被派生成弧摘要却先复核"的 editor 会满足旧的宽松判据提前结束,弧摘要永不落盘 (配合 dispatcher 去重哑火曾导致卷中骨架弧死循环,详见 outline-exhaustion-livelock)。 终态工具退出同样会咨询 StopGuard(契约测试 TestContract_TerminalToolExitConsultsStopGuard), 所以 save_review 在 build.go 里硬停是安全的:摘要任务里 editor 先复核时本 guard 会 否决该次退出并催促,直到对应摘要落盘。

func NewWriterStopGuard

func NewWriterStopGuard(st *store.Store, onBlock BlockHook) agentcore.StopGuard

NewWriterStopGuard 要求 writer 本轮至少产生一次成功的 commit_chapter。 催促消息按已落盘的 step 进度组装:writer 是唯一有多步工具链的子代理, 静态的"必须调 commit_chapter"在前置步骤缺失或 commit 本身报错时是误导。

Types

type BlockHook

type BlockHook func(agent, reason string, consecutive int32)

BlockHook 是 StopGuard 的审计回调:每次拦截/升级时同步调用。Host 用它把拦截 事实浮出到 TUI 事件流与离屏通知——否则拦截只进日志,用户在界面上只看到 "卡顿+token 变快",无从判断系统是在自愈还是在空转(issue #75)。 回调不参与 guard 决策。reason 取值:

  • "blocked" 已注入催促消息,模型将继续推进
  • "escalated" 连续空转超限,本轮 run 终止交回上层
  • "hard_stop" provider 拒答(safety/content_filter),立即终止

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL