Repository navigation
fix(protocol): Claude Desktop local-agent — claude_code_only 不误判 OMP (#511) - #518
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
复刻已关闭 fork dofastted/vm2api#511(HEAD
a120f38),在上游开干净 PR。Supersedes
@file:/workspace/...损坏,已关闭)变更
docs/PROTOCOL.md— 协议说明src/lib/identity/claude-code-only.mjs— 入口判定src/lib/identity/crs-persona.mjs— Desktop local-agent 指纹(UA / agent-sdk / desktop_app / anthropic-client-version)test/unit/claude-code-only.test.mjs— 单元测试CHANGELOG.md— 未发布 追加 fix(protocol): recognize Claude Desktop local-agent requests #511 条目Claude Desktop local-agent(UA 含 local-agent 与 agent-sdk、平台 desktop_app、合法 anthropic-client-version)不再仅凭
cc_entrypoint=local-agent判成 OMP,避免claude_code_only误 403;OMP 专属与 body-only relay 仍保守。自检
git diff origin/main --stat:5 文件,+92/−10rg '@file:|file:/workspace'变更文件:0 命中biome format已跑node --test test/unit/claude-code-only.test.mjs:16/16 通过未做
VERSIONNote
Medium Risk
改动入站身份与
claude_code_only403 边界,错误指纹可能误放第三方或误拦 Desktop;OMP 排除逻辑仍保守,但需依赖请求头完整性。Overview
Claude Desktop
local-agent在开启claude_code_only时不再被当成 Oh My Pi / OMP,从而避免误 403。原先只要 system 里出现
cc_entrypoint=local-agent就会走looksLikeOhMyPiSystem,和 OMP 共用同一套 OAuth 隐身前缀,Desktop 也会被挡在官方 Claude Code 家族之外。现在looksLikeOhMyPiSystem会结合请求头:UA 含local-agent与agent-sdk/x.y.z、anthropic-client-platform: desktop_app、合法的anthropic-client-version时,不再仅凭local-agententrypoint 判 OMP,而是继续走isOfficialClaudeCodeTraffic/isClaudeCodeFamilyRequest等既有校验。OMP 专属 system 标记、缺头、会话/版本不一致、OpenAI tools 等仍会拒绝。isOfficialClaudeCodeTraffic与looksLikeOfficialClaudeSystem把 headers 传入 OMP 判定;docs/PROTOCOL.md与 未发布 CHANGELOG 已同步说明。新增单元与协议层测试覆盖 Desktop 放行、count_tokens头契约,以及 OMP 叠加 system 仍被拦。Reviewed by Cursor Bugbot for commit e64fa5d. Configure here.