@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,168 @@
1
+ /**
2
+ * Work that is already written down in the code — ADE §5.1.
3
+ *
4
+ * §5.1 names the sources work arrives from: *"a typed instruction, a spec or
5
+ * plan document, **a repository TODO**, an issue tracker, a scheduled trigger,
6
+ * or another agent."* This is that one, and it is the right first source for
7
+ * three reasons: it needs no credentials, no network and no tracker account, so
8
+ * it works on a fresh install; the work is genuinely there; and it exercises the
9
+ * `IntakeSource` seam without teaching this package what a tracker is.
10
+ *
11
+ * ## 🔴 A scan that could not read is a FAILED source, never an empty one
12
+ *
13
+ * `list()` throws rather than returning `[]` when the root cannot be read.
14
+ * `IntakeService` captures that as a failed source and marks the inbox
15
+ * incomplete — an empty inbox reads as "nothing to pick up", so a person stops
16
+ * looking. An unreadable directory is not an absence of work.
17
+ *
18
+ * Per-FILE read errors are different and are skipped: one unreadable file in a
19
+ * tree of thousands should not blank the inbox, and it is not evidence about the
20
+ * others. The distinction is deliberate: the root failing means the scan did not
21
+ * happen; a file failing means the scan happened and missed one thing.
22
+ *
23
+ * ## What it deliberately does not do
24
+ *
25
+ * No git. No ranking. No parsing beyond the marker and its line. §5.1's boundary
26
+ * is that XENO Agent "does not become a ticket system", and a TODO scanner that
27
+ * starts inferring priority and assignees is one.
28
+ */
29
+ import { readdir, readFile, stat } from 'node:fs/promises';
30
+ import { extname, join, relative, sep } from 'node:path';
31
+ import { intakeItemId } from '@xenosystem/agent-interface-core';
32
+ /**
33
+ * Markers, in the form the ecosystem already writes them.
34
+ *
35
+ * `TODO(name):` and `TODO:` both appear in this repo, and a marker inside a word
36
+ * (`MASTODON`) is not one — hence the boundary and the required punctuation.
37
+ */
38
+ const MARKER = /\b(TODO|FIXME|HACK|XXX)\b(?:\([^)]*\))?\s*:\s*(.+)$/;
39
+ /** Directories never worth scanning. Not a preference — these are generated. */
40
+ const SKIP_DIRECTORIES = new Set([
41
+ 'node_modules', '.git', 'dist', 'out', 'build', 'coverage', '.next', '.turbo',
42
+ '.worktrees', 'target', 'vendor', '__pycache__',
43
+ ]);
44
+ /** Extensions worth reading. An allow-list, because a binary is not a TODO. */
45
+ const SCAN_EXTENSIONS = new Set([
46
+ '.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs', '.rs', '.go', '.py', '.rb',
47
+ '.java', '.kt', '.swift', '.c', '.h', '.cc', '.cpp', '.cs', '.sh', '.ps1',
48
+ '.md', '.yml', '.yaml', '.toml',
49
+ ]);
50
+ const DEFAULT_MAX_FILES = 2_000;
51
+ const DEFAULT_MAX_ITEMS = 200;
52
+ const DEFAULT_MAX_FILE_BYTES = 512 * 1024;
53
+ export class RepositoryTodoIntakeSource {
54
+ id;
55
+ label;
56
+ #root;
57
+ #maxFiles;
58
+ #maxItems;
59
+ #maxFileBytes;
60
+ #externalIdPrefix;
61
+ /** True when a cap stopped the scan early. Read by `truncated()`. */
62
+ #truncated = false;
63
+ constructor(options) {
64
+ this.id = options.id ?? 'repository-todo';
65
+ this.label = options.label ?? 'Repository TODOs';
66
+ this.#root = options.rootDirectory;
67
+ this.#maxFiles = options.maxFiles ?? DEFAULT_MAX_FILES;
68
+ this.#maxItems = options.maxItems ?? DEFAULT_MAX_ITEMS;
69
+ this.#maxFileBytes = options.maxFileBytes ?? DEFAULT_MAX_FILE_BYTES;
70
+ this.#externalIdPrefix = options.externalIdPrefix ?? '';
71
+ }
72
+ /**
73
+ * True when a cap stopped the scan before the tree was exhausted.
74
+ *
75
+ * 🔴 Exposed rather than swallowed. A truncated scan that looked complete
76
+ * would tell a developer their inbox is empty of everything below the cap,
77
+ * which is a claim this source cannot make.
78
+ */
79
+ truncated() {
80
+ return this.#truncated;
81
+ }
82
+ async list() {
83
+ this.#truncated = false;
84
+ // Deliberately NOT caught: a root that cannot be read means the scan did
85
+ // not happen, and `IntakeService` must report a failed source rather than
86
+ // an empty one.
87
+ const rootStat = await stat(this.#root);
88
+ if (!rootStat.isDirectory()) {
89
+ throw new Error(`Repository TODO source root is not a directory: ${this.#root}`);
90
+ }
91
+ const items = [];
92
+ let filesScanned = 0;
93
+ const walk = async (directory) => {
94
+ if (items.length >= this.#maxItems || filesScanned >= this.#maxFiles)
95
+ return;
96
+ let entries;
97
+ try {
98
+ entries = await readdir(directory, { withFileTypes: true });
99
+ }
100
+ catch {
101
+ // One unreadable directory is not evidence about the rest of the tree.
102
+ return;
103
+ }
104
+ for (const entry of entries) {
105
+ if (items.length >= this.#maxItems || filesScanned >= this.#maxFiles) {
106
+ this.#truncated = true;
107
+ return;
108
+ }
109
+ // A dotfile directory is skipped, a dotfile is not: `.eslintrc` may
110
+ // carry a TODO and reading it costs nothing.
111
+ if (entry.isDirectory()) {
112
+ if (SKIP_DIRECTORIES.has(entry.name) || entry.name.startsWith('.'))
113
+ continue;
114
+ await walk(join(directory, entry.name));
115
+ continue;
116
+ }
117
+ if (!entry.isFile())
118
+ continue;
119
+ if (!SCAN_EXTENSIONS.has(extname(entry.name).toLowerCase()))
120
+ continue;
121
+ filesScanned += 1;
122
+ const absolute = join(directory, entry.name);
123
+ let contents;
124
+ try {
125
+ const raw = await readFile(absolute);
126
+ contents = raw.subarray(0, this.#maxFileBytes).toString('utf8');
127
+ }
128
+ catch {
129
+ // Skipped, not fatal — see the header on the root/file distinction.
130
+ continue;
131
+ }
132
+ const relativePath = relative(this.#root, absolute).split(sep).join('/');
133
+ const lines = contents.split(/\r?\n/);
134
+ for (let index = 0; index < lines.length; index += 1) {
135
+ if (items.length >= this.#maxItems) {
136
+ this.#truncated = true;
137
+ return;
138
+ }
139
+ const match = MARKER.exec(lines[index]);
140
+ if (!match)
141
+ continue;
142
+ const marker = match[1];
143
+ const text = match[2].trim();
144
+ if (!text)
145
+ continue;
146
+ const source = {
147
+ sourceId: this.id,
148
+ // Stable across scans for an unchanged line, and unique within the
149
+ // source. Line-based, so moving a TODO makes a new item -- which is
150
+ // honest: this source has no way to track identity across edits.
151
+ externalId: `${this.#externalIdPrefix}${relativePath}#${index + 1}`,
152
+ };
153
+ items.push({
154
+ id: intakeItemId(source),
155
+ source,
156
+ title: `${marker}: ${text.length > 120 ? `${text.slice(0, 117)}...` : text}`,
157
+ detail: `${relativePath}:${index + 1}\n${lines[index].trim()}`,
158
+ });
159
+ }
160
+ }
161
+ };
162
+ await walk(this.#root);
163
+ if (filesScanned >= this.#maxFiles)
164
+ this.#truncated = true;
165
+ return items;
166
+ }
167
+ }
168
+ //# sourceMappingURL=RepositoryTodoIntakeSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RepositoryTodoIntakeSource.js","sourceRoot":"","sources":["../../src/intake/RepositoryTodoIntakeSource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE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,CAAC,IAAI,EAAE,EAAE;qBAC3E,CAAC,CAAA;gBACJ,CAAC;YACH,CAAC;QACH,CAAC,CAAA;QAED,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACtB,IAAI,YAAY,IAAI,IAAI,CAAC,SAAS;YAAE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAA;QAC1D,OAAO,KAAK,CAAA;IACd,CAAC;CACF"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Repository TODOs across the directories the user granted — ADE §5.1.
3
+ *
4
+ * `RepositoryTodoIntakeSource` scans ONE tree. This is what the composition
5
+ * mounts, and its only job is answering the question that blocked the mount:
6
+ * *which* tree?
7
+ *
8
+ * 🔴 **The answer is forced, not chosen: the directories the user granted.**
9
+ * The workspace authority exists so the host reads only what a person
10
+ * authorised through a native dialog. Any other root — the home directory, the
11
+ * process cwd, a guess — would scan a tree nobody permitted. So this is not a
12
+ * product preference about scope; it is the only root the host is allowed to
13
+ * read, which is why it needed no decision to build.
14
+ *
15
+ * ## Roots are read at LIST time, not at construction
16
+ *
17
+ * Sources are polled. Reading the grant set on every `list()` means a directory
18
+ * granted after startup appears in the next poll with no registration
19
+ * lifecycle, no event type, and no cache to invalidate — the three things a
20
+ * notification-based design would have added.
21
+ *
22
+ * ## A failed root fails the SOURCE
23
+ *
24
+ * If any granted root cannot be read, this throws, exactly as the single-root
25
+ * scanner does. `IntakeService` then marks the inbox incomplete. Returning the
26
+ * items it did find would report a partial inbox as a whole one, and an inbox
27
+ * that looks complete is one a person stops checking.
28
+ */
29
+ import type { IntakeItem } from '@xenosystem/agent-interface-core';
30
+ import type { IntakeSource } from './IntakeService.js';
31
+ export interface WorkspaceTodoIntakeSourceOptions {
32
+ id?: string;
33
+ label?: string;
34
+ /** Read on every `list()`. See the header. */
35
+ resolveRoots: () => string[];
36
+ /**
37
+ * Bounded because a person may have granted many directories over time and an
38
+ * intake poll must return. Exceeding it is reported through `truncated()`
39
+ * rather than silently ignoring the rest.
40
+ */
41
+ maxRoots?: number;
42
+ maxItemsPerRoot?: number;
43
+ }
44
+ export declare class WorkspaceTodoIntakeSource implements IntakeSource {
45
+ #private;
46
+ readonly id: string;
47
+ readonly label: string;
48
+ constructor(options: WorkspaceTodoIntakeSourceOptions);
49
+ /** True when a cap, or a per-root cap, stopped the scan early. */
50
+ truncated(): boolean;
51
+ list(): Promise<IntakeItem[]>;
52
+ }
53
+ //# sourceMappingURL=WorkspaceTodoIntakeSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkspaceTodoIntakeSource.d.ts","sourceRoot":"","sources":["../../src/intake/WorkspaceTodoIntakeSource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAElE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAGtD,MAAM,WAAW,gCAAgC;IAC/C,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,8CAA8C;IAC9C,YAAY,EAAE,MAAM,MAAM,EAAE,CAAA;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAID,qBAAa,yBAA0B,YAAW,YAAY;;IAC5D,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;gBAMV,OAAO,EAAE,gCAAgC;IAQrD,kEAAkE;IAClE,SAAS,IAAI,OAAO;IAId,IAAI,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;CA6BpC"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Repository TODOs across the directories the user granted — ADE §5.1.
3
+ *
4
+ * `RepositoryTodoIntakeSource` scans ONE tree. This is what the composition
5
+ * mounts, and its only job is answering the question that blocked the mount:
6
+ * *which* tree?
7
+ *
8
+ * 🔴 **The answer is forced, not chosen: the directories the user granted.**
9
+ * The workspace authority exists so the host reads only what a person
10
+ * authorised through a native dialog. Any other root — the home directory, the
11
+ * process cwd, a guess — would scan a tree nobody permitted. So this is not a
12
+ * product preference about scope; it is the only root the host is allowed to
13
+ * read, which is why it needed no decision to build.
14
+ *
15
+ * ## Roots are read at LIST time, not at construction
16
+ *
17
+ * Sources are polled. Reading the grant set on every `list()` means a directory
18
+ * granted after startup appears in the next poll with no registration
19
+ * lifecycle, no event type, and no cache to invalidate — the three things a
20
+ * notification-based design would have added.
21
+ *
22
+ * ## A failed root fails the SOURCE
23
+ *
24
+ * If any granted root cannot be read, this throws, exactly as the single-root
25
+ * scanner does. `IntakeService` then marks the inbox incomplete. Returning the
26
+ * items it did find would report a partial inbox as a whole one, and an inbox
27
+ * that looks complete is one a person stops checking.
28
+ */
29
+ import { createHash } from 'node:crypto';
30
+ import { RepositoryTodoIntakeSource } from './RepositoryTodoIntakeSource.js';
31
+ const DEFAULT_MAX_ROOTS = 8;
32
+ export class WorkspaceTodoIntakeSource {
33
+ id;
34
+ label;
35
+ #resolveRoots;
36
+ #maxRoots;
37
+ #maxItemsPerRoot;
38
+ #truncated = false;
39
+ constructor(options) {
40
+ this.id = options.id ?? 'repository-todo';
41
+ this.label = options.label ?? 'Repository TODOs';
42
+ this.#resolveRoots = options.resolveRoots;
43
+ this.#maxRoots = options.maxRoots ?? DEFAULT_MAX_ROOTS;
44
+ this.#maxItemsPerRoot = options.maxItemsPerRoot;
45
+ }
46
+ /** True when a cap, or a per-root cap, stopped the scan early. */
47
+ truncated() {
48
+ return this.#truncated;
49
+ }
50
+ async list() {
51
+ this.#truncated = false;
52
+ const roots = this.#resolveRoots();
53
+ const scanned = roots.slice(0, this.#maxRoots);
54
+ if (scanned.length < roots.length)
55
+ this.#truncated = true;
56
+ const items = [];
57
+ for (const root of scanned) {
58
+ const scanner = new RepositoryTodoIntakeSource({
59
+ // The SAME source id, so every TODO belongs to one source in the UI.
60
+ id: this.id,
61
+ label: this.label,
62
+ rootDirectory: root,
63
+ // 🔴 ...but a per-root PREFIX, because the scanner's external id is
64
+ // the path RELATIVE to its root: `src/a.ts#2` in two granted directories
65
+ // would otherwise be ONE id for two different TODOs, and claiming is by
66
+ // id. Derived from the root, so it is stable across polls and across
67
+ // reorderings of the grant list — a positional prefix would change an
68
+ // item's identity when an unrelated directory was granted.
69
+ externalIdPrefix: `${createHash('sha256').update(root).digest('hex').slice(0, 8)}:`,
70
+ ...(this.#maxItemsPerRoot === undefined ? {} : { maxItems: this.#maxItemsPerRoot }),
71
+ });
72
+ // Deliberately not caught: see the header. A root that cannot be read
73
+ // means this scan did not happen.
74
+ items.push(...await scanner.list());
75
+ if (scanner.truncated())
76
+ this.#truncated = true;
77
+ }
78
+ return items;
79
+ }
80
+ }
81
+ //# sourceMappingURL=WorkspaceTodoIntakeSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkspaceTodoIntakeSource.js","sourceRoot":"","sources":["../../src/intake/WorkspaceTodoIntakeSource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAKxC,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AAgB5E,MAAM,iBAAiB,GAAG,CAAC,CAAA;AAE3B,MAAM,OAAO,yBAAyB;IAC3B,EAAE,CAAQ;IACV,KAAK,CAAQ;IACb,aAAa,CAAgB;IAC7B,SAAS,CAAQ;IACjB,gBAAgB,CAAoB;IAC7C,UAAU,GAAG,KAAK,CAAA;IAElB,YAAY,OAAyC;QACnD,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,IAAI,iBAAiB,CAAA;QACzC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,kBAAkB,CAAA;QAChD,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,YAA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,CAAC,IAAI,CAAC,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;YACnC,IAAI,OAAO,CAAC,SAAS,EAAE;gBAAE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAA;QACjD,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;CACF"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * The one shape every agent-reachable command execution shares — ADE §5.3.
3
+ *
4
+ * ADOPTED at one of three sites. `EngineeringWorkbenchService.runProcess` runs
5
+ * through it via `LocalCommandExecutor`; `WorkspaceHostService.runCommand` and
6
+ * `executeWindowsPowerShellTool` in `packages/electron-host/src/sdkAgent.ts`
7
+ * still spawn directly.
8
+ *
9
+ * They move one at a time on purpose. Each carries its own access control that
10
+ * has to be reconciled rather than dropped — a string blocklist plus path
11
+ * authorization in one, consent plus a runtime policy engine plus a path
12
+ * allowlist in the other — and three in a single commit would be three
13
+ * behaviour changes behind one review. Engineering went first because it had
14
+ * the least to preserve and because its result shape was the model for
15
+ * `CommandExecutionResult`, so the adoption proved the port without bending the
16
+ * caller to fit.
17
+ *
18
+ * ## Why a port at all
19
+ *
20
+ * §5.3's target is to consume `xeno-use` sandboxes. `xeno-use` is AGPL-3.0 and
21
+ * this package is proprietary, so it is reached OUT OF PROCESS over `/v1/use/*`
22
+ * and never imported — the same boundary `RunObservationSource` holds one
23
+ * directory over. The port is what makes the local implementation and the
24
+ * sandbox implementation interchangeable at each call site.
25
+ *
26
+ * §5.3 also puts implementing containers, VMs and worktrees explicitly out of
27
+ * scope here. Nothing in this file starts anything; it describes a call.
28
+ */
29
+ /**
30
+ * 🔴 **argv is a LIST, never a shell line.** The decision, made once.
31
+ *
32
+ * `xeno-use`'s `sandboxExec` takes argv as a list and refuses a shell string,
33
+ * for the ordinary reason: a string has to be parsed by *something*, and which
34
+ * something is exactly the ambiguity a sandbox boundary cannot afford.
35
+ *
36
+ * The agent's terminal tool genuinely needs a shell — an agent writes
37
+ * `npm test && node x.js`, not an argv. That is not a conflict, because
38
+ * **running a shell IS expressible as argv**:
39
+ *
40
+ * ```ts
41
+ * argv: ['powershell.exe', '-NoLogo', '-NoProfile', '-NonInteractive',
42
+ * '-ExecutionPolicy', 'Bypass', '-Command', command]
43
+ * ```
44
+ *
45
+ * which is precisely what that tool already spawns today. So the rule costs
46
+ * nothing and buys the property that matters: **whether a shell is involved is
47
+ * visible at the call site**, in argv[0], rather than hidden behind a
48
+ * `shell: true` flag that a reader has to know the semantics of. A reviewer
49
+ * asking "does this run a shell?" reads one array.
50
+ *
51
+ * The rejected alternative was changing the agent tool to accept argv and
52
+ * dropping shell support. That would break what an agent actually writes, and
53
+ * §5.3 is about confining execution, not narrowing it.
54
+ */
55
+ export interface CommandExecutionRequest {
56
+ /**
57
+ * The program and its arguments. Non-empty by type: an execution with no
58
+ * program is not a request this port can carry, and making that
59
+ * unrepresentable is cheaper than validating it at three call sites.
60
+ */
61
+ argv: readonly [string, ...string[]];
62
+ cwd: string;
63
+ /**
64
+ * REQUIRED, and the caller must already have capped it.
65
+ *
66
+ * `sandboxExec` makes its timeout required and bounded because a command that
67
+ * cannot time out turns a wedged process inside the sandbox into a wedged
68
+ * caller outside it. Optional here would let a caller omit it and inherit
69
+ * some implementation's default — which is how one path ends up unbounded
70
+ * while the gate that checks the others stays green. All three sites already
71
+ * cap; `executionTimeouts.test.ts` pins that.
72
+ */
73
+ timeoutMs: number;
74
+ /** Output ceiling. Absent means the implementation's own bound applies. */
75
+ maxOutputBytes?: number;
76
+ }
77
+ /**
78
+ * What happened. Modelled on `EngineeringWorkbenchService`'s `ProcessResult`,
79
+ * which is the only one of the three that already carried every fact.
80
+ *
81
+ * 🔴 A timeout and a non-zero exit are both RESULTS, not errors. The command
82
+ * ran; it is the caller's business what that means. Throwing for either would
83
+ * make an ordinary failing test indistinguishable from the executor breaking.
84
+ */
85
+ export interface CommandExecutionResult {
86
+ stdout: string;
87
+ stderr: string;
88
+ /**
89
+ * 🔴 `null` when the process was KILLED BY A SIGNAL rather than exiting.
90
+ *
91
+ * Not a number with a sentinel. `ed6ed69` fixed exactly this: the agent's
92
+ * tool coerced `code ?? 1` and told the agent *"Command failed with exit code
93
+ * 1."* about a value the process never produced. Exit 1 means the program ran
94
+ * and failed; a signal means something else stopped it, and the command may
95
+ * be fine. `sandboxExec` returns an Option for the same reason, so a port
96
+ * that flattened it would discard the distinction at the boundary.
97
+ */
98
+ exitCode: number | null;
99
+ /** Distinct from a non-zero exit: the deadline fired and the child was killed. */
100
+ timedOut: boolean;
101
+ /** Output hit the ceiling. A short result and a truncated one are different. */
102
+ truncated: boolean;
103
+ /**
104
+ * The execution could not be attempted or completed — spawn failure, a
105
+ * refusal by the substrate. NOT set for a command that ran and failed.
106
+ */
107
+ error?: string;
108
+ }
109
+ /**
110
+ * Runs a command somewhere. Implemented locally today, by a sandbox later.
111
+ *
112
+ * Deliberately one method. A port is the exact set of calls a caller may make,
113
+ * and everything else about running a command — where it runs, what confines
114
+ * it, who approved it — belongs to whoever supplies the implementation.
115
+ */
116
+ export interface CommandExecutionPort {
117
+ execute(request: CommandExecutionRequest): Promise<CommandExecutionResult>;
118
+ }
119
+ /**
120
+ * Whether a result should read as success.
121
+ *
122
+ * Exported so the rule has ONE spelling. Today each site derives it slightly
123
+ * differently — `!timedOut && exitCode === 0` in one, `exitCode === 0` in
124
+ * another — and a difference in a success predicate is the kind of thing that
125
+ * survives a refactor because both spellings look obviously right.
126
+ *
127
+ * A signal-killed process is NOT a success even though it has no failing exit
128
+ * code, which is the case a naive `exitCode === 0` gets wrong by way of `null`
129
+ * comparing unequal to 0 only by accident of the operator used.
130
+ */
131
+ export declare function commandSucceeded(result: CommandExecutionResult): boolean;
132
+ //# sourceMappingURL=CommandExecution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandExecution.d.ts","sourceRoot":"","sources":["../../src/isolation/CommandExecution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAA;IACpC,GAAG,EAAE,MAAM,CAAA;IACX;;;;;;;;;OASG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB,2EAA2E;IAC3E,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd;;;;;;;;;OASG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,kFAAkF;IAClF,QAAQ,EAAE,OAAO,CAAA;IACjB,gFAAgF;IAChF,SAAS,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAA;CAC3E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAIxE"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * The one shape every agent-reachable command execution shares — ADE §5.3.
3
+ *
4
+ * ADOPTED at one of three sites. `EngineeringWorkbenchService.runProcess` runs
5
+ * through it via `LocalCommandExecutor`; `WorkspaceHostService.runCommand` and
6
+ * `executeWindowsPowerShellTool` in `packages/electron-host/src/sdkAgent.ts`
7
+ * still spawn directly.
8
+ *
9
+ * They move one at a time on purpose. Each carries its own access control that
10
+ * has to be reconciled rather than dropped — a string blocklist plus path
11
+ * authorization in one, consent plus a runtime policy engine plus a path
12
+ * allowlist in the other — and three in a single commit would be three
13
+ * behaviour changes behind one review. Engineering went first because it had
14
+ * the least to preserve and because its result shape was the model for
15
+ * `CommandExecutionResult`, so the adoption proved the port without bending the
16
+ * caller to fit.
17
+ *
18
+ * ## Why a port at all
19
+ *
20
+ * §5.3's target is to consume `xeno-use` sandboxes. `xeno-use` is AGPL-3.0 and
21
+ * this package is proprietary, so it is reached OUT OF PROCESS over `/v1/use/*`
22
+ * and never imported — the same boundary `RunObservationSource` holds one
23
+ * directory over. The port is what makes the local implementation and the
24
+ * sandbox implementation interchangeable at each call site.
25
+ *
26
+ * §5.3 also puts implementing containers, VMs and worktrees explicitly out of
27
+ * scope here. Nothing in this file starts anything; it describes a call.
28
+ */
29
+ /**
30
+ * Whether a result should read as success.
31
+ *
32
+ * Exported so the rule has ONE spelling. Today each site derives it slightly
33
+ * differently — `!timedOut && exitCode === 0` in one, `exitCode === 0` in
34
+ * another — and a difference in a success predicate is the kind of thing that
35
+ * survives a refactor because both spellings look obviously right.
36
+ *
37
+ * A signal-killed process is NOT a success even though it has no failing exit
38
+ * code, which is the case a naive `exitCode === 0` gets wrong by way of `null`
39
+ * comparing unequal to 0 only by accident of the operator used.
40
+ */
41
+ export function commandSucceeded(result) {
42
+ if (result.timedOut)
43
+ return false;
44
+ if (result.error !== undefined)
45
+ return false;
46
+ return result.exitCode === 0;
47
+ }
48
+ //# sourceMappingURL=CommandExecution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandExecution.js","sourceRoot":"","sources":["../../src/isolation/CommandExecution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AA+FH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAA8B;IAC7D,IAAI,MAAM,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAA;IACjC,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAA;IAC5C,OAAO,MAAM,CAAC,QAAQ,KAAK,CAAC,CAAA;AAC9B,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * `CommandExecutionPort` over `node:child_process` — the LOCAL implementation.
3
+ *
4
+ * 🔴 This confines nothing. It starts a real process on the user's machine, as
5
+ * the signed-in user, with `process.env`. It exists so the three agent-reachable
6
+ * call sites can express what they need through a port whose OTHER
7
+ * implementation will be a sandbox, and so that swapping them is a composition
8
+ * change rather than a rewrite at each site.
9
+ *
10
+ * Naming it `Local` rather than `Default` is deliberate: a reader choosing an
11
+ * implementation should see that this one is defined by WHERE it runs, and be
12
+ * prompted to ask whether that is what they want.
13
+ *
14
+ * ## Extracted, not rewritten
15
+ *
16
+ * The body is `EngineeringWorkbenchService`'s `runProcess` moved behind the
17
+ * port — same spawn options, same output-limit trimming, same settle-once
18
+ * guard. That site was chosen to go first precisely because its result shape
19
+ * was the model for `CommandExecutionResult`, so nothing about its behaviour
20
+ * had to change to fit. An adoption that has to bend the caller is evidence the
21
+ * port is wrong, not that the caller is.
22
+ */
23
+ import type { CommandExecutionPort, CommandExecutionRequest, CommandExecutionResult } from './CommandExecution.js';
24
+ export declare class LocalCommandExecutor implements CommandExecutionPort {
25
+ execute(request: CommandExecutionRequest): Promise<CommandExecutionResult>;
26
+ }
27
+ //# sourceMappingURL=LocalCommandExecutor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalCommandExecutor.d.ts","sourceRoot":"","sources":["../../src/isolation/LocalCommandExecutor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,KAAK,EACV,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,uBAAuB,CAAA;AAI9B,qBAAa,oBAAqB,YAAW,oBAAoB;IACzD,OAAO,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAyEjF"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * `CommandExecutionPort` over `node:child_process` — the LOCAL implementation.
3
+ *
4
+ * 🔴 This confines nothing. It starts a real process on the user's machine, as
5
+ * the signed-in user, with `process.env`. It exists so the three agent-reachable
6
+ * call sites can express what they need through a port whose OTHER
7
+ * implementation will be a sandbox, and so that swapping them is a composition
8
+ * change rather than a rewrite at each site.
9
+ *
10
+ * Naming it `Local` rather than `Default` is deliberate: a reader choosing an
11
+ * implementation should see that this one is defined by WHERE it runs, and be
12
+ * prompted to ask whether that is what they want.
13
+ *
14
+ * ## Extracted, not rewritten
15
+ *
16
+ * The body is `EngineeringWorkbenchService`'s `runProcess` moved behind the
17
+ * port — same spawn options, same output-limit trimming, same settle-once
18
+ * guard. That site was chosen to go first precisely because its result shape
19
+ * was the model for `CommandExecutionResult`, so nothing about its behaviour
20
+ * had to change to fit. An adoption that has to bend the caller is evidence the
21
+ * port is wrong, not that the caller is.
22
+ */
23
+ import { spawn } from 'node:child_process';
24
+ const DEFAULT_MAX_OUTPUT_BYTES = 200_000;
25
+ export class LocalCommandExecutor {
26
+ async execute(request) {
27
+ const [command, ...args] = request.argv;
28
+ const outputLimit = request.maxOutputBytes ?? DEFAULT_MAX_OUTPUT_BYTES;
29
+ return await new Promise((settle) => {
30
+ let stdout = '';
31
+ let stderr = '';
32
+ let settled = false;
33
+ let timedOut = false;
34
+ let truncated = false;
35
+ const child = spawn(command, args, {
36
+ cwd: request.cwd,
37
+ windowsHide: true,
38
+ // 🔴 Never `shell: true`. The port's rule is that argv is a list, and a
39
+ // shell — when one is wanted — is named in argv[0] by the caller. A
40
+ // `shell` flag here would reintroduce the ambiguity at the one place
41
+ // that must not have it: the boundary a sandbox implementation sits on.
42
+ shell: false,
43
+ env: process.env,
44
+ });
45
+ const timer = setTimeout(() => {
46
+ timedOut = true;
47
+ child.kill();
48
+ }, request.timeoutMs);
49
+ const append = (target, chunk) => {
50
+ const text = chunk.toString();
51
+ if (target === 'stdout')
52
+ stdout += text;
53
+ else
54
+ stderr += text;
55
+ if (stdout.length + stderr.length > outputLimit) {
56
+ truncated = true;
57
+ const keep = Math.max(4_000, Math.floor(outputLimit / 2));
58
+ stdout = stdout.slice(-keep);
59
+ stderr = stderr.slice(-keep);
60
+ }
61
+ };
62
+ child.stdout.on('data', (chunk) => append('stdout', chunk));
63
+ child.stderr.on('data', (chunk) => append('stderr', chunk));
64
+ child.on('error', (err) => {
65
+ if (settled)
66
+ return;
67
+ settled = true;
68
+ clearTimeout(timer);
69
+ // The execution could not be ATTEMPTED. `exitCode: null` here means the
70
+ // same thing it means everywhere on this type — there is no exit code —
71
+ // and `error` is what distinguishes "never started" from "killed".
72
+ settle({ stdout, stderr, exitCode: null, timedOut, truncated, error: err.message });
73
+ });
74
+ child.on('close', (code) => {
75
+ if (settled)
76
+ return;
77
+ settled = true;
78
+ clearTimeout(timer);
79
+ settle({
80
+ stdout,
81
+ stderr,
82
+ // 🔴 Passed through, INCLUDING null. Node gives null when the child
83
+ // was killed by a signal, and the port keeps that distinction rather
84
+ // than coercing — the defect `ed6ed69` removed from the agent's tool.
85
+ exitCode: code,
86
+ timedOut,
87
+ truncated,
88
+ // Spread-omitted rather than set to undefined: `error` is optional
89
+ // under `exactOptionalPropertyTypes`, and an explicit undefined is a
90
+ // different type from an absent key.
91
+ ...(timedOut ? { error: `Command timed out after ${request.timeoutMs}ms.` } : {}),
92
+ });
93
+ });
94
+ });
95
+ }
96
+ }
97
+ //# sourceMappingURL=LocalCommandExecutor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalCommandExecutor.js","sourceRoot":"","sources":["../../src/isolation/LocalCommandExecutor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAQ1C,MAAM,wBAAwB,GAAG,OAAO,CAAA;AAExC,MAAM,OAAO,oBAAoB;IAC/B,KAAK,CAAC,OAAO,CAAC,OAAgC;QAC5C,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAA;QACvC,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,IAAI,wB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