@codebolt/codeboltjs 2.0.12 → 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/Readme.md +138 -4
- 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 +342 -0
- package/dist/core/Codebolt.js +201 -0
- package/dist/core/websocket.js +2 -1
- package/dist/index.d.ts +4 -300
- package/dist/index.js +11 -137
- 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 +15 -0
- package/dist/types/index.js +15 -0
- package/dist/types/libFunctionTypes.d.ts +110 -4
- 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/index.d.ts
CHANGED
|
@@ -1,302 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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';
|
|
6
|
-
/**
|
|
7
|
-
* @class Codebolt
|
|
8
|
-
* @description This class provides a unified interface to interact with various modules.
|
|
9
|
-
*/
|
|
10
|
-
declare class Codebolt {
|
|
11
|
-
websocket: WebSocket | null;
|
|
12
|
-
private isReady;
|
|
13
|
-
private readyPromise;
|
|
14
|
-
/**
|
|
15
|
-
* @constructor
|
|
16
|
-
* @description Initializes the websocket connection.
|
|
17
|
-
*/
|
|
18
|
-
constructor();
|
|
19
|
-
/**
|
|
20
|
-
* @method initializeConnection
|
|
21
|
-
* @description Initializes the WebSocket connection asynchronously.
|
|
22
|
-
* @private
|
|
23
|
-
*/
|
|
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;
|
|
37
|
-
fs: {
|
|
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>;
|
|
44
|
-
listFile: (folderPath: string, isRecursive?: boolean) => Promise<any>;
|
|
45
|
-
listCodeDefinitionNames: (path: string) => Promise<{
|
|
46
|
-
success: boolean;
|
|
47
|
-
result: any;
|
|
48
|
-
}>;
|
|
49
|
-
searchFiles: (path: string, regex: string, filePattern: string) => Promise<{
|
|
50
|
-
success: boolean;
|
|
51
|
-
result: any;
|
|
52
|
-
}>;
|
|
53
|
-
writeToFile: (relPath: string, newContent: string) => Promise<any>;
|
|
54
|
-
grepSearch: (path: string, query: string, includePattern?: string | undefined, excludePattern?: string | undefined, caseSensitive?: boolean) => Promise<{
|
|
55
|
-
success: boolean;
|
|
56
|
-
result: any;
|
|
57
|
-
}>;
|
|
58
|
-
fileSearch: (query: string) => Promise<{
|
|
59
|
-
success: boolean;
|
|
60
|
-
result: any;
|
|
61
|
-
}>;
|
|
62
|
-
editFileWithDiff: (targetFile: string, codeEdit: string, diffIdentifier: string, prompt: string, applyModel?: string | undefined) => Promise<{
|
|
63
|
-
success: boolean;
|
|
64
|
-
result: any;
|
|
65
|
-
}>;
|
|
66
|
-
};
|
|
67
|
-
git: {
|
|
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>;
|
|
78
|
-
};
|
|
79
|
-
llm: {
|
|
80
|
-
inference: (message: string, llmrole: string) => Promise<LLMResponse>;
|
|
81
|
-
};
|
|
82
|
-
browser: {
|
|
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>;
|
|
89
|
-
getPDF: () => void;
|
|
90
|
-
pdfToText: () => void;
|
|
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>;
|
|
95
|
-
close: () => void;
|
|
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>;
|
|
101
|
-
};
|
|
102
|
-
chat: {
|
|
103
|
-
getChatHistory: () => Promise<import("./types/socketMessageTypes").ChatMessage[]>;
|
|
104
|
-
setRequestHandler: (handler: (request: any, response: (data: any) => void) => void | Promise<void>) => void;
|
|
105
|
-
sendMessage: (message: string, payload: any) => void;
|
|
106
|
-
waitforReply: (message: string) => Promise<UserMessage>;
|
|
107
|
-
processStarted: (onStopClicked?: ((message: any) => void) | undefined) => {
|
|
108
|
-
stopProcess: () => void;
|
|
109
|
-
cleanup: () => void;
|
|
110
|
-
} | {
|
|
111
|
-
stopProcess: () => void;
|
|
112
|
-
cleanup?: undefined;
|
|
113
|
-
};
|
|
114
|
-
stopProcess: () => void;
|
|
115
|
-
processFinished: () => void;
|
|
116
|
-
sendConfirmationRequest: (confirmationMessage: string, buttons?: string[], withFeedback?: boolean) => Promise<string>;
|
|
117
|
-
askQuestion: (question: string, buttons?: string[], withFeedback?: boolean) => Promise<string>;
|
|
118
|
-
sendNotificationEvent: (notificationMessage: string, type: "browser" | "terminal" | "git" | "debug" | "planner" | "editor" | "preview") => void;
|
|
119
|
-
};
|
|
120
|
-
terminal: {
|
|
121
|
-
eventEmitter: {
|
|
122
|
-
cleanup?: (() => void) | undefined;
|
|
123
|
-
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
|
|
124
|
-
addListener<K_1>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
125
|
-
on<K_2>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
126
|
-
once<K_3>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
127
|
-
removeListener<K_4>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
128
|
-
off<K_5>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
129
|
-
removeAllListeners(eventName?: string | symbol | undefined): any;
|
|
130
|
-
setMaxListeners(n: number): any;
|
|
131
|
-
getMaxListeners(): number;
|
|
132
|
-
listeners<K_6>(eventName: string | symbol): Function[];
|
|
133
|
-
rawListeners<K_7>(eventName: string | symbol): Function[];
|
|
134
|
-
emit<K_8>(eventName: string | symbol, ...args: any[]): boolean;
|
|
135
|
-
listenerCount<K_9>(eventName: string | symbol, listener?: Function | undefined): number;
|
|
136
|
-
prependListener<K_10>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
137
|
-
prependOnceListener<K_11>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
138
|
-
eventNames(): (string | symbol)[];
|
|
139
|
-
};
|
|
140
|
-
executeCommand: (command: string, returnEmptyStringOnSuccess?: boolean) => Promise<any>;
|
|
141
|
-
executeCommandRunUntilError: (command: string, executeInMain?: boolean) => Promise<import("./types/socketMessageTypes").CommandError>;
|
|
142
|
-
sendManualInterrupt(): Promise<import("./types/socketMessageTypes").TerminalInterruptResponse>;
|
|
143
|
-
executeCommandWithStream(command: string, executeInMain?: boolean): {
|
|
144
|
-
cleanup?: (() => void) | undefined;
|
|
145
|
-
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
|
|
146
|
-
addListener<K_1>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
147
|
-
on<K_2>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
148
|
-
once<K_3>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
149
|
-
removeListener<K_4>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
150
|
-
off<K_5>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
151
|
-
removeAllListeners(eventName?: string | symbol | undefined): any;
|
|
152
|
-
setMaxListeners(n: number): any;
|
|
153
|
-
getMaxListeners(): number;
|
|
154
|
-
listeners<K_6>(eventName: string | symbol): Function[];
|
|
155
|
-
rawListeners<K_7>(eventName: string | symbol): Function[];
|
|
156
|
-
emit<K_8>(eventName: string | symbol, ...args: any[]): boolean;
|
|
157
|
-
listenerCount<K_9>(eventName: string | symbol, listener?: Function | undefined): number;
|
|
158
|
-
prependListener<K_10>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
159
|
-
prependOnceListener<K_11>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
160
|
-
eventNames(): (string | symbol)[];
|
|
161
|
-
};
|
|
162
|
-
};
|
|
163
|
-
codeutils: {
|
|
164
|
-
getJsTree: (filePath?: string | undefined) => Promise<import("./types/InternalTypes").JSTreeResponse>;
|
|
165
|
-
getAllFilesAsMarkDown: () => 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>;
|
|
169
|
-
};
|
|
170
|
-
crawler: {
|
|
171
|
-
start: () => void;
|
|
172
|
-
screenshot: () => void;
|
|
173
|
-
goToPage: (url: string) => void;
|
|
174
|
-
scroll: (direction: string) => void;
|
|
175
|
-
click: (id: string) => Promise<any>;
|
|
176
|
-
};
|
|
177
|
-
search: {
|
|
178
|
-
init: (engine?: string) => void;
|
|
179
|
-
search: (query: string) => Promise<string>;
|
|
180
|
-
get_first_link: (query: string) => Promise<string>;
|
|
181
|
-
};
|
|
182
|
-
knowledge: {};
|
|
183
|
-
rag: {
|
|
184
|
-
init: () => void;
|
|
185
|
-
add_file: (filename: string, file_path: string) => void;
|
|
186
|
-
retrieve_related_knowledge: (query: string, filename: string) => void;
|
|
187
|
-
};
|
|
188
|
-
codeparsers: {
|
|
189
|
-
getClassesInFile: (file: string) => Promise<{
|
|
190
|
-
error: string;
|
|
191
|
-
} | {
|
|
192
|
-
name: any;
|
|
193
|
-
location: string;
|
|
194
|
-
}[]>;
|
|
195
|
-
getFunctionsinClass: (file: string, className: string) => Promise<{
|
|
196
|
-
error: string;
|
|
197
|
-
} | {
|
|
198
|
-
name: string;
|
|
199
|
-
class: string;
|
|
200
|
-
location: string;
|
|
201
|
-
}[]>;
|
|
202
|
-
getAstTreeInFile: (file: string, className?: string | undefined) => Promise<import("./types/commonTypes").ASTNode | {
|
|
203
|
-
error: string;
|
|
204
|
-
}>;
|
|
205
|
-
};
|
|
206
|
-
outputparsers: {
|
|
207
|
-
parseJSON: (jsonString: string) => {
|
|
208
|
-
success: boolean;
|
|
209
|
-
parsed?: any;
|
|
210
|
-
error?: Error | undefined;
|
|
211
|
-
};
|
|
212
|
-
parseXML: (xmlString: string) => {
|
|
213
|
-
success: boolean;
|
|
214
|
-
parsed?: any;
|
|
215
|
-
};
|
|
216
|
-
parseCSV: (csvString: string) => {
|
|
217
|
-
success: boolean;
|
|
218
|
-
parsed?: any[] | undefined;
|
|
219
|
-
error?: Error | undefined;
|
|
220
|
-
};
|
|
221
|
-
parseText: (text: string) => {
|
|
222
|
-
success: boolean;
|
|
223
|
-
parsed: string[];
|
|
224
|
-
};
|
|
225
|
-
parseErrors: (output: any) => string[];
|
|
226
|
-
parseWarnings: (output: any) => string[];
|
|
227
|
-
};
|
|
228
|
-
project: {
|
|
229
|
-
getProjectSettings: () => Promise<any>;
|
|
230
|
-
getProjectPath: () => Promise<import("./types/socketMessageTypes").GetProjectPathResponse>;
|
|
231
|
-
getRepoMap: (message: any) => Promise<import("./types/socketMessageTypes").GetProjectPathResponse>;
|
|
232
|
-
runProject: () => void;
|
|
233
|
-
getEditorFileStatus: () => Promise<any>;
|
|
234
|
-
};
|
|
235
|
-
dbmemory: {
|
|
236
|
-
addKnowledge: (key: string, value: any) => Promise<import("./types/socketMessageTypes").MemorySetResponse>;
|
|
237
|
-
getKnowledge: (key: string) => Promise<import("./types/socketMessageTypes").MemoryGetResponse>;
|
|
238
|
-
};
|
|
239
|
-
cbstate: {
|
|
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>;
|
|
243
|
-
getProjectState: () => Promise<any>;
|
|
244
|
-
updateProjectState: (key: string, value: any) => Promise<any>;
|
|
245
|
-
};
|
|
246
|
-
taskplaner: {
|
|
247
|
-
addTask: (task: string) => Promise<any>;
|
|
248
|
-
getTasks: () => Promise<any>;
|
|
249
|
-
updateTask: (task: string) => Promise<any>;
|
|
250
|
-
};
|
|
251
|
-
vectordb: {
|
|
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>;
|
|
256
|
-
};
|
|
257
|
-
debug: {
|
|
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>;
|
|
260
|
-
};
|
|
261
|
-
tokenizer: {
|
|
262
|
-
addToken: (key: string) => Promise<import("./types/socketMessageTypes").AddTokenResponse>;
|
|
263
|
-
getToken: (key: string) => Promise<import("./types/socketMessageTypes").GetTokenResponse>;
|
|
264
|
-
};
|
|
265
|
-
chatSummary: {
|
|
266
|
-
summarizeAll: () => Promise<import("./types/socketMessageTypes").GetSummarizeAllResponse>;
|
|
267
|
-
summarize: (messages: {
|
|
268
|
-
role: string;
|
|
269
|
-
content: string;
|
|
270
|
-
}[], depth: number) => Promise<import("./types/socketMessageTypes").GetSummarizeResponse>;
|
|
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>;
|
|
279
|
-
getTools: (tools: {
|
|
280
|
-
toolbox: string;
|
|
281
|
-
toolName: string;
|
|
282
|
-
}[]) => Promise<import("./types/socketMessageTypes").GetToolsResponse>;
|
|
283
|
-
executeTool: (toolbox: string, toolName: string, params: any) => Promise<import("./types/socketMessageTypes").ExecuteToolResponse>;
|
|
284
|
-
};
|
|
285
|
-
agent: {
|
|
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>;
|
|
290
|
-
};
|
|
291
|
-
utils: {
|
|
292
|
-
editFileAndApplyDiff: (filePath: string, diff: string, diffIdentifier: string, prompt: string, applyModel?: string | undefined) => Promise<import("./types/socketMessageTypes").FsEditFileAndApplyDiffResponse>;
|
|
293
|
-
};
|
|
294
|
-
/**
|
|
295
|
-
* Sets up a listener for incoming messages with a direct handler function.
|
|
296
|
-
* @param {Function} handler - The handler function to call when a message is received.
|
|
297
|
-
* @returns {void}
|
|
298
|
-
*/
|
|
299
|
-
onMessage(handler: (userMessage: ChatMessageFromUser) => void | Promise<void> | any | Promise<any>): void;
|
|
300
|
-
}
|
|
1
|
+
import Codebolt from './core/Codebolt';
|
|
2
|
+
export type { Message, ToolCall, Tool, UserMessage, LLMInferenceParams, APIResponse, CodeboltConfig, ProgressCallback, ErrorCallback, SuccessCallback, CompletionCallback, OpenAIMessage, OpenAITool, ConversationEntry, ToolResult, ToolDetails, UserMessageContent, CodeboltAPI, ReadFileOptions, WriteFileOptions, ListFilesOptions, SearchFilesOptions, GrepSearchOptions, BrowserNavigationOptions, BrowserScreenshotOptions, BrowserElementSelector, TerminalExecuteOptions, GitCommitOptions, GitLogOptions, LLMChatOptions, VectorAddOptions, VectorQueryOptions, AgentMessageHandler, AgentConfiguration, MemorySetOptions, MemoryGetOptions, TaskCreateOptions, TaskUpdateOptions, CodeAnalysisOptions, CodeParseOptions, DebugLogOptions, ProjectInfo, CrawlerOptions, MCPExecuteOptions, MCPConfigureOptions, StateUpdateOptions, ChatSendOptions, ChatHistoryOptions, NotificationOptions, PaginationOptions, FilterOptions, AsyncOperationOptions, APIEventMap } from './types/libFunctionTypes';
|
|
3
|
+
export type { GitFileStatus, StatusResult, CommitSummary, DiffResult, AgentFunction, AgentDetail, Agent, Task, VectorItem, VectorQueryResult, FileEntry, SearchMatch, SearchResult, BrowserElement, CodeIssue, CodeAnalysis, CodeMatcher, MCPTool, MCPServer, ASTNode, Notification, DeepPartial, DeepRequired, Optional, Required } from './types/commonTypes';
|
|
301
4
|
declare const codebolt: Codebolt;
|
|
302
5
|
export default codebolt;
|
|
6
|
+
export { Codebolt };
|
package/dist/index.js
CHANGED
|
@@ -3,145 +3,19 @@ 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
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const rag_1 = __importDefault(require("./modules/rag"));
|
|
17
|
-
const codeparsers_1 = __importDefault(require("./modules/codeparsers"));
|
|
18
|
-
const outputparsers_1 = __importDefault(require("./modules/outputparsers"));
|
|
19
|
-
const project_1 = __importDefault(require("./modules/project"));
|
|
20
|
-
const git_1 = __importDefault(require("./modules/git"));
|
|
21
|
-
const dbmemory_1 = __importDefault(require("./modules/dbmemory"));
|
|
22
|
-
const state_1 = __importDefault(require("./modules/state"));
|
|
23
|
-
const task_1 = __importDefault(require("./modules/task"));
|
|
24
|
-
const vectordb_1 = __importDefault(require("./modules/vectordb"));
|
|
25
|
-
const debug_1 = __importDefault(require("./modules/debug"));
|
|
26
|
-
const tokenizer_1 = __importDefault(require("./modules/tokenizer"));
|
|
27
|
-
const history_1 = require("./modules/history");
|
|
28
|
-
const mcp_1 = __importDefault(require("./modules/mcp"));
|
|
29
|
-
const agent_1 = __importDefault(require("./modules/agent"));
|
|
30
|
-
const utils_1 = __importDefault(require("./modules/utils"));
|
|
31
|
-
/**
|
|
32
|
-
* @class Codebolt
|
|
33
|
-
* @description This class provides a unified interface to interact with various modules.
|
|
34
|
-
*/
|
|
35
|
-
class Codebolt {
|
|
36
|
-
/**
|
|
37
|
-
* @constructor
|
|
38
|
-
* @description Initializes the websocket connection.
|
|
39
|
-
*/
|
|
40
|
-
constructor() {
|
|
41
|
-
this.websocket = null;
|
|
42
|
-
this.isReady = false;
|
|
43
|
-
this.fs = fs_1.default;
|
|
44
|
-
this.git = git_1.default;
|
|
45
|
-
this.llm = llm_1.default;
|
|
46
|
-
this.browser = browser_1.default;
|
|
47
|
-
this.chat = chat_1.default;
|
|
48
|
-
this.terminal = terminal_1.default;
|
|
49
|
-
this.codeutils = codeutils_1.default;
|
|
50
|
-
this.crawler = crawler_1.default;
|
|
51
|
-
this.search = search_1.default;
|
|
52
|
-
this.knowledge = knowledge_1.default;
|
|
53
|
-
this.rag = rag_1.default;
|
|
54
|
-
this.codeparsers = codeparsers_1.default;
|
|
55
|
-
this.outputparsers = outputparsers_1.default;
|
|
56
|
-
this.project = project_1.default;
|
|
57
|
-
this.dbmemory = dbmemory_1.default;
|
|
58
|
-
this.cbstate = state_1.default;
|
|
59
|
-
this.taskplaner = task_1.default;
|
|
60
|
-
this.vectordb = vectordb_1.default;
|
|
61
|
-
this.debug = debug_1.default;
|
|
62
|
-
this.tokenizer = tokenizer_1.default;
|
|
63
|
-
this.chatSummary = history_1.chatSummary;
|
|
64
|
-
this.mcp = mcp_1.default;
|
|
65
|
-
this.agent = agent_1.default;
|
|
66
|
-
this.utils = utils_1.default;
|
|
67
|
-
console.log("Codebolt Agent initialized");
|
|
68
|
-
this.readyPromise = this.initializeConnection();
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* @method initializeConnection
|
|
72
|
-
* @description Initializes the WebSocket connection asynchronously.
|
|
73
|
-
* @private
|
|
74
|
-
*/
|
|
75
|
-
async initializeConnection() {
|
|
76
|
-
try {
|
|
77
|
-
await websocket_1.default.initializeWebSocket();
|
|
78
|
-
this.websocket = websocket_1.default.getWebsocket;
|
|
79
|
-
this.isReady = true;
|
|
80
|
-
console.log("Codebolt WebSocket connection established");
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
console.error('Failed to initialize WebSocket connection:', error);
|
|
84
|
-
throw error;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* @method waitForReady
|
|
89
|
-
* @description Waits for the Codebolt instance to be fully initialized.
|
|
90
|
-
* @returns {Promise<void>} A promise that resolves when the instance is ready.
|
|
91
|
-
*/
|
|
92
|
-
async waitForReady() {
|
|
93
|
-
return this.readyPromise;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* @method isReady
|
|
97
|
-
* @description Checks if the Codebolt instance is ready for use.
|
|
98
|
-
* @returns {boolean} True if the instance is ready, false otherwise.
|
|
99
|
-
*/
|
|
100
|
-
get ready() {
|
|
101
|
-
return this.isReady;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Sets up a listener for incoming messages with a direct handler function.
|
|
105
|
-
* @param {Function} handler - The handler function to call when a message is received.
|
|
106
|
-
* @returns {void}
|
|
107
|
-
*/
|
|
108
|
-
onMessage(handler) {
|
|
109
|
-
// Wait for the WebSocket to be ready before setting up the handler
|
|
110
|
-
this.waitForReady().then(() => {
|
|
111
|
-
const handleUserMessage = async (response) => {
|
|
112
|
-
console.log("Message received By Agent Library Starting Custom Agent Handler Logic");
|
|
113
|
-
if (response.type === "messageResponse") {
|
|
114
|
-
try {
|
|
115
|
-
const result = await handler(response.message);
|
|
116
|
-
// Send processStoped with optional message
|
|
117
|
-
const message = {
|
|
118
|
-
"type": "processStoped"
|
|
119
|
-
};
|
|
120
|
-
// If handler returned data, include it as message
|
|
121
|
-
if (result !== undefined && result !== null) {
|
|
122
|
-
message.message = result;
|
|
123
|
-
}
|
|
124
|
-
websocket_1.default.messageManager.send(message);
|
|
125
|
-
}
|
|
126
|
-
catch (error) {
|
|
127
|
-
console.error('Error in user message handler:', error);
|
|
128
|
-
// Send processStoped even if there's an error
|
|
129
|
-
websocket_1.default.messageManager.send({
|
|
130
|
-
"type": "processStoped",
|
|
131
|
-
"error": error instanceof Error ? error.message : "Unknown error occurred"
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
websocket_1.default.messageManager.on('message', handleUserMessage);
|
|
137
|
-
}).catch(error => {
|
|
138
|
-
console.error('Failed to set up message handler:', error);
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
const codebolt = new Codebolt();
|
|
6
|
+
exports.Codebolt = void 0;
|
|
7
|
+
const Codebolt_1 = __importDefault(require("./core/Codebolt"));
|
|
8
|
+
exports.Codebolt = Codebolt_1.default;
|
|
9
|
+
// ================================
|
|
10
|
+
// Main Library Instance
|
|
11
|
+
// ================================
|
|
12
|
+
const codebolt = new Codebolt_1.default();
|
|
13
|
+
// ================================
|
|
14
|
+
// Export the Main Instance and Class
|
|
15
|
+
// ================================
|
|
143
16
|
// For ES6 modules (import)
|
|
144
17
|
exports.default = codebolt;
|
|
145
18
|
// For CommonJS compatibility (require)
|
|
146
19
|
module.exports = codebolt;
|
|
147
20
|
module.exports.default = codebolt;
|
|
21
|
+
module.exports.Codebolt = Codebolt_1.default;
|
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) => {
|