feat: add codebuddy client support (bili codebuddy) - #641
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-641Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr641.tgz
npm install -g packageThis comment is automatically updated on each push. |
…me (Windows) On Windows os.homedir() does not follow HOME, so resolveCodebuddyHome fell back to the real user profile and the temp-home config files were never found (discoverMitmDomains returned []). Pass CODEBUDDY_CONFIG_DIR in the helper env, parallel to the existing CODEX_HOME / ZCODE_DATA_BASE_DIR / PI_CODING_AGENT_DIR overrides. Fixes the windows-latest CI failure on PR #641.
[bot] 🏷 Reviewed the full diff (8 files, +610/−9) against the #640 plan and re-ran the pre-flight. Verdict: implementation is consistent with the plan and mergeable after the Windows CI fix I just pushed (details below). Merge itself stays human-only. 🔴 Found & fixed: Windows CI was redThe pre-flight claim "Passes in CI" held for ubuntu but Root cause: the Fix pushed to the PR branch — commit Pre-flight (re-verified on
|
|
解决 冲突 |
# Conflicts: # src/client-config.ts
[bot] 🏷 冲突已解决 ✅ 做了什么:把 冲突详情:只有一个文件冲突 —— Pre-flight(合并后
说明:推送后 master 又前进到 CI 正在跑(windows/ubuntu test matrix),完成后补结果。PR 合并仍需人工操作。 |
…ly (#679) planClientSpawn routes extensionless targets through comspec on Windows, so the extensionless fake-codebuddy never matched the stub spawnImpl and the runLaunch integration test hung (cancelledByParent) in the windows CI job after merging master.
[bot] 🏷 冲突解决后 CI 又抓到一个 Windows-only 的测试问题,已修复并推送到 PR 分支(新 head 问题:合并 master 后, 根因:master 的 #679 给 launcher 加了 修复:一行测试改动(tests/launcher.test.ts:2719),给假二进制加 win32 当前状态
PR 可以合并了——按规矩合并操作留给你:#641 中文摘要:修了冲突合并 master 后暴露的 Windows 测试挂起问题(#679 的 spawn 规划把无扩展名的假 client 改走 comspec,导致 stub 失配、Promise 永不 settle),按既有惯例给假二进制加了 |
Closes #640
What
New
bili codebuddylauncher for Tencent's CodeBuddy Code CLI (@tencent-ai/codebuddy-code), following the issue's plan: claude-style/bili/URL rewrite in proxy mode (codebuddy is not ACP-native, so no agent-side plugin; the proxy injects the context tools on the wire).Changes
src/client-config.ts—CodebuddyConfig,resolveCodebuddyHome()(CODEBUDDY_CONFIG_DIR??~/.codebuddy),readCodebuddyConfig()(read-only:settings.jsonenv-blockCODEBUDDY_BASE_URL+ top-levelmodel/autoCompactWindow, shellCODEBUDDY_BASE_URLfallback; two-tiermodels.jsonwith project-level winning per model id,maxInputTokens→ModelWindow, per-modelurlcollected as inventory). DefensiveparseCodebuddyModelsJson()tolerates the container shapes (top-level map /modelsmap / array) since the exact on-disk shape is unverified. Wired intoloadClientConfig,ModelWindowScope,collectModelWindows.src/launcher.ts—codebuddyinLAUNCH_CLIENTS/BaseClientName;discoverRoutesclaude-style branch (defaulthttps://tencent.sso.codebuddy.cn/v2,CODEBUDDY_BASE_URLrewrite; models.json urls → MITM-whitelist inventory only, never rewritten — they bypassCODEBUDDY_BASE_URL, v1 limitation per issue decision (a));buildCodebuddyEnv();resolveCodebuddyBudgetEnv()— REQ: codex 压缩预算协调 + 匿名代理模式拦截伪造(根本解决方案) #321 budget alignment viaCODEBUDDY_AUTO_COMPACT_WINDOW(no model / user-set window / shell env / unresolvable window → no injection);launcherInjectMcpexcludes codebuddy (wire mode;--mcp-configcompat not yet verified against a real build — possible follow-up);resolveClientCommandtriescodebuddythencbc.src/discover.ts—extractHttpsHosts+configFilePathscodebuddy paths.src/cli.ts— HELP lines (dispatch already auto-detects viaisLaunchClient).CODEBUDDY_BASE_URLrewrite, budget alignment (inject / self-align / shell-override),resolveClientCommand(codebuddy/cbc),runLaunchintegration (env + budget end-to-end with a fake binary), discover hosts.v1 limitations (documented in code + issue)
models.jsonper-modelurls are not proxied — they bypassCODEBUDDY_BASE_URL(issue decision (a): env/platform path only, documented). Pure platform login (nomodels.json) is the first validation scenario.CODEBUDDY_BASE_URLexplicitly.--mcp-configis verified against a real codebuddy build.Pre-flight
npm run typecheck— passnpm test— 1251/1252 pass; the single failure (resolveClientCommand: codex/claude resolve to themselves) is pre-existing and environmental — it fails on pristine master in this sandbox because/usr/bin/codexhappens to be installed (the test asserts the not-on-PATH fallback); verified viagit stashon master. Passes in CI.npm run build— passLauncher-side change only (no request-pipeline changes), so the codex E2E suite is not applicable; coverage is mock-based per the existing
launcher.test.tspatterns.