@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 @@
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,GAMlB,MAAM,sCAAsC,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,qBAAqB,CAAA;AACnC,cAAc,yBAAyB,CAAA;AACvC,cAAc,0BAA0B,CAAA;AACxC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qCAAqC,CAAA;AACnD,cAAc,uCAAuC,CAAA;AACrD,cAAc,uCAAuC,CAAA;AACrD,cAAc,iCAAiC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,cAAc,yBAAyB,CAAA;AACvC,cAAc,wCAAwC,CAAA;AACtD,cAAc,+BAA+B,CAAA;AAC7C,cAAc,kCAAkC,CAAA;AAChD,cAAc,mCAAmC,CAAA;AACjD,cAAc,kCAAkC,CAAA;AAChD,cAAc,mCAAmC,CAAA;AACjD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,iDAAiD,CAAA;AAC/D,cAAc,8BAA8B,CAAA;AAC5C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,4CAA4C,CAAA;AAC1D,cAAc,4CAA4C,CAAA;AAC1D,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AACtC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,0CAA0C,CAAA;AACxD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,wCAAwC,CAAA;AACtD,cAAc,yCAAyC,CAAA;AACvD,cAAc,2BAA2B,CAAA;AACzC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,sCAAsC,CAAA;AACpD,cAAc,kCAAkC,CAAA;AAChD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,kCAAkC,CAAA;AAChD,cAAc,0CAA0C,CAAA;AACxD,cAAc,+BAA+B,CAAA;AAC7C,cAAc,qCAAqC,CAAA;AACnD,cAAc,oCAAoC,CAAA;AAClD,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uCAAuC,CAAA;AACrD,cAAc,6CAA6C,CAAA;AAC3D,cAAc,+CAA+C,CAAA;AAE7D,cAAc,wCAAwC,CAAA;AACtD,cAAc,iCAAiC,CAAA;AAC/C;;;;;;;;;GASG;AACH,cAAc,wCAAwC,CAAA"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * What was already on disk when a run started, in CONTAINER terms.
3
+ *
4
+ * ## Why the namespace matters more than the walk
5
+ *
6
+ * The filesystem sensor reports paths as the sandbox sees them
7
+ * (`/mnt/xeno/work/src/app.ts`), because that is the only namespace both sides
8
+ * agree on. A baseline collected in host terms (`D:\work\repo\src\app.ts`) would
9
+ * therefore match nothing, and `RunDiff` would classify every touched file as
10
+ * `added` — a diff that reads as "the agent created your whole repository".
11
+ *
12
+ * It would also be silently wrong. Nothing errors; the numbers are simply
13
+ * inflated. So the mapping is the point of this class and the walk is incidental.
14
+ *
15
+ * ## Bounds are not an optimisation
16
+ *
17
+ * A run's directory can be a monorepo with `node_modules`. Walking it without a
18
+ * bound would stall the turn that triggered it, so there are two: entries and
19
+ * elapsed time. Hitting either yields `complete: false`, which the observer
20
+ * carries into the snapshot as a degradation rather than discarding — an
21
+ * incomplete baseline over-reports, and a reviewer cannot tell an inflated diff
22
+ * from an accurate one by looking at it.
23
+ */
24
+ import type { RunBaselineScanner } from './XenoUseRunObserver.js';
25
+ export interface DirectoryBaselineScannerOptions {
26
+ /** Largest number of files to record before giving up and saying so. */
27
+ maxEntries?: number;
28
+ /** Wall-clock budget for the whole walk. */
29
+ budgetMs?: number;
30
+ now?: () => number;
31
+ }
32
+ export declare class DirectoryBaselineScanner implements RunBaselineScanner {
33
+ #private;
34
+ constructor(options?: DirectoryBaselineScannerOptions);
35
+ scan(request: {
36
+ hostDirectory: string;
37
+ containerDirectory: string;
38
+ }): Promise<{
39
+ paths: string[];
40
+ complete: boolean;
41
+ problem?: string;
42
+ }>;
43
+ }
44
+ //# sourceMappingURL=DirectoryBaselineScanner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DirectoryBaselineScanner.d.ts","sourceRoot":"","sources":["../../src/observation/DirectoryBaselineScanner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAKH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAEjE,MAAM,WAAW,+BAA+B;IAC9C,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CACnB;AAKD,qBAAa,wBAAyB,YAAW,kBAAkB;;gBAKrD,OAAO,GAAE,+BAAoC;IAMnD,IAAI,CAAC,OAAO,EAAE;QAClB,aAAa,EAAE,MAAM,CAAA;QACrB,kBAAkB,EAAE,MAAM,CAAA;KAC3B,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAwEtE"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * What was already on disk when a run started, in CONTAINER terms.
3
+ *
4
+ * ## Why the namespace matters more than the walk
5
+ *
6
+ * The filesystem sensor reports paths as the sandbox sees them
7
+ * (`/mnt/xeno/work/src/app.ts`), because that is the only namespace both sides
8
+ * agree on. A baseline collected in host terms (`D:\work\repo\src\app.ts`) would
9
+ * therefore match nothing, and `RunDiff` would classify every touched file as
10
+ * `added` — a diff that reads as "the agent created your whole repository".
11
+ *
12
+ * It would also be silently wrong. Nothing errors; the numbers are simply
13
+ * inflated. So the mapping is the point of this class and the walk is incidental.
14
+ *
15
+ * ## Bounds are not an optimisation
16
+ *
17
+ * A run's directory can be a monorepo with `node_modules`. Walking it without a
18
+ * bound would stall the turn that triggered it, so there are two: entries and
19
+ * elapsed time. Hitting either yields `complete: false`, which the observer
20
+ * carries into the snapshot as a degradation rather than discarding — an
21
+ * incomplete baseline over-reports, and a reviewer cannot tell an inflated diff
22
+ * from an accurate one by looking at it.
23
+ */
24
+ import { opendir } from 'node:fs/promises';
25
+ import { join } from 'node:path';
26
+ const DEFAULT_MAX_ENTRIES = 200_000;
27
+ const DEFAULT_BUDGET_MS = 15_000;
28
+ export class DirectoryBaselineScanner {
29
+ #maxEntries;
30
+ #budgetMs;
31
+ #now;
32
+ constructor(options = {}) {
33
+ this.#maxEntries = options.maxEntries ?? DEFAULT_MAX_ENTRIES;
34
+ this.#budgetMs = options.budgetMs ?? DEFAULT_BUDGET_MS;
35
+ this.#now = options.now ?? (() => Date.now());
36
+ }
37
+ async scan(request) {
38
+ const deadline = this.#now() + this.#budgetMs;
39
+ const paths = [];
40
+ // Iterative rather than recursive: a deep tree should bound the walk, not
41
+ // the call stack.
42
+ const queue = [
43
+ {
44
+ hostDirectory: request.hostDirectory,
45
+ // Trailing slashes are stripped HERE as well as by the observer that
46
+ // normally calls this. `/mnt/xeno/work//a.ts` matches no event, which is
47
+ // the same silent miss as a host-shaped path from a subtler cause — and
48
+ // this class is exported, so it cannot assume its caller normalised.
49
+ containerPrefix: request.containerDirectory.replace(/\/+$/, ''),
50
+ },
51
+ ];
52
+ const tooManyFiles = () => ({
53
+ paths,
54
+ complete: false,
55
+ problem: `the run's starting state was larger than ${this.#maxEntries} files, so files that already existed may report as added`,
56
+ });
57
+ while (queue.length > 0) {
58
+ if (paths.length >= this.#maxEntries)
59
+ return tooManyFiles();
60
+ if (this.#now() >= deadline) {
61
+ return {
62
+ paths,
63
+ complete: false,
64
+ problem: `reading the run's starting state took longer than ${this.#budgetMs}ms, so files that already existed may report as added`,
65
+ };
66
+ }
67
+ const next = queue.pop();
68
+ if (!next)
69
+ break;
70
+ let dir;
71
+ try {
72
+ dir = await opendir(next.hostDirectory);
73
+ }
74
+ catch (error) {
75
+ // A directory that cannot be read is a genuine hole in the baseline —
76
+ // its files WILL report as added — so it degrades rather than being
77
+ // skipped quietly. The root failing is the common case (the run's
78
+ // directory does not exist yet) and it is the same answer.
79
+ return {
80
+ paths,
81
+ complete: false,
82
+ problem: `part of the run's starting state could not be read (${reason(error)}), so files that already existed may report as added`,
83
+ };
84
+ }
85
+ for await (const entry of dir) {
86
+ // Symlinks are recorded as leaves and never followed. Following them
87
+ // could walk out of the mount entirely, and a link's TARGET is not part
88
+ // of this run's starting state even when it resolves inside.
89
+ if (entry.isDirectory()) {
90
+ queue.push({
91
+ hostDirectory: join(next.hostDirectory, entry.name),
92
+ containerPrefix: `${next.containerPrefix}/${entry.name}`,
93
+ });
94
+ continue;
95
+ }
96
+ paths.push(`${next.containerPrefix}/${entry.name}`);
97
+ // Returned from HERE, not deferred to the top of the outer loop. The
98
+ // bound can be reached while draining the last directory in the queue,
99
+ // and a deferred check never runs in that case — the walk simply ends
100
+ // and reports `complete: true` for a baseline it knows is truncated.
101
+ // Found by the test, which is the only reason it is not still true.
102
+ if (paths.length >= this.#maxEntries)
103
+ return tooManyFiles();
104
+ }
105
+ }
106
+ return { paths, complete: true };
107
+ }
108
+ }
109
+ function reason(error) {
110
+ return error instanceof Error ? error.message : String(error);
111
+ }
112
+ //# sourceMappingURL=DirectoryBaselineScanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DirectoryBaselineScanner.js","sourceRoot":"","sources":["../../src/observation/DirectoryBaselineScanner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAYhC,MAAM,mBAAmB,GAAG,OAAO,CAAA;AACnC,MAAM,iBAAiB,GAAG,MAAM,CAAA;AAEhC,MAAM,OAAO,wBAAwB;IAC1B,WAAW,CAAQ;IACnB,SAAS,CAAQ;IACjB,IAAI,CAAc;IAE3B,YAAY,UAA2C,EAAE;QACvD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,UAAU,IAAI,mBAAmB,CAAA;QAC5D,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,IAAI,iBAAiB,CAAA;QACtD,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;IAC/C,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAGV;QACC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,EAA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,CAAA;YACH,CAAC;YAED,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,EAAE,CAAC;gBAC9B,qEAAqE;gBACrE,wEAAwE;gBACxE,6DAA6D;gBAC7D,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;oBACxB,KAAK,CAAC,IAAI,CAAC;wBACT,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,IAAI,CAAC;wBACnD,eAAe,EAAE,GAAG,IAAI,CAAC,eAAe,IAAI,KAAK,CAAC,IAAI,EAAE;qBACzD,CAAC,CAAA;oBACF,SAAQ;gBACV,CAAC;gBACD,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,eAAe,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;gBACnD,qEAAqE;gBACrE,uEAAuE;gBACvE,sEAAsE;gBACtE,qEAAqE;gBACrE,oEAAoE;gBACpE,IAAI,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,WAAW;oBAAE,OAAO,YAAY,EAAE,CAAA;YAC7D,CAAC;QACH,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;IAClC,CAAC;CACF;AAED,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC/D,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Reads review content off a run's mounts — the "after" half of §2.9 hunks.
3
+ *
4
+ * Lives in the `node` entry, not `index`, because it touches the filesystem and
5
+ * `index` is renderer-safe by convention in this package.
6
+ *
7
+ * ## Why this needs no sandbox call, and no `xeno-use` dependency
8
+ *
9
+ * A bind mount **is** the host directory. That is the same property the
10
+ * filesystem sensor already relies on to observe container writes from outside,
11
+ * so current content is an ordinary host-side read. No verb, no exec, no
12
+ * licensing entanglement (see the AGPL boundary noted on `RunObservationService`).
13
+ *
14
+ * ## Containment is the whole job
15
+ *
16
+ * This maps an agent-supplied container path onto a host path and then reads it.
17
+ * That is precisely the shape of a path-traversal vulnerability, so the rule is:
18
+ * **resolve first, then verify the RESOLVED REAL path is still inside the mount.**
19
+ * Checking the string before resolving is the classic mistake — `..` segments,
20
+ * mixed separators and, most importantly, **symlinks** all defeat it. A symlink
21
+ * inside a mount pointing at `C:\Users\...\.ssh` is a file the container can
22
+ * create and this reader would happily follow.
23
+ *
24
+ * A review pane is not an exemption from containment.
25
+ */
26
+ import type { RunChangeContent, RunContentReader } from './RunObservationService.js';
27
+ /** One mount, as the run was granted it. */
28
+ export interface MountBinding {
29
+ /** Host directory, e.g. `D:\work\repo`. */
30
+ source: string;
31
+ /** Container path it appears at, e.g. `/mnt/xeno/work`. */
32
+ target: string;
33
+ }
34
+ /**
35
+ * Supplies the pre-run bytes for a path.
36
+ *
37
+ * Separate from this reader because it CANNOT be a filesystem read of the same
38
+ * location: by the time a change is observed, the previous content is gone. It
39
+ * comes from something captured before the run — normally git's pre-run commit.
40
+ * Absent, review shows an "after" side only, which is honest and still useful.
41
+ */
42
+ export interface RunBaselineContentSource {
43
+ read(containerPath: string): Promise<string | undefined> | string | undefined;
44
+ }
45
+ export interface MountContentReaderOptions {
46
+ mounts: MountBinding[];
47
+ baseline?: RunBaselineContentSource;
48
+ /**
49
+ * Largest file this will decode, in bytes.
50
+ *
51
+ * A cap rather than a preference: a review pane that reads a 2 GB artifact
52
+ * into the host's heap to render a hunk nobody asked for is a denial of
53
+ * service the agent can trigger by writing one file. Truncation is reported,
54
+ * never silent — a hunk cut off without saying so is a diff that lies.
55
+ */
56
+ maxBytes?: number;
57
+ }
58
+ export declare class MountContentReader implements RunContentReader {
59
+ #private;
60
+ constructor(options: MountContentReaderOptions);
61
+ read(path: string): Promise<RunChangeContent>;
62
+ }
63
+ //# sourceMappingURL=MountContentReader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MountContentReader.d.ts","sourceRoot":"","sources":["../../src/observation/MountContentReader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAKH,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAEpF,4CAA4C;AAC5C,MAAM,WAAW,YAAY;IAC3B,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAA;IACd,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,wBAAwB;IACvC,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,GAAG,SAAS,CAAA;CAC9E;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,YAAY,EAAE,CAAA;IACtB,QAAQ,CAAC,EAAE,wBAAwB,CAAA;IACnC;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAMD,qBAAa,kBAAmB,YAAW,gBAAgB;;gBAK7C,OAAO,EAAE,yBAAyB;IASxC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;CA4FpD"}
@@ -0,0 +1,158 @@
1
+ /**
2
+ * Reads review content off a run's mounts — the "after" half of §2.9 hunks.
3
+ *
4
+ * Lives in the `node` entry, not `index`, because it touches the filesystem and
5
+ * `index` is renderer-safe by convention in this package.
6
+ *
7
+ * ## Why this needs no sandbox call, and no `xeno-use` dependency
8
+ *
9
+ * A bind mount **is** the host directory. That is the same property the
10
+ * filesystem sensor already relies on to observe container writes from outside,
11
+ * so current content is an ordinary host-side read. No verb, no exec, no
12
+ * licensing entanglement (see the AGPL boundary noted on `RunObservationService`).
13
+ *
14
+ * ## Containment is the whole job
15
+ *
16
+ * This maps an agent-supplied container path onto a host path and then reads it.
17
+ * That is precisely the shape of a path-traversal vulnerability, so the rule is:
18
+ * **resolve first, then verify the RESOLVED REAL path is still inside the mount.**
19
+ * Checking the string before resolving is the classic mistake — `..` segments,
20
+ * mixed separators and, most importantly, **symlinks** all defeat it. A symlink
21
+ * inside a mount pointing at `C:\Users\...\.ssh` is a file the container can
22
+ * create and this reader would happily follow.
23
+ *
24
+ * A review pane is not an exemption from containment.
25
+ */
26
+ import { readFile, realpath } from 'node:fs/promises';
27
+ import { isAbsolute, relative, resolve, sep } from 'node:path';
28
+ const DEFAULT_MAX_BYTES = 2 * 1024 * 1024;
29
+ /** Git's own heuristic window for binary detection. */
30
+ const BINARY_SNIFF_BYTES = 8_000;
31
+ export class MountContentReader {
32
+ #mounts;
33
+ #baseline;
34
+ #maxBytes;
35
+ constructor(options) {
36
+ this.#mounts = options.mounts.map((mount) => ({
37
+ source: resolve(mount.source),
38
+ target: normaliseTarget(mount.target),
39
+ }));
40
+ this.#baseline = options.baseline;
41
+ this.#maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
42
+ }
43
+ async read(path) {
44
+ const hostPath = this.#toHostPath(path);
45
+ if (!hostPath) {
46
+ return {
47
+ path,
48
+ binary: false,
49
+ truncated: false,
50
+ refusal: 'path is not inside any mount granted to this run',
51
+ };
52
+ }
53
+ const before = await this.#readBaseline(path);
54
+ let after;
55
+ try {
56
+ after = await this.#readContained(hostPath);
57
+ }
58
+ catch (error) {
59
+ // A deleted file is the ORDINARY case here — the diff said `deleted`, so
60
+ // its absence is the expected finding rather than a failure. Anything
61
+ // else is reported as a refusal rather than swallowed into "no content",
62
+ // which would make a permissions problem look like an empty file.
63
+ const code = error.code;
64
+ if (code !== 'ENOENT') {
65
+ return {
66
+ path,
67
+ ...(before === undefined ? {} : { before }),
68
+ binary: false,
69
+ truncated: false,
70
+ refusal: `could not read current content: ${code ?? 'unknown error'}`,
71
+ };
72
+ }
73
+ }
74
+ if (after === undefined) {
75
+ return { path, ...(before === undefined ? {} : { before }), binary: false, truncated: false };
76
+ }
77
+ if (isBinary(after)) {
78
+ // Deliberately no `after` string. Decoding binary to UTF-8 yields
79
+ // replacement characters that render as a plausible-looking text diff of
80
+ // something that was never text.
81
+ return { path, ...(before === undefined ? {} : { before }), binary: true, truncated: false };
82
+ }
83
+ const truncated = after.byteLength > this.#maxBytes;
84
+ return {
85
+ path,
86
+ ...(before === undefined ? {} : { before }),
87
+ after: after.subarray(0, this.#maxBytes).toString('utf8'),
88
+ binary: false,
89
+ truncated,
90
+ };
91
+ }
92
+ async #readBaseline(containerPath) {
93
+ if (!this.#baseline)
94
+ return undefined;
95
+ return (await this.#baseline.read(containerPath)) ?? undefined;
96
+ }
97
+ /**
98
+ * Reads a host path, re-verifying containment AFTER symlink resolution.
99
+ *
100
+ * The mapping in `#toHostPath` already rejects `..` escapes textually. This is
101
+ * the second check, and it is the one that catches a symlink the container
102
+ * planted inside its own mount — which the string check cannot see, because
103
+ * the string is entirely well-formed.
104
+ */
105
+ async #readContained(hostPath) {
106
+ const real = await realpath(hostPath);
107
+ if (!this.#mounts.some((mount) => isInside(mount.source, real))) {
108
+ const error = new Error('resolved path escapes its mount');
109
+ error.code = 'EACCES';
110
+ throw error;
111
+ }
112
+ return readFile(real);
113
+ }
114
+ /** Container path → host path, or `undefined` when it belongs to no mount. */
115
+ #toHostPath(containerPath) {
116
+ const normalised = containerPath.replace(/\\/g, '/');
117
+ for (const mount of this.#mounts) {
118
+ if (normalised === mount.target)
119
+ return mount.source;
120
+ if (!normalised.startsWith(`${mount.target}/`))
121
+ continue;
122
+ const relativePart = normalised.slice(mount.target.length + 1);
123
+ // Rejected BEFORE resolution rather than resolved and checked: a path
124
+ // containing `..` has no legitimate reason to reach a review pane, and
125
+ // refusing the input is clearer than proving the output happened to land
126
+ // somewhere acceptable.
127
+ if (relativePart.split('/').includes('..'))
128
+ return undefined;
129
+ const candidate = resolve(mount.source, relativePart);
130
+ if (!isInside(mount.source, candidate))
131
+ return undefined;
132
+ return candidate;
133
+ }
134
+ return undefined;
135
+ }
136
+ }
137
+ function normaliseTarget(target) {
138
+ const unified = target.replace(/\\/g, '/').replace(/\/+$/, '');
139
+ return unified === '' ? '/' : unified;
140
+ }
141
+ /**
142
+ * True when `candidate` is `root` or lies beneath it.
143
+ *
144
+ * Uses `relative` rather than `startsWith`, because `startsWith` reports
145
+ * `D:\work\repo-other` as inside `D:\work\repo` — the prefix bug that turns a
146
+ * scoped grant into a wider one.
147
+ */
148
+ function isInside(root, candidate) {
149
+ if (root === candidate)
150
+ return true;
151
+ const rel = relative(root, candidate);
152
+ return rel !== '' && !rel.startsWith('..') && !isAbsolute(rel) && !rel.startsWith(`..${sep}`);
153
+ }
154
+ /** A NUL byte in the first window means binary — git's heuristic. */
155
+ function isBinary(content) {
156
+ return content.subarray(0, BINARY_SNIFF_BYTES).includes(0);
157
+ }
158
+ //# sourceMappingURL=MountContentReader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MountContentReader.js","sourceRoot":"","sources":["../../src/observation/MountContentReader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAsC9D,MAAM,iBAAiB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA;AACzC,uDAAuD;AACvD,MAAM,kBAAkB,GAAG,KAAK,CAAA;AAEhC,MAAM,OAAO,kBAAkB;IACpB,OAAO,CAAgB;IACvB,SAAS,CAAsC;IAC/C,SAAS,CAAQ;IAE1B,YAAY,OAAkC;QAC5C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC5C,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC;YAC7B,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,MA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,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAA;AACvC,CAAC;AAED;;;;;;GAMG;AACH,SAAS,QAAQ,CAAC,IAAY,EAAE,SAAiB;IAC/C,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,IAAI,CAAA;IACnC,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;IACrC,OAAO,GAAG,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,GAAG,EAAE,CAAC,CAAA;AAC/F,CAAC;AAED,qEAAqE;AACrE,SAAS,QAAQ,CAAC,OAAe;IAC/B,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;AAC5D,CAAC"}
@@ -0,0 +1,229 @@
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 { type CapabilityResolution, type CapabilitySources, type KnownCapability, type LandingOverlapReport, type RunChange, type RunFileEvent } from '@xenosystem/agent-interface-core';
37
+ /**
38
+ * One bounded drain from a run's sandbox.
39
+ *
40
+ * Mirrors what `xeno-use`'s observation surface returns, as a SHAPE rather than
41
+ * an import — three event kinds and four completeness facts. Redeclaring it is
42
+ * what keeps the AGPL boundary intact; there is nothing here that could be
43
+ * imported instead without creating the linkage this port exists to avoid.
44
+ */
45
+ export interface RunObservationBatch {
46
+ events: RunFileEvent[];
47
+ /** The per-call bound was hit; drain again. Not a loss. */
48
+ morePending?: boolean;
49
+ /** Observation is known to be incomplete. */
50
+ degraded?: boolean;
51
+ /** Events the sandbox's backlog refused. These will never arrive. */
52
+ droppedEvents?: number;
53
+ /** Why, in prose, for a human. */
54
+ problems?: string[];
55
+ }
56
+ export interface RunObservationSource {
57
+ /** Drains at most `maxEvents`. May be async: a real source crosses a process
58
+ * or network boundary, and a synchronous port would force every adapter to
59
+ * block on it. */
60
+ drain(maxEvents: number): RunObservationBatch | Promise<RunObservationBatch>;
61
+ }
62
+ /**
63
+ * Content for one changed path — §2.9 hunk-level review.
64
+ *
65
+ * `before` and `after` are independently optional because they fail for
66
+ * different reasons: `after` is absent for a deleted file, `before` for an added
67
+ * one, and either can be refused. `refusal` says WHICH, because a reviewer
68
+ * shown an empty pane must be able to tell "this file is empty" from "we would
69
+ * not read this".
70
+ */
71
+ export interface RunChangeContent {
72
+ path: string;
73
+ before?: string;
74
+ after?: string;
75
+ /** Content was not decoded as text. Never partially rendered as a hunk. */
76
+ binary: boolean;
77
+ /** Content exceeded the read cap and is cut short. */
78
+ truncated: boolean;
79
+ /** Present when a side could not be produced, in terms a human can act on. */
80
+ refusal?: string;
81
+ }
82
+ /**
83
+ * Resolves file content for review.
84
+ *
85
+ * A PORT, like `RunObservationSource`, and for the same licensing reason — but
86
+ * note the asymmetry the spec records: the **after** side needs no sandbox call
87
+ * at all, because a bind mount IS the host directory. The **before** side
88
+ * cannot come from the sandbox even in principle: by the time the watcher
89
+ * reports a write, the previous bytes are gone. It has to come from something
90
+ * captured before the run — git, normally.
91
+ */
92
+ export interface RunContentReader {
93
+ read(path: string): RunChangeContent | Promise<RunChangeContent>;
94
+ }
95
+ /** A run's net changes, WITH whether they are the whole story. */
96
+ export interface RunObservationSnapshot {
97
+ runId: string;
98
+ changes: RunChange[];
99
+ /**
100
+ * False when anything is known to have been missed. A surface must not
101
+ * present an incomplete diff as a review — §2.9's whole claim is that tier 1
102
+ * yields "a real diff", and a diff that quietly omits changes is worse than
103
+ * no diff, because a reviewer acts on it.
104
+ */
105
+ complete: boolean;
106
+ droppedEvents: number;
107
+ problems: string[];
108
+ }
109
+ /** What goes on the host event feed. Counts, never contents. */
110
+ export interface RunObservationSummary {
111
+ runId: string;
112
+ added: number;
113
+ modified: number;
114
+ deleted: number;
115
+ complete: boolean;
116
+ droppedEvents: number;
117
+ }
118
+ export interface RunObservationServiceOptions {
119
+ /**
120
+ * Events per drain, and drains per poll. Both bounded, for the reason the
121
+ * sandbox's own drain is bounded: a poll that loops until a busy run stops
122
+ * producing does not return, and "wait for the filesystem to go quiet" is not
123
+ * a termination condition.
124
+ */
125
+ maxEventsPerDrain?: number;
126
+ maxDrainsPerPoll?: number;
127
+ emit?: (summary: RunObservationSummary) => void;
128
+ }
129
+ export declare class RunObservationService {
130
+ #private;
131
+ constructor(options?: RunObservationServiceOptions);
132
+ /** Mirrors `CoordinationService.setEventSink` — the host is constructed with
133
+ * its services, so a sink fixed at construction could not be the host. */
134
+ setEventSink(emit: (summary: RunObservationSummary) => void): void;
135
+ /**
136
+ * Begins observing a run.
137
+ *
138
+ * `baseline` is the set of paths that existed when the run started. Its
139
+ * ABSENCE is meaningful and not a default: with no baseline every modified
140
+ * file reports as `added`, because nothing says it was there before. Callers
141
+ * that cannot supply one get a diff that is still useful and still honest —
142
+ * `added` really does mean "this run touched a path we have no prior record
143
+ * of" — but they should know that is what they are reading.
144
+ */
145
+ observe(runId: string, source: RunObservationSource, options?: {
146
+ baseline?: Iterable<string>;
147
+ content?: RunContentReader;
148
+ /**
149
+ * Observation began already knowing it is imperfect.
150
+ *
151
+ * The case this exists for is a baseline that could not be established:
152
+ * without one, files that existed before the run report as `added`, so the
153
+ * diff is not merely shorter — it attributes existing work to the agent.
154
+ * That is a completeness fact known at registration, and the only
155
+ * alternative to carrying it is discovering it during review.
156
+ */
157
+ degraded?: boolean;
158
+ /** Why, in prose, for the human who will read the snapshot. */
159
+ problems?: Iterable<string>;
160
+ }): void;
161
+ /**
162
+ * Content for one changed path, for hunk-level review.
163
+ *
164
+ * ⚠️ **A SNAPSHOT, not the state at the event.** The agent may have written
165
+ * again between the change being observed and this read, so a hunk view can
166
+ * disagree with the change list that prompted it. That is inherent to sampling
167
+ * a live filesystem rather than a defect to engineer away — but it means a
168
+ * surface must never label this "what the agent did at 10:04:03".
169
+ *
170
+ * Refuses a path the run has not actually changed. Reading arbitrary paths
171
+ * through a review API would turn a review pane into a file browser scoped to
172
+ * the sandbox, which is a different capability with a different consent story.
173
+ */
174
+ readChange(runId: string, path: string): Promise<RunChangeContent | undefined>;
175
+ stopObserving(runId: string): void;
176
+ observedRuns(): string[];
177
+ /**
178
+ * Drains what the sandbox has produced and folds it in.
179
+ *
180
+ * Returns the snapshot rather than only emitting it, so a caller that wants
181
+ * the answer does not have to subscribe to learn the result of its own call.
182
+ */
183
+ poll(runId: string): Promise<RunObservationSnapshot | undefined>;
184
+ /**
185
+ * What a run can deliver for a capability, and from which tier.
186
+ *
187
+ * §8: *"Reporting them unavailable for a third-party agent is a defect, not
188
+ * honest degradation — the data is in the sandbox."* This is the only place
189
+ * that can answer honestly, because it is the only place that knows whether a
190
+ * sandbox is actually being observed for this run — so the answer is DERIVED
191
+ * from that fact rather than configured.
192
+ *
193
+ * `acp` and `vendorSideChannel` are passed in by the caller, which knows what
194
+ * the run's provider supports. Absent, the answer is the tier-1 one: correct
195
+ * for a third-party agent in `native-tui`, which is the case §2.9 exists for.
196
+ */
197
+ capabilityFor(runId: string, capability: KnownCapability, sources?: Partial<Omit<CapabilitySources, 'sandboxObservation'>>): CapabilityResolution;
198
+ /**
199
+ * Where the observed runs collide — §5.7 conflict-aware landing.
200
+ *
201
+ * Computed from OBSERVED diffs rather than from claims, because nothing forces
202
+ * an agent to claim a path before writing it, and the agent that surprises us
203
+ * is exactly the one whose overlap matters. Claims remain complementary: pass
204
+ * them in and the report says whether a collision was invisible to the
205
+ * registry or whether a claim was released.
206
+ *
207
+ * Available *while the runs are alive*, which is the point — after the merge
208
+ * it is archaeology. Completeness rides along: a run with a hole in its diff
209
+ * cannot rule out an overlap, and `mayLand` refuses on that rather than
210
+ * reporting a clean landing it did not measure.
211
+ */
212
+ landingOverlaps(claimedPathsByRun?: Record<string, string[]>,
213
+ /**
214
+ * 🔴 Runs the CALLER knows exist. Any of them this service never observed
215
+ * makes the report incomplete, so `mayLand` refuses.
216
+ *
217
+ * This rule lives HERE, not in the caller, because it was in the caller
218
+ * once and the shipping landing gate bypassed it: `apps/desktop` calls this
219
+ * method directly while the host's RPC reader had its own copy of the check.
220
+ * The surface told the truth and the gate that actually merges did not —
221
+ * so the rule belongs where every caller passes through.
222
+ *
223
+ * A caller that knows of no other runs passes nothing and loses nothing.
224
+ */
225
+ knownRunIds?: readonly string[]): LandingOverlapReport;
226
+ /** The current diff without draining. */
227
+ snapshot(runId: string): RunObservationSnapshot | undefined;
228
+ }
229
+ //# sourceMappingURL=RunObservationService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RunObservationService.d.ts","sourceRoot":"","sources":["../../src/observation/RunObservationService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,SAAS,EAEd,KAAK,YAAY,EAClB,MAAM,kCAAkC,CAAA;AAEzC;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,YAAY,EAAE,CAAA;IACtB,2DAA2D;IAC3D,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,qEAAqE;IACrE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC;;uBAEmB;IACnB,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;CAC7E;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,2EAA2E;IAC3E,MAAM,EAAE,OAAO,CAAA;IACf,sDAAsD;IACtD,SAAS,EAAE,OAAO,CAAA;IAClB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,O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