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
15 changes: 9 additions & 6 deletions CLIENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -536,19 +536,22 @@ the four have a base-URL env hook; one doesn't:
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,
`CLOUD_CODE_URL=<proxy>/bili/<upstream>` (default upstream
`https://daily-cloudcode-pa.googleapis.com` — Antigravity's real default;
the bare `cloudcode-pa` host 400s on `/v1internal:*`, #3129; 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.
Fallback if Google ever removes the env hook: cert-MITM — the
language_server honors `HTTPS_PROXY` and does not pin certificates, so add
`daily-cloudcode-pa.googleapis.com` (Antigravity's real default endpoint;
the bare `cloudcode-pa` name 400s on `/v1internal:*`, #3129) 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.
Expand Down
14 changes: 8 additions & 6 deletions CLIENTS.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,19 @@
`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**:
`CLOUD_CODE_URL=<proxy>/bili/<upstream>`(默认上游
`https://daily-cloudcode-pa.googleapis.com` —— Antigravity 真实默认;裸
`cloudcode-pa` 主机在 `/v1internal:*` 上 400,#3129;如果你自己导出了
`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 通道;启动器只驱动
language_server 遵循 `HTTPS_PROXY` 且不锁定证书,把
`daily-cloudcode-pa.googleapis.com`(Antigravity 真实默认端点;裸
`cloudcode-pa` 名称在 `/v1internal:*` 上 400,#3129)加进 `"mitm".domains`
并信任 bili 根 CA 即可。桌面端与 IDE 扩展共用同一条 language_server 通道;启动器只驱动
CLI —— 桌面用户可手动导出 `CLOUD_CODE_URL`,或直接用上面的 MITM 配方。

四者都没有 native 模式:均无环内工具注入接缝(gemini-cli 扩展只到自定义命令,
Expand Down
2 changes: 1 addition & 1 deletion CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -1787,7 +1787,7 @@ File keys resolve only when the matching env var is unset. Defaults in parenthes
| `BILI_PERSIST_EPERM_ALERT_REPEAT_MS` | Re-alert window for the persist EPERM alert, in ms. `0` (default) = alert once then stay silent; `>0` = re-alert at most every that many ms while the failures continue. |
| `BILI_TUNNEL_ALLOWED_HOSTS` | `/bili/<absolute-url>` tunnel admission for **remote clients** (#409): comma-separated `host` or `host:port` entries that unlock loopback/private destinations (e.g. a LAN relay or the machine's own sglang) for non-loopback clients. The proxy itself and link-local/metadata addresses are always denied; local (loopback) clients always pass. |
| `BILI_MAX_SESSIONS` | Max sessions held in memory (default `256`; LRU eviction — disk is the source of truth). |
| `BILI_SESSION_WARM_MAX` | Bounded startup (#2803): max most-recently-saved sessions hydrated at boot before listening (default `8`, capped by `sessions.max`); older state reloads on demand. `0` warms none. File twin: `sessions.warmMax`. |
| `BILI_SESSION_WARM_MAX` | Bounded startup (#2803): max most-recently-saved sessions hydrated at boot before listening (default `0` = warm none, capped by `sessions.max`); older state reloads on demand. Set e.g. `8` to restore eager warming of the recent set. File twin: `sessions.warmMax`. |
| `BILI_SESSION_WARM_MAX_BYTES` | Decoded-byte budget for the boot warm set (#2803; default `67108864` = 64 MiB). Counts DECODED size, not compressed on-disk bytes, so zstd archives cannot sneak past the RAM bound. A single file over the budget is never warmed. File twin: `sessions.warmMaxBytes`. |
| `BILI_SESSION_RESIDENT_MAX_BYTES` | Soft target for estimated resident session bytes (#2803; default `536870912` = 512 MiB). Active/in-flight state stays pinned above it (the byte budget limits the idle cache, not active workload); when over target, idle state discharges back to disk as requests complete. File twin: `sessions.residentMaxBytes`. |
| `BILI_PUBLIC_SNAPSHOT_CAP_BYTES` | Retention cap (bytes) for the raw wire-history snapshot kept per plugin session to serve the public fork API (#2017). A plugin session whose serialized snapshot exceeds the cap stops being forkable — `GET /__bili/plugin/snapshot` and `POST /__bili/plugin/fork` fail closed with `409` and the capped reason — instead of retaining an unbounded raw copy of the history forever. The cap is re-evaluated on every plugin model request: a session that shrinks back under the cap (after a fork trimmed it, or the host shrank the history) resumes being forkable. Default `104857600` (100 MiB); `0` disables retention entirely (no session is forkable; existing snapshots are dropped on the next request). File twin: `plugin.snapshotCapBytes`. |
Expand Down
2 changes: 1 addition & 1 deletion CONFIGURATION.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -1783,7 +1783,7 @@ ACP 原生 agent(当前为 `pi` 扩展)会在每个进程内向代理上报
| `BILI_PERSIST_EPERM_ALERT_THRESHOLD` | 同一会话连续 N 次持久化写失败(`EPERM`/`EBUSY`/`EACCES`)后触发一次性「把该目录加入杀软排除项」告警的阈值(默认 `5`)。仅 Windows。见下文「Windows:把会话目录加入杀软排除项」章节。 |
| `BILI_PERSIST_EPERM_ALERT_REPEAT_MS` | persist EPERM 告警的重复窗口(毫秒)。`0`(默认)= 只告警一次后静默;`>0` = 失败持续期间最多每这么久重复告警一次。 |
| `BILI_MAX_SESSIONS` | 内存中最多保留的会话数(默认 `256`;LRU 淘汰 —— 磁盘是事实源)。 |
| `BILI_SESSION_WARM_MAX` | 有界启动(#2803):监听前启动时最多预加载的最近保存会话数(默认 `8`,受 `sessions.max` 封顶);更早的状态按需重载。`0` 表示不预热。文件侧对应:`sessions.warmMax`。 |
| `BILI_SESSION_WARM_MAX` | 有界启动(#2803):监听前启动时最多预加载的最近保存会话数(默认 `0` = 不预热,受 `sessions.max` 封顶);更早的状态按需重载。设为如 `8` 可恢复对最近集的热加载。文件侧对应:`sessions.warmMax`。 |
| `BILI_SESSION_WARM_MAX_BYTES` | 启动预热集的解码字节预算(#2803;默认 `67108864` = 64 MiB)。计的是**解码后**尺寸而非磁盘压缩字节,zstd 归档无法绕过内存上限。单文件超预算则永不预热。文件侧对应:`sessions.warmMaxBytes`。 |
| `BILI_SESSION_RESIDENT_MAX_BYTES` | 常驻会话估算字节的软目标(#2803;默认 `536870912` = 512 MiB)。活跃/in-flight 状态不受此限制(字节预算约束的是空闲缓存而非活跃负载);超出目标时空闲状态随请求完成回落磁盘。文件侧对应:`sessions.residentMaxBytes`。 |
| `BILI_PUBLIC_SNAPSHOT_CAP_BYTES` | 为公开 fork API 按插件会话保留的原始 wire 历史快照的大小上限(字节,#2017)。序列化快照超限的插件会话不再可 fork —— `GET /__bili/plugin/snapshot` 与 `POST /__bili/plugin/fork` 以 `409` fail-closed 并注明原因 —— 而不是永久保留无上限的原始历史副本。上限在每次插件模型请求时重新评估:会话缩回上限内(fork 裁剪后或宿主缩短历史)即恢复可 fork。默认 `104857600`(100 MiB);`0` 完全停用留存(所有会话不可 fork,已有快照在下一次请求时丢弃)。文件孪生键:`plugin.snapshotCapBytes`。 |
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,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) |
| **antigravity** (Antigravity CLI / agy, Google) | `bili antigravity` (launcher, `CLOUD_CODE_URL` `/bili/` rewrite of daily-cloudcode-pa.googleapis.com — Antigravity's real default upstream, #3129) 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 @@ -267,7 +267,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 antigravity # Antigravity CLI (agy, Google): CLOUD_CODE_URL /bili/ rewrite of daily-cloudcode-pa.googleapis.com — the real default upstream (bare cloudcode-pa 400s on /v1internal:*, #3129); 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
4 changes: 2 additions & 2 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,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) |
| **antigravity**(Antigravity CLI / agy,Google) | `bili antigravity`(启动器,`CLOUD_CODE_URL` 对 `daily-cloudcode-pa.googleapis.com` 的 `/bili/` 改写 —— Antigravity 真实默认上游,#3129)或 `/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 @@ -213,7 +213,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 antigravity # Google Antigravity CLI(agy,Gemini CLI 继任者):CLOUD_CODE_URL 对 daily-cloudcode-pa.googleapis.com 的 /bili/ 改写 —— 真实默认上游(裸 cloudcode-pa 在 /v1internal:* 上 400,#3129),无需证书 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
2 changes: 1 addition & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Launcher (bili pi / bili codex / bili claude / bili omp / bili opencode / bili h
bili gemini # launch Gemini CLI through the proxy (GOOGLE_GEMINI_BASE_URL /bili/ rewrite; API-key & gateway auth)
bili iflow # launch iFlow CLI through the proxy (IFLOW_BASE_URL /bili/ rewrite of apis.iflow.cn/v1)
bili qwen # launch Qwen Code through the proxy (cert-MITM; DashScope/Qwen gateways whitelisted by default, custom relays via --mitm-domain)
bili antigravity # launch Antigravity CLI (agy) through the proxy (CLOUD_CODE_URL /bili/ rewrite of cloudcode-pa.googleapis.com)
bili antigravity # launch Antigravity CLI (agy) through the proxy (CLOUD_CODE_URL /bili/ rewrite of daily-cloudcode-pa.googleapis.com — real default upstream, #3129)
bili mcode # launch MiniMax Code through the proxy (cert-MITM; provider hosts from ~/.minimax*/config.yaml or the official agent.minimax.* endpoints)
bili aider # launch aider through the proxy (cert-MITM; endpoint from OPENAI_API_BASE/--openai-api-base/.aider.conf.yml or api.openai.com+api.anthropic.com by default)
bili copilot # launch Copilot CLI through the proxy (cert-MITM; api.githubcopilot.com + plan subdomains whitelisted by default)
Expand Down
Loading
Loading