@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,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host's coordination surface — the three primitives as one service.
|
|
3
|
+
*
|
|
4
|
+
* `XENO_AGENT_COORDINATION_SPEC.md` §1 treats message, query and claim as one
|
|
5
|
+
* capability rather than three features, and this is where that becomes true:
|
|
6
|
+
* a claim refusal names the holder so the requester can *message* them, and a
|
|
7
|
+
* message is only actionable because the receiver can *query* what the sender
|
|
8
|
+
* changed. Composed here so no caller has to wire the relationship itself.
|
|
9
|
+
*
|
|
10
|
+
* ## Gate 8 — coordination is visible in the timeline, and causal
|
|
11
|
+
*
|
|
12
|
+
* §9 requires messages and claims to be auditable, and gate 8 requires "a diff
|
|
13
|
+
* can be traced back to the message that caused it". Two halves:
|
|
14
|
+
*
|
|
15
|
+
* 1. Every send, delivery, claim and refusal emits a runtime event, so the
|
|
16
|
+
* timeline shows coordination alongside the work it produced.
|
|
17
|
+
* 2. A delivered message becomes the receiving run's **current cause** until its
|
|
18
|
+
* turn ends. Work the run performs while that cause is set carries the
|
|
19
|
+
* message id, so a diff points at the sentence that prompted it rather than
|
|
20
|
+
* leaving a reader to infer it from timestamps.
|
|
21
|
+
*
|
|
22
|
+
* The second half is the one that is easy to get wrong by making it implicit.
|
|
23
|
+
* Inferring cause from "the message arrived shortly before the edit" is a guess
|
|
24
|
+
* that looks like a fact — and this codebase has spent enough time removing
|
|
25
|
+
* outputs that cannot distinguish a measurement from an assumption.
|
|
26
|
+
*/
|
|
27
|
+
import { type AcquireClaimResult, type Claim, type ClaimScope } from './claims.js';
|
|
28
|
+
import { type DeliveredMessage, type AgentMessage, type InboundPolicy, type MessageBusOptions, type MessageOutcome } from './messages.js';
|
|
29
|
+
import { type PeerDescriptor, type RunRecord, type RunSummary } from './query.js';
|
|
30
|
+
export type CoordinationEvent = {
|
|
31
|
+
type: 'coordination.message.sent';
|
|
32
|
+
fromRunId: string;
|
|
33
|
+
toRunId: string;
|
|
34
|
+
messageId: string;
|
|
35
|
+
outcome: MessageOutcome['status'];
|
|
36
|
+
} | {
|
|
37
|
+
type: 'coordination.message.delivered';
|
|
38
|
+
toRunId: string;
|
|
39
|
+
messageId: string;
|
|
40
|
+
fromRunId: string;
|
|
41
|
+
} | {
|
|
42
|
+
type: 'coordination.claim.acquired';
|
|
43
|
+
runId: string;
|
|
44
|
+
scope: ClaimScope;
|
|
45
|
+
claimId: string;
|
|
46
|
+
} | {
|
|
47
|
+
type: 'coordination.claim.refused';
|
|
48
|
+
runId: string;
|
|
49
|
+
scope: ClaimScope;
|
|
50
|
+
heldByRunId: string;
|
|
51
|
+
} | {
|
|
52
|
+
type: 'coordination.claim.released';
|
|
53
|
+
runId: string;
|
|
54
|
+
released: number;
|
|
55
|
+
};
|
|
56
|
+
export interface CoordinationServiceOptions extends MessageBusOptions {
|
|
57
|
+
/**
|
|
58
|
+
* Where coordination events go. Injected rather than imported so the service
|
|
59
|
+
* has no opinion about the event store, and so a test observes exactly what a
|
|
60
|
+
* timeline would.
|
|
61
|
+
*/
|
|
62
|
+
emit?: (event: CoordinationEvent) => void;
|
|
63
|
+
maxFiles?: number;
|
|
64
|
+
maxCommands?: number;
|
|
65
|
+
canSee?: (caller: RunRecord, candidate: RunRecord) => boolean;
|
|
66
|
+
}
|
|
67
|
+
export declare class CoordinationService {
|
|
68
|
+
#private;
|
|
69
|
+
constructor(options?: CoordinationServiceOptions);
|
|
70
|
+
/**
|
|
71
|
+
* Redirects coordination events after construction.
|
|
72
|
+
*
|
|
73
|
+
* Mirrors `WorkspaceHostService.setEventSink`, and exists for the same
|
|
74
|
+
* reason: the host is constructed with its services, so a sink passed at
|
|
75
|
+
* construction time would have to be built before the host that owns it. A
|
|
76
|
+
* service that can only be wired at construction cannot be mounted onto an
|
|
77
|
+
* existing host at all.
|
|
78
|
+
*
|
|
79
|
+
* Replaces rather than adds. Coordination events are the audit record gate 8
|
|
80
|
+
* rests on, and fanning them to two sinks makes "the timeline" ambiguous
|
|
81
|
+
* exactly where a reader needs it to be singular.
|
|
82
|
+
*/
|
|
83
|
+
setEventSink(emit: (event: CoordinationEvent) => void): void;
|
|
84
|
+
/**
|
|
85
|
+
* Where coordination goes to become a durable timeline entry.
|
|
86
|
+
*
|
|
87
|
+
* Gate 8 is unusually blunt about the stakes: *"A reviewer looking at a
|
|
88
|
+
* surprising diff must be able to trace it back to the message that prompted
|
|
89
|
+
* it. **If they cannot, this section is not implemented.**"* Without this sink
|
|
90
|
+
* wired, coordination is visible live and absent from the record.
|
|
91
|
+
*/
|
|
92
|
+
setTimelineSink(record: (event: CoordinationEvent, text?: string) => void): void;
|
|
93
|
+
registerRun(record: RunRecord): void;
|
|
94
|
+
/**
|
|
95
|
+
* A run ended. Claims release immediately rather than waiting for their lease
|
|
96
|
+
* (§5): waiting a full lease for a run we KNOW is gone is a stall nobody can
|
|
97
|
+
* explain, and the lease is the backstop for a host that never got the news.
|
|
98
|
+
*/
|
|
99
|
+
endRun(runId: string): void;
|
|
100
|
+
send(input: {
|
|
101
|
+
fromRunId: string;
|
|
102
|
+
toRunId: string;
|
|
103
|
+
text: string;
|
|
104
|
+
}): MessageOutcome;
|
|
105
|
+
/**
|
|
106
|
+
* Delivers queued messages at a turn boundary (§6) and sets the receiving
|
|
107
|
+
* run's cause to the last one, so subsequent work is attributable.
|
|
108
|
+
*/
|
|
109
|
+
deliverTo(runId: string): DeliveredMessage[];
|
|
110
|
+
/** The turn ended; work after this is no longer attributed to that message. */
|
|
111
|
+
endTurn(runId: string): void;
|
|
112
|
+
/**
|
|
113
|
+
* Gate 8: what caused this run's current work, or `undefined` when nothing
|
|
114
|
+
* did.
|
|
115
|
+
*
|
|
116
|
+
* `undefined` rather than a best guess: attributing a change to a message that
|
|
117
|
+
* merely arrived nearby would be an inference presented as a record, and a
|
|
118
|
+
* timeline that does that is worse than one that says nothing.
|
|
119
|
+
*/
|
|
120
|
+
causeFor(runId: string): string | undefined;
|
|
121
|
+
acquireClaim(scope: ClaimScope, runId: string): AcquireClaimResult;
|
|
122
|
+
claims(): Claim[];
|
|
123
|
+
peers(callerRunId: string): PeerDescriptor[];
|
|
124
|
+
runSummary(callerRunId: string, targetRunId: string): RunSummary | undefined;
|
|
125
|
+
setInboundPolicy(runId: string, policy: InboundPolicy): void;
|
|
126
|
+
/** Returns a run to §6's derived default. See `MessageBus.clearInboundPolicy`. */
|
|
127
|
+
clearInboundPolicy(runId: string): void;
|
|
128
|
+
/**
|
|
129
|
+
* What policy a run is under, and whether a human chose it.
|
|
130
|
+
*
|
|
131
|
+
* Both halves, from ONE call, because they are read together and a surface
|
|
132
|
+
* that fetched them separately could render an effective policy against a
|
|
133
|
+
* stale notion of whether it was explicit — the two-reads-one-screen mistake.
|
|
134
|
+
*
|
|
135
|
+
* `effective` is computed against a NAMED peer rather than in the abstract:
|
|
136
|
+
* §6's derivation is comparative, so "what happens to a message" has no answer
|
|
137
|
+
* until you say who sent it. Absent a peer this reports the explicit override
|
|
138
|
+
* only, and says the derivation is what would decide.
|
|
139
|
+
*/
|
|
140
|
+
inboundPolicyFor(runId: string, fromRunId?: string): {
|
|
141
|
+
explicit: InboundPolicy | undefined;
|
|
142
|
+
effective: InboundPolicy | undefined;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Messages withheld from this run, awaiting a human (§6 `hold`).
|
|
146
|
+
*
|
|
147
|
+
* 🔴 Without this and `releaseHeld` below, `hold` was a TRAP. The bus
|
|
148
|
+
* implements the whole lifecycle — set the policy, list what it withheld,
|
|
149
|
+
* release one — and this service exposed only the first third. Anything
|
|
150
|
+
* that set `hold` would have stranded messages where nothing above the bus
|
|
151
|
+
* could see or approve them, which is why nothing ever set it.
|
|
152
|
+
*
|
|
153
|
+
* §6 is explicit that a held message is "surfaced to the human for
|
|
154
|
+
* approval"; a hold nobody can act on is a silent drop with extra steps.
|
|
155
|
+
*/
|
|
156
|
+
heldFor(runId: string): AgentMessage[];
|
|
157
|
+
/**
|
|
158
|
+
* A human approves a held message; it then follows the ordinary queue path.
|
|
159
|
+
*
|
|
160
|
+
* Returns the OUTCOME rather than a boolean, because §6 requires the sender
|
|
161
|
+
* to learn what became of every message — and a release can legitimately
|
|
162
|
+
* find nothing, which is `expired`, not failure.
|
|
163
|
+
*/
|
|
164
|
+
releaseHeld(runId: string, messageId: string): MessageOutcome;
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=CoordinationService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoordinationService.d.ts","sourceRoot":"","sources":["../../src/coordination/CoordinationService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAq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,GAAG,IAAI;IAIvC;;;;;;;;;;;OAWG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG;QACnD,QAAQ,EAAE,aAAa,GAAG,SAAS,CAAA;QACnC,SAAS,EAAE,aAAa,GAAG,SAAS,CAAA;KACrC;IAYD;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,EAAE;IAItC;;;;;;OAMG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,cAAc;CAG9D"}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host's coordination surface — the three primitives as one service.
|
|
3
|
+
*
|
|
4
|
+
* `XENO_AGENT_COORDINATION_SPEC.md` §1 treats message, query and claim as one
|
|
5
|
+
* capability rather than three features, and this is where that becomes true:
|
|
6
|
+
* a claim refusal names the holder so the requester can *message* them, and a
|
|
7
|
+
* message is only actionable because the receiver can *query* what the sender
|
|
8
|
+
* changed. Composed here so no caller has to wire the relationship itself.
|
|
9
|
+
*
|
|
10
|
+
* ## Gate 8 — coordination is visible in the timeline, and causal
|
|
11
|
+
*
|
|
12
|
+
* §9 requires messages and claims to be auditable, and gate 8 requires "a diff
|
|
13
|
+
* can be traced back to the message that caused it". Two halves:
|
|
14
|
+
*
|
|
15
|
+
* 1. Every send, delivery, claim and refusal emits a runtime event, so the
|
|
16
|
+
* timeline shows coordination alongside the work it produced.
|
|
17
|
+
* 2. A delivered message becomes the receiving run's **current cause** until its
|
|
18
|
+
* turn ends. Work the run performs while that cause is set carries the
|
|
19
|
+
* message id, so a diff points at the sentence that prompted it rather than
|
|
20
|
+
* leaving a reader to infer it from timestamps.
|
|
21
|
+
*
|
|
22
|
+
* The second half is the one that is easy to get wrong by making it implicit.
|
|
23
|
+
* Inferring cause from "the message arrived shortly before the edit" is a guess
|
|
24
|
+
* that looks like a fact — and this codebase has spent enough time removing
|
|
25
|
+
* outputs that cannot distinguish a measurement from an assumption.
|
|
26
|
+
*/
|
|
27
|
+
import { ClaimRegistry, describeClaimScope } from './claims.js';
|
|
28
|
+
import { MessageBus, } from './messages.js';
|
|
29
|
+
import { CoordinationQuery } from './query.js';
|
|
30
|
+
export class CoordinationService {
|
|
31
|
+
#claims;
|
|
32
|
+
#bus;
|
|
33
|
+
#query;
|
|
34
|
+
#emit;
|
|
35
|
+
/**
|
|
36
|
+
* The TIMELINE sink, separate from the live feed on purpose.
|
|
37
|
+
*
|
|
38
|
+
* §9 requires the message TEXT on the timeline — *"a reviewer following an id
|
|
39
|
+
* to a message they cannot read has traced a pointer, not a reason"* — while
|
|
40
|
+
* the host's live event feed is stamped `redactionState: 'safe'` and must
|
|
41
|
+
* carry ids and outcomes only. One sink cannot satisfy both, and collapsing
|
|
42
|
+
* them would either put message contents on every subscriber or leave the
|
|
43
|
+
* audit record unreadable. So: two sinks, and the text travels on exactly one.
|
|
44
|
+
*/
|
|
45
|
+
#timeline = () => { };
|
|
46
|
+
/** runId -> the message currently being acted on, for gate-8 attribution. */
|
|
47
|
+
#cause = new Map();
|
|
48
|
+
constructor(options = {}) {
|
|
49
|
+
this.#claims = new ClaimRegistry(options.now === undefined ? {} : { now: options.now });
|
|
50
|
+
// 🔴 The posture resolver is supplied HERE and overrides anything a caller
|
|
51
|
+
// passed, because a run's posture is a fact this service owns: it arrives on
|
|
52
|
+
// the `RunRecord` the host registers. Letting a caller inject its own would
|
|
53
|
+
// create a second source of truth for the input to a safety rule, and the
|
|
54
|
+
// one that decided policy would not be the one the fleet view displays.
|
|
55
|
+
// Reading through a closure rather than a captured value keeps it LIVE — a
|
|
56
|
+
// posture that changes on the next `registerRun` upsert is the posture the
|
|
57
|
+
// next message is judged against.
|
|
58
|
+
this.#bus = new MessageBus({ ...options, posture: (runId) => this.#query.postureOf(runId) });
|
|
59
|
+
this.#query = new CoordinationQuery({
|
|
60
|
+
...(options.maxFiles === undefined ? {} : { maxFiles: options.maxFiles }),
|
|
61
|
+
...(options.maxCommands === undefined ? {} : { maxCommands: options.maxCommands }),
|
|
62
|
+
...(options.canSee === undefined ? {} : { canSee: options.canSee }),
|
|
63
|
+
});
|
|
64
|
+
this.#emit = options.emit ?? (() => { });
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Redirects coordination events after construction.
|
|
68
|
+
*
|
|
69
|
+
* Mirrors `WorkspaceHostService.setEventSink`, and exists for the same
|
|
70
|
+
* reason: the host is constructed with its services, so a sink passed at
|
|
71
|
+
* construction time would have to be built before the host that owns it. A
|
|
72
|
+
* service that can only be wired at construction cannot be mounted onto an
|
|
73
|
+
* existing host at all.
|
|
74
|
+
*
|
|
75
|
+
* Replaces rather than adds. Coordination events are the audit record gate 8
|
|
76
|
+
* rests on, and fanning them to two sinks makes "the timeline" ambiguous
|
|
77
|
+
* exactly where a reader needs it to be singular.
|
|
78
|
+
*/
|
|
79
|
+
setEventSink(emit) {
|
|
80
|
+
this.#emit = emit;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Where coordination goes to become a durable timeline entry.
|
|
84
|
+
*
|
|
85
|
+
* Gate 8 is unusually blunt about the stakes: *"A reviewer looking at a
|
|
86
|
+
* surprising diff must be able to trace it back to the message that prompted
|
|
87
|
+
* it. **If they cannot, this section is not implemented.**"* Without this sink
|
|
88
|
+
* wired, coordination is visible live and absent from the record.
|
|
89
|
+
*/
|
|
90
|
+
setTimelineSink(record) {
|
|
91
|
+
this.#timeline = record;
|
|
92
|
+
}
|
|
93
|
+
#publish(event, text) {
|
|
94
|
+
this.#emit(event);
|
|
95
|
+
this.#timeline(event, text);
|
|
96
|
+
}
|
|
97
|
+
registerRun(record) {
|
|
98
|
+
this.#query.upsertRun(record);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A run ended. Claims release immediately rather than waiting for their lease
|
|
102
|
+
* (§5): waiting a full lease for a run we KNOW is gone is a stall nobody can
|
|
103
|
+
* explain, and the lease is the backstop for a host that never got the news.
|
|
104
|
+
*/
|
|
105
|
+
endRun(runId) {
|
|
106
|
+
const released = this.#claims.releaseRun(runId);
|
|
107
|
+
this.#cause.delete(runId);
|
|
108
|
+
this.#query.removeRun(runId);
|
|
109
|
+
if (released > 0)
|
|
110
|
+
this.#publish({ type: 'coordination.claim.released', runId, released });
|
|
111
|
+
}
|
|
112
|
+
send(input) {
|
|
113
|
+
// A message sent while handling another inherits its chain, so §8 loop
|
|
114
|
+
// detection works without the caller having to thread the id itself — which
|
|
115
|
+
// it would forget exactly when a loop was forming.
|
|
116
|
+
const causedBy = this.#cause.get(input.fromRunId);
|
|
117
|
+
const outcome = this.#bus.send({ ...input, ...(causedBy === undefined ? {} : { causedBy }) });
|
|
118
|
+
this.#publish({
|
|
119
|
+
type: 'coordination.message.sent',
|
|
120
|
+
fromRunId: input.fromRunId,
|
|
121
|
+
toRunId: input.toRunId,
|
|
122
|
+
messageId: outcome.messageId,
|
|
123
|
+
outcome: outcome.status,
|
|
124
|
+
}, input.text);
|
|
125
|
+
return outcome;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Delivers queued messages at a turn boundary (§6) and sets the receiving
|
|
129
|
+
* run's cause to the last one, so subsequent work is attributable.
|
|
130
|
+
*/
|
|
131
|
+
deliverTo(runId) {
|
|
132
|
+
const delivered = this.#bus.drainFor(runId);
|
|
133
|
+
for (const item of delivered) {
|
|
134
|
+
this.#publish({
|
|
135
|
+
type: 'coordination.message.delivered',
|
|
136
|
+
toRunId: runId,
|
|
137
|
+
messageId: item.message.id,
|
|
138
|
+
fromRunId: item.message.fromRunId,
|
|
139
|
+
}, item.message.text);
|
|
140
|
+
}
|
|
141
|
+
const last = delivered.at(-1);
|
|
142
|
+
if (last)
|
|
143
|
+
this.#cause.set(runId, last.message.id);
|
|
144
|
+
return delivered;
|
|
145
|
+
}
|
|
146
|
+
/** The turn ended; work after this is no longer attributed to that message. */
|
|
147
|
+
endTurn(runId) {
|
|
148
|
+
this.#cause.delete(runId);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Gate 8: what caused this run's current work, or `undefined` when nothing
|
|
152
|
+
* did.
|
|
153
|
+
*
|
|
154
|
+
* `undefined` rather than a best guess: attributing a change to a message that
|
|
155
|
+
* merely arrived nearby would be an inference presented as a record, and a
|
|
156
|
+
* timeline that does that is worse than one that says nothing.
|
|
157
|
+
*/
|
|
158
|
+
causeFor(runId) {
|
|
159
|
+
return this.#cause.get(runId);
|
|
160
|
+
}
|
|
161
|
+
acquireClaim(scope, runId) {
|
|
162
|
+
const result = this.#claims.acquire(scope, runId);
|
|
163
|
+
if (result.acquired) {
|
|
164
|
+
this.#publish({
|
|
165
|
+
type: 'coordination.claim.acquired',
|
|
166
|
+
runId,
|
|
167
|
+
scope: result.claim.scope,
|
|
168
|
+
claimId: result.claim.id,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
this.#publish({
|
|
173
|
+
type: 'coordination.claim.refused',
|
|
174
|
+
runId,
|
|
175
|
+
scope,
|
|
176
|
+
heldByRunId: result.heldBy.runId,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
return result;
|
|
180
|
+
}
|
|
181
|
+
claims() {
|
|
182
|
+
return this.#claims.list();
|
|
183
|
+
}
|
|
184
|
+
peers(callerRunId) {
|
|
185
|
+
return this.#query.peers(callerRunId);
|
|
186
|
+
}
|
|
187
|
+
runSummary(callerRunId, targetRunId) {
|
|
188
|
+
return this.#query.runSummary(callerRunId, targetRunId, this.#claims.list());
|
|
189
|
+
}
|
|
190
|
+
setInboundPolicy(runId, policy) {
|
|
191
|
+
this.#bus.setInboundPolicy(runId, policy);
|
|
192
|
+
}
|
|
193
|
+
/** Returns a run to §6's derived default. See `MessageBus.clearInboundPolicy`. */
|
|
194
|
+
clearInboundPolicy(runId) {
|
|
195
|
+
this.#bus.clearInboundPolicy(runId);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* What policy a run is under, and whether a human chose it.
|
|
199
|
+
*
|
|
200
|
+
* Both halves, from ONE call, because they are read together and a surface
|
|
201
|
+
* that fetched them separately could render an effective policy against a
|
|
202
|
+
* stale notion of whether it was explicit — the two-reads-one-screen mistake.
|
|
203
|
+
*
|
|
204
|
+
* `effective` is computed against a NAMED peer rather than in the abstract:
|
|
205
|
+
* §6's derivation is comparative, so "what happens to a message" has no answer
|
|
206
|
+
* until you say who sent it. Absent a peer this reports the explicit override
|
|
207
|
+
* only, and says the derivation is what would decide.
|
|
208
|
+
*/
|
|
209
|
+
inboundPolicyFor(runId, fromRunId) {
|
|
210
|
+
const explicit = this.#bus.explicitPolicyFor(runId);
|
|
211
|
+
if (explicit !== undefined)
|
|
212
|
+
return { explicit, effective: explicit };
|
|
213
|
+
return {
|
|
214
|
+
explicit: undefined,
|
|
215
|
+
// `undefined` rather than a guess: without a sender there is nothing to
|
|
216
|
+
// compare, and reporting the permissive answer here would be the same
|
|
217
|
+
// failure the derivation itself refuses.
|
|
218
|
+
effective: fromRunId === undefined ? undefined : this.#bus.deriveInboundPolicy(fromRunId, runId),
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Messages withheld from this run, awaiting a human (§6 `hold`).
|
|
223
|
+
*
|
|
224
|
+
* 🔴 Without this and `releaseHeld` below, `hold` was a TRAP. The bus
|
|
225
|
+
* implements the whole lifecycle — set the policy, list what it withheld,
|
|
226
|
+
* release one — and this service exposed only the first third. Anything
|
|
227
|
+
* that set `hold` would have stranded messages where nothing above the bus
|
|
228
|
+
* could see or approve them, which is why nothing ever set it.
|
|
229
|
+
*
|
|
230
|
+
* §6 is explicit that a held message is "surfaced to the human for
|
|
231
|
+
* approval"; a hold nobody can act on is a silent drop with extra steps.
|
|
232
|
+
*/
|
|
233
|
+
heldFor(runId) {
|
|
234
|
+
return this.#bus.heldFor(runId);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* A human approves a held message; it then follows the ordinary queue path.
|
|
238
|
+
*
|
|
239
|
+
* Returns the OUTCOME rather than a boolean, because §6 requires the sender
|
|
240
|
+
* to learn what became of every message — and a release can legitimately
|
|
241
|
+
* find nothing, which is `expired`, not failure.
|
|
242
|
+
*/
|
|
243
|
+
releaseHeld(runId, messageId) {
|
|
244
|
+
return this.#bus.releaseHeld(runId, messageId);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=CoordinationService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoordinationService.js","sourceRoot":"","sources":["../../src/coordination/CoordinationService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAwD,MAAM,aAAa,CAAA;AACrH,OAAO,EACL,UAAU,GAMX,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,iBAAiB,EAAwD,MAAM,YAAY,CAAA;AAqBpG,MAAM,OAAO,mBAAmB;IACrB,OAAO,CAAe;IACtB,IAAI,CAAY;IAChB,MAAM,CAAmB;IAClC,KAAK,CAAoC;IACzC;;;;;;;;;OASG;IACH,SAAS,GAAsD,GAAG,EAAE,GAAE,CAAC,CAAA;IACvE,6EAA6E;IACpE,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAA;IAE3C,YAAY,UAAsC,EAAE;QAClD,IAAI,CAAC,OAAO,GAAG,IAAI,aAAa,CAAC,OAAO,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;QACvF,2EAA2E;QAC3E,6EAA6E;QAC7E,4EAA4E;QAC5E,0EAA0E;QAC1E,wEAAwE;QACxE,2EAA2E;QAC3E,2EAA2E;QAC3E,kCAAkC;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,UAAU,CAAC,EAAE,GAAG,OAAO,EAAE,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WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;IAChD,CAAC;CACF"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task claiming — the third coordination primitive.
|
|
3
|
+
*
|
|
4
|
+
* `XENO_AGENT_COORDINATION_SPEC.md` §1 is blunt about why this exists: shared
|
|
5
|
+
* state means another run *could* know something and a message means it *does*,
|
|
6
|
+
* but **neither prevents two agents from starting the same work.** Only a claim
|
|
7
|
+
* does. §5 names the failure it closes: two agents independently rewriting the
|
|
8
|
+
* same module, each with a green suite, producing a merge that is wrong in a way
|
|
9
|
+
* neither could have detected alone.
|
|
10
|
+
*
|
|
11
|
+
* ## Why the host owns this
|
|
12
|
+
*
|
|
13
|
+
* §2.1: overlap is computed by the host **because the host is the only party
|
|
14
|
+
* that sees all runs**. A run cannot arbitrate a claim it cannot observe, and
|
|
15
|
+
* peer-to-peer discovery breaks at the container boundary — which is not a
|
|
16
|
+
* theory, it is Claude Code's own documented limitation, and we sandbox every
|
|
17
|
+
* run. A claim registry that lived in the fleet rather than above it would be
|
|
18
|
+
* unable to answer the one question it exists to answer.
|
|
19
|
+
*
|
|
20
|
+
* ## Scopes are paths, deliberately
|
|
21
|
+
*
|
|
22
|
+
* Spec §13 lists claim granularity as an OPEN DECISION: path, module, or free
|
|
23
|
+
* label. This implements **paths**, which §13 calls "the obvious start and the
|
|
24
|
+
* easiest to compute overlap for". Recorded as a decision rather than left
|
|
25
|
+
* implicit: free labels are more expressive and much harder to arbitrate, and
|
|
26
|
+
* nothing here forecloses adding them behind the same interface.
|
|
27
|
+
*
|
|
28
|
+
* The overlap rule is the same one `xeno-use` applies to sandbox mount targets,
|
|
29
|
+
* and for the same reason — a claim on `src/` must conflict with a claim on
|
|
30
|
+
* `src/app.ts`, or the coarser claim silently means nothing.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* A claim over WORKING TREE CONTENT — the original scope kind, unchanged.
|
|
34
|
+
*
|
|
35
|
+
* `kind` is optional so every existing `{ path }` literal, wire payload and stored claim stays
|
|
36
|
+
* valid. This is a protected host-protocol type; widening it additively is the only shape that
|
|
37
|
+
* does not force every consumer to change on the same commit.
|
|
38
|
+
*/
|
|
39
|
+
export interface PathClaimScope {
|
|
40
|
+
kind?: 'path';
|
|
41
|
+
path: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A claim over a GIT BRANCH — ADE step 5's branch permit.
|
|
45
|
+
*
|
|
46
|
+
* 🔴 This is an EXTENSION of the claim primitive rather than a second subsystem, and that was
|
|
47
|
+
* the whole design decision. The CLI's `waitForBranchPermit` would have arrived in the host
|
|
48
|
+
* carrying its own lease clock, its own expiry, its own release-on-crash path and its own audit
|
|
49
|
+
* trail — four things `ClaimRegistry` already does, and would then do twice, differently.
|
|
50
|
+
* Coordination §1 already names claim as one of the three primitives; a branch permit IS a
|
|
51
|
+
* claim whose unit of work happens not to be a path.
|
|
52
|
+
*/
|
|
53
|
+
export interface BranchClaimScope {
|
|
54
|
+
kind: 'branch';
|
|
55
|
+
branch: string;
|
|
56
|
+
}
|
|
57
|
+
export type ClaimScope = PathClaimScope | BranchClaimScope;
|
|
58
|
+
export declare function isBranchScope(scope: ClaimScope): scope is BranchClaimScope;
|
|
59
|
+
/** Canonical form for storage, so `refs/heads/x` and `x` cannot both be held. */
|
|
60
|
+
export declare function normalizeClaimScope(scope: ClaimScope): ClaimScope;
|
|
61
|
+
/** A stable one-line rendering for events and diagnostics. */
|
|
62
|
+
export declare function describeClaimScope(scope: ClaimScope): string;
|
|
63
|
+
export interface Claim {
|
|
64
|
+
id: string;
|
|
65
|
+
scope: ClaimScope;
|
|
66
|
+
runId: string;
|
|
67
|
+
acquiredAt: number;
|
|
68
|
+
/** Leases expire so a crashed run cannot deadlock the fleet (§5). */
|
|
69
|
+
expiresAt: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* §5: "A refused claim returns WHO HOLDS IT, so the requesting agent can message
|
|
73
|
+
* that run rather than spin or silently proceed." A bare `false` would leave the
|
|
74
|
+
* caller with exactly the two behaviours the spec is trying to prevent.
|
|
75
|
+
*/
|
|
76
|
+
export type AcquireClaimResult = {
|
|
77
|
+
acquired: true;
|
|
78
|
+
claim: Claim;
|
|
79
|
+
} | {
|
|
80
|
+
acquired: false;
|
|
81
|
+
heldBy: Claim;
|
|
82
|
+
};
|
|
83
|
+
export interface ClaimRegistryOptions {
|
|
84
|
+
/** Injected so lease expiry is deterministic in tests rather than wall-clock. */
|
|
85
|
+
now?: () => number;
|
|
86
|
+
leaseMs?: number;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Two scopes overlap when they name the same work or one contains the other.
|
|
90
|
+
*
|
|
91
|
+
* The containment half is what makes a coarse claim mean anything: without it a
|
|
92
|
+
* run holding `src/` would not conflict with a run holding `src/app.ts`, and the
|
|
93
|
+
* coarse claim would be decorative. Compared segment-wise so `src` does not
|
|
94
|
+
* swallow `srcgen` — the same prefix-boundary bug that widens a scoped grant.
|
|
95
|
+
*/
|
|
96
|
+
export declare function scopesOverlap(a: ClaimScope, b: ClaimScope): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Host-held claim registry.
|
|
99
|
+
*
|
|
100
|
+
* Advisory to the agent, authoritative to the human (§5): a refusal tells the
|
|
101
|
+
* requester who holds the scope so it can coordinate, and the fleet view shows
|
|
102
|
+
* the collision before it becomes a merge.
|
|
103
|
+
*/
|
|
104
|
+
export declare class ClaimRegistry {
|
|
105
|
+
#private;
|
|
106
|
+
constructor(options?: ClaimRegistryOptions);
|
|
107
|
+
/** Live claims, expired ones already removed. */
|
|
108
|
+
list(): Claim[];
|
|
109
|
+
acquire(scope: ClaimScope, runId: string): AcquireClaimResult;
|
|
110
|
+
/** Extends a live lease. Returns false when it has already lapsed. */
|
|
111
|
+
renew(claimId: string): boolean;
|
|
112
|
+
release(claimId: string): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* §5: "released automatically when a run terminates. A crashed run must never
|
|
115
|
+
* deadlock the fleet." Called by the host on run termination — the expiry
|
|
116
|
+
* sweep is the backstop for a host that never got the news, not the primary
|
|
117
|
+
* path, because waiting a full lease for a run we KNOW is gone is a stall
|
|
118
|
+
* nobody can explain.
|
|
119
|
+
*/
|
|
120
|
+
releaseRun(runId: string): number;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=claims.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claims.d.ts","sourceRoot":"","sources":["../../src/coordination/claims.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAgBH;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,QAAQ,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,gBAAgB,CAAA;AAE1D,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,IAAI,gBAAgB,CAE1E;AAcD,iFAAiF;AACjF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAIjE;AAED,8DAA8D;AAC9D,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAI5D;AAED,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,UAAU,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IAAE,QAAQ,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GACh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