meetsoma 0.3.2 → 0.3.4

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 (516) hide show
  1. package/CHANGELOG.md +26 -194
  2. package/dist/thin-cli.js +1587 -392
  3. package/package.json +12 -59
  4. package/bin/gum +0 -0
  5. package/dist/bun/cli.d.ts +0 -3
  6. package/dist/bun/cli.d.ts.map +0 -1
  7. package/dist/bun/cli.js +0 -7
  8. package/dist/bun/cli.js.map +0 -1
  9. package/dist/bun/register-bedrock.d.ts +0 -2
  10. package/dist/bun/register-bedrock.d.ts.map +0 -1
  11. package/dist/bun/register-bedrock.js +0 -4
  12. package/dist/bun/register-bedrock.js.map +0 -1
  13. package/dist/cli/args.d.ts +0 -49
  14. package/dist/cli/args.d.ts.map +0 -1
  15. package/dist/cli/args.js +0 -304
  16. package/dist/cli/args.js.map +0 -1
  17. package/dist/cli/config-selector.d.ts +0 -14
  18. package/dist/cli/config-selector.d.ts.map +0 -1
  19. package/dist/cli/config-selector.js +0 -31
  20. package/dist/cli/config-selector.js.map +0 -1
  21. package/dist/cli/file-processor.d.ts +0 -15
  22. package/dist/cli/file-processor.d.ts.map +0 -1
  23. package/dist/cli/file-processor.js +0 -83
  24. package/dist/cli/file-processor.js.map +0 -1
  25. package/dist/cli/initial-message.d.ts +0 -18
  26. package/dist/cli/initial-message.d.ts.map +0 -1
  27. package/dist/cli/initial-message.js +0 -22
  28. package/dist/cli/initial-message.js.map +0 -1
  29. package/dist/cli/list-models.d.ts +0 -9
  30. package/dist/cli/list-models.d.ts.map +0 -1
  31. package/dist/cli/list-models.js +0 -92
  32. package/dist/cli/list-models.js.map +0 -1
  33. package/dist/cli/session-picker.d.ts +0 -9
  34. package/dist/cli/session-picker.d.ts.map +0 -1
  35. package/dist/cli/session-picker.js +0 -35
  36. package/dist/cli/session-picker.js.map +0 -1
  37. package/dist/cli.d.ts +0 -3
  38. package/dist/cli.d.ts.map +0 -1
  39. package/dist/cli.js +0 -601
  40. package/dist/cli.js.map +0 -1
  41. package/dist/config.d.ts +0 -68
  42. package/dist/config.d.ts.map +0 -1
  43. package/dist/config.js +0 -203
  44. package/dist/config.js.map +0 -1
  45. package/dist/core/agent-session-runtime.d.ts +0 -134
  46. package/dist/core/agent-session-runtime.d.ts.map +0 -1
  47. package/dist/core/agent-session-runtime.js +0 -264
  48. package/dist/core/agent-session-runtime.js.map +0 -1
  49. package/dist/core/agent-session.d.ts +0 -585
  50. package/dist/core/agent-session.d.ts.map +0 -1
  51. package/dist/core/agent-session.js +0 -2497
  52. package/dist/core/agent-session.js.map +0 -1
  53. package/dist/core/auth-storage.d.ts +0 -132
  54. package/dist/core/auth-storage.d.ts.map +0 -1
  55. package/dist/core/auth-storage.js +0 -422
  56. package/dist/core/auth-storage.js.map +0 -1
  57. package/dist/core/bash-executor.d.ts +0 -46
  58. package/dist/core/bash-executor.d.ts.map +0 -1
  59. package/dist/core/bash-executor.js +0 -113
  60. package/dist/core/bash-executor.js.map +0 -1
  61. package/dist/core/compaction/branch-summarization.d.ts +0 -88
  62. package/dist/core/compaction/branch-summarization.d.ts.map +0 -1
  63. package/dist/core/compaction/branch-summarization.js +0 -243
  64. package/dist/core/compaction/branch-summarization.js.map +0 -1
  65. package/dist/core/compaction/compaction.d.ts +0 -121
  66. package/dist/core/compaction/compaction.d.ts.map +0 -1
  67. package/dist/core/compaction/compaction.js +0 -613
  68. package/dist/core/compaction/compaction.js.map +0 -1
  69. package/dist/core/compaction/index.d.ts +0 -7
  70. package/dist/core/compaction/index.d.ts.map +0 -1
  71. package/dist/core/compaction/index.js +0 -7
  72. package/dist/core/compaction/index.js.map +0 -1
  73. package/dist/core/compaction/utils.d.ts +0 -38
  74. package/dist/core/compaction/utils.d.ts.map +0 -1
  75. package/dist/core/compaction/utils.js +0 -153
  76. package/dist/core/compaction/utils.js.map +0 -1
  77. package/dist/core/defaults.d.ts +0 -3
  78. package/dist/core/defaults.d.ts.map +0 -1
  79. package/dist/core/defaults.js +0 -2
  80. package/dist/core/defaults.js.map +0 -1
  81. package/dist/core/diagnostics.d.ts +0 -15
  82. package/dist/core/diagnostics.d.ts.map +0 -1
  83. package/dist/core/diagnostics.js +0 -2
  84. package/dist/core/diagnostics.js.map +0 -1
  85. package/dist/core/event-bus.d.ts +0 -9
  86. package/dist/core/event-bus.d.ts.map +0 -1
  87. package/dist/core/event-bus.js +0 -25
  88. package/dist/core/event-bus.js.map +0 -1
  89. package/dist/core/exec.d.ts +0 -29
  90. package/dist/core/exec.d.ts.map +0 -1
  91. package/dist/core/exec.js +0 -75
  92. package/dist/core/exec.js.map +0 -1
  93. package/dist/core/export-html/ansi-to-html.d.ts +0 -22
  94. package/dist/core/export-html/ansi-to-html.d.ts.map +0 -1
  95. package/dist/core/export-html/ansi-to-html.js +0 -249
  96. package/dist/core/export-html/ansi-to-html.js.map +0 -1
  97. package/dist/core/export-html/index.d.ts +0 -37
  98. package/dist/core/export-html/index.d.ts.map +0 -1
  99. package/dist/core/export-html/index.js +0 -224
  100. package/dist/core/export-html/index.js.map +0 -1
  101. package/dist/core/export-html/template.css +0 -1001
  102. package/dist/core/export-html/template.html +0 -55
  103. package/dist/core/export-html/template.js +0 -1690
  104. package/dist/core/export-html/tool-renderer.d.ts +0 -40
  105. package/dist/core/export-html/tool-renderer.d.ts.map +0 -1
  106. package/dist/core/export-html/tool-renderer.js +0 -95
  107. package/dist/core/export-html/tool-renderer.js.map +0 -1
  108. package/dist/core/export-html/vendor/highlight.min.js +0 -1213
  109. package/dist/core/export-html/vendor/marked.min.js +0 -6
  110. package/dist/core/extensions/index.d.ts +0 -12
  111. package/dist/core/extensions/index.d.ts.map +0 -1
  112. package/dist/core/extensions/index.js +0 -9
  113. package/dist/core/extensions/index.js.map +0 -1
  114. package/dist/core/extensions/loader.d.ts +0 -25
  115. package/dist/core/extensions/loader.d.ts.map +0 -1
  116. package/dist/core/extensions/loader.js +0 -436
  117. package/dist/core/extensions/loader.js.map +0 -1
  118. package/dist/core/extensions/runner.d.ts +0 -148
  119. package/dist/core/extensions/runner.d.ts.map +0 -1
  120. package/dist/core/extensions/runner.js +0 -700
  121. package/dist/core/extensions/runner.js.map +0 -1
  122. package/dist/core/extensions/types.d.ts +0 -1076
  123. package/dist/core/extensions/types.d.ts.map +0 -1
  124. package/dist/core/extensions/types.js +0 -35
  125. package/dist/core/extensions/types.js.map +0 -1
  126. package/dist/core/extensions/wrapper.d.ts +0 -20
  127. package/dist/core/extensions/wrapper.d.ts.map +0 -1
  128. package/dist/core/extensions/wrapper.js +0 -22
  129. package/dist/core/extensions/wrapper.js.map +0 -1
  130. package/dist/core/footer-data-provider.d.ts +0 -48
  131. package/dist/core/footer-data-provider.d.ts.map +0 -1
  132. package/dist/core/footer-data-provider.js +0 -314
  133. package/dist/core/footer-data-provider.js.map +0 -1
  134. package/dist/core/index.d.ts +0 -11
  135. package/dist/core/index.d.ts.map +0 -1
  136. package/dist/core/index.js +0 -11
  137. package/dist/core/index.js.map +0 -1
  138. package/dist/core/keybindings.d.ts +0 -285
  139. package/dist/core/keybindings.d.ts.map +0 -1
  140. package/dist/core/keybindings.js +0 -251
  141. package/dist/core/keybindings.js.map +0 -1
  142. package/dist/core/messages.d.ts +0 -77
  143. package/dist/core/messages.d.ts.map +0 -1
  144. package/dist/core/messages.js +0 -123
  145. package/dist/core/messages.js.map +0 -1
  146. package/dist/core/model-registry.d.ts +0 -132
  147. package/dist/core/model-registry.d.ts.map +0 -1
  148. package/dist/core/model-registry.js +0 -583
  149. package/dist/core/model-registry.js.map +0 -1
  150. package/dist/core/model-resolver.d.ts +0 -110
  151. package/dist/core/model-resolver.d.ts.map +0 -1
  152. package/dist/core/model-resolver.js +0 -486
  153. package/dist/core/model-resolver.js.map +0 -1
  154. package/dist/core/output-guard.d.ts +0 -6
  155. package/dist/core/output-guard.d.ts.map +0 -1
  156. package/dist/core/output-guard.js +0 -59
  157. package/dist/core/output-guard.js.map +0 -1
  158. package/dist/core/package-manager.d.ts +0 -172
  159. package/dist/core/package-manager.d.ts.map +0 -1
  160. package/dist/core/package-manager.js +0 -1783
  161. package/dist/core/package-manager.js.map +0 -1
  162. package/dist/core/prompt-templates.d.ts +0 -51
  163. package/dist/core/prompt-templates.d.ts.map +0 -1
  164. package/dist/core/prompt-templates.js +0 -249
  165. package/dist/core/prompt-templates.js.map +0 -1
  166. package/dist/core/resolve-config-value.d.ts +0 -23
  167. package/dist/core/resolve-config-value.d.ts.map +0 -1
  168. package/dist/core/resolve-config-value.js +0 -126
  169. package/dist/core/resolve-config-value.js.map +0 -1
  170. package/dist/core/resource-loader.d.ts +0 -185
  171. package/dist/core/resource-loader.d.ts.map +0 -1
  172. package/dist/core/resource-loader.js +0 -698
  173. package/dist/core/resource-loader.js.map +0 -1
  174. package/dist/core/sdk.d.ts +0 -93
  175. package/dist/core/sdk.d.ts.map +0 -1
  176. package/dist/core/sdk.js +0 -236
  177. package/dist/core/sdk.js.map +0 -1
  178. package/dist/core/session-manager.d.ts +0 -332
  179. package/dist/core/session-manager.d.ts.map +0 -1
  180. package/dist/core/session-manager.js +0 -1104
  181. package/dist/core/session-manager.js.map +0 -1
  182. package/dist/core/settings-manager.d.ts +0 -237
  183. package/dist/core/settings-manager.d.ts.map +0 -1
  184. package/dist/core/settings-manager.js +0 -702
  185. package/dist/core/settings-manager.js.map +0 -1
  186. package/dist/core/skills.d.ts +0 -60
  187. package/dist/core/skills.d.ts.map +0 -1
  188. package/dist/core/skills.js +0 -409
  189. package/dist/core/skills.js.map +0 -1
  190. package/dist/core/slash-commands.d.ts +0 -14
  191. package/dist/core/slash-commands.d.ts.map +0 -1
  192. package/dist/core/slash-commands.js +0 -23
  193. package/dist/core/slash-commands.js.map +0 -1
  194. package/dist/core/source-info.d.ts +0 -18
  195. package/dist/core/source-info.d.ts.map +0 -1
  196. package/dist/core/source-info.js +0 -19
  197. package/dist/core/source-info.js.map +0 -1
  198. package/dist/core/system-prompt.d.ts +0 -28
  199. package/dist/core/system-prompt.d.ts.map +0 -1
  200. package/dist/core/system-prompt.js +0 -116
  201. package/dist/core/system-prompt.js.map +0 -1
  202. package/dist/core/timings.d.ts +0 -8
  203. package/dist/core/timings.d.ts.map +0 -1
  204. package/dist/core/timings.js +0 -31
  205. package/dist/core/timings.js.map +0 -1
  206. package/dist/core/tools/bash.d.ts +0 -73
  207. package/dist/core/tools/bash.d.ts.map +0 -1
  208. package/dist/core/tools/bash.js +0 -342
  209. package/dist/core/tools/bash.js.map +0 -1
  210. package/dist/core/tools/edit-diff.d.ts +0 -85
  211. package/dist/core/tools/edit-diff.d.ts.map +0 -1
  212. package/dist/core/tools/edit-diff.js +0 -337
  213. package/dist/core/tools/edit-diff.js.map +0 -1
  214. package/dist/core/tools/edit.d.ts +0 -53
  215. package/dist/core/tools/edit.d.ts.map +0 -1
  216. package/dist/core/tools/edit.js +0 -196
  217. package/dist/core/tools/edit.js.map +0 -1
  218. package/dist/core/tools/file-mutation-queue.d.ts +0 -6
  219. package/dist/core/tools/file-mutation-queue.d.ts.map +0 -1
  220. package/dist/core/tools/file-mutation-queue.js +0 -37
  221. package/dist/core/tools/file-mutation-queue.js.map +0 -1
  222. package/dist/core/tools/find.d.ts +0 -46
  223. package/dist/core/tools/find.d.ts.map +0 -1
  224. package/dist/core/tools/find.js +0 -258
  225. package/dist/core/tools/find.js.map +0 -1
  226. package/dist/core/tools/grep.d.ts +0 -56
  227. package/dist/core/tools/grep.d.ts.map +0 -1
  228. package/dist/core/tools/grep.js +0 -293
  229. package/dist/core/tools/grep.js.map +0 -1
  230. package/dist/core/tools/index.d.ts +0 -115
  231. package/dist/core/tools/index.d.ts.map +0 -1
  232. package/dist/core/tools/index.js +0 -86
  233. package/dist/core/tools/index.js.map +0 -1
  234. package/dist/core/tools/ls.d.ts +0 -46
  235. package/dist/core/tools/ls.d.ts.map +0 -1
  236. package/dist/core/tools/ls.js +0 -172
  237. package/dist/core/tools/ls.js.map +0 -1
  238. package/dist/core/tools/path-utils.d.ts +0 -8
  239. package/dist/core/tools/path-utils.d.ts.map +0 -1
  240. package/dist/core/tools/path-utils.js +0 -81
  241. package/dist/core/tools/path-utils.js.map +0 -1
  242. package/dist/core/tools/read.d.ts +0 -46
  243. package/dist/core/tools/read.d.ts.map +0 -1
  244. package/dist/core/tools/read.js +0 -225
  245. package/dist/core/tools/read.js.map +0 -1
  246. package/dist/core/tools/render-utils.d.ts +0 -21
  247. package/dist/core/tools/render-utils.d.ts.map +0 -1
  248. package/dist/core/tools/render-utils.js +0 -49
  249. package/dist/core/tools/render-utils.js.map +0 -1
  250. package/dist/core/tools/tool-definition-wrapper.d.ts +0 -14
  251. package/dist/core/tools/tool-definition-wrapper.d.ts.map +0 -1
  252. package/dist/core/tools/tool-definition-wrapper.js +0 -32
  253. package/dist/core/tools/tool-definition-wrapper.js.map +0 -1
  254. package/dist/core/tools/truncate.d.ts +0 -70
  255. package/dist/core/tools/truncate.d.ts.map +0 -1
  256. package/dist/core/tools/truncate.js +0 -205
  257. package/dist/core/tools/truncate.js.map +0 -1
  258. package/dist/core/tools/write.d.ts +0 -35
  259. package/dist/core/tools/write.d.ts.map +0 -1
  260. package/dist/core/tools/write.js +0 -216
  261. package/dist/core/tools/write.js.map +0 -1
  262. package/dist/index.d.ts +0 -28
  263. package/dist/index.d.ts.map +0 -1
  264. package/dist/index.js +0 -43
  265. package/dist/index.js.map +0 -1
  266. package/dist/lib/config.js +0 -22
  267. package/dist/lib/detect.js +0 -94
  268. package/dist/lib/display.js +0 -182
  269. package/dist/main.d.ts +0 -8
  270. package/dist/main.d.ts.map +0 -1
  271. package/dist/main.js +0 -806
  272. package/dist/main.js.map +0 -1
  273. package/dist/migrations.d.ts +0 -33
  274. package/dist/migrations.d.ts.map +0 -1
  275. package/dist/migrations.js +0 -261
  276. package/dist/migrations.js.map +0 -1
  277. package/dist/modes/index.d.ts +0 -9
  278. package/dist/modes/index.d.ts.map +0 -1
  279. package/dist/modes/index.js +0 -8
  280. package/dist/modes/index.js.map +0 -1
  281. package/dist/modes/interactive/components/armin.d.ts +0 -34
  282. package/dist/modes/interactive/components/armin.d.ts.map +0 -1
  283. package/dist/modes/interactive/components/armin.js +0 -333
  284. package/dist/modes/interactive/components/armin.js.map +0 -1
  285. package/dist/modes/interactive/components/assistant-message.d.ts +0 -18
  286. package/dist/modes/interactive/components/assistant-message.d.ts.map +0 -1
  287. package/dist/modes/interactive/components/assistant-message.js +0 -107
  288. package/dist/modes/interactive/components/assistant-message.js.map +0 -1
  289. package/dist/modes/interactive/components/bash-execution.d.ts +0 -34
  290. package/dist/modes/interactive/components/bash-execution.d.ts.map +0 -1
  291. package/dist/modes/interactive/components/bash-execution.js +0 -175
  292. package/dist/modes/interactive/components/bash-execution.js.map +0 -1
  293. package/dist/modes/interactive/components/bordered-loader.d.ts +0 -16
  294. package/dist/modes/interactive/components/bordered-loader.d.ts.map +0 -1
  295. package/dist/modes/interactive/components/bordered-loader.js +0 -51
  296. package/dist/modes/interactive/components/bordered-loader.js.map +0 -1
  297. package/dist/modes/interactive/components/branch-summary-message.d.ts +0 -16
  298. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +0 -1
  299. package/dist/modes/interactive/components/branch-summary-message.js +0 -44
  300. package/dist/modes/interactive/components/branch-summary-message.js.map +0 -1
  301. package/dist/modes/interactive/components/compaction-summary-message.d.ts +0 -16
  302. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +0 -1
  303. package/dist/modes/interactive/components/compaction-summary-message.js +0 -45
  304. package/dist/modes/interactive/components/compaction-summary-message.js.map +0 -1
  305. package/dist/modes/interactive/components/config-selector.d.ts +0 -71
  306. package/dist/modes/interactive/components/config-selector.d.ts.map +0 -1
  307. package/dist/modes/interactive/components/config-selector.js +0 -479
  308. package/dist/modes/interactive/components/config-selector.js.map +0 -1
  309. package/dist/modes/interactive/components/countdown-timer.d.ts +0 -14
  310. package/dist/modes/interactive/components/countdown-timer.d.ts.map +0 -1
  311. package/dist/modes/interactive/components/countdown-timer.js +0 -33
  312. package/dist/modes/interactive/components/countdown-timer.js.map +0 -1
  313. package/dist/modes/interactive/components/custom-editor.d.ts +0 -21
  314. package/dist/modes/interactive/components/custom-editor.d.ts.map +0 -1
  315. package/dist/modes/interactive/components/custom-editor.js +0 -70
  316. package/dist/modes/interactive/components/custom-editor.js.map +0 -1
  317. package/dist/modes/interactive/components/custom-message.d.ts +0 -20
  318. package/dist/modes/interactive/components/custom-message.d.ts.map +0 -1
  319. package/dist/modes/interactive/components/custom-message.js +0 -79
  320. package/dist/modes/interactive/components/custom-message.js.map +0 -1
  321. package/dist/modes/interactive/components/daxnuts.d.ts +0 -23
  322. package/dist/modes/interactive/components/daxnuts.d.ts.map +0 -1
  323. package/dist/modes/interactive/components/daxnuts.js +0 -140
  324. package/dist/modes/interactive/components/daxnuts.js.map +0 -1
  325. package/dist/modes/interactive/components/diff.d.ts +0 -12
  326. package/dist/modes/interactive/components/diff.d.ts.map +0 -1
  327. package/dist/modes/interactive/components/diff.js +0 -133
  328. package/dist/modes/interactive/components/diff.js.map +0 -1
  329. package/dist/modes/interactive/components/dynamic-border.d.ts +0 -15
  330. package/dist/modes/interactive/components/dynamic-border.d.ts.map +0 -1
  331. package/dist/modes/interactive/components/dynamic-border.js +0 -21
  332. package/dist/modes/interactive/components/dynamic-border.js.map +0 -1
  333. package/dist/modes/interactive/components/extension-editor.d.ts +0 -20
  334. package/dist/modes/interactive/components/extension-editor.d.ts.map +0 -1
  335. package/dist/modes/interactive/components/extension-editor.js +0 -111
  336. package/dist/modes/interactive/components/extension-editor.js.map +0 -1
  337. package/dist/modes/interactive/components/extension-input.d.ts +0 -23
  338. package/dist/modes/interactive/components/extension-input.d.ts.map +0 -1
  339. package/dist/modes/interactive/components/extension-input.js +0 -61
  340. package/dist/modes/interactive/components/extension-input.js.map +0 -1
  341. package/dist/modes/interactive/components/extension-selector.d.ts +0 -24
  342. package/dist/modes/interactive/components/extension-selector.d.ts.map +0 -1
  343. package/dist/modes/interactive/components/extension-selector.js +0 -78
  344. package/dist/modes/interactive/components/extension-selector.js.map +0 -1
  345. package/dist/modes/interactive/components/footer.d.ts +0 -27
  346. package/dist/modes/interactive/components/footer.d.ts.map +0 -1
  347. package/dist/modes/interactive/components/footer.js +0 -201
  348. package/dist/modes/interactive/components/footer.js.map +0 -1
  349. package/dist/modes/interactive/components/index.d.ts +0 -32
  350. package/dist/modes/interactive/components/index.d.ts.map +0 -1
  351. package/dist/modes/interactive/components/index.js +0 -33
  352. package/dist/modes/interactive/components/index.js.map +0 -1
  353. package/dist/modes/interactive/components/keybinding-hints.d.ts +0 -8
  354. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +0 -1
  355. package/dist/modes/interactive/components/keybinding-hints.js +0 -22
  356. package/dist/modes/interactive/components/keybinding-hints.js.map +0 -1
  357. package/dist/modes/interactive/components/login-dialog.d.ts +0 -42
  358. package/dist/modes/interactive/components/login-dialog.d.ts.map +0 -1
  359. package/dist/modes/interactive/components/login-dialog.js +0 -145
  360. package/dist/modes/interactive/components/login-dialog.js.map +0 -1
  361. package/dist/modes/interactive/components/model-selector.d.ts +0 -47
  362. package/dist/modes/interactive/components/model-selector.d.ts.map +0 -1
  363. package/dist/modes/interactive/components/model-selector.js +0 -275
  364. package/dist/modes/interactive/components/model-selector.js.map +0 -1
  365. package/dist/modes/interactive/components/oauth-selector.d.ts +0 -19
  366. package/dist/modes/interactive/components/oauth-selector.d.ts.map +0 -1
  367. package/dist/modes/interactive/components/oauth-selector.js +0 -97
  368. package/dist/modes/interactive/components/oauth-selector.js.map +0 -1
  369. package/dist/modes/interactive/components/scoped-models-selector.d.ts +0 -49
  370. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +0 -1
  371. package/dist/modes/interactive/components/scoped-models-selector.js +0 -275
  372. package/dist/modes/interactive/components/scoped-models-selector.js.map +0 -1
  373. package/dist/modes/interactive/components/session-selector-search.d.ts +0 -23
  374. package/dist/modes/interactive/components/session-selector-search.d.ts.map +0 -1
  375. package/dist/modes/interactive/components/session-selector-search.js +0 -155
  376. package/dist/modes/interactive/components/session-selector-search.js.map +0 -1
  377. package/dist/modes/interactive/components/session-selector.d.ts +0 -95
  378. package/dist/modes/interactive/components/session-selector.d.ts.map +0 -1
  379. package/dist/modes/interactive/components/session-selector.js +0 -848
  380. package/dist/modes/interactive/components/session-selector.js.map +0 -1
  381. package/dist/modes/interactive/components/settings-selector.d.ts +0 -58
  382. package/dist/modes/interactive/components/settings-selector.d.ts.map +0 -1
  383. package/dist/modes/interactive/components/settings-selector.js +0 -301
  384. package/dist/modes/interactive/components/settings-selector.js.map +0 -1
  385. package/dist/modes/interactive/components/show-images-selector.d.ts +0 -10
  386. package/dist/modes/interactive/components/show-images-selector.d.ts.map +0 -1
  387. package/dist/modes/interactive/components/show-images-selector.js +0 -39
  388. package/dist/modes/interactive/components/show-images-selector.js.map +0 -1
  389. package/dist/modes/interactive/components/skill-invocation-message.d.ts +0 -17
  390. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +0 -1
  391. package/dist/modes/interactive/components/skill-invocation-message.js +0 -47
  392. package/dist/modes/interactive/components/skill-invocation-message.js.map +0 -1
  393. package/dist/modes/interactive/components/theme-selector.d.ts +0 -11
  394. package/dist/modes/interactive/components/theme-selector.d.ts.map +0 -1
  395. package/dist/modes/interactive/components/theme-selector.js +0 -50
  396. package/dist/modes/interactive/components/theme-selector.js.map +0 -1
  397. package/dist/modes/interactive/components/thinking-selector.d.ts +0 -11
  398. package/dist/modes/interactive/components/thinking-selector.d.ts.map +0 -1
  399. package/dist/modes/interactive/components/thinking-selector.js +0 -51
  400. package/dist/modes/interactive/components/thinking-selector.js.map +0 -1
  401. package/dist/modes/interactive/components/tool-execution.d.ts +0 -58
  402. package/dist/modes/interactive/components/tool-execution.d.ts.map +0 -1
  403. package/dist/modes/interactive/components/tool-execution.js +0 -274
  404. package/dist/modes/interactive/components/tool-execution.js.map +0 -1
  405. package/dist/modes/interactive/components/tree-selector.d.ts +0 -89
  406. package/dist/modes/interactive/components/tree-selector.d.ts.map +0 -1
  407. package/dist/modes/interactive/components/tree-selector.js +0 -1084
  408. package/dist/modes/interactive/components/tree-selector.js.map +0 -1
  409. package/dist/modes/interactive/components/user-message-selector.d.ts +0 -30
  410. package/dist/modes/interactive/components/user-message-selector.d.ts.map +0 -1
  411. package/dist/modes/interactive/components/user-message-selector.js +0 -113
  412. package/dist/modes/interactive/components/user-message-selector.js.map +0 -1
  413. package/dist/modes/interactive/components/user-message.d.ts +0 -9
  414. package/dist/modes/interactive/components/user-message.d.ts.map +0 -1
  415. package/dist/modes/interactive/components/user-message.js +0 -28
  416. package/dist/modes/interactive/components/user-message.js.map +0 -1
  417. package/dist/modes/interactive/components/visual-truncate.d.ts +0 -24
  418. package/dist/modes/interactive/components/visual-truncate.d.ts.map +0 -1
  419. package/dist/modes/interactive/components/visual-truncate.js +0 -33
  420. package/dist/modes/interactive/components/visual-truncate.js.map +0 -1
  421. package/dist/modes/interactive/interactive-mode.d.ts +0 -318
  422. package/dist/modes/interactive/interactive-mode.d.ts.map +0 -1
  423. package/dist/modes/interactive/interactive-mode.js +0 -3907
  424. package/dist/modes/interactive/interactive-mode.js.map +0 -1
  425. package/dist/modes/interactive/theme/dark.json +0 -85
  426. package/dist/modes/interactive/theme/light.json +0 -84
  427. package/dist/modes/interactive/theme/theme-schema.json +0 -335
  428. package/dist/modes/interactive/theme/theme.d.ts +0 -81
  429. package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
  430. package/dist/modes/interactive/theme/theme.js +0 -970
  431. package/dist/modes/interactive/theme/theme.js.map +0 -1
  432. package/dist/modes/print-mode.d.ts +0 -28
  433. package/dist/modes/print-mode.d.ts.map +0 -1
  434. package/dist/modes/print-mode.js +0 -108
  435. package/dist/modes/print-mode.js.map +0 -1
  436. package/dist/modes/rpc/jsonl.d.ts +0 -17
  437. package/dist/modes/rpc/jsonl.d.ts.map +0 -1
  438. package/dist/modes/rpc/jsonl.js +0 -49
  439. package/dist/modes/rpc/jsonl.js.map +0 -1
  440. package/dist/modes/rpc/rpc-client.d.ts +0 -217
  441. package/dist/modes/rpc/rpc-client.d.ts.map +0 -1
  442. package/dist/modes/rpc/rpc-client.js +0 -401
  443. package/dist/modes/rpc/rpc-client.js.map +0 -1
  444. package/dist/modes/rpc/rpc-mode.d.ts +0 -20
  445. package/dist/modes/rpc/rpc-mode.d.ts.map +0 -1
  446. package/dist/modes/rpc/rpc-mode.js +0 -542
  447. package/dist/modes/rpc/rpc-mode.js.map +0 -1
  448. package/dist/modes/rpc/rpc-types.d.ts +0 -408
  449. package/dist/modes/rpc/rpc-types.d.ts.map +0 -1
  450. package/dist/modes/rpc/rpc-types.js +0 -8
  451. package/dist/modes/rpc/rpc-types.js.map +0 -1
  452. package/dist/utils/changelog.d.ts +0 -21
  453. package/dist/utils/changelog.d.ts.map +0 -1
  454. package/dist/utils/changelog.js +0 -87
  455. package/dist/utils/changelog.js.map +0 -1
  456. package/dist/utils/child-process.d.ts +0 -11
  457. package/dist/utils/child-process.d.ts.map +0 -1
  458. package/dist/utils/child-process.js +0 -78
  459. package/dist/utils/child-process.js.map +0 -1
  460. package/dist/utils/clipboard-image.d.ts +0 -11
  461. package/dist/utils/clipboard-image.d.ts.map +0 -1
  462. package/dist/utils/clipboard-image.js +0 -245
  463. package/dist/utils/clipboard-image.js.map +0 -1
  464. package/dist/utils/clipboard-native.d.ts +0 -8
  465. package/dist/utils/clipboard-native.d.ts.map +0 -1
  466. package/dist/utils/clipboard-native.js +0 -14
  467. package/dist/utils/clipboard-native.js.map +0 -1
  468. package/dist/utils/clipboard.d.ts +0 -2
  469. package/dist/utils/clipboard.d.ts.map +0 -1
  470. package/dist/utils/clipboard.js +0 -78
  471. package/dist/utils/clipboard.js.map +0 -1
  472. package/dist/utils/exif-orientation.d.ts +0 -5
  473. package/dist/utils/exif-orientation.d.ts.map +0 -1
  474. package/dist/utils/exif-orientation.js +0 -158
  475. package/dist/utils/exif-orientation.js.map +0 -1
  476. package/dist/utils/frontmatter.d.ts +0 -8
  477. package/dist/utils/frontmatter.d.ts.map +0 -1
  478. package/dist/utils/frontmatter.js +0 -26
  479. package/dist/utils/frontmatter.js.map +0 -1
  480. package/dist/utils/git.d.ts +0 -26
  481. package/dist/utils/git.d.ts.map +0 -1
  482. package/dist/utils/git.js +0 -163
  483. package/dist/utils/git.js.map +0 -1
  484. package/dist/utils/image-convert.d.ts +0 -9
  485. package/dist/utils/image-convert.d.ts.map +0 -1
  486. package/dist/utils/image-convert.js +0 -39
  487. package/dist/utils/image-convert.js.map +0 -1
  488. package/dist/utils/image-resize.d.ts +0 -36
  489. package/dist/utils/image-resize.d.ts.map +0 -1
  490. package/dist/utils/image-resize.js +0 -137
  491. package/dist/utils/image-resize.js.map +0 -1
  492. package/dist/utils/mime.d.ts +0 -2
  493. package/dist/utils/mime.d.ts.map +0 -1
  494. package/dist/utils/mime.js +0 -26
  495. package/dist/utils/mime.js.map +0 -1
  496. package/dist/utils/photon.d.ts +0 -21
  497. package/dist/utils/photon.d.ts.map +0 -1
  498. package/dist/utils/photon.js +0 -121
  499. package/dist/utils/photon.js.map +0 -1
  500. package/dist/utils/shell.d.ts +0 -26
  501. package/dist/utils/shell.d.ts.map +0 -1
  502. package/dist/utils/shell.js +0 -186
  503. package/dist/utils/shell.js.map +0 -1
  504. package/dist/utils/sleep.d.ts +0 -5
  505. package/dist/utils/sleep.d.ts.map +0 -1
  506. package/dist/utils/sleep.js +0 -17
  507. package/dist/utils/sleep.js.map +0 -1
  508. package/dist/utils/tools-manager.d.ts +0 -3
  509. package/dist/utils/tools-manager.d.ts.map +0 -1
  510. package/dist/utils/tools-manager.js +0 -252
  511. package/dist/utils/tools-manager.js.map +0 -1
  512. package/dist/welcome/about.js +0 -50
  513. package/dist/welcome/auth.js +0 -126
  514. package/dist/welcome/intro.js +0 -90
  515. package/dist/welcome/qa.js +0 -131
  516. package/scripts/install-gum.sh +0 -141
@@ -1,848 +0,0 @@
1
- import { spawnSync } from "node:child_process";
2
- import { existsSync } from "node:fs";
3
- import { unlink } from "node:fs/promises";
4
- import * as os from "node:os";
5
- import { Container, getKeybindings, Input, Spacer, Text, truncateToWidth, visibleWidth, } from "@mariozechner/pi-tui";
6
- import { KeybindingsManager } from "../../../core/keybindings.js";
7
- import { theme } from "../theme/theme.js";
8
- import { DynamicBorder } from "./dynamic-border.js";
9
- import { keyHint, keyText } from "./keybinding-hints.js";
10
- import { filterAndSortSessions, hasSessionName } from "./session-selector-search.js";
11
- function shortenPath(path) {
12
- const home = os.homedir();
13
- if (!path)
14
- return path;
15
- if (path.startsWith(home)) {
16
- return `~${path.slice(home.length)}`;
17
- }
18
- return path;
19
- }
20
- function formatSessionDate(date) {
21
- const now = new Date();
22
- const diffMs = now.getTime() - date.getTime();
23
- const diffMins = Math.floor(diffMs / 60000);
24
- const diffHours = Math.floor(diffMs / 3600000);
25
- const diffDays = Math.floor(diffMs / 86400000);
26
- if (diffMins < 1)
27
- return "now";
28
- if (diffMins < 60)
29
- return `${diffMins}m`;
30
- if (diffHours < 24)
31
- return `${diffHours}h`;
32
- if (diffDays < 7)
33
- return `${diffDays}d`;
34
- if (diffDays < 30)
35
- return `${Math.floor(diffDays / 7)}w`;
36
- if (diffDays < 365)
37
- return `${Math.floor(diffDays / 30)}mo`;
38
- return `${Math.floor(diffDays / 365)}y`;
39
- }
40
- class SessionSelectorHeader {
41
- scope;
42
- sortMode;
43
- nameFilter;
44
- requestRender;
45
- loading = false;
46
- loadProgress = null;
47
- showPath = false;
48
- confirmingDeletePath = null;
49
- statusMessage = null;
50
- statusTimeout = null;
51
- showRenameHint = false;
52
- constructor(scope, sortMode, nameFilter, requestRender) {
53
- this.scope = scope;
54
- this.sortMode = sortMode;
55
- this.nameFilter = nameFilter;
56
- this.requestRender = requestRender;
57
- }
58
- setScope(scope) {
59
- this.scope = scope;
60
- }
61
- setSortMode(sortMode) {
62
- this.sortMode = sortMode;
63
- }
64
- setNameFilter(nameFilter) {
65
- this.nameFilter = nameFilter;
66
- }
67
- setLoading(loading) {
68
- this.loading = loading;
69
- // Progress is scoped to the current load; clear whenever the loading state is set
70
- this.loadProgress = null;
71
- }
72
- setProgress(loaded, total) {
73
- this.loadProgress = { loaded, total };
74
- }
75
- setShowPath(showPath) {
76
- this.showPath = showPath;
77
- }
78
- setShowRenameHint(show) {
79
- this.showRenameHint = show;
80
- }
81
- setConfirmingDeletePath(path) {
82
- this.confirmingDeletePath = path;
83
- }
84
- clearStatusTimeout() {
85
- if (!this.statusTimeout)
86
- return;
87
- clearTimeout(this.statusTimeout);
88
- this.statusTimeout = null;
89
- }
90
- setStatusMessage(msg, autoHideMs) {
91
- this.clearStatusTimeout();
92
- this.statusMessage = msg;
93
- if (!msg || !autoHideMs)
94
- return;
95
- this.statusTimeout = setTimeout(() => {
96
- this.statusMessage = null;
97
- this.statusTimeout = null;
98
- this.requestRender();
99
- }, autoHideMs);
100
- }
101
- invalidate() { }
102
- render(width) {
103
- const title = this.scope === "current" ? "Resume Session (Current Folder)" : "Resume Session (All)";
104
- const leftText = theme.bold(title);
105
- const sortLabel = this.sortMode === "threaded" ? "Threaded" : this.sortMode === "recent" ? "Recent" : "Fuzzy";
106
- const sortText = theme.fg("muted", "Sort: ") + theme.fg("accent", sortLabel);
107
- const nameLabel = this.nameFilter === "all" ? "All" : "Named";
108
- const nameText = theme.fg("muted", "Name: ") + theme.fg("accent", nameLabel);
109
- let scopeText;
110
- if (this.loading) {
111
- const progressText = this.loadProgress ? `${this.loadProgress.loaded}/${this.loadProgress.total}` : "...";
112
- scopeText = `${theme.fg("muted", "○ Current Folder | ")}${theme.fg("accent", `Loading ${progressText}`)}`;
113
- }
114
- else if (this.scope === "current") {
115
- scopeText = `${theme.fg("accent", "◉ Current Folder")}${theme.fg("muted", " | ○ All")}`;
116
- }
117
- else {
118
- scopeText = `${theme.fg("muted", "○ Current Folder | ")}${theme.fg("accent", "◉ All")}`;
119
- }
120
- const rightText = truncateToWidth(`${scopeText} ${nameText} ${sortText}`, width, "");
121
- const availableLeft = Math.max(0, width - visibleWidth(rightText) - 1);
122
- const left = truncateToWidth(leftText, availableLeft, "");
123
- const spacing = Math.max(0, width - visibleWidth(left) - visibleWidth(rightText));
124
- // Build hint lines - changes based on state (all branches truncate to width)
125
- let hintLine1;
126
- let hintLine2;
127
- if (this.confirmingDeletePath !== null) {
128
- const confirmHint = `Delete session? ${keyHint("tui.select.confirm", "confirm")} · ${keyHint("tui.select.cancel", "cancel")}`;
129
- hintLine1 = theme.fg("error", truncateToWidth(confirmHint, width, "…"));
130
- hintLine2 = "";
131
- }
132
- else if (this.statusMessage) {
133
- const color = this.statusMessage.type === "error" ? "error" : "accent";
134
- hintLine1 = theme.fg(color, truncateToWidth(this.statusMessage.message, width, "…"));
135
- hintLine2 = "";
136
- }
137
- else {
138
- const pathState = this.showPath ? "(on)" : "(off)";
139
- const sep = theme.fg("muted", " · ");
140
- const hint1 = keyHint("tui.input.tab", "scope") + sep + theme.fg("muted", 're:<pattern> regex · "phrase" exact');
141
- const hint2Parts = [
142
- keyHint("app.session.toggleSort", "sort"),
143
- keyHint("app.session.toggleNamedFilter", "named"),
144
- keyHint("app.session.delete", "delete"),
145
- keyHint("app.session.togglePath", `path ${pathState}`),
146
- ];
147
- if (this.showRenameHint) {
148
- hint2Parts.push(keyHint("app.session.rename", "rename"));
149
- }
150
- const hint2 = hint2Parts.join(sep);
151
- hintLine1 = truncateToWidth(hint1, width, "…");
152
- hintLine2 = truncateToWidth(hint2, width, "…");
153
- }
154
- return [`${left}${" ".repeat(spacing)}${rightText}`, hintLine1, hintLine2];
155
- }
156
- }
157
- /**
158
- * Build a tree structure from sessions based on parentSessionPath.
159
- * Returns root nodes sorted by modified date (descending).
160
- */
161
- function buildSessionTree(sessions) {
162
- const byPath = new Map();
163
- for (const session of sessions) {
164
- byPath.set(session.path, { session, children: [] });
165
- }
166
- const roots = [];
167
- for (const session of sessions) {
168
- const node = byPath.get(session.path);
169
- const parentPath = session.parentSessionPath;
170
- if (parentPath && byPath.has(parentPath)) {
171
- byPath.get(parentPath).children.push(node);
172
- }
173
- else {
174
- roots.push(node);
175
- }
176
- }
177
- // Sort children and roots by modified date (descending)
178
- const sortNodes = (nodes) => {
179
- nodes.sort((a, b) => b.session.modified.getTime() - a.session.modified.getTime());
180
- for (const node of nodes) {
181
- sortNodes(node.children);
182
- }
183
- };
184
- sortNodes(roots);
185
- return roots;
186
- }
187
- /**
188
- * Flatten tree into display list with tree structure metadata.
189
- */
190
- function flattenSessionTree(roots) {
191
- const result = [];
192
- const walk = (node, depth, ancestorContinues, isLast) => {
193
- result.push({ session: node.session, depth, isLast, ancestorContinues });
194
- for (let i = 0; i < node.children.length; i++) {
195
- const childIsLast = i === node.children.length - 1;
196
- // Only show continuation line for non-root ancestors
197
- const continues = depth > 0 ? !isLast : false;
198
- walk(node.children[i], depth + 1, [...ancestorContinues, continues], childIsLast);
199
- }
200
- };
201
- for (let i = 0; i < roots.length; i++) {
202
- walk(roots[i], 0, [], i === roots.length - 1);
203
- }
204
- return result;
205
- }
206
- /**
207
- * Custom session list component with multi-line items and search
208
- */
209
- class SessionList {
210
- getSelectedSessionPath() {
211
- const selected = this.filteredSessions[this.selectedIndex];
212
- return selected?.session.path;
213
- }
214
- allSessions = [];
215
- filteredSessions = [];
216
- selectedIndex = 0;
217
- searchInput;
218
- showCwd = false;
219
- sortMode = "threaded";
220
- nameFilter = "all";
221
- keybindings;
222
- showPath = false;
223
- confirmingDeletePath = null;
224
- currentSessionFilePath;
225
- onSelect;
226
- onCancel;
227
- onExit = () => { };
228
- onToggleScope;
229
- onToggleSort;
230
- onToggleNameFilter;
231
- onTogglePath;
232
- onDeleteConfirmationChange;
233
- onDeleteSession;
234
- onRenameSession;
235
- onError;
236
- maxVisible = 10; // Max sessions visible (one line each)
237
- // Focusable implementation - propagate to searchInput for IME cursor positioning
238
- _focused = false;
239
- get focused() {
240
- return this._focused;
241
- }
242
- set focused(value) {
243
- this._focused = value;
244
- this.searchInput.focused = value;
245
- }
246
- constructor(sessions, showCwd, sortMode, nameFilter, keybindings, currentSessionFilePath) {
247
- this.allSessions = sessions;
248
- this.filteredSessions = [];
249
- this.searchInput = new Input();
250
- this.showCwd = showCwd;
251
- this.sortMode = sortMode;
252
- this.nameFilter = nameFilter;
253
- this.keybindings = keybindings;
254
- this.currentSessionFilePath = currentSessionFilePath;
255
- this.filterSessions("");
256
- // Handle Enter in search input - select current item
257
- this.searchInput.onSubmit = () => {
258
- if (this.filteredSessions[this.selectedIndex]) {
259
- const selected = this.filteredSessions[this.selectedIndex];
260
- if (this.onSelect) {
261
- this.onSelect(selected.session.path);
262
- }
263
- }
264
- };
265
- }
266
- setSortMode(sortMode) {
267
- this.sortMode = sortMode;
268
- this.filterSessions(this.searchInput.getValue());
269
- }
270
- setNameFilter(nameFilter) {
271
- this.nameFilter = nameFilter;
272
- this.filterSessions(this.searchInput.getValue());
273
- }
274
- setSessions(sessions, showCwd) {
275
- this.allSessions = sessions;
276
- this.showCwd = showCwd;
277
- this.filterSessions(this.searchInput.getValue());
278
- }
279
- filterSessions(query) {
280
- const trimmed = query.trim();
281
- const nameFiltered = this.nameFilter === "all" ? this.allSessions : this.allSessions.filter((session) => hasSessionName(session));
282
- if (this.sortMode === "threaded" && !trimmed) {
283
- // Threaded mode without search: show tree structure
284
- const roots = buildSessionTree(nameFiltered);
285
- this.filteredSessions = flattenSessionTree(roots);
286
- }
287
- else {
288
- // Other modes or with search: flat list
289
- const filtered = filterAndSortSessions(nameFiltered, query, this.sortMode, "all");
290
- this.filteredSessions = filtered.map((session) => ({
291
- session,
292
- depth: 0,
293
- isLast: true,
294
- ancestorContinues: [],
295
- }));
296
- }
297
- this.selectedIndex = Math.min(this.selectedIndex, Math.max(0, this.filteredSessions.length - 1));
298
- }
299
- setConfirmingDeletePath(path) {
300
- this.confirmingDeletePath = path;
301
- this.onDeleteConfirmationChange?.(path);
302
- }
303
- startDeleteConfirmationForSelectedSession() {
304
- const selected = this.filteredSessions[this.selectedIndex];
305
- if (!selected)
306
- return;
307
- // Prevent deleting current session
308
- if (this.currentSessionFilePath && selected.session.path === this.currentSessionFilePath) {
309
- this.onError?.("Cannot delete the currently active session");
310
- return;
311
- }
312
- this.setConfirmingDeletePath(selected.session.path);
313
- }
314
- invalidate() { }
315
- render(width) {
316
- const lines = [];
317
- // Render search input
318
- lines.push(...this.searchInput.render(width));
319
- lines.push(""); // Blank line after search
320
- if (this.filteredSessions.length === 0) {
321
- let emptyMessage;
322
- if (this.nameFilter === "named") {
323
- const toggleKey = keyText("app.session.toggleNamedFilter");
324
- if (this.showCwd) {
325
- emptyMessage = ` No named sessions found. Press ${toggleKey} to show all.`;
326
- }
327
- else {
328
- emptyMessage = ` No named sessions in current folder. Press ${toggleKey} to show all, or Tab to view all.`;
329
- }
330
- }
331
- else if (this.showCwd) {
332
- // "All" scope - no sessions anywhere that match filter
333
- emptyMessage = " No sessions found";
334
- }
335
- else {
336
- // "Current folder" scope - hint to try "all"
337
- emptyMessage = " No sessions in current folder. Press Tab to view all.";
338
- }
339
- lines.push(theme.fg("muted", truncateToWidth(emptyMessage, width, "…")));
340
- return lines;
341
- }
342
- // Calculate visible range with scrolling
343
- const startIndex = Math.max(0, Math.min(this.selectedIndex - Math.floor(this.maxVisible / 2), this.filteredSessions.length - this.maxVisible));
344
- const endIndex = Math.min(startIndex + this.maxVisible, this.filteredSessions.length);
345
- // Render visible sessions (one line each with tree structure)
346
- for (let i = startIndex; i < endIndex; i++) {
347
- const node = this.filteredSessions[i];
348
- const session = node.session;
349
- const isSelected = i === this.selectedIndex;
350
- const isConfirmingDelete = session.path === this.confirmingDeletePath;
351
- const isCurrent = this.currentSessionFilePath === session.path;
352
- // Build tree prefix
353
- const prefix = this.buildTreePrefix(node);
354
- // Session display text (name or first message)
355
- const hasName = !!session.name;
356
- const displayText = session.name ?? session.firstMessage;
357
- const normalizedMessage = displayText.replace(/[\x00-\x1f\x7f]/g, " ").trim();
358
- // Right side: message count and age
359
- const age = formatSessionDate(session.modified);
360
- const msgCount = String(session.messageCount);
361
- let rightPart = `${msgCount} ${age}`;
362
- if (this.showCwd && session.cwd) {
363
- rightPart = `${shortenPath(session.cwd)} ${rightPart}`;
364
- }
365
- if (this.showPath) {
366
- rightPart = `${shortenPath(session.path)} ${rightPart}`;
367
- }
368
- // Cursor
369
- const cursor = isSelected ? theme.fg("accent", "› ") : " ";
370
- // Calculate available width for message
371
- const prefixWidth = visibleWidth(prefix);
372
- const rightWidth = visibleWidth(rightPart) + 2; // +2 for spacing
373
- const availableForMsg = width - 2 - prefixWidth - rightWidth; // -2 for cursor
374
- const truncatedMsg = truncateToWidth(normalizedMessage, Math.max(10, availableForMsg), "…");
375
- // Style message
376
- let messageColor = null;
377
- if (isConfirmingDelete) {
378
- messageColor = "error";
379
- }
380
- else if (isCurrent) {
381
- messageColor = "accent";
382
- }
383
- else if (hasName) {
384
- messageColor = "warning";
385
- }
386
- let styledMsg = messageColor ? theme.fg(messageColor, truncatedMsg) : truncatedMsg;
387
- if (isSelected) {
388
- styledMsg = theme.bold(styledMsg);
389
- }
390
- // Build line
391
- const leftPart = cursor + theme.fg("dim", prefix) + styledMsg;
392
- const leftWidth = visibleWidth(leftPart);
393
- const spacing = Math.max(1, width - leftWidth - visibleWidth(rightPart));
394
- const styledRight = theme.fg(isConfirmingDelete ? "error" : "dim", rightPart);
395
- let line = leftPart + " ".repeat(spacing) + styledRight;
396
- if (isSelected) {
397
- line = theme.bg("selectedBg", line);
398
- }
399
- lines.push(truncateToWidth(line, width));
400
- }
401
- // Add scroll indicator if needed
402
- if (startIndex > 0 || endIndex < this.filteredSessions.length) {
403
- const scrollText = ` (${this.selectedIndex + 1}/${this.filteredSessions.length})`;
404
- const scrollInfo = theme.fg("muted", truncateToWidth(scrollText, width, ""));
405
- lines.push(scrollInfo);
406
- }
407
- return lines;
408
- }
409
- buildTreePrefix(node) {
410
- if (node.depth === 0) {
411
- return "";
412
- }
413
- const parts = node.ancestorContinues.map((continues) => (continues ? "│ " : " "));
414
- const branch = node.isLast ? "└─ " : "├─ ";
415
- return parts.join("") + branch;
416
- }
417
- handleInput(keyData) {
418
- const kb = getKeybindings();
419
- // Handle delete confirmation state first - intercept all keys
420
- if (this.confirmingDeletePath !== null) {
421
- if (kb.matches(keyData, "tui.select.confirm")) {
422
- const pathToDelete = this.confirmingDeletePath;
423
- this.setConfirmingDeletePath(null);
424
- void this.onDeleteSession?.(pathToDelete);
425
- return;
426
- }
427
- if (kb.matches(keyData, "tui.select.cancel")) {
428
- this.setConfirmingDeletePath(null);
429
- return;
430
- }
431
- // Ignore all other keys while confirming
432
- return;
433
- }
434
- if (kb.matches(keyData, "tui.input.tab")) {
435
- if (this.onToggleScope) {
436
- this.onToggleScope();
437
- }
438
- return;
439
- }
440
- if (kb.matches(keyData, "app.session.toggleSort")) {
441
- this.onToggleSort?.();
442
- return;
443
- }
444
- if (this.keybindings.matches(keyData, "app.session.toggleNamedFilter")) {
445
- this.onToggleNameFilter?.();
446
- return;
447
- }
448
- // Ctrl+P: toggle path display
449
- if (kb.matches(keyData, "app.session.togglePath")) {
450
- this.showPath = !this.showPath;
451
- this.onTogglePath?.(this.showPath);
452
- return;
453
- }
454
- // Ctrl+D: initiate delete confirmation (useful on terminals that don't distinguish Ctrl+Backspace from Backspace)
455
- if (kb.matches(keyData, "app.session.delete")) {
456
- this.startDeleteConfirmationForSelectedSession();
457
- return;
458
- }
459
- // Rename selected session
460
- if (kb.matches(keyData, "app.session.rename")) {
461
- const selected = this.filteredSessions[this.selectedIndex];
462
- if (selected) {
463
- this.onRenameSession?.(selected.session.path);
464
- }
465
- return;
466
- }
467
- // Ctrl+Backspace: non-invasive convenience alias for delete
468
- // Only triggers deletion when the query is empty; otherwise it is forwarded to the input
469
- if (kb.matches(keyData, "app.session.deleteNoninvasive")) {
470
- if (this.searchInput.getValue().length > 0) {
471
- this.searchInput.handleInput(keyData);
472
- this.filterSessions(this.searchInput.getValue());
473
- return;
474
- }
475
- this.startDeleteConfirmationForSelectedSession();
476
- return;
477
- }
478
- // Up arrow
479
- if (kb.matches(keyData, "tui.select.up")) {
480
- this.selectedIndex = Math.max(0, this.selectedIndex - 1);
481
- }
482
- // Down arrow
483
- else if (kb.matches(keyData, "tui.select.down")) {
484
- this.selectedIndex = Math.min(this.filteredSessions.length - 1, this.selectedIndex + 1);
485
- }
486
- // Page up - jump up by maxVisible items
487
- else if (kb.matches(keyData, "tui.select.pageUp")) {
488
- this.selectedIndex = Math.max(0, this.selectedIndex - this.maxVisible);
489
- }
490
- // Page down - jump down by maxVisible items
491
- else if (kb.matches(keyData, "tui.select.pageDown")) {
492
- this.selectedIndex = Math.min(this.filteredSessions.length - 1, this.selectedIndex + this.maxVisible);
493
- }
494
- // Enter
495
- else if (kb.matches(keyData, "tui.select.confirm")) {
496
- const selected = this.filteredSessions[this.selectedIndex];
497
- if (selected && this.onSelect) {
498
- this.onSelect(selected.session.path);
499
- }
500
- }
501
- // Escape - cancel
502
- else if (kb.matches(keyData, "tui.select.cancel")) {
503
- if (this.onCancel) {
504
- this.onCancel();
505
- }
506
- }
507
- // Pass everything else to search input
508
- else {
509
- this.searchInput.handleInput(keyData);
510
- this.filterSessions(this.searchInput.getValue());
511
- }
512
- }
513
- }
514
- /**
515
- * Delete a session file, trying the `trash` CLI first, then falling back to unlink
516
- */
517
- async function deleteSessionFile(sessionPath) {
518
- // Try `trash` first (if installed)
519
- const trashArgs = sessionPath.startsWith("-") ? ["--", sessionPath] : [sessionPath];
520
- const trashResult = spawnSync("trash", trashArgs, { encoding: "utf-8" });
521
- const getTrashErrorHint = () => {
522
- const parts = [];
523
- if (trashResult.error) {
524
- parts.push(trashResult.error.message);
525
- }
526
- const stderr = trashResult.stderr?.trim();
527
- if (stderr) {
528
- parts.push(stderr.split("\n")[0] ?? stderr);
529
- }
530
- if (parts.length === 0)
531
- return null;
532
- return `trash: ${parts.join(" · ").slice(0, 200)}`;
533
- };
534
- // If trash reports success, or the file is gone afterwards, treat it as successful
535
- if (trashResult.status === 0 || !existsSync(sessionPath)) {
536
- return { ok: true, method: "trash" };
537
- }
538
- // Fallback to permanent deletion
539
- try {
540
- await unlink(sessionPath);
541
- return { ok: true, method: "unlink" };
542
- }
543
- catch (err) {
544
- const unlinkError = err instanceof Error ? err.message : String(err);
545
- const trashErrorHint = getTrashErrorHint();
546
- const error = trashErrorHint ? `${unlinkError} (${trashErrorHint})` : unlinkError;
547
- return { ok: false, method: "unlink", error };
548
- }
549
- }
550
- /**
551
- * Component that renders a session selector
552
- */
553
- export class SessionSelectorComponent extends Container {
554
- handleInput(data) {
555
- if (this.mode === "rename") {
556
- const kb = getKeybindings();
557
- if (kb.matches(data, "tui.select.cancel")) {
558
- this.exitRenameMode();
559
- return;
560
- }
561
- this.renameInput.handleInput(data);
562
- return;
563
- }
564
- this.sessionList.handleInput(data);
565
- }
566
- canRename = true;
567
- sessionList;
568
- header;
569
- keybindings;
570
- scope = "current";
571
- sortMode = "threaded";
572
- nameFilter = "all";
573
- currentSessions = null;
574
- allSessions = null;
575
- currentSessionsLoader;
576
- allSessionsLoader;
577
- onCancel;
578
- requestRender;
579
- renameSession;
580
- currentLoading = false;
581
- allLoading = false;
582
- allLoadSeq = 0;
583
- mode = "list";
584
- renameInput = new Input();
585
- renameTargetPath = null;
586
- // Focusable implementation - propagate to sessionList for IME cursor positioning
587
- _focused = false;
588
- get focused() {
589
- return this._focused;
590
- }
591
- set focused(value) {
592
- this._focused = value;
593
- this.sessionList.focused = value;
594
- this.renameInput.focused = value;
595
- if (value && this.mode === "rename") {
596
- this.renameInput.focused = true;
597
- }
598
- }
599
- buildBaseLayout(content, options) {
600
- this.clear();
601
- this.addChild(new Spacer(1));
602
- this.addChild(new DynamicBorder((s) => theme.fg("accent", s)));
603
- this.addChild(new Spacer(1));
604
- if (options?.showHeader ?? true) {
605
- this.addChild(this.header);
606
- this.addChild(new Spacer(1));
607
- }
608
- this.addChild(content);
609
- this.addChild(new Spacer(1));
610
- this.addChild(new DynamicBorder((s) => theme.fg("accent", s)));
611
- }
612
- constructor(currentSessionsLoader, allSessionsLoader, onSelect, onCancel, onExit, requestRender, options, currentSessionFilePath) {
613
- super();
614
- this.keybindings = options?.keybindings ?? KeybindingsManager.create();
615
- this.currentSessionsLoader = currentSessionsLoader;
616
- this.allSessionsLoader = allSessionsLoader;
617
- this.onCancel = onCancel;
618
- this.requestRender = requestRender;
619
- this.header = new SessionSelectorHeader(this.scope, this.sortMode, this.nameFilter, this.requestRender);
620
- const renameSession = options?.renameSession;
621
- this.renameSession = renameSession;
622
- this.canRename = !!renameSession;
623
- this.header.setShowRenameHint(options?.showRenameHint ?? this.canRename);
624
- // Create session list (starts empty, will be populated after load)
625
- this.sessionList = new SessionList([], false, this.sortMode, this.nameFilter, this.keybindings, currentSessionFilePath);
626
- this.buildBaseLayout(this.sessionList);
627
- this.renameInput.onSubmit = (value) => {
628
- void this.confirmRename(value);
629
- };
630
- // Ensure header status timeouts are cleared when leaving the selector
631
- const clearStatusMessage = () => this.header.setStatusMessage(null);
632
- this.sessionList.onSelect = (sessionPath) => {
633
- clearStatusMessage();
634
- onSelect(sessionPath);
635
- };
636
- this.sessionList.onCancel = () => {
637
- clearStatusMessage();
638
- onCancel();
639
- };
640
- this.sessionList.onExit = () => {
641
- clearStatusMessage();
642
- onExit();
643
- };
644
- this.sessionList.onToggleScope = () => this.toggleScope();
645
- this.sessionList.onToggleSort = () => this.toggleSortMode();
646
- this.sessionList.onToggleNameFilter = () => this.toggleNameFilter();
647
- this.sessionList.onRenameSession = (sessionPath) => {
648
- if (!renameSession)
649
- return;
650
- if (this.scope === "current" && this.currentLoading)
651
- return;
652
- if (this.scope === "all" && this.allLoading)
653
- return;
654
- const sessions = this.scope === "all" ? (this.allSessions ?? []) : (this.currentSessions ?? []);
655
- const session = sessions.find((s) => s.path === sessionPath);
656
- this.enterRenameMode(sessionPath, session?.name);
657
- };
658
- // Sync list events to header
659
- this.sessionList.onTogglePath = (showPath) => {
660
- this.header.setShowPath(showPath);
661
- this.requestRender();
662
- };
663
- this.sessionList.onDeleteConfirmationChange = (path) => {
664
- this.header.setConfirmingDeletePath(path);
665
- this.requestRender();
666
- };
667
- this.sessionList.onError = (msg) => {
668
- this.header.setStatusMessage({ type: "error", message: msg }, 3000);
669
- this.requestRender();
670
- };
671
- // Handle session deletion
672
- this.sessionList.onDeleteSession = async (sessionPath) => {
673
- const result = await deleteSessionFile(sessionPath);
674
- if (result.ok) {
675
- if (this.currentSessions) {
676
- this.currentSessions = this.currentSessions.filter((s) => s.path !== sessionPath);
677
- }
678
- if (this.allSessions) {
679
- this.allSessions = this.allSessions.filter((s) => s.path !== sessionPath);
680
- }
681
- const sessions = this.scope === "all" ? (this.allSessions ?? []) : (this.currentSessions ?? []);
682
- const showCwd = this.scope === "all";
683
- this.sessionList.setSessions(sessions, showCwd);
684
- const msg = result.method === "trash" ? "Session moved to trash" : "Session deleted";
685
- this.header.setStatusMessage({ type: "info", message: msg }, 2000);
686
- await this.refreshSessionsAfterMutation();
687
- }
688
- else {
689
- const errorMessage = result.error ?? "Unknown error";
690
- this.header.setStatusMessage({ type: "error", message: `Failed to delete: ${errorMessage}` }, 3000);
691
- }
692
- this.requestRender();
693
- };
694
- // Start loading current sessions immediately
695
- this.loadCurrentSessions();
696
- }
697
- loadCurrentSessions() {
698
- void this.loadScope("current", "initial");
699
- }
700
- enterRenameMode(sessionPath, currentName) {
701
- this.mode = "rename";
702
- this.renameTargetPath = sessionPath;
703
- this.renameInput.setValue(currentName ?? "");
704
- this.renameInput.focused = true;
705
- const panel = new Container();
706
- panel.addChild(new Text(theme.bold("Rename Session"), 1, 0));
707
- panel.addChild(new Spacer(1));
708
- panel.addChild(this.renameInput);
709
- panel.addChild(new Spacer(1));
710
- panel.addChild(new Text(theme.fg("muted", `${keyText("tui.select.confirm")} to save · ${keyText("tui.select.cancel")} to cancel`), 1, 0));
711
- this.buildBaseLayout(panel, { showHeader: false });
712
- this.requestRender();
713
- }
714
- exitRenameMode() {
715
- this.mode = "list";
716
- this.renameTargetPath = null;
717
- this.buildBaseLayout(this.sessionList);
718
- this.requestRender();
719
- }
720
- async confirmRename(value) {
721
- const next = value.trim();
722
- if (!next)
723
- return;
724
- const target = this.renameTargetPath;
725
- if (!target) {
726
- this.exitRenameMode();
727
- return;
728
- }
729
- // Find current name for callback
730
- const renameSession = this.renameSession;
731
- if (!renameSession) {
732
- this.exitRenameMode();
733
- return;
734
- }
735
- try {
736
- await renameSession(target, next);
737
- await this.refreshSessionsAfterMutation();
738
- }
739
- finally {
740
- this.exitRenameMode();
741
- }
742
- }
743
- async loadScope(scope, reason) {
744
- const showCwd = scope === "all";
745
- // Mark loading
746
- if (scope === "current") {
747
- this.currentLoading = true;
748
- }
749
- else {
750
- this.allLoading = true;
751
- }
752
- const seq = scope === "all" ? ++this.allLoadSeq : undefined;
753
- this.header.setScope(scope);
754
- this.header.setLoading(true);
755
- this.requestRender();
756
- const onProgress = (loaded, total) => {
757
- if (scope !== this.scope)
758
- return;
759
- if (seq !== undefined && seq !== this.allLoadSeq)
760
- return;
761
- this.header.setProgress(loaded, total);
762
- this.requestRender();
763
- };
764
- try {
765
- const sessions = await (scope === "current"
766
- ? this.currentSessionsLoader(onProgress)
767
- : this.allSessionsLoader(onProgress));
768
- if (scope === "current") {
769
- this.currentSessions = sessions;
770
- this.currentLoading = false;
771
- }
772
- else {
773
- this.allSessions = sessions;
774
- this.allLoading = false;
775
- }
776
- if (scope !== this.scope)
777
- return;
778
- if (seq !== undefined && seq !== this.allLoadSeq)
779
- return;
780
- this.header.setLoading(false);
781
- this.sessionList.setSessions(sessions, showCwd);
782
- this.requestRender();
783
- if (scope === "all" && sessions.length === 0 && (this.currentSessions?.length ?? 0) === 0) {
784
- this.onCancel();
785
- }
786
- }
787
- catch (err) {
788
- if (scope === "current") {
789
- this.currentLoading = false;
790
- }
791
- else {
792
- this.allLoading = false;
793
- }
794
- if (scope !== this.scope)
795
- return;
796
- if (seq !== undefined && seq !== this.allLoadSeq)
797
- return;
798
- const message = err instanceof Error ? err.message : String(err);
799
- this.header.setLoading(false);
800
- this.header.setStatusMessage({ type: "error", message: `Failed to load sessions: ${message}` }, 4000);
801
- if (reason === "initial") {
802
- this.sessionList.setSessions([], showCwd);
803
- }
804
- this.requestRender();
805
- }
806
- }
807
- toggleSortMode() {
808
- // Cycle: threaded -> recent -> relevance -> threaded
809
- this.sortMode = this.sortMode === "threaded" ? "recent" : this.sortMode === "recent" ? "relevance" : "threaded";
810
- this.header.setSortMode(this.sortMode);
811
- this.sessionList.setSortMode(this.sortMode);
812
- this.requestRender();
813
- }
814
- toggleNameFilter() {
815
- this.nameFilter = this.nameFilter === "all" ? "named" : "all";
816
- this.header.setNameFilter(this.nameFilter);
817
- this.sessionList.setNameFilter(this.nameFilter);
818
- this.requestRender();
819
- }
820
- async refreshSessionsAfterMutation() {
821
- await this.loadScope(this.scope, "refresh");
822
- }
823
- toggleScope() {
824
- if (this.scope === "current") {
825
- this.scope = "all";
826
- this.header.setScope(this.scope);
827
- if (this.allSessions !== null) {
828
- this.header.setLoading(false);
829
- this.sessionList.setSessions(this.allSessions, true);
830
- this.requestRender();
831
- return;
832
- }
833
- if (!this.allLoading) {
834
- void this.loadScope("all", "toggle");
835
- }
836
- return;
837
- }
838
- this.scope = "current";
839
- this.header.setScope(this.scope);
840
- this.header.setLoading(this.currentLoading);
841
- this.sessionList.setSessions(this.currentSessions ?? [], false);
842
- this.requestRender();
843
- }
844
- getSessionList() {
845
- return this.sessionList;
846
- }
847
- }
848
- //# sourceMappingURL=session-selector.js.map