@codebolt/codeboltjs 1.1.9 → 1.1.12
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/index.d.ts +1 -164
- package/index.js +2 -1
- package/modules/chat.d.ts +1 -0
- package/modules/chat.js +13 -0
- package/package.json +1 -2
- package/src/index.ts +3 -1
- package/src/modules/chat.ts +16 -0
package/index.d.ts
CHANGED
|
@@ -1,164 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import WebSocket from 'ws';
|
|
3
|
-
/**
|
|
4
|
-
* @class Codebolt
|
|
5
|
-
* @description This class provides a unified interface to interact with various modules.
|
|
6
|
-
*/
|
|
7
|
-
declare class Codebolt {
|
|
8
|
-
/**
|
|
9
|
-
* @constructor
|
|
10
|
-
* @description Initializes the websocket connection.
|
|
11
|
-
*/
|
|
12
|
-
constructor();
|
|
13
|
-
/**
|
|
14
|
-
* @method waitForConnection
|
|
15
|
-
* @description Waits for the WebSocket connection to open.
|
|
16
|
-
* @returns {Promise<void>} A promise that resolves when the WebSocket connection is open.
|
|
17
|
-
*/
|
|
18
|
-
waitForConnection(): Promise<void>;
|
|
19
|
-
/**
|
|
20
|
-
* @method start_browser
|
|
21
|
-
* @description Starts a new browser page.
|
|
22
|
-
* @param {string} objective - The objective of the browser session.
|
|
23
|
-
* @param {string} url - The URL to navigate to.
|
|
24
|
-
* @param {string} previous_command - The previous command executed.
|
|
25
|
-
* @param {string} browser_content - The content of the browser.
|
|
26
|
-
*/
|
|
27
|
-
start_browser(objective: string, url: string, previous_command: string, browser_content: string): void;
|
|
28
|
-
websocket: WebSocket | null;
|
|
29
|
-
fs: {
|
|
30
|
-
createFile: (fileName: string, source: string, filePath: string) => Promise<any>;
|
|
31
|
-
createFolder: (folderName: string, folderPath: string) => Promise<any>;
|
|
32
|
-
readFile: (filename: string, filePath: string) => Promise<any>;
|
|
33
|
-
updateFile: (filename: string, filePath: string, newContent: string) => Promise<any>;
|
|
34
|
-
deleteFile: (filename: string, filePath: string) => Promise<any>;
|
|
35
|
-
deleteFolder: (foldername: string, folderpath: string) => Promise<any>;
|
|
36
|
-
};
|
|
37
|
-
git: {
|
|
38
|
-
init: (path: string) => Promise<any>;
|
|
39
|
-
clone: (url: string, path: string) => Promise<any>;
|
|
40
|
-
pull: (path: string) => Promise<any>;
|
|
41
|
-
push: (path: string) => Promise<any>;
|
|
42
|
-
status: (path: string) => Promise<any>;
|
|
43
|
-
add: (path: string) => Promise<any>;
|
|
44
|
-
commit: (message: string) => Promise<any>;
|
|
45
|
-
checkout: (path: string, branch: string) => Promise<any>;
|
|
46
|
-
branch: (path: string, branch: string) => Promise<any>;
|
|
47
|
-
logs: (path: string) => Promise<any>;
|
|
48
|
-
diff: (commitHash: string, path: string) => Promise<any>;
|
|
49
|
-
};
|
|
50
|
-
llm: {
|
|
51
|
-
inference: (message: string, llmrole: string) => Promise<any>;
|
|
52
|
-
};
|
|
53
|
-
browser: {
|
|
54
|
-
newPage: () => void;
|
|
55
|
-
getUrl: () => Promise<unknown>;
|
|
56
|
-
goToPage: (url: string) => Promise<unknown>;
|
|
57
|
-
screenshot: () => void;
|
|
58
|
-
getHTML: () => Promise<unknown>;
|
|
59
|
-
getMarkdown: () => Promise<unknown>;
|
|
60
|
-
getPDF: () => void;
|
|
61
|
-
pdfToText: () => void;
|
|
62
|
-
getContent: () => void;
|
|
63
|
-
extractText: () => void;
|
|
64
|
-
close: () => void;
|
|
65
|
-
scroll: (direction: string, pixels: string) => Promise<unknown>;
|
|
66
|
-
type: (elementid: string, text: string) => Promise<unknown>;
|
|
67
|
-
click: (elementid: string) => Promise<unknown>;
|
|
68
|
-
enter: () => Promise<unknown>;
|
|
69
|
-
search: (elementid: string, query: string) => Promise<unknown>;
|
|
70
|
-
};
|
|
71
|
-
chat: {
|
|
72
|
-
eventEmitter: {
|
|
73
|
-
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
|
|
74
|
-
addListener<K_1>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
75
|
-
on<K_2>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
76
|
-
once<K_3>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
77
|
-
removeListener<K_4>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
78
|
-
off<K_5>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
79
|
-
removeAllListeners(eventName?: string | symbol | undefined): any;
|
|
80
|
-
setMaxListeners(n: number): any;
|
|
81
|
-
getMaxListeners(): number;
|
|
82
|
-
listeners<K_6>(eventName: string | symbol): Function[];
|
|
83
|
-
rawListeners<K_7>(eventName: string | symbol): Function[];
|
|
84
|
-
emit<K_8>(eventName: string | symbol, ...args: any[]): boolean;
|
|
85
|
-
listenerCount<K_9>(eventName: string | symbol, listener?: Function | undefined): number;
|
|
86
|
-
prependListener<K_10>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
87
|
-
prependOnceListener<K_11>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
88
|
-
eventNames(): (string | symbol)[];
|
|
89
|
-
};
|
|
90
|
-
sendMessage(message: string): void;
|
|
91
|
-
waitforReply(message: string): Promise<any>;
|
|
92
|
-
processStarted(): {
|
|
93
|
-
event: {
|
|
94
|
-
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
|
|
95
|
-
addListener<K_1>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
96
|
-
on<K_2>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
97
|
-
once<K_3>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
98
|
-
removeListener<K_4>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
99
|
-
off<K_5>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
100
|
-
removeAllListeners(eventName?: string | symbol | undefined): any;
|
|
101
|
-
setMaxListeners(n: number): any;
|
|
102
|
-
getMaxListeners(): number;
|
|
103
|
-
listeners<K_6>(eventName: string | symbol): Function[];
|
|
104
|
-
rawListeners<K_7>(eventName: string | symbol): Function[];
|
|
105
|
-
emit<K_8>(eventName: string | symbol, ...args: any[]): boolean;
|
|
106
|
-
listenerCount<K_9>(eventName: string | symbol, listener?: Function | undefined): number;
|
|
107
|
-
prependListener<K_10>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
108
|
-
prependOnceListener<K_11>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
109
|
-
eventNames(): (string | symbol)[];
|
|
110
|
-
};
|
|
111
|
-
stopProcess: () => void;
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
terminal: {
|
|
115
|
-
executeCommand: (command: string) => Promise<any>;
|
|
116
|
-
};
|
|
117
|
-
codeutils: {
|
|
118
|
-
getCodeTree: (fileName: any, source: any, filePath: any) => Promise<any>;
|
|
119
|
-
};
|
|
120
|
-
docutils: {
|
|
121
|
-
pdf_to_text: (pdf_path: any) => Promise<string>;
|
|
122
|
-
};
|
|
123
|
-
crawler: {
|
|
124
|
-
start: () => void;
|
|
125
|
-
screenshot: () => void;
|
|
126
|
-
goToPage: (url: string) => void;
|
|
127
|
-
scroll: (direction: string) => void;
|
|
128
|
-
click: (id: string) => Promise<unknown>;
|
|
129
|
-
type: (id: string, text: string) => Promise<unknown>;
|
|
130
|
-
enter: () => void;
|
|
131
|
-
crawl: () => void;
|
|
132
|
-
};
|
|
133
|
-
search: {
|
|
134
|
-
init: (engine?: string) => void;
|
|
135
|
-
search: (query: string) => Promise<string>;
|
|
136
|
-
get_first_link: (query: string) => Promise<string>;
|
|
137
|
-
};
|
|
138
|
-
knowledge: {};
|
|
139
|
-
rag: {
|
|
140
|
-
init: () => void;
|
|
141
|
-
add_file: (filename: string, file_path: string) => void;
|
|
142
|
-
retrieve_related_knowledge: (query: string, filename: string) => void;
|
|
143
|
-
};
|
|
144
|
-
codeparsers: {
|
|
145
|
-
getClassesInFile: (file: any) => void;
|
|
146
|
-
getFunctionsinClass: (file: any, className: any) => void;
|
|
147
|
-
getAstTreeInFile: (file: any, className: any) => void;
|
|
148
|
-
};
|
|
149
|
-
outputparsers: {
|
|
150
|
-
init: (output: any) => void;
|
|
151
|
-
parseErrors: (output: any) => string[];
|
|
152
|
-
parseWarnings: (output: any) => string[];
|
|
153
|
-
};
|
|
154
|
-
project: {
|
|
155
|
-
getProjectSettings: (output: any) => void;
|
|
156
|
-
getProjectPath: () => Promise<any>;
|
|
157
|
-
};
|
|
158
|
-
dbmemory: {
|
|
159
|
-
addKnowledge: (key: string, value: any) => Promise<any>;
|
|
160
|
-
getKnowledge: (key: string) => Promise<any>;
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
declare const _default: Codebolt;
|
|
164
|
-
export default _default;
|
|
1
|
+
export {};
|
package/index.js
CHANGED
package/modules/chat.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ declare class CustomEventEmitter extends EventEmitter {
|
|
|
10
10
|
*/
|
|
11
11
|
declare const cbchat: {
|
|
12
12
|
eventEmitter: CustomEventEmitter;
|
|
13
|
+
getChatHistory(): Promise<unknown>;
|
|
13
14
|
/**
|
|
14
15
|
* Sends a message through the WebSocket connection.
|
|
15
16
|
* @param {string} message - The message to be sent.
|
package/modules/chat.js
CHANGED
|
@@ -16,6 +16,19 @@ class CustomEventEmitter extends events_1.EventEmitter {
|
|
|
16
16
|
*/
|
|
17
17
|
const cbchat = {
|
|
18
18
|
eventEmitter: new CustomEventEmitter(),
|
|
19
|
+
getChatHistory() {
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
22
|
+
"type": "getChatHistory"
|
|
23
|
+
}));
|
|
24
|
+
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
25
|
+
const response = JSON.parse(data);
|
|
26
|
+
if (response.type === "getChatHistoryResponse") {
|
|
27
|
+
resolve(response); // Resolve the Promise with the response data
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
},
|
|
19
32
|
/**
|
|
20
33
|
* Sends a message through the WebSocket connection.
|
|
21
34
|
* @param {string} message - The message to be sent.
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codebolt/codeboltjs",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "",
|
|
7
7
|
"main": "index.js",
|
|
8
|
-
"license": "ISC",
|
|
9
8
|
"scripts": {
|
|
10
9
|
"build": "tsc",
|
|
11
10
|
"build:docs": "typedoc --plugin typedoc-plugin-missing-exports",
|
package/src/index.ts
CHANGED
package/src/modules/chat.ts
CHANGED
|
@@ -13,6 +13,22 @@ class CustomEventEmitter extends EventEmitter {}
|
|
|
13
13
|
const cbchat = {
|
|
14
14
|
eventEmitter: new CustomEventEmitter(),
|
|
15
15
|
|
|
16
|
+
getChatHistory() {
|
|
17
|
+
return new Promise((resolve, reject) => {
|
|
18
|
+
cbws.getWebsocket.send(JSON.stringify({
|
|
19
|
+
"type": "getChatHistory"
|
|
20
|
+
}));
|
|
21
|
+
cbws.getWebsocket.on('message', (data: string) => {
|
|
22
|
+
const response = JSON.parse(data);
|
|
23
|
+
if (response.type === "getChatHistoryResponse") {
|
|
24
|
+
resolve(response); // Resolve the Promise with the response data
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
},
|
|
31
|
+
|
|
16
32
|
/**
|
|
17
33
|
* Sends a message through the WebSocket connection.
|
|
18
34
|
* @param {string} message - The message to be sent.
|