@codebolt/agent 5.0.2 → 5.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.d.ts +86 -0
- package/dist/agent.js +324 -0
- package/dist/builderpattern/agent.js +2 -2
- package/dist/builderpattern/followupquestionbuilder.js +1 -1
- package/dist/builderpattern/llmoutputhandler.js +7 -7
- package/dist/builderpattern/usermessage.d.ts +1 -6
- package/dist/composablepattern/document.js +35 -2
- package/dist/followupquestionbuilder.d.ts +75 -0
- package/dist/followupquestionbuilder.js +197 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +23 -0
- package/dist/llmoutputhandler.d.ts +102 -0
- package/dist/llmoutputhandler.js +452 -0
- package/dist/processor/types/interfaces.d.ts +21 -44
- package/dist/processor-pieces/index.d.ts +3 -0
- package/dist/processor-pieces/index.js +3 -0
- package/dist/processor-pieces/messageModifiers/addToolsListMessageModifier.d.ts +5 -14
- package/dist/processor-pieces/messageModifiers/addToolsListMessageModifier.js +40 -41
- package/dist/processor-pieces/messageModifiers/baseContextMessageModifier.d.ts +13 -5
- package/dist/processor-pieces/messageModifiers/baseContextMessageModifier.js +58 -50
- package/dist/processor-pieces/messageModifiers/baseSystemInstructionMessageModifier.d.ts +8 -6
- package/dist/processor-pieces/messageModifiers/baseSystemInstructionMessageModifier.js +22 -66
- package/dist/processor-pieces/messageModifiers/handleUrlMessageModifier.d.ts +2 -3
- package/dist/processor-pieces/messageModifiers/handleUrlMessageModifier.js +2 -1
- package/dist/processor-pieces/messageModifiers/imageAttachmentMessageModifier.d.ts +2 -3
- package/dist/processor-pieces/messageModifiers/imageAttachmentMessageModifier.js +2 -1
- package/dist/processor-pieces/messageModifiers/toolInjectionModifier.js +4 -1
- package/dist/processor-pieces/messageModifiers/workingDirectoryMessageModifier.d.ts +2 -18
- package/dist/processor-pieces/messageModifiers/workingDirectoryMessageModifier.js +93 -291
- package/dist/processor-pieces/postToolCallProcessors/conversationCompactorModifier.d.ts +18 -0
- package/dist/processor-pieces/postToolCallProcessors/conversationCompactorModifier.js +41 -0
- package/dist/processor-pieces/postToolCallProcessors/index.d.ts +2 -1
- package/dist/processor-pieces/postToolCallProcessors/index.js +5 -0
- package/dist/processor-pieces/preInferenceProcessors/index.d.ts +1 -1
- package/dist/processor-pieces/preInferenceProcessors/index.js +3 -0
- package/dist/processor-pieces/pretoolCallProcessors/index.d.ts +2 -1
- package/dist/processor-pieces/pretoolCallProcessors/index.js +5 -0
- package/dist/processor-pieces/pretoolCallProcessors/toolParameterModifier.d.ts +21 -0
- package/dist/processor-pieces/pretoolCallProcessors/toolParameterModifier.js +32 -0
- package/dist/processor-pieces/pretoolCallProcessors/toolValidationModifier.d.ts +16 -0
- package/dist/processor-pieces/pretoolCallProcessors/toolValidationModifier.js +37 -0
- package/dist/promptbuilder.d.ts +382 -0
- package/dist/promptbuilder.js +805 -0
- package/dist/systemprompt.d.ts +20 -0
- package/dist/systemprompt.js +48 -0
- package/dist/taskInstruction.d.ts +37 -0
- package/dist/taskInstruction.js +57 -0
- package/dist/unified/agent/agent.js +2 -2
- package/dist/unified/agent/codeboltAgent.d.ts +122 -0
- package/dist/unified/agent/codeboltAgent.js +210 -0
- package/dist/unified/base/initialPromptGenerator.js +18 -4
- package/dist/unified/base/responseExecutor.d.ts +3 -2
- package/dist/unified/base/responseExecutor.js +100 -56
- package/dist/unified/index.d.ts +4 -0
- package/dist/unified/index.js +12 -1
- package/dist/usermessage.d.ts +70 -0
- package/dist/usermessage.js +123 -0
- package/package.json +5 -5
- package/dist/local-tools/fileTools.d.ts +0 -26
- package/dist/local-tools/fileTools.js +0 -162
- package/dist/processor-pieces/additionalModifiers/argumentProcessorModifier.d.ts +0 -13
- package/dist/processor-pieces/additionalModifiers/argumentProcessorModifier.js +0 -68
- package/dist/processor-pieces/additionalModifiers/atFileProcessorModifier.d.ts +0 -15
- package/dist/processor-pieces/additionalModifiers/atFileProcessorModifier.js +0 -212
- package/dist/processor-pieces/additionalModifiers/chatCompressionModifier.d.ts +0 -19
- package/dist/processor-pieces/additionalModifiers/chatCompressionModifier.js +0 -110
- package/dist/processor-pieces/additionalModifiers/chatRecordingModifier.d.ts +0 -23
- package/dist/processor-pieces/additionalModifiers/chatRecordingModifier.js +0 -173
- package/dist/processor-pieces/additionalModifiers/coreSystemPromptModifier.d.ts +0 -14
- package/dist/processor-pieces/additionalModifiers/coreSystemPromptModifier.js +0 -93
- package/dist/processor-pieces/additionalModifiers/directoryContextModifier.d.ts +0 -30
- package/dist/processor-pieces/additionalModifiers/directoryContextModifier.js +0 -330
- package/dist/processor-pieces/additionalModifiers/environmentContextModifier.d.ts +0 -26
- package/dist/processor-pieces/additionalModifiers/environmentContextModifier.js +0 -269
- package/dist/processor-pieces/additionalModifiers/fallbackHandlerModifier.d.ts +0 -38
- package/dist/processor-pieces/additionalModifiers/fallbackHandlerModifier.js +0 -217
- package/dist/processor-pieces/additionalModifiers/ideContextModifier.d.ts +0 -34
- package/dist/processor-pieces/additionalModifiers/ideContextModifier.js +0 -147
- package/dist/processor-pieces/additionalModifiers/index.d.ts +0 -12
- package/dist/processor-pieces/additionalModifiers/index.js +0 -28
- package/dist/processor-pieces/additionalModifiers/loopDetectionModifier.d.ts +0 -29
- package/dist/processor-pieces/additionalModifiers/loopDetectionModifier.js +0 -155
- package/dist/processor-pieces/additionalModifiers/memoryImportModifier.d.ts +0 -15
- package/dist/processor-pieces/additionalModifiers/memoryImportModifier.js +0 -129
- package/dist/processor-pieces/additionalModifiers/shellProcessorModifier.d.ts +0 -25
- package/dist/processor-pieces/additionalModifiers/shellProcessorModifier.js +0 -169
- package/dist/processor-pieces/additionalModifiers/toolInjectionModifier.d.ts +0 -20
- package/dist/processor-pieces/additionalModifiers/toolInjectionModifier.js +0 -152
- package/dist/processor-pieces/messageModifiers/addCurrentDirectoryRootFilesModifier.d.ts +0 -7
- package/dist/processor-pieces/messageModifiers/addCurrentDirectoryRootFilesModifier.js +0 -93
- package/dist/processor-pieces/messageModifiers/advancedSystemInstructionMessageModifier.d.ts +0 -9
- package/dist/processor-pieces/messageModifiers/advancedSystemInstructionMessageModifier.js +0 -77
- package/dist/processor-pieces/messageModifiers/chatCompressionModifier.d.ts +0 -19
- package/dist/processor-pieces/messageModifiers/chatCompressionModifier.js +0 -110
- package/dist/processor-pieces/messageModifiers/chatHistoryMessageModifier.example.d.ts +0 -20
- package/dist/processor-pieces/messageModifiers/chatHistoryMessageModifier.example.js +0 -124
- package/dist/processor-pieces/messageModifiers/environmentContext.d.ts +0 -41
- package/dist/processor-pieces/messageModifiers/environmentContext.js +0 -355
- package/dist/processor-pieces/messageModifiers/mentionedFilesModifier.d.ts +0 -23
- package/dist/processor-pieces/messageModifiers/mentionedFilesModifier.js +0 -207
- package/dist/processor-pieces/messageModifiers/simpleMessageModifier.d.ts +0 -7
- package/dist/processor-pieces/messageModifiers/simpleMessageModifier.js +0 -26
- package/dist/processor-pieces/postInference/llmOutputValidityProcessor.d.ts +0 -1
- package/dist/processor-pieces/postInference/llmOutputValidityProcessor.js +0 -2
- package/dist/processor-pieces/postInferenceProcessors/checkForNoToolCall.d.ts +0 -7
- package/dist/processor-pieces/postInferenceProcessors/checkForNoToolCall.js +0 -24
- package/dist/processor-pieces/postToolCall/advancedLoopDetectionProcessor.d.ts +0 -41
- package/dist/processor-pieces/postToolCall/advancedLoopDetectionProcessor.js +0 -197
- package/dist/processor-pieces/postToolCall/chatCompressionProcessor.d.ts +0 -26
- package/dist/processor-pieces/postToolCall/chatCompressionProcessor.js +0 -90
- package/dist/processor-pieces/postToolCall/chatRecordingProcessor.d.ts +0 -81
- package/dist/processor-pieces/postToolCall/chatRecordingProcessor.js +0 -329
- package/dist/processor-pieces/postToolCall/contextManagementProcessor.d.ts +0 -40
- package/dist/processor-pieces/postToolCall/contextManagementProcessor.js +0 -272
- package/dist/processor-pieces/postToolCall/conversationCompactorProcessor.d.ts +0 -49
- package/dist/processor-pieces/postToolCall/conversationCompactorProcessor.js +0 -291
- package/dist/processor-pieces/postToolCall/conversationContinuityProcessor.d.ts +0 -49
- package/dist/processor-pieces/postToolCall/conversationContinuityProcessor.js +0 -293
- package/dist/processor-pieces/postToolCall/followUpConversationProcessor.d.ts +0 -47
- package/dist/processor-pieces/postToolCall/followUpConversationProcessor.js +0 -249
- package/dist/processor-pieces/postToolCall/loopDetectionProcessor.d.ts +0 -30
- package/dist/processor-pieces/postToolCall/loopDetectionProcessor.js +0 -137
- package/dist/processor-pieces/postToolCall/responseValidationProcessor.d.ts +0 -30
- package/dist/processor-pieces/postToolCall/responseValidationProcessor.js +0 -228
- package/dist/processor-pieces/postToolCall/telemetryProcessor.d.ts +0 -99
- package/dist/processor-pieces/postToolCall/telemetryProcessor.js +0 -278
- package/dist/processor-pieces/postToolCall/tokenManagementProcessor.d.ts +0 -37
- package/dist/processor-pieces/postToolCall/tokenManagementProcessor.js +0 -178
- package/dist/processor-pieces/postToolCall/toolExecutionProcessor.d.ts +0 -43
- package/dist/processor-pieces/postToolCall/toolExecutionProcessor.js +0 -207
- package/dist/processor-pieces/preInference/conversationCompactorProcessor.d.ts +0 -52
- package/dist/processor-pieces/preInference/conversationCompactorProcessor.js +0 -264
- package/dist/processor-pieces/preInference/conversationContinuityProcessor.d.ts +0 -49
- package/dist/processor-pieces/preInference/conversationContinuityProcessor.js +0 -293
- package/dist/processor-pieces/preInferenceProcessors/conversationCompaction.d.ts +0 -7
- package/dist/processor-pieces/preInferenceProcessors/conversationCompaction.js +0 -31
- package/dist/processor-pieces/preToolCall/index.d.ts +0 -9
- package/dist/processor-pieces/preToolCall/index.js +0 -18
- package/dist/processor-pieces/preToolCall/localToolInterceptorProcessor.d.ts +0 -58
- package/dist/processor-pieces/preToolCall/localToolInterceptorProcessor.js +0 -444
- package/dist/processor-pieces/preToolCall/toolParameterModifierProcessor.d.ts +0 -44
- package/dist/processor-pieces/preToolCall/toolParameterModifierProcessor.js +0 -367
- package/dist/processor-pieces/preToolCall/toolValidationProcessor.d.ts +0 -58
- package/dist/processor-pieces/preToolCall/toolValidationProcessor.js +0 -391
- package/dist/unified/agent/tool.d.ts +0 -99
- package/dist/unified/agent/tool.js +0 -440
- package/dist/unified/examples/agentExample.d.ts +0 -46
- package/dist/unified/examples/agentExample.js +0 -464
- package/dist/unified/examples/documentationPatternExample.d.ts +0 -10
- package/dist/unified/examples/documentationPatternExample.js +0 -385
- package/dist/unified/examples/followUpProcessorsExample.d.ts +0 -45
- package/dist/unified/examples/followUpProcessorsExample.js +0 -311
- package/dist/unified/examples/orchestratorExample.d.ts +0 -16
- package/dist/unified/examples/orchestratorExample.js +0 -415
- package/dist/unified/examples/preToolCallProcessorsExample.d.ts +0 -36
- package/dist/unified/examples/preToolCallProcessorsExample.js +0 -458
- package/dist/unified/examples/workflowExample.d.ts +0 -12
- package/dist/unified/examples/workflowExample.js +0 -497
- package/dist/unified/orchestrator/orchestrator.d.ts +0 -260
- package/dist/unified/orchestrator/orchestrator.js +0 -519
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConversationContinuityProcessor = void 0;
|
|
4
|
-
const processor_1 = require("../../processor");
|
|
5
|
-
/**
|
|
6
|
-
* Processor that maintains conversation continuity by linking related messages,
|
|
7
|
-
* resolving references, and detecting context gaps in follow-up conversations.
|
|
8
|
-
*/
|
|
9
|
-
class ConversationContinuityProcessor extends processor_1.BaseProcessor {
|
|
10
|
-
constructor(options = {}) {
|
|
11
|
-
super(options);
|
|
12
|
-
this.enableContextLinking = options.enableContextLinking !== false;
|
|
13
|
-
this.enableReferenceResolution = options.enableReferenceResolution !== false;
|
|
14
|
-
this.enableGapDetection = options.enableGapDetection !== false;
|
|
15
|
-
this.maxContextLinks = options.maxContextLinks || 5;
|
|
16
|
-
this.contextLookbackWindow = options.contextLookbackWindow || 20;
|
|
17
|
-
this.enableProactiveContext = options.enableProactiveContext !== false;
|
|
18
|
-
}
|
|
19
|
-
async processInput(input) {
|
|
20
|
-
try {
|
|
21
|
-
const { message, context } = input;
|
|
22
|
-
// Only process follow-up conversations
|
|
23
|
-
if (!(context === null || context === void 0 ? void 0 : context.followUpProcessing)) {
|
|
24
|
-
return [this.createEvent('ContinuityProcessingSkipped', {
|
|
25
|
-
reason: 'Not a follow-up conversation processing context'
|
|
26
|
-
})];
|
|
27
|
-
}
|
|
28
|
-
const enhancedMessage = await this.enhanceConversationContinuity(message, context);
|
|
29
|
-
const continuityInfo = this.calculateContinuityInfo(message, enhancedMessage, context);
|
|
30
|
-
return [
|
|
31
|
-
this.createEvent('ConversationContinuityProcessed', continuityInfo),
|
|
32
|
-
this.createEvent('ConversationProcessed', enhancedMessage)
|
|
33
|
-
];
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
console.error('Error in ConversationContinuityProcessor:', error);
|
|
37
|
-
return [this.createEvent('ConversationContinuityError', {
|
|
38
|
-
error: error instanceof Error ? error.message : String(error),
|
|
39
|
-
originalLength: input.message.messages.length
|
|
40
|
-
})];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
async enhanceConversationContinuity(message, context) {
|
|
44
|
-
let enhancedMessages = [...message.messages];
|
|
45
|
-
let enhancementsAdded = 0;
|
|
46
|
-
// Add context links if enabled
|
|
47
|
-
if (this.enableContextLinking) {
|
|
48
|
-
const contextLinks = this.addContextLinks(enhancedMessages, context);
|
|
49
|
-
enhancedMessages.push(...contextLinks);
|
|
50
|
-
enhancementsAdded += contextLinks.length;
|
|
51
|
-
}
|
|
52
|
-
// Resolve references if enabled
|
|
53
|
-
if (this.enableReferenceResolution) {
|
|
54
|
-
enhancedMessages = this.resolveReferences(enhancedMessages, context);
|
|
55
|
-
}
|
|
56
|
-
// Detect and fill conversation gaps if enabled
|
|
57
|
-
if (this.enableGapDetection) {
|
|
58
|
-
const gapFillers = this.detectAndFillGaps(enhancedMessages, context);
|
|
59
|
-
enhancedMessages.push(...gapFillers);
|
|
60
|
-
enhancementsAdded += gapFillers.length;
|
|
61
|
-
}
|
|
62
|
-
// Add proactive context if enabled
|
|
63
|
-
if (this.enableProactiveContext) {
|
|
64
|
-
const proactiveContext = this.addProactiveContext(enhancedMessages, context);
|
|
65
|
-
enhancedMessages.push(...proactiveContext);
|
|
66
|
-
enhancementsAdded += proactiveContext.length;
|
|
67
|
-
}
|
|
68
|
-
return {
|
|
69
|
-
...message,
|
|
70
|
-
messages: enhancedMessages,
|
|
71
|
-
metadata: {
|
|
72
|
-
...message.metadata,
|
|
73
|
-
continuityEnhanced: true,
|
|
74
|
-
enhancementsAdded,
|
|
75
|
-
timestamp: new Date().toISOString()
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
addContextLinks(messages, context) {
|
|
80
|
-
const contextLinks = [];
|
|
81
|
-
const recentMessages = messages.slice(-this.contextLookbackWindow);
|
|
82
|
-
// Find messages that reference previous interactions
|
|
83
|
-
const referencingMessages = this.findReferencingMessages(recentMessages);
|
|
84
|
-
if (referencingMessages.length > 0) {
|
|
85
|
-
const linkMessage = {
|
|
86
|
-
role: 'system',
|
|
87
|
-
content: this.generateContextLinkMessage(referencingMessages, context),
|
|
88
|
-
name: 'context-link'
|
|
89
|
-
};
|
|
90
|
-
contextLinks.push(linkMessage);
|
|
91
|
-
}
|
|
92
|
-
return contextLinks.slice(0, this.maxContextLinks);
|
|
93
|
-
}
|
|
94
|
-
findReferencingMessages(messages) {
|
|
95
|
-
const referencePatterns = [
|
|
96
|
-
/\b(this|that|it|they|them)\b/i,
|
|
97
|
-
/\b(the (above|previous|last|earlier))\b/i,
|
|
98
|
-
/\b(as (mentioned|discussed|shown))\b/i,
|
|
99
|
-
/\b(from (before|earlier))\b/i,
|
|
100
|
-
/\b(the (file|code|result|output))\b/i
|
|
101
|
-
];
|
|
102
|
-
return messages.filter(message => {
|
|
103
|
-
const content = typeof message.content === 'string'
|
|
104
|
-
? message.content
|
|
105
|
-
: JSON.stringify(message.content);
|
|
106
|
-
return referencePatterns.some(pattern => pattern.test(content));
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
generateContextLinkMessage(referencingMessages, context) {
|
|
110
|
-
const messageCount = referencingMessages.length;
|
|
111
|
-
const toolResults = context.toolResults || [];
|
|
112
|
-
let linkMessage = `**Context Links:** Found ${messageCount} message${messageCount > 1 ? 's' : ''} with references to previous interactions.`;
|
|
113
|
-
if (toolResults.length > 0) {
|
|
114
|
-
linkMessage += ` Recent tool executions: ${toolResults.length} tool${toolResults.length > 1 ? 's' : ''} executed.`;
|
|
115
|
-
}
|
|
116
|
-
if (context.originalHistory && context.originalHistory.length > 0) {
|
|
117
|
-
linkMessage += ` Conversation history: ${context.originalHistory.length} previous messages available for reference.`;
|
|
118
|
-
}
|
|
119
|
-
return linkMessage;
|
|
120
|
-
}
|
|
121
|
-
resolveReferences(messages, context) {
|
|
122
|
-
return messages.map(message => {
|
|
123
|
-
if (message.role === 'system' || message.name === 'reference-resolution') {
|
|
124
|
-
return message;
|
|
125
|
-
}
|
|
126
|
-
const resolvedContent = this.resolveMessageReferences(message.content, context);
|
|
127
|
-
if (resolvedContent !== message.content) {
|
|
128
|
-
return {
|
|
129
|
-
...message,
|
|
130
|
-
content: resolvedContent,
|
|
131
|
-
name: message.name || 'reference-resolved'
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
return message;
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
resolveMessageReferences(content, context) {
|
|
138
|
-
if (typeof content !== 'string') {
|
|
139
|
-
return content;
|
|
140
|
-
}
|
|
141
|
-
let resolvedContent = content;
|
|
142
|
-
const toolResults = context.toolResults || [];
|
|
143
|
-
// Resolve "the file" references
|
|
144
|
-
if (/\bthe file\b/i.test(resolvedContent) && toolResults.length > 0) {
|
|
145
|
-
const fileOperations = toolResults.filter((result) => result.tool_call_id && result.tool_call_id.includes('file'));
|
|
146
|
-
if (fileOperations.length === 1) {
|
|
147
|
-
resolvedContent = resolvedContent.replace(/\bthe file\b/gi, `the file (from recent tool execution)`);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
// Resolve "the result" references
|
|
151
|
-
if (/\bthe result\b/i.test(resolvedContent) && toolResults.length > 0) {
|
|
152
|
-
resolvedContent = resolvedContent.replace(/\bthe result\b/gi, `the result (from ${toolResults.length} recent tool execution${toolResults.length > 1 ? 's' : ''})`);
|
|
153
|
-
}
|
|
154
|
-
// Resolve "it" references in context of tool operations
|
|
155
|
-
if (/\bit\b/i.test(resolvedContent) && toolResults.length === 1) {
|
|
156
|
-
const toolResult = toolResults[0];
|
|
157
|
-
if (toolResult.tool_call_id) {
|
|
158
|
-
resolvedContent = resolvedContent.replace(/\bit\b/gi, `it (referring to the tool execution result)`);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return resolvedContent;
|
|
162
|
-
}
|
|
163
|
-
detectAndFillGaps(messages, context) {
|
|
164
|
-
const gapFillers = [];
|
|
165
|
-
const gaps = this.detectConversationGaps(messages, context);
|
|
166
|
-
gaps.forEach(gap => {
|
|
167
|
-
const fillerMessage = {
|
|
168
|
-
role: 'system',
|
|
169
|
-
content: this.generateGapFillerMessage(gap, context),
|
|
170
|
-
name: 'gap-filler'
|
|
171
|
-
};
|
|
172
|
-
gapFillers.push(fillerMessage);
|
|
173
|
-
});
|
|
174
|
-
return gapFillers;
|
|
175
|
-
}
|
|
176
|
-
detectConversationGaps(messages, context) {
|
|
177
|
-
const gaps = [];
|
|
178
|
-
const toolResults = context.toolResults || [];
|
|
179
|
-
// Gap: Tool results without explanation
|
|
180
|
-
const unexplainedToolResults = toolResults.filter((result) => {
|
|
181
|
-
const hasExplanation = messages.some(msg => msg.role === 'assistant' &&
|
|
182
|
-
typeof msg.content === 'string' &&
|
|
183
|
-
msg.content.includes('result'));
|
|
184
|
-
return !hasExplanation;
|
|
185
|
-
});
|
|
186
|
-
if (unexplainedToolResults.length > 0) {
|
|
187
|
-
gaps.push({
|
|
188
|
-
type: 'unexplained-tool-results',
|
|
189
|
-
description: `${unexplainedToolResults.length} tool result(s) without explanation`,
|
|
190
|
-
severity: 'medium'
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
// Gap: Missing context for references
|
|
194
|
-
const unresolvedReferences = messages.filter(msg => {
|
|
195
|
-
const content = typeof msg.content === 'string' ? msg.content : JSON.stringify(msg.content);
|
|
196
|
-
return /\b(this|that|it)\b/i.test(content) && msg.role === 'user';
|
|
197
|
-
});
|
|
198
|
-
if (unresolvedReferences.length > 2) {
|
|
199
|
-
gaps.push({
|
|
200
|
-
type: 'unresolved-references',
|
|
201
|
-
description: `${unresolvedReferences.length} messages with unclear references`,
|
|
202
|
-
severity: 'low'
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
// Gap: Long silence after tool execution
|
|
206
|
-
const lastToolIndex = messages.findLastIndex(msg => msg.role === 'tool');
|
|
207
|
-
const lastAssistantIndex = messages.findLastIndex(msg => msg.role === 'assistant');
|
|
208
|
-
if (lastToolIndex > lastAssistantIndex && lastToolIndex < messages.length - 1) {
|
|
209
|
-
gaps.push({
|
|
210
|
-
type: 'missing-tool-response',
|
|
211
|
-
description: 'Tool execution without assistant response',
|
|
212
|
-
severity: 'high'
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
return gaps;
|
|
216
|
-
}
|
|
217
|
-
generateGapFillerMessage(gap, context) {
|
|
218
|
-
switch (gap.type) {
|
|
219
|
-
case 'unexplained-tool-results':
|
|
220
|
-
return `**Context Note:** There are tool execution results that may need explanation or analysis. Consider reviewing the tool outputs and their implications.`;
|
|
221
|
-
case 'unresolved-references':
|
|
222
|
-
return `**Context Note:** Some messages contain references that might be unclear. Consider providing more specific context when referring to previous interactions.`;
|
|
223
|
-
case 'missing-tool-response':
|
|
224
|
-
return `**Context Note:** Recent tool execution completed but may need assistant analysis or response to continue the conversation effectively.`;
|
|
225
|
-
default:
|
|
226
|
-
return `**Context Note:** Potential conversation gap detected: ${gap.description}`;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
addProactiveContext(messages, context) {
|
|
230
|
-
const proactiveMessages = [];
|
|
231
|
-
const toolResults = context.toolResults || [];
|
|
232
|
-
const conversationLength = messages.length;
|
|
233
|
-
// Add proactive context for complex tool interactions
|
|
234
|
-
if (toolResults.length > 3) {
|
|
235
|
-
proactiveMessages.push({
|
|
236
|
-
role: 'system',
|
|
237
|
-
content: `**Proactive Context:** Multiple tools have been executed (${toolResults.length} total). This suggests a complex task that may benefit from step-by-step progress tracking.`,
|
|
238
|
-
name: 'proactive-context'
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
// Add proactive context for long conversations
|
|
242
|
-
if (conversationLength > 25) {
|
|
243
|
-
proactiveMessages.push({
|
|
244
|
-
role: 'system',
|
|
245
|
-
content: `**Proactive Context:** This is an extended conversation (${conversationLength} messages). Consider summarizing progress or breaking down remaining objectives.`,
|
|
246
|
-
name: 'proactive-context'
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
return proactiveMessages.slice(0, 2); // Limit proactive messages
|
|
250
|
-
}
|
|
251
|
-
calculateContinuityInfo(original, enhanced, context) {
|
|
252
|
-
const originalCount = original.messages.length;
|
|
253
|
-
const enhancedCount = enhanced.messages.length;
|
|
254
|
-
const addedMessages = enhancedCount - originalCount;
|
|
255
|
-
// Count different types of enhancements
|
|
256
|
-
const contextLinks = enhanced.messages.filter(m => m.name === 'context-link').length;
|
|
257
|
-
const referenceResolutions = enhanced.messages.filter(m => m.name === 'reference-resolved').length;
|
|
258
|
-
const gapFillers = enhanced.messages.filter(m => m.name === 'gap-filler').length;
|
|
259
|
-
return {
|
|
260
|
-
contextLinksAdded: contextLinks,
|
|
261
|
-
referenceResolutionsAdded: referenceResolutions,
|
|
262
|
-
continuityEnhanced: addedMessages > 0,
|
|
263
|
-
missingContextDetected: gapFillers > 0,
|
|
264
|
-
conversationGapsFound: gapFillers
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
// Public methods for configuration
|
|
268
|
-
setContextLookbackWindow(window) {
|
|
269
|
-
this.contextLookbackWindow = Math.max(5, Math.min(50, window));
|
|
270
|
-
}
|
|
271
|
-
setMaxContextLinks(max) {
|
|
272
|
-
this.maxContextLinks = Math.max(1, Math.min(10, max));
|
|
273
|
-
}
|
|
274
|
-
enableContextLinkingForSession() {
|
|
275
|
-
this.enableContextLinking = true;
|
|
276
|
-
}
|
|
277
|
-
disableContextLinkingForSession() {
|
|
278
|
-
this.enableContextLinking = false;
|
|
279
|
-
}
|
|
280
|
-
enableReferenceResolutionForSession() {
|
|
281
|
-
this.enableReferenceResolution = true;
|
|
282
|
-
}
|
|
283
|
-
disableReferenceResolutionForSession() {
|
|
284
|
-
this.enableReferenceResolution = false;
|
|
285
|
-
}
|
|
286
|
-
enableGapDetectionForSession() {
|
|
287
|
-
this.enableGapDetection = true;
|
|
288
|
-
}
|
|
289
|
-
disableGapDetectionForSession() {
|
|
290
|
-
this.enableGapDetection = false;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
exports.ConversationContinuityProcessor = ConversationContinuityProcessor;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { BaseProcessor, ProcessorInput, ProcessorOutput } from '../../processor';
|
|
2
|
-
export interface FollowUpConversationInfo {
|
|
3
|
-
toolResultsProcessed: number;
|
|
4
|
-
followUpMessagesAdded: number;
|
|
5
|
-
conversationEnhanced: boolean;
|
|
6
|
-
processingMethod: 'automatic' | 'guided' | 'minimal';
|
|
7
|
-
}
|
|
8
|
-
export interface FollowUpConversationProcessorOptions {
|
|
9
|
-
addFollowUpPrompts?: boolean;
|
|
10
|
-
enhanceToolResults?: boolean;
|
|
11
|
-
addContextualHints?: boolean;
|
|
12
|
-
processingMode?: 'automatic' | 'guided' | 'minimal';
|
|
13
|
-
maxFollowUpMessages?: number;
|
|
14
|
-
enableToolResultEnhancement?: boolean;
|
|
15
|
-
enableConversationGuidance?: boolean;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Processor that enhances follow-up conversations by adding contextual information,
|
|
19
|
-
* improving tool result presentation, and providing guidance for continued interaction.
|
|
20
|
-
*/
|
|
21
|
-
export declare class FollowUpConversationProcessor extends BaseProcessor {
|
|
22
|
-
private readonly addFollowUpPrompts;
|
|
23
|
-
private readonly enhanceToolResults;
|
|
24
|
-
private readonly addContextualHints;
|
|
25
|
-
private readonly processingMode;
|
|
26
|
-
private readonly maxFollowUpMessages;
|
|
27
|
-
private readonly enableToolResultEnhancement;
|
|
28
|
-
private readonly enableConversationGuidance;
|
|
29
|
-
constructor(options?: FollowUpConversationProcessorOptions);
|
|
30
|
-
processInput(input: ProcessorInput): Promise<ProcessorOutput[]>;
|
|
31
|
-
private enhanceFollowUpConversation;
|
|
32
|
-
private enhanceToolResultMessages;
|
|
33
|
-
private enhanceToolResultContent;
|
|
34
|
-
private generateFollowUpPrompts;
|
|
35
|
-
private generateGuidedPrompts;
|
|
36
|
-
private generateAutomaticPrompts;
|
|
37
|
-
private generateContextualHints;
|
|
38
|
-
private calculateProcessingInfo;
|
|
39
|
-
setProcessingMode(mode: 'automatic' | 'guided' | 'minimal'): void;
|
|
40
|
-
setMaxFollowUpMessages(count: number): void;
|
|
41
|
-
enableFollowUpPromptsForSession(): void;
|
|
42
|
-
disableFollowUpPromptsForSession(): void;
|
|
43
|
-
enableToolResultEnhancementForSession(): void;
|
|
44
|
-
disableToolResultEnhancementForSession(): void;
|
|
45
|
-
enableConversationGuidanceForSession(): void;
|
|
46
|
-
disableConversationGuidanceForSession(): void;
|
|
47
|
-
}
|
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FollowUpConversationProcessor = void 0;
|
|
4
|
-
const processor_1 = require("../../processor");
|
|
5
|
-
/**
|
|
6
|
-
* Processor that enhances follow-up conversations by adding contextual information,
|
|
7
|
-
* improving tool result presentation, and providing guidance for continued interaction.
|
|
8
|
-
*/
|
|
9
|
-
class FollowUpConversationProcessor extends processor_1.BaseProcessor {
|
|
10
|
-
constructor(options = {}) {
|
|
11
|
-
super(options);
|
|
12
|
-
this.addFollowUpPrompts = options.addFollowUpPrompts !== false;
|
|
13
|
-
this.enhanceToolResults = options.enhanceToolResults !== false;
|
|
14
|
-
this.addContextualHints = options.addContextualHints !== false;
|
|
15
|
-
this.processingMode = options.processingMode || 'automatic';
|
|
16
|
-
this.maxFollowUpMessages = options.maxFollowUpMessages || 3;
|
|
17
|
-
this.enableToolResultEnhancement = options.enableToolResultEnhancement !== false;
|
|
18
|
-
this.enableConversationGuidance = options.enableConversationGuidance !== false;
|
|
19
|
-
}
|
|
20
|
-
async processInput(input) {
|
|
21
|
-
try {
|
|
22
|
-
const { message, context } = input;
|
|
23
|
-
// Check if this is a follow-up conversation processing
|
|
24
|
-
if (!(context === null || context === void 0 ? void 0 : context.followUpProcessing)) {
|
|
25
|
-
return [this.createEvent('FollowUpProcessingSkipped', {
|
|
26
|
-
reason: 'Not a follow-up conversation processing context'
|
|
27
|
-
})];
|
|
28
|
-
}
|
|
29
|
-
const enhancedMessage = await this.enhanceFollowUpConversation(message, context);
|
|
30
|
-
const processingInfo = this.calculateProcessingInfo(message, enhancedMessage, context);
|
|
31
|
-
return [
|
|
32
|
-
this.createEvent('FollowUpConversationProcessed', processingInfo),
|
|
33
|
-
this.createEvent('ConversationProcessed', enhancedMessage)
|
|
34
|
-
];
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
console.error('Error in FollowUpConversationProcessor:', error);
|
|
38
|
-
return [this.createEvent('FollowUpConversationError', {
|
|
39
|
-
error: error instanceof Error ? error.message : String(error),
|
|
40
|
-
originalLength: input.message.messages.length
|
|
41
|
-
})];
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
async enhanceFollowUpConversation(message, context) {
|
|
45
|
-
let enhancedMessages = [...message.messages];
|
|
46
|
-
let enhancementsAdded = 0;
|
|
47
|
-
// Enhance tool results if enabled
|
|
48
|
-
if (this.enableToolResultEnhancement && this.enhanceToolResults) {
|
|
49
|
-
enhancedMessages = this.enhanceToolResultMessages(enhancedMessages, context);
|
|
50
|
-
enhancementsAdded++;
|
|
51
|
-
}
|
|
52
|
-
// Add follow-up prompts if enabled
|
|
53
|
-
if (this.addFollowUpPrompts && this.processingMode !== 'minimal') {
|
|
54
|
-
const followUpMessages = this.generateFollowUpPrompts(enhancedMessages, context);
|
|
55
|
-
enhancedMessages.push(...followUpMessages);
|
|
56
|
-
enhancementsAdded += followUpMessages.length;
|
|
57
|
-
}
|
|
58
|
-
// Add contextual hints if enabled
|
|
59
|
-
if (this.addContextualHints && this.enableConversationGuidance) {
|
|
60
|
-
const contextualMessages = this.generateContextualHints(enhancedMessages, context);
|
|
61
|
-
enhancedMessages.push(...contextualMessages);
|
|
62
|
-
enhancementsAdded += contextualMessages.length;
|
|
63
|
-
}
|
|
64
|
-
return {
|
|
65
|
-
...message,
|
|
66
|
-
messages: enhancedMessages,
|
|
67
|
-
metadata: {
|
|
68
|
-
...message.metadata,
|
|
69
|
-
followUpEnhanced: true,
|
|
70
|
-
enhancementsAdded,
|
|
71
|
-
processingMode: this.processingMode,
|
|
72
|
-
timestamp: new Date().toISOString()
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
enhanceToolResultMessages(messages, context) {
|
|
77
|
-
return messages.map(message => {
|
|
78
|
-
if (message.role !== 'tool') {
|
|
79
|
-
return message;
|
|
80
|
-
}
|
|
81
|
-
// Enhance tool result presentation
|
|
82
|
-
const enhancedContent = this.enhanceToolResultContent(message.content, context);
|
|
83
|
-
return {
|
|
84
|
-
...message,
|
|
85
|
-
content: enhancedContent,
|
|
86
|
-
name: message.name || 'tool-result'
|
|
87
|
-
};
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
enhanceToolResultContent(content, context) {
|
|
91
|
-
if (typeof content !== 'string') {
|
|
92
|
-
return content;
|
|
93
|
-
}
|
|
94
|
-
// Add formatting and context to tool results
|
|
95
|
-
let enhancedContent = content;
|
|
96
|
-
// Add success/failure indicators
|
|
97
|
-
if (content.toLowerCase().includes('error') || content.toLowerCase().includes('failed')) {
|
|
98
|
-
enhancedContent = `❌ **Tool Execution Result:**\n${content}\n\n*The tool encountered an issue. Please review the error and try again if needed.*`;
|
|
99
|
-
}
|
|
100
|
-
else if (content.toLowerCase().includes('success') || content.toLowerCase().includes('completed')) {
|
|
101
|
-
enhancedContent = `✅ **Tool Execution Result:**\n${content}\n\n*The tool executed successfully.*`;
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
enhancedContent = `🔧 **Tool Execution Result:**\n${content}`;
|
|
105
|
-
}
|
|
106
|
-
// Add tool execution context if available
|
|
107
|
-
if (context.toolResults && Array.isArray(context.toolResults)) {
|
|
108
|
-
const toolCount = context.toolResults.length;
|
|
109
|
-
if (toolCount > 1) {
|
|
110
|
-
enhancedContent += `\n\n*This is one of ${toolCount} tool results in this interaction.*`;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return enhancedContent;
|
|
114
|
-
}
|
|
115
|
-
generateFollowUpPrompts(messages, context) {
|
|
116
|
-
const followUpMessages = [];
|
|
117
|
-
const toolResults = context.toolResults || [];
|
|
118
|
-
const hasErrors = toolResults.some((result) => result.content && result.content.toLowerCase().includes('error'));
|
|
119
|
-
// Add different prompts based on processing mode
|
|
120
|
-
switch (this.processingMode) {
|
|
121
|
-
case 'guided':
|
|
122
|
-
followUpMessages.push(...this.generateGuidedPrompts(messages, context, hasErrors));
|
|
123
|
-
break;
|
|
124
|
-
case 'automatic':
|
|
125
|
-
followUpMessages.push(...this.generateAutomaticPrompts(messages, context, hasErrors));
|
|
126
|
-
break;
|
|
127
|
-
case 'minimal':
|
|
128
|
-
// Minimal mode doesn't add prompts
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
// Limit the number of follow-up messages
|
|
132
|
-
return followUpMessages.slice(0, this.maxFollowUpMessages);
|
|
133
|
-
}
|
|
134
|
-
generateGuidedPrompts(messages, context, hasErrors) {
|
|
135
|
-
var _a;
|
|
136
|
-
const prompts = [];
|
|
137
|
-
if (hasErrors) {
|
|
138
|
-
prompts.push({
|
|
139
|
-
role: 'user',
|
|
140
|
-
content: "I notice there were some errors in the tool execution. Would you like me to:\n1. Retry the failed operations\n2. Try an alternative approach\n3. Provide more details about the errors\n4. Continue with the successful results\n\nPlease let me know how you'd like to proceed.",
|
|
141
|
-
name: 'error-guidance-prompt'
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
const toolCount = ((_a = context.toolResults) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
146
|
-
if (toolCount > 0) {
|
|
147
|
-
prompts.push({
|
|
148
|
-
role: 'user',
|
|
149
|
-
content: `The tools have been executed successfully. Based on the results, would you like me to:\n1. Analyze the results further\n2. Perform additional related tasks\n3. Provide a summary of what was accomplished\n4. Continue with the next steps\n\nWhat would be most helpful?`,
|
|
150
|
-
name: 'success-guidance-prompt'
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
return prompts;
|
|
155
|
-
}
|
|
156
|
-
generateAutomaticPrompts(messages, context, hasErrors) {
|
|
157
|
-
var _a;
|
|
158
|
-
const prompts = [];
|
|
159
|
-
if (hasErrors) {
|
|
160
|
-
prompts.push({
|
|
161
|
-
role: 'user',
|
|
162
|
-
content: "Please review the errors above and suggest how to resolve them or continue with alternative approaches.",
|
|
163
|
-
name: 'automatic-error-prompt'
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
const toolCount = ((_a = context.toolResults) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
168
|
-
if (toolCount > 0) {
|
|
169
|
-
prompts.push({
|
|
170
|
-
role: 'user',
|
|
171
|
-
content: "Please analyze the tool execution results and let me know if there are any next steps or if the task has been completed successfully.",
|
|
172
|
-
name: 'automatic-success-prompt'
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return prompts;
|
|
177
|
-
}
|
|
178
|
-
generateContextualHints(messages, context) {
|
|
179
|
-
const hints = [];
|
|
180
|
-
const toolResults = context.toolResults || [];
|
|
181
|
-
const conversationLength = context.conversationLength || 0;
|
|
182
|
-
// Add hints based on conversation state
|
|
183
|
-
if (conversationLength > 30) {
|
|
184
|
-
hints.push({
|
|
185
|
-
role: 'system',
|
|
186
|
-
content: "Note: This conversation is getting quite long. Consider summarizing progress or breaking down remaining tasks into smaller steps.",
|
|
187
|
-
name: 'conversation-length-hint'
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
// Add hints based on tool execution patterns
|
|
191
|
-
if (toolResults.length > 5) {
|
|
192
|
-
hints.push({
|
|
193
|
-
role: 'system',
|
|
194
|
-
content: "Multiple tools have been executed in this interaction. Consider reviewing the overall progress and determining if the objectives have been met.",
|
|
195
|
-
name: 'tool-execution-hint'
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
// Add hints for specific tool types
|
|
199
|
-
const fileOperations = toolResults.filter((result) => result.tool_call_id && (result.tool_call_id.includes('file') ||
|
|
200
|
-
result.tool_call_id.includes('read') ||
|
|
201
|
-
result.tool_call_id.includes('write')));
|
|
202
|
-
if (fileOperations.length > 0) {
|
|
203
|
-
hints.push({
|
|
204
|
-
role: 'system',
|
|
205
|
-
content: "File operations have been performed. Consider verifying the changes and ensuring all modifications are correct.",
|
|
206
|
-
name: 'file-operations-hint'
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
return hints.slice(0, 2); // Limit hints to avoid clutter
|
|
210
|
-
}
|
|
211
|
-
calculateProcessingInfo(original, enhanced, context) {
|
|
212
|
-
var _a;
|
|
213
|
-
const originalCount = original.messages.length;
|
|
214
|
-
const enhancedCount = enhanced.messages.length;
|
|
215
|
-
const toolResultsCount = ((_a = context.toolResults) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
216
|
-
return {
|
|
217
|
-
toolResultsProcessed: toolResultsCount,
|
|
218
|
-
followUpMessagesAdded: enhancedCount - originalCount,
|
|
219
|
-
conversationEnhanced: enhancedCount > originalCount,
|
|
220
|
-
processingMethod: this.processingMode
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
// Public methods for configuration
|
|
224
|
-
setProcessingMode(mode) {
|
|
225
|
-
this.processingMode = mode;
|
|
226
|
-
}
|
|
227
|
-
setMaxFollowUpMessages(count) {
|
|
228
|
-
this.maxFollowUpMessages = Math.max(0, Math.min(10, count));
|
|
229
|
-
}
|
|
230
|
-
enableFollowUpPromptsForSession() {
|
|
231
|
-
this.addFollowUpPrompts = true;
|
|
232
|
-
}
|
|
233
|
-
disableFollowUpPromptsForSession() {
|
|
234
|
-
this.addFollowUpPrompts = false;
|
|
235
|
-
}
|
|
236
|
-
enableToolResultEnhancementForSession() {
|
|
237
|
-
this.enableToolResultEnhancement = true;
|
|
238
|
-
}
|
|
239
|
-
disableToolResultEnhancementForSession() {
|
|
240
|
-
this.enableToolResultEnhancement = false;
|
|
241
|
-
}
|
|
242
|
-
enableConversationGuidanceForSession() {
|
|
243
|
-
this.enableConversationGuidance = true;
|
|
244
|
-
}
|
|
245
|
-
disableConversationGuidanceForSession() {
|
|
246
|
-
this.enableConversationGuidance = false;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
exports.FollowUpConversationProcessor = FollowUpConversationProcessor;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { BaseProcessor, ProcessorInput, ProcessorOutput } from '../../processor';
|
|
2
|
-
export interface LoopDetectionInfo {
|
|
3
|
-
promptId: string;
|
|
4
|
-
loopCount: number;
|
|
5
|
-
maxLoops: number;
|
|
6
|
-
recentMessages: any[];
|
|
7
|
-
isLoop: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface LoopDetectionProcessorOptions {
|
|
10
|
-
maxLoops?: number;
|
|
11
|
-
messageThreshold?: number;
|
|
12
|
-
enableLoopDetection?: boolean;
|
|
13
|
-
}
|
|
14
|
-
export declare class LoopDetectionProcessor extends BaseProcessor {
|
|
15
|
-
private readonly maxLoops;
|
|
16
|
-
private readonly messageThreshold;
|
|
17
|
-
private readonly enableLoopDetection;
|
|
18
|
-
private lastPromptId;
|
|
19
|
-
private loopCount;
|
|
20
|
-
constructor(options?: LoopDetectionProcessorOptions);
|
|
21
|
-
processInput(input: ProcessorInput): Promise<ProcessorOutput[]>;
|
|
22
|
-
private generatePromptId;
|
|
23
|
-
private resetLoopDetector;
|
|
24
|
-
private checkLoopDetection;
|
|
25
|
-
resetSession(): void;
|
|
26
|
-
getCurrentLoopCount(): number;
|
|
27
|
-
setMaxLoops(maxLoops: number): void;
|
|
28
|
-
enableLoopDetectionForSession(): void;
|
|
29
|
-
disableLoopDetectionForSession(): void;
|
|
30
|
-
}
|