@codebolt/agent 5.0.2 → 5.0.7
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/types/libFunctionTypes.d.ts +13 -19
- package/dist/types/libFunctionTypes.js +3 -0
- package/dist/types/processorTypes.d.ts +8 -8
- package/dist/types/processorTypes.js +6 -23
- 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 +109 -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 +11 -6
- 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
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SystemPrompt class for loading and managing system prompts from YAML files
|
|
3
|
+
*/
|
|
4
|
+
declare class SystemPrompt {
|
|
5
|
+
private filepath;
|
|
6
|
+
private key;
|
|
7
|
+
/**
|
|
8
|
+
* Creates a SystemPrompt instance
|
|
9
|
+
* @param {string} filepath - Path to the YAML file containing prompts
|
|
10
|
+
* @param {string} key - Key identifier for the specific prompt
|
|
11
|
+
*/
|
|
12
|
+
constructor(filepath?: string, key?: string);
|
|
13
|
+
/**
|
|
14
|
+
* Loads and returns the prompt text
|
|
15
|
+
* @returns {string} The prompt text
|
|
16
|
+
* @throws {Error} If file cannot be read or parsed
|
|
17
|
+
*/
|
|
18
|
+
toPromptText(): string;
|
|
19
|
+
}
|
|
20
|
+
export { SystemPrompt };
|
|
@@ -0,0 +1,48 @@
|
|
|
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.SystemPrompt = void 0;
|
|
7
|
+
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
/**
|
|
11
|
+
* SystemPrompt class for loading and managing system prompts from YAML files
|
|
12
|
+
*/
|
|
13
|
+
class SystemPrompt {
|
|
14
|
+
/**
|
|
15
|
+
* Creates a SystemPrompt instance
|
|
16
|
+
* @param {string} filepath - Path to the YAML file containing prompts
|
|
17
|
+
* @param {string} key - Key identifier for the specific prompt
|
|
18
|
+
*/
|
|
19
|
+
constructor(filepath = "", key = "") {
|
|
20
|
+
this.filepath = filepath;
|
|
21
|
+
this.key = key;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Loads and returns the prompt text
|
|
25
|
+
* @returns {string} The prompt text
|
|
26
|
+
* @throws {Error} If file cannot be read or parsed
|
|
27
|
+
*/
|
|
28
|
+
toPromptText() {
|
|
29
|
+
try {
|
|
30
|
+
const absolutePath = path_1.default.resolve(this.filepath);
|
|
31
|
+
const fileContents = fs_1.default.readFileSync(absolutePath, 'utf8');
|
|
32
|
+
const data = js_yaml_1.default.load(fileContents);
|
|
33
|
+
if (!data || typeof data !== 'object') {
|
|
34
|
+
throw new Error('Invalid YAML structure');
|
|
35
|
+
}
|
|
36
|
+
if (!data[this.key]) {
|
|
37
|
+
throw new Error(`Prompt not found for key: ${this.key}`);
|
|
38
|
+
}
|
|
39
|
+
const promptData = data[this.key];
|
|
40
|
+
return typeof promptData === 'string' ? promptData : promptData.prompt;
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
console.error(`SystemPrompt Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
44
|
+
throw error; // Re-throw to allow caller handling
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.SystemPrompt = SystemPrompt;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { UserMessage } from "./usermessage";
|
|
2
|
+
import type { UserMessageContent } from "./types/libFunctionTypes";
|
|
3
|
+
import type { Tools, UserMessages } from "./types/InternalTypes";
|
|
4
|
+
/**
|
|
5
|
+
* Class representing a task instruction.
|
|
6
|
+
* Handles loading task data and converting it to prompts.
|
|
7
|
+
*/
|
|
8
|
+
declare class TaskInstruction {
|
|
9
|
+
/** Available tools for the task */
|
|
10
|
+
tools: Tools;
|
|
11
|
+
/** Messages from the user for this task */
|
|
12
|
+
userMessages: UserMessageContent[];
|
|
13
|
+
/** The user message object containing input */
|
|
14
|
+
userMessage: UserMessage;
|
|
15
|
+
/** Path to the YAML file with task instructions */
|
|
16
|
+
filepath: string;
|
|
17
|
+
/** The section reference within the YAML file */
|
|
18
|
+
refsection: string;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new TaskInstruction instance.
|
|
21
|
+
*
|
|
22
|
+
* @param tools - Tools available for this task
|
|
23
|
+
* @param userMessage - User message containing task instructions
|
|
24
|
+
* @param filepath - Path to the YAML file with task data
|
|
25
|
+
* @param refsection - Section name within the YAML file
|
|
26
|
+
*/
|
|
27
|
+
constructor(tools: Tools | undefined, userMessage: UserMessage, filepath?: string, refsection?: string);
|
|
28
|
+
/**
|
|
29
|
+
* Converts the task instruction to a prompt format.
|
|
30
|
+
* Loads data from YAML file and combines with user message.
|
|
31
|
+
*
|
|
32
|
+
* @returns Promise with an array of user message content blocks
|
|
33
|
+
* @throws Error if there's an issue processing the task instruction
|
|
34
|
+
*/
|
|
35
|
+
toPrompt(): Promise<UserMessages[]>;
|
|
36
|
+
}
|
|
37
|
+
export { TaskInstruction };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TaskInstruction = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Encapsulates task instructions and their related metadata.
|
|
6
|
+
* Handles loading and processing of task instructions from YAML files.
|
|
7
|
+
*/
|
|
8
|
+
const yaml = require('js-yaml');
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
/**
|
|
12
|
+
* Class representing a task instruction.
|
|
13
|
+
* Handles loading task data and converting it to prompts.
|
|
14
|
+
*/
|
|
15
|
+
class TaskInstruction {
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new TaskInstruction instance.
|
|
18
|
+
*
|
|
19
|
+
* @param tools - Tools available for this task
|
|
20
|
+
* @param userMessage - User message containing task instructions
|
|
21
|
+
* @param filepath - Path to the YAML file with task data
|
|
22
|
+
* @param refsection - Section name within the YAML file
|
|
23
|
+
*/
|
|
24
|
+
constructor(tools = {}, userMessage, filepath = "", refsection = "") {
|
|
25
|
+
/** Messages from the user for this task */
|
|
26
|
+
this.userMessages = [];
|
|
27
|
+
this.tools = tools;
|
|
28
|
+
this.userMessage = userMessage;
|
|
29
|
+
this.filepath = filepath;
|
|
30
|
+
this.refsection = refsection;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Converts the task instruction to a prompt format.
|
|
34
|
+
* Loads data from YAML file and combines with user message.
|
|
35
|
+
*
|
|
36
|
+
* @returns Promise with an array of user message content blocks
|
|
37
|
+
* @throws Error if there's an issue processing the task instruction
|
|
38
|
+
*/
|
|
39
|
+
async toPrompt() {
|
|
40
|
+
try {
|
|
41
|
+
this.userMessages = await this.userMessage.toPrompt();
|
|
42
|
+
const fileContents = fs.readFileSync(path.resolve(this.filepath), 'utf8');
|
|
43
|
+
const data = yaml.load(fileContents);
|
|
44
|
+
const task = data[this.refsection];
|
|
45
|
+
this.userMessages.push({
|
|
46
|
+
type: "text",
|
|
47
|
+
text: `Task Description: ${task.description}\nExpected Output: ${task.expected_output}`
|
|
48
|
+
});
|
|
49
|
+
return this.userMessages;
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
console.error(`Error processing task instruction: ${error}`);
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.TaskInstruction = TaskInstruction;
|
|
@@ -6,9 +6,17 @@
|
|
|
6
6
|
* - API interfaces exposed to library users
|
|
7
7
|
* - Configuration options for library functions
|
|
8
8
|
* - User-facing data structures
|
|
9
|
+
*
|
|
10
|
+
* Note: Core message and tool types are imported from @codebolt/types/sdk.
|
|
11
|
+
* Local extensions are provided for backward compatibility.
|
|
9
12
|
*/
|
|
13
|
+
import type { MessageObject, ToolCall as SDKToolCall, ToolChoice, LLMCompletion } from '@codebolt/types/sdk';
|
|
14
|
+
import type { ToolResult as AgentToolResult } from '@codebolt/types/agent';
|
|
15
|
+
export type { MessageObject, ToolChoice, LLMCompletion };
|
|
16
|
+
export type { AgentToolResult };
|
|
10
17
|
/**
|
|
11
18
|
* Represents a message in the conversation with roles and content.
|
|
19
|
+
* Extended version with looser typing for backward compatibility.
|
|
12
20
|
*/
|
|
13
21
|
export interface Message {
|
|
14
22
|
/** The role of the message sender: user, assistant, tool, or system */
|
|
@@ -24,22 +32,12 @@ export interface Message {
|
|
|
24
32
|
}
|
|
25
33
|
/**
|
|
26
34
|
* Represents a tool call in OpenAI format
|
|
35
|
+
* Re-exported from SDK with same structure
|
|
27
36
|
*/
|
|
28
|
-
export
|
|
29
|
-
/** Unique identifier for this tool call */
|
|
30
|
-
id: string;
|
|
31
|
-
/** The type of tool call */
|
|
32
|
-
type: 'function';
|
|
33
|
-
/** Function call details */
|
|
34
|
-
function: {
|
|
35
|
-
/** Name of the function to call */
|
|
36
|
-
name: string;
|
|
37
|
-
/** Arguments for the function call as JSON string */
|
|
38
|
-
arguments: string;
|
|
39
|
-
};
|
|
40
|
-
}
|
|
37
|
+
export type ToolCall = SDKToolCall;
|
|
41
38
|
/**
|
|
42
39
|
* Represents a tool definition in OpenAI format
|
|
40
|
+
* Extended with looser parameter typing for flexibility
|
|
43
41
|
*/
|
|
44
42
|
export interface Tool {
|
|
45
43
|
/** The type of tool */
|
|
@@ -56,6 +54,7 @@ export interface Tool {
|
|
|
56
54
|
}
|
|
57
55
|
/**
|
|
58
56
|
* LLM inference request parameters
|
|
57
|
+
* Local version with required llmrole for backward compatibility
|
|
59
58
|
*/
|
|
60
59
|
export interface LLMInferenceParams {
|
|
61
60
|
/** Array of messages in the conversation */
|
|
@@ -63,12 +62,7 @@ export interface LLMInferenceParams {
|
|
|
63
62
|
/** Available tools for the model to use */
|
|
64
63
|
tools?: Tool[];
|
|
65
64
|
/** How the model should use tools */
|
|
66
|
-
tool_choice?:
|
|
67
|
-
type: 'function';
|
|
68
|
-
function: {
|
|
69
|
-
name: string;
|
|
70
|
-
};
|
|
71
|
-
};
|
|
65
|
+
tool_choice?: ToolChoice;
|
|
72
66
|
/** The LLM role to determine which model to use */
|
|
73
67
|
llmrole: string;
|
|
74
68
|
/** Maximum number of tokens to generate */
|
|
@@ -7,5 +7,8 @@
|
|
|
7
7
|
* - API interfaces exposed to library users
|
|
8
8
|
* - Configuration options for library functions
|
|
9
9
|
* - User-facing data structures
|
|
10
|
+
*
|
|
11
|
+
* Note: Core message and tool types are imported from @codebolt/types/sdk.
|
|
12
|
+
* Local extensions are provided for backward compatibility.
|
|
10
13
|
*/
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Processor types and interfaces for the Unified Agent Framework
|
|
3
|
-
* @deprecated Use
|
|
3
|
+
* @deprecated Use types from @codebolt/types/agent instead
|
|
4
4
|
*
|
|
5
5
|
* This file is kept for backward compatibility.
|
|
6
|
-
* New code should import from
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
11
|
-
* - './processorTypes/postToolCallProcessorTypes'
|
|
6
|
+
* New code should import from @codebolt/types/agent:
|
|
7
|
+
* - MessageModifier, MessageModifierOptions
|
|
8
|
+
* - PreInferenceProcessor, PostInferenceProcessor
|
|
9
|
+
* - PreToolCallProcessor, PostToolCallProcessor
|
|
10
|
+
* - ProcessedMessage, ToolCall, ToolResult
|
|
12
11
|
*/
|
|
13
|
-
|
|
12
|
+
import type { ToolResult } from '@codebolt/types/agent';
|
|
13
|
+
export type { ToolResult };
|
|
14
14
|
export interface ToolCall {
|
|
15
15
|
id: string;
|
|
16
16
|
function: {
|
|
@@ -1,34 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* Processor types and interfaces for the Unified Agent Framework
|
|
4
|
-
* @deprecated Use
|
|
4
|
+
* @deprecated Use types from @codebolt/types/agent instead
|
|
5
5
|
*
|
|
6
6
|
* This file is kept for backward compatibility.
|
|
7
|
-
* New code should import from
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
12
|
-
* - './processorTypes/postToolCallProcessorTypes'
|
|
7
|
+
* New code should import from @codebolt/types/agent:
|
|
8
|
+
* - MessageModifier, MessageModifierOptions
|
|
9
|
+
* - PreInferenceProcessor, PostInferenceProcessor
|
|
10
|
+
* - PreToolCallProcessor, PostToolCallProcessor
|
|
11
|
+
* - ProcessedMessage, ToolCall, ToolResult
|
|
13
12
|
*/
|
|
14
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
|
-
if (k2 === undefined) k2 = k;
|
|
16
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
|
-
}
|
|
20
|
-
Object.defineProperty(o, k2, desc);
|
|
21
|
-
}) : (function(o, m, k, k2) {
|
|
22
|
-
if (k2 === undefined) k2 = k;
|
|
23
|
-
o[k2] = m[k];
|
|
24
|
-
}));
|
|
25
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
-
};
|
|
28
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
14
|
exports.BaseProcessor = void 0;
|
|
30
|
-
// Re-export all processor types from their specific modules
|
|
31
|
-
__exportStar(require("./processorTypes"), exports);
|
|
32
15
|
// Base processor class
|
|
33
16
|
class BaseProcessor {
|
|
34
17
|
constructor(options) {
|
|
@@ -42,11 +42,11 @@ class Agent {
|
|
|
42
42
|
// console.log('[Agent] Step completed, processing response');
|
|
43
43
|
}
|
|
44
44
|
const responseExecutor = new responseExecutor_1.ResponseExecutor({
|
|
45
|
-
|
|
45
|
+
preToolCallProcessors: this.preToolCallProcessors,
|
|
46
46
|
postToolCallProcessors: this.postToolCallProcessors
|
|
47
47
|
});
|
|
48
48
|
const executionResult = await responseExecutor.executeResponse({
|
|
49
|
-
|
|
49
|
+
initialUserMessage: reqMessage,
|
|
50
50
|
actualMessageSentToLLM: stepResult.actualMessageSentToLLM,
|
|
51
51
|
rawLLMOutput: stepResult.rawLLMResponse,
|
|
52
52
|
nextMessage: stepResult.nextMessage
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { AgentConfig, MessageModifier, PostInferenceProcessor, PostToolCallProcessor, PreInferenceProcessor, PreToolCallProcessor } from "@codebolt/types/agent";
|
|
2
|
+
import { FlatUserMessage } from "@codebolt/types/sdk";
|
|
3
|
+
/**
|
|
4
|
+
* Configuration options for CodeboltAgent
|
|
5
|
+
*/
|
|
6
|
+
export interface CodeboltAgentConfig extends AgentConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Enable logging for debugging purposes.
|
|
9
|
+
* Defaults to true.
|
|
10
|
+
*/
|
|
11
|
+
enableLogging?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* CodeboltAgent is a high-level agent class that:
|
|
15
|
+
* - Uses InitialPromptGenerator with configurable processors/modifiers
|
|
16
|
+
* - Runs an agent loop with AgentStep and ResponseExecutor
|
|
17
|
+
* - Handles tool execution and conversation flow automatically
|
|
18
|
+
* - Is triggered via processMessage (not via onMessage listener)
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import { CodeboltAgent } from '@codebolt/agent/unified';
|
|
23
|
+
* import {
|
|
24
|
+
* EnvironmentContextModifier,
|
|
25
|
+
* CoreSystemPromptModifier,
|
|
26
|
+
* DirectoryContextModifier,
|
|
27
|
+
* IdeContextModifier,
|
|
28
|
+
* AtFileProcessorModifier,
|
|
29
|
+
* ToolInjectionModifier,
|
|
30
|
+
* ChatHistoryMessageModifier
|
|
31
|
+
* } from '@codebolt/agent/processor-pieces';
|
|
32
|
+
*
|
|
33
|
+
* const systemPrompt = `You are an AI coding assistant...`;
|
|
34
|
+
*
|
|
35
|
+
* const agent = new CodeboltAgent({
|
|
36
|
+
* instructions: systemPrompt,
|
|
37
|
+
* processors: {
|
|
38
|
+
* messageModifiers: [
|
|
39
|
+
* new ChatHistoryMessageModifier({ enableChatHistory: true }),
|
|
40
|
+
* new EnvironmentContextModifier({ enableFullContext: true }),
|
|
41
|
+
* new DirectoryContextModifier(),
|
|
42
|
+
* new IdeContextModifier({
|
|
43
|
+
* includeActiveFile: true,
|
|
44
|
+
* includeOpenFiles: true,
|
|
45
|
+
* includeCursorPosition: true,
|
|
46
|
+
* includeSelectedText: true
|
|
47
|
+
* }),
|
|
48
|
+
* new CoreSystemPromptModifier({ customSystemPrompt: systemPrompt }),
|
|
49
|
+
* new ToolInjectionModifier({ includeToolDescriptions: true }),
|
|
50
|
+
* new AtFileProcessorModifier({ enableRecursiveSearch: true })
|
|
51
|
+
* ],
|
|
52
|
+
* preInferenceProcessors: [],
|
|
53
|
+
* postInferenceProcessors: [],
|
|
54
|
+
* preToolCallProcessors: [],
|
|
55
|
+
* postToolCallProcessors: []
|
|
56
|
+
* }
|
|
57
|
+
* });
|
|
58
|
+
*
|
|
59
|
+
* // Process a message (triggered from graph node)
|
|
60
|
+
* const result = await agent.processMessage(userMessage);
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare class CodeboltAgent {
|
|
64
|
+
private readonly config;
|
|
65
|
+
private readonly messageModifiers;
|
|
66
|
+
private readonly preInferenceProcessors;
|
|
67
|
+
private readonly postInferenceProcessors;
|
|
68
|
+
private readonly preToolCallProcessors;
|
|
69
|
+
private readonly postToolCallProcessors;
|
|
70
|
+
private readonly enableLogging;
|
|
71
|
+
private readonly baseSystemPrompt;
|
|
72
|
+
constructor(config: CodeboltAgentConfig);
|
|
73
|
+
/**
|
|
74
|
+
* Creates default message modifiers when none are provided
|
|
75
|
+
*/
|
|
76
|
+
private createDefaultMessageModifiers;
|
|
77
|
+
/**
|
|
78
|
+
* Process a message through the agent pipeline.
|
|
79
|
+
* This is the main entry point - triggered from graph nodes.
|
|
80
|
+
*/
|
|
81
|
+
processMessage(reqMessage: FlatUserMessage): Promise<{
|
|
82
|
+
success: boolean;
|
|
83
|
+
result: any;
|
|
84
|
+
error?: string;
|
|
85
|
+
}>;
|
|
86
|
+
/**
|
|
87
|
+
* Get the current configuration
|
|
88
|
+
*/
|
|
89
|
+
getConfig(): CodeboltAgentConfig;
|
|
90
|
+
/**
|
|
91
|
+
* Get all message modifiers
|
|
92
|
+
*/
|
|
93
|
+
getMessageModifiers(): MessageModifier[];
|
|
94
|
+
/**
|
|
95
|
+
* Get all pre-inference processors
|
|
96
|
+
*/
|
|
97
|
+
getPreInferenceProcessors(): PreInferenceProcessor[];
|
|
98
|
+
/**
|
|
99
|
+
* Get all post-inference processors
|
|
100
|
+
*/
|
|
101
|
+
getPostInferenceProcessors(): PostInferenceProcessor[];
|
|
102
|
+
/**
|
|
103
|
+
* Get all pre-tool-call processors
|
|
104
|
+
*/
|
|
105
|
+
getPreToolCallProcessors(): PreToolCallProcessor[];
|
|
106
|
+
/**
|
|
107
|
+
* Get all post-tool-call processors
|
|
108
|
+
*/
|
|
109
|
+
getPostToolCallProcessors(): PostToolCallProcessor[];
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Factory function to create a CodeboltAgent with common defaults
|
|
113
|
+
*/
|
|
114
|
+
export declare function createCodeboltAgent(options: {
|
|
115
|
+
systemPrompt: string;
|
|
116
|
+
messageModifiers?: MessageModifier[];
|
|
117
|
+
preInferenceProcessors?: PreInferenceProcessor[];
|
|
118
|
+
postInferenceProcessors?: PostInferenceProcessor[];
|
|
119
|
+
preToolCallProcessors?: PreToolCallProcessor[];
|
|
120
|
+
postToolCallProcessors?: PostToolCallProcessor[];
|
|
121
|
+
enableLogging?: boolean;
|
|
122
|
+
}): CodeboltAgent;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CodeboltAgent = void 0;
|
|
4
|
+
exports.createCodeboltAgent = createCodeboltAgent;
|
|
5
|
+
const base_1 = require("../base");
|
|
6
|
+
const responseExecutor_1 = require("../base/responseExecutor");
|
|
7
|
+
const agentStep_1 = require("../base/agentStep");
|
|
8
|
+
const processor_pieces_1 = require("../../processor-pieces");
|
|
9
|
+
/**
|
|
10
|
+
* CodeboltAgent is a high-level agent class that:
|
|
11
|
+
* - Uses InitialPromptGenerator with configurable processors/modifiers
|
|
12
|
+
* - Runs an agent loop with AgentStep and ResponseExecutor
|
|
13
|
+
* - Handles tool execution and conversation flow automatically
|
|
14
|
+
* - Is triggered via processMessage (not via onMessage listener)
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { CodeboltAgent } from '@codebolt/agent/unified';
|
|
19
|
+
* import {
|
|
20
|
+
* EnvironmentContextModifier,
|
|
21
|
+
* CoreSystemPromptModifier,
|
|
22
|
+
* DirectoryContextModifier,
|
|
23
|
+
* IdeContextModifier,
|
|
24
|
+
* AtFileProcessorModifier,
|
|
25
|
+
* ToolInjectionModifier,
|
|
26
|
+
* ChatHistoryMessageModifier
|
|
27
|
+
* } from '@codebolt/agent/processor-pieces';
|
|
28
|
+
*
|
|
29
|
+
* const systemPrompt = `You are an AI coding assistant...`;
|
|
30
|
+
*
|
|
31
|
+
* const agent = new CodeboltAgent({
|
|
32
|
+
* instructions: systemPrompt,
|
|
33
|
+
* processors: {
|
|
34
|
+
* messageModifiers: [
|
|
35
|
+
* new ChatHistoryMessageModifier({ enableChatHistory: true }),
|
|
36
|
+
* new EnvironmentContextModifier({ enableFullContext: true }),
|
|
37
|
+
* new DirectoryContextModifier(),
|
|
38
|
+
* new IdeContextModifier({
|
|
39
|
+
* includeActiveFile: true,
|
|
40
|
+
* includeOpenFiles: true,
|
|
41
|
+
* includeCursorPosition: true,
|
|
42
|
+
* includeSelectedText: true
|
|
43
|
+
* }),
|
|
44
|
+
* new CoreSystemPromptModifier({ customSystemPrompt: systemPrompt }),
|
|
45
|
+
* new ToolInjectionModifier({ includeToolDescriptions: true }),
|
|
46
|
+
* new AtFileProcessorModifier({ enableRecursiveSearch: true })
|
|
47
|
+
* ],
|
|
48
|
+
* preInferenceProcessors: [],
|
|
49
|
+
* postInferenceProcessors: [],
|
|
50
|
+
* preToolCallProcessors: [],
|
|
51
|
+
* postToolCallProcessors: []
|
|
52
|
+
* }
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* // Process a message (triggered from graph node)
|
|
56
|
+
* const result = await agent.processMessage(userMessage);
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
class CodeboltAgent {
|
|
60
|
+
constructor(config) {
|
|
61
|
+
var _a, _b, _c, _d, _e, _f;
|
|
62
|
+
this.config = { ...config };
|
|
63
|
+
this.enableLogging = config.enableLogging !== false;
|
|
64
|
+
this.baseSystemPrompt = config.instructions || 'Based on User Message send reply';
|
|
65
|
+
// Use provided modifiers or default ones
|
|
66
|
+
this.messageModifiers = ((_b = (_a = config.processors) === null || _a === void 0 ? void 0 : _a.messageModifiers) === null || _b === void 0 ? void 0 : _b.length)
|
|
67
|
+
? config.processors.messageModifiers
|
|
68
|
+
: this.createDefaultMessageModifiers(this.baseSystemPrompt);
|
|
69
|
+
this.preInferenceProcessors = ((_c = config.processors) === null || _c === void 0 ? void 0 : _c.preInferenceProcessors) || [];
|
|
70
|
+
this.postInferenceProcessors = ((_d = config.processors) === null || _d === void 0 ? void 0 : _d.postInferenceProcessors) || [];
|
|
71
|
+
this.preToolCallProcessors = ((_e = config.processors) === null || _e === void 0 ? void 0 : _e.preToolCallProcessors) || [];
|
|
72
|
+
this.postToolCallProcessors = ((_f = config.processors) === null || _f === void 0 ? void 0 : _f.postToolCallProcessors) || [];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Creates default message modifiers when none are provided
|
|
76
|
+
*/
|
|
77
|
+
createDefaultMessageModifiers(systemPrompt) {
|
|
78
|
+
return [
|
|
79
|
+
// 1. Chat History
|
|
80
|
+
new processor_pieces_1.ChatHistoryMessageModifier({ enableChatHistory: true }),
|
|
81
|
+
// 2. Environment Context (date, OS)
|
|
82
|
+
new processor_pieces_1.EnvironmentContextModifier({ enableFullContext: true }),
|
|
83
|
+
// 3. Directory Context (folder structure)
|
|
84
|
+
new processor_pieces_1.DirectoryContextModifier(),
|
|
85
|
+
// 4. IDE Context (active file, opened files)
|
|
86
|
+
new processor_pieces_1.IdeContextModifier({
|
|
87
|
+
includeActiveFile: true,
|
|
88
|
+
includeOpenFiles: true,
|
|
89
|
+
includeCursorPosition: true,
|
|
90
|
+
includeSelectedText: true
|
|
91
|
+
}),
|
|
92
|
+
// 5. Core System Prompt (instructions)
|
|
93
|
+
new processor_pieces_1.CoreSystemPromptModifier({ customSystemPrompt: systemPrompt }),
|
|
94
|
+
// 6. Tools (function declarations)
|
|
95
|
+
new processor_pieces_1.ToolInjectionModifier({ includeToolDescriptions: true }),
|
|
96
|
+
// 7. At-file processing (@file mentions)
|
|
97
|
+
new processor_pieces_1.AtFileProcessorModifier({ enableRecursiveSearch: true })
|
|
98
|
+
];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Process a message through the agent pipeline.
|
|
102
|
+
* This is the main entry point - triggered from graph nodes.
|
|
103
|
+
*/
|
|
104
|
+
async processMessage(reqMessage) {
|
|
105
|
+
try {
|
|
106
|
+
if (this.enableLogging) {
|
|
107
|
+
console.log('[CodeboltAgent] Processing message');
|
|
108
|
+
}
|
|
109
|
+
const promptGenerator = new base_1.InitialPromptGenerator({
|
|
110
|
+
processors: this.messageModifiers,
|
|
111
|
+
baseSystemPrompt: this.baseSystemPrompt,
|
|
112
|
+
enableLogging: this.enableLogging
|
|
113
|
+
});
|
|
114
|
+
let prompt = await promptGenerator.processMessage(reqMessage);
|
|
115
|
+
let completed = false;
|
|
116
|
+
while (!completed) {
|
|
117
|
+
const agentStep = new agentStep_1.AgentStep({
|
|
118
|
+
preInferenceProcessors: this.preInferenceProcessors,
|
|
119
|
+
postInferenceProcessors: this.postInferenceProcessors
|
|
120
|
+
});
|
|
121
|
+
const stepResult = await agentStep.executeStep(reqMessage, prompt);
|
|
122
|
+
prompt = stepResult.nextMessage;
|
|
123
|
+
const responseExecutor = new responseExecutor_1.ResponseExecutor({
|
|
124
|
+
preToolCallProcessors: this.preToolCallProcessors,
|
|
125
|
+
postToolCallProcessors: this.postToolCallProcessors
|
|
126
|
+
});
|
|
127
|
+
const executionResult = await responseExecutor.executeResponse({
|
|
128
|
+
initialUserMessage: reqMessage,
|
|
129
|
+
actualMessageSentToLLM: stepResult.actualMessageSentToLLM,
|
|
130
|
+
rawLLMOutput: stepResult.rawLLMResponse,
|
|
131
|
+
nextMessage: stepResult.nextMessage
|
|
132
|
+
});
|
|
133
|
+
completed = executionResult.completed;
|
|
134
|
+
prompt = executionResult.nextMessage;
|
|
135
|
+
}
|
|
136
|
+
if (this.enableLogging) {
|
|
137
|
+
console.log('[CodeboltAgent] Message processing completed');
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
success: true,
|
|
141
|
+
result: prompt,
|
|
142
|
+
error: undefined
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
147
|
+
if (this.enableLogging) {
|
|
148
|
+
console.error('[CodeboltAgent] Execution failed:', error);
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
success: false,
|
|
152
|
+
result: null,
|
|
153
|
+
error: errorMessage
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Get the current configuration
|
|
159
|
+
*/
|
|
160
|
+
getConfig() {
|
|
161
|
+
return { ...this.config };
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Get all message modifiers
|
|
165
|
+
*/
|
|
166
|
+
getMessageModifiers() {
|
|
167
|
+
return [...this.messageModifiers];
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Get all pre-inference processors
|
|
171
|
+
*/
|
|
172
|
+
getPreInferenceProcessors() {
|
|
173
|
+
return [...this.preInferenceProcessors];
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Get all post-inference processors
|
|
177
|
+
*/
|
|
178
|
+
getPostInferenceProcessors() {
|
|
179
|
+
return [...this.postInferenceProcessors];
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Get all pre-tool-call processors
|
|
183
|
+
*/
|
|
184
|
+
getPreToolCallProcessors() {
|
|
185
|
+
return [...this.preToolCallProcessors];
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Get all post-tool-call processors
|
|
189
|
+
*/
|
|
190
|
+
getPostToolCallProcessors() {
|
|
191
|
+
return [...this.postToolCallProcessors];
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
exports.CodeboltAgent = CodeboltAgent;
|
|
195
|
+
/**
|
|
196
|
+
* Factory function to create a CodeboltAgent with common defaults
|
|
197
|
+
*/
|
|
198
|
+
function createCodeboltAgent(options) {
|
|
199
|
+
return new CodeboltAgent({
|
|
200
|
+
instructions: options.systemPrompt,
|
|
201
|
+
processors: {
|
|
202
|
+
messageModifiers: options.messageModifiers || [],
|
|
203
|
+
preInferenceProcessors: options.preInferenceProcessors || [],
|
|
204
|
+
postInferenceProcessors: options.postInferenceProcessors || [],
|
|
205
|
+
preToolCallProcessors: options.preToolCallProcessors || [],
|
|
206
|
+
postToolCallProcessors: options.postToolCallProcessors || []
|
|
207
|
+
},
|
|
208
|
+
enableLogging: options.enableLogging
|
|
209
|
+
});
|
|
210
|
+
}
|