@m4ike1/ion-coding-agent 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1126) hide show
  1. package/CHANGELOG.md +5747 -0
  2. package/README.md +738 -0
  3. package/dist/bun/cli.d.ts +5 -0
  4. package/dist/bun/cli.d.ts.map +1 -0
  5. package/dist/bun/cli.js +5 -0
  6. package/dist/bun/cli.js.map +1 -0
  7. package/dist/bun/restore-sandbox-env.d.ts +17 -0
  8. package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
  9. package/dist/bun/restore-sandbox-env.js +36 -0
  10. package/dist/bun/restore-sandbox-env.js.map +1 -0
  11. package/dist/bun/runtime-setup.d.ts +2 -0
  12. package/dist/bun/runtime-setup.d.ts.map +1 -0
  13. package/dist/bun/runtime-setup.js +9 -0
  14. package/dist/bun/runtime-setup.js.map +1 -0
  15. package/dist/bun/sandbox-env-setup.d.ts +2 -0
  16. package/dist/bun/sandbox-env-setup.d.ts.map +1 -0
  17. package/dist/bun/sandbox-env-setup.js +4 -0
  18. package/dist/bun/sandbox-env-setup.js.map +1 -0
  19. package/dist/bundle/chunks/anthropic-messages-RPVA4Z4Y.js +6 -0
  20. package/dist/bundle/chunks/anthropic.js +75 -0
  21. package/dist/bundle/chunks/azure-openai-responses-AJS3XTKL.js +2 -0
  22. package/dist/bundle/chunks/bedrock-converse-stream.js +78 -0
  23. package/dist/bundle/chunks/chunk-2MOZ6JBC.js +2 -0
  24. package/dist/bundle/chunks/chunk-3BIJ3AQO.js +12 -0
  25. package/dist/bundle/chunks/chunk-47K3I3YT.js +6 -0
  26. package/dist/bundle/chunks/chunk-4BN67GCJ.js +1664 -0
  27. package/dist/bundle/chunks/chunk-4PN6UIWX.js +2 -0
  28. package/dist/bundle/chunks/chunk-4TQA6ATT.js +4 -0
  29. package/dist/bundle/chunks/chunk-5NVSYJOG.js +2 -0
  30. package/dist/bundle/chunks/chunk-7OJL7DR5.js +2 -0
  31. package/dist/bundle/chunks/chunk-BEER2HEL.js +2 -0
  32. package/dist/bundle/chunks/chunk-CQX3HQAT.js +2 -0
  33. package/dist/bundle/chunks/chunk-FBMFFBV2.js +2 -0
  34. package/dist/bundle/chunks/chunk-GAZIWLQB.js +2 -0
  35. package/dist/bundle/chunks/chunk-HFYRAIWC.js +44 -0
  36. package/dist/bundle/chunks/chunk-IH7HUXWH.js +2 -0
  37. package/dist/bundle/chunks/chunk-LPP2XRBR.js +11 -0
  38. package/dist/bundle/chunks/chunk-LUTYILPM.js +25 -0
  39. package/dist/bundle/chunks/chunk-Q3ZNVFWD.js +42 -0
  40. package/dist/bundle/chunks/chunk-QNBVCBN3.js +2 -0
  41. package/dist/bundle/chunks/chunk-SWVWKUIA.js +2 -0
  42. package/dist/bundle/chunks/chunk-SY4QP6EI.js +2 -0
  43. package/dist/bundle/chunks/chunk-TVAWBPPS.js +2 -0
  44. package/dist/bundle/chunks/chunk-WPN6KEON.js +2 -0
  45. package/dist/bundle/chunks/chunk-WRID246J.js +2 -0
  46. package/dist/bundle/chunks/github-copilot.js +2 -0
  47. package/dist/bundle/chunks/google-generative-ai-S7SD5HC7.js +2 -0
  48. package/dist/bundle/chunks/google-vertex-NUNHA7QM.js +2 -0
  49. package/dist/bundle/chunks/https-proxy-agent-O2332S4O.js +13 -0
  50. package/dist/bundle/chunks/image-resize-worker.js +2 -0
  51. package/dist/bundle/chunks/ion-messages-KTW6MD7U.js +8 -0
  52. package/dist/bundle/chunks/kimi-coding.js +2 -0
  53. package/dist/bundle/chunks/lib-D4EQQPRR.js +9 -0
  54. package/dist/bundle/chunks/mistral-conversations-C7I3G2LA.js +5 -0
  55. package/dist/bundle/chunks/multipart-parser-PL2BXRDT.js +3 -0
  56. package/dist/bundle/chunks/node-7OQEATQA.js +2 -0
  57. package/dist/bundle/chunks/node-QIUI6CIW.js +16 -0
  58. package/dist/bundle/chunks/openai-codex-responses-2KRULDYR.js +10 -0
  59. package/dist/bundle/chunks/openai-codex.js +75 -0
  60. package/dist/bundle/chunks/openai-completions-64KX63FN.js +7 -0
  61. package/dist/bundle/chunks/openai-responses-QF3PPSTS.js +2 -0
  62. package/dist/bundle/chunks/openrouter-images-GQVXT3PO.js +2 -0
  63. package/dist/bundle/chunks/openrouter.js +75 -0
  64. package/dist/bundle/chunks/radius.js +75 -0
  65. package/dist/bundle/chunks/src-AZ7LBHGY.js +4 -0
  66. package/dist/bundle/chunks/xai.js +2 -0
  67. package/dist/bundle/cli.js +3 -0
  68. package/dist/bundle/index.js +2 -0
  69. package/dist/bundle/rpc-entry.js +3 -0
  70. package/dist/cli/args.d.ts +61 -0
  71. package/dist/cli/args.d.ts.map +1 -0
  72. package/dist/cli/args.js +440 -0
  73. package/dist/cli/args.js.map +1 -0
  74. package/dist/cli/auth-check.d.ts +19 -0
  75. package/dist/cli/auth-check.d.ts.map +1 -0
  76. package/dist/cli/auth-check.js +50 -0
  77. package/dist/cli/auth-check.js.map +1 -0
  78. package/dist/cli/auth-command.d.ts +24 -0
  79. package/dist/cli/auth-command.d.ts.map +1 -0
  80. package/dist/cli/auth-command.js +103 -0
  81. package/dist/cli/auth-command.js.map +1 -0
  82. package/dist/cli/config-selector.d.ts +16 -0
  83. package/dist/cli/config-selector.d.ts.map +1 -0
  84. package/dist/cli/config-selector.js +32 -0
  85. package/dist/cli/config-selector.js.map +1 -0
  86. package/dist/cli/credential-print.d.ts +13 -0
  87. package/dist/cli/credential-print.d.ts.map +1 -0
  88. package/dist/cli/credential-print.js +76 -0
  89. package/dist/cli/credential-print.js.map +1 -0
  90. package/dist/cli/file-processor.d.ts +15 -0
  91. package/dist/cli/file-processor.d.ts.map +1 -0
  92. package/dist/cli/file-processor.js +71 -0
  93. package/dist/cli/file-processor.js.map +1 -0
  94. package/dist/cli/initial-message.d.ts +18 -0
  95. package/dist/cli/initial-message.d.ts.map +1 -0
  96. package/dist/cli/initial-message.js +22 -0
  97. package/dist/cli/initial-message.js.map +1 -0
  98. package/dist/cli/list-models.d.ts +9 -0
  99. package/dist/cli/list-models.d.ts.map +1 -0
  100. package/dist/cli/list-models.js +98 -0
  101. package/dist/cli/list-models.js.map +1 -0
  102. package/dist/cli/project-trust.d.ts +10 -0
  103. package/dist/cli/project-trust.d.ts.map +1 -0
  104. package/dist/cli/project-trust.js +48 -0
  105. package/dist/cli/project-trust.js.map +1 -0
  106. package/dist/cli/session-picker.d.ts +10 -0
  107. package/dist/cli/session-picker.d.ts.map +1 -0
  108. package/dist/cli/session-picker.js +36 -0
  109. package/dist/cli/session-picker.js.map +1 -0
  110. package/dist/cli/setup.d.ts +2 -0
  111. package/dist/cli/setup.d.ts.map +1 -0
  112. package/dist/cli/setup.js +12 -0
  113. package/dist/cli/setup.js.map +1 -0
  114. package/dist/cli/startup-ui.d.ts +20 -0
  115. package/dist/cli/startup-ui.d.ts.map +1 -0
  116. package/dist/cli/startup-ui.js +185 -0
  117. package/dist/cli/startup-ui.js.map +1 -0
  118. package/dist/cli.d.ts +3 -0
  119. package/dist/cli.d.ts.map +1 -0
  120. package/dist/cli.js +6 -0
  121. package/dist/cli.js.map +1 -0
  122. package/dist/config.d.ts +122 -0
  123. package/dist/config.d.ts.map +1 -0
  124. package/dist/config.js +609 -0
  125. package/dist/config.js.map +1 -0
  126. package/dist/core/agent-session-runtime.d.ts +119 -0
  127. package/dist/core/agent-session-runtime.d.ts.map +1 -0
  128. package/dist/core/agent-session-runtime.js +317 -0
  129. package/dist/core/agent-session-runtime.js.map +1 -0
  130. package/dist/core/agent-session-services.d.ts +86 -0
  131. package/dist/core/agent-session-services.d.ts.map +1 -0
  132. package/dist/core/agent-session-services.js +134 -0
  133. package/dist/core/agent-session-services.js.map +1 -0
  134. package/dist/core/agent-session.d.ts +725 -0
  135. package/dist/core/agent-session.d.ts.map +1 -0
  136. package/dist/core/agent-session.js +2968 -0
  137. package/dist/core/agent-session.js.map +1 -0
  138. package/dist/core/auth-guidance.d.ts +5 -0
  139. package/dist/core/auth-guidance.d.ts.map +1 -0
  140. package/dist/core/auth-guidance.js +21 -0
  141. package/dist/core/auth-guidance.js.map +1 -0
  142. package/dist/core/auth-storage.d.ts +72 -0
  143. package/dist/core/auth-storage.d.ts.map +1 -0
  144. package/dist/core/auth-storage.js +426 -0
  145. package/dist/core/auth-storage.js.map +1 -0
  146. package/dist/core/bash-executor.d.ts +32 -0
  147. package/dist/core/bash-executor.d.ts.map +1 -0
  148. package/dist/core/bash-executor.js +111 -0
  149. package/dist/core/bash-executor.js.map +1 -0
  150. package/dist/core/cache-stats.d.ts +49 -0
  151. package/dist/core/cache-stats.d.ts.map +1 -0
  152. package/dist/core/cache-stats.js +101 -0
  153. package/dist/core/cache-stats.js.map +1 -0
  154. package/dist/core/compaction/branch-summarization.d.ts +98 -0
  155. package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
  156. package/dist/core/compaction/branch-summarization.js +251 -0
  157. package/dist/core/compaction/branch-summarization.js.map +1 -0
  158. package/dist/core/compaction/compaction.d.ts +145 -0
  159. package/dist/core/compaction/compaction.d.ts.map +1 -0
  160. package/dist/core/compaction/compaction.js +690 -0
  161. package/dist/core/compaction/compaction.js.map +1 -0
  162. package/dist/core/compaction/index.d.ts +7 -0
  163. package/dist/core/compaction/index.d.ts.map +1 -0
  164. package/dist/core/compaction/index.js +7 -0
  165. package/dist/core/compaction/index.js.map +1 -0
  166. package/dist/core/compaction/utils.d.ts +38 -0
  167. package/dist/core/compaction/utils.d.ts.map +1 -0
  168. package/dist/core/compaction/utils.js +142 -0
  169. package/dist/core/compaction/utils.js.map +1 -0
  170. package/dist/core/defaults.d.ts +4 -0
  171. package/dist/core/defaults.d.ts.map +1 -0
  172. package/dist/core/defaults.js +11 -0
  173. package/dist/core/defaults.js.map +1 -0
  174. package/dist/core/diagnostics.d.ts +15 -0
  175. package/dist/core/diagnostics.d.ts.map +1 -0
  176. package/dist/core/diagnostics.js +2 -0
  177. package/dist/core/diagnostics.js.map +1 -0
  178. package/dist/core/event-bus.d.ts +9 -0
  179. package/dist/core/event-bus.d.ts.map +1 -0
  180. package/dist/core/event-bus.js +25 -0
  181. package/dist/core/event-bus.js.map +1 -0
  182. package/dist/core/exec.d.ts +29 -0
  183. package/dist/core/exec.d.ts.map +1 -0
  184. package/dist/core/exec.js +75 -0
  185. package/dist/core/exec.js.map +1 -0
  186. package/dist/core/experimental.d.ts +2 -0
  187. package/dist/core/experimental.d.ts.map +1 -0
  188. package/dist/core/experimental.js +4 -0
  189. package/dist/core/experimental.js.map +1 -0
  190. package/dist/core/export-html/ansi-to-html.d.ts +22 -0
  191. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
  192. package/dist/core/export-html/ansi-to-html.js +249 -0
  193. package/dist/core/export-html/ansi-to-html.js.map +1 -0
  194. package/dist/core/export-html/index.d.ts +37 -0
  195. package/dist/core/export-html/index.d.ts.map +1 -0
  196. package/dist/core/export-html/index.js +226 -0
  197. package/dist/core/export-html/index.js.map +1 -0
  198. package/dist/core/export-html/template.css +1066 -0
  199. package/dist/core/export-html/template.html +55 -0
  200. package/dist/core/export-html/template.js +1871 -0
  201. package/dist/core/export-html/tool-renderer.d.ts +34 -0
  202. package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
  203. package/dist/core/export-html/tool-renderer.js +108 -0
  204. package/dist/core/export-html/tool-renderer.js.map +1 -0
  205. package/dist/core/export-html/vendor/highlight.min.js +1213 -0
  206. package/dist/core/export-html/vendor/marked.min.js +78 -0
  207. package/dist/core/extensions/index.d.ts +12 -0
  208. package/dist/core/extensions/index.d.ts.map +1 -0
  209. package/dist/core/extensions/index.js +9 -0
  210. package/dist/core/extensions/index.js.map +1 -0
  211. package/dist/core/extensions/loader.d.ts +23 -0
  212. package/dist/core/extensions/loader.d.ts.map +1 -0
  213. package/dist/core/extensions/loader.js +655 -0
  214. package/dist/core/extensions/loader.js.map +1 -0
  215. package/dist/core/extensions/runner.d.ts +178 -0
  216. package/dist/core/extensions/runner.d.ts.map +1 -0
  217. package/dist/core/extensions/runner.js +1011 -0
  218. package/dist/core/extensions/runner.js.map +1 -0
  219. package/dist/core/extensions/types.d.ts +1375 -0
  220. package/dist/core/extensions/types.d.ts.map +1 -0
  221. package/dist/core/extensions/types.js +54 -0
  222. package/dist/core/extensions/types.js.map +1 -0
  223. package/dist/core/extensions/wrapper.d.ts +20 -0
  224. package/dist/core/extensions/wrapper.d.ts.map +1 -0
  225. package/dist/core/extensions/wrapper.js +41 -0
  226. package/dist/core/extensions/wrapper.js.map +1 -0
  227. package/dist/core/footer-data-provider.d.ts +64 -0
  228. package/dist/core/footer-data-provider.d.ts.map +1 -0
  229. package/dist/core/footer-data-provider.js +338 -0
  230. package/dist/core/footer-data-provider.js.map +1 -0
  231. package/dist/core/http-dispatcher.d.ts +22 -0
  232. package/dist/core/http-dispatcher.d.ts.map +1 -0
  233. package/dist/core/http-dispatcher.js +98 -0
  234. package/dist/core/http-dispatcher.js.map +1 -0
  235. package/dist/core/index.d.ts +13 -0
  236. package/dist/core/index.d.ts.map +1 -0
  237. package/dist/core/index.js +13 -0
  238. package/dist/core/index.js.map +1 -0
  239. package/dist/core/ion-manifest.d.ts +8 -0
  240. package/dist/core/ion-manifest.d.ts.map +1 -0
  241. package/dist/core/ion-manifest.js +26 -0
  242. package/dist/core/ion-manifest.js.map +1 -0
  243. package/dist/core/keybindings.d.ts +475 -0
  244. package/dist/core/keybindings.d.ts.map +1 -0
  245. package/dist/core/keybindings.js +321 -0
  246. package/dist/core/keybindings.js.map +1 -0
  247. package/dist/core/messages.d.ts +77 -0
  248. package/dist/core/messages.d.ts.map +1 -0
  249. package/dist/core/messages.js +123 -0
  250. package/dist/core/messages.js.map +1 -0
  251. package/dist/core/model-config.d.ts +591 -0
  252. package/dist/core/model-config.d.ts.map +1 -0
  253. package/dist/core/model-config.js +259 -0
  254. package/dist/core/model-config.js.map +1 -0
  255. package/dist/core/model-registry.d.ts +49 -0
  256. package/dist/core/model-registry.d.ts.map +1 -0
  257. package/dist/core/model-registry.js +115 -0
  258. package/dist/core/model-registry.js.map +1 -0
  259. package/dist/core/model-resolver.d.ts +124 -0
  260. package/dist/core/model-resolver.d.ts.map +1 -0
  261. package/dist/core/model-resolver.js +591 -0
  262. package/dist/core/model-resolver.js.map +1 -0
  263. package/dist/core/model-runtime.d.ts +101 -0
  264. package/dist/core/model-runtime.d.ts.map +1 -0
  265. package/dist/core/model-runtime.js +606 -0
  266. package/dist/core/model-runtime.js.map +1 -0
  267. package/dist/core/models-store.d.ts +22 -0
  268. package/dist/core/models-store.d.ts.map +1 -0
  269. package/dist/core/models-store.js +115 -0
  270. package/dist/core/models-store.js.map +1 -0
  271. package/dist/core/output-guard.d.ts +7 -0
  272. package/dist/core/output-guard.d.ts.map +1 -0
  273. package/dist/core/output-guard.js +89 -0
  274. package/dist/core/output-guard.js.map +1 -0
  275. package/dist/core/package-manager.d.ts +216 -0
  276. package/dist/core/package-manager.d.ts.map +1 -0
  277. package/dist/core/package-manager.js +2207 -0
  278. package/dist/core/package-manager.js.map +1 -0
  279. package/dist/core/project-trust.d.ts +15 -0
  280. package/dist/core/project-trust.d.ts.map +1 -0
  281. package/dist/core/project-trust.js +59 -0
  282. package/dist/core/project-trust.js.map +1 -0
  283. package/dist/core/prompt-templates.d.ts +54 -0
  284. package/dist/core/prompt-templates.d.ts.map +1 -0
  285. package/dist/core/prompt-templates.js +236 -0
  286. package/dist/core/prompt-templates.js.map +1 -0
  287. package/dist/core/provider-attribution.d.ts +4 -0
  288. package/dist/core/provider-attribution.d.ts.map +1 -0
  289. package/dist/core/provider-attribution.js +72 -0
  290. package/dist/core/provider-attribution.js.map +1 -0
  291. package/dist/core/provider-composer.d.ts +58 -0
  292. package/dist/core/provider-composer.d.ts.map +1 -0
  293. package/dist/core/provider-composer.js +402 -0
  294. package/dist/core/provider-composer.js.map +1 -0
  295. package/dist/core/radius.d.ts +2 -0
  296. package/dist/core/radius.d.ts.map +1 -0
  297. package/dist/core/radius.js +2 -0
  298. package/dist/core/radius.js.map +1 -0
  299. package/dist/core/remote-catalog-provider.d.ts +5 -0
  300. package/dist/core/remote-catalog-provider.d.ts.map +1 -0
  301. package/dist/core/remote-catalog-provider.js +137 -0
  302. package/dist/core/remote-catalog-provider.js.map +1 -0
  303. package/dist/core/resolve-config-value.d.ts +30 -0
  304. package/dist/core/resolve-config-value.d.ts.map +1 -0
  305. package/dist/core/resolve-config-value.js +247 -0
  306. package/dist/core/resolve-config-value.js.map +1 -0
  307. package/dist/core/resource-loader.d.ts +221 -0
  308. package/dist/core/resource-loader.d.ts.map +1 -0
  309. package/dist/core/resource-loader.js +875 -0
  310. package/dist/core/resource-loader.js.map +1 -0
  311. package/dist/core/runtime-credentials.d.ts +15 -0
  312. package/dist/core/runtime-credentials.d.ts.map +1 -0
  313. package/dist/core/runtime-credentials.js +39 -0
  314. package/dist/core/runtime-credentials.js.map +1 -0
  315. package/dist/core/sdk.d.ts +108 -0
  316. package/dist/core/sdk.d.ts.map +1 -0
  317. package/dist/core/sdk.js +285 -0
  318. package/dist/core/sdk.js.map +1 -0
  319. package/dist/core/session-cwd.d.ts +19 -0
  320. package/dist/core/session-cwd.d.ts.map +1 -0
  321. package/dist/core/session-cwd.js +38 -0
  322. package/dist/core/session-cwd.js.map +1 -0
  323. package/dist/core/session-export.d.ts +4 -0
  324. package/dist/core/session-export.d.ts.map +1 -0
  325. package/dist/core/session-export.js +32 -0
  326. package/dist/core/session-export.js.map +1 -0
  327. package/dist/core/session-index.d.ts +67 -0
  328. package/dist/core/session-index.d.ts.map +1 -0
  329. package/dist/core/session-index.js +376 -0
  330. package/dist/core/session-index.js.map +1 -0
  331. package/dist/core/session-manager.d.ts +376 -0
  332. package/dist/core/session-manager.d.ts.map +1 -0
  333. package/dist/core/session-manager.js +1587 -0
  334. package/dist/core/session-manager.js.map +1 -0
  335. package/dist/core/session-naming-runtime.d.ts +153 -0
  336. package/dist/core/session-naming-runtime.d.ts.map +1 -0
  337. package/dist/core/session-naming-runtime.js +336 -0
  338. package/dist/core/session-naming-runtime.js.map +1 -0
  339. package/dist/core/settings-diagnostics.d.ts +9 -0
  340. package/dist/core/settings-diagnostics.d.ts.map +1 -0
  341. package/dist/core/settings-diagnostics.js +21 -0
  342. package/dist/core/settings-diagnostics.js.map +1 -0
  343. package/dist/core/settings-manager.d.ts +375 -0
  344. package/dist/core/settings-manager.d.ts.map +1 -0
  345. package/dist/core/settings-manager.js +1110 -0
  346. package/dist/core/settings-manager.js.map +1 -0
  347. package/dist/core/skills.d.ts +60 -0
  348. package/dist/core/skills.d.ts.map +1 -0
  349. package/dist/core/skills.js +412 -0
  350. package/dist/core/skills.js.map +1 -0
  351. package/dist/core/slash-commands.d.ts +17 -0
  352. package/dist/core/slash-commands.d.ts.map +1 -0
  353. package/dist/core/slash-commands.js +33 -0
  354. package/dist/core/slash-commands.js.map +1 -0
  355. package/dist/core/source-info.d.ts +18 -0
  356. package/dist/core/source-info.d.ts.map +1 -0
  357. package/dist/core/source-info.js +19 -0
  358. package/dist/core/source-info.js.map +1 -0
  359. package/dist/core/system-prompt.d.ts +28 -0
  360. package/dist/core/system-prompt.d.ts.map +1 -0
  361. package/dist/core/system-prompt.js +118 -0
  362. package/dist/core/system-prompt.js.map +1 -0
  363. package/dist/core/telemetry.d.ts +3 -0
  364. package/dist/core/telemetry.d.ts.map +1 -0
  365. package/dist/core/telemetry.js +9 -0
  366. package/dist/core/telemetry.js.map +1 -0
  367. package/dist/core/timings.d.ts +10 -0
  368. package/dist/core/timings.d.ts.map +1 -0
  369. package/dist/core/timings.js +41 -0
  370. package/dist/core/timings.js.map +1 -0
  371. package/dist/core/tools/bash.d.ts +87 -0
  372. package/dist/core/tools/bash.d.ts.map +1 -0
  373. package/dist/core/tools/bash.js +295 -0
  374. package/dist/core/tools/bash.js.map +1 -0
  375. package/dist/core/tools/edit-diff.d.ts +101 -0
  376. package/dist/core/tools/edit-diff.d.ts.map +1 -0
  377. package/dist/core/tools/edit-diff.js +421 -0
  378. package/dist/core/tools/edit-diff.js.map +1 -0
  379. package/dist/core/tools/edit.d.ts +44 -0
  380. package/dist/core/tools/edit.d.ts.map +1 -0
  381. package/dist/core/tools/edit.js +147 -0
  382. package/dist/core/tools/edit.js.map +1 -0
  383. package/dist/core/tools/file-mutation-queue.d.ts +6 -0
  384. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
  385. package/dist/core/tools/file-mutation-queue.js +52 -0
  386. package/dist/core/tools/file-mutation-queue.js.map +1 -0
  387. package/dist/core/tools/find.d.ts +42 -0
  388. package/dist/core/tools/find.d.ts.map +1 -0
  389. package/dist/core/tools/find.js +251 -0
  390. package/dist/core/tools/find.js.map +1 -0
  391. package/dist/core/tools/grep.d.ts +53 -0
  392. package/dist/core/tools/grep.d.ts.map +1 -0
  393. package/dist/core/tools/grep.js +463 -0
  394. package/dist/core/tools/grep.js.map +1 -0
  395. package/dist/core/tools/index.d.ts +49 -0
  396. package/dist/core/tools/index.d.ts.map +1 -0
  397. package/dist/core/tools/index.js +147 -0
  398. package/dist/core/tools/index.js.map +1 -0
  399. package/dist/core/tools/ls.d.ts +48 -0
  400. package/dist/core/tools/ls.d.ts.map +1 -0
  401. package/dist/core/tools/ls.js +224 -0
  402. package/dist/core/tools/ls.js.map +1 -0
  403. package/dist/core/tools/output-accumulator.d.ts +52 -0
  404. package/dist/core/tools/output-accumulator.d.ts.map +1 -0
  405. package/dist/core/tools/output-accumulator.js +184 -0
  406. package/dist/core/tools/output-accumulator.js.map +1 -0
  407. package/dist/core/tools/path-utils.d.ts +10 -0
  408. package/dist/core/tools/path-utils.d.ts.map +1 -0
  409. package/dist/core/tools/path-utils.js +99 -0
  410. package/dist/core/tools/path-utils.js.map +1 -0
  411. package/dist/core/tools/powershell.d.ts +16 -0
  412. package/dist/core/tools/powershell.d.ts.map +1 -0
  413. package/dist/core/tools/powershell.js +39 -0
  414. package/dist/core/tools/powershell.js.map +1 -0
  415. package/dist/core/tools/read.d.ts +39 -0
  416. package/dist/core/tools/read.d.ts.map +1 -0
  417. package/dist/core/tools/read.js +165 -0
  418. package/dist/core/tools/read.js.map +1 -0
  419. package/dist/core/tools/render-utils.d.ts +24 -0
  420. package/dist/core/tools/render-utils.d.ts.map +1 -0
  421. package/dist/core/tools/render-utils.js +65 -0
  422. package/dist/core/tools/render-utils.js.map +1 -0
  423. package/dist/core/tools/renderers/bash.d.ts +12 -0
  424. package/dist/core/tools/renderers/bash.d.ts.map +1 -0
  425. package/dist/core/tools/renderers/bash.js +130 -0
  426. package/dist/core/tools/renderers/bash.js.map +1 -0
  427. package/dist/core/tools/renderers/edit.d.ts +23 -0
  428. package/dist/core/tools/renderers/edit.d.ts.map +1 -0
  429. package/dist/core/tools/renderers/edit.js +167 -0
  430. package/dist/core/tools/renderers/edit.js.map +1 -0
  431. package/dist/core/tools/renderers/find.d.ts +10 -0
  432. package/dist/core/tools/renderers/find.d.ts.map +1 -0
  433. package/dist/core/tools/renderers/find.js +64 -0
  434. package/dist/core/tools/renderers/find.js.map +1 -0
  435. package/dist/core/tools/renderers/grep.d.ts +10 -0
  436. package/dist/core/tools/renderers/grep.d.ts.map +1 -0
  437. package/dist/core/tools/renderers/grep.js +69 -0
  438. package/dist/core/tools/renderers/grep.js.map +1 -0
  439. package/dist/core/tools/renderers/index.d.ts +29 -0
  440. package/dist/core/tools/renderers/index.d.ts.map +1 -0
  441. package/dist/core/tools/renderers/index.js +50 -0
  442. package/dist/core/tools/renderers/index.js.map +1 -0
  443. package/dist/core/tools/renderers/ls.d.ts +10 -0
  444. package/dist/core/tools/renderers/ls.d.ts.map +1 -0
  445. package/dist/core/tools/renderers/ls.js +66 -0
  446. package/dist/core/tools/renderers/ls.js.map +1 -0
  447. package/dist/core/tools/renderers/read.d.ts +11 -0
  448. package/dist/core/tools/renderers/read.d.ts.map +1 -0
  449. package/dist/core/tools/renderers/read.js +129 -0
  450. package/dist/core/tools/renderers/read.js.map +1 -0
  451. package/dist/core/tools/renderers/webfetch.d.ts +11 -0
  452. package/dist/core/tools/renderers/webfetch.d.ts.map +1 -0
  453. package/dist/core/tools/renderers/webfetch.js +89 -0
  454. package/dist/core/tools/renderers/webfetch.js.map +1 -0
  455. package/dist/core/tools/renderers/write.d.ts +10 -0
  456. package/dist/core/tools/renderers/write.d.ts.map +1 -0
  457. package/dist/core/tools/renderers/write.js +153 -0
  458. package/dist/core/tools/renderers/write.js.map +1 -0
  459. package/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
  460. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
  461. package/dist/core/tools/tool-definition-wrapper.js +36 -0
  462. package/dist/core/tools/tool-definition-wrapper.js.map +1 -0
  463. package/dist/core/tools/truncate.d.ts +70 -0
  464. package/dist/core/tools/truncate.d.ts.map +1 -0
  465. package/dist/core/tools/truncate.js +215 -0
  466. package/dist/core/tools/truncate.js.map +1 -0
  467. package/dist/core/tools/webextract.d.ts +36 -0
  468. package/dist/core/tools/webextract.d.ts.map +1 -0
  469. package/dist/core/tools/webextract.js +130 -0
  470. package/dist/core/tools/webextract.js.map +1 -0
  471. package/dist/core/tools/webfetch.d.ts +104 -0
  472. package/dist/core/tools/webfetch.d.ts.map +1 -0
  473. package/dist/core/tools/webfetch.js +231 -0
  474. package/dist/core/tools/webfetch.js.map +1 -0
  475. package/dist/core/tools/write.d.ts +30 -0
  476. package/dist/core/tools/write.d.ts.map +1 -0
  477. package/dist/core/tools/write.js +61 -0
  478. package/dist/core/tools/write.js.map +1 -0
  479. package/dist/core/trust-manager.d.ts +36 -0
  480. package/dist/core/trust-manager.d.ts.map +1 -0
  481. package/dist/core/trust-manager.js +203 -0
  482. package/dist/core/trust-manager.js.map +1 -0
  483. package/dist/core/usage-totals.d.ts +19 -0
  484. package/dist/core/usage-totals.d.ts.map +1 -0
  485. package/dist/core/usage-totals.js +52 -0
  486. package/dist/core/usage-totals.js.map +1 -0
  487. package/dist/core/webfetch/backend-exa.d.ts +65 -0
  488. package/dist/core/webfetch/backend-exa.d.ts.map +1 -0
  489. package/dist/core/webfetch/backend-exa.js +282 -0
  490. package/dist/core/webfetch/backend-exa.js.map +1 -0
  491. package/dist/core/webfetch/backend-firecrawl.d.ts +59 -0
  492. package/dist/core/webfetch/backend-firecrawl.d.ts.map +1 -0
  493. package/dist/core/webfetch/backend-firecrawl.js +339 -0
  494. package/dist/core/webfetch/backend-firecrawl.js.map +1 -0
  495. package/dist/core/webfetch/backend-undici.d.ts +21 -0
  496. package/dist/core/webfetch/backend-undici.d.ts.map +1 -0
  497. package/dist/core/webfetch/backend-undici.js +109 -0
  498. package/dist/core/webfetch/backend-undici.js.map +1 -0
  499. package/dist/core/webfetch/backend.d.ts +45 -0
  500. package/dist/core/webfetch/backend.d.ts.map +1 -0
  501. package/dist/core/webfetch/backend.js +9 -0
  502. package/dist/core/webfetch/backend.js.map +1 -0
  503. package/dist/core/webfetch/doc-store.d.ts +45 -0
  504. package/dist/core/webfetch/doc-store.d.ts.map +1 -0
  505. package/dist/core/webfetch/doc-store.js +57 -0
  506. package/dist/core/webfetch/doc-store.js.map +1 -0
  507. package/dist/core/webfetch/guardrails.d.ts +75 -0
  508. package/dist/core/webfetch/guardrails.d.ts.map +1 -0
  509. package/dist/core/webfetch/guardrails.js +195 -0
  510. package/dist/core/webfetch/guardrails.js.map +1 -0
  511. package/dist/core/webfetch/robots.d.ts +46 -0
  512. package/dist/core/webfetch/robots.d.ts.map +1 -0
  513. package/dist/core/webfetch/robots.js +153 -0
  514. package/dist/core/webfetch/robots.js.map +1 -0
  515. package/dist/core/webfetch/search-intent.d.ts +59 -0
  516. package/dist/core/webfetch/search-intent.d.ts.map +1 -0
  517. package/dist/core/webfetch/search-intent.js +89 -0
  518. package/dist/core/webfetch/search-intent.js.map +1 -0
  519. package/dist/core/webfetch/search-tags.d.ts +23 -0
  520. package/dist/core/webfetch/search-tags.d.ts.map +1 -0
  521. package/dist/core/webfetch/search-tags.js +118 -0
  522. package/dist/core/webfetch/search-tags.js.map +1 -0
  523. package/dist/env-compat.d.ts +2 -0
  524. package/dist/env-compat.d.ts.map +1 -0
  525. package/dist/env-compat.js +17 -0
  526. package/dist/env-compat.js.map +1 -0
  527. package/dist/extensions/cue/autocomplete.d.ts +126 -0
  528. package/dist/extensions/cue/autocomplete.d.ts.map +1 -0
  529. package/dist/extensions/cue/autocomplete.js +744 -0
  530. package/dist/extensions/cue/autocomplete.js.map +1 -0
  531. package/dist/extensions/cue/index.d.ts +3 -0
  532. package/dist/extensions/cue/index.d.ts.map +1 -0
  533. package/dist/extensions/cue/index.js +341 -0
  534. package/dist/extensions/cue/index.js.map +1 -0
  535. package/dist/extensions/index.d.ts +13 -0
  536. package/dist/extensions/index.d.ts.map +1 -0
  537. package/dist/extensions/index.js +18 -0
  538. package/dist/extensions/index.js.map +1 -0
  539. package/dist/extensions/llama/client.d.ts +67 -0
  540. package/dist/extensions/llama/client.d.ts.map +1 -0
  541. package/dist/extensions/llama/client.js +309 -0
  542. package/dist/extensions/llama/client.js.map +1 -0
  543. package/dist/extensions/llama/huggingface.d.ts +23 -0
  544. package/dist/extensions/llama/huggingface.d.ts.map +1 -0
  545. package/dist/extensions/llama/huggingface.js +141 -0
  546. package/dist/extensions/llama/huggingface.js.map +1 -0
  547. package/dist/extensions/llama/index.d.ts +3 -0
  548. package/dist/extensions/llama/index.d.ts.map +1 -0
  549. package/dist/extensions/llama/index.js +219 -0
  550. package/dist/extensions/llama/index.js.map +1 -0
  551. package/dist/extensions/llama/provider.d.ts +12 -0
  552. package/dist/extensions/llama/provider.d.ts.map +1 -0
  553. package/dist/extensions/llama/provider.js +146 -0
  554. package/dist/extensions/llama/provider.js.map +1 -0
  555. package/dist/extensions/llama/ui.d.ts +42 -0
  556. package/dist/extensions/llama/ui.d.ts.map +1 -0
  557. package/dist/extensions/llama/ui.js +416 -0
  558. package/dist/extensions/llama/ui.js.map +1 -0
  559. package/dist/index.d.ts +36 -0
  560. package/dist/index.d.ts.map +1 -0
  561. package/dist/index.js +48 -0
  562. package/dist/index.js.map +1 -0
  563. package/dist/main.d.ts +17 -0
  564. package/dist/main.d.ts.map +1 -0
  565. package/dist/main.js +820 -0
  566. package/dist/main.js.map +1 -0
  567. package/dist/migrations.d.ts +33 -0
  568. package/dist/migrations.d.ts.map +1 -0
  569. package/dist/migrations.js +288 -0
  570. package/dist/migrations.js.map +1 -0
  571. package/dist/modes/index.d.ts +10 -0
  572. package/dist/modes/index.d.ts.map +1 -0
  573. package/dist/modes/index.js +8 -0
  574. package/dist/modes/index.js.map +1 -0
  575. package/dist/modes/interactive/assets/clankolas.png +0 -0
  576. package/dist/modes/interactive/chat-viewport.d.ts +20 -0
  577. package/dist/modes/interactive/chat-viewport.d.ts.map +1 -0
  578. package/dist/modes/interactive/chat-viewport.js +28 -0
  579. package/dist/modes/interactive/chat-viewport.js.map +1 -0
  580. package/dist/modes/interactive/components/armin.d.ts +34 -0
  581. package/dist/modes/interactive/components/armin.d.ts.map +1 -0
  582. package/dist/modes/interactive/components/armin.js +333 -0
  583. package/dist/modes/interactive/components/armin.js.map +1 -0
  584. package/dist/modes/interactive/components/assistant-message.d.ts +26 -0
  585. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
  586. package/dist/modes/interactive/components/assistant-message.js +171 -0
  587. package/dist/modes/interactive/components/assistant-message.js.map +1 -0
  588. package/dist/modes/interactive/components/bash-execution.d.ts +34 -0
  589. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
  590. package/dist/modes/interactive/components/bash-execution.js +175 -0
  591. package/dist/modes/interactive/components/bash-execution.js.map +1 -0
  592. package/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
  593. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
  594. package/dist/modes/interactive/components/bordered-loader.js +54 -0
  595. package/dist/modes/interactive/components/bordered-loader.js.map +1 -0
  596. package/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
  597. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
  598. package/dist/modes/interactive/components/branch-summary-message.js +44 -0
  599. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
  600. package/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
  601. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
  602. package/dist/modes/interactive/components/compaction-summary-message.js +45 -0
  603. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
  604. package/dist/modes/interactive/components/config-selector.d.ts +102 -0
  605. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
  606. package/dist/modes/interactive/components/config-selector.js +770 -0
  607. package/dist/modes/interactive/components/config-selector.js.map +1 -0
  608. package/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
  609. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
  610. package/dist/modes/interactive/components/countdown-timer.js +33 -0
  611. package/dist/modes/interactive/components/countdown-timer.js.map +1 -0
  612. package/dist/modes/interactive/components/custom-editor.d.ts +30 -0
  613. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
  614. package/dist/modes/interactive/components/custom-editor.js +115 -0
  615. package/dist/modes/interactive/components/custom-editor.js.map +1 -0
  616. package/dist/modes/interactive/components/custom-entry.d.ts +19 -0
  617. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -0
  618. package/dist/modes/interactive/components/custom-entry.js +52 -0
  619. package/dist/modes/interactive/components/custom-entry.js.map +1 -0
  620. package/dist/modes/interactive/components/custom-message.d.ts +22 -0
  621. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
  622. package/dist/modes/interactive/components/custom-message.js +87 -0
  623. package/dist/modes/interactive/components/custom-message.js.map +1 -0
  624. package/dist/modes/interactive/components/daxnuts.d.ts +23 -0
  625. package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -0
  626. package/dist/modes/interactive/components/daxnuts.js +140 -0
  627. package/dist/modes/interactive/components/daxnuts.js.map +1 -0
  628. package/dist/modes/interactive/components/diff.d.ts +12 -0
  629. package/dist/modes/interactive/components/diff.d.ts.map +1 -0
  630. package/dist/modes/interactive/components/diff.js +133 -0
  631. package/dist/modes/interactive/components/diff.js.map +1 -0
  632. package/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
  633. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
  634. package/dist/modes/interactive/components/dynamic-border.js +21 -0
  635. package/dist/modes/interactive/components/dynamic-border.js.map +1 -0
  636. package/dist/modes/interactive/components/earendil-announcement.d.ts +5 -0
  637. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -0
  638. package/dist/modes/interactive/components/earendil-announcement.js +40 -0
  639. package/dist/modes/interactive/components/earendil-announcement.js.map +1 -0
  640. package/dist/modes/interactive/components/extension-editor.d.ts +21 -0
  641. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
  642. package/dist/modes/interactive/components/extension-editor.js +98 -0
  643. package/dist/modes/interactive/components/extension-editor.js.map +1 -0
  644. package/dist/modes/interactive/components/extension-input.d.ts +23 -0
  645. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
  646. package/dist/modes/interactive/components/extension-input.js +61 -0
  647. package/dist/modes/interactive/components/extension-input.js.map +1 -0
  648. package/dist/modes/interactive/components/extension-selector.d.ts +26 -0
  649. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
  650. package/dist/modes/interactive/components/extension-selector.js +83 -0
  651. package/dist/modes/interactive/components/extension-selector.js.map +1 -0
  652. package/dist/modes/interactive/components/first-time-setup.d.ts +25 -0
  653. package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -0
  654. package/dist/modes/interactive/components/first-time-setup.js +103 -0
  655. package/dist/modes/interactive/components/first-time-setup.js.map +1 -0
  656. package/dist/modes/interactive/components/footer.d.ts +32 -0
  657. package/dist/modes/interactive/components/footer.d.ts.map +1 -0
  658. package/dist/modes/interactive/components/footer.js +230 -0
  659. package/dist/modes/interactive/components/footer.js.map +1 -0
  660. package/dist/modes/interactive/components/index.d.ts +34 -0
  661. package/dist/modes/interactive/components/index.d.ts.map +1 -0
  662. package/dist/modes/interactive/components/index.js +35 -0
  663. package/dist/modes/interactive/components/index.js.map +1 -0
  664. package/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
  665. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
  666. package/dist/modes/interactive/components/keybinding-hints.js +36 -0
  667. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
  668. package/dist/modes/interactive/components/login-dialog.d.ts +52 -0
  669. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
  670. package/dist/modes/interactive/components/login-dialog.js +188 -0
  671. package/dist/modes/interactive/components/login-dialog.js.map +1 -0
  672. package/dist/modes/interactive/components/markdown-transform.d.ts +3 -0
  673. package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -0
  674. package/dist/modes/interactive/components/markdown-transform.js +19 -0
  675. package/dist/modes/interactive/components/markdown-transform.js.map +1 -0
  676. package/dist/modes/interactive/components/mermaid.d.ts +11 -0
  677. package/dist/modes/interactive/components/mermaid.d.ts.map +1 -0
  678. package/dist/modes/interactive/components/mermaid.js +75 -0
  679. package/dist/modes/interactive/components/mermaid.js.map +1 -0
  680. package/dist/modes/interactive/components/model-selector.d.ts +60 -0
  681. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
  682. package/dist/modes/interactive/components/model-selector.js +361 -0
  683. package/dist/modes/interactive/components/model-selector.js.map +1 -0
  684. package/dist/modes/interactive/components/oauth-selector.d.ts +33 -0
  685. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
  686. package/dist/modes/interactive/components/oauth-selector.js +163 -0
  687. package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
  688. package/dist/modes/interactive/components/scoped-models-selector.d.ts +46 -0
  689. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
  690. package/dist/modes/interactive/components/scoped-models-selector.js +326 -0
  691. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
  692. package/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
  693. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
  694. package/dist/modes/interactive/components/session-selector-search.js +155 -0
  695. package/dist/modes/interactive/components/session-selector-search.js.map +1 -0
  696. package/dist/modes/interactive/components/session-selector.d.ts +98 -0
  697. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
  698. package/dist/modes/interactive/components/session-selector.js +891 -0
  699. package/dist/modes/interactive/components/session-selector.js.map +1 -0
  700. package/dist/modes/interactive/components/settings-selector.d.ts +98 -0
  701. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
  702. package/dist/modes/interactive/components/settings-selector.js +745 -0
  703. package/dist/modes/interactive/components/settings-selector.js.map +1 -0
  704. package/dist/modes/interactive/components/settings-submenu.d.ts +72 -0
  705. package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -0
  706. package/dist/modes/interactive/components/settings-submenu.js +165 -0
  707. package/dist/modes/interactive/components/settings-submenu.js.map +1 -0
  708. package/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
  709. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
  710. package/dist/modes/interactive/components/show-images-selector.js +39 -0
  711. package/dist/modes/interactive/components/show-images-selector.js.map +1 -0
  712. package/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
  713. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
  714. package/dist/modes/interactive/components/skill-invocation-message.js +47 -0
  715. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
  716. package/dist/modes/interactive/components/status-indicator.d.ts +30 -0
  717. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -0
  718. package/dist/modes/interactive/components/status-indicator.js +67 -0
  719. package/dist/modes/interactive/components/status-indicator.js.map +1 -0
  720. package/dist/modes/interactive/components/theme-selector.d.ts +11 -0
  721. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
  722. package/dist/modes/interactive/components/theme-selector.js +50 -0
  723. package/dist/modes/interactive/components/theme-selector.js.map +1 -0
  724. package/dist/modes/interactive/components/thinking-selector.d.ts +23 -0
  725. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
  726. package/dist/modes/interactive/components/thinking-selector.js +109 -0
  727. package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
  728. package/dist/modes/interactive/components/tool-execution.d.ts +80 -0
  729. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
  730. package/dist/modes/interactive/components/tool-execution.js +328 -0
  731. package/dist/modes/interactive/components/tool-execution.js.map +1 -0
  732. package/dist/modes/interactive/components/tree-selector.d.ts +94 -0
  733. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
  734. package/dist/modes/interactive/components/tree-selector.js +1245 -0
  735. package/dist/modes/interactive/components/tree-selector.js.map +1 -0
  736. package/dist/modes/interactive/components/trust-selector.d.ts +23 -0
  737. package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -0
  738. package/dist/modes/interactive/components/trust-selector.js +91 -0
  739. package/dist/modes/interactive/components/trust-selector.js.map +1 -0
  740. package/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
  741. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
  742. package/dist/modes/interactive/components/user-message-selector.js +114 -0
  743. package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
  744. package/dist/modes/interactive/components/user-message.d.ts +16 -0
  745. package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
  746. package/dist/modes/interactive/components/user-message.js +49 -0
  747. package/dist/modes/interactive/components/user-message.js.map +1 -0
  748. package/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
  749. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
  750. package/dist/modes/interactive/components/visual-truncate.js +33 -0
  751. package/dist/modes/interactive/components/visual-truncate.js.map +1 -0
  752. package/dist/modes/interactive/external-editor.d.ts +12 -0
  753. package/dist/modes/interactive/external-editor.d.ts.map +1 -0
  754. package/dist/modes/interactive/external-editor.js +38 -0
  755. package/dist/modes/interactive/external-editor.js.map +1 -0
  756. package/dist/modes/interactive/interactive-mode.d.ts +471 -0
  757. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
  758. package/dist/modes/interactive/interactive-mode.js +5735 -0
  759. package/dist/modes/interactive/interactive-mode.js.map +1 -0
  760. package/dist/modes/interactive/model-catalog-refresh.d.ts +7 -0
  761. package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -0
  762. package/dist/modes/interactive/model-catalog-refresh.js +34 -0
  763. package/dist/modes/interactive/model-catalog-refresh.js.map +1 -0
  764. package/dist/modes/interactive/model-search.d.ts +12 -0
  765. package/dist/modes/interactive/model-search.d.ts.map +1 -0
  766. package/dist/modes/interactive/model-search.js +15 -0
  767. package/dist/modes/interactive/model-search.js.map +1 -0
  768. package/dist/modes/interactive/session-share.d.ts +16 -0
  769. package/dist/modes/interactive/session-share.d.ts.map +1 -0
  770. package/dist/modes/interactive/session-share.js +184 -0
  771. package/dist/modes/interactive/session-share.js.map +1 -0
  772. package/dist/modes/interactive/theme/dark.json +91 -0
  773. package/dist/modes/interactive/theme/light.json +90 -0
  774. package/dist/modes/interactive/theme/theme-controller.d.ts +41 -0
  775. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
  776. package/dist/modes/interactive/theme/theme-controller.js +130 -0
  777. package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
  778. package/dist/modes/interactive/theme/theme-json.d.ts +84 -0
  779. package/dist/modes/interactive/theme/theme-json.d.ts.map +1 -0
  780. package/dist/modes/interactive/theme/theme-json.js +130 -0
  781. package/dist/modes/interactive/theme/theme-json.js.map +1 -0
  782. package/dist/modes/interactive/theme/theme-schema.json +356 -0
  783. package/dist/modes/interactive/theme/theme.d.ts +131 -0
  784. package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
  785. package/dist/modes/interactive/theme/theme.js +991 -0
  786. package/dist/modes/interactive/theme/theme.js.map +1 -0
  787. package/dist/modes/interactive/tui-renderer.d.ts +21 -0
  788. package/dist/modes/interactive/tui-renderer.d.ts.map +1 -0
  789. package/dist/modes/interactive/tui-renderer.js +66 -0
  790. package/dist/modes/interactive/tui-renderer.js.map +1 -0
  791. package/dist/modes/json-event.d.ts +34 -0
  792. package/dist/modes/json-event.d.ts.map +1 -0
  793. package/dist/modes/json-event.js +29 -0
  794. package/dist/modes/json-event.js.map +1 -0
  795. package/dist/modes/print-mode.d.ts +28 -0
  796. package/dist/modes/print-mode.d.ts.map +1 -0
  797. package/dist/modes/print-mode.js +142 -0
  798. package/dist/modes/print-mode.js.map +1 -0
  799. package/dist/modes/rpc/jsonl.d.ts +17 -0
  800. package/dist/modes/rpc/jsonl.d.ts.map +1 -0
  801. package/dist/modes/rpc/jsonl.js +49 -0
  802. package/dist/modes/rpc/jsonl.js.map +1 -0
  803. package/dist/modes/rpc/rpc-client.d.ts +254 -0
  804. package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
  805. package/dist/modes/rpc/rpc-client.js +495 -0
  806. package/dist/modes/rpc/rpc-client.js.map +1 -0
  807. package/dist/modes/rpc/rpc-mode.d.ts +20 -0
  808. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
  809. package/dist/modes/rpc/rpc-mode.js +657 -0
  810. package/dist/modes/rpc/rpc-mode.js.map +1 -0
  811. package/dist/modes/rpc/rpc-types.d.ts +469 -0
  812. package/dist/modes/rpc/rpc-types.d.ts.map +1 -0
  813. package/dist/modes/rpc/rpc-types.js +8 -0
  814. package/dist/modes/rpc/rpc-types.js.map +1 -0
  815. package/dist/package-manager-cli.d.ts +9 -0
  816. package/dist/package-manager-cli.d.ts.map +1 -0
  817. package/dist/package-manager-cli.js +961 -0
  818. package/dist/package-manager-cli.js.map +1 -0
  819. package/dist/rpc-entry.d.ts +3 -0
  820. package/dist/rpc-entry.d.ts.map +1 -0
  821. package/dist/rpc-entry.js +12 -0
  822. package/dist/rpc-entry.js.map +1 -0
  823. package/dist/utils/abort.d.ts +5 -0
  824. package/dist/utils/abort.d.ts.map +1 -0
  825. package/dist/utils/abort.js +48 -0
  826. package/dist/utils/abort.js.map +1 -0
  827. package/dist/utils/ansi.d.ts +2 -0
  828. package/dist/utils/ansi.d.ts.map +1 -0
  829. package/dist/utils/ansi.js +52 -0
  830. package/dist/utils/ansi.js.map +1 -0
  831. package/dist/utils/changelog.d.ts +22 -0
  832. package/dist/utils/changelog.d.ts.map +1 -0
  833. package/dist/utils/changelog.js +165 -0
  834. package/dist/utils/changelog.js.map +1 -0
  835. package/dist/utils/child-process.d.ts +18 -0
  836. package/dist/utils/child-process.d.ts.map +1 -0
  837. package/dist/utils/child-process.js +106 -0
  838. package/dist/utils/child-process.js.map +1 -0
  839. package/dist/utils/clipboard-command.d.ts +7 -0
  840. package/dist/utils/clipboard-command.d.ts.map +1 -0
  841. package/dist/utils/clipboard-command.js +45 -0
  842. package/dist/utils/clipboard-command.js.map +1 -0
  843. package/dist/utils/clipboard-image.d.ts +11 -0
  844. package/dist/utils/clipboard-image.d.ts.map +1 -0
  845. package/dist/utils/clipboard-image.js +228 -0
  846. package/dist/utils/clipboard-image.js.map +1 -0
  847. package/dist/utils/clipboard.d.ts +4 -0
  848. package/dist/utils/clipboard.d.ts.map +1 -0
  849. package/dist/utils/clipboard.js +84 -0
  850. package/dist/utils/clipboard.js.map +1 -0
  851. package/dist/utils/deprecation.d.ts +4 -0
  852. package/dist/utils/deprecation.d.ts.map +1 -0
  853. package/dist/utils/deprecation.js +13 -0
  854. package/dist/utils/deprecation.js.map +1 -0
  855. package/dist/utils/exif-orientation.d.ts +5 -0
  856. package/dist/utils/exif-orientation.d.ts.map +1 -0
  857. package/dist/utils/exif-orientation.js +157 -0
  858. package/dist/utils/exif-orientation.js.map +1 -0
  859. package/dist/utils/frontmatter.d.ts +8 -0
  860. package/dist/utils/frontmatter.d.ts.map +1 -0
  861. package/dist/utils/frontmatter.js +27 -0
  862. package/dist/utils/frontmatter.js.map +1 -0
  863. package/dist/utils/fs-watch.d.ts +5 -0
  864. package/dist/utils/fs-watch.d.ts.map +1 -0
  865. package/dist/utils/fs-watch.js +25 -0
  866. package/dist/utils/fs-watch.js.map +1 -0
  867. package/dist/utils/git.d.ts +26 -0
  868. package/dist/utils/git.d.ts.map +1 -0
  869. package/dist/utils/git.js +195 -0
  870. package/dist/utils/git.js.map +1 -0
  871. package/dist/utils/html.d.ts +7 -0
  872. package/dist/utils/html.d.ts.map +1 -0
  873. package/dist/utils/html.js +40 -0
  874. package/dist/utils/html.js.map +1 -0
  875. package/dist/utils/image-convert.d.ts +10 -0
  876. package/dist/utils/image-convert.d.ts.map +1 -0
  877. package/dist/utils/image-convert.js +45 -0
  878. package/dist/utils/image-convert.js.map +1 -0
  879. package/dist/utils/image-process.d.ts +18 -0
  880. package/dist/utils/image-process.d.ts.map +1 -0
  881. package/dist/utils/image-process.js +83 -0
  882. package/dist/utils/image-process.js.map +1 -0
  883. package/dist/utils/image-resize-core.d.ts +30 -0
  884. package/dist/utils/image-resize-core.d.ts.map +1 -0
  885. package/dist/utils/image-resize-core.js +124 -0
  886. package/dist/utils/image-resize-core.js.map +1 -0
  887. package/dist/utils/image-resize-worker.d.ts +2 -0
  888. package/dist/utils/image-resize-worker.d.ts.map +1 -0
  889. package/dist/utils/image-resize-worker.js +31 -0
  890. package/dist/utils/image-resize-worker.js.map +1 -0
  891. package/dist/utils/image-resize.d.ts +16 -0
  892. package/dist/utils/image-resize.d.ts.map +1 -0
  893. package/dist/utils/image-resize.js +97 -0
  894. package/dist/utils/image-resize.js.map +1 -0
  895. package/dist/utils/ion-user-agent.d.ts +2 -0
  896. package/dist/utils/ion-user-agent.d.ts.map +1 -0
  897. package/dist/utils/ion-user-agent.js +5 -0
  898. package/dist/utils/ion-user-agent.js.map +1 -0
  899. package/dist/utils/json.d.ts +3 -0
  900. package/dist/utils/json.d.ts.map +1 -0
  901. package/dist/utils/json.js +7 -0
  902. package/dist/utils/json.js.map +1 -0
  903. package/dist/utils/management-http.d.ts +25 -0
  904. package/dist/utils/management-http.d.ts.map +1 -0
  905. package/dist/utils/management-http.js +54 -0
  906. package/dist/utils/management-http.js.map +1 -0
  907. package/dist/utils/mime.d.ts +3 -0
  908. package/dist/utils/mime.d.ts.map +1 -0
  909. package/dist/utils/mime.js +110 -0
  910. package/dist/utils/mime.js.map +1 -0
  911. package/dist/utils/open-browser.d.ts +9 -0
  912. package/dist/utils/open-browser.d.ts.map +1 -0
  913. package/dist/utils/open-browser.js +22 -0
  914. package/dist/utils/open-browser.js.map +1 -0
  915. package/dist/utils/paths.d.ts +34 -0
  916. package/dist/utils/paths.d.ts.map +1 -0
  917. package/dist/utils/paths.js +114 -0
  918. package/dist/utils/paths.js.map +1 -0
  919. package/dist/utils/photon.d.ts +21 -0
  920. package/dist/utils/photon.d.ts.map +1 -0
  921. package/dist/utils/photon.js +121 -0
  922. package/dist/utils/photon.js.map +1 -0
  923. package/dist/utils/shell.d.ts +34 -0
  924. package/dist/utils/shell.d.ts.map +1 -0
  925. package/dist/utils/shell.js +216 -0
  926. package/dist/utils/shell.js.map +1 -0
  927. package/dist/utils/sleep.d.ts +5 -0
  928. package/dist/utils/sleep.d.ts.map +1 -0
  929. package/dist/utils/sleep.js +17 -0
  930. package/dist/utils/sleep.js.map +1 -0
  931. package/dist/utils/syntax-highlight.d.ts +13 -0
  932. package/dist/utils/syntax-highlight.d.ts.map +1 -0
  933. package/dist/utils/syntax-highlight.js +177 -0
  934. package/dist/utils/syntax-highlight.js.map +1 -0
  935. package/dist/utils/text.d.ts +8 -0
  936. package/dist/utils/text.d.ts.map +1 -0
  937. package/dist/utils/text.js +9 -0
  938. package/dist/utils/text.js.map +1 -0
  939. package/dist/utils/tool-result-images.d.ts +19 -0
  940. package/dist/utils/tool-result-images.d.ts.map +1 -0
  941. package/dist/utils/tool-result-images.js +45 -0
  942. package/dist/utils/tool-result-images.js.map +1 -0
  943. package/dist/utils/tools-manager.d.ts +19 -0
  944. package/dist/utils/tools-manager.d.ts.map +1 -0
  945. package/dist/utils/tools-manager.js +382 -0
  946. package/dist/utils/tools-manager.js.map +1 -0
  947. package/dist/utils/version-check.d.ts +19 -0
  948. package/dist/utils/version-check.d.ts.map +1 -0
  949. package/dist/utils/version-check.js +79 -0
  950. package/dist/utils/version-check.js.map +1 -0
  951. package/dist/utils/windows-self-update.d.ts +3 -0
  952. package/dist/utils/windows-self-update.d.ts.map +1 -0
  953. package/dist/utils/windows-self-update.js +77 -0
  954. package/dist/utils/windows-self-update.js.map +1 -0
  955. package/docs/browser-extension.md +108 -0
  956. package/docs/compaction.md +444 -0
  957. package/docs/containerization.md +156 -0
  958. package/docs/custom-provider.md +777 -0
  959. package/docs/development.md +90 -0
  960. package/docs/docs.json +164 -0
  961. package/docs/environment-variables.md +101 -0
  962. package/docs/extensions.md +3033 -0
  963. package/docs/images/doom-extension.png +0 -0
  964. package/docs/images/exy.png +0 -0
  965. package/docs/images/interactive-mode.png +0 -0
  966. package/docs/images/tree-view.png +0 -0
  967. package/docs/index.md +85 -0
  968. package/docs/json.md +98 -0
  969. package/docs/keybindings.md +239 -0
  970. package/docs/llama-cpp.md +101 -0
  971. package/docs/models.md +574 -0
  972. package/docs/packages.md +228 -0
  973. package/docs/prompt-templates.md +96 -0
  974. package/docs/providers.md +321 -0
  975. package/docs/quickstart.md +168 -0
  976. package/docs/rpc.md +1618 -0
  977. package/docs/sdk.md +1226 -0
  978. package/docs/security.md +59 -0
  979. package/docs/session-format.md +450 -0
  980. package/docs/sessions.md +145 -0
  981. package/docs/settings.md +408 -0
  982. package/docs/shell-aliases.md +13 -0
  983. package/docs/skills.md +241 -0
  984. package/docs/terminal-setup.md +192 -0
  985. package/docs/termux.md +126 -0
  986. package/docs/themes.md +322 -0
  987. package/docs/tmux.md +63 -0
  988. package/docs/tui.md +961 -0
  989. package/docs/usage.md +327 -0
  990. package/docs/webfetch.md +119 -0
  991. package/docs/windows.md +39 -0
  992. package/examples/README.md +28 -0
  993. package/examples/extensions/README.md +213 -0
  994. package/examples/extensions/auto-commit-on-exit.ts +49 -0
  995. package/examples/extensions/bash-spawn-hook.ts +30 -0
  996. package/examples/extensions/bookmark.ts +50 -0
  997. package/examples/extensions/border-status-editor.ts +150 -0
  998. package/examples/extensions/built-in-tool-renderer.ts +249 -0
  999. package/examples/extensions/claude-rules.ts +86 -0
  1000. package/examples/extensions/commands.ts +72 -0
  1001. package/examples/extensions/confirm-destructive.ts +59 -0
  1002. package/examples/extensions/custom-compaction.ts +117 -0
  1003. package/examples/extensions/custom-footer.ts +64 -0
  1004. package/examples/extensions/custom-header.ts +73 -0
  1005. package/examples/extensions/custom-provider-anthropic/index.ts +611 -0
  1006. package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
  1007. package/examples/extensions/custom-provider-anthropic/package.json +19 -0
  1008. package/examples/extensions/custom-provider-gitlab-duo/index.ts +405 -0
  1009. package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
  1010. package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
  1011. package/examples/extensions/dirty-repo-guard.ts +56 -0
  1012. package/examples/extensions/doom-overlay/README.md +46 -0
  1013. package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
  1014. package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  1015. package/examples/extensions/doom-overlay/doom/build.sh +152 -0
  1016. package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
  1017. package/examples/extensions/doom-overlay/doom-component.ts +132 -0
  1018. package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
  1019. package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
  1020. package/examples/extensions/doom-overlay/index.ts +74 -0
  1021. package/examples/extensions/doom-overlay/wad-finder.ts +55 -0
  1022. package/examples/extensions/dynamic-resources/SKILL.md +8 -0
  1023. package/examples/extensions/dynamic-resources/dynamic.json +81 -0
  1024. package/examples/extensions/dynamic-resources/dynamic.md +5 -0
  1025. package/examples/extensions/dynamic-resources/index.ts +15 -0
  1026. package/examples/extensions/dynamic-tools.ts +74 -0
  1027. package/examples/extensions/entry-renderer.ts +41 -0
  1028. package/examples/extensions/event-bus.ts +43 -0
  1029. package/examples/extensions/file-trigger.ts +41 -0
  1030. package/examples/extensions/git-checkpoint.ts +53 -0
  1031. package/examples/extensions/git-merge-and-resolve.ts +115 -0
  1032. package/examples/extensions/github-issue-autocomplete.ts +185 -0
  1033. package/examples/extensions/gondolin/index.ts +531 -0
  1034. package/examples/extensions/gondolin/package-lock.json +185 -0
  1035. package/examples/extensions/gondolin/package.json +19 -0
  1036. package/examples/extensions/handoff.ts +190 -0
  1037. package/examples/extensions/hello.ts +26 -0
  1038. package/examples/extensions/hidden-thinking-label.ts +53 -0
  1039. package/examples/extensions/inline-bash.ts +94 -0
  1040. package/examples/extensions/input-transform-streaming.ts +39 -0
  1041. package/examples/extensions/input-transform.ts +43 -0
  1042. package/examples/extensions/interactive-shell.ts +196 -0
  1043. package/examples/extensions/kimi-deferred-tools.ts +61 -0
  1044. package/examples/extensions/mac-system-theme.ts +47 -0
  1045. package/examples/extensions/message-renderer.ts +59 -0
  1046. package/examples/extensions/minimal-mode.ts +426 -0
  1047. package/examples/extensions/modal-editor.ts +85 -0
  1048. package/examples/extensions/model-status.ts +31 -0
  1049. package/examples/extensions/notify.ts +57 -0
  1050. package/examples/extensions/overlay-qa-tests.ts +1450 -0
  1051. package/examples/extensions/overlay-test.ts +153 -0
  1052. package/examples/extensions/permission-gate.ts +34 -0
  1053. package/examples/extensions/pirate.ts +47 -0
  1054. package/examples/extensions/plan-mode/README.md +66 -0
  1055. package/examples/extensions/plan-mode/index.ts +390 -0
  1056. package/examples/extensions/plan-mode/utils.ts +168 -0
  1057. package/examples/extensions/preset.ts +436 -0
  1058. package/examples/extensions/project-trust.ts +64 -0
  1059. package/examples/extensions/prompt-customizer.ts +97 -0
  1060. package/examples/extensions/protected-paths.ts +30 -0
  1061. package/examples/extensions/provider-payload.ts +18 -0
  1062. package/examples/extensions/qna.ts +118 -0
  1063. package/examples/extensions/question.ts +278 -0
  1064. package/examples/extensions/questionnaire.ts +440 -0
  1065. package/examples/extensions/rainbow-editor.ts +88 -0
  1066. package/examples/extensions/reload-runtime.ts +37 -0
  1067. package/examples/extensions/rpc-demo.ts +118 -0
  1068. package/examples/extensions/sandbox/index.ts +321 -0
  1069. package/examples/extensions/sandbox/package-lock.json +92 -0
  1070. package/examples/extensions/sandbox/package.json +19 -0
  1071. package/examples/extensions/send-user-message.ts +97 -0
  1072. package/examples/extensions/session-name.ts +27 -0
  1073. package/examples/extensions/shutdown-command.ts +63 -0
  1074. package/examples/extensions/snake.ts +343 -0
  1075. package/examples/extensions/space-invaders.ts +560 -0
  1076. package/examples/extensions/ssh.ts +220 -0
  1077. package/examples/extensions/status-line.ts +32 -0
  1078. package/examples/extensions/structured-output.ts +65 -0
  1079. package/examples/extensions/subagent/README.md +177 -0
  1080. package/examples/extensions/subagent/agents/planner.md +37 -0
  1081. package/examples/extensions/subagent/agents/reviewer.md +35 -0
  1082. package/examples/extensions/subagent/agents/scout.md +50 -0
  1083. package/examples/extensions/subagent/agents/worker.md +24 -0
  1084. package/examples/extensions/subagent/agents.ts +157 -0
  1085. package/examples/extensions/subagent/index.ts +1038 -0
  1086. package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
  1087. package/examples/extensions/subagent/prompts/implement.md +10 -0
  1088. package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
  1089. package/examples/extensions/summarize.ts +199 -0
  1090. package/examples/extensions/system-prompt-header.ts +17 -0
  1091. package/examples/extensions/tic-tac-toe.ts +1008 -0
  1092. package/examples/extensions/timed-confirm.ts +70 -0
  1093. package/examples/extensions/titlebar-spinner.ts +58 -0
  1094. package/examples/extensions/todo.ts +297 -0
  1095. package/examples/extensions/tool-override.ts +144 -0
  1096. package/examples/extensions/tools.ts +146 -0
  1097. package/examples/extensions/trigger-compact.ts +50 -0
  1098. package/examples/extensions/truncated-tool.ts +195 -0
  1099. package/examples/extensions/widget-placement.ts +9 -0
  1100. package/examples/extensions/with-deps/index.ts +32 -0
  1101. package/examples/extensions/with-deps/package-lock.json +31 -0
  1102. package/examples/extensions/with-deps/package.json +22 -0
  1103. package/examples/extensions/working-indicator.ts +123 -0
  1104. package/examples/extensions/working-message-test.ts +25 -0
  1105. package/examples/plugins/ion-example-plugin/README.md +38 -0
  1106. package/examples/plugins/ion-example-plugin/package.json +10 -0
  1107. package/examples/plugins/ion-example-plugin/src/contract.ts +13 -0
  1108. package/examples/plugins/ion-example-plugin/src/session.ts +23 -0
  1109. package/examples/plugins/ion-example-plugin/src/tui.ts +31 -0
  1110. package/examples/rpc-extension-ui.ts +641 -0
  1111. package/examples/sdk/01-minimal.ts +26 -0
  1112. package/examples/sdk/02-custom-model.ts +49 -0
  1113. package/examples/sdk/03-custom-prompt.ts +70 -0
  1114. package/examples/sdk/04-skills.ts +55 -0
  1115. package/examples/sdk/05-tools.ts +48 -0
  1116. package/examples/sdk/06-extensions.ts +94 -0
  1117. package/examples/sdk/07-context-files.ts +42 -0
  1118. package/examples/sdk/08-prompt-templates.ts +51 -0
  1119. package/examples/sdk/09-api-keys-and-oauth.ts +34 -0
  1120. package/examples/sdk/10-settings.ts +53 -0
  1121. package/examples/sdk/11-sessions.ts +52 -0
  1122. package/examples/sdk/12-full-control.ts +74 -0
  1123. package/examples/sdk/13-session-runtime.ts +67 -0
  1124. package/examples/sdk/README.md +140 -0
  1125. package/npm-shrinkwrap.json +1912 -0
  1126. package/package.json +108 -0
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Built-in tool renderers, without the tools themselves.
3
+ *
4
+ * A presentation displays tool calls and results; it does not execute them and does not need their
5
+ * typebox parameter schemas. Importing this instead of `core/tools/index.ts` keeps ~17 MB of module
6
+ * graph out of a process that only renders.
7
+ */
8
+ import type { ToolDefinition } from "../../extensions/types.ts";
9
+ import type { ToolName } from "../index.ts";
10
+ import { createShellRenderers } from "./bash.ts";
11
+ import { editRenderers } from "./edit.ts";
12
+ import { findRenderers } from "./find.ts";
13
+ import { grepRenderers } from "./grep.ts";
14
+ import { lsRenderers } from "./ls.ts";
15
+ import { readRenderers } from "./read.ts";
16
+ import { webextractRenderers, webfetchRenderers } from "./webfetch.ts";
17
+ import { writeRenderers } from "./write.ts";
18
+ export type ToolRenderers = Pick<ToolDefinition<any, any>, "renderCall" | "renderResult">;
19
+ export { createShellRenderers, editRenderers, findRenderers, grepRenderers, lsRenderers, readRenderers, webextractRenderers, webfetchRenderers, writeRenderers, };
20
+ /** Renderers for every built-in tool, keyed by tool name. */
21
+ export declare function createAllToolRenderers(): Record<ToolName, ToolRenderers>;
22
+ /**
23
+ * Merge built-in renderers into a tool definition that does not supply its own.
24
+ *
25
+ * `ToolExecutionComponent` used to do this lookup itself, which forced every presentation to import
26
+ * the tool implementations. Callers do it now, so a process that renders can import renderers alone.
27
+ */
28
+ export declare function withBuiltInRenderers<TDefinition extends ToolRenderers>(toolName: string, definition: TDefinition | undefined): TDefinition | ToolRenderers | undefined;
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/renderers/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,YAAY,GAAG,cAAc,CAAC,CAAC;AAE1F,OAAO,EACN,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,aAAa,EACb,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,GACd,CAAC;AAEF,6DAA6D;AAC7D,wBAAgB,sBAAsB,IAAI,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC,CAaxE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,SAAS,aAAa,EACrE,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,WAAW,GAAG,SAAS,GACjC,WAAW,GAAG,aAAa,GAAG,SAAS,CASzC","sourcesContent":["/**\n * Built-in tool renderers, without the tools themselves.\n *\n * A presentation displays tool calls and results; it does not execute them and does not need their\n * typebox parameter schemas. Importing this instead of `core/tools/index.ts` keeps ~17 MB of module\n * graph out of a process that only renders.\n */\n\nimport type { ToolDefinition } from \"../../extensions/types.ts\";\nimport type { ToolName } from \"../index.ts\";\nimport { createShellRenderers } from \"./bash.ts\";\nimport { editRenderers } from \"./edit.ts\";\nimport { findRenderers } from \"./find.ts\";\nimport { grepRenderers } from \"./grep.ts\";\nimport { lsRenderers } from \"./ls.ts\";\nimport { readRenderers } from \"./read.ts\";\nimport { webextractRenderers, webfetchRenderers } from \"./webfetch.ts\";\nimport { writeRenderers } from \"./write.ts\";\n\nexport type ToolRenderers = Pick<ToolDefinition<any, any>, \"renderCall\" | \"renderResult\">;\n\nexport {\n\tcreateShellRenderers,\n\teditRenderers,\n\tfindRenderers,\n\tgrepRenderers,\n\tlsRenderers,\n\treadRenderers,\n\twebextractRenderers,\n\twebfetchRenderers,\n\twriteRenderers,\n};\n\n/** Renderers for every built-in tool, keyed by tool name. */\nexport function createAllToolRenderers(): Record<ToolName, ToolRenderers> {\n\treturn {\n\t\tread: readRenderers,\n\t\tbash: createShellRenderers(\"$\"),\n\t\tpowershell: createShellRenderers(\"PS>\"),\n\t\tedit: editRenderers,\n\t\twrite: writeRenderers,\n\t\tgrep: grepRenderers,\n\t\tfind: findRenderers,\n\t\tls: lsRenderers,\n\t\twebfetch: webfetchRenderers,\n\t\twebextract: webextractRenderers,\n\t};\n}\n\n/**\n * Merge built-in renderers into a tool definition that does not supply its own.\n *\n * `ToolExecutionComponent` used to do this lookup itself, which forced every presentation to import\n * the tool implementations. Callers do it now, so a process that renders can import renderers alone.\n */\nexport function withBuiltInRenderers<TDefinition extends ToolRenderers>(\n\ttoolName: string,\n\tdefinition: TDefinition | undefined,\n): TDefinition | ToolRenderers | undefined {\n\tconst builtIn = createAllToolRenderers()[toolName as ToolName];\n\tif (!definition) return builtIn;\n\tif (!builtIn) return definition;\n\treturn {\n\t\t...definition,\n\t\trenderCall: definition.renderCall ?? builtIn.renderCall,\n\t\trenderResult: definition.renderResult ?? builtIn.renderResult,\n\t};\n}\n"]}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Built-in tool renderers, without the tools themselves.
3
+ *
4
+ * A presentation displays tool calls and results; it does not execute them and does not need their
5
+ * typebox parameter schemas. Importing this instead of `core/tools/index.ts` keeps ~17 MB of module
6
+ * graph out of a process that only renders.
7
+ */
8
+ import { createShellRenderers } from "./bash.js";
9
+ import { editRenderers } from "./edit.js";
10
+ import { findRenderers } from "./find.js";
11
+ import { grepRenderers } from "./grep.js";
12
+ import { lsRenderers } from "./ls.js";
13
+ import { readRenderers } from "./read.js";
14
+ import { webextractRenderers, webfetchRenderers } from "./webfetch.js";
15
+ import { writeRenderers } from "./write.js";
16
+ export { createShellRenderers, editRenderers, findRenderers, grepRenderers, lsRenderers, readRenderers, webextractRenderers, webfetchRenderers, writeRenderers, };
17
+ /** Renderers for every built-in tool, keyed by tool name. */
18
+ export function createAllToolRenderers() {
19
+ return {
20
+ read: readRenderers,
21
+ bash: createShellRenderers("$"),
22
+ powershell: createShellRenderers("PS>"),
23
+ edit: editRenderers,
24
+ write: writeRenderers,
25
+ grep: grepRenderers,
26
+ find: findRenderers,
27
+ ls: lsRenderers,
28
+ webfetch: webfetchRenderers,
29
+ webextract: webextractRenderers,
30
+ };
31
+ }
32
+ /**
33
+ * Merge built-in renderers into a tool definition that does not supply its own.
34
+ *
35
+ * `ToolExecutionComponent` used to do this lookup itself, which forced every presentation to import
36
+ * the tool implementations. Callers do it now, so a process that renders can import renderers alone.
37
+ */
38
+ export function withBuiltInRenderers(toolName, definition) {
39
+ const builtIn = createAllToolRenderers()[toolName];
40
+ if (!definition)
41
+ return builtIn;
42
+ if (!builtIn)
43
+ return definition;
44
+ return {
45
+ ...definition,
46
+ renderCall: definition.renderCall ?? builtIn.renderCall,
47
+ renderResult: definition.renderResult ?? builtIn.renderResult,
48
+ };
49
+ }
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/tools/renderers/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAI5C,OAAO,EACN,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,aAAa,EACb,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,GACd,CAAC;AAEF,6DAA6D;AAC7D,MAAM,UAAU,sBAAsB,GAAoC;IACzE,OAAO;QACN,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,oBAAoB,CAAC,GAAG,CAAC;QAC/B,UAAU,EAAE,oBAAoB,CAAC,KAAK,CAAC;QACvC,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,aAAa;QACnB,EAAE,EAAE,WAAW;QACf,QAAQ,EAAE,iBAAiB;QAC3B,UAAU,EAAE,mBAAmB;KAC/B,CAAC;AAAA,CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CACnC,QAAgB,EAChB,UAAmC,EACO;IAC1C,MAAM,OAAO,GAAG,sBAAsB,EAAE,CAAC,QAAoB,CAAC,CAAC;IAC/D,IAAI,CAAC,UAAU;QAAE,OAAO,OAAO,CAAC;IAChC,IAAI,CAAC,OAAO;QAAE,OAAO,UAAU,CAAC;IAChC,OAAO;QACN,GAAG,UAAU;QACb,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU;QACvD,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,OAAO,CAAC,YAAY;KAC7D,CAAC;AAAA,CACF","sourcesContent":["/**\n * Built-in tool renderers, without the tools themselves.\n *\n * A presentation displays tool calls and results; it does not execute them and does not need their\n * typebox parameter schemas. Importing this instead of `core/tools/index.ts` keeps ~17 MB of module\n * graph out of a process that only renders.\n */\n\nimport type { ToolDefinition } from \"../../extensions/types.ts\";\nimport type { ToolName } from \"../index.ts\";\nimport { createShellRenderers } from \"./bash.ts\";\nimport { editRenderers } from \"./edit.ts\";\nimport { findRenderers } from \"./find.ts\";\nimport { grepRenderers } from \"./grep.ts\";\nimport { lsRenderers } from \"./ls.ts\";\nimport { readRenderers } from \"./read.ts\";\nimport { webextractRenderers, webfetchRenderers } from \"./webfetch.ts\";\nimport { writeRenderers } from \"./write.ts\";\n\nexport type ToolRenderers = Pick<ToolDefinition<any, any>, \"renderCall\" | \"renderResult\">;\n\nexport {\n\tcreateShellRenderers,\n\teditRenderers,\n\tfindRenderers,\n\tgrepRenderers,\n\tlsRenderers,\n\treadRenderers,\n\twebextractRenderers,\n\twebfetchRenderers,\n\twriteRenderers,\n};\n\n/** Renderers for every built-in tool, keyed by tool name. */\nexport function createAllToolRenderers(): Record<ToolName, ToolRenderers> {\n\treturn {\n\t\tread: readRenderers,\n\t\tbash: createShellRenderers(\"$\"),\n\t\tpowershell: createShellRenderers(\"PS>\"),\n\t\tedit: editRenderers,\n\t\twrite: writeRenderers,\n\t\tgrep: grepRenderers,\n\t\tfind: findRenderers,\n\t\tls: lsRenderers,\n\t\twebfetch: webfetchRenderers,\n\t\twebextract: webextractRenderers,\n\t};\n}\n\n/**\n * Merge built-in renderers into a tool definition that does not supply its own.\n *\n * `ToolExecutionComponent` used to do this lookup itself, which forced every presentation to import\n * the tool implementations. Callers do it now, so a process that renders can import renderers alone.\n */\nexport function withBuiltInRenderers<TDefinition extends ToolRenderers>(\n\ttoolName: string,\n\tdefinition: TDefinition | undefined,\n): TDefinition | ToolRenderers | undefined {\n\tconst builtIn = createAllToolRenderers()[toolName as ToolName];\n\tif (!definition) return builtIn;\n\tif (!builtIn) return definition;\n\treturn {\n\t\t...definition,\n\t\trenderCall: definition.renderCall ?? builtIn.renderCall,\n\t\trenderResult: definition.renderResult ?? builtIn.renderResult,\n\t};\n}\n"]}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Presentation for the ls tool.
3
+ *
4
+ * Renderers live apart from the implementation so a process that only displays tool output does not
5
+ * load the execution path or its typebox parameter schema. `ls.ts` spreads these into its
6
+ * definition, so the tool's public shape is unchanged.
7
+ */
8
+ import type { ToolDefinition } from "../../extensions/types.ts";
9
+ export declare const lsRenderers: Pick<ToolDefinition<any, any>, "renderCall" | "renderResult">;
10
+ //# sourceMappingURL=ls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/renderers/ls.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,cAAc,EAA2B,MAAM,2BAA2B,CAAC;AAuDzF,eAAO,MAAM,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,YAAY,GAAG,cAAc,CAWrF,CAAC","sourcesContent":["/**\n * Presentation for the ls tool.\n *\n * Renderers live apart from the implementation so a process that only displays tool output does not\n * load the execution path or its typebox parameter schema. `ls.ts` spreads these into its\n * definition, so the tool's public shape is unchanged.\n */\n\nimport { Text } from \"@m4ike1/ion-tui\";\nimport { keyHint } from \"../../../modes/interactive/components/keybinding-hints.ts\";\nimport type { Theme } from \"../../../modes/interactive/theme/theme.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../../extensions/types.ts\";\nimport type { LsToolDetails } from \"../ls.ts\";\nimport { getTextOutput, renderToolPath, str } from \"../render-utils.ts\";\nimport { DEFAULT_MAX_BYTES, formatSize } from \"../truncate.ts\";\n\nfunction formatLsCall(\n\targs: { path?: string; limit?: number; sort?: string; filter?: string; detail?: boolean } | undefined,\n\ttheme: Theme,\n\tcwd: string,\n): string {\n\tconst pathDisplay = renderToolPath(str(args?.path), theme, cwd, { emptyFallback: \".\" });\n\tlet text = `${theme.fg(\"toolTitle\", theme.bold(\"ls\"))} ${pathDisplay}`;\n\tconst modifiers: string[] = [];\n\tif (args?.sort && args.sort !== \"name\") modifiers.push(args.sort);\n\tif (args?.filter) modifiers.push(args.filter);\n\tif (args?.detail) modifiers.push(\"detail\");\n\tif (args?.limit !== undefined) modifiers.push(`limit ${args.limit}`);\n\tif (modifiers.length > 0) {\n\t\ttext += theme.fg(\"toolOutput\", ` (${modifiers.join(\", \")})`);\n\t}\n\treturn text;\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: 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\")}${theme.fg(\"muted\", \")\")}`;\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 const lsRenderers: Pick<ToolDefinition<any, any>, \"renderCall\" | \"renderResult\"> = {\n\trenderCall(args, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(formatLsCall(args as any, theme, context.cwd));\n\t\treturn text;\n\t},\n\trenderResult(result, options, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(formatLsResult(result as any, options, theme, context.showImages));\n\t\treturn text;\n\t},\n};\n"]}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Presentation for the ls tool.
3
+ *
4
+ * Renderers live apart from the implementation so a process that only displays tool output does not
5
+ * load the execution path or its typebox parameter schema. `ls.ts` spreads these into its
6
+ * definition, so the tool's public shape is unchanged.
7
+ */
8
+ import { Text } from "@m4ike1/ion-tui";
9
+ import { keyHint } from "../../../modes/interactive/components/keybinding-hints.js";
10
+ import { getTextOutput, renderToolPath, str } from "../render-utils.js";
11
+ import { DEFAULT_MAX_BYTES, formatSize } from "../truncate.js";
12
+ function formatLsCall(args, theme, cwd) {
13
+ const pathDisplay = renderToolPath(str(args?.path), theme, cwd, { emptyFallback: "." });
14
+ let text = `${theme.fg("toolTitle", theme.bold("ls"))} ${pathDisplay}`;
15
+ const modifiers = [];
16
+ if (args?.sort && args.sort !== "name")
17
+ modifiers.push(args.sort);
18
+ if (args?.filter)
19
+ modifiers.push(args.filter);
20
+ if (args?.detail)
21
+ modifiers.push("detail");
22
+ if (args?.limit !== undefined)
23
+ modifiers.push(`limit ${args.limit}`);
24
+ if (modifiers.length > 0) {
25
+ text += theme.fg("toolOutput", ` (${modifiers.join(", ")})`);
26
+ }
27
+ return text;
28
+ }
29
+ function formatLsResult(result, options, theme, showImages) {
30
+ const output = getTextOutput(result, showImages).trim();
31
+ let text = "";
32
+ if (output) {
33
+ const lines = output.split("\n");
34
+ const maxLines = options.expanded ? lines.length : 20;
35
+ const displayLines = lines.slice(0, maxLines);
36
+ const remaining = lines.length - maxLines;
37
+ text += `\n${displayLines.map((line) => theme.fg("toolOutput", line)).join("\n")}`;
38
+ if (remaining > 0) {
39
+ text += `${theme.fg("muted", `\n... (${remaining} more lines,`)} ${keyHint("app.tools.expand", "to expand")}${theme.fg("muted", ")")}`;
40
+ }
41
+ }
42
+ const entryLimit = result.details?.entryLimitReached;
43
+ const truncation = result.details?.truncation;
44
+ if (entryLimit || truncation?.truncated) {
45
+ const warnings = [];
46
+ if (entryLimit)
47
+ warnings.push(`${entryLimit} entries limit`);
48
+ if (truncation?.truncated)
49
+ warnings.push(`${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit`);
50
+ text += `\n${theme.fg("warning", `[Truncated: ${warnings.join(", ")}]`)}`;
51
+ }
52
+ return text;
53
+ }
54
+ export const lsRenderers = {
55
+ renderCall(args, theme, context) {
56
+ const text = context.lastComponent ?? new Text("", 0, 0);
57
+ text.setText(formatLsCall(args, theme, context.cwd));
58
+ return text;
59
+ },
60
+ renderResult(result, options, theme, context) {
61
+ const text = context.lastComponent ?? new Text("", 0, 0);
62
+ text.setText(formatLsResult(result, options, theme, context.showImages));
63
+ return text;
64
+ },
65
+ };
66
+ //# sourceMappingURL=ls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ls.js","sourceRoot":"","sources":["../../../../src/core/tools/renderers/ls.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,2DAA2D,CAAC;AAIpF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE/D,SAAS,YAAY,CACpB,IAAqG,EACrG,KAAY,EACZ,GAAW,EACF;IACT,MAAM,WAAW,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC;IACxF,IAAI,IAAI,GAAG,GAAG,KAAK,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC;IACvE,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM;QAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClE,IAAI,IAAI,EAAE,MAAM;QAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9C,IAAI,IAAI,EAAE,MAAM;QAAE,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3C,IAAI,IAAI,EAAE,KAAK,KAAK,SAAS;QAAE,SAAS,CAAC,IAAI,CA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CAAC,CAAC,CAAC;QAChF,OAAO,IAAI,CAAC;IAAA,CACZ;CACD,CAAC","sourcesContent":["/**\n * Presentation for the ls tool.\n *\n * Renderers live apart from the implementation so a process that only displays tool output does not\n * load the execution path or its typebox parameter schema. `ls.ts` spreads these into its\n * definition, so the tool's public shape is unchanged.\n */\n\nimport { Text } from \"@m4ike1/ion-tui\";\nimport { keyHint } from \"../../../modes/interactive/components/keybinding-hints.ts\";\nimport type { Theme } from \"../../../modes/interactive/theme/theme.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../../extensions/types.ts\";\nimport type { LsToolDetails } from \"../ls.ts\";\nimport { getTextOutput, renderToolPath, str } from \"../render-utils.ts\";\nimport { DEFAULT_MAX_BYTES, formatSize } from \"../truncate.ts\";\n\nfunction formatLsCall(\n\targs: { path?: string; limit?: number; sort?: string; filter?: string; detail?: boolean } | undefined,\n\ttheme: Theme,\n\tcwd: string,\n): string {\n\tconst pathDisplay = renderToolPath(str(args?.path), theme, cwd, { emptyFallback: \".\" });\n\tlet text = `${theme.fg(\"toolTitle\", theme.bold(\"ls\"))} ${pathDisplay}`;\n\tconst modifiers: string[] = [];\n\tif (args?.sort && args.sort !== \"name\") modifiers.push(args.sort);\n\tif (args?.filter) modifiers.push(args.filter);\n\tif (args?.detail) modifiers.push(\"detail\");\n\tif (args?.limit !== undefined) modifiers.push(`limit ${args.limit}`);\n\tif (modifiers.length > 0) {\n\t\ttext += theme.fg(\"toolOutput\", ` (${modifiers.join(\", \")})`);\n\t}\n\treturn text;\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: 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\")}${theme.fg(\"muted\", \")\")}`;\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 const lsRenderers: Pick<ToolDefinition<any, any>, \"renderCall\" | \"renderResult\"> = {\n\trenderCall(args, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(formatLsCall(args as any, theme, context.cwd));\n\t\treturn text;\n\t},\n\trenderResult(result, options, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(formatLsResult(result as any, options, theme, context.showImages));\n\t\treturn text;\n\t},\n};\n"]}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Presentation for the read tool.
3
+ *
4
+ * Renderers live apart from the implementation so a process that only displays tool output does not
5
+ * load the execution path or its typebox parameter schema. `read.ts` spreads these into its
6
+ * definition, so the tool's public shape is unchanged.
7
+ */
8
+ import type { ToolDefinition } from "../../extensions/types.ts";
9
+ import type { ReadToolDetails } from "../read.ts";
10
+ export declare const readRenderers: Pick<ToolDefinition<any, ReadToolDetails | undefined>, "renderCall" | "renderResult">;
11
+ //# sourceMappingURL=read.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/renderers/read.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,KAAK,EAAE,cAAc,EAA2B,MAAM,2BAA2B,CAAC;AAEzF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAoIlD,eAAO,MAAM,aAAa,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,eAAe,GAAG,SAAS,CAAC,EAAE,YAAY,GAAG,cAAc,CAyB/G,CAAC","sourcesContent":["/**\n * Presentation for the read tool.\n *\n * Renderers live apart from the implementation so a process that only displays tool output does not\n * load the execution path or its typebox parameter schema. `read.ts` spreads these into its\n * definition, so the tool's public shape is unchanged.\n */\n\nimport { basename, dirname, isAbsolute, relative, resolve as resolvePath, sep } from \"node:path\";\nimport type { ImageContent, TextContent } from \"@m4ike1/ion-ai\";\nimport { Text } from \"@m4ike1/ion-tui\";\nimport { getReadmePath } from \"../../../config.ts\";\nimport { keyHint, keyText } from \"../../../modes/interactive/components/keybinding-hints.ts\";\nimport { getLanguageFromPath, highlightCode, type Theme } from \"../../../modes/interactive/theme/theme.ts\";\nimport { formatPathRelativeToCwdOrAbsolute } from \"../../../utils/paths.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../../extensions/types.ts\";\nimport { resolveToCwd } from \"../path-utils.ts\";\nimport type { ReadToolDetails } from \"../read.ts\";\nimport { getTextOutput, renderToolPath, replaceTabs, str } from \"../render-utils.ts\";\nimport { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize } from \"../truncate.ts\";\n\ninterface CompactReadClassification {\n\tkind: \"docs\" | \"resource\" | \"skill\";\n\tlabel: string;\n}\nconst COMPACT_RESOURCE_FILE_NAMES = new Set([\"AGENTS.override.md\", \"AGENTS.md\", \"AGENTS.MD\", \"CLAUDE.md\", \"CLAUDE.MD\"]);\ntype ReadRenderArgs = { path?: string; file_path?: string; offset?: number; limit?: number };\nfunction formatReadLineRange(args: ReadRenderArgs | undefined, theme: Theme): string {\n\tif (args?.offset === undefined && args?.limit === undefined) return \"\";\n\tconst startLine = args.offset ?? 1;\n\tconst endLine = args.limit !== undefined ? startLine + args.limit - 1 : \"\";\n\treturn theme.fg(\"warning\", `:${startLine}${endLine ? `-${endLine}` : \"\"}`);\n}\nfunction formatReadCall(args: ReadRenderArgs | undefined, theme: Theme, cwd: string): string {\n\tconst pathDisplay = renderToolPath(str(args?.file_path ?? args?.path), theme, cwd);\n\treturn `${theme.fg(\"toolTitle\", theme.bold(\"read\"))} ${pathDisplay}${formatReadLineRange(args, theme)}`;\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}\nfunction toPosixPath(filePath: string): string {\n\treturn filePath.split(sep).join(\"/\");\n}\nfunction getIonDocsClassification(absolutePath: string): CompactReadClassification | undefined {\n\tconst packageRoot = dirname(getReadmePath());\n\tconst relativePath = relative(resolvePath(packageRoot), resolvePath(absolutePath));\n\tif (\n\t\trelativePath === \"\" ||\n\t\trelativePath === \"..\" ||\n\t\trelativePath.startsWith(`..${sep}`) ||\n\t\tisAbsolute(relativePath)\n\t) {\n\t\treturn undefined;\n\t}\n\n\tconst label = toPosixPath(relativePath);\n\tif (label === \"README.md\" || label.startsWith(\"docs/\") || label.startsWith(\"examples/\")) {\n\t\treturn { kind: \"docs\", label };\n\t}\n\treturn undefined;\n}\nfunction getCompactReadClassification(\n\targs: ReadRenderArgs | undefined,\n\tcwd: string,\n): CompactReadClassification | undefined {\n\tconst rawPath = str(args?.file_path ?? args?.path);\n\tif (!rawPath) return undefined;\n\n\tconst absolutePath = resolveToCwd(rawPath, cwd);\n\tconst fileName = basename(absolutePath);\n\tif (fileName === \"SKILL.md\") {\n\t\treturn { kind: \"skill\", label: basename(dirname(absolutePath)) || fileName };\n\t}\n\n\tconst docsClassification = getIonDocsClassification(absolutePath);\n\tif (docsClassification) return docsClassification;\n\n\tif (COMPACT_RESOURCE_FILE_NAMES.has(fileName)) {\n\t\treturn { kind: \"resource\", label: formatPathRelativeToCwdOrAbsolute(absolutePath, cwd) };\n\t}\n\n\treturn undefined;\n}\nfunction formatCompactReadCall(\n\tclassification: CompactReadClassification,\n\targs: ReadRenderArgs | undefined,\n\ttheme: Theme,\n): string {\n\tconst expandHint = theme.fg(\"dim\", ` (${keyText(\"app.tools.expand\")} to expand)`);\n\tif (classification.kind === \"skill\") {\n\t\treturn (\n\t\t\ttheme.fg(\"customMessageLabel\", `\\x1b[1m[skill]\\x1b[22m `) +\n\t\t\ttheme.fg(\"customMessageText\", classification.label) +\n\t\t\tformatReadLineRange(args, theme) +\n\t\t\texpandHint\n\t\t);\n\t}\n\n\treturn (\n\t\ttheme.fg(\"toolTitle\", theme.bold(`read ${classification.kind}`)) +\n\t\t\" \" +\n\t\ttheme.fg(\"accent\", classification.label) +\n\t\tformatReadLineRange(args, theme) +\n\t\texpandHint\n\t);\n}\nfunction formatReadResult(\n\targs: ReadRenderArgs | undefined,\n\tresult: { content: (TextContent | ImageContent)[]; details?: ReadToolDetails },\n\toptions: ToolRenderResultOptions,\n\ttheme: Theme,\n\tshowImages: boolean,\n\t_cwd: string,\n\tisError: boolean,\n): string {\n\tif (!options.expanded && !isError) {\n\t\treturn \"\";\n\t}\n\n\tconst rawPath = str(args?.file_path ?? args?.path);\n\tconst output = getTextOutput(result, showImages);\n\tconst lang = !isError && 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\")}${theme.fg(\"muted\", \")\")}`;\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 const readRenderers: Pick<ToolDefinition<any, ReadToolDetails | undefined>, \"renderCall\" | \"renderResult\"> = {\n\trenderCall(rawArgs, theme, context) {\n\t\tconst args = rawArgs as ReadRenderArgs | undefined;\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\tconst classification = !context.expanded ? getCompactReadClassification(args, context.cwd) : undefined;\n\t\ttext.setText(\n\t\t\tclassification ? formatCompactReadCall(classification, args, theme) : formatReadCall(args, theme, context.cwd),\n\t\t);\n\t\treturn text;\n\t},\n\trenderResult(result, options, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(\n\t\t\tformatReadResult(\n\t\t\t\tcontext.args as ReadRenderArgs | undefined,\n\t\t\t\tresult,\n\t\t\t\toptions,\n\t\t\t\ttheme,\n\t\t\t\tcontext.showImages,\n\t\t\t\tcontext.cwd,\n\t\t\t\tcontext.isError,\n\t\t\t),\n\t\t);\n\t\treturn text;\n\t},\n};\n"]}
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Presentation for the read tool.
3
+ *
4
+ * Renderers live apart from the implementation so a process that only displays tool output does not
5
+ * load the execution path or its typebox parameter schema. `read.ts` spreads these into its
6
+ * definition, so the tool's public shape is unchanged.
7
+ */
8
+ import { basename, dirname, isAbsolute, relative, resolve as resolvePath, sep } from "node:path";
9
+ import { Text } from "@m4ike1/ion-tui";
10
+ import { getReadmePath } from "../../../config.js";
11
+ import { keyHint, keyText } from "../../../modes/interactive/components/keybinding-hints.js";
12
+ import { getLanguageFromPath, highlightCode } from "../../../modes/interactive/theme/theme.js";
13
+ import { formatPathRelativeToCwdOrAbsolute } from "../../../utils/paths.js";
14
+ import { resolveToCwd } from "../path-utils.js";
15
+ import { getTextOutput, renderToolPath, replaceTabs, str } from "../render-utils.js";
16
+ import { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize } from "../truncate.js";
17
+ const COMPACT_RESOURCE_FILE_NAMES = new Set(["AGENTS.override.md", "AGENTS.md", "AGENTS.MD", "CLAUDE.md", "CLAUDE.MD"]);
18
+ function formatReadLineRange(args, theme) {
19
+ if (args?.offset === undefined && args?.limit === undefined)
20
+ return "";
21
+ const startLine = args.offset ?? 1;
22
+ const endLine = args.limit !== undefined ? startLine + args.limit - 1 : "";
23
+ return theme.fg("warning", `:${startLine}${endLine ? `-${endLine}` : ""}`);
24
+ }
25
+ function formatReadCall(args, theme, cwd) {
26
+ const pathDisplay = renderToolPath(str(args?.file_path ?? args?.path), theme, cwd);
27
+ return `${theme.fg("toolTitle", theme.bold("read"))} ${pathDisplay}${formatReadLineRange(args, theme)}`;
28
+ }
29
+ function trimTrailingEmptyLines(lines) {
30
+ let end = lines.length;
31
+ while (end > 0 && lines[end - 1] === "") {
32
+ end--;
33
+ }
34
+ return lines.slice(0, end);
35
+ }
36
+ function toPosixPath(filePath) {
37
+ return filePath.split(sep).join("/");
38
+ }
39
+ function getIonDocsClassification(absolutePath) {
40
+ const packageRoot = dirname(getReadmePath());
41
+ const relativePath = relative(resolvePath(packageRoot), resolvePath(absolutePath));
42
+ if (relativePath === "" ||
43
+ relativePath === ".." ||
44
+ relativePath.startsWith(`..${sep}`) ||
45
+ isAbsolute(relativePath)) {
46
+ return undefined;
47
+ }
48
+ const label = toPosixPath(relativePath);
49
+ if (label === "README.md" || label.startsWith("docs/") || label.startsWith("examples/")) {
50
+ return { kind: "docs", label };
51
+ }
52
+ return undefined;
53
+ }
54
+ function getCompactReadClassification(args, cwd) {
55
+ const rawPath = str(args?.file_path ?? args?.path);
56
+ if (!rawPath)
57
+ return undefined;
58
+ const absolutePath = resolveToCwd(rawPath, cwd);
59
+ const fileName = basename(absolutePath);
60
+ if (fileName === "SKILL.md") {
61
+ return { kind: "skill", label: basename(dirname(absolutePath)) || fileName };
62
+ }
63
+ const docsClassification = getIonDocsClassification(absolutePath);
64
+ if (docsClassification)
65
+ return docsClassification;
66
+ if (COMPACT_RESOURCE_FILE_NAMES.has(fileName)) {
67
+ return { kind: "resource", label: formatPathRelativeToCwdOrAbsolute(absolutePath, cwd) };
68
+ }
69
+ return undefined;
70
+ }
71
+ function formatCompactReadCall(classification, args, theme) {
72
+ const expandHint = theme.fg("dim", ` (${keyText("app.tools.expand")} to expand)`);
73
+ if (classification.kind === "skill") {
74
+ return (theme.fg("customMessageLabel", `\x1b[1m[skill]\x1b[22m `) +
75
+ theme.fg("customMessageText", classification.label) +
76
+ formatReadLineRange(args, theme) +
77
+ expandHint);
78
+ }
79
+ return (theme.fg("toolTitle", theme.bold(`read ${classification.kind}`)) +
80
+ " " +
81
+ theme.fg("accent", classification.label) +
82
+ formatReadLineRange(args, theme) +
83
+ expandHint);
84
+ }
85
+ function formatReadResult(args, result, options, theme, showImages, _cwd, isError) {
86
+ if (!options.expanded && !isError) {
87
+ return "";
88
+ }
89
+ const rawPath = str(args?.file_path ?? args?.path);
90
+ const output = getTextOutput(result, showImages);
91
+ const lang = !isError && rawPath ? getLanguageFromPath(rawPath) : undefined;
92
+ const renderedLines = lang ? highlightCode(replaceTabs(output), lang) : output.split("\n");
93
+ const lines = trimTrailingEmptyLines(renderedLines);
94
+ const maxLines = options.expanded ? lines.length : 10;
95
+ const displayLines = lines.slice(0, maxLines);
96
+ const remaining = lines.length - maxLines;
97
+ let text = `\n${displayLines.map((line) => (lang ? replaceTabs(line) : theme.fg("toolOutput", replaceTabs(line)))).join("\n")}`;
98
+ if (remaining > 0) {
99
+ text += `${theme.fg("muted", `\n... (${remaining} more lines,`)} ${keyHint("app.tools.expand", "to expand")}${theme.fg("muted", ")")}`;
100
+ }
101
+ const truncation = result.details?.truncation;
102
+ if (truncation?.truncated) {
103
+ if (truncation.firstLineExceedsLimit) {
104
+ text += `\n${theme.fg("warning", `[First line exceeds ${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit]`)}`;
105
+ }
106
+ else if (truncation.truncatedBy === "lines") {
107
+ text += `\n${theme.fg("warning", `[Truncated: showing ${truncation.outputLines} of ${truncation.totalLines} lines (${truncation.maxLines ?? DEFAULT_MAX_LINES} line limit)]`)}`;
108
+ }
109
+ else {
110
+ text += `\n${theme.fg("warning", `[Truncated: ${truncation.outputLines} lines shown (${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit)]`)}`;
111
+ }
112
+ }
113
+ return text;
114
+ }
115
+ export const readRenderers = {
116
+ renderCall(rawArgs, theme, context) {
117
+ const args = rawArgs;
118
+ const text = context.lastComponent ?? new Text("", 0, 0);
119
+ const classification = !context.expanded ? getCompactReadClassification(args, context.cwd) : undefined;
120
+ text.setText(classification ? formatCompactReadCall(classification, args, theme) : formatReadCall(args, theme, context.cwd));
121
+ return text;
122
+ },
123
+ renderResult(result, options, theme, context) {
124
+ const text = context.lastComponent ?? new Text("", 0, 0);
125
+ text.setText(formatReadResult(context.args, result, options, theme, context.showImages, context.cwd, context.isError));
126
+ return text;
127
+ },
128
+ };
129
+ //# sourceMappingURL=read.js.map
@@ -0,0 +1 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C,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/E,IAAI,CAAC,OAAO,CACX,gBAAgB,CACf,OAAO,CAAC,IAAkC,EAC1C,MAAM,EACN,OAAO,EACP,KAAK,EACL,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,GAAG,EACX,OAAO,CAAC,OAAO,CACf,CACD,CAAC;QACF,OAAO,IAAI,CAAC;IAAA,CACZ;CACD,CAAC","sourcesContent":["/**\n * Presentation for the read tool.\n *\n * Renderers live apart from the implementation so a process that only displays tool output does not\n * load the execution path or its typebox parameter schema. `read.ts` spreads these into its\n * definition, so the tool's public shape is unchanged.\n */\n\nimport { basename, dirname, isAbsolute, relative, resolve as resolvePath, sep } from \"node:path\";\nimport type { ImageContent, TextContent } from \"@m4ike1/ion-ai\";\nimport { Text } from \"@m4ike1/ion-tui\";\nimport { getReadmePath } from \"../../../config.ts\";\nimport { keyHint, keyText } from \"../../../modes/interactive/components/keybinding-hints.ts\";\nimport { getLanguageFromPath, highlightCode, type Theme } from \"../../../modes/interactive/theme/theme.ts\";\nimport { formatPathRelativeToCwdOrAbsolute } from \"../../../utils/paths.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../../extensions/types.ts\";\nimport { resolveToCwd } from \"../path-utils.ts\";\nimport type { ReadToolDetails } from \"../read.ts\";\nimport { getTextOutput, renderToolPath, replaceTabs, str } from \"../render-utils.ts\";\nimport { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize } from \"../truncate.ts\";\n\ninterface CompactReadClassification {\n\tkind: \"docs\" | \"resource\" | \"skill\";\n\tlabel: string;\n}\nconst COMPACT_RESOURCE_FILE_NAMES = new Set([\"AGENTS.override.md\", \"AGENTS.md\", \"AGENTS.MD\", \"CLAUDE.md\", \"CLAUDE.MD\"]);\ntype ReadRenderArgs = { path?: string; file_path?: string; offset?: number; limit?: number };\nfunction formatReadLineRange(args: ReadRenderArgs | undefined, theme: Theme): string {\n\tif (args?.offset === undefined && args?.limit === undefined) return \"\";\n\tconst startLine = args.offset ?? 1;\n\tconst endLine = args.limit !== undefined ? startLine + args.limit - 1 : \"\";\n\treturn theme.fg(\"warning\", `:${startLine}${endLine ? `-${endLine}` : \"\"}`);\n}\nfunction formatReadCall(args: ReadRenderArgs | undefined, theme: Theme, cwd: string): string {\n\tconst pathDisplay = renderToolPath(str(args?.file_path ?? args?.path), theme, cwd);\n\treturn `${theme.fg(\"toolTitle\", theme.bold(\"read\"))} ${pathDisplay}${formatReadLineRange(args, theme)}`;\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}\nfunction toPosixPath(filePath: string): string {\n\treturn filePath.split(sep).join(\"/\");\n}\nfunction getIonDocsClassification(absolutePath: string): CompactReadClassification | undefined {\n\tconst packageRoot = dirname(getReadmePath());\n\tconst relativePath = relative(resolvePath(packageRoot), resolvePath(absolutePath));\n\tif (\n\t\trelativePath === \"\" ||\n\t\trelativePath === \"..\" ||\n\t\trelativePath.startsWith(`..${sep}`) ||\n\t\tisAbsolute(relativePath)\n\t) {\n\t\treturn undefined;\n\t}\n\n\tconst label = toPosixPath(relativePath);\n\tif (label === \"README.md\" || label.startsWith(\"docs/\") || label.startsWith(\"examples/\")) {\n\t\treturn { kind: \"docs\", label };\n\t}\n\treturn undefined;\n}\nfunction getCompactReadClassification(\n\targs: ReadRenderArgs | undefined,\n\tcwd: string,\n): CompactReadClassification | undefined {\n\tconst rawPath = str(args?.file_path ?? args?.path);\n\tif (!rawPath) return undefined;\n\n\tconst absolutePath = resolveToCwd(rawPath, cwd);\n\tconst fileName = basename(absolutePath);\n\tif (fileName === \"SKILL.md\") {\n\t\treturn { kind: \"skill\", label: basename(dirname(absolutePath)) || fileName };\n\t}\n\n\tconst docsClassification = getIonDocsClassification(absolutePath);\n\tif (docsClassification) return docsClassification;\n\n\tif (COMPACT_RESOURCE_FILE_NAMES.has(fileName)) {\n\t\treturn { kind: \"resource\", label: formatPathRelativeToCwdOrAbsolute(absolutePath, cwd) };\n\t}\n\n\treturn undefined;\n}\nfunction formatCompactReadCall(\n\tclassification: CompactReadClassification,\n\targs: ReadRenderArgs | undefined,\n\ttheme: Theme,\n): string {\n\tconst expandHint = theme.fg(\"dim\", ` (${keyText(\"app.tools.expand\")} to expand)`);\n\tif (classification.kind === \"skill\") {\n\t\treturn (\n\t\t\ttheme.fg(\"customMessageLabel\", `\\x1b[1m[skill]\\x1b[22m `) +\n\t\t\ttheme.fg(\"customMessageText\", classification.label) +\n\t\t\tformatReadLineRange(args, theme) +\n\t\t\texpandHint\n\t\t);\n\t}\n\n\treturn (\n\t\ttheme.fg(\"toolTitle\", theme.bold(`read ${classification.kind}`)) +\n\t\t\" \" +\n\t\ttheme.fg(\"accent\", classification.label) +\n\t\tformatReadLineRange(args, theme) +\n\t\texpandHint\n\t);\n}\nfunction formatReadResult(\n\targs: ReadRenderArgs | undefined,\n\tresult: { content: (TextContent | ImageContent)[]; details?: ReadToolDetails },\n\toptions: ToolRenderResultOptions,\n\ttheme: Theme,\n\tshowImages: boolean,\n\t_cwd: string,\n\tisError: boolean,\n): string {\n\tif (!options.expanded && !isError) {\n\t\treturn \"\";\n\t}\n\n\tconst rawPath = str(args?.file_path ?? args?.path);\n\tconst output = getTextOutput(result, showImages);\n\tconst lang = !isError && 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\")}${theme.fg(\"muted\", \")\")}`;\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 const readRenderers: Pick<ToolDefinition<any, ReadToolDetails | undefined>, \"renderCall\" | \"renderResult\"> = {\n\trenderCall(rawArgs, theme, context) {\n\t\tconst args = rawArgs as ReadRenderArgs | undefined;\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\tconst classification = !context.expanded ? getCompactReadClassification(args, context.cwd) : undefined;\n\t\ttext.setText(\n\t\t\tclassification ? formatCompactReadCall(classification, args, theme) : formatReadCall(args, theme, context.cwd),\n\t\t);\n\t\treturn text;\n\t},\n\trenderResult(result, options, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(\n\t\t\tformatReadResult(\n\t\t\t\tcontext.args as ReadRenderArgs | undefined,\n\t\t\t\tresult,\n\t\t\t\toptions,\n\t\t\t\ttheme,\n\t\t\t\tcontext.showImages,\n\t\t\t\tcontext.cwd,\n\t\t\t\tcontext.isError,\n\t\t\t),\n\t\t);\n\t\treturn text;\n\t},\n};\n"]}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Presentation for the webfetch and webextract tools.
3
+ *
4
+ * Renderers live apart from the implementation so a process that only displays tool output does not
5
+ * load the execution path or its typebox parameter schema. `webfetch.ts`/`webextract.ts` spread
6
+ * these into their definitions, so the tools' public shape is unchanged.
7
+ */
8
+ import type { ToolDefinition } from "../../extensions/types.ts";
9
+ export declare const webfetchRenderers: Pick<ToolDefinition<any, any>, "renderCall" | "renderResult">;
10
+ export declare const webextractRenderers: Pick<ToolDefinition<any, any>, "renderCall" | "renderResult">;
11
+ //# sourceMappingURL=webfetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webfetch.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/renderers/webfetch.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,cAAc,EAA2B,MAAM,2BAA2B,CAAC;AAmFzF,eAAO,MAAM,iBAAiB,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,YAAY,GAAG,cAAc,CAW3F,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,YAAY,GAAG,cAAc,CAW7F,CAAC","sourcesContent":["/**\n * Presentation for the webfetch and webextract tools.\n *\n * Renderers live apart from the implementation so a process that only displays tool output does not\n * load the execution path or its typebox parameter schema. `webfetch.ts`/`webextract.ts` spread\n * these into their definitions, so the tools' public shape is unchanged.\n */\n\nimport { Text } from \"@m4ike1/ion-tui\";\nimport { keyHint } from \"../../../modes/interactive/components/keybinding-hints.ts\";\nimport type { Theme } from \"../../../modes/interactive/theme/theme.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../../extensions/types.ts\";\nimport { getTextOutput, invalidArgText, str } from \"../render-utils.ts\";\nimport type { WebextractToolDetails } from \"../webextract.ts\";\nimport type { WebfetchToolDetails } from \"../webfetch.ts\";\n\nfunction formatWebfetchCall(args: { query: string; limit?: number } | undefined, theme: Theme): string {\n\tconst query = str(args?.query);\n\tconst limit = args?.limit;\n\tconst invalidArg = invalidArgText(theme);\n\tlet text =\n\t\ttheme.fg(\"toolTitle\", theme.bold(\"webfetch\")) +\n\t\t\" \" +\n\t\t(query === null ? invalidArg : theme.fg(\"accent\", `\"${query || \"\"}\"`));\n\tif (limit !== undefined) text += theme.fg(\"toolOutput\", ` (limit ${limit})`);\n\treturn text;\n}\n\nfunction renderTrimmedOutput(output: string, options: ToolRenderResultOptions, theme: Theme, maxLines: number): string {\n\tif (!output) return \"\";\n\tconst lines = output.split(\"\\n\");\n\tconst displayLines = lines.slice(0, options.expanded ? lines.length : maxLines);\n\tconst remaining = lines.length - displayLines.length;\n\tlet text = `\\n${displayLines.map((line) => theme.fg(\"toolOutput\", line)).join(\"\\n\")}`;\n\tif (remaining > 0) {\n\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines,`)} ${keyHint(\"app.tools.expand\", \"to expand\")}${theme.fg(\"muted\", \")\")}`;\n\t}\n\treturn text;\n}\n\nfunction formatWebfetchResult(\n\tresult: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tdetails?: WebfetchToolDetails;\n\t},\n\toptions: ToolRenderResultOptions,\n\ttheme: Theme,\n\tshowImages: boolean,\n): string {\n\tconst output = getTextOutput(result, showImages).trim();\n\treturn renderTrimmedOutput(output, options, theme, 15);\n}\n\nfunction formatWebextractCall(\n\targs: { ref?: string; url?: string; offsetChars?: number; lengthChars?: number } | undefined,\n\ttheme: Theme,\n): string {\n\tconst ref = str(args?.ref);\n\tconst url = str(args?.url);\n\tconst target = ref || url || \"\";\n\tconst invalidArg = invalidArgText(theme);\n\tlet text =\n\t\ttheme.fg(\"toolTitle\", theme.bold(\"webextract\")) +\n\t\t\" \" +\n\t\t(target === null ? invalidArg : theme.fg(\"accent\", target || \"\"));\n\tconst offset = args?.offsetChars;\n\tconst length = args?.lengthChars;\n\tif (offset !== undefined || length !== undefined) {\n\t\ttext += theme.fg(\"toolOutput\", ` [${offset ?? 0}-${length !== undefined ? (offset ?? 0) + length : \"\"}]`);\n\t}\n\treturn text;\n}\n\nfunction formatWebextractResult(\n\tresult: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tdetails?: WebextractToolDetails;\n\t},\n\toptions: ToolRenderResultOptions,\n\ttheme: Theme,\n\tshowImages: boolean,\n): string {\n\tconst output = getTextOutput(result, showImages).trim();\n\tlet text = renderTrimmedOutput(output, options, theme, 15);\n\tconst details = result.details;\n\tif (details && details.totalChars > details.offsetChars + details.lengthChars) {\n\t\ttext += `\\n${theme.fg(\"warning\", `[Windowed: showing ${details.lengthChars} of ${details.totalChars} chars]`)}`;\n\t}\n\tif (details?.fallbackNotice) {\n\t\ttext += `\\n${theme.fg(\"warning\", details.fallbackNotice)}`;\n\t}\n\treturn text;\n}\n\nexport const webfetchRenderers: Pick<ToolDefinition<any, any>, \"renderCall\" | \"renderResult\"> = {\n\trenderCall(args, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(formatWebfetchCall(args as any, theme));\n\t\treturn text;\n\t},\n\trenderResult(result, options, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(formatWebfetchResult(result as any, options, theme, context.showImages));\n\t\treturn text;\n\t},\n};\n\nexport const webextractRenderers: Pick<ToolDefinition<any, any>, \"renderCall\" | \"renderResult\"> = {\n\trenderCall(args, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(formatWebextractCall(args as any, theme));\n\t\treturn text;\n\t},\n\trenderResult(result, options, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(formatWebextractResult(result as any, options, theme, context.showImages));\n\t\treturn text;\n\t},\n};\n"]}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Presentation for the webfetch and webextract tools.
3
+ *
4
+ * Renderers live apart from the implementation so a process that only displays tool output does not
5
+ * load the execution path or its typebox parameter schema. `webfetch.ts`/`webextract.ts` spread
6
+ * these into their definitions, so the tools' public shape is unchanged.
7
+ */
8
+ import { Text } from "@m4ike1/ion-tui";
9
+ import { keyHint } from "../../../modes/interactive/components/keybinding-hints.js";
10
+ import { getTextOutput, invalidArgText, str } from "../render-utils.js";
11
+ function formatWebfetchCall(args, theme) {
12
+ const query = str(args?.query);
13
+ const limit = args?.limit;
14
+ const invalidArg = invalidArgText(theme);
15
+ let text = theme.fg("toolTitle", theme.bold("webfetch")) +
16
+ " " +
17
+ (query === null ? invalidArg : theme.fg("accent", `"${query || ""}"`));
18
+ if (limit !== undefined)
19
+ text += theme.fg("toolOutput", ` (limit ${limit})`);
20
+ return text;
21
+ }
22
+ function renderTrimmedOutput(output, options, theme, maxLines) {
23
+ if (!output)
24
+ return "";
25
+ const lines = output.split("\n");
26
+ const displayLines = lines.slice(0, options.expanded ? lines.length : maxLines);
27
+ const remaining = lines.length - displayLines.length;
28
+ let text = `\n${displayLines.map((line) => theme.fg("toolOutput", line)).join("\n")}`;
29
+ if (remaining > 0) {
30
+ text += `${theme.fg("muted", `\n... (${remaining} more lines,`)} ${keyHint("app.tools.expand", "to expand")}${theme.fg("muted", ")")}`;
31
+ }
32
+ return text;
33
+ }
34
+ function formatWebfetchResult(result, options, theme, showImages) {
35
+ const output = getTextOutput(result, showImages).trim();
36
+ return renderTrimmedOutput(output, options, theme, 15);
37
+ }
38
+ function formatWebextractCall(args, theme) {
39
+ const ref = str(args?.ref);
40
+ const url = str(args?.url);
41
+ const target = ref || url || "";
42
+ const invalidArg = invalidArgText(theme);
43
+ let text = theme.fg("toolTitle", theme.bold("webextract")) +
44
+ " " +
45
+ (target === null ? invalidArg : theme.fg("accent", target || ""));
46
+ const offset = args?.offsetChars;
47
+ const length = args?.lengthChars;
48
+ if (offset !== undefined || length !== undefined) {
49
+ text += theme.fg("toolOutput", ` [${offset ?? 0}-${length !== undefined ? (offset ?? 0) + length : ""}]`);
50
+ }
51
+ return text;
52
+ }
53
+ function formatWebextractResult(result, options, theme, showImages) {
54
+ const output = getTextOutput(result, showImages).trim();
55
+ let text = renderTrimmedOutput(output, options, theme, 15);
56
+ const details = result.details;
57
+ if (details && details.totalChars > details.offsetChars + details.lengthChars) {
58
+ text += `\n${theme.fg("warning", `[Windowed: showing ${details.lengthChars} of ${details.totalChars} chars]`)}`;
59
+ }
60
+ if (details?.fallbackNotice) {
61
+ text += `\n${theme.fg("warning", details.fallbackNotice)}`;
62
+ }
63
+ return text;
64
+ }
65
+ export const webfetchRenderers = {
66
+ renderCall(args, theme, context) {
67
+ const text = context.lastComponent ?? new Text("", 0, 0);
68
+ text.setText(formatWebfetchCall(args, theme));
69
+ return text;
70
+ },
71
+ renderResult(result, options, theme, context) {
72
+ const text = context.lastComponent ?? new Text("", 0, 0);
73
+ text.setText(formatWebfetchResult(result, options, theme, context.showImages));
74
+ return text;
75
+ },
76
+ };
77
+ export const webextractRenderers = {
78
+ renderCall(args, theme, context) {
79
+ const text = context.lastComponent ?? new Text("", 0, 0);
80
+ text.setText(formatWebextractCall(args, theme));
81
+ return text;
82
+ },
83
+ renderResult(result, options, theme, context) {
84
+ const text = context.lastComponent ?? new Text("", 0, 0);
85
+ text.setText(formatWebextractResult(result, options, theme, context.showImages));
86
+ return text;
87
+ },
88
+ };
89
+ //# sourceMappingURL=webfetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webfetch.js","sourceRoot":"","sources":["../../../../src/core/tools/renderers/webfetch.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,2DAA2D,CAAC;AAGpF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAIxE,SAAS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,OAAO,CAAC,kBAAkB,CAAC,IAAW,EAAE,KAAK,CAAC,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC;IAAA,CACZ;IACD,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;QAC7C,MAAM,IAAI,GAAI,OAAO,CAAC,aAAkC,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/E,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,MAAa,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;QACtF,OAAO,IAAI,CAAC;IAAA,CACZ;CACD,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAkE;IACjG,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE;QAChC,MAAM,IAAI,GAAI,OAAO,CAAC,aAAkC,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/E,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAW,EAAE,KAAK,CAAC,CAAC,CAAC;QACvD,OAAO,IAAI,CAAC;IAAA,CACZ;IACD,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;QAC7C,MAAM,IAAI,GAAI,OAAO,CAAC,aAAkC,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/E,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,MAAa,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;QACxF,OAAO,IAAI,CAAC;IAAA,CACZ;CACD,CAAC","sourcesContent":["/**\n * Presentation for the webfetch and webextract tools.\n *\n * Renderers live apart from the implementation so a process that only displays tool output does not\n * load the execution path or its typebox parameter schema. `webfetch.ts`/`webextract.ts` spread\n * these into their definitions, so the tools' public shape is unchanged.\n */\n\nimport { Text } from \"@m4ike1/ion-tui\";\nimport { keyHint } from \"../../../modes/interactive/components/keybinding-hints.ts\";\nimport type { Theme } from \"../../../modes/interactive/theme/theme.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../../extensions/types.ts\";\nimport { getTextOutput, invalidArgText, str } from \"../render-utils.ts\";\nimport type { WebextractToolDetails } from \"../webextract.ts\";\nimport type { WebfetchToolDetails } from \"../webfetch.ts\";\n\nfunction formatWebfetchCall(args: { query: string; limit?: number } | undefined, theme: Theme): string {\n\tconst query = str(args?.query);\n\tconst limit = args?.limit;\n\tconst invalidArg = invalidArgText(theme);\n\tlet text =\n\t\ttheme.fg(\"toolTitle\", theme.bold(\"webfetch\")) +\n\t\t\" \" +\n\t\t(query === null ? invalidArg : theme.fg(\"accent\", `\"${query || \"\"}\"`));\n\tif (limit !== undefined) text += theme.fg(\"toolOutput\", ` (limit ${limit})`);\n\treturn text;\n}\n\nfunction renderTrimmedOutput(output: string, options: ToolRenderResultOptions, theme: Theme, maxLines: number): string {\n\tif (!output) return \"\";\n\tconst lines = output.split(\"\\n\");\n\tconst displayLines = lines.slice(0, options.expanded ? lines.length : maxLines);\n\tconst remaining = lines.length - displayLines.length;\n\tlet text = `\\n${displayLines.map((line) => theme.fg(\"toolOutput\", line)).join(\"\\n\")}`;\n\tif (remaining > 0) {\n\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines,`)} ${keyHint(\"app.tools.expand\", \"to expand\")}${theme.fg(\"muted\", \")\")}`;\n\t}\n\treturn text;\n}\n\nfunction formatWebfetchResult(\n\tresult: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tdetails?: WebfetchToolDetails;\n\t},\n\toptions: ToolRenderResultOptions,\n\ttheme: Theme,\n\tshowImages: boolean,\n): string {\n\tconst output = getTextOutput(result, showImages).trim();\n\treturn renderTrimmedOutput(output, options, theme, 15);\n}\n\nfunction formatWebextractCall(\n\targs: { ref?: string; url?: string; offsetChars?: number; lengthChars?: number } | undefined,\n\ttheme: Theme,\n): string {\n\tconst ref = str(args?.ref);\n\tconst url = str(args?.url);\n\tconst target = ref || url || \"\";\n\tconst invalidArg = invalidArgText(theme);\n\tlet text =\n\t\ttheme.fg(\"toolTitle\", theme.bold(\"webextract\")) +\n\t\t\" \" +\n\t\t(target === null ? invalidArg : theme.fg(\"accent\", target || \"\"));\n\tconst offset = args?.offsetChars;\n\tconst length = args?.lengthChars;\n\tif (offset !== undefined || length !== undefined) {\n\t\ttext += theme.fg(\"toolOutput\", ` [${offset ?? 0}-${length !== undefined ? (offset ?? 0) + length : \"\"}]`);\n\t}\n\treturn text;\n}\n\nfunction formatWebextractResult(\n\tresult: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tdetails?: WebextractToolDetails;\n\t},\n\toptions: ToolRenderResultOptions,\n\ttheme: Theme,\n\tshowImages: boolean,\n): string {\n\tconst output = getTextOutput(result, showImages).trim();\n\tlet text = renderTrimmedOutput(output, options, theme, 15);\n\tconst details = result.details;\n\tif (details && details.totalChars > details.offsetChars + details.lengthChars) {\n\t\ttext += `\\n${theme.fg(\"warning\", `[Windowed: showing ${details.lengthChars} of ${details.totalChars} chars]`)}`;\n\t}\n\tif (details?.fallbackNotice) {\n\t\ttext += `\\n${theme.fg(\"warning\", details.fallbackNotice)}`;\n\t}\n\treturn text;\n}\n\nexport const webfetchRenderers: Pick<ToolDefinition<any, any>, \"renderCall\" | \"renderResult\"> = {\n\trenderCall(args, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(formatWebfetchCall(args as any, theme));\n\t\treturn text;\n\t},\n\trenderResult(result, options, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(formatWebfetchResult(result as any, options, theme, context.showImages));\n\t\treturn text;\n\t},\n};\n\nexport const webextractRenderers: Pick<ToolDefinition<any, any>, \"renderCall\" | \"renderResult\"> = {\n\trenderCall(args, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(formatWebextractCall(args as any, theme));\n\t\treturn text;\n\t},\n\trenderResult(result, options, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(formatWebextractResult(result as any, options, theme, context.showImages));\n\t\treturn text;\n\t},\n};\n"]}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Presentation for the write tool.
3
+ *
4
+ * Renderers live apart from the implementation so a process that only displays tool output does not
5
+ * load the execution path or its typebox parameter schema. `write.ts` spreads these into its
6
+ * definition, so the tool's public shape is unchanged.
7
+ */
8
+ import type { ToolDefinition } from "../../extensions/types.ts";
9
+ export declare const writeRenderers: Pick<ToolDefinition<any, any>, "renderCall" | "renderResult">;
10
+ //# sourceMappingURL=write.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/renderers/write.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,cAAc,EAA2B,MAAM,2BAA2B,CAAC;AAqIzF,eAAO,MAAM,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,YAAY,GAAG,cAAc,CAoCxF,CAAC","sourcesContent":["/**\n * Presentation for the write tool.\n *\n * Renderers live apart from the implementation so a process that only displays tool output does not\n * load the execution path or its typebox parameter schema. `write.ts` spreads these into its\n * definition, so the tool's public shape is unchanged.\n */\n\nimport { Container, Text } from \"@m4ike1/ion-tui\";\nimport { keyHint } from \"../../../modes/interactive/components/keybinding-hints.ts\";\nimport { getLanguageFromPath, highlightCode, type Theme } from \"../../../modes/interactive/theme/theme.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../../extensions/types.ts\";\nimport { normalizeDisplayText, renderToolPath, replaceTabs, str } from \"../render-utils.ts\";\n\ntype WriteHighlightCache = {\n\trawPath: string | null;\n\tlang: string;\n\trawContent: string;\n\tnormalizedLines: string[];\n\thighlightedLines: string[];\n};\nclass WriteCallRenderComponent extends Text {\n\tcache?: WriteHighlightCache;\n\n\tconstructor() {\n\t\tsuper(\"\", 0, 0);\n\t}\n}\nconst WRITE_PARTIAL_FULL_HIGHLIGHT_LINES = 50;\nfunction highlightSingleLine(line: string, lang: string): string {\n\tconst highlighted = highlightCode(line, lang);\n\treturn highlighted[0] ?? \"\";\n}\nfunction refreshWriteHighlightPrefix(cache: WriteHighlightCache): void {\n\tconst prefixCount = Math.min(WRITE_PARTIAL_FULL_HIGHLIGHT_LINES, cache.normalizedLines.length);\n\tif (prefixCount === 0) return;\n\tconst prefixSource = cache.normalizedLines.slice(0, prefixCount).join(\"\\n\");\n\tconst prefixHighlighted = highlightCode(prefixSource, cache.lang);\n\tfor (let i = 0; i < prefixCount; i++) {\n\t\tcache.highlightedLines[i] =\n\t\t\tprefixHighlighted[i] ?? highlightSingleLine(cache.normalizedLines[i] ?? \"\", cache.lang);\n\t}\n}\nfunction rebuildWriteHighlightCacheFull(rawPath: string | null, fileContent: string): WriteHighlightCache | undefined {\n\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tif (!lang) return undefined;\n\tconst displayContent = normalizeDisplayText(fileContent);\n\tconst normalized = replaceTabs(displayContent);\n\treturn {\n\t\trawPath,\n\t\tlang,\n\t\trawContent: fileContent,\n\t\tnormalizedLines: normalized.split(\"\\n\"),\n\t\thighlightedLines: highlightCode(normalized, lang),\n\t};\n}\nfunction updateWriteHighlightCacheIncremental(\n\tcache: WriteHighlightCache | undefined,\n\trawPath: string | null,\n\tfileContent: string,\n): WriteHighlightCache | undefined {\n\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tif (!lang) return undefined;\n\tif (!cache) return rebuildWriteHighlightCacheFull(rawPath, fileContent);\n\tif (cache.lang !== lang || cache.rawPath !== rawPath) return rebuildWriteHighlightCacheFull(rawPath, fileContent);\n\tif (!fileContent.startsWith(cache.rawContent)) return rebuildWriteHighlightCacheFull(rawPath, fileContent);\n\tif (fileContent.length === cache.rawContent.length) return cache;\n\n\tconst deltaRaw = fileContent.slice(cache.rawContent.length);\n\tconst deltaDisplay = normalizeDisplayText(deltaRaw);\n\tconst deltaNormalized = replaceTabs(deltaDisplay);\n\tcache.rawContent = fileContent;\n\tif (cache.normalizedLines.length === 0) {\n\t\tcache.normalizedLines.push(\"\");\n\t\tcache.highlightedLines.push(\"\");\n\t}\n\n\tconst segments = deltaNormalized.split(\"\\n\");\n\tconst lastIndex = cache.normalizedLines.length - 1;\n\tcache.normalizedLines[lastIndex] += segments[0];\n\tcache.highlightedLines[lastIndex] = highlightSingleLine(cache.normalizedLines[lastIndex], cache.lang);\n\tfor (let i = 1; i < segments.length; i++) {\n\t\tcache.normalizedLines.push(segments[i]);\n\t\tcache.highlightedLines.push(highlightSingleLine(segments[i], cache.lang));\n\t}\n\trefreshWriteHighlightPrefix(cache);\n\treturn cache;\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}\nfunction formatWriteCall(\n\targs: { path?: string; file_path?: string; content?: string } | undefined,\n\toptions: ToolRenderResultOptions,\n\ttheme: Theme,\n\tcache: WriteHighlightCache | undefined,\n\tcwd: string,\n): string {\n\tconst rawPath = str(args?.file_path ?? args?.path);\n\tconst fileContent = str(args?.content);\n\tconst pathDisplay = renderToolPath(rawPath, theme, cwd);\n\tlet text = `${theme.fg(\"toolTitle\", theme.bold(\"write\"))} ${pathDisplay}`;\n\n\tif (fileContent === null) {\n\t\ttext += `\\n\\n${theme.fg(\"error\", \"[invalid content arg - expected string]\")}`;\n\t} else if (fileContent) {\n\t\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\t\tconst renderedLines = lang\n\t\t\t? (cache?.highlightedLines ?? highlightCode(replaceTabs(normalizeDisplayText(fileContent)), lang))\n\t\t\t: normalizeDisplayText(fileContent).split(\"\\n\");\n\t\tconst lines = trimTrailingEmptyLines(renderedLines);\n\t\tconst totalLines = lines.length;\n\t\tconst maxLines = options.expanded ? lines.length : 10;\n\t\tconst displayLines = lines.slice(0, maxLines);\n\t\tconst remaining = lines.length - maxLines;\n\t\ttext += `\\n\\n${displayLines.map((line) => (lang ? line : theme.fg(\"toolOutput\", replaceTabs(line)))).join(\"\\n\")}`;\n\t\tif (remaining > 0) {\n\t\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines, ${totalLines} total,`)} ${keyHint(\"app.tools.expand\", \"to expand\")}${theme.fg(\"muted\", \")\")}`;\n\t\t}\n\t}\n\n\treturn text;\n}\nfunction formatWriteResult(\n\tresult: { content: Array<{ type: string; text?: string; data?: string; mimeType?: string }>; isError?: boolean },\n\ttheme: Theme,\n): string | undefined {\n\tif (!result.isError) {\n\t\treturn undefined;\n\t}\n\tconst output = result.content\n\t\t.filter((c) => c.type === \"text\")\n\t\t.map((c) => c.text || \"\")\n\t\t.join(\"\\n\");\n\tif (!output) {\n\t\treturn undefined;\n\t}\n\treturn `\\n${theme.fg(\"error\", output)}`;\n}\n\nexport const writeRenderers: Pick<ToolDefinition<any, any>, \"renderCall\" | \"renderResult\"> = {\n\trenderCall(args, theme, context) {\n\t\tconst renderArgs = args as { path?: string; file_path?: string; content?: string } | undefined;\n\t\tconst rawPath = str(renderArgs?.file_path ?? renderArgs?.path);\n\t\tconst fileContent = str(renderArgs?.content);\n\t\tconst component =\n\t\t\t(context.lastComponent as WriteCallRenderComponent | undefined) ?? new WriteCallRenderComponent();\n\t\tif (fileContent !== null) {\n\t\t\tcomponent.cache = context.argsComplete\n\t\t\t\t? rebuildWriteHighlightCacheFull(rawPath, fileContent)\n\t\t\t\t: updateWriteHighlightCacheIncremental(component.cache, rawPath, fileContent);\n\t\t} else {\n\t\t\tcomponent.cache = undefined;\n\t\t}\n\t\tcomponent.setText(\n\t\t\tformatWriteCall(\n\t\t\t\trenderArgs,\n\t\t\t\t{ expanded: context.expanded, isPartial: context.isPartial },\n\t\t\t\ttheme,\n\t\t\t\tcomponent.cache,\n\t\t\t\tcontext.cwd,\n\t\t\t),\n\t\t);\n\t\treturn component;\n\t},\n\trenderResult(result, _options, theme, context) {\n\t\tconst output = formatWriteResult({ ...result, isError: context.isError }, theme);\n\t\tif (!output) {\n\t\t\tconst component = (context.lastComponent as Container | undefined) ?? new Container();\n\t\t\tcomponent.clear();\n\t\t\treturn component;\n\t\t}\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(output);\n\t\treturn text;\n\t},\n};\n"]}