@eminent337/aery 0.1.11 → 1.0.0

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 (547) hide show
  1. package/CHANGELOG.md +898 -898
  2. package/README.md +2 -32
  3. package/docs/compaction.md +14 -14
  4. package/docs/custom-provider.md +9 -9
  5. package/docs/development.md +2 -2
  6. package/docs/extensions.md +25 -25
  7. package/docs/json.md +4 -4
  8. package/docs/packages.md +2 -2
  9. package/docs/providers.md +1 -1
  10. package/docs/rpc.md +1 -1
  11. package/docs/sdk.md +22 -22
  12. package/docs/session.md +7 -7
  13. package/docs/termux.md +1 -1
  14. package/docs/themes.md +2 -2
  15. package/docs/tui.md +7 -7
  16. package/examples/extensions/dynamic-resources/dynamic.json +1 -1
  17. package/package.json +5 -5
  18. package/dist/bun/cli.d.ts +0 -3
  19. package/dist/bun/cli.d.ts.map +0 -1
  20. package/dist/bun/cli.js +0 -7
  21. package/dist/bun/cli.js.map +0 -1
  22. package/dist/bun/register-bedrock.d.ts +0 -2
  23. package/dist/bun/register-bedrock.d.ts.map +0 -1
  24. package/dist/bun/register-bedrock.js +0 -4
  25. package/dist/bun/register-bedrock.js.map +0 -1
  26. package/dist/cli/args.d.ts +0 -52
  27. package/dist/cli/args.d.ts.map +0 -1
  28. package/dist/cli/args.js +0 -321
  29. package/dist/cli/args.js.map +0 -1
  30. package/dist/cli/config-selector.d.ts +0 -14
  31. package/dist/cli/config-selector.d.ts.map +0 -1
  32. package/dist/cli/config-selector.js +0 -31
  33. package/dist/cli/config-selector.js.map +0 -1
  34. package/dist/cli/file-processor.d.ts +0 -15
  35. package/dist/cli/file-processor.d.ts.map +0 -1
  36. package/dist/cli/file-processor.js +0 -83
  37. package/dist/cli/file-processor.js.map +0 -1
  38. package/dist/cli/initial-message.d.ts +0 -18
  39. package/dist/cli/initial-message.d.ts.map +0 -1
  40. package/dist/cli/initial-message.js +0 -22
  41. package/dist/cli/initial-message.js.map +0 -1
  42. package/dist/cli/list-models.d.ts +0 -9
  43. package/dist/cli/list-models.d.ts.map +0 -1
  44. package/dist/cli/list-models.js +0 -97
  45. package/dist/cli/list-models.js.map +0 -1
  46. package/dist/cli/session-picker.d.ts +0 -9
  47. package/dist/cli/session-picker.d.ts.map +0 -1
  48. package/dist/cli/session-picker.js +0 -35
  49. package/dist/cli/session-picker.js.map +0 -1
  50. package/dist/cli.d.ts +0 -3
  51. package/dist/cli.d.ts.map +0 -1
  52. package/dist/cli.js +0 -15
  53. package/dist/cli.js.map +0 -1
  54. package/dist/config.d.ts +0 -77
  55. package/dist/config.d.ts.map +0 -1
  56. package/dist/config.js +0 -221
  57. package/dist/config.js.map +0 -1
  58. package/dist/core/agent-session-runtime.d.ts +0 -99
  59. package/dist/core/agent-session-runtime.d.ts.map +0 -1
  60. package/dist/core/agent-session-runtime.js +0 -261
  61. package/dist/core/agent-session-runtime.js.map +0 -1
  62. package/dist/core/agent-session-services.d.ts +0 -85
  63. package/dist/core/agent-session-services.d.ts.map +0 -1
  64. package/dist/core/agent-session-services.js +0 -116
  65. package/dist/core/agent-session-services.js.map +0 -1
  66. package/dist/core/agent-session.d.ts +0 -590
  67. package/dist/core/agent-session.d.ts.map +0 -1
  68. package/dist/core/agent-session.js +0 -2505
  69. package/dist/core/agent-session.js.map +0 -1
  70. package/dist/core/auth-storage.d.ts +0 -132
  71. package/dist/core/auth-storage.d.ts.map +0 -1
  72. package/dist/core/auth-storage.js +0 -422
  73. package/dist/core/auth-storage.js.map +0 -1
  74. package/dist/core/bash-executor.d.ts +0 -32
  75. package/dist/core/bash-executor.d.ts.map +0 -1
  76. package/dist/core/bash-executor.js +0 -108
  77. package/dist/core/bash-executor.js.map +0 -1
  78. package/dist/core/compaction/branch-summarization.d.ts +0 -88
  79. package/dist/core/compaction/branch-summarization.d.ts.map +0 -1
  80. package/dist/core/compaction/branch-summarization.js +0 -243
  81. package/dist/core/compaction/branch-summarization.js.map +0 -1
  82. package/dist/core/compaction/compaction.d.ts +0 -121
  83. package/dist/core/compaction/compaction.d.ts.map +0 -1
  84. package/dist/core/compaction/compaction.js +0 -615
  85. package/dist/core/compaction/compaction.js.map +0 -1
  86. package/dist/core/compaction/index.d.ts +0 -7
  87. package/dist/core/compaction/index.d.ts.map +0 -1
  88. package/dist/core/compaction/index.js +0 -7
  89. package/dist/core/compaction/index.js.map +0 -1
  90. package/dist/core/compaction/utils.d.ts +0 -38
  91. package/dist/core/compaction/utils.d.ts.map +0 -1
  92. package/dist/core/compaction/utils.js +0 -153
  93. package/dist/core/compaction/utils.js.map +0 -1
  94. package/dist/core/defaults.d.ts +0 -3
  95. package/dist/core/defaults.d.ts.map +0 -1
  96. package/dist/core/defaults.js +0 -2
  97. package/dist/core/defaults.js.map +0 -1
  98. package/dist/core/diagnostics.d.ts +0 -15
  99. package/dist/core/diagnostics.d.ts.map +0 -1
  100. package/dist/core/diagnostics.js +0 -2
  101. package/dist/core/diagnostics.js.map +0 -1
  102. package/dist/core/event-bus.d.ts +0 -9
  103. package/dist/core/event-bus.d.ts.map +0 -1
  104. package/dist/core/event-bus.js +0 -25
  105. package/dist/core/event-bus.js.map +0 -1
  106. package/dist/core/exec.d.ts +0 -29
  107. package/dist/core/exec.d.ts.map +0 -1
  108. package/dist/core/exec.js +0 -75
  109. package/dist/core/exec.js.map +0 -1
  110. package/dist/core/export-html/ansi-to-html.d.ts +0 -22
  111. package/dist/core/export-html/ansi-to-html.d.ts.map +0 -1
  112. package/dist/core/export-html/ansi-to-html.js +0 -249
  113. package/dist/core/export-html/ansi-to-html.js.map +0 -1
  114. package/dist/core/export-html/index.d.ts +0 -37
  115. package/dist/core/export-html/index.d.ts.map +0 -1
  116. package/dist/core/export-html/index.js +0 -224
  117. package/dist/core/export-html/index.js.map +0 -1
  118. package/dist/core/export-html/template.css +0 -1017
  119. package/dist/core/export-html/template.html +0 -55
  120. package/dist/core/export-html/template.js +0 -1729
  121. package/dist/core/export-html/tool-renderer.d.ts +0 -40
  122. package/dist/core/export-html/tool-renderer.d.ts.map +0 -1
  123. package/dist/core/export-html/tool-renderer.js +0 -95
  124. package/dist/core/export-html/tool-renderer.js.map +0 -1
  125. package/dist/core/export-html/vendor/highlight.min.js +0 -1213
  126. package/dist/core/export-html/vendor/marked.min.js +0 -6
  127. package/dist/core/extensions/index.d.ts +0 -12
  128. package/dist/core/extensions/index.d.ts.map +0 -1
  129. package/dist/core/extensions/index.js +0 -9
  130. package/dist/core/extensions/index.js.map +0 -1
  131. package/dist/core/extensions/loader.d.ts +0 -25
  132. package/dist/core/extensions/loader.d.ts.map +0 -1
  133. package/dist/core/extensions/loader.js +0 -436
  134. package/dist/core/extensions/loader.js.map +0 -1
  135. package/dist/core/extensions/runner.d.ts +0 -150
  136. package/dist/core/extensions/runner.d.ts.map +0 -1
  137. package/dist/core/extensions/runner.js +0 -706
  138. package/dist/core/extensions/runner.js.map +0 -1
  139. package/dist/core/extensions/types.d.ts +0 -1111
  140. package/dist/core/extensions/types.d.ts.map +0 -1
  141. package/dist/core/extensions/types.js +0 -45
  142. package/dist/core/extensions/types.js.map +0 -1
  143. package/dist/core/extensions/wrapper.d.ts +0 -20
  144. package/dist/core/extensions/wrapper.d.ts.map +0 -1
  145. package/dist/core/extensions/wrapper.js +0 -22
  146. package/dist/core/extensions/wrapper.js.map +0 -1
  147. package/dist/core/footer-data-provider.d.ts +0 -48
  148. package/dist/core/footer-data-provider.d.ts.map +0 -1
  149. package/dist/core/footer-data-provider.js +0 -314
  150. package/dist/core/footer-data-provider.js.map +0 -1
  151. package/dist/core/index.d.ts +0 -12
  152. package/dist/core/index.d.ts.map +0 -1
  153. package/dist/core/index.js +0 -12
  154. package/dist/core/index.js.map +0 -1
  155. package/dist/core/keybindings.d.ts +0 -353
  156. package/dist/core/keybindings.d.ts.map +0 -1
  157. package/dist/core/keybindings.js +0 -295
  158. package/dist/core/keybindings.js.map +0 -1
  159. package/dist/core/messages.d.ts +0 -77
  160. package/dist/core/messages.d.ts.map +0 -1
  161. package/dist/core/messages.js +0 -123
  162. package/dist/core/messages.js.map +0 -1
  163. package/dist/core/model-registry.d.ts +0 -132
  164. package/dist/core/model-registry.d.ts.map +0 -1
  165. package/dist/core/model-registry.js +0 -635
  166. package/dist/core/model-registry.js.map +0 -1
  167. package/dist/core/model-resolver.d.ts +0 -110
  168. package/dist/core/model-resolver.d.ts.map +0 -1
  169. package/dist/core/model-resolver.js +0 -486
  170. package/dist/core/model-resolver.js.map +0 -1
  171. package/dist/core/output-guard.d.ts +0 -6
  172. package/dist/core/output-guard.d.ts.map +0 -1
  173. package/dist/core/output-guard.js +0 -59
  174. package/dist/core/output-guard.js.map +0 -1
  175. package/dist/core/package-manager.d.ts +0 -194
  176. package/dist/core/package-manager.d.ts.map +0 -1
  177. package/dist/core/package-manager.js +0 -1882
  178. package/dist/core/package-manager.js.map +0 -1
  179. package/dist/core/prompt-templates.d.ts +0 -52
  180. package/dist/core/prompt-templates.d.ts.map +0 -1
  181. package/dist/core/prompt-templates.js +0 -250
  182. package/dist/core/prompt-templates.js.map +0 -1
  183. package/dist/core/resolve-config-value.d.ts +0 -23
  184. package/dist/core/resolve-config-value.d.ts.map +0 -1
  185. package/dist/core/resolve-config-value.js +0 -126
  186. package/dist/core/resolve-config-value.js.map +0 -1
  187. package/dist/core/resource-loader.d.ts +0 -194
  188. package/dist/core/resource-loader.d.ts.map +0 -1
  189. package/dist/core/resource-loader.js +0 -726
  190. package/dist/core/resource-loader.js.map +0 -1
  191. package/dist/core/sdk.d.ts +0 -99
  192. package/dist/core/sdk.d.ts.map +0 -1
  193. package/dist/core/sdk.js +0 -261
  194. package/dist/core/sdk.js.map +0 -1
  195. package/dist/core/session-cwd.d.ts +0 -19
  196. package/dist/core/session-cwd.d.ts.map +0 -1
  197. package/dist/core/session-cwd.js +0 -38
  198. package/dist/core/session-cwd.js.map +0 -1
  199. package/dist/core/session-manager.d.ts +0 -333
  200. package/dist/core/session-manager.d.ts.map +0 -1
  201. package/dist/core/session-manager.js +0 -1109
  202. package/dist/core/session-manager.js.map +0 -1
  203. package/dist/core/settings-manager.d.ts +0 -240
  204. package/dist/core/settings-manager.d.ts.map +0 -1
  205. package/dist/core/settings-manager.js +0 -711
  206. package/dist/core/settings-manager.js.map +0 -1
  207. package/dist/core/skills.d.ts +0 -60
  208. package/dist/core/skills.d.ts.map +0 -1
  209. package/dist/core/skills.js +0 -409
  210. package/dist/core/skills.js.map +0 -1
  211. package/dist/core/slash-commands.d.ts +0 -14
  212. package/dist/core/slash-commands.d.ts.map +0 -1
  213. package/dist/core/slash-commands.js +0 -24
  214. package/dist/core/slash-commands.js.map +0 -1
  215. package/dist/core/source-info.d.ts +0 -18
  216. package/dist/core/source-info.d.ts.map +0 -1
  217. package/dist/core/source-info.js +0 -19
  218. package/dist/core/source-info.js.map +0 -1
  219. package/dist/core/system-prompt.d.ts +0 -28
  220. package/dist/core/system-prompt.d.ts.map +0 -1
  221. package/dist/core/system-prompt.js +0 -120
  222. package/dist/core/system-prompt.js.map +0 -1
  223. package/dist/core/telemetry.d.ts +0 -3
  224. package/dist/core/telemetry.d.ts.map +0 -1
  225. package/dist/core/telemetry.js +0 -9
  226. package/dist/core/telemetry.js.map +0 -1
  227. package/dist/core/timings.d.ts +0 -8
  228. package/dist/core/timings.d.ts.map +0 -1
  229. package/dist/core/timings.js +0 -31
  230. package/dist/core/timings.js.map +0 -1
  231. package/dist/core/tools/bash.d.ts +0 -64
  232. package/dist/core/tools/bash.d.ts.map +0 -1
  233. package/dist/core/tools/bash.js +0 -355
  234. package/dist/core/tools/bash.js.map +0 -1
  235. package/dist/core/tools/edit-diff.d.ts +0 -85
  236. package/dist/core/tools/edit-diff.d.ts.map +0 -1
  237. package/dist/core/tools/edit-diff.js +0 -337
  238. package/dist/core/tools/edit-diff.js.map +0 -1
  239. package/dist/core/tools/edit.d.ts +0 -49
  240. package/dist/core/tools/edit.d.ts.map +0 -1
  241. package/dist/core/tools/edit.js +0 -323
  242. package/dist/core/tools/edit.js.map +0 -1
  243. package/dist/core/tools/file-mutation-queue.d.ts +0 -6
  244. package/dist/core/tools/file-mutation-queue.d.ts.map +0 -1
  245. package/dist/core/tools/file-mutation-queue.js +0 -37
  246. package/dist/core/tools/file-mutation-queue.js.map +0 -1
  247. package/dist/core/tools/find.d.ts +0 -35
  248. package/dist/core/tools/find.d.ts.map +0 -1
  249. package/dist/core/tools/find.js +0 -298
  250. package/dist/core/tools/find.js.map +0 -1
  251. package/dist/core/tools/grep.d.ts +0 -37
  252. package/dist/core/tools/grep.d.ts.map +0 -1
  253. package/dist/core/tools/grep.js +0 -304
  254. package/dist/core/tools/grep.js.map +0 -1
  255. package/dist/core/tools/index.d.ts +0 -40
  256. package/dist/core/tools/index.d.ts.map +0 -1
  257. package/dist/core/tools/index.js +0 -112
  258. package/dist/core/tools/index.js.map +0 -1
  259. package/dist/core/tools/ls.d.ts +0 -37
  260. package/dist/core/tools/ls.d.ts.map +0 -1
  261. package/dist/core/tools/ls.js +0 -169
  262. package/dist/core/tools/ls.js.map +0 -1
  263. package/dist/core/tools/path-utils.d.ts +0 -8
  264. package/dist/core/tools/path-utils.d.ts.map +0 -1
  265. package/dist/core/tools/path-utils.js +0 -81
  266. package/dist/core/tools/path-utils.js.map +0 -1
  267. package/dist/core/tools/read.d.ts +0 -35
  268. package/dist/core/tools/read.d.ts.map +0 -1
  269. package/dist/core/tools/read.js +0 -232
  270. package/dist/core/tools/read.js.map +0 -1
  271. package/dist/core/tools/render-utils.d.ts +0 -21
  272. package/dist/core/tools/render-utils.d.ts.map +0 -1
  273. package/dist/core/tools/render-utils.js +0 -49
  274. package/dist/core/tools/render-utils.js.map +0 -1
  275. package/dist/core/tools/tool-definition-wrapper.d.ts +0 -14
  276. package/dist/core/tools/tool-definition-wrapper.d.ts.map +0 -1
  277. package/dist/core/tools/tool-definition-wrapper.js +0 -34
  278. package/dist/core/tools/tool-definition-wrapper.js.map +0 -1
  279. package/dist/core/tools/truncate.d.ts +0 -70
  280. package/dist/core/tools/truncate.d.ts.map +0 -1
  281. package/dist/core/tools/truncate.js +0 -205
  282. package/dist/core/tools/truncate.js.map +0 -1
  283. package/dist/core/tools/write.d.ts +0 -26
  284. package/dist/core/tools/write.d.ts.map +0 -1
  285. package/dist/core/tools/write.js +0 -213
  286. package/dist/core/tools/write.js.map +0 -1
  287. package/dist/index.d.ts +0 -28
  288. package/dist/index.d.ts.map +0 -1
  289. package/dist/index.js +0 -41
  290. package/dist/index.js.map +0 -1
  291. package/dist/main.d.ts +0 -12
  292. package/dist/main.d.ts.map +0 -1
  293. package/dist/main.js +0 -589
  294. package/dist/main.js.map +0 -1
  295. package/dist/migrations.d.ts +0 -33
  296. package/dist/migrations.d.ts.map +0 -1
  297. package/dist/migrations.js +0 -281
  298. package/dist/migrations.js.map +0 -1
  299. package/dist/modes/index.d.ts +0 -9
  300. package/dist/modes/index.d.ts.map +0 -1
  301. package/dist/modes/index.js +0 -8
  302. package/dist/modes/index.js.map +0 -1
  303. package/dist/modes/interactive/assets/clankolas.png +0 -0
  304. package/dist/modes/interactive/components/armin.d.ts +0 -34
  305. package/dist/modes/interactive/components/armin.d.ts.map +0 -1
  306. package/dist/modes/interactive/components/armin.js +0 -333
  307. package/dist/modes/interactive/components/armin.js.map +0 -1
  308. package/dist/modes/interactive/components/assistant-message.d.ts +0 -20
  309. package/dist/modes/interactive/components/assistant-message.d.ts.map +0 -1
  310. package/dist/modes/interactive/components/assistant-message.js +0 -121
  311. package/dist/modes/interactive/components/assistant-message.js.map +0 -1
  312. package/dist/modes/interactive/components/bash-execution.d.ts +0 -34
  313. package/dist/modes/interactive/components/bash-execution.d.ts.map +0 -1
  314. package/dist/modes/interactive/components/bash-execution.js +0 -175
  315. package/dist/modes/interactive/components/bash-execution.js.map +0 -1
  316. package/dist/modes/interactive/components/bordered-loader.d.ts +0 -16
  317. package/dist/modes/interactive/components/bordered-loader.d.ts.map +0 -1
  318. package/dist/modes/interactive/components/bordered-loader.js +0 -54
  319. package/dist/modes/interactive/components/bordered-loader.js.map +0 -1
  320. package/dist/modes/interactive/components/branch-summary-message.d.ts +0 -16
  321. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +0 -1
  322. package/dist/modes/interactive/components/branch-summary-message.js +0 -44
  323. package/dist/modes/interactive/components/branch-summary-message.js.map +0 -1
  324. package/dist/modes/interactive/components/compaction-summary-message.d.ts +0 -16
  325. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +0 -1
  326. package/dist/modes/interactive/components/compaction-summary-message.js +0 -45
  327. package/dist/modes/interactive/components/compaction-summary-message.js.map +0 -1
  328. package/dist/modes/interactive/components/config-selector.d.ts +0 -71
  329. package/dist/modes/interactive/components/config-selector.d.ts.map +0 -1
  330. package/dist/modes/interactive/components/config-selector.js +0 -479
  331. package/dist/modes/interactive/components/config-selector.js.map +0 -1
  332. package/dist/modes/interactive/components/countdown-timer.d.ts +0 -14
  333. package/dist/modes/interactive/components/countdown-timer.d.ts.map +0 -1
  334. package/dist/modes/interactive/components/countdown-timer.js +0 -33
  335. package/dist/modes/interactive/components/countdown-timer.js.map +0 -1
  336. package/dist/modes/interactive/components/custom-editor.d.ts +0 -21
  337. package/dist/modes/interactive/components/custom-editor.d.ts.map +0 -1
  338. package/dist/modes/interactive/components/custom-editor.js +0 -70
  339. package/dist/modes/interactive/components/custom-editor.js.map +0 -1
  340. package/dist/modes/interactive/components/custom-message.d.ts +0 -20
  341. package/dist/modes/interactive/components/custom-message.d.ts.map +0 -1
  342. package/dist/modes/interactive/components/custom-message.js +0 -79
  343. package/dist/modes/interactive/components/custom-message.js.map +0 -1
  344. package/dist/modes/interactive/components/daxnuts.d.ts +0 -23
  345. package/dist/modes/interactive/components/daxnuts.d.ts.map +0 -1
  346. package/dist/modes/interactive/components/daxnuts.js +0 -140
  347. package/dist/modes/interactive/components/daxnuts.js.map +0 -1
  348. package/dist/modes/interactive/components/diff.d.ts +0 -12
  349. package/dist/modes/interactive/components/diff.d.ts.map +0 -1
  350. package/dist/modes/interactive/components/diff.js +0 -133
  351. package/dist/modes/interactive/components/diff.js.map +0 -1
  352. package/dist/modes/interactive/components/dynamic-border.d.ts +0 -15
  353. package/dist/modes/interactive/components/dynamic-border.d.ts.map +0 -1
  354. package/dist/modes/interactive/components/dynamic-border.js +0 -21
  355. package/dist/modes/interactive/components/dynamic-border.js.map +0 -1
  356. package/dist/modes/interactive/components/earendil-announcement.d.ts +0 -5
  357. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +0 -1
  358. package/dist/modes/interactive/components/earendil-announcement.js +0 -40
  359. package/dist/modes/interactive/components/earendil-announcement.js.map +0 -1
  360. package/dist/modes/interactive/components/extension-editor.d.ts +0 -20
  361. package/dist/modes/interactive/components/extension-editor.d.ts.map +0 -1
  362. package/dist/modes/interactive/components/extension-editor.js +0 -111
  363. package/dist/modes/interactive/components/extension-editor.js.map +0 -1
  364. package/dist/modes/interactive/components/extension-input.d.ts +0 -23
  365. package/dist/modes/interactive/components/extension-input.d.ts.map +0 -1
  366. package/dist/modes/interactive/components/extension-input.js +0 -61
  367. package/dist/modes/interactive/components/extension-input.js.map +0 -1
  368. package/dist/modes/interactive/components/extension-selector.d.ts +0 -24
  369. package/dist/modes/interactive/components/extension-selector.d.ts.map +0 -1
  370. package/dist/modes/interactive/components/extension-selector.js +0 -78
  371. package/dist/modes/interactive/components/extension-selector.js.map +0 -1
  372. package/dist/modes/interactive/components/footer.d.ts +0 -27
  373. package/dist/modes/interactive/components/footer.d.ts.map +0 -1
  374. package/dist/modes/interactive/components/footer.js +0 -201
  375. package/dist/modes/interactive/components/footer.js.map +0 -1
  376. package/dist/modes/interactive/components/index.d.ts +0 -32
  377. package/dist/modes/interactive/components/index.d.ts.map +0 -1
  378. package/dist/modes/interactive/components/index.js +0 -33
  379. package/dist/modes/interactive/components/index.js.map +0 -1
  380. package/dist/modes/interactive/components/keybinding-hints.d.ts +0 -8
  381. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +0 -1
  382. package/dist/modes/interactive/components/keybinding-hints.js +0 -22
  383. package/dist/modes/interactive/components/keybinding-hints.js.map +0 -1
  384. package/dist/modes/interactive/components/login-dialog.d.ts +0 -42
  385. package/dist/modes/interactive/components/login-dialog.d.ts.map +0 -1
  386. package/dist/modes/interactive/components/login-dialog.js +0 -145
  387. package/dist/modes/interactive/components/login-dialog.js.map +0 -1
  388. package/dist/modes/interactive/components/model-selector.d.ts +0 -47
  389. package/dist/modes/interactive/components/model-selector.d.ts.map +0 -1
  390. package/dist/modes/interactive/components/model-selector.js +0 -278
  391. package/dist/modes/interactive/components/model-selector.js.map +0 -1
  392. package/dist/modes/interactive/components/oauth-selector.d.ts +0 -19
  393. package/dist/modes/interactive/components/oauth-selector.d.ts.map +0 -1
  394. package/dist/modes/interactive/components/oauth-selector.js +0 -97
  395. package/dist/modes/interactive/components/oauth-selector.js.map +0 -1
  396. package/dist/modes/interactive/components/scoped-models-selector.d.ts +0 -42
  397. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +0 -1
  398. package/dist/modes/interactive/components/scoped-models-selector.js +0 -290
  399. package/dist/modes/interactive/components/scoped-models-selector.js.map +0 -1
  400. package/dist/modes/interactive/components/session-selector-search.d.ts +0 -23
  401. package/dist/modes/interactive/components/session-selector-search.d.ts.map +0 -1
  402. package/dist/modes/interactive/components/session-selector-search.js +0 -155
  403. package/dist/modes/interactive/components/session-selector-search.js.map +0 -1
  404. package/dist/modes/interactive/components/session-selector.d.ts +0 -96
  405. package/dist/modes/interactive/components/session-selector.d.ts.map +0 -1
  406. package/dist/modes/interactive/components/session-selector.js +0 -865
  407. package/dist/modes/interactive/components/session-selector.js.map +0 -1
  408. package/dist/modes/interactive/components/settings-selector.d.ts +0 -60
  409. package/dist/modes/interactive/components/settings-selector.d.ts.map +0 -1
  410. package/dist/modes/interactive/components/settings-selector.js +0 -311
  411. package/dist/modes/interactive/components/settings-selector.js.map +0 -1
  412. package/dist/modes/interactive/components/show-images-selector.d.ts +0 -10
  413. package/dist/modes/interactive/components/show-images-selector.d.ts.map +0 -1
  414. package/dist/modes/interactive/components/show-images-selector.js +0 -39
  415. package/dist/modes/interactive/components/show-images-selector.js.map +0 -1
  416. package/dist/modes/interactive/components/skill-invocation-message.d.ts +0 -17
  417. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +0 -1
  418. package/dist/modes/interactive/components/skill-invocation-message.js +0 -47
  419. package/dist/modes/interactive/components/skill-invocation-message.js.map +0 -1
  420. package/dist/modes/interactive/components/theme-selector.d.ts +0 -11
  421. package/dist/modes/interactive/components/theme-selector.d.ts.map +0 -1
  422. package/dist/modes/interactive/components/theme-selector.js +0 -50
  423. package/dist/modes/interactive/components/theme-selector.js.map +0 -1
  424. package/dist/modes/interactive/components/thinking-selector.d.ts +0 -11
  425. package/dist/modes/interactive/components/thinking-selector.d.ts.map +0 -1
  426. package/dist/modes/interactive/components/thinking-selector.js +0 -51
  427. package/dist/modes/interactive/components/thinking-selector.js.map +0 -1
  428. package/dist/modes/interactive/components/tool-execution.d.ts +0 -60
  429. package/dist/modes/interactive/components/tool-execution.d.ts.map +0 -1
  430. package/dist/modes/interactive/components/tool-execution.js +0 -289
  431. package/dist/modes/interactive/components/tool-execution.js.map +0 -1
  432. package/dist/modes/interactive/components/tree-selector.d.ts +0 -89
  433. package/dist/modes/interactive/components/tree-selector.d.ts.map +0 -1
  434. package/dist/modes/interactive/components/tree-selector.js +0 -1092
  435. package/dist/modes/interactive/components/tree-selector.js.map +0 -1
  436. package/dist/modes/interactive/components/user-message-selector.d.ts +0 -30
  437. package/dist/modes/interactive/components/user-message-selector.d.ts.map +0 -1
  438. package/dist/modes/interactive/components/user-message-selector.js +0 -114
  439. package/dist/modes/interactive/components/user-message-selector.js.map +0 -1
  440. package/dist/modes/interactive/components/user-message.d.ts +0 -10
  441. package/dist/modes/interactive/components/user-message.d.ts.map +0 -1
  442. package/dist/modes/interactive/components/user-message.js +0 -29
  443. package/dist/modes/interactive/components/user-message.js.map +0 -1
  444. package/dist/modes/interactive/components/visual-truncate.d.ts +0 -24
  445. package/dist/modes/interactive/components/visual-truncate.d.ts.map +0 -1
  446. package/dist/modes/interactive/components/visual-truncate.js +0 -33
  447. package/dist/modes/interactive/components/visual-truncate.js.map +0 -1
  448. package/dist/modes/interactive/interactive-mode.d.ts +0 -343
  449. package/dist/modes/interactive/interactive-mode.d.ts.map +0 -1
  450. package/dist/modes/interactive/interactive-mode.js +0 -4315
  451. package/dist/modes/interactive/interactive-mode.js.map +0 -1
  452. package/dist/modes/interactive/theme/aery.json +0 -84
  453. package/dist/modes/interactive/theme/dark.json +0 -85
  454. package/dist/modes/interactive/theme/light.json +0 -84
  455. package/dist/modes/interactive/theme/theme-schema.json +0 -335
  456. package/dist/modes/interactive/theme/theme.d.ts +0 -81
  457. package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
  458. package/dist/modes/interactive/theme/theme.js +0 -979
  459. package/dist/modes/interactive/theme/theme.js.map +0 -1
  460. package/dist/modes/print-mode.d.ts +0 -28
  461. package/dist/modes/print-mode.d.ts.map +0 -1
  462. package/dist/modes/print-mode.js +0 -141
  463. package/dist/modes/print-mode.js.map +0 -1
  464. package/dist/modes/rpc/jsonl.d.ts +0 -17
  465. package/dist/modes/rpc/jsonl.d.ts.map +0 -1
  466. package/dist/modes/rpc/jsonl.js +0 -49
  467. package/dist/modes/rpc/jsonl.js.map +0 -1
  468. package/dist/modes/rpc/rpc-client.d.ts +0 -224
  469. package/dist/modes/rpc/rpc-client.d.ts.map +0 -1
  470. package/dist/modes/rpc/rpc-client.js +0 -410
  471. package/dist/modes/rpc/rpc-client.js.map +0 -1
  472. package/dist/modes/rpc/rpc-mode.d.ts +0 -20
  473. package/dist/modes/rpc/rpc-mode.d.ts.map +0 -1
  474. package/dist/modes/rpc/rpc-mode.js +0 -601
  475. package/dist/modes/rpc/rpc-mode.js.map +0 -1
  476. package/dist/modes/rpc/rpc-types.d.ts +0 -419
  477. package/dist/modes/rpc/rpc-types.d.ts.map +0 -1
  478. package/dist/modes/rpc/rpc-types.js +0 -8
  479. package/dist/modes/rpc/rpc-types.js.map +0 -1
  480. package/dist/package-manager-cli.d.ts +0 -4
  481. package/dist/package-manager-cli.d.ts.map +0 -1
  482. package/dist/package-manager-cli.js +0 -234
  483. package/dist/package-manager-cli.js.map +0 -1
  484. package/dist/utils/changelog.d.ts +0 -21
  485. package/dist/utils/changelog.d.ts.map +0 -1
  486. package/dist/utils/changelog.js +0 -87
  487. package/dist/utils/changelog.js.map +0 -1
  488. package/dist/utils/child-process.d.ts +0 -11
  489. package/dist/utils/child-process.d.ts.map +0 -1
  490. package/dist/utils/child-process.js +0 -78
  491. package/dist/utils/child-process.js.map +0 -1
  492. package/dist/utils/clipboard-image.d.ts +0 -11
  493. package/dist/utils/clipboard-image.d.ts.map +0 -1
  494. package/dist/utils/clipboard-image.js +0 -245
  495. package/dist/utils/clipboard-image.js.map +0 -1
  496. package/dist/utils/clipboard-native.d.ts +0 -8
  497. package/dist/utils/clipboard-native.d.ts.map +0 -1
  498. package/dist/utils/clipboard-native.js +0 -14
  499. package/dist/utils/clipboard-native.js.map +0 -1
  500. package/dist/utils/clipboard.d.ts +0 -2
  501. package/dist/utils/clipboard.d.ts.map +0 -1
  502. package/dist/utils/clipboard.js +0 -78
  503. package/dist/utils/clipboard.js.map +0 -1
  504. package/dist/utils/exif-orientation.d.ts +0 -5
  505. package/dist/utils/exif-orientation.d.ts.map +0 -1
  506. package/dist/utils/exif-orientation.js +0 -158
  507. package/dist/utils/exif-orientation.js.map +0 -1
  508. package/dist/utils/frontmatter.d.ts +0 -8
  509. package/dist/utils/frontmatter.d.ts.map +0 -1
  510. package/dist/utils/frontmatter.js +0 -26
  511. package/dist/utils/frontmatter.js.map +0 -1
  512. package/dist/utils/git.d.ts +0 -26
  513. package/dist/utils/git.d.ts.map +0 -1
  514. package/dist/utils/git.js +0 -163
  515. package/dist/utils/git.js.map +0 -1
  516. package/dist/utils/image-convert.d.ts +0 -9
  517. package/dist/utils/image-convert.d.ts.map +0 -1
  518. package/dist/utils/image-convert.js +0 -39
  519. package/dist/utils/image-convert.js.map +0 -1
  520. package/dist/utils/image-resize.d.ts +0 -36
  521. package/dist/utils/image-resize.d.ts.map +0 -1
  522. package/dist/utils/image-resize.js +0 -137
  523. package/dist/utils/image-resize.js.map +0 -1
  524. package/dist/utils/mime.d.ts +0 -2
  525. package/dist/utils/mime.d.ts.map +0 -1
  526. package/dist/utils/mime.js +0 -26
  527. package/dist/utils/mime.js.map +0 -1
  528. package/dist/utils/paths.d.ts +0 -7
  529. package/dist/utils/paths.d.ts.map +0 -1
  530. package/dist/utils/paths.js +0 -19
  531. package/dist/utils/paths.js.map +0 -1
  532. package/dist/utils/photon.d.ts +0 -21
  533. package/dist/utils/photon.d.ts.map +0 -1
  534. package/dist/utils/photon.js +0 -121
  535. package/dist/utils/photon.js.map +0 -1
  536. package/dist/utils/shell.d.ts +0 -29
  537. package/dist/utils/shell.d.ts.map +0 -1
  538. package/dist/utils/shell.js +0 -203
  539. package/dist/utils/shell.js.map +0 -1
  540. package/dist/utils/sleep.d.ts +0 -5
  541. package/dist/utils/sleep.d.ts.map +0 -1
  542. package/dist/utils/sleep.js +0 -17
  543. package/dist/utils/sleep.js.map +0 -1
  544. package/dist/utils/tools-manager.d.ts +0 -3
  545. package/dist/utils/tools-manager.d.ts.map +0 -1
  546. package/dist/utils/tools-manager.js +0 -252
  547. package/dist/utils/tools-manager.js.map +0 -1
@@ -1,304 +0,0 @@
1
- import { createInterface } from "node:readline";
2
- import { Text } from "@aryee/aery-tui";
3
- import { Type } from "@sinclair/typebox";
4
- import { spawn } from "child_process";
5
- import { readFileSync, statSync } from "fs";
6
- import path from "path";
7
- import { keyHint } from "../../modes/interactive/components/keybinding-hints.js";
8
- import { ensureTool } from "../../utils/tools-manager.js";
9
- import { resolveToCwd } from "./path-utils.js";
10
- import { getTextOutput, invalidArgText, shortenPath, str } from "./render-utils.js";
11
- import { wrapToolDefinition } from "./tool-definition-wrapper.js";
12
- import { DEFAULT_MAX_BYTES, formatSize, GREP_MAX_LINE_LENGTH, truncateHead, truncateLine, } from "./truncate.js";
13
- const grepSchema = Type.Object({
14
- pattern: Type.String({ description: "Search pattern (regex or literal string)" }),
15
- path: Type.Optional(Type.String({ description: "Directory or file to search (default: current directory)" })),
16
- glob: Type.Optional(Type.String({ description: "Filter files by glob pattern, e.g. '*.ts' or '**/*.spec.ts'" })),
17
- ignoreCase: Type.Optional(Type.Boolean({ description: "Case-insensitive search (default: false)" })),
18
- literal: Type.Optional(Type.Boolean({ description: "Treat pattern as literal string instead of regex (default: false)" })),
19
- context: Type.Optional(Type.Number({ description: "Number of lines to show before and after each match (default: 0)" })),
20
- limit: Type.Optional(Type.Number({ description: "Maximum number of matches to return (default: 100)" })),
21
- });
22
- const DEFAULT_LIMIT = 100;
23
- const defaultGrepOperations = {
24
- isDirectory: (p) => statSync(p).isDirectory(),
25
- readFile: (p) => readFileSync(p, "utf-8"),
26
- };
27
- function formatGrepCall(args, theme) {
28
- const pattern = str(args?.pattern);
29
- const rawPath = str(args?.path);
30
- const path = rawPath !== null ? shortenPath(rawPath || ".") : null;
31
- const glob = str(args?.glob);
32
- const limit = args?.limit;
33
- const invalidArg = invalidArgText(theme);
34
- let text = theme.fg("toolTitle", theme.bold("grep")) +
35
- " " +
36
- (pattern === null ? invalidArg : theme.fg("accent", `/${pattern || ""}/`)) +
37
- theme.fg("toolOutput", ` in ${path === null ? invalidArg : path}`);
38
- if (glob)
39
- text += theme.fg("toolOutput", ` (${glob})`);
40
- if (limit !== undefined)
41
- text += theme.fg("toolOutput", ` limit ${limit}`);
42
- return text;
43
- }
44
- function formatGrepResult(result, options, theme, showImages) {
45
- const output = getTextOutput(result, showImages).trim();
46
- let text = "";
47
- if (output) {
48
- const lines = output.split("\n");
49
- const maxLines = options.expanded ? lines.length : 15;
50
- const displayLines = lines.slice(0, maxLines);
51
- const remaining = lines.length - maxLines;
52
- text += `\n${displayLines.map((line) => theme.fg("toolOutput", line)).join("\n")}`;
53
- if (remaining > 0) {
54
- text += `${theme.fg("muted", `\n... (${remaining} more lines,`)} ${keyHint("app.tools.expand", "to expand")})`;
55
- }
56
- }
57
- const matchLimit = result.details?.matchLimitReached;
58
- const truncation = result.details?.truncation;
59
- const linesTruncated = result.details?.linesTruncated;
60
- if (matchLimit || truncation?.truncated || linesTruncated) {
61
- const warnings = [];
62
- if (matchLimit)
63
- warnings.push(`${matchLimit} matches limit`);
64
- if (truncation?.truncated)
65
- warnings.push(`${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit`);
66
- if (linesTruncated)
67
- warnings.push("some lines truncated");
68
- text += `\n${theme.fg("warning", `[Truncated: ${warnings.join(", ")}]`)}`;
69
- }
70
- return text;
71
- }
72
- export function createGrepToolDefinition(cwd, options) {
73
- const customOps = options?.operations;
74
- return {
75
- name: "grep",
76
- label: "grep",
77
- description: `Search file contents for a pattern. Returns matching lines with file paths and line numbers. Respects .gitignore. Output is truncated to ${DEFAULT_LIMIT} matches or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first). Long lines are truncated to ${GREP_MAX_LINE_LENGTH} chars.`,
78
- promptSnippet: "Search file contents for patterns (respects .gitignore)",
79
- parameters: grepSchema,
80
- async execute(_toolCallId, { pattern, path: searchDir, glob, ignoreCase, literal, context, limit, }, signal, _onUpdate, _ctx) {
81
- return new Promise((resolve, reject) => {
82
- if (signal?.aborted) {
83
- reject(new Error("Operation aborted"));
84
- return;
85
- }
86
- let settled = false;
87
- const settle = (fn) => {
88
- if (!settled) {
89
- settled = true;
90
- fn();
91
- }
92
- };
93
- (async () => {
94
- try {
95
- const rgPath = await ensureTool("rg", true);
96
- if (!rgPath) {
97
- settle(() => reject(new Error("ripgrep (rg) is not available and could not be downloaded")));
98
- return;
99
- }
100
- const searchPath = resolveToCwd(searchDir || ".", cwd);
101
- const ops = customOps ?? defaultGrepOperations;
102
- let isDirectory;
103
- try {
104
- isDirectory = await ops.isDirectory(searchPath);
105
- }
106
- catch {
107
- settle(() => reject(new Error(`Path not found: ${searchPath}`)));
108
- return;
109
- }
110
- const contextValue = context && context > 0 ? context : 0;
111
- const effectiveLimit = Math.max(1, limit ?? DEFAULT_LIMIT);
112
- const formatPath = (filePath) => {
113
- if (isDirectory) {
114
- const relative = path.relative(searchPath, filePath);
115
- if (relative && !relative.startsWith("..")) {
116
- return relative.replace(/\\/g, "/");
117
- }
118
- }
119
- return path.basename(filePath);
120
- };
121
- const fileCache = new Map();
122
- const getFileLines = async (filePath) => {
123
- let lines = fileCache.get(filePath);
124
- if (!lines) {
125
- try {
126
- const content = await ops.readFile(filePath);
127
- lines = content.replace(/\r\n/g, "\n").replace(/\r/g, "\n").split("\n");
128
- }
129
- catch {
130
- lines = [];
131
- }
132
- fileCache.set(filePath, lines);
133
- }
134
- return lines;
135
- };
136
- const args = ["--json", "--line-number", "--color=never", "--hidden"];
137
- if (ignoreCase)
138
- args.push("--ignore-case");
139
- if (literal)
140
- args.push("--fixed-strings");
141
- if (glob)
142
- args.push("--glob", glob);
143
- args.push(pattern, searchPath);
144
- const child = spawn(rgPath, args, { stdio: ["ignore", "pipe", "pipe"] });
145
- const rl = createInterface({ input: child.stdout });
146
- let stderr = "";
147
- let matchCount = 0;
148
- let matchLimitReached = false;
149
- let linesTruncated = false;
150
- let aborted = false;
151
- let killedDueToLimit = false;
152
- const outputLines = [];
153
- const cleanup = () => {
154
- rl.close();
155
- signal?.removeEventListener("abort", onAbort);
156
- };
157
- const stopChild = (dueToLimit = false) => {
158
- if (!child.killed) {
159
- killedDueToLimit = dueToLimit;
160
- child.kill();
161
- }
162
- };
163
- const onAbort = () => {
164
- aborted = true;
165
- stopChild();
166
- };
167
- signal?.addEventListener("abort", onAbort, { once: true });
168
- child.stderr?.on("data", (chunk) => {
169
- stderr += chunk.toString();
170
- });
171
- const formatBlock = async (filePath, lineNumber) => {
172
- const relativePath = formatPath(filePath);
173
- const lines = await getFileLines(filePath);
174
- if (!lines.length)
175
- return [`${relativePath}:${lineNumber}: (unable to read file)`];
176
- const block = [];
177
- const start = contextValue > 0 ? Math.max(1, lineNumber - contextValue) : lineNumber;
178
- const end = contextValue > 0 ? Math.min(lines.length, lineNumber + contextValue) : lineNumber;
179
- for (let current = start; current <= end; current++) {
180
- const lineText = lines[current - 1] ?? "";
181
- const sanitized = lineText.replace(/\r/g, "");
182
- const isMatchLine = current === lineNumber;
183
- // Truncate long lines so grep output stays compact.
184
- const { text: truncatedText, wasTruncated } = truncateLine(sanitized);
185
- if (wasTruncated)
186
- linesTruncated = true;
187
- if (isMatchLine)
188
- block.push(`${relativePath}:${current}: ${truncatedText}`);
189
- else
190
- block.push(`${relativePath}-${current}- ${truncatedText}`);
191
- }
192
- return block;
193
- };
194
- // Collect matches during streaming, then format them after rg exits.
195
- const matches = [];
196
- rl.on("line", (line) => {
197
- if (!line.trim() || matchCount >= effectiveLimit)
198
- return;
199
- let event;
200
- try {
201
- event = JSON.parse(line);
202
- }
203
- catch {
204
- return;
205
- }
206
- if (event.type === "match") {
207
- matchCount++;
208
- const filePath = event.data?.path?.text;
209
- const lineNumber = event.data?.line_number;
210
- const lineText = event.data?.lines?.text;
211
- if (filePath && typeof lineNumber === "number")
212
- matches.push({ filePath, lineNumber, lineText });
213
- if (matchCount >= effectiveLimit) {
214
- matchLimitReached = true;
215
- stopChild(true);
216
- }
217
- }
218
- });
219
- child.on("error", (error) => {
220
- cleanup();
221
- settle(() => reject(new Error(`Failed to run ripgrep: ${error.message}`)));
222
- });
223
- child.on("close", async (code) => {
224
- cleanup();
225
- if (aborted) {
226
- settle(() => reject(new Error("Operation aborted")));
227
- return;
228
- }
229
- if (!killedDueToLimit && code !== 0 && code !== 1) {
230
- const errorMsg = stderr.trim() || `ripgrep exited with code ${code}`;
231
- settle(() => reject(new Error(errorMsg)));
232
- return;
233
- }
234
- if (matchCount === 0) {
235
- settle(() => resolve({ content: [{ type: "text", text: "No matches found" }], details: undefined }));
236
- return;
237
- }
238
- // Format matches after streaming finishes so custom readFile() backends can be async.
239
- for (const match of matches) {
240
- if (contextValue === 0 && match.lineText !== undefined) {
241
- const relativePath = formatPath(match.filePath);
242
- const sanitized = match.lineText
243
- .replace(/\r\n/g, "\n")
244
- .replace(/\r/g, "")
245
- .replace(/\n$/, "");
246
- const { text: truncatedText, wasTruncated } = truncateLine(sanitized);
247
- if (wasTruncated)
248
- linesTruncated = true;
249
- outputLines.push(`${relativePath}:${match.lineNumber}: ${truncatedText}`);
250
- }
251
- else {
252
- const block = await formatBlock(match.filePath, match.lineNumber);
253
- outputLines.push(...block);
254
- }
255
- }
256
- const rawOutput = outputLines.join("\n");
257
- // Apply byte truncation. There is no line limit here because the match limit already capped rows.
258
- const truncation = truncateHead(rawOutput, { maxLines: Number.MAX_SAFE_INTEGER });
259
- let output = truncation.content;
260
- const details = {};
261
- // Build actionable notices for truncation and match limits.
262
- const notices = [];
263
- if (matchLimitReached) {
264
- notices.push(`${effectiveLimit} matches limit reached. Use limit=${effectiveLimit * 2} for more, or refine pattern`);
265
- details.matchLimitReached = effectiveLimit;
266
- }
267
- if (truncation.truncated) {
268
- notices.push(`${formatSize(DEFAULT_MAX_BYTES)} limit reached`);
269
- details.truncation = truncation;
270
- }
271
- if (linesTruncated) {
272
- notices.push(`Some lines truncated to ${GREP_MAX_LINE_LENGTH} chars. Use read tool to see full lines`);
273
- details.linesTruncated = true;
274
- }
275
- if (notices.length > 0)
276
- output += `\n\n[${notices.join(". ")}]`;
277
- settle(() => resolve({
278
- content: [{ type: "text", text: output }],
279
- details: Object.keys(details).length > 0 ? details : undefined,
280
- }));
281
- });
282
- }
283
- catch (err) {
284
- settle(() => reject(err));
285
- }
286
- })();
287
- });
288
- },
289
- renderCall(args, theme, context) {
290
- const text = context.lastComponent ?? new Text("", 0, 0);
291
- text.setText(formatGrepCall(args, theme));
292
- return text;
293
- },
294
- renderResult(result, options, theme, context) {
295
- const text = context.lastComponent ?? new Text("", 0, 0);
296
- text.setText(formatGrepResult(result, options, theme, context.showImages));
297
- return text;
298
- },
299
- };
300
- }
301
- export function createGrepTool(cwd, options) {
302
- return wrapToolDefinition(createGrepToolDefinition(cwd, options));
303
- }
304
- //# sourceMappingURL=grep.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"grep.js","sourceRoot":"","sources":["../../../src/core/tools/grep.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC5C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,wDAAwD,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EACN,iBAAiB,EACjB,UAAU,EACV,oBAAoB,EAEpB,YAAY,EACZ,YAAY,GACZ,MAAM,eAAe,CAAC;AAEvB,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9B,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC;IACjF,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,0DAA0D,EAAE,CAAC,CAAC;IAC7G,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,6DAA6D,EAAE,CAAC,CAAC;IAChH,UAAU,EAAE,IAAI,CAAC,QAAQ,C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BACd,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAY,CAAC,CAAC,CAAC;oBACpC,CAAC;gBAAA,CACD,CAAC,EAAE,CAAC;YAAA,CACL,CAAC,CAAC;QAAA,CACH;QACD,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE;YAChC,MAAM,IAAI,GAAI,OAAO,CAAC,aAAkC,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YAC/E,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;YAC1C,OAAO,IAAI,CAAC;QAAA,CACZ;QACD,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;YAC7C,MAAM,IAAI,GAAI,OAAO,CAAC,aAAkC,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YAC/E,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,MAAa,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;YAClF,OAAO,IAAI,CAAC;QAAA,CACZ;KACD,CAAC;AAAA,CACF;AAED,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,OAAyB,EAAgC;IACpG,OAAO,kBAAkB,CAAC,wBAAwB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AAAA,CAClE","sourcesContent":["import { createInterface } from \"node:readline\";\nimport type { AgentTool } from \"@aryee/aery-core\";\nimport { Text } from \"@aryee/aery-tui\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport { spawn } from \"child_process\";\nimport { readFileSync, statSync } from \"fs\";\nimport path from \"path\";\nimport { keyHint } from \"../../modes/interactive/components/keybinding-hints.js\";\nimport { ensureTool } from \"../../utils/tools-manager.js\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../extensions/types.js\";\nimport { resolveToCwd } from \"./path-utils.js\";\nimport { getTextOutput, invalidArgText, shortenPath, str } from \"./render-utils.js\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.js\";\nimport {\n\tDEFAULT_MAX_BYTES,\n\tformatSize,\n\tGREP_MAX_LINE_LENGTH,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n} from \"./truncate.js\";\n\nconst grepSchema = Type.Object({\n\tpattern: Type.String({ description: \"Search pattern (regex or literal string)\" }),\n\tpath: Type.Optional(Type.String({ description: \"Directory or file to search (default: current directory)\" })),\n\tglob: Type.Optional(Type.String({ description: \"Filter files by glob pattern, e.g. '*.ts' or '**/*.spec.ts'\" })),\n\tignoreCase: Type.Optional(Type.Boolean({ description: \"Case-insensitive search (default: false)\" })),\n\tliteral: Type.Optional(\n\t\tType.Boolean({ description: \"Treat pattern as literal string instead of regex (default: false)\" }),\n\t),\n\tcontext: Type.Optional(\n\t\tType.Number({ description: \"Number of lines to show before and after each match (default: 0)\" }),\n\t),\n\tlimit: Type.Optional(Type.Number({ description: \"Maximum number of matches to return (default: 100)\" })),\n});\n\nexport type GrepToolInput = Static<typeof grepSchema>;\nconst DEFAULT_LIMIT = 100;\n\nexport interface GrepToolDetails {\n\ttruncation?: TruncationResult;\n\tmatchLimitReached?: number;\n\tlinesTruncated?: boolean;\n}\n\n/**\n * Pluggable operations for the grep tool.\n * Override these to delegate search to remote systems (for example SSH).\n */\nexport interface GrepOperations {\n\t/** Check if path is a directory. Throws if path does not exist. */\n\tisDirectory: (absolutePath: string) => Promise<boolean> | boolean;\n\t/** Read file contents for context lines */\n\treadFile: (absolutePath: string) => Promise<string> | string;\n}\n\nconst defaultGrepOperations: GrepOperations = {\n\tisDirectory: (p) => statSync(p).isDirectory(),\n\treadFile: (p) => readFileSync(p, \"utf-8\"),\n};\n\nexport interface GrepToolOptions {\n\t/** Custom operations for grep. Default: local filesystem plus ripgrep */\n\toperations?: GrepOperations;\n}\n\nfunction formatGrepCall(\n\targs: { pattern: string; path?: string; glob?: string; limit?: number } | undefined,\n\ttheme: typeof import(\"../../modes/interactive/theme/theme.js\").theme,\n): string {\n\tconst pattern = str(args?.pattern);\n\tconst rawPath = str(args?.path);\n\tconst path = rawPath !== null ? shortenPath(rawPath || \".\") : null;\n\tconst glob = str(args?.glob);\n\tconst limit = args?.limit;\n\tconst invalidArg = invalidArgText(theme);\n\tlet text =\n\t\ttheme.fg(\"toolTitle\", theme.bold(\"grep\")) +\n\t\t\" \" +\n\t\t(pattern === null ? invalidArg : theme.fg(\"accent\", `/${pattern || \"\"}/`)) +\n\t\ttheme.fg(\"toolOutput\", ` in ${path === null ? invalidArg : path}`);\n\tif (glob) text += theme.fg(\"toolOutput\", ` (${glob})`);\n\tif (limit !== undefined) text += theme.fg(\"toolOutput\", ` limit ${limit}`);\n\treturn text;\n}\n\nfunction formatGrepResult(\n\tresult: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tdetails?: GrepToolDetails;\n\t},\n\toptions: ToolRenderResultOptions,\n\ttheme: typeof import(\"../../modes/interactive/theme/theme.js\").theme,\n\tshowImages: boolean,\n): string {\n\tconst output = getTextOutput(result, showImages).trim();\n\tlet text = \"\";\n\tif (output) {\n\t\tconst lines = output.split(\"\\n\");\n\t\tconst maxLines = options.expanded ? lines.length : 15;\n\t\tconst displayLines = lines.slice(0, maxLines);\n\t\tconst remaining = lines.length - maxLines;\n\t\ttext += `\\n${displayLines.map((line) => theme.fg(\"toolOutput\", line)).join(\"\\n\")}`;\n\t\tif (remaining > 0) {\n\t\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines,`)} ${keyHint(\"app.tools.expand\", \"to expand\")})`;\n\t\t}\n\t}\n\n\tconst matchLimit = result.details?.matchLimitReached;\n\tconst truncation = result.details?.truncation;\n\tconst linesTruncated = result.details?.linesTruncated;\n\tif (matchLimit || truncation?.truncated || linesTruncated) {\n\t\tconst warnings: string[] = [];\n\t\tif (matchLimit) warnings.push(`${matchLimit} matches limit`);\n\t\tif (truncation?.truncated) warnings.push(`${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit`);\n\t\tif (linesTruncated) warnings.push(\"some lines truncated\");\n\t\ttext += `\\n${theme.fg(\"warning\", `[Truncated: ${warnings.join(\", \")}]`)}`;\n\t}\n\treturn text;\n}\n\nexport function createGrepToolDefinition(\n\tcwd: string,\n\toptions?: GrepToolOptions,\n): ToolDefinition<typeof grepSchema, GrepToolDetails | undefined> {\n\tconst customOps = options?.operations;\n\treturn {\n\t\tname: \"grep\",\n\t\tlabel: \"grep\",\n\t\tdescription: `Search file contents for a pattern. Returns matching lines with file paths and line numbers. Respects .gitignore. Output is truncated to ${DEFAULT_LIMIT} matches or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first). Long lines are truncated to ${GREP_MAX_LINE_LENGTH} chars.`,\n\t\tpromptSnippet: \"Search file contents for patterns (respects .gitignore)\",\n\t\tparameters: grepSchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{\n\t\t\t\tpattern,\n\t\t\t\tpath: searchDir,\n\t\t\t\tglob,\n\t\t\t\tignoreCase,\n\t\t\t\tliteral,\n\t\t\t\tcontext,\n\t\t\t\tlimit,\n\t\t\t}: {\n\t\t\t\tpattern: string;\n\t\t\t\tpath?: string;\n\t\t\t\tglob?: string;\n\t\t\t\tignoreCase?: boolean;\n\t\t\t\tliteral?: boolean;\n\t\t\t\tcontext?: number;\n\t\t\t\tlimit?: number;\n\t\t\t},\n\t\t\tsignal?: AbortSignal,\n\t\t\t_onUpdate?,\n\t\t\t_ctx?,\n\t\t) {\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet settled = false;\n\t\t\t\tconst settle = (fn: () => void) => {\n\t\t\t\t\tif (!settled) {\n\t\t\t\t\t\tsettled = true;\n\t\t\t\t\t\tfn();\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\t(async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst rgPath = await ensureTool(\"rg\", true);\n\t\t\t\t\t\tif (!rgPath) {\n\t\t\t\t\t\t\tsettle(() => reject(new Error(\"ripgrep (rg) is not available and could not be downloaded\")));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst searchPath = resolveToCwd(searchDir || \".\", cwd);\n\t\t\t\t\t\tconst ops = customOps ?? defaultGrepOperations;\n\t\t\t\t\t\tlet isDirectory: boolean;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tisDirectory = await ops.isDirectory(searchPath);\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\tsettle(() => reject(new Error(`Path not found: ${searchPath}`)));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst contextValue = context && context > 0 ? context : 0;\n\t\t\t\t\t\tconst effectiveLimit = Math.max(1, limit ?? DEFAULT_LIMIT);\n\t\t\t\t\t\tconst formatPath = (filePath: string): string => {\n\t\t\t\t\t\t\tif (isDirectory) {\n\t\t\t\t\t\t\t\tconst relative = path.relative(searchPath, filePath);\n\t\t\t\t\t\t\t\tif (relative && !relative.startsWith(\"..\")) {\n\t\t\t\t\t\t\t\t\treturn relative.replace(/\\\\/g, \"/\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn path.basename(filePath);\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tconst fileCache = new Map<string, string[]>();\n\t\t\t\t\t\tconst getFileLines = async (filePath: string): Promise<string[]> => {\n\t\t\t\t\t\t\tlet lines = fileCache.get(filePath);\n\t\t\t\t\t\t\tif (!lines) {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tconst content = await ops.readFile(filePath);\n\t\t\t\t\t\t\t\t\tlines = content.replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\\n\").split(\"\\n\");\n\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\tlines = [];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tfileCache.set(filePath, lines);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn lines;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tconst args: string[] = [\"--json\", \"--line-number\", \"--color=never\", \"--hidden\"];\n\t\t\t\t\t\tif (ignoreCase) args.push(\"--ignore-case\");\n\t\t\t\t\t\tif (literal) args.push(\"--fixed-strings\");\n\t\t\t\t\t\tif (glob) args.push(\"--glob\", glob);\n\t\t\t\t\t\targs.push(pattern, searchPath);\n\n\t\t\t\t\t\tconst child = spawn(rgPath, args, { stdio: [\"ignore\", \"pipe\", \"pipe\"] });\n\t\t\t\t\t\tconst rl = createInterface({ input: child.stdout });\n\t\t\t\t\t\tlet stderr = \"\";\n\t\t\t\t\t\tlet matchCount = 0;\n\t\t\t\t\t\tlet matchLimitReached = false;\n\t\t\t\t\t\tlet linesTruncated = false;\n\t\t\t\t\t\tlet aborted = false;\n\t\t\t\t\t\tlet killedDueToLimit = false;\n\t\t\t\t\t\tconst outputLines: string[] = [];\n\n\t\t\t\t\t\tconst cleanup = () => {\n\t\t\t\t\t\t\trl.close();\n\t\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst stopChild = (dueToLimit = false) => {\n\t\t\t\t\t\t\tif (!child.killed) {\n\t\t\t\t\t\t\t\tkilledDueToLimit = dueToLimit;\n\t\t\t\t\t\t\t\tchild.kill();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst onAbort = () => {\n\t\t\t\t\t\t\taborted = true;\n\t\t\t\t\t\t\tstopChild();\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\t\t\t\tchild.stderr?.on(\"data\", (chunk) => {\n\t\t\t\t\t\t\tstderr += chunk.toString();\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tconst formatBlock = async (filePath: string, lineNumber: number): Promise<string[]> => {\n\t\t\t\t\t\t\tconst relativePath = formatPath(filePath);\n\t\t\t\t\t\t\tconst lines = await getFileLines(filePath);\n\t\t\t\t\t\t\tif (!lines.length) return [`${relativePath}:${lineNumber}: (unable to read file)`];\n\t\t\t\t\t\t\tconst block: string[] = [];\n\t\t\t\t\t\t\tconst start = contextValue > 0 ? Math.max(1, lineNumber - contextValue) : lineNumber;\n\t\t\t\t\t\t\tconst end = contextValue > 0 ? Math.min(lines.length, lineNumber + contextValue) : lineNumber;\n\t\t\t\t\t\t\tfor (let current = start; current <= end; current++) {\n\t\t\t\t\t\t\t\tconst lineText = lines[current - 1] ?? \"\";\n\t\t\t\t\t\t\t\tconst sanitized = lineText.replace(/\\r/g, \"\");\n\t\t\t\t\t\t\t\tconst isMatchLine = current === lineNumber;\n\t\t\t\t\t\t\t\t// Truncate long lines so grep output stays compact.\n\t\t\t\t\t\t\t\tconst { text: truncatedText, wasTruncated } = truncateLine(sanitized);\n\t\t\t\t\t\t\t\tif (wasTruncated) linesTruncated = true;\n\t\t\t\t\t\t\t\tif (isMatchLine) block.push(`${relativePath}:${current}: ${truncatedText}`);\n\t\t\t\t\t\t\t\telse block.push(`${relativePath}-${current}- ${truncatedText}`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn block;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// Collect matches during streaming, then format them after rg exits.\n\t\t\t\t\t\tconst matches: Array<{ filePath: string; lineNumber: number; lineText?: string }> = [];\n\t\t\t\t\t\trl.on(\"line\", (line) => {\n\t\t\t\t\t\t\tif (!line.trim() || matchCount >= effectiveLimit) return;\n\t\t\t\t\t\t\tlet event: any;\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tevent = JSON.parse(line);\n\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (event.type === \"match\") {\n\t\t\t\t\t\t\t\tmatchCount++;\n\t\t\t\t\t\t\t\tconst filePath = event.data?.path?.text;\n\t\t\t\t\t\t\t\tconst lineNumber = event.data?.line_number;\n\t\t\t\t\t\t\t\tconst lineText = event.data?.lines?.text;\n\t\t\t\t\t\t\t\tif (filePath && typeof lineNumber === \"number\")\n\t\t\t\t\t\t\t\t\tmatches.push({ filePath, lineNumber, lineText });\n\t\t\t\t\t\t\t\tif (matchCount >= effectiveLimit) {\n\t\t\t\t\t\t\t\t\tmatchLimitReached = true;\n\t\t\t\t\t\t\t\t\tstopChild(true);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tchild.on(\"error\", (error) => {\n\t\t\t\t\t\t\tcleanup();\n\t\t\t\t\t\t\tsettle(() => reject(new Error(`Failed to run ripgrep: ${error.message}`)));\n\t\t\t\t\t\t});\n\t\t\t\t\t\tchild.on(\"close\", async (code) => {\n\t\t\t\t\t\t\tcleanup();\n\t\t\t\t\t\t\tif (aborted) {\n\t\t\t\t\t\t\t\tsettle(() => reject(new Error(\"Operation aborted\")));\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!killedDueToLimit && code !== 0 && code !== 1) {\n\t\t\t\t\t\t\t\tconst errorMsg = stderr.trim() || `ripgrep exited with code ${code}`;\n\t\t\t\t\t\t\t\tsettle(() => reject(new Error(errorMsg)));\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (matchCount === 0) {\n\t\t\t\t\t\t\t\tsettle(() =>\n\t\t\t\t\t\t\t\t\tresolve({ content: [{ type: \"text\", text: \"No matches found\" }], details: undefined }),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Format matches after streaming finishes so custom readFile() backends can be async.\n\t\t\t\t\t\t\tfor (const match of matches) {\n\t\t\t\t\t\t\t\tif (contextValue === 0 && match.lineText !== undefined) {\n\t\t\t\t\t\t\t\t\tconst relativePath = formatPath(match.filePath);\n\t\t\t\t\t\t\t\t\tconst sanitized = match.lineText\n\t\t\t\t\t\t\t\t\t\t.replace(/\\r\\n/g, \"\\n\")\n\t\t\t\t\t\t\t\t\t\t.replace(/\\r/g, \"\")\n\t\t\t\t\t\t\t\t\t\t.replace(/\\n$/, \"\");\n\t\t\t\t\t\t\t\t\tconst { text: truncatedText, wasTruncated } = truncateLine(sanitized);\n\t\t\t\t\t\t\t\t\tif (wasTruncated) linesTruncated = true;\n\t\t\t\t\t\t\t\t\toutputLines.push(`${relativePath}:${match.lineNumber}: ${truncatedText}`);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tconst block = await formatBlock(match.filePath, match.lineNumber);\n\t\t\t\t\t\t\t\t\toutputLines.push(...block);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst rawOutput = outputLines.join(\"\\n\");\n\t\t\t\t\t\t\t// Apply byte truncation. There is no line limit here because the match limit already capped rows.\n\t\t\t\t\t\t\tconst truncation = truncateHead(rawOutput, { maxLines: Number.MAX_SAFE_INTEGER });\n\t\t\t\t\t\t\tlet output = truncation.content;\n\t\t\t\t\t\t\tconst details: GrepToolDetails = {};\n\t\t\t\t\t\t\t// Build actionable notices for truncation and match limits.\n\t\t\t\t\t\t\tconst notices: string[] = [];\n\t\t\t\t\t\t\tif (matchLimitReached) {\n\t\t\t\t\t\t\t\tnotices.push(\n\t\t\t\t\t\t\t\t\t`${effectiveLimit} matches limit reached. Use limit=${effectiveLimit * 2} for more, or refine pattern`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tdetails.matchLimitReached = effectiveLimit;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (truncation.truncated) {\n\t\t\t\t\t\t\t\tnotices.push(`${formatSize(DEFAULT_MAX_BYTES)} limit reached`);\n\t\t\t\t\t\t\t\tdetails.truncation = truncation;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (linesTruncated) {\n\t\t\t\t\t\t\t\tnotices.push(\n\t\t\t\t\t\t\t\t\t`Some lines truncated to ${GREP_MAX_LINE_LENGTH} chars. Use read tool to see full lines`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tdetails.linesTruncated = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (notices.length > 0) output += `\\n\\n[${notices.join(\". \")}]`;\n\t\t\t\t\t\t\tsettle(() =>\n\t\t\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: output }],\n\t\t\t\t\t\t\t\t\tdetails: Object.keys(details).length > 0 ? details : undefined,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tsettle(() => reject(err as Error));\n\t\t\t\t\t}\n\t\t\t\t})();\n\t\t\t});\n\t\t},\n\t\trenderCall(args, theme, context) {\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\t\ttext.setText(formatGrepCall(args, theme));\n\t\t\treturn text;\n\t\t},\n\t\trenderResult(result, options, theme, context) {\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\t\ttext.setText(formatGrepResult(result as any, options, theme, context.showImages));\n\t\t\treturn text;\n\t\t},\n\t};\n}\n\nexport function createGrepTool(cwd: string, options?: GrepToolOptions): AgentTool<typeof grepSchema> {\n\treturn wrapToolDefinition(createGrepToolDefinition(cwd, options));\n}\n"]}
@@ -1,40 +0,0 @@
1
- export { type BashOperations, type BashSpawnContext, type BashSpawnHook, type BashToolDetails, type BashToolInput, type BashToolOptions, createBashTool, createBashToolDefinition, createLocalBashOperations, } from "./bash.js";
2
- export { createEditTool, createEditToolDefinition, type EditOperations, type EditToolDetails, type EditToolInput, type EditToolOptions, } from "./edit.js";
3
- export { withFileMutationQueue } from "./file-mutation-queue.js";
4
- export { createFindTool, createFindToolDefinition, type FindOperations, type FindToolDetails, type FindToolInput, type FindToolOptions, } from "./find.js";
5
- export { createGrepTool, createGrepToolDefinition, type GrepOperations, type GrepToolDetails, type GrepToolInput, type GrepToolOptions, } from "./grep.js";
6
- export { createLsTool, createLsToolDefinition, type LsOperations, type LsToolDetails, type LsToolInput, type LsToolOptions, } from "./ls.js";
7
- export { createReadTool, createReadToolDefinition, type ReadOperations, type ReadToolDetails, type ReadToolInput, type ReadToolOptions, } from "./read.js";
8
- export { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, type TruncationOptions, type TruncationResult, truncateHead, truncateLine, truncateTail, } from "./truncate.js";
9
- export { createWriteTool, createWriteToolDefinition, type WriteOperations, type WriteToolInput, type WriteToolOptions, } from "./write.js";
10
- import type { AgentTool } from "@aryee/aery-core";
11
- import type { ToolDefinition } from "../extensions/types.js";
12
- import { type BashToolOptions } from "./bash.js";
13
- import { type EditToolOptions } from "./edit.js";
14
- import { type FindToolOptions } from "./find.js";
15
- import { type GrepToolOptions } from "./grep.js";
16
- import { type LsToolOptions } from "./ls.js";
17
- import { type ReadToolOptions } from "./read.js";
18
- import { type WriteToolOptions } from "./write.js";
19
- export type Tool = AgentTool<any>;
20
- export type ToolDef = ToolDefinition<any, any>;
21
- export type ToolName = "read" | "bash" | "edit" | "write" | "grep" | "find" | "ls";
22
- export declare const allToolNames: Set<ToolName>;
23
- export interface ToolsOptions {
24
- read?: ReadToolOptions;
25
- bash?: BashToolOptions;
26
- write?: WriteToolOptions;
27
- edit?: EditToolOptions;
28
- grep?: GrepToolOptions;
29
- find?: FindToolOptions;
30
- ls?: LsToolOptions;
31
- }
32
- export declare function createToolDefinition(toolName: ToolName, cwd: string, options?: ToolsOptions): ToolDef;
33
- export declare function createTool(toolName: ToolName, cwd: string, options?: ToolsOptions): Tool;
34
- export declare function createCodingToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[];
35
- export declare function createReadOnlyToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[];
36
- export declare function createAllToolDefinitions(cwd: string, options?: ToolsOptions): Record<ToolName, ToolDef>;
37
- export declare function createCodingTools(cwd: string, options?: ToolsOptions): Tool[];
38
- export declare function createReadOnlyTools(cwd: string, options?: ToolsOptions): Tool[];
39
- export declare function createAllTools(cwd: string, options?: ToolsOptions): Record<ToolName, Tool>;
40
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,cAAc,EACd,wBAAwB,EACxB,yBAAyB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EACN,cAAc,EACd,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,YAAY,EACZ,sBAAsB,EACtB,KAAK,YAAY,EACjB,KAAK,aAA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,CAU1F","sourcesContent":["export {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashTool,\n\tcreateBashToolDefinition,\n\tcreateLocalBashOperations,\n} from \"./bash.js\";\nexport {\n\tcreateEditTool,\n\tcreateEditToolDefinition,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n} from \"./edit.js\";\nexport { withFileMutationQueue } from \"./file-mutation-queue.js\";\nexport {\n\tcreateFindTool,\n\tcreateFindToolDefinition,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n} from \"./find.js\";\nexport {\n\tcreateGrepTool,\n\tcreateGrepToolDefinition,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n} from \"./grep.js\";\nexport {\n\tcreateLsTool,\n\tcreateLsToolDefinition,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n} from \"./ls.js\";\nexport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n} from \"./read.js\";\nexport {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\tformatSize,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n} from \"./truncate.js\";\nexport {\n\tcreateWriteTool,\n\tcreateWriteToolDefinition,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n} from \"./write.js\";\n\nimport type { AgentTool } from \"@aryee/aery-core\";\nimport type { ToolDefinition } from \"../extensions/types.js\";\nimport { type BashToolOptions, createBashTool, createBashToolDefinition } from \"./bash.js\";\nimport { createEditTool, createEditToolDefinition, type EditToolOptions } from \"./edit.js\";\nimport { createFindTool, createFindToolDefinition, type FindToolOptions } from \"./find.js\";\nimport { createGrepTool, createGrepToolDefinition, type GrepToolOptions } from \"./grep.js\";\nimport { createLsTool, createLsToolDefinition, type LsToolOptions } from \"./ls.js\";\nimport { createReadTool, createReadToolDefinition, type ReadToolOptions } from \"./read.js\";\nimport { createWriteTool, createWriteToolDefinition, type WriteToolOptions } from \"./write.js\";\n\nexport type Tool = AgentTool<any>;\nexport type ToolDef = ToolDefinition<any, any>;\nexport type ToolName = \"read\" | \"bash\" | \"edit\" | \"write\" | \"grep\" | \"find\" | \"ls\";\nexport const allToolNames: Set<ToolName> = new Set([\"read\", \"bash\", \"edit\", \"write\", \"grep\", \"find\", \"ls\"]);\n\nexport interface ToolsOptions {\n\tread?: ReadToolOptions;\n\tbash?: BashToolOptions;\n\twrite?: WriteToolOptions;\n\tedit?: EditToolOptions;\n\tgrep?: GrepToolOptions;\n\tfind?: FindToolOptions;\n\tls?: LsToolOptions;\n}\n\nexport function createToolDefinition(toolName: ToolName, cwd: string, options?: ToolsOptions): ToolDef {\n\tswitch (toolName) {\n\t\tcase \"read\":\n\t\t\treturn createReadToolDefinition(cwd, options?.read);\n\t\tcase \"bash\":\n\t\t\treturn createBashToolDefinition(cwd, options?.bash);\n\t\tcase \"edit\":\n\t\t\treturn createEditToolDefinition(cwd, options?.edit);\n\t\tcase \"write\":\n\t\t\treturn createWriteToolDefinition(cwd, options?.write);\n\t\tcase \"grep\":\n\t\t\treturn createGrepToolDefinition(cwd, options?.grep);\n\t\tcase \"find\":\n\t\t\treturn createFindToolDefinition(cwd, options?.find);\n\t\tcase \"ls\":\n\t\t\treturn createLsToolDefinition(cwd, options?.ls);\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown tool name: ${toolName}`);\n\t}\n}\n\nexport function createTool(toolName: ToolName, cwd: string, options?: ToolsOptions): Tool {\n\tswitch (toolName) {\n\t\tcase \"read\":\n\t\t\treturn createReadTool(cwd, options?.read);\n\t\tcase \"bash\":\n\t\t\treturn createBashTool(cwd, options?.bash);\n\t\tcase \"edit\":\n\t\t\treturn createEditTool(cwd, options?.edit);\n\t\tcase \"write\":\n\t\t\treturn createWriteTool(cwd, options?.write);\n\t\tcase \"grep\":\n\t\t\treturn createGrepTool(cwd, options?.grep);\n\t\tcase \"find\":\n\t\t\treturn createFindTool(cwd, options?.find);\n\t\tcase \"ls\":\n\t\t\treturn createLsTool(cwd, options?.ls);\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown tool name: ${toolName}`);\n\t}\n}\n\nexport function createCodingToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateBashToolDefinition(cwd, options?.bash),\n\t\tcreateEditToolDefinition(cwd, options?.edit),\n\t\tcreateWriteToolDefinition(cwd, options?.write),\n\t];\n}\n\nexport function createReadOnlyToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateGrepToolDefinition(cwd, options?.grep),\n\t\tcreateFindToolDefinition(cwd, options?.find),\n\t\tcreateLsToolDefinition(cwd, options?.ls),\n\t];\n}\n\nexport function createAllToolDefinitions(cwd: string, options?: ToolsOptions): Record<ToolName, ToolDef> {\n\treturn {\n\t\tread: createReadToolDefinition(cwd, options?.read),\n\t\tbash: createBashToolDefinition(cwd, options?.bash),\n\t\tedit: createEditToolDefinition(cwd, options?.edit),\n\t\twrite: createWriteToolDefinition(cwd, options?.write),\n\t\tgrep: createGrepToolDefinition(cwd, options?.grep),\n\t\tfind: createFindToolDefinition(cwd, options?.find),\n\t\tls: createLsToolDefinition(cwd, options?.ls),\n\t};\n}\n\nexport function createCodingTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateBashTool(cwd, options?.bash),\n\t\tcreateEditTool(cwd, options?.edit),\n\t\tcreateWriteTool(cwd, options?.write),\n\t];\n}\n\nexport function createReadOnlyTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateGrepTool(cwd, options?.grep),\n\t\tcreateFindTool(cwd, options?.find),\n\t\tcreateLsTool(cwd, options?.ls),\n\t];\n}\n\nexport function createAllTools(cwd: string, options?: ToolsOptions): Record<ToolName, Tool> {\n\treturn {\n\t\tread: createReadTool(cwd, options?.read),\n\t\tbash: createBashTool(cwd, options?.bash),\n\t\tedit: createEditTool(cwd, options?.edit),\n\t\twrite: createWriteTool(cwd, options?.write),\n\t\tgrep: createGrepTool(cwd, options?.grep),\n\t\tfind: createFindTool(cwd, options?.find),\n\t\tls: createLsTool(cwd, options?.ls),\n\t};\n}\n"]}
@@ -1,112 +0,0 @@
1
- export { createBashTool, createBashToolDefinition, createLocalBashOperations, } from "./bash.js";
2
- export { createEditTool, createEditToolDefinition, } from "./edit.js";
3
- export { withFileMutationQueue } from "./file-mutation-queue.js";
4
- export { createFindTool, createFindToolDefinition, } from "./find.js";
5
- export { createGrepTool, createGrepToolDefinition, } from "./grep.js";
6
- export { createLsTool, createLsToolDefinition, } from "./ls.js";
7
- export { createReadTool, createReadToolDefinition, } from "./read.js";
8
- export { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, truncateHead, truncateLine, truncateTail, } from "./truncate.js";
9
- export { createWriteTool, createWriteToolDefinition, } from "./write.js";
10
- import { createBashTool, createBashToolDefinition } from "./bash.js";
11
- import { createEditTool, createEditToolDefinition } from "./edit.js";
12
- import { createFindTool, createFindToolDefinition } from "./find.js";
13
- import { createGrepTool, createGrepToolDefinition } from "./grep.js";
14
- import { createLsTool, createLsToolDefinition } from "./ls.js";
15
- import { createReadTool, createReadToolDefinition } from "./read.js";
16
- import { createWriteTool, createWriteToolDefinition } from "./write.js";
17
- export const allToolNames = new Set(["read", "bash", "edit", "write", "grep", "find", "ls"]);
18
- export function createToolDefinition(toolName, cwd, options) {
19
- switch (toolName) {
20
- case "read":
21
- return createReadToolDefinition(cwd, options?.read);
22
- case "bash":
23
- return createBashToolDefinition(cwd, options?.bash);
24
- case "edit":
25
- return createEditToolDefinition(cwd, options?.edit);
26
- case "write":
27
- return createWriteToolDefinition(cwd, options?.write);
28
- case "grep":
29
- return createGrepToolDefinition(cwd, options?.grep);
30
- case "find":
31
- return createFindToolDefinition(cwd, options?.find);
32
- case "ls":
33
- return createLsToolDefinition(cwd, options?.ls);
34
- default:
35
- throw new Error(`Unknown tool name: ${toolName}`);
36
- }
37
- }
38
- export function createTool(toolName, cwd, options) {
39
- switch (toolName) {
40
- case "read":
41
- return createReadTool(cwd, options?.read);
42
- case "bash":
43
- return createBashTool(cwd, options?.bash);
44
- case "edit":
45
- return createEditTool(cwd, options?.edit);
46
- case "write":
47
- return createWriteTool(cwd, options?.write);
48
- case "grep":
49
- return createGrepTool(cwd, options?.grep);
50
- case "find":
51
- return createFindTool(cwd, options?.find);
52
- case "ls":
53
- return createLsTool(cwd, options?.ls);
54
- default:
55
- throw new Error(`Unknown tool name: ${toolName}`);
56
- }
57
- }
58
- export function createCodingToolDefinitions(cwd, options) {
59
- return [
60
- createReadToolDefinition(cwd, options?.read),
61
- createBashToolDefinition(cwd, options?.bash),
62
- createEditToolDefinition(cwd, options?.edit),
63
- createWriteToolDefinition(cwd, options?.write),
64
- ];
65
- }
66
- export function createReadOnlyToolDefinitions(cwd, options) {
67
- return [
68
- createReadToolDefinition(cwd, options?.read),
69
- createGrepToolDefinition(cwd, options?.grep),
70
- createFindToolDefinition(cwd, options?.find),
71
- createLsToolDefinition(cwd, options?.ls),
72
- ];
73
- }
74
- export function createAllToolDefinitions(cwd, options) {
75
- return {
76
- read: createReadToolDefinition(cwd, options?.read),
77
- bash: createBashToolDefinition(cwd, options?.bash),
78
- edit: createEditToolDefinition(cwd, options?.edit),
79
- write: createWriteToolDefinition(cwd, options?.write),
80
- grep: createGrepToolDefinition(cwd, options?.grep),
81
- find: createFindToolDefinition(cwd, options?.find),
82
- ls: createLsToolDefinition(cwd, options?.ls),
83
- };
84
- }
85
- export function createCodingTools(cwd, options) {
86
- return [
87
- createReadTool(cwd, options?.read),
88
- createBashTool(cwd, options?.bash),
89
- createEditTool(cwd, options?.edit),
90
- createWriteTool(cwd, options?.write),
91
- ];
92
- }
93
- export function createReadOnlyTools(cwd, options) {
94
- return [
95
- createReadTool(cwd, options?.read),
96
- createGrepTool(cwd, options?.grep),
97
- createFindTool(cwd, options?.find),
98
- createLsTool(cwd, options?.ls),
99
- ];
100
- }
101
- export function createAllTools(cwd, options) {
102
- return {
103
- read: createReadTool(cwd, options?.read),
104
- bash: createBashTool(cwd, options?.bash),
105
- edit: createEditTool(cwd, options?.edit),
106
- write: createWriteTool(cwd, options?.write),
107
- grep: createGrepTool(cwd, options?.grep),
108
- find: createFindTool(cwd, options?.find),
109
- ls: createLsTool(cwd, options?.ls),
110
- };
111
- }
112
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAON,cAAc,EACd,wBAAwB,EACxB,yBAAyB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB,GAKxB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EACN,cAAc,EACd,wBAAwB,GAKxB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB,GAKxB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,YAAY,EACZ,sBAAsB,GAKtB,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,cAAc,EACd,wBAAwB,GAKxB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EAGV,YAAY,EACZ,YAAY,EACZ,YAAY,GACZ,MAAM,eAAe,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CAAC;QAClC,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC;KACpC,CAAC;AAAA,CACF;AAED,MAAM,UAAU,mBAAmB,CAAC,GAAW,EAAE,OAAsB,EAAU;IAChF,OAAO;QACN,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC;QAClC,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC;QAClC,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC;QAClC,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC;KAC9B,CAAC;AAAA,CACF;AAED,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,OAAsB,EAA0B;IAC3F,OAAO;QACN,IAAI,EAAE,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC;QACxC,IAAI,EAAE,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC;QACxC,IAAI,EAAE,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC;QACxC,KAAK,EAAE,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC;QAC3C,IAAI,EAAE,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC;QACxC,IAAI,EAAE,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC;QACxC,EAAE,EAAE,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC;KAClC,CAAC;AAAA,CACF","sourcesContent":["export {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashTool,\n\tcreateBashToolDefinition,\n\tcreateLocalBashOperations,\n} from \"./bash.js\";\nexport {\n\tcreateEditTool,\n\tcreateEditToolDefinition,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n} from \"./edit.js\";\nexport { withFileMutationQueue } from \"./file-mutation-queue.js\";\nexport {\n\tcreateFindTool,\n\tcreateFindToolDefinition,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n} from \"./find.js\";\nexport {\n\tcreateGrepTool,\n\tcreateGrepToolDefinition,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n} from \"./grep.js\";\nexport {\n\tcreateLsTool,\n\tcreateLsToolDefinition,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n} from \"./ls.js\";\nexport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n} from \"./read.js\";\nexport {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\tformatSize,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n} from \"./truncate.js\";\nexport {\n\tcreateWriteTool,\n\tcreateWriteToolDefinition,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n} from \"./write.js\";\n\nimport type { AgentTool } from \"@aryee/aery-core\";\nimport type { ToolDefinition } from \"../extensions/types.js\";\nimport { type BashToolOptions, createBashTool, createBashToolDefinition } from \"./bash.js\";\nimport { createEditTool, createEditToolDefinition, type EditToolOptions } from \"./edit.js\";\nimport { createFindTool, createFindToolDefinition, type FindToolOptions } from \"./find.js\";\nimport { createGrepTool, createGrepToolDefinition, type GrepToolOptions } from \"./grep.js\";\nimport { createLsTool, createLsToolDefinition, type LsToolOptions } from \"./ls.js\";\nimport { createReadTool, createReadToolDefinition, type ReadToolOptions } from \"./read.js\";\nimport { createWriteTool, createWriteToolDefinition, type WriteToolOptions } from \"./write.js\";\n\nexport type Tool = AgentTool<any>;\nexport type ToolDef = ToolDefinition<any, any>;\nexport type ToolName = \"read\" | \"bash\" | \"edit\" | \"write\" | \"grep\" | \"find\" | \"ls\";\nexport const allToolNames: Set<ToolName> = new Set([\"read\", \"bash\", \"edit\", \"write\", \"grep\", \"find\", \"ls\"]);\n\nexport interface ToolsOptions {\n\tread?: ReadToolOptions;\n\tbash?: BashToolOptions;\n\twrite?: WriteToolOptions;\n\tedit?: EditToolOptions;\n\tgrep?: GrepToolOptions;\n\tfind?: FindToolOptions;\n\tls?: LsToolOptions;\n}\n\nexport function createToolDefinition(toolName: ToolName, cwd: string, options?: ToolsOptions): ToolDef {\n\tswitch (toolName) {\n\t\tcase \"read\":\n\t\t\treturn createReadToolDefinition(cwd, options?.read);\n\t\tcase \"bash\":\n\t\t\treturn createBashToolDefinition(cwd, options?.bash);\n\t\tcase \"edit\":\n\t\t\treturn createEditToolDefinition(cwd, options?.edit);\n\t\tcase \"write\":\n\t\t\treturn createWriteToolDefinition(cwd, options?.write);\n\t\tcase \"grep\":\n\t\t\treturn createGrepToolDefinition(cwd, options?.grep);\n\t\tcase \"find\":\n\t\t\treturn createFindToolDefinition(cwd, options?.find);\n\t\tcase \"ls\":\n\t\t\treturn createLsToolDefinition(cwd, options?.ls);\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown tool name: ${toolName}`);\n\t}\n}\n\nexport function createTool(toolName: ToolName, cwd: string, options?: ToolsOptions): Tool {\n\tswitch (toolName) {\n\t\tcase \"read\":\n\t\t\treturn createReadTool(cwd, options?.read);\n\t\tcase \"bash\":\n\t\t\treturn createBashTool(cwd, options?.bash);\n\t\tcase \"edit\":\n\t\t\treturn createEditTool(cwd, options?.edit);\n\t\tcase \"write\":\n\t\t\treturn createWriteTool(cwd, options?.write);\n\t\tcase \"grep\":\n\t\t\treturn createGrepTool(cwd, options?.grep);\n\t\tcase \"find\":\n\t\t\treturn createFindTool(cwd, options?.find);\n\t\tcase \"ls\":\n\t\t\treturn createLsTool(cwd, options?.ls);\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown tool name: ${toolName}`);\n\t}\n}\n\nexport function createCodingToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateBashToolDefinition(cwd, options?.bash),\n\t\tcreateEditToolDefinition(cwd, options?.edit),\n\t\tcreateWriteToolDefinition(cwd, options?.write),\n\t];\n}\n\nexport function createReadOnlyToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateGrepToolDefinition(cwd, options?.grep),\n\t\tcreateFindToolDefinition(cwd, options?.find),\n\t\tcreateLsToolDefinition(cwd, options?.ls),\n\t];\n}\n\nexport function createAllToolDefinitions(cwd: string, options?: ToolsOptions): Record<ToolName, ToolDef> {\n\treturn {\n\t\tread: createReadToolDefinition(cwd, options?.read),\n\t\tbash: createBashToolDefinition(cwd, options?.bash),\n\t\tedit: createEditToolDefinition(cwd, options?.edit),\n\t\twrite: createWriteToolDefinition(cwd, options?.write),\n\t\tgrep: createGrepToolDefinition(cwd, options?.grep),\n\t\tfind: createFindToolDefinition(cwd, options?.find),\n\t\tls: createLsToolDefinition(cwd, options?.ls),\n\t};\n}\n\nexport function createCodingTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateBashTool(cwd, options?.bash),\n\t\tcreateEditTool(cwd, options?.edit),\n\t\tcreateWriteTool(cwd, options?.write),\n\t];\n}\n\nexport function createReadOnlyTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateGrepTool(cwd, options?.grep),\n\t\tcreateFindTool(cwd, options?.find),\n\t\tcreateLsTool(cwd, options?.ls),\n\t];\n}\n\nexport function createAllTools(cwd: string, options?: ToolsOptions): Record<ToolName, Tool> {\n\treturn {\n\t\tread: createReadTool(cwd, options?.read),\n\t\tbash: createBashTool(cwd, options?.bash),\n\t\tedit: createEditTool(cwd, options?.edit),\n\t\twrite: createWriteTool(cwd, options?.write),\n\t\tgrep: createGrepTool(cwd, options?.grep),\n\t\tfind: createFindTool(cwd, options?.find),\n\t\tls: createLsTool(cwd, options?.ls),\n\t};\n}\n"]}
@@ -1,37 +0,0 @@
1
- import type { AgentTool } from "@aryee/aery-core";
2
- import { type Static } from "@sinclair/typebox";
3
- import type { ToolDefinition } from "../extensions/types.js";
4
- import { type TruncationResult } from "./truncate.js";
5
- declare const lsSchema: import("@sinclair/typebox").TObject<{
6
- path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
7
- limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
8
- }>;
9
- export type LsToolInput = Static<typeof lsSchema>;
10
- export interface LsToolDetails {
11
- truncation?: TruncationResult;
12
- entryLimitReached?: number;
13
- }
14
- /**
15
- * Pluggable operations for the ls tool.
16
- * Override these to delegate directory listing to remote systems (for example SSH).
17
- */
18
- export interface LsOperations {
19
- /** Check if path exists */
20
- exists: (absolutePath: string) => Promise<boolean> | boolean;
21
- /** Get file or directory stats. Throws if not found. */
22
- stat: (absolutePath: string) => Promise<{
23
- isDirectory: () => boolean;
24
- }> | {
25
- isDirectory: () => boolean;
26
- };
27
- /** Read directory entries */
28
- readdir: (absolutePath: string) => Promise<string[]> | string[];
29
- }
30
- export interface LsToolOptions {
31
- /** Custom operations for directory listing. Default: local filesystem */
32
- operations?: LsOperations;
33
- }
34
- export declare function createLsToolDefinition(cwd: string, options?: LsToolOptions): ToolDefinition<typeof lsSchema, LsToolDetails | undefined>;
35
- export declare function createLsTool(cwd: string, options?: LsToolOptions): AgentTool<typeof lsSchema>;
36
- export {};
37
- //# sourceMappingURL=ls.d.ts.map