@dexto/core 1.5.2 → 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 (137) hide show
  1. package/dist/agent/DextoAgent.cjs +296 -2
  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 +287 -2
  5. package/dist/agent/schemas.d.ts +93 -21
  6. package/dist/agent/schemas.d.ts.map +1 -1
  7. package/dist/approval/manager.cjs +16 -0
  8. package/dist/approval/manager.d.ts +10 -0
  9. package/dist/approval/manager.d.ts.map +1 -1
  10. package/dist/approval/manager.js +16 -0
  11. package/dist/approval/types.d.ts +11 -0
  12. package/dist/approval/types.d.ts.map +1 -1
  13. package/dist/context/compaction/overflow.cjs +6 -10
  14. package/dist/context/compaction/overflow.d.ts +14 -11
  15. package/dist/context/compaction/overflow.d.ts.map +1 -1
  16. package/dist/context/compaction/overflow.js +6 -10
  17. package/dist/context/compaction/providers/reactive-overflow-provider.cjs +15 -0
  18. package/dist/context/compaction/providers/reactive-overflow-provider.d.ts +15 -0
  19. package/dist/context/compaction/providers/reactive-overflow-provider.d.ts.map +1 -1
  20. package/dist/context/compaction/providers/reactive-overflow-provider.js +15 -0
  21. package/dist/context/compaction/schemas.cjs +22 -2
  22. package/dist/context/compaction/schemas.d.ts +45 -0
  23. package/dist/context/compaction/schemas.d.ts.map +1 -1
  24. package/dist/context/compaction/schemas.js +22 -2
  25. package/dist/context/compaction/strategies/reactive-overflow.cjs +166 -26
  26. package/dist/context/compaction/strategies/reactive-overflow.d.ts +21 -0
  27. package/dist/context/compaction/strategies/reactive-overflow.d.ts.map +1 -1
  28. package/dist/context/compaction/strategies/reactive-overflow.js +166 -26
  29. package/dist/context/manager.cjs +278 -31
  30. package/dist/context/manager.d.ts +192 -5
  31. package/dist/context/manager.d.ts.map +1 -1
  32. package/dist/context/manager.js +285 -32
  33. package/dist/context/types.d.ts +6 -0
  34. package/dist/context/types.d.ts.map +1 -1
  35. package/dist/context/utils.cjs +77 -11
  36. package/dist/context/utils.d.ts +86 -8
  37. package/dist/context/utils.d.ts.map +1 -1
  38. package/dist/context/utils.js +71 -11
  39. package/dist/events/index.cjs +7 -1
  40. package/dist/events/index.d.ts +58 -7
  41. package/dist/events/index.d.ts.map +1 -1
  42. package/dist/events/index.js +7 -1
  43. package/dist/filesystem/filesystem-service.cjs +18 -15
  44. package/dist/filesystem/filesystem-service.d.ts +3 -3
  45. package/dist/filesystem/filesystem-service.d.ts.map +1 -1
  46. package/dist/filesystem/filesystem-service.js +18 -15
  47. package/dist/filesystem/path-validator.cjs +16 -7
  48. package/dist/filesystem/path-validator.d.ts +10 -3
  49. package/dist/filesystem/path-validator.d.ts.map +1 -1
  50. package/dist/filesystem/path-validator.js +16 -7
  51. package/dist/filesystem/types.d.ts +4 -0
  52. package/dist/filesystem/types.d.ts.map +1 -1
  53. package/dist/llm/executor/stream-processor.cjs +19 -1
  54. package/dist/llm/executor/stream-processor.d.ts +3 -0
  55. package/dist/llm/executor/stream-processor.d.ts.map +1 -1
  56. package/dist/llm/executor/stream-processor.js +19 -1
  57. package/dist/llm/executor/turn-executor.cjs +219 -30
  58. package/dist/llm/executor/turn-executor.d.ts +62 -10
  59. package/dist/llm/executor/turn-executor.d.ts.map +1 -1
  60. package/dist/llm/executor/turn-executor.js +219 -30
  61. package/dist/llm/executor/types.d.ts +28 -0
  62. package/dist/llm/executor/types.d.ts.map +1 -1
  63. package/dist/llm/formatters/vercel.cjs +36 -28
  64. package/dist/llm/formatters/vercel.d.ts.map +1 -1
  65. package/dist/llm/formatters/vercel.js +36 -28
  66. package/dist/llm/services/factory.cjs +3 -2
  67. package/dist/llm/services/factory.d.ts +3 -1
  68. package/dist/llm/services/factory.d.ts.map +1 -1
  69. package/dist/llm/services/factory.js +3 -2
  70. package/dist/llm/services/vercel.cjs +34 -6
  71. package/dist/llm/services/vercel.d.ts +23 -3
  72. package/dist/llm/services/vercel.d.ts.map +1 -1
  73. package/dist/llm/services/vercel.js +34 -6
  74. package/dist/logger/v2/schemas.cjs +4 -0
  75. package/dist/logger/v2/schemas.d.ts +16 -0
  76. package/dist/logger/v2/schemas.d.ts.map +1 -1
  77. package/dist/logger/v2/schemas.js +4 -0
  78. package/dist/logger/v2/transport-factory.cjs +4 -1
  79. package/dist/logger/v2/transport-factory.d.ts.map +1 -1
  80. package/dist/logger/v2/transport-factory.js +4 -1
  81. package/dist/logger/v2/transports/silent-transport.cjs +33 -0
  82. package/dist/logger/v2/transports/silent-transport.d.ts +15 -0
  83. package/dist/logger/v2/transports/silent-transport.d.ts.map +1 -0
  84. package/dist/logger/v2/transports/silent-transport.js +10 -0
  85. package/dist/session/chat-session.cjs +20 -11
  86. package/dist/session/chat-session.d.ts +9 -4
  87. package/dist/session/chat-session.d.ts.map +1 -1
  88. package/dist/session/chat-session.js +20 -11
  89. package/dist/session/compaction-service.cjs +139 -0
  90. package/dist/session/compaction-service.d.ts +81 -0
  91. package/dist/session/compaction-service.d.ts.map +1 -0
  92. package/dist/session/compaction-service.js +106 -0
  93. package/dist/session/session-manager.cjs +146 -0
  94. package/dist/session/session-manager.d.ts +50 -0
  95. package/dist/session/session-manager.d.ts.map +1 -1
  96. package/dist/session/session-manager.js +146 -0
  97. package/dist/session/title-generator.cjs +2 -2
  98. package/dist/session/title-generator.js +2 -2
  99. package/dist/systemPrompt/in-built-prompts.cjs +36 -0
  100. package/dist/systemPrompt/in-built-prompts.d.ts +18 -1
  101. package/dist/systemPrompt/in-built-prompts.d.ts.map +1 -1
  102. package/dist/systemPrompt/in-built-prompts.js +25 -0
  103. package/dist/systemPrompt/manager.cjs +22 -0
  104. package/dist/systemPrompt/manager.d.ts +10 -0
  105. package/dist/systemPrompt/manager.d.ts.map +1 -1
  106. package/dist/systemPrompt/manager.js +22 -0
  107. package/dist/systemPrompt/registry.cjs +2 -1
  108. package/dist/systemPrompt/registry.d.ts +1 -1
  109. package/dist/systemPrompt/registry.d.ts.map +1 -1
  110. package/dist/systemPrompt/registry.js +2 -1
  111. package/dist/systemPrompt/schemas.cjs +7 -0
  112. package/dist/systemPrompt/schemas.d.ts +13 -13
  113. package/dist/systemPrompt/schemas.d.ts.map +1 -1
  114. package/dist/systemPrompt/schemas.js +7 -0
  115. package/dist/tools/error-codes.cjs +1 -0
  116. package/dist/tools/error-codes.d.ts +1 -0
  117. package/dist/tools/error-codes.d.ts.map +1 -1
  118. package/dist/tools/error-codes.js +1 -0
  119. package/dist/tools/errors.cjs +17 -0
  120. package/dist/tools/errors.d.ts +9 -0
  121. package/dist/tools/errors.d.ts.map +1 -1
  122. package/dist/tools/errors.js +17 -0
  123. package/dist/tools/internal-tools/provider.cjs +3 -2
  124. package/dist/tools/internal-tools/provider.d.ts +1 -1
  125. package/dist/tools/internal-tools/provider.d.ts.map +1 -1
  126. package/dist/tools/internal-tools/provider.js +3 -2
  127. package/dist/tools/tool-manager.cjs +77 -4
  128. package/dist/tools/tool-manager.d.ts +18 -0
  129. package/dist/tools/tool-manager.d.ts.map +1 -1
  130. package/dist/tools/tool-manager.js +78 -5
  131. package/dist/tools/types.d.ts +5 -3
  132. package/dist/tools/types.d.ts.map +1 -1
  133. package/dist/utils/index.cjs +3 -1
  134. package/dist/utils/index.d.ts +1 -0
  135. package/dist/utils/index.d.ts.map +1 -1
  136. package/dist/utils/index.js +1 -0
  137. package/package.json +1 -1
@@ -92,13 +92,15 @@ class VercelLLMService {
92
92
  resourceManager;
93
93
  messageQueue;
94
94
  compactionStrategy;
95
+ modelLimits;
96
+ compactionThresholdPercent;
95
97
  /**
96
98
  * Helper to extract model ID from LanguageModel union type (string | LanguageModelV2)
97
99
  */
98
100
  getModelId() {
99
101
  return typeof this.model === "string" ? this.model : this.model.modelId;
100
102
  }
101
- constructor(toolManager, model, systemPromptManager, historyProvider, sessionEventBus, config, sessionId, resourceManager, logger, compactionStrategy) {
103
+ constructor(toolManager, model, systemPromptManager, historyProvider, sessionEventBus, config, sessionId, resourceManager, logger, compactionStrategy, compactionConfig) {
102
104
  this.logger = logger.createChild(import_types2.DextoLogComponent.LLM);
103
105
  this.model = model;
104
106
  this.config = config;
@@ -107,9 +109,20 @@ class VercelLLMService {
107
109
  this.sessionId = sessionId;
108
110
  this.resourceManager = resourceManager;
109
111
  this.compactionStrategy = compactionStrategy ?? null;
112
+ this.compactionThresholdPercent = compactionConfig?.thresholdPercent ?? 0.9;
110
113
  this.messageQueue = new import_message_queue.MessageQueueService(this.sessionEventBus, this.logger);
111
114
  const formatter = new import_vercel.VercelMessageFormatter(this.logger);
112
115
  const maxInputTokens = (0, import_registry.getEffectiveMaxInputTokens)(config, this.logger);
116
+ let effectiveContextWindow = maxInputTokens;
117
+ if (compactionConfig?.maxContextTokens !== void 0) {
118
+ effectiveContextWindow = Math.min(maxInputTokens, compactionConfig.maxContextTokens);
119
+ this.logger.debug(
120
+ `Compaction: Using maxContextTokens override: ${compactionConfig.maxContextTokens} (model max: ${maxInputTokens})`
121
+ );
122
+ }
123
+ this.modelLimits = {
124
+ contextWindow: effectiveContextWindow
125
+ };
113
126
  this.contextManager = new import_manager.ContextManager(
114
127
  config,
115
128
  formatter,
@@ -149,19 +162,23 @@ class VercelLLMService {
149
162
  { provider: this.config.provider, model: this.getModelId() },
150
163
  this.logger,
151
164
  this.messageQueue,
152
- void 0,
153
- // modelLimits - TurnExecutor will use defaults
165
+ this.modelLimits,
154
166
  externalSignal,
155
- this.compactionStrategy
167
+ this.compactionStrategy,
168
+ this.compactionThresholdPercent
156
169
  );
157
170
  }
171
+ /**
172
+ * Result from streaming a response.
173
+ */
174
+ static StreamResult;
158
175
  /**
159
176
  * Stream a response for the given content.
160
177
  * Primary method for running conversations with multi-image support.
161
178
  *
162
179
  * @param content - String or ContentPart[] (text, images, files)
163
180
  * @param options - { signal?: AbortSignal }
164
- * @returns The assistant's text response
181
+ * @returns Object with text response, whether compaction occurred, and compaction data if applicable
165
182
  */
166
183
  async stream(content, options) {
167
184
  const activeSpan = import_api.trace.getActiveSpan();
@@ -191,7 +208,12 @@ class VercelLLMService {
191
208
  const executor = this.createTurnExecutor(options?.signal);
192
209
  const contributorContext = { mcpManager: this.toolManager.getMcpManager() };
193
210
  const result = await executor.execute(contributorContext, true);
194
- return result.text ?? "";
211
+ return {
212
+ text: result.text ?? "",
213
+ didCompact: result.didCompact,
214
+ // Use spread to conditionally include compaction (exactOptionalPropertyTypes)
215
+ ...result.compaction && { compaction: result.compaction }
216
+ };
195
217
  });
196
218
  }
197
219
  /**
@@ -236,6 +258,12 @@ class VercelLLMService {
236
258
  getMessageQueue() {
237
259
  return this.messageQueue;
238
260
  }
261
+ /**
262
+ * Get the compaction strategy for external access (e.g., session-native compaction)
263
+ */
264
+ getCompactionStrategy() {
265
+ return this.compactionStrategy;
266
+ }
239
267
  }
240
268
  _init = __decoratorStart(null);
241
269
  VercelLLMService = __decorateElement(_init, 0, "VercelLLMService", _VercelLLMService_decorators, VercelLLMService);
@@ -4,10 +4,12 @@ import { LLMServiceConfig } from './types.js';
4
4
  import type { IDextoLogger } from '../../logger/v2/types.js';
5
5
  import { ToolSet } from '../../tools/types.js';
6
6
  import { ContextManager } from '../../context/manager.js';
7
+ import type { CompactionConfigInput } from '../../context/compaction/schemas.js';
7
8
  import type { SessionEventBus } from '../../events/index.js';
8
9
  import type { IConversationHistoryProvider } from '../../session/history/types.js';
9
10
  import type { SystemPromptManager } from '../../systemPrompt/manager.js';
10
11
  import type { ValidatedLLMConfig } from '../schemas.js';
12
+ import type { CompactionData } from '../executor/types.js';
11
13
  import { MessageQueueService } from '../../session/message-queue.js';
12
14
  import type { ResourceManager } from '../../resources/index.js';
13
15
  import type { ContentInput } from '../../agent/types.js';
@@ -36,27 +38,41 @@ export declare class VercelLLMService {
36
38
  private resourceManager;
37
39
  private messageQueue;
38
40
  private compactionStrategy;
41
+ private modelLimits;
42
+ private compactionThresholdPercent;
39
43
  /**
40
44
  * Helper to extract model ID from LanguageModel union type (string | LanguageModelV2)
41
45
  */
42
46
  private getModelId;
43
- constructor(toolManager: ToolManager, model: LanguageModel, systemPromptManager: SystemPromptManager, historyProvider: IConversationHistoryProvider, sessionEventBus: SessionEventBus, config: ValidatedLLMConfig, sessionId: string, resourceManager: ResourceManager, logger: IDextoLogger, compactionStrategy?: import('../../context/compaction/types.js').ICompactionStrategy | null);
47
+ constructor(toolManager: ToolManager, model: LanguageModel, systemPromptManager: SystemPromptManager, historyProvider: IConversationHistoryProvider, sessionEventBus: SessionEventBus, config: ValidatedLLMConfig, sessionId: string, resourceManager: ResourceManager, logger: IDextoLogger, compactionStrategy?: import('../../context/compaction/types.js').ICompactionStrategy | null, compactionConfig?: CompactionConfigInput);
44
48
  getAllTools(): Promise<ToolSet>;
45
49
  /**
46
50
  * Create a TurnExecutor instance for executing the agent loop.
47
51
  */
48
52
  private createTurnExecutor;
53
+ /**
54
+ * Result from streaming a response.
55
+ */
56
+ static StreamResult: {
57
+ text: string;
58
+ didCompact: boolean;
59
+ compaction?: CompactionData;
60
+ };
49
61
  /**
50
62
  * Stream a response for the given content.
51
63
  * Primary method for running conversations with multi-image support.
52
64
  *
53
65
  * @param content - String or ContentPart[] (text, images, files)
54
66
  * @param options - { signal?: AbortSignal }
55
- * @returns The assistant's text response
67
+ * @returns Object with text response, whether compaction occurred, and compaction data if applicable
56
68
  */
57
69
  stream(content: ContentInput, options?: {
58
70
  signal?: AbortSignal;
59
- }): Promise<string>;
71
+ }): Promise<{
72
+ text: string;
73
+ didCompact: boolean;
74
+ compaction?: CompactionData;
75
+ }>;
60
76
  /**
61
77
  * Get configuration information about the LLM service
62
78
  * @returns Configuration object with provider and model information
@@ -70,5 +86,9 @@ export declare class VercelLLMService {
70
86
  * Get the message queue for external access (e.g., queueing messages while busy)
71
87
  */
72
88
  getMessageQueue(): MessageQueueService;
89
+ /**
90
+ * Get the compaction strategy for external access (e.g., session-native compaction)
91
+ */
92
+ getCompactionStrategy(): import('../../context/compaction/types.js').ICompactionStrategy | null;
73
93
  }
74
94
  //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/B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA0B1B;;OAEG;IACH,OAAc,YAAY,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,cAAc,CAAA;KAAE,CAAC;IAE/F;;;;;;;OAOG;IACG,MAAM,CACR,OAAO,EAAE,YAAY,EACrB,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GACnC,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,cAAc,CAAA;KAAE,CAAC;IA2D9E;;;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"}
@@ -29,13 +29,15 @@ class VercelLLMService {
29
29
  resourceManager;
30
30
  messageQueue;
31
31
  compactionStrategy;
32
+ modelLimits;
33
+ compactionThresholdPercent;
32
34
  /**
33
35
  * Helper to extract model ID from LanguageModel union type (string | LanguageModelV2)
34
36
  */
35
37
  getModelId() {
36
38
  return typeof this.model === "string" ? this.model : this.model.modelId;
37
39
  }
38
- constructor(toolManager, model, systemPromptManager, historyProvider, sessionEventBus, config, sessionId, resourceManager, logger, compactionStrategy) {
40
+ constructor(toolManager, model, systemPromptManager, historyProvider, sessionEventBus, config, sessionId, resourceManager, logger, compactionStrategy, compactionConfig) {
39
41
  this.logger = logger.createChild(DextoLogComponent.LLM);
40
42
  this.model = model;
41
43
  this.config = config;
@@ -44,9 +46,20 @@ class VercelLLMService {
44
46
  this.sessionId = sessionId;
45
47
  this.resourceManager = resourceManager;
46
48
  this.compactionStrategy = compactionStrategy ?? null;
49
+ this.compactionThresholdPercent = compactionConfig?.thresholdPercent ?? 0.9;
47
50
  this.messageQueue = new MessageQueueService(this.sessionEventBus, this.logger);
48
51
  const formatter = new VercelMessageFormatter(this.logger);
49
52
  const maxInputTokens = getEffectiveMaxInputTokens(config, this.logger);
53
+ let effectiveContextWindow = maxInputTokens;
54
+ if (compactionConfig?.maxContextTokens !== void 0) {
55
+ effectiveContextWindow = Math.min(maxInputTokens, compactionConfig.maxContextTokens);
56
+ this.logger.debug(
57
+ `Compaction: Using maxContextTokens override: ${compactionConfig.maxContextTokens} (model max: ${maxInputTokens})`
58
+ );
59
+ }
60
+ this.modelLimits = {
61
+ contextWindow: effectiveContextWindow
62
+ };
50
63
  this.contextManager = new ContextManager(
51
64
  config,
52
65
  formatter,
@@ -86,19 +99,23 @@ class VercelLLMService {
86
99
  { provider: this.config.provider, model: this.getModelId() },
87
100
  this.logger,
88
101
  this.messageQueue,
89
- void 0,
90
- // modelLimits - TurnExecutor will use defaults
102
+ this.modelLimits,
91
103
  externalSignal,
92
- this.compactionStrategy
104
+ this.compactionStrategy,
105
+ this.compactionThresholdPercent
93
106
  );
94
107
  }
108
+ /**
109
+ * Result from streaming a response.
110
+ */
111
+ static StreamResult;
95
112
  /**
96
113
  * Stream a response for the given content.
97
114
  * Primary method for running conversations with multi-image support.
98
115
  *
99
116
  * @param content - String or ContentPart[] (text, images, files)
100
117
  * @param options - { signal?: AbortSignal }
101
- * @returns The assistant's text response
118
+ * @returns Object with text response, whether compaction occurred, and compaction data if applicable
102
119
  */
103
120
  async stream(content, options) {
104
121
  const activeSpan = trace.getActiveSpan();
@@ -128,7 +145,12 @@ class VercelLLMService {
128
145
  const executor = this.createTurnExecutor(options?.signal);
129
146
  const contributorContext = { mcpManager: this.toolManager.getMcpManager() };
130
147
  const result = await executor.execute(contributorContext, true);
131
- return result.text ?? "";
148
+ return {
149
+ text: result.text ?? "",
150
+ didCompact: result.didCompact,
151
+ // Use spread to conditionally include compaction (exactOptionalPropertyTypes)
152
+ ...result.compaction && { compaction: result.compaction }
153
+ };
132
154
  });
133
155
  }
134
156
  /**
@@ -173,6 +195,12 @@ class VercelLLMService {
173
195
  getMessageQueue() {
174
196
  return this.messageQueue;
175
197
  }
198
+ /**
199
+ * Get the compaction strategy for external access (e.g., session-native compaction)
200
+ */
201
+ getCompactionStrategy() {
202
+ return this.compactionStrategy;
203
+ }
176
204
  }
177
205
  _init = __decoratorStart(null);
178
206
  VercelLLMService = __decorateElement(_init, 0, "VercelLLMService", _VercelLLMService_decorators, VercelLLMService);
@@ -23,6 +23,9 @@ __export(schemas_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(schemas_exports);
25
25
  var import_zod = require("zod");
26
+ const SilentTransportSchema = import_zod.z.object({
27
+ type: import_zod.z.literal("silent")
28
+ }).strict().describe("Silent transport that discards all logs (useful for sub-agents)");
26
29
  const ConsoleTransportSchema = import_zod.z.object({
27
30
  type: import_zod.z.literal("console"),
28
31
  colorize: import_zod.z.boolean().default(true).describe("Enable colored output")
@@ -42,6 +45,7 @@ const UpstashTransportSchema = import_zod.z.object({
42
45
  batchSize: import_zod.z.number().int().positive().default(100).describe("Number of log entries to batch before sending (default: 100)")
43
46
  }).strict().describe("Upstash Redis transport for remote logging");
44
47
  const LoggerTransportSchema = import_zod.z.discriminatedUnion("type", [
48
+ SilentTransportSchema,
45
49
  ConsoleTransportSchema,
46
50
  FileTransportSchema,
47
51
  UpstashTransportSchema
@@ -9,6 +9,12 @@ import { z } from 'zod';
9
9
  * Transport configuration (discriminated union)
10
10
  */
11
11
  export declare const LoggerTransportSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
12
+ type: z.ZodLiteral<"silent">;
13
+ }, "strict", z.ZodTypeAny, {
14
+ type: "silent";
15
+ }, {
16
+ type: "silent";
17
+ }>, z.ZodObject<{
12
18
  type: z.ZodLiteral<"console">;
13
19
  colorize: z.ZodDefault<z.ZodBoolean>;
14
20
  }, "strict", z.ZodTypeAny, {
@@ -61,6 +67,12 @@ export type LoggerTransportConfig = z.output<typeof LoggerTransportSchema>;
61
67
  export declare const LoggerConfigSchema: z.ZodObject<{
62
68
  level: z.ZodDefault<z.ZodEnum<["debug", "info", "warn", "error", "silly"]>>;
63
69
  transports: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
70
+ type: z.ZodLiteral<"silent">;
71
+ }, "strict", z.ZodTypeAny, {
72
+ type: "silent";
73
+ }, {
74
+ type: "silent";
75
+ }>, z.ZodObject<{
64
76
  type: z.ZodLiteral<"console">;
65
77
  colorize: z.ZodDefault<z.ZodBoolean>;
66
78
  }, "strict", z.ZodTypeAny, {
@@ -109,6 +121,8 @@ export declare const LoggerConfigSchema: z.ZodObject<{
109
121
  }, "strict", z.ZodTypeAny, {
110
122
  level: "debug" | "info" | "warn" | "error" | "silly";
111
123
  transports: ({
124
+ type: "silent";
125
+ } | {
112
126
  type: "console";
113
127
  colorize: boolean;
114
128
  } | {
@@ -127,6 +141,8 @@ export declare const LoggerConfigSchema: z.ZodObject<{
127
141
  }, {
128
142
  level?: "debug" | "info" | "warn" | "error" | "silly" | undefined;
129
143
  transports?: ({
144
+ type: "silent";
145
+ } | {
130
146
  type: "console";
131
147
  colorize?: boolean | undefined;
132
148
  } | {
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/logger/v2/schemas.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4DxB;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIhC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAamC,CAAC;AAEnE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/logger/v2/schemas.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAsExB;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKhC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAamC,CAAC;AAEnE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
@@ -1,5 +1,8 @@
1
1
  import "../../chunk-PTJYTZNU.js";
2
2
  import { z } from "zod";
3
+ const SilentTransportSchema = z.object({
4
+ type: z.literal("silent")
5
+ }).strict().describe("Silent transport that discards all logs (useful for sub-agents)");
3
6
  const ConsoleTransportSchema = z.object({
4
7
  type: z.literal("console"),
5
8
  colorize: z.boolean().default(true).describe("Enable colored output")
@@ -19,6 +22,7 @@ const UpstashTransportSchema = z.object({
19
22
  batchSize: z.number().int().positive().default(100).describe("Number of log entries to batch before sending (default: 100)")
20
23
  }).strict().describe("Upstash Redis transport for remote logging");
21
24
  const LoggerTransportSchema = z.discriminatedUnion("type", [
25
+ SilentTransportSchema,
22
26
  ConsoleTransportSchema,
23
27
  FileTransportSchema,
24
28
  UpstashTransportSchema
@@ -22,11 +22,14 @@ __export(transport_factory_exports, {
22
22
  createTransports: () => createTransports
23
23
  });
24
24
  module.exports = __toCommonJS(transport_factory_exports);
25
+ var import_silent_transport = require("./transports/silent-transport.js");
25
26
  var import_console_transport = require("./transports/console-transport.js");
26
27
  var import_file_transport = require("./transports/file-transport.js");
27
28
  var import_errors = require("./errors.js");
28
29
  function createTransport(config) {
29
30
  switch (config.type) {
31
+ case "silent":
32
+ return new import_silent_transport.SilentTransport();
30
33
  case "console":
31
34
  return new import_console_transport.ConsoleTransport({
32
35
  colorize: config.colorize
@@ -38,7 +41,7 @@ function createTransport(config) {
38
41
  maxFiles: config.maxFiles
39
42
  });
40
43
  case "upstash":
41
- throw import_errors.LoggerError.transportNotImplemented("upstash", ["console", "file"]);
44
+ throw import_errors.LoggerError.transportNotImplemented("upstash", ["silent", "console", "file"]);
42
45
  default:
43
46
  throw import_errors.LoggerError.unknownTransportType(config.type);
44
47
  }
@@ -1 +1 @@
1
- {"version":3,"file":"transport-factory.d.ts","sourceRoot":"","sources":["../../../src/logger/v2/transport-factory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAK1D;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,gBAAgB,CAqB/E;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,EAAE,GAAG,gBAAgB,EAAE,CAErF"}
1
+ {"version":3,"file":"transport-factory.d.ts","sourceRoot":"","sources":["../../../src/logger/v2/transport-factory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAM1D;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,gBAAgB,CAwB/E;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,EAAE,GAAG,gBAAgB,EAAE,CAErF"}
@@ -1,9 +1,12 @@
1
1
  import "../../chunk-PTJYTZNU.js";
2
+ import { SilentTransport } from "./transports/silent-transport.js";
2
3
  import { ConsoleTransport } from "./transports/console-transport.js";
3
4
  import { FileTransport } from "./transports/file-transport.js";
4
5
  import { LoggerError } from "./errors.js";
5
6
  function createTransport(config) {
6
7
  switch (config.type) {
8
+ case "silent":
9
+ return new SilentTransport();
7
10
  case "console":
8
11
  return new ConsoleTransport({
9
12
  colorize: config.colorize
@@ -15,7 +18,7 @@ function createTransport(config) {
15
18
  maxFiles: config.maxFiles
16
19
  });
17
20
  case "upstash":
18
- throw LoggerError.transportNotImplemented("upstash", ["console", "file"]);
21
+ throw LoggerError.transportNotImplemented("upstash", ["silent", "console", "file"]);
19
22
  default:
20
23
  throw LoggerError.unknownTransportType(config.type);
21
24
  }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var silent_transport_exports = {};
20
+ __export(silent_transport_exports, {
21
+ SilentTransport: () => SilentTransport
22
+ });
23
+ module.exports = __toCommonJS(silent_transport_exports);
24
+ class SilentTransport {
25
+ write(_entry) {
26
+ }
27
+ destroy() {
28
+ }
29
+ }
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ SilentTransport
33
+ });
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Silent Transport
3
+ *
4
+ * A no-op transport that discards all log entries.
5
+ * Used when logging needs to be completely suppressed (e.g., sub-agents).
6
+ */
7
+ import type { ILoggerTransport, LogEntry } from '../types.js';
8
+ /**
9
+ * SilentTransport - Discards all log entries
10
+ */
11
+ export declare class SilentTransport implements ILoggerTransport {
12
+ write(_entry: LogEntry): void;
13
+ destroy(): void;
14
+ }
15
+ //# sourceMappingURL=silent-transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"silent-transport.d.ts","sourceRoot":"","sources":["../../../../src/logger/v2/transports/silent-transport.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE9D;;GAEG;AACH,qBAAa,eAAgB,YAAW,gBAAgB;IACpD,KAAK,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI;IAI7B,OAAO,IAAI,IAAI;CAGlB"}
@@ -0,0 +1,10 @@
1
+ import "../../../chunk-PTJYTZNU.js";
2
+ class SilentTransport {
3
+ write(_entry) {
4
+ }
5
+ destroy() {
6
+ }
7
+ }
8
+ export {
9
+ SilentTransport
10
+ };
@@ -169,8 +169,10 @@ class ChatSession {
169
169
  // Pass ResourceManager for blob storage
170
170
  this.logger,
171
171
  // Pass logger for dependency injection
172
- compactionStrategy
172
+ compactionStrategy,
173
173
  // Pass compaction strategy
174
+ runtimeConfig.compaction
175
+ // Pass compaction config for threshold settings
174
176
  );
175
177
  this.logger.debug(`ChatSession ${this.id}: Services initialized with storage`);
176
178
  }
@@ -210,15 +212,15 @@ class ChatSession {
210
212
  *
211
213
  * @param content - String or ContentPart[] (text, images, files)
212
214
  * @param options - { signal?: AbortSignal }
213
- * @returns Promise that resolves to the AI's response text
215
+ * @returns Promise that resolves to object with text and compaction status
214
216
  *
215
217
  * @example
216
218
  * ```typescript
217
219
  * // Text only
218
- * const response = await session.stream('What is the weather?');
220
+ * const { text, didCompact } = await session.stream('What is the weather?');
219
221
  *
220
222
  * // Multiple images
221
- * const response = await session.stream([
223
+ * const { text, didCompact } = await session.stream([
222
224
  * { type: 'text', text: 'Compare these images' },
223
225
  * { type: 'image', image: base64Data1, mimeType: 'image/png' },
224
226
  * { type: 'image', image: base64Data2, mimeType: 'image/png' }
@@ -275,10 +277,10 @@ class ChatSession {
275
277
  modifiedParts = modifiedParts.filter((p) => p.type !== "text");
276
278
  modifiedParts.unshift({ type: "text", text: modifiedBeforePayload.text });
277
279
  }
278
- const response = await this.llmService.stream(modifiedParts, { signal });
280
+ const streamResult = await this.llmService.stream(modifiedParts, { signal });
279
281
  const llmConfig = this.services.stateManager.getLLMConfig(this.id);
280
282
  const beforeResponsePayload = {
281
- content: response,
283
+ content: streamResult.text,
282
284
  provider: llmConfig.provider,
283
285
  model: llmConfig.model,
284
286
  sessionId: this.id
@@ -295,7 +297,12 @@ class ChatSession {
295
297
  abortSignal: signal
296
298
  }
297
299
  );
298
- return modifiedResponsePayload.content;
300
+ return {
301
+ text: modifiedResponsePayload.content,
302
+ didCompact: streamResult.didCompact,
303
+ // Use spread to conditionally include compaction (exactOptionalPropertyTypes)
304
+ ...streamResult.compaction && { compaction: streamResult.compaction }
305
+ };
299
306
  } catch (error) {
300
307
  const aborted = error instanceof Error && error.name === "AbortError" || typeof error === "object" && error !== null && error.aborted === true;
301
308
  if (aborted) {
@@ -308,12 +315,12 @@ class ChatSession {
308
315
  const history = await this.getHistory();
309
316
  const lastAssistant = history.filter((m) => m.role === "assistant").pop();
310
317
  if (lastAssistant && typeof lastAssistant.content === "string") {
311
- return lastAssistant.content;
318
+ return { text: lastAssistant.content, didCompact: false };
312
319
  }
313
320
  } catch {
314
321
  this.logger.debug("Failed to retrieve partial response from history on cancel");
315
322
  }
316
- return "";
323
+ return { text: "", didCompact: false };
317
324
  }
318
325
  if (error instanceof import_errors.DextoRuntimeError && error.code === import_error_codes.PluginErrorCode.PLUGIN_BLOCKED_EXECUTION && error.scope === import_errors.ErrorScope.PLUGIN && error.type === import_errors.ErrorType.FORBIDDEN) {
319
326
  const textContent = parts.filter((p) => p.type === "text").map((p) => p.text).join("\n");
@@ -327,7 +334,7 @@ class ChatSession {
327
334
  `Failed to save blocked interaction to history: ${saveError instanceof Error ? saveError.message : String(saveError)}`
328
335
  );
329
336
  }
330
- return error.message;
337
+ return { text: error.message, didCompact: false };
331
338
  }
332
339
  this.logger.error(
333
340
  `Error in ChatSession.stream: ${error instanceof Error ? error.message : String(error)}`
@@ -455,8 +462,10 @@ class ChatSession {
455
462
  this.id,
456
463
  this.services.resourceManager,
457
464
  this.logger,
458
- compactionStrategy
465
+ compactionStrategy,
459
466
  // Pass compaction strategy
467
+ runtimeConfig.compaction
468
+ // Pass compaction config for threshold settings
460
469
  );
461
470
  this.llmService = newLLMService;
462
471
  this.logger.info(
@@ -12,6 +12,7 @@ import type { IDextoLogger } from '../logger/v2/types.js';
12
12
  import type { InternalMessage } from '../context/types.js';
13
13
  import type { UserMessageInput } from './message-queue.js';
14
14
  import type { ContentInput } from '../agent/types.js';
15
+ import type { CompactionData } from '../llm/executor/types.js';
15
16
  /**
16
17
  * Represents an isolated conversation session within a Dexto agent.
17
18
  *
@@ -162,15 +163,15 @@ export declare class ChatSession {
162
163
  *
163
164
  * @param content - String or ContentPart[] (text, images, files)
164
165
  * @param options - { signal?: AbortSignal }
165
- * @returns Promise that resolves to the AI's response text
166
+ * @returns Promise that resolves to object with text and compaction status
166
167
  *
167
168
  * @example
168
169
  * ```typescript
169
170
  * // Text only
170
- * const response = await session.stream('What is the weather?');
171
+ * const { text, didCompact } = await session.stream('What is the weather?');
171
172
  *
172
173
  * // Multiple images
173
- * const response = await session.stream([
174
+ * const { text, didCompact } = await session.stream([
174
175
  * { type: 'text', text: 'Compare these images' },
175
176
  * { type: 'image', image: base64Data1, mimeType: 'image/png' },
176
177
  * { type: 'image', image: base64Data2, mimeType: 'image/png' }
@@ -179,7 +180,11 @@ export declare class ChatSession {
179
180
  */
180
181
  stream(content: ContentInput, options?: {
181
182
  signal?: AbortSignal;
182
- }): Promise<string>;
183
+ }): Promise<{
184
+ text: string;
185
+ didCompact: boolean;
186
+ compaction?: CompactionData;
187
+ }>;
183
188
  /**
184
189
  * Combine multiple abort signals into one.
185
190
  */
@@ -1 +1 @@
1
- {"version":3,"file":"chat-session.d.ts","sourceRoot":"","sources":["../../src/session/chat-session.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EACH,eAAe,EACf,aAAa,EAIhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAI1D,OAAO,KAAK,EAAE,eAAe,EAAe,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY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