mirror of
https://github.com/router-for-me/CLIProxyAPIPlus.git
synced 2026-04-13 01:34:18 +00:00
The review asked for the builtin tool registry helper to live with the rest of executor support utilities. This moves the registry code into the helps package, exports the minimal surface executor needs, and keeps behavior tests with the executor while leaving registry-focused checks with the helper. Constraint: Requested layout keeps executor helper utilities centralized under internal/runtime/executor/helps Rejected: Keep the files in executor and reply with rationale | conflicts with requested package organization Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep executor behavior tests near applyClaudeToolPrefix and keep pure registry tests in helps Tested: go test ./internal/runtime/executor/helps ./internal/runtime/executor -run 'Claude|Builtin|Tool'; go test ./test/...; go test ./... Not-tested: End-to-end Claude Code direct-connect/session runtime behavior
33 lines
939 B
Go
33 lines
939 B
Go
package helps
|
|
|
|
import "testing"
|
|
|
|
func TestClaudeBuiltinToolRegistry_DefaultSeedFallback(t *testing.T) {
|
|
registry := AugmentClaudeBuiltinToolRegistry(nil, nil)
|
|
for _, name := range defaultClaudeBuiltinToolNames {
|
|
if !registry[name] {
|
|
t.Fatalf("default builtin %q missing from fallback registry", name)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestClaudeBuiltinToolRegistry_AugmentsTypedBuiltinsFromBody(t *testing.T) {
|
|
registry := AugmentClaudeBuiltinToolRegistry([]byte(`{
|
|
"tools": [
|
|
{"type": "web_search_20250305", "name": "web_search"},
|
|
{"type": "custom_builtin_20250401", "name": "special_builtin"},
|
|
{"name": "Read"}
|
|
]
|
|
}`), nil)
|
|
|
|
if !registry["web_search"] {
|
|
t.Fatal("expected default typed builtin web_search in registry")
|
|
}
|
|
if !registry["special_builtin"] {
|
|
t.Fatal("expected typed builtin from body to be added to registry")
|
|
}
|
|
if registry["Read"] {
|
|
t.Fatal("expected untyped custom tool to stay out of builtin registry")
|
|
}
|
|
}
|