@subimpact/e 0.100.0 → 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 (911) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +7 -1
  3. package/dist/bundle/chunks/{chunk-KAXC2ESR.js → chunk-GICF34HK.js} +8 -8
  4. package/dist/bundle/chunks/{chunk-FBZU53S6.js → chunk-NBSSK56J.js} +1 -1
  5. package/dist/bundle/chunks/{chunk-QSDAQKAU.js → chunk-RAB4RJZ2.js} +11 -12
  6. package/dist/bundle/chunks/{easter-egg-3d-DD22MRM3.js → easter-egg-3d-JQPBRQEU.js} +1 -1
  7. package/dist/bundle/chunks/{openai-codex-responses-YOLBMQOC.js → openai-codex-responses-WGH4GHLE.js} +1 -1
  8. package/dist/bundle/chunks/{virtual-modules-YQUQNKDN.js → virtual-modules-L22CHFWU.js} +1 -1
  9. package/dist/bundle/cli-runtime.js +1 -1
  10. package/dist/bundle/index.js +1 -1
  11. package/dist/bundle/rpc-entry.js +1 -1
  12. package/docs/compaction.md +2 -2
  13. package/docs/extensions.md +4 -10
  14. package/docs/message-types.md +2 -4
  15. package/docs/session-format.md +4 -4
  16. package/docs/settings.md +1 -1
  17. package/docs/tui.md +1 -1
  18. package/examples/extensions/overlay-test.ts +2 -2
  19. package/package.json +31 -31
  20. package/dist/bun/cli.d.ts +0 -5
  21. package/dist/bun/cli.d.ts.map +0 -1
  22. package/dist/bun/cli.js +0 -5
  23. package/dist/bun/cli.js.map +0 -1
  24. package/dist/bun/restore-sandbox-env.d.ts +0 -17
  25. package/dist/bun/restore-sandbox-env.d.ts.map +0 -1
  26. package/dist/bun/restore-sandbox-env.js +0 -36
  27. package/dist/bun/restore-sandbox-env.js.map +0 -1
  28. package/dist/bun/runtime-setup.d.ts +0 -2
  29. package/dist/bun/runtime-setup.d.ts.map +0 -1
  30. package/dist/bun/runtime-setup.js +0 -9
  31. package/dist/bun/runtime-setup.js.map +0 -1
  32. package/dist/bun/sandbox-env-setup.d.ts +0 -2
  33. package/dist/bun/sandbox-env-setup.d.ts.map +0 -1
  34. package/dist/bun/sandbox-env-setup.js +0 -4
  35. package/dist/bun/sandbox-env-setup.js.map +0 -1
  36. package/dist/cli/args.d.ts +0 -61
  37. package/dist/cli/args.d.ts.map +0 -1
  38. package/dist/cli/args.js +0 -453
  39. package/dist/cli/args.js.map +0 -1
  40. package/dist/cli/auth-check.d.ts +0 -19
  41. package/dist/cli/auth-check.d.ts.map +0 -1
  42. package/dist/cli/auth-check.js +0 -50
  43. package/dist/cli/auth-check.js.map +0 -1
  44. package/dist/cli/auth-command.d.ts +0 -24
  45. package/dist/cli/auth-command.d.ts.map +0 -1
  46. package/dist/cli/auth-command.js +0 -103
  47. package/dist/cli/auth-command.js.map +0 -1
  48. package/dist/cli/config-selector.d.ts +0 -16
  49. package/dist/cli/config-selector.d.ts.map +0 -1
  50. package/dist/cli/config-selector.js +0 -32
  51. package/dist/cli/config-selector.js.map +0 -1
  52. package/dist/cli/credential-print.d.ts +0 -13
  53. package/dist/cli/credential-print.d.ts.map +0 -1
  54. package/dist/cli/credential-print.js +0 -76
  55. package/dist/cli/credential-print.js.map +0 -1
  56. package/dist/cli/file-processor.d.ts +0 -15
  57. package/dist/cli/file-processor.d.ts.map +0 -1
  58. package/dist/cli/file-processor.js +0 -71
  59. package/dist/cli/file-processor.js.map +0 -1
  60. package/dist/cli/initial-message.d.ts +0 -18
  61. package/dist/cli/initial-message.d.ts.map +0 -1
  62. package/dist/cli/initial-message.js +0 -22
  63. package/dist/cli/initial-message.js.map +0 -1
  64. package/dist/cli/list-models.d.ts +0 -9
  65. package/dist/cli/list-models.d.ts.map +0 -1
  66. package/dist/cli/list-models.js +0 -98
  67. package/dist/cli/list-models.js.map +0 -1
  68. package/dist/cli/project-trust.d.ts +0 -10
  69. package/dist/cli/project-trust.d.ts.map +0 -1
  70. package/dist/cli/project-trust.js +0 -48
  71. package/dist/cli/project-trust.js.map +0 -1
  72. package/dist/cli/session-picker.d.ts +0 -10
  73. package/dist/cli/session-picker.d.ts.map +0 -1
  74. package/dist/cli/session-picker.js +0 -36
  75. package/dist/cli/session-picker.js.map +0 -1
  76. package/dist/cli/setup.d.ts +0 -2
  77. package/dist/cli/setup.d.ts.map +0 -1
  78. package/dist/cli/setup.js +0 -12
  79. package/dist/cli/setup.js.map +0 -1
  80. package/dist/cli/startup-ui.d.ts +0 -20
  81. package/dist/cli/startup-ui.d.ts.map +0 -1
  82. package/dist/cli/startup-ui.js +0 -193
  83. package/dist/cli/startup-ui.js.map +0 -1
  84. package/dist/cli.d.ts +0 -3
  85. package/dist/cli.d.ts.map +0 -1
  86. package/dist/cli.js +0 -6
  87. package/dist/cli.js.map +0 -1
  88. package/dist/config.d.ts +0 -107
  89. package/dist/config.d.ts.map +0 -1
  90. package/dist/config.js +0 -486
  91. package/dist/config.js.map +0 -1
  92. package/dist/core/agent-session-runtime.d.ts +0 -119
  93. package/dist/core/agent-session-runtime.d.ts.map +0 -1
  94. package/dist/core/agent-session-runtime.js +0 -317
  95. package/dist/core/agent-session-runtime.js.map +0 -1
  96. package/dist/core/agent-session-services.d.ts +0 -86
  97. package/dist/core/agent-session-services.d.ts.map +0 -1
  98. package/dist/core/agent-session-services.js +0 -147
  99. package/dist/core/agent-session-services.js.map +0 -1
  100. package/dist/core/agent-session.d.ts +0 -859
  101. package/dist/core/agent-session.d.ts.map +0 -1
  102. package/dist/core/agent-session.js +0 -3416
  103. package/dist/core/agent-session.js.map +0 -1
  104. package/dist/core/auth-guidance.d.ts +0 -5
  105. package/dist/core/auth-guidance.d.ts.map +0 -1
  106. package/dist/core/auth-guidance.js +0 -21
  107. package/dist/core/auth-guidance.js.map +0 -1
  108. package/dist/core/auth-storage.d.ts +0 -72
  109. package/dist/core/auth-storage.d.ts.map +0 -1
  110. package/dist/core/auth-storage.js +0 -426
  111. package/dist/core/auth-storage.js.map +0 -1
  112. package/dist/core/bash-executor.d.ts +0 -32
  113. package/dist/core/bash-executor.d.ts.map +0 -1
  114. package/dist/core/bash-executor.js +0 -106
  115. package/dist/core/bash-executor.js.map +0 -1
  116. package/dist/core/bug-report-upload.d.ts +0 -12
  117. package/dist/core/bug-report-upload.d.ts.map +0 -1
  118. package/dist/core/bug-report-upload.js +0 -22
  119. package/dist/core/bug-report-upload.js.map +0 -1
  120. package/dist/core/bug-report.d.ts +0 -176
  121. package/dist/core/bug-report.d.ts.map +0 -1
  122. package/dist/core/bug-report.js +0 -292
  123. package/dist/core/bug-report.js.map +0 -1
  124. package/dist/core/cache-stats.d.ts +0 -49
  125. package/dist/core/cache-stats.d.ts.map +0 -1
  126. package/dist/core/cache-stats.js +0 -112
  127. package/dist/core/cache-stats.js.map +0 -1
  128. package/dist/core/cache-warmer.d.ts +0 -103
  129. package/dist/core/cache-warmer.d.ts.map +0 -1
  130. package/dist/core/cache-warmer.js +0 -359
  131. package/dist/core/cache-warmer.js.map +0 -1
  132. package/dist/core/compaction/branch-summarization.d.ts +0 -98
  133. package/dist/core/compaction/branch-summarization.d.ts.map +0 -1
  134. package/dist/core/compaction/branch-summarization.js +0 -251
  135. package/dist/core/compaction/branch-summarization.js.map +0 -1
  136. package/dist/core/compaction/compaction.d.ts +0 -145
  137. package/dist/core/compaction/compaction.d.ts.map +0 -1
  138. package/dist/core/compaction/compaction.js +0 -744
  139. package/dist/core/compaction/compaction.js.map +0 -1
  140. package/dist/core/compaction/index.d.ts +0 -7
  141. package/dist/core/compaction/index.d.ts.map +0 -1
  142. package/dist/core/compaction/index.js +0 -7
  143. package/dist/core/compaction/index.js.map +0 -1
  144. package/dist/core/compaction/utils.d.ts +0 -39
  145. package/dist/core/compaction/utils.d.ts.map +0 -1
  146. package/dist/core/compaction/utils.js +0 -149
  147. package/dist/core/compaction/utils.js.map +0 -1
  148. package/dist/core/crash-log.d.ts +0 -27
  149. package/dist/core/crash-log.d.ts.map +0 -1
  150. package/dist/core/crash-log.js +0 -140
  151. package/dist/core/crash-log.js.map +0 -1
  152. package/dist/core/defaults.d.ts +0 -4
  153. package/dist/core/defaults.d.ts.map +0 -1
  154. package/dist/core/defaults.js +0 -11
  155. package/dist/core/defaults.js.map +0 -1
  156. package/dist/core/diagnostics.d.ts +0 -15
  157. package/dist/core/diagnostics.d.ts.map +0 -1
  158. package/dist/core/diagnostics.js +0 -2
  159. package/dist/core/diagnostics.js.map +0 -1
  160. package/dist/core/event-bus.d.ts +0 -9
  161. package/dist/core/event-bus.d.ts.map +0 -1
  162. package/dist/core/event-bus.js +0 -25
  163. package/dist/core/event-bus.js.map +0 -1
  164. package/dist/core/exec.d.ts +0 -29
  165. package/dist/core/exec.d.ts.map +0 -1
  166. package/dist/core/exec.js +0 -75
  167. package/dist/core/exec.js.map +0 -1
  168. package/dist/core/experimental.d.ts +0 -2
  169. package/dist/core/experimental.d.ts.map +0 -1
  170. package/dist/core/experimental.js +0 -6
  171. package/dist/core/experimental.js.map +0 -1
  172. package/dist/core/export-html/ansi-to-html.d.ts +0 -22
  173. package/dist/core/export-html/ansi-to-html.d.ts.map +0 -1
  174. package/dist/core/export-html/ansi-to-html.js +0 -249
  175. package/dist/core/export-html/ansi-to-html.js.map +0 -1
  176. package/dist/core/export-html/index.d.ts +0 -37
  177. package/dist/core/export-html/index.d.ts.map +0 -1
  178. package/dist/core/export-html/index.js +0 -226
  179. package/dist/core/export-html/index.js.map +0 -1
  180. package/dist/core/export-html/tool-renderer.d.ts +0 -34
  181. package/dist/core/export-html/tool-renderer.d.ts.map +0 -1
  182. package/dist/core/export-html/tool-renderer.js +0 -109
  183. package/dist/core/export-html/tool-renderer.js.map +0 -1
  184. package/dist/core/extensions/compat-check.d.ts +0 -26
  185. package/dist/core/extensions/compat-check.d.ts.map +0 -1
  186. package/dist/core/extensions/compat-check.js +0 -129
  187. package/dist/core/extensions/compat-check.js.map +0 -1
  188. package/dist/core/extensions/index.d.ts +0 -12
  189. package/dist/core/extensions/index.d.ts.map +0 -1
  190. package/dist/core/extensions/index.js +0 -9
  191. package/dist/core/extensions/index.js.map +0 -1
  192. package/dist/core/extensions/jiti-loader.d.ts +0 -2
  193. package/dist/core/extensions/jiti-loader.d.ts.map +0 -1
  194. package/dist/core/extensions/jiti-loader.js +0 -4
  195. package/dist/core/extensions/jiti-loader.js.map +0 -1
  196. package/dist/core/extensions/jiti-static-loader.d.ts +0 -2
  197. package/dist/core/extensions/jiti-static-loader.d.ts.map +0 -1
  198. package/dist/core/extensions/jiti-static-loader.js +0 -4
  199. package/dist/core/extensions/jiti-static-loader.js.map +0 -1
  200. package/dist/core/extensions/loader.d.ts +0 -23
  201. package/dist/core/extensions/loader.d.ts.map +0 -1
  202. package/dist/core/extensions/loader.js +0 -689
  203. package/dist/core/extensions/loader.js.map +0 -1
  204. package/dist/core/extensions/runner.d.ts +0 -204
  205. package/dist/core/extensions/runner.d.ts.map +0 -1
  206. package/dist/core/extensions/runner.js +0 -1207
  207. package/dist/core/extensions/runner.js.map +0 -1
  208. package/dist/core/extensions/types.d.ts +0 -1623
  209. package/dist/core/extensions/types.d.ts.map +0 -1
  210. package/dist/core/extensions/types.js +0 -48
  211. package/dist/core/extensions/types.js.map +0 -1
  212. package/dist/core/extensions/virtual-modules.d.ts +0 -3
  213. package/dist/core/extensions/virtual-modules.d.ts.map +0 -1
  214. package/dist/core/extensions/virtual-modules.js +0 -38
  215. package/dist/core/extensions/virtual-modules.js.map +0 -1
  216. package/dist/core/extensions/wrapper.d.ts +0 -20
  217. package/dist/core/extensions/wrapper.d.ts.map +0 -1
  218. package/dist/core/extensions/wrapper.js +0 -22
  219. package/dist/core/extensions/wrapper.js.map +0 -1
  220. package/dist/core/footer-data-provider.d.ts +0 -64
  221. package/dist/core/footer-data-provider.d.ts.map +0 -1
  222. package/dist/core/footer-data-provider.js +0 -338
  223. package/dist/core/footer-data-provider.js.map +0 -1
  224. package/dist/core/http-dispatcher.d.ts +0 -22
  225. package/dist/core/http-dispatcher.d.ts.map +0 -1
  226. package/dist/core/http-dispatcher.js +0 -98
  227. package/dist/core/http-dispatcher.js.map +0 -1
  228. package/dist/core/index.d.ts +0 -14
  229. package/dist/core/index.d.ts.map +0 -1
  230. package/dist/core/index.js +0 -13
  231. package/dist/core/index.js.map +0 -1
  232. package/dist/core/keybindings.d.ts +0 -428
  233. package/dist/core/keybindings.d.ts.map +0 -1
  234. package/dist/core/keybindings.js +0 -321
  235. package/dist/core/keybindings.js.map +0 -1
  236. package/dist/core/messages.d.ts +0 -77
  237. package/dist/core/messages.d.ts.map +0 -1
  238. package/dist/core/messages.js +0 -124
  239. package/dist/core/messages.js.map +0 -1
  240. package/dist/core/model-config.d.ts +0 -760
  241. package/dist/core/model-config.d.ts.map +0 -1
  242. package/dist/core/model-config.js +0 -294
  243. package/dist/core/model-config.js.map +0 -1
  244. package/dist/core/model-registry.d.ts +0 -61
  245. package/dist/core/model-registry.d.ts.map +0 -1
  246. package/dist/core/model-registry.js +0 -140
  247. package/dist/core/model-registry.js.map +0 -1
  248. package/dist/core/model-resolver.d.ts +0 -124
  249. package/dist/core/model-resolver.d.ts.map +0 -1
  250. package/dist/core/model-resolver.js +0 -590
  251. package/dist/core/model-resolver.js.map +0 -1
  252. package/dist/core/model-runtime.d.ts +0 -145
  253. package/dist/core/model-runtime.d.ts.map +0 -1
  254. package/dist/core/model-runtime.js +0 -758
  255. package/dist/core/model-runtime.js.map +0 -1
  256. package/dist/core/models-store.d.ts +0 -22
  257. package/dist/core/models-store.d.ts.map +0 -1
  258. package/dist/core/models-store.js +0 -115
  259. package/dist/core/models-store.js.map +0 -1
  260. package/dist/core/nested-tool-calls.d.ts +0 -102
  261. package/dist/core/nested-tool-calls.d.ts.map +0 -1
  262. package/dist/core/nested-tool-calls.js +0 -178
  263. package/dist/core/nested-tool-calls.js.map +0 -1
  264. package/dist/core/output-guard.d.ts +0 -7
  265. package/dist/core/output-guard.d.ts.map +0 -1
  266. package/dist/core/output-guard.js +0 -89
  267. package/dist/core/output-guard.js.map +0 -1
  268. package/dist/core/package-manager.d.ts +0 -222
  269. package/dist/core/package-manager.d.ts.map +0 -1
  270. package/dist/core/package-manager.js +0 -2258
  271. package/dist/core/package-manager.js.map +0 -1
  272. package/dist/core/pi-manifest.d.ts +0 -8
  273. package/dist/core/pi-manifest.d.ts.map +0 -1
  274. package/dist/core/pi-manifest.js +0 -26
  275. package/dist/core/pi-manifest.js.map +0 -1
  276. package/dist/core/project-trust.d.ts +0 -15
  277. package/dist/core/project-trust.d.ts.map +0 -1
  278. package/dist/core/project-trust.js +0 -59
  279. package/dist/core/project-trust.js.map +0 -1
  280. package/dist/core/prompt-templates.d.ts +0 -59
  281. package/dist/core/prompt-templates.d.ts.map +0 -1
  282. package/dist/core/prompt-templates.js +0 -262
  283. package/dist/core/prompt-templates.js.map +0 -1
  284. package/dist/core/provider-attribution.d.ts +0 -4
  285. package/dist/core/provider-attribution.d.ts.map +0 -1
  286. package/dist/core/provider-attribution.js +0 -72
  287. package/dist/core/provider-attribution.js.map +0 -1
  288. package/dist/core/provider-composer.d.ts +0 -80
  289. package/dist/core/provider-composer.d.ts.map +0 -1
  290. package/dist/core/provider-composer.js +0 -488
  291. package/dist/core/provider-composer.js.map +0 -1
  292. package/dist/core/radius.d.ts +0 -5
  293. package/dist/core/radius.d.ts.map +0 -1
  294. package/dist/core/radius.js +0 -9
  295. package/dist/core/radius.js.map +0 -1
  296. package/dist/core/remote-catalog-provider.d.ts +0 -12
  297. package/dist/core/remote-catalog-provider.d.ts.map +0 -1
  298. package/dist/core/remote-catalog-provider.js +0 -132
  299. package/dist/core/remote-catalog-provider.js.map +0 -1
  300. package/dist/core/resolve-config-value.d.ts +0 -30
  301. package/dist/core/resolve-config-value.d.ts.map +0 -1
  302. package/dist/core/resolve-config-value.js +0 -247
  303. package/dist/core/resolve-config-value.js.map +0 -1
  304. package/dist/core/resource-loader.d.ts +0 -227
  305. package/dist/core/resource-loader.d.ts.map +0 -1
  306. package/dist/core/resource-loader.js +0 -1008
  307. package/dist/core/resource-loader.js.map +0 -1
  308. package/dist/core/runtime-credentials.d.ts +0 -15
  309. package/dist/core/runtime-credentials.d.ts.map +0 -1
  310. package/dist/core/runtime-credentials.js +0 -39
  311. package/dist/core/runtime-credentials.js.map +0 -1
  312. package/dist/core/sdk.d.ts +0 -108
  313. package/dist/core/sdk.d.ts.map +0 -1
  314. package/dist/core/sdk.js +0 -315
  315. package/dist/core/sdk.js.map +0 -1
  316. package/dist/core/session-cwd.d.ts +0 -19
  317. package/dist/core/session-cwd.d.ts.map +0 -1
  318. package/dist/core/session-cwd.js +0 -38
  319. package/dist/core/session-cwd.js.map +0 -1
  320. package/dist/core/session-export.d.ts +0 -8
  321. package/dist/core/session-export.d.ts.map +0 -1
  322. package/dist/core/session-export.js +0 -33
  323. package/dist/core/session-export.js.map +0 -1
  324. package/dist/core/session-manager.d.ts +0 -416
  325. package/dist/core/session-manager.d.ts.map +0 -1
  326. package/dist/core/session-manager.js +0 -1537
  327. package/dist/core/session-manager.js.map +0 -1
  328. package/dist/core/settings-diagnostics.d.ts +0 -9
  329. package/dist/core/settings-diagnostics.d.ts.map +0 -1
  330. package/dist/core/settings-diagnostics.js +0 -21
  331. package/dist/core/settings-diagnostics.js.map +0 -1
  332. package/dist/core/settings-manager.d.ts +0 -362
  333. package/dist/core/settings-manager.d.ts.map +0 -1
  334. package/dist/core/settings-manager.js +0 -1107
  335. package/dist/core/settings-manager.js.map +0 -1
  336. package/dist/core/skills.d.ts +0 -60
  337. package/dist/core/skills.d.ts.map +0 -1
  338. package/dist/core/skills.js +0 -407
  339. package/dist/core/skills.js.map +0 -1
  340. package/dist/core/slash-commands.d.ts +0 -15
  341. package/dist/core/slash-commands.d.ts.map +0 -1
  342. package/dist/core/slash-commands.js +0 -28
  343. package/dist/core/slash-commands.js.map +0 -1
  344. package/dist/core/source-info.d.ts +0 -26
  345. package/dist/core/source-info.d.ts.map +0 -1
  346. package/dist/core/source-info.js +0 -35
  347. package/dist/core/source-info.js.map +0 -1
  348. package/dist/core/system-prompt.d.ts +0 -71
  349. package/dist/core/system-prompt.d.ts.map +0 -1
  350. package/dist/core/system-prompt.js +0 -147
  351. package/dist/core/system-prompt.js.map +0 -1
  352. package/dist/core/telemetry.d.ts +0 -3
  353. package/dist/core/telemetry.d.ts.map +0 -1
  354. package/dist/core/telemetry.js +0 -10
  355. package/dist/core/telemetry.js.map +0 -1
  356. package/dist/core/timings.d.ts +0 -6
  357. package/dist/core/timings.d.ts.map +0 -1
  358. package/dist/core/timings.js +0 -42
  359. package/dist/core/timings.js.map +0 -1
  360. package/dist/core/tools/bash.d.ts +0 -101
  361. package/dist/core/tools/bash.d.ts.map +0 -1
  362. package/dist/core/tools/bash.js +0 -348
  363. package/dist/core/tools/bash.js.map +0 -1
  364. package/dist/core/tools/edit-diff.d.ts +0 -101
  365. package/dist/core/tools/edit-diff.d.ts.map +0 -1
  366. package/dist/core/tools/edit-diff.js +0 -421
  367. package/dist/core/tools/edit-diff.js.map +0 -1
  368. package/dist/core/tools/edit.d.ts +0 -44
  369. package/dist/core/tools/edit.d.ts.map +0 -1
  370. package/dist/core/tools/edit.js +0 -147
  371. package/dist/core/tools/edit.js.map +0 -1
  372. package/dist/core/tools/file-mutation-queue.d.ts +0 -6
  373. package/dist/core/tools/file-mutation-queue.d.ts.map +0 -1
  374. package/dist/core/tools/file-mutation-queue.js +0 -52
  375. package/dist/core/tools/file-mutation-queue.js.map +0 -1
  376. package/dist/core/tools/find.d.ts +0 -42
  377. package/dist/core/tools/find.d.ts.map +0 -1
  378. package/dist/core/tools/find.js +0 -251
  379. package/dist/core/tools/find.js.map +0 -1
  380. package/dist/core/tools/grep.d.ts +0 -41
  381. package/dist/core/tools/grep.d.ts.map +0 -1
  382. package/dist/core/tools/grep.js +0 -252
  383. package/dist/core/tools/grep.js.map +0 -1
  384. package/dist/core/tools/index.d.ts +0 -43
  385. package/dist/core/tools/index.d.ts.map +0 -1
  386. package/dist/core/tools/index.js +0 -129
  387. package/dist/core/tools/index.js.map +0 -1
  388. package/dist/core/tools/ls.d.ts +0 -41
  389. package/dist/core/tools/ls.d.ts.map +0 -1
  390. package/dist/core/tools/ls.js +0 -126
  391. package/dist/core/tools/ls.js.map +0 -1
  392. package/dist/core/tools/output-accumulator.d.ts +0 -63
  393. package/dist/core/tools/output-accumulator.d.ts.map +0 -1
  394. package/dist/core/tools/output-accumulator.js +0 -220
  395. package/dist/core/tools/output-accumulator.js.map +0 -1
  396. package/dist/core/tools/path-utils.d.ts +0 -10
  397. package/dist/core/tools/path-utils.d.ts.map +0 -1
  398. package/dist/core/tools/path-utils.js +0 -99
  399. package/dist/core/tools/path-utils.js.map +0 -1
  400. package/dist/core/tools/powershell.d.ts +0 -16
  401. package/dist/core/tools/powershell.d.ts.map +0 -1
  402. package/dist/core/tools/powershell.js +0 -39
  403. package/dist/core/tools/powershell.js.map +0 -1
  404. package/dist/core/tools/read.d.ts +0 -42
  405. package/dist/core/tools/read.d.ts.map +0 -1
  406. package/dist/core/tools/read.js +0 -169
  407. package/dist/core/tools/read.js.map +0 -1
  408. package/dist/core/tools/render-utils.d.ts +0 -30
  409. package/dist/core/tools/render-utils.d.ts.map +0 -1
  410. package/dist/core/tools/render-utils.js +0 -91
  411. package/dist/core/tools/render-utils.js.map +0 -1
  412. package/dist/core/tools/renderers/bash.d.ts +0 -12
  413. package/dist/core/tools/renderers/bash.d.ts.map +0 -1
  414. package/dist/core/tools/renderers/bash.js +0 -117
  415. package/dist/core/tools/renderers/bash.js.map +0 -1
  416. package/dist/core/tools/renderers/edit.d.ts +0 -23
  417. package/dist/core/tools/renderers/edit.d.ts.map +0 -1
  418. package/dist/core/tools/renderers/edit.js +0 -168
  419. package/dist/core/tools/renderers/edit.js.map +0 -1
  420. package/dist/core/tools/renderers/find.d.ts +0 -10
  421. package/dist/core/tools/renderers/find.d.ts.map +0 -1
  422. package/dist/core/tools/renderers/find.js +0 -64
  423. package/dist/core/tools/renderers/find.js.map +0 -1
  424. package/dist/core/tools/renderers/grep.d.ts +0 -10
  425. package/dist/core/tools/renderers/grep.d.ts.map +0 -1
  426. package/dist/core/tools/renderers/grep.js +0 -69
  427. package/dist/core/tools/renderers/grep.js.map +0 -1
  428. package/dist/core/tools/renderers/index.d.ts +0 -28
  429. package/dist/core/tools/renderers/index.d.ts.map +0 -1
  430. package/dist/core/tools/renderers/index.js +0 -47
  431. package/dist/core/tools/renderers/index.js.map +0 -1
  432. package/dist/core/tools/renderers/ls.d.ts +0 -10
  433. package/dist/core/tools/renderers/ls.d.ts.map +0 -1
  434. package/dist/core/tools/renderers/ls.js +0 -58
  435. package/dist/core/tools/renderers/ls.js.map +0 -1
  436. package/dist/core/tools/renderers/read.d.ts +0 -11
  437. package/dist/core/tools/renderers/read.d.ts.map +0 -1
  438. package/dist/core/tools/renderers/read.js +0 -130
  439. package/dist/core/tools/renderers/read.js.map +0 -1
  440. package/dist/core/tools/renderers/write.d.ts +0 -10
  441. package/dist/core/tools/renderers/write.d.ts.map +0 -1
  442. package/dist/core/tools/renderers/write.js +0 -153
  443. package/dist/core/tools/renderers/write.js.map +0 -1
  444. package/dist/core/tools/tool-definition-wrapper.d.ts +0 -16
  445. package/dist/core/tools/tool-definition-wrapper.d.ts.map +0 -1
  446. package/dist/core/tools/tool-definition-wrapper.js +0 -38
  447. package/dist/core/tools/tool-definition-wrapper.js.map +0 -1
  448. package/dist/core/tools/truncate.d.ts +0 -84
  449. package/dist/core/tools/truncate.d.ts.map +0 -1
  450. package/dist/core/tools/truncate.js +0 -244
  451. package/dist/core/tools/truncate.js.map +0 -1
  452. package/dist/core/tools/write.d.ts +0 -30
  453. package/dist/core/tools/write.d.ts.map +0 -1
  454. package/dist/core/tools/write.js +0 -61
  455. package/dist/core/tools/write.js.map +0 -1
  456. package/dist/core/trust-manager.d.ts +0 -36
  457. package/dist/core/trust-manager.d.ts.map +0 -1
  458. package/dist/core/trust-manager.js +0 -203
  459. package/dist/core/trust-manager.js.map +0 -1
  460. package/dist/core/usage-totals.d.ts +0 -21
  461. package/dist/core/usage-totals.d.ts.map +0 -1
  462. package/dist/core/usage-totals.js +0 -79
  463. package/dist/core/usage-totals.js.map +0 -1
  464. package/dist/core/virtual-models.d.ts +0 -117
  465. package/dist/core/virtual-models.d.ts.map +0 -1
  466. package/dist/core/virtual-models.js +0 -124
  467. package/dist/core/virtual-models.js.map +0 -1
  468. package/dist/extensions/index.d.ts +0 -3
  469. package/dist/extensions/index.d.ts.map +0 -1
  470. package/dist/extensions/index.js +0 -3
  471. package/dist/extensions/index.js.map +0 -1
  472. package/dist/extensions/llama/client.d.ts +0 -69
  473. package/dist/extensions/llama/client.d.ts.map +0 -1
  474. package/dist/extensions/llama/client.js +0 -313
  475. package/dist/extensions/llama/client.js.map +0 -1
  476. package/dist/extensions/llama/huggingface.d.ts +0 -23
  477. package/dist/extensions/llama/huggingface.d.ts.map +0 -1
  478. package/dist/extensions/llama/huggingface.js +0 -141
  479. package/dist/extensions/llama/huggingface.js.map +0 -1
  480. package/dist/extensions/llama/index.d.ts +0 -3
  481. package/dist/extensions/llama/index.d.ts.map +0 -1
  482. package/dist/extensions/llama/index.js +0 -219
  483. package/dist/extensions/llama/index.js.map +0 -1
  484. package/dist/extensions/llama/provider.d.ts +0 -12
  485. package/dist/extensions/llama/provider.d.ts.map +0 -1
  486. package/dist/extensions/llama/provider.js +0 -213
  487. package/dist/extensions/llama/provider.js.map +0 -1
  488. package/dist/extensions/llama/ui.d.ts +0 -42
  489. package/dist/extensions/llama/ui.d.ts.map +0 -1
  490. package/dist/extensions/llama/ui.js +0 -416
  491. package/dist/extensions/llama/ui.js.map +0 -1
  492. package/dist/index.d.ts +0 -38
  493. package/dist/index.d.ts.map +0 -1
  494. package/dist/index.js +0 -49
  495. package/dist/index.js.map +0 -1
  496. package/dist/main.d.ts +0 -16
  497. package/dist/main.d.ts.map +0 -1
  498. package/dist/main.js +0 -819
  499. package/dist/main.js.map +0 -1
  500. package/dist/migrations.d.ts +0 -33
  501. package/dist/migrations.d.ts.map +0 -1
  502. package/dist/migrations.js +0 -282
  503. package/dist/migrations.js.map +0 -1
  504. package/dist/modes/index.d.ts +0 -10
  505. package/dist/modes/index.d.ts.map +0 -1
  506. package/dist/modes/index.js +0 -8
  507. package/dist/modes/index.js.map +0 -1
  508. package/dist/modes/interactive/bug-report.d.ts +0 -16
  509. package/dist/modes/interactive/bug-report.d.ts.map +0 -1
  510. package/dist/modes/interactive/bug-report.js +0 -210
  511. package/dist/modes/interactive/bug-report.js.map +0 -1
  512. package/dist/modes/interactive/chat-viewport.d.ts +0 -20
  513. package/dist/modes/interactive/chat-viewport.d.ts.map +0 -1
  514. package/dist/modes/interactive/chat-viewport.js +0 -28
  515. package/dist/modes/interactive/chat-viewport.js.map +0 -1
  516. package/dist/modes/interactive/components/armin.d.ts +0 -37
  517. package/dist/modes/interactive/components/armin.d.ts.map +0 -1
  518. package/dist/modes/interactive/components/armin.js +0 -335
  519. package/dist/modes/interactive/components/armin.js.map +0 -1
  520. package/dist/modes/interactive/components/assistant-message.d.ts +0 -26
  521. package/dist/modes/interactive/components/assistant-message.d.ts.map +0 -1
  522. package/dist/modes/interactive/components/assistant-message.js +0 -158
  523. package/dist/modes/interactive/components/assistant-message.js.map +0 -1
  524. package/dist/modes/interactive/components/bash-execution.d.ts +0 -38
  525. package/dist/modes/interactive/components/bash-execution.d.ts.map +0 -1
  526. package/dist/modes/interactive/components/bash-execution.js +0 -178
  527. package/dist/modes/interactive/components/bash-execution.js.map +0 -1
  528. package/dist/modes/interactive/components/bordered-loader.d.ts +0 -16
  529. package/dist/modes/interactive/components/bordered-loader.d.ts.map +0 -1
  530. package/dist/modes/interactive/components/bordered-loader.js +0 -54
  531. package/dist/modes/interactive/components/bordered-loader.js.map +0 -1
  532. package/dist/modes/interactive/components/branch-summary-message.d.ts +0 -17
  533. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +0 -1
  534. package/dist/modes/interactive/components/branch-summary-message.js +0 -54
  535. package/dist/modes/interactive/components/branch-summary-message.js.map +0 -1
  536. package/dist/modes/interactive/components/compaction-summary-message.d.ts +0 -17
  537. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +0 -1
  538. package/dist/modes/interactive/components/compaction-summary-message.js +0 -55
  539. package/dist/modes/interactive/components/compaction-summary-message.js.map +0 -1
  540. package/dist/modes/interactive/components/config-selector.d.ts +0 -102
  541. package/dist/modes/interactive/components/config-selector.d.ts.map +0 -1
  542. package/dist/modes/interactive/components/config-selector.js +0 -771
  543. package/dist/modes/interactive/components/config-selector.js.map +0 -1
  544. package/dist/modes/interactive/components/countdown-timer.d.ts +0 -14
  545. package/dist/modes/interactive/components/countdown-timer.d.ts.map +0 -1
  546. package/dist/modes/interactive/components/countdown-timer.js +0 -33
  547. package/dist/modes/interactive/components/countdown-timer.js.map +0 -1
  548. package/dist/modes/interactive/components/custom-editor.d.ts +0 -30
  549. package/dist/modes/interactive/components/custom-editor.d.ts.map +0 -1
  550. package/dist/modes/interactive/components/custom-editor.js +0 -115
  551. package/dist/modes/interactive/components/custom-editor.js.map +0 -1
  552. package/dist/modes/interactive/components/custom-entry.d.ts +0 -21
  553. package/dist/modes/interactive/components/custom-entry.d.ts.map +0 -1
  554. package/dist/modes/interactive/components/custom-entry.js +0 -58
  555. package/dist/modes/interactive/components/custom-entry.js.map +0 -1
  556. package/dist/modes/interactive/components/custom-message.d.ts +0 -22
  557. package/dist/modes/interactive/components/custom-message.d.ts.map +0 -1
  558. package/dist/modes/interactive/components/custom-message.js +0 -88
  559. package/dist/modes/interactive/components/custom-message.js.map +0 -1
  560. package/dist/modes/interactive/components/diff.d.ts +0 -12
  561. package/dist/modes/interactive/components/diff.d.ts.map +0 -1
  562. package/dist/modes/interactive/components/diff.js +0 -133
  563. package/dist/modes/interactive/components/diff.js.map +0 -1
  564. package/dist/modes/interactive/components/dynamic-border.d.ts +0 -15
  565. package/dist/modes/interactive/components/dynamic-border.d.ts.map +0 -1
  566. package/dist/modes/interactive/components/dynamic-border.js +0 -21
  567. package/dist/modes/interactive/components/dynamic-border.js.map +0 -1
  568. package/dist/modes/interactive/components/e-logo.d.ts +0 -16
  569. package/dist/modes/interactive/components/e-logo.d.ts.map +0 -1
  570. package/dist/modes/interactive/components/e-logo.js +0 -29
  571. package/dist/modes/interactive/components/e-logo.js.map +0 -1
  572. package/dist/modes/interactive/components/earendil-announcement.d.ts +0 -5
  573. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +0 -1
  574. package/dist/modes/interactive/components/earendil-announcement.js +0 -40
  575. package/dist/modes/interactive/components/earendil-announcement.js.map +0 -1
  576. package/dist/modes/interactive/components/easter-egg-3d.d.ts +0 -104
  577. package/dist/modes/interactive/components/easter-egg-3d.d.ts.map +0 -1
  578. package/dist/modes/interactive/components/easter-egg-3d.js +0 -1138
  579. package/dist/modes/interactive/components/easter-egg-3d.js.map +0 -1
  580. package/dist/modes/interactive/components/easter-egg-3d.lazy.d.ts +0 -6
  581. package/dist/modes/interactive/components/easter-egg-3d.lazy.d.ts.map +0 -1
  582. package/dist/modes/interactive/components/easter-egg-3d.lazy.js +0 -23
  583. package/dist/modes/interactive/components/easter-egg-3d.lazy.js.map +0 -1
  584. package/dist/modes/interactive/components/extension-editor.d.ts +0 -24
  585. package/dist/modes/interactive/components/extension-editor.d.ts.map +0 -1
  586. package/dist/modes/interactive/components/extension-editor.js +0 -103
  587. package/dist/modes/interactive/components/extension-editor.js.map +0 -1
  588. package/dist/modes/interactive/components/extension-input.d.ts +0 -25
  589. package/dist/modes/interactive/components/extension-input.d.ts.map +0 -1
  590. package/dist/modes/interactive/components/extension-input.js +0 -67
  591. package/dist/modes/interactive/components/extension-input.js.map +0 -1
  592. package/dist/modes/interactive/components/extension-selector.d.ts +0 -27
  593. package/dist/modes/interactive/components/extension-selector.d.ts.map +0 -1
  594. package/dist/modes/interactive/components/extension-selector.js +0 -87
  595. package/dist/modes/interactive/components/extension-selector.js.map +0 -1
  596. package/dist/modes/interactive/components/first-time-setup.d.ts +0 -25
  597. package/dist/modes/interactive/components/first-time-setup.d.ts.map +0 -1
  598. package/dist/modes/interactive/components/first-time-setup.js +0 -109
  599. package/dist/modes/interactive/components/first-time-setup.js.map +0 -1
  600. package/dist/modes/interactive/components/footer.d.ts +0 -39
  601. package/dist/modes/interactive/components/footer.d.ts.map +0 -1
  602. package/dist/modes/interactive/components/footer.js +0 -265
  603. package/dist/modes/interactive/components/footer.js.map +0 -1
  604. package/dist/modes/interactive/components/index.d.ts +0 -33
  605. package/dist/modes/interactive/components/index.d.ts.map +0 -1
  606. package/dist/modes/interactive/components/index.js +0 -34
  607. package/dist/modes/interactive/components/index.js.map +0 -1
  608. package/dist/modes/interactive/components/keybinding-hints.d.ts +0 -13
  609. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +0 -1
  610. package/dist/modes/interactive/components/keybinding-hints.js +0 -36
  611. package/dist/modes/interactive/components/keybinding-hints.js.map +0 -1
  612. package/dist/modes/interactive/components/login-dialog.d.ts +0 -52
  613. package/dist/modes/interactive/components/login-dialog.d.ts.map +0 -1
  614. package/dist/modes/interactive/components/login-dialog.js +0 -188
  615. package/dist/modes/interactive/components/login-dialog.js.map +0 -1
  616. package/dist/modes/interactive/components/markdown-transform.d.ts +0 -3
  617. package/dist/modes/interactive/components/markdown-transform.d.ts.map +0 -1
  618. package/dist/modes/interactive/components/markdown-transform.js +0 -19
  619. package/dist/modes/interactive/components/markdown-transform.js.map +0 -1
  620. package/dist/modes/interactive/components/mermaid.d.ts +0 -11
  621. package/dist/modes/interactive/components/mermaid.d.ts.map +0 -1
  622. package/dist/modes/interactive/components/mermaid.js +0 -75
  623. package/dist/modes/interactive/components/mermaid.js.map +0 -1
  624. package/dist/modes/interactive/components/model-selector.d.ts +0 -60
  625. package/dist/modes/interactive/components/model-selector.d.ts.map +0 -1
  626. package/dist/modes/interactive/components/model-selector.js +0 -361
  627. package/dist/modes/interactive/components/model-selector.js.map +0 -1
  628. package/dist/modes/interactive/components/oauth-selector.d.ts +0 -33
  629. package/dist/modes/interactive/components/oauth-selector.d.ts.map +0 -1
  630. package/dist/modes/interactive/components/oauth-selector.js +0 -163
  631. package/dist/modes/interactive/components/oauth-selector.js.map +0 -1
  632. package/dist/modes/interactive/components/scoped-models-selector.d.ts +0 -46
  633. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +0 -1
  634. package/dist/modes/interactive/components/scoped-models-selector.js +0 -326
  635. package/dist/modes/interactive/components/scoped-models-selector.js.map +0 -1
  636. package/dist/modes/interactive/components/session-selector-search.d.ts +0 -23
  637. package/dist/modes/interactive/components/session-selector-search.d.ts.map +0 -1
  638. package/dist/modes/interactive/components/session-selector-search.js +0 -155
  639. package/dist/modes/interactive/components/session-selector-search.js.map +0 -1
  640. package/dist/modes/interactive/components/session-selector.d.ts +0 -95
  641. package/dist/modes/interactive/components/session-selector.d.ts.map +0 -1
  642. package/dist/modes/interactive/components/session-selector.js +0 -893
  643. package/dist/modes/interactive/components/session-selector.js.map +0 -1
  644. package/dist/modes/interactive/components/settings-selector.d.ts +0 -96
  645. package/dist/modes/interactive/components/settings-selector.d.ts.map +0 -1
  646. package/dist/modes/interactive/components/settings-selector.js +0 -742
  647. package/dist/modes/interactive/components/settings-selector.js.map +0 -1
  648. package/dist/modes/interactive/components/settings-submenu.d.ts +0 -72
  649. package/dist/modes/interactive/components/settings-submenu.d.ts.map +0 -1
  650. package/dist/modes/interactive/components/settings-submenu.js +0 -165
  651. package/dist/modes/interactive/components/settings-submenu.js.map +0 -1
  652. package/dist/modes/interactive/components/show-images-selector.d.ts +0 -10
  653. package/dist/modes/interactive/components/show-images-selector.d.ts.map +0 -1
  654. package/dist/modes/interactive/components/show-images-selector.js +0 -39
  655. package/dist/modes/interactive/components/show-images-selector.js.map +0 -1
  656. package/dist/modes/interactive/components/skill-invocation-message.d.ts +0 -18
  657. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +0 -1
  658. package/dist/modes/interactive/components/skill-invocation-message.js +0 -57
  659. package/dist/modes/interactive/components/skill-invocation-message.js.map +0 -1
  660. package/dist/modes/interactive/components/status-indicator.d.ts +0 -30
  661. package/dist/modes/interactive/components/status-indicator.d.ts.map +0 -1
  662. package/dist/modes/interactive/components/status-indicator.js +0 -67
  663. package/dist/modes/interactive/components/status-indicator.js.map +0 -1
  664. package/dist/modes/interactive/components/theme-selector.d.ts +0 -11
  665. package/dist/modes/interactive/components/theme-selector.d.ts.map +0 -1
  666. package/dist/modes/interactive/components/theme-selector.js +0 -50
  667. package/dist/modes/interactive/components/theme-selector.js.map +0 -1
  668. package/dist/modes/interactive/components/themed-text.d.ts +0 -17
  669. package/dist/modes/interactive/components/themed-text.d.ts.map +0 -1
  670. package/dist/modes/interactive/components/themed-text.js +0 -29
  671. package/dist/modes/interactive/components/themed-text.js.map +0 -1
  672. package/dist/modes/interactive/components/thinking-selector.d.ts +0 -23
  673. package/dist/modes/interactive/components/thinking-selector.d.ts.map +0 -1
  674. package/dist/modes/interactive/components/thinking-selector.js +0 -109
  675. package/dist/modes/interactive/components/thinking-selector.js.map +0 -1
  676. package/dist/modes/interactive/components/tool-execution.d.ts +0 -83
  677. package/dist/modes/interactive/components/tool-execution.d.ts.map +0 -1
  678. package/dist/modes/interactive/components/tool-execution.js +0 -323
  679. package/dist/modes/interactive/components/tool-execution.js.map +0 -1
  680. package/dist/modes/interactive/components/tree-selector.d.ts +0 -94
  681. package/dist/modes/interactive/components/tree-selector.d.ts.map +0 -1
  682. package/dist/modes/interactive/components/tree-selector.js +0 -1254
  683. package/dist/modes/interactive/components/tree-selector.js.map +0 -1
  684. package/dist/modes/interactive/components/trust-selector.d.ts +0 -23
  685. package/dist/modes/interactive/components/trust-selector.d.ts.map +0 -1
  686. package/dist/modes/interactive/components/trust-selector.js +0 -91
  687. package/dist/modes/interactive/components/trust-selector.js.map +0 -1
  688. package/dist/modes/interactive/components/user-message-selector.d.ts +0 -30
  689. package/dist/modes/interactive/components/user-message-selector.d.ts.map +0 -1
  690. package/dist/modes/interactive/components/user-message-selector.js +0 -114
  691. package/dist/modes/interactive/components/user-message-selector.js.map +0 -1
  692. package/dist/modes/interactive/components/user-message.d.ts +0 -16
  693. package/dist/modes/interactive/components/user-message.d.ts.map +0 -1
  694. package/dist/modes/interactive/components/user-message.js +0 -50
  695. package/dist/modes/interactive/components/user-message.js.map +0 -1
  696. package/dist/modes/interactive/components/visual-truncate.d.ts +0 -48
  697. package/dist/modes/interactive/components/visual-truncate.d.ts.map +0 -1
  698. package/dist/modes/interactive/components/visual-truncate.js +0 -66
  699. package/dist/modes/interactive/components/visual-truncate.js.map +0 -1
  700. package/dist/modes/interactive/external-editor.d.ts +0 -12
  701. package/dist/modes/interactive/external-editor.d.ts.map +0 -1
  702. package/dist/modes/interactive/external-editor.js +0 -38
  703. package/dist/modes/interactive/external-editor.js.map +0 -1
  704. package/dist/modes/interactive/interactive-mode.d.ts +0 -470
  705. package/dist/modes/interactive/interactive-mode.d.ts.map +0 -1
  706. package/dist/modes/interactive/interactive-mode.js +0 -5795
  707. package/dist/modes/interactive/interactive-mode.js.map +0 -1
  708. package/dist/modes/interactive/model-catalog-refresh.d.ts +0 -7
  709. package/dist/modes/interactive/model-catalog-refresh.d.ts.map +0 -1
  710. package/dist/modes/interactive/model-catalog-refresh.js +0 -34
  711. package/dist/modes/interactive/model-catalog-refresh.js.map +0 -1
  712. package/dist/modes/interactive/model-search.d.ts +0 -12
  713. package/dist/modes/interactive/model-search.d.ts.map +0 -1
  714. package/dist/modes/interactive/model-search.js +0 -15
  715. package/dist/modes/interactive/model-search.js.map +0 -1
  716. package/dist/modes/interactive/session-share.d.ts +0 -18
  717. package/dist/modes/interactive/session-share.d.ts.map +0 -1
  718. package/dist/modes/interactive/session-share.js +0 -188
  719. package/dist/modes/interactive/session-share.js.map +0 -1
  720. package/dist/modes/interactive/theme/system-theme.d.ts +0 -55
  721. package/dist/modes/interactive/theme/system-theme.d.ts.map +0 -1
  722. package/dist/modes/interactive/theme/system-theme.js +0 -546
  723. package/dist/modes/interactive/theme/system-theme.js.map +0 -1
  724. package/dist/modes/interactive/theme/theme-controller.d.ts +0 -81
  725. package/dist/modes/interactive/theme/theme-controller.d.ts.map +0 -1
  726. package/dist/modes/interactive/theme/theme-controller.js +0 -210
  727. package/dist/modes/interactive/theme/theme-controller.js.map +0 -1
  728. package/dist/modes/interactive/theme/theme-json.d.ts +0 -85
  729. package/dist/modes/interactive/theme/theme-json.d.ts.map +0 -1
  730. package/dist/modes/interactive/theme/theme-json.js +0 -132
  731. package/dist/modes/interactive/theme/theme-json.js.map +0 -1
  732. package/dist/modes/interactive/theme/theme.d.ts +0 -158
  733. package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
  734. package/dist/modes/interactive/theme/theme.js +0 -913
  735. package/dist/modes/interactive/theme/theme.js.map +0 -1
  736. package/dist/modes/interactive/tui-renderer.d.ts +0 -22
  737. package/dist/modes/interactive/tui-renderer.d.ts.map +0 -1
  738. package/dist/modes/interactive/tui-renderer.js +0 -67
  739. package/dist/modes/interactive/tui-renderer.js.map +0 -1
  740. package/dist/modes/json-event.d.ts +0 -34
  741. package/dist/modes/json-event.d.ts.map +0 -1
  742. package/dist/modes/json-event.js +0 -29
  743. package/dist/modes/json-event.js.map +0 -1
  744. package/dist/modes/print-mode.d.ts +0 -28
  745. package/dist/modes/print-mode.d.ts.map +0 -1
  746. package/dist/modes/print-mode.js +0 -142
  747. package/dist/modes/print-mode.js.map +0 -1
  748. package/dist/modes/rpc/jsonl.d.ts +0 -17
  749. package/dist/modes/rpc/jsonl.d.ts.map +0 -1
  750. package/dist/modes/rpc/jsonl.js +0 -49
  751. package/dist/modes/rpc/jsonl.js.map +0 -1
  752. package/dist/modes/rpc/rpc-client.d.ts +0 -254
  753. package/dist/modes/rpc/rpc-client.d.ts.map +0 -1
  754. package/dist/modes/rpc/rpc-client.js +0 -499
  755. package/dist/modes/rpc/rpc-client.js.map +0 -1
  756. package/dist/modes/rpc/rpc-mode.d.ts +0 -20
  757. package/dist/modes/rpc/rpc-mode.d.ts.map +0 -1
  758. package/dist/modes/rpc/rpc-mode.js +0 -655
  759. package/dist/modes/rpc/rpc-mode.js.map +0 -1
  760. package/dist/modes/rpc/rpc-types.d.ts +0 -478
  761. package/dist/modes/rpc/rpc-types.d.ts.map +0 -1
  762. package/dist/modes/rpc/rpc-types.js +0 -8
  763. package/dist/modes/rpc/rpc-types.js.map +0 -1
  764. package/dist/package-manager-cli.d.ts +0 -9
  765. package/dist/package-manager-cli.d.ts.map +0 -1
  766. package/dist/package-manager-cli.js +0 -1003
  767. package/dist/package-manager-cli.js.map +0 -1
  768. package/dist/rpc-entry.d.ts +0 -3
  769. package/dist/rpc-entry.d.ts.map +0 -1
  770. package/dist/rpc-entry.js +0 -11
  771. package/dist/rpc-entry.js.map +0 -1
  772. package/dist/utils/abort.d.ts +0 -5
  773. package/dist/utils/abort.d.ts.map +0 -1
  774. package/dist/utils/abort.js +0 -48
  775. package/dist/utils/abort.js.map +0 -1
  776. package/dist/utils/ansi.d.ts +0 -10
  777. package/dist/utils/ansi.d.ts.map +0 -1
  778. package/dist/utils/ansi.js +0 -71
  779. package/dist/utils/ansi.js.map +0 -1
  780. package/dist/utils/changelog.d.ts +0 -22
  781. package/dist/utils/changelog.d.ts.map +0 -1
  782. package/dist/utils/changelog.js +0 -165
  783. package/dist/utils/changelog.js.map +0 -1
  784. package/dist/utils/child-process.d.ts +0 -18
  785. package/dist/utils/child-process.d.ts.map +0 -1
  786. package/dist/utils/child-process.js +0 -106
  787. package/dist/utils/child-process.js.map +0 -1
  788. package/dist/utils/clipboard-command.d.ts +0 -7
  789. package/dist/utils/clipboard-command.d.ts.map +0 -1
  790. package/dist/utils/clipboard-command.js +0 -45
  791. package/dist/utils/clipboard-command.js.map +0 -1
  792. package/dist/utils/clipboard-image.d.ts +0 -11
  793. package/dist/utils/clipboard-image.d.ts.map +0 -1
  794. package/dist/utils/clipboard-image.js +0 -214
  795. package/dist/utils/clipboard-image.js.map +0 -1
  796. package/dist/utils/clipboard.d.ts +0 -6
  797. package/dist/utils/clipboard.d.ts.map +0 -1
  798. package/dist/utils/clipboard.js +0 -157
  799. package/dist/utils/clipboard.js.map +0 -1
  800. package/dist/utils/deprecation.d.ts +0 -4
  801. package/dist/utils/deprecation.d.ts.map +0 -1
  802. package/dist/utils/deprecation.js +0 -13
  803. package/dist/utils/deprecation.js.map +0 -1
  804. package/dist/utils/exif-orientation.d.ts +0 -5
  805. package/dist/utils/exif-orientation.d.ts.map +0 -1
  806. package/dist/utils/exif-orientation.js +0 -157
  807. package/dist/utils/exif-orientation.js.map +0 -1
  808. package/dist/utils/frontmatter.d.ts +0 -8
  809. package/dist/utils/frontmatter.d.ts.map +0 -1
  810. package/dist/utils/frontmatter.js +0 -27
  811. package/dist/utils/frontmatter.js.map +0 -1
  812. package/dist/utils/fs-watch.d.ts +0 -5
  813. package/dist/utils/fs-watch.d.ts.map +0 -1
  814. package/dist/utils/fs-watch.js +0 -25
  815. package/dist/utils/fs-watch.js.map +0 -1
  816. package/dist/utils/git.d.ts +0 -26
  817. package/dist/utils/git.d.ts.map +0 -1
  818. package/dist/utils/git.js +0 -195
  819. package/dist/utils/git.js.map +0 -1
  820. package/dist/utils/html.d.ts +0 -7
  821. package/dist/utils/html.d.ts.map +0 -1
  822. package/dist/utils/html.js +0 -40
  823. package/dist/utils/html.js.map +0 -1
  824. package/dist/utils/image-convert.d.ts +0 -22
  825. package/dist/utils/image-convert.d.ts.map +0 -1
  826. package/dist/utils/image-convert.js +0 -84
  827. package/dist/utils/image-convert.js.map +0 -1
  828. package/dist/utils/image-process.d.ts +0 -18
  829. package/dist/utils/image-process.d.ts.map +0 -1
  830. package/dist/utils/image-process.js +0 -83
  831. package/dist/utils/image-process.js.map +0 -1
  832. package/dist/utils/image-resize-core.d.ts +0 -42
  833. package/dist/utils/image-resize-core.d.ts.map +0 -1
  834. package/dist/utils/image-resize-core.js +0 -129
  835. package/dist/utils/image-resize-core.js.map +0 -1
  836. package/dist/utils/image-resize-worker.d.ts +0 -2
  837. package/dist/utils/image-resize-worker.d.ts.map +0 -1
  838. package/dist/utils/image-resize-worker.js +0 -32
  839. package/dist/utils/image-resize-worker.js.map +0 -1
  840. package/dist/utils/image-resize.d.ts +0 -16
  841. package/dist/utils/image-resize.d.ts.map +0 -1
  842. package/dist/utils/image-resize.js +0 -96
  843. package/dist/utils/image-resize.js.map +0 -1
  844. package/dist/utils/json.d.ts +0 -3
  845. package/dist/utils/json.d.ts.map +0 -1
  846. package/dist/utils/json.js +0 -7
  847. package/dist/utils/json.js.map +0 -1
  848. package/dist/utils/management-http.d.ts +0 -25
  849. package/dist/utils/management-http.d.ts.map +0 -1
  850. package/dist/utils/management-http.js +0 -54
  851. package/dist/utils/management-http.js.map +0 -1
  852. package/dist/utils/mime.d.ts +0 -3
  853. package/dist/utils/mime.d.ts.map +0 -1
  854. package/dist/utils/mime.js +0 -110
  855. package/dist/utils/mime.js.map +0 -1
  856. package/dist/utils/open-browser.d.ts +0 -9
  857. package/dist/utils/open-browser.d.ts.map +0 -1
  858. package/dist/utils/open-browser.js +0 -22
  859. package/dist/utils/open-browser.js.map +0 -1
  860. package/dist/utils/paths.d.ts +0 -34
  861. package/dist/utils/paths.d.ts.map +0 -1
  862. package/dist/utils/paths.js +0 -115
  863. package/dist/utils/paths.js.map +0 -1
  864. package/dist/utils/photon.d.ts +0 -21
  865. package/dist/utils/photon.d.ts.map +0 -1
  866. package/dist/utils/photon.js +0 -121
  867. package/dist/utils/photon.js.map +0 -1
  868. package/dist/utils/pi-user-agent.d.ts +0 -2
  869. package/dist/utils/pi-user-agent.d.ts.map +0 -1
  870. package/dist/utils/pi-user-agent.js +0 -5
  871. package/dist/utils/pi-user-agent.js.map +0 -1
  872. package/dist/utils/shell.d.ts +0 -32
  873. package/dist/utils/shell.d.ts.map +0 -1
  874. package/dist/utils/shell.js +0 -189
  875. package/dist/utils/shell.js.map +0 -1
  876. package/dist/utils/sleep.d.ts +0 -5
  877. package/dist/utils/sleep.d.ts.map +0 -1
  878. package/dist/utils/sleep.js +0 -17
  879. package/dist/utils/sleep.js.map +0 -1
  880. package/dist/utils/syntax-highlight.d.ts +0 -13
  881. package/dist/utils/syntax-highlight.d.ts.map +0 -1
  882. package/dist/utils/syntax-highlight.js +0 -184
  883. package/dist/utils/syntax-highlight.js.map +0 -1
  884. package/dist/utils/text.d.ts +0 -8
  885. package/dist/utils/text.d.ts.map +0 -1
  886. package/dist/utils/text.js +0 -9
  887. package/dist/utils/text.js.map +0 -1
  888. package/dist/utils/tool-result-images.d.ts +0 -21
  889. package/dist/utils/tool-result-images.d.ts.map +0 -1
  890. package/dist/utils/tool-result-images.js +0 -48
  891. package/dist/utils/tool-result-images.js.map +0 -1
  892. package/dist/utils/tools-manager.d.ts +0 -13
  893. package/dist/utils/tools-manager.d.ts.map +0 -1
  894. package/dist/utils/tools-manager.js +0 -343
  895. package/dist/utils/tools-manager.js.map +0 -1
  896. package/dist/utils/version-check.d.ts +0 -19
  897. package/dist/utils/version-check.d.ts.map +0 -1
  898. package/dist/utils/version-check.js +0 -72
  899. package/dist/utils/version-check.js.map +0 -1
  900. package/dist/utils/windows-self-update.d.ts +0 -3
  901. package/dist/utils/windows-self-update.d.ts.map +0 -1
  902. package/dist/utils/windows-self-update.js +0 -77
  903. package/dist/utils/windows-self-update.js.map +0 -1
  904. package/dist/utils/wsl.d.ts +0 -3
  905. package/dist/utils/wsl.d.ts.map +0 -1
  906. package/dist/utils/wsl.js +0 -15
  907. package/dist/utils/wsl.js.map +0 -1
  908. package/dist/utils/zip.d.ts +0 -7
  909. package/dist/utils/zip.d.ts.map +0 -1
  910. package/dist/utils/zip.js +0 -60
  911. 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,uB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AO,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC,OAAO,UAAU,CAAC,CAEnG"}
@@ -1,169 +0,0 @@
1
- import { constants } from "fs";
2
- import { access as fsAccess, readFile as fsReadFile } from "fs/promises";
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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,UAAU,CAAC,OAAO,QAAQ,SAAS,mCAAmC,UAAU,gBAAgB,CAAC;4BAClH,CAAC;iCAAM,CAAC;gCACP,uDAAuD;gCACvD,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC;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":"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E,KAAK,EACZ,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,GAClC,MAAM,CAKR"}
@@ -1,91 +0,0 @@
1
- import * 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,kBA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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,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;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"]}