@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,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent-to-agent messages — the push half of coordination.
|
|
3
|
+
*
|
|
4
|
+
* `XENO_AGENT_COORDINATION_SPEC.md` §2.1: every message travels **run → host →
|
|
5
|
+
* run**. Runs never address each other directly, discover each other through the
|
|
6
|
+
* filesystem, or hold sockets for one another. That is a deliberate divergence
|
|
7
|
+
* from Claude Code's per-session Unix socket plus filesystem discovery — the
|
|
8
|
+
* right design for its constraints, and unusable for ours, because **we sandbox
|
|
9
|
+
* every run** and its own documentation states a container's filesystem cannot
|
|
10
|
+
* reach a session outside it. Copying it would make our isolation defeat our
|
|
11
|
+
* coordination.
|
|
12
|
+
*
|
|
13
|
+
* ## The safety model is structural, not advisory
|
|
14
|
+
*
|
|
15
|
+
* §4 requires every safety rule to be "enforced by the host, not by convention
|
|
16
|
+
* in a prompt". The strongest form of that is to make the unsafe thing
|
|
17
|
+
* **unrepresentable**, which §2.3 already does most of: a message carries
|
|
18
|
+
* *plain text and nothing else* — never conversation history, never files, never
|
|
19
|
+
* structured context, never tool results.
|
|
20
|
+
*
|
|
21
|
+
* So a message cannot carry an action, a tool call, a permission grant or a
|
|
22
|
+
* config change, because there is no field for one. `DeliveredMessage` is also a
|
|
23
|
+
* DISTINCT TYPE from a user turn, so code that consumes consent cannot be handed
|
|
24
|
+
* one by mistake:
|
|
25
|
+
*
|
|
26
|
+
* > "These rules make agent-to-agent messaging strictly weaker than a user
|
|
27
|
+
* > prompt, and that asymmetry is the entire safety argument. Any future
|
|
28
|
+
* > capability that lets a message do something a user prompt can do is a change
|
|
29
|
+
* > to this spec, not an enhancement."
|
|
30
|
+
*
|
|
31
|
+
* The temptation §2.3 names — *"we have a host, we could send the whole
|
|
32
|
+
* context"* — is the one to resist: forcing the sender to compress a finding
|
|
33
|
+
* into a sentence **is** the value, because a run that must summarise has done
|
|
34
|
+
* the reader's thinking for it.
|
|
35
|
+
*/
|
|
36
|
+
export type TurnSource = 'user' | 'agent-message';
|
|
37
|
+
/** A message in flight. Text and addressing only — see §2.3. */
|
|
38
|
+
export interface AgentMessage {
|
|
39
|
+
id: string;
|
|
40
|
+
fromRunId: string;
|
|
41
|
+
toRunId: string;
|
|
42
|
+
/** Plain text. There is deliberately no payload field to grow. */
|
|
43
|
+
text: string;
|
|
44
|
+
sentAt: number;
|
|
45
|
+
/**
|
|
46
|
+
* The message this one answers, when it was sent while handling another.
|
|
47
|
+
* Present so the host can bound a cycle (§8) without inspecting content.
|
|
48
|
+
*/
|
|
49
|
+
causedBy?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A message as the receiver sees it.
|
|
53
|
+
*
|
|
54
|
+
* `source` is `'agent-message'` and cannot be `'user'`. That single field is why
|
|
55
|
+
* gate 2 holds: consent-consuming code accepts `TurnSource extends 'user'`, so a
|
|
56
|
+
* delivered message is rejected by the type system before any runtime check.
|
|
57
|
+
*/
|
|
58
|
+
export interface DeliveredMessage {
|
|
59
|
+
readonly source: 'agent-message';
|
|
60
|
+
readonly message: AgentMessage;
|
|
61
|
+
readonly deliveredAt: number;
|
|
62
|
+
}
|
|
63
|
+
/** §6: three outcomes, and the sender learns which (gate 10). */
|
|
64
|
+
export type InboundPolicy = 'accept' | 'hold' | 'refuse';
|
|
65
|
+
/**
|
|
66
|
+
* The capabilities a run is executing with — its permission posture.
|
|
67
|
+
*
|
|
68
|
+
* Mirrors `AgentTurnExecutionOptions['capabilities']` and is deliberately NOT
|
|
69
|
+
* imported from the contract: this module has zero imports on purpose (see the
|
|
70
|
+
* header). `runPostureKeysMatchContract` in the test suite fails if the two ever
|
|
71
|
+
* drift, which is the check that keeps a hand-mirrored list honest — a
|
|
72
|
+
* capability added to the contract and not here would be silently ignored by
|
|
73
|
+
* the comparison below, i.e. it would widen what counts as "not upward".
|
|
74
|
+
*/
|
|
75
|
+
export declare const RUN_CAPABILITY_KEYS: readonly ["terminal", "browser", "fileRead", "fileWrite", "appLaunch", "webSearch"];
|
|
76
|
+
export type RunCapability = (typeof RUN_CAPABILITY_KEYS)[number];
|
|
77
|
+
/** Derived from the ONE array above, so the list and the type cannot disagree. */
|
|
78
|
+
export type RunPosture = {
|
|
79
|
+
readonly [K in RunCapability]?: boolean;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* §6: **a message never moves trust upward.**
|
|
83
|
+
*
|
|
84
|
+
* The spec's default is COMPARATIVE, not a per-run flag — "a run operating with
|
|
85
|
+
* elevated autonomy is a *sender* whose messages are held for a more constrained
|
|
86
|
+
* receiver". So the question is not "how much" autonomy either side has; it is
|
|
87
|
+
* whether the sender holds anything the receiver does not.
|
|
88
|
+
*
|
|
89
|
+
* The honest comparison over a capability SET is therefore SUBSET, never a
|
|
90
|
+
* score. A numeric trust level would have to rank `terminal` against
|
|
91
|
+
* `fileWrite`, and nothing in the spec licenses that ordering — inventing one
|
|
92
|
+
* would be this module asserting a policy the spec never states.
|
|
93
|
+
*
|
|
94
|
+
* Absent is not `false` by accident: an undeclared capability is one the run is
|
|
95
|
+
* not executing with, so `undefined` and `false` are the same answer to "may it
|
|
96
|
+
* do this", and only `true` on the sender's side can move trust.
|
|
97
|
+
*/
|
|
98
|
+
export declare function movesTrustUpward(sender: RunPosture, receiver: RunPosture): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* What a derivation resolves to when a posture is UNKNOWN.
|
|
101
|
+
*
|
|
102
|
+
* 🔴 Named, not silent, and deliberately `accept` — the same distinction
|
|
103
|
+
* `RunRecord.complete` exists to preserve: unknown must not masquerade as a
|
|
104
|
+
* measured answer. Holding instead would be the stricter choice, and it is the
|
|
105
|
+
* wrong one HERE: no run carried a posture before this change, so an unknown
|
|
106
|
+
* posture is the ordinary case during rollout, and defaulting it to `hold`
|
|
107
|
+
* would silently route every coordination message in the product to a human
|
|
108
|
+
* approval queue. The rule becomes real for a pair the moment both postures are
|
|
109
|
+
* known; until then this preserves shipped behaviour, visibly.
|
|
110
|
+
*/
|
|
111
|
+
export declare const UNKNOWN_POSTURE_POLICY: InboundPolicy;
|
|
112
|
+
export type MessageOutcome = {
|
|
113
|
+
status: 'delivered';
|
|
114
|
+
messageId: string;
|
|
115
|
+
at: number;
|
|
116
|
+
} | {
|
|
117
|
+
status: 'held';
|
|
118
|
+
messageId: string;
|
|
119
|
+
reason: string;
|
|
120
|
+
} | {
|
|
121
|
+
status: 'refused';
|
|
122
|
+
messageId: string;
|
|
123
|
+
reason: string;
|
|
124
|
+
} | {
|
|
125
|
+
status: 'expired';
|
|
126
|
+
messageId: string;
|
|
127
|
+
reason: string;
|
|
128
|
+
};
|
|
129
|
+
export interface MessageBusOptions {
|
|
130
|
+
now?: () => number;
|
|
131
|
+
/** §8 rate limit: messages one sender may emit per window. */
|
|
132
|
+
maxPerSenderPerWindow?: number;
|
|
133
|
+
windowMs?: number;
|
|
134
|
+
/** §8: cap on undelivered messages per run; oldest dropped past the cap. */
|
|
135
|
+
maxQueuedPerRun?: number;
|
|
136
|
+
/** §8: a separate cap on held messages. */
|
|
137
|
+
maxHeldPerRun?: number;
|
|
138
|
+
/** §8 loop detection: how deep a causal chain may run before it is refused. */
|
|
139
|
+
maxChainDepth?: number;
|
|
140
|
+
/**
|
|
141
|
+
* Resolves a run's permission posture — §6's derivation input.
|
|
142
|
+
*
|
|
143
|
+
* A PORT rather than a registry reference: the bus decides policy and must not
|
|
144
|
+
* also own where runs are recorded. Absent, or returning `undefined` for a run
|
|
145
|
+
* it has never heard of, is a legitimate answer and resolves to
|
|
146
|
+
* {@link UNKNOWN_POSTURE_POLICY}.
|
|
147
|
+
*/
|
|
148
|
+
posture?: (runId: string) => RunPosture | undefined;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Answers whether a turn's text may satisfy consent.
|
|
152
|
+
*
|
|
153
|
+
* Exported so the rule lives in ONE place rather than being re-derived at each
|
|
154
|
+
* permission gate. §4.1: a message "cannot answer a pending permission prompt,
|
|
155
|
+
* approve a tool call, or satisfy an approval gate".
|
|
156
|
+
*/
|
|
157
|
+
export declare function canSatisfyConsent(source: TurnSource): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Host-mediated message bus.
|
|
160
|
+
*
|
|
161
|
+
* Holds no sockets and performs no discovery: every operation is a host call, so
|
|
162
|
+
* two runs in separate sandboxes exchange messages by construction (gate 1) —
|
|
163
|
+
* the gate that fails for filesystem-discovery designs.
|
|
164
|
+
*/
|
|
165
|
+
export declare class MessageBus {
|
|
166
|
+
#private;
|
|
167
|
+
constructor(options?: MessageBusOptions);
|
|
168
|
+
setInboundPolicy(runId: string, policy: InboundPolicy): void;
|
|
169
|
+
/**
|
|
170
|
+
* Drops the explicit override, returning the run to §6's derived default.
|
|
171
|
+
*
|
|
172
|
+
* Without this, setting a policy is a ONE-WAY DOOR: a human who pins `accept`
|
|
173
|
+
* during an incident can never hand the decision back to the rule, and the
|
|
174
|
+
* safest posture becomes the one nobody dares leave. Clearing is not the same
|
|
175
|
+
* as setting `accept` — one restores the derivation, the other overrides it
|
|
176
|
+
* permanently in the permissive direction.
|
|
177
|
+
*/
|
|
178
|
+
clearInboundPolicy(runId: string): void;
|
|
179
|
+
/**
|
|
180
|
+
* The explicit override for a run, or `undefined` when the derivation answers.
|
|
181
|
+
*
|
|
182
|
+
* A surface needs BOTH this and the effective policy: showing only the
|
|
183
|
+
* effective one leaves a person unable to tell a decision they made from a
|
|
184
|
+
* decision the rule made, and those are undone differently.
|
|
185
|
+
*/
|
|
186
|
+
explicitPolicyFor(runId: string): InboundPolicy | undefined;
|
|
187
|
+
/**
|
|
188
|
+
* §6's derived default — used only when no explicit policy was set.
|
|
189
|
+
*
|
|
190
|
+
* Exposed so a surface can explain *why* a message was held without
|
|
191
|
+
* re-deriving the rule from the two postures itself, which is how a second,
|
|
192
|
+
* subtly different spelling of a safety rule gets written.
|
|
193
|
+
*/
|
|
194
|
+
deriveInboundPolicy(fromRunId: string, toRunId: string): InboundPolicy;
|
|
195
|
+
/**
|
|
196
|
+
* Sends a message and returns its outcome.
|
|
197
|
+
*
|
|
198
|
+
* Returns rather than resolves-later on purpose: §6 requires the sender to
|
|
199
|
+
* learn "delivered, held, denied or expired" in EVERY case, so an agent is
|
|
200
|
+
* never left assuming a message landed. A fire-and-forget signature would make
|
|
201
|
+
* that impossible to honour at the type level.
|
|
202
|
+
*/
|
|
203
|
+
send(input: {
|
|
204
|
+
fromRunId: string;
|
|
205
|
+
toRunId: string;
|
|
206
|
+
text: string;
|
|
207
|
+
causedBy?: string;
|
|
208
|
+
}): MessageOutcome;
|
|
209
|
+
/**
|
|
210
|
+
* Takes everything queued for a run.
|
|
211
|
+
*
|
|
212
|
+
* §6: delivery happens at a turn boundary or between tool calls — "a running
|
|
213
|
+
* tool is never interrupted mid-execution". The host calls this at those
|
|
214
|
+
* points; the bus does not push, so it cannot interrupt anything.
|
|
215
|
+
*
|
|
216
|
+
* Every message comes back tagged `source: 'agent-message'`, which is what
|
|
217
|
+
* keeps a delivered message from being mistaken for user input downstream.
|
|
218
|
+
*/
|
|
219
|
+
drainFor(runId: string): DeliveredMessage[];
|
|
220
|
+
/** Messages withheld for human approval (§6 `hold`). */
|
|
221
|
+
heldFor(runId: string): AgentMessage[];
|
|
222
|
+
/** A human releases a held message; it then follows the normal queue path. */
|
|
223
|
+
releaseHeld(runId: string, messageId: string): MessageOutcome;
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/coordination/messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAgBH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,eAAe,CAAA;AAEjD,gEAAgE;AAChE,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;IAChC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAA;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC7B;AAED,iEAAiE;AACjE,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAA;AAExD;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAm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AK,UAAU,GAAG,SAAS,CAAA;CACpD;AAUD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAE7D;AAED;;;;;;GAMG;AACH,qBAAa,UAAU;;gBAyBT,OAAO,GAAE,iBAAsB;IAY3C,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI;IAI5D;;;;;;;;OAQG;IACH,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIvC;;;;;;OAMG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAI3D;;;;;;OAMG;IACH,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa;IAWtE;;;;;;;OAOG;IACH,IAAI,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,cAAc;IAyFpG;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,EAAE;IAO3C,wDAAwD;IACxD,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,EAAE;IAItC,8EAA8E;IAC9E,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,cAAc;CAqB9D"}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent-to-agent messages — the push half of coordination.
|
|
3
|
+
*
|
|
4
|
+
* `XENO_AGENT_COORDINATION_SPEC.md` §2.1: every message travels **run → host →
|
|
5
|
+
* run**. Runs never address each other directly, discover each other through the
|
|
6
|
+
* filesystem, or hold sockets for one another. That is a deliberate divergence
|
|
7
|
+
* from Claude Code's per-session Unix socket plus filesystem discovery — the
|
|
8
|
+
* right design for its constraints, and unusable for ours, because **we sandbox
|
|
9
|
+
* every run** and its own documentation states a container's filesystem cannot
|
|
10
|
+
* reach a session outside it. Copying it would make our isolation defeat our
|
|
11
|
+
* coordination.
|
|
12
|
+
*
|
|
13
|
+
* ## The safety model is structural, not advisory
|
|
14
|
+
*
|
|
15
|
+
* §4 requires every safety rule to be "enforced by the host, not by convention
|
|
16
|
+
* in a prompt". The strongest form of that is to make the unsafe thing
|
|
17
|
+
* **unrepresentable**, which §2.3 already does most of: a message carries
|
|
18
|
+
* *plain text and nothing else* — never conversation history, never files, never
|
|
19
|
+
* structured context, never tool results.
|
|
20
|
+
*
|
|
21
|
+
* So a message cannot carry an action, a tool call, a permission grant or a
|
|
22
|
+
* config change, because there is no field for one. `DeliveredMessage` is also a
|
|
23
|
+
* DISTINCT TYPE from a user turn, so code that consumes consent cannot be handed
|
|
24
|
+
* one by mistake:
|
|
25
|
+
*
|
|
26
|
+
* > "These rules make agent-to-agent messaging strictly weaker than a user
|
|
27
|
+
* > prompt, and that asymmetry is the entire safety argument. Any future
|
|
28
|
+
* > capability that lets a message do something a user prompt can do is a change
|
|
29
|
+
* > to this spec, not an enhancement."
|
|
30
|
+
*
|
|
31
|
+
* The temptation §2.3 names — *"we have a host, we could send the whole
|
|
32
|
+
* context"* — is the one to resist: forcing the sender to compress a finding
|
|
33
|
+
* into a sentence **is** the value, because a run that must summarise has done
|
|
34
|
+
* the reader's thinking for it.
|
|
35
|
+
*/
|
|
36
|
+
/** Where a turn's text came from. The discriminant the safety model rests on. */
|
|
37
|
+
/**
|
|
38
|
+
* A short unique id, without a Node dependency.
|
|
39
|
+
*
|
|
40
|
+
* `packages/host`'s portable entry (`index.ts`) has ZERO `node:` imports by
|
|
41
|
+
* design — it is the half that must run outside a Node host — and coordination
|
|
42
|
+
* is provider-neutral rules, so it belongs there rather than behind `./node`.
|
|
43
|
+
* `crypto.randomUUID` is Web Crypto, available in Node 20+ (this package's
|
|
44
|
+
* floor) and every modern browser, so the portability costs nothing.
|
|
45
|
+
*/
|
|
46
|
+
function shortId(prefix) {
|
|
47
|
+
return `${prefix}_${globalThis.crypto.randomUUID().replaceAll('-', '').slice(0, 16)}`;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The capabilities a run is executing with — its permission posture.
|
|
51
|
+
*
|
|
52
|
+
* Mirrors `AgentTurnExecutionOptions['capabilities']` and is deliberately NOT
|
|
53
|
+
* imported from the contract: this module has zero imports on purpose (see the
|
|
54
|
+
* header). `runPostureKeysMatchContract` in the test suite fails if the two ever
|
|
55
|
+
* drift, which is the check that keeps a hand-mirrored list honest — a
|
|
56
|
+
* capability added to the contract and not here would be silently ignored by
|
|
57
|
+
* the comparison below, i.e. it would widen what counts as "not upward".
|
|
58
|
+
*/
|
|
59
|
+
export const RUN_CAPABILITY_KEYS = [
|
|
60
|
+
'terminal',
|
|
61
|
+
'browser',
|
|
62
|
+
'fileRead',
|
|
63
|
+
'fileWrite',
|
|
64
|
+
'appLaunch',
|
|
65
|
+
'webSearch',
|
|
66
|
+
];
|
|
67
|
+
/**
|
|
68
|
+
* §6: **a message never moves trust upward.**
|
|
69
|
+
*
|
|
70
|
+
* The spec's default is COMPARATIVE, not a per-run flag — "a run operating with
|
|
71
|
+
* elevated autonomy is a *sender* whose messages are held for a more constrained
|
|
72
|
+
* receiver". So the question is not "how much" autonomy either side has; it is
|
|
73
|
+
* whether the sender holds anything the receiver does not.
|
|
74
|
+
*
|
|
75
|
+
* The honest comparison over a capability SET is therefore SUBSET, never a
|
|
76
|
+
* score. A numeric trust level would have to rank `terminal` against
|
|
77
|
+
* `fileWrite`, and nothing in the spec licenses that ordering — inventing one
|
|
78
|
+
* would be this module asserting a policy the spec never states.
|
|
79
|
+
*
|
|
80
|
+
* Absent is not `false` by accident: an undeclared capability is one the run is
|
|
81
|
+
* not executing with, so `undefined` and `false` are the same answer to "may it
|
|
82
|
+
* do this", and only `true` on the sender's side can move trust.
|
|
83
|
+
*/
|
|
84
|
+
export function movesTrustUpward(sender, receiver) {
|
|
85
|
+
return RUN_CAPABILITY_KEYS.some((key) => sender[key] === true && receiver[key] !== true);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* What a derivation resolves to when a posture is UNKNOWN.
|
|
89
|
+
*
|
|
90
|
+
* 🔴 Named, not silent, and deliberately `accept` — the same distinction
|
|
91
|
+
* `RunRecord.complete` exists to preserve: unknown must not masquerade as a
|
|
92
|
+
* measured answer. Holding instead would be the stricter choice, and it is the
|
|
93
|
+
* wrong one HERE: no run carried a posture before this change, so an unknown
|
|
94
|
+
* posture is the ordinary case during rollout, and defaulting it to `hold`
|
|
95
|
+
* would silently route every coordination message in the product to a human
|
|
96
|
+
* approval queue. The rule becomes real for a pair the moment both postures are
|
|
97
|
+
* known; until then this preserves shipped behaviour, visibly.
|
|
98
|
+
*/
|
|
99
|
+
export const UNKNOWN_POSTURE_POLICY = 'accept';
|
|
100
|
+
const DEFAULTS = {
|
|
101
|
+
maxPerSenderPerWindow: 20,
|
|
102
|
+
windowMs: 60_000,
|
|
103
|
+
maxQueuedPerRun: 50,
|
|
104
|
+
maxHeldPerRun: 20,
|
|
105
|
+
maxChainDepth: 8,
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Answers whether a turn's text may satisfy consent.
|
|
109
|
+
*
|
|
110
|
+
* Exported so the rule lives in ONE place rather than being re-derived at each
|
|
111
|
+
* permission gate. §4.1: a message "cannot answer a pending permission prompt,
|
|
112
|
+
* approve a tool call, or satisfy an approval gate".
|
|
113
|
+
*/
|
|
114
|
+
export function canSatisfyConsent(source) {
|
|
115
|
+
return source === 'user';
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Host-mediated message bus.
|
|
119
|
+
*
|
|
120
|
+
* Holds no sockets and performs no discovery: every operation is a host call, so
|
|
121
|
+
* two runs in separate sandboxes exchange messages by construction (gate 1) —
|
|
122
|
+
* the gate that fails for filesystem-discovery designs.
|
|
123
|
+
*/
|
|
124
|
+
export class MessageBus {
|
|
125
|
+
#now;
|
|
126
|
+
#options;
|
|
127
|
+
#posture;
|
|
128
|
+
/**
|
|
129
|
+
* Per-run inbound policy — an EXPLICIT override only.
|
|
130
|
+
*
|
|
131
|
+
* §6 says defaults derive from permission posture, and until this map was
|
|
132
|
+
* given a derivation behind it that sentence was false: nothing ever called
|
|
133
|
+
* `setInboundPolicy`, so every run fell through to a hardcoded `accept` — the
|
|
134
|
+
* most permissive of the three — and "a message never moves trust upward" was
|
|
135
|
+
* enforced nowhere. An entry here now means somebody *decided*; absence means
|
|
136
|
+
* {@link deriveInboundPolicy} answers.
|
|
137
|
+
*/
|
|
138
|
+
#policy = new Map();
|
|
139
|
+
#queues = new Map();
|
|
140
|
+
#held = new Map();
|
|
141
|
+
/** Send timestamps per sender, for the §8 rate limit. */
|
|
142
|
+
#sendLog = new Map();
|
|
143
|
+
/** Recent `from|to|text` fingerprints, for §8 deduplication. */
|
|
144
|
+
#recent = new Map();
|
|
145
|
+
/** messageId -> causal depth, so a cycle is bounded without reading content. */
|
|
146
|
+
#depth = new Map();
|
|
147
|
+
constructor(options = {}) {
|
|
148
|
+
this.#now = options.now ?? Date.now;
|
|
149
|
+
this.#options = {
|
|
150
|
+
maxPerSenderPerWindow: options.maxPerSenderPerWindow ?? DEFAULTS.maxPerSenderPerWindow,
|
|
151
|
+
windowMs: options.windowMs ?? DEFAULTS.windowMs,
|
|
152
|
+
maxQueuedPerRun: options.maxQueuedPerRun ?? DEFAULTS.maxQueuedPerRun,
|
|
153
|
+
maxHeldPerRun: options.maxHeldPerRun ?? DEFAULTS.maxHeldPerRun,
|
|
154
|
+
maxChainDepth: options.maxChainDepth ?? DEFAULTS.maxChainDepth,
|
|
155
|
+
};
|
|
156
|
+
this.#posture = options.posture;
|
|
157
|
+
}
|
|
158
|
+
setInboundPolicy(runId, policy) {
|
|
159
|
+
this.#policy.set(runId, policy);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Drops the explicit override, returning the run to §6's derived default.
|
|
163
|
+
*
|
|
164
|
+
* Without this, setting a policy is a ONE-WAY DOOR: a human who pins `accept`
|
|
165
|
+
* during an incident can never hand the decision back to the rule, and the
|
|
166
|
+
* safest posture becomes the one nobody dares leave. Clearing is not the same
|
|
167
|
+
* as setting `accept` — one restores the derivation, the other overrides it
|
|
168
|
+
* permanently in the permissive direction.
|
|
169
|
+
*/
|
|
170
|
+
clearInboundPolicy(runId) {
|
|
171
|
+
this.#policy.delete(runId);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* The explicit override for a run, or `undefined` when the derivation answers.
|
|
175
|
+
*
|
|
176
|
+
* A surface needs BOTH this and the effective policy: showing only the
|
|
177
|
+
* effective one leaves a person unable to tell a decision they made from a
|
|
178
|
+
* decision the rule made, and those are undone differently.
|
|
179
|
+
*/
|
|
180
|
+
explicitPolicyFor(runId) {
|
|
181
|
+
return this.#policy.get(runId);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* §6's derived default — used only when no explicit policy was set.
|
|
185
|
+
*
|
|
186
|
+
* Exposed so a surface can explain *why* a message was held without
|
|
187
|
+
* re-deriving the rule from the two postures itself, which is how a second,
|
|
188
|
+
* subtly different spelling of a safety rule gets written.
|
|
189
|
+
*/
|
|
190
|
+
deriveInboundPolicy(fromRunId, toRunId) {
|
|
191
|
+
const resolve = this.#posture;
|
|
192
|
+
if (!resolve)
|
|
193
|
+
return UNKNOWN_POSTURE_POLICY;
|
|
194
|
+
const sender = resolve(fromRunId);
|
|
195
|
+
const receiver = resolve(toRunId);
|
|
196
|
+
// Either side unknown: the comparison cannot be made, and a comparison that
|
|
197
|
+
// cannot be made must not report the permissive answer as though it had been.
|
|
198
|
+
if (!sender || !receiver)
|
|
199
|
+
return UNKNOWN_POSTURE_POLICY;
|
|
200
|
+
return movesTrustUpward(sender, receiver) ? 'hold' : 'accept';
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Sends a message and returns its outcome.
|
|
204
|
+
*
|
|
205
|
+
* Returns rather than resolves-later on purpose: §6 requires the sender to
|
|
206
|
+
* learn "delivered, held, denied or expired" in EVERY case, so an agent is
|
|
207
|
+
* never left assuming a message landed. A fire-and-forget signature would make
|
|
208
|
+
* that impossible to honour at the type level.
|
|
209
|
+
*/
|
|
210
|
+
send(input) {
|
|
211
|
+
const at = this.#now();
|
|
212
|
+
const id = shortId('msg');
|
|
213
|
+
// §8 loop detection. Bounded by CAUSAL DEPTH rather than by inspecting text,
|
|
214
|
+
// because two runs can loop forever with different wording every time.
|
|
215
|
+
const depth = input.causedBy ? (this.#depth.get(input.causedBy) ?? 0) + 1 : 0;
|
|
216
|
+
if (depth > this.#options.maxChainDepth) {
|
|
217
|
+
return {
|
|
218
|
+
status: 'refused',
|
|
219
|
+
messageId: id,
|
|
220
|
+
reason: `message chain exceeded ${this.#options.maxChainDepth} hops; a cycle must terminate without human intervention`,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
// §8 rate limit per sender.
|
|
224
|
+
const sent = (this.#sendLog.get(input.fromRunId) ?? []).filter((stamp) => at - stamp < this.#options.windowMs);
|
|
225
|
+
if (sent.length >= this.#options.maxPerSenderPerWindow) {
|
|
226
|
+
this.#sendLog.set(input.fromRunId, sent);
|
|
227
|
+
return {
|
|
228
|
+
status: 'refused',
|
|
229
|
+
messageId: id,
|
|
230
|
+
reason: `sender exceeded ${this.#options.maxPerSenderPerWindow} messages per ${this.#options.windowMs} ms`,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
// §8 deduplication of identical messages within the window.
|
|
234
|
+
const fingerprint = `${input.fromRunId}|${input.toRunId}|${input.text}`;
|
|
235
|
+
const lastSeen = this.#recent.get(fingerprint);
|
|
236
|
+
if (lastSeen !== undefined && at - lastSeen < this.#options.windowMs) {
|
|
237
|
+
return { status: 'refused', messageId: id, reason: 'duplicate message within the dedup window' };
|
|
238
|
+
}
|
|
239
|
+
const message = {
|
|
240
|
+
id,
|
|
241
|
+
fromRunId: input.fromRunId,
|
|
242
|
+
toRunId: input.toRunId,
|
|
243
|
+
text: input.text,
|
|
244
|
+
sentAt: at,
|
|
245
|
+
// Only present when this message answers another. An always-present
|
|
246
|
+
// `causedBy: undefined` would put a key on every message that a reviewer
|
|
247
|
+
// has to think about, and §2.3's whole point is that there is nothing on a
|
|
248
|
+
// message to think about beyond its text.
|
|
249
|
+
...(input.causedBy === undefined ? {} : { causedBy: input.causedBy }),
|
|
250
|
+
};
|
|
251
|
+
this.#depth.set(id, depth);
|
|
252
|
+
sent.push(at);
|
|
253
|
+
this.#sendLog.set(input.fromRunId, sent);
|
|
254
|
+
this.#recent.set(fingerprint, at);
|
|
255
|
+
// An explicit policy WINS: `setInboundPolicy` is somebody's decision, and a
|
|
256
|
+
// derivation must not overrule it in either direction. Only its absence
|
|
257
|
+
// reaches §6's default.
|
|
258
|
+
const explicit = this.#policy.get(input.toRunId);
|
|
259
|
+
const policy = explicit ?? this.deriveInboundPolicy(input.fromRunId, input.toRunId);
|
|
260
|
+
if (policy === 'refuse') {
|
|
261
|
+
return { status: 'refused', messageId: id, reason: 'receiver inbound policy refuses this sender' };
|
|
262
|
+
}
|
|
263
|
+
if (policy === 'hold') {
|
|
264
|
+
const held = this.#held.get(input.toRunId) ?? [];
|
|
265
|
+
if (held.length >= this.#options.maxHeldPerRun) {
|
|
266
|
+
return { status: 'refused', messageId: id, reason: 'receiver hold queue is full' };
|
|
267
|
+
}
|
|
268
|
+
held.push(message);
|
|
269
|
+
this.#held.set(input.toRunId, held);
|
|
270
|
+
// Distinct reasons because the two holds are different facts, and §6
|
|
271
|
+
// requires the SENDER to learn the outcome: "a human has not approved this
|
|
272
|
+
// yet" and "you hold capabilities the receiver does not" are answers a
|
|
273
|
+
// sending agent would act on differently.
|
|
274
|
+
return {
|
|
275
|
+
status: 'held',
|
|
276
|
+
messageId: id,
|
|
277
|
+
reason: explicit === undefined
|
|
278
|
+
? 'sender holds capabilities the receiver does not; a message never moves trust upward'
|
|
279
|
+
: 'awaiting human approval',
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
const queue = this.#queues.get(input.toRunId) ?? [];
|
|
283
|
+
// §8: oldest dropped past the cap. Dropping the NEWEST would silently
|
|
284
|
+
// discard the most current information, which is the opposite of useful.
|
|
285
|
+
if (queue.length >= this.#options.maxQueuedPerRun)
|
|
286
|
+
queue.shift();
|
|
287
|
+
queue.push(message);
|
|
288
|
+
this.#queues.set(input.toRunId, queue);
|
|
289
|
+
return { status: 'delivered', messageId: id, at };
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Takes everything queued for a run.
|
|
293
|
+
*
|
|
294
|
+
* §6: delivery happens at a turn boundary or between tool calls — "a running
|
|
295
|
+
* tool is never interrupted mid-execution". The host calls this at those
|
|
296
|
+
* points; the bus does not push, so it cannot interrupt anything.
|
|
297
|
+
*
|
|
298
|
+
* Every message comes back tagged `source: 'agent-message'`, which is what
|
|
299
|
+
* keeps a delivered message from being mistaken for user input downstream.
|
|
300
|
+
*/
|
|
301
|
+
drainFor(runId) {
|
|
302
|
+
const queue = this.#queues.get(runId) ?? [];
|
|
303
|
+
this.#queues.set(runId, []);
|
|
304
|
+
const at = this.#now();
|
|
305
|
+
return queue.map((message) => ({ source: 'agent-message', message, deliveredAt: at }));
|
|
306
|
+
}
|
|
307
|
+
/** Messages withheld for human approval (§6 `hold`). */
|
|
308
|
+
heldFor(runId) {
|
|
309
|
+
return [...(this.#held.get(runId) ?? [])];
|
|
310
|
+
}
|
|
311
|
+
/** A human releases a held message; it then follows the normal queue path. */
|
|
312
|
+
releaseHeld(runId, messageId) {
|
|
313
|
+
const held = this.#held.get(runId) ?? [];
|
|
314
|
+
const index = held.findIndex((message) => message.id === messageId);
|
|
315
|
+
if (index === -1) {
|
|
316
|
+
return { status: 'expired', messageId, reason: 'held message is no longer available' };
|
|
317
|
+
}
|
|
318
|
+
const [message] = held.splice(index, 1);
|
|
319
|
+
// `splice` is typed as possibly-empty even though `index` came from a
|
|
320
|
+
// successful `findIndex`. Guarding rather than asserting: a non-null
|
|
321
|
+
// assertion here would be correct today and silently wrong the day the
|
|
322
|
+
// lookup above changes.
|
|
323
|
+
if (!message) {
|
|
324
|
+
return { status: 'expired', messageId, reason: 'held message is no longer available' };
|
|
325
|
+
}
|
|
326
|
+
this.#held.set(runId, held);
|
|
327
|
+
const queue = this.#queues.get(runId) ?? [];
|
|
328
|
+
if (queue.length >= this.#options.maxQueuedPerRun)
|
|
329
|
+
queue.shift();
|
|
330
|
+
queue.push(message);
|
|
331
|
+
this.#queues.set(runId, queue);
|
|
332
|
+
return { status: 'delivered', messageId, at: this.#now() };
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/coordination/messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,iFAAiF;AACjF;;;;;;;;GAQG;AACH,SAAS,OAAO,CAAC,MAAc;IAC7B,OAAO,GAAG,MAAM,IAAI,UAAU,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAA;AACvF,CAAC;AAmCD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,UAAU;IACV,SAAS;IACT,UAAU;IACV,WAAW;IACX,WAAW;IACX,WAAW;CACH,CAAA;AAOV;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAkB,EAAE,QAAoB;IACvE,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,QAAQ,CAAC,GAAG,CAAC,KAAK,IAAI,CA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,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;QAC3C,IAAI,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,eAAe;YAAE,KAAK,CAAC,KAAK,EAAE,CAAA;QAChE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACnB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;QAC9B,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,CAAA;IAC5D,CAAC;CACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A registry of outstanding human prompts that says when a RUN starts and stops
|
|
3
|
+
* waiting on one — ADE §7's `awaiting-approval`.
|
|
4
|
+
*
|
|
5
|
+
* 🔴 The rule lives HERE, not beside the prompts it watches, for two reasons.
|
|
6
|
+
*
|
|
7
|
+
* It is the same rule in every lane, and a per-lane copy is how a run blocked on
|
|
8
|
+
* a human came to report itself busy in one runtime and correctly in the other.
|
|
9
|
+
* And `packages/electron-host` is not one of this repo's test projects, so a
|
|
10
|
+
* version of this written there could not be proven at all — the occupancy
|
|
11
|
+
* arithmetic below is exactly the part worth proving.
|
|
12
|
+
*
|
|
13
|
+
* Occupancy is derived rather than announced: every wait registers an entry and
|
|
14
|
+
* every resolution removes one, so the FIRST entry for a run means it is
|
|
15
|
+
* blocked and the LAST removal means it is free. Instrumenting the call sites
|
|
16
|
+
* instead would mean editing each one, and missing the next one someone adds.
|
|
17
|
+
*/
|
|
18
|
+
export interface PermissionWaitEntry {
|
|
19
|
+
/** The run's turn. Entries without one are held but never reported on. */
|
|
20
|
+
requestId?: string | undefined;
|
|
21
|
+
}
|
|
22
|
+
export type PermissionWaitListener = (requestId: string, waiting: boolean) => void;
|
|
23
|
+
export interface PermissionWaitRegistry<T extends PermissionWaitEntry> {
|
|
24
|
+
set(key: string, entry: T): void;
|
|
25
|
+
get(key: string): T | undefined;
|
|
26
|
+
delete(key: string): boolean;
|
|
27
|
+
entries(): IterableIterator<[string, T]>;
|
|
28
|
+
/** Returns an unsubscribe, so a finished turn stops hearing about later ones. */
|
|
29
|
+
onChange(listener: PermissionWaitListener): () => void;
|
|
30
|
+
}
|
|
31
|
+
export declare function createPermissionWaitRegistry<T extends PermissionWaitEntry>(): PermissionWaitRegistry<T>;
|
|
32
|
+
//# sourceMappingURL=permissionWaitRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissionWaitRegistry.d.ts","sourceRoot":"","sources":["../../src/coordination/permissionWaitRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,mBAAmB;IAClC,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC/B;AAED,MAAM,MAAM,sBAAsB,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;AAElF,MAAM,WAAW,sBAAsB,CAAC,CAAC,SAAS,mBAAmB;IACnE,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAA;IAChC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAA;IAC/B,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;IAC5B,OAAO,IAAI,gBAAgB,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAA;IACxC,iFAAiF;IACjF,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,GAAG,MAAM,IAAI,CAAA;CACvD;AAED,wBAAgB,4BAA4B,CAAC,CAAC,SAAS,mBAAmB,KAAK,sBAAsB,CAAC,CAAC,CAAC,CAqDvG"}
|