orient-cli 0.3.1 → 0.3.3

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 (337) hide show
  1. package/dist/cli.js +0 -0
  2. package/dist/integrations/notebooklm/notebooklm-extension.js +3 -8
  3. package/dist/integrations/notebooklm/notebooklm-extension.js.map +1 -1
  4. package/dist/integrations/playwright/playwright-extension.js +3 -11
  5. package/dist/integrations/playwright/playwright-extension.js.map +1 -1
  6. package/dist/integrations/web-search/bridge.js.map +1 -1
  7. package/dist/integrations/web-search/web-search-extension.js +0 -3
  8. package/dist/integrations/web-search/web-search-extension.js.map +1 -1
  9. package/dist/orient/orient-extension.js +4 -12
  10. package/dist/orient/orient-extension.js.map +1 -1
  11. package/package.json +1 -1
  12. package/vendor/@orient-cli/coding-agent/README.md +618 -0
  13. package/vendor/@orient-cli/coding-agent/dist/bun/cli.d.ts.map +1 -1
  14. package/vendor/@orient-cli/coding-agent/dist/bun/cli.js.map +1 -1
  15. package/vendor/@orient-cli/coding-agent/dist/bun/register-bedrock.d.ts.map +1 -1
  16. package/vendor/@orient-cli/coding-agent/dist/cli/args.d.ts.map +1 -1
  17. package/vendor/@orient-cli/coding-agent/dist/cli/args.js.map +1 -1
  18. package/vendor/@orient-cli/coding-agent/dist/cli/config-selector.d.ts.map +1 -1
  19. package/vendor/@orient-cli/coding-agent/dist/cli/config-selector.js.map +1 -1
  20. package/vendor/@orient-cli/coding-agent/dist/cli/file-processor.d.ts.map +1 -1
  21. package/vendor/@orient-cli/coding-agent/dist/cli/file-processor.js.map +1 -1
  22. package/vendor/@orient-cli/coding-agent/dist/cli/initial-message.d.ts +1 -1
  23. package/vendor/@orient-cli/coding-agent/dist/cli/initial-message.d.ts.map +1 -1
  24. package/vendor/@orient-cli/coding-agent/dist/cli/initial-message.js.map +1 -1
  25. package/vendor/@orient-cli/coding-agent/dist/cli/list-models.d.ts.map +1 -1
  26. package/vendor/@orient-cli/coding-agent/dist/cli/list-models.js.map +1 -1
  27. package/vendor/@orient-cli/coding-agent/dist/cli/session-picker.d.ts.map +1 -1
  28. package/vendor/@orient-cli/coding-agent/dist/cli/session-picker.js.map +1 -1
  29. package/vendor/@orient-cli/coding-agent/dist/cli.d.ts.map +1 -1
  30. package/vendor/@orient-cli/coding-agent/dist/cli.js +0 -0
  31. package/vendor/@orient-cli/coding-agent/dist/cli.js.map +1 -1
  32. package/vendor/@orient-cli/coding-agent/dist/config.d.ts.map +1 -1
  33. package/vendor/@orient-cli/coding-agent/dist/config.js +23 -1
  34. package/vendor/@orient-cli/coding-agent/dist/config.js.map +1 -1
  35. package/vendor/@orient-cli/coding-agent/dist/core/agent-session-runtime.d.ts.map +1 -1
  36. package/vendor/@orient-cli/coding-agent/dist/core/agent-session-runtime.js +0 -5
  37. package/vendor/@orient-cli/coding-agent/dist/core/agent-session-runtime.js.map +1 -1
  38. package/vendor/@orient-cli/coding-agent/dist/core/agent-session-services.d.ts.map +1 -1
  39. package/vendor/@orient-cli/coding-agent/dist/core/agent-session-services.js.map +1 -1
  40. package/vendor/@orient-cli/coding-agent/dist/core/agent-session.d.ts +32 -0
  41. package/vendor/@orient-cli/coding-agent/dist/core/agent-session.d.ts.map +1 -1
  42. package/vendor/@orient-cli/coding-agent/dist/core/agent-session.js +47 -67
  43. package/vendor/@orient-cli/coding-agent/dist/core/agent-session.js.map +1 -1
  44. package/vendor/@orient-cli/coding-agent/dist/core/auth-storage.d.ts +4 -0
  45. package/vendor/@orient-cli/coding-agent/dist/core/auth-storage.d.ts.map +1 -1
  46. package/vendor/@orient-cli/coding-agent/dist/core/auth-storage.js +4 -8
  47. package/vendor/@orient-cli/coding-agent/dist/core/auth-storage.js.map +1 -1
  48. package/vendor/@orient-cli/coding-agent/dist/core/bash-executor.d.ts.map +1 -1
  49. package/vendor/@orient-cli/coding-agent/dist/core/bash-executor.js.map +1 -1
  50. package/vendor/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  51. package/vendor/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.js.map +1 -1
  52. package/vendor/@orient-cli/coding-agent/dist/core/compaction/compaction.d.ts.map +1 -1
  53. package/vendor/@orient-cli/coding-agent/dist/core/compaction/compaction.js.map +1 -1
  54. package/vendor/@orient-cli/coding-agent/dist/core/compaction/index.d.ts.map +1 -1
  55. package/vendor/@orient-cli/coding-agent/dist/core/compaction/utils.d.ts.map +1 -1
  56. package/vendor/@orient-cli/coding-agent/dist/core/compaction/utils.js.map +1 -1
  57. package/vendor/@orient-cli/coding-agent/dist/core/defaults.d.ts.map +1 -1
  58. package/vendor/@orient-cli/coding-agent/dist/core/diagnostics.d.ts.map +1 -1
  59. package/vendor/@orient-cli/coding-agent/dist/core/event-bus.d.ts.map +1 -1
  60. package/vendor/@orient-cli/coding-agent/dist/core/event-bus.js.map +1 -1
  61. package/vendor/@orient-cli/coding-agent/dist/core/exec.d.ts.map +1 -1
  62. package/vendor/@orient-cli/coding-agent/dist/core/exec.js.map +1 -1
  63. package/vendor/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  64. package/vendor/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.js.map +1 -1
  65. package/vendor/@orient-cli/coding-agent/dist/core/export-html/index.d.ts.map +1 -1
  66. package/vendor/@orient-cli/coding-agent/dist/core/export-html/index.js.map +1 -1
  67. package/vendor/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  68. package/vendor/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.js.map +1 -1
  69. package/vendor/@orient-cli/coding-agent/dist/core/extensions/index.d.ts.map +1 -1
  70. package/vendor/@orient-cli/coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
  71. package/vendor/@orient-cli/coding-agent/dist/core/extensions/loader.js.map +1 -1
  72. package/vendor/@orient-cli/coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
  73. package/vendor/@orient-cli/coding-agent/dist/core/extensions/runner.js +18 -24
  74. package/vendor/@orient-cli/coding-agent/dist/core/extensions/runner.js.map +1 -1
  75. package/vendor/@orient-cli/coding-agent/dist/core/extensions/types.d.ts.map +1 -1
  76. package/vendor/@orient-cli/coding-agent/dist/core/extensions/types.js.map +1 -1
  77. package/vendor/@orient-cli/coding-agent/dist/core/extensions/wrapper.d.ts.map +1 -1
  78. package/vendor/@orient-cli/coding-agent/dist/core/extensions/wrapper.js.map +1 -1
  79. package/vendor/@orient-cli/coding-agent/dist/core/footer-data-provider.d.ts.map +1 -1
  80. package/vendor/@orient-cli/coding-agent/dist/core/footer-data-provider.js +14 -15
  81. package/vendor/@orient-cli/coding-agent/dist/core/footer-data-provider.js.map +1 -1
  82. package/vendor/@orient-cli/coding-agent/dist/core/index.d.ts.map +1 -1
  83. package/vendor/@orient-cli/coding-agent/dist/core/keybindings.d.ts +116 -116
  84. package/vendor/@orient-cli/coding-agent/dist/core/keybindings.d.ts.map +1 -1
  85. package/vendor/@orient-cli/coding-agent/dist/core/keybindings.js +0 -1
  86. package/vendor/@orient-cli/coding-agent/dist/core/keybindings.js.map +1 -1
  87. package/vendor/@orient-cli/coding-agent/dist/core/messages.d.ts.map +1 -1
  88. package/vendor/@orient-cli/coding-agent/dist/core/messages.js.map +1 -1
  89. package/vendor/@orient-cli/coding-agent/dist/core/model-registry.d.ts.map +1 -1
  90. package/vendor/@orient-cli/coding-agent/dist/core/model-registry.js +8 -8
  91. package/vendor/@orient-cli/coding-agent/dist/core/model-registry.js.map +1 -1
  92. package/vendor/@orient-cli/coding-agent/dist/core/model-resolver.d.ts.map +1 -1
  93. package/vendor/@orient-cli/coding-agent/dist/core/model-resolver.js.map +1 -1
  94. package/vendor/@orient-cli/coding-agent/dist/core/output-guard.d.ts.map +1 -1
  95. package/vendor/@orient-cli/coding-agent/dist/core/output-guard.js.map +1 -1
  96. package/vendor/@orient-cli/coding-agent/dist/core/package-manager.d.ts.map +1 -1
  97. package/vendor/@orient-cli/coding-agent/dist/core/package-manager.js +0 -6
  98. package/vendor/@orient-cli/coding-agent/dist/core/package-manager.js.map +1 -1
  99. package/vendor/@orient-cli/coding-agent/dist/core/prompt-templates.d.ts.map +1 -1
  100. package/vendor/@orient-cli/coding-agent/dist/core/prompt-templates.js.map +1 -1
  101. package/vendor/@orient-cli/coding-agent/dist/core/resolve-config-value.d.ts.map +1 -1
  102. package/vendor/@orient-cli/coding-agent/dist/core/resolve-config-value.js.map +1 -1
  103. package/vendor/@orient-cli/coding-agent/dist/core/resource-loader.d.ts.map +1 -1
  104. package/vendor/@orient-cli/coding-agent/dist/core/resource-loader.js +0 -39
  105. package/vendor/@orient-cli/coding-agent/dist/core/resource-loader.js.map +1 -1
  106. package/vendor/@orient-cli/coding-agent/dist/core/sdk.d.ts.map +1 -1
  107. package/vendor/@orient-cli/coding-agent/dist/core/sdk.js.map +1 -1
  108. package/vendor/@orient-cli/coding-agent/dist/core/session-cwd.d.ts.map +1 -1
  109. package/vendor/@orient-cli/coding-agent/dist/core/session-cwd.js +0 -1
  110. package/vendor/@orient-cli/coding-agent/dist/core/session-cwd.js.map +1 -1
  111. package/vendor/@orient-cli/coding-agent/dist/core/session-manager.d.ts.map +1 -1
  112. package/vendor/@orient-cli/coding-agent/dist/core/session-manager.js +7 -11
  113. package/vendor/@orient-cli/coding-agent/dist/core/session-manager.js.map +1 -1
  114. package/vendor/@orient-cli/coding-agent/dist/core/settings-manager.d.ts.map +1 -1
  115. package/vendor/@orient-cli/coding-agent/dist/core/settings-manager.js +7 -16
  116. package/vendor/@orient-cli/coding-agent/dist/core/settings-manager.js.map +1 -1
  117. package/vendor/@orient-cli/coding-agent/dist/core/skills.d.ts.map +1 -1
  118. package/vendor/@orient-cli/coding-agent/dist/core/skills.js.map +1 -1
  119. package/vendor/@orient-cli/coding-agent/dist/core/slash-commands.d.ts.map +1 -1
  120. package/vendor/@orient-cli/coding-agent/dist/core/source-info.d.ts.map +1 -1
  121. package/vendor/@orient-cli/coding-agent/dist/core/source-info.js.map +1 -1
  122. package/vendor/@orient-cli/coding-agent/dist/core/system-prompt.d.ts.map +1 -1
  123. package/vendor/@orient-cli/coding-agent/dist/core/system-prompt.js.map +1 -1
  124. package/vendor/@orient-cli/coding-agent/dist/core/timings.d.ts.map +1 -1
  125. package/vendor/@orient-cli/coding-agent/dist/core/timings.js.map +1 -1
  126. package/vendor/@orient-cli/coding-agent/dist/core/tools/bash.d.ts.map +1 -1
  127. package/vendor/@orient-cli/coding-agent/dist/core/tools/bash.js +8 -5
  128. package/vendor/@orient-cli/coding-agent/dist/core/tools/bash.js.map +1 -1
  129. package/vendor/@orient-cli/coding-agent/dist/core/tools/edit-diff.d.ts.map +1 -1
  130. package/vendor/@orient-cli/coding-agent/dist/core/tools/edit-diff.js.map +1 -1
  131. package/vendor/@orient-cli/coding-agent/dist/core/tools/edit.d.ts.map +1 -1
  132. package/vendor/@orient-cli/coding-agent/dist/core/tools/edit.js.map +1 -1
  133. package/vendor/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
  134. package/vendor/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.js.map +1 -1
  135. package/vendor/@orient-cli/coding-agent/dist/core/tools/find.d.ts.map +1 -1
  136. package/vendor/@orient-cli/coding-agent/dist/core/tools/find.js.map +1 -1
  137. package/vendor/@orient-cli/coding-agent/dist/core/tools/grep.d.ts.map +1 -1
  138. package/vendor/@orient-cli/coding-agent/dist/core/tools/grep.js.map +1 -1
  139. package/vendor/@orient-cli/coding-agent/dist/core/tools/index.d.ts.map +1 -1
  140. package/vendor/@orient-cli/coding-agent/dist/core/tools/index.js.map +1 -1
  141. package/vendor/@orient-cli/coding-agent/dist/core/tools/ls.d.ts.map +1 -1
  142. package/vendor/@orient-cli/coding-agent/dist/core/tools/ls.js.map +1 -1
  143. package/vendor/@orient-cli/coding-agent/dist/core/tools/path-utils.d.ts.map +1 -1
  144. package/vendor/@orient-cli/coding-agent/dist/core/tools/path-utils.js.map +1 -1
  145. package/vendor/@orient-cli/coding-agent/dist/core/tools/read.d.ts.map +1 -1
  146. package/vendor/@orient-cli/coding-agent/dist/core/tools/read.js.map +1 -1
  147. package/vendor/@orient-cli/coding-agent/dist/core/tools/render-utils.d.ts.map +1 -1
  148. package/vendor/@orient-cli/coding-agent/dist/core/tools/render-utils.js.map +1 -1
  149. package/vendor/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  150. package/vendor/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  151. package/vendor/@orient-cli/coding-agent/dist/core/tools/truncate.d.ts.map +1 -1
  152. package/vendor/@orient-cli/coding-agent/dist/core/tools/truncate.js.map +1 -1
  153. package/vendor/@orient-cli/coding-agent/dist/core/tools/write.d.ts.map +1 -1
  154. package/vendor/@orient-cli/coding-agent/dist/core/tools/write.js +0 -1
  155. package/vendor/@orient-cli/coding-agent/dist/core/tools/write.js.map +1 -1
  156. package/vendor/@orient-cli/coding-agent/dist/index.d.ts.map +1 -1
  157. package/vendor/@orient-cli/coding-agent/dist/main.d.ts.map +1 -1
  158. package/vendor/@orient-cli/coding-agent/dist/main.js.map +1 -1
  159. package/vendor/@orient-cli/coding-agent/dist/migrations.d.ts.map +1 -1
  160. package/vendor/@orient-cli/coding-agent/dist/migrations.js.map +1 -1
  161. package/vendor/@orient-cli/coding-agent/dist/modes/index.d.ts.map +1 -1
  162. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  163. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.js +0 -5
  164. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -1
  165. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  166. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.js +4 -9
  167. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.js.map +1 -1
  168. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
  169. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.js +0 -3
  170. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.js.map +1 -1
  171. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  172. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.js +1 -3
  173. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  174. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  175. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.js +1 -3
  176. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  177. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  178. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.js +6 -15
  179. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.js.map +1 -1
  180. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
  181. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.js +0 -5
  182. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.js.map +1 -1
  183. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  184. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.js +1 -8
  185. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.js.map +1 -1
  186. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  187. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.js +1 -6
  188. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.js.map +1 -1
  189. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/diff.d.ts.map +1 -1
  190. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/diff.js.map +1 -1
  191. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
  192. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.js +0 -1
  193. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.js.map +1 -1
  194. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  195. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.js +1 -6
  196. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.js.map +1 -1
  197. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  198. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.js +2 -8
  199. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.js.map +1 -1
  200. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  201. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.js +1 -8
  202. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.js.map +1 -1
  203. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -1
  204. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/footer.js +1 -3
  205. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/footer.js.map +1 -1
  206. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/index.d.ts.map +1 -1
  207. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/index.js.map +1 -1
  208. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  209. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
  210. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  211. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.js +3 -9
  212. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.js.map +1 -1
  213. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  214. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.js +8 -20
  215. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.js.map +1 -1
  216. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  217. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.js +2 -7
  218. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  219. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.d.ts.map +1 -1
  220. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.js.map +1 -1
  221. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  222. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.js +9 -13
  223. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  224. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
  225. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.js.map +1 -1
  226. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  227. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.js +33 -58
  228. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.js.map +1 -1
  229. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  230. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.js +0 -2
  231. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.js.map +1 -1
  232. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
  233. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.js +0 -1
  234. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.js.map +1 -1
  235. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  236. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.js +1 -3
  237. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  238. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
  239. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.js +0 -2
  240. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.js.map +1 -1
  241. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  242. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.js +0 -1
  243. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  244. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  245. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.js +9 -22
  246. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  247. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  248. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.js +18 -32
  249. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.js.map +1 -1
  250. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
  251. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.js +3 -6
  252. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  253. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  254. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.js.map +1 -1
  255. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
  256. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.js.map +1 -1
  257. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.d.ts +14 -0
  258. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  259. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.js +59 -84
  260. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  261. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  262. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.js +0 -6
  263. package/vendor/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
  264. package/vendor/@orient-cli/coding-agent/dist/modes/print-mode.d.ts.map +1 -1
  265. package/vendor/@orient-cli/coding-agent/dist/modes/print-mode.js.map +1 -1
  266. package/vendor/@orient-cli/coding-agent/dist/modes/rpc/jsonl.d.ts.map +1 -1
  267. package/vendor/@orient-cli/coding-agent/dist/modes/rpc/jsonl.js.map +1 -1
  268. package/vendor/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  269. package/vendor/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.js +6 -7
  270. package/vendor/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.js.map +1 -1
  271. package/vendor/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  272. package/vendor/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -1
  273. package/vendor/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  274. package/vendor/@orient-cli/coding-agent/dist/package-manager-cli.d.ts.map +1 -1
  275. package/vendor/@orient-cli/coding-agent/dist/package-manager-cli.js.map +1 -1
  276. package/vendor/@orient-cli/coding-agent/dist/utils/changelog.d.ts.map +1 -1
  277. package/vendor/@orient-cli/coding-agent/dist/utils/changelog.js.map +1 -1
  278. package/vendor/@orient-cli/coding-agent/dist/utils/child-process.d.ts.map +1 -1
  279. package/vendor/@orient-cli/coding-agent/dist/utils/child-process.js.map +1 -1
  280. package/vendor/@orient-cli/coding-agent/dist/utils/clipboard-image.d.ts.map +1 -1
  281. package/vendor/@orient-cli/coding-agent/dist/utils/clipboard-image.js.map +1 -1
  282. package/vendor/@orient-cli/coding-agent/dist/utils/clipboard-native.d.ts.map +1 -1
  283. package/vendor/@orient-cli/coding-agent/dist/utils/clipboard-native.js.map +1 -1
  284. package/vendor/@orient-cli/coding-agent/dist/utils/clipboard.d.ts.map +1 -1
  285. package/vendor/@orient-cli/coding-agent/dist/utils/clipboard.js.map +1 -1
  286. package/vendor/@orient-cli/coding-agent/dist/utils/exif-orientation.d.ts.map +1 -1
  287. package/vendor/@orient-cli/coding-agent/dist/utils/exif-orientation.js.map +1 -1
  288. package/vendor/@orient-cli/coding-agent/dist/utils/frontmatter.d.ts.map +1 -1
  289. package/vendor/@orient-cli/coding-agent/dist/utils/frontmatter.js.map +1 -1
  290. package/vendor/@orient-cli/coding-agent/dist/utils/git.d.ts.map +1 -1
  291. package/vendor/@orient-cli/coding-agent/dist/utils/git.js.map +1 -1
  292. package/vendor/@orient-cli/coding-agent/dist/utils/image-convert.d.ts.map +1 -1
  293. package/vendor/@orient-cli/coding-agent/dist/utils/image-convert.js.map +1 -1
  294. package/vendor/@orient-cli/coding-agent/dist/utils/image-resize.d.ts.map +1 -1
  295. package/vendor/@orient-cli/coding-agent/dist/utils/image-resize.js.map +1 -1
  296. package/vendor/@orient-cli/coding-agent/dist/utils/mime.d.ts.map +1 -1
  297. package/vendor/@orient-cli/coding-agent/dist/utils/mime.js.map +1 -1
  298. package/vendor/@orient-cli/coding-agent/dist/utils/paths.d.ts.map +1 -1
  299. package/vendor/@orient-cli/coding-agent/dist/utils/paths.js.map +1 -1
  300. package/vendor/@orient-cli/coding-agent/dist/utils/photon.d.ts.map +1 -1
  301. package/vendor/@orient-cli/coding-agent/dist/utils/photon.js.map +1 -1
  302. package/vendor/@orient-cli/coding-agent/dist/utils/shell.d.ts.map +1 -1
  303. package/vendor/@orient-cli/coding-agent/dist/utils/shell.js.map +1 -1
  304. package/vendor/@orient-cli/coding-agent/dist/utils/sleep.d.ts.map +1 -1
  305. package/vendor/@orient-cli/coding-agent/dist/utils/sleep.js.map +1 -1
  306. package/vendor/@orient-cli/coding-agent/dist/utils/tools-manager.d.ts.map +1 -1
  307. package/vendor/@orient-cli/coding-agent/dist/utils/tools-manager.js.map +1 -1
  308. package/vendor/@orient-cli/coding-agent/docs/compaction.md +394 -0
  309. package/vendor/@orient-cli/coding-agent/docs/custom-provider.md +596 -0
  310. package/vendor/@orient-cli/coding-agent/docs/development.md +71 -0
  311. package/vendor/@orient-cli/coding-agent/docs/extensions.md +2262 -0
  312. package/vendor/@orient-cli/coding-agent/docs/images/doom-extension.png +0 -0
  313. package/vendor/@orient-cli/coding-agent/docs/images/exy.png +0 -0
  314. package/vendor/@orient-cli/coding-agent/docs/images/interactive-mode.png +0 -0
  315. package/vendor/@orient-cli/coding-agent/docs/images/tree-view.png +0 -0
  316. package/vendor/@orient-cli/coding-agent/docs/json.md +82 -0
  317. package/vendor/@orient-cli/coding-agent/docs/keybindings.md +175 -0
  318. package/vendor/@orient-cli/coding-agent/docs/models.md +392 -0
  319. package/vendor/@orient-cli/coding-agent/docs/packages.md +218 -0
  320. package/vendor/@orient-cli/coding-agent/docs/prompt-templates.md +67 -0
  321. package/vendor/@orient-cli/coding-agent/docs/providers.md +195 -0
  322. package/vendor/@orient-cli/coding-agent/docs/rpc.md +1377 -0
  323. package/vendor/@orient-cli/coding-agent/docs/sdk.md +1124 -0
  324. package/vendor/@orient-cli/coding-agent/docs/session.md +412 -0
  325. package/vendor/@orient-cli/coding-agent/docs/settings.md +246 -0
  326. package/vendor/@orient-cli/coding-agent/docs/shell-aliases.md +13 -0
  327. package/vendor/@orient-cli/coding-agent/docs/skills.md +232 -0
  328. package/vendor/@orient-cli/coding-agent/docs/terminal-setup.md +106 -0
  329. package/vendor/@orient-cli/coding-agent/docs/termux.md +127 -0
  330. package/vendor/@orient-cli/coding-agent/docs/themes.md +295 -0
  331. package/vendor/@orient-cli/coding-agent/docs/tmux.md +61 -0
  332. package/vendor/@orient-cli/coding-agent/docs/tree.md +231 -0
  333. package/vendor/@orient-cli/coding-agent/docs/tui.md +887 -0
  334. package/vendor/@orient-cli/coding-agent/docs/windows.md +17 -0
  335. package/vendor/@orient-cli/coding-agent/dist/core/export-html/template.js +0 -1690
  336. package/vendor/@orient-cli/coding-agent/dist/core/export-html/vendor/highlight.min.js +0 -1213
  337. package/vendor/@orient-cli/coding-agent/dist/core/export-html/vendor/marked.min.js +0 -6
@@ -7,11 +7,9 @@ import { keyText } from "./keybinding-hints.js";
7
7
  * Only renders the skill block itself - user message is rendered separately.
8
8
  */
9
9
  export class SkillInvocationMessageComponent extends Box {
10
- expanded = false;
11
- skillBlock;
12
- markdownTheme;
13
10
  constructor(skillBlock, markdownTheme = getMarkdownTheme()) {
14
11
  super(1, 1, (t) => theme.bg("customMessageBg", t));
12
+ this.expanded = false;
15
13
  this.skillBlock = skillBlock;
16
14
  this.markdownTheme = markdownTheme;
17
15
  this.updateDisplay();
@@ -1 +1 @@
1
- {"version":3,"file":"skill-invocation-message.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/skill-invocation-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAsB,IAA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AI,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE;gBACxE,KAAK,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,mBAAmB,EAAE,IAAI,CAAC;aAC5D,CAAC,CACF,CAAC;QACH,CAAC;aAAM,CAAC;YACP,yDAAyD;YACzD,MAAM,IAAI,GACT,KAAK,CAAC,EAAE,CAAC,oBAAoB,EAAE,yBAAyB,CAAC;gBACzD,KAAK,CAAC,EAAE,CAAC,mBAAmB,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;gBACnD,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,OAAO,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC;YAChE,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACrC,CAAC;IAAA,CACD;CACD","sourcesContent":["import { Box, Markdown, type MarkdownTheme, Text } from \"@orient-cli/tui\";\nimport type { ParsedSkillBlock } from \"../../../core/agent-session.js\";\nimport { getMarkdownTheme, theme } from \"../theme/theme.js\";\nimport { keyText } from \"./keybinding-hints.js\";\n\n/**\n * Component that renders a skill invocation message with collapsed/expanded state.\n * Uses same background color as custom messages for visual consistency.\n * Only renders the skill block itself - user message is rendered separately.\n */\nexport class SkillInvocationMessageComponent extends Box {\n\tprivate expanded = false;\n\tprivate skillBlock: ParsedSkillBlock;\n\tprivate markdownTheme: MarkdownTheme;\n\n\tconstructor(skillBlock: ParsedSkillBlock, markdownTheme: MarkdownTheme = getMarkdownTheme()) {\n\t\tsuper(1, 1, (t) => theme.bg(\"customMessageBg\", t));\n\t\tthis.skillBlock = skillBlock;\n\t\tthis.markdownTheme = markdownTheme;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tthis.updateDisplay();\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tthis.updateDisplay();\n\t}\n\n\tprivate updateDisplay(): void {\n\t\tthis.clear();\n\n\t\tif (this.expanded) {\n\t\t\t// Expanded: label + skill name header + full content\n\t\t\tconst label = theme.fg(\"customMessageLabel\", `\\x1b[1m[skill]\\x1b[22m`);\n\t\t\tthis.addChild(new Text(label, 0, 0));\n\t\t\tconst header = `**${this.skillBlock.name}**\\n\\n`;\n\t\t\tthis.addChild(\n\t\t\t\tnew Markdown(header + this.skillBlock.content, 0, 0, this.markdownTheme, {\n\t\t\t\t\tcolor: (text: string) => theme.fg(\"customMessageText\", text),\n\t\t\t\t}),\n\t\t\t);\n\t\t} else {\n\t\t\t// Collapsed: single line - [skill] name (hint to expand)\n\t\t\tconst line =\n\t\t\t\ttheme.fg(\"customMessageLabel\", `\\x1b[1m[skill]\\x1b[22m `) +\n\t\t\t\ttheme.fg(\"customMessageText\", this.skillBlock.name) +\n\t\t\t\ttheme.fg(\"dim\", ` (${keyText(\"app.tools.expand\")} to expand)`);\n\t\t\tthis.addChild(new Text(line, 0, 0));\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"skill-invocation-message.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/skill-invocation-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAsB,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE1E,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD;;;;GAIG;AACH,MAAM,OAAO,+BAAgC,SAAQ,GAAG;IAKvD,YAAY,UAA4B,EAAE,gBAA+B,gBAAgB,EAAE;QAC1F,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE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U,CAAC,IAAI,CAAC;gBACnD,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,OAAO,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC;YAChE,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACrC,CAAC;IACF,CAAC;CACD","sourcesContent":["import { Box, Markdown, type MarkdownTheme, Text } from \"@orient-cli/tui\";\nimport type { ParsedSkillBlock } from \"../../../core/agent-session.js\";\nimport { getMarkdownTheme, theme } from \"../theme/theme.js\";\nimport { keyText } from \"./keybinding-hints.js\";\n\n/**\n * Component that renders a skill invocation message with collapsed/expanded state.\n * Uses same background color as custom messages for visual consistency.\n * Only renders the skill block itself - user message is rendered separately.\n */\nexport class SkillInvocationMessageComponent extends Box {\n\tprivate expanded = false;\n\tprivate skillBlock: ParsedSkillBlock;\n\tprivate markdownTheme: MarkdownTheme;\n\n\tconstructor(skillBlock: ParsedSkillBlock, markdownTheme: MarkdownTheme = getMarkdownTheme()) {\n\t\tsuper(1, 1, (t) => theme.bg(\"customMessageBg\", t));\n\t\tthis.skillBlock = skillBlock;\n\t\tthis.markdownTheme = markdownTheme;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tthis.updateDisplay();\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tthis.updateDisplay();\n\t}\n\n\tprivate updateDisplay(): void {\n\t\tthis.clear();\n\n\t\tif (this.expanded) {\n\t\t\t// Expanded: label + skill name header + full content\n\t\t\tconst label = theme.fg(\"customMessageLabel\", `\\x1b[1m[skill]\\x1b[22m`);\n\t\t\tthis.addChild(new Text(label, 0, 0));\n\t\t\tconst header = `**${this.skillBlock.name}**\\n\\n`;\n\t\t\tthis.addChild(\n\t\t\t\tnew Markdown(header + this.skillBlock.content, 0, 0, this.markdownTheme, {\n\t\t\t\t\tcolor: (text: string) => theme.fg(\"customMessageText\", text),\n\t\t\t\t}),\n\t\t\t);\n\t\t} else {\n\t\t\t// Collapsed: single line - [skill] name (hint to expand)\n\t\t\tconst line =\n\t\t\t\ttheme.fg(\"customMessageLabel\", `\\x1b[1m[skill]\\x1b[22m `) +\n\t\t\t\ttheme.fg(\"customMessageText\", this.skillBlock.name) +\n\t\t\t\ttheme.fg(\"dim\", ` (${keyText(\"app.tools.expand\")} to expand)`);\n\t\t\tthis.addChild(new Text(line, 0, 0));\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"theme-selector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/theme-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,UAAU,EAAgC,MAAM,iBAAiB,CAAC;AASvG;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,SAAS;IACpD,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,SAAS,CAA8B;IAE/C,YACC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,EACrC,QAAQ,EAAE,MAAM,IAAI,EACpB,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,EAyCtC;IAED,aAAa,IAAI,UAAU,CAE1B;CACD","sourcesContent":["import { Container, type SelectItem, SelectList, type SelectListLayoutOptions } from \"@orient-cli/tui\";\nimport { getAvailableThemes, getSelectListTheme } from \"../theme/theme.js\";\nimport { DynamicBorder } from \"./dynamic-border.js\";\n\nconst THEME_SELECT_LIST_LAYOUT: SelectListLayoutOptions = {\n\tminPrimaryColumnWidth: 12,\n\tmaxPrimaryColumnWidth: 32,\n};\n\n/**\n * Component that renders a theme selector\n */\nexport class ThemeSelectorComponent extends Container {\n\tprivate selectList: SelectList;\n\tprivate onPreview: (themeName: string) => void;\n\n\tconstructor(\n\t\tcurrentTheme: string,\n\t\tonSelect: (themeName: string) => void,\n\t\tonCancel: () => void,\n\t\tonPreview: (themeName: string) => void,\n\t) {\n\t\tsuper();\n\t\tthis.onPreview = onPreview;\n\n\t\t// Get available themes and create select items\n\t\tconst themes = getAvailableThemes();\n\t\tconst themeItems: SelectItem[] = themes.map((name) => ({\n\t\t\tvalue: name,\n\t\t\tlabel: name,\n\t\t\tdescription: name === currentTheme ? \"(current)\" : undefined,\n\t\t}));\n\n\t\t// Add top border\n\t\tthis.addChild(new DynamicBorder());\n\n\t\t// Create selector\n\t\tthis.selectList = new SelectList(themeItems, 10, getSelectListTheme(), THEME_SELECT_LIST_LAYOUT);\n\n\t\t// Preselect current theme\n\t\tconst currentIndex = themes.indexOf(currentTheme);\n\t\tif (currentIndex !== -1) {\n\t\t\tthis.selectList.setSelectedIndex(currentIndex);\n\t\t}\n\n\t\tthis.selectList.onSelect = (item) => {\n\t\t\tonSelect(item.value);\n\t\t};\n\n\t\tthis.selectList.onCancel = () => {\n\t\t\tonCancel();\n\t\t};\n\n\t\tthis.selectList.onSelectionChange = (item) => {\n\t\t\tthis.onPreview(item.value);\n\t\t};\n\n\t\tthis.addChild(this.selectList);\n\n\t\t// Add bottom border\n\t\tthis.addChild(new DynamicBorder());\n\t}\n\n\tgetSelectList(): SelectList {\n\t\treturn this.selectList;\n\t}\n}\n"]}
1
+ {"version":3,"file":"theme-selector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/theme-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,UAAU,EAAgC,MAAM,iBAAiB,CAAC;AASvG;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,SAAS;IACpD,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,SAAS,CAA8B;gBAG9C,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,EACrC,QAAQ,EAAE,MAAM,IAAI,EACpB,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI;IA2CvC,aAAa,IAAI,UAAU;CAG3B"}
@@ -9,8 +9,6 @@ const THEME_SELECT_LIST_LAYOUT = {
9
9
  * Component that renders a theme selector
10
10
  */
11
11
  export class ThemeSelectorComponent extends Container {
12
- selectList;
13
- onPreview;
14
12
  constructor(currentTheme, onSelect, onCancel, onPreview) {
15
13
  super();
16
14
  this.onPreview = onPreview;
@@ -1 +1 @@
1
- {"version":3,"file":"theme-selector.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/theme-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,UAAU,EAAgC,MAAM,iBAAiB,CAAC;AACvG,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,wBAAwB,GAA4B;IACzD,qBAAqB,EAAE,EAAE;IACzB,qBAAqB,EAAE,EAAE;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IAC5C,UAAU,CAAa;IACvB,SAAS,CAA8B;IAE/C,YACC,YAAoB,EACpB,QAAqC,EACrC,QAAoB,EACpB,SAAsC,EACrC;QACD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAE3B,+CAA+C;QAC/C,MAAM,MAAM,GAAG,kBAAkB,EAAE,CAAC;QACpC,MAAM,UAAU,GAAiB,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACtD,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,IAAI;YACX,WAAW,EAAE,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;SAC5D,CAAC,CAAC,CAAC;QAEJ,iBAAiB;QACjB,IAAI,CAAC,QAAQ,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;QAEnC,kBAAkB;QAClB,IAAI,CAAC,UAAU,GAAG,IAAI,UAAU,CAAC,UAAU,EAAE,EAAE,EAAE,kBAAkB,EAAE,EAAE,wBAAwB,CAAC,CAAC;QAEjG,0BAA0B;QAC1B,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAClD,IAAI,YAAY,KAAK,CAAC,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QAChD,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC;YACpC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAAA,CACrB,CAAC;QAEF,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,GAAG,EAAE,CAAC;YAChC,QAAQ,EAAE,CAAC;QAAA,CACX,CAAC;QAEF,IAAI,CAAC,UAAU,CAAC,iBAAiB,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC;YAC7C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAAA,CAC3B,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAE/B,oBAAoB;QACpB,IAAI,CAAC,QAAQ,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;IAAA,CACnC;IAED,aAAa,GAAe;QAC3B,OAAO,IAAI,CAAC,UAAU,CAAC;IAAA,CACvB;CACD","sourcesContent":["import { Container, type SelectItem, SelectList, type SelectListLayoutOptions } from \"@orient-cli/tui\";\nimport { getAvailableThemes, getSelectListTheme } from \"../theme/theme.js\";\nimport { DynamicBorder } from \"./dynamic-border.js\";\n\nconst THEME_SELECT_LIST_LAYOUT: SelectListLayoutOptions = {\n\tminPrimaryColumnWidth: 12,\n\tmaxPrimaryColumnWidth: 32,\n};\n\n/**\n * Component that renders a theme selector\n */\nexport class ThemeSelectorComponent extends Container {\n\tprivate selectList: SelectList;\n\tprivate onPreview: (themeName: string) => void;\n\n\tconstructor(\n\t\tcurrentTheme: string,\n\t\tonSelect: (themeName: string) => void,\n\t\tonCancel: () => void,\n\t\tonPreview: (themeName: string) => void,\n\t) {\n\t\tsuper();\n\t\tthis.onPreview = onPreview;\n\n\t\t// Get available themes and create select items\n\t\tconst themes = getAvailableThemes();\n\t\tconst themeItems: SelectItem[] = themes.map((name) => ({\n\t\t\tvalue: name,\n\t\t\tlabel: name,\n\t\t\tdescription: name === currentTheme ? \"(current)\" : undefined,\n\t\t}));\n\n\t\t// Add top border\n\t\tthis.addChild(new DynamicBorder());\n\n\t\t// Create selector\n\t\tthis.selectList = new SelectList(themeItems, 10, getSelectListTheme(), THEME_SELECT_LIST_LAYOUT);\n\n\t\t// Preselect current theme\n\t\tconst currentIndex = themes.indexOf(currentTheme);\n\t\tif (currentIndex !== -1) {\n\t\t\tthis.selectList.setSelectedIndex(currentIndex);\n\t\t}\n\n\t\tthis.selectList.onSelect = (item) => {\n\t\t\tonSelect(item.value);\n\t\t};\n\n\t\tthis.selectList.onCancel = () => {\n\t\t\tonCancel();\n\t\t};\n\n\t\tthis.selectList.onSelectionChange = (item) => {\n\t\t\tthis.onPreview(item.value);\n\t\t};\n\n\t\tthis.addChild(this.selectList);\n\n\t\t// Add bottom border\n\t\tthis.addChild(new DynamicBorder());\n\t}\n\n\tgetSelectList(): SelectList {\n\t\treturn this.selectList;\n\t}\n}\n"]}
1
+ {"version":3,"file":"theme-selector.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/theme-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,UAAU,EAAgC,MAAM,iBAAiB,CAAC;AACvG,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,wBAAwB,GAA4B;IACzD,qBAAqB,EAAE,EAAE;IACzB,qBAA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,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAE/B,oBAAoB;QACpB,IAAI,CAAC,QAAQ,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,aAAa;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;CACD","sourcesContent":["import { Container, type SelectItem, SelectList, type SelectListLayoutOptions } from \"@orient-cli/tui\";\nimport { getAvailableThemes, getSelectListTheme } from \"../theme/theme.js\";\nimport { DynamicBorder } from \"./dynamic-border.js\";\n\nconst THEME_SELECT_LIST_LAYOUT: SelectListLayoutOptions = {\n\tminPrimaryColumnWidth: 12,\n\tmaxPrimaryColumnWidth: 32,\n};\n\n/**\n * Component that renders a theme selector\n */\nexport class ThemeSelectorComponent extends Container {\n\tprivate selectList: SelectList;\n\tprivate onPreview: (themeName: string) => void;\n\n\tconstructor(\n\t\tcurrentTheme: string,\n\t\tonSelect: (themeName: string) => void,\n\t\tonCancel: () => void,\n\t\tonPreview: (themeName: string) => void,\n\t) {\n\t\tsuper();\n\t\tthis.onPreview = onPreview;\n\n\t\t// Get available themes and create select items\n\t\tconst themes = getAvailableThemes();\n\t\tconst themeItems: SelectItem[] = themes.map((name) => ({\n\t\t\tvalue: name,\n\t\t\tlabel: name,\n\t\t\tdescription: name === currentTheme ? \"(current)\" : undefined,\n\t\t}));\n\n\t\t// Add top border\n\t\tthis.addChild(new DynamicBorder());\n\n\t\t// Create selector\n\t\tthis.selectList = new SelectList(themeItems, 10, getSelectListTheme(), THEME_SELECT_LIST_LAYOUT);\n\n\t\t// Preselect current theme\n\t\tconst currentIndex = themes.indexOf(currentTheme);\n\t\tif (currentIndex !== -1) {\n\t\t\tthis.selectList.setSelectedIndex(currentIndex);\n\t\t}\n\n\t\tthis.selectList.onSelect = (item) => {\n\t\t\tonSelect(item.value);\n\t\t};\n\n\t\tthis.selectList.onCancel = () => {\n\t\t\tonCancel();\n\t\t};\n\n\t\tthis.selectList.onSelectionChange = (item) => {\n\t\t\tthis.onPreview(item.value);\n\t\t};\n\n\t\tthis.addChild(this.selectList);\n\n\t\t// Add bottom border\n\t\tthis.addChild(new DynamicBorder());\n\t}\n\n\tgetSelectList(): SelectList {\n\t\treturn this.selectList;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"thinking-selector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/thinking-selector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAmB,UAAU,EAAgC,MAAM,iBAAiB,CAAC;AAkBvG;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,SAAS;IACvD,OAAO,CAAC,UAAU,CAAa;IAE/B,YACC,YAAY,EAAE,aAAa,EAC3B,eAAe,EAAE,aAAa,EAAE,EAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,EACxC,QAAQ,EAAE,MAAM,IAAI,EAuCpB;IAED,aAAa,IAAI,UAAU,CAE1B;CACD","sourcesContent":["import type { ThinkingLevel } from \"@orient-cli/agent-core\";\nimport { Container, type SelectItem, SelectList, type SelectListLayoutOptions } from \"@orient-cli/tui\";\nimport { getSelectListTheme } from \"../theme/theme.js\";\nimport { DynamicBorder } from \"./dynamic-border.js\";\n\nconst THINKING_SELECT_LIST_LAYOUT: SelectListLayoutOptions = {\n\tminPrimaryColumnWidth: 12,\n\tmaxPrimaryColumnWidth: 32,\n};\n\nconst LEVEL_DESCRIPTIONS: Record<ThinkingLevel, string> = {\n\toff: \"No reasoning\",\n\tminimal: \"Very brief reasoning (~1k tokens)\",\n\tlow: \"Light reasoning (~2k tokens)\",\n\tmedium: \"Moderate reasoning (~8k tokens)\",\n\thigh: \"Deep reasoning (~16k tokens)\",\n\txhigh: \"Maximum reasoning (~32k tokens)\",\n};\n\n/**\n * Component that renders a thinking level selector with borders\n */\nexport class ThinkingSelectorComponent extends Container {\n\tprivate selectList: SelectList;\n\n\tconstructor(\n\t\tcurrentLevel: ThinkingLevel,\n\t\tavailableLevels: ThinkingLevel[],\n\t\tonSelect: (level: ThinkingLevel) => void,\n\t\tonCancel: () => void,\n\t) {\n\t\tsuper();\n\n\t\tconst thinkingLevels: SelectItem[] = availableLevels.map((level) => ({\n\t\t\tvalue: level,\n\t\t\tlabel: level,\n\t\t\tdescription: LEVEL_DESCRIPTIONS[level],\n\t\t}));\n\n\t\t// Add top border\n\t\tthis.addChild(new DynamicBorder());\n\n\t\t// Create selector\n\t\tthis.selectList = new SelectList(\n\t\t\tthinkingLevels,\n\t\t\tthinkingLevels.length,\n\t\t\tgetSelectListTheme(),\n\t\t\tTHINKING_SELECT_LIST_LAYOUT,\n\t\t);\n\n\t\t// Preselect current level\n\t\tconst currentIndex = thinkingLevels.findIndex((item) => item.value === currentLevel);\n\t\tif (currentIndex !== -1) {\n\t\t\tthis.selectList.setSelectedIndex(currentIndex);\n\t\t}\n\n\t\tthis.selectList.onSelect = (item) => {\n\t\t\tonSelect(item.value as ThinkingLevel);\n\t\t};\n\n\t\tthis.selectList.onCancel = () => {\n\t\t\tonCancel();\n\t\t};\n\n\t\tthis.addChild(this.selectList);\n\n\t\t// Add bottom border\n\t\tthis.addChild(new DynamicBorder());\n\t}\n\n\tgetSelectList(): SelectList {\n\t\treturn this.selectList;\n\t}\n}\n"]}
1
+ {"version":3,"file":"thinking-selector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/thinking-selector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAmB,UAAU,EAAgC,MAAM,iBAAiB,CAAC;AAkBvG;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,SAAS;IACvD,OAAO,CAAC,UAAU,CAAa;gBAG9B,YAAY,EAAE,aAAa,EAC3B,eAAe,EAAE,aAAa,EAAE,EAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,EACxC,QAAQ,EAAE,MAAM,IAAI;IAyCrB,aAAa,IAAI,UAAU;CAG3B"}
@@ -17,7 +17,6 @@ const LEVEL_DESCRIPTIONS = {
17
17
  * Component that renders a thinking level selector with borders
18
18
  */
19
19
  export class ThinkingSelectorComponent extends Container {
20
- selectList;
21
20
  constructor(currentLevel, availableLevels, onSelect, onCancel) {
22
21
  super();
23
22
  const thinkingLevels = availableLevels.map((level) => ({
@@ -1 +1 @@
1
- {"version":3,"file":"thinking-selector.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/thinking-selector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAmB,UAAU,EAAgC,MAAM,iBAAiB,CAAC;AACvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,2BAA2B,GAA4B;IAC5D,qBAAqB,EAAE,EAAE;IACzB,qBAAqB,EAAE,EAAE;CACzB,CAAC;AAEF,MAAM,kBAAkB,GAAkC;IACzD,GAAG,EAAE,cAAc;IACnB,OAAO,EAAE,mCAAmC;IAC5C,GAAG,EAAE,8BAA8B;IACnC,MAAM,EAAE,iCAAiC;IACzC,IAAI,EAAE,8BAA8B;IACpC,KAAK,EAAE,iCAAiC;CACxC,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,SAAS;IAC/C,UAAU,CAAa;IAE/B,YACC,YAA2B,EAC3B,eAAgC,EAChC,QAAwC,EACxC,QAAoB,EACnB;QACD,KAAK,EAAE,CAAC;QAER,MAAM,cAAc,GAAiB,eAAe,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACpE,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,KAAK;YACZ,WAAW,EAAE,kBAAkB,CAAC,KAAK,CAAC;SACtC,CAAC,CAAC,CAAC;QAEJ,iBAAiB;QACjB,IAAI,CAAC,QAAQ,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;QAEnC,kBAAkB;QAClB,IAAI,CAAC,UAAU,GAAG,IAAI,UAAU,CAC/B,cAAc,EACd,cAAc,CAAC,MAAM,EACrB,kBAAkB,EAAE,EACpB,2BAA2B,CAC3B,CAAC;QAEF,0BAA0B;QAC1B,MAAM,YAAY,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,KAAK,YAAY,CAAC,CAAC;QACrF,IAAI,YAAY,KAAK,CAAC,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QAChD,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC;YACpC,QAAQ,CAAC,IAAI,CAAC,KAAsB,CAAC,CAAC;QAAA,CACtC,CAAC;QAEF,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,GAAG,EAAE,CAAC;YAChC,QAAQ,EAAE,CAAC;QAAA,CACX,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAE/B,oBAAoB;QACpB,IAAI,CAAC,QAAQ,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;IAAA,CACnC;IAED,aAAa,GAAe;QAC3B,OAAO,IAAI,CAAC,UAAU,CAAC;IAAA,CACvB;CACD","sourcesContent":["import type { ThinkingLevel } from \"@orient-cli/agent-core\";\nimport { Container, type SelectItem, SelectList, type SelectListLayoutOptions } from \"@orient-cli/tui\";\nimport { getSelectListTheme } from \"../theme/theme.js\";\nimport { DynamicBorder } from \"./dynamic-border.js\";\n\nconst THINKING_SELECT_LIST_LAYOUT: SelectListLayoutOptions = {\n\tminPrimaryColumnWidth: 12,\n\tmaxPrimaryColumnWidth: 32,\n};\n\nconst LEVEL_DESCRIPTIONS: Record<ThinkingLevel, string> = {\n\toff: \"No reasoning\",\n\tminimal: \"Very brief reasoning (~1k tokens)\",\n\tlow: \"Light reasoning (~2k tokens)\",\n\tmedium: \"Moderate reasoning (~8k tokens)\",\n\thigh: \"Deep reasoning (~16k tokens)\",\n\txhigh: \"Maximum reasoning (~32k tokens)\",\n};\n\n/**\n * Component that renders a thinking level selector with borders\n */\nexport class ThinkingSelectorComponent extends Container {\n\tprivate selectList: SelectList;\n\n\tconstructor(\n\t\tcurrentLevel: ThinkingLevel,\n\t\tavailableLevels: ThinkingLevel[],\n\t\tonSelect: (level: ThinkingLevel) => void,\n\t\tonCancel: () => void,\n\t) {\n\t\tsuper();\n\n\t\tconst thinkingLevels: SelectItem[] = availableLevels.map((level) => ({\n\t\t\tvalue: level,\n\t\t\tlabel: level,\n\t\t\tdescription: LEVEL_DESCRIPTIONS[level],\n\t\t}));\n\n\t\t// Add top border\n\t\tthis.addChild(new DynamicBorder());\n\n\t\t// Create selector\n\t\tthis.selectList = new SelectList(\n\t\t\tthinkingLevels,\n\t\t\tthinkingLevels.length,\n\t\t\tgetSelectListTheme(),\n\t\t\tTHINKING_SELECT_LIST_LAYOUT,\n\t\t);\n\n\t\t// Preselect current level\n\t\tconst currentIndex = thinkingLevels.findIndex((item) => item.value === currentLevel);\n\t\tif (currentIndex !== -1) {\n\t\t\tthis.selectList.setSelectedIndex(currentIndex);\n\t\t}\n\n\t\tthis.selectList.onSelect = (item) => {\n\t\t\tonSelect(item.value as ThinkingLevel);\n\t\t};\n\n\t\tthis.selectList.onCancel = () => {\n\t\t\tonCancel();\n\t\t};\n\n\t\tthis.addChild(this.selectList);\n\n\t\t// Add bottom border\n\t\tthis.addChild(new DynamicBorder());\n\t}\n\n\tgetSelectList(): SelectList {\n\t\treturn this.selectList;\n\t}\n}\n"]}
1
+ {"version":3,"file":"thinking-selector.js","sourceRoot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AC,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QAChD,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,CAAC,IAAI,EAAE,EAAE;YACnC,QAAQ,CAAC,IAAI,CAAC,KAAsB,CAAC,CAAC;QACvC,CAAC,CAAC;QAEF,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,GAAG,EAAE;YAC/B,QAAQ,EAAE,CAAC;QACZ,CAAC,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAE/B,oBAAoB;QACpB,IAAI,CAAC,QAAQ,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,aAAa;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;CACD","sourcesContent":["import type { ThinkingLevel } from \"@orient-cli/agent-core\";\nimport { Container, type SelectItem, SelectList, type SelectListLayoutOptions } from \"@orient-cli/tui\";\nimport { getSelectListTheme } from \"../theme/theme.js\";\nimport { DynamicBorder } from \"./dynamic-border.js\";\n\nconst THINKING_SELECT_LIST_LAYOUT: SelectListLayoutOptions = {\n\tminPrimaryColumnWidth: 12,\n\tmaxPrimaryColumnWidth: 32,\n};\n\nconst LEVEL_DESCRIPTIONS: Record<ThinkingLevel, string> = {\n\toff: \"No reasoning\",\n\tminimal: \"Very brief reasoning (~1k tokens)\",\n\tlow: \"Light reasoning (~2k tokens)\",\n\tmedium: \"Moderate reasoning (~8k tokens)\",\n\thigh: \"Deep reasoning (~16k tokens)\",\n\txhigh: \"Maximum reasoning (~32k tokens)\",\n};\n\n/**\n * Component that renders a thinking level selector with borders\n */\nexport class ThinkingSelectorComponent extends Container {\n\tprivate selectList: SelectList;\n\n\tconstructor(\n\t\tcurrentLevel: ThinkingLevel,\n\t\tavailableLevels: ThinkingLevel[],\n\t\tonSelect: (level: ThinkingLevel) => void,\n\t\tonCancel: () => void,\n\t) {\n\t\tsuper();\n\n\t\tconst thinkingLevels: SelectItem[] = availableLevels.map((level) => ({\n\t\t\tvalue: level,\n\t\t\tlabel: level,\n\t\t\tdescription: LEVEL_DESCRIPTIONS[level],\n\t\t}));\n\n\t\t// Add top border\n\t\tthis.addChild(new DynamicBorder());\n\n\t\t// Create selector\n\t\tthis.selectList = new SelectList(\n\t\t\tthinkingLevels,\n\t\t\tthinkingLevels.length,\n\t\t\tgetSelectListTheme(),\n\t\t\tTHINKING_SELECT_LIST_LAYOUT,\n\t\t);\n\n\t\t// Preselect current level\n\t\tconst currentIndex = thinkingLevels.findIndex((item) => item.value === currentLevel);\n\t\tif (currentIndex !== -1) {\n\t\t\tthis.selectList.setSelectedIndex(currentIndex);\n\t\t}\n\n\t\tthis.selectList.onSelect = (item) => {\n\t\t\tonSelect(item.value as ThinkingLevel);\n\t\t};\n\n\t\tthis.selectList.onCancel = () => {\n\t\t\tonCancel();\n\t\t};\n\n\t\tthis.addChild(this.selectList);\n\n\t\t// Add bottom border\n\t\tthis.addChild(new DynamicBorder());\n\t}\n\n\tgetSelectList(): SelectList {\n\t\treturn this.selectList;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"tool-execution.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,SAAS,EAAwC,KAAK,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACjH,OAAO,KAAK,EAAE,cAAc,EAAqB,MAAM,mCAAmC,CAAC;AAM3F,MAAM,WAAW,oBAAoB;IACpC,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,qBAAa,sBAAuB,SAAQ,SAAS;IACpD,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,WAAW,CAAO;IAC1B,OAAO,CAAC,qBAAqB,CAAC,CAAY;IAC1C,OAAO,CAAC,uBAAuB,CAAC,CAAY;IAC5C,OAAO,CAAC,aAAa,CA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AE,MAAM,CAAA;SAAE,CAAC,CAAC;QAClF,OAAO,CAAC,EAAE,GAAG,CAAC;QACd,OAAO,EAAE,OAAO,CAAC;KACjB,EACD,SAAS,UAAQ,GACf,IAAI,CAKN;IAED,OAAO,CAAC,0BAA0B;IAuBlC,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAGnC;IAED,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAGjC;IAEQ,UAAU,IAAI,IAAI,CAG1B;IAEQ,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAKvC;IAED,OAAO,CAAC,aAAa;IAyGrB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,mBAAmB;CAY3B","sourcesContent":["import { Box, type Component, Container, getCapabilities, Image, Spacer, Text, type TUI } from \"@orient-cli/tui\";\nimport type { ToolDefinition, ToolRenderContext } from \"../../../core/extensions/types.js\";\nimport { allToolDefinitions } from \"../../../core/tools/index.js\";\nimport { getTextOutput as getRenderedTextOutput } from \"../../../core/tools/render-utils.js\";\nimport { convertToPng } from \"../../../utils/image-convert.js\";\nimport { theme } from \"../theme/theme.js\";\n\nexport interface ToolExecutionOptions {\n\tshowImages?: boolean;\n}\n\nexport class ToolExecutionComponent extends Container {\n\tprivate contentBox: Box;\n\tprivate contentText: Text;\n\tprivate callRendererComponent?: Component;\n\tprivate resultRendererComponent?: Component;\n\tprivate rendererState: any = {};\n\tprivate imageComponents: Image[] = [];\n\tprivate imageSpacers: Spacer[] = [];\n\tprivate toolName: string;\n\tprivate toolCallId: string;\n\tprivate args: any;\n\tprivate expanded = false;\n\tprivate showImages: boolean;\n\tprivate isPartial = true;\n\tprivate toolDefinition?: ToolDefinition<any, any>;\n\tprivate builtInToolDefinition?: ToolDefinition<any, any>;\n\tprivate ui: TUI;\n\tprivate cwd: string;\n\tprivate executionStarted = false;\n\tprivate argsComplete = false;\n\tprivate result?: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tisError: boolean;\n\t\tdetails?: any;\n\t};\n\tprivate convertedImages: Map<number, { data: string; mimeType: string }> = new Map();\n\tprivate hideComponent = false;\n\n\tconstructor(\n\t\ttoolName: string,\n\t\ttoolCallId: string,\n\t\targs: any,\n\t\toptions: ToolExecutionOptions = {},\n\t\ttoolDefinition: ToolDefinition<any, any> | undefined,\n\t\tui: TUI,\n\t\tcwd: string = process.cwd(),\n\t) {\n\t\tsuper();\n\t\tthis.toolName = toolName;\n\t\tthis.toolCallId = toolCallId;\n\t\tthis.args = args;\n\t\tthis.toolDefinition = toolDefinition;\n\t\tthis.builtInToolDefinition = allToolDefinitions[toolName as keyof typeof allToolDefinitions];\n\t\tthis.showImages = options.showImages ?? true;\n\t\tthis.ui = ui;\n\t\tthis.cwd = cwd;\n\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// Always create both. contentBox is used for tools with renderer-based call/result composition.\n\t\t// contentText is reserved for generic fallback rendering when no tool definition exists.\n\t\tthis.contentBox = new Box(1, 1, (text: string) => theme.bg(\"toolPendingBg\", text));\n\t\tthis.contentText = new Text(\"\", 1, 1, (text: string) => theme.bg(\"toolPendingBg\", text));\n\n\t\tif (this.hasRendererDefinition()) {\n\t\t\tthis.addChild(this.contentBox);\n\t\t} else {\n\t\t\tthis.addChild(this.contentText);\n\t\t}\n\n\t\tthis.updateDisplay();\n\t}\n\n\tprivate getCallRenderer(): ToolDefinition<any, any>[\"renderCall\"] | undefined {\n\t\tif (!this.builtInToolDefinition) {\n\t\t\treturn this.toolDefinition?.renderCall;\n\t\t}\n\t\tif (!this.toolDefinition) {\n\t\t\treturn this.builtInToolDefinition.renderCall;\n\t\t}\n\t\treturn this.toolDefinition.renderCall ?? this.builtInToolDefinition.renderCall;\n\t}\n\n\tprivate getResultRenderer(): ToolDefinition<any, any>[\"renderResult\"] | undefined {\n\t\tif (!this.builtInToolDefinition) {\n\t\t\treturn this.toolDefinition?.renderResult;\n\t\t}\n\t\tif (!this.toolDefinition) {\n\t\t\treturn this.builtInToolDefinition.renderResult;\n\t\t}\n\t\treturn this.toolDefinition.renderResult ?? this.builtInToolDefinition.renderResult;\n\t}\n\n\tprivate hasRendererDefinition(): boolean {\n\t\treturn this.builtInToolDefinition !== undefined || this.toolDefinition !== undefined;\n\t}\n\n\tprivate getRenderContext(lastComponent: Component | undefined): ToolRenderContext {\n\t\treturn {\n\t\t\targs: this.args,\n\t\t\ttoolCallId: this.toolCallId,\n\t\t\tinvalidate: () => {\n\t\t\t\tthis.invalidate();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t},\n\t\t\tlastComponent,\n\t\t\tstate: this.rendererState,\n\t\t\tcwd: this.cwd,\n\t\t\texecutionStarted: this.executionStarted,\n\t\t\targsComplete: this.argsComplete,\n\t\t\tisPartial: this.isPartial,\n\t\t\texpanded: this.expanded,\n\t\t\tshowImages: this.showImages,\n\t\t\tisError: this.result?.isError ?? false,\n\t\t};\n\t}\n\n\tprivate createCallFallback(): Component {\n\t\treturn new Text(theme.fg(\"toolTitle\", theme.bold(this.toolName)), 0, 0);\n\t}\n\n\tprivate createResultFallback(): Component | undefined {\n\t\tconst output = this.getTextOutput();\n\t\tif (!output) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn new Text(theme.fg(\"toolOutput\", output), 0, 0);\n\t}\n\n\tupdateArgs(args: any): void {\n\t\tthis.args = args;\n\t\tthis.updateDisplay();\n\t}\n\n\tmarkExecutionStarted(): void {\n\t\tthis.executionStarted = true;\n\t\tthis.updateDisplay();\n\t\tthis.ui.requestRender();\n\t}\n\n\tsetArgsComplete(): void {\n\t\tthis.argsComplete = true;\n\t\tthis.updateDisplay();\n\t\tthis.ui.requestRender();\n\t}\n\n\tupdateResult(\n\t\tresult: {\n\t\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\t\tdetails?: any;\n\t\t\tisError: boolean;\n\t\t},\n\t\tisPartial = false,\n\t): void {\n\t\tthis.result = result;\n\t\tthis.isPartial = isPartial;\n\t\tthis.updateDisplay();\n\t\tthis.maybeConvertImagesForKitty();\n\t}\n\n\tprivate maybeConvertImagesForKitty(): void {\n\t\tconst caps = getCapabilities();\n\t\tif (caps.images !== \"kitty\") return;\n\t\tif (!this.result) return;\n\n\t\tconst imageBlocks = this.result.content.filter((c) => c.type === \"image\");\n\t\tfor (let i = 0; i < imageBlocks.length; i++) {\n\t\t\tconst img = imageBlocks[i];\n\t\t\tif (!img.data || !img.mimeType) continue;\n\t\t\tif (img.mimeType === \"image/png\") continue;\n\t\t\tif (this.convertedImages.has(i)) continue;\n\n\t\t\tconst index = i;\n\t\t\tconvertToPng(img.data, img.mimeType).then((converted) => {\n\t\t\t\tif (converted) {\n\t\t\t\t\tthis.convertedImages.set(index, converted);\n\t\t\t\t\tthis.updateDisplay();\n\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetShowImages(show: boolean): void {\n\t\tthis.showImages = show;\n\t\tthis.updateDisplay();\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tthis.updateDisplay();\n\t}\n\n\toverride render(width: number): string[] {\n\t\tif (this.hideComponent) {\n\t\t\treturn [];\n\t\t}\n\t\treturn super.render(width);\n\t}\n\n\tprivate updateDisplay(): void {\n\t\tconst bgFn = this.isPartial\n\t\t\t? (text: string) => theme.bg(\"toolPendingBg\", text)\n\t\t\t: this.result?.isError\n\t\t\t\t? (text: string) => theme.bg(\"toolErrorBg\", text)\n\t\t\t\t: (text: string) => theme.bg(\"toolSuccessBg\", text);\n\n\t\tlet hasContent = false;\n\t\tthis.hideComponent = false;\n\t\tif (this.hasRendererDefinition()) {\n\t\t\tthis.contentBox.setBgFn(bgFn);\n\t\t\tthis.contentBox.clear();\n\n\t\t\tconst callRenderer = this.getCallRenderer();\n\t\t\tif (!callRenderer) {\n\t\t\t\tthis.contentBox.addChild(this.createCallFallback());\n\t\t\t\thasContent = true;\n\t\t\t} else {\n\t\t\t\ttry {\n\t\t\t\t\tconst component = callRenderer(this.args, theme, this.getRenderContext(this.callRendererComponent));\n\t\t\t\t\tthis.callRendererComponent = component;\n\t\t\t\t\tthis.contentBox.addChild(component);\n\t\t\t\t\thasContent = true;\n\t\t\t\t} catch {\n\t\t\t\t\tthis.callRendererComponent = undefined;\n\t\t\t\t\tthis.contentBox.addChild(this.createCallFallback());\n\t\t\t\t\thasContent = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.result) {\n\t\t\t\tconst resultRenderer = this.getResultRenderer();\n\t\t\t\tif (!resultRenderer) {\n\t\t\t\t\tconst component = this.createResultFallback();\n\t\t\t\t\tif (component) {\n\t\t\t\t\t\tthis.contentBox.addChild(component);\n\t\t\t\t\t\thasContent = true;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst component = resultRenderer(\n\t\t\t\t\t\t\t{ content: this.result.content as any, details: this.result.details },\n\t\t\t\t\t\t\t{ expanded: this.expanded, isPartial: this.isPartial },\n\t\t\t\t\t\t\ttheme,\n\t\t\t\t\t\t\tthis.getRenderContext(this.resultRendererComponent),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.resultRendererComponent = component;\n\t\t\t\t\t\tthis.contentBox.addChild(component);\n\t\t\t\t\t\thasContent = true;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\tthis.resultRendererComponent = undefined;\n\t\t\t\t\t\tconst component = this.createResultFallback();\n\t\t\t\t\t\tif (component) {\n\t\t\t\t\t\t\tthis.contentBox.addChild(component);\n\t\t\t\t\t\t\thasContent = true;\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} else {\n\t\t\tthis.contentText.setCustomBgFn(bgFn);\n\t\t\tthis.contentText.setText(this.formatToolExecution());\n\t\t\thasContent = true;\n\t\t}\n\n\t\tfor (const img of this.imageComponents) {\n\t\t\tthis.removeChild(img);\n\t\t}\n\t\tthis.imageComponents = [];\n\t\tfor (const spacer of this.imageSpacers) {\n\t\t\tthis.removeChild(spacer);\n\t\t}\n\t\tthis.imageSpacers = [];\n\n\t\tif (this.result) {\n\t\t\tconst imageBlocks = this.result.content.filter((c) => c.type === \"image\");\n\t\t\tconst caps = getCapabilities();\n\t\t\tfor (let i = 0; i < imageBlocks.length; i++) {\n\t\t\t\tconst img = imageBlocks[i];\n\t\t\t\tif (caps.images && this.showImages && img.data && img.mimeType) {\n\t\t\t\t\tconst converted = this.convertedImages.get(i);\n\t\t\t\t\tconst imageData = converted?.data ?? img.data;\n\t\t\t\t\tconst imageMimeType = converted?.mimeType ?? img.mimeType;\n\t\t\t\t\tif (caps.images === \"kitty\" && imageMimeType !== \"image/png\") continue;\n\n\t\t\t\t\tconst spacer = new Spacer(1);\n\t\t\t\t\tthis.addChild(spacer);\n\t\t\t\t\tthis.imageSpacers.push(spacer);\n\t\t\t\t\tconst imageComponent = new Image(\n\t\t\t\t\t\timageData,\n\t\t\t\t\t\timageMimeType,\n\t\t\t\t\t\t{ fallbackColor: (s: string) => theme.fg(\"toolOutput\", s) },\n\t\t\t\t\t\t{ maxWidthCells: 60 },\n\t\t\t\t\t);\n\t\t\t\t\tthis.imageComponents.push(imageComponent);\n\t\t\t\t\tthis.addChild(imageComponent);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (this.hasRendererDefinition() && !hasContent && this.imageComponents.length === 0) {\n\t\t\tthis.hideComponent = true;\n\t\t}\n\t}\n\n\tprivate getTextOutput(): string {\n\t\treturn getRenderedTextOutput(this.result, this.showImages);\n\t}\n\n\tprivate formatToolExecution(): string {\n\t\tlet text = theme.fg(\"toolTitle\", theme.bold(this.toolName));\n\t\tconst content = JSON.stringify(this.args, null, 2);\n\t\tif (content) {\n\t\t\ttext += `\\n\\n${content}`;\n\t\t}\n\t\tconst output = this.getTextOutput();\n\t\tif (output) {\n\t\t\ttext += `\\n${output}`;\n\t\t}\n\t\treturn text;\n\t}\n}\n"]}
1
+ {"version":3,"file":"tool-execution.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,SAAS,EAAwC,KAAK,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACjH,OAAO,KAAK,EAAE,cAAc,EAAqB,MAAM,mCAAmC,CAAC;AAM3F,MAAM,WAAW,oBAAoB;IACpC,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,qBAAa,sBAAuB,SAAQ,SAAS;IACpD,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,WAAW,CAAO;IAC1B,OAAO,CAAC,qBAAqB,CAAC,CAAY;IAC1C,OAAO,CAAC,uBAAuB,CAAC,CAAY;IAC5C,OAAO,CAAC,aAAa,CAAW;IAChC,OAAO,CAAC,eAAe,CAAe;IACtC,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,IAAI,CAAM;IAClB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,CAAU;IAC5B,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,cAAc,CAAC,CAA2B;IAClD,OAAO,CAAC,qBAAqB,CAAC,CAA2B;IACzD,OAAO,CAAC,EAAE,CAAM;IAChB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,MAAM,CAAC,CAIb;IACF,OAAO,CAAC,eAAe,CAA8D;IACrF,OAAO,CAAC,aAAa,CAAS;gBAG7B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,GAAG,EACT,OAAO,EAAE,oBAAoB,YAAK,EAClC,cAAc,EAAE,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,SAAS,EACpD,EAAE,EAAE,GAAG,EACP,GAAG,GAAE,MAAsB;IA4B5B,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,oBAAoB;IAQ5B,UAAU,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI;IAK3B,oBAAoB,IAAI,IAAI;IAM5B,eAAe,IAAI,IAAI;IAMvB,YAAY,CACX,MAAM,EAAE;QACP,OAAO,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAClF,OAAO,CAAC,EAAE,GAAG,CAAC;QACd,OAAO,EAAE,OAAO,CAAC;KACjB,EACD,SAAS,UAAQ,GACf,IAAI;IAOP,OAAO,CAAC,0BAA0B;IAuBlC,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAKpC,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAKzB,UAAU,IAAI,IAAI;IAKlB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IAOxC,OAAO,CAAC,aAAa;IAyGrB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,mBAAmB;CAY3B"}
@@ -4,30 +4,17 @@ import { getTextOutput as getRenderedTextOutput } from "../../../core/tools/rend
4
4
  import { convertToPng } from "../../../utils/image-convert.js";
5
5
  import { theme } from "../theme/theme.js";
6
6
  export class ToolExecutionComponent extends Container {
7
- contentBox;
8
- contentText;
9
- callRendererComponent;
10
- resultRendererComponent;
11
- rendererState = {};
12
- imageComponents = [];
13
- imageSpacers = [];
14
- toolName;
15
- toolCallId;
16
- args;
17
- expanded = false;
18
- showImages;
19
- isPartial = true;
20
- toolDefinition;
21
- builtInToolDefinition;
22
- ui;
23
- cwd;
24
- executionStarted = false;
25
- argsComplete = false;
26
- result;
27
- convertedImages = new Map();
28
- hideComponent = false;
29
7
  constructor(toolName, toolCallId, args, options = {}, toolDefinition, ui, cwd = process.cwd()) {
30
8
  super();
9
+ this.rendererState = {};
10
+ this.imageComponents = [];
11
+ this.imageSpacers = [];
12
+ this.expanded = false;
13
+ this.isPartial = true;
14
+ this.executionStarted = false;
15
+ this.argsComplete = false;
16
+ this.convertedImages = new Map();
17
+ this.hideComponent = false;
31
18
  this.toolName = toolName;
32
19
  this.toolCallId = toolCallId;
33
20
  this.args = args;
@@ -1 +1 @@
1
- {"version":3,"file":"tool-execution.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAkB,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAY,MAAM,iBAAiB,CAAC;AAEjH,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAM1C,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IAC5C,UAAU,CAAM;IAChB,WAAW,CAAO;IAClB,qBAAqB,CAAa;IAClC,uBAAuB,CAAa;IACpC,aAAa,GAAQ,EAAE,CAAC;IACxB,eAAe,GAAY,EAAE,CAAC;IAC9B,YAAY,GAAa,EAAE,CAAC;IAC5B,QAAQ,CAAS;IACjB,UAAU,CAAS;IACnB,IAAI,CAAM;IACV,QAAQ,GAAG,KAAK,CAAC;IACjB,UAAU,CAAU;IACpB,SAAS,GAAG,IAAI,CAAC;IACj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EAAE,EAAE,EAAE,CACrB,CAAC;oBACF,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;oBAC1C,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;gBAC/B,CAAC;YACF,CAAC;QACF,CAAC;QAED,IAAI,IAAI,CAAC,qBAAqB,EAAE,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtF,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC3B,CAAC;IAAA,CACD;IAEO,aAAa,GAAW;QAC/B,OAAO,qBAAqB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAAA,CAC3D;IAEO,mBAAmB,GAAW;QACrC,IAAI,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACnD,IAAI,OAAO,EAAE,CAAC;YACb,IAAI,IAAI,OAAO,OAAO,EAAE,CAAC;QAC1B,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACpC,IAAI,MAAM,EAAE,CAAC;YACZ,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QACvB,CAAC;QACD,OAAO,IAAI,CAAC;IAAA,CACZ;CACD","sourcesContent":["import { Box, type Component, Container, getCapabilities, Image, Spacer, Text, type TUI } from \"@orient-cli/tui\";\nimport type { ToolDefinition, ToolRenderContext } from \"../../../core/extensions/types.js\";\nimport { allToolDefinitions } from \"../../../core/tools/index.js\";\nimport { getTextOutput as getRenderedTextOutput } from \"../../../core/tools/render-utils.js\";\nimport { convertToPng } from \"../../../utils/image-convert.js\";\nimport { theme } from \"../theme/theme.js\";\n\nexport interface ToolExecutionOptions {\n\tshowImages?: boolean;\n}\n\nexport class ToolExecutionComponent extends Container {\n\tprivate contentBox: Box;\n\tprivate contentText: Text;\n\tprivate callRendererComponent?: Component;\n\tprivate resultRendererComponent?: Component;\n\tprivate rendererState: any = {};\n\tprivate imageComponents: Image[] = [];\n\tprivate imageSpacers: Spacer[] = [];\n\tprivate toolName: string;\n\tprivate toolCallId: string;\n\tprivate args: any;\n\tprivate expanded = false;\n\tprivate showImages: boolean;\n\tprivate isPartial = true;\n\tprivate toolDefinition?: ToolDefinition<any, any>;\n\tprivate builtInToolDefinition?: ToolDefinition<any, any>;\n\tprivate ui: TUI;\n\tprivate cwd: string;\n\tprivate executionStarted = false;\n\tprivate argsComplete = false;\n\tprivate result?: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tisError: boolean;\n\t\tdetails?: any;\n\t};\n\tprivate convertedImages: Map<number, { data: string; mimeType: string }> = new Map();\n\tprivate hideComponent = false;\n\n\tconstructor(\n\t\ttoolName: string,\n\t\ttoolCallId: string,\n\t\targs: any,\n\t\toptions: ToolExecutionOptions = {},\n\t\ttoolDefinition: ToolDefinition<any, any> | undefined,\n\t\tui: TUI,\n\t\tcwd: string = process.cwd(),\n\t) {\n\t\tsuper();\n\t\tthis.toolName = toolName;\n\t\tthis.toolCallId = toolCallId;\n\t\tthis.args = args;\n\t\tthis.toolDefinition = toolDefinition;\n\t\tthis.builtInToolDefinition = allToolDefinitions[toolName as keyof typeof allToolDefinitions];\n\t\tthis.showImages = options.showImages ?? true;\n\t\tthis.ui = ui;\n\t\tthis.cwd = cwd;\n\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// Always create both. contentBox is used for tools with renderer-based call/result composition.\n\t\t// contentText is reserved for generic fallback rendering when no tool definition exists.\n\t\tthis.contentBox = new Box(1, 1, (text: string) => theme.bg(\"toolPendingBg\", text));\n\t\tthis.contentText = new Text(\"\", 1, 1, (text: string) => theme.bg(\"toolPendingBg\", text));\n\n\t\tif (this.hasRendererDefinition()) {\n\t\t\tthis.addChild(this.contentBox);\n\t\t} else {\n\t\t\tthis.addChild(this.contentText);\n\t\t}\n\n\t\tthis.updateDisplay();\n\t}\n\n\tprivate getCallRenderer(): ToolDefinition<any, any>[\"renderCall\"] | undefined {\n\t\tif (!this.builtInToolDefinition) {\n\t\t\treturn this.toolDefinition?.renderCall;\n\t\t}\n\t\tif (!this.toolDefinition) {\n\t\t\treturn this.builtInToolDefinition.renderCall;\n\t\t}\n\t\treturn this.toolDefinition.renderCall ?? this.builtInToolDefinition.renderCall;\n\t}\n\n\tprivate getResultRenderer(): ToolDefinition<any, any>[\"renderResult\"] | undefined {\n\t\tif (!this.builtInToolDefinition) {\n\t\t\treturn this.toolDefinition?.renderResult;\n\t\t}\n\t\tif (!this.toolDefinition) {\n\t\t\treturn this.builtInToolDefinition.renderResult;\n\t\t}\n\t\treturn this.toolDefinition.renderResult ?? this.builtInToolDefinition.renderResult;\n\t}\n\n\tprivate hasRendererDefinition(): boolean {\n\t\treturn this.builtInToolDefinition !== undefined || this.toolDefinition !== undefined;\n\t}\n\n\tprivate getRenderContext(lastComponent: Component | undefined): ToolRenderContext {\n\t\treturn {\n\t\t\targs: this.args,\n\t\t\ttoolCallId: this.toolCallId,\n\t\t\tinvalidate: () => {\n\t\t\t\tthis.invalidate();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t},\n\t\t\tlastComponent,\n\t\t\tstate: this.rendererState,\n\t\t\tcwd: this.cwd,\n\t\t\texecutionStarted: this.executionStarted,\n\t\t\targsComplete: this.argsComplete,\n\t\t\tisPartial: this.isPartial,\n\t\t\texpanded: this.expanded,\n\t\t\tshowImages: this.showImages,\n\t\t\tisError: this.result?.isError ?? false,\n\t\t};\n\t}\n\n\tprivate createCallFallback(): Component {\n\t\treturn new Text(theme.fg(\"toolTitle\", theme.bold(this.toolName)), 0, 0);\n\t}\n\n\tprivate createResultFallback(): Component | undefined {\n\t\tconst output = this.getTextOutput();\n\t\tif (!output) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn new Text(theme.fg(\"toolOutput\", output), 0, 0);\n\t}\n\n\tupdateArgs(args: any): void {\n\t\tthis.args = args;\n\t\tthis.updateDisplay();\n\t}\n\n\tmarkExecutionStarted(): void {\n\t\tthis.executionStarted = true;\n\t\tthis.updateDisplay();\n\t\tthis.ui.requestRender();\n\t}\n\n\tsetArgsComplete(): void {\n\t\tthis.argsComplete = true;\n\t\tthis.updateDisplay();\n\t\tthis.ui.requestRender();\n\t}\n\n\tupdateResult(\n\t\tresult: {\n\t\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\t\tdetails?: any;\n\t\t\tisError: boolean;\n\t\t},\n\t\tisPartial = false,\n\t): void {\n\t\tthis.result = result;\n\t\tthis.isPartial = isPartial;\n\t\tthis.updateDisplay();\n\t\tthis.maybeConvertImagesForKitty();\n\t}\n\n\tprivate maybeConvertImagesForKitty(): void {\n\t\tconst caps = getCapabilities();\n\t\tif (caps.images !== \"kitty\") return;\n\t\tif (!this.result) return;\n\n\t\tconst imageBlocks = this.result.content.filter((c) => c.type === \"image\");\n\t\tfor (let i = 0; i < imageBlocks.length; i++) {\n\t\t\tconst img = imageBlocks[i];\n\t\t\tif (!img.data || !img.mimeType) continue;\n\t\t\tif (img.mimeType === \"image/png\") continue;\n\t\t\tif (this.convertedImages.has(i)) continue;\n\n\t\t\tconst index = i;\n\t\t\tconvertToPng(img.data, img.mimeType).then((converted) => {\n\t\t\t\tif (converted) {\n\t\t\t\t\tthis.convertedImages.set(index, converted);\n\t\t\t\t\tthis.updateDisplay();\n\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetShowImages(show: boolean): void {\n\t\tthis.showImages = show;\n\t\tthis.updateDisplay();\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tthis.updateDisplay();\n\t}\n\n\toverride render(width: number): string[] {\n\t\tif (this.hideComponent) {\n\t\t\treturn [];\n\t\t}\n\t\treturn super.render(width);\n\t}\n\n\tprivate updateDisplay(): void {\n\t\tconst bgFn = this.isPartial\n\t\t\t? (text: string) => theme.bg(\"toolPendingBg\", text)\n\t\t\t: this.result?.isError\n\t\t\t\t? (text: string) => theme.bg(\"toolErrorBg\", text)\n\t\t\t\t: (text: string) => theme.bg(\"toolSuccessBg\", text);\n\n\t\tlet hasContent = false;\n\t\tthis.hideComponent = false;\n\t\tif (this.hasRendererDefinition()) {\n\t\t\tthis.contentBox.setBgFn(bgFn);\n\t\t\tthis.contentBox.clear();\n\n\t\t\tconst callRenderer = this.getCallRenderer();\n\t\t\tif (!callRenderer) {\n\t\t\t\tthis.contentBox.addChild(this.createCallFallback());\n\t\t\t\thasContent = true;\n\t\t\t} else {\n\t\t\t\ttry {\n\t\t\t\t\tconst component = callRenderer(this.args, theme, this.getRenderContext(this.callRendererComponent));\n\t\t\t\t\tthis.callRendererComponent = component;\n\t\t\t\t\tthis.contentBox.addChild(component);\n\t\t\t\t\thasContent = true;\n\t\t\t\t} catch {\n\t\t\t\t\tthis.callRendererComponent = undefined;\n\t\t\t\t\tthis.contentBox.addChild(this.createCallFallback());\n\t\t\t\t\thasContent = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.result) {\n\t\t\t\tconst resultRenderer = this.getResultRenderer();\n\t\t\t\tif (!resultRenderer) {\n\t\t\t\t\tconst component = this.createResultFallback();\n\t\t\t\t\tif (component) {\n\t\t\t\t\t\tthis.contentBox.addChild(component);\n\t\t\t\t\t\thasContent = true;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst component = resultRenderer(\n\t\t\t\t\t\t\t{ content: this.result.content as any, details: this.result.details },\n\t\t\t\t\t\t\t{ expanded: this.expanded, isPartial: this.isPartial },\n\t\t\t\t\t\t\ttheme,\n\t\t\t\t\t\t\tthis.getRenderContext(this.resultRendererComponent),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.resultRendererComponent = component;\n\t\t\t\t\t\tthis.contentBox.addChild(component);\n\t\t\t\t\t\thasContent = true;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\tthis.resultRendererComponent = undefined;\n\t\t\t\t\t\tconst component = this.createResultFallback();\n\t\t\t\t\t\tif (component) {\n\t\t\t\t\t\t\tthis.contentBox.addChild(component);\n\t\t\t\t\t\t\thasContent = true;\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} else {\n\t\t\tthis.contentText.setCustomBgFn(bgFn);\n\t\t\tthis.contentText.setText(this.formatToolExecution());\n\t\t\thasContent = true;\n\t\t}\n\n\t\tfor (const img of this.imageComponents) {\n\t\t\tthis.removeChild(img);\n\t\t}\n\t\tthis.imageComponents = [];\n\t\tfor (const spacer of this.imageSpacers) {\n\t\t\tthis.removeChild(spacer);\n\t\t}\n\t\tthis.imageSpacers = [];\n\n\t\tif (this.result) {\n\t\t\tconst imageBlocks = this.result.content.filter((c) => c.type === \"image\");\n\t\t\tconst caps = getCapabilities();\n\t\t\tfor (let i = 0; i < imageBlocks.length; i++) {\n\t\t\t\tconst img = imageBlocks[i];\n\t\t\t\tif (caps.images && this.showImages && img.data && img.mimeType) {\n\t\t\t\t\tconst converted = this.convertedImages.get(i);\n\t\t\t\t\tconst imageData = converted?.data ?? img.data;\n\t\t\t\t\tconst imageMimeType = converted?.mimeType ?? img.mimeType;\n\t\t\t\t\tif (caps.images === \"kitty\" && imageMimeType !== \"image/png\") continue;\n\n\t\t\t\t\tconst spacer = new Spacer(1);\n\t\t\t\t\tthis.addChild(spacer);\n\t\t\t\t\tthis.imageSpacers.push(spacer);\n\t\t\t\t\tconst imageComponent = new Image(\n\t\t\t\t\t\timageData,\n\t\t\t\t\t\timageMimeType,\n\t\t\t\t\t\t{ fallbackColor: (s: string) => theme.fg(\"toolOutput\", s) },\n\t\t\t\t\t\t{ maxWidthCells: 60 },\n\t\t\t\t\t);\n\t\t\t\t\tthis.imageComponents.push(imageComponent);\n\t\t\t\t\tthis.addChild(imageComponent);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (this.hasRendererDefinition() && !hasContent && this.imageComponents.length === 0) {\n\t\t\tthis.hideComponent = true;\n\t\t}\n\t}\n\n\tprivate getTextOutput(): string {\n\t\treturn getRenderedTextOutput(this.result, this.showImages);\n\t}\n\n\tprivate formatToolExecution(): string {\n\t\tlet text = theme.fg(\"toolTitle\", theme.bold(this.toolName));\n\t\tconst content = JSON.stringify(this.args, null, 2);\n\t\tif (content) {\n\t\t\ttext += `\\n\\n${content}`;\n\t\t}\n\t\tconst output = this.getTextOutput();\n\t\tif (output) {\n\t\t\ttext += `\\n${output}`;\n\t\t}\n\t\treturn text;\n\t}\n}\n"]}
1
+ {"version":3,"file":"tool-execution.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAkB,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAY,MAAM,iBAAiB,CAAC;AAEjH,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAM1C,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IA4BpD,YACC,QAAgB,EAChB,UAAkB,EAClB,IAAS,EACT,UAAgC,EAAE,EAClC,cAAoD,EACpD,EAAO,EACP,MAAc,OAAO,CAAC,GAAG,EAAE;QAE3B,KAAK,EAAE,CAAC;QAhCD,kBAAa,GAAQ,EAAE,CAAC;QACx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IAAI,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtF,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC3B,CAAC;IACF,CAAC;IAEO,aAAa;QACpB,OAAO,qBAAqB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5D,CAAC;IAEO,mBAAmB;QAC1B,IAAI,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACnD,IAAI,OAAO,EAAE,CAAC;YACb,IAAI,IAAI,OAAO,OAAO,EAAE,CAAC;QAC1B,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACpC,IAAI,MAAM,EAAE,CAAC;YACZ,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QACvB,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD","sourcesContent":["import { Box, type Component, Container, getCapabilities, Image, Spacer, Text, type TUI } from \"@orient-cli/tui\";\nimport type { ToolDefinition, ToolRenderContext } from \"../../../core/extensions/types.js\";\nimport { allToolDefinitions } from \"../../../core/tools/index.js\";\nimport { getTextOutput as getRenderedTextOutput } from \"../../../core/tools/render-utils.js\";\nimport { convertToPng } from \"../../../utils/image-convert.js\";\nimport { theme } from \"../theme/theme.js\";\n\nexport interface ToolExecutionOptions {\n\tshowImages?: boolean;\n}\n\nexport class ToolExecutionComponent extends Container {\n\tprivate contentBox: Box;\n\tprivate contentText: Text;\n\tprivate callRendererComponent?: Component;\n\tprivate resultRendererComponent?: Component;\n\tprivate rendererState: any = {};\n\tprivate imageComponents: Image[] = [];\n\tprivate imageSpacers: Spacer[] = [];\n\tprivate toolName: string;\n\tprivate toolCallId: string;\n\tprivate args: any;\n\tprivate expanded = false;\n\tprivate showImages: boolean;\n\tprivate isPartial = true;\n\tprivate toolDefinition?: ToolDefinition<any, any>;\n\tprivate builtInToolDefinition?: ToolDefinition<any, any>;\n\tprivate ui: TUI;\n\tprivate cwd: string;\n\tprivate executionStarted = false;\n\tprivate argsComplete = false;\n\tprivate result?: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tisError: boolean;\n\t\tdetails?: any;\n\t};\n\tprivate convertedImages: Map<number, { data: string; mimeType: string }> = new Map();\n\tprivate hideComponent = false;\n\n\tconstructor(\n\t\ttoolName: string,\n\t\ttoolCallId: string,\n\t\targs: any,\n\t\toptions: ToolExecutionOptions = {},\n\t\ttoolDefinition: ToolDefinition<any, any> | undefined,\n\t\tui: TUI,\n\t\tcwd: string = process.cwd(),\n\t) {\n\t\tsuper();\n\t\tthis.toolName = toolName;\n\t\tthis.toolCallId = toolCallId;\n\t\tthis.args = args;\n\t\tthis.toolDefinition = toolDefinition;\n\t\tthis.builtInToolDefinition = allToolDefinitions[toolName as keyof typeof allToolDefinitions];\n\t\tthis.showImages = options.showImages ?? true;\n\t\tthis.ui = ui;\n\t\tthis.cwd = cwd;\n\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// Always create both. contentBox is used for tools with renderer-based call/result composition.\n\t\t// contentText is reserved for generic fallback rendering when no tool definition exists.\n\t\tthis.contentBox = new Box(1, 1, (text: string) => theme.bg(\"toolPendingBg\", text));\n\t\tthis.contentText = new Text(\"\", 1, 1, (text: string) => theme.bg(\"toolPendingBg\", text));\n\n\t\tif (this.hasRendererDefinition()) {\n\t\t\tthis.addChild(this.contentBox);\n\t\t} else {\n\t\t\tthis.addChild(this.contentText);\n\t\t}\n\n\t\tthis.updateDisplay();\n\t}\n\n\tprivate getCallRenderer(): ToolDefinition<any, any>[\"renderCall\"] | undefined {\n\t\tif (!this.builtInToolDefinition) {\n\t\t\treturn this.toolDefinition?.renderCall;\n\t\t}\n\t\tif (!this.toolDefinition) {\n\t\t\treturn this.builtInToolDefinition.renderCall;\n\t\t}\n\t\treturn this.toolDefinition.renderCall ?? this.builtInToolDefinition.renderCall;\n\t}\n\n\tprivate getResultRenderer(): ToolDefinition<any, any>[\"renderResult\"] | undefined {\n\t\tif (!this.builtInToolDefinition) {\n\t\t\treturn this.toolDefinition?.renderResult;\n\t\t}\n\t\tif (!this.toolDefinition) {\n\t\t\treturn this.builtInToolDefinition.renderResult;\n\t\t}\n\t\treturn this.toolDefinition.renderResult ?? this.builtInToolDefinition.renderResult;\n\t}\n\n\tprivate hasRendererDefinition(): boolean {\n\t\treturn this.builtInToolDefinition !== undefined || this.toolDefinition !== undefined;\n\t}\n\n\tprivate getRenderContext(lastComponent: Component | undefined): ToolRenderContext {\n\t\treturn {\n\t\t\targs: this.args,\n\t\t\ttoolCallId: this.toolCallId,\n\t\t\tinvalidate: () => {\n\t\t\t\tthis.invalidate();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t},\n\t\t\tlastComponent,\n\t\t\tstate: this.rendererState,\n\t\t\tcwd: this.cwd,\n\t\t\texecutionStarted: this.executionStarted,\n\t\t\targsComplete: this.argsComplete,\n\t\t\tisPartial: this.isPartial,\n\t\t\texpanded: this.expanded,\n\t\t\tshowImages: this.showImages,\n\t\t\tisError: this.result?.isError ?? false,\n\t\t};\n\t}\n\n\tprivate createCallFallback(): Component {\n\t\treturn new Text(theme.fg(\"toolTitle\", theme.bold(this.toolName)), 0, 0);\n\t}\n\n\tprivate createResultFallback(): Component | undefined {\n\t\tconst output = this.getTextOutput();\n\t\tif (!output) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn new Text(theme.fg(\"toolOutput\", output), 0, 0);\n\t}\n\n\tupdateArgs(args: any): void {\n\t\tthis.args = args;\n\t\tthis.updateDisplay();\n\t}\n\n\tmarkExecutionStarted(): void {\n\t\tthis.executionStarted = true;\n\t\tthis.updateDisplay();\n\t\tthis.ui.requestRender();\n\t}\n\n\tsetArgsComplete(): void {\n\t\tthis.argsComplete = true;\n\t\tthis.updateDisplay();\n\t\tthis.ui.requestRender();\n\t}\n\n\tupdateResult(\n\t\tresult: {\n\t\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\t\tdetails?: any;\n\t\t\tisError: boolean;\n\t\t},\n\t\tisPartial = false,\n\t): void {\n\t\tthis.result = result;\n\t\tthis.isPartial = isPartial;\n\t\tthis.updateDisplay();\n\t\tthis.maybeConvertImagesForKitty();\n\t}\n\n\tprivate maybeConvertImagesForKitty(): void {\n\t\tconst caps = getCapabilities();\n\t\tif (caps.images !== \"kitty\") return;\n\t\tif (!this.result) return;\n\n\t\tconst imageBlocks = this.result.content.filter((c) => c.type === \"image\");\n\t\tfor (let i = 0; i < imageBlocks.length; i++) {\n\t\t\tconst img = imageBlocks[i];\n\t\t\tif (!img.data || !img.mimeType) continue;\n\t\t\tif (img.mimeType === \"image/png\") continue;\n\t\t\tif (this.convertedImages.has(i)) continue;\n\n\t\t\tconst index = i;\n\t\t\tconvertToPng(img.data, img.mimeType).then((converted) => {\n\t\t\t\tif (converted) {\n\t\t\t\t\tthis.convertedImages.set(index, converted);\n\t\t\t\t\tthis.updateDisplay();\n\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetShowImages(show: boolean): void {\n\t\tthis.showImages = show;\n\t\tthis.updateDisplay();\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tthis.updateDisplay();\n\t}\n\n\toverride render(width: number): string[] {\n\t\tif (this.hideComponent) {\n\t\t\treturn [];\n\t\t}\n\t\treturn super.render(width);\n\t}\n\n\tprivate updateDisplay(): void {\n\t\tconst bgFn = this.isPartial\n\t\t\t? (text: string) => theme.bg(\"toolPendingBg\", text)\n\t\t\t: this.result?.isError\n\t\t\t\t? (text: string) => theme.bg(\"toolErrorBg\", text)\n\t\t\t\t: (text: string) => theme.bg(\"toolSuccessBg\", text);\n\n\t\tlet hasContent = false;\n\t\tthis.hideComponent = false;\n\t\tif (this.hasRendererDefinition()) {\n\t\t\tthis.contentBox.setBgFn(bgFn);\n\t\t\tthis.contentBox.clear();\n\n\t\t\tconst callRenderer = this.getCallRenderer();\n\t\t\tif (!callRenderer) {\n\t\t\t\tthis.contentBox.addChild(this.createCallFallback());\n\t\t\t\thasContent = true;\n\t\t\t} else {\n\t\t\t\ttry {\n\t\t\t\t\tconst component = callRenderer(this.args, theme, this.getRenderContext(this.callRendererComponent));\n\t\t\t\t\tthis.callRendererComponent = component;\n\t\t\t\t\tthis.contentBox.addChild(component);\n\t\t\t\t\thasContent = true;\n\t\t\t\t} catch {\n\t\t\t\t\tthis.callRendererComponent = undefined;\n\t\t\t\t\tthis.contentBox.addChild(this.createCallFallback());\n\t\t\t\t\thasContent = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.result) {\n\t\t\t\tconst resultRenderer = this.getResultRenderer();\n\t\t\t\tif (!resultRenderer) {\n\t\t\t\t\tconst component = this.createResultFallback();\n\t\t\t\t\tif (component) {\n\t\t\t\t\t\tthis.contentBox.addChild(component);\n\t\t\t\t\t\thasContent = true;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst component = resultRenderer(\n\t\t\t\t\t\t\t{ content: this.result.content as any, details: this.result.details },\n\t\t\t\t\t\t\t{ expanded: this.expanded, isPartial: this.isPartial },\n\t\t\t\t\t\t\ttheme,\n\t\t\t\t\t\t\tthis.getRenderContext(this.resultRendererComponent),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.resultRendererComponent = component;\n\t\t\t\t\t\tthis.contentBox.addChild(component);\n\t\t\t\t\t\thasContent = true;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\tthis.resultRendererComponent = undefined;\n\t\t\t\t\t\tconst component = this.createResultFallback();\n\t\t\t\t\t\tif (component) {\n\t\t\t\t\t\t\tthis.contentBox.addChild(component);\n\t\t\t\t\t\t\thasContent = true;\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} else {\n\t\t\tthis.contentText.setCustomBgFn(bgFn);\n\t\t\tthis.contentText.setText(this.formatToolExecution());\n\t\t\thasContent = true;\n\t\t}\n\n\t\tfor (const img of this.imageComponents) {\n\t\t\tthis.removeChild(img);\n\t\t}\n\t\tthis.imageComponents = [];\n\t\tfor (const spacer of this.imageSpacers) {\n\t\t\tthis.removeChild(spacer);\n\t\t}\n\t\tthis.imageSpacers = [];\n\n\t\tif (this.result) {\n\t\t\tconst imageBlocks = this.result.content.filter((c) => c.type === \"image\");\n\t\t\tconst caps = getCapabilities();\n\t\t\tfor (let i = 0; i < imageBlocks.length; i++) {\n\t\t\t\tconst img = imageBlocks[i];\n\t\t\t\tif (caps.images && this.showImages && img.data && img.mimeType) {\n\t\t\t\t\tconst converted = this.convertedImages.get(i);\n\t\t\t\t\tconst imageData = converted?.data ?? img.data;\n\t\t\t\t\tconst imageMimeType = converted?.mimeType ?? img.mimeType;\n\t\t\t\t\tif (caps.images === \"kitty\" && imageMimeType !== \"image/png\") continue;\n\n\t\t\t\t\tconst spacer = new Spacer(1);\n\t\t\t\t\tthis.addChild(spacer);\n\t\t\t\t\tthis.imageSpacers.push(spacer);\n\t\t\t\t\tconst imageComponent = new Image(\n\t\t\t\t\t\timageData,\n\t\t\t\t\t\timageMimeType,\n\t\t\t\t\t\t{ fallbackColor: (s: string) => theme.fg(\"toolOutput\", s) },\n\t\t\t\t\t\t{ maxWidthCells: 60 },\n\t\t\t\t\t);\n\t\t\t\t\tthis.imageComponents.push(imageComponent);\n\t\t\t\t\tthis.addChild(imageComponent);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (this.hasRendererDefinition() && !hasContent && this.imageComponents.length === 0) {\n\t\t\tthis.hideComponent = true;\n\t\t}\n\t}\n\n\tprivate getTextOutput(): string {\n\t\treturn getRenderedTextOutput(this.result, this.showImages);\n\t}\n\n\tprivate formatToolExecution(): string {\n\t\tlet text = theme.fg(\"toolTitle\", theme.bold(this.toolName));\n\t\tconst content = JSON.stringify(this.args, null, 2);\n\t\tif (content) {\n\t\t\ttext += `\\n\\n${content}`;\n\t\t}\n\t\tconst output = this.getTextOutput();\n\t\tif (output) {\n\t\t\ttext += `\\n${output}`;\n\t\t}\n\t\treturn text;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"tree-selector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tree-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,SAAS,EACd,SAAS,EACT,KAAK,SAAS,EAQd,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AA0BxE,mCAAmC;AACnC,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,cAAc,GAAG,KAAK,CAAC;AAWvF,cAAM,QAAS,YAAW,SAAS;IAClC,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,aAAa,CAAkB;IACvC,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,UAAU,CAAyB;IAC3C,OAAO,CAAC,WAAW,CAAM;IACzB,OAAO,CAAC,WAAW,CAAwC;IAC3D,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,mBAAmB,CAAS;IACpC,OAAO,CAAC,aAAa,CAA0B;IAC/C,OAAO,CAAC,gBAAgB,CAAyC;IACjE,OAAO,CAAC,kBAAkB,CAA2C;IACrE,OAAO,CAAC,cAAc,CAAuB;IAC7C,OAAO,CAAC,WAAW,CAA0B;IAEtC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAA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C,QAAQ,CAAW;IAC3B,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,mBAAmB,CAAY;IACvC,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,qBAAqB,CAAC,CAAuD;IAGrF,OAAO,CAAC,QAAQ,CAAS;IACzB,IAAI,OAAO,IAAI,OAAO,CAErB;IACD,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAMzB;IAED,YACC,IAAI,EAAE,eAAe,EAAE,EACvB,aAAa,EAAE,MAAM,GAAG,IAAI,EAC5B,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,EACnC,QAAQ,EAAE,MAAM,IAAI,EACpB,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,EACpE,iBAAiB,CAAC,EAAE,MAAM,EAC1B,iBAAiB,CAAC,EAAE,UAAU,EAyC9B;IAED,OAAO,CAAC,cAAc;IAiBtB,OAAO,CAAC,cAAc;IAOtB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAMjC;IAED,WAAW,IAAI,QAAQ,CAEtB;CACD","sourcesContent":["import {\n\ttype Component,\n\tContainer,\n\ttype Focusable,\n\tgetKeybindings,\n\tInput,\n\tmatchesKey,\n\tSpacer,\n\tText,\n\tTruncatedText,\n\ttruncateToWidth,\n} from \"@orient-cli/tui\";\nimport type { SessionTreeNode } from \"../../../core/session-manager.js\";\nimport { theme } from \"../theme/theme.js\";\nimport { DynamicBorder } from \"./dynamic-border.js\";\nimport { keyHint, keyText } from \"./keybinding-hints.js\";\n\n/** Gutter info: position (displayIndent where connector was) and whether to show │ */\ninterface GutterInfo {\n\tposition: number; // displayIndent level where the connector was shown\n\tshow: boolean; // true = show │, false = show spaces\n}\n\n/** Flattened tree node for navigation */\ninterface FlatNode {\n\tnode: SessionTreeNode;\n\t/** Indentation level (each level = 3 chars) */\n\tindent: number;\n\t/** Whether to show connector (├─ or └─) - true if parent has multiple children */\n\tshowConnector: boolean;\n\t/** If showConnector, true = last sibling (└─), false = not last (├─) */\n\tisLast: boolean;\n\t/** Gutter info for each ancestor branch point */\n\tgutters: GutterInfo[];\n\t/** True if this node is a root under a virtual branching root (multiple roots) */\n\tisVirtualRootChild: boolean;\n}\n\n/** Filter mode for tree display */\nexport type FilterMode = \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\";\n\n/**\n * Tree list component with selection and ASCII art visualization\n */\n/** Tool call info for lookup */\ninterface ToolCallInfo {\n\tname: string;\n\targuments: Record<string, unknown>;\n}\n\nclass TreeList implements Component {\n\tprivate flatNodes: FlatNode[] = [];\n\tprivate filteredNodes: FlatNode[] = [];\n\tprivate selectedIndex = 0;\n\tprivate currentLeafId: string | null;\n\tprivate maxVisibleLines: number;\n\tprivate filterMode: FilterMode = \"default\";\n\tprivate searchQuery = \"\";\n\tprivate toolCallMap: Map<string, ToolCallInfo> = new Map();\n\tprivate multipleRoots = false;\n\tprivate showLabelTimestamps = false;\n\tprivate activePathIds: Set<string> = new Set();\n\tprivate visibleParentMap: Map<string, string | null> = new Map();\n\tprivate visibleChildrenMap: Map<string | null, string[]> = new Map();\n\tprivate lastSelectedId: string | null = null;\n\tprivate foldedNodes: Set<string> = new Set();\n\n\tpublic onSelect?: (entryId: string) => void;\n\tpublic onCancel?: () => void;\n\tpublic onLabelEdit?: (entryId: string, currentLabel: string | undefined) => void;\n\n\tconstructor(\n\t\ttree: SessionTreeNode[],\n\t\tcurrentLeafId: string | null,\n\t\tmaxVisibleLines: number,\n\t\tinitialSelectedId?: string,\n\t\tinitialFilterMode?: FilterMode,\n\t) {\n\t\tthis.currentLeafId = currentLeafId;\n\t\tthis.maxVisibleLines = maxVisibleLines;\n\t\tthis.filterMode = initialFilterMode ?? \"default\";\n\t\tthis.multipleRoots = tree.length > 1;\n\t\tthis.flatNodes = this.flattenTree(tree);\n\t\tthis.buildActivePath();\n\t\tthis.applyFilter();\n\n\t\t// Start with initialSelectedId if provided, otherwise current leaf\n\t\tconst targetId = initialSelectedId ?? currentLeafId;\n\t\tthis.selectedIndex = this.findNearestVisibleIndex(targetId);\n\t\tthis.lastSelectedId = this.filteredNodes[this.selectedIndex]?.node.entry.id ?? null;\n\t}\n\n\t/**\n\t * Find the index of the nearest visible entry, walking up the parent chain if needed.\n\t * Returns the index in filteredNodes, or the last index as fallback.\n\t */\n\tprivate findNearestVisibleIndex(entryId: string | null): number {\n\t\tif (this.filteredNodes.length === 0) return 0;\n\n\t\t// Build a map for parent lookup\n\t\tconst entryMap = new Map<string, FlatNode>();\n\t\tfor (const flatNode of this.flatNodes) {\n\t\t\tentryMap.set(flatNode.node.entry.id, flatNode);\n\t\t}\n\n\t\t// Build a map of visible entry IDs to their indices in filteredNodes\n\t\tconst visibleIdToIndex = new Map<string, number>(this.filteredNodes.map((node, i) => [node.node.entry.id, i]));\n\n\t\t// Walk from entryId up to root, looking for a visible entry\n\t\tlet currentId = entryId;\n\t\twhile (currentId !== null) {\n\t\t\tconst index = visibleIdToIndex.get(currentId);\n\t\t\tif (index !== undefined) return index;\n\t\t\tconst node = entryMap.get(currentId);\n\t\t\tif (!node) break;\n\t\t\tcurrentId = node.node.entry.parentId ?? null;\n\t\t}\n\n\t\t// Fallback: last visible entry\n\t\treturn this.filteredNodes.length - 1;\n\t}\n\n\t/** Build the set of entry IDs on the path from root to current leaf */\n\tprivate buildActivePath(): void {\n\t\tthis.activePathIds.clear();\n\t\tif (!this.currentLeafId) return;\n\n\t\t// Build a map of id -> entry for parent lookup\n\t\tconst entryMap = new Map<string, FlatNode>();\n\t\tfor (const flatNode of this.flatNodes) {\n\t\t\tentryMap.set(flatNode.node.entry.id, flatNode);\n\t\t}\n\n\t\t// Walk from leaf to root\n\t\tlet currentId: string | null = this.currentLeafId;\n\t\twhile (currentId) {\n\t\t\tthis.activePathIds.add(currentId);\n\t\t\tconst node = entryMap.get(currentId);\n\t\t\tif (!node) break;\n\t\t\tcurrentId = node.node.entry.parentId ?? null;\n\t\t}\n\t}\n\n\tprivate flattenTree(roots: SessionTreeNode[]): FlatNode[] {\n\t\tconst result: FlatNode[] = [];\n\t\tthis.toolCallMap.clear();\n\n\t\t// Indentation rules:\n\t\t// - At indent 0: stay at 0 unless parent has >1 children (then +1)\n\t\t// - At indent 1: children always go to indent 2 (visual grouping of subtree)\n\t\t// - At indent 2+: stay flat for single-child chains, +1 only if parent branches\n\n\t\t// Stack items: [node, indent, justBranched, showConnector, isLast, gutters, isVirtualRootChild]\n\t\ttype StackItem = [SessionTreeNode, number, boolean, boolean, boolean, GutterInfo[], boolean];\n\t\tconst stack: StackItem[] = [];\n\n\t\t// Determine which subtrees contain the active leaf (to sort current branch first)\n\t\t// Use iterative post-order traversal to avoid stack overflow\n\t\tconst containsActive = new Map<SessionTreeNode, boolean>();\n\t\tconst leafId = this.currentLeafId;\n\t\t{\n\t\t\t// Build list in pre-order, then process in reverse for post-order effect\n\t\t\tconst allNodes: SessionTreeNode[] = [];\n\t\t\tconst preOrderStack: SessionTreeNode[] = [...roots];\n\t\t\twhile (preOrderStack.length > 0) {\n\t\t\t\tconst node = preOrderStack.pop()!;\n\t\t\t\tallNodes.push(node);\n\t\t\t\t// Push children in reverse so they're processed left-to-right\n\t\t\t\tfor (let i = node.children.length - 1; i >= 0; i--) {\n\t\t\t\t\tpreOrderStack.push(node.children[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Process in reverse (post-order): children before parents\n\t\t\tfor (let i = allNodes.length - 1; i >= 0; i--) {\n\t\t\t\tconst node = allNodes[i];\n\t\t\t\tlet has = leafId !== null && node.entry.id === leafId;\n\t\t\t\tfor (const child of node.children) {\n\t\t\t\t\tif (containsActive.get(child)) {\n\t\t\t\t\t\thas = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcontainsActive.set(node, has);\n\t\t\t}\n\t\t}\n\n\t\t// Add roots in reverse order, prioritizing the one containing the active leaf\n\t\t// If multiple roots, treat them as children of a virtual root that branches\n\t\tconst multipleRoots = roots.length > 1;\n\t\tconst orderedRoots = [...roots].sort((a, b) => Number(containsActive.get(b)) - Number(containsActive.get(a)));\n\t\tfor (let i = orderedRoots.length - 1; i >= 0; i--) {\n\t\t\tconst isLast = i === orderedRoots.length - 1;\n\t\t\tstack.push([orderedRoots[i], multipleRoots ? 1 : 0, multipleRoots, multipleRoots, isLast, [], multipleRoots]);\n\t\t}\n\n\t\twhile (stack.length > 0) {\n\t\t\tconst [node, indent, justBranched, showConnector, isLast, gutters, isVirtualRootChild] = stack.pop()!;\n\n\t\t\t// Extract tool calls from assistant messages for later lookup\n\t\t\tconst entry = node.entry;\n\t\t\tif (entry.type === \"message\" && entry.message.role === \"assistant\") {\n\t\t\t\tconst content = (entry.message as { content?: unknown }).content;\n\t\t\t\tif (Array.isArray(content)) {\n\t\t\t\t\tfor (const block of content) {\n\t\t\t\t\t\tif (typeof block === \"object\" && block !== null && \"type\" in block && block.type === \"toolCall\") {\n\t\t\t\t\t\t\tconst tc = block as { id: string; name: string; arguments: Record<string, unknown> };\n\t\t\t\t\t\t\tthis.toolCallMap.set(tc.id, { name: tc.name, arguments: tc.arguments });\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tresult.push({ node, indent, showConnector, isLast, gutters, isVirtualRootChild });\n\n\t\t\tconst children = node.children;\n\t\t\tconst multipleChildren = children.length > 1;\n\n\t\t\t// Order children so the branch containing the active leaf comes first\n\t\t\tconst orderedChildren = (() => {\n\t\t\t\tconst prioritized: SessionTreeNode[] = [];\n\t\t\t\tconst rest: SessionTreeNode[] = [];\n\t\t\t\tfor (const child of children) {\n\t\t\t\t\tif (containsActive.get(child)) {\n\t\t\t\t\t\tprioritized.push(child);\n\t\t\t\t\t} else {\n\t\t\t\t\t\trest.push(child);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn [...prioritized, ...rest];\n\t\t\t})();\n\n\t\t\t// Calculate child indent\n\t\t\tlet childIndent: number;\n\t\t\tif (multipleChildren) {\n\t\t\t\t// Parent branches: children get +1\n\t\t\t\tchildIndent = indent + 1;\n\t\t\t} else if (justBranched && indent > 0) {\n\t\t\t\t// First generation after a branch: +1 for visual grouping\n\t\t\t\tchildIndent = indent + 1;\n\t\t\t} else {\n\t\t\t\t// Single-child chain: stay flat\n\t\t\t\tchildIndent = indent;\n\t\t\t}\n\n\t\t\t// Build gutters for children\n\t\t\t// If this node showed a connector, add a gutter entry for descendants\n\t\t\t// Only add gutter if connector is actually displayed (not suppressed for virtual root children)\n\t\t\tconst connectorDisplayed = showConnector && !isVirtualRootChild;\n\t\t\t// When connector is displayed, add a gutter entry at the connector's position\n\t\t\t// Connector is at position (displayIndent - 1), so gutter should be there too\n\t\t\tconst currentDisplayIndent = this.multipleRoots ? Math.max(0, indent - 1) : indent;\n\t\t\tconst connectorPosition = Math.max(0, currentDisplayIndent - 1);\n\t\t\tconst childGutters: GutterInfo[] = connectorDisplayed\n\t\t\t\t? [...gutters, { position: connectorPosition, show: !isLast }]\n\t\t\t\t: gutters;\n\n\t\t\t// Add children in reverse order\n\t\t\tfor (let i = orderedChildren.length - 1; i >= 0; i--) {\n\t\t\t\tconst childIsLast = i === orderedChildren.length - 1;\n\t\t\t\tstack.push([\n\t\t\t\t\torderedChildren[i],\n\t\t\t\t\tchildIndent,\n\t\t\t\t\tmultipleChildren,\n\t\t\t\t\tmultipleChildren,\n\t\t\t\t\tchildIsLast,\n\t\t\t\t\tchildGutters,\n\t\t\t\t\tfalse,\n\t\t\t\t]);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tprivate applyFilter(): void {\n\t\t// Update lastSelectedId only when we have a valid selection (non-empty list)\n\t\t// This preserves the selection when switching through empty filter results\n\t\tif (this.filteredNodes.length > 0) {\n\t\t\tthis.lastSelectedId = this.filteredNodes[this.selectedIndex]?.node.entry.id ?? this.lastSelectedId;\n\t\t}\n\n\t\tconst searchTokens = this.searchQuery.toLowerCase().split(/\\s+/).filter(Boolean);\n\n\t\tthis.filteredNodes = this.flatNodes.filter((flatNode) => {\n\t\t\tconst entry = flatNode.node.entry;\n\t\t\tconst isCurrentLeaf = entry.id === this.currentLeafId;\n\n\t\t\t// Skip assistant messages with only tool calls (no text) unless error/aborted\n\t\t\t// Always show current leaf so active position is visible\n\t\t\tif (entry.type === \"message\" && entry.message.role === \"assistant\" && !isCurrentLeaf) {\n\t\t\t\tconst msg = entry.message as { stopReason?: string; content?: unknown };\n\t\t\t\tconst hasText = this.hasTextContent(msg.content);\n\t\t\t\tconst isErrorOrAborted = msg.stopReason && msg.stopReason !== \"stop\" && msg.stopReason !== \"toolUse\";\n\t\t\t\t// Only hide if no text AND not an error/aborted message\n\t\t\t\tif (!hasText && !isErrorOrAborted) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Apply filter mode\n\t\t\tlet passesFilter = true;\n\t\t\t// Entry types hidden in default view (settings/bookkeeping)\n\t\t\tconst isSettingsEntry =\n\t\t\t\tentry.type === \"label\" ||\n\t\t\t\tentry.type === \"custom\" ||\n\t\t\t\tentry.type === \"model_change\" ||\n\t\t\t\tentry.type === \"thinking_level_change\" ||\n\t\t\t\tentry.type === \"session_info\";\n\n\t\t\tswitch (this.filterMode) {\n\t\t\t\tcase \"user-only\":\n\t\t\t\t\t// Just user messages\n\t\t\t\t\tpassesFilter = entry.type === \"message\" && entry.message.role === \"user\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"no-tools\":\n\t\t\t\t\t// Default minus tool results\n\t\t\t\t\tpassesFilter = !isSettingsEntry && !(entry.type === \"message\" && entry.message.role === \"toolResult\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"labeled-only\":\n\t\t\t\t\t// Just labeled entries\n\t\t\t\t\tpassesFilter = flatNode.node.label !== undefined;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"all\":\n\t\t\t\t\t// Show everything\n\t\t\t\t\tpassesFilter = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t// Default mode: hide settings/bookkeeping entries\n\t\t\t\t\tpassesFilter = !isSettingsEntry;\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (!passesFilter) return false;\n\n\t\t\t// Apply search filter\n\t\t\tif (searchTokens.length > 0) {\n\t\t\t\tconst nodeText = this.getSearchableText(flatNode.node).toLowerCase();\n\t\t\t\treturn searchTokens.every((token) => nodeText.includes(token));\n\t\t\t}\n\n\t\t\treturn true;\n\t\t});\n\n\t\t// Filter out descendants of folded nodes.\n\t\tif (this.foldedNodes.size > 0) {\n\t\t\tconst skipSet = new Set<string>();\n\t\t\tfor (const flatNode of this.flatNodes) {\n\t\t\t\tconst { id, parentId } = flatNode.node.entry;\n\t\t\t\tif (parentId != null && (this.foldedNodes.has(parentId) || skipSet.has(parentId))) {\n\t\t\t\t\tskipSet.add(id);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.filteredNodes = this.filteredNodes.filter((flatNode) => !skipSet.has(flatNode.node.entry.id));\n\t\t}\n\n\t\t// Recalculate visual structure (indent, connectors, gutters) based on visible tree\n\t\tthis.recalculateVisualStructure();\n\n\t\t// Try to preserve cursor on the same node, or find nearest visible ancestor\n\t\tif (this.lastSelectedId) {\n\t\t\tthis.selectedIndex = this.findNearestVisibleIndex(this.lastSelectedId);\n\t\t} else if (this.selectedIndex >= this.filteredNodes.length) {\n\t\t\t// Clamp index if out of bounds\n\t\t\tthis.selectedIndex = Math.max(0, this.filteredNodes.length - 1);\n\t\t}\n\n\t\t// Update lastSelectedId to the actual selection (may have changed due to parent walk)\n\t\tif (this.filteredNodes.length > 0) {\n\t\t\tthis.lastSelectedId = this.filteredNodes[this.selectedIndex]?.node.entry.id ?? this.lastSelectedId;\n\t\t}\n\t}\n\n\t/**\n\t * Recompute indentation/connectors for the filtered view\n\t *\n\t * Filtering can hide intermediate entries; descendants attach to the nearest visible ancestor.\n\t * Keep indentation semantics aligned with flattenTree() so single-child chains don't drift right.\n\t */\n\tprivate recalculateVisualStructure(): void {\n\t\tif (this.filteredNodes.length === 0) return;\n\n\t\tconst visibleIds = new Set(this.filteredNodes.map((n) => n.node.entry.id));\n\n\t\t// Build entry map for efficient parent lookup (using full tree)\n\t\tconst entryMap = new Map<string, FlatNode>();\n\t\tfor (const flatNode of this.flatNodes) {\n\t\t\tentryMap.set(flatNode.node.entry.id, flatNode);\n\t\t}\n\n\t\t// Find nearest visible ancestor for a node\n\t\tconst findVisibleAncestor = (nodeId: string): string | null => {\n\t\t\tlet currentId = entryMap.get(nodeId)?.node.entry.parentId ?? null;\n\t\t\twhile (currentId !== null) {\n\t\t\t\tif (visibleIds.has(currentId)) {\n\t\t\t\t\treturn currentId;\n\t\t\t\t}\n\t\t\t\tcurrentId = entryMap.get(currentId)?.node.entry.parentId ?? null;\n\t\t\t}\n\t\t\treturn null;\n\t\t};\n\n\t\t// Build visible tree structure:\n\t\t// - visibleParent: nodeId → nearest visible ancestor (or null for roots)\n\t\t// - visibleChildren: parentId → list of visible children (in filteredNodes order)\n\t\tconst visibleParent = new Map<string, string | null>();\n\t\tconst visibleChildren = new Map<string | null, string[]>();\n\t\tvisibleChildren.set(null, []); // root-level nodes\n\n\t\tfor (const flatNode of this.filteredNodes) {\n\t\t\tconst nodeId = flatNode.node.entry.id;\n\t\t\tconst ancestorId = findVisibleAncestor(nodeId);\n\t\t\tvisibleParent.set(nodeId, ancestorId);\n\n\t\t\tif (!visibleChildren.has(ancestorId)) {\n\t\t\t\tvisibleChildren.set(ancestorId, []);\n\t\t\t}\n\t\t\tvisibleChildren.get(ancestorId)!.push(nodeId);\n\t\t}\n\n\t\t// Update multipleRoots based on visible roots\n\t\tconst visibleRootIds = visibleChildren.get(null)!;\n\t\tthis.multipleRoots = visibleRootIds.length > 1;\n\n\t\t// Build a map for quick lookup: nodeId → FlatNode\n\t\tconst filteredNodeMap = new Map<string, FlatNode>();\n\t\tfor (const flatNode of this.filteredNodes) {\n\t\t\tfilteredNodeMap.set(flatNode.node.entry.id, flatNode);\n\t\t}\n\n\t\t// DFS over the visible tree using flattenTree() indentation semantics\n\t\t// Stack items: [nodeId, indent, justBranched, showConnector, isLast, gutters, isVirtualRootChild]\n\t\ttype StackItem = [string, number, boolean, boolean, boolean, GutterInfo[], boolean];\n\t\tconst stack: StackItem[] = [];\n\n\t\t// Add visible roots in reverse order (to process in forward order via stack)\n\t\tfor (let i = visibleRootIds.length - 1; i >= 0; i--) {\n\t\t\tconst isLast = i === visibleRootIds.length - 1;\n\t\t\tstack.push([\n\t\t\t\tvisibleRootIds[i],\n\t\t\t\tthis.multipleRoots ? 1 : 0,\n\t\t\t\tthis.multipleRoots,\n\t\t\t\tthis.multipleRoots,\n\t\t\t\tisLast,\n\t\t\t\t[],\n\t\t\t\tthis.multipleRoots,\n\t\t\t]);\n\t\t}\n\n\t\twhile (stack.length > 0) {\n\t\t\tconst [nodeId, indent, justBranched, showConnector, isLast, gutters, isVirtualRootChild] = stack.pop()!;\n\n\t\t\tconst flatNode = filteredNodeMap.get(nodeId);\n\t\t\tif (!flatNode) continue;\n\n\t\t\t// Update this node's visual properties\n\t\t\tflatNode.indent = indent;\n\t\t\tflatNode.showConnector = showConnector;\n\t\t\tflatNode.isLast = isLast;\n\t\t\tflatNode.gutters = gutters;\n\t\t\tflatNode.isVirtualRootChild = isVirtualRootChild;\n\n\t\t\t// Get visible children of this node\n\t\t\tconst children = visibleChildren.get(nodeId) || [];\n\t\t\tconst multipleChildren = children.length > 1;\n\n\t\t\t// Child indent follows flattenTree(): branch points (and first generation after a branch) shift +1\n\t\t\tlet childIndent: number;\n\t\t\tif (multipleChildren) {\n\t\t\t\tchildIndent = indent + 1;\n\t\t\t} else if (justBranched && indent > 0) {\n\t\t\t\tchildIndent = indent + 1;\n\t\t\t} else {\n\t\t\t\tchildIndent = indent;\n\t\t\t}\n\n\t\t\t// Child gutters follow flattenTree() connector/gutter rules\n\t\t\tconst connectorDisplayed = showConnector && !isVirtualRootChild;\n\t\t\tconst currentDisplayIndent = this.multipleRoots ? Math.max(0, indent - 1) : indent;\n\t\t\tconst connectorPosition = Math.max(0, currentDisplayIndent - 1);\n\t\t\tconst childGutters: GutterInfo[] = connectorDisplayed\n\t\t\t\t? [...gutters, { position: connectorPosition, show: !isLast }]\n\t\t\t\t: gutters;\n\n\t\t\t// Add children in reverse order (to process in forward order via stack)\n\t\t\tfor (let i = children.length - 1; i >= 0; i--) {\n\t\t\t\tconst childIsLast = i === children.length - 1;\n\t\t\t\tstack.push([\n\t\t\t\t\tchildren[i],\n\t\t\t\t\tchildIndent,\n\t\t\t\t\tmultipleChildren,\n\t\t\t\t\tmultipleChildren,\n\t\t\t\t\tchildIsLast,\n\t\t\t\t\tchildGutters,\n\t\t\t\t\tfalse,\n\t\t\t\t]);\n\t\t\t}\n\t\t}\n\n\t\t// Store visible tree maps for ancestor/descendant lookups in navigation\n\t\tthis.visibleParentMap = visibleParent;\n\t\tthis.visibleChildrenMap = visibleChildren;\n\t}\n\n\t/** Get searchable text content from a node */\n\tprivate getSearchableText(node: SessionTreeNode): string {\n\t\tconst entry = node.entry;\n\t\tconst parts: string[] = [];\n\n\t\tif (node.label) {\n\t\t\tparts.push(node.label);\n\t\t}\n\n\t\tswitch (entry.type) {\n\t\t\tcase \"message\": {\n\t\t\t\tconst msg = entry.message;\n\t\t\t\tparts.push(msg.role);\n\t\t\t\tif (\"content\" in msg && msg.content) {\n\t\t\t\t\tparts.push(this.extractContent(msg.content));\n\t\t\t\t}\n\t\t\t\tif (msg.role === \"bashExecution\") {\n\t\t\t\t\tconst bashMsg = msg as { command?: string };\n\t\t\t\t\tif (bashMsg.command) parts.push(bashMsg.command);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"custom_message\": {\n\t\t\t\tparts.push(entry.customType);\n\t\t\t\tif (typeof entry.content === \"string\") {\n\t\t\t\t\tparts.push(entry.content);\n\t\t\t\t} else {\n\t\t\t\t\tparts.push(this.extractContent(entry.content));\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"compaction\":\n\t\t\t\tparts.push(\"compaction\");\n\t\t\t\tbreak;\n\t\t\tcase \"branch_summary\":\n\t\t\t\tparts.push(\"branch summary\", entry.summary);\n\t\t\t\tbreak;\n\t\t\tcase \"session_info\":\n\t\t\t\tparts.push(\"title\");\n\t\t\t\tif (entry.name) parts.push(entry.name);\n\t\t\t\tbreak;\n\t\t\tcase \"model_change\":\n\t\t\t\tparts.push(\"model\", entry.modelId);\n\t\t\t\tbreak;\n\t\t\tcase \"thinking_level_change\":\n\t\t\t\tparts.push(\"thinking\", entry.thinkingLevel);\n\t\t\t\tbreak;\n\t\t\tcase \"custom\":\n\t\t\t\tparts.push(\"custom\", entry.customType);\n\t\t\t\tbreak;\n\t\t\tcase \"label\":\n\t\t\t\tparts.push(\"label\", entry.label ?? \"\");\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn parts.join(\" \");\n\t}\n\n\tinvalidate(): void {}\n\n\tgetSearchQuery(): string {\n\t\treturn this.searchQuery;\n\t}\n\n\tgetSelectedNode(): SessionTreeNode | undefined {\n\t\treturn this.filteredNodes[this.selectedIndex]?.node;\n\t}\n\n\tupdateNodeLabel(entryId: string, label: string | undefined, labelTimestamp?: string): void {\n\t\tfor (const flatNode of this.flatNodes) {\n\t\t\tif (flatNode.node.entry.id === entryId) {\n\t\t\t\tflatNode.node.label = label;\n\t\t\t\tflatNode.node.labelTimestamp = label ? (labelTimestamp ?? new Date().toISOString()) : undefined;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate getStatusLabels(): string {\n\t\tlet labels = \"\";\n\t\tswitch (this.filterMode) {\n\t\t\tcase \"no-tools\":\n\t\t\t\tlabels += \" [no-tools]\";\n\t\t\t\tbreak;\n\t\t\tcase \"user-only\":\n\t\t\t\tlabels += \" [user]\";\n\t\t\t\tbreak;\n\t\t\tcase \"labeled-only\":\n\t\t\t\tlabels += \" [labeled]\";\n\t\t\t\tbreak;\n\t\t\tcase \"all\":\n\t\t\t\tlabels += \" [all]\";\n\t\t\t\tbreak;\n\t\t}\n\t\tif (this.showLabelTimestamps) {\n\t\t\tlabels += \" [+label time]\";\n\t\t}\n\t\treturn labels;\n\t}\n\n\trender(width: number): string[] {\n\t\tconst lines: string[] = [];\n\n\t\tif (this.filteredNodes.length === 0) {\n\t\t\tlines.push(truncateToWidth(theme.fg(\"muted\", \" No entries found\"), width));\n\t\t\tlines.push(truncateToWidth(theme.fg(\"muted\", ` (0/0)${this.getStatusLabels()}`), width));\n\t\t\treturn lines;\n\t\t}\n\n\t\tconst startIndex = Math.max(\n\t\t\t0,\n\t\t\tMath.min(\n\t\t\t\tthis.selectedIndex - Math.floor(this.maxVisibleLines / 2),\n\t\t\t\tthis.filteredNodes.length - this.maxVisibleLines,\n\t\t\t),\n\t\t);\n\t\tconst endIndex = Math.min(startIndex + this.maxVisibleLines, this.filteredNodes.length);\n\n\t\tfor (let i = startIndex; i < endIndex; i++) {\n\t\t\tconst flatNode = this.filteredNodes[i];\n\t\t\tconst entry = flatNode.node.entry;\n\t\t\tconst isSelected = i === this.selectedIndex;\n\n\t\t\t// Build line: cursor + prefix + path marker + label + content\n\t\t\tconst cursor = isSelected ? theme.fg(\"accent\", \"› \") : \" \";\n\n\t\t\t// If multiple roots, shift display (roots at 0, not 1)\n\t\t\tconst displayIndent = this.multipleRoots ? Math.max(0, flatNode.indent - 1) : flatNode.indent;\n\n\t\t\t// Build prefix with gutters at their correct positions\n\t\t\t// Each gutter has a position (displayIndent where its connector was shown)\n\t\t\tconst connector =\n\t\t\t\tflatNode.showConnector && !flatNode.isVirtualRootChild ? (flatNode.isLast ? \"└─ \" : \"├─ \") : \"\";\n\t\t\tconst connectorPosition = connector ? displayIndent - 1 : -1;\n\n\t\t\t// Build prefix char by char, placing gutters and connector at their positions\n\t\t\tconst totalChars = displayIndent * 3;\n\t\t\tconst prefixChars: string[] = [];\n\t\t\tconst isFolded = this.foldedNodes.has(entry.id);\n\t\t\tfor (let i = 0; i < totalChars; i++) {\n\t\t\t\tconst level = Math.floor(i / 3);\n\t\t\t\tconst posInLevel = i % 3;\n\n\t\t\t\t// Check if there's a gutter at this level\n\t\t\t\tconst gutter = flatNode.gutters.find((g) => g.position === level);\n\t\t\t\tif (gutter) {\n\t\t\t\t\tif (posInLevel === 0) {\n\t\t\t\t\t\tprefixChars.push(gutter.show ? \"│\" : \" \");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tprefixChars.push(\" \");\n\t\t\t\t\t}\n\t\t\t\t} else if (connector && level === connectorPosition) {\n\t\t\t\t\t// Connector at this level, with fold indicator\n\t\t\t\t\tif (posInLevel === 0) {\n\t\t\t\t\t\tprefixChars.push(flatNode.isLast ? \"└\" : \"├\");\n\t\t\t\t\t} else if (posInLevel === 1) {\n\t\t\t\t\t\tconst foldable = this.isFoldable(entry.id);\n\t\t\t\t\t\tprefixChars.push(isFolded ? \"⊞\" : foldable ? \"⊟\" : \"─\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tprefixChars.push(\" \");\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tprefixChars.push(\" \");\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst prefix = prefixChars.join(\"\");\n\n\t\t\t// Fold marker for nodes without connectors (roots)\n\t\t\tconst showsFoldInConnector = flatNode.showConnector && !flatNode.isVirtualRootChild;\n\t\t\tconst foldMarker = isFolded && !showsFoldInConnector ? theme.fg(\"accent\", \"⊞ \") : \"\";\n\n\t\t\t// Active path marker - shown right before the entry text\n\t\t\tconst isOnActivePath = this.activePathIds.has(entry.id);\n\t\t\tconst pathMarker = isOnActivePath ? theme.fg(\"accent\", \"• \") : \"\";\n\n\t\t\tconst label = flatNode.node.label ? theme.fg(\"warning\", `[${flatNode.node.label}] `) : \"\";\n\t\t\tconst labelTimestamp =\n\t\t\t\tthis.showLabelTimestamps && flatNode.node.label && flatNode.node.labelTimestamp\n\t\t\t\t\t? theme.fg(\"muted\", `${this.formatLabelTimestamp(flatNode.node.labelTimestamp)} `)\n\t\t\t\t\t: \"\";\n\t\t\tconst content = this.getEntryDisplayText(flatNode.node, isSelected);\n\n\t\t\tlet line = cursor + theme.fg(\"dim\", prefix) + foldMarker + pathMarker + label + labelTimestamp + content;\n\t\t\tif (isSelected) {\n\t\t\t\tline = theme.bg(\"selectedBg\", line);\n\t\t\t}\n\t\t\tlines.push(truncateToWidth(line, width));\n\t\t}\n\n\t\tlines.push(\n\t\t\ttruncateToWidth(\n\t\t\t\ttheme.fg(\"muted\", ` (${this.selectedIndex + 1}/${this.filteredNodes.length})${this.getStatusLabels()}`),\n\t\t\t\twidth,\n\t\t\t),\n\t\t);\n\n\t\treturn lines;\n\t}\n\n\tprivate getEntryDisplayText(node: SessionTreeNode, isSelected: boolean): string {\n\t\tconst entry = node.entry;\n\t\tlet result: string;\n\n\t\tconst normalize = (s: string) => s.replace(/[\\n\\t]/g, \" \").trim();\n\n\t\tswitch (entry.type) {\n\t\t\tcase \"message\": {\n\t\t\t\tconst msg = entry.message;\n\t\t\t\tconst role = msg.role;\n\t\t\t\tif (role === \"user\") {\n\t\t\t\t\tconst msgWithContent = msg as { content?: unknown };\n\t\t\t\t\tconst content = normalize(this.extractContent(msgWithContent.content));\n\t\t\t\t\tresult = theme.fg(\"accent\", \"user: \") + content;\n\t\t\t\t} else if (role === \"assistant\") {\n\t\t\t\t\tconst msgWithContent = msg as { content?: unknown; stopReason?: string; errorMessage?: string };\n\t\t\t\t\tconst textContent = normalize(this.extractContent(msgWithContent.content));\n\t\t\t\t\tif (textContent) {\n\t\t\t\t\t\tresult = theme.fg(\"success\", \"assistant: \") + textContent;\n\t\t\t\t\t} else if (msgWithContent.stopReason === \"aborted\") {\n\t\t\t\t\t\tresult = theme.fg(\"success\", \"assistant: \") + theme.fg(\"muted\", \"(aborted)\");\n\t\t\t\t\t} else if (msgWithContent.errorMessage) {\n\t\t\t\t\t\tconst errMsg = normalize(msgWithContent.errorMessage).slice(0, 80);\n\t\t\t\t\t\tresult = theme.fg(\"success\", \"assistant: \") + theme.fg(\"error\", errMsg);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult = theme.fg(\"success\", \"assistant: \") + theme.fg(\"muted\", \"(no content)\");\n\t\t\t\t\t}\n\t\t\t\t} else if (role === \"toolResult\") {\n\t\t\t\t\tconst toolMsg = msg as { toolCallId?: string; toolName?: string };\n\t\t\t\t\tconst toolCall = toolMsg.toolCallId ? this.toolCallMap.get(toolMsg.toolCallId) : undefined;\n\t\t\t\t\tif (toolCall) {\n\t\t\t\t\t\tresult = theme.fg(\"muted\", this.formatToolCall(toolCall.name, toolCall.arguments));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult = theme.fg(\"muted\", `[${toolMsg.toolName ?? \"tool\"}]`);\n\t\t\t\t\t}\n\t\t\t\t} else if (role === \"bashExecution\") {\n\t\t\t\t\tconst bashMsg = msg as { command?: string };\n\t\t\t\t\tresult = theme.fg(\"dim\", `[bash]: ${normalize(bashMsg.command ?? \"\")}`);\n\t\t\t\t} else {\n\t\t\t\t\tresult = theme.fg(\"dim\", `[${role}]`);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"custom_message\": {\n\t\t\t\tconst content =\n\t\t\t\t\ttypeof entry.content === \"string\"\n\t\t\t\t\t\t? entry.content\n\t\t\t\t\t\t: entry.content\n\t\t\t\t\t\t\t\t.filter((c): c is { type: \"text\"; text: string } => c.type === \"text\")\n\t\t\t\t\t\t\t\t.map((c) => c.text)\n\t\t\t\t\t\t\t\t.join(\"\");\n\t\t\t\tresult = theme.fg(\"customMessageLabel\", `[${entry.customType}]: `) + normalize(content);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"compaction\": {\n\t\t\t\tconst tokens = Math.round(entry.tokensBefore / 1000);\n\t\t\t\tresult = theme.fg(\"borderAccent\", `[compaction: ${tokens}k tokens]`);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"branch_summary\":\n\t\t\t\tresult = theme.fg(\"warning\", `[branch summary]: `) + normalize(entry.summary);\n\t\t\t\tbreak;\n\t\t\tcase \"model_change\":\n\t\t\t\tresult = theme.fg(\"dim\", `[model: ${entry.modelId}]`);\n\t\t\t\tbreak;\n\t\t\tcase \"thinking_level_change\":\n\t\t\t\tresult = theme.fg(\"dim\", `[thinking: ${entry.thinkingLevel}]`);\n\t\t\t\tbreak;\n\t\t\tcase \"custom\":\n\t\t\t\tresult = theme.fg(\"dim\", `[custom: ${entry.customType}]`);\n\t\t\t\tbreak;\n\t\t\tcase \"label\":\n\t\t\t\tresult = theme.fg(\"dim\", `[label: ${entry.label ?? \"(cleared)\"}]`);\n\t\t\t\tbreak;\n\t\t\tcase \"session_info\":\n\t\t\t\tresult = entry.name\n\t\t\t\t\t? [theme.fg(\"dim\", \"[title: \"), theme.fg(\"dim\", entry.name), theme.fg(\"dim\", \"]\")].join(\"\")\n\t\t\t\t\t: [theme.fg(\"dim\", \"[title: \"), theme.italic(theme.fg(\"dim\", \"empty\")), theme.fg(\"dim\", \"]\")].join(\"\");\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tresult = \"\";\n\t\t}\n\n\t\treturn isSelected ? theme.bold(result) : result;\n\t}\n\n\tprivate formatLabelTimestamp(timestamp: string): string {\n\t\tconst date = new Date(timestamp);\n\t\tconst now = new Date();\n\t\tconst hours = date.getHours().toString().padStart(2, \"0\");\n\t\tconst minutes = date.getMinutes().toString().padStart(2, \"0\");\n\t\tconst time = `${hours}:${minutes}`;\n\n\t\tif (\n\t\t\tdate.getFullYear() === now.getFullYear() &&\n\t\t\tdate.getMonth() === now.getMonth() &&\n\t\t\tdate.getDate() === now.getDate()\n\t\t) {\n\t\t\treturn time;\n\t\t}\n\n\t\tconst month = date.getMonth() + 1;\n\t\tconst day = date.getDate();\n\t\tif (date.getFullYear() === now.getFullYear()) {\n\t\t\treturn `${month}/${day} ${time}`;\n\t\t}\n\n\t\tconst year = date.getFullYear().toString().slice(-2);\n\t\treturn `${year}/${month}/${day} ${time}`;\n\t}\n\n\tprivate extractContent(content: unknown): string {\n\t\tconst maxLen = 200;\n\t\tif (typeof content === \"string\") return content.slice(0, maxLen);\n\t\tif (Array.isArray(content)) {\n\t\t\tlet result = \"\";\n\t\t\tfor (const c of content) {\n\t\t\t\tif (typeof c === \"object\" && c !== null && \"type\" in c && c.type === \"text\") {\n\t\t\t\t\tresult += (c as { text: string }).text;\n\t\t\t\t\tif (result.length >= maxLen) return result.slice(0, maxLen);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t\treturn \"\";\n\t}\n\n\tprivate hasTextContent(content: unknown): boolean {\n\t\tif (typeof content === \"string\") return content.trim().length > 0;\n\t\tif (Array.isArray(content)) {\n\t\t\tfor (const c of content) {\n\t\t\t\tif (typeof c === \"object\" && c !== null && \"type\" in c && c.type === \"text\") {\n\t\t\t\t\tconst text = (c as { text?: string }).text;\n\t\t\t\t\tif (text && text.trim().length > 0) return true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate formatToolCall(name: string, args: Record<string, unknown>): string {\n\t\tconst shortenPath = (p: string): string => {\n\t\t\tconst home = process.env.HOME || process.env.USERPROFILE || \"\";\n\t\t\tif (home && p.startsWith(home)) return `~${p.slice(home.length)}`;\n\t\t\treturn p;\n\t\t};\n\n\t\tswitch (name) {\n\t\t\tcase \"read\": {\n\t\t\t\tconst path = shortenPath(String(args.path || args.file_path || \"\"));\n\t\t\t\tconst offset = args.offset as number | undefined;\n\t\t\t\tconst limit = args.limit as number | undefined;\n\t\t\t\tlet display = path;\n\t\t\t\tif (offset !== undefined || limit !== undefined) {\n\t\t\t\t\tconst start = offset ?? 1;\n\t\t\t\t\tconst end = limit !== undefined ? start + limit - 1 : \"\";\n\t\t\t\t\tdisplay += `:${start}${end ? `-${end}` : \"\"}`;\n\t\t\t\t}\n\t\t\t\treturn `[read: ${display}]`;\n\t\t\t}\n\t\t\tcase \"write\": {\n\t\t\t\tconst path = shortenPath(String(args.path || args.file_path || \"\"));\n\t\t\t\treturn `[write: ${path}]`;\n\t\t\t}\n\t\t\tcase \"edit\": {\n\t\t\t\tconst path = shortenPath(String(args.path || args.file_path || \"\"));\n\t\t\t\treturn `[edit: ${path}]`;\n\t\t\t}\n\t\t\tcase \"bash\": {\n\t\t\t\tconst rawCmd = String(args.command || \"\");\n\t\t\t\tconst cmd = rawCmd\n\t\t\t\t\t.replace(/[\\n\\t]/g, \" \")\n\t\t\t\t\t.trim()\n\t\t\t\t\t.slice(0, 50);\n\t\t\t\treturn `[bash: ${cmd}${rawCmd.length > 50 ? \"...\" : \"\"}]`;\n\t\t\t}\n\t\t\tcase \"grep\": {\n\t\t\t\tconst pattern = String(args.pattern || \"\");\n\t\t\t\tconst path = shortenPath(String(args.path || \".\"));\n\t\t\t\treturn `[grep: /${pattern}/ in ${path}]`;\n\t\t\t}\n\t\t\tcase \"find\": {\n\t\t\t\tconst pattern = String(args.pattern || \"\");\n\t\t\t\tconst path = shortenPath(String(args.path || \".\"));\n\t\t\t\treturn `[find: ${pattern} in ${path}]`;\n\t\t\t}\n\t\t\tcase \"ls\": {\n\t\t\t\tconst path = shortenPath(String(args.path || \".\"));\n\t\t\t\treturn `[ls: ${path}]`;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\t// Custom tool - show name and truncated JSON args\n\t\t\t\tconst argsStr = JSON.stringify(args).slice(0, 40);\n\t\t\t\treturn `[${name}: ${argsStr}${JSON.stringify(args).length > 40 ? \"...\" : \"\"}]`;\n\t\t\t}\n\t\t}\n\t}\n\n\thandleInput(keyData: string): void {\n\t\tconst kb = getKeybindings();\n\t\tif (kb.matches(keyData, \"tui.select.up\")) {\n\t\t\tthis.selectedIndex = this.selectedIndex === 0 ? this.filteredNodes.length - 1 : this.selectedIndex - 1;\n\t\t} else if (kb.matches(keyData, \"tui.select.down\")) {\n\t\t\tthis.selectedIndex = this.selectedIndex === this.filteredNodes.length - 1 ? 0 : this.selectedIndex + 1;\n\t\t} else if (kb.matches(keyData, \"app.tree.foldOrUp\")) {\n\t\t\tconst currentId = this.filteredNodes[this.selectedIndex]?.node.entry.id;\n\t\t\tif (currentId && this.isFoldable(currentId) && !this.foldedNodes.has(currentId)) {\n\t\t\t\tthis.foldedNodes.add(currentId);\n\t\t\t\tthis.applyFilter();\n\t\t\t} else {\n\t\t\t\tthis.selectedIndex = this.findBranchSegmentStart(\"up\");\n\t\t\t}\n\t\t} else if (kb.matches(keyData, \"app.tree.unfoldOrDown\")) {\n\t\t\tconst currentId = this.filteredNodes[this.selectedIndex]?.node.entry.id;\n\t\t\tif (currentId && this.foldedNodes.has(currentId)) {\n\t\t\t\tthis.foldedNodes.delete(currentId);\n\t\t\t\tthis.applyFilter();\n\t\t\t} else {\n\t\t\t\tthis.selectedIndex = this.findBranchSegmentStart(\"down\");\n\t\t\t}\n\t\t} else if (kb.matches(keyData, \"tui.editor.cursorLeft\") || kb.matches(keyData, \"tui.select.pageUp\")) {\n\t\t\t// Page up\n\t\t\tthis.selectedIndex = Math.max(0, this.selectedIndex - this.maxVisibleLines);\n\t\t} else if (kb.matches(keyData, \"tui.editor.cursorRight\") || kb.matches(keyData, \"tui.select.pageDown\")) {\n\t\t\t// Page down\n\t\t\tthis.selectedIndex = Math.min(this.filteredNodes.length - 1, this.selectedIndex + this.maxVisibleLines);\n\t\t} else if (kb.matches(keyData, \"tui.select.confirm\")) {\n\t\t\tconst selected = this.filteredNodes[this.selectedIndex];\n\t\t\tif (selected && this.onSelect) {\n\t\t\t\tthis.onSelect(selected.node.entry.id);\n\t\t\t}\n\t\t} else if (kb.matches(keyData, \"tui.select.cancel\")) {\n\t\t\tif (this.searchQuery) {\n\t\t\t\tthis.searchQuery = \"\";\n\t\t\t\tthis.foldedNodes.clear();\n\t\t\t\tthis.applyFilter();\n\t\t\t} else {\n\t\t\t\tthis.onCancel?.();\n\t\t\t}\n\t\t} else if (matchesKey(keyData, \"ctrl+d\")) {\n\t\t\t// Direct filter: default\n\t\t\tthis.filterMode = \"default\";\n\t\t\tthis.foldedNodes.clear();\n\t\t\tthis.applyFilter();\n\t\t} else if (matchesKey(keyData, \"ctrl+t\")) {\n\t\t\t// Toggle filter: no-tools ↔ default\n\t\t\tthis.filterMode = this.filterMode === \"no-tools\" ? \"default\" : \"no-tools\";\n\t\t\tthis.foldedNodes.clear();\n\t\t\tthis.applyFilter();\n\t\t} else if (matchesKey(keyData, \"ctrl+u\")) {\n\t\t\t// Toggle filter: user-only ↔ default\n\t\t\tthis.filterMode = this.filterMode === \"user-only\" ? \"default\" : \"user-only\";\n\t\t\tthis.foldedNodes.clear();\n\t\t\tthis.applyFilter();\n\t\t} else if (matchesKey(keyData, \"ctrl+l\")) {\n\t\t\t// Toggle filter: labeled-only ↔ default\n\t\t\tthis.filterMode = this.filterMode === \"labeled-only\" ? \"default\" : \"labeled-only\";\n\t\t\tthis.foldedNodes.clear();\n\t\t\tthis.applyFilter();\n\t\t} else if (matchesKey(keyData, \"ctrl+a\")) {\n\t\t\t// Toggle filter: all ↔ default\n\t\t\tthis.filterMode = this.filterMode === \"all\" ? \"default\" : \"all\";\n\t\t\tthis.foldedNodes.clear();\n\t\t\tthis.applyFilter();\n\t\t} else if (matchesKey(keyData, \"shift+ctrl+o\")) {\n\t\t\t// Cycle filter backwards\n\t\t\tconst modes: FilterMode[] = [\"default\", \"no-tools\", \"user-only\", \"labeled-only\", \"all\"];\n\t\t\tconst currentIndex = modes.indexOf(this.filterMode);\n\t\t\tthis.filterMode = modes[(currentIndex - 1 + modes.length) % modes.length];\n\t\t\tthis.foldedNodes.clear();\n\t\t\tthis.applyFilter();\n\t\t} else if (matchesKey(keyData, \"ctrl+o\")) {\n\t\t\t// Cycle filter forwards: default → no-tools → user-only → labeled-only → all → default\n\t\t\tconst modes: FilterMode[] = [\"default\", \"no-tools\", \"user-only\", \"labeled-only\", \"all\"];\n\t\t\tconst currentIndex = modes.indexOf(this.filterMode);\n\t\t\tthis.filterMode = modes[(currentIndex + 1) % modes.length];\n\t\t\tthis.foldedNodes.clear();\n\t\t\tthis.applyFilter();\n\t\t} else if (kb.matches(keyData, \"tui.editor.deleteCharBackward\")) {\n\t\t\tif (this.searchQuery.length > 0) {\n\t\t\t\tthis.searchQuery = this.searchQuery.slice(0, -1);\n\t\t\t\tthis.foldedNodes.clear();\n\t\t\t\tthis.applyFilter();\n\t\t\t}\n\t\t} else if (kb.matches(keyData, \"app.tree.editLabel\")) {\n\t\t\tconst selected = this.filteredNodes[this.selectedIndex];\n\t\t\tif (selected && this.onLabelEdit) {\n\t\t\t\tthis.onLabelEdit(selected.node.entry.id, selected.node.label);\n\t\t\t}\n\t\t} else if (kb.matches(keyData, \"app.tree.toggleLabelTimestamp\")) {\n\t\t\tthis.showLabelTimestamps = !this.showLabelTimestamps;\n\t\t} else {\n\t\t\tconst hasControlChars = [...keyData].some((ch) => {\n\t\t\t\tconst code = ch.charCodeAt(0);\n\t\t\t\treturn code < 32 || code === 0x7f || (code >= 0x80 && code <= 0x9f);\n\t\t\t});\n\t\t\tif (!hasControlChars && keyData.length > 0) {\n\t\t\t\tthis.searchQuery += keyData;\n\t\t\t\tthis.foldedNodes.clear();\n\t\t\t\tthis.applyFilter();\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Whether a node can be folded. A node is foldable if it has visible children\n\t * and is either a root (no visible parent) or a segment start (visible parent\n\t * has multiple visible children).\n\t */\n\tprivate isFoldable(entryId: string): boolean {\n\t\tconst children = this.visibleChildrenMap.get(entryId);\n\t\tif (!children || children.length === 0) return false;\n\t\tconst parentId = this.visibleParentMap.get(entryId);\n\t\tif (parentId === null || parentId === undefined) return true;\n\t\tconst siblings = this.visibleChildrenMap.get(parentId);\n\t\treturn siblings !== undefined && siblings.length > 1;\n\t}\n\n\t/**\n\t * Find the index of the next branch segment start in the given direction.\n\t * A segment start is the first child of a branch point.\n\t *\n\t * \"up\" walks the visible parent chain; \"down\" walks visible children\n\t * (always following the first child).\n\t */\n\tprivate findBranchSegmentStart(direction: \"up\" | \"down\"): number {\n\t\tconst selectedId = this.filteredNodes[this.selectedIndex]?.node.entry.id;\n\t\tif (!selectedId) return this.selectedIndex;\n\n\t\tconst indexByEntryId = new Map(this.filteredNodes.map((node, i) => [node.node.entry.id, i]));\n\t\tlet currentId: string = selectedId;\n\t\tif (direction === \"down\") {\n\t\t\twhile (true) {\n\t\t\t\tconst children: string[] = this.visibleChildrenMap.get(currentId) ?? [];\n\t\t\t\tif (children.length === 0) return indexByEntryId.get(currentId)!;\n\t\t\t\tif (children.length > 1) return indexByEntryId.get(children[0])!;\n\t\t\t\tcurrentId = children[0];\n\t\t\t}\n\t\t}\n\n\t\t// direction === \"up\"\n\t\twhile (true) {\n\t\t\tconst parentId: string | null = this.visibleParentMap.get(currentId) ?? null;\n\t\t\tif (parentId === null) return indexByEntryId.get(currentId)!;\n\t\t\tconst children = this.visibleChildrenMap.get(parentId) ?? [];\n\t\t\tif (children.length > 1) {\n\t\t\t\tconst segmentStart = indexByEntryId.get(currentId)!;\n\t\t\t\tif (segmentStart < this.selectedIndex) {\n\t\t\t\t\treturn segmentStart;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcurrentId = parentId;\n\t\t}\n\t}\n}\n\n/** Component that displays the current search query */\nclass SearchLine implements Component {\n\tconstructor(private treeList: TreeList) {}\n\n\tinvalidate(): void {}\n\n\trender(width: number): string[] {\n\t\tconst query = this.treeList.getSearchQuery();\n\t\tif (query) {\n\t\t\treturn [truncateToWidth(` ${theme.fg(\"muted\", \"Type to search:\")} ${theme.fg(\"accent\", query)}`, width)];\n\t\t}\n\t\treturn [truncateToWidth(` ${theme.fg(\"muted\", \"Type to search:\")}`, width)];\n\t}\n\n\thandleInput(_keyData: string): void {}\n}\n\n/** Label input component shown when editing a label */\nclass LabelInput implements Component, Focusable {\n\tprivate input: Input;\n\tprivate entryId: string;\n\tpublic onSubmit?: (entryId: string, label: string | undefined) => void;\n\tpublic onCancel?: () => void;\n\n\t// Focusable implementation - propagate to input for IME cursor positioning\n\tprivate _focused = false;\n\tget focused(): boolean {\n\t\treturn this._focused;\n\t}\n\tset focused(value: boolean) {\n\t\tthis._focused = value;\n\t\tthis.input.focused = value;\n\t}\n\n\tconstructor(entryId: string, currentLabel: string | undefined) {\n\t\tthis.entryId = entryId;\n\t\tthis.input = new Input();\n\t\tif (currentLabel) {\n\t\t\tthis.input.setValue(currentLabel);\n\t\t}\n\t}\n\n\tinvalidate(): void {}\n\n\trender(width: number): string[] {\n\t\tconst lines: string[] = [];\n\t\tconst indent = \" \";\n\t\tconst availableWidth = width - indent.length;\n\t\tlines.push(truncateToWidth(`${indent}${theme.fg(\"muted\", \"Label (empty to remove):\")}`, width));\n\t\tlines.push(...this.input.render(availableWidth).map((line) => truncateToWidth(`${indent}${line}`, width)));\n\t\tlines.push(\n\t\t\ttruncateToWidth(\n\t\t\t\t`${indent}${keyHint(\"tui.select.confirm\", \"save\")} ${keyHint(\"tui.select.cancel\", \"cancel\")}`,\n\t\t\t\twidth,\n\t\t\t),\n\t\t);\n\t\treturn lines;\n\t}\n\n\thandleInput(keyData: string): void {\n\t\tconst kb = getKeybindings();\n\t\tif (kb.matches(keyData, \"tui.select.confirm\")) {\n\t\t\tconst value = this.input.getValue().trim();\n\t\t\tthis.onSubmit?.(this.entryId, value || undefined);\n\t\t} else if (kb.matches(keyData, \"tui.select.cancel\")) {\n\t\t\tthis.onCancel?.();\n\t\t} else {\n\t\t\tthis.input.handleInput(keyData);\n\t\t}\n\t}\n}\n\n/**\n * Component that renders a session tree selector for navigation\n */\nexport class TreeSelectorComponent extends Container implements Focusable {\n\tprivate treeList: TreeList;\n\tprivate labelInput: LabelInput | null = null;\n\tprivate labelInputContainer: Container;\n\tprivate treeContainer: Container;\n\tprivate onLabelChangeCallback?: (entryId: string, label: string | undefined) => void;\n\n\t// Focusable implementation - propagate to labelInput when active for IME cursor positioning\n\tprivate _focused = false;\n\tget focused(): boolean {\n\t\treturn this._focused;\n\t}\n\tset focused(value: boolean) {\n\t\tthis._focused = value;\n\t\t// Propagate to labelInput when it's active\n\t\tif (this.labelInput) {\n\t\t\tthis.labelInput.focused = value;\n\t\t}\n\t}\n\n\tconstructor(\n\t\ttree: SessionTreeNode[],\n\t\tcurrentLeafId: string | null,\n\t\tterminalHeight: number,\n\t\tonSelect: (entryId: string) => void,\n\t\tonCancel: () => void,\n\t\tonLabelChange?: (entryId: string, label: string | undefined) => void,\n\t\tinitialSelectedId?: string,\n\t\tinitialFilterMode?: FilterMode,\n\t) {\n\t\tsuper();\n\n\t\tthis.onLabelChangeCallback = onLabelChange;\n\t\tconst maxVisibleLines = Math.max(5, Math.floor(terminalHeight / 2));\n\n\t\tthis.treeList = new TreeList(tree, currentLeafId, maxVisibleLines, initialSelectedId, initialFilterMode);\n\t\tthis.treeList.onSelect = onSelect;\n\t\tthis.treeList.onCancel = onCancel;\n\t\tthis.treeList.onLabelEdit = (entryId, currentLabel) => this.showLabelInput(entryId, currentLabel);\n\n\t\tthis.treeContainer = new Container();\n\t\tthis.treeContainer.addChild(this.treeList);\n\n\t\tthis.labelInputContainer = new Container();\n\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild(new DynamicBorder());\n\t\tthis.addChild(new Text(theme.bold(\" Session Tree\"), 1, 0));\n\t\tthis.addChild(\n\t\t\tnew TruncatedText(\n\t\t\t\ttheme.fg(\n\t\t\t\t\t\"muted\",\n\t\t\t\t\t` ↑/↓: move. ←/→: page. ^←/^→ or Alt+←/Alt+→: fold/branch. ${keyText(\"app.tree.editLabel\")}: label. ^D/^T/^U/^L/^A: filters (^O/⇧^O cycle). ${keyText(\"app.tree.toggleLabelTimestamp\")}: label time`,\n\t\t\t\t),\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t),\n\t\t);\n\t\tthis.addChild(new SearchLine(this.treeList));\n\t\tthis.addChild(new DynamicBorder());\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild(this.treeContainer);\n\t\tthis.addChild(this.labelInputContainer);\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild(new DynamicBorder());\n\n\t\tif (tree.length === 0) {\n\t\t\tsetTimeout(() => onCancel(), 100);\n\t\t}\n\t}\n\n\tprivate showLabelInput(entryId: string, currentLabel: string | undefined): void {\n\t\tthis.labelInput = new LabelInput(entryId, currentLabel);\n\t\tthis.labelInput.onSubmit = (id, label) => {\n\t\t\tthis.treeList.updateNodeLabel(id, label);\n\t\t\tthis.onLabelChangeCallback?.(id, label);\n\t\t\tthis.hideLabelInput();\n\t\t};\n\t\tthis.labelInput.onCancel = () => this.hideLabelInput();\n\n\t\t// Propagate current focused state to the new labelInput\n\t\tthis.labelInput.focused = this._focused;\n\n\t\tthis.treeContainer.clear();\n\t\tthis.labelInputContainer.clear();\n\t\tthis.labelInputContainer.addChild(this.labelInput);\n\t}\n\n\tprivate hideLabelInput(): void {\n\t\tthis.labelInput = null;\n\t\tthis.labelInputContainer.clear();\n\t\tthis.treeContainer.clear();\n\t\tthis.treeContainer.addChild(this.treeList);\n\t}\n\n\thandleInput(keyData: string): void {\n\t\tif (this.labelInput) {\n\t\t\tthis.labelInput.handleInput(keyData);\n\t\t} else {\n\t\t\tthis.treeList.handleInput(keyData);\n\t\t}\n\t}\n\n\tgetTreeList(): TreeList {\n\t\treturn this.treeList;\n\t}\n}\n"]}
1
+ {"version":3,"file":"tree-selector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tree-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,SAAS,EACd,SAAS,EACT,KAAK,SAAS,EAQd,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AA0BxE,mCAAmC;AACnC,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,cAAc,GAAG,KAAK,CAAC;AAWvF,cAAM,QAAS,YAAW,S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"}
@@ -3,25 +3,20 @@ import { theme } from "../theme/theme.js";
3
3
  import { DynamicBorder } from "./dynamic-border.js";
4
4
  import { keyHint, keyText } from "./keybinding-hints.js";
5
5
  class TreeList {
6
- flatNodes = [];
7
- filteredNodes = [];
8
- selectedIndex = 0;
9
- currentLeafId;
10
- maxVisibleLines;
11
- filterMode = "default";
12
- searchQuery = "";
13
- toolCallMap = new Map();
14
- multipleRoots = false;
15
- showLabelTimestamps = false;
16
- activePathIds = new Set();
17
- visibleParentMap = new Map();
18
- visibleChildrenMap = new Map();
19
- lastSelectedId = null;
20
- foldedNodes = new Set();
21
- onSelect;
22
- onCancel;
23
- onLabelEdit;
24
6
  constructor(tree, currentLeafId, maxVisibleLines, initialSelectedId, initialFilterMode) {
7
+ this.flatNodes = [];
8
+ this.filteredNodes = [];
9
+ this.selectedIndex = 0;
10
+ this.filterMode = "default";
11
+ this.searchQuery = "";
12
+ this.toolCallMap = new Map();
13
+ this.multipleRoots = false;
14
+ this.showLabelTimestamps = false;
15
+ this.activePathIds = new Set();
16
+ this.visibleParentMap = new Map();
17
+ this.visibleChildrenMap = new Map();
18
+ this.lastSelectedId = null;
19
+ this.foldedNodes = new Set();
25
20
  this.currentLeafId = currentLeafId;
26
21
  this.maxVisibleLines = maxVisibleLines;
27
22
  this.filterMode = initialFilterMode ?? "default";
@@ -942,7 +937,6 @@ class TreeList {
942
937
  }
943
938
  /** Component that displays the current search query */
944
939
  class SearchLine {
945
- treeList;
946
940
  constructor(treeList) {
947
941
  this.treeList = treeList;
948
942
  }
@@ -958,12 +952,6 @@ class SearchLine {
958
952
  }
959
953
  /** Label input component shown when editing a label */
960
954
  class LabelInput {
961
- input;
962
- entryId;
963
- onSubmit;
964
- onCancel;
965
- // Focusable implementation - propagate to input for IME cursor positioning
966
- _focused = false;
967
955
  get focused() {
968
956
  return this._focused;
969
957
  }
@@ -972,6 +960,8 @@ class LabelInput {
972
960
  this.input.focused = value;
973
961
  }
974
962
  constructor(entryId, currentLabel) {
963
+ // Focusable implementation - propagate to input for IME cursor positioning
964
+ this._focused = false;
975
965
  this.entryId = entryId;
976
966
  this.input = new Input();
977
967
  if (currentLabel) {
@@ -1006,13 +996,6 @@ class LabelInput {
1006
996
  * Component that renders a session tree selector for navigation
1007
997
  */
1008
998
  export class TreeSelectorComponent extends Container {
1009
- treeList;
1010
- labelInput = null;
1011
- labelInputContainer;
1012
- treeContainer;
1013
- onLabelChangeCallback;
1014
- // Focusable implementation - propagate to labelInput when active for IME cursor positioning
1015
- _focused = false;
1016
999
  get focused() {
1017
1000
  return this._focused;
1018
1001
  }
@@ -1025,6 +1008,9 @@ export class TreeSelectorComponent extends Container {
1025
1008
  }
1026
1009
  constructor(tree, currentLeafId, terminalHeight, onSelect, onCancel, onLabelChange, initialSelectedId, initialFilterMode) {
1027
1010
  super();
1011
+ this.labelInput = null;
1012
+ // Focusable implementation - propagate to labelInput when active for IME cursor positioning
1013
+ this._focused = false;
1028
1014
  this.onLabelChangeCallback = onLabelChange;
1029
1015
  const maxVisibleLines = Math.max(5, Math.floor(terminalHeight / 2));
1030
1016
  this.treeList = new TreeList(tree, currentLeafId, maxVisibleLines, initialSelectedId, initialFilterMode);