imcp 0.0.12 → 0.0.14

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 (81) hide show
  1. package/dist/core/ConfigurationProvider.d.ts +2 -1
  2. package/dist/core/ConfigurationProvider.js +20 -24
  3. package/dist/core/InstallationService.d.ts +17 -0
  4. package/dist/core/InstallationService.js +127 -61
  5. package/dist/core/MCPManager.d.ts +1 -0
  6. package/dist/core/MCPManager.js +3 -0
  7. package/dist/core/RequirementService.d.ts +4 -4
  8. package/dist/core/RequirementService.js +11 -7
  9. package/dist/core/ServerSchemaProvider.d.ts +1 -1
  10. package/dist/core/ServerSchemaProvider.js +15 -10
  11. package/dist/core/constants.d.ts +3 -0
  12. package/dist/core/constants.js +4 -1
  13. package/dist/core/installers/clients/ClientInstaller.js +58 -40
  14. package/dist/core/installers/requirements/PipInstaller.js +10 -5
  15. package/dist/core/onboard/FeedOnboardService.d.ts +35 -0
  16. package/dist/core/onboard/FeedOnboardService.js +137 -0
  17. package/dist/core/types.d.ts +6 -1
  18. package/dist/core/validators/FeedValidator.d.ts +13 -0
  19. package/dist/core/validators/FeedValidator.js +27 -0
  20. package/dist/services/ServerService.d.ts +5 -0
  21. package/dist/services/ServerService.js +15 -0
  22. package/dist/utils/githubAuth.js +0 -10
  23. package/dist/utils/githubUtils.d.ts +16 -0
  24. package/dist/utils/githubUtils.js +55 -39
  25. package/dist/web/contract/serverContract.d.ts +64 -0
  26. package/dist/web/contract/serverContract.js +2 -0
  27. package/dist/web/public/css/detailsWidget.css +157 -32
  28. package/dist/web/public/css/onboard.css +44 -0
  29. package/dist/web/public/css/serverDetails.css +35 -19
  30. package/dist/web/public/index.html +16 -10
  31. package/dist/web/public/js/detailsWidget.js +43 -40
  32. package/dist/web/public/js/modal/index.js +58 -0
  33. package/dist/web/public/js/modal/installHandler.js +227 -0
  34. package/dist/web/public/js/modal/installModal.js +163 -0
  35. package/dist/web/public/js/modal/installation.js +281 -0
  36. package/dist/web/public/js/modal/loadingModal.js +52 -0
  37. package/dist/web/public/js/modal/loadingUI.js +74 -0
  38. package/dist/web/public/js/modal/messageQueue.js +112 -0
  39. package/dist/web/public/js/modal/modalSetup.js +512 -0
  40. package/dist/web/public/js/modal/modalUI.js +214 -0
  41. package/dist/web/public/js/modal/modalUtils.js +49 -0
  42. package/dist/web/public/js/modal/version.js +20 -0
  43. package/dist/web/public/js/modal/versionUtils.js +20 -0
  44. package/dist/web/public/js/modal.js +25 -1041
  45. package/dist/web/public/js/onboard/formProcessor.js +309 -0
  46. package/dist/web/public/js/onboard/index.js +131 -0
  47. package/dist/web/public/js/onboard/state.js +32 -0
  48. package/dist/web/public/js/onboard/templates.js +375 -0
  49. package/dist/web/public/js/onboard/uiHandlers.js +196 -0
  50. package/dist/web/public/js/serverCategoryDetails.js +211 -123
  51. package/dist/web/public/onboard.html +150 -0
  52. package/dist/web/server.js +25 -0
  53. package/package.json +3 -4
  54. package/src/core/ConfigurationProvider.ts +37 -29
  55. package/src/core/InstallationService.ts +176 -62
  56. package/src/core/MCPManager.ts +4 -0
  57. package/src/core/RequirementService.ts +12 -8
  58. package/src/core/ServerSchemaLoader.ts +48 -0
  59. package/src/core/ServerSchemaProvider.ts +137 -0
  60. package/src/core/constants.ts +4 -1
  61. package/src/core/installers/clients/ClientInstaller.ts +66 -49
  62. package/src/core/installers/requirements/PipInstaller.ts +10 -5
  63. package/src/core/types.ts +6 -1
  64. package/src/services/ServerService.ts +15 -0
  65. package/src/utils/githubAuth.ts +14 -27
  66. package/src/utils/githubUtils.ts +84 -47
  67. package/src/web/public/css/detailsWidget.css +235 -0
  68. package/src/web/public/css/serverDetails.css +126 -0
  69. package/src/web/public/index.html +16 -10
  70. package/src/web/public/js/detailsWidget.js +264 -0
  71. package/src/web/public/js/modal/index.js +58 -0
  72. package/src/web/public/js/modal/installModal.js +163 -0
  73. package/src/web/public/js/modal/installation.js +281 -0
  74. package/src/web/public/js/modal/loadingModal.js +52 -0
  75. package/src/web/public/js/modal/messageQueue.js +112 -0
  76. package/src/web/public/js/modal/modalSetup.js +512 -0
  77. package/src/web/public/js/modal/modalUtils.js +49 -0
  78. package/src/web/public/js/modal/versionUtils.js +20 -0
  79. package/src/web/public/js/modal.js +25 -1041
  80. package/src/web/public/js/serverCategoryDetails.js +211 -123
  81. package/src/web/server.ts +31 -0
@@ -0,0 +1,281 @@
1
+ import { delayedAppendInstallLoadingMessage } from './messageQueue.js';
2
+ import { showInstallLoadingModal } from './loadingModal.js';
3
+ import { showToast } from '../notifications.js';
4
+
5
+ /**
6
+ * Handle bulk client installations
7
+ * @param {string} categoryName - The category name
8
+ * @param {string} serverName - The server name
9
+ * @param {string[]} targets - Target clients
10
+ * @param {Object} envVars - Environment variables
11
+ * @param {string} installingMessage - Installation message
12
+ * @param {Object} serverData - Server data
13
+ * @param {Object} serverInstallOptions - Server installation options
14
+ */
15
+ export async function handleBulkClientInstall(categoryName, serverName, targets, envVars = {}, installingMessage = "Starting installation...", serverData = null, serverInstallOptions = null) {
16
+ console.log('[LoadingModal] handleBulkClientInstall called', { categoryName, serverName, targets, envVars, serverInstallOptions });
17
+ // Hide install modal, show loading modal
18
+ const installModal = document.getElementById('installModal');
19
+ console.log('[LoadingModal] installModal:', installModal);
20
+ if (installModal) installModal.style.display = "none";
21
+
22
+ // If serverData is provided, extract the installing message from it (latest status)
23
+ if (serverData?.data?.installationStatus?.serversStatus) {
24
+ const serverStatuses = serverData.data.installationStatus.serversStatus;
25
+ const serverStatus = serverStatuses[serverName] || { installedStatus: {} };
26
+ if (targets?.length > 0) {
27
+ const target = targets[0];
28
+ const msg = serverStatus.installedStatus?.[target]?.message;
29
+ if (msg) installingMessage = msg;
30
+ }
31
+ // Append the installing message for user visibility
32
+ if (installingMessage && installingMessage !== "Starting installation...") {
33
+ delayedAppendInstallLoadingMessage(installingMessage);
34
+ }
35
+ }
36
+
37
+ showInstallLoadingModal();
38
+ delayedAppendInstallLoadingMessage(installingMessage);
39
+
40
+ try {
41
+ delayedAppendInstallLoadingMessage("Installing, please wait...");
42
+
43
+ // Use serverInstallOptions if provided, otherwise build the traditional options
44
+ const requestBody = {
45
+ serverList: {
46
+ [serverName]: serverInstallOptions || {
47
+ targetClients: targets,
48
+ env: envVars
49
+ }
50
+ }
51
+ };
52
+
53
+ const response = await fetch(`/api/categories/${categoryName}/install`, {
54
+ method: 'POST',
55
+ headers: {
56
+ 'Content-Type': 'application/json',
57
+ 'Accept': 'application/json'
58
+ },
59
+ body: JSON.stringify(requestBody)
60
+ });
61
+
62
+ console.log('[LoadingModal] fetch install response:', response);
63
+
64
+ if (!response.ok) {
65
+ const errorData = await response.text();
66
+ delayedAppendInstallLoadingMessage(`<span style="color:#f59e0b;">Failed: ${errorData || response.statusText}</span>`);
67
+ console.error('[LoadingModal] Failed:', errorData || response.statusText);
68
+ throw new Error(`Installation failed: ${errorData || response.statusText}`);
69
+ }
70
+
71
+ const result = await response.json();
72
+ console.log('[LoadingModal] install result:', result);
73
+ if (!result.success) {
74
+ delayedAppendInstallLoadingMessage(`<span style="color:#f59e0b;">${result.error || 'Operation failed'}</span>`);
75
+ console.error('[LoadingModal] Error:', result.error || 'Operation failed');
76
+ throw new Error(result.error || 'Installation failed');
77
+ }
78
+
79
+ // Start polling for install status, pass requirements if available
80
+ const requirements = serverInstallOptions?.requirements || [];
81
+ pollInstallStatus(categoryName, serverName, targets, 2000, requirements);
82
+ } catch (error) {
83
+ console.error('[LoadingModal] Error applying configuration:', error);
84
+ delayedAppendInstallLoadingMessage(`<span style="color:red;">Error: ${error.message}</span>`);
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Poll install status for the given server/targets and optional requirements
90
+ * @param {string} categoryName - The category name
91
+ * @param {string} serverName - The server name
92
+ * @param {string[]} targets - Target clients
93
+ * @param {number} interval - Polling interval in milliseconds
94
+ * @param {Array} requirements - Requirements to check
95
+ */
96
+ async function pollInstallStatus(categoryName, serverName, targets, interval = 2000, requirements = []) {
97
+ let lastMessages = {};
98
+ let lastRequirementMessages = {};
99
+ let lastReqirementErrorMessages = {};
100
+ let completionMessageSent = false;
101
+
102
+ const startTime = Date.now();
103
+ const maxTimeout = 10 * 60 * 1000; // 10 minutes in milliseconds
104
+
105
+ while (Date.now() - startTime < maxTimeout) {
106
+ try {
107
+ const resp = await fetch(`/api/categories/${categoryName}`);
108
+ if (resp.ok) {
109
+ const data = await resp.json();
110
+ // If requirements is empty and we have targets, get requirements from server's dependencies
111
+ if (requirements.length === 0 && targets?.length > 0) {
112
+ const feedConfig = data?.data?.feedConfiguration;
113
+ if (feedConfig?.mcpServers) {
114
+ const server = feedConfig.mcpServers.find(s => s.name === serverName);
115
+ if (server?.dependencies?.requirements) {
116
+ requirements = server.dependencies.requirements;
117
+ }
118
+ }
119
+ }
120
+ const installationStatus = data?.data?.installationStatus || {};
121
+ const serverStatuses = installationStatus.serversStatus || {};
122
+ const requirementsStatus = installationStatus.requirementsStatus || {};
123
+ const serverStatus = serverStatuses[serverName] || { installedStatus: {} };
124
+
125
+ // First check requirements status if we have any
126
+ let allRequirementsCompleted = true;
127
+ let hasRequirements = requirements.length > 0;
128
+
129
+ for (const req of requirements) {
130
+ const reqStatus = requirementsStatus[req.name] || {};
131
+ if (reqStatus.installed === true && !reqStatus.operationStatus) {
132
+ const msg = `Requirement [${req.name}] already installed.`;
133
+ if (msg && lastRequirementMessages[req.name] !== msg) {
134
+ delayedAppendInstallLoadingMessage(msg);
135
+ lastRequirementMessages[req.name] = msg;
136
+ }
137
+ continue;
138
+ }
139
+ const opStatus = reqStatus.operationStatus || {};
140
+ const msg = opStatus.message;
141
+ const status = opStatus.status;
142
+
143
+ // Only append new messages for requirements
144
+ if (msg && lastRequirementMessages[req.name] !== msg) {
145
+ delayedAppendInstallLoadingMessage(`${req.name}: ${msg}`);
146
+ lastRequirementMessages[req.name] = msg;
147
+ }
148
+
149
+ if (status !== "completed" && status !== "failed") {
150
+ allRequirementsCompleted = false;
151
+ }
152
+
153
+ // If a requirement failed, show an error
154
+ if (status === "failed") {
155
+ if (lastReqirementErrorMessages[req.name] !== reqStatus.error) {
156
+ delayedAppendInstallLoadingMessage(`${req.name} failed: ${reqStatus.error}`);
157
+ lastReqirementErrorMessages[req.name] = reqStatus.error;
158
+ }
159
+ if (lastRequirementMessages[req.name] !== msg) {
160
+ delayedAppendInstallLoadingMessage(`<span style="color:#f59e0b;">${req.name}: Update failed - ${msg || 'Unknown error'}</span>`);
161
+ }
162
+ }
163
+ }
164
+
165
+ // Now check target statuses
166
+ let allTargetsCompleted = true;
167
+ let hasTargets = targets && targets.length > 0;
168
+
169
+ if (hasTargets) {
170
+ for (const target of targets) {
171
+ const status = serverStatus.installedStatus?.[target]?.status;
172
+ const msg = serverStatus.installedStatus?.[target]?.message;
173
+ // Only append new messages for targets, making output more compact
174
+ if (msg && lastMessages[target] !== msg) {
175
+ delayedAppendInstallLoadingMessage(`${target}: ${msg}`);
176
+ lastMessages[target] = msg;
177
+ }
178
+ if (status !== "completed") {
179
+ allTargetsCompleted = false;
180
+ }
181
+ }
182
+ }
183
+
184
+ // Complete if all operations are done
185
+ const allCompleted = (!hasRequirements || allRequirementsCompleted) &&
186
+ (!hasTargets || allTargetsCompleted);
187
+
188
+ if (allCompleted && !completionMessageSent) {
189
+ completionMessageSent = true;
190
+
191
+ // Compose completion message
192
+ const completionMessage = hasRequirements && hasTargets ?
193
+ `Updated requirements and configured ${targets.length} client(s)` :
194
+ hasRequirements ? 'Requirements updated' :
195
+ hasTargets ? `Configured ${targets.length} client(s)` :
196
+ 'Operation completed';
197
+
198
+ console.log('[LoadingModal] Completed:', completionMessage);
199
+ delayedAppendInstallLoadingMessage(`<span style="color:green;">${completionMessage}</span>`, true);
200
+
201
+ // Give time for message queue to process before returning
202
+ await new Promise(resolve => setTimeout(resolve, 1500));
203
+ return;
204
+ }
205
+ }
206
+ } catch (error) {
207
+ console.error('[LoadingModal] Error polling status:', error);
208
+ }
209
+ await new Promise(resolve => setTimeout(resolve, interval)); // 2 second interval
210
+ }
211
+
212
+ // If we reach here, we've timed out
213
+ console.error('[LoadingModal] Operation timed out after 10 minutes');
214
+
215
+ // On timeout, show timeout message but don't auto-close
216
+ if (!completionMessageSent) {
217
+ delayedAppendInstallLoadingMessage(`<span style="color:#f59e0b;">Operation timed out - Please refresh the page</span>`, true);
218
+ }
219
+ }
220
+
221
+ /**
222
+ * Handle client uninstallation for multiple targets
223
+ * @param {string} categoryName - The category name
224
+ * @param {Object} serverList - List of servers to uninstall
225
+ * @param {string[]} targets - Target clients
226
+ */
227
+ export async function uninstallTools(categoryName, serverList, targets) {
228
+ // Get selected targets from window.selectedClients or the provided targets
229
+ const selectedTargets = window.selectedClients || (Array.isArray(targets) ? targets : [targets]);
230
+
231
+ // Validate selected targets
232
+ if (!selectedTargets || selectedTargets.length === 0) {
233
+ showToast('Please select at least one client to uninstall.', 'error');
234
+ return;
235
+ }
236
+
237
+ try {
238
+ delayedAppendInstallLoadingMessage('Starting uninstallation...');
239
+
240
+ // Ensure serverList is an object where each key is a server name
241
+ if (Array.isArray(serverList)) {
242
+ const formattedServerList = {};
243
+ serverList.forEach(server => {
244
+ formattedServerList[server] = { removeData: true };
245
+ });
246
+ serverList = formattedServerList;
247
+ }
248
+
249
+ const response = await fetch(`/api/categories/${categoryName}/uninstall`, {
250
+ method: 'POST',
251
+ headers: { 'Content-Type': 'application/json' },
252
+ body: JSON.stringify({
253
+ serverList: serverList,
254
+ options: {
255
+ targets: selectedTargets,
256
+ removeData: true
257
+ }
258
+ })
259
+ });
260
+
261
+ if (!response.ok) {
262
+ const errorData = await response.text();
263
+ throw new Error(`Uninstallation failed: ${errorData || response.statusText}`);
264
+ }
265
+
266
+ const result = await response.json();
267
+ if (!result.success) {
268
+ throw new Error(result.error || 'Uninstallation failed');
269
+ }
270
+
271
+ // Add completion message and trigger completion UI
272
+ delayedAppendInstallLoadingMessage(`Successfully uninstalled from ${selectedTargets.join(', ')}`, true);
273
+
274
+ // Clear selected clients after successful uninstall
275
+ window.selectedClients = [];
276
+ } catch (error) {
277
+ console.error('Error uninstalling tools:', error);
278
+ delayedAppendInstallLoadingMessage(`Error: ${error.message}`, true);
279
+ showToast(`Error uninstalling tools: ${error.message}`, 'error');
280
+ }
281
+ }
@@ -0,0 +1,52 @@
1
+ import { delayedAppendInstallLoadingMessage } from './messageQueue.js';
2
+
3
+ /**
4
+ * Display the installation loading modal and prepare it for messages.
5
+ * @param {string} [operation='Installing'] - The operation being performed
6
+ */
7
+ export function showInstallLoadingModal(operation = 'Installing') {
8
+ const loadingModal = document.getElementById('installLoadingModal');
9
+ const loadingMsg = document.getElementById('installLoadingMessage');
10
+ const loadingTitle = document.querySelector('.loading-title');
11
+ if (loadingModal && loadingMsg && loadingTitle) {
12
+ loadingModal.style.display = 'block';
13
+ loadingMsg.innerHTML = '';
14
+ loadingTitle.textContent = `${operation}...`;
15
+ } else {
16
+ console.error('[LoadingModal] Required elements not found: installLoadingModal, installLoadingMessage, or loading-title');
17
+ }
18
+ }
19
+
20
+ /**
21
+ * Append a message to the loading modal display.
22
+ * @param {string} message - The message to display
23
+ */
24
+ export function appendInstallLoadingMessage(message) {
25
+ console.log(`[LoadingModal] Message: ${message}`);
26
+ delayedAppendInstallLoadingMessage(message);
27
+ }
28
+
29
+ /**
30
+ * Hide the install loading modal.
31
+ */
32
+ export function hideInstallLoadingModal() {
33
+ console.log('[LoadingModal] Hiding installation modal');
34
+ const loadingModal = document.getElementById('installLoadingModal');
35
+ if (loadingModal) {
36
+ loadingModal.style.display = 'none';
37
+
38
+ // Get the last selected category
39
+ const lastSelected = localStorage.getItem('lastSelectedCategory');
40
+
41
+ // Refresh page while maintaining category selection
42
+ setTimeout(() => {
43
+ if (lastSelected) {
44
+ window.location.href = window.location.pathname + '?category=' + encodeURIComponent(lastSelected);
45
+ } else {
46
+ location.reload();
47
+ }
48
+ }, 100);
49
+ } else {
50
+ console.error('[LoadingModal] loading modal DOM not found');
51
+ }
52
+ }
@@ -0,0 +1,74 @@
1
+ import { queueMessage } from './messageQueue.js';
2
+
3
+ /**
4
+ * Display the installation loading modal and prepare it for messages
5
+ * @param {string} operation Operation name to display
6
+ */
7
+ export function showLoadingModal(operation = 'Installing') {
8
+ const elements = getLoadingElements();
9
+ if (!elements) {
10
+ console.error('[LoadingModal] Required elements not found');
11
+ return;
12
+ }
13
+
14
+ elements.modal.style.display = 'block';
15
+ elements.messageContainer.innerHTML = '';
16
+ elements.title.textContent = `${operation}...`;
17
+ }
18
+
19
+ /**
20
+ * Hide the installation loading modal
21
+ */
22
+ export function hideLoadingModal() {
23
+ const modal = document.getElementById('installLoadingModal');
24
+ if (!modal) {
25
+ console.error('[LoadingModal] Loading modal not found');
26
+ return;
27
+ }
28
+
29
+ modal.style.display = 'none';
30
+ refreshPageWithCategory();
31
+ }
32
+
33
+ /**
34
+ * Append a message to the loading modal
35
+ * @param {string} message Message to display
36
+ * @param {boolean} isCompletion Whether this is a completion message
37
+ */
38
+ export function appendLoadingMessage(message, isCompletion = false) {
39
+ queueMessage(message, isCompletion);
40
+ }
41
+
42
+ /**
43
+ * Get the loading modal elements
44
+ * @private
45
+ * @returns {Object|null} Object containing modal elements or null if not found
46
+ */
47
+ function getLoadingElements() {
48
+ const modal = document.getElementById('installLoadingModal');
49
+ const messageContainer = document.getElementById('installLoadingMessage');
50
+ const title = document.querySelector('.loading-title');
51
+
52
+ if (!modal || !messageContainer || !title) {
53
+ return null;
54
+ }
55
+
56
+ return { modal, messageContainer, title };
57
+ }
58
+
59
+ /**
60
+ * Refresh the page maintaining category selection
61
+ * @private
62
+ */
63
+ function refreshPageWithCategory() {
64
+ const lastSelected = localStorage.getItem('lastSelectedCategory');
65
+
66
+ setTimeout(() => {
67
+ if (lastSelected) {
68
+ window.location.href = window.location.pathname +
69
+ '?category=' + encodeURIComponent(lastSelected);
70
+ } else {
71
+ location.reload();
72
+ }
73
+ }, 100);
74
+ }
@@ -0,0 +1,112 @@
1
+ /** @type {boolean} Flag indicating if a message is currently being appended */
2
+ let isAppending = false;
3
+
4
+ /** @type {boolean} Flag indicating if completion UI update is pending */
5
+ let completionPending = false;
6
+
7
+ /**
8
+ * Message queue for delayed loading modal updates.
9
+ * @type {Array<{msg: string, isCompletion: boolean}>}
10
+ */
11
+ let messageQueue = [];
12
+
13
+ /**
14
+ * Process messages in the queue with a delay between each message.
15
+ * When the queue is empty and completion is pending, triggers the completion UI.
16
+ * @private
17
+ */
18
+ function processMessageQueue() {
19
+ if (isAppending || messageQueue.length === 0) {
20
+ // Only update completion UI if all messages have been displayed
21
+ if (messageQueue.length === 0 && completionPending) {
22
+ // Add small delay before showing completion to ensure last message is visible
23
+ setTimeout(() => {
24
+ updateCompletionUI();
25
+ completionPending = false;
26
+ }, 500);
27
+ }
28
+ return;
29
+ }
30
+
31
+ isAppending = true;
32
+ const { msg, isCompletion } = messageQueue.shift();
33
+
34
+ if (isCompletion) {
35
+ completionPending = true;
36
+ }
37
+
38
+ appendInstallLoadingMessage(msg);
39
+
40
+ setTimeout(() => {
41
+ isAppending = false;
42
+ processMessageQueue();
43
+ }, 1000);
44
+ }
45
+
46
+ /**
47
+ * Queue a message to be displayed with a delay.
48
+ * Messages are displayed sequentially with a 1-second delay between each.
49
+ * @param {string} msg The message to display
50
+ * @param {boolean} [isCompletion=false] If true, triggers completion UI after message display
51
+ */
52
+ export function delayedAppendInstallLoadingMessage(msg, isCompletion = false) {
53
+ messageQueue.push({ msg, isCompletion });
54
+ processMessageQueue();
55
+ }
56
+
57
+ function updateCompletionUI() {
58
+ const loadingTitle = document.querySelector('.loading-title');
59
+ const loadingIcon = document.querySelector('.loading-icon');
60
+
61
+ if (loadingTitle) {
62
+ loadingTitle.textContent = 'Completed';
63
+ loadingTitle.classList.add('completed');
64
+ }
65
+
66
+ if (loadingIcon) {
67
+ loadingIcon.innerHTML = `
68
+ <svg width="48" height="48" viewBox="0 0 48 48" fill="none">
69
+ <circle cx="24" cy="24" r="20" stroke="#059669" stroke-width="4"/>
70
+ <path d="M16 24l6 6 12-12" stroke="#059669" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
71
+ </svg>
72
+ `;
73
+ loadingIcon.classList.add('completed');
74
+ }
75
+ }
76
+
77
+ /**
78
+ * Internal function to append a message to the loading modal with formatting.
79
+ * @private
80
+ * @param {string} message - The message to append
81
+ */
82
+ function appendInstallLoadingMessage(message) {
83
+ const loadingMsg = document.getElementById('installLoadingMessage');
84
+ if (loadingMsg) {
85
+ // Split message on newlines
86
+ const lines = message.split('\n');
87
+
88
+ lines.forEach(line => {
89
+ // Check if line contains an error
90
+ const isError = line.toLowerCase().includes('error') ||
91
+ line.toLowerCase().includes('failed') ||
92
+ line.toLowerCase().includes('timeout');
93
+
94
+ const formattedMessage = line;
95
+
96
+ // Create message container
97
+ const messageDiv = document.createElement('div');
98
+ messageDiv.className = 'message-line';
99
+
100
+ // Apply yellow color for error messages
101
+ if (isError) {
102
+ messageDiv.style.color = '#f59e0b';
103
+ }
104
+ messageDiv.innerHTML = formattedMessage;
105
+
106
+ loadingMsg.appendChild(messageDiv);
107
+ loadingMsg.scrollTop = loadingMsg.scrollHeight;
108
+ });
109
+ } else {
110
+ console.error('[LoadingModal] Element not found: installLoadingMessage');
111
+ }
112
+ }