@eminent337/aery 0.1.57 → 0.1.59

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