@genesislcap/ai-assistant 15.6.0 → 15.6.2

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.
@@ -2793,6 +2793,9 @@ function triggerLabel(trigger) {
2793
2793
  function estimateTokensSaved(origLen, stubLen) {
2794
2794
  return Math.max(0, Math.ceil((origLen - stubLen) / APPROX_CHARS_PER_TOKEN));
2795
2795
  }
2796
+ function marksDiscontinuity(kind) {
2797
+ return kind === "agentEnd" || kind === "phaseEnd";
2798
+ }
2796
2799
  function applyCondensation(history, policies, ctx, onCondensed) {
2797
2800
  if (policies.size === 0) return history;
2798
2801
  const triggersOf = (entry) => Array.isArray(entry.policy.on) ? entry.policy.on : [entry.policy.on];
@@ -2832,7 +2835,9 @@ function applyCondensation(history, policies, ctx, onCondensed) {
2832
2835
  return latestByKey.get(trig.by) !== toolCallId;
2833
2836
  }
2834
2837
  };
2835
- const firstFired = (toolCallId, entry) => withinBatch(entry) ? triggersOf(entry).find((t) => triggerFires(toolCallId, entry, t)) : void 0;
2838
+ const firstFired = (toolCallId, entry) => triggersOf(entry).find(
2839
+ (t) => (marksDiscontinuity(t.kind) || withinBatch(entry)) && triggerFires(toolCallId, entry, t)
2840
+ );
2836
2841
  return history.map((msg) => {
2837
2842
  if (msg.toolCalls?.length) {
2838
2843
  let changed = false;