@codebolt/codeboltjs 2.0.7 → 2.0.11
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/agentlib/agent.js +12 -4
- package/dist/agentlib/promptbuilder.d.ts +228 -0
- package/dist/agentlib/promptbuilder.js +487 -0
- package/dist/agentlib/taskInstruction.d.ts +3 -25
- package/dist/agentlib/usermessage.d.ts +13 -43
- package/dist/agentlib/usermessage.js +8 -8
- package/dist/core/messageManager.d.ts +4 -6
- package/dist/core/messageManager.js +24 -17
- package/dist/core/websocket.d.ts +10 -0
- package/dist/core/websocket.js +92 -8
- package/dist/index.d.ts +97 -95
- package/dist/index.js +63 -57
- package/dist/modules/agent.d.ts +9 -8
- package/dist/modules/agent.js +4 -4
- package/dist/modules/browser.d.ts +17 -17
- package/dist/modules/browser.js +7 -7
- package/dist/modules/chat.d.ts +1 -1
- package/dist/modules/codeparsers.d.ts +1 -16
- package/dist/modules/codeutils.d.ts +3 -18
- package/dist/modules/dbmemory.d.ts +1 -1
- package/dist/modules/debug.d.ts +1 -1
- package/dist/modules/fs.d.ts +1 -1
- package/dist/modules/git.d.ts +21 -20
- package/dist/modules/git.js +10 -10
- package/dist/modules/history.d.ts +6 -8
- package/dist/modules/history.js +4 -1
- package/dist/modules/llm.d.ts +13 -5
- package/dist/modules/llm.js +29 -4
- package/dist/modules/{tools.d.ts → mcp.d.ts} +9 -8
- package/dist/modules/{tools.js → mcp.js} +6 -6
- package/dist/modules/project.d.ts +1 -1
- package/dist/modules/state.d.ts +2 -1
- package/dist/modules/task.js +0 -1
- package/dist/modules/terminal.d.ts +1 -1
- package/dist/modules/tokenizer.d.ts +1 -1
- package/dist/modules/utils.d.ts +11 -1
- package/dist/modules/utils.js +9 -0
- package/dist/modules/vectordb.d.ts +1 -1
- package/dist/types/InternalTypes.d.ts +501 -0
- package/dist/types/InternalTypes.js +30 -0
- package/dist/types/commonTypes.d.ts +346 -0
- package/dist/types/commonTypes.js +37 -0
- package/dist/types/libFunctionTypes.d.ts +589 -0
- package/dist/types/libFunctionTypes.js +11 -0
- package/dist/types/socketMessageTypes.d.ts +951 -0
- package/dist/types/socketMessageTypes.js +51 -0
- package/dist/utils/{toolBox.d.ts → mcpServer.d.ts} +1 -1
- package/dist/utils/{toolBox.js → mcpServer.js} +36 -36
- package/dist/utils/parse-source-code/languageParser.d.ts +1 -7
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +3 -3
- package/package.json +6 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { GetSummarizeAllResponse, GetSummarizeResponse } from '../types/socketMessageTypes';
|
|
2
|
+
import { LogType } from '../types/commonTypes';
|
|
1
3
|
/**
|
|
2
4
|
* Enum representing different types of log messages.
|
|
5
|
+
* @deprecated Use LogType from commonTypes instead
|
|
3
6
|
*/
|
|
4
7
|
export declare enum logType {
|
|
5
8
|
/** Informational messages */
|
|
@@ -9,6 +12,7 @@ export declare enum logType {
|
|
|
9
12
|
/** Warning messages */
|
|
10
13
|
warning = "warning"
|
|
11
14
|
}
|
|
15
|
+
export { LogType };
|
|
12
16
|
/**
|
|
13
17
|
* Object with methods for summarizing chat history.
|
|
14
18
|
* Provides functionality to create summaries of conversation history.
|
|
@@ -19,10 +23,7 @@ export declare const chatSummary: {
|
|
|
19
23
|
*
|
|
20
24
|
* @returns Promise with an array of message objects containing role and content
|
|
21
25
|
*/
|
|
22
|
-
summarizeAll: () => Promise<
|
|
23
|
-
role: string;
|
|
24
|
-
content: string;
|
|
25
|
-
}[]>;
|
|
26
|
+
summarizeAll: () => Promise<GetSummarizeAllResponse>;
|
|
26
27
|
/**
|
|
27
28
|
* Summarizes a specific part of the chat history.
|
|
28
29
|
*
|
|
@@ -33,9 +34,6 @@ export declare const chatSummary: {
|
|
|
33
34
|
summarize: (messages: {
|
|
34
35
|
role: string;
|
|
35
36
|
content: string;
|
|
36
|
-
}[], depth: number) => Promise<
|
|
37
|
-
role: string;
|
|
38
|
-
content: string;
|
|
39
|
-
}[]>;
|
|
37
|
+
}[], depth: number) => Promise<GetSummarizeResponse>;
|
|
40
38
|
};
|
|
41
39
|
export default chatSummary;
|
package/dist/modules/history.js
CHANGED
|
@@ -3,10 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.chatSummary = exports.logType = void 0;
|
|
6
|
+
exports.chatSummary = exports.LogType = exports.logType = void 0;
|
|
7
7
|
const websocket_1 = __importDefault(require("../core/websocket"));
|
|
8
|
+
const commonTypes_1 = require("../types/commonTypes");
|
|
9
|
+
Object.defineProperty(exports, "LogType", { enumerable: true, get: function () { return commonTypes_1.LogType; } });
|
|
8
10
|
/**
|
|
9
11
|
* Enum representing different types of log messages.
|
|
12
|
+
* @deprecated Use LogType from commonTypes instead
|
|
10
13
|
*/
|
|
11
14
|
var logType;
|
|
12
15
|
(function (logType) {
|
package/dist/modules/llm.d.ts
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
import { LLMResponse } from '
|
|
1
|
+
import { LLMResponse } from '../types/socketMessageTypes';
|
|
2
|
+
import type { Message, ToolCall, Tool, LLMInferenceParams } from '../types/libFunctionTypes';
|
|
3
|
+
export type { Message, ToolCall, Tool, LLMInferenceParams };
|
|
2
4
|
/**
|
|
3
5
|
* A module for interacting with language learning models (LLMs) via WebSocket.
|
|
4
6
|
*/
|
|
5
7
|
declare const cbllm: {
|
|
6
8
|
/**
|
|
7
|
-
* Sends an inference request to the LLM
|
|
9
|
+
* Sends an inference request to the LLM using OpenAI message format with tools support.
|
|
8
10
|
* The model is selected based on the provided `llmrole`. If the specific model
|
|
9
11
|
* for the role is not found, it falls back to the default model for the current agent,
|
|
10
12
|
* and ultimately to the default application-wide LLM if necessary.
|
|
11
13
|
*
|
|
12
|
-
* @param
|
|
13
|
-
*
|
|
14
|
-
*
|
|
14
|
+
* @param message - The inference parameters including:
|
|
15
|
+
* - messages: Array of conversation messages
|
|
16
|
+
* - tools: Available tools for the model to use
|
|
17
|
+
* - tool_choice: How the model should use tools
|
|
18
|
+
* - llmrole: The LLM role to determine which model to use
|
|
19
|
+
* - max_tokens: Maximum number of tokens to generate
|
|
20
|
+
* - temperature: Temperature for response generation
|
|
21
|
+
* - stream: Whether to stream the response
|
|
22
|
+
* @returns A promise that resolves with the LLM's response
|
|
15
23
|
*/
|
|
16
24
|
inference: (message: string, llmrole: string) => Promise<LLMResponse>;
|
|
17
25
|
};
|
package/dist/modules/llm.js
CHANGED
|
@@ -9,14 +9,20 @@ const websocket_1 = __importDefault(require("../core/websocket"));
|
|
|
9
9
|
*/
|
|
10
10
|
const cbllm = {
|
|
11
11
|
/**
|
|
12
|
-
* Sends an inference request to the LLM
|
|
12
|
+
* Sends an inference request to the LLM using OpenAI message format with tools support.
|
|
13
13
|
* The model is selected based on the provided `llmrole`. If the specific model
|
|
14
14
|
* for the role is not found, it falls back to the default model for the current agent,
|
|
15
15
|
* and ultimately to the default application-wide LLM if necessary.
|
|
16
16
|
*
|
|
17
|
-
* @param
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* @param message - The inference parameters including:
|
|
18
|
+
* - messages: Array of conversation messages
|
|
19
|
+
* - tools: Available tools for the model to use
|
|
20
|
+
* - tool_choice: How the model should use tools
|
|
21
|
+
* - llmrole: The LLM role to determine which model to use
|
|
22
|
+
* - max_tokens: Maximum number of tokens to generate
|
|
23
|
+
* - temperature: Temperature for response generation
|
|
24
|
+
* - stream: Whether to stream the response
|
|
25
|
+
* @returns A promise that resolves with the LLM's response
|
|
20
26
|
*/
|
|
21
27
|
inference: async (message, llmrole) => {
|
|
22
28
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
@@ -27,5 +33,24 @@ const cbllm = {
|
|
|
27
33
|
},
|
|
28
34
|
}, "llmResponse");
|
|
29
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Legacy method for backward compatibility - converts simple string prompt to message format.
|
|
38
|
+
* @deprecated Use the new inference method with proper message format instead.
|
|
39
|
+
*
|
|
40
|
+
* @param {string} message - The input message or prompt to be sent to the LLM.
|
|
41
|
+
* @param {string} llmrole - The role of the LLM to determine which model to use.
|
|
42
|
+
* @returns {Promise<LLMResponse>} A promise that resolves with the LLM's response.
|
|
43
|
+
*/
|
|
44
|
+
// legacyInference: async (message: string, llmrole: string): Promise<LLMResponse> => {
|
|
45
|
+
// const messages: Message[] = [
|
|
46
|
+
// {
|
|
47
|
+
// role: 'user',
|
|
48
|
+
// content: message
|
|
49
|
+
// }
|
|
50
|
+
// ];
|
|
51
|
+
// return cbllm.inference({
|
|
52
|
+
// messages,
|
|
53
|
+
// }, llmrole);
|
|
54
|
+
// }
|
|
30
55
|
};
|
|
31
56
|
exports.default = cbllm;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { UserMessage } from '../utils';
|
|
2
|
+
import { GetEnabledToolBoxesResponse, GetLocalToolBoxesResponse, GetAvailableToolBoxesResponse, SearchAvailableToolBoxesResponse, ListToolsFromToolBoxesResponse, ConfigureToolBoxResponse, GetToolsResponse, ExecuteToolResponse } from '../types/socketMessageTypes';
|
|
2
3
|
/**
|
|
3
4
|
* Object containing methods for interacting with Codebolt MCP (Model Context Protocol) tools.
|
|
4
5
|
* Provides functionality to discover, list, and execute tools.
|
|
@@ -9,34 +10,34 @@ declare const codeboltMCP: {
|
|
|
9
10
|
*
|
|
10
11
|
* @returns Promise with the enabled toolboxes data
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
|
+
getEnabledMCPServers: () => Promise<GetEnabledToolBoxesResponse>;
|
|
13
14
|
/**
|
|
14
15
|
* Gets the list of locally available toolboxes.
|
|
15
16
|
*
|
|
16
17
|
* @returns Promise with the local toolboxes data
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
+
getLocalMCPServers: () => Promise<GetLocalToolBoxesResponse>;
|
|
19
20
|
/**
|
|
20
21
|
* Gets toolboxes mentioned in a user message.
|
|
21
22
|
*
|
|
22
23
|
* @param userMessage - The user message to extract mentions from
|
|
23
24
|
* @returns Promise with the mentioned toolboxes
|
|
24
25
|
*/
|
|
25
|
-
|
|
26
|
+
getMentionedMCPServers: (userMessage: UserMessage) => Promise<GetAvailableToolBoxesResponse>;
|
|
26
27
|
/**
|
|
27
28
|
* Searches for available toolboxes matching a query.
|
|
28
29
|
*
|
|
29
30
|
* @param query - The search query string
|
|
30
31
|
* @returns Promise with matching toolboxes data
|
|
31
32
|
*/
|
|
32
|
-
|
|
33
|
+
searchAvailableMCPServers: (query: string) => Promise<SearchAvailableToolBoxesResponse>;
|
|
33
34
|
/**
|
|
34
35
|
* Lists all tools from the specified toolboxes.
|
|
35
36
|
*
|
|
36
37
|
* @param toolBoxes - Array of toolbox names to list tools from
|
|
37
38
|
* @returns Promise with tools from the specified toolboxes
|
|
38
39
|
*/
|
|
39
|
-
|
|
40
|
+
listMcpFromServers: (toolBoxes: string[]) => Promise<ListToolsFromToolBoxesResponse>;
|
|
40
41
|
/**
|
|
41
42
|
* Configures a specific toolbox with provided configuration.
|
|
42
43
|
*
|
|
@@ -44,7 +45,7 @@ declare const codeboltMCP: {
|
|
|
44
45
|
* @param config - Configuration object for the toolbox
|
|
45
46
|
* @returns Promise with the configuration result
|
|
46
47
|
*/
|
|
47
|
-
|
|
48
|
+
configureMCPServer: (name: string, config: any) => Promise<ConfigureToolBoxResponse>;
|
|
48
49
|
/**
|
|
49
50
|
* Gets detailed information about specific tools.
|
|
50
51
|
*
|
|
@@ -54,7 +55,7 @@ declare const codeboltMCP: {
|
|
|
54
55
|
getTools: (tools: {
|
|
55
56
|
toolbox: string;
|
|
56
57
|
toolName: string;
|
|
57
|
-
}[]) => Promise<
|
|
58
|
+
}[]) => Promise<GetToolsResponse>;
|
|
58
59
|
/**
|
|
59
60
|
* Executes a specific tool with provided parameters.
|
|
60
61
|
*
|
|
@@ -63,6 +64,6 @@ declare const codeboltMCP: {
|
|
|
63
64
|
* @param params - Parameters to pass to the tool
|
|
64
65
|
* @returns Promise with the execution result
|
|
65
66
|
*/
|
|
66
|
-
executeTool: (toolbox: string, toolName: string, params: any) => Promise<
|
|
67
|
+
executeTool: (toolbox: string, toolName: string, params: any) => Promise<ExecuteToolResponse>;
|
|
67
68
|
};
|
|
68
69
|
export default codeboltMCP;
|
|
@@ -14,7 +14,7 @@ const codeboltMCP = {
|
|
|
14
14
|
*
|
|
15
15
|
* @returns Promise with the enabled toolboxes data
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
getEnabledMCPServers: () => {
|
|
18
18
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
19
19
|
"type": "codebolttools",
|
|
20
20
|
"action": "getEnabledToolBoxes"
|
|
@@ -25,7 +25,7 @@ const codeboltMCP = {
|
|
|
25
25
|
*
|
|
26
26
|
* @returns Promise with the local toolboxes data
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
getLocalMCPServers: () => {
|
|
29
29
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
30
30
|
"type": "codebolttools",
|
|
31
31
|
"action": "getLocalToolBoxes"
|
|
@@ -37,7 +37,7 @@ const codeboltMCP = {
|
|
|
37
37
|
* @param userMessage - The user message to extract mentions from
|
|
38
38
|
* @returns Promise with the mentioned toolboxes
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
getMentionedMCPServers: (userMessage) => {
|
|
41
41
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
42
42
|
"type": "codebolttools",
|
|
43
43
|
"action": "getAvailableToolBoxes"
|
|
@@ -49,7 +49,7 @@ const codeboltMCP = {
|
|
|
49
49
|
* @param query - The search query string
|
|
50
50
|
* @returns Promise with matching toolboxes data
|
|
51
51
|
*/
|
|
52
|
-
|
|
52
|
+
searchAvailableMCPServers: (query) => {
|
|
53
53
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
54
54
|
"type": "codebolttools",
|
|
55
55
|
"action": "searchAvailableToolBoxes",
|
|
@@ -62,7 +62,7 @@ const codeboltMCP = {
|
|
|
62
62
|
* @param toolBoxes - Array of toolbox names to list tools from
|
|
63
63
|
* @returns Promise with tools from the specified toolboxes
|
|
64
64
|
*/
|
|
65
|
-
|
|
65
|
+
listMcpFromServers: (toolBoxes) => {
|
|
66
66
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
67
67
|
"type": "codebolttools",
|
|
68
68
|
"action": "listToolsFromToolBoxes",
|
|
@@ -76,7 +76,7 @@ const codeboltMCP = {
|
|
|
76
76
|
* @param config - Configuration object for the toolbox
|
|
77
77
|
* @returns Promise with the configuration result
|
|
78
78
|
*/
|
|
79
|
-
|
|
79
|
+
configureMCPServer: (name, config) => {
|
|
80
80
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
81
81
|
"type": "codebolttools",
|
|
82
82
|
"action": "configureToolBox",
|
package/dist/modules/state.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AddToAgentStateResponse, GetAgentStateResponse } from '../types/socketMessageTypes';
|
|
2
|
+
import { ApplicationState } from '../types/commonTypes';
|
|
2
3
|
declare const cbstate: {
|
|
3
4
|
/**
|
|
4
5
|
* Retrieves the current application state from the server via WebSocket.
|
package/dist/modules/task.js
CHANGED
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const websocket_1 = __importDefault(require("../core/websocket"));
|
|
7
|
-
// import {AddTaskResponse,GetTasksResponse,UpdateTasksResponse } from '@codebolt/types';
|
|
8
7
|
/**
|
|
9
8
|
* Manages task operations via WebSocket communication.
|
|
10
9
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import { CommandError, TerminalInterruptResponse } from '
|
|
3
|
+
import { CommandError, TerminalInterruptResponse } from '../types/socketMessageTypes';
|
|
4
4
|
/**
|
|
5
5
|
* CustomEventEmitter class that extends the Node.js EventEmitter class.
|
|
6
6
|
*/
|
package/dist/modules/utils.d.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
import { FsEditFileAndApplyDiffResponse } from '../types/socketMessageTypes';
|
|
1
2
|
declare const cbutils: {
|
|
2
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Edits a file and applies a diff with AI assistance.
|
|
5
|
+
* @param {string} filePath - The path to the file to edit.
|
|
6
|
+
* @param {string} diff - The diff to apply.
|
|
7
|
+
* @param {string} diffIdentifier - The identifier for the diff.
|
|
8
|
+
* @param {string} prompt - The prompt for the AI model.
|
|
9
|
+
* @param {string} applyModel - Optional model to use for applying the diff.
|
|
10
|
+
* @returns {Promise<FsEditFileAndApplyDiffResponse>} A promise that resolves with the edit response.
|
|
11
|
+
*/
|
|
12
|
+
editFileAndApplyDiff: (filePath: string, diff: string, diffIdentifier: string, prompt: string, applyModel?: string) => Promise<FsEditFileAndApplyDiffResponse>;
|
|
3
13
|
};
|
|
4
14
|
export default cbutils;
|
package/dist/modules/utils.js
CHANGED
|
@@ -5,6 +5,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const websocket_1 = __importDefault(require("../core/websocket"));
|
|
7
7
|
const cbutils = {
|
|
8
|
+
/**
|
|
9
|
+
* Edits a file and applies a diff with AI assistance.
|
|
10
|
+
* @param {string} filePath - The path to the file to edit.
|
|
11
|
+
* @param {string} diff - The diff to apply.
|
|
12
|
+
* @param {string} diffIdentifier - The identifier for the diff.
|
|
13
|
+
* @param {string} prompt - The prompt for the AI model.
|
|
14
|
+
* @param {string} applyModel - Optional model to use for applying the diff.
|
|
15
|
+
* @returns {Promise<FsEditFileAndApplyDiffResponse>} A promise that resolves with the edit response.
|
|
16
|
+
*/
|
|
8
17
|
editFileAndApplyDiff: (filePath, diff, diffIdentifier, prompt, applyModel) => {
|
|
9
18
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
10
19
|
"type": "fsEvent",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddVectorItemResponse, GetVectorResponse, QueryVectorItemResponse } from '
|
|
1
|
+
import { AddVectorItemResponse, GetVectorResponse, QueryVectorItemResponse } from '../types/socketMessageTypes';
|
|
2
2
|
declare const VectorDB: {
|
|
3
3
|
/**
|
|
4
4
|
* Retrieves a vector from the vector database based on the provided key.
|