@codebolt/codeboltjs 2.0.13 → 2.0.15
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 +3 -7
- package/dist/agentlib/followupquestionbuilder.d.ts +75 -0
- package/dist/agentlib/followupquestionbuilder.js +193 -0
- package/dist/agentlib/llmoutputhandler.d.ts +102 -0
- package/dist/agentlib/llmoutputhandler.js +451 -0
- package/dist/agentlib/promptbuilder.d.ts +171 -17
- package/dist/agentlib/promptbuilder.js +367 -49
- package/dist/agentlib/systemprompt.js +3 -3
- package/dist/agentlib/usermessage.d.ts +1 -1
- package/dist/agentlib/usermessage.js +5 -1
- package/dist/core/Codebolt.d.ts +52 -20
- package/dist/core/Codebolt.js +43 -1
- package/dist/core/websocket.js +2 -1
- package/dist/modules/llm.d.ts +23 -3
- package/dist/modules/llm.js +20 -3
- package/dist/modules/project.d.ts +3 -3
- package/dist/modules/project.js +1 -1
- package/dist/modules/state.d.ts +5 -3
- package/dist/modules/state.js +2 -0
- package/dist/modules/task.d.ts +126 -11
- package/dist/modules/task.js +262 -20
- package/dist/notificationfunctions/agent.d.ts +48 -0
- package/dist/notificationfunctions/agent.js +115 -0
- package/dist/notificationfunctions/browser.d.ts +60 -0
- package/dist/notificationfunctions/browser.js +145 -0
- package/dist/notificationfunctions/chat.d.ts +53 -0
- package/dist/notificationfunctions/chat.js +125 -0
- package/dist/notificationfunctions/codeutils.d.ts +60 -0
- package/dist/notificationfunctions/codeutils.js +145 -0
- package/dist/notificationfunctions/crawler.d.ts +59 -0
- package/dist/notificationfunctions/crawler.js +159 -0
- package/dist/notificationfunctions/dbmemory.d.ts +50 -0
- package/dist/notificationfunctions/dbmemory.js +132 -0
- package/dist/notificationfunctions/fs.d.ts +125 -0
- package/dist/notificationfunctions/fs.js +472 -0
- package/dist/notificationfunctions/git.d.ts +174 -0
- package/dist/notificationfunctions/git.js +521 -0
- package/dist/notificationfunctions/history.d.ts +38 -0
- package/dist/notificationfunctions/history.js +97 -0
- package/dist/notificationfunctions/index.d.ts +79 -0
- package/dist/notificationfunctions/index.js +102 -0
- package/dist/notificationfunctions/llm.d.ts +39 -0
- package/dist/notificationfunctions/llm.js +99 -0
- package/dist/notificationfunctions/mcp.d.ts +67 -0
- package/dist/notificationfunctions/mcp.js +192 -0
- package/dist/notificationfunctions/search.d.ts +50 -0
- package/dist/notificationfunctions/search.js +146 -0
- package/dist/notificationfunctions/system.d.ts +25 -0
- package/dist/notificationfunctions/system.js +59 -0
- package/dist/notificationfunctions/terminal.d.ts +26 -0
- package/dist/notificationfunctions/terminal.js +64 -0
- package/dist/notificationfunctions/todo.d.ts +63 -0
- package/dist/notificationfunctions/todo.js +164 -0
- package/dist/notificationfunctions/utils.d.ts +81 -0
- package/dist/notificationfunctions/utils.js +177 -0
- package/dist/types/InternalTypes.d.ts +1 -0
- package/dist/types/commonTypes.d.ts +26 -3
- package/dist/types/index.d.ts +2 -2
- package/dist/types/libFunctionTypes.d.ts +80 -3
- package/dist/types/notificationFunctions/agent.d.ts +8 -0
- package/dist/types/notificationFunctions/agent.js +2 -0
- package/dist/types/notificationFunctions/browser.d.ts +10 -0
- package/dist/types/notificationFunctions/browser.js +2 -0
- package/dist/types/notificationFunctions/chat.d.ts +10 -0
- package/dist/types/notificationFunctions/chat.js +2 -0
- package/dist/types/notificationFunctions/codeutils.d.ts +10 -0
- package/dist/types/notificationFunctions/codeutils.js +2 -0
- package/dist/types/notificationFunctions/crawler.d.ts +10 -0
- package/dist/types/notificationFunctions/crawler.js +2 -0
- package/dist/types/notificationFunctions/dbmemory.d.ts +9 -0
- package/dist/types/notificationFunctions/dbmemory.js +2 -0
- package/dist/types/notificationFunctions/fs.d.ts +27 -0
- package/dist/types/notificationFunctions/fs.js +2 -0
- package/dist/types/notificationFunctions/git.d.ts +29 -0
- package/dist/types/notificationFunctions/git.js +2 -0
- package/dist/types/notificationFunctions/history.d.ts +10 -0
- package/dist/types/notificationFunctions/history.js +2 -0
- package/dist/types/notificationFunctions/index.d.ts +0 -0
- package/dist/types/notificationFunctions/index.js +1 -0
- package/dist/types/notificationFunctions/llm.d.ts +10 -0
- package/dist/types/notificationFunctions/llm.js +2 -0
- package/dist/types/notificationFunctions/mcp.d.ts +16 -0
- package/dist/types/notificationFunctions/mcp.js +2 -0
- package/dist/types/notificationFunctions/search.d.ts +11 -0
- package/dist/types/notificationFunctions/search.js +2 -0
- package/dist/types/notificationFunctions/system.d.ts +7 -0
- package/dist/types/notificationFunctions/system.js +2 -0
- package/dist/types/notificationFunctions/terminal.d.ts +7 -0
- package/dist/types/notificationFunctions/terminal.js +2 -0
- package/dist/types/notificationFunctions/todo.d.ts +11 -0
- package/dist/types/notificationFunctions/todo.js +2 -0
- package/dist/types/notifications/agent.d.ts +31 -0
- package/dist/types/notifications/agent.js +3 -0
- package/dist/types/notifications/browser.d.ts +53 -0
- package/dist/types/notifications/browser.js +3 -0
- package/dist/types/notifications/chat.d.ts +37 -0
- package/dist/types/notifications/chat.js +3 -0
- package/dist/types/notifications/codeutils.d.ts +55 -0
- package/dist/types/notifications/codeutils.js +3 -0
- package/dist/types/notifications/crawler.d.ts +55 -0
- package/dist/types/notifications/crawler.js +3 -0
- package/dist/types/notifications/dbmemory.d.ts +31 -0
- package/dist/types/notifications/dbmemory.js +3 -0
- package/dist/types/notifications/fs.d.ts +180 -0
- package/dist/types/notifications/fs.js +3 -0
- package/dist/types/notifications/git.d.ts +205 -0
- package/dist/types/notifications/git.js +3 -0
- package/dist/types/notifications/history.d.ts +32 -0
- package/dist/types/notifications/history.js +3 -0
- package/dist/types/notifications/llm.d.ts +45 -0
- package/dist/types/notifications/llm.js +2 -0
- package/dist/types/notifications/mcp.d.ts +63 -0
- package/dist/types/notifications/mcp.js +3 -0
- package/dist/types/notifications/search.d.ts +47 -0
- package/dist/types/notifications/search.js +3 -0
- package/dist/types/notifications/system.d.ts +20 -0
- package/dist/types/notifications/system.js +2 -0
- package/dist/types/notifications/terminal.d.ts +17 -0
- package/dist/types/notifications/terminal.js +2 -0
- package/dist/types/notifications/todo.d.ts +60 -0
- package/dist/types/notifications/todo.js +3 -0
- package/dist/types/socketMessageTypes.d.ts +3 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +7 -1
- package/package.json +1 -1
package/dist/core/Codebolt.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import WebSocket from 'ws';
|
|
3
|
+
import { type NotificationFunctions } from '../notificationfunctions';
|
|
3
4
|
import type { UserMessage } from '../types/libFunctionTypes';
|
|
4
5
|
/**
|
|
5
6
|
* @class Codebolt
|
|
@@ -9,6 +10,7 @@ declare class Codebolt {
|
|
|
9
10
|
websocket: WebSocket | null;
|
|
10
11
|
private isReady;
|
|
11
12
|
private readyPromise;
|
|
13
|
+
private readyHandlers;
|
|
12
14
|
/**
|
|
13
15
|
* @constructor
|
|
14
16
|
* @description Initializes the websocket connection.
|
|
@@ -75,7 +77,23 @@ declare class Codebolt {
|
|
|
75
77
|
diff: (commitHash: string) => Promise<import("../types/socketMessageTypes").GitDiffResponse>;
|
|
76
78
|
};
|
|
77
79
|
llm: {
|
|
78
|
-
inference: (
|
|
80
|
+
inference: (params: {
|
|
81
|
+
messages: import("../types/libFunctionTypes").Message[];
|
|
82
|
+
tools?: any[] | undefined;
|
|
83
|
+
tool_choice?: string | undefined;
|
|
84
|
+
full?: boolean | undefined;
|
|
85
|
+
llmrole?: string | undefined;
|
|
86
|
+
max_tokens?: number | undefined;
|
|
87
|
+
temperature?: number | undefined;
|
|
88
|
+
stream?: boolean | undefined;
|
|
89
|
+
}, llmrole?: string | undefined) => Promise<{
|
|
90
|
+
/**
|
|
91
|
+
* @constructor
|
|
92
|
+
* @description Initializes the websocket connection.
|
|
93
|
+
*/
|
|
94
|
+
completion: any;
|
|
95
|
+
}>;
|
|
96
|
+
legacyInference: (message: string, llmrole: string) => Promise<import("../types/socketMessageTypes").LLMResponse>;
|
|
79
97
|
};
|
|
80
98
|
browser: {
|
|
81
99
|
newPage: () => Promise<import("../types/socketMessageTypes").BrowserActionResponseData>;
|
|
@@ -218,17 +236,13 @@ declare class Codebolt {
|
|
|
218
236
|
};
|
|
219
237
|
parseText: (text: string) => {
|
|
220
238
|
success: boolean;
|
|
221
|
-
parsed: string[];
|
|
222
|
-
* @method isReady
|
|
223
|
-
* @description Checks if the Codebolt instance is ready for use.
|
|
224
|
-
* @returns {boolean} True if the instance is ready, false otherwise.
|
|
225
|
-
*/
|
|
239
|
+
parsed: string[];
|
|
226
240
|
};
|
|
227
241
|
parseErrors: (output: any) => string[];
|
|
228
242
|
parseWarnings: (output: any) => string[];
|
|
229
243
|
};
|
|
230
244
|
project: {
|
|
231
|
-
getProjectSettings: () => Promise<
|
|
245
|
+
getProjectSettings: () => Promise<import("../types/socketMessageTypes").GetProjectSettingsResponse>;
|
|
232
246
|
getProjectPath: () => Promise<import("../types/socketMessageTypes").GetProjectPathResponse>;
|
|
233
247
|
getRepoMap: (message: any) => Promise<import("../types/socketMessageTypes").GetProjectPathResponse>;
|
|
234
248
|
runProject: () => void;
|
|
@@ -236,22 +250,36 @@ declare class Codebolt {
|
|
|
236
250
|
};
|
|
237
251
|
dbmemory: {
|
|
238
252
|
addKnowledge: (key: string, value: any) => Promise<import("../types/socketMessageTypes").MemorySetResponse>;
|
|
239
|
-
getKnowledge: (key: string) => Promise<import("../types/socketMessageTypes").MemoryGetResponse>;
|
|
240
|
-
* @constructor
|
|
241
|
-
* @description Initializes the websocket connection.
|
|
242
|
-
*/
|
|
253
|
+
getKnowledge: (key: string) => Promise<import("../types/socketMessageTypes").MemoryGetResponse>;
|
|
243
254
|
};
|
|
244
255
|
cbstate: {
|
|
245
256
|
getApplicationState: () => Promise<import("../types/commonTypes").ApplicationState>;
|
|
246
257
|
addToAgentState: (key: string, value: string) => Promise<import("../types/socketMessageTypes").AddToAgentStateResponse>;
|
|
247
258
|
getAgentState: () => Promise<import("../types/socketMessageTypes").GetAgentStateResponse>;
|
|
248
|
-
getProjectState: () => Promise<
|
|
249
|
-
updateProjectState: (key: string, value: any) => Promise<
|
|
259
|
+
getProjectState: () => Promise<import("../types/socketMessageTypes").GetProjectStateResponse>;
|
|
260
|
+
updateProjectState: (key: string, value: any) => Promise<import("../types/socketMessageTypes").UpdateProjectStateResponse>;
|
|
250
261
|
};
|
|
251
262
|
taskplaner: {
|
|
252
|
-
addTask: (
|
|
253
|
-
|
|
254
|
-
|
|
263
|
+
addTask: (params: import("../types/libFunctionTypes").TaskCreateOptions) => Promise<import("../types/commonTypes").TaskResponse>;
|
|
264
|
+
addSimpleTask: (task: string, agentId?: string) => Promise<import("../types/commonTypes").TaskResponse>;
|
|
265
|
+
getTasks: (filters?: import("../types/libFunctionTypes").TaskFilterOptions) => Promise<import("../types/commonTypes").TaskResponse>;
|
|
266
|
+
getTasksByAgent: (agentId: string) => Promise<import("../types/commonTypes").TaskResponse>;
|
|
267
|
+
getTasksByCategory: (category: string) => Promise<import("../types/commonTypes").TaskResponse>;
|
|
268
|
+
getAllAgents: () => Promise<import("../types/commonTypes").TaskResponse>;
|
|
269
|
+
updateTask: (params: import("../types/libFunctionTypes").TaskUpdateOptions) => Promise<import("../types/commonTypes").TaskResponse>;
|
|
270
|
+
updateSimpleTask: (taskId: string, task: string) => Promise<import("../types/commonTypes").TaskResponse>;
|
|
271
|
+
deleteTask: (taskId: string) => Promise<import("../types/commonTypes").TaskResponse>;
|
|
272
|
+
addSubTask: (params: import("../types/libFunctionTypes").AddSubTaskOptions) => Promise<import("../types/commonTypes").TaskResponse>;
|
|
273
|
+
updateSubTask: (params: import("../types/libFunctionTypes").UpdateSubTaskOptions) => Promise<import("../types/commonTypes").TaskResponse>;
|
|
274
|
+
deleteSubTask: (taskId: string, subtaskId: string) => Promise<import("../types/commonTypes").TaskResponse>;
|
|
275
|
+
createTasksFromMarkdown: (params: import("../types/libFunctionTypes").TaskMarkdownImportOptions) => Promise<import("../types/commonTypes").TaskResponse>;
|
|
276
|
+
exportTasksToMarkdown: (params?: import("../types/libFunctionTypes").TaskMarkdownExportOptions) => Promise<import("../types/commonTypes").TaskResponse>;
|
|
277
|
+
toggleTaskCompletion: (taskId: string, completed: boolean) => Promise<import("../types/commonTypes").TaskResponse>;
|
|
278
|
+
toggleSubTaskCompletion: (taskId: string, subtaskId: string, completed: boolean) => Promise<import("../types/commonTypes").TaskResponse>;
|
|
279
|
+
moveTaskToAgent: (taskId: string, newAgentId: string) => Promise<import("../types/commonTypes").TaskResponse>;
|
|
280
|
+
setTaskPriority: (taskId: string, priority: "low" | "medium" | "high") => Promise<import("../types/commonTypes").TaskResponse>;
|
|
281
|
+
addTaskTags: (taskId: string, tags: string[]) => Promise<import("../types/commonTypes").TaskResponse>;
|
|
282
|
+
createQuickTask: (title: string, agentId?: string, category?: string | undefined) => Promise<import("../types/commonTypes").TaskResponse>;
|
|
255
283
|
};
|
|
256
284
|
vectordb: {
|
|
257
285
|
getVector: (key: string) => Promise<import("../types/socketMessageTypes").GetVectorResponse>;
|
|
@@ -289,10 +317,6 @@ declare class Codebolt {
|
|
|
289
317
|
};
|
|
290
318
|
agent: {
|
|
291
319
|
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>;
|
|
292
|
-
/**
|
|
293
|
-
* @constructor
|
|
294
|
-
* @description Initializes the websocket connection.
|
|
295
|
-
*/
|
|
296
320
|
startAgent: (agentId: string, task: string) => Promise<import("../types/socketMessageTypes").TaskCompletionResponse>;
|
|
297
321
|
getAgentsList: (type?: import("../modules/agent").Agents) => Promise<import("../types/socketMessageTypes").ListAgentsResponse>;
|
|
298
322
|
getAgentsDetail: (agentList?: never[]) => Promise<import("../types/socketMessageTypes").AgentsDetailResponse>;
|
|
@@ -300,6 +324,14 @@ declare class Codebolt {
|
|
|
300
324
|
utils: {
|
|
301
325
|
editFileAndApplyDiff: (filePath: string, diff: string, diffIdentifier: string, prompt: string, applyModel?: string | undefined) => Promise<import("../types/socketMessageTypes").FsEditFileAndApplyDiffResponse>;
|
|
302
326
|
};
|
|
327
|
+
notify: NotificationFunctions;
|
|
328
|
+
/**
|
|
329
|
+
* Sets up a handler function to be executed when the WebSocket connection is established.
|
|
330
|
+
* If the connection is already established, the handler will be executed immediately.
|
|
331
|
+
* @param {Function} handler - The handler function to call when the connection is ready.
|
|
332
|
+
* @returns {void}
|
|
333
|
+
*/
|
|
334
|
+
onReady(handler: () => void | Promise<void>): void;
|
|
303
335
|
/**
|
|
304
336
|
* Sets up a listener for incoming messages with a direct handler function.
|
|
305
337
|
* @param {Function} handler - The handler function to call when a message is received.
|
package/dist/core/Codebolt.js
CHANGED
|
@@ -28,6 +28,7 @@ const history_1 = require("../modules/history");
|
|
|
28
28
|
const mcp_1 = __importDefault(require("../modules/mcp"));
|
|
29
29
|
const agent_1 = __importDefault(require("../modules/agent"));
|
|
30
30
|
const utils_1 = __importDefault(require("../modules/utils"));
|
|
31
|
+
const notificationfunctions_1 = require("../notificationfunctions");
|
|
31
32
|
/**
|
|
32
33
|
* @class Codebolt
|
|
33
34
|
* @description This class provides a unified interface to interact with various modules.
|
|
@@ -40,6 +41,7 @@ class Codebolt {
|
|
|
40
41
|
constructor() {
|
|
41
42
|
this.websocket = null;
|
|
42
43
|
this.isReady = false;
|
|
44
|
+
this.readyHandlers = [];
|
|
43
45
|
this.fs = fs_1.default;
|
|
44
46
|
this.git = git_1.default;
|
|
45
47
|
this.llm = llm_1.default;
|
|
@@ -64,6 +66,7 @@ class Codebolt {
|
|
|
64
66
|
this.mcp = mcp_1.default;
|
|
65
67
|
this.agent = agent_1.default;
|
|
66
68
|
this.utils = utils_1.default;
|
|
69
|
+
this.notify = notificationfunctions_1.notificationFunctions;
|
|
67
70
|
console.log("Codebolt Agent initialized");
|
|
68
71
|
this.readyPromise = this.initializeConnection();
|
|
69
72
|
}
|
|
@@ -78,6 +81,15 @@ class Codebolt {
|
|
|
78
81
|
this.websocket = websocket_1.default.getWebsocket;
|
|
79
82
|
this.isReady = true;
|
|
80
83
|
console.log("Codebolt WebSocket connection established");
|
|
84
|
+
// Execute all registered ready handlers
|
|
85
|
+
for (const handler of this.readyHandlers) {
|
|
86
|
+
try {
|
|
87
|
+
await handler();
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
console.error('Error executing ready handler:', error);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
81
93
|
}
|
|
82
94
|
catch (error) {
|
|
83
95
|
console.error('Failed to initialize WebSocket connection:', error);
|
|
@@ -100,6 +112,32 @@ class Codebolt {
|
|
|
100
112
|
get ready() {
|
|
101
113
|
return this.isReady;
|
|
102
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Sets up a handler function to be executed when the WebSocket connection is established.
|
|
117
|
+
* If the connection is already established, the handler will be executed immediately.
|
|
118
|
+
* @param {Function} handler - The handler function to call when the connection is ready.
|
|
119
|
+
* @returns {void}
|
|
120
|
+
*/
|
|
121
|
+
onReady(handler) {
|
|
122
|
+
if (this.isReady) {
|
|
123
|
+
// If already ready, execute the handler immediately
|
|
124
|
+
try {
|
|
125
|
+
const result = handler();
|
|
126
|
+
if (result instanceof Promise) {
|
|
127
|
+
result.catch(error => {
|
|
128
|
+
console.error('Error in ready handler:', error);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
console.error('Error in ready handler:', error);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
// If not ready yet, add to the list of handlers to execute when ready
|
|
138
|
+
this.readyHandlers.push(handler);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
103
141
|
/**
|
|
104
142
|
* Sets up a listener for incoming messages with a direct handler function.
|
|
105
143
|
* @param {Function} handler - The handler function to call when a message is received.
|
|
@@ -115,19 +153,23 @@ class Codebolt {
|
|
|
115
153
|
try {
|
|
116
154
|
// Extract user-facing message from internal socket message
|
|
117
155
|
const userMessage = {
|
|
156
|
+
type: response.type,
|
|
118
157
|
userMessage: response.message.userMessage,
|
|
119
158
|
currentFile: response.message.currentFile,
|
|
120
159
|
mentionedFiles: response.message.mentionedFiles || [],
|
|
121
160
|
mentionedFullPaths: response.message.mentionedFullPaths || [],
|
|
122
161
|
mentionedFolders: response.message.mentionedFolders || [],
|
|
123
162
|
uploadedImages: response.message.uploadedImages || [],
|
|
163
|
+
mentionedMCPs: response.message.mentionedMCPs || [],
|
|
124
164
|
selectedAgent: {
|
|
125
165
|
id: ((_a = response.message.selectedAgent) === null || _a === void 0 ? void 0 : _a.id) || '',
|
|
126
166
|
name: ((_b = response.message.selectedAgent) === null || _b === void 0 ? void 0 : _b.name) || ''
|
|
127
167
|
},
|
|
128
168
|
messageId: response.message.messageId,
|
|
129
169
|
threadId: response.message.threadId,
|
|
130
|
-
selection: response.message.selection
|
|
170
|
+
selection: response.message.selection,
|
|
171
|
+
remixPrompt: response.message.remixPrompt,
|
|
172
|
+
mentionedAgents: response.message.mentionedAgents
|
|
131
173
|
};
|
|
132
174
|
const result = await handler(userMessage);
|
|
133
175
|
// Send processStoped with optional message
|
package/dist/core/websocket.js
CHANGED
|
@@ -65,7 +65,8 @@ class cbws {
|
|
|
65
65
|
const parentAgentInstanceIdParam = process.env.parentAgentInstanceId ? `&parentAgentInstanceId=${process.env.parentAgentInstanceId}` : '';
|
|
66
66
|
const agentTask = process.env.agentTask ? `&agentTask=${process.env.agentTask}` : '';
|
|
67
67
|
const socketPort = process.env.SOCKET_PORT || '12345';
|
|
68
|
-
const
|
|
68
|
+
const serverUrl = process.env.CODEBOLT_SERVER_URL || 'localhost';
|
|
69
|
+
const wsUrl = `ws://${serverUrl}:${socketPort}/codebolt?id=${uniqueConnectionId}${agentIdParam}${parentIdParam}${parentAgentInstanceIdParam}${agentTask}${process.env.Is_Dev ? '&dev=true' : ''}`;
|
|
69
70
|
console.log('[WebSocket] Connecting to:', wsUrl);
|
|
70
71
|
this.websocket = new ws_1.default(wsUrl);
|
|
71
72
|
return new Promise((resolve, reject) => {
|
package/dist/modules/llm.d.ts
CHANGED
|
@@ -11,16 +11,36 @@ declare const cbllm: {
|
|
|
11
11
|
* for the role is not found, it falls back to the default model for the current agent,
|
|
12
12
|
* and ultimately to the default application-wide LLM if necessary.
|
|
13
13
|
*
|
|
14
|
-
* @param
|
|
14
|
+
* @param params - The inference parameters including:
|
|
15
15
|
* - messages: Array of conversation messages
|
|
16
16
|
* - tools: Available tools for the model to use
|
|
17
17
|
* - tool_choice: How the model should use tools
|
|
18
|
-
* -
|
|
18
|
+
* - full: Whether to return full response
|
|
19
19
|
* - max_tokens: Maximum number of tokens to generate
|
|
20
20
|
* - temperature: Temperature for response generation
|
|
21
21
|
* - stream: Whether to stream the response
|
|
22
22
|
* @returns A promise that resolves with the LLM's response
|
|
23
23
|
*/
|
|
24
|
-
inference: (
|
|
24
|
+
inference: (params: {
|
|
25
|
+
messages: Message[];
|
|
26
|
+
tools?: any[];
|
|
27
|
+
tool_choice?: string;
|
|
28
|
+
full?: boolean;
|
|
29
|
+
llmrole?: string;
|
|
30
|
+
max_tokens?: number;
|
|
31
|
+
temperature?: number;
|
|
32
|
+
stream?: boolean;
|
|
33
|
+
}, llmrole?: string) => Promise<{
|
|
34
|
+
completion: any;
|
|
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: (message: string, llmrole: string) => Promise<LLMResponse>;
|
|
25
45
|
};
|
|
26
46
|
export default cbllm;
|
package/dist/modules/llm.js
CHANGED
|
@@ -14,17 +14,34 @@ const cbllm = {
|
|
|
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
|
|
17
|
+
* @param params - The inference parameters including:
|
|
18
18
|
* - messages: Array of conversation messages
|
|
19
19
|
* - tools: Available tools for the model to use
|
|
20
20
|
* - tool_choice: How the model should use tools
|
|
21
|
-
* -
|
|
21
|
+
* - full: Whether to return full response
|
|
22
22
|
* - max_tokens: Maximum number of tokens to generate
|
|
23
23
|
* - temperature: Temperature for response generation
|
|
24
24
|
* - stream: Whether to stream the response
|
|
25
25
|
* @returns A promise that resolves with the LLM's response
|
|
26
26
|
*/
|
|
27
|
-
inference: async (
|
|
27
|
+
inference: async (params, llmrole) => {
|
|
28
|
+
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
29
|
+
"type": "inference",
|
|
30
|
+
"message": {
|
|
31
|
+
prompt: params,
|
|
32
|
+
llmrole
|
|
33
|
+
},
|
|
34
|
+
}, "llmResponse");
|
|
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, llmrole) => {
|
|
28
45
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
29
46
|
"type": "inference",
|
|
30
47
|
"message": {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { GetProjectPathResponse } from '../types/socketMessageTypes';
|
|
1
|
+
import { GetProjectPathResponse, GetProjectSettingsResponse } from '../types/socketMessageTypes';
|
|
2
2
|
/**
|
|
3
3
|
* A module for interacting with project settings and paths.
|
|
4
4
|
*/
|
|
5
5
|
declare const cbproject: {
|
|
6
6
|
/**
|
|
7
7
|
* Retrieves the project settings from the server.
|
|
8
|
-
* @returns {Promise<
|
|
8
|
+
* @returns {Promise<GetProjectSettingsResponse>} A promise that resolves with the project settings response.
|
|
9
9
|
*/
|
|
10
|
-
getProjectSettings: () => Promise<
|
|
10
|
+
getProjectSettings: () => Promise<GetProjectSettingsResponse>;
|
|
11
11
|
/**
|
|
12
12
|
* Retrieves the path of the current project.
|
|
13
13
|
* @returns {Promise<GetProjectPathResponse>} A promise that resolves with the project path response.
|
package/dist/modules/project.js
CHANGED
|
@@ -10,7 +10,7 @@ const websocket_1 = __importDefault(require("../core/websocket"));
|
|
|
10
10
|
const cbproject = {
|
|
11
11
|
/**
|
|
12
12
|
* Retrieves the project settings from the server.
|
|
13
|
-
* @returns {Promise<
|
|
13
|
+
* @returns {Promise<GetProjectSettingsResponse>} A promise that resolves with the project settings response.
|
|
14
14
|
*/
|
|
15
15
|
getProjectSettings: () => {
|
|
16
16
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
package/dist/modules/state.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddToAgentStateResponse, GetAgentStateResponse } from '../types/socketMessageTypes';
|
|
1
|
+
import { AddToAgentStateResponse, GetAgentStateResponse, GetProjectStateResponse, UpdateProjectStateResponse } from '../types/socketMessageTypes';
|
|
2
2
|
import { ApplicationState } from '../types/commonTypes';
|
|
3
3
|
declare const cbstate: {
|
|
4
4
|
/**
|
|
@@ -22,11 +22,13 @@ declare const cbstate: {
|
|
|
22
22
|
* Retrieves the current project state from the server via WebSocket.
|
|
23
23
|
* @returns {Promise<GetProjectStateResponse>} A promise that resolves with the project's state.
|
|
24
24
|
*/
|
|
25
|
-
getProjectState: () => Promise<
|
|
25
|
+
getProjectState: () => Promise<GetProjectStateResponse>;
|
|
26
26
|
/**
|
|
27
27
|
* Updates the project state on the server via WebSocket.
|
|
28
|
+
* @param {string} key - The key to update in the project state.
|
|
29
|
+
* @param {any} value - The value to set for the key.
|
|
28
30
|
* @returns {Promise<UpdateProjectStateResponse>} A promise that resolves with the response to the update request.
|
|
29
31
|
*/
|
|
30
|
-
updateProjectState: (key: string, value: any) => Promise<
|
|
32
|
+
updateProjectState: (key: string, value: any) => Promise<UpdateProjectStateResponse>;
|
|
31
33
|
};
|
|
32
34
|
export default cbstate;
|
package/dist/modules/state.js
CHANGED
|
@@ -53,6 +53,8 @@ const cbstate = {
|
|
|
53
53
|
},
|
|
54
54
|
/**
|
|
55
55
|
* Updates the project state on the server via WebSocket.
|
|
56
|
+
* @param {string} key - The key to update in the project state.
|
|
57
|
+
* @param {any} value - The value to set for the key.
|
|
56
58
|
* @returns {Promise<UpdateProjectStateResponse>} A promise that resolves with the response to the update request.
|
|
57
59
|
*/
|
|
58
60
|
updateProjectState: async (key, value) => {
|
package/dist/modules/task.d.ts
CHANGED
|
@@ -1,23 +1,138 @@
|
|
|
1
|
+
import type { Task, SubTask, TaskResponse, TaskCreateOptions, TaskUpdateOptions, AddSubTaskOptions, UpdateSubTaskOptions, TaskFilterOptions, TaskMarkdownImportOptions, TaskMarkdownExportOptions } from '../types';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* Enhanced task planner with agent-based organization and comprehensive task management.
|
|
3
4
|
*/
|
|
4
5
|
declare const taskplaner: {
|
|
5
6
|
/**
|
|
6
|
-
* Adds a task
|
|
7
|
-
* @param {
|
|
8
|
-
* @returns {Promise<
|
|
7
|
+
* Adds a new task with enhanced parameters.
|
|
8
|
+
* @param {TaskCreateOptions} params - The task parameters including title, agentId, description, etc.
|
|
9
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the add task event.
|
|
9
10
|
*/
|
|
10
|
-
addTask: (
|
|
11
|
+
addTask: (params: TaskCreateOptions) => Promise<TaskResponse>;
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
-
* @
|
|
13
|
+
* Adds a task using simple string parameter (legacy support).
|
|
14
|
+
* @param {string} task - The task title.
|
|
15
|
+
* @param {string} agentId - The agent ID (optional, defaults to 'default-agent').
|
|
16
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the add task event.
|
|
14
17
|
*/
|
|
15
|
-
|
|
18
|
+
addSimpleTask: (task: string, agentId?: string) => Promise<TaskResponse>;
|
|
16
19
|
/**
|
|
17
|
-
*
|
|
20
|
+
* Retrieves all tasks with optional filtering.
|
|
21
|
+
* @param {TaskFilterOptions} filters - Optional filters for agentId, category, phase, etc.
|
|
22
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the get tasks event.
|
|
23
|
+
*/
|
|
24
|
+
getTasks: (filters?: TaskFilterOptions) => Promise<TaskResponse>;
|
|
25
|
+
/**
|
|
26
|
+
* Retrieves tasks for a specific agent.
|
|
27
|
+
* @param {string} agentId - The agent ID.
|
|
28
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with tasks for the specified agent.
|
|
29
|
+
*/
|
|
30
|
+
getTasksByAgent: (agentId: string) => Promise<TaskResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves tasks by category.
|
|
33
|
+
* @param {string} category - The category name.
|
|
34
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with tasks in the specified category.
|
|
35
|
+
*/
|
|
36
|
+
getTasksByCategory: (category: string) => Promise<TaskResponse>;
|
|
37
|
+
/**
|
|
38
|
+
* Retrieves all available agents.
|
|
39
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the list of all agents.
|
|
40
|
+
*/
|
|
41
|
+
getAllAgents: () => Promise<TaskResponse>;
|
|
42
|
+
/**
|
|
43
|
+
* Updates an existing task.
|
|
44
|
+
* @param {TaskUpdateOptions} params - The task update parameters.
|
|
45
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the update task event.
|
|
46
|
+
*/
|
|
47
|
+
updateTask: (params: TaskUpdateOptions) => Promise<TaskResponse>;
|
|
48
|
+
/**
|
|
49
|
+
* Updates an existing task using legacy string parameter.
|
|
50
|
+
* @param {string} taskId - The task ID.
|
|
18
51
|
* @param {string} task - The updated task information.
|
|
19
|
-
* @returns {Promise<
|
|
52
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the update task event.
|
|
53
|
+
*/
|
|
54
|
+
updateSimpleTask: (taskId: string, task: string) => Promise<TaskResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* Deletes a task.
|
|
57
|
+
* @param {string} taskId - The task ID to delete.
|
|
58
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the delete task event.
|
|
59
|
+
*/
|
|
60
|
+
deleteTask: (taskId: string) => Promise<TaskResponse>;
|
|
61
|
+
/**
|
|
62
|
+
* Adds a subtask to an existing task.
|
|
63
|
+
* @param {AddSubTaskOptions} params - The subtask parameters.
|
|
64
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the add subtask event.
|
|
65
|
+
*/
|
|
66
|
+
addSubTask: (params: AddSubTaskOptions) => Promise<TaskResponse>;
|
|
67
|
+
/**
|
|
68
|
+
* Updates an existing subtask.
|
|
69
|
+
* @param {UpdateSubTaskOptions} params - The subtask update parameters.
|
|
70
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the update subtask event.
|
|
71
|
+
*/
|
|
72
|
+
updateSubTask: (params: UpdateSubTaskOptions) => Promise<TaskResponse>;
|
|
73
|
+
/**
|
|
74
|
+
* Deletes a subtask.
|
|
75
|
+
* @param {string} taskId - The parent task ID.
|
|
76
|
+
* @param {string} subtaskId - The subtask ID to delete.
|
|
77
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the delete subtask event.
|
|
78
|
+
*/
|
|
79
|
+
deleteSubTask: (taskId: string, subtaskId: string) => Promise<TaskResponse>;
|
|
80
|
+
/**
|
|
81
|
+
* Creates tasks from markdown content.
|
|
82
|
+
* @param {TaskMarkdownImportOptions} params - The markdown parameters including content, agentId, phase, and category.
|
|
83
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the create tasks from markdown event.
|
|
84
|
+
*/
|
|
85
|
+
createTasksFromMarkdown: (params: TaskMarkdownImportOptions) => Promise<TaskResponse>;
|
|
86
|
+
/**
|
|
87
|
+
* Exports tasks to markdown format.
|
|
88
|
+
* @param {TaskMarkdownExportOptions} params - The export parameters including optional phase, agentId, and category filters.
|
|
89
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the markdown content.
|
|
90
|
+
*/
|
|
91
|
+
exportTasksToMarkdown: (params?: TaskMarkdownExportOptions) => Promise<TaskResponse>;
|
|
92
|
+
/**
|
|
93
|
+
* Utility function to toggle task completion status.
|
|
94
|
+
* @param {string} taskId - The task ID.
|
|
95
|
+
* @param {boolean} completed - The new completion status.
|
|
96
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the update task event.
|
|
97
|
+
*/
|
|
98
|
+
toggleTaskCompletion: (taskId: string, completed: boolean) => Promise<TaskResponse>;
|
|
99
|
+
/**
|
|
100
|
+
* Utility function to toggle subtask completion status.
|
|
101
|
+
* @param {string} taskId - The parent task ID.
|
|
102
|
+
* @param {string} subtaskId - The subtask ID.
|
|
103
|
+
* @param {boolean} completed - The new completion status.
|
|
104
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the update subtask event.
|
|
105
|
+
*/
|
|
106
|
+
toggleSubTaskCompletion: (taskId: string, subtaskId: string, completed: boolean) => Promise<TaskResponse>;
|
|
107
|
+
/**
|
|
108
|
+
* Utility function to move a task to a different agent.
|
|
109
|
+
* @param {string} taskId - The task ID.
|
|
110
|
+
* @param {string} newAgentId - The new agent ID.
|
|
111
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the update task event.
|
|
112
|
+
*/
|
|
113
|
+
moveTaskToAgent: (taskId: string, newAgentId: string) => Promise<TaskResponse>;
|
|
114
|
+
/**
|
|
115
|
+
* Utility function to set task priority.
|
|
116
|
+
* @param {string} taskId - The task ID.
|
|
117
|
+
* @param {'low' | 'medium' | 'high'} priority - The priority level.
|
|
118
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the update task event.
|
|
119
|
+
*/
|
|
120
|
+
setTaskPriority: (taskId: string, priority: 'low' | 'medium' | 'high') => Promise<TaskResponse>;
|
|
121
|
+
/**
|
|
122
|
+
* Utility function to add tags to a task.
|
|
123
|
+
* @param {string} taskId - The task ID.
|
|
124
|
+
* @param {string[]} tags - The tags to add.
|
|
125
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the update task event.
|
|
126
|
+
*/
|
|
127
|
+
addTaskTags: (taskId: string, tags: string[]) => Promise<TaskResponse>;
|
|
128
|
+
/**
|
|
129
|
+
* Utility function to create a quick task with minimal parameters.
|
|
130
|
+
* @param {string} title - The task title.
|
|
131
|
+
* @param {string} agentId - The agent ID (optional, defaults to 'default-agent').
|
|
132
|
+
* @param {string} category - The category (optional).
|
|
133
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the add task event.
|
|
20
134
|
*/
|
|
21
|
-
|
|
135
|
+
createQuickTask: (title: string, agentId?: string, category?: string) => Promise<TaskResponse>;
|
|
22
136
|
};
|
|
137
|
+
export type { Task, SubTask, TaskResponse, TaskCreateOptions, TaskUpdateOptions, AddSubTaskOptions, UpdateSubTaskOptions, TaskFilterOptions, TaskMarkdownImportOptions, TaskMarkdownExportOptions };
|
|
23
138
|
export default taskplaner;
|