@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,754 @@
|
|
|
1
|
+
import { execFileSync, spawnSync } from 'child_process';
|
|
2
|
+
import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from 'fs';
|
|
3
|
+
import { homedir } from 'os';
|
|
4
|
+
import { basename, dirname, isAbsolute, join, resolve } from 'path';
|
|
5
|
+
import { ACP_ENDPOINT_CERTIFICATION_PROMPT, resolveCommand } from '@xenosystem/acp-core';
|
|
6
|
+
import { selectProviderExecutableCandidate } from '@xenosystem/acp-provider-manager';
|
|
7
|
+
import { AcpProcessSupervisor } from './AcpProcessSupervisor.js';
|
|
8
|
+
// Command-safety rules live in ./acpCommandSafety so admission and launch
|
|
9
|
+
// cannot drift apart. See that module for the Linux blind spot they close.
|
|
10
|
+
import { isAcpShellCommandLine, isAcpShellExecutable } from './acpCommandSafety.js';
|
|
11
|
+
import { runAcpProviderModels } from './AcpProviderModelService.js';
|
|
12
|
+
import { getAcpProviderVersionReadiness } from './AcpProviderVersionReadiness.js';
|
|
13
|
+
import { acpSafeErrorMessage } from './acpErrors.js';
|
|
14
|
+
import { redactAcpAgentConfig, redactAcpPath, redactAcpText } from './acpRedaction.js';
|
|
15
|
+
const REGISTRY_VERSION = 1;
|
|
16
|
+
const DEFAULT_TEST_TIMEOUT_MS = 5_000;
|
|
17
|
+
export const ACP_REGISTRY_CERTIFICATION_PROMPT = ACP_ENDPOINT_CERTIFICATION_PROMPT;
|
|
18
|
+
const TRUST_LEVELS = new Set(['restricted', 'workspace']);
|
|
19
|
+
const CERTIFICATION_STATUSES = new Set(['not_certified', 'fixture_only', 'certified', 'authentication_required', 'blocked_by_environment', 'failed']);
|
|
20
|
+
const LOCAL_PROVIDER_PRESETS = {
|
|
21
|
+
'codex-local': {
|
|
22
|
+
name: 'Codex CLI',
|
|
23
|
+
policyExample: 'codex-local.provider-policy.example.jsonc',
|
|
24
|
+
},
|
|
25
|
+
'claude-local': {
|
|
26
|
+
name: 'Claude CLI',
|
|
27
|
+
policyExample: 'claude-local.provider-policy.example.jsonc',
|
|
28
|
+
},
|
|
29
|
+
kimi: {
|
|
30
|
+
name: 'Kimi Code CLI',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export function defaultAcpRegistryRoot() {
|
|
34
|
+
return process.env.XENO_ACP_REGISTRY_ROOT || join(homedir(), '.xeno');
|
|
35
|
+
}
|
|
36
|
+
export function createFixtureAcpAgentConfig(rootDir, mode = 'normal', id = `fixture-${mode}`) {
|
|
37
|
+
const fixturePath = join(process.cwd(), 'tests', 'fixtures', 'acp', 'fixture-acp-agent.mjs');
|
|
38
|
+
const now = new Date().toISOString();
|
|
39
|
+
return {
|
|
40
|
+
id,
|
|
41
|
+
name: `Fixture ACP ${mode}`,
|
|
42
|
+
command: process.execPath,
|
|
43
|
+
args: [fixturePath, `--mode=${mode}`],
|
|
44
|
+
cwd: rootDir,
|
|
45
|
+
// Local fixture-only env values are supported; provider credentials stay in provider-owned auth.
|
|
46
|
+
env: { XENO_ACP_FIXTURE_MODE: mode },
|
|
47
|
+
enabled: true,
|
|
48
|
+
trustLevel: 'restricted',
|
|
49
|
+
createdAt: now,
|
|
50
|
+
updatedAt: now,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export function isAcpLocalProviderPresetId(value) {
|
|
54
|
+
return value === 'codex-local' || value === 'claude-local' || value === 'kimi';
|
|
55
|
+
}
|
|
56
|
+
export function normalizeAcpAgentConfig(input, now = new Date().toISOString()) {
|
|
57
|
+
if (!isRecord(input))
|
|
58
|
+
return null;
|
|
59
|
+
const id = cleanString(input.id);
|
|
60
|
+
const name = cleanString(input.name);
|
|
61
|
+
const command = cleanString(input.command);
|
|
62
|
+
if (!id || !name || !command)
|
|
63
|
+
return null;
|
|
64
|
+
const args = Array.isArray(input.args)
|
|
65
|
+
? input.args.filter((arg) => typeof arg === 'string')
|
|
66
|
+
: [];
|
|
67
|
+
const cwd = typeof input.cwd === 'string' && input.cwd.trim() ? input.cwd.trim() : undefined;
|
|
68
|
+
const env = normalizeEnv(input.env);
|
|
69
|
+
const trustLevel = input.trustLevel === 'workspace' ? 'workspace' : 'restricted';
|
|
70
|
+
const certification = normalizeAcpAgentCertification(input.certification);
|
|
71
|
+
const createdAt = cleanString(input.createdAt) || now;
|
|
72
|
+
const updatedAt = cleanString(input.updatedAt) || now;
|
|
73
|
+
return {
|
|
74
|
+
id,
|
|
75
|
+
name,
|
|
76
|
+
command,
|
|
77
|
+
args,
|
|
78
|
+
cwd,
|
|
79
|
+
env,
|
|
80
|
+
enabled: typeof input.enabled === 'boolean' ? input.enabled : false,
|
|
81
|
+
trustLevel,
|
|
82
|
+
certification,
|
|
83
|
+
createdAt,
|
|
84
|
+
updatedAt,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export function normalizeAcpAgentCertification(input) {
|
|
88
|
+
if (!isRecord(input))
|
|
89
|
+
return undefined;
|
|
90
|
+
const status = typeof input.status === 'string' && CERTIFICATION_STATUSES.has(input.status)
|
|
91
|
+
? input.status
|
|
92
|
+
: undefined;
|
|
93
|
+
if (!status)
|
|
94
|
+
return undefined;
|
|
95
|
+
return {
|
|
96
|
+
status,
|
|
97
|
+
certifiedAt: cleanString(input.certifiedAt),
|
|
98
|
+
certifiedBy: input.certifiedBy === 'harness' ? 'harness' : undefined,
|
|
99
|
+
protocolVersion: typeof input.protocolVersion === 'number' && Number.isFinite(input.protocolVersion) ? input.protocolVersion : undefined,
|
|
100
|
+
agentName: cleanString(input.agentName),
|
|
101
|
+
agentVersion: cleanString(input.agentVersion),
|
|
102
|
+
notes: cleanString(input.notes),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export function validateAcpAgentConfig(input, options = {}) {
|
|
106
|
+
const errors = [];
|
|
107
|
+
const config = normalizeAcpAgentConfig(input);
|
|
108
|
+
const raw = isRecord(input) ? input : {};
|
|
109
|
+
if (!config) {
|
|
110
|
+
errors.push('ACP agent id, name, and command are required.');
|
|
111
|
+
return { valid: false, errors };
|
|
112
|
+
}
|
|
113
|
+
if (!config.id)
|
|
114
|
+
errors.push('ACP agent id is required.');
|
|
115
|
+
if (!config.name)
|
|
116
|
+
errors.push('ACP agent name is required.');
|
|
117
|
+
validateCommand(config.command, errors);
|
|
118
|
+
if (!Array.isArray(raw.args) && raw.args !== undefined) {
|
|
119
|
+
errors.push('ACP agent args must be an array of strings.');
|
|
120
|
+
}
|
|
121
|
+
if (Array.isArray(raw.args) && raw.args.some((arg) => typeof arg !== 'string')) {
|
|
122
|
+
errors.push('ACP agent args must be an array of strings.');
|
|
123
|
+
}
|
|
124
|
+
if (config.cwd !== undefined && !isAbsolute(config.cwd)) {
|
|
125
|
+
errors.push('ACP agent cwd must be an absolute path.');
|
|
126
|
+
}
|
|
127
|
+
if (raw.env !== undefined) {
|
|
128
|
+
if (!isRecord(raw.env)) {
|
|
129
|
+
errors.push('ACP agent env must be an object of string values.');
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
for (const [key, value] of Object.entries(raw.env)) {
|
|
133
|
+
if (typeof value !== 'string')
|
|
134
|
+
errors.push(`ACP agent env value must be a string: ${key}`);
|
|
135
|
+
else if (isSecretEnvEntry(key, value))
|
|
136
|
+
errors.push(`ACP agent env cannot store raw secret values: ${key}`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (raw.trustLevel !== undefined && !TRUST_LEVELS.has(String(raw.trustLevel))) {
|
|
141
|
+
errors.push('ACP agent trustLevel must be restricted or workspace.');
|
|
142
|
+
}
|
|
143
|
+
if (raw.shell === true)
|
|
144
|
+
errors.push('ACP agent shell launch is not supported.');
|
|
145
|
+
if (typeof raw.commandLine === 'string')
|
|
146
|
+
errors.push('ACP agent raw commandLine is not supported.');
|
|
147
|
+
const existing = new Set(options.existingIds || []);
|
|
148
|
+
if (!options.allowExistingId && existing.has(config.id)) {
|
|
149
|
+
errors.push(`ACP agent id already exists: ${config.id}`);
|
|
150
|
+
}
|
|
151
|
+
return { valid: errors.length === 0, errors };
|
|
152
|
+
}
|
|
153
|
+
export function isFixtureAcpAgentConfig(config) {
|
|
154
|
+
return config.command === process.execPath
|
|
155
|
+
&& config.args.some((arg) => basename(arg) === 'fixture-acp-agent.mjs');
|
|
156
|
+
}
|
|
157
|
+
export class AcpAgentRegistryService {
|
|
158
|
+
rootDir;
|
|
159
|
+
registryPath;
|
|
160
|
+
requestTimeoutMs;
|
|
161
|
+
constructor(options = {}) {
|
|
162
|
+
this.rootDir = options.rootDir || defaultAcpRegistryRoot();
|
|
163
|
+
this.registryPath = options.registryPath || join(this.rootDir, 'acp-agents.json');
|
|
164
|
+
this.requestTimeoutMs = options.requestTimeoutMs || DEFAULT_TEST_TIMEOUT_MS;
|
|
165
|
+
}
|
|
166
|
+
listAgents(options = {}) {
|
|
167
|
+
const loaded = this.loadRegistry();
|
|
168
|
+
return {
|
|
169
|
+
success: true,
|
|
170
|
+
repaired: loaded.repaired,
|
|
171
|
+
result: loaded.registry.agents.map((agent) => this.toAgentView(agent, options.includeRuntimeStatus !== false)),
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
getAgent(id, options = {}) {
|
|
175
|
+
const agent = this.getAgentInternal(id);
|
|
176
|
+
if (!agent)
|
|
177
|
+
return { success: false, error: 'ACP agent not found.' };
|
|
178
|
+
return { success: true, result: this.toAgentView(agent, options.includeRuntimeStatus !== false) };
|
|
179
|
+
}
|
|
180
|
+
saveAgent(input, options = {}) {
|
|
181
|
+
const loaded = this.loadRegistry();
|
|
182
|
+
const existingIndex = loaded.registry.agents.findIndex((agent) => agent.id === input.id);
|
|
183
|
+
const now = new Date().toISOString();
|
|
184
|
+
const existing = existingIndex >= 0 ? loaded.registry.agents[existingIndex] : undefined;
|
|
185
|
+
const launchIdentityChanged = !!existing && ((input.command !== undefined && input.command !== existing.command)
|
|
186
|
+
|| (input.args !== undefined && JSON.stringify(input.args) !== JSON.stringify(existing.args))
|
|
187
|
+
|| (input.cwd !== undefined && input.cwd !== existing.cwd)
|
|
188
|
+
|| (input.env !== undefined && JSON.stringify(input.env) !== JSON.stringify(existing.env)));
|
|
189
|
+
const candidate = normalizeAcpAgentConfig({
|
|
190
|
+
...existing,
|
|
191
|
+
...input,
|
|
192
|
+
command: input.command ?? existing?.command,
|
|
193
|
+
args: input.args ?? existing?.args ?? [],
|
|
194
|
+
cwd: input.cwd ?? existing?.cwd,
|
|
195
|
+
env: input.env ?? existing?.env,
|
|
196
|
+
enabled: input.enabled ?? existing?.enabled ?? false,
|
|
197
|
+
trustLevel: input.trustLevel ?? existing?.trustLevel ?? 'restricted',
|
|
198
|
+
certification: launchIdentityChanged ? undefined : existing?.certification,
|
|
199
|
+
createdAt: existing?.createdAt || input.createdAt || now,
|
|
200
|
+
updatedAt: now,
|
|
201
|
+
}, now);
|
|
202
|
+
const validation = validateAcpAgentConfig(candidate, {
|
|
203
|
+
existingIds: loaded.registry.agents.map((agent) => agent.id),
|
|
204
|
+
allowExistingId: existingIndex >= 0,
|
|
205
|
+
});
|
|
206
|
+
if (!candidate || !validation.valid) {
|
|
207
|
+
return { success: false, error: validation.errors.join(' ') || 'Invalid ACP agent config.' };
|
|
208
|
+
}
|
|
209
|
+
const nextAgents = [...loaded.registry.agents];
|
|
210
|
+
if (existingIndex >= 0)
|
|
211
|
+
nextAgents[existingIndex] = candidate;
|
|
212
|
+
else
|
|
213
|
+
nextAgents.push(candidate);
|
|
214
|
+
this.writeRegistry({ version: REGISTRY_VERSION, agents: nextAgents });
|
|
215
|
+
return {
|
|
216
|
+
success: true,
|
|
217
|
+
repaired: loaded.repaired,
|
|
218
|
+
result: this.toAgentView(candidate, options.includeRuntimeStatus !== false),
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
removeAgent(id) {
|
|
222
|
+
const loaded = this.loadRegistry();
|
|
223
|
+
const nextAgents = loaded.registry.agents.filter((agent) => agent.id !== id);
|
|
224
|
+
if (nextAgents.length === loaded.registry.agents.length) {
|
|
225
|
+
return { success: false, error: 'ACP agent not found.' };
|
|
226
|
+
}
|
|
227
|
+
this.writeRegistry({ version: REGISTRY_VERSION, agents: nextAgents });
|
|
228
|
+
return { success: true, result: { removed: true } };
|
|
229
|
+
}
|
|
230
|
+
setAgentEnabled(id, enabled) {
|
|
231
|
+
const loaded = this.loadRegistry();
|
|
232
|
+
const index = loaded.registry.agents.findIndex((agent) => agent.id === id);
|
|
233
|
+
if (index < 0)
|
|
234
|
+
return { success: false, error: 'ACP agent not found.' };
|
|
235
|
+
const agent = {
|
|
236
|
+
...loaded.registry.agents[index],
|
|
237
|
+
enabled,
|
|
238
|
+
updatedAt: new Date().toISOString(),
|
|
239
|
+
};
|
|
240
|
+
const nextAgents = [...loaded.registry.agents];
|
|
241
|
+
nextAgents[index] = agent;
|
|
242
|
+
this.writeRegistry({ version: REGISTRY_VERSION, agents: nextAgents });
|
|
243
|
+
return { success: true, result: this.toAgentView(agent) };
|
|
244
|
+
}
|
|
245
|
+
setAgentsEnabled(updates) {
|
|
246
|
+
const loaded = this.loadRegistry();
|
|
247
|
+
const updateEntries = Object.entries(updates);
|
|
248
|
+
if (!updateEntries.length)
|
|
249
|
+
return { success: true, result: { updatedIds: [] } };
|
|
250
|
+
const knownIds = new Set(loaded.registry.agents.map((agent) => agent.id));
|
|
251
|
+
const unknownId = updateEntries.find(([id]) => !knownIds.has(id))?.[0];
|
|
252
|
+
if (unknownId)
|
|
253
|
+
return { success: false, error: `ACP agent not found: ${unknownId}` };
|
|
254
|
+
const now = new Date().toISOString();
|
|
255
|
+
const updatedIds = [];
|
|
256
|
+
const agents = loaded.registry.agents.map((agent) => {
|
|
257
|
+
const enabled = updates[agent.id];
|
|
258
|
+
if (typeof enabled !== 'boolean' || enabled === agent.enabled)
|
|
259
|
+
return agent;
|
|
260
|
+
updatedIds.push(agent.id);
|
|
261
|
+
return { ...agent, enabled, updatedAt: now };
|
|
262
|
+
});
|
|
263
|
+
if (updatedIds.length)
|
|
264
|
+
this.writeRegistry({ version: REGISTRY_VERSION, agents });
|
|
265
|
+
return { success: true, repaired: loaded.repaired, result: { updatedIds } };
|
|
266
|
+
}
|
|
267
|
+
setAgentCertification(id, certification, options = {}) {
|
|
268
|
+
const loaded = this.loadRegistry();
|
|
269
|
+
const index = loaded.registry.agents.findIndex((agent) => agent.id === id);
|
|
270
|
+
if (index < 0)
|
|
271
|
+
return { success: false, error: 'ACP agent not found.' };
|
|
272
|
+
const normalized = normalizeAcpAgentCertification(certification);
|
|
273
|
+
if (!normalized)
|
|
274
|
+
return { success: false, error: 'Invalid ACP certification metadata.' };
|
|
275
|
+
const agent = {
|
|
276
|
+
...loaded.registry.agents[index],
|
|
277
|
+
certification: normalized,
|
|
278
|
+
updatedAt: new Date().toISOString(),
|
|
279
|
+
};
|
|
280
|
+
const nextAgents = [...loaded.registry.agents];
|
|
281
|
+
nextAgents[index] = agent;
|
|
282
|
+
this.writeRegistry({ version: REGISTRY_VERSION, agents: nextAgents });
|
|
283
|
+
return { success: true, result: this.toAgentView(agent, options.includeRuntimeStatus !== false) };
|
|
284
|
+
}
|
|
285
|
+
clearAgentCertification(id, options = {}) {
|
|
286
|
+
const loaded = this.loadRegistry();
|
|
287
|
+
const index = loaded.registry.agents.findIndex((agent) => agent.id === id);
|
|
288
|
+
if (index < 0)
|
|
289
|
+
return { success: false, error: 'ACP agent not found.' };
|
|
290
|
+
const agent = {
|
|
291
|
+
...loaded.registry.agents[index],
|
|
292
|
+
certification: undefined,
|
|
293
|
+
updatedAt: new Date().toISOString(),
|
|
294
|
+
};
|
|
295
|
+
const nextAgents = [...loaded.registry.agents];
|
|
296
|
+
nextAgents[index] = agent;
|
|
297
|
+
this.writeRegistry({ version: REGISTRY_VERSION, agents: nextAgents });
|
|
298
|
+
return { success: true, result: this.toAgentView(agent, options.includeRuntimeStatus !== false) };
|
|
299
|
+
}
|
|
300
|
+
diagnostics(options = {}) {
|
|
301
|
+
const loaded = this.loadRegistry();
|
|
302
|
+
const includeRuntimeStatus = options.includeRuntimeStatus !== false;
|
|
303
|
+
return {
|
|
304
|
+
path: redactAcpPath(this.registryPath) || 'acp-agents.json',
|
|
305
|
+
exists: existsSync(this.registryPath),
|
|
306
|
+
version: loaded.registry.version,
|
|
307
|
+
agentCount: loaded.registry.agents.length,
|
|
308
|
+
enabledCount: loaded.registry.agents.filter((agent) => agent.enabled).length,
|
|
309
|
+
repaired: loaded.repaired,
|
|
310
|
+
backupPath: redactAcpPath(loaded.backupPath),
|
|
311
|
+
agents: loaded.registry.agents.map((agent) => ({
|
|
312
|
+
...this.toAgentView(agent, includeRuntimeStatus),
|
|
313
|
+
providerVersionReadiness: includeRuntimeStatus ? getAcpProviderVersionReadiness(agent) : undefined,
|
|
314
|
+
})),
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
async testAgent(id, options = {}) {
|
|
318
|
+
const agent = this.getAgentInternal(id);
|
|
319
|
+
if (!agent) {
|
|
320
|
+
return { success: false, updateCount: 0, diagnostics: {}, error: 'ACP agent not found.' };
|
|
321
|
+
}
|
|
322
|
+
if (!agent.enabled && !options.allowDisabled) {
|
|
323
|
+
return {
|
|
324
|
+
success: false,
|
|
325
|
+
updateCount: 0,
|
|
326
|
+
diagnostics: { agentConfigId: agent.id },
|
|
327
|
+
error: 'ACP agent is disabled and cannot be tested.',
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
const canRunExternal = options.allowExternal || agent.certification?.status === 'certified';
|
|
331
|
+
if (!isFixtureAcpAgentConfig(agent) && !canRunExternal) {
|
|
332
|
+
return {
|
|
333
|
+
success: false,
|
|
334
|
+
updateCount: 0,
|
|
335
|
+
diagnostics: { agentConfigId: agent.id },
|
|
336
|
+
error: 'External ACP agent is not certified. Run AGENT-009E certification before testing this config.',
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
const supervisor = new AcpProcessSupervisor(agent, { requestTimeoutMs: this.requestTimeoutMs });
|
|
340
|
+
try {
|
|
341
|
+
const initialized = await supervisor.initialize();
|
|
342
|
+
const session = await supervisor.createSession({
|
|
343
|
+
cwd: agent.cwd || this.rootDir,
|
|
344
|
+
mcpServers: [],
|
|
345
|
+
});
|
|
346
|
+
const prompt = await supervisor.prompt(session.sessionId, ACP_REGISTRY_CERTIFICATION_PROMPT, { timeoutMs: this.requestTimeoutMs });
|
|
347
|
+
const diagnostics = supervisor.diagnostics();
|
|
348
|
+
diagnostics.lastStopReason = prompt.result.stopReason;
|
|
349
|
+
return {
|
|
350
|
+
success: prompt.result.stopReason === 'end_turn',
|
|
351
|
+
protocolVersion: initialized.protocolVersion,
|
|
352
|
+
agentInfo: initialized.agentInfo,
|
|
353
|
+
updateCount: prompt.updates.length,
|
|
354
|
+
stopReason: prompt.result.stopReason,
|
|
355
|
+
diagnostics,
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
catch (error) {
|
|
359
|
+
return {
|
|
360
|
+
success: false,
|
|
361
|
+
updateCount: 0,
|
|
362
|
+
diagnostics: supervisor.diagnostics(),
|
|
363
|
+
error: redactAcpText(acpSafeErrorMessage(error), 1000),
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
finally {
|
|
367
|
+
await supervisor.stop().catch(() => undefined);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
async getProviderModels(id, providerId) {
|
|
371
|
+
const agent = this.getAgentInternal(id);
|
|
372
|
+
if (!agent) {
|
|
373
|
+
return {
|
|
374
|
+
success: false,
|
|
375
|
+
providerId: providerId || id,
|
|
376
|
+
commandBasename: '[redacted-command]',
|
|
377
|
+
argsCount: 0,
|
|
378
|
+
stdoutTail: [],
|
|
379
|
+
stderrTail: [],
|
|
380
|
+
error: 'ACP agent not found.',
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
return runAcpProviderModels(agent, { providerId });
|
|
384
|
+
}
|
|
385
|
+
createFixtureAgentConfig(rootDir, mode = 'normal', id) {
|
|
386
|
+
return createFixtureAcpAgentConfig(rootDir, mode, id);
|
|
387
|
+
}
|
|
388
|
+
createLocalProviderAgentConfig(providerId) {
|
|
389
|
+
const preset = LOCAL_PROVIDER_PRESETS[providerId];
|
|
390
|
+
if (providerId === 'kimi') {
|
|
391
|
+
const kimiPath = findExecutable('kimi');
|
|
392
|
+
if (!kimiPath) {
|
|
393
|
+
return {
|
|
394
|
+
success: false,
|
|
395
|
+
error: 'Kimi Code CLI executable not found on PATH. Install Kimi Code CLI, then run kimi login before adding it to Hub.',
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
return this.saveAgent({
|
|
399
|
+
id: providerId,
|
|
400
|
+
name: preset.name,
|
|
401
|
+
command: kimiPath,
|
|
402
|
+
args: ['acp'],
|
|
403
|
+
cwd: this.rootDir,
|
|
404
|
+
enabled: true,
|
|
405
|
+
trustLevel: 'restricted',
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
const xenoAcpRoot = findXenoAcpRoot();
|
|
409
|
+
if (!xenoAcpRoot) {
|
|
410
|
+
return {
|
|
411
|
+
success: false,
|
|
412
|
+
error: 'xeno-acp checkout not found. Set XENO_ACP_ROOT to the xeno-acp repository path and build xeno-acp first.',
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
const nodePath = findNodeExecutable();
|
|
416
|
+
if (!nodePath) {
|
|
417
|
+
return { success: false, error: 'Node.js executable not found on PATH. Install Node.js or add node to PATH before adding a local ACP provider.' };
|
|
418
|
+
}
|
|
419
|
+
const cliPath = xenoAcpAgentCliPath(xenoAcpRoot);
|
|
420
|
+
const policyPath = join(xenoAcpRoot, 'docs', 'examples', preset.policyExample);
|
|
421
|
+
if (!existsSync(cliPath)) {
|
|
422
|
+
return { success: false, error: `xeno-acp agent endpoint is not built: ${redactAcpPath(cliPath) || 'packages/agent/dist/cli.js'}.` };
|
|
423
|
+
}
|
|
424
|
+
if (!existsSync(policyPath)) {
|
|
425
|
+
return { success: false, error: `xeno-acp provider policy example is missing: ${redactAcpPath(policyPath) || preset.policyExample}.` };
|
|
426
|
+
}
|
|
427
|
+
return this.saveAgent({
|
|
428
|
+
id: providerId,
|
|
429
|
+
name: preset.name,
|
|
430
|
+
command: nodePath,
|
|
431
|
+
args: [
|
|
432
|
+
cliPath,
|
|
433
|
+
'agent',
|
|
434
|
+
'--provider',
|
|
435
|
+
providerId,
|
|
436
|
+
'--provider-policy',
|
|
437
|
+
policyPath,
|
|
438
|
+
'--provider-approvals',
|
|
439
|
+
join(this.rootDir, 'provider-approvals.json'),
|
|
440
|
+
],
|
|
441
|
+
cwd: xenoAcpRoot,
|
|
442
|
+
enabled: true,
|
|
443
|
+
trustLevel: 'restricted',
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
getAgentInternal(id) {
|
|
447
|
+
return this.loadRegistry().registry.agents.find((agent) => agent.id === id);
|
|
448
|
+
}
|
|
449
|
+
loadRegistry() {
|
|
450
|
+
mkdirSync(dirname(this.registryPath), { recursive: true });
|
|
451
|
+
if (!existsSync(this.registryPath)) {
|
|
452
|
+
const registry = { version: REGISTRY_VERSION, agents: [] };
|
|
453
|
+
this.writeRegistry(registry);
|
|
454
|
+
return { registry, repaired: false };
|
|
455
|
+
}
|
|
456
|
+
let parsed;
|
|
457
|
+
try {
|
|
458
|
+
parsed = JSON.parse(readFileSync(this.registryPath, 'utf-8'));
|
|
459
|
+
}
|
|
460
|
+
catch {
|
|
461
|
+
const backupPath = this.backupRegistry();
|
|
462
|
+
const registry = { version: REGISTRY_VERSION, agents: [] };
|
|
463
|
+
this.writeRegistry(registry);
|
|
464
|
+
return { registry, repaired: true, backupPath };
|
|
465
|
+
}
|
|
466
|
+
const repair = this.repairRegistry(parsed);
|
|
467
|
+
if (repair.repaired) {
|
|
468
|
+
const backupPath = this.backupRegistry();
|
|
469
|
+
this.writeRegistry(repair.registry);
|
|
470
|
+
return { ...repair, backupPath };
|
|
471
|
+
}
|
|
472
|
+
return repair;
|
|
473
|
+
}
|
|
474
|
+
repairRegistry(value) {
|
|
475
|
+
const now = new Date().toISOString();
|
|
476
|
+
let repaired = false;
|
|
477
|
+
const rawAgents = isRecord(value) && Array.isArray(value.agents) ? value.agents : [];
|
|
478
|
+
if (!isRecord(value) || value.version !== REGISTRY_VERSION || !Array.isArray(value.agents))
|
|
479
|
+
repaired = true;
|
|
480
|
+
const ids = new Set();
|
|
481
|
+
const agents = [];
|
|
482
|
+
for (const rawAgent of rawAgents) {
|
|
483
|
+
const agent = normalizeAcpAgentConfig(rawAgent, now);
|
|
484
|
+
if (!agent) {
|
|
485
|
+
repaired = true;
|
|
486
|
+
continue;
|
|
487
|
+
}
|
|
488
|
+
const validation = validateAcpAgentConfig(agent, { existingIds: ids });
|
|
489
|
+
if (!validation.valid) {
|
|
490
|
+
repaired = true;
|
|
491
|
+
continue;
|
|
492
|
+
}
|
|
493
|
+
ids.add(agent.id);
|
|
494
|
+
agents.push(agent);
|
|
495
|
+
if (JSON.stringify(rawAgent) !== JSON.stringify(agent))
|
|
496
|
+
repaired = true;
|
|
497
|
+
}
|
|
498
|
+
return { registry: { version: REGISTRY_VERSION, agents }, repaired };
|
|
499
|
+
}
|
|
500
|
+
writeRegistry(registry) {
|
|
501
|
+
mkdirSync(dirname(this.registryPath), { recursive: true });
|
|
502
|
+
const tempPath = `${this.registryPath}.tmp-${process.pid}-${Date.now()}`;
|
|
503
|
+
writeFileSync(tempPath, `${JSON.stringify(registry, null, 2)}\n`, 'utf-8');
|
|
504
|
+
try {
|
|
505
|
+
renameSync(tempPath, this.registryPath);
|
|
506
|
+
}
|
|
507
|
+
catch (error) {
|
|
508
|
+
try {
|
|
509
|
+
unlinkSync(tempPath);
|
|
510
|
+
}
|
|
511
|
+
catch {
|
|
512
|
+
// Ignore temp cleanup failure; original write error is the important signal.
|
|
513
|
+
}
|
|
514
|
+
throw error;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
backupRegistry() {
|
|
518
|
+
if (!existsSync(this.registryPath))
|
|
519
|
+
return undefined;
|
|
520
|
+
const backupPath = `${this.registryPath}.bak-${Date.now()}`;
|
|
521
|
+
copyFileSync(this.registryPath, backupPath);
|
|
522
|
+
return backupPath;
|
|
523
|
+
}
|
|
524
|
+
toAgentView(agent, includeRuntimeStatus = true) {
|
|
525
|
+
const providerCommand = buildAcpProviderReviewCommand(agent);
|
|
526
|
+
const providerReview = includeRuntimeStatus ? getAcpProviderReview(agent) : undefined;
|
|
527
|
+
return {
|
|
528
|
+
...redactAcpAgentConfig(agent),
|
|
529
|
+
endpointKind: isNativeAcpAgentConfig(agent)
|
|
530
|
+
? 'native-acp'
|
|
531
|
+
: providerCommand
|
|
532
|
+
? 'xeno-acp-provider'
|
|
533
|
+
: 'custom-acp',
|
|
534
|
+
providerReview,
|
|
535
|
+
providerVersionReadiness: includeRuntimeStatus ? getAcpProviderVersionReadiness(agent) : undefined,
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
let sharedAcpAgentRegistryService;
|
|
540
|
+
export function getAcpAgentRegistryService() {
|
|
541
|
+
if (!sharedAcpAgentRegistryService)
|
|
542
|
+
sharedAcpAgentRegistryService = new AcpAgentRegistryService();
|
|
543
|
+
return sharedAcpAgentRegistryService;
|
|
544
|
+
}
|
|
545
|
+
function cleanString(value) {
|
|
546
|
+
return typeof value === 'string' && value.trim() ? value.trim() : undefined;
|
|
547
|
+
}
|
|
548
|
+
function normalizeEnv(value) {
|
|
549
|
+
if (!isRecord(value))
|
|
550
|
+
return undefined;
|
|
551
|
+
const env = {};
|
|
552
|
+
for (const [key, item] of Object.entries(value)) {
|
|
553
|
+
if (typeof item === 'string')
|
|
554
|
+
env[key] = item;
|
|
555
|
+
}
|
|
556
|
+
return Object.keys(env).length ? env : undefined;
|
|
557
|
+
}
|
|
558
|
+
function isSecretEnvEntry(key, value) {
|
|
559
|
+
return /(^|_)(TOKEN|SECRET|PASSWORD|COOKIE|AUTHORIZATION|API_?KEY|CREDENTIAL|BEARER)(_|$)/i.test(key)
|
|
560
|
+
|| redactAcpText(value) !== value;
|
|
561
|
+
}
|
|
562
|
+
function validateCommand(command, errors) {
|
|
563
|
+
const trimmed = command.trim();
|
|
564
|
+
if (!trimmed) {
|
|
565
|
+
errors.push('ACP command must be a non-empty string.');
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
if (!isAbsolute(trimmed)) {
|
|
569
|
+
errors.push('ACP command must be an absolute executable path.');
|
|
570
|
+
}
|
|
571
|
+
if (isAcpShellCommandLine(trimmed)) {
|
|
572
|
+
errors.push('ACP command must be an executable path, not a shell command line.');
|
|
573
|
+
}
|
|
574
|
+
if (isAcpShellExecutable(trimmed)) {
|
|
575
|
+
errors.push('ACP command cannot be a shell executable.');
|
|
576
|
+
}
|
|
577
|
+
if (resolve(trimmed) !== trimmed && trimmed !== process.execPath) {
|
|
578
|
+
// Keep the executable field boring and literal; args carry all dynamic behavior.
|
|
579
|
+
errors.push('ACP command path must be normalized before launch.');
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
function isRecord(value) {
|
|
583
|
+
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
584
|
+
}
|
|
585
|
+
function findNodeExecutable() {
|
|
586
|
+
const found = findExecutable('node');
|
|
587
|
+
if (found)
|
|
588
|
+
return found;
|
|
589
|
+
const current = basename(process.execPath).toLowerCase();
|
|
590
|
+
return current === 'node' || current === 'node.exe' ? process.execPath : null;
|
|
591
|
+
}
|
|
592
|
+
function findExecutable(name) {
|
|
593
|
+
const lookup = process.platform === 'win32' ? 'where.exe' : 'which';
|
|
594
|
+
try {
|
|
595
|
+
const output = execFileSync(lookup, [name], {
|
|
596
|
+
encoding: 'utf-8',
|
|
597
|
+
timeout: 3_000,
|
|
598
|
+
windowsHide: true,
|
|
599
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
600
|
+
});
|
|
601
|
+
const found = selectProviderExecutableCandidate(output.split(/\r?\n/), process.platform);
|
|
602
|
+
if (found)
|
|
603
|
+
return resolve(found);
|
|
604
|
+
}
|
|
605
|
+
catch {
|
|
606
|
+
// PATH lookup is best effort; the caller returns a safe setup error.
|
|
607
|
+
}
|
|
608
|
+
return null;
|
|
609
|
+
}
|
|
610
|
+
function findXenoAcpRoot() {
|
|
611
|
+
const executableDir = dirname(process.execPath);
|
|
612
|
+
const rawCandidates = [
|
|
613
|
+
process.env.XENO_ACP_ROOT,
|
|
614
|
+
resolve(process.cwd(), '..', 'xeno-acp'),
|
|
615
|
+
resolve(process.cwd(), 'xeno-acp'),
|
|
616
|
+
resolve(process.cwd(), '..', '..', 'xeno-acp'),
|
|
617
|
+
resolve(process.cwd(), '..', '..', '..', 'xeno-acp'),
|
|
618
|
+
resolve(executableDir, '..', '..', '..', 'xeno-acp'),
|
|
619
|
+
];
|
|
620
|
+
const seen = new Set();
|
|
621
|
+
for (const candidate of rawCandidates) {
|
|
622
|
+
if (!candidate)
|
|
623
|
+
continue;
|
|
624
|
+
const resolved = resolve(candidate);
|
|
625
|
+
if (seen.has(resolved))
|
|
626
|
+
continue;
|
|
627
|
+
seen.add(resolved);
|
|
628
|
+
if (existsSync(xenoAcpAgentCliPath(resolved)))
|
|
629
|
+
return resolved;
|
|
630
|
+
}
|
|
631
|
+
return null;
|
|
632
|
+
}
|
|
633
|
+
function xenoAcpAgentCliPath(rootDir) {
|
|
634
|
+
return join(rootDir, 'packages', 'agent', 'dist', 'cli.js');
|
|
635
|
+
}
|
|
636
|
+
function isNativeAcpAgentConfig(config) {
|
|
637
|
+
const commandName = basename(config.command).toLowerCase().replace(/\.(exe|cmd|bat)$/i, '');
|
|
638
|
+
if (config.id.startsWith('registry-'))
|
|
639
|
+
return true;
|
|
640
|
+
if (config.id === 'kimi') {
|
|
641
|
+
return commandName === 'kimi'
|
|
642
|
+
&& config.args.length === 1
|
|
643
|
+
&& config.args[0].toLowerCase() === 'acp';
|
|
644
|
+
}
|
|
645
|
+
if (config.id === 'gemini')
|
|
646
|
+
return commandName === 'gemini' && config.args.some((arg) => arg.toLowerCase() === '--acp');
|
|
647
|
+
if (config.id === 'opencode')
|
|
648
|
+
return commandName === 'opencode' && config.args.some((arg) => arg.toLowerCase() === 'acp');
|
|
649
|
+
return false;
|
|
650
|
+
}
|
|
651
|
+
function getAcpProviderReview(config) {
|
|
652
|
+
const command = buildAcpProviderReviewCommand(config);
|
|
653
|
+
if (!command)
|
|
654
|
+
return undefined;
|
|
655
|
+
const resolved = resolveCommand(command.command, command.args);
|
|
656
|
+
const result = spawnSync(resolved.file, resolved.args, {
|
|
657
|
+
cwd: config.cwd,
|
|
658
|
+
env: {},
|
|
659
|
+
encoding: 'utf-8',
|
|
660
|
+
timeout: 5_000,
|
|
661
|
+
windowsHide: true,
|
|
662
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
663
|
+
});
|
|
664
|
+
if (!result.stdout)
|
|
665
|
+
return undefined;
|
|
666
|
+
return normalizeProviderReview(result.stdout);
|
|
667
|
+
}
|
|
668
|
+
function buildAcpProviderReviewCommand(config) {
|
|
669
|
+
const agentIndex = config.args.findIndex((arg) => arg === 'agent');
|
|
670
|
+
if (agentIndex < 0)
|
|
671
|
+
return undefined;
|
|
672
|
+
const providerId = readFlag(config.args, '--provider');
|
|
673
|
+
const policyPath = readFlag(config.args, '--provider-policy');
|
|
674
|
+
const approvalsPath = readFlag(config.args, '--provider-approvals');
|
|
675
|
+
if (!providerId || !policyPath || !approvalsPath)
|
|
676
|
+
return undefined;
|
|
677
|
+
return {
|
|
678
|
+
command: config.command,
|
|
679
|
+
args: [
|
|
680
|
+
...config.args.slice(0, agentIndex),
|
|
681
|
+
'providers',
|
|
682
|
+
'review',
|
|
683
|
+
'--provider',
|
|
684
|
+
providerId,
|
|
685
|
+
'--config',
|
|
686
|
+
policyPath,
|
|
687
|
+
'--store',
|
|
688
|
+
approvalsPath,
|
|
689
|
+
],
|
|
690
|
+
};
|
|
691
|
+
}
|
|
692
|
+
function normalizeProviderReview(stdout) {
|
|
693
|
+
let parsed;
|
|
694
|
+
try {
|
|
695
|
+
parsed = JSON.parse(stdout);
|
|
696
|
+
}
|
|
697
|
+
catch {
|
|
698
|
+
return undefined;
|
|
699
|
+
}
|
|
700
|
+
const record = isRecord(parsed) ? parsed : {};
|
|
701
|
+
const providerId = cleanString(record.providerId);
|
|
702
|
+
if (!providerId)
|
|
703
|
+
return undefined;
|
|
704
|
+
const auth = isRecord(record.auth) ? record.auth : {};
|
|
705
|
+
const refs = Array.isArray(auth.secretRefs) ? auth.secretRefs.filter(isRecord) : [];
|
|
706
|
+
return {
|
|
707
|
+
providerId: redactAcpText(providerId, 120),
|
|
708
|
+
displayName: cleanString(record.displayName) ? redactAcpText(cleanString(record.displayName), 160) : undefined,
|
|
709
|
+
trustClass: cleanString(record.trustClass),
|
|
710
|
+
runnable: record.runnable === true,
|
|
711
|
+
approvalState: providerApprovalState(record),
|
|
712
|
+
runtimeEnvKeys: runtimeEnvKeys(record),
|
|
713
|
+
requiredAuthRefs: refs.filter((ref) => ref.required === true).map((ref) => redactAcpText(String(ref.id || ''), 120)).filter(Boolean),
|
|
714
|
+
optionalAuthRefs: refs.filter((ref) => ref.required !== true).map((ref) => redactAcpText(String(ref.id || ''), 120)).filter(Boolean),
|
|
715
|
+
enforcementClassification: {
|
|
716
|
+
network: 'network: not_enforced',
|
|
717
|
+
filesystem: 'filesystem: not_enforced_against_hostile_process',
|
|
718
|
+
},
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
function providerApprovalState(record) {
|
|
722
|
+
const status = cleanString(record.status);
|
|
723
|
+
const approval = isRecord(record.approval) ? record.approval : undefined;
|
|
724
|
+
if (approval?.current === true)
|
|
725
|
+
return 'approved';
|
|
726
|
+
if (approval && approval.current === false)
|
|
727
|
+
return 'stale';
|
|
728
|
+
if (status === 'requires_approval')
|
|
729
|
+
return 'missing';
|
|
730
|
+
if (status === 'stale_approval')
|
|
731
|
+
return 'stale';
|
|
732
|
+
if (status && status.startsWith('blocked'))
|
|
733
|
+
return 'blocked';
|
|
734
|
+
if (record.runnable === true)
|
|
735
|
+
return 'not_required';
|
|
736
|
+
return 'blocked';
|
|
737
|
+
}
|
|
738
|
+
function runtimeEnvKeys(record) {
|
|
739
|
+
const runtimeEnv = isRecord(record.runtimeEnv) ? record.runtimeEnv : {};
|
|
740
|
+
return Array.isArray(runtimeEnv.forwardedKeys)
|
|
741
|
+
? runtimeEnv.forwardedKeys.map((key) => typeof key === 'string' ? redactAcpText(key, 120) : '').filter(Boolean)
|
|
742
|
+
: [];
|
|
743
|
+
}
|
|
744
|
+
function readFlag(args, flag) {
|
|
745
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
746
|
+
const arg = args[i];
|
|
747
|
+
if (arg === flag)
|
|
748
|
+
return cleanString(args[i + 1]);
|
|
749
|
+
if (arg.startsWith(`${flag}=`))
|
|
750
|
+
return cleanString(arg.slice(flag.length + 1));
|
|
751
|
+
}
|
|
752
|
+
return undefined;
|
|
753
|
+
}
|
|
754
|
+
//# sourceMappingURL=AcpAgentRegistryService.js.map
|