billion-context 0.1.50-pr.229.68 → 0.1.50

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
@@ -54406,19 +54406,6 @@ function injectResponsesTool(tools, toolsToAdd = ACP_TOOLS_RESPONSES) {
54406
54406
  const additions = toolsToAdd.filter((t) => !present.has(t.name));
54407
54407
  return [...tools, ...additions];
54408
54408
  }
54409
- function armFailureShrink(prepared, body, log2, reason) {
54410
- const s3 = prepared?.session;
54411
- if (!s3 || body === void 0) return;
54412
- try {
54413
- const est = estimateTokensFast(typeof body === "string" ? body : body.toString("utf8"));
54414
- if (est > s3.stats.lastInputTokens) {
54415
- s3.stats.lastInputTokens = est;
54416
- markDirty(s3);
54417
- log2("warn", `[${s3.id}] ${reason} with no usage report \u2014 armed emergency shrink with local estimate ${est} tokens`);
54418
- }
54419
- } catch {
54420
- }
54421
- }
54422
54409
  async function forward(req, res, opts, body, prepared, core, config, log2, route, affinity) {
54423
54410
  const reqUrl = req.url ?? "";
54424
54411
  const isAbsoluteUrl = /^https?:\/\//i.test(reqUrl);
@@ -54530,7 +54517,6 @@ ${bodyText}`);
54530
54517
  recordUpstreamConnection(upstreamUrl, proxyUrl);
54531
54518
  } catch (error) {
54532
54519
  recordUpstreamConnection(upstreamUrl, proxyUrl, error);
54533
- if (req.method !== "GET" && req.method !== "HEAD") armFailureShrink(prepared, body, log2, "network failure");
54534
54520
  throw new Error(`upstream request failed: ${formatUpstreamError(error, upstreamUrl, proxyUrl)}`, { cause: error });
54535
54521
  }
54536
54522
  const { response: upstream, clearTimer: clearUpstreamTimer } = upstreamResult;
@@ -54595,8 +54581,6 @@ ${hdrText}
54595
54581
  const floor = info.window ?? (reqModel ? learnedMap[reqModel] : void 0) ?? s3.metadata.learnedContextLimit ?? s3.metadata.effectiveContextLimit ?? 0;
54596
54582
  if (floor > 0) s3.stats.lastInputTokens = Math.max(s3.stats.lastInputTokens, floor);
54597
54583
  markDirty(s3);
54598
- } else if (upstream.status >= 500) {
54599
- armFailureShrink(prepared, prepared.body, log2, `upstream ${upstream.status}`);
54600
54584
  }
54601
54585
  }
54602
54586
  const errSid = prepared?.session.id ?? "unknown";