@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.
Files changed (482) hide show
  1. package/LICENSE +67 -0
  2. package/dist/acp/AcpAgentRegistryService.d.ts +77 -0
  3. package/dist/acp/AcpAgentRegistryService.d.ts.map +1 -0
  4. package/dist/acp/AcpAgentRegistryService.js +754 -0
  5. package/dist/acp/AcpAgentRegistryService.js.map +1 -0
  6. package/dist/acp/AcpAgentTurnExecutionAdapter.d.ts +56 -0
  7. package/dist/acp/AcpAgentTurnExecutionAdapter.d.ts.map +1 -0
  8. package/dist/acp/AcpAgentTurnExecutionAdapter.js +323 -0
  9. package/dist/acp/AcpAgentTurnExecutionAdapter.js.map +1 -0
  10. package/dist/acp/AcpApprovalPortAdapter.d.ts +41 -0
  11. package/dist/acp/AcpApprovalPortAdapter.d.ts.map +1 -0
  12. package/dist/acp/AcpApprovalPortAdapter.js +82 -0
  13. package/dist/acp/AcpApprovalPortAdapter.js.map +1 -0
  14. package/dist/acp/AcpCoordinationBridge.d.ts +13 -0
  15. package/dist/acp/AcpCoordinationBridge.d.ts.map +1 -0
  16. package/dist/acp/AcpCoordinationBridge.js +13 -0
  17. package/dist/acp/AcpCoordinationBridge.js.map +1 -0
  18. package/dist/acp/AcpDiagnosticsService.d.ts +61 -0
  19. package/dist/acp/AcpDiagnosticsService.d.ts.map +1 -0
  20. package/dist/acp/AcpDiagnosticsService.js +203 -0
  21. package/dist/acp/AcpDiagnosticsService.js.map +1 -0
  22. package/dist/acp/AcpExternalCertificationHarness.d.ts +47 -0
  23. package/dist/acp/AcpExternalCertificationHarness.d.ts.map +1 -0
  24. package/dist/acp/AcpExternalCertificationHarness.js +176 -0
  25. package/dist/acp/AcpExternalCertificationHarness.js.map +1 -0
  26. package/dist/acp/AcpHostBridge.d.ts +81 -0
  27. package/dist/acp/AcpHostBridge.d.ts.map +1 -0
  28. package/dist/acp/AcpHostBridge.js +101 -0
  29. package/dist/acp/AcpHostBridge.js.map +1 -0
  30. package/dist/acp/AcpInteractivePermissionBridge.d.ts +77 -0
  31. package/dist/acp/AcpInteractivePermissionBridge.d.ts.map +1 -0
  32. package/dist/acp/AcpInteractivePermissionBridge.js +127 -0
  33. package/dist/acp/AcpInteractivePermissionBridge.js.map +1 -0
  34. package/dist/acp/AcpPermissionBridge.d.ts +19 -0
  35. package/dist/acp/AcpPermissionBridge.d.ts.map +1 -0
  36. package/dist/acp/AcpPermissionBridge.js +110 -0
  37. package/dist/acp/AcpPermissionBridge.js.map +1 -0
  38. package/dist/acp/AcpPermissionPolicy.d.ts +111 -0
  39. package/dist/acp/AcpPermissionPolicy.d.ts.map +1 -0
  40. package/dist/acp/AcpPermissionPolicy.js +167 -0
  41. package/dist/acp/AcpPermissionPolicy.js.map +1 -0
  42. package/dist/acp/AcpProcessSupervisor.d.ts +134 -0
  43. package/dist/acp/AcpProcessSupervisor.d.ts.map +1 -0
  44. package/dist/acp/AcpProcessSupervisor.js +674 -0
  45. package/dist/acp/AcpProcessSupervisor.js.map +1 -0
  46. package/dist/acp/AcpProviderApprovalService.d.ts +27 -0
  47. package/dist/acp/AcpProviderApprovalService.d.ts.map +1 -0
  48. package/dist/acp/AcpProviderApprovalService.js +128 -0
  49. package/dist/acp/AcpProviderApprovalService.js.map +1 -0
  50. package/dist/acp/AcpProviderCatalogService.d.ts +69 -0
  51. package/dist/acp/AcpProviderCatalogService.d.ts.map +1 -0
  52. package/dist/acp/AcpProviderCatalogService.js +707 -0
  53. package/dist/acp/AcpProviderCatalogService.js.map +1 -0
  54. package/dist/acp/AcpProviderModelService.d.ts +6 -0
  55. package/dist/acp/AcpProviderModelService.d.ts.map +1 -0
  56. package/dist/acp/AcpProviderModelService.js +274 -0
  57. package/dist/acp/AcpProviderModelService.js.map +1 -0
  58. package/dist/acp/AcpProviderVersionReadiness.d.ts +6 -0
  59. package/dist/acp/AcpProviderVersionReadiness.d.ts.map +1 -0
  60. package/dist/acp/AcpProviderVersionReadiness.js +100 -0
  61. package/dist/acp/AcpProviderVersionReadiness.js.map +1 -0
  62. package/dist/acp/AcpRuntimeEventMapper.d.ts +16 -0
  63. package/dist/acp/AcpRuntimeEventMapper.d.ts.map +1 -0
  64. package/dist/acp/AcpRuntimeEventMapper.js +326 -0
  65. package/dist/acp/AcpRuntimeEventMapper.js.map +1 -0
  66. package/dist/acp/AcpSessionService.d.ts +65 -0
  67. package/dist/acp/AcpSessionService.d.ts.map +1 -0
  68. package/dist/acp/AcpSessionService.js +931 -0
  69. package/dist/acp/AcpSessionService.js.map +1 -0
  70. package/dist/acp/DurableAcpPermissionPolicyStore.d.ts +25 -0
  71. package/dist/acp/DurableAcpPermissionPolicyStore.d.ts.map +1 -0
  72. package/dist/acp/DurableAcpPermissionPolicyStore.js +100 -0
  73. package/dist/acp/DurableAcpPermissionPolicyStore.js.map +1 -0
  74. package/dist/acp/acpCommandSafety.d.ts +63 -0
  75. package/dist/acp/acpCommandSafety.d.ts.map +1 -0
  76. package/dist/acp/acpCommandSafety.js +90 -0
  77. package/dist/acp/acpCommandSafety.js.map +1 -0
  78. package/dist/acp/acpErrors.d.ts +47 -0
  79. package/dist/acp/acpErrors.d.ts.map +1 -0
  80. package/dist/acp/acpErrors.js +93 -0
  81. package/dist/acp/acpErrors.js.map +1 -0
  82. package/dist/acp/acpRedaction.d.ts +9 -0
  83. package/dist/acp/acpRedaction.d.ts.map +1 -0
  84. package/dist/acp/acpRedaction.js +69 -0
  85. package/dist/acp/acpRedaction.js.map +1 -0
  86. package/dist/acp/acpSessionResume.d.ts +8 -0
  87. package/dist/acp/acpSessionResume.d.ts.map +1 -0
  88. package/dist/acp/acpSessionResume.js +31 -0
  89. package/dist/acp/acpSessionResume.js.map +1 -0
  90. package/dist/acp/acpTypes.d.ts +467 -0
  91. package/dist/acp/acpTypes.d.ts.map +1 -0
  92. package/dist/acp/acpTypes.js +2 -0
  93. package/dist/acp/acpTypes.js.map +1 -0
  94. package/dist/agent/chooseDirectoryBridge.d.ts +29 -0
  95. package/dist/agent/chooseDirectoryBridge.d.ts.map +1 -0
  96. package/dist/agent/chooseDirectoryBridge.js +116 -0
  97. package/dist/agent/chooseDirectoryBridge.js.map +1 -0
  98. package/dist/agent/permissionProfiles.d.ts +29 -0
  99. package/dist/agent/permissionProfiles.d.ts.map +1 -0
  100. package/dist/agent/permissionProfiles.js +107 -0
  101. package/dist/agent/permissionProfiles.js.map +1 -0
  102. package/dist/agent/runtimeAuthorityPrompt.d.ts +13 -0
  103. package/dist/agent/runtimeAuthorityPrompt.d.ts.map +1 -0
  104. package/dist/agent/runtimeAuthorityPrompt.js +45 -0
  105. package/dist/agent/runtimeAuthorityPrompt.js.map +1 -0
  106. package/dist/agent/runtimeModeOutputGuard.d.ts +6 -0
  107. package/dist/agent/runtimeModeOutputGuard.d.ts.map +1 -0
  108. package/dist/agent/runtimeModeOutputGuard.js +40 -0
  109. package/dist/agent/runtimeModeOutputGuard.js.map +1 -0
  110. package/dist/agent/workspacePlacementBridge.d.ts +29 -0
  111. package/dist/agent/workspacePlacementBridge.d.ts.map +1 -0
  112. package/dist/agent/workspacePlacementBridge.js +143 -0
  113. package/dist/agent/workspacePlacementBridge.js.map +1 -0
  114. package/dist/agentSearch/AgentSearchService.d.ts +81 -0
  115. package/dist/agentSearch/AgentSearchService.d.ts.map +1 -0
  116. package/dist/agentSearch/AgentSearchService.js +1038 -0
  117. package/dist/agentSearch/AgentSearchService.js.map +1 -0
  118. package/dist/agentSearch/JsonInvertedIndexAdapter.d.ts +44 -0
  119. package/dist/agentSearch/JsonInvertedIndexAdapter.d.ts.map +1 -0
  120. package/dist/agentSearch/JsonInvertedIndexAdapter.js +307 -0
  121. package/dist/agentSearch/JsonInvertedIndexAdapter.js.map +1 -0
  122. package/dist/agentSearch/SearchIndexAdapter.d.ts +33 -0
  123. package/dist/agentSearch/SearchIndexAdapter.d.ts.map +1 -0
  124. package/dist/agentSearch/SearchIndexAdapter.js +2 -0
  125. package/dist/agentSearch/SearchIndexAdapter.js.map +1 -0
  126. package/dist/agentSearch/SearchSourceWatcher.d.ts +29 -0
  127. package/dist/agentSearch/SearchSourceWatcher.d.ts.map +1 -0
  128. package/dist/agentSearch/SearchSourceWatcher.js +150 -0
  129. package/dist/agentSearch/SearchSourceWatcher.js.map +1 -0
  130. package/dist/agentSearch/SqliteFtsIndexAdapter.d.ts +58 -0
  131. package/dist/agentSearch/SqliteFtsIndexAdapter.d.ts.map +1 -0
  132. package/dist/agentSearch/SqliteFtsIndexAdapter.js +420 -0
  133. package/dist/agentSearch/SqliteFtsIndexAdapter.js.map +1 -0
  134. package/dist/agentSearch/conversationIndexer.d.ts +69 -0
  135. package/dist/agentSearch/conversationIndexer.d.ts.map +1 -0
  136. package/dist/agentSearch/conversationIndexer.js +313 -0
  137. package/dist/agentSearch/conversationIndexer.js.map +1 -0
  138. package/dist/agentSearch/searchTypes.d.ts +264 -0
  139. package/dist/agentSearch/searchTypes.d.ts.map +1 -0
  140. package/dist/agentSearch/searchTypes.js +2 -0
  141. package/dist/agentSearch/searchTypes.js.map +1 -0
  142. package/dist/agentSearch/searchUtils.d.ts +12 -0
  143. package/dist/agentSearch/searchUtils.d.ts.map +1 -0
  144. package/dist/agentSearch/searchUtils.js +125 -0
  145. package/dist/agentSearch/searchUtils.js.map +1 -0
  146. package/dist/agentSearch/workspaceMetadataIndexer.d.ts +3 -0
  147. package/dist/agentSearch/workspaceMetadataIndexer.d.ts.map +1 -0
  148. package/dist/agentSearch/workspaceMetadataIndexer.js +125 -0
  149. package/dist/agentSearch/workspaceMetadataIndexer.js.map +1 -0
  150. package/dist/cli/CliControlPlaneService.d.ts +269 -0
  151. package/dist/cli/CliControlPlaneService.d.ts.map +1 -0
  152. package/dist/cli/CliControlPlaneService.js +1874 -0
  153. package/dist/cli/CliControlPlaneService.js.map +1 -0
  154. package/dist/cloud/XenoCloudAgentTurnExecutionAdapter.d.ts +91 -0
  155. package/dist/cloud/XenoCloudAgentTurnExecutionAdapter.d.ts.map +1 -0
  156. package/dist/cloud/XenoCloudAgentTurnExecutionAdapter.js +379 -0
  157. package/dist/cloud/XenoCloudAgentTurnExecutionAdapter.js.map +1 -0
  158. package/dist/codebase/CodebaseIntelligenceService.d.ts +68 -0
  159. package/dist/codebase/CodebaseIntelligenceService.d.ts.map +1 -0
  160. package/dist/codebase/CodebaseIntelligenceService.js +1717 -0
  161. package/dist/codebase/CodebaseIntelligenceService.js.map +1 -0
  162. package/dist/codebase/LanguageServerProcessManager.d.ts +85 -0
  163. package/dist/codebase/LanguageServerProcessManager.d.ts.map +1 -0
  164. package/dist/codebase/LanguageServerProcessManager.js +607 -0
  165. package/dist/codebase/LanguageServerProcessManager.js.map +1 -0
  166. package/dist/codebase/codeTypes.d.ts +485 -0
  167. package/dist/codebase/codeTypes.d.ts.map +1 -0
  168. package/dist/codebase/codeTypes.js +2 -0
  169. package/dist/codebase/codeTypes.js.map +1 -0
  170. package/dist/codebase/codeUtils.d.ts +24 -0
  171. package/dist/codebase/codeUtils.d.ts.map +1 -0
  172. package/dist/codebase/codeUtils.js +177 -0
  173. package/dist/codebase/codeUtils.js.map +1 -0
  174. package/dist/codebase/contextPacks.d.ts +18 -0
  175. package/dist/codebase/contextPacks.d.ts.map +1 -0
  176. package/dist/codebase/contextPacks.js +180 -0
  177. package/dist/codebase/contextPacks.js.map +1 -0
  178. package/dist/codebase/dependencyGraph.d.ts +3 -0
  179. package/dist/codebase/dependencyGraph.d.ts.map +1 -0
  180. package/dist/codebase/dependencyGraph.js +209 -0
  181. package/dist/codebase/dependencyGraph.js.map +1 -0
  182. package/dist/codebase/fileIndexer.d.ts +27 -0
  183. package/dist/codebase/fileIndexer.d.ts.map +1 -0
  184. package/dist/codebase/fileIndexer.js +167 -0
  185. package/dist/codebase/fileIndexer.js.map +1 -0
  186. package/dist/codebase/symbolIndexer.d.ts +3 -0
  187. package/dist/codebase/symbolIndexer.d.ts.map +1 -0
  188. package/dist/codebase/symbolIndexer.js +184 -0
  189. package/dist/codebase/symbolIndexer.js.map +1 -0
  190. package/dist/codebase/whatChanged.d.ts +4 -0
  191. package/dist/codebase/whatChanged.d.ts.map +1 -0
  192. package/dist/codebase/whatChanged.js +138 -0
  193. package/dist/codebase/whatChanged.js.map +1 -0
  194. package/dist/coordination/CoordinationService.d.ts +166 -0
  195. package/dist/coordination/CoordinationService.d.ts.map +1 -0
  196. package/dist/coordination/CoordinationService.js +247 -0
  197. package/dist/coordination/CoordinationService.js.map +1 -0
  198. package/dist/coordination/claims.d.ts +122 -0
  199. package/dist/coordination/claims.d.ts.map +1 -0
  200. package/dist/coordination/claims.js +196 -0
  201. package/dist/coordination/claims.js.map +1 -0
  202. package/dist/coordination/coordinationTools.d.ts +40 -0
  203. package/dist/coordination/coordinationTools.d.ts.map +1 -0
  204. package/dist/coordination/coordinationTools.js +92 -0
  205. package/dist/coordination/coordinationTools.js.map +1 -0
  206. package/dist/coordination/laneBridge.d.ts +84 -0
  207. package/dist/coordination/laneBridge.d.ts.map +1 -0
  208. package/dist/coordination/laneBridge.js +86 -0
  209. package/dist/coordination/laneBridge.js.map +1 -0
  210. package/dist/coordination/messages.d.ts +225 -0
  211. package/dist/coordination/messages.d.ts.map +1 -0
  212. package/dist/coordination/messages.js +335 -0
  213. package/dist/coordination/messages.js.map +1 -0
  214. package/dist/coordination/permissionWaitRegistry.d.ts +32 -0
  215. package/dist/coordination/permissionWaitRegistry.d.ts.map +1 -0
  216. package/dist/coordination/permissionWaitRegistry.js +59 -0
  217. package/dist/coordination/permissionWaitRegistry.js.map +1 -0
  218. package/dist/coordination/query.d.ts +187 -0
  219. package/dist/coordination/query.d.ts.map +1 -0
  220. package/dist/coordination/query.js +138 -0
  221. package/dist/coordination/query.js.map +1 -0
  222. package/dist/coordination/renderInbox.d.ts +15 -0
  223. package/dist/coordination/renderInbox.d.ts.map +1 -0
  224. package/dist/coordination/renderInbox.js +19 -0
  225. package/dist/coordination/renderInbox.js.map +1 -0
  226. package/dist/coordination/runtimeEvents.d.ts +53 -0
  227. package/dist/coordination/runtimeEvents.d.ts.map +1 -0
  228. package/dist/coordination/runtimeEvents.js +112 -0
  229. package/dist/coordination/runtimeEvents.js.map +1 -0
  230. package/dist/detachedHostService.d.ts +77 -0
  231. package/dist/detachedHostService.d.ts.map +1 -0
  232. package/dist/detachedHostService.js +66 -0
  233. package/dist/detachedHostService.js.map +1 -0
  234. package/dist/detachedHostSupervisor.d.ts +102 -0
  235. package/dist/detachedHostSupervisor.d.ts.map +1 -0
  236. package/dist/detachedHostSupervisor.js +168 -0
  237. package/dist/detachedHostSupervisor.js.map +1 -0
  238. package/dist/durableRuntimeEventStore.d.ts +49 -0
  239. package/dist/durableRuntimeEventStore.d.ts.map +1 -0
  240. package/dist/durableRuntimeEventStore.js +364 -0
  241. package/dist/durableRuntimeEventStore.js.map +1 -0
  242. package/dist/engineering/EngineeringWorkbenchService.d.ts +142 -0
  243. package/dist/engineering/EngineeringWorkbenchService.d.ts.map +1 -0
  244. package/dist/engineering/EngineeringWorkbenchService.js +2301 -0
  245. package/dist/engineering/EngineeringWorkbenchService.js.map +1 -0
  246. package/dist/engineering/LandingService.d.ts +112 -0
  247. package/dist/engineering/LandingService.d.ts.map +1 -0
  248. package/dist/engineering/LandingService.js +239 -0
  249. package/dist/engineering/LandingService.js.map +1 -0
  250. package/dist/engineering/engineeringTypes.d.ts +2 -0
  251. package/dist/engineering/engineeringTypes.d.ts.map +1 -0
  252. package/dist/engineering/engineeringTypes.js +2 -0
  253. package/dist/engineering/engineeringTypes.js.map +1 -0
  254. package/dist/engineering/patchReview.d.ts +11 -0
  255. package/dist/engineering/patchReview.d.ts.map +1 -0
  256. package/dist/engineering/patchReview.js +174 -0
  257. package/dist/engineering/patchReview.js.map +1 -0
  258. package/dist/index.d.ts +834 -0
  259. package/dist/index.d.ts.map +1 -0
  260. package/dist/index.js +3242 -0
  261. package/dist/index.js.map +1 -0
  262. package/dist/intake/IntakeService.d.ts +84 -0
  263. package/dist/intake/IntakeService.d.ts.map +1 -0
  264. package/dist/intake/IntakeService.js +117 -0
  265. package/dist/intake/IntakeService.js.map +1 -0
  266. package/dist/intake/RepositoryTodoIntakeSource.d.ts +72 -0
  267. package/dist/intake/RepositoryTodoIntakeSource.d.ts.map +1 -0
  268. package/dist/intake/RepositoryTodoIntakeSource.js +168 -0
  269. package/dist/intake/RepositoryTodoIntakeSource.js.map +1 -0
  270. package/dist/intake/WorkspaceTodoIntakeSource.d.ts +53 -0
  271. package/dist/intake/WorkspaceTodoIntakeSource.d.ts.map +1 -0
  272. package/dist/intake/WorkspaceTodoIntakeSource.js +81 -0
  273. package/dist/intake/WorkspaceTodoIntakeSource.js.map +1 -0
  274. package/dist/isolation/CommandExecution.d.ts +132 -0
  275. package/dist/isolation/CommandExecution.d.ts.map +1 -0
  276. package/dist/isolation/CommandExecution.js +48 -0
  277. package/dist/isolation/CommandExecution.js.map +1 -0
  278. package/dist/isolation/LocalCommandExecutor.d.ts +27 -0
  279. package/dist/isolation/LocalCommandExecutor.d.ts.map +1 -0
  280. package/dist/isolation/LocalCommandExecutor.js +97 -0
  281. package/dist/isolation/LocalCommandExecutor.js.map +1 -0
  282. package/dist/isolation/RunExecutionEnvironment.d.ts +135 -0
  283. package/dist/isolation/RunExecutionEnvironment.d.ts.map +1 -0
  284. package/dist/isolation/RunExecutionEnvironment.js +206 -0
  285. package/dist/isolation/RunExecutionEnvironment.js.map +1 -0
  286. package/dist/isolation/RunIsolationService.d.ts +90 -0
  287. package/dist/isolation/RunIsolationService.d.ts.map +1 -0
  288. package/dist/isolation/RunIsolationService.js +86 -0
  289. package/dist/isolation/RunIsolationService.js.map +1 -0
  290. package/dist/isolation/SandboxCommandExecutor.d.ts +93 -0
  291. package/dist/isolation/SandboxCommandExecutor.d.ts.map +1 -0
  292. package/dist/isolation/SandboxCommandExecutor.js +189 -0
  293. package/dist/isolation/SandboxCommandExecutor.js.map +1 -0
  294. package/dist/knowledge/WorkspaceKnowledgeService.d.ts +71 -0
  295. package/dist/knowledge/WorkspaceKnowledgeService.d.ts.map +1 -0
  296. package/dist/knowledge/WorkspaceKnowledgeService.js +103 -0
  297. package/dist/knowledge/WorkspaceKnowledgeService.js.map +1 -0
  298. package/dist/localHostAuthority.d.ts +24 -0
  299. package/dist/localHostAuthority.d.ts.map +1 -0
  300. package/dist/localHostAuthority.js +87 -0
  301. package/dist/localHostAuthority.js.map +1 -0
  302. package/dist/localHostLease.d.ts +51 -0
  303. package/dist/localHostLease.d.ts.map +1 -0
  304. package/dist/localHostLease.js +167 -0
  305. package/dist/localHostLease.js.map +1 -0
  306. package/dist/localHostPaths.d.ts +30 -0
  307. package/dist/localHostPaths.d.ts.map +1 -0
  308. package/dist/localHostPaths.js +60 -0
  309. package/dist/localHostPaths.js.map +1 -0
  310. package/dist/localRpcTransport.d.ts +21 -0
  311. package/dist/localRpcTransport.d.ts.map +1 -0
  312. package/dist/localRpcTransport.js +423 -0
  313. package/dist/localRpcTransport.js.map +1 -0
  314. package/dist/node.d.ts +104 -0
  315. package/dist/node.d.ts.map +1 -0
  316. package/dist/node.js +103 -0
  317. package/dist/node.js.map +1 -0
  318. package/dist/observation/DirectoryBaselineScanner.d.ts +44 -0
  319. package/dist/observation/DirectoryBaselineScanner.d.ts.map +1 -0
  320. package/dist/observation/DirectoryBaselineScanner.js +112 -0
  321. package/dist/observation/DirectoryBaselineScanner.js.map +1 -0
  322. package/dist/observation/MountContentReader.d.ts +63 -0
  323. package/dist/observation/MountContentReader.d.ts.map +1 -0
  324. package/dist/observation/MountContentReader.js +158 -0
  325. package/dist/observation/MountContentReader.js.map +1 -0
  326. package/dist/observation/RunObservationService.d.ts +229 -0
  327. package/dist/observation/RunObservationService.d.ts.map +1 -0
  328. package/dist/observation/RunObservationService.js +248 -0
  329. package/dist/observation/RunObservationService.js.map +1 -0
  330. package/dist/observation/XenoUseObservationSource.d.ts +42 -0
  331. package/dist/observation/XenoUseObservationSource.d.ts.map +1 -0
  332. package/dist/observation/XenoUseObservationSource.js +104 -0
  333. package/dist/observation/XenoUseObservationSource.js.map +1 -0
  334. package/dist/observation/XenoUseRunObserver.d.ts +140 -0
  335. package/dist/observation/XenoUseRunObserver.d.ts.map +1 -0
  336. package/dist/observation/XenoUseRunObserver.js +256 -0
  337. package/dist/observation/XenoUseRunObserver.js.map +1 -0
  338. package/dist/pluginMcp/PluginMcpManagerService.d.ts +141 -0
  339. package/dist/pluginMcp/PluginMcpManagerService.d.ts.map +1 -0
  340. package/dist/pluginMcp/PluginMcpManagerService.js +1821 -0
  341. package/dist/pluginMcp/PluginMcpManagerService.js.map +1 -0
  342. package/dist/pluginMcp/pluginMcpTypes.d.ts +349 -0
  343. package/dist/pluginMcp/pluginMcpTypes.d.ts.map +1 -0
  344. package/dist/pluginMcp/pluginMcpTypes.js +2 -0
  345. package/dist/pluginMcp/pluginMcpTypes.js.map +1 -0
  346. package/dist/policy/WorkspacePolicyService.d.ts +83 -0
  347. package/dist/policy/WorkspacePolicyService.d.ts.map +1 -0
  348. package/dist/policy/WorkspacePolicyService.js +809 -0
  349. package/dist/policy/WorkspacePolicyService.js.map +1 -0
  350. package/dist/policy/policyGuard.d.ts +27 -0
  351. package/dist/policy/policyGuard.d.ts.map +1 -0
  352. package/dist/policy/policyGuard.js +143 -0
  353. package/dist/policy/policyGuard.js.map +1 -0
  354. package/dist/policy/policyTypes.d.ts +190 -0
  355. package/dist/policy/policyTypes.d.ts.map +1 -0
  356. package/dist/policy/policyTypes.js +2 -0
  357. package/dist/policy/policyTypes.js.map +1 -0
  358. package/dist/runtime/RuntimeEventStore.d.ts +42 -0
  359. package/dist/runtime/RuntimeEventStore.d.ts.map +1 -0
  360. package/dist/runtime/RuntimeEventStore.js +412 -0
  361. package/dist/runtime/RuntimeEventStore.js.map +1 -0
  362. package/dist/runtime/RuntimeEventStoreRepositoryAdapter.d.ts +21 -0
  363. package/dist/runtime/RuntimeEventStoreRepositoryAdapter.d.ts.map +1 -0
  364. package/dist/runtime/RuntimeEventStoreRepositoryAdapter.js +41 -0
  365. package/dist/runtime/RuntimeEventStoreRepositoryAdapter.js.map +1 -0
  366. package/dist/runtime/RuntimeTimelineProjection.d.ts +5 -0
  367. package/dist/runtime/RuntimeTimelineProjection.d.ts.map +1 -0
  368. package/dist/runtime/RuntimeTimelineProjection.js +705 -0
  369. package/dist/runtime/RuntimeTimelineProjection.js.map +1 -0
  370. package/dist/runtime/runtimeEventTypes.d.ts +73 -0
  371. package/dist/runtime/runtimeEventTypes.d.ts.map +1 -0
  372. package/dist/runtime/runtimeEventTypes.js +2 -0
  373. package/dist/runtime/runtimeEventTypes.js.map +1 -0
  374. package/dist/sdk/SdkNativeAgentTurnExecutionAdapter.d.ts +117 -0
  375. package/dist/sdk/SdkNativeAgentTurnExecutionAdapter.d.ts.map +1 -0
  376. package/dist/sdk/SdkNativeAgentTurnExecutionAdapter.js +214 -0
  377. package/dist/sdk/SdkNativeAgentTurnExecutionAdapter.js.map +1 -0
  378. package/dist/session/AgentSessionService.d.ts +285 -0
  379. package/dist/session/AgentSessionService.d.ts.map +1 -0
  380. package/dist/session/AgentSessionService.js +444 -0
  381. package/dist/session/AgentSessionService.js.map +1 -0
  382. package/dist/session/bufferedSessionPty.d.ts +27 -0
  383. package/dist/session/bufferedSessionPty.d.ts.map +1 -0
  384. package/dist/session/bufferedSessionPty.js +49 -0
  385. package/dist/session/bufferedSessionPty.js.map +1 -0
  386. package/dist/session/renderSupport.d.ts +53 -0
  387. package/dist/session/renderSupport.d.ts.map +1 -0
  388. package/dist/session/renderSupport.js +41 -0
  389. package/dist/session/renderSupport.js.map +1 -0
  390. package/dist/session/runtimeEventChannel.d.ts +56 -0
  391. package/dist/session/runtimeEventChannel.d.ts.map +1 -0
  392. package/dist/session/runtimeEventChannel.js +53 -0
  393. package/dist/session/runtimeEventChannel.js.map +1 -0
  394. package/dist/state/JsonAgentStateRepository.d.ts +29 -0
  395. package/dist/state/JsonAgentStateRepository.d.ts.map +1 -0
  396. package/dist/state/JsonAgentStateRepository.js +165 -0
  397. package/dist/state/JsonAgentStateRepository.js.map +1 -0
  398. package/dist/state/SqliteAgentStateRepository.d.ts +58 -0
  399. package/dist/state/SqliteAgentStateRepository.d.ts.map +1 -0
  400. package/dist/state/SqliteAgentStateRepository.js +777 -0
  401. package/dist/state/SqliteAgentStateRepository.js.map +1 -0
  402. package/dist/state/createAgentStateRepository.d.ts +4 -0
  403. package/dist/state/createAgentStateRepository.d.ts.map +1 -0
  404. package/dist/state/createAgentStateRepository.js +12 -0
  405. package/dist/state/createAgentStateRepository.js.map +1 -0
  406. package/dist/state/stateSanitizers.d.ts +7 -0
  407. package/dist/state/stateSanitizers.d.ts.map +1 -0
  408. package/dist/state/stateSanitizers.js +87 -0
  409. package/dist/state/stateSanitizers.js.map +1 -0
  410. package/dist/subagents/AcpSubagentExecutionAdapter.d.ts +12 -0
  411. package/dist/subagents/AcpSubagentExecutionAdapter.d.ts.map +1 -0
  412. package/dist/subagents/AcpSubagentExecutionAdapter.js +119 -0
  413. package/dist/subagents/AcpSubagentExecutionAdapter.js.map +1 -0
  414. package/dist/subagents/CliSubagentExecutionAdapter.d.ts +13 -0
  415. package/dist/subagents/CliSubagentExecutionAdapter.d.ts.map +1 -0
  416. package/dist/subagents/CliSubagentExecutionAdapter.js +217 -0
  417. package/dist/subagents/CliSubagentExecutionAdapter.js.map +1 -0
  418. package/dist/subagents/HostTurnSubagentExecutionAdapter.d.ts +78 -0
  419. package/dist/subagents/HostTurnSubagentExecutionAdapter.d.ts.map +1 -0
  420. package/dist/subagents/HostTurnSubagentExecutionAdapter.js +160 -0
  421. package/dist/subagents/HostTurnSubagentExecutionAdapter.js.map +1 -0
  422. package/dist/subagents/SubagentRunService.d.ts +103 -0
  423. package/dist/subagents/SubagentRunService.d.ts.map +1 -0
  424. package/dist/subagents/SubagentRunService.js +1183 -0
  425. package/dist/subagents/SubagentRunService.js.map +1 -0
  426. package/dist/subagents/SubagentScheduler.d.ts +167 -0
  427. package/dist/subagents/SubagentScheduler.d.ts.map +1 -0
  428. package/dist/subagents/SubagentScheduler.js +530 -0
  429. package/dist/subagents/SubagentScheduler.js.map +1 -0
  430. package/dist/subagents/TeamAgentRouter.d.ts +104 -0
  431. package/dist/subagents/TeamAgentRouter.d.ts.map +1 -0
  432. package/dist/subagents/TeamAgentRouter.js +435 -0
  433. package/dist/subagents/TeamAgentRouter.js.map +1 -0
  434. package/dist/subagents/capabilityMatcher.d.ts +3 -0
  435. package/dist/subagents/capabilityMatcher.d.ts.map +1 -0
  436. package/dist/subagents/capabilityMatcher.js +127 -0
  437. package/dist/subagents/capabilityMatcher.js.map +1 -0
  438. package/dist/subagents/subagentRunPort.d.ts +43 -0
  439. package/dist/subagents/subagentRunPort.d.ts.map +1 -0
  440. package/dist/subagents/subagentRunPort.js +24 -0
  441. package/dist/subagents/subagentRunPort.js.map +1 -0
  442. package/dist/subagents/subagentTypes.d.ts +330 -0
  443. package/dist/subagents/subagentTypes.d.ts.map +1 -0
  444. package/dist/subagents/subagentTypes.js +2 -0
  445. package/dist/subagents/subagentTypes.js.map +1 -0
  446. package/dist/subagents/subagentWorkspaceAuthority.d.ts +29 -0
  447. package/dist/subagents/subagentWorkspaceAuthority.d.ts.map +1 -0
  448. package/dist/subagents/subagentWorkspaceAuthority.js +173 -0
  449. package/dist/subagents/subagentWorkspaceAuthority.js.map +1 -0
  450. package/dist/support/SupportDiagnosticsService.d.ts +87 -0
  451. package/dist/support/SupportDiagnosticsService.d.ts.map +1 -0
  452. package/dist/support/SupportDiagnosticsService.js +1199 -0
  453. package/dist/support/SupportDiagnosticsService.js.map +1 -0
  454. package/dist/turns/DurableInterruptedTurnStore.d.ts +14 -0
  455. package/dist/turns/DurableInterruptedTurnStore.d.ts.map +1 -0
  456. package/dist/turns/DurableInterruptedTurnStore.js +63 -0
  457. package/dist/turns/DurableInterruptedTurnStore.js.map +1 -0
  458. package/dist/turns/interruptedTurns.d.ts +50 -0
  459. package/dist/turns/interruptedTurns.d.ts.map +1 -0
  460. package/dist/turns/interruptedTurns.js +54 -0
  461. package/dist/turns/interruptedTurns.js.map +1 -0
  462. package/dist/turns/turnAdmission.d.ts +113 -0
  463. package/dist/turns/turnAdmission.d.ts.map +1 -0
  464. package/dist/turns/turnAdmission.js +136 -0
  465. package/dist/turns/turnAdmission.js.map +1 -0
  466. package/dist/workspace/WorkspaceHostService.d.ts +126 -0
  467. package/dist/workspace/WorkspaceHostService.d.ts.map +1 -0
  468. package/dist/workspace/WorkspaceHostService.js +841 -0
  469. package/dist/workspace/WorkspaceHostService.js.map +1 -0
  470. package/dist/workspace/WorkspaceShellService.d.ts +71 -0
  471. package/dist/workspace/WorkspaceShellService.d.ts.map +1 -0
  472. package/dist/workspace/WorkspaceShellService.js +273 -0
  473. package/dist/workspace/WorkspaceShellService.js.map +1 -0
  474. package/dist/workspace/fileAssociations.d.ts +12 -0
  475. package/dist/workspace/fileAssociations.d.ts.map +1 -0
  476. package/dist/workspace/fileAssociations.js +202 -0
  477. package/dist/workspace/fileAssociations.js.map +1 -0
  478. package/dist/workspace/scrollbackBuffer.d.ts +48 -0
  479. package/dist/workspace/scrollbackBuffer.d.ts.map +1 -0
  480. package/dist/workspace/scrollbackBuffer.js +94 -0
  481. package/dist/workspace/scrollbackBuffer.js.map +1 -0
  482. package/package.json +42 -0
@@ -0,0 +1,59 @@
1
+ export function createPermissionWaitRegistry() {
2
+ const entries = new Map();
3
+ const listeners = new Set();
4
+ const outstanding = (requestId) => {
5
+ if (!requestId)
6
+ return 0;
7
+ let count = 0;
8
+ for (const entry of entries.values()) {
9
+ if (entry.requestId === requestId)
10
+ count += 1;
11
+ }
12
+ return count;
13
+ };
14
+ const announce = (requestId, waiting) => {
15
+ if (!requestId)
16
+ return;
17
+ for (const listener of [...listeners]) {
18
+ // Contained: a listener that throws must not break the permission flow it
19
+ // is only observing. Losing the report costs a peer an accurate state;
20
+ // losing the prompt would hang the turn.
21
+ try {
22
+ listener(requestId, waiting);
23
+ }
24
+ catch { /* observer's fault, not ours */ }
25
+ }
26
+ };
27
+ return {
28
+ set(key, entry) {
29
+ const before = outstanding(entry.requestId);
30
+ entries.set(key, entry);
31
+ // The FIRST outstanding prompt is what makes a run blocked; a second
32
+ // concurrent one does not make it more blocked, and announcing again
33
+ // would have a listener count transitions rather than read a state.
34
+ if (before === 0)
35
+ announce(entry.requestId, true);
36
+ },
37
+ get(key) {
38
+ return entries.get(key);
39
+ },
40
+ delete(key) {
41
+ const entry = entries.get(key);
42
+ const removed = entries.delete(key);
43
+ // The LAST removal clears it. Announcing on every resolution would report
44
+ // a run free while another prompt is still on screen.
45
+ if (removed && entry && outstanding(entry.requestId) === 0) {
46
+ announce(entry.requestId, false);
47
+ }
48
+ return removed;
49
+ },
50
+ entries() {
51
+ return entries.entries();
52
+ },
53
+ onChange(listener) {
54
+ listeners.add(listener);
55
+ return () => { listeners.delete(listener); };
56
+ },
57
+ };
58
+ }
59
+ //# sourceMappingURL=permissionWaitRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permissionWaitRegistry.js","sourceRoot":"","sources":["../../src/coordination/permissionWaitRegistry.ts"],"names":[],"mappings":"AAiCA,MAAM,UAAU,4BAA4B;IAC1C,MAAM,OAAO,GAAG,IAAI,GAAG,EAAa,CAAA;IACpC,MAAM,SAAS,GAAG,IAAI,GAAG,EAA0B,CAAA;IAEnD,MAAM,WAAW,GAAG,CAAC,SAA6B,EAAU,EAAE;QAC5D,IAAI,CAAC,SAAS;YAAE,OAAO,CAAC,CAAA;QACxB,IAAI,KAAK,GAAG,CAAC,CAAA;QACb,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;YACrC,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS;gBAAE,KAAK,IAAI,CAAC,CAAA;QAC/C,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC,CAAA;IAED,MAAM,QAAQ,GAAG,CAAC,SAA6B,EAAE,OAAgB,EAAQ,EAAE;QACzE,IAAI,CAAC,SAAS;YAAE,OAAM;QACtB,KAA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CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA,CAAC,CAAC,CAAA;QAC7C,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,187 @@
1
+ /**
2
+ * Query — the pull half of coordination.
3
+ *
4
+ * `XENO_AGENT_COORDINATION_SPEC.md` §7: messaging is a notification channel, but
5
+ * because runs share a host an agent can also **ask**. That changes the
6
+ * coordination style from *"hope someone told me"* to *"check before you act"*,
7
+ * which the spec calls the only version that scales past a handful of agents.
8
+ *
9
+ * > "This is the capability a peer-to-peer design cannot offer, because peers
10
+ * > hold no shared state."
11
+ *
12
+ * ## Summary, never transcript — enforced by the type, not by discipline
13
+ *
14
+ * Gate 9 requires `run.summary` to return a summary and **never** a transcript
15
+ * or file contents, and §2.3's rule holds for pull as well as push: moving whole
16
+ * context between runs "prevents context bleeding between runs that the user
17
+ * separated on purpose".
18
+ *
19
+ * So `RunSummary` has **no field capable of holding one**. There is no
20
+ * `transcript`, no `messages`, no `contents`, no `diff` — `filesTouched` is a
21
+ * list of PATHS. A reviewer checking this rule reads the type, not the call
22
+ * sites, and a future field that could carry content has to be added
23
+ * deliberately rather than slipped in.
24
+ *
25
+ * ## Truncation is reported, never silent
26
+ *
27
+ * A summary is bounded, because an unbounded one is a transcript wearing a
28
+ * different name. When the caps bite, the result SAYS SO: a shortened list that
29
+ * does not announce itself is indistinguishable from a run that touched fewer
30
+ * files, and the reader would draw a conclusion from an absence that is an
31
+ * artefact.
32
+ */
33
+ import type { Claim, ClaimScope } from './claims.js';
34
+ import type { RunPosture } from './messages.js';
35
+ export type RunState = 'idle' | 'running' | 'awaiting-approval' | 'stopped';
36
+ /** What a peer looks like from another run (§3, §7). */
37
+ /**
38
+ * A run's activity changed — ADE §5.2b, §7's "last decision".
39
+ *
40
+ * 🔴 `awaiting-approval` is a DECLARED state that nothing ever produced, and
41
+ * the gap is not cosmetic: a peer deciding whether to wait for a run or take
42
+ * the work itself needs "blocked on a human" to look different from "busy". A
43
+ * run reported `running` while it sits on a permission prompt is the one case
44
+ * where waiting is guaranteed to be wrong.
45
+ */
46
+ export interface RunActivitySignal {
47
+ runId: string;
48
+ state: RunState;
49
+ /** §7's fourth summary field. Absent means "no change", never "none". */
50
+ lastDecision?: string;
51
+ }
52
+ export type RunActivityListener = (signal: RunActivitySignal) => void;
53
+ export interface PeerDescriptor {
54
+ runId: string;
55
+ /** Human-readable, defaults from the workspace, settable by the user (§3). */
56
+ name: string;
57
+ state: RunState;
58
+ /** Workspace IDENTITY so a human can disambiguate — never its contents. */
59
+ workspace: string;
60
+ }
61
+ /**
62
+ * What a run has changed, as §7 defines it: "files touched, commands run,
63
+ * current claim set, last decision."
64
+ */
65
+ export interface RunSummary {
66
+ runId: string;
67
+ name: string;
68
+ state: RunState;
69
+ workspace: string;
70
+ /** Paths only. There is deliberately no field for their contents. */
71
+ filesTouched: string[];
72
+ commandsRun: string[];
73
+ /**
74
+ * False when the lists above are not the whole story — see `RunRecord`.
75
+ *
76
+ * Distinct from `truncated`, which says a complete account was CUT to a cap.
77
+ * This says the account was never complete to begin with, and the reader's
78
+ * next action differs: ask for more versus do not conclude anything from an
79
+ * empty list.
80
+ */
81
+ complete: boolean;
82
+ claims: ClaimScope[];
83
+ /** One line. Not a transcript, not the reasoning that produced it. */
84
+ lastDecision?: string;
85
+ /**
86
+ * True when a cap shortened any list above.
87
+ *
88
+ * Present so a bounded summary cannot be mistaken for a complete one — the
89
+ * same reason the sandbox observation surface reports `degraded` rather than
90
+ * letting an empty result mean two different things.
91
+ */
92
+ truncated: boolean;
93
+ }
94
+ export interface RunRecord {
95
+ runId: string;
96
+ name: string;
97
+ state: RunState;
98
+ workspace: string;
99
+ filesTouched: string[];
100
+ commandsRun: string[];
101
+ lastDecision?: string;
102
+ /**
103
+ * Whether this account of what the run has done is WHOLE.
104
+ *
105
+ * 🔴 Defaults to false, and the default is the point. An empty
106
+ * `commandsRun` means "ran nothing" to whoever reads it, and a host that
107
+ * simply does not observe commands would be asserting that — the same
108
+ * empty-versus-unknown conflation `runSummary` already refuses when it
109
+ * returns `undefined` for an invisible run rather than an empty summary.
110
+ *
111
+ * Today the standalone host observes FILES and not commands: the process
112
+ * sensor lives behind `xeno-use` and this host consumes only the
113
+ * file-change port. So it registers runs with this false, and a peer reading
114
+ * the summary can tell "no commands" from "commands unknown".
115
+ */
116
+ complete?: boolean;
117
+ /**
118
+ * The capabilities this run is executing with — §6's derivation input.
119
+ *
120
+ * ⚠️ Optional, and absent means UNKNOWN rather than "no capabilities" — the
121
+ * same distinction `complete` above exists to preserve. A host that does not
122
+ * know a run's posture must not have that read as the most constrained
123
+ * posture, because a maximally-constrained *receiver* is precisely the case
124
+ * that holds everything, and a maximally-constrained *sender* is the case that
125
+ * is never held. Guessing in either direction would be a safety decision
126
+ * disguised as a default; `deriveInboundPolicy` refuses to compare instead.
127
+ *
128
+ * Not part of `RunSummary`: §7 answers what a run has CHANGED, and a peer
129
+ * learning exactly which capabilities another run holds is reconnaissance,
130
+ * not coordination.
131
+ */
132
+ posture?: RunPosture;
133
+ }
134
+ export interface CoordinationQueryOptions {
135
+ maxFiles?: number;
136
+ maxCommands?: number;
137
+ /**
138
+ * Decides which runs a caller may see (§7: "every run the caller is permitted
139
+ * to see"). Defaults to same-workspace visibility, which is the conservative
140
+ * reading: a run should not learn that unrelated work exists just because it
141
+ * shares a host.
142
+ */
143
+ canSee?: (caller: RunRecord, candidate: RunRecord) => boolean;
144
+ }
145
+ /**
146
+ * The host's read side.
147
+ *
148
+ * Every method is a host call over host-held state. §3: "Discovery is a host
149
+ * query, never a filesystem scan" — which is also why this works across sandbox
150
+ * boundaries at all, since a container cannot scan a directory it cannot see.
151
+ */
152
+ export declare class CoordinationQuery {
153
+ #private;
154
+ constructor(options?: CoordinationQueryOptions);
155
+ upsertRun(record: RunRecord): void;
156
+ removeRun(runId: string): void;
157
+ /**
158
+ * §7 `coordination.peers.list`.
159
+ *
160
+ * A run that no window is attached to is still listed: §3 says addressing
161
+ * survives the disappearance of any surface, because the run lives in the
162
+ * host rather than in a window.
163
+ */
164
+ peers(callerRunId: string): PeerDescriptor[];
165
+ /**
166
+ * A run's permission posture, for §6's inbound-policy derivation.
167
+ *
168
+ * ⚠️ NOT a host method and NOT reachable by an agent — deliberately. It is
169
+ * read by the message bus inside the host to decide a policy; exposing it as a
170
+ * peer-visible fact would hand one agent an inventory of another's
171
+ * capabilities, which §7's summary-not-transcript rule exists to prevent.
172
+ *
173
+ * `undefined` for a run this registry has never seen AND for a registered run
174
+ * that carried no posture — both are honestly "unknown", and the caller must
175
+ * not be able to tell them apart, because it must treat them identically.
176
+ */
177
+ postureOf(runId: string): RunPosture | undefined;
178
+ /**
179
+ * §7 `coordination.run.summary`. Gate 9: a summary, never a transcript.
180
+ *
181
+ * Returns `undefined` rather than an empty summary when the caller may not see
182
+ * the run: an empty summary would report "this run changed nothing", which is
183
+ * a different and false statement from "you cannot see this run".
184
+ */
185
+ runSummary(callerRunId: string, targetRunId: string, claims: Claim[]): RunSummary | undefined;
186
+ }
187
+ //# sourceMappingURL=query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/coordination/query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/C,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,mBAAmB,GAAG,SAAS,CAAA;AAE3E,wDAAwD;AACxD;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,QAAQ,CAAA;IACf,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,iBAAiB,KAAK,I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G;AACH,qBAAa,iBAAiB;;gBAMhB,OAAO,GAAE,wBAA6B;IAmBlD,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IAIlC,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI9B;;;;;;OAMG;IACH,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,EAAE;IAa5C;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAIhD;;;;;;OAMG;IACH,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,GAAG,SAAS;CAyB9F"}
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Query — the pull half of coordination.
3
+ *
4
+ * `XENO_AGENT_COORDINATION_SPEC.md` §7: messaging is a notification channel, but
5
+ * because runs share a host an agent can also **ask**. That changes the
6
+ * coordination style from *"hope someone told me"* to *"check before you act"*,
7
+ * which the spec calls the only version that scales past a handful of agents.
8
+ *
9
+ * > "This is the capability a peer-to-peer design cannot offer, because peers
10
+ * > hold no shared state."
11
+ *
12
+ * ## Summary, never transcript — enforced by the type, not by discipline
13
+ *
14
+ * Gate 9 requires `run.summary` to return a summary and **never** a transcript
15
+ * or file contents, and §2.3's rule holds for pull as well as push: moving whole
16
+ * context between runs "prevents context bleeding between runs that the user
17
+ * separated on purpose".
18
+ *
19
+ * So `RunSummary` has **no field capable of holding one**. There is no
20
+ * `transcript`, no `messages`, no `contents`, no `diff` — `filesTouched` is a
21
+ * list of PATHS. A reviewer checking this rule reads the type, not the call
22
+ * sites, and a future field that could carry content has to be added
23
+ * deliberately rather than slipped in.
24
+ *
25
+ * ## Truncation is reported, never silent
26
+ *
27
+ * A summary is bounded, because an unbounded one is a transcript wearing a
28
+ * different name. When the caps bite, the result SAYS SO: a shortened list that
29
+ * does not announce itself is indistinguishable from a run that touched fewer
30
+ * files, and the reader would draw a conclusion from an absence that is an
31
+ * artefact.
32
+ */
33
+ const DEFAULT_MAX_FILES = 50;
34
+ const DEFAULT_MAX_COMMANDS = 25;
35
+ /**
36
+ * The host's read side.
37
+ *
38
+ * Every method is a host call over host-held state. §3: "Discovery is a host
39
+ * query, never a filesystem scan" — which is also why this works across sandbox
40
+ * boundaries at all, since a container cannot scan a directory it cannot see.
41
+ */
42
+ export class CoordinationQuery {
43
+ #runs = new Map();
44
+ #maxFiles;
45
+ #maxCommands;
46
+ #canSee;
47
+ constructor(options = {}) {
48
+ this.#maxFiles = options.maxFiles ?? DEFAULT_MAX_FILES;
49
+ this.#maxCommands = options.maxCommands ?? DEFAULT_MAX_COMMANDS;
50
+ /**
51
+ * 🔴 An UNIDENTIFIED workspace matches nothing, including another
52
+ * unidentified one.
53
+ *
54
+ * Plain string equality made two runs with no workspace id peers of each
55
+ * other, which is precisely what this rule exists to prevent: §7 says a run
56
+ * "should not learn that unrelated work exists just because it shares a
57
+ * host", and `''` is not evidence of shared work — it is the absence of
58
+ * evidence either way.
59
+ */
60
+ this.#canSee =
61
+ options.canSee
62
+ ?? ((caller, candidate) => caller.workspace !== '' && caller.workspace === candidate.workspace);
63
+ }
64
+ upsertRun(record) {
65
+ this.#runs.set(record.runId, record);
66
+ }
67
+ removeRun(runId) {
68
+ this.#runs.delete(runId);
69
+ }
70
+ /**
71
+ * §7 `coordination.peers.list`.
72
+ *
73
+ * A run that no window is attached to is still listed: §3 says addressing
74
+ * survives the disappearance of any surface, because the run lives in the
75
+ * host rather than in a window.
76
+ */
77
+ peers(callerRunId) {
78
+ const caller = this.#runs.get(callerRunId);
79
+ if (!caller)
80
+ return [];
81
+ return [...this.#runs.values()]
82
+ .filter((candidate) => candidate.runId !== callerRunId && this.#canSee(caller, candidate))
83
+ .map((candidate) => ({
84
+ runId: candidate.runId,
85
+ name: candidate.name,
86
+ state: candidate.state,
87
+ workspace: candidate.workspace,
88
+ }));
89
+ }
90
+ /**
91
+ * A run's permission posture, for §6's inbound-policy derivation.
92
+ *
93
+ * ⚠️ NOT a host method and NOT reachable by an agent — deliberately. It is
94
+ * read by the message bus inside the host to decide a policy; exposing it as a
95
+ * peer-visible fact would hand one agent an inventory of another's
96
+ * capabilities, which §7's summary-not-transcript rule exists to prevent.
97
+ *
98
+ * `undefined` for a run this registry has never seen AND for a registered run
99
+ * that carried no posture — both are honestly "unknown", and the caller must
100
+ * not be able to tell them apart, because it must treat them identically.
101
+ */
102
+ postureOf(runId) {
103
+ return this.#runs.get(runId)?.posture;
104
+ }
105
+ /**
106
+ * §7 `coordination.run.summary`. Gate 9: a summary, never a transcript.
107
+ *
108
+ * Returns `undefined` rather than an empty summary when the caller may not see
109
+ * the run: an empty summary would report "this run changed nothing", which is
110
+ * a different and false statement from "you cannot see this run".
111
+ */
112
+ runSummary(callerRunId, targetRunId, claims) {
113
+ const caller = this.#runs.get(callerRunId);
114
+ const target = this.#runs.get(targetRunId);
115
+ if (!caller || !target)
116
+ return undefined;
117
+ if (target.runId !== caller.runId && !this.#canSee(caller, target))
118
+ return undefined;
119
+ const files = target.filesTouched.slice(0, this.#maxFiles);
120
+ const commands = target.commandsRun.slice(0, this.#maxCommands);
121
+ return {
122
+ runId: target.runId,
123
+ name: target.name,
124
+ state: target.state,
125
+ workspace: target.workspace,
126
+ filesTouched: files,
127
+ commandsRun: commands,
128
+ complete: target.complete === true,
129
+ claims: claims
130
+ .filter((claim) => claim.runId === target.runId)
131
+ .map((claim) => claim.scope),
132
+ ...(target.lastDecision === undefined ? {} : { lastDecision: target.lastDecision }),
133
+ truncated: files.length < target.filesTouched.length ||
134
+ commands.length < target.commandsRun.length,
135
+ };
136
+ }
137
+ }
138
+ //# sourceMappingURL=query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/coordination/query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AA0HH,MAAM,iBAAiB,GAAG,EAAE,CAA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MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,CAAC;iBAC/C,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;YAC9B,GAAG,CAAC,MAAM,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC;YACnF,SAAS,EACP,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM;gBACzC,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM;SAC9C,CAAA;IACH,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ import type { DeliveredMessage } from './messages.js';
2
+ /**
3
+ * What a run's peers said, as text an agent will read — ADE §5.2b, §6.
4
+ *
5
+ * 🔴 A separate function because the DELIVERY and the WORDING fail
6
+ * differently: delivery is a host wire that either happens or does not, and the
7
+ * wording is a prompt-space decision. Keeping them apart is also what makes the
8
+ * wording assertable without starting a turn.
9
+ *
10
+ * Names the sender on every line. A message an agent cannot attribute is one it
11
+ * cannot reply to — and replying is a `CoordinationSend` away, which is the
12
+ * whole point of pushing these in rather than letting the agent poll.
13
+ */
14
+ export declare function renderInbox(delivered: readonly DeliveredMessage[]): string;
15
+ //# sourceMappingURL=renderInbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderInbox.d.ts","sourceRoot":"","sources":["../../src/coordination/renderInbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,SAAS,gBAAgB,EAAE,GAAG,MAAM,CAI1E"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * What a run's peers said, as text an agent will read — ADE §5.2b, §6.
3
+ *
4
+ * 🔴 A separate function because the DELIVERY and the WORDING fail
5
+ * differently: delivery is a host wire that either happens or does not, and the
6
+ * wording is a prompt-space decision. Keeping them apart is also what makes the
7
+ * wording assertable without starting a turn.
8
+ *
9
+ * Names the sender on every line. A message an agent cannot attribute is one it
10
+ * cannot reply to — and replying is a `CoordinationSend` away, which is the
11
+ * whole point of pushing these in rather than letting the agent poll.
12
+ */
13
+ export function renderInbox(delivered) {
14
+ if (delivered.length === 0)
15
+ return '';
16
+ const lines = delivered.map((item) => `- ${item.message.fromRunId}: ${item.message.text}`);
17
+ return lines.join('\n');
18
+ }
19
+ //# sourceMappingURL=renderInbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderInbox.js","sourceRoot":"","sources":["../../src/coordination/renderInbox.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,WAAW,CAAC,SAAsC;IAChE,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IACrC,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;IAC1F,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Coordination events as runtime-timeline events — the other half of gate 8.
3
+ *
4
+ * `XENO_AGENT_COORDINATION_SPEC.md` §9 sets the bar and states the consequence
5
+ * of missing it:
6
+ *
7
+ * > "Every message and every claim is a first-class runtime event, recorded in
8
+ * > the run timeline and the audit trail with sender, recipient, outcome and
9
+ * > timestamp… A reviewer looking at a surprising diff must be able to trace it
10
+ * > back to the message that prompted it. **If they cannot, this section is not
11
+ * > implemented.**"
12
+ *
13
+ * That is why the message TEXT is carried rather than only its id. A reviewer
14
+ * following an id to a message they cannot read has traced a pointer, not a
15
+ * reason — and §9's whole claim is that a message is "reviewable evidence of why
16
+ * a run changed course" rather than "an invisible nudge that changed an agent's
17
+ * behaviour for reasons a reviewer cannot reconstruct". Carrying the text costs
18
+ * nothing precisely because §2.3 already bounds a message to one line.
19
+ *
20
+ * ## Why this is an adapter and not a method on the service
21
+ *
22
+ * `CoordinationService` emits DOMAIN events and knows nothing about the event
23
+ * store; this maps them onto the timeline contract. Keeping the seam explicit
24
+ * means the coordination rules stay testable without a store, and the store's
25
+ * schema can change without touching them.
26
+ */
27
+ import type { AgentRuntimeEventDraft } from '@xenosystem/agent-interface-contract';
28
+ import type { CoordinationEvent } from './CoordinationService.js';
29
+ export interface CoordinationEventContext {
30
+ conversationId: string;
31
+ requestId: string;
32
+ workspaceId?: string;
33
+ agentId?: string;
34
+ }
35
+ /**
36
+ * Every coordination event shares this source, so a timeline query can select
37
+ * coordination without matching on each type — and a reviewer can see at a
38
+ * glance which lines are agents talking rather than an agent working.
39
+ */
40
+ export declare const COORDINATION_EVENT_SOURCE = "coordination";
41
+ /**
42
+ * Maps one coordination event onto a runtime-event draft.
43
+ *
44
+ * `sequence` is deliberately absent: the store assigns it. A caller inventing
45
+ * one would be asserting an ordering it cannot know, and two callers inventing
46
+ * them would silently interleave.
47
+ */
48
+ export declare function coordinationRuntimeEventDraft(event: CoordinationEvent, context: CoordinationEventContext, options: {
49
+ id: string;
50
+ timestamp: string;
51
+ text?: string;
52
+ }): AgentRuntimeEventDraft;
53
+ //# sourceMappingURL=runtimeEvents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeEvents.d.ts","sourceRoot":"","sources":["../../src/coordination/runtimeEvents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAA;AAGlF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAEjE,MAAM,WAAW,wBAAwB;IACvC,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,iBAAiB,CAAA;AAEvD;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,iBAAiB,EACxB,OAAO,EAAE,wBAAwB,EACjC,OAAO,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GACxD,sBAAsB,CAwExB"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Coordination events as runtime-timeline events — the other half of gate 8.
3
+ *
4
+ * `XENO_AGENT_COORDINATION_SPEC.md` §9 sets the bar and states the consequence
5
+ * of missing it:
6
+ *
7
+ * > "Every message and every claim is a first-class runtime event, recorded in
8
+ * > the run timeline and the audit trail with sender, recipient, outcome and
9
+ * > timestamp… A reviewer looking at a surprising diff must be able to trace it
10
+ * > back to the message that prompted it. **If they cannot, this section is not
11
+ * > implemented.**"
12
+ *
13
+ * That is why the message TEXT is carried rather than only its id. A reviewer
14
+ * following an id to a message they cannot read has traced a pointer, not a
15
+ * reason — and §9's whole claim is that a message is "reviewable evidence of why
16
+ * a run changed course" rather than "an invisible nudge that changed an agent's
17
+ * behaviour for reasons a reviewer cannot reconstruct". Carrying the text costs
18
+ * nothing precisely because §2.3 already bounds a message to one line.
19
+ *
20
+ * ## Why this is an adapter and not a method on the service
21
+ *
22
+ * `CoordinationService` emits DOMAIN events and knows nothing about the event
23
+ * store; this maps them onto the timeline contract. Keeping the seam explicit
24
+ * means the coordination rules stay testable without a store, and the store's
25
+ * schema can change without touching them.
26
+ */
27
+ import { describeClaimScope } from './claims.js';
28
+ /**
29
+ * Every coordination event shares this source, so a timeline query can select
30
+ * coordination without matching on each type — and a reviewer can see at a
31
+ * glance which lines are agents talking rather than an agent working.
32
+ */
33
+ export const COORDINATION_EVENT_SOURCE = 'coordination';
34
+ /**
35
+ * Maps one coordination event onto a runtime-event draft.
36
+ *
37
+ * `sequence` is deliberately absent: the store assigns it. A caller inventing
38
+ * one would be asserting an ordering it cannot know, and two callers inventing
39
+ * them would silently interleave.
40
+ */
41
+ export function coordinationRuntimeEventDraft(event, context, options) {
42
+ const base = {
43
+ conversationId: context.conversationId,
44
+ requestId: context.requestId,
45
+ ...(context.workspaceId === undefined ? {} : { workspaceId: context.workspaceId }),
46
+ ...(context.agentId === undefined ? {} : { agentId: context.agentId }),
47
+ source: COORDINATION_EVENT_SOURCE,
48
+ };
49
+ const envelope = {
50
+ id: options.id,
51
+ type: event.type,
52
+ timestamp: options.timestamp,
53
+ };
54
+ switch (event.type) {
55
+ case 'coordination.message.sent':
56
+ return {
57
+ ...base,
58
+ event: {
59
+ ...envelope,
60
+ fromRunId: event.fromRunId,
61
+ toRunId: event.toRunId,
62
+ messageId: event.messageId,
63
+ outcome: event.outcome,
64
+ // §9 requires sender, recipient, OUTCOME and timestamp. The outcome is
65
+ // what makes a refused or held message auditable rather than absent —
66
+ // a timeline showing only delivered messages would imply the others
67
+ // were never attempted.
68
+ ...(options.text === undefined ? {} : { text: options.text }),
69
+ },
70
+ };
71
+ case 'coordination.message.delivered':
72
+ return {
73
+ ...base,
74
+ event: {
75
+ ...envelope,
76
+ fromRunId: event.fromRunId,
77
+ toRunId: event.toRunId,
78
+ messageId: event.messageId,
79
+ // The text again, on the DELIVERY, because delivery is the moment the
80
+ // receiving run could have changed course — and that is the line a
81
+ // reviewer lands on when tracing a diff backwards.
82
+ ...(options.text === undefined ? {} : { text: options.text }),
83
+ },
84
+ };
85
+ case 'coordination.claim.acquired':
86
+ return {
87
+ ...base,
88
+ event: {
89
+ ...envelope,
90
+ runId: event.runId,
91
+ scope: describeClaimScope(event.scope),
92
+ claimId: event.claimId,
93
+ },
94
+ };
95
+ case 'coordination.claim.refused':
96
+ return {
97
+ ...base,
98
+ event: {
99
+ ...envelope,
100
+ runId: event.runId,
101
+ scope: describeClaimScope(event.scope),
102
+ // The holder, so the timeline records the COLLISION rather than just a
103
+ // failure. §5: the fleet view showing what is claimed by whom is the
104
+ // fastest way to see a collision before it becomes a merge.
105
+ heldByRunId: event.heldByRunId,
106
+ },
107
+ };
108
+ case 'coordination.claim.released':
109
+ return { ...base, event: { ...envelope, runId: event.runId, released: event.released } };
110
+ }
111
+ }
112
+ //# sourceMappingURL=runtimeEvents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeEvents.js","sourceRoot":"","sources":["../../src/coordination/runtimeEvents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAUhD;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,cAAc,CAAA;AAEvD;;;;;;GAMG;AACH,MAAM,UAAU,6BAA6B,CAC3C,KAAwB,EACxB,OAAiC,EACjC,OAAyD;IAEzD,MAAM,IAAI,GAAG;QACX,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,GAAG,CAAC,OAAO,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC;QAClF,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;QACtE,MAAM,EAAE,yBAAyB;KAClC,CAAA;IAED,MAAM,QAAQ,GAAG;QACf,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,SAAS,EAAE,OAAO,CAAC,SAAS;KAC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