@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,1199 @@
1
+ import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'fs';
2
+ import { homedir, cpus, freemem, totalmem, uptime as osUptime, platform, release, arch } from 'os';
3
+ import { basename, join } from 'path';
4
+ import { performance } from 'perf_hooks';
5
+ import { getAgentSearchService } from '../agentSearch/AgentSearchService.js';
6
+ import { getSearchSourceWatcher } from '../agentSearch/SearchSourceWatcher.js';
7
+ import { getCodebaseIntelligenceService } from '../codebase/CodebaseIntelligenceService.js';
8
+ import { getPluginMcpManagerService } from '../pluginMcp/PluginMcpManagerService.js';
9
+ import { RuntimeEventStore } from '../runtime/RuntimeEventStore.js';
10
+ import { peekSubagentScheduler } from '../subagents/SubagentScheduler.js';
11
+ import { SubagentRunService } from '../subagents/SubagentRunService.js';
12
+ import { collectAcpDiagnosticsSummary } from '../acp/AcpDiagnosticsService.js';
13
+ const DEFAULT_XENO_DIR = join(homedir(), '.xeno');
14
+ const REDACTED = '[redacted]';
15
+ const SUPPORT_SECRET_PATTERN = /token|secret|password|cookie|authorization|api[-_]?key|credential|bearer|access[-_]?key|refresh[-_]?token|private[-_]?key/i;
16
+ const SUPPORT_LOCAL_CLI_HOSTS = new Set(['localhost', '127.0.0.1', '::1', '[::1]']);
17
+ /**
18
+ * The composed scheduler's status, or an explicit statement that none is composed.
19
+ *
20
+ * Returning a marker rather than a fabricated status is the whole point: a support bundle is read
21
+ * by someone deciding whether to intervene, and "not composed" tells them to look at the
22
+ * composition while "running: false" tells them to look at the scheduler.
23
+ */
24
+ function schedulerStatusOrAbsent() {
25
+ const scheduler = peekSubagentScheduler();
26
+ if (!scheduler) {
27
+ return { composed: false, reason: 'no scheduler registered with setSubagentScheduler()' };
28
+ }
29
+ return scheduler.status();
30
+ }
31
+ export class SupportDiagnosticsService {
32
+ rootDir;
33
+ supportDir;
34
+ migrationStatePath;
35
+ constructor(rootDir = DEFAULT_XENO_DIR) {
36
+ this.rootDir = rootDir;
37
+ this.supportDir = join(rootDir, 'support');
38
+ this.migrationStatePath = join(rootDir, 'migrations.json');
39
+ }
40
+ async createSupportBundle(request = {}) {
41
+ try {
42
+ ensureDir(this.supportDir);
43
+ const capturedAt = new Date().toISOString();
44
+ const profile = this.profile();
45
+ const search = request.includeSearchStatus !== false ? await getAgentSearchService().status() : undefined;
46
+ const searchProfile = request.includeSearchStatus !== false && request.includeSearchProfile !== false
47
+ ? await getAgentSearchService().profile({ limit: 25 })
48
+ : undefined;
49
+ const searchWatcher = request.includeSearchStatus !== false && request.includeSearchWatcher !== false
50
+ ? getSearchSourceWatcher().status()
51
+ : undefined;
52
+ const runtime = request.includeRuntimeSummary !== false ? collectRuntimeSummary(this.rootDir) : undefined;
53
+ const acp = request.includeAcpDiagnostics !== false ? collectAcpDiagnosticsSummary(this.rootDir) : undefined;
54
+ const subagents = request.includeSubagentSnapshot !== false ? collectSubagentSnapshot(this.rootDir) : undefined;
55
+ const cliControlPlane = request.includeCliControlPlane !== false
56
+ ? collectCliControlPlaneSnapshot(this.rootDir, request.cliControlPlaneSnapshot)
57
+ : undefined;
58
+ const pluginMcp = request.includePluginMcpSnapshot ? await getPluginMcpManagerService().snapshot({ includeSdkConfigured: true }) : undefined;
59
+ const policyAudit = collectPolicyAuditSummary(this.rootDir);
60
+ const utilityIpcPolicy = collectUtilityIpcPolicyCoverage();
61
+ const lsp = collectLspDegradedSummary();
62
+ const diagnostics = {
63
+ searchLifecycle: summarizeSearchLifecycle(search, searchProfile, searchWatcher),
64
+ subagentExecution: summarizeSubagentExecution(subagents),
65
+ acpSessionRuntime: summarizeAcpSessionRuntime(acp),
66
+ cliControlPlane: summarizeCliControlPlaneHealth(cliControlPlane),
67
+ policyAudit,
68
+ pluginMcpTrustDrift: summarizePluginMcpTrustDrift(pluginMcp),
69
+ lspDegradedStatus: lsp,
70
+ utilityIpcPolicy,
71
+ };
72
+ const repairRecommendations = buildRepairRecommendations(diagnostics);
73
+ const bundle = {
74
+ version: 1,
75
+ capturedAt,
76
+ app: readPackageSummary(),
77
+ profile: profile.success ? profile : undefined,
78
+ search,
79
+ searchProfile,
80
+ searchWatcher,
81
+ runtime,
82
+ acp,
83
+ subagents,
84
+ cliControlPlane,
85
+ pluginMcp,
86
+ diagnostics,
87
+ repairRecommendations,
88
+ files: collectXenoFileInventory(this.rootDir),
89
+ logs: request.includeRecentLogs ? collectRecentTextFiles(this.rootDir, 30) : [],
90
+ };
91
+ const redacted = redact(bundle, this.rootDir);
92
+ const path = join(this.supportDir, `support-bundle-${new Date().toISOString().replace(/[:.]/g, '-')}.json`);
93
+ writeFileSync(path, JSON.stringify(redacted, null, 2) + '\n', 'utf-8');
94
+ return {
95
+ success: true,
96
+ path,
97
+ summary: {
98
+ capturedAt,
99
+ fileCount: Array.isArray(redacted.files) ? redacted.files.length : 0,
100
+ includedPluginMcp: !!request.includePluginMcpSnapshot,
101
+ includedRuntimeSummary: request.includeRuntimeSummary !== false,
102
+ includedAcpDiagnostics: request.includeAcpDiagnostics !== false,
103
+ includedSubagents: request.includeSubagentSnapshot !== false,
104
+ includedCliControlPlane: request.includeCliControlPlane !== false,
105
+ includedRecentLogs: !!request.includeRecentLogs,
106
+ searchHealth: diagnostics.searchLifecycle.health,
107
+ subagentActiveRuns: diagnostics.subagentExecution.activeRunCount,
108
+ acpSessionCount: diagnostics.acpSessionRuntime.sessionCount,
109
+ acpFailedSessionCount: diagnostics.acpSessionRuntime.failedSessionCount,
110
+ cliEndpointCount: diagnostics.cliControlPlane.endpointCount,
111
+ cliReadyEndpointCount: diagnostics.cliControlPlane.readyEndpointCount,
112
+ cliWorkflowAvailableCount: diagnostics.cliControlPlane.availableWorkflowCount,
113
+ cliDashboardReadyCount: diagnostics.cliControlPlane.readyDashboardCount,
114
+ policyDeniedCount: diagnostics.policyAudit.deniedCount,
115
+ pluginMcpReviewRequired: diagnostics.pluginMcpTrustDrift.reviewRequiredCount,
116
+ lspDegradedCount: diagnostics.lspDegradedStatus.degradedCount,
117
+ utilityIpcGuardedHandlers: diagnostics.utilityIpcPolicy.guardedHandlerCount,
118
+ repairRecommendationCount: repairRecommendations.length,
119
+ },
120
+ };
121
+ }
122
+ catch (err) {
123
+ return { success: false, error: errorMessage(err) };
124
+ }
125
+ }
126
+ async repairAll(request = {}) {
127
+ const startedAt = performance.now();
128
+ const repaired = [];
129
+ try {
130
+ try {
131
+ const status = await getAgentSearchService().reindex({ force: request.forceSearchReindex !== false });
132
+ const stats = asRecord(status.stats);
133
+ const documentCount = typeof stats.documentCount === 'number' ? stats.documentCount : 'unknown';
134
+ repaired.push({ id: 'agent-search-index', success: !status.error, detail: `ready=${status.ready} docs=${documentCount}` });
135
+ }
136
+ catch (err) {
137
+ repaired.push({ id: 'agent-search-index', success: false, error: errorMessage(err) });
138
+ }
139
+ try {
140
+ const migration = this.runMigrations();
141
+ repaired.push({ id: 'local-schema-migrations', success: migration.success, detail: `${migration.checks.length} checks`, error: migration.error });
142
+ }
143
+ catch (err) {
144
+ repaired.push({ id: 'local-schema-migrations', success: false, error: errorMessage(err) });
145
+ }
146
+ const diagnostics = await this.collectRepairDiagnostics();
147
+ return {
148
+ success: repaired.every((entry) => entry.success),
149
+ repaired,
150
+ repairRecommendations: buildRepairRecommendations(diagnostics),
151
+ durationMs: Math.round(performance.now() - startedAt),
152
+ };
153
+ }
154
+ catch (err) {
155
+ return {
156
+ success: false,
157
+ repaired,
158
+ repairRecommendations: [{
159
+ id: 'support-repair-failed',
160
+ severity: 'critical',
161
+ title: 'Support repair failed before diagnostics completed',
162
+ detail: errorMessage(err),
163
+ action: 'Open the support bundle with recent logs enabled, then retry repair after restarting Hub.',
164
+ }],
165
+ durationMs: Math.round(performance.now() - startedAt),
166
+ error: errorMessage(err),
167
+ };
168
+ }
169
+ }
170
+ runMigrations() {
171
+ const startedAt = performance.now();
172
+ const checks = [];
173
+ try {
174
+ ensureDir(this.rootDir);
175
+ ensureDir(join(this.rootDir, 'agent-chats'));
176
+ checks.push({ id: 'agent-chats-dir', status: 'ok', detail: 'Agent chat directory exists.' });
177
+ ensureDir(join(this.rootDir, 'runtime-events'));
178
+ checks.push({ id: 'runtime-events-dir', status: 'ok', detail: 'Runtime event directory exists.' });
179
+ ensureDir(join(this.rootDir, 'indexes', 'hub-search'));
180
+ checks.push({ id: 'search-index-dir', status: 'ok', detail: 'Search index directory exists.' });
181
+ ensureDir(join(this.rootDir, 'plugins'));
182
+ ensureDir(join(this.rootDir, 'mcp'));
183
+ checks.push({ id: 'plugin-mcp-dirs', status: 'ok', detail: 'Plugin and MCP directories exist.' });
184
+ const state = {
185
+ version: 1,
186
+ updatedAt: Date.now(),
187
+ checks: checks.map((check) => ({ id: check.id, status: check.status })),
188
+ };
189
+ writeFileSync(this.migrationStatePath, JSON.stringify(state, null, 2) + '\n', 'utf-8');
190
+ return {
191
+ success: true,
192
+ version: 1,
193
+ migrated: true,
194
+ path: this.migrationStatePath,
195
+ checks,
196
+ durationMs: Math.round(performance.now() - startedAt),
197
+ };
198
+ }
199
+ catch (err) {
200
+ return {
201
+ success: false,
202
+ version: 1,
203
+ migrated: false,
204
+ path: this.migrationStatePath,
205
+ checks,
206
+ durationMs: Math.round(performance.now() - startedAt),
207
+ error: errorMessage(err),
208
+ };
209
+ }
210
+ }
211
+ profile() {
212
+ const marks = {};
213
+ for (const entry of performance.getEntriesByType('mark')) {
214
+ marks[entry.name] = Math.round(entry.startTime);
215
+ }
216
+ return {
217
+ success: true,
218
+ capturedAt: new Date().toISOString(),
219
+ process: {
220
+ pid: process.pid,
221
+ uptimeSeconds: Math.round(process.uptime()),
222
+ memory: process.memoryUsage(),
223
+ cpuUsage: process.cpuUsage(),
224
+ },
225
+ host: {
226
+ platform: platform(),
227
+ release: release(),
228
+ arch: arch(),
229
+ cpuCount: cpus().length,
230
+ memoryTotalBytes: totalmem(),
231
+ memoryFreeBytes: freemem(),
232
+ osUptimeSeconds: Math.round(osUptime()),
233
+ },
234
+ marks,
235
+ };
236
+ }
237
+ async collectRepairDiagnostics() {
238
+ const search = await getAgentSearchService().status().catch((err) => ({ ready: false, building: false, error: errorMessage(err) }));
239
+ const searchProfile = await getAgentSearchService().profile({ limit: 25 }).catch(() => undefined);
240
+ const searchWatcher = getSearchSourceWatcher().status();
241
+ const subagents = collectSubagentSnapshot(this.rootDir);
242
+ const acp = collectAcpDiagnosticsSummary(this.rootDir);
243
+ const cliControlPlane = collectCliControlPlaneSnapshot(this.rootDir);
244
+ const pluginMcp = await getPluginMcpManagerService().snapshot({ includeSdkConfigured: true }).catch(() => undefined);
245
+ return {
246
+ searchLifecycle: summarizeSearchLifecycle(search, searchProfile, searchWatcher),
247
+ subagentExecution: summarizeSubagentExecution(subagents),
248
+ acpSessionRuntime: summarizeAcpSessionRuntime(acp),
249
+ cliControlPlane: summarizeCliControlPlaneHealth(cliControlPlane),
250
+ policyAudit: collectPolicyAuditSummary(this.rootDir),
251
+ pluginMcpTrustDrift: summarizePluginMcpTrustDrift(pluginMcp),
252
+ lspDegradedStatus: collectLspDegradedSummary(),
253
+ utilityIpcPolicy: collectUtilityIpcPolicyCoverage(),
254
+ };
255
+ }
256
+ }
257
+ function readPackageSummary() {
258
+ try {
259
+ const pkg = JSON.parse(readFileSync(join(process.cwd(), 'package.json'), 'utf-8'));
260
+ return {
261
+ name: pkg.name,
262
+ version: pkg.version,
263
+ productName: pkg.productName,
264
+ };
265
+ }
266
+ catch {
267
+ return { name: 'xeno-hub', version: 'unknown' };
268
+ }
269
+ }
270
+ function summarizeSearchLifecycle(search, profile, watcher) {
271
+ const status = asRecord(search);
272
+ const stats = asRecord(status.stats);
273
+ const health = asRecord(status.health);
274
+ const lifecycle = asRecord(status.lifecycle);
275
+ const queryProfile = asRecord(profile);
276
+ const watcherStatus = asRecord(watcher);
277
+ const healthIssues = Array.isArray(health.issues) ? health.issues : [];
278
+ const profileHealth = typeof queryProfile.health === 'string' ? queryProfile.health : undefined;
279
+ const hasError = typeof status.error === 'string' && status.error.length > 0;
280
+ const stale = health.stale === true || Number(lifecycle.staleDirtySourceCount || 0) > 0 || Number(watcherStatus.staleDirtySourceCount || 0) > 0;
281
+ const healthLabel = hasError || profileHealth === 'failing'
282
+ ? 'failing'
283
+ : health.healthy === false || stale || profileHealth === 'degraded' || status.ready === false
284
+ ? 'degraded'
285
+ : 'healthy';
286
+ return {
287
+ success: !hasError,
288
+ health: healthLabel,
289
+ ready: status.ready === true,
290
+ building: status.building === true,
291
+ backend: typeof stats.backend === 'string' ? stats.backend : undefined,
292
+ documentCount: finiteNumberOrUndefined(stats.documentCount),
293
+ stale,
294
+ activeJobStatus: typeof asRecord(lifecycle.activeJob).status === 'string' ? String(asRecord(lifecycle.activeJob).status) : undefined,
295
+ queuedJobCount: Array.isArray(lifecycle.queuedJobs) ? lifecycle.queuedJobs.length : 0,
296
+ dirtySourceCount: finiteNumber(watcherStatus.dirtySourceCount ?? (Array.isArray(lifecycle.dirtySources) ? lifecycle.dirtySources.length : 0)),
297
+ staleDirtySourceCount: finiteNumber(watcherStatus.staleDirtySourceCount ?? lifecycle.staleDirtySourceCount),
298
+ crashResumeAvailable: lifecycle.crashResumeAvailable === true,
299
+ cancellable: lifecycle.cancellable === true,
300
+ averageQueryMs: typeof queryProfile.averageQueryMs === 'number' ? Math.round(queryProfile.averageQueryMs) : null,
301
+ p95QueryMs: typeof queryProfile.p95QueryMs === 'number' ? Math.round(queryProfile.p95QueryMs) : null,
302
+ slowQueryCount: Array.isArray(queryProfile.slowQueries) ? queryProfile.slowQueries.length : finiteNumber(stats.slowQueryCount),
303
+ failedQueryCount: finiteNumber(queryProfile.failedQueryCount ?? stats.failedQueryCount),
304
+ watcherRunning: watcherStatus.running === true,
305
+ pendingReindex: watcherStatus.pendingReindex === true,
306
+ issues: healthIssues.slice(0, 20).map((issue) => {
307
+ const record = asRecord(issue);
308
+ return {
309
+ id: String(record.id || 'search-issue'),
310
+ severity: String(record.severity || 'warning'),
311
+ message: String(record.message || record.detail || 'Search health issue detected.').slice(0, 500),
312
+ };
313
+ }),
314
+ };
315
+ }
316
+ function summarizeSubagentExecution(subagents) {
317
+ const snapshot = asRecord(subagents);
318
+ const scheduler = asRecord(snapshot.scheduler);
319
+ const durable = asRecord(scheduler.durable);
320
+ const byStatus = asRecord(snapshot.byStatus);
321
+ return {
322
+ success: snapshot.success !== false,
323
+ schedulerRunning: scheduler.running === true,
324
+ activeRunCount: finiteNumber(snapshot.activeRunCount),
325
+ queuedCount: finiteNumber(byStatus.queued ?? durable.queuedCount),
326
+ runningCount: finiteNumber(byStatus.running ?? durable.runningCount),
327
+ waitingCount: finiteNumber(byStatus['waiting-for-permission']) + finiteNumber(byStatus['waiting-for-user']) + finiteNumber(durable.waitingCount),
328
+ recentRunCount: finiteNumber(snapshot.recentRunCount),
329
+ failedCount: finiteNumber(byStatus.failed),
330
+ cancelledCount: finiteNumber(byStatus.cancelled),
331
+ recoverableCount: Array.isArray(durable.recoverableRunIds) ? durable.recoverableRunIds.length : 0,
332
+ staleCount: finiteNumber(scheduler.lastStale) || (Array.isArray(durable.staleRunIds) ? durable.staleRunIds.length : 0),
333
+ timedOutCount: finiteNumber(scheduler.lastTimedOut) || (Array.isArray(durable.timedOutRunIds) ? durable.timedOutRunIds.length : 0),
334
+ lastRecovered: finiteNumber(scheduler.lastRecovered),
335
+ lastFailed: finiteNumber(scheduler.lastFailed),
336
+ lastTimedOut: finiteNumber(scheduler.lastTimedOut),
337
+ lastError: typeof scheduler.lastError === 'string' ? scheduler.lastError.slice(0, 500) : undefined,
338
+ };
339
+ }
340
+ function summarizeAcpSessionRuntime(acp) {
341
+ const summary = asRecord(acp);
342
+ const agents = Array.isArray(summary.agents) ? summary.agents : [];
343
+ return {
344
+ success: summary.success !== false,
345
+ protocol: typeof summary.protocol === 'string' ? summary.protocol : 'acp-v1-stdio',
346
+ eventCount: finiteNumber(summary.eventCount),
347
+ sessionCount: finiteNumber(summary.sessionCount),
348
+ activeSessionCount: finiteNumber(summary.activeSessionCount),
349
+ failedSessionCount: finiteNumber(summary.failedSessionCount),
350
+ pendingRequestCount: finiteNumber(summary.pendingRequestCount),
351
+ pendingPermissionCount: finiteNumber(summary.pendingPermissionCount),
352
+ malformedMessageCount: finiteNumber(summary.malformedMessageCount),
353
+ stderrLineCount: finiteNumber(summary.stderrLineCount),
354
+ agentCount: agents.length,
355
+ lastError: typeof summary.lastError === 'string' ? summary.lastError.slice(0, 500) : undefined,
356
+ };
357
+ }
358
+ function summarizeCliControlPlaneHealth(cliControlPlane) {
359
+ const snapshot = asRecord(cliControlPlane);
360
+ const endpoints = Array.isArray(snapshot.endpoints) ? snapshot.endpoints : [];
361
+ const remoteBackends = Array.isArray(snapshot.remoteBackends) ? snapshot.remoteBackends : [];
362
+ const lastInspection = asRecord(snapshot.lastInspection);
363
+ const workflows = Array.isArray(lastInspection.workflows) ? lastInspection.workflows : [];
364
+ const dashboards = Array.isArray(lastInspection.dashboards) ? lastInspection.dashboards : [];
365
+ const localReadyEndpointCount = endpoints.filter((entry) => {
366
+ const record = asRecord(entry);
367
+ return record.status === 'configured-local' || record.status === 'last-known-available';
368
+ }).length;
369
+ const inspectedEndpoint = typeof lastInspection.endpoint === 'string' ? lastInspection.endpoint : undefined;
370
+ const inspectedEndpointAlreadyCounted = !!inspectedEndpoint && endpoints.some((entry) => asRecord(entry).endpoint === inspectedEndpoint);
371
+ const readyEndpointCount = localReadyEndpointCount + (lastInspection.status === 'available' && !inspectedEndpointAlreadyCounted ? 1 : 0);
372
+ const nonLocalEndpointCount = finiteNumber(snapshot.nonLocalEndpointCount);
373
+ const missingActionCount = workflows.reduce((sum, workflow) => {
374
+ const record = asRecord(workflow);
375
+ return sum + finiteNumber(record.missingActionCount);
376
+ }, 0);
377
+ const lastInspectionStatus = typeof lastInspection.status === 'string' ? lastInspection.status : undefined;
378
+ const lastError = typeof snapshot.error === 'string'
379
+ ? snapshot.error.slice(0, 500)
380
+ : typeof lastInspection.error === 'string'
381
+ ? lastInspection.error.slice(0, 500)
382
+ : undefined;
383
+ return {
384
+ success: snapshot.success !== false && nonLocalEndpointCount === 0 && lastInspectionStatus !== 'blocked' && lastInspectionStatus !== 'offline',
385
+ checked: snapshot.checked === true,
386
+ endpointCount: finiteNumber(snapshot.endpointCount) || endpoints.length,
387
+ readyEndpointCount,
388
+ nonLocalEndpointCount,
389
+ remoteBackendCount: finiteNumber(snapshot.remoteBackendCount) || remoteBackends.length,
390
+ configuredAgentCount: finiteNumber(snapshot.configuredAgentCount),
391
+ lastInspectionStatus,
392
+ availableWorkflowCount: workflows.filter((workflow) => asRecord(workflow).available === true).length,
393
+ readyDashboardCount: dashboards.filter((dashboard) => asRecord(dashboard).status === 'ready').length,
394
+ partialDashboardCount: dashboards.filter((dashboard) => asRecord(dashboard).status === 'partial').length,
395
+ missingDashboardCount: dashboards.filter((dashboard) => asRecord(dashboard).status === 'missing').length,
396
+ missingActionCount,
397
+ versionSkewWarning: typeof lastInspection.versionSkewWarning === 'string' ? lastInspection.versionSkewWarning.slice(0, 500) : undefined,
398
+ lastError,
399
+ };
400
+ }
401
+ function summarizePluginMcpTrustDrift(pluginMcp) {
402
+ const snapshot = asRecord(pluginMcp);
403
+ const plugins = Array.isArray(snapshot.plugins) ? snapshot.plugins : [];
404
+ const servers = Array.isArray(snapshot.mcpServers) ? snapshot.mcpServers : [];
405
+ const stats = asRecord(snapshot.stats);
406
+ const effectivePolicy = asRecord(snapshot.effectivePolicy);
407
+ const targetsNeedingReview = [];
408
+ let reviewRequiredCount = 0;
409
+ let blockedCount = 0;
410
+ let configDriftCount = 0;
411
+ for (const plugin of plugins) {
412
+ const record = asRecord(plugin);
413
+ const trust = asRecord(record.trust);
414
+ const state = typeof trust.state === 'string' ? trust.state : 'unknown';
415
+ if (state === 'review-required')
416
+ reviewRequiredCount += 1;
417
+ if (state === 'blocked')
418
+ blockedCount += 1;
419
+ if (state !== 'trusted') {
420
+ targetsNeedingReview.push({
421
+ type: 'plugin',
422
+ name: String(record.name || 'unknown-plugin').slice(0, 120),
423
+ state,
424
+ risk: typeof trust.riskLevel === 'string' ? trust.riskLevel : undefined,
425
+ reason: firstString(trust.reasons),
426
+ });
427
+ }
428
+ }
429
+ for (const server of servers) {
430
+ const record = asRecord(server);
431
+ const trust = asRecord(record.trust);
432
+ const state = typeof trust.state === 'string' ? trust.state : 'unknown';
433
+ const drift = trust.configDrift === true;
434
+ if (state === 'review-required')
435
+ reviewRequiredCount += 1;
436
+ if (state === 'blocked')
437
+ blockedCount += 1;
438
+ if (drift)
439
+ configDriftCount += 1;
440
+ if (state !== 'trusted' || drift) {
441
+ targetsNeedingReview.push({
442
+ type: 'mcp',
443
+ name: String(record.name || 'unknown-mcp').slice(0, 120),
444
+ state,
445
+ risk: typeof trust.riskLevel === 'string' ? trust.riskLevel : undefined,
446
+ drift,
447
+ reason: firstString(trust.reasons),
448
+ });
449
+ }
450
+ }
451
+ const deniedByPolicyCount = normalizedList(effectivePolicy.pluginDenylist).length + normalizedList(effectivePolicy.mcpServerDenylist).length;
452
+ return {
453
+ success: !!pluginMcp,
454
+ pluginCount: finiteNumber(stats.pluginCount) || plugins.length,
455
+ mcpServerCount: finiteNumber(stats.mcpServerCount) || servers.length,
456
+ reviewRequiredCount,
457
+ blockedCount,
458
+ configDriftCount,
459
+ deniedByPolicyCount,
460
+ activePluginToolCount: finiteNumber(stats.activePluginToolCount),
461
+ connectedMcpServerCount: finiteNumber(stats.connectedMcpServerCount),
462
+ registryPolicy: typeof snapshot.mcpRegistryPolicy === 'string' ? snapshot.mcpRegistryPolicy : undefined,
463
+ targetsNeedingReview: targetsNeedingReview.slice(0, 25),
464
+ };
465
+ }
466
+ function collectPolicyAuditSummary(rootDir) {
467
+ const candidates = uniqueValues([
468
+ process.env.XENO_POLICY_AUDIT_PATH,
469
+ join(rootDir, 'audit', 'policy-decisions.jsonl'),
470
+ join(DEFAULT_XENO_DIR, 'audit', 'policy-decisions.jsonl'),
471
+ ]);
472
+ const path = candidates.find((candidate) => existsSync(candidate));
473
+ if (!path) {
474
+ return {
475
+ success: true,
476
+ checked: false,
477
+ entryCount: 0,
478
+ allowedCount: 0,
479
+ deniedCount: 0,
480
+ byAction: {},
481
+ byResourceKind: {},
482
+ recentDenials: [],
483
+ };
484
+ }
485
+ try {
486
+ const lines = readFileSync(path, 'utf-8').split(/\r?\n/).filter(Boolean).slice(-1000);
487
+ const byAction = {};
488
+ const byResourceKind = {};
489
+ const recentDenials = [];
490
+ let allowedCount = 0;
491
+ let deniedCount = 0;
492
+ for (const line of lines) {
493
+ let entry;
494
+ try {
495
+ entry = JSON.parse(line);
496
+ }
497
+ catch {
498
+ continue;
499
+ }
500
+ const action = typeof entry.action === 'string' ? entry.action : undefined;
501
+ const resource = asRecord(entry.resource);
502
+ const kind = typeof resource.kind === 'string' ? resource.kind : undefined;
503
+ const decision = asRecord(entry.decision);
504
+ if (action)
505
+ byAction[action] = (byAction[action] || 0) + 1;
506
+ if (kind)
507
+ byResourceKind[kind] = (byResourceKind[kind] || 0) + 1;
508
+ if (decision.allowed === true)
509
+ allowedCount += 1;
510
+ if (decision.allowed === false) {
511
+ deniedCount += 1;
512
+ recentDenials.push({
513
+ action,
514
+ kind,
515
+ reason: String(decision.reason || 'Policy denied the request.').slice(0, 500),
516
+ timestamp: typeof entry.timestamp === 'string' ? entry.timestamp : undefined,
517
+ });
518
+ }
519
+ }
520
+ return {
521
+ success: true,
522
+ checked: true,
523
+ entryCount: lines.length,
524
+ allowedCount,
525
+ deniedCount,
526
+ byAction,
527
+ byResourceKind,
528
+ recentDenials: recentDenials.slice(-20).reverse(),
529
+ };
530
+ }
531
+ catch (err) {
532
+ return {
533
+ success: false,
534
+ checked: true,
535
+ entryCount: 0,
536
+ allowedCount: 0,
537
+ deniedCount: 0,
538
+ byAction: {},
539
+ byResourceKind: {},
540
+ recentDenials: [],
541
+ error: errorMessage(err),
542
+ };
543
+ }
544
+ }
545
+ function collectLspDegradedSummary() {
546
+ try {
547
+ const rootDirectory = process.cwd();
548
+ const status = getCodebaseIntelligenceService().languageServiceStatus({
549
+ rootDirectory,
550
+ allowedDirectories: [rootDirectory],
551
+ });
552
+ if (!status.success) {
553
+ return {
554
+ success: false,
555
+ serviceCount: 0,
556
+ degradedCount: 0,
557
+ missingCount: 0,
558
+ runningCount: 0,
559
+ degradedServices: [],
560
+ error: status.error,
561
+ };
562
+ }
563
+ const services = status.services || [];
564
+ const degradedServices = services
565
+ .filter((service) => service.degraded || service.status === 'missing' || service.status === 'error')
566
+ .map((service) => ({
567
+ id: service.id,
568
+ label: service.label,
569
+ status: service.status,
570
+ languages: service.languages,
571
+ reason: service.degradedReason || service.lastError || service.detail,
572
+ installHint: service.installHint,
573
+ }));
574
+ return {
575
+ success: true,
576
+ serviceCount: services.length,
577
+ degradedCount: degradedServices.length,
578
+ missingCount: services.filter((service) => service.status === 'missing').length,
579
+ runningCount: services.filter((service) => service.status === 'running' || service.status === 'ready').length,
580
+ degradedServices: degradedServices.slice(0, 20),
581
+ };
582
+ }
583
+ catch (err) {
584
+ return {
585
+ success: false,
586
+ serviceCount: 0,
587
+ degradedCount: 0,
588
+ missingCount: 0,
589
+ runningCount: 0,
590
+ degradedServices: [],
591
+ error: errorMessage(err),
592
+ };
593
+ }
594
+ }
595
+ function collectUtilityIpcPolicyCoverage() {
596
+ const ipcDir = join(process.cwd(), 'src', 'main', 'ipc');
597
+ try {
598
+ const files = readdirSync(ipcDir).filter((name) => name.endsWith('.ts')).sort();
599
+ const guardedFiles = [];
600
+ const unguardedFiles = [];
601
+ let handlerCount = 0;
602
+ let guardedHandlerCount = 0;
603
+ for (const file of files) {
604
+ const path = join(ipcDir, file);
605
+ const text = readFileSync(path, 'utf-8');
606
+ const channels = extractIpcChannels(text);
607
+ if (channels.length === 0)
608
+ continue;
609
+ const guarded = /assertIpcPolicy|evaluateIpcPolicy|denyWithPolicy|evaluate[A-Za-z]+Policy|policyDecision|WorkspacePolicyService/.test(text);
610
+ handlerCount += channels.length;
611
+ if (guarded) {
612
+ guardedFiles.push(file);
613
+ guardedHandlerCount += channels.length;
614
+ }
615
+ else {
616
+ unguardedFiles.push(file);
617
+ }
618
+ }
619
+ return {
620
+ success: true,
621
+ checkedFileCount: files.length,
622
+ handlerCount,
623
+ guardedHandlerCount,
624
+ unguardedHandlerCount: Math.max(0, handlerCount - guardedHandlerCount),
625
+ guardedFiles: guardedFiles.slice(0, 100),
626
+ unguardedFiles: unguardedFiles.slice(0, 100),
627
+ knownUtilitySurfaces: ['files', 'capture', 'convert', 'content', 'exportBackup', 'webSearch', 'pluginMcp', 'apps', 'pixelBridge', 'motionBridge'],
628
+ };
629
+ }
630
+ catch (err) {
631
+ return {
632
+ success: false,
633
+ checkedFileCount: 0,
634
+ handlerCount: 0,
635
+ guardedHandlerCount: 0,
636
+ unguardedHandlerCount: 0,
637
+ guardedFiles: [],
638
+ unguardedFiles: [],
639
+ knownUtilitySurfaces: [],
640
+ error: errorMessage(err),
641
+ };
642
+ }
643
+ }
644
+ function buildRepairRecommendations(summary) {
645
+ const recommendations = [];
646
+ if (summary.searchLifecycle.health !== 'healthy' || summary.searchLifecycle.stale || summary.searchLifecycle.crashResumeAvailable) {
647
+ recommendations.push({
648
+ id: 'repair-search-lifecycle',
649
+ severity: summary.searchLifecycle.health === 'failing' ? 'critical' : 'warning',
650
+ title: 'Repair or resume search indexing',
651
+ detail: `Search is ${summary.searchLifecycle.health}; stale sources=${summary.searchLifecycle.staleDirtySourceCount}, dirty sources=${summary.searchLifecycle.dirtySourceCount}.`,
652
+ action: 'Run Support > Repair indexes. If an active job is stuck, cancel and force a rebuild from local sources.',
653
+ });
654
+ }
655
+ if (summary.subagentExecution.recoverableCount > 0 || summary.subagentExecution.staleCount > 0 || summary.subagentExecution.timedOutCount > 0 || summary.subagentExecution.lastError) {
656
+ recommendations.push({
657
+ id: 'repair-subagent-scheduler',
658
+ severity: summary.subagentExecution.lastError ? 'critical' : 'warning',
659
+ title: 'Sweep subagent scheduler state',
660
+ detail: `Recoverable=${summary.subagentExecution.recoverableCount}, stale=${summary.subagentExecution.staleCount}, timed out=${summary.subagentExecution.timedOutCount}.`,
661
+ action: 'Refresh the Subagents panel or restart Hub to trigger the scheduler sweep; cancel orphaned child runs if they remain active.',
662
+ });
663
+ }
664
+ if (summary.acpSessionRuntime.failedSessionCount > 0 || summary.acpSessionRuntime.malformedMessageCount > 0 || summary.acpSessionRuntime.pendingRequestCount > 0 || summary.acpSessionRuntime.lastError) {
665
+ recommendations.push({
666
+ id: 'review-acp-agent-runtime',
667
+ severity: summary.acpSessionRuntime.failedSessionCount > 0 || summary.acpSessionRuntime.pendingRequestCount > 0 ? 'warning' : 'info',
668
+ title: 'Review ACP agent runtime diagnostics',
669
+ detail: `ACP sessions=${summary.acpSessionRuntime.sessionCount}, failed=${summary.acpSessionRuntime.failedSessionCount}, pending requests=${summary.acpSessionRuntime.pendingRequestCount}, malformed messages=${summary.acpSessionRuntime.malformedMessageCount}.`,
670
+ action: 'Inspect the ACP diagnostics section and keep third-party ACP agents disabled until fixture lifecycle evidence is clean.',
671
+ });
672
+ }
673
+ if (summary.cliControlPlane.nonLocalEndpointCount > 0
674
+ || summary.cliControlPlane.lastInspectionStatus === 'blocked'
675
+ || summary.cliControlPlane.lastInspectionStatus === 'offline'
676
+ || summary.cliControlPlane.lastError
677
+ || summary.cliControlPlane.missingActionCount > 0) {
678
+ recommendations.push({
679
+ id: 'review-cli-control-plane',
680
+ severity: summary.cliControlPlane.lastInspectionStatus === 'blocked' || summary.cliControlPlane.nonLocalEndpointCount > 0 ? 'warning' : 'info',
681
+ title: 'Review CLI control-plane readiness',
682
+ detail: `CLI endpoints=${summary.cliControlPlane.endpointCount}, ready=${summary.cliControlPlane.readyEndpointCount}, workflows=${summary.cliControlPlane.availableWorkflowCount}, dashboards=${summary.cliControlPlane.readyDashboardCount}, missing actions=${summary.cliControlPlane.missingActionCount}.`,
683
+ action: 'Open the CLI workbench tab, inspect the local app-server manifest/OpenAPI contracts, and keep non-local or offline endpoints disabled until verified.',
684
+ });
685
+ }
686
+ if (summary.policyAudit.deniedCount > 0) {
687
+ recommendations.push({
688
+ id: 'review-policy-denials',
689
+ severity: 'warning',
690
+ title: 'Review recent policy denials',
691
+ detail: `${summary.policyAudit.deniedCount} denied policy decisions were found in the recent audit tail.`,
692
+ action: 'Open workspace/team/agent settings and grant the missing directory, plugin, MCP, app, or profile permission only if expected.',
693
+ });
694
+ }
695
+ if (summary.pluginMcpTrustDrift.reviewRequiredCount > 0 || summary.pluginMcpTrustDrift.configDriftCount > 0 || summary.pluginMcpTrustDrift.blockedCount > 0) {
696
+ recommendations.push({
697
+ id: 'review-plugin-mcp-trust',
698
+ severity: summary.pluginMcpTrustDrift.blockedCount > 0 ? 'critical' : 'warning',
699
+ title: 'Review Plugin/MCP trust decisions',
700
+ detail: `Review required=${summary.pluginMcpTrustDrift.reviewRequiredCount}, config drift=${summary.pluginMcpTrustDrift.configDriftCount}, blocked=${summary.pluginMcpTrustDrift.blockedCount}.`,
701
+ action: 'Open Plugin Manager, inspect permission/signature/config changes, then approve, deny, or update scoped policy.',
702
+ });
703
+ }
704
+ if (summary.lspDegradedStatus.degradedCount > 0) {
705
+ recommendations.push({
706
+ id: 'install-or-start-lsp',
707
+ severity: 'info',
708
+ title: 'Restore degraded language services',
709
+ detail: `${summary.lspDegradedStatus.degradedCount} language services are missing, stopped, or degraded.`,
710
+ action: 'Install the missing language servers shown in the LSP summary or start them from the Code workbench.',
711
+ });
712
+ }
713
+ if (summary.utilityIpcPolicy.unguardedFiles.length > 0) {
714
+ recommendations.push({
715
+ id: 'audit-utility-ipc-policy',
716
+ severity: 'warning',
717
+ title: 'Audit utility IPC policy coverage',
718
+ detail: `${summary.utilityIpcPolicy.unguardedFiles.length} IPC files with handlers did not expose an obvious policy guard marker.`,
719
+ action: 'Review the listed IPC files and add evaluateIpcPolicy/assertIpcPolicy for agent-scoped file, app, plugin, MCP, search, and content access.',
720
+ });
721
+ }
722
+ return recommendations;
723
+ }
724
+ function collectXenoFileInventory(rootDir) {
725
+ return collectRawXenoFileInventory(rootDir).map((file) => ({
726
+ ...file,
727
+ path: redactLocalPath(file.path, rootDir),
728
+ }));
729
+ }
730
+ function collectRawXenoFileInventory(rootDir) {
731
+ const files = [];
732
+ const visit = (dir, depth) => {
733
+ if (depth > 4 || !existsSync(dir))
734
+ return;
735
+ let names = [];
736
+ try {
737
+ names = readdirSync(dir);
738
+ }
739
+ catch {
740
+ return;
741
+ }
742
+ for (const name of names) {
743
+ const fullPath = join(dir, name);
744
+ let stat;
745
+ try {
746
+ stat = statSync(fullPath);
747
+ }
748
+ catch {
749
+ continue;
750
+ }
751
+ if (stat.isDirectory()) {
752
+ visit(fullPath, depth + 1);
753
+ }
754
+ else {
755
+ files.push({ path: fullPath, size: stat.size, mtimeMs: stat.mtimeMs });
756
+ }
757
+ if (files.length >= 5000)
758
+ return;
759
+ }
760
+ };
761
+ visit(rootDir, 0);
762
+ return files;
763
+ }
764
+ function collectRuntimeSummary(rootDir) {
765
+ try {
766
+ const store = new RuntimeEventStore(join(rootDir, 'runtime-events'));
767
+ const conversationIds = store.listConversationIds();
768
+ const recent = conversationIds.slice(-25).flatMap((conversationId) => {
769
+ const projection = store.project(conversationId);
770
+ if (!projection.success || !projection.projection)
771
+ return [];
772
+ return [{
773
+ conversationId,
774
+ eventCount: projection.projection.eventCount,
775
+ lastEventType: projection.projection.lastEventType,
776
+ lastEventAt: projection.projection.lastEventAt,
777
+ activeToolCount: projection.projection.activeTools.length,
778
+ toolCompletionCount: Object.values(projection.projection.toolCompletions).reduce((sum, count) => sum + count, 0),
779
+ diagnostics: projection.projection.timeline?.diagnostics,
780
+ }];
781
+ });
782
+ return {
783
+ success: true,
784
+ conversationCount: conversationIds.length,
785
+ recent,
786
+ };
787
+ }
788
+ catch (err) {
789
+ return { success: false, error: errorMessage(err) };
790
+ }
791
+ }
792
+ function collectCliControlPlaneSnapshot(rootDir, lastKnownInspection) {
793
+ const workspacePath = join(rootDir, 'workspaces.json');
794
+ const endpointMap = new Map();
795
+ const remoteBackendMap = new Map();
796
+ let workspaceCount = 0;
797
+ let teamCount = 0;
798
+ let agentCount = 0;
799
+ let configuredAgentCount = 0;
800
+ let parseError;
801
+ try {
802
+ if (existsSync(workspacePath)) {
803
+ const parsed = JSON.parse(readFileSync(workspacePath, 'utf-8'));
804
+ const workspaces = Array.isArray(parsed) ? parsed : [];
805
+ workspaceCount = workspaces.length;
806
+ for (const workspaceValue of workspaces.slice(0, 1000)) {
807
+ const workspace = asRecord(workspaceValue);
808
+ const workspaceId = safeSupportText(workspace.id, 'workspace', 200);
809
+ const teams = Array.isArray(workspace.teams) ? workspace.teams : [];
810
+ teamCount += teams.length;
811
+ for (const teamValue of teams.slice(0, 1000)) {
812
+ const team = asRecord(teamValue);
813
+ const teamId = safeSupportText(team.id, 'team', 200);
814
+ const agents = Array.isArray(team.agents) ? team.agents : [];
815
+ agentCount += agents.length;
816
+ for (const agentValue of agents.slice(0, 1000)) {
817
+ const agent = asRecord(agentValue);
818
+ const agentId = safeSupportText(agent.id, 'agent', 200);
819
+ const runtimeSelection = asRecord(agent.runtimeSelection);
820
+ const providerKind = typeof runtimeSelection.providerKind === 'string' ? runtimeSelection.providerKind : '';
821
+ if (providerKind === 'cli-app-server') {
822
+ configuredAgentCount += 1;
823
+ const origin = sanitizeCliSupportOrigin(runtimeSelection.cliAppServerEndpoint);
824
+ const key = origin.local ? origin.endpoint : `${origin.status}:${endpointMap.size}`;
825
+ const existing = endpointMap.get(key) || {
826
+ endpoint: origin.endpoint,
827
+ local: origin.local,
828
+ status: origin.status,
829
+ agentCount: 0,
830
+ workspaceIds: new Set(),
831
+ teamIds: new Set(),
832
+ agentIds: new Set(),
833
+ };
834
+ existing.agentCount += 1;
835
+ if (workspaceId)
836
+ existing.workspaceIds.add(workspaceId);
837
+ if (teamId)
838
+ existing.teamIds.add(teamId);
839
+ if (agentId)
840
+ existing.agentIds.add(agentId);
841
+ endpointMap.set(key, existing);
842
+ }
843
+ else if (providerKind === 'cli-remote') {
844
+ configuredAgentCount += 1;
845
+ const backendId = safeSupportText(runtimeSelection.remoteBackendId, 'cli-remote', 200) || 'cli-remote';
846
+ const existing = remoteBackendMap.get(backendId) || {
847
+ backendId,
848
+ agentCount: 0,
849
+ workspaceIds: new Set(),
850
+ teamIds: new Set(),
851
+ agentIds: new Set(),
852
+ };
853
+ existing.agentCount += 1;
854
+ if (workspaceId)
855
+ existing.workspaceIds.add(workspaceId);
856
+ if (teamId)
857
+ existing.teamIds.add(teamId);
858
+ if (agentId)
859
+ existing.agentIds.add(agentId);
860
+ remoteBackendMap.set(backendId, existing);
861
+ }
862
+ }
863
+ }
864
+ }
865
+ }
866
+ }
867
+ catch (err) {
868
+ parseError = errorMessage(err);
869
+ }
870
+ const lastInspection = summarizeCliControlPlaneLastInspection(lastKnownInspection);
871
+ const endpoints = Array.from(endpointMap.values()).map((entry) => ({
872
+ endpoint: entry.endpoint,
873
+ local: entry.local,
874
+ status: entry.status,
875
+ agentCount: entry.agentCount,
876
+ workspaceIds: Array.from(entry.workspaceIds).slice(0, 20),
877
+ teamIds: Array.from(entry.teamIds).slice(0, 20),
878
+ agentIds: Array.from(entry.agentIds).slice(0, 20),
879
+ }));
880
+ const remoteBackends = Array.from(remoteBackendMap.values()).map((entry) => ({
881
+ backendId: entry.backendId,
882
+ agentCount: entry.agentCount,
883
+ workspaceIds: Array.from(entry.workspaceIds).slice(0, 20),
884
+ teamIds: Array.from(entry.teamIds).slice(0, 20),
885
+ agentIds: Array.from(entry.agentIds).slice(0, 20),
886
+ }));
887
+ return {
888
+ success: !parseError,
889
+ checked: true,
890
+ workspacePath: redactLocalPath(workspacePath, rootDir),
891
+ workspaceFileExists: existsSync(workspacePath),
892
+ workspaceCount,
893
+ teamCount,
894
+ agentCount,
895
+ configuredAgentCount,
896
+ endpointCount: endpoints.length,
897
+ localEndpointCount: endpoints.filter((entry) => entry.local).length,
898
+ nonLocalEndpointCount: endpoints.filter((entry) => !entry.local && entry.status !== 'missing-endpoint').length,
899
+ remoteBackendCount: remoteBackends.length,
900
+ endpoints,
901
+ remoteBackends,
902
+ lastInspection,
903
+ error: parseError ? redactString(parseError, rootDir) : undefined,
904
+ };
905
+ }
906
+ function summarizeCliControlPlaneLastInspection(value) {
907
+ const record = asRecord(value);
908
+ if (Object.keys(record).length === 0)
909
+ return undefined;
910
+ const origin = sanitizeCliSupportOrigin(record.endpoint);
911
+ const manifest = asRecord(record.manifest);
912
+ const openapi = asRecord(record.openapi);
913
+ const workflows = Array.isArray(record.workflows) ? record.workflows : [];
914
+ const dashboards = Array.isArray(record.dashboards) ? record.dashboards : [];
915
+ return {
916
+ endpoint: origin.endpoint,
917
+ local: origin.local,
918
+ checkedAt: typeof record.checkedAt === 'number' && Number.isFinite(record.checkedAt) ? Math.max(0, Math.round(record.checkedAt)) : undefined,
919
+ status: safeEnum(record.status, ['idle', 'available', 'degraded', 'blocked', 'offline'], 'unknown'),
920
+ success: record.success === true || record.status === 'available',
921
+ error: safeSupportText(record.error, undefined, 500),
922
+ versionSkewWarning: safeSupportText(record.versionSkewWarning, undefined, 500),
923
+ manifest: {
924
+ ok: manifest.ok === true,
925
+ status: finiteNumber(manifest.status),
926
+ name: safeSupportText(manifest.name, undefined, 120),
927
+ version: safeSupportText(manifest.version, undefined, 120),
928
+ cliVersion: safeSupportText(manifest.cliVersion, undefined, 120),
929
+ appVersion: safeSupportText(manifest.appVersion, undefined, 120),
930
+ clientName: safeSupportText(manifest.clientName, undefined, 120),
931
+ capabilityCount: normalizedSafeStringList(manifest.capabilities, 40).length,
932
+ },
933
+ openapi: {
934
+ ok: openapi.ok === true,
935
+ status: finiteNumber(openapi.status),
936
+ title: safeSupportText(openapi.title, undefined, 120),
937
+ version: safeSupportText(openapi.version, undefined, 120),
938
+ operationCount: finiteNumber(openapi.operationCount),
939
+ pathCount: normalizedSafeStringList(openapi.paths, 200).length,
940
+ },
941
+ workflows: workflows.slice(0, 20).map(summarizeCliWorkflowSupportState),
942
+ dashboards: dashboards.slice(0, 20).map(summarizeCliDashboardSupportState),
943
+ };
944
+ }
945
+ function summarizeCliWorkflowSupportState(value) {
946
+ const workflow = asRecord(value);
947
+ const actions = Array.isArray(workflow.actions) ? workflow.actions : [];
948
+ const missing = normalizedSafeStringList(workflow.missing, 20);
949
+ return {
950
+ id: safeSupportText(workflow.id, 'workflow', 80),
951
+ label: safeSupportText(workflow.label, 'Workflow', 120),
952
+ available: workflow.available === true,
953
+ operationCount: finiteNumber(workflow.operationCount),
954
+ pathCount: normalizedSafeStringList(workflow.paths, 100).length,
955
+ actionCount: actions.length,
956
+ availableActionCount: actions.filter((action) => asRecord(action).available === true).length,
957
+ missingActionCount: missing.length,
958
+ missing: missing.slice(0, 12),
959
+ };
960
+ }
961
+ function summarizeCliDashboardSupportState(value) {
962
+ const dashboard = asRecord(value);
963
+ const actions = Array.isArray(dashboard.actions) ? dashboard.actions : [];
964
+ const missing = normalizedSafeStringList(dashboard.missing, 20);
965
+ return {
966
+ id: safeSupportText(dashboard.id, 'dashboard', 80),
967
+ label: safeSupportText(dashboard.label, 'Dashboard', 120),
968
+ status: safeEnum(dashboard.status, ['ready', 'partial', 'missing'], 'missing'),
969
+ operationCount: finiteNumber(dashboard.operationCount),
970
+ availableActionCount: finiteNumber(dashboard.availableActionCount),
971
+ requiredActionCount: finiteNumber(dashboard.requiredActionCount),
972
+ readOnlyProbeCount: finiteNumber(dashboard.readOnlyProbeCount),
973
+ mutatingOperationCount: finiteNumber(dashboard.mutatingOperationCount),
974
+ pathCount: normalizedSafeStringList(dashboard.paths, 100).length,
975
+ actionCount: actions.length,
976
+ missingActionCount: missing.length,
977
+ missing: missing.slice(0, 12),
978
+ };
979
+ }
980
+ function sanitizeCliSupportOrigin(value) {
981
+ if (typeof value !== 'string' || !value.trim())
982
+ return { endpoint: 'not-configured', local: false, status: 'missing-endpoint' };
983
+ try {
984
+ const url = new URL(value.trim());
985
+ if (url.protocol !== 'http:' && url.protocol !== 'https:')
986
+ return { endpoint: 'unsupported-protocol', local: false, status: 'blocked-protocol' };
987
+ const host = url.hostname.toLowerCase();
988
+ const local = SUPPORT_LOCAL_CLI_HOSTS.has(host) || host.endsWith('.localhost');
989
+ if (!local)
990
+ return { endpoint: 'non-local-origin', local: false, status: 'blocked-non-local' };
991
+ return { endpoint: `${url.protocol}//${url.host}`, local: true, status: 'configured-local' };
992
+ }
993
+ catch {
994
+ return { endpoint: 'invalid-origin', local: false, status: 'invalid-endpoint' };
995
+ }
996
+ }
997
+ function safeEnum(value, allowed, fallback) {
998
+ return typeof value === 'string' && allowed.includes(value) ? value : fallback;
999
+ }
1000
+ function safeSupportText(value, fallback, limit = 200) {
1001
+ if (typeof value !== 'string')
1002
+ return fallback;
1003
+ const trimmed = value.trim();
1004
+ if (!trimmed)
1005
+ return fallback;
1006
+ const redacted = redactString(trimmed).slice(0, Math.max(1, limit));
1007
+ return SUPPORT_SECRET_PATTERN.test(redacted) ? fallback : redacted;
1008
+ }
1009
+ function normalizedSafeStringList(value, limit) {
1010
+ if (!Array.isArray(value))
1011
+ return [];
1012
+ const out = [];
1013
+ const seen = new Set();
1014
+ for (const entry of value) {
1015
+ const text = safeSupportText(entry, undefined, 200);
1016
+ if (!text || seen.has(text))
1017
+ continue;
1018
+ seen.add(text);
1019
+ out.push(text);
1020
+ if (out.length >= limit)
1021
+ break;
1022
+ }
1023
+ return out;
1024
+ }
1025
+ function collectSubagentSnapshot(rootDir) {
1026
+ try {
1027
+ const service = new SubagentRunService(join(rootDir, 'subagent-runs.json'));
1028
+ const active = service.listRuns({ activeOnly: true, limit: 100 });
1029
+ const recent = service.listRuns({ limit: 100 });
1030
+ const byStatus = {};
1031
+ for (const run of recent.runs || []) {
1032
+ byStatus[run.status] = (byStatus[run.status] || 0) + 1;
1033
+ }
1034
+ return {
1035
+ success: active.success && recent.success,
1036
+ // `peek`, never `get`: the getter would BUILD a scheduler to answer, and an idle scheduler
1037
+ // that has never existed reads exactly like a live one that is doing nothing.
1038
+ scheduler: schedulerStatusOrAbsent(),
1039
+ activeRunCount: active.runs?.length || 0,
1040
+ recentRunCount: recent.runs?.length || 0,
1041
+ byStatus,
1042
+ recentRuns: (recent.runs || []).slice(0, 25).map((run) => ({
1043
+ id: run.id,
1044
+ status: run.status,
1045
+ workspaceId: run.workspaceId,
1046
+ teamId: run.teamId,
1047
+ parentAgentId: run.parentAgentId,
1048
+ childAgentId: run.childAgentId,
1049
+ createdAt: run.createdAt,
1050
+ updatedAt: run.updatedAt,
1051
+ artifactCount: run.artifacts.length,
1052
+ hasError: !!run.error,
1053
+ })),
1054
+ error: active.error || recent.error,
1055
+ };
1056
+ }
1057
+ catch (err) {
1058
+ return { success: false, error: errorMessage(err), scheduler: schedulerStatusOrAbsent() };
1059
+ }
1060
+ }
1061
+ function collectRecentTextFiles(root, limit) {
1062
+ const candidates = collectRawXenoFileInventory(root)
1063
+ .filter((file) => /\.(log|jsonl|txt|md)$/i.test(file.path))
1064
+ .sort((left, right) => right.mtimeMs - left.mtimeMs)
1065
+ .slice(0, Math.max(1, Math.min(limit, 100)));
1066
+ return candidates.flatMap((file) => {
1067
+ try {
1068
+ const text = readFileSync(file.path, 'utf-8').slice(-20_000);
1069
+ return [{ path: redactLocalPath(file.path, root), text }];
1070
+ }
1071
+ catch {
1072
+ return [];
1073
+ }
1074
+ });
1075
+ }
1076
+ function extractIpcChannels(text) {
1077
+ const channels = [];
1078
+ const patterns = [
1079
+ /\bsafeHandle\(\s*['"`]([^'"`]+)['"`]/g,
1080
+ /\bipcMain\.handle\(\s*['"`]([^'"`]+)['"`]/g,
1081
+ ];
1082
+ for (const pattern of patterns) {
1083
+ let match;
1084
+ while ((match = pattern.exec(text)))
1085
+ channels.push(match[1]);
1086
+ }
1087
+ return [...new Set(channels)];
1088
+ }
1089
+ function finiteNumberOrUndefined(value) {
1090
+ return typeof value === 'number' && Number.isFinite(value) ? Math.max(0, Math.round(value)) : undefined;
1091
+ }
1092
+ function finiteNumber(value) {
1093
+ return typeof value === 'number' && Number.isFinite(value) ? Math.max(0, Math.round(value)) : 0;
1094
+ }
1095
+ function firstString(value) {
1096
+ if (Array.isArray(value)) {
1097
+ const first = value.find((entry) => typeof entry === 'string' && entry.trim());
1098
+ return typeof first === 'string' ? first.slice(0, 500) : undefined;
1099
+ }
1100
+ return typeof value === 'string' && value.trim() ? value.slice(0, 500) : undefined;
1101
+ }
1102
+ function normalizedList(value) {
1103
+ if (!Array.isArray(value))
1104
+ return [];
1105
+ return value.filter((entry) => typeof entry === 'string' && !!entry.trim());
1106
+ }
1107
+ function uniqueValues(values) {
1108
+ const out = [];
1109
+ const seen = new Set();
1110
+ for (const value of values) {
1111
+ if (!value || seen.has(value))
1112
+ continue;
1113
+ seen.add(value);
1114
+ out.push(value);
1115
+ }
1116
+ return out;
1117
+ }
1118
+ function redact(value, rootDir = DEFAULT_XENO_DIR) {
1119
+ if (Array.isArray(value))
1120
+ return value.map((entry) => redact(entry, rootDir));
1121
+ if (!value || typeof value !== 'object')
1122
+ return value;
1123
+ const out = {};
1124
+ for (const [key, entry] of Object.entries(value)) {
1125
+ if (/token|secret|password|cookie|authorization|api[-_]?key|credential/i.test(key)) {
1126
+ out[key] = REDACTED;
1127
+ }
1128
+ else if (typeof entry === 'string') {
1129
+ out[key] = redactString(entry, rootDir);
1130
+ }
1131
+ else {
1132
+ out[key] = redact(entry, rootDir);
1133
+ }
1134
+ }
1135
+ return out;
1136
+ }
1137
+ function redactString(value, rootDir = DEFAULT_XENO_DIR) {
1138
+ return redactPathLikeString(value, rootDir)
1139
+ .replace(/Bearer\s+[A-Za-z0-9._~+/=-]+/gi, `Bearer ${REDACTED}`)
1140
+ .replace(/sk-[A-Za-z0-9_-]{20,}/g, REDACTED)
1141
+ .replace(/xai-[A-Za-z0-9_-]{20,}/g, REDACTED)
1142
+ .replace(/gh[pousr]_[A-Za-z0-9_]{20,}/g, REDACTED)
1143
+ .replace(/AKIA[0-9A-Z]{16}/g, REDACTED)
1144
+ .replace(/(api[_-]?key["'\s:=]{1,12})[A-Za-z0-9._~+/=-]{16,}/gi, `$1${REDACTED}`)
1145
+ .replace(/(token["'\s:=]{1,12})[A-Za-z0-9._~+/=-]{16,}/gi, `$1${REDACTED}`);
1146
+ }
1147
+ function redactLocalPath(value, rootDir) {
1148
+ const normalizedRoot = rootDir.replace(/\\/g, '/').replace(/\/+$/, '');
1149
+ const normalizedValue = value.replace(/\\/g, '/');
1150
+ if (normalizedValue === normalizedRoot)
1151
+ return '~/.xeno';
1152
+ if (normalizedValue.startsWith(`${normalizedRoot}/`)) {
1153
+ return `~/.xeno/${normalizedValue.slice(normalizedRoot.length + 1)}`;
1154
+ }
1155
+ return normalizedValue.replace(homedir().replace(/\\/g, '/'), '~');
1156
+ }
1157
+ function redactPathLikeString(value, rootDir) {
1158
+ let out = value;
1159
+ const root = rootDir.replace(/\\/g, '/').replace(/\/+$/, '');
1160
+ const home = homedir().replace(/\\/g, '/').replace(/\/+$/, '');
1161
+ if (root)
1162
+ out = replacePathPrefix(out, root, '~/.xeno');
1163
+ if (home)
1164
+ out = replacePathPrefix(out, home, '~');
1165
+ out = out.replace(/(^|[^a-zA-Z])([A-Za-z]:[\\/][^\s"'`<>|]+)/g, (_match, prefix, pathMatch) => {
1166
+ const normalized = pathMatch.replace(/\\/g, '/');
1167
+ if (normalized.startsWith('~/.xeno') || normalized.startsWith('~'))
1168
+ return `${prefix}${pathMatch}`;
1169
+ return `${prefix}[path:${safePathBasename(pathMatch)}]`;
1170
+ });
1171
+ out = out.replace(/(^|[\s"'=:(])\/(?:Users|home|tmp|var|private|mnt|Volumes|opt|workspace|code)\/[^\s"'`<>),]+/g, (_match, prefix) => {
1172
+ return `${prefix}[path]`;
1173
+ });
1174
+ return out;
1175
+ }
1176
+ function replacePathPrefix(value, prefix, replacement) {
1177
+ return value.split(prefix).join(replacement);
1178
+ }
1179
+ function safePathBasename(value) {
1180
+ const base = basename(value.replace(/\\/g, '/')).replace(/[^a-zA-Z0-9._-]/g, '_').slice(0, 80);
1181
+ return base || 'local';
1182
+ }
1183
+ function ensureDir(path) {
1184
+ if (!existsSync(path))
1185
+ mkdirSync(path, { recursive: true });
1186
+ }
1187
+ function errorMessage(err) {
1188
+ return err instanceof Error ? err.message : String(err);
1189
+ }
1190
+ function asRecord(value) {
1191
+ return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
1192
+ }
1193
+ let singleton = null;
1194
+ export function getSupportDiagnosticsService() {
1195
+ if (!singleton)
1196
+ singleton = new SupportDiagnosticsService();
1197
+ return singleton;
1198
+ }
1199
+ //# sourceMappingURL=SupportDiagnosticsService.js.map