billion-context-pi 0.1.47-pr.217.13 → 0.1.47

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 CHANGED
@@ -4607,7 +4607,6 @@ function pruneOrphanRefs(state, messages) {
4607
4607
  }
4608
4608
  }
4609
4609
  var MAX_COMPRESS_ATTEMPTS = 3;
4610
- var MAX_RETRY_PROMPT_FIRES = 5;
4611
4610
  function createRuntime(adapter) {
4612
4611
  const density = new DensityEstimator();
4613
4612
  let countModelId = "default";
@@ -4652,52 +4651,33 @@ function createRuntime(adapter) {
4652
4651
  const compressOutcomeSeen = /* @__PURE__ */ new Set();
4653
4652
  let compressFailTurnKey = null;
4654
4653
  let compressFailCount = 0;
4655
- let retryPromptFires = 0;
4656
- let retryExhaustedNotified = false;
4657
4654
  function noteCompressOutcomes(turnKey, outcomes) {
4658
4655
  if (compressFailTurnKey !== turnKey) {
4659
4656
  compressFailTurnKey = turnKey;
4660
4657
  compressFailCount = 0;
4661
- retryPromptFires = 0;
4662
- retryExhaustedNotified = false;
4663
4658
  }
4664
4659
  const prevCount = compressFailCount;
4665
- let sawNewOutcome = false;
4666
4660
  for (const o of outcomes) {
4667
4661
  if (compressOutcomeSeen.has(o.toolCallId)) continue;
4668
4662
  compressOutcomeSeen.add(o.toolCallId);
4669
- sawNewOutcome = true;
4670
4663
  if (o.isError || o.noop === true) {
4671
4664
  compressFailCount += 1;
4672
4665
  } else if (o.success) {
4673
4666
  compressFailCount = 0;
4674
4667
  }
4675
4668
  }
4676
- if (sawNewOutcome) {
4677
- retryPromptFires = 0;
4678
- retryExhaustedNotified = false;
4679
- }
4680
4669
  const latest = outcomes.length > 0 ? outcomes[outcomes.length - 1] : void 0;
4681
- const latestFailed = latest !== void 0 && (latest.isError || latest.noop === true);
4682
- const retryFor = latestFailed && compressFailCount >= 1 && compressFailCount < MAX_COMPRESS_ATTEMPTS && retryPromptFires < MAX_RETRY_PROMPT_FIRES ? latest.toolCallId : null;
4683
- if (retryFor !== null) retryPromptFires += 1;
4670
+ const retryFor = latest && (latest.isError || latest.noop === true) && compressFailCount >= 1 && compressFailCount < MAX_COMPRESS_ATTEMPTS ? latest.toolCallId : null;
4684
4671
  const cappedNow = compressFailCount >= MAX_COMPRESS_ATTEMPTS && prevCount < MAX_COMPRESS_ATTEMPTS;
4685
- const exhaustedNow = retryFor === null && latestFailed && compressFailCount >= 1 && compressFailCount < MAX_COMPRESS_ATTEMPTS && retryPromptFires >= MAX_RETRY_PROMPT_FIRES && !retryExhaustedNotified;
4686
- if (exhaustedNow) retryExhaustedNotified = true;
4687
- return { count: compressFailCount, retryFor, cappedNow, exhaustedNow, fires: retryPromptFires };
4672
+ return { count: compressFailCount, retryFor, cappedNow };
4688
4673
  }
4689
4674
  function compressRetryCappedFor(turnKey) {
4690
4675
  return compressFailTurnKey === turnKey && compressFailCount >= MAX_COMPRESS_ATTEMPTS;
4691
4676
  }
4692
- function compressRetryExhaustedFor(turnKey) {
4693
- return compressFailTurnKey === turnKey && compressFailCount >= 1 && compressFailCount < MAX_COMPRESS_ATTEMPTS && retryPromptFires >= MAX_RETRY_PROMPT_FIRES;
4694
- }
4695
4677
  function clearCompressRetryTracking() {
4696
4678
  compressOutcomeSeen.clear();
4697
4679
  compressFailTurnKey = null;
4698
4680
  compressFailCount = 0;
4699
- retryPromptFires = 0;
4700
- retryExhaustedNotified = false;
4701
4681
  }
4702
4682
  async function acquireLock(sid) {
4703
4683
  const prev = locks.get(sid) ?? Promise.resolve();
@@ -4786,7 +4766,7 @@ function createRuntime(adapter) {
4786
4766
  nudgeShownTurns.add(k);
4787
4767
  }, nudgeShownFor: (k) => nudgeShownTurns.has(k), clearNudgeTracking: () => {
4788
4768
  nudgeShownTurns.clear();
4789
- }, noteCompressOutcomes, compressRetryCappedFor, compressRetryExhaustedFor, clearCompressRetryTracking, liveContextLimit, configFor, reloadConfig, stateFor, save, acquireLock, overflowFor, overflowDrop, throttleFor, throttleDrop };
4769
+ }, noteCompressOutcomes, compressRetryCappedFor, clearCompressRetryTracking, liveContextLimit, configFor, reloadConfig, stateFor, save, acquireLock, overflowFor, overflowDrop, throttleFor, throttleDrop };
4790
4770
  }
4791
4771
 
4792
4772
  // node_modules/typebox/build/system/memory/memory.mjs
@@ -12128,8 +12108,7 @@ function wireContextTransform(pi, runtime) {
12128
12108
  const emergency = turn.nudge.breakdown?.emergencyOverride === 1;
12129
12109
  turn.nudge.compressibleRanges = viableRanges(turn.nudge.compressibleRanges);
12130
12110
  const retryCapped = runtime.compressRetryCappedFor(turnKey);
12131
- const retryQuiet = retryCapped || runtime.compressRetryExhaustedFor(turnKey);
12132
- const alreadyShown = retryQuiet || !emergency && runtime.nudgeShownFor(turnKey);
12111
+ const alreadyShown = retryCapped || !emergency && runtime.nudgeShownFor(turnKey);
12133
12112
  if (!alreadyShown) {
12134
12113
  rebuilt.push(nudgeMessage(turn.nudge, turn.state.blocks.filter((b) => b.active), runtime.prompts));
12135
12114
  const rendered = renderNudgeText(turn.nudge, runtime.prompts);
@@ -12154,7 +12133,7 @@ ${rendered.text}${example}`);
12154
12133
  const failed = outcome.retryFor !== null ? compressOutcomes.find((o) => o.toolCallId === outcome.retryFor) : void 0;
12155
12134
  if (failed) {
12156
12135
  rebuilt.push(compressRetryMessage(failed.text, outcome.count, MAX_COMPRESS_ATTEMPTS));
12157
- logWarn("nudge", { sid, event: "compress-retry-inject", attempt: outcome.count, max: MAX_COMPRESS_ATTEMPTS, fires: outcome.fires, fireMax: MAX_RETRY_PROMPT_FIRES, toolCallId: failed.toolCallId });
12136
+ logWarn("nudge", { sid, event: "compress-retry-inject", attempt: outcome.count, max: MAX_COMPRESS_ATTEMPTS, toolCallId: failed.toolCallId });
12158
12137
  debug.event("compress-retry-injected", { sid, turnKey, attempt: outcome.count, toolCallId: failed.toolCallId, text: failed.text.slice(0, 200) });
12159
12138
  } else if (outcome.cappedNow) {
12160
12139
  logWarn("nudge", { sid, event: "compress-retry-capped", failures: outcome.count });
@@ -12162,12 +12141,6 @@ ${rendered.text}${example}`);
12162
12141
  if (ctx.hasUI) {
12163
12142
  ctx.ui.notify(`[ACP] compress failed ${outcome.count}\xD7 this turn \u2014 retry prompts disabled until the next user message.`);
12164
12143
  }
12165
- } else if (outcome.exhaustedNow) {
12166
- logWarn("nudge", { sid, event: "compress-retry-exhausted", failures: outcome.count, fires: outcome.fires, fireMax: MAX_RETRY_PROMPT_FIRES });
12167
- debug.event("compress-retry-exhausted", { sid, turnKey, failures: outcome.count });
12168
- if (ctx.hasUI) {
12169
- ctx.ui.notify(`[ACP] compress retry prompt ignored ${MAX_RETRY_PROMPT_FIRES}\xD7 this turn \u2014 retry prompts paused until a new compress attempt or the next user message.`);
12170
- }
12171
12144
  }
12172
12145
  }
12173
12146
  debug.event("context-out", { outMsgs: rebuilt.length, injected: turn.nudge?.shouldInject ?? false, emergency: turn.nudge?.breakdown?.emergencyOverride === 1 });