billion-context 0.1.83 → 0.1.84-pr.529.347

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 CHANGED
@@ -112,6 +112,17 @@ turn is a semantic mismatch the model tolerates (it is clearly marked
112
112
  summaries (their tool call isn't in the agent's history and the agent's view
113
113
  skips `acp_summary`) — but that needs the id match above, which doesn't occur.
114
114
 
115
+ ## Which do I need?
116
+
117
+ Pick by your client:
118
+
119
+ | Client | Use |
120
+ |---|---|
121
+ | **pi** | [`billion-context-pi`](https://github.com/ranxianglei/billion-context-pi) (in-process extension) |
122
+ | **opencode** | [`opencode-acp`](https://github.com/ranxianglei/opencode-acp) (in-process extension) |
123
+ | **omp** | [`billion-context`](https://github.com/ranxianglei/billion-context) via `bili omp` (built-in plugin) |
124
+ | **everything else** (no context hook) | [`billion-context`](https://github.com/ranxianglei/billion-context) — `bili <client>` (launcher, preferred) or `/bili/` prefix |
125
+
115
126
  ## Install
116
127
 
117
128
  ```bash
@@ -382,7 +393,7 @@ pass an explicit `x-acp-session` header per conversation to avoid collisions.
382
393
 
383
394
  Early. Protocol handling and compression work against mock tests (500+ passing). Real-model integration testing is the next milestone. Expect rough edges.
384
395
 
385
- See [billion-context-pi](https://github.com/ranxianglei/billion-context-pi) for the pi-extension mode (in-process, tighter integration, the reference implementation).
396
+ Client-side plugins for pi / omp / opencode ship inside `billion-context` (`dist/agent/*.js`) for the cooperative-proxy path. See the **"Which do I need?"** section above for how `billion-context`, the standalone `billion-context-pi`, and `opencode-acp` relate.
386
397
 
387
398
  ## License
388
399
 
package/README.zh-CN.md CHANGED
@@ -50,6 +50,17 @@ AI 编程助手的<strong>通用上下文压缩代理</strong>
50
50
 
51
51
  代理向对话注入四个上下文管理工具(`compress`、`decompress`、`search_context`、`acp_status`)。模型在对话增长时调用 `compress`,代理在服务端执行 —— 压缩后的范围在下一轮之前折叠进对话历史。
52
52
 
53
+ ## 该选哪个?
54
+
55
+ 按客户端选:
56
+
57
+ | 客户端 | 用这个 |
58
+ |---|---|
59
+ | **pi** | [`billion-context-pi`](https://github.com/ranxianglei/billion-context-pi)(进程内扩展) |
60
+ | **opencode** | [`opencode-acp`](https://github.com/ranxianglei/opencode-acp)(进程内扩展) |
61
+ | **omp** | [`billion-context`](https://github.com/ranxianglei/billion-context),`bili omp`(内置插件) |
62
+ | **其余所有**(没有上下文 hook) | [`billion-context`](https://github.com/ranxianglei/billion-context) —— `bili <client>`(启动器,优先)或 `/bili/` 前缀 |
63
+
53
64
  ## 安装
54
65
 
55
66
  ```bash
@@ -258,7 +269,7 @@ Windows 下会自动发现常见 Clash/Mihomo 静态系统代理;Web UI 会显
258
269
 
259
270
  早期。协议处理和压缩已通过 mock 测试(500+ 项通过)。真实模型集成测试是下一里程碑。预期会有粗糙的地方。
260
271
 
261
- pi 扩展模式(进程内、更紧密集成、参考实现)见 [billion-context-pi](https://github.com/ranxianglei/billion-context-pi)。
272
+ 针对 pi / omp / opencode 的客户端插件随 `billion-context` 一起发布(`dist/agent/*.js`),用于协作代理路径。三者(`billion-context`、独立的 `billion-context-pi`、`opencode-acp`)如何取舍,见上文「该选哪个?」一节。
262
273
 
263
274
  ## 许可证
264
275
 
package/dist/index.js CHANGED
@@ -56964,7 +56964,7 @@ Content-Length: ${Buffer.byteLength(body)}\r
56964
56964
  );
56965
56965
  }
56966
56966
  if (opts.debug) {
56967
- log2("info", `[debug] build features: raw-HTTP-capture(on) | remote_compaction_v2-strip(on) | cert-MITM-launcher(on) | strip-acp-summary(on) \u2014 seeing this line confirms the launcher build (not registry 0.1.34)`);
56967
+ log2("info", `[debug] build features: raw-HTTP-capture(${bodyDumpEnabled() ? "on" : "off"}) | remote_compaction_v2-strip(on) | cert-MITM-launcher(on) | strip-acp-summary(on) \u2014 seeing this line confirms the launcher build (not registry 0.1.34)`);
56968
56968
  }
56969
56969
  };
56970
56970
  const attemptListen = (port) => {
@@ -62704,7 +62704,6 @@ function selfDistFile(name) {
62704
62704
  return path15.join(selfPackageRoot(), "dist", name);
62705
62705
  }
62706
62706
  var LAUNCHER_DEFAULT_HOST = "127.0.0.1";
62707
- var LAUNCHER_DEFAULT_PORT = 8787;
62708
62707
  var LAUNCH_CLIENTS = ["pi", "codex", "claude", "omp", "opencode", "hermes", "dsh", "pi-test"];
62709
62708
  var HEALTH_PATH = "/__bili/health";
62710
62709
  var HEALTH_POLL_INTERVAL_MS = 200;
@@ -63878,6 +63877,19 @@ async function probeExistingInstance(readInstance, fetchHealthInfo) {
63878
63877
  if (health.instanceId !== void 0 && health.instanceId !== inst.instanceId) return void 0;
63879
63878
  return inst;
63880
63879
  }
63880
+ function pickEphemeralPort(host = LAUNCHER_DEFAULT_HOST) {
63881
+ return new Promise((resolve, reject) => {
63882
+ const srv = net2.createServer();
63883
+ srv.once("error", reject);
63884
+ srv.listen(0, host, () => {
63885
+ const addr = srv.address();
63886
+ srv.close(() => {
63887
+ if (addr && typeof addr === "object") resolve(addr.port);
63888
+ else reject(new Error("could not allocate a free port"));
63889
+ });
63890
+ });
63891
+ });
63892
+ }
63881
63893
  var INHERITED_PROXY_VARS = ["http_proxy", "https_proxy", "all_proxy", "HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY"];
63882
63894
  function stripInheritedProxy(env) {
63883
63895
  const cleaned = { ...env };
@@ -63903,7 +63915,7 @@ async function ensureProxyRunning(opts, deps = {}) {
63903
63915
  return { origin: existing.origin, port: existing.port, attached: true };
63904
63916
  }
63905
63917
  const launchToken = randomUUID5();
63906
- const port = opts.port;
63918
+ const port = opts.port > 0 ? opts.port : await pickEphemeralPort(opts.host);
63907
63919
  const script = process.argv[1];
63908
63920
  if (!script) throw new Error("bili: cannot resolve launcher script path");
63909
63921
  const logPath2 = path15.join(os5.tmpdir(), `bili-proxy-${port}.log`);
@@ -63912,7 +63924,7 @@ async function ensureProxyRunning(opts, deps = {}) {
63912
63924
  try {
63913
63925
  child = spawnImpl(
63914
63926
  process.execPath,
63915
- [script, ...proxyStartArgs(opts)],
63927
+ [script, ...proxyStartArgs({ ...opts, port })],
63916
63928
  {
63917
63929
  detached: true,
63918
63930
  stdio: ["ignore", logFd, logFd],
@@ -64019,8 +64031,9 @@ function resolveClientCommand(client, env) {
64019
64031
  return { command: resolved ?? client, prefixArgs: [] };
64020
64032
  }
64021
64033
  function parsePort(raw) {
64022
- const port = raw && raw.trim() ? parseInt(raw, 10) : LAUNCHER_DEFAULT_PORT;
64023
- if (!Number.isFinite(port) || port <= 0 || port > 65535) {
64034
+ if (!raw || !raw.trim()) return 0;
64035
+ const port = parseInt(raw, 10);
64036
+ if (!Number.isFinite(port) || port < 1 || port > 65535) {
64024
64037
  console.error(`bili: invalid --port "${raw}"`);
64025
64038
  process.exit(2);
64026
64039
  }
@@ -64459,7 +64472,7 @@ Launcher (bili pi / bili codex / bili claude / bili omp / bili opencode / bili h
64459
64472
  Options (override config file / env):
64460
64473
  -F <url> upstream proxy to forward through (gost-style;
64461
64474
  http://host:port; must precede the client name)
64462
- --port <N> listen port (default 8787)
64475
+ --port <N> listen port (start: 8787; launcher default: random free port)
64463
64476
  --host <ADDR> listen host (default 127.0.0.1)
64464
64477
  --mitm-domain <domain> extra MITM domain (repeatable; launcher only)
64465
64478
  --config <FILE> path to config JSON (default: XDG location)