@dexto/core 1.5.4 → 1.5.6
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/agent/DextoAgent.cjs +61 -155
- package/dist/agent/DextoAgent.d.ts +11 -54
- package/dist/agent/DextoAgent.d.ts.map +1 -1
- package/dist/agent/DextoAgent.js +61 -155
- package/dist/context/compaction/strategies/reactive-overflow.cjs +5 -3
- package/dist/context/compaction/strategies/reactive-overflow.d.ts +1 -0
- package/dist/context/compaction/strategies/reactive-overflow.d.ts.map +1 -1
- package/dist/context/compaction/strategies/reactive-overflow.js +5 -3
- package/dist/context/compaction/types.d.ts +13 -1
- package/dist/context/compaction/types.d.ts.map +1 -1
- package/dist/errors/types.cjs +0 -2
- package/dist/errors/types.d.ts +1 -5
- package/dist/errors/types.d.ts.map +1 -1
- package/dist/errors/types.js +0 -2
- package/dist/events/index.cjs +0 -2
- package/dist/events/index.d.ts +6 -25
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +0 -2
- package/dist/llm/executor/stream-processor.cjs +85 -27
- package/dist/llm/executor/stream-processor.d.ts +4 -0
- package/dist/llm/executor/stream-processor.d.ts.map +1 -1
- package/dist/llm/executor/stream-processor.js +85 -27
- package/dist/llm/executor/turn-executor.cjs +58 -130
- package/dist/llm/executor/turn-executor.d.ts +9 -43
- package/dist/llm/executor/turn-executor.d.ts.map +1 -1
- package/dist/llm/executor/turn-executor.js +58 -130
- package/dist/llm/executor/types.d.ts +0 -28
- package/dist/llm/executor/types.d.ts.map +1 -1
- package/dist/llm/services/vercel.cjs +2 -5
- package/dist/llm/services/vercel.d.ts +1 -6
- package/dist/llm/services/vercel.d.ts.map +1 -1
- package/dist/llm/services/vercel.js +2 -5
- package/dist/logger/logger.cjs +6 -7
- package/dist/logger/logger.d.ts +1 -0
- package/dist/logger/logger.d.ts.map +1 -1
- package/dist/logger/logger.js +6 -7
- package/dist/session/chat-session.cjs +19 -12
- package/dist/session/chat-session.d.ts +3 -6
- package/dist/session/chat-session.d.ts.map +1 -1
- package/dist/session/chat-session.js +19 -12
- package/dist/session/session-manager.cjs +0 -135
- package/dist/session/session-manager.d.ts +0 -43
- package/dist/session/session-manager.d.ts.map +1 -1
- package/dist/session/session-manager.js +0 -135
- package/dist/telemetry/telemetry.cjs +12 -5
- package/dist/telemetry/telemetry.d.ts.map +1 -1
- package/dist/telemetry/telemetry.js +12 -5
- package/dist/tools/schemas.cjs +2 -2
- package/dist/tools/schemas.js +2 -2
- package/package.json +15 -5
- package/dist/filesystem/error-codes.cjs +0 -53
- package/dist/filesystem/error-codes.d.ts +0 -31
- package/dist/filesystem/error-codes.d.ts.map +0 -1
- package/dist/filesystem/error-codes.js +0 -30
- package/dist/filesystem/errors.cjs +0 -303
- package/dist/filesystem/errors.d.ts +0 -109
- package/dist/filesystem/errors.d.ts.map +0 -1
- package/dist/filesystem/errors.js +0 -280
- package/dist/filesystem/filesystem-service.cjs +0 -534
- package/dist/filesystem/filesystem-service.d.ts +0 -97
- package/dist/filesystem/filesystem-service.d.ts.map +0 -1
- package/dist/filesystem/filesystem-service.js +0 -501
- package/dist/filesystem/index.cjs +0 -37
- package/dist/filesystem/index.d.ts +0 -11
- package/dist/filesystem/index.d.ts.map +0 -1
- package/dist/filesystem/index.js +0 -11
- package/dist/filesystem/path-validator.cjs +0 -250
- package/dist/filesystem/path-validator.d.ts +0 -103
- package/dist/filesystem/path-validator.d.ts.map +0 -1
- package/dist/filesystem/path-validator.js +0 -217
- package/dist/filesystem/types.cjs +0 -16
- package/dist/filesystem/types.d.ts +0 -175
- package/dist/filesystem/types.d.ts.map +0 -1
- package/dist/filesystem/types.js +0 -0
- package/dist/process/command-validator.cjs +0 -554
- package/dist/process/command-validator.d.ts +0 -49
- package/dist/process/command-validator.d.ts.map +0 -1
- package/dist/process/command-validator.js +0 -531
- package/dist/process/error-codes.cjs +0 -47
- package/dist/process/error-codes.d.ts +0 -25
- package/dist/process/error-codes.d.ts.map +0 -1
- package/dist/process/error-codes.js +0 -24
- package/dist/process/errors.cjs +0 -244
- package/dist/process/errors.d.ts +0 -87
- package/dist/process/errors.d.ts.map +0 -1
- package/dist/process/errors.js +0 -221
- package/dist/process/index.cjs +0 -37
- package/dist/process/index.d.ts +0 -11
- package/dist/process/index.d.ts.map +0 -1
- package/dist/process/index.js +0 -11
- package/dist/process/process-service.cjs +0 -497
- package/dist/process/process-service.d.ts +0 -69
- package/dist/process/process-service.d.ts.map +0 -1
- package/dist/process/process-service.js +0 -464
- package/dist/process/types.cjs +0 -16
- package/dist/process/types.d.ts +0 -107
- package/dist/process/types.d.ts.map +0 -1
- package/dist/process/types.js +0 -0
- package/dist/session/compaction-service.cjs +0 -139
- package/dist/session/compaction-service.d.ts +0 -81
- package/dist/session/compaction-service.d.ts.map +0 -1
- package/dist/session/compaction-service.js +0 -106
|
@@ -47,23 +47,6 @@ export declare class TurnExecutor {
|
|
|
47
47
|
* Used to pass approval info from tool execution to result persistence.
|
|
48
48
|
*/
|
|
49
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;
|
|
67
50
|
constructor(model: LanguageModel, toolManager: ToolManager, contextManager: ContextManager<ModelMessage>, eventBus: SessionEventBus, resourceManager: ResourceManager, sessionId: string, config: {
|
|
68
51
|
maxSteps?: number | undefined;
|
|
69
52
|
maxOutputTokens?: number | undefined;
|
|
@@ -178,40 +161,23 @@ export declare class TurnExecutor {
|
|
|
178
161
|
*/
|
|
179
162
|
private shouldCompactFromActual;
|
|
180
163
|
/**
|
|
181
|
-
* Compact context
|
|
164
|
+
* Compact context by generating a summary and adding it to the same session.
|
|
182
165
|
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
* The original session remains UNTOUCHED - no messages are added or modified.
|
|
166
|
+
* The summary message is added to the conversation history with `isSummary: true` metadata.
|
|
167
|
+
* When the context is loaded via getFormattedMessagesForLLM(), filterCompacted() will
|
|
168
|
+
* exclude all messages before the summary, effectively compacting the context.
|
|
188
169
|
*
|
|
189
170
|
* @param originalTokens The estimated input token count that triggered overflow
|
|
171
|
+
* @param contributorContext Context for system prompt contributors (needed for accurate token estimation)
|
|
172
|
+
* @param tools Tool definitions (needed for accurate token estimation)
|
|
173
|
+
* @returns true if compaction occurred, false if skipped
|
|
190
174
|
*/
|
|
191
|
-
private
|
|
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
|
|
209
|
-
*/
|
|
210
|
-
private buildMessagesFromVirtualContext;
|
|
175
|
+
private compactContext;
|
|
211
176
|
/**
|
|
212
177
|
* Set telemetry span attributes for token usage.
|
|
213
178
|
*/
|
|
214
179
|
private setTelemetryAttributes;
|
|
180
|
+
private getContextInputTokens;
|
|
215
181
|
/**
|
|
216
182
|
* Map provider errors to DextoRuntimeError.
|
|
217
183
|
*/
|
|
@@ -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;
|
|
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,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAQ1E,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAEpF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAc7E;;;;;;;;;;;GAWG;AACH,qBAAa,YAAY;IAkBjB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC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AAE,yBAAyB,EAC7C,SAAS,GAAE,OAAc,GAC1B,OAAO,CAAC,cAAc,CAAC;IA0T1B;;;OAGG;IACH,KAAK,IAAI,IAAI;IAIb;;;OAGG;YACW,oBAAoB;IAmBlC;;;;;;OAMG;YACW,mBAAmB;IA0EjC;;;;;;;OAOG;YACW,WAAW;IA0GzB;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IAuF9B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAyBxB;;OAEG;IACH,OAAO,CAAC,eAAe;IAavB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAS5B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAU;IAC/C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAU;IAE/C;;;;;;;;;;;OAWG;YACW,mBAAmB;IAkDjC;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;IAgB1B;;;OAGG;IACH,OAAO,CAAC,OAAO;IAYf;;;;;;OAMG;IACH,OAAO,CAAC,aAAa;IAYrB;;;;;;OAMG;IACH,OAAO,CAAC,uBAAuB;IAY/B;;;;;;;;;;;OAWG;YACW,cAAc;IAoF5B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAoB9B,OAAO,CAAC,qBAAqB;IAK7B;;OAEG;IACH,OAAO,CAAC,gBAAgB;CA0D3B"}
|
|
@@ -56,23 +56,6 @@ class TurnExecutor {
|
|
|
56
56
|
* Used to pass approval info from tool execution to result persistence.
|
|
57
57
|
*/
|
|
58
58
|
approvalMetadata = /* @__PURE__ */ new Map();
|
|
59
|
-
/**
|
|
60
|
-
* Tracks whether compaction occurred during this turn.
|
|
61
|
-
* Used to signal to the caller that session continuation may be needed.
|
|
62
|
-
*/
|
|
63
|
-
compactionOccurred = false;
|
|
64
|
-
/**
|
|
65
|
-
* Compaction data captured during this turn.
|
|
66
|
-
* Contains summary text and preserved messages for session continuation.
|
|
67
|
-
* This data is passed up the call chain (NOT persisted to original session).
|
|
68
|
-
*/
|
|
69
|
-
compactionData = null;
|
|
70
|
-
/**
|
|
71
|
-
* Virtual context for remaining iterations after compaction.
|
|
72
|
-
* When set, the main loop uses this instead of calling getFormattedMessagesForLLM().
|
|
73
|
-
* This provides reduced context to the LLM without persisting to the original session.
|
|
74
|
-
*/
|
|
75
|
-
virtualContext = null;
|
|
76
59
|
/**
|
|
77
60
|
* Get StreamProcessor config from TurnExecutor state.
|
|
78
61
|
* @param estimatedInputTokens Optional estimated input tokens for analytics
|
|
@@ -138,7 +121,7 @@ class TurnExecutor {
|
|
|
138
121
|
await this.injectQueuedMessages(coalesced);
|
|
139
122
|
}
|
|
140
123
|
await this.pruneOldToolOutputs();
|
|
141
|
-
let prepared =
|
|
124
|
+
let prepared = await this.contextManager.getFormattedMessagesForLLM(
|
|
142
125
|
contributorContext,
|
|
143
126
|
this.llmContext
|
|
144
127
|
);
|
|
@@ -152,9 +135,16 @@ class TurnExecutor {
|
|
|
152
135
|
this.logger.debug(
|
|
153
136
|
`Pre-check: estimated ${estimatedTokens} tokens exceeds threshold, compacting`
|
|
154
137
|
);
|
|
155
|
-
await this.
|
|
156
|
-
|
|
157
|
-
|
|
138
|
+
const didCompact = await this.compactContext(
|
|
139
|
+
estimatedTokens,
|
|
140
|
+
contributorContext,
|
|
141
|
+
toolDefinitions
|
|
142
|
+
);
|
|
143
|
+
if (didCompact) {
|
|
144
|
+
prepared = await this.contextManager.getFormattedMessagesForLLM(
|
|
145
|
+
contributorContext,
|
|
146
|
+
this.llmContext
|
|
147
|
+
);
|
|
158
148
|
estimatedTokens = await this.contextManager.getEstimatedNextInputTokens(
|
|
159
149
|
prepared.systemPrompt,
|
|
160
150
|
prepared.preparedHistory,
|
|
@@ -216,22 +206,29 @@ class TurnExecutor {
|
|
|
216
206
|
`Context estimation (cancelled): keeping last known actuals, partial response (${result.text.length} chars) will be estimated`
|
|
217
207
|
);
|
|
218
208
|
} else if (result.usage?.inputTokens !== void 0) {
|
|
219
|
-
const
|
|
220
|
-
const
|
|
209
|
+
const contextInputTokens2 = this.getContextInputTokens(result.usage);
|
|
210
|
+
const actualInputTokens = contextInputTokens2 ?? result.usage.inputTokens;
|
|
211
|
+
const diff = estimatedTokens - actualInputTokens;
|
|
212
|
+
const diffPercent = actualInputTokens > 0 ? (diff / actualInputTokens * 100).toFixed(1) : "0.0";
|
|
221
213
|
this.logger.info(
|
|
222
|
-
`Context estimation accuracy: estimated=${estimatedTokens}, actual=${
|
|
214
|
+
`Context estimation accuracy: estimated=${estimatedTokens}, actual=${actualInputTokens}, error=${diff} (${diffPercent}%)`
|
|
223
215
|
);
|
|
224
|
-
this.contextManager.setLastActualInputTokens(
|
|
216
|
+
this.contextManager.setLastActualInputTokens(actualInputTokens);
|
|
225
217
|
if (result.usage?.outputTokens !== void 0) {
|
|
226
218
|
this.contextManager.setLastActualOutputTokens(result.usage.outputTokens);
|
|
227
219
|
}
|
|
228
220
|
await this.contextManager.recordLastCallMessageCount();
|
|
229
221
|
}
|
|
230
|
-
|
|
222
|
+
const contextInputTokens = result.usage ? this.getContextInputTokens(result.usage) : null;
|
|
223
|
+
if (contextInputTokens && this.shouldCompactFromActual(contextInputTokens)) {
|
|
231
224
|
this.logger.debug(
|
|
232
|
-
`Post-response: actual ${
|
|
225
|
+
`Post-response: actual ${contextInputTokens} tokens exceeds threshold, compacting`
|
|
226
|
+
);
|
|
227
|
+
await this.compactContext(
|
|
228
|
+
contextInputTokens,
|
|
229
|
+
contributorContext,
|
|
230
|
+
toolDefinitions
|
|
233
231
|
);
|
|
234
|
-
await this.compactToVirtualContext(result.usage.inputTokens);
|
|
235
232
|
}
|
|
236
233
|
if (result.finishReason !== "tool-calls") {
|
|
237
234
|
const queuedOnTerminate = this.messageQueue.dequeueAll();
|
|
@@ -285,14 +282,7 @@ class TurnExecutor {
|
|
|
285
282
|
text: lastText,
|
|
286
283
|
stepCount,
|
|
287
284
|
usage: lastStepTokens,
|
|
288
|
-
finishReason: lastFinishReason
|
|
289
|
-
// Signal to caller that compaction occurred during this turn
|
|
290
|
-
// Caller can use this to trigger session-native continuation
|
|
291
|
-
didCompact: this.compactionOccurred,
|
|
292
|
-
// Pass compaction data up the chain (NOT persisted to original session)
|
|
293
|
-
// Caller uses this to create the continuation session with summary
|
|
294
|
-
// Use spread to conditionally include only when data exists (exactOptionalPropertyTypes)
|
|
295
|
-
...this.compactionData && { compaction: this.compactionData }
|
|
285
|
+
finishReason: lastFinishReason
|
|
296
286
|
};
|
|
297
287
|
} catch (_2) {
|
|
298
288
|
var _error = _2, _hasError = true;
|
|
@@ -693,27 +683,31 @@ class TurnExecutor {
|
|
|
693
683
|
);
|
|
694
684
|
}
|
|
695
685
|
/**
|
|
696
|
-
* Compact context
|
|
697
|
-
*
|
|
698
|
-
* Key design: Creates a virtual context (summary + preserved messages) that will be used
|
|
699
|
-
* for the remaining iterations of this turn. The compaction data is passed up the call chain
|
|
700
|
-
* so the caller can create a continuation session with the summary.
|
|
686
|
+
* Compact context by generating a summary and adding it to the same session.
|
|
701
687
|
*
|
|
702
|
-
* The
|
|
688
|
+
* The summary message is added to the conversation history with `isSummary: true` metadata.
|
|
689
|
+
* When the context is loaded via getFormattedMessagesForLLM(), filterCompacted() will
|
|
690
|
+
* exclude all messages before the summary, effectively compacting the context.
|
|
703
691
|
*
|
|
704
692
|
* @param originalTokens The estimated input token count that triggered overflow
|
|
693
|
+
* @param contributorContext Context for system prompt contributors (needed for accurate token estimation)
|
|
694
|
+
* @param tools Tool definitions (needed for accurate token estimation)
|
|
695
|
+
* @returns true if compaction occurred, false if skipped
|
|
705
696
|
*/
|
|
706
|
-
async
|
|
697
|
+
async compactContext(originalTokens, contributorContext, tools) {
|
|
707
698
|
if (!this.compactionStrategy) {
|
|
708
|
-
return;
|
|
699
|
+
return false;
|
|
709
700
|
}
|
|
710
701
|
this.logger.info(
|
|
711
702
|
`Context overflow detected (${originalTokens} tokens), checking if compression is possible`
|
|
712
703
|
);
|
|
713
704
|
const history = await this.contextManager.getHistory();
|
|
705
|
+
const { filterCompacted } = await import("../../context/utils.js");
|
|
706
|
+
const originalFiltered = filterCompacted(history);
|
|
707
|
+
const originalMessages = originalFiltered.length;
|
|
714
708
|
if (history.length < 4) {
|
|
715
709
|
this.logger.debug("Compaction skipped: history too short to summarize");
|
|
716
|
-
return;
|
|
710
|
+
return false;
|
|
717
711
|
}
|
|
718
712
|
this.eventBus.emit("context:compacting", {
|
|
719
713
|
estimatedTokens: originalTokens
|
|
@@ -727,106 +721,36 @@ class TurnExecutor {
|
|
|
727
721
|
originalTokens,
|
|
728
722
|
compactedTokens: originalTokens,
|
|
729
723
|
// No change
|
|
730
|
-
originalMessages
|
|
731
|
-
compactedMessages:
|
|
724
|
+
originalMessages,
|
|
725
|
+
compactedMessages: originalMessages,
|
|
732
726
|
// No change
|
|
733
727
|
strategy: this.compactionStrategy.name,
|
|
734
728
|
reason: "overflow"
|
|
735
729
|
});
|
|
736
|
-
return;
|
|
737
|
-
}
|
|
738
|
-
const summaryMessage = summaryMessages[0];
|
|
739
|
-
if (!summaryMessage) {
|
|
740
|
-
this.logger.warn("Compaction returned empty summary message array");
|
|
741
|
-
return;
|
|
730
|
+
return false;
|
|
742
731
|
}
|
|
743
|
-
const
|
|
744
|
-
|
|
745
|
-
let existingSummaryIndex = -1;
|
|
746
|
-
for (let i = history.length - 1; i >= 0; i--) {
|
|
747
|
-
const msg = history[i];
|
|
748
|
-
if (msg?.metadata?.isSummary === true || msg?.metadata?.isSessionSummary === true) {
|
|
749
|
-
existingSummaryIndex = i;
|
|
750
|
-
break;
|
|
751
|
-
}
|
|
732
|
+
for (const summary of summaryMessages) {
|
|
733
|
+
await this.contextManager.addMessage(summary);
|
|
752
734
|
}
|
|
753
|
-
const baseIndex = existingSummaryIndex >= 0 ? existingSummaryIndex + 1 : 0;
|
|
754
|
-
const preservedMessages = history.slice(baseIndex + summarizedCount);
|
|
755
|
-
const firstTimestamp = summaryMessage.metadata?.originalFirstTimestamp;
|
|
756
|
-
const lastTimestamp = summaryMessage.metadata?.originalLastTimestamp;
|
|
757
|
-
this.compactionData = {
|
|
758
|
-
summaryText,
|
|
759
|
-
preservedMessages: [...preservedMessages],
|
|
760
|
-
// Copy to avoid mutation
|
|
761
|
-
summarizedCount,
|
|
762
|
-
...firstTimestamp !== void 0 && { originalFirstTimestamp: firstTimestamp },
|
|
763
|
-
...lastTimestamp !== void 0 && { originalLastTimestamp: lastTimestamp }
|
|
764
|
-
};
|
|
765
|
-
this.virtualContext = {
|
|
766
|
-
summaryMessage,
|
|
767
|
-
preservedMessages: [...preservedMessages]
|
|
768
|
-
};
|
|
769
|
-
this.compactionOccurred = true;
|
|
770
735
|
this.contextManager.resetActualTokenTracking();
|
|
771
|
-
const
|
|
772
|
-
|
|
773
|
-
|
|
736
|
+
const afterEstimate = await this.contextManager.getContextTokenEstimate(
|
|
737
|
+
contributorContext,
|
|
738
|
+
tools
|
|
739
|
+
);
|
|
740
|
+
const compactedTokens = afterEstimate.estimated;
|
|
741
|
+
const compactedMessages = afterEstimate.stats.filteredMessageCount;
|
|
774
742
|
this.eventBus.emit("context:compacted", {
|
|
775
743
|
originalTokens,
|
|
776
744
|
compactedTokens,
|
|
777
|
-
originalMessages
|
|
778
|
-
compactedMessages
|
|
745
|
+
originalMessages,
|
|
746
|
+
compactedMessages,
|
|
779
747
|
strategy: this.compactionStrategy.name,
|
|
780
748
|
reason: "overflow"
|
|
781
749
|
});
|
|
782
750
|
this.logger.info(
|
|
783
|
-
`Compaction complete
|
|
751
|
+
`Compaction complete: ${originalTokens} \u2192 ~${compactedTokens} tokens (${originalMessages} \u2192 ${compactedMessages} messages after filtering)`
|
|
784
752
|
);
|
|
785
|
-
|
|
786
|
-
/**
|
|
787
|
-
* Extract the summary text from a summary message.
|
|
788
|
-
*/
|
|
789
|
-
extractSummaryText(summaryMessage) {
|
|
790
|
-
if (typeof summaryMessage.content === "string") {
|
|
791
|
-
return summaryMessage.content;
|
|
792
|
-
}
|
|
793
|
-
if (Array.isArray(summaryMessage.content)) {
|
|
794
|
-
return summaryMessage.content.filter((part) => part.type === "text").map((part) => part.text).join("\n");
|
|
795
|
-
}
|
|
796
|
-
return "";
|
|
797
|
-
}
|
|
798
|
-
/**
|
|
799
|
-
* Build formatted messages from virtual context (after compaction).
|
|
800
|
-
*
|
|
801
|
-
* This creates LLM-ready messages using:
|
|
802
|
-
* - System prompt (same as normal flow)
|
|
803
|
-
* - Summary message (as first message)
|
|
804
|
-
* - Preserved messages (formatted for LLM)
|
|
805
|
-
*
|
|
806
|
-
* Uses the same formatting pipeline as getFormattedMessagesForLLM()
|
|
807
|
-
* but with our virtual history instead of the stored history.
|
|
808
|
-
*
|
|
809
|
-
* @param contributorContext Context for system prompt contributors
|
|
810
|
-
* @returns Formatted messages ready for LLM call, matching getFormattedMessagesForLLM return type
|
|
811
|
-
*/
|
|
812
|
-
async buildMessagesFromVirtualContext(contributorContext) {
|
|
813
|
-
if (!this.virtualContext) {
|
|
814
|
-
throw new Error("buildMessagesFromVirtualContext called without virtual context");
|
|
815
|
-
}
|
|
816
|
-
const { summaryMessage, preservedMessages } = this.virtualContext;
|
|
817
|
-
const systemPrompt = await this.contextManager.getSystemPrompt(contributorContext);
|
|
818
|
-
const virtualHistory = [summaryMessage, ...preservedMessages];
|
|
819
|
-
const formattedMessages = await this.contextManager.getFormattedMessages(
|
|
820
|
-
contributorContext,
|
|
821
|
-
this.llmContext,
|
|
822
|
-
systemPrompt,
|
|
823
|
-
virtualHistory
|
|
824
|
-
);
|
|
825
|
-
return {
|
|
826
|
-
formattedMessages,
|
|
827
|
-
systemPrompt,
|
|
828
|
-
preparedHistory: virtualHistory
|
|
829
|
-
};
|
|
753
|
+
return true;
|
|
830
754
|
}
|
|
831
755
|
/**
|
|
832
756
|
* Set telemetry span attributes for token usage.
|
|
@@ -849,6 +773,10 @@ class TurnExecutor {
|
|
|
849
773
|
activeSpan.setAttribute("gen_ai.usage.reasoning_tokens", usage.reasoningTokens);
|
|
850
774
|
}
|
|
851
775
|
}
|
|
776
|
+
getContextInputTokens(usage) {
|
|
777
|
+
if (usage.inputTokens === void 0) return null;
|
|
778
|
+
return usage.inputTokens + (usage.cacheReadTokens ?? 0) + (usage.cacheWriteTokens ?? 0);
|
|
779
|
+
}
|
|
852
780
|
/**
|
|
853
781
|
* Map provider errors to DextoRuntimeError.
|
|
854
782
|
*/
|
|
@@ -1,23 +1,5 @@
|
|
|
1
|
-
import type { InternalMessage } from '../../context/types.js';
|
|
2
1
|
import { TokenUsage } from '../types.js';
|
|
3
2
|
import { LLMFinishReason } from '../../events/index.js';
|
|
4
|
-
/**
|
|
5
|
-
* Data captured during context compaction for session-native continuation.
|
|
6
|
-
* This is passed through the call chain so the new session can be created
|
|
7
|
-
* with the summary and preserved messages.
|
|
8
|
-
*/
|
|
9
|
-
export interface CompactionData {
|
|
10
|
-
/** The generated summary text */
|
|
11
|
-
summaryText: string;
|
|
12
|
-
/** Messages preserved (not summarized) - typically last N turns */
|
|
13
|
-
preservedMessages: InternalMessage[];
|
|
14
|
-
/** Number of messages that were summarized */
|
|
15
|
-
summarizedCount: number;
|
|
16
|
-
/** Timestamp of first summarized message */
|
|
17
|
-
originalFirstTimestamp?: number;
|
|
18
|
-
/** Timestamp of last summarized message */
|
|
19
|
-
originalLastTimestamp?: number;
|
|
20
|
-
}
|
|
21
3
|
export interface ExecutorResult {
|
|
22
4
|
/**
|
|
23
5
|
* The accumulated text from assistant responses.
|
|
@@ -31,16 +13,6 @@ export interface ExecutorResult {
|
|
|
31
13
|
usage: TokenUsage | null;
|
|
32
14
|
/** Reason the execution finished */
|
|
33
15
|
finishReason: LLMFinishReason;
|
|
34
|
-
/**
|
|
35
|
-
* Set to true if context compaction occurred during this turn.
|
|
36
|
-
* Caller can use this to trigger session-native continuation (create new session).
|
|
37
|
-
*/
|
|
38
|
-
didCompact: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Compaction data when didCompact is true.
|
|
41
|
-
* Contains the summary text and preserved messages for creating the continuation session.
|
|
42
|
-
*/
|
|
43
|
-
compaction?: CompactionData;
|
|
44
16
|
}
|
|
45
17
|
export interface StreamProcessorResult {
|
|
46
18
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/llm/executor/types.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/llm/executor/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,WAAW,cAAc;IAC3B;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACzB,oCAAoC;IACpC,YAAY,EAAE,eAAe,CAAC;CACjC;AAED,MAAM,WAAW,qBAAqB;IAClC;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,eAAe,CAAC;IAC9B,KAAK,EAAE,UAAU,CAAC;CACrB"}
|
|
@@ -178,7 +178,7 @@ class VercelLLMService {
|
|
|
178
178
|
*
|
|
179
179
|
* @param content - String or ContentPart[] (text, images, files)
|
|
180
180
|
* @param options - { signal?: AbortSignal }
|
|
181
|
-
* @returns Object with text response
|
|
181
|
+
* @returns Object with text response
|
|
182
182
|
*/
|
|
183
183
|
async stream(content, options) {
|
|
184
184
|
const activeSpan = import_api.trace.getActiveSpan();
|
|
@@ -209,10 +209,7 @@ class VercelLLMService {
|
|
|
209
209
|
const contributorContext = { mcpManager: this.toolManager.getMcpManager() };
|
|
210
210
|
const result = await executor.execute(contributorContext, true);
|
|
211
211
|
return {
|
|
212
|
-
text: result.text ?? ""
|
|
213
|
-
didCompact: result.didCompact,
|
|
214
|
-
// Use spread to conditionally include compaction (exactOptionalPropertyTypes)
|
|
215
|
-
...result.compaction && { compaction: result.compaction }
|
|
212
|
+
text: result.text ?? ""
|
|
216
213
|
};
|
|
217
214
|
});
|
|
218
215
|
}
|
|
@@ -9,7 +9,6 @@ import type { SessionEventBus } from '../../events/index.js';
|
|
|
9
9
|
import type { IConversationHistoryProvider } from '../../session/history/types.js';
|
|
10
10
|
import type { SystemPromptManager } from '../../systemPrompt/manager.js';
|
|
11
11
|
import type { ValidatedLLMConfig } from '../schemas.js';
|
|
12
|
-
import type { CompactionData } from '../executor/types.js';
|
|
13
12
|
import { MessageQueueService } from '../../session/message-queue.js';
|
|
14
13
|
import type { ResourceManager } from '../../resources/index.js';
|
|
15
14
|
import type { ContentInput } from '../../agent/types.js';
|
|
@@ -55,8 +54,6 @@ export declare class VercelLLMService {
|
|
|
55
54
|
*/
|
|
56
55
|
static StreamResult: {
|
|
57
56
|
text: string;
|
|
58
|
-
didCompact: boolean;
|
|
59
|
-
compaction?: CompactionData;
|
|
60
57
|
};
|
|
61
58
|
/**
|
|
62
59
|
* Stream a response for the given content.
|
|
@@ -64,14 +61,12 @@ export declare class VercelLLMService {
|
|
|
64
61
|
*
|
|
65
62
|
* @param content - String or ContentPart[] (text, images, files)
|
|
66
63
|
* @param options - { signal?: AbortSignal }
|
|
67
|
-
* @returns Object with text response
|
|
64
|
+
* @returns Object with text response
|
|
68
65
|
*/
|
|
69
66
|
stream(content: ContentInput, options?: {
|
|
70
67
|
signal?: AbortSignal;
|
|
71
68
|
}): Promise<{
|
|
72
69
|
text: string;
|
|
73
|
-
didCompact: boolean;
|
|
74
|
-
compaction?: CompactionData;
|
|
75
70
|
}>;
|
|
76
71
|
/**
|
|
77
72
|
* Get configuration information about the LLM service
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vercel.d.ts","sourceRoot":"","sources":["../../../src/llm/services/vercel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAqB,MAAM,IAAI,CAAC;AACtD,OAAO,EAA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AAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GACnC,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAwD5B;;;OAGG;IACH,SAAS,IAAI,gBAAgB;IA+B7B;;OAEG;IACH,iBAAiB,IAAI,cAAc,CAAC,OAAO,CAAC;IAI5C;;OAEG;IACH,eAAe,IAAI,mBAAmB;IAItC;;OAEG;IACH,qBAAqB,IACf,OAAO,mCAAmC,EAAE,mBAAmB,GAC/D,IAAI;CAGb"}
|
|
@@ -115,7 +115,7 @@ class VercelLLMService {
|
|
|
115
115
|
*
|
|
116
116
|
* @param content - String or ContentPart[] (text, images, files)
|
|
117
117
|
* @param options - { signal?: AbortSignal }
|
|
118
|
-
* @returns Object with text response
|
|
118
|
+
* @returns Object with text response
|
|
119
119
|
*/
|
|
120
120
|
async stream(content, options) {
|
|
121
121
|
const activeSpan = trace.getActiveSpan();
|
|
@@ -146,10 +146,7 @@ class VercelLLMService {
|
|
|
146
146
|
const contributorContext = { mcpManager: this.toolManager.getMcpManager() };
|
|
147
147
|
const result = await executor.execute(contributorContext, true);
|
|
148
148
|
return {
|
|
149
|
-
text: result.text ?? ""
|
|
150
|
-
didCompact: result.didCompact,
|
|
151
|
-
// Use spread to conditionally include compaction (exactOptionalPropertyTypes)
|
|
152
|
-
...result.compaction && { compaction: result.compaction }
|
|
149
|
+
text: result.text ?? ""
|
|
153
150
|
};
|
|
154
151
|
});
|
|
155
152
|
}
|
package/dist/logger/logger.cjs
CHANGED
|
@@ -340,6 +340,9 @@ ${import_chalk.default.white(JSON.stringify(args, null, 2))}`,
|
|
|
340
340
|
displayStartupInfo(info) {
|
|
341
341
|
if (this.isSilent) return;
|
|
342
342
|
console.log("");
|
|
343
|
+
if (info.configPath) {
|
|
344
|
+
console.log(`\u{1F4C4} ${import_chalk.default.bold("Config:")} ${import_chalk.default.dim(info.configPath)}`);
|
|
345
|
+
}
|
|
343
346
|
if (info.model && info.provider) {
|
|
344
347
|
console.log(
|
|
345
348
|
`\u{1F916} ${import_chalk.default.bold("Current Model:")} ${import_chalk.default.cyan(info.model)} ${import_chalk.default.dim(`(${info.provider})`)}`
|
|
@@ -375,13 +378,9 @@ ${import_chalk.default.white(JSON.stringify(args, null, 2))}`,
|
|
|
375
378
|
console.log(`\u{1F4AC} ${import_chalk.default.bold("Session:")} ${import_chalk.default.blue(info.sessionId)}`);
|
|
376
379
|
}
|
|
377
380
|
if (info.logLevel && info.logFile) {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
console.log(
|
|
382
|
-
`\u{1F4CB} ${import_chalk.default.bold("Log Level:")} ${import_chalk.default.cyan(info.logLevel)} ${import_chalk.default.dim(`(file: ${info.logFile})`)}`
|
|
383
|
-
);
|
|
384
|
-
}
|
|
381
|
+
console.log(
|
|
382
|
+
`\u{1F4CB} ${import_chalk.default.bold("Log Level:")} ${import_chalk.default.cyan(info.logLevel)} ${import_chalk.default.dim(`(file: ${info.logFile})`)}`
|
|
383
|
+
);
|
|
385
384
|
}
|
|
386
385
|
}
|
|
387
386
|
displayError(message, error) {
|
package/dist/logger/logger.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAwCH,KAAK,UAAU,GACT,OAAO,GACP,KAAK,GACL,OAAO,GACP,QAAQ,GACR,MAAM,GACN,SAAS,GACT,MAAM,GACN,OAAO,GACP,MAAM,GACN,MAAM,GACN,aAAa,GACb,WAAW,GACX,aAAa,GACb,cAAc,GACd,YAAY,GACZ,eAAe,GACf,YAAY,GACZ,aAAa,CAAC;AA2CpB,MAAM,WAAW,aAAa;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO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M,EAAE,CAAA;SAAE,CAAC;QACtD,iBAAiB,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;QAC9C,SAAS,CAAC,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC;QAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;KACpB;IAwDD,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAkB9C;AAGD,eAAO,MAAM,MAAM,QAAe,CAAC"}
|
package/dist/logger/logger.js
CHANGED
|
@@ -307,6 +307,9 @@ ${chalk.white(JSON.stringify(args, null, 2))}`,
|
|
|
307
307
|
displayStartupInfo(info) {
|
|
308
308
|
if (this.isSilent) return;
|
|
309
309
|
console.log("");
|
|
310
|
+
if (info.configPath) {
|
|
311
|
+
console.log(`\u{1F4C4} ${chalk.bold("Config:")} ${chalk.dim(info.configPath)}`);
|
|
312
|
+
}
|
|
310
313
|
if (info.model && info.provider) {
|
|
311
314
|
console.log(
|
|
312
315
|
`\u{1F916} ${chalk.bold("Current Model:")} ${chalk.cyan(info.model)} ${chalk.dim(`(${info.provider})`)}`
|
|
@@ -342,13 +345,9 @@ ${chalk.white(JSON.stringify(args, null, 2))}`,
|
|
|
342
345
|
console.log(`\u{1F4AC} ${chalk.bold("Session:")} ${chalk.blue(info.sessionId)}`);
|
|
343
346
|
}
|
|
344
347
|
if (info.logLevel && info.logFile) {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
console.log(
|
|
349
|
-
`\u{1F4CB} ${chalk.bold("Log Level:")} ${chalk.cyan(info.logLevel)} ${chalk.dim(`(file: ${info.logFile})`)}`
|
|
350
|
-
);
|
|
351
|
-
}
|
|
348
|
+
console.log(
|
|
349
|
+
`\u{1F4CB} ${chalk.bold("Log Level:")} ${chalk.cyan(info.logLevel)} ${chalk.dim(`(file: ${info.logFile})`)}`
|
|
350
|
+
);
|
|
352
351
|
}
|
|
353
352
|
}
|
|
354
353
|
displayError(message, error) {
|