@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,754 @@
1
+ import { execFileSync, spawnSync } from 'child_process';
2
+ import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from 'fs';
3
+ import { homedir } from 'os';
4
+ import { basename, dirname, isAbsolute, join, resolve } from 'path';
5
+ import { ACP_ENDPOINT_CERTIFICATION_PROMPT, resolveCommand } from '@xenosystem/acp-core';
6
+ import { selectProviderExecutableCandidate } from '@xenosystem/acp-provider-manager';
7
+ import { AcpProcessSupervisor } from './AcpProcessSupervisor.js';
8
+ // Command-safety rules live in ./acpCommandSafety so admission and launch
9
+ // cannot drift apart. See that module for the Linux blind spot they close.
10
+ import { isAcpShellCommandLine, isAcpShellExecutable } from './acpCommandSafety.js';
11
+ import { runAcpProviderModels } from './AcpProviderModelService.js';
12
+ import { getAcpProviderVersionReadiness } from './AcpProviderVersionReadiness.js';
13
+ import { acpSafeErrorMessage } from './acpErrors.js';
14
+ import { redactAcpAgentConfig, redactAcpPath, redactAcpText } from './acpRedaction.js';
15
+ const REGISTRY_VERSION = 1;
16
+ const DEFAULT_TEST_TIMEOUT_MS = 5_000;
17
+ export const ACP_REGISTRY_CERTIFICATION_PROMPT = ACP_ENDPOINT_CERTIFICATION_PROMPT;
18
+ const TRUST_LEVELS = new Set(['restricted', 'workspace']);
19
+ const CERTIFICATION_STATUSES = new Set(['not_certified', 'fixture_only', 'certified', 'authentication_required', 'blocked_by_environment', 'failed']);
20
+ const LOCAL_PROVIDER_PRESETS = {
21
+ 'codex-local': {
22
+ name: 'Codex CLI',
23
+ policyExample: 'codex-local.provider-policy.example.jsonc',
24
+ },
25
+ 'claude-local': {
26
+ name: 'Claude CLI',
27
+ policyExample: 'claude-local.provider-policy.example.jsonc',
28
+ },
29
+ kimi: {
30
+ name: 'Kimi Code CLI',
31
+ },
32
+ };
33
+ export function defaultAcpRegistryRoot() {
34
+ return process.env.XENO_ACP_REGISTRY_ROOT || join(homedir(), '.xeno');
35
+ }
36
+ export function createFixtureAcpAgentConfig(rootDir, mode = 'normal', id = `fixture-${mode}`) {
37
+ const fixturePath = join(process.cwd(), 'tests', 'fixtures', 'acp', 'fixture-acp-agent.mjs');
38
+ const now = new Date().toISOString();
39
+ return {
40
+ id,
41
+ name: `Fixture ACP ${mode}`,
42
+ command: process.execPath,
43
+ args: [fixturePath, `--mode=${mode}`],
44
+ cwd: rootDir,
45
+ // Local fixture-only env values are supported; provider credentials stay in provider-owned auth.
46
+ env: { XENO_ACP_FIXTURE_MODE: mode },
47
+ enabled: true,
48
+ trustLevel: 'restricted',
49
+ createdAt: now,
50
+ updatedAt: now,
51
+ };
52
+ }
53
+ export function isAcpLocalProviderPresetId(value) {
54
+ return value === 'codex-local' || value === 'claude-local' || value === 'kimi';
55
+ }
56
+ export function normalizeAcpAgentConfig(input, now = new Date().toISOString()) {
57
+ if (!isRecord(input))
58
+ return null;
59
+ const id = cleanString(input.id);
60
+ const name = cleanString(input.name);
61
+ const command = cleanString(input.command);
62
+ if (!id || !name || !command)
63
+ return null;
64
+ const args = Array.isArray(input.args)
65
+ ? input.args.filter((arg) => typeof arg === 'string')
66
+ : [];
67
+ const cwd = typeof input.cwd === 'string' && input.cwd.trim() ? input.cwd.trim() : undefined;
68
+ const env = normalizeEnv(input.env);
69
+ const trustLevel = input.trustLevel === 'workspace' ? 'workspace' : 'restricted';
70
+ const certification = normalizeAcpAgentCertification(input.certification);
71
+ const createdAt = cleanString(input.createdAt) || now;
72
+ const updatedAt = cleanString(input.updatedAt) || now;
73
+ return {
74
+ id,
75
+ name,
76
+ command,
77
+ args,
78
+ cwd,
79
+ env,
80
+ enabled: typeof input.enabled === 'boolean' ? input.enabled : false,
81
+ trustLevel,
82
+ certification,
83
+ createdAt,
84
+ updatedAt,
85
+ };
86
+ }
87
+ export function normalizeAcpAgentCertification(input) {
88
+ if (!isRecord(input))
89
+ return undefined;
90
+ const status = typeof input.status === 'string' && CERTIFICATION_STATUSES.has(input.status)
91
+ ? input.status
92
+ : undefined;
93
+ if (!status)
94
+ return undefined;
95
+ return {
96
+ status,
97
+ certifiedAt: cleanString(input.certifiedAt),
98
+ certifiedBy: input.certifiedBy === 'harness' ? 'harness' : undefined,
99
+ protocolVersion: typeof input.protocolVersion === 'number' && Number.isFinite(input.protocolVersion) ? input.protocolVersion : undefined,
100
+ agentName: cleanString(input.agentName),
101
+ agentVersion: cleanString(input.agentVersion),
102
+ notes: cleanString(input.notes),
103
+ };
104
+ }
105
+ export function validateAcpAgentConfig(input, options = {}) {
106
+ const errors = [];
107
+ const config = normalizeAcpAgentConfig(input);
108
+ const raw = isRecord(input) ? input : {};
109
+ if (!config) {
110
+ errors.push('ACP agent id, name, and command are required.');
111
+ return { valid: false, errors };
112
+ }
113
+ if (!config.id)
114
+ errors.push('ACP agent id is required.');
115
+ if (!config.name)
116
+ errors.push('ACP agent name is required.');
117
+ validateCommand(config.command, errors);
118
+ if (!Array.isArray(raw.args) && raw.args !== undefined) {
119
+ errors.push('ACP agent args must be an array of strings.');
120
+ }
121
+ if (Array.isArray(raw.args) && raw.args.some((arg) => typeof arg !== 'string')) {
122
+ errors.push('ACP agent args must be an array of strings.');
123
+ }
124
+ if (config.cwd !== undefined && !isAbsolute(config.cwd)) {
125
+ errors.push('ACP agent cwd must be an absolute path.');
126
+ }
127
+ if (raw.env !== undefined) {
128
+ if (!isRecord(raw.env)) {
129
+ errors.push('ACP agent env must be an object of string values.');
130
+ }
131
+ else {
132
+ for (const [key, value] of Object.entries(raw.env)) {
133
+ if (typeof value !== 'string')
134
+ errors.push(`ACP agent env value must be a string: ${key}`);
135
+ else if (isSecretEnvEntry(key, value))
136
+ errors.push(`ACP agent env cannot store raw secret values: ${key}`);
137
+ }
138
+ }
139
+ }
140
+ if (raw.trustLevel !== undefined && !TRUST_LEVELS.has(String(raw.trustLevel))) {
141
+ errors.push('ACP agent trustLevel must be restricted or workspace.');
142
+ }
143
+ if (raw.shell === true)
144
+ errors.push('ACP agent shell launch is not supported.');
145
+ if (typeof raw.commandLine === 'string')
146
+ errors.push('ACP agent raw commandLine is not supported.');
147
+ const existing = new Set(options.existingIds || []);
148
+ if (!options.allowExistingId && existing.has(config.id)) {
149
+ errors.push(`ACP agent id already exists: ${config.id}`);
150
+ }
151
+ return { valid: errors.length === 0, errors };
152
+ }
153
+ export function isFixtureAcpAgentConfig(config) {
154
+ return config.command === process.execPath
155
+ && config.args.some((arg) => basename(arg) === 'fixture-acp-agent.mjs');
156
+ }
157
+ export class AcpAgentRegistryService {
158
+ rootDir;
159
+ registryPath;
160
+ requestTimeoutMs;
161
+ constructor(options = {}) {
162
+ this.rootDir = options.rootDir || defaultAcpRegistryRoot();
163
+ this.registryPath = options.registryPath || join(this.rootDir, 'acp-agents.json');
164
+ this.requestTimeoutMs = options.requestTimeoutMs || DEFAULT_TEST_TIMEOUT_MS;
165
+ }
166
+ listAgents(options = {}) {
167
+ const loaded = this.loadRegistry();
168
+ return {
169
+ success: true,
170
+ repaired: loaded.repaired,
171
+ result: loaded.registry.agents.map((agent) => this.toAgentView(agent, options.includeRuntimeStatus !== false)),
172
+ };
173
+ }
174
+ getAgent(id, options = {}) {
175
+ const agent = this.getAgentInternal(id);
176
+ if (!agent)
177
+ return { success: false, error: 'ACP agent not found.' };
178
+ return { success: true, result: this.toAgentView(agent, options.includeRuntimeStatus !== false) };
179
+ }
180
+ saveAgent(input, options = {}) {
181
+ const loaded = this.loadRegistry();
182
+ const existingIndex = loaded.registry.agents.findIndex((agent) => agent.id === input.id);
183
+ const now = new Date().toISOString();
184
+ const existing = existingIndex >= 0 ? loaded.registry.agents[existingIndex] : undefined;
185
+ const launchIdentityChanged = !!existing && ((input.command !== undefined && input.command !== existing.command)
186
+ || (input.args !== undefined && JSON.stringify(input.args) !== JSON.stringify(existing.args))
187
+ || (input.cwd !== undefined && input.cwd !== existing.cwd)
188
+ || (input.env !== undefined && JSON.stringify(input.env) !== JSON.stringify(existing.env)));
189
+ const candidate = normalizeAcpAgentConfig({
190
+ ...existing,
191
+ ...input,
192
+ command: input.command ?? existing?.command,
193
+ args: input.args ?? existing?.args ?? [],
194
+ cwd: input.cwd ?? existing?.cwd,
195
+ env: input.env ?? existing?.env,
196
+ enabled: input.enabled ?? existing?.enabled ?? false,
197
+ trustLevel: input.trustLevel ?? existing?.trustLevel ?? 'restricted',
198
+ certification: launchIdentityChanged ? undefined : existing?.certification,
199
+ createdAt: existing?.createdAt || input.createdAt || now,
200
+ updatedAt: now,
201
+ }, now);
202
+ const validation = validateAcpAgentConfig(candidate, {
203
+ existingIds: loaded.registry.agents.map((agent) => agent.id),
204
+ allowExistingId: existingIndex >= 0,
205
+ });
206
+ if (!candidate || !validation.valid) {
207
+ return { success: false, error: validation.errors.join(' ') || 'Invalid ACP agent config.' };
208
+ }
209
+ const nextAgents = [...loaded.registry.agents];
210
+ if (existingIndex >= 0)
211
+ nextAgents[existingIndex] = candidate;
212
+ else
213
+ nextAgents.push(candidate);
214
+ this.writeRegistry({ version: REGISTRY_VERSION, agents: nextAgents });
215
+ return {
216
+ success: true,
217
+ repaired: loaded.repaired,
218
+ result: this.toAgentView(candidate, options.includeRuntimeStatus !== false),
219
+ };
220
+ }
221
+ removeAgent(id) {
222
+ const loaded = this.loadRegistry();
223
+ const nextAgents = loaded.registry.agents.filter((agent) => agent.id !== id);
224
+ if (nextAgents.length === loaded.registry.agents.length) {
225
+ return { success: false, error: 'ACP agent not found.' };
226
+ }
227
+ this.writeRegistry({ version: REGISTRY_VERSION, agents: nextAgents });
228
+ return { success: true, result: { removed: true } };
229
+ }
230
+ setAgentEnabled(id, enabled) {
231
+ const loaded = this.loadRegistry();
232
+ const index = loaded.registry.agents.findIndex((agent) => agent.id === id);
233
+ if (index < 0)
234
+ return { success: false, error: 'ACP agent not found.' };
235
+ const agent = {
236
+ ...loaded.registry.agents[index],
237
+ enabled,
238
+ updatedAt: new Date().toISOString(),
239
+ };
240
+ const nextAgents = [...loaded.registry.agents];
241
+ nextAgents[index] = agent;
242
+ this.writeRegistry({ version: REGISTRY_VERSION, agents: nextAgents });
243
+ return { success: true, result: this.toAgentView(agent) };
244
+ }
245
+ setAgentsEnabled(updates) {
246
+ const loaded = this.loadRegistry();
247
+ const updateEntries = Object.entries(updates);
248
+ if (!updateEntries.length)
249
+ return { success: true, result: { updatedIds: [] } };
250
+ const knownIds = new Set(loaded.registry.agents.map((agent) => agent.id));
251
+ const unknownId = updateEntries.find(([id]) => !knownIds.has(id))?.[0];
252
+ if (unknownId)
253
+ return { success: false, error: `ACP agent not found: ${unknownId}` };
254
+ const now = new Date().toISOString();
255
+ const updatedIds = [];
256
+ const agents = loaded.registry.agents.map((agent) => {
257
+ const enabled = updates[agent.id];
258
+ if (typeof enabled !== 'boolean' || enabled === agent.enabled)
259
+ return agent;
260
+ updatedIds.push(agent.id);
261
+ return { ...agent, enabled, updatedAt: now };
262
+ });
263
+ if (updatedIds.length)
264
+ this.writeRegistry({ version: REGISTRY_VERSION, agents });
265
+ return { success: true, repaired: loaded.repaired, result: { updatedIds } };
266
+ }
267
+ setAgentCertification(id, certification, options = {}) {
268
+ const loaded = this.loadRegistry();
269
+ const index = loaded.registry.agents.findIndex((agent) => agent.id === id);
270
+ if (index < 0)
271
+ return { success: false, error: 'ACP agent not found.' };
272
+ const normalized = normalizeAcpAgentCertification(certification);
273
+ if (!normalized)
274
+ return { success: false, error: 'Invalid ACP certification metadata.' };
275
+ const agent = {
276
+ ...loaded.registry.agents[index],
277
+ certification: normalized,
278
+ updatedAt: new Date().toISOString(),
279
+ };
280
+ const nextAgents = [...loaded.registry.agents];
281
+ nextAgents[index] = agent;
282
+ this.writeRegistry({ version: REGISTRY_VERSION, agents: nextAgents });
283
+ return { success: true, result: this.toAgentView(agent, options.includeRuntimeStatus !== false) };
284
+ }
285
+ clearAgentCertification(id, options = {}) {
286
+ const loaded = this.loadRegistry();
287
+ const index = loaded.registry.agents.findIndex((agent) => agent.id === id);
288
+ if (index < 0)
289
+ return { success: false, error: 'ACP agent not found.' };
290
+ const agent = {
291
+ ...loaded.registry.agents[index],
292
+ certification: undefined,
293
+ updatedAt: new Date().toISOString(),
294
+ };
295
+ const nextAgents = [...loaded.registry.agents];
296
+ nextAgents[index] = agent;
297
+ this.writeRegistry({ version: REGISTRY_VERSION, agents: nextAgents });
298
+ return { success: true, result: this.toAgentView(agent, options.includeRuntimeStatus !== false) };
299
+ }
300
+ diagnostics(options = {}) {
301
+ const loaded = this.loadRegistry();
302
+ const includeRuntimeStatus = options.includeRuntimeStatus !== false;
303
+ return {
304
+ path: redactAcpPath(this.registryPath) || 'acp-agents.json',
305
+ exists: existsSync(this.registryPath),
306
+ version: loaded.registry.version,
307
+ agentCount: loaded.registry.agents.length,
308
+ enabledCount: loaded.registry.agents.filter((agent) => agent.enabled).length,
309
+ repaired: loaded.repaired,
310
+ backupPath: redactAcpPath(loaded.backupPath),
311
+ agents: loaded.registry.agents.map((agent) => ({
312
+ ...this.toAgentView(agent, includeRuntimeStatus),
313
+ providerVersionReadiness: includeRuntimeStatus ? getAcpProviderVersionReadiness(agent) : undefined,
314
+ })),
315
+ };
316
+ }
317
+ async testAgent(id, options = {}) {
318
+ const agent = this.getAgentInternal(id);
319
+ if (!agent) {
320
+ return { success: false, updateCount: 0, diagnostics: {}, error: 'ACP agent not found.' };
321
+ }
322
+ if (!agent.enabled && !options.allowDisabled) {
323
+ return {
324
+ success: false,
325
+ updateCount: 0,
326
+ diagnostics: { agentConfigId: agent.id },
327
+ error: 'ACP agent is disabled and cannot be tested.',
328
+ };
329
+ }
330
+ const canRunExternal = options.allowExternal || agent.certification?.status === 'certified';
331
+ if (!isFixtureAcpAgentConfig(agent) && !canRunExternal) {
332
+ return {
333
+ success: false,
334
+ updateCount: 0,
335
+ diagnostics: { agentConfigId: agent.id },
336
+ error: 'External ACP agent is not certified. Run AGENT-009E certification before testing this config.',
337
+ };
338
+ }
339
+ const supervisor = new AcpProcessSupervisor(agent, { requestTimeoutMs: this.requestTimeoutMs });
340
+ try {
341
+ const initialized = await supervisor.initialize();
342
+ const session = await supervisor.createSession({
343
+ cwd: agent.cwd || this.rootDir,
344
+ mcpServers: [],
345
+ });
346
+ const prompt = await supervisor.prompt(session.sessionId, ACP_REGISTRY_CERTIFICATION_PROMPT, { timeoutMs: this.requestTimeoutMs });
347
+ const diagnostics = supervisor.diagnostics();
348
+ diagnostics.lastStopReason = prompt.result.stopReason;
349
+ return {
350
+ success: prompt.result.stopReason === 'end_turn',
351
+ protocolVersion: initialized.protocolVersion,
352
+ agentInfo: initialized.agentInfo,
353
+ updateCount: prompt.updates.length,
354
+ stopReason: prompt.result.stopReason,
355
+ diagnostics,
356
+ };
357
+ }
358
+ catch (error) {
359
+ return {
360
+ success: false,
361
+ updateCount: 0,
362
+ diagnostics: supervisor.diagnostics(),
363
+ error: redactAcpText(acpSafeErrorMessage(error), 1000),
364
+ };
365
+ }
366
+ finally {
367
+ await supervisor.stop().catch(() => undefined);
368
+ }
369
+ }
370
+ async getProviderModels(id, providerId) {
371
+ const agent = this.getAgentInternal(id);
372
+ if (!agent) {
373
+ return {
374
+ success: false,
375
+ providerId: providerId || id,
376
+ commandBasename: '[redacted-command]',
377
+ argsCount: 0,
378
+ stdoutTail: [],
379
+ stderrTail: [],
380
+ error: 'ACP agent not found.',
381
+ };
382
+ }
383
+ return runAcpProviderModels(agent, { providerId });
384
+ }
385
+ createFixtureAgentConfig(rootDir, mode = 'normal', id) {
386
+ return createFixtureAcpAgentConfig(rootDir, mode, id);
387
+ }
388
+ createLocalProviderAgentConfig(providerId) {
389
+ const preset = LOCAL_PROVIDER_PRESETS[providerId];
390
+ if (providerId === 'kimi') {
391
+ const kimiPath = findExecutable('kimi');
392
+ if (!kimiPath) {
393
+ return {
394
+ success: false,
395
+ error: 'Kimi Code CLI executable not found on PATH. Install Kimi Code CLI, then run kimi login before adding it to Hub.',
396
+ };
397
+ }
398
+ return this.saveAgent({
399
+ id: providerId,
400
+ name: preset.name,
401
+ command: kimiPath,
402
+ args: ['acp'],
403
+ cwd: this.rootDir,
404
+ enabled: true,
405
+ trustLevel: 'restricted',
406
+ });
407
+ }
408
+ const xenoAcpRoot = findXenoAcpRoot();
409
+ if (!xenoAcpRoot) {
410
+ return {
411
+ success: false,
412
+ error: 'xeno-acp checkout not found. Set XENO_ACP_ROOT to the xeno-acp repository path and build xeno-acp first.',
413
+ };
414
+ }
415
+ const nodePath = findNodeExecutable();
416
+ if (!nodePath) {
417
+ return { success: false, error: 'Node.js executable not found on PATH. Install Node.js or add node to PATH before adding a local ACP provider.' };
418
+ }
419
+ const cliPath = xenoAcpAgentCliPath(xenoAcpRoot);
420
+ const policyPath = join(xenoAcpRoot, 'docs', 'examples', preset.policyExample);
421
+ if (!existsSync(cliPath)) {
422
+ return { success: false, error: `xeno-acp agent endpoint is not built: ${redactAcpPath(cliPath) || 'packages/agent/dist/cli.js'}.` };
423
+ }
424
+ if (!existsSync(policyPath)) {
425
+ return { success: false, error: `xeno-acp provider policy example is missing: ${redactAcpPath(policyPath) || preset.policyExample}.` };
426
+ }
427
+ return this.saveAgent({
428
+ id: providerId,
429
+ name: preset.name,
430
+ command: nodePath,
431
+ args: [
432
+ cliPath,
433
+ 'agent',
434
+ '--provider',
435
+ providerId,
436
+ '--provider-policy',
437
+ policyPath,
438
+ '--provider-approvals',
439
+ join(this.rootDir, 'provider-approvals.json'),
440
+ ],
441
+ cwd: xenoAcpRoot,
442
+ enabled: true,
443
+ trustLevel: 'restricted',
444
+ });
445
+ }
446
+ getAgentInternal(id) {
447
+ return this.loadRegistry().registry.agents.find((agent) => agent.id === id);
448
+ }
449
+ loadRegistry() {
450
+ mkdirSync(dirname(this.registryPath), { recursive: true });
451
+ if (!existsSync(this.registryPath)) {
452
+ const registry = { version: REGISTRY_VERSION, agents: [] };
453
+ this.writeRegistry(registry);
454
+ return { registry, repaired: false };
455
+ }
456
+ let parsed;
457
+ try {
458
+ parsed = JSON.parse(readFileSync(this.registryPath, 'utf-8'));
459
+ }
460
+ catch {
461
+ const backupPath = this.backupRegistry();
462
+ const registry = { version: REGISTRY_VERSION, agents: [] };
463
+ this.writeRegistry(registry);
464
+ return { registry, repaired: true, backupPath };
465
+ }
466
+ const repair = this.repairRegistry(parsed);
467
+ if (repair.repaired) {
468
+ const backupPath = this.backupRegistry();
469
+ this.writeRegistry(repair.registry);
470
+ return { ...repair, backupPath };
471
+ }
472
+ return repair;
473
+ }
474
+ repairRegistry(value) {
475
+ const now = new Date().toISOString();
476
+ let repaired = false;
477
+ const rawAgents = isRecord(value) && Array.isArray(value.agents) ? value.agents : [];
478
+ if (!isRecord(value) || value.version !== REGISTRY_VERSION || !Array.isArray(value.agents))
479
+ repaired = true;
480
+ const ids = new Set();
481
+ const agents = [];
482
+ for (const rawAgent of rawAgents) {
483
+ const agent = normalizeAcpAgentConfig(rawAgent, now);
484
+ if (!agent) {
485
+ repaired = true;
486
+ continue;
487
+ }
488
+ const validation = validateAcpAgentConfig(agent, { existingIds: ids });
489
+ if (!validation.valid) {
490
+ repaired = true;
491
+ continue;
492
+ }
493
+ ids.add(agent.id);
494
+ agents.push(agent);
495
+ if (JSON.stringify(rawAgent) !== JSON.stringify(agent))
496
+ repaired = true;
497
+ }
498
+ return { registry: { version: REGISTRY_VERSION, agents }, repaired };
499
+ }
500
+ writeRegistry(registry) {
501
+ mkdirSync(dirname(this.registryPath), { recursive: true });
502
+ const tempPath = `${this.registryPath}.tmp-${process.pid}-${Date.now()}`;
503
+ writeFileSync(tempPath, `${JSON.stringify(registry, null, 2)}\n`, 'utf-8');
504
+ try {
505
+ renameSync(tempPath, this.registryPath);
506
+ }
507
+ catch (error) {
508
+ try {
509
+ unlinkSync(tempPath);
510
+ }
511
+ catch {
512
+ // Ignore temp cleanup failure; original write error is the important signal.
513
+ }
514
+ throw error;
515
+ }
516
+ }
517
+ backupRegistry() {
518
+ if (!existsSync(this.registryPath))
519
+ return undefined;
520
+ const backupPath = `${this.registryPath}.bak-${Date.now()}`;
521
+ copyFileSync(this.registryPath, backupPath);
522
+ return backupPath;
523
+ }
524
+ toAgentView(agent, includeRuntimeStatus = true) {
525
+ const providerCommand = buildAcpProviderReviewCommand(agent);
526
+ const providerReview = includeRuntimeStatus ? getAcpProviderReview(agent) : undefined;
527
+ return {
528
+ ...redactAcpAgentConfig(agent),
529
+ endpointKind: isNativeAcpAgentConfig(agent)
530
+ ? 'native-acp'
531
+ : providerCommand
532
+ ? 'xeno-acp-provider'
533
+ : 'custom-acp',
534
+ providerReview,
535
+ providerVersionReadiness: includeRuntimeStatus ? getAcpProviderVersionReadiness(agent) : undefined,
536
+ };
537
+ }
538
+ }
539
+ let sharedAcpAgentRegistryService;
540
+ export function getAcpAgentRegistryService() {
541
+ if (!sharedAcpAgentRegistryService)
542
+ sharedAcpAgentRegistryService = new AcpAgentRegistryService();
543
+ return sharedAcpAgentRegistryService;
544
+ }
545
+ function cleanString(value) {
546
+ return typeof value === 'string' && value.trim() ? value.trim() : undefined;
547
+ }
548
+ function normalizeEnv(value) {
549
+ if (!isRecord(value))
550
+ return undefined;
551
+ const env = {};
552
+ for (const [key, item] of Object.entries(value)) {
553
+ if (typeof item === 'string')
554
+ env[key] = item;
555
+ }
556
+ return Object.keys(env).length ? env : undefined;
557
+ }
558
+ function isSecretEnvEntry(key, value) {
559
+ return /(^|_)(TOKEN|SECRET|PASSWORD|COOKIE|AUTHORIZATION|API_?KEY|CREDENTIAL|BEARER)(_|$)/i.test(key)
560
+ || redactAcpText(value) !== value;
561
+ }
562
+ function validateCommand(command, errors) {
563
+ const trimmed = command.trim();
564
+ if (!trimmed) {
565
+ errors.push('ACP command must be a non-empty string.');
566
+ return;
567
+ }
568
+ if (!isAbsolute(trimmed)) {
569
+ errors.push('ACP command must be an absolute executable path.');
570
+ }
571
+ if (isAcpShellCommandLine(trimmed)) {
572
+ errors.push('ACP command must be an executable path, not a shell command line.');
573
+ }
574
+ if (isAcpShellExecutable(trimmed)) {
575
+ errors.push('ACP command cannot be a shell executable.');
576
+ }
577
+ if (resolve(trimmed) !== trimmed && trimmed !== process.execPath) {
578
+ // Keep the executable field boring and literal; args carry all dynamic behavior.
579
+ errors.push('ACP command path must be normalized before launch.');
580
+ }
581
+ }
582
+ function isRecord(value) {
583
+ return !!value && typeof value === 'object' && !Array.isArray(value);
584
+ }
585
+ function findNodeExecutable() {
586
+ const found = findExecutable('node');
587
+ if (found)
588
+ return found;
589
+ const current = basename(process.execPath).toLowerCase();
590
+ return current === 'node' || current === 'node.exe' ? process.execPath : null;
591
+ }
592
+ function findExecutable(name) {
593
+ const lookup = process.platform === 'win32' ? 'where.exe' : 'which';
594
+ try {
595
+ const output = execFileSync(lookup, [name], {
596
+ encoding: 'utf-8',
597
+ timeout: 3_000,
598
+ windowsHide: true,
599
+ stdio: ['ignore', 'pipe', 'ignore'],
600
+ });
601
+ const found = selectProviderExecutableCandidate(output.split(/\r?\n/), process.platform);
602
+ if (found)
603
+ return resolve(found);
604
+ }
605
+ catch {
606
+ // PATH lookup is best effort; the caller returns a safe setup error.
607
+ }
608
+ return null;
609
+ }
610
+ function findXenoAcpRoot() {
611
+ const executableDir = dirname(process.execPath);
612
+ const rawCandidates = [
613
+ process.env.XENO_ACP_ROOT,
614
+ resolve(process.cwd(), '..', 'xeno-acp'),
615
+ resolve(process.cwd(), 'xeno-acp'),
616
+ resolve(process.cwd(), '..', '..', 'xeno-acp'),
617
+ resolve(process.cwd(), '..', '..', '..', 'xeno-acp'),
618
+ resolve(executableDir, '..', '..', '..', 'xeno-acp'),
619
+ ];
620
+ const seen = new Set();
621
+ for (const candidate of rawCandidates) {
622
+ if (!candidate)
623
+ continue;
624
+ const resolved = resolve(candidate);
625
+ if (seen.has(resolved))
626
+ continue;
627
+ seen.add(resolved);
628
+ if (existsSync(xenoAcpAgentCliPath(resolved)))
629
+ return resolved;
630
+ }
631
+ return null;
632
+ }
633
+ function xenoAcpAgentCliPath(rootDir) {
634
+ return join(rootDir, 'packages', 'agent', 'dist', 'cli.js');
635
+ }
636
+ function isNativeAcpAgentConfig(config) {
637
+ const commandName = basename(config.command).toLowerCase().replace(/\.(exe|cmd|bat)$/i, '');
638
+ if (config.id.startsWith('registry-'))
639
+ return true;
640
+ if (config.id === 'kimi') {
641
+ return commandName === 'kimi'
642
+ && config.args.length === 1
643
+ && config.args[0].toLowerCase() === 'acp';
644
+ }
645
+ if (config.id === 'gemini')
646
+ return commandName === 'gemini' && config.args.some((arg) => arg.toLowerCase() === '--acp');
647
+ if (config.id === 'opencode')
648
+ return commandName === 'opencode' && config.args.some((arg) => arg.toLowerCase() === 'acp');
649
+ return false;
650
+ }
651
+ function getAcpProviderReview(config) {
652
+ const command = buildAcpProviderReviewCommand(config);
653
+ if (!command)
654
+ return undefined;
655
+ const resolved = resolveCommand(command.command, command.args);
656
+ const result = spawnSync(resolved.file, resolved.args, {
657
+ cwd: config.cwd,
658
+ env: {},
659
+ encoding: 'utf-8',
660
+ timeout: 5_000,
661
+ windowsHide: true,
662
+ stdio: ['ignore', 'pipe', 'pipe'],
663
+ });
664
+ if (!result.stdout)
665
+ return undefined;
666
+ return normalizeProviderReview(result.stdout);
667
+ }
668
+ function buildAcpProviderReviewCommand(config) {
669
+ const agentIndex = config.args.findIndex((arg) => arg === 'agent');
670
+ if (agentIndex < 0)
671
+ return undefined;
672
+ const providerId = readFlag(config.args, '--provider');
673
+ const policyPath = readFlag(config.args, '--provider-policy');
674
+ const approvalsPath = readFlag(config.args, '--provider-approvals');
675
+ if (!providerId || !policyPath || !approvalsPath)
676
+ return undefined;
677
+ return {
678
+ command: config.command,
679
+ args: [
680
+ ...config.args.slice(0, agentIndex),
681
+ 'providers',
682
+ 'review',
683
+ '--provider',
684
+ providerId,
685
+ '--config',
686
+ policyPath,
687
+ '--store',
688
+ approvalsPath,
689
+ ],
690
+ };
691
+ }
692
+ function normalizeProviderReview(stdout) {
693
+ let parsed;
694
+ try {
695
+ parsed = JSON.parse(stdout);
696
+ }
697
+ catch {
698
+ return undefined;
699
+ }
700
+ const record = isRecord(parsed) ? parsed : {};
701
+ const providerId = cleanString(record.providerId);
702
+ if (!providerId)
703
+ return undefined;
704
+ const auth = isRecord(record.auth) ? record.auth : {};
705
+ const refs = Array.isArray(auth.secretRefs) ? auth.secretRefs.filter(isRecord) : [];
706
+ return {
707
+ providerId: redactAcpText(providerId, 120),
708
+ displayName: cleanString(record.displayName) ? redactAcpText(cleanString(record.displayName), 160) : undefined,
709
+ trustClass: cleanString(record.trustClass),
710
+ runnable: record.runnable === true,
711
+ approvalState: providerApprovalState(record),
712
+ runtimeEnvKeys: runtimeEnvKeys(record),
713
+ requiredAuthRefs: refs.filter((ref) => ref.required === true).map((ref) => redactAcpText(String(ref.id || ''), 120)).filter(Boolean),
714
+ optionalAuthRefs: refs.filter((ref) => ref.required !== true).map((ref) => redactAcpText(String(ref.id || ''), 120)).filter(Boolean),
715
+ enforcementClassification: {
716
+ network: 'network: not_enforced',
717
+ filesystem: 'filesystem: not_enforced_against_hostile_process',
718
+ },
719
+ };
720
+ }
721
+ function providerApprovalState(record) {
722
+ const status = cleanString(record.status);
723
+ const approval = isRecord(record.approval) ? record.approval : undefined;
724
+ if (approval?.current === true)
725
+ return 'approved';
726
+ if (approval && approval.current === false)
727
+ return 'stale';
728
+ if (status === 'requires_approval')
729
+ return 'missing';
730
+ if (status === 'stale_approval')
731
+ return 'stale';
732
+ if (status && status.startsWith('blocked'))
733
+ return 'blocked';
734
+ if (record.runnable === true)
735
+ return 'not_required';
736
+ return 'blocked';
737
+ }
738
+ function runtimeEnvKeys(record) {
739
+ const runtimeEnv = isRecord(record.runtimeEnv) ? record.runtimeEnv : {};
740
+ return Array.isArray(runtimeEnv.forwardedKeys)
741
+ ? runtimeEnv.forwardedKeys.map((key) => typeof key === 'string' ? redactAcpText(key, 120) : '').filter(Boolean)
742
+ : [];
743
+ }
744
+ function readFlag(args, flag) {
745
+ for (let i = 0; i < args.length; i += 1) {
746
+ const arg = args[i];
747
+ if (arg === flag)
748
+ return cleanString(args[i + 1]);
749
+ if (arg.startsWith(`${flag}=`))
750
+ return cleanString(arg.slice(flag.length + 1));
751
+ }
752
+ return undefined;
753
+ }
754
+ //# sourceMappingURL=AcpAgentRegistryService.js.map