@xenosystem/agent-interface-host 0.1.3
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/LICENSE +67 -0
- package/dist/acp/AcpAgentRegistryService.d.ts +77 -0
- package/dist/acp/AcpAgentRegistryService.d.ts.map +1 -0
- package/dist/acp/AcpAgentRegistryService.js +754 -0
- package/dist/acp/AcpAgentRegistryService.js.map +1 -0
- package/dist/acp/AcpAgentTurnExecutionAdapter.d.ts +56 -0
- package/dist/acp/AcpAgentTurnExecutionAdapter.d.ts.map +1 -0
- package/dist/acp/AcpAgentTurnExecutionAdapter.js +323 -0
- package/dist/acp/AcpAgentTurnExecutionAdapter.js.map +1 -0
- package/dist/acp/AcpApprovalPortAdapter.d.ts +41 -0
- package/dist/acp/AcpApprovalPortAdapter.d.ts.map +1 -0
- package/dist/acp/AcpApprovalPortAdapter.js +82 -0
- package/dist/acp/AcpApprovalPortAdapter.js.map +1 -0
- package/dist/acp/AcpCoordinationBridge.d.ts +13 -0
- package/dist/acp/AcpCoordinationBridge.d.ts.map +1 -0
- package/dist/acp/AcpCoordinationBridge.js +13 -0
- package/dist/acp/AcpCoordinationBridge.js.map +1 -0
- package/dist/acp/AcpDiagnosticsService.d.ts +61 -0
- package/dist/acp/AcpDiagnosticsService.d.ts.map +1 -0
- package/dist/acp/AcpDiagnosticsService.js +203 -0
- package/dist/acp/AcpDiagnosticsService.js.map +1 -0
- package/dist/acp/AcpExternalCertificationHarness.d.ts +47 -0
- package/dist/acp/AcpExternalCertificationHarness.d.ts.map +1 -0
- package/dist/acp/AcpExternalCertificationHarness.js +176 -0
- package/dist/acp/AcpExternalCertificationHarness.js.map +1 -0
- package/dist/acp/AcpHostBridge.d.ts +81 -0
- package/dist/acp/AcpHostBridge.d.ts.map +1 -0
- package/dist/acp/AcpHostBridge.js +101 -0
- package/dist/acp/AcpHostBridge.js.map +1 -0
- package/dist/acp/AcpInteractivePermissionBridge.d.ts +77 -0
- package/dist/acp/AcpInteractivePermissionBridge.d.ts.map +1 -0
- package/dist/acp/AcpInteractivePermissionBridge.js +127 -0
- package/dist/acp/AcpInteractivePermissionBridge.js.map +1 -0
- package/dist/acp/AcpPermissionBridge.d.ts +19 -0
- package/dist/acp/AcpPermissionBridge.d.ts.map +1 -0
- package/dist/acp/AcpPermissionBridge.js +110 -0
- package/dist/acp/AcpPermissionBridge.js.map +1 -0
- package/dist/acp/AcpPermissionPolicy.d.ts +111 -0
- package/dist/acp/AcpPermissionPolicy.d.ts.map +1 -0
- package/dist/acp/AcpPermissionPolicy.js +167 -0
- package/dist/acp/AcpPermissionPolicy.js.map +1 -0
- package/dist/acp/AcpProcessSupervisor.d.ts +134 -0
- package/dist/acp/AcpProcessSupervisor.d.ts.map +1 -0
- package/dist/acp/AcpProcessSupervisor.js +674 -0
- package/dist/acp/AcpProcessSupervisor.js.map +1 -0
- package/dist/acp/AcpProviderApprovalService.d.ts +27 -0
- package/dist/acp/AcpProviderApprovalService.d.ts.map +1 -0
- package/dist/acp/AcpProviderApprovalService.js +128 -0
- package/dist/acp/AcpProviderApprovalService.js.map +1 -0
- package/dist/acp/AcpProviderCatalogService.d.ts +69 -0
- package/dist/acp/AcpProviderCatalogService.d.ts.map +1 -0
- package/dist/acp/AcpProviderCatalogService.js +707 -0
- package/dist/acp/AcpProviderCatalogService.js.map +1 -0
- package/dist/acp/AcpProviderModelService.d.ts +6 -0
- package/dist/acp/AcpProviderModelService.d.ts.map +1 -0
- package/dist/acp/AcpProviderModelService.js +274 -0
- package/dist/acp/AcpProviderModelService.js.map +1 -0
- package/dist/acp/AcpProviderVersionReadiness.d.ts +6 -0
- package/dist/acp/AcpProviderVersionReadiness.d.ts.map +1 -0
- package/dist/acp/AcpProviderVersionReadiness.js +100 -0
- package/dist/acp/AcpProviderVersionReadiness.js.map +1 -0
- package/dist/acp/AcpRuntimeEventMapper.d.ts +16 -0
- package/dist/acp/AcpRuntimeEventMapper.d.ts.map +1 -0
- package/dist/acp/AcpRuntimeEventMapper.js +326 -0
- package/dist/acp/AcpRuntimeEventMapper.js.map +1 -0
- package/dist/acp/AcpSessionService.d.ts +65 -0
- package/dist/acp/AcpSessionService.d.ts.map +1 -0
- package/dist/acp/AcpSessionService.js +931 -0
- package/dist/acp/AcpSessionService.js.map +1 -0
- package/dist/acp/DurableAcpPermissionPolicyStore.d.ts +25 -0
- package/dist/acp/DurableAcpPermissionPolicyStore.d.ts.map +1 -0
- package/dist/acp/DurableAcpPermissionPolicyStore.js +100 -0
- package/dist/acp/DurableAcpPermissionPolicyStore.js.map +1 -0
- package/dist/acp/acpCommandSafety.d.ts +63 -0
- package/dist/acp/acpCommandSafety.d.ts.map +1 -0
- package/dist/acp/acpCommandSafety.js +90 -0
- package/dist/acp/acpCommandSafety.js.map +1 -0
- package/dist/acp/acpErrors.d.ts +47 -0
- package/dist/acp/acpErrors.d.ts.map +1 -0
- package/dist/acp/acpErrors.js +93 -0
- package/dist/acp/acpErrors.js.map +1 -0
- package/dist/acp/acpRedaction.d.ts +9 -0
- package/dist/acp/acpRedaction.d.ts.map +1 -0
- package/dist/acp/acpRedaction.js +69 -0
- package/dist/acp/acpRedaction.js.map +1 -0
- package/dist/acp/acpSessionResume.d.ts +8 -0
- package/dist/acp/acpSessionResume.d.ts.map +1 -0
- package/dist/acp/acpSessionResume.js +31 -0
- package/dist/acp/acpSessionResume.js.map +1 -0
- package/dist/acp/acpTypes.d.ts +467 -0
- package/dist/acp/acpTypes.d.ts.map +1 -0
- package/dist/acp/acpTypes.js +2 -0
- package/dist/acp/acpTypes.js.map +1 -0
- package/dist/agent/chooseDirectoryBridge.d.ts +29 -0
- package/dist/agent/chooseDirectoryBridge.d.ts.map +1 -0
- package/dist/agent/chooseDirectoryBridge.js +116 -0
- package/dist/agent/chooseDirectoryBridge.js.map +1 -0
- package/dist/agent/permissionProfiles.d.ts +29 -0
- package/dist/agent/permissionProfiles.d.ts.map +1 -0
- package/dist/agent/permissionProfiles.js +107 -0
- package/dist/agent/permissionProfiles.js.map +1 -0
- package/dist/agent/runtimeAuthorityPrompt.d.ts +13 -0
- package/dist/agent/runtimeAuthorityPrompt.d.ts.map +1 -0
- package/dist/agent/runtimeAuthorityPrompt.js +45 -0
- package/dist/agent/runtimeAuthorityPrompt.js.map +1 -0
- package/dist/agent/runtimeModeOutputGuard.d.ts +6 -0
- package/dist/agent/runtimeModeOutputGuard.d.ts.map +1 -0
- package/dist/agent/runtimeModeOutputGuard.js +40 -0
- package/dist/agent/runtimeModeOutputGuard.js.map +1 -0
- package/dist/agent/workspacePlacementBridge.d.ts +29 -0
- package/dist/agent/workspacePlacementBridge.d.ts.map +1 -0
- package/dist/agent/workspacePlacementBridge.js +143 -0
- package/dist/agent/workspacePlacementBridge.js.map +1 -0
- package/dist/agentSearch/AgentSearchService.d.ts +81 -0
- package/dist/agentSearch/AgentSearchService.d.ts.map +1 -0
- package/dist/agentSearch/AgentSearchService.js +1038 -0
- package/dist/agentSearch/AgentSearchService.js.map +1 -0
- package/dist/agentSearch/JsonInvertedIndexAdapter.d.ts +44 -0
- package/dist/agentSearch/JsonInvertedIndexAdapter.d.ts.map +1 -0
- package/dist/agentSearch/JsonInvertedIndexAdapter.js +307 -0
- package/dist/agentSearch/JsonInvertedIndexAdapter.js.map +1 -0
- package/dist/agentSearch/SearchIndexAdapter.d.ts +33 -0
- package/dist/agentSearch/SearchIndexAdapter.d.ts.map +1 -0
- package/dist/agentSearch/SearchIndexAdapter.js +2 -0
- package/dist/agentSearch/SearchIndexAdapter.js.map +1 -0
- package/dist/agentSearch/SearchSourceWatcher.d.ts +29 -0
- package/dist/agentSearch/SearchSourceWatcher.d.ts.map +1 -0
- package/dist/agentSearch/SearchSourceWatcher.js +150 -0
- package/dist/agentSearch/SearchSourceWatcher.js.map +1 -0
- package/dist/agentSearch/SqliteFtsIndexAdapter.d.ts +58 -0
- package/dist/agentSearch/SqliteFtsIndexAdapter.d.ts.map +1 -0
- package/dist/agentSearch/SqliteFtsIndexAdapter.js +420 -0
- package/dist/agentSearch/SqliteFtsIndexAdapter.js.map +1 -0
- package/dist/agentSearch/conversationIndexer.d.ts +69 -0
- package/dist/agentSearch/conversationIndexer.d.ts.map +1 -0
- package/dist/agentSearch/conversationIndexer.js +313 -0
- package/dist/agentSearch/conversationIndexer.js.map +1 -0
- package/dist/agentSearch/searchTypes.d.ts +264 -0
- package/dist/agentSearch/searchTypes.d.ts.map +1 -0
- package/dist/agentSearch/searchTypes.js +2 -0
- package/dist/agentSearch/searchTypes.js.map +1 -0
- package/dist/agentSearch/searchUtils.d.ts +12 -0
- package/dist/agentSearch/searchUtils.d.ts.map +1 -0
- package/dist/agentSearch/searchUtils.js +125 -0
- package/dist/agentSearch/searchUtils.js.map +1 -0
- package/dist/agentSearch/workspaceMetadataIndexer.d.ts +3 -0
- package/dist/agentSearch/workspaceMetadataIndexer.d.ts.map +1 -0
- package/dist/agentSearch/workspaceMetadataIndexer.js +125 -0
- package/dist/agentSearch/workspaceMetadataIndexer.js.map +1 -0
- package/dist/cli/CliControlPlaneService.d.ts +269 -0
- package/dist/cli/CliControlPlaneService.d.ts.map +1 -0
- package/dist/cli/CliControlPlaneService.js +1874 -0
- package/dist/cli/CliControlPlaneService.js.map +1 -0
- package/dist/cloud/XenoCloudAgentTurnExecutionAdapter.d.ts +91 -0
- package/dist/cloud/XenoCloudAgentTurnExecutionAdapter.d.ts.map +1 -0
- package/dist/cloud/XenoCloudAgentTurnExecutionAdapter.js +379 -0
- package/dist/cloud/XenoCloudAgentTurnExecutionAdapter.js.map +1 -0
- package/dist/codebase/CodebaseIntelligenceService.d.ts +68 -0
- package/dist/codebase/CodebaseIntelligenceService.d.ts.map +1 -0
- package/dist/codebase/CodebaseIntelligenceService.js +1717 -0
- package/dist/codebase/CodebaseIntelligenceService.js.map +1 -0
- package/dist/codebase/LanguageServerProcessManager.d.ts +85 -0
- package/dist/codebase/LanguageServerProcessManager.d.ts.map +1 -0
- package/dist/codebase/LanguageServerProcessManager.js +607 -0
- package/dist/codebase/LanguageServerProcessManager.js.map +1 -0
- package/dist/codebase/codeTypes.d.ts +485 -0
- package/dist/codebase/codeTypes.d.ts.map +1 -0
- package/dist/codebase/codeTypes.js +2 -0
- package/dist/codebase/codeTypes.js.map +1 -0
- package/dist/codebase/codeUtils.d.ts +24 -0
- package/dist/codebase/codeUtils.d.ts.map +1 -0
- package/dist/codebase/codeUtils.js +177 -0
- package/dist/codebase/codeUtils.js.map +1 -0
- package/dist/codebase/contextPacks.d.ts +18 -0
- package/dist/codebase/contextPacks.d.ts.map +1 -0
- package/dist/codebase/contextPacks.js +180 -0
- package/dist/codebase/contextPacks.js.map +1 -0
- package/dist/codebase/dependencyGraph.d.ts +3 -0
- package/dist/codebase/dependencyGraph.d.ts.map +1 -0
- package/dist/codebase/dependencyGraph.js +209 -0
- package/dist/codebase/dependencyGraph.js.map +1 -0
- package/dist/codebase/fileIndexer.d.ts +27 -0
- package/dist/codebase/fileIndexer.d.ts.map +1 -0
- package/dist/codebase/fileIndexer.js +167 -0
- package/dist/codebase/fileIndexer.js.map +1 -0
- package/dist/codebase/symbolIndexer.d.ts +3 -0
- package/dist/codebase/symbolIndexer.d.ts.map +1 -0
- package/dist/codebase/symbolIndexer.js +184 -0
- package/dist/codebase/symbolIndexer.js.map +1 -0
- package/dist/codebase/whatChanged.d.ts +4 -0
- package/dist/codebase/whatChanged.d.ts.map +1 -0
- package/dist/codebase/whatChanged.js +138 -0
- package/dist/codebase/whatChanged.js.map +1 -0
- package/dist/coordination/CoordinationService.d.ts +166 -0
- package/dist/coordination/CoordinationService.d.ts.map +1 -0
- package/dist/coordination/CoordinationService.js +247 -0
- package/dist/coordination/CoordinationService.js.map +1 -0
- package/dist/coordination/claims.d.ts +122 -0
- package/dist/coordination/claims.d.ts.map +1 -0
- package/dist/coordination/claims.js +196 -0
- package/dist/coordination/claims.js.map +1 -0
- package/dist/coordination/coordinationTools.d.ts +40 -0
- package/dist/coordination/coordinationTools.d.ts.map +1 -0
- package/dist/coordination/coordinationTools.js +92 -0
- package/dist/coordination/coordinationTools.js.map +1 -0
- package/dist/coordination/laneBridge.d.ts +84 -0
- package/dist/coordination/laneBridge.d.ts.map +1 -0
- package/dist/coordination/laneBridge.js +86 -0
- package/dist/coordination/laneBridge.js.map +1 -0
- package/dist/coordination/messages.d.ts +225 -0
- package/dist/coordination/messages.d.ts.map +1 -0
- package/dist/coordination/messages.js +335 -0
- package/dist/coordination/messages.js.map +1 -0
- package/dist/coordination/permissionWaitRegistry.d.ts +32 -0
- package/dist/coordination/permissionWaitRegistry.d.ts.map +1 -0
- package/dist/coordination/permissionWaitRegistry.js +59 -0
- package/dist/coordination/permissionWaitRegistry.js.map +1 -0
- package/dist/coordination/query.d.ts +187 -0
- package/dist/coordination/query.d.ts.map +1 -0
- package/dist/coordination/query.js +138 -0
- package/dist/coordination/query.js.map +1 -0
- package/dist/coordination/renderInbox.d.ts +15 -0
- package/dist/coordination/renderInbox.d.ts.map +1 -0
- package/dist/coordination/renderInbox.js +19 -0
- package/dist/coordination/renderInbox.js.map +1 -0
- package/dist/coordination/runtimeEvents.d.ts +53 -0
- package/dist/coordination/runtimeEvents.d.ts.map +1 -0
- package/dist/coordination/runtimeEvents.js +112 -0
- package/dist/coordination/runtimeEvents.js.map +1 -0
- package/dist/detachedHostService.d.ts +77 -0
- package/dist/detachedHostService.d.ts.map +1 -0
- package/dist/detachedHostService.js +66 -0
- package/dist/detachedHostService.js.map +1 -0
- package/dist/detachedHostSupervisor.d.ts +102 -0
- package/dist/detachedHostSupervisor.d.ts.map +1 -0
- package/dist/detachedHostSupervisor.js +168 -0
- package/dist/detachedHostSupervisor.js.map +1 -0
- package/dist/durableRuntimeEventStore.d.ts +49 -0
- package/dist/durableRuntimeEventStore.d.ts.map +1 -0
- package/dist/durableRuntimeEventStore.js +364 -0
- package/dist/durableRuntimeEventStore.js.map +1 -0
- package/dist/engineering/EngineeringWorkbenchService.d.ts +142 -0
- package/dist/engineering/EngineeringWorkbenchService.d.ts.map +1 -0
- package/dist/engineering/EngineeringWorkbenchService.js +2301 -0
- package/dist/engineering/EngineeringWorkbenchService.js.map +1 -0
- package/dist/engineering/LandingService.d.ts +112 -0
- package/dist/engineering/LandingService.d.ts.map +1 -0
- package/dist/engineering/LandingService.js +239 -0
- package/dist/engineering/LandingService.js.map +1 -0
- package/dist/engineering/engineeringTypes.d.ts +2 -0
- package/dist/engineering/engineeringTypes.d.ts.map +1 -0
- package/dist/engineering/engineeringTypes.js +2 -0
- package/dist/engineering/engineeringTypes.js.map +1 -0
- package/dist/engineering/patchReview.d.ts +11 -0
- package/dist/engineering/patchReview.d.ts.map +1 -0
- package/dist/engineering/patchReview.js +174 -0
- package/dist/engineering/patchReview.js.map +1 -0
- package/dist/index.d.ts +834 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3242 -0
- package/dist/index.js.map +1 -0
- package/dist/intake/IntakeService.d.ts +84 -0
- package/dist/intake/IntakeService.d.ts.map +1 -0
- package/dist/intake/IntakeService.js +117 -0
- package/dist/intake/IntakeService.js.map +1 -0
- package/dist/intake/RepositoryTodoIntakeSource.d.ts +72 -0
- package/dist/intake/RepositoryTodoIntakeSource.d.ts.map +1 -0
- package/dist/intake/RepositoryTodoIntakeSource.js +168 -0
- package/dist/intake/RepositoryTodoIntakeSource.js.map +1 -0
- package/dist/intake/WorkspaceTodoIntakeSource.d.ts +53 -0
- package/dist/intake/WorkspaceTodoIntakeSource.d.ts.map +1 -0
- package/dist/intake/WorkspaceTodoIntakeSource.js +81 -0
- package/dist/intake/WorkspaceTodoIntakeSource.js.map +1 -0
- package/dist/isolation/CommandExecution.d.ts +132 -0
- package/dist/isolation/CommandExecution.d.ts.map +1 -0
- package/dist/isolation/CommandExecution.js +48 -0
- package/dist/isolation/CommandExecution.js.map +1 -0
- package/dist/isolation/LocalCommandExecutor.d.ts +27 -0
- package/dist/isolation/LocalCommandExecutor.d.ts.map +1 -0
- package/dist/isolation/LocalCommandExecutor.js +97 -0
- package/dist/isolation/LocalCommandExecutor.js.map +1 -0
- package/dist/isolation/RunExecutionEnvironment.d.ts +135 -0
- package/dist/isolation/RunExecutionEnvironment.d.ts.map +1 -0
- package/dist/isolation/RunExecutionEnvironment.js +206 -0
- package/dist/isolation/RunExecutionEnvironment.js.map +1 -0
- package/dist/isolation/RunIsolationService.d.ts +90 -0
- package/dist/isolation/RunIsolationService.d.ts.map +1 -0
- package/dist/isolation/RunIsolationService.js +86 -0
- package/dist/isolation/RunIsolationService.js.map +1 -0
- package/dist/isolation/SandboxCommandExecutor.d.ts +93 -0
- package/dist/isolation/SandboxCommandExecutor.d.ts.map +1 -0
- package/dist/isolation/SandboxCommandExecutor.js +189 -0
- package/dist/isolation/SandboxCommandExecutor.js.map +1 -0
- package/dist/knowledge/WorkspaceKnowledgeService.d.ts +71 -0
- package/dist/knowledge/WorkspaceKnowledgeService.d.ts.map +1 -0
- package/dist/knowledge/WorkspaceKnowledgeService.js +103 -0
- package/dist/knowledge/WorkspaceKnowledgeService.js.map +1 -0
- package/dist/localHostAuthority.d.ts +24 -0
- package/dist/localHostAuthority.d.ts.map +1 -0
- package/dist/localHostAuthority.js +87 -0
- package/dist/localHostAuthority.js.map +1 -0
- package/dist/localHostLease.d.ts +51 -0
- package/dist/localHostLease.d.ts.map +1 -0
- package/dist/localHostLease.js +167 -0
- package/dist/localHostLease.js.map +1 -0
- package/dist/localHostPaths.d.ts +30 -0
- package/dist/localHostPaths.d.ts.map +1 -0
- package/dist/localHostPaths.js +60 -0
- package/dist/localHostPaths.js.map +1 -0
- package/dist/localRpcTransport.d.ts +21 -0
- package/dist/localRpcTransport.d.ts.map +1 -0
- package/dist/localRpcTransport.js +423 -0
- package/dist/localRpcTransport.js.map +1 -0
- package/dist/node.d.ts +104 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +103 -0
- package/dist/node.js.map +1 -0
- package/dist/observation/DirectoryBaselineScanner.d.ts +44 -0
- package/dist/observation/DirectoryBaselineScanner.d.ts.map +1 -0
- package/dist/observation/DirectoryBaselineScanner.js +112 -0
- package/dist/observation/DirectoryBaselineScanner.js.map +1 -0
- package/dist/observation/MountContentReader.d.ts +63 -0
- package/dist/observation/MountContentReader.d.ts.map +1 -0
- package/dist/observation/MountContentReader.js +158 -0
- package/dist/observation/MountContentReader.js.map +1 -0
- package/dist/observation/RunObservationService.d.ts +229 -0
- package/dist/observation/RunObservationService.d.ts.map +1 -0
- package/dist/observation/RunObservationService.js +248 -0
- package/dist/observation/RunObservationService.js.map +1 -0
- package/dist/observation/XenoUseObservationSource.d.ts +42 -0
- package/dist/observation/XenoUseObservationSource.d.ts.map +1 -0
- package/dist/observation/XenoUseObservationSource.js +104 -0
- package/dist/observation/XenoUseObservationSource.js.map +1 -0
- package/dist/observation/XenoUseRunObserver.d.ts +140 -0
- package/dist/observation/XenoUseRunObserver.d.ts.map +1 -0
- package/dist/observation/XenoUseRunObserver.js +256 -0
- package/dist/observation/XenoUseRunObserver.js.map +1 -0
- package/dist/pluginMcp/PluginMcpManagerService.d.ts +141 -0
- package/dist/pluginMcp/PluginMcpManagerService.d.ts.map +1 -0
- package/dist/pluginMcp/PluginMcpManagerService.js +1821 -0
- package/dist/pluginMcp/PluginMcpManagerService.js.map +1 -0
- package/dist/pluginMcp/pluginMcpTypes.d.ts +349 -0
- package/dist/pluginMcp/pluginMcpTypes.d.ts.map +1 -0
- package/dist/pluginMcp/pluginMcpTypes.js +2 -0
- package/dist/pluginMcp/pluginMcpTypes.js.map +1 -0
- package/dist/policy/WorkspacePolicyService.d.ts +83 -0
- package/dist/policy/WorkspacePolicyService.d.ts.map +1 -0
- package/dist/policy/WorkspacePolicyService.js +809 -0
- package/dist/policy/WorkspacePolicyService.js.map +1 -0
- package/dist/policy/policyGuard.d.ts +27 -0
- package/dist/policy/policyGuard.d.ts.map +1 -0
- package/dist/policy/policyGuard.js +143 -0
- package/dist/policy/policyGuard.js.map +1 -0
- package/dist/policy/policyTypes.d.ts +190 -0
- package/dist/policy/policyTypes.d.ts.map +1 -0
- package/dist/policy/policyTypes.js +2 -0
- package/dist/policy/policyTypes.js.map +1 -0
- package/dist/runtime/RuntimeEventStore.d.ts +42 -0
- package/dist/runtime/RuntimeEventStore.d.ts.map +1 -0
- package/dist/runtime/RuntimeEventStore.js +412 -0
- package/dist/runtime/RuntimeEventStore.js.map +1 -0
- package/dist/runtime/RuntimeEventStoreRepositoryAdapter.d.ts +21 -0
- package/dist/runtime/RuntimeEventStoreRepositoryAdapter.d.ts.map +1 -0
- package/dist/runtime/RuntimeEventStoreRepositoryAdapter.js +41 -0
- package/dist/runtime/RuntimeEventStoreRepositoryAdapter.js.map +1 -0
- package/dist/runtime/RuntimeTimelineProjection.d.ts +5 -0
- package/dist/runtime/RuntimeTimelineProjection.d.ts.map +1 -0
- package/dist/runtime/RuntimeTimelineProjection.js +705 -0
- package/dist/runtime/RuntimeTimelineProjection.js.map +1 -0
- package/dist/runtime/runtimeEventTypes.d.ts +73 -0
- package/dist/runtime/runtimeEventTypes.d.ts.map +1 -0
- package/dist/runtime/runtimeEventTypes.js +2 -0
- package/dist/runtime/runtimeEventTypes.js.map +1 -0
- package/dist/sdk/SdkNativeAgentTurnExecutionAdapter.d.ts +117 -0
- package/dist/sdk/SdkNativeAgentTurnExecutionAdapter.d.ts.map +1 -0
- package/dist/sdk/SdkNativeAgentTurnExecutionAdapter.js +214 -0
- package/dist/sdk/SdkNativeAgentTurnExecutionAdapter.js.map +1 -0
- package/dist/session/AgentSessionService.d.ts +285 -0
- package/dist/session/AgentSessionService.d.ts.map +1 -0
- package/dist/session/AgentSessionService.js +444 -0
- package/dist/session/AgentSessionService.js.map +1 -0
- package/dist/session/bufferedSessionPty.d.ts +27 -0
- package/dist/session/bufferedSessionPty.d.ts.map +1 -0
- package/dist/session/bufferedSessionPty.js +49 -0
- package/dist/session/bufferedSessionPty.js.map +1 -0
- package/dist/session/renderSupport.d.ts +53 -0
- package/dist/session/renderSupport.d.ts.map +1 -0
- package/dist/session/renderSupport.js +41 -0
- package/dist/session/renderSupport.js.map +1 -0
- package/dist/session/runtimeEventChannel.d.ts +56 -0
- package/dist/session/runtimeEventChannel.d.ts.map +1 -0
- package/dist/session/runtimeEventChannel.js +53 -0
- package/dist/session/runtimeEventChannel.js.map +1 -0
- package/dist/state/JsonAgentStateRepository.d.ts +29 -0
- package/dist/state/JsonAgentStateRepository.d.ts.map +1 -0
- package/dist/state/JsonAgentStateRepository.js +165 -0
- package/dist/state/JsonAgentStateRepository.js.map +1 -0
- package/dist/state/SqliteAgentStateRepository.d.ts +58 -0
- package/dist/state/SqliteAgentStateRepository.d.ts.map +1 -0
- package/dist/state/SqliteAgentStateRepository.js +777 -0
- package/dist/state/SqliteAgentStateRepository.js.map +1 -0
- package/dist/state/createAgentStateRepository.d.ts +4 -0
- package/dist/state/createAgentStateRepository.d.ts.map +1 -0
- package/dist/state/createAgentStateRepository.js +12 -0
- package/dist/state/createAgentStateRepository.js.map +1 -0
- package/dist/state/stateSanitizers.d.ts +7 -0
- package/dist/state/stateSanitizers.d.ts.map +1 -0
- package/dist/state/stateSanitizers.js +87 -0
- package/dist/state/stateSanitizers.js.map +1 -0
- package/dist/subagents/AcpSubagentExecutionAdapter.d.ts +12 -0
- package/dist/subagents/AcpSubagentExecutionAdapter.d.ts.map +1 -0
- package/dist/subagents/AcpSubagentExecutionAdapter.js +119 -0
- package/dist/subagents/AcpSubagentExecutionAdapter.js.map +1 -0
- package/dist/subagents/CliSubagentExecutionAdapter.d.ts +13 -0
- package/dist/subagents/CliSubagentExecutionAdapter.d.ts.map +1 -0
- package/dist/subagents/CliSubagentExecutionAdapter.js +217 -0
- package/dist/subagents/CliSubagentExecutionAdapter.js.map +1 -0
- package/dist/subagents/HostTurnSubagentExecutionAdapter.d.ts +78 -0
- package/dist/subagents/HostTurnSubagentExecutionAdapter.d.ts.map +1 -0
- package/dist/subagents/HostTurnSubagentExecutionAdapter.js +160 -0
- package/dist/subagents/HostTurnSubagentExecutionAdapter.js.map +1 -0
- package/dist/subagents/SubagentRunService.d.ts +103 -0
- package/dist/subagents/SubagentRunService.d.ts.map +1 -0
- package/dist/subagents/SubagentRunService.js +1183 -0
- package/dist/subagents/SubagentRunService.js.map +1 -0
- package/dist/subagents/SubagentScheduler.d.ts +167 -0
- package/dist/subagents/SubagentScheduler.d.ts.map +1 -0
- package/dist/subagents/SubagentScheduler.js +530 -0
- package/dist/subagents/SubagentScheduler.js.map +1 -0
- package/dist/subagents/TeamAgentRouter.d.ts +104 -0
- package/dist/subagents/TeamAgentRouter.d.ts.map +1 -0
- package/dist/subagents/TeamAgentRouter.js +435 -0
- package/dist/subagents/TeamAgentRouter.js.map +1 -0
- package/dist/subagents/capabilityMatcher.d.ts +3 -0
- package/dist/subagents/capabilityMatcher.d.ts.map +1 -0
- package/dist/subagents/capabilityMatcher.js +127 -0
- package/dist/subagents/capabilityMatcher.js.map +1 -0
- package/dist/subagents/subagentRunPort.d.ts +43 -0
- package/dist/subagents/subagentRunPort.d.ts.map +1 -0
- package/dist/subagents/subagentRunPort.js +24 -0
- package/dist/subagents/subagentRunPort.js.map +1 -0
- package/dist/subagents/subagentTypes.d.ts +330 -0
- package/dist/subagents/subagentTypes.d.ts.map +1 -0
- package/dist/subagents/subagentTypes.js +2 -0
- package/dist/subagents/subagentTypes.js.map +1 -0
- package/dist/subagents/subagentWorkspaceAuthority.d.ts +29 -0
- package/dist/subagents/subagentWorkspaceAuthority.d.ts.map +1 -0
- package/dist/subagents/subagentWorkspaceAuthority.js +173 -0
- package/dist/subagents/subagentWorkspaceAuthority.js.map +1 -0
- package/dist/support/SupportDiagnosticsService.d.ts +87 -0
- package/dist/support/SupportDiagnosticsService.d.ts.map +1 -0
- package/dist/support/SupportDiagnosticsService.js +1199 -0
- package/dist/support/SupportDiagnosticsService.js.map +1 -0
- package/dist/turns/DurableInterruptedTurnStore.d.ts +14 -0
- package/dist/turns/DurableInterruptedTurnStore.d.ts.map +1 -0
- package/dist/turns/DurableInterruptedTurnStore.js +63 -0
- package/dist/turns/DurableInterruptedTurnStore.js.map +1 -0
- package/dist/turns/interruptedTurns.d.ts +50 -0
- package/dist/turns/interruptedTurns.d.ts.map +1 -0
- package/dist/turns/interruptedTurns.js +54 -0
- package/dist/turns/interruptedTurns.js.map +1 -0
- package/dist/turns/turnAdmission.d.ts +113 -0
- package/dist/turns/turnAdmission.d.ts.map +1 -0
- package/dist/turns/turnAdmission.js +136 -0
- package/dist/turns/turnAdmission.js.map +1 -0
- package/dist/workspace/WorkspaceHostService.d.ts +126 -0
- package/dist/workspace/WorkspaceHostService.d.ts.map +1 -0
- package/dist/workspace/WorkspaceHostService.js +841 -0
- package/dist/workspace/WorkspaceHostService.js.map +1 -0
- package/dist/workspace/WorkspaceShellService.d.ts +71 -0
- package/dist/workspace/WorkspaceShellService.d.ts.map +1 -0
- package/dist/workspace/WorkspaceShellService.js +273 -0
- package/dist/workspace/WorkspaceShellService.js.map +1 -0
- package/dist/workspace/fileAssociations.d.ts +12 -0
- package/dist/workspace/fileAssociations.d.ts.map +1 -0
- package/dist/workspace/fileAssociations.js +202 -0
- package/dist/workspace/fileAssociations.js.map +1 -0
- package/dist/workspace/scrollbackBuffer.d.ts +48 -0
- package/dist/workspace/scrollbackBuffer.d.ts.map +1 -0
- package/dist/workspace/scrollbackBuffer.js +94 -0
- package/dist/workspace/scrollbackBuffer.js.map +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1,707 @@
|
|
|
1
|
+
import { execFile } from 'child_process';
|
|
2
|
+
import { createHash } from 'crypto';
|
|
3
|
+
import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, unlinkSync, writeFileSync } from 'fs';
|
|
4
|
+
import { basename, dirname, isAbsolute, join, relative, resolve } from 'path';
|
|
5
|
+
import extractZip from 'extract-zip';
|
|
6
|
+
import { x as extractTar } from 'tar';
|
|
7
|
+
import { canAutomaticallyCertifyProvider, fallbackProviderRegistry, fetchOfficialProviderRegistry, installKimiNativeUpdate as installXenoKimiNativeUpdate, nativeLauncherFor, normalizeProviderHttpsUrl, normalizeProviderRegistry, providerConfigId, providerConfigIds, providerDistributionKind, providerPlatformTarget, resolveProviderLifecycle, resolveProviderBinaryInstallPlan, resolveProviderUpdatePlan, selectProviderExecutableCandidate, } from '@xenosystem/acp-provider-manager';
|
|
8
|
+
import { AcpAgentRegistryService } from './AcpAgentRegistryService.js';
|
|
9
|
+
import { runAcpExternalCertification, } from './AcpExternalCertificationHarness.js';
|
|
10
|
+
import { getAcpProviderVersionReadinessAsync } from './AcpProviderVersionReadiness.js';
|
|
11
|
+
import { redactAcpText } from './acpRedaction.js';
|
|
12
|
+
const CATALOG_CACHE_VERSION = 1;
|
|
13
|
+
const CATALOG_PREFERENCES_VERSION = 1;
|
|
14
|
+
const CATALOG_CACHE_MAX_AGE_MS = 24 * 60 * 60_000;
|
|
15
|
+
export class AcpProviderCatalogService {
|
|
16
|
+
registryService;
|
|
17
|
+
rootDir;
|
|
18
|
+
cachePath;
|
|
19
|
+
preferencesPath;
|
|
20
|
+
fetchRegistry;
|
|
21
|
+
fetchArchive;
|
|
22
|
+
executableFinder;
|
|
23
|
+
now;
|
|
24
|
+
certify;
|
|
25
|
+
checkVersionReadiness;
|
|
26
|
+
runProviderUpdate;
|
|
27
|
+
certificationInFlight = new Map();
|
|
28
|
+
updatesInFlight = new Map();
|
|
29
|
+
versionReadiness = new Map();
|
|
30
|
+
syncInFlight;
|
|
31
|
+
syncGeneration = 0;
|
|
32
|
+
discoveredLaunchers = new Map();
|
|
33
|
+
constructor(options = {}) {
|
|
34
|
+
this.registryService = options.registryService || new AcpAgentRegistryService({ rootDir: options.rootDir });
|
|
35
|
+
this.rootDir = options.rootDir || this.registryService.rootDir;
|
|
36
|
+
this.cachePath = join(this.rootDir, 'acp-provider-catalog-cache.json');
|
|
37
|
+
this.preferencesPath = join(this.rootDir, 'acp-provider-preferences.json');
|
|
38
|
+
this.fetchRegistry = options.fetchRegistry || (() => fetchOfficialProviderRegistry((url, init) => fetch(url, init)));
|
|
39
|
+
this.fetchArchive = options.fetchArchive || fetchProviderArchive;
|
|
40
|
+
this.executableFinder = options.findExecutableAsync
|
|
41
|
+
|| (options.findExecutable ? async (name) => options.findExecutable(name) : findExecutable);
|
|
42
|
+
this.now = options.now || (() => new Date());
|
|
43
|
+
this.certify = options.certify || runAcpExternalCertification;
|
|
44
|
+
this.checkVersionReadiness = options.checkVersionReadiness || getAcpProviderVersionReadinessAsync;
|
|
45
|
+
this.runProviderUpdate = options.runProviderUpdate || runProviderUpdateCommand;
|
|
46
|
+
}
|
|
47
|
+
async listCatalog(options = {}) {
|
|
48
|
+
const loaded = await this.loadRegistry(!!options.refresh);
|
|
49
|
+
return this.buildSnapshot(loaded);
|
|
50
|
+
}
|
|
51
|
+
async syncCatalog(options = {}) {
|
|
52
|
+
if (this.syncInFlight)
|
|
53
|
+
return this.syncInFlight;
|
|
54
|
+
const generation = ++this.syncGeneration;
|
|
55
|
+
const operation = this.performCatalogSync(options, generation);
|
|
56
|
+
this.syncInFlight = operation;
|
|
57
|
+
try {
|
|
58
|
+
return await operation;
|
|
59
|
+
}
|
|
60
|
+
finally {
|
|
61
|
+
if (this.syncInFlight === operation)
|
|
62
|
+
this.syncInFlight = undefined;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async performCatalogSync(options, generation) {
|
|
66
|
+
const loaded = await this.loadRegistry(!!options.refresh);
|
|
67
|
+
const preferences = this.loadPreferences();
|
|
68
|
+
const discovered = new Map();
|
|
69
|
+
if (preferences.acpEnabled) {
|
|
70
|
+
for (const manifest of loaded.registry.agents) {
|
|
71
|
+
if (generation !== this.syncGeneration)
|
|
72
|
+
return this.buildSnapshot(loaded);
|
|
73
|
+
let configured = this.findConfiguredAgent(manifest);
|
|
74
|
+
if (configured) {
|
|
75
|
+
if (nativeLauncherFor(manifest.id)) {
|
|
76
|
+
const launcher = await this.resolveLauncher(manifest, true);
|
|
77
|
+
if (launcher?.installed && !sameCommandPath(launcher.command, configured.command)) {
|
|
78
|
+
configured = this.saveResolvedLauncher(manifest, configured, launcher);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const readiness = await this.refreshVersionReadiness(configured);
|
|
82
|
+
if (options.autoCertify !== false
|
|
83
|
+
&& configured.enabled
|
|
84
|
+
&& !configured.certification
|
|
85
|
+
&& canAutomaticallyCertifyProvider(readiness)) {
|
|
86
|
+
this.startProviderCertification(configured);
|
|
87
|
+
}
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (!nativeLauncherFor(manifest.id))
|
|
91
|
+
continue;
|
|
92
|
+
const launcher = await this.resolveLauncher(manifest, true);
|
|
93
|
+
if (generation !== this.syncGeneration)
|
|
94
|
+
return this.buildSnapshot(loaded);
|
|
95
|
+
if (launcher?.installed)
|
|
96
|
+
discovered.set(manifest.id, launcher);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (generation === this.syncGeneration)
|
|
100
|
+
this.discoveredLaunchers = discovered;
|
|
101
|
+
return this.buildSnapshot(loaded);
|
|
102
|
+
}
|
|
103
|
+
async setProviderEnabled(providerId, enabled) {
|
|
104
|
+
const loaded = await this.loadRegistry(false);
|
|
105
|
+
const manifest = loaded.registry.agents.find((entry) => entry.id === providerId);
|
|
106
|
+
if (!manifest)
|
|
107
|
+
throw new Error('ACP catalog provider was not found.');
|
|
108
|
+
let agent = this.findConfiguredAgent(manifest);
|
|
109
|
+
if (enabled && !agent) {
|
|
110
|
+
const launcher = this.discoveredLaunchers.get(manifest.id)
|
|
111
|
+
|| await this.resolveLauncher(manifest, false)
|
|
112
|
+
|| await this.installBinaryLauncher(manifest);
|
|
113
|
+
if (!launcher) {
|
|
114
|
+
throw new Error(`${manifest.name} is not installed and has no automatic setup available on this computer.`);
|
|
115
|
+
}
|
|
116
|
+
const saved = this.registryService.saveAgent({
|
|
117
|
+
id: providerConfigId(manifest.id),
|
|
118
|
+
name: manifest.name,
|
|
119
|
+
command: launcher.command,
|
|
120
|
+
args: launcher.args,
|
|
121
|
+
cwd: this.rootDir,
|
|
122
|
+
enabled: true,
|
|
123
|
+
trustLevel: 'restricted',
|
|
124
|
+
}, { includeRuntimeStatus: false });
|
|
125
|
+
if (!saved.success)
|
|
126
|
+
throw new Error(saved.error || `Could not configure ${manifest.name}.`);
|
|
127
|
+
agent = this.registryService.getAgentInternal(saved.result?.id || providerConfigId(manifest.id));
|
|
128
|
+
}
|
|
129
|
+
else if (agent) {
|
|
130
|
+
const updated = this.registryService.setAgentsEnabled({ [agent.id]: enabled });
|
|
131
|
+
if (!updated.success)
|
|
132
|
+
throw new Error(updated.error || `Could not ${enabled ? 'enable' : 'disable'} ${manifest.name}.`);
|
|
133
|
+
agent = this.registryService.getAgentInternal(agent.id);
|
|
134
|
+
if (enabled && agent && nativeLauncherFor(manifest.id)) {
|
|
135
|
+
const launcher = await this.resolveLauncher(manifest, true);
|
|
136
|
+
if (launcher?.installed && !sameCommandPath(launcher.command, agent.command)) {
|
|
137
|
+
agent = this.saveResolvedLauncher(manifest, agent, launcher);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const readiness = agent ? await this.refreshVersionReadiness(agent) : undefined;
|
|
142
|
+
const preferences = this.loadPreferences();
|
|
143
|
+
preferences.acpEnabled = true;
|
|
144
|
+
preferences.enabledAgentIds = updateStringSet(preferences.enabledAgentIds, agent?.id, enabled);
|
|
145
|
+
if (!enabled && preferences.preferredAgentId === agent?.id)
|
|
146
|
+
preferences.preferredAgentId = undefined;
|
|
147
|
+
this.ensurePreferredAgent(preferences);
|
|
148
|
+
const errors = [...loaded.errors];
|
|
149
|
+
if (enabled && agent) {
|
|
150
|
+
if (canAutomaticallyCertifyProvider(readiness) && agent.certification?.status !== 'certified') {
|
|
151
|
+
this.startProviderCertification(agent);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return this.buildSnapshot({ ...loaded, errors });
|
|
155
|
+
}
|
|
156
|
+
async updateProvider(providerId) {
|
|
157
|
+
const inFlight = this.updatesInFlight.get(providerId);
|
|
158
|
+
if (inFlight)
|
|
159
|
+
return inFlight;
|
|
160
|
+
const operation = this.performProviderUpdate(providerId);
|
|
161
|
+
this.updatesInFlight.set(providerId, operation);
|
|
162
|
+
try {
|
|
163
|
+
return await operation;
|
|
164
|
+
}
|
|
165
|
+
finally {
|
|
166
|
+
if (this.updatesInFlight.get(providerId) === operation)
|
|
167
|
+
this.updatesInFlight.delete(providerId);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
async performProviderUpdate(providerId) {
|
|
171
|
+
const loaded = await this.loadRegistry(false);
|
|
172
|
+
const manifest = loaded.registry.agents.find((entry) => entry.id === providerId);
|
|
173
|
+
if (!manifest)
|
|
174
|
+
throw new Error('ACP catalog provider was not found.');
|
|
175
|
+
const agent = this.findConfiguredAgent(manifest);
|
|
176
|
+
if (!agent)
|
|
177
|
+
throw new Error(`${manifest.name} must be configured before it can be updated.`);
|
|
178
|
+
if (!agent.enabled)
|
|
179
|
+
throw new Error(`${manifest.name} must be enabled before it can be updated.`);
|
|
180
|
+
const readiness = await this.refreshVersionReadiness(agent);
|
|
181
|
+
if (readiness?.status !== 'outdated') {
|
|
182
|
+
throw new Error(readiness?.ok
|
|
183
|
+
? `${manifest.name} is already up to date.`
|
|
184
|
+
: readiness?.message || `${manifest.name} does not expose a supported automatic updater.`);
|
|
185
|
+
}
|
|
186
|
+
const updateCommand = providerUpdateCommand(manifest, agent);
|
|
187
|
+
if (!updateCommand)
|
|
188
|
+
throw new Error(`${manifest.name} does not expose a supported automatic updater.`);
|
|
189
|
+
const cleared = this.registryService.clearAgentCertification(agent.id, { includeRuntimeStatus: false });
|
|
190
|
+
if (!cleared.success)
|
|
191
|
+
throw new Error(cleared.error || `Could not prepare ${manifest.name} for update.`);
|
|
192
|
+
await this.runProviderUpdate(updateCommand);
|
|
193
|
+
const updatedAgent = this.registryService.getAgentInternal(agent.id);
|
|
194
|
+
if (!updatedAgent)
|
|
195
|
+
throw new Error(`${manifest.name} configuration disappeared during update.`);
|
|
196
|
+
const updatedReadiness = await this.refreshVersionReadiness(updatedAgent);
|
|
197
|
+
if (!updatedReadiness?.ok) {
|
|
198
|
+
throw new Error(updatedReadiness?.updateHint || updatedReadiness?.message || `${manifest.name} did not report a supported version after updating.`);
|
|
199
|
+
}
|
|
200
|
+
this.startProviderCertification(updatedAgent);
|
|
201
|
+
return this.buildSnapshot(loaded);
|
|
202
|
+
}
|
|
203
|
+
async setCatalogEnabled(enabled) {
|
|
204
|
+
this.syncGeneration += 1;
|
|
205
|
+
const loaded = await this.loadRegistry(false);
|
|
206
|
+
const preferences = this.loadPreferences();
|
|
207
|
+
const configured = this.registryService.loadRegistry().registry.agents;
|
|
208
|
+
if (!enabled) {
|
|
209
|
+
preferences.enabledAgentIds = configured.filter((agent) => agent.enabled).map((agent) => agent.id);
|
|
210
|
+
const updates = Object.fromEntries(configured.filter((agent) => agent.enabled).map((agent) => [agent.id, false]));
|
|
211
|
+
const updated = this.registryService.setAgentsEnabled(updates);
|
|
212
|
+
if (!updated.success)
|
|
213
|
+
throw new Error(updated.error || 'Could not disable ACP providers.');
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
const configuredIds = new Set(configured.map((agent) => agent.id));
|
|
217
|
+
const updates = Object.fromEntries(preferences.enabledAgentIds.filter((id) => configuredIds.has(id)).map((id) => [id, true]));
|
|
218
|
+
const updated = this.registryService.setAgentsEnabled(updates);
|
|
219
|
+
if (!updated.success)
|
|
220
|
+
throw new Error(updated.error || 'Could not enable ACP providers.');
|
|
221
|
+
}
|
|
222
|
+
preferences.acpEnabled = enabled;
|
|
223
|
+
this.writePreferences(preferences);
|
|
224
|
+
return this.buildSnapshot(loaded);
|
|
225
|
+
}
|
|
226
|
+
async setPreferredProvider(providerId) {
|
|
227
|
+
const loaded = await this.loadRegistry(false);
|
|
228
|
+
const manifest = loaded.registry.agents.find((entry) => entry.id === providerId);
|
|
229
|
+
if (!manifest)
|
|
230
|
+
throw new Error('ACP catalog provider was not found.');
|
|
231
|
+
const agent = this.findConfiguredAgent(manifest);
|
|
232
|
+
if (!agent?.enabled || agent.certification?.status !== 'certified') {
|
|
233
|
+
throw new Error('Enable this provider and let automatic setup finish before making it preferred.');
|
|
234
|
+
}
|
|
235
|
+
const preferences = this.loadPreferences();
|
|
236
|
+
preferences.preferredAgentId = agent.id;
|
|
237
|
+
preferences.acpEnabled = true;
|
|
238
|
+
preferences.enabledAgentIds = updateStringSet(preferences.enabledAgentIds, agent.id, true);
|
|
239
|
+
this.writePreferences(preferences);
|
|
240
|
+
return this.buildSnapshot(loaded);
|
|
241
|
+
}
|
|
242
|
+
async certifyAgent(agent) {
|
|
243
|
+
const result = await this.certify(agent, {
|
|
244
|
+
registryRoot: this.registryService.rootDir,
|
|
245
|
+
requestTimeoutMs: 120_000,
|
|
246
|
+
});
|
|
247
|
+
return result.status === 'PASSED' || result.status === 'FALLBACK_FIXTURE_ONLY'
|
|
248
|
+
? undefined
|
|
249
|
+
: result.error || result.certification.notes || 'Automatic ACP setup did not pass.';
|
|
250
|
+
}
|
|
251
|
+
startProviderCertification(agent) {
|
|
252
|
+
if (this.certificationInFlight.has(agent.id))
|
|
253
|
+
return;
|
|
254
|
+
const operation = (async () => {
|
|
255
|
+
try {
|
|
256
|
+
const error = await this.certifyAgent(agent);
|
|
257
|
+
if (error && !this.registryService.getAgentInternal(agent.id)?.certification) {
|
|
258
|
+
this.registryService.setAgentCertification(agent.id, {
|
|
259
|
+
status: 'failed',
|
|
260
|
+
certifiedAt: this.now().toISOString(),
|
|
261
|
+
certifiedBy: 'harness',
|
|
262
|
+
notes: redactAcpText(error, 500),
|
|
263
|
+
}, { includeRuntimeStatus: false });
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
catch (error) {
|
|
267
|
+
this.registryService.setAgentCertification(agent.id, {
|
|
268
|
+
status: 'failed',
|
|
269
|
+
certifiedAt: this.now().toISOString(),
|
|
270
|
+
certifiedBy: 'harness',
|
|
271
|
+
notes: redactAcpText(error instanceof Error ? error.message : 'Automatic ACP setup failed.', 500),
|
|
272
|
+
}, { includeRuntimeStatus: false });
|
|
273
|
+
}
|
|
274
|
+
})().finally(() => {
|
|
275
|
+
this.certificationInFlight.delete(agent.id);
|
|
276
|
+
});
|
|
277
|
+
this.certificationInFlight.set(agent.id, operation);
|
|
278
|
+
}
|
|
279
|
+
async loadRegistry(refresh) {
|
|
280
|
+
const cached = this.readCache();
|
|
281
|
+
const cachedAge = cached ? this.now().getTime() - Date.parse(cached.fetchedAt) : Number.POSITIVE_INFINITY;
|
|
282
|
+
if (!refresh && cached && cachedAge >= 0 && cachedAge < CATALOG_CACHE_MAX_AGE_MS) {
|
|
283
|
+
return { registry: cached.registry, source: 'cache', refreshedAt: cached.fetchedAt, errors: [] };
|
|
284
|
+
}
|
|
285
|
+
try {
|
|
286
|
+
const registry = normalizeProviderRegistry(await this.fetchRegistry());
|
|
287
|
+
if (!registry)
|
|
288
|
+
throw new Error('Official ACP Registry returned invalid metadata.');
|
|
289
|
+
const fetchedAt = this.now().toISOString();
|
|
290
|
+
this.writeCache({ version: CATALOG_CACHE_VERSION, fetchedAt, registry });
|
|
291
|
+
return { registry, source: 'network', refreshedAt: fetchedAt, errors: [] };
|
|
292
|
+
}
|
|
293
|
+
catch (error) {
|
|
294
|
+
const safeError = redactAcpText(error instanceof Error ? error.message : 'Official ACP Registry is unavailable.', 500);
|
|
295
|
+
if (cached) {
|
|
296
|
+
return { registry: cached.registry, source: 'cache', refreshedAt: cached.fetchedAt, errors: [safeError] };
|
|
297
|
+
}
|
|
298
|
+
return {
|
|
299
|
+
registry: fallbackProviderRegistry(),
|
|
300
|
+
source: 'fallback',
|
|
301
|
+
refreshedAt: this.now().toISOString(),
|
|
302
|
+
errors: [safeError],
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
buildSnapshot(loaded) {
|
|
307
|
+
const preferences = this.loadPreferences();
|
|
308
|
+
const configuredAgents = this.registryService.loadRegistry().registry.agents;
|
|
309
|
+
const configuredById = new Map(configuredAgents.map((agent) => [agent.id, agent]));
|
|
310
|
+
const entries = loaded.registry.agents.map((manifest) => this.toCatalogEntry(manifest, preferences, configuredById));
|
|
311
|
+
const representedIds = new Set(entries.flatMap((entry) => [entry.agentConfigId, entry.id].filter((id) => !!id)));
|
|
312
|
+
for (const agent of configuredAgents) {
|
|
313
|
+
if (representedIds.has(agent.id))
|
|
314
|
+
continue;
|
|
315
|
+
entries.push(customCatalogEntry(agent, preferences.preferredAgentId === agent.id));
|
|
316
|
+
}
|
|
317
|
+
return {
|
|
318
|
+
acpEnabled: preferences.acpEnabled,
|
|
319
|
+
preferredAgentId: preferences.preferredAgentId,
|
|
320
|
+
source: loaded.source,
|
|
321
|
+
refreshedAt: loaded.refreshedAt,
|
|
322
|
+
entries: entries.sort(catalogSort),
|
|
323
|
+
syncErrors: loaded.errors.map((error) => redactAcpText(error, 500)),
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
toCatalogEntry(manifest, preferences, configuredById) {
|
|
327
|
+
const agent = this.findConfiguredAgent(manifest, configuredById);
|
|
328
|
+
const discoveredLauncher = this.discoveredLaunchers.get(manifest.id);
|
|
329
|
+
const readiness = agent ? this.versionReadiness.get(agent.id) : undefined;
|
|
330
|
+
const lifecycle = resolveProviderLifecycle({
|
|
331
|
+
manifest,
|
|
332
|
+
configured: !!agent,
|
|
333
|
+
enabled: preferences.acpEnabled && agent?.enabled === true,
|
|
334
|
+
setupInProgress: !!agent && this.certificationInFlight.has(agent.id),
|
|
335
|
+
...(agent?.certification?.status ? { certificationStatus: agent.certification.status } : {}),
|
|
336
|
+
...(agent?.certification?.notes ? { certificationMessage: agent.certification.notes } : {}),
|
|
337
|
+
...(readiness ? {
|
|
338
|
+
readiness: {
|
|
339
|
+
ok: readiness.ok,
|
|
340
|
+
status: readiness.status,
|
|
341
|
+
message: readiness.message,
|
|
342
|
+
...(readiness.updateHint ? { updateHint: readiness.updateHint } : {}),
|
|
343
|
+
},
|
|
344
|
+
} : {}),
|
|
345
|
+
});
|
|
346
|
+
return {
|
|
347
|
+
id: manifest.id,
|
|
348
|
+
name: manifest.name,
|
|
349
|
+
description: manifest.description,
|
|
350
|
+
version: manifest.version,
|
|
351
|
+
iconUrl: normalizeProviderHttpsUrl(manifest.icon),
|
|
352
|
+
website: normalizeProviderHttpsUrl(manifest.website),
|
|
353
|
+
repository: normalizeProviderHttpsUrl(manifest.repository),
|
|
354
|
+
authors: manifest.authors,
|
|
355
|
+
license: manifest.license,
|
|
356
|
+
distributionKind: providerDistributionKind(manifest),
|
|
357
|
+
installed: !!agent || discoveredLauncher?.installed === true,
|
|
358
|
+
configured: !!agent,
|
|
359
|
+
enabled: preferences.acpEnabled && agent?.enabled === true,
|
|
360
|
+
preferred: preferences.preferredAgentId === agent?.id,
|
|
361
|
+
canAutoSetup: lifecycle.canAutoSetup,
|
|
362
|
+
primaryAction: lifecycle.primaryAction,
|
|
363
|
+
availableActions: lifecycle.availableActions,
|
|
364
|
+
agentConfigId: agent?.id,
|
|
365
|
+
status: lifecycle.status,
|
|
366
|
+
statusMessage: lifecycle.statusMessage,
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
findConfiguredAgent(manifest, configuredById) {
|
|
370
|
+
const ids = providerConfigIds(manifest.id);
|
|
371
|
+
for (const id of ids) {
|
|
372
|
+
const agent = configuredById?.get(id) || this.registryService.getAgentInternal(id);
|
|
373
|
+
if (agent)
|
|
374
|
+
return agent;
|
|
375
|
+
}
|
|
376
|
+
return undefined;
|
|
377
|
+
}
|
|
378
|
+
async refreshVersionReadiness(agent) {
|
|
379
|
+
const readiness = await this.checkVersionReadiness(agent);
|
|
380
|
+
if (readiness)
|
|
381
|
+
this.versionReadiness.set(agent.id, readiness);
|
|
382
|
+
else
|
|
383
|
+
this.versionReadiness.delete(agent.id);
|
|
384
|
+
return readiness;
|
|
385
|
+
}
|
|
386
|
+
async resolveLauncher(manifest, installedOnly) {
|
|
387
|
+
const native = nativeLauncherFor(manifest.id);
|
|
388
|
+
if (native) {
|
|
389
|
+
const command = await this.executableFinder(native.executable);
|
|
390
|
+
if (command)
|
|
391
|
+
return { command, args: native.args, installed: true, distributionKind: providerDistributionKind(manifest) };
|
|
392
|
+
}
|
|
393
|
+
const target = manifest.distribution.binary?.[providerPlatformTarget()];
|
|
394
|
+
if (target) {
|
|
395
|
+
const executableName = basename(target.cmd).replace(/^\.\\|^\.\//, '');
|
|
396
|
+
const command = await this.executableFinder(executableName.replace(/\.exe$/i, ''))
|
|
397
|
+
|| await this.executableFinder(executableName);
|
|
398
|
+
if (command)
|
|
399
|
+
return { command, args: target.args || [], installed: true, distributionKind: 'binary' };
|
|
400
|
+
}
|
|
401
|
+
if (installedOnly)
|
|
402
|
+
return undefined;
|
|
403
|
+
if (manifest.distribution.npx) {
|
|
404
|
+
const npx = await resolveNpxLauncher(this.executableFinder);
|
|
405
|
+
if (npx) {
|
|
406
|
+
return {
|
|
407
|
+
command: npx.command,
|
|
408
|
+
args: [...npx.args, '--yes', manifest.distribution.npx.package, ...(manifest.distribution.npx.args || [])],
|
|
409
|
+
installed: false,
|
|
410
|
+
distributionKind: 'npx',
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
if (manifest.distribution.uvx) {
|
|
415
|
+
const uvx = await this.executableFinder('uvx');
|
|
416
|
+
if (uvx) {
|
|
417
|
+
return {
|
|
418
|
+
command: uvx,
|
|
419
|
+
args: [manifest.distribution.uvx.package, ...(manifest.distribution.uvx.args || [])],
|
|
420
|
+
installed: false,
|
|
421
|
+
distributionKind: 'uvx',
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
return undefined;
|
|
426
|
+
}
|
|
427
|
+
async installBinaryLauncher(manifest) {
|
|
428
|
+
const plan = resolveProviderBinaryInstallPlan(manifest);
|
|
429
|
+
if (!plan)
|
|
430
|
+
return undefined;
|
|
431
|
+
const managedRoot = resolve(this.rootDir, 'acp-providers');
|
|
432
|
+
const installDir = resolve(managedRoot, manifest.id, manifest.version);
|
|
433
|
+
const relativeCommand = plan.command.replace(/^\.([/\\])/, '');
|
|
434
|
+
const command = resolve(installDir, relativeCommand);
|
|
435
|
+
assertWithin(managedRoot, command);
|
|
436
|
+
if (existsSync(command)) {
|
|
437
|
+
return { command, args: plan.args, installed: true, distributionKind: 'binary' };
|
|
438
|
+
}
|
|
439
|
+
const stagingDir = resolve(managedRoot, '.staging', `${manifest.id}-${process.pid}-${Date.now()}`);
|
|
440
|
+
const archivePath = resolve(managedRoot, '.downloads', `${manifest.id}-${process.pid}-${Date.now()}${archiveExtension(plan.archiveUrl)}`);
|
|
441
|
+
assertWithin(managedRoot, stagingDir);
|
|
442
|
+
assertWithin(managedRoot, archivePath);
|
|
443
|
+
mkdirSync(dirname(archivePath), { recursive: true });
|
|
444
|
+
mkdirSync(stagingDir, { recursive: true });
|
|
445
|
+
try {
|
|
446
|
+
const archive = await this.fetchArchive(plan.archiveUrl);
|
|
447
|
+
const actualHash = createHash('sha256').update(archive).digest('hex');
|
|
448
|
+
if (actualHash !== plan.sha256)
|
|
449
|
+
throw new Error('Downloaded provider failed SHA-256 verification.');
|
|
450
|
+
writeFileSync(archivePath, archive);
|
|
451
|
+
if (/\.zip$/i.test(archivePath)) {
|
|
452
|
+
await extractZip(archivePath, { dir: stagingDir });
|
|
453
|
+
}
|
|
454
|
+
else if (/\.(?:tar\.gz|tgz)$/i.test(archivePath)) {
|
|
455
|
+
await extractTar({
|
|
456
|
+
file: archivePath,
|
|
457
|
+
cwd: stagingDir,
|
|
458
|
+
strict: true,
|
|
459
|
+
preservePaths: false,
|
|
460
|
+
filter: (entryPath, entry) => {
|
|
461
|
+
if ('type' in entry && (entry.type === 'SymbolicLink' || entry.type === 'Link'))
|
|
462
|
+
return false;
|
|
463
|
+
try {
|
|
464
|
+
assertWithin(stagingDir, resolve(stagingDir, entryPath));
|
|
465
|
+
return true;
|
|
466
|
+
}
|
|
467
|
+
catch {
|
|
468
|
+
return false;
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
else {
|
|
474
|
+
throw new Error('Provider archive format is not supported on this platform.');
|
|
475
|
+
}
|
|
476
|
+
assertNoSymlinks(stagingDir);
|
|
477
|
+
const stagedCommand = resolve(stagingDir, relativeCommand);
|
|
478
|
+
assertWithin(stagingDir, stagedCommand);
|
|
479
|
+
if (!existsSync(stagedCommand) || !lstatSync(stagedCommand).isFile()) {
|
|
480
|
+
throw new Error('Provider archive did not contain its declared executable.');
|
|
481
|
+
}
|
|
482
|
+
mkdirSync(dirname(installDir), { recursive: true });
|
|
483
|
+
if (existsSync(installDir))
|
|
484
|
+
removeManagedDirectory(managedRoot, installDir);
|
|
485
|
+
renameSync(stagingDir, installDir);
|
|
486
|
+
if (process.platform !== 'win32')
|
|
487
|
+
chmodSync(command, 0o755);
|
|
488
|
+
return { command, args: plan.args, installed: true, distributionKind: 'binary' };
|
|
489
|
+
}
|
|
490
|
+
finally {
|
|
491
|
+
if (existsSync(archivePath))
|
|
492
|
+
unlinkSync(archivePath);
|
|
493
|
+
if (existsSync(stagingDir))
|
|
494
|
+
removeManagedDirectory(managedRoot, stagingDir);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
saveResolvedLauncher(manifest, agent, launcher) {
|
|
498
|
+
const saved = this.registryService.saveAgent({
|
|
499
|
+
id: agent.id,
|
|
500
|
+
name: manifest.name,
|
|
501
|
+
command: launcher.command,
|
|
502
|
+
args: launcher.args,
|
|
503
|
+
cwd: this.rootDir,
|
|
504
|
+
enabled: agent.enabled,
|
|
505
|
+
trustLevel: agent.trustLevel,
|
|
506
|
+
}, { includeRuntimeStatus: false });
|
|
507
|
+
if (!saved.success)
|
|
508
|
+
throw new Error(saved.error || `Could not update ${manifest.name}.`);
|
|
509
|
+
const updated = this.registryService.getAgentInternal(agent.id);
|
|
510
|
+
if (!updated)
|
|
511
|
+
throw new Error(`Could not reload ${manifest.name} after updating its launcher.`);
|
|
512
|
+
return updated;
|
|
513
|
+
}
|
|
514
|
+
ensurePreferredAgent(preferences) {
|
|
515
|
+
const current = preferences.preferredAgentId
|
|
516
|
+
? this.registryService.getAgentInternal(preferences.preferredAgentId)
|
|
517
|
+
: undefined;
|
|
518
|
+
if (!current?.enabled || current.certification?.status !== 'certified') {
|
|
519
|
+
preferences.preferredAgentId = this.registryService.loadRegistry().registry.agents.find((agent) => agent.enabled && agent.certification?.status === 'certified')?.id;
|
|
520
|
+
}
|
|
521
|
+
this.writePreferences(preferences);
|
|
522
|
+
}
|
|
523
|
+
loadPreferences() {
|
|
524
|
+
try {
|
|
525
|
+
const parsed = JSON.parse(readFileSync(this.preferencesPath, 'utf-8'));
|
|
526
|
+
if (isRecord(parsed) && parsed.version === CATALOG_PREFERENCES_VERSION) {
|
|
527
|
+
return {
|
|
528
|
+
version: CATALOG_PREFERENCES_VERSION,
|
|
529
|
+
acpEnabled: parsed.acpEnabled !== false,
|
|
530
|
+
preferredAgentId: cleanString(parsed.preferredAgentId),
|
|
531
|
+
enabledAgentIds: Array.isArray(parsed.enabledAgentIds)
|
|
532
|
+
? parsed.enabledAgentIds.filter((id) => typeof id === 'string' && !!id.trim())
|
|
533
|
+
: [],
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
catch {
|
|
538
|
+
// Missing or corrupt preferences fall back to the durable agent registry state.
|
|
539
|
+
}
|
|
540
|
+
return {
|
|
541
|
+
version: CATALOG_PREFERENCES_VERSION,
|
|
542
|
+
acpEnabled: true,
|
|
543
|
+
enabledAgentIds: this.registryService.loadRegistry().registry.agents.filter((agent) => agent.enabled).map((agent) => agent.id),
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
writePreferences(preferences) {
|
|
547
|
+
writeJsonAtomic(this.preferencesPath, preferences);
|
|
548
|
+
}
|
|
549
|
+
readCache() {
|
|
550
|
+
try {
|
|
551
|
+
const parsed = JSON.parse(readFileSync(this.cachePath, 'utf-8'));
|
|
552
|
+
if (!isRecord(parsed) || parsed.version !== CATALOG_CACHE_VERSION)
|
|
553
|
+
return undefined;
|
|
554
|
+
const registry = normalizeProviderRegistry(parsed.registry);
|
|
555
|
+
const fetchedAt = cleanString(parsed.fetchedAt);
|
|
556
|
+
if (!registry || !fetchedAt || !Number.isFinite(Date.parse(fetchedAt)))
|
|
557
|
+
return undefined;
|
|
558
|
+
return { version: CATALOG_CACHE_VERSION, fetchedAt, registry };
|
|
559
|
+
}
|
|
560
|
+
catch {
|
|
561
|
+
return undefined;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
writeCache(cache) {
|
|
565
|
+
writeJsonAtomic(this.cachePath, cache);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
function sameCommandPath(left, right) {
|
|
569
|
+
const normalizedLeft = resolve(left);
|
|
570
|
+
const normalizedRight = resolve(right);
|
|
571
|
+
return process.platform === 'win32'
|
|
572
|
+
? normalizedLeft.toLowerCase() === normalizedRight.toLowerCase()
|
|
573
|
+
: normalizedLeft === normalizedRight;
|
|
574
|
+
}
|
|
575
|
+
function providerUpdateCommand(manifest, agent) {
|
|
576
|
+
return resolveProviderUpdatePlan(manifest, {
|
|
577
|
+
command: agent.command,
|
|
578
|
+
args: agent.args,
|
|
579
|
+
...(agent.cwd ? { cwd: agent.cwd } : {}),
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
async function runProviderUpdateCommand(input) {
|
|
583
|
+
return installXenoKimiNativeUpdate(input, {
|
|
584
|
+
fetchImpl: (url, init) => fetch(url, init),
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
function customCatalogEntry(agent, preferred) {
|
|
588
|
+
const ready = agent.enabled && (agent.certification?.status === 'certified' || agent.certification?.status === 'fixture_only');
|
|
589
|
+
return {
|
|
590
|
+
id: agent.id,
|
|
591
|
+
name: agent.name,
|
|
592
|
+
description: 'Custom ACP agent configured in XENO Hub.',
|
|
593
|
+
authors: [],
|
|
594
|
+
distributionKind: 'custom',
|
|
595
|
+
installed: true,
|
|
596
|
+
configured: true,
|
|
597
|
+
enabled: agent.enabled,
|
|
598
|
+
preferred,
|
|
599
|
+
canAutoSetup: true,
|
|
600
|
+
availableActions: agent.enabled
|
|
601
|
+
? [{ id: 'disable', label: 'Disable', mode: 'automatic' }, { id: 'configure', label: 'Configure', mode: 'automatic' }]
|
|
602
|
+
: [{ id: 'enable', label: 'Enable', mode: 'automatic' }],
|
|
603
|
+
primaryAction: agent.enabled ? undefined : { id: 'enable', label: 'Enable', mode: 'automatic' },
|
|
604
|
+
agentConfigId: agent.id,
|
|
605
|
+
status: ready ? 'ready' : agent.enabled ? 'needs_attention' : 'disabled',
|
|
606
|
+
statusMessage: ready ? 'Enabled and ready.' : agent.certification?.notes || (agent.enabled ? 'Automatic setup needs attention.' : 'Disabled.'),
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
function catalogSort(left, right) {
|
|
610
|
+
const rank = (entry) => entry.preferred ? 0 : entry.status === 'ready' ? 1 : entry.enabled ? 2 : 3;
|
|
611
|
+
return rank(left) - rank(right) || left.name.localeCompare(right.name);
|
|
612
|
+
}
|
|
613
|
+
function archiveExtension(url) {
|
|
614
|
+
const pathname = new URL(url).pathname.toLowerCase();
|
|
615
|
+
if (pathname.endsWith('.tar.gz'))
|
|
616
|
+
return '.tar.gz';
|
|
617
|
+
if (pathname.endsWith('.tgz'))
|
|
618
|
+
return '.tgz';
|
|
619
|
+
if (pathname.endsWith('.zip'))
|
|
620
|
+
return '.zip';
|
|
621
|
+
return '.archive';
|
|
622
|
+
}
|
|
623
|
+
function assertWithin(root, candidate) {
|
|
624
|
+
const rel = relative(resolve(root), resolve(candidate));
|
|
625
|
+
if (!rel || (!rel.startsWith('..') && !isAbsolute(rel)))
|
|
626
|
+
return;
|
|
627
|
+
throw new Error('Provider installation path escaped the XENO-managed directory.');
|
|
628
|
+
}
|
|
629
|
+
function removeManagedDirectory(root, target) {
|
|
630
|
+
assertWithin(root, target);
|
|
631
|
+
rmSync(target, { recursive: true, force: true });
|
|
632
|
+
}
|
|
633
|
+
function assertNoSymlinks(root) {
|
|
634
|
+
const pending = [resolve(root)];
|
|
635
|
+
while (pending.length) {
|
|
636
|
+
const current = pending.pop();
|
|
637
|
+
for (const entry of readdirSync(current, { withFileTypes: true })) {
|
|
638
|
+
const path = resolve(current, entry.name);
|
|
639
|
+
assertWithin(root, path);
|
|
640
|
+
const stat = lstatSync(path);
|
|
641
|
+
if (stat.isSymbolicLink())
|
|
642
|
+
throw new Error('Provider archive contains unsupported symbolic links.');
|
|
643
|
+
if (stat.isDirectory())
|
|
644
|
+
pending.push(path);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
async function resolveNpxLauncher(finder) {
|
|
649
|
+
const node = await finder('node');
|
|
650
|
+
if (!node)
|
|
651
|
+
return undefined;
|
|
652
|
+
const candidates = [
|
|
653
|
+
join(dirname(node), 'node_modules', 'npm', 'bin', 'npx-cli.js'),
|
|
654
|
+
join(dirname(node), 'node_modules', 'npm', 'bin', 'npm-cli.js'),
|
|
655
|
+
];
|
|
656
|
+
const cli = candidates.find((candidate) => existsSync(candidate));
|
|
657
|
+
return cli ? { command: node, args: [cli] } : undefined;
|
|
658
|
+
}
|
|
659
|
+
function findExecutable(name) {
|
|
660
|
+
const lookup = process.platform === 'win32' ? 'where.exe' : 'which';
|
|
661
|
+
return new Promise((resolveResult) => {
|
|
662
|
+
execFile(lookup, [name], {
|
|
663
|
+
encoding: 'utf-8',
|
|
664
|
+
timeout: 3_000,
|
|
665
|
+
windowsHide: true,
|
|
666
|
+
}, (error, stdout) => {
|
|
667
|
+
if (error)
|
|
668
|
+
return resolveResult(null);
|
|
669
|
+
const found = selectProviderExecutableCandidate(stdout.split(/\r?\n/), process.platform);
|
|
670
|
+
resolveResult(found ? resolve(found) : null);
|
|
671
|
+
});
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
async function fetchProviderArchive(url) {
|
|
675
|
+
const response = await fetch(url, { signal: AbortSignal.timeout(120_000) });
|
|
676
|
+
if (!response.ok)
|
|
677
|
+
throw new Error(`Download failed with status ${response.status}.`);
|
|
678
|
+
return Buffer.from(await response.arrayBuffer());
|
|
679
|
+
}
|
|
680
|
+
function writeJsonAtomic(path, value) {
|
|
681
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
682
|
+
const tempPath = `${path}.tmp-${process.pid}-${Date.now()}`;
|
|
683
|
+
writeFileSync(tempPath, `${JSON.stringify(value, null, 2)}\n`, 'utf-8');
|
|
684
|
+
try {
|
|
685
|
+
renameSync(tempPath, path);
|
|
686
|
+
}
|
|
687
|
+
catch (error) {
|
|
688
|
+
try {
|
|
689
|
+
unlinkSync(tempPath);
|
|
690
|
+
}
|
|
691
|
+
catch { /* Preserve the original write failure. */ }
|
|
692
|
+
throw error;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
function updateStringSet(values, id, enabled) {
|
|
696
|
+
const next = new Set(values);
|
|
697
|
+
if (id)
|
|
698
|
+
enabled ? next.add(id) : next.delete(id);
|
|
699
|
+
return [...next];
|
|
700
|
+
}
|
|
701
|
+
function cleanString(value) {
|
|
702
|
+
return typeof value === 'string' && value.trim() ? value.trim() : undefined;
|
|
703
|
+
}
|
|
704
|
+
function isRecord(value) {
|
|
705
|
+
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
706
|
+
}
|
|
707
|
+
//# sourceMappingURL=AcpProviderCatalogService.js.map
|