Skip to content

v0.3.10 — drop the Command Code CLI bridge (vendor TOS)

Latest

Choose a tag to compare

@oliveagle oliveagle released this 08 Nov 13:06
· 28 commits to main since this release

v0.3.10

撤下 Command Code CLI 桥接

厂商的 /alpha/* 面是他们自家 cmd 客户端的私有协议,直连会回
Proxy use detected. This endpoint only serves CLI. Use Command Code provider API instead.,
并写明「Continued proxying of your subscription violates the TOS and will result in account ban.」
把包月订阅经自建网关转出去属于厂商明令禁止的用法,因此本版本把桥接整体撤掉:

  • 删除 crate crates/maxllm-commandcode/(独立 sidecar,工作区内无其它 crate 依赖它);
  • maxllm.toml 移除 [providers.cmd_cli] 与两条路由 /v1/responses/cli_cmd、/v1/channels/cli_cmd;
  • 线上(oleNas01)停用 maxllm-commandcode.service,二进制移出 bin/;
  • 保留 kind = "commandcode"(厂商授权的 Provider API 路径):Go 计划下它恒 403
    upgrade_required,升级 Provider 计划后 /v1/responses/cmd 原生透传即可用,网关侧无需改动。

附带:逆向 cmd 的识别机制(写入 docs/ops_review_20261108.md 附录 C)

cmd 并没有一个「魔法 token」证明自己是 CLI,识别是分层的:

  1. 路径面 — /alpha/* = CLI 私有协议,/provider/v1/* = 公开 API;
  2. 自称头 — User-Agent: cli(常量,每个请求都带)、x-cli-surface
    (仅 acp/rpc 面才带,普通 CLI 不带)、x-cli-environment: production、x-command-code-version;
  3. 设备指纹 — 首次运行把 thumbmark = sha256(salt + machineId|MACs) 上报
    /alpha/fingerprint/record,components 里 machineId / MAC / 用户名 / 主机名 / git 邮箱全部 hash,
    并标 runtime: "cli";
  4. 凭证 — Authorization: Bearer <apiKey>,来自 ~/.commandcode/auth.json
    (或 COMMAND_CODE_API_KEY 环境变量),登录走 https://commandcode.ai/studio/auth/cli;
  5. 服务端判定 — 路径族决定「这是 CLI 面」,套餐决定「能不能用 API」,/alpha/* 上另有反代理护栏。

实测补充:User-Agent: cli 并不是所有 /alpha/* 端点的准入条件(/alpha/namespaces、
/alpha/billing/credits、/alpha/sandbox/sessions 用普通 curl UA 同样 200)——它只是客户端自称;
真正的闸门在服务端。另外 POST /alpha/generate 的 403 响应体会把 CLI 上传的内容寻址文件池索引
(syspool/<user>/main/<sha256>)原样回显,属上游的一个信息泄漏。

验证

  • cargo fmt --all -- --check、cargo clippy --workspace --all-targets -- -D warnings、
    cargo test --workspace 全绿;
  • python3 scripts/check_responses_policy.py --config maxllm.toml → OK(每个能上 Responses 的上游仍是 native)。