@codebolt/codeboltjs 2.0.6 → 2.0.11

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.
Files changed (54) hide show
  1. package/dist/agentlib/agent.js +12 -4
  2. package/dist/agentlib/promptbuilder.d.ts +228 -0
  3. package/dist/agentlib/promptbuilder.js +487 -0
  4. package/dist/agentlib/taskInstruction.d.ts +3 -25
  5. package/dist/agentlib/usermessage.d.ts +13 -43
  6. package/dist/agentlib/usermessage.js +8 -8
  7. package/dist/core/messageManager.d.ts +4 -6
  8. package/dist/core/messageManager.js +24 -17
  9. package/dist/core/websocket.d.ts +10 -0
  10. package/dist/core/websocket.js +92 -8
  11. package/dist/index.d.ts +95 -88
  12. package/dist/index.js +63 -59
  13. package/dist/modules/agent.d.ts +9 -8
  14. package/dist/modules/agent.js +4 -4
  15. package/dist/modules/browser.d.ts +17 -17
  16. package/dist/modules/browser.js +7 -7
  17. package/dist/modules/chat.d.ts +1 -1
  18. package/dist/modules/codeparsers.d.ts +1 -16
  19. package/dist/modules/codeutils.d.ts +3 -18
  20. package/dist/modules/dbmemory.d.ts +1 -1
  21. package/dist/modules/debug.d.ts +1 -1
  22. package/dist/modules/fs.d.ts +1 -1
  23. package/dist/modules/git.d.ts +21 -20
  24. package/dist/modules/git.js +10 -10
  25. package/dist/modules/history.d.ts +6 -8
  26. package/dist/modules/history.js +4 -1
  27. package/dist/modules/llm.d.ts +13 -5
  28. package/dist/modules/llm.js +29 -4
  29. package/dist/modules/{tools.d.ts → mcp.d.ts} +9 -8
  30. package/dist/modules/{tools.js → mcp.js} +6 -6
  31. package/dist/modules/project.d.ts +1 -1
  32. package/dist/modules/state.d.ts +2 -1
  33. package/dist/modules/task.js +0 -1
  34. package/dist/modules/terminal.d.ts +1 -1
  35. package/dist/modules/tokenizer.d.ts +1 -1
  36. package/dist/modules/utils.d.ts +11 -1
  37. package/dist/modules/utils.js +9 -0
  38. package/dist/modules/vectordb.d.ts +1 -1
  39. package/dist/types/InternalTypes.d.ts +501 -0
  40. package/dist/types/InternalTypes.js +30 -0
  41. package/dist/types/commonTypes.d.ts +346 -0
  42. package/dist/types/commonTypes.js +37 -0
  43. package/dist/types/libFunctionTypes.d.ts +589 -0
  44. package/dist/types/libFunctionTypes.js +11 -0
  45. package/dist/types/socketMessageTypes.d.ts +951 -0
  46. package/dist/types/socketMessageTypes.js +51 -0
  47. package/dist/{modules → utils}/docutils.d.ts +2 -2
  48. package/dist/{modules → utils}/docutils.js +2 -2
  49. package/dist/utils/{toolBox.d.ts → mcpServer.d.ts} +1 -1
  50. package/dist/utils/{toolBox.js → mcpServer.js} +36 -36
  51. package/dist/utils/parse-source-code/languageParser.d.ts +1 -7
  52. package/dist/utils.d.ts +2 -1
  53. package/dist/utils.js +8 -3
  54. package/package.json +6 -1
package/dist/index.js CHANGED
@@ -10,7 +10,6 @@ const terminal_1 = __importDefault(require("./modules/terminal"));
10
10
  const browser_1 = __importDefault(require("./modules/browser"));
11
11
  const chat_1 = __importDefault(require("./modules/chat"));
12
12
  const codeutils_1 = __importDefault(require("./modules/codeutils"));
13
- const docutils_1 = __importDefault(require("./modules/docutils"));
14
13
  const crawler_1 = __importDefault(require("./modules/crawler"));
15
14
  const search_1 = __importDefault(require("./modules/search"));
16
15
  const knowledge_1 = __importDefault(require("./modules/knowledge"));
@@ -25,9 +24,8 @@ const task_1 = __importDefault(require("./modules/task"));
25
24
  const vectordb_1 = __importDefault(require("./modules/vectordb"));
26
25
  const debug_1 = __importDefault(require("./modules/debug"));
27
26
  const tokenizer_1 = __importDefault(require("./modules/tokenizer"));
28
- const ws_1 = __importDefault(require("ws"));
29
27
  const history_1 = require("./modules/history");
30
- const tools_1 = __importDefault(require("./modules/tools"));
28
+ const mcp_1 = __importDefault(require("./modules/mcp"));
31
29
  const agent_1 = __importDefault(require("./modules/agent"));
32
30
  const utils_1 = __importDefault(require("./modules/utils"));
33
31
  /**
@@ -41,6 +39,7 @@ class Codebolt {
41
39
  */
42
40
  constructor() {
43
41
  this.websocket = null;
42
+ this.isReady = false;
44
43
  this.fs = fs_1.default;
45
44
  this.git = git_1.default;
46
45
  this.llm = llm_1.default;
@@ -48,7 +47,6 @@ class Codebolt {
48
47
  this.chat = chat_1.default;
49
48
  this.terminal = terminal_1.default;
50
49
  this.codeutils = codeutils_1.default;
51
- this.docutils = docutils_1.default;
52
50
  this.crawler = crawler_1.default;
53
51
  this.search = search_1.default;
54
52
  this.knowledge = knowledge_1.default;
@@ -63,35 +61,44 @@ class Codebolt {
63
61
  this.debug = debug_1.default;
64
62
  this.tokenizer = tokenizer_1.default;
65
63
  this.chatSummary = history_1.chatSummary;
66
- this.tools = tools_1.default;
64
+ this.mcp = mcp_1.default;
67
65
  this.agent = agent_1.default;
68
66
  this.utils = utils_1.default;
69
67
  console.log("Codebolt Agent initialized");
70
- websocket_1.default.initializeWebSocket();
71
- this.websocket = websocket_1.default.getWebsocket;
68
+ this.readyPromise = this.initializeConnection();
72
69
  }
73
70
  /**
74
- * @method waitForConnection
75
- * @description Waits for the WebSocket connection to open.
76
- * @returns {Promise<void>} A promise that resolves when the WebSocket connection is open.
71
+ * @method initializeConnection
72
+ * @description Initializes the WebSocket connection asynchronously.
73
+ * @private
77
74
  */
78
- async waitForConnection() {
79
- return new Promise((resolve, reject) => {
80
- if (!this.websocket) {
81
- reject(new Error('WebSocket is not initialized'));
82
- return;
83
- }
84
- if (this.websocket.readyState === ws_1.default.OPEN) {
85
- resolve();
86
- return;
87
- }
88
- this.websocket.addEventListener('open', () => {
89
- resolve();
90
- });
91
- this.websocket.addEventListener('error', (error) => {
92
- reject(error);
93
- });
94
- });
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;
95
102
  }
96
103
  /**
97
104
  * Sets up a listener for incoming messages with a direct handler function.
@@ -99,40 +106,37 @@ class Codebolt {
99
106
  * @returns {void}
100
107
  */
101
108
  onMessage(handler) {
102
- const waitForConnection = () => {
103
- if (websocket_1.default.messageManager) {
104
- const handleUserMessage = async (response) => {
105
- console.log("Message received By Agent Library Starting Custom Agent Handler Logic", response);
106
- if (response.type === "messageResponse") {
107
- try {
108
- const result = await handler(response);
109
- // Send processStoped with optional message
110
- const message = {
111
- "type": "processStoped"
112
- };
113
- // If handler returned data, include it as message
114
- if (result !== undefined && result !== null) {
115
- message.message = result;
116
- }
117
- websocket_1.default.messageManager.send(message);
118
- }
119
- catch (error) {
120
- console.error('Error in user message handler:', error);
121
- // Send processStoped even if there's an error
122
- websocket_1.default.messageManager.send({
123
- "type": "processStoped",
124
- "error": error instanceof Error ? error.message : "Unknown error occurred"
125
- });
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;
126
123
  }
124
+ websocket_1.default.messageManager.send(message);
127
125
  }
128
- };
129
- websocket_1.default.messageManager.on('message', handleUserMessage);
130
- }
131
- else {
132
- setTimeout(waitForConnection, 100);
133
- }
134
- };
135
- waitForConnection();
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
+ });
136
140
  }
137
141
  }
138
142
  const codebolt = new Codebolt();
@@ -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<AgentResponse>} A promise that resolves with the agent details.
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<any>;
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<void>} A promise that resolves when the agent has been successfully started.
27
+ * @returns {Promise<TaskCompletionResponse>} A promise that resolves when the agent has been successfully started.
27
28
  */
28
- startAgent: (agentId: string, task: string) => Promise<any>;
29
+ startAgent: (agentId: string, task: string) => Promise<TaskCompletionResponse>;
29
30
  /**
30
31
  * Lists all available agents.
31
- * @returns {Promise<any>} A promise that resolves with the list of agents.
32
+ * @returns {Promise<ListAgentsResponse>} A promise that resolves with the list of agents.
32
33
  */
33
- getAgentsList: (type?: Agents) => Promise<any>;
34
+ getAgentsList: (type?: Agents) => Promise<ListAgentsResponse>;
34
35
  /**
35
36
  * Lists all available agents.
36
- * @returns {Promise<any>} A promise that resolves with the list of agents.
37
+ * @returns {Promise<AgentsDetailResponse>} A promise that resolves with the list of agents.
37
38
  */
38
- getAgentsDetail: (agentList?: never[]) => Promise<any>;
39
+ getAgentsDetail: (agentList?: never[]) => Promise<AgentsDetailResponse>;
39
40
  };
40
41
  export default codeboltAgent;
@@ -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<AgentResponse>} A promise that resolves with the agent details.
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<void>} A promise that resolves when the agent has been successfully started.
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<any>} A promise that resolves with the list of agents.
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<any>} A promise that resolves with the list of agents.
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 '@codebolt/types';
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<any>;
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<any>;
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<GetContentResponse>} A promise that resolves with the content.
51
+ * @returns {Promise<BrowserSnapshotResponse>} A promise that resolves with the snapshot.
52
52
  */
53
- getSnapShot: () => Promise<any>;
53
+ getSnapShot: () => Promise<BrowserSnapshotResponse>;
54
54
  /**
55
55
  * Retrieves browser info like height width scrollx scrolly of the current page.
56
- * @returns {Promise<GetContentResponse>} A promise that resolves with the content.
56
+ * @returns {Promise<BrowserInfoResponse>} A promise that resolves with the browser info.
57
57
  */
58
- getBrowserInfo: () => Promise<any>;
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<any>} A promise that resolves when the scroll action is complete.
73
+ * @returns {Promise<BrowserActionResponseData>} A promise that resolves when the scroll action is complete.
74
74
  */
75
- scroll: (direction: string, pixels: string) => Promise<any>;
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<any>} A promise that resolves when the typing action is complete.
80
+ * @returns {Promise<BrowserActionResponseData>} A promise that resolves when the typing action is complete.
81
81
  */
82
- type: (elementid: string, text: string) => Promise<any>;
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<any>} A promise that resolves when the click action is complete.
86
+ * @returns {Promise<BrowserActionResponseData>} A promise that resolves when the click action is complete.
87
87
  */
88
- click: (elementid: string) => Promise<any>;
88
+ click: (elementid: string) => Promise<BrowserActionResponseData>;
89
89
  /**
90
90
  * Simulates the Enter key press on the current page.
91
- * @returns {Promise<any>} A promise that resolves when the Enter action is complete.
91
+ * @returns {Promise<BrowserActionResponseData>} A promise that resolves when the Enter action is complete.
92
92
  */
93
- enter: () => Promise<any>;
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<any>} A promise that resolves with the search results.
98
+ * @returns {Promise<BrowserActionResponseData>} A promise that resolves with the search results.
99
99
  */
100
- search: (elementid: string, query: string) => Promise<any>;
100
+ search: (elementid: string, query: string) => Promise<BrowserActionResponseData>;
101
101
  };
102
102
  export default cbbrowser;
103
103
  /***
@@ -99,7 +99,7 @@ const cbbrowser = {
99
99
  },
100
100
  /**
101
101
  * Retrieves the snapshot of the current page.
102
- * @returns {Promise<GetContentResponse>} A promise that resolves with the content.
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<GetContentResponse>} A promise that resolves with the content.
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<any>} A promise that resolves when the scroll action is complete.
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<any>} A promise that resolves when the typing action is complete.
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<any>} A promise that resolves when the click action is complete.
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<any>} A promise that resolves when the Enter action is complete.
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<any>} A promise that resolves with the search results.
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({
@@ -1,4 +1,4 @@
1
- import { ChatMessage, UserMessage } from '@codebolt/types';
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 '@codebolt/types';
2
- export interface JSTreeStructureItem {
3
- type: string;
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
  */
@@ -1,4 +1,4 @@
1
- import { MemorySetResponse, MemoryGetResponse } from '@codebolt/types';
1
+ import { MemorySetResponse, MemoryGetResponse } from '../types/socketMessageTypes';
2
2
  /**
3
3
  * A module for handling in-memory database operations via WebSocket.
4
4
  */
@@ -1,4 +1,4 @@
1
- import { DebugAddLogResponse, OpenDebugBrowserResponse } from '@codebolt/types';
1
+ import { DebugAddLogResponse, OpenDebugBrowserResponse } from '../types/socketMessageTypes';
2
2
  export declare enum logType {
3
3
  info = "info",
4
4
  error = "error",
@@ -1,4 +1,4 @@
1
- import { CreateFileResponse, CreateFolderResponse, ReadFileResponse, UpdateFileResponse, DeleteFileResponse, DeleteFolderResponse } from '@codebolt/types';
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.
@@ -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<any>} A promise that resolves with the response from the init event.
9
+ * @returns {Promise<GitInitResponse>} A promise that resolves with the response from the init event.
9
10
  */
10
- init: (path: string) => Promise<any>;
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<any>} A promise that resolves with the response from the pull event.
15
+ * @returns {Promise<GitPullResponse>} A promise that resolves with the response from the pull event.
15
16
  */
16
- pull: () => Promise<any>;
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<any>} A promise that resolves with the response from the push event.
21
+ * @returns {Promise<GitPushResponse>} A promise that resolves with the response from the push event.
21
22
  */
22
- push: () => Promise<any>;
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<any>} A promise that resolves with the response from the status event.
27
+ * @returns {Promise<GitStatusResponse>} A promise that resolves with the response from the status event.
27
28
  */
28
- status: () => Promise<any>;
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<any>} A promise that resolves with the response from the add event.
33
+ * @returns {Promise<AddResponse>} A promise that resolves with the response from the add event.
33
34
  */
34
- addAll: () => Promise<any>;
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<any>} A promise that resolves with the response from the commit event.
39
+ * @returns {Promise<GitCommitResponse>} A promise that resolves with the response from the commit event.
39
40
  */
40
- commit: (message: string) => Promise<any>;
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<any>} A promise that resolves with the response from the checkout event.
46
+ * @returns {Promise<GitCheckoutResponse>} A promise that resolves with the response from the checkout event.
46
47
  */
47
- checkout: (branch: string) => Promise<any>;
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<any>} A promise that resolves with the response from the branch event.
53
+ * @returns {Promise<GitBranchResponse>} A promise that resolves with the response from the branch event.
53
54
  */
54
- branch: (branch: string) => Promise<any>;
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<any>} A promise that resolves with the response from the logs event.
59
+ * @returns {Promise<GitLogsResponse>} A promise that resolves with the response from the logs event.
59
60
  */
60
- logs: (path: string) => Promise<any>;
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<any>} A promise that resolves with the response from the diff event.
66
+ * @returns {Promise<GitDiffResponse>} A promise that resolves with the response from the diff event.
66
67
  */
67
- diff: (commitHash: string) => Promise<any>;
68
+ diff: (commitHash: string) => Promise<GitDiffResponse>;
68
69
  };
69
70
  export default gitService;