fix(claude): map question/skill to TitleCase instead of removing them

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
wykk-12138
2026-04-09 22:28:00 +08:00
parent ac36119a02
commit f780c289e8

View File

@@ -48,19 +48,21 @@ const claudeToolPrefix = ""
// oauthToolRenameMap maps OpenCode-style (lowercase) tool names to Claude Code-style
// (TitleCase) names. Anthropic uses tool name fingerprinting to detect third-party
// clients on OAuth traffic. Renaming to official names avoids extra-usage billing.
// Tools without a Claude Code equivalent (e.g. "question", "skill") are removed entirely.
// All tools are mapped to TitleCase equivalents to match Claude Code naming patterns.
var oauthToolRenameMap = map[string]string{
"bash": "Bash",
"read": "Read",
"write": "Write",
"edit": "Edit",
"glob": "Glob",
"grep": "Grep",
"task": "Task",
"webfetch": "WebFetch",
"todowrite": "TodoWrite",
"ls": "LS",
"todoread": "TodoRead",
"bash": "Bash",
"read": "Read",
"write": "Write",
"edit": "Edit",
"glob": "Glob",
"grep": "Grep",
"task": "Task",
"webfetch": "WebFetch",
"todowrite": "TodoWrite",
"question": "Question",
"skill": "Skill",
"ls": "LS",
"todoread": "TodoRead",
"notebookedit": "NotebookEdit",
}
@@ -73,12 +75,9 @@ var oauthToolRenameReverseMap = func() map[string]string {
return m
}()
// oauthToolsToRemove lists tool names that have no Claude Code equivalent and must
// be stripped from OAuth requests to avoid third-party fingerprinting.
var oauthToolsToRemove = map[string]bool{
"question": true,
"skill": true,
}
// oauthToolsToRemove lists tool names that must be stripped from OAuth requests
// even after remapping. Currently empty — all tools are mapped instead of removed.
var oauthToolsToRemove = map[string]bool{}
// Anthropic-compatible upstreams may reject or even crash when Claude models
// omit max_tokens. Prefer registered model metadata before using a fallback.