@dexto/core 1.5.3 → 1.5.4

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.
Files changed (92) hide show
  1. package/dist/agent/DextoAgent.cjs +284 -1
  2. package/dist/agent/DextoAgent.d.ts +114 -0
  3. package/dist/agent/DextoAgent.d.ts.map +1 -1
  4. package/dist/agent/DextoAgent.js +275 -1
  5. package/dist/agent/schemas.d.ts +51 -21
  6. package/dist/agent/schemas.d.ts.map +1 -1
  7. package/dist/context/compaction/overflow.cjs +6 -10
  8. package/dist/context/compaction/overflow.d.ts +14 -11
  9. package/dist/context/compaction/overflow.d.ts.map +1 -1
  10. package/dist/context/compaction/overflow.js +6 -10
  11. package/dist/context/compaction/providers/reactive-overflow-provider.cjs +15 -0
  12. package/dist/context/compaction/providers/reactive-overflow-provider.d.ts +15 -0
  13. package/dist/context/compaction/providers/reactive-overflow-provider.d.ts.map +1 -1
  14. package/dist/context/compaction/providers/reactive-overflow-provider.js +15 -0
  15. package/dist/context/compaction/schemas.cjs +22 -2
  16. package/dist/context/compaction/schemas.d.ts +45 -0
  17. package/dist/context/compaction/schemas.d.ts.map +1 -1
  18. package/dist/context/compaction/schemas.js +22 -2
  19. package/dist/context/compaction/strategies/reactive-overflow.cjs +166 -26
  20. package/dist/context/compaction/strategies/reactive-overflow.d.ts +21 -0
  21. package/dist/context/compaction/strategies/reactive-overflow.d.ts.map +1 -1
  22. package/dist/context/compaction/strategies/reactive-overflow.js +166 -26
  23. package/dist/context/manager.cjs +278 -31
  24. package/dist/context/manager.d.ts +192 -5
  25. package/dist/context/manager.d.ts.map +1 -1
  26. package/dist/context/manager.js +285 -32
  27. package/dist/context/types.d.ts +6 -0
  28. package/dist/context/types.d.ts.map +1 -1
  29. package/dist/context/utils.cjs +77 -11
  30. package/dist/context/utils.d.ts +86 -8
  31. package/dist/context/utils.d.ts.map +1 -1
  32. package/dist/context/utils.js +71 -11
  33. package/dist/events/index.cjs +4 -0
  34. package/dist/events/index.d.ts +41 -7
  35. package/dist/events/index.d.ts.map +1 -1
  36. package/dist/events/index.js +4 -0
  37. package/dist/llm/executor/stream-processor.cjs +19 -1
  38. package/dist/llm/executor/stream-processor.d.ts +3 -0
  39. package/dist/llm/executor/stream-processor.d.ts.map +1 -1
  40. package/dist/llm/executor/stream-processor.js +19 -1
  41. package/dist/llm/executor/turn-executor.cjs +219 -30
  42. package/dist/llm/executor/turn-executor.d.ts +62 -10
  43. package/dist/llm/executor/turn-executor.d.ts.map +1 -1
  44. package/dist/llm/executor/turn-executor.js +219 -30
  45. package/dist/llm/executor/types.d.ts +28 -0
  46. package/dist/llm/executor/types.d.ts.map +1 -1
  47. package/dist/llm/formatters/vercel.cjs +36 -28
  48. package/dist/llm/formatters/vercel.d.ts.map +1 -1
  49. package/dist/llm/formatters/vercel.js +36 -28
  50. package/dist/llm/services/factory.cjs +3 -2
  51. package/dist/llm/services/factory.d.ts +3 -1
  52. package/dist/llm/services/factory.d.ts.map +1 -1
  53. package/dist/llm/services/factory.js +3 -2
  54. package/dist/llm/services/vercel.cjs +34 -6
  55. package/dist/llm/services/vercel.d.ts +23 -3
  56. package/dist/llm/services/vercel.d.ts.map +1 -1
  57. package/dist/llm/services/vercel.js +34 -6
  58. package/dist/session/chat-session.cjs +20 -11
  59. package/dist/session/chat-session.d.ts +9 -4
  60. package/dist/session/chat-session.d.ts.map +1 -1
  61. package/dist/session/chat-session.js +20 -11
  62. package/dist/session/compaction-service.cjs +139 -0
  63. package/dist/session/compaction-service.d.ts +81 -0
  64. package/dist/session/compaction-service.d.ts.map +1 -0
  65. package/dist/session/compaction-service.js +106 -0
  66. package/dist/session/session-manager.cjs +146 -0
  67. package/dist/session/session-manager.d.ts +50 -0
  68. package/dist/session/session-manager.d.ts.map +1 -1
  69. package/dist/session/session-manager.js +146 -0
  70. package/dist/session/title-generator.cjs +2 -2
  71. package/dist/session/title-generator.js +2 -2
  72. package/dist/systemPrompt/in-built-prompts.cjs +36 -0
  73. package/dist/systemPrompt/in-built-prompts.d.ts +18 -1
  74. package/dist/systemPrompt/in-built-prompts.d.ts.map +1 -1
  75. package/dist/systemPrompt/in-built-prompts.js +25 -0
  76. package/dist/systemPrompt/manager.cjs +22 -0
  77. package/dist/systemPrompt/manager.d.ts +10 -0
  78. package/dist/systemPrompt/manager.d.ts.map +1 -1
  79. package/dist/systemPrompt/manager.js +22 -0
  80. package/dist/systemPrompt/registry.cjs +2 -1
  81. package/dist/systemPrompt/registry.d.ts +1 -1
  82. package/dist/systemPrompt/registry.d.ts.map +1 -1
  83. package/dist/systemPrompt/registry.js +2 -1
  84. package/dist/systemPrompt/schemas.cjs +7 -0
  85. package/dist/systemPrompt/schemas.d.ts +13 -13
  86. package/dist/systemPrompt/schemas.d.ts.map +1 -1
  87. package/dist/systemPrompt/schemas.js +7 -0
  88. package/dist/utils/index.cjs +3 -1
  89. package/dist/utils/index.d.ts +1 -0
  90. package/dist/utils/index.d.ts.map +1 -1
  91. package/dist/utils/index.js +1 -0
  92. package/package.json +1 -1
@@ -49,6 +49,7 @@ class StreamProcessor {
49
49
  actualTokens = { inputTokens: 0, outputTokens: 0, totalTokens: 0 };
50
50
  finishReason = "unknown";
51
51
  reasoningText = "";
52
+ reasoningMetadata;
52
53
  accumulatedText = "";
53
54
  logger;
54
55
  /**
@@ -81,6 +82,9 @@ class StreamProcessor {
81
82
  break;
82
83
  case "reasoning-delta":
83
84
  this.reasoningText += event.text;
85
+ if (event.providerMetadata) {
86
+ this.reasoningMetadata = event.providerMetadata;
87
+ }
84
88
  if (this.streaming) {
85
89
  this.eventBus.emit("llm:chunk", {
86
90
  chunkType: "reasoning",
@@ -210,7 +214,12 @@ class StreamProcessor {
210
214
  await this.contextManager.updateAssistantMessage(
211
215
  this.assistantMessageId,
212
216
  {
213
- tokenUsage: usage
217
+ tokenUsage: usage,
218
+ // Persist reasoning text and metadata for round-tripping
219
+ ...this.reasoningText && { reasoning: this.reasoningText },
220
+ ...this.reasoningMetadata && {
221
+ reasoningMetadata: this.reasoningMetadata
222
+ }
214
223
  }
215
224
  );
216
225
  }
@@ -222,6 +231,9 @@ class StreamProcessor {
222
231
  provider: this.config.provider,
223
232
  model: this.config.model,
224
233
  tokenUsage: usage,
234
+ ...this.config.estimatedInputTokens !== void 0 && {
235
+ estimatedInputTokens: this.config.estimatedInputTokens
236
+ },
225
237
  finishReason: this.finishReason
226
238
  });
227
239
  }
@@ -283,6 +295,9 @@ class StreamProcessor {
283
295
  provider: this.config.provider,
284
296
  model: this.config.model,
285
297
  tokenUsage: this.actualTokens,
298
+ ...this.config.estimatedInputTokens !== void 0 && {
299
+ estimatedInputTokens: this.config.estimatedInputTokens
300
+ },
286
301
  finishReason: "cancelled"
287
302
  });
288
303
  return {
@@ -304,6 +319,9 @@ class StreamProcessor {
304
319
  provider: this.config.provider,
305
320
  model: this.config.model,
306
321
  tokenUsage: this.actualTokens,
322
+ ...this.config.estimatedInputTokens !== void 0 && {
323
+ estimatedInputTokens: this.config.estimatedInputTokens
324
+ },
307
325
  finishReason: "cancelled"
308
326
  });
309
327
  return {
@@ -8,6 +8,8 @@ import { LLMProvider } from '../types.js';
8
8
  export interface StreamProcessorConfig {
9
9
  provider: LLMProvider;
10
10
  model: string;
11
+ /** Estimated input tokens before LLM call (for analytics/calibration) */
12
+ estimatedInputTokens?: number;
11
13
  }
12
14
  export declare class StreamProcessor {
13
15
  private contextManager;
@@ -21,6 +23,7 @@ export declare class StreamProcessor {
21
23
  private actualTokens;
22
24
  private finishReason;
23
25
  private reasoningText;
26
+ private reasoningMetadata;
24
27
  private accumulatedText;
25
28
  private logger;
26
29
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"stream-processor.d.ts","sourceRoot":"","sources":["../../../src/llm/executor/stream-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,IAAI,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1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,EAAE,eAAe,EAChC,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,qBAAqB,EACrC,MAAM,EAAE,YAAY,EACZ,SAAS,GAAE,OAAc,EACzB,gBAAgB,CAAC,EAAE,GAAG,CAC1B,MAAM,EACN;QAAE,eAAe,EAAE,OAAO,CAAC;QAAC,cAAc,CAAC,EAAE,UAAU,GAAG,UAAU,CAAA;KAAE,CACzE,YAAA;IAKC,OAAO,CACT,QAAQ,EAAE,MAAM,gBAAgB,CAAC,aAAa,EAAE,OAAO,CAAC,GACzD,OAAO,CAAC,qBAAqB,CAAC;YAubnB,sBAAsB;YAKtB,gBAAgB;IAO9B;;;;OAIG;YACW,2BAA2B;CAmC5C"}
@@ -27,6 +27,7 @@ class StreamProcessor {
27
27
  actualTokens = { inputTokens: 0, outputTokens: 0, totalTokens: 0 };
28
28
  finishReason = "unknown";
29
29
  reasoningText = "";
30
+ reasoningMetadata;
30
31
  accumulatedText = "";
31
32
  logger;
32
33
  /**
@@ -59,6 +60,9 @@ class StreamProcessor {
59
60
  break;
60
61
  case "reasoning-delta":
61
62
  this.reasoningText += event.text;
63
+ if (event.providerMetadata) {
64
+ this.reasoningMetadata = event.providerMetadata;
65
+ }
62
66
  if (this.streaming) {
63
67
  this.eventBus.emit("llm:chunk", {
64
68
  chunkType: "reasoning",
@@ -188,7 +192,12 @@ class StreamProcessor {
188
192
  await this.contextManager.updateAssistantMessage(
189
193
  this.assistantMessageId,
190
194
  {
191
- tokenUsage: usage
195
+ tokenUsage: usage,
196
+ // Persist reasoning text and metadata for round-tripping
197
+ ...this.reasoningText && { reasoning: this.reasoningText },
198
+ ...this.reasoningMetadata && {
199
+ reasoningMetadata: this.reasoningMetadata
200
+ }
192
201
  }
193
202
  );
194
203
  }
@@ -200,6 +209,9 @@ class StreamProcessor {
200
209
  provider: this.config.provider,
201
210
  model: this.config.model,
202
211
  tokenUsage: usage,
212
+ ...this.config.estimatedInputTokens !== void 0 && {
213
+ estimatedInputTokens: this.config.estimatedInputTokens
214
+ },
203
215
  finishReason: this.finishReason
204
216
  });
205
217
  }
@@ -261,6 +273,9 @@ class StreamProcessor {
261
273
  provider: this.config.provider,
262
274
  model: this.config.model,
263
275
  tokenUsage: this.actualTokens,
276
+ ...this.config.estimatedInputTokens !== void 0 && {
277
+ estimatedInputTokens: this.config.estimatedInputTokens
278
+ },
264
279
  finishReason: "cancelled"
265
280
  });
266
281
  return {
@@ -282,6 +297,9 @@ class StreamProcessor {
282
297
  provider: this.config.provider,
283
298
  model: this.config.model,
284
299
  tokenUsage: this.actualTokens,
300
+ ...this.config.estimatedInputTokens !== void 0 && {
301
+ estimatedInputTokens: this.config.estimatedInputTokens
302
+ },
285
303
  finishReason: "cancelled"
286
304
  });
287
305
  return {
@@ -91,7 +91,7 @@ var import_reactive_overflow = require("../../context/compaction/strategies/reac
91
91
  const toolSupportCache = /* @__PURE__ */ new Map();
92
92
  const LOCAL_PROVIDERS = ["ollama", "local"];
93
93
  class TurnExecutor {
94
- constructor(model, toolManager, contextManager, eventBus, resourceManager, sessionId, config, llmContext, logger, messageQueue, modelLimits, externalSignal, compactionStrategy) {
94
+ constructor(model, toolManager, contextManager, eventBus, resourceManager, sessionId, config, llmContext, logger, messageQueue, modelLimits, externalSignal, compactionStrategy, compactionThresholdPercent = 1) {
95
95
  this.model = model;
96
96
  this.toolManager = toolManager;
97
97
  this.contextManager = contextManager;
@@ -103,6 +103,7 @@ class TurnExecutor {
103
103
  this.messageQueue = messageQueue;
104
104
  this.modelLimits = modelLimits;
105
105
  this.externalSignal = externalSignal;
106
+ this.compactionThresholdPercent = compactionThresholdPercent;
106
107
  this.logger = logger.createChild(import_types4.DextoLogComponent.EXECUTOR);
107
108
  this.stepAbortController = new AbortController();
108
109
  if (compactionStrategy !== void 0) {
@@ -123,13 +124,32 @@ class TurnExecutor {
123
124
  * Used to pass approval info from tool execution to result persistence.
124
125
  */
125
126
  approvalMetadata = /* @__PURE__ */ new Map();
127
+ /**
128
+ * Tracks whether compaction occurred during this turn.
129
+ * Used to signal to the caller that session continuation may be needed.
130
+ */
131
+ compactionOccurred = false;
132
+ /**
133
+ * Compaction data captured during this turn.
134
+ * Contains summary text and preserved messages for session continuation.
135
+ * This data is passed up the call chain (NOT persisted to original session).
136
+ */
137
+ compactionData = null;
138
+ /**
139
+ * Virtual context for remaining iterations after compaction.
140
+ * When set, the main loop uses this instead of calling getFormattedMessagesForLLM().
141
+ * This provides reduced context to the LLM without persisting to the original session.
142
+ */
143
+ virtualContext = null;
126
144
  /**
127
145
  * Get StreamProcessor config from TurnExecutor state.
146
+ * @param estimatedInputTokens Optional estimated input tokens for analytics
128
147
  */
129
- getStreamProcessorConfig() {
148
+ getStreamProcessorConfig(estimatedInputTokens) {
130
149
  return {
131
150
  provider: this.llmContext.provider,
132
- model: this.llmContext.model
151
+ model: this.llmContext.model,
152
+ ...estimatedInputTokens !== void 0 && { estimatedInputTokens }
133
153
  };
134
154
  }
135
155
  /**
@@ -185,13 +205,34 @@ class TurnExecutor {
185
205
  if (coalesced) {
186
206
  await this.injectQueuedMessages(coalesced);
187
207
  }
188
- if (lastStepTokens && this.checkAndHandleOverflow(lastStepTokens)) {
189
- await this.compress(lastStepTokens.inputTokens ?? 0);
190
- }
191
- const prepared = await this.contextManager.getFormattedMessagesWithCompression(
208
+ await this.pruneOldToolOutputs();
209
+ let prepared = this.virtualContext ? await this.buildMessagesFromVirtualContext(contributorContext) : await this.contextManager.getFormattedMessagesForLLM(
192
210
  contributorContext,
193
211
  this.llmContext
194
212
  );
213
+ const toolDefinitions = supportsTools ? await this.toolManager.getAllTools() : {};
214
+ let estimatedTokens = await this.contextManager.getEstimatedNextInputTokens(
215
+ prepared.systemPrompt,
216
+ prepared.preparedHistory,
217
+ toolDefinitions
218
+ );
219
+ if (this.shouldCompact(estimatedTokens)) {
220
+ this.logger.debug(
221
+ `Pre-check: estimated ${estimatedTokens} tokens exceeds threshold, compacting`
222
+ );
223
+ await this.compactToVirtualContext(estimatedTokens);
224
+ if (this.virtualContext) {
225
+ prepared = await this.buildMessagesFromVirtualContext(contributorContext);
226
+ estimatedTokens = await this.contextManager.getEstimatedNextInputTokens(
227
+ prepared.systemPrompt,
228
+ prepared.preparedHistory,
229
+ toolDefinitions
230
+ );
231
+ this.logger.debug(
232
+ `Post-compaction: recomputed estimate is ${estimatedTokens} tokens`
233
+ );
234
+ }
235
+ }
195
236
  this.logger.debug(`Step ${stepCount}: Starting`);
196
237
  const tools = supportsTools ? await this.createTools() : {};
197
238
  const streamProcessor = new import_stream_processor.StreamProcessor(
@@ -199,7 +240,7 @@ class TurnExecutor {
199
240
  this.eventBus,
200
241
  this.resourceManager,
201
242
  this.stepAbortController.signal,
202
- this.getStreamProcessorConfig(),
243
+ this.getStreamProcessorConfig(estimatedTokens),
203
244
  this.logger,
204
245
  streaming,
205
246
  this.approvalMetadata
@@ -238,6 +279,28 @@ class TurnExecutor {
238
279
  this.logger.debug(
239
280
  `Step ${stepCount}: Finished with reason="${result.finishReason}", tokens=${JSON.stringify(result.usage)}`
240
281
  );
282
+ if (result.finishReason === "cancelled") {
283
+ this.logger.info(
284
+ `Context estimation (cancelled): keeping last known actuals, partial response (${result.text.length} chars) will be estimated`
285
+ );
286
+ } else if (result.usage?.inputTokens !== void 0) {
287
+ const diff = estimatedTokens - result.usage.inputTokens;
288
+ const diffPercent = result.usage.inputTokens > 0 ? (diff / result.usage.inputTokens * 100).toFixed(1) : "0.0";
289
+ this.logger.info(
290
+ `Context estimation accuracy: estimated=${estimatedTokens}, actual=${result.usage.inputTokens}, error=${diff} (${diffPercent}%)`
291
+ );
292
+ this.contextManager.setLastActualInputTokens(result.usage.inputTokens);
293
+ if (result.usage?.outputTokens !== void 0) {
294
+ this.contextManager.setLastActualOutputTokens(result.usage.outputTokens);
295
+ }
296
+ await this.contextManager.recordLastCallMessageCount();
297
+ }
298
+ if (!this.virtualContext && result.usage?.inputTokens && this.shouldCompactFromActual(result.usage.inputTokens)) {
299
+ this.logger.debug(
300
+ `Post-response: actual ${result.usage.inputTokens} tokens exceeds threshold, compacting`
301
+ );
302
+ await this.compactToVirtualContext(result.usage.inputTokens);
303
+ }
241
304
  if (result.finishReason !== "tool-calls") {
242
305
  const queuedOnTerminate = this.messageQueue.dequeueAll();
243
306
  if (queuedOnTerminate) {
@@ -261,7 +324,6 @@ class TurnExecutor {
261
324
  lastFinishReason = "max-steps";
262
325
  break;
263
326
  }
264
- await this.pruneOldToolOutputs();
265
327
  }
266
328
  } catch (error) {
267
329
  const mappedError = this.mapProviderError(error);
@@ -291,7 +353,14 @@ class TurnExecutor {
291
353
  text: lastText,
292
354
  stepCount,
293
355
  usage: lastStepTokens,
294
- finishReason: lastFinishReason
356
+ finishReason: lastFinishReason,
357
+ // Signal to caller that compaction occurred during this turn
358
+ // Caller can use this to trigger session-native continuation
359
+ didCompact: this.compactionOccurred,
360
+ // Pass compaction data up the chain (NOT persisted to original session)
361
+ // Caller uses this to create the continuation session with summary
362
+ // Use spread to conditionally include only when data exists (exactOptionalPropertyTypes)
363
+ ...this.compactionData && { compaction: this.compactionData }
295
364
  };
296
365
  } catch (_2) {
297
366
  var _error = _2, _hasError = true;
@@ -589,7 +658,7 @@ class TurnExecutor {
589
658
  /**
590
659
  * Prunes old tool outputs by marking them with compactedAt timestamp.
591
660
  * Does NOT modify content - transformation happens at format time in
592
- * ContextManager.getFormattedMessagesWithCompression().
661
+ * ContextManager.prepareHistory().
593
662
  *
594
663
  * Algorithm:
595
664
  * 1. Go backwards through history (most recent first)
@@ -658,54 +727,174 @@ class TurnExecutor {
658
727
  this.messageQueue.clear();
659
728
  }
660
729
  /**
661
- * Check if context has overflowed based on actual token usage from API.
730
+ * Check if context should be compacted based on estimated token count.
731
+ * Uses the threshold percentage from compaction config to trigger earlier (e.g., at 90%).
732
+ *
733
+ * @param estimatedTokens Estimated token count from the current context
734
+ * @returns true if compaction is needed before making the LLM call
735
+ */
736
+ shouldCompact(estimatedTokens) {
737
+ if (!this.modelLimits || !this.compactionStrategy) {
738
+ return false;
739
+ }
740
+ return (0, import_overflow.isOverflow)(
741
+ { inputTokens: estimatedTokens },
742
+ this.modelLimits,
743
+ this.compactionThresholdPercent
744
+ );
745
+ }
746
+ /**
747
+ * Check if context should be compacted based on actual token count from API response.
748
+ * This is a post-response check using real token counts rather than estimates.
749
+ *
750
+ * @param actualTokens Actual input token count from the API response
751
+ * @returns true if compaction is needed
662
752
  */
663
- checkAndHandleOverflow(tokens) {
753
+ shouldCompactFromActual(actualTokens) {
664
754
  if (!this.modelLimits || !this.compactionStrategy) {
665
755
  return false;
666
756
  }
667
- return (0, import_overflow.isOverflow)(tokens, this.modelLimits);
757
+ return (0, import_overflow.isOverflow)(
758
+ { inputTokens: actualTokens },
759
+ this.modelLimits,
760
+ this.compactionThresholdPercent
761
+ );
668
762
  }
669
763
  /**
670
- * Compress context using ReactiveOverflowStrategy.
764
+ * Compact context using ReactiveOverflowStrategy WITHOUT persisting to original session.
765
+ *
766
+ * Key design: Creates a virtual context (summary + preserved messages) that will be used
767
+ * for the remaining iterations of this turn. The compaction data is passed up the call chain
768
+ * so the caller can create a continuation session with the summary.
671
769
  *
672
- * Generates a summary of older messages and adds it to history.
673
- * The actual token reduction happens at read-time via filterCompacted()
674
- * in getFormattedMessagesWithCompression().
770
+ * The original session remains UNTOUCHED - no messages are added or modified.
675
771
  *
676
- * @param originalTokens The actual input token count from API that triggered overflow
772
+ * @param originalTokens The estimated input token count that triggered overflow
677
773
  */
678
- async compress(originalTokens) {
774
+ async compactToVirtualContext(originalTokens) {
679
775
  if (!this.compactionStrategy) {
680
776
  return;
681
777
  }
682
778
  this.logger.info(
683
- `Context overflow detected (${originalTokens} tokens), running compression`
779
+ `Context overflow detected (${originalTokens} tokens), checking if compression is possible`
684
780
  );
685
781
  const history = await this.contextManager.getHistory();
782
+ if (history.length < 4) {
783
+ this.logger.debug("Compaction skipped: history too short to summarize");
784
+ return;
785
+ }
786
+ this.eventBus.emit("context:compacting", {
787
+ estimatedTokens: originalTokens
788
+ });
686
789
  const summaryMessages = await this.compactionStrategy.compact(history);
687
790
  if (summaryMessages.length === 0) {
688
- this.logger.debug("Compaction returned no summary (history too short)");
791
+ this.logger.debug(
792
+ "Compaction skipped: strategy returned no summary (likely already compacted or nothing to summarize)"
793
+ );
794
+ this.eventBus.emit("context:compacted", {
795
+ originalTokens,
796
+ compactedTokens: originalTokens,
797
+ // No change
798
+ originalMessages: history.length,
799
+ compactedMessages: history.length,
800
+ // No change
801
+ strategy: this.compactionStrategy.name,
802
+ reason: "overflow"
803
+ });
804
+ return;
805
+ }
806
+ const summaryMessage = summaryMessages[0];
807
+ if (!summaryMessage) {
808
+ this.logger.warn("Compaction returned empty summary message array");
689
809
  return;
690
810
  }
691
- for (const summary of summaryMessages) {
692
- await this.contextManager.addMessage(summary);
811
+ const summaryText = this.extractSummaryText(summaryMessage);
812
+ const summarizedCount = summaryMessage.metadata?.originalMessageCount ?? 0;
813
+ let existingSummaryIndex = -1;
814
+ for (let i = history.length - 1; i >= 0; i--) {
815
+ const msg = history[i];
816
+ if (msg?.metadata?.isSummary === true || msg?.metadata?.isSessionSummary === true) {
817
+ existingSummaryIndex = i;
818
+ break;
819
+ }
693
820
  }
694
- const { filterCompacted, estimateMessagesTokens } = await import("../../context/utils.js");
695
- const updatedHistory = await this.contextManager.getHistory();
696
- const filteredHistory = filterCompacted(updatedHistory);
697
- const compactedTokens = estimateMessagesTokens(filteredHistory);
821
+ const baseIndex = existingSummaryIndex >= 0 ? existingSummaryIndex + 1 : 0;
822
+ const preservedMessages = history.slice(baseIndex + summarizedCount);
823
+ const firstTimestamp = summaryMessage.metadata?.originalFirstTimestamp;
824
+ const lastTimestamp = summaryMessage.metadata?.originalLastTimestamp;
825
+ this.compactionData = {
826
+ summaryText,
827
+ preservedMessages: [...preservedMessages],
828
+ // Copy to avoid mutation
829
+ summarizedCount,
830
+ ...firstTimestamp !== void 0 && { originalFirstTimestamp: firstTimestamp },
831
+ ...lastTimestamp !== void 0 && { originalLastTimestamp: lastTimestamp }
832
+ };
833
+ this.virtualContext = {
834
+ summaryMessage,
835
+ preservedMessages: [...preservedMessages]
836
+ };
837
+ this.compactionOccurred = true;
838
+ this.contextManager.resetActualTokenTracking();
839
+ const { estimateMessagesTokens: estimateTokens } = await import("../../context/utils.js");
840
+ const virtualMessages = [summaryMessage, ...preservedMessages];
841
+ const compactedTokens = estimateTokens(virtualMessages);
698
842
  this.eventBus.emit("context:compacted", {
699
843
  originalTokens,
700
844
  compactedTokens,
701
845
  originalMessages: history.length,
702
- compactedMessages: filteredHistory.length,
846
+ compactedMessages: virtualMessages.length,
703
847
  strategy: this.compactionStrategy.name,
704
848
  reason: "overflow"
705
849
  });
706
850
  this.logger.info(
707
- `Compaction complete: ${originalTokens} \u2192 ~${compactedTokens} tokens (${history.length} \u2192 ${filteredHistory.length} messages after filtering)`
851
+ `Compaction complete (virtual context): ${originalTokens} \u2192 ~${compactedTokens} tokens (${history.length} \u2192 ${virtualMessages.length} messages). Original session unchanged - summary will be passed to continuation session.`
852
+ );
853
+ }
854
+ /**
855
+ * Extract the summary text from a summary message.
856
+ */
857
+ extractSummaryText(summaryMessage) {
858
+ if (typeof summaryMessage.content === "string") {
859
+ return summaryMessage.content;
860
+ }
861
+ if (Array.isArray(summaryMessage.content)) {
862
+ return summaryMessage.content.filter((part) => part.type === "text").map((part) => part.text).join("\n");
863
+ }
864
+ return "";
865
+ }
866
+ /**
867
+ * Build formatted messages from virtual context (after compaction).
868
+ *
869
+ * This creates LLM-ready messages using:
870
+ * - System prompt (same as normal flow)
871
+ * - Summary message (as first message)
872
+ * - Preserved messages (formatted for LLM)
873
+ *
874
+ * Uses the same formatting pipeline as getFormattedMessagesForLLM()
875
+ * but with our virtual history instead of the stored history.
876
+ *
877
+ * @param contributorContext Context for system prompt contributors
878
+ * @returns Formatted messages ready for LLM call, matching getFormattedMessagesForLLM return type
879
+ */
880
+ async buildMessagesFromVirtualContext(contributorContext) {
881
+ if (!this.virtualContext) {
882
+ throw new Error("buildMessagesFromVirtualContext called without virtual context");
883
+ }
884
+ const { summaryMessage, preservedMessages } = this.virtualContext;
885
+ const systemPrompt = await this.contextManager.getSystemPrompt(contributorContext);
886
+ const virtualHistory = [summaryMessage, ...preservedMessages];
887
+ const formattedMessages = await this.contextManager.getFormattedMessages(
888
+ contributorContext,
889
+ this.llmContext,
890
+ systemPrompt,
891
+ virtualHistory
708
892
  );
893
+ return {
894
+ formattedMessages,
895
+ systemPrompt,
896
+ preparedHistory: virtualHistory
897
+ };
709
898
  }
710
899
  /**
711
900
  * Set telemetry span attributes for token usage.
@@ -34,6 +34,7 @@ export declare class TurnExecutor {
34
34
  private messageQueue;
35
35
  private modelLimits?;
36
36
  private externalSignal?;
37
+ private compactionThresholdPercent;
37
38
  private logger;
38
39
  /**
39
40
  * Per-step abort controller. Created fresh for each iteration of the loop.
@@ -46,15 +47,33 @@ export declare class TurnExecutor {
46
47
  * Used to pass approval info from tool execution to result persistence.
47
48
  */
48
49
  private approvalMetadata;
50
+ /**
51
+ * Tracks whether compaction occurred during this turn.
52
+ * Used to signal to the caller that session continuation may be needed.
53
+ */
54
+ private compactionOccurred;
55
+ /**
56
+ * Compaction data captured during this turn.
57
+ * Contains summary text and preserved messages for session continuation.
58
+ * This data is passed up the call chain (NOT persisted to original session).
59
+ */
60
+ private compactionData;
61
+ /**
62
+ * Virtual context for remaining iterations after compaction.
63
+ * When set, the main loop uses this instead of calling getFormattedMessagesForLLM().
64
+ * This provides reduced context to the LLM without persisting to the original session.
65
+ */
66
+ private virtualContext;
49
67
  constructor(model: LanguageModel, toolManager: ToolManager, contextManager: ContextManager<ModelMessage>, eventBus: SessionEventBus, resourceManager: ResourceManager, sessionId: string, config: {
50
68
  maxSteps?: number | undefined;
51
69
  maxOutputTokens?: number | undefined;
52
70
  temperature?: number | undefined;
53
71
  baseURL?: string | undefined;
54
72
  reasoningEffort?: 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | undefined;
55
- }, llmContext: LLMContext, logger: IDextoLogger, messageQueue: MessageQueueService, modelLimits?: ModelLimits | undefined, externalSignal?: AbortSignal | undefined, compactionStrategy?: ICompactionStrategy | null);
73
+ }, llmContext: LLMContext, logger: IDextoLogger, messageQueue: MessageQueueService, modelLimits?: ModelLimits | undefined, externalSignal?: AbortSignal | undefined, compactionStrategy?: ICompactionStrategy | null, compactionThresholdPercent?: number);
56
74
  /**
57
75
  * Get StreamProcessor config from TurnExecutor state.
76
+ * @param estimatedInputTokens Optional estimated input tokens for analytics
58
77
  */
59
78
  private getStreamProcessorConfig;
60
79
  /**
@@ -119,7 +138,7 @@ export declare class TurnExecutor {
119
138
  /**
120
139
  * Prunes old tool outputs by marking them with compactedAt timestamp.
121
140
  * Does NOT modify content - transformation happens at format time in
122
- * ContextManager.getFormattedMessagesWithCompression().
141
+ * ContextManager.prepareHistory().
123
142
  *
124
143
  * Algorithm:
125
144
  * 1. Go backwards through history (most recent first)
@@ -143,19 +162,52 @@ export declare class TurnExecutor {
143
162
  */
144
163
  private cleanup;
145
164
  /**
146
- * Check if context has overflowed based on actual token usage from API.
165
+ * Check if context should be compacted based on estimated token count.
166
+ * Uses the threshold percentage from compaction config to trigger earlier (e.g., at 90%).
167
+ *
168
+ * @param estimatedTokens Estimated token count from the current context
169
+ * @returns true if compaction is needed before making the LLM call
170
+ */
171
+ private shouldCompact;
172
+ /**
173
+ * Check if context should be compacted based on actual token count from API response.
174
+ * This is a post-response check using real token counts rather than estimates.
175
+ *
176
+ * @param actualTokens Actual input token count from the API response
177
+ * @returns true if compaction is needed
147
178
  */
148
- private checkAndHandleOverflow;
179
+ private shouldCompactFromActual;
149
180
  /**
150
- * Compress context using ReactiveOverflowStrategy.
181
+ * Compact context using ReactiveOverflowStrategy WITHOUT persisting to original session.
151
182
  *
152
- * Generates a summary of older messages and adds it to history.
153
- * The actual token reduction happens at read-time via filterCompacted()
154
- * in getFormattedMessagesWithCompression().
183
+ * Key design: Creates a virtual context (summary + preserved messages) that will be used
184
+ * for the remaining iterations of this turn. The compaction data is passed up the call chain
185
+ * so the caller can create a continuation session with the summary.
155
186
  *
156
- * @param originalTokens The actual input token count from API that triggered overflow
187
+ * The original session remains UNTOUCHED - no messages are added or modified.
188
+ *
189
+ * @param originalTokens The estimated input token count that triggered overflow
190
+ */
191
+ private compactToVirtualContext;
192
+ /**
193
+ * Extract the summary text from a summary message.
194
+ */
195
+ private extractSummaryText;
196
+ /**
197
+ * Build formatted messages from virtual context (after compaction).
198
+ *
199
+ * This creates LLM-ready messages using:
200
+ * - System prompt (same as normal flow)
201
+ * - Summary message (as first message)
202
+ * - Preserved messages (formatted for LLM)
203
+ *
204
+ * Uses the same formatting pipeline as getFormattedMessagesForLLM()
205
+ * but with our virtual history instead of the stored history.
206
+ *
207
+ * @param contributorContext Context for system prompt contributors
208
+ * @returns Formatted messages ready for LLM call, matching getFormattedMessagesForLLM return type
157
209
  */
158
- private compress;
210
+ private buildMessagesFromVirtualContext;
159
211
  /**
160
212
  * Set telemetry span attributes for token usage.
161
213
  */
@@ -1 +1 @@
1
- {"version":3,"file":"turn-executor.d.ts","sourceRoot":"","sources":["../../../src/llm/executor/turn-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EAMb,KAAK,YAAY,EAEpB,MAAM,IAAI,CAAC;AAEZ,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAG1D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,uBAAuB,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,UAAU,EAAoB,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE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