@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.
- package/README.md +157 -66
- package/dist/{agent.js → builderpattern/agent.js} +2 -2
- package/dist/{followupquestionbuilder.d.ts → builderpattern/followupquestionbuilder.d.ts} +1 -1
- package/dist/{followupquestionbuilder.js → builderpattern/followupquestionbuilder.js} +1 -1
- package/dist/{index.d.ts → builderpattern/index.d.ts} +3 -3
- package/dist/{llmoutputhandler.d.ts → builderpattern/llmoutputhandler.d.ts} +1 -1
- package/dist/{llmoutputhandler.js → builderpattern/llmoutputhandler.js} +7 -7
- package/dist/{promptbuilder.d.ts → builderpattern/promptbuilder.d.ts} +3 -3
- package/dist/{taskInstruction.d.ts → builderpattern/taskInstruction.d.ts} +2 -2
- package/dist/{usermessage.d.ts → builderpattern/usermessage.d.ts} +9 -4
- package/dist/composablepattern/agent.d.ts +169 -0
- package/dist/composablepattern/agent.js +598 -0
- package/dist/composablepattern/codebolt-storage.d.ts +67 -0
- package/dist/composablepattern/codebolt-storage.js +320 -0
- package/dist/composablepattern/document.d.ts +149 -0
- package/dist/composablepattern/document.js +372 -0
- package/dist/composablepattern/examples/codebolt-integration-example.d.ts +12 -0
- package/dist/composablepattern/examples/codebolt-integration-example.js +218 -0
- package/dist/composablepattern/examples/codebolt-storage-example.d.ts +40 -0
- package/dist/composablepattern/examples/codebolt-storage-example.js +223 -0
- package/dist/composablepattern/examples/custom-steps-example.d.ts +20 -0
- package/dist/composablepattern/examples/custom-steps-example.js +455 -0
- package/dist/composablepattern/examples/document-agent.d.ts +17 -0
- package/dist/composablepattern/examples/document-agent.js +107 -0
- package/dist/composablepattern/examples/simple-codebolt-integration.d.ts +8 -0
- package/dist/composablepattern/examples/simple-codebolt-integration.js +164 -0
- package/dist/composablepattern/examples/weather-agent.d.ts +18 -0
- package/dist/composablepattern/examples/weather-agent.js +86 -0
- package/dist/composablepattern/examples/workflow-example.d.ts +12 -0
- package/dist/composablepattern/examples/workflow-example.js +463 -0
- package/dist/composablepattern/index.d.ts +63 -0
- package/dist/composablepattern/index.js +115 -0
- package/dist/composablepattern/memory.d.ts +89 -0
- package/dist/composablepattern/memory.js +141 -0
- package/dist/composablepattern/tool.d.ts +84 -0
- package/dist/composablepattern/tool.js +260 -0
- package/dist/composablepattern/types.d.ts +194 -0
- package/dist/composablepattern/types.js +6 -0
- package/dist/composablepattern/user-context.d.ts +214 -0
- package/dist/composablepattern/user-context.js +275 -0
- package/dist/composablepattern/workflow.d.ts +388 -0
- package/dist/composablepattern/workflow.js +562 -0
- package/dist/local-tools/fileTools.d.ts +26 -0
- package/dist/local-tools/fileTools.js +162 -0
- package/dist/processor/agent/agentStep.d.ts +49 -0
- package/dist/processor/agent/agentStep.js +241 -0
- package/dist/processor/agent/toolExecutor.d.ts +19 -0
- package/dist/processor/agent/toolExecutor.js +90 -0
- package/dist/processor/index.d.ts +7 -0
- package/dist/processor/index.js +36 -0
- package/dist/processor/messageModifiers/baseMessageModifier.d.ts +20 -0
- package/dist/processor/messageModifiers/baseMessageModifier.js +55 -0
- package/dist/processor/processors/baseProcessor.d.ts +14 -0
- package/dist/processor/processors/baseProcessor.js +29 -0
- package/dist/processor/tools/baseTool.d.ts +10 -0
- package/dist/processor/tools/baseTool.js +20 -0
- package/dist/processor/tools/toolList.d.ts +9 -0
- package/dist/processor/tools/toolList.js +22 -0
- package/dist/processor/types/interfaces.d.ts +117 -0
- package/dist/processor/types/interfaces.js +2 -0
- package/dist/processor-pieces/additionalModifiers/argumentProcessorModifier.d.ts +13 -0
- package/dist/processor-pieces/additionalModifiers/argumentProcessorModifier.js +68 -0
- package/dist/processor-pieces/additionalModifiers/atFileProcessorModifier.d.ts +15 -0
- package/dist/processor-pieces/additionalModifiers/atFileProcessorModifier.js +212 -0
- package/dist/processor-pieces/additionalModifiers/chatCompressionModifier.d.ts +19 -0
- package/dist/processor-pieces/additionalModifiers/chatCompressionModifier.js +110 -0
- package/dist/processor-pieces/additionalModifiers/chatRecordingModifier.d.ts +23 -0
- package/dist/processor-pieces/additionalModifiers/chatRecordingModifier.js +173 -0
- package/dist/processor-pieces/additionalModifiers/coreSystemPromptModifier.d.ts +14 -0
- package/dist/processor-pieces/additionalModifiers/coreSystemPromptModifier.js +93 -0
- package/dist/processor-pieces/additionalModifiers/directoryContextModifier.d.ts +30 -0
- package/dist/processor-pieces/additionalModifiers/directoryContextModifier.js +330 -0
- package/dist/processor-pieces/additionalModifiers/environmentContextModifier.d.ts +26 -0
- package/dist/processor-pieces/additionalModifiers/environmentContextModifier.js +269 -0
- package/dist/processor-pieces/additionalModifiers/fallbackHandlerModifier.d.ts +38 -0
- package/dist/processor-pieces/additionalModifiers/fallbackHandlerModifier.js +217 -0
- package/dist/processor-pieces/additionalModifiers/ideContextModifier.d.ts +34 -0
- package/dist/processor-pieces/additionalModifiers/ideContextModifier.js +147 -0
- package/dist/processor-pieces/additionalModifiers/index.d.ts +12 -0
- package/dist/processor-pieces/additionalModifiers/index.js +28 -0
- package/dist/processor-pieces/additionalModifiers/loopDetectionModifier.d.ts +29 -0
- package/dist/processor-pieces/additionalModifiers/loopDetectionModifier.js +155 -0
- package/dist/processor-pieces/additionalModifiers/memoryImportModifier.d.ts +15 -0
- package/dist/processor-pieces/additionalModifiers/memoryImportModifier.js +129 -0
- package/dist/processor-pieces/additionalModifiers/shellProcessorModifier.d.ts +25 -0
- package/dist/processor-pieces/additionalModifiers/shellProcessorModifier.js +169 -0
- package/dist/processor-pieces/additionalModifiers/toolInjectionModifier.d.ts +20 -0
- package/dist/processor-pieces/additionalModifiers/toolInjectionModifier.js +152 -0
- package/dist/processor-pieces/base/baseMessageModifier.d.ts +12 -0
- package/dist/processor-pieces/base/baseMessageModifier.js +15 -0
- package/dist/processor-pieces/base/basePostInferenceProcessor.d.ts +13 -0
- package/dist/processor-pieces/base/basePostInferenceProcessor.js +18 -0
- package/dist/processor-pieces/base/basePostToolCallProcessor.d.ts +15 -0
- package/dist/processor-pieces/base/basePostToolCallProcessor.js +25 -0
- package/dist/processor-pieces/base/basePreInferenceProcessor.d.ts +12 -0
- package/dist/processor-pieces/base/basePreInferenceProcessor.js +17 -0
- package/dist/processor-pieces/base/basePreToolCallProcessor.d.ts +18 -0
- package/dist/processor-pieces/base/basePreToolCallProcessor.js +66 -0
- package/dist/processor-pieces/base/index.d.ts +9 -0
- package/dist/processor-pieces/base/index.js +18 -0
- package/dist/processor-pieces/index.d.ts +1 -0
- package/dist/processor-pieces/index.js +59 -0
- package/dist/processor-pieces/messageModifiers/addCurrentDirectoryRootFilesModifier.d.ts +7 -0
- package/dist/processor-pieces/messageModifiers/addCurrentDirectoryRootFilesModifier.js +93 -0
- package/dist/processor-pieces/messageModifiers/addToolsListMessageModifier.d.ts +31 -0
- package/dist/processor-pieces/messageModifiers/addToolsListMessageModifier.js +145 -0
- package/dist/processor-pieces/messageModifiers/advancedSystemInstructionMessageModifier.d.ts +9 -0
- package/dist/processor-pieces/messageModifiers/advancedSystemInstructionMessageModifier.js +77 -0
- package/dist/processor-pieces/messageModifiers/argumentProcessorModifier.d.ts +13 -0
- package/dist/processor-pieces/messageModifiers/argumentProcessorModifier.js +68 -0
- package/dist/processor-pieces/messageModifiers/atFileProcessorModifier.d.ts +25 -0
- package/dist/processor-pieces/messageModifiers/atFileProcessorModifier.js +453 -0
- package/dist/processor-pieces/messageModifiers/baseContextMessageModifier.d.ts +7 -0
- package/dist/processor-pieces/messageModifiers/baseContextMessageModifier.js +67 -0
- package/dist/processor-pieces/messageModifiers/baseSystemInstructionMessageModifier.d.ts +9 -0
- package/dist/processor-pieces/messageModifiers/baseSystemInstructionMessageModifier.js +90 -0
- package/dist/processor-pieces/messageModifiers/chatCompressionModifier.d.ts +19 -0
- package/dist/processor-pieces/messageModifiers/chatCompressionModifier.js +110 -0
- package/dist/processor-pieces/messageModifiers/chatHistoryMessageModifier.d.ts +18 -0
- package/dist/processor-pieces/messageModifiers/chatHistoryMessageModifier.example.d.ts +20 -0
- package/dist/processor-pieces/messageModifiers/chatHistoryMessageModifier.example.js +124 -0
- package/dist/processor-pieces/messageModifiers/chatHistoryMessageModifier.js +104 -0
- package/dist/processor-pieces/messageModifiers/chatRecordingModifier.d.ts +23 -0
- package/dist/processor-pieces/messageModifiers/chatRecordingModifier.js +173 -0
- package/dist/processor-pieces/messageModifiers/coreSystemPromptModifier.d.ts +14 -0
- package/dist/processor-pieces/messageModifiers/coreSystemPromptModifier.js +130 -0
- package/dist/processor-pieces/messageModifiers/directoryContextModifier.d.ts +36 -0
- package/dist/processor-pieces/messageModifiers/directoryContextModifier.js +418 -0
- package/dist/processor-pieces/messageModifiers/environmentContext.d.ts +41 -0
- package/dist/processor-pieces/messageModifiers/environmentContext.js +355 -0
- package/dist/processor-pieces/messageModifiers/environmentContextModifier.d.ts +26 -0
- package/dist/processor-pieces/messageModifiers/environmentContextModifier.js +260 -0
- package/dist/processor-pieces/messageModifiers/handleUrlMessageModifier.d.ts +13 -0
- package/dist/processor-pieces/messageModifiers/handleUrlMessageModifier.js +59 -0
- package/dist/processor-pieces/messageModifiers/ideContextModifier.d.ts +34 -0
- package/dist/processor-pieces/messageModifiers/ideContextModifier.js +157 -0
- package/dist/processor-pieces/messageModifiers/imageAttachmentMessageModifier.d.ts +19 -0
- package/dist/processor-pieces/messageModifiers/imageAttachmentMessageModifier.js +221 -0
- package/dist/processor-pieces/messageModifiers/index.d.ts +11 -0
- package/dist/processor-pieces/messageModifiers/index.js +26 -0
- package/dist/processor-pieces/messageModifiers/memoryImportModifier.d.ts +15 -0
- package/dist/processor-pieces/messageModifiers/memoryImportModifier.js +129 -0
- package/dist/processor-pieces/messageModifiers/mentionedFilesModifier.d.ts +23 -0
- package/dist/processor-pieces/messageModifiers/mentionedFilesModifier.js +207 -0
- package/dist/processor-pieces/messageModifiers/simpleMessageModifier.d.ts +7 -0
- package/dist/processor-pieces/messageModifiers/simpleMessageModifier.js +26 -0
- package/dist/processor-pieces/messageModifiers/toolInjectionModifier.d.ts +20 -0
- package/dist/processor-pieces/messageModifiers/toolInjectionModifier.js +152 -0
- package/dist/processor-pieces/messageModifiers/workingDirectoryMessageModifier.d.ts +38 -0
- package/dist/processor-pieces/messageModifiers/workingDirectoryMessageModifier.js +392 -0
- package/dist/processor-pieces/postInference/llmOutputValidityProcessor.d.ts +1 -0
- package/dist/processor-pieces/postInference/llmOutputValidityProcessor.js +2 -0
- package/dist/processor-pieces/postInferenceProcessors/checkForNoToolCall.d.ts +7 -0
- package/dist/processor-pieces/postInferenceProcessors/checkForNoToolCall.js +24 -0
- package/dist/processor-pieces/postInferenceProcessors/loopDetectionModifier.d.ts +29 -0
- package/dist/processor-pieces/postInferenceProcessors/loopDetectionModifier.js +174 -0
- package/dist/processor-pieces/postToolCall/advancedLoopDetectionProcessor.d.ts +41 -0
- package/dist/processor-pieces/postToolCall/advancedLoopDetectionProcessor.js +197 -0
- package/dist/processor-pieces/postToolCall/chatCompressionProcessor.d.ts +26 -0
- package/dist/processor-pieces/postToolCall/chatCompressionProcessor.js +90 -0
- package/dist/processor-pieces/postToolCall/chatRecordingProcessor.d.ts +81 -0
- package/dist/processor-pieces/postToolCall/chatRecordingProcessor.js +329 -0
- package/dist/processor-pieces/postToolCall/contextManagementProcessor.d.ts +40 -0
- package/dist/processor-pieces/postToolCall/contextManagementProcessor.js +272 -0
- package/dist/processor-pieces/postToolCall/conversationCompactorProcessor.d.ts +49 -0
- package/dist/processor-pieces/postToolCall/conversationCompactorProcessor.js +291 -0
- package/dist/processor-pieces/postToolCall/conversationContinuityProcessor.d.ts +49 -0
- package/dist/processor-pieces/postToolCall/conversationContinuityProcessor.js +293 -0
- package/dist/processor-pieces/postToolCall/followUpConversationProcessor.d.ts +47 -0
- package/dist/processor-pieces/postToolCall/followUpConversationProcessor.js +249 -0
- package/dist/processor-pieces/postToolCall/loopDetectionProcessor.d.ts +30 -0
- package/dist/processor-pieces/postToolCall/loopDetectionProcessor.js +137 -0
- package/dist/processor-pieces/postToolCall/responseValidationProcessor.d.ts +30 -0
- package/dist/processor-pieces/postToolCall/responseValidationProcessor.js +228 -0
- package/dist/processor-pieces/postToolCall/telemetryProcessor.d.ts +99 -0
- package/dist/processor-pieces/postToolCall/telemetryProcessor.js +278 -0
- package/dist/processor-pieces/postToolCall/tokenManagementProcessor.d.ts +37 -0
- package/dist/processor-pieces/postToolCall/tokenManagementProcessor.js +178 -0
- package/dist/processor-pieces/postToolCall/toolExecutionProcessor.d.ts +43 -0
- package/dist/processor-pieces/postToolCall/toolExecutionProcessor.js +207 -0
- package/dist/processor-pieces/postToolCallProcessors/index.d.ts +1 -0
- package/dist/processor-pieces/postToolCallProcessors/index.js +2 -0
- package/dist/processor-pieces/postToolCallProcessors/shellProcessorModifier.d.ts +25 -0
- package/dist/processor-pieces/postToolCallProcessors/shellProcessorModifier.js +225 -0
- package/dist/processor-pieces/preInference/conversationCompactorProcessor.d.ts +52 -0
- package/dist/processor-pieces/preInference/conversationCompactorProcessor.js +264 -0
- package/dist/processor-pieces/preInference/conversationContinuityProcessor.d.ts +49 -0
- package/dist/processor-pieces/preInference/conversationContinuityProcessor.js +293 -0
- package/dist/processor-pieces/preInferenceProcessors/chatCompressionModifier.d.ts +35 -0
- package/dist/processor-pieces/preInferenceProcessors/chatCompressionModifier.js +255 -0
- package/dist/processor-pieces/preInferenceProcessors/conversationCompaction.d.ts +7 -0
- package/dist/processor-pieces/preInferenceProcessors/conversationCompaction.js +31 -0
- package/dist/processor-pieces/preInferenceProcessors/index.d.ts +1 -0
- package/dist/processor-pieces/preInferenceProcessors/index.js +2 -0
- package/dist/processor-pieces/preToolCall/index.d.ts +9 -0
- package/dist/processor-pieces/preToolCall/index.js +18 -0
- package/dist/processor-pieces/preToolCall/localToolInterceptorProcessor.d.ts +58 -0
- package/dist/processor-pieces/preToolCall/localToolInterceptorProcessor.js +444 -0
- package/dist/processor-pieces/preToolCall/toolParameterModifierProcessor.d.ts +44 -0
- package/dist/processor-pieces/preToolCall/toolParameterModifierProcessor.js +367 -0
- package/dist/processor-pieces/preToolCall/toolValidationProcessor.d.ts +58 -0
- package/dist/processor-pieces/preToolCall/toolValidationProcessor.js +391 -0
- package/dist/processor-pieces/pretoolCallProcessors/index.d.ts +1 -0
- package/dist/processor-pieces/pretoolCallProcessors/index.js +2 -0
- package/dist/processor-pieces/processors/advancedLoopDetectionProcessor.d.ts +41 -0
- package/dist/processor-pieces/processors/advancedLoopDetectionProcessor.js +197 -0
- package/dist/processor-pieces/processors/chatCompressionProcessor.d.ts +26 -0
- package/dist/processor-pieces/processors/chatCompressionProcessor.js +90 -0
- package/dist/processor-pieces/processors/chatRecordingProcessor.d.ts +81 -0
- package/dist/processor-pieces/processors/chatRecordingProcessor.js +329 -0
- package/dist/processor-pieces/processors/contextManagementProcessor.d.ts +40 -0
- package/dist/processor-pieces/processors/contextManagementProcessor.js +305 -0
- package/dist/processor-pieces/processors/loopDetectionProcessor.d.ts +30 -0
- package/dist/processor-pieces/processors/loopDetectionProcessor.js +137 -0
- package/dist/processor-pieces/processors/responseValidationProcessor.d.ts +30 -0
- package/dist/processor-pieces/processors/responseValidationProcessor.js +228 -0
- package/dist/processor-pieces/processors/telemetryProcessor.d.ts +99 -0
- package/dist/processor-pieces/processors/telemetryProcessor.js +311 -0
- package/dist/processor-pieces/processors/tokenManagementProcessor.d.ts +37 -0
- package/dist/processor-pieces/processors/tokenManagementProcessor.js +178 -0
- package/dist/processor-pieces/processors/toolExecutionProcessor.d.ts +43 -0
- package/dist/processor-pieces/processors/toolExecutionProcessor.js +207 -0
- package/dist/processor-pieces/tools/fileTools.d.ts +26 -0
- package/dist/processor-pieces/tools/fileTools.js +162 -0
- package/dist/processor-pieces/utils/messageModifierHelper.d.ts +4 -0
- package/dist/processor-pieces/utils/messageModifierHelper.js +58 -0
- package/dist/types/commonTypes.d.ts +4 -0
- package/dist/types/processorTypes.d.ts +67 -0
- package/dist/types/processorTypes.js +58 -0
- package/dist/unified/agent/agent.d.ts +17 -0
- package/dist/unified/agent/agent.js +79 -0
- package/dist/unified/agent/team.d.ts +2 -0
- package/dist/unified/agent/team.js +6 -0
- package/dist/unified/agent/tool.d.ts +99 -0
- package/dist/unified/agent/tool.js +440 -0
- package/dist/unified/agent/tools.d.ts +44 -0
- package/dist/unified/agent/tools.js +487 -0
- package/dist/unified/agent/workflow.d.ts +24 -0
- package/dist/unified/agent/workflow.js +275 -0
- package/dist/unified/agent/workflowControls.d.ts +11 -0
- package/dist/unified/agent/workflowControls.js +20 -0
- package/dist/unified/agent/workflowSteps.d.ts +63 -0
- package/dist/unified/agent/workflowSteps.js +284 -0
- package/dist/unified/base/agentStep.d.ts +32 -0
- package/dist/unified/base/agentStep.js +96 -0
- package/dist/unified/base/create/createInitialPromptGenerators.d.ts +5 -0
- package/dist/unified/base/create/createInitialPromptGenerators.js +17 -0
- package/dist/unified/base/index.d.ts +5 -0
- package/dist/unified/base/index.js +13 -0
- package/dist/unified/base/initialPromptGenerator.d.ts +48 -0
- package/dist/unified/base/initialPromptGenerator.js +118 -0
- package/dist/unified/base/responseExecutor.d.ts +36 -0
- package/dist/unified/base/responseExecutor.js +283 -0
- package/dist/unified/examples/agentExample.d.ts +46 -0
- package/dist/unified/examples/agentExample.js +464 -0
- package/dist/unified/examples/documentationPatternExample.d.ts +10 -0
- package/dist/unified/examples/documentationPatternExample.js +385 -0
- package/dist/unified/examples/followUpProcessorsExample.d.ts +45 -0
- package/dist/unified/examples/followUpProcessorsExample.js +311 -0
- package/dist/unified/examples/orchestratorExample.d.ts +16 -0
- package/dist/unified/examples/orchestratorExample.js +415 -0
- package/dist/unified/examples/preToolCallProcessorsExample.d.ts +36 -0
- package/dist/unified/examples/preToolCallProcessorsExample.js +458 -0
- package/dist/unified/examples/workflowExample.d.ts +12 -0
- package/dist/unified/examples/workflowExample.js +497 -0
- package/dist/unified/index.d.ts +18 -0
- package/dist/unified/index.js +42 -0
- package/dist/unified/orchestrator/orchestrator.d.ts +260 -0
- package/dist/unified/orchestrator/orchestrator.js +519 -0
- package/dist/unified/team/team.d.ts +1 -0
- package/dist/unified/team/team.js +2 -0
- package/dist/unified/types/libTypes.d.ts +378 -0
- package/dist/unified/types/libTypes.js +6 -0
- package/dist/unified/types/types.d.ts +212 -0
- package/dist/unified/types/types.js +43 -0
- package/dist/unified/utils/utils.d.ts +40 -0
- package/dist/unified/utils/utils.js +219 -0
- package/package.json +35 -13
- /package/dist/{agent.d.ts → builderpattern/agent.d.ts} +0 -0
- /package/dist/{index.js → builderpattern/index.js} +0 -0
- /package/dist/{promptbuilder.js → builderpattern/promptbuilder.js} +0 -0
- /package/dist/{systemprompt.d.ts → builderpattern/systemprompt.d.ts} +0 -0
- /package/dist/{systemprompt.js → builderpattern/systemprompt.js} +0 -0
- /package/dist/{taskInstruction.js → builderpattern/taskInstruction.js} +0 -0
- /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,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
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoreSystemPromptModifier = void 0;
|
|
4
|
+
const base_1 = require("../base");
|
|
5
|
+
class CoreSystemPromptModifier extends base_1.BaseMessageModifier {
|
|
6
|
+
constructor(options = {}) {
|
|
7
|
+
super();
|
|
8
|
+
this.options = options;
|
|
9
|
+
}
|
|
10
|
+
modify(originalRequest, createdMessage) {
|
|
11
|
+
var _a;
|
|
12
|
+
// Get user memory from metadata or options
|
|
13
|
+
const userMemory = ((_a = createdMessage.metadata) === null || _a === void 0 ? void 0 : _a.userMemory) || this.options.userMemory;
|
|
14
|
+
const systemPrompt = this.options.customSystemPrompt || this.getCoreSystemPrompt(userMemory);
|
|
15
|
+
const systemMessage = {
|
|
16
|
+
role: 'system',
|
|
17
|
+
content: systemPrompt
|
|
18
|
+
};
|
|
19
|
+
// Find existing system message or add new one
|
|
20
|
+
const messages = [...createdMessage.message.messages];
|
|
21
|
+
const systemMessageIndex = messages.findIndex(msg => msg.role === 'system');
|
|
22
|
+
if (systemMessageIndex !== -1) {
|
|
23
|
+
// Replace existing system message
|
|
24
|
+
messages[systemMessageIndex] = systemMessage;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
// Add new system message at the beginning
|
|
28
|
+
messages.unshift(systemMessage);
|
|
29
|
+
}
|
|
30
|
+
return Promise.resolve({
|
|
31
|
+
message: {
|
|
32
|
+
...createdMessage.message,
|
|
33
|
+
messages
|
|
34
|
+
},
|
|
35
|
+
metadata: {
|
|
36
|
+
...createdMessage.metadata,
|
|
37
|
+
coreSystemPromptAdded: true,
|
|
38
|
+
systemPromptSource: this.options.customSystemPrompt ? 'custom' : 'default',
|
|
39
|
+
hasUserMemory: !!userMemory
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
getCoreSystemPrompt(userMemory) {
|
|
44
|
+
const basePrompt = this.getDefaultSystemPrompt();
|
|
45
|
+
// Add user memory with separator if provided (exactly like gemini-cli)
|
|
46
|
+
const memorySuffix = userMemory && userMemory.trim().length > 0
|
|
47
|
+
? `\n\n---\n\n${userMemory.trim()}`
|
|
48
|
+
: '';
|
|
49
|
+
return `${basePrompt}${memorySuffix}`;
|
|
50
|
+
}
|
|
51
|
+
getDefaultSystemPrompt() {
|
|
52
|
+
return `
|
|
53
|
+
You are an interactive AI agent specializing in software engineering tasks. Your primary goal is to help users safely and efficiently, adhering strictly to the following instructions and utilizing your available tools.
|
|
54
|
+
|
|
55
|
+
# Core Mandates
|
|
56
|
+
|
|
57
|
+
- **Conventions:** Rigorously adhere to existing project conventions when reading or modifying code. Analyze surrounding code, tests, and configuration first.
|
|
58
|
+
- **Libraries/Frameworks:** NEVER assume a library/framework is available or appropriate. Verify its established usage within the project before employing it.
|
|
59
|
+
- **Style & Structure:** Mimic the style (formatting, naming), structure, framework choices, typing, and architectural patterns of existing code in the project.
|
|
60
|
+
- **Idiomatic Changes:** When editing, understand the local context (imports, functions/classes) to ensure your changes integrate naturally and idiomatically.
|
|
61
|
+
- **Comments:** Add code comments sparingly. Focus on *why* something is done, especially for complex logic, rather than *what* is done.
|
|
62
|
+
- **Proactiveness:** Fulfill the user's request thoroughly, including reasonable, directly implied follow-up actions.
|
|
63
|
+
- **Confirm Ambiguity/Expansion:** Do not take significant actions beyond the clear scope of the request without confirming with the user.
|
|
64
|
+
- **Explaining Changes:** After completing a code modification or file operation *do not* provide summaries unless asked.
|
|
65
|
+
|
|
66
|
+
# Primary Workflows
|
|
67
|
+
|
|
68
|
+
## Software Engineering Tasks
|
|
69
|
+
When requested to perform tasks like fixing bugs, adding features, refactoring, or explaining code, follow this sequence:
|
|
70
|
+
1. **Understand:** Think about the user's request and the relevant codebase context. Use search tools extensively to understand file structures, existing code patterns, and conventions.
|
|
71
|
+
2. **Plan:** Build a coherent and grounded plan for how you intend to resolve the user's task. Share a concise yet clear plan with the user if it would help.
|
|
72
|
+
3. **Implement:** Use the available tools to act on the plan, strictly adhering to the project's established conventions.
|
|
73
|
+
4. **Verify:** If applicable and feasible, verify the changes using the project's testing procedures and build/lint commands.
|
|
74
|
+
|
|
75
|
+
# Operational Guidelines
|
|
76
|
+
|
|
77
|
+
## Tone and Style
|
|
78
|
+
- **Concise & Direct:** Adopt a professional, direct, and concise tone.
|
|
79
|
+
- **Minimal Output:** Aim for fewer than 3 lines of text output per response whenever practical.
|
|
80
|
+
- **Clarity over Brevity:** While conciseness is key, prioritize clarity for essential explanations.
|
|
81
|
+
- **No Chitchat:** Avoid conversational filler. Get straight to the action or answer.
|
|
82
|
+
- **Formatting:** Use GitHub-flavored Markdown.
|
|
83
|
+
|
|
84
|
+
## Security and Safety Rules
|
|
85
|
+
- **Security First:** Always apply security best practices. Never introduce code that exposes, logs, or commits secrets, API keys, or other sensitive information.
|
|
86
|
+
- **File Operations:** Always use absolute paths when referring to files with tools.
|
|
87
|
+
|
|
88
|
+
# Final Reminder
|
|
89
|
+
Your core function is efficient and safe assistance. Balance extreme conciseness with the crucial need for clarity, especially regarding safety and potential system modifications. Always prioritize user control and project conventions.
|
|
90
|
+
`.trim();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.CoreSystemPromptModifier = CoreSystemPromptModifier;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ProcessedMessage } from "@codebolt/types/agent";
|
|
2
|
+
import { BaseMessageModifier } from "../base";
|
|
3
|
+
import { FlatUserMessage } from "@codebolt/types/sdk";
|
|
4
|
+
export interface DirectoryContextOptions {
|
|
5
|
+
workspaceDirectories?: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare class DirectoryContextModifier extends BaseMessageModifier {
|
|
8
|
+
private readonly options;
|
|
9
|
+
constructor(options?: DirectoryContextOptions);
|
|
10
|
+
modify(originalRequest: FlatUserMessage, createdMessage: ProcessedMessage): Promise<ProcessedMessage>;
|
|
11
|
+
/**
|
|
12
|
+
* Generates a string representation of a directory's structure,
|
|
13
|
+
* limiting the number of items displayed. Ignored folders are shown
|
|
14
|
+
* followed by '...' instead of their contents.
|
|
15
|
+
*
|
|
16
|
+
* @param directory The absolute or relative path to the directory.
|
|
17
|
+
* @param options Optional configuration settings.
|
|
18
|
+
* @returns A promise resolving to the formatted folder structure string.
|
|
19
|
+
*/
|
|
20
|
+
private getFolderStructure;
|
|
21
|
+
private readFullStructure;
|
|
22
|
+
/**
|
|
23
|
+
* Reads the directory structure using BFS, respecting maxItems.
|
|
24
|
+
* @param node The current node in the reduced structure.
|
|
25
|
+
* @param indent The current indentation string.
|
|
26
|
+
* @param isLast Sibling indicator.
|
|
27
|
+
* @param builder Array to build the string lines.
|
|
28
|
+
*/
|
|
29
|
+
private formatStructure;
|
|
30
|
+
}
|