@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.
@@ -2840,6 +2840,9 @@ function triggerLabel(trigger) {
2840
2840
  function estimateTokensSaved(origLen, stubLen) {
2841
2841
  return Math.max(0, Math.ceil((origLen - stubLen) / APPROX_CHARS_PER_TOKEN));
2842
2842
  }
2843
+ function marksDiscontinuity(kind) {
2844
+ return kind === "agentEnd" || kind === "phaseEnd";
2845
+ }
2843
2846
  function applyCondensation(history, policies, ctx, onCondensed) {
2844
2847
  if (policies.size === 0) return history;
2845
2848
  const triggersOf = (entry) => Array.isArray(entry.policy.on) ? entry.policy.on : [entry.policy.on];
@@ -2879,7 +2882,9 @@ function applyCondensation(history, policies, ctx, onCondensed) {
2879
2882
  return latestByKey.get(trig.by) !== toolCallId;
2880
2883
  }
2881
2884
  };
2882
- const firstFired = (toolCallId, entry) => withinBatch(entry) ? triggersOf(entry).find((t) => triggerFires(toolCallId, entry, t)) : void 0;
2885
+ const firstFired = (toolCallId, entry) => triggersOf(entry).find(
2886
+ (t) => (marksDiscontinuity(t.kind) || withinBatch(entry)) && triggerFires(toolCallId, entry, t)
2887
+ );
2883
2888
  return history.map((msg) => {
2884
2889
  if (msg.toolCalls?.length) {
2885
2890
  let changed = false;