imcp 0.1.7 → 0.1.8-dev

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 (314) hide show
  1. package/dist/cli/commands/install.js +1 -106
  2. package/dist/cli/commands/install.js.map +1 -0
  3. package/dist/cli/commands/list.js +1 -90
  4. package/dist/cli/commands/list.js.map +1 -0
  5. package/dist/cli/commands/pull.js +1 -16
  6. package/dist/cli/commands/pull.js.map +1 -0
  7. package/dist/cli/commands/serve.js +1 -33
  8. package/dist/cli/commands/serve.js.map +1 -0
  9. package/dist/cli/commands/uninstall.js +1 -46
  10. package/dist/cli/commands/uninstall.js.map +1 -0
  11. package/dist/cli/index.js +1 -65
  12. package/dist/cli/index.js.map +1 -0
  13. package/dist/core/installers/clients/BaseClientInstaller.js +1 -282
  14. package/dist/core/installers/clients/BaseClientInstaller.js.map +1 -0
  15. package/dist/core/installers/clients/ClientInstaller.js +1 -163
  16. package/dist/core/installers/clients/ClientInstaller.js.map +1 -0
  17. package/dist/core/installers/clients/ClientInstallerFactory.js +1 -36
  18. package/dist/core/installers/clients/ClientInstallerFactory.js.map +1 -0
  19. package/dist/core/installers/clients/ClineInstaller.js +1 -30
  20. package/dist/core/installers/clients/ClineInstaller.js.map +1 -0
  21. package/dist/core/installers/clients/ExtensionInstaller.js +1 -151
  22. package/dist/core/installers/clients/ExtensionInstaller.js.map +1 -0
  23. package/dist/core/installers/clients/GithubCopilotInstaller.js +1 -68
  24. package/dist/core/installers/clients/GithubCopilotInstaller.js.map +1 -0
  25. package/dist/core/installers/clients/MSRooCodeInstaller.js +1 -28
  26. package/dist/core/installers/clients/MSRooCodeInstaller.js.map +1 -0
  27. package/dist/core/installers/index.js +1 -8
  28. package/dist/core/installers/index.js.map +1 -0
  29. package/dist/core/installers/requirements/BaseInstaller.js +1 -56
  30. package/dist/core/installers/requirements/BaseInstaller.js.map +1 -0
  31. package/dist/core/installers/requirements/CommandInstaller.js +1 -213
  32. package/dist/core/installers/requirements/CommandInstaller.js.map +1 -0
  33. package/dist/core/installers/requirements/GeneralInstaller.js +1 -126
  34. package/dist/core/installers/requirements/GeneralInstaller.js.map +1 -0
  35. package/dist/core/installers/requirements/InstallerFactory.js +1 -99
  36. package/dist/core/installers/requirements/InstallerFactory.js.map +1 -0
  37. package/dist/core/installers/requirements/NpmInstaller.js +1 -235
  38. package/dist/core/installers/requirements/NpmInstaller.js.map +1 -0
  39. package/dist/core/installers/requirements/NugetInstaller.js +1 -188
  40. package/dist/core/installers/requirements/NugetInstaller.js.map +1 -0
  41. package/dist/core/installers/requirements/PipInstaller.js +1 -192
  42. package/dist/core/installers/requirements/PipInstaller.js.map +1 -0
  43. package/dist/core/installers/requirements/RequirementInstaller.js +1 -2
  44. package/dist/core/installers/requirements/RequirementInstaller.js.map +1 -0
  45. package/dist/core/loaders/ConfigurationLoader.js +1 -256
  46. package/dist/core/loaders/ConfigurationLoader.js.map +1 -0
  47. package/dist/core/loaders/ConfigurationProvider.js +1 -383
  48. package/dist/core/loaders/ConfigurationProvider.js.map +1 -0
  49. package/dist/core/loaders/InstallOperationManager.js +1 -310
  50. package/dist/core/loaders/InstallOperationManager.js.map +1 -0
  51. package/dist/core/loaders/ServerSchemaLoader.js +1 -108
  52. package/dist/core/loaders/ServerSchemaLoader.js.map +1 -0
  53. package/dist/core/loaders/ServerSchemaProvider.js +1 -89
  54. package/dist/core/loaders/ServerSchemaProvider.js.map +1 -0
  55. package/dist/core/loaders/SystemSettingsManager.js +1 -256
  56. package/dist/core/loaders/SystemSettingsManager.js.map +1 -0
  57. package/dist/core/metadatas/constants.js +1 -100
  58. package/dist/core/metadatas/constants.js.map +1 -0
  59. package/dist/core/metadatas/recordingConstants.js +1 -46
  60. package/dist/core/metadatas/recordingConstants.js.map +1 -0
  61. package/dist/core/metadatas/types.js +1 -15
  62. package/dist/core/metadatas/types.js.map +1 -0
  63. package/dist/core/onboard/FeedOnboardService.js +1 -422
  64. package/dist/core/onboard/FeedOnboardService.js.map +1 -0
  65. package/dist/core/onboard/OnboardProcessor.js +1 -333
  66. package/dist/core/onboard/OnboardProcessor.js.map +1 -0
  67. package/dist/core/onboard/OnboardStatus.js +1 -9
  68. package/dist/core/onboard/OnboardStatus.js.map +1 -0
  69. package/dist/core/onboard/OnboardStatusManager.js +1 -360
  70. package/dist/core/onboard/OnboardStatusManager.js.map +1 -0
  71. package/dist/core/validators/FeedValidator.js +1 -133
  72. package/dist/core/validators/FeedValidator.js.map +1 -0
  73. package/dist/core/validators/IServerValidator.js +1 -1
  74. package/dist/core/validators/IServerValidator.js.map +1 -0
  75. package/dist/core/validators/SSEServerValidator.js +1 -38
  76. package/dist/core/validators/SSEServerValidator.js.map +1 -0
  77. package/dist/core/validators/ServerValidatorFactory.js +1 -44
  78. package/dist/core/validators/ServerValidatorFactory.js.map +1 -0
  79. package/dist/core/validators/StdioServerValidator.js +1 -281
  80. package/dist/core/validators/StdioServerValidator.js.map +1 -0
  81. package/dist/index.js +1 -18
  82. package/dist/index.js.map +1 -0
  83. package/dist/services/InstallationService.js +1 -81
  84. package/dist/services/InstallationService.js.map +1 -0
  85. package/dist/services/MCPManager.js +1 -197
  86. package/dist/services/MCPManager.js.map +1 -0
  87. package/dist/services/RequirementService.js +1 -548
  88. package/dist/services/RequirementService.js.map +1 -0
  89. package/dist/services/ServerService.js +1 -127
  90. package/dist/services/ServerService.js.map +1 -0
  91. package/dist/services/TelemetryService.js +1 -53
  92. package/dist/services/TelemetryService.js.map +1 -0
  93. package/dist/utils/UpdateCheckTracker.js +1 -79
  94. package/dist/utils/UpdateCheckTracker.js.map +1 -0
  95. package/dist/utils/adoUtils.js +1 -254
  96. package/dist/utils/adoUtils.js.map +1 -0
  97. package/dist/utils/clientUtils.js +1 -65
  98. package/dist/utils/clientUtils.js.map +1 -0
  99. package/dist/utils/feedUtils.js +1 -28
  100. package/dist/utils/feedUtils.js.map +1 -0
  101. package/dist/utils/githubAuth.js +1 -177
  102. package/dist/utils/githubAuth.js.map +1 -0
  103. package/dist/utils/githubUtils.js +1 -125
  104. package/dist/utils/githubUtils.js.map +1 -0
  105. package/dist/utils/logger.js +1 -176
  106. package/dist/utils/logger.js.map +1 -0
  107. package/dist/utils/macroExpressionUtils.js +1 -93
  108. package/dist/utils/macroExpressionUtils.js.map +1 -0
  109. package/dist/utils/osUtils.js +1 -664
  110. package/dist/utils/osUtils.js.map +1 -0
  111. package/dist/utils/versionUtils.js +1 -101
  112. package/dist/utils/versionUtils.js.map +1 -0
  113. package/dist/web/contract/serverContract.js +1 -1
  114. package/dist/web/contract/serverContract.js.map +1 -0
  115. package/dist/web/public/js/api.js +2 -132
  116. package/dist/web/public/js/api.js.map +1 -0
  117. package/dist/web/public/js/detailsWidget.js +2 -264
  118. package/dist/web/public/js/detailsWidget.js.map +1 -0
  119. package/dist/web/public/js/flights/flights.js +2 -127
  120. package/dist/web/public/js/flights/flights.js.map +1 -0
  121. package/dist/web/public/js/modal/index.js +2 -52
  122. package/dist/web/public/js/modal/index.js.map +1 -0
  123. package/dist/web/public/js/modal/installModal.js +2 -162
  124. package/dist/web/public/js/modal/installModal.js.map +1 -0
  125. package/dist/web/public/js/modal/installation.js +2 -266
  126. package/dist/web/public/js/modal/installation.js.map +1 -0
  127. package/dist/web/public/js/modal/loadingModal.js +2 -182
  128. package/dist/web/public/js/modal/loadingModal.js.map +1 -0
  129. package/dist/web/public/js/modal/modalSetup.js +2 -595
  130. package/dist/web/public/js/modal/modalSetup.js.map +1 -0
  131. package/dist/web/public/js/modal/modalUtils.js +2 -37
  132. package/dist/web/public/js/modal/modalUtils.js.map +1 -0
  133. package/dist/web/public/js/modal/versionUtils.js +2 -20
  134. package/dist/web/public/js/modal/versionUtils.js.map +1 -0
  135. package/dist/web/public/js/modal.js +2 -42
  136. package/dist/web/public/js/modal.js.map +1 -0
  137. package/dist/web/public/js/notifications.js +2 -137
  138. package/dist/web/public/js/notifications.js.map +1 -0
  139. package/dist/web/public/js/onboard/formProcessor.js +2 -1037
  140. package/dist/web/public/js/onboard/formProcessor.js.map +1 -0
  141. package/dist/web/public/js/onboard/index.js +2 -374
  142. package/dist/web/public/js/onboard/index.js.map +1 -0
  143. package/dist/web/public/js/onboard/publishHandler.js +2 -172
  144. package/dist/web/public/js/onboard/publishHandler.js.map +1 -0
  145. package/dist/web/public/js/onboard/state.js +2 -76
  146. package/dist/web/public/js/onboard/state.js.map +1 -0
  147. package/dist/web/public/js/onboard/templates.js +2 -342
  148. package/dist/web/public/js/onboard/templates.js.map +1 -0
  149. package/dist/web/public/js/onboard/uiHandlers.js +2 -1076
  150. package/dist/web/public/js/onboard/uiHandlers.js.map +1 -0
  151. package/dist/web/public/js/onboard/validationHandlers.js +2 -493
  152. package/dist/web/public/js/onboard/validationHandlers.js.map +1 -0
  153. package/dist/web/public/js/serverCategoryDetails.js +2 -364
  154. package/dist/web/public/js/serverCategoryDetails.js.map +1 -0
  155. package/dist/web/public/js/serverCategoryList.js +2 -241
  156. package/dist/web/public/js/serverCategoryList.js.map +1 -0
  157. package/dist/web/public/js/settings.js +2 -314
  158. package/dist/web/public/js/settings.js.map +1 -0
  159. package/dist/web/server.js +1 -404
  160. package/dist/web/server.js.map +1 -0
  161. package/package.json +8 -2
  162. package/.github/ISSUE_TEMPLATE/JitAccess.yml +0 -28
  163. package/.github/acl/access.yml +0 -20
  164. package/.github/compliance/inventory.yml +0 -5
  165. package/.github/policies/jit.yml +0 -19
  166. package/.github/workflows/build.yml +0 -28
  167. package/.roo/rules-code/rules.md +0 -88
  168. package/dist/cli/commands/start.d.ts +0 -2
  169. package/dist/cli/commands/start.js +0 -32
  170. package/dist/cli/commands/sync.d.ts +0 -2
  171. package/dist/cli/commands/sync.js +0 -17
  172. package/dist/core/ConfigurationLoader.d.ts +0 -32
  173. package/dist/core/ConfigurationLoader.js +0 -236
  174. package/dist/core/ConfigurationProvider.d.ts +0 -35
  175. package/dist/core/ConfigurationProvider.js +0 -375
  176. package/dist/core/InstallationService.d.ts +0 -50
  177. package/dist/core/InstallationService.js +0 -350
  178. package/dist/core/MCPManager.d.ts +0 -28
  179. package/dist/core/MCPManager.js +0 -188
  180. package/dist/core/RequirementService.d.ts +0 -40
  181. package/dist/core/RequirementService.js +0 -110
  182. package/dist/core/ServerSchemaLoader.d.ts +0 -11
  183. package/dist/core/ServerSchemaLoader.js +0 -43
  184. package/dist/core/ServerSchemaProvider.d.ts +0 -17
  185. package/dist/core/ServerSchemaProvider.js +0 -120
  186. package/dist/core/constants.d.ts +0 -47
  187. package/dist/core/constants.js +0 -94
  188. package/dist/core/installers/BaseInstaller.d.ts +0 -74
  189. package/dist/core/installers/BaseInstaller.js +0 -253
  190. package/dist/core/installers/ClientInstaller.d.ts +0 -23
  191. package/dist/core/installers/ClientInstaller.js +0 -564
  192. package/dist/core/installers/CommandInstaller.d.ts +0 -37
  193. package/dist/core/installers/CommandInstaller.js +0 -173
  194. package/dist/core/installers/GeneralInstaller.d.ts +0 -33
  195. package/dist/core/installers/GeneralInstaller.js +0 -85
  196. package/dist/core/installers/InstallerFactory.d.ts +0 -54
  197. package/dist/core/installers/InstallerFactory.js +0 -97
  198. package/dist/core/installers/NpmInstaller.d.ts +0 -26
  199. package/dist/core/installers/NpmInstaller.js +0 -127
  200. package/dist/core/installers/PipInstaller.d.ts +0 -28
  201. package/dist/core/installers/PipInstaller.js +0 -127
  202. package/dist/core/installers/RequirementInstaller.d.ts +0 -33
  203. package/dist/core/installers/RequirementInstaller.js +0 -3
  204. package/dist/core/types.d.ts +0 -166
  205. package/dist/core/types.js +0 -16
  206. package/dist/services/InstallRequestValidator.d.ts +0 -21
  207. package/dist/services/InstallRequestValidator.js +0 -99
  208. package/dist/web/public/js/modal/installHandler.js +0 -227
  209. package/dist/web/public/js/modal/loadingUI.js +0 -74
  210. package/dist/web/public/js/modal/messageQueue.js +0 -112
  211. package/dist/web/public/js/modal/modalUI.js +0 -214
  212. package/dist/web/public/js/modal/version.js +0 -20
  213. package/dist/web/public/js/onboard/ONBOARDING_PAGE_DESIGN.md +0 -370
  214. package/docs/ONBOARDING_PAGE_DESIGN.md +0 -260
  215. package/docs/Telemetry.md +0 -136
  216. package/memory-bank/activeContext.md +0 -26
  217. package/memory-bank/decisionLog.md +0 -91
  218. package/memory-bank/productContext.md +0 -41
  219. package/memory-bank/progress.md +0 -35
  220. package/memory-bank/systemPatterns.md +0 -10
  221. package/src/cli/commands/install.ts +0 -139
  222. package/src/cli/commands/list.ts +0 -113
  223. package/src/cli/commands/pull.ts +0 -16
  224. package/src/cli/commands/serve.ts +0 -39
  225. package/src/cli/commands/uninstall.ts +0 -64
  226. package/src/cli/index.ts +0 -82
  227. package/src/core/installers/clients/BaseClientInstaller.ts +0 -341
  228. package/src/core/installers/clients/ClientInstaller.ts +0 -222
  229. package/src/core/installers/clients/ClientInstallerFactory.ts +0 -43
  230. package/src/core/installers/clients/ClineInstaller.ts +0 -35
  231. package/src/core/installers/clients/ExtensionInstaller.ts +0 -165
  232. package/src/core/installers/clients/GithubCopilotInstaller.ts +0 -79
  233. package/src/core/installers/clients/MSRooCodeInstaller.ts +0 -32
  234. package/src/core/installers/index.ts +0 -11
  235. package/src/core/installers/requirements/BaseInstaller.ts +0 -85
  236. package/src/core/installers/requirements/CommandInstaller.ts +0 -231
  237. package/src/core/installers/requirements/GeneralInstaller.ts +0 -133
  238. package/src/core/installers/requirements/InstallerFactory.ts +0 -114
  239. package/src/core/installers/requirements/NpmInstaller.ts +0 -271
  240. package/src/core/installers/requirements/NugetInstaller.ts +0 -203
  241. package/src/core/installers/requirements/PipInstaller.ts +0 -207
  242. package/src/core/installers/requirements/RequirementInstaller.ts +0 -42
  243. package/src/core/loaders/ConfigurationLoader.ts +0 -298
  244. package/src/core/loaders/ConfigurationProvider.ts +0 -462
  245. package/src/core/loaders/InstallOperationManager.ts +0 -367
  246. package/src/core/loaders/ServerSchemaLoader.ts +0 -117
  247. package/src/core/loaders/ServerSchemaProvider.ts +0 -99
  248. package/src/core/loaders/SystemSettingsManager.ts +0 -278
  249. package/src/core/metadatas/constants.ts +0 -122
  250. package/src/core/metadatas/recordingConstants.ts +0 -65
  251. package/src/core/metadatas/types.ts +0 -202
  252. package/src/core/onboard/FeedOnboardService.ts +0 -501
  253. package/src/core/onboard/OnboardProcessor.ts +0 -356
  254. package/src/core/onboard/OnboardStatus.ts +0 -60
  255. package/src/core/onboard/OnboardStatusManager.ts +0 -416
  256. package/src/core/validators/FeedValidator.ts +0 -135
  257. package/src/core/validators/IServerValidator.ts +0 -21
  258. package/src/core/validators/SSEServerValidator.ts +0 -43
  259. package/src/core/validators/ServerValidatorFactory.ts +0 -51
  260. package/src/core/validators/StdioServerValidator.ts +0 -313
  261. package/src/index.ts +0 -44
  262. package/src/services/InstallationService.ts +0 -102
  263. package/src/services/MCPManager.ts +0 -249
  264. package/src/services/RequirementService.ts +0 -627
  265. package/src/services/ServerService.ts +0 -161
  266. package/src/services/TelemetryService.ts +0 -59
  267. package/src/utils/UpdateCheckTracker.ts +0 -86
  268. package/src/utils/adoUtils.ts +0 -293
  269. package/src/utils/clientUtils.ts +0 -72
  270. package/src/utils/feedUtils.ts +0 -31
  271. package/src/utils/githubAuth.ts +0 -212
  272. package/src/utils/githubUtils.ts +0 -164
  273. package/src/utils/logger.ts +0 -195
  274. package/src/utils/macroExpressionUtils.ts +0 -104
  275. package/src/utils/osUtils.ts +0 -700
  276. package/src/utils/versionUtils.ts +0 -114
  277. package/src/web/contract/serverContract.ts +0 -74
  278. package/src/web/public/css/detailsWidget.css +0 -235
  279. package/src/web/public/css/modal.css +0 -757
  280. package/src/web/public/css/notifications.css +0 -101
  281. package/src/web/public/css/onboard.css +0 -107
  282. package/src/web/public/css/serverCategoryList.css +0 -120
  283. package/src/web/public/css/serverDetails.css +0 -139
  284. package/src/web/public/index.html +0 -359
  285. package/src/web/public/js/api.js +0 -132
  286. package/src/web/public/js/detailsWidget.js +0 -264
  287. package/src/web/public/js/flights/flights.js +0 -127
  288. package/src/web/public/js/modal/index.js +0 -52
  289. package/src/web/public/js/modal/installModal.js +0 -162
  290. package/src/web/public/js/modal/installation.js +0 -266
  291. package/src/web/public/js/modal/loadingModal.js +0 -182
  292. package/src/web/public/js/modal/modalSetup.js +0 -595
  293. package/src/web/public/js/modal/modalUtils.js +0 -37
  294. package/src/web/public/js/modal/versionUtils.js +0 -20
  295. package/src/web/public/js/modal.js +0 -42
  296. package/src/web/public/js/notifications.js +0 -137
  297. package/src/web/public/js/onboard/formProcessor.js +0 -1037
  298. package/src/web/public/js/onboard/index.js +0 -374
  299. package/src/web/public/js/onboard/publishHandler.js +0 -172
  300. package/src/web/public/js/onboard/state.js +0 -76
  301. package/src/web/public/js/onboard/templates.js +0 -342
  302. package/src/web/public/js/onboard/uiHandlers.js +0 -1076
  303. package/src/web/public/js/onboard/validationHandlers.js +0 -493
  304. package/src/web/public/js/serverCategoryDetails.js +0 -364
  305. package/src/web/public/js/serverCategoryList.js +0 -241
  306. package/src/web/public/js/settings.js +0 -314
  307. package/src/web/public/modal.html +0 -84
  308. package/src/web/public/onboard.html +0 -296
  309. package/src/web/public/settings.html +0 -135
  310. package/src/web/public/styles.css +0 -277
  311. package/src/web/server.ts +0 -478
  312. package/tsconfig.json +0 -18
  313. package/wiki/Installation.md +0 -3
  314. package/wiki/Publish.md +0 -3
@@ -1,595 +1,2 @@
1
- import { showToast, showConfirm } from '../notifications.js';
2
- import { showInstallLoadingModal, updateOverallInstallStatus } from './loadingModal.js';
3
- // import { delayedAppendInstallLoadingMessage } from './messageQueue.js'; // No longer used
4
- import { uninstallTools } from './installation.js';
5
- import { handleBulkClientInstall } from './installation.js';
6
- import { compareVersions } from './versionUtils.js';
7
-
8
- /**
9
- * Set up client items in the modal
10
- */
11
- export function setupClientItems(targets, serverStatus, categoryName, serverName, targetDiv) {
12
- targets.forEach(target => {
13
- const operationStatus = serverStatus.installedStatus[target] || { status: 'not-installed', type: 'check', target: 'server' };
14
-
15
- // Determine client status
16
- let statusText = '';
17
- let statusClass = '';
18
-
19
- if (operationStatus.status === 'completed' && operationStatus.type === 'install') {
20
- statusText = 'Installed';
21
- statusClass = 'installed';
22
- } else if (operationStatus.status === 'pending') {
23
- statusText = 'Pending Requirements';
24
- statusClass = 'pending';
25
- } else if (operationStatus.status === 'in-progress') {
26
- statusText = 'In Progress';
27
- statusClass = 'pending';
28
- } else if (operationStatus.status === 'failed') {
29
- statusText = 'Failed';
30
- statusClass = 'not-installed';
31
- }
32
-
33
- const isConfigured = operationStatus.status === 'completed' && operationStatus.type === 'install';
34
- const isInProgress = operationStatus.status === 'in-progress';
35
- const isSelectable = !isConfigured && !isInProgress;
36
-
37
- const clientItem = createClientItem(target, statusText, statusClass, isSelectable, isConfigured, isInProgress);
38
- setupClientItemListeners(clientItem, target, isSelectable);
39
- setupUninstallButton(clientItem, statusText, operationStatus, target, categoryName, serverName, statusClass);
40
- targetDiv.appendChild(clientItem);
41
- });
42
-
43
- addSectionTitle(targetDiv);
44
- }
45
-
46
- /**
47
- * Set up environment variables section in the modal
48
- */
49
- export function setupEnvironmentVariables(mcpServer, envInputsDiv, targetData) {
50
- // For SSE mode, don't show env section at all
51
- if (mcpServer.mode === 'sse') {
52
- envInputsDiv.style.display = 'none';
53
- return;
54
- }
55
-
56
- const envRequirements = mcpServer.installation?.['env'] || mcpServer.installation?.env || {};
57
- addEnvironmentTitle(envInputsDiv);
58
-
59
- // Fetch system settings to get userConfigurations for env defaults
60
- fetch('/api/settings')
61
- .then(response => response.json())
62
- .then(data => {
63
- const userConfigurations = (data && data.data && data.data.userConfigurations) ? data.data.userConfigurations : {};
64
- if (Object.keys(envRequirements).length === 0) {
65
- addNoEnvMessage(envInputsDiv);
66
- } else {
67
- createEnvironmentInputs(envRequirements, envInputsDiv, targetData.clientMcpSettings, mcpServer.name, userConfigurations);
68
- }
69
- })
70
- .catch(() => {
71
- // fallback to old logic if fetch fails
72
- if (Object.keys(envRequirements).length === 0) {
73
- addNoEnvMessage(envInputsDiv);
74
- } else {
75
- createEnvironmentInputs(envRequirements, envInputsDiv, targetData.clientMcpSettings, mcpServer.name, {});
76
- }
77
- });
78
- }
79
-
80
- /**
81
- * Set up installation arguments section in the modal
82
- */
83
- export function setupInstallationArguments(installation, modalArguments, categoryName, mcpServer) {
84
- // For SSE mode, don't show arguments section at all
85
- if (mcpServer?.mode === 'sse') {
86
- modalArguments.style.display = 'none';
87
- return;
88
- }
89
-
90
- if (!installation) return;
91
-
92
- addArgumentsTitle(modalArguments);
93
- const container = createArgumentsContainer();
94
- modalArguments.appendChild(container);
95
-
96
- if (installation.args && Array.isArray(installation.args)) {
97
- installation.args.forEach(arg => {
98
- container.appendChild(createArgumentInput(arg));
99
- });
100
- } else {
101
- container.appendChild(createArgumentInput());
102
- }
103
-
104
- if (installation.command === 'python' || installation.command.includes('python')) {
105
- addPythonEnvironmentInput(categoryName, mcpServer.name, modalArguments);
106
- }
107
- }
108
-
109
- /**
110
- * Set up server requirements section in the modal
111
- */
112
- export function setupServerRequirements(mcpServer, serverData, categoryName, serverName, modalRequirements) {
113
- // For SSE mode, don't show requirements section at all
114
- if (mcpServer.mode === 'sse') {
115
- modalRequirements.style.display = 'none';
116
- return;
117
- }
118
-
119
- const serverRequirements = mcpServer.dependencies?.requirements || [];
120
- const requirements = serverData.data.installationStatus?.requirementsStatus || {};
121
-
122
- if (serverRequirements.length > 0) {
123
- const reqHtml = renderRequirements(serverRequirements, requirements, categoryName, serverName);
124
- modalRequirements.innerHTML = `
125
- <h3 class="text-lg font-semibold text-gray-700 mb-3">Dependencies</h3>
126
- <p class="text-sm text-gray-600 mb-4">These dependencies will be automatically installed when installing the server</p>
127
- ${reqHtml}
128
- `;
129
-
130
- setupUpdateToggles(modalRequirements);
131
- } else {
132
- modalRequirements.innerHTML = '<p class="text-gray-600">No additional dependencies required.</p>';
133
- }
134
- }
135
-
136
- /**
137
- * Set up the form submit handler
138
- */
139
- export function setupFormSubmitHandler(form, envInputsDiv, modalArguments, modalRequirements, categoryName, serverName, serverStatuses, serverData, mcpServer) {
140
- form.onsubmit = (e) => {
141
- e.preventDefault();
142
-
143
- const envVars = {};
144
- const args = [];
145
- const requirementsToUpdate = [];
146
- let pythonEnv = undefined;
147
-
148
- // Only collect env, args and requirements if not in SSE mode
149
- if (mcpServer?.mode !== 'sse') {
150
- const inputs = envInputsDiv.querySelectorAll('input');
151
- inputs.forEach(input => {
152
- if (input.name && input.value) {
153
- envVars[input.name] = input.value;
154
- }
155
- });
156
-
157
- const argInputs = modalArguments.querySelectorAll('.arg-input');
158
- args.push(...Array.from(argInputs)
159
- .map(input => input.value.trim())
160
- .filter(val => val !== ''));
161
-
162
- const pythonEnvInput = document.getElementById('python_env');
163
- pythonEnv = pythonEnvInput?.value?.trim();
164
-
165
- const updateToggles = modalRequirements.querySelectorAll('.toggle-update:checked');
166
- updateToggles.forEach(toggle => {
167
- requirementsToUpdate.push({
168
- name: toggle.dataset.name,
169
- version: toggle.dataset.version
170
- });
171
- });
172
- }
173
-
174
- // Only POST userConfigurations and/or pythonEnvs if there is a difference, then proceed with install
175
- fetch('/api/settings')
176
- .then(response => response.json())
177
- .then(data => {
178
- const userConfigurations = (data && data.data && data.data.userConfigurations) ? data.data.userConfigurations : {};
179
- const pythonEnvs = (data && data.data && data.data.pythonEnvs) ? data.data.pythonEnvs : {};
180
- const updatedUserConfigurations = { ...userConfigurations };
181
- const updatedPythonEnvs = { ...pythonEnvs };
182
-
183
- Object.keys(envVars).forEach(key => {
184
- updatedUserConfigurations[key] = envVars[key];
185
- });
186
-
187
- // Check for userConfigurations difference
188
- let needsUserConfigUpdate = false;
189
- const allUserConfigKeys = new Set([...Object.keys(userConfigurations), ...Object.keys(envVars)]);
190
- for (const key of allUserConfigKeys) {
191
- if (userConfigurations[key] !== updatedUserConfigurations[key]) {
192
- needsUserConfigUpdate = true;
193
- break;
194
- }
195
- }
196
-
197
- // Check for pythonEnvs difference
198
- let needsPythonEnvUpdate = false;
199
- if (pythonEnv !== undefined && pythonEnv !== pythonEnvs[`${categoryName}:${serverName}`]) {
200
- updatedPythonEnvs[`${categoryName}:${serverName}`] = pythonEnv;
201
- needsPythonEnvUpdate = true;
202
- }
203
-
204
- // If either needs update, POST the merged object
205
- if (needsUserConfigUpdate || needsPythonEnvUpdate) {
206
- const postBody = {};
207
- if (needsUserConfigUpdate) postBody.userConfigurations = updatedUserConfigurations;
208
- if (needsPythonEnvUpdate) postBody.pythonEnvs = updatedPythonEnvs;
209
- fetch('/api/settings', {
210
- method: 'POST',
211
- headers: { 'Content-Type': 'application/json' },
212
- body: JSON.stringify(postBody)
213
- }).then(() => {
214
- proceedInstall();
215
- }).catch(() => {
216
- proceedInstall();
217
- });
218
- } else {
219
- proceedInstall();
220
- }
221
- })
222
- .catch(() => {
223
- proceedInstall();
224
- });
225
-
226
- function proceedInstall() {
227
- const hasRequirementsToUpdate = requirementsToUpdate.length > 0;
228
-
229
- const uninstallBtn = document.querySelector('.uninstall-btn');
230
- if (!uninstallBtn || !uninstallBtn.matches(':active')) {
231
- const selectedTargets = window.selectedClients;
232
- if (selectedTargets.length === 0 && !hasRequirementsToUpdate) {
233
- showToast('Please select at least one client to configure.', 'error');
234
- return;
235
- }
236
-
237
- let installingMessage = "Starting installation...";
238
- const serverStatus = serverStatuses[serverName] || { installedStatus: {} };
239
- if (selectedTargets.length > 0) {
240
- const target = selectedTargets[0];
241
- const msg = serverStatus.installedStatus?.[target]?.message;
242
- if (msg) installingMessage = msg;
243
- }
244
-
245
- const serverInstallOptions = {
246
- targetClients: selectedTargets,
247
- env: envVars,
248
- args: args,
249
- settings: pythonEnv ? { pythonEnv: pythonEnv } : {}
250
- };
251
-
252
- if (requirementsToUpdate.length > 0) {
253
- serverInstallOptions.requirements = requirementsToUpdate;
254
- }
255
-
256
- handleBulkClientInstall(categoryName, serverName, selectedTargets, envVars, installingMessage, serverData, serverInstallOptions);
257
- }
258
- }
259
- };
260
- }
261
-
262
- // Helper functions
263
- function createClientItem(target, statusText, statusClass, isSelectable, isConfigured, isInProgress) {
264
- const clientItem = document.createElement('div');
265
- clientItem.className = 'client-item';
266
- clientItem.dataset.target = target;
267
- clientItem.dataset.selected = 'false';
268
-
269
- // Create client info (name)
270
- const clientInfo = document.createElement('div');
271
- clientInfo.className = 'client-info';
272
-
273
- // Client name label
274
- const clientName = document.createElement('span');
275
- clientName.className = 'text-sm font-medium text-gray-900';
276
- clientName.textContent = target;
277
-
278
- // Add elements to client info
279
- clientInfo.appendChild(clientName);
280
-
281
- // Add client info to client item
282
- clientItem.appendChild(clientInfo);
283
-
284
- if (!isSelectable) {
285
- clientItem.classList.add('non-selectable');
286
- if (isConfigured) {
287
- clientItem.classList.add('installed-item');
288
- clientItem.title = 'Already installed';
289
- } else if (isInProgress) {
290
- clientItem.classList.add('in-progress-item');
291
- clientItem.title = 'Installation in progress';
292
- }
293
- }
294
-
295
- return clientItem;
296
- }
297
-
298
- function setupClientItemListeners(clientItem, target, isSelectable) {
299
- if (isSelectable) {
300
- clientItem.addEventListener('click', () => {
301
- const isSelected = clientItem.dataset.selected === 'true';
302
- clientItem.dataset.selected = isSelected ? 'false' : 'true';
303
-
304
- if (isSelected) {
305
- clientItem.classList.remove('selected');
306
- window.selectedClients = window.selectedClients.filter(c => c !== target);
307
- } else {
308
- clientItem.classList.add('selected');
309
- if (!window.selectedClients.includes(target)) {
310
- window.selectedClients.push(target);
311
- }
312
- }
313
- });
314
- }
315
- }
316
-
317
- function setupUninstallButton(clientItem, statusText, operationStatus, target, categoryName, serverName, statusClass) {
318
- if (statusText) {
319
- const statusContainer = document.createElement('div');
320
- statusContainer.className = 'status-container';
321
-
322
- const statusBadge = document.createElement('span');
323
- statusBadge.className = `status-badge ${statusClass}`;
324
- statusBadge.textContent = statusText;
325
- statusContainer.appendChild(statusBadge);
326
-
327
- if (operationStatus.status === 'completed' && operationStatus.type === 'install') {
328
- const uninstallBtn = createUninstallButton(target, categoryName, serverName);
329
- statusContainer.appendChild(uninstallBtn);
330
- }
331
-
332
- clientItem.appendChild(statusContainer);
333
- }
334
- }
335
-
336
- function createUninstallButton(target, categoryName, serverName) {
337
- const uninstallBtn = document.createElement('button');
338
- uninstallBtn.className = 'uninstall-btn text-red-600 hover:text-red-800 ml-2';
339
- uninstallBtn.innerHTML = '<i class="bx bx-trash"></i>';
340
- uninstallBtn.title = 'Uninstall from this client';
341
-
342
- uninstallBtn.onclick = async (e) => {
343
- e.stopPropagation();
344
- e.preventDefault();
345
-
346
- const confirmed = await showConfirm('Uninstall Confirmation',
347
- `Are you sure you want to uninstall ${serverName} from ${target}?`);
348
-
349
- if (confirmed) {
350
- window.selectedClients = [target];
351
- showInstallLoadingModal('Uninstalling');
352
- const serverList = {
353
- [serverName]: {
354
- removeData: true
355
- }
356
- };
357
-
358
- try {
359
- updateOverallInstallStatus('in-progress', `Uninstalling ${serverName} from ${target}...`);
360
- await uninstallTools(categoryName, serverList, [target]);
361
- // uninstallTools will now handle its own final status update via updateOverallInstallStatus
362
- } catch (error) {
363
- updateOverallInstallStatus('failed', `Error during uninstall: ${error.message}`);
364
- // No need to throw here if uninstallTools handles its errors by updating status
365
- }
366
- }
367
- return false;
368
- };
369
-
370
- return uninstallBtn;
371
- }
372
-
373
- function addSectionTitle(targetDiv) {
374
- if (!targetDiv.querySelector('.section-title')) {
375
- const titleElement = document.createElement('h3');
376
- titleElement.className = 'section-title text-lg font-semibold text-gray-700 mb-3';
377
- titleElement.textContent = 'Client Status';
378
- targetDiv.insertBefore(titleElement, targetDiv.firstChild);
379
- }
380
- }
381
-
382
- function addEnvironmentTitle(envInputsDiv) {
383
- if (!envInputsDiv.querySelector('.section-title')) {
384
- const envTitle = document.createElement('h3');
385
- envTitle.className = 'section-title text-lg font-semibold text-gray-700 mb-3';
386
- envTitle.textContent = 'Environment Variables';
387
- envInputsDiv.insertBefore(envTitle, envInputsDiv.firstChild);
388
- }
389
- }
390
-
391
- function addNoEnvMessage(envInputsDiv) {
392
- const noEnvMessage = document.createElement('p');
393
- noEnvMessage.className = 'text-gray-600';
394
- noEnvMessage.textContent = 'No environment variables required for this MCP server.';
395
- envInputsDiv.appendChild(noEnvMessage);
396
- }
397
-
398
- function createEnvironmentInputs(envRequirements, envInputsDiv, clientSettings, serverName, userConfigurations = {}) {
399
- Object.keys(envRequirements).forEach(key => {
400
- const req = envRequirements[key];
401
- const inputId = `env_${key}`;
402
- const inputWrapper = document.createElement('div');
403
- inputWrapper.className = 'mb-3';
404
-
405
- const label = document.createElement('label');
406
- label.htmlFor = inputId;
407
- label.className = 'block text-sm font-medium text-gray-700 mb-1';
408
- label.innerHTML = `${key} ${req.Required ? '<span class="text-red-500">*</span>' : ''}`;
409
-
410
- const input = document.createElement('input');
411
- input.type = req.isSecret ? 'password' : 'text';
412
- input.id = inputId;
413
- input.name = key;
414
- input.placeholder = req.Description || key;
415
- input.required = req.Required;
416
- input.className = 'input-field';
417
-
418
- // For default value, first check userConfigurations, then client settings, then provided default
419
- let defaultValue = req.Default || '';
420
-
421
- // Use userConfigurations if present
422
- if (userConfigurations && userConfigurations[key]) {
423
- defaultValue = userConfigurations[key];
424
- } else if (clientSettings && clientSettings.MSRooCode &&
425
- clientSettings.MSRooCode.mcpServers &&
426
- clientSettings.MSRooCode.mcpServers[serverName] &&
427
- clientSettings.MSRooCode.mcpServers[serverName].env &&
428
- clientSettings.MSRooCode.mcpServers[serverName].env[key]) {
429
- defaultValue = clientSettings.MSRooCode.mcpServers[serverName].env[key];
430
- }
431
-
432
- input.value = defaultValue;
433
-
434
- inputWrapper.appendChild(label);
435
- inputWrapper.appendChild(input);
436
-
437
- if (req.Description) {
438
- const description = document.createElement('p');
439
- description.className = 'text-xs text-gray-500 mt-1';
440
- description.textContent = req.Description;
441
- inputWrapper.appendChild(description);
442
- }
443
-
444
- envInputsDiv.appendChild(inputWrapper);
445
- });
446
- }
447
-
448
- function addArgumentsTitle(modalArguments) {
449
- const argsTitle = document.createElement('h3');
450
- argsTitle.className = 'section-title text-lg font-semibold text-gray-700 mb-3';
451
- argsTitle.textContent = 'Arguments';
452
- modalArguments.appendChild(argsTitle);
453
- }
454
-
455
- function createArgumentsContainer() {
456
- const container = document.createElement('div');
457
- container.className = 'args-container mb-3';
458
-
459
- const addButton = document.createElement('button');
460
- addButton.type = 'button';
461
- addButton.className = 'add-arg-button px-3 py-1 text-sm text-blue-600 hover:text-blue-800 border border-blue-600 hover:border-blue-800 rounded-md mb-2';
462
- addButton.innerHTML = '<i class="bx bx-plus"></i> Add Argument';
463
- addButton.onclick = () => container.appendChild(createArgumentInput());
464
-
465
- container.appendChild(addButton);
466
- return container;
467
- }
468
-
469
- function createArgumentInput(value = '') {
470
- const argWrapper = document.createElement('div');
471
- argWrapper.className = 'arg-wrapper flex items-center gap-2 mb-2';
472
-
473
- const input = document.createElement('input');
474
- input.type = 'text';
475
- input.className = 'arg-input flex-grow';
476
- input.value = value;
477
- input.placeholder = 'Enter argument value';
478
-
479
- const removeButton = document.createElement('button');
480
- removeButton.type = 'button';
481
- removeButton.className = 'remove-arg-button text-red-600 hover:text-red-800';
482
- removeButton.innerHTML = '<i class="bx bx-trash"></i>';
483
- removeButton.onclick = () => argWrapper.remove();
484
-
485
- argWrapper.appendChild(input);
486
- argWrapper.appendChild(removeButton);
487
- return argWrapper;
488
- }
489
-
490
- function addPythonEnvironmentInput(categoryName, serverName, modalArguments) {
491
- const pythonEnvWrapper = document.createElement('div');
492
- pythonEnvWrapper.className = 'mt-4';
493
-
494
- const pythonEnvLabel = document.createElement('label');
495
- pythonEnvLabel.htmlFor = 'python_env';
496
- pythonEnvLabel.className = 'block text-sm font-medium text-gray-700 mb-1';
497
- pythonEnvLabel.textContent = 'Python Environment';
498
-
499
- const pythonEnvInput = document.createElement('input');
500
- pythonEnvInput.type = 'text';
501
- pythonEnvInput.id = 'python_env';
502
- pythonEnvInput.className = 'input-field';
503
- pythonEnvInput.placeholder = 'Enter Python environment path (optional)';
504
-
505
- const envDescription = document.createElement('p');
506
- envDescription.className = 'text-xs text-gray-500 mt-1';
507
- envDescription.textContent = 'Specify the Python exectable file(e.g. C:/python312/python) to use for installation. Leave empty to use system default. You can specify value in Settings page';
508
-
509
- pythonEnvWrapper.appendChild(pythonEnvLabel);
510
- pythonEnvWrapper.appendChild(pythonEnvInput);
511
- pythonEnvWrapper.appendChild(envDescription);
512
- modalArguments.appendChild(pythonEnvWrapper);
513
- // Fetch system settings and set default value for python_env
514
- fetch('/api/settings')
515
- .then(response => response.json())
516
- .then(data => {
517
- if (data && data.data && data.data.pythonEnvs) {
518
- pythonEnvInput.value = data.data.pythonEnvs[`${categoryName}:${serverName}`] || data.data.pythonEnvs['system'] || '';
519
- }
520
- })
521
- .catch(() => {
522
- // Ignore errors, leave input empty
523
- });
524
- }
525
-
526
- function renderRequirements(serverRequirements, requirements, categoryName, serverName) {
527
- return serverRequirements.map(req => {
528
- const status = requirements[req.name] || {};
529
- let statusClass = status.installed
530
- ? 'text-green-600 bg-green-50'
531
- : 'text-yellow-600 bg-yellow-50';
532
- let statusText = status.installed ? 'Installed' : 'Required';
533
- let versionDisplay = status.version ? ` • <span class="font-medium">${status.version}</span>` : '';
534
- let updateToggle = '';
535
-
536
- // Check if there's an available update
537
- if (status.installed && status.availableUpdate && status.availableUpdate.version) {
538
- if (status.version && compareVersions(status.availableUpdate.version, status.version) > 0) {
539
- // Show version update information with yellow color and icon
540
- statusClass = 'text-yellow-600 bg-yellow-50';
541
- statusText = `<span style="color: #f59e0b; font-weight: bold; margin-right: 5px;">↑</span>${status.availableUpdate.version}`;
542
-
543
- // Create a toggle switch for update
544
- updateToggle = `
545
- <label class="inline-flex items-center cursor-pointer ml-2">
546
- <input type="checkbox" class="toggle-update sr-only"
547
- data-name="${req.name}"
548
- data-version="${status.availableUpdate.version}"
549
- data-category="${categoryName}"
550
- data-server="${serverName}">
551
- <div class="relative w-10 h-5 bg-gray-200 rounded-full toggle-bg">
552
- <div class="absolute inset-y-0 left-0 w-5 h-5 bg-white rounded-full transition-transform duration-300 transform"></div>
553
- </div>
554
- <span class="ml-2 text-sm text-gray-700">Update</span>
555
- </label>
556
- `;
557
- }
558
- }
559
-
560
- return `
561
- <div class="border border-gray-200 p-3 rounded-lg mb-2 hover:bg-gray-50">
562
- <div class="flex justify-between items-center">
563
- <div>
564
- <div class="font-semibold text-gray-800">${req.name}</div>
565
- <div class="text-sm text-gray-600 shadow-sm p-1 rounded bg-gray-50">
566
- <span class="font-medium">${status.type || 'package'}</span>${versionDisplay}
567
- </div>
568
- </div>
569
- <div class="flex items-center">
570
- <span class="${statusClass} inline-flex items-center px-3 py-1 rounded-full text-sm">
571
- ${statusText}
572
- </span>
573
- ${updateToggle}
574
- </div>
575
- </div>
576
- </div>
577
- `;
578
- }).join('');
579
- }
580
-
581
- function setupUpdateToggles(modalRequirements) {
582
- const updateToggles = modalRequirements.querySelectorAll('.toggle-update');
583
- updateToggles.forEach(toggle => {
584
- toggle.addEventListener('change', function () {
585
- const toggleBg = this.parentElement.querySelector('.toggle-bg');
586
- if (this.checked) {
587
- toggleBg.classList.add('bg-blue-500');
588
- toggleBg.querySelector('div').classList.add('translate-x-5');
589
- } else {
590
- toggleBg.classList.remove('bg-blue-500');
591
- toggleBg.querySelector('div').classList.remove('translate-x-5');
592
- }
593
- });
594
- });
595
- }
1
+ import{showToast,showConfirm}from"../notifications.js";import{showInstallLoadingModal,updateOverallInstallStatus}from"./loadingModal.js";import{uninstallTools}from"./installation.js";import{handleBulkClientInstall}from"./installation.js";import{compareVersions}from"./versionUtils.js";export function setupClientItems(e,t,n,s,a){e.forEach((e=>{const l=t.installedStatus[e]||{status:"not-installed",type:"check",target:"server"};let i="",o="";"completed"===l.status&&"install"===l.type?(i="Installed",o="installed"):"pending"===l.status?(i="Pending Requirements",o="pending"):"in-progress"===l.status?(i="In Progress",o="pending"):"failed"===l.status&&(i="Failed",o="not-installed");const r="completed"===l.status&&"install"===l.type,d="in-progress"===l.status,c=!r&&!d,m=createClientItem(e,i,o,c,r,d);setupClientItemListeners(m,e,c),setupUninstallButton(m,i,l,e,n,s,o),a.appendChild(m)})),addSectionTitle(a)}export function setupEnvironmentVariables(e,t,n){if("sse"===e.mode)return void(t.style.display="none");const s=e.installation?.env||e.installation?.env||{};addEnvironmentTitle(t),fetch("/api/settings").then((e=>e.json())).then((a=>{const l=a&&a.data&&a.data.userConfigurations?a.data.userConfigurations:{};0===Object.keys(s).length?addNoEnvMessage(t):createEnvironmentInputs(s,t,n.clientMcpSettings,e.name,l)})).catch((()=>{0===Object.keys(s).length?addNoEnvMessage(t):createEnvironmentInputs(s,t,n.clientMcpSettings,e.name,{})}))}export function setupInstallationArguments(e,t,n,s){if("sse"===s?.mode)return void(t.style.display="none");if(!e)return;addArgumentsTitle(t);const a=createArgumentsContainer();t.appendChild(a),e.args&&Array.isArray(e.args)?e.args.forEach((e=>{a.appendChild(createArgumentInput(e))})):a.appendChild(createArgumentInput()),("python"===e.command||e.command.includes("python"))&&addPythonEnvironmentInput(n,s.name,t)}export function setupServerRequirements(e,t,n,s,a){if("sse"===e.mode)return void(a.style.display="none");const l=e.dependencies?.requirements||[],i=t.data.installationStatus?.requirementsStatus||{};if(l.length>0){const e=renderRequirements(l,i,n,s);a.innerHTML=`\n <h3 class="text-lg font-semibold text-gray-700 mb-3">Dependencies</h3>\n <p class="text-sm text-gray-600 mb-4">These dependencies will be automatically installed when installing the server</p>\n ${e}\n `,setupUpdateToggles(a)}else a.innerHTML='<p class="text-gray-600">No additional dependencies required.</p>'}export function setupFormSubmitHandler(e,t,n,s,a,l,i,o,r){e.onsubmit=e=>{e.preventDefault();const d={},c=[],m=[];let u;if("sse"!==r?.mode){t.querySelectorAll("input").forEach((e=>{e.name&&e.value&&(d[e.name]=e.value)}));const e=n.querySelectorAll(".arg-input");c.push(...Array.from(e).map((e=>e.value.trim())).filter((e=>""!==e)));const a=document.getElementById("python_env");u=a?.value?.trim(),s.querySelectorAll(".toggle-update:checked").forEach((e=>{m.push({name:e.dataset.name,version:e.dataset.version})}))}function p(){const e=m.length>0,t=document.querySelector(".uninstall-btn");if(!t||!t.matches(":active")){const t=window.selectedClients;if(0===t.length&&!e)return void showToast("Please select at least one client to configure.","error");let n="Starting installation...";const s=i[l]||{installedStatus:{}};if(t.length>0){const e=t[0],a=s.installedStatus?.[e]?.message;a&&(n=a)}const r={targetClients:t,env:d,args:c,settings:u?{pythonEnv:u}:{}};m.length>0&&(r.requirements=m),handleBulkClientInstall(a,l,t,d,n,o,r)}}fetch("/api/settings").then((e=>e.json())).then((e=>{const t=e&&e.data&&e.data.userConfigurations?e.data.userConfigurations:{},n=e&&e.data&&e.data.pythonEnvs?e.data.pythonEnvs:{},s={...t},i={...n};Object.keys(d).forEach((e=>{s[e]=d[e]}));let o=!1;const r=new Set([...Object.keys(t),...Object.keys(d)]);for(const e of r)if(t[e]!==s[e]){o=!0;break}let c=!1;if(void 0!==u&&u!==n[`${a}:${l}`]&&(i[`${a}:${l}`]=u,c=!0),o||c){const e={};o&&(e.userConfigurations=s),c&&(e.pythonEnvs=i),fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then((()=>{p()})).catch((()=>{p()}))}else p()})).catch((()=>{p()}))}}function createClientItem(e,t,n,s,a,l){const i=document.createElement("div");i.className="client-item",i.dataset.target=e,i.dataset.selected="false";const o=document.createElement("div");o.className="client-info";const r=document.createElement("span");return r.className="text-sm font-medium text-gray-900",r.textContent=e,o.appendChild(r),i.appendChild(o),s||(i.classList.add("non-selectable"),a?(i.classList.add("installed-item"),i.title="Already installed"):l&&(i.classList.add("in-progress-item"),i.title="Installation in progress")),i}function setupClientItemListeners(e,t,n){n&&e.addEventListener("click",(()=>{const n="true"===e.dataset.selected;e.dataset.selected=n?"false":"true",n?(e.classList.remove("selected"),window.selectedClients=window.selectedClients.filter((e=>e!==t))):(e.classList.add("selected"),window.selectedClients.includes(t)||window.selectedClients.push(t))}))}function setupUninstallButton(e,t,n,s,a,l,i){if(t){const o=document.createElement("div");o.className="status-container";const r=document.createElement("span");if(r.className=`status-badge ${i}`,r.textContent=t,o.appendChild(r),"completed"===n.status&&"install"===n.type){const e=createUninstallButton(s,a,l);o.appendChild(e)}e.appendChild(o)}}function createUninstallButton(e,t,n){const s=document.createElement("button");return s.className="uninstall-btn text-red-600 hover:text-red-800 ml-2",s.innerHTML='<i class="bx bx-trash"></i>',s.title="Uninstall from this client",s.onclick=async s=>{if(s.stopPropagation(),s.preventDefault(),await showConfirm("Uninstall Confirmation",`Are you sure you want to uninstall ${n} from ${e}?`)){window.selectedClients=[e],showInstallLoadingModal("Uninstalling");const s={[n]:{removeData:!0}};try{updateOverallInstallStatus("in-progress",`Uninstalling ${n} from ${e}...`),await uninstallTools(t,s,[e])}catch(e){updateOverallInstallStatus("failed",`Error during uninstall: ${e.message}`)}}return!1},s}function addSectionTitle(e){if(!e.querySelector(".section-title")){const t=document.createElement("h3");t.className="section-title text-lg font-semibold text-gray-700 mb-3",t.textContent="Client Status",e.insertBefore(t,e.firstChild)}}function addEnvironmentTitle(e){if(!e.querySelector(".section-title")){const t=document.createElement("h3");t.className="section-title text-lg font-semibold text-gray-700 mb-3",t.textContent="Environment Variables",e.insertBefore(t,e.firstChild)}}function addNoEnvMessage(e){const t=document.createElement("p");t.className="text-gray-600",t.textContent="No environment variables required for this MCP server.",e.appendChild(t)}function createEnvironmentInputs(e,t,n,s,a={}){Object.keys(e).forEach((l=>{const i=e[l],o=`env_${l}`,r=document.createElement("div");r.className="mb-3";const d=document.createElement("label");d.htmlFor=o,d.className="block text-sm font-medium text-gray-700 mb-1",d.innerHTML=`${l} ${i.Required?'<span class="text-red-500">*</span>':""}`;const c=document.createElement("input");c.type=i.isSecret?"password":"text",c.id=o,c.name=l,c.placeholder=i.Description||l,c.required=i.Required,c.className="input-field";let m=i.Default||"";if(a&&a[l]?m=a[l]:n&&n.MSRooCode&&n.MSRooCode.mcpServers&&n.MSRooCode.mcpServers[s]&&n.MSRooCode.mcpServers[s].env&&n.MSRooCode.mcpServers[s].env[l]&&(m=n.MSRooCode.mcpServers[s].env[l]),c.value=m,r.appendChild(d),r.appendChild(c),i.Description){const e=document.createElement("p");e.className="text-xs text-gray-500 mt-1",e.textContent=i.Description,r.appendChild(e)}t.appendChild(r)}))}function addArgumentsTitle(e){const t=document.createElement("h3");t.className="section-title text-lg font-semibold text-gray-700 mb-3",t.textContent="Arguments",e.appendChild(t)}function createArgumentsContainer(){const e=document.createElement("div");e.className="args-container mb-3";const t=document.createElement("button");return t.type="button",t.className="add-arg-button px-3 py-1 text-sm text-blue-600 hover:text-blue-800 border border-blue-600 hover:border-blue-800 rounded-md mb-2",t.innerHTML='<i class="bx bx-plus"></i> Add Argument',t.onclick=()=>e.appendChild(createArgumentInput()),e.appendChild(t),e}function createArgumentInput(e=""){const t=document.createElement("div");t.className="arg-wrapper flex items-center gap-2 mb-2";const n=document.createElement("input");n.type="text",n.className="arg-input flex-grow",n.value=e,n.placeholder="Enter argument value";const s=document.createElement("button");return s.type="button",s.className="remove-arg-button text-red-600 hover:text-red-800",s.innerHTML='<i class="bx bx-trash"></i>',s.onclick=()=>t.remove(),t.appendChild(n),t.appendChild(s),t}function addPythonEnvironmentInput(e,t,n){const s=document.createElement("div");s.className="mt-4";const a=document.createElement("label");a.htmlFor="python_env",a.className="block text-sm font-medium text-gray-700 mb-1",a.textContent="Python Environment";const l=document.createElement("input");l.type="text",l.id="python_env",l.className="input-field",l.placeholder="Enter Python environment path (optional)";const i=document.createElement("p");i.className="text-xs text-gray-500 mt-1",i.textContent="Specify the Python exectable file(e.g. C:/python312/python) to use for installation. Leave empty to use system default. You can specify value in Settings page",s.appendChild(a),s.appendChild(l),s.appendChild(i),n.appendChild(s),fetch("/api/settings").then((e=>e.json())).then((n=>{n&&n.data&&n.data.pythonEnvs&&(l.value=n.data.pythonEnvs[`${e}:${t}`]||n.data.pythonEnvs.system||"")})).catch((()=>{}))}function renderRequirements(e,t,n,s){return e.map((e=>{const a=t[e.name]||{};let l=a.installed?"text-green-600 bg-green-50":"text-yellow-600 bg-yellow-50",i=a.installed?"Installed":"Required",o=a.version?` • <span class="font-medium">${a.version}</span>`:"",r="";return a.installed&&a.availableUpdate&&a.availableUpdate.version&&a.version&&compareVersions(a.availableUpdate.version,a.version)>0&&(l="text-yellow-600 bg-yellow-50",i=`<span style="color: #f59e0b; font-weight: bold; margin-right: 5px;">↑</span>${a.availableUpdate.version}`,r=`\n <label class="inline-flex items-center cursor-pointer ml-2">\n <input type="checkbox" class="toggle-update sr-only"\n data-name="${e.name}"\n data-version="${a.availableUpdate.version}"\n data-category="${n}"\n data-server="${s}">\n <div class="relative w-10 h-5 bg-gray-200 rounded-full toggle-bg">\n <div class="absolute inset-y-0 left-0 w-5 h-5 bg-white rounded-full transition-transform duration-300 transform"></div>\n </div>\n <span class="ml-2 text-sm text-gray-700">Update</span>\n </label>\n `),`\n <div class="border border-gray-200 p-3 rounded-lg mb-2 hover:bg-gray-50">\n <div class="flex justify-between items-center">\n <div>\n <div class="font-semibold text-gray-800">${e.name}</div>\n <div class="text-sm text-gray-600 shadow-sm p-1 rounded bg-gray-50">\n <span class="font-medium">${a.type||"package"}</span>${o}\n </div>\n </div>\n <div class="flex items-center">\n <span class="${l} inline-flex items-center px-3 py-1 rounded-full text-sm">\n ${i}\n </span>\n ${r}\n </div>\n </div>\n </div>\n `})).join("")}function setupUpdateToggles(e){e.querySelectorAll(".toggle-update").forEach((e=>{e.addEventListener("change",(function(){const e=this.parentElement.querySelector(".toggle-bg");this.checked?(e.classList.add("bg-blue-500"),e.querySelector("div").classList.add("translate-x-5")):(e.classList.remove("bg-blue-500"),e.querySelector("div").classList.remove("translate-x-5"))}))}))}
2
+ //# sourceMappingURL=modalSetup.js.map