opencode-acp 1.14.25-pr.343.65 → 1.14.25-pr.345.67
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 +11 -4
- package/README.zh-CN.md +8 -0
- package/dist/index.js +44 -4
- package/dist/index.js.map +1 -1
- package/dist/lib/config-validation.d.ts.map +1 -1
- package/dist/lib/config.d.ts +1 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/messages/inject/inject.d.ts.map +1 -1
- package/dist/lib/messages/inject/utils.d.ts +17 -1
- package/dist/lib/messages/inject/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -325,10 +325,9 @@ Each level overrides the previous, so project settings take priority over global
|
|
|
325
325
|
// compression nudges (based on nudgeFrequency), so compression is
|
|
326
326
|
// much more likely. Accepts: number or "X%" of model context window.
|
|
327
327
|
"maxContextLimit": "80%",
|
|
328
|
-
// Soft lower threshold for
|
|
329
|
-
//
|
|
330
|
-
// are on.
|
|
331
|
-
// Accepts: number or "X%" of model context window.
|
|
328
|
+
// Soft lower threshold for reminder nudges: below this, growth/turn/iteration
|
|
329
|
+
// reminders are off (compression less likely). At/above this, reminders
|
|
330
|
+
// are on. Accepts: number or "X%" of model context window.
|
|
332
331
|
"minContextLimit": "80%",
|
|
333
332
|
// Optional per-model override for maxContextLimit by providerID/modelID.
|
|
334
333
|
// If present, this wins over the global maxContextLimit.
|
|
@@ -344,6 +343,14 @@ Each level overrides the previous, so project settings take priority over global
|
|
|
344
343
|
// "openai/gpt-5.3-codex": 50000,
|
|
345
344
|
// "anthropic/claude-sonnet-4.6": "25%"
|
|
346
345
|
// },
|
|
346
|
+
// Optional per-model override for the growth-nudge floor
|
|
347
|
+
// (minNudgeContextPercent). Keyed by providerID/modelID; accepts a
|
|
348
|
+
// token count or "X%" of that model's context window. If present,
|
|
349
|
+
// this wins over the global minNudgeContextPercent for that model.
|
|
350
|
+
// "modelMinNudgeLimits": {
|
|
351
|
+
// "openai/gpt-5.6": 150000,
|
|
352
|
+
// "openrouter/z-ai/glm-5.3": "20%"
|
|
353
|
+
// },
|
|
347
354
|
// How often the context-limit nudge fires (1 = every fetch, 5 = every 5th)
|
|
348
355
|
"nudgeFrequency": 5,
|
|
349
356
|
// Start adding compression reminders after this many
|
package/README.zh-CN.md
CHANGED
|
@@ -297,6 +297,14 @@ ACP 使用自己的配置文件,按以下顺序搜索:
|
|
|
297
297
|
// "openai/gpt-5.3-codex": 50000,
|
|
298
298
|
// "anthropic/claude-sonnet-4.6": "25%"
|
|
299
299
|
// },
|
|
300
|
+
// Optional per-model override for the growth-nudge floor
|
|
301
|
+
// (minNudgeContextPercent). Keyed by providerID/modelID; accepts a
|
|
302
|
+
// token count or "X%" of that model's context window. If present,
|
|
303
|
+
// this wins over the global minNudgeContextPercent for that model.
|
|
304
|
+
// "modelMinNudgeLimits": {
|
|
305
|
+
// "openai/gpt-5.6": 150000,
|
|
306
|
+
// "openrouter/z-ai/glm-5.3": "20%"
|
|
307
|
+
// },
|
|
300
308
|
// How often the context-limit nudge fires (1 = every fetch, 5 = every 5th)
|
|
301
309
|
"nudgeFrequency": 5,
|
|
302
310
|
// Start adding compression reminders after this many
|
package/dist/index.js
CHANGED
|
@@ -888,6 +888,7 @@ var VALID_CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
888
888
|
"compress.minContextLimit",
|
|
889
889
|
"compress.modelMaxLimits",
|
|
890
890
|
"compress.modelMinLimits",
|
|
891
|
+
"compress.modelMinNudgeLimits",
|
|
891
892
|
"compress.nudgeFrequency",
|
|
892
893
|
"compress.minNudgeContextPercent",
|
|
893
894
|
"compress.nudgeGrowthTokens",
|
|
@@ -931,7 +932,7 @@ function getConfigKeyPaths(obj, prefix = "") {
|
|
|
931
932
|
for (const key of Object.keys(obj)) {
|
|
932
933
|
const fullKey = prefix ? `${prefix}.${key}` : key;
|
|
933
934
|
keys.push(fullKey);
|
|
934
|
-
if (fullKey === "compress.modelMaxLimits" || fullKey === "compress.modelMinLimits" || fullKey === "messageFilters.filters") {
|
|
935
|
+
if (fullKey === "compress.modelMaxLimits" || fullKey === "compress.modelMinLimits" || fullKey === "compress.modelMinNudgeLimits" || fullKey === "messageFilters.filters") {
|
|
935
936
|
continue;
|
|
936
937
|
}
|
|
937
938
|
if (obj[key] && typeof obj[key] === "object" && !Array.isArray(obj[key])) {
|
|
@@ -1311,6 +1312,7 @@ function validateConfigTypes(config) {
|
|
|
1311
1312
|
}
|
|
1312
1313
|
validateModelLimits("compress.modelMaxLimits", compress.modelMaxLimits);
|
|
1313
1314
|
validateModelLimits("compress.modelMinLimits", compress.modelMinLimits);
|
|
1315
|
+
validateModelLimits("compress.modelMinNudgeLimits", compress.modelMinNudgeLimits);
|
|
1314
1316
|
const validValues = ["ask", "allow", "deny"];
|
|
1315
1317
|
if (compress.permission !== void 0 && !validValues.includes(compress.permission)) {
|
|
1316
1318
|
errors.push({
|
|
@@ -1623,6 +1625,7 @@ function mergeCompress(base, override) {
|
|
|
1623
1625
|
minContextLimit: override.minContextLimit ?? base.minContextLimit,
|
|
1624
1626
|
modelMaxLimits: override.modelMaxLimits ?? base.modelMaxLimits,
|
|
1625
1627
|
modelMinLimits: override.modelMinLimits ?? base.modelMinLimits,
|
|
1628
|
+
modelMinNudgeLimits: override.modelMinNudgeLimits ?? base.modelMinNudgeLimits,
|
|
1626
1629
|
nudgeFrequency: override.nudgeFrequency ?? base.nudgeFrequency,
|
|
1627
1630
|
minNudgeContextPercent: override.minNudgeContextPercent ?? base.minNudgeContextPercent,
|
|
1628
1631
|
nudgeGrowthTokens: override.nudgeGrowthTokens,
|
|
@@ -1673,6 +1676,7 @@ function deepCloneConfig(config) {
|
|
|
1673
1676
|
...config.compress,
|
|
1674
1677
|
modelMaxLimits: { ...config.compress.modelMaxLimits },
|
|
1675
1678
|
modelMinLimits: { ...config.compress.modelMinLimits },
|
|
1679
|
+
modelMinNudgeLimits: { ...config.compress.modelMinNudgeLimits },
|
|
1676
1680
|
protectedTools: [...config.compress.protectedTools]
|
|
1677
1681
|
},
|
|
1678
1682
|
gc: {
|
|
@@ -6909,6 +6913,37 @@ function resolveContextTokenLimit(config, state, providerId, modelId, threshold)
|
|
|
6909
6913
|
const globalLimit = threshold === "max" ? config.compress.maxContextLimit : config.compress.minContextLimit;
|
|
6910
6914
|
return parseLimitValue(globalLimit);
|
|
6911
6915
|
}
|
|
6916
|
+
function resolveMinNudgeFloorTokens(config, modelContextLimit, providerId, modelId) {
|
|
6917
|
+
const parseModelLimit = (limit) => {
|
|
6918
|
+
if (typeof limit === "number") {
|
|
6919
|
+
return limit;
|
|
6920
|
+
}
|
|
6921
|
+
if (modelContextLimit === void 0) {
|
|
6922
|
+
return void 0;
|
|
6923
|
+
}
|
|
6924
|
+
const parsedPercent = parseFloat(limit.slice(0, -1));
|
|
6925
|
+
if (isNaN(parsedPercent)) {
|
|
6926
|
+
return void 0;
|
|
6927
|
+
}
|
|
6928
|
+
const roundedPercent = Math.round(parsedPercent);
|
|
6929
|
+
const clampedPercent = Math.max(0, Math.min(100, roundedPercent));
|
|
6930
|
+
return Math.round(clampedPercent / 100 * modelContextLimit);
|
|
6931
|
+
};
|
|
6932
|
+
const modelLimits = config.compress.modelMinNudgeLimits;
|
|
6933
|
+
if (modelLimits && providerId !== void 0 && modelId !== void 0) {
|
|
6934
|
+
const modelLimit = modelLimits[`${providerId}/${modelId}`];
|
|
6935
|
+
if (modelLimit !== void 0) {
|
|
6936
|
+
const resolved = parseModelLimit(modelLimit);
|
|
6937
|
+
if (resolved !== void 0) {
|
|
6938
|
+
return resolved;
|
|
6939
|
+
}
|
|
6940
|
+
}
|
|
6941
|
+
}
|
|
6942
|
+
if (modelContextLimit === void 0) {
|
|
6943
|
+
return void 0;
|
|
6944
|
+
}
|
|
6945
|
+
return Math.round((config.compress.minNudgeContextPercent ?? 15) / 100 * modelContextLimit);
|
|
6946
|
+
}
|
|
6912
6947
|
function isContextOverLimits(config, state, providerId, modelId, messages) {
|
|
6913
6948
|
const summaryTokenExtension = config.compress.summaryBuffer ? getActiveSummaryTokenUsage(
|
|
6914
6949
|
state,
|
|
@@ -7643,7 +7678,12 @@ var injectCompressNudges = (state, config, logger, messages, prompts, compressio
|
|
|
7643
7678
|
nudgeGrowthTokens: effectiveThreshold
|
|
7644
7679
|
});
|
|
7645
7680
|
const growthSinceBaseline = currentTokens !== void 0 && growthReference !== void 0 ? currentTokens - growthReference : void 0;
|
|
7646
|
-
const minNudgeFloorTokens =
|
|
7681
|
+
const minNudgeFloorTokens = resolveMinNudgeFloorTokens(
|
|
7682
|
+
config,
|
|
7683
|
+
modelContextLimit,
|
|
7684
|
+
providerId,
|
|
7685
|
+
modelId
|
|
7686
|
+
);
|
|
7647
7687
|
const overMinNudgeFloor = minNudgeFloorTokens === void 0 || currentTokens === void 0 || currentTokens >= minNudgeFloorTokens;
|
|
7648
7688
|
const nudgeAllowed = emergencyOverride || decision.shouldNudge && (overMaxLimit || overMinNudgeFloor) && growthSinceBaseline !== void 0 && growthSinceBaseline >= growthFloor;
|
|
7649
7689
|
const effectiveTipsVariant = emergencyOverride ? "maxLimit" : decision.tipsVariant;
|
|
@@ -9112,7 +9152,7 @@ import { writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
|
9112
9152
|
import { join as join3 } from "path";
|
|
9113
9153
|
import { existsSync as existsSync3 } from "fs";
|
|
9114
9154
|
import { homedir as homedir3 } from "os";
|
|
9115
|
-
var LOG_VERSION = true ? "1.14.25-pr.
|
|
9155
|
+
var LOG_VERSION = true ? "1.14.25-pr.345.67" : "dev";
|
|
9116
9156
|
var LEVEL_RANK = {
|
|
9117
9157
|
debug: 10,
|
|
9118
9158
|
info: 20,
|
|
@@ -11553,7 +11593,7 @@ var server = (async (ctx) => {
|
|
|
11553
11593
|
}
|
|
11554
11594
|
const logger = new Logger(config.debug, config.debug ? "debug" : config.logLevel);
|
|
11555
11595
|
logger.info("ACP plugin initialized", {
|
|
11556
|
-
version: true ? "1.14.25-pr.
|
|
11596
|
+
version: true ? "1.14.25-pr.345.67" : "dev",
|
|
11557
11597
|
workspace: ctx.directory,
|
|
11558
11598
|
logLevel: logger.level,
|
|
11559
11599
|
debug: config.debug,
|