-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
262 lines (262 loc) · 14 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
/// <reference types="node" />
import WebSocket from 'ws';
import { EventEmitter } from 'events';
/**
* @class Codebolt
* @description This class provides a unified interface to interact with various modules.
*/
declare class Codebolt {
/**
* @constructor
* @description Initializes the websocket connection.
*/
constructor();
/**
* @method waitForConnection
* @description Waits for the WebSocket connection to open.
* @returns {Promise<void>} A promise that resolves when the WebSocket connection is open.
*/
waitForConnection(): Promise<void>;
websocket: WebSocket | null;
fs: {
createFile: (fileName: string, source: string, filePath: string) => Promise<import("@codebolt/types").CreateFileResponse>;
createFolder: (folderName: string, folderPath: string) => Promise<import("@codebolt/types").CreateFolderResponse>;
readFile: (filePath: string) => Promise<import("@codebolt/types").ReadFileResponse>;
updateFile: (filename: string, filePath: string, newContent: string) => Promise<import("@codebolt/types").UpdateFileResponse>;
deleteFile: (filename: string, filePath: string) => Promise<import("@codebolt/types").DeleteFileResponse>;
deleteFolder: (foldername: string, folderpath: string) => Promise<import("@codebolt/types").DeleteFolderResponse>;
listFile: (folderPath: string, isRecursive?: boolean) => Promise<any>;
listCodeDefinitionNames: (path: string) => Promise<{
success: boolean;
result: any;
}>;
searchFiles: (path: string, regex: string, filePattern: string) => Promise<{
success: boolean;
result: any;
}>;
writeToFile: (relPath: string, newContent: string) => Promise<unknown>;
};
git: {
init: (path: string) => Promise<any>;
clone: (url: string, path: string) => Promise<any>;
pull: (path: string) => Promise<any>;
push: (path: string) => Promise<any>;
status: (path: string) => Promise<any>;
add: (path: string) => Promise<any>;
commit: (message: string) => Promise<any>;
checkout: (path: string, branch: string) => Promise<any>;
branch: (path: string, branch: string) => Promise<any>;
logs: (path: string) => Promise<any>;
diff: (commitHash: string, path: string) => Promise<any>;
};
llm: {
inference: (message: string, llmrole: string) => Promise<import("@codebolt/types").LLMResponse>;
};
browser: {
newPage: () => Promise<unknown>;
getUrl: () => Promise<import("@codebolt/types").UrlResponse>;
goToPage: (url: string) => Promise<import("@codebolt/types").GoToPageResponse>;
screenshot: () => Promise<unknown>;
getHTML: () => Promise<import("@codebolt/types").HtmlReceived>;
getMarkdown: () => Promise<import("@codebolt/types").GetMarkdownResponse>;
getPDF: () => void;
pdfToText: () => void;
getContent: () => Promise<import("@codebolt/types").GetContentResponse>;
getSnapShot: () => Promise<any>;
getBrowserInfo: () => Promise<any>;
extractText: () => Promise<import("@codebolt/types").ExtractTextResponse>;
close: () => void;
scroll: (direction: string, pixels: string) => Promise<unknown>;
type: (elementid: string, text: string) => Promise<unknown>;
click: (elementid: string) => Promise<unknown>;
enter: () => Promise<unknown>;
search: (elementid: string, query: string) => Promise<unknown>;
};
chat: {
getChatHistory: () => Promise<import("@codebolt/types").ChatMessage[]>;
setRequestHandler: (handler: (request: any, response: (data: any) => void) => void | Promise<void>) => void;
onActionMessage: () => {
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
addListener<K_1>(eventName: string | symbol, listener: (...args: any[]) => void): any;
on<K_2>(eventName: string | symbol, listener: (...args: any[]) => void): any;
once<K_3>(eventName: string | symbol, listener: (...args: any[]) => void): any;
removeListener<K_4>(eventName: string | symbol, listener: (...args: any[]) => void): any;
off<K_5>(eventName: string | symbol, listener: (...args: any[]) => void): any;
removeAllListeners(eventName?: string | symbol | undefined): any;
setMaxListeners(n: number): any;
getMaxListeners(): number;
listeners<K_6>(eventName: string | symbol): Function[];
rawListeners<K_7>(eventName: string | symbol): Function[];
emit<K_8>(eventName: string | symbol, ...args: any[]): boolean;
listenerCount<K_9>(eventName: string | symbol, listener?: Function | undefined): number;
prependListener<K_10>(eventName: string | symbol, listener: (...args: any[]) => void): any;
prependOnceListener<K_11>(eventName: string | symbol, listener: (...args: any[]) => void): any;
eventNames(): (string | symbol)[];
};
sendMessage: (message: string, payload: any) => void;
waitforReply: (message: string) => Promise<import("@codebolt/types").UserMessage>;
processStarted: () => {
event: {
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
addListener<K_1>(eventName: string | symbol, listener: (...args: any[]) => void): any;
on<K_2>(eventName: string | symbol, listener: (...args: any[]) => void): any;
once<K_3>(eventName: string | symbol, listener: (...args: any[]) => void): any;
removeListener<K_4>(eventName: string | symbol, listener: (...args: any[]) => void): any;
off<K_5>(eventName: string | symbol, listener: (...args: any[]) => void): any;
removeAllListeners(eventName?: string | symbol | undefined): any;
setMaxListeners(n: number): any;
getMaxListeners(): number;
listeners<K_6>(eventName: string | symbol): Function[];
rawListeners<K_7>(eventName: string | symbol): Function[];
emit<K_8>(eventName: string | symbol, ...args: any[]): boolean;
listenerCount<K_9>(eventName: string | symbol, listener?: Function | undefined): number;
prependListener<K_10>(eventName: string | symbol, listener: (...args: any[]) => void): any;
prependOnceListener<K_11>(eventName: string | symbol, listener: (...args: any[]) => void): any;
eventNames(): (string | symbol)[];
};
stopProcess: () => void;
};
stopProcess: () => void;
processFinished: () => void;
sendConfirmationRequest: (confirmationMessage: string, buttons?: string[], withFeedback?: boolean) => Promise<string>;
askQuestion: (question: string, buttons?: string[], withFeedback?: boolean) => Promise<string>;
sendNotificationEvent: (notificationMessage: string, type: "debug" | "git" | "planner" | "browser" | "editor" | "terminal" | "preview") => void;
};
terminal: {
eventEmitter: {
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
addListener<K_1>(eventName: string | symbol, listener: (...args: any[]) => void): any;
on<K_2>(eventName: string | symbol, listener: (...args: any[]) => void): any;
once<K_3>(eventName: string | symbol, listener: (...args: any[]) => void): any;
removeListener<K_4>(eventName: string | symbol, listener: (...args: any[]) => void): any;
off<K_5>(eventName: string | symbol, listener: (...args: any[]) => void): any;
removeAllListeners(eventName?: string | symbol | undefined): any;
setMaxListeners(n: number): any;
getMaxListeners(): number;
listeners<K_6>(eventName: string | symbol): Function[];
rawListeners<K_7>(eventName: string | symbol): Function[];
emit<K_8>(eventName: string | symbol, ...args: any[]): boolean;
listenerCount<K_9>(eventName: string | symbol, listener?: Function | undefined): number;
prependListener<K_10>(eventName: string | symbol, listener: (...args: any[]) => void): any;
prependOnceListener<K_11>(eventName: string | symbol, listener: (...args: any[]) => void): any;
eventNames(): (string | symbol)[];
};
executeCommand: (command: string, returnEmptyStringOnSuccess?: boolean) => Promise<unknown>;
executeCommandRunUntilError: (command: string, executeInMain?: boolean) => Promise<import("@codebolt/types").CommandError>;
sendManualInterrupt(): Promise<import("@codebolt/types").TerminalInterruptResponse>;
executeCommandWithStream(command: string, executeInMain?: boolean): EventEmitter<[never]>;
};
codeutils: {
getJsTree: (filePath?: string | undefined) => Promise<unknown>;
getAllFilesAsMarkDown: () => Promise<string>;
performMatch: (matcherDefinition: object, problemPatterns: any[], problems: any[]) => Promise<import("@codebolt/types").MatchProblemResponse>;
getMatcherList: () => Promise<import("@codebolt/types").GetMatcherListTreeResponse>;
matchDetail: (matcher: string) => Promise<import("@codebolt/types").getMatchDetail>;
};
docutils: {
pdf_to_text: (pdf_path: any) => Promise<string>;
};
crawler: {
start: () => void;
screenshot: () => void;
goToPage: (url: string) => void;
scroll: (direction: string) => void;
click: (id: string) => Promise<unknown>;
type: (id: string, text: string) => Promise<unknown>;
enter: () => void;
crawl: (query: string) => Promise<unknown>;
};
search: {
init: (engine?: string) => void;
search: (query: string) => Promise<string>;
get_first_link: (query: string) => Promise<string>;
};
knowledge: {};
rag: {
init: () => void;
add_file: (filename: string, file_path: string) => void;
retrieve_related_knowledge: (query: string, filename: string) => void;
};
codeparsers: {
getClassesInFile: (file: any) => void;
getFunctionsinClass: (file: any, className: any) => void;
getAstTreeInFile: (file: any, className: any) => void;
};
outputparsers: {
init: (output: any) => void;
parseErrors: (output: any) => string[];
parseWarnings: (output: any) => string[];
};
project: {
getProjectSettings: (output: any) => void;
getProjectPath: () => Promise<import("@codebolt/types").GetProjectPathResponse>;
getRepoMap: (message: any) => Promise<import("@codebolt/types").GetProjectPathResponse>;
runProject: () => void;
getEditorFileStatus: () => Promise<unknown>;
};
dbmemory: {
addKnowledge: (key: string, value: any) => Promise<import("@codebolt/types").MemorySetResponse>;
getKnowledge: (key: string) => Promise<import("@codebolt/types").MemoryGetResponse>;
};
cbstate: {
getApplicationState: () => Promise<import("@codebolt/types").ApplicationState>;
addToAgentState: (key: string, value: string) => Promise<import("@codebolt/types").AddToAgentStateResponse>;
getAgentState: () => Promise<import("@codebolt/types").GetAgentStateResponse>;
getProjectState: () => Promise<any>;
updateProjectState: (key: string, value: any) => Promise<any>;
};
taskplaner: {
addTask: (task: string) => Promise<any>;
getTasks: () => Promise<any>;
updateTask: (task: string) => Promise<any>;
};
vectordb: {
getVector: (key: string) => Promise<import("@codebolt/types").GetVectorResponse>;
addVectorItem: (item: any) => Promise<import("@codebolt/types").AddVectorItemResponse>;
queryVectorItem: (key: string) => Promise<import("@codebolt/types").QueryVectorItemResponse>;
queryVectorItems: (items: [], dbPath: string) => Promise<import("@codebolt/types").QueryVectorItemResponse>;
};
debug: {
debug: (log: string, type: import("./modules/debug").logType) => Promise<import("@codebolt/types").DebugAddLogResponse>;
openDebugBrowser: (url: string, port: number) => Promise<import("@codebolt/types").OpenDebugBrowserResponse>;
};
tokenizer: {
addToken: (key: string) => Promise<import("@codebolt/types").AddTokenResponse>;
getToken: (key: string) => Promise<import("@codebolt/types").GetTokenResponse>;
};
chatSummary: {
summarizeAll: () => Promise<{
role: string;
content: string;
}[]>;
summarize: (messages: {
role: string;
content: string;
}[], depth: number) => Promise<{
role: string;
content: string;
}[]>;
};
tools: {
getEnabledToolBoxes: () => Promise<any>;
getLocalToolBoxes: () => Promise<any>;
getMentionedToolBoxes: (userMessage: import("./utils").UserMessage) => Promise<any>;
getAvailableToolBoxes: () => Promise<any>;
searchAvailableToolBoxes: (query: string) => Promise<any>;
listToolsFromToolBoxes: (toolBoxes: string[]) => Promise<any>;
configureToolBox: (name: string, config: any) => Promise<any>;
getTools: (tools: {
toolbox: string;
toolName: string;
}[]) => Promise<any[]>;
executeTool: (toolbox: string, toolName: string, params: any) => Promise<any>;
};
agent: {
findAgent: (task: string, maxResult: number | undefined, agents: never[] | undefined, agentLocaltion: import("./modules/agent").AgentLocation | undefined, getFrom: import("./modules/agent").FilterUsing.USE_VECTOR_DB) => Promise<any>;
startAgent: (agentId: string, task: string) => Promise<any>;
getAgentsList: (type?: import("./modules/agent").Agents) => Promise<any>;
getAgentsDetail: (agentList?: never[]) => Promise<any>;
};
}
declare const _default: Codebolt;
export default _default;