Skip to content

add bili zed launcher: cert-MITM for the Zed editor + adopt-unlisted-clients docs (#2340) - #2352

Merged
ranxianglei merged 2 commits into
masterfrom
2026-10-07_zed-launcher
Oct 7, 2026
Merged

ranxianglei merged 2 commits into
masterfrom
2026-10-07_zed-launcher

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

为什么

#2340 计划第 2 项。Zed spike 结论(issue #2340 计划内验证):

  • Zed 模型流量走共享 reqwest + rustls client(crates/reqwest_client),代理经 ProxySettings.proxy env 兜底(HTTPS_PROXY/https_proxy/… 双路生效);
  • 根证书解析链 = rustls-platform-verifier → rustls-native-certs → openssl-probe,SSL_CERT_FILE/SSL_CERT_DIR 优先于系统库(Linux)——不是 goose 那种 webpki 焊死(新增 bili copilot / bili amp / bili goose 启动器(第三梯队) #1049),cert-MITM 成立;
  • macOS/Windows 的 platform verifier(Security.framework/schannel)不读 env CA 文件——那两个平台用文档里的 settings.json api_url /bili/ 前缀路径(跨平台替代)。

内容(两个 commit)

  1. docs: adopt unlisted clients — CLIENTS.md/zh 新节"收养未列表的客户端":任何模型 baseURL 可编辑 + API key 的客户端,一行 /bili/ 前缀即全功能;已核实入口表(Cline/Roo/Kilo、Continue、OpenHands、Zed、Void、Cursor Override、Warp);CONFIGURATION.md/zh /bili/ 节加指针。
  2. bili zed launcher — jcode 同款 env 契约(HTTPS_PROXY + SSL_CERT_FILE combined bundle + NO_PROXY 环回旁路,ollama/lmstudio 本地 provider 保持直连);ZED_DEFAULT_MODEL_HOSTS(anthropic/openai/google/deepseek/xai/mistral/openrouter)+ readZedConfig 只读发现 settings.json 的 language_models.{openai_compatible,anthropic_compatible}.<id>.api_url(仅 https、软失败);MCP 注入排除(纯 wire 模式);cli help/web chips/README 中英表行+badge;CLIENTS 收养节 Zed 行改为指向 launcher。

行为变化披露

  • 新 lane,无既有行为改动;crush/amp/copilot 路径零变化(buildZedEnv 走既有 ENV_CLIENTS 表,jcode 预设克隆)。
  • Zed GUI 在 macOS/Windows 上 launcher 不设 env CA(平台限制,文档披露);Linux 上桌面 launcher 启动的 Zed 不继承终端 env——须从终端 bili zed 启动(README/cli 帮助已写)。

验证

  • tests/launcher.test.ts 292/292(新增 5:buildZedEnv 契约含 NO_PROXY、discoverRoutes 默认域、settings.json api_url 去重+https-only、readZedConfig fixture 含 junk/损坏软失败、runLaunch zed 端到端 env 捕获含 NO_PROXY 断言+继承剥离(NO_PROXY 豁免));
  • cli/web-i18n/text-safe/panel-tokens 22/22;双 tsconfig rc=0;unused-export 门 clean;docs-sync 生成器零漂移。

Closes #2340(计划 1 Crush、2 Zed、5 文档收养完成;3 Continue=文档覆盖(无 CLI 可 launch,apiBase 路径已列表);4 OpenHands 低优先保持)

Supersedes: none。Stack: 无栈基(master)。

One-line /bili/ prefix works for any API-key client whose model base URL
is editable. Verified entry points (Cline/Roo/Kilo, Continue, OpenHands,
Zed, Void, Cursor override, Warp) documented in CLIENTS.md + zh mirror,
with a pointer from CONFIGURATION.md's /bili/ prefix section.
Zed's model traffic rides the shared reqwest+rustls client whose roots
resolve through rustls-platform-verifier -> rustls-native-certs ->
openssl-probe — which reads SSL_CERT_FILE first on Linux (unlike goose's
webpki-locked release builds). So the launcher gets the jcode env
contract: HTTPS_PROXY + SSL_CERT_FILE (combined bundle) + NO_PROXY so
loopback providers (ollama/lmstudio) stay direct.

Whitelist = ZED_DEFAULT_MODEL_HOSTS (built-in anthropic/openai/google/
deepseek/xai/mistral/openrouter hosts) + custom provider api_urls
auto-discovered read-only from settings.json
language_models.{openai_compatible,anthropic_compatible}.<id>.api_url
(https only, soft-fail); exotic relays ride --mitm-domain.

macOS/Windows note: their platform verifiers ignore env CA files —
there the settings.json api_url /bili/ prefix path (documented in the
new CLIENTS adoption section) is the cross-platform alternative.
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-07_zed-launcher (4d7b281)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.2514-pr.2352.aa57984

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr2352.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 PR #2352 review 完成(branch 2026-10-07_zed-launcher @ 4d7b281,2 commits / 11 files;查重:无并行 zed lane 工作)

① 原 issue 方向:#2340 计划项 2(Zed)+ 5(文档收养)。实现严格按你 floor-5 复核后的 spike 结论走(Linux openssl-probe 先读 SSL_CERT_FILE → cert-MITM 成立;macOS/Windows 用 settings.json api_url /bili/ 前缀替代),与修正后结论一致——注意这不是我 floor-3 的初判(初判「CA 源=系统库、需提权装 CA」被你的逐文件核对推翻,PR 跟的是修正版)。方向成立。

② 回归清单(触碰路径逐项既有行为):

  • LAUNCH_CLIENTS/BaseClientName/web chips/cli help:纯新增("zed" 插在 crush/goose 之间),既有 lane 条目零变化,chips 顺序与表一致;
  • loadClientConfig 新增无条件 readZedConfig(3 调用点:discover.ts:153、launcher.ts:4643/5316)——只填充 config.zed,仅被 zed 自己的 discoverRoutes 分支消费;其他客户端行为零变化(代价 = 每次 launch/discover 多一次软失败文件读,与 crush.json 同模式);
  • ModelWindowScope 联合加 "zed" 纯为 TS 兼容(collectModelWindows(config, base) 调用点 launcher.ts:4725,base 已含 zed)——switch 无 zed case,返回空 map,与改前一致;
  • launcherInjectMcp 排除名单加 zed → 纯 wire 模式,其他 lane 零变化;
  • ENV_CLIENTS 仅新增 zed preset(jcode 克隆 + NO_PROXY 环回旁路),既有 preset 逐字未动;
  • runLaunch 新增 else-if 分支,crush/amp/copilot/goose 路径未触碰;
  • 配置 schema / 持久化格式 / wire 协议 / kernel / update.ts / version / lockfile 均未动。
    高危模式逐项过:语义漂移、fail-fast 变吞错、阈值/时序/输出格式漂移——均无。readZedConfig 软失败与 readCrushConfig 的发现语义一致(discovery must never block the launcher),不是吞错。结论:无回归。

③ 代码:逻辑干净,几个关键点核实过:

  • SSL_CERT_FILE 用 resolveCombinedCaPath combined bundle——正确,openssl-probe env 是 REPLACE 语义(只放 bili CA 会丢全部公网根);
  • ZED_DEFAULT_MODEL_HOSTS 经 split(":")[0].toLowerCase() + httpsSeen 去重;baseUrls 侧 https-only 二次校验(readZedConfig 已过滤,防御纵深);
  • 二进制解析落到通用 resolveOnPath("zed") ?? "zed"(支持 BILI_CLIENT_BIN 覆盖)——PATH 上有 zed CLI 即工作;
  • 双语跨文档锚链(CONFIGURATION #bili-prefix-api-key-clients 等 5 处)逐一对照目标 heading 实测可解析。

④ 测试有效性:5 个新测试均为有牙真测——buildZedEnv 钉 env 契约全量(含 NO_PROXY 双写);discoverRoutes 钉默认域 + 去重 + https-only(含 not-a-url / http loopback 负例);readZedConfig 用真实 fixture 覆盖 junk/损坏/缺失软失败;runLaunch zed 端到端 env 捕获(combined-ca 路径后缀断言 + 继承代理剥离 + BILI_TEST_MARKER 继承保留)。bug 回归时抓得住,非恒真。

⑤ diff 整洁度:11 文件每行都与本 PR 目的相关,无跑题文件/空行重排/锁文件 churn。

CI:head 4d7b281 上 10 个 workflow 全绿(含主 CI gate = typecheck + 全量 suite + build)。本地定向复验一致:typecheck rc=0;launcher.test.ts 291 pass / 1 pre-existing skip / 0 fail;cli-parseargs/web-i18n/text-safe/panel-tokens/discover 59/59。

两个非阻断备注:

  1. 用户继承的自定义 NO_PROXY 条目不进被启动的 Zed(stripInheritedProxy 剥离后被 launcher 环回值覆盖)——与既有 jcode/aider/qwen 三 lane 契约完全同构,是一致设计而非本 PR 引入的回归;将来若要合并用户 NO_PROXY,属跨 lane 变更,应另立项。
  2. Zed 是首个 GUI lane:zed CLI 若 fork-and-exit 早退(不随窗口保活),launcher 会随 client exit 杀代理,会话中途丢压缩。e2e 只覆盖 env 契约(fake binary),不覆盖真实 GUI 生命周期——建议合并后做一次实机验证(终端 bili zed 起编辑器,确认编辑期间压缩持续、关窗后进程退出且代理随之终止)。

结构化七问:

  1. 是什么问题:Zed 等"baseURL 可编辑但未列表"客户端无一等接入方式;客户端收养:剩余低成本可接入客户端(Crush / Zed / Continue / Cline 家族等) #2340 计划项 2(Zed launcher)+ 5(文档收养段)落地。
  2. 什么原因导致的:覆盖缺口而非缺陷——既有 22 条 lane 没覆盖"原生尊重 HTTPS_PROXY + openssl-probe env CA"类开源 Rust GUI 客户端。
  3. 怎么修复的:复用 jcode env 契约模子(HTTPS_PROXY + combined SSL_CERT_FILE + NO_PROXY 环回旁路)+ settings.json api_url 只读发现数据源;文档收养节用 /bili/ 前缀机制覆盖其余①档客户端(Cline/Roo/Kilo、Continue、OpenHands、Void、Cursor Override、Warp)。用户配置零改动。
  4. 是否有回归问题:无(见②清单,逐项审过并给结论)。
  5. 是否破坏缓存:不涉及——缓存/重试/增量游标/去重键均不受影响。
  6. 是否改了设计方向:没有。沿用两模式架构与 install-lane 契约;zed 排除 MCP 注入(纯 wire,同 copilot/amp/crush)。
  7. 是否引入了新的配置:无新 billion-context.json 字段、无新 BILI_* env;只读消费 Zed 自己的 XDG_CONFIG_HOME|~/.config /zed/settings.json;新 CLI 面仅 bili zed 命令本身(PR body 有行为变化披露节)。

判定:可合并。feat 类,按规则由你人工合并:#2352 。合并后 #2340 计划 1/2/5 完成,3 收敛为文档覆盖,4 保持低优先——该 issue 即可关闭。

@ranxianglei
ranxianglei merged commit 126de7a into master Oct 7, 2026
23 checks passed
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.118-master.126de7a (rolling master tag).

npm install -g billion-context@0.0.118-master.126de7a  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

客户端收养:剩余低成本可接入客户端(Crush / Zed / Continue / Cline 家族等)

1 participant