@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,196 @@
1
+ /**
2
+ * Task claiming — the third coordination primitive.
3
+ *
4
+ * `XENO_AGENT_COORDINATION_SPEC.md` §1 is blunt about why this exists: shared
5
+ * state means another run *could* know something and a message means it *does*,
6
+ * but **neither prevents two agents from starting the same work.** Only a claim
7
+ * does. §5 names the failure it closes: two agents independently rewriting the
8
+ * same module, each with a green suite, producing a merge that is wrong in a way
9
+ * neither could have detected alone.
10
+ *
11
+ * ## Why the host owns this
12
+ *
13
+ * §2.1: overlap is computed by the host **because the host is the only party
14
+ * that sees all runs**. A run cannot arbitrate a claim it cannot observe, and
15
+ * peer-to-peer discovery breaks at the container boundary — which is not a
16
+ * theory, it is Claude Code's own documented limitation, and we sandbox every
17
+ * run. A claim registry that lived in the fleet rather than above it would be
18
+ * unable to answer the one question it exists to answer.
19
+ *
20
+ * ## Scopes are paths, deliberately
21
+ *
22
+ * Spec §13 lists claim granularity as an OPEN DECISION: path, module, or free
23
+ * label. This implements **paths**, which §13 calls "the obvious start and the
24
+ * easiest to compute overlap for". Recorded as a decision rather than left
25
+ * implicit: free labels are more expressive and much harder to arbitrate, and
26
+ * nothing here forecloses adding them behind the same interface.
27
+ *
28
+ * The overlap rule is the same one `xeno-use` applies to sandbox mount targets,
29
+ * and for the same reason — a claim on `src/` must conflict with a claim on
30
+ * `src/app.ts`, or the coarser claim silently means nothing.
31
+ */
32
+ /** A claimed unit of work. Paths are POSIX-style and workspace-relative. */
33
+ /**
34
+ * A short unique id, without a Node dependency.
35
+ *
36
+ * `packages/host`'s portable entry (`index.ts`) has ZERO `node:` imports by
37
+ * design — it is the half that must run outside a Node host — and coordination
38
+ * is provider-neutral rules, so it belongs there rather than behind `./node`.
39
+ * `crypto.randomUUID` is Web Crypto, available in Node 20+ (this package's
40
+ * floor) and every modern browser, so the portability costs nothing.
41
+ */
42
+ function shortId(prefix) {
43
+ return `${prefix}_${globalThis.crypto.randomUUID().replaceAll('-', '').slice(0, 16)}`;
44
+ }
45
+ export function isBranchScope(scope) {
46
+ return scope.kind === 'branch';
47
+ }
48
+ /**
49
+ * `refs/heads/x` and `x` are the same branch; whitespace and trailing slashes are spelling.
50
+ *
51
+ * ⚠️ Case is SIGNIFICANT and deliberately not folded. Git's ref model is case-sensitive, so
52
+ * folding would refuse a legitimately distinct branch on Linux. The opposite risk — two agents
53
+ * on branches differing only by case on a case-insensitive filesystem — is one git itself
54
+ * refuses to create, so it is not a hole this lock has to cover.
55
+ */
56
+ function normalizeBranchName(branch) {
57
+ return branch.trim().replace(/^refs\/heads\//, '').replace(/\/+$/, '');
58
+ }
59
+ /** Canonical form for storage, so `refs/heads/x` and `x` cannot both be held. */
60
+ export function normalizeClaimScope(scope) {
61
+ return isBranchScope(scope)
62
+ ? { kind: 'branch', branch: normalizeBranchName(scope.branch) }
63
+ : { path: normalizeScopePath(scope.path) };
64
+ }
65
+ /** A stable one-line rendering for events and diagnostics. */
66
+ export function describeClaimScope(scope) {
67
+ // Path claims render as the bare path, byte-for-byte as before this type gained a second
68
+ // member — the runtime event payload is a wire surface and must not shift under consumers.
69
+ return isBranchScope(scope) ? `branch:${normalizeBranchName(scope.branch)}` : scope.path;
70
+ }
71
+ const DEFAULT_LEASE_MS = 60_000;
72
+ /** Trailing slashes and `./` prefixes are spelling, not meaning. */
73
+ function normalizeScopePath(path) {
74
+ const unified = path.replace(/\\/g, '/').replace(/^\.\//, '');
75
+ const trimmed = unified.replace(/\/+$/, '');
76
+ return trimmed === '' ? '/' : trimmed;
77
+ }
78
+ /**
79
+ * Two scopes overlap when they name the same work or one contains the other.
80
+ *
81
+ * The containment half is what makes a coarse claim mean anything: without it a
82
+ * run holding `src/` would not conflict with a run holding `src/app.ts`, and the
83
+ * coarse claim would be decorative. Compared segment-wise so `src` does not
84
+ * swallow `srcgen` — the same prefix-boundary bug that widens a scoped grant.
85
+ */
86
+ export function scopesOverlap(a, b) {
87
+ // 🔴 A branch and a path NEVER overlap, and this is the load-bearing line of the extension.
88
+ // They are different axes: an agent may legitimately hold `src/app.ts` while another holds
89
+ // the branch it will land on. Collapsing them into one namespace — comparing `branch:x`
90
+ // against a path string — would invent conflicts that do not exist and, worse, would let a
91
+ // path named `branch:x` take a branch permit.
92
+ if (isBranchScope(a) !== isBranchScope(b))
93
+ return false;
94
+ if (isBranchScope(a) && isBranchScope(b)) {
95
+ // Exact match is COMPLETE for branches, unlike paths, and not an approximation of
96
+ // containment: git cannot hold both `feat/a` and `feat/a/b` at once — a ref is a file, so
97
+ // the parent would have to be a directory too. Nesting is unrepresentable upstream, so
98
+ // there is no containment case to miss.
99
+ return normalizeBranchName(a.branch) === normalizeBranchName(b.branch);
100
+ }
101
+ const left = normalizeScopePath(a.path);
102
+ const right = normalizeScopePath(b.path);
103
+ if (left === right)
104
+ return true;
105
+ return right.startsWith(`${left}/`) || left.startsWith(`${right}/`);
106
+ }
107
+ /**
108
+ * Host-held claim registry.
109
+ *
110
+ * Advisory to the agent, authoritative to the human (§5): a refusal tells the
111
+ * requester who holds the scope so it can coordinate, and the fleet view shows
112
+ * the collision before it becomes a merge.
113
+ */
114
+ export class ClaimRegistry {
115
+ #claims = new Map();
116
+ #now;
117
+ #leaseMs;
118
+ constructor(options = {}) {
119
+ this.#now = options.now ?? Date.now;
120
+ this.#leaseMs = options.leaseMs ?? DEFAULT_LEASE_MS;
121
+ }
122
+ /**
123
+ * Drops leases that have run out.
124
+ *
125
+ * Called before every read and write rather than on a timer: a timer that
126
+ * failed to fire would leave a dead run holding the fleet, and the whole point
127
+ * of a lease is that it cannot outlive its holder's silence. Expiry is
128
+ * therefore a property of every observation, not a background job.
129
+ */
130
+ #sweep() {
131
+ const at = this.#now();
132
+ for (const [id, claim] of this.#claims) {
133
+ if (claim.expiresAt <= at)
134
+ this.#claims.delete(id);
135
+ }
136
+ }
137
+ /** Live claims, expired ones already removed. */
138
+ list() {
139
+ this.#sweep();
140
+ return [...this.#claims.values()];
141
+ }
142
+ acquire(scope, runId) {
143
+ this.#sweep();
144
+ for (const claim of this.#claims.values()) {
145
+ // A run re-claiming its own scope is a renewal, not a conflict: refusing
146
+ // it would make a run its own blocker across a retry.
147
+ if (claim.runId === runId && scopesOverlap(claim.scope, scope)) {
148
+ claim.expiresAt = this.#now() + this.#leaseMs;
149
+ return { acquired: true, claim };
150
+ }
151
+ if (scopesOverlap(claim.scope, scope)) {
152
+ return { acquired: false, heldBy: claim };
153
+ }
154
+ }
155
+ const acquiredAt = this.#now();
156
+ const claim = {
157
+ id: shortId('clm'),
158
+ scope: normalizeClaimScope(scope),
159
+ runId,
160
+ acquiredAt,
161
+ expiresAt: acquiredAt + this.#leaseMs,
162
+ };
163
+ this.#claims.set(claim.id, claim);
164
+ return { acquired: true, claim };
165
+ }
166
+ /** Extends a live lease. Returns false when it has already lapsed. */
167
+ renew(claimId) {
168
+ this.#sweep();
169
+ const claim = this.#claims.get(claimId);
170
+ if (!claim)
171
+ return false;
172
+ claim.expiresAt = this.#now() + this.#leaseMs;
173
+ return true;
174
+ }
175
+ release(claimId) {
176
+ return this.#claims.delete(claimId);
177
+ }
178
+ /**
179
+ * §5: "released automatically when a run terminates. A crashed run must never
180
+ * deadlock the fleet." Called by the host on run termination — the expiry
181
+ * sweep is the backstop for a host that never got the news, not the primary
182
+ * path, because waiting a full lease for a run we KNOW is gone is a stall
183
+ * nobody can explain.
184
+ */
185
+ releaseRun(runId) {
186
+ let released = 0;
187
+ for (const [id, claim] of this.#claims) {
188
+ if (claim.runId === runId) {
189
+ this.#claims.delete(id);
190
+ released += 1;
191
+ }
192
+ }
193
+ return released;
194
+ }
195
+ }
196
+ //# sourceMappingURL=claims.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claims.js","sourceRoot":"","sources":["../../src/coordination/claims.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,4EAA4E;AAC5E;;;;;;;;GAQG;AACH,SAAS,OAAO,CAAC,MAAc;IAC7B,OAAO,GAAG,MAAM,IAAI,UAAU,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAA;AACvF,CAAC;AA+BD,MAAM,UAAU,aAAa,CAAC,KAAiB;IAC7C,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAA;AAChC,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,mBAAmB,CAAC,MAAc;IACzC,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AACxE,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,mBAAmB,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IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC7C,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,CAAC,OAAe;QACrB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACrC,CAAC;IAED;;;;;;OAMG;IACH,UAAU,CAAC,KAAa;QACtB,IAAI,QAAQ,GAAG,CAAC,CAAA;QAChB,KAAK,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACvC,IAAI,KAAK,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;gBAC1B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;gBACvB,QAAQ,IAAI,CAAC,CAAA;YACf,CAAC;QACH,CAAC;QACD,OAAO,QAAQ,CAAA;IACjB,CAAC;CACF"}
@@ -0,0 +1,40 @@
1
+ import type { CoordinationLaneBridge } from './laneBridge.js';
2
+ /**
3
+ * A tool as the SDK loop registers them: plain data plus a function.
4
+ *
5
+ * Redeclared here rather than imported, and that is the point — the shape has
6
+ * no Electron in it, so the definitions belong in the host where every lane can
7
+ * reach them. `electron-host` owns the *registration*, not the tools.
8
+ */
9
+ export interface CoordinationToolDefinition {
10
+ definition: {
11
+ name: string;
12
+ description: string;
13
+ input_schema: {
14
+ type: 'object';
15
+ properties: Record<string, unknown>;
16
+ required?: string[];
17
+ };
18
+ };
19
+ execute: (input: Record<string, unknown>) => Promise<{
20
+ success: boolean;
21
+ output: string;
22
+ error?: string;
23
+ }>;
24
+ }
25
+ /**
26
+ * The SDK lane's names for the three coordination primitives — ADE §5.2b.
27
+ *
28
+ * 🔴 **Built from the SAME bridge the ACP lane uses.** An ACP agent reaches
29
+ * these as `xeno.dev/*` extension methods and an SDK agent as registered tools;
30
+ * two vocabularies for one set of calls. Implementing them twice would let a
31
+ * primitive behave differently depending on which runtime happened to be
32
+ * executing — an agent told a claim was granted in one lane and refused in the
33
+ * other has no way to tell which answer to believe.
34
+ *
35
+ * The caller's run id is bound INTO the bridge by the host, so it is absent
36
+ * from every schema below. An agent cannot address these calls as another run
37
+ * because there is no parameter through which to try.
38
+ */
39
+ export declare function createCoordinationTools(bridge: CoordinationLaneBridge): CoordinationToolDefinition[];
40
+ //# sourceMappingURL=coordinationTools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinationTools.d.ts","sourceRoot":"","sources":["../../src/coordination/coordinationTools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAE7D;;;;;;GAMG;AACH,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,MAAM,CAAA;QACnB,YAAY,EAAE;YACZ,IAAI,EAAE,QAAQ,CAAA;YACd,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;YACnC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;SACpB,CAAA;KACF,CAAA;IACD,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC3G;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,sBAAsB,GAAG,0BAA0B,EAAE,CAiEpG"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * The SDK lane's names for the three coordination primitives — ADE §5.2b.
3
+ *
4
+ * 🔴 **Built from the SAME bridge the ACP lane uses.** An ACP agent reaches
5
+ * these as `xeno.dev/*` extension methods and an SDK agent as registered tools;
6
+ * two vocabularies for one set of calls. Implementing them twice would let a
7
+ * primitive behave differently depending on which runtime happened to be
8
+ * executing — an agent told a claim was granted in one lane and refused in the
9
+ * other has no way to tell which answer to believe.
10
+ *
11
+ * The caller's run id is bound INTO the bridge by the host, so it is absent
12
+ * from every schema below. An agent cannot address these calls as another run
13
+ * because there is no parameter through which to try.
14
+ */
15
+ export function createCoordinationTools(bridge) {
16
+ return [
17
+ {
18
+ definition: {
19
+ name: 'CoordinationSend',
20
+ description: 'Send a message to another agent run in this fleet. Returns the delivery outcome: '
21
+ + 'delivered, held, refused or expired. Held and refused are not failures to retry blindly — '
22
+ + 'they mean the recipient is not accepting this message.',
23
+ input_schema: {
24
+ type: 'object',
25
+ properties: {
26
+ toRunId: { type: 'string', description: 'The run to send to, from CoordinationQuery.' },
27
+ text: { type: 'string', description: 'What to tell it.' },
28
+ },
29
+ required: ['toRunId', 'text'],
30
+ },
31
+ },
32
+ execute: async (input) => report(bridge.send(input)),
33
+ },
34
+ {
35
+ definition: {
36
+ name: 'CoordinationQuery',
37
+ description: 'List the other agent runs you can see, or ask about one of them by id: what files it '
38
+ + 'has touched, what commands it has run, and what it currently holds a claim on.',
39
+ input_schema: {
40
+ type: 'object',
41
+ properties: {
42
+ runId: { type: 'string', description: 'Omit to list peers; supply one to ask about it.' },
43
+ },
44
+ },
45
+ },
46
+ execute: async (input) => report(bridge.query(input)),
47
+ },
48
+ {
49
+ definition: {
50
+ name: 'CoordinationClaim',
51
+ description: 'Take an exclusive claim before editing, so two runs do not collide. Claim a PATH '
52
+ + 'before editing files under it, or a BRANCH before committing to it — supply exactly '
53
+ + 'one. A refusal names the run that holds it — message that run rather than waiting or '
54
+ + 'proceeding anyway.',
55
+ input_schema: {
56
+ type: 'object',
57
+ properties: {
58
+ path: { type: 'string', description: 'The path to claim. A claim on a directory covers everything under it.' },
59
+ branch: {
60
+ type: 'string',
61
+ description: 'The git branch to claim, instead of a path. Branches do not nest: claiming '
62
+ + 'feat/a does not claim feat/a/b.',
63
+ },
64
+ },
65
+ // 🔴 Neither is individually required and the ONE-OF rule is enforced in the bridge,
66
+ // not here. JSON Schema could express it with `oneOf`, but this schema is handed to
67
+ // several agent runtimes whose support for it varies, and a constraint some providers
68
+ // silently drop is worse than one enforced where it is actually checked. The bridge
69
+ // refuses both-or-neither with a message naming the fix.
70
+ required: [],
71
+ },
72
+ },
73
+ execute: async (input) => report(bridge.claim(input)),
74
+ },
75
+ ];
76
+ }
77
+ /**
78
+ * Turns a bridge answer into a tool result.
79
+ *
80
+ * 🔴 An `error` field means the CALL was rejected — a missing parameter, or a
81
+ * host with no coordination. A `status: 'refused'` does not: the call worked and
82
+ * the answer is no. Collapsing the two would tell an agent its message failed to
83
+ * send when the recipient simply declined it, and the corrections differ —
84
+ * retry the call, versus find another way to reach that run.
85
+ */
86
+ async function report(answer) {
87
+ const error = typeof answer.error === 'string' ? answer.error : undefined;
88
+ return error === undefined
89
+ ? { success: true, output: JSON.stringify(answer) }
90
+ : { success: false, output: '', error };
91
+ }
92
+ //# sourceMappingURL=coordinationTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinationTools.js","sourceRoot":"","sources":["../../src/coordination/coordinationTools.ts"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAA8B;IACpE,OAAO;QACL;YACE,UAAU,EAAE;gBACV,IAAI,EAAE,kBAAkB;gBACxB,WAAW,EACT,mFAAmF;sBACjF,4FAA4F;sBAC5F,wDAAwD;gBAC5D,YAAY,EAAE;oBACZ,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6CAA6C,EAAE;wBACvF,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAE;qBAC1D;oBACD,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC;iBAC9B;aACF;YACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC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AAS;QACxB,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE;QACnD,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,CAAA;AAC3C,CAAC"}
@@ -0,0 +1,84 @@
1
+ import type { AcquireClaimResult, ClaimScope } from './claims.js';
2
+ import type { MessageOutcome } from './messages.js';
3
+ import type { PeerDescriptor, RunSummary } from './query.js';
4
+ /**
5
+ * Coordination, reachable by an AGENT — ADE §5.2b. LANE-NEUTRAL.
6
+ *
7
+ * 🔴 **One implementation, two vocabularies.** An ACP agent reaches these three
8
+ * primitives as `xeno.dev/*` extension methods; an SDK agent reaches them as
9
+ * registered tools. Both are names for the same calls, so both are built from
10
+ * this bridge rather than from two hand-kept copies — a lane that drifted would
11
+ * offer an agent a coordination primitive that behaves differently depending on
12
+ * which runtime happened to be executing it.
13
+ *
14
+ * It lives in `coordination/` and not in `acp/` for exactly that reason: the SDK
15
+ * lane must not have to import from the ACP one to be a peer.
16
+ *
17
+ * 🔴 **This is the surface a recorded blocker said did not exist.**
18
+ *
19
+ * `coordinationService` was the last unmounted host service, exempted on the
20
+ * grounds that *"coordination is reached by AGENTS through tools"* and that the
21
+ * ACP lane *"needs an MCP/protocol surface"*. The first half is right. The
22
+ * second is wrong, and had been for as long as `choose_directory` has shipped:
23
+ * XENO already owns an ACP extension surface, and it is live in the shipping
24
+ * path. `AcpProcessSupervisor` routes `extMethod` into
25
+ * `handleAcpHostExtensionRequest`, and `DEFAULT_CLIENT_CAPABILITIES` advertises
26
+ * the available methods under `_meta['xeno.dev'].hostRequests` at `initialize`,
27
+ * so agents discover them rather than guessing.
28
+ *
29
+ * Coordination needed three more entries in that table, not a second protocol —
30
+ * which is the build doctrine's own instruction: *extend the protocol rather
31
+ * than work around it.* An MCP server would have been a parallel transport
32
+ * carrying the same calls to the same service.
33
+ *
34
+ * 🔴 **The caller's run id is NOT a parameter, and that is the whole security
35
+ * model.** It is bound when this bridge is constructed, from the host's own
36
+ * per-conversation context. An agent that could name its own `fromRunId` could
37
+ * send messages as another run, read a peer's summary through someone else's
38
+ * visibility, and take a claim in a third run's name — coordination is
39
+ * host-mediated precisely so that a participant cannot assert who it is.
40
+ */
41
+ export interface CoordinationLanePort {
42
+ send(input: {
43
+ fromRunId: string;
44
+ toRunId: string;
45
+ text: string;
46
+ }): MessageOutcome;
47
+ peers(callerRunId: string): PeerDescriptor[];
48
+ runSummary(callerRunId: string, targetRunId: string): RunSummary | undefined;
49
+ acquireClaim(scope: ClaimScope, runId: string): AcquireClaimResult;
50
+ }
51
+ export interface CoordinationLaneBridge {
52
+ send(params: Record<string, unknown>): Record<string, unknown>;
53
+ query(params: Record<string, unknown>): Record<string, unknown>;
54
+ claim(params: Record<string, unknown>): Record<string, unknown>;
55
+ }
56
+ /**
57
+ * The bridge a lane gets when coordination is not mounted.
58
+ *
59
+ * Refuses by NAME rather than returning an empty result. "No peers" and "this
60
+ * host cannot coordinate" are the same empty list and opposite meanings, and an
61
+ * agent told the first will conclude it is working alone — then edit a file
62
+ * another run has claimed.
63
+ */
64
+ export declare class UnavailableCoordinationLaneBridge implements CoordinationLaneBridge {
65
+ send(): Record<string, unknown>;
66
+ query(): Record<string, unknown>;
67
+ claim(): Record<string, unknown>;
68
+ }
69
+ export interface HostCoordinationLaneBridgeOptions {
70
+ /** Bound by the host from its own conversation context, never by the agent. */
71
+ callerRunId: string;
72
+ port: CoordinationLanePort;
73
+ }
74
+ export declare class HostCoordinationLaneBridge implements CoordinationLaneBridge {
75
+ #private;
76
+ constructor(options: HostCoordinationLaneBridgeOptions);
77
+ /** message (push) — §5.2b's first primitive. */
78
+ send(params: Record<string, unknown>): Record<string, unknown>;
79
+ /** query (pull) — peers, or one peer's summary. */
80
+ query(params: Record<string, unknown>): Record<string, unknown>;
81
+ /** claim (lock) — the primitive that prevents two runs editing one file. */
82
+ claim(params: Record<string, unknown>): Record<string, unknown>;
83
+ }
84
+ //# sourceMappingURL=laneBridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"laneBridge.d.ts","sourceRoot":"","sources":["../../src/coordination/laneBridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,cAAc,CAAA;IACjF,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,EAAE,CAAA;IAC5C,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAA;IAC5E,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,kBAAkB,CAAA;CACnE;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9D,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/D,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAChE;AAED;;;;;;;GAOG;AACH,qBAAa,iCAAkC,YAAW,sBAAsB;IAC9E,IAAI,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAI/B,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAIhC,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAGjC;AAED,MAAM,WAAW,iCAAiC;IAChD,+EAA+E;IAC/E,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,oBAAoB,CAAA;CAC3B;AAED,qBAAa,0BAA2B,YAAW,sBAAsB;;gBAI3D,OAAO,EAAE,iCAAiC;IAKtD,gDAAgD;IAChD,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAmB9D,mDAAmD;IACnD,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAW/D,4EAA4E;IAC5E,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAuBhE"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * The bridge a lane gets when coordination is not mounted.
3
+ *
4
+ * Refuses by NAME rather than returning an empty result. "No peers" and "this
5
+ * host cannot coordinate" are the same empty list and opposite meanings, and an
6
+ * agent told the first will conclude it is working alone — then edit a file
7
+ * another run has claimed.
8
+ */
9
+ export class UnavailableCoordinationLaneBridge {
10
+ send() {
11
+ return { error: 'Coordination is not available on this host.' };
12
+ }
13
+ query() {
14
+ return { error: 'Coordination is not available on this host.' };
15
+ }
16
+ claim() {
17
+ return { error: 'Coordination is not available on this host.' };
18
+ }
19
+ }
20
+ export class HostCoordinationLaneBridge {
21
+ #callerRunId;
22
+ #port;
23
+ constructor(options) {
24
+ this.#callerRunId = options.callerRunId;
25
+ this.#port = options.port;
26
+ }
27
+ /** message (push) — §5.2b's first primitive. */
28
+ send(params) {
29
+ const toRunId = stringParam(params.toRunId ?? params.to);
30
+ const text = stringParam(params.text ?? params.message);
31
+ if (!toRunId || !text) {
32
+ // Named, because the two failures need different corrections: a missing
33
+ // recipient is a different mistake from an empty message.
34
+ return { error: !toRunId ? 'coordination_send requires toRunId.' : 'coordination_send requires text.' };
35
+ }
36
+ const outcome = this.#port.send({ fromRunId: this.#callerRunId, toRunId, text });
37
+ // \u{1F534} The OUTCOME travels back verbatim. `held`, `refused` and `expired` are
38
+ // not failures to smooth over into a boolean: an agent that believes a
39
+ // held message was delivered will wait for an answer that is not coming,
40
+ // and one that reads `refused` as `delivered` will assume it has handed
41
+ // work off and stop.
42
+ return outcome.status === 'delivered'
43
+ ? { status: outcome.status, messageId: outcome.messageId }
44
+ : { status: outcome.status, messageId: outcome.messageId, reason: outcome.reason };
45
+ }
46
+ /** query (pull) — peers, or one peer's summary. */
47
+ query(params) {
48
+ const targetRunId = stringParam(params.runId ?? params.target);
49
+ if (!targetRunId) {
50
+ return { peers: this.#port.peers(this.#callerRunId) };
51
+ }
52
+ const summary = this.#port.runSummary(this.#callerRunId, targetRunId);
53
+ // Absent and invisible are the same answer HERE on purpose: telling a caller
54
+ // that a run exists but it may not look is itself a disclosure.
55
+ return summary ? { run: summary } : { run: null };
56
+ }
57
+ /** claim (lock) — the primitive that prevents two runs editing one file. */
58
+ claim(params) {
59
+ const path = stringParam(params.path);
60
+ const branch = stringParam(params.branch);
61
+ // Exactly one axis per call. Accepting both would make a partial acquisition expressible —
62
+ // the path taken and the branch refused — and the caller would have no single answer to act
63
+ // on, which is the same reason a LIST of paths is refused below.
64
+ if (path && branch) {
65
+ return { error: 'coordination_claim takes a path or a branch, not both.' };
66
+ }
67
+ if (!path && !branch)
68
+ return { error: 'coordination_claim requires a path or a branch.' };
69
+ // ONE path per call, because `ClaimScope` is one unit of work. Accepting a list here
70
+ // and looping would make a partial acquisition expressible — some paths
71
+ // taken, some refused — and the caller would have no single answer to act on.
72
+ const scope = branch ? { kind: 'branch', branch } : { path: path };
73
+ const result = this.#port.acquireClaim(scope, this.#callerRunId);
74
+ // \u{1F534} A refusal names WHO HOLDS IT. Coordination §5 is explicit that a bare
75
+ // `false` leaves the caller with exactly the two behaviours it exists to
76
+ // prevent — spinning, or proceeding anyway — whereas a holder is someone
77
+ // the agent can message with the primitive it already has.
78
+ return result.acquired
79
+ ? { granted: true, claimId: result.claim.id }
80
+ : { granted: false, heldByRunId: result.heldBy.runId };
81
+ }
82
+ }
83
+ function stringParam(value) {
84
+ return typeof value === 'string' && value.trim() ? value.trim() : undefined;
85
+ }
86
+ //# sourceMappingURL=laneBridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"laneBridge.js","sourceRoot":"","sources":["../../src/coordination/laneBridge.ts"],"names":[],"mappings":"AAsDA;;;;;;;GAOG;AACH,MAAM,OAAO,iCAAiC;IAC5C,IAAI;QACF,OAAO,EAAE,KAAK,EAAE,6CAA6C,EAAE,CAAA;IACjE,CAAC;IAED,KAAK;QACH,OAAO,EAAE,KAAK,EAAE,6CAA6C,EAAE,CAAA;IACjE,CAAC;IAED,KAAK;QACH,OAAO,EAAE,KAAK,EAAE,6CAA6C,EAAE,CAAA;IACjE,CAAC;CACF;AAQD,MAAM,OAAO,0BAA0B;IAC5B,YAAY,CAAQ;IACpB,KAAK,CAAsB;IAEpC,YAAY,OAA0C;QACpD,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,WAAW,CAAA;QACvC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAA;IAC3B,CAAC;IAED,gDAAgD;IAChD,IAAI,CAAC,MAA+B;QAClC,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,EAAE,CAAC,CAAA;QACxD,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,OAAO,CAAC,CAAA;QACvD,IAAI,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