@codebolt/codeboltjs 2.0.6 → 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 +95 -88
- package/dist/index.js +63 -59
- 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/{modules → utils}/docutils.d.ts +2 -2
- package/dist/{modules → utils}/docutils.js +2 -2
- 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 +2 -1
- package/dist/utils.js +8 -3
- package/package.json +6 -1
|
@@ -60,8 +60,11 @@ class MessageManager extends events_1.EventEmitter {
|
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* Send a message and wait for a specific response type
|
|
63
|
+
* @param message The message to send
|
|
64
|
+
* @param expectedResponseType The type of response to wait for
|
|
65
|
+
* @param timeout Optional timeout in milliseconds. If not provided or set to 0, will wait indefinitely
|
|
63
66
|
*/
|
|
64
|
-
sendAndWaitForResponse(message, expectedResponseType, timeout =
|
|
67
|
+
sendAndWaitForResponse(message, expectedResponseType, timeout = 0) {
|
|
65
68
|
return new Promise((resolve, reject) => {
|
|
66
69
|
if (!this.websocket) {
|
|
67
70
|
reject(new Error('WebSocket is not initialized'));
|
|
@@ -72,6 +75,7 @@ class MessageManager extends events_1.EventEmitter {
|
|
|
72
75
|
const messageWithId = { ...message, requestId };
|
|
73
76
|
// Parse multiple message types separated by pipe
|
|
74
77
|
const messageTypes = expectedResponseType.split('|').map(type => type.trim());
|
|
78
|
+
console.log("Message types: ", messageTypes);
|
|
75
79
|
// Store the pending request
|
|
76
80
|
this.pendingRequests.set(requestId, {
|
|
77
81
|
resolve,
|
|
@@ -79,22 +83,25 @@ class MessageManager extends events_1.EventEmitter {
|
|
|
79
83
|
messageTypes,
|
|
80
84
|
requestId
|
|
81
85
|
});
|
|
82
|
-
// Set timeout
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
86
|
+
// Set timeout only if a positive timeout value is provided
|
|
87
|
+
let timeoutId;
|
|
88
|
+
if (timeout > 0) {
|
|
89
|
+
timeoutId = setTimeout(() => {
|
|
90
|
+
if (this.pendingRequests.has(requestId)) {
|
|
91
|
+
this.pendingRequests.delete(requestId);
|
|
92
|
+
reject(new Error(`Request timeout after ${timeout}ms for message types: ${expectedResponseType}`));
|
|
93
|
+
}
|
|
94
|
+
}, timeout);
|
|
95
|
+
// Override resolve to clear timeout
|
|
96
|
+
const originalResolve = resolve;
|
|
97
|
+
const wrappedResolve = (value) => {
|
|
98
|
+
clearTimeout(timeoutId);
|
|
99
|
+
originalResolve(value);
|
|
100
|
+
};
|
|
101
|
+
// Update the stored request with wrapped resolve
|
|
102
|
+
const request = this.pendingRequests.get(requestId);
|
|
103
|
+
request.resolve = wrappedResolve;
|
|
104
|
+
}
|
|
98
105
|
// Send the message
|
|
99
106
|
this.websocket.send(JSON.stringify(messageWithId));
|
|
100
107
|
});
|
package/dist/core/websocket.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { MessageManager } from './messageManager';
|
|
|
5
5
|
*/
|
|
6
6
|
declare class cbws {
|
|
7
7
|
websocket: WebSocket;
|
|
8
|
+
private initialized;
|
|
8
9
|
/**
|
|
9
10
|
* Constructs a new cbws instance and initializes the WebSocket connection.
|
|
10
11
|
*/
|
|
@@ -23,10 +24,19 @@ declare class cbws {
|
|
|
23
24
|
* @throws {Error} If the WebSocket is not open.
|
|
24
25
|
*/
|
|
25
26
|
get getWebsocket(): WebSocket;
|
|
27
|
+
/**
|
|
28
|
+
* Waits for the WebSocket to be ready and returns it.
|
|
29
|
+
* @returns {Promise<WebSocket>} A promise that resolves with the WebSocket instance when it's ready.
|
|
30
|
+
*/
|
|
31
|
+
waitForWebSocket(): Promise<WebSocket>;
|
|
26
32
|
/**
|
|
27
33
|
* Get the message manager instance
|
|
28
34
|
*/
|
|
29
35
|
get messageManager(): MessageManager;
|
|
36
|
+
/**
|
|
37
|
+
* Check if the WebSocket is initialized and ready
|
|
38
|
+
*/
|
|
39
|
+
get isInitialized(): boolean;
|
|
30
40
|
}
|
|
31
41
|
declare const _default: cbws;
|
|
32
42
|
export default _default;
|
package/dist/core/websocket.js
CHANGED
|
@@ -15,6 +15,8 @@ class cbws {
|
|
|
15
15
|
* Constructs a new cbws instance and initializes the WebSocket connection.
|
|
16
16
|
*/
|
|
17
17
|
constructor() {
|
|
18
|
+
this.initialized = false;
|
|
19
|
+
console.log('[WebSocket] Initializing cbws instance');
|
|
18
20
|
// this.websocket=undefined;
|
|
19
21
|
// this.websocket = new WebSocket(`ws://localhost:${process.env.SOCKET_PORT}/codebolt?id=${uniqueConnectionId}${agentIdParam}${parentIdParam}${process.env.Is_Dev ? '&dev=true' : ''}`);
|
|
20
22
|
// this.initializeWebSocket(initialMessage).catch(error => {
|
|
@@ -23,23 +25,29 @@ class cbws {
|
|
|
23
25
|
}
|
|
24
26
|
getUniqueConnectionId() {
|
|
25
27
|
try {
|
|
28
|
+
console.log('[WebSocket] Reading unique connection ID from codeboltagent.yaml');
|
|
26
29
|
let fileContents = fs_1.default.readFileSync('./codeboltagent.yaml', 'utf8');
|
|
27
30
|
let data = js_yaml_1.default.load(fileContents);
|
|
28
|
-
|
|
31
|
+
const connectionId = data.unique_connectionid;
|
|
32
|
+
console.log('[WebSocket] Successfully retrieved connection ID:', connectionId);
|
|
33
|
+
return connectionId;
|
|
29
34
|
}
|
|
30
35
|
catch (e) {
|
|
31
|
-
console.error('Unable to locate codeboltagent.yaml file
|
|
36
|
+
console.error('[WebSocket] Unable to locate codeboltagent.yaml file:', e);
|
|
32
37
|
return '';
|
|
33
38
|
}
|
|
34
39
|
}
|
|
35
40
|
getInitialMessage() {
|
|
36
41
|
try {
|
|
42
|
+
console.log('[WebSocket] Reading initial message from codeboltagent.yaml');
|
|
37
43
|
let fileContents = fs_1.default.readFileSync('./codeboltagent.yaml', 'utf8');
|
|
38
44
|
let data = js_yaml_1.default.load(fileContents);
|
|
39
|
-
|
|
45
|
+
const initialMessage = data.initial_message;
|
|
46
|
+
console.log('[WebSocket] Successfully retrieved initial message');
|
|
47
|
+
return initialMessage;
|
|
40
48
|
}
|
|
41
49
|
catch (e) {
|
|
42
|
-
|
|
50
|
+
console.warn('[WebSocket] Unable to locate codeboltagent.yaml file for initial message:', e);
|
|
43
51
|
return '';
|
|
44
52
|
}
|
|
45
53
|
}
|
|
@@ -49,6 +57,7 @@ class cbws {
|
|
|
49
57
|
* @returns {Promise<WebSocket>} A promise that resolves with the WebSocket instance.
|
|
50
58
|
*/
|
|
51
59
|
async initializeWebSocket() {
|
|
60
|
+
console.log('[WebSocket] Starting WebSocket initialization');
|
|
52
61
|
const uniqueConnectionId = this.getUniqueConnectionId();
|
|
53
62
|
const initialMessage = this.getInitialMessage();
|
|
54
63
|
const agentIdParam = process.env.agentId ? `&agentId=${process.env.agentId}` : '';
|
|
@@ -56,19 +65,49 @@ class cbws {
|
|
|
56
65
|
const parentAgentInstanceIdParam = process.env.parentAgentInstanceId ? `&parentAgentInstanceId=${process.env.parentAgentInstanceId}` : '';
|
|
57
66
|
const agentTask = process.env.agentTask ? `&agentTask=${process.env.agentTask}` : '';
|
|
58
67
|
const socketPort = process.env.SOCKET_PORT || '12345';
|
|
59
|
-
|
|
68
|
+
const wsUrl = `ws://localhost:${socketPort}/codebolt?id=${uniqueConnectionId}${agentIdParam}${parentIdParam}${parentAgentInstanceIdParam}${agentTask}${process.env.Is_Dev ? '&dev=true' : ''}`;
|
|
69
|
+
console.log('[WebSocket] Connecting to:', wsUrl);
|
|
70
|
+
this.websocket = new ws_1.default(wsUrl);
|
|
60
71
|
return new Promise((resolve, reject) => {
|
|
72
|
+
// Set a timeout for the connection
|
|
73
|
+
const connectionTimeout = setTimeout(() => {
|
|
74
|
+
console.error('[WebSocket] Connection timeout after 10 seconds');
|
|
75
|
+
if (this.websocket) {
|
|
76
|
+
this.websocket.terminate();
|
|
77
|
+
}
|
|
78
|
+
reject(new Error('WebSocket connection timeout after 10 seconds'));
|
|
79
|
+
}, 10000);
|
|
61
80
|
this.websocket.on('error', (error) => {
|
|
81
|
+
console.error('[WebSocket] Connection error:', error);
|
|
82
|
+
clearTimeout(connectionTimeout);
|
|
62
83
|
reject(error);
|
|
63
84
|
});
|
|
64
85
|
this.websocket.on('open', () => {
|
|
86
|
+
console.log('[WebSocket] Connection opened successfully');
|
|
87
|
+
clearTimeout(connectionTimeout);
|
|
65
88
|
// Initialize the message manager with this websocket
|
|
89
|
+
console.log('[WebSocket] Initializing message manager');
|
|
66
90
|
messageManager_1.default.initialize(this.websocket);
|
|
91
|
+
this.initialized = true;
|
|
92
|
+
console.log('[WebSocket] WebSocket fully initialized and ready');
|
|
67
93
|
resolve(this.websocket);
|
|
68
94
|
});
|
|
69
|
-
this.websocket.on('close', () => {
|
|
95
|
+
this.websocket.on('close', (code, reason) => {
|
|
96
|
+
console.log(`[WebSocket] Connection closed with code: ${code}, reason: ${reason.toString()}`);
|
|
97
|
+
clearTimeout(connectionTimeout);
|
|
70
98
|
// Clean up pending requests when connection closes
|
|
99
|
+
console.log('[WebSocket] Cleaning up message manager');
|
|
71
100
|
messageManager_1.default.cleanup();
|
|
101
|
+
this.initialized = false;
|
|
102
|
+
});
|
|
103
|
+
this.websocket.on('message', (data) => {
|
|
104
|
+
console.log('[WebSocket] Message received:', data.toString().substring(0, 100) + (data.toString().length > 100 ? '...' : ''));
|
|
105
|
+
});
|
|
106
|
+
this.websocket.on('ping', () => {
|
|
107
|
+
console.log('[WebSocket] Ping received');
|
|
108
|
+
});
|
|
109
|
+
this.websocket.on('pong', () => {
|
|
110
|
+
console.log('[WebSocket] Pong received');
|
|
72
111
|
});
|
|
73
112
|
});
|
|
74
113
|
}
|
|
@@ -78,18 +117,63 @@ class cbws {
|
|
|
78
117
|
* @throws {Error} If the WebSocket is not open.
|
|
79
118
|
*/
|
|
80
119
|
get getWebsocket() {
|
|
81
|
-
if (
|
|
120
|
+
if (!this.websocket) {
|
|
121
|
+
console.error('[WebSocket] WebSocket is not initialized');
|
|
122
|
+
throw new Error('WebSocket is not initialized');
|
|
123
|
+
}
|
|
124
|
+
if (this.websocket.readyState !== ws_1.default.OPEN) {
|
|
125
|
+
console.error('[WebSocket] Attempted to access WebSocket but it is not open. Ready state:', this.websocket.readyState);
|
|
82
126
|
throw new Error('WebSocket is not open');
|
|
83
127
|
}
|
|
84
|
-
|
|
128
|
+
console.log('[WebSocket] WebSocket access - ready state:', this.websocket.readyState);
|
|
129
|
+
return this.websocket;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Waits for the WebSocket to be ready and returns it.
|
|
133
|
+
* @returns {Promise<WebSocket>} A promise that resolves with the WebSocket instance when it's ready.
|
|
134
|
+
*/
|
|
135
|
+
async waitForWebSocket() {
|
|
136
|
+
if (!this.websocket) {
|
|
137
|
+
console.error('[WebSocket] WebSocket is not initialized');
|
|
138
|
+
throw new Error('WebSocket is not initialized');
|
|
139
|
+
}
|
|
140
|
+
if (this.websocket.readyState === ws_1.default.OPEN) {
|
|
141
|
+
console.log('[WebSocket] WebSocket is already open');
|
|
85
142
|
return this.websocket;
|
|
86
143
|
}
|
|
144
|
+
console.log('[WebSocket] Waiting for WebSocket to connect...');
|
|
145
|
+
return new Promise((resolve, reject) => {
|
|
146
|
+
const timeout = setTimeout(() => {
|
|
147
|
+
console.error('[WebSocket] Connection timeout after 5 seconds');
|
|
148
|
+
reject(new Error('WebSocket connection timeout'));
|
|
149
|
+
}, 5000);
|
|
150
|
+
this.websocket.once('open', () => {
|
|
151
|
+
console.log('[WebSocket] WebSocket connection established while waiting');
|
|
152
|
+
clearTimeout(timeout);
|
|
153
|
+
resolve(this.websocket);
|
|
154
|
+
});
|
|
155
|
+
this.websocket.once('error', (error) => {
|
|
156
|
+
console.error('[WebSocket] WebSocket error while waiting:', error);
|
|
157
|
+
clearTimeout(timeout);
|
|
158
|
+
reject(error);
|
|
159
|
+
});
|
|
160
|
+
});
|
|
87
161
|
}
|
|
88
162
|
/**
|
|
89
163
|
* Get the message manager instance
|
|
90
164
|
*/
|
|
91
165
|
get messageManager() {
|
|
166
|
+
if (!this.initialized) {
|
|
167
|
+
console.log('[WebSocket] Accessing message manager (not yet initialized)');
|
|
168
|
+
}
|
|
92
169
|
return messageManager_1.default;
|
|
93
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Check if the WebSocket is initialized and ready
|
|
173
|
+
*/
|
|
174
|
+
get isInitialized() {
|
|
175
|
+
return this.initialized && this.websocket && this.websocket.readyState === ws_1.default.OPEN;
|
|
176
|
+
}
|
|
94
177
|
}
|
|
178
|
+
// console.log('[WebSocket] Creating cbws singleton instance');
|
|
95
179
|
exports.default = new cbws();
|
package/dist/index.d.ts
CHANGED
|
@@ -1,30 +1,46 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import WebSocket from 'ws';
|
|
3
3
|
import { EventEmitter } from 'events';
|
|
4
|
+
import type { ChatMessageFromUser, LLMResponse, UserMessage } from './types/socketMessageTypes';
|
|
5
|
+
export type { Message, ToolCall, Tool, LLMInferenceParams, APIResponse, CodeboltConfig, ProgressCallback, ErrorCallback, SuccessCallback, CompletionCallback } from './types/libFunctionTypes';
|
|
4
6
|
/**
|
|
5
7
|
* @class Codebolt
|
|
6
8
|
* @description This class provides a unified interface to interact with various modules.
|
|
7
9
|
*/
|
|
8
10
|
declare class Codebolt {
|
|
11
|
+
websocket: WebSocket | null;
|
|
12
|
+
private isReady;
|
|
13
|
+
private readyPromise;
|
|
9
14
|
/**
|
|
10
15
|
* @constructor
|
|
11
16
|
* @description Initializes the websocket connection.
|
|
12
17
|
*/
|
|
13
18
|
constructor();
|
|
14
19
|
/**
|
|
15
|
-
* @method
|
|
16
|
-
* @description
|
|
17
|
-
* @
|
|
20
|
+
* @method initializeConnection
|
|
21
|
+
* @description Initializes the WebSocket connection asynchronously.
|
|
22
|
+
* @private
|
|
18
23
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
private initializeConnection;
|
|
25
|
+
/**
|
|
26
|
+
* @method waitForReady
|
|
27
|
+
* @description Waits for the Codebolt instance to be fully initialized.
|
|
28
|
+
* @returns {Promise<void>} A promise that resolves when the instance is ready.
|
|
29
|
+
*/
|
|
30
|
+
waitForReady(): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* @method isReady
|
|
33
|
+
* @description Checks if the Codebolt instance is ready for use.
|
|
34
|
+
* @returns {boolean} True if the instance is ready, false otherwise.
|
|
35
|
+
*/
|
|
36
|
+
get ready(): boolean;
|
|
21
37
|
fs: {
|
|
22
|
-
createFile: (fileName: string, source: string, filePath: string) => Promise<import("
|
|
23
|
-
createFolder: (folderName: string, folderPath: string) => Promise<import("
|
|
24
|
-
readFile: (filePath: string) => Promise<import("
|
|
25
|
-
updateFile: (filename: string, filePath: string, newContent: string) => Promise<import("
|
|
26
|
-
deleteFile: (filename: string, filePath: string) => Promise<import("
|
|
27
|
-
deleteFolder: (foldername: string, folderpath: string) => Promise<import("
|
|
38
|
+
createFile: (fileName: string, source: string, filePath: string) => Promise<import("./types/socketMessageTypes").CreateFileResponse>;
|
|
39
|
+
createFolder: (folderName: string, folderPath: string) => Promise<import("./types/socketMessageTypes").CreateFolderResponse>;
|
|
40
|
+
readFile: (filePath: string) => Promise<import("./types/socketMessageTypes").ReadFileResponse>;
|
|
41
|
+
updateFile: (filename: string, filePath: string, newContent: string) => Promise<import("./types/socketMessageTypes").UpdateFileResponse>;
|
|
42
|
+
deleteFile: (filename: string, filePath: string) => Promise<import("./types/socketMessageTypes").DeleteFileResponse>;
|
|
43
|
+
deleteFolder: (foldername: string, folderpath: string) => Promise<import("./types/socketMessageTypes").DeleteFolderResponse>;
|
|
28
44
|
listFile: (folderPath: string, isRecursive?: boolean) => Promise<any>;
|
|
29
45
|
listCodeDefinitionNames: (path: string) => Promise<{
|
|
30
46
|
success: boolean;
|
|
@@ -49,45 +65,45 @@ declare class Codebolt {
|
|
|
49
65
|
}>;
|
|
50
66
|
};
|
|
51
67
|
git: {
|
|
52
|
-
init: (path: string) => Promise<
|
|
53
|
-
pull: () => Promise<
|
|
54
|
-
push: () => Promise<
|
|
55
|
-
status: () => Promise<
|
|
56
|
-
addAll: () => Promise<
|
|
57
|
-
commit: (message: string) => Promise<
|
|
58
|
-
checkout: (branch: string) => Promise<
|
|
59
|
-
branch: (branch: string) => Promise<
|
|
60
|
-
logs: (path: string) => Promise<
|
|
61
|
-
diff: (commitHash: string) => Promise<
|
|
68
|
+
init: (path: string) => Promise<import("./types/socketMessageTypes").GitInitResponse>;
|
|
69
|
+
pull: () => Promise<import("./types/socketMessageTypes").GitPullResponse>;
|
|
70
|
+
push: () => Promise<import("./types/socketMessageTypes").GitPushResponse>;
|
|
71
|
+
status: () => Promise<import("./types/socketMessageTypes").GitStatusResponse>;
|
|
72
|
+
addAll: () => Promise<import("./types/socketMessageTypes").AddResponse>;
|
|
73
|
+
commit: (message: string) => Promise<import("./types/socketMessageTypes").GitCommitResponse>;
|
|
74
|
+
checkout: (branch: string) => Promise<import("./types/socketMessageTypes").GitCheckoutResponse>;
|
|
75
|
+
branch: (branch: string) => Promise<import("./types/socketMessageTypes").GitBranchResponse>;
|
|
76
|
+
logs: (path: string) => Promise<import("./types/socketMessageTypes").GitLogsResponse>;
|
|
77
|
+
diff: (commitHash: string) => Promise<import("./types/socketMessageTypes").GitDiffResponse>;
|
|
62
78
|
};
|
|
63
79
|
llm: {
|
|
64
|
-
inference: (message: string, llmrole: string) => Promise<
|
|
80
|
+
inference: (message: string, llmrole: string) => Promise<LLMResponse>;
|
|
65
81
|
};
|
|
66
82
|
browser: {
|
|
67
|
-
newPage: () => Promise<
|
|
68
|
-
getUrl: () => Promise<import("
|
|
69
|
-
goToPage: (url: string) => Promise<import("
|
|
70
|
-
screenshot: () => Promise<
|
|
71
|
-
getHTML: () => Promise<import("
|
|
72
|
-
getMarkdown: () => Promise<import("
|
|
83
|
+
newPage: () => Promise<import("./types/socketMessageTypes").BrowserActionResponseData>;
|
|
84
|
+
getUrl: () => Promise<import("./types/socketMessageTypes").UrlResponse>;
|
|
85
|
+
goToPage: (url: string) => Promise<import("./types/socketMessageTypes").GoToPageResponse>;
|
|
86
|
+
screenshot: () => Promise<import("./types/socketMessageTypes").BrowserScreenshotResponse>;
|
|
87
|
+
getHTML: () => Promise<import("./types/socketMessageTypes").HtmlReceived>;
|
|
88
|
+
getMarkdown: () => Promise<import("./types/socketMessageTypes").GetMarkdownResponse>;
|
|
73
89
|
getPDF: () => void;
|
|
74
90
|
pdfToText: () => void;
|
|
75
|
-
getContent: () => Promise<import("
|
|
76
|
-
getSnapShot: () => Promise<
|
|
77
|
-
getBrowserInfo: () => Promise<
|
|
78
|
-
extractText: () => Promise<import("
|
|
91
|
+
getContent: () => Promise<import("./types/socketMessageTypes").GetContentResponse>;
|
|
92
|
+
getSnapShot: () => Promise<import("./types/socketMessageTypes").BrowserSnapshotResponse>;
|
|
93
|
+
getBrowserInfo: () => Promise<import("./types/socketMessageTypes").BrowserInfoResponse>;
|
|
94
|
+
extractText: () => Promise<import("./types/socketMessageTypes").ExtractTextResponse>;
|
|
79
95
|
close: () => void;
|
|
80
|
-
scroll: (direction: string, pixels: string) => Promise<
|
|
81
|
-
type: (elementid: string, text: string) => Promise<
|
|
82
|
-
click: (elementid: string) => Promise<
|
|
83
|
-
enter: () => Promise<
|
|
84
|
-
search: (elementid: string, query: string) => Promise<
|
|
96
|
+
scroll: (direction: string, pixels: string) => Promise<import("./types/socketMessageTypes").BrowserActionResponseData>;
|
|
97
|
+
type: (elementid: string, text: string) => Promise<import("./types/socketMessageTypes").BrowserActionResponseData>;
|
|
98
|
+
click: (elementid: string) => Promise<import("./types/socketMessageTypes").BrowserActionResponseData>;
|
|
99
|
+
enter: () => Promise<import("./types/socketMessageTypes").BrowserActionResponseData>;
|
|
100
|
+
search: (elementid: string, query: string) => Promise<import("./types/socketMessageTypes").BrowserActionResponseData>;
|
|
85
101
|
};
|
|
86
102
|
chat: {
|
|
87
|
-
getChatHistory: () => Promise<import("
|
|
103
|
+
getChatHistory: () => Promise<import("./types/socketMessageTypes").ChatMessage[]>;
|
|
88
104
|
setRequestHandler: (handler: (request: any, response: (data: any) => void) => void | Promise<void>) => void;
|
|
89
105
|
sendMessage: (message: string, payload: any) => void;
|
|
90
|
-
waitforReply: (message: string) => Promise<
|
|
106
|
+
waitforReply: (message: string) => Promise<UserMessage>;
|
|
91
107
|
processStarted: (onStopClicked?: ((message: any) => void) | undefined) => {
|
|
92
108
|
stopProcess: () => void;
|
|
93
109
|
cleanup: () => void;
|
|
@@ -99,7 +115,7 @@ declare class Codebolt {
|
|
|
99
115
|
processFinished: () => void;
|
|
100
116
|
sendConfirmationRequest: (confirmationMessage: string, buttons?: string[], withFeedback?: boolean) => Promise<string>;
|
|
101
117
|
askQuestion: (question: string, buttons?: string[], withFeedback?: boolean) => Promise<string>;
|
|
102
|
-
sendNotificationEvent: (notificationMessage: string, type: "
|
|
118
|
+
sendNotificationEvent: (notificationMessage: string, type: "browser" | "terminal" | "git" | "debug" | "planner" | "editor" | "preview") => void;
|
|
103
119
|
};
|
|
104
120
|
terminal: {
|
|
105
121
|
eventEmitter: {
|
|
@@ -122,8 +138,8 @@ declare class Codebolt {
|
|
|
122
138
|
eventNames(): (string | symbol)[];
|
|
123
139
|
};
|
|
124
140
|
executeCommand: (command: string, returnEmptyStringOnSuccess?: boolean) => Promise<any>;
|
|
125
|
-
executeCommandRunUntilError: (command: string, executeInMain?: boolean) => Promise<import("
|
|
126
|
-
sendManualInterrupt(): Promise<import("
|
|
141
|
+
executeCommandRunUntilError: (command: string, executeInMain?: boolean) => Promise<import("./types/socketMessageTypes").CommandError>;
|
|
142
|
+
sendManualInterrupt(): Promise<import("./types/socketMessageTypes").TerminalInterruptResponse>;
|
|
127
143
|
executeCommandWithStream(command: string, executeInMain?: boolean): {
|
|
128
144
|
cleanup?: (() => void) | undefined;
|
|
129
145
|
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
|
|
@@ -145,14 +161,11 @@ declare class Codebolt {
|
|
|
145
161
|
};
|
|
146
162
|
};
|
|
147
163
|
codeutils: {
|
|
148
|
-
getJsTree: (filePath?: string | undefined) => Promise<import("./
|
|
164
|
+
getJsTree: (filePath?: string | undefined) => Promise<import("./types/InternalTypes").JSTreeResponse>;
|
|
149
165
|
getAllFilesAsMarkDown: () => Promise<string>;
|
|
150
|
-
performMatch: (matcherDefinition: object, problemPatterns: any[], problems?: any[]) => Promise<import("
|
|
151
|
-
getMatcherList: () => Promise<import("
|
|
152
|
-
matchDetail: (matcher: string) => Promise<import("
|
|
153
|
-
};
|
|
154
|
-
docutils: {
|
|
155
|
-
pdf_to_text: (pdf_path: string) => Promise<string>;
|
|
166
|
+
performMatch: (matcherDefinition: object, problemPatterns: any[], problems?: any[]) => Promise<import("./types/socketMessageTypes").MatchProblemResponse>;
|
|
167
|
+
getMatcherList: () => Promise<import("./types/socketMessageTypes").GetMatcherListTreeResponse>;
|
|
168
|
+
matchDetail: (matcher: string) => Promise<import("./types/socketMessageTypes").getMatchDetail>;
|
|
156
169
|
};
|
|
157
170
|
crawler: {
|
|
158
171
|
start: () => void;
|
|
@@ -186,7 +199,7 @@ declare class Codebolt {
|
|
|
186
199
|
class: string;
|
|
187
200
|
location: string;
|
|
188
201
|
}[]>;
|
|
189
|
-
getAstTreeInFile: (file: string, className?: string | undefined) => Promise<import("./
|
|
202
|
+
getAstTreeInFile: (file: string, className?: string | undefined) => Promise<import("./types/commonTypes").ASTNode | {
|
|
190
203
|
error: string;
|
|
191
204
|
}>;
|
|
192
205
|
};
|
|
@@ -214,19 +227,19 @@ declare class Codebolt {
|
|
|
214
227
|
};
|
|
215
228
|
project: {
|
|
216
229
|
getProjectSettings: () => Promise<any>;
|
|
217
|
-
getProjectPath: () => Promise<import("
|
|
218
|
-
getRepoMap: (message: any) => Promise<import("
|
|
230
|
+
getProjectPath: () => Promise<import("./types/socketMessageTypes").GetProjectPathResponse>;
|
|
231
|
+
getRepoMap: (message: any) => Promise<import("./types/socketMessageTypes").GetProjectPathResponse>;
|
|
219
232
|
runProject: () => void;
|
|
220
233
|
getEditorFileStatus: () => Promise<any>;
|
|
221
234
|
};
|
|
222
235
|
dbmemory: {
|
|
223
|
-
addKnowledge: (key: string, value: any) => Promise<import("
|
|
224
|
-
getKnowledge: (key: string) => Promise<import("
|
|
236
|
+
addKnowledge: (key: string, value: any) => Promise<import("./types/socketMessageTypes").MemorySetResponse>;
|
|
237
|
+
getKnowledge: (key: string) => Promise<import("./types/socketMessageTypes").MemoryGetResponse>;
|
|
225
238
|
};
|
|
226
239
|
cbstate: {
|
|
227
|
-
getApplicationState: () => Promise<import("
|
|
228
|
-
addToAgentState: (key: string, value: string) => Promise<import("
|
|
229
|
-
getAgentState: () => Promise<import("
|
|
240
|
+
getApplicationState: () => Promise<import("./types/commonTypes").ApplicationState>;
|
|
241
|
+
addToAgentState: (key: string, value: string) => Promise<import("./types/socketMessageTypes").AddToAgentStateResponse>;
|
|
242
|
+
getAgentState: () => Promise<import("./types/socketMessageTypes").GetAgentStateResponse>;
|
|
230
243
|
getProjectState: () => Promise<any>;
|
|
231
244
|
updateProjectState: (key: string, value: any) => Promise<any>;
|
|
232
245
|
};
|
|
@@ -236,60 +249,54 @@ declare class Codebolt {
|
|
|
236
249
|
updateTask: (task: string) => Promise<any>;
|
|
237
250
|
};
|
|
238
251
|
vectordb: {
|
|
239
|
-
getVector: (key: string) => Promise<import("
|
|
240
|
-
addVectorItem: (item: any) => Promise<import("
|
|
241
|
-
queryVectorItem: (key: string) => Promise<import("
|
|
242
|
-
queryVectorItems: (items: [], dbPath: string) => Promise<import("
|
|
252
|
+
getVector: (key: string) => Promise<import("./types/socketMessageTypes").GetVectorResponse>;
|
|
253
|
+
addVectorItem: (item: any) => Promise<import("./types/socketMessageTypes").AddVectorItemResponse>;
|
|
254
|
+
queryVectorItem: (key: string) => Promise<import("./types/socketMessageTypes").QueryVectorItemResponse>;
|
|
255
|
+
queryVectorItems: (items: [], dbPath: string) => Promise<import("./types/socketMessageTypes").QueryVectorItemResponse>;
|
|
243
256
|
};
|
|
244
257
|
debug: {
|
|
245
|
-
debug: (log: string, type: import("./modules/debug").logType) => Promise<import("
|
|
246
|
-
openDebugBrowser: (url: string, port: number) => Promise<import("
|
|
258
|
+
debug: (log: string, type: import("./modules/debug").logType) => Promise<import("./types/socketMessageTypes").DebugAddLogResponse>;
|
|
259
|
+
openDebugBrowser: (url: string, port: number) => Promise<import("./types/socketMessageTypes").OpenDebugBrowserResponse>;
|
|
247
260
|
};
|
|
248
261
|
tokenizer: {
|
|
249
|
-
addToken: (key: string) => Promise<import("
|
|
250
|
-
getToken: (key: string) => Promise<import("
|
|
262
|
+
addToken: (key: string) => Promise<import("./types/socketMessageTypes").AddTokenResponse>;
|
|
263
|
+
getToken: (key: string) => Promise<import("./types/socketMessageTypes").GetTokenResponse>;
|
|
251
264
|
};
|
|
252
265
|
chatSummary: {
|
|
253
|
-
summarizeAll: () => Promise<
|
|
254
|
-
role: string;
|
|
255
|
-
content: string;
|
|
256
|
-
}[]>;
|
|
266
|
+
summarizeAll: () => Promise<import("./types/socketMessageTypes").GetSummarizeAllResponse>;
|
|
257
267
|
summarize: (messages: {
|
|
258
268
|
role: string;
|
|
259
269
|
content: string;
|
|
260
|
-
}[], depth: number) => Promise<
|
|
261
|
-
role: string;
|
|
262
|
-
content: string;
|
|
263
|
-
}[]>;
|
|
270
|
+
}[], depth: number) => Promise<import("./types/socketMessageTypes").GetSummarizeResponse>;
|
|
264
271
|
};
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
+
mcp: {
|
|
273
|
+
getEnabledMCPServers: () => Promise<import("./types/socketMessageTypes").GetEnabledToolBoxesResponse>;
|
|
274
|
+
getLocalMCPServers: () => Promise<import("./types/socketMessageTypes").GetLocalToolBoxesResponse>;
|
|
275
|
+
getMentionedMCPServers: (userMessage: import("./utils").UserMessage) => Promise<import("./types/socketMessageTypes").GetAvailableToolBoxesResponse>;
|
|
276
|
+
searchAvailableMCPServers: (query: string) => Promise<import("./types/socketMessageTypes").SearchAvailableToolBoxesResponse>;
|
|
277
|
+
listMcpFromServers: (toolBoxes: string[]) => Promise<import("./types/socketMessageTypes").ListToolsFromToolBoxesResponse>;
|
|
278
|
+
configureMCPServer: (name: string, config: any) => Promise<import("./types/socketMessageTypes").ConfigureToolBoxResponse>;
|
|
272
279
|
getTools: (tools: {
|
|
273
280
|
toolbox: string;
|
|
274
281
|
toolName: string;
|
|
275
|
-
}[]) => Promise<
|
|
276
|
-
executeTool: (toolbox: string, toolName: string, params: any) => Promise<
|
|
282
|
+
}[]) => Promise<import("./types/socketMessageTypes").GetToolsResponse>;
|
|
283
|
+
executeTool: (toolbox: string, toolName: string, params: any) => Promise<import("./types/socketMessageTypes").ExecuteToolResponse>;
|
|
277
284
|
};
|
|
278
285
|
agent: {
|
|
279
|
-
findAgent: (task: string, maxResult: number | undefined, agents: never[] | undefined, agentLocaltion: import("./modules/agent").AgentLocation | undefined, getFrom: import("./modules/agent").FilterUsing.USE_VECTOR_DB) => Promise<
|
|
280
|
-
startAgent: (agentId: string, task: string) => Promise<
|
|
281
|
-
getAgentsList: (type?: import("./modules/agent").Agents) => Promise<
|
|
282
|
-
getAgentsDetail: (agentList?: never[]) => Promise<
|
|
286
|
+
findAgent: (task: string, maxResult: number | undefined, agents: never[] | undefined, agentLocaltion: import("./modules/agent").AgentLocation | undefined, getFrom: import("./modules/agent").FilterUsing.USE_VECTOR_DB) => Promise<import("./types/socketMessageTypes").FindAgentByTaskResponse>;
|
|
287
|
+
startAgent: (agentId: string, task: string) => Promise<import("./types/socketMessageTypes").TaskCompletionResponse>;
|
|
288
|
+
getAgentsList: (type?: import("./modules/agent").Agents) => Promise<import("./types/socketMessageTypes").ListAgentsResponse>;
|
|
289
|
+
getAgentsDetail: (agentList?: never[]) => Promise<import("./types/socketMessageTypes").AgentsDetailResponse>;
|
|
283
290
|
};
|
|
284
291
|
utils: {
|
|
285
|
-
editFileAndApplyDiff: (filePath: string, diff: string, diffIdentifier: string, prompt: string, applyModel?: string | undefined) => Promise<
|
|
292
|
+
editFileAndApplyDiff: (filePath: string, diff: string, diffIdentifier: string, prompt: string, applyModel?: string | undefined) => Promise<import("./types/socketMessageTypes").FsEditFileAndApplyDiffResponse>;
|
|
286
293
|
};
|
|
287
294
|
/**
|
|
288
295
|
* Sets up a listener for incoming messages with a direct handler function.
|
|
289
296
|
* @param {Function} handler - The handler function to call when a message is received.
|
|
290
297
|
* @returns {void}
|
|
291
298
|
*/
|
|
292
|
-
onMessage(handler: (userMessage:
|
|
299
|
+
onMessage(handler: (userMessage: ChatMessageFromUser) => void | Promise<void> | any | Promise<any>): void;
|
|
293
300
|
}
|
|
294
301
|
declare const codebolt: Codebolt;
|
|
295
302
|
export default codebolt;
|