@aria-cli/tools 1.0.8 → 1.0.10

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