@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,248 @@
1
+ /**
2
+ * Tier-1 run observation โ€” the live producer behind ยง2.9's review capability.
3
+ *
4
+ * `RunDiff` (in `core`) folds a filesystem event stream into a net change set,
5
+ * `capabilityTier` says review is deliverable at tier 1 for ANY agent, and
6
+ * `xeno-use` emits the stream. All three existed and **nothing connected them**,
7
+ * which is the same "built, tested, unreachable" shape as xeno-workflow's 76
8
+ * node types and xeno-tools' never-called `install`. This is the connection.
9
+ *
10
+ * ## The source is a PORT, and that is a licensing boundary before it is a
11
+ * design preference
12
+ *
13
+ * ๐Ÿ”ด **`xeno-use` is AGPL-3.0** โ€” it ships the AGPL text and its Cargo workspace
14
+ * declares `license = "AGPL-3.0-only"`. XENO Agent is proprietary. So this
15
+ * package must not import `@xeno-use/core`, link its N-API binding, or take it
16
+ * as a dependency in any direction, and neither may any composition that ships
17
+ * inside a proprietary installer.
18
+ *
19
+ * `RunObservationSource` is therefore declared HERE, provider-neutral, and an
20
+ * adapter is supplied from outside. That is the right design under either
21
+ * outcome of the open licence question: if `xeno-use` stays AGPL the adapter
22
+ * talks to it out of process over its own `/v1/use/*` surface โ€” the consumption
23
+ * model it was built for โ€” and if it is ever relicensed, an in-process adapter
24
+ * plugs into the identical port. The port is not a workaround for the licence;
25
+ * it is what makes the licence answer swappable.
26
+ *
27
+ * ## Completeness travels with the diff, never beside it
28
+ *
29
+ * A `RunChange[]` cannot say whether it is the whole story. A stream that
30
+ * dropped events yields a *shorter* diff, not an error โ€” and a shorter diff is
31
+ * the most dangerous possible output here, because a reviewer reads "3 files
32
+ * changed" and approves. This is the same rule `SandboxObservation` applies one
33
+ * layer down, and it has to be re-applied here rather than assumed: the
34
+ * completeness signal does not survive a fold unless the fold carries it.
35
+ */
36
+ import { RunDiff, detectLandingOverlaps, resolveCapabilityTier, } from '@xenosystem/agent-interface-core';
37
+ const DEFAULT_MAX_EVENTS_PER_DRAIN = 5_000;
38
+ const DEFAULT_MAX_DRAINS_PER_POLL = 8;
39
+ export class RunObservationService {
40
+ #runs = new Map();
41
+ #maxEventsPerDrain;
42
+ #maxDrainsPerPoll;
43
+ #emit;
44
+ constructor(options = {}) {
45
+ this.#maxEventsPerDrain = options.maxEventsPerDrain ?? DEFAULT_MAX_EVENTS_PER_DRAIN;
46
+ this.#maxDrainsPerPoll = options.maxDrainsPerPoll ?? DEFAULT_MAX_DRAINS_PER_POLL;
47
+ this.#emit = options.emit ?? (() => { });
48
+ }
49
+ /** Mirrors `CoordinationService.setEventSink` โ€” the host is constructed with
50
+ * its services, so a sink fixed at construction could not be the host. */
51
+ setEventSink(emit) {
52
+ this.#emit = emit;
53
+ }
54
+ /**
55
+ * Begins observing a run.
56
+ *
57
+ * `baseline` is the set of paths that existed when the run started. Its
58
+ * ABSENCE is meaningful and not a default: with no baseline every modified
59
+ * file reports as `added`, because nothing says it was there before. Callers
60
+ * that cannot supply one get a diff that is still useful and still honest โ€”
61
+ * `added` really does mean "this run touched a path we have no prior record
62
+ * of" โ€” but they should know that is what they are reading.
63
+ */
64
+ observe(runId, source, options = {}) {
65
+ this.#runs.set(runId, {
66
+ source,
67
+ diff: new RunDiff(options.baseline ? { baseline: options.baseline } : {}),
68
+ content: options.content,
69
+ droppedEvents: 0,
70
+ problems: new Set(options.problems ?? []),
71
+ degraded: options.degraded === true,
72
+ });
73
+ }
74
+ /**
75
+ * Content for one changed path, for hunk-level review.
76
+ *
77
+ * โš ๏ธ **A SNAPSHOT, not the state at the event.** The agent may have written
78
+ * again between the change being observed and this read, so a hunk view can
79
+ * disagree with the change list that prompted it. That is inherent to sampling
80
+ * a live filesystem rather than a defect to engineer away โ€” but it means a
81
+ * surface must never label this "what the agent did at 10:04:03".
82
+ *
83
+ * Refuses a path the run has not actually changed. Reading arbitrary paths
84
+ * through a review API would turn a review pane into a file browser scoped to
85
+ * the sandbox, which is a different capability with a different consent story.
86
+ */
87
+ async readChange(runId, path) {
88
+ const run = this.#runs.get(runId);
89
+ if (!run?.content)
90
+ return undefined;
91
+ if (!run.diff.changes().some((change) => change.path === path))
92
+ return undefined;
93
+ return run.content.read(path);
94
+ }
95
+ stopObserving(runId) {
96
+ this.#runs.delete(runId);
97
+ }
98
+ observedRuns() {
99
+ return [...this.#runs.keys()].sort();
100
+ }
101
+ /**
102
+ * Drains what the sandbox has produced and folds it in.
103
+ *
104
+ * Returns the snapshot rather than only emitting it, so a caller that wants
105
+ * the answer does not have to subscribe to learn the result of its own call.
106
+ */
107
+ async poll(runId) {
108
+ const run = this.#runs.get(runId);
109
+ if (!run)
110
+ return undefined;
111
+ for (let drain = 0; drain < this.#maxDrainsPerPoll; drain += 1) {
112
+ const batch = await run.source.drain(this.#maxEventsPerDrain);
113
+ run.diff.applyAll(batch.events);
114
+ // Accumulated, never overwritten: a run that was degraded at 10:01 is
115
+ // still a run whose diff has a hole, even if the drain at 10:02 was
116
+ // clean. Completeness is a property of the RECORD, not of the last read.
117
+ if (batch.degraded)
118
+ run.degraded = true;
119
+ run.droppedEvents += batch.droppedEvents ?? 0;
120
+ for (const problem of batch.problems ?? [])
121
+ run.problems.add(problem);
122
+ if (!batch.morePending)
123
+ break;
124
+ // Falling out of this loop with `morePending` still true is not an error:
125
+ // the next poll continues. Blocking here until a busy run went quiet
126
+ // would make one noisy sandbox stall the host โ€” the bound is the point.
127
+ }
128
+ const snapshot = this.snapshot(runId);
129
+ if (snapshot)
130
+ this.#emit(summarise(snapshot));
131
+ return snapshot;
132
+ }
133
+ /**
134
+ * What a run can deliver for a capability, and from which tier.
135
+ *
136
+ * ยง8: *"Reporting them unavailable for a third-party agent is a defect, not
137
+ * honest degradation โ€” the data is in the sandbox."* This is the only place
138
+ * that can answer honestly, because it is the only place that knows whether a
139
+ * sandbox is actually being observed for this run โ€” so the answer is DERIVED
140
+ * from that fact rather than configured.
141
+ *
142
+ * `acp` and `vendorSideChannel` are passed in by the caller, which knows what
143
+ * the run's provider supports. Absent, the answer is the tier-1 one: correct
144
+ * for a third-party agent in `native-tui`, which is the case ยง2.9 exists for.
145
+ */
146
+ capabilityFor(runId, capability, sources = {}) {
147
+ return resolveCapabilityTier(capability, {
148
+ // Observed means observed. A run this service has never been told about
149
+ // has no sandbox stream as far as anything here can tell, and claiming
150
+ // tier 1 for it would invent the sensor ยง2.9 rests on.
151
+ sandboxObservation: this.#runs.has(runId),
152
+ vendorSideChannel: sources.vendorSideChannel ?? false,
153
+ acp: sources.acp ?? false,
154
+ });
155
+ }
156
+ /**
157
+ * Where the observed runs collide โ€” ยง5.7 conflict-aware landing.
158
+ *
159
+ * Computed from OBSERVED diffs rather than from claims, because nothing forces
160
+ * an agent to claim a path before writing it, and the agent that surprises us
161
+ * is exactly the one whose overlap matters. Claims remain complementary: pass
162
+ * them in and the report says whether a collision was invisible to the
163
+ * registry or whether a claim was released.
164
+ *
165
+ * Available *while the runs are alive*, which is the point โ€” after the merge
166
+ * it is archaeology. Completeness rides along: a run with a hole in its diff
167
+ * cannot rule out an overlap, and `mayLand` refuses on that rather than
168
+ * reporting a clean landing it did not measure.
169
+ */
170
+ landingOverlaps(claimedPathsByRun = {},
171
+ /**
172
+ * ๐Ÿ”ด Runs the CALLER knows exist. Any of them this service never observed
173
+ * makes the report incomplete, so `mayLand` refuses.
174
+ *
175
+ * This rule lives HERE, not in the caller, because it was in the caller
176
+ * once and the shipping landing gate bypassed it: `apps/desktop` calls this
177
+ * method directly while the host's RPC reader had its own copy of the check.
178
+ * The surface told the truth and the gate that actually merges did not โ€”
179
+ * so the rule belongs where every caller passes through.
180
+ *
181
+ * A caller that knows of no other runs passes nothing and loses nothing.
182
+ */
183
+ knownRunIds = []) {
184
+ const sets = [];
185
+ for (const runId of this.#runs.keys()) {
186
+ const snapshot = this.snapshot(runId);
187
+ if (!snapshot)
188
+ continue;
189
+ const claimed = claimedPathsByRun[runId];
190
+ sets.push({
191
+ runId,
192
+ changes: snapshot.changes.map((change) => ({ path: change.path, kind: change.kind })),
193
+ complete: snapshot.complete,
194
+ ...(claimed ? { claimedPaths: claimed } : {}),
195
+ });
196
+ }
197
+ const report = detectLandingOverlaps(sets);
198
+ const observed = new Set(sets.map((set) => set.runId));
199
+ const unobserved = [...new Set([...knownRunIds, ...Object.keys(claimedPathsByRun)])]
200
+ .filter((runId) => !observed.has(runId))
201
+ .sort();
202
+ if (unobserved.length === 0)
203
+ return report;
204
+ return {
205
+ ...report,
206
+ // Both kinds of hole in one list: the reader's next action is the same.
207
+ incompleteRuns: [...new Set([...report.incompleteRuns, ...unobserved])].sort(),
208
+ complete: false,
209
+ };
210
+ }
211
+ /** The current diff without draining. */
212
+ snapshot(runId) {
213
+ const run = this.#runs.get(runId);
214
+ if (!run)
215
+ return undefined;
216
+ return {
217
+ runId,
218
+ changes: run.diff.changes(),
219
+ // Dropped events are the definitive incompleteness: those changes exist
220
+ // on disk and are absent from this diff forever.
221
+ complete: !run.degraded && run.droppedEvents === 0,
222
+ droppedEvents: run.droppedEvents,
223
+ problems: [...run.problems],
224
+ };
225
+ }
226
+ }
227
+ function summarise(snapshot) {
228
+ let added = 0;
229
+ let modified = 0;
230
+ let deleted = 0;
231
+ for (const change of snapshot.changes) {
232
+ if (change.kind === 'added')
233
+ added += 1;
234
+ else if (change.kind === 'modified')
235
+ modified += 1;
236
+ else
237
+ deleted += 1;
238
+ }
239
+ return {
240
+ runId: snapshot.runId,
241
+ added,
242
+ modified,
243
+ deleted,
244
+ complete: snapshot.complete,
245
+ droppedEvents: snapshot.droppedEvents,
246
+ };
247
+ }
248
+ //# sourceMappingURL=RunObservationService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RunObservationService.js","sourceRoot":"","sources":["../../src/observation/RunObservationService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EACL,OAAO,EACP,qBAAqB,EACrB,qBAAqB,GAQtB,MAAM,kCAAkC,CAAA;AAqGzC,MAAM,4BAA4B,GAAG,KAAK,CAAA;AAC1C,MAAM,2BAA2B,GAAG,CAAC,CAAA;AAErC,MAAM,OAAO,qBAAqB;IACvB,KAAK,GAAG,IAAI,GAAG,EAOpB,CAAA;IACK,kBAAkB,CAAQ;IAC1B,iBAAiB,CAAQ;IAClC,KAAK,CAA0C;IAE/C,YAAY,UAAwC,EAAE;QACpD,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,IAAI,4BAA4B,CAAA;QACnF,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,IAAI,2BAA2B,CAAA;QAChF,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;IACzC,CAAC;IAED;+EAC2E;IAC3E,YAAY,CAAC,IAA8C;QACzD,IAAI,CAAC,KA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I,KAAK,UAAU;YAAE,QAAQ,IAAI,CAAC,CAAA;;YAC7C,OAAO,IAAI,CAAC,CAAA;IACnB,CAAC;IACD,OAAO;QACL,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,KAAK;QACL,QAAQ;QACR,OAAO;QACP,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,aAAa,EAAE,QAAQ,CAAC,aAAa;KACtC,CAAA;AACH,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * `RunObservationSource` over `xeno-use`'s HTTP surface.
3
+ *
4
+ * ๐Ÿ”’ **This is the ONLY sanctioned way this repo consumes `xeno-use`** โ€” locked
5
+ * decision 17. `xeno-use` is AGPL-3.0 and this package is proprietary, so
6
+ * importing `@xeno-use/*` or linking its N-API binding would make this a
7
+ * derivative work. An HTTP client is not linkage.
8
+ *
9
+ * โš ๏ธ **Nothing here may import from `xeno-use`.** The batch shape is redeclared
10
+ * by `RunObservationSource`; this file only knows a URL and a JSON shape. If a
11
+ * future change makes it convenient to import a type from there, that
12
+ * convenience is the boundary being crossed.
13
+ *
14
+ * ## Why a poll and not a stream
15
+ *
16
+ * The remote drain is bounded and reports `more_pending`, so this is a few
17
+ * requests per second per sandbox rather than one per event โ€” measured at ~30
18
+ * requests/second across six concurrent sandboxes. That is why this needed no
19
+ * WebSocket, no SSE, and no reconnect logic: there is no long-lived connection
20
+ * to lose.
21
+ */
22
+ import type { RunObservationBatch, RunObservationSource } from './RunObservationService.js';
23
+ export interface XenoUseObservationSourceOptions {
24
+ /** Base URL of the `xeno-use` service, e.g. `http://127.0.0.1:8787`. */
25
+ baseUrl: string;
26
+ sandboxId: string;
27
+ /** Bearer token. Its workspace is what authorizes every call โ€” the sandbox id
28
+ * alone proves nothing, which is the point of the remote ownership check. */
29
+ token: string;
30
+ /** Injected so this is testable without a server, and so a composition can
31
+ * supply a fetch with its own timeouts and proxy rules. */
32
+ fetch?: typeof globalThis.fetch;
33
+ /** Per-request timeout. A drain that never returns would stall the poll loop
34
+ * that owns it, so there is no unbounded wait anywhere on this path. */
35
+ timeoutMs?: number;
36
+ }
37
+ export declare class XenoUseObservationSource implements RunObservationSource {
38
+ #private;
39
+ constructor(options: XenoUseObservationSourceOptions);
40
+ drain(maxEvents: number): Promise<RunObservationBatch>;
41
+ }
42
+ //# sourceMappingURL=XenoUseObservationSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XenoUseObservationSource.d.ts","sourceRoot":"","sources":["../../src/observation/XenoUseObservationSource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAc3F,MAAM,WAAW,+BAA+B;IAC9C,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB;kFAC8E;IAC9E,KAAK,EAAE,MAAM,CAAA;IACb;gEAC4D;IAC5D,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAA;IAC/B;6EACyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAID,qBAAa,wBAAyB,YAAW,oBAAoB;;gBAKvD,OAAO,EAAE,+BAA+B;IAU9C,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAuE7D"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * `RunObservationSource` over `xeno-use`'s HTTP surface.
3
+ *
4
+ * ๐Ÿ”’ **This is the ONLY sanctioned way this repo consumes `xeno-use`** โ€” locked
5
+ * decision 17. `xeno-use` is AGPL-3.0 and this package is proprietary, so
6
+ * importing `@xeno-use/*` or linking its N-API binding would make this a
7
+ * derivative work. An HTTP client is not linkage.
8
+ *
9
+ * โš ๏ธ **Nothing here may import from `xeno-use`.** The batch shape is redeclared
10
+ * by `RunObservationSource`; this file only knows a URL and a JSON shape. If a
11
+ * future change makes it convenient to import a type from there, that
12
+ * convenience is the boundary being crossed.
13
+ *
14
+ * ## Why a poll and not a stream
15
+ *
16
+ * The remote drain is bounded and reports `more_pending`, so this is a few
17
+ * requests per second per sandbox rather than one per event โ€” measured at ~30
18
+ * requests/second across six concurrent sandboxes. That is why this needed no
19
+ * WebSocket, no SSE, and no reconnect logic: there is no long-lived connection
20
+ * to lose.
21
+ */
22
+ const DEFAULT_TIMEOUT_MS = 10_000;
23
+ export class XenoUseObservationSource {
24
+ #options;
25
+ constructor(options) {
26
+ this.#options = {
27
+ baseUrl: options.baseUrl.replace(/\/+$/, ''),
28
+ sandboxId: options.sandboxId,
29
+ token: options.token,
30
+ fetch: options.fetch ?? globalThis.fetch,
31
+ timeoutMs: options.timeoutMs ?? DEFAULT_TIMEOUT_MS,
32
+ };
33
+ }
34
+ async drain(maxEvents) {
35
+ const { baseUrl, sandboxId, token, fetch, timeoutMs } = this.#options;
36
+ const url = `${baseUrl}/v1/use/sandbox/${encodeURIComponent(sandboxId)}/observation/drain?max=${maxEvents}`;
37
+ const controller = new AbortController();
38
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
39
+ try {
40
+ const response = await fetch(url, {
41
+ method: 'POST',
42
+ headers: { authorization: `Bearer ${token}` },
43
+ signal: controller.signal,
44
+ });
45
+ if (!response.ok) {
46
+ return this.#unreachable(`the observation service answered ${response.status}`);
47
+ }
48
+ const body = (await response.json());
49
+ return this.#toBatch(body);
50
+ }
51
+ catch (error) {
52
+ return this.#unreachable(error instanceof Error && error.name === 'AbortError'
53
+ ? `the observation service did not answer within ${timeoutMs}ms`
54
+ : 'the observation service could not be reached');
55
+ }
56
+ finally {
57
+ clearTimeout(timer);
58
+ }
59
+ }
60
+ /**
61
+ * ๐Ÿ”ด A failure is DEGRADED, never an empty batch.
62
+ *
63
+ * An unreachable service and a sandbox that changed nothing produce the same
64
+ * zero events, and reading the first as the second is the false-clean diff
65
+ * this whole path exists to prevent โ€” now with a network in the middle, which
66
+ * makes it far likelier. `degraded` propagates through `RunObservationService`
67
+ * into the snapshot and on into `mayLand`, which refuses to land on it.
68
+ *
69
+ * It does NOT count as `droppedEvents`: nothing is known to have been lost.
70
+ * Events may still be waiting on the other side, which is a different fact
71
+ * from events that will never arrive.
72
+ */
73
+ #unreachable(reason) {
74
+ return {
75
+ events: [],
76
+ morePending: false,
77
+ degraded: true,
78
+ droppedEvents: 0,
79
+ problems: [reason],
80
+ };
81
+ }
82
+ #toBatch(body) {
83
+ const data = body.data;
84
+ if (!data) {
85
+ return this.#unreachable('the observation service returned no data');
86
+ }
87
+ return {
88
+ // Unknown event kinds are DROPPED and reported rather than coerced: a
89
+ // kind this build does not understand must not become `modified` by
90
+ // default, which would put a fabricated change in a diff.
91
+ events: (data.events ?? []).flatMap((event) => event.path && isEventKind(event.kind)
92
+ ? [{ kind: event.kind, path: event.path }]
93
+ : []),
94
+ morePending: data.more_pending === true,
95
+ degraded: data.degraded === true,
96
+ droppedEvents: data.dropped_events ?? 0,
97
+ problems: data.problems ?? [],
98
+ };
99
+ }
100
+ }
101
+ function isEventKind(value) {
102
+ return value === 'created' || value === 'modified' || value === 'removed';
103
+ }
104
+ //# sourceMappingURL=XenoUseObservationSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XenoUseObservationSource.js","sourceRoot":"","sources":["../../src/observation/XenoUseObservationSource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA+BH,MAAM,kBAAkB,GAAG,MAAM,CAAA;AAEjC,MAAM,OAAO,wBAAwB;IAC1B,QAAQ,CAEhB;IAED,YAAY,OAAwC;QAClD,IAAI,CAAC,QAAQ,GAAG;YACd,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;YAC5C,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK;YACxC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AAC;IACH,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,YAAY,CAAC,MAAc;QACzB,OAAO;YACL,MAAM,EAAE,EAAE;YACV,WAAW,EAAE,KAAK;YAClB,QAAQ,EAAE,IAAI;YACd,aAAa,EAAE,CAAC;YAChB,QAAQ,EAAE,CAAC,MAAM,CAAC;SACnB,CAAA;IACH,CAAC;IAED,QAAQ,CAAC,IAAyB;QAChC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;QACtB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,IAAI,CAAC,YAAY,CAAC,0CAA0C,CAAC,CAAA;QACtE,CAAC;QACD,OAAO;YACL,sEAAsE;YACtE,oEAAoE;YACpE,0DAA0D;YAC1D,MAAM,EAAE,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAC5C,KAAK,CAAC,IAAI,IAAI,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC;gBACnC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;gBAC1C,CAAC,CAAC,EAAE,CACP;YACD,WAAW,EAAE,IAAI,CAAC,YAAY,KAAK,IAAI;YACvC,QAAQ,EAAE,IAAI,CAAC,QAAQ,KAAK,IAAI;YAChC,aAAa,EAAE,IAAI,CAAC,cAAc,IAAI,CAAC;YACvC,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,EAAE;SAC9B,CAAA;IACH,CAAC;CACF;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,UAAU,IAAI,KAAK,KAAK,SAAS,CAAA;AAC3E,CAAC"}
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Binds a RUN to a real sandbox, so tier-1 observation reaches the running app.
3
+ *
4
+ * `RunObservationService` folds a stream it is given; `XenoUseObservationSource`
5
+ * carries that stream over HTTP. Neither of them starts anything. Something has
6
+ * to spawn the sandbox, mount the run's directory into it, tell `xeno-use` to
7
+ * watch it, work out what was already there, and register all of that against a
8
+ * run id โ€” and then take it down again. That is this.
9
+ *
10
+ * Without it the service is mounted and permanently empty, which is the exact
11
+ * "built, tested, unreachable" shape this ecosystem has shipped four times.
12
+ *
13
+ * ๐Ÿ”’ **HTTP only** (locked decision 17). `xeno-use` is AGPL-3.0 and this package
14
+ * is proprietary, so nothing here imports from it โ€” the request bodies and JSON
15
+ * shapes are written out by hand for the same reason `RunObservationSource`
16
+ * redeclares its event type. That is the boundary, not duplication.
17
+ *
18
+ * ## ๐Ÿ”ด A failed start must NOT register the run
19
+ *
20
+ * This is the rule the whole module is organised around. If a sandbox cannot be
21
+ * created and the run is registered anyway, everything downstream reports
22
+ * success: `capabilityFor` answers tier 1 because the service has the run,
23
+ * `snapshot` answers `changes: [], complete: true` because nothing arrived, and
24
+ * a reviewer is shown a clean diff of a run that was never watched. An
25
+ * unobserved run must therefore be *absent*, and absent is what every consumer
26
+ * already handles honestly โ€” `capabilityFor` drops below tier 1 and `mayLand`
27
+ * refuses for want of a diff.
28
+ *
29
+ * Degrading loudly is right when observation started and then broke. Refusing
30
+ * to start is right when it never began. They are different facts and this
31
+ * distinction is what keeps them apart.
32
+ */
33
+ import type { RunContentReader, RunObservationService } from './RunObservationService.js';
34
+ /** What the run's directory is called on each side of the mount. */
35
+ export interface RunMountRequest {
36
+ /** Host directory holding the run's work, e.g. `D:\work\repo`. */
37
+ hostDirectory: string;
38
+ /** Where it appears inside the sandbox. Events come back in THESE terms. */
39
+ containerDirectory?: string;
40
+ readOnly?: boolean;
41
+ }
42
+ /**
43
+ * The paths that already existed when the run began, in CONTAINER terms.
44
+ *
45
+ * A port, because walking a filesystem is a node-side concern and this class is
46
+ * otherwise pure HTTP. `complete: false` is a first-class answer: a baseline
47
+ * that hit its bound is not "a slightly shorter list", it is a list that will
48
+ * report pre-existing files as things the agent added.
49
+ */
50
+ export interface RunBaselineScanner {
51
+ scan(request: {
52
+ hostDirectory: string;
53
+ containerDirectory: string;
54
+ }): Promise<{
55
+ paths: string[];
56
+ complete: boolean;
57
+ problem?: string;
58
+ }>;
59
+ }
60
+ export interface XenoUseRunObserverOptions {
61
+ /** Base URL of the `xeno-use` service, e.g. `http://127.0.0.1:8787`. */
62
+ baseUrl: string;
63
+ /** Bearer token. Its workspace is what authorizes every call. */
64
+ token: string;
65
+ service: RunObservationService;
66
+ /** Container image for the observation sandbox. `xeno-use`'s default when omitted. */
67
+ image?: string;
68
+ baselineScanner?: RunBaselineScanner;
69
+ /** Builds the hunk-content reader once the mount is known. Optional: review
70
+ * degrades to a change list without it, which is honest and still useful. */
71
+ createContentReader?: (mount: {
72
+ hostDirectory: string;
73
+ containerDirectory: string;
74
+ }) => RunContentReader;
75
+ fetch?: typeof globalThis.fetch;
76
+ /** Per-request timeout for the lifecycle calls. Distinct from the drain's own:
77
+ * spawning a container is slower than reading a batch off one. */
78
+ timeoutMs?: number;
79
+ /** Reported rather than thrown. A run whose observation could not start is a
80
+ * run that proceeds unobserved โ€” never a run that fails to start. */
81
+ onProblem?: (problem: {
82
+ runId: string;
83
+ reason: string;
84
+ }) => void;
85
+ }
86
+ /**
87
+ * The sandbox a run is bound to, in both sides' terms.
88
+ *
89
+ * Exposed so a composition can route EXECUTION into the same container this
90
+ * observes โ€” which is ADE ยง2.9's architecture, not a shortcut: the observation
91
+ * plane is meant to watch the sandbox the agent runs in. What was never
92
+ * legitimate, and is what `isolationIsNotObservation.test.ts` pins, is deriving
93
+ * `sandboxed` from this binding while execution still goes to the host. The
94
+ * binding is necessary for containment; it has never been sufficient.
95
+ */
96
+ export interface RunSandboxDescriptor {
97
+ sandboxId: string;
98
+ hostDirectory: string;
99
+ containerDirectory: string;
100
+ }
101
+ export declare class XenoUseRunObserver {
102
+ #private;
103
+ constructor(options: XenoUseRunObserverOptions);
104
+ /**
105
+ * The sandbox bound to a run, for a composition routing EXECUTION into it.
106
+ *
107
+ * Returns `undefined` when the run has none โ€” which every caller must treat
108
+ * as "not confined", never as "probably fine". Deliberately a plain lookup
109
+ * with no side effects: asking where a run executes must not start anything.
110
+ */
111
+ sandboxFor(runId: string): RunSandboxDescriptor | undefined;
112
+ /** Runs this observer currently holds a sandbox for. */
113
+ observedRuns(): string[];
114
+ /**
115
+ * Starts observing `runId` against a fresh sandbox mounting `hostDirectory`.
116
+ *
117
+ * Resolves `true` when the run is registered and genuinely being watched, and
118
+ * `false` when it is not โ€” including every failure. It never throws: a broken
119
+ * observation service must not take a turn down with it, because observation
120
+ * is a review capability and the run itself is the user's actual work.
121
+ *
122
+ * Idempotent per run: a second call while the first is in flight, or after it
123
+ * succeeded, returns the first answer rather than spawning another container.
124
+ */
125
+ start(runId: string, mount: RunMountRequest): Promise<boolean>;
126
+ /**
127
+ * Stops observing and removes the sandbox.
128
+ *
129
+ * The service entry is dropped FIRST and unconditionally. If the remote
130
+ * teardown fails, the alternative โ€” leaving the run registered against a dead
131
+ * sandbox โ€” means every later poll degrades against a container that no longer
132
+ * exists, which reads as "the agent's changes were lost" rather than "we
133
+ * stopped looking".
134
+ */
135
+ stop(runId: string): Promise<void>;
136
+ /** Tears every observation down. For app shutdown: a leaked container outlives
137
+ * the process that spawned it, which is how six were once found running. */
138
+ stopAll(): Promise<void>;
139
+ }
140
+ //# sourceMappingURL=XenoUseRunObserver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XenoUseRunObserver.d.ts","sourceRoot":"","sources":["../../src/observation/XenoUseRunObserver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,4BAA4B,CAAA;AAGnC,oEAAoE;AACpE,MAAM,WAAW,eAAe;IAC9B,kEAAkE;IAClE,aAAa,EAAE,MAAM,CAAA;IACrB,4EAA4E;IAC5E,kBAAkB,C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