@codebolt/codeboltjs 1.1.70 → 1.1.72
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/package.json +3 -3
- package/src/index.ts +3 -1
- package/webpack.config.js +1 -1
- package/docs/modules/_internal_.EventEmitter.html +0 -6
- package/docs/modules/_internal_.WebSocket.html +0 -21
- package/docs/modules/_internal_._node_stream_consumers_.html +0 -6
- package/docs/modules/_internal_._node_stream_promises_.html +0 -3
- package/docs/modules/_internal_.html +0 -228
- package/docs/modules/_internal_.internal.finished.html +0 -2
- package/docs/modules/_internal_.internal.html +0 -36
- package/docs/modules/_internal_.internal.pipeline.html +0 -2
- package/index.d.ts +0 -238
- package/index.js +0 -90
- package/modules/browser.d.ts +0 -108
- package/modules/browser.js +0 -331
- package/modules/chat.d.ts +0 -63
- package/modules/chat.js +0 -174
- package/modules/codeparsers.d.ts +0 -23
- package/modules/codeparsers.js +0 -30
- package/modules/codeutils.d.ts +0 -37
- package/modules/codeutils.js +0 -166
- package/modules/crawler.d.ts +0 -45
- package/modules/crawler.js +0 -123
- package/modules/dbmemory.d.ts +0 -20
- package/modules/dbmemory.js +0 -54
- package/modules/debug.d.ts +0 -23
- package/modules/debug.js +0 -64
- package/modules/docutils.d.ts +0 -12
- package/modules/docutils.js +0 -19
- package/modules/fs.d.ts +0 -94
- package/modules/fs.js +0 -264
- package/modules/git.d.ts +0 -76
- package/modules/git.js +0 -240
- package/modules/history.d.ts +0 -19
- package/modules/history.js +0 -46
- package/modules/knowledge.d.ts +0 -2
- package/modules/knowledge.js +0 -6
- package/modules/llm.d.ts +0 -18
- package/modules/llm.js +0 -39
- package/modules/outputparsers.d.ts +0 -24
- package/modules/outputparsers.js +0 -32
- package/modules/project.d.ts +0 -21
- package/modules/project.js +0 -72
- package/modules/rag.d.ts +0 -22
- package/modules/rag.js +0 -30
- package/modules/search.d.ts +0 -23
- package/modules/search.js +0 -37
- package/modules/state.d.ts +0 -21
- package/modules/state.js +0 -68
- package/modules/task.d.ts +0 -23
- package/modules/task.js +0 -75
- package/modules/terminal.d.ts +0 -46
- package/modules/terminal.js +0 -108
- package/modules/tokenizer.d.ts +0 -19
- package/modules/tokenizer.js +0 -56
- package/modules/vectordb.d.ts +0 -33
- package/modules/vectordb.js +0 -103
- package/modules/websocket.d.ts +0 -27
- package/modules/websocket.js +0 -88
- package/src/modules/browser.ts +0 -352
- package/src/modules/chat.ts +0 -182
- package/src/modules/codeparsers.ts +0 -30
- package/src/modules/codeutils.ts +0 -181
- package/src/modules/crawler.ts +0 -121
- package/src/modules/dbmemory.ts +0 -52
- package/src/modules/debug.ts +0 -68
- package/src/modules/docutils.ts +0 -18
- package/src/modules/fs.ts +0 -263
- package/src/modules/git.ts +0 -237
- package/src/modules/history.ts +0 -61
- package/src/modules/knowledge.ts +0 -5
- package/src/modules/llm.ts +0 -36
- package/src/modules/outputparsers.ts +0 -30
- package/src/modules/project.ts +0 -68
- package/src/modules/rag.ts +0 -28
- package/src/modules/search.ts +0 -35
- package/src/modules/state.ts +0 -69
- package/src/modules/task.ts +0 -73
- package/src/modules/terminal.ts +0 -114
- package/src/modules/tokenizer.ts +0 -56
- package/src/modules/vectordb.ts +0 -102
- package/src/modules/websocket.ts +0 -89
package/index.d.ts
DELETED
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import WebSocket from 'ws';
|
|
3
|
-
import { EventEmitter } from 'events';
|
|
4
|
-
/**
|
|
5
|
-
* @class Codebolt
|
|
6
|
-
* @description This class provides a unified interface to interact with various modules.
|
|
7
|
-
*/
|
|
8
|
-
declare class Codebolt {
|
|
9
|
-
/**
|
|
10
|
-
* @constructor
|
|
11
|
-
* @description Initializes the websocket connection.
|
|
12
|
-
*/
|
|
13
|
-
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* @method waitForConnection
|
|
16
|
-
* @description Waits for the WebSocket connection to open.
|
|
17
|
-
* @returns {Promise<void>} A promise that resolves when the WebSocket connection is open.
|
|
18
|
-
*/
|
|
19
|
-
waitForConnection(): Promise<void>;
|
|
20
|
-
websocket: WebSocket | null;
|
|
21
|
-
fs: {
|
|
22
|
-
createFile: (fileName: string, source: string, filePath: string) => Promise<import("@codebolt/types").CreateFileResponse>;
|
|
23
|
-
createFolder: (folderName: string, folderPath: string) => Promise<import("@codebolt/types").CreateFolderResponse>;
|
|
24
|
-
readFile: (filePath: string) => Promise<import("@codebolt/types").ReadFileResponse>;
|
|
25
|
-
updateFile: (filename: string, filePath: string, newContent: string) => Promise<import("@codebolt/types").UpdateFileResponse>;
|
|
26
|
-
deleteFile: (filename: string, filePath: string) => Promise<import("@codebolt/types").DeleteFileResponse>;
|
|
27
|
-
deleteFolder: (foldername: string, folderpath: string) => Promise<import("@codebolt/types").DeleteFolderResponse>;
|
|
28
|
-
listFile: (folderPath: string, isRecursive?: boolean) => Promise<unknown>;
|
|
29
|
-
listCodeDefinitionNames: (path: string) => Promise<{
|
|
30
|
-
success: boolean;
|
|
31
|
-
result: any;
|
|
32
|
-
}>;
|
|
33
|
-
searchFiles: (path: string, regex: string, filePattern: string) => Promise<{
|
|
34
|
-
success: boolean;
|
|
35
|
-
result: any;
|
|
36
|
-
}>;
|
|
37
|
-
writeToFile: (relPath: string, newContent: string) => Promise<unknown>;
|
|
38
|
-
};
|
|
39
|
-
git: {
|
|
40
|
-
init: (path: string) => Promise<any>;
|
|
41
|
-
clone: (url: string, path: string) => Promise<any>;
|
|
42
|
-
pull: (path: string) => Promise<any>;
|
|
43
|
-
push: (path: string) => Promise<any>;
|
|
44
|
-
status: (path: string) => Promise<any>;
|
|
45
|
-
add: (path: string) => Promise<any>;
|
|
46
|
-
commit: (message: string) => Promise<any>;
|
|
47
|
-
checkout: (path: string, branch: string) => Promise<any>;
|
|
48
|
-
branch: (path: string, branch: string) => Promise<any>;
|
|
49
|
-
logs: (path: string) => Promise<any>;
|
|
50
|
-
diff: (commitHash: string, path: string) => Promise<any>;
|
|
51
|
-
};
|
|
52
|
-
llm: {
|
|
53
|
-
inference: (message: string, llmrole: string) => Promise<import("@codebolt/types").LLMResponse>;
|
|
54
|
-
};
|
|
55
|
-
browser: {
|
|
56
|
-
newPage: () => Promise<unknown>;
|
|
57
|
-
getUrl: () => Promise<import("@codebolt/types").UrlResponse>;
|
|
58
|
-
goToPage: (url: string) => Promise<import("@codebolt/types").GoToPageResponse>;
|
|
59
|
-
screenshot: () => Promise<unknown>;
|
|
60
|
-
getHTML: () => Promise<import("@codebolt/types").HtmlReceived>;
|
|
61
|
-
getMarkdown: () => Promise<import("@codebolt/types").GetMarkdownResponse>;
|
|
62
|
-
getPDF: () => void;
|
|
63
|
-
pdfToText: () => void;
|
|
64
|
-
getContent: () => Promise<import("@codebolt/types").GetContentResponse>;
|
|
65
|
-
getSnapShot: () => Promise<any>;
|
|
66
|
-
getBrowserInfo: () => Promise<any>;
|
|
67
|
-
extractText: () => Promise<import("@codebolt/types").ExtractTextResponse>;
|
|
68
|
-
close: () => void;
|
|
69
|
-
scroll: (direction: string, pixels: string) => Promise<unknown>;
|
|
70
|
-
type: (elementid: string, text: string) => Promise<unknown>;
|
|
71
|
-
click: (elementid: string) => Promise<unknown>;
|
|
72
|
-
enter: () => Promise<unknown>;
|
|
73
|
-
search: (elementid: string, query: string) => Promise<unknown>;
|
|
74
|
-
};
|
|
75
|
-
chat: {
|
|
76
|
-
getChatHistory: () => Promise<import("@codebolt/types").ChatMessage[]>;
|
|
77
|
-
onActionMessage: () => {
|
|
78
|
-
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
|
|
79
|
-
addListener<K_1>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
80
|
-
on<K_2>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
81
|
-
once<K_3>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
82
|
-
removeListener<K_4>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
83
|
-
off<K_5>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
84
|
-
removeAllListeners(eventName?: string | symbol | undefined): any;
|
|
85
|
-
setMaxListeners(n: number): any;
|
|
86
|
-
getMaxListeners(): number;
|
|
87
|
-
listeners<K_6>(eventName: string | symbol): Function[];
|
|
88
|
-
rawListeners<K_7>(eventName: string | symbol): Function[];
|
|
89
|
-
emit<K_8>(eventName: string | symbol, ...args: any[]): boolean;
|
|
90
|
-
listenerCount<K_9>(eventName: string | symbol, listener?: Function | undefined): number;
|
|
91
|
-
prependListener<K_10>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
92
|
-
prependOnceListener<K_11>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
93
|
-
eventNames(): (string | symbol)[];
|
|
94
|
-
} | undefined;
|
|
95
|
-
sendMessage: (message: string, payload: any) => void;
|
|
96
|
-
waitforReply: (message: string) => Promise<import("@codebolt/types").UserMessage>;
|
|
97
|
-
processStarted: () => {
|
|
98
|
-
event: {
|
|
99
|
-
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
|
|
100
|
-
addListener<K_1>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
101
|
-
on<K_2>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
102
|
-
once<K_3>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
103
|
-
removeListener<K_4>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
104
|
-
off<K_5>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
105
|
-
removeAllListeners(eventName?: string | symbol | undefined): any;
|
|
106
|
-
setMaxListeners(n: number): any;
|
|
107
|
-
getMaxListeners(): number;
|
|
108
|
-
listeners<K_6>(eventName: string | symbol): Function[];
|
|
109
|
-
rawListeners<K_7>(eventName: string | symbol): Function[];
|
|
110
|
-
emit<K_8>(eventName: string | symbol, ...args: any[]): boolean;
|
|
111
|
-
listenerCount<K_9>(eventName: string | symbol, listener?: Function | undefined): number;
|
|
112
|
-
prependListener<K_10>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
113
|
-
prependOnceListener<K_11>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
114
|
-
eventNames(): (string | symbol)[];
|
|
115
|
-
};
|
|
116
|
-
stopProcess: () => void;
|
|
117
|
-
};
|
|
118
|
-
stopProcess: () => void;
|
|
119
|
-
processFinished: () => void;
|
|
120
|
-
sendConfirmationRequest: (confirmationMessage: string, buttons?: string[], withFeedback?: boolean) => Promise<string>;
|
|
121
|
-
sendNotificationEvent: (notificationMessage: string, type: "debug" | "git" | "planner" | "browser" | "editor" | "terminal" | "preview") => void;
|
|
122
|
-
};
|
|
123
|
-
terminal: {
|
|
124
|
-
eventEmitter: {
|
|
125
|
-
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
|
|
126
|
-
addListener<K_1>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
127
|
-
on<K_2>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
128
|
-
once<K_3>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
129
|
-
removeListener<K_4>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
130
|
-
off<K_5>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
131
|
-
removeAllListeners(eventName?: string | symbol | undefined): any;
|
|
132
|
-
setMaxListeners(n: number): any;
|
|
133
|
-
getMaxListeners(): number;
|
|
134
|
-
listeners<K_6>(eventName: string | symbol): Function[];
|
|
135
|
-
rawListeners<K_7>(eventName: string | symbol): Function[];
|
|
136
|
-
emit<K_8>(eventName: string | symbol, ...args: any[]): boolean;
|
|
137
|
-
listenerCount<K_9>(eventName: string | symbol, listener?: Function | undefined): number;
|
|
138
|
-
prependListener<K_10>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
139
|
-
prependOnceListener<K_11>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
140
|
-
eventNames(): (string | symbol)[];
|
|
141
|
-
};
|
|
142
|
-
executeCommand: (command: string, returnEmptyStringOnSuccess?: boolean) => Promise<unknown>;
|
|
143
|
-
executeCommandRunUntilError: (command: string, executeInMain?: boolean) => Promise<import("@codebolt/types").CommandError>;
|
|
144
|
-
sendManualInterrupt(): Promise<import("@codebolt/types").TerminalInterruptResponse>;
|
|
145
|
-
executeCommandWithStream(command: string, executeInMain?: boolean): EventEmitter<[never]>;
|
|
146
|
-
};
|
|
147
|
-
codeutils: {
|
|
148
|
-
getJsTree: (filePath?: string | undefined) => void;
|
|
149
|
-
getAllFilesAsMarkDown: () => Promise<string>;
|
|
150
|
-
performMatch: (matcherDefinition: object, problemPatterns: any[], problems: any[]) => Promise<import("@codebolt/types").MatchProblemResponse>;
|
|
151
|
-
getMatcherList: () => Promise<import("@codebolt/types").GetMatcherListTreeResponse>;
|
|
152
|
-
matchDetail: (matcher: string) => Promise<import("@codebolt/types").getMatchDetail>;
|
|
153
|
-
};
|
|
154
|
-
docutils: {
|
|
155
|
-
pdf_to_text: (pdf_path: any) => Promise<string>;
|
|
156
|
-
};
|
|
157
|
-
crawler: {
|
|
158
|
-
start: () => void;
|
|
159
|
-
screenshot: () => void;
|
|
160
|
-
goToPage: (url: string) => void;
|
|
161
|
-
scroll: (direction: string) => void;
|
|
162
|
-
click: (id: string) => Promise<unknown>;
|
|
163
|
-
type: (id: string, text: string) => Promise<unknown>;
|
|
164
|
-
enter: () => void;
|
|
165
|
-
crawl: (query: string) => Promise<unknown>;
|
|
166
|
-
};
|
|
167
|
-
search: {
|
|
168
|
-
init: (engine?: string) => void;
|
|
169
|
-
search: (query: string) => Promise<string>;
|
|
170
|
-
get_first_link: (query: string) => Promise<string>;
|
|
171
|
-
};
|
|
172
|
-
knowledge: {};
|
|
173
|
-
rag: {
|
|
174
|
-
init: () => void;
|
|
175
|
-
add_file: (filename: string, file_path: string) => void;
|
|
176
|
-
retrieve_related_knowledge: (query: string, filename: string) => void;
|
|
177
|
-
};
|
|
178
|
-
codeparsers: {
|
|
179
|
-
getClassesInFile: (file: any) => void;
|
|
180
|
-
getFunctionsinClass: (file: any, className: any) => void;
|
|
181
|
-
getAstTreeInFile: (file: any, className: any) => void;
|
|
182
|
-
};
|
|
183
|
-
outputparsers: {
|
|
184
|
-
init: (output: any) => void;
|
|
185
|
-
parseErrors: (output: any) => string[];
|
|
186
|
-
parseWarnings: (output: any) => string[];
|
|
187
|
-
};
|
|
188
|
-
project: {
|
|
189
|
-
getProjectSettings: (output: any) => void;
|
|
190
|
-
getProjectPath: () => Promise<import("@codebolt/types").GetProjectPathResponse>;
|
|
191
|
-
getRepoMap: (message: any) => Promise<import("@codebolt/types").GetProjectPathResponse>;
|
|
192
|
-
runProject: () => void;
|
|
193
|
-
getEditorFileStatus: () => Promise<unknown>;
|
|
194
|
-
};
|
|
195
|
-
dbmemory: {
|
|
196
|
-
addKnowledge: (key: string, value: any) => Promise<import("@codebolt/types").MemorySetResponse>;
|
|
197
|
-
getKnowledge: (key: string) => Promise<import("@codebolt/types").MemoryGetResponse>;
|
|
198
|
-
};
|
|
199
|
-
cbstate: {
|
|
200
|
-
getApplicationState: () => Promise<import("@codebolt/types").ApplicationState>;
|
|
201
|
-
addToAgentState: (key: string, value: string) => Promise<import("@codebolt/types").AddToAgentStateResponse>;
|
|
202
|
-
getAgentState: () => Promise<import("@codebolt/types").GetAgentStateResponse>;
|
|
203
|
-
};
|
|
204
|
-
taskplaner: {
|
|
205
|
-
addTask: (task: string) => Promise<any>;
|
|
206
|
-
getTasks: () => Promise<any>;
|
|
207
|
-
updateTask: (task: string) => Promise<any>;
|
|
208
|
-
};
|
|
209
|
-
vectordb: {
|
|
210
|
-
getVector: (key: string) => Promise<import("@codebolt/types").GetVectorResponse>;
|
|
211
|
-
addVectorItem: (item: any) => Promise<import("@codebolt/types").AddVectorItemResponse>;
|
|
212
|
-
queryVectorItem: (key: string) => Promise<import("@codebolt/types").QueryVectorItemResponse>;
|
|
213
|
-
queryVectorItems: (items: [], dbPath: string) => Promise<import("@codebolt/types").QueryVectorItemResponse>;
|
|
214
|
-
};
|
|
215
|
-
debug: {
|
|
216
|
-
debug: (log: string, type: import("./modules/debug").logType) => Promise<import("@codebolt/types").DebugAddLogResponse>;
|
|
217
|
-
openDebugBrowser: (url: string, port: number) => Promise<import("@codebolt/types").OpenDebugBrowserResponse>;
|
|
218
|
-
};
|
|
219
|
-
tokenizer: {
|
|
220
|
-
addToken: (key: string) => Promise<import("@codebolt/types").AddTokenResponse>;
|
|
221
|
-
getToken: (key: string) => Promise<import("@codebolt/types").GetTokenResponse>;
|
|
222
|
-
};
|
|
223
|
-
chatSummary: {
|
|
224
|
-
summarizeAll: () => Promise<{
|
|
225
|
-
role: string;
|
|
226
|
-
content: string;
|
|
227
|
-
}[]>;
|
|
228
|
-
summarize: (messages: {
|
|
229
|
-
role: string;
|
|
230
|
-
content: string;
|
|
231
|
-
}[], depth: number) => Promise<{
|
|
232
|
-
role: string;
|
|
233
|
-
content: string;
|
|
234
|
-
}[]>;
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
declare const _default: Codebolt;
|
|
238
|
-
export default _default;
|
package/index.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const websocket_1 = __importDefault(require("./modules/websocket"));
|
|
7
|
-
const fs_1 = __importDefault(require("./modules/fs"));
|
|
8
|
-
const llm_1 = __importDefault(require("./modules/llm"));
|
|
9
|
-
const terminal_1 = __importDefault(require("./modules/terminal"));
|
|
10
|
-
const browser_1 = __importDefault(require("./modules/browser"));
|
|
11
|
-
const chat_1 = __importDefault(require("./modules/chat"));
|
|
12
|
-
const codeutils_1 = __importDefault(require("./modules/codeutils"));
|
|
13
|
-
const docutils_1 = __importDefault(require("./modules/docutils"));
|
|
14
|
-
const crawler_1 = __importDefault(require("./modules/crawler"));
|
|
15
|
-
const search_1 = __importDefault(require("./modules/search"));
|
|
16
|
-
const knowledge_1 = __importDefault(require("./modules/knowledge"));
|
|
17
|
-
const rag_1 = __importDefault(require("./modules/rag"));
|
|
18
|
-
const codeparsers_1 = __importDefault(require("./modules/codeparsers"));
|
|
19
|
-
const outputparsers_1 = __importDefault(require("./modules/outputparsers"));
|
|
20
|
-
const project_1 = __importDefault(require("./modules/project"));
|
|
21
|
-
const git_1 = __importDefault(require("./modules/git"));
|
|
22
|
-
const dbmemory_1 = __importDefault(require("./modules/dbmemory"));
|
|
23
|
-
const state_1 = __importDefault(require("./modules/state"));
|
|
24
|
-
const task_1 = __importDefault(require("./modules/task"));
|
|
25
|
-
const vectordb_1 = __importDefault(require("./modules/vectordb"));
|
|
26
|
-
const debug_1 = __importDefault(require("./modules/debug"));
|
|
27
|
-
const tokenizer_1 = __importDefault(require("./modules/tokenizer"));
|
|
28
|
-
const ws_1 = __importDefault(require("ws"));
|
|
29
|
-
const history_1 = require("./modules/history");
|
|
30
|
-
/**
|
|
31
|
-
* @class Codebolt
|
|
32
|
-
* @description This class provides a unified interface to interact with various modules.
|
|
33
|
-
*/
|
|
34
|
-
class Codebolt {
|
|
35
|
-
/**
|
|
36
|
-
* @constructor
|
|
37
|
-
* @description Initializes the websocket connection.
|
|
38
|
-
*/
|
|
39
|
-
constructor() {
|
|
40
|
-
this.websocket = null;
|
|
41
|
-
this.fs = fs_1.default;
|
|
42
|
-
this.git = git_1.default;
|
|
43
|
-
this.llm = llm_1.default;
|
|
44
|
-
this.browser = browser_1.default;
|
|
45
|
-
this.chat = chat_1.default;
|
|
46
|
-
this.terminal = terminal_1.default;
|
|
47
|
-
this.codeutils = codeutils_1.default;
|
|
48
|
-
this.docutils = docutils_1.default;
|
|
49
|
-
this.crawler = crawler_1.default;
|
|
50
|
-
this.search = search_1.default;
|
|
51
|
-
this.knowledge = knowledge_1.default;
|
|
52
|
-
this.rag = rag_1.default;
|
|
53
|
-
this.codeparsers = codeparsers_1.default;
|
|
54
|
-
this.outputparsers = outputparsers_1.default;
|
|
55
|
-
this.project = project_1.default;
|
|
56
|
-
this.dbmemory = dbmemory_1.default;
|
|
57
|
-
this.cbstate = state_1.default;
|
|
58
|
-
this.taskplaner = task_1.default;
|
|
59
|
-
this.vectordb = vectordb_1.default;
|
|
60
|
-
this.debug = debug_1.default;
|
|
61
|
-
this.tokenizer = tokenizer_1.default;
|
|
62
|
-
this.chatSummary = history_1.chatSummary;
|
|
63
|
-
this.websocket = websocket_1.default.getWebsocket;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* @method waitForConnection
|
|
67
|
-
* @description Waits for the WebSocket connection to open.
|
|
68
|
-
* @returns {Promise<void>} A promise that resolves when the WebSocket connection is open.
|
|
69
|
-
*/
|
|
70
|
-
async waitForConnection() {
|
|
71
|
-
return new Promise((resolve, reject) => {
|
|
72
|
-
if (!this.websocket) {
|
|
73
|
-
reject(new Error('WebSocket is not initialized'));
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
if (this.websocket.readyState === ws_1.default.OPEN) {
|
|
77
|
-
resolve();
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
this.websocket.addEventListener('open', () => {
|
|
81
|
-
resolve();
|
|
82
|
-
});
|
|
83
|
-
this.websocket.addEventListener('error', (error) => {
|
|
84
|
-
reject(error);
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
exports.default = new Codebolt();
|
|
90
|
-
// module.exports = new Codebolt();
|
package/modules/browser.d.ts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { GoToPageResponse, UrlResponse, GetMarkdownResponse, HtmlReceived, ExtractTextResponse, GetContentResponse } from '@codebolt/types';
|
|
2
|
-
/**
|
|
3
|
-
* A module for interacting with a browser through WebSockets.
|
|
4
|
-
*/
|
|
5
|
-
declare const cbbrowser: {
|
|
6
|
-
/**
|
|
7
|
-
* Opens a new page in the browser.
|
|
8
|
-
*/
|
|
9
|
-
newPage: () => Promise<unknown>;
|
|
10
|
-
/**
|
|
11
|
-
* Retrieves the current URL of the browser's active page.
|
|
12
|
-
* @returns {Promise<UrlResponse>} A promise that resolves with the URL.
|
|
13
|
-
*/
|
|
14
|
-
getUrl: () => Promise<UrlResponse>;
|
|
15
|
-
/**
|
|
16
|
-
* Navigates to a specified URL.
|
|
17
|
-
* @param {string} url - The URL to navigate to.
|
|
18
|
-
* @returns {Promise<GoToPageResponse>} A promise that resolves when navigation is complete.
|
|
19
|
-
*/
|
|
20
|
-
goToPage: (url: string) => Promise<GoToPageResponse>;
|
|
21
|
-
/**
|
|
22
|
-
* Takes a screenshot of the current page.
|
|
23
|
-
*/
|
|
24
|
-
screenshot: () => Promise<unknown>;
|
|
25
|
-
/**
|
|
26
|
-
* Retrieves the HTML content of the current page.
|
|
27
|
-
* @returns {Promise<HtmlReceived>} A promise that resolves with the HTML content.
|
|
28
|
-
*/
|
|
29
|
-
getHTML: () => Promise<HtmlReceived>;
|
|
30
|
-
/**
|
|
31
|
-
* Retrieves the Markdown content of the current page.
|
|
32
|
-
* @returns {Promise<GetMarkdownResponse>} A promise that resolves with the Markdown content.
|
|
33
|
-
*/
|
|
34
|
-
getMarkdown: () => Promise<GetMarkdownResponse>;
|
|
35
|
-
/**
|
|
36
|
-
* Retrieves the PDF content of the current page.
|
|
37
|
-
*
|
|
38
|
-
*/
|
|
39
|
-
getPDF: () => void;
|
|
40
|
-
/**
|
|
41
|
-
* Converts the PDF content of the current page to text.
|
|
42
|
-
*/
|
|
43
|
-
pdfToText: () => void;
|
|
44
|
-
/**
|
|
45
|
-
* Retrieves the content of the current page.
|
|
46
|
-
* @returns {Promise<GetContentResponse>} A promise that resolves with the content.
|
|
47
|
-
*/
|
|
48
|
-
getContent: () => Promise<GetContentResponse>;
|
|
49
|
-
/**
|
|
50
|
-
* Retrieves the snapshot of the current page.
|
|
51
|
-
* @returns {Promise<GetContentResponse>} A promise that resolves with the content.
|
|
52
|
-
*/
|
|
53
|
-
getSnapShot: () => Promise<any>;
|
|
54
|
-
/**
|
|
55
|
-
* Retrieves browser info like height width scrollx scrolly of the current page.
|
|
56
|
-
* @returns {Promise<GetContentResponse>} A promise that resolves with the content.
|
|
57
|
-
*/
|
|
58
|
-
getBrowserInfo: () => Promise<any>;
|
|
59
|
-
/**
|
|
60
|
-
* Extracts text from the current page.
|
|
61
|
-
* @returns {Promise<ExtractTextResponse>} A promise that resolves with the extracted text.
|
|
62
|
-
*
|
|
63
|
-
*/
|
|
64
|
-
extractText: () => Promise<ExtractTextResponse>;
|
|
65
|
-
/**
|
|
66
|
-
* Closes the current page.
|
|
67
|
-
*/
|
|
68
|
-
close: () => void;
|
|
69
|
-
/**
|
|
70
|
-
* Scrolls the current page in a specified direction by a specified number of pixels.
|
|
71
|
-
* @param {string} direction - The direction to scroll.
|
|
72
|
-
* @param {string} pixels - The number of pixels to scroll.
|
|
73
|
-
* @returns {Promise<any>} A promise that resolves when the scroll action is complete.
|
|
74
|
-
*/
|
|
75
|
-
scroll: (direction: string, pixels: string) => Promise<unknown>;
|
|
76
|
-
/**
|
|
77
|
-
* Types text into a specified element on the page.
|
|
78
|
-
* @param {string} elementid - The ID of the element to type into.
|
|
79
|
-
* @param {string} text - The text to type.
|
|
80
|
-
* @returns {Promise<any>} A promise that resolves when the typing action is complete.
|
|
81
|
-
*/
|
|
82
|
-
type: (elementid: string, text: string) => Promise<unknown>;
|
|
83
|
-
/**
|
|
84
|
-
* Clicks on a specified element on the page.
|
|
85
|
-
* @param {string} elementid - The ID of the element to click.
|
|
86
|
-
* @returns {Promise<any>} A promise that resolves when the click action is complete.
|
|
87
|
-
*/
|
|
88
|
-
click: (elementid: string) => Promise<unknown>;
|
|
89
|
-
/**
|
|
90
|
-
* Simulates the Enter key press on the current page.
|
|
91
|
-
* @returns {Promise<any>} A promise that resolves when the Enter action is complete.
|
|
92
|
-
*/
|
|
93
|
-
enter: () => Promise<unknown>;
|
|
94
|
-
/**
|
|
95
|
-
* Performs a search on the current page using a specified query.
|
|
96
|
-
* @param {string} elementid - The ID of the element to perform the search in.
|
|
97
|
-
* @param {string} query - The search query.
|
|
98
|
-
* @returns {Promise<any>} A promise that resolves with the search results.
|
|
99
|
-
*/
|
|
100
|
-
search: (elementid: string, query: string) => Promise<unknown>;
|
|
101
|
-
};
|
|
102
|
-
export default cbbrowser;
|
|
103
|
-
/***
|
|
104
|
-
|
|
105
|
-
start_browser(objective: string, url: string, previous_command: string, browser_content: string) {
|
|
106
|
-
cbbrowser.newPage();
|
|
107
|
-
}
|
|
108
|
-
*/
|