billion-context 0.1.49 → 0.1.50-pr.226.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -9
- package/README.zh-CN.md +1 -1
- package/dist/index.js +398 -93
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -104,14 +104,16 @@ and proxy always match versions. Killing it entirely: `BILLION_CONTEXT_PLUGIN=0`
|
|
|
104
104
|
Hosts without a plugin API (claude, codex, opencode) install the MCP
|
|
105
105
|
bridge instead (`dist/mcp.js`), same protocol underneath.
|
|
106
106
|
|
|
107
|
-
### Option 0 — Launcher (`bili pi` / `bili codex` / `bili claude`)
|
|
107
|
+
### Option 0 — Launcher (`bili pi` / `bili codex` / `bili claude` / `bili omp` / `bili opencode` / `bili hermes`)
|
|
108
108
|
|
|
109
109
|
The launcher wraps a client in one command: it starts a proxy on an
|
|
110
|
-
independent port (
|
|
111
|
-
at it
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
independent port (a fresh instance is always spawned — a port is never
|
|
111
|
+
reused), then points the client at it — **certificate-based MITM** where the
|
|
112
|
+
client honors proxy/CA env vars, or an isolated **`/bili/` config rewrite**
|
|
113
|
+
where it doesn't. No real config file is ever edited; the client's own
|
|
114
|
+
config is READ to discover which HTTPS upstream hosts it talks to, and those
|
|
115
|
+
hosts are whitelisted for MITM so the proxy can TLS-terminate exactly them
|
|
116
|
+
and blind-tunnel everything else.
|
|
115
117
|
|
|
116
118
|
```bash
|
|
117
119
|
bili pi # launch pi through the proxy
|
|
@@ -119,6 +121,9 @@ bili pi -- print "hi" # args after the client are passed through
|
|
|
119
121
|
bili pi-test # clean pi (extensions off) — proxy owns compression, no double-compress
|
|
120
122
|
bili codex # launch codex through the proxy
|
|
121
123
|
bili claude # launch claude through the proxy
|
|
124
|
+
bili omp # pi-style: MITM env + isolated temp models.yml
|
|
125
|
+
bili opencode # MITM for HTTPS + temp opencode.json (/bili/ for HTTP) + thin /acp plugin
|
|
126
|
+
bili hermes # no MITM possible (certifi CA) — isolated HERMES_HOME, all traffic /bili/
|
|
122
127
|
bili test pi # quick end-to-end smoke test of the pi path
|
|
123
128
|
bili pi --mitm-domain api.foo.com # add a domain to the MITM whitelist
|
|
124
129
|
```
|
|
@@ -157,8 +162,11 @@ How the client is pointed at the proxy (set automatically in the child env):
|
|
|
157
162
|
| Client | Proxy redirect | CA trust env var |
|
|
158
163
|
|-------------|---------------------|-------------------------|
|
|
159
164
|
| pi | `HTTPS_PROXY` | `NODE_EXTRA_CA_CERTS` |
|
|
160
|
-
| claude | `HTTPS_PROXY`
|
|
165
|
+
| claude | `HTTPS_PROXY` (undici ignores it → `ANTHROPIC_BASE_URL` `/bili/` ride-along) | `NODE_EXTRA_CA_CERTS` |
|
|
161
166
|
| codex | `HTTPS_PROXY` | `SSL_CERT_FILE` |
|
|
167
|
+
| omp | `HTTPS_PROXY` | `NODE_EXTRA_CA_CERTS` |
|
|
168
|
+
| opencode | `HTTPS_PROXY` | `NODE_EXTRA_CA_CERTS` |
|
|
169
|
+
| hermes | `HERMES_HOME` (temp `config.yaml`, every upstream `/bili/`) | — (no MITM: httpx builds its own CA bundle) |
|
|
162
170
|
|
|
163
171
|
`NODE_EXTRA_CA_CERTS` *appends* to the built-in trust store, so it points at
|
|
164
172
|
the MITM root alone (`root-ca.pem`). `SSL_CERT_FILE` *replaces* the default
|
|
@@ -175,6 +183,9 @@ the client's own config, so whatever you already have set up keeps working:
|
|
|
175
183
|
| Pi | `~/.pi/agent/models.json` — each provider's `baseUrl` |
|
|
176
184
|
| Codex | `~/.codex/config.toml` — each `[model_providers.<name>]` `base_url` (+ top-level `openai_base_url`) |
|
|
177
185
|
| Claude Code | hardcoded `api.anthropic.com` (no per-config upstream) |
|
|
186
|
+
| omp | `~/.omp/agent/models.yml` — each provider's `baseUrl` |
|
|
187
|
+
| opencode | `~/.config/opencode/opencode.json` — each provider's `options.baseURL` |
|
|
188
|
+
| hermes | `~/.hermes/config.yaml` — each provider's `api:`/`base_url:` endpoint |
|
|
178
189
|
|
|
179
190
|
Only **HTTPS** hosts are MITM'd (a self-signed CA can't intercept plaintext
|
|
180
191
|
anyway); HTTP / `localhost` / `127.0.0.1` providers used to go direct, but are
|
|
@@ -199,9 +210,28 @@ runtime rather than from its config file. The proxy port defaults to `8787`;
|
|
|
199
210
|
if it's taken, a free port is chosen automatically. Use `--passthrough` /
|
|
200
211
|
`--debug` / `--no-auto-update` just like plain `bili`.
|
|
201
212
|
|
|
213
|
+
For clients whose config can't be pointed at the proxy through env vars, the
|
|
214
|
+
launcher writes an **isolated temp copy** of the client config with the
|
|
215
|
+
discovered upstreams rewritten and points the client at it — the real config
|
|
216
|
+
is never touched, and the temp dir is removed when the client exits:
|
|
217
|
+
|
|
218
|
+
- **pi / omp** — an isolated `PI_CODING_AGENT_DIR` whose `models.json` /
|
|
219
|
+
`models.yml` rewrites HTTP upstreams to the `/bili/` form (HTTPS upstreams
|
|
220
|
+
ride cert-MITM; everything else in the real home is symlinked through).
|
|
221
|
+
- **opencode** — `OPENCODE_CONFIG` pointing at a full copy of `opencode.json`
|
|
222
|
+
with HTTP upstreams `/bili/`-rewritten **and** the thin `bili` `/acp`
|
|
223
|
+
status plugin appended to `plugin` (`BILLION_CONTEXT_PROXY` makes a host
|
|
224
|
+
opencode-acp plugin self-disable so the proxy owns the ACP tools).
|
|
225
|
+
- **hermes** — cert MITM is impossible (httpx builds its own CA bundle from
|
|
226
|
+
certifi and ignores `SSL_CERT_FILE`), so **every** upstream is rewritten to
|
|
227
|
+
the `/bili/` form in an isolated `HERMES_HOME` (`config.yaml` copy;
|
|
228
|
+
skills/memories/sessions stay shared via symlinks). No plugin — hermes has
|
|
229
|
+
no plugin API; wire-injected tools ride the proxied stream.
|
|
230
|
+
|
|
202
231
|
> **Note:** the launcher ties the proxy's lifetime to the client — when the
|
|
203
|
-
> client exits,
|
|
204
|
-
>
|
|
232
|
+
> client exits, the proxy it started is stopped. Each `bili <client>` spawns
|
|
233
|
+
> its own fresh proxy instance; an independently started `bili` on the same
|
|
234
|
+
> port is never reused.
|
|
205
235
|
|
|
206
236
|
### Option A — Zero-config (`/bili/` prefix)
|
|
207
237
|
|
package/README.zh-CN.md
CHANGED
|
@@ -57,7 +57,7 @@ ACP 工具(`compress` / `decompress` / `search_context` / `acp_status`)
|
|
|
57
57
|
漂移。协议规范见 [PLUGIN.md](PLUGIN.md)。带插件的会话通过请求头自动
|
|
58
58
|
识别 —— 该会话的 wire 层工具注入自动关闭(不会双重压缩,工具体验原生)。
|
|
59
59
|
两种代理模式都支持:`/bili/` 前缀 baseURL **和 MITM 透明模式** ——
|
|
60
|
-
launcher(`bili pi` / `bili codex` / `bili claude`)会导出
|
|
60
|
+
launcher(`bili pi` / `bili codex` / `bili claude` / `bili omp` / `bili opencode` / `bili hermes`)会导出
|
|
61
61
|
`BILLION_CONTEXT_PROXY` 供插件检测;插件还可以上报 agent 自己的模型
|
|
62
62
|
上下文窗口(`x-bili-plugin-context-window`),并通过
|
|
63
63
|
`GET /__bili/plugin/status` 读取实时上下文水位。
|