@1mcp/agent 0.35.0-beta.3 → 0.35.0
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/build/admin/assets/admin-AboutRuntimeWorkspace-DH2QC2nJ.js +1 -0
- package/build/admin/assets/admin-BackendLogsWorkspace-BKavXT9B.js +1 -0
- package/build/admin/assets/admin-InstructionTemplatesWorkspace-CvG4EPdZ.js +1 -0
- package/build/admin/assets/admin-OAuthServicesWorkspace-B8y2weAX.js +1 -0
- package/build/admin/assets/admin-PresetAuthoringWorkspace-BboJVBFl.js +1 -0
- package/build/admin/assets/admin-console-D6jyI73o.css +1 -0
- package/build/admin/assets/{admin-console-Bbil6BQU.css → admin-console-DmRyrCWD.css} +1 -1
- package/build/admin/assets/admin-console-HJH52xGP.js +3 -0
- package/build/admin/assets/admin-icons-CYGTDZA5.js +1 -0
- package/build/admin/assets/admin-mantine-xwbfu5Gd.js +53 -0
- package/build/admin/assets/admin-react-BSaWeqgv.js +8 -0
- package/build/admin/assets/admin-rolldown-runtime-Bh1tDfsg.js +1 -0
- package/build/admin/favicon.svg +4 -0
- package/build/admin/index.html +8 -2
- package/build/auth/sdkOAuthClientProvider.d.ts +4 -0
- package/build/auth/sdkOAuthClientProvider.d.ts.map +1 -1
- package/build/auth/sdkOAuthClientProvider.js +29 -0
- package/build/auth/sdkOAuthClientProvider.js.map +1 -1
- package/build/auth/sessionTypes.d.ts +2 -0
- package/build/auth/sessionTypes.d.ts.map +1 -1
- package/build/auth/sessionTypes.js.map +1 -1
- package/build/commands/inspect/inspect.d.ts +1 -0
- package/build/commands/inspect/inspect.d.ts.map +1 -1
- package/build/commands/inspect/inspect.js +4 -1
- package/build/commands/inspect/inspect.js.map +1 -1
- package/build/commands/instructions/instructions.d.ts.map +1 -1
- package/build/commands/instructions/instructions.js +56 -1
- package/build/commands/instructions/instructions.js.map +1 -1
- package/build/commands/mcp/add.js +2 -2
- package/build/commands/mcp/add.js.map +1 -1
- package/build/commands/mcp/list.js +1 -1
- package/build/commands/mcp/list.js.map +1 -1
- package/build/commands/mcp/update.js +1 -1
- package/build/commands/mcp/update.js.map +1 -1
- package/build/commands/proxy/proxy.d.ts.map +1 -1
- package/build/commands/proxy/proxy.js +2 -0
- package/build/commands/proxy/proxy.js.map +1 -1
- package/build/commands/run/run.d.ts +1 -0
- package/build/commands/run/run.d.ts.map +1 -1
- package/build/commands/run/run.js +4 -1
- package/build/commands/run/run.js.map +1 -1
- package/build/commands/serve/index.d.ts +10 -0
- package/build/commands/serve/index.d.ts.map +1 -1
- package/build/commands/serve/index.js +10 -0
- package/build/commands/serve/index.js.map +1 -1
- package/build/commands/serve/serve.d.ts +3 -0
- package/build/commands/serve/serve.d.ts.map +1 -1
- package/build/commands/serve/serve.js +20 -0
- package/build/commands/serve/serve.js.map +1 -1
- package/build/commands/serve/serveBackground.d.ts.map +1 -1
- package/build/commands/serve/serveBackground.js +2 -0
- package/build/commands/serve/serveBackground.js.map +1 -1
- package/build/commands/serve/templateContextTrust.d.ts +12 -0
- package/build/commands/serve/templateContextTrust.d.ts.map +1 -0
- package/build/commands/serve/templateContextTrust.js +23 -0
- package/build/commands/serve/templateContextTrust.js.map +1 -0
- package/build/commands/shared/apiClient.d.ts +3 -0
- package/build/commands/shared/apiClient.d.ts.map +1 -1
- package/build/commands/shared/apiClient.js +6 -0
- package/build/commands/shared/apiClient.js.map +1 -1
- package/build/commands/shared/clientSurfaceAttachment.d.ts +11 -0
- package/build/commands/shared/clientSurfaceAttachment.d.ts.map +1 -1
- package/build/commands/shared/clientSurfaceAttachment.js +64 -6
- package/build/commands/shared/clientSurfaceAttachment.js.map +1 -1
- package/build/commands/shared/inspectApiSchemas.d.ts +8 -8
- package/build/commands/shared/serveClient.d.ts +2 -1
- package/build/commands/shared/serveClient.d.ts.map +1 -1
- package/build/commands/shared/serveClient.js +3 -1
- package/build/commands/shared/serveClient.js.map +1 -1
- package/build/commands/shared/serveTargetResolver.d.ts +4 -0
- package/build/commands/shared/serveTargetResolver.d.ts.map +1 -1
- package/build/commands/shared/serveTargetResolver.js +22 -22
- package/build/commands/shared/serveTargetResolver.js.map +1 -1
- package/build/commands/wait/wait.d.ts.map +1 -1
- package/build/commands/wait/wait.js +1 -0
- package/build/commands/wait/wait.js.map +1 -1
- package/build/config/configManager.d.ts +11 -1
- package/build/config/configManager.d.ts.map +1 -1
- package/build/config/configManager.js +13 -0
- package/build/config/configManager.js.map +1 -1
- package/build/config/configuredServerTargets.d.ts +3 -0
- package/build/config/configuredServerTargets.d.ts.map +1 -0
- package/build/config/configuredServerTargets.js +8 -0
- package/build/config/configuredServerTargets.js.map +1 -0
- package/build/config/mcpConfigManager.d.ts +3 -0
- package/build/config/mcpConfigManager.d.ts.map +1 -1
- package/build/config/mcpConfigManager.js +15 -0
- package/build/config/mcpConfigManager.js.map +1 -1
- package/build/constants/api.d.ts +1 -0
- package/build/constants/api.d.ts.map +1 -1
- package/build/constants/api.js +1 -0
- package/build/constants/api.js.map +1 -1
- package/build/constants/mcp.d.ts +1 -1
- package/build/constants/mcp.d.ts.map +1 -1
- package/build/constants/mcp.js +1 -1
- package/build/constants/mcp.js.map +1 -1
- package/build/core/capabilities/capabilityAggregator.d.ts.map +1 -1
- package/build/core/capabilities/capabilityAggregator.js +33 -14
- package/build/core/capabilities/capabilityAggregator.js.map +1 -1
- package/build/core/capabilities/capabilityCatalog.d.ts +23 -1
- package/build/core/capabilities/capabilityCatalog.d.ts.map +1 -1
- package/build/core/capabilities/capabilityCatalog.js +81 -7
- package/build/core/capabilities/capabilityCatalog.js.map +1 -1
- package/build/core/capabilities/capabilityPagination.d.ts +40 -0
- package/build/core/capabilities/capabilityPagination.d.ts.map +1 -0
- package/build/core/capabilities/capabilityPagination.js +287 -0
- package/build/core/capabilities/capabilityPagination.js.map +1 -0
- package/build/core/capabilities/capabilityVisibility.d.ts +2 -1
- package/build/core/capabilities/capabilityVisibility.d.ts.map +1 -1
- package/build/core/capabilities/capabilityVisibility.js +2 -1
- package/build/core/capabilities/capabilityVisibility.js.map +1 -1
- package/build/core/capabilities/configuredToolSnapshot.d.ts +12 -0
- package/build/core/capabilities/configuredToolSnapshot.d.ts.map +1 -0
- package/build/core/capabilities/configuredToolSnapshot.js +98 -0
- package/build/core/capabilities/configuredToolSnapshot.js.map +1 -0
- package/build/core/capabilities/lazyLoadingOrchestrator.d.ts.map +1 -1
- package/build/core/capabilities/lazyLoadingOrchestrator.js +8 -4
- package/build/core/capabilities/lazyLoadingOrchestrator.js.map +1 -1
- package/build/core/capabilities/metaToolProvider.js +3 -3
- package/build/core/capabilities/metaToolProvider.js.map +1 -1
- package/build/core/client/clientManager.d.ts.map +1 -1
- package/build/core/client/clientManager.js +11 -6
- package/build/core/client/clientManager.js.map +1 -1
- package/build/core/client/postAuthOAuthRecovery.d.ts +6 -0
- package/build/core/client/postAuthOAuthRecovery.d.ts.map +1 -0
- package/build/core/client/postAuthOAuthRecovery.js +74 -0
- package/build/core/client/postAuthOAuthRecovery.js.map +1 -0
- package/build/core/configChangeHandler.d.ts +2 -0
- package/build/core/configChangeHandler.d.ts.map +1 -1
- package/build/core/configChangeHandler.js +38 -11
- package/build/core/configChangeHandler.js.map +1 -1
- package/build/core/context/templateContextTrust.d.ts +66 -0
- package/build/core/context/templateContextTrust.d.ts.map +1 -0
- package/build/core/context/templateContextTrust.js +184 -0
- package/build/core/context/templateContextTrust.js.map +1 -0
- package/build/core/instructions/effectiveServerInstructions.d.ts +17 -0
- package/build/core/instructions/effectiveServerInstructions.d.ts.map +1 -0
- package/build/core/instructions/effectiveServerInstructions.js +12 -0
- package/build/core/instructions/effectiveServerInstructions.js.map +1 -0
- package/build/core/instructions/instructionAggregator.d.ts +51 -2
- package/build/core/instructions/instructionAggregator.d.ts.map +1 -1
- package/build/core/instructions/instructionAggregator.js +191 -30
- package/build/core/instructions/instructionAggregator.js.map +1 -1
- package/build/core/instructions/instructionsDistribution.d.ts +53 -0
- package/build/core/instructions/instructionsDistribution.d.ts.map +1 -1
- package/build/core/instructions/instructionsDistribution.js +25 -0
- package/build/core/instructions/instructionsDistribution.js.map +1 -1
- package/build/core/instructions/templateTypes.d.ts +25 -3
- package/build/core/instructions/templateTypes.d.ts.map +1 -1
- package/build/core/instructions/templateTypes.js +45 -0
- package/build/core/instructions/templateTypes.js.map +1 -1
- package/build/core/protocol/notificationHandlers.d.ts.map +1 -1
- package/build/core/protocol/notificationHandlers.js +26 -4
- package/build/core/protocol/notificationHandlers.js.map +1 -1
- package/build/core/protocol/promptRequestHandlers.d.ts.map +1 -1
- package/build/core/protocol/promptRequestHandlers.js +20 -11
- package/build/core/protocol/promptRequestHandlers.js.map +1 -1
- package/build/core/protocol/requestHandlerUtils.d.ts +4 -0
- package/build/core/protocol/requestHandlerUtils.d.ts.map +1 -1
- package/build/core/protocol/requestHandlerUtils.js +24 -4
- package/build/core/protocol/requestHandlerUtils.js.map +1 -1
- package/build/core/protocol/resourceRequestHandlers.d.ts.map +1 -1
- package/build/core/protocol/resourceRequestHandlers.js +38 -18
- package/build/core/protocol/resourceRequestHandlers.js.map +1 -1
- package/build/core/protocol/toolRequestHandlers.d.ts.map +1 -1
- package/build/core/protocol/toolRequestHandlers.js +79 -23
- package/build/core/protocol/toolRequestHandlers.js.map +1 -1
- package/build/core/server/agentConfig.d.ts +4 -0
- package/build/core/server/agentConfig.d.ts.map +1 -1
- package/build/core/server/agentConfig.js +3 -0
- package/build/core/server/agentConfig.js.map +1 -1
- package/build/core/server/clientInstancePool.js +2 -2
- package/build/core/server/clientInstancePool.js.map +1 -1
- package/build/core/server/connectionManager.d.ts.map +1 -1
- package/build/core/server/connectionManager.js +2 -0
- package/build/core/server/connectionManager.js.map +1 -1
- package/build/core/server/disabledTools.d.ts +2 -0
- package/build/core/server/disabledTools.d.ts.map +1 -1
- package/build/core/server/disabledTools.js +7 -4
- package/build/core/server/disabledTools.js.map +1 -1
- package/build/core/server/requestContextPreparation.d.ts +2 -1
- package/build/core/server/requestContextPreparation.d.ts.map +1 -1
- package/build/core/server/requestContextPreparation.js.map +1 -1
- package/build/core/server/runtimeScopeOwnership.js +1 -1
- package/build/core/server/runtimeScopeOwnership.js.map +1 -1
- package/build/core/server/serverManager.d.ts.map +1 -1
- package/build/core/server/serverManager.js +1 -0
- package/build/core/server/serverManager.js.map +1 -1
- package/build/core/server/templateIdentity.d.ts +1 -0
- package/build/core/server/templateIdentity.d.ts.map +1 -1
- package/build/core/server/templateIdentity.js +11 -1
- package/build/core/server/templateIdentity.js.map +1 -1
- package/build/core/server/templateServerManager.d.ts +5 -1
- package/build/core/server/templateServerManager.d.ts.map +1 -1
- package/build/core/server/templateServerManager.js +27 -9
- package/build/core/server/templateServerManager.js.map +1 -1
- package/build/core/server/toolDescriptionOverrides.d.ts +9 -0
- package/build/core/server/toolDescriptionOverrides.d.ts.map +1 -0
- package/build/core/server/toolDescriptionOverrides.js +44 -0
- package/build/core/server/toolDescriptionOverrides.js.map +1 -0
- package/build/core/tools/handlers/serverManagementHandler.d.ts +15 -1
- package/build/core/tools/handlers/serverManagementHandler.d.ts.map +1 -1
- package/build/core/tools/internal/adapters/helpers/configTransformers.d.ts +2 -0
- package/build/core/tools/internal/adapters/helpers/configTransformers.d.ts.map +1 -1
- package/build/core/tools/internal/schemas/discovery.d.ts +2 -2
- package/build/core/tools/internal/schemas/index.d.ts +9 -9
- package/build/core/tools/internal/schemas/installation.d.ts +3 -3
- package/build/core/tools/internal/schemas/management.d.ts +4 -4
- package/build/core/types/server.d.ts +2 -0
- package/build/core/types/server.d.ts.map +1 -1
- package/build/core/types/server.js.map +1 -1
- package/build/core/types/transport.d.ts +43 -0
- package/build/core/types/transport.d.ts.map +1 -1
- package/build/core/types/transport.js +60 -1
- package/build/core/types/transport.js.map +1 -1
- package/build/domains/admin/adminConfiguredServerService.d.ts +131 -4
- package/build/domains/admin/adminConfiguredServerService.d.ts.map +1 -1
- package/build/domains/admin/adminConfiguredServerService.js +766 -39
- package/build/domains/admin/adminConfiguredServerService.js.map +1 -1
- package/build/domains/admin/adminDomain.d.ts +13 -0
- package/build/domains/admin/adminDomain.d.ts.map +1 -1
- package/build/domains/admin/adminDomain.js +16 -0
- package/build/domains/admin/adminDomain.js.map +1 -1
- package/build/domains/admin/adminInstructionPreviewRuntime.d.ts +7 -0
- package/build/domains/admin/adminInstructionPreviewRuntime.d.ts.map +1 -0
- package/build/domains/admin/adminInstructionPreviewRuntime.js +154 -0
- package/build/domains/admin/adminInstructionPreviewRuntime.js.map +1 -0
- package/build/domains/admin/adminInstructionTemplateService.d.ts +169 -0
- package/build/domains/admin/adminInstructionTemplateService.d.ts.map +1 -0
- package/build/domains/admin/adminInstructionTemplateService.js +181 -0
- package/build/domains/admin/adminInstructionTemplateService.js.map +1 -0
- package/build/domains/admin/configuredToolInventory.d.ts +46 -0
- package/build/domains/admin/configuredToolInventory.d.ts.map +1 -0
- package/build/domains/admin/configuredToolInventory.js +135 -0
- package/build/domains/admin/configuredToolInventory.js.map +1 -0
- package/build/domains/backend-logs/backendLogSource.d.ts.map +1 -1
- package/build/domains/backend-logs/backendLogSource.js.map +1 -1
- package/build/domains/config-change/configChange.d.ts +2 -1
- package/build/domains/config-change/configChange.d.ts.map +1 -1
- package/build/domains/config-change/configChange.js +241 -13
- package/build/domains/config-change/configChange.js.map +1 -1
- package/build/domains/config-change/types.d.ts +34 -2
- package/build/domains/config-change/types.d.ts.map +1 -1
- package/build/domains/installation/serverInstallationSourceResolution.js +2 -0
- package/build/domains/installation/serverInstallationSourceResolution.js.map +1 -1
- package/build/domains/installation/serverInstallationTypes.d.ts +8 -0
- package/build/domains/installation/serverInstallationTypes.d.ts.map +1 -1
- package/build/domains/installation/serverInstallationWorkflow.js +16 -3
- package/build/domains/installation/serverInstallationWorkflow.js.map +1 -1
- package/build/domains/instruction-template/instructionTemplateManager.d.ts +58 -0
- package/build/domains/instruction-template/instructionTemplateManager.d.ts.map +1 -0
- package/build/domains/instruction-template/instructionTemplateManager.js +167 -0
- package/build/domains/instruction-template/instructionTemplateManager.js.map +1 -0
- package/build/domains/runtime-targets/runtimeIdentityVerification.d.ts +1 -0
- package/build/domains/runtime-targets/runtimeIdentityVerification.d.ts.map +1 -1
- package/build/domains/runtime-targets/runtimeIdentityVerification.js +6 -5
- package/build/domains/runtime-targets/runtimeIdentityVerification.js.map +1 -1
- package/build/transport/http/middlewares/httpRequestLogger.d.ts.map +1 -1
- package/build/transport/http/middlewares/httpRequestLogger.js +3 -2
- package/build/transport/http/middlewares/httpRequestLogger.js.map +1 -1
- package/build/transport/http/routes/adminRoutes.d.ts +2 -0
- package/build/transport/http/routes/adminRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/adminRoutes.js +422 -23
- package/build/transport/http/routes/adminRoutes.js.map +1 -1
- package/build/transport/http/routes/apiRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/apiRoutes.js +2 -0
- package/build/transport/http/routes/apiRoutes.js.map +1 -1
- package/build/transport/http/routes/inspectRequestContext.d.ts +2 -0
- package/build/transport/http/routes/inspectRequestContext.d.ts.map +1 -1
- package/build/transport/http/routes/inspectRequestContext.js +15 -6
- package/build/transport/http/routes/inspectRequestContext.js.map +1 -1
- package/build/transport/http/routes/inspectRoutes.d.ts +9 -0
- package/build/transport/http/routes/inspectRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/inspectRoutes.js +15 -10
- package/build/transport/http/routes/inspectRoutes.js.map +1 -1
- package/build/transport/http/routes/instructionsRoutes.d.ts +4 -0
- package/build/transport/http/routes/instructionsRoutes.d.ts.map +1 -0
- package/build/transport/http/routes/instructionsRoutes.js +147 -0
- package/build/transport/http/routes/instructionsRoutes.js.map +1 -0
- package/build/transport/http/routes/streamableHttpRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/streamableHttpRoutes.js +13 -4
- package/build/transport/http/routes/streamableHttpRoutes.js.map +1 -1
- package/build/transport/http/routes/toolRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/toolRoutes.js +5 -4
- package/build/transport/http/routes/toolRoutes.js.map +1 -1
- package/build/transport/http/server.d.ts.map +1 -1
- package/build/transport/http/server.js +17 -0
- package/build/transport/http/server.js.map +1 -1
- package/build/transport/http/storage/streamableSessionRepository.d.ts.map +1 -1
- package/build/transport/http/storage/streamableSessionRepository.js +2 -0
- package/build/transport/http/storage/streamableSessionRepository.js.map +1 -1
- package/build/transport/http/streamableSessionLifecycle.d.ts +3 -1
- package/build/transport/http/streamableSessionLifecycle.d.ts.map +1 -1
- package/build/transport/http/streamableSessionLifecycle.js +23 -6
- package/build/transport/http/streamableSessionLifecycle.js.map +1 -1
- package/build/transport/http/utils/contextExtractor.d.ts +14 -16
- package/build/transport/http/utils/contextExtractor.d.ts.map +1 -1
- package/build/transport/http/utils/contextExtractor.js +124 -33
- package/build/transport/http/utils/contextExtractor.js.map +1 -1
- package/build/transport/http/utils/templateContextAuthority.d.ts +13 -0
- package/build/transport/http/utils/templateContextAuthority.d.ts.map +1 -0
- package/build/transport/http/utils/templateContextAuthority.js +121 -0
- package/build/transport/http/utils/templateContextAuthority.js.map +1 -0
- package/build/transport/stdioProxyTransport.d.ts +3 -0
- package/build/transport/stdioProxyTransport.d.ts.map +1 -1
- package/build/transport/stdioProxyTransport.js +7 -2
- package/build/transport/stdioProxyTransport.js.map +1 -1
- package/build/utils/validation/discoveredServer.d.ts +15 -0
- package/build/utils/validation/discoveredServer.d.ts.map +1 -0
- package/build/utils/validation/discoveredServer.js +2 -0
- package/build/utils/validation/discoveredServer.js.map +1 -0
- package/build/utils/validation/urlDetection.d.ts +4 -5
- package/build/utils/validation/urlDetection.d.ts.map +1 -1
- package/build/utils/validation/urlDetection.js +94 -25
- package/build/utils/validation/urlDetection.js.map +1 -1
- package/package.json +2 -2
- package/build/admin/assets/admin-console-BOl7XR0p.js +0 -61
- package/build/utils/ui/pagination.d.ts +0 -35
- package/build/utils/ui/pagination.d.ts.map +0 -1
- package/build/utils/ui/pagination.js +0 -166
- package/build/utils/ui/pagination.js.map +0 -1
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { TokenEstimationService } from '../../application/services/tokenEstimationService.js';
|
|
3
|
+
import { publishLastConfiguredToolSnapshot, readConfiguredToolSnapshot, readLastConfiguredToolSnapshot, } from '../../core/capabilities/configuredToolSnapshot.js';
|
|
4
|
+
import { getDisabledTools, getLogicalToolName, isToolDisabled } from '../../core/server/disabledTools.js';
|
|
5
|
+
import { applyEffectiveToolDescription, getToolDescriptionOverrides, } from '../../core/server/toolDescriptionOverrides.js';
|
|
6
|
+
import { ClientStatus } from '../../core/types/index.js';
|
|
7
|
+
import { isConfiguredServerTargetDisabled } from '../../domains/config-change/configChange.js';
|
|
8
|
+
export async function createConfiguredToolInventory(input) {
|
|
9
|
+
const model = input.model?.trim() || 'gpt-4o';
|
|
10
|
+
const matchingConnections = Array.from(input.connections.entries()).filter(([, connection]) => {
|
|
11
|
+
const logicalName = connection.name;
|
|
12
|
+
return connection.status === ClientStatus.Connected && logicalName === input.targetName;
|
|
13
|
+
});
|
|
14
|
+
const activeInstanceCount = matchingConnections.length;
|
|
15
|
+
const toolsByName = new Map();
|
|
16
|
+
let successfulInstances = 0;
|
|
17
|
+
const snapshotAvailability = [];
|
|
18
|
+
for (const [connectionKey, connection] of matchingConnections) {
|
|
19
|
+
const tools = readConfiguredToolSnapshot(connection);
|
|
20
|
+
snapshotAvailability.push({ connectionKey, available: tools !== undefined });
|
|
21
|
+
if (!tools)
|
|
22
|
+
continue;
|
|
23
|
+
successfulInstances += 1;
|
|
24
|
+
for (const tool of tools) {
|
|
25
|
+
const existing = toolsByName.get(tool.name);
|
|
26
|
+
if (existing)
|
|
27
|
+
existing.instances.add(connectionKey);
|
|
28
|
+
else
|
|
29
|
+
toolsByName.set(tool.name, { tool, instances: new Set([connectionKey]), live: true });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (activeInstanceCount > 0 && successfulInstances === activeInstanceCount) {
|
|
33
|
+
publishLastConfiguredToolSnapshot(input.targetName, Array.from(toolsByName.values(), ({ tool }) => tool));
|
|
34
|
+
}
|
|
35
|
+
for (const tool of readLastConfiguredToolSnapshot(input.targetName)) {
|
|
36
|
+
if (!toolsByName.has(tool.name))
|
|
37
|
+
toolsByName.set(tool.name, { tool, instances: new Set(), live: false });
|
|
38
|
+
}
|
|
39
|
+
const overrides = getToolDescriptionOverrides(input.config);
|
|
40
|
+
const configuredNames = new Set([
|
|
41
|
+
...getDisabledTools(input.config).map((name) => getLogicalToolName(input.targetName, name)),
|
|
42
|
+
...Object.keys(overrides).map((name) => getLogicalToolName(input.targetName, name)),
|
|
43
|
+
]);
|
|
44
|
+
const allNames = new Set([...toolsByName.keys(), ...configuredNames]);
|
|
45
|
+
const tokenEstimator = new TokenEstimationService(model);
|
|
46
|
+
const serverConfigs = { [input.targetName]: input.config };
|
|
47
|
+
let rows;
|
|
48
|
+
try {
|
|
49
|
+
rows = Array.from(allNames)
|
|
50
|
+
.sort((left, right) => left.localeCompare(right))
|
|
51
|
+
.map((name) => {
|
|
52
|
+
const observed = toolsByName.get(name);
|
|
53
|
+
const effectiveTool = observed
|
|
54
|
+
? applyEffectiveToolDescription(observed.tool, input.config, input.targetName)
|
|
55
|
+
: undefined;
|
|
56
|
+
const approximateTokens = effectiveTool
|
|
57
|
+
? (tokenEstimator.estimateServerTokens(input.targetName, [effectiveTool], [], [], true).breakdown.tools[0]
|
|
58
|
+
?.tokens ?? 0)
|
|
59
|
+
: 0;
|
|
60
|
+
const observedInstanceCount = observed?.instances.size ?? 0;
|
|
61
|
+
const descriptionOverride = overrides[name];
|
|
62
|
+
return {
|
|
63
|
+
name,
|
|
64
|
+
...(observed?.tool.description !== undefined ? { upstreamDescription: observed.tool.description } : {}),
|
|
65
|
+
...(effectiveTool?.description !== undefined
|
|
66
|
+
? { effectiveDescription: effectiveTool.description }
|
|
67
|
+
: descriptionOverride !== undefined
|
|
68
|
+
? { effectiveDescription: descriptionOverride }
|
|
69
|
+
: {}),
|
|
70
|
+
...(descriptionOverride !== undefined ? { descriptionOverride } : {}),
|
|
71
|
+
descriptionOverridden: descriptionOverride !== undefined,
|
|
72
|
+
enabled: !isToolDisabled(serverConfigs, input.targetName, name),
|
|
73
|
+
observed: observed?.live ?? false,
|
|
74
|
+
stale: observed !== undefined && !observed.live,
|
|
75
|
+
unresolved: observed === undefined,
|
|
76
|
+
observedInstanceCount,
|
|
77
|
+
activeInstanceCount,
|
|
78
|
+
observedInSomeInstances: successfulInstances === activeInstanceCount &&
|
|
79
|
+
observedInstanceCount > 0 &&
|
|
80
|
+
observedInstanceCount < activeInstanceCount,
|
|
81
|
+
approximateTokens,
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
tokenEstimator.dispose();
|
|
87
|
+
}
|
|
88
|
+
const allObservedTokens = rows.reduce((total, row) => total + row.approximateTokens, 0);
|
|
89
|
+
const enabledTokens = rows.reduce((total, row) => total + (row.enabled ? row.approximateTokens : 0), 0);
|
|
90
|
+
const generation = createHash('sha256')
|
|
91
|
+
.update(JSON.stringify({
|
|
92
|
+
targetName: input.targetName,
|
|
93
|
+
source: input.source,
|
|
94
|
+
instances: snapshotAvailability.sort((left, right) => left.connectionKey.localeCompare(right.connectionKey)),
|
|
95
|
+
tools: Array.from(toolsByName.entries())
|
|
96
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
97
|
+
.map(([name, observed]) => ({
|
|
98
|
+
name,
|
|
99
|
+
tool: normalizeGenerationValue(observed.tool),
|
|
100
|
+
instances: Array.from(observed.instances).sort(),
|
|
101
|
+
})),
|
|
102
|
+
}))
|
|
103
|
+
.digest('base64url');
|
|
104
|
+
return {
|
|
105
|
+
targetName: input.targetName,
|
|
106
|
+
source: input.source,
|
|
107
|
+
targetEnabled: !isConfiguredServerTargetDisabled(input.config.disabled),
|
|
108
|
+
freshness: activeInstanceCount > 0 && successfulInstances === activeInstanceCount ? 'live' : 'unavailable',
|
|
109
|
+
model,
|
|
110
|
+
generation,
|
|
111
|
+
activeInstanceCount,
|
|
112
|
+
rows,
|
|
113
|
+
counts: {
|
|
114
|
+
observed: rows.filter((row) => row.observed).length,
|
|
115
|
+
enabled: rows.filter((row) => row.enabled).length,
|
|
116
|
+
disabled: rows.filter((row) => !row.enabled).length,
|
|
117
|
+
unresolved: rows.filter((row) => row.unresolved).length,
|
|
118
|
+
},
|
|
119
|
+
approximateTokens: {
|
|
120
|
+
enabled: enabledTokens,
|
|
121
|
+
allObserved: allObservedTokens,
|
|
122
|
+
savings: allObservedTokens - enabledTokens,
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function normalizeGenerationValue(value) {
|
|
127
|
+
if (Array.isArray(value))
|
|
128
|
+
return value.map(normalizeGenerationValue);
|
|
129
|
+
if (!value || typeof value !== 'object')
|
|
130
|
+
return value;
|
|
131
|
+
return Object.fromEntries(Object.entries(value)
|
|
132
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
133
|
+
.map(([key, nested]) => [key, normalizeGenerationValue(nested)]));
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=configuredToolInventory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuredToolInventory.js","sourceRoot":"","sources":["../../../src/domains/admin/configuredToolInventory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,qDAAqD,CAAC;AAC7F,OAAO,EACL,iCAAiC,EACjC,0BAA0B,EAC1B,8BAA8B,GAC/B,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACzG,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,GAC5B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,YAAY,EAAkD,MAAM,0BAA0B,CAAC;AACxG,OAAO,EAAE,gCAAgC,E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../../src/domains/backend-logs/backendLogSource.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEhF,wBAAgB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"backendLogSource.d.ts","sourceRoot":"","sources":["../../../src/domains/backend-logs/backendLogSource.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEhF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,iBAA6B,GAAG,gBAAgB,CAS7G;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAC9C,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B,GAAG,gBAAgB,CASnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backendLogSource.js","sourceRoot":"","sources":["../../../src/domains/backend-logs/backendLogSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAIhF,MAAM,UAAU,sBAAsB,
|
|
1
|
+
{"version":3,"file":"backendLogSource.js","sourceRoot":"","sources":["../../../src/domains/backend-logs/backendLogSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAIhF,MAAM,UAAU,sBAAsB,CAAC,IAAY,EAAE,UAA6B,SAAS;IACzF,OAAO;QACL,EAAE,EAAE,UAAU,IAAI,EAAE;QACpB,aAAa,EAAE,IAAI;QACnB,WAAW,EAAE,IAAI;QACjB,IAAI,EAAE,QAAQ;QACd,OAAO;QACP,SAAS,EAAE,QAAQ;KACpB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,KAIxC;IACC,OAAO;QACL,EAAE,EAAE,YAAY,KAAK,CAAC,UAAU,EAAE;QAClC,aAAa,EAAE,KAAK,CAAC,UAAU;QAC/B,WAAW,EAAE,GAAG,KAAK,CAAC,YAAY,KAAK,wBAAwB,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG;QACpF,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,SAAS;QACnC,SAAS,EAAE,QAAQ;KACpB,CAAC;AACJ,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { MCPServerParams } from '../../core/types/index.js';
|
|
2
2
|
import type { ConfigChangePorts, ConfigChangeService } from './types.js';
|
|
3
|
-
export type { ConfigBackupPolicy, ConfigBackupResult, ConfigChangeOperation, ConfigChangePorts, ConfigChangeReason, ConfigChangeResult, ConfigChangeService, ConfigChangeStatus, ConfigReloadResult, ConfigReloadStatus, ConfigRetentionCleanupResult, ConfiguredServerTargetRef, ConfiguredServerTargetSource, EditConfiguredServerTargetInput, RemoveConfiguredServerTargetInput, SetConfiguredServerTargetEnabledStateInput, SetStaticConfiguredServerTargetInput, } from './types.js';
|
|
3
|
+
export type { ConfigBackupPolicy, ConfigBackupResult, ConfigChangeOperation, ConfigChangePorts, ConfigChangeReason, ConfigChangeResult, ConfigChangeService, ConfigChangeStatus, ConfigReloadResult, ConfigReloadStatus, ConfigRetentionCleanupResult, ConfiguredServerTargetRef, ConfiguredServerTargetSource, InstructionOverrideMutation, ChangeConfiguredServerInstructionOverrideInput, CreateStaticConfiguredServerTargetInput, EditConfiguredServerTargetInput, RemoveConfiguredServerTargetInput, SetConfiguredServerTargetEnabledStateInput, SetInstructionTemplateConfigurationInput, SetStaticConfiguredServerTargetInput, } from './types.js';
|
|
4
4
|
export declare function createConfigChangeService(ports?: ConfigChangePorts): ConfigChangeService;
|
|
5
5
|
export declare function fingerprintConfiguredServerTarget(serverConfig: MCPServerParams): string;
|
|
6
6
|
export declare function fingerprintConfiguredServerDefaults(serverDefaults: unknown): string;
|
|
7
|
+
export declare function fingerprintConfiguredServerConfigDocument(config: unknown): string;
|
|
7
8
|
export declare function fingerprintConfiguredServerSecretValue(value: string): string;
|
|
8
9
|
export declare function isConfiguredServerTargetDisabled(value: MCPServerParams['disabled']): boolean;
|
|
9
10
|
//# sourceMappingURL=configChange.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configChange.d.ts","sourceRoot":"","sources":["../../../src/domains/config-change/configChange.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"configChange.d.ts","sourceRoot":"","sources":["../../../src/domains/config-change/configChange.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAkBhE,OAAO,KAAK,EAIV,iBAAiB,EAGjB,mBAAmB,EAYpB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,yBAAyB,EACzB,4BAA4B,EAC5B,2BAA2B,EAC3B,8CAA8C,EAC9C,uCAAuC,EACvC,+BAA+B,EAC/B,iCAAiC,EACjC,0CAA0C,EAC1C,wCAAwC,EACxC,oCAAoC,GACrC,MAAM,YAAY,CAAC;AAEpB,wBAAgB,yBAAyB,CAAC,KAAK,GAAE,iBAAsB,GAAG,mBAAmB,CAE5F;AAID,wBAAgB,iCAAiC,CAAC,YAAY,EAAE,eAAe,GAAG,MAAM,CAEvF;AAED,wBAAgB,mCAAmC,CAAC,cAAc,EAAE,OAAO,GAAG,MAAM,CAEnF;AAED,wBAAgB,yCAAyC,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAQjF;AAED,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,eAAe,CAAC,UAAU,CAAC,GAAG,OAAO,CAI5F"}
|
|
@@ -4,6 +4,7 @@ import path from 'path';
|
|
|
4
4
|
import ConfigContext from '../../config/configContext.js';
|
|
5
5
|
import { ConfigLoader } from '../../config/configLoader.js';
|
|
6
6
|
import { McpConfigManager } from '../../config/mcpConfigManager.js';
|
|
7
|
+
import { mcpServerConfigSchema } from '../../core/types/transport.js';
|
|
7
8
|
import logger from '../../logger/logger.js';
|
|
8
9
|
import { parse as parseToml } from 'smol-toml';
|
|
9
10
|
import { DEFAULT_BACKUP_RETENTION, listConfigBackups, retentionSkipped, } from './backupRetention.js';
|
|
@@ -18,6 +19,14 @@ export function fingerprintConfiguredServerTarget(serverConfig) {
|
|
|
18
19
|
export function fingerprintConfiguredServerDefaults(serverDefaults) {
|
|
19
20
|
return `configured_server_defaults_${keyedConfiguredServerFingerprint('defaults', stableStringify(serverDefaults ?? {}))}`;
|
|
20
21
|
}
|
|
22
|
+
export function fingerprintConfiguredServerConfigDocument(config) {
|
|
23
|
+
const record = config && typeof config === 'object' && !Array.isArray(config) ? config : {};
|
|
24
|
+
const normalized = {
|
|
25
|
+
...record,
|
|
26
|
+
mcpServers: record.mcpServers && typeof record.mcpServers === 'object' ? record.mcpServers : {},
|
|
27
|
+
};
|
|
28
|
+
return `configured_server_config_${keyedConfiguredServerFingerprint('config-document', stableStringify(normalized))}`;
|
|
29
|
+
}
|
|
21
30
|
export function fingerprintConfiguredServerSecretValue(value) {
|
|
22
31
|
return keyedConfiguredServerFingerprint('inline-secret', value);
|
|
23
32
|
}
|
|
@@ -172,6 +181,86 @@ class DefaultConfigChangeService {
|
|
|
172
181
|
reload: this.reloadConfig(configPath),
|
|
173
182
|
};
|
|
174
183
|
}
|
|
184
|
+
async createStaticConfiguredServerTarget(input) {
|
|
185
|
+
const configPath = this.resolveConfigPath();
|
|
186
|
+
let releaseLock;
|
|
187
|
+
try {
|
|
188
|
+
releaseLock = await acquireConfigLock(configPath, this.ports.lockTimeoutMs ?? DEFAULT_LOCK_TIMEOUT_MS);
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
if (error instanceof ConfigLockTimeoutError) {
|
|
192
|
+
return {
|
|
193
|
+
status: 'failed',
|
|
194
|
+
operation: 'create_static',
|
|
195
|
+
configPath,
|
|
196
|
+
target: { name: input.targetName },
|
|
197
|
+
changed: false,
|
|
198
|
+
backup: { created: false },
|
|
199
|
+
retentionCleanup: retentionSkipped(),
|
|
200
|
+
reload: { status: 'skipped' },
|
|
201
|
+
warnings: [],
|
|
202
|
+
error: error.message,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
throw error;
|
|
206
|
+
}
|
|
207
|
+
let resultWithoutReload;
|
|
208
|
+
try {
|
|
209
|
+
const config = this.loadConfigForSet(configPath);
|
|
210
|
+
if (input.expectedConfigFingerprint !== undefined &&
|
|
211
|
+
fingerprintConfiguredServerConfigDocument(config) !== input.expectedConfigFingerprint) {
|
|
212
|
+
return {
|
|
213
|
+
status: 'source_conflict',
|
|
214
|
+
operation: 'create_static',
|
|
215
|
+
configPath,
|
|
216
|
+
target: { name: input.targetName },
|
|
217
|
+
changed: false,
|
|
218
|
+
backup: { created: false },
|
|
219
|
+
retentionCleanup: retentionSkipped(),
|
|
220
|
+
reload: { status: 'skipped' },
|
|
221
|
+
warnings: [],
|
|
222
|
+
error: 'Configured server state changed after preview',
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
const target = resolveConfiguredServerTarget(config, input.targetName);
|
|
226
|
+
if (target.source) {
|
|
227
|
+
const templateConflict = target.source === 'mcpTemplates';
|
|
228
|
+
return {
|
|
229
|
+
status: templateConflict ? 'template_conflict' : 'destination_conflict',
|
|
230
|
+
operation: 'create_static',
|
|
231
|
+
configPath,
|
|
232
|
+
target,
|
|
233
|
+
changed: false,
|
|
234
|
+
backup: { created: false },
|
|
235
|
+
retentionCleanup: retentionSkipped(),
|
|
236
|
+
reload: { status: 'skipped' },
|
|
237
|
+
warnings: [],
|
|
238
|
+
error: `Configured server target '${input.targetName}' already exists`,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
const backup = this.createBackupIfNeeded(configPath, input.backup ?? 'skip');
|
|
242
|
+
config.mcpServers = normalizeServerRecord(config.mcpServers);
|
|
243
|
+
config.mcpServers[input.targetName] = input.serverConfig;
|
|
244
|
+
this.validateConfig(configPath, config);
|
|
245
|
+
this.writeConfig(configPath, config);
|
|
246
|
+
const retentionCleanup = this.cleanupBackups(configPath, backup);
|
|
247
|
+
resultWithoutReload = {
|
|
248
|
+
status: 'changed',
|
|
249
|
+
operation: 'create_static',
|
|
250
|
+
configPath,
|
|
251
|
+
target: { name: input.targetName, source: 'mcpServers' },
|
|
252
|
+
changed: true,
|
|
253
|
+
backup,
|
|
254
|
+
retentionCleanup,
|
|
255
|
+
reload: { status: 'skipped' },
|
|
256
|
+
warnings: retentionCleanup.warnings,
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
finally {
|
|
260
|
+
releaseLock();
|
|
261
|
+
}
|
|
262
|
+
return { ...resultWithoutReload, reload: this.reloadConfig(configPath) };
|
|
263
|
+
}
|
|
175
264
|
async setConfiguredServerTargetEnabledState(input) {
|
|
176
265
|
const configPath = this.resolveConfigPath();
|
|
177
266
|
const operation = input.enabled ? 'enable' : 'disable';
|
|
@@ -199,7 +288,7 @@ class DefaultConfigChangeService {
|
|
|
199
288
|
let resultWithoutReload;
|
|
200
289
|
try {
|
|
201
290
|
const config = this.loadConfig(configPath);
|
|
202
|
-
const target =
|
|
291
|
+
const target = resolveConfiguredServerTargetForSource(config, input.targetName, input.targetSource);
|
|
203
292
|
if (!target.source) {
|
|
204
293
|
resultWithoutReload = {
|
|
205
294
|
status: 'not_found',
|
|
@@ -306,14 +395,12 @@ class DefaultConfigChangeService {
|
|
|
306
395
|
let resultWithoutReload;
|
|
307
396
|
try {
|
|
308
397
|
const config = this.loadConfig(configPath);
|
|
309
|
-
const source =
|
|
398
|
+
const source = resolveConfiguredServerTargetForSource(config, input.sourceName, input.targetSource);
|
|
310
399
|
if (!source.source) {
|
|
311
400
|
return editConflictResult('not_found', configPath, source);
|
|
312
401
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
}
|
|
316
|
-
const existingConfig = config.mcpServers?.[input.sourceName];
|
|
402
|
+
const sourceSection = source.source === 'mcpTemplates' ? config.mcpTemplates : config.mcpServers;
|
|
403
|
+
const existingConfig = sourceSection?.[input.sourceName];
|
|
317
404
|
if (!existingConfig) {
|
|
318
405
|
return editConflictResult('not_found', configPath, source);
|
|
319
406
|
}
|
|
@@ -325,8 +412,9 @@ class DefaultConfigChangeService {
|
|
|
325
412
|
return editConflictResult('source_conflict', configPath, source, 'Global transport defaults changed after preview');
|
|
326
413
|
}
|
|
327
414
|
if (input.targetName !== input.sourceName) {
|
|
328
|
-
const
|
|
329
|
-
if (
|
|
415
|
+
const destinationSection = source.source === 'mcpTemplates' ? config.mcpTemplates : config.mcpServers;
|
|
416
|
+
if (destinationSection?.[input.targetName]) {
|
|
417
|
+
const destination = { name: input.targetName, source: source.source };
|
|
330
418
|
return editConflictResult('destination_conflict', configPath, destination, `Configured server target '${input.targetName}' already exists`);
|
|
331
419
|
}
|
|
332
420
|
}
|
|
@@ -335,9 +423,10 @@ class DefaultConfigChangeService {
|
|
|
335
423
|
return editConflictResult('unchanged', configPath, source);
|
|
336
424
|
}
|
|
337
425
|
const nextConfig = cloneConfig(config);
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
426
|
+
const nextSection = normalizeServerRecord(nextConfig[source.source]);
|
|
427
|
+
nextConfig[source.source] = nextSection;
|
|
428
|
+
delete nextSection[input.sourceName];
|
|
429
|
+
nextSection[input.targetName] = input.serverConfig;
|
|
341
430
|
this.validateConfig(configPath, nextConfig);
|
|
342
431
|
const backup = this.createBackupIfNeeded(configPath, 'required');
|
|
343
432
|
this.writeConfig(configPath, nextConfig);
|
|
@@ -346,7 +435,7 @@ class DefaultConfigChangeService {
|
|
|
346
435
|
status: 'changed',
|
|
347
436
|
operation: 'edit',
|
|
348
437
|
configPath,
|
|
349
|
-
target: { name: input.targetName, source:
|
|
438
|
+
target: { name: input.targetName, source: source.source },
|
|
350
439
|
changed: true,
|
|
351
440
|
backup,
|
|
352
441
|
retentionCleanup,
|
|
@@ -363,7 +452,7 @@ class DefaultConfigChangeService {
|
|
|
363
452
|
const configPath = this.resolveConfigPath();
|
|
364
453
|
const operation = input.enabled ? 'enable' : 'disable';
|
|
365
454
|
const config = this.loadConfig(configPath);
|
|
366
|
-
const target =
|
|
455
|
+
const target = resolveConfiguredServerTargetForSource(config, input.targetName, input.targetSource);
|
|
367
456
|
if (!target.source) {
|
|
368
457
|
return {
|
|
369
458
|
status: 'not_found',
|
|
@@ -461,6 +550,125 @@ class DefaultConfigChangeService {
|
|
|
461
550
|
warnings: [],
|
|
462
551
|
};
|
|
463
552
|
}
|
|
553
|
+
async setInstructionTemplateConfiguration(input) {
|
|
554
|
+
const configPath = this.resolveConfigPath();
|
|
555
|
+
let releaseLock;
|
|
556
|
+
try {
|
|
557
|
+
releaseLock = await acquireConfigLock(configPath, this.ports.lockTimeoutMs ?? DEFAULT_LOCK_TIMEOUT_MS);
|
|
558
|
+
}
|
|
559
|
+
catch (error) {
|
|
560
|
+
if (error instanceof ConfigLockTimeoutError) {
|
|
561
|
+
return instructionChangeResult('failed', input.operation, configPath, { name: input.identity }, error.message);
|
|
562
|
+
}
|
|
563
|
+
throw error;
|
|
564
|
+
}
|
|
565
|
+
let resultWithoutReload;
|
|
566
|
+
try {
|
|
567
|
+
const config = this.loadConfig(configPath);
|
|
568
|
+
if (fingerprintConfiguredServerConfigDocument(config) !== input.expectedConfigFingerprint) {
|
|
569
|
+
return instructionChangeResult('source_conflict', input.operation, configPath, { name: input.identity }, 'Instruction template configuration changed after it was read');
|
|
570
|
+
}
|
|
571
|
+
const currentState = {
|
|
572
|
+
instructionTemplates: config.instructionTemplates,
|
|
573
|
+
publishedInstructionTemplates: config.publishedInstructionTemplates,
|
|
574
|
+
activeInstructionTemplate: config.activeInstructionTemplate,
|
|
575
|
+
};
|
|
576
|
+
const requestedState = {
|
|
577
|
+
instructionTemplates: input.instructionTemplates,
|
|
578
|
+
publishedInstructionTemplates: input.publishedInstructionTemplates,
|
|
579
|
+
activeInstructionTemplate: input.activeInstructionTemplate,
|
|
580
|
+
};
|
|
581
|
+
if (stableStringify(currentState) === stableStringify(requestedState)) {
|
|
582
|
+
return instructionChangeResult('unchanged', input.operation, configPath, { name: input.identity });
|
|
583
|
+
}
|
|
584
|
+
const nextConfig = cloneConfig(config);
|
|
585
|
+
if (input.instructionTemplates === undefined)
|
|
586
|
+
delete nextConfig.instructionTemplates;
|
|
587
|
+
else
|
|
588
|
+
nextConfig.instructionTemplates = input.instructionTemplates;
|
|
589
|
+
if (input.publishedInstructionTemplates === undefined)
|
|
590
|
+
delete nextConfig.publishedInstructionTemplates;
|
|
591
|
+
else
|
|
592
|
+
nextConfig.publishedInstructionTemplates = input.publishedInstructionTemplates;
|
|
593
|
+
if (input.activeInstructionTemplate === undefined)
|
|
594
|
+
delete nextConfig.activeInstructionTemplate;
|
|
595
|
+
else
|
|
596
|
+
nextConfig.activeInstructionTemplate = input.activeInstructionTemplate;
|
|
597
|
+
this.validateConfig(configPath, nextConfig);
|
|
598
|
+
const backup = this.createBackupIfNeeded(configPath, 'required');
|
|
599
|
+
this.writeConfig(configPath, nextConfig);
|
|
600
|
+
const retentionCleanup = this.cleanupBackups(configPath, backup);
|
|
601
|
+
resultWithoutReload = {
|
|
602
|
+
...instructionChangeResult('changed', input.operation, configPath, { name: input.identity }),
|
|
603
|
+
changed: true,
|
|
604
|
+
backup,
|
|
605
|
+
retentionCleanup,
|
|
606
|
+
warnings: retentionCleanup.warnings,
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
finally {
|
|
610
|
+
releaseLock();
|
|
611
|
+
}
|
|
612
|
+
return { ...resultWithoutReload, reload: this.reloadConfig(configPath) };
|
|
613
|
+
}
|
|
614
|
+
async changeConfiguredServerInstructionOverride(input) {
|
|
615
|
+
const configPath = this.resolveConfigPath();
|
|
616
|
+
const operation = input.mutation.action === 'set' ? 'instruction_override_set' : 'instruction_override_remove';
|
|
617
|
+
let releaseLock;
|
|
618
|
+
try {
|
|
619
|
+
releaseLock = await acquireConfigLock(configPath, this.ports.lockTimeoutMs ?? DEFAULT_LOCK_TIMEOUT_MS);
|
|
620
|
+
}
|
|
621
|
+
catch (error) {
|
|
622
|
+
if (error instanceof ConfigLockTimeoutError) {
|
|
623
|
+
return instructionChangeResult('failed', operation, configPath, input.target, error.message);
|
|
624
|
+
}
|
|
625
|
+
throw error;
|
|
626
|
+
}
|
|
627
|
+
let resultWithoutReload;
|
|
628
|
+
try {
|
|
629
|
+
const config = this.loadConfig(configPath);
|
|
630
|
+
if (input.expectedConfigFingerprint !== undefined &&
|
|
631
|
+
fingerprintConfiguredServerConfigDocument(config) !== input.expectedConfigFingerprint) {
|
|
632
|
+
return instructionChangeResult('source_conflict', operation, configPath, input.target, 'Configured server state changed after it was read');
|
|
633
|
+
}
|
|
634
|
+
const section = input.target.source === 'mcpServers' ? config.mcpServers : config.mcpTemplates;
|
|
635
|
+
const existing = section?.[input.target.name];
|
|
636
|
+
if (!existing)
|
|
637
|
+
return instructionChangeResult('not_found', operation, configPath, input.target);
|
|
638
|
+
if (fingerprintConfiguredServerTarget(existing) !== input.expectedSourceFingerprint) {
|
|
639
|
+
return instructionChangeResult('source_conflict', operation, configPath, input.target, `Configured server target '${input.target.name}' changed after it was read`);
|
|
640
|
+
}
|
|
641
|
+
const hasOverride = Object.hasOwn(existing, 'instructionOverride');
|
|
642
|
+
if ((input.mutation.action === 'set' && hasOverride && existing.instructionOverride === input.mutation.value) ||
|
|
643
|
+
(input.mutation.action === 'remove' && !hasOverride)) {
|
|
644
|
+
return instructionChangeResult('unchanged', operation, configPath, input.target);
|
|
645
|
+
}
|
|
646
|
+
const nextConfig = cloneConfig(config);
|
|
647
|
+
const nextSection = input.target.source === 'mcpServers' ? nextConfig.mcpServers : nextConfig.mcpTemplates;
|
|
648
|
+
const nextTarget = nextSection?.[input.target.name];
|
|
649
|
+
if (!nextTarget)
|
|
650
|
+
return instructionChangeResult('not_found', operation, configPath, input.target);
|
|
651
|
+
if (input.mutation.action === 'set')
|
|
652
|
+
nextTarget.instructionOverride = input.mutation.value;
|
|
653
|
+
else
|
|
654
|
+
delete nextTarget.instructionOverride;
|
|
655
|
+
this.validateConfig(configPath, nextConfig);
|
|
656
|
+
const backup = this.createBackupIfNeeded(configPath, 'required');
|
|
657
|
+
this.writeConfig(configPath, nextConfig);
|
|
658
|
+
const retentionCleanup = this.cleanupBackups(configPath, backup);
|
|
659
|
+
resultWithoutReload = {
|
|
660
|
+
...instructionChangeResult('changed', operation, configPath, input.target),
|
|
661
|
+
changed: true,
|
|
662
|
+
backup,
|
|
663
|
+
retentionCleanup,
|
|
664
|
+
warnings: retentionCleanup.warnings,
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
finally {
|
|
668
|
+
releaseLock();
|
|
669
|
+
}
|
|
670
|
+
return { ...resultWithoutReload, reload: this.reloadConfig(configPath) };
|
|
671
|
+
}
|
|
464
672
|
async acquireConfigLockForTest(configPath) {
|
|
465
673
|
return acquireConfigLock(configPath, DEFAULT_LOCK_TIMEOUT_MS);
|
|
466
674
|
}
|
|
@@ -568,6 +776,7 @@ class DefaultConfigChangeService {
|
|
|
568
776
|
}
|
|
569
777
|
validateConfig(configPath, config) {
|
|
570
778
|
const loader = new ConfigLoader(configPath, { ensureConfigExists: false });
|
|
779
|
+
mcpServerConfigSchema.parse(config);
|
|
571
780
|
for (const [serverName, serverConfig] of Object.entries(config.mcpServers ?? {})) {
|
|
572
781
|
loader.validateServerConfig(serverName, serverConfig);
|
|
573
782
|
}
|
|
@@ -626,6 +835,11 @@ function resolveConfiguredServerTarget(config, targetName) {
|
|
|
626
835
|
}
|
|
627
836
|
return { name: targetName };
|
|
628
837
|
}
|
|
838
|
+
function resolveConfiguredServerTargetForSource(config, targetName, targetSource) {
|
|
839
|
+
if (!targetSource)
|
|
840
|
+
return resolveConfiguredServerTarget(config, targetName);
|
|
841
|
+
return config[targetSource]?.[targetName] ? { name: targetName, source: targetSource } : { name: targetName };
|
|
842
|
+
}
|
|
629
843
|
function removeTarget(config, target) {
|
|
630
844
|
const section = target.source === 'mcpTemplates' ? config.mcpTemplates : config.mcpServers;
|
|
631
845
|
if (!section) {
|
|
@@ -653,6 +867,20 @@ function editConflictResult(status, configPath, target, error) {
|
|
|
653
867
|
...(error ? { error } : {}),
|
|
654
868
|
};
|
|
655
869
|
}
|
|
870
|
+
function instructionChangeResult(status, operation, configPath, target, error) {
|
|
871
|
+
return {
|
|
872
|
+
status,
|
|
873
|
+
operation,
|
|
874
|
+
configPath,
|
|
875
|
+
target,
|
|
876
|
+
changed: false,
|
|
877
|
+
backup: { created: false },
|
|
878
|
+
retentionCleanup: retentionSkipped(),
|
|
879
|
+
reload: { status: 'skipped' },
|
|
880
|
+
warnings: [],
|
|
881
|
+
...(error ? { error } : {}),
|
|
882
|
+
};
|
|
883
|
+
}
|
|
656
884
|
function stableStringify(value) {
|
|
657
885
|
if (Array.isArray(value))
|
|
658
886
|
return `[${value.map(stableStringify).join(',')}]`;
|