@linxiraos/pi-tui 1.4.6 → 1.4.9

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 (399) hide show
  1. package/CHANGELOG.md +162 -244
  2. package/README.md +41 -35
  3. package/dist/types/app-keybindings.d.ts +20 -0
  4. package/dist/types/apps/session-picker.d.ts +5 -0
  5. package/dist/types/charts/chart-plan.d.ts +9 -7
  6. package/dist/types/charts/table-data.d.ts +4 -2
  7. package/dist/types/chat/assistant-message.d.ts +15 -3
  8. package/dist/types/chat/bash-execution.d.ts +6 -1
  9. package/dist/types/chat/display-preferences.d.ts +2 -0
  10. package/dist/types/chat/eval-execution.d.ts +2 -0
  11. package/dist/types/chat/execution-shared.d.ts +14 -8
  12. package/dist/types/chat/extension-types.d.ts +31 -0
  13. package/dist/types/chat/figure-markdown.d.ts +2 -0
  14. package/dist/types/chat/reply-write.d.ts +48 -0
  15. package/dist/types/chat/svg-figure.d.ts +5 -0
  16. package/dist/types/chat/table-chart.d.ts +6 -3
  17. package/dist/types/chat/tool-execution.d.ts +1 -2
  18. package/dist/types/chat/transcript-outline.d.ts +7 -0
  19. package/dist/types/chat/transcript-render-helpers.d.ts +13 -3
  20. package/dist/types/chrome/dynamic-border.d.ts +6 -0
  21. package/dist/types/chrome/index.d.ts +1 -0
  22. package/dist/types/chrome/transcript-notice.d.ts +35 -0
  23. package/dist/types/chrome/transcript-status.d.ts +21 -9
  24. package/dist/types/components/editor.d.ts +23 -6
  25. package/dist/types/components/image.d.ts +6 -0
  26. package/dist/types/components/loader.d.ts +2 -0
  27. package/dist/types/components/markdown.d.ts +7 -0
  28. package/dist/types/keybinding-matchers.d.ts +7 -0
  29. package/dist/types/native/blobs.d.ts +2 -1
  30. package/dist/types/native/describe.d.ts +4 -2
  31. package/dist/types/native/node.d.ts +2 -3
  32. package/dist/types/native/overlay.d.ts +42 -2
  33. package/dist/types/native/picker.d.ts +4 -4
  34. package/dist/types/native/state.d.ts +4 -0
  35. package/dist/types/overlays/annotation-overlay.d.ts +7 -1
  36. package/dist/types/overlays/annotation-types.d.ts +28 -0
  37. package/dist/types/overlays/btw-history-panel.d.ts +15 -0
  38. package/dist/types/overlays/btw-history.d.ts +24 -0
  39. package/dist/types/overlays/btw-inject.d.ts +22 -0
  40. package/dist/types/overlays/btw-panel.d.ts +7 -0
  41. package/dist/types/overlays/hook-editor.d.ts +2 -0
  42. package/dist/types/overlays/jobs-panel.d.ts +4 -0
  43. package/dist/types/overlays/login-dialog.d.ts +5 -1
  44. package/dist/types/overlays/model-browser.d.ts +11 -2
  45. package/dist/types/overlays/oauth-selector.d.ts +23 -0
  46. package/dist/types/overlays/plan-review-overlay.d.ts +2 -0
  47. package/dist/types/overlays/rewind-selector.d.ts +1 -1
  48. package/dist/types/overlays/session-selector.d.ts +33 -4
  49. package/dist/types/prompt/composer.d.ts +56 -5
  50. package/dist/types/prompt/interactive-context-helpers.d.ts +10 -3
  51. package/dist/types/render/extension-links.d.ts +65 -0
  52. package/dist/types/render/hyperlink.d.ts +25 -7
  53. package/dist/types/render/index.d.ts +1 -0
  54. package/dist/types/render/render-utils.d.ts +23 -1
  55. package/dist/types/setup/scenes/glyph.d.ts +1 -1
  56. package/dist/types/setup/scenes/model.d.ts +1 -1
  57. package/dist/types/setup/scenes/outro.d.ts +5 -4
  58. package/dist/types/setup/scenes/sign-in.d.ts +13 -8
  59. package/dist/types/setup/scenes/types.d.ts +16 -1
  60. package/dist/types/setup/startup-splash.d.ts +1 -1
  61. package/dist/types/setup/wizard-overlay.d.ts +11 -7
  62. package/dist/types/setup/wizard.d.ts +5 -1
  63. package/dist/types/status-line/component.d.ts +1 -1
  64. package/dist/types/status-line/context-usage.d.ts +28 -6
  65. package/dist/types/status-line/host.d.ts +6 -2
  66. package/dist/types/status-line/startup.d.ts +0 -15
  67. package/dist/types/terminal-capabilities.d.ts +1 -1
  68. package/dist/types/theme/symbols.d.ts +3 -1
  69. package/dist/types/theme/theme-class.d.ts +1 -0
  70. package/dist/types/theme/theme.d.ts +1 -24
  71. package/dist/types/theme/tui-adapters.d.ts +2 -0
  72. package/dist/types/thinking.d.ts +8 -6
  73. package/dist/types/tools/ast-grep.d.ts +2 -0
  74. package/dist/types/tools/bash-interactive.d.ts +6 -0
  75. package/dist/types/tools/bash.d.ts +2 -0
  76. package/dist/types/tools/default-renderer.d.ts +6 -4
  77. package/dist/types/tools/eval.d.ts +2 -0
  78. package/dist/types/tools/find.d.ts +1 -1
  79. package/dist/types/tools/grouped-file-output.d.ts +100 -19
  80. package/dist/types/tools/hashline-format.d.ts +5 -0
  81. package/dist/types/tools/irc.d.ts +6 -0
  82. package/dist/types/tools/json-tree.d.ts +23 -4
  83. package/dist/types/tools/lsp.d.ts +2 -0
  84. package/dist/types/tools/mcp.d.ts +6 -5
  85. package/dist/types/tools/native-view.d.ts +3 -1
  86. package/dist/types/tools/output-meta.d.ts +27 -0
  87. package/dist/types/tools/read.d.ts +14 -4
  88. package/dist/types/tools/renderer.d.ts +2 -0
  89. package/dist/types/tools/streaming-output.d.ts +11 -0
  90. package/dist/types/tools/task.d.ts +13 -4
  91. package/dist/types/tools/url-scheme-host.d.ts +17 -0
  92. package/dist/types/tools/wait.d.ts +2 -0
  93. package/dist/types/tools/yield.d.ts +1 -1
  94. package/dist/types/tui.d.ts +19 -2
  95. package/dist/types/utils.d.ts +4 -0
  96. package/package.json +10 -14
  97. package/src/app-keybindings.d.ts +20 -0
  98. package/src/app-keybindings.ts +20 -0
  99. package/src/apps/git/git-tui.ts +10 -17
  100. package/src/apps/git/sidebar.ts +21 -35
  101. package/src/apps/ps-top.ts +4 -12
  102. package/src/apps/session-picker.ts +7 -0
  103. package/src/charts/chart-plan.d.ts +9 -7
  104. package/src/charts/chart-plan.ts +20 -79
  105. package/src/charts/table-data.d.ts +4 -2
  106. package/src/charts/table-data.ts +55 -6
  107. package/src/chat/advisor-message.ts +2 -0
  108. package/src/chat/assistant-message.d.ts +15 -3
  109. package/src/chat/assistant-message.ts +137 -19
  110. package/src/chat/background-tan-message.ts +4 -0
  111. package/src/chat/bash-execution.d.ts +6 -1
  112. package/src/chat/bash-execution.ts +26 -9
  113. package/src/chat/chat-transcript-builder.ts +63 -30
  114. package/src/chat/compaction-summary-message.ts +2 -1
  115. package/src/chat/display-preferences.d.ts +2 -0
  116. package/src/chat/display-preferences.ts +3 -0
  117. package/src/chat/eval-execution.d.ts +2 -0
  118. package/src/chat/eval-execution.ts +14 -7
  119. package/src/chat/execution-shared.d.ts +14 -8
  120. package/src/chat/execution-shared.ts +39 -18
  121. package/src/chat/extension-types.d.ts +31 -0
  122. package/src/chat/extension-types.ts +34 -0
  123. package/src/chat/figure-markdown.d.ts +2 -0
  124. package/src/chat/figure-markdown.ts +6 -4
  125. package/src/chat/read-tool-group.ts +56 -36
  126. package/src/chat/reply-write.d.ts +48 -0
  127. package/src/chat/reply-write.ts +127 -0
  128. package/src/chat/svg-figure.d.ts +5 -0
  129. package/src/chat/svg-figure.ts +55 -16
  130. package/src/chat/table-chart.d.ts +6 -3
  131. package/src/chat/table-chart.ts +29 -6
  132. package/src/chat/tool-execution.d.ts +1 -2
  133. package/src/chat/tool-execution.ts +20 -13
  134. package/src/chat/transcript-outline.d.ts +7 -0
  135. package/src/chat/transcript-outline.ts +27 -0
  136. package/src/chat/transcript-render-helpers.d.ts +13 -3
  137. package/src/chat/transcript-render-helpers.ts +134 -44
  138. package/src/chrome/dynamic-border.d.ts +6 -0
  139. package/src/chrome/dynamic-border.ts +28 -2
  140. package/src/chrome/index.ts +1 -0
  141. package/src/chrome/transcript-notice.d.ts +35 -0
  142. package/src/chrome/transcript-notice.ts +83 -0
  143. package/src/chrome/transcript-status.d.ts +21 -9
  144. package/src/chrome/transcript-status.ts +32 -30
  145. package/src/components/editor.d.ts +23 -6
  146. package/src/components/editor.ts +133 -25
  147. package/src/components/image.d.ts +6 -0
  148. package/src/components/image.ts +13 -0
  149. package/src/components/key-value-list.ts +9 -9
  150. package/src/components/loader.d.ts +2 -0
  151. package/src/components/loader.ts +7 -0
  152. package/src/components/markdown.d.ts +7 -0
  153. package/src/components/markdown.ts +116 -6
  154. package/src/components/section.ts +1 -9
  155. package/src/components/table.ts +1 -9
  156. package/src/hotkeys-markdown.ts +1 -0
  157. package/src/keybinding-matchers.d.ts +7 -0
  158. package/src/keybinding-matchers.ts +13 -0
  159. package/src/native/backend.ts +10 -67
  160. package/src/native/blobs.d.ts +2 -1
  161. package/src/native/blobs.ts +3 -2
  162. package/src/native/describe.d.ts +4 -2
  163. package/src/native/describe.ts +9 -4
  164. package/src/native/node.d.ts +2 -3
  165. package/src/native/node.ts +2 -3
  166. package/src/native/overlay.d.ts +42 -2
  167. package/src/native/overlay.ts +124 -16
  168. package/src/native/picker.d.ts +4 -4
  169. package/src/native/picker.ts +4 -4
  170. package/src/native/state.d.ts +4 -0
  171. package/src/native/state.ts +25 -5
  172. package/src/overlays/advisor-config.ts +1 -10
  173. package/src/overlays/annotation-overlay.ts +125 -37
  174. package/src/overlays/annotation-types.ts +24 -0
  175. package/src/overlays/btw-history-panel.ts +106 -14
  176. package/src/overlays/btw-history.ts +65 -0
  177. package/src/overlays/btw-inject.ts +91 -0
  178. package/src/overlays/btw-panel.ts +53 -12
  179. package/src/overlays/extensions/extension-dashboard.ts +7 -8
  180. package/src/overlays/hook-editor.ts +6 -0
  181. package/src/overlays/hook-selector.ts +2 -2
  182. package/src/overlays/jobs-panel.ts +82 -22
  183. package/src/overlays/login-dialog.ts +39 -31
  184. package/src/overlays/mcp-add-wizard.ts +1 -1
  185. package/src/overlays/model-browser.ts +106 -10
  186. package/src/overlays/model-hub.ts +1 -7
  187. package/src/overlays/model-picker.ts +1 -10
  188. package/src/overlays/oauth-selector.ts +44 -6
  189. package/src/overlays/plan-review-overlay.ts +13 -2
  190. package/src/overlays/rewind-selector.ts +29 -12
  191. package/src/overlays/session-selector.ts +338 -47
  192. package/src/overlays/settings-defs.ts +2 -2
  193. package/src/overlays/tree-selector.ts +83 -27
  194. package/src/overlays/usage-dashboard.ts +9 -18
  195. package/src/prompt/composer.ts +233 -6
  196. package/src/prompt/custom-editor.ts +6 -1
  197. package/src/prompt/emoji-autocomplete.ts +0 -2
  198. package/src/prompt/interactive-context-helpers.ts +29 -4
  199. package/src/render/code-cell.ts +1 -1
  200. package/src/render/extension-links.d.ts +65 -0
  201. package/src/render/extension-links.ts +214 -0
  202. package/src/render/file-list.ts +4 -7
  203. package/src/render/hyperlink.d.ts +25 -7
  204. package/src/render/hyperlink.ts +65 -9
  205. package/src/render/index.d.ts +1 -0
  206. package/src/render/index.ts +1 -0
  207. package/src/render/render-utils.d.ts +23 -1
  208. package/src/render/render-utils.ts +38 -6
  209. package/src/setup/scenes/composer.ts +2 -0
  210. package/src/setup/scenes/glyph.ts +4 -2
  211. package/src/setup/scenes/model.ts +192 -29
  212. package/src/setup/scenes/outro.ts +33 -15
  213. package/src/setup/scenes/sign-in.ts +196 -400
  214. package/src/setup/scenes/theme.ts +2 -0
  215. package/src/setup/scenes/types.ts +18 -1
  216. package/src/setup/startup-splash.ts +8 -7
  217. package/src/setup/wizard-overlay.ts +164 -35
  218. package/src/setup/wizard.ts +11 -2
  219. package/src/status-line/component.ts +4 -10
  220. package/src/status-line/context-usage.ts +72 -21
  221. package/src/status-line/host.ts +6 -2
  222. package/src/status-line/startup.ts +36 -70
  223. package/src/terminal-capabilities.d.ts +1 -1
  224. package/src/terminal-capabilities.ts +5 -0
  225. package/src/terminal.ts +24 -2
  226. package/src/theme/defaults.json +1 -0
  227. package/src/theme/loader.ts +1 -1
  228. package/src/theme/symbols.d.ts +3 -1
  229. package/src/theme/symbols.ts +16 -9
  230. package/src/theme/theme-class.d.ts +1 -0
  231. package/src/theme/theme-class.ts +15 -3
  232. package/src/theme/theme.d.ts +1 -24
  233. package/src/theme/theme.ts +3 -75
  234. package/src/theme/tui-adapters.d.ts +2 -0
  235. package/src/theme/tui-adapters.ts +8 -3
  236. package/src/thinking.d.ts +8 -6
  237. package/src/thinking.ts +17 -11
  238. package/src/tmux.ts +1 -0
  239. package/src/tools/agent-tree.ts +13 -11
  240. package/src/tools/ask.ts +24 -37
  241. package/src/tools/ast-edit.ts +48 -93
  242. package/src/tools/ast-grep.d.ts +2 -0
  243. package/src/tools/ast-grep.ts +31 -67
  244. package/src/tools/bash-interactive.d.ts +49 -0
  245. package/src/tools/bash-interactive.ts +6 -1
  246. package/src/tools/bash.d.ts +2 -0
  247. package/src/tools/bash.ts +9 -0
  248. package/src/tools/default-renderer.d.ts +6 -4
  249. package/src/tools/default-renderer.ts +10 -7
  250. package/src/tools/edit.ts +50 -43
  251. package/src/tools/eval.d.ts +2 -0
  252. package/src/tools/eval.ts +16 -4
  253. package/src/tools/fetch.ts +2 -1
  254. package/src/tools/find.d.ts +1 -1
  255. package/src/tools/find.ts +13 -5
  256. package/src/tools/github.ts +14 -46
  257. package/src/tools/glob.ts +2 -1
  258. package/src/tools/grep.ts +47 -277
  259. package/src/tools/grouped-file-output.d.ts +100 -19
  260. package/src/tools/grouped-file-output.ts +414 -103
  261. package/src/tools/hashline-format.d.ts +5 -0
  262. package/src/tools/hashline-format.ts +5 -0
  263. package/src/tools/irc.d.ts +6 -0
  264. package/src/tools/irc.ts +6 -0
  265. package/src/tools/job-widget.ts +13 -1
  266. package/src/tools/json-tree.d.ts +23 -4
  267. package/src/tools/json-tree.ts +132 -46
  268. package/src/tools/lsp.d.ts +2 -0
  269. package/src/tools/lsp.ts +246 -47
  270. package/src/tools/mcp.d.ts +6 -5
  271. package/src/tools/mcp.ts +20 -12
  272. package/src/tools/native-view.d.ts +3 -1
  273. package/src/tools/native-view.ts +12 -6
  274. package/src/tools/output-meta.d.ts +27 -0
  275. package/src/tools/output-meta.ts +68 -4
  276. package/src/tools/proc-render.ts +3 -3
  277. package/src/tools/read.d.ts +14 -4
  278. package/src/tools/read.ts +20 -5
  279. package/src/tools/renderer.d.ts +2 -0
  280. package/src/tools/renderer.ts +2 -0
  281. package/src/tools/streaming-output.d.ts +11 -0
  282. package/src/tools/streaming-output.ts +41 -0
  283. package/src/tools/task.d.ts +13 -4
  284. package/src/tools/task.ts +100 -97
  285. package/src/tools/url-scheme-host.d.ts +17 -0
  286. package/src/tools/url-scheme-host.ts +21 -0
  287. package/src/tools/vibe.ts +4 -4
  288. package/src/tools/wait.d.ts +2 -0
  289. package/src/tools/wait.ts +8 -5
  290. package/src/tools/write.ts +17 -27
  291. package/src/tools/yield.d.ts +1 -1
  292. package/src/tools/yield.ts +19 -10
  293. package/src/tui.d.ts +19 -2
  294. package/src/tui.ts +134 -24
  295. package/src/utils.d.ts +4 -0
  296. package/src/utils.ts +10 -0
  297. package/dist/types/theme/defaults/index.d.ts +0 -10289
  298. package/src/theme/defaults/alabaster.json +0 -103
  299. package/src/theme/defaults/amethyst.json +0 -106
  300. package/src/theme/defaults/anthracite.json +0 -103
  301. package/src/theme/defaults/basalt.json +0 -101
  302. package/src/theme/defaults/birch.json +0 -105
  303. package/src/theme/defaults/dark-abyss.json +0 -101
  304. package/src/theme/defaults/dark-arctic.json +0 -114
  305. package/src/theme/defaults/dark-aurora.json +0 -105
  306. package/src/theme/defaults/dark-catppuccin.json +0 -117
  307. package/src/theme/defaults/dark-cavern.json +0 -101
  308. package/src/theme/defaults/dark-celestial.json +0 -116
  309. package/src/theme/defaults/dark-copper.json +0 -105
  310. package/src/theme/defaults/dark-cosmos.json +0 -100
  311. package/src/theme/defaults/dark-cyberpunk.json +0 -112
  312. package/src/theme/defaults/dark-dracula.json +0 -108
  313. package/src/theme/defaults/dark-eclipse.json +0 -101
  314. package/src/theme/defaults/dark-ember.json +0 -105
  315. package/src/theme/defaults/dark-equinox.json +0 -100
  316. package/src/theme/defaults/dark-forest.json +0 -106
  317. package/src/theme/defaults/dark-github.json +0 -115
  318. package/src/theme/defaults/dark-gruvbox.json +0 -122
  319. package/src/theme/defaults/dark-lavender.json +0 -105
  320. package/src/theme/defaults/dark-lunar.json +0 -99
  321. package/src/theme/defaults/dark-midnight.json +0 -105
  322. package/src/theme/defaults/dark-monochrome.json +0 -104
  323. package/src/theme/defaults/dark-monokai.json +0 -108
  324. package/src/theme/defaults/dark-nebula.json +0 -100
  325. package/src/theme/defaults/dark-neon-noir.json +0 -110
  326. package/src/theme/defaults/dark-nord.json +0 -108
  327. package/src/theme/defaults/dark-ocean.json +0 -111
  328. package/src/theme/defaults/dark-one.json +0 -110
  329. package/src/theme/defaults/dark-poimandres.json +0 -125
  330. package/src/theme/defaults/dark-rainforest.json +0 -101
  331. package/src/theme/defaults/dark-reef.json +0 -101
  332. package/src/theme/defaults/dark-retro.json +0 -102
  333. package/src/theme/defaults/dark-rose-pine.json +0 -106
  334. package/src/theme/defaults/dark-sakura.json +0 -105
  335. package/src/theme/defaults/dark-slate.json +0 -105
  336. package/src/theme/defaults/dark-solarized.json +0 -107
  337. package/src/theme/defaults/dark-solstice.json +0 -100
  338. package/src/theme/defaults/dark-starfall.json +0 -101
  339. package/src/theme/defaults/dark-sunset.json +0 -109
  340. package/src/theme/defaults/dark-swamp.json +0 -100
  341. package/src/theme/defaults/dark-synthwave.json +0 -113
  342. package/src/theme/defaults/dark-taiga.json +0 -101
  343. package/src/theme/defaults/dark-terminal.json +0 -105
  344. package/src/theme/defaults/dark-tokyo-night.json +0 -111
  345. package/src/theme/defaults/dark-tundra.json +0 -101
  346. package/src/theme/defaults/dark-twilight.json +0 -101
  347. package/src/theme/defaults/dark-volcanic.json +0 -101
  348. package/src/theme/defaults/graphite.json +0 -102
  349. package/src/theme/defaults/index.d.ts +0 -10289
  350. package/src/theme/defaults/index.ts +0 -203
  351. package/src/theme/defaults/light-arctic.json +0 -117
  352. package/src/theme/defaults/light-aurora-day.json +0 -101
  353. package/src/theme/defaults/light-canyon.json +0 -101
  354. package/src/theme/defaults/light-catppuccin.json +0 -116
  355. package/src/theme/defaults/light-cirrus.json +0 -100
  356. package/src/theme/defaults/light-coral.json +0 -105
  357. package/src/theme/defaults/light-cyberpunk.json +0 -106
  358. package/src/theme/defaults/light-dawn.json +0 -100
  359. package/src/theme/defaults/light-dunes.json +0 -101
  360. package/src/theme/defaults/light-eucalyptus.json +0 -105
  361. package/src/theme/defaults/light-forest.json +0 -110
  362. package/src/theme/defaults/light-frost.json +0 -105
  363. package/src/theme/defaults/light-github.json +0 -125
  364. package/src/theme/defaults/light-glacier.json +0 -101
  365. package/src/theme/defaults/light-gruvbox.json +0 -118
  366. package/src/theme/defaults/light-haze.json +0 -100
  367. package/src/theme/defaults/light-honeycomb.json +0 -105
  368. package/src/theme/defaults/light-lagoon.json +0 -101
  369. package/src/theme/defaults/light-lavender.json +0 -105
  370. package/src/theme/defaults/light-meadow.json +0 -101
  371. package/src/theme/defaults/light-mint.json +0 -105
  372. package/src/theme/defaults/light-monochrome.json +0 -111
  373. package/src/theme/defaults/light-ocean.json +0 -109
  374. package/src/theme/defaults/light-one.json +0 -109
  375. package/src/theme/defaults/light-opal.json +0 -101
  376. package/src/theme/defaults/light-orchard.json +0 -101
  377. package/src/theme/defaults/light-paper.json +0 -105
  378. package/src/theme/defaults/light-poimandres.json +0 -125
  379. package/src/theme/defaults/light-prism.json +0 -100
  380. package/src/theme/defaults/light-retro.json +0 -108
  381. package/src/theme/defaults/light-sand.json +0 -105
  382. package/src/theme/defaults/light-savanna.json +0 -101
  383. package/src/theme/defaults/light-solarized.json +0 -112
  384. package/src/theme/defaults/light-soleil.json +0 -100
  385. package/src/theme/defaults/light-sunset.json +0 -109
  386. package/src/theme/defaults/light-synthwave.json +0 -108
  387. package/src/theme/defaults/light-tokyo-night.json +0 -121
  388. package/src/theme/defaults/light-wetland.json +0 -101
  389. package/src/theme/defaults/light-zenith.json +0 -99
  390. package/src/theme/defaults/limestone.json +0 -104
  391. package/src/theme/defaults/mahogany.json +0 -107
  392. package/src/theme/defaults/marble.json +0 -103
  393. package/src/theme/defaults/obsidian.json +0 -101
  394. package/src/theme/defaults/onyx.json +0 -101
  395. package/src/theme/defaults/pearl.json +0 -103
  396. package/src/theme/defaults/porcelain.json +0 -101
  397. package/src/theme/defaults/quartz.json +0 -106
  398. package/src/theme/defaults/sandstone.json +0 -105
  399. package/src/theme/defaults/titanium.json +0 -100
@@ -18,6 +18,7 @@ import { formatBytes, getProjectDir } from "@linxiraos/pi-utils";
18
18
  import type { TspPickerGroup, TspPickerItem, TspSpan, TspText, TspTone } from "@linxiraos/pi-wire";
19
19
  import { compact, kv, md, node, span } from "../native/describe";
20
20
  import {
21
+ bindingKeys,
21
22
  picker,
22
23
  pickerAction,
23
24
  pickerAge,
@@ -27,7 +28,7 @@ import {
27
28
  pickerHits,
28
29
  } from "../native/picker";
29
30
  import type { DescribeContext, NativeChild, NativeNode, NativeUiEvent } from "../native/node";
30
- import { hintsRow, type NativeHint, overlayCard } from "../native/overlay";
31
+ import { actionHint, hintsRow, type NativeHint, overlayCard } from "../native/overlay";
31
32
  import { plainText } from "../native/spans";
32
33
  import { tuiText, tuiTextFmt } from "../i18n";
33
34
  import {
@@ -45,6 +46,7 @@ import {
45
46
  import { theme } from "../theme/theme";
46
47
  import { contentRowWidth } from "../chrome/selector-helpers";
47
48
  import { matchesAppInterrupt, matchesSelectDown, matchesSelectUp } from "../keybinding-matchers";
49
+ import { getKeybindings } from "../keybindings";
48
50
  /** Session lifecycle status presented by the picker. */
49
51
  export type SessionSelectorStatus = "complete" | "interrupted" | "aborted" | "error" | "pending" | "unknown";
50
52
 
@@ -64,6 +66,7 @@ export interface SessionSelectorEntry {
64
66
  parentSessionPath?: string;
65
67
  }
66
68
  import { shortenPath } from "../render/render-utils";
69
+ import { formTheme } from "../chrome/form-theme";
67
70
  import { HookSelectorComponent } from "./hook-selector";
68
71
  import { ResumeTreeComponent, type ResumeTreeSource } from "./resume-tree";
69
72
 
@@ -80,6 +83,7 @@ export type {
80
83
  ResumeWorkspaceLike,
81
84
  } from "./resume-picker";
82
85
  import { bottomBorder, OverlayPanel, row, topBorder } from "../chrome/overlay-box";
86
+ import { TextFormField } from "../components/form";
83
87
  import { MenuSelection, getMenuWindow } from "../components/menu-selection";
84
88
  import { formatKeyHint, formatKeyHints } from "../app-keybindings";
85
89
  import { boundKeys, interruptKey } from "../chrome/keybinding-hints";
@@ -545,6 +549,8 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
545
549
  readonly #getTerminalRows: () => number;
546
550
 
547
551
  onDeleteRequest?: (session: T) => void;
552
+ onRenameRequest?: (session: T) => void;
553
+ onPinRequest?: (session: T, pinned: boolean) => void;
548
554
 
549
555
  #allSessions: T[];
550
556
  #showCwd: boolean;
@@ -618,7 +624,7 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
618
624
  this.#getCurrentSessionPath =
619
625
  typeof currentSessionPath === "function" ? currentSessionPath : () => currentSessionPath;
620
626
  this.#historyMatcher = historyMatcher;
621
- this.#menu = new MenuSelection<T>(sessions, {
627
+ this.#menu = new MenuSelection<T>(this.#pinnedFirst(sessions), {
622
628
  getKey: session => session.path,
623
629
  getSearchText: sessionSearchText,
624
630
  });
@@ -714,8 +720,9 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
714
720
  this.#hadFilterQuery = tokens.length > 0;
715
721
  this.#lastFilterQuery = query;
716
722
  if (tokens.length === 0) {
717
- const keepIndex = Math.min(this.#menu.selectedIndex, Math.max(0, this.#allSessions.length - 1));
718
- this.#menu.setItems(this.#allSessions, keepIndex >= 0 ? this.#allSessions[keepIndex]?.path : undefined);
723
+ const items = this.#pinnedFirst(this.#allSessions);
724
+ const keepIndex = Math.min(this.#menu.selectedIndex, Math.max(0, items.length - 1));
725
+ this.#menu.setItems(items, keepIndex >= 0 ? items[keepIndex]?.path : undefined);
719
726
  if (hadQuery) this.#selectCurrentSession();
720
727
  this.#scheduleHistoryMerge(query);
721
728
  return;
@@ -789,8 +796,9 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
789
796
  }
790
797
 
791
798
  /**
792
- * Rebuild the menu's visible list with title matches first, then other
793
- * prompt-history hits, literal matches (recency), and fuzzy-only hits (score).
799
+ * Rebuild the menu's visible list with pinned sessions first, then title
800
+ * matches, other prompt-history hits, literal matches (recency), and
801
+ * fuzzy-only hits (score).
794
802
  */
795
803
  #composeFiltered(): void {
796
804
  this.#itemsVersion++;
@@ -798,17 +806,31 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
798
806
  const base: T[] = [];
799
807
  for (const match of this.#literalRanked) base.push(match.session);
800
808
  for (const match of this.#fuzzyRanked) base.push(match.session);
801
- const composed = prioritizeTitleMatches(
802
- this.#historyIds.length > 0 ? mergeSessionRanking(this.#allSessions, base, this.#historyIds) : base,
803
- tokenizeSessionQuery(this.#searchInput.getValue()),
804
- this.#literalRanked,
809
+ const composed = this.#pinnedFirst(
810
+ prioritizeTitleMatches(
811
+ this.#historyIds.length > 0 ? mergeSessionRanking(this.#allSessions, base, this.#historyIds) : base,
812
+ tokenizeSessionQuery(this.#searchInput.getValue()),
813
+ this.#literalRanked,
814
+ ),
805
815
  );
806
- // The fuzzy scan and the history merge only clamp the cursor so an arrow
807
- // selection survives recomposition; the query path resets explicitly.
816
+ // A late pinned or history match can land above the cursor: a moved
817
+ // selection follows its session, an untouched one keeps the top rank.
818
+ // The query path resets explicitly.
819
+ if (this.#selectionMoved) {
820
+ this.#menu.setItems(composed);
821
+ return;
822
+ }
808
823
  const keepIndex = Math.min(this.#menu.selectedIndex, Math.max(0, composed.length - 1));
809
824
  this.#menu.setItems(composed, keepIndex >= 0 ? composed[keepIndex]?.path : undefined);
810
825
  }
811
826
 
827
+ /** Stable partition: pinned sessions first, each group in its incoming order. */
828
+ #pinnedFirst(sessions: readonly T[]): readonly T[] {
829
+ const pins = this.#pinnedIds;
830
+ const pinned = pins.size > 0 ? sessions.filter(session => pins.has(session.id)) : [];
831
+ return pinned.length > 0 ? [...pinned, ...sessions.filter(session => !pins.has(session.id))] : sessions;
832
+ }
833
+
812
834
  /**
813
835
  * Augment ranked results with prompt-history matches without replacing them.
814
836
  * The session-list corpus only sees the first 4KB of each session, so a prompt
@@ -870,6 +892,22 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
870
892
  }
871
893
  }
872
894
 
895
+ /** Update a session's title in place and refresh the visible list, keeping the selection. */
896
+ renameSessionTitle(sessionPath: string, title: string): void {
897
+ const entry = this.#allSessions.find(s => s.path === sessionPath);
898
+ if (!entry) return;
899
+ this.#datasetVersion++;
900
+ entry.title = title;
901
+ // The cached native item embeds the old title, and the search haystack
902
+ // caches it too: drop both so the next describe rebuilds the row and
903
+ // the literal/fuzzy search paths match the new title. Selection is
904
+ // path-keyed, so the same-query refilter keeps the cursor on the
905
+ // renamed session.
906
+ delete (entry as NativeSessionInfo)[kNativeItem];
907
+ delete (entry as SearchableSessionInfo)[kSearchTextLower];
908
+ this.#filterSessions(this.#searchInput.getValue());
909
+ }
910
+
873
911
  /** Resolve a list-local rendered-line index to a filtered-session index. */
874
912
  hitTestSession(line: number): number | undefined {
875
913
  return this.#hitRows[line];
@@ -913,6 +951,43 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
913
951
  if (selected) this.onDeleteRequest?.(selected);
914
952
  }
915
953
 
954
+ /** F2: ask the parent to rename the selected session. */
955
+ requestRename(): void {
956
+ const selected = this.#menu.selectedItem;
957
+ if (selected) this.onRenameRequest?.(selected);
958
+ }
959
+
960
+ /** Pin keys: ask the parent to pin or unpin the selected session (default: flip it); no-op when already there. */
961
+ requestPin(pinned?: boolean): void {
962
+ const selected = this.#menu.selectedItem;
963
+ if (!selected) return;
964
+ const isPinned = this.#pinnedIds.has(selected.id);
965
+ if (pinned !== isPinned) this.onPinRequest?.(selected, !isPinned);
966
+ }
967
+
968
+ /** Apply a persisted pin change; the list re-partitions and the cursor follows the session. */
969
+ setPinned(sessionId: string, pinned: boolean): void {
970
+ const pinnedIds = new Set(this.#pinnedIds);
971
+ if (pinned) pinnedIds.add(sessionId);
972
+ else pinnedIds.delete(sessionId);
973
+ this.#pinnedIds = pinnedIds;
974
+ // Counts as moving the selection: it keeps the cursor on this session
975
+ // and a pending history merge from reordering under it.
976
+ this.#selectionMoved = true;
977
+ if (this.#hadFilterQuery) {
978
+ this.#composeFiltered();
979
+ } else {
980
+ this.#itemsVersion++;
981
+ this.#menu.setItems(this.#pinnedFirst(this.#allSessions));
982
+ }
983
+ }
984
+
985
+ /** Whether the selected session is pinned (picks the pin action's direction). */
986
+ get selectedPinned(): boolean {
987
+ const selected = this.#menu.selectedItem;
988
+ return selected !== undefined && this.#pinnedIds.has(selected.id);
989
+ }
990
+
916
991
  /** Empty the search query (the empty state's "Clear search"). */
917
992
  clearSearch(): void {
918
993
  this.#searchInput.setValue("");
@@ -966,7 +1041,7 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
966
1041
  if (tokens.length === 0) {
967
1042
  const now = new Date();
968
1043
  const startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
969
- // Pins lead the listing (`sortPinnedFirst`), so they get their own group ahead of the days.
1044
+ // Pins lead the listing (`#pinnedFirst`), so they get their own group ahead of the days.
970
1045
  const groups = visible.map(session =>
971
1046
  this.#pinnedIds.has(session.id) ? PINNED_GROUP : sessionDayGroup(session.modified, startOfToday),
972
1047
  );
@@ -1331,6 +1406,21 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
1331
1406
  this.requestDelete();
1332
1407
  return;
1333
1408
  }
1409
+ // F2 renames the selected session; as a non-printable key it never
1410
+ // collides with the search input.
1411
+ if (matchesKey(keyData, "f2")) {
1412
+ this.requestRename();
1413
+ return;
1414
+ }
1415
+ const keybindings = getKeybindings();
1416
+ if (keybindings.matches(keyData, "app.session.pin")) {
1417
+ this.requestPin(true);
1418
+ return;
1419
+ }
1420
+ if (keybindings.matches(keyData, "app.session.unpin")) {
1421
+ this.requestPin(false);
1422
+ return;
1423
+ }
1334
1424
  // Up arrow
1335
1425
  if (matchesSelectUp(keyData)) {
1336
1426
  this.#selectionMoved = true;
@@ -1386,11 +1476,24 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
1386
1476
 
1387
1477
  export interface SessionSelectorOptions<T extends SessionSelectorEntry = SessionSelectorEntry> {
1388
1478
  onDelete?: (session: T) => Promise<boolean>;
1479
+ /**
1480
+ * Rename the selected session to a user-supplied title; resolve with the
1481
+ * title as stored (the session canonicalizes it) or null when the rename
1482
+ * did not happen.
1483
+ */
1484
+ onRename?: (session: T, title: string) => Promise<string | null>;
1485
+ /** Persist the selected session's pin state (pin keys / the picker's Pin action). */
1486
+ onSetPinned?: (session: T, pinned: boolean) => Promise<void>;
1389
1487
  historyMatcher?: SessionHistoryMatcher;
1488
+ /**
1489
+ * Complete folder listing when the constructor's `sessions` are a preliminary
1490
+ * subset; replaces them once it settles.
1491
+ */
1492
+ completeSessions?: Promise<T[]>;
1390
1493
  /** Loads sessions across all projects for the all-projects scope toggle (Tab). */
1391
- loadAllSessions?: () => Promise<T[]>;
1494
+ loadAllSessions?: () => Promise<T[] | { sessions: T[] }>;
1392
1495
  /** Preloaded all-projects list; cached so the first Tab toggle is instant. */
1393
- allSessions?: T[];
1496
+ allSessions?: T[] | { sessions: T[] };
1394
1497
  /**
1395
1498
  * The host's resume model (project → workspace → conversation) and its
1396
1499
  * pure view builder. When set, the native `picker` describes the resume
@@ -1487,17 +1590,23 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1487
1590
  #nativePicker = false;
1488
1591
  readonly #getTerminalRowsOption: (() => number) | undefined;
1489
1592
  #confirmationDialog: HookSelectorComponent | null = null;
1490
- // Hosts whichever of `#sessionList` / `#confirmationDialog` is live this
1491
- // frame. The delete dialog REPLACES the list in this slot rather than being
1492
- // appended below the picker chrome, so the picker is always
1593
+ /** Open rename dialog: an OverlayPanel hosting the rename TextFormField. */
1594
+ #renameDialog: OverlayPanel | null = null;
1595
+ /** The rename dialog's input; keystrokes route here while the dialog is open. */
1596
+ #renameField: TextFormField | null = null;
1597
+ // Hosts whichever of `#sessionList` / `#confirmationDialog` / `#renameDialog`
1598
+ // is live this frame. The delete dialog REPLACES the list in this slot rather
1599
+ // than being appended below the picker chrome, so the picker is always
1493
1600
  // `chrome + max(list, dialog) + chrome` and never overflows the viewport
1494
1601
  // (issue #3283: an overflowing dialog frame committed the header into
1495
1602
  // scrollback, stranding it above the viewport once the dialog closed).
1496
1603
  #contentSlot: Container;
1497
1604
  #messageContainer: Container;
1498
1605
  #onDelete?: (session: T) => Promise<boolean>;
1606
+ #onRename?: (session: T, title: string) => Promise<string | null>;
1607
+ #onSetPinned?: (session: T, pinned: boolean) => Promise<void>;
1499
1608
  #onRequestRender?: () => void;
1500
- readonly #loadAllSessions?: () => Promise<T[]>;
1609
+ readonly #loadAllSessions?: () => Promise<T[] | { sessions: T[] }>;
1501
1610
  #folderSessions: T[];
1502
1611
  readonly #folderShowCwd: boolean;
1503
1612
  #globalSessions: T[] | null = null;
@@ -1577,6 +1686,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1577
1686
  message: SessionPickerMessage | undefined;
1578
1687
  errorOpen: boolean;
1579
1688
  choice: DeleteChoice<T> | null;
1689
+ rename: OverlayPanel | null;
1580
1690
  node: NativeNode;
1581
1691
  }
1582
1692
  | undefined;
@@ -1585,7 +1695,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1585
1695
  title: string;
1586
1696
  scope: "folder" | "all";
1587
1697
  message: SessionPickerMessage | undefined;
1588
- dialog: HookSelectorComponent | null;
1698
+ dialog: HookSelectorComponent | OverlayPanel | null;
1589
1699
  list: NativeNode;
1590
1700
  node: NativeNode;
1591
1701
  }
@@ -1602,18 +1712,34 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1602
1712
 
1603
1713
  this.#messageContainer = new Container();
1604
1714
  this.#onDelete = options.onDelete;
1715
+ this.#onRename = options.onRename;
1716
+ this.#onSetPinned = options.onSetPinned;
1605
1717
  this.#loadAllSessions = options.loadAllSessions;
1606
1718
  this.#folderSessions = sessions;
1607
1719
  // Storage directory, not recorded cwd: one folder's sessions may record
1608
1720
  // symlink aliases of the same path, which must not turn the column on.
1609
1721
  this.#folderShowCwd = options.showCwd ?? new Set(sessions.map(session => path.dirname(session.path))).size > 1;
1610
- this.#globalSessions = options.allSessions ?? null;
1722
+ this.#globalSessions = Array.isArray(options.allSessions)
1723
+ ? options.allSessions
1724
+ : (options.allSessions?.sessions ?? null);
1611
1725
  this.#getTerminalRows = options.getTerminalRows ?? (() => 24);
1612
1726
  this.#fillHeight = options.fillHeight ?? false;
1613
1727
  this.#title = options.title ?? tuiText("ssTitleResume", "Resume Session");
1614
1728
  this.#actionLabel = options.actionLabel ?? "Resume";
1615
1729
  this.#pickerTitle = options.title;
1616
1730
  this.#standalone = options.standalone ?? false;
1731
+ if (options.completeSessions) {
1732
+ void options.completeSessions.then(rows => {
1733
+ const next = rows.filter(row => !this.#resumeHidden.has(row.path));
1734
+ const selected = this.#sessionList.selectedSession?.path;
1735
+ this.#folderSessions = next;
1736
+ if (this.#scope === "folder") {
1737
+ this.#sessionList.setSessions(next, this.#folderShowCwd);
1738
+ if (selected) this.#sessionList.selectSession(selected);
1739
+ }
1740
+ this.#onRequestRender?.();
1741
+ });
1742
+ }
1617
1743
  this.#resumeSource = options.resumeSource;
1618
1744
  this.#resumeScope = options.resumeSource?.initialScope ?? "workspace";
1619
1745
  this.#deleteMode = options.deleteMode ?? options.resumeSource?.deleteMode ?? "permanent";
@@ -1657,6 +1783,16 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1657
1783
  this.#showDeleteConfirmation(session);
1658
1784
  };
1659
1785
  }
1786
+ if (this.#onRename) {
1787
+ this.#sessionList.onRenameRequest = (session: T) => {
1788
+ this.#showRenameDialog(session);
1789
+ };
1790
+ }
1791
+ if (this.#onSetPinned) {
1792
+ this.#sessionList.onPinRequest = (session: T, pinned: boolean) => {
1793
+ void this.#setPinned(session, pinned);
1794
+ };
1795
+ }
1660
1796
  if (this.#loadAllSessions || this.#globalSessions) {
1661
1797
  this.#sessionList.onToggleScope = () => {
1662
1798
  void this.#toggleScope();
@@ -1723,7 +1859,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1723
1859
  * never pays for the cross-project scan.
1724
1860
  */
1725
1861
  async #toggleScope(): Promise<void> {
1726
- if (this.#toggling || this.#confirmationDialog) return;
1862
+ if (this.#toggling || this.#confirmationDialog || this.#renameDialog) return;
1727
1863
  if (this.#scope === "folder") {
1728
1864
  let global = this.#globalSessions;
1729
1865
  if (!global) {
@@ -1735,7 +1871,8 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1735
1871
  this.#message = { kind: "loading", text: loading };
1736
1872
  this.#onRequestRender?.();
1737
1873
  try {
1738
- global = await this.#loadAllSessions();
1874
+ const loaded = await this.#loadAllSessions();
1875
+ global = Array.isArray(loaded) ? loaded : loaded.sessions;
1739
1876
  } catch (err) {
1740
1877
  this.#showError(err instanceof Error ? err.message : String(err));
1741
1878
  this.#toggling = false;
@@ -1865,6 +2002,107 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1865
2002
  this.#onRequestRender?.();
1866
2003
  }
1867
2004
 
2005
+ /**
2006
+ * Mirror a renamed title into the scope caches. The visible list holds
2007
+ * one entry per session, but the folder and all-projects caches can hold
2008
+ * their own copies of the same session, so a rename has to reach all of
2009
+ * them or a scope switch shows the old title again.
2010
+ */
2011
+ #syncScopeTitles(sessionPath: string, title: string): void {
2012
+ for (const cache of [this.#folderSessions, this.#globalSessions]) {
2013
+ if (!cache) continue;
2014
+ const entry = cache.find(s => s.path === sessionPath);
2015
+ if (!entry) continue;
2016
+ entry.title = title;
2017
+ delete (entry as NativeSessionInfo)[kNativeItem];
2018
+ delete (entry as SearchableSessionInfo)[kSearchTextLower];
2019
+ }
2020
+ }
2021
+
2022
+ /** Close the rename dialog without changes, restoring the session list. */
2023
+ #closeRenameDialog(): void {
2024
+ if (!this.#renameDialog) return;
2025
+ this.#renameDialog = null;
2026
+ this.#renameField = null;
2027
+ // Restore the SessionList into the content slot so the picker is back
2028
+ // to its normal layout on the very next render — the same frame the
2029
+ // dialog disappears.
2030
+ this.#contentSlot.clear();
2031
+ this.#contentSlot.addChild(this.#sessionList);
2032
+ this.#onRequestRender?.();
2033
+ }
2034
+
2035
+ #showRenameDialog(session: T): void {
2036
+ if (!this.#onRename || this.#confirmationDialog || this.#renameDialog || this.#toggling) return;
2037
+ // One submit at a time: a second Enter while the rename is still
2038
+ // awaiting disk I/O would queue a second write for the same session.
2039
+ let pending = false;
2040
+ // This editor's own identity: a submit that settles after the user
2041
+ // opened another editor must not close it.
2042
+ const owner = new OverlayPanel("Rename Session");
2043
+ const submit = async (value: string) => {
2044
+ if (pending) return;
2045
+ const title = value.trim();
2046
+ // Empty treated as cancel: Esc and a blank submit both leave the title.
2047
+ if (title.length === 0) {
2048
+ this.#closeRenameDialog();
2049
+ return;
2050
+ }
2051
+ const rename = this.#onRename;
2052
+ if (!rename) {
2053
+ this.#closeRenameDialog();
2054
+ return;
2055
+ }
2056
+ this.#clearError();
2057
+ pending = true;
2058
+ try {
2059
+ const stored = await rename(session, title);
2060
+ if (stored) {
2061
+ // The stored title is the canonical one (the session may
2062
+ // collapse whitespace), so the row and the search index
2063
+ // match what is on disk.
2064
+ this.#sessionList.renameSessionTitle(session.path, stored);
2065
+ this.#syncScopeTitles(session.path, stored);
2066
+ if (this.#preview?.session === session) this.#preview = undefined;
2067
+ } else {
2068
+ this.#showError("Failed to rename session.");
2069
+ }
2070
+ } catch (err) {
2071
+ this.#showError(err instanceof Error ? err.message : String(err));
2072
+ } finally {
2073
+ pending = false;
2074
+ }
2075
+ if (this.#renameDialog === owner) this.#closeRenameDialog();
2076
+ };
2077
+ const field = new TextFormField({
2078
+ theme: formTheme,
2079
+ label: "Rename session",
2080
+ initialValue: session.title ?? "",
2081
+ empty: "cancel",
2082
+ onSubmit: value => {
2083
+ void submit(value);
2084
+ },
2085
+ onCancel: () => {
2086
+ // A cancel while the rename is still in flight must not tear
2087
+ // the editor down underneath it; the submit closes it.
2088
+ if (pending) return;
2089
+ this.#closeRenameDialog();
2090
+ },
2091
+ });
2092
+ field.focused = true;
2093
+ owner.addChild(field);
2094
+ this.#renameDialog = owner;
2095
+ this.#renameField = field;
2096
+ // Swap the SessionList out of the content slot and mount the dialog in its
2097
+ // place: the dialog competes only with the SessionList's rendered budget,
2098
+ // never the SessionList AND the picker chrome, so the picker frame stays
2099
+ // inside the terminal viewport and the TUI never commits the header into
2100
+ // scrollback (issue #3283).
2101
+ this.#contentSlot.clear();
2102
+ this.#contentSlot.addChild(owner);
2103
+ this.#onRequestRender?.();
2104
+ }
2105
+
1868
2106
  /**
1869
2107
  * Render the panel directly so fill-height mode can keep its footer pinned
1870
2108
  * while sharing OverlayPanel's exact rounded-box chrome. Children receive
@@ -1889,9 +2127,34 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1889
2127
  return lines;
1890
2128
  }
1891
2129
 
2130
+ /** Persist a pin change, then reorder the list; a failure shows the error and leaves the list as it was. */
2131
+ async #setPinned(session: T, pinned: boolean): Promise<void> {
2132
+ if (!this.#onSetPinned) return;
2133
+ this.#clearError();
2134
+ try {
2135
+ await this.#onSetPinned(session, pinned);
2136
+ this.#sessionList.setPinned(session.id, pinned);
2137
+ } catch (err) {
2138
+ this.#showError(err instanceof Error ? err.message : String(err));
2139
+ }
2140
+ this.#onRequestRender?.();
2141
+ }
2142
+
2143
+ /** The pin action that applies to the selected session: unpin when it is pinned, else pin. */
2144
+ #pinAction(): { binding: "app.session.pin" | "app.session.unpin"; label: string } | undefined {
2145
+ if (!this.#onSetPinned) return undefined;
2146
+ return this.#sessionList.selectedPinned
2147
+ ? { binding: "app.session.unpin", label: "unpin" }
2148
+ : { binding: "app.session.pin", label: "pin" };
2149
+ }
2150
+
1892
2151
  /** Blank · keybinding hint · bottom border. Rendered by {@link render}. */
1893
2152
  #footerLines(width: number): string[] {
1894
2153
  const cancel = interruptKey();
2154
+ const scopeHint = this.#scope === "all" ? "current folder" : "all projects";
2155
+ // Keys mirror SessionList#handleInput; cancel is `app.interrupt` (raw Escape when unbound).
2156
+ const pin = this.#pinAction();
2157
+ const pinKey = pin && getKeybindings().getKeys(pin.binding)[0];
1895
2158
  const hint = this.#resumeTree
1896
2159
  ? composeFooter(
1897
2160
  width,
@@ -1918,7 +2181,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1918
2181
  )
1919
2182
  : theme.fg(
1920
2183
  "muted",
1921
- `[${this.#onDelete ? `${formatKeyHints(["delete", "backspace"])} delete · ` : ""}${formatKeyHint("enter")} select · ${formatKeyHint("tab")} ${this.#scope === "all" ? tuiText("resumeScopeWorkspace", "this workspace") : tuiText("resumeScopeAll", "all projects")} · ${cancel} cancel]`,
2184
+ `[${this.#onDelete ? `${formatKeyHints(["delete", "backspace"])} delete · ` : ""}${this.#onRename ? `${formatKeyHint("f2")} rename · ` : ""}${pinKey ? `${formatKeyHint(pinKey)} ${pin.label} · ` : ""}${formatKeyHint("enter")} select · ${formatKeyHint("tab")} ${scopeHint} · ${cancel} cancel]`,
1922
2185
  );
1923
2186
  return [row("", width), row(hint, width), row("", width), bottomBorder(width)];
1924
2187
  }
@@ -1930,31 +2193,41 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1930
2193
 
1931
2194
  /** Over the transcript the picker is its own sheet (`layer`); the standalone app fills the screen surface. */
1932
2195
  nativeSheet(cx: DescribeContext): boolean {
2196
+ // A rename editor is a card with a text field, not a picker sheet: it
2197
+ // renders in place, like the generic composition does.
2198
+ if (this.#renameDialog) return false;
1933
2199
  return cx.supports("picker") && !this.#standalone;
1934
2200
  }
1935
2201
 
1936
2202
  /**
1937
2203
  * With the `picker` kind: the data-first session picker (§4.7). Otherwise
1938
2204
  * scope `tabs`, loading/error message, then the search `input` and session
1939
- * `list` — or the delete-confirmation dialog in their place, as on the ANSI
1940
- * path — and the key-hint footer.
2205
+ * `list` — or the delete-confirmation / rename dialog in their place, as on
2206
+ * the ANSI path — and the key-hint footer.
1941
2207
  */
1942
2208
  override describe(cx: DescribeContext): NativeNode {
1943
- if (cx.supports("picker")) {
2209
+ // The picker kind has no text-input affordance, so a rename would
2210
+ // capture every keystroke into an invisible field. While the rename
2211
+ // editor is open, describe the card path instead (the same fallback
2212
+ // the hook selector uses for its slider and countdown).
2213
+ if (cx.supports("picker") && !this.#renameDialog) {
1944
2214
  // The native picker owns its own event model; raw keys must keep going
1945
2215
  // to the list even though the ANSI tree is constructed.
1946
2216
  this.#nativePicker = true;
1947
2217
  return this.#describePicker();
1948
2218
  }
1949
2219
  this.#nativePicker = false;
1950
- this.#mountResumeTree();
2220
+ // The rename card is an in-place fallback on picker terminals; only a
2221
+ // terminal without the kind swaps the flat list for the ANSI tree.
2222
+ if (!cx.supports("picker")) this.#mountResumeTree();
1951
2223
  const list = this.#sessionList.describeList();
2224
+ const dialog = this.#confirmationDialog ?? this.#renameDialog;
1952
2225
  const memo = this.#nativeMemo;
1953
2226
  if (
1954
2227
  memo?.title === this.title &&
1955
2228
  memo.scope === this.#scope &&
1956
2229
  memo.message === this.#message &&
1957
- memo.dialog === this.#confirmationDialog &&
2230
+ memo.dialog === dialog &&
1958
2231
  memo.list === list
1959
2232
  ) {
1960
2233
  return memo.node;
@@ -1968,13 +2241,16 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1968
2241
  } else if (message) {
1969
2242
  children.push(node("text", { spans: [span(message.text, "error")] }, undefined, "message"));
1970
2243
  }
1971
- if (this.#confirmationDialog) {
1972
- children.push(this.#confirmationDialog);
2244
+ if (dialog) {
2245
+ children.push(dialog);
1973
2246
  } else {
1974
2247
  children.push(this.#sessionList.searchInput, list);
1975
2248
  }
1976
2249
  const hints: (NativeHint | undefined)[] = [];
1977
2250
  if (this.#onDelete) hints.push({ keys: ["delete", "backspace"], label: "delete" });
2251
+ if (this.#onRename) hints.push({ keys: ["f2"], label: "rename" });
2252
+ const pin = this.#pinAction();
2253
+ if (pin) hints.push(actionHint(pin.binding, pin.label));
1978
2254
  hints.push({ keys: ["enter"], label: "select" });
1979
2255
  if (this.#sessionList.onToggleScope) {
1980
2256
  hints.push({ keys: ["tab"], label: this.#scope === "all" ? "current folder" : "all projects" });
@@ -1988,7 +2264,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1988
2264
  title: this.title,
1989
2265
  scope: this.#scope,
1990
2266
  message,
1991
- dialog: this.#confirmationDialog,
2267
+ dialog,
1992
2268
  list,
1993
2269
  node: result,
1994
2270
  };
@@ -2276,8 +2552,9 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
2276
2552
  * `lg` cards sheet (`screen` for the standalone app): sessions grouped by
2277
2553
  * day (ranked flat while searching), the selected session's preview, the
2278
2554
  * delete confirm strip, and the actions of the keys Enter, Delete/Backspace,
2279
- * Tab (the scope toggle, labelled with the scope it switches to) and Esc.
2280
- * Untitled unless the caller named it; the placeholder says the scope.
2555
+ * F2 (rename), the pin keys (Pin / Unpin, whichever applies to the selected
2556
+ * session), Tab (the scope toggle, labelled with the scope it switches
2557
+ * to) and Esc. Untitled unless the caller named it; the placeholder says the scope.
2281
2558
  */
2282
2559
  #describePicker(): NativeNode {
2283
2560
  if (this.#resumeSource) return this.#describeResumePicker();
@@ -2287,6 +2564,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
2287
2564
  const message = this.#message;
2288
2565
  const errorOpen = this.#pickerErrorOpen && message?.kind === "error";
2289
2566
  const choice = this.#deleteChoice;
2567
+ const rename = this.#renameDialog;
2290
2568
  const memo = this.#pickerMemo;
2291
2569
  if (
2292
2570
  memo?.view === view &&
@@ -2294,7 +2572,8 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
2294
2572
  memo.scope === this.#scope &&
2295
2573
  memo.message === message &&
2296
2574
  memo.errorOpen === errorOpen &&
2297
- memo.choice === choice
2575
+ memo.choice === choice &&
2576
+ memo.rename === rename
2298
2577
  ) {
2299
2578
  return memo.node;
2300
2579
  }
@@ -2302,6 +2581,9 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
2302
2581
  const toggle = list.onToggleScope !== undefined;
2303
2582
  const actions = [pickerAction("resume", this.#actionLabel, "enter", { primary: true })];
2304
2583
  if (this.#onDelete) actions.push(pickerAction("delete", "Delete", "backspace"));
2584
+ if (this.#onRename) actions.push(pickerAction("rename", "Rename", "f2"));
2585
+ const pin = this.#pinAction();
2586
+ if (pin) actions.push(pickerAction("pin", pin.label === "pin" ? "Pin" : "Unpin", bindingKeys(pin.binding)));
2305
2587
  if (toggle) {
2306
2588
  actions.push(pickerAction("scope", this.#scope === "all" ? "This folder" : "All projects", "tab"));
2307
2589
  }
@@ -2352,7 +2634,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
2352
2634
  },
2353
2635
  preview,
2354
2636
  );
2355
- this.#pickerMemo = { view, preview, scope: this.#scope, message, errorOpen, choice, node: result };
2637
+ this.#pickerMemo = { view, preview, scope: this.#scope, message, errorOpen, choice, rename, node: result };
2356
2638
  return result;
2357
2639
  }
2358
2640
 
@@ -2390,31 +2672,37 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
2390
2672
 
2391
2673
  /**
2392
2674
  * Picker pointer events run the keys' paths: a row click selects (arrows),
2393
- * a second click or `Resume` resumes (Enter), `Delete` asks (Delete), the
2394
- * tab or `All projects` toggles scope (Tab), `Close` cancels (Esc), and
2395
- * the confirm strip answers the delete dialog (Yes / Esc).
2675
+ * a second click or `Resume` resumes (Enter), `Delete` asks (Delete),
2676
+ * `Rename` renames (F2), `Pin` / `Unpin` flips the pin, the tab or `All projects` toggles scope (Tab),
2677
+ * `Close` cancels (Esc), and the confirm strip answers the delete dialog (Yes / Esc).
2396
2678
  */
2397
2679
  #handlePickerEvent(ev: PickerEvent): void {
2398
2680
  const list = this.#sessionList;
2399
2681
  const choice = this.#deleteChoice;
2400
2682
  if (ev.kind !== "action") {
2401
- if (choice) return;
2683
+ if (choice || this.#renameDialog) return;
2402
2684
  if (ev.kind === "select") list.selectSession(ev.item);
2403
2685
  else list.confirmSession(ev.item);
2404
2686
  return;
2405
2687
  }
2406
2688
  if (ev.act === "delete-confirm") choice?.confirm();
2407
- else if (ev.act === "cancel") choice?.cancel();
2408
- else if (ev.act === "tab") {
2689
+ else if (ev.act === "cancel") {
2690
+ if (choice) choice.cancel();
2691
+ else this.#closeRenameDialog();
2692
+ } else if (ev.act === "tab") {
2409
2693
  if (this.#resumeSource && ev.value) this.#setResumeScope(ev.value as ResumeScopeKindLike);
2410
2694
  } else if (ev.act === "close") {
2411
2695
  if (choice) choice.cancel();
2696
+ else if (this.#renameDialog) this.#closeRenameDialog();
2412
2697
  else list.onCancel?.();
2413
- } else if (choice) return;
2698
+ } else if (choice || this.#renameDialog) return;
2414
2699
  else if (ev.act === "resume") list.resumeSelected();
2415
2700
  else if (ev.act === "delete") list.requestDelete();
2416
- else if (ev.act === "pin") this.#toggleResumePin();
2417
- else if (ev.act === "refresh") this.#refreshResume();
2701
+ else if (ev.act === "rename") list.requestRename();
2702
+ else if (ev.act === "pin") {
2703
+ if (this.#resumeSource) this.#toggleResumePin();
2704
+ else list.requestPin();
2705
+ } else if (ev.act === "refresh") this.#refreshResume();
2418
2706
  else if (ev.act === "scope") {
2419
2707
  list.onToggleScope?.();
2420
2708
  } else if (ev.act === "clear") list.clearSearch();
@@ -2434,7 +2722,8 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
2434
2722
  if (event.type === "select" && event.item !== this.#scope) void this.#toggleScope();
2435
2723
  return;
2436
2724
  }
2437
- if (event.key === "list" && !this.#confirmationDialog) this.#sessionList.confirmSession(event.item);
2725
+ if (event.key === "list" && !this.#confirmationDialog && !this.#renameDialog)
2726
+ this.#sessionList.confirmSession(event.item);
2438
2727
  }
2439
2728
 
2440
2729
  handleInput(keyData: string): void {
@@ -2446,6 +2735,8 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
2446
2735
  }
2447
2736
  if (this.#confirmationDialog) {
2448
2737
  this.#confirmationDialog.handleInput(keyData);
2738
+ } else if (this.#renameDialog) {
2739
+ this.#renameField?.handleInput(keyData);
2449
2740
  } else if (this.#resumeTree && !this.#nativePicker) {
2450
2741
  this.#resumeTree.handleInput(keyData);
2451
2742
  } else {
@@ -2460,7 +2751,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
2460
2751
  * pointer. Mouse is inert while the delete-confirmation dialog is open.
2461
2752
  */
2462
2753
  #handleMouse(data: string): void {
2463
- if (this.#confirmationDialog) return;
2754
+ if (this.#confirmationDialog || this.#renameDialog) return;
2464
2755
  if (this.#resumeTree) {
2465
2756
  // The panel paints the tree inside `│ ` … ` │`; rows start at
2466
2757
  // #listLineOffset and the first content column is 2.