billion-context 0.1.103-pr.699.527 → 0.1.103

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
@@ -51956,11 +51956,7 @@ ${reasons.map((r) => `- ${r}`).join("\n")}` : "";
51956
51956
  const shrinkRatio = preContext > 0 ? r.tokensCompressed / preContext : 0;
51957
51957
  const foldPoint = [...ranges].sort((a, b2) => refNum(a.startRef) - refNum(b2.startRef))[0]?.startRef ?? "unknown";
51958
51958
  ctx.session.lastCompress = { at: Date.now(), shrinkRatio, foldPoint, blocks: r.blocksCreated, tokensCompressed: r.tokensCompressed };
51959
- ctx.session.stats.pendingFoldUsage = true;
51960
- const anchorTok = res.state.blocks.reduce((n, b2) => n + (b2.active ? Math.ceil(b2.summary.length / 4) : 0), 0);
51961
- const postCtx = Math.max(0, preContext - r.tokensCompressed);
51962
- const ceiling = postCtx > 0 ? Math.floor(100 * anchorTok / postCtx) : 0;
51963
- ctx.log(`[acp-compress-obs] shrink ${Math.round(shrinkRatio * 100)}% (~${r.tokensCompressed}/${preContext} tok) foldPoint=${foldPoint} blocks=${r.blocksCreated} anchor\u2248${anchorTok} tok (${res.state.blocks.filter((b2) => b2.active).length} active blocks, sys excluded) postCtx\u2248${postCtx} \u2192 next-request cache ceiling \u2265${ceiling}%`);
51959
+ ctx.log(`[acp-compress-obs] shrink ${Math.round(shrinkRatio * 100)}% (~${r.tokensCompressed}/${preContext} tok) foldPoint=${foldPoint} blocks=${r.blocksCreated}`);
51964
51960
  const warn = r.warnings.length > 0 ? ` ${r.warnings.join("; ")}` : "";
51965
51961
  let msg = `[Compressed ${detail} \u2192 ${r.blocksCreated} block(s), ~${r.tokensCompressed} tokens saved.${warn}]`;
51966
51962
  const maxShrink = maxShrinkPerCompress();
@@ -53494,10 +53490,8 @@ function recordUsage(ctx, usage, round) {
53494
53490
  if (typeof out === "number") ctx.session.stats.outputTokens += out;
53495
53491
  const hitPct = typeof cached === "number" && total > 0 ? Math.round(cached / total * 100) : 0;
53496
53492
  warnCacheCollapse(ctx.session, total, cached ?? 0);
53497
- const foldNew = ctx.session.stats.pendingFoldUsage === true;
53498
- if (foldNew) ctx.session.stats.pendingFoldUsage = false;
53499
53493
  ctx.log(
53500
- `[acp-usage] round ${round} input=${total} cached=${cached ?? 0} (cache hit ${hitPct}%)${foldNew ? " fold=new" : ""}`
53494
+ `[acp-usage] round ${round} input=${total} cached=${cached ?? 0} (cache hit ${hitPct}%)`
53501
53495
  );
53502
53496
  }
53503
53497
  async function* runCompressLoop(upstream, ctx, requestBody, requestOptions, adapter, systemPrompt, signal) {
@@ -56776,10 +56770,6 @@ function applyUsageSample(session, sample, protocol) {
56776
56770
  session.stats.lastInputTokens = Math.max(0, total - (session.stats.compressCreditTokens ?? 0));
56777
56771
  warnCacheCollapse(session, total, sample.cachedTokens ?? 0);
56778
56772
  session.hostContextTokens = total + (session.hostCreditTokens ?? 0);
56779
- const hit = sample.cachedTokens === void 0 || total <= 0 ? void 0 : Math.round(100 * (sample.cachedTokens ?? 0) / total);
56780
- const foldNew = session.stats.pendingFoldUsage === true;
56781
- if (foldNew) session.stats.pendingFoldUsage = false;
56782
- log("info", `[${session.id}] [plugin] [acp-usage] input=${total} cached=${sample.cachedTokens ?? "n/a"}${hit === void 0 ? "" : ` (cache hit ${hit}%)`} ctx=${session.hostContextTokens}${foldNew ? " fold=new" : ""}`);
56783
56773
  }
56784
56774
  if (sample.outputTokens !== void 0) session.stats.outputTokens += sample.outputTokens;
56785
56775
  }