orient-cli 0.3.0 → 0.3.2

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 (1134) hide show
  1. package/dist/integrations/notebooklm/notebooklm-extension.js +3 -8
  2. package/dist/integrations/notebooklm/notebooklm-extension.js.map +1 -1
  3. package/dist/integrations/playwright/playwright-extension.js +4 -14
  4. package/dist/integrations/playwright/playwright-extension.js.map +1 -1
  5. package/dist/integrations/web-search/bridge.js +12 -23
  6. package/dist/integrations/web-search/bridge.js.map +1 -1
  7. package/dist/integrations/web-search/web-search-extension.js +0 -3
  8. package/dist/integrations/web-search/web-search-extension.js.map +1 -1
  9. package/dist/orient/orient-extension.js +6 -14
  10. package/dist/orient/orient-extension.js.map +1 -1
  11. package/package.json +3 -10
  12. package/scripts/postinstall.mjs +40 -1
  13. package/vendor/@orient-cli/coding-agent/dist/bun/cli.d.ts.map +1 -0
  14. package/vendor/@orient-cli/coding-agent/dist/bun/cli.js.map +1 -0
  15. package/vendor/@orient-cli/coding-agent/dist/bun/register-bedrock.d.ts.map +1 -0
  16. package/vendor/@orient-cli/coding-agent/dist/cli/args.d.ts.map +1 -0
  17. package/vendor/@orient-cli/coding-agent/dist/cli/args.js.map +1 -0
  18. package/vendor/@orient-cli/coding-agent/dist/cli/config-selector.d.ts.map +1 -0
  19. package/vendor/@orient-cli/coding-agent/dist/cli/config-selector.js.map +1 -0
  20. package/vendor/@orient-cli/coding-agent/dist/cli/file-processor.d.ts.map +1 -0
  21. package/vendor/@orient-cli/coding-agent/dist/cli/file-processor.js.map +1 -0
  22. package/vendor/@orient-cli/coding-agent/dist/cli/initial-message.d.ts +18 -0
  23. package/vendor/@orient-cli/coding-agent/dist/cli/initial-message.d.ts.map +1 -0
  24. package/vendor/@orient-cli/coding-agent/dist/cli/initial-message.js.map +1 -0
  25. package/vendor/@orient-cli/coding-agent/dist/cli/list-models.d.ts.map +1 -0
  26. package/vendor/@orient-cli/coding-agent/dist/cli/list-models.js.map +1 -0
  27. package/vendor/@orient-cli/coding-agent/dist/cli/session-picker.d.ts.map +1 -0
  28. package/vendor/@orient-cli/coding-agent/dist/cli/session-picker.js.map +1 -0
  29. package/vendor/@orient-cli/coding-agent/dist/cli.d.ts.map +1 -0
  30. package/{node_modules → vendor}/@orient-cli/coding-agent/dist/cli.js +0 -0
  31. package/vendor/@orient-cli/coding-agent/dist/cli.js.map +1 -0
  32. package/vendor/@orient-cli/coding-agent/dist/config.d.ts.map +1 -0
  33. package/vendor/@orient-cli/coding-agent/dist/config.js +251 -0
  34. package/vendor/@orient-cli/coding-agent/dist/config.js.map +1 -0
  35. package/vendor/@orient-cli/coding-agent/dist/core/agent-session-runtime.d.ts.map +1 -0
  36. package/vendor/@orient-cli/coding-agent/dist/core/agent-session-runtime.js +231 -0
  37. package/vendor/@orient-cli/coding-agent/dist/core/agent-session-runtime.js.map +1 -0
  38. package/vendor/@orient-cli/coding-agent/dist/core/agent-session-services.d.ts.map +1 -0
  39. package/vendor/@orient-cli/coding-agent/dist/core/agent-session-services.js.map +1 -0
  40. package/vendor/@orient-cli/coding-agent/dist/core/agent-session.d.ts +617 -0
  41. package/vendor/@orient-cli/coding-agent/dist/core/agent-session.d.ts.map +1 -0
  42. package/vendor/@orient-cli/coding-agent/dist/core/agent-session.js +2477 -0
  43. package/vendor/@orient-cli/coding-agent/dist/core/agent-session.js.map +1 -0
  44. package/vendor/@orient-cli/coding-agent/dist/core/auth-storage.d.ts +136 -0
  45. package/vendor/@orient-cli/coding-agent/dist/core/auth-storage.d.ts.map +1 -0
  46. package/vendor/@orient-cli/coding-agent/dist/core/auth-storage.js +418 -0
  47. package/vendor/@orient-cli/coding-agent/dist/core/auth-storage.js.map +1 -0
  48. package/vendor/@orient-cli/coding-agent/dist/core/bash-executor.d.ts.map +1 -0
  49. package/vendor/@orient-cli/coding-agent/dist/core/bash-executor.js.map +1 -0
  50. package/vendor/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.d.ts.map +1 -0
  51. package/vendor/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.js.map +1 -0
  52. package/vendor/@orient-cli/coding-agent/dist/core/compaction/compaction.d.ts.map +1 -0
  53. package/vendor/@orient-cli/coding-agent/dist/core/compaction/compaction.js.map +1 -0
  54. package/vendor/@orient-cli/coding-agent/dist/core/compaction/index.d.ts.map +1 -0
  55. package/vendor/@orient-cli/coding-agent/dist/core/compaction/utils.d.ts.map +1 -0
  56. package/vendor/@orient-cli/coding-agent/dist/core/compaction/utils.js.map +1 -0
  57. package/vendor/@orient-cli/coding-agent/dist/core/defaults.d.ts.map +1 -0
  58. package/vendor/@orient-cli/coding-agent/dist/core/diagnostics.d.ts.map +1 -0
  59. package/vendor/@orient-cli/coding-agent/dist/core/event-bus.d.ts.map +1 -0
  60. package/vendor/@orient-cli/coding-agent/dist/core/event-bus.js.map +1 -0
  61. package/vendor/@orient-cli/coding-agent/dist/core/exec.d.ts.map +1 -0
  62. package/vendor/@orient-cli/coding-agent/dist/core/exec.js.map +1 -0
  63. package/vendor/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
  64. package/vendor/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.js.map +1 -0
  65. package/vendor/@orient-cli/coding-agent/dist/core/export-html/index.d.ts.map +1 -0
  66. package/vendor/@orient-cli/coding-agent/dist/core/export-html/index.js.map +1 -0
  67. package/vendor/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.d.ts.map +1 -0
  68. package/vendor/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.js.map +1 -0
  69. package/vendor/@orient-cli/coding-agent/dist/core/extensions/index.d.ts.map +1 -0
  70. package/vendor/@orient-cli/coding-agent/dist/core/extensions/loader.d.ts.map +1 -0
  71. package/vendor/@orient-cli/coding-agent/dist/core/extensions/loader.js.map +1 -0
  72. package/vendor/@orient-cli/coding-agent/dist/core/extensions/runner.d.ts.map +1 -0
  73. package/vendor/@orient-cli/coding-agent/dist/core/extensions/runner.js +695 -0
  74. package/vendor/@orient-cli/coding-agent/dist/core/extensions/runner.js.map +1 -0
  75. package/vendor/@orient-cli/coding-agent/dist/core/extensions/types.d.ts.map +1 -0
  76. package/vendor/@orient-cli/coding-agent/dist/core/extensions/types.js.map +1 -0
  77. package/vendor/@orient-cli/coding-agent/dist/core/extensions/wrapper.d.ts.map +1 -0
  78. package/vendor/@orient-cli/coding-agent/dist/core/extensions/wrapper.js.map +1 -0
  79. package/vendor/@orient-cli/coding-agent/dist/core/footer-data-provider.d.ts.map +1 -0
  80. package/vendor/@orient-cli/coding-agent/dist/core/footer-data-provider.js +313 -0
  81. package/vendor/@orient-cli/coding-agent/dist/core/footer-data-provider.js.map +1 -0
  82. package/vendor/@orient-cli/coding-agent/dist/core/index.d.ts.map +1 -0
  83. package/vendor/@orient-cli/coding-agent/dist/core/keybindings.d.ts +293 -0
  84. package/vendor/@orient-cli/coding-agent/dist/core/keybindings.d.ts.map +1 -0
  85. package/vendor/@orient-cli/coding-agent/dist/core/keybindings.js +247 -0
  86. package/vendor/@orient-cli/coding-agent/dist/core/keybindings.js.map +1 -0
  87. package/vendor/@orient-cli/coding-agent/dist/core/messages.d.ts.map +1 -0
  88. package/vendor/@orient-cli/coding-agent/dist/core/messages.js.map +1 -0
  89. package/vendor/@orient-cli/coding-agent/dist/core/model-registry.d.ts.map +1 -0
  90. package/vendor/@orient-cli/coding-agent/dist/core/model-registry.js +612 -0
  91. package/vendor/@orient-cli/coding-agent/dist/core/model-registry.js.map +1 -0
  92. package/vendor/@orient-cli/coding-agent/dist/core/model-resolver.d.ts.map +1 -0
  93. package/vendor/@orient-cli/coding-agent/dist/core/model-resolver.js.map +1 -0
  94. package/vendor/@orient-cli/coding-agent/dist/core/output-guard.d.ts.map +1 -0
  95. package/vendor/@orient-cli/coding-agent/dist/core/output-guard.js.map +1 -0
  96. package/vendor/@orient-cli/coding-agent/dist/core/package-manager.d.ts.map +1 -0
  97. package/vendor/@orient-cli/coding-agent/dist/core/package-manager.js +1823 -0
  98. package/vendor/@orient-cli/coding-agent/dist/core/package-manager.js.map +1 -0
  99. package/vendor/@orient-cli/coding-agent/dist/core/prompt-templates.d.ts.map +1 -0
  100. package/vendor/@orient-cli/coding-agent/dist/core/prompt-templates.js.map +1 -0
  101. package/vendor/@orient-cli/coding-agent/dist/core/resolve-config-value.d.ts.map +1 -0
  102. package/vendor/@orient-cli/coding-agent/dist/core/resolve-config-value.js.map +1 -0
  103. package/vendor/@orient-cli/coding-agent/dist/core/resource-loader.d.ts.map +1 -0
  104. package/vendor/@orient-cli/coding-agent/dist/core/resource-loader.js +681 -0
  105. package/vendor/@orient-cli/coding-agent/dist/core/resource-loader.js.map +1 -0
  106. package/vendor/@orient-cli/coding-agent/dist/core/sdk.d.ts.map +1 -0
  107. package/vendor/@orient-cli/coding-agent/dist/core/sdk.js.map +1 -0
  108. package/vendor/@orient-cli/coding-agent/dist/core/session-cwd.d.ts.map +1 -0
  109. package/vendor/@orient-cli/coding-agent/dist/core/session-cwd.js +37 -0
  110. package/vendor/@orient-cli/coding-agent/dist/core/session-cwd.js.map +1 -0
  111. package/vendor/@orient-cli/coding-agent/dist/core/session-manager.d.ts.map +1 -0
  112. package/vendor/@orient-cli/coding-agent/dist/core/session-manager.js +1101 -0
  113. package/vendor/@orient-cli/coding-agent/dist/core/session-manager.js.map +1 -0
  114. package/vendor/@orient-cli/coding-agent/dist/core/settings-manager.d.ts.map +1 -0
  115. package/vendor/@orient-cli/coding-agent/dist/core/settings-manager.js +699 -0
  116. package/vendor/@orient-cli/coding-agent/dist/core/settings-manager.js.map +1 -0
  117. package/vendor/@orient-cli/coding-agent/dist/core/skills.d.ts.map +1 -0
  118. package/vendor/@orient-cli/coding-agent/dist/core/skills.js.map +1 -0
  119. package/vendor/@orient-cli/coding-agent/dist/core/slash-commands.d.ts.map +1 -0
  120. package/vendor/@orient-cli/coding-agent/dist/core/source-info.d.ts.map +1 -0
  121. package/vendor/@orient-cli/coding-agent/dist/core/source-info.js.map +1 -0
  122. package/vendor/@orient-cli/coding-agent/dist/core/system-prompt.d.ts.map +1 -0
  123. package/vendor/@orient-cli/coding-agent/dist/core/system-prompt.js.map +1 -0
  124. package/vendor/@orient-cli/coding-agent/dist/core/timings.d.ts.map +1 -0
  125. package/vendor/@orient-cli/coding-agent/dist/core/timings.js.map +1 -0
  126. package/vendor/@orient-cli/coding-agent/dist/core/tools/bash.d.ts.map +1 -0
  127. package/vendor/@orient-cli/coding-agent/dist/core/tools/bash.js +355 -0
  128. package/vendor/@orient-cli/coding-agent/dist/core/tools/bash.js.map +1 -0
  129. package/vendor/@orient-cli/coding-agent/dist/core/tools/edit-diff.d.ts.map +1 -0
  130. package/vendor/@orient-cli/coding-agent/dist/core/tools/edit-diff.js.map +1 -0
  131. package/vendor/@orient-cli/coding-agent/dist/core/tools/edit.d.ts.map +1 -0
  132. package/vendor/@orient-cli/coding-agent/dist/core/tools/edit.js.map +1 -0
  133. package/vendor/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
  134. package/vendor/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.js.map +1 -0
  135. package/vendor/@orient-cli/coding-agent/dist/core/tools/find.d.ts.map +1 -0
  136. package/vendor/@orient-cli/coding-agent/dist/core/tools/find.js.map +1 -0
  137. package/vendor/@orient-cli/coding-agent/dist/core/tools/grep.d.ts.map +1 -0
  138. package/vendor/@orient-cli/coding-agent/dist/core/tools/grep.js.map +1 -0
  139. package/vendor/@orient-cli/coding-agent/dist/core/tools/index.d.ts.map +1 -0
  140. package/vendor/@orient-cli/coding-agent/dist/core/tools/index.js.map +1 -0
  141. package/vendor/@orient-cli/coding-agent/dist/core/tools/ls.d.ts.map +1 -0
  142. package/vendor/@orient-cli/coding-agent/dist/core/tools/ls.js.map +1 -0
  143. package/vendor/@orient-cli/coding-agent/dist/core/tools/path-utils.d.ts.map +1 -0
  144. package/vendor/@orient-cli/coding-agent/dist/core/tools/path-utils.js.map +1 -0
  145. package/vendor/@orient-cli/coding-agent/dist/core/tools/read.d.ts.map +1 -0
  146. package/vendor/@orient-cli/coding-agent/dist/core/tools/read.js.map +1 -0
  147. package/vendor/@orient-cli/coding-agent/dist/core/tools/render-utils.d.ts.map +1 -0
  148. package/vendor/@orient-cli/coding-agent/dist/core/tools/render-utils.js.map +1 -0
  149. package/vendor/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
  150. package/vendor/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.js.map +1 -0
  151. package/vendor/@orient-cli/coding-agent/dist/core/tools/truncate.d.ts.map +1 -0
  152. package/vendor/@orient-cli/coding-agent/dist/core/tools/truncate.js.map +1 -0
  153. package/vendor/@orient-cli/coding-agent/dist/core/tools/write.d.ts.map +1 -0
  154. package/vendor/@orient-cli/coding-agent/dist/core/tools/write.js +215 -0
  155. package/vendor/@orient-cli/coding-agent/dist/core/tools/write.js.map +1 -0
  156. package/vendor/@orient-cli/coding-agent/dist/index.d.ts.map +1 -0
  157. package/vendor/@orient-cli/coding-agent/dist/main.d.ts.map +1 -0
  158. package/vendor/@orient-cli/coding-agent/dist/main.js.map +1 -0
  159. package/vendor/@orient-cli/coding-agent/dist/migrations.d.ts.map +1 -0
  160. package/vendor/@orient-cli/coding-agent/dist/migrations.js.map +1 -0
  161. package/vendor/@orient-cli/coding-agent/dist/modes/index.d.ts.map +1 -0
  162. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
  163. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.js +102 -0
  164. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -0
  165. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
  166. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.js +170 -0
  167. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.js.map +1 -0
  168. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
  169. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.js +48 -0
  170. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.js.map +1 -0
  171. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
  172. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.js +42 -0
  173. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
  174. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
  175. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.js +43 -0
  176. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
  177. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
  178. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.js +470 -0
  179. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.js.map +1 -0
  180. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
  181. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.js +28 -0
  182. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.js.map +1 -0
  183. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
  184. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.js +63 -0
  185. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.js.map +1 -0
  186. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
  187. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.js +74 -0
  188. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.js.map +1 -0
  189. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/diff.d.ts.map +1 -0
  190. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/diff.js.map +1 -0
  191. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
  192. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.js +20 -0
  193. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.js.map +1 -0
  194. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
  195. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.js +106 -0
  196. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.js.map +1 -0
  197. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
  198. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.js +55 -0
  199. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.js.map +1 -0
  200. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
  201. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.js +71 -0
  202. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.js.map +1 -0
  203. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -0
  204. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/footer.js +199 -0
  205. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/footer.js.map +1 -0
  206. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/index.d.ts.map +1 -0
  207. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/index.js.map +1 -0
  208. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
  209. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
  210. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
  211. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.js +139 -0
  212. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.js.map +1 -0
  213. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
  214. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.js +263 -0
  215. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.js.map +1 -0
  216. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
  217. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.js +92 -0
  218. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.js.map +1 -0
  219. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.d.ts.map +1 -0
  220. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.js.map +1 -0
  221. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
  222. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.js +271 -0
  223. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
  224. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
  225. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.js.map +1 -0
  226. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
  227. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.js +823 -0
  228. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.js.map +1 -0
  229. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
  230. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.js +299 -0
  231. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.js.map +1 -0
  232. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
  233. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.js +38 -0
  234. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.js.map +1 -0
  235. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
  236. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.js +45 -0
  237. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
  238. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
  239. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.js +48 -0
  240. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.js.map +1 -0
  241. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
  242. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.js +50 -0
  243. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.js.map +1 -0
  244. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
  245. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.js +261 -0
  246. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -0
  247. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
  248. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.js +1070 -0
  249. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.js.map +1 -0
  250. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
  251. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.js +110 -0
  252. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.js.map +1 -0
  253. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.d.ts.map +1 -0
  254. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.js.map +1 -0
  255. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
  256. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.js.map +1 -0
  257. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.d.ts +359 -0
  258. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
  259. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.js +4081 -0
  260. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -0
  261. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -0
  262. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.js +973 -0
  263. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.js.map +1 -0
  264. package/vendor/@orient-cli/coding-agent/dist/modes/print-mode.d.ts.map +1 -0
  265. package/vendor/@orient-cli/coding-agent/dist/modes/print-mode.js.map +1 -0
  266. package/vendor/@orient-cli/coding-agent/dist/modes/rpc/jsonl.d.ts.map +1 -0
  267. package/vendor/@orient-cli/coding-agent/dist/modes/rpc/jsonl.js.map +1 -0
  268. package/vendor/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.d.ts.map +1 -0
  269. package/vendor/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.js +401 -0
  270. package/vendor/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.js.map +1 -0
  271. package/vendor/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
  272. package/vendor/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -0
  273. package/vendor/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.d.ts.map +1 -0
  274. package/vendor/@orient-cli/coding-agent/dist/package-manager-cli.d.ts.map +1 -0
  275. package/vendor/@orient-cli/coding-agent/dist/package-manager-cli.js.map +1 -0
  276. package/vendor/@orient-cli/coding-agent/dist/utils/changelog.d.ts.map +1 -0
  277. package/vendor/@orient-cli/coding-agent/dist/utils/changelog.js.map +1 -0
  278. package/vendor/@orient-cli/coding-agent/dist/utils/child-process.d.ts.map +1 -0
  279. package/vendor/@orient-cli/coding-agent/dist/utils/child-process.js.map +1 -0
  280. package/vendor/@orient-cli/coding-agent/dist/utils/clipboard-image.d.ts.map +1 -0
  281. package/vendor/@orient-cli/coding-agent/dist/utils/clipboard-image.js.map +1 -0
  282. package/vendor/@orient-cli/coding-agent/dist/utils/clipboard-native.d.ts.map +1 -0
  283. package/vendor/@orient-cli/coding-agent/dist/utils/clipboard-native.js.map +1 -0
  284. package/vendor/@orient-cli/coding-agent/dist/utils/clipboard.d.ts.map +1 -0
  285. package/vendor/@orient-cli/coding-agent/dist/utils/clipboard.js.map +1 -0
  286. package/vendor/@orient-cli/coding-agent/dist/utils/exif-orientation.d.ts.map +1 -0
  287. package/vendor/@orient-cli/coding-agent/dist/utils/exif-orientation.js.map +1 -0
  288. package/vendor/@orient-cli/coding-agent/dist/utils/frontmatter.d.ts.map +1 -0
  289. package/vendor/@orient-cli/coding-agent/dist/utils/frontmatter.js.map +1 -0
  290. package/vendor/@orient-cli/coding-agent/dist/utils/git.d.ts.map +1 -0
  291. package/vendor/@orient-cli/coding-agent/dist/utils/git.js.map +1 -0
  292. package/vendor/@orient-cli/coding-agent/dist/utils/image-convert.d.ts.map +1 -0
  293. package/vendor/@orient-cli/coding-agent/dist/utils/image-convert.js.map +1 -0
  294. package/vendor/@orient-cli/coding-agent/dist/utils/image-resize.d.ts.map +1 -0
  295. package/vendor/@orient-cli/coding-agent/dist/utils/image-resize.js.map +1 -0
  296. package/vendor/@orient-cli/coding-agent/dist/utils/mime.d.ts.map +1 -0
  297. package/vendor/@orient-cli/coding-agent/dist/utils/mime.js.map +1 -0
  298. package/vendor/@orient-cli/coding-agent/dist/utils/paths.d.ts.map +1 -0
  299. package/vendor/@orient-cli/coding-agent/dist/utils/paths.js.map +1 -0
  300. package/vendor/@orient-cli/coding-agent/dist/utils/photon.d.ts.map +1 -0
  301. package/vendor/@orient-cli/coding-agent/dist/utils/photon.js.map +1 -0
  302. package/vendor/@orient-cli/coding-agent/dist/utils/shell.d.ts.map +1 -0
  303. package/vendor/@orient-cli/coding-agent/dist/utils/shell.js.map +1 -0
  304. package/vendor/@orient-cli/coding-agent/dist/utils/sleep.d.ts.map +1 -0
  305. package/vendor/@orient-cli/coding-agent/dist/utils/sleep.js.map +1 -0
  306. package/vendor/@orient-cli/coding-agent/dist/utils/tools-manager.d.ts.map +1 -0
  307. package/vendor/@orient-cli/coding-agent/dist/utils/tools-manager.js.map +1 -0
  308. package/node_modules/@orient-cli/agent-core/README.md +0 -456
  309. package/node_modules/@orient-cli/ai/README.md +0 -1315
  310. package/node_modules/@orient-cli/coding-agent/README.md +0 -618
  311. package/node_modules/@orient-cli/coding-agent/dist/bun/cli.d.ts.map +0 -1
  312. package/node_modules/@orient-cli/coding-agent/dist/bun/cli.js.map +0 -1
  313. package/node_modules/@orient-cli/coding-agent/dist/bun/register-bedrock.d.ts.map +0 -1
  314. package/node_modules/@orient-cli/coding-agent/dist/cli/args.d.ts.map +0 -1
  315. package/node_modules/@orient-cli/coding-agent/dist/cli/args.js.map +0 -1
  316. package/node_modules/@orient-cli/coding-agent/dist/cli/config-selector.d.ts.map +0 -1
  317. package/node_modules/@orient-cli/coding-agent/dist/cli/config-selector.js.map +0 -1
  318. package/node_modules/@orient-cli/coding-agent/dist/cli/file-processor.d.ts.map +0 -1
  319. package/node_modules/@orient-cli/coding-agent/dist/cli/file-processor.js.map +0 -1
  320. package/node_modules/@orient-cli/coding-agent/dist/cli/initial-message.d.ts +0 -18
  321. package/node_modules/@orient-cli/coding-agent/dist/cli/initial-message.d.ts.map +0 -1
  322. package/node_modules/@orient-cli/coding-agent/dist/cli/initial-message.js.map +0 -1
  323. package/node_modules/@orient-cli/coding-agent/dist/cli/list-models.d.ts.map +0 -1
  324. package/node_modules/@orient-cli/coding-agent/dist/cli/list-models.js.map +0 -1
  325. package/node_modules/@orient-cli/coding-agent/dist/cli/session-picker.d.ts.map +0 -1
  326. package/node_modules/@orient-cli/coding-agent/dist/cli/session-picker.js.map +0 -1
  327. package/node_modules/@orient-cli/coding-agent/dist/cli.d.ts.map +0 -1
  328. package/node_modules/@orient-cli/coding-agent/dist/cli.js.map +0 -1
  329. package/node_modules/@orient-cli/coding-agent/dist/config.d.ts.map +0 -1
  330. package/node_modules/@orient-cli/coding-agent/dist/config.js +0 -229
  331. package/node_modules/@orient-cli/coding-agent/dist/config.js.map +0 -1
  332. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-runtime.d.ts.map +0 -1
  333. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-runtime.js +0 -236
  334. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-runtime.js.map +0 -1
  335. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-services.d.ts.map +0 -1
  336. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-services.js.map +0 -1
  337. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session.d.ts +0 -585
  338. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session.d.ts.map +0 -1
  339. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session.js +0 -2497
  340. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session.js.map +0 -1
  341. package/node_modules/@orient-cli/coding-agent/dist/core/auth-storage.d.ts +0 -132
  342. package/node_modules/@orient-cli/coding-agent/dist/core/auth-storage.d.ts.map +0 -1
  343. package/node_modules/@orient-cli/coding-agent/dist/core/auth-storage.js +0 -422
  344. package/node_modules/@orient-cli/coding-agent/dist/core/auth-storage.js.map +0 -1
  345. package/node_modules/@orient-cli/coding-agent/dist/core/bash-executor.d.ts.map +0 -1
  346. package/node_modules/@orient-cli/coding-agent/dist/core/bash-executor.js.map +0 -1
  347. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.d.ts.map +0 -1
  348. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.js.map +0 -1
  349. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/compaction.d.ts.map +0 -1
  350. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/compaction.js.map +0 -1
  351. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/index.d.ts.map +0 -1
  352. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/utils.d.ts.map +0 -1
  353. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/utils.js.map +0 -1
  354. package/node_modules/@orient-cli/coding-agent/dist/core/defaults.d.ts.map +0 -1
  355. package/node_modules/@orient-cli/coding-agent/dist/core/diagnostics.d.ts.map +0 -1
  356. package/node_modules/@orient-cli/coding-agent/dist/core/event-bus.d.ts.map +0 -1
  357. package/node_modules/@orient-cli/coding-agent/dist/core/event-bus.js.map +0 -1
  358. package/node_modules/@orient-cli/coding-agent/dist/core/exec.d.ts.map +0 -1
  359. package/node_modules/@orient-cli/coding-agent/dist/core/exec.js.map +0 -1
  360. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.d.ts.map +0 -1
  361. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.js.map +0 -1
  362. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/index.d.ts.map +0 -1
  363. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/index.js.map +0 -1
  364. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/template.css +0 -1001
  365. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/template.html +0 -55
  366. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/template.js +0 -1690
  367. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.d.ts.map +0 -1
  368. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.js.map +0 -1
  369. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/vendor/highlight.min.js +0 -1213
  370. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/vendor/marked.min.js +0 -6
  371. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/index.d.ts.map +0 -1
  372. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/loader.d.ts.map +0 -1
  373. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/loader.js.map +0 -1
  374. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/runner.d.ts.map +0 -1
  375. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/runner.js +0 -701
  376. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/runner.js.map +0 -1
  377. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/types.d.ts.map +0 -1
  378. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/types.js.map +0 -1
  379. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/wrapper.d.ts.map +0 -1
  380. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/wrapper.js.map +0 -1
  381. package/node_modules/@orient-cli/coding-agent/dist/core/footer-data-provider.d.ts.map +0 -1
  382. package/node_modules/@orient-cli/coding-agent/dist/core/footer-data-provider.js +0 -314
  383. package/node_modules/@orient-cli/coding-agent/dist/core/footer-data-provider.js.map +0 -1
  384. package/node_modules/@orient-cli/coding-agent/dist/core/index.d.ts.map +0 -1
  385. package/node_modules/@orient-cli/coding-agent/dist/core/keybindings.d.ts +0 -293
  386. package/node_modules/@orient-cli/coding-agent/dist/core/keybindings.d.ts.map +0 -1
  387. package/node_modules/@orient-cli/coding-agent/dist/core/keybindings.js +0 -248
  388. package/node_modules/@orient-cli/coding-agent/dist/core/keybindings.js.map +0 -1
  389. package/node_modules/@orient-cli/coding-agent/dist/core/messages.d.ts.map +0 -1
  390. package/node_modules/@orient-cli/coding-agent/dist/core/messages.js.map +0 -1
  391. package/node_modules/@orient-cli/coding-agent/dist/core/model-registry.d.ts.map +0 -1
  392. package/node_modules/@orient-cli/coding-agent/dist/core/model-registry.js +0 -612
  393. package/node_modules/@orient-cli/coding-agent/dist/core/model-registry.js.map +0 -1
  394. package/node_modules/@orient-cli/coding-agent/dist/core/model-resolver.d.ts.map +0 -1
  395. package/node_modules/@orient-cli/coding-agent/dist/core/model-resolver.js.map +0 -1
  396. package/node_modules/@orient-cli/coding-agent/dist/core/output-guard.d.ts.map +0 -1
  397. package/node_modules/@orient-cli/coding-agent/dist/core/output-guard.js.map +0 -1
  398. package/node_modules/@orient-cli/coding-agent/dist/core/package-manager.d.ts.map +0 -1
  399. package/node_modules/@orient-cli/coding-agent/dist/core/package-manager.js +0 -1829
  400. package/node_modules/@orient-cli/coding-agent/dist/core/package-manager.js.map +0 -1
  401. package/node_modules/@orient-cli/coding-agent/dist/core/prompt-templates.d.ts.map +0 -1
  402. package/node_modules/@orient-cli/coding-agent/dist/core/prompt-templates.js.map +0 -1
  403. package/node_modules/@orient-cli/coding-agent/dist/core/resolve-config-value.d.ts.map +0 -1
  404. package/node_modules/@orient-cli/coding-agent/dist/core/resolve-config-value.js.map +0 -1
  405. package/node_modules/@orient-cli/coding-agent/dist/core/resource-loader.d.ts.map +0 -1
  406. package/node_modules/@orient-cli/coding-agent/dist/core/resource-loader.js +0 -720
  407. package/node_modules/@orient-cli/coding-agent/dist/core/resource-loader.js.map +0 -1
  408. package/node_modules/@orient-cli/coding-agent/dist/core/sdk.d.ts.map +0 -1
  409. package/node_modules/@orient-cli/coding-agent/dist/core/sdk.js.map +0 -1
  410. package/node_modules/@orient-cli/coding-agent/dist/core/session-cwd.d.ts.map +0 -1
  411. package/node_modules/@orient-cli/coding-agent/dist/core/session-cwd.js +0 -38
  412. package/node_modules/@orient-cli/coding-agent/dist/core/session-cwd.js.map +0 -1
  413. package/node_modules/@orient-cli/coding-agent/dist/core/session-manager.d.ts.map +0 -1
  414. package/node_modules/@orient-cli/coding-agent/dist/core/session-manager.js +0 -1105
  415. package/node_modules/@orient-cli/coding-agent/dist/core/session-manager.js.map +0 -1
  416. package/node_modules/@orient-cli/coding-agent/dist/core/settings-manager.d.ts.map +0 -1
  417. package/node_modules/@orient-cli/coding-agent/dist/core/settings-manager.js +0 -708
  418. package/node_modules/@orient-cli/coding-agent/dist/core/settings-manager.js.map +0 -1
  419. package/node_modules/@orient-cli/coding-agent/dist/core/skills.d.ts.map +0 -1
  420. package/node_modules/@orient-cli/coding-agent/dist/core/skills.js.map +0 -1
  421. package/node_modules/@orient-cli/coding-agent/dist/core/slash-commands.d.ts.map +0 -1
  422. package/node_modules/@orient-cli/coding-agent/dist/core/source-info.d.ts.map +0 -1
  423. package/node_modules/@orient-cli/coding-agent/dist/core/source-info.js.map +0 -1
  424. package/node_modules/@orient-cli/coding-agent/dist/core/system-prompt.d.ts.map +0 -1
  425. package/node_modules/@orient-cli/coding-agent/dist/core/system-prompt.js.map +0 -1
  426. package/node_modules/@orient-cli/coding-agent/dist/core/timings.d.ts.map +0 -1
  427. package/node_modules/@orient-cli/coding-agent/dist/core/timings.js.map +0 -1
  428. package/node_modules/@orient-cli/coding-agent/dist/core/tools/bash.d.ts.map +0 -1
  429. package/node_modules/@orient-cli/coding-agent/dist/core/tools/bash.js +0 -352
  430. package/node_modules/@orient-cli/coding-agent/dist/core/tools/bash.js.map +0 -1
  431. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit-diff.d.ts.map +0 -1
  432. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit-diff.js.map +0 -1
  433. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit.d.ts.map +0 -1
  434. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit.js.map +0 -1
  435. package/node_modules/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.d.ts.map +0 -1
  436. package/node_modules/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.js.map +0 -1
  437. package/node_modules/@orient-cli/coding-agent/dist/core/tools/find.d.ts.map +0 -1
  438. package/node_modules/@orient-cli/coding-agent/dist/core/tools/find.js.map +0 -1
  439. package/node_modules/@orient-cli/coding-agent/dist/core/tools/grep.d.ts.map +0 -1
  440. package/node_modules/@orient-cli/coding-agent/dist/core/tools/grep.js.map +0 -1
  441. package/node_modules/@orient-cli/coding-agent/dist/core/tools/index.d.ts.map +0 -1
  442. package/node_modules/@orient-cli/coding-agent/dist/core/tools/index.js.map +0 -1
  443. package/node_modules/@orient-cli/coding-agent/dist/core/tools/ls.d.ts.map +0 -1
  444. package/node_modules/@orient-cli/coding-agent/dist/core/tools/ls.js.map +0 -1
  445. package/node_modules/@orient-cli/coding-agent/dist/core/tools/path-utils.d.ts.map +0 -1
  446. package/node_modules/@orient-cli/coding-agent/dist/core/tools/path-utils.js.map +0 -1
  447. package/node_modules/@orient-cli/coding-agent/dist/core/tools/read.d.ts.map +0 -1
  448. package/node_modules/@orient-cli/coding-agent/dist/core/tools/read.js.map +0 -1
  449. package/node_modules/@orient-cli/coding-agent/dist/core/tools/render-utils.d.ts.map +0 -1
  450. package/node_modules/@orient-cli/coding-agent/dist/core/tools/render-utils.js.map +0 -1
  451. package/node_modules/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.d.ts.map +0 -1
  452. package/node_modules/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.js.map +0 -1
  453. package/node_modules/@orient-cli/coding-agent/dist/core/tools/truncate.d.ts.map +0 -1
  454. package/node_modules/@orient-cli/coding-agent/dist/core/tools/truncate.js.map +0 -1
  455. package/node_modules/@orient-cli/coding-agent/dist/core/tools/write.d.ts.map +0 -1
  456. package/node_modules/@orient-cli/coding-agent/dist/core/tools/write.js +0 -216
  457. package/node_modules/@orient-cli/coding-agent/dist/core/tools/write.js.map +0 -1
  458. package/node_modules/@orient-cli/coding-agent/dist/index.d.ts.map +0 -1
  459. package/node_modules/@orient-cli/coding-agent/dist/main.d.ts.map +0 -1
  460. package/node_modules/@orient-cli/coding-agent/dist/main.js.map +0 -1
  461. package/node_modules/@orient-cli/coding-agent/dist/migrations.d.ts.map +0 -1
  462. package/node_modules/@orient-cli/coding-agent/dist/migrations.js.map +0 -1
  463. package/node_modules/@orient-cli/coding-agent/dist/modes/index.d.ts.map +0 -1
  464. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +0 -1
  465. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.js +0 -107
  466. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.js.map +0 -1
  467. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.d.ts.map +0 -1
  468. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.js +0 -175
  469. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.js.map +0 -1
  470. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.d.ts.map +0 -1
  471. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.js +0 -51
  472. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.js.map +0 -1
  473. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts.map +0 -1
  474. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.js +0 -44
  475. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.js.map +0 -1
  476. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts.map +0 -1
  477. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.js +0 -45
  478. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.js.map +0 -1
  479. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.d.ts.map +0 -1
  480. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.js +0 -479
  481. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.js.map +0 -1
  482. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.d.ts.map +0 -1
  483. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.js +0 -33
  484. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.js.map +0 -1
  485. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.d.ts.map +0 -1
  486. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.js +0 -70
  487. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.js.map +0 -1
  488. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.d.ts.map +0 -1
  489. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.js +0 -79
  490. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.js.map +0 -1
  491. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/diff.d.ts.map +0 -1
  492. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/diff.js.map +0 -1
  493. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.d.ts.map +0 -1
  494. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.js +0 -21
  495. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.js.map +0 -1
  496. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.d.ts.map +0 -1
  497. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.js +0 -111
  498. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.js.map +0 -1
  499. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.d.ts.map +0 -1
  500. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.js +0 -61
  501. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.js.map +0 -1
  502. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.d.ts.map +0 -1
  503. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.js +0 -78
  504. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.js.map +0 -1
  505. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/footer.d.ts.map +0 -1
  506. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/footer.js +0 -201
  507. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/footer.js.map +0 -1
  508. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/index.d.ts.map +0 -1
  509. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/index.js.map +0 -1
  510. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.d.ts.map +0 -1
  511. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.js.map +0 -1
  512. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.d.ts.map +0 -1
  513. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.js +0 -145
  514. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.js.map +0 -1
  515. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.d.ts.map +0 -1
  516. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.js +0 -275
  517. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.js.map +0 -1
  518. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.d.ts.map +0 -1
  519. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.js +0 -97
  520. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.js.map +0 -1
  521. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.d.ts.map +0 -1
  522. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.js.map +0 -1
  523. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.d.ts.map +0 -1
  524. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.js +0 -275
  525. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.js.map +0 -1
  526. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.d.ts.map +0 -1
  527. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.js.map +0 -1
  528. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.d.ts.map +0 -1
  529. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.js +0 -848
  530. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.js.map +0 -1
  531. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.d.ts.map +0 -1
  532. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.js +0 -301
  533. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.js.map +0 -1
  534. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.d.ts.map +0 -1
  535. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.js +0 -39
  536. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.js.map +0 -1
  537. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts.map +0 -1
  538. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.js +0 -47
  539. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.js.map +0 -1
  540. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.d.ts.map +0 -1
  541. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.js +0 -50
  542. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.js.map +0 -1
  543. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.d.ts.map +0 -1
  544. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.js +0 -51
  545. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.js.map +0 -1
  546. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +0 -1
  547. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.js +0 -274
  548. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.js.map +0 -1
  549. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.d.ts.map +0 -1
  550. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.js +0 -1084
  551. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.js.map +0 -1
  552. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.d.ts.map +0 -1
  553. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.js +0 -113
  554. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.js.map +0 -1
  555. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.d.ts.map +0 -1
  556. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.js.map +0 -1
  557. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.d.ts.map +0 -1
  558. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.js.map +0 -1
  559. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.d.ts +0 -345
  560. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +0 -1
  561. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.js +0 -4106
  562. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.js.map +0 -1
  563. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/dark.json +0 -85
  564. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/light.json +0 -84
  565. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme-schema.json +0 -335
  566. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.d.ts.map +0 -1
  567. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.js +0 -979
  568. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.js.map +0 -1
  569. package/node_modules/@orient-cli/coding-agent/dist/modes/print-mode.d.ts.map +0 -1
  570. package/node_modules/@orient-cli/coding-agent/dist/modes/print-mode.js.map +0 -1
  571. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/jsonl.d.ts.map +0 -1
  572. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/jsonl.js.map +0 -1
  573. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.d.ts.map +0 -1
  574. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.js +0 -402
  575. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.js.map +0 -1
  576. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +0 -1
  577. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.js.map +0 -1
  578. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.d.ts.map +0 -1
  579. package/node_modules/@orient-cli/coding-agent/dist/package-manager-cli.d.ts.map +0 -1
  580. package/node_modules/@orient-cli/coding-agent/dist/package-manager-cli.js.map +0 -1
  581. package/node_modules/@orient-cli/coding-agent/dist/utils/changelog.d.ts.map +0 -1
  582. package/node_modules/@orient-cli/coding-agent/dist/utils/changelog.js.map +0 -1
  583. package/node_modules/@orient-cli/coding-agent/dist/utils/child-process.d.ts.map +0 -1
  584. package/node_modules/@orient-cli/coding-agent/dist/utils/child-process.js.map +0 -1
  585. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-image.d.ts.map +0 -1
  586. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-image.js.map +0 -1
  587. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-native.d.ts.map +0 -1
  588. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-native.js.map +0 -1
  589. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard.d.ts.map +0 -1
  590. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard.js.map +0 -1
  591. package/node_modules/@orient-cli/coding-agent/dist/utils/exif-orientation.d.ts.map +0 -1
  592. package/node_modules/@orient-cli/coding-agent/dist/utils/exif-orientation.js.map +0 -1
  593. package/node_modules/@orient-cli/coding-agent/dist/utils/frontmatter.d.ts.map +0 -1
  594. package/node_modules/@orient-cli/coding-agent/dist/utils/frontmatter.js.map +0 -1
  595. package/node_modules/@orient-cli/coding-agent/dist/utils/git.d.ts.map +0 -1
  596. package/node_modules/@orient-cli/coding-agent/dist/utils/git.js.map +0 -1
  597. package/node_modules/@orient-cli/coding-agent/dist/utils/image-convert.d.ts.map +0 -1
  598. package/node_modules/@orient-cli/coding-agent/dist/utils/image-convert.js.map +0 -1
  599. package/node_modules/@orient-cli/coding-agent/dist/utils/image-resize.d.ts.map +0 -1
  600. package/node_modules/@orient-cli/coding-agent/dist/utils/image-resize.js.map +0 -1
  601. package/node_modules/@orient-cli/coding-agent/dist/utils/mime.d.ts.map +0 -1
  602. package/node_modules/@orient-cli/coding-agent/dist/utils/mime.js.map +0 -1
  603. package/node_modules/@orient-cli/coding-agent/dist/utils/paths.d.ts.map +0 -1
  604. package/node_modules/@orient-cli/coding-agent/dist/utils/paths.js.map +0 -1
  605. package/node_modules/@orient-cli/coding-agent/dist/utils/photon.d.ts.map +0 -1
  606. package/node_modules/@orient-cli/coding-agent/dist/utils/photon.js.map +0 -1
  607. package/node_modules/@orient-cli/coding-agent/dist/utils/shell.d.ts.map +0 -1
  608. package/node_modules/@orient-cli/coding-agent/dist/utils/shell.js.map +0 -1
  609. package/node_modules/@orient-cli/coding-agent/dist/utils/sleep.d.ts.map +0 -1
  610. package/node_modules/@orient-cli/coding-agent/dist/utils/sleep.js.map +0 -1
  611. package/node_modules/@orient-cli/coding-agent/dist/utils/tools-manager.d.ts.map +0 -1
  612. package/node_modules/@orient-cli/coding-agent/dist/utils/tools-manager.js.map +0 -1
  613. package/node_modules/@orient-cli/tui/README.md +0 -767
  614. package/node_modules/mime-db/HISTORY.md +0 -541
  615. package/node_modules/mime-db/LICENSE +0 -23
  616. package/node_modules/mime-db/README.md +0 -109
  617. package/node_modules/mime-db/db.json +0 -9342
  618. package/node_modules/mime-db/index.js +0 -12
  619. package/node_modules/mime-db/package.json +0 -56
  620. package/node_modules/mime-types/HISTORY.md +0 -428
  621. package/node_modules/mime-types/LICENSE +0 -23
  622. package/node_modules/mime-types/README.md +0 -126
  623. package/node_modules/mime-types/index.js +0 -211
  624. package/node_modules/mime-types/mimeScore.js +0 -57
  625. package/node_modules/mime-types/package.json +0 -49
  626. /package/{node_modules → vendor}/@orient-cli/agent-core/dist/agent-loop.d.ts +0 -0
  627. /package/{node_modules → vendor}/@orient-cli/agent-core/dist/agent-loop.d.ts.map +0 -0
  628. /package/{node_modules → vendor}/@orient-cli/agent-core/dist/agent-loop.js +0 -0
  629. /package/{node_modules → vendor}/@orient-cli/agent-core/dist/agent-loop.js.map +0 -0
  630. /package/{node_modules → vendor}/@orient-cli/agent-core/dist/agent.d.ts +0 -0
  631. /package/{node_modules → vendor}/@orient-cli/agent-core/dist/agent.d.ts.map +0 -0
  632. /package/{node_modules → vendor}/@orient-cli/agent-core/dist/agent.js +0 -0
  633. /package/{node_modules → vendor}/@orient-cli/agent-core/dist/agent.js.map +0 -0
  634. /package/{node_modules → vendor}/@orient-cli/agent-core/dist/index.d.ts +0 -0
  635. /package/{node_modules → vendor}/@orient-cli/agent-core/dist/index.d.ts.map +0 -0
  636. /package/{node_modules → vendor}/@orient-cli/agent-core/dist/index.js +0 -0
  637. /package/{node_modules → vendor}/@orient-cli/agent-core/dist/index.js.map +0 -0
  638. /package/{node_modules → vendor}/@orient-cli/agent-core/dist/proxy.d.ts +0 -0
  639. /package/{node_modules → vendor}/@orient-cli/agent-core/dist/proxy.d.ts.map +0 -0
  640. /package/{node_modules → vendor}/@orient-cli/agent-core/dist/proxy.js +0 -0
  641. /package/{node_modules → vendor}/@orient-cli/agent-core/dist/proxy.js.map +0 -0
  642. /package/{node_modules → vendor}/@orient-cli/agent-core/dist/types.d.ts +0 -0
  643. /package/{node_modules → vendor}/@orient-cli/agent-core/dist/types.d.ts.map +0 -0
  644. /package/{node_modules → vendor}/@orient-cli/agent-core/dist/types.js +0 -0
  645. /package/{node_modules → vendor}/@orient-cli/agent-core/dist/types.js.map +0 -0
  646. /package/{node_modules → vendor}/@orient-cli/agent-core/package.json +0 -0
  647. /package/{node_modules → vendor}/@orient-cli/ai/dist/api-registry.d.ts +0 -0
  648. /package/{node_modules → vendor}/@orient-cli/ai/dist/api-registry.d.ts.map +0 -0
  649. /package/{node_modules → vendor}/@orient-cli/ai/dist/api-registry.js +0 -0
  650. /package/{node_modules → vendor}/@orient-cli/ai/dist/api-registry.js.map +0 -0
  651. /package/{node_modules → vendor}/@orient-cli/ai/dist/bedrock-provider.d.ts +0 -0
  652. /package/{node_modules → vendor}/@orient-cli/ai/dist/bedrock-provider.d.ts.map +0 -0
  653. /package/{node_modules → vendor}/@orient-cli/ai/dist/bedrock-provider.js +0 -0
  654. /package/{node_modules → vendor}/@orient-cli/ai/dist/bedrock-provider.js.map +0 -0
  655. /package/{node_modules → vendor}/@orient-cli/ai/dist/cli.d.ts +0 -0
  656. /package/{node_modules → vendor}/@orient-cli/ai/dist/cli.d.ts.map +0 -0
  657. /package/{node_modules → vendor}/@orient-cli/ai/dist/cli.js +0 -0
  658. /package/{node_modules → vendor}/@orient-cli/ai/dist/cli.js.map +0 -0
  659. /package/{node_modules → vendor}/@orient-cli/ai/dist/env-api-keys.d.ts +0 -0
  660. /package/{node_modules → vendor}/@orient-cli/ai/dist/env-api-keys.d.ts.map +0 -0
  661. /package/{node_modules → vendor}/@orient-cli/ai/dist/env-api-keys.js +0 -0
  662. /package/{node_modules → vendor}/@orient-cli/ai/dist/env-api-keys.js.map +0 -0
  663. /package/{node_modules → vendor}/@orient-cli/ai/dist/index.d.ts +0 -0
  664. /package/{node_modules → vendor}/@orient-cli/ai/dist/index.d.ts.map +0 -0
  665. /package/{node_modules → vendor}/@orient-cli/ai/dist/index.js +0 -0
  666. /package/{node_modules → vendor}/@orient-cli/ai/dist/index.js.map +0 -0
  667. /package/{node_modules → vendor}/@orient-cli/ai/dist/models.d.ts +0 -0
  668. /package/{node_modules → vendor}/@orient-cli/ai/dist/models.d.ts.map +0 -0
  669. /package/{node_modules → vendor}/@orient-cli/ai/dist/models.generated.d.ts +0 -0
  670. /package/{node_modules → vendor}/@orient-cli/ai/dist/models.generated.d.ts.map +0 -0
  671. /package/{node_modules → vendor}/@orient-cli/ai/dist/models.generated.js +0 -0
  672. /package/{node_modules → vendor}/@orient-cli/ai/dist/models.generated.js.map +0 -0
  673. /package/{node_modules → vendor}/@orient-cli/ai/dist/models.js +0 -0
  674. /package/{node_modules → vendor}/@orient-cli/ai/dist/models.js.map +0 -0
  675. /package/{node_modules → vendor}/@orient-cli/ai/dist/oauth.d.ts +0 -0
  676. /package/{node_modules → vendor}/@orient-cli/ai/dist/oauth.d.ts.map +0 -0
  677. /package/{node_modules → vendor}/@orient-cli/ai/dist/oauth.js +0 -0
  678. /package/{node_modules → vendor}/@orient-cli/ai/dist/oauth.js.map +0 -0
  679. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/amazon-bedrock.d.ts +0 -0
  680. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/amazon-bedrock.d.ts.map +0 -0
  681. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/amazon-bedrock.js +0 -0
  682. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/amazon-bedrock.js.map +0 -0
  683. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/anthropic.d.ts +0 -0
  684. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/anthropic.d.ts.map +0 -0
  685. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/anthropic.js +0 -0
  686. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/anthropic.js.map +0 -0
  687. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/azure-openai-responses.d.ts +0 -0
  688. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/azure-openai-responses.d.ts.map +0 -0
  689. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/azure-openai-responses.js +0 -0
  690. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/azure-openai-responses.js.map +0 -0
  691. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/faux.d.ts +0 -0
  692. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/faux.d.ts.map +0 -0
  693. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/faux.js +0 -0
  694. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/faux.js.map +0 -0
  695. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/github-copilot-headers.d.ts +0 -0
  696. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/github-copilot-headers.d.ts.map +0 -0
  697. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/github-copilot-headers.js +0 -0
  698. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/github-copilot-headers.js.map +0 -0
  699. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/google-gemini-cli.d.ts +0 -0
  700. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/google-gemini-cli.d.ts.map +0 -0
  701. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/google-gemini-cli.js +0 -0
  702. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/google-gemini-cli.js.map +0 -0
  703. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/google-shared.d.ts +0 -0
  704. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/google-shared.d.ts.map +0 -0
  705. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/google-shared.js +0 -0
  706. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/google-shared.js.map +0 -0
  707. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/google-vertex.d.ts +0 -0
  708. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/google-vertex.d.ts.map +0 -0
  709. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/google-vertex.js +0 -0
  710. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/google-vertex.js.map +0 -0
  711. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/google.d.ts +0 -0
  712. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/google.d.ts.map +0 -0
  713. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/google.js +0 -0
  714. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/google.js.map +0 -0
  715. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/mistral.d.ts +0 -0
  716. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/mistral.d.ts.map +0 -0
  717. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/mistral.js +0 -0
  718. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/mistral.js.map +0 -0
  719. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/openai-codex-responses.d.ts +0 -0
  720. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/openai-codex-responses.d.ts.map +0 -0
  721. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/openai-codex-responses.js +0 -0
  722. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/openai-codex-responses.js.map +0 -0
  723. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/openai-completions.d.ts +0 -0
  724. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/openai-completions.d.ts.map +0 -0
  725. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/openai-completions.js +0 -0
  726. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/openai-completions.js.map +0 -0
  727. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/openai-responses-shared.d.ts +0 -0
  728. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/openai-responses-shared.d.ts.map +0 -0
  729. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/openai-responses-shared.js +0 -0
  730. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/openai-responses-shared.js.map +0 -0
  731. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/openai-responses.d.ts +0 -0
  732. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/openai-responses.d.ts.map +0 -0
  733. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/openai-responses.js +0 -0
  734. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/openai-responses.js.map +0 -0
  735. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/register-builtins.d.ts +0 -0
  736. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/register-builtins.d.ts.map +0 -0
  737. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/register-builtins.js +0 -0
  738. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/register-builtins.js.map +0 -0
  739. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/simple-options.d.ts +0 -0
  740. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/simple-options.d.ts.map +0 -0
  741. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/simple-options.js +0 -0
  742. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/simple-options.js.map +0 -0
  743. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/transform-messages.d.ts +0 -0
  744. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/transform-messages.d.ts.map +0 -0
  745. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/transform-messages.js +0 -0
  746. /package/{node_modules → vendor}/@orient-cli/ai/dist/providers/transform-messages.js.map +0 -0
  747. /package/{node_modules → vendor}/@orient-cli/ai/dist/stream.d.ts +0 -0
  748. /package/{node_modules → vendor}/@orient-cli/ai/dist/stream.d.ts.map +0 -0
  749. /package/{node_modules → vendor}/@orient-cli/ai/dist/stream.js +0 -0
  750. /package/{node_modules → vendor}/@orient-cli/ai/dist/stream.js.map +0 -0
  751. /package/{node_modules → vendor}/@orient-cli/ai/dist/types.d.ts +0 -0
  752. /package/{node_modules → vendor}/@orient-cli/ai/dist/types.d.ts.map +0 -0
  753. /package/{node_modules → vendor}/@orient-cli/ai/dist/types.js +0 -0
  754. /package/{node_modules → vendor}/@orient-cli/ai/dist/types.js.map +0 -0
  755. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/event-stream.d.ts +0 -0
  756. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/event-stream.d.ts.map +0 -0
  757. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/event-stream.js +0 -0
  758. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/event-stream.js.map +0 -0
  759. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/hash.d.ts +0 -0
  760. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/hash.d.ts.map +0 -0
  761. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/hash.js +0 -0
  762. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/hash.js.map +0 -0
  763. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/json-parse.d.ts +0 -0
  764. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/json-parse.d.ts.map +0 -0
  765. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/json-parse.js +0 -0
  766. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/json-parse.js.map +0 -0
  767. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/anthropic.d.ts +0 -0
  768. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/anthropic.d.ts.map +0 -0
  769. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/anthropic.js +0 -0
  770. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/anthropic.js.map +0 -0
  771. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/github-copilot.d.ts +0 -0
  772. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/github-copilot.d.ts.map +0 -0
  773. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/github-copilot.js +0 -0
  774. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/github-copilot.js.map +0 -0
  775. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/google-antigravity.d.ts +0 -0
  776. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/google-antigravity.d.ts.map +0 -0
  777. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/google-antigravity.js +0 -0
  778. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/google-antigravity.js.map +0 -0
  779. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/google-gemini-cli.d.ts +0 -0
  780. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/google-gemini-cli.d.ts.map +0 -0
  781. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/google-gemini-cli.js +0 -0
  782. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/google-gemini-cli.js.map +0 -0
  783. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/index.d.ts +0 -0
  784. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/index.d.ts.map +0 -0
  785. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/index.js +0 -0
  786. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/index.js.map +0 -0
  787. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/oauth-page.d.ts +0 -0
  788. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/oauth-page.d.ts.map +0 -0
  789. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/oauth-page.js +0 -0
  790. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/oauth-page.js.map +0 -0
  791. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/openai-codex.d.ts +0 -0
  792. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/openai-codex.d.ts.map +0 -0
  793. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/openai-codex.js +0 -0
  794. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/openai-codex.js.map +0 -0
  795. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/pkce.d.ts +0 -0
  796. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/pkce.d.ts.map +0 -0
  797. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/pkce.js +0 -0
  798. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/pkce.js.map +0 -0
  799. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/types.d.ts +0 -0
  800. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/types.d.ts.map +0 -0
  801. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/types.js +0 -0
  802. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/oauth/types.js.map +0 -0
  803. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/overflow.d.ts +0 -0
  804. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/overflow.d.ts.map +0 -0
  805. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/overflow.js +0 -0
  806. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/overflow.js.map +0 -0
  807. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/sanitize-unicode.d.ts +0 -0
  808. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/sanitize-unicode.d.ts.map +0 -0
  809. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/sanitize-unicode.js +0 -0
  810. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/sanitize-unicode.js.map +0 -0
  811. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/typebox-helpers.d.ts +0 -0
  812. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/typebox-helpers.d.ts.map +0 -0
  813. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/typebox-helpers.js +0 -0
  814. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/typebox-helpers.js.map +0 -0
  815. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/validation.d.ts +0 -0
  816. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/validation.d.ts.map +0 -0
  817. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/validation.js +0 -0
  818. /package/{node_modules → vendor}/@orient-cli/ai/dist/utils/validation.js.map +0 -0
  819. /package/{node_modules → vendor}/@orient-cli/ai/package.json +0 -0
  820. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/bun/cli.d.ts +0 -0
  821. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/bun/cli.js +0 -0
  822. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/bun/register-bedrock.d.ts +0 -0
  823. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/bun/register-bedrock.js +0 -0
  824. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/bun/register-bedrock.js.map +0 -0
  825. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/cli/args.d.ts +0 -0
  826. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/cli/args.js +0 -0
  827. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/cli/config-selector.d.ts +0 -0
  828. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/cli/config-selector.js +0 -0
  829. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/cli/file-processor.d.ts +0 -0
  830. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/cli/file-processor.js +0 -0
  831. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/cli/initial-message.js +0 -0
  832. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/cli/list-models.d.ts +0 -0
  833. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/cli/list-models.js +0 -0
  834. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/cli/session-picker.d.ts +0 -0
  835. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/cli/session-picker.js +0 -0
  836. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/cli.d.ts +0 -0
  837. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/config.d.ts +0 -0
  838. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/agent-session-runtime.d.ts +0 -0
  839. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/agent-session-services.d.ts +0 -0
  840. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/agent-session-services.js +0 -0
  841. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/bash-executor.d.ts +0 -0
  842. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/bash-executor.js +0 -0
  843. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.d.ts +0 -0
  844. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.js +0 -0
  845. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/compaction/compaction.d.ts +0 -0
  846. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/compaction/compaction.js +0 -0
  847. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/compaction/index.d.ts +0 -0
  848. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/compaction/index.js +0 -0
  849. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/compaction/index.js.map +0 -0
  850. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/compaction/utils.d.ts +0 -0
  851. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/compaction/utils.js +0 -0
  852. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/defaults.d.ts +0 -0
  853. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/defaults.js +0 -0
  854. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/defaults.js.map +0 -0
  855. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/diagnostics.d.ts +0 -0
  856. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/diagnostics.js +0 -0
  857. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/diagnostics.js.map +0 -0
  858. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/event-bus.d.ts +0 -0
  859. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/event-bus.js +0 -0
  860. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/exec.d.ts +0 -0
  861. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/exec.js +0 -0
  862. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.d.ts +0 -0
  863. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.js +0 -0
  864. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/export-html/index.d.ts +0 -0
  865. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/export-html/index.js +0 -0
  866. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.d.ts +0 -0
  867. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.js +0 -0
  868. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/extensions/index.d.ts +0 -0
  869. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/extensions/index.js +0 -0
  870. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/extensions/index.js.map +0 -0
  871. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/extensions/loader.d.ts +0 -0
  872. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/extensions/loader.js +0 -0
  873. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/extensions/runner.d.ts +0 -0
  874. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/extensions/types.d.ts +0 -0
  875. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/extensions/types.js +0 -0
  876. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/extensions/wrapper.d.ts +0 -0
  877. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/extensions/wrapper.js +0 -0
  878. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/footer-data-provider.d.ts +0 -0
  879. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/index.d.ts +0 -0
  880. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/index.js +0 -0
  881. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/index.js.map +0 -0
  882. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/messages.d.ts +0 -0
  883. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/messages.js +0 -0
  884. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/model-registry.d.ts +0 -0
  885. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/model-resolver.d.ts +0 -0
  886. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/model-resolver.js +0 -0
  887. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/output-guard.d.ts +0 -0
  888. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/output-guard.js +0 -0
  889. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/package-manager.d.ts +0 -0
  890. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/prompt-templates.d.ts +0 -0
  891. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/prompt-templates.js +0 -0
  892. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/resolve-config-value.d.ts +0 -0
  893. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/resolve-config-value.js +0 -0
  894. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/resource-loader.d.ts +0 -0
  895. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/sdk.d.ts +0 -0
  896. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/sdk.js +0 -0
  897. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/session-cwd.d.ts +0 -0
  898. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/session-manager.d.ts +0 -0
  899. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/settings-manager.d.ts +0 -0
  900. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/skills.d.ts +0 -0
  901. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/skills.js +0 -0
  902. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/slash-commands.d.ts +0 -0
  903. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/slash-commands.js +0 -0
  904. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/slash-commands.js.map +0 -0
  905. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/source-info.d.ts +0 -0
  906. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/source-info.js +0 -0
  907. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/system-prompt.d.ts +0 -0
  908. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/system-prompt.js +0 -0
  909. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/timings.d.ts +0 -0
  910. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/timings.js +0 -0
  911. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/bash.d.ts +0 -0
  912. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/edit-diff.d.ts +0 -0
  913. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/edit-diff.js +0 -0
  914. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/edit.d.ts +0 -0
  915. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/edit.js +0 -0
  916. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.d.ts +0 -0
  917. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.js +0 -0
  918. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/find.d.ts +0 -0
  919. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/find.js +0 -0
  920. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/grep.d.ts +0 -0
  921. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/grep.js +0 -0
  922. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/index.d.ts +0 -0
  923. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/index.js +0 -0
  924. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/ls.d.ts +0 -0
  925. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/ls.js +0 -0
  926. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/path-utils.d.ts +0 -0
  927. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/path-utils.js +0 -0
  928. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/read.d.ts +0 -0
  929. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/read.js +0 -0
  930. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/render-utils.d.ts +0 -0
  931. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/render-utils.js +0 -0
  932. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.d.ts +0 -0
  933. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.js +0 -0
  934. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/truncate.d.ts +0 -0
  935. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/truncate.js +0 -0
  936. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/core/tools/write.d.ts +0 -0
  937. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/index.d.ts +0 -0
  938. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/index.js +0 -0
  939. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/index.js.map +0 -0
  940. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/main.d.ts +0 -0
  941. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/main.js +0 -0
  942. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/migrations.d.ts +0 -0
  943. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/migrations.js +0 -0
  944. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/index.d.ts +0 -0
  945. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/index.js +0 -0
  946. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/index.js.map +0 -0
  947. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.d.ts +0 -0
  948. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.d.ts +0 -0
  949. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.d.ts +0 -0
  950. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts +0 -0
  951. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts +0 -0
  952. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.d.ts +0 -0
  953. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.d.ts +0 -0
  954. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.d.ts +0 -0
  955. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.d.ts +0 -0
  956. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/diff.d.ts +0 -0
  957. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/diff.js +0 -0
  958. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.d.ts +0 -0
  959. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.d.ts +0 -0
  960. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.d.ts +0 -0
  961. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.d.ts +0 -0
  962. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/footer.d.ts +0 -0
  963. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/index.d.ts +0 -0
  964. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/index.js +0 -0
  965. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.d.ts +0 -0
  966. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.js +0 -0
  967. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.d.ts +0 -0
  968. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.d.ts +0 -0
  969. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.d.ts +0 -0
  970. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.d.ts +0 -0
  971. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.js +0 -0
  972. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.d.ts +0 -0
  973. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.d.ts +0 -0
  974. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.js +0 -0
  975. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.d.ts +0 -0
  976. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.d.ts +0 -0
  977. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.d.ts +0 -0
  978. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts +0 -0
  979. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.d.ts +0 -0
  980. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.d.ts +0 -0
  981. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.d.ts +0 -0
  982. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.d.ts +0 -0
  983. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.d.ts +0 -0
  984. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.d.ts +0 -0
  985. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.js +0 -0
  986. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.d.ts +0 -0
  987. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.js +0 -0
  988. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.d.ts +0 -0
  989. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/print-mode.d.ts +0 -0
  990. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/print-mode.js +0 -0
  991. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/rpc/jsonl.d.ts +0 -0
  992. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/rpc/jsonl.js +0 -0
  993. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.d.ts +0 -0
  994. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.d.ts +0 -0
  995. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.js +0 -0
  996. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.d.ts +0 -0
  997. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.js +0 -0
  998. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.js.map +0 -0
  999. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/package-manager-cli.d.ts +0 -0
  1000. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/package-manager-cli.js +0 -0
  1001. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/changelog.d.ts +0 -0
  1002. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/changelog.js +0 -0
  1003. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/child-process.d.ts +0 -0
  1004. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/child-process.js +0 -0
  1005. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/clipboard-image.d.ts +0 -0
  1006. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/clipboard-image.js +0 -0
  1007. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/clipboard-native.d.ts +0 -0
  1008. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/clipboard-native.js +0 -0
  1009. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/clipboard.d.ts +0 -0
  1010. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/clipboard.js +0 -0
  1011. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/exif-orientation.d.ts +0 -0
  1012. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/exif-orientation.js +0 -0
  1013. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/frontmatter.d.ts +0 -0
  1014. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/frontmatter.js +0 -0
  1015. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/git.d.ts +0 -0
  1016. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/git.js +0 -0
  1017. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/image-convert.d.ts +0 -0
  1018. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/image-convert.js +0 -0
  1019. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/image-resize.d.ts +0 -0
  1020. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/image-resize.js +0 -0
  1021. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/mime.d.ts +0 -0
  1022. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/mime.js +0 -0
  1023. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/paths.d.ts +0 -0
  1024. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/paths.js +0 -0
  1025. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/photon.d.ts +0 -0
  1026. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/photon.js +0 -0
  1027. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/shell.d.ts +0 -0
  1028. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/shell.js +0 -0
  1029. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/sleep.d.ts +0 -0
  1030. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/sleep.js +0 -0
  1031. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/tools-manager.d.ts +0 -0
  1032. /package/{node_modules → vendor}/@orient-cli/coding-agent/dist/utils/tools-manager.js +0 -0
  1033. /package/{node_modules → vendor}/@orient-cli/coding-agent/package.json +0 -0
  1034. /package/{node_modules → vendor}/@orient-cli/tui/dist/autocomplete.d.ts +0 -0
  1035. /package/{node_modules → vendor}/@orient-cli/tui/dist/autocomplete.d.ts.map +0 -0
  1036. /package/{node_modules → vendor}/@orient-cli/tui/dist/autocomplete.js +0 -0
  1037. /package/{node_modules → vendor}/@orient-cli/tui/dist/autocomplete.js.map +0 -0
  1038. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/box.d.ts +0 -0
  1039. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/box.d.ts.map +0 -0
  1040. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/box.js +0 -0
  1041. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/box.js.map +0 -0
  1042. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/cancellable-loader.d.ts +0 -0
  1043. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/cancellable-loader.d.ts.map +0 -0
  1044. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/cancellable-loader.js +0 -0
  1045. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/cancellable-loader.js.map +0 -0
  1046. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/editor.d.ts +0 -0
  1047. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/editor.d.ts.map +0 -0
  1048. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/editor.js +0 -0
  1049. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/editor.js.map +0 -0
  1050. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/image.d.ts +0 -0
  1051. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/image.d.ts.map +0 -0
  1052. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/image.js +0 -0
  1053. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/image.js.map +0 -0
  1054. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/input.d.ts +0 -0
  1055. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/input.d.ts.map +0 -0
  1056. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/input.js +0 -0
  1057. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/input.js.map +0 -0
  1058. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/loader.d.ts +0 -0
  1059. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/loader.d.ts.map +0 -0
  1060. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/loader.js +0 -0
  1061. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/loader.js.map +0 -0
  1062. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/markdown.d.ts +0 -0
  1063. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/markdown.d.ts.map +0 -0
  1064. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/markdown.js +0 -0
  1065. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/markdown.js.map +0 -0
  1066. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/select-list.d.ts +0 -0
  1067. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/select-list.d.ts.map +0 -0
  1068. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/select-list.js +0 -0
  1069. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/select-list.js.map +0 -0
  1070. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/settings-list.d.ts +0 -0
  1071. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/settings-list.d.ts.map +0 -0
  1072. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/settings-list.js +0 -0
  1073. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/settings-list.js.map +0 -0
  1074. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/spacer.d.ts +0 -0
  1075. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/spacer.d.ts.map +0 -0
  1076. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/spacer.js +0 -0
  1077. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/spacer.js.map +0 -0
  1078. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/text.d.ts +0 -0
  1079. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/text.d.ts.map +0 -0
  1080. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/text.js +0 -0
  1081. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/text.js.map +0 -0
  1082. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/truncated-text.d.ts +0 -0
  1083. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/truncated-text.d.ts.map +0 -0
  1084. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/truncated-text.js +0 -0
  1085. /package/{node_modules → vendor}/@orient-cli/tui/dist/components/truncated-text.js.map +0 -0
  1086. /package/{node_modules → vendor}/@orient-cli/tui/dist/editor-component.d.ts +0 -0
  1087. /package/{node_modules → vendor}/@orient-cli/tui/dist/editor-component.d.ts.map +0 -0
  1088. /package/{node_modules → vendor}/@orient-cli/tui/dist/editor-component.js +0 -0
  1089. /package/{node_modules → vendor}/@orient-cli/tui/dist/editor-component.js.map +0 -0
  1090. /package/{node_modules → vendor}/@orient-cli/tui/dist/fuzzy.d.ts +0 -0
  1091. /package/{node_modules → vendor}/@orient-cli/tui/dist/fuzzy.d.ts.map +0 -0
  1092. /package/{node_modules → vendor}/@orient-cli/tui/dist/fuzzy.js +0 -0
  1093. /package/{node_modules → vendor}/@orient-cli/tui/dist/fuzzy.js.map +0 -0
  1094. /package/{node_modules → vendor}/@orient-cli/tui/dist/index.d.ts +0 -0
  1095. /package/{node_modules → vendor}/@orient-cli/tui/dist/index.d.ts.map +0 -0
  1096. /package/{node_modules → vendor}/@orient-cli/tui/dist/index.js +0 -0
  1097. /package/{node_modules → vendor}/@orient-cli/tui/dist/index.js.map +0 -0
  1098. /package/{node_modules → vendor}/@orient-cli/tui/dist/keybindings.d.ts +0 -0
  1099. /package/{node_modules → vendor}/@orient-cli/tui/dist/keybindings.d.ts.map +0 -0
  1100. /package/{node_modules → vendor}/@orient-cli/tui/dist/keybindings.js +0 -0
  1101. /package/{node_modules → vendor}/@orient-cli/tui/dist/keybindings.js.map +0 -0
  1102. /package/{node_modules → vendor}/@orient-cli/tui/dist/keys.d.ts +0 -0
  1103. /package/{node_modules → vendor}/@orient-cli/tui/dist/keys.d.ts.map +0 -0
  1104. /package/{node_modules → vendor}/@orient-cli/tui/dist/keys.js +0 -0
  1105. /package/{node_modules → vendor}/@orient-cli/tui/dist/keys.js.map +0 -0
  1106. /package/{node_modules → vendor}/@orient-cli/tui/dist/kill-ring.d.ts +0 -0
  1107. /package/{node_modules → vendor}/@orient-cli/tui/dist/kill-ring.d.ts.map +0 -0
  1108. /package/{node_modules → vendor}/@orient-cli/tui/dist/kill-ring.js +0 -0
  1109. /package/{node_modules → vendor}/@orient-cli/tui/dist/kill-ring.js.map +0 -0
  1110. /package/{node_modules → vendor}/@orient-cli/tui/dist/stdin-buffer.d.ts +0 -0
  1111. /package/{node_modules → vendor}/@orient-cli/tui/dist/stdin-buffer.d.ts.map +0 -0
  1112. /package/{node_modules → vendor}/@orient-cli/tui/dist/stdin-buffer.js +0 -0
  1113. /package/{node_modules → vendor}/@orient-cli/tui/dist/stdin-buffer.js.map +0 -0
  1114. /package/{node_modules → vendor}/@orient-cli/tui/dist/terminal-image.d.ts +0 -0
  1115. /package/{node_modules → vendor}/@orient-cli/tui/dist/terminal-image.d.ts.map +0 -0
  1116. /package/{node_modules → vendor}/@orient-cli/tui/dist/terminal-image.js +0 -0
  1117. /package/{node_modules → vendor}/@orient-cli/tui/dist/terminal-image.js.map +0 -0
  1118. /package/{node_modules → vendor}/@orient-cli/tui/dist/terminal.d.ts +0 -0
  1119. /package/{node_modules → vendor}/@orient-cli/tui/dist/terminal.d.ts.map +0 -0
  1120. /package/{node_modules → vendor}/@orient-cli/tui/dist/terminal.js +0 -0
  1121. /package/{node_modules → vendor}/@orient-cli/tui/dist/terminal.js.map +0 -0
  1122. /package/{node_modules → vendor}/@orient-cli/tui/dist/tui.d.ts +0 -0
  1123. /package/{node_modules → vendor}/@orient-cli/tui/dist/tui.d.ts.map +0 -0
  1124. /package/{node_modules → vendor}/@orient-cli/tui/dist/tui.js +0 -0
  1125. /package/{node_modules → vendor}/@orient-cli/tui/dist/tui.js.map +0 -0
  1126. /package/{node_modules → vendor}/@orient-cli/tui/dist/undo-stack.d.ts +0 -0
  1127. /package/{node_modules → vendor}/@orient-cli/tui/dist/undo-stack.d.ts.map +0 -0
  1128. /package/{node_modules → vendor}/@orient-cli/tui/dist/undo-stack.js +0 -0
  1129. /package/{node_modules → vendor}/@orient-cli/tui/dist/undo-stack.js.map +0 -0
  1130. /package/{node_modules → vendor}/@orient-cli/tui/dist/utils.d.ts +0 -0
  1131. /package/{node_modules → vendor}/@orient-cli/tui/dist/utils.d.ts.map +0 -0
  1132. /package/{node_modules → vendor}/@orient-cli/tui/dist/utils.js +0 -0
  1133. /package/{node_modules → vendor}/@orient-cli/tui/dist/utils.js.map +0 -0
  1134. /package/{node_modules → vendor}/@orient-cli/tui/package.json +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-mutation-queue.js","sourceRoot":"","sources":["../../../src/core/tools/file-mutation-queue.ts"],"names":[],"mappings":"AAA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Sync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nconst fileMutationQueues = new Map<string, Promise<void>>();\n\nfunction getMutationQueueKey(filePath: string): string {\n\tconst resolvedPath = resolve(filePath);\n\ttry {\n\t\treturn realpathSync.native(resolvedPath);\n\t} catch {\n\t\treturn resolvedPath;\n\t}\n}\n\n/**\n * Serialize file mutation operations targeting the same file.\n * Operations for different files still run in parallel.\n */\nexport async function withFileMutationQueue<T>(filePath: string, fn: () => Promise<T>): Promise<T> {\n\tconst key = getMutationQueueKey(filePath);\n\tconst currentQueue = fileMutationQueues.get(key) ?? Promise.resolve();\n\n\tlet releaseNext!: () => void;\n\tconst nextQueue = new Promise<void>((resolveQueue) => {\n\t\treleaseNext = resolveQueue;\n\t});\n\tconst chainedQueue = currentQueue.then(() => nextQueue);\n\tfileMutationQueues.set(key, chainedQueue);\n\n\tawait currentQueue;\n\ttry {\n\t\treturn await fn();\n\t} finally {\n\t\treleaseNext();\n\t\tif (fileMutationQueues.get(key) === chainedQueue) {\n\t\t\tfileMutationQueues.delete(key);\n\t\t}\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../src/core/tools/find.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAOtD,OAAO,KAAK,EAAE,cAAc,EAA2B,MAAM,wBAAwB,CAAC;AAItF,OAAO,EAAiC,KAAK,gBAAgB,EAAgB,MAAM,eAAe,CAAC;AAMnG,QAAA,MAAM,UAAU;;;;EAMd,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAItD,MAAM,WAAW,eAAe;IAC/B,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B,2BAA2B;IAC3B,MAAM,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IAC7D,4EAA4E;IAC5E,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC;CACnH;AAQD,MAAM,WAAW,eAAe;IAC/B,oEAAoE;IACpE,UAAU,CAAC,EAAE,cAAc,CAAC;CAC5B;AAuDD,wBAAgB,wBAAwB,CACvC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,eAAe,GACvB,cAAc,CAAC,OAAO,UAAU,EAAE,eAAe,GAAG,SAAS,CAAC,CA+LhE;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC,OAAO,UAAU,CAAC,CAEnG;AAED,yEAAyE;AACzE,eAAO,MAAM,kBAAkB;;;;qCAA0C,CAAC;AAC1E,eAAO,MAAM,QAAQ;;;;QAAgC,CAAC","sourcesContent":["import type { AgentTool } from \"@orient-cli/agent-core\";\nimport { Text } from \"@orient-cli/tui\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport { spawnSync } from \"child_process\";\nimport { existsSync } from \"fs\";\nimport { globSync } from \"glob\";\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 { DEFAULT_MAX_BYTES, formatSize, type TruncationResult, truncateHead } from \"./truncate.js\";\n\nfunction toPosixPath(value: string): string {\n\treturn value.split(path.sep).join(\"/\");\n}\n\nconst findSchema = Type.Object({\n\tpattern: Type.String({\n\t\tdescription: \"Glob pattern to match files, e.g. '*.ts', '**/*.json', or 'src/**/*.spec.ts'\",\n\t}),\n\tpath: Type.Optional(Type.String({ description: \"Directory to search in (default: current directory)\" })),\n\tlimit: Type.Optional(Type.Number({ description: \"Maximum number of results (default: 1000)\" })),\n});\n\nexport type FindToolInput = Static<typeof findSchema>;\n\nconst DEFAULT_LIMIT = 1000;\n\nexport interface FindToolDetails {\n\ttruncation?: TruncationResult;\n\tresultLimitReached?: number;\n}\n\n/**\n * Pluggable operations for the find tool.\n * Override these to delegate file search to remote systems (for example SSH).\n */\nexport interface FindOperations {\n\t/** Check if path exists */\n\texists: (absolutePath: string) => Promise<boolean> | boolean;\n\t/** Find files matching glob pattern. Returns relative or absolute paths. */\n\tglob: (pattern: string, cwd: string, options: { ignore: string[]; limit: number }) => Promise<string[]> | string[];\n}\n\nconst defaultFindOperations: FindOperations = {\n\texists: existsSync,\n\t// This is a placeholder. Actual fd execution happens in execute() when no custom glob is provided.\n\tglob: () => [],\n};\n\nexport interface FindToolOptions {\n\t/** Custom operations for find. Default: local filesystem plus fd */\n\toperations?: FindOperations;\n}\n\nfunction formatFindCall(\n\targs: { pattern: string; path?: 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 limit = args?.limit;\n\tconst invalidArg = invalidArgText(theme);\n\tlet text =\n\t\ttheme.fg(\"toolTitle\", theme.bold(\"find\")) +\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 (limit !== undefined) {\n\t\ttext += theme.fg(\"toolOutput\", ` (limit ${limit})`);\n\t}\n\treturn text;\n}\n\nfunction formatFindResult(\n\tresult: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tdetails?: FindToolDetails;\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 : 20;\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 resultLimit = result.details?.resultLimitReached;\n\tconst truncation = result.details?.truncation;\n\tif (resultLimit || truncation?.truncated) {\n\t\tconst warnings: string[] = [];\n\t\tif (resultLimit) warnings.push(`${resultLimit} results limit`);\n\t\tif (truncation?.truncated) warnings.push(`${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit`);\n\t\ttext += `\\n${theme.fg(\"warning\", `[Truncated: ${warnings.join(\", \")}]`)}`;\n\t}\n\treturn text;\n}\n\nexport function createFindToolDefinition(\n\tcwd: string,\n\toptions?: FindToolOptions,\n): ToolDefinition<typeof findSchema, FindToolDetails | undefined> {\n\tconst customOps = options?.operations;\n\treturn {\n\t\tname: \"find\",\n\t\tlabel: \"find\",\n\t\tdescription: `Search for files by glob pattern. Returns matching file paths relative to the search directory. Respects .gitignore. Output is truncated to ${DEFAULT_LIMIT} results or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first).`,\n\t\tpromptSnippet: \"Find files by glob pattern (respects .gitignore)\",\n\t\tparameters: findSchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{ pattern, path: searchDir, limit }: { pattern: string; path?: string; limit?: number },\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\n\t\t\t\tconst onAbort = () => reject(new Error(\"Operation aborted\"));\n\t\t\t\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\n\t\t\t\t(async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst searchPath = resolveToCwd(searchDir || \".\", cwd);\n\t\t\t\t\t\tconst effectiveLimit = limit ?? DEFAULT_LIMIT;\n\t\t\t\t\t\tconst ops = customOps ?? defaultFindOperations;\n\n\t\t\t\t\t\t// If custom operations provide glob(), use that instead of fd.\n\t\t\t\t\t\tif (customOps?.glob) {\n\t\t\t\t\t\t\tif (!(await ops.exists(searchPath))) {\n\t\t\t\t\t\t\t\treject(new Error(`Path not found: ${searchPath}`));\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst results = await ops.glob(pattern, searchPath, {\n\t\t\t\t\t\t\t\tignore: [\"**/node_modules/**\", \"**/.git/**\"],\n\t\t\t\t\t\t\t\tlimit: effectiveLimit,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t\tif (results.length === 0) {\n\t\t\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: \"No files found matching pattern\" }],\n\t\t\t\t\t\t\t\t\tdetails: 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// Relativize paths against the search root for stable output.\n\t\t\t\t\t\t\tconst relativized = results.map((p) => {\n\t\t\t\t\t\t\t\tif (p.startsWith(searchPath)) return toPosixPath(p.slice(searchPath.length + 1));\n\t\t\t\t\t\t\t\treturn toPosixPath(path.relative(searchPath, p));\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tconst resultLimitReached = relativized.length >= effectiveLimit;\n\t\t\t\t\t\t\tconst rawOutput = relativized.join(\"\\n\");\n\t\t\t\t\t\t\tconst truncation = truncateHead(rawOutput, { maxLines: Number.MAX_SAFE_INTEGER });\n\t\t\t\t\t\t\tlet resultOutput = truncation.content;\n\t\t\t\t\t\t\tconst details: FindToolDetails = {};\n\t\t\t\t\t\t\tconst notices: string[] = [];\n\t\t\t\t\t\t\tif (resultLimitReached) {\n\t\t\t\t\t\t\t\tnotices.push(`${effectiveLimit} results limit reached`);\n\t\t\t\t\t\t\t\tdetails.resultLimitReached = 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 (notices.length > 0) {\n\t\t\t\t\t\t\t\tresultOutput += `\\n\\n[${notices.join(\". \")}]`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: resultOutput }],\n\t\t\t\t\t\t\t\tdetails: Object.keys(details).length > 0 ? details : undefined,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Default implementation uses fd.\n\t\t\t\t\t\tconst fdPath = await ensureTool(\"fd\", true);\n\t\t\t\t\t\tif (!fdPath) {\n\t\t\t\t\t\t\treject(new Error(\"fd 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\t// Build fd arguments.\n\t\t\t\t\t\tconst args: string[] = [\n\t\t\t\t\t\t\t\"--glob\",\n\t\t\t\t\t\t\t\"--color=never\",\n\t\t\t\t\t\t\t\"--hidden\",\n\t\t\t\t\t\t\t\"--max-results\",\n\t\t\t\t\t\t\tString(effectiveLimit),\n\t\t\t\t\t\t];\n\t\t\t\t\t\t// Include .gitignore files from the search tree.\n\t\t\t\t\t\tconst gitignoreFiles = new Set<string>();\n\t\t\t\t\t\tconst rootGitignore = path.join(searchPath, \".gitignore\");\n\t\t\t\t\t\tif (existsSync(rootGitignore)) gitignoreFiles.add(rootGitignore);\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst nestedGitignores = globSync(\"**/.gitignore\", {\n\t\t\t\t\t\t\t\tcwd: searchPath,\n\t\t\t\t\t\t\t\tdot: true,\n\t\t\t\t\t\t\t\tabsolute: true,\n\t\t\t\t\t\t\t\tignore: [\"**/node_modules/**\", \"**/.git/**\"],\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tfor (const file of nestedGitignores) gitignoreFiles.add(file);\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t// ignore\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (const gitignorePath of gitignoreFiles) args.push(\"--ignore-file\", gitignorePath);\n\t\t\t\t\t\targs.push(pattern, searchPath);\n\n\t\t\t\t\t\tconst result = spawnSync(fdPath, args, { encoding: \"utf-8\", maxBuffer: 10 * 1024 * 1024 });\n\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\tif (result.error) {\n\t\t\t\t\t\t\treject(new Error(`Failed to run fd: ${result.error.message}`));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst output = result.stdout?.trim() || \"\";\n\t\t\t\t\t\tif (result.status !== 0) {\n\t\t\t\t\t\t\tconst errorMsg = result.stderr?.trim() || `fd exited with code ${result.status}`;\n\t\t\t\t\t\t\tif (!output) {\n\t\t\t\t\t\t\t\treject(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}\n\t\t\t\t\t\tif (!output) {\n\t\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: \"No files found matching pattern\" }],\n\t\t\t\t\t\t\t\tdetails: undefined,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst lines = output.split(\"\\n\");\n\t\t\t\t\t\tconst relativized: string[] = [];\n\t\t\t\t\t\tfor (const rawLine of lines) {\n\t\t\t\t\t\t\tconst line = rawLine.replace(/\\r$/, \"\").trim();\n\t\t\t\t\t\t\tif (!line) continue;\n\t\t\t\t\t\t\tconst hadTrailingSlash = line.endsWith(\"/\") || line.endsWith(\"\\\\\");\n\t\t\t\t\t\t\tlet relativePath = line;\n\t\t\t\t\t\t\tif (line.startsWith(searchPath)) {\n\t\t\t\t\t\t\t\trelativePath = line.slice(searchPath.length + 1);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\trelativePath = path.relative(searchPath, line);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (hadTrailingSlash && !relativePath.endsWith(\"/\")) relativePath += \"/\";\n\t\t\t\t\t\t\trelativized.push(toPosixPath(relativePath));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst resultLimitReached = relativized.length >= effectiveLimit;\n\t\t\t\t\t\tconst rawOutput = relativized.join(\"\\n\");\n\t\t\t\t\t\tconst truncation = truncateHead(rawOutput, { maxLines: Number.MAX_SAFE_INTEGER });\n\t\t\t\t\t\tlet resultOutput = truncation.content;\n\t\t\t\t\t\tconst details: FindToolDetails = {};\n\t\t\t\t\t\tconst notices: string[] = [];\n\t\t\t\t\t\tif (resultLimitReached) {\n\t\t\t\t\t\t\tnotices.push(\n\t\t\t\t\t\t\t\t`${effectiveLimit} results limit reached. Use limit=${effectiveLimit * 2} for more, or refine pattern`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tdetails.resultLimitReached = effectiveLimit;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (truncation.truncated) {\n\t\t\t\t\t\t\tnotices.push(`${formatSize(DEFAULT_MAX_BYTES)} limit reached`);\n\t\t\t\t\t\t\tdetails.truncation = truncation;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (notices.length > 0) {\n\t\t\t\t\t\t\tresultOutput += `\\n\\n[${notices.join(\". \")}]`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: resultOutput }],\n\t\t\t\t\t\t\tdetails: Object.keys(details).length > 0 ? details : undefined,\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (e: any) {\n\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\treject(e);\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(formatFindCall(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(formatFindResult(result as any, options, theme, context.showImages));\n\t\t\treturn text;\n\t\t},\n\t};\n}\n\nexport function createFindTool(cwd: string, options?: FindToolOptions): AgentTool<typeof findSchema> {\n\treturn wrapToolDefinition(createFindToolDefinition(cwd, options));\n}\n\n/** Default find tool using process.cwd() for backwards compatibility. */\nexport const findToolDefinition = createFindToolDefinition(process.cwd());\nexport const findTool = createFindTool(process.cwd());\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"find.js","sourceRoot":"","sources":["../../../src/core/tools/find.ts"],"names":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AAQ,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC","sourcesContent":["import type { AgentTool } from \"@orient-cli/agent-core\";\nimport { Text } from \"@orient-cli/tui\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport { spawnSync } from \"child_process\";\nimport { existsSync } from \"fs\";\nimport { globSync } from \"glob\";\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 { DEFAULT_MAX_BYTES, formatSize, type TruncationResult, truncateHead } from \"./truncate.js\";\n\nfunction toPosixPath(value: string): string {\n\treturn value.split(path.sep).join(\"/\");\n}\n\nconst findSchema = Type.Object({\n\tpattern: Type.String({\n\t\tdescription: \"Glob pattern to match files, e.g. '*.ts', '**/*.json', or 'src/**/*.spec.ts'\",\n\t}),\n\tpath: Type.Optional(Type.String({ description: \"Directory to search in (default: current directory)\" })),\n\tlimit: Type.Optional(Type.Number({ description: \"Maximum number of results (default: 1000)\" })),\n});\n\nexport type FindToolInput = Static<typeof findSchema>;\n\nconst DEFAULT_LIMIT = 1000;\n\nexport interface FindToolDetails {\n\ttruncation?: TruncationResult;\n\tresultLimitReached?: number;\n}\n\n/**\n * Pluggable operations for the find tool.\n * Override these to delegate file search to remote systems (for example SSH).\n */\nexport interface FindOperations {\n\t/** Check if path exists */\n\texists: (absolutePath: string) => Promise<boolean> | boolean;\n\t/** Find files matching glob pattern. Returns relative or absolute paths. */\n\tglob: (pattern: string, cwd: string, options: { ignore: string[]; limit: number }) => Promise<string[]> | string[];\n}\n\nconst defaultFindOperations: FindOperations = {\n\texists: existsSync,\n\t// This is a placeholder. Actual fd execution happens in execute() when no custom glob is provided.\n\tglob: () => [],\n};\n\nexport interface FindToolOptions {\n\t/** Custom operations for find. Default: local filesystem plus fd */\n\toperations?: FindOperations;\n}\n\nfunction formatFindCall(\n\targs: { pattern: string; path?: 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 limit = args?.limit;\n\tconst invalidArg = invalidArgText(theme);\n\tlet text =\n\t\ttheme.fg(\"toolTitle\", theme.bold(\"find\")) +\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 (limit !== undefined) {\n\t\ttext += theme.fg(\"toolOutput\", ` (limit ${limit})`);\n\t}\n\treturn text;\n}\n\nfunction formatFindResult(\n\tresult: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tdetails?: FindToolDetails;\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 : 20;\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 resultLimit = result.details?.resultLimitReached;\n\tconst truncation = result.details?.truncation;\n\tif (resultLimit || truncation?.truncated) {\n\t\tconst warnings: string[] = [];\n\t\tif (resultLimit) warnings.push(`${resultLimit} results limit`);\n\t\tif (truncation?.truncated) warnings.push(`${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit`);\n\t\ttext += `\\n${theme.fg(\"warning\", `[Truncated: ${warnings.join(\", \")}]`)}`;\n\t}\n\treturn text;\n}\n\nexport function createFindToolDefinition(\n\tcwd: string,\n\toptions?: FindToolOptions,\n): ToolDefinition<typeof findSchema, FindToolDetails | undefined> {\n\tconst customOps = options?.operations;\n\treturn {\n\t\tname: \"find\",\n\t\tlabel: \"find\",\n\t\tdescription: `Search for files by glob pattern. Returns matching file paths relative to the search directory. Respects .gitignore. Output is truncated to ${DEFAULT_LIMIT} results or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first).`,\n\t\tpromptSnippet: \"Find files by glob pattern (respects .gitignore)\",\n\t\tparameters: findSchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{ pattern, path: searchDir, limit }: { pattern: string; path?: string; limit?: number },\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\n\t\t\t\tconst onAbort = () => reject(new Error(\"Operation aborted\"));\n\t\t\t\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\n\t\t\t\t(async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst searchPath = resolveToCwd(searchDir || \".\", cwd);\n\t\t\t\t\t\tconst effectiveLimit = limit ?? DEFAULT_LIMIT;\n\t\t\t\t\t\tconst ops = customOps ?? defaultFindOperations;\n\n\t\t\t\t\t\t// If custom operations provide glob(), use that instead of fd.\n\t\t\t\t\t\tif (customOps?.glob) {\n\t\t\t\t\t\t\tif (!(await ops.exists(searchPath))) {\n\t\t\t\t\t\t\t\treject(new Error(`Path not found: ${searchPath}`));\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst results = await ops.glob(pattern, searchPath, {\n\t\t\t\t\t\t\t\tignore: [\"**/node_modules/**\", \"**/.git/**\"],\n\t\t\t\t\t\t\t\tlimit: effectiveLimit,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t\tif (results.length === 0) {\n\t\t\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: \"No files found matching pattern\" }],\n\t\t\t\t\t\t\t\t\tdetails: 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// Relativize paths against the search root for stable output.\n\t\t\t\t\t\t\tconst relativized = results.map((p) => {\n\t\t\t\t\t\t\t\tif (p.startsWith(searchPath)) return toPosixPath(p.slice(searchPath.length + 1));\n\t\t\t\t\t\t\t\treturn toPosixPath(path.relative(searchPath, p));\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tconst resultLimitReached = relativized.length >= effectiveLimit;\n\t\t\t\t\t\t\tconst rawOutput = relativized.join(\"\\n\");\n\t\t\t\t\t\t\tconst truncation = truncateHead(rawOutput, { maxLines: Number.MAX_SAFE_INTEGER });\n\t\t\t\t\t\t\tlet resultOutput = truncation.content;\n\t\t\t\t\t\t\tconst details: FindToolDetails = {};\n\t\t\t\t\t\t\tconst notices: string[] = [];\n\t\t\t\t\t\t\tif (resultLimitReached) {\n\t\t\t\t\t\t\t\tnotices.push(`${effectiveLimit} results limit reached`);\n\t\t\t\t\t\t\t\tdetails.resultLimitReached = 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 (notices.length > 0) {\n\t\t\t\t\t\t\t\tresultOutput += `\\n\\n[${notices.join(\". \")}]`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: resultOutput }],\n\t\t\t\t\t\t\t\tdetails: Object.keys(details).length > 0 ? details : undefined,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Default implementation uses fd.\n\t\t\t\t\t\tconst fdPath = await ensureTool(\"fd\", true);\n\t\t\t\t\t\tif (!fdPath) {\n\t\t\t\t\t\t\treject(new Error(\"fd 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\t// Build fd arguments.\n\t\t\t\t\t\tconst args: string[] = [\n\t\t\t\t\t\t\t\"--glob\",\n\t\t\t\t\t\t\t\"--color=never\",\n\t\t\t\t\t\t\t\"--hidden\",\n\t\t\t\t\t\t\t\"--max-results\",\n\t\t\t\t\t\t\tString(effectiveLimit),\n\t\t\t\t\t\t];\n\t\t\t\t\t\t// Include .gitignore files from the search tree.\n\t\t\t\t\t\tconst gitignoreFiles = new Set<string>();\n\t\t\t\t\t\tconst rootGitignore = path.join(searchPath, \".gitignore\");\n\t\t\t\t\t\tif (existsSync(rootGitignore)) gitignoreFiles.add(rootGitignore);\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst nestedGitignores = globSync(\"**/.gitignore\", {\n\t\t\t\t\t\t\t\tcwd: searchPath,\n\t\t\t\t\t\t\t\tdot: true,\n\t\t\t\t\t\t\t\tabsolute: true,\n\t\t\t\t\t\t\t\tignore: [\"**/node_modules/**\", \"**/.git/**\"],\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tfor (const file of nestedGitignores) gitignoreFiles.add(file);\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t// ignore\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (const gitignorePath of gitignoreFiles) args.push(\"--ignore-file\", gitignorePath);\n\t\t\t\t\t\targs.push(pattern, searchPath);\n\n\t\t\t\t\t\tconst result = spawnSync(fdPath, args, { encoding: \"utf-8\", maxBuffer: 10 * 1024 * 1024 });\n\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\tif (result.error) {\n\t\t\t\t\t\t\treject(new Error(`Failed to run fd: ${result.error.message}`));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst output = result.stdout?.trim() || \"\";\n\t\t\t\t\t\tif (result.status !== 0) {\n\t\t\t\t\t\t\tconst errorMsg = result.stderr?.trim() || `fd exited with code ${result.status}`;\n\t\t\t\t\t\t\tif (!output) {\n\t\t\t\t\t\t\t\treject(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}\n\t\t\t\t\t\tif (!output) {\n\t\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: \"No files found matching pattern\" }],\n\t\t\t\t\t\t\t\tdetails: undefined,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst lines = output.split(\"\\n\");\n\t\t\t\t\t\tconst relativized: string[] = [];\n\t\t\t\t\t\tfor (const rawLine of lines) {\n\t\t\t\t\t\t\tconst line = rawLine.replace(/\\r$/, \"\").trim();\n\t\t\t\t\t\t\tif (!line) continue;\n\t\t\t\t\t\t\tconst hadTrailingSlash = line.endsWith(\"/\") || line.endsWith(\"\\\\\");\n\t\t\t\t\t\t\tlet relativePath = line;\n\t\t\t\t\t\t\tif (line.startsWith(searchPath)) {\n\t\t\t\t\t\t\t\trelativePath = line.slice(searchPath.length + 1);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\trelativePath = path.relative(searchPath, line);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (hadTrailingSlash && !relativePath.endsWith(\"/\")) relativePath += \"/\";\n\t\t\t\t\t\t\trelativized.push(toPosixPath(relativePath));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst resultLimitReached = relativized.length >= effectiveLimit;\n\t\t\t\t\t\tconst rawOutput = relativized.join(\"\\n\");\n\t\t\t\t\t\tconst truncation = truncateHead(rawOutput, { maxLines: Number.MAX_SAFE_INTEGER });\n\t\t\t\t\t\tlet resultOutput = truncation.content;\n\t\t\t\t\t\tconst details: FindToolDetails = {};\n\t\t\t\t\t\tconst notices: string[] = [];\n\t\t\t\t\t\tif (resultLimitReached) {\n\t\t\t\t\t\t\tnotices.push(\n\t\t\t\t\t\t\t\t`${effectiveLimit} results limit reached. Use limit=${effectiveLimit * 2} for more, or refine pattern`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tdetails.resultLimitReached = effectiveLimit;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (truncation.truncated) {\n\t\t\t\t\t\t\tnotices.push(`${formatSize(DEFAULT_MAX_BYTES)} limit reached`);\n\t\t\t\t\t\t\tdetails.truncation = truncation;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (notices.length > 0) {\n\t\t\t\t\t\t\tresultOutput += `\\n\\n[${notices.join(\". \")}]`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: resultOutput }],\n\t\t\t\t\t\t\tdetails: Object.keys(details).length > 0 ? details : undefined,\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (e: any) {\n\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\treject(e);\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(formatFindCall(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(formatFindResult(result as any, options, theme, context.showImages));\n\t\t\treturn text;\n\t\t},\n\t};\n}\n\nexport function createFindTool(cwd: string, options?: FindToolOptions): AgentTool<typeof findSchema> {\n\treturn wrapToolDefinition(createFindToolDefinition(cwd, options));\n}\n\n/** Default find tool using process.cwd() for backwards compatibility. */\nexport const findToolDefinition = createFindToolDefinition(process.cwd());\nexport const findTool = createFindTool(process.cwd());\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"grep.d.ts","sourceRoot":"","sources":["../../../src/core/tools/grep.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAMtD,OAAO,KAAK,EAAE,cAAc,EAA2B,MAAM,wBAAwB,CAAC;AAItF,OAAO,EAIN,KAAK,gBAAgB,EAGrB,MAAM,eAAe,CAAC;AAEvB,QAAA,MAAM,UAAU;;;;;;;;EAYd,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAGtD,MAAM,WAAW,eAAe;IAC/B,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B,mEAAmE;IACnE,WAAW,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IAClE,2CAA2C;IAC3C,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;CAC7D;AAOD,MAAM,WAAW,eAAe;IAC/B,yEAAyE;IACzE,UAAU,CAAC,EAAE,cAAc,CAAC;CAC5B;AAyDD,wBAAgB,wBAAwB,CACvC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,eAAe,GACvB,cAAc,CAAC,OAAO,UAAU,EAAE,eAAe,GAAG,SAAS,CAAC,CAkPhE;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC,OAAO,UAAU,CAAC,CAEnG;AAED,yEAAyE;AACzE,eAAO,MAAM,kBAAkB;;;;;;;;qCAA0C,CAAC;AAC1E,eAAO,MAAM,QAAQ;;;;;;;;QAAgC,CAAC","sourcesContent":["import { createInterface } from \"node:readline\";\nimport type { AgentTool } from \"@orient-cli/agent-core\";\nimport { Text } from \"@orient-cli/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 }> = [];\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\tif (filePath && typeof lineNumber === \"number\") matches.push({ filePath, lineNumber });\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\tconst block = await formatBlock(match.filePath, match.lineNumber);\n\t\t\t\t\t\t\t\toutputLines.push(...block);\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\n/** Default grep tool using process.cwd() for backwards compatibility. */\nexport const grepToolDefinition = createGrepToolDefinition(process.cwd());\nexport const grepTool = createGrepTool(process.cwd());\n"]}
@@ -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,E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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;AAED,yEAAyE;AACzE,MAAM,CAAC,MAAM,kBAAkB,GAAG,wBAAwB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;AAC1E,MAAM,CAAC,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC","sourcesContent":["import { createInterface } from \"node:readline\";\nimport type { AgentTool } from \"@orient-cli/agent-core\";\nimport { Text } from \"@orient-cli/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 }> = [];\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\tif (filePath && typeof lineNumber === \"number\") matches.push({ filePath, lineNumber });\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\tconst block = await formatBlock(match.filePath, match.lineNumber);\n\t\t\t\t\t\t\t\toutputLines.push(...block);\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\n/** Default grep tool using process.cwd() for backwards compatibility. */\nexport const grepToolDefinition = createGrepToolDefinition(process.cwd());\nexport const grepTool = createGrepTool(process.cwd());\n"]}
@@ -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,QAAQ,EACR,kBAAkB,EAClB,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,EACpB,QAAQ,EACR,kBAAkB,GAClB,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,EACpB,QAAQ,EACR,kBAAkB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,QAAQ,EACR,kBAAkB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,YAAY,EACZ,sBAAsB,EACtB,KAAK,YAAY,E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OAAO,QAAQ,CAAC;AAE7C,MAAM,WAAW,YAAY;IAC5B,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,IAAI,CAAC,EAAE,eAAe,CAAC;CACvB;AAED,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,EAAE,CAO1F;AAED,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,EAAE,CAO5F;AAED,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAUvG;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,EAAE,CAO7E;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,EAAE,CAE/E;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAU1F","sourcesContent":["export {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashTool,\n\tbashToolDefinition,\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\teditTool,\n\teditToolDefinition,\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\tfindTool,\n\tfindToolDefinition,\n} from \"./find.js\";\nexport {\n\tcreateGrepTool,\n\tcreateGrepToolDefinition,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\tgrepTool,\n\tgrepToolDefinition,\n} from \"./grep.js\";\nexport {\n\tcreateLsTool,\n\tcreateLsToolDefinition,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsTool,\n\tlsToolDefinition,\n} from \"./ls.js\";\nexport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadTool,\n\treadToolDefinition,\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\twriteTool,\n\twriteToolDefinition,\n} from \"./write.js\";\n\nimport type { AgentTool } from \"@orient-cli/agent-core\";\nimport type { ToolDefinition } from \"../extensions/types.js\";\nimport {\n\ttype BashToolOptions,\n\tbashTool,\n\tbashToolDefinition,\n\tcreateBashTool,\n\tcreateBashToolDefinition,\n} from \"./bash.js\";\nimport { createEditTool, createEditToolDefinition, editTool, editToolDefinition } from \"./edit.js\";\nimport { createFindTool, createFindToolDefinition, findTool, findToolDefinition } from \"./find.js\";\nimport { createGrepTool, createGrepToolDefinition, grepTool, grepToolDefinition } from \"./grep.js\";\nimport { createLsTool, createLsToolDefinition, lsTool, lsToolDefinition } from \"./ls.js\";\nimport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadToolOptions,\n\treadTool,\n\treadToolDefinition,\n} from \"./read.js\";\nimport { createWriteTool, createWriteToolDefinition, writeTool, writeToolDefinition } from \"./write.js\";\n\nexport type Tool = AgentTool<any>;\nexport type ToolDef = ToolDefinition<any, any>;\n\nexport const codingTools: Tool[] = [readTool, bashTool, editTool, writeTool];\nexport const readOnlyTools: Tool[] = [readTool, grepTool, findTool, lsTool];\n\nexport const allTools = {\n\tread: readTool,\n\tbash: bashTool,\n\tedit: editTool,\n\twrite: writeTool,\n\tgrep: grepTool,\n\tfind: findTool,\n\tls: lsTool,\n};\n\nexport const allToolDefinitions = {\n\tread: readToolDefinition,\n\tbash: bashToolDefinition,\n\tedit: editToolDefinition,\n\twrite: writeToolDefinition,\n\tgrep: grepToolDefinition,\n\tfind: findToolDefinition,\n\tls: lsToolDefinition,\n};\n\nexport type ToolName = keyof typeof allTools;\n\nexport interface ToolsOptions {\n\tread?: ReadToolOptions;\n\tbash?: BashToolOptions;\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),\n\t\tcreateWriteToolDefinition(cwd),\n\t];\n}\n\nexport function createReadOnlyToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateGrepToolDefinition(cwd),\n\t\tcreateFindToolDefinition(cwd),\n\t\tcreateLsToolDefinition(cwd),\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),\n\t\twrite: createWriteToolDefinition(cwd),\n\t\tgrep: createGrepToolDefinition(cwd),\n\t\tfind: createFindToolDefinition(cwd),\n\t\tls: createLsToolDefinition(cwd),\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),\n\t\tcreateWriteTool(cwd),\n\t];\n}\n\nexport function createReadOnlyTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [createReadTool(cwd, options?.read), createGrepTool(cwd), createFindTool(cwd), createLsTool(cwd)];\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),\n\t\twrite: createWriteTool(cwd),\n\t\tgrep: createGrepTool(cwd),\n\t\tfind: createFindTool(cwd),\n\t\tls: createLsTool(cwd),\n\t};\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAON,QAAQ,EACR,kBAAkB,EAClB,cAAc,EACd,wBAAwB,EACxB,yBAAyB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB,EAKxB,QAAQ,EACR,kBAAkB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EACN,cAAc,EACd,wBAAwB,EAKxB,QAAQ,EACR,kBAAkB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB,EAKxB,QAAQ,EACR,kBAAkB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,YAAY,EACZ,sBAAsB,EAKtB,MAAM,EACN,gBAAgB,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,cAAc,EACd,wBAAwB,EAKxB,QAAQ,EACR,kBAAkB,G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AAC;AAAA,CACF;AAED,MAAM,UAAU,iBAAiB,CAAC,GAAW,EAAE,OAAsB,EAAU;IAC9E,OAAO;QACN,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC;QAClC,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC;QAClC,cAAc,CAAC,GAAG,CAAC;QACnB,eAAe,CAAC,GAAG,CAAC;KACpB,CAAC;AAAA,CACF;AAED,MAAM,UAAU,mBAAmB,CAAC,GAAW,EAAE,OAAsB,EAAU;IAChF,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,cAAc,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;AAAA,CACzG;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,CAAC;QACzB,KAAK,EAAE,eAAe,CAAC,GAAG,CAAC;QAC3B,IAAI,EAAE,cAAc,CAAC,GAAG,CAAC;QACzB,IAAI,EAAE,cAAc,CAAC,GAAG,CAAC;QACzB,EAAE,EAAE,YAAY,CAAC,GAAG,CAAC;KACrB,CAAC;AAAA,CACF","sourcesContent":["export {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashTool,\n\tbashToolDefinition,\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\teditTool,\n\teditToolDefinition,\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\tfindTool,\n\tfindToolDefinition,\n} from \"./find.js\";\nexport {\n\tcreateGrepTool,\n\tcreateGrepToolDefinition,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\tgrepTool,\n\tgrepToolDefinition,\n} from \"./grep.js\";\nexport {\n\tcreateLsTool,\n\tcreateLsToolDefinition,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsTool,\n\tlsToolDefinition,\n} from \"./ls.js\";\nexport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadTool,\n\treadToolDefinition,\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\twriteTool,\n\twriteToolDefinition,\n} from \"./write.js\";\n\nimport type { AgentTool } from \"@orient-cli/agent-core\";\nimport type { ToolDefinition } from \"../extensions/types.js\";\nimport {\n\ttype BashToolOptions,\n\tbashTool,\n\tbashToolDefinition,\n\tcreateBashTool,\n\tcreateBashToolDefinition,\n} from \"./bash.js\";\nimport { createEditTool, createEditToolDefinition, editTool, editToolDefinition } from \"./edit.js\";\nimport { createFindTool, createFindToolDefinition, findTool, findToolDefinition } from \"./find.js\";\nimport { createGrepTool, createGrepToolDefinition, grepTool, grepToolDefinition } from \"./grep.js\";\nimport { createLsTool, createLsToolDefinition, lsTool, lsToolDefinition } from \"./ls.js\";\nimport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadToolOptions,\n\treadTool,\n\treadToolDefinition,\n} from \"./read.js\";\nimport { createWriteTool, createWriteToolDefinition, writeTool, writeToolDefinition } from \"./write.js\";\n\nexport type Tool = AgentTool<any>;\nexport type ToolDef = ToolDefinition<any, any>;\n\nexport const codingTools: Tool[] = [readTool, bashTool, editTool, writeTool];\nexport const readOnlyTools: Tool[] = [readTool, grepTool, findTool, lsTool];\n\nexport const allTools = {\n\tread: readTool,\n\tbash: bashTool,\n\tedit: editTool,\n\twrite: writeTool,\n\tgrep: grepTool,\n\tfind: findTool,\n\tls: lsTool,\n};\n\nexport const allToolDefinitions = {\n\tread: readToolDefinition,\n\tbash: bashToolDefinition,\n\tedit: editToolDefinition,\n\twrite: writeToolDefinition,\n\tgrep: grepToolDefinition,\n\tfind: findToolDefinition,\n\tls: lsToolDefinition,\n};\n\nexport type ToolName = keyof typeof allTools;\n\nexport interface ToolsOptions {\n\tread?: ReadToolOptions;\n\tbash?: BashToolOptions;\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),\n\t\tcreateWriteToolDefinition(cwd),\n\t];\n}\n\nexport function createReadOnlyToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateGrepToolDefinition(cwd),\n\t\tcreateFindToolDefinition(cwd),\n\t\tcreateLsToolDefinition(cwd),\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),\n\t\twrite: createWriteToolDefinition(cwd),\n\t\tgrep: createGrepToolDefinition(cwd),\n\t\tfind: createFindToolDefinition(cwd),\n\t\tls: createLsToolDefinition(cwd),\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),\n\t\tcreateWriteTool(cwd),\n\t];\n}\n\nexport function createReadOnlyTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [createReadTool(cwd, options?.read), createGrepTool(cwd), createFindTool(cwd), createLsTool(cwd)];\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),\n\t\twrite: createWriteTool(cwd),\n\t\tgrep: createGrepTool(cwd),\n\t\tfind: createFindTool(cwd),\n\t\tls: createLsTool(cwd),\n\t};\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../../src/core/tools/ls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAItD,OAAO,KAAK,EAAE,cAAc,EAA2B,MAAM,wBAAwB,CAAC;AAItF,OAAO,EAAiC,KAAK,gBAAgB,EAAgB,MAAM,eAAe,CAAC;AAEnG,QAAA,MAAM,QAAQ;;;EAGZ,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAC;AAIlD,MAAM,WAAW,aAAa;IAC7B,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC5B,2BAA2B;IAC3B,MAAM,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IAC7D,wDAAwD;IACxD,IAAI,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,OAAO,CAAA;KAAE,CAAC,GAAG;QAAE,WAAW,EAAE,MAAM,OAAO,CAAA;KAAE,CAAC;IACzG,6BAA6B;IAC7B,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC;CAChE;AAQD,MAAM,WAAW,aAAa;IAC7B,yEAAyE;IACzE,UAAU,CAAC,EAAE,YAAY,CAAC;CAC1B;AAkDD,wBAAgB,sBAAsB,CACrC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,aAAa,GACrB,cAAc,CAAC,OAAO,QAAQ,EAAE,aAAa,GAAG,SAAS,CAAC,CA2H5D;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC,OAAO,QAAQ,CAAC,CAE7F;AAED,uEAAuE;AACvE,eAAO,MAAM,gBAAgB;;;mCAAwC,CAAC;AACtE,eAAO,MAAM,MAAM;;;QAA8B,CAAC","sourcesContent":["import type { AgentTool } from \"@orient-cli/agent-core\";\nimport { Text } from \"@orient-cli/tui\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport { existsSync, readdirSync, statSync } from \"fs\";\nimport nodePath from \"path\";\nimport { keyHint } from \"../../modes/interactive/components/keybinding-hints.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 { DEFAULT_MAX_BYTES, formatSize, type TruncationResult, truncateHead } from \"./truncate.js\";\n\nconst lsSchema = Type.Object({\n\tpath: Type.Optional(Type.String({ description: \"Directory to list (default: current directory)\" })),\n\tlimit: Type.Optional(Type.Number({ description: \"Maximum number of entries to return (default: 500)\" })),\n});\n\nexport type LsToolInput = Static<typeof lsSchema>;\n\nconst DEFAULT_LIMIT = 500;\n\nexport interface LsToolDetails {\n\ttruncation?: TruncationResult;\n\tentryLimitReached?: number;\n}\n\n/**\n * Pluggable operations for the ls tool.\n * Override these to delegate directory listing to remote systems (for example SSH).\n */\nexport interface LsOperations {\n\t/** Check if path exists */\n\texists: (absolutePath: string) => Promise<boolean> | boolean;\n\t/** Get file or directory stats. Throws if not found. */\n\tstat: (absolutePath: string) => Promise<{ isDirectory: () => boolean }> | { isDirectory: () => boolean };\n\t/** Read directory entries */\n\treaddir: (absolutePath: string) => Promise<string[]> | string[];\n}\n\nconst defaultLsOperations: LsOperations = {\n\texists: existsSync,\n\tstat: statSync,\n\treaddir: readdirSync,\n};\n\nexport interface LsToolOptions {\n\t/** Custom operations for directory listing. Default: local filesystem */\n\toperations?: LsOperations;\n}\n\nfunction formatLsCall(\n\targs: { path?: string; limit?: number } | undefined,\n\ttheme: typeof import(\"../../modes/interactive/theme/theme.js\").theme,\n): string {\n\tconst rawPath = str(args?.path);\n\tconst path = rawPath !== null ? shortenPath(rawPath || \".\") : null;\n\tconst limit = args?.limit;\n\tconst invalidArg = invalidArgText(theme);\n\tlet text = `${theme.fg(\"toolTitle\", theme.bold(\"ls\"))} ${path === null ? invalidArg : theme.fg(\"accent\", path)}`;\n\tif (limit !== undefined) {\n\t\ttext += theme.fg(\"toolOutput\", ` (limit ${limit})`);\n\t}\n\treturn text;\n}\n\nfunction formatLsResult(\n\tresult: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tdetails?: LsToolDetails;\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 : 20;\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 entryLimit = result.details?.entryLimitReached;\n\tconst truncation = result.details?.truncation;\n\tif (entryLimit || truncation?.truncated) {\n\t\tconst warnings: string[] = [];\n\t\tif (entryLimit) warnings.push(`${entryLimit} entries limit`);\n\t\tif (truncation?.truncated) warnings.push(`${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit`);\n\t\ttext += `\\n${theme.fg(\"warning\", `[Truncated: ${warnings.join(\", \")}]`)}`;\n\t}\n\treturn text;\n}\n\nexport function createLsToolDefinition(\n\tcwd: string,\n\toptions?: LsToolOptions,\n): ToolDefinition<typeof lsSchema, LsToolDetails | undefined> {\n\tconst ops = options?.operations ?? defaultLsOperations;\n\treturn {\n\t\tname: \"ls\",\n\t\tlabel: \"ls\",\n\t\tdescription: `List directory contents. Returns entries sorted alphabetically, with '/' suffix for directories. Includes dotfiles. Output is truncated to ${DEFAULT_LIMIT} entries or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first).`,\n\t\tpromptSnippet: \"List directory contents\",\n\t\tparameters: lsSchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{ path, limit }: { path?: string; limit?: number },\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\n\t\t\t\tconst onAbort = () => reject(new Error(\"Operation aborted\"));\n\t\t\t\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\n\t\t\t\t(async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst dirPath = resolveToCwd(path || \".\", cwd);\n\t\t\t\t\t\tconst effectiveLimit = limit ?? DEFAULT_LIMIT;\n\n\t\t\t\t\t\t// Check if path exists.\n\t\t\t\t\t\tif (!(await ops.exists(dirPath))) {\n\t\t\t\t\t\t\treject(new Error(`Path not found: ${dirPath}`));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Check if path is a directory.\n\t\t\t\t\t\tconst stat = await ops.stat(dirPath);\n\t\t\t\t\t\tif (!stat.isDirectory()) {\n\t\t\t\t\t\t\treject(new Error(`Not a directory: ${dirPath}`));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Read directory entries.\n\t\t\t\t\t\tlet entries: string[];\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tentries = await ops.readdir(dirPath);\n\t\t\t\t\t\t} catch (e: any) {\n\t\t\t\t\t\t\treject(new Error(`Cannot read directory: ${e.message}`));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Sort alphabetically, case-insensitive.\n\t\t\t\t\t\tentries.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));\n\n\t\t\t\t\t\t// Format entries with directory indicators.\n\t\t\t\t\t\tconst results: string[] = [];\n\t\t\t\t\t\tlet entryLimitReached = false;\n\t\t\t\t\t\tfor (const entry of entries) {\n\t\t\t\t\t\t\tif (results.length >= effectiveLimit) {\n\t\t\t\t\t\t\t\tentryLimitReached = true;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst fullPath = nodePath.join(dirPath, entry);\n\t\t\t\t\t\t\tlet suffix = \"\";\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst entryStat = await ops.stat(fullPath);\n\t\t\t\t\t\t\t\tif (entryStat.isDirectory()) suffix = \"/\";\n\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t// Skip entries we cannot stat.\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tresults.push(entry + suffix);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\n\t\t\t\t\t\tif (results.length === 0) {\n\t\t\t\t\t\t\tresolve({ content: [{ type: \"text\", text: \"(empty directory)\" }], details: undefined });\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst rawOutput = results.join(\"\\n\");\n\t\t\t\t\t\t// Apply byte truncation. There is no separate line limit because entry count is already capped.\n\t\t\t\t\t\tconst truncation = truncateHead(rawOutput, { maxLines: Number.MAX_SAFE_INTEGER });\n\t\t\t\t\t\tlet output = truncation.content;\n\t\t\t\t\t\tconst details: LsToolDetails = {};\n\t\t\t\t\t\t// Build actionable notices for truncation and entry limits.\n\t\t\t\t\t\tconst notices: string[] = [];\n\t\t\t\t\t\tif (entryLimitReached) {\n\t\t\t\t\t\t\tnotices.push(`${effectiveLimit} entries limit reached. Use limit=${effectiveLimit * 2} for more`);\n\t\t\t\t\t\t\tdetails.entryLimitReached = effectiveLimit;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (truncation.truncated) {\n\t\t\t\t\t\t\tnotices.push(`${formatSize(DEFAULT_MAX_BYTES)} limit reached`);\n\t\t\t\t\t\t\tdetails.truncation = truncation;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (notices.length > 0) {\n\t\t\t\t\t\t\toutput += `\\n\\n[${notices.join(\". \")}]`;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: output }],\n\t\t\t\t\t\t\tdetails: Object.keys(details).length > 0 ? details : undefined,\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (e: any) {\n\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\treject(e);\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(formatLsCall(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(formatLsResult(result as any, options, theme, context.showImages));\n\t\t\treturn text;\n\t\t},\n\t};\n}\n\nexport function createLsTool(cwd: string, options?: LsToolOptions): AgentTool<typeof lsSchema> {\n\treturn wrapToolDefinition(createLsToolDefinition(cwd, options));\n}\n\n/** Default ls tool using process.cwd() for backwards compatibility. */\nexport const lsToolDefinition = createLsToolDefinition(process.cwd());\nexport const lsTool = createLsTool(process.cwd());\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ls.js","sourceRoot":"","sources":["../../../src/core/tools/ls.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACvD,OAAO,QAAQ,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,wDAAwD,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OA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ACxC,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,cAAc,CAAC,MAAa,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;YAChF,OAAO,IAAI,CAAC;QAAA,CACZ;KACD,CAAC;AAAA,CACF;AAED,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,OAAuB,EAA8B;IAC9F,OAAO,kBAAkB,CAAC,sBAAsB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AAAA,CAChE;AAED,uEAAuE;AACvE,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;AACtE,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC","sourcesContent":["import type { AgentTool } from \"@orient-cli/agent-core\";\nimport { Text } from \"@orient-cli/tui\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport { existsSync, readdirSync, statSync } from \"fs\";\nimport nodePath from \"path\";\nimport { keyHint } from \"../../modes/interactive/components/keybinding-hints.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 { DEFAULT_MAX_BYTES, formatSize, type TruncationResult, truncateHead } from \"./truncate.js\";\n\nconst lsSchema = Type.Object({\n\tpath: Type.Optional(Type.String({ description: \"Directory to list (default: current directory)\" })),\n\tlimit: Type.Optional(Type.Number({ description: \"Maximum number of entries to return (default: 500)\" })),\n});\n\nexport type LsToolInput = Static<typeof lsSchema>;\n\nconst DEFAULT_LIMIT = 500;\n\nexport interface LsToolDetails {\n\ttruncation?: TruncationResult;\n\tentryLimitReached?: number;\n}\n\n/**\n * Pluggable operations for the ls tool.\n * Override these to delegate directory listing to remote systems (for example SSH).\n */\nexport interface LsOperations {\n\t/** Check if path exists */\n\texists: (absolutePath: string) => Promise<boolean> | boolean;\n\t/** Get file or directory stats. Throws if not found. */\n\tstat: (absolutePath: string) => Promise<{ isDirectory: () => boolean }> | { isDirectory: () => boolean };\n\t/** Read directory entries */\n\treaddir: (absolutePath: string) => Promise<string[]> | string[];\n}\n\nconst defaultLsOperations: LsOperations = {\n\texists: existsSync,\n\tstat: statSync,\n\treaddir: readdirSync,\n};\n\nexport interface LsToolOptions {\n\t/** Custom operations for directory listing. Default: local filesystem */\n\toperations?: LsOperations;\n}\n\nfunction formatLsCall(\n\targs: { path?: string; limit?: number } | undefined,\n\ttheme: typeof import(\"../../modes/interactive/theme/theme.js\").theme,\n): string {\n\tconst rawPath = str(args?.path);\n\tconst path = rawPath !== null ? shortenPath(rawPath || \".\") : null;\n\tconst limit = args?.limit;\n\tconst invalidArg = invalidArgText(theme);\n\tlet text = `${theme.fg(\"toolTitle\", theme.bold(\"ls\"))} ${path === null ? invalidArg : theme.fg(\"accent\", path)}`;\n\tif (limit !== undefined) {\n\t\ttext += theme.fg(\"toolOutput\", ` (limit ${limit})`);\n\t}\n\treturn text;\n}\n\nfunction formatLsResult(\n\tresult: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tdetails?: LsToolDetails;\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 : 20;\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 entryLimit = result.details?.entryLimitReached;\n\tconst truncation = result.details?.truncation;\n\tif (entryLimit || truncation?.truncated) {\n\t\tconst warnings: string[] = [];\n\t\tif (entryLimit) warnings.push(`${entryLimit} entries limit`);\n\t\tif (truncation?.truncated) warnings.push(`${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit`);\n\t\ttext += `\\n${theme.fg(\"warning\", `[Truncated: ${warnings.join(\", \")}]`)}`;\n\t}\n\treturn text;\n}\n\nexport function createLsToolDefinition(\n\tcwd: string,\n\toptions?: LsToolOptions,\n): ToolDefinition<typeof lsSchema, LsToolDetails | undefined> {\n\tconst ops = options?.operations ?? defaultLsOperations;\n\treturn {\n\t\tname: \"ls\",\n\t\tlabel: \"ls\",\n\t\tdescription: `List directory contents. Returns entries sorted alphabetically, with '/' suffix for directories. Includes dotfiles. Output is truncated to ${DEFAULT_LIMIT} entries or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first).`,\n\t\tpromptSnippet: \"List directory contents\",\n\t\tparameters: lsSchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{ path, limit }: { path?: string; limit?: number },\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\n\t\t\t\tconst onAbort = () => reject(new Error(\"Operation aborted\"));\n\t\t\t\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\n\t\t\t\t(async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst dirPath = resolveToCwd(path || \".\", cwd);\n\t\t\t\t\t\tconst effectiveLimit = limit ?? DEFAULT_LIMIT;\n\n\t\t\t\t\t\t// Check if path exists.\n\t\t\t\t\t\tif (!(await ops.exists(dirPath))) {\n\t\t\t\t\t\t\treject(new Error(`Path not found: ${dirPath}`));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Check if path is a directory.\n\t\t\t\t\t\tconst stat = await ops.stat(dirPath);\n\t\t\t\t\t\tif (!stat.isDirectory()) {\n\t\t\t\t\t\t\treject(new Error(`Not a directory: ${dirPath}`));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Read directory entries.\n\t\t\t\t\t\tlet entries: string[];\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tentries = await ops.readdir(dirPath);\n\t\t\t\t\t\t} catch (e: any) {\n\t\t\t\t\t\t\treject(new Error(`Cannot read directory: ${e.message}`));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Sort alphabetically, case-insensitive.\n\t\t\t\t\t\tentries.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));\n\n\t\t\t\t\t\t// Format entries with directory indicators.\n\t\t\t\t\t\tconst results: string[] = [];\n\t\t\t\t\t\tlet entryLimitReached = false;\n\t\t\t\t\t\tfor (const entry of entries) {\n\t\t\t\t\t\t\tif (results.length >= effectiveLimit) {\n\t\t\t\t\t\t\t\tentryLimitReached = true;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst fullPath = nodePath.join(dirPath, entry);\n\t\t\t\t\t\t\tlet suffix = \"\";\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst entryStat = await ops.stat(fullPath);\n\t\t\t\t\t\t\t\tif (entryStat.isDirectory()) suffix = \"/\";\n\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t// Skip entries we cannot stat.\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tresults.push(entry + suffix);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\n\t\t\t\t\t\tif (results.length === 0) {\n\t\t\t\t\t\t\tresolve({ content: [{ type: \"text\", text: \"(empty directory)\" }], details: undefined });\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst rawOutput = results.join(\"\\n\");\n\t\t\t\t\t\t// Apply byte truncation. There is no separate line limit because entry count is already capped.\n\t\t\t\t\t\tconst truncation = truncateHead(rawOutput, { maxLines: Number.MAX_SAFE_INTEGER });\n\t\t\t\t\t\tlet output = truncation.content;\n\t\t\t\t\t\tconst details: LsToolDetails = {};\n\t\t\t\t\t\t// Build actionable notices for truncation and entry limits.\n\t\t\t\t\t\tconst notices: string[] = [];\n\t\t\t\t\t\tif (entryLimitReached) {\n\t\t\t\t\t\t\tnotices.push(`${effectiveLimit} entries limit reached. Use limit=${effectiveLimit * 2} for more`);\n\t\t\t\t\t\t\tdetails.entryLimitReached = effectiveLimit;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (truncation.truncated) {\n\t\t\t\t\t\t\tnotices.push(`${formatSize(DEFAULT_MAX_BYTES)} limit reached`);\n\t\t\t\t\t\t\tdetails.truncation = truncation;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (notices.length > 0) {\n\t\t\t\t\t\t\toutput += `\\n\\n[${notices.join(\". \")}]`;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: output }],\n\t\t\t\t\t\t\tdetails: Object.keys(details).length > 0 ? details : undefined,\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (e: any) {\n\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\treject(e);\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(formatLsCall(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(formatLsResult(result as any, options, theme, context.showImages));\n\t\t\treturn text;\n\t\t},\n\t};\n}\n\nexport function createLsTool(cwd: string, options?: LsToolOptions): AgentTool<typeof lsSchema> {\n\treturn wrapToolDefinition(createLsToolDefinition(cwd, options));\n}\n\n/** Default ls tool using process.cwd() for backwards compatibility. */\nexport const lsToolDefinition = createLsToolDefinition(process.cwd());\nexport const lsTool = createLsTool(process.cwd());\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"path-utils.d.ts","sourceRoot":"","sources":["../../../src/core/tools/path-utils.ts"],"names":[],"mappings":"AAsCA,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CASnD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAMlE;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAgCrE","sourcesContent":["import { accessSync, constants } from \"node:fs\";\nimport * as os from \"node:os\";\nimport { isAbsolute, resolve as resolvePath } from \"node:path\";\n\nconst UNICODE_SPACES = /[\\u00A0\\u2000-\\u200A\\u202F\\u205F\\u3000]/g;\nconst NARROW_NO_BREAK_SPACE = \"\\u202F\";\nfunction normalizeUnicodeSpaces(str: string): string {\n\treturn str.replace(UNICODE_SPACES, \" \");\n}\n\nfunction tryMacOSScreenshotPath(filePath: string): string {\n\treturn filePath.replace(/ (AM|PM)\\./g, `${NARROW_NO_BREAK_SPACE}$1.`);\n}\n\nfunction tryNFDVariant(filePath: string): string {\n\t// macOS stores filenames in NFD (decomposed) form, try converting user input to NFD\n\treturn filePath.normalize(\"NFD\");\n}\n\nfunction tryCurlyQuoteVariant(filePath: string): string {\n\t// macOS uses U+2019 (right single quotation mark) in screenshot names like \"Capture d'écran\"\n\t// Users typically type U+0027 (straight apostrophe)\n\treturn filePath.replace(/'/g, \"\\u2019\");\n}\n\nfunction fileExists(filePath: string): boolean {\n\ttry {\n\t\taccessSync(filePath, constants.F_OK);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction normalizeAtPrefix(filePath: string): string {\n\treturn filePath.startsWith(\"@\") ? filePath.slice(1) : filePath;\n}\n\nexport function expandPath(filePath: string): string {\n\tconst normalized = normalizeUnicodeSpaces(normalizeAtPrefix(filePath));\n\tif (normalized === \"~\") {\n\t\treturn os.homedir();\n\t}\n\tif (normalized.startsWith(\"~/\")) {\n\t\treturn os.homedir() + normalized.slice(1);\n\t}\n\treturn normalized;\n}\n\n/**\n * Resolve a path relative to the given cwd.\n * Handles ~ expansion and absolute paths.\n */\nexport function resolveToCwd(filePath: string, cwd: string): string {\n\tconst expanded = expandPath(filePath);\n\tif (isAbsolute(expanded)) {\n\t\treturn expanded;\n\t}\n\treturn resolvePath(cwd, expanded);\n}\n\nexport function resolveReadPath(filePath: string, cwd: string): string {\n\tconst resolved = resolveToCwd(filePath, cwd);\n\n\tif (fileExists(resolved)) {\n\t\treturn resolved;\n\t}\n\n\t// Try macOS AM/PM variant (narrow no-break space before AM/PM)\n\tconst amPmVariant = tryMacOSScreenshotPath(resolved);\n\tif (amPmVariant !== resolved && fileExists(amPmVariant)) {\n\t\treturn amPmVariant;\n\t}\n\n\t// Try NFD variant (macOS stores filenames in NFD form)\n\tconst nfdVariant = tryNFDVariant(resolved);\n\tif (nfdVariant !== resolved && fileExists(nfdVariant)) {\n\t\treturn nfdVariant;\n\t}\n\n\t// Try curly quote variant (macOS uses U+2019 in screenshot names)\n\tconst curlyVariant = tryCurlyQuoteVariant(resolved);\n\tif (curlyVariant !== resolved && fileExists(curlyVariant)) {\n\t\treturn curlyVariant;\n\t}\n\n\t// Try combined NFD + curly quote (for French macOS screenshots like \"Capture d'écran\")\n\tconst nfdCurlyVariant = tryCurlyQuoteVariant(nfdVariant);\n\tif (nfdCurlyVariant !== resolved && fileExists(nfdCurlyVariant)) {\n\t\treturn nfdCurlyVariant;\n\t}\n\n\treturn resolved;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"path-utils.js","sourceRoot":"","sources":["../../../src/core/tools/path-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAE/D,MAAM,cAAc,GAAG,0CAA0C,CAAC;AAClE,MAAM,qBAAqB,GAAG,QAAQ,CAAC;AACvC,SAAS,sBAAsB,CAAC,GAAW,EAAU;IACpD,OAAO,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;AAAA,CACxC;AAED,SAAS,sBAAsB,CAAC,QAAgB,EAAU;IACzD,OAAO,QAAQ,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,qBAAqB,KAAK,CAAC,CAAC;AAAA,CACtE;AAED,SAAS,aAAa,CAAC,QAAgB,EAAU;IAChD,oFAAoF;IACpF,OAAO,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAAA,CACjC;AAED,SAAS,oBAAoB,CAAC,QAAgB,EAAU;IACvD,8FAA6F;IAC7F,oDAAoD;IACpD,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAAA,CACxC;AAED,SAAS,U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AAC,EAAE,CAAC;QAC1B,OAAO,QAAQ,CAAC;IACjB,CAAC;IAED,+DAA+D;IAC/D,MAAM,WAAW,GAAG,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IACrD,IAAI,WAAW,KAAK,QAAQ,IAAI,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QACzD,OAAO,WAAW,CAAC;IACpB,CAAC;IAED,uDAAuD;IACvD,MAAM,UAAU,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC3C,IAAI,UAAU,KAAK,QAAQ,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QACvD,OAAO,UAAU,CAAC;IACnB,CAAC;IAED,kEAAkE;IAClE,MAAM,YAAY,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IACpD,IAAI,YAAY,KAAK,QAAQ,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAC3D,OAAO,YAAY,CAAC;IACrB,CAAC;IAED,wFAAuF;IACvF,MAAM,eAAe,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;IACzD,IAAI,eAAe,KAAK,QAAQ,IAAI,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QACjE,OAAO,eAAe,CAAC;IACxB,CAAC;IAED,OAAO,QAAQ,CAAC;AAAA,CAChB","sourcesContent":["import { accessSync, constants } from \"node:fs\";\nimport * as os from \"node:os\";\nimport { isAbsolute, resolve as resolvePath } from \"node:path\";\n\nconst UNICODE_SPACES = /[\\u00A0\\u2000-\\u200A\\u202F\\u205F\\u3000]/g;\nconst NARROW_NO_BREAK_SPACE = \"\\u202F\";\nfunction normalizeUnicodeSpaces(str: string): string {\n\treturn str.replace(UNICODE_SPACES, \" \");\n}\n\nfunction tryMacOSScreenshotPath(filePath: string): string {\n\treturn filePath.replace(/ (AM|PM)\\./g, `${NARROW_NO_BREAK_SPACE}$1.`);\n}\n\nfunction tryNFDVariant(filePath: string): string {\n\t// macOS stores filenames in NFD (decomposed) form, try converting user input to NFD\n\treturn filePath.normalize(\"NFD\");\n}\n\nfunction tryCurlyQuoteVariant(filePath: string): string {\n\t// macOS uses U+2019 (right single quotation mark) in screenshot names like \"Capture d'écran\"\n\t// Users typically type U+0027 (straight apostrophe)\n\treturn filePath.replace(/'/g, \"\\u2019\");\n}\n\nfunction fileExists(filePath: string): boolean {\n\ttry {\n\t\taccessSync(filePath, constants.F_OK);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction normalizeAtPrefix(filePath: string): string {\n\treturn filePath.startsWith(\"@\") ? filePath.slice(1) : filePath;\n}\n\nexport function expandPath(filePath: string): string {\n\tconst normalized = normalizeUnicodeSpaces(normalizeAtPrefix(filePath));\n\tif (normalized === \"~\") {\n\t\treturn os.homedir();\n\t}\n\tif (normalized.startsWith(\"~/\")) {\n\t\treturn os.homedir() + normalized.slice(1);\n\t}\n\treturn normalized;\n}\n\n/**\n * Resolve a path relative to the given cwd.\n * Handles ~ expansion and absolute paths.\n */\nexport function resolveToCwd(filePath: string, cwd: string): string {\n\tconst expanded = expandPath(filePath);\n\tif (isAbsolute(expanded)) {\n\t\treturn expanded;\n\t}\n\treturn resolvePath(cwd, expanded);\n}\n\nexport function resolveReadPath(filePath: string, cwd: string): string {\n\tconst resolved = resolveToCwd(filePath, cwd);\n\n\tif (fileExists(resolved)) {\n\t\treturn resolved;\n\t}\n\n\t// Try macOS AM/PM variant (narrow no-break space before AM/PM)\n\tconst amPmVariant = tryMacOSScreenshotPath(resolved);\n\tif (amPmVariant !== resolved && fileExists(amPmVariant)) {\n\t\treturn amPmVariant;\n\t}\n\n\t// Try NFD variant (macOS stores filenames in NFD form)\n\tconst nfdVariant = tryNFDVariant(resolved);\n\tif (nfdVariant !== resolved && fileExists(nfdVariant)) {\n\t\treturn nfdVariant;\n\t}\n\n\t// Try curly quote variant (macOS uses U+2019 in screenshot names)\n\tconst curlyVariant = tryCurlyQuoteVariant(resolved);\n\tif (curlyVariant !== resolved && fileExists(curlyVariant)) {\n\t\treturn curlyVariant;\n\t}\n\n\t// Try combined NFD + curly quote (for French macOS screenshots like \"Capture d'écran\")\n\tconst nfdCurlyVariant = tryCurlyQuoteVariant(nfdVariant);\n\tif (nfdCurlyVariant !== resolved && fileExists(nfdCurlyVariant)) {\n\t\treturn nfdCurlyVariant;\n\t}\n\n\treturn resolved;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../src/core/tools/read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAOtD,OAAO,KAAK,EAAE,cAAc,EAA2B,MAAM,wBAAwB,CAAC;AAItF,OAAO,EAAoD,KAAK,gBAAgB,EAAgB,MAAM,eAAe,CAAC;AAEtH,QAAA,MAAM,UAAU;;;;EAId,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAEtD,MAAM,WAAW,eAAe;IAC/B,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B,qCAAqC;IACrC,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACpD,+CAA+C;IAC/C,MAAM,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,sEAAsE;IACtE,mBAAmB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CACnF;AAQD,MAAM,WAAW,eAAe;IAC/B,oEAAoE;IACpE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oEAAoE;IACpE,UAAU,CAAC,EAAE,cAAc,CAAC;CAC5B;AA6DD,wBAAgB,wBAAwB,CACvC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,eAAe,GACvB,cAAc,CAAC,OAAO,UAAU,EAAE,eAAe,GAAG,SAAS,CAAC,CAgJhE;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC,OAAO,UAAU,CAAC,CAEnG;AAED,yEAAyE;AACzE,eAAO,MAAM,kBAAkB;;;;qCAA0C,CAAC;AAC1E,eAAO,MAAM,QAAQ;;;;QAAgC,CAAC","sourcesContent":["import type { AgentTool } from \"@orient-cli/agent-core\";\nimport type { ImageContent, TextContent } from \"@orient-cli/ai\";\nimport { Text } from \"@orient-cli/tui\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport { constants } from \"fs\";\nimport { access as fsAccess, readFile as fsReadFile } from \"fs/promises\";\nimport { keyHint } from \"../../modes/interactive/components/keybinding-hints.js\";\nimport { getLanguageFromPath, highlightCode } from \"../../modes/interactive/theme/theme.js\";\nimport { formatDimensionNote, resizeImage } from \"../../utils/image-resize.js\";\nimport { detectSupportedImageMimeTypeFromFile } from \"../../utils/mime.js\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../extensions/types.js\";\nimport { resolveReadPath } from \"./path-utils.js\";\nimport { getTextOutput, invalidArgText, replaceTabs, shortenPath, str } from \"./render-utils.js\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.js\";\nimport { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, type TruncationResult, truncateHead } from \"./truncate.js\";\n\nconst readSchema = Type.Object({\n\tpath: Type.String({ description: \"Path to the file to read (relative or absolute)\" }),\n\toffset: Type.Optional(Type.Number({ description: \"Line number to start reading from (1-indexed)\" })),\n\tlimit: Type.Optional(Type.Number({ description: \"Maximum number of lines to read\" })),\n});\n\nexport type ReadToolInput = Static<typeof readSchema>;\n\nexport interface ReadToolDetails {\n\ttruncation?: TruncationResult;\n}\n\n/**\n * Pluggable operations for the read tool.\n * Override these to delegate file reading to remote systems (for example SSH).\n */\nexport interface ReadOperations {\n\t/** Read file contents as a Buffer */\n\treadFile: (absolutePath: string) => Promise<Buffer>;\n\t/** Check if file is readable (throw if not) */\n\taccess: (absolutePath: string) => Promise<void>;\n\t/** Detect image MIME type, return null or undefined for non-images */\n\tdetectImageMimeType?: (absolutePath: string) => Promise<string | null | undefined>;\n}\n\nconst defaultReadOperations: ReadOperations = {\n\treadFile: (path) => fsReadFile(path),\n\taccess: (path) => fsAccess(path, constants.R_OK),\n\tdetectImageMimeType: detectSupportedImageMimeTypeFromFile,\n};\n\nexport interface ReadToolOptions {\n\t/** Whether to auto-resize images to 2000x2000 max. Default: true */\n\tautoResizeImages?: boolean;\n\t/** Custom operations for file reading. Default: local filesystem */\n\toperations?: ReadOperations;\n}\n\nfunction formatReadCall(\n\targs: { path?: string; file_path?: string; offset?: number; limit?: number } | undefined,\n\ttheme: typeof import(\"../../modes/interactive/theme/theme.js\").theme,\n): string {\n\tconst rawPath = str(args?.file_path ?? args?.path);\n\tconst path = rawPath !== null ? shortenPath(rawPath) : null;\n\tconst offset = args?.offset;\n\tconst limit = args?.limit;\n\tconst invalidArg = invalidArgText(theme);\n\tlet pathDisplay = path === null ? invalidArg : path ? theme.fg(\"accent\", path) : theme.fg(\"toolOutput\", \"...\");\n\tif (offset !== undefined || limit !== undefined) {\n\t\tconst startLine = offset ?? 1;\n\t\tconst endLine = limit !== undefined ? startLine + limit - 1 : \"\";\n\t\tpathDisplay += theme.fg(\"warning\", `:${startLine}${endLine ? `-${endLine}` : \"\"}`);\n\t}\n\treturn `${theme.fg(\"toolTitle\", theme.bold(\"read\"))} ${pathDisplay}`;\n}\n\nfunction trimTrailingEmptyLines(lines: string[]): string[] {\n\tlet end = lines.length;\n\twhile (end > 0 && lines[end - 1] === \"\") {\n\t\tend--;\n\t}\n\treturn lines.slice(0, end);\n}\n\nfunction formatReadResult(\n\targs: { path?: string; file_path?: string; offset?: number; limit?: number } | undefined,\n\tresult: { content: (TextContent | ImageContent)[]; details?: ReadToolDetails },\n\toptions: ToolRenderResultOptions,\n\ttheme: typeof import(\"../../modes/interactive/theme/theme.js\").theme,\n\tshowImages: boolean,\n): string {\n\tconst rawPath = str(args?.file_path ?? args?.path);\n\tconst output = getTextOutput(result as any, showImages);\n\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tconst renderedLines = lang ? highlightCode(replaceTabs(output), lang) : output.split(\"\\n\");\n\tconst lines = trimTrailingEmptyLines(renderedLines);\n\tconst maxLines = options.expanded ? lines.length : 10;\n\tconst displayLines = lines.slice(0, maxLines);\n\tconst remaining = lines.length - maxLines;\n\tlet text = `\\n${displayLines.map((line) => (lang ? replaceTabs(line) : theme.fg(\"toolOutput\", replaceTabs(line)))).join(\"\\n\")}`;\n\tif (remaining > 0) {\n\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines,`)} ${keyHint(\"app.tools.expand\", \"to expand\")})`;\n\t}\n\n\tconst truncation = result.details?.truncation;\n\tif (truncation?.truncated) {\n\t\tif (truncation.firstLineExceedsLimit) {\n\t\t\ttext += `\\n${theme.fg(\"warning\", `[First line exceeds ${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit]`)}`;\n\t\t} else if (truncation.truncatedBy === \"lines\") {\n\t\t\ttext += `\\n${theme.fg(\"warning\", `[Truncated: showing ${truncation.outputLines} of ${truncation.totalLines} lines (${truncation.maxLines ?? DEFAULT_MAX_LINES} line limit)]`)}`;\n\t\t} else {\n\t\t\ttext += `\\n${theme.fg(\"warning\", `[Truncated: ${truncation.outputLines} lines shown (${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit)]`)}`;\n\t\t}\n\t}\n\treturn text;\n}\n\nexport function createReadToolDefinition(\n\tcwd: string,\n\toptions?: ReadToolOptions,\n): ToolDefinition<typeof readSchema, ReadToolDetails | undefined> {\n\tconst autoResizeImages = options?.autoResizeImages ?? true;\n\tconst ops = options?.operations ?? defaultReadOperations;\n\treturn {\n\t\tname: \"read\",\n\t\tlabel: \"read\",\n\t\tdescription: `Read the contents of a file. Supports text files and images (jpg, png, gif, webp). Images are sent as attachments. For text files, output is truncated to ${DEFAULT_MAX_LINES} lines or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first). Use offset/limit for large files. When you need the full file, continue with offset until complete.`,\n\t\tpromptSnippet: \"Read file contents\",\n\t\tpromptGuidelines: [\"Use read to examine files instead of cat or sed.\"],\n\t\tparameters: readSchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{ path, offset, limit }: { path: string; offset?: number; limit?: number },\n\t\t\tsignal?: AbortSignal,\n\t\t\t_onUpdate?,\n\t\t\t_ctx?,\n\t\t) {\n\t\t\tconst absolutePath = resolveReadPath(path, cwd);\n\t\t\treturn new Promise<{ content: (TextContent | ImageContent)[]; details: ReadToolDetails | undefined }>(\n\t\t\t\t(resolve, reject) => {\n\t\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tlet aborted = false;\n\t\t\t\t\tconst onAbort = () => {\n\t\t\t\t\t\taborted = true;\n\t\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\t};\n\t\t\t\t\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\n\t\t\t\t\t(async () => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t// Check if file exists and is readable.\n\t\t\t\t\t\t\tawait ops.access(absolutePath);\n\t\t\t\t\t\t\tif (aborted) return;\n\t\t\t\t\t\t\tconst mimeType = ops.detectImageMimeType ? await ops.detectImageMimeType(absolutePath) : undefined;\n\t\t\t\t\t\t\tlet content: (TextContent | ImageContent)[];\n\t\t\t\t\t\t\tlet details: ReadToolDetails | undefined;\n\t\t\t\t\t\t\tif (mimeType) {\n\t\t\t\t\t\t\t\t// Read image as binary.\n\t\t\t\t\t\t\t\tconst buffer = await ops.readFile(absolutePath);\n\t\t\t\t\t\t\t\tconst base64 = buffer.toString(\"base64\");\n\t\t\t\t\t\t\t\tif (autoResizeImages) {\n\t\t\t\t\t\t\t\t\t// Resize image if needed before sending it back to the model.\n\t\t\t\t\t\t\t\t\tconst resized = await resizeImage({ type: \"image\", data: base64, mimeType });\n\t\t\t\t\t\t\t\t\tif (!resized) {\n\t\t\t\t\t\t\t\t\t\tcontent = [\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\t\t\t\t\t\ttext: `Read image file [${mimeType}]\\n[Image omitted: could not be resized below the inline image size limit.]`,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tconst dimensionNote = formatDimensionNote(resized);\n\t\t\t\t\t\t\t\t\t\tlet textNote = `Read image file [${resized.mimeType}]`;\n\t\t\t\t\t\t\t\t\t\tif (dimensionNote) textNote += `\\n${dimensionNote}`;\n\t\t\t\t\t\t\t\t\t\tcontent = [\n\t\t\t\t\t\t\t\t\t\t\t{ type: \"text\", text: textNote },\n\t\t\t\t\t\t\t\t\t\t\t{ type: \"image\", data: resized.data, mimeType: resized.mimeType },\n\t\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tcontent = [\n\t\t\t\t\t\t\t\t\t\t{ type: \"text\", text: `Read image file [${mimeType}]` },\n\t\t\t\t\t\t\t\t\t\t{ type: \"image\", data: base64, mimeType },\n\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Read text content.\n\t\t\t\t\t\t\t\tconst buffer = await ops.readFile(absolutePath);\n\t\t\t\t\t\t\t\tconst textContent = buffer.toString(\"utf-8\");\n\t\t\t\t\t\t\t\tconst allLines = textContent.split(\"\\n\");\n\t\t\t\t\t\t\t\tconst totalFileLines = allLines.length;\n\t\t\t\t\t\t\t\t// Apply offset if specified. Convert from 1-indexed input to 0-indexed array access.\n\t\t\t\t\t\t\t\tconst startLine = offset ? Math.max(0, offset - 1) : 0;\n\t\t\t\t\t\t\t\tconst startLineDisplay = startLine + 1;\n\t\t\t\t\t\t\t\t// Check if offset is out of bounds.\n\t\t\t\t\t\t\t\tif (startLine >= allLines.length) {\n\t\t\t\t\t\t\t\t\tthrow new Error(`Offset ${offset} is beyond end of file (${allLines.length} lines total)`);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlet selectedContent: string;\n\t\t\t\t\t\t\t\tlet userLimitedLines: number | undefined;\n\t\t\t\t\t\t\t\t// If limit is specified by the user, honor it first. Otherwise truncateHead decides.\n\t\t\t\t\t\t\t\tif (limit !== undefined) {\n\t\t\t\t\t\t\t\t\tconst endLine = Math.min(startLine + limit, allLines.length);\n\t\t\t\t\t\t\t\t\tselectedContent = allLines.slice(startLine, endLine).join(\"\\n\");\n\t\t\t\t\t\t\t\t\tuserLimitedLines = endLine - startLine;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tselectedContent = allLines.slice(startLine).join(\"\\n\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Apply truncation, respecting both line and byte limits.\n\t\t\t\t\t\t\t\tconst truncation = truncateHead(selectedContent);\n\t\t\t\t\t\t\t\tlet outputText: string;\n\t\t\t\t\t\t\t\tif (truncation.firstLineExceedsLimit) {\n\t\t\t\t\t\t\t\t\t// First line alone exceeds the byte limit. Point the model at a bash fallback.\n\t\t\t\t\t\t\t\t\tconst firstLineSize = formatSize(Buffer.byteLength(allLines[startLine], \"utf-8\"));\n\t\t\t\t\t\t\t\t\toutputText = `[Line ${startLineDisplay} is ${firstLineSize}, exceeds ${formatSize(DEFAULT_MAX_BYTES)} limit. Use bash: sed -n '${startLineDisplay}p' ${path} | head -c ${DEFAULT_MAX_BYTES}]`;\n\t\t\t\t\t\t\t\t\tdetails = { truncation };\n\t\t\t\t\t\t\t\t} else if (truncation.truncated) {\n\t\t\t\t\t\t\t\t\t// Truncation occurred. Build an actionable continuation notice.\n\t\t\t\t\t\t\t\t\tconst endLineDisplay = startLineDisplay + truncation.outputLines - 1;\n\t\t\t\t\t\t\t\t\tconst nextOffset = endLineDisplay + 1;\n\t\t\t\t\t\t\t\t\toutputText = truncation.content;\n\t\t\t\t\t\t\t\t\tif (truncation.truncatedBy === \"lines\") {\n\t\t\t\t\t\t\t\t\t\toutputText += `\\n\\n[Showing lines ${startLineDisplay}-${endLineDisplay} of ${totalFileLines}. Use offset=${nextOffset} to continue.]`;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\toutputText += `\\n\\n[Showing lines ${startLineDisplay}-${endLineDisplay} of ${totalFileLines} (${formatSize(DEFAULT_MAX_BYTES)} limit). Use offset=${nextOffset} to continue.]`;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdetails = { truncation };\n\t\t\t\t\t\t\t\t} else if (userLimitedLines !== undefined && startLine + userLimitedLines < allLines.length) {\n\t\t\t\t\t\t\t\t\t// User-specified limit stopped early, but the file still has more content.\n\t\t\t\t\t\t\t\t\tconst remaining = allLines.length - (startLine + userLimitedLines);\n\t\t\t\t\t\t\t\t\tconst nextOffset = startLine + userLimitedLines + 1;\n\t\t\t\t\t\t\t\t\toutputText = `${truncation.content}\\n\\n[${remaining} more lines in file. Use offset=${nextOffset} to continue.]`;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// No truncation and no remaining user-limited content.\n\t\t\t\t\t\t\t\t\toutputText = truncation.content;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcontent = [{ type: \"text\", text: outputText }];\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (aborted) return;\n\t\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t\tresolve({ content, details });\n\t\t\t\t\t\t} catch (error: any) {\n\t\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t\tif (!aborted) reject(error);\n\t\t\t\t\t\t}\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(formatReadCall(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(formatReadResult(context.args, result as any, options, theme, context.showImages));\n\t\t\treturn text;\n\t\t},\n\t};\n}\n\nexport function createReadTool(cwd: string, options?: ReadToolOptions): AgentTool<typeof readSchema> {\n\treturn wrapToolDefinition(createReadToolDefinition(cwd, options));\n}\n\n/** Default read tool using process.cwd() for backwards compatibility. */\nexport const readToolDefinition = createReadToolDefinition(process.cwd());\nexport const readTool = createReadTool(process.cwd());\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"read.js","sourceRoot":"","sources":["../../../src/core/tools/read.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,wDAAwD,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAC5F,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,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wB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AAAA,CAClE;AAED,yEAAyE;AACzE,MAAM,CAAC,MAAM,kBAAkB,GAAG,wBAAwB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;AAC1E,MAAM,CAAC,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC","sourcesContent":["import type { AgentTool } from \"@orient-cli/agent-core\";\nimport type { ImageContent, TextContent } from \"@orient-cli/ai\";\nimport { Text } from \"@orient-cli/tui\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport { constants } from \"fs\";\nimport { access as fsAccess, readFile as fsReadFile } from \"fs/promises\";\nimport { keyHint } from \"../../modes/interactive/components/keybinding-hints.js\";\nimport { getLanguageFromPath, highlightCode } from \"../../modes/interactive/theme/theme.js\";\nimport { formatDimensionNote, resizeImage } from \"../../utils/image-resize.js\";\nimport { detectSupportedImageMimeTypeFromFile } from \"../../utils/mime.js\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../extensions/types.js\";\nimport { resolveReadPath } from \"./path-utils.js\";\nimport { getTextOutput, invalidArgText, replaceTabs, shortenPath, str } from \"./render-utils.js\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.js\";\nimport { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, type TruncationResult, truncateHead } from \"./truncate.js\";\n\nconst readSchema = Type.Object({\n\tpath: Type.String({ description: \"Path to the file to read (relative or absolute)\" }),\n\toffset: Type.Optional(Type.Number({ description: \"Line number to start reading from (1-indexed)\" })),\n\tlimit: Type.Optional(Type.Number({ description: \"Maximum number of lines to read\" })),\n});\n\nexport type ReadToolInput = Static<typeof readSchema>;\n\nexport interface ReadToolDetails {\n\ttruncation?: TruncationResult;\n}\n\n/**\n * Pluggable operations for the read tool.\n * Override these to delegate file reading to remote systems (for example SSH).\n */\nexport interface ReadOperations {\n\t/** Read file contents as a Buffer */\n\treadFile: (absolutePath: string) => Promise<Buffer>;\n\t/** Check if file is readable (throw if not) */\n\taccess: (absolutePath: string) => Promise<void>;\n\t/** Detect image MIME type, return null or undefined for non-images */\n\tdetectImageMimeType?: (absolutePath: string) => Promise<string | null | undefined>;\n}\n\nconst defaultReadOperations: ReadOperations = {\n\treadFile: (path) => fsReadFile(path),\n\taccess: (path) => fsAccess(path, constants.R_OK),\n\tdetectImageMimeType: detectSupportedImageMimeTypeFromFile,\n};\n\nexport interface ReadToolOptions {\n\t/** Whether to auto-resize images to 2000x2000 max. Default: true */\n\tautoResizeImages?: boolean;\n\t/** Custom operations for file reading. Default: local filesystem */\n\toperations?: ReadOperations;\n}\n\nfunction formatReadCall(\n\targs: { path?: string; file_path?: string; offset?: number; limit?: number } | undefined,\n\ttheme: typeof import(\"../../modes/interactive/theme/theme.js\").theme,\n): string {\n\tconst rawPath = str(args?.file_path ?? args?.path);\n\tconst path = rawPath !== null ? shortenPath(rawPath) : null;\n\tconst offset = args?.offset;\n\tconst limit = args?.limit;\n\tconst invalidArg = invalidArgText(theme);\n\tlet pathDisplay = path === null ? invalidArg : path ? theme.fg(\"accent\", path) : theme.fg(\"toolOutput\", \"...\");\n\tif (offset !== undefined || limit !== undefined) {\n\t\tconst startLine = offset ?? 1;\n\t\tconst endLine = limit !== undefined ? startLine + limit - 1 : \"\";\n\t\tpathDisplay += theme.fg(\"warning\", `:${startLine}${endLine ? `-${endLine}` : \"\"}`);\n\t}\n\treturn `${theme.fg(\"toolTitle\", theme.bold(\"read\"))} ${pathDisplay}`;\n}\n\nfunction trimTrailingEmptyLines(lines: string[]): string[] {\n\tlet end = lines.length;\n\twhile (end > 0 && lines[end - 1] === \"\") {\n\t\tend--;\n\t}\n\treturn lines.slice(0, end);\n}\n\nfunction formatReadResult(\n\targs: { path?: string; file_path?: string; offset?: number; limit?: number } | undefined,\n\tresult: { content: (TextContent | ImageContent)[]; details?: ReadToolDetails },\n\toptions: ToolRenderResultOptions,\n\ttheme: typeof import(\"../../modes/interactive/theme/theme.js\").theme,\n\tshowImages: boolean,\n): string {\n\tconst rawPath = str(args?.file_path ?? args?.path);\n\tconst output = getTextOutput(result as any, showImages);\n\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tconst renderedLines = lang ? highlightCode(replaceTabs(output), lang) : output.split(\"\\n\");\n\tconst lines = trimTrailingEmptyLines(renderedLines);\n\tconst maxLines = options.expanded ? lines.length : 10;\n\tconst displayLines = lines.slice(0, maxLines);\n\tconst remaining = lines.length - maxLines;\n\tlet text = `\\n${displayLines.map((line) => (lang ? replaceTabs(line) : theme.fg(\"toolOutput\", replaceTabs(line)))).join(\"\\n\")}`;\n\tif (remaining > 0) {\n\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines,`)} ${keyHint(\"app.tools.expand\", \"to expand\")})`;\n\t}\n\n\tconst truncation = result.details?.truncation;\n\tif (truncation?.truncated) {\n\t\tif (truncation.firstLineExceedsLimit) {\n\t\t\ttext += `\\n${theme.fg(\"warning\", `[First line exceeds ${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit]`)}`;\n\t\t} else if (truncation.truncatedBy === \"lines\") {\n\t\t\ttext += `\\n${theme.fg(\"warning\", `[Truncated: showing ${truncation.outputLines} of ${truncation.totalLines} lines (${truncation.maxLines ?? DEFAULT_MAX_LINES} line limit)]`)}`;\n\t\t} else {\n\t\t\ttext += `\\n${theme.fg(\"warning\", `[Truncated: ${truncation.outputLines} lines shown (${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit)]`)}`;\n\t\t}\n\t}\n\treturn text;\n}\n\nexport function createReadToolDefinition(\n\tcwd: string,\n\toptions?: ReadToolOptions,\n): ToolDefinition<typeof readSchema, ReadToolDetails | undefined> {\n\tconst autoResizeImages = options?.autoResizeImages ?? true;\n\tconst ops = options?.operations ?? defaultReadOperations;\n\treturn {\n\t\tname: \"read\",\n\t\tlabel: \"read\",\n\t\tdescription: `Read the contents of a file. Supports text files and images (jpg, png, gif, webp). Images are sent as attachments. For text files, output is truncated to ${DEFAULT_MAX_LINES} lines or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first). Use offset/limit for large files. When you need the full file, continue with offset until complete.`,\n\t\tpromptSnippet: \"Read file contents\",\n\t\tpromptGuidelines: [\"Use read to examine files instead of cat or sed.\"],\n\t\tparameters: readSchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{ path, offset, limit }: { path: string; offset?: number; limit?: number },\n\t\t\tsignal?: AbortSignal,\n\t\t\t_onUpdate?,\n\t\t\t_ctx?,\n\t\t) {\n\t\t\tconst absolutePath = resolveReadPath(path, cwd);\n\t\t\treturn new Promise<{ content: (TextContent | ImageContent)[]; details: ReadToolDetails | undefined }>(\n\t\t\t\t(resolve, reject) => {\n\t\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tlet aborted = false;\n\t\t\t\t\tconst onAbort = () => {\n\t\t\t\t\t\taborted = true;\n\t\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\t};\n\t\t\t\t\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\n\t\t\t\t\t(async () => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t// Check if file exists and is readable.\n\t\t\t\t\t\t\tawait ops.access(absolutePath);\n\t\t\t\t\t\t\tif (aborted) return;\n\t\t\t\t\t\t\tconst mimeType = ops.detectImageMimeType ? await ops.detectImageMimeType(absolutePath) : undefined;\n\t\t\t\t\t\t\tlet content: (TextContent | ImageContent)[];\n\t\t\t\t\t\t\tlet details: ReadToolDetails | undefined;\n\t\t\t\t\t\t\tif (mimeType) {\n\t\t\t\t\t\t\t\t// Read image as binary.\n\t\t\t\t\t\t\t\tconst buffer = await ops.readFile(absolutePath);\n\t\t\t\t\t\t\t\tconst base64 = buffer.toString(\"base64\");\n\t\t\t\t\t\t\t\tif (autoResizeImages) {\n\t\t\t\t\t\t\t\t\t// Resize image if needed before sending it back to the model.\n\t\t\t\t\t\t\t\t\tconst resized = await resizeImage({ type: \"image\", data: base64, mimeType });\n\t\t\t\t\t\t\t\t\tif (!resized) {\n\t\t\t\t\t\t\t\t\t\tcontent = [\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\t\t\t\t\t\ttext: `Read image file [${mimeType}]\\n[Image omitted: could not be resized below the inline image size limit.]`,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tconst dimensionNote = formatDimensionNote(resized);\n\t\t\t\t\t\t\t\t\t\tlet textNote = `Read image file [${resized.mimeType}]`;\n\t\t\t\t\t\t\t\t\t\tif (dimensionNote) textNote += `\\n${dimensionNote}`;\n\t\t\t\t\t\t\t\t\t\tcontent = [\n\t\t\t\t\t\t\t\t\t\t\t{ type: \"text\", text: textNote },\n\t\t\t\t\t\t\t\t\t\t\t{ type: \"image\", data: resized.data, mimeType: resized.mimeType },\n\t\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tcontent = [\n\t\t\t\t\t\t\t\t\t\t{ type: \"text\", text: `Read image file [${mimeType}]` },\n\t\t\t\t\t\t\t\t\t\t{ type: \"image\", data: base64, mimeType },\n\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Read text content.\n\t\t\t\t\t\t\t\tconst buffer = await ops.readFile(absolutePath);\n\t\t\t\t\t\t\t\tconst textContent = buffer.toString(\"utf-8\");\n\t\t\t\t\t\t\t\tconst allLines = textContent.split(\"\\n\");\n\t\t\t\t\t\t\t\tconst totalFileLines = allLines.length;\n\t\t\t\t\t\t\t\t// Apply offset if specified. Convert from 1-indexed input to 0-indexed array access.\n\t\t\t\t\t\t\t\tconst startLine = offset ? Math.max(0, offset - 1) : 0;\n\t\t\t\t\t\t\t\tconst startLineDisplay = startLine + 1;\n\t\t\t\t\t\t\t\t// Check if offset is out of bounds.\n\t\t\t\t\t\t\t\tif (startLine >= allLines.length) {\n\t\t\t\t\t\t\t\t\tthrow new Error(`Offset ${offset} is beyond end of file (${allLines.length} lines total)`);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlet selectedContent: string;\n\t\t\t\t\t\t\t\tlet userLimitedLines: number | undefined;\n\t\t\t\t\t\t\t\t// If limit is specified by the user, honor it first. Otherwise truncateHead decides.\n\t\t\t\t\t\t\t\tif (limit !== undefined) {\n\t\t\t\t\t\t\t\t\tconst endLine = Math.min(startLine + limit, allLines.length);\n\t\t\t\t\t\t\t\t\tselectedContent = allLines.slice(startLine, endLine).join(\"\\n\");\n\t\t\t\t\t\t\t\t\tuserLimitedLines = endLine - startLine;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tselectedContent = allLines.slice(startLine).join(\"\\n\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Apply truncation, respecting both line and byte limits.\n\t\t\t\t\t\t\t\tconst truncation = truncateHead(selectedContent);\n\t\t\t\t\t\t\t\tlet outputText: string;\n\t\t\t\t\t\t\t\tif (truncation.firstLineExceedsLimit) {\n\t\t\t\t\t\t\t\t\t// First line alone exceeds the byte limit. Point the model at a bash fallback.\n\t\t\t\t\t\t\t\t\tconst firstLineSize = formatSize(Buffer.byteLength(allLines[startLine], \"utf-8\"));\n\t\t\t\t\t\t\t\t\toutputText = `[Line ${startLineDisplay} is ${firstLineSize}, exceeds ${formatSize(DEFAULT_MAX_BYTES)} limit. Use bash: sed -n '${startLineDisplay}p' ${path} | head -c ${DEFAULT_MAX_BYTES}]`;\n\t\t\t\t\t\t\t\t\tdetails = { truncation };\n\t\t\t\t\t\t\t\t} else if (truncation.truncated) {\n\t\t\t\t\t\t\t\t\t// Truncation occurred. Build an actionable continuation notice.\n\t\t\t\t\t\t\t\t\tconst endLineDisplay = startLineDisplay + truncation.outputLines - 1;\n\t\t\t\t\t\t\t\t\tconst nextOffset = endLineDisplay + 1;\n\t\t\t\t\t\t\t\t\toutputText = truncation.content;\n\t\t\t\t\t\t\t\t\tif (truncation.truncatedBy === \"lines\") {\n\t\t\t\t\t\t\t\t\t\toutputText += `\\n\\n[Showing lines ${startLineDisplay}-${endLineDisplay} of ${totalFileLines}. Use offset=${nextOffset} to continue.]`;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\toutputText += `\\n\\n[Showing lines ${startLineDisplay}-${endLineDisplay} of ${totalFileLines} (${formatSize(DEFAULT_MAX_BYTES)} limit). Use offset=${nextOffset} to continue.]`;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdetails = { truncation };\n\t\t\t\t\t\t\t\t} else if (userLimitedLines !== undefined && startLine + userLimitedLines < allLines.length) {\n\t\t\t\t\t\t\t\t\t// User-specified limit stopped early, but the file still has more content.\n\t\t\t\t\t\t\t\t\tconst remaining = allLines.length - (startLine + userLimitedLines);\n\t\t\t\t\t\t\t\t\tconst nextOffset = startLine + userLimitedLines + 1;\n\t\t\t\t\t\t\t\t\toutputText = `${truncation.content}\\n\\n[${remaining} more lines in file. Use offset=${nextOffset} to continue.]`;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// No truncation and no remaining user-limited content.\n\t\t\t\t\t\t\t\t\toutputText = truncation.content;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcontent = [{ type: \"text\", text: outputText }];\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (aborted) return;\n\t\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t\tresolve({ content, details });\n\t\t\t\t\t\t} catch (error: any) {\n\t\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t\tif (!aborted) reject(error);\n\t\t\t\t\t\t}\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(formatReadCall(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(formatReadResult(context.args, result as any, options, theme, context.showImages));\n\t\t\treturn text;\n\t\t},\n\t};\n}\n\nexport function createReadTool(cwd: string, options?: ReadToolOptions): AgentTool<typeof readSchema> {\n\treturn wrapToolDefinition(createReadToolDefinition(cwd, options));\n}\n\n/** Default read tool using process.cwd() for backwards compatibility. */\nexport const readToolDefinition = createReadToolDefinition(process.cwd());\nexport const readTool = createReadTool(process.cwd());\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"render-utils.d.ts","sourceRoot":"","sources":["../../../src/core/tools/render-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAKhE,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAOjD;AAED,wBAAgB,GAAG,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAIjD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,wBAAgB,aAAa,CAC5B,MAAM,EAAE;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,GAAG,SAAS,EACzG,UAAU,EAAE,OAAO,GACjB,MAAM,CAsBR;AAED,MAAM,MAAM,oBAAoB,CAAC,QAAQ,IAAI;IAC5C,OAAO,EAAE,CAAC,WAAW,GAAG,YAAY,CAAC,EAAE,CAAC;IACxC,OAAO,EAAE,QAAQ,CAAC;CAClB,CAAC;AAEF,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,EAAE,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;CAAE,GAAG,MAAM,CAEzF","sourcesContent":["import * as os from \"node:os\";\nimport type { ImageContent, TextContent } from \"@orient-cli/ai\";\nimport { getCapabilities, getImageDimensions, imageFallback } from \"@orient-cli/tui\";\nimport stripAnsi from \"strip-ansi\";\nimport { sanitizeBinaryOutput } from \"../../utils/shell.js\";\n\nexport function shortenPath(path: unknown): string {\n\tif (typeof path !== \"string\") return \"\";\n\tconst home = os.homedir();\n\tif (path.startsWith(home)) {\n\t\treturn `~${path.slice(home.length)}`;\n\t}\n\treturn path;\n}\n\nexport function str(value: unknown): string | null {\n\tif (typeof value === \"string\") return value;\n\tif (value == null) return \"\";\n\treturn null;\n}\n\nexport function replaceTabs(text: string): string {\n\treturn text.replace(/\\t/g, \" \");\n}\n\nexport function normalizeDisplayText(text: string): string {\n\treturn text.replace(/\\r/g, \"\");\n}\n\nexport function getTextOutput(\n\tresult: { content: Array<{ type: string; text?: string; data?: string; mimeType?: string }> } | undefined,\n\tshowImages: boolean,\n): string {\n\tif (!result) return \"\";\n\n\tconst textBlocks = result.content.filter((c) => c.type === \"text\");\n\tconst imageBlocks = result.content.filter((c) => c.type === \"image\");\n\n\tlet output = textBlocks.map((c) => sanitizeBinaryOutput(stripAnsi(c.text || \"\")).replace(/\\r/g, \"\")).join(\"\\n\");\n\n\tconst caps = getCapabilities();\n\tif (imageBlocks.length > 0 && (!caps.images || !showImages)) {\n\t\tconst imageIndicators = imageBlocks\n\t\t\t.map((img) => {\n\t\t\t\tconst mimeType = img.mimeType ?? \"image/unknown\";\n\t\t\t\tconst dims =\n\t\t\t\t\timg.data && img.mimeType ? (getImageDimensions(img.data, img.mimeType) ?? undefined) : undefined;\n\t\t\t\treturn imageFallback(mimeType, dims);\n\t\t\t})\n\t\t\t.join(\"\\n\");\n\t\toutput = output ? `${output}\\n${imageIndicators}` : imageIndicators;\n\t}\n\n\treturn output;\n}\n\nexport type ToolRenderResultLike<TDetails> = {\n\tcontent: (TextContent | ImageContent)[];\n\tdetails: TDetails;\n};\n\nexport function invalidArgText(theme: { fg: (name: any, text: string) => string }): string {\n\treturn theme.fg(\"error\", \"[invalid arg]\");\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"render-utils.js","sourceRoot":"","sources":["../../../src/core/tools/render-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrF,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,UAAU,WAAW,CAAC,IAAa,EAAU;IAClD,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IACxC,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;IAC1B,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IACtC,CAAC;IACD,OAAO,IAAI,CAAC;AAAA,CACZ;AAED,MAAM,UAAU,GAAG,CAAC,KAAc,EAAiB;IAClD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,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e,CAAC;YACjD,MAAM,IAAI,GACT,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YAClG,OAAO,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAAA,CACrC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,KAAK,eAAe,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC;IACrE,CAAC;IAED,OAAO,MAAM,CAAC;AAAA,CACd;AAOD,MAAM,UAAU,cAAc,CAAC,KAAkD,EAAU;IAC1F,OAAO,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;AAAA,CAC1C","sourcesContent":["import * as os from \"node:os\";\nimport type { ImageContent, TextContent } from \"@orient-cli/ai\";\nimport { getCapabilities, getImageDimensions, imageFallback } from \"@orient-cli/tui\";\nimport stripAnsi from \"strip-ansi\";\nimport { sanitizeBinaryOutput } from \"../../utils/shell.js\";\n\nexport function shortenPath(path: unknown): string {\n\tif (typeof path !== \"string\") return \"\";\n\tconst home = os.homedir();\n\tif (path.startsWith(home)) {\n\t\treturn `~${path.slice(home.length)}`;\n\t}\n\treturn path;\n}\n\nexport function str(value: unknown): string | null {\n\tif (typeof value === \"string\") return value;\n\tif (value == null) return \"\";\n\treturn null;\n}\n\nexport function replaceTabs(text: string): string {\n\treturn text.replace(/\\t/g, \" \");\n}\n\nexport function normalizeDisplayText(text: string): string {\n\treturn text.replace(/\\r/g, \"\");\n}\n\nexport function getTextOutput(\n\tresult: { content: Array<{ type: string; text?: string; data?: string; mimeType?: string }> } | undefined,\n\tshowImages: boolean,\n): string {\n\tif (!result) return \"\";\n\n\tconst textBlocks = result.content.filter((c) => c.type === \"text\");\n\tconst imageBlocks = result.content.filter((c) => c.type === \"image\");\n\n\tlet output = textBlocks.map((c) => sanitizeBinaryOutput(stripAnsi(c.text || \"\")).replace(/\\r/g, \"\")).join(\"\\n\");\n\n\tconst caps = getCapabilities();\n\tif (imageBlocks.length > 0 && (!caps.images || !showImages)) {\n\t\tconst imageIndicators = imageBlocks\n\t\t\t.map((img) => {\n\t\t\t\tconst mimeType = img.mimeType ?? \"image/unknown\";\n\t\t\t\tconst dims =\n\t\t\t\t\timg.data && img.mimeType ? (getImageDimensions(img.data, img.mimeType) ?? undefined) : undefined;\n\t\t\t\treturn imageFallback(mimeType, dims);\n\t\t\t})\n\t\t\t.join(\"\\n\");\n\t\toutput = output ? `${output}\\n${imageIndicators}` : imageIndicators;\n\t}\n\n\treturn output;\n}\n\nexport type ToolRenderResultLike<TDetails> = {\n\tcontent: (TextContent | ImageContent)[];\n\tdetails: TDetails;\n};\n\nexport function invalidArgText(theme: { fg: (name: any, text: string) => string }): string {\n\treturn theme.fg(\"error\", \"[invalid arg]\");\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tool-definition-wrapper.d.ts","sourceRoot":"","sources":["../../../src/core/tools/tool-definition-wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE/E,oEAAoE;AACpE,wBAAgB,kBAAkB,CAAC,QAAQ,GAAG,OAAO,EACpD,UAAU,EAAE,cAAc,CAAC,GAAG,EAAE,QAAQ,CAAC,EACzC,UAAU,CAAC,EAAE,MAAM,gBAAgB,GACjC,SAAS,CAAC,GAAG,EAAE,QAAQ,CAAC,CAU1B;AAED,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAClC,WAAW,EAAE,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EACvC,UAAU,CAAC,EAAE,MAAM,gBAAgB,GACjC,SAAS,CAAC,GAAG,CAAC,EAAE,CAElB;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,GAAG,EAAE,OAAO,CAAC,CASpG","sourcesContent":["import type { AgentTool } from \"@orient-cli/agent-core\";\nimport type { ExtensionContext, ToolDefinition } from \"../extensions/types.js\";\n\n/** Wrap a ToolDefinition into an AgentTool for the core runtime. */\nexport function wrapToolDefinition<TDetails = unknown>(\n\tdefinition: ToolDefinition<any, TDetails>,\n\tctxFactory?: () => ExtensionContext,\n): AgentTool<any, TDetails> {\n\treturn {\n\t\tname: definition.name,\n\t\tlabel: definition.label,\n\t\tdescription: definition.description,\n\t\tparameters: definition.parameters,\n\t\tprepareArguments: definition.prepareArguments,\n\t\texecute: (toolCallId, params, signal, onUpdate) =>\n\t\t\tdefinition.execute(toolCallId, params, signal, onUpdate, ctxFactory?.() as ExtensionContext),\n\t};\n}\n\n/** Wrap multiple ToolDefinitions into AgentTools for the core runtime. */\nexport function wrapToolDefinitions(\n\tdefinitions: ToolDefinition<any, any>[],\n\tctxFactory?: () => ExtensionContext,\n): AgentTool<any>[] {\n\treturn definitions.map((definition) => wrapToolDefinition(definition, ctxFactory));\n}\n\n/**\n * Synthesize a minimal ToolDefinition from an AgentTool.\n *\n * This keeps AgentSession's internal registry definition-first even when a caller\n * provides plain AgentTool overrides that do not include prompt metadata or renderers.\n */\nexport function createToolDefinitionFromAgentTool(tool: AgentTool<any>): ToolDefinition<any, unknown> {\n\treturn {\n\t\tname: tool.name,\n\t\tlabel: tool.label,\n\t\tdescription: tool.description,\n\t\tparameters: tool.parameters as any,\n\t\tprepareArguments: tool.prepareArguments,\n\t\texecute: async (toolCallId, params, signal, onUpdate) => tool.execute(toolCallId, params, signal, onUpdate),\n\t};\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tool-definition-wrapper.js","sourceRoot":"","sources":["../../../src/core/tools/tool-definition-wrapper.ts"],"names":[],"mappings":"AAGA,oEAAoE;AACpE,MAAM,UAAU,kBAAkB,CACjC,UAAyC,EACzC,UAAmC,EACR;IAC3B,OAAO;QACN,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,WAAW,EAAE,UAAU,CAAC,WAAW;QACnC,UAAU,EAAE,UAAU,CAAC,UAAU;QACjC,gBAAgB,EAAE,UAAU,CAAC,gBAAgB;QAC7C,OAAO,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,CACjD,UAAU,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAsB,CAAC;KAC7F,CAAC;AAAA,CACF;AAED,0EAA0E;AAC1E,MAAM,UAAU,mBAAmB,CAClC,WAAuC,EACvC,UAAmC,EAChB;IACnB,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,kBAAkB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AAAA,CACnF;AAED;;;;;GAKG;AACH,MAAM,UAAU,iCAAiC,CAAC,IAAoB,EAAgC;IACrG,OAAO;QACN,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,UAAU,EAAE,IAAI,CAAC,UAAiB;QAClC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;QACvC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC;KAC3G,CAAC;AAAA,CACF","sourcesContent":["import type { AgentTool } from \"@orient-cli/agent-core\";\nimport type { ExtensionContext, ToolDefinition } from \"../extensions/types.js\";\n\n/** Wrap a ToolDefinition into an AgentTool for the core runtime. */\nexport function wrapToolDefinition<TDetails = unknown>(\n\tdefinition: ToolDefinition<any, TDetails>,\n\tctxFactory?: () => ExtensionContext,\n): AgentTool<any, TDetails> {\n\treturn {\n\t\tname: definition.name,\n\t\tlabel: definition.label,\n\t\tdescription: definition.description,\n\t\tparameters: definition.parameters,\n\t\tprepareArguments: definition.prepareArguments,\n\t\texecute: (toolCallId, params, signal, onUpdate) =>\n\t\t\tdefinition.execute(toolCallId, params, signal, onUpdate, ctxFactory?.() as ExtensionContext),\n\t};\n}\n\n/** Wrap multiple ToolDefinitions into AgentTools for the core runtime. */\nexport function wrapToolDefinitions(\n\tdefinitions: ToolDefinition<any, any>[],\n\tctxFactory?: () => ExtensionContext,\n): AgentTool<any>[] {\n\treturn definitions.map((definition) => wrapToolDefinition(definition, ctxFactory));\n}\n\n/**\n * Synthesize a minimal ToolDefinition from an AgentTool.\n *\n * This keeps AgentSession's internal registry definition-first even when a caller\n * provides plain AgentTool overrides that do not include prompt metadata or renderers.\n */\nexport function createToolDefinitionFromAgentTool(tool: AgentTool<any>): ToolDefinition<any, unknown> {\n\treturn {\n\t\tname: tool.name,\n\t\tlabel: tool.label,\n\t\tdescription: tool.description,\n\t\tparameters: tool.parameters as any,\n\t\tprepareArguments: tool.prepareArguments,\n\t\texecute: async (toolCallId, params, signal, onUpdate) => tool.execute(toolCallId, params, signal, onUpdate),\n\t};\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"truncate.d.ts","sourceRoot":"","sources":["../../../src/core/tools/truncate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,iBAAiB,OAAO,CAAC;AACtC,eAAO,MAAM,iBAAiB,QAAY,CAAC;AAC3C,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,MAAM,WAAW,gBAAgB;IAChC,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,sEAAsE;IACtE,WAAW,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAAC;IACtC,oDAAoD;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,yFAAyF;IACzF,eAAe,EAAE,OAAO,CAAC;IACzB,2EAA2E;IAC3E,qBAAqB,EAAE,OAAO,CAAC;IAC/B,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IACjC,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQhD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,gBAAgB,CAkF/F;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,gBAAgB,CAyE/F;AAuBD;;;GAGG;AACH,wBAAgB,YAAY,CAC3B,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE,MAA6B,GACrC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,OAAO,CAAA;CAAE,CAKzC","sourcesContent":["/**\n * Shared truncation utilities for tool outputs.\n *\n * Truncation is based on two independent limits - whichever is hit first wins:\n * - Line limit (default: 2000 lines)\n * - Byte limit (default: 50KB)\n *\n * Never returns partial lines (except bash tail truncation edge case).\n */\n\nexport const DEFAULT_MAX_LINES = 2000;\nexport const DEFAULT_MAX_BYTES = 50 * 1024; // 50KB\nexport const GREP_MAX_LINE_LENGTH = 500; // Max chars per grep match line\n\nexport interface TruncationResult {\n\t/** The truncated content */\n\tcontent: string;\n\t/** Whether truncation occurred */\n\ttruncated: boolean;\n\t/** Which limit was hit: \"lines\", \"bytes\", or null if not truncated */\n\ttruncatedBy: \"lines\" | \"bytes\" | null;\n\t/** Total number of lines in the original content */\n\ttotalLines: number;\n\t/** Total number of bytes in the original content */\n\ttotalBytes: number;\n\t/** Number of complete lines in the truncated output */\n\toutputLines: number;\n\t/** Number of bytes in the truncated output */\n\toutputBytes: number;\n\t/** Whether the last line was partially truncated (only for tail truncation edge case) */\n\tlastLinePartial: boolean;\n\t/** Whether the first line exceeded the byte limit (for head truncation) */\n\tfirstLineExceedsLimit: boolean;\n\t/** The max lines limit that was applied */\n\tmaxLines: number;\n\t/** The max bytes limit that was applied */\n\tmaxBytes: number;\n}\n\nexport interface TruncationOptions {\n\t/** Maximum number of lines (default: 2000) */\n\tmaxLines?: number;\n\t/** Maximum number of bytes (default: 50KB) */\n\tmaxBytes?: number;\n}\n\n/**\n * Format bytes as human-readable size.\n */\nexport function formatSize(bytes: number): string {\n\tif (bytes < 1024) {\n\t\treturn `${bytes}B`;\n\t} else if (bytes < 1024 * 1024) {\n\t\treturn `${(bytes / 1024).toFixed(1)}KB`;\n\t} else {\n\t\treturn `${(bytes / (1024 * 1024)).toFixed(1)}MB`;\n\t}\n}\n\n/**\n * Truncate content from the head (keep first N lines/bytes).\n * Suitable for file reads where you want to see the beginning.\n *\n * Never returns partial lines. If first line exceeds byte limit,\n * returns empty content with firstLineExceedsLimit=true.\n */\nexport function truncateHead(content: string, options: TruncationOptions = {}): TruncationResult {\n\tconst maxLines = options.maxLines ?? DEFAULT_MAX_LINES;\n\tconst maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;\n\n\tconst totalBytes = Buffer.byteLength(content, \"utf-8\");\n\tconst lines = content.split(\"\\n\");\n\tconst totalLines = lines.length;\n\n\t// Check if no truncation needed\n\tif (totalLines <= maxLines && totalBytes <= maxBytes) {\n\t\treturn {\n\t\t\tcontent,\n\t\t\ttruncated: false,\n\t\t\ttruncatedBy: null,\n\t\t\ttotalLines,\n\t\t\ttotalBytes,\n\t\t\toutputLines: totalLines,\n\t\t\toutputBytes: totalBytes,\n\t\t\tlastLinePartial: false,\n\t\t\tfirstLineExceedsLimit: false,\n\t\t\tmaxLines,\n\t\t\tmaxBytes,\n\t\t};\n\t}\n\n\t// Check if first line alone exceeds byte limit\n\tconst firstLineBytes = Buffer.byteLength(lines[0], \"utf-8\");\n\tif (firstLineBytes > maxBytes) {\n\t\treturn {\n\t\t\tcontent: \"\",\n\t\t\ttruncated: true,\n\t\t\ttruncatedBy: \"bytes\",\n\t\t\ttotalLines,\n\t\t\ttotalBytes,\n\t\t\toutputLines: 0,\n\t\t\toutputBytes: 0,\n\t\t\tlastLinePartial: false,\n\t\t\tfirstLineExceedsLimit: true,\n\t\t\tmaxLines,\n\t\t\tmaxBytes,\n\t\t};\n\t}\n\n\t// Collect complete lines that fit\n\tconst outputLinesArr: string[] = [];\n\tlet outputBytesCount = 0;\n\tlet truncatedBy: \"lines\" | \"bytes\" = \"lines\";\n\n\tfor (let i = 0; i < lines.length && i < maxLines; i++) {\n\t\tconst line = lines[i];\n\t\tconst lineBytes = Buffer.byteLength(line, \"utf-8\") + (i > 0 ? 1 : 0); // +1 for newline\n\n\t\tif (outputBytesCount + lineBytes > maxBytes) {\n\t\t\ttruncatedBy = \"bytes\";\n\t\t\tbreak;\n\t\t}\n\n\t\toutputLinesArr.push(line);\n\t\toutputBytesCount += lineBytes;\n\t}\n\n\t// If we exited due to line limit\n\tif (outputLinesArr.length >= maxLines && outputBytesCount <= maxBytes) {\n\t\ttruncatedBy = \"lines\";\n\t}\n\n\tconst outputContent = outputLinesArr.join(\"\\n\");\n\tconst finalOutputBytes = Buffer.byteLength(outputContent, \"utf-8\");\n\n\treturn {\n\t\tcontent: outputContent,\n\t\ttruncated: true,\n\t\ttruncatedBy,\n\t\ttotalLines,\n\t\ttotalBytes,\n\t\toutputLines: outputLinesArr.length,\n\t\toutputBytes: finalOutputBytes,\n\t\tlastLinePartial: false,\n\t\tfirstLineExceedsLimit: false,\n\t\tmaxLines,\n\t\tmaxBytes,\n\t};\n}\n\n/**\n * Truncate content from the tail (keep last N lines/bytes).\n * Suitable for bash output where you want to see the end (errors, final results).\n *\n * May return partial first line if the last line of original content exceeds byte limit.\n */\nexport function truncateTail(content: string, options: TruncationOptions = {}): TruncationResult {\n\tconst maxLines = options.maxLines ?? DEFAULT_MAX_LINES;\n\tconst maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;\n\n\tconst totalBytes = Buffer.byteLength(content, \"utf-8\");\n\tconst lines = content.split(\"\\n\");\n\tconst totalLines = lines.length;\n\n\t// Check if no truncation needed\n\tif (totalLines <= maxLines && totalBytes <= maxBytes) {\n\t\treturn {\n\t\t\tcontent,\n\t\t\ttruncated: false,\n\t\t\ttruncatedBy: null,\n\t\t\ttotalLines,\n\t\t\ttotalBytes,\n\t\t\toutputLines: totalLines,\n\t\t\toutputBytes: totalBytes,\n\t\t\tlastLinePartial: false,\n\t\t\tfirstLineExceedsLimit: false,\n\t\t\tmaxLines,\n\t\t\tmaxBytes,\n\t\t};\n\t}\n\n\t// Work backwards from the end\n\tconst outputLinesArr: string[] = [];\n\tlet outputBytesCount = 0;\n\tlet truncatedBy: \"lines\" | \"bytes\" = \"lines\";\n\tlet lastLinePartial = false;\n\n\tfor (let i = lines.length - 1; i >= 0 && outputLinesArr.length < maxLines; i--) {\n\t\tconst line = lines[i];\n\t\tconst lineBytes = Buffer.byteLength(line, \"utf-8\") + (outputLinesArr.length > 0 ? 1 : 0); // +1 for newline\n\n\t\tif (outputBytesCount + lineBytes > maxBytes) {\n\t\t\ttruncatedBy = \"bytes\";\n\t\t\t// Edge case: if we haven't added ANY lines yet and this line exceeds maxBytes,\n\t\t\t// take the end of the line (partial)\n\t\t\tif (outputLinesArr.length === 0) {\n\t\t\t\tconst truncatedLine = truncateStringToBytesFromEnd(line, maxBytes);\n\t\t\t\toutputLinesArr.unshift(truncatedLine);\n\t\t\t\toutputBytesCount = Buffer.byteLength(truncatedLine, \"utf-8\");\n\t\t\t\tlastLinePartial = true;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\toutputLinesArr.unshift(line);\n\t\toutputBytesCount += lineBytes;\n\t}\n\n\t// If we exited due to line limit\n\tif (outputLinesArr.length >= maxLines && outputBytesCount <= maxBytes) {\n\t\ttruncatedBy = \"lines\";\n\t}\n\n\tconst outputContent = outputLinesArr.join(\"\\n\");\n\tconst finalOutputBytes = Buffer.byteLength(outputContent, \"utf-8\");\n\n\treturn {\n\t\tcontent: outputContent,\n\t\ttruncated: true,\n\t\ttruncatedBy,\n\t\ttotalLines,\n\t\ttotalBytes,\n\t\toutputLines: outputLinesArr.length,\n\t\toutputBytes: finalOutputBytes,\n\t\tlastLinePartial,\n\t\tfirstLineExceedsLimit: false,\n\t\tmaxLines,\n\t\tmaxBytes,\n\t};\n}\n\n/**\n * Truncate a string to fit within a byte limit (from the end).\n * Handles multi-byte UTF-8 characters correctly.\n */\nfunction truncateStringToBytesFromEnd(str: string, maxBytes: number): string {\n\tconst buf = Buffer.from(str, \"utf-8\");\n\tif (buf.length <= maxBytes) {\n\t\treturn str;\n\t}\n\n\t// Start from the end, skip maxBytes back\n\tlet start = buf.length - maxBytes;\n\n\t// Find a valid UTF-8 boundary (start of a character)\n\twhile (start < buf.length && (buf[start] & 0xc0) === 0x80) {\n\t\tstart++;\n\t}\n\n\treturn buf.slice(start).toString(\"utf-8\");\n}\n\n/**\n * Truncate a single line to max characters, adding [truncated] suffix.\n * Used for grep match lines.\n */\nexport function truncateLine(\n\tline: string,\n\tmaxChars: number = GREP_MAX_LINE_LENGTH,\n): { text: string; wasTruncated: boolean } {\n\tif (line.length <= maxChars) {\n\t\treturn { text: line, wasTruncated: false };\n\t}\n\treturn { text: `${line.slice(0, maxChars)}... [truncated]`, wasTruncated: true };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"truncate.js","sourceRoot":"","sources":["../../../src/core/tools/truncate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AACtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,OAAO;AACnD,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC,CAAC,gCAAgC;AAkCzE;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa,EAAU;IACjD,IAAI,KAAK,GAAG,IAAI,EAAE,CAAC;QAClB,OAAO,GAAG,KAAK,GAAG,CAAC;IACpB,CAAC;SAAM,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;QAChC,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IACzC,CAAC;SAAM,CAAC;QACP,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IAClD,CAAC;AAAA,CACD;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe,EAAE,OAAO,GAAsB,EAAE,EAAoB;IAChG,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,iBAAiB,CAAC;IACvD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,iBAAiB,CAAC;IAEvD,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACvD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC;IA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,QAAQ,GAAW,oBAAoB,EACG;IAC1C,IAAI,IAAI,CAAC,MAAM,IAAI,QAAQ,EAAE,CAAC;QAC7B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;IAC5C,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,iBAAiB,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;AAAA,CACjF","sourcesContent":["/**\n * Shared truncation utilities for tool outputs.\n *\n * Truncation is based on two independent limits - whichever is hit first wins:\n * - Line limit (default: 2000 lines)\n * - Byte limit (default: 50KB)\n *\n * Never returns partial lines (except bash tail truncation edge case).\n */\n\nexport const DEFAULT_MAX_LINES = 2000;\nexport const DEFAULT_MAX_BYTES = 50 * 1024; // 50KB\nexport const GREP_MAX_LINE_LENGTH = 500; // Max chars per grep match line\n\nexport interface TruncationResult {\n\t/** The truncated content */\n\tcontent: string;\n\t/** Whether truncation occurred */\n\ttruncated: boolean;\n\t/** Which limit was hit: \"lines\", \"bytes\", or null if not truncated */\n\ttruncatedBy: \"lines\" | \"bytes\" | null;\n\t/** Total number of lines in the original content */\n\ttotalLines: number;\n\t/** Total number of bytes in the original content */\n\ttotalBytes: number;\n\t/** Number of complete lines in the truncated output */\n\toutputLines: number;\n\t/** Number of bytes in the truncated output */\n\toutputBytes: number;\n\t/** Whether the last line was partially truncated (only for tail truncation edge case) */\n\tlastLinePartial: boolean;\n\t/** Whether the first line exceeded the byte limit (for head truncation) */\n\tfirstLineExceedsLimit: boolean;\n\t/** The max lines limit that was applied */\n\tmaxLines: number;\n\t/** The max bytes limit that was applied */\n\tmaxBytes: number;\n}\n\nexport interface TruncationOptions {\n\t/** Maximum number of lines (default: 2000) */\n\tmaxLines?: number;\n\t/** Maximum number of bytes (default: 50KB) */\n\tmaxBytes?: number;\n}\n\n/**\n * Format bytes as human-readable size.\n */\nexport function formatSize(bytes: number): string {\n\tif (bytes < 1024) {\n\t\treturn `${bytes}B`;\n\t} else if (bytes < 1024 * 1024) {\n\t\treturn `${(bytes / 1024).toFixed(1)}KB`;\n\t} else {\n\t\treturn `${(bytes / (1024 * 1024)).toFixed(1)}MB`;\n\t}\n}\n\n/**\n * Truncate content from the head (keep first N lines/bytes).\n * Suitable for file reads where you want to see the beginning.\n *\n * Never returns partial lines. If first line exceeds byte limit,\n * returns empty content with firstLineExceedsLimit=true.\n */\nexport function truncateHead(content: string, options: TruncationOptions = {}): TruncationResult {\n\tconst maxLines = options.maxLines ?? DEFAULT_MAX_LINES;\n\tconst maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;\n\n\tconst totalBytes = Buffer.byteLength(content, \"utf-8\");\n\tconst lines = content.split(\"\\n\");\n\tconst totalLines = lines.length;\n\n\t// Check if no truncation needed\n\tif (totalLines <= maxLines && totalBytes <= maxBytes) {\n\t\treturn {\n\t\t\tcontent,\n\t\t\ttruncated: false,\n\t\t\ttruncatedBy: null,\n\t\t\ttotalLines,\n\t\t\ttotalBytes,\n\t\t\toutputLines: totalLines,\n\t\t\toutputBytes: totalBytes,\n\t\t\tlastLinePartial: false,\n\t\t\tfirstLineExceedsLimit: false,\n\t\t\tmaxLines,\n\t\t\tmaxBytes,\n\t\t};\n\t}\n\n\t// Check if first line alone exceeds byte limit\n\tconst firstLineBytes = Buffer.byteLength(lines[0], \"utf-8\");\n\tif (firstLineBytes > maxBytes) {\n\t\treturn {\n\t\t\tcontent: \"\",\n\t\t\ttruncated: true,\n\t\t\ttruncatedBy: \"bytes\",\n\t\t\ttotalLines,\n\t\t\ttotalBytes,\n\t\t\toutputLines: 0,\n\t\t\toutputBytes: 0,\n\t\t\tlastLinePartial: false,\n\t\t\tfirstLineExceedsLimit: true,\n\t\t\tmaxLines,\n\t\t\tmaxBytes,\n\t\t};\n\t}\n\n\t// Collect complete lines that fit\n\tconst outputLinesArr: string[] = [];\n\tlet outputBytesCount = 0;\n\tlet truncatedBy: \"lines\" | \"bytes\" = \"lines\";\n\n\tfor (let i = 0; i < lines.length && i < maxLines; i++) {\n\t\tconst line = lines[i];\n\t\tconst lineBytes = Buffer.byteLength(line, \"utf-8\") + (i > 0 ? 1 : 0); // +1 for newline\n\n\t\tif (outputBytesCount + lineBytes > maxBytes) {\n\t\t\ttruncatedBy = \"bytes\";\n\t\t\tbreak;\n\t\t}\n\n\t\toutputLinesArr.push(line);\n\t\toutputBytesCount += lineBytes;\n\t}\n\n\t// If we exited due to line limit\n\tif (outputLinesArr.length >= maxLines && outputBytesCount <= maxBytes) {\n\t\ttruncatedBy = \"lines\";\n\t}\n\n\tconst outputContent = outputLinesArr.join(\"\\n\");\n\tconst finalOutputBytes = Buffer.byteLength(outputContent, \"utf-8\");\n\n\treturn {\n\t\tcontent: outputContent,\n\t\ttruncated: true,\n\t\ttruncatedBy,\n\t\ttotalLines,\n\t\ttotalBytes,\n\t\toutputLines: outputLinesArr.length,\n\t\toutputBytes: finalOutputBytes,\n\t\tlastLinePartial: false,\n\t\tfirstLineExceedsLimit: false,\n\t\tmaxLines,\n\t\tmaxBytes,\n\t};\n}\n\n/**\n * Truncate content from the tail (keep last N lines/bytes).\n * Suitable for bash output where you want to see the end (errors, final results).\n *\n * May return partial first line if the last line of original content exceeds byte limit.\n */\nexport function truncateTail(content: string, options: TruncationOptions = {}): TruncationResult {\n\tconst maxLines = options.maxLines ?? DEFAULT_MAX_LINES;\n\tconst maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;\n\n\tconst totalBytes = Buffer.byteLength(content, \"utf-8\");\n\tconst lines = content.split(\"\\n\");\n\tconst totalLines = lines.length;\n\n\t// Check if no truncation needed\n\tif (totalLines <= maxLines && totalBytes <= maxBytes) {\n\t\treturn {\n\t\t\tcontent,\n\t\t\ttruncated: false,\n\t\t\ttruncatedBy: null,\n\t\t\ttotalLines,\n\t\t\ttotalBytes,\n\t\t\toutputLines: totalLines,\n\t\t\toutputBytes: totalBytes,\n\t\t\tlastLinePartial: false,\n\t\t\tfirstLineExceedsLimit: false,\n\t\t\tmaxLines,\n\t\t\tmaxBytes,\n\t\t};\n\t}\n\n\t// Work backwards from the end\n\tconst outputLinesArr: string[] = [];\n\tlet outputBytesCount = 0;\n\tlet truncatedBy: \"lines\" | \"bytes\" = \"lines\";\n\tlet lastLinePartial = false;\n\n\tfor (let i = lines.length - 1; i >= 0 && outputLinesArr.length < maxLines; i--) {\n\t\tconst line = lines[i];\n\t\tconst lineBytes = Buffer.byteLength(line, \"utf-8\") + (outputLinesArr.length > 0 ? 1 : 0); // +1 for newline\n\n\t\tif (outputBytesCount + lineBytes > maxBytes) {\n\t\t\ttruncatedBy = \"bytes\";\n\t\t\t// Edge case: if we haven't added ANY lines yet and this line exceeds maxBytes,\n\t\t\t// take the end of the line (partial)\n\t\t\tif (outputLinesArr.length === 0) {\n\t\t\t\tconst truncatedLine = truncateStringToBytesFromEnd(line, maxBytes);\n\t\t\t\toutputLinesArr.unshift(truncatedLine);\n\t\t\t\toutputBytesCount = Buffer.byteLength(truncatedLine, \"utf-8\");\n\t\t\t\tlastLinePartial = true;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\toutputLinesArr.unshift(line);\n\t\toutputBytesCount += lineBytes;\n\t}\n\n\t// If we exited due to line limit\n\tif (outputLinesArr.length >= maxLines && outputBytesCount <= maxBytes) {\n\t\ttruncatedBy = \"lines\";\n\t}\n\n\tconst outputContent = outputLinesArr.join(\"\\n\");\n\tconst finalOutputBytes = Buffer.byteLength(outputContent, \"utf-8\");\n\n\treturn {\n\t\tcontent: outputContent,\n\t\ttruncated: true,\n\t\ttruncatedBy,\n\t\ttotalLines,\n\t\ttotalBytes,\n\t\toutputLines: outputLinesArr.length,\n\t\toutputBytes: finalOutputBytes,\n\t\tlastLinePartial,\n\t\tfirstLineExceedsLimit: false,\n\t\tmaxLines,\n\t\tmaxBytes,\n\t};\n}\n\n/**\n * Truncate a string to fit within a byte limit (from the end).\n * Handles multi-byte UTF-8 characters correctly.\n */\nfunction truncateStringToBytesFromEnd(str: string, maxBytes: number): string {\n\tconst buf = Buffer.from(str, \"utf-8\");\n\tif (buf.length <= maxBytes) {\n\t\treturn str;\n\t}\n\n\t// Start from the end, skip maxBytes back\n\tlet start = buf.length - maxBytes;\n\n\t// Find a valid UTF-8 boundary (start of a character)\n\twhile (start < buf.length && (buf[start] & 0xc0) === 0x80) {\n\t\tstart++;\n\t}\n\n\treturn buf.slice(start).toString(\"utf-8\");\n}\n\n/**\n * Truncate a single line to max characters, adding [truncated] suffix.\n * Used for grep match lines.\n */\nexport function truncateLine(\n\tline: string,\n\tmaxChars: number = GREP_MAX_LINE_LENGTH,\n): { text: string; wasTruncated: boolean } {\n\tif (line.length <= maxChars) {\n\t\treturn { text: line, wasTruncated: false };\n\t}\n\treturn { text: `${line.slice(0, maxChars)}... [truncated]`, wasTruncated: true };\n}\n"]}