Why: N1 increment three (WP1/WP4) - agents need a canonical spec
format with plugin restrictions, hosts need typed input/output/tool
guardrails, delegation needs lifecycle events, and squad adapters
need to pass the permission ask port through.
Evidence: go vet clean; go test ./... 26 packages ok, including new
agentspec (12 tests), guardrails (5), loop_guardrails (5), and
subagent hook tests (3).
Impact: new runtime/agentspec and runtime/guardrails packages; loop
consumes UserPromptSubmit outcomes (deny skips the loop, modify
appends the rewrite); subagent gains RegisterWithHooks emitting
SubagentStart/Stop around delegation; GateOptions gains PermissionAsk
forwarded into the kernel config. All additions are opt-in: nil
ports preserve prior behavior exactly.
Refs: Documents proposal 2026-10-07-agent-stack-n1q1i1-plans.md WP1/WP4
weichen
merged commit c5b9dca446 into main2026-10-07 05:07:25 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
N1 增量三(库侧):AgentSpec、三类 guardrail、委派事件与 ask 透传(WP1/WP4)
按 Documents 提案
2026-10-07-agent-stack-n1q1i1-plans.md§2.2 落地 WP1/WP4 的库侧部分。全部新增能力为 opt-in:端口为 nil / 未注册时行为与现状逐字节一致。改动
runtime/agentspec(WP1):AgentSpec类型(Name/Description/Prompt/Tools/DisallowedTools/Model/PermissionMode/Skills/MaxTurns/MemoryScope/Effort/Background/WorktreeIsolation/OutputSchema);agent-*.md解析Parse(宿主/内置全字段)与ParsePlugin(插件来源禁带 hooks/mcp/permissionMode 键,错误定位到字段);LoadDir整批原子(坏文件/重名全批拒绝)。runtime/guardrails(WP4):Input/Output/Tool 三端口,Verdict 复用 hooks.Decision,经Register(bus, set, scope{Entry,Final})以总线注册。语义:Input deny→不进入循环直接收尾(原文留痕)、modify→改写内容追加为新用户消息;Output(仅 Final)挂 Stop,deny→视同续跑附理由(计入内核 3 次上限)、modify→替换最终文本;Tool 挂 PreToolUse 按既有优先级合并,modify 改写参数。子代理 run(Scope 全 false)不受 Input/Output 影响。runtime/loop.go:消费 UserPromptSubmit 判定(上述 deny/modify 两分支)。runtime/subagent:RegisterWithHooks——委派执行前后发SubagentStart(带目标摘要)/SubagentStop(带成败标记);Register旧签名不变(静默)。adapters/native:GateOptions.PermissionAsk字段,透传进内核 Config(小队链路的 ask 裁决管道;squad 侧映射在 squad PR)。验证
go vet ./...通过;go test -count=1 ./...26 包全 ok。范围裁定
主任务:Dev 仓
feature/agent-stack-n1。