opencode-acp 1.14.26-pr.360.95 → 1.14.27-pr.361.96
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/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,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
|
@@ -6922,10 +6922,13 @@ function buildCompressibleRanges(messages, state, protectedTools = [], protected
|
|
|
6922
6922
|
if (!ref) continue;
|
|
6923
6923
|
const rn = parseInt(ref.slice(1), 10);
|
|
6924
6924
|
if ((protectedTools.length > 0 || protectedFilePatterns.length > 0) && messageContainsProtectedTool(msg, protectedTools, protectedFilePatterns)) {
|
|
6925
|
-
|
|
6925
|
+
let tokens2 = 0;
|
|
6926
6926
|
const tools = /* @__PURE__ */ new Set();
|
|
6927
6927
|
for (const part of msg.parts || []) {
|
|
6928
|
-
if (part.type
|
|
6928
|
+
if (part.type === "text" && typeof part.text === "string") {
|
|
6929
|
+
tokens2 += Math.round(part.text.length / 4);
|
|
6930
|
+
} else if (part.type !== "text" && part.type !== "reasoning") {
|
|
6931
|
+
tokens2 += Math.round(JSON.stringify(part).length / 4);
|
|
6929
6932
|
const toolName = part?.tool;
|
|
6930
6933
|
const callID = part?.callID;
|
|
6931
6934
|
if (toolName && callID) {
|
|
@@ -6946,13 +6949,15 @@ function buildCompressibleRanges(messages, state, protectedTools = [], protected
|
|
|
6946
6949
|
protectedMsgInfo.push({ ref, refNum: rn, tokens: tokens2, tools: [...tools] });
|
|
6947
6950
|
continue;
|
|
6948
6951
|
}
|
|
6949
|
-
|
|
6952
|
+
let tokens = 0;
|
|
6950
6953
|
let isTool = false;
|
|
6951
6954
|
let hasMeaningfulPart = false;
|
|
6952
6955
|
for (const part of msg.parts || []) {
|
|
6953
6956
|
if (part.type === "text" && typeof part.text === "string") {
|
|
6957
|
+
tokens += Math.round(part.text.length / 4);
|
|
6954
6958
|
if (part.text.trim().length > 0) hasMeaningfulPart = true;
|
|
6955
6959
|
} else if (part.type !== "text" && part.type !== "reasoning") {
|
|
6960
|
+
tokens += Math.round(JSON.stringify(part).length / 4);
|
|
6956
6961
|
isTool = true;
|
|
6957
6962
|
hasMeaningfulPart = true;
|
|
6958
6963
|
}
|
|
@@ -9373,7 +9378,7 @@ import { writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
|
9373
9378
|
import { join as join3 } from "path";
|
|
9374
9379
|
import { existsSync as existsSync3 } from "fs";
|
|
9375
9380
|
import { homedir as homedir3 } from "os";
|
|
9376
|
-
var LOG_VERSION = true ? "1.14.
|
|
9381
|
+
var LOG_VERSION = true ? "1.14.27-pr.361.96" : "dev";
|
|
9377
9382
|
var LEVEL_RANK = {
|
|
9378
9383
|
debug: 10,
|
|
9379
9384
|
info: 20,
|
|
@@ -11602,6 +11607,36 @@ function configureClientAuth(client) {
|
|
|
11602
11607
|
return client;
|
|
11603
11608
|
}
|
|
11604
11609
|
|
|
11610
|
+
// lib/bili-proxy.ts
|
|
11611
|
+
var BILI_PROXY_MARKER = "/bili/";
|
|
11612
|
+
function extractBaseURL(entry) {
|
|
11613
|
+
if (!entry || typeof entry !== "object") return void 0;
|
|
11614
|
+
const record = entry;
|
|
11615
|
+
const options = record.options;
|
|
11616
|
+
if (options && typeof options === "object") {
|
|
11617
|
+
const optionBaseURL = options.baseURL;
|
|
11618
|
+
if (typeof optionBaseURL === "string" && optionBaseURL.length > 0) {
|
|
11619
|
+
return optionBaseURL;
|
|
11620
|
+
}
|
|
11621
|
+
}
|
|
11622
|
+
const topLevelBaseURL = record.baseURL;
|
|
11623
|
+
if (typeof topLevelBaseURL === "string" && topLevelBaseURL.length > 0) {
|
|
11624
|
+
return topLevelBaseURL;
|
|
11625
|
+
}
|
|
11626
|
+
return void 0;
|
|
11627
|
+
}
|
|
11628
|
+
function findBiliProxyProviders(provider) {
|
|
11629
|
+
if (!provider || typeof provider !== "object") return [];
|
|
11630
|
+
const matches = [];
|
|
11631
|
+
for (const [name, entry] of Object.entries(provider)) {
|
|
11632
|
+
const baseURL = extractBaseURL(entry);
|
|
11633
|
+
if (baseURL !== void 0 && baseURL.includes(BILI_PROXY_MARKER)) {
|
|
11634
|
+
matches.push({ provider: name, baseURL });
|
|
11635
|
+
}
|
|
11636
|
+
}
|
|
11637
|
+
return matches;
|
|
11638
|
+
}
|
|
11639
|
+
|
|
11605
11640
|
// lib/update.ts
|
|
11606
11641
|
import { readFile as readFile2, rm } from "fs/promises";
|
|
11607
11642
|
import { basename, dirname as dirname4, join as join6 } from "path";
|
|
@@ -11809,12 +11844,14 @@ var server = (async (ctx) => {
|
|
|
11809
11844
|
return {};
|
|
11810
11845
|
}
|
|
11811
11846
|
if (process.env.BILLION_CONTEXT_PROXY) {
|
|
11812
|
-
console.log(
|
|
11847
|
+
console.log(
|
|
11848
|
+
"[opencode-acp] disabled: BILLION_CONTEXT_PROXY detected \u2014 proxy handles compression"
|
|
11849
|
+
);
|
|
11813
11850
|
return {};
|
|
11814
11851
|
}
|
|
11815
11852
|
const logger = new Logger(config.debug, config.debug ? "debug" : config.logLevel);
|
|
11816
11853
|
logger.info("ACP plugin initialized", {
|
|
11817
|
-
version: true ? "1.14.
|
|
11854
|
+
version: true ? "1.14.27-pr.361.96" : "dev",
|
|
11818
11855
|
workspace: ctx.directory,
|
|
11819
11856
|
logLevel: logger.level,
|
|
11820
11857
|
debug: config.debug,
|
|
@@ -11858,31 +11895,34 @@ var server = (async (ctx) => {
|
|
|
11858
11895
|
config,
|
|
11859
11896
|
prompts
|
|
11860
11897
|
};
|
|
11898
|
+
let disabledByBiliProxy = false;
|
|
11899
|
+
const guard = (fn) => (...args) => disabledByBiliProxy ? Promise.resolve() : fn(...args);
|
|
11861
11900
|
return {
|
|
11862
|
-
"experimental.chat.system.transform":
|
|
11863
|
-
registry4,
|
|
11864
|
-
logger,
|
|
11865
|
-
config,
|
|
11866
|
-
prompts
|
|
11901
|
+
"experimental.chat.system.transform": guard(
|
|
11902
|
+
createSystemPromptHandler(registry4, logger, config, prompts)
|
|
11867
11903
|
),
|
|
11868
|
-
"experimental.chat.messages.transform":
|
|
11869
|
-
|
|
11870
|
-
|
|
11871
|
-
|
|
11872
|
-
|
|
11873
|
-
|
|
11874
|
-
|
|
11904
|
+
"experimental.chat.messages.transform": guard(
|
|
11905
|
+
createChatMessageTransformHandler(
|
|
11906
|
+
ctx.client,
|
|
11907
|
+
registry4,
|
|
11908
|
+
logger,
|
|
11909
|
+
config,
|
|
11910
|
+
prompts,
|
|
11911
|
+
hostPermissions
|
|
11912
|
+
)
|
|
11875
11913
|
),
|
|
11876
|
-
"experimental.text.complete": createTextCompleteHandler(),
|
|
11877
|
-
"command.execute.before":
|
|
11878
|
-
|
|
11879
|
-
|
|
11880
|
-
|
|
11881
|
-
|
|
11882
|
-
|
|
11883
|
-
|
|
11914
|
+
"experimental.text.complete": guard(createTextCompleteHandler()),
|
|
11915
|
+
"command.execute.before": guard(
|
|
11916
|
+
createCommandExecuteHandler(
|
|
11917
|
+
ctx.client,
|
|
11918
|
+
registry4,
|
|
11919
|
+
logger,
|
|
11920
|
+
config,
|
|
11921
|
+
ctx.directory,
|
|
11922
|
+
hostPermissions
|
|
11923
|
+
)
|
|
11884
11924
|
),
|
|
11885
|
-
event: createEventHandler(registry4, logger),
|
|
11925
|
+
event: guard(createEventHandler(registry4, logger)),
|
|
11886
11926
|
tool: {
|
|
11887
11927
|
...config.compress.permission !== "deny" && {
|
|
11888
11928
|
compress: createCompressRangeTool(compressToolContext),
|
|
@@ -11893,6 +11933,23 @@ var server = (async (ctx) => {
|
|
|
11893
11933
|
}
|
|
11894
11934
|
},
|
|
11895
11935
|
config: async (opencodeConfig) => {
|
|
11936
|
+
const biliMatches = findBiliProxyProviders(opencodeConfig.provider);
|
|
11937
|
+
disabledByBiliProxy = biliMatches.length > 0;
|
|
11938
|
+
if (biliMatches.length > 0) {
|
|
11939
|
+
console.log(
|
|
11940
|
+
"[opencode-acp] disabled: /bili/ proxy detected in provider baseURL (" + biliMatches.map((m) => m.provider).join(", ") + ") \u2014 proxy handles compression"
|
|
11941
|
+
);
|
|
11942
|
+
const permission = opencodeConfig.permission ?? {};
|
|
11943
|
+
opencodeConfig.permission = {
|
|
11944
|
+
...permission,
|
|
11945
|
+
compress: "deny",
|
|
11946
|
+
decompress: "deny",
|
|
11947
|
+
search_context: "deny",
|
|
11948
|
+
acp_status: "deny",
|
|
11949
|
+
acp_context_recap: "deny"
|
|
11950
|
+
};
|
|
11951
|
+
return;
|
|
11952
|
+
}
|
|
11896
11953
|
if (config.compress.permission !== "deny" && compressDisabledByOpencode(opencodeConfig.permission)) {
|
|
11897
11954
|
config.compress.permission = "deny";
|
|
11898
11955
|
}
|