opencode-acp 1.18.2-pr.449.193 → 1.18.2-pr.450.194

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
@@ -42,9 +42,11 @@ A production-scale longitudinal study: 4.5 months, three hosts, 174,327 model ca
42
42
 
43
43
  ## Community
44
44
 
45
- Discussion, help, and updates on QQ — one group covers all three projects (`billion-context`, `billion-context-pi`, `opencode-acp`):
45
+ Discussion, help, and updates on QQ — one group covers all three projects (`billion-context`, `billion-context-pi`, `opencode-acp`). Please join the new group:
46
46
 
47
- **QQ Group: 1056132097**
47
+ **QQ Group: 1108730198**
48
+
49
+ > The original group **1056132097** is now full and no longer accepts new members.
48
50
 
49
51
  ---
50
52
 
package/README.zh-CN.md CHANGED
@@ -38,9 +38,11 @@
38
38
 
39
39
  ## 社区
40
40
 
41
- 交流、求助与更新都在 QQ——同一个群覆盖三个项目(`billion-context`、`billion-context-pi`、`opencode-acp`):
41
+ 交流、求助与更新都在 QQ——同一个群覆盖三个项目(`billion-context`、`billion-context-pi`、`opencode-acp`)。请加入新群:
42
42
 
43
- **QQ 群:1056132097**
43
+ **QQ 群:1108730198**
44
+
45
+ > 原群 **1056132097** 已满,不再接受新成员。
44
46
 
45
47
  ---
46
48
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AA4BjD,QAAA,MAAM,MAAM,EAAE,MAwMK,CAAA;AAEnB,eAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,qBAAqB,CAAA;AA6BzD,QAAA,MAAM,MAAM,EAAE,MA8OK,CAAA;AAEnB,eAAe,MAAM,CAAA"}
package/dist/index.js CHANGED
@@ -2148,8 +2148,57 @@ Using previous/default values`
2148
2148
  // lib/compress/range.ts
2149
2149
  import { tool as tool2 } from "@opencode-ai/plugin";
2150
2150
 
2151
+ // lib/bili-proxy.ts
2152
+ var BILI_PROXY_MARKER = "/bili/";
2153
+ function extractBaseURL(entry) {
2154
+ if (!entry || typeof entry !== "object") return void 0;
2155
+ const record = entry;
2156
+ const options = record.options;
2157
+ if (options && typeof options === "object") {
2158
+ const optionBaseURL = options.baseURL;
2159
+ if (typeof optionBaseURL === "string" && optionBaseURL.length > 0) {
2160
+ return optionBaseURL;
2161
+ }
2162
+ }
2163
+ const topLevelBaseURL = record.baseURL;
2164
+ if (typeof topLevelBaseURL === "string" && topLevelBaseURL.length > 0) {
2165
+ return topLevelBaseURL;
2166
+ }
2167
+ return void 0;
2168
+ }
2169
+ function findBiliProxyProviders(provider) {
2170
+ if (!provider || typeof provider !== "object") return [];
2171
+ const matches = [];
2172
+ for (const [name, entry] of Object.entries(provider)) {
2173
+ const baseURL = extractBaseURL(entry);
2174
+ if (baseURL !== void 0 && baseURL.includes(BILI_PROXY_MARKER)) {
2175
+ matches.push({ provider: name, baseURL });
2176
+ }
2177
+ }
2178
+ return matches;
2179
+ }
2180
+ var BILI_PROXY_ENV_VAR = "BILLION_CONTEXT_PROXY";
2181
+ var BILI_NATIVE_ENV_VAR = "BILLION_CONTEXT_NATIVE";
2182
+ function detectBiliEnvYield(env = process.env) {
2183
+ if (env[BILI_PROXY_ENV_VAR]) return "launcher";
2184
+ if (env[BILI_NATIVE_ENV_VAR]) return "native";
2185
+ return null;
2186
+ }
2187
+ function describeBiliEnvYield(source) {
2188
+ return source === "native" ? "BILLION_CONTEXT_NATIVE set (billion-context native mode)" : "BILLION_CONTEXT_PROXY set (billion-context launcher mode)";
2189
+ }
2190
+ function biliYieldLogMessage(source) {
2191
+ return source === "native" ? "[opencode-acp] disabled: BILLION_CONTEXT_NATIVE detected \u2014 billion-context native mode handles compression" : "[opencode-acp] disabled: BILLION_CONTEXT_PROXY detected \u2014 proxy handles compression";
2192
+ }
2193
+
2151
2194
  // lib/compress/types.ts
2152
2195
  function resolveToolContext(factoryCtx, sessionID) {
2196
+ const biliYield = detectBiliEnvYield();
2197
+ if (biliYield !== null) {
2198
+ throw new Error(
2199
+ `ACP is disabled in this process \u2014 ${describeBiliEnvYield(biliYield)}. billion-context owns context compression; do not call ACP tools again.`
2200
+ );
2201
+ }
2153
2202
  const state = factoryCtx.registry.get(sessionID);
2154
2203
  if (!state) {
2155
2204
  throw new Error(
@@ -11037,7 +11086,7 @@ import { writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
11037
11086
  import { join as join4 } from "path";
11038
11087
  import { existsSync as existsSync4 } from "fs";
11039
11088
  import { homedir as homedir3 } from "os";
11040
- var LOG_VERSION = true ? "1.18.2-pr.449.193" : "dev";
11089
+ var LOG_VERSION = true ? "1.18.2-pr.450.194" : "dev";
11041
11090
  var LEVEL_RANK = {
11042
11091
  debug: 10,
11043
11092
  info: 20,
@@ -13511,36 +13560,6 @@ function configureClientAuth(client) {
13511
13560
  return client;
13512
13561
  }
13513
13562
 
13514
- // lib/bili-proxy.ts
13515
- var BILI_PROXY_MARKER = "/bili/";
13516
- function extractBaseURL(entry) {
13517
- if (!entry || typeof entry !== "object") return void 0;
13518
- const record = entry;
13519
- const options = record.options;
13520
- if (options && typeof options === "object") {
13521
- const optionBaseURL = options.baseURL;
13522
- if (typeof optionBaseURL === "string" && optionBaseURL.length > 0) {
13523
- return optionBaseURL;
13524
- }
13525
- }
13526
- const topLevelBaseURL = record.baseURL;
13527
- if (typeof topLevelBaseURL === "string" && topLevelBaseURL.length > 0) {
13528
- return topLevelBaseURL;
13529
- }
13530
- return void 0;
13531
- }
13532
- function findBiliProxyProviders(provider) {
13533
- if (!provider || typeof provider !== "object") return [];
13534
- const matches = [];
13535
- for (const [name, entry] of Object.entries(provider)) {
13536
- const baseURL = extractBaseURL(entry);
13537
- if (baseURL !== void 0 && baseURL.includes(BILI_PROXY_MARKER)) {
13538
- matches.push({ provider: name, baseURL });
13539
- }
13540
- }
13541
- return matches;
13542
- }
13543
-
13544
13563
  // lib/update.ts
13545
13564
  import { readFile as readFile2, rm } from "fs/promises";
13546
13565
  import { basename, dirname as dirname4, join as join7 } from "path";
@@ -13747,15 +13766,14 @@ var server = (async (ctx) => {
13747
13766
  if (!config.enabled) {
13748
13767
  return {};
13749
13768
  }
13750
- if (process.env.BILLION_CONTEXT_PROXY) {
13751
- console.log(
13752
- "[opencode-acp] disabled: BILLION_CONTEXT_PROXY detected \u2014 proxy handles compression"
13753
- );
13769
+ const setupBiliYield = detectBiliEnvYield();
13770
+ if (setupBiliYield) {
13771
+ console.log(biliYieldLogMessage(setupBiliYield));
13754
13772
  return {};
13755
13773
  }
13756
13774
  const logger = new Logger(config.debug, config.debug ? "debug" : config.logLevel);
13757
13775
  logger.info("ACP plugin initialized", {
13758
- version: true ? "1.18.2-pr.449.193" : "dev",
13776
+ version: true ? "1.18.2-pr.450.194" : "dev",
13759
13777
  workspace: ctx.directory,
13760
13778
  logLevel: logger.level,
13761
13779
  debug: config.debug,
@@ -13805,7 +13823,21 @@ var server = (async (ctx) => {
13805
13823
  prompts
13806
13824
  };
13807
13825
  let disabledByBiliProxy = false;
13808
- const guard = (fn) => (...args) => disabledByBiliProxy ? Promise.resolve() : fn(...args);
13826
+ let announcedEnvYieldSource;
13827
+ const noteEnvYield = (source) => {
13828
+ if (source === null || announcedEnvYieldSource === source) return;
13829
+ announcedEnvYieldSource = source;
13830
+ console.log(biliYieldLogMessage(source));
13831
+ };
13832
+ const guard = (fn) => (...args) => {
13833
+ if (disabledByBiliProxy) return Promise.resolve();
13834
+ const envYield = detectBiliEnvYield();
13835
+ if (envYield !== null) {
13836
+ noteEnvYield(envYield);
13837
+ return Promise.resolve();
13838
+ }
13839
+ return fn(...args);
13840
+ };
13809
13841
  return {
13810
13842
  "experimental.chat.system.transform": guard(
13811
13843
  createSystemPromptHandler(registry4, logger, config, prompts)
@@ -13842,14 +13874,9 @@ var server = (async (ctx) => {
13842
13874
  }
13843
13875
  },
13844
13876
  config: async (opencodeConfig) => {
13845
- const biliMatches = findBiliProxyProviders(opencodeConfig.provider);
13846
- disabledByBiliProxy = biliMatches.length > 0;
13847
- if (biliMatches.length > 0) {
13848
- console.log(
13849
- "[opencode-acp] disabled: /bili/ proxy detected in provider baseURL (" + biliMatches.map((m) => m.provider).join(", ") + ") \u2014 proxy handles compression"
13850
- );
13851
- const permission = opencodeConfig.permission ?? {};
13852
- opencodeConfig.permission = {
13877
+ const denyAcpTools = (opencodeConfig2) => {
13878
+ const permission = opencodeConfig2.permission ?? {};
13879
+ opencodeConfig2.permission = {
13853
13880
  ...permission,
13854
13881
  compress: "deny",
13855
13882
  decompress: "deny",
@@ -13857,6 +13884,20 @@ var server = (async (ctx) => {
13857
13884
  acp_status: "deny",
13858
13885
  acp_context_recap: "deny"
13859
13886
  };
13887
+ };
13888
+ const biliMatches = findBiliProxyProviders(opencodeConfig.provider);
13889
+ disabledByBiliProxy = biliMatches.length > 0;
13890
+ const envYield = detectBiliEnvYield();
13891
+ if (envYield !== null) {
13892
+ noteEnvYield(envYield);
13893
+ denyAcpTools(opencodeConfig);
13894
+ return;
13895
+ }
13896
+ if (biliMatches.length > 0) {
13897
+ console.log(
13898
+ "[opencode-acp] disabled: /bili/ proxy detected in provider baseURL (" + biliMatches.map((m) => m.provider).join(", ") + ") \u2014 proxy handles compression"
13899
+ );
13900
+ denyAcpTools(opencodeConfig);
13860
13901
  return;
13861
13902
  }
13862
13903
  if (config.compress.permission !== "deny" && compressDisabledByOpencode(opencodeConfig.permission)) {