@genesislcap/ai-assistant 15.10.2 → 15.10.3-GENC-1494.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.
@@ -3076,6 +3076,7 @@ function createInteractionContext(interactionId) {
3076
3076
  // src/utils/condense-history.ts
3077
3077
  var CONDENSE_MIN_CHARS = 1e3;
3078
3078
  var CONDENSED_ARGS_KEY = "condensed";
3079
+ var ELIDED_PLACEHOLDER = "[elided]";
3079
3080
  var APPROX_CHARS_PER_TOKEN = 4;
3080
3081
  function triggerReason(trigger) {
3081
3082
  switch (trigger.kind) {
@@ -3151,9 +3152,14 @@ function applyCondensation(history, policies, ctx, onCondensed) {
3151
3152
  return latestByKey.get(trig.by) !== toolCallId;
3152
3153
  }
3153
3154
  };
3154
- const firstFired = (toolCallId, entry) => triggersOf(entry).find(
3155
- (t) => (marksDiscontinuity(t.kind) || withinBatch(entry)) && triggerFires(toolCallId, entry, t)
3156
- );
3155
+ const firstFired = (toolCallId, entry) => {
3156
+ if (entry.firedTrigger) return entry.firedTrigger;
3157
+ const fired = triggersOf(entry).find(
3158
+ (t) => (marksDiscontinuity(t.kind) || withinBatch(entry)) && triggerFires(toolCallId, entry, t)
3159
+ );
3160
+ if (fired) entry.firedTrigger = fired;
3161
+ return fired;
3162
+ };
3157
3163
  return history.map((msg) => {
3158
3164
  if (msg.toolCalls?.length) {
3159
3165
  let changed = false;
@@ -3166,8 +3172,8 @@ function applyCondensation(history, policies, ctx, onCondensed) {
3166
3172
  if (origLen < CONDENSE_MIN_CHARS) return tc;
3167
3173
  changed = true;
3168
3174
  const result = entry.policy.args;
3169
- const args = result === "drop" ? {} : {
3170
- [CONDENSED_ARGS_KEY]: result === "pointer" ? condenseStub("args", tc.name, fired, origLen) : result.replaceWith
3175
+ const args = {
3176
+ [CONDENSED_ARGS_KEY]: result === "drop" ? ELIDED_PLACEHOLDER : result === "pointer" ? condenseStub("args", tc.name, fired, origLen) : result.replaceWith
3171
3177
  };
3172
3178
  if (!entry.reportedArgs) {
3173
3179
  entry.reportedArgs = true;
@@ -3193,7 +3199,7 @@ function applyCondensation(history, policies, ctx, onCondensed) {
3193
3199
  if (entry && fired && origLen >= CONDENSE_MIN_CHARS) {
3194
3200
  const tool = nameById.get(msg.toolResult.toolCallId) ?? msg.toolResult.toolCallId;
3195
3201
  const result = entry.policy.response;
3196
- const content = result === "drop" ? "[elided]" : result === "pointer" ? condenseStub("response", tool, fired, origLen) : result.replaceWith;
3202
+ const content = result === "drop" ? ELIDED_PLACEHOLDER : result === "pointer" ? condenseStub("response", tool, fired, origLen) : result.replaceWith;
3197
3203
  if (!entry.reportedResponse) {
3198
3204
  entry.reportedResponse = true;
3199
3205
  onCondensed({