@codebolt/codeboltjs 2.2.1 → 2.2.3

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 (72) hide show
  1. package/Readme.md +3 -0
  2. package/dist/core/Codebolt.d.ts +212 -165
  3. package/dist/core/Codebolt.js +267 -6
  4. package/dist/core/websocket.js +9 -11
  5. package/dist/index.d.ts +1 -1
  6. package/dist/modules/agent.d.ts +2 -16
  7. package/dist/modules/agent.js +15 -33
  8. package/dist/modules/browser.d.ts +1 -1
  9. package/dist/modules/browser.js +52 -51
  10. package/dist/modules/chat.d.ts +2 -2
  11. package/dist/modules/chat.js +20 -18
  12. package/dist/modules/codeutils.d.ts +1 -9
  13. package/dist/modules/codeutils.js +13 -111
  14. package/dist/modules/dbmemory.d.ts +3 -3
  15. package/dist/modules/dbmemory.js +8 -7
  16. package/dist/modules/debug.d.ts +1 -1
  17. package/dist/modules/fs.d.ts +59 -28
  18. package/dist/modules/fs.js +86 -45
  19. package/dist/modules/git.d.ts +1 -1
  20. package/dist/modules/git.js +31 -30
  21. package/dist/modules/history.d.ts +1 -1
  22. package/dist/modules/history.js +7 -6
  23. package/dist/modules/llm.d.ts +13 -20
  24. package/dist/modules/llm.js +16 -15
  25. package/dist/modules/mcp.d.ts +4 -4
  26. package/dist/modules/mcp.js +25 -25
  27. package/dist/modules/outputparsers.d.ts +22 -22
  28. package/dist/modules/outputparsers.js +7 -5
  29. package/dist/modules/project.d.ts +1 -1
  30. package/dist/modules/project.js +15 -13
  31. package/dist/modules/state.d.ts +1 -1
  32. package/dist/modules/state.js +16 -15
  33. package/dist/modules/task.d.ts +136 -92
  34. package/dist/modules/task.js +354 -205
  35. package/dist/modules/terminal.d.ts +1 -1
  36. package/dist/modules/terminal.js +12 -11
  37. package/dist/modules/tokenizer.d.ts +1 -1
  38. package/dist/modules/tokenizer.js +7 -6
  39. package/dist/modules/user-message-manager.d.ts +165 -0
  40. package/dist/modules/user-message-manager.js +308 -0
  41. package/dist/modules/user-message-utilities.d.ts +111 -0
  42. package/dist/modules/user-message-utilities.js +115 -0
  43. package/dist/modules/utils.d.ts +1 -1
  44. package/dist/modules/utils.js +4 -3
  45. package/dist/modules/vectordb.d.ts +1 -1
  46. package/dist/modules/vectordb.js +13 -12
  47. package/dist/notificationfunctions/agent.js +7 -6
  48. package/dist/notificationfunctions/browser.js +9 -8
  49. package/dist/notificationfunctions/chat.js +9 -8
  50. package/dist/notificationfunctions/codeutils.js +9 -8
  51. package/dist/notificationfunctions/crawler.js +9 -8
  52. package/dist/notificationfunctions/dbmemory.js +9 -8
  53. package/dist/notificationfunctions/fs.js +45 -44
  54. package/dist/notificationfunctions/git.d.ts +2 -2
  55. package/dist/notificationfunctions/git.js +111 -51
  56. package/dist/notificationfunctions/history.js +9 -8
  57. package/dist/notificationfunctions/llm.js +9 -8
  58. package/dist/notificationfunctions/mcp.js +17 -16
  59. package/dist/notificationfunctions/search.js +13 -12
  60. package/dist/notificationfunctions/system.js +5 -4
  61. package/dist/notificationfunctions/terminal.js +5 -4
  62. package/dist/notificationfunctions/todo.js +13 -12
  63. package/dist/types/commonTypes.d.ts +4 -0
  64. package/dist/types/index.d.ts +1 -1
  65. package/dist/types/libFunctionTypes.d.ts +918 -29
  66. package/dist/types/libFunctionTypes.js +33 -0
  67. package/dist/types/notificationFunctions/git.d.ts +40 -1
  68. package/dist/types/notificationFunctions/index.d.ts +1 -0
  69. package/dist/types/notificationFunctions/index.js +1 -0
  70. package/package.json +17 -25
  71. package/dist/modules/codeparsers.d.ts +0 -37
  72. package/dist/modules/codeparsers.js +0 -329
@@ -1,6 +1,4 @@
1
- import { LLMResponse } from '../types/socketMessageTypes';
2
- import type { Message, ToolCall, Tool, LLMInferenceParams } from '../types/libFunctionTypes';
3
- export type { Message, ToolCall, Tool, LLMInferenceParams };
1
+ import type { LLMInferenceParams, LLMCompletion, LLMModelConfig } from '@codebolt/types/sdk';
4
2
  /**
5
3
  * A module for interacting with language learning models (LLMs) via WebSocket.
6
4
  */
@@ -21,26 +19,21 @@ declare const cbllm: {
21
19
  * - stream: Whether to stream the response
22
20
  * @returns A promise that resolves with the LLM's response
23
21
  */
24
- inference: (params: {
25
- messages: Message[];
26
- tools?: any[];
27
- tool_choice?: string;
28
- full?: boolean;
29
- llmrole?: string;
30
- max_tokens?: number;
31
- temperature?: number;
32
- stream?: boolean;
33
- }, llmrole?: string) => Promise<{
34
- completion: any;
22
+ inference: (params: LLMInferenceParams) => Promise<{
23
+ completion: LLMCompletion;
35
24
  }>;
36
25
  /**
37
- * Legacy method for backward compatibility - converts simple string prompt to message format.
38
- * @deprecated Use the new inference method with proper message format instead.
26
+ * Gets the model configuration for a specific model or the default application model.
27
+ * If modelId is provided, returns configuration for that specific model.
28
+ * If modelId is not provided, returns the default application LLM configuration.
39
29
  *
40
- * @param {string} message - The input message or prompt to be sent to the LLM.
41
- * @param {string} llmrole - The role of the LLM to determine which model to use.
42
- * @returns {Promise<LLMResponse>} A promise that resolves with the LLM's response.
30
+ * @param modelId - Optional model identifier. If not provided, returns default model config.
31
+ * @returns A promise that resolves with the model configuration including provider and model details.
43
32
  */
44
- legacyInference: (message: string, llmrole: string) => Promise<LLMResponse>;
33
+ getModelConfig: (modelId?: string) => Promise<{
34
+ config: LLMModelConfig | null;
35
+ success: boolean;
36
+ error?: string;
37
+ }>;
45
38
  };
46
39
  export default cbllm;
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const websocket_1 = __importDefault(require("../core/websocket"));
7
+ const enum_1 = require("@codebolt/types/enum");
7
8
  /**
8
9
  * A module for interacting with language learning models (LLMs) via WebSocket.
9
10
  */
@@ -24,31 +25,31 @@ const cbllm = {
24
25
  * - stream: Whether to stream the response
25
26
  * @returns A promise that resolves with the LLM's response
26
27
  */
27
- inference: async (params, llmrole) => {
28
+ inference: async (params) => {
28
29
  return websocket_1.default.messageManager.sendAndWaitForResponse({
29
- "type": "inference",
30
+ "type": enum_1.EventType.LLM_EVENT,
30
31
  "message": {
31
32
  prompt: params,
32
- llmrole
33
+ llmrole: params.llmrole
33
34
  },
34
- }, "llmResponse");
35
+ }, enum_1.LLMResponseType.LLM_RESPONSE);
35
36
  },
36
37
  /**
37
- * Legacy method for backward compatibility - converts simple string prompt to message format.
38
- * @deprecated Use the new inference method with proper message format instead.
38
+ * Gets the model configuration for a specific model or the default application model.
39
+ * If modelId is provided, returns configuration for that specific model.
40
+ * If modelId is not provided, returns the default application LLM configuration.
39
41
  *
40
- * @param {string} message - The input message or prompt to be sent to the LLM.
41
- * @param {string} llmrole - The role of the LLM to determine which model to use.
42
- * @returns {Promise<LLMResponse>} A promise that resolves with the LLM's response.
42
+ * @param modelId - Optional model identifier. If not provided, returns default model config.
43
+ * @returns A promise that resolves with the model configuration including provider and model details.
43
44
  */
44
- legacyInference: async (message, llmrole) => {
45
- return websocket_1.default.messageManager.sendAndWaitForResponse({
46
- "type": "inference",
45
+ getModelConfig: async (modelId) => {
46
+ return await websocket_1.default.messageManager.sendAndWaitForResponse({
47
+ "type": enum_1.EventType.STATE_EVENT,
47
48
  "message": {
48
- prompt: message,
49
- llmrole
49
+ action: enum_1.StateAction.GET_APP_STATE,
50
+ modelId: modelId // Include modelId if provided for future extensibility
50
51
  },
51
- }, "llmResponse");
52
+ }, enum_1.StateResponseType.GET_APP_STATE_RESPONSE);
52
53
  }
53
54
  /**
54
55
  * Legacy method for backward compatibility - converts simple string prompt to message format.
@@ -1,4 +1,4 @@
1
- import { GetEnabledToolBoxesResponse, GetLocalToolBoxesResponse, GetAvailableToolBoxesResponse, SearchAvailableToolBoxesResponse, ListToolsFromToolBoxesResponse, ConfigureToolBoxResponse, GetToolsResponse, ExecuteToolResponse } from '../types/socketMessageTypes';
1
+ import { GetEnabledToolBoxesResponse, GetLocalToolBoxesResponse, GetAvailableToolBoxesResponse, SearchAvailableToolBoxesResponse, ListToolsFromToolBoxesResponse, ConfigureToolBoxResponse, GetToolsResponse, ExecuteToolResponse, MCPUserMessage, MCPConfiguration, ToolParameters } from '@codebolt/types/sdk';
2
2
  /**
3
3
  * Object containing methods for interacting with Codebolt MCP (Model Context Protocol) tools.
4
4
  * Provides functionality to discover, list, and execute tools.
@@ -22,7 +22,7 @@ declare const codeboltMCP: {
22
22
  * @param userMessage - The user message to extract mentions from
23
23
  * @returns Promise with the mentioned toolboxes
24
24
  */
25
- getMentionedMCPServers: (userMessage: any) => Promise<GetAvailableToolBoxesResponse>;
25
+ getMentionedMCPServers: (userMessage: MCPUserMessage) => Promise<GetAvailableToolBoxesResponse>;
26
26
  /**
27
27
  * Searches for available toolboxes matching a query.
28
28
  *
@@ -44,7 +44,7 @@ declare const codeboltMCP: {
44
44
  * @param config - Configuration object for the toolbox
45
45
  * @returns Promise with the configuration result
46
46
  */
47
- configureMCPServer: (name: string, config: any) => Promise<ConfigureToolBoxResponse>;
47
+ configureMCPServer: (name: string, config: MCPConfiguration) => Promise<ConfigureToolBoxResponse>;
48
48
  /**
49
49
  * Gets detailed information about specific tools.
50
50
  *
@@ -63,6 +63,6 @@ declare const codeboltMCP: {
63
63
  * @param params - Parameters to pass to the tool
64
64
  * @returns Promise with the execution result
65
65
  */
66
- executeTool: (toolbox: string, toolName: string, params: any) => Promise<ExecuteToolResponse>;
66
+ executeTool: (toolbox: string, toolName: string, params: ToolParameters) => Promise<ExecuteToolResponse>;
67
67
  };
68
68
  export default codeboltMCP;
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- // UserMessage type removed - using any for compatibility
7
6
  // To use UserMessage functionality, install @codebolt/agent-utils
8
7
  const websocket_1 = __importDefault(require("../core/websocket"));
8
+ const enum_1 = require("@codebolt/types/enum");
9
9
  /**
10
10
  * Object containing methods for interacting with Codebolt MCP (Model Context Protocol) tools.
11
11
  * Provides functionality to discover, list, and execute tools.
@@ -18,9 +18,9 @@ const codeboltMCP = {
18
18
  */
19
19
  getEnabledMCPServers: () => {
20
20
  return websocket_1.default.messageManager.sendAndWaitForResponse({
21
- "type": "codebolttools",
22
- "action": "getEnabledToolBoxes"
23
- }, "getEnabledToolBoxesResponse");
21
+ "type": enum_1.EventType.CODEBOLT_TOOLS_EVENT,
22
+ "action": enum_1.CodeboltToolsAction.GetEnabledToolBoxes
23
+ }, enum_1.CodeboltToolsResponse.GetEnabledToolBoxesResponse);
24
24
  },
25
25
  /**
26
26
  * Gets the list of locally available toolboxes.
@@ -29,9 +29,9 @@ const codeboltMCP = {
29
29
  */
30
30
  getLocalMCPServers: () => {
31
31
  return websocket_1.default.messageManager.sendAndWaitForResponse({
32
- "type": "codebolttools",
33
- "action": "getLocalToolBoxes"
34
- }, "getLocalToolBoxesResponse");
32
+ "type": enum_1.EventType.CODEBOLT_TOOLS_EVENT,
33
+ "action": enum_1.CodeboltToolsAction.GetLocalToolBoxes
34
+ }, enum_1.CodeboltToolsResponse.GetLocalToolBoxesResponse);
35
35
  },
36
36
  /**
37
37
  * Gets toolboxes mentioned in a user message.
@@ -41,9 +41,9 @@ const codeboltMCP = {
41
41
  */
42
42
  getMentionedMCPServers: (userMessage) => {
43
43
  return websocket_1.default.messageManager.sendAndWaitForResponse({
44
- "type": "codebolttools",
45
- "action": "getAvailableToolBoxes"
46
- }, "getAvailableToolBoxesResponse");
44
+ "type": enum_1.EventType.CODEBOLT_TOOLS_EVENT,
45
+ "action": enum_1.CodeboltToolsAction.GetAvailableToolBoxes
46
+ }, enum_1.CodeboltToolsResponse.GetAvailableToolBoxesResponse);
47
47
  },
48
48
  /**
49
49
  * Searches for available toolboxes matching a query.
@@ -53,10 +53,10 @@ const codeboltMCP = {
53
53
  */
54
54
  searchAvailableMCPServers: (query) => {
55
55
  return websocket_1.default.messageManager.sendAndWaitForResponse({
56
- "type": "codebolttools",
57
- "action": "searchAvailableToolBoxes",
56
+ "type": enum_1.EventType.CODEBOLT_TOOLS_EVENT,
57
+ "action": enum_1.CodeboltToolsAction.SearchAvailableToolBoxes,
58
58
  "query": query
59
- }, "searchAvailableToolBoxesResponse");
59
+ }, enum_1.CodeboltToolsResponse.SearchAvailableToolBoxesResponse);
60
60
  },
61
61
  /**
62
62
  * Lists all tools from the specified toolboxes.
@@ -66,10 +66,10 @@ const codeboltMCP = {
66
66
  */
67
67
  listMcpFromServers: (toolBoxes) => {
68
68
  return websocket_1.default.messageManager.sendAndWaitForResponse({
69
- "type": "codebolttools",
70
- "action": "listToolsFromToolBoxes",
69
+ "type": enum_1.EventType.CODEBOLT_TOOLS_EVENT,
70
+ "action": enum_1.CodeboltToolsAction.ListToolsFromToolBoxes,
71
71
  "toolBoxes": toolBoxes
72
- }, "listToolsFromToolBoxesResponse");
72
+ }, enum_1.CodeboltToolsResponse.ListToolsFromToolBoxesResponse);
73
73
  },
74
74
  /**
75
75
  * Configures a specific toolbox with provided configuration.
@@ -80,11 +80,11 @@ const codeboltMCP = {
80
80
  */
81
81
  configureMCPServer: (name, config) => {
82
82
  return websocket_1.default.messageManager.sendAndWaitForResponse({
83
- "type": "codebolttools",
84
- "action": "configureToolBox",
83
+ "type": enum_1.EventType.CODEBOLT_TOOLS_EVENT,
84
+ "action": enum_1.CodeboltToolsAction.ConfigureToolBox,
85
85
  "mcpName": name,
86
86
  "config": config
87
- }, "configureToolBoxResponse");
87
+ }, enum_1.CodeboltToolsResponse.ConfigureToolBoxResponse);
88
88
  },
89
89
  /**
90
90
  * Gets detailed information about specific tools.
@@ -94,10 +94,10 @@ const codeboltMCP = {
94
94
  */
95
95
  getTools: (tools) => {
96
96
  return websocket_1.default.messageManager.sendAndWaitForResponse({
97
- "type": "codebolttools",
98
- "action": "getTools",
97
+ "type": enum_1.EventType.CODEBOLT_TOOLS_EVENT,
98
+ "action": enum_1.CodeboltToolsAction.GetTools,
99
99
  "toolboxes": tools
100
- }, "getToolsResponse");
100
+ }, enum_1.CodeboltToolsResponse.GetToolsResponse);
101
101
  },
102
102
  /**
103
103
  * Executes a specific tool with provided parameters.
@@ -109,11 +109,11 @@ const codeboltMCP = {
109
109
  */
110
110
  executeTool: (toolbox, toolName, params) => {
111
111
  return websocket_1.default.messageManager.sendAndWaitForResponse({
112
- "type": "codebolttools",
113
- "action": "executeTool",
112
+ "type": enum_1.EventType.CODEBOLT_TOOLS_EVENT,
113
+ "action": enum_1.CodeboltToolsAction.ExecuteTool,
114
114
  "toolName": `${toolbox}--${toolName}`,
115
115
  "params": params
116
- }, "executeToolResponse");
116
+ }, enum_1.CodeboltToolsResponse.ExecuteToolResponse);
117
117
  }
118
118
  };
119
119
  exports.default = codeboltMCP;
@@ -1,56 +1,56 @@
1
1
  /**
2
2
  * A module for parsing output messages to identify errors and warnings.
3
3
  */
4
+ export interface CSVRow {
5
+ [key: string]: string;
6
+ }
7
+ export type ParsableOutput = string | string[] | {
8
+ toString(): string;
9
+ };
10
+ export interface ParseResult<T = unknown> {
11
+ success: boolean;
12
+ parsed?: T;
13
+ error?: Error;
14
+ }
4
15
  declare const cboutputparsers: {
5
16
  /**
6
17
  * Parses JSON string and returns a result object.
7
18
  * @param {string} jsonString - The JSON string to parse.
8
19
  * @returns {Object} An object with success flag and parsed data or error.
9
20
  */
10
- parseJSON: (jsonString: string) => {
11
- success: boolean;
12
- parsed?: any;
13
- error?: Error;
14
- };
21
+ parseJSON: (jsonString: string) => ParseResult<unknown>;
15
22
  /**
16
23
  * Parses XML string and returns a result object.
17
24
  * @param {string} xmlString - The XML string to parse.
18
25
  * @returns {Object} An object with success flag and parsed data.
19
26
  */
20
- parseXML: (xmlString: string) => {
21
- success: boolean;
22
- parsed?: any;
23
- };
27
+ parseXML: (xmlString: string) => ParseResult<{
28
+ rootElement: string;
29
+ [key: string]: unknown;
30
+ }>;
24
31
  /**
25
32
  * Parses CSV string and returns a result object.
26
33
  * @param {string} csvString - The CSV string to parse.
27
34
  * @returns {Object} An object with success flag and parsed data or error.
28
35
  */
29
- parseCSV: (csvString: string) => {
30
- success: boolean;
31
- parsed?: any[];
32
- error?: Error;
33
- };
36
+ parseCSV: (csvString: string) => ParseResult<CSVRow[]>;
34
37
  /**
35
38
  * Parses text string and returns a result object with lines.
36
39
  * @param {string} text - The text to parse.
37
40
  * @returns {Object} An object with success flag and parsed lines.
38
41
  */
39
- parseText: (text: string) => {
40
- success: boolean;
41
- parsed: string[];
42
- };
42
+ parseText: (text: string) => ParseResult<string[]>;
43
43
  /**
44
44
  * Parses the given output and returns all the error messages.
45
- * @param {any} output - The output to parse for error messages.
45
+ * @param {ParsableOutput} output - The output to parse for error messages.
46
46
  * @returns {string[]} An array of error messages.
47
47
  */
48
- parseErrors: (output: any) => string[];
48
+ parseErrors: (output: ParsableOutput) => string[];
49
49
  /**
50
50
  * Parses the given output and returns all the warning messages.
51
- * @param {any} output - The output to parse for warning messages.
51
+ * @param {ParsableOutput} output - The output to parse for warning messages.
52
52
  * @returns {string[]} An array of warning messages.
53
53
  */
54
- parseWarnings: (output: any) => string[];
54
+ parseWarnings: (output: ParsableOutput) => string[];
55
55
  };
56
56
  export default cboutputparsers;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
2
  /**
4
3
  * A module for parsing output messages to identify errors and warnings.
5
4
  */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const cboutputparsers = {
7
7
  /**
8
8
  * Parses JSON string and returns a result object.
@@ -65,19 +65,21 @@ const cboutputparsers = {
65
65
  },
66
66
  /**
67
67
  * Parses the given output and returns all the error messages.
68
- * @param {any} output - The output to parse for error messages.
68
+ * @param {ParsableOutput} output - The output to parse for error messages.
69
69
  * @returns {string[]} An array of error messages.
70
70
  */
71
71
  parseErrors: (output) => {
72
- return output.split('\n').filter((line) => line.includes('Error:'));
72
+ const outputString = typeof output === 'string' ? output : output.toString();
73
+ return outputString.split('\n').filter((line) => line.includes('Error:'));
73
74
  },
74
75
  /**
75
76
  * Parses the given output and returns all the warning messages.
76
- * @param {any} output - The output to parse for warning messages.
77
+ * @param {ParsableOutput} output - The output to parse for warning messages.
77
78
  * @returns {string[]} An array of warning messages.
78
79
  */
79
80
  parseWarnings: (output) => {
80
- return output.split('\n').filter((line) => line.includes('Warning:'));
81
+ const outputString = typeof output === 'string' ? output : output.toString();
82
+ return outputString.split('\n').filter((line) => line.includes('Warning:'));
81
83
  }
82
84
  };
83
85
  exports.default = cboutputparsers;
@@ -1,4 +1,4 @@
1
- import { GetProjectPathResponse, GetProjectSettingsResponse } from '../types/socketMessageTypes';
1
+ import { GetProjectPathResponse, GetProjectSettingsResponse } from '@codebolt/types/sdk';
2
2
  /**
3
3
  * A module for interacting with project settings and paths.
4
4
  */
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const websocket_1 = __importDefault(require("../core/websocket"));
7
+ const enum_1 = require("@codebolt/types/enum");
7
8
  /**
8
9
  * A module for interacting with project settings and paths.
9
10
  */
@@ -14,9 +15,9 @@ const cbproject = {
14
15
  */
15
16
  getProjectSettings: () => {
16
17
  return websocket_1.default.messageManager.sendAndWaitForResponse({
17
- "type": "settingEvent",
18
- "action": "getProjectSettings"
19
- }, "getProjectSettingsResponse");
18
+ "type": enum_1.EventType.PROJECT_EVENT,
19
+ "action": enum_1.ProjectAction.GET_PROJECT_SETTINGS
20
+ }, enum_1.ProjectResponseType.GET_PROJECT_SETTINGS_RESPONSE);
20
21
  },
21
22
  /**
22
23
  * Retrieves the path of the current project.
@@ -24,27 +25,28 @@ const cbproject = {
24
25
  */
25
26
  getProjectPath: () => {
26
27
  return websocket_1.default.messageManager.sendAndWaitForResponse({
27
- "type": "settingEvent",
28
- "action": "getProjectPath"
29
- }, "getProjectPathResponse");
28
+ "type": enum_1.EventType.PROJECT_EVENT,
29
+ "action": enum_1.ProjectAction.GET_PROJECT_PATH
30
+ }, enum_1.ProjectResponseType.GET_PROJECT_PATH_RESPONSE);
30
31
  },
31
32
  getRepoMap: (message) => {
32
33
  return websocket_1.default.messageManager.sendAndWaitForResponse({
33
- "type": "settingEvent",
34
- "action": "getRepoMap",
34
+ "type": enum_1.EventType.PROJECT_EVENT,
35
+ "action": enum_1.ProjectAction.GET_REPO_MAP,
35
36
  message
36
- }, "getRepoMapResponse");
37
+ }, enum_1.ProjectResponseType.GET_REPO_MAP_RESPONSE);
37
38
  },
38
39
  runProject: () => {
39
40
  websocket_1.default.messageManager.send({
40
- "type": "runProject"
41
+ "type": enum_1.EventType.PROJECT_EVENT,
42
+ "action": enum_1.ProjectAction.RUN_PROJECT
41
43
  });
42
44
  },
43
45
  getEditorFileStatus: () => {
44
46
  return websocket_1.default.messageManager.sendAndWaitForResponse({
45
- "type": "settingEvent",
46
- "action": "getEditorFileStatus",
47
- }, "getEditorFileStatusResponse");
47
+ "type": enum_1.EventType.PROJECT_EVENT,
48
+ "action": enum_1.ProjectAction.GET_EDITOR_FILE_STATUS,
49
+ }, enum_1.ProjectResponseType.GET_EDITOR_FILE_STATUS_RESPONSE);
48
50
  }
49
51
  };
50
52
  exports.default = cbproject;
@@ -1,4 +1,4 @@
1
- import { AddToAgentStateResponse, GetAgentStateResponse, GetProjectStateResponse, UpdateProjectStateResponse } from '../types/socketMessageTypes';
1
+ import { AddToAgentStateResponse, GetAgentStateResponse, GetProjectStateResponse, UpdateProjectStateResponse } from '@codebolt/types/sdk';
2
2
  import { ApplicationState } from '../types/commonTypes';
3
3
  declare const cbstate: {
4
4
  /**
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const websocket_1 = __importDefault(require("../core/websocket"));
7
+ const enum_1 = require("@codebolt/types/enum");
7
8
  const cbstate = {
8
9
  /**
9
10
  * Retrieves the current application state from the server via WebSocket.
@@ -11,9 +12,9 @@ const cbstate = {
11
12
  */
12
13
  getApplicationState: async () => {
13
14
  return websocket_1.default.messageManager.sendAndWaitForResponse({
14
- "type": "projectStateEvent",
15
- "action": "getAppState",
16
- }, "getAppStateResponse");
15
+ "type": enum_1.StateEventType.PROJECT_STATE_EVENT,
16
+ "action": enum_1.StateAction.GET_APP_STATE,
17
+ }, enum_1.StateResponseType.GET_APP_STATE_RESPONSE);
17
18
  },
18
19
  /**
19
20
  * Adds a key-value pair to the agent's state on the server via WebSocket.
@@ -23,13 +24,13 @@ const cbstate = {
23
24
  */
24
25
  addToAgentState: async (key, value) => {
25
26
  return websocket_1.default.messageManager.sendAndWaitForResponse({
26
- "type": "agentStateEvent",
27
- "action": "addToAgentState",
27
+ "type": enum_1.StateEventType.AGENT_STATE_EVENT,
28
+ "action": enum_1.StateAction.ADD_TO_AGENT_STATE,
28
29
  payload: {
29
30
  key,
30
31
  value
31
32
  }
32
- }, "addToAgentStateResponse");
33
+ }, enum_1.StateResponseType.ADD_TO_AGENT_STATE_RESPONSE);
33
34
  },
34
35
  /**
35
36
  * Retrieves the current state of the agent from the server via WebSocket.
@@ -37,9 +38,9 @@ const cbstate = {
37
38
  */
38
39
  getAgentState: async () => {
39
40
  return websocket_1.default.messageManager.sendAndWaitForResponse({
40
- "type": "agentStateEvent",
41
- "action": "getAgentState",
42
- }, "getAgentStateResponse");
41
+ "type": enum_1.StateEventType.AGENT_STATE_EVENT,
42
+ "action": enum_1.StateAction.GET_AGENT_STATE,
43
+ }, enum_1.StateResponseType.GET_AGENT_STATE_RESPONSE);
43
44
  },
44
45
  /**
45
46
  * Retrieves the current project state from the server via WebSocket.
@@ -47,9 +48,9 @@ const cbstate = {
47
48
  */
48
49
  getProjectState: async () => {
49
50
  return websocket_1.default.messageManager.sendAndWaitForResponse({
50
- "type": "projectStateEvent",
51
- "action": "getProjectState",
52
- }, "getProjectStateResponse");
51
+ "type": enum_1.StateEventType.PROJECT_STATE_EVENT,
52
+ "action": enum_1.StateAction.GET_PROJECT_STATE,
53
+ }, enum_1.StateResponseType.GET_PROJECT_STATE_RESPONSE);
53
54
  },
54
55
  /**
55
56
  * Updates the project state on the server via WebSocket.
@@ -59,13 +60,13 @@ const cbstate = {
59
60
  */
60
61
  updateProjectState: async (key, value) => {
61
62
  return websocket_1.default.messageManager.sendAndWaitForResponse({
62
- "type": "projectStateEvent",
63
- "action": "updateProjectState",
63
+ "type": enum_1.StateEventType.PROJECT_STATE_EVENT,
64
+ "action": enum_1.StateAction.UPDATE_PROJECT_STATE,
64
65
  payload: {
65
66
  key,
66
67
  value
67
68
  }
68
- }, "updateProjectStateResponse");
69
+ }, enum_1.StateResponseType.UPDATE_PROJECT_STATE_RESPONSE);
69
70
  }
70
71
  };
71
72
  exports.default = cbstate;