From 41dfe7e3eff4a6dfc9cf96663a95981c9a0bc280 Mon Sep 17 00:00:00 2001 From: weichen Date: Sat, 3 Oct 2026 16:55:26 +0000 Subject: [PATCH 1/2] Pass tool gates through the squad native backend Why: Squad members used the same kernel as direct chat but dropped stop, reminder, and before-tool hooks. Evidence: GOWORK=off go test . in adapters/native passed after pinning agent-native to 99d623a. Impact: Zero GateOptions still builds the previous backend. A set BeforeTool now runs inside the member loop. Refs: feature/permission-hooks Co-authored-by: Cursor --- adapters/native/register.go | 12 ++++++++++++ deps/agent-native | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/adapters/native/register.go b/adapters/native/register.go index c9b6d64..a582a9b 100644 --- a/adapters/native/register.go +++ b/adapters/native/register.go @@ -9,6 +9,8 @@ import ( nativexec "agent-native/adapters/native" "agent-native/exec" + "agent-native/runtime" + "agent-native/runtime/hooks" "agent-native/runtime/llm" "agent-native/runtime/mcp" "agent-native/runtime/subagent" @@ -33,6 +35,12 @@ type Config struct { OnEvent func(ev squad.ProcessEvent) Stream llm.StreamFunc MaxToolCalls int + BeforeTool func(call llm.ToolCall) error + AfterTool func(call llm.ToolCall, res llm.Message) + Stop func(last llm.Message, info runtime.StopInfo) runtime.StopDecision + Reminders func(turn int) []string + RepeatGuard bool + Hooks *hooks.Bus } // Register 把 "agent-native" 工厂注册进解析器。 @@ -72,6 +80,10 @@ func buildOptions(cfg Config, role squad.RoleSpec) (nativexec.Options, error) { SkillsRoots: cfg.SkillsRoots, Subagent: cfg.Subagent, HostTools: cfg.HostTools, }, SessionOptions: nativexec.SessionOptions{Compact: cfg.Compact, MaxToolCalls: cfg.MaxToolCalls}, + GateOptions: nativexec.GateOptions{ + BeforeTool: cfg.BeforeTool, AfterTool: cfg.AfterTool, Stop: cfg.Stop, + Reminders: cfg.Reminders, RepeatGuard: cfg.RepeatGuard, Hooks: cfg.Hooks, + }, } if cfg.Client != nil { opts.APIBase, opts.APIKey = cfg.Client.BaseURL, cfg.Client.APIKey diff --git a/deps/agent-native b/deps/agent-native index 6fd1d44..99d623a 160000 --- a/deps/agent-native +++ b/deps/agent-native @@ -1 +1 @@ -Subproject commit 6fd1d441a95423e27be6f6159207d5d0821bec4d +Subproject commit 99d623a8bb6f1654124c9c25cc4a03a0b89ed0ef From beea97e8cf8f509289545827bc3034a940433ca4 Mon Sep 17 00:00:00 2001 From: weichen Date: Sat, 3 Oct 2026 17:02:37 +0000 Subject: [PATCH 2/2] Pin the rebased agent-native hook bus Why: The hook-bus commit was replayed onto origin/main, so the squad pin has to follow that commit. Evidence: deps/agent-native is 0a52d9f, which contains origin/main. Impact: Squad members load the same kernel commit as the top-level pin. Refs: feature/permission-hooks --- deps/agent-native | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/agent-native b/deps/agent-native index 99d623a..0a52d9f 160000 --- a/deps/agent-native +++ b/deps/agent-native @@ -1 +1 @@ -Subproject commit 99d623a8bb6f1654124c9c25cc4a03a0b89ed0ef +Subproject commit 0a52d9f9763372ef1b4d061934d60f15fd8bcbea