opencode-acp 1.14.24 → 1.14.25-pr.338.58

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AA2BjD,QAAA,MAAM,MAAM,EAAE,MAqJK,CAAA;AAEnB,eAAe,MAAM,CAAA"}
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,MAmMK,CAAA;AAEnB,eAAe,MAAM,CAAA"}
package/dist/index.js CHANGED
@@ -9110,7 +9110,7 @@ import { writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
9110
9110
  import { join as join3 } from "path";
9111
9111
  import { existsSync as existsSync3 } from "fs";
9112
9112
  import { homedir as homedir3 } from "os";
9113
- var LOG_VERSION = true ? "1.14.24" : "dev";
9113
+ var LOG_VERSION = true ? "1.14.25-pr.338.58" : "dev";
9114
9114
  var LEVEL_RANK = {
9115
9115
  debug: 10,
9116
9116
  info: 20,
@@ -11339,6 +11339,36 @@ function configureClientAuth(client) {
11339
11339
  return client;
11340
11340
  }
11341
11341
 
11342
+ // lib/bili-proxy.ts
11343
+ var BILI_PROXY_MARKER = "/bili/";
11344
+ function extractBaseURL(entry) {
11345
+ if (!entry || typeof entry !== "object") return void 0;
11346
+ const record = entry;
11347
+ const options = record.options;
11348
+ if (options && typeof options === "object") {
11349
+ const optionBaseURL = options.baseURL;
11350
+ if (typeof optionBaseURL === "string" && optionBaseURL.length > 0) {
11351
+ return optionBaseURL;
11352
+ }
11353
+ }
11354
+ const topLevelBaseURL = record.baseURL;
11355
+ if (typeof topLevelBaseURL === "string" && topLevelBaseURL.length > 0) {
11356
+ return topLevelBaseURL;
11357
+ }
11358
+ return void 0;
11359
+ }
11360
+ function findBiliProxyProviders(provider) {
11361
+ if (!provider || typeof provider !== "object") return [];
11362
+ const matches = [];
11363
+ for (const [name, entry] of Object.entries(provider)) {
11364
+ const baseURL = extractBaseURL(entry);
11365
+ if (baseURL !== void 0 && baseURL.includes(BILI_PROXY_MARKER)) {
11366
+ matches.push({ provider: name, baseURL });
11367
+ }
11368
+ }
11369
+ return matches;
11370
+ }
11371
+
11342
11372
  // lib/update.ts
11343
11373
  import { readFile as readFile2, rm } from "fs/promises";
11344
11374
  import { basename, dirname as dirname4, join as join6 } from "path";
@@ -11545,9 +11575,15 @@ var server = (async (ctx) => {
11545
11575
  if (!config.enabled) {
11546
11576
  return {};
11547
11577
  }
11578
+ if (process.env.BILLION_CONTEXT_PROXY) {
11579
+ console.log(
11580
+ "[opencode-acp] disabled: BILLION_CONTEXT_PROXY detected \u2014 proxy handles compression"
11581
+ );
11582
+ return {};
11583
+ }
11548
11584
  const logger = new Logger(config.debug, config.debug ? "debug" : config.logLevel);
11549
11585
  logger.info("ACP plugin initialized", {
11550
- version: true ? "1.14.24" : "dev",
11586
+ version: true ? "1.14.25-pr.338.58" : "dev",
11551
11587
  workspace: ctx.directory,
11552
11588
  logLevel: logger.level,
11553
11589
  debug: config.debug,
@@ -11591,31 +11627,34 @@ var server = (async (ctx) => {
11591
11627
  config,
11592
11628
  prompts
11593
11629
  };
11630
+ let disabledByBiliProxy = false;
11631
+ const guard = (fn) => (...args) => disabledByBiliProxy ? Promise.resolve() : fn(...args);
11594
11632
  return {
11595
- "experimental.chat.system.transform": createSystemPromptHandler(
11596
- registry4,
11597
- logger,
11598
- config,
11599
- prompts
11633
+ "experimental.chat.system.transform": guard(
11634
+ createSystemPromptHandler(registry4, logger, config, prompts)
11600
11635
  ),
11601
- "experimental.chat.messages.transform": createChatMessageTransformHandler(
11602
- ctx.client,
11603
- registry4,
11604
- logger,
11605
- config,
11606
- prompts,
11607
- hostPermissions
11636
+ "experimental.chat.messages.transform": guard(
11637
+ createChatMessageTransformHandler(
11638
+ ctx.client,
11639
+ registry4,
11640
+ logger,
11641
+ config,
11642
+ prompts,
11643
+ hostPermissions
11644
+ )
11608
11645
  ),
11609
- "experimental.text.complete": createTextCompleteHandler(),
11610
- "command.execute.before": createCommandExecuteHandler(
11611
- ctx.client,
11612
- registry4,
11613
- logger,
11614
- config,
11615
- ctx.directory,
11616
- hostPermissions
11646
+ "experimental.text.complete": guard(createTextCompleteHandler()),
11647
+ "command.execute.before": guard(
11648
+ createCommandExecuteHandler(
11649
+ ctx.client,
11650
+ registry4,
11651
+ logger,
11652
+ config,
11653
+ ctx.directory,
11654
+ hostPermissions
11655
+ )
11617
11656
  ),
11618
- event: createEventHandler(registry4, logger),
11657
+ event: guard(createEventHandler(registry4, logger)),
11619
11658
  tool: {
11620
11659
  ...config.compress.permission !== "deny" && {
11621
11660
  compress: createCompressRangeTool(compressToolContext),
@@ -11626,6 +11665,23 @@ var server = (async (ctx) => {
11626
11665
  }
11627
11666
  },
11628
11667
  config: async (opencodeConfig) => {
11668
+ const biliMatches = findBiliProxyProviders(opencodeConfig.provider);
11669
+ disabledByBiliProxy = biliMatches.length > 0;
11670
+ if (biliMatches.length > 0) {
11671
+ console.log(
11672
+ "[opencode-acp] disabled: /bili/ proxy detected in provider baseURL (" + biliMatches.map((m) => m.provider).join(", ") + ") \u2014 proxy handles compression"
11673
+ );
11674
+ const permission = opencodeConfig.permission ?? {};
11675
+ opencodeConfig.permission = {
11676
+ ...permission,
11677
+ compress: "deny",
11678
+ decompress: "deny",
11679
+ search_context: "deny",
11680
+ acp_status: "deny",
11681
+ acp_context_recap: "deny"
11682
+ };
11683
+ return;
11684
+ }
11629
11685
  if (config.compress.permission !== "deny" && compressDisabledByOpencode(opencodeConfig.permission)) {
11630
11686
  config.compress.permission = "deny";
11631
11687
  }