acp-kernel 0.0.98-pr.477.335 → 0.0.98-pr.479.337
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/compress.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compress.d.ts","sourceRoot":"","sources":["../src/compress.ts"],"names":[],"mappings":"AAKA,OAAO,EAAkC,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAgBhF,OAAO,KAAK,EAAE,mBAAmB,EAAa,MAAM,UAAU,CAAC;AAE/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAI9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAgBvD,OAAO,EAGL,KAAK,YAAY,EAGlB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAEhB,MAAM,EAEN,WAAW,EAGX,iBAAiB,EAEjB,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,KAAK;IACpB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACxC;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,iBAAiB,CAAC;IACxD;mEAC+D;IAC/D,QAAQ,CAAC,KAAK,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAAC;IACvE,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,sBAAsB,CAAC;IACvE,YAAY,IAAI,YAAY,EAAE,CAAC;IAC/B,UAAU,CACR,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,gBAAgB,GACtB,gBAAgB,GAAG,SAAS,CAAC;IAChC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,gBAAgB,EAAE,CAAC;IACnE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MAAM,CAAC;QACf,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,EAAE,CAAC;IACJ,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,KAAK,EAAE,gBAAgB,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACnC;AAqND,wBAAgB,UAAU,CAAC,KAAK,GAAE,KAAU,GAAG,eAAe,CAke7D;AAyrCD,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5261,12 +5261,13 @@ var nudgeNode = {
|
|
|
5261
5261
|
countTokens: ctx.countTokens
|
|
5262
5262
|
});
|
|
5263
5263
|
const baseline = io.state.nudge.lastPerMessageNudgeTokens;
|
|
5264
|
+
const shownAtDecision = io.state.nudge.lastNudgeShownTokens;
|
|
5264
5265
|
const nudgeGrowthTokens = resolveAdaptiveGrowth(
|
|
5265
5266
|
ctx.config.modelContextLimit,
|
|
5266
5267
|
ctx.config.nudge
|
|
5267
5268
|
);
|
|
5268
5269
|
let stamped = { ...io.state.nudge };
|
|
5269
|
-
if (baseline > 0 && ctx.tokenCount < baseline - nudgeGrowthTokens) {
|
|
5270
|
+
if (baseline > 0 && ctx.tokenCount < baseline - nudgeGrowthTokens || shownAtDecision > 0 && ctx.tokenCount < shownAtDecision - nudgeGrowthTokens) {
|
|
5270
5271
|
stamped.lastPerMessageNudgeTokens = ctx.tokenCount;
|
|
5271
5272
|
stamped.lastNudgeShownTokens = 0;
|
|
5272
5273
|
stamped.lastShownByTier = {};
|
|
@@ -7497,30 +7498,12 @@ function parseStringCore(cleaned, callId, diag) {
|
|
|
7497
7498
|
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
7498
7499
|
return parseObjectValue(value, callId, diag);
|
|
7499
7500
|
}
|
|
7500
|
-
if (typeof value === "string") {
|
|
7501
|
-
const recovered2 = salvageLineFormEntries(value, callId);
|
|
7502
|
-
if (recovered2.ranges.length > 0)
|
|
7503
|
-
return finishLineFormSalvage(recovered2, diag, false);
|
|
7504
|
-
}
|
|
7505
7501
|
if (value !== void 0) {
|
|
7506
7502
|
diag.kind = "not-object";
|
|
7507
7503
|
return finish([], diag);
|
|
7508
7504
|
}
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
if (entries.length === 0) {
|
|
7512
|
-
entries = salvageStringSlotEntries(cleaned);
|
|
7513
|
-
fromStringSlot = entries.length > 0;
|
|
7514
|
-
}
|
|
7515
|
-
if (entries.length > 0) {
|
|
7516
|
-
const out = finishSalvage(entries, callId, diag, true);
|
|
7517
|
-
if (fromStringSlot && out.ranges.length > 0) diag.contentSalvage = true;
|
|
7518
|
-
return out;
|
|
7519
|
-
}
|
|
7520
|
-
const recovered = salvageLineFormEntries(cleaned, callId);
|
|
7521
|
-
if (recovered.ranges.length > 0)
|
|
7522
|
-
return finishLineFormSalvage(recovered, diag, looksTruncated(cleaned));
|
|
7523
|
-
return finishSalvage([], callId, diag, looksTruncated(cleaned));
|
|
7505
|
+
const entries = salvageContentEntries(cleaned);
|
|
7506
|
+
return finishSalvage(entries, callId, diag, looksTruncated(cleaned));
|
|
7524
7507
|
}
|
|
7525
7508
|
function parseObjectValue(value, callId, diag) {
|
|
7526
7509
|
diag.keys = Object.keys(value);
|
|
@@ -7542,11 +7525,11 @@ function parseObjectValue(value, callId, diag) {
|
|
|
7542
7525
|
const parsed = parseContentArray(content);
|
|
7543
7526
|
if (parsed === null || parsed.entries.length === 0 && content.trim().length > 0) {
|
|
7544
7527
|
const bare = stripJsonWrapperResidue(content);
|
|
7545
|
-
const entries2 =
|
|
7528
|
+
const entries2 = splitLineEntries(bare);
|
|
7546
7529
|
const { ranges: ranges2, invalid: invalid2, reasons: reasons2 } = validateEntries(entries2, callId);
|
|
7547
|
-
diag.invalidItems = invalid2;
|
|
7548
|
-
if (reasons2.length > 0) diag.invalidReasons = reasons2;
|
|
7549
7530
|
if (ranges2.length > 0) {
|
|
7531
|
+
diag.invalidItems = invalid2;
|
|
7532
|
+
if (reasons2.length > 0) diag.invalidReasons = reasons2;
|
|
7550
7533
|
diag.kind = "ok";
|
|
7551
7534
|
return finish(ranges2, diag);
|
|
7552
7535
|
}
|
|
@@ -7969,56 +7952,6 @@ function looksTruncated(s) {
|
|
|
7969
7952
|
}
|
|
7970
7953
|
return depth > 0 || inString;
|
|
7971
7954
|
}
|
|
7972
|
-
function inlineSingleLineEntry(entries) {
|
|
7973
|
-
if (entries.length !== 1) return entries;
|
|
7974
|
-
const e = entries[0];
|
|
7975
|
-
if (typeof e !== "string" || e.includes("\n")) return entries;
|
|
7976
|
-
const head = e.trim();
|
|
7977
|
-
const m = REF_PAIR_IN_LINE.exec(head) ?? SINGLE_REF_IN_LINE.exec(head);
|
|
7978
|
-
if (m === null) return entries;
|
|
7979
|
-
const rest = head.slice(m.index + m[0].length).trim();
|
|
7980
|
-
if (!/\p{L}|\p{N}/u.test(rest)) return entries;
|
|
7981
|
-
return [m[0] + "\n" + rest];
|
|
7982
|
-
}
|
|
7983
|
-
function salvageLineFormEntries(text, callId) {
|
|
7984
|
-
return validateEntries(
|
|
7985
|
-
inlineSingleLineEntry(splitLineEntries(stripJsonWrapperResidue(text))),
|
|
7986
|
-
callId
|
|
7987
|
-
);
|
|
7988
|
-
}
|
|
7989
|
-
function finishLineFormSalvage(result, diag, truncatedShape) {
|
|
7990
|
-
diag.stringSalvage = true;
|
|
7991
|
-
diag.invalidItems = result.invalid;
|
|
7992
|
-
if (result.reasons.length > 0) diag.invalidReasons = result.reasons;
|
|
7993
|
-
diag.kind = truncatedShape ? "truncated" : "ok";
|
|
7994
|
-
return finish(result.ranges, diag);
|
|
7995
|
-
}
|
|
7996
|
-
function salvageStringSlotEntries(raw) {
|
|
7997
|
-
const match = /"content"\s*:\s*"/.exec(raw);
|
|
7998
|
-
if (match === null) return [];
|
|
7999
|
-
const start = match.index + match[0].length;
|
|
8000
|
-
let i = start;
|
|
8001
|
-
let terminated = false;
|
|
8002
|
-
while (i < raw.length) {
|
|
8003
|
-
const ch = raw.charAt(i);
|
|
8004
|
-
if (ch === "\\") {
|
|
8005
|
-
i += 2;
|
|
8006
|
-
continue;
|
|
8007
|
-
}
|
|
8008
|
-
if (ch === '"') {
|
|
8009
|
-
terminated = true;
|
|
8010
|
-
break;
|
|
8011
|
-
}
|
|
8012
|
-
i++;
|
|
8013
|
-
}
|
|
8014
|
-
const body = raw.slice(start, i).replace(/\\n/g, "\n");
|
|
8015
|
-
const parts = splitLineEntries(body);
|
|
8016
|
-
if (!terminated) {
|
|
8017
|
-
if (parts.length <= 1) return [];
|
|
8018
|
-
parts.pop();
|
|
8019
|
-
}
|
|
8020
|
-
return parts;
|
|
8021
|
-
}
|
|
8022
7955
|
function salvageContentEntries(raw) {
|
|
8023
7956
|
const match = /"content"\s*:\s*\[/.exec(raw);
|
|
8024
7957
|
if (match === null) return [];
|