@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,5 +1,5 @@
1
1
  import { EventEmitter } from 'events';
2
- import { CommandError, TerminalInterruptResponse } from '../types/socketMessageTypes';
2
+ import { CommandError, TerminalInterruptResponse } from '@codebolt/types/sdk';
3
3
  /**
4
4
  * CustomEventEmitter class that extends the Node.js EventEmitter class.
5
5
  */
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const websocket_1 = __importDefault(require("../core/websocket"));
7
7
  const events_1 = require("events");
8
+ const enum_1 = require("@codebolt/types/enum");
8
9
  /**
9
10
  * CustomEventEmitter class that extends the Node.js EventEmitter class.
10
11
  */
@@ -25,10 +26,10 @@ const cbterminal = {
25
26
  */
26
27
  executeCommand: async (command, returnEmptyStringOnSuccess = false) => {
27
28
  return websocket_1.default.messageManager.sendAndWaitForResponse({
28
- "type": "executeCommand",
29
+ "type": enum_1.TerminalEventType.EXECUTE_COMMAND,
29
30
  "message": command,
30
31
  returnEmptyStringOnSuccess
31
- }, "commandError|commandFinish");
32
+ }, enum_1.TerminalResponseType.COMMAND_ERROR_OR_FINISH);
32
33
  },
33
34
  /**
34
35
  * Executes a given command and keeps running until an error occurs.
@@ -39,10 +40,10 @@ const cbterminal = {
39
40
  */
40
41
  executeCommandRunUntilError: async (command, executeInMain = false) => {
41
42
  return websocket_1.default.messageManager.sendAndWaitForResponse({
42
- "type": "executeCommandRunUntilError",
43
+ "type": enum_1.TerminalEventType.EXECUTE_COMMAND_RUN_UNTIL_ERROR,
43
44
  "message": command,
44
45
  executeInMain
45
- }, "commandError");
46
+ }, enum_1.TerminalResponseType.COMMAND_ERROR);
46
47
  },
47
48
  /**
48
49
  * Sends a manual interrupt signal to the terminal.
@@ -51,8 +52,8 @@ const cbterminal = {
51
52
  */
52
53
  sendManualInterrupt() {
53
54
  return websocket_1.default.messageManager.sendAndWaitForResponse({
54
- "type": "sendInterruptToTerminal",
55
- }, "terminalInterrupted");
55
+ "type": enum_1.TerminalEventType.SEND_INTERRUPT_TO_TERMINAL,
56
+ }, enum_1.TerminalResponseType.TERMINAL_INTERRUPTED);
56
57
  },
57
58
  /**
58
59
  * Executes a given command and streams the output.
@@ -64,13 +65,13 @@ const cbterminal = {
64
65
  executeCommandWithStream(command, executeInMain = false) {
65
66
  // Send the process started message
66
67
  websocket_1.default.messageManager.send({
67
- "type": "executeCommandWithStream",
68
+ "type": enum_1.TerminalEventType.EXECUTE_COMMAND_WITH_STREAM,
68
69
  "message": command,
69
70
  executeInMain
70
71
  });
71
72
  // Listen for streaming messages through the message manager
72
73
  const handleStreamMessage = (response) => {
73
- if (response.type === "commandOutput" || response.type === "commandError" || response.type === "commandFinish") {
74
+ if (response.type === enum_1.TerminalResponseType.COMMAND_OUTPUT || response.type === enum_1.TerminalResponseType.COMMAND_ERROR || response.type === enum_1.TerminalResponseType.COMMAND_FINISH) {
74
75
  this.eventEmitter.emit(response.type, response);
75
76
  }
76
77
  };
@@ -83,9 +84,9 @@ const cbterminal = {
83
84
  streamEmitter.emit(eventType, data);
84
85
  });
85
86
  };
86
- forwardEvent('commandOutput');
87
- forwardEvent('commandError');
88
- forwardEvent('commandFinish');
87
+ forwardEvent(enum_1.TerminalResponseType.COMMAND_OUTPUT);
88
+ forwardEvent(enum_1.TerminalResponseType.COMMAND_ERROR);
89
+ forwardEvent(enum_1.TerminalResponseType.COMMAND_FINISH);
89
90
  // Add a cleanup method to remove the listener
90
91
  streamEmitter.cleanup = () => {
91
92
  websocket_1.default.messageManager.removeListener('message', handleStreamMessage);
@@ -1,4 +1,4 @@
1
- import { AddTokenResponse, GetTokenResponse } from '../types/socketMessageTypes';
1
+ import { AddTokenResponse, GetTokenResponse } from '@codebolt/types/sdk';
2
2
  /**
3
3
  * Tokenizer module for handling token-related operations.
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
  * Tokenizer module for handling token-related operations.
9
10
  */
@@ -15,12 +16,12 @@ const tokenizer = {
15
16
  */
16
17
  addToken: async (key) => {
17
18
  return websocket_1.default.messageManager.sendAndWaitForResponse({
18
- "type": "tokenizerEvent",
19
- "action": "addToken",
19
+ "type": enum_1.EventType.TOKENIZER_EVENT,
20
+ "action": enum_1.TokenizerAction.ADD_TOKEN,
20
21
  "message": {
21
22
  item: key
22
23
  },
23
- }, "addTokenResponse");
24
+ }, enum_1.TokenizerResponseType.ADD_TOKEN_RESPONSE);
24
25
  },
25
26
  /**
26
27
  * Retrieves a token from the system via WebSocket.
@@ -29,12 +30,12 @@ const tokenizer = {
29
30
  */
30
31
  getToken: async (key) => {
31
32
  return websocket_1.default.messageManager.sendAndWaitForResponse({
32
- "type": "tokenizerEvent",
33
- "action": "getToken",
33
+ "type": enum_1.EventType.TOKENIZER_EVENT,
34
+ "action": enum_1.TokenizerAction.GET_TOKEN,
34
35
  "message": {
35
36
  item: key
36
37
  },
37
- }, "getTokenResponse");
38
+ }, enum_1.TokenizerResponseType.GET_TOKEN_RESPONSE);
38
39
  }
39
40
  };
40
41
  exports.default = tokenizer;
@@ -0,0 +1,165 @@
1
+ /**
2
+ * @fileoverview Global User Message Manager for CodeBolt
3
+ * @description Automatically manages the current user message for agent integration
4
+ */
5
+ import type { FlatUserMessage, AgentProcessingConfig } from '@codebolt/types/sdk';
6
+ /**
7
+ * User processing configuration (alias for AgentProcessingConfig)
8
+ */
9
+ export type UserProcessingConfig = AgentProcessingConfig;
10
+ /**
11
+ * Global user message manager
12
+ */
13
+ declare class UserMessageManager {
14
+ private state;
15
+ /**
16
+ * Save user message (called automatically by onMessage)
17
+ *
18
+ * @param message - User message from onMessage
19
+ * @param config - Optional processing configuration
20
+ */
21
+ saveMessage(message: FlatUserMessage, config?: UserProcessingConfig): void;
22
+ /**
23
+ * Get current user message
24
+ *
25
+ * @returns Current user message or undefined
26
+ */
27
+ getMessage(): FlatUserMessage | undefined;
28
+ /**
29
+ * Get user processing configuration
30
+ *
31
+ * @returns User processing configuration
32
+ */
33
+ getConfig(): UserProcessingConfig;
34
+ /**
35
+ * Get mentioned MCPs from current message
36
+ *
37
+ * @returns Array of mentioned MCP tools
38
+ */
39
+ getMentionedMCPs(): string[];
40
+ /**
41
+ * Get mentioned files from current message
42
+ *
43
+ * @returns Array of mentioned file paths
44
+ */
45
+ getMentionedFiles(): string[];
46
+ /**
47
+ * Get mentioned folders from current message
48
+ *
49
+ * @returns Array of mentioned folder paths
50
+ */
51
+ getMentionedFolders(): string[];
52
+ /**
53
+ * Get mentioned agents from current message
54
+ *
55
+ * @returns Array of mentioned agents
56
+ */
57
+ getMentionedAgents(): any[];
58
+ /**
59
+ * Get remix prompt from current message
60
+ *
61
+ * @returns Remix prompt string or undefined
62
+ */
63
+ getRemixPrompt(): string | undefined;
64
+ /**
65
+ * Get uploaded images from current message
66
+ *
67
+ * @returns Array of uploaded images
68
+ */
69
+ getUploadedImages(): any[];
70
+ /**
71
+ * Get current file from current message
72
+ *
73
+ * @returns Current file path or undefined
74
+ */
75
+ getCurrentFile(): string | undefined;
76
+ /**
77
+ * Get text selection from current message
78
+ *
79
+ * @returns Text selection or undefined
80
+ */
81
+ getSelection(): string | undefined;
82
+ /**
83
+ * Get message ID
84
+ *
85
+ * @returns Message ID or undefined
86
+ */
87
+ getMessageId(): string | undefined;
88
+ /**
89
+ * Get thread ID
90
+ *
91
+ * @returns Thread ID or undefined
92
+ */
93
+ getThreadId(): string | undefined;
94
+ /**
95
+ * Check if a specific processing type is enabled
96
+ *
97
+ * @param type - Processing type to check
98
+ * @returns Whether the processing type is enabled
99
+ */
100
+ isProcessingEnabled(type: keyof UserProcessingConfig): boolean;
101
+ /**
102
+ * Set session data
103
+ *
104
+ * @param key - Session data key
105
+ * @param value - Session data value
106
+ */
107
+ setSessionData(key: string, value: any): void;
108
+ /**
109
+ * Get session data
110
+ *
111
+ * @param key - Session data key
112
+ * @returns Session data value
113
+ */
114
+ getSessionData(key: string): any;
115
+ /**
116
+ * Clear all user message state
117
+ */
118
+ clear(): void;
119
+ /**
120
+ * Get current message text content
121
+ *
122
+ * @returns User message text
123
+ */
124
+ getMessageText(): string;
125
+ /**
126
+ * Get message timestamp
127
+ *
128
+ * @returns Timestamp when message was saved
129
+ */
130
+ getTimestamp(): string | undefined;
131
+ /**
132
+ * Update processing configuration
133
+ *
134
+ * @param config - New processing configuration
135
+ */
136
+ updateConfig(config: Partial<UserProcessingConfig>): void;
137
+ /**
138
+ * Check if there's a current message
139
+ *
140
+ * @returns Whether there's a current message
141
+ */
142
+ hasMessage(): boolean;
143
+ }
144
+ declare const userMessageManager: UserMessageManager;
145
+ export { userMessageManager };
146
+ export declare function getCurrentUserMessage(): FlatUserMessage | undefined;
147
+ export declare function getUserMessageText(): string;
148
+ export declare function getUserProcessingConfig(): UserProcessingConfig;
149
+ export declare function getMentionedMCPs(): string[];
150
+ export declare function getMentionedFiles(): string[];
151
+ export declare function getMentionedFolders(): string[];
152
+ export declare function getMentionedAgents(): any[];
153
+ export declare function getRemixPrompt(): string | undefined;
154
+ export declare function getUploadedImages(): any[];
155
+ export declare function getCurrentFile(): string | undefined;
156
+ export declare function getSelection(): string | undefined;
157
+ export declare function getMessageId(): string | undefined;
158
+ export declare function getThreadId(): string | undefined;
159
+ export declare function isUserProcessingEnabled(type: keyof UserProcessingConfig): boolean;
160
+ export declare function setUserSessionData(key: string, value: any): void;
161
+ export declare function getUserSessionData(key: string): any;
162
+ export declare function clearUserMessage(): void;
163
+ export declare function getUserMessageTimestamp(): string | undefined;
164
+ export declare function updateUserProcessingConfig(config: Partial<UserProcessingConfig>): void;
165
+ export declare function hasCurrentUserMessage(): boolean;
@@ -0,0 +1,308 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Global User Message Manager for CodeBolt
4
+ * @description Automatically manages the current user message for agent integration
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.userMessageManager = void 0;
8
+ exports.getCurrentUserMessage = getCurrentUserMessage;
9
+ exports.getUserMessageText = getUserMessageText;
10
+ exports.getUserProcessingConfig = getUserProcessingConfig;
11
+ exports.getMentionedMCPs = getMentionedMCPs;
12
+ exports.getMentionedFiles = getMentionedFiles;
13
+ exports.getMentionedFolders = getMentionedFolders;
14
+ exports.getMentionedAgents = getMentionedAgents;
15
+ exports.getRemixPrompt = getRemixPrompt;
16
+ exports.getUploadedImages = getUploadedImages;
17
+ exports.getCurrentFile = getCurrentFile;
18
+ exports.getSelection = getSelection;
19
+ exports.getMessageId = getMessageId;
20
+ exports.getThreadId = getThreadId;
21
+ exports.isUserProcessingEnabled = isUserProcessingEnabled;
22
+ exports.setUserSessionData = setUserSessionData;
23
+ exports.getUserSessionData = getUserSessionData;
24
+ exports.clearUserMessage = clearUserMessage;
25
+ exports.getUserMessageTimestamp = getUserMessageTimestamp;
26
+ exports.updateUserProcessingConfig = updateUserProcessingConfig;
27
+ exports.hasCurrentUserMessage = hasCurrentUserMessage;
28
+ /**
29
+ * Global user message manager
30
+ */
31
+ class UserMessageManager {
32
+ constructor() {
33
+ this.state = {};
34
+ }
35
+ /**
36
+ * Save user message (called automatically by onMessage)
37
+ *
38
+ * @param message - User message from onMessage
39
+ * @param config - Optional processing configuration
40
+ */
41
+ saveMessage(message, config) {
42
+ var _a, _b, _c, _d;
43
+ this.state.currentMessage = message;
44
+ this.state.timestamp = new Date().toISOString();
45
+ // Auto-detect configuration from message if not explicitly provided
46
+ if (config) {
47
+ this.state.userConfig = { ...config };
48
+ }
49
+ else {
50
+ this.state.userConfig = {
51
+ processMentionedMCPs: ((_a = message.mentionedMCPs) === null || _a === void 0 ? void 0 : _a.length) > 0,
52
+ processRemixPrompt: !!message.remixPrompt,
53
+ processMentionedFiles: (((_b = message.mentionedFiles) === null || _b === void 0 ? void 0 : _b.length) > 0) || (((_c = message.mentionedFullPaths) === null || _c === void 0 ? void 0 : _c.length) > 0),
54
+ processMentionedAgents: ((_d = message.mentionedAgents) === null || _d === void 0 ? void 0 : _d.length) > 0
55
+ };
56
+ }
57
+ }
58
+ /**
59
+ * Get current user message
60
+ *
61
+ * @returns Current user message or undefined
62
+ */
63
+ getMessage() {
64
+ return this.state.currentMessage;
65
+ }
66
+ /**
67
+ * Get user processing configuration
68
+ *
69
+ * @returns User processing configuration
70
+ */
71
+ getConfig() {
72
+ return this.state.userConfig || {};
73
+ }
74
+ /**
75
+ * Get mentioned MCPs from current message
76
+ *
77
+ * @returns Array of mentioned MCP tools
78
+ */
79
+ getMentionedMCPs() {
80
+ var _a;
81
+ return ((_a = this.state.currentMessage) === null || _a === void 0 ? void 0 : _a.mentionedMCPs) || [];
82
+ }
83
+ /**
84
+ * Get mentioned files from current message
85
+ *
86
+ * @returns Array of mentioned file paths
87
+ */
88
+ getMentionedFiles() {
89
+ var _a, _b;
90
+ const files = ((_a = this.state.currentMessage) === null || _a === void 0 ? void 0 : _a.mentionedFiles) || [];
91
+ const fullPaths = ((_b = this.state.currentMessage) === null || _b === void 0 ? void 0 : _b.mentionedFullPaths) || [];
92
+ return [...files, ...fullPaths];
93
+ }
94
+ /**
95
+ * Get mentioned folders from current message
96
+ *
97
+ * @returns Array of mentioned folder paths
98
+ */
99
+ getMentionedFolders() {
100
+ var _a;
101
+ return ((_a = this.state.currentMessage) === null || _a === void 0 ? void 0 : _a.mentionedFolders) || [];
102
+ }
103
+ /**
104
+ * Get mentioned agents from current message
105
+ *
106
+ * @returns Array of mentioned agents
107
+ */
108
+ getMentionedAgents() {
109
+ var _a;
110
+ return ((_a = this.state.currentMessage) === null || _a === void 0 ? void 0 : _a.mentionedAgents) || [];
111
+ }
112
+ /**
113
+ * Get remix prompt from current message
114
+ *
115
+ * @returns Remix prompt string or undefined
116
+ */
117
+ getRemixPrompt() {
118
+ var _a;
119
+ return (_a = this.state.currentMessage) === null || _a === void 0 ? void 0 : _a.remixPrompt;
120
+ }
121
+ /**
122
+ * Get uploaded images from current message
123
+ *
124
+ * @returns Array of uploaded images
125
+ */
126
+ getUploadedImages() {
127
+ var _a;
128
+ return ((_a = this.state.currentMessage) === null || _a === void 0 ? void 0 : _a.uploadedImages) || [];
129
+ }
130
+ /**
131
+ * Get current file from current message
132
+ *
133
+ * @returns Current file path or undefined
134
+ */
135
+ getCurrentFile() {
136
+ var _a;
137
+ return (_a = this.state.currentMessage) === null || _a === void 0 ? void 0 : _a.currentFile;
138
+ }
139
+ /**
140
+ * Get text selection from current message
141
+ *
142
+ * @returns Text selection or undefined
143
+ */
144
+ getSelection() {
145
+ var _a;
146
+ return (_a = this.state.currentMessage) === null || _a === void 0 ? void 0 : _a.selection;
147
+ }
148
+ /**
149
+ * Get message ID
150
+ *
151
+ * @returns Message ID or undefined
152
+ */
153
+ getMessageId() {
154
+ var _a;
155
+ return (_a = this.state.currentMessage) === null || _a === void 0 ? void 0 : _a.messageId;
156
+ }
157
+ /**
158
+ * Get thread ID
159
+ *
160
+ * @returns Thread ID or undefined
161
+ */
162
+ getThreadId() {
163
+ var _a;
164
+ return (_a = this.state.currentMessage) === null || _a === void 0 ? void 0 : _a.threadId;
165
+ }
166
+ /**
167
+ * Check if a specific processing type is enabled
168
+ *
169
+ * @param type - Processing type to check
170
+ * @returns Whether the processing type is enabled
171
+ */
172
+ isProcessingEnabled(type) {
173
+ var _a;
174
+ const value = (_a = this.state.userConfig) === null || _a === void 0 ? void 0 : _a[type];
175
+ if (typeof value === 'function') {
176
+ return true; // If a function is provided, consider it enabled
177
+ }
178
+ return Boolean(value);
179
+ }
180
+ /**
181
+ * Set session data
182
+ *
183
+ * @param key - Session data key
184
+ * @param value - Session data value
185
+ */
186
+ setSessionData(key, value) {
187
+ if (!this.state.sessionData) {
188
+ this.state.sessionData = {};
189
+ }
190
+ this.state.sessionData[key] = value;
191
+ }
192
+ /**
193
+ * Get session data
194
+ *
195
+ * @param key - Session data key
196
+ * @returns Session data value
197
+ */
198
+ getSessionData(key) {
199
+ var _a;
200
+ return (_a = this.state.sessionData) === null || _a === void 0 ? void 0 : _a[key];
201
+ }
202
+ /**
203
+ * Clear all user message state
204
+ */
205
+ clear() {
206
+ this.state = {};
207
+ }
208
+ /**
209
+ * Get current message text content
210
+ *
211
+ * @returns User message text
212
+ */
213
+ getMessageText() {
214
+ var _a;
215
+ return ((_a = this.state.currentMessage) === null || _a === void 0 ? void 0 : _a.userMessage) || '';
216
+ }
217
+ /**
218
+ * Get message timestamp
219
+ *
220
+ * @returns Timestamp when message was saved
221
+ */
222
+ getTimestamp() {
223
+ return this.state.timestamp;
224
+ }
225
+ /**
226
+ * Update processing configuration
227
+ *
228
+ * @param config - New processing configuration
229
+ */
230
+ updateConfig(config) {
231
+ this.state.userConfig = {
232
+ ...this.state.userConfig,
233
+ ...config
234
+ };
235
+ }
236
+ /**
237
+ * Check if there's a current message
238
+ *
239
+ * @returns Whether there's a current message
240
+ */
241
+ hasMessage() {
242
+ return !!this.state.currentMessage;
243
+ }
244
+ }
245
+ // Global singleton instance
246
+ const userMessageManager = new UserMessageManager();
247
+ exports.userMessageManager = userMessageManager;
248
+ // Export utility functions for public API
249
+ function getCurrentUserMessage() {
250
+ return userMessageManager.getMessage();
251
+ }
252
+ function getUserMessageText() {
253
+ return userMessageManager.getMessageText();
254
+ }
255
+ function getUserProcessingConfig() {
256
+ return userMessageManager.getConfig();
257
+ }
258
+ function getMentionedMCPs() {
259
+ return userMessageManager.getMentionedMCPs();
260
+ }
261
+ function getMentionedFiles() {
262
+ return userMessageManager.getMentionedFiles();
263
+ }
264
+ function getMentionedFolders() {
265
+ return userMessageManager.getMentionedFolders();
266
+ }
267
+ function getMentionedAgents() {
268
+ return userMessageManager.getMentionedAgents();
269
+ }
270
+ function getRemixPrompt() {
271
+ return userMessageManager.getRemixPrompt();
272
+ }
273
+ function getUploadedImages() {
274
+ return userMessageManager.getUploadedImages();
275
+ }
276
+ function getCurrentFile() {
277
+ return userMessageManager.getCurrentFile();
278
+ }
279
+ function getSelection() {
280
+ return userMessageManager.getSelection();
281
+ }
282
+ function getMessageId() {
283
+ return userMessageManager.getMessageId();
284
+ }
285
+ function getThreadId() {
286
+ return userMessageManager.getThreadId();
287
+ }
288
+ function isUserProcessingEnabled(type) {
289
+ return userMessageManager.isProcessingEnabled(type);
290
+ }
291
+ function setUserSessionData(key, value) {
292
+ userMessageManager.setSessionData(key, value);
293
+ }
294
+ function getUserSessionData(key) {
295
+ return userMessageManager.getSessionData(key);
296
+ }
297
+ function clearUserMessage() {
298
+ userMessageManager.clear();
299
+ }
300
+ function getUserMessageTimestamp() {
301
+ return userMessageManager.getTimestamp();
302
+ }
303
+ function updateUserProcessingConfig(config) {
304
+ userMessageManager.updateConfig(config);
305
+ }
306
+ function hasCurrentUserMessage() {
307
+ return userMessageManager.hasMessage();
308
+ }