billion-context-pi 0.1.59-pr.331.128 → 0.1.59
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 +6 -30
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.ts +0 -5
- package/package.json +1 -1
- package/dist/compress-loop.d.ts +0 -3
package/dist/index.js
CHANGED
|
@@ -3826,10 +3826,6 @@ var REF_TAG_SOURCE = "(?:<acp\\s[^>]*>m\\d{5}</acp>|\\[m\\d{1,5}\\])";
|
|
|
3826
3826
|
var REF_TAG = new RegExp(`^${REF_TAG_SOURCE}\\s?\\n?`);
|
|
3827
3827
|
var TRAILING_REF_TAG = new RegExp(`\\n*${REF_TAG_SOURCE}\\s*$`);
|
|
3828
3828
|
var ACP_STATUS_CUSTOM_TYPE = "acp-status";
|
|
3829
|
-
var INTERRUPTED_STOP_REASONS = /* @__PURE__ */ new Set(["aborted", "error"]);
|
|
3830
|
-
function wasInterrupted(msg) {
|
|
3831
|
-
return typeof msg.stopReason === "string" && INTERRUPTED_STOP_REASONS.has(msg.stopReason);
|
|
3832
|
-
}
|
|
3833
3829
|
function entriesToCoreMessages(entries) {
|
|
3834
3830
|
const out = [];
|
|
3835
3831
|
for (const entry of entries) {
|
|
@@ -3864,8 +3860,7 @@ function projectMessage(message, id) {
|
|
|
3864
3860
|
}];
|
|
3865
3861
|
}
|
|
3866
3862
|
if (role === "assistant") {
|
|
3867
|
-
|
|
3868
|
-
if (wasInterrupted(msg)) calls = [];
|
|
3863
|
+
const calls = allToolCalls(msg.content);
|
|
3869
3864
|
if (calls.length > 0) {
|
|
3870
3865
|
const textParts = extractText(msg.content);
|
|
3871
3866
|
if (calls.length === 1) {
|
|
@@ -4197,10 +4192,10 @@ var SessionStateStore = class {
|
|
|
4197
4192
|
}
|
|
4198
4193
|
async save(state, sessionFile, sessionId) {
|
|
4199
4194
|
const file = stateFileFor(sessionFile);
|
|
4195
|
+
if (!file) return;
|
|
4200
4196
|
const key = cacheKey(sessionFile, sessionId);
|
|
4201
4197
|
const liveRefOrigins = this.cache.get(key)?.liveRefOrigins ?? [];
|
|
4202
4198
|
this.cache.set(key, { state, liveRefOrigins });
|
|
4203
|
-
if (!file) return;
|
|
4204
4199
|
const dir = path2.dirname(file);
|
|
4205
4200
|
await fs.mkdir(dir, { recursive: true }).catch((e) => {
|
|
4206
4201
|
logError("state", { event: "save-mkdir-failed", dir, error: e instanceof Error ? e.message : String(e) });
|
|
@@ -4952,9 +4947,6 @@ function createRuntime(adapter) {
|
|
|
4952
4947
|
function compressRetryCappedFor(turnKey) {
|
|
4953
4948
|
return compressFailTurnKey === turnKey && compressFailCount >= MAX_COMPRESS_ATTEMPTS;
|
|
4954
4949
|
}
|
|
4955
|
-
function compressFailCountFor(turnKey) {
|
|
4956
|
-
return compressFailTurnKey === turnKey ? compressFailCount : 0;
|
|
4957
|
-
}
|
|
4958
4950
|
function clearCompressRetryTracking() {
|
|
4959
4951
|
compressOutcomeSeen.clear();
|
|
4960
4952
|
compressFailTurnKey = null;
|
|
@@ -5061,7 +5053,7 @@ function createRuntime(adapter) {
|
|
|
5061
5053
|
}, nudgeShownFor: (k) => nudgeShownTurns.has(k), nudgeShownTokensFor: (k) => nudgeShownTokens.get(k), clearNudgeTracking: () => {
|
|
5062
5054
|
nudgeShownTurns.clear();
|
|
5063
5055
|
nudgeShownTokens.clear();
|
|
5064
|
-
}, clearNudgeTokenStamps: () => nudgeShownTokens.clear(), noteCompressOutcomes, compressRetryCappedFor,
|
|
5056
|
+
}, clearNudgeTokenStamps: () => nudgeShownTokens.clear(), noteCompressOutcomes, compressRetryCappedFor, clearCompressRetryTracking, liveContextLimit, configFor, reloadConfig, stateFor, save, acquireLock, overflowFor, overflowDrop, noteDeadCompress, clearDeadCompress, throttleFor, throttleDrop, noteTokenScale, dropTokenScale };
|
|
5065
5057
|
}
|
|
5066
5058
|
|
|
5067
5059
|
// node_modules/typebox/build/system/memory/memory.mjs
|
|
@@ -9716,7 +9708,7 @@ function cappedRejectionText(snapshot) {
|
|
|
9716
9708
|
"Current compressible ranges (use these refs exactly as listed):",
|
|
9717
9709
|
snapshot,
|
|
9718
9710
|
"",
|
|
9719
|
-
"Continue the task
|
|
9711
|
+
"Continue the task; compress becomes available again on the next user message."
|
|
9720
9712
|
].join("\n");
|
|
9721
9713
|
}
|
|
9722
9714
|
function tier3OnlyRewrite(newBlocks, allBlocks) {
|
|
@@ -16631,10 +16623,6 @@ PROVIDER THROTTLE RETRY
|
|
|
16631
16623
|
|
|
16632
16624
|
A provider rate-limit error (e.g. "Too many tokens, please wait before trying again.") may appear as a failed assistant response followed by a [ACP:provider-throttle] note. The interruption was transient and the system is retrying automatically. After such an interruption, resume the interrupted step exactly where it left off: do not re-run completed steps, do not re-read content already in context, and do not discuss the interruption unless asked.
|
|
16633
16625
|
Retries are capped; when the cap is reached the error is surfaced to the user unchanged. If the user sends new input during a retry wait, the retry is cancelled.
|
|
16634
|
-
|
|
16635
|
-
COMPRESS LOOP GUARD
|
|
16636
|
-
|
|
16637
|
-
If you see a note beginning with [ACP:compress-loop], you have been repeatedly issuing compress calls this turn without making progress (identical or already-compressed ranges). STOP calling compress immediately and do not try to "fix" it by re-issuing another compress call \u2014 that is exactly what is looping. Continue your actual task using the context you already have. Compressing becomes available again on the next user message.
|
|
16638
16626
|
`;
|
|
16639
16627
|
}
|
|
16640
16628
|
var ACP_DELEGATE_PROMPT = `
|
|
@@ -17230,13 +17218,6 @@ async function getInstalledSpec() {
|
|
|
17230
17218
|
return hostPkg?.dependencies?.[PACKAGE_NAME];
|
|
17231
17219
|
}
|
|
17232
17220
|
|
|
17233
|
-
// src/compress-loop.ts
|
|
17234
|
-
var COMPRESS_LOOP_SENTINEL = "[ACP:compress-loop]";
|
|
17235
|
-
var COMPRESS_LOOP_CORRECT_THRESHOLD = 2;
|
|
17236
|
-
function buildCompressLoopText(failures) {
|
|
17237
|
-
return `${COMPRESS_LOOP_SENTINEL} You have issued ${failures} compress calls this turn without making progress (identical or already-compressed ranges). STOP calling compress now. Continue your actual task using the context you already have \u2014 compression is paused until your next user request.`;
|
|
17238
|
-
}
|
|
17239
|
-
|
|
17240
17221
|
// src/proxy-detect.ts
|
|
17241
17222
|
function isBiliProxyBaseUrl(baseUrl) {
|
|
17242
17223
|
if (!baseUrl) return false;
|
|
@@ -17507,7 +17488,6 @@ function wireContextTransform(pi, runtime, standDownIfProxied) {
|
|
|
17507
17488
|
const turnKey = lastUserMessageId(entries) ?? sid;
|
|
17508
17489
|
const compressOutcomes = collectCompressOutcomes(entries, turnStartIndex(entries));
|
|
17509
17490
|
const outcome = compressOutcomes.length > 0 ? runtime.noteCompressOutcomes(turnKey, compressOutcomes) : null;
|
|
17510
|
-
const compressFails = runtime.compressFailCountFor(turnKey);
|
|
17511
17491
|
const adaptiveGrowth = !config.modelContextLimit || config.modelContextLimit <= 0 ? config.nudge.growthFloor : Math.min(
|
|
17512
17492
|
config.nudge.growthCap,
|
|
17513
17493
|
Math.max(config.nudge.growthFloor, Math.round(config.modelContextLimit * config.nudge.growthRatio))
|
|
@@ -17522,8 +17502,9 @@ function wireContextTransform(pi, runtime, standDownIfProxied) {
|
|
|
17522
17502
|
if (turn.nudge?.shouldInject) {
|
|
17523
17503
|
const emergency = turn.nudge.breakdown?.emergencyOverride === 1;
|
|
17524
17504
|
turn.nudge.compressibleRanges = viableRanges(turn.nudge.compressibleRanges);
|
|
17505
|
+
const retryCapped = runtime.compressRetryCappedFor(turnKey);
|
|
17525
17506
|
const reInjectReady = shownAt === void 0 || tokenCount - shownAt >= reInjectFloor;
|
|
17526
|
-
const alreadyShown =
|
|
17507
|
+
const alreadyShown = retryCapped || !emergency && runtime.nudgeShownFor(turnKey) && !reInjectReady;
|
|
17527
17508
|
if (!alreadyShown) {
|
|
17528
17509
|
rebuilt.push(nudgeMessage(turn.nudge, turn.state.blocks.filter((b2) => b2.active), runtime.prompts));
|
|
17529
17510
|
const rendered = renderNudgeText(turn.nudge, runtime.prompts);
|
|
@@ -17551,11 +17532,6 @@ ${rendered.text}${example}`);
|
|
|
17551
17532
|
ctx.ui.notify(`[ACP] compress failed ${outcome.count}\xD7 this turn \u2014 nudge paused until the next user message (emergency truncation still active).`);
|
|
17552
17533
|
}
|
|
17553
17534
|
}
|
|
17554
|
-
if (compressFails >= COMPRESS_LOOP_CORRECT_THRESHOLD) {
|
|
17555
|
-
rebuilt.push({ role: "user", content: [{ type: "text", text: buildCompressLoopText(compressFails) }], timestamp: Date.now() });
|
|
17556
|
-
logWarn("nudge", { sid, event: "compress-loop-correction", failures: compressFails });
|
|
17557
|
-
debug.event("compress-loop-correction", { sid, turnKey, failures: compressFails });
|
|
17558
|
-
}
|
|
17559
17535
|
debug.event("context-out", { outMsgs: rebuilt.length, injected: turn.nudge?.shouldInject ?? false, emergency: turn.nudge?.breakdown?.emergencyOverride === 1 });
|
|
17560
17536
|
const updateCheck = checkForUpdate(runtime.adapter.autoUpdate ?? true, (msg) => {
|
|
17561
17537
|
if (ctx.hasUI) ctx.ui.notify(msg);
|