@codebolt/codeboltjs 1.1.33 → 1.1.34
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 -1
- package/modules/browser.d.ts +1 -1
- package/modules/browser.js +12 -4
- package/package.json +1 -1
- package/src/modules/browser.ts +13 -4
package/index.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ declare class Codebolt {
|
|
|
44
44
|
inference: (message: string, llmrole: string) => Promise<import("@codebolt/types").LLMResponse>;
|
|
45
45
|
};
|
|
46
46
|
browser: {
|
|
47
|
-
newPage: () =>
|
|
47
|
+
newPage: () => Promise<unknown>;
|
|
48
48
|
getUrl: () => Promise<import("@codebolt/types").UrlResponse>;
|
|
49
49
|
goToPage: (url: string) => Promise<import("@codebolt/types").GoToPageResponse>;
|
|
50
50
|
screenshot: () => void;
|
package/modules/browser.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ declare const cbbrowser: {
|
|
|
6
6
|
/**
|
|
7
7
|
* Opens a new page in the browser.
|
|
8
8
|
*/
|
|
9
|
-
newPage: () =>
|
|
9
|
+
newPage: () => Promise<unknown>;
|
|
10
10
|
/**
|
|
11
11
|
* Retrieves the current URL of the browser's active page.
|
|
12
12
|
* @returns {Promise<UrlResponse>} A promise that resolves with the URL.
|
package/modules/browser.js
CHANGED
|
@@ -12,10 +12,18 @@ const cbbrowser = {
|
|
|
12
12
|
* Opens a new page in the browser.
|
|
13
13
|
*/
|
|
14
14
|
newPage: () => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
return new Promise((resolve, reject) => {
|
|
16
|
+
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
17
|
+
"type": "browserEvent",
|
|
18
|
+
action: 'newPage'
|
|
19
|
+
}));
|
|
20
|
+
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
21
|
+
const response = JSON.parse(data);
|
|
22
|
+
if (response.event === "newPageResponse") {
|
|
23
|
+
resolve(response);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
19
27
|
},
|
|
20
28
|
/**
|
|
21
29
|
* Retrieves the current URL of the browser's active page.
|
package/package.json
CHANGED
package/src/modules/browser.ts
CHANGED
|
@@ -9,10 +9,19 @@ const cbbrowser = {
|
|
|
9
9
|
* Opens a new page in the browser.
|
|
10
10
|
*/
|
|
11
11
|
newPage: () => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
14
|
+
cbws.getWebsocket.send(JSON.stringify({
|
|
15
|
+
"type": "browserEvent",
|
|
16
|
+
action: 'newPage'
|
|
17
|
+
}));
|
|
18
|
+
cbws.getWebsocket.on('message', (data: string) => {
|
|
19
|
+
const response = JSON.parse(data);
|
|
20
|
+
if (response.event === "newPageResponse") {
|
|
21
|
+
resolve(response);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
});
|
|
16
25
|
},
|
|
17
26
|
|
|
18
27
|
/**
|