Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 37 additions & 8 deletions CLIENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,10 @@ The #321 budget `-c` args are kept verbatim (embedded mode honors them
identically). If you want the shared background server, run native `codex`
directly — no compression, but tools still work via `bili plugin install codex`.

## Gemini family (Gemini CLI / iFlow CLI / Qwen Code)
## Gemini family (Gemini CLI / iFlow CLI / Qwen Code / Antigravity)

Three launchers for the gemini-cli architecture family (#1043 tier 1). Two of
the three have a base-URL env hook; one doesn't:
Four launchers for the gemini-cli architecture family (#1043 tier 1). Three of
the four have a base-URL env hook; one doesn't:

- **`bili gemini`** — Gemini CLI (`@google/gemini-cli`). Sets
`GOOGLE_GEMINI_BASE_URL=<proxy>/bili/<upstream>` (default upstream
Expand All @@ -392,12 +392,41 @@ the three have a base-URL env hook; one doesn't:
`HTTPS_PROXY=<proxy>` + `NODE_EXTRA_CA_CERTS=<bili CA>` with a static
whitelist of the default model hosts (DashScope / Qwen gateway / common
third-party endpoints). Custom relay hosts: add them with
`--mitm-domain <host>`. Best-effort route — a `BLIND TUNNEL WARNING` in the
log means a host is missing from the whitelist.

None of the three has a native mode: none exposes an in-loop tool injection
`--mitm-domain <host>`. Best-effort route — a `BLIND TUNNEL WARNING` in the
log means a host is missing from the whitelist.
- **`bili antigravity`** — Google Antigravity (#2115). The launcher drives the
official CLI binary **`agy`** (the successor of Gemini CLI, which was
discontinued in 2026-06; found on `PATH` or at `~/.local/bin/agy`, Windows
`%LOCALAPPDATA%\agy\bin`). Its model channel lives inside the closed-source
Go `language_server`, which honors an **undocumented** `CLOUD_CODE_URL` env
override (verified in the v2.19.1 binary: *"Overriding CloudCodeServerURL
via CLOUD_CODE_URL environment variable"*) — same shape as the gemini-cli
base-URL hook. The launcher sets
`CLOUD_CODE_URL=<proxy>/bili/<upstream>` (default upstream
`https://cloudcode-pa.googleapis.com`; if you export your own
`CLOUD_CODE_URL`, that value is relayed through the proxy instead). No MITM,
no CA install. The proxy recognizes the wire **by path**:
`:streamGenerateContent` / `:generateContent` / `:countTokens` requests are
routed to the Google-native adapter and compressed like `bili gemini`. If
the server instead uses gRPC method paths
(`/google.internal.cloud.code.v1internal.CloudCode/*`), those requests are
not recognized and relay verbatim without compression — a graceful degrade,
fixable with a per-lane `protocol` declaration (#1909) once confirmed.
Fallback if Google ever removes the env hook: cert-MITM — the
language_server honors `HTTPS_PROXY` and does not pin certificates, so add
`cloudcode-pa.googleapis.com` to `"mitm".domains` and trust bili's root CA.
The desktop app and the IDE extension share this same language_server
channel; the launcher drives the CLI specifically — desktop users can export
`CLOUD_CODE_URL` manually or use the MITM recipe.

None of the four has a native mode: none exposes an in-loop tool injection
seam (gemini-cli extensions reach custom commands only; the forks inherit
that surface). Launcher-only by design.
that surface; Antigravity ships a user-plugin system — `plugins/<name>/`
with `plugin.json`, `hooks.json`, `mcp_config.json`, `skills/`, JS sidecars —
but every surface is additive only: tools, prompts, UI, event callbacks.
Nothing in it can intercept or rewrite the model request/response stream,
which stays entirely inside the closed language_server, so wire-only
integration is the ceiling for v1). Launcher-only by design.

## Pi (pi.dev coding agent)

Expand Down
35 changes: 29 additions & 6 deletions CLIENTS.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
- **看门狗与生命周期:** MCP 子进程每 30 s 探测一次代理。attach 模式下永远等待(绝不碰用户自己的代理);spawn 模式下代理死亡则重新拉起并把路由改写到新 origin。恢复失败时移除受管块,让流量退回直连上游而不是打到死端口。会话结束时 kimi 杀掉 MCP 子进程,父进程 pid 看门狗随之收掉拉起的代理。多个并发 TUI 共享第一个拉起的代理;它消失后其余会话自动重新拉起并改路。
- **已知局限:** 子代理会话各自得到独立的派生代理会话(kimi 不暴露稳定的会话 id;工具调用经每次调用的 `conversation_id` 参数绑定);kimi 的原生自动压缩**没有**被推后 —— ACP 压缩只是先触发,与启动器模式一致。退出开关:`BILI_NATIVE_KIMI=0`。

## Gemini 系(Gemini CLI / iFlow CLI / Qwen Code)
## Gemini 系(Gemini CLI / iFlow CLI / Qwen Code / Antigravity)

面向 gemini-cli 架构家族的三个启动器(#1043 第一梯队)。三者中两个有 base-URL 环境变量钩子,一个没有:
面向 gemini-cli 架构家族的四个启动器(#1043 第一梯队)。四者中三个有 base-URL 环境变量钩子,一个没有:

- **`bili gemini`** —— Gemini CLI(`@google/gemini-cli`)。设置
`GOOGLE_GEMINI_BASE_URL=<proxy>/bili/<upstream>`(默认上游
Expand All @@ -50,10 +50,33 @@
但它遵循标准代理环境变量,所以启动器走证书 MITM:`HTTPS_PROXY=<proxy>` +
`NODE_EXTRA_CA_CERTS=<bili CA>`,并把默认模型主机(DashScope / Qwen 网关 /
常见第三方端点)静态加白。自建中转主机用 `--mitm-domain <host>` 追加。
尽力而为的路由 —— 日志里出现 `BLIND TUNNEL WARNING` 说明有主机没进白名单。

三者都没有 native 模式:均无环内工具注入接缝(gemini-cli 扩展只到自定义命令,
fork 继承同一面)。按设计保持 launcher-only。
尽力而为的路由 —— 日志里出现 `BLIND TUNNEL WARNING` 说明有主机没进白名单。
- **`bili antigravity`** —— Google Antigravity(#2115)。启动器驱动官方 CLI
二进制 **`agy`**(Gemini CLI 的继任者,Gemini CLI 已于 2026-06 退役;在
`PATH` 或 `~/.local/bin/agy`,Windows 为 `%LOCALAPPDATA%\agy\bin`)。其模型
通道在闭源 Go `language_server` 内部,该进程遵循一个**未公开的**
`CLOUD_CODE_URL` 环境变量覆盖(已在 v2.19.1 二进制中验证:*"Overriding
CloudCodeServerURL via CLOUD_CODE_URL environment variable"*),形态与
gemini-cli 的 base-URL 钩子相同。启动器设置
`CLOUD_CODE_URL=<proxy>/bili/<upstream>`(默认上游
`https://cloudcode-pa.googleapis.com`;如果你自己导出了 `CLOUD_CODE_URL`,
该值会被中继经过代理)。无 MITM、无需装 CA。代理**按 path 识别 wire**:
`:streamGenerateContent` / `:generateContent` / `:countTokens` 请求走
Google 原生适配器,与 `bili gemini` 一样被压缩。若服务端改用 gRPC 方法
path(`/google.internal.cloud.code.v1internal.CloudCode/*`),这些请求不被
识别、原样透传不压缩 —— 属优雅降级,确认后可用按 lane 的 `protocol`
声明(#1909)修复。若 Google 将来移除该环境钩子,退路是证书 MITM:
language_server 遵循 `HTTPS_PROXY` 且不锁定证书,把
`cloudcode-pa.googleapis.com` 加进 `"mitm".domains` 并信任 bili 根 CA
即可。桌面端与 IDE 扩展共用同一条 language_server 通道;启动器只驱动
CLI —— 桌面用户可手动导出 `CLOUD_CODE_URL`,或直接用上面的 MITM 配方。

四者都没有 native 模式:均无环内工具注入接缝(gemini-cli 扩展只到自定义命令,
fork 继承同一面;Antigravity 自带用户插件系统 —— `plugins/<name>/` 下的
`plugin.json`、`hooks.json`、`mcp_config.json`、`skills/`、JS sidecar ——
但每个面都只能追加:工具、提示词、UI、事件回调,没有任何一个能拦截或改写
模型请求/响应流,那条流完全留在闭源 language_server 内部,所以 wire-only
是 v1 的上限)。按设计保持 launcher-only。

## Hermes(Nous Research)

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ Pick by your client:
| **gemini** (Gemini CLI) | `bili gemini` (launcher, `GOOGLE_GEMINI_BASE_URL` `/bili/` rewrite) or `/bili/` prefix — launcher-only (no in-loop tool seam, #1043) |
| **iflow** (iFlow CLI) | `bili iflow` (launcher, `IFLOW_BASE_URL` `/bili/` rewrite) or `/bili/` prefix |
| **qwen** (Qwen Code) | `bili qwen` (launcher, cert-MITM) or `/bili/` prefix |
| **antigravity** (Antigravity CLI / agy, Google) | `bili antigravity` (launcher, `CLOUD_CODE_URL` `/bili/` rewrite of cloudcode-pa.googleapis.com) or `/bili/` prefix — no plugin seam (closed Go language_server; its user-plugin surface is additive-only, #2115) — details: [CLIENTS.md](CLIENTS.md) |
| **mcode** (MiniMax Code) | [`billion-context`](https://github.com/ranxianglei/billion-context) via `bili mcode` (cert-MITM) or `/bili/` prefix — no native mode (event hooks only, no model-request seam, [#1050](https://github.com/ranxianglei/billion-context/issues/1050)) |
| **aider** | [`billion-context`](https://github.com/ranxianglei/billion-context) via `bili aider` (cert-MITM) or `/bili/` prefix — no native mode (shell-command-only hooks, no tool-injection seam, [#1048](https://github.com/ranxianglei/billion-context/issues/1048)) |
| **copilot** (GitHub Copilot CLI) | `bili copilot` (launcher, cert-MITM) — closed Go binary, no plugin seam (#1049) |
Expand Down Expand Up @@ -209,7 +210,7 @@ Notes:
- `jcode` and `aider` have no native mode (no plugin/MCP/tool-injection seam: #962, #1048) — use `bili jcode` / `bili aider`.
- `copilot`, `amp` and `goose` are launcher-only (#1049); goose cannot be cert-MITMed (rustls trusts no CA file) and rides plain-HTTP base-URL redirects instead.

### Option 2 — Launcher (`bili pi` / `bili codex` / `bili claude` / `bili omp` / `bili opencode` / `bili hermes` / `bili dsh` / `bili codebuddy` / `bili qoder` / `bili trae` / `bili jcode` / `bili kimi` / `bili gemini` / `bili iflow` / `bili qwen` / `bili mcode` / `bili aider` / `bili copilot` / `bili amp` / `bili goose`)
### Option 2 — Launcher (`bili pi` / `bili codex` / `bili claude` / `bili omp` / `bili opencode` / `bili hermes` / `bili dsh` / `bili codebuddy` / `bili qoder` / `bili trae` / `bili jcode` / `bili kimi` / `bili gemini` / `bili iflow` / `bili qwen` / `bili antigravity` / `bili mcode` / `bili aider` / `bili copilot` / `bili amp` / `bili goose`)

The launcher wraps a client in one command: it starts a proxy on an
independent port (a fresh instance is always spawned — a port is never
Expand All @@ -236,6 +237,7 @@ bili kimi # Kimi Code CLI (Moonshot): standard proxy
bili gemini # Gemini CLI (Google): GOOGLE_GEMINI_BASE_URL /bili/ rewrite to generativelanguage.googleapis.com (Google native wire), real ~/.gemini untouched
bili iflow # iFlow CLI: IFLOW_BASE_URL /bili/ rewrite to apis.iflow.cn/v1 (OpenAI chat-completions wire), real ~/.iflow untouched
bili qwen # Qwen Code (multi-protocol gemini-cli fork, no base-URL hook): cert-MITM via HTTPS_PROXY + NODE_EXTRA_CA_CERTS, default DashScope/Qwen model hosts whitelisted, custom relays via --mitm-domain
bili antigravity # Antigravity CLI (agy, Google): CLOUD_CODE_URL /bili/ rewrite of cloudcode-pa.googleapis.com (undocumented language-server env override, v2.19.1 binary-verified); wire recognized as Google native by path (#2115)
bili mcode # MiniMax Code CLI: same shape as kimi (proxy envs, unconditional loopback bypass, cert-MITM/absolute-form); session bound via X-Mavis-Session-Id (#1050)
bili aider # Aider (Python pair programmer): cert-MITM via HTTPS_PROXY + SSL_CERT_FILE/REQUESTS_CA_BUNDLE; endpoint from OPENAI_API_BASE / ANTHROPIC_BASE_URL / --openai-api-base / .aider.conf.yml (#1048)
bili copilot # Copilot CLI (GitHub, closed Go binary) — cert-MITM via HTTPS_PROXY + SSL_CERT_FILE, api.githubcopilot.com + per-plan subdomains whitelisted (#1049)
Expand Down Expand Up @@ -282,7 +284,7 @@ should see a `processTurn` line per request, and once the conversation grows,

### Client deep dives

Everything that doesn't fit in one Quickstart line — how each client's lanes attach, what gets written where, and known limitations — lives in **[CLIENTS.md](CLIENTS.md)**: dsh · Kimi Code · Hermes · ZCode · Gemini family (Gemini CLI / iFlow CLI / Qwen Code) · cert-MITM clients that never compress (CONNECT blind tunnels, #897) · unrecognized endpoints going direct (#1290) · OpenCode (launcher / native / pure proxy, `/acp` status & rules, legacy opencode-acp sessions #920).
Everything that doesn't fit in one Quickstart line — how each client's lanes attach, what gets written where, and known limitations — lives in **[CLIENTS.md](CLIENTS.md)**: dsh · Kimi Code · Hermes · ZCode · Gemini family (Gemini CLI / iFlow CLI / Qwen Code / Antigravity) · cert-MITM clients that never compress (CONNECT blind tunnels, #897) · unrecognized endpoints going direct (#1290) · OpenCode (launcher / native / pure proxy, `/acp` status & rules, legacy opencode-acp sessions #920).

## FAQ

Expand Down
6 changes: 4 additions & 2 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ QQ群:
| **gemini**(Gemini CLI) | `bili gemini`(启动器,`GOOGLE_GEMINI_BASE_URL` `/bili/` 改写)或 `/bili/` 前缀 —— 仅启动器(无环内工具注入接缝,#1043) |
| **iflow**(iFlow CLI) | `bili iflow`(启动器,`IFLOW_BASE_URL` `/bili/` 改写)或 `/bili/` 前缀 |
| **qwen**(Qwen Code) | `bili qwen`(启动器,cert-MITM)或 `/bili/` 前缀 |
| **antigravity**(Antigravity CLI / agy,Google) | `bili antigravity`(启动器,`CLOUD_CODE_URL` 对 `cloudcode-pa.googleapis.com` 的 `/bili/` 改写)或 `/bili/` 前缀 —— 无插件接缝(闭源 Go language_server;其用户插件面仅可追加、不能拦截模型流,[#2115](https://github.com/ranxianglei/billion-context/issues/2115))—— 细节见 [CLIENTS.zh-CN.md](CLIENTS.zh-CN.md) |
| **mcode**(MiniMax Code) | [`billion-context`](https://github.com/ranxianglei/billion-context),`bili mcode`(cert-MITM)或 `/bili/` 前缀 —— 无原生模式(纯声明式事件钩子,无模型请求接缝,[#1050](https://github.com/ranxianglei/billion-context/issues/1050)) |
| **aider** | [`billion-context`](https://github.com/ranxianglei/billion-context),`bili aider`(cert-MITM)或 `/bili/` 前缀 —— 无原生模式(仅 shell 命令钩子,无工具注入接缝,[#1048](https://github.com/ranxianglei/billion-context/issues/1048)) |
| **copilot**(GitHub Copilot CLI) | `bili copilot`(启动器,cert-MITM)—— 闭源 Go 二进制、无插件接缝(#1049) |
Expand Down Expand Up @@ -182,7 +183,7 @@ pi / omp / kimi / claude 没有客户端侧通道 —— 它们的配置条目
- `jcode`、`aider` 无原生模式(无插件/MCP/工具注入接缝:#962、#1048)—— 用 `bili jcode` / `bili aider`。
- `copilot`、`amp`、`goose` 仅启动器模式(#1049);goose 无法 cert-MITM(rustls 不信任任何 CA 文件),改走纯 HTTP base-URL 重定向。

### 方式 2 —— 启动器(`bili pi` / `bili codex` / `bili claude` / `bili omp` / `bili opencode` / `bili hermes` / `bili dsh` / `bili codebuddy` / `bili qoder` / `bili trae` / `bili jcode` / `bili kimi` / `bili gemini` / `bili iflow` / `bili qwen` / `bili mcode` / `bili aider` / `bili copilot` / `bili amp` / `bili goose`)
### 方式 2 —— 启动器(`bili pi` / `bili codex` / `bili claude` / `bili omp` / `bili opencode` / `bili hermes` / `bili dsh` / `bili codebuddy` / `bili qoder` / `bili trae` / `bili jcode` / `bili kimi` / `bili gemini` / `bili iflow` / `bili qwen` / `bili antigravity` / `bili mcode` / `bili aider` / `bili copilot` / `bili amp` / `bili goose`)

启动器把客户端包进一条命令:在独立端口拉起一个代理(总是全新实例,绝不复用端口),再按客户端支持的机制把它指向代理 —— 能吃代理/CA 环境变量的走**证书 MITM**,不吃的走隔离的**`/bili/` 配置重写**。真实配置文件从不被修改;客户端自己的配置只被**读取**,用来发现它实际连接的 HTTPS 上游主机,把这些主机加入 MITM 白名单 —— 代理只 TLS 终结它们,其余流量盲透传。

Expand All @@ -202,6 +203,7 @@ bili kimi # Kimi Code CLI(Moonshot):除无条件回
bili gemini # Gemini CLI(Google):GOOGLE_GEMINI_BASE_URL /bili/ 改写到 generativelanguage.googleapis.com(Google 原生 wire),真实 ~/.gemini 零改动
bili iflow # iFlow CLI:IFLOW_BASE_URL /bili/ 改写到 apis.iflow.cn/v1(OpenAI chat-completions wire),真实 ~/.iflow 零改动
bili qwen # Qwen Code(多协议 gemini-cli fork,无 base-URL 钩子):HTTPS_PROXY + NODE_EXTRA_CA_CERTS 证书 MITM,默认 DashScope/Qwen 模型主机加白,自建中转用 --mitm-domain 追加
bili antigravity # Google Antigravity CLI(agy,Gemini CLI 继任者):CLOUD_CODE_URL 对 cloudcode-pa.googleapis.com 的 /bili/ 改写,无需证书 MITM(#2115)
bili mcode # MiniMax Code CLI:与 kimi 同构(代理环境变量、无条件回环绕过、证书 MITM/绝对形式);会话经 X-Mavis-Session-Id 绑定(#1050)
bili aider # Aider(Python pair programmer):HTTPS_PROXY + SSL_CERT_FILE/REQUESTS_CA_BUNDLE 证书 MITM;端点取自 OPENAI_API_BASE / ANTHROPIC_BASE_URL / --openai-api-base / .aider.conf.yml(#1048)
bili copilot # Copilot CLI(GitHub,闭源 Go 二进制)—— 证书 MITM(HTTPS_PROXY + SSL_CERT_FILE),api.githubcopilot.com + 各套餐子域加白(#1049)
Expand Down Expand Up @@ -243,7 +245,7 @@ curl -s http://localhost:8787/__bili/stats

### 客户端深入

一行带不过来的细节 —— 各模式(启动器 / `/bili/` URL 前缀 / 原生插件)如何把流量接进代理、往哪儿写了什么、已知局限有哪些 —— 都在 **[CLIENTS.zh-CN.md](CLIENTS.zh-CN.md)**:dsh · Kimi Code · Hermes · ZCode · Gemini 系(Gemini CLI / iFlow CLI / Qwen Code)· CONNECT 盲隧道接入但从不压缩的客户端(#897)· 未识别端点直连(#1290)· OpenCode(启动器 / 原生 / 纯代理、`/acp` 状态与规则、旧 opencode-acp 会话 #920)。
一行带不过来的细节 —— 各模式(启动器 / `/bili/` URL 前缀 / 原生插件)如何把流量接进代理、往哪儿写了什么、已知局限有哪些 —— 都在 **[CLIENTS.zh-CN.md](CLIENTS.zh-CN.md)**:dsh · Kimi Code · Hermes · ZCode · Gemini 系(Gemini CLI / iFlow CLI / Qwen Code / Antigravity)· CONNECT 盲隧道接入但从不压缩的客户端(#897)· 未识别端点直连(#1290)· OpenCode(启动器 / 原生 / 纯代理、`/acp` 状态与规则、旧 opencode-acp 会话 #920)。

## 常见问题

Expand Down
Loading
Loading