@codebolt/agent 5.0.8 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/dist/unified/base/responseExecutor.js +10 -6
  2. package/package.json +5 -5
  3. package/dist/agent.d.ts +0 -86
  4. package/dist/agent.js +0 -324
  5. package/dist/builderpattern/agent.d.ts +0 -86
  6. package/dist/builderpattern/agent.js +0 -324
  7. package/dist/builderpattern/followupquestionbuilder.d.ts +0 -75
  8. package/dist/builderpattern/followupquestionbuilder.js +0 -197
  9. package/dist/builderpattern/index.d.ts +0 -14
  10. package/dist/builderpattern/index.js +0 -23
  11. package/dist/builderpattern/llmoutputhandler.d.ts +0 -102
  12. package/dist/builderpattern/llmoutputhandler.js +0 -452
  13. package/dist/builderpattern/promptbuilder.d.ts +0 -382
  14. package/dist/builderpattern/promptbuilder.js +0 -805
  15. package/dist/builderpattern/systemprompt.d.ts +0 -20
  16. package/dist/builderpattern/systemprompt.js +0 -48
  17. package/dist/builderpattern/taskInstruction.d.ts +0 -37
  18. package/dist/builderpattern/taskInstruction.js +0 -57
  19. package/dist/builderpattern/usermessage.d.ts +0 -70
  20. package/dist/builderpattern/usermessage.js +0 -123
  21. package/dist/composablepattern/agent.d.ts +0 -169
  22. package/dist/composablepattern/agent.js +0 -598
  23. package/dist/composablepattern/codebolt-storage.d.ts +0 -67
  24. package/dist/composablepattern/codebolt-storage.js +0 -320
  25. package/dist/composablepattern/document.d.ts +0 -149
  26. package/dist/composablepattern/document.js +0 -405
  27. package/dist/composablepattern/examples/codebolt-integration-example.d.ts +0 -12
  28. package/dist/composablepattern/examples/codebolt-integration-example.js +0 -218
  29. package/dist/composablepattern/examples/codebolt-storage-example.d.ts +0 -40
  30. package/dist/composablepattern/examples/codebolt-storage-example.js +0 -223
  31. package/dist/composablepattern/examples/custom-steps-example.d.ts +0 -20
  32. package/dist/composablepattern/examples/custom-steps-example.js +0 -455
  33. package/dist/composablepattern/examples/document-agent.d.ts +0 -17
  34. package/dist/composablepattern/examples/document-agent.js +0 -107
  35. package/dist/composablepattern/examples/simple-codebolt-integration.d.ts +0 -8
  36. package/dist/composablepattern/examples/simple-codebolt-integration.js +0 -164
  37. package/dist/composablepattern/examples/weather-agent.d.ts +0 -18
  38. package/dist/composablepattern/examples/weather-agent.js +0 -86
  39. package/dist/composablepattern/examples/workflow-example.d.ts +0 -12
  40. package/dist/composablepattern/examples/workflow-example.js +0 -463
  41. package/dist/composablepattern/index.d.ts +0 -63
  42. package/dist/composablepattern/index.js +0 -115
  43. package/dist/composablepattern/memory.d.ts +0 -89
  44. package/dist/composablepattern/memory.js +0 -141
  45. package/dist/composablepattern/tool.d.ts +0 -84
  46. package/dist/composablepattern/tool.js +0 -260
  47. package/dist/composablepattern/types.d.ts +0 -194
  48. package/dist/composablepattern/types.js +0 -6
  49. package/dist/composablepattern/user-context.d.ts +0 -214
  50. package/dist/composablepattern/user-context.js +0 -275
  51. package/dist/composablepattern/workflow.d.ts +0 -388
  52. package/dist/composablepattern/workflow.js +0 -562
  53. package/dist/followupquestionbuilder.d.ts +0 -75
  54. package/dist/followupquestionbuilder.js +0 -197
  55. package/dist/index.d.ts +0 -14
  56. package/dist/index.js +0 -23
  57. package/dist/llmoutputhandler.d.ts +0 -102
  58. package/dist/llmoutputhandler.js +0 -452
  59. package/dist/processor/agent/agentStep.d.ts +0 -49
  60. package/dist/processor/agent/agentStep.js +0 -241
  61. package/dist/processor/agent/toolExecutor.d.ts +0 -19
  62. package/dist/processor/agent/toolExecutor.js +0 -90
  63. package/dist/processor/index.d.ts +0 -7
  64. package/dist/processor/index.js +0 -36
  65. package/dist/processor/messageModifiers/baseMessageModifier.d.ts +0 -20
  66. package/dist/processor/messageModifiers/baseMessageModifier.js +0 -55
  67. package/dist/processor/processors/baseProcessor.d.ts +0 -14
  68. package/dist/processor/processors/baseProcessor.js +0 -29
  69. package/dist/processor/tools/baseTool.d.ts +0 -10
  70. package/dist/processor/tools/baseTool.js +0 -20
  71. package/dist/processor/tools/toolList.d.ts +0 -9
  72. package/dist/processor/tools/toolList.js +0 -22
  73. package/dist/processor/types/interfaces.d.ts +0 -94
  74. package/dist/processor/types/interfaces.js +0 -2
  75. package/dist/processor-pieces/messageModifiers/addToolsListMessageModifier.d.ts +0 -22
  76. package/dist/processor-pieces/messageModifiers/addToolsListMessageModifier.js +0 -144
  77. package/dist/processor-pieces/messageModifiers/baseContextMessageModifier.d.ts +0 -15
  78. package/dist/processor-pieces/messageModifiers/baseContextMessageModifier.js +0 -75
  79. package/dist/processor-pieces/messageModifiers/baseSystemInstructionMessageModifier.d.ts +0 -11
  80. package/dist/processor-pieces/messageModifiers/baseSystemInstructionMessageModifier.js +0 -46
  81. package/dist/processor-pieces/messageModifiers/handleUrlMessageModifier.d.ts +0 -12
  82. package/dist/processor-pieces/messageModifiers/handleUrlMessageModifier.js +0 -60
  83. package/dist/processor-pieces/messageModifiers/imageAttachmentMessageModifier.d.ts +0 -18
  84. package/dist/processor-pieces/messageModifiers/imageAttachmentMessageModifier.js +0 -222
  85. package/dist/processor-pieces/messageModifiers/workingDirectoryMessageModifier.d.ts +0 -22
  86. package/dist/processor-pieces/messageModifiers/workingDirectoryMessageModifier.js +0 -194
  87. package/dist/processor-pieces/processors/advancedLoopDetectionProcessor.d.ts +0 -41
  88. package/dist/processor-pieces/processors/advancedLoopDetectionProcessor.js +0 -197
  89. package/dist/processor-pieces/processors/chatCompressionProcessor.d.ts +0 -26
  90. package/dist/processor-pieces/processors/chatCompressionProcessor.js +0 -90
  91. package/dist/processor-pieces/processors/chatRecordingProcessor.d.ts +0 -81
  92. package/dist/processor-pieces/processors/chatRecordingProcessor.js +0 -329
  93. package/dist/processor-pieces/processors/contextManagementProcessor.d.ts +0 -40
  94. package/dist/processor-pieces/processors/contextManagementProcessor.js +0 -305
  95. package/dist/processor-pieces/processors/loopDetectionProcessor.d.ts +0 -30
  96. package/dist/processor-pieces/processors/loopDetectionProcessor.js +0 -137
  97. package/dist/processor-pieces/processors/responseValidationProcessor.d.ts +0 -30
  98. package/dist/processor-pieces/processors/responseValidationProcessor.js +0 -228
  99. package/dist/processor-pieces/processors/telemetryProcessor.d.ts +0 -99
  100. package/dist/processor-pieces/processors/telemetryProcessor.js +0 -311
  101. package/dist/processor-pieces/processors/tokenManagementProcessor.d.ts +0 -37
  102. package/dist/processor-pieces/processors/tokenManagementProcessor.js +0 -178
  103. package/dist/processor-pieces/processors/toolExecutionProcessor.d.ts +0 -43
  104. package/dist/processor-pieces/processors/toolExecutionProcessor.js +0 -207
  105. package/dist/processor-pieces/tools/fileTools.d.ts +0 -26
  106. package/dist/processor-pieces/tools/fileTools.js +0 -162
  107. package/dist/promptbuilder.d.ts +0 -382
  108. package/dist/promptbuilder.js +0 -805
  109. package/dist/systemprompt.d.ts +0 -20
  110. package/dist/systemprompt.js +0 -48
  111. package/dist/taskInstruction.d.ts +0 -37
  112. package/dist/taskInstruction.js +0 -57
  113. package/dist/usermessage.d.ts +0 -70
  114. package/dist/usermessage.js +0 -123
@@ -1,20 +0,0 @@
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 };
@@ -1,48 +0,0 @@
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;
@@ -1,37 +0,0 @@
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 };
@@ -1,57 +0,0 @@
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;
@@ -1,70 +0,0 @@
1
- import type { UserMessageContent } from "./types/libFunctionTypes";
2
- import type { Agent } from "./types/commonTypes";
3
- import type { Message } from "./types/InternalTypes";
4
- /**
5
- * Class that processes and manages user messages.
6
- * Handles converting messages to prompts and extracting mentioned entities.
7
- */
8
- declare class UserMessage {
9
- /** The message content and metadata */
10
- message: Message;
11
- /** Whether to override the default prompt generation */
12
- promptOverride: boolean;
13
- /** Array of content blocks for the user message */
14
- userMessages: UserMessageContent[];
15
- /** List of MCP tools mentioned in the message */
16
- mentionedMCPs: {
17
- toolbox: string;
18
- toolName: string;
19
- }[];
20
- /**
21
- * Creates a new UserMessage instance.
22
- *
23
- * @param message - The message content and metadata
24
- * @param promptOverride - Whether to override default prompt generation
25
- */
26
- constructor(message: Message, promptOverride?: boolean);
27
- /**
28
- * Gets files mentioned in the message.
29
- * Currently a placeholder for implementation.
30
- */
31
- getFiles(): void;
32
- /**
33
- * Converts the user message to a prompt format.
34
- *
35
- * @param bAttachFiles - Whether to attach file contents
36
- * @param bAttachImages - Whether to attach images
37
- * @param bAttachEnvironment - Whether to attach environment details
38
- * @returns Promise with an array of content blocks for the prompt
39
- */
40
- toPrompt(bAttachFiles?: boolean, bAttachImages?: boolean, bAttachEnvironment?: boolean, supportRemix?: boolean): Promise<UserMessageContent[]>;
41
- /**
42
- * Gets agents mentioned in the message.
43
- *
44
- * @returns Array of agent objects
45
- */
46
- getMentionedAgents(): Agent[];
47
- /**
48
- * Gets MCP tools mentioned in the message.
49
- *
50
- * @returns Array of MCP tool names
51
- */
52
- getMentionedMcps(): {
53
- toolbox: string;
54
- toolName: string;
55
- }[];
56
- /**
57
- * Gets MCP tools in a format suitable for the LLM.
58
- *
59
- * @returns Promise with an array of MCP tools
60
- */
61
- getMentionedMcpsTools(): Promise<any[] | undefined>;
62
- /**
63
- * Gets environment details for the current working directory.
64
- *
65
- * @param cwd - The current working directory path
66
- * @returns Promise with a string containing environment details
67
- */
68
- private getEnvironmentDetail;
69
- }
70
- export { UserMessage };
@@ -1,123 +0,0 @@
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.UserMessage = void 0;
7
- const codeboltjs_1 = __importDefault(require("@codebolt/codeboltjs"));
8
- const { fs: cbfs, project, mcp } = codeboltjs_1.default;
9
- // All interfaces moved to appropriate type files
10
- /**
11
- * Class that processes and manages user messages.
12
- * Handles converting messages to prompts and extracting mentioned entities.
13
- */
14
- class UserMessage {
15
- /**
16
- * Creates a new UserMessage instance.
17
- *
18
- * @param message - The message content and metadata
19
- * @param promptOverride - Whether to override default prompt generation
20
- */
21
- constructor(message, promptOverride = false) {
22
- /**
23
- * Gets environment details for the current working directory.
24
- *
25
- * @param cwd - The current working directory path
26
- * @returns Promise with a string containing environment details
27
- */
28
- this.getEnvironmentDetail = async (cwd) => {
29
- let details = "";
30
- const { success, result } = await cbfs.listFile(cwd, true);
31
- details += `\n\n# Current Working Directory (${cwd}) Files\n${result}
32
- ? "\n(Note: Only top-level contents shown for Desktop by default. Use list_files to explore further if necessary.)"
33
- : ""
34
- }`;
35
- return `<environment_details>\n${details.trim()}\n</environment_details>`;
36
- };
37
- this.message = message;
38
- this.promptOverride = promptOverride;
39
- this.userMessages = [];
40
- this.mentionedMCPs = message.mentionedMCPs || [];
41
- }
42
- /**
43
- * Gets files mentioned in the message.
44
- * Currently a placeholder for implementation.
45
- */
46
- getFiles() {
47
- // Implementation to be added
48
- }
49
- /**
50
- * Converts the user message to a prompt format.
51
- *
52
- * @param bAttachFiles - Whether to attach file contents
53
- * @param bAttachImages - Whether to attach images
54
- * @param bAttachEnvironment - Whether to attach environment details
55
- * @returns Promise with an array of content blocks for the prompt
56
- */
57
- async toPrompt(bAttachFiles = true, bAttachImages = true, bAttachEnvironment = true, supportRemix = true) {
58
- var _a;
59
- if (bAttachFiles) {
60
- if (this.promptOverride) {
61
- // Use a rendering engine
62
- }
63
- else {
64
- let finalPrompt = `
65
- The user has sent the following query:
66
- <user_query> ${this.message.userMessage} </user_query>.
67
- `;
68
- if ((_a = this.message.mentionedFiles) === null || _a === void 0 ? void 0 : _a.length) {
69
- finalPrompt += `The Attached files are:`;
70
- for (const file of this.message.mentionedFiles) {
71
- let filedata = await cbfs.readFile(file);
72
- finalPrompt += `File Name: ${file}, File Path: ${file}, Filedata: ${filedata}`;
73
- }
74
- }
75
- this.userMessages.push({ type: "text", text: finalPrompt });
76
- }
77
- }
78
- if (bAttachEnvironment) {
79
- let { projectPath } = await project.getProjectPath();
80
- if (projectPath) {
81
- const environmentDetail = await this.getEnvironmentDetail(projectPath);
82
- this.userMessages.push({ type: "text", text: environmentDetail });
83
- }
84
- }
85
- if (supportRemix) {
86
- if (this.message.remixPrompt)
87
- this.userMessages.push({ type: "text", text: this.message.remixPrompt });
88
- }
89
- return this.userMessages;
90
- }
91
- /**
92
- * Gets agents mentioned in the message.
93
- *
94
- * @returns Array of agent objects
95
- */
96
- getMentionedAgents() {
97
- //TODO : get config in tool format if neede
98
- return this.message.mentionedAgents || [];
99
- }
100
- /**
101
- * Gets MCP tools mentioned in the message.
102
- *
103
- * @returns Array of MCP tool names
104
- */
105
- getMentionedMcps() {
106
- return this.message.mentionedMCPs || [];
107
- }
108
- /**
109
- * Gets MCP tools in a format suitable for the LLM.
110
- *
111
- * @returns Promise with an array of MCP tools
112
- */
113
- async getMentionedMcpsTools() {
114
- if (this.mentionedMCPs.length > 0) {
115
- const { data } = await mcp.getTools(this.mentionedMCPs);
116
- return data;
117
- }
118
- else {
119
- return [];
120
- }
121
- }
122
- }
123
- exports.UserMessage = UserMessage;