@subimpact/e 0.99.12 → 0.100.1

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 (930) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +7 -1
  3. package/dist/bundle/chunks/anthropic-messages-BGDBSRR2.js +6 -0
  4. package/dist/bundle/chunks/azure-openai-responses-ZCNWFVTX.js +2 -0
  5. package/dist/bundle/chunks/bedrock-converse-stream.js +3 -3
  6. package/dist/bundle/chunks/chunk-35AZPBGE.js +11 -0
  7. package/dist/bundle/chunks/{chunk-C47CLQZK.js → chunk-CMZY6PM7.js} +1 -1
  8. package/dist/bundle/chunks/{chunk-XVIZD2L5.js → chunk-DOSAFY5Y.js} +3 -3
  9. package/dist/bundle/chunks/{chunk-KAXC2ESR.js → chunk-GICF34HK.js} +8 -8
  10. package/dist/bundle/chunks/{chunk-GYREDKZT.js → chunk-HKQXO4IQ.js} +1 -1
  11. package/dist/bundle/chunks/chunk-K4O5WZC5.js +11 -0
  12. package/dist/bundle/chunks/{chunk-SVKJCAH2.js → chunk-NBSSK56J.js} +1 -1
  13. package/dist/bundle/chunks/{chunk-XZYVF4BW.js → chunk-RAB4RJZ2.js} +60 -60
  14. package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-NHSAQJW5.js → cloudflare-workers-ai-system-one-6FXZDK6A.js} +1 -1
  15. package/dist/bundle/chunks/{easter-egg-3d-DD22MRM3.js → easter-egg-3d-JQPBRQEU.js} +1 -1
  16. package/dist/bundle/chunks/github-copilot.js +1 -1
  17. package/dist/bundle/chunks/{google-generative-ai-ON7RPJHF.js → google-generative-ai-VJA5IOK3.js} +1 -1
  18. package/dist/bundle/chunks/{google-vertex-6YO5GV2H.js → google-vertex-TI6AJXT2.js} +1 -1
  19. package/dist/bundle/chunks/{mistral-conversations-NN33SMJ6.js → mistral-conversations-XTWEX6FG.js} +1 -1
  20. package/dist/bundle/chunks/openai-codex-responses-WGH4GHLE.js +10 -0
  21. package/dist/bundle/chunks/openai-completions-GXGEEHZH.js +7 -0
  22. package/dist/bundle/chunks/openai-responses-NLSL5UY4.js +3 -0
  23. package/dist/bundle/chunks/{typesafe-system-one-PRR5K6CI.js → typesafe-system-one-3OTHQPDL.js} +1 -1
  24. package/dist/bundle/chunks/{virtual-modules-6MDPJKNE.js → virtual-modules-L22CHFWU.js} +1 -1
  25. package/dist/bundle/cli-runtime.js +1 -1
  26. package/dist/bundle/index.js +1 -1
  27. package/dist/bundle/rpc-entry.js +1 -1
  28. package/docs/compaction.md +2 -2
  29. package/docs/extensions.md +4 -10
  30. package/docs/message-types.md +2 -4
  31. package/docs/session-format.md +4 -4
  32. package/docs/settings.md +1 -1
  33. package/docs/tui.md +1 -1
  34. package/examples/extensions/overlay-test.ts +2 -2
  35. package/package.json +31 -31
  36. package/dist/bun/cli.d.ts +0 -5
  37. package/dist/bun/cli.d.ts.map +0 -1
  38. package/dist/bun/cli.js +0 -5
  39. package/dist/bun/cli.js.map +0 -1
  40. package/dist/bun/restore-sandbox-env.d.ts +0 -17
  41. package/dist/bun/restore-sandbox-env.d.ts.map +0 -1
  42. package/dist/bun/restore-sandbox-env.js +0 -36
  43. package/dist/bun/restore-sandbox-env.js.map +0 -1
  44. package/dist/bun/runtime-setup.d.ts +0 -2
  45. package/dist/bun/runtime-setup.d.ts.map +0 -1
  46. package/dist/bun/runtime-setup.js +0 -9
  47. package/dist/bun/runtime-setup.js.map +0 -1
  48. package/dist/bun/sandbox-env-setup.d.ts +0 -2
  49. package/dist/bun/sandbox-env-setup.d.ts.map +0 -1
  50. package/dist/bun/sandbox-env-setup.js +0 -4
  51. package/dist/bun/sandbox-env-setup.js.map +0 -1
  52. package/dist/bundle/chunks/anthropic-messages-EGJT3PY6.js +0 -6
  53. package/dist/bundle/chunks/azure-openai-responses-JEEXH6HK.js +0 -2
  54. package/dist/bundle/chunks/chunk-IOJUMBW3.js +0 -11
  55. package/dist/bundle/chunks/chunk-KJUDFE6Y.js +0 -11
  56. package/dist/bundle/chunks/openai-codex-responses-CPSVXTKM.js +0 -10
  57. package/dist/bundle/chunks/openai-completions-T7GN33JE.js +0 -7
  58. package/dist/bundle/chunks/openai-responses-GPE3ZQ46.js +0 -3
  59. package/dist/cli/args.d.ts +0 -61
  60. package/dist/cli/args.d.ts.map +0 -1
  61. package/dist/cli/args.js +0 -453
  62. package/dist/cli/args.js.map +0 -1
  63. package/dist/cli/auth-check.d.ts +0 -19
  64. package/dist/cli/auth-check.d.ts.map +0 -1
  65. package/dist/cli/auth-check.js +0 -50
  66. package/dist/cli/auth-check.js.map +0 -1
  67. package/dist/cli/auth-command.d.ts +0 -24
  68. package/dist/cli/auth-command.d.ts.map +0 -1
  69. package/dist/cli/auth-command.js +0 -103
  70. package/dist/cli/auth-command.js.map +0 -1
  71. package/dist/cli/config-selector.d.ts +0 -16
  72. package/dist/cli/config-selector.d.ts.map +0 -1
  73. package/dist/cli/config-selector.js +0 -32
  74. package/dist/cli/config-selector.js.map +0 -1
  75. package/dist/cli/credential-print.d.ts +0 -13
  76. package/dist/cli/credential-print.d.ts.map +0 -1
  77. package/dist/cli/credential-print.js +0 -76
  78. package/dist/cli/credential-print.js.map +0 -1
  79. package/dist/cli/file-processor.d.ts +0 -15
  80. package/dist/cli/file-processor.d.ts.map +0 -1
  81. package/dist/cli/file-processor.js +0 -71
  82. package/dist/cli/file-processor.js.map +0 -1
  83. package/dist/cli/initial-message.d.ts +0 -18
  84. package/dist/cli/initial-message.d.ts.map +0 -1
  85. package/dist/cli/initial-message.js +0 -22
  86. package/dist/cli/initial-message.js.map +0 -1
  87. package/dist/cli/list-models.d.ts +0 -9
  88. package/dist/cli/list-models.d.ts.map +0 -1
  89. package/dist/cli/list-models.js +0 -98
  90. package/dist/cli/list-models.js.map +0 -1
  91. package/dist/cli/project-trust.d.ts +0 -10
  92. package/dist/cli/project-trust.d.ts.map +0 -1
  93. package/dist/cli/project-trust.js +0 -48
  94. package/dist/cli/project-trust.js.map +0 -1
  95. package/dist/cli/session-picker.d.ts +0 -10
  96. package/dist/cli/session-picker.d.ts.map +0 -1
  97. package/dist/cli/session-picker.js +0 -36
  98. package/dist/cli/session-picker.js.map +0 -1
  99. package/dist/cli/setup.d.ts +0 -2
  100. package/dist/cli/setup.d.ts.map +0 -1
  101. package/dist/cli/setup.js +0 -12
  102. package/dist/cli/setup.js.map +0 -1
  103. package/dist/cli/startup-ui.d.ts +0 -20
  104. package/dist/cli/startup-ui.d.ts.map +0 -1
  105. package/dist/cli/startup-ui.js +0 -193
  106. package/dist/cli/startup-ui.js.map +0 -1
  107. package/dist/cli.d.ts +0 -3
  108. package/dist/cli.d.ts.map +0 -1
  109. package/dist/cli.js +0 -6
  110. package/dist/cli.js.map +0 -1
  111. package/dist/config.d.ts +0 -107
  112. package/dist/config.d.ts.map +0 -1
  113. package/dist/config.js +0 -486
  114. package/dist/config.js.map +0 -1
  115. package/dist/core/agent-session-runtime.d.ts +0 -119
  116. package/dist/core/agent-session-runtime.d.ts.map +0 -1
  117. package/dist/core/agent-session-runtime.js +0 -317
  118. package/dist/core/agent-session-runtime.js.map +0 -1
  119. package/dist/core/agent-session-services.d.ts +0 -86
  120. package/dist/core/agent-session-services.d.ts.map +0 -1
  121. package/dist/core/agent-session-services.js +0 -147
  122. package/dist/core/agent-session-services.js.map +0 -1
  123. package/dist/core/agent-session.d.ts +0 -881
  124. package/dist/core/agent-session.d.ts.map +0 -1
  125. package/dist/core/agent-session.js +0 -3524
  126. package/dist/core/agent-session.js.map +0 -1
  127. package/dist/core/auth-guidance.d.ts +0 -5
  128. package/dist/core/auth-guidance.d.ts.map +0 -1
  129. package/dist/core/auth-guidance.js +0 -21
  130. package/dist/core/auth-guidance.js.map +0 -1
  131. package/dist/core/auth-storage.d.ts +0 -72
  132. package/dist/core/auth-storage.d.ts.map +0 -1
  133. package/dist/core/auth-storage.js +0 -426
  134. package/dist/core/auth-storage.js.map +0 -1
  135. package/dist/core/bash-executor.d.ts +0 -32
  136. package/dist/core/bash-executor.d.ts.map +0 -1
  137. package/dist/core/bash-executor.js +0 -106
  138. package/dist/core/bash-executor.js.map +0 -1
  139. package/dist/core/bug-report-upload.d.ts +0 -12
  140. package/dist/core/bug-report-upload.d.ts.map +0 -1
  141. package/dist/core/bug-report-upload.js +0 -22
  142. package/dist/core/bug-report-upload.js.map +0 -1
  143. package/dist/core/bug-report.d.ts +0 -176
  144. package/dist/core/bug-report.d.ts.map +0 -1
  145. package/dist/core/bug-report.js +0 -292
  146. package/dist/core/bug-report.js.map +0 -1
  147. package/dist/core/cache-stats.d.ts +0 -49
  148. package/dist/core/cache-stats.d.ts.map +0 -1
  149. package/dist/core/cache-stats.js +0 -112
  150. package/dist/core/cache-stats.js.map +0 -1
  151. package/dist/core/cache-warmer.d.ts +0 -103
  152. package/dist/core/cache-warmer.d.ts.map +0 -1
  153. package/dist/core/cache-warmer.js +0 -359
  154. package/dist/core/cache-warmer.js.map +0 -1
  155. package/dist/core/compaction/branch-summarization.d.ts +0 -98
  156. package/dist/core/compaction/branch-summarization.d.ts.map +0 -1
  157. package/dist/core/compaction/branch-summarization.js +0 -251
  158. package/dist/core/compaction/branch-summarization.js.map +0 -1
  159. package/dist/core/compaction/compaction.d.ts +0 -145
  160. package/dist/core/compaction/compaction.d.ts.map +0 -1
  161. package/dist/core/compaction/compaction.js +0 -744
  162. package/dist/core/compaction/compaction.js.map +0 -1
  163. package/dist/core/compaction/index.d.ts +0 -7
  164. package/dist/core/compaction/index.d.ts.map +0 -1
  165. package/dist/core/compaction/index.js +0 -7
  166. package/dist/core/compaction/index.js.map +0 -1
  167. package/dist/core/compaction/utils.d.ts +0 -39
  168. package/dist/core/compaction/utils.d.ts.map +0 -1
  169. package/dist/core/compaction/utils.js +0 -149
  170. package/dist/core/compaction/utils.js.map +0 -1
  171. package/dist/core/crash-log.d.ts +0 -27
  172. package/dist/core/crash-log.d.ts.map +0 -1
  173. package/dist/core/crash-log.js +0 -140
  174. package/dist/core/crash-log.js.map +0 -1
  175. package/dist/core/defaults.d.ts +0 -4
  176. package/dist/core/defaults.d.ts.map +0 -1
  177. package/dist/core/defaults.js +0 -11
  178. package/dist/core/defaults.js.map +0 -1
  179. package/dist/core/diagnostics.d.ts +0 -15
  180. package/dist/core/diagnostics.d.ts.map +0 -1
  181. package/dist/core/diagnostics.js +0 -2
  182. package/dist/core/diagnostics.js.map +0 -1
  183. package/dist/core/event-bus.d.ts +0 -9
  184. package/dist/core/event-bus.d.ts.map +0 -1
  185. package/dist/core/event-bus.js +0 -25
  186. package/dist/core/event-bus.js.map +0 -1
  187. package/dist/core/exec.d.ts +0 -29
  188. package/dist/core/exec.d.ts.map +0 -1
  189. package/dist/core/exec.js +0 -75
  190. package/dist/core/exec.js.map +0 -1
  191. package/dist/core/experimental.d.ts +0 -2
  192. package/dist/core/experimental.d.ts.map +0 -1
  193. package/dist/core/experimental.js +0 -6
  194. package/dist/core/experimental.js.map +0 -1
  195. package/dist/core/export-html/ansi-to-html.d.ts +0 -22
  196. package/dist/core/export-html/ansi-to-html.d.ts.map +0 -1
  197. package/dist/core/export-html/ansi-to-html.js +0 -249
  198. package/dist/core/export-html/ansi-to-html.js.map +0 -1
  199. package/dist/core/export-html/index.d.ts +0 -37
  200. package/dist/core/export-html/index.d.ts.map +0 -1
  201. package/dist/core/export-html/index.js +0 -226
  202. package/dist/core/export-html/index.js.map +0 -1
  203. package/dist/core/export-html/tool-renderer.d.ts +0 -34
  204. package/dist/core/export-html/tool-renderer.d.ts.map +0 -1
  205. package/dist/core/export-html/tool-renderer.js +0 -109
  206. package/dist/core/export-html/tool-renderer.js.map +0 -1
  207. package/dist/core/extensions/index.d.ts +0 -12
  208. package/dist/core/extensions/index.d.ts.map +0 -1
  209. package/dist/core/extensions/index.js +0 -9
  210. package/dist/core/extensions/index.js.map +0 -1
  211. package/dist/core/extensions/jiti-loader.d.ts +0 -2
  212. package/dist/core/extensions/jiti-loader.d.ts.map +0 -1
  213. package/dist/core/extensions/jiti-loader.js +0 -4
  214. package/dist/core/extensions/jiti-loader.js.map +0 -1
  215. package/dist/core/extensions/jiti-static-loader.d.ts +0 -2
  216. package/dist/core/extensions/jiti-static-loader.d.ts.map +0 -1
  217. package/dist/core/extensions/jiti-static-loader.js +0 -4
  218. package/dist/core/extensions/jiti-static-loader.js.map +0 -1
  219. package/dist/core/extensions/loader.d.ts +0 -23
  220. package/dist/core/extensions/loader.d.ts.map +0 -1
  221. package/dist/core/extensions/loader.js +0 -667
  222. package/dist/core/extensions/loader.js.map +0 -1
  223. package/dist/core/extensions/runner.d.ts +0 -204
  224. package/dist/core/extensions/runner.d.ts.map +0 -1
  225. package/dist/core/extensions/runner.js +0 -1207
  226. package/dist/core/extensions/runner.js.map +0 -1
  227. package/dist/core/extensions/types.d.ts +0 -1669
  228. package/dist/core/extensions/types.d.ts.map +0 -1
  229. package/dist/core/extensions/types.js +0 -48
  230. package/dist/core/extensions/types.js.map +0 -1
  231. package/dist/core/extensions/virtual-modules.d.ts +0 -3
  232. package/dist/core/extensions/virtual-modules.d.ts.map +0 -1
  233. package/dist/core/extensions/virtual-modules.js +0 -38
  234. package/dist/core/extensions/virtual-modules.js.map +0 -1
  235. package/dist/core/extensions/wrapper.d.ts +0 -20
  236. package/dist/core/extensions/wrapper.d.ts.map +0 -1
  237. package/dist/core/extensions/wrapper.js +0 -22
  238. package/dist/core/extensions/wrapper.js.map +0 -1
  239. package/dist/core/footer-data-provider.d.ts +0 -64
  240. package/dist/core/footer-data-provider.d.ts.map +0 -1
  241. package/dist/core/footer-data-provider.js +0 -338
  242. package/dist/core/footer-data-provider.js.map +0 -1
  243. package/dist/core/http-dispatcher.d.ts +0 -22
  244. package/dist/core/http-dispatcher.d.ts.map +0 -1
  245. package/dist/core/http-dispatcher.js +0 -98
  246. package/dist/core/http-dispatcher.js.map +0 -1
  247. package/dist/core/index.d.ts +0 -14
  248. package/dist/core/index.d.ts.map +0 -1
  249. package/dist/core/index.js +0 -13
  250. package/dist/core/index.js.map +0 -1
  251. package/dist/core/keybindings.d.ts +0 -428
  252. package/dist/core/keybindings.d.ts.map +0 -1
  253. package/dist/core/keybindings.js +0 -321
  254. package/dist/core/keybindings.js.map +0 -1
  255. package/dist/core/messages.d.ts +0 -77
  256. package/dist/core/messages.d.ts.map +0 -1
  257. package/dist/core/messages.js +0 -124
  258. package/dist/core/messages.js.map +0 -1
  259. package/dist/core/model-config.d.ts +0 -760
  260. package/dist/core/model-config.d.ts.map +0 -1
  261. package/dist/core/model-config.js +0 -294
  262. package/dist/core/model-config.js.map +0 -1
  263. package/dist/core/model-registry.d.ts +0 -61
  264. package/dist/core/model-registry.d.ts.map +0 -1
  265. package/dist/core/model-registry.js +0 -140
  266. package/dist/core/model-registry.js.map +0 -1
  267. package/dist/core/model-resolver.d.ts +0 -124
  268. package/dist/core/model-resolver.d.ts.map +0 -1
  269. package/dist/core/model-resolver.js +0 -590
  270. package/dist/core/model-resolver.js.map +0 -1
  271. package/dist/core/model-runtime.d.ts +0 -145
  272. package/dist/core/model-runtime.d.ts.map +0 -1
  273. package/dist/core/model-runtime.js +0 -758
  274. package/dist/core/model-runtime.js.map +0 -1
  275. package/dist/core/models-store.d.ts +0 -22
  276. package/dist/core/models-store.d.ts.map +0 -1
  277. package/dist/core/models-store.js +0 -115
  278. package/dist/core/models-store.js.map +0 -1
  279. package/dist/core/nested-tool-calls.d.ts +0 -102
  280. package/dist/core/nested-tool-calls.d.ts.map +0 -1
  281. package/dist/core/nested-tool-calls.js +0 -178
  282. package/dist/core/nested-tool-calls.js.map +0 -1
  283. package/dist/core/output-guard.d.ts +0 -7
  284. package/dist/core/output-guard.d.ts.map +0 -1
  285. package/dist/core/output-guard.js +0 -89
  286. package/dist/core/output-guard.js.map +0 -1
  287. package/dist/core/package-manager.d.ts +0 -217
  288. package/dist/core/package-manager.d.ts.map +0 -1
  289. package/dist/core/package-manager.js +0 -2224
  290. package/dist/core/package-manager.js.map +0 -1
  291. package/dist/core/pi-manifest.d.ts +0 -8
  292. package/dist/core/pi-manifest.d.ts.map +0 -1
  293. package/dist/core/pi-manifest.js +0 -26
  294. package/dist/core/pi-manifest.js.map +0 -1
  295. package/dist/core/project-trust.d.ts +0 -15
  296. package/dist/core/project-trust.d.ts.map +0 -1
  297. package/dist/core/project-trust.js +0 -59
  298. package/dist/core/project-trust.js.map +0 -1
  299. package/dist/core/prompt-templates.d.ts +0 -59
  300. package/dist/core/prompt-templates.d.ts.map +0 -1
  301. package/dist/core/prompt-templates.js +0 -262
  302. package/dist/core/prompt-templates.js.map +0 -1
  303. package/dist/core/provider-attribution.d.ts +0 -4
  304. package/dist/core/provider-attribution.d.ts.map +0 -1
  305. package/dist/core/provider-attribution.js +0 -72
  306. package/dist/core/provider-attribution.js.map +0 -1
  307. package/dist/core/provider-composer.d.ts +0 -80
  308. package/dist/core/provider-composer.d.ts.map +0 -1
  309. package/dist/core/provider-composer.js +0 -488
  310. package/dist/core/provider-composer.js.map +0 -1
  311. package/dist/core/radius.d.ts +0 -5
  312. package/dist/core/radius.d.ts.map +0 -1
  313. package/dist/core/radius.js +0 -9
  314. package/dist/core/radius.js.map +0 -1
  315. package/dist/core/remote-catalog-provider.d.ts +0 -12
  316. package/dist/core/remote-catalog-provider.d.ts.map +0 -1
  317. package/dist/core/remote-catalog-provider.js +0 -132
  318. package/dist/core/remote-catalog-provider.js.map +0 -1
  319. package/dist/core/resolve-config-value.d.ts +0 -30
  320. package/dist/core/resolve-config-value.d.ts.map +0 -1
  321. package/dist/core/resolve-config-value.js +0 -247
  322. package/dist/core/resolve-config-value.js.map +0 -1
  323. package/dist/core/resource-loader.d.ts +0 -227
  324. package/dist/core/resource-loader.d.ts.map +0 -1
  325. package/dist/core/resource-loader.js +0 -1008
  326. package/dist/core/resource-loader.js.map +0 -1
  327. package/dist/core/runtime-credentials.d.ts +0 -15
  328. package/dist/core/runtime-credentials.d.ts.map +0 -1
  329. package/dist/core/runtime-credentials.js +0 -39
  330. package/dist/core/runtime-credentials.js.map +0 -1
  331. package/dist/core/sdk.d.ts +0 -108
  332. package/dist/core/sdk.d.ts.map +0 -1
  333. package/dist/core/sdk.js +0 -315
  334. package/dist/core/sdk.js.map +0 -1
  335. package/dist/core/session-cwd.d.ts +0 -19
  336. package/dist/core/session-cwd.d.ts.map +0 -1
  337. package/dist/core/session-cwd.js +0 -38
  338. package/dist/core/session-cwd.js.map +0 -1
  339. package/dist/core/session-export.d.ts +0 -8
  340. package/dist/core/session-export.d.ts.map +0 -1
  341. package/dist/core/session-export.js +0 -33
  342. package/dist/core/session-export.js.map +0 -1
  343. package/dist/core/session-manager.d.ts +0 -416
  344. package/dist/core/session-manager.d.ts.map +0 -1
  345. package/dist/core/session-manager.js +0 -1523
  346. package/dist/core/session-manager.js.map +0 -1
  347. package/dist/core/settings-diagnostics.d.ts +0 -9
  348. package/dist/core/settings-diagnostics.d.ts.map +0 -1
  349. package/dist/core/settings-diagnostics.js +0 -21
  350. package/dist/core/settings-diagnostics.js.map +0 -1
  351. package/dist/core/settings-manager.d.ts +0 -362
  352. package/dist/core/settings-manager.d.ts.map +0 -1
  353. package/dist/core/settings-manager.js +0 -1107
  354. package/dist/core/settings-manager.js.map +0 -1
  355. package/dist/core/skills.d.ts +0 -60
  356. package/dist/core/skills.d.ts.map +0 -1
  357. package/dist/core/skills.js +0 -407
  358. package/dist/core/skills.js.map +0 -1
  359. package/dist/core/slash-commands.d.ts +0 -15
  360. package/dist/core/slash-commands.d.ts.map +0 -1
  361. package/dist/core/slash-commands.js +0 -28
  362. package/dist/core/slash-commands.js.map +0 -1
  363. package/dist/core/source-info.d.ts +0 -26
  364. package/dist/core/source-info.d.ts.map +0 -1
  365. package/dist/core/source-info.js +0 -35
  366. package/dist/core/source-info.js.map +0 -1
  367. package/dist/core/system-prompt.d.ts +0 -71
  368. package/dist/core/system-prompt.d.ts.map +0 -1
  369. package/dist/core/system-prompt.js +0 -147
  370. package/dist/core/system-prompt.js.map +0 -1
  371. package/dist/core/telemetry.d.ts +0 -3
  372. package/dist/core/telemetry.d.ts.map +0 -1
  373. package/dist/core/telemetry.js +0 -10
  374. package/dist/core/telemetry.js.map +0 -1
  375. package/dist/core/timings.d.ts +0 -6
  376. package/dist/core/timings.d.ts.map +0 -1
  377. package/dist/core/timings.js +0 -42
  378. package/dist/core/timings.js.map +0 -1
  379. package/dist/core/tools/bash.d.ts +0 -101
  380. package/dist/core/tools/bash.d.ts.map +0 -1
  381. package/dist/core/tools/bash.js +0 -348
  382. package/dist/core/tools/bash.js.map +0 -1
  383. package/dist/core/tools/edit-diff.d.ts +0 -101
  384. package/dist/core/tools/edit-diff.d.ts.map +0 -1
  385. package/dist/core/tools/edit-diff.js +0 -421
  386. package/dist/core/tools/edit-diff.js.map +0 -1
  387. package/dist/core/tools/edit.d.ts +0 -44
  388. package/dist/core/tools/edit.d.ts.map +0 -1
  389. package/dist/core/tools/edit.js +0 -147
  390. package/dist/core/tools/edit.js.map +0 -1
  391. package/dist/core/tools/file-mutation-queue.d.ts +0 -6
  392. package/dist/core/tools/file-mutation-queue.d.ts.map +0 -1
  393. package/dist/core/tools/file-mutation-queue.js +0 -52
  394. package/dist/core/tools/file-mutation-queue.js.map +0 -1
  395. package/dist/core/tools/find.d.ts +0 -42
  396. package/dist/core/tools/find.d.ts.map +0 -1
  397. package/dist/core/tools/find.js +0 -251
  398. package/dist/core/tools/find.js.map +0 -1
  399. package/dist/core/tools/grep.d.ts +0 -41
  400. package/dist/core/tools/grep.d.ts.map +0 -1
  401. package/dist/core/tools/grep.js +0 -252
  402. package/dist/core/tools/grep.js.map +0 -1
  403. package/dist/core/tools/index.d.ts +0 -43
  404. package/dist/core/tools/index.d.ts.map +0 -1
  405. package/dist/core/tools/index.js +0 -129
  406. package/dist/core/tools/index.js.map +0 -1
  407. package/dist/core/tools/ls.d.ts +0 -41
  408. package/dist/core/tools/ls.d.ts.map +0 -1
  409. package/dist/core/tools/ls.js +0 -126
  410. package/dist/core/tools/ls.js.map +0 -1
  411. package/dist/core/tools/output-accumulator.d.ts +0 -63
  412. package/dist/core/tools/output-accumulator.d.ts.map +0 -1
  413. package/dist/core/tools/output-accumulator.js +0 -220
  414. package/dist/core/tools/output-accumulator.js.map +0 -1
  415. package/dist/core/tools/path-utils.d.ts +0 -10
  416. package/dist/core/tools/path-utils.d.ts.map +0 -1
  417. package/dist/core/tools/path-utils.js +0 -99
  418. package/dist/core/tools/path-utils.js.map +0 -1
  419. package/dist/core/tools/powershell.d.ts +0 -16
  420. package/dist/core/tools/powershell.d.ts.map +0 -1
  421. package/dist/core/tools/powershell.js +0 -39
  422. package/dist/core/tools/powershell.js.map +0 -1
  423. package/dist/core/tools/read.d.ts +0 -42
  424. package/dist/core/tools/read.d.ts.map +0 -1
  425. package/dist/core/tools/read.js +0 -169
  426. package/dist/core/tools/read.js.map +0 -1
  427. package/dist/core/tools/render-utils.d.ts +0 -30
  428. package/dist/core/tools/render-utils.d.ts.map +0 -1
  429. package/dist/core/tools/render-utils.js +0 -91
  430. package/dist/core/tools/render-utils.js.map +0 -1
  431. package/dist/core/tools/renderers/bash.d.ts +0 -12
  432. package/dist/core/tools/renderers/bash.d.ts.map +0 -1
  433. package/dist/core/tools/renderers/bash.js +0 -117
  434. package/dist/core/tools/renderers/bash.js.map +0 -1
  435. package/dist/core/tools/renderers/edit.d.ts +0 -23
  436. package/dist/core/tools/renderers/edit.d.ts.map +0 -1
  437. package/dist/core/tools/renderers/edit.js +0 -168
  438. package/dist/core/tools/renderers/edit.js.map +0 -1
  439. package/dist/core/tools/renderers/find.d.ts +0 -10
  440. package/dist/core/tools/renderers/find.d.ts.map +0 -1
  441. package/dist/core/tools/renderers/find.js +0 -64
  442. package/dist/core/tools/renderers/find.js.map +0 -1
  443. package/dist/core/tools/renderers/grep.d.ts +0 -10
  444. package/dist/core/tools/renderers/grep.d.ts.map +0 -1
  445. package/dist/core/tools/renderers/grep.js +0 -69
  446. package/dist/core/tools/renderers/grep.js.map +0 -1
  447. package/dist/core/tools/renderers/index.d.ts +0 -28
  448. package/dist/core/tools/renderers/index.d.ts.map +0 -1
  449. package/dist/core/tools/renderers/index.js +0 -47
  450. package/dist/core/tools/renderers/index.js.map +0 -1
  451. package/dist/core/tools/renderers/ls.d.ts +0 -10
  452. package/dist/core/tools/renderers/ls.d.ts.map +0 -1
  453. package/dist/core/tools/renderers/ls.js +0 -58
  454. package/dist/core/tools/renderers/ls.js.map +0 -1
  455. package/dist/core/tools/renderers/read.d.ts +0 -11
  456. package/dist/core/tools/renderers/read.d.ts.map +0 -1
  457. package/dist/core/tools/renderers/read.js +0 -130
  458. package/dist/core/tools/renderers/read.js.map +0 -1
  459. package/dist/core/tools/renderers/write.d.ts +0 -10
  460. package/dist/core/tools/renderers/write.d.ts.map +0 -1
  461. package/dist/core/tools/renderers/write.js +0 -153
  462. package/dist/core/tools/renderers/write.js.map +0 -1
  463. package/dist/core/tools/tool-definition-wrapper.d.ts +0 -16
  464. package/dist/core/tools/tool-definition-wrapper.d.ts.map +0 -1
  465. package/dist/core/tools/tool-definition-wrapper.js +0 -38
  466. package/dist/core/tools/tool-definition-wrapper.js.map +0 -1
  467. package/dist/core/tools/truncate.d.ts +0 -84
  468. package/dist/core/tools/truncate.d.ts.map +0 -1
  469. package/dist/core/tools/truncate.js +0 -244
  470. package/dist/core/tools/truncate.js.map +0 -1
  471. package/dist/core/tools/write.d.ts +0 -30
  472. package/dist/core/tools/write.d.ts.map +0 -1
  473. package/dist/core/tools/write.js +0 -61
  474. package/dist/core/tools/write.js.map +0 -1
  475. package/dist/core/trust-manager.d.ts +0 -36
  476. package/dist/core/trust-manager.d.ts.map +0 -1
  477. package/dist/core/trust-manager.js +0 -203
  478. package/dist/core/trust-manager.js.map +0 -1
  479. package/dist/core/usage-totals.d.ts +0 -21
  480. package/dist/core/usage-totals.d.ts.map +0 -1
  481. package/dist/core/usage-totals.js +0 -79
  482. package/dist/core/usage-totals.js.map +0 -1
  483. package/dist/core/virtual-models.d.ts +0 -117
  484. package/dist/core/virtual-models.d.ts.map +0 -1
  485. package/dist/core/virtual-models.js +0 -124
  486. package/dist/core/virtual-models.js.map +0 -1
  487. package/dist/extensions/index.d.ts +0 -3
  488. package/dist/extensions/index.d.ts.map +0 -1
  489. package/dist/extensions/index.js +0 -3
  490. package/dist/extensions/index.js.map +0 -1
  491. package/dist/extensions/llama/client.d.ts +0 -69
  492. package/dist/extensions/llama/client.d.ts.map +0 -1
  493. package/dist/extensions/llama/client.js +0 -313
  494. package/dist/extensions/llama/client.js.map +0 -1
  495. package/dist/extensions/llama/huggingface.d.ts +0 -23
  496. package/dist/extensions/llama/huggingface.d.ts.map +0 -1
  497. package/dist/extensions/llama/huggingface.js +0 -141
  498. package/dist/extensions/llama/huggingface.js.map +0 -1
  499. package/dist/extensions/llama/index.d.ts +0 -3
  500. package/dist/extensions/llama/index.d.ts.map +0 -1
  501. package/dist/extensions/llama/index.js +0 -219
  502. package/dist/extensions/llama/index.js.map +0 -1
  503. package/dist/extensions/llama/provider.d.ts +0 -12
  504. package/dist/extensions/llama/provider.d.ts.map +0 -1
  505. package/dist/extensions/llama/provider.js +0 -213
  506. package/dist/extensions/llama/provider.js.map +0 -1
  507. package/dist/extensions/llama/ui.d.ts +0 -42
  508. package/dist/extensions/llama/ui.d.ts.map +0 -1
  509. package/dist/extensions/llama/ui.js +0 -416
  510. package/dist/extensions/llama/ui.js.map +0 -1
  511. package/dist/index.d.ts +0 -38
  512. package/dist/index.d.ts.map +0 -1
  513. package/dist/index.js +0 -49
  514. package/dist/index.js.map +0 -1
  515. package/dist/main.d.ts +0 -16
  516. package/dist/main.d.ts.map +0 -1
  517. package/dist/main.js +0 -819
  518. package/dist/main.js.map +0 -1
  519. package/dist/migrations.d.ts +0 -33
  520. package/dist/migrations.d.ts.map +0 -1
  521. package/dist/migrations.js +0 -282
  522. package/dist/migrations.js.map +0 -1
  523. package/dist/modes/index.d.ts +0 -10
  524. package/dist/modes/index.d.ts.map +0 -1
  525. package/dist/modes/index.js +0 -8
  526. package/dist/modes/index.js.map +0 -1
  527. package/dist/modes/interactive/bug-report.d.ts +0 -16
  528. package/dist/modes/interactive/bug-report.d.ts.map +0 -1
  529. package/dist/modes/interactive/bug-report.js +0 -210
  530. package/dist/modes/interactive/bug-report.js.map +0 -1
  531. package/dist/modes/interactive/chat-viewport.d.ts +0 -20
  532. package/dist/modes/interactive/chat-viewport.d.ts.map +0 -1
  533. package/dist/modes/interactive/chat-viewport.js +0 -28
  534. package/dist/modes/interactive/chat-viewport.js.map +0 -1
  535. package/dist/modes/interactive/components/armin.d.ts +0 -37
  536. package/dist/modes/interactive/components/armin.d.ts.map +0 -1
  537. package/dist/modes/interactive/components/armin.js +0 -335
  538. package/dist/modes/interactive/components/armin.js.map +0 -1
  539. package/dist/modes/interactive/components/assistant-message.d.ts +0 -26
  540. package/dist/modes/interactive/components/assistant-message.d.ts.map +0 -1
  541. package/dist/modes/interactive/components/assistant-message.js +0 -158
  542. package/dist/modes/interactive/components/assistant-message.js.map +0 -1
  543. package/dist/modes/interactive/components/bash-execution.d.ts +0 -38
  544. package/dist/modes/interactive/components/bash-execution.d.ts.map +0 -1
  545. package/dist/modes/interactive/components/bash-execution.js +0 -178
  546. package/dist/modes/interactive/components/bash-execution.js.map +0 -1
  547. package/dist/modes/interactive/components/bordered-loader.d.ts +0 -16
  548. package/dist/modes/interactive/components/bordered-loader.d.ts.map +0 -1
  549. package/dist/modes/interactive/components/bordered-loader.js +0 -54
  550. package/dist/modes/interactive/components/bordered-loader.js.map +0 -1
  551. package/dist/modes/interactive/components/branch-summary-message.d.ts +0 -17
  552. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +0 -1
  553. package/dist/modes/interactive/components/branch-summary-message.js +0 -54
  554. package/dist/modes/interactive/components/branch-summary-message.js.map +0 -1
  555. package/dist/modes/interactive/components/compaction-summary-message.d.ts +0 -17
  556. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +0 -1
  557. package/dist/modes/interactive/components/compaction-summary-message.js +0 -55
  558. package/dist/modes/interactive/components/compaction-summary-message.js.map +0 -1
  559. package/dist/modes/interactive/components/config-selector.d.ts +0 -102
  560. package/dist/modes/interactive/components/config-selector.d.ts.map +0 -1
  561. package/dist/modes/interactive/components/config-selector.js +0 -771
  562. package/dist/modes/interactive/components/config-selector.js.map +0 -1
  563. package/dist/modes/interactive/components/countdown-timer.d.ts +0 -14
  564. package/dist/modes/interactive/components/countdown-timer.d.ts.map +0 -1
  565. package/dist/modes/interactive/components/countdown-timer.js +0 -33
  566. package/dist/modes/interactive/components/countdown-timer.js.map +0 -1
  567. package/dist/modes/interactive/components/custom-editor.d.ts +0 -30
  568. package/dist/modes/interactive/components/custom-editor.d.ts.map +0 -1
  569. package/dist/modes/interactive/components/custom-editor.js +0 -115
  570. package/dist/modes/interactive/components/custom-editor.js.map +0 -1
  571. package/dist/modes/interactive/components/custom-entry.d.ts +0 -21
  572. package/dist/modes/interactive/components/custom-entry.d.ts.map +0 -1
  573. package/dist/modes/interactive/components/custom-entry.js +0 -58
  574. package/dist/modes/interactive/components/custom-entry.js.map +0 -1
  575. package/dist/modes/interactive/components/custom-message.d.ts +0 -22
  576. package/dist/modes/interactive/components/custom-message.d.ts.map +0 -1
  577. package/dist/modes/interactive/components/custom-message.js +0 -88
  578. package/dist/modes/interactive/components/custom-message.js.map +0 -1
  579. package/dist/modes/interactive/components/diff.d.ts +0 -12
  580. package/dist/modes/interactive/components/diff.d.ts.map +0 -1
  581. package/dist/modes/interactive/components/diff.js +0 -133
  582. package/dist/modes/interactive/components/diff.js.map +0 -1
  583. package/dist/modes/interactive/components/dynamic-border.d.ts +0 -15
  584. package/dist/modes/interactive/components/dynamic-border.d.ts.map +0 -1
  585. package/dist/modes/interactive/components/dynamic-border.js +0 -21
  586. package/dist/modes/interactive/components/dynamic-border.js.map +0 -1
  587. package/dist/modes/interactive/components/e-logo.d.ts +0 -16
  588. package/dist/modes/interactive/components/e-logo.d.ts.map +0 -1
  589. package/dist/modes/interactive/components/e-logo.js +0 -29
  590. package/dist/modes/interactive/components/e-logo.js.map +0 -1
  591. package/dist/modes/interactive/components/earendil-announcement.d.ts +0 -5
  592. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +0 -1
  593. package/dist/modes/interactive/components/earendil-announcement.js +0 -40
  594. package/dist/modes/interactive/components/earendil-announcement.js.map +0 -1
  595. package/dist/modes/interactive/components/easter-egg-3d.d.ts +0 -104
  596. package/dist/modes/interactive/components/easter-egg-3d.d.ts.map +0 -1
  597. package/dist/modes/interactive/components/easter-egg-3d.js +0 -1138
  598. package/dist/modes/interactive/components/easter-egg-3d.js.map +0 -1
  599. package/dist/modes/interactive/components/easter-egg-3d.lazy.d.ts +0 -6
  600. package/dist/modes/interactive/components/easter-egg-3d.lazy.d.ts.map +0 -1
  601. package/dist/modes/interactive/components/easter-egg-3d.lazy.js +0 -23
  602. package/dist/modes/interactive/components/easter-egg-3d.lazy.js.map +0 -1
  603. package/dist/modes/interactive/components/extension-editor.d.ts +0 -24
  604. package/dist/modes/interactive/components/extension-editor.d.ts.map +0 -1
  605. package/dist/modes/interactive/components/extension-editor.js +0 -103
  606. package/dist/modes/interactive/components/extension-editor.js.map +0 -1
  607. package/dist/modes/interactive/components/extension-input.d.ts +0 -25
  608. package/dist/modes/interactive/components/extension-input.d.ts.map +0 -1
  609. package/dist/modes/interactive/components/extension-input.js +0 -67
  610. package/dist/modes/interactive/components/extension-input.js.map +0 -1
  611. package/dist/modes/interactive/components/extension-selector.d.ts +0 -27
  612. package/dist/modes/interactive/components/extension-selector.d.ts.map +0 -1
  613. package/dist/modes/interactive/components/extension-selector.js +0 -87
  614. package/dist/modes/interactive/components/extension-selector.js.map +0 -1
  615. package/dist/modes/interactive/components/first-time-setup.d.ts +0 -25
  616. package/dist/modes/interactive/components/first-time-setup.d.ts.map +0 -1
  617. package/dist/modes/interactive/components/first-time-setup.js +0 -109
  618. package/dist/modes/interactive/components/first-time-setup.js.map +0 -1
  619. package/dist/modes/interactive/components/footer.d.ts +0 -39
  620. package/dist/modes/interactive/components/footer.d.ts.map +0 -1
  621. package/dist/modes/interactive/components/footer.js +0 -265
  622. package/dist/modes/interactive/components/footer.js.map +0 -1
  623. package/dist/modes/interactive/components/index.d.ts +0 -33
  624. package/dist/modes/interactive/components/index.d.ts.map +0 -1
  625. package/dist/modes/interactive/components/index.js +0 -34
  626. package/dist/modes/interactive/components/index.js.map +0 -1
  627. package/dist/modes/interactive/components/keybinding-hints.d.ts +0 -13
  628. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +0 -1
  629. package/dist/modes/interactive/components/keybinding-hints.js +0 -36
  630. package/dist/modes/interactive/components/keybinding-hints.js.map +0 -1
  631. package/dist/modes/interactive/components/login-dialog.d.ts +0 -52
  632. package/dist/modes/interactive/components/login-dialog.d.ts.map +0 -1
  633. package/dist/modes/interactive/components/login-dialog.js +0 -188
  634. package/dist/modes/interactive/components/login-dialog.js.map +0 -1
  635. package/dist/modes/interactive/components/markdown-transform.d.ts +0 -3
  636. package/dist/modes/interactive/components/markdown-transform.d.ts.map +0 -1
  637. package/dist/modes/interactive/components/markdown-transform.js +0 -19
  638. package/dist/modes/interactive/components/markdown-transform.js.map +0 -1
  639. package/dist/modes/interactive/components/mermaid.d.ts +0 -11
  640. package/dist/modes/interactive/components/mermaid.d.ts.map +0 -1
  641. package/dist/modes/interactive/components/mermaid.js +0 -75
  642. package/dist/modes/interactive/components/mermaid.js.map +0 -1
  643. package/dist/modes/interactive/components/model-selector.d.ts +0 -60
  644. package/dist/modes/interactive/components/model-selector.d.ts.map +0 -1
  645. package/dist/modes/interactive/components/model-selector.js +0 -361
  646. package/dist/modes/interactive/components/model-selector.js.map +0 -1
  647. package/dist/modes/interactive/components/oauth-selector.d.ts +0 -33
  648. package/dist/modes/interactive/components/oauth-selector.d.ts.map +0 -1
  649. package/dist/modes/interactive/components/oauth-selector.js +0 -163
  650. package/dist/modes/interactive/components/oauth-selector.js.map +0 -1
  651. package/dist/modes/interactive/components/scoped-models-selector.d.ts +0 -46
  652. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +0 -1
  653. package/dist/modes/interactive/components/scoped-models-selector.js +0 -326
  654. package/dist/modes/interactive/components/scoped-models-selector.js.map +0 -1
  655. package/dist/modes/interactive/components/session-selector-search.d.ts +0 -23
  656. package/dist/modes/interactive/components/session-selector-search.d.ts.map +0 -1
  657. package/dist/modes/interactive/components/session-selector-search.js +0 -155
  658. package/dist/modes/interactive/components/session-selector-search.js.map +0 -1
  659. package/dist/modes/interactive/components/session-selector.d.ts +0 -95
  660. package/dist/modes/interactive/components/session-selector.d.ts.map +0 -1
  661. package/dist/modes/interactive/components/session-selector.js +0 -893
  662. package/dist/modes/interactive/components/session-selector.js.map +0 -1
  663. package/dist/modes/interactive/components/settings-selector.d.ts +0 -96
  664. package/dist/modes/interactive/components/settings-selector.d.ts.map +0 -1
  665. package/dist/modes/interactive/components/settings-selector.js +0 -742
  666. package/dist/modes/interactive/components/settings-selector.js.map +0 -1
  667. package/dist/modes/interactive/components/settings-submenu.d.ts +0 -72
  668. package/dist/modes/interactive/components/settings-submenu.d.ts.map +0 -1
  669. package/dist/modes/interactive/components/settings-submenu.js +0 -165
  670. package/dist/modes/interactive/components/settings-submenu.js.map +0 -1
  671. package/dist/modes/interactive/components/show-images-selector.d.ts +0 -10
  672. package/dist/modes/interactive/components/show-images-selector.d.ts.map +0 -1
  673. package/dist/modes/interactive/components/show-images-selector.js +0 -39
  674. package/dist/modes/interactive/components/show-images-selector.js.map +0 -1
  675. package/dist/modes/interactive/components/skill-invocation-message.d.ts +0 -18
  676. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +0 -1
  677. package/dist/modes/interactive/components/skill-invocation-message.js +0 -57
  678. package/dist/modes/interactive/components/skill-invocation-message.js.map +0 -1
  679. package/dist/modes/interactive/components/status-indicator.d.ts +0 -30
  680. package/dist/modes/interactive/components/status-indicator.d.ts.map +0 -1
  681. package/dist/modes/interactive/components/status-indicator.js +0 -67
  682. package/dist/modes/interactive/components/status-indicator.js.map +0 -1
  683. package/dist/modes/interactive/components/theme-selector.d.ts +0 -11
  684. package/dist/modes/interactive/components/theme-selector.d.ts.map +0 -1
  685. package/dist/modes/interactive/components/theme-selector.js +0 -50
  686. package/dist/modes/interactive/components/theme-selector.js.map +0 -1
  687. package/dist/modes/interactive/components/themed-text.d.ts +0 -17
  688. package/dist/modes/interactive/components/themed-text.d.ts.map +0 -1
  689. package/dist/modes/interactive/components/themed-text.js +0 -29
  690. package/dist/modes/interactive/components/themed-text.js.map +0 -1
  691. package/dist/modes/interactive/components/thinking-selector.d.ts +0 -23
  692. package/dist/modes/interactive/components/thinking-selector.d.ts.map +0 -1
  693. package/dist/modes/interactive/components/thinking-selector.js +0 -109
  694. package/dist/modes/interactive/components/thinking-selector.js.map +0 -1
  695. package/dist/modes/interactive/components/tool-execution.d.ts +0 -83
  696. package/dist/modes/interactive/components/tool-execution.d.ts.map +0 -1
  697. package/dist/modes/interactive/components/tool-execution.js +0 -323
  698. package/dist/modes/interactive/components/tool-execution.js.map +0 -1
  699. package/dist/modes/interactive/components/tree-selector.d.ts +0 -94
  700. package/dist/modes/interactive/components/tree-selector.d.ts.map +0 -1
  701. package/dist/modes/interactive/components/tree-selector.js +0 -1254
  702. package/dist/modes/interactive/components/tree-selector.js.map +0 -1
  703. package/dist/modes/interactive/components/trust-selector.d.ts +0 -23
  704. package/dist/modes/interactive/components/trust-selector.d.ts.map +0 -1
  705. package/dist/modes/interactive/components/trust-selector.js +0 -91
  706. package/dist/modes/interactive/components/trust-selector.js.map +0 -1
  707. package/dist/modes/interactive/components/user-message-selector.d.ts +0 -30
  708. package/dist/modes/interactive/components/user-message-selector.d.ts.map +0 -1
  709. package/dist/modes/interactive/components/user-message-selector.js +0 -114
  710. package/dist/modes/interactive/components/user-message-selector.js.map +0 -1
  711. package/dist/modes/interactive/components/user-message.d.ts +0 -16
  712. package/dist/modes/interactive/components/user-message.d.ts.map +0 -1
  713. package/dist/modes/interactive/components/user-message.js +0 -50
  714. package/dist/modes/interactive/components/user-message.js.map +0 -1
  715. package/dist/modes/interactive/components/visual-truncate.d.ts +0 -48
  716. package/dist/modes/interactive/components/visual-truncate.d.ts.map +0 -1
  717. package/dist/modes/interactive/components/visual-truncate.js +0 -66
  718. package/dist/modes/interactive/components/visual-truncate.js.map +0 -1
  719. package/dist/modes/interactive/external-editor.d.ts +0 -12
  720. package/dist/modes/interactive/external-editor.d.ts.map +0 -1
  721. package/dist/modes/interactive/external-editor.js +0 -38
  722. package/dist/modes/interactive/external-editor.js.map +0 -1
  723. package/dist/modes/interactive/interactive-mode.d.ts +0 -470
  724. package/dist/modes/interactive/interactive-mode.d.ts.map +0 -1
  725. package/dist/modes/interactive/interactive-mode.js +0 -5795
  726. package/dist/modes/interactive/interactive-mode.js.map +0 -1
  727. package/dist/modes/interactive/model-catalog-refresh.d.ts +0 -7
  728. package/dist/modes/interactive/model-catalog-refresh.d.ts.map +0 -1
  729. package/dist/modes/interactive/model-catalog-refresh.js +0 -34
  730. package/dist/modes/interactive/model-catalog-refresh.js.map +0 -1
  731. package/dist/modes/interactive/model-search.d.ts +0 -12
  732. package/dist/modes/interactive/model-search.d.ts.map +0 -1
  733. package/dist/modes/interactive/model-search.js +0 -15
  734. package/dist/modes/interactive/model-search.js.map +0 -1
  735. package/dist/modes/interactive/session-share.d.ts +0 -18
  736. package/dist/modes/interactive/session-share.d.ts.map +0 -1
  737. package/dist/modes/interactive/session-share.js +0 -188
  738. package/dist/modes/interactive/session-share.js.map +0 -1
  739. package/dist/modes/interactive/theme/system-theme.d.ts +0 -55
  740. package/dist/modes/interactive/theme/system-theme.d.ts.map +0 -1
  741. package/dist/modes/interactive/theme/system-theme.js +0 -546
  742. package/dist/modes/interactive/theme/system-theme.js.map +0 -1
  743. package/dist/modes/interactive/theme/theme-controller.d.ts +0 -81
  744. package/dist/modes/interactive/theme/theme-controller.d.ts.map +0 -1
  745. package/dist/modes/interactive/theme/theme-controller.js +0 -210
  746. package/dist/modes/interactive/theme/theme-controller.js.map +0 -1
  747. package/dist/modes/interactive/theme/theme-json.d.ts +0 -85
  748. package/dist/modes/interactive/theme/theme-json.d.ts.map +0 -1
  749. package/dist/modes/interactive/theme/theme-json.js +0 -132
  750. package/dist/modes/interactive/theme/theme-json.js.map +0 -1
  751. package/dist/modes/interactive/theme/theme.d.ts +0 -158
  752. package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
  753. package/dist/modes/interactive/theme/theme.js +0 -913
  754. package/dist/modes/interactive/theme/theme.js.map +0 -1
  755. package/dist/modes/interactive/tui-renderer.d.ts +0 -22
  756. package/dist/modes/interactive/tui-renderer.d.ts.map +0 -1
  757. package/dist/modes/interactive/tui-renderer.js +0 -67
  758. package/dist/modes/interactive/tui-renderer.js.map +0 -1
  759. package/dist/modes/json-event.d.ts +0 -34
  760. package/dist/modes/json-event.d.ts.map +0 -1
  761. package/dist/modes/json-event.js +0 -29
  762. package/dist/modes/json-event.js.map +0 -1
  763. package/dist/modes/print-mode.d.ts +0 -28
  764. package/dist/modes/print-mode.d.ts.map +0 -1
  765. package/dist/modes/print-mode.js +0 -142
  766. package/dist/modes/print-mode.js.map +0 -1
  767. package/dist/modes/rpc/jsonl.d.ts +0 -17
  768. package/dist/modes/rpc/jsonl.d.ts.map +0 -1
  769. package/dist/modes/rpc/jsonl.js +0 -49
  770. package/dist/modes/rpc/jsonl.js.map +0 -1
  771. package/dist/modes/rpc/rpc-client.d.ts +0 -254
  772. package/dist/modes/rpc/rpc-client.d.ts.map +0 -1
  773. package/dist/modes/rpc/rpc-client.js +0 -499
  774. package/dist/modes/rpc/rpc-client.js.map +0 -1
  775. package/dist/modes/rpc/rpc-mode.d.ts +0 -20
  776. package/dist/modes/rpc/rpc-mode.d.ts.map +0 -1
  777. package/dist/modes/rpc/rpc-mode.js +0 -655
  778. package/dist/modes/rpc/rpc-mode.js.map +0 -1
  779. package/dist/modes/rpc/rpc-types.d.ts +0 -478
  780. package/dist/modes/rpc/rpc-types.d.ts.map +0 -1
  781. package/dist/modes/rpc/rpc-types.js +0 -8
  782. package/dist/modes/rpc/rpc-types.js.map +0 -1
  783. package/dist/package-manager-cli.d.ts +0 -9
  784. package/dist/package-manager-cli.d.ts.map +0 -1
  785. package/dist/package-manager-cli.js +0 -1000
  786. package/dist/package-manager-cli.js.map +0 -1
  787. package/dist/rpc-entry.d.ts +0 -3
  788. package/dist/rpc-entry.d.ts.map +0 -1
  789. package/dist/rpc-entry.js +0 -11
  790. package/dist/rpc-entry.js.map +0 -1
  791. package/dist/utils/abort.d.ts +0 -5
  792. package/dist/utils/abort.d.ts.map +0 -1
  793. package/dist/utils/abort.js +0 -48
  794. package/dist/utils/abort.js.map +0 -1
  795. package/dist/utils/ansi.d.ts +0 -10
  796. package/dist/utils/ansi.d.ts.map +0 -1
  797. package/dist/utils/ansi.js +0 -71
  798. package/dist/utils/ansi.js.map +0 -1
  799. package/dist/utils/changelog.d.ts +0 -22
  800. package/dist/utils/changelog.d.ts.map +0 -1
  801. package/dist/utils/changelog.js +0 -165
  802. package/dist/utils/changelog.js.map +0 -1
  803. package/dist/utils/child-process.d.ts +0 -18
  804. package/dist/utils/child-process.d.ts.map +0 -1
  805. package/dist/utils/child-process.js +0 -106
  806. package/dist/utils/child-process.js.map +0 -1
  807. package/dist/utils/clipboard-command.d.ts +0 -7
  808. package/dist/utils/clipboard-command.d.ts.map +0 -1
  809. package/dist/utils/clipboard-command.js +0 -45
  810. package/dist/utils/clipboard-command.js.map +0 -1
  811. package/dist/utils/clipboard-image.d.ts +0 -11
  812. package/dist/utils/clipboard-image.d.ts.map +0 -1
  813. package/dist/utils/clipboard-image.js +0 -214
  814. package/dist/utils/clipboard-image.js.map +0 -1
  815. package/dist/utils/clipboard.d.ts +0 -6
  816. package/dist/utils/clipboard.d.ts.map +0 -1
  817. package/dist/utils/clipboard.js +0 -157
  818. package/dist/utils/clipboard.js.map +0 -1
  819. package/dist/utils/deprecation.d.ts +0 -4
  820. package/dist/utils/deprecation.d.ts.map +0 -1
  821. package/dist/utils/deprecation.js +0 -13
  822. package/dist/utils/deprecation.js.map +0 -1
  823. package/dist/utils/exif-orientation.d.ts +0 -5
  824. package/dist/utils/exif-orientation.d.ts.map +0 -1
  825. package/dist/utils/exif-orientation.js +0 -157
  826. package/dist/utils/exif-orientation.js.map +0 -1
  827. package/dist/utils/frontmatter.d.ts +0 -8
  828. package/dist/utils/frontmatter.d.ts.map +0 -1
  829. package/dist/utils/frontmatter.js +0 -27
  830. package/dist/utils/frontmatter.js.map +0 -1
  831. package/dist/utils/fs-watch.d.ts +0 -5
  832. package/dist/utils/fs-watch.d.ts.map +0 -1
  833. package/dist/utils/fs-watch.js +0 -25
  834. package/dist/utils/fs-watch.js.map +0 -1
  835. package/dist/utils/git.d.ts +0 -26
  836. package/dist/utils/git.d.ts.map +0 -1
  837. package/dist/utils/git.js +0 -195
  838. package/dist/utils/git.js.map +0 -1
  839. package/dist/utils/html.d.ts +0 -7
  840. package/dist/utils/html.d.ts.map +0 -1
  841. package/dist/utils/html.js +0 -40
  842. package/dist/utils/html.js.map +0 -1
  843. package/dist/utils/image-convert.d.ts +0 -22
  844. package/dist/utils/image-convert.d.ts.map +0 -1
  845. package/dist/utils/image-convert.js +0 -84
  846. package/dist/utils/image-convert.js.map +0 -1
  847. package/dist/utils/image-process.d.ts +0 -18
  848. package/dist/utils/image-process.d.ts.map +0 -1
  849. package/dist/utils/image-process.js +0 -83
  850. package/dist/utils/image-process.js.map +0 -1
  851. package/dist/utils/image-resize-core.d.ts +0 -42
  852. package/dist/utils/image-resize-core.d.ts.map +0 -1
  853. package/dist/utils/image-resize-core.js +0 -129
  854. package/dist/utils/image-resize-core.js.map +0 -1
  855. package/dist/utils/image-resize-worker.d.ts +0 -2
  856. package/dist/utils/image-resize-worker.d.ts.map +0 -1
  857. package/dist/utils/image-resize-worker.js +0 -32
  858. package/dist/utils/image-resize-worker.js.map +0 -1
  859. package/dist/utils/image-resize.d.ts +0 -16
  860. package/dist/utils/image-resize.d.ts.map +0 -1
  861. package/dist/utils/image-resize.js +0 -96
  862. package/dist/utils/image-resize.js.map +0 -1
  863. package/dist/utils/json.d.ts +0 -3
  864. package/dist/utils/json.d.ts.map +0 -1
  865. package/dist/utils/json.js +0 -7
  866. package/dist/utils/json.js.map +0 -1
  867. package/dist/utils/management-http.d.ts +0 -25
  868. package/dist/utils/management-http.d.ts.map +0 -1
  869. package/dist/utils/management-http.js +0 -54
  870. package/dist/utils/management-http.js.map +0 -1
  871. package/dist/utils/mime.d.ts +0 -3
  872. package/dist/utils/mime.d.ts.map +0 -1
  873. package/dist/utils/mime.js +0 -110
  874. package/dist/utils/mime.js.map +0 -1
  875. package/dist/utils/open-browser.d.ts +0 -9
  876. package/dist/utils/open-browser.d.ts.map +0 -1
  877. package/dist/utils/open-browser.js +0 -22
  878. package/dist/utils/open-browser.js.map +0 -1
  879. package/dist/utils/paths.d.ts +0 -34
  880. package/dist/utils/paths.d.ts.map +0 -1
  881. package/dist/utils/paths.js +0 -115
  882. package/dist/utils/paths.js.map +0 -1
  883. package/dist/utils/photon.d.ts +0 -21
  884. package/dist/utils/photon.d.ts.map +0 -1
  885. package/dist/utils/photon.js +0 -121
  886. package/dist/utils/photon.js.map +0 -1
  887. package/dist/utils/pi-user-agent.d.ts +0 -2
  888. package/dist/utils/pi-user-agent.d.ts.map +0 -1
  889. package/dist/utils/pi-user-agent.js +0 -5
  890. package/dist/utils/pi-user-agent.js.map +0 -1
  891. package/dist/utils/shell.d.ts +0 -32
  892. package/dist/utils/shell.d.ts.map +0 -1
  893. package/dist/utils/shell.js +0 -189
  894. package/dist/utils/shell.js.map +0 -1
  895. package/dist/utils/sleep.d.ts +0 -5
  896. package/dist/utils/sleep.d.ts.map +0 -1
  897. package/dist/utils/sleep.js +0 -17
  898. package/dist/utils/sleep.js.map +0 -1
  899. package/dist/utils/syntax-highlight.d.ts +0 -13
  900. package/dist/utils/syntax-highlight.d.ts.map +0 -1
  901. package/dist/utils/syntax-highlight.js +0 -184
  902. package/dist/utils/syntax-highlight.js.map +0 -1
  903. package/dist/utils/text.d.ts +0 -8
  904. package/dist/utils/text.d.ts.map +0 -1
  905. package/dist/utils/text.js +0 -9
  906. package/dist/utils/text.js.map +0 -1
  907. package/dist/utils/tool-result-images.d.ts +0 -21
  908. package/dist/utils/tool-result-images.d.ts.map +0 -1
  909. package/dist/utils/tool-result-images.js +0 -48
  910. package/dist/utils/tool-result-images.js.map +0 -1
  911. package/dist/utils/tools-manager.d.ts +0 -13
  912. package/dist/utils/tools-manager.d.ts.map +0 -1
  913. package/dist/utils/tools-manager.js +0 -343
  914. package/dist/utils/tools-manager.js.map +0 -1
  915. package/dist/utils/version-check.d.ts +0 -19
  916. package/dist/utils/version-check.d.ts.map +0 -1
  917. package/dist/utils/version-check.js +0 -72
  918. package/dist/utils/version-check.js.map +0 -1
  919. package/dist/utils/windows-self-update.d.ts +0 -3
  920. package/dist/utils/windows-self-update.d.ts.map +0 -1
  921. package/dist/utils/windows-self-update.js +0 -77
  922. package/dist/utils/windows-self-update.js.map +0 -1
  923. package/dist/utils/wsl.d.ts +0 -3
  924. package/dist/utils/wsl.d.ts.map +0 -1
  925. package/dist/utils/wsl.js +0 -15
  926. package/dist/utils/wsl.js.map +0 -1
  927. package/dist/utils/zip.d.ts +0 -7
  928. package/dist/utils/zip.d.ts.map +0 -1
  929. package/dist/utils/zip.js +0 -60
  930. package/dist/utils/zip.js.map +0 -1
@@ -1,39 +0,0 @@
1
- import { getPowerShellConfig } from "../../utils/shell.js";
2
- import { createLocalShellOperations, createShellToolDefinition, } from "./bash.js";
3
- import { wrapToolDefinition } from "./tool-definition-wrapper.js";
4
- const UTF8_OUTPUT_PREFIX = "try { [Console]::OutputEncoding=[System.Text.Encoding]::UTF8 } catch {}\n";
5
- export const powershellToolSystemPromptContribution = {
6
- snippet: "Execute PowerShell commands",
7
- guidelines: ["You can inspect PI_* environment variables for current model and session details."],
8
- };
9
- export function createLocalPowerShellOperations() {
10
- const operations = createLocalShellOperations("PowerShell", getPowerShellConfig);
11
- return {
12
- exec: (command, cwd, options) => operations.exec(`${UTF8_OUTPUT_PREFIX}${command}`, cwd, options),
13
- };
14
- }
15
- const powershellToolConfig = {
16
- name: "powershell",
17
- label: "powershell",
18
- shellName: "PowerShell",
19
- prompt: "PS>",
20
- promptSnippet: powershellToolSystemPromptContribution.snippet,
21
- promptGuidelines: powershellToolSystemPromptContribution.guidelines,
22
- tempFilePrefix: "pi-powershell",
23
- };
24
- export function createPowerShellToolDefinition(cwd, options) {
25
- return createShellToolDefinition(cwd, powershellToolConfig, {
26
- ...options,
27
- operations: options?.operations ?? createLocalPowerShellOperations(),
28
- });
29
- }
30
- export function createPowerShellTool(cwd, options) {
31
- const definition = createPowerShellToolDefinition(cwd, options);
32
- const tool = wrapToolDefinition(definition);
33
- Object.assign(tool, {
34
- promptSnippet: definition.promptSnippet,
35
- promptGuidelines: definition.promptGuidelines,
36
- });
37
- return tool;
38
- }
39
- //# sourceMappingURL=powershell.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"powershell.js","sourceRoot":"","sources":["../../../src/core/tools/powershell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAQN,0BAA0B,EAC1B,yBAAyB,GAEzB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,kBAAkB,GAAG,2EAA2E,CAAC;AAEvG,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACrD,OAAO,EAAE,6BAA6B;IACtC,UAAU,EAAE,CAAC,mFAAmF,CAAC;CACxF,CAAC;AAWX,MAAM,UAAU,+BAA+B;IAC9C,MAAM,UAAU,GAAG,0BAA0B,CAAC,YAAY,EAAE,mBAAmB,CAAC,CAAC;IACjF,OAAO;QACN,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,kBAAkB,GAAG,OAAO,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC;KACjG,CAAC;AACH,CAAC;AAED,MAAM,oBAAoB,GAAoB;IAC7C,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,YAAY;IACnB,SAAS,EAAE,YAAY;IACvB,MAAM,EAAE,KAAK;IACb,aAAa,EAAE,sCAAsC,CAAC,OAAO;IAC7D,gBAAgB,EAAE,sCAAsC,CAAC,UAAU;IACnE,cAAc,EAAE,eAAe;CAC/B,CAAC;AAEF,MAAM,UAAU,8BAA8B,CAC7C,GAAW,EACX,OAA+B;IAE/B,OAAO,yBAAyB,CAAC,GAAG,EAAE,oBAAoB,EAAE;QAC3D,GAAG,OAAO;QACV,UAAU,EAAE,OAAO,EAAE,UAAU,IAAI,+BAA+B,EAAE;KACpE,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,GAAW,EAAE,OAA+B;IAChF,MAAM,UAAU,GAAG,8BAA8B,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAChE,MAAM,IAAI,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAC5C,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QACnB,aAAa,EAAE,UAAU,CAAC,aAAa;QACvC,gBAAgB,EAAE,UAAU,CAAC,gBAAgB;KAC7C,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["import { getPowerShellConfig } from \"../../utils/shell.ts\";\nimport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\ttype createBashTool,\n\tcreateLocalShellOperations,\n\tcreateShellToolDefinition,\n\ttype ShellToolConfig,\n} from \"./bash.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\n\nconst UTF8_OUTPUT_PREFIX = \"try { [Console]::OutputEncoding=[System.Text.Encoding]::UTF8 } catch {}\\n\";\n\nexport const powershellToolSystemPromptContribution = {\n\tsnippet: \"Execute PowerShell commands\",\n\tguidelines: [\"You can inspect PI_* environment variables for current model and session details.\"],\n} as const;\n\nexport type PowerShellOperations = BashOperations;\nexport type PowerShellSpawnContext = BashSpawnContext;\nexport type PowerShellSpawnHook = BashSpawnHook;\nexport type PowerShellToolDetails = BashToolDetails;\nexport type PowerShellToolInput = BashToolInput;\n\nexport interface PowerShellToolOptions\n\textends Pick<BashToolOptions, \"operations\" | \"exposeSessionEnvironment\" | \"spawnHook\"> {}\n\nexport function createLocalPowerShellOperations(): PowerShellOperations {\n\tconst operations = createLocalShellOperations(\"PowerShell\", getPowerShellConfig);\n\treturn {\n\t\texec: (command, cwd, options) => operations.exec(`${UTF8_OUTPUT_PREFIX}${command}`, cwd, options),\n\t};\n}\n\nconst powershellToolConfig: ShellToolConfig = {\n\tname: \"powershell\",\n\tlabel: \"powershell\",\n\tshellName: \"PowerShell\",\n\tprompt: \"PS>\",\n\tpromptSnippet: powershellToolSystemPromptContribution.snippet,\n\tpromptGuidelines: powershellToolSystemPromptContribution.guidelines,\n\ttempFilePrefix: \"pi-powershell\",\n};\n\nexport function createPowerShellToolDefinition(\n\tcwd: string,\n\toptions?: PowerShellToolOptions,\n): ReturnType<typeof createShellToolDefinition> {\n\treturn createShellToolDefinition(cwd, powershellToolConfig, {\n\t\t...options,\n\t\toperations: options?.operations ?? createLocalPowerShellOperations(),\n\t});\n}\n\nexport function createPowerShellTool(cwd: string, options?: PowerShellToolOptions): ReturnType<typeof createBashTool> {\n\tconst definition = createPowerShellToolDefinition(cwd, options);\n\tconst tool = wrapToolDefinition(definition);\n\tObject.assign(tool, {\n\t\tpromptSnippet: definition.promptSnippet,\n\t\tpromptGuidelines: definition.promptGuidelines,\n\t});\n\treturn tool;\n}\n"]}
@@ -1,42 +0,0 @@
1
- import type { AgentTool } from "@earendil-works/pi-agent-core";
2
- import type { ModelImageResizeOptions } from "@earendil-works/pi-ai";
3
- import { type Static, Type } from "typebox";
4
- import type { ToolDefinition } from "../extensions/types.ts";
5
- import { type TruncationResult } from "./truncate.ts";
6
- declare const readSchema: Type.TObject<{
7
- path: Type.TString;
8
- offset: Type.TOptional<Type.TNumber>;
9
- limit: Type.TOptional<Type.TNumber>;
10
- }>;
11
- export declare const readToolSystemPromptContribution: {
12
- readonly snippet: "Read file contents";
13
- readonly guidelines: readonly ["Use read to examine files instead of cat or sed."];
14
- };
15
- export type ReadToolInput = Static<typeof readSchema>;
16
- export interface ReadToolDetails {
17
- truncation?: TruncationResult;
18
- }
19
- /**
20
- * Pluggable operations for the read tool.
21
- * Override these to delegate file reading to remote systems (for example SSH).
22
- */
23
- export interface ReadOperations {
24
- /** Read file contents as a Buffer */
25
- readFile: (absolutePath: string) => Promise<Buffer>;
26
- /** Check if file is readable (throw if not) */
27
- access: (absolutePath: string) => Promise<void>;
28
- /** Detect image MIME type, return null or undefined for non-images */
29
- detectImageMimeType?: (absolutePath: string) => Promise<string | null | undefined>;
30
- }
31
- export interface ReadToolOptions {
32
- /** Whether to auto-resize images. Default: true */
33
- autoResizeImages?: boolean;
34
- /** Fallback resize profile when the execution context has no model metadata. */
35
- resizeOptions?: ModelImageResizeOptions;
36
- /** Custom operations for file reading. Default: local filesystem */
37
- operations?: ReadOperations;
38
- }
39
- export declare function createReadToolDefinition(cwd: string, options?: ReadToolOptions): ToolDefinition<typeof readSchema, ReadToolDetails | undefined>;
40
- export declare function createReadTool(cwd: string, options?: ReadToolOptions): AgentTool<typeof readSchema>;
41
- export {};
42
- //# sourceMappingURL=read.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../src/core/tools/read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAA4B,uBAAuB,EAAe,MAAM,uBAAuB,CAAC;AAG5G,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,KAAK,EAAoB,cAAc,EAAE,MAA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
3
- import { Type } from "typebox";
4
- import { processImage } from "../../utils/image-process.js";
5
- import { detectSupportedImageMimeTypeFromFile } from "../../utils/mime.js";
6
- import { resolveReadPathAsync } from "./path-utils.js";
7
- import { readRenderers } from "./renderers/read.js";
8
- import { wrapToolDefinition } from "./tool-definition-wrapper.js";
9
- import { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, truncateHead } from "./truncate.js";
10
- const readSchema = Type.Object({
11
- path: Type.String({ description: "Path to the file to read (relative or absolute)" }),
12
- offset: Type.Optional(Type.Number({ description: "Line number to start reading from (1-indexed)" })),
13
- limit: Type.Optional(Type.Number({ description: "Maximum number of lines to read" })),
14
- });
15
- export const readToolSystemPromptContribution = {
16
- snippet: "Read file contents",
17
- guidelines: ["Use read to examine files instead of cat or sed."],
18
- };
19
- const defaultReadOperations = {
20
- readFile: (path) => fsReadFile(path),
21
- access: (path) => fsAccess(path, constants.R_OK),
22
- detectImageMimeType: detectSupportedImageMimeTypeFromFile,
23
- };
24
- function getNonVisionImageNote(model) {
25
- if (!model || model.input.includes("image")) {
26
- return undefined;
27
- }
28
- return "[Current model does not support images. The image will be omitted from this request.]";
29
- }
30
- export function createReadToolDefinition(cwd, options) {
31
- const autoResizeImages = options?.autoResizeImages ?? true;
32
- const fallbackResizeOptions = options?.resizeOptions;
33
- const ops = options?.operations ?? defaultReadOperations;
34
- return {
35
- name: "read",
36
- label: "read",
37
- description: `Read the contents of a file. Supports text files and images (jpg, png, gif, webp, bmp). Images are sent as attachments. For text files, output is truncated to ${DEFAULT_MAX_LINES} lines or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first). Use offset/limit for large files. When you need the full file, continue with offset until complete.`,
38
- promptSnippet: readToolSystemPromptContribution.snippet,
39
- promptGuidelines: [...readToolSystemPromptContribution.guidelines],
40
- parameters: readSchema,
41
- constrainedSampling: { type: "json_schema", strict: "prefer" },
42
- async execute(_toolCallId, { path, offset, limit }, signal, _onUpdate, ctx) {
43
- return new Promise((resolve, reject) => {
44
- if (signal?.aborted) {
45
- reject(new Error("Operation aborted"));
46
- return;
47
- }
48
- let aborted = false;
49
- const onAbort = () => {
50
- aborted = true;
51
- reject(new Error("Operation aborted"));
52
- };
53
- signal?.addEventListener("abort", onAbort, { once: true });
54
- (async () => {
55
- try {
56
- const absolutePath = await resolveReadPathAsync(path, ctx?.cwd || cwd);
57
- if (aborted)
58
- return;
59
- // Check if file exists and is readable.
60
- await ops.access(absolutePath);
61
- if (aborted)
62
- return;
63
- const mimeType = ops.detectImageMimeType ? await ops.detectImageMimeType(absolutePath) : undefined;
64
- let content;
65
- let details;
66
- const nonVisionImageNote = getNonVisionImageNote(ctx?.model);
67
- if (mimeType) {
68
- // Read image as binary.
69
- const buffer = await ops.readFile(absolutePath);
70
- const processed = await processImage(buffer, mimeType, {
71
- autoResizeImages,
72
- resizeOptions: ctx?.model?.inputLimits?.images?.resize ?? fallbackResizeOptions,
73
- });
74
- if (!processed.ok) {
75
- let textNote = `Read image file [${mimeType}]\n${processed.message}`;
76
- if (nonVisionImageNote)
77
- textNote += `\n${nonVisionImageNote}`;
78
- content = [{ type: "text", text: textNote }];
79
- }
80
- else {
81
- let textNote = `Read image file [${processed.mimeType}]`;
82
- if (processed.hints.length > 0)
83
- textNote += `\n${processed.hints.join("\n")}`;
84
- if (nonVisionImageNote)
85
- textNote += `\n${nonVisionImageNote}`;
86
- content = [
87
- { type: "text", text: textNote },
88
- { type: "image", data: processed.data, mimeType: processed.mimeType },
89
- ];
90
- }
91
- }
92
- else {
93
- // Read text content.
94
- const buffer = await ops.readFile(absolutePath);
95
- const textContent = buffer.toString("utf-8");
96
- const allLines = textContent.split("\n");
97
- const totalFileLines = allLines.length;
98
- // Apply offset if specified. Convert from 1-indexed input to 0-indexed array access.
99
- const startLine = offset ? Math.max(0, offset - 1) : 0;
100
- const startLineDisplay = startLine + 1;
101
- // Check if offset is out of bounds.
102
- if (startLine >= allLines.length) {
103
- throw new Error(`Offset ${offset} is beyond end of file (${allLines.length} lines total)`);
104
- }
105
- let selectedContent;
106
- let userLimitedLines;
107
- // If limit is specified by the user, honor it first. Otherwise truncateHead decides.
108
- if (limit !== undefined) {
109
- const endLine = Math.min(startLine + limit, allLines.length);
110
- selectedContent = allLines.slice(startLine, endLine).join("\n");
111
- userLimitedLines = endLine - startLine;
112
- }
113
- else {
114
- selectedContent = allLines.slice(startLine).join("\n");
115
- }
116
- // Apply truncation, respecting both line and byte limits.
117
- const truncation = truncateHead(selectedContent);
118
- let outputText;
119
- if (truncation.firstLineExceedsLimit) {
120
- // First line alone exceeds the byte limit. Point the model at a bash fallback.
121
- const firstLineSize = formatSize(Buffer.byteLength(allLines[startLine], "utf-8"));
122
- outputText = `[Line ${startLineDisplay} is ${firstLineSize}, exceeds ${formatSize(DEFAULT_MAX_BYTES)} limit. Use bash: sed -n '${startLineDisplay}p' ${path} | head -c ${DEFAULT_MAX_BYTES}]`;
123
- details = { truncation };
124
- }
125
- else if (truncation.truncated) {
126
- // Truncation occurred. Build an actionable continuation notice.
127
- const endLineDisplay = startLineDisplay + truncation.outputLines - 1;
128
- const nextOffset = endLineDisplay + 1;
129
- outputText = truncation.content;
130
- if (truncation.truncatedBy === "lines") {
131
- outputText += `\n\n[Showing lines ${startLineDisplay}-${endLineDisplay} of ${totalFileLines}. Use offset=${nextOffset} to continue.]`;
132
- }
133
- else {
134
- outputText += `\n\n[Showing lines ${startLineDisplay}-${endLineDisplay} of ${totalFileLines} (${formatSize(DEFAULT_MAX_BYTES)} limit). Use offset=${nextOffset} to continue.]`;
135
- }
136
- details = { truncation };
137
- }
138
- else if (userLimitedLines !== undefined && startLine + userLimitedLines < allLines.length) {
139
- // User-specified limit stopped early, but the file still has more content.
140
- const remaining = allLines.length - (startLine + userLimitedLines);
141
- const nextOffset = startLine + userLimitedLines + 1;
142
- outputText = `${truncation.content}\n\n[${remaining} more lines in file. Use offset=${nextOffset} to continue.]`;
143
- }
144
- else {
145
- // No truncation and no remaining user-limited content.
146
- outputText = truncation.content;
147
- }
148
- content = [{ type: "text", text: outputText }];
149
- }
150
- if (aborted)
151
- return;
152
- signal?.removeEventListener("abort", onAbort);
153
- resolve({ content, details });
154
- }
155
- catch (error) {
156
- signal?.removeEventListener("abort", onAbort);
157
- if (!aborted)
158
- reject(error);
159
- }
160
- })();
161
- });
162
- },
163
- ...readRenderers,
164
- };
165
- }
166
- export function createReadTool(cwd, options) {
167
- return wrapToolDefinition(createReadToolDefinition(cwd, options));
168
- }
169
- //# sourceMappingURL=read.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"read.js","sourceRoot":"","sources":["../../../src/core/tools/read.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,oCAAoC,EAAE,MAAM,qBAAqB,CAAC;AAE3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAyB,YAAY,EAAE,MAAM,eAAe,CAAC;AAEtH,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9B,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,iDAAiD,EAAE,CAAC;IACrF,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,+CAA+C,EAAE,CAAC,CAAC;IACpG,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAA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AC;4BACjC,CAAC;4BACD,OAAO,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;wBAChD,CAAC;wBAED,IAAI,OAAO;4BAAE,OAAO;wBACpB,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;wBAC9C,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;oBAC/B,CAAC;oBAAC,OAAO,KAAU,EAAE,CAAC;wBACrB,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;wBAC9C,IAAI,CAAC,OAAO;4BAAE,MAAM,CAAC,KAAK,CAAC,CAAC;oBAC7B,CAAC;gBACF,CAAC,CAAC,EAAE,CAAC;YACN,CAAC,CACD,CAAC;QACH,CAAC;QACD,GAAG,aAAa;KAChB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,OAAyB;IACpE,OAAO,kBAAkB,CAAC,wBAAwB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AACnE,CAAC","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport type { Api, ImageContent, Model, ModelImageResizeOptions, TextContent } from \"@earendil-works/pi-ai\";\nimport { constants } from \"fs\";\nimport { access as fsAccess, readFile as fsReadFile } from \"fs/promises\";\nimport { type Static, Type } from \"typebox\";\nimport { processImage } from \"../../utils/image-process.ts\";\nimport { detectSupportedImageMimeTypeFromFile } from \"../../utils/mime.ts\";\nimport type { ExtensionContext, ToolDefinition } from \"../extensions/types.ts\";\nimport { resolveReadPathAsync } from \"./path-utils.ts\";\nimport { readRenderers } from \"./renderers/read.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\nimport { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, type TruncationResult, truncateHead } from \"./truncate.ts\";\n\nconst readSchema = Type.Object({\n\tpath: Type.String({ description: \"Path to the file to read (relative or absolute)\" }),\n\toffset: Type.Optional(Type.Number({ description: \"Line number to start reading from (1-indexed)\" })),\n\tlimit: Type.Optional(Type.Number({ description: \"Maximum number of lines to read\" })),\n});\n\nexport const readToolSystemPromptContribution = {\n\tsnippet: \"Read file contents\",\n\tguidelines: [\"Use read to examine files instead of cat or sed.\"],\n} as const;\n\nexport type ReadToolInput = Static<typeof readSchema>;\n\nexport interface ReadToolDetails {\n\ttruncation?: TruncationResult;\n}\n\n/**\n * Pluggable operations for the read tool.\n * Override these to delegate file reading to remote systems (for example SSH).\n */\nexport interface ReadOperations {\n\t/** Read file contents as a Buffer */\n\treadFile: (absolutePath: string) => Promise<Buffer>;\n\t/** Check if file is readable (throw if not) */\n\taccess: (absolutePath: string) => Promise<void>;\n\t/** Detect image MIME type, return null or undefined for non-images */\n\tdetectImageMimeType?: (absolutePath: string) => Promise<string | null | undefined>;\n}\n\nconst defaultReadOperations: ReadOperations = {\n\treadFile: (path) => fsReadFile(path),\n\taccess: (path) => fsAccess(path, constants.R_OK),\n\tdetectImageMimeType: detectSupportedImageMimeTypeFromFile,\n};\n\nexport interface ReadToolOptions {\n\t/** Whether to auto-resize images. Default: true */\n\tautoResizeImages?: boolean;\n\t/** Fallback resize profile when the execution context has no model metadata. */\n\tresizeOptions?: ModelImageResizeOptions;\n\t/** Custom operations for file reading. Default: local filesystem */\n\toperations?: ReadOperations;\n}\n\nfunction getNonVisionImageNote(model: Model<Api> | undefined): string | undefined {\n\tif (!model || model.input.includes(\"image\")) {\n\t\treturn undefined;\n\t}\n\treturn \"[Current model does not support images. The image will be omitted from this request.]\";\n}\n\nexport function createReadToolDefinition(\n\tcwd: string,\n\toptions?: ReadToolOptions,\n): ToolDefinition<typeof readSchema, ReadToolDetails | undefined> {\n\tconst autoResizeImages = options?.autoResizeImages ?? true;\n\tconst fallbackResizeOptions = options?.resizeOptions;\n\tconst ops = options?.operations ?? defaultReadOperations;\n\treturn {\n\t\tname: \"read\",\n\t\tlabel: \"read\",\n\t\tdescription: `Read the contents of a file. Supports text files and images (jpg, png, gif, webp, bmp). Images are sent as attachments. For text files, output is truncated to ${DEFAULT_MAX_LINES} lines or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first). Use offset/limit for large files. When you need the full file, continue with offset until complete.`,\n\t\tpromptSnippet: readToolSystemPromptContribution.snippet,\n\t\tpromptGuidelines: [...readToolSystemPromptContribution.guidelines],\n\t\tparameters: readSchema,\n\t\tconstrainedSampling: { type: \"json_schema\", strict: \"prefer\" },\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{ path, offset, limit }: { path: string; offset?: number; limit?: number },\n\t\t\tsignal?: AbortSignal,\n\t\t\t_onUpdate?,\n\t\t\tctx?: ExtensionContext,\n\t\t) {\n\t\t\treturn new Promise<{ content: (TextContent | ImageContent)[]; details: ReadToolDetails | undefined }>(\n\t\t\t\t(resolve, reject) => {\n\t\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tlet aborted = false;\n\t\t\t\t\tconst onAbort = () => {\n\t\t\t\t\t\taborted = true;\n\t\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\t};\n\t\t\t\t\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\n\t\t\t\t\t(async () => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst absolutePath = await resolveReadPathAsync(path, ctx?.cwd || cwd);\n\t\t\t\t\t\t\tif (aborted) return;\n\t\t\t\t\t\t\t// Check if file exists and is readable.\n\t\t\t\t\t\t\tawait ops.access(absolutePath);\n\t\t\t\t\t\t\tif (aborted) return;\n\t\t\t\t\t\t\tconst mimeType = ops.detectImageMimeType ? await ops.detectImageMimeType(absolutePath) : undefined;\n\t\t\t\t\t\t\tlet content: (TextContent | ImageContent)[];\n\t\t\t\t\t\t\tlet details: ReadToolDetails | undefined;\n\t\t\t\t\t\t\tconst nonVisionImageNote = getNonVisionImageNote(ctx?.model);\n\t\t\t\t\t\t\tif (mimeType) {\n\t\t\t\t\t\t\t\t// Read image as binary.\n\t\t\t\t\t\t\t\tconst buffer = await ops.readFile(absolutePath);\n\t\t\t\t\t\t\t\tconst processed = await processImage(buffer, mimeType, {\n\t\t\t\t\t\t\t\t\tautoResizeImages,\n\t\t\t\t\t\t\t\t\tresizeOptions: ctx?.model?.inputLimits?.images?.resize ?? fallbackResizeOptions,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tif (!processed.ok) {\n\t\t\t\t\t\t\t\t\tlet textNote = `Read image file [${mimeType}]\\n${processed.message}`;\n\t\t\t\t\t\t\t\t\tif (nonVisionImageNote) textNote += `\\n${nonVisionImageNote}`;\n\t\t\t\t\t\t\t\t\tcontent = [{ type: \"text\", text: textNote }];\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tlet textNote = `Read image file [${processed.mimeType}]`;\n\t\t\t\t\t\t\t\t\tif (processed.hints.length > 0) textNote += `\\n${processed.hints.join(\"\\n\")}`;\n\t\t\t\t\t\t\t\t\tif (nonVisionImageNote) textNote += `\\n${nonVisionImageNote}`;\n\t\t\t\t\t\t\t\t\tcontent = [\n\t\t\t\t\t\t\t\t\t\t{ type: \"text\", text: textNote },\n\t\t\t\t\t\t\t\t\t\t{ type: \"image\", data: processed.data, mimeType: processed.mimeType },\n\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Read text content.\n\t\t\t\t\t\t\t\tconst buffer = await ops.readFile(absolutePath);\n\t\t\t\t\t\t\t\tconst textContent = buffer.toString(\"utf-8\");\n\t\t\t\t\t\t\t\tconst allLines = textContent.split(\"\\n\");\n\t\t\t\t\t\t\t\tconst totalFileLines = allLines.length;\n\t\t\t\t\t\t\t\t// Apply offset if specified. Convert from 1-indexed input to 0-indexed array access.\n\t\t\t\t\t\t\t\tconst startLine = offset ? Math.max(0, offset - 1) : 0;\n\t\t\t\t\t\t\t\tconst startLineDisplay = startLine + 1;\n\t\t\t\t\t\t\t\t// Check if offset is out of bounds.\n\t\t\t\t\t\t\t\tif (startLine >= allLines.length) {\n\t\t\t\t\t\t\t\t\tthrow new Error(`Offset ${offset} is beyond end of file (${allLines.length} lines total)`);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlet selectedContent: string;\n\t\t\t\t\t\t\t\tlet userLimitedLines: number | undefined;\n\t\t\t\t\t\t\t\t// If limit is specified by the user, honor it first. Otherwise truncateHead decides.\n\t\t\t\t\t\t\t\tif (limit !== undefined) {\n\t\t\t\t\t\t\t\t\tconst endLine = Math.min(startLine + limit, allLines.length);\n\t\t\t\t\t\t\t\t\tselectedContent = allLines.slice(startLine, endLine).join(\"\\n\");\n\t\t\t\t\t\t\t\t\tuserLimitedLines = endLine - startLine;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tselectedContent = allLines.slice(startLine).join(\"\\n\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Apply truncation, respecting both line and byte limits.\n\t\t\t\t\t\t\t\tconst truncation = truncateHead(selectedContent);\n\t\t\t\t\t\t\t\tlet outputText: string;\n\t\t\t\t\t\t\t\tif (truncation.firstLineExceedsLimit) {\n\t\t\t\t\t\t\t\t\t// First line alone exceeds the byte limit. Point the model at a bash fallback.\n\t\t\t\t\t\t\t\t\tconst firstLineSize = formatSize(Buffer.byteLength(allLines[startLine], \"utf-8\"));\n\t\t\t\t\t\t\t\t\toutputText = `[Line ${startLineDisplay} is ${firstLineSize}, exceeds ${formatSize(DEFAULT_MAX_BYTES)} limit. Use bash: sed -n '${startLineDisplay}p' ${path} | head -c ${DEFAULT_MAX_BYTES}]`;\n\t\t\t\t\t\t\t\t\tdetails = { truncation };\n\t\t\t\t\t\t\t\t} else if (truncation.truncated) {\n\t\t\t\t\t\t\t\t\t// Truncation occurred. Build an actionable continuation notice.\n\t\t\t\t\t\t\t\t\tconst endLineDisplay = startLineDisplay + truncation.outputLines - 1;\n\t\t\t\t\t\t\t\t\tconst nextOffset = endLineDisplay + 1;\n\t\t\t\t\t\t\t\t\toutputText = truncation.content;\n\t\t\t\t\t\t\t\t\tif (truncation.truncatedBy === \"lines\") {\n\t\t\t\t\t\t\t\t\t\toutputText += `\\n\\n[Showing lines ${startLineDisplay}-${endLineDisplay} of ${totalFileLines}. Use offset=${nextOffset} to continue.]`;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\toutputText += `\\n\\n[Showing lines ${startLineDisplay}-${endLineDisplay} of ${totalFileLines} (${formatSize(DEFAULT_MAX_BYTES)} limit). Use offset=${nextOffset} to continue.]`;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdetails = { truncation };\n\t\t\t\t\t\t\t\t} else if (userLimitedLines !== undefined && startLine + userLimitedLines < allLines.length) {\n\t\t\t\t\t\t\t\t\t// User-specified limit stopped early, but the file still has more content.\n\t\t\t\t\t\t\t\t\tconst remaining = allLines.length - (startLine + userLimitedLines);\n\t\t\t\t\t\t\t\t\tconst nextOffset = startLine + userLimitedLines + 1;\n\t\t\t\t\t\t\t\t\toutputText = `${truncation.content}\\n\\n[${remaining} more lines in file. Use offset=${nextOffset} to continue.]`;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// No truncation and no remaining user-limited content.\n\t\t\t\t\t\t\t\t\toutputText = truncation.content;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcontent = [{ type: \"text\", text: outputText }];\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (aborted) return;\n\t\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t\tresolve({ content, details });\n\t\t\t\t\t\t} catch (error: any) {\n\t\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t\tif (!aborted) reject(error);\n\t\t\t\t\t\t}\n\t\t\t\t\t})();\n\t\t\t\t},\n\t\t\t);\n\t\t},\n\t\t...readRenderers,\n\t};\n}\n\nexport function createReadTool(cwd: string, options?: ReadToolOptions): AgentTool<typeof readSchema> {\n\treturn wrapToolDefinition(createReadToolDefinition(cwd, options));\n}\n"]}
@@ -1,30 +0,0 @@
1
- import type { ImageContent, TextContent } from "@earendil-works/pi-ai";
2
- import type { Theme } from "../../modes/interactive/theme/theme.ts";
3
- export declare function shortenPath(path: unknown): string;
4
- export declare function linkPath(styledText: string, rawPath: string, cwd: string): string;
5
- export declare function str(value: unknown): string | null;
6
- export declare function replaceTabs(text: string): string;
7
- export declare function normalizeDisplayText(text: string): string;
8
- export declare function getTextOutput(result: {
9
- content: Array<{
10
- type: string;
11
- text?: string;
12
- data?: string;
13
- mimeType?: string;
14
- }>;
15
- } | undefined, showImages: boolean): string;
16
- export type ToolRenderResultLike<TDetails> = {
17
- content: (TextContent | ImageContent)[];
18
- details: TDetails;
19
- };
20
- /**
21
- * Generic tool call header: the title followed by the arguments. Collapsed, they are `key=value`
22
- * pairs on the title line, cut to {@link COLLAPSED_ARGS_CHARS}. Expanded, each is a `key: value`
23
- * line below the title, with strings shown raw and continuation lines indented.
24
- */
25
- export declare function formatToolCallWithArgs(title: string, args: unknown, theme: Theme, expanded: boolean): string;
26
- export declare function invalidArgText(theme: Theme): string;
27
- export declare function renderToolPath(rawPath: string | null, theme: Theme, cwd: string, options?: {
28
- emptyFallback?: string;
29
- }): string;
30
- //# sourceMappingURL=render-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"render-utils.d.ts","sourceRoot":"","sources":["../../../src/core/tools/render-utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAKpE,wBAAgB,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* as os from "node:os";
2
- import { pathToFileURL } from "node:url";
3
- import { getCapabilities, getImageDimensions, hyperlink, imageFallback } from "@earendil-works/pi-tui";
4
- import { stripAnsi } from "../../utils/ansi.js";
5
- import { resolvePath } from "../../utils/paths.js";
6
- import { sanitizeBinaryOutput } from "../../utils/shell.js";
7
- export function shortenPath(path) {
8
- if (typeof path !== "string")
9
- return "";
10
- const home = os.homedir();
11
- if (path.startsWith(home)) {
12
- return `~${path.slice(home.length)}`;
13
- }
14
- return path;
15
- }
16
- export function linkPath(styledText, rawPath, cwd) {
17
- if (!getCapabilities().hyperlinks)
18
- return styledText;
19
- const absolutePath = resolvePath(rawPath, cwd);
20
- return hyperlink(styledText, pathToFileURL(absolutePath).href);
21
- }
22
- export function str(value) {
23
- if (typeof value === "string")
24
- return value;
25
- if (value == null)
26
- return "";
27
- return null;
28
- }
29
- export function replaceTabs(text) {
30
- return text.replace(/\t/g, " ");
31
- }
32
- export function normalizeDisplayText(text) {
33
- return text.replace(/\r/g, "");
34
- }
35
- export function getTextOutput(result, showImages) {
36
- if (!result)
37
- return "";
38
- const textBlocks = result.content.filter((c) => c.type === "text");
39
- const imageBlocks = result.content.filter((c) => c.type === "image");
40
- let output = textBlocks.map((c) => sanitizeBinaryOutput(stripAnsi(c.text || "")).replace(/\r/g, "")).join("\n");
41
- const caps = getCapabilities();
42
- if (imageBlocks.length > 0 && (!caps.images || !showImages)) {
43
- const imageIndicators = imageBlocks
44
- .map((img) => {
45
- const mimeType = img.mimeType ?? "image/unknown";
46
- const dims = img.data && img.mimeType ? (getImageDimensions(img.data, img.mimeType) ?? undefined) : undefined;
47
- return imageFallback(mimeType, dims);
48
- })
49
- .join("\n");
50
- output = output ? `${output}\n${imageIndicators}` : imageIndicators;
51
- }
52
- return output;
53
- }
54
- const COLLAPSED_ARGS_CHARS = 100;
55
- /**
56
- * Generic tool call header: the title followed by the arguments. Collapsed, they are `key=value`
57
- * pairs on the title line, cut to {@link COLLAPSED_ARGS_CHARS}. Expanded, each is a `key: value`
58
- * line below the title, with strings shown raw and continuation lines indented.
59
- */
60
- export function formatToolCallWithArgs(title, args, theme, expanded) {
61
- const header = theme.fg("toolTitle", theme.bold(title));
62
- if (args == null)
63
- return header;
64
- const entries = typeof args === "object" && !Array.isArray(args)
65
- ? Object.entries(args)
66
- : [["args", args]];
67
- if (entries.length === 0)
68
- return header;
69
- if (expanded) {
70
- const lines = entries.map(([key, value]) => {
71
- const text = typeof value === "string" ? value : (JSON.stringify(value, null, 2) ?? String(value));
72
- return ` ${key}: ${replaceTabs(text).replace(/\r/g, "").split("\n").join("\n ")}`;
73
- });
74
- return `${header}\n${theme.fg("muted", lines.join("\n"))}`;
75
- }
76
- const pairs = entries.map(([key, value]) => `${key}=${JSON.stringify(value) ?? String(value)}`).join(" ");
77
- const preview = pairs.length > COLLAPSED_ARGS_CHARS ? `${pairs.slice(0, COLLAPSED_ARGS_CHARS - 3)}...` : pairs;
78
- return `${header} ${theme.fg("muted", preview)}`;
79
- }
80
- export function invalidArgText(theme) {
81
- return theme.fg("error", "[invalid arg]");
82
- }
83
- export function renderToolPath(rawPath, theme, cwd, options) {
84
- if (rawPath === null)
85
- return invalidArgText(theme);
86
- const value = rawPath || options?.emptyFallback;
87
- if (!value)
88
- return theme.fg("toolOutput", "...");
89
- return linkPath(theme.fg("accent", shortenPath(value)), value, cwd);
90
- }
91
- //# sourceMappingURL=render-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"render-utils.js","sourceRoot":"","sources":["../../../src/core/tools/render-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvG,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM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;IACD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1G,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,GAAG,oBAAoB,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAC/G,OAAO,GAAG,MAAM,IAAI,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAY;IAC1C,OAAO,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,cAAc,CAC7B,OAAsB,EACtB,KAAY,EACZ,GAAW,EACX,OAAoC;IAEpC,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,OAAO,IAAI,OAAO,EAAE,aAAa,CAAC;IAChD,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC,EAAE,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IACjD,OAAO,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AACrE,CAAC","sourcesContent":["import * as os from \"node:os\";\nimport { pathToFileURL } from \"node:url\";\nimport type { ImageContent, TextContent } from \"@earendil-works/pi-ai\";\nimport { getCapabilities, getImageDimensions, hyperlink, imageFallback } from \"@earendil-works/pi-tui\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport { stripAnsi } from \"../../utils/ansi.ts\";\nimport { resolvePath } from \"../../utils/paths.ts\";\nimport { sanitizeBinaryOutput } from \"../../utils/shell.ts\";\n\nexport function shortenPath(path: unknown): string {\n\tif (typeof path !== \"string\") return \"\";\n\tconst home = os.homedir();\n\tif (path.startsWith(home)) {\n\t\treturn `~${path.slice(home.length)}`;\n\t}\n\treturn path;\n}\n\nexport function linkPath(styledText: string, rawPath: string, cwd: string): string {\n\tif (!getCapabilities().hyperlinks) return styledText;\n\tconst absolutePath = resolvePath(rawPath, cwd);\n\treturn hyperlink(styledText, pathToFileURL(absolutePath).href);\n}\n\nexport function str(value: unknown): string | null {\n\tif (typeof value === \"string\") return value;\n\tif (value == null) return \"\";\n\treturn null;\n}\n\nexport function replaceTabs(text: string): string {\n\treturn text.replace(/\\t/g, \" \");\n}\n\nexport function normalizeDisplayText(text: string): string {\n\treturn text.replace(/\\r/g, \"\");\n}\n\nexport function getTextOutput(\n\tresult: { content: Array<{ type: string; text?: string; data?: string; mimeType?: string }> } | undefined,\n\tshowImages: boolean,\n): string {\n\tif (!result) return \"\";\n\n\tconst textBlocks = result.content.filter((c) => c.type === \"text\");\n\tconst imageBlocks = result.content.filter((c) => c.type === \"image\");\n\n\tlet output = textBlocks.map((c) => sanitizeBinaryOutput(stripAnsi(c.text || \"\")).replace(/\\r/g, \"\")).join(\"\\n\");\n\n\tconst caps = getCapabilities();\n\tif (imageBlocks.length > 0 && (!caps.images || !showImages)) {\n\t\tconst imageIndicators = imageBlocks\n\t\t\t.map((img) => {\n\t\t\t\tconst mimeType = img.mimeType ?? \"image/unknown\";\n\t\t\t\tconst dims =\n\t\t\t\t\timg.data && img.mimeType ? (getImageDimensions(img.data, img.mimeType) ?? undefined) : undefined;\n\t\t\t\treturn imageFallback(mimeType, dims);\n\t\t\t})\n\t\t\t.join(\"\\n\");\n\t\toutput = output ? `${output}\\n${imageIndicators}` : imageIndicators;\n\t}\n\n\treturn output;\n}\n\nexport type ToolRenderResultLike<TDetails> = {\n\tcontent: (TextContent | ImageContent)[];\n\tdetails: TDetails;\n};\n\nconst COLLAPSED_ARGS_CHARS = 100;\n\n/**\n * Generic tool call header: the title followed by the arguments. Collapsed, they are `key=value`\n * pairs on the title line, cut to {@link COLLAPSED_ARGS_CHARS}. Expanded, each is a `key: value`\n * line below the title, with strings shown raw and continuation lines indented.\n */\nexport function formatToolCallWithArgs(title: string, args: unknown, theme: Theme, expanded: boolean): string {\n\tconst header = theme.fg(\"toolTitle\", theme.bold(title));\n\tif (args == null) return header;\n\tconst entries =\n\t\ttypeof args === \"object\" && !Array.isArray(args)\n\t\t\t? Object.entries(args)\n\t\t\t: ([[\"args\", args]] as [string, unknown][]);\n\tif (entries.length === 0) return header;\n\tif (expanded) {\n\t\tconst lines = entries.map(([key, value]) => {\n\t\t\tconst text = typeof value === \"string\" ? value : (JSON.stringify(value, null, 2) ?? String(value));\n\t\t\treturn ` ${key}: ${replaceTabs(text).replace(/\\r/g, \"\").split(\"\\n\").join(\"\\n \")}`;\n\t\t});\n\t\treturn `${header}\\n${theme.fg(\"muted\", lines.join(\"\\n\"))}`;\n\t}\n\tconst pairs = entries.map(([key, value]) => `${key}=${JSON.stringify(value) ?? String(value)}`).join(\" \");\n\tconst preview = pairs.length > COLLAPSED_ARGS_CHARS ? `${pairs.slice(0, COLLAPSED_ARGS_CHARS - 3)}...` : pairs;\n\treturn `${header} ${theme.fg(\"muted\", preview)}`;\n}\n\nexport function invalidArgText(theme: Theme): string {\n\treturn theme.fg(\"error\", \"[invalid arg]\");\n}\n\nexport function renderToolPath(\n\trawPath: string | null,\n\ttheme: Theme,\n\tcwd: string,\n\toptions?: { emptyFallback?: string },\n): string {\n\tif (rawPath === null) return invalidArgText(theme);\n\tconst value = rawPath || options?.emptyFallback;\n\tif (!value) return theme.fg(\"toolOutput\", \"...\");\n\treturn linkPath(theme.fg(\"accent\", shortenPath(value)), value, cwd);\n}\n"]}
@@ -1,12 +0,0 @@
1
- /**
2
- * Presentation for the shell 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. `bash.ts` spreads these into the shell
6
- * tool definition, so the tool's public shape is unchanged.
7
- */
8
- import type { ToolDefinition } from "../../extensions/types.ts";
9
- export declare const BASH_UPDATE_THROTTLE_MS = 100;
10
- /** Shell renderers are shared by bash and powershell, which differ only in the prompt they display. */
11
- export declare function createShellRenderers(prompt: string): Pick<ToolDefinition<any, any>, "renderCall" | "renderResult">;
12
- //# sourceMappingURL=bash.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/renderers/bash.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,cAAc,EAA2B,MAAM,2BAA2B,CAAC;AAMzF,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAyF3C,uGAAuG;AACvG,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,YAAY,GAAG,cAAc,CAAC,CAqClH"}
@@ -1,117 +0,0 @@
1
- /**
2
- * Presentation for the shell 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. `bash.ts` spreads these into the shell
6
- * tool definition, so the tool's public shape is unchanged.
7
- */
8
- import { Container, Spacer, Text } from "@earendil-works/pi-tui";
9
- import { keyHint } from "../../../modes/interactive/components/keybinding-hints.js";
10
- import { VisualLinePreview } from "../../../modes/interactive/components/visual-truncate.js";
11
- import { theme } from "../../../modes/interactive/theme/theme.js";
12
- import { getTextOutput, invalidArgText, str } from "../render-utils.js";
13
- import { DEFAULT_MAX_BYTES, formatSize } from "../truncate.js";
14
- const BASH_PREVIEW_LINES = 5;
15
- export const BASH_UPDATE_THROTTLE_MS = 100;
16
- function formatDuration(ms) {
17
- const seconds = ms / 1000;
18
- if (seconds < 60)
19
- return `${seconds.toFixed(1)}s`;
20
- const totalSeconds = Math.floor(seconds);
21
- const minutes = Math.floor(totalSeconds / 60);
22
- const remainder = totalSeconds % 60;
23
- if (minutes < 60)
24
- return `${minutes}m ${remainder}s`;
25
- return `${Math.floor(minutes / 60)}h ${minutes % 60}m ${remainder}s`;
26
- }
27
- function formatShellCall(args, prompt) {
28
- const command = str(args?.command);
29
- const timeout = args?.timeout;
30
- const timeoutSuffix = timeout ? theme.fg("muted", ` (timeout ${timeout}s)`) : "";
31
- const commandDisplay = command === null ? invalidArgText(theme) : command ? command : theme.fg("toolOutput", "...");
32
- return theme.fg("toolTitle", theme.bold(`${prompt} ${commandDisplay}`)) + timeoutSuffix;
33
- }
34
- function rebuildBashResultRenderComponent(component, result, options, showImages, startedAt, endedAt) {
35
- component.clear();
36
- let output = getTextOutput(result, showImages).trim();
37
- const truncation = result.details?.truncation;
38
- const fullOutputPath = result.details?.fullOutputPath;
39
- if (!options.isPartial && truncation?.truncated && fullOutputPath && output.endsWith("]")) {
40
- const footerStart = output.lastIndexOf("\n\n[");
41
- if (footerStart !== -1 && output.slice(footerStart).includes(fullOutputPath)) {
42
- output = output.slice(0, footerStart).trimEnd();
43
- }
44
- }
45
- if (output) {
46
- const styledOutput = output
47
- .split("\n")
48
- .map((line) => theme.fg("toolOutput", line))
49
- .join("\n");
50
- if (options.expanded) {
51
- component.addChild(new Text(`\n${styledOutput}`, 0, 0));
52
- }
53
- else {
54
- component.addChild(new Spacer(1));
55
- component.addChild(new VisualLinePreview({
56
- text: styledOutput,
57
- maxVisualLines: BASH_PREVIEW_LINES,
58
- keep: "end",
59
- formatHint: (hidden) => theme.fg("muted", `... (${hidden} earlier lines,`) +
60
- ` ${keyHint("app.tools.expand", "to expand")}${theme.fg("muted", ")")}`,
61
- }));
62
- }
63
- }
64
- if (truncation?.truncated || fullOutputPath) {
65
- const warnings = [];
66
- if (fullOutputPath) {
67
- warnings.push(`Full output: ${fullOutputPath}`);
68
- }
69
- if (truncation?.truncated) {
70
- if (truncation.truncatedBy === "lines") {
71
- warnings.push(`Truncated: showing ${truncation.outputLines} of ${truncation.totalLines} lines`);
72
- }
73
- else {
74
- warnings.push(`Truncated: ${truncation.outputLines} lines shown (${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit)`);
75
- }
76
- }
77
- component.addChild(new Text(`\n${theme.fg("warning", `[${warnings.join(". ")}]`)}`, 0, 0));
78
- }
79
- if (startedAt !== undefined) {
80
- const label = options.isPartial ? "Elapsed" : "Took";
81
- const endTime = endedAt ?? Date.now();
82
- component.addChild(new Text(`\n${theme.fg("muted", `${label} ${formatDuration(endTime - startedAt)}`)}`, 0, 0));
83
- }
84
- }
85
- /** Shell renderers are shared by bash and powershell, which differ only in the prompt they display. */
86
- export function createShellRenderers(prompt) {
87
- return {
88
- renderCall(args, _theme, context) {
89
- const state = context.state;
90
- if (context.executionStarted && state.startedAt === undefined) {
91
- state.startedAt = Date.now();
92
- state.endedAt = undefined;
93
- }
94
- const text = context.lastComponent ?? new Text("", 0, 0);
95
- text.setText(formatShellCall(args, prompt));
96
- return text;
97
- },
98
- renderResult(result, options, _theme, context) {
99
- const state = context.state;
100
- if (state.startedAt !== undefined && options.isPartial && !state.interval) {
101
- state.interval = setInterval(() => context.invalidate(), 1000);
102
- }
103
- if (!options.isPartial || context.isError) {
104
- state.endedAt ??= Date.now();
105
- if (state.interval) {
106
- clearInterval(state.interval);
107
- state.interval = undefined;
108
- }
109
- }
110
- const component = context.lastComponent ?? new Container();
111
- rebuildBashResultRenderComponent(component, result, options, context.showImages, state.startedAt, state.endedAt);
112
- component.invalidate();
113
- return component;
114
- },
115
- };
116
- }
117
- //# sourceMappingURL=bash.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bash.js","sourceRoot":"","sources":["../../../../src/core/tools/renderers/bash.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE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CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YAC/E,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAA0D,EAAE,MAAM,CAAC,CAAC,CAAC;YAClG,OAAO,IAAI,CAAC;QACb,CAAC;QACD,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO;YAC5C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;YAC5B,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,IAAI,OAAO,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;gBAC3E,KAAK,CAAC,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC,CAAC;YAChE,CAAC;YACD,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;gBAC3C,KAAK,CAAC,OAAO,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC;gBAC7B,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;oBACpB,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;oBAC9B,KAAK,CAAC,QAAQ,GAAG,SAAS,CAAC;gBAC5B,CAAC;YACF,CAAC;YACD,MAAM,SAAS,GAAI,OAAO,CAAC,aAAuC,IAAI,IAAI,SAAS,EAAE,CAAC;YACtF,gCAAgC,CAC/B,SAAS,EACT,MAAa,EACb,OAAO,EACP,OAAO,CAAC,UAAU,EAClB,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,OAAO,CACb,CAAC;YACF,SAAS,CAAC,UAAU,EAAE,CAAC;YACvB,OAAO,SAAS,CAAC;QAClB,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["/**\n * Presentation for the shell 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. `bash.ts` spreads these into the shell\n * tool definition, so the tool's public shape is unchanged.\n */\n\nimport { Container, Spacer, Text } from \"@earendil-works/pi-tui\";\nimport { keyHint } from \"../../../modes/interactive/components/keybinding-hints.ts\";\nimport { VisualLinePreview } from \"../../../modes/interactive/components/visual-truncate.ts\";\nimport { theme } from \"../../../modes/interactive/theme/theme.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../../extensions/types.ts\";\nimport type { BashToolDetails } from \"../bash.ts\";\nimport { getTextOutput, invalidArgText, str } from \"../render-utils.ts\";\nimport { DEFAULT_MAX_BYTES, formatSize } from \"../truncate.ts\";\n\nconst BASH_PREVIEW_LINES = 5;\nexport const BASH_UPDATE_THROTTLE_MS = 100;\nfunction formatDuration(ms: number): string {\n\tconst seconds = ms / 1000;\n\tif (seconds < 60) return `${seconds.toFixed(1)}s`;\n\n\tconst totalSeconds = Math.floor(seconds);\n\tconst minutes = Math.floor(totalSeconds / 60);\n\tconst remainder = totalSeconds % 60;\n\tif (minutes < 60) return `${minutes}m ${remainder}s`;\n\n\treturn `${Math.floor(minutes / 60)}h ${minutes % 60}m ${remainder}s`;\n}\nfunction formatShellCall(args: { command?: string; timeout?: number } | undefined, prompt: string): string {\n\tconst command = str(args?.command);\n\tconst timeout = args?.timeout as number | undefined;\n\tconst timeoutSuffix = timeout ? theme.fg(\"muted\", ` (timeout ${timeout}s)`) : \"\";\n\tconst commandDisplay = command === null ? invalidArgText(theme) : command ? command : theme.fg(\"toolOutput\", \"...\");\n\treturn theme.fg(\"toolTitle\", theme.bold(`${prompt} ${commandDisplay}`)) + timeoutSuffix;\n}\nfunction rebuildBashResultRenderComponent(\n\tcomponent: Container,\n\tresult: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tdetails?: BashToolDetails;\n\t},\n\toptions: ToolRenderResultOptions,\n\tshowImages: boolean,\n\tstartedAt: number | undefined,\n\tendedAt: number | undefined,\n): void {\n\tcomponent.clear();\n\n\tlet output = getTextOutput(result as any, showImages).trim();\n\tconst truncation = result.details?.truncation;\n\tconst fullOutputPath = result.details?.fullOutputPath;\n\tif (!options.isPartial && truncation?.truncated && fullOutputPath && output.endsWith(\"]\")) {\n\t\tconst footerStart = output.lastIndexOf(\"\\n\\n[\");\n\t\tif (footerStart !== -1 && output.slice(footerStart).includes(fullOutputPath)) {\n\t\t\toutput = output.slice(0, footerStart).trimEnd();\n\t\t}\n\t}\n\n\tif (output) {\n\t\tconst styledOutput = output\n\t\t\t.split(\"\\n\")\n\t\t\t.map((line) => theme.fg(\"toolOutput\", line))\n\t\t\t.join(\"\\n\");\n\n\t\tif (options.expanded) {\n\t\t\tcomponent.addChild(new Text(`\\n${styledOutput}`, 0, 0));\n\t\t} else {\n\t\t\tcomponent.addChild(new Spacer(1));\n\t\t\tcomponent.addChild(\n\t\t\t\tnew VisualLinePreview({\n\t\t\t\t\ttext: styledOutput,\n\t\t\t\t\tmaxVisualLines: BASH_PREVIEW_LINES,\n\t\t\t\t\tkeep: \"end\",\n\t\t\t\t\tformatHint: (hidden) =>\n\t\t\t\t\t\ttheme.fg(\"muted\", `... (${hidden} earlier lines,`) +\n\t\t\t\t\t\t` ${keyHint(\"app.tools.expand\", \"to expand\")}${theme.fg(\"muted\", \")\")}`,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t}\n\n\tif (truncation?.truncated || fullOutputPath) {\n\t\tconst warnings: string[] = [];\n\t\tif (fullOutputPath) {\n\t\t\twarnings.push(`Full output: ${fullOutputPath}`);\n\t\t}\n\t\tif (truncation?.truncated) {\n\t\t\tif (truncation.truncatedBy === \"lines\") {\n\t\t\t\twarnings.push(`Truncated: showing ${truncation.outputLines} of ${truncation.totalLines} lines`);\n\t\t\t} else {\n\t\t\t\twarnings.push(\n\t\t\t\t\t`Truncated: ${truncation.outputLines} lines shown (${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit)`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tcomponent.addChild(new Text(`\\n${theme.fg(\"warning\", `[${warnings.join(\". \")}]`)}`, 0, 0));\n\t}\n\n\tif (startedAt !== undefined) {\n\t\tconst label = options.isPartial ? \"Elapsed\" : \"Took\";\n\t\tconst endTime = endedAt ?? Date.now();\n\t\tcomponent.addChild(new Text(`\\n${theme.fg(\"muted\", `${label} ${formatDuration(endTime - startedAt)}`)}`, 0, 0));\n\t}\n}\n\n/** Shell renderers are shared by bash and powershell, which differ only in the prompt they display. */\nexport function createShellRenderers(prompt: string): Pick<ToolDefinition<any, any>, \"renderCall\" | \"renderResult\"> {\n\treturn {\n\t\trenderCall(args, _theme, context) {\n\t\t\tconst state = context.state;\n\t\t\tif (context.executionStarted && state.startedAt === undefined) {\n\t\t\t\tstate.startedAt = Date.now();\n\t\t\t\tstate.endedAt = undefined;\n\t\t\t}\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\t\ttext.setText(formatShellCall(args as { command?: string; timeout?: number } | undefined, prompt));\n\t\t\treturn text;\n\t\t},\n\t\trenderResult(result, options, _theme, context) {\n\t\t\tconst state = context.state;\n\t\t\tif (state.startedAt !== undefined && options.isPartial && !state.interval) {\n\t\t\t\tstate.interval = setInterval(() => context.invalidate(), 1000);\n\t\t\t}\n\t\t\tif (!options.isPartial || context.isError) {\n\t\t\t\tstate.endedAt ??= Date.now();\n\t\t\t\tif (state.interval) {\n\t\t\t\t\tclearInterval(state.interval);\n\t\t\t\t\tstate.interval = undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst component = (context.lastComponent as Container | undefined) ?? new Container();\n\t\t\trebuildBashResultRenderComponent(\n\t\t\t\tcomponent,\n\t\t\t\tresult as any,\n\t\t\t\toptions,\n\t\t\t\tcontext.showImages,\n\t\t\t\tstate.startedAt,\n\t\t\t\tstate.endedAt,\n\t\t\t);\n\t\t\tcomponent.invalidate();\n\t\t\treturn component;\n\t\t},\n\t};\n}\n"]}