@codebolt/agent 1.2.1 → 2.2.3

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 (285) hide show
  1. package/README.md +157 -66
  2. package/dist/{agent.js → builderpattern/agent.js} +2 -2
  3. package/dist/{followupquestionbuilder.d.ts → builderpattern/followupquestionbuilder.d.ts} +1 -1
  4. package/dist/{followupquestionbuilder.js → builderpattern/followupquestionbuilder.js} +1 -1
  5. package/dist/{index.d.ts → builderpattern/index.d.ts} +3 -3
  6. package/dist/{llmoutputhandler.d.ts → builderpattern/llmoutputhandler.d.ts} +1 -1
  7. package/dist/{llmoutputhandler.js → builderpattern/llmoutputhandler.js} +7 -7
  8. package/dist/{promptbuilder.d.ts → builderpattern/promptbuilder.d.ts} +3 -3
  9. package/dist/{taskInstruction.d.ts → builderpattern/taskInstruction.d.ts} +2 -2
  10. package/dist/{usermessage.d.ts → builderpattern/usermessage.d.ts} +9 -4
  11. package/dist/composablepattern/agent.d.ts +169 -0
  12. package/dist/composablepattern/agent.js +598 -0
  13. package/dist/composablepattern/codebolt-storage.d.ts +67 -0
  14. package/dist/composablepattern/codebolt-storage.js +320 -0
  15. package/dist/composablepattern/document.d.ts +149 -0
  16. package/dist/composablepattern/document.js +372 -0
  17. package/dist/composablepattern/examples/codebolt-integration-example.d.ts +12 -0
  18. package/dist/composablepattern/examples/codebolt-integration-example.js +218 -0
  19. package/dist/composablepattern/examples/codebolt-storage-example.d.ts +40 -0
  20. package/dist/composablepattern/examples/codebolt-storage-example.js +223 -0
  21. package/dist/composablepattern/examples/custom-steps-example.d.ts +20 -0
  22. package/dist/composablepattern/examples/custom-steps-example.js +455 -0
  23. package/dist/composablepattern/examples/document-agent.d.ts +17 -0
  24. package/dist/composablepattern/examples/document-agent.js +107 -0
  25. package/dist/composablepattern/examples/simple-codebolt-integration.d.ts +8 -0
  26. package/dist/composablepattern/examples/simple-codebolt-integration.js +164 -0
  27. package/dist/composablepattern/examples/weather-agent.d.ts +18 -0
  28. package/dist/composablepattern/examples/weather-agent.js +86 -0
  29. package/dist/composablepattern/examples/workflow-example.d.ts +12 -0
  30. package/dist/composablepattern/examples/workflow-example.js +463 -0
  31. package/dist/composablepattern/index.d.ts +63 -0
  32. package/dist/composablepattern/index.js +115 -0
  33. package/dist/composablepattern/memory.d.ts +89 -0
  34. package/dist/composablepattern/memory.js +141 -0
  35. package/dist/composablepattern/tool.d.ts +84 -0
  36. package/dist/composablepattern/tool.js +260 -0
  37. package/dist/composablepattern/types.d.ts +194 -0
  38. package/dist/composablepattern/types.js +6 -0
  39. package/dist/composablepattern/user-context.d.ts +214 -0
  40. package/dist/composablepattern/user-context.js +275 -0
  41. package/dist/composablepattern/workflow.d.ts +388 -0
  42. package/dist/composablepattern/workflow.js +562 -0
  43. package/dist/local-tools/fileTools.d.ts +26 -0
  44. package/dist/local-tools/fileTools.js +162 -0
  45. package/dist/processor/agent/agentStep.d.ts +49 -0
  46. package/dist/processor/agent/agentStep.js +241 -0
  47. package/dist/processor/agent/toolExecutor.d.ts +19 -0
  48. package/dist/processor/agent/toolExecutor.js +90 -0
  49. package/dist/processor/index.d.ts +7 -0
  50. package/dist/processor/index.js +36 -0
  51. package/dist/processor/messageModifiers/baseMessageModifier.d.ts +20 -0
  52. package/dist/processor/messageModifiers/baseMessageModifier.js +55 -0
  53. package/dist/processor/processors/baseProcessor.d.ts +14 -0
  54. package/dist/processor/processors/baseProcessor.js +29 -0
  55. package/dist/processor/tools/baseTool.d.ts +10 -0
  56. package/dist/processor/tools/baseTool.js +20 -0
  57. package/dist/processor/tools/toolList.d.ts +9 -0
  58. package/dist/processor/tools/toolList.js +22 -0
  59. package/dist/processor/types/interfaces.d.ts +117 -0
  60. package/dist/processor/types/interfaces.js +2 -0
  61. package/dist/processor-pieces/additionalModifiers/argumentProcessorModifier.d.ts +13 -0
  62. package/dist/processor-pieces/additionalModifiers/argumentProcessorModifier.js +68 -0
  63. package/dist/processor-pieces/additionalModifiers/atFileProcessorModifier.d.ts +15 -0
  64. package/dist/processor-pieces/additionalModifiers/atFileProcessorModifier.js +212 -0
  65. package/dist/processor-pieces/additionalModifiers/chatCompressionModifier.d.ts +19 -0
  66. package/dist/processor-pieces/additionalModifiers/chatCompressionModifier.js +110 -0
  67. package/dist/processor-pieces/additionalModifiers/chatRecordingModifier.d.ts +23 -0
  68. package/dist/processor-pieces/additionalModifiers/chatRecordingModifier.js +173 -0
  69. package/dist/processor-pieces/additionalModifiers/coreSystemPromptModifier.d.ts +14 -0
  70. package/dist/processor-pieces/additionalModifiers/coreSystemPromptModifier.js +93 -0
  71. package/dist/processor-pieces/additionalModifiers/directoryContextModifier.d.ts +30 -0
  72. package/dist/processor-pieces/additionalModifiers/directoryContextModifier.js +330 -0
  73. package/dist/processor-pieces/additionalModifiers/environmentContextModifier.d.ts +26 -0
  74. package/dist/processor-pieces/additionalModifiers/environmentContextModifier.js +269 -0
  75. package/dist/processor-pieces/additionalModifiers/fallbackHandlerModifier.d.ts +38 -0
  76. package/dist/processor-pieces/additionalModifiers/fallbackHandlerModifier.js +217 -0
  77. package/dist/processor-pieces/additionalModifiers/ideContextModifier.d.ts +34 -0
  78. package/dist/processor-pieces/additionalModifiers/ideContextModifier.js +147 -0
  79. package/dist/processor-pieces/additionalModifiers/index.d.ts +12 -0
  80. package/dist/processor-pieces/additionalModifiers/index.js +28 -0
  81. package/dist/processor-pieces/additionalModifiers/loopDetectionModifier.d.ts +29 -0
  82. package/dist/processor-pieces/additionalModifiers/loopDetectionModifier.js +155 -0
  83. package/dist/processor-pieces/additionalModifiers/memoryImportModifier.d.ts +15 -0
  84. package/dist/processor-pieces/additionalModifiers/memoryImportModifier.js +129 -0
  85. package/dist/processor-pieces/additionalModifiers/shellProcessorModifier.d.ts +25 -0
  86. package/dist/processor-pieces/additionalModifiers/shellProcessorModifier.js +169 -0
  87. package/dist/processor-pieces/additionalModifiers/toolInjectionModifier.d.ts +20 -0
  88. package/dist/processor-pieces/additionalModifiers/toolInjectionModifier.js +152 -0
  89. package/dist/processor-pieces/base/baseMessageModifier.d.ts +12 -0
  90. package/dist/processor-pieces/base/baseMessageModifier.js +15 -0
  91. package/dist/processor-pieces/base/basePostInferenceProcessor.d.ts +13 -0
  92. package/dist/processor-pieces/base/basePostInferenceProcessor.js +18 -0
  93. package/dist/processor-pieces/base/basePostToolCallProcessor.d.ts +15 -0
  94. package/dist/processor-pieces/base/basePostToolCallProcessor.js +25 -0
  95. package/dist/processor-pieces/base/basePreInferenceProcessor.d.ts +12 -0
  96. package/dist/processor-pieces/base/basePreInferenceProcessor.js +17 -0
  97. package/dist/processor-pieces/base/basePreToolCallProcessor.d.ts +18 -0
  98. package/dist/processor-pieces/base/basePreToolCallProcessor.js +66 -0
  99. package/dist/processor-pieces/base/index.d.ts +9 -0
  100. package/dist/processor-pieces/base/index.js +18 -0
  101. package/dist/processor-pieces/index.d.ts +1 -0
  102. package/dist/processor-pieces/index.js +59 -0
  103. package/dist/processor-pieces/messageModifiers/addCurrentDirectoryRootFilesModifier.d.ts +7 -0
  104. package/dist/processor-pieces/messageModifiers/addCurrentDirectoryRootFilesModifier.js +93 -0
  105. package/dist/processor-pieces/messageModifiers/addToolsListMessageModifier.d.ts +31 -0
  106. package/dist/processor-pieces/messageModifiers/addToolsListMessageModifier.js +145 -0
  107. package/dist/processor-pieces/messageModifiers/advancedSystemInstructionMessageModifier.d.ts +9 -0
  108. package/dist/processor-pieces/messageModifiers/advancedSystemInstructionMessageModifier.js +77 -0
  109. package/dist/processor-pieces/messageModifiers/argumentProcessorModifier.d.ts +13 -0
  110. package/dist/processor-pieces/messageModifiers/argumentProcessorModifier.js +68 -0
  111. package/dist/processor-pieces/messageModifiers/atFileProcessorModifier.d.ts +25 -0
  112. package/dist/processor-pieces/messageModifiers/atFileProcessorModifier.js +453 -0
  113. package/dist/processor-pieces/messageModifiers/baseContextMessageModifier.d.ts +7 -0
  114. package/dist/processor-pieces/messageModifiers/baseContextMessageModifier.js +67 -0
  115. package/dist/processor-pieces/messageModifiers/baseSystemInstructionMessageModifier.d.ts +9 -0
  116. package/dist/processor-pieces/messageModifiers/baseSystemInstructionMessageModifier.js +90 -0
  117. package/dist/processor-pieces/messageModifiers/chatCompressionModifier.d.ts +19 -0
  118. package/dist/processor-pieces/messageModifiers/chatCompressionModifier.js +110 -0
  119. package/dist/processor-pieces/messageModifiers/chatHistoryMessageModifier.d.ts +18 -0
  120. package/dist/processor-pieces/messageModifiers/chatHistoryMessageModifier.example.d.ts +20 -0
  121. package/dist/processor-pieces/messageModifiers/chatHistoryMessageModifier.example.js +124 -0
  122. package/dist/processor-pieces/messageModifiers/chatHistoryMessageModifier.js +104 -0
  123. package/dist/processor-pieces/messageModifiers/chatRecordingModifier.d.ts +23 -0
  124. package/dist/processor-pieces/messageModifiers/chatRecordingModifier.js +173 -0
  125. package/dist/processor-pieces/messageModifiers/coreSystemPromptModifier.d.ts +14 -0
  126. package/dist/processor-pieces/messageModifiers/coreSystemPromptModifier.js +130 -0
  127. package/dist/processor-pieces/messageModifiers/directoryContextModifier.d.ts +36 -0
  128. package/dist/processor-pieces/messageModifiers/directoryContextModifier.js +418 -0
  129. package/dist/processor-pieces/messageModifiers/environmentContext.d.ts +41 -0
  130. package/dist/processor-pieces/messageModifiers/environmentContext.js +355 -0
  131. package/dist/processor-pieces/messageModifiers/environmentContextModifier.d.ts +26 -0
  132. package/dist/processor-pieces/messageModifiers/environmentContextModifier.js +260 -0
  133. package/dist/processor-pieces/messageModifiers/handleUrlMessageModifier.d.ts +13 -0
  134. package/dist/processor-pieces/messageModifiers/handleUrlMessageModifier.js +59 -0
  135. package/dist/processor-pieces/messageModifiers/ideContextModifier.d.ts +34 -0
  136. package/dist/processor-pieces/messageModifiers/ideContextModifier.js +157 -0
  137. package/dist/processor-pieces/messageModifiers/imageAttachmentMessageModifier.d.ts +19 -0
  138. package/dist/processor-pieces/messageModifiers/imageAttachmentMessageModifier.js +221 -0
  139. package/dist/processor-pieces/messageModifiers/index.d.ts +11 -0
  140. package/dist/processor-pieces/messageModifiers/index.js +26 -0
  141. package/dist/processor-pieces/messageModifiers/memoryImportModifier.d.ts +15 -0
  142. package/dist/processor-pieces/messageModifiers/memoryImportModifier.js +129 -0
  143. package/dist/processor-pieces/messageModifiers/mentionedFilesModifier.d.ts +23 -0
  144. package/dist/processor-pieces/messageModifiers/mentionedFilesModifier.js +207 -0
  145. package/dist/processor-pieces/messageModifiers/simpleMessageModifier.d.ts +7 -0
  146. package/dist/processor-pieces/messageModifiers/simpleMessageModifier.js +26 -0
  147. package/dist/processor-pieces/messageModifiers/toolInjectionModifier.d.ts +20 -0
  148. package/dist/processor-pieces/messageModifiers/toolInjectionModifier.js +152 -0
  149. package/dist/processor-pieces/messageModifiers/workingDirectoryMessageModifier.d.ts +38 -0
  150. package/dist/processor-pieces/messageModifiers/workingDirectoryMessageModifier.js +392 -0
  151. package/dist/processor-pieces/postInference/llmOutputValidityProcessor.d.ts +1 -0
  152. package/dist/processor-pieces/postInference/llmOutputValidityProcessor.js +2 -0
  153. package/dist/processor-pieces/postInferenceProcessors/checkForNoToolCall.d.ts +7 -0
  154. package/dist/processor-pieces/postInferenceProcessors/checkForNoToolCall.js +24 -0
  155. package/dist/processor-pieces/postInferenceProcessors/loopDetectionModifier.d.ts +29 -0
  156. package/dist/processor-pieces/postInferenceProcessors/loopDetectionModifier.js +174 -0
  157. package/dist/processor-pieces/postToolCall/advancedLoopDetectionProcessor.d.ts +41 -0
  158. package/dist/processor-pieces/postToolCall/advancedLoopDetectionProcessor.js +197 -0
  159. package/dist/processor-pieces/postToolCall/chatCompressionProcessor.d.ts +26 -0
  160. package/dist/processor-pieces/postToolCall/chatCompressionProcessor.js +90 -0
  161. package/dist/processor-pieces/postToolCall/chatRecordingProcessor.d.ts +81 -0
  162. package/dist/processor-pieces/postToolCall/chatRecordingProcessor.js +329 -0
  163. package/dist/processor-pieces/postToolCall/contextManagementProcessor.d.ts +40 -0
  164. package/dist/processor-pieces/postToolCall/contextManagementProcessor.js +272 -0
  165. package/dist/processor-pieces/postToolCall/conversationCompactorProcessor.d.ts +49 -0
  166. package/dist/processor-pieces/postToolCall/conversationCompactorProcessor.js +291 -0
  167. package/dist/processor-pieces/postToolCall/conversationContinuityProcessor.d.ts +49 -0
  168. package/dist/processor-pieces/postToolCall/conversationContinuityProcessor.js +293 -0
  169. package/dist/processor-pieces/postToolCall/followUpConversationProcessor.d.ts +47 -0
  170. package/dist/processor-pieces/postToolCall/followUpConversationProcessor.js +249 -0
  171. package/dist/processor-pieces/postToolCall/loopDetectionProcessor.d.ts +30 -0
  172. package/dist/processor-pieces/postToolCall/loopDetectionProcessor.js +137 -0
  173. package/dist/processor-pieces/postToolCall/responseValidationProcessor.d.ts +30 -0
  174. package/dist/processor-pieces/postToolCall/responseValidationProcessor.js +228 -0
  175. package/dist/processor-pieces/postToolCall/telemetryProcessor.d.ts +99 -0
  176. package/dist/processor-pieces/postToolCall/telemetryProcessor.js +278 -0
  177. package/dist/processor-pieces/postToolCall/tokenManagementProcessor.d.ts +37 -0
  178. package/dist/processor-pieces/postToolCall/tokenManagementProcessor.js +178 -0
  179. package/dist/processor-pieces/postToolCall/toolExecutionProcessor.d.ts +43 -0
  180. package/dist/processor-pieces/postToolCall/toolExecutionProcessor.js +207 -0
  181. package/dist/processor-pieces/postToolCallProcessors/index.d.ts +1 -0
  182. package/dist/processor-pieces/postToolCallProcessors/index.js +2 -0
  183. package/dist/processor-pieces/postToolCallProcessors/shellProcessorModifier.d.ts +25 -0
  184. package/dist/processor-pieces/postToolCallProcessors/shellProcessorModifier.js +225 -0
  185. package/dist/processor-pieces/preInference/conversationCompactorProcessor.d.ts +52 -0
  186. package/dist/processor-pieces/preInference/conversationCompactorProcessor.js +264 -0
  187. package/dist/processor-pieces/preInference/conversationContinuityProcessor.d.ts +49 -0
  188. package/dist/processor-pieces/preInference/conversationContinuityProcessor.js +293 -0
  189. package/dist/processor-pieces/preInferenceProcessors/chatCompressionModifier.d.ts +35 -0
  190. package/dist/processor-pieces/preInferenceProcessors/chatCompressionModifier.js +255 -0
  191. package/dist/processor-pieces/preInferenceProcessors/conversationCompaction.d.ts +7 -0
  192. package/dist/processor-pieces/preInferenceProcessors/conversationCompaction.js +31 -0
  193. package/dist/processor-pieces/preInferenceProcessors/index.d.ts +1 -0
  194. package/dist/processor-pieces/preInferenceProcessors/index.js +2 -0
  195. package/dist/processor-pieces/preToolCall/index.d.ts +9 -0
  196. package/dist/processor-pieces/preToolCall/index.js +18 -0
  197. package/dist/processor-pieces/preToolCall/localToolInterceptorProcessor.d.ts +58 -0
  198. package/dist/processor-pieces/preToolCall/localToolInterceptorProcessor.js +444 -0
  199. package/dist/processor-pieces/preToolCall/toolParameterModifierProcessor.d.ts +44 -0
  200. package/dist/processor-pieces/preToolCall/toolParameterModifierProcessor.js +367 -0
  201. package/dist/processor-pieces/preToolCall/toolValidationProcessor.d.ts +58 -0
  202. package/dist/processor-pieces/preToolCall/toolValidationProcessor.js +391 -0
  203. package/dist/processor-pieces/pretoolCallProcessors/index.d.ts +1 -0
  204. package/dist/processor-pieces/pretoolCallProcessors/index.js +2 -0
  205. package/dist/processor-pieces/processors/advancedLoopDetectionProcessor.d.ts +41 -0
  206. package/dist/processor-pieces/processors/advancedLoopDetectionProcessor.js +197 -0
  207. package/dist/processor-pieces/processors/chatCompressionProcessor.d.ts +26 -0
  208. package/dist/processor-pieces/processors/chatCompressionProcessor.js +90 -0
  209. package/dist/processor-pieces/processors/chatRecordingProcessor.d.ts +81 -0
  210. package/dist/processor-pieces/processors/chatRecordingProcessor.js +329 -0
  211. package/dist/processor-pieces/processors/contextManagementProcessor.d.ts +40 -0
  212. package/dist/processor-pieces/processors/contextManagementProcessor.js +305 -0
  213. package/dist/processor-pieces/processors/loopDetectionProcessor.d.ts +30 -0
  214. package/dist/processor-pieces/processors/loopDetectionProcessor.js +137 -0
  215. package/dist/processor-pieces/processors/responseValidationProcessor.d.ts +30 -0
  216. package/dist/processor-pieces/processors/responseValidationProcessor.js +228 -0
  217. package/dist/processor-pieces/processors/telemetryProcessor.d.ts +99 -0
  218. package/dist/processor-pieces/processors/telemetryProcessor.js +311 -0
  219. package/dist/processor-pieces/processors/tokenManagementProcessor.d.ts +37 -0
  220. package/dist/processor-pieces/processors/tokenManagementProcessor.js +178 -0
  221. package/dist/processor-pieces/processors/toolExecutionProcessor.d.ts +43 -0
  222. package/dist/processor-pieces/processors/toolExecutionProcessor.js +207 -0
  223. package/dist/processor-pieces/tools/fileTools.d.ts +26 -0
  224. package/dist/processor-pieces/tools/fileTools.js +162 -0
  225. package/dist/processor-pieces/utils/messageModifierHelper.d.ts +4 -0
  226. package/dist/processor-pieces/utils/messageModifierHelper.js +58 -0
  227. package/dist/types/commonTypes.d.ts +4 -0
  228. package/dist/types/processorTypes.d.ts +67 -0
  229. package/dist/types/processorTypes.js +58 -0
  230. package/dist/unified/agent/agent.d.ts +17 -0
  231. package/dist/unified/agent/agent.js +79 -0
  232. package/dist/unified/agent/team.d.ts +2 -0
  233. package/dist/unified/agent/team.js +6 -0
  234. package/dist/unified/agent/tool.d.ts +99 -0
  235. package/dist/unified/agent/tool.js +440 -0
  236. package/dist/unified/agent/tools.d.ts +44 -0
  237. package/dist/unified/agent/tools.js +487 -0
  238. package/dist/unified/agent/workflow.d.ts +24 -0
  239. package/dist/unified/agent/workflow.js +275 -0
  240. package/dist/unified/agent/workflowControls.d.ts +11 -0
  241. package/dist/unified/agent/workflowControls.js +20 -0
  242. package/dist/unified/agent/workflowSteps.d.ts +63 -0
  243. package/dist/unified/agent/workflowSteps.js +284 -0
  244. package/dist/unified/base/agentStep.d.ts +32 -0
  245. package/dist/unified/base/agentStep.js +96 -0
  246. package/dist/unified/base/create/createInitialPromptGenerators.d.ts +5 -0
  247. package/dist/unified/base/create/createInitialPromptGenerators.js +17 -0
  248. package/dist/unified/base/index.d.ts +5 -0
  249. package/dist/unified/base/index.js +13 -0
  250. package/dist/unified/base/initialPromptGenerator.d.ts +48 -0
  251. package/dist/unified/base/initialPromptGenerator.js +118 -0
  252. package/dist/unified/base/responseExecutor.d.ts +36 -0
  253. package/dist/unified/base/responseExecutor.js +283 -0
  254. package/dist/unified/examples/agentExample.d.ts +46 -0
  255. package/dist/unified/examples/agentExample.js +464 -0
  256. package/dist/unified/examples/documentationPatternExample.d.ts +10 -0
  257. package/dist/unified/examples/documentationPatternExample.js +385 -0
  258. package/dist/unified/examples/followUpProcessorsExample.d.ts +45 -0
  259. package/dist/unified/examples/followUpProcessorsExample.js +311 -0
  260. package/dist/unified/examples/orchestratorExample.d.ts +16 -0
  261. package/dist/unified/examples/orchestratorExample.js +415 -0
  262. package/dist/unified/examples/preToolCallProcessorsExample.d.ts +36 -0
  263. package/dist/unified/examples/preToolCallProcessorsExample.js +458 -0
  264. package/dist/unified/examples/workflowExample.d.ts +12 -0
  265. package/dist/unified/examples/workflowExample.js +497 -0
  266. package/dist/unified/index.d.ts +18 -0
  267. package/dist/unified/index.js +42 -0
  268. package/dist/unified/orchestrator/orchestrator.d.ts +260 -0
  269. package/dist/unified/orchestrator/orchestrator.js +519 -0
  270. package/dist/unified/team/team.d.ts +1 -0
  271. package/dist/unified/team/team.js +2 -0
  272. package/dist/unified/types/libTypes.d.ts +378 -0
  273. package/dist/unified/types/libTypes.js +6 -0
  274. package/dist/unified/types/types.d.ts +212 -0
  275. package/dist/unified/types/types.js +43 -0
  276. package/dist/unified/utils/utils.d.ts +40 -0
  277. package/dist/unified/utils/utils.js +219 -0
  278. package/package.json +35 -13
  279. /package/dist/{agent.d.ts → builderpattern/agent.d.ts} +0 -0
  280. /package/dist/{index.js → builderpattern/index.js} +0 -0
  281. /package/dist/{promptbuilder.js → builderpattern/promptbuilder.js} +0 -0
  282. /package/dist/{systemprompt.d.ts → builderpattern/systemprompt.d.ts} +0 -0
  283. /package/dist/{systemprompt.js → builderpattern/systemprompt.js} +0 -0
  284. /package/dist/{taskInstruction.js → builderpattern/taskInstruction.js} +0 -0
  285. /package/dist/{usermessage.js → builderpattern/usermessage.js} +0 -0
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChatCompressionModifier = void 0;
4
+ const base_1 = require("../base");
5
+ class ChatCompressionModifier extends base_1.BaseMessageModifier {
6
+ constructor(options = {}) {
7
+ super();
8
+ this.hasFailedCompressionAttempt = false;
9
+ this.options = {
10
+ tokenThreshold: options.tokenThreshold || 8000, // Approximate token threshold
11
+ compressionRatio: options.compressionRatio || 0.5, // Compress to 50% of original
12
+ preserveRecentMessages: options.preserveRecentMessages || 5,
13
+ enableCompression: options.enableCompression !== false
14
+ };
15
+ }
16
+ async modify(originalRequest, createdMessage) {
17
+ try {
18
+ if (!this.options.enableCompression || this.hasFailedCompressionAttempt) {
19
+ return createdMessage;
20
+ }
21
+ const messages = createdMessage.message.messages;
22
+ // Skip compression if we don't have enough messages
23
+ if (messages.length <= this.options.preserveRecentMessages) {
24
+ return createdMessage;
25
+ }
26
+ const shouldCompress = await this.shouldCompressChat(messages);
27
+ if (!shouldCompress) {
28
+ return createdMessage;
29
+ }
30
+ const compressedMessages = await this.compressMessages(messages);
31
+ return Promise.resolve({
32
+ message: {
33
+ ...createdMessage.message,
34
+ messages: compressedMessages
35
+ },
36
+ metadata: {
37
+ ...createdMessage.metadata,
38
+ chatCompressed: true,
39
+ originalMessageCount: messages.length,
40
+ compressedMessageCount: compressedMessages.length
41
+ }
42
+ });
43
+ }
44
+ catch (error) {
45
+ console.error('Error in ChatCompressionModifier:', error);
46
+ this.hasFailedCompressionAttempt = true;
47
+ return createdMessage;
48
+ }
49
+ }
50
+ async shouldCompressChat(messages) {
51
+ // Estimate token count (rough approximation: 4 characters per token)
52
+ const totalCharacters = messages.reduce((sum, msg) => {
53
+ return sum + (typeof msg.content === 'string' ? msg.content.length : JSON.stringify(msg.content).length);
54
+ }, 0);
55
+ const estimatedTokens = totalCharacters / 4;
56
+ return estimatedTokens > this.options.tokenThreshold;
57
+ }
58
+ async compressMessages(messages) {
59
+ const preserveCount = this.options.preserveRecentMessages;
60
+ const recentMessages = messages.slice(-preserveCount);
61
+ const messagesToCompress = messages.slice(0, -preserveCount);
62
+ if (messagesToCompress.length === 0) {
63
+ return messages;
64
+ }
65
+ // Create a summary of the messages to compress
66
+ const conversationSummary = this.createConversationSummary(messagesToCompress);
67
+ const compressionMessage = {
68
+ role: 'system',
69
+ content: `[Conversation Summary - Previous ${messagesToCompress.length} messages compressed]
70
+
71
+ ${conversationSummary}
72
+
73
+ [End of Summary - Continuing with recent conversation...]`
74
+ };
75
+ return [compressionMessage, ...recentMessages];
76
+ }
77
+ createConversationSummary(messages) {
78
+ const summaryParts = [];
79
+ let currentTopic = '';
80
+ let userQuestions = [];
81
+ let assistantResponses = [];
82
+ for (const message of messages) {
83
+ const content = typeof message.content === 'string' ? message.content : JSON.stringify(message.content);
84
+ if (message.role === 'user') {
85
+ // Extract key questions or requests
86
+ if (content.length > 20) { // Only include substantial messages
87
+ userQuestions.push(content.substring(0, 100) + (content.length > 100 ? '...' : ''));
88
+ }
89
+ }
90
+ else if (message.role === 'assistant') {
91
+ // Extract key responses or actions
92
+ if (content.length > 20) {
93
+ assistantResponses.push(content.substring(0, 100) + (content.length > 100 ? '...' : ''));
94
+ }
95
+ }
96
+ }
97
+ if (userQuestions.length > 0) {
98
+ summaryParts.push(`Key user requests: ${userQuestions.slice(0, 3).join('; ')}`);
99
+ }
100
+ if (assistantResponses.length > 0) {
101
+ summaryParts.push(`Key assistant actions: ${assistantResponses.slice(0, 3).join('; ')}`);
102
+ }
103
+ summaryParts.push(`Total messages compressed: ${messages.length}`);
104
+ return summaryParts.join('\n');
105
+ }
106
+ resetCompressionState() {
107
+ this.hasFailedCompressionAttempt = false;
108
+ }
109
+ }
110
+ exports.ChatCompressionModifier = ChatCompressionModifier;
@@ -0,0 +1,18 @@
1
+ import { ProcessedMessage } from "@codebolt/types/agent";
2
+ import { BaseMessageModifier } from "../base";
3
+ import { FlatUserMessage } from "@codebolt/types/sdk";
4
+ export interface ChatHistoryMessageModifierOptions {
5
+ enableChatHistory?: boolean;
6
+ maxHistoryMessages?: number;
7
+ includeSystemMessages?: boolean;
8
+ [key: string]: unknown;
9
+ }
10
+ export declare class ChatHistoryMessageModifier extends BaseMessageModifier {
11
+ private readonly enableChatHistory;
12
+ private readonly maxHistoryMessages;
13
+ private readonly includeSystemMessages;
14
+ constructor(options?: ChatHistoryMessageModifierOptions);
15
+ modify(originalRequest: FlatUserMessage, createdMessage: ProcessedMessage): Promise<ProcessedMessage>;
16
+ private getChatHistory;
17
+ setMaxHistoryMessages(max: number): void;
18
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Example usage of ChatHistoryMessageModifier
3
+ *
4
+ * This file demonstrates how to integrate chat history into your agent's message processing pipeline.
5
+ */
6
+ import { InitialPromptGenerator } from '@codebolt/agent/unified';
7
+ import { FlatUserMessage } from '@codebolt/types/sdk';
8
+ export declare function createBasicChatHistoryAgent(): InitialPromptGenerator;
9
+ export declare function createCompactChatHistoryAgent(): InitialPromptGenerator;
10
+ export declare function createThreadAwareChatHistoryAgent(): InitialPromptGenerator;
11
+ export declare function processMessageWithHistory(userMessage: FlatUserMessage): Promise<import("@codebolt/types/agent").ProcessedMessage>;
12
+ export declare const chatHistoryOptions: {
13
+ enableChatHistory: boolean;
14
+ maxHistoryMessages: number;
15
+ includeSystemMessages: boolean;
16
+ historyContextLabel: string;
17
+ filterByThreadId: boolean;
18
+ includeTimestamps: boolean;
19
+ compactFormat: boolean;
20
+ };
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ /**
3
+ * Example usage of ChatHistoryMessageModifier
4
+ *
5
+ * This file demonstrates how to integrate chat history into your agent's message processing pipeline.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.chatHistoryOptions = void 0;
9
+ exports.createBasicChatHistoryAgent = createBasicChatHistoryAgent;
10
+ exports.createCompactChatHistoryAgent = createCompactChatHistoryAgent;
11
+ exports.createThreadAwareChatHistoryAgent = createThreadAwareChatHistoryAgent;
12
+ exports.processMessageWithHistory = processMessageWithHistory;
13
+ const chatHistoryMessageModifier_1 = require("./chatHistoryMessageModifier");
14
+ const unified_1 = require("@codebolt/agent/unified");
15
+ // Example 1: Basic chat history integration
16
+ function createBasicChatHistoryAgent() {
17
+ return new unified_1.InitialPromptGenerator({
18
+ processors: [
19
+ // Add chat history before other processors
20
+ new chatHistoryMessageModifier_1.ChatHistoryMessageModifier({
21
+ enableChatHistory: true,
22
+ maxHistoryMessages: 5,
23
+ includeTimestamps: true,
24
+ compactFormat: false
25
+ }),
26
+ // ... other processors like system prompts, tools, etc.
27
+ ],
28
+ baseSystemPrompt: "You are a helpful assistant."
29
+ });
30
+ }
31
+ // Example 2: Compact chat history for token efficiency
32
+ function createCompactChatHistoryAgent() {
33
+ return new unified_1.InitialPromptGenerator({
34
+ processors: [
35
+ new chatHistoryMessageModifier_1.ChatHistoryMessageModifier({
36
+ enableChatHistory: true,
37
+ maxHistoryMessages: 10,
38
+ includeTimestamps: false,
39
+ compactFormat: true,
40
+ includeSystemMessages: false,
41
+ historyContextLabel: "Previous Conversation"
42
+ }),
43
+ ],
44
+ baseSystemPrompt: "You are a helpful assistant."
45
+ });
46
+ }
47
+ // Example 3: Thread-specific chat history (when API supports it)
48
+ function createThreadAwareChatHistoryAgent() {
49
+ return new unified_1.InitialPromptGenerator({
50
+ processors: [
51
+ new chatHistoryMessageModifier_1.ChatHistoryMessageModifier({
52
+ enableChatHistory: true,
53
+ maxHistoryMessages: 8,
54
+ filterByThreadId: true, // Filter by thread ID when supported
55
+ includeTimestamps: true,
56
+ compactFormat: false,
57
+ historyContextLabel: "Thread History"
58
+ }),
59
+ ],
60
+ baseSystemPrompt: "You are a helpful assistant."
61
+ });
62
+ }
63
+ // Example 4: Usage in a real agent scenario
64
+ async function processMessageWithHistory(userMessage) {
65
+ const promptGenerator = new unified_1.InitialPromptGenerator({
66
+ processors: [
67
+ // Chat history comes first to provide context
68
+ new chatHistoryMessageModifier_1.ChatHistoryMessageModifier({
69
+ enableChatHistory: true,
70
+ maxHistoryMessages: 5,
71
+ includeTimestamps: false,
72
+ compactFormat: true
73
+ }),
74
+ // Add other processors after history
75
+ // new EnvironmentContextModifier(),
76
+ // new CoreSystemPromptModifier({ systemPrompt: "..." }),
77
+ // new ToolInjectionModifier(),
78
+ ],
79
+ baseSystemPrompt: "You are a helpful AI assistant."
80
+ });
81
+ try {
82
+ const processedMessage = await promptGenerator.processMessage(userMessage);
83
+ console.log('Message processed with chat history context');
84
+ return processedMessage;
85
+ }
86
+ catch (error) {
87
+ console.error('Error processing message with history:', error);
88
+ throw error;
89
+ }
90
+ }
91
+ // Example 5: Configuration options explained
92
+ exports.chatHistoryOptions = {
93
+ // Enable/disable chat history entirely
94
+ enableChatHistory: true,
95
+ // Maximum number of previous messages to include
96
+ maxHistoryMessages: 10,
97
+ // Include system messages in history
98
+ includeSystemMessages: false,
99
+ // Custom label for the history section
100
+ historyContextLabel: "Previous Conversation",
101
+ // Filter by thread ID (when API supports it)
102
+ filterByThreadId: true,
103
+ // Include timestamps with messages
104
+ includeTimestamps: true,
105
+ // Use compact format to save tokens
106
+ compactFormat: false
107
+ };
108
+ // Example output format:
109
+ /*
110
+ === Chat History ===
111
+ Thread ID: 6536c82f-c7d1-4dbd-8e68-c90f7ef5ebc3
112
+ Recent 3 messages:
113
+
114
+ **User (2025-01-15 10:30:15):**
115
+ Can you help me with my React component?
116
+
117
+ **Assistant (2025-01-15 10:30:45):**
118
+ Of course! I'd be happy to help you with your React component. Could you please share the code or describe what specific issue you're facing?
119
+
120
+ **User (2025-01-15 10:31:20):**
121
+ I'm having trouble with state management in my component.
122
+
123
+ === End Chat History ===
124
+ */
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ChatHistoryMessageModifier = void 0;
7
+ const base_1 = require("../base");
8
+ const codeboltjs_1 = __importDefault(require("@codebolt/codeboltjs"));
9
+ // Using MessageObject from SDK types for chat history messages
10
+ class ChatHistoryMessageModifier extends base_1.BaseMessageModifier {
11
+ constructor(options = {}) {
12
+ super({ context: options });
13
+ this.enableChatHistory = options.enableChatHistory !== false;
14
+ this.maxHistoryMessages = options.maxHistoryMessages || 20;
15
+ this.includeSystemMessages = options.includeSystemMessages !== false;
16
+ }
17
+ async modify(originalRequest, createdMessage) {
18
+ try {
19
+ if (!this.enableChatHistory) {
20
+ return createdMessage;
21
+ }
22
+ // Get chat history using the thread ID from the original request
23
+ const chatHistory = await this.getChatHistory(originalRequest.threadId);
24
+ if (!chatHistory || chatHistory.length === 0) {
25
+ return createdMessage;
26
+ }
27
+ // Directly use the chat history messages - they're already in MessageObject format
28
+ return {
29
+ message: {
30
+ ...createdMessage.message,
31
+ messages: [...chatHistory, ...createdMessage.message.messages]
32
+ },
33
+ metadata: {
34
+ ...createdMessage.metadata,
35
+ chatHistoryAdded: true,
36
+ chatHistoryCount: chatHistory.length,
37
+ threadId: originalRequest.threadId
38
+ }
39
+ };
40
+ }
41
+ catch (error) {
42
+ console.error('Error in ChatHistoryMessageModifier:', error);
43
+ // Return original message if chat history fails to avoid breaking the flow
44
+ return createdMessage;
45
+ }
46
+ }
47
+ async getChatHistory(threadId) {
48
+ var _a, _b, _c, _d;
49
+ try {
50
+ const response = await codeboltjs_1.default.chat.getChatHistory(threadId);
51
+ // Check if response has messages array
52
+ if (!(response === null || response === void 0 ? void 0 : response.chats) || !((_a = response === null || response === void 0 ? void 0 : response.chats) === null || _a === void 0 ? void 0 : _a.messages) || !Array.isArray((_b = response === null || response === void 0 ? void 0 : response.chats) === null || _b === void 0 ? void 0 : _b.messages) || ((_c = response === null || response === void 0 ? void 0 : response.chats) === null || _c === void 0 ? void 0 : _c.messages.length) === 0) {
53
+ return [];
54
+ }
55
+ let historyMessages = (_d = response === null || response === void 0 ? void 0 : response.chats) === null || _d === void 0 ? void 0 : _d.messages;
56
+ // Thread filtering is now handled by the API directly via threadId parameter
57
+ // Filter out system messages if not included
58
+ if (!this.includeSystemMessages) {
59
+ historyMessages = historyMessages.filter((msg) => msg.role !== 'system');
60
+ }
61
+ // Limit the number of messages
62
+ // will do it later
63
+ if (false) {
64
+ historyMessages = historyMessages.slice(-this.maxHistoryMessages);
65
+ }
66
+ // Check if the last message is an assistant message with tool_calls
67
+ // If so, add tool response messages for each tool_call
68
+ const lastMessage = historyMessages[historyMessages.length - 1];
69
+ if (lastMessage &&
70
+ lastMessage.role === 'assistant' &&
71
+ lastMessage.tool_calls &&
72
+ Array.isArray(lastMessage.tool_calls) &&
73
+ lastMessage.tool_calls.length > 0) {
74
+ // Add tool response messages for each tool_call
75
+ const toolResponseMessages = [];
76
+ for (const toolCall of lastMessage.tool_calls) {
77
+ toolResponseMessages.push({
78
+ role: 'tool',
79
+ content: `Tool call "${toolCall.function.name}" was not executed. This appears to be from a previous incomplete conversation. The tool was called with arguments: ${toolCall.function.arguments}`,
80
+ tool_call_id: toolCall.id
81
+ });
82
+ }
83
+ // Return original messages + tool responses + context message
84
+ return [...historyMessages, ...toolResponseMessages];
85
+ }
86
+ // Add a system message to indicate this is previous conversation
87
+ const contextMessage = {
88
+ role: 'user',
89
+ content: '--- End of previous conversation history ---\n\nThe above messages are from a previous conversation. Any incomplete tool calls have been marked as not executed. You should now respond to the current user message.'
90
+ };
91
+ historyMessages = [...historyMessages, contextMessage];
92
+ // Return messages as-is if no tool_calls in last message
93
+ return historyMessages;
94
+ }
95
+ catch (error) {
96
+ console.error('Error retrieving chat history:', error);
97
+ return [];
98
+ }
99
+ }
100
+ setMaxHistoryMessages(max) {
101
+ this.maxHistoryMessages = max;
102
+ }
103
+ }
104
+ exports.ChatHistoryMessageModifier = ChatHistoryMessageModifier;
@@ -0,0 +1,23 @@
1
+ import { ProcessedMessage } from "@codebolt/types/agent";
2
+ import { BaseMessageModifier } from "../base";
3
+ import { FlatUserMessage } from "@codebolt/types/sdk";
4
+ export interface ChatRecordingOptions {
5
+ enableRecording?: boolean;
6
+ recordingPath?: string;
7
+ maxRecordingSize?: number;
8
+ includeMetadata?: boolean;
9
+ recordingFormat?: 'json' | 'markdown';
10
+ }
11
+ export declare class ChatRecordingModifier extends BaseMessageModifier {
12
+ private readonly options;
13
+ private recordingFile?;
14
+ constructor(options?: ChatRecordingOptions);
15
+ modify(originalRequest: FlatUserMessage, createdMessage: ProcessedMessage): Promise<ProcessedMessage>;
16
+ private initializeRecording;
17
+ private recordMessages;
18
+ private writeRecord;
19
+ startRecording(customPath?: string): void;
20
+ stopRecording(): void;
21
+ getRecordingFile(): string | undefined;
22
+ isRecording(): boolean;
23
+ }
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ChatRecordingModifier = void 0;
37
+ const base_1 = require("../base");
38
+ const fs = __importStar(require("fs"));
39
+ const path = __importStar(require("path"));
40
+ class ChatRecordingModifier extends base_1.BaseMessageModifier {
41
+ constructor(options = {}) {
42
+ super();
43
+ this.options = {
44
+ enableRecording: options.enableRecording || false,
45
+ recordingPath: options.recordingPath || path.join(process.cwd(), '.chat-recordings'),
46
+ maxRecordingSize: options.maxRecordingSize || 10 * 1024 * 1024, // 10MB
47
+ includeMetadata: options.includeMetadata !== false,
48
+ recordingFormat: options.recordingFormat || 'json'
49
+ };
50
+ if (this.options.enableRecording) {
51
+ this.initializeRecording();
52
+ }
53
+ }
54
+ async modify(originalRequest, createdMessage) {
55
+ try {
56
+ if (!this.options.enableRecording || !this.recordingFile) {
57
+ return createdMessage;
58
+ }
59
+ // Record the conversation
60
+ await this.recordMessages(createdMessage, originalRequest);
61
+ return Promise.resolve({
62
+ ...createdMessage,
63
+ metadata: {
64
+ ...createdMessage.metadata,
65
+ chatRecorded: true,
66
+ recordingFile: this.recordingFile
67
+ }
68
+ });
69
+ }
70
+ catch (error) {
71
+ console.error('Error in ChatRecordingModifier:', error);
72
+ return createdMessage;
73
+ }
74
+ }
75
+ initializeRecording() {
76
+ try {
77
+ // Ensure recording directory exists
78
+ if (!fs.existsSync(this.options.recordingPath)) {
79
+ fs.mkdirSync(this.options.recordingPath, { recursive: true });
80
+ }
81
+ // Create recording file with timestamp
82
+ const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
83
+ const extension = this.options.recordingFormat === 'markdown' ? 'md' : 'jsonl';
84
+ this.recordingFile = path.join(this.options.recordingPath, `chat-${timestamp}.${extension}`);
85
+ // Initialize file with header
86
+ if (this.options.recordingFormat === 'markdown') {
87
+ fs.writeFileSync(this.recordingFile, `# Chat Recording\n\nStarted: ${new Date().toISOString()}\n\n---\n\n`);
88
+ }
89
+ }
90
+ catch (error) {
91
+ console.error('Failed to initialize chat recording:', error);
92
+ this.recordingFile = undefined;
93
+ }
94
+ }
95
+ async recordMessages(createdMessage, originalRequest) {
96
+ var _a, _b;
97
+ if (!this.recordingFile)
98
+ return;
99
+ try {
100
+ // Check file size before writing
101
+ if (fs.existsSync(this.recordingFile)) {
102
+ const stats = fs.statSync(this.recordingFile);
103
+ if (stats.size > this.options.maxRecordingSize) {
104
+ console.warn(`Chat recording file ${this.recordingFile} exceeds maximum size. Stopping recording.`);
105
+ return;
106
+ }
107
+ }
108
+ const timestamp = new Date().toISOString();
109
+ // Record each message
110
+ for (const message of createdMessage.message.messages) {
111
+ const record = {
112
+ timestamp,
113
+ messageId: (_a = createdMessage.metadata) === null || _a === void 0 ? void 0 : _a.messageId,
114
+ threadId: (_b = createdMessage.metadata) === null || _b === void 0 ? void 0 : _b.threadId,
115
+ role: message.role,
116
+ content: typeof message.content === 'string' ? message.content : JSON.stringify(message.content)
117
+ };
118
+ if (this.options.includeMetadata) {
119
+ record.metadata = {
120
+ originalRequest: {
121
+ userMessage: originalRequest.userMessage,
122
+ messageId: originalRequest.messageId,
123
+ threadId: originalRequest.threadId
124
+ },
125
+ processedMetadata: createdMessage.metadata
126
+ };
127
+ }
128
+ await this.writeRecord(record);
129
+ }
130
+ }
131
+ catch (error) {
132
+ console.error('Error recording chat messages:', error);
133
+ }
134
+ }
135
+ async writeRecord(record) {
136
+ if (!this.recordingFile)
137
+ return;
138
+ try {
139
+ if (this.options.recordingFormat === 'markdown') {
140
+ const content = `## ${record.role.toUpperCase()} - ${record.timestamp}\n\n${record.content}\n\n---\n\n`;
141
+ fs.appendFileSync(this.recordingFile, content);
142
+ }
143
+ else {
144
+ const jsonLine = JSON.stringify(record) + '\n';
145
+ fs.appendFileSync(this.recordingFile, jsonLine);
146
+ }
147
+ }
148
+ catch (error) {
149
+ console.error('Error writing chat record:', error);
150
+ }
151
+ }
152
+ startRecording(customPath) {
153
+ this.options.enableRecording = true;
154
+ if (customPath) {
155
+ this.options.recordingPath = customPath;
156
+ }
157
+ this.initializeRecording();
158
+ }
159
+ stopRecording() {
160
+ this.options.enableRecording = false;
161
+ if (this.recordingFile && this.options.recordingFormat === 'markdown') {
162
+ fs.appendFileSync(this.recordingFile, `\n---\n\nRecording ended: ${new Date().toISOString()}\n`);
163
+ }
164
+ this.recordingFile = undefined;
165
+ }
166
+ getRecordingFile() {
167
+ return this.recordingFile;
168
+ }
169
+ isRecording() {
170
+ return (this.options.enableRecording || false) && !!this.recordingFile;
171
+ }
172
+ }
173
+ exports.ChatRecordingModifier = ChatRecordingModifier;
@@ -0,0 +1,14 @@
1
+ import { ProcessedMessage } from "@codebolt/types/agent";
2
+ import { BaseMessageModifier } from "../base";
3
+ import { FlatUserMessage } from "@codebolt/types/sdk";
4
+ export interface CoreSystemPromptOptions {
5
+ customSystemPrompt?: string;
6
+ userMemory?: string;
7
+ }
8
+ export declare class CoreSystemPromptModifier extends BaseMessageModifier {
9
+ private readonly options;
10
+ constructor(options?: CoreSystemPromptOptions);
11
+ modify(originalRequest: FlatUserMessage, createdMessage: ProcessedMessage): Promise<ProcessedMessage>;
12
+ private getCoreSystemPrompt;
13
+ private getDefaultSystemPrompt;
14
+ }