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..0a52d9f 160000 --- a/deps/agent-native +++ b/deps/agent-native @@ -1 +1 @@ -Subproject commit 6fd1d441a95423e27be6f6159207d5d0821bec4d +Subproject commit 0a52d9f9763372ef1b4d061934d60f15fd8bcbea