@codebolt/codeboltjs 2.0.7 → 2.0.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/dist/agentlib/agent.js +12 -4
- package/dist/agentlib/promptbuilder.d.ts +228 -0
- package/dist/agentlib/promptbuilder.js +487 -0
- package/dist/agentlib/taskInstruction.d.ts +3 -25
- package/dist/agentlib/usermessage.d.ts +13 -43
- package/dist/agentlib/usermessage.js +8 -8
- package/dist/core/messageManager.d.ts +4 -6
- package/dist/core/messageManager.js +24 -17
- package/dist/core/websocket.d.ts +10 -0
- package/dist/core/websocket.js +92 -8
- package/dist/index.d.ts +97 -95
- package/dist/index.js +63 -57
- package/dist/modules/agent.d.ts +9 -8
- package/dist/modules/agent.js +4 -4
- package/dist/modules/browser.d.ts +17 -17
- package/dist/modules/browser.js +7 -7
- package/dist/modules/chat.d.ts +1 -1
- package/dist/modules/codeparsers.d.ts +1 -16
- package/dist/modules/codeutils.d.ts +3 -18
- package/dist/modules/dbmemory.d.ts +1 -1
- package/dist/modules/debug.d.ts +1 -1
- package/dist/modules/fs.d.ts +1 -1
- package/dist/modules/git.d.ts +21 -20
- package/dist/modules/git.js +10 -10
- package/dist/modules/history.d.ts +6 -8
- package/dist/modules/history.js +4 -1
- package/dist/modules/llm.d.ts +13 -5
- package/dist/modules/llm.js +29 -4
- package/dist/modules/{tools.d.ts → mcp.d.ts} +9 -8
- package/dist/modules/{tools.js → mcp.js} +6 -6
- package/dist/modules/project.d.ts +1 -1
- package/dist/modules/state.d.ts +2 -1
- package/dist/modules/task.js +0 -1
- package/dist/modules/terminal.d.ts +1 -1
- package/dist/modules/tokenizer.d.ts +1 -1
- package/dist/modules/utils.d.ts +11 -1
- package/dist/modules/utils.js +9 -0
- package/dist/modules/vectordb.d.ts +1 -1
- package/dist/types/InternalTypes.d.ts +501 -0
- package/dist/types/InternalTypes.js +30 -0
- package/dist/types/commonTypes.d.ts +346 -0
- package/dist/types/commonTypes.js +37 -0
- package/dist/types/libFunctionTypes.d.ts +589 -0
- package/dist/types/libFunctionTypes.js +11 -0
- package/dist/types/socketMessageTypes.d.ts +951 -0
- package/dist/types/socketMessageTypes.js +51 -0
- package/dist/utils/{toolBox.d.ts → mcpServer.d.ts} +1 -1
- package/dist/utils/{toolBox.js → mcpServer.js} +36 -36
- package/dist/utils/parse-source-code/languageParser.d.ts +1 -7
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +3 -3
- package/package.json +7 -2
package/dist/index.js
CHANGED
|
@@ -24,9 +24,8 @@ const task_1 = __importDefault(require("./modules/task"));
|
|
|
24
24
|
const vectordb_1 = __importDefault(require("./modules/vectordb"));
|
|
25
25
|
const debug_1 = __importDefault(require("./modules/debug"));
|
|
26
26
|
const tokenizer_1 = __importDefault(require("./modules/tokenizer"));
|
|
27
|
-
const ws_1 = __importDefault(require("ws"));
|
|
28
27
|
const history_1 = require("./modules/history");
|
|
29
|
-
const
|
|
28
|
+
const mcp_1 = __importDefault(require("./modules/mcp"));
|
|
30
29
|
const agent_1 = __importDefault(require("./modules/agent"));
|
|
31
30
|
const utils_1 = __importDefault(require("./modules/utils"));
|
|
32
31
|
/**
|
|
@@ -40,6 +39,7 @@ class Codebolt {
|
|
|
40
39
|
*/
|
|
41
40
|
constructor() {
|
|
42
41
|
this.websocket = null;
|
|
42
|
+
this.isReady = false;
|
|
43
43
|
this.fs = fs_1.default;
|
|
44
44
|
this.git = git_1.default;
|
|
45
45
|
this.llm = llm_1.default;
|
|
@@ -61,35 +61,44 @@ class Codebolt {
|
|
|
61
61
|
this.debug = debug_1.default;
|
|
62
62
|
this.tokenizer = tokenizer_1.default;
|
|
63
63
|
this.chatSummary = history_1.chatSummary;
|
|
64
|
-
this.
|
|
64
|
+
this.mcp = mcp_1.default;
|
|
65
65
|
this.agent = agent_1.default;
|
|
66
66
|
this.utils = utils_1.default;
|
|
67
67
|
console.log("Codebolt Agent initialized");
|
|
68
|
-
|
|
69
|
-
this.websocket = websocket_1.default.getWebsocket;
|
|
68
|
+
this.readyPromise = this.initializeConnection();
|
|
70
69
|
}
|
|
71
70
|
/**
|
|
72
|
-
* @method
|
|
73
|
-
* @description
|
|
74
|
-
* @
|
|
71
|
+
* @method initializeConnection
|
|
72
|
+
* @description Initializes the WebSocket connection asynchronously.
|
|
73
|
+
* @private
|
|
75
74
|
*/
|
|
76
|
-
async
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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;
|
|
93
102
|
}
|
|
94
103
|
/**
|
|
95
104
|
* Sets up a listener for incoming messages with a direct handler function.
|
|
@@ -97,40 +106,37 @@ class Codebolt {
|
|
|
97
106
|
* @returns {void}
|
|
98
107
|
*/
|
|
99
108
|
onMessage(handler) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
websocket_1.default.messageManager.send(message);
|
|
116
|
-
}
|
|
117
|
-
catch (error) {
|
|
118
|
-
console.error('Error in user message handler:', error);
|
|
119
|
-
// Send processStoped even if there's an error
|
|
120
|
-
websocket_1.default.messageManager.send({
|
|
121
|
-
"type": "processStoped",
|
|
122
|
-
"error": error instanceof Error ? error.message : "Unknown error occurred"
|
|
123
|
-
});
|
|
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;
|
|
124
123
|
}
|
|
124
|
+
websocket_1.default.messageManager.send(message);
|
|
125
125
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
+
});
|
|
134
140
|
}
|
|
135
141
|
}
|
|
136
142
|
const codebolt = new Codebolt();
|
package/dist/modules/agent.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FindAgentByTaskResponse, ListAgentsResponse, AgentsDetailResponse, TaskCompletionResponse } from '../types/socketMessageTypes';
|
|
1
2
|
export declare enum AgentLocation {
|
|
2
3
|
ALL = "all",
|
|
3
4
|
LOCAL_ONLY = "local_only",
|
|
@@ -17,24 +18,24 @@ declare const codeboltAgent: {
|
|
|
17
18
|
/**
|
|
18
19
|
* Retrieves an agent based on the specified task.
|
|
19
20
|
* @param {string} task - The task for which an agent is needed.
|
|
20
|
-
* @returns {Promise<
|
|
21
|
+
* @returns {Promise<FindAgentByTaskResponse>} A promise that resolves with the agent details.
|
|
21
22
|
*/
|
|
22
|
-
findAgent: (task: string, maxResult: number | undefined, agents: never[] | undefined, agentLocaltion: AgentLocation | undefined, getFrom: FilterUsing.USE_VECTOR_DB) => Promise<
|
|
23
|
+
findAgent: (task: string, maxResult: number | undefined, agents: never[] | undefined, agentLocaltion: AgentLocation | undefined, getFrom: FilterUsing.USE_VECTOR_DB) => Promise<FindAgentByTaskResponse>;
|
|
23
24
|
/**
|
|
24
25
|
* Starts an agent for the specified task.
|
|
25
26
|
* @param {string} task - The task for which the agent should be started.
|
|
26
|
-
* @returns {Promise<
|
|
27
|
+
* @returns {Promise<TaskCompletionResponse>} A promise that resolves when the agent has been successfully started.
|
|
27
28
|
*/
|
|
28
|
-
startAgent: (agentId: string, task: string) => Promise<
|
|
29
|
+
startAgent: (agentId: string, task: string) => Promise<TaskCompletionResponse>;
|
|
29
30
|
/**
|
|
30
31
|
* Lists all available agents.
|
|
31
|
-
* @returns {Promise<
|
|
32
|
+
* @returns {Promise<ListAgentsResponse>} A promise that resolves with the list of agents.
|
|
32
33
|
*/
|
|
33
|
-
getAgentsList: (type?: Agents) => Promise<
|
|
34
|
+
getAgentsList: (type?: Agents) => Promise<ListAgentsResponse>;
|
|
34
35
|
/**
|
|
35
36
|
* Lists all available agents.
|
|
36
|
-
* @returns {Promise<
|
|
37
|
+
* @returns {Promise<AgentsDetailResponse>} A promise that resolves with the list of agents.
|
|
37
38
|
*/
|
|
38
|
-
getAgentsDetail: (agentList?: never[]) => Promise<
|
|
39
|
+
getAgentsDetail: (agentList?: never[]) => Promise<AgentsDetailResponse>;
|
|
39
40
|
};
|
|
40
41
|
export default codeboltAgent;
|
package/dist/modules/agent.js
CHANGED
|
@@ -27,7 +27,7 @@ const codeboltAgent = {
|
|
|
27
27
|
/**
|
|
28
28
|
* Retrieves an agent based on the specified task.
|
|
29
29
|
* @param {string} task - The task for which an agent is needed.
|
|
30
|
-
* @returns {Promise<
|
|
30
|
+
* @returns {Promise<FindAgentByTaskResponse>} A promise that resolves with the agent details.
|
|
31
31
|
*/
|
|
32
32
|
findAgent: (task, maxResult = 1, agents = [], agentLocaltion = AgentLocation.ALL, getFrom) => {
|
|
33
33
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
@@ -43,7 +43,7 @@ const codeboltAgent = {
|
|
|
43
43
|
/**
|
|
44
44
|
* Starts an agent for the specified task.
|
|
45
45
|
* @param {string} task - The task for which the agent should be started.
|
|
46
|
-
* @returns {Promise<
|
|
46
|
+
* @returns {Promise<TaskCompletionResponse>} A promise that resolves when the agent has been successfully started.
|
|
47
47
|
*/
|
|
48
48
|
startAgent: (agentId, task) => {
|
|
49
49
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
@@ -55,7 +55,7 @@ const codeboltAgent = {
|
|
|
55
55
|
},
|
|
56
56
|
/**
|
|
57
57
|
* Lists all available agents.
|
|
58
|
-
* @returns {Promise<
|
|
58
|
+
* @returns {Promise<ListAgentsResponse>} A promise that resolves with the list of agents.
|
|
59
59
|
*/
|
|
60
60
|
getAgentsList: (type = Agents.DOWNLOADED) => {
|
|
61
61
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
@@ -66,7 +66,7 @@ const codeboltAgent = {
|
|
|
66
66
|
},
|
|
67
67
|
/**
|
|
68
68
|
* Lists all available agents.
|
|
69
|
-
* @returns {Promise<
|
|
69
|
+
* @returns {Promise<AgentsDetailResponse>} A promise that resolves with the list of agents.
|
|
70
70
|
*/
|
|
71
71
|
getAgentsDetail: (agentList = []) => {
|
|
72
72
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GoToPageResponse, UrlResponse, GetMarkdownResponse, HtmlReceived, ExtractTextResponse, GetContentResponse } from '
|
|
1
|
+
import { GoToPageResponse, UrlResponse, GetMarkdownResponse, HtmlReceived, ExtractTextResponse, GetContentResponse, BrowserActionResponseData, BrowserScreenshotResponse, BrowserInfoResponse, BrowserSnapshotResponse } from '../types/socketMessageTypes';
|
|
2
2
|
/**
|
|
3
3
|
* A module for interacting with a browser through WebSockets.
|
|
4
4
|
*/
|
|
@@ -6,7 +6,7 @@ declare const cbbrowser: {
|
|
|
6
6
|
/**
|
|
7
7
|
* Opens a new page in the browser.
|
|
8
8
|
*/
|
|
9
|
-
newPage: () => Promise<
|
|
9
|
+
newPage: () => Promise<BrowserActionResponseData>;
|
|
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.
|
|
@@ -21,7 +21,7 @@ declare const cbbrowser: {
|
|
|
21
21
|
/**
|
|
22
22
|
* Takes a screenshot of the current page.
|
|
23
23
|
*/
|
|
24
|
-
screenshot: () => Promise<
|
|
24
|
+
screenshot: () => Promise<BrowserScreenshotResponse>;
|
|
25
25
|
/**
|
|
26
26
|
* Retrieves the HTML content of the current page.
|
|
27
27
|
* @returns {Promise<HtmlReceived>} A promise that resolves with the HTML content.
|
|
@@ -48,14 +48,14 @@ declare const cbbrowser: {
|
|
|
48
48
|
getContent: () => Promise<GetContentResponse>;
|
|
49
49
|
/**
|
|
50
50
|
* Retrieves the snapshot of the current page.
|
|
51
|
-
* @returns {Promise<
|
|
51
|
+
* @returns {Promise<BrowserSnapshotResponse>} A promise that resolves with the snapshot.
|
|
52
52
|
*/
|
|
53
|
-
getSnapShot: () => Promise<
|
|
53
|
+
getSnapShot: () => Promise<BrowserSnapshotResponse>;
|
|
54
54
|
/**
|
|
55
55
|
* Retrieves browser info like height width scrollx scrolly of the current page.
|
|
56
|
-
* @returns {Promise<
|
|
56
|
+
* @returns {Promise<BrowserInfoResponse>} A promise that resolves with the browser info.
|
|
57
57
|
*/
|
|
58
|
-
getBrowserInfo: () => Promise<
|
|
58
|
+
getBrowserInfo: () => Promise<BrowserInfoResponse>;
|
|
59
59
|
/**
|
|
60
60
|
* Extracts text from the current page.
|
|
61
61
|
* @returns {Promise<ExtractTextResponse>} A promise that resolves with the extracted text.
|
|
@@ -70,34 +70,34 @@ declare const cbbrowser: {
|
|
|
70
70
|
* Scrolls the current page in a specified direction by a specified number of pixels.
|
|
71
71
|
* @param {string} direction - The direction to scroll.
|
|
72
72
|
* @param {string} pixels - The number of pixels to scroll.
|
|
73
|
-
* @returns {Promise<
|
|
73
|
+
* @returns {Promise<BrowserActionResponseData>} A promise that resolves when the scroll action is complete.
|
|
74
74
|
*/
|
|
75
|
-
scroll: (direction: string, pixels: string) => Promise<
|
|
75
|
+
scroll: (direction: string, pixels: string) => Promise<BrowserActionResponseData>;
|
|
76
76
|
/**
|
|
77
77
|
* Types text into a specified element on the page.
|
|
78
78
|
* @param {string} elementid - The ID of the element to type into.
|
|
79
79
|
* @param {string} text - The text to type.
|
|
80
|
-
* @returns {Promise<
|
|
80
|
+
* @returns {Promise<BrowserActionResponseData>} A promise that resolves when the typing action is complete.
|
|
81
81
|
*/
|
|
82
|
-
type: (elementid: string, text: string) => Promise<
|
|
82
|
+
type: (elementid: string, text: string) => Promise<BrowserActionResponseData>;
|
|
83
83
|
/**
|
|
84
84
|
* Clicks on a specified element on the page.
|
|
85
85
|
* @param {string} elementid - The ID of the element to click.
|
|
86
|
-
* @returns {Promise<
|
|
86
|
+
* @returns {Promise<BrowserActionResponseData>} A promise that resolves when the click action is complete.
|
|
87
87
|
*/
|
|
88
|
-
click: (elementid: string) => Promise<
|
|
88
|
+
click: (elementid: string) => Promise<BrowserActionResponseData>;
|
|
89
89
|
/**
|
|
90
90
|
* Simulates the Enter key press on the current page.
|
|
91
|
-
* @returns {Promise<
|
|
91
|
+
* @returns {Promise<BrowserActionResponseData>} A promise that resolves when the Enter action is complete.
|
|
92
92
|
*/
|
|
93
|
-
enter: () => Promise<
|
|
93
|
+
enter: () => Promise<BrowserActionResponseData>;
|
|
94
94
|
/**
|
|
95
95
|
* Performs a search on the current page using a specified query.
|
|
96
96
|
* @param {string} elementid - The ID of the element to perform the search in.
|
|
97
97
|
* @param {string} query - The search query.
|
|
98
|
-
* @returns {Promise<
|
|
98
|
+
* @returns {Promise<BrowserActionResponseData>} A promise that resolves with the search results.
|
|
99
99
|
*/
|
|
100
|
-
search: (elementid: string, query: string) => Promise<
|
|
100
|
+
search: (elementid: string, query: string) => Promise<BrowserActionResponseData>;
|
|
101
101
|
};
|
|
102
102
|
export default cbbrowser;
|
|
103
103
|
/***
|
package/dist/modules/browser.js
CHANGED
|
@@ -99,7 +99,7 @@ const cbbrowser = {
|
|
|
99
99
|
},
|
|
100
100
|
/**
|
|
101
101
|
* Retrieves the snapshot of the current page.
|
|
102
|
-
* @returns {Promise<
|
|
102
|
+
* @returns {Promise<BrowserSnapshotResponse>} A promise that resolves with the snapshot.
|
|
103
103
|
*/
|
|
104
104
|
getSnapShot: () => {
|
|
105
105
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
@@ -109,7 +109,7 @@ const cbbrowser = {
|
|
|
109
109
|
},
|
|
110
110
|
/**
|
|
111
111
|
* Retrieves browser info like height width scrollx scrolly of the current page.
|
|
112
|
-
* @returns {Promise<
|
|
112
|
+
* @returns {Promise<BrowserInfoResponse>} A promise that resolves with the browser info.
|
|
113
113
|
*/
|
|
114
114
|
getBrowserInfo: () => {
|
|
115
115
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
@@ -141,7 +141,7 @@ const cbbrowser = {
|
|
|
141
141
|
* Scrolls the current page in a specified direction by a specified number of pixels.
|
|
142
142
|
* @param {string} direction - The direction to scroll.
|
|
143
143
|
* @param {string} pixels - The number of pixels to scroll.
|
|
144
|
-
* @returns {Promise<
|
|
144
|
+
* @returns {Promise<BrowserActionResponseData>} A promise that resolves when the scroll action is complete.
|
|
145
145
|
*/
|
|
146
146
|
scroll: (direction, pixels) => {
|
|
147
147
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
@@ -155,7 +155,7 @@ const cbbrowser = {
|
|
|
155
155
|
* Types text into a specified element on the page.
|
|
156
156
|
* @param {string} elementid - The ID of the element to type into.
|
|
157
157
|
* @param {string} text - The text to type.
|
|
158
|
-
* @returns {Promise<
|
|
158
|
+
* @returns {Promise<BrowserActionResponseData>} A promise that resolves when the typing action is complete.
|
|
159
159
|
*/
|
|
160
160
|
type: (elementid, text) => {
|
|
161
161
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
@@ -168,7 +168,7 @@ const cbbrowser = {
|
|
|
168
168
|
/**
|
|
169
169
|
* Clicks on a specified element on the page.
|
|
170
170
|
* @param {string} elementid - The ID of the element to click.
|
|
171
|
-
* @returns {Promise<
|
|
171
|
+
* @returns {Promise<BrowserActionResponseData>} A promise that resolves when the click action is complete.
|
|
172
172
|
*/
|
|
173
173
|
click: (elementid) => {
|
|
174
174
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
@@ -179,7 +179,7 @@ const cbbrowser = {
|
|
|
179
179
|
},
|
|
180
180
|
/**
|
|
181
181
|
* Simulates the Enter key press on the current page.
|
|
182
|
-
* @returns {Promise<
|
|
182
|
+
* @returns {Promise<BrowserActionResponseData>} A promise that resolves when the Enter action is complete.
|
|
183
183
|
*/
|
|
184
184
|
enter: () => {
|
|
185
185
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
@@ -191,7 +191,7 @@ const cbbrowser = {
|
|
|
191
191
|
* Performs a search on the current page using a specified query.
|
|
192
192
|
* @param {string} elementid - The ID of the element to perform the search in.
|
|
193
193
|
* @param {string} query - The search query.
|
|
194
|
-
* @returns {Promise<
|
|
194
|
+
* @returns {Promise<BrowserActionResponseData>} A promise that resolves with the search results.
|
|
195
195
|
*/
|
|
196
196
|
search: (elementid, query) => {
|
|
197
197
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
package/dist/modules/chat.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChatMessage, UserMessage } from '
|
|
1
|
+
import { ChatMessage, UserMessage } from '../types/socketMessageTypes';
|
|
2
2
|
type RequestHandler = (request: any, response: (data: any) => void) => Promise<void> | void;
|
|
3
3
|
/**
|
|
4
4
|
* Chat module to interact with the WebSocket server.
|
|
@@ -1,19 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Type definition for an AST node.
|
|
3
|
-
*/
|
|
4
|
-
export interface ASTNode {
|
|
5
|
-
type: string;
|
|
6
|
-
text: string;
|
|
7
|
-
startPosition: {
|
|
8
|
-
row: number;
|
|
9
|
-
column: number;
|
|
10
|
-
};
|
|
11
|
-
endPosition: {
|
|
12
|
-
row: number;
|
|
13
|
-
column: number;
|
|
14
|
-
};
|
|
15
|
-
children: ASTNode[];
|
|
16
|
-
}
|
|
1
|
+
import type { ASTNode } from "../types/commonTypes";
|
|
17
2
|
/**
|
|
18
3
|
* A collection of code parser functions.
|
|
19
4
|
*/
|
|
@@ -1,21 +1,6 @@
|
|
|
1
|
-
import { MatchProblemResponse, GetMatcherListTreeResponse, getMatchDetail } from '
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
name: string;
|
|
5
|
-
startLine: number;
|
|
6
|
-
endLine: number;
|
|
7
|
-
startColumn: number;
|
|
8
|
-
endColumn: number;
|
|
9
|
-
nodeType: string;
|
|
10
|
-
}
|
|
11
|
-
export interface JSTreeResponse {
|
|
12
|
-
event: string;
|
|
13
|
-
payload?: {
|
|
14
|
-
filePath: string;
|
|
15
|
-
structure: JSTreeStructureItem[];
|
|
16
|
-
};
|
|
17
|
-
error?: string;
|
|
18
|
-
}
|
|
1
|
+
import { MatchProblemResponse, GetMatcherListTreeResponse, getMatchDetail } from '../types/socketMessageTypes';
|
|
2
|
+
import type { JSTreeStructureItem, JSTreeResponse } from '../types/InternalTypes';
|
|
3
|
+
export type { JSTreeStructureItem, JSTreeResponse };
|
|
19
4
|
/**
|
|
20
5
|
* A utility module for working with code.
|
|
21
6
|
*/
|
package/dist/modules/debug.d.ts
CHANGED
package/dist/modules/fs.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateFileResponse, CreateFolderResponse, ReadFileResponse, UpdateFileResponse, DeleteFileResponse, DeleteFolderResponse } from '
|
|
1
|
+
import { CreateFileResponse, CreateFolderResponse, ReadFileResponse, UpdateFileResponse, DeleteFileResponse, DeleteFolderResponse } from '../types/socketMessageTypes';
|
|
2
2
|
/**
|
|
3
3
|
* @module cbfs
|
|
4
4
|
* @description This module provides functionality to interact with the filesystem.
|
package/dist/modules/git.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GitInitResponse, GitPullResponse, GitPushResponse, GitStatusResponse, AddResponse, GitCommitResponse, GitCheckoutResponse, GitBranchResponse, GitLogsResponse, GitDiffResponse } from '../types/socketMessageTypes';
|
|
1
2
|
/**
|
|
2
3
|
* A service for interacting with Git operations via WebSocket messages.
|
|
3
4
|
*/
|
|
@@ -5,65 +6,65 @@ declare const gitService: {
|
|
|
5
6
|
/**
|
|
6
7
|
* Initializes a new Git repository at the given path.
|
|
7
8
|
* @param {string} path - The file system path where the Git repository should be initialized.
|
|
8
|
-
* @returns {Promise<
|
|
9
|
+
* @returns {Promise<GitInitResponse>} A promise that resolves with the response from the init event.
|
|
9
10
|
*/
|
|
10
|
-
init: (path: string) => Promise<
|
|
11
|
+
init: (path: string) => Promise<GitInitResponse>;
|
|
11
12
|
/**
|
|
12
13
|
* Pulls the latest changes from the remote repository to the local repository at the given path.
|
|
13
14
|
* @param {string} path - The file system path of the local Git repository.
|
|
14
|
-
* @returns {Promise<
|
|
15
|
+
* @returns {Promise<GitPullResponse>} A promise that resolves with the response from the pull event.
|
|
15
16
|
*/
|
|
16
|
-
pull: () => Promise<
|
|
17
|
+
pull: () => Promise<GitPullResponse>;
|
|
17
18
|
/**
|
|
18
19
|
* Pushes local repository changes to the remote repository at the given path.
|
|
19
20
|
* @param {string} path - The file system path of the local Git repository.
|
|
20
|
-
* @returns {Promise<
|
|
21
|
+
* @returns {Promise<GitPushResponse>} A promise that resolves with the response from the push event.
|
|
21
22
|
*/
|
|
22
|
-
push: () => Promise<
|
|
23
|
+
push: () => Promise<GitPushResponse>;
|
|
23
24
|
/**
|
|
24
25
|
* Retrieves the status of the local repository at the given path.
|
|
25
26
|
* @param {string} path - The file system path of the local Git repository.
|
|
26
|
-
* @returns {Promise<
|
|
27
|
+
* @returns {Promise<GitStatusResponse>} A promise that resolves with the response from the status event.
|
|
27
28
|
*/
|
|
28
|
-
status: () => Promise<
|
|
29
|
+
status: () => Promise<GitStatusResponse>;
|
|
29
30
|
/**
|
|
30
31
|
* Adds changes in the local repository to the staging area at the given path.
|
|
31
32
|
* @param {string} path - The file system path of the local Git repository.
|
|
32
|
-
* @returns {Promise<
|
|
33
|
+
* @returns {Promise<AddResponse>} A promise that resolves with the response from the add event.
|
|
33
34
|
*/
|
|
34
|
-
addAll: () => Promise<
|
|
35
|
+
addAll: () => Promise<AddResponse>;
|
|
35
36
|
/**
|
|
36
37
|
* Commits the staged changes in the local repository with the given commit message.
|
|
37
38
|
* @param {string} message - The commit message to use for the commit.
|
|
38
|
-
* @returns {Promise<
|
|
39
|
+
* @returns {Promise<GitCommitResponse>} A promise that resolves with the response from the commit event.
|
|
39
40
|
*/
|
|
40
|
-
commit: (message: string) => Promise<
|
|
41
|
+
commit: (message: string) => Promise<GitCommitResponse>;
|
|
41
42
|
/**
|
|
42
43
|
* Checks out a branch or commit in the local repository at the given path.
|
|
43
44
|
* @param {string} path - The file system path of the local Git repository.
|
|
44
45
|
* @param {string} branch - The name of the branch or commit to check out.
|
|
45
|
-
* @returns {Promise<
|
|
46
|
+
* @returns {Promise<GitCheckoutResponse>} A promise that resolves with the response from the checkout event.
|
|
46
47
|
*/
|
|
47
|
-
checkout: (branch: string) => Promise<
|
|
48
|
+
checkout: (branch: string) => Promise<GitCheckoutResponse>;
|
|
48
49
|
/**
|
|
49
50
|
* Creates a new branch in the local repository at the given path.
|
|
50
51
|
* @param {string} path - The file system path of the local Git repository.
|
|
51
52
|
* @param {string} branch - The name of the new branch to create.
|
|
52
|
-
* @returns {Promise<
|
|
53
|
+
* @returns {Promise<GitBranchResponse>} A promise that resolves with the response from the branch event.
|
|
53
54
|
*/
|
|
54
|
-
branch: (branch: string) => Promise<
|
|
55
|
+
branch: (branch: string) => Promise<GitBranchResponse>;
|
|
55
56
|
/**
|
|
56
57
|
* Retrieves the commit logs for the local repository at the given path.
|
|
57
58
|
* @param {string} path - The file system path of the local Git repository.
|
|
58
|
-
* @returns {Promise<
|
|
59
|
+
* @returns {Promise<GitLogsResponse>} A promise that resolves with the response from the logs event.
|
|
59
60
|
*/
|
|
60
|
-
logs: (path: string) => Promise<
|
|
61
|
+
logs: (path: string) => Promise<GitLogsResponse>;
|
|
61
62
|
/**
|
|
62
63
|
* Retrieves the diff of changes for a specific commit in the local repository.
|
|
63
64
|
* @param {string} commitHash - The hash of the commit to retrieve the diff for.
|
|
64
65
|
* @param {string} path - The file system path of the local Git repository.
|
|
65
|
-
* @returns {Promise<
|
|
66
|
+
* @returns {Promise<GitDiffResponse>} A promise that resolves with the response from the diff event.
|
|
66
67
|
*/
|
|
67
|
-
diff: (commitHash: string) => Promise<
|
|
68
|
+
diff: (commitHash: string) => Promise<GitDiffResponse>;
|
|
68
69
|
};
|
|
69
70
|
export default gitService;
|
package/dist/modules/git.js
CHANGED
|
@@ -11,7 +11,7 @@ const gitService = {
|
|
|
11
11
|
/**
|
|
12
12
|
* Initializes a new Git repository at the given path.
|
|
13
13
|
* @param {string} path - The file system path where the Git repository should be initialized.
|
|
14
|
-
* @returns {Promise<
|
|
14
|
+
* @returns {Promise<GitInitResponse>} A promise that resolves with the response from the init event.
|
|
15
15
|
*/
|
|
16
16
|
init: async (path) => {
|
|
17
17
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
@@ -23,7 +23,7 @@ const gitService = {
|
|
|
23
23
|
/**
|
|
24
24
|
* Pulls the latest changes from the remote repository to the local repository at the given path.
|
|
25
25
|
* @param {string} path - The file system path of the local Git repository.
|
|
26
|
-
* @returns {Promise<
|
|
26
|
+
* @returns {Promise<GitPullResponse>} A promise that resolves with the response from the pull event.
|
|
27
27
|
*/
|
|
28
28
|
pull: async () => {
|
|
29
29
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
@@ -34,7 +34,7 @@ const gitService = {
|
|
|
34
34
|
/**
|
|
35
35
|
* Pushes local repository changes to the remote repository at the given path.
|
|
36
36
|
* @param {string} path - The file system path of the local Git repository.
|
|
37
|
-
* @returns {Promise<
|
|
37
|
+
* @returns {Promise<GitPushResponse>} A promise that resolves with the response from the push event.
|
|
38
38
|
*/
|
|
39
39
|
push: async () => {
|
|
40
40
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
@@ -45,7 +45,7 @@ const gitService = {
|
|
|
45
45
|
/**
|
|
46
46
|
* Retrieves the status of the local repository at the given path.
|
|
47
47
|
* @param {string} path - The file system path of the local Git repository.
|
|
48
|
-
* @returns {Promise<
|
|
48
|
+
* @returns {Promise<GitStatusResponse>} A promise that resolves with the response from the status event.
|
|
49
49
|
*/
|
|
50
50
|
status: async () => {
|
|
51
51
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
@@ -56,7 +56,7 @@ const gitService = {
|
|
|
56
56
|
/**
|
|
57
57
|
* Adds changes in the local repository to the staging area at the given path.
|
|
58
58
|
* @param {string} path - The file system path of the local Git repository.
|
|
59
|
-
* @returns {Promise<
|
|
59
|
+
* @returns {Promise<AddResponse>} A promise that resolves with the response from the add event.
|
|
60
60
|
*/
|
|
61
61
|
addAll: async () => {
|
|
62
62
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
@@ -67,7 +67,7 @@ const gitService = {
|
|
|
67
67
|
/**
|
|
68
68
|
* Commits the staged changes in the local repository with the given commit message.
|
|
69
69
|
* @param {string} message - The commit message to use for the commit.
|
|
70
|
-
* @returns {Promise<
|
|
70
|
+
* @returns {Promise<GitCommitResponse>} A promise that resolves with the response from the commit event.
|
|
71
71
|
*/
|
|
72
72
|
commit: async (message) => {
|
|
73
73
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
@@ -80,7 +80,7 @@ const gitService = {
|
|
|
80
80
|
* Checks out a branch or commit in the local repository at the given path.
|
|
81
81
|
* @param {string} path - The file system path of the local Git repository.
|
|
82
82
|
* @param {string} branch - The name of the branch or commit to check out.
|
|
83
|
-
* @returns {Promise<
|
|
83
|
+
* @returns {Promise<GitCheckoutResponse>} A promise that resolves with the response from the checkout event.
|
|
84
84
|
*/
|
|
85
85
|
checkout: async (branch) => {
|
|
86
86
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
@@ -93,7 +93,7 @@ const gitService = {
|
|
|
93
93
|
* Creates a new branch in the local repository at the given path.
|
|
94
94
|
* @param {string} path - The file system path of the local Git repository.
|
|
95
95
|
* @param {string} branch - The name of the new branch to create.
|
|
96
|
-
* @returns {Promise<
|
|
96
|
+
* @returns {Promise<GitBranchResponse>} A promise that resolves with the response from the branch event.
|
|
97
97
|
*/
|
|
98
98
|
branch: async (branch) => {
|
|
99
99
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
@@ -105,7 +105,7 @@ const gitService = {
|
|
|
105
105
|
/**
|
|
106
106
|
* Retrieves the commit logs for the local repository at the given path.
|
|
107
107
|
* @param {string} path - The file system path of the local Git repository.
|
|
108
|
-
* @returns {Promise<
|
|
108
|
+
* @returns {Promise<GitLogsResponse>} A promise that resolves with the response from the logs event.
|
|
109
109
|
*/
|
|
110
110
|
logs: async (path) => {
|
|
111
111
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
@@ -118,7 +118,7 @@ const gitService = {
|
|
|
118
118
|
* Retrieves the diff of changes for a specific commit in the local repository.
|
|
119
119
|
* @param {string} commitHash - The hash of the commit to retrieve the diff for.
|
|
120
120
|
* @param {string} path - The file system path of the local Git repository.
|
|
121
|
-
* @returns {Promise<
|
|
121
|
+
* @returns {Promise<GitDiffResponse>} A promise that resolves with the response from the diff event.
|
|
122
122
|
*/
|
|
123
123
|
diff: async (commitHash) => {
|
|
124
124
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|