imcp 0.1.6 → 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.
- package/dist/cli/commands/install.js +1 -106
- package/dist/cli/commands/install.js.map +1 -0
- package/dist/cli/commands/list.js +1 -90
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/pull.js +1 -16
- package/dist/cli/commands/pull.js.map +1 -0
- package/dist/cli/commands/serve.js +1 -33
- package/dist/cli/commands/serve.js.map +1 -0
- package/dist/cli/commands/uninstall.js +1 -46
- package/dist/cli/commands/uninstall.js.map +1 -0
- package/dist/cli/index.js +1 -65
- package/dist/cli/index.js.map +1 -0
- package/dist/core/installers/clients/BaseClientInstaller.js +1 -282
- package/dist/core/installers/clients/BaseClientInstaller.js.map +1 -0
- package/dist/core/installers/clients/ClientInstaller.js +1 -163
- package/dist/core/installers/clients/ClientInstaller.js.map +1 -0
- package/dist/core/installers/clients/ClientInstallerFactory.js +1 -36
- package/dist/core/installers/clients/ClientInstallerFactory.js.map +1 -0
- package/dist/core/installers/clients/ClineInstaller.js +1 -30
- package/dist/core/installers/clients/ClineInstaller.js.map +1 -0
- package/dist/core/installers/clients/ExtensionInstaller.js +1 -151
- package/dist/core/installers/clients/ExtensionInstaller.js.map +1 -0
- package/dist/core/installers/clients/GithubCopilotInstaller.js +1 -68
- package/dist/core/installers/clients/GithubCopilotInstaller.js.map +1 -0
- package/dist/core/installers/clients/MSRooCodeInstaller.js +1 -28
- package/dist/core/installers/clients/MSRooCodeInstaller.js.map +1 -0
- package/dist/core/installers/index.js +1 -8
- package/dist/core/installers/index.js.map +1 -0
- package/dist/core/installers/requirements/BaseInstaller.js +1 -56
- package/dist/core/installers/requirements/BaseInstaller.js.map +1 -0
- package/dist/core/installers/requirements/CommandInstaller.js +1 -213
- package/dist/core/installers/requirements/CommandInstaller.js.map +1 -0
- package/dist/core/installers/requirements/GeneralInstaller.js +1 -126
- package/dist/core/installers/requirements/GeneralInstaller.js.map +1 -0
- package/dist/core/installers/requirements/InstallerFactory.js +1 -99
- package/dist/core/installers/requirements/InstallerFactory.js.map +1 -0
- package/dist/core/installers/requirements/NpmInstaller.js +1 -235
- package/dist/core/installers/requirements/NpmInstaller.js.map +1 -0
- package/dist/core/installers/requirements/NugetInstaller.js +1 -188
- package/dist/core/installers/requirements/NugetInstaller.js.map +1 -0
- package/dist/core/installers/requirements/PipInstaller.js +1 -192
- package/dist/core/installers/requirements/PipInstaller.js.map +1 -0
- package/dist/core/installers/requirements/RequirementInstaller.js +1 -2
- package/dist/core/installers/requirements/RequirementInstaller.js.map +1 -0
- package/dist/core/loaders/ConfigurationLoader.js +1 -256
- package/dist/core/loaders/ConfigurationLoader.js.map +1 -0
- package/dist/core/loaders/ConfigurationProvider.js +1 -383
- package/dist/core/loaders/ConfigurationProvider.js.map +1 -0
- package/dist/core/loaders/InstallOperationManager.js +1 -310
- package/dist/core/loaders/InstallOperationManager.js.map +1 -0
- package/dist/core/loaders/ServerSchemaLoader.js +1 -108
- package/dist/core/loaders/ServerSchemaLoader.js.map +1 -0
- package/dist/core/loaders/ServerSchemaProvider.js +1 -89
- package/dist/core/loaders/ServerSchemaProvider.js.map +1 -0
- package/dist/core/loaders/SystemSettingsManager.js +1 -256
- package/dist/core/loaders/SystemSettingsManager.js.map +1 -0
- package/dist/core/metadatas/constants.js +1 -100
- package/dist/core/metadatas/constants.js.map +1 -0
- package/dist/core/metadatas/recordingConstants.js +1 -46
- package/dist/core/metadatas/recordingConstants.js.map +1 -0
- package/dist/core/metadatas/types.js +1 -15
- package/dist/core/metadatas/types.js.map +1 -0
- package/dist/core/onboard/FeedOnboardService.js +1 -422
- package/dist/core/onboard/FeedOnboardService.js.map +1 -0
- package/dist/core/onboard/OnboardProcessor.js +1 -333
- package/dist/core/onboard/OnboardProcessor.js.map +1 -0
- package/dist/core/onboard/OnboardStatus.js +1 -9
- package/dist/core/onboard/OnboardStatus.js.map +1 -0
- package/dist/core/onboard/OnboardStatusManager.js +1 -360
- package/dist/core/onboard/OnboardStatusManager.js.map +1 -0
- package/dist/core/validators/FeedValidator.js +1 -133
- package/dist/core/validators/FeedValidator.js.map +1 -0
- package/dist/core/validators/IServerValidator.js +1 -1
- package/dist/core/validators/IServerValidator.js.map +1 -0
- package/dist/core/validators/SSEServerValidator.js +1 -38
- package/dist/core/validators/SSEServerValidator.js.map +1 -0
- package/dist/core/validators/ServerValidatorFactory.js +1 -44
- package/dist/core/validators/ServerValidatorFactory.js.map +1 -0
- package/dist/core/validators/StdioServerValidator.js +1 -281
- package/dist/core/validators/StdioServerValidator.js.map +1 -0
- package/dist/index.js +1 -18
- package/dist/index.js.map +1 -0
- package/dist/services/InstallationService.js +1 -81
- package/dist/services/InstallationService.js.map +1 -0
- package/dist/services/MCPManager.js +1 -197
- package/dist/services/MCPManager.js.map +1 -0
- package/dist/services/RequirementService.js +1 -548
- package/dist/services/RequirementService.js.map +1 -0
- package/dist/services/ServerService.js +1 -127
- package/dist/services/ServerService.js.map +1 -0
- package/dist/services/TelemetryService.js +1 -53
- package/dist/services/TelemetryService.js.map +1 -0
- package/dist/utils/UpdateCheckTracker.js +1 -79
- package/dist/utils/UpdateCheckTracker.js.map +1 -0
- package/dist/utils/adoUtils.js +1 -254
- package/dist/utils/adoUtils.js.map +1 -0
- package/dist/utils/clientUtils.js +1 -65
- package/dist/utils/clientUtils.js.map +1 -0
- package/dist/utils/feedUtils.js +1 -28
- package/dist/utils/feedUtils.js.map +1 -0
- package/dist/utils/githubAuth.js +1 -177
- package/dist/utils/githubAuth.js.map +1 -0
- package/dist/utils/githubUtils.js +1 -125
- package/dist/utils/githubUtils.js.map +1 -0
- package/dist/utils/logger.js +1 -176
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/macroExpressionUtils.js +1 -93
- package/dist/utils/macroExpressionUtils.js.map +1 -0
- package/dist/utils/osUtils.js +1 -664
- package/dist/utils/osUtils.js.map +1 -0
- package/dist/utils/versionUtils.js +1 -101
- package/dist/utils/versionUtils.js.map +1 -0
- package/dist/web/contract/serverContract.js +1 -1
- package/dist/web/contract/serverContract.js.map +1 -0
- package/dist/web/public/js/api.js +2 -132
- package/dist/web/public/js/api.js.map +1 -0
- package/dist/web/public/js/detailsWidget.js +2 -264
- package/dist/web/public/js/detailsWidget.js.map +1 -0
- package/dist/web/public/js/flights/flights.js +2 -127
- package/dist/web/public/js/flights/flights.js.map +1 -0
- package/dist/web/public/js/modal/index.js +2 -52
- package/dist/web/public/js/modal/index.js.map +1 -0
- package/dist/web/public/js/modal/installModal.js +2 -162
- package/dist/web/public/js/modal/installModal.js.map +1 -0
- package/dist/web/public/js/modal/installation.js +2 -266
- package/dist/web/public/js/modal/installation.js.map +1 -0
- package/dist/web/public/js/modal/loadingModal.js +2 -182
- package/dist/web/public/js/modal/loadingModal.js.map +1 -0
- package/dist/web/public/js/modal/modalSetup.js +2 -595
- package/dist/web/public/js/modal/modalSetup.js.map +1 -0
- package/dist/web/public/js/modal/modalUtils.js +2 -37
- package/dist/web/public/js/modal/modalUtils.js.map +1 -0
- package/dist/web/public/js/modal/versionUtils.js +2 -20
- package/dist/web/public/js/modal/versionUtils.js.map +1 -0
- package/dist/web/public/js/modal.js +2 -42
- package/dist/web/public/js/modal.js.map +1 -0
- package/dist/web/public/js/notifications.js +2 -137
- package/dist/web/public/js/notifications.js.map +1 -0
- package/dist/web/public/js/onboard/formProcessor.js +2 -1037
- package/dist/web/public/js/onboard/formProcessor.js.map +1 -0
- package/dist/web/public/js/onboard/index.js +2 -374
- package/dist/web/public/js/onboard/index.js.map +1 -0
- package/dist/web/public/js/onboard/publishHandler.js +2 -172
- package/dist/web/public/js/onboard/publishHandler.js.map +1 -0
- package/dist/web/public/js/onboard/state.js +2 -76
- package/dist/web/public/js/onboard/state.js.map +1 -0
- package/dist/web/public/js/onboard/templates.js +2 -342
- package/dist/web/public/js/onboard/templates.js.map +1 -0
- package/dist/web/public/js/onboard/uiHandlers.js +2 -1076
- package/dist/web/public/js/onboard/uiHandlers.js.map +1 -0
- package/dist/web/public/js/onboard/validationHandlers.js +2 -493
- package/dist/web/public/js/onboard/validationHandlers.js.map +1 -0
- package/dist/web/public/js/serverCategoryDetails.js +2 -364
- package/dist/web/public/js/serverCategoryDetails.js.map +1 -0
- package/dist/web/public/js/serverCategoryList.js +2 -241
- package/dist/web/public/js/serverCategoryList.js.map +1 -0
- package/dist/web/public/js/settings.js +2 -314
- package/dist/web/public/js/settings.js.map +1 -0
- package/dist/web/server.js +1 -404
- package/dist/web/server.js.map +1 -0
- package/package.json +8 -2
- package/.github/ISSUE_TEMPLATE/JitAccess.yml +0 -28
- package/.github/acl/access.yml +0 -20
- package/.github/compliance/inventory.yml +0 -5
- package/.github/policies/jit.yml +0 -19
- package/.github/workflows/build.yml +0 -28
- package/.roo/rules-code/rules.md +0 -88
- package/dist/cli/commands/start.d.ts +0 -2
- package/dist/cli/commands/start.js +0 -32
- package/dist/cli/commands/sync.d.ts +0 -2
- package/dist/cli/commands/sync.js +0 -17
- package/dist/core/ConfigurationLoader.d.ts +0 -32
- package/dist/core/ConfigurationLoader.js +0 -236
- package/dist/core/ConfigurationProvider.d.ts +0 -35
- package/dist/core/ConfigurationProvider.js +0 -375
- package/dist/core/InstallationService.d.ts +0 -50
- package/dist/core/InstallationService.js +0 -350
- package/dist/core/MCPManager.d.ts +0 -28
- package/dist/core/MCPManager.js +0 -188
- package/dist/core/RequirementService.d.ts +0 -40
- package/dist/core/RequirementService.js +0 -110
- package/dist/core/ServerSchemaLoader.d.ts +0 -11
- package/dist/core/ServerSchemaLoader.js +0 -43
- package/dist/core/ServerSchemaProvider.d.ts +0 -17
- package/dist/core/ServerSchemaProvider.js +0 -120
- package/dist/core/constants.d.ts +0 -47
- package/dist/core/constants.js +0 -94
- package/dist/core/installers/BaseInstaller.d.ts +0 -74
- package/dist/core/installers/BaseInstaller.js +0 -253
- package/dist/core/installers/ClientInstaller.d.ts +0 -23
- package/dist/core/installers/ClientInstaller.js +0 -564
- package/dist/core/installers/CommandInstaller.d.ts +0 -37
- package/dist/core/installers/CommandInstaller.js +0 -173
- package/dist/core/installers/GeneralInstaller.d.ts +0 -33
- package/dist/core/installers/GeneralInstaller.js +0 -85
- package/dist/core/installers/InstallerFactory.d.ts +0 -54
- package/dist/core/installers/InstallerFactory.js +0 -97
- package/dist/core/installers/NpmInstaller.d.ts +0 -26
- package/dist/core/installers/NpmInstaller.js +0 -127
- package/dist/core/installers/PipInstaller.d.ts +0 -28
- package/dist/core/installers/PipInstaller.js +0 -127
- package/dist/core/installers/RequirementInstaller.d.ts +0 -33
- package/dist/core/installers/RequirementInstaller.js +0 -3
- package/dist/core/types.d.ts +0 -166
- package/dist/core/types.js +0 -16
- package/dist/services/InstallRequestValidator.d.ts +0 -21
- package/dist/services/InstallRequestValidator.js +0 -99
- package/dist/web/public/js/modal/installHandler.js +0 -227
- package/dist/web/public/js/modal/loadingUI.js +0 -74
- package/dist/web/public/js/modal/messageQueue.js +0 -112
- package/dist/web/public/js/modal/modalUI.js +0 -214
- package/dist/web/public/js/modal/version.js +0 -20
- package/dist/web/public/js/onboard/ONBOARDING_PAGE_DESIGN.md +0 -370
- package/docs/ONBOARDING_PAGE_DESIGN.md +0 -260
- package/docs/Telemetry.md +0 -136
- package/memory-bank/activeContext.md +0 -26
- package/memory-bank/decisionLog.md +0 -91
- package/memory-bank/productContext.md +0 -41
- package/memory-bank/progress.md +0 -35
- package/memory-bank/systemPatterns.md +0 -10
- package/src/cli/commands/install.ts +0 -139
- package/src/cli/commands/list.ts +0 -113
- package/src/cli/commands/pull.ts +0 -16
- package/src/cli/commands/serve.ts +0 -39
- package/src/cli/commands/uninstall.ts +0 -64
- package/src/cli/index.ts +0 -82
- package/src/core/installers/clients/BaseClientInstaller.ts +0 -341
- package/src/core/installers/clients/ClientInstaller.ts +0 -222
- package/src/core/installers/clients/ClientInstallerFactory.ts +0 -43
- package/src/core/installers/clients/ClineInstaller.ts +0 -35
- package/src/core/installers/clients/ExtensionInstaller.ts +0 -165
- package/src/core/installers/clients/GithubCopilotInstaller.ts +0 -79
- package/src/core/installers/clients/MSRooCodeInstaller.ts +0 -32
- package/src/core/installers/index.ts +0 -11
- package/src/core/installers/requirements/BaseInstaller.ts +0 -85
- package/src/core/installers/requirements/CommandInstaller.ts +0 -231
- package/src/core/installers/requirements/GeneralInstaller.ts +0 -133
- package/src/core/installers/requirements/InstallerFactory.ts +0 -114
- package/src/core/installers/requirements/NpmInstaller.ts +0 -271
- package/src/core/installers/requirements/NugetInstaller.ts +0 -203
- package/src/core/installers/requirements/PipInstaller.ts +0 -207
- package/src/core/installers/requirements/RequirementInstaller.ts +0 -42
- package/src/core/loaders/ConfigurationLoader.ts +0 -298
- package/src/core/loaders/ConfigurationProvider.ts +0 -462
- package/src/core/loaders/InstallOperationManager.ts +0 -367
- package/src/core/loaders/ServerSchemaLoader.ts +0 -117
- package/src/core/loaders/ServerSchemaProvider.ts +0 -99
- package/src/core/loaders/SystemSettingsManager.ts +0 -278
- package/src/core/metadatas/constants.ts +0 -122
- package/src/core/metadatas/recordingConstants.ts +0 -65
- package/src/core/metadatas/types.ts +0 -202
- package/src/core/onboard/FeedOnboardService.ts +0 -501
- package/src/core/onboard/OnboardProcessor.ts +0 -356
- package/src/core/onboard/OnboardStatus.ts +0 -60
- package/src/core/onboard/OnboardStatusManager.ts +0 -416
- package/src/core/validators/FeedValidator.ts +0 -135
- package/src/core/validators/IServerValidator.ts +0 -21
- package/src/core/validators/SSEServerValidator.ts +0 -43
- package/src/core/validators/ServerValidatorFactory.ts +0 -51
- package/src/core/validators/StdioServerValidator.ts +0 -313
- package/src/index.ts +0 -44
- package/src/services/InstallationService.ts +0 -102
- package/src/services/MCPManager.ts +0 -249
- package/src/services/RequirementService.ts +0 -627
- package/src/services/ServerService.ts +0 -161
- package/src/services/TelemetryService.ts +0 -59
- package/src/utils/UpdateCheckTracker.ts +0 -86
- package/src/utils/adoUtils.ts +0 -293
- package/src/utils/clientUtils.ts +0 -72
- package/src/utils/feedUtils.ts +0 -31
- package/src/utils/githubAuth.ts +0 -212
- package/src/utils/githubUtils.ts +0 -164
- package/src/utils/logger.ts +0 -195
- package/src/utils/macroExpressionUtils.ts +0 -104
- package/src/utils/osUtils.ts +0 -700
- package/src/utils/versionUtils.ts +0 -114
- package/src/web/contract/serverContract.ts +0 -74
- package/src/web/public/css/detailsWidget.css +0 -235
- package/src/web/public/css/modal.css +0 -757
- package/src/web/public/css/notifications.css +0 -101
- package/src/web/public/css/onboard.css +0 -107
- package/src/web/public/css/serverCategoryList.css +0 -120
- package/src/web/public/css/serverDetails.css +0 -139
- package/src/web/public/index.html +0 -359
- package/src/web/public/js/api.js +0 -132
- package/src/web/public/js/detailsWidget.js +0 -264
- package/src/web/public/js/flights/flights.js +0 -127
- package/src/web/public/js/modal/index.js +0 -52
- package/src/web/public/js/modal/installModal.js +0 -162
- package/src/web/public/js/modal/installation.js +0 -266
- package/src/web/public/js/modal/loadingModal.js +0 -182
- package/src/web/public/js/modal/modalSetup.js +0 -595
- package/src/web/public/js/modal/modalUtils.js +0 -37
- package/src/web/public/js/modal/versionUtils.js +0 -20
- package/src/web/public/js/modal.js +0 -42
- package/src/web/public/js/notifications.js +0 -137
- package/src/web/public/js/onboard/formProcessor.js +0 -1037
- package/src/web/public/js/onboard/index.js +0 -374
- package/src/web/public/js/onboard/publishHandler.js +0 -172
- package/src/web/public/js/onboard/state.js +0 -76
- package/src/web/public/js/onboard/templates.js +0 -342
- package/src/web/public/js/onboard/uiHandlers.js +0 -1076
- package/src/web/public/js/onboard/validationHandlers.js +0 -493
- package/src/web/public/js/serverCategoryDetails.js +0 -364
- package/src/web/public/js/serverCategoryList.js +0 -241
- package/src/web/public/js/settings.js +0 -314
- package/src/web/public/modal.html +0 -84
- package/src/web/public/onboard.html +0 -296
- package/src/web/public/settings.html +0 -135
- package/src/web/public/styles.css +0 -277
- package/src/web/server.ts +0 -478
- package/tsconfig.json +0 -18
- package/wiki/Installation.md +0 -3
- package/wiki/Publish.md +0 -3
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { BaseInstaller } from './BaseInstaller.js';
|
|
2
|
-
/**
|
|
3
|
-
* Installer implementation for Python packages using pip
|
|
4
|
-
*/
|
|
5
|
-
export class PipInstaller extends BaseInstaller {
|
|
6
|
-
getPythonCommand(options) {
|
|
7
|
-
return options?.settings?.pythonEnv || 'python';
|
|
8
|
-
}
|
|
9
|
-
getPipCommand(options) {
|
|
10
|
-
const pythonCmd = this.getPythonCommand(options);
|
|
11
|
-
return `${pythonCmd} -m pip`;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Check if this installer can handle the given requirement type
|
|
15
|
-
* @param requirement The requirement to check
|
|
16
|
-
* @returns True if this installer can handle the requirement
|
|
17
|
-
*/
|
|
18
|
-
canHandle(requirement) {
|
|
19
|
-
return requirement.type === 'pip';
|
|
20
|
-
}
|
|
21
|
-
supportCheckUpdates() {
|
|
22
|
-
/// temporarily disabling update check for pip as not able to get which pip of python is being used
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Check if the Python package is already installed
|
|
27
|
-
* @param requirement The requirement to check
|
|
28
|
-
* @returns The status of the requirement
|
|
29
|
-
*/
|
|
30
|
-
async checkInstallation(requirement, options) {
|
|
31
|
-
try {
|
|
32
|
-
const pipCmd = this.getPipCommand(options);
|
|
33
|
-
const { stdout, stderr } = await this.execPromise(`${pipCmd} show ${requirement.name}`);
|
|
34
|
-
// If we get an output and no error, the package is installed
|
|
35
|
-
const installed = stdout.includes(requirement.name);
|
|
36
|
-
const versionMatch = stdout.match(/Version: (.+)/);
|
|
37
|
-
const installedVersion = versionMatch ? versionMatch[1] : undefined;
|
|
38
|
-
return {
|
|
39
|
-
name: requirement.name,
|
|
40
|
-
type: 'pip',
|
|
41
|
-
installed,
|
|
42
|
-
version: installedVersion,
|
|
43
|
-
inProgress: false
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
return {
|
|
48
|
-
name: requirement.name,
|
|
49
|
-
type: 'pip',
|
|
50
|
-
installed: false,
|
|
51
|
-
error: error instanceof Error ? error.message : String(error),
|
|
52
|
-
inProgress: false
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Install the Python package
|
|
58
|
-
* @param requirement The requirement to install
|
|
59
|
-
* @returns The status of the installation
|
|
60
|
-
*/
|
|
61
|
-
async install(requirement, options) {
|
|
62
|
-
try {
|
|
63
|
-
const status = await this.checkInstallation(requirement, options);
|
|
64
|
-
if (status.installed) {
|
|
65
|
-
return status;
|
|
66
|
-
}
|
|
67
|
-
const pipCmd = this.getPipCommand(options);
|
|
68
|
-
// If no registry is specified, use standard pip installation
|
|
69
|
-
if (!requirement.registry) {
|
|
70
|
-
// Standard pip installation
|
|
71
|
-
const { stderr } = await this.execPromise(`${pipCmd} install ${requirement.name}==${requirement.version}`);
|
|
72
|
-
if (stderr && stderr.toLowerCase().includes('error')) {
|
|
73
|
-
throw new Error(stderr);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
// Handle different registry types
|
|
78
|
-
let packageSource;
|
|
79
|
-
if (requirement.registry.githubRelease) {
|
|
80
|
-
const result = await this.handleGitHubRelease(requirement, requirement.registry.githubRelease);
|
|
81
|
-
packageSource = result.resolvedPath;
|
|
82
|
-
// Install from the downloaded wheel or tar.gz file
|
|
83
|
-
const { stderr } = await this.execPromise(`${pipCmd} install "${packageSource}"`);
|
|
84
|
-
if (stderr && stderr.toLowerCase().includes('error')) {
|
|
85
|
-
throw new Error(stderr);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
else if (requirement.registry.artifacts) {
|
|
89
|
-
const registryUrl = requirement.registry.artifacts.registryUrl;
|
|
90
|
-
// Install using the custom index URL
|
|
91
|
-
const { stderr } = await this.execPromise(`${pipCmd} install ${requirement.name}==${requirement.version} --index-url ${registryUrl}`);
|
|
92
|
-
if (stderr && stderr.toLowerCase().includes('error')) {
|
|
93
|
-
throw new Error(stderr);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
else if (requirement.registry.local) {
|
|
97
|
-
packageSource = await this.handleLocalRegistry(requirement, requirement.registry.local);
|
|
98
|
-
// Install from the local path
|
|
99
|
-
const { stderr } = await this.execPromise(`${pipCmd} install "${packageSource}"`);
|
|
100
|
-
if (stderr && stderr.toLowerCase().includes('error')) {
|
|
101
|
-
throw new Error(stderr);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
throw new Error('Invalid registry configuration');
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return {
|
|
109
|
-
name: requirement.name,
|
|
110
|
-
type: 'pip',
|
|
111
|
-
installed: true,
|
|
112
|
-
version: requirement.version,
|
|
113
|
-
inProgress: false
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
catch (error) {
|
|
117
|
-
return {
|
|
118
|
-
name: requirement.name,
|
|
119
|
-
type: 'pip',
|
|
120
|
-
installed: false,
|
|
121
|
-
error: error instanceof Error ? error.message : String(error),
|
|
122
|
-
inProgress: false
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
//# sourceMappingURL=PipInstaller.js.map
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Interface for requirement installers.
|
|
4
|
-
* Implementations should handle specific requirement types.
|
|
5
|
-
*/
|
|
6
|
-
export interface RequirementInstaller {
|
|
7
|
-
/**
|
|
8
|
-
* Check if this installer can handle the given requirement type
|
|
9
|
-
* @param requirement The requirement to check
|
|
10
|
-
* @returns True if this installer can handle the requirement
|
|
11
|
-
*/
|
|
12
|
-
canHandle(requirement: RequirementConfig): boolean;
|
|
13
|
-
supportCheckUpdates(): boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Install the requirement
|
|
16
|
-
* @param requirement The requirement to install
|
|
17
|
-
* @returns The status of the installation
|
|
18
|
-
*/
|
|
19
|
-
install(requirement: RequirementConfig, options?: ServerInstallOptions): Promise<RequirementStatus>;
|
|
20
|
-
/**
|
|
21
|
-
* Check if the requirement is already installed
|
|
22
|
-
* @param requirement The requirement to check
|
|
23
|
-
* @returns The status of the requirement
|
|
24
|
-
*/
|
|
25
|
-
checkInstallation(requirement: RequirementConfig, options?: ServerInstallOptions): Promise<RequirementStatus>;
|
|
26
|
-
/**
|
|
27
|
-
* Check if updates are available for the requirement
|
|
28
|
-
* @param requirement The requirement to check
|
|
29
|
-
* @param currentStatus The current status of the requirement
|
|
30
|
-
* @returns The status of the requirement with update information
|
|
31
|
-
*/
|
|
32
|
-
checkForUpdates(requirement: RequirementConfig, currentStatus: RequirementStatus): Promise<RequirementStatus>;
|
|
33
|
-
}
|
package/dist/core/types.d.ts
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
export declare enum OSType {
|
|
2
|
-
Windows = "windows",
|
|
3
|
-
MacOS = "macos",
|
|
4
|
-
Linux = "linux"
|
|
5
|
-
}
|
|
6
|
-
export interface RequirementStatus {
|
|
7
|
-
name: string;
|
|
8
|
-
type: string;
|
|
9
|
-
installed: boolean;
|
|
10
|
-
inProgress?: boolean;
|
|
11
|
-
version?: string;
|
|
12
|
-
error?: string;
|
|
13
|
-
availableUpdate?: {
|
|
14
|
-
version: string;
|
|
15
|
-
message: string;
|
|
16
|
-
};
|
|
17
|
-
lastCheckTime?: string;
|
|
18
|
-
operationStatus?: OperationStatus;
|
|
19
|
-
pythonEnv?: string;
|
|
20
|
-
npmPath?: string;
|
|
21
|
-
}
|
|
22
|
-
export interface MCPServerStatus {
|
|
23
|
-
installedStatus: Record<string, OperationStatus>;
|
|
24
|
-
name: string;
|
|
25
|
-
tags?: string[];
|
|
26
|
-
error?: string;
|
|
27
|
-
}
|
|
28
|
-
export interface OperationStatus {
|
|
29
|
-
status: 'pending' | 'in-progress' | 'completed' | 'failed';
|
|
30
|
-
type: 'install' | 'uninstall' | 'update' | 'check';
|
|
31
|
-
target: 'requirement' | 'server';
|
|
32
|
-
message?: string;
|
|
33
|
-
error?: string;
|
|
34
|
-
operationId?: string;
|
|
35
|
-
}
|
|
36
|
-
export interface InstallationStatus {
|
|
37
|
-
requirementsStatus: Record<string, RequirementStatus>;
|
|
38
|
-
serversStatus: Record<string, MCPServerStatus>;
|
|
39
|
-
lastUpdated: string;
|
|
40
|
-
}
|
|
41
|
-
export interface MCPServerCategory {
|
|
42
|
-
name: string;
|
|
43
|
-
displayName: string;
|
|
44
|
-
description?: string;
|
|
45
|
-
type: 'local';
|
|
46
|
-
tags?: string[];
|
|
47
|
-
path?: string;
|
|
48
|
-
installationStatus?: InstallationStatus;
|
|
49
|
-
feedConfiguration?: FeedConfiguration;
|
|
50
|
-
}
|
|
51
|
-
export interface ServerCategoryListOptions {
|
|
52
|
-
local?: boolean;
|
|
53
|
-
}
|
|
54
|
-
export interface ServerOperationResult {
|
|
55
|
-
success: boolean;
|
|
56
|
-
message?: string;
|
|
57
|
-
error?: Error;
|
|
58
|
-
output?: string;
|
|
59
|
-
status?: OperationStatus[];
|
|
60
|
-
}
|
|
61
|
-
export interface MCPConfiguration {
|
|
62
|
-
localServerCategories: MCPServerCategory[];
|
|
63
|
-
feeds: Record<string, FeedConfiguration>;
|
|
64
|
-
clientMCPSettings?: Record<string, Record<string, any>>;
|
|
65
|
-
}
|
|
66
|
-
export interface ServerInstallOptions {
|
|
67
|
-
force?: boolean;
|
|
68
|
-
env?: Record<string, string>;
|
|
69
|
-
targetClients?: string[];
|
|
70
|
-
requirements?: RequirementConfig[];
|
|
71
|
-
args?: string[];
|
|
72
|
-
settings?: Record<string, any>;
|
|
73
|
-
}
|
|
74
|
-
export interface UpdateRequirementOptions {
|
|
75
|
-
requirementName: string;
|
|
76
|
-
updateVersion: string;
|
|
77
|
-
}
|
|
78
|
-
export interface ServerUninstallOptions {
|
|
79
|
-
removeData?: boolean;
|
|
80
|
-
targets?: string[];
|
|
81
|
-
}
|
|
82
|
-
export interface EnvVariableConfig {
|
|
83
|
-
Required: boolean;
|
|
84
|
-
Description: string;
|
|
85
|
-
Default?: string;
|
|
86
|
-
}
|
|
87
|
-
export interface InstallationConfig {
|
|
88
|
-
command: string;
|
|
89
|
-
args: string[];
|
|
90
|
-
env?: Record<string, EnvVariableConfig>;
|
|
91
|
-
url?: string;
|
|
92
|
-
}
|
|
93
|
-
export interface DependencyConfig {
|
|
94
|
-
requirements?: Array<{
|
|
95
|
-
name: string;
|
|
96
|
-
version: string;
|
|
97
|
-
order?: number;
|
|
98
|
-
}>;
|
|
99
|
-
mcpServers?: Array<{
|
|
100
|
-
name: string;
|
|
101
|
-
}>;
|
|
102
|
-
}
|
|
103
|
-
export interface McpConfig {
|
|
104
|
-
name: string;
|
|
105
|
-
description: string;
|
|
106
|
-
mode: 'stdio' | 'sse';
|
|
107
|
-
dependencies?: DependencyConfig;
|
|
108
|
-
schemas?: string;
|
|
109
|
-
repository?: string;
|
|
110
|
-
installation: InstallationConfig;
|
|
111
|
-
}
|
|
112
|
-
export interface RegistryConfig {
|
|
113
|
-
githubRelease?: {
|
|
114
|
-
repository: string;
|
|
115
|
-
assetsName?: string;
|
|
116
|
-
assetName: string;
|
|
117
|
-
};
|
|
118
|
-
artifacts?: {
|
|
119
|
-
registryUrl: string;
|
|
120
|
-
registryName: string;
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
export interface RequirementConfig {
|
|
124
|
-
name: string;
|
|
125
|
-
type: 'npm' | 'pip' | 'command' | 'extension' | 'other';
|
|
126
|
-
alias?: string;
|
|
127
|
-
version: string;
|
|
128
|
-
registry?: RegistryConfig;
|
|
129
|
-
}
|
|
130
|
-
export interface FeedConfiguration {
|
|
131
|
-
name: string;
|
|
132
|
-
displayName: string;
|
|
133
|
-
description: string;
|
|
134
|
-
repository?: string;
|
|
135
|
-
requirements: RequirementConfig[];
|
|
136
|
-
mcpServers: McpConfig[];
|
|
137
|
-
}
|
|
138
|
-
export interface ClientSettings {
|
|
139
|
-
codeSettingPath: string;
|
|
140
|
-
codeInsiderSettingPath: string;
|
|
141
|
-
}
|
|
142
|
-
export declare enum MCPEvent {
|
|
143
|
-
SERVER_INSTALLED = "server:installed",
|
|
144
|
-
SERVER_UNINSTALLED = "server:uninstalled",
|
|
145
|
-
SERVER_STARTED = "server:started",
|
|
146
|
-
SERVER_STOPPED = "server:stopped",
|
|
147
|
-
CONFIG_CHANGED = "config:changed"
|
|
148
|
-
}
|
|
149
|
-
export interface MCPEventData {
|
|
150
|
-
[MCPEvent.SERVER_INSTALLED]: {
|
|
151
|
-
server: MCPServerCategory;
|
|
152
|
-
};
|
|
153
|
-
[MCPEvent.SERVER_UNINSTALLED]: {
|
|
154
|
-
serverName: string;
|
|
155
|
-
targets?: string[];
|
|
156
|
-
};
|
|
157
|
-
[MCPEvent.SERVER_STARTED]: {
|
|
158
|
-
server: MCPServerCategory;
|
|
159
|
-
};
|
|
160
|
-
[MCPEvent.SERVER_STOPPED]: {
|
|
161
|
-
serverName: string;
|
|
162
|
-
};
|
|
163
|
-
[MCPEvent.CONFIG_CHANGED]: {
|
|
164
|
-
configuration: MCPConfiguration;
|
|
165
|
-
};
|
|
166
|
-
}
|
package/dist/core/types.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export var OSType;
|
|
2
|
-
(function (OSType) {
|
|
3
|
-
OSType["Windows"] = "windows";
|
|
4
|
-
OSType["MacOS"] = "macos";
|
|
5
|
-
OSType["Linux"] = "linux";
|
|
6
|
-
})(OSType || (OSType = {}));
|
|
7
|
-
// Events that can be emitted by the SDK
|
|
8
|
-
export var MCPEvent;
|
|
9
|
-
(function (MCPEvent) {
|
|
10
|
-
MCPEvent["SERVER_INSTALLED"] = "server:installed";
|
|
11
|
-
MCPEvent["SERVER_UNINSTALLED"] = "server:uninstalled";
|
|
12
|
-
MCPEvent["SERVER_STARTED"] = "server:started";
|
|
13
|
-
MCPEvent["SERVER_STOPPED"] = "server:stopped";
|
|
14
|
-
MCPEvent["CONFIG_CHANGED"] = "config:changed";
|
|
15
|
-
})(MCPEvent || (MCPEvent = {}));
|
|
16
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ServerInstallOptions } from '../core/types.js';
|
|
2
|
-
import { InstallServersRequestBody } from '../web/contract/serverContract.js';
|
|
3
|
-
export declare class InstallRequestValidator {
|
|
4
|
-
private serverFeedConfigs;
|
|
5
|
-
private feedDirectory;
|
|
6
|
-
constructor(feedDirectory?: string);
|
|
7
|
-
private loadServerFeedConfiguration;
|
|
8
|
-
/**
|
|
9
|
-
* Validates the install request body for a specific server.
|
|
10
|
-
* @param serverName The name of the server to validate against.
|
|
11
|
-
* @param requestBody The installation request body.
|
|
12
|
-
* @returns An array of error messages, or an empty array if validation passes.
|
|
13
|
-
*/
|
|
14
|
-
validate(serverName: string, requestBody: ServerInstallOptions): Promise<string[]>;
|
|
15
|
-
/**
|
|
16
|
-
* Validates the install request body for multiple servers.
|
|
17
|
-
* @param requestBody The installation request body containing multiple server names.
|
|
18
|
-
* @returns An object mapping server names to their validation errors. Empty arrays indicate success.
|
|
19
|
-
*/
|
|
20
|
-
validateMultiple(requestBody: InstallServersRequestBody): Promise<Record<string, string[]>>;
|
|
21
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import fs from 'fs/promises';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { SUPPORTED_CLIENT_NAMES } from '../core/constants.js';
|
|
4
|
-
export class InstallRequestValidator {
|
|
5
|
-
serverFeedConfigs = new Map();
|
|
6
|
-
feedDirectory;
|
|
7
|
-
constructor(feedDirectory = path.join(__dirname, '../feeds')) {
|
|
8
|
-
this.feedDirectory = feedDirectory;
|
|
9
|
-
// Consider loading configs lazily or providing an explicit load method
|
|
10
|
-
// For now, let's assume pre-loading or loading on demand in validate
|
|
11
|
-
}
|
|
12
|
-
async loadServerFeedConfiguration(serverName) {
|
|
13
|
-
if (this.serverFeedConfigs.has(serverName)) {
|
|
14
|
-
return this.serverFeedConfigs.get(serverName);
|
|
15
|
-
}
|
|
16
|
-
const filePath = path.join(this.feedDirectory, `${serverName}.json`);
|
|
17
|
-
try {
|
|
18
|
-
const fileContent = await fs.readFile(filePath, 'utf-8');
|
|
19
|
-
const config = JSON.parse(fileContent);
|
|
20
|
-
// Basic validation of the loaded config structure could be added here
|
|
21
|
-
if (config && config.name === serverName) {
|
|
22
|
-
this.serverFeedConfigs.set(serverName, config);
|
|
23
|
-
return config;
|
|
24
|
-
}
|
|
25
|
-
console.error(`Configuration name mismatch in ${filePath}`);
|
|
26
|
-
return undefined;
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
if (error.code === 'ENOENT') {
|
|
30
|
-
console.warn(`Server feed configuration not found for: ${serverName} at ${filePath}`);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
console.error(`Error loading server feed configuration for ${serverName}:`, error);
|
|
34
|
-
}
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Validates the install request body for a specific server.
|
|
40
|
-
* @param serverName The name of the server to validate against.
|
|
41
|
-
* @param requestBody The installation request body.
|
|
42
|
-
* @returns An array of error messages, or an empty array if validation passes.
|
|
43
|
-
*/
|
|
44
|
-
async validate(serverName, requestBody) {
|
|
45
|
-
const errors = [];
|
|
46
|
-
const config = await this.loadServerFeedConfiguration(serverName);
|
|
47
|
-
if (!config) {
|
|
48
|
-
errors.push(`Server configuration feed not found for '${serverName}'.`);
|
|
49
|
-
// Cannot perform further validation without the config
|
|
50
|
-
return errors;
|
|
51
|
-
}
|
|
52
|
-
// 1.2 Validate required environment variables
|
|
53
|
-
config.mcpServers.forEach(mcp => {
|
|
54
|
-
if (mcp.installation?.env) {
|
|
55
|
-
Object.entries(mcp.installation.env).forEach(([envVar, envConfig]) => {
|
|
56
|
-
if (envConfig.Required) {
|
|
57
|
-
if (!requestBody.env || !(envVar in requestBody.env) || !requestBody.env[envVar]) {
|
|
58
|
-
errors.push(`Missing required environment variable '${envVar}' for server '${serverName}' (category: ${mcp.name}).`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
// 1.3 Validate target clients
|
|
65
|
-
if (!requestBody.targetClients || requestBody.targetClients.length === 0) {
|
|
66
|
-
errors.push(`Request body must include a non-empty 'targetClients' array for server '${serverName}'.`);
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
requestBody.targetClients.forEach((client) => {
|
|
70
|
-
if (!SUPPORTED_CLIENT_NAMES.includes(client)) {
|
|
71
|
-
errors.push(`Unsupported target client '${client}' specified for server '${serverName}'. Supported clients are: ${SUPPORTED_CLIENT_NAMES.join(', ')}.`);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
// Add other validation rules as needed
|
|
76
|
-
return errors;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Validates the install request body for multiple servers.
|
|
80
|
-
* @param requestBody The installation request body containing multiple server names.
|
|
81
|
-
* @returns An object mapping server names to their validation errors. Empty arrays indicate success.
|
|
82
|
-
*/
|
|
83
|
-
async validateMultiple(requestBody) {
|
|
84
|
-
const results = {};
|
|
85
|
-
if (!requestBody.serverList || Object.keys(requestBody.serverList).length === 0) {
|
|
86
|
-
return { '_global': ['Request body must include a non-empty \'serverCategoryList\' record.'] };
|
|
87
|
-
}
|
|
88
|
-
for (const serverName of Object.keys(requestBody.serverList)) {
|
|
89
|
-
results[serverName] = await this.validate(serverName, requestBody.serverList[serverName]);
|
|
90
|
-
}
|
|
91
|
-
return results;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
// Helper __dirname for ES modules
|
|
95
|
-
import { fileURLToPath } from 'url';
|
|
96
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
97
|
-
// Export a singleton instance (optional, depends on usage pattern)
|
|
98
|
-
// export const installRequestValidator = new InstallRequestValidator();
|
|
99
|
-
//# sourceMappingURL=InstallRequestValidator.js.map
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import { showLoadingModal, appendLoadingMessage } from './loadingUI.js';
|
|
2
|
-
import { compareVersions } from './version.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Handle bulk client installations
|
|
6
|
-
* @param {string} categoryName Category name
|
|
7
|
-
* @param {string} serverName Server name
|
|
8
|
-
* @param {string[]} targets Target clients
|
|
9
|
-
* @param {Object} options Installation options
|
|
10
|
-
*/
|
|
11
|
-
export async function handleInstallation(categoryName, serverName, targets, options = {}) {
|
|
12
|
-
const { envVars = {}, installingMessage = "Starting installation...", serverData = null } = options;
|
|
13
|
-
|
|
14
|
-
hideInstallModal();
|
|
15
|
-
initializeInstallation(installingMessage, serverData, serverName, targets);
|
|
16
|
-
|
|
17
|
-
try {
|
|
18
|
-
await executeInstallation(categoryName, serverName, targets, options);
|
|
19
|
-
} catch (error) {
|
|
20
|
-
handleInstallationError(error);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Handle uninstallation of tools
|
|
26
|
-
* @param {string} categoryName Category name
|
|
27
|
-
* @param {Object|Array} serverList Servers to uninstall
|
|
28
|
-
* @param {string[]} targets Target clients
|
|
29
|
-
*/
|
|
30
|
-
export async function handleUninstallation(categoryName, serverList, targets) {
|
|
31
|
-
const selectedTargets = getSelectedTargets(targets);
|
|
32
|
-
validateTargets(selectedTargets);
|
|
33
|
-
|
|
34
|
-
try {
|
|
35
|
-
await executeUninstallation(categoryName, serverList, selectedTargets);
|
|
36
|
-
} catch (error) {
|
|
37
|
-
handleUninstallationError(error);
|
|
38
|
-
throw error;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Private helper functions
|
|
43
|
-
|
|
44
|
-
function hideInstallModal() {
|
|
45
|
-
const installModal = document.getElementById('installModal');
|
|
46
|
-
if (installModal) {
|
|
47
|
-
installModal.style.display = "none";
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function initializeInstallation(installingMessage, serverData, serverName, targets) {
|
|
52
|
-
showLoadingModal();
|
|
53
|
-
|
|
54
|
-
if (hasExistingStatus(serverData, serverName, targets)) {
|
|
55
|
-
const existingMessage = getExistingMessage(serverData, serverName, targets[0]);
|
|
56
|
-
if (existingMessage && existingMessage !== "Starting installation...") {
|
|
57
|
-
appendLoadingMessage(existingMessage);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
appendLoadingMessage(installingMessage);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function hasExistingStatus(serverData, serverName, targets) {
|
|
65
|
-
return serverData?.data?.installationStatus?.serversStatus &&
|
|
66
|
-
targets?.length > 0;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function getExistingMessage(serverData, serverName, target) {
|
|
70
|
-
const serverStatuses = serverData.data.installationStatus.serversStatus;
|
|
71
|
-
const serverStatus = serverStatuses[serverName] || { installedStatus: {} };
|
|
72
|
-
return serverStatus.installedStatus?.[target]?.message;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
async function executeInstallation(categoryName, serverName, targets, options) {
|
|
76
|
-
appendLoadingMessage("Installing, please wait...");
|
|
77
|
-
|
|
78
|
-
const requestBody = buildInstallRequestBody(serverName, targets, options);
|
|
79
|
-
const response = await fetchWithErrorHandling(
|
|
80
|
-
`api/categories/${categoryName}/install`,
|
|
81
|
-
requestBody
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
if (response.success) {
|
|
85
|
-
startStatusPolling(categoryName, serverName, targets, options);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function buildInstallRequestBody(serverName, targets, options) {
|
|
90
|
-
const { envVars = {}, args = [], pythonEnv, requirements = [] } = options;
|
|
91
|
-
|
|
92
|
-
const serverOptions = {
|
|
93
|
-
targetClients: targets,
|
|
94
|
-
env: envVars,
|
|
95
|
-
args: args,
|
|
96
|
-
settings: pythonEnv ? { pythonEnv } : undefined
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
if (requirements.length > 0) {
|
|
100
|
-
serverOptions.requirements = requirements;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return {
|
|
104
|
-
serverList: {
|
|
105
|
-
[serverName]: serverOptions
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
async function executeUninstallation(categoryName, serverList, selectedTargets) {
|
|
111
|
-
appendLoadingMessage('Starting uninstallation...');
|
|
112
|
-
|
|
113
|
-
const formattedServerList = formatServerList(serverList);
|
|
114
|
-
await fetchWithErrorHandling(
|
|
115
|
-
`api/categories/${categoryName}/uninstall`,
|
|
116
|
-
{
|
|
117
|
-
serverList: formattedServerList,
|
|
118
|
-
options: {
|
|
119
|
-
targets: selectedTargets,
|
|
120
|
-
removeData: true
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
appendLoadingMessage(`Successfully uninstalled from ${selectedTargets.join(', ')}`, true);
|
|
126
|
-
window.selectedClients = [];
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function formatServerList(serverList) {
|
|
130
|
-
if (Array.isArray(serverList)) {
|
|
131
|
-
return serverList.reduce((acc, server) => {
|
|
132
|
-
acc[server] = { removeData: true };
|
|
133
|
-
return acc;
|
|
134
|
-
}, {});
|
|
135
|
-
}
|
|
136
|
-
return serverList;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
async function fetchWithErrorHandling(endpoint, body) {
|
|
140
|
-
const response = await fetch(endpoint, {
|
|
141
|
-
method: 'POST',
|
|
142
|
-
headers: {
|
|
143
|
-
'Content-Type': 'application/json',
|
|
144
|
-
'Accept': 'application/json'
|
|
145
|
-
},
|
|
146
|
-
body: JSON.stringify(body)
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
if (!response.ok) {
|
|
150
|
-
const errorData = await response.text();
|
|
151
|
-
throw new Error(`Operation failed: ${errorData || response.statusText}`);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const result = await response.json();
|
|
155
|
-
if (!result.success) {
|
|
156
|
-
throw new Error(result.error || 'Operation failed');
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return result;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
function handleInstallationError(error) {
|
|
163
|
-
console.error('[LoadingModal] Error:', error);
|
|
164
|
-
appendLoadingMessage(`<span style="color:red;">Error: ${error.message}</span>`);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function handleUninstallationError(error) {
|
|
168
|
-
console.error('Error uninstalling tools:', error);
|
|
169
|
-
appendLoadingMessage(`Error: ${error.message}`, true);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function getSelectedTargets(targets) {
|
|
173
|
-
return window.selectedClients || (Array.isArray(targets) ? targets : [targets]);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function validateTargets(selectedTargets) {
|
|
177
|
-
if (!selectedTargets || selectedTargets.length === 0) {
|
|
178
|
-
throw new Error('Please select at least one client to uninstall.');
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// Status polling functionality
|
|
183
|
-
async function startStatusPolling(categoryName, serverName, targets, options) {
|
|
184
|
-
const { requirements = [] } = options;
|
|
185
|
-
let lastMessages = {};
|
|
186
|
-
let lastRequirementMessages = {};
|
|
187
|
-
let lastRequirementErrorMessages = {};
|
|
188
|
-
let completionMessageSent = false;
|
|
189
|
-
|
|
190
|
-
const startTime = Date.now();
|
|
191
|
-
const maxTimeout = 10 * 60 * 1000; // 10 minutes
|
|
192
|
-
|
|
193
|
-
while (Date.now() - startTime < maxTimeout) {
|
|
194
|
-
try {
|
|
195
|
-
const status = await pollStatus(categoryName, serverName, targets, requirements);
|
|
196
|
-
|
|
197
|
-
if (status.isComplete) {
|
|
198
|
-
sendCompletionMessage(status, targets);
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
updateMessages(status, lastMessages, lastRequirementMessages, lastRequirementErrorMessages);
|
|
203
|
-
} catch (error) {
|
|
204
|
-
console.error('[LoadingModal] Error polling status:', error);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
handlePollingTimeout(completionMessageSent);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
async function pollStatus(categoryName, serverName, targets, requirements) {
|
|
214
|
-
const response = await fetch(`api/categories/${categoryName}`);
|
|
215
|
-
if (!response.ok) {
|
|
216
|
-
throw new Error('Failed to fetch status');
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
const data = await response.json();
|
|
220
|
-
return processStatusData(data, serverName, targets, requirements);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function processStatusData(data, serverName, targets, requirements) {
|
|
224
|
-
// Implementation details for processing status data
|
|
225
|
-
// This would include checking requirements status and target status
|
|
226
|
-
// Returns an object with status information
|
|
227
|
-
}
|