billion-context 0.1.96 → 0.1.97-pr.667.482

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
@@ -44472,25 +44472,71 @@ var KEEP_LAST_ORPHANED = 2;
44472
44472
  function rangeKey(startRef, endRef) {
44473
44473
  return `${startRef}::${endRef}`;
44474
44474
  }
44475
- function rewriteCompressText(text, liveKeys) {
44475
+ function parseCallText(text) {
44476
+ const raw = text ?? "";
44477
+ const start = raw.indexOf("{");
44478
+ if (start < 0) return null;
44476
44479
  let parsed;
44477
44480
  try {
44478
- parsed = JSON.parse(text ?? "");
44481
+ parsed = JSON.parse(raw.slice(start));
44479
44482
  } catch {
44480
44483
  return null;
44481
44484
  }
44482
44485
  if (!parsed || typeof parsed !== "object") return null;
44483
44486
  const obj = parsed;
44484
- const content = obj.content;
44485
- if (!Array.isArray(content) || content.length === 0) return null;
44487
+ let content = null;
44488
+ let contentWasString = false;
44489
+ if (Array.isArray(obj.content)) {
44490
+ content = obj.content;
44491
+ } else if (typeof obj.content === "string") {
44492
+ contentWasString = true;
44493
+ try {
44494
+ const inner = JSON.parse(obj.content);
44495
+ if (Array.isArray(inner)) content = inner;
44496
+ } catch {
44497
+ content = null;
44498
+ }
44499
+ }
44500
+ if (!content || content.length === 0) return null;
44501
+ return { prefix: raw.slice(0, start), obj, content, contentWasString };
44502
+ }
44503
+ function rewriteCompressText(text, liveKeys) {
44504
+ const parsed = parseCallText(text);
44505
+ if (!parsed) return null;
44506
+ const { prefix, obj, content, contentWasString } = parsed;
44486
44507
  const kept = content.filter((entry) => {
44487
44508
  if (!entry || typeof entry !== "object") return false;
44488
- const s3 = typeof entry.startId === "string" ? entry.startId : typeof entry.messageId === "string" ? entry.messageId : "";
44489
- const e = typeof entry.endId === "string" ? entry.endId : typeof entry.messageId === "string" ? entry.messageId : "";
44490
- return liveKeys.has(rangeKey(s3, e));
44509
+ const e = entry;
44510
+ const s3 = typeof e.startId === "string" ? e.startId : typeof e.messageId === "string" ? e.messageId : "";
44511
+ const end = typeof e.endId === "string" ? e.endId : typeof e.messageId === "string" ? e.messageId : "";
44512
+ return liveKeys.has(rangeKey(s3, end));
44491
44513
  });
44492
- if (kept.length === content.length || kept.length === 0) return null;
44493
- return JSON.stringify({ ...obj, content: kept });
44514
+ if (kept.length === 0) return null;
44515
+ return prefix + serializeCompacted(obj, kept, contentWasString).text;
44516
+ }
44517
+ var SUMMARY_STUB_CHARS = 200;
44518
+ function compactEntry(entry) {
44519
+ if (!entry || typeof entry !== "object") return entry;
44520
+ const e = entry;
44521
+ if (typeof e.summary !== "string" || e.summary.length <= SUMMARY_STUB_CHARS) return entry;
44522
+ return { ...e, summary: `${e.summary.slice(0, SUMMARY_STUB_CHARS - 1)}\u2026` };
44523
+ }
44524
+ function serializeCompacted(obj, content, contentWasString) {
44525
+ let changed = false;
44526
+ const compacted = content.map((entry) => {
44527
+ const out = compactEntry(entry);
44528
+ if (out !== entry) changed = true;
44529
+ return out;
44530
+ });
44531
+ const outContent = contentWasString ? JSON.stringify(compacted) : compacted;
44532
+ return { text: JSON.stringify({ ...obj, content: outContent }), changed };
44533
+ }
44534
+ function compactCompressText(text) {
44535
+ const parsed = parseCallText(text);
44536
+ if (!parsed) return null;
44537
+ const { prefix, obj, content, contentWasString } = parsed;
44538
+ const { text: out, changed } = serializeCompacted(obj, content, contentWasString);
44539
+ return changed ? prefix + out : null;
44494
44540
  }
44495
44541
  function hideConsumedCompressCalls(state, messages) {
44496
44542
  const allBlockCallIds = /* @__PURE__ */ new Set();
@@ -44549,6 +44595,11 @@ function hideConsumedCompressCalls(state, messages) {
44549
44595
  continue;
44550
44596
  }
44551
44597
  }
44598
+ const compacted = compactCompressText(message.text);
44599
+ if (compacted !== null) {
44600
+ result.push({ ...message, text: compacted });
44601
+ continue;
44602
+ }
44552
44603
  }
44553
44604
  result.push(message);
44554
44605
  }
@@ -46262,6 +46313,9 @@ function decideNudge(input) {
46262
46313
  const growthReady = firstSightMassReady || growthSinceReference >= growthFloor;
46263
46314
  const t2Count = tiers[2]?.targetBlocks.length ?? 0;
46264
46315
  const t3Count = tiers[3]?.targetBlocks.length ?? 0;
46316
+ const tierCountUsageFloor = config.nudge.minContextLimitPct;
46317
+ const t2CountReady = t2Count >= config.tiers.tier2Trigger && usage >= tierCountUsageFloor;
46318
+ const t3CountReady = t3Count >= config.tiers.tier3Trigger && usage >= tierCountUsageFloor;
46265
46319
  if (pressure) {
46266
46320
  const candidates = [1];
46267
46321
  if (config.tiers.enabled) {
@@ -46284,19 +46338,19 @@ function decideNudge(input) {
46284
46338
  if (t1Eff >= nudgeGrowthTokens) {
46285
46339
  injectedTier = 1;
46286
46340
  injectedReason = `T1 effective ${t1Eff} >= ${nudgeGrowthTokens}, growth ${growthSinceReference}, usage ${Math.round(usage * 100)}%`;
46287
- } else if (config.tiers.enabled && (t2Count >= config.tiers.tier2Trigger || t2Pen >= tier2Threshold && t2Pen > t1Eff)) {
46341
+ } else if (config.tiers.enabled && (t2CountReady || t2Pen >= tier2Threshold && t2Pen > t1Eff)) {
46288
46342
  const lastShown = state.nudge.lastShownByTier[2] ?? 0;
46289
46343
  const cadenceMet = lastShown === 0 || tokenCount - lastShown >= growthFloor;
46290
46344
  if (cadenceMet) {
46291
46345
  injectedTier = 2;
46292
- injectedReason = t2Count >= config.tiers.tier2Trigger ? `T2 distill ready: ${t2Count} tier-1 blocks >= tier2Trigger ${config.tiers.tier2Trigger} (${t2Pen} tokens), usage ${Math.round(usage * 100)}%` : `T2 distill ready: ${tiers[2].targetBlocks.length} tier-1 blocks (${t2Pen} tokens) >= ${tier2Threshold} (1.5x) and > T1 effective ${t1Eff}, usage ${Math.round(usage * 100)}%`;
46346
+ injectedReason = t2CountReady ? `T2 distill ready: ${t2Count} tier-1 blocks >= tier2Trigger ${config.tiers.tier2Trigger} (${t2Pen} tokens), usage ${Math.round(usage * 100)}%` : `T2 distill ready: ${tiers[2].targetBlocks.length} tier-1 blocks (${t2Pen} tokens) >= ${tier2Threshold} (1.5x) and > T1 effective ${t1Eff}, usage ${Math.round(usage * 100)}%`;
46293
46347
  }
46294
- } else if (config.tiers.enabled && (t3Count >= config.tiers.tier3Trigger || t3Pen >= tier2Threshold && t3Pen > t2Pen && t3Pen > t1Eff)) {
46348
+ } else if (config.tiers.enabled && (t3CountReady || t3Pen >= tier2Threshold && t3Pen > t2Pen && t3Pen > t1Eff)) {
46295
46349
  const lastShown = state.nudge.lastShownByTier[3] ?? 0;
46296
46350
  const cadenceMet = lastShown === 0 || tokenCount - lastShown >= growthFloor;
46297
46351
  if (cadenceMet) {
46298
46352
  injectedTier = 3;
46299
- injectedReason = t3Count >= config.tiers.tier3Trigger ? `T3 condense ready: ${t3Count} tier-2 blocks >= tier3Trigger ${config.tiers.tier3Trigger} (${t3Pen} tokens), usage ${Math.round(usage * 100)}%` : `T3 condense ready: ${tiers[3].targetBlocks.length} tier-2 blocks (${t3Pen} tokens) >= ${tier2Threshold} (1.5x) and > T2 ${t2Pen} and > T1 effective ${t1Eff}, usage ${Math.round(usage * 100)}%`;
46353
+ injectedReason = t3CountReady ? `T3 condense ready: ${t3Count} tier-2 blocks >= tier3Trigger ${config.tiers.tier3Trigger} (${t3Pen} tokens), usage ${Math.round(usage * 100)}%` : `T3 condense ready: ${tiers[3].targetBlocks.length} tier-2 blocks (${t3Pen} tokens) >= ${tier2Threshold} (1.5x) and > T2 ${t2Pen} and > T1 effective ${t1Eff}, usage ${Math.round(usage * 100)}%`;
46300
46354
  }
46301
46355
  }
46302
46356
  }
@@ -46313,9 +46367,14 @@ function decideNudge(input) {
46313
46367
  } else {
46314
46368
  const tiersList = [1, 2, 3];
46315
46369
  const eligible = tiersList.filter((t) => config.tiers.enabled || t === 1);
46316
- const countReady = (t) => t === 2 ? t2Count >= config.tiers.tier2Trigger : t === 3 ? t3Count >= config.tiers.tier3Trigger : false;
46370
+ const countReadyUngated = (t) => t === 2 ? t2Count >= config.tiers.tier2Trigger : t === 3 ? t3Count >= config.tiers.tier3Trigger : false;
46371
+ const countReady = (t) => countReadyUngated(t) && usage >= tierCountUsageFloor;
46317
46372
  const ready = eligible.filter((t) => (tiers[t]?.pending ?? 0) >= nudgeGrowthTokens).map((t) => `T${t} ${tiers[t].pending}`);
46318
- const readyCount = eligible.filter((t) => (tiers[t]?.pending ?? 0) < nudgeGrowthTokens && countReady(t)).map((t) => `T${t} ${t === 2 ? t2Count : t3Count} blocks (count)`);
46373
+ const readyCount = eligible.filter(
46374
+ (t) => (tiers[t]?.pending ?? 0) < nudgeGrowthTokens && countReadyUngated(t)
46375
+ ).map(
46376
+ (t) => `T${t} ${t === 2 ? t2Count : t3Count} blocks (count${usage >= tierCountUsageFloor ? "" : ", usage-gated"})`
46377
+ );
46319
46378
  const readyAll = [...ready, ...readyCount];
46320
46379
  const readyHint = readyAll.length > 0 ? `, ready: ${readyAll.join(", ")}` : "";
46321
46380
  const blocked = eligible.filter(
@@ -48667,6 +48726,7 @@ function mergeCompress(global2, provider, model) {
48667
48726
  const promptLevels = [global2?.prompts, provider?.prompts, model?.prompts].filter(Boolean);
48668
48727
  const rangeOf = (s3) => s3?.minCompressRangeChars ?? s3?.minCompressRange;
48669
48728
  const absorbLevels = [global2?.absorb, provider?.absorb, model?.absorb].filter(Boolean);
48729
+ const reasoningLevels = [global2?.reasoning, provider?.reasoning, model?.reasoning].filter(Boolean);
48670
48730
  return {
48671
48731
  modelContextLimit: pick("modelContextLimit"),
48672
48732
  maxContextLimit: pick("maxContextLimit"),
@@ -48680,7 +48740,11 @@ function mergeCompress(global2, provider, model) {
48680
48740
  acknowledgePromptsRisk: pick("acknowledgePromptsRisk"),
48681
48741
  absorb: absorbLevels.length > 0 ? Object.assign({}, ...absorbLevels) : void 0,
48682
48742
  stripImages: pick("stripImages"),
48683
- stripImagesKeepRecent: pick("stripImagesKeepRecent")
48743
+ stripImagesKeepRecent: pick("stripImagesKeepRecent"),
48744
+ // `reasoning` is a third nested-object field merged sub-field-wise
48745
+ // exactly like `absorb`/`prompts`: a model-level `threshold` must not
48746
+ // discard a provider-level `drop: false`.
48747
+ reasoning: reasoningLevels.length > 0 ? Object.assign({}, ...reasoningLevels) : void 0
48684
48748
  };
48685
48749
  }
48686
48750
  function resolveCompress(routes, upstreamUrl, model, global2) {
@@ -48760,6 +48824,49 @@ function resolveRequestConfig(base, routes, embeddedUrl, model, native, globalCo
48760
48824
  return applyCompressSettings(base, limit, compress);
48761
48825
  }
48762
48826
 
48827
+ // src/reasoning-drop.ts
48828
+ var DEFAULT_COMPRESS_REASONING = { drop: true, threshold: 2048 };
48829
+ function resolveReasoningDrop(cfg) {
48830
+ let threshold = DEFAULT_COMPRESS_REASONING.threshold;
48831
+ if (cfg?.threshold !== void 0) {
48832
+ const t = cfg.threshold;
48833
+ if (typeof t === "number" && Number.isFinite(t) && t >= 0) {
48834
+ threshold = Math.floor(t);
48835
+ }
48836
+ }
48837
+ return { drop: cfg?.drop !== false, threshold };
48838
+ }
48839
+ function dropCompressReasoning(messages, cfg) {
48840
+ const { drop, threshold } = resolveReasoningDrop(cfg);
48841
+ if (!drop || messages.length === 0) return messages;
48842
+ try {
48843
+ let lastUser = -1;
48844
+ for (let i = 0; i < messages.length; i++) {
48845
+ const m2 = messages[i];
48846
+ if (m2.role === "user" && m2.contentType === "text") lastUser = i;
48847
+ }
48848
+ if (lastUser < 0) return messages;
48849
+ const dropIdx = /* @__PURE__ */ new Set();
48850
+ for (let i = 0; i < lastUser; i++) {
48851
+ const m2 = messages[i];
48852
+ if (m2.contentType !== "tool-call" || m2.toolName !== "compress") continue;
48853
+ let total = 0;
48854
+ let j2 = i - 1;
48855
+ while (j2 >= 0 && messages[j2].contentType === "reasoning") {
48856
+ total += (messages[j2].text ?? "").length;
48857
+ j2--;
48858
+ }
48859
+ if (total > threshold) {
48860
+ for (let k2 = j2 + 1; k2 < i; k2++) dropIdx.add(k2);
48861
+ }
48862
+ }
48863
+ if (dropIdx.size === 0) return messages;
48864
+ return messages.filter((_2, idx) => !dropIdx.has(idx));
48865
+ } catch {
48866
+ return messages;
48867
+ }
48868
+ }
48869
+
48763
48870
  // src/strip-images.ts
48764
48871
  var DEFAULT_STRIP_IMAGES_KEEP_RECENT = 5;
48765
48872
  var IMAGE_PLACEHOLDER = "[image]";
@@ -59155,13 +59262,14 @@ ${bodyBuffer.toString("utf8")}`);
59155
59262
  await withSessionLock(session, async () => {
59156
59263
  const runPrepare = () => {
59157
59264
  const cs2 = resolveCompress(opts.routes, route?.rewrittenUrl, parsed.model, opts.compress);
59265
+ const reasoningCfg = cs2.reasoning;
59158
59266
  const keepRecent = cs2.stripImagesKeepRecent ?? DEFAULT_STRIP_IMAGES_KEEP_RECENT;
59159
59267
  const stripped = cs2.stripImages ? stripHistoricalImages(parsed, protocol, keepRecent) : { body: parsed, removed: 0 };
59160
59268
  if (opts.debug && stripped.removed > 0) {
59161
59269
  log2("info", `[debug] strip-images: dropped ${stripped.removed} historical image part(s), kept last ${keepRecent} (session=${session.id})`);
59162
59270
  }
59163
59271
  const work = stripped.body;
59164
- return countTokens ? prepareCountTokens(work, core, reqConfig, log2, session) : protocol === "anthropic" ? prepareAnthropic(work, req, opts, core, reqConfig, reqPrompts, log2, session, pluginMode) : protocol === "openai" ? prepareOpenai(work, req, opts, core, reqConfig, reqPrompts, log2, session, pluginMode, nativeWindow) : responsesCompact ? prepareResponsesCompact(stripped.removed > 0 ? Buffer.from(JSON.stringify(work)) : bodyBuffer, work, session, req, core, reqConfig, log2) : prepareResponses(work, req, opts, core, reqConfig, reqPrompts, log2, session, responsesIdentity, pluginMode, upstreamOrigin, nativeWindow);
59272
+ return countTokens ? prepareCountTokens(work, core, reqConfig, log2, session) : protocol === "anthropic" ? prepareAnthropic(work, req, opts, core, reqConfig, reqPrompts, log2, session, pluginMode, reasoningCfg) : protocol === "openai" ? prepareOpenai(work, req, opts, core, reqConfig, reqPrompts, log2, session, pluginMode, nativeWindow, reasoningCfg) : responsesCompact ? prepareResponsesCompact(stripped.removed > 0 ? Buffer.from(JSON.stringify(work)) : bodyBuffer, work, session, req, core, reqConfig, log2) : prepareResponses(work, req, opts, core, reqConfig, reqPrompts, log2, session, responsesIdentity, pluginMode, upstreamOrigin, nativeWindow, reasoningCfg);
59165
59273
  };
59166
59274
  const isCodexCompactTrigger = protocol === "responses" && !responsesCompact && isCodexClient(req.headers) && hasCompactionTrigger(parsed.input);
59167
59275
  if (isCodexCompactTrigger) {
@@ -59249,6 +59357,13 @@ ${bodyBuffer.toString("utf8")}`);
59249
59357
  }
59250
59358
  }
59251
59359
  var ACP_TAG_MARK = "<acp ";
59360
+ function withReasoningDrop(msgs, reasoning, log2, sessionId) {
59361
+ const out = dropCompressReasoning(msgs, reasoning);
59362
+ if (out.length !== msgs.length) {
59363
+ log2("info", `[${sessionId}] compress-reasoning: dropped ${msgs.length - out.length} reasoning message(s) from closed compress turns (#651)`);
59364
+ }
59365
+ return out;
59366
+ }
59252
59367
  function stripKernelSummaries(messages, state) {
59253
59368
  const carried = /* @__PURE__ */ new Set();
59254
59369
  for (const b2 of state.blocks) {
@@ -59350,12 +59465,13 @@ function effectiveTokenCount(session, msgs) {
59350
59465
  if (!session.metadata.anonymousPrefixAffinity) return 0;
59351
59466
  return estimateCoreMessagesUpper(msgs);
59352
59467
  }
59353
- function prepareAnthropic(parsed, req, opts, core, config, prompts, log2, session, pluginMode) {
59468
+ function prepareAnthropic(parsed, req, opts, core, config, prompts, log2, session, pluginMode, reasoning) {
59354
59469
  const sessionId = session.id;
59355
59470
  const stream2 = parsed.stream === true;
59356
59471
  ++session.stats.requests;
59357
59472
  session.hostCreditTokens = 0;
59358
59473
  const injectTools = opts.compress.injectTool && !pluginMode;
59474
+ const stripReasoning = (msgs) => withReasoningDrop(msgs, reasoning, log2, sessionId);
59359
59475
  if (isAutoModeClassifier(parsed)) {
59360
59476
  log2("info", `[${sessionId}] auto-mode classifier passthrough (skipping compress injection)`);
59361
59477
  return { body: JSON.stringify(parsed), session, processedMessages: [], originalMessages: [], anthropicSystem: parsed.system, protocol: "anthropic", stream: stream2, compressInjected: false, pluginMode, nudge: void 0, prompts };
@@ -59393,7 +59509,7 @@ function prepareAnthropic(parsed, req, opts, core, config, prompts, log2, sessio
59393
59509
  log2("info", diagTagSummary(turn.messages, sessionId, "text-only"));
59394
59510
  const willInjectNudge = opts.compress.injectNudge && !!turn.nudge && (turn.nudge.shouldInject || emergencyNudge(turn.nudge));
59395
59511
  log2("info", diagNudge(turn, sessionId, tokenCount, config.modelContextLimit, parsed.model, willInjectNudge));
59396
- processedMessages = stripKernelSummaries(turn.messages, turn.state);
59512
+ processedMessages = stripReasoning(stripKernelSummaries(turn.messages, turn.state));
59397
59513
  applyCompactionArchive(session, activeBefore, new Set(msgs.map((m2) => m2.id)), log2);
59398
59514
  reapOrphanBlocks(session, msgs, deactivateBlock);
59399
59515
  rebuiltMessages = coreToAnthropic(processedMessages, cacheControls);
@@ -59475,12 +59591,13 @@ function clampOutgoingOutput(rebuilt, field, ctx, sessionId, log2) {
59475
59591
  log2("info", `[${sessionId}] output budget clamped ${raw} -> ${capped} (input~${inputEstimate}, window=${ctx.nativeWindow}); prevents input+output overflow (#453)`);
59476
59592
  }
59477
59593
  }
59478
- function prepareOpenai(parsed, req, opts, core, config, prompts, log2, session, pluginMode, nativeWindow) {
59594
+ function prepareOpenai(parsed, req, opts, core, config, prompts, log2, session, pluginMode, nativeWindow, reasoning) {
59479
59595
  const sessionId = session.id;
59480
59596
  const stream2 = parsed.stream === true;
59481
59597
  ++session.stats.requests;
59482
59598
  session.hostCreditTokens = 0;
59483
59599
  let openaiSystemText = "";
59600
+ const stripReasoning = (msgs) => withReasoningDrop(msgs, reasoning, log2, sessionId);
59484
59601
  let openaiOutboundSystem;
59485
59602
  let processedMessages = [];
59486
59603
  let originalMessages = [];
@@ -59518,7 +59635,7 @@ function prepareOpenai(parsed, req, opts, core, config, prompts, log2, session,
59518
59635
  log2("info", diagTagSummary(turn.messages, sessionId, "text-only"));
59519
59636
  const willInjectNudge = opts.compress.injectNudge && !!turn.nudge && shouldInject && (turn.nudge.shouldInject || emergencyNudge(turn.nudge));
59520
59637
  log2("info", diagNudge(turn, sessionId, tokenCount, config.modelContextLimit, parsed.model, willInjectNudge));
59521
- processedMessages = stripKernelSummaries(turn.messages, turn.state);
59638
+ processedMessages = stripReasoning(stripKernelSummaries(turn.messages, turn.state));
59522
59639
  applyCompactionArchive(session, activeBefore, new Set(msgs.map((m2) => m2.id)), log2);
59523
59640
  reapOrphanBlocks(session, msgs, deactivateBlock);
59524
59641
  rebuiltMessages = systemToUser(coreToOpenai(processedMessages));
@@ -59558,11 +59675,12 @@ function prepareOpenai(parsed, req, opts, core, config, prompts, log2, session,
59558
59675
  markDirty(session);
59559
59676
  return { body: JSON.stringify(rebuilt), session, processedMessages, originalMessages, protocol: "openai", stream: stream2, compressInjected: injectTools, pluginMode, nudge, prompts, openaiSystemText, renderTags: "text-only" };
59560
59677
  }
59561
- function prepareResponses(parsed, req, opts, core, config, prompts, log2, session, identity, pluginMode, upstreamOrigin, nativeWindow) {
59678
+ function prepareResponses(parsed, req, opts, core, config, prompts, log2, session, identity, pluginMode, upstreamOrigin, nativeWindow, reasoning) {
59562
59679
  const sessionId = session.id;
59563
59680
  const stream2 = parsed.stream === true;
59564
59681
  ++session.stats.requests;
59565
59682
  session.hostCreditTokens = 0;
59683
+ const stripReasoning = (msgs) => withReasoningDrop(msgs, reasoning, log2, sessionId);
59566
59684
  if (reconcileNativeCompactionBoundary(session)) {
59567
59685
  log2("info", `[${sessionId}] reconciled ACP state after native Responses compact boundary`);
59568
59686
  }
@@ -59627,7 +59745,7 @@ function prepareResponses(parsed, req, opts, core, config, prompts, log2, sessio
59627
59745
  log2("info", diagTagSummary(turn.messages, sessionId, "text-only"));
59628
59746
  const willInjectNudge = opts.compress.injectNudge && !!turn.nudge && shouldInject && !isCompactionTrigger && (turn.nudge.shouldInject || emergencyNudge(turn.nudge));
59629
59747
  log2("info", diagNudge(turn, sessionId, tokenCount, config.modelContextLimit, parsed.model, willInjectNudge));
59630
- processedMessages = repairResponsesAssistantOrdering(stripKernelSummaries(turn.messages, turn.state), originalMessages);
59748
+ processedMessages = repairResponsesAssistantOrdering(stripReasoning(stripKernelSummaries(turn.messages, turn.state)), originalMessages);
59631
59749
  reapOrphanBlocks(session, msgs, deactivateBlock);
59632
59750
  rebuiltInput = patchResponsesInput(projection, processedMessages);
59633
59751
  const forgedSummaries = echoReplaced ? [] : session.metadata.codexForgedSummaries ?? [];