opencode-acp 1.14.25-pr.352.85 → 1.14.26-pr.353.86
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.js +5 -160
- package/dist/index.js.map +1 -1
- package/dist/lib/config-validation.d.ts.map +1 -1
- package/dist/lib/config.d.ts +0 -30
- 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 +0 -26
- package/dist/lib/messages/inject/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -888,7 +888,6 @@ var VALID_CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
888
888
|
"compress.minContextLimit",
|
|
889
889
|
"compress.modelMaxLimits",
|
|
890
890
|
"compress.modelMinLimits",
|
|
891
|
-
"compress.providers",
|
|
892
891
|
"compress.nudgeFrequency",
|
|
893
892
|
"compress.minNudgeContextPercent",
|
|
894
893
|
"compress.nudgeGrowthTokens",
|
|
@@ -932,7 +931,7 @@ function getConfigKeyPaths(obj, prefix = "") {
|
|
|
932
931
|
for (const key of Object.keys(obj)) {
|
|
933
932
|
const fullKey = prefix ? `${prefix}.${key}` : key;
|
|
934
933
|
keys.push(fullKey);
|
|
935
|
-
if (fullKey === "compress.modelMaxLimits" || fullKey === "compress.modelMinLimits" || fullKey === "
|
|
934
|
+
if (fullKey === "compress.modelMaxLimits" || fullKey === "compress.modelMinLimits" || fullKey === "messageFilters.filters") {
|
|
936
935
|
continue;
|
|
937
936
|
}
|
|
938
937
|
if (obj[key] && typeof obj[key] === "object" && !Array.isArray(obj[key])) {
|
|
@@ -1312,85 +1311,6 @@ function validateConfigTypes(config) {
|
|
|
1312
1311
|
}
|
|
1313
1312
|
validateModelLimits("compress.modelMaxLimits", compress.modelMaxLimits);
|
|
1314
1313
|
validateModelLimits("compress.modelMinLimits", compress.modelMinLimits);
|
|
1315
|
-
const validatePercentField = (key, value) => {
|
|
1316
|
-
if (value === void 0) {
|
|
1317
|
-
return;
|
|
1318
|
-
}
|
|
1319
|
-
if (typeof value !== "number" || !Number.isFinite(value) || value < 0 || value > 100) {
|
|
1320
|
-
errors.push({
|
|
1321
|
-
key,
|
|
1322
|
-
expected: "number (0-100)",
|
|
1323
|
-
actual: JSON.stringify(value)
|
|
1324
|
-
});
|
|
1325
|
-
}
|
|
1326
|
-
};
|
|
1327
|
-
const validateModelOverrides = (prefix, overrides) => {
|
|
1328
|
-
if (overrides === void 0) {
|
|
1329
|
-
return;
|
|
1330
|
-
}
|
|
1331
|
-
if (typeof overrides !== "object" || overrides === null || Array.isArray(overrides)) {
|
|
1332
|
-
errors.push({ key: prefix, expected: "CompressModelOverrides", actual: typeof overrides });
|
|
1333
|
-
return;
|
|
1334
|
-
}
|
|
1335
|
-
const model = overrides;
|
|
1336
|
-
for (const field of Object.keys(model)) {
|
|
1337
|
-
if (field !== "minNudgeContextPercent") {
|
|
1338
|
-
errors.push({
|
|
1339
|
-
key: `${prefix}.${field}`,
|
|
1340
|
-
expected: "known override field (minNudgeContextPercent)",
|
|
1341
|
-
actual: "unknown field"
|
|
1342
|
-
});
|
|
1343
|
-
}
|
|
1344
|
-
}
|
|
1345
|
-
validatePercentField(`${prefix}.minNudgeContextPercent`, model.minNudgeContextPercent);
|
|
1346
|
-
};
|
|
1347
|
-
const validateProviderOverrides = (providers) => {
|
|
1348
|
-
if (providers === void 0) {
|
|
1349
|
-
return;
|
|
1350
|
-
}
|
|
1351
|
-
if (typeof providers !== "object" || providers === null || Array.isArray(providers)) {
|
|
1352
|
-
errors.push({
|
|
1353
|
-
key: "compress.providers",
|
|
1354
|
-
expected: "Record<string, ProviderOverrides>",
|
|
1355
|
-
actual: typeof providers
|
|
1356
|
-
});
|
|
1357
|
-
return;
|
|
1358
|
-
}
|
|
1359
|
-
for (const [providerId, providerValue] of Object.entries(providers)) {
|
|
1360
|
-
const prefix = `compress.providers.${providerId}`;
|
|
1361
|
-
if (typeof providerValue !== "object" || providerValue === null || Array.isArray(providerValue)) {
|
|
1362
|
-
errors.push({ key: prefix, expected: "ProviderOverrides", actual: typeof providerValue });
|
|
1363
|
-
continue;
|
|
1364
|
-
}
|
|
1365
|
-
const provider = providerValue;
|
|
1366
|
-
for (const field of Object.keys(provider)) {
|
|
1367
|
-
if (field !== "minNudgeContextPercent" && field !== "models") {
|
|
1368
|
-
errors.push({
|
|
1369
|
-
key: `${prefix}.${field}`,
|
|
1370
|
-
expected: "known override field (minNudgeContextPercent, models)",
|
|
1371
|
-
actual: "unknown field"
|
|
1372
|
-
});
|
|
1373
|
-
}
|
|
1374
|
-
}
|
|
1375
|
-
validatePercentField(`${prefix}.minNudgeContextPercent`, provider.minNudgeContextPercent);
|
|
1376
|
-
const models = provider.models;
|
|
1377
|
-
if (models === void 0) {
|
|
1378
|
-
continue;
|
|
1379
|
-
}
|
|
1380
|
-
if (typeof models !== "object" || models === null || Array.isArray(models)) {
|
|
1381
|
-
errors.push({
|
|
1382
|
-
key: `${prefix}.models`,
|
|
1383
|
-
expected: "Record<string, ModelOverrides>",
|
|
1384
|
-
actual: typeof models
|
|
1385
|
-
});
|
|
1386
|
-
continue;
|
|
1387
|
-
}
|
|
1388
|
-
for (const [modelId, modelValue] of Object.entries(models)) {
|
|
1389
|
-
validateModelOverrides(`${prefix}.models.${modelId}`, modelValue);
|
|
1390
|
-
}
|
|
1391
|
-
}
|
|
1392
|
-
};
|
|
1393
|
-
validateProviderOverrides(compress.providers);
|
|
1394
1314
|
const validValues = ["ask", "allow", "deny"];
|
|
1395
1315
|
if (compress.permission !== void 0 && !validValues.includes(compress.permission)) {
|
|
1396
1316
|
errors.push({
|
|
@@ -1691,39 +1611,6 @@ function loadConfigFile(configPath) {
|
|
|
1691
1611
|
return { data: null, parseError: error.message || "Failed to parse config" };
|
|
1692
1612
|
}
|
|
1693
1613
|
}
|
|
1694
|
-
function stripUndefined(value) {
|
|
1695
|
-
const result = {};
|
|
1696
|
-
for (const [key, entry] of Object.entries(value)) {
|
|
1697
|
-
if (entry !== void 0) {
|
|
1698
|
-
result[key] = entry;
|
|
1699
|
-
}
|
|
1700
|
-
}
|
|
1701
|
-
return result;
|
|
1702
|
-
}
|
|
1703
|
-
function mergeModelOverrides(base, override) {
|
|
1704
|
-
if (base === void 0) return override;
|
|
1705
|
-
if (override === void 0) return base;
|
|
1706
|
-
const merged = { ...base };
|
|
1707
|
-
for (const [modelId, model] of Object.entries(override)) {
|
|
1708
|
-
merged[modelId] = { ...base[modelId], ...stripUndefined(model) };
|
|
1709
|
-
}
|
|
1710
|
-
return merged;
|
|
1711
|
-
}
|
|
1712
|
-
function mergeProviderOverrides(base, override) {
|
|
1713
|
-
if (base === void 0) return override;
|
|
1714
|
-
if (override === void 0) return base;
|
|
1715
|
-
const merged = { ...base };
|
|
1716
|
-
for (const [providerId, provider] of Object.entries(override)) {
|
|
1717
|
-
const baseProvider = base[providerId];
|
|
1718
|
-
const mergedModels = mergeModelOverrides(baseProvider?.models, provider.models);
|
|
1719
|
-
merged[providerId] = {
|
|
1720
|
-
...baseProvider,
|
|
1721
|
-
...stripUndefined(provider),
|
|
1722
|
-
...mergedModels !== void 0 ? { models: mergedModels } : {}
|
|
1723
|
-
};
|
|
1724
|
-
}
|
|
1725
|
-
return merged;
|
|
1726
|
-
}
|
|
1727
1614
|
function mergeCompress(base, override) {
|
|
1728
1615
|
if (!override) {
|
|
1729
1616
|
return base;
|
|
@@ -1736,7 +1623,6 @@ function mergeCompress(base, override) {
|
|
|
1736
1623
|
minContextLimit: override.minContextLimit ?? base.minContextLimit,
|
|
1737
1624
|
modelMaxLimits: override.modelMaxLimits ?? base.modelMaxLimits,
|
|
1738
1625
|
modelMinLimits: override.modelMinLimits ?? base.modelMinLimits,
|
|
1739
|
-
providers: mergeProviderOverrides(base.providers, override.providers),
|
|
1740
1626
|
nudgeFrequency: override.nudgeFrequency ?? base.nudgeFrequency,
|
|
1741
1627
|
minNudgeContextPercent: override.minNudgeContextPercent ?? base.minNudgeContextPercent,
|
|
1742
1628
|
nudgeGrowthTokens: override.nudgeGrowthTokens,
|
|
@@ -1787,22 +1673,6 @@ function deepCloneConfig(config) {
|
|
|
1787
1673
|
...config.compress,
|
|
1788
1674
|
modelMaxLimits: { ...config.compress.modelMaxLimits },
|
|
1789
1675
|
modelMinLimits: { ...config.compress.modelMinLimits },
|
|
1790
|
-
providers: config.compress.providers ? Object.fromEntries(
|
|
1791
|
-
Object.entries(config.compress.providers).map(([providerId, provider]) => [
|
|
1792
|
-
providerId,
|
|
1793
|
-
{
|
|
1794
|
-
...provider,
|
|
1795
|
-
...provider.models ? {
|
|
1796
|
-
models: Object.fromEntries(
|
|
1797
|
-
Object.entries(provider.models).map(([modelId, model]) => [
|
|
1798
|
-
modelId,
|
|
1799
|
-
{ ...model }
|
|
1800
|
-
])
|
|
1801
|
-
)
|
|
1802
|
-
} : {}
|
|
1803
|
-
}
|
|
1804
|
-
])
|
|
1805
|
-
) : void 0,
|
|
1806
1676
|
protectedTools: [...config.compress.protectedTools]
|
|
1807
1677
|
},
|
|
1808
1678
|
gc: {
|
|
@@ -7087,26 +6957,6 @@ function computeShouldNudge2(params) {
|
|
|
7087
6957
|
return policy.computeShouldNudge(params);
|
|
7088
6958
|
}
|
|
7089
6959
|
var DEFAULT_NUDGE_GROWTH_TOKENS = 5e4;
|
|
7090
|
-
var DEFAULT_MIN_NUDGE_CONTEXT_PERCENT = 5;
|
|
7091
|
-
function resolveMinNudgeContextPercent(config, providerId, modelId) {
|
|
7092
|
-
const modelOverrides = providerId !== void 0 && modelId !== void 0 ? config.compress?.providers?.[providerId]?.models?.[modelId] : void 0;
|
|
7093
|
-
if (modelOverrides?.minNudgeContextPercent !== void 0) {
|
|
7094
|
-
return modelOverrides.minNudgeContextPercent;
|
|
7095
|
-
}
|
|
7096
|
-
const providerOverrides = providerId !== void 0 ? config.compress?.providers?.[providerId] : void 0;
|
|
7097
|
-
if (providerOverrides?.minNudgeContextPercent !== void 0) {
|
|
7098
|
-
return providerOverrides.minNudgeContextPercent;
|
|
7099
|
-
}
|
|
7100
|
-
return config.compress?.minNudgeContextPercent;
|
|
7101
|
-
}
|
|
7102
|
-
function resolveMinNudgeFloorTokens(config, modelContextLimit, providerId, modelId) {
|
|
7103
|
-
if (modelContextLimit === void 0) {
|
|
7104
|
-
return void 0;
|
|
7105
|
-
}
|
|
7106
|
-
const percent = resolveMinNudgeContextPercent(config, providerId, modelId) ?? DEFAULT_MIN_NUDGE_CONTEXT_PERCENT;
|
|
7107
|
-
const clamped = Math.min(100, Math.max(0, percent));
|
|
7108
|
-
return Math.round(clamped / 100 * modelContextLimit);
|
|
7109
|
-
}
|
|
7110
6960
|
function addAnchor(anchorMessageIds, anchorMessageId, anchorMessageIndex, messages, interval) {
|
|
7111
6961
|
if (anchorMessageIndex < 0) {
|
|
7112
6962
|
return false;
|
|
@@ -7789,16 +7639,11 @@ var injectCompressNudges = (state, config, logger, messages, prompts, compressio
|
|
|
7789
7639
|
overMinLimit,
|
|
7790
7640
|
overMaxLimit,
|
|
7791
7641
|
lastNudgeTokens: growthReference,
|
|
7792
|
-
minNudgeContextPercent:
|
|
7642
|
+
minNudgeContextPercent: config.compress?.minNudgeContextPercent ?? 5,
|
|
7793
7643
|
nudgeGrowthTokens: effectiveThreshold
|
|
7794
7644
|
});
|
|
7795
7645
|
const growthSinceBaseline = currentTokens !== void 0 && growthReference !== void 0 ? currentTokens - growthReference : void 0;
|
|
7796
|
-
const minNudgeFloorTokens =
|
|
7797
|
-
config,
|
|
7798
|
-
modelContextLimit,
|
|
7799
|
-
providerId,
|
|
7800
|
-
modelId
|
|
7801
|
-
);
|
|
7646
|
+
const minNudgeFloorTokens = modelContextLimit !== void 0 ? Math.round((config.compress?.minNudgeContextPercent ?? 5) / 100 * modelContextLimit) : void 0;
|
|
7802
7647
|
const overMinNudgeFloor = minNudgeFloorTokens === void 0 || currentTokens === void 0 || currentTokens >= minNudgeFloorTokens;
|
|
7803
7648
|
const nudgeAllowed = emergencyOverride || decision.shouldNudge && (overMaxLimit || overMinNudgeFloor) && growthSinceBaseline !== void 0 && growthSinceBaseline >= growthFloor;
|
|
7804
7649
|
const effectiveTipsVariant = emergencyOverride ? "maxLimit" : decision.tipsVariant;
|
|
@@ -9267,7 +9112,7 @@ import { writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
|
9267
9112
|
import { join as join3 } from "path";
|
|
9268
9113
|
import { existsSync as existsSync3 } from "fs";
|
|
9269
9114
|
import { homedir as homedir3 } from "os";
|
|
9270
|
-
var LOG_VERSION = true ? "1.14.
|
|
9115
|
+
var LOG_VERSION = true ? "1.14.26-pr.353.86" : "dev";
|
|
9271
9116
|
var LEVEL_RANK = {
|
|
9272
9117
|
debug: 10,
|
|
9273
9118
|
info: 20,
|
|
@@ -11708,7 +11553,7 @@ var server = (async (ctx) => {
|
|
|
11708
11553
|
}
|
|
11709
11554
|
const logger = new Logger(config.debug, config.debug ? "debug" : config.logLevel);
|
|
11710
11555
|
logger.info("ACP plugin initialized", {
|
|
11711
|
-
version: true ? "1.14.
|
|
11556
|
+
version: true ? "1.14.26-pr.353.86" : "dev",
|
|
11712
11557
|
workspace: ctx.directory,
|
|
11713
11558
|
logLevel: logger.level,
|
|
11714
11559
|
debug: config.debug,
|