@eminent337/aery 0.1.11 → 1.0.0

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 (547) hide show
  1. package/CHANGELOG.md +898 -898
  2. package/README.md +2 -32
  3. package/docs/compaction.md +14 -14
  4. package/docs/custom-provider.md +9 -9
  5. package/docs/development.md +2 -2
  6. package/docs/extensions.md +25 -25
  7. package/docs/json.md +4 -4
  8. package/docs/packages.md +2 -2
  9. package/docs/providers.md +1 -1
  10. package/docs/rpc.md +1 -1
  11. package/docs/sdk.md +22 -22
  12. package/docs/session.md +7 -7
  13. package/docs/termux.md +1 -1
  14. package/docs/themes.md +2 -2
  15. package/docs/tui.md +7 -7
  16. package/examples/extensions/dynamic-resources/dynamic.json +1 -1
  17. package/package.json +5 -5
  18. package/dist/bun/cli.d.ts +0 -3
  19. package/dist/bun/cli.d.ts.map +0 -1
  20. package/dist/bun/cli.js +0 -7
  21. package/dist/bun/cli.js.map +0 -1
  22. package/dist/bun/register-bedrock.d.ts +0 -2
  23. package/dist/bun/register-bedrock.d.ts.map +0 -1
  24. package/dist/bun/register-bedrock.js +0 -4
  25. package/dist/bun/register-bedrock.js.map +0 -1
  26. package/dist/cli/args.d.ts +0 -52
  27. package/dist/cli/args.d.ts.map +0 -1
  28. package/dist/cli/args.js +0 -321
  29. package/dist/cli/args.js.map +0 -1
  30. package/dist/cli/config-selector.d.ts +0 -14
  31. package/dist/cli/config-selector.d.ts.map +0 -1
  32. package/dist/cli/config-selector.js +0 -31
  33. package/dist/cli/config-selector.js.map +0 -1
  34. package/dist/cli/file-processor.d.ts +0 -15
  35. package/dist/cli/file-processor.d.ts.map +0 -1
  36. package/dist/cli/file-processor.js +0 -83
  37. package/dist/cli/file-processor.js.map +0 -1
  38. package/dist/cli/initial-message.d.ts +0 -18
  39. package/dist/cli/initial-message.d.ts.map +0 -1
  40. package/dist/cli/initial-message.js +0 -22
  41. package/dist/cli/initial-message.js.map +0 -1
  42. package/dist/cli/list-models.d.ts +0 -9
  43. package/dist/cli/list-models.d.ts.map +0 -1
  44. package/dist/cli/list-models.js +0 -97
  45. package/dist/cli/list-models.js.map +0 -1
  46. package/dist/cli/session-picker.d.ts +0 -9
  47. package/dist/cli/session-picker.d.ts.map +0 -1
  48. package/dist/cli/session-picker.js +0 -35
  49. package/dist/cli/session-picker.js.map +0 -1
  50. package/dist/cli.d.ts +0 -3
  51. package/dist/cli.d.ts.map +0 -1
  52. package/dist/cli.js +0 -15
  53. package/dist/cli.js.map +0 -1
  54. package/dist/config.d.ts +0 -77
  55. package/dist/config.d.ts.map +0 -1
  56. package/dist/config.js +0 -221
  57. package/dist/config.js.map +0 -1
  58. package/dist/core/agent-session-runtime.d.ts +0 -99
  59. package/dist/core/agent-session-runtime.d.ts.map +0 -1
  60. package/dist/core/agent-session-runtime.js +0 -261
  61. package/dist/core/agent-session-runtime.js.map +0 -1
  62. package/dist/core/agent-session-services.d.ts +0 -85
  63. package/dist/core/agent-session-services.d.ts.map +0 -1
  64. package/dist/core/agent-session-services.js +0 -116
  65. package/dist/core/agent-session-services.js.map +0 -1
  66. package/dist/core/agent-session.d.ts +0 -590
  67. package/dist/core/agent-session.d.ts.map +0 -1
  68. package/dist/core/agent-session.js +0 -2505
  69. package/dist/core/agent-session.js.map +0 -1
  70. package/dist/core/auth-storage.d.ts +0 -132
  71. package/dist/core/auth-storage.d.ts.map +0 -1
  72. package/dist/core/auth-storage.js +0 -422
  73. package/dist/core/auth-storage.js.map +0 -1
  74. package/dist/core/bash-executor.d.ts +0 -32
  75. package/dist/core/bash-executor.d.ts.map +0 -1
  76. package/dist/core/bash-executor.js +0 -108
  77. package/dist/core/bash-executor.js.map +0 -1
  78. package/dist/core/compaction/branch-summarization.d.ts +0 -88
  79. package/dist/core/compaction/branch-summarization.d.ts.map +0 -1
  80. package/dist/core/compaction/branch-summarization.js +0 -243
  81. package/dist/core/compaction/branch-summarization.js.map +0 -1
  82. package/dist/core/compaction/compaction.d.ts +0 -121
  83. package/dist/core/compaction/compaction.d.ts.map +0 -1
  84. package/dist/core/compaction/compaction.js +0 -615
  85. package/dist/core/compaction/compaction.js.map +0 -1
  86. package/dist/core/compaction/index.d.ts +0 -7
  87. package/dist/core/compaction/index.d.ts.map +0 -1
  88. package/dist/core/compaction/index.js +0 -7
  89. package/dist/core/compaction/index.js.map +0 -1
  90. package/dist/core/compaction/utils.d.ts +0 -38
  91. package/dist/core/compaction/utils.d.ts.map +0 -1
  92. package/dist/core/compaction/utils.js +0 -153
  93. package/dist/core/compaction/utils.js.map +0 -1
  94. package/dist/core/defaults.d.ts +0 -3
  95. package/dist/core/defaults.d.ts.map +0 -1
  96. package/dist/core/defaults.js +0 -2
  97. package/dist/core/defaults.js.map +0 -1
  98. package/dist/core/diagnostics.d.ts +0 -15
  99. package/dist/core/diagnostics.d.ts.map +0 -1
  100. package/dist/core/diagnostics.js +0 -2
  101. package/dist/core/diagnostics.js.map +0 -1
  102. package/dist/core/event-bus.d.ts +0 -9
  103. package/dist/core/event-bus.d.ts.map +0 -1
  104. package/dist/core/event-bus.js +0 -25
  105. package/dist/core/event-bus.js.map +0 -1
  106. package/dist/core/exec.d.ts +0 -29
  107. package/dist/core/exec.d.ts.map +0 -1
  108. package/dist/core/exec.js +0 -75
  109. package/dist/core/exec.js.map +0 -1
  110. package/dist/core/export-html/ansi-to-html.d.ts +0 -22
  111. package/dist/core/export-html/ansi-to-html.d.ts.map +0 -1
  112. package/dist/core/export-html/ansi-to-html.js +0 -249
  113. package/dist/core/export-html/ansi-to-html.js.map +0 -1
  114. package/dist/core/export-html/index.d.ts +0 -37
  115. package/dist/core/export-html/index.d.ts.map +0 -1
  116. package/dist/core/export-html/index.js +0 -224
  117. package/dist/core/export-html/index.js.map +0 -1
  118. package/dist/core/export-html/template.css +0 -1017
  119. package/dist/core/export-html/template.html +0 -55
  120. package/dist/core/export-html/template.js +0 -1729
  121. package/dist/core/export-html/tool-renderer.d.ts +0 -40
  122. package/dist/core/export-html/tool-renderer.d.ts.map +0 -1
  123. package/dist/core/export-html/tool-renderer.js +0 -95
  124. package/dist/core/export-html/tool-renderer.js.map +0 -1
  125. package/dist/core/export-html/vendor/highlight.min.js +0 -1213
  126. package/dist/core/export-html/vendor/marked.min.js +0 -6
  127. package/dist/core/extensions/index.d.ts +0 -12
  128. package/dist/core/extensions/index.d.ts.map +0 -1
  129. package/dist/core/extensions/index.js +0 -9
  130. package/dist/core/extensions/index.js.map +0 -1
  131. package/dist/core/extensions/loader.d.ts +0 -25
  132. package/dist/core/extensions/loader.d.ts.map +0 -1
  133. package/dist/core/extensions/loader.js +0 -436
  134. package/dist/core/extensions/loader.js.map +0 -1
  135. package/dist/core/extensions/runner.d.ts +0 -150
  136. package/dist/core/extensions/runner.d.ts.map +0 -1
  137. package/dist/core/extensions/runner.js +0 -706
  138. package/dist/core/extensions/runner.js.map +0 -1
  139. package/dist/core/extensions/types.d.ts +0 -1111
  140. package/dist/core/extensions/types.d.ts.map +0 -1
  141. package/dist/core/extensions/types.js +0 -45
  142. package/dist/core/extensions/types.js.map +0 -1
  143. package/dist/core/extensions/wrapper.d.ts +0 -20
  144. package/dist/core/extensions/wrapper.d.ts.map +0 -1
  145. package/dist/core/extensions/wrapper.js +0 -22
  146. package/dist/core/extensions/wrapper.js.map +0 -1
  147. package/dist/core/footer-data-provider.d.ts +0 -48
  148. package/dist/core/footer-data-provider.d.ts.map +0 -1
  149. package/dist/core/footer-data-provider.js +0 -314
  150. package/dist/core/footer-data-provider.js.map +0 -1
  151. package/dist/core/index.d.ts +0 -12
  152. package/dist/core/index.d.ts.map +0 -1
  153. package/dist/core/index.js +0 -12
  154. package/dist/core/index.js.map +0 -1
  155. package/dist/core/keybindings.d.ts +0 -353
  156. package/dist/core/keybindings.d.ts.map +0 -1
  157. package/dist/core/keybindings.js +0 -295
  158. package/dist/core/keybindings.js.map +0 -1
  159. package/dist/core/messages.d.ts +0 -77
  160. package/dist/core/messages.d.ts.map +0 -1
  161. package/dist/core/messages.js +0 -123
  162. package/dist/core/messages.js.map +0 -1
  163. package/dist/core/model-registry.d.ts +0 -132
  164. package/dist/core/model-registry.d.ts.map +0 -1
  165. package/dist/core/model-registry.js +0 -635
  166. package/dist/core/model-registry.js.map +0 -1
  167. package/dist/core/model-resolver.d.ts +0 -110
  168. package/dist/core/model-resolver.d.ts.map +0 -1
  169. package/dist/core/model-resolver.js +0 -486
  170. package/dist/core/model-resolver.js.map +0 -1
  171. package/dist/core/output-guard.d.ts +0 -6
  172. package/dist/core/output-guard.d.ts.map +0 -1
  173. package/dist/core/output-guard.js +0 -59
  174. package/dist/core/output-guard.js.map +0 -1
  175. package/dist/core/package-manager.d.ts +0 -194
  176. package/dist/core/package-manager.d.ts.map +0 -1
  177. package/dist/core/package-manager.js +0 -1882
  178. package/dist/core/package-manager.js.map +0 -1
  179. package/dist/core/prompt-templates.d.ts +0 -52
  180. package/dist/core/prompt-templates.d.ts.map +0 -1
  181. package/dist/core/prompt-templates.js +0 -250
  182. package/dist/core/prompt-templates.js.map +0 -1
  183. package/dist/core/resolve-config-value.d.ts +0 -23
  184. package/dist/core/resolve-config-value.d.ts.map +0 -1
  185. package/dist/core/resolve-config-value.js +0 -126
  186. package/dist/core/resolve-config-value.js.map +0 -1
  187. package/dist/core/resource-loader.d.ts +0 -194
  188. package/dist/core/resource-loader.d.ts.map +0 -1
  189. package/dist/core/resource-loader.js +0 -726
  190. package/dist/core/resource-loader.js.map +0 -1
  191. package/dist/core/sdk.d.ts +0 -99
  192. package/dist/core/sdk.d.ts.map +0 -1
  193. package/dist/core/sdk.js +0 -261
  194. package/dist/core/sdk.js.map +0 -1
  195. package/dist/core/session-cwd.d.ts +0 -19
  196. package/dist/core/session-cwd.d.ts.map +0 -1
  197. package/dist/core/session-cwd.js +0 -38
  198. package/dist/core/session-cwd.js.map +0 -1
  199. package/dist/core/session-manager.d.ts +0 -333
  200. package/dist/core/session-manager.d.ts.map +0 -1
  201. package/dist/core/session-manager.js +0 -1109
  202. package/dist/core/session-manager.js.map +0 -1
  203. package/dist/core/settings-manager.d.ts +0 -240
  204. package/dist/core/settings-manager.d.ts.map +0 -1
  205. package/dist/core/settings-manager.js +0 -711
  206. package/dist/core/settings-manager.js.map +0 -1
  207. package/dist/core/skills.d.ts +0 -60
  208. package/dist/core/skills.d.ts.map +0 -1
  209. package/dist/core/skills.js +0 -409
  210. package/dist/core/skills.js.map +0 -1
  211. package/dist/core/slash-commands.d.ts +0 -14
  212. package/dist/core/slash-commands.d.ts.map +0 -1
  213. package/dist/core/slash-commands.js +0 -24
  214. package/dist/core/slash-commands.js.map +0 -1
  215. package/dist/core/source-info.d.ts +0 -18
  216. package/dist/core/source-info.d.ts.map +0 -1
  217. package/dist/core/source-info.js +0 -19
  218. package/dist/core/source-info.js.map +0 -1
  219. package/dist/core/system-prompt.d.ts +0 -28
  220. package/dist/core/system-prompt.d.ts.map +0 -1
  221. package/dist/core/system-prompt.js +0 -120
  222. package/dist/core/system-prompt.js.map +0 -1
  223. package/dist/core/telemetry.d.ts +0 -3
  224. package/dist/core/telemetry.d.ts.map +0 -1
  225. package/dist/core/telemetry.js +0 -9
  226. package/dist/core/telemetry.js.map +0 -1
  227. package/dist/core/timings.d.ts +0 -8
  228. package/dist/core/timings.d.ts.map +0 -1
  229. package/dist/core/timings.js +0 -31
  230. package/dist/core/timings.js.map +0 -1
  231. package/dist/core/tools/bash.d.ts +0 -64
  232. package/dist/core/tools/bash.d.ts.map +0 -1
  233. package/dist/core/tools/bash.js +0 -355
  234. package/dist/core/tools/bash.js.map +0 -1
  235. package/dist/core/tools/edit-diff.d.ts +0 -85
  236. package/dist/core/tools/edit-diff.d.ts.map +0 -1
  237. package/dist/core/tools/edit-diff.js +0 -337
  238. package/dist/core/tools/edit-diff.js.map +0 -1
  239. package/dist/core/tools/edit.d.ts +0 -49
  240. package/dist/core/tools/edit.d.ts.map +0 -1
  241. package/dist/core/tools/edit.js +0 -323
  242. package/dist/core/tools/edit.js.map +0 -1
  243. package/dist/core/tools/file-mutation-queue.d.ts +0 -6
  244. package/dist/core/tools/file-mutation-queue.d.ts.map +0 -1
  245. package/dist/core/tools/file-mutation-queue.js +0 -37
  246. package/dist/core/tools/file-mutation-queue.js.map +0 -1
  247. package/dist/core/tools/find.d.ts +0 -35
  248. package/dist/core/tools/find.d.ts.map +0 -1
  249. package/dist/core/tools/find.js +0 -298
  250. package/dist/core/tools/find.js.map +0 -1
  251. package/dist/core/tools/grep.d.ts +0 -37
  252. package/dist/core/tools/grep.d.ts.map +0 -1
  253. package/dist/core/tools/grep.js +0 -304
  254. package/dist/core/tools/grep.js.map +0 -1
  255. package/dist/core/tools/index.d.ts +0 -40
  256. package/dist/core/tools/index.d.ts.map +0 -1
  257. package/dist/core/tools/index.js +0 -112
  258. package/dist/core/tools/index.js.map +0 -1
  259. package/dist/core/tools/ls.d.ts +0 -37
  260. package/dist/core/tools/ls.d.ts.map +0 -1
  261. package/dist/core/tools/ls.js +0 -169
  262. package/dist/core/tools/ls.js.map +0 -1
  263. package/dist/core/tools/path-utils.d.ts +0 -8
  264. package/dist/core/tools/path-utils.d.ts.map +0 -1
  265. package/dist/core/tools/path-utils.js +0 -81
  266. package/dist/core/tools/path-utils.js.map +0 -1
  267. package/dist/core/tools/read.d.ts +0 -35
  268. package/dist/core/tools/read.d.ts.map +0 -1
  269. package/dist/core/tools/read.js +0 -232
  270. package/dist/core/tools/read.js.map +0 -1
  271. package/dist/core/tools/render-utils.d.ts +0 -21
  272. package/dist/core/tools/render-utils.d.ts.map +0 -1
  273. package/dist/core/tools/render-utils.js +0 -49
  274. package/dist/core/tools/render-utils.js.map +0 -1
  275. package/dist/core/tools/tool-definition-wrapper.d.ts +0 -14
  276. package/dist/core/tools/tool-definition-wrapper.d.ts.map +0 -1
  277. package/dist/core/tools/tool-definition-wrapper.js +0 -34
  278. package/dist/core/tools/tool-definition-wrapper.js.map +0 -1
  279. package/dist/core/tools/truncate.d.ts +0 -70
  280. package/dist/core/tools/truncate.d.ts.map +0 -1
  281. package/dist/core/tools/truncate.js +0 -205
  282. package/dist/core/tools/truncate.js.map +0 -1
  283. package/dist/core/tools/write.d.ts +0 -26
  284. package/dist/core/tools/write.d.ts.map +0 -1
  285. package/dist/core/tools/write.js +0 -213
  286. package/dist/core/tools/write.js.map +0 -1
  287. package/dist/index.d.ts +0 -28
  288. package/dist/index.d.ts.map +0 -1
  289. package/dist/index.js +0 -41
  290. package/dist/index.js.map +0 -1
  291. package/dist/main.d.ts +0 -12
  292. package/dist/main.d.ts.map +0 -1
  293. package/dist/main.js +0 -589
  294. package/dist/main.js.map +0 -1
  295. package/dist/migrations.d.ts +0 -33
  296. package/dist/migrations.d.ts.map +0 -1
  297. package/dist/migrations.js +0 -281
  298. package/dist/migrations.js.map +0 -1
  299. package/dist/modes/index.d.ts +0 -9
  300. package/dist/modes/index.d.ts.map +0 -1
  301. package/dist/modes/index.js +0 -8
  302. package/dist/modes/index.js.map +0 -1
  303. package/dist/modes/interactive/assets/clankolas.png +0 -0
  304. package/dist/modes/interactive/components/armin.d.ts +0 -34
  305. package/dist/modes/interactive/components/armin.d.ts.map +0 -1
  306. package/dist/modes/interactive/components/armin.js +0 -333
  307. package/dist/modes/interactive/components/armin.js.map +0 -1
  308. package/dist/modes/interactive/components/assistant-message.d.ts +0 -20
  309. package/dist/modes/interactive/components/assistant-message.d.ts.map +0 -1
  310. package/dist/modes/interactive/components/assistant-message.js +0 -121
  311. package/dist/modes/interactive/components/assistant-message.js.map +0 -1
  312. package/dist/modes/interactive/components/bash-execution.d.ts +0 -34
  313. package/dist/modes/interactive/components/bash-execution.d.ts.map +0 -1
  314. package/dist/modes/interactive/components/bash-execution.js +0 -175
  315. package/dist/modes/interactive/components/bash-execution.js.map +0 -1
  316. package/dist/modes/interactive/components/bordered-loader.d.ts +0 -16
  317. package/dist/modes/interactive/components/bordered-loader.d.ts.map +0 -1
  318. package/dist/modes/interactive/components/bordered-loader.js +0 -54
  319. package/dist/modes/interactive/components/bordered-loader.js.map +0 -1
  320. package/dist/modes/interactive/components/branch-summary-message.d.ts +0 -16
  321. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +0 -1
  322. package/dist/modes/interactive/components/branch-summary-message.js +0 -44
  323. package/dist/modes/interactive/components/branch-summary-message.js.map +0 -1
  324. package/dist/modes/interactive/components/compaction-summary-message.d.ts +0 -16
  325. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +0 -1
  326. package/dist/modes/interactive/components/compaction-summary-message.js +0 -45
  327. package/dist/modes/interactive/components/compaction-summary-message.js.map +0 -1
  328. package/dist/modes/interactive/components/config-selector.d.ts +0 -71
  329. package/dist/modes/interactive/components/config-selector.d.ts.map +0 -1
  330. package/dist/modes/interactive/components/config-selector.js +0 -479
  331. package/dist/modes/interactive/components/config-selector.js.map +0 -1
  332. package/dist/modes/interactive/components/countdown-timer.d.ts +0 -14
  333. package/dist/modes/interactive/components/countdown-timer.d.ts.map +0 -1
  334. package/dist/modes/interactive/components/countdown-timer.js +0 -33
  335. package/dist/modes/interactive/components/countdown-timer.js.map +0 -1
  336. package/dist/modes/interactive/components/custom-editor.d.ts +0 -21
  337. package/dist/modes/interactive/components/custom-editor.d.ts.map +0 -1
  338. package/dist/modes/interactive/components/custom-editor.js +0 -70
  339. package/dist/modes/interactive/components/custom-editor.js.map +0 -1
  340. package/dist/modes/interactive/components/custom-message.d.ts +0 -20
  341. package/dist/modes/interactive/components/custom-message.d.ts.map +0 -1
  342. package/dist/modes/interactive/components/custom-message.js +0 -79
  343. package/dist/modes/interactive/components/custom-message.js.map +0 -1
  344. package/dist/modes/interactive/components/daxnuts.d.ts +0 -23
  345. package/dist/modes/interactive/components/daxnuts.d.ts.map +0 -1
  346. package/dist/modes/interactive/components/daxnuts.js +0 -140
  347. package/dist/modes/interactive/components/daxnuts.js.map +0 -1
  348. package/dist/modes/interactive/components/diff.d.ts +0 -12
  349. package/dist/modes/interactive/components/diff.d.ts.map +0 -1
  350. package/dist/modes/interactive/components/diff.js +0 -133
  351. package/dist/modes/interactive/components/diff.js.map +0 -1
  352. package/dist/modes/interactive/components/dynamic-border.d.ts +0 -15
  353. package/dist/modes/interactive/components/dynamic-border.d.ts.map +0 -1
  354. package/dist/modes/interactive/components/dynamic-border.js +0 -21
  355. package/dist/modes/interactive/components/dynamic-border.js.map +0 -1
  356. package/dist/modes/interactive/components/earendil-announcement.d.ts +0 -5
  357. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +0 -1
  358. package/dist/modes/interactive/components/earendil-announcement.js +0 -40
  359. package/dist/modes/interactive/components/earendil-announcement.js.map +0 -1
  360. package/dist/modes/interactive/components/extension-editor.d.ts +0 -20
  361. package/dist/modes/interactive/components/extension-editor.d.ts.map +0 -1
  362. package/dist/modes/interactive/components/extension-editor.js +0 -111
  363. package/dist/modes/interactive/components/extension-editor.js.map +0 -1
  364. package/dist/modes/interactive/components/extension-input.d.ts +0 -23
  365. package/dist/modes/interactive/components/extension-input.d.ts.map +0 -1
  366. package/dist/modes/interactive/components/extension-input.js +0 -61
  367. package/dist/modes/interactive/components/extension-input.js.map +0 -1
  368. package/dist/modes/interactive/components/extension-selector.d.ts +0 -24
  369. package/dist/modes/interactive/components/extension-selector.d.ts.map +0 -1
  370. package/dist/modes/interactive/components/extension-selector.js +0 -78
  371. package/dist/modes/interactive/components/extension-selector.js.map +0 -1
  372. package/dist/modes/interactive/components/footer.d.ts +0 -27
  373. package/dist/modes/interactive/components/footer.d.ts.map +0 -1
  374. package/dist/modes/interactive/components/footer.js +0 -201
  375. package/dist/modes/interactive/components/footer.js.map +0 -1
  376. package/dist/modes/interactive/components/index.d.ts +0 -32
  377. package/dist/modes/interactive/components/index.d.ts.map +0 -1
  378. package/dist/modes/interactive/components/index.js +0 -33
  379. package/dist/modes/interactive/components/index.js.map +0 -1
  380. package/dist/modes/interactive/components/keybinding-hints.d.ts +0 -8
  381. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +0 -1
  382. package/dist/modes/interactive/components/keybinding-hints.js +0 -22
  383. package/dist/modes/interactive/components/keybinding-hints.js.map +0 -1
  384. package/dist/modes/interactive/components/login-dialog.d.ts +0 -42
  385. package/dist/modes/interactive/components/login-dialog.d.ts.map +0 -1
  386. package/dist/modes/interactive/components/login-dialog.js +0 -145
  387. package/dist/modes/interactive/components/login-dialog.js.map +0 -1
  388. package/dist/modes/interactive/components/model-selector.d.ts +0 -47
  389. package/dist/modes/interactive/components/model-selector.d.ts.map +0 -1
  390. package/dist/modes/interactive/components/model-selector.js +0 -278
  391. package/dist/modes/interactive/components/model-selector.js.map +0 -1
  392. package/dist/modes/interactive/components/oauth-selector.d.ts +0 -19
  393. package/dist/modes/interactive/components/oauth-selector.d.ts.map +0 -1
  394. package/dist/modes/interactive/components/oauth-selector.js +0 -97
  395. package/dist/modes/interactive/components/oauth-selector.js.map +0 -1
  396. package/dist/modes/interactive/components/scoped-models-selector.d.ts +0 -42
  397. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +0 -1
  398. package/dist/modes/interactive/components/scoped-models-selector.js +0 -290
  399. package/dist/modes/interactive/components/scoped-models-selector.js.map +0 -1
  400. package/dist/modes/interactive/components/session-selector-search.d.ts +0 -23
  401. package/dist/modes/interactive/components/session-selector-search.d.ts.map +0 -1
  402. package/dist/modes/interactive/components/session-selector-search.js +0 -155
  403. package/dist/modes/interactive/components/session-selector-search.js.map +0 -1
  404. package/dist/modes/interactive/components/session-selector.d.ts +0 -96
  405. package/dist/modes/interactive/components/session-selector.d.ts.map +0 -1
  406. package/dist/modes/interactive/components/session-selector.js +0 -865
  407. package/dist/modes/interactive/components/session-selector.js.map +0 -1
  408. package/dist/modes/interactive/components/settings-selector.d.ts +0 -60
  409. package/dist/modes/interactive/components/settings-selector.d.ts.map +0 -1
  410. package/dist/modes/interactive/components/settings-selector.js +0 -311
  411. package/dist/modes/interactive/components/settings-selector.js.map +0 -1
  412. package/dist/modes/interactive/components/show-images-selector.d.ts +0 -10
  413. package/dist/modes/interactive/components/show-images-selector.d.ts.map +0 -1
  414. package/dist/modes/interactive/components/show-images-selector.js +0 -39
  415. package/dist/modes/interactive/components/show-images-selector.js.map +0 -1
  416. package/dist/modes/interactive/components/skill-invocation-message.d.ts +0 -17
  417. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +0 -1
  418. package/dist/modes/interactive/components/skill-invocation-message.js +0 -47
  419. package/dist/modes/interactive/components/skill-invocation-message.js.map +0 -1
  420. package/dist/modes/interactive/components/theme-selector.d.ts +0 -11
  421. package/dist/modes/interactive/components/theme-selector.d.ts.map +0 -1
  422. package/dist/modes/interactive/components/theme-selector.js +0 -50
  423. package/dist/modes/interactive/components/theme-selector.js.map +0 -1
  424. package/dist/modes/interactive/components/thinking-selector.d.ts +0 -11
  425. package/dist/modes/interactive/components/thinking-selector.d.ts.map +0 -1
  426. package/dist/modes/interactive/components/thinking-selector.js +0 -51
  427. package/dist/modes/interactive/components/thinking-selector.js.map +0 -1
  428. package/dist/modes/interactive/components/tool-execution.d.ts +0 -60
  429. package/dist/modes/interactive/components/tool-execution.d.ts.map +0 -1
  430. package/dist/modes/interactive/components/tool-execution.js +0 -289
  431. package/dist/modes/interactive/components/tool-execution.js.map +0 -1
  432. package/dist/modes/interactive/components/tree-selector.d.ts +0 -89
  433. package/dist/modes/interactive/components/tree-selector.d.ts.map +0 -1
  434. package/dist/modes/interactive/components/tree-selector.js +0 -1092
  435. package/dist/modes/interactive/components/tree-selector.js.map +0 -1
  436. package/dist/modes/interactive/components/user-message-selector.d.ts +0 -30
  437. package/dist/modes/interactive/components/user-message-selector.d.ts.map +0 -1
  438. package/dist/modes/interactive/components/user-message-selector.js +0 -114
  439. package/dist/modes/interactive/components/user-message-selector.js.map +0 -1
  440. package/dist/modes/interactive/components/user-message.d.ts +0 -10
  441. package/dist/modes/interactive/components/user-message.d.ts.map +0 -1
  442. package/dist/modes/interactive/components/user-message.js +0 -29
  443. package/dist/modes/interactive/components/user-message.js.map +0 -1
  444. package/dist/modes/interactive/components/visual-truncate.d.ts +0 -24
  445. package/dist/modes/interactive/components/visual-truncate.d.ts.map +0 -1
  446. package/dist/modes/interactive/components/visual-truncate.js +0 -33
  447. package/dist/modes/interactive/components/visual-truncate.js.map +0 -1
  448. package/dist/modes/interactive/interactive-mode.d.ts +0 -343
  449. package/dist/modes/interactive/interactive-mode.d.ts.map +0 -1
  450. package/dist/modes/interactive/interactive-mode.js +0 -4315
  451. package/dist/modes/interactive/interactive-mode.js.map +0 -1
  452. package/dist/modes/interactive/theme/aery.json +0 -84
  453. package/dist/modes/interactive/theme/dark.json +0 -85
  454. package/dist/modes/interactive/theme/light.json +0 -84
  455. package/dist/modes/interactive/theme/theme-schema.json +0 -335
  456. package/dist/modes/interactive/theme/theme.d.ts +0 -81
  457. package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
  458. package/dist/modes/interactive/theme/theme.js +0 -979
  459. package/dist/modes/interactive/theme/theme.js.map +0 -1
  460. package/dist/modes/print-mode.d.ts +0 -28
  461. package/dist/modes/print-mode.d.ts.map +0 -1
  462. package/dist/modes/print-mode.js +0 -141
  463. package/dist/modes/print-mode.js.map +0 -1
  464. package/dist/modes/rpc/jsonl.d.ts +0 -17
  465. package/dist/modes/rpc/jsonl.d.ts.map +0 -1
  466. package/dist/modes/rpc/jsonl.js +0 -49
  467. package/dist/modes/rpc/jsonl.js.map +0 -1
  468. package/dist/modes/rpc/rpc-client.d.ts +0 -224
  469. package/dist/modes/rpc/rpc-client.d.ts.map +0 -1
  470. package/dist/modes/rpc/rpc-client.js +0 -410
  471. package/dist/modes/rpc/rpc-client.js.map +0 -1
  472. package/dist/modes/rpc/rpc-mode.d.ts +0 -20
  473. package/dist/modes/rpc/rpc-mode.d.ts.map +0 -1
  474. package/dist/modes/rpc/rpc-mode.js +0 -601
  475. package/dist/modes/rpc/rpc-mode.js.map +0 -1
  476. package/dist/modes/rpc/rpc-types.d.ts +0 -419
  477. package/dist/modes/rpc/rpc-types.d.ts.map +0 -1
  478. package/dist/modes/rpc/rpc-types.js +0 -8
  479. package/dist/modes/rpc/rpc-types.js.map +0 -1
  480. package/dist/package-manager-cli.d.ts +0 -4
  481. package/dist/package-manager-cli.d.ts.map +0 -1
  482. package/dist/package-manager-cli.js +0 -234
  483. package/dist/package-manager-cli.js.map +0 -1
  484. package/dist/utils/changelog.d.ts +0 -21
  485. package/dist/utils/changelog.d.ts.map +0 -1
  486. package/dist/utils/changelog.js +0 -87
  487. package/dist/utils/changelog.js.map +0 -1
  488. package/dist/utils/child-process.d.ts +0 -11
  489. package/dist/utils/child-process.d.ts.map +0 -1
  490. package/dist/utils/child-process.js +0 -78
  491. package/dist/utils/child-process.js.map +0 -1
  492. package/dist/utils/clipboard-image.d.ts +0 -11
  493. package/dist/utils/clipboard-image.d.ts.map +0 -1
  494. package/dist/utils/clipboard-image.js +0 -245
  495. package/dist/utils/clipboard-image.js.map +0 -1
  496. package/dist/utils/clipboard-native.d.ts +0 -8
  497. package/dist/utils/clipboard-native.d.ts.map +0 -1
  498. package/dist/utils/clipboard-native.js +0 -14
  499. package/dist/utils/clipboard-native.js.map +0 -1
  500. package/dist/utils/clipboard.d.ts +0 -2
  501. package/dist/utils/clipboard.d.ts.map +0 -1
  502. package/dist/utils/clipboard.js +0 -78
  503. package/dist/utils/clipboard.js.map +0 -1
  504. package/dist/utils/exif-orientation.d.ts +0 -5
  505. package/dist/utils/exif-orientation.d.ts.map +0 -1
  506. package/dist/utils/exif-orientation.js +0 -158
  507. package/dist/utils/exif-orientation.js.map +0 -1
  508. package/dist/utils/frontmatter.d.ts +0 -8
  509. package/dist/utils/frontmatter.d.ts.map +0 -1
  510. package/dist/utils/frontmatter.js +0 -26
  511. package/dist/utils/frontmatter.js.map +0 -1
  512. package/dist/utils/git.d.ts +0 -26
  513. package/dist/utils/git.d.ts.map +0 -1
  514. package/dist/utils/git.js +0 -163
  515. package/dist/utils/git.js.map +0 -1
  516. package/dist/utils/image-convert.d.ts +0 -9
  517. package/dist/utils/image-convert.d.ts.map +0 -1
  518. package/dist/utils/image-convert.js +0 -39
  519. package/dist/utils/image-convert.js.map +0 -1
  520. package/dist/utils/image-resize.d.ts +0 -36
  521. package/dist/utils/image-resize.d.ts.map +0 -1
  522. package/dist/utils/image-resize.js +0 -137
  523. package/dist/utils/image-resize.js.map +0 -1
  524. package/dist/utils/mime.d.ts +0 -2
  525. package/dist/utils/mime.d.ts.map +0 -1
  526. package/dist/utils/mime.js +0 -26
  527. package/dist/utils/mime.js.map +0 -1
  528. package/dist/utils/paths.d.ts +0 -7
  529. package/dist/utils/paths.d.ts.map +0 -1
  530. package/dist/utils/paths.js +0 -19
  531. package/dist/utils/paths.js.map +0 -1
  532. package/dist/utils/photon.d.ts +0 -21
  533. package/dist/utils/photon.d.ts.map +0 -1
  534. package/dist/utils/photon.js +0 -121
  535. package/dist/utils/photon.js.map +0 -1
  536. package/dist/utils/shell.d.ts +0 -29
  537. package/dist/utils/shell.d.ts.map +0 -1
  538. package/dist/utils/shell.js +0 -203
  539. package/dist/utils/shell.js.map +0 -1
  540. package/dist/utils/sleep.d.ts +0 -5
  541. package/dist/utils/sleep.d.ts.map +0 -1
  542. package/dist/utils/sleep.js +0 -17
  543. package/dist/utils/sleep.js.map +0 -1
  544. package/dist/utils/tools-manager.d.ts +0 -3
  545. package/dist/utils/tools-manager.d.ts.map +0 -1
  546. package/dist/utils/tools-manager.js +0 -252
  547. 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 "@aryee/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