@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,705 @@
|
|
|
1
|
+
const UNKNOWN_REQUEST_ID = '__unknown_request__';
|
|
2
|
+
function isRecord(value) {
|
|
3
|
+
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
4
|
+
}
|
|
5
|
+
function readString(record, key) {
|
|
6
|
+
const value = record[key];
|
|
7
|
+
return typeof value === 'string' && value.trim() ? value.trim() : undefined;
|
|
8
|
+
}
|
|
9
|
+
function readRawString(record, key) {
|
|
10
|
+
const value = record[key];
|
|
11
|
+
return typeof value === 'string' ? value : undefined;
|
|
12
|
+
}
|
|
13
|
+
function readBoolean(record, key) {
|
|
14
|
+
const value = record[key];
|
|
15
|
+
return typeof value === 'boolean' ? value : undefined;
|
|
16
|
+
}
|
|
17
|
+
function readNumber(record, key) {
|
|
18
|
+
const value = record[key];
|
|
19
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
|
|
20
|
+
}
|
|
21
|
+
function readStringArray(value) {
|
|
22
|
+
if (!Array.isArray(value))
|
|
23
|
+
return [];
|
|
24
|
+
const out = [];
|
|
25
|
+
const seen = new Set();
|
|
26
|
+
for (const item of value) {
|
|
27
|
+
if (typeof item !== 'string')
|
|
28
|
+
continue;
|
|
29
|
+
const trimmed = item.trim();
|
|
30
|
+
if (!trimmed || seen.has(trimmed))
|
|
31
|
+
continue;
|
|
32
|
+
seen.add(trimmed);
|
|
33
|
+
out.push(trimmed);
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
function readTokenUsage(value) {
|
|
38
|
+
if (!isRecord(value))
|
|
39
|
+
return undefined;
|
|
40
|
+
const input = readNumber(value, 'input');
|
|
41
|
+
const output = readNumber(value, 'output');
|
|
42
|
+
const total = readNumber(value, 'total');
|
|
43
|
+
if (input === undefined || output === undefined || total === undefined)
|
|
44
|
+
return undefined;
|
|
45
|
+
return { input, output, total };
|
|
46
|
+
}
|
|
47
|
+
function parseTimestampMs(timestamp) {
|
|
48
|
+
if (!timestamp)
|
|
49
|
+
return undefined;
|
|
50
|
+
const parsed = Date.parse(timestamp);
|
|
51
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
52
|
+
}
|
|
53
|
+
function readNestedPayload(record) {
|
|
54
|
+
return isRecord(record.event) ? record.event : record;
|
|
55
|
+
}
|
|
56
|
+
function normalizeRuntimeEvent(input, index) {
|
|
57
|
+
if (!isRecord(input))
|
|
58
|
+
return null;
|
|
59
|
+
const payload = readNestedPayload(input);
|
|
60
|
+
const type = readString(input, 'type') || readString(payload, 'type');
|
|
61
|
+
if (!type)
|
|
62
|
+
return null;
|
|
63
|
+
const sequence = readNumber(input, 'sequence') ?? readNumber(payload, 'sequence') ?? index + 1;
|
|
64
|
+
const timestamp = readString(input, 'timestamp') || readString(payload, 'timestamp');
|
|
65
|
+
const id = readString(input, 'id') || readString(payload, 'id') || `runtime-event-${sequence}-${index}`;
|
|
66
|
+
const requestId = readString(input, 'requestId') || readString(payload, 'requestId') || UNKNOWN_REQUEST_ID;
|
|
67
|
+
return {
|
|
68
|
+
id,
|
|
69
|
+
sequence,
|
|
70
|
+
timestamp,
|
|
71
|
+
timestampMs: parseTimestampMs(timestamp),
|
|
72
|
+
conversationId: readString(input, 'conversationId') || readString(payload, 'conversationId'),
|
|
73
|
+
workspaceId: readString(input, 'workspaceId') || readString(payload, 'workspaceId'),
|
|
74
|
+
teamId: readString(input, 'teamId') || readString(payload, 'teamId'),
|
|
75
|
+
agentId: readString(input, 'agentId') || readString(payload, 'agentId'),
|
|
76
|
+
requestId,
|
|
77
|
+
parentRunId: readString(input, 'parentRunId') || readString(payload, 'parentRunId'),
|
|
78
|
+
subagentRunId: readString(input, 'subagentRunId') || readString(payload, 'subagentRunId'),
|
|
79
|
+
providerKind: readString(input, 'providerKind') || readString(payload, 'providerKind'),
|
|
80
|
+
providerId: readString(input, 'providerId') || readString(payload, 'providerId'),
|
|
81
|
+
source: readString(input, 'source') || readString(payload, 'source'),
|
|
82
|
+
type,
|
|
83
|
+
schemaVersion: readString(input, 'schemaVersion') || readString(payload, 'schemaVersion'),
|
|
84
|
+
redactionState: readString(input, 'redactionState') || readString(payload, 'redactionState'),
|
|
85
|
+
payload,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function sortEvents(events) {
|
|
89
|
+
return events.slice().sort((a, b) => (a.sequence - b.sequence
|
|
90
|
+
|| (a.timestampMs ?? Number.POSITIVE_INFINITY) - (b.timestampMs ?? Number.POSITIVE_INFINITY)
|
|
91
|
+
|| a.id.localeCompare(b.id)));
|
|
92
|
+
}
|
|
93
|
+
function ensureRequest(state, event) {
|
|
94
|
+
const existing = state.requests.get(event.requestId);
|
|
95
|
+
if (existing)
|
|
96
|
+
return existing;
|
|
97
|
+
const request = {
|
|
98
|
+
requestId: event.requestId,
|
|
99
|
+
conversationId: event.conversationId,
|
|
100
|
+
parentRunId: event.parentRunId,
|
|
101
|
+
subagentRunId: event.subagentRunId,
|
|
102
|
+
status: 'unknown',
|
|
103
|
+
text: '',
|
|
104
|
+
textEventIds: [],
|
|
105
|
+
toolIds: [],
|
|
106
|
+
modelWaitEventIds: [],
|
|
107
|
+
eventIds: [],
|
|
108
|
+
};
|
|
109
|
+
state.requests.set(event.requestId, request);
|
|
110
|
+
return request;
|
|
111
|
+
}
|
|
112
|
+
function eventToolName(event) {
|
|
113
|
+
return readString(event.payload, 'toolName')
|
|
114
|
+
|| readString(event.payload, 'tool')
|
|
115
|
+
|| readString(event.payload, 'name')
|
|
116
|
+
|| readString(event.payload, 'title')
|
|
117
|
+
|| readString(event.payload, 'kind');
|
|
118
|
+
}
|
|
119
|
+
function eventToolCallId(event) {
|
|
120
|
+
return readString(event.payload, 'toolCallId')
|
|
121
|
+
|| readString(event.payload, 'tool_call_id');
|
|
122
|
+
}
|
|
123
|
+
function toolKeyFor(event, fallbackToolName = 'unknown') {
|
|
124
|
+
const toolCallId = eventToolCallId(event);
|
|
125
|
+
if (toolCallId)
|
|
126
|
+
return `${event.requestId}:${toolCallId}`;
|
|
127
|
+
return `${event.requestId}:${eventToolName(event) || fallbackToolName}:${event.sequence}`;
|
|
128
|
+
}
|
|
129
|
+
function findLatestRunningTool(state, event, toolName) {
|
|
130
|
+
const normalized = (toolName || '').toLowerCase();
|
|
131
|
+
const candidates = Array.from(state.tools.values())
|
|
132
|
+
.filter((tool) => tool.requestId === event.requestId)
|
|
133
|
+
.filter((tool) => tool.status === 'running')
|
|
134
|
+
.filter((tool) => !normalized || tool.toolName.toLowerCase() === normalized)
|
|
135
|
+
.sort((a, b) => (Date.parse(b.startedAt || '') || 0) - (Date.parse(a.startedAt || '') || 0));
|
|
136
|
+
return candidates[0];
|
|
137
|
+
}
|
|
138
|
+
function ensureTool(state, event, status) {
|
|
139
|
+
const toolName = eventToolName(event) || 'unknown';
|
|
140
|
+
const directKey = toolKeyFor(event, toolName);
|
|
141
|
+
const existing = state.tools.get(directKey);
|
|
142
|
+
if (existing)
|
|
143
|
+
return existing;
|
|
144
|
+
const toolCallId = eventToolCallId(event);
|
|
145
|
+
if (!toolCallId && event.type === 'tool.completed') {
|
|
146
|
+
const running = findLatestRunningTool(state, event, toolName);
|
|
147
|
+
if (running)
|
|
148
|
+
return running;
|
|
149
|
+
state.orphanToolCompletionCount += 1;
|
|
150
|
+
}
|
|
151
|
+
const tool = {
|
|
152
|
+
id: directKey,
|
|
153
|
+
requestId: event.requestId,
|
|
154
|
+
toolCallId,
|
|
155
|
+
toolName,
|
|
156
|
+
status,
|
|
157
|
+
startedAt: status === 'running' ? event.timestamp : undefined,
|
|
158
|
+
eventIds: [],
|
|
159
|
+
};
|
|
160
|
+
state.tools.set(directKey, tool);
|
|
161
|
+
const request = ensureRequest(state, event);
|
|
162
|
+
if (!request.toolIds.includes(tool.id))
|
|
163
|
+
request.toolIds.push(tool.id);
|
|
164
|
+
return tool;
|
|
165
|
+
}
|
|
166
|
+
function attachToolEvent(tool, event) {
|
|
167
|
+
if (!tool.eventIds.includes(event.id))
|
|
168
|
+
tool.eventIds.push(event.id);
|
|
169
|
+
}
|
|
170
|
+
function readInputPreview(event) {
|
|
171
|
+
if ('inputPreview' in event.payload)
|
|
172
|
+
return event.payload.inputPreview;
|
|
173
|
+
if ('input' in event.payload)
|
|
174
|
+
return event.payload.input;
|
|
175
|
+
if ('params' in event.payload)
|
|
176
|
+
return event.payload.params;
|
|
177
|
+
return undefined;
|
|
178
|
+
}
|
|
179
|
+
function readOutputPreview(event) {
|
|
180
|
+
return readString(event.payload, 'outputPreview')
|
|
181
|
+
|| readString(event.payload, 'output')
|
|
182
|
+
|| readString(event.payload, 'result')
|
|
183
|
+
|| readString(event.payload, 'summary')
|
|
184
|
+
|| stringifyPreview(event.payload.rawOutput);
|
|
185
|
+
}
|
|
186
|
+
function stringifyPreview(value) {
|
|
187
|
+
if (value === undefined)
|
|
188
|
+
return undefined;
|
|
189
|
+
if (typeof value === 'string')
|
|
190
|
+
return value;
|
|
191
|
+
try {
|
|
192
|
+
return JSON.stringify(value).slice(0, 500);
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function normalizePermissionStatus(event) {
|
|
199
|
+
const raw = readString(event.payload, 'status') || readString(event.payload, 'decision');
|
|
200
|
+
if (raw === 'pending' || raw === 'granted' || raw === 'denied')
|
|
201
|
+
return raw;
|
|
202
|
+
const allowed = readBoolean(event.payload, 'allowed');
|
|
203
|
+
if (allowed === true)
|
|
204
|
+
return 'granted';
|
|
205
|
+
if (allowed === false)
|
|
206
|
+
return 'denied';
|
|
207
|
+
return 'unknown';
|
|
208
|
+
}
|
|
209
|
+
function normalizeAskUserStatus(event) {
|
|
210
|
+
const raw = readString(event.payload, 'status');
|
|
211
|
+
if (raw === 'pending' || raw === 'answered' || raw === 'cancelled')
|
|
212
|
+
return raw;
|
|
213
|
+
if (readString(event.payload, 'answer') || readString(event.payload, 'selectedOption'))
|
|
214
|
+
return 'answered';
|
|
215
|
+
return 'unknown';
|
|
216
|
+
}
|
|
217
|
+
function normalizeModelWaitStatus(event) {
|
|
218
|
+
if (event.type === 'hub.model.waiting')
|
|
219
|
+
return 'waiting';
|
|
220
|
+
if (event.type === 'hub.model.stalled')
|
|
221
|
+
return 'stalled';
|
|
222
|
+
if (event.type === 'hub.model.request.started')
|
|
223
|
+
return 'started';
|
|
224
|
+
if (event.type === 'hub.model.request.completed')
|
|
225
|
+
return 'completed';
|
|
226
|
+
if (event.type === 'hub.model.request.failed')
|
|
227
|
+
return 'failed';
|
|
228
|
+
const raw = readString(event.payload, 'status');
|
|
229
|
+
if (raw === 'started' || raw === 'waiting' || raw === 'completed' || raw === 'failed' || raw === 'stalled')
|
|
230
|
+
return raw;
|
|
231
|
+
return 'unknown';
|
|
232
|
+
}
|
|
233
|
+
function handleTurnEvent(state, event) {
|
|
234
|
+
const request = ensureRequest(state, event);
|
|
235
|
+
if (!request.eventIds.includes(event.id))
|
|
236
|
+
request.eventIds.push(event.id);
|
|
237
|
+
request.conversationId ||= event.conversationId;
|
|
238
|
+
request.parentRunId ||= event.parentRunId;
|
|
239
|
+
request.subagentRunId ||= event.subagentRunId;
|
|
240
|
+
if (event.type === 'turn.started') {
|
|
241
|
+
request.status = 'running';
|
|
242
|
+
request.startedAt = event.timestamp || request.startedAt;
|
|
243
|
+
request.model = readString(event.payload, 'model') || request.model;
|
|
244
|
+
}
|
|
245
|
+
else if (event.type === 'turn.completed') {
|
|
246
|
+
request.status = 'completed';
|
|
247
|
+
request.completedAt = event.timestamp || request.completedAt;
|
|
248
|
+
request.tokenUsage = readTokenUsage(event.payload.tokenUsage) || request.tokenUsage;
|
|
249
|
+
state.tokenUsage = request.tokenUsage || state.tokenUsage;
|
|
250
|
+
}
|
|
251
|
+
else if (event.type === 'turn.failed') {
|
|
252
|
+
request.status = 'failed';
|
|
253
|
+
request.failedAt = event.timestamp || request.failedAt;
|
|
254
|
+
request.error = readString(event.payload, 'error') || readString(event.payload, 'message') || request.error;
|
|
255
|
+
}
|
|
256
|
+
else if (event.type === 'turn.cancelled') {
|
|
257
|
+
request.status = 'cancelled';
|
|
258
|
+
request.completedAt = event.timestamp || request.completedAt;
|
|
259
|
+
}
|
|
260
|
+
if (event.type === 'turn.completed' || event.type === 'turn.failed' || event.type === 'turn.cancelled') {
|
|
261
|
+
closeRunningToolsForTerminalTurn(state, event);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
function closeRunningToolsForTerminalTurn(state, event) {
|
|
265
|
+
for (const tool of state.tools.values()) {
|
|
266
|
+
if (tool.requestId !== event.requestId || tool.status !== 'running')
|
|
267
|
+
continue;
|
|
268
|
+
attachToolEvent(tool, event);
|
|
269
|
+
tool.status = 'failed';
|
|
270
|
+
tool.success = false;
|
|
271
|
+
tool.completedAt = event.timestamp || tool.completedAt;
|
|
272
|
+
tool.error = readString(event.payload, 'error')
|
|
273
|
+
|| readString(event.payload, 'message')
|
|
274
|
+
|| readString(event.payload, 'reason')
|
|
275
|
+
|| 'Stopped before the tool completed.';
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
function handleTextEvent(state, event) {
|
|
279
|
+
const text = readRawString(event.payload, 'text') ?? readRawString(event.payload, 'delta');
|
|
280
|
+
if (text === undefined)
|
|
281
|
+
return;
|
|
282
|
+
const request = ensureRequest(state, event);
|
|
283
|
+
if (!request.eventIds.includes(event.id))
|
|
284
|
+
request.eventIds.push(event.id);
|
|
285
|
+
request.text += text;
|
|
286
|
+
request.textEventIds.push(event.id);
|
|
287
|
+
if (request.status === 'unknown')
|
|
288
|
+
request.status = 'running';
|
|
289
|
+
}
|
|
290
|
+
function handleToolEvent(state, event) {
|
|
291
|
+
const isStarted = event.type === 'tool.started';
|
|
292
|
+
const isCompleted = event.type === 'tool.completed';
|
|
293
|
+
const tool = ensureTool(state, event, isStarted ? 'running' : 'unknown');
|
|
294
|
+
attachToolEvent(tool, event);
|
|
295
|
+
if (isStarted) {
|
|
296
|
+
tool.status = 'running';
|
|
297
|
+
tool.startedAt = event.timestamp || tool.startedAt;
|
|
298
|
+
tool.input = readInputPreview(event) ?? tool.input;
|
|
299
|
+
tool.cwd = readString(event.payload, 'cwd') || tool.cwd;
|
|
300
|
+
}
|
|
301
|
+
if (isCompleted) {
|
|
302
|
+
const success = readBoolean(event.payload, 'success');
|
|
303
|
+
tool.status = success === false ? 'failed' : 'completed';
|
|
304
|
+
tool.success = success ?? true;
|
|
305
|
+
tool.completedAt = event.timestamp || tool.completedAt;
|
|
306
|
+
tool.durationMs = readNumber(event.payload, 'elapsedMs') ?? readNumber(event.payload, 'durationMs') ?? tool.durationMs;
|
|
307
|
+
tool.outputPreview = readOutputPreview(event) || tool.outputPreview;
|
|
308
|
+
tool.output = readString(event.payload, 'output') || readString(event.payload, 'result') || tool.output;
|
|
309
|
+
tool.error = readString(event.payload, 'error') || tool.error;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
function handleAcpSessionEvent(state, event) {
|
|
313
|
+
const request = ensureRequest(state, event);
|
|
314
|
+
if (!request.eventIds.includes(event.id))
|
|
315
|
+
request.eventIds.push(event.id);
|
|
316
|
+
if (event.type === 'acp.session.started') {
|
|
317
|
+
request.status = 'running';
|
|
318
|
+
request.startedAt = event.timestamp || request.startedAt;
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
if (event.type === 'acp.session.message.delta') {
|
|
322
|
+
handleTextEvent(state, event);
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
if (event.type === 'acp.session.usage') {
|
|
326
|
+
const input = readNumber(event.payload, 'inputTokens') ?? 0;
|
|
327
|
+
const output = readNumber(event.payload, 'outputTokens') ?? 0;
|
|
328
|
+
const total = readNumber(event.payload, 'totalTokens') ?? input + output;
|
|
329
|
+
request.tokenUsage = { input, output, total };
|
|
330
|
+
state.tokenUsage = request.tokenUsage;
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
if (event.type === 'acp.session.completed') {
|
|
334
|
+
request.status = 'completed';
|
|
335
|
+
request.completedAt = event.timestamp || request.completedAt;
|
|
336
|
+
closeRunningToolsForTerminalTurn(state, event);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
if (event.type === 'acp.session.cancelled') {
|
|
340
|
+
request.status = 'cancelled';
|
|
341
|
+
request.completedAt = event.timestamp || request.completedAt;
|
|
342
|
+
closeRunningToolsForTerminalTurn(state, event);
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
if (event.type === 'acp.session.failed') {
|
|
346
|
+
request.status = 'failed';
|
|
347
|
+
request.failedAt = event.timestamp || request.failedAt;
|
|
348
|
+
request.error = readString(event.payload, 'error') || request.error;
|
|
349
|
+
closeRunningToolsForTerminalTurn(state, event);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
function handleAcpToolEvent(state, event) {
|
|
353
|
+
const isStarted = event.type === 'acp.tool.started';
|
|
354
|
+
const isCompleted = event.type === 'acp.tool.completed';
|
|
355
|
+
const isFailed = event.type === 'acp.tool.failed';
|
|
356
|
+
const tool = ensureTool(state, event, isStarted ? 'running' : 'unknown');
|
|
357
|
+
attachToolEvent(tool, event);
|
|
358
|
+
tool.toolName = eventToolName(event) || tool.toolName || 'ACP Tool';
|
|
359
|
+
if (isStarted) {
|
|
360
|
+
tool.status = 'running';
|
|
361
|
+
tool.startedAt = event.timestamp || tool.startedAt;
|
|
362
|
+
tool.input = readInputPreview(event) ?? event.payload.rawInput ?? tool.input;
|
|
363
|
+
tool.outputPreview = readString(event.payload, 'title') || tool.outputPreview;
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
if (event.type === 'acp.tool.updated') {
|
|
367
|
+
tool.status = tool.status === 'unknown' ? 'running' : tool.status;
|
|
368
|
+
tool.outputPreview = readOutputPreview(event) || tool.outputPreview;
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
if (isCompleted || isFailed) {
|
|
372
|
+
tool.status = isFailed ? 'failed' : 'completed';
|
|
373
|
+
tool.success = !isFailed;
|
|
374
|
+
tool.completedAt = event.timestamp || tool.completedAt;
|
|
375
|
+
tool.outputPreview = readOutputPreview(event) || tool.outputPreview;
|
|
376
|
+
tool.output = readOutputPreview(event) || tool.output;
|
|
377
|
+
tool.error = readString(event.payload, 'error') || tool.error;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
function handlePermissionEvent(state, event) {
|
|
381
|
+
const toolName = eventToolName(event);
|
|
382
|
+
const toolCallId = eventToolCallId(event);
|
|
383
|
+
const id = readString(event.payload, 'permissionId') || `${event.requestId}:permission:${toolCallId || event.sequence}`;
|
|
384
|
+
const permission = {
|
|
385
|
+
...(state.permissions.get(id) || {
|
|
386
|
+
id,
|
|
387
|
+
requestId: event.requestId,
|
|
388
|
+
toolCallId,
|
|
389
|
+
toolName,
|
|
390
|
+
status: 'unknown',
|
|
391
|
+
startedAt: event.timestamp,
|
|
392
|
+
}),
|
|
393
|
+
status: normalizePermissionStatus(event),
|
|
394
|
+
reason: readString(event.payload, 'reason') || readString(event.payload, 'error'),
|
|
395
|
+
path: readString(event.payload, 'path'),
|
|
396
|
+
directory: readString(event.payload, 'directory'),
|
|
397
|
+
browserOrigin: readString(event.payload, 'browserOrigin'),
|
|
398
|
+
resolvedAt: event.timestamp,
|
|
399
|
+
};
|
|
400
|
+
state.permissions.set(id, permission);
|
|
401
|
+
const tool = toolCallId
|
|
402
|
+
? state.tools.get(`${event.requestId}:${toolCallId}`)
|
|
403
|
+
: findLatestRunningTool(state, event, toolName);
|
|
404
|
+
if (tool) {
|
|
405
|
+
tool.permission = permission;
|
|
406
|
+
attachToolEvent(tool, event);
|
|
407
|
+
if (permission.status === 'denied') {
|
|
408
|
+
tool.status = 'failed';
|
|
409
|
+
tool.success = false;
|
|
410
|
+
tool.completedAt = event.timestamp || tool.completedAt;
|
|
411
|
+
tool.error = permission.reason || tool.error || 'Permission denied.';
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
else {
|
|
415
|
+
state.orphanPermissionCount += 1;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
function handlePermissionProfileEvent(state, event) {
|
|
419
|
+
const request = ensureRequest(state, event);
|
|
420
|
+
const id = `${event.requestId}:permission-profile`;
|
|
421
|
+
const capabilities = isRecord(event.payload.capabilities) ? event.payload.capabilities : undefined;
|
|
422
|
+
const profile = {
|
|
423
|
+
id,
|
|
424
|
+
requestId: event.requestId,
|
|
425
|
+
profile: readString(event.payload, 'profile'),
|
|
426
|
+
sdkMode: readString(event.payload, 'sdkMode'),
|
|
427
|
+
ruleCount: readNumber(event.payload, 'ruleCount'),
|
|
428
|
+
allowedDirectoriesCount: readNumber(event.payload, 'allowedDirectoriesCount'),
|
|
429
|
+
approvalRulesCount: readNumber(event.payload, 'approvalRulesCount'),
|
|
430
|
+
capabilities,
|
|
431
|
+
selectedAt: event.timestamp,
|
|
432
|
+
eventId: event.id,
|
|
433
|
+
};
|
|
434
|
+
state.permissionProfiles.set(id, profile);
|
|
435
|
+
request.permissionProfile = profile;
|
|
436
|
+
}
|
|
437
|
+
function handleCheckpointEvent(state, event) {
|
|
438
|
+
const checkpointId = readString(event.payload, 'checkpointId');
|
|
439
|
+
if (!checkpointId)
|
|
440
|
+
return;
|
|
441
|
+
const checkpoint = {
|
|
442
|
+
id: `${event.requestId}:checkpoint:${checkpointId}`,
|
|
443
|
+
requestId: event.requestId,
|
|
444
|
+
checkpointId,
|
|
445
|
+
toolName: readString(event.payload, 'toolName'),
|
|
446
|
+
path: readString(event.payload, 'path'),
|
|
447
|
+
messageCount: readNumber(event.payload, 'messageCount'),
|
|
448
|
+
createdAt: event.timestamp,
|
|
449
|
+
eventId: event.id,
|
|
450
|
+
};
|
|
451
|
+
state.checkpoints.set(checkpoint.id, checkpoint);
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* `context.compacted` — the agent began continuing from a summary of its own history.
|
|
455
|
+
*
|
|
456
|
+
* ⚠️ Every field is optional except identity. The host builds this event from a request's
|
|
457
|
+
* `contextCompaction`, and a lane that reports compaction without token estimates is reporting
|
|
458
|
+
* something true; dropping the record because one number is absent would lose the boundary itself,
|
|
459
|
+
* which is the part no consumer can reconstruct.
|
|
460
|
+
*/
|
|
461
|
+
function handleCompactionEvent(state, event) {
|
|
462
|
+
const compaction = {
|
|
463
|
+
id: `${event.requestId}:compaction:${event.id}`,
|
|
464
|
+
requestId: event.requestId,
|
|
465
|
+
strategyVersion: readNumber(event.payload, 'strategyVersion'),
|
|
466
|
+
rawMessageCount: readNumber(event.payload, 'rawMessageCount'),
|
|
467
|
+
sentMessageCount: readNumber(event.payload, 'sentMessageCount'),
|
|
468
|
+
compactedMessageCount: readNumber(event.payload, 'compactedMessageCount'),
|
|
469
|
+
estimatedRawTokens: readNumber(event.payload, 'estimatedRawTokens'),
|
|
470
|
+
estimatedSentTokens: readNumber(event.payload, 'estimatedSentTokens'),
|
|
471
|
+
retainedAnchorCount: readNumber(event.payload, 'retainedAnchorCount'),
|
|
472
|
+
retainedArtifactCount: readNumber(event.payload, 'retainedArtifactCount'),
|
|
473
|
+
retainedGrantedDirectoryCount: readNumber(event.payload, 'retainedGrantedDirectoryCount'),
|
|
474
|
+
contextDigest: readString(event.payload, 'contextDigest'),
|
|
475
|
+
createdAt: event.timestamp,
|
|
476
|
+
eventId: event.id,
|
|
477
|
+
};
|
|
478
|
+
state.compactions.set(compaction.id, compaction);
|
|
479
|
+
}
|
|
480
|
+
function handleModelWaitEvent(state, event) {
|
|
481
|
+
const waitMs = readNumber(event.payload, 'waitMs');
|
|
482
|
+
const wait = {
|
|
483
|
+
id: `${event.requestId}:model-wait:${event.id}`,
|
|
484
|
+
requestId: event.requestId,
|
|
485
|
+
status: normalizeModelWaitStatus(event),
|
|
486
|
+
stage: readString(event.payload, 'stage'),
|
|
487
|
+
waitCategory: readString(event.payload, 'waitCategory'),
|
|
488
|
+
lifecycle: readString(event.payload, 'lifecycle'),
|
|
489
|
+
source: event.source,
|
|
490
|
+
message: readString(event.payload, 'message'),
|
|
491
|
+
error: readString(event.payload, 'error'),
|
|
492
|
+
waitMs,
|
|
493
|
+
timeoutMs: readNumber(event.payload, 'timeoutMs'),
|
|
494
|
+
warningMs: readNumber(event.payload, 'warningMs'),
|
|
495
|
+
hardTimeoutMs: readNumber(event.payload, 'hardTimeoutMs'),
|
|
496
|
+
activeToolCount: readNumber(event.payload, 'activeToolCount'),
|
|
497
|
+
lastToolName: readString(event.payload, 'lastToolName'),
|
|
498
|
+
lastToolCompletedAt: readString(event.payload, 'lastToolCompletedAt'),
|
|
499
|
+
lastToolCompletedSucceeded: readBoolean(event.payload, 'lastToolCompletedSucceeded'),
|
|
500
|
+
lastToolWasContextDiscovery: readBoolean(event.payload, 'lastToolWasContextDiscovery'),
|
|
501
|
+
postToolPlanningGraceEligible: readBoolean(event.payload, 'postToolPlanningGraceEligible'),
|
|
502
|
+
emittedAt: event.timestamp,
|
|
503
|
+
eventId: event.id,
|
|
504
|
+
};
|
|
505
|
+
state.modelWaits.set(wait.id, wait);
|
|
506
|
+
const request = ensureRequest(state, event);
|
|
507
|
+
if (!request.eventIds.includes(event.id))
|
|
508
|
+
request.eventIds.push(event.id);
|
|
509
|
+
if (!request.modelWaitEventIds.includes(event.id))
|
|
510
|
+
request.modelWaitEventIds.push(event.id);
|
|
511
|
+
if (waitMs !== undefined)
|
|
512
|
+
request.maxModelWaitMs = Math.max(request.maxModelWaitMs || 0, waitMs);
|
|
513
|
+
if (wait.status === 'stalled') {
|
|
514
|
+
request.modelStalledAt = event.timestamp || request.modelStalledAt;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
function handleAskUserEvent(state, event) {
|
|
518
|
+
const toolCallId = eventToolCallId(event);
|
|
519
|
+
const id = readString(event.payload, 'askUserId') || readString(event.payload, 'requestId') || `${event.requestId}:ask-user:${toolCallId || event.sequence}`;
|
|
520
|
+
const askUser = {
|
|
521
|
+
...(state.askUserRequests.get(id) || {
|
|
522
|
+
id,
|
|
523
|
+
requestId: event.requestId,
|
|
524
|
+
toolCallId,
|
|
525
|
+
options: [],
|
|
526
|
+
status: 'unknown',
|
|
527
|
+
startedAt: event.timestamp,
|
|
528
|
+
}),
|
|
529
|
+
question: readString(event.payload, 'question'),
|
|
530
|
+
options: readStringArray(event.payload.options),
|
|
531
|
+
answer: readString(event.payload, 'answer'),
|
|
532
|
+
selectedOption: readString(event.payload, 'selectedOption'),
|
|
533
|
+
status: normalizeAskUserStatus(event),
|
|
534
|
+
resolvedAt: event.timestamp,
|
|
535
|
+
};
|
|
536
|
+
state.askUserRequests.set(id, askUser);
|
|
537
|
+
const tool = toolCallId
|
|
538
|
+
? state.tools.get(`${event.requestId}:${toolCallId}`)
|
|
539
|
+
: findLatestRunningTool(state, event, 'AskUser');
|
|
540
|
+
if (tool) {
|
|
541
|
+
tool.askUser = askUser;
|
|
542
|
+
attachToolEvent(tool, event);
|
|
543
|
+
}
|
|
544
|
+
else {
|
|
545
|
+
state.orphanAskUserCount += 1;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
function applyEvent(state, event) {
|
|
549
|
+
state.events.push(event);
|
|
550
|
+
const request = ensureRequest(state, event);
|
|
551
|
+
if (!request.eventIds.includes(event.id))
|
|
552
|
+
request.eventIds.push(event.id);
|
|
553
|
+
if (event.type.startsWith('turn.')) {
|
|
554
|
+
handleTurnEvent(state, event);
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
if (event.type === 'model.text.delta' || event.type === 'text.delta' || event.type === 'model.text.completed') {
|
|
558
|
+
handleTextEvent(state, event);
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
if (event.type.startsWith('acp.session.') && event.type !== 'acp.session.permission.requested' && event.type !== 'acp.session.permission.decided') {
|
|
562
|
+
handleAcpSessionEvent(state, event);
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
if (event.type.startsWith('acp.tool.')) {
|
|
566
|
+
handleAcpToolEvent(state, event);
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
if (event.type === 'acp.session.permission.requested' || event.type === 'acp.session.permission.decided') {
|
|
570
|
+
handlePermissionEvent(state, event);
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
if (event.type === 'tool.started' || event.type === 'tool.completed') {
|
|
574
|
+
handleToolEvent(state, event);
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
if (event.type === 'tool.permission' || event.type === 'permission.requested' || event.type === 'permission.resolved') {
|
|
578
|
+
handlePermissionEvent(state, event);
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
if (event.type === 'permission.profile.selected') {
|
|
582
|
+
handlePermissionProfileEvent(state, event);
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
if (event.type === 'hub.checkpoint') {
|
|
586
|
+
handleCheckpointEvent(state, event);
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
589
|
+
if (event.type === 'context.compacted') {
|
|
590
|
+
handleCompactionEvent(state, event);
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
if (event.type.startsWith('hub.model.')) {
|
|
594
|
+
handleModelWaitEvent(state, event);
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
if (event.type === 'ask_user.requested' || event.type === 'ask_user.answered' || event.type === 'ask_user.cancelled') {
|
|
598
|
+
handleAskUserEvent(state, event);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
export function projectRuntimeTimeline(inputs) {
|
|
602
|
+
const seenIds = new Set();
|
|
603
|
+
const normalized = [];
|
|
604
|
+
let duplicateEventCount = 0;
|
|
605
|
+
inputs.forEach((input, index) => {
|
|
606
|
+
const event = normalizeRuntimeEvent(input, index);
|
|
607
|
+
if (!event)
|
|
608
|
+
return;
|
|
609
|
+
if (seenIds.has(event.id)) {
|
|
610
|
+
duplicateEventCount += 1;
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
seenIds.add(event.id);
|
|
614
|
+
normalized.push(event);
|
|
615
|
+
});
|
|
616
|
+
const state = {
|
|
617
|
+
events: [],
|
|
618
|
+
requests: new Map(),
|
|
619
|
+
tools: new Map(),
|
|
620
|
+
permissions: new Map(),
|
|
621
|
+
permissionProfiles: new Map(),
|
|
622
|
+
checkpoints: new Map(),
|
|
623
|
+
compactions: new Map(),
|
|
624
|
+
modelWaits: new Map(),
|
|
625
|
+
askUserRequests: new Map(),
|
|
626
|
+
duplicateEventCount,
|
|
627
|
+
orphanToolCompletionCount: 0,
|
|
628
|
+
orphanPermissionCount: 0,
|
|
629
|
+
orphanAskUserCount: 0,
|
|
630
|
+
};
|
|
631
|
+
for (const event of sortEvents(normalized))
|
|
632
|
+
applyEvent(state, event);
|
|
633
|
+
const orderedEvents = state.events;
|
|
634
|
+
const requests = Array.from(state.requests.values())
|
|
635
|
+
.sort((a, b) => firstRequestSequence(a, orderedEvents) - firstRequestSequence(b, orderedEvents));
|
|
636
|
+
const tools = Array.from(state.tools.values())
|
|
637
|
+
.sort((a, b) => firstToolSequence(a, orderedEvents) - firstToolSequence(b, orderedEvents));
|
|
638
|
+
const permissions = Array.from(state.permissions.values());
|
|
639
|
+
const permissionProfiles = Array.from(state.permissionProfiles.values())
|
|
640
|
+
.sort((a, b) => firstProfileSequence(a, orderedEvents) - firstProfileSequence(b, orderedEvents));
|
|
641
|
+
const checkpoints = Array.from(state.checkpoints.values())
|
|
642
|
+
.sort((a, b) => firstCheckpointSequence(a, orderedEvents) - firstCheckpointSequence(b, orderedEvents));
|
|
643
|
+
const compactions = Array.from(state.compactions.values())
|
|
644
|
+
.sort((a, b) => firstCheckpointSequence(a, orderedEvents) - firstCheckpointSequence(b, orderedEvents));
|
|
645
|
+
const modelWaits = Array.from(state.modelWaits.values());
|
|
646
|
+
const maxModelWaitMs = modelWaits.reduce((max, wait) => Math.max(max, wait.waitMs || 0), 0);
|
|
647
|
+
const modelStallCount = modelWaits.filter((wait) => wait.status === 'stalled').length;
|
|
648
|
+
const askUserRequests = Array.from(state.askUserRequests.values());
|
|
649
|
+
const activeTools = tools.filter((tool) => tool.status === 'running');
|
|
650
|
+
const failedTools = tools.filter((tool) => tool.status === 'failed');
|
|
651
|
+
const last = orderedEvents[orderedEvents.length - 1];
|
|
652
|
+
return {
|
|
653
|
+
eventCount: orderedEvents.length,
|
|
654
|
+
orderedEvents,
|
|
655
|
+
requests,
|
|
656
|
+
tools,
|
|
657
|
+
activeTools,
|
|
658
|
+
failedTools,
|
|
659
|
+
permissions,
|
|
660
|
+
permissionProfiles,
|
|
661
|
+
checkpoints,
|
|
662
|
+
compactions,
|
|
663
|
+
modelWaits,
|
|
664
|
+
askUserRequests,
|
|
665
|
+
lastEventType: last?.type,
|
|
666
|
+
lastEventAt: last?.timestamp,
|
|
667
|
+
latestSequence: orderedEvents.reduce((max, event) => Math.max(max, event.sequence), 0),
|
|
668
|
+
tokenUsage: state.tokenUsage,
|
|
669
|
+
diagnostics: {
|
|
670
|
+
duplicateEventCount: state.duplicateEventCount,
|
|
671
|
+
orphanToolCompletionCount: state.orphanToolCompletionCount,
|
|
672
|
+
orphanPermissionCount: state.orphanPermissionCount,
|
|
673
|
+
orphanAskUserCount: state.orphanAskUserCount,
|
|
674
|
+
activeToolCount: activeTools.length,
|
|
675
|
+
failedToolCount: failedTools.length,
|
|
676
|
+
modelWaitCount: modelWaits.length,
|
|
677
|
+
modelStallCount,
|
|
678
|
+
maxModelWaitMs,
|
|
679
|
+
},
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
function firstRequestSequence(request, events) {
|
|
683
|
+
const event = events.find((candidate) => request.eventIds.includes(candidate.id));
|
|
684
|
+
return event?.sequence ?? Number.MAX_SAFE_INTEGER;
|
|
685
|
+
}
|
|
686
|
+
function firstToolSequence(tool, events) {
|
|
687
|
+
const event = events.find((candidate) => tool.eventIds.includes(candidate.id));
|
|
688
|
+
return event?.sequence ?? Number.MAX_SAFE_INTEGER;
|
|
689
|
+
}
|
|
690
|
+
function firstProfileSequence(profile, events) {
|
|
691
|
+
const event = events.find((candidate) => candidate.id === profile.eventId);
|
|
692
|
+
return event?.sequence ?? Number.MAX_SAFE_INTEGER;
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Order any event-anchored record by where its event fell in the stream.
|
|
696
|
+
*
|
|
697
|
+
* ⚠️ Widened from `RuntimeTimelineCheckpoint` to a structural `{ eventId }` rather than copied
|
|
698
|
+
* for compactions. Two identical comparators drift; the second one is always the one nobody
|
|
699
|
+
* notices, because both look right in isolation.
|
|
700
|
+
*/
|
|
701
|
+
function firstCheckpointSequence(checkpoint, events) {
|
|
702
|
+
const event = events.find((candidate) => candidate.id === checkpoint.eventId);
|
|
703
|
+
return event?.sequence ?? Number.MAX_SAFE_INTEGER;
|
|
704
|
+
}
|
|
705
|
+
//# sourceMappingURL=RuntimeTimelineProjection.js.map
|