@aria-cli/tools 1.0.13 → 1.0.15

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 (478) hide show
  1. package/dist/.aria-build-stamp.json +1 -1
  2. package/dist/ask-user-interaction.d.ts +0 -1
  3. package/dist/cache/web-cache.d.ts +0 -1
  4. package/dist/definitions/arion.d.ts +0 -1
  5. package/dist/definitions/browser/browser.d.ts +0 -1
  6. package/dist/definitions/browser/index.d.ts +0 -1
  7. package/dist/definitions/browser/pw-downloads.d.ts +0 -1
  8. package/dist/definitions/browser/pw-interactions.d.ts +0 -1
  9. package/dist/definitions/browser/pw-responses.d.ts +0 -1
  10. package/dist/definitions/browser/pw-session.d.ts +0 -1
  11. package/dist/definitions/browser/pw-shared.d.ts +0 -1
  12. package/dist/definitions/browser/pw-snapshot.d.ts +0 -1
  13. package/dist/definitions/browser/pw-state.d.ts +0 -1
  14. package/dist/definitions/browser/types.d.ts +0 -1
  15. package/dist/definitions/code-intelligence.d.ts +0 -1
  16. package/dist/definitions/core.d.ts +0 -1
  17. package/dist/definitions/delegation.d.ts +0 -1
  18. package/dist/definitions/deploy.d.ts +0 -1
  19. package/dist/definitions/filesystem.d.ts +0 -1
  20. package/dist/definitions/frg.d.ts +0 -1
  21. package/dist/definitions/index.d.ts +0 -1
  22. package/dist/definitions/memory.d.ts +0 -1
  23. package/dist/definitions/messaging.d.ts +0 -1
  24. package/dist/definitions/meta.d.ts +0 -1
  25. package/dist/definitions/network.d.ts +0 -1
  26. package/dist/definitions/outlook.d.ts +0 -1
  27. package/dist/definitions/patch/apply-patch.d.ts +0 -1
  28. package/dist/definitions/patch/fuzzy-match.d.ts +0 -1
  29. package/dist/definitions/patch/index.d.ts +0 -1
  30. package/dist/definitions/patch/patch-parser.d.ts +0 -1
  31. package/dist/definitions/patch/sandbox-paths.d.ts +0 -1
  32. package/dist/definitions/process/index.d.ts +0 -1
  33. package/dist/definitions/process/process-registry.d.ts +0 -1
  34. package/dist/definitions/process/process.d.ts +0 -1
  35. package/dist/definitions/process/pty-keys.d.ts +0 -1
  36. package/dist/definitions/process/session-slug.d.ts +0 -1
  37. package/dist/definitions/quip.d.ts +0 -1
  38. package/dist/definitions/search.d.ts +0 -1
  39. package/dist/definitions/session-history.d.ts +0 -1
  40. package/dist/definitions/shell.d.ts +0 -1
  41. package/dist/definitions/slack.d.ts +0 -1
  42. package/dist/definitions/web.d.ts +0 -1
  43. package/dist/dns-pinning-vc0r0vpx.js +1 -0
  44. package/dist/executors/apply-patch.d.ts +0 -1
  45. package/dist/executors/arion.d.ts +0 -1
  46. package/dist/executors/code-intelligence.d.ts +0 -1
  47. package/dist/executors/deploy.d.ts +0 -1
  48. package/dist/executors/filesystem.d.ts +0 -1
  49. package/dist/executors/frg-freshness.d.ts +0 -1
  50. package/dist/executors/frg.d.ts +0 -1
  51. package/dist/executors/index.d.ts +0 -1
  52. package/dist/executors/learning-meta.d.ts +0 -1
  53. package/dist/executors/lsp-client.d.ts +0 -1
  54. package/dist/executors/memory.d.ts +0 -1
  55. package/dist/executors/meta.d.ts +0 -1
  56. package/dist/executors/process-registry.d.ts +0 -1
  57. package/dist/executors/pty-session-store.d.ts +0 -1
  58. package/dist/executors/pty.d.ts +0 -1
  59. package/dist/executors/restart.d.ts +0 -1
  60. package/dist/executors/search-freshness.d.ts +0 -1
  61. package/dist/executors/search-types.d.ts +0 -1
  62. package/dist/executors/search.d.ts +0 -1
  63. package/dist/executors/self-diagnose.d.ts +0 -1
  64. package/dist/executors/session-history.d.ts +0 -1
  65. package/dist/executors/shell-safety.d.ts +0 -1
  66. package/dist/executors/shell.d.ts +0 -1
  67. package/dist/executors/utils.d.ts +0 -1
  68. package/dist/executors/web.d.ts +0 -1
  69. package/dist/extraction/content-extraction.d.ts +0 -1
  70. package/dist/extraction/index.d.ts +0 -1
  71. package/dist/headless-control-contract.d.ts +0 -1
  72. package/dist/index-6qew5tp1.js +2 -0
  73. package/dist/index-8xap0se3.js +6 -0
  74. package/dist/index-a2fr1b3x.js +2 -0
  75. package/dist/index-e1r4t0h0.js +8 -0
  76. package/dist/index-syg9gyvy.js +2 -0
  77. package/dist/index-x52t2mbj.js +4 -0
  78. package/dist/index.d.ts +0 -1
  79. package/dist/index.js +372 -71
  80. package/dist/local-control-http-auth.d.ts +0 -1
  81. package/dist/lsp-client-msnj763y.js +1 -0
  82. package/dist/mcp/client.d.ts +0 -1
  83. package/dist/mcp/connection.d.ts +0 -1
  84. package/dist/mcp/index.d.ts +0 -1
  85. package/dist/mcp/jsonrpc.d.ts +0 -1
  86. package/dist/mcp/types.d.ts +0 -1
  87. package/dist/network-control-adapter.d.ts +0 -1
  88. package/dist/network-runtime/address-types.d.ts +0 -1
  89. package/dist/network-runtime/db-owner-fencing.d.ts +0 -1
  90. package/dist/network-runtime/delivery-receipts.d.ts +0 -1
  91. package/dist/network-runtime/direct-endpoint-authority.d.ts +0 -1
  92. package/dist/network-runtime/index.d.ts +0 -1
  93. package/dist/network-runtime/index.js +1 -13
  94. package/dist/network-runtime/local-control-contract.d.ts +0 -1
  95. package/dist/network-runtime/node-store-contract.d.ts +0 -1
  96. package/dist/network-runtime/pair-route-contract.d.ts +0 -1
  97. package/dist/network-runtime/peer-capabilities.d.ts +0 -1
  98. package/dist/network-runtime/peer-principal-ref.d.ts +0 -1
  99. package/dist/network-runtime/peer-state-machine.d.ts +0 -1
  100. package/dist/network-runtime/protocol-schemas.d.ts +0 -1
  101. package/dist/network-runtime/runtime-bootstrap-contract.d.ts +0 -1
  102. package/dist/outlook/desktop-session.d.ts +0 -1
  103. package/dist/policy.d.ts +0 -1
  104. package/dist/providers/brave.d.ts +0 -1
  105. package/dist/providers/duckduckgo.d.ts +0 -1
  106. package/dist/providers/exa.d.ts +0 -1
  107. package/dist/providers/firecrawl.d.ts +0 -1
  108. package/dist/providers/index.d.ts +0 -1
  109. package/dist/providers/jina.d.ts +0 -1
  110. package/dist/providers/router.d.ts +0 -1
  111. package/dist/providers/search-provider.d.ts +0 -1
  112. package/dist/providers/tavily.d.ts +0 -1
  113. package/dist/pty-ff59hy75.js +1 -0
  114. package/dist/quip/desktop-session.d.ts +0 -1
  115. package/dist/registry/index.d.ts +0 -1
  116. package/dist/registry/registry.d.ts +0 -1
  117. package/dist/runtime-socket-local-control-client.d.ts +0 -1
  118. package/dist/security/dns-normalization.d.ts +0 -1
  119. package/dist/security/dns-pinning.d.ts +0 -1
  120. package/dist/security/external-content.d.ts +0 -1
  121. package/dist/security/ssrf.d.ts +0 -1
  122. package/dist/session-history-6gn52xhp.js +1 -0
  123. package/dist/slack/desktop-session.d.ts +0 -1
  124. package/dist/tool-factory.d.ts +0 -1
  125. package/dist/types.d.ts +0 -1
  126. package/dist/utils/retry.d.ts +0 -1
  127. package/dist/utils/safe-parse-json.d.ts +0 -1
  128. package/dist/utils/url.d.ts +0 -1
  129. package/dist-cjs/headless-control-contract.d.ts +35 -35
  130. package/dist-cjs/index.js +171 -186
  131. package/dist-cjs/network-runtime/index.js +3 -3
  132. package/dist-cjs/network-runtime/local-control-contract.d.ts +12 -12
  133. package/package.json +8 -6
  134. package/dist/.tsbuildinfo +0 -1
  135. package/dist/ask-user-interaction.d.ts.map +0 -1
  136. package/dist/ask-user-interaction.js +0 -23
  137. package/dist/ask-user-interaction.js.map +0 -1
  138. package/dist/cache/web-cache.d.ts.map +0 -1
  139. package/dist/cache/web-cache.js +0 -67
  140. package/dist/cache/web-cache.js.map +0 -1
  141. package/dist/definitions/arion.d.ts.map +0 -1
  142. package/dist/definitions/arion.js +0 -105
  143. package/dist/definitions/arion.js.map +0 -1
  144. package/dist/definitions/browser/browser.d.ts.map +0 -1
  145. package/dist/definitions/browser/browser.js +0 -419
  146. package/dist/definitions/browser/browser.js.map +0 -1
  147. package/dist/definitions/browser/index.d.ts.map +0 -1
  148. package/dist/definitions/browser/index.js +0 -5
  149. package/dist/definitions/browser/index.js.map +0 -1
  150. package/dist/definitions/browser/pw-downloads.d.ts.map +0 -1
  151. package/dist/definitions/browser/pw-downloads.js +0 -115
  152. package/dist/definitions/browser/pw-downloads.js.map +0 -1
  153. package/dist/definitions/browser/pw-interactions.d.ts.map +0 -1
  154. package/dist/definitions/browser/pw-interactions.js +0 -200
  155. package/dist/definitions/browser/pw-interactions.js.map +0 -1
  156. package/dist/definitions/browser/pw-responses.d.ts.map +0 -1
  157. package/dist/definitions/browser/pw-responses.js +0 -77
  158. package/dist/definitions/browser/pw-responses.js.map +0 -1
  159. package/dist/definitions/browser/pw-session.d.ts.map +0 -1
  160. package/dist/definitions/browser/pw-session.js +0 -311
  161. package/dist/definitions/browser/pw-session.js.map +0 -1
  162. package/dist/definitions/browser/pw-shared.d.ts.map +0 -1
  163. package/dist/definitions/browser/pw-shared.js +0 -67
  164. package/dist/definitions/browser/pw-shared.js.map +0 -1
  165. package/dist/definitions/browser/pw-snapshot.d.ts.map +0 -1
  166. package/dist/definitions/browser/pw-snapshot.js +0 -302
  167. package/dist/definitions/browser/pw-snapshot.js.map +0 -1
  168. package/dist/definitions/browser/pw-state.d.ts.map +0 -1
  169. package/dist/definitions/browser/pw-state.js +0 -63
  170. package/dist/definitions/browser/pw-state.js.map +0 -1
  171. package/dist/definitions/browser/types.d.ts.map +0 -1
  172. package/dist/definitions/browser/types.js +0 -5
  173. package/dist/definitions/browser/types.js.map +0 -1
  174. package/dist/definitions/code-intelligence.d.ts.map +0 -1
  175. package/dist/definitions/code-intelligence.js +0 -471
  176. package/dist/definitions/code-intelligence.js.map +0 -1
  177. package/dist/definitions/core.d.ts.map +0 -1
  178. package/dist/definitions/core.js +0 -110
  179. package/dist/definitions/core.js.map +0 -1
  180. package/dist/definitions/delegation.d.ts.map +0 -1
  181. package/dist/definitions/delegation.js +0 -513
  182. package/dist/definitions/delegation.js.map +0 -1
  183. package/dist/definitions/deploy.d.ts.map +0 -1
  184. package/dist/definitions/deploy.js +0 -66
  185. package/dist/definitions/deploy.js.map +0 -1
  186. package/dist/definitions/filesystem.d.ts.map +0 -1
  187. package/dist/definitions/filesystem.js +0 -197
  188. package/dist/definitions/filesystem.js.map +0 -1
  189. package/dist/definitions/frg.d.ts.map +0 -1
  190. package/dist/definitions/frg.js +0 -64
  191. package/dist/definitions/frg.js.map +0 -1
  192. package/dist/definitions/index.d.ts.map +0 -1
  193. package/dist/definitions/index.js +0 -21
  194. package/dist/definitions/index.js.map +0 -1
  195. package/dist/definitions/memory.d.ts.map +0 -1
  196. package/dist/definitions/memory.js +0 -124
  197. package/dist/definitions/memory.js.map +0 -1
  198. package/dist/definitions/messaging.d.ts.map +0 -1
  199. package/dist/definitions/messaging.js +0 -626
  200. package/dist/definitions/messaging.js.map +0 -1
  201. package/dist/definitions/meta.d.ts.map +0 -1
  202. package/dist/definitions/meta.js +0 -350
  203. package/dist/definitions/meta.js.map +0 -1
  204. package/dist/definitions/network.d.ts.map +0 -1
  205. package/dist/definitions/network.js +0 -160
  206. package/dist/definitions/network.js.map +0 -1
  207. package/dist/definitions/outlook.d.ts.map +0 -1
  208. package/dist/definitions/outlook.js +0 -278
  209. package/dist/definitions/outlook.js.map +0 -1
  210. package/dist/definitions/patch/apply-patch.d.ts.map +0 -1
  211. package/dist/definitions/patch/apply-patch.js +0 -185
  212. package/dist/definitions/patch/apply-patch.js.map +0 -1
  213. package/dist/definitions/patch/fuzzy-match.d.ts.map +0 -1
  214. package/dist/definitions/patch/fuzzy-match.js +0 -167
  215. package/dist/definitions/patch/fuzzy-match.js.map +0 -1
  216. package/dist/definitions/patch/index.d.ts.map +0 -1
  217. package/dist/definitions/patch/index.js +0 -2
  218. package/dist/definitions/patch/index.js.map +0 -1
  219. package/dist/definitions/patch/patch-parser.d.ts.map +0 -1
  220. package/dist/definitions/patch/patch-parser.js +0 -208
  221. package/dist/definitions/patch/patch-parser.js.map +0 -1
  222. package/dist/definitions/patch/sandbox-paths.d.ts.map +0 -1
  223. package/dist/definitions/patch/sandbox-paths.js +0 -106
  224. package/dist/definitions/patch/sandbox-paths.js.map +0 -1
  225. package/dist/definitions/process/index.d.ts.map +0 -1
  226. package/dist/definitions/process/index.js +0 -5
  227. package/dist/definitions/process/index.js.map +0 -1
  228. package/dist/definitions/process/process-registry.d.ts.map +0 -1
  229. package/dist/definitions/process/process-registry.js +0 -214
  230. package/dist/definitions/process/process-registry.js.map +0 -1
  231. package/dist/definitions/process/process.d.ts.map +0 -1
  232. package/dist/definitions/process/process.js +0 -387
  233. package/dist/definitions/process/process.js.map +0 -1
  234. package/dist/definitions/process/pty-keys.d.ts.map +0 -1
  235. package/dist/definitions/process/pty-keys.js +0 -255
  236. package/dist/definitions/process/pty-keys.js.map +0 -1
  237. package/dist/definitions/process/session-slug.d.ts.map +0 -1
  238. package/dist/definitions/process/session-slug.js +0 -143
  239. package/dist/definitions/process/session-slug.js.map +0 -1
  240. package/dist/definitions/quip.d.ts.map +0 -1
  241. package/dist/definitions/quip.js +0 -196
  242. package/dist/definitions/quip.js.map +0 -1
  243. package/dist/definitions/search.d.ts.map +0 -1
  244. package/dist/definitions/search.js +0 -61
  245. package/dist/definitions/search.js.map +0 -1
  246. package/dist/definitions/session-history.d.ts.map +0 -1
  247. package/dist/definitions/session-history.js +0 -70
  248. package/dist/definitions/session-history.js.map +0 -1
  249. package/dist/definitions/shell.d.ts.map +0 -1
  250. package/dist/definitions/shell.js +0 -182
  251. package/dist/definitions/shell.js.map +0 -1
  252. package/dist/definitions/slack.d.ts.map +0 -1
  253. package/dist/definitions/slack.js +0 -181
  254. package/dist/definitions/slack.js.map +0 -1
  255. package/dist/definitions/web.d.ts.map +0 -1
  256. package/dist/definitions/web.js +0 -110
  257. package/dist/definitions/web.js.map +0 -1
  258. package/dist/executors/apply-patch.d.ts.map +0 -1
  259. package/dist/executors/apply-patch.js +0 -902
  260. package/dist/executors/apply-patch.js.map +0 -1
  261. package/dist/executors/arion.d.ts.map +0 -1
  262. package/dist/executors/arion.js +0 -120
  263. package/dist/executors/arion.js.map +0 -1
  264. package/dist/executors/code-intelligence.d.ts.map +0 -1
  265. package/dist/executors/code-intelligence.js +0 -883
  266. package/dist/executors/code-intelligence.js.map +0 -1
  267. package/dist/executors/deploy.d.ts.map +0 -1
  268. package/dist/executors/deploy.js +0 -849
  269. package/dist/executors/deploy.js.map +0 -1
  270. package/dist/executors/filesystem.d.ts.map +0 -1
  271. package/dist/executors/filesystem.js +0 -1123
  272. package/dist/executors/filesystem.js.map +0 -1
  273. package/dist/executors/frg-freshness.d.ts.map +0 -1
  274. package/dist/executors/frg-freshness.js +0 -577
  275. package/dist/executors/frg-freshness.js.map +0 -1
  276. package/dist/executors/frg.d.ts.map +0 -1
  277. package/dist/executors/frg.js +0 -299
  278. package/dist/executors/frg.js.map +0 -1
  279. package/dist/executors/index.d.ts.map +0 -1
  280. package/dist/executors/index.js +0 -47
  281. package/dist/executors/index.js.map +0 -1
  282. package/dist/executors/learning-meta.d.ts.map +0 -1
  283. package/dist/executors/learning-meta.js +0 -1147
  284. package/dist/executors/learning-meta.js.map +0 -1
  285. package/dist/executors/lsp-client.d.ts.map +0 -1
  286. package/dist/executors/lsp-client.js +0 -297
  287. package/dist/executors/lsp-client.js.map +0 -1
  288. package/dist/executors/memory.d.ts.map +0 -1
  289. package/dist/executors/memory.js +0 -751
  290. package/dist/executors/memory.js.map +0 -1
  291. package/dist/executors/meta.d.ts.map +0 -1
  292. package/dist/executors/meta.js +0 -221
  293. package/dist/executors/meta.js.map +0 -1
  294. package/dist/executors/process-registry.d.ts.map +0 -1
  295. package/dist/executors/process-registry.js +0 -466
  296. package/dist/executors/process-registry.js.map +0 -1
  297. package/dist/executors/pty-session-store.d.ts.map +0 -1
  298. package/dist/executors/pty-session-store.js +0 -31
  299. package/dist/executors/pty-session-store.js.map +0 -1
  300. package/dist/executors/pty.d.ts.map +0 -1
  301. package/dist/executors/pty.js +0 -272
  302. package/dist/executors/pty.js.map +0 -1
  303. package/dist/executors/restart.d.ts.map +0 -1
  304. package/dist/executors/restart.js +0 -120
  305. package/dist/executors/restart.js.map +0 -1
  306. package/dist/executors/search-freshness.d.ts.map +0 -1
  307. package/dist/executors/search-freshness.js +0 -196
  308. package/dist/executors/search-freshness.js.map +0 -1
  309. package/dist/executors/search-types.d.ts.map +0 -1
  310. package/dist/executors/search-types.js +0 -53
  311. package/dist/executors/search-types.js.map +0 -1
  312. package/dist/executors/search.d.ts.map +0 -1
  313. package/dist/executors/search.js +0 -67
  314. package/dist/executors/search.js.map +0 -1
  315. package/dist/executors/self-diagnose.d.ts.map +0 -1
  316. package/dist/executors/self-diagnose.js +0 -399
  317. package/dist/executors/self-diagnose.js.map +0 -1
  318. package/dist/executors/session-history.d.ts.map +0 -1
  319. package/dist/executors/session-history.js +0 -284
  320. package/dist/executors/session-history.js.map +0 -1
  321. package/dist/executors/shell-safety.d.ts.map +0 -1
  322. package/dist/executors/shell-safety.js +0 -474
  323. package/dist/executors/shell-safety.js.map +0 -1
  324. package/dist/executors/shell.d.ts.map +0 -1
  325. package/dist/executors/shell.js +0 -955
  326. package/dist/executors/shell.js.map +0 -1
  327. package/dist/executors/utils.d.ts.map +0 -1
  328. package/dist/executors/utils.js +0 -34
  329. package/dist/executors/utils.js.map +0 -1
  330. package/dist/executors/web.d.ts.map +0 -1
  331. package/dist/executors/web.js +0 -543
  332. package/dist/executors/web.js.map +0 -1
  333. package/dist/extraction/content-extraction.d.ts.map +0 -1
  334. package/dist/extraction/content-extraction.js +0 -236
  335. package/dist/extraction/content-extraction.js.map +0 -1
  336. package/dist/extraction/index.d.ts.map +0 -1
  337. package/dist/extraction/index.js +0 -5
  338. package/dist/extraction/index.js.map +0 -1
  339. package/dist/headless-control-contract.d.ts.map +0 -1
  340. package/dist/headless-control-contract.js +0 -968
  341. package/dist/headless-control-contract.js.map +0 -1
  342. package/dist/index.d.ts.map +0 -1
  343. package/dist/index.js.map +0 -1
  344. package/dist/local-control-http-auth.d.ts.map +0 -1
  345. package/dist/local-control-http-auth.js +0 -3
  346. package/dist/local-control-http-auth.js.map +0 -1
  347. package/dist/mcp/client.d.ts.map +0 -1
  348. package/dist/mcp/client.js +0 -182
  349. package/dist/mcp/client.js.map +0 -1
  350. package/dist/mcp/connection.d.ts.map +0 -1
  351. package/dist/mcp/connection.js +0 -481
  352. package/dist/mcp/connection.js.map +0 -1
  353. package/dist/mcp/index.d.ts.map +0 -1
  354. package/dist/mcp/index.js +0 -11
  355. package/dist/mcp/index.js.map +0 -1
  356. package/dist/mcp/jsonrpc.d.ts.map +0 -1
  357. package/dist/mcp/jsonrpc.js +0 -145
  358. package/dist/mcp/jsonrpc.js.map +0 -1
  359. package/dist/mcp/types.d.ts.map +0 -1
  360. package/dist/mcp/types.js +0 -8
  361. package/dist/mcp/types.js.map +0 -1
  362. package/dist/network-control-adapter.d.ts.map +0 -1
  363. package/dist/network-control-adapter.js +0 -73
  364. package/dist/network-control-adapter.js.map +0 -1
  365. package/dist/network-runtime/address-types.d.ts.map +0 -1
  366. package/dist/network-runtime/address-types.js +0 -166
  367. package/dist/network-runtime/address-types.js.map +0 -1
  368. package/dist/network-runtime/db-owner-fencing.d.ts.map +0 -1
  369. package/dist/network-runtime/db-owner-fencing.js +0 -70
  370. package/dist/network-runtime/db-owner-fencing.js.map +0 -1
  371. package/dist/network-runtime/delivery-receipts.d.ts.map +0 -1
  372. package/dist/network-runtime/delivery-receipts.js +0 -268
  373. package/dist/network-runtime/delivery-receipts.js.map +0 -1
  374. package/dist/network-runtime/direct-endpoint-authority.d.ts.map +0 -1
  375. package/dist/network-runtime/direct-endpoint-authority.js +0 -26
  376. package/dist/network-runtime/direct-endpoint-authority.js.map +0 -1
  377. package/dist/network-runtime/index.d.ts.map +0 -1
  378. package/dist/network-runtime/index.js.map +0 -1
  379. package/dist/network-runtime/local-control-contract.d.ts.map +0 -1
  380. package/dist/network-runtime/local-control-contract.js +0 -628
  381. package/dist/network-runtime/local-control-contract.js.map +0 -1
  382. package/dist/network-runtime/node-store-contract.d.ts.map +0 -1
  383. package/dist/network-runtime/node-store-contract.js +0 -35
  384. package/dist/network-runtime/node-store-contract.js.map +0 -1
  385. package/dist/network-runtime/pair-route-contract.d.ts.map +0 -1
  386. package/dist/network-runtime/pair-route-contract.js +0 -78
  387. package/dist/network-runtime/pair-route-contract.js.map +0 -1
  388. package/dist/network-runtime/peer-capabilities.d.ts.map +0 -1
  389. package/dist/network-runtime/peer-capabilities.js +0 -29
  390. package/dist/network-runtime/peer-capabilities.js.map +0 -1
  391. package/dist/network-runtime/peer-principal-ref.d.ts.map +0 -1
  392. package/dist/network-runtime/peer-principal-ref.js +0 -13
  393. package/dist/network-runtime/peer-principal-ref.js.map +0 -1
  394. package/dist/network-runtime/peer-state-machine.d.ts.map +0 -1
  395. package/dist/network-runtime/peer-state-machine.js +0 -122
  396. package/dist/network-runtime/peer-state-machine.js.map +0 -1
  397. package/dist/network-runtime/protocol-schemas.d.ts.map +0 -1
  398. package/dist/network-runtime/protocol-schemas.js +0 -206
  399. package/dist/network-runtime/protocol-schemas.js.map +0 -1
  400. package/dist/network-runtime/runtime-bootstrap-contract.d.ts.map +0 -1
  401. package/dist/network-runtime/runtime-bootstrap-contract.js +0 -61
  402. package/dist/network-runtime/runtime-bootstrap-contract.js.map +0 -1
  403. package/dist/outlook/desktop-session.d.ts.map +0 -1
  404. package/dist/outlook/desktop-session.js +0 -280
  405. package/dist/outlook/desktop-session.js.map +0 -1
  406. package/dist/policy.d.ts.map +0 -1
  407. package/dist/policy.js +0 -150
  408. package/dist/policy.js.map +0 -1
  409. package/dist/providers/brave.d.ts.map +0 -1
  410. package/dist/providers/brave.js +0 -63
  411. package/dist/providers/brave.js.map +0 -1
  412. package/dist/providers/duckduckgo.d.ts.map +0 -1
  413. package/dist/providers/duckduckgo.js +0 -177
  414. package/dist/providers/duckduckgo.js.map +0 -1
  415. package/dist/providers/exa.d.ts.map +0 -1
  416. package/dist/providers/exa.js +0 -64
  417. package/dist/providers/exa.js.map +0 -1
  418. package/dist/providers/firecrawl.d.ts.map +0 -1
  419. package/dist/providers/firecrawl.js +0 -56
  420. package/dist/providers/firecrawl.js.map +0 -1
  421. package/dist/providers/index.d.ts.map +0 -1
  422. package/dist/providers/index.js +0 -8
  423. package/dist/providers/index.js.map +0 -1
  424. package/dist/providers/jina.d.ts.map +0 -1
  425. package/dist/providers/jina.js +0 -50
  426. package/dist/providers/jina.js.map +0 -1
  427. package/dist/providers/router.d.ts.map +0 -1
  428. package/dist/providers/router.js +0 -97
  429. package/dist/providers/router.js.map +0 -1
  430. package/dist/providers/search-provider.d.ts.map +0 -1
  431. package/dist/providers/search-provider.js +0 -33
  432. package/dist/providers/search-provider.js.map +0 -1
  433. package/dist/providers/tavily.d.ts.map +0 -1
  434. package/dist/providers/tavily.js +0 -55
  435. package/dist/providers/tavily.js.map +0 -1
  436. package/dist/quip/desktop-session.d.ts.map +0 -1
  437. package/dist/quip/desktop-session.js +0 -318
  438. package/dist/quip/desktop-session.js.map +0 -1
  439. package/dist/registry/index.d.ts.map +0 -1
  440. package/dist/registry/index.js +0 -2
  441. package/dist/registry/index.js.map +0 -1
  442. package/dist/registry/registry.d.ts.map +0 -1
  443. package/dist/registry/registry.js +0 -757
  444. package/dist/registry/registry.js.map +0 -1
  445. package/dist/runtime-socket-local-control-client.d.ts.map +0 -1
  446. package/dist/runtime-socket-local-control-client.js +0 -331
  447. package/dist/runtime-socket-local-control-client.js.map +0 -1
  448. package/dist/security/dns-normalization.d.ts.map +0 -1
  449. package/dist/security/dns-normalization.js +0 -20
  450. package/dist/security/dns-normalization.js.map +0 -1
  451. package/dist/security/dns-pinning.d.ts.map +0 -1
  452. package/dist/security/dns-pinning.js +0 -124
  453. package/dist/security/dns-pinning.js.map +0 -1
  454. package/dist/security/external-content.d.ts.map +0 -1
  455. package/dist/security/external-content.js +0 -92
  456. package/dist/security/external-content.js.map +0 -1
  457. package/dist/security/ssrf.d.ts.map +0 -1
  458. package/dist/security/ssrf.js +0 -182
  459. package/dist/security/ssrf.js.map +0 -1
  460. package/dist/slack/desktop-session.d.ts.map +0 -1
  461. package/dist/slack/desktop-session.js +0 -325
  462. package/dist/slack/desktop-session.js.map +0 -1
  463. package/dist/tool-factory.d.ts.map +0 -1
  464. package/dist/tool-factory.js +0 -48
  465. package/dist/tool-factory.js.map +0 -1
  466. package/dist/types.d.ts.map +0 -1
  467. package/dist/types.js +0 -8
  468. package/dist/types.js.map +0 -1
  469. package/dist/utils/retry.d.ts.map +0 -1
  470. package/dist/utils/retry.js +0 -133
  471. package/dist/utils/retry.js.map +0 -1
  472. package/dist/utils/safe-parse-json.d.ts.map +0 -1
  473. package/dist/utils/safe-parse-json.js +0 -161
  474. package/dist/utils/safe-parse-json.js.map +0 -1
  475. package/dist/utils/url.d.ts.map +0 -1
  476. package/dist/utils/url.js +0 -20
  477. package/dist/utils/url.js.map +0 -1
  478. package/dist-cjs/.tsbuildinfo +0 -1
@@ -1,883 +0,0 @@
1
- /**
2
- * @aria/tools - Code intelligence executors
3
- *
4
- * 7 native tools wrapping external CLI binaries:
5
- * rg (ripgrep), ug (ugrep), probe, sg (ast-grep),
6
- * cbm (codebase-memory-mcp), serena, fff
7
- */
8
- import { execFile, spawn as cpSpawn } from "node:child_process";
9
- import { promisify } from "node:util";
10
- import { existsSync, readdirSync, statSync } from "node:fs";
11
- import { resolve as pathResolve, dirname, join as pathJoin } from "node:path";
12
- import { createConnection } from "node:net";
13
- import { success, fail } from "./utils.js";
14
- const execFileAsync = promisify(execFile);
15
- // ---------------------------------------------------------------------------
16
- // Shared helpers
17
- // ---------------------------------------------------------------------------
18
- const binaryCache = new Map();
19
- async function hasBinary(name) {
20
- if (binaryCache.has(name))
21
- return binaryCache.get(name);
22
- try {
23
- await execFileAsync("which", [name]);
24
- binaryCache.set(name, true);
25
- }
26
- catch {
27
- binaryCache.set(name, false);
28
- }
29
- return binaryCache.get(name);
30
- }
31
- async function shellExec(cmd, args, opts) {
32
- return execFileAsync(cmd, args, {
33
- cwd: opts.cwd,
34
- timeout: opts.timeout ?? 30_000,
35
- signal: opts.signal,
36
- maxBuffer: 10 * 1024 * 1024, // 10MB
37
- });
38
- }
39
- function pushIf(args, condition, ...flags) {
40
- if (condition)
41
- args.push(...flags);
42
- }
43
- function mergeExtraArgs(args, extra) {
44
- if (extra?.length)
45
- args.push(...extra);
46
- }
47
- function escapeRegex(str) {
48
- return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
49
- }
50
- function asExecError(err) {
51
- if (err && typeof err === "object")
52
- return err;
53
- return { message: String(err) };
54
- }
55
- // ---------------------------------------------------------------------------
56
- // 1. rg — ripgrep
57
- // ---------------------------------------------------------------------------
58
- export async function executeRg(input, ctx) {
59
- if (ctx.abortSignal?.aborted)
60
- return fail("Operation cancelled");
61
- if (!(await hasBinary("rg")))
62
- return fail("ripgrep (rg) not installed. Install: brew install ripgrep");
63
- // When count mode is active, rg -c outputs plain text (file:count) even with --json.
64
- // We omit --json and parse the plain-text output instead.
65
- const rgCountMode = !!input.count;
66
- const args = rgCountMode
67
- ? ["--line-number", "--color", "never"]
68
- : ["--json", "--line-number", "--color", "never"];
69
- pushIf(args, input.ignore_case, "-i");
70
- pushIf(args, input.smart_case, "-S");
71
- pushIf(args, input.fixed_strings, "-F");
72
- pushIf(args, input.word_regexp, "-w");
73
- pushIf(args, input.invert, "-v");
74
- pushIf(args, input.files_only, "-l");
75
- pushIf(args, input.count, "-c");
76
- if (input.file_type)
77
- args.push("-t", input.file_type);
78
- if (input.glob)
79
- args.push("-g", input.glob);
80
- if (input.context != null)
81
- args.push("-C", String(input.context));
82
- if (input.max_count != null)
83
- args.push("-m", String(input.max_count));
84
- mergeExtraArgs(args, input.extra_args);
85
- args.push("--", input.pattern);
86
- args.push(input.path ?? ctx.workingDir);
87
- try {
88
- const { stdout } = await shellExec("rg", args, {
89
- cwd: ctx.workingDir,
90
- signal: ctx.abortSignal,
91
- });
92
- if (rgCountMode) {
93
- const counts = parseRipgrepCount(stdout);
94
- const total = counts.reduce((s, c) => s + c.count, 0);
95
- return success(`Found ${total} matches across ${counts.length} files for "${input.pattern}"`, { counts, total });
96
- }
97
- const matches = parseRipgrepJson(stdout);
98
- return success(`Found ${matches.length} matches for "${input.pattern}"`, { matches });
99
- }
100
- catch (err) {
101
- const e = asExecError(err);
102
- if (e.code === 1)
103
- return success("No matches found", { matches: [] });
104
- return fail(`rg failed: ${e.stderr || e.message}`);
105
- }
106
- }
107
- function parseRipgrepJson(stdout) {
108
- const matches = [];
109
- for (const line of stdout.split("\n")) {
110
- if (!line.trim())
111
- continue;
112
- try {
113
- const obj = JSON.parse(line);
114
- if (obj.type === "match") {
115
- matches.push({
116
- file: obj.data.path.text,
117
- line: obj.data.line_number,
118
- text: obj.data.lines.text.trimEnd(),
119
- submatches: obj.data.submatches?.map((s) => s.match?.text) ?? [],
120
- });
121
- }
122
- }
123
- catch {
124
- // Skip malformed lines
125
- }
126
- }
127
- return matches;
128
- }
129
- /** Parse rg/ug plain-text count output: `file:count` per line.
130
- * Filters out files with 0 matches (ug -c outputs 0-count lines, rg doesn't). */
131
- function parseRipgrepCount(stdout) {
132
- const counts = [];
133
- for (const line of stdout.split("\n")) {
134
- if (!line.trim())
135
- continue;
136
- const lastColon = line.lastIndexOf(":");
137
- if (lastColon === -1)
138
- continue;
139
- const file = line.slice(0, lastColon);
140
- const count = parseInt(line.slice(lastColon + 1), 10);
141
- if (!isNaN(count) && count > 0)
142
- counts.push({ file, count });
143
- }
144
- return counts;
145
- }
146
- // ---------------------------------------------------------------------------
147
- // 2. ug — ugrep
148
- // ---------------------------------------------------------------------------
149
- export async function executeUg(input, ctx) {
150
- if (ctx.abortSignal?.aborted)
151
- return fail("Operation cancelled");
152
- if (!(await hasBinary("ug")))
153
- return fail("ugrep (ug) not installed. Install: brew install ugrep");
154
- // --ignore-files: respect .gitignore / .ignore (parity with rg default behaviour).
155
- // --ignore-binary: skip binary files (tar, images, etc.) — rg skips them by default.
156
- // Without these flags ug searches dist/, node_modules/, .tar archives, etc.
157
- const ugCountMode = !!input.count;
158
- const args = ugCountMode
159
- ? ["--line-number", "--color=never", "-r", "--ignore-files", "--ignore-binary"]
160
- : ["--json", "--line-number", "--color=never", "-r", "--ignore-files", "--ignore-binary"];
161
- pushIf(args, input.ignore_case, "-i");
162
- pushIf(args, input.smart_case, "-j");
163
- pushIf(args, input.fixed_strings, "-F");
164
- pushIf(args, input.word_regexp, "-w");
165
- pushIf(args, input.files_only, "-l");
166
- pushIf(args, input.count, "-c");
167
- pushIf(args, input.decompress, "-z");
168
- if (input.file_type)
169
- args.push("-t", input.file_type);
170
- if (input.glob)
171
- args.push("-g", input.glob);
172
- if (input.context != null)
173
- args.push("-C", String(input.context));
174
- if (input.max_count != null)
175
- args.push("-m", String(input.max_count));
176
- if (input.neg_pattern)
177
- args.push("-N", input.neg_pattern);
178
- // Fuzzy matching
179
- if (input.fuzzy === true) {
180
- args.push("-Z");
181
- }
182
- else if (typeof input.fuzzy === "number") {
183
- args.push(`-Z${input.fuzzy}`);
184
- }
185
- // Boolean query mode
186
- if (input.bool)
187
- args.push("-%%");
188
- mergeExtraArgs(args, input.extra_args);
189
- args.push("--", input.pattern);
190
- args.push(input.path ?? ctx.workingDir);
191
- try {
192
- const { stdout } = await shellExec("ug", args, {
193
- cwd: ctx.workingDir,
194
- signal: ctx.abortSignal,
195
- });
196
- if (ugCountMode) {
197
- const counts = parseRipgrepCount(stdout); // same file:count format
198
- const total = counts.reduce((s, c) => s + c.count, 0);
199
- return success(`Found ${total} matches across ${counts.length} files for "${input.pattern}"`, { counts, total });
200
- }
201
- const matches = parseUgrepJson(stdout);
202
- return success(`Found ${matches.length} matches for "${input.pattern}"`, { matches });
203
- }
204
- catch (err) {
205
- const e = asExecError(err);
206
- if (e.code === 1)
207
- return success("No matches found", { matches: [] });
208
- return fail(`ug failed: ${e.stderr || e.message}`);
209
- }
210
- }
211
- function parseUgrepJson(stdout) {
212
- // ugrep --json outputs: [{ file, matches: [{ line, match }] }]
213
- // This is a JSON array, NOT NDJSON like ripgrep
214
- const results = [];
215
- try {
216
- const parsed = JSON.parse(stdout);
217
- for (const fileGroup of parsed) {
218
- for (const m of fileGroup.matches) {
219
- results.push({
220
- file: fileGroup.file,
221
- line: m.line,
222
- text: m.match.trimEnd(),
223
- submatches: [],
224
- });
225
- }
226
- }
227
- }
228
- catch {
229
- // Fallback: try NDJSON parsing in case format varies
230
- for (const line of stdout.split("\n")) {
231
- if (!line.trim())
232
- continue;
233
- try {
234
- const obj = JSON.parse(line);
235
- if (obj.file && obj.matches) {
236
- for (const m of obj.matches) {
237
- results.push({
238
- file: obj.file,
239
- line: m.line,
240
- text: m.match?.trimEnd() ?? "",
241
- submatches: [],
242
- });
243
- }
244
- }
245
- }
246
- catch {
247
- // Skip
248
- }
249
- }
250
- }
251
- return results;
252
- }
253
- // ---------------------------------------------------------------------------
254
- // 3. probe
255
- // ---------------------------------------------------------------------------
256
- export async function executeProbe(input, ctx) {
257
- if (ctx.abortSignal?.aborted)
258
- return fail("Operation cancelled");
259
- if (!(await hasBinary("probe")))
260
- return fail("probe not installed. Install: npm install -g @probelabs/probe");
261
- const cmd = input.command ?? "search";
262
- const args = [cmd];
263
- switch (cmd) {
264
- case "search": {
265
- if (!input.query)
266
- return fail("query required for search");
267
- pushIf(args, input.exact, "--exact");
268
- pushIf(args, input.allow_tests, "--allow-tests");
269
- if (input.max_tokens != null)
270
- args.push("--max-tokens", String(input.max_tokens));
271
- if (input.max_results != null)
272
- args.push("--max-results", String(input.max_results));
273
- if (input.session)
274
- args.push("--session", input.session);
275
- if (input.language)
276
- args.push("--language", input.language);
277
- if (input.reranker)
278
- args.push("--reranker", input.reranker);
279
- args.push("--format", "json");
280
- mergeExtraArgs(args, input.extra_args);
281
- args.push("--", input.query);
282
- if (input.path)
283
- args.push(input.path);
284
- break;
285
- }
286
- case "extract": {
287
- if (!input.files?.length)
288
- return fail("files required for extract");
289
- args.push("--format", "json");
290
- mergeExtraArgs(args, input.extra_args);
291
- args.push(...input.files);
292
- break;
293
- }
294
- case "symbols": {
295
- // Accept files via `files` array or fall back to `query` as a file path
296
- const symbolFiles = input.files?.length ? input.files : input.query ? [input.query] : [];
297
- if (!symbolFiles.length)
298
- return fail("files required for symbols (pass via 'files' or 'query')");
299
- args.push("--format", "json");
300
- mergeExtraArgs(args, input.extra_args);
301
- args.push(...symbolFiles);
302
- break;
303
- }
304
- case "query": {
305
- if (!input.query)
306
- return fail("query (AST pattern) required for query command");
307
- if (input.language)
308
- args.push("--language", input.language);
309
- if (input.max_results != null)
310
- args.push("--max-results", String(input.max_results));
311
- pushIf(args, input.allow_tests, "--allow-tests");
312
- args.push("--format", "json");
313
- mergeExtraArgs(args, input.extra_args);
314
- args.push("--", input.query);
315
- if (input.path)
316
- args.push(input.path);
317
- break;
318
- }
319
- }
320
- try {
321
- const { stdout } = await shellExec("probe", args, {
322
- cwd: ctx.workingDir,
323
- signal: ctx.abortSignal,
324
- timeout: 60_000,
325
- });
326
- try {
327
- const data = JSON.parse(stdout);
328
- return success(`probe ${cmd} completed`, data);
329
- }
330
- catch {
331
- // If not valid JSON, return raw output
332
- return success(`probe ${cmd} completed`, { raw: stdout });
333
- }
334
- }
335
- catch (err) {
336
- const e = asExecError(err);
337
- return fail(`probe ${cmd} failed: ${e.stderr || e.message}`);
338
- }
339
- }
340
- // ---------------------------------------------------------------------------
341
- // 4. sg — ast-grep
342
- // ---------------------------------------------------------------------------
343
- export async function executeSg(input, ctx) {
344
- if (ctx.abortSignal?.aborted)
345
- return fail("Operation cancelled");
346
- if (!(await hasBinary("sg")))
347
- return fail("ast-grep (sg) not installed. Install: cargo install ast-grep --locked");
348
- const cmd = input.command ?? "run";
349
- const isMutation = !!(input.rewrite || input.update_all);
350
- // Require confirmation for mutations
351
- if (isMutation && !input.update_all && ctx.confirm) {
352
- const approved = await ctx.confirm(`Rewrite code matching \`${input.pattern}\` to \`${input.rewrite}\` in ${input.language || "auto-detected"} files?`);
353
- if (!approved)
354
- return fail("Rewrite cancelled by user");
355
- }
356
- const args = [cmd];
357
- if (cmd === "run") {
358
- if (!input.pattern)
359
- return fail("pattern required for sg run");
360
- args.push("--pattern", input.pattern);
361
- if (input.language)
362
- args.push("--lang", input.language);
363
- if (input.rewrite)
364
- args.push("--rewrite", input.rewrite);
365
- if (input.strictness)
366
- args.push("--strictness", input.strictness);
367
- pushIf(args, input.update_all, "-U");
368
- }
369
- else if (cmd === "scan") {
370
- if (input.rule)
371
- args.push("--rule", input.rule);
372
- if (input.inline_rules)
373
- args.push("--inline-rules", input.inline_rules);
374
- }
375
- // Shared flags
376
- if (input.globs)
377
- args.push("--globs", input.globs);
378
- if (input.context != null)
379
- args.push("-C", String(input.context));
380
- // Always JSON for machine parsing, skip color
381
- if (!isMutation) {
382
- args.push("--json=compact");
383
- }
384
- args.push("--color", "never");
385
- mergeExtraArgs(args, input.extra_args);
386
- args.push(input.path ?? ctx.workingDir);
387
- try {
388
- const { stdout } = await shellExec("sg", args, {
389
- cwd: ctx.workingDir,
390
- signal: ctx.abortSignal,
391
- });
392
- if (isMutation) {
393
- return success(`sg ${cmd}: rewrites applied`, { raw: stdout });
394
- }
395
- try {
396
- const data = JSON.parse(stdout);
397
- const count = Array.isArray(data) ? data.length : 0;
398
- return success(`Found ${count} matches`, { matches: data });
399
- }
400
- catch {
401
- return success(`sg ${cmd} completed`, { raw: stdout });
402
- }
403
- }
404
- catch (err) {
405
- // Exit code 1 = no matches for run
406
- const e = asExecError(err);
407
- if (e.code === 1 && cmd === "run")
408
- return success("No matches found", { matches: [] });
409
- return fail(`sg ${cmd} failed: ${e.stderr || e.message}`);
410
- }
411
- }
412
- // ---------------------------------------------------------------------------
413
- // 5. cbm — codebase-memory-mcp
414
- // ---------------------------------------------------------------------------
415
- // Internal helper to call cbm CLI
416
- async function cbmCall(tool, params, ctx, timeout) {
417
- // Remove undefined/null values from params
418
- const clean = {};
419
- for (const [k, v] of Object.entries(params)) {
420
- if (v !== undefined && v !== null)
421
- clean[k] = v;
422
- }
423
- const { stdout } = await shellExec("codebase-memory-mcp", ["cli", tool, JSON.stringify(clean)], {
424
- cwd: ctx.workingDir,
425
- signal: ctx.abortSignal,
426
- timeout: timeout ?? 30_000,
427
- });
428
- // cbm cli returns MCP content format: { content: [{ type: "text", text: "..." }] }
429
- // Filter log lines (level=info ...) and parse
430
- const jsonLines = stdout.split("\n").filter((l) => l.trim() && !l.startsWith("level="));
431
- const parsed = JSON.parse(jsonLines.join("\n"));
432
- if (Array.isArray(parsed.content)) {
433
- const textBlocks = parsed.content
434
- .filter((c) => c.type === "text")
435
- .map((c) => c.text);
436
- const combined = textBlocks.join("\n");
437
- try {
438
- return JSON.parse(combined);
439
- }
440
- catch {
441
- return { text: combined };
442
- }
443
- }
444
- return parsed;
445
- }
446
- export async function executeCbm(input, ctx) {
447
- if (ctx.abortSignal?.aborted)
448
- return fail("Operation cancelled");
449
- if (!(await hasBinary("codebase-memory-mcp")))
450
- return fail("codebase-memory-mcp not installed. Install:\ncurl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/scripts/setup.sh | bash");
451
- // Auto-detect project name: cbm slugifies repo_path by replacing / with -
452
- // and stripping the leading separator: /Users/hole/aria → Users-hole-aria
453
- const p = input.project ?? (input.path ?? ctx.workingDir).replace(/^\//, "").replace(/\//g, "-");
454
- // Auto-index: if the action requires an indexed project and no project exists,
455
- // transparently run a fast index first so queries don't silently return empty.
456
- const queryActions = new Set([
457
- "search",
458
- "trace",
459
- "impact",
460
- "context",
461
- "snippet",
462
- "code_search",
463
- "architecture",
464
- "schema",
465
- "cypher",
466
- ]);
467
- if (queryActions.has(input.action)) {
468
- let needsIndex = false;
469
- try {
470
- const statusResult = (await cbmCall("index_status", { project: p }, ctx));
471
- // If status indicates no project or empty graph, auto-index
472
- if (statusResult?.status === "no_project" ||
473
- statusResult?.node_count === 0 ||
474
- statusResult?.error) {
475
- needsIndex = true;
476
- }
477
- }
478
- catch {
479
- // index_status failed — likely no project
480
- needsIndex = true;
481
- }
482
- if (needsIndex) {
483
- try {
484
- await cbmCall("index_repository", { repo_path: input.path ?? ctx.workingDir, mode: "full" }, ctx, 300_000);
485
- }
486
- catch {
487
- // If auto-index fails, continue — let the actual action produce the error
488
- }
489
- }
490
- }
491
- switch (input.action) {
492
- case "index":
493
- return success("Indexed", await cbmCall("index_repository", { repo_path: input.path ?? ctx.workingDir, mode: input.mode ?? "full" }, ctx, 300_000));
494
- case "search":
495
- return success("Search results", await cbmCall("search_graph", {
496
- project: p,
497
- name_pattern: input.name,
498
- label: input.label,
499
- file_pattern: input.file,
500
- limit: input.limit ?? 20,
501
- }, ctx));
502
- case "trace": {
503
- if (!input.name)
504
- return fail("name required for trace");
505
- return success(`Call chain: ${input.name}`, await cbmCall("trace_call_path", {
506
- project: p,
507
- function_name: input.name,
508
- direction: input.direction ?? "both",
509
- depth: input.depth ?? 3,
510
- edge_types: input.edge_types,
511
- }, ctx));
512
- }
513
- case "impact":
514
- return success("Impact analysis", await cbmCall("detect_changes", {
515
- project: p,
516
- scope: input.scope,
517
- depth: input.depth ?? 2,
518
- base_branch: input.base_branch ?? "main",
519
- }, ctx));
520
- case "context": {
521
- if (!input.name)
522
- return fail("name required for context");
523
- const [sym, callers, callees] = await Promise.all([
524
- cbmCall("search_graph", { project: p, name_pattern: `^${escapeRegex(input.name)}$`, limit: 1 }, ctx),
525
- cbmCall("trace_call_path", { project: p, function_name: input.name, direction: "inbound", depth: 2 }, ctx),
526
- cbmCall("trace_call_path", { project: p, function_name: input.name, direction: "outbound", depth: 2 }, ctx),
527
- ]);
528
- return success(`360° context: ${input.name}`, {
529
- definition: sym.results?.[0],
530
- callers,
531
- callees,
532
- });
533
- }
534
- case "snippet": {
535
- if (!input.qualified_name)
536
- return fail("qualified_name required for snippet");
537
- return success("Code snippet", await cbmCall("get_code_snippet", {
538
- project: p,
539
- qualified_name: input.qualified_name,
540
- include_neighbors: input.include_neighbors,
541
- }, ctx));
542
- }
543
- case "code_search":
544
- return success("Code search", await cbmCall("search_code", {
545
- project: p,
546
- pattern: input.code_pattern,
547
- mode: input.code_mode ?? "compact",
548
- regex: input.regex,
549
- limit: input.limit ?? 10,
550
- file_pattern: input.file,
551
- context: input.context,
552
- }, ctx));
553
- case "architecture":
554
- return success("Architecture", await cbmCall("get_architecture", { project: p }, ctx));
555
- case "schema":
556
- return success("Schema", await cbmCall("get_graph_schema", { project: p }, ctx));
557
- case "cypher": {
558
- if (!input.query)
559
- return fail("query required for cypher");
560
- return success("Cypher result", await cbmCall("query_graph", { project: p, query: input.query, max_rows: input.max_rows }, ctx));
561
- }
562
- case "list_projects":
563
- return success("Projects", await cbmCall("list_projects", {}, ctx));
564
- case "delete_project": {
565
- if (!input.project)
566
- return fail("project required for delete_project");
567
- if (ctx.confirm) {
568
- const ok = await ctx.confirm(`Delete project "${input.project}" from cbm index?`);
569
- if (!ok)
570
- return fail("Cancelled");
571
- }
572
- return success("Deleted", await cbmCall("delete_project", { project: p }, ctx));
573
- }
574
- case "status":
575
- return success("Status", await cbmCall("index_status", { project: p }, ctx));
576
- default:
577
- return fail(`Unknown cbm action: ${input.action}`);
578
- }
579
- }
580
- let _lspClient;
581
- async function getLspClient() {
582
- if (!_lspClient) {
583
- // Use variable to prevent TypeScript from following the import in CJS build
584
- const modulePath = "./lsp-client.js";
585
- _lspClient = (await import(/* webpackIgnore: true */ modulePath));
586
- }
587
- return _lspClient;
588
- }
589
- export async function executeLsp(input, ctx) {
590
- if (ctx.abortSignal?.aborted)
591
- return fail("Operation cancelled");
592
- if (!input.file)
593
- return fail("file required");
594
- const { getServerForFile, getOrCreateServer, LSP_SERVERS } = await getLspClient();
595
- const serverName = getServerForFile(input.file);
596
- if (!serverName) {
597
- const ext = input.file.slice(input.file.lastIndexOf("."));
598
- const supported = Object.entries(LSP_SERVERS)
599
- .map(([name, cfg]) => `${name}: ${Object.keys(cfg.extensionToLanguage).join(", ")}`)
600
- .join("\n ");
601
- return fail(`No language server for extension "${ext}". Supported:\n ${supported}`);
602
- }
603
- // Rename requires confirmation
604
- if (input.action === "rename" && ctx.confirm) {
605
- const ok = await ctx.confirm(`Rename symbol at ${input.file}:${input.line}:${input.character} to "${input.new_name}"?`);
606
- if (!ok)
607
- return fail("Cancelled by user");
608
- }
609
- const server = getOrCreateServer(serverName, ctx.workingDir);
610
- try {
611
- await server.start();
612
- switch (input.action) {
613
- case "definition": {
614
- if (input.line == null || input.character == null)
615
- return fail("line and character required for definition");
616
- const result = await server.definition(input.file, input.line, input.character);
617
- return success(`lsp definition`, result);
618
- }
619
- case "references": {
620
- if (input.line == null || input.character == null)
621
- return fail("line and character required for references");
622
- const result = await server.references(input.file, input.line, input.character);
623
- return success(`lsp references`, result);
624
- }
625
- case "hover": {
626
- if (input.line == null || input.character == null)
627
- return fail("line and character required for hover");
628
- const result = await server.hover(input.file, input.line, input.character);
629
- return success(`lsp hover`, result);
630
- }
631
- case "symbols": {
632
- const result = await server.documentSymbols(input.file);
633
- return success(`lsp symbols`, result);
634
- }
635
- case "rename": {
636
- if (input.line == null || input.character == null || !input.new_name)
637
- return fail("line, character, and new_name required for rename");
638
- const result = await server.rename(input.file, input.line, input.character, input.new_name);
639
- return success(`lsp rename`, result);
640
- }
641
- default:
642
- return fail(`Unknown lsp action: ${input.action}. Use: definition, references, hover, symbols, rename`);
643
- }
644
- }
645
- catch (err) {
646
- const e = asExecError(err);
647
- return fail(`lsp ${input.action} failed: ${e.message}`);
648
- }
649
- }
650
- // ---------------------------------------------------------------------------
651
- // 7. serena — HTTP project server (kept alongside native LSP for full Serena API)
652
- // ---------------------------------------------------------------------------
653
- const SERENA_PORT = 9750;
654
- const SERENA_BASE = `http://127.0.0.1:${SERENA_PORT}`;
655
- const SERENA_PROJECT = "aria";
656
- const SERENA_TOOL_MAP = {
657
- find_symbol: "find_symbol",
658
- find_references: "find_referencing_symbols",
659
- overview: "get_symbols_overview",
660
- replace_body: "replace_symbol_body",
661
- insert_after: "insert_after_symbol",
662
- insert_before: "insert_before_symbol",
663
- rename: "rename_symbol",
664
- search: "search_for_pattern",
665
- };
666
- // ---------------------------------------------------------------------------
667
- // Serena auto-start: spawn the HTTP project server on demand
668
- // ---------------------------------------------------------------------------
669
- let serenaStarting = null;
670
- async function isSerenaAlive() {
671
- // Lightweight TCP probe — just check if something is listening on the port.
672
- // A full HTTP request is too heavy during startup (Serena takes seconds to load projects).
673
- return new Promise((resolve) => {
674
- const sock = createConnection({ host: "127.0.0.1", port: SERENA_PORT }, () => {
675
- sock.destroy();
676
- resolve(true);
677
- });
678
- sock.setTimeout(2_000);
679
- sock.on("error", () => resolve(false));
680
- sock.on("timeout", () => {
681
- sock.destroy();
682
- resolve(false);
683
- });
684
- });
685
- }
686
- function findSerenaProjectRoot() {
687
- // Walk up from cwd looking for .serena/project.yml
688
- let dir = pathResolve(process.cwd());
689
- while (dir !== dirname(dir)) {
690
- if (existsSync(pathJoin(dir, ".serena", "project.yml")))
691
- return dir;
692
- dir = dirname(dir);
693
- }
694
- // Fallback: walk up from this file's directory
695
- // (compiled JS lives in packages/tools/dist/executors/)
696
- // __dirname is available since the build target is CJS
697
- dir = typeof __dirname === "string" ? pathResolve(__dirname) : pathResolve(".");
698
- while (dir !== dirname(dir)) {
699
- if (existsSync(pathJoin(dir, ".serena", "project.yml")))
700
- return dir;
701
- dir = dirname(dir);
702
- }
703
- return process.cwd();
704
- }
705
- let cachedSerenaBin;
706
- function resolveSerenaBin() {
707
- if (cachedSerenaBin !== undefined)
708
- return cachedSerenaBin;
709
- // Find the serena binary from uv's cache directory.
710
- // We avoid `uvx --from git+... which serena` because it triggers a blocking
711
- // git fetch that hangs inside a detached spawn context.
712
- const cacheBase = pathJoin(process.env.HOME ?? "/tmp", ".cache", "uv", "archive-v0");
713
- try {
714
- const entries = readdirSync(cacheBase)
715
- .map((d) => pathJoin(cacheBase, d, "bin", "serena"))
716
- .filter((p) => existsSync(p))
717
- .sort((a, b) => statSync(b).mtimeMs - statSync(a).mtimeMs);
718
- cachedSerenaBin = entries.length > 0 ? entries[0] : null;
719
- }
720
- catch {
721
- cachedSerenaBin = null;
722
- }
723
- return cachedSerenaBin ?? null;
724
- }
725
- function spawnSerenaServer() {
726
- const projectRoot = findSerenaProjectRoot();
727
- const serenaBin = resolveSerenaBin();
728
- if (!serenaBin)
729
- return;
730
- // Spawn the cached Python binary directly with stdio:'ignore' + detached.
731
- // Using 'uvx --from git+...' does NOT work because uvx triggers a blocking
732
- // git fetch that hangs/dies with closed file descriptors.
733
- const child = cpSpawn(serenaBin, ["start-project-server", "--port", String(SERENA_PORT)], {
734
- cwd: projectRoot,
735
- detached: true,
736
- stdio: "ignore",
737
- env: { ...process.env },
738
- });
739
- child.unref();
740
- }
741
- async function ensureSerenaServer() {
742
- if (await isSerenaAlive())
743
- return true;
744
- // Deduplicate concurrent start attempts
745
- if (serenaStarting)
746
- return serenaStarting;
747
- serenaStarting = (async () => {
748
- spawnSerenaServer();
749
- // Poll for readiness (serena can take a few seconds to initialize)
750
- const deadline = Date.now() + 30_000;
751
- const interval = 500;
752
- while (Date.now() < deadline) {
753
- await new Promise((r) => setTimeout(r, interval));
754
- if (await isSerenaAlive()) {
755
- serenaStarting = null;
756
- return true;
757
- }
758
- }
759
- serenaStarting = null;
760
- return false;
761
- })();
762
- return serenaStarting;
763
- }
764
- export async function executeSerena(input, ctx) {
765
- if (ctx.abortSignal?.aborted)
766
- return fail("Operation cancelled");
767
- const toolName = SERENA_TOOL_MAP[input.action];
768
- if (!toolName)
769
- return fail(`Unknown serena action: ${input.action}`);
770
- const isMutation = ["replace_body", "insert_after", "insert_before", "rename"].includes(input.action);
771
- if (isMutation && ctx.confirm) {
772
- const desc = input.action === "rename"
773
- ? `Rename "${input.name_path}" to "${input.new_name}"?`
774
- : `${input.action} on "${input.name_path}"?`;
775
- const ok = await ctx.confirm(desc);
776
- if (!ok)
777
- return fail("Cancelled by user");
778
- }
779
- // Auto-start the Serena project server if not running
780
- const alive = await ensureSerenaServer();
781
- if (!alive) {
782
- return fail("Failed to auto-start Serena project server after 30s. " +
783
- "Check logs or start manually:\n" +
784
- `uvx --from "git+https://github.com/oraios/serena" serena start-project-server --port ${SERENA_PORT}`);
785
- }
786
- const params = { ...input.extra_args };
787
- if (input.name_path) {
788
- if (input.action === "find_symbol") {
789
- params.name_path_pattern = input.name_path;
790
- }
791
- else {
792
- params.name_path = input.name_path;
793
- }
794
- }
795
- if (input.relative_path)
796
- params.relative_path = input.relative_path;
797
- if (input.include_body != null)
798
- params.include_body = input.include_body;
799
- if (input.include_info != null)
800
- params.include_info = input.include_info;
801
- if (input.depth != null)
802
- params.depth = input.depth;
803
- if (input.body)
804
- params.body = input.body;
805
- if (input.new_name)
806
- params.new_name = input.new_name;
807
- if (input.pattern)
808
- params.substring_pattern = input.pattern;
809
- if (input.context_before != null)
810
- params.context_lines_before = input.context_before;
811
- if (input.context_after != null)
812
- params.context_lines_after = input.context_after;
813
- if (input.paths_include)
814
- params.paths_include_glob = input.paths_include;
815
- if (input.paths_exclude)
816
- params.paths_exclude_glob = input.paths_exclude;
817
- try {
818
- const body = JSON.stringify({
819
- project_name: SERENA_PROJECT,
820
- tool_name: toolName,
821
- tool_params_json: JSON.stringify(params),
822
- });
823
- const response = await fetch(`${SERENA_BASE}/query_project`, {
824
- method: "POST",
825
- headers: { "Content-Type": "application/json" },
826
- body,
827
- signal: ctx.abortSignal,
828
- });
829
- if (!response.ok) {
830
- const text = await response.text();
831
- return fail(`serena ${input.action}: HTTP ${response.status} — ${text.slice(0, 200)}`);
832
- }
833
- const text = await response.text();
834
- try {
835
- return success(`serena ${input.action} completed`, JSON.parse(text));
836
- }
837
- catch {
838
- return success(`serena ${input.action} completed`, { raw: text });
839
- }
840
- }
841
- catch (err) {
842
- const e = asExecError(err);
843
- return fail(`serena ${input.action} failed: ${e.message}`);
844
- }
845
- }
846
- // ---------------------------------------------------------------------------
847
- // 8. fff — native CLI (fff-cli binary, zero MCP)
848
- // ---------------------------------------------------------------------------
849
- export async function executeFff(input, ctx) {
850
- if (ctx.abortSignal?.aborted)
851
- return fail("Operation cancelled");
852
- if (!(await hasBinary("fff-cli")))
853
- return fail("fff-cli not installed. Build: cd vendor/fff-cli && cargo build --release && cp target/release/fff-cli ~/.local/bin/");
854
- const args = [input.action];
855
- // Query or patterns. Native fff-cli supports positional query terms; constraints are
856
- // appended as additional terms for grep/find_files and patterns for multi_grep.
857
- if (input.action === "multi_grep" && input.patterns?.length) {
858
- args.push(...input.patterns);
859
- if (input.constraints)
860
- args.push(input.constraints);
861
- }
862
- else {
863
- if (input.query)
864
- args.push(input.query);
865
- if (input.constraints)
866
- args.push(input.constraints);
867
- }
868
- // Path
869
- args.push("--path", input.path ?? ctx.workingDir);
870
- try {
871
- const { stdout } = await shellExec("fff-cli", args, {
872
- cwd: ctx.workingDir,
873
- signal: ctx.abortSignal,
874
- timeout: 30_000,
875
- });
876
- return success(`fff ${input.action} completed`, JSON.parse(stdout));
877
- }
878
- catch (err) {
879
- const e = asExecError(err);
880
- return fail(`fff ${input.action} failed: ${e.stderr || e.message}`);
881
- }
882
- }
883
- //# sourceMappingURL=code-intelligence.js.map