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,127 +1,2 @@
1
- // Centralized flight control configuration
2
-
3
- const FLIGHT_STORAGE_KEY = 'activeFlightSettings';
4
-
5
- // Default flight settings
6
- const defaultFlights = {
7
- enableOnboard: true, // Default: Onboarding is enabled. Set to false to disable.
8
- // Add other default flights here, e.g., newFeatureX: false,
9
- };
10
-
11
- let effectiveFlightSettings = {};
12
-
13
- // Initialize flight settings
14
- function initializeFlightSettings() {
15
- const urlParams = new URLSearchParams(window.location.search);
16
- let settingsToStore = {};
17
- let sourcedFromUrl = false;
18
-
19
- // Check URL parameters first
20
- for (const key in defaultFlights) {
21
- if (urlParams.has(key)) {
22
- const paramValue = urlParams.get(key);
23
- settingsToStore[key] = (paramValue === 'true') ? true : (paramValue === 'false' ? false : paramValue);
24
- sourcedFromUrl = true;
25
- }
26
- }
27
-
28
- if (sourcedFromUrl) {
29
- // If any flight was set via URL, these override sessionStorage for this load
30
- // and then update sessionStorage.
31
- // Fill any missing flights with defaults before storing.
32
- for (const key in defaultFlights) {
33
- if (!Object.hasOwnProperty.call(settingsToStore, key)) {
34
- settingsToStore[key] = defaultFlights[key];
35
- }
36
- }
37
- try {
38
- sessionStorage.setItem(FLIGHT_STORAGE_KEY, JSON.stringify(settingsToStore));
39
- effectiveFlightSettings = settingsToStore;
40
- } catch (e) {
41
- console.error("Failed to write to sessionStorage:", e);
42
- effectiveFlightSettings = settingsToStore; // Use them anyway for this page load
43
- }
44
- } else {
45
- // No flight params in URL, try sessionStorage
46
- try {
47
- const storedSettings = sessionStorage.getItem(FLIGHT_STORAGE_KEY);
48
- if (storedSettings) {
49
- effectiveFlightSettings = JSON.parse(storedSettings);
50
- // Ensure all default keys are present, add if missing (e.g., new flight added)
51
- for (const key in defaultFlights) {
52
- if (!Object.hasOwnProperty.call(effectiveFlightSettings, key)) {
53
- effectiveFlightSettings[key] = defaultFlights[key];
54
- }
55
- }
56
- } else {
57
- // Not in sessionStorage, use defaults and store them
58
- effectiveFlightSettings = { ...defaultFlights };
59
- sessionStorage.setItem(FLIGHT_STORAGE_KEY, JSON.stringify(effectiveFlightSettings));
60
- }
61
- } catch (e) {
62
- console.error("Failed to read/write sessionStorage:", e);
63
- effectiveFlightSettings = { ...defaultFlights }; // Fallback to defaults
64
- }
65
- }
66
- }
67
-
68
- initializeFlightSettings();
69
-
70
- // The `flights` object provides these effective values.
71
- const flights = {};
72
- for (const key in defaultFlights) { // Iterate defaultFlights to define getters for all known flights
73
- if (Object.hasOwnProperty.call(defaultFlights, key)) {
74
- Object.defineProperty(flights, key, {
75
- get: () => effectiveFlightSettings[key] !== undefined ? effectiveFlightSettings[key] : defaultFlights[key],
76
- enumerable: true,
77
- configurable: false
78
- });
79
- }
80
- }
81
-
82
- /**
83
- * Helper to build a URLSearchParams object with the effective flight values.
84
- * @returns {URLSearchParams}
85
- */
86
- function _buildFlightParams() {
87
- const flightParams = new URLSearchParams();
88
- for (const flightName in effectiveFlightSettings) {
89
- if (Object.hasOwnProperty.call(effectiveFlightSettings, flightName)) {
90
- // Only add if it's a recognized flight from defaultFlights to avoid polluting URL
91
- // with unrelated sessionStorage items if FLIGHT_STORAGE_KEY was somehow corrupted.
92
- if (Object.hasOwnProperty.call(defaultFlights, flightName)) {
93
- flightParams.set(flightName, String(effectiveFlightSettings[flightName]));
94
- }
95
- }
96
- }
97
- return flightParams;
98
- }
99
-
100
- /**
101
- * Constructs a URL with the effective flight parameters and any additional parameters.
102
- * @param {string} baseUrl The base URL (e.g., "index.html").
103
- * @param {object} [additionalParams={}] - An object of additional key-value pairs to include.
104
- * @returns {string} A full URL with query string.
105
- */
106
- export function buildUrlWithFlights(baseUrl, additionalParams = {}) {
107
- const params = _buildFlightParams(); // Start with all effective flight values
108
-
109
- for (const key in additionalParams) {
110
- if (Object.hasOwnProperty.call(additionalParams, key) && additionalParams[key] !== undefined) {
111
- params.set(key, additionalParams[key]);
112
- }
113
- }
114
- const queryString = params.toString();
115
- return `${baseUrl}${queryString ? `?${queryString}` : ''}`;
116
- }
117
-
118
- /**
119
- * Gets a query string containing only the effective flight parameters.
120
- * @returns {string} A query string like "?enableOnboard=true" or empty.
121
- */
122
- export function getFlightQueryParameters() {
123
- const queryString = _buildFlightParams().toString();
124
- return queryString ? `?${queryString}` : '';
125
- }
126
-
127
- export default flights;
1
+ const FLIGHT_STORAGE_KEY="activeFlightSettings",defaultFlights={enableOnboard:!0};let effectiveFlightSettings={};function initializeFlightSettings(){const t=new URLSearchParams(window.location.search);let e={},i=!1;for(const s in defaultFlights)if(t.has(s)){const l=t.get(s);e[s]="true"===l||"false"!==l&&l,i=!0}if(i){for(const t in defaultFlights)Object.hasOwnProperty.call(e,t)||(e[t]=defaultFlights[t]);try{sessionStorage.setItem(FLIGHT_STORAGE_KEY,JSON.stringify(e)),effectiveFlightSettings=e}catch(t){effectiveFlightSettings=e}}else try{const t=sessionStorage.getItem(FLIGHT_STORAGE_KEY);if(t){effectiveFlightSettings=JSON.parse(t);for(const t in defaultFlights)Object.hasOwnProperty.call(effectiveFlightSettings,t)||(effectiveFlightSettings[t]=defaultFlights[t])}else effectiveFlightSettings={...defaultFlights},sessionStorage.setItem(FLIGHT_STORAGE_KEY,JSON.stringify(effectiveFlightSettings))}catch(t){effectiveFlightSettings={...defaultFlights}}}initializeFlightSettings();const flights={};for(const t in defaultFlights)Object.hasOwnProperty.call(defaultFlights,t)&&Object.defineProperty(flights,t,{get:()=>void 0!==effectiveFlightSettings[t]?effectiveFlightSettings[t]:defaultFlights[t],enumerable:!0,configurable:!1});function _buildFlightParams(){const t=new URLSearchParams;for(const e in effectiveFlightSettings)Object.hasOwnProperty.call(effectiveFlightSettings,e)&&Object.hasOwnProperty.call(defaultFlights,e)&&t.set(e,String(effectiveFlightSettings[e]));return t}export function buildUrlWithFlights(t,e={}){const i=_buildFlightParams();for(const t in e)Object.hasOwnProperty.call(e,t)&&void 0!==e[t]&&i.set(t,e[t]);const s=i.toString();return`${t}${s?`?${s}`:""}`}export function getFlightQueryParameters(){const t=_buildFlightParams().toString();return t?`?${t}`:""}export default flights;
2
+ //# sourceMappingURL=flights.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":[],"mappings":"","ignoreList":[]}
@@ -1,52 +1,2 @@
1
- // Import all modal-related functionality
2
- import { compareVersions } from './versionUtils.js';
3
- // import { delayedAppendInstallLoadingMessage } from './messageQueue.js'; // Removed
4
- import { showInstallLoadingModal, hideInstallLoadingModal, updateOverallInstallStatus, addInstallationStep } from './loadingModal.js'; // Removed appendInstallLoadingMessage, added new fns
5
- import { closeModal } from './modalUtils.js';
6
- import { handleBulkClientInstall, uninstallTools } from './installation.js';
7
- import { showInstallModal } from './installModal.js';
8
- import {
9
- setupClientItems,
10
- setupEnvironmentVariables,
11
- setupInstallationArguments,
12
- setupServerRequirements,
13
- setupFormSubmitHandler
14
- } from './modalSetup.js';
15
-
16
- // Export all modal functionality
17
- export {
18
- // Version utilities
19
- compareVersions,
20
-
21
- // Message queue - (delayedAppendInstallLoadingMessage removed)
22
-
23
- // Loading modal
24
- showInstallLoadingModal,
25
- // appendInstallLoadingMessage, // Removed
26
- hideInstallLoadingModal,
27
- updateOverallInstallStatus, // Added
28
- addInstallationStep, // Added
29
-
30
- // Modal utilities
31
- closeModal,
32
- // Installation
33
- handleBulkClientInstall,
34
- uninstallTools,
35
-
36
- // Install modal
37
- showInstallModal,
38
-
39
- // Modal setup
40
- setupClientItems,
41
- setupEnvironmentVariables,
42
- setupInstallationArguments,
43
- setupServerRequirements,
44
- setupFormSubmitHandler
45
- };
46
-
47
- // Make certain functions available globally
48
- window.showInstallModal = showInstallModal;
49
- window.showInstallLoadingModal = showInstallLoadingModal;
50
- // window.appendInstallLoadingMessage = appendInstallLoadingMessage; // Removed
51
- window.hideInstallLoadingModal = hideInstallLoadingModal;
52
- window.uninstallTools = uninstallTools;
1
+ import{compareVersions}from"./versionUtils.js";import{showInstallLoadingModal,hideInstallLoadingModal,updateOverallInstallStatus,addInstallationStep}from"./loadingModal.js";import{closeModal}from"./modalUtils.js";import{handleBulkClientInstall,uninstallTools}from"./installation.js";import{showInstallModal}from"./installModal.js";import{setupClientItems,setupEnvironmentVariables,setupInstallationArguments,setupServerRequirements,setupFormSubmitHandler}from"./modalSetup.js";export{compareVersions,showInstallLoadingModal,hideInstallLoadingModal,updateOverallInstallStatus,addInstallationStep,closeModal,handleBulkClientInstall,uninstallTools,showInstallModal,setupClientItems,setupEnvironmentVariables,setupInstallationArguments,setupServerRequirements,setupFormSubmitHandler};window.showInstallModal=showInstallModal,window.showInstallLoadingModal=showInstallLoadingModal,window.hideInstallLoadingModal=hideInstallLoadingModal,window.uninstallTools=uninstallTools;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":[],"mappings":"","ignoreList":[]}
@@ -1,162 +1,2 @@
1
- import { showToast, showConfirm } from '../notifications.js';
2
- import { compareVersions } from './versionUtils.js';
3
- // import { delayedAppendInstallLoadingMessage } from './messageQueue.js'; // No longer needed here
4
- import { showInstallLoadingModal } from './loadingModal.js';
5
- import { closeModal, setupToggleStyles } from './modalUtils.js';
6
- import { handleBulkClientInstall, uninstallTools } from './installation.js';
7
- import {
8
- setupClientItems,
9
- setupEnvironmentVariables,
10
- setupInstallationArguments,
11
- setupServerRequirements,
12
- setupFormSubmitHandler
13
- } from './modalSetup.js';
14
-
15
- // Initialize modal functionality when DOM is loaded
16
- document.addEventListener('DOMContentLoaded', () => {
17
- setupToggleStyles();
18
- });
19
-
20
- /**
21
- * Show install modal for MCP tools
22
- * @param {string} categoryName - The category name
23
- * @param {string} serverName - The server name
24
- * @param {Function} callback - Optional callback function
25
- */
26
- export async function showInstallModal(categoryName, serverName, callback) {
27
- console.log("Showing install modal for:", serverName);
28
-
29
- // Wait for a short delay to ensure modal is loaded
30
- await new Promise(resolve => setTimeout(resolve, 100));
31
-
32
- const modal = document.getElementById('installModal');
33
- if (!modal) {
34
- console.error('Modal container not found');
35
- return;
36
- }
37
-
38
- const title = modal.querySelector('#modalTitle');
39
- const envInputsDiv = modal.querySelector('#modalEnvInputs');
40
- const targetDiv = modal.querySelector('#modalTargets');
41
- const modalRequirements = modal.querySelector('#modalRequirements');
42
- const modalArguments = modal.querySelector('#modalArguments');
43
-
44
- // Global array to track selected clients
45
- window.selectedClients = [];
46
-
47
- // Verify all required modal elements exist
48
- if (!title || !envInputsDiv || !targetDiv || !modalRequirements || !modalArguments) {
49
- console.error('Required modal elements not found');
50
- return;
51
- }
52
-
53
- title.textContent = `Install ${serverName}`;
54
- envInputsDiv.innerHTML = ''; // Clear previous inputs
55
- targetDiv.innerHTML = ''; // Clear previous targets
56
- modalRequirements.innerHTML = ''; // Clear previous requirements
57
- modalArguments.innerHTML = ''; // Clear previous arguments
58
-
59
- try {
60
- // Fetch both targets and server data simultaneously
61
- const [targetResponse, serverResponse] = await Promise.all([
62
- fetch('/api/targets'),
63
- fetch(`/api/categories/${categoryName}`)
64
- ]);
65
-
66
- if (!targetResponse.ok || !serverResponse.ok) {
67
- throw new Error('Failed to fetch required data');
68
- }
69
-
70
- const [targetData, serverData] = await Promise.all([
71
- targetResponse.json(),
72
- serverResponse.json()
73
- ]);
74
-
75
- if (!targetData.success || !serverData.success) {
76
- throw new Error('Invalid data received');
77
- }
78
-
79
- const mcpServer = serverData.data.feedConfiguration.mcpServers.find(server => server.name === serverName);
80
- if (!mcpServer) {
81
- throw new Error('Server configuration not found');
82
- }
83
-
84
- // Add mode indicator
85
- const modeSpan = document.createElement('span');
86
- modeSpan.textContent = mcpServer.mode || 'stdio';
87
- modeSpan.className = 'ml-2 px-2 py-0.5 text-xs bg-gray-200 text-gray-600 rounded';
88
- title.appendChild(modeSpan);
89
- const installationStatus = serverData.data.installationStatus || {};
90
- const serverStatuses = installationStatus.serversStatus || {};
91
- const serverStatus = serverStatuses[serverName] || { installedStatus: {} };
92
-
93
- await setupModalContent(
94
- targetData,
95
- mcpServer,
96
- serverStatus,
97
- categoryName,
98
- serverName,
99
- serverStatuses,
100
- serverData,
101
- targetDiv,
102
- envInputsDiv,
103
- modalArguments,
104
- modalRequirements
105
- );
106
-
107
- } catch (error) {
108
- console.error("Error loading data:", error);
109
- targetDiv.innerHTML = `<p class="text-red-500">Error: ${error.message}</p>`;
110
- }
111
-
112
- modal.style.display = "block";
113
- }
114
-
115
- /**
116
- * Set up the modal content including client list, environment variables, and requirements
117
- * @private
118
- */
119
- async function setupModalContent(
120
- targetData,
121
- mcpServer,
122
- serverStatus,
123
- categoryName,
124
- serverName,
125
- serverStatuses,
126
- serverData,
127
- targetDiv,
128
- envInputsDiv,
129
- modalArguments,
130
- modalRequirements
131
- ) {
132
- // Create client items
133
- setupClientItems(targetData.data, serverStatus, categoryName, serverName, targetDiv);
134
-
135
- // Handle environment variables section
136
- setupEnvironmentVariables(mcpServer, envInputsDiv, targetData);
137
-
138
- // Handle installation arguments section
139
- setupInstallationArguments(mcpServer.installation, modalArguments, categoryName, mcpServer);
140
-
141
- // Handle server requirements section
142
- setupServerRequirements(mcpServer, serverData, categoryName, serverName, modalRequirements);
143
-
144
- // Set up the install form submit handler
145
- const installForm = document.getElementById('installForm');
146
- setupFormSubmitHandler(
147
- installForm,
148
- envInputsDiv,
149
- modalArguments,
150
- modalRequirements,
151
- categoryName,
152
- serverName,
153
- serverStatuses,
154
- serverData,
155
- mcpServer
156
- );
157
- }
158
-
159
- // Make functions available globally
160
- window.showInstallModal = showInstallModal;
161
- window.closeModal = closeModal;
162
- window.uninstallTools = uninstallTools;
1
+ import{showToast,showConfirm}from"../notifications.js";import{compareVersions}from"./versionUtils.js";import{showInstallLoadingModal}from"./loadingModal.js";import{closeModal,setupToggleStyles}from"./modalUtils.js";import{handleBulkClientInstall,uninstallTools}from"./installation.js";import{setupClientItems,setupEnvironmentVariables,setupInstallationArguments,setupServerRequirements,setupFormSubmitHandler}from"./modalSetup.js";document.addEventListener("DOMContentLoaded",(()=>{setupToggleStyles()}));export async function showInstallModal(t,e,o){await new Promise((t=>setTimeout(t,100)));const n=document.getElementById("installModal");if(!n)return;const s=n.querySelector("#modalTitle"),a=n.querySelector("#modalEnvInputs"),l=n.querySelector("#modalTargets"),r=n.querySelector("#modalRequirements"),i=n.querySelector("#modalArguments");if(window.selectedClients=[],s&&a&&l&&r&&i){s.textContent=`Install ${e}`,a.innerHTML="",l.innerHTML="",r.innerHTML="",i.innerHTML="";try{const[o,n]=await Promise.all([fetch("/api/targets"),fetch(`/api/categories/${t}`)]);if(!o.ok||!n.ok)throw new Error("Failed to fetch required data");const[d,m]=await Promise.all([o.json(),n.json()]);if(!d.success||!m.success)throw new Error("Invalid data received");const u=m.data.feedConfiguration.mcpServers.find((t=>t.name===e));if(!u)throw new Error("Server configuration not found");const c=document.createElement("span");c.textContent=u.mode||"stdio",c.className="ml-2 px-2 py-0.5 text-xs bg-gray-200 text-gray-600 rounded",s.appendChild(c);const p=(m.data.installationStatus||{}).serversStatus||{},w=p[e]||{installedStatus:{}};await setupModalContent(d,u,w,t,e,p,m,l,a,i,r)}catch(t){l.innerHTML=`<p class="text-red-500">Error: ${t.message}</p>`}n.style.display="block"}}async function setupModalContent(t,e,o,n,s,a,l,r,i,d,m){setupClientItems(t.data,o,n,s,r),setupEnvironmentVariables(e,i,t),setupInstallationArguments(e.installation,d,n,e),setupServerRequirements(e,l,n,s,m);const u=document.getElementById("installForm");setupFormSubmitHandler(u,i,d,m,n,s,a,l,e)}window.showInstallModal=showInstallModal,window.closeModal=closeModal,window.uninstallTools=uninstallTools;
2
+ //# sourceMappingURL=installModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["showToast","showConfirm"],"sources":["0"],"sourcesContent":["import { showToast, showConfirm } from '../notifications.js';\r\nimport { compareVersions } from './versionUtils.js';\r\n// import { delayedAppendInstallLoadingMessage } from './messageQueue.js'; // No longer needed here\r\nimport { showInstallLoadingModal } from './loadingModal.js';\r\nimport { closeModal, setupToggleStyles } from './modalUtils.js';\r\nimport { handleBulkClientInstall, uninstallTools } from './installation.js';\r\nimport {\r\n setupClientItems,\r\n setupEnvironmentVariables,\r\n setupInstallationArguments,\r\n setupServerRequirements,\r\n setupFormSubmitHandler\r\n} from './modalSetup.js';\r\n\r\n// Initialize modal functionality when DOM is loaded\r\ndocument.addEventListener('DOMContentLoaded', () => {\r\n setupToggleStyles();\r\n});\r\n\r\n/**\r\n * Show install modal for MCP tools\r\n * @param {string} categoryName - The category name\r\n * @param {string} serverName - The server name\r\n * @param {Function} callback - Optional callback function\r\n */\r\nexport async function showInstallModal(categoryName, serverName, callback) {\r\n console.log(\"Showing install modal for:\", serverName);\r\n\r\n // Wait for a short delay to ensure modal is loaded\r\n await new Promise(resolve => setTimeout(resolve, 100));\r\n\r\n const modal = document.getElementById('installModal');\r\n if (!modal) {\r\n console.error('Modal container not found');\r\n return;\r\n }\r\n\r\n const title = modal.querySelector('#modalTitle');\r\n const envInputsDiv = modal.querySelector('#modalEnvInputs');\r\n const targetDiv = modal.querySelector('#modalTargets');\r\n const modalRequirements = modal.querySelector('#modalRequirements');\r\n const modalArguments = modal.querySelector('#modalArguments');\r\n\r\n // Global array to track selected clients\r\n window.selectedClients = [];\r\n\r\n // Verify all required modal elements exist\r\n if (!title || !envInputsDiv || !targetDiv || !modalRequirements || !modalArguments) {\r\n console.error('Required modal elements not found');\r\n return;\r\n }\r\n\r\n title.textContent = `Install ${serverName}`;\r\n envInputsDiv.innerHTML = ''; // Clear previous inputs\r\n targetDiv.innerHTML = ''; // Clear previous targets\r\n modalRequirements.innerHTML = ''; // Clear previous requirements\r\n modalArguments.innerHTML = ''; // Clear previous arguments\r\n\r\n try {\r\n // Fetch both targets and server data simultaneously\r\n const [targetResponse, serverResponse] = await Promise.all([\r\n fetch('/api/targets'),\r\n fetch(`/api/categories/${categoryName}`)\r\n ]);\r\n\r\n if (!targetResponse.ok || !serverResponse.ok) {\r\n throw new Error('Failed to fetch required data');\r\n }\r\n\r\n const [targetData, serverData] = await Promise.all([\r\n targetResponse.json(),\r\n serverResponse.json()\r\n ]);\r\n\r\n if (!targetData.success || !serverData.success) {\r\n throw new Error('Invalid data received');\r\n }\r\n\r\n const mcpServer = serverData.data.feedConfiguration.mcpServers.find(server => server.name === serverName);\r\n if (!mcpServer) {\r\n throw new Error('Server configuration not found');\r\n }\r\n\r\n // Add mode indicator\r\n const modeSpan = document.createElement('span');\r\n modeSpan.textContent = mcpServer.mode || 'stdio';\r\n modeSpan.className = 'ml-2 px-2 py-0.5 text-xs bg-gray-200 text-gray-600 rounded';\r\n title.appendChild(modeSpan);\r\n const installationStatus = serverData.data.installationStatus || {};\r\n const serverStatuses = installationStatus.serversStatus || {};\r\n const serverStatus = serverStatuses[serverName] || { installedStatus: {} };\r\n\r\n await setupModalContent(\r\n targetData,\r\n mcpServer,\r\n serverStatus,\r\n categoryName,\r\n serverName,\r\n serverStatuses,\r\n serverData,\r\n targetDiv,\r\n envInputsDiv,\r\n modalArguments,\r\n modalRequirements\r\n );\r\n\r\n } catch (error) {\r\n console.error(\"Error loading data:\", error);\r\n targetDiv.innerHTML = `<p class=\"text-red-500\">Error: ${error.message}</p>`;\r\n }\r\n\r\n modal.style.display = \"block\";\r\n}\r\n\r\n/**\r\n * Set up the modal content including client list, environment variables, and requirements\r\n * @private\r\n */\r\nasync function setupModalContent(\r\n targetData,\r\n mcpServer,\r\n serverStatus,\r\n categoryName,\r\n serverName,\r\n serverStatuses,\r\n serverData,\r\n targetDiv,\r\n envInputsDiv,\r\n modalArguments,\r\n modalRequirements\r\n) {\r\n // Create client items\r\n setupClientItems(targetData.data, serverStatus, categoryName, serverName, targetDiv);\r\n\r\n // Handle environment variables section\r\n setupEnvironmentVariables(mcpServer, envInputsDiv, targetData);\r\n\r\n // Handle installation arguments section\r\n setupInstallationArguments(mcpServer.installation, modalArguments, categoryName, mcpServer);\r\n\r\n // Handle server requirements section\r\n setupServerRequirements(mcpServer, serverData, categoryName, serverName, modalRequirements);\r\n\r\n // Set up the install form submit handler\r\n const installForm = document.getElementById('installForm');\r\n setupFormSubmitHandler(\r\n installForm,\r\n envInputsDiv,\r\n modalArguments,\r\n modalRequirements,\r\n categoryName,\r\n serverName,\r\n serverStatuses,\r\n serverData,\r\n mcpServer\r\n );\r\n}\r\n\r\n// Make functions available globally\r\nwindow.showInstallModal = showInstallModal;\r\nwindow.closeModal = closeModal;\r\nwindow.uninstallTools = uninstallTools;"],"mappings":"OAASA,UAAWC,gBAAmB,6B","ignoreList":[]}
@@ -1,266 +1,2 @@
1
- // import { delayedAppendInstallLoadingMessage } from './messageQueue.js'; // No longer used directly for steps
2
- import { showInstallLoadingModal, updateOverallInstallStatus, addInstallationStep } 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
- // Store category and server name for potential refresh
23
- if (categoryName) {
24
- localStorage.setItem('lastSelectedCategory', categoryName);
25
- }
26
- if (serverName) {
27
- localStorage.setItem('lastSelectedServerName', serverName);
28
- }
29
-
30
- // If serverData is provided, extract the installing message from it (latest status)
31
- if (serverData?.data?.installationStatus?.serversStatus) {
32
- const serverStatuses = serverData.data.installationStatus.serversStatus;
33
- const serverStatus = serverStatuses[serverName] || { installedStatus: {} };
34
- if (targets?.length > 0) {
35
- const target = targets[0];
36
- const msg = serverStatus.installedStatus?.[target]?.message;
37
- if (msg) installingMessage = msg;
38
- }
39
- // Append the installing message for user visibility
40
- if (installingMessage && installingMessage !== "Starting installation...") {
41
- delayedAppendInstallLoadingMessage(installingMessage);
42
- }
43
- }
44
-
45
- showInstallLoadingModal(`Installing ${serverName}`); // Pass initial server name
46
- // delayedAppendInstallLoadingMessage(installingMessage); // Old way
47
-
48
- try {
49
- // delayedAppendInstallLoadingMessage("Installing, please wait..."); // Old way
50
-
51
- // Use serverInstallOptions if provided, otherwise build the traditional options
52
- const requestBody = {
53
- serverList: {
54
- [serverName]: serverInstallOptions || {
55
- targetClients: targets,
56
- env: envVars
57
- }
58
- }
59
- };
60
-
61
- const response = await fetch(`/api/categories/${categoryName}/install`, {
62
- method: 'POST',
63
- headers: {
64
- 'Content-Type': 'application/json',
65
- 'Accept': 'application/json'
66
- },
67
- body: JSON.stringify(requestBody)
68
- });
69
-
70
- console.log('[LoadingModal] fetch install response:', response);
71
-
72
- if (!response.ok) {
73
- const errorData = await response.text();
74
- // delayedAppendInstallLoadingMessage(`<span style="color:#f59e0b;">Failed: ${errorData || response.statusText}</span>`); // Old way
75
- updateOverallInstallStatus('failed', `Installation request failed: ${errorData || response.statusText}`);
76
- console.error('[LoadingModal] Failed:', errorData || response.statusText);
77
- throw new Error(`Installation failed: ${errorData || response.statusText}`);
78
- }
79
-
80
- const result = await response.json();
81
- console.log('[LoadingModal] install result:', result);
82
- if (!result.success) {
83
- // delayedAppendInstallLoadingMessage(`<span style="color:#f59e0b;">${result.error || 'Operation failed'}</span>`); // Old way
84
- updateOverallInstallStatus('failed', result.error || 'Installation operation failed to start.');
85
- console.error('[LoadingModal] Error:', result.error || 'Operation failed');
86
- throw new Error(result.error || 'Installation failed');
87
- }
88
-
89
- // Start polling for install status
90
- pollNewInstallStatus(categoryName, serverName, 2000); // New polling
91
- } catch (error) {
92
- console.error('[LoadingModal] Error applying configuration:', error);
93
- // delayedAppendInstallLoadingMessage(`<span style="color:red;">Error: ${error.message}</span>`); // Old way
94
- updateOverallInstallStatus('failed', `Error: ${error.message}`);
95
- }
96
- }
97
-
98
- /**
99
- * Poll install status using the new API endpoint for detailed steps.
100
- * @param {string} categoryName - The category name
101
- * @param {string} serverName - The server name
102
- * @param {number} interval - Polling interval in milliseconds
103
- */
104
- async function pollNewInstallStatus(categoryName, serverName, interval = 2000) {
105
- let completionMessageSent = false;
106
- const startTime = Date.now();
107
- const maxTimeout = 10 * 60 * 1000; // 10 minutes
108
-
109
- while (Date.now() - startTime < maxTimeout && !completionMessageSent) {
110
- try {
111
- const resp = await fetch(`/api/categories/${categoryName}/servers/${serverName}/installation/status`);
112
- if (resp.ok) {
113
- const result = await resp.json();
114
- if (result.success && result.data) {
115
- const { steps, overallStatus, error } = result.data;
116
-
117
- updateOverallInstallStatus(overallStatus, error || `Installation ${overallStatus}`);
118
-
119
- // Always update or insert each step, so UI stays in sync with backend
120
- steps.forEach(step => {
121
- addInstallationStep(step.name, step.message, step.status, step.timestamp);
122
- });
123
-
124
- if (overallStatus === 'completed' || overallStatus === 'failed') {
125
- completionMessageSent = true;
126
- // The hideInstallLoadingModal will be called by the user or after a timeout.
127
- // We can add a "Close" button or auto-close logic here if needed.
128
- // For now, just stop polling.
129
- // Ensure final status is displayed
130
- const finalMessage = overallStatus === 'completed' ?
131
- `Installation completed successfully for ${serverName}.` :
132
- `Installation failed for ${serverName}`;
133
- updateOverallInstallStatus(overallStatus, finalMessage);
134
- return;
135
- }
136
- } else if (!result.success && resp.status === 404) {
137
- // Still waiting for the status file to be created.
138
- updateOverallInstallStatus('in-progress', `Waiting for installation to start for ${serverName}...`);
139
- } else if (!result.success) {
140
- updateOverallInstallStatus('failed', `Error fetching status: ${result.error || 'Unknown error'}`);
141
- completionMessageSent = true; // Stop polling on error
142
- return;
143
- }
144
- } else if (resp.status === 404) {
145
- updateOverallInstallStatus('in-progress', `Installation status not yet available for ${serverName}. Retrying...`);
146
- } else {
147
- const errorText = await resp.text();
148
- updateOverallInstallStatus('failed', `Error fetching status: ${errorText || resp.statusText}`);
149
- completionMessageSent = true; // Stop polling on error
150
- return;
151
- }
152
- } catch (error) {
153
- console.error('[LoadingModal] Error polling new install status:', error);
154
- updateOverallInstallStatus('failed', `Error polling status: ${error.message}`);
155
- completionMessageSent = true; // Stop polling on error
156
- return;
157
- }
158
- await new Promise(resolve => setTimeout(resolve, interval));
159
- }
160
-
161
- if (!completionMessageSent) {
162
- updateOverallInstallStatus('failed', `Operation timed out for ${serverName} - Please check logs or refresh.`);
163
- }
164
- }
165
-
166
- /**
167
- * Handle client uninstallation for multiple targets
168
- * @param {string} categoryName - The category name
169
- * @param {Object} serverList - List of servers to uninstall
170
- * @param {string[]} targets - Target clients
171
- */
172
- export async function uninstallTools(categoryName, serverList, targets) {
173
-
174
- console.log('[LoadingModal] uninstallTools called', { categoryName, serverList, targets });
175
- // Store category and server name for potential refresh
176
- if (categoryName) {
177
- console.log('[LoadingModal] Setting lastSelectedCategory:', categoryName);
178
- localStorage.setItem('lastSelectedCategory', categoryName);
179
- }
180
-
181
- // Get selected targets from window.selectedClients or the provided targets
182
- const selectedTargets = window.selectedClients || (Array.isArray(targets) ? targets : [targets]);
183
-
184
- // Validate selected targets
185
- if (!selectedTargets || selectedTargets.length === 0) {
186
- showToast('Please select at least one client to uninstall.', 'error');
187
- return;
188
- }
189
-
190
- // Ensure showInstallLoadingModal is called if not already visible,
191
- // or ensure overall status is updated if it is.
192
- // For simplicity, we assume the modal is shown by the caller (e.g., modalSetup.js)
193
- // Add uninstall started step
194
- if (typeof addInstallationStep === 'function') {
195
- addInstallationStep(
196
- 'Uninstalling',
197
- `Uninstallation process started for ${Object.keys(serverList).join(', ')}`,
198
- 'in-progress',
199
- new Date().toISOString()
200
- );
201
- }
202
- updateOverallInstallStatus('in-progress', `Starting uninstallation for ${Object.keys(serverList).join(', ')}...`);
203
-
204
- try {
205
- const serverListKeys = Object.keys(serverList);
206
- serverListKeys.forEach(server => {
207
- console.log('[LoadingModal] Setting lastSelectedServerName:', server);
208
- localStorage.setItem('lastSelectedServerName', server);
209
- });
210
-
211
- const response = await fetch(`/api/categories/${categoryName}/uninstall`, {
212
- method: 'POST',
213
- headers: { 'Content-Type': 'application/json' },
214
- body: JSON.stringify({
215
- serverList: serverList,
216
- options: {
217
- targets: selectedTargets,
218
- removeData: true
219
- }
220
- })
221
- });
222
-
223
- if (!response.ok) {
224
- const errorData = await response.text();
225
- updateOverallInstallStatus('failed', `Uninstallation request failed: ${errorData || response.statusText}`);
226
- throw new Error(`Uninstallation failed: ${errorData || response.statusText}`);
227
- }
228
-
229
- const result = await response.json();
230
- if (!result.success) {
231
- updateOverallInstallStatus('failed', `Uninstallation failed: ${result.error || 'Operation failed'}`);
232
- throw new Error(result.error || 'Uninstallation failed');
233
- }
234
-
235
- // Add uninstall finished step with 1s delay before updating overall status
236
- if (typeof addInstallationStep === 'function') {
237
- await new Promise(resolve => setTimeout(resolve, 1000));
238
- addInstallationStep(
239
- 'Uninstalling',
240
- `Uninstallation process finished for ${Object.keys(serverList).join(', ')}`,
241
- 'completed',
242
- new Date().toISOString()
243
- );
244
- await new Promise(resolve => setTimeout(resolve, 1000));
245
- addInstallationStep(
246
- 'Uninstall Finished',
247
- `Uninstallation finished for ${Object.keys(serverList).join(', ')}`,
248
- 'completed',
249
- new Date().toISOString()
250
- );
251
- }
252
- await new Promise(resolve => setTimeout(resolve, 1000));
253
- updateOverallInstallStatus('completed', `Successfully uninstalled from ${selectedTargets.join(', ')}.`);
254
- window.selectedClients = []; // Clear selected clients
255
-
256
- } catch (error) {
257
- console.error('Error uninstalling tools:', error);
258
- // The status should have been updated by the specific error handlers above.
259
- // If an error occurs before those, update status here.
260
- const overallStatusTextEl = document.getElementById('overallStatusText'); // Check if element exists
261
- if (overallStatusTextEl && overallStatusTextEl.textContent.startsWith('Starting uninstallation')) {
262
- updateOverallInstallStatus('failed', `Error uninstalling tools: ${error.message}`);
263
- }
264
- showToast(`Error uninstalling tools: ${error.message}`, 'error');
265
- }
266
- }
1
+ import{showInstallLoadingModal,updateOverallInstallStatus,addInstallationStep}from"./loadingModal.js";import{showToast}from"../notifications.js";export async function handleBulkClientInstall(t,a,e,s={},l="Starting installation...",n=null,o=null){const i=document.getElementById("installModal");if(i&&(i.style.display="none"),t&&localStorage.setItem("lastSelectedCategory",t),a&&localStorage.setItem("lastSelectedServerName",a),n?.data?.installationStatus?.serversStatus){const t=n.data.installationStatus.serversStatus[a]||{installedStatus:{}};if(e?.length>0){const a=e[0],s=t.installedStatus?.[a]?.message;s&&(l=s)}l&&"Starting installation..."!==l&&delayedAppendInstallLoadingMessage(l)}showInstallLoadingModal(`Installing ${a}`);try{const l={serverList:{[a]:o||{targetClients:e,env:s}}},n=await fetch(`/api/categories/${t}/install`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(l)});if(!n.ok){const t=await n.text();throw updateOverallInstallStatus("failed",`Installation request failed: ${t||n.statusText}`),new Error(`Installation failed: ${t||n.statusText}`)}const i=await n.json();if(!i.success)throw updateOverallInstallStatus("failed",i.error||"Installation operation failed to start."),new Error(i.error||"Installation failed");pollNewInstallStatus(t,a,2e3)}catch(t){updateOverallInstallStatus("failed",`Error: ${t.message}`)}}async function pollNewInstallStatus(t,a,e=2e3){let s=!1;const l=Date.now();for(;Date.now()-l<6e5&&!s;){try{const e=await fetch(`/api/categories/${t}/servers/${a}/installation/status`);if(e.ok){const t=await e.json();if(t.success&&t.data){const{steps:e,overallStatus:l,error:n}=t.data;if(updateOverallInstallStatus(l,n||`Installation ${l}`),e.forEach((t=>{addInstallationStep(t.name,t.message,t.status,t.timestamp)})),"completed"===l||"failed"===l)return s=!0,void updateOverallInstallStatus(l,"completed"===l?`Installation completed successfully for ${a}.`:`Installation failed for ${a}`)}else if(t.success||404!==e.status){if(!t.success)return updateOverallInstallStatus("failed",`Error fetching status: ${t.error||"Unknown error"}`),void(s=!0)}else updateOverallInstallStatus("in-progress",`Waiting for installation to start for ${a}...`)}else{if(404!==e.status){const t=await e.text();return updateOverallInstallStatus("failed",`Error fetching status: ${t||e.statusText}`),void(s=!0)}updateOverallInstallStatus("in-progress",`Installation status not yet available for ${a}. Retrying...`)}}catch(t){return updateOverallInstallStatus("failed",`Error polling status: ${t.message}`),void(s=!0)}await new Promise((t=>setTimeout(t,e)))}s||updateOverallInstallStatus("failed",`Operation timed out for ${a} - Please check logs or refresh.`)}export async function uninstallTools(t,a,e){t&&localStorage.setItem("lastSelectedCategory",t);const s=window.selectedClients||(Array.isArray(e)?e:[e]);if(s&&0!==s.length){"function"==typeof addInstallationStep&&addInstallationStep("Uninstalling",`Uninstallation process started for ${Object.keys(a).join(", ")}`,"in-progress",(new Date).toISOString()),updateOverallInstallStatus("in-progress",`Starting uninstallation for ${Object.keys(a).join(", ")}...`);try{Object.keys(a).forEach((t=>{localStorage.setItem("lastSelectedServerName",t)}));const e=await fetch(`/api/categories/${t}/uninstall`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serverList:a,options:{targets:s,removeData:!0}})});if(!e.ok){const t=await e.text();throw updateOverallInstallStatus("failed",`Uninstallation request failed: ${t||e.statusText}`),new Error(`Uninstallation failed: ${t||e.statusText}`)}const l=await e.json();if(!l.success)throw updateOverallInstallStatus("failed",`Uninstallation failed: ${l.error||"Operation failed"}`),new Error(l.error||"Uninstallation failed");"function"==typeof addInstallationStep&&(await new Promise((t=>setTimeout(t,1e3))),addInstallationStep("Uninstalling",`Uninstallation process finished for ${Object.keys(a).join(", ")}`,"completed",(new Date).toISOString()),await new Promise((t=>setTimeout(t,1e3))),addInstallationStep("Uninstall Finished",`Uninstallation finished for ${Object.keys(a).join(", ")}`,"completed",(new Date).toISOString())),await new Promise((t=>setTimeout(t,1e3))),updateOverallInstallStatus("completed",`Successfully uninstalled from ${s.join(", ")}.`),window.selectedClients=[]}catch(t){const a=document.getElementById("overallStatusText");a&&a.textContent.startsWith("Starting uninstallation")&&updateOverallInstallStatus("failed",`Error uninstalling tools: ${t.message}`),showToast(`Error uninstalling tools: ${t.message}`,"error")}}else showToast("Please select at least one client to uninstall.","error")}
2
+ //# sourceMappingURL=installation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":[],"mappings":"","ignoreList":[]}