@oh-my-pi/pi-tui 18.13.2 → 18.14.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 (245) hide show
  1. package/CHANGELOG.md +40 -54
  2. package/README.md +34 -34
  3. package/dist/types/app-keybindings.d.ts +15 -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/chat/assistant-message.d.ts +15 -3
  7. package/dist/types/chat/bash-execution.d.ts +2 -0
  8. package/dist/types/chat/display-preferences.d.ts +2 -0
  9. package/dist/types/chat/extension-types.d.ts +31 -0
  10. package/dist/types/chat/reply-write.d.ts +48 -0
  11. package/dist/types/chat/table-chart.d.ts +4 -3
  12. package/dist/types/chat/tool-execution.d.ts +1 -2
  13. package/dist/types/chat/transcript-outline.d.ts +7 -0
  14. package/dist/types/chat/transcript-render-helpers.d.ts +2 -0
  15. package/dist/types/chrome/index.d.ts +1 -0
  16. package/dist/types/chrome/transcript-notice.d.ts +35 -0
  17. package/dist/types/chrome/transcript-status.d.ts +20 -8
  18. package/dist/types/components/editor.d.ts +8 -0
  19. package/dist/types/components/markdown.d.ts +7 -0
  20. package/dist/types/native/blobs.d.ts +2 -1
  21. package/dist/types/native/picker.d.ts +3 -3
  22. package/dist/types/overlays/annotation-overlay.d.ts +7 -1
  23. package/dist/types/overlays/annotation-types.d.ts +28 -0
  24. package/dist/types/overlays/login-dialog.d.ts +5 -1
  25. package/dist/types/overlays/model-browser.d.ts +10 -1
  26. package/dist/types/overlays/oauth-selector.d.ts +23 -0
  27. package/dist/types/overlays/plan-review-overlay.d.ts +2 -0
  28. package/dist/types/overlays/rewind-selector.d.ts +1 -1
  29. package/dist/types/overlays/session-selector.d.ts +22 -2
  30. package/dist/types/prompt/composer.d.ts +41 -4
  31. package/dist/types/prompt/interactive-context-helpers.d.ts +10 -3
  32. package/dist/types/prompt/welcome.d.ts +6 -2
  33. package/dist/types/render/extension-links.d.ts +65 -0
  34. package/dist/types/render/hyperlink.d.ts +25 -7
  35. package/dist/types/render/index.d.ts +1 -0
  36. package/dist/types/setup/scenes/model.d.ts +1 -1
  37. package/dist/types/setup/scenes/outro.d.ts +5 -4
  38. package/dist/types/setup/scenes/sign-in.d.ts +13 -8
  39. package/dist/types/setup/scenes/splash.d.ts +4 -4
  40. package/dist/types/setup/scenes/types.d.ts +16 -1
  41. package/dist/types/setup/startup-splash.d.ts +1 -1
  42. package/dist/types/setup/wizard-overlay.d.ts +11 -7
  43. package/dist/types/setup/wizard.d.ts +5 -1
  44. package/dist/types/status-line/component.d.ts +1 -1
  45. package/dist/types/status-line/context-usage.d.ts +28 -6
  46. package/dist/types/status-line/host.d.ts +6 -2
  47. package/dist/types/theme/theme.d.ts +0 -23
  48. package/dist/types/tools/bash-interactive.d.ts +6 -0
  49. package/dist/types/tools/bash.d.ts +2 -0
  50. package/dist/types/tools/default-renderer.d.ts +6 -4
  51. package/dist/types/tools/irc.d.ts +6 -0
  52. package/dist/types/tools/json-tree.d.ts +23 -4
  53. package/dist/types/tools/lsp.d.ts +2 -0
  54. package/dist/types/tools/mcp.d.ts +6 -5
  55. package/dist/types/tools/native-view.d.ts +1 -1
  56. package/dist/types/tools/renderer.d.ts +2 -0
  57. package/dist/types/tools/streaming-output.d.ts +11 -0
  58. package/dist/types/tools/task.d.ts +9 -1
  59. package/dist/types/tools/url-scheme-host.d.ts +17 -0
  60. package/dist/types/tools/yield.d.ts +1 -1
  61. package/dist/types/tui.d.ts +7 -2
  62. package/package.json +10 -15
  63. package/src/app-keybindings.ts +15 -0
  64. package/src/apps/session-picker.ts +7 -0
  65. package/src/charts/chart-plan.ts +20 -50
  66. package/src/chat/advisor-message.ts +2 -0
  67. package/src/chat/assistant-message.ts +137 -19
  68. package/src/chat/background-tan-message.ts +4 -0
  69. package/src/chat/bash-execution.ts +6 -0
  70. package/src/chat/chat-transcript-builder.ts +58 -28
  71. package/src/chat/compaction-summary-message.ts +2 -1
  72. package/src/chat/display-preferences.ts +3 -0
  73. package/src/chat/extension-types.ts +34 -0
  74. package/src/chat/reply-write.ts +127 -0
  75. package/src/chat/table-chart.ts +10 -4
  76. package/src/chat/tool-execution.ts +20 -13
  77. package/src/chat/transcript-outline.ts +27 -0
  78. package/src/chat/transcript-render-helpers.ts +66 -24
  79. package/src/chrome/index.ts +1 -0
  80. package/src/chrome/transcript-notice.ts +83 -0
  81. package/src/chrome/transcript-status.ts +29 -29
  82. package/src/components/editor.ts +10 -1
  83. package/src/components/markdown.ts +116 -6
  84. package/src/hotkeys-markdown.ts +1 -0
  85. package/src/native/backend.ts +5 -66
  86. package/src/native/blobs.ts +3 -2
  87. package/src/native/picker.ts +3 -3
  88. package/src/overlays/advisor-config.ts +1 -10
  89. package/src/overlays/annotation-overlay.ts +125 -37
  90. package/src/overlays/annotation-types.ts +24 -0
  91. package/src/overlays/hook-selector.ts +2 -2
  92. package/src/overlays/login-dialog.ts +31 -5
  93. package/src/overlays/model-browser.ts +37 -0
  94. package/src/overlays/model-hub.ts +1 -7
  95. package/src/overlays/model-picker.ts +1 -10
  96. package/src/overlays/oauth-selector.ts +44 -6
  97. package/src/overlays/plan-review-overlay.ts +13 -2
  98. package/src/overlays/rewind-selector.ts +29 -12
  99. package/src/overlays/session-selector.ts +305 -39
  100. package/src/overlays/usage-dashboard.ts +5 -12
  101. package/src/prompt/composer.ts +213 -5
  102. package/src/prompt/custom-editor.ts +6 -1
  103. package/src/prompt/emoji-autocomplete.ts +0 -2
  104. package/src/prompt/interactive-context-helpers.ts +29 -4
  105. package/src/prompt/welcome.ts +31 -45
  106. package/src/render/extension-links.ts +214 -0
  107. package/src/render/hyperlink.ts +65 -9
  108. package/src/render/index.ts +1 -0
  109. package/src/setup/scenes/composer.ts +2 -0
  110. package/src/setup/scenes/glyph.ts +2 -0
  111. package/src/setup/scenes/model.ts +192 -29
  112. package/src/setup/scenes/outro.ts +30 -17
  113. package/src/setup/scenes/sign-in.ts +196 -400
  114. package/src/setup/scenes/splash.ts +25 -21
  115. package/src/setup/scenes/theme.ts +2 -0
  116. package/src/setup/scenes/types.ts +18 -1
  117. package/src/setup/startup-splash.ts +8 -7
  118. package/src/setup/wizard-overlay.ts +164 -33
  119. package/src/setup/wizard.ts +11 -2
  120. package/src/status-line/component.ts +4 -10
  121. package/src/status-line/context-usage.ts +72 -21
  122. package/src/status-line/host.ts +6 -2
  123. package/src/terminal.ts +24 -2
  124. package/src/theme/defaults.json +1 -0
  125. package/src/theme/loader.ts +1 -1
  126. package/src/theme/theme.ts +2 -75
  127. package/src/tools/bash-interactive.ts +6 -1
  128. package/src/tools/bash.ts +2 -0
  129. package/src/tools/default-renderer.ts +9 -6
  130. package/src/tools/eval.ts +14 -4
  131. package/src/tools/irc.ts +6 -0
  132. package/src/tools/job-widget.ts +13 -1
  133. package/src/tools/json-tree.ts +132 -42
  134. package/src/tools/lsp.ts +36 -15
  135. package/src/tools/mcp.ts +20 -12
  136. package/src/tools/native-view.ts +1 -1
  137. package/src/tools/renderer.ts +2 -0
  138. package/src/tools/streaming-output.ts +41 -0
  139. package/src/tools/task.ts +59 -17
  140. package/src/tools/url-scheme-host.ts +21 -0
  141. package/src/tools/yield.ts +18 -9
  142. package/src/tui.ts +43 -15
  143. package/THIRD-PARTY-NOTICES.txt +0 -22901
  144. package/dist/types/theme/defaults/index.d.ts +0 -10289
  145. package/src/theme/defaults/alabaster.json +0 -103
  146. package/src/theme/defaults/amethyst.json +0 -106
  147. package/src/theme/defaults/anthracite.json +0 -103
  148. package/src/theme/defaults/basalt.json +0 -101
  149. package/src/theme/defaults/birch.json +0 -105
  150. package/src/theme/defaults/dark-abyss.json +0 -101
  151. package/src/theme/defaults/dark-arctic.json +0 -114
  152. package/src/theme/defaults/dark-aurora.json +0 -105
  153. package/src/theme/defaults/dark-catppuccin.json +0 -117
  154. package/src/theme/defaults/dark-cavern.json +0 -101
  155. package/src/theme/defaults/dark-celestial.json +0 -116
  156. package/src/theme/defaults/dark-copper.json +0 -105
  157. package/src/theme/defaults/dark-cosmos.json +0 -100
  158. package/src/theme/defaults/dark-cyberpunk.json +0 -112
  159. package/src/theme/defaults/dark-dracula.json +0 -108
  160. package/src/theme/defaults/dark-eclipse.json +0 -101
  161. package/src/theme/defaults/dark-ember.json +0 -105
  162. package/src/theme/defaults/dark-equinox.json +0 -100
  163. package/src/theme/defaults/dark-forest.json +0 -106
  164. package/src/theme/defaults/dark-github.json +0 -115
  165. package/src/theme/defaults/dark-gruvbox.json +0 -122
  166. package/src/theme/defaults/dark-lavender.json +0 -105
  167. package/src/theme/defaults/dark-lunar.json +0 -99
  168. package/src/theme/defaults/dark-midnight.json +0 -105
  169. package/src/theme/defaults/dark-monochrome.json +0 -104
  170. package/src/theme/defaults/dark-monokai.json +0 -108
  171. package/src/theme/defaults/dark-nebula.json +0 -100
  172. package/src/theme/defaults/dark-neon-noir.json +0 -110
  173. package/src/theme/defaults/dark-nord.json +0 -108
  174. package/src/theme/defaults/dark-ocean.json +0 -111
  175. package/src/theme/defaults/dark-one.json +0 -110
  176. package/src/theme/defaults/dark-poimandres.json +0 -125
  177. package/src/theme/defaults/dark-rainforest.json +0 -101
  178. package/src/theme/defaults/dark-reef.json +0 -101
  179. package/src/theme/defaults/dark-retro.json +0 -102
  180. package/src/theme/defaults/dark-rose-pine.json +0 -106
  181. package/src/theme/defaults/dark-sakura.json +0 -105
  182. package/src/theme/defaults/dark-slate.json +0 -105
  183. package/src/theme/defaults/dark-solarized.json +0 -107
  184. package/src/theme/defaults/dark-solstice.json +0 -100
  185. package/src/theme/defaults/dark-starfall.json +0 -101
  186. package/src/theme/defaults/dark-sunset.json +0 -109
  187. package/src/theme/defaults/dark-swamp.json +0 -100
  188. package/src/theme/defaults/dark-synthwave.json +0 -113
  189. package/src/theme/defaults/dark-taiga.json +0 -101
  190. package/src/theme/defaults/dark-terminal.json +0 -105
  191. package/src/theme/defaults/dark-tokyo-night.json +0 -111
  192. package/src/theme/defaults/dark-tundra.json +0 -101
  193. package/src/theme/defaults/dark-twilight.json +0 -101
  194. package/src/theme/defaults/dark-volcanic.json +0 -101
  195. package/src/theme/defaults/graphite.json +0 -102
  196. package/src/theme/defaults/index.ts +0 -203
  197. package/src/theme/defaults/light-arctic.json +0 -117
  198. package/src/theme/defaults/light-aurora-day.json +0 -101
  199. package/src/theme/defaults/light-canyon.json +0 -101
  200. package/src/theme/defaults/light-catppuccin.json +0 -116
  201. package/src/theme/defaults/light-cirrus.json +0 -100
  202. package/src/theme/defaults/light-coral.json +0 -105
  203. package/src/theme/defaults/light-cyberpunk.json +0 -106
  204. package/src/theme/defaults/light-dawn.json +0 -100
  205. package/src/theme/defaults/light-dunes.json +0 -101
  206. package/src/theme/defaults/light-eucalyptus.json +0 -105
  207. package/src/theme/defaults/light-forest.json +0 -110
  208. package/src/theme/defaults/light-frost.json +0 -105
  209. package/src/theme/defaults/light-github.json +0 -125
  210. package/src/theme/defaults/light-glacier.json +0 -101
  211. package/src/theme/defaults/light-gruvbox.json +0 -118
  212. package/src/theme/defaults/light-haze.json +0 -100
  213. package/src/theme/defaults/light-honeycomb.json +0 -105
  214. package/src/theme/defaults/light-lagoon.json +0 -101
  215. package/src/theme/defaults/light-lavender.json +0 -105
  216. package/src/theme/defaults/light-meadow.json +0 -101
  217. package/src/theme/defaults/light-mint.json +0 -105
  218. package/src/theme/defaults/light-monochrome.json +0 -111
  219. package/src/theme/defaults/light-ocean.json +0 -109
  220. package/src/theme/defaults/light-one.json +0 -109
  221. package/src/theme/defaults/light-opal.json +0 -101
  222. package/src/theme/defaults/light-orchard.json +0 -101
  223. package/src/theme/defaults/light-paper.json +0 -105
  224. package/src/theme/defaults/light-poimandres.json +0 -125
  225. package/src/theme/defaults/light-prism.json +0 -100
  226. package/src/theme/defaults/light-retro.json +0 -108
  227. package/src/theme/defaults/light-sand.json +0 -105
  228. package/src/theme/defaults/light-savanna.json +0 -101
  229. package/src/theme/defaults/light-solarized.json +0 -112
  230. package/src/theme/defaults/light-soleil.json +0 -100
  231. package/src/theme/defaults/light-sunset.json +0 -109
  232. package/src/theme/defaults/light-synthwave.json +0 -108
  233. package/src/theme/defaults/light-tokyo-night.json +0 -121
  234. package/src/theme/defaults/light-wetland.json +0 -101
  235. package/src/theme/defaults/light-zenith.json +0 -99
  236. package/src/theme/defaults/limestone.json +0 -104
  237. package/src/theme/defaults/mahogany.json +0 -107
  238. package/src/theme/defaults/marble.json +0 -103
  239. package/src/theme/defaults/obsidian.json +0 -101
  240. package/src/theme/defaults/onyx.json +0 -101
  241. package/src/theme/defaults/pearl.json +0 -103
  242. package/src/theme/defaults/porcelain.json +0 -101
  243. package/src/theme/defaults/quartz.json +0 -106
  244. package/src/theme/defaults/sandstone.json +0 -105
  245. package/src/theme/defaults/titanium.json +0 -100
@@ -18,6 +18,7 @@ import { formatBytes, getProjectDir } from "@oh-my-pi/pi-utils";
18
18
  import type { TspPickerGroup, TspPickerItem, TspSpan, TspText, TspTone } from "@oh-my-pi/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,11 +28,12 @@ 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 { theme } from "../theme/theme";
33
34
  import { contentRowWidth } from "../chrome/selector-helpers";
34
35
  import { matchesAppInterrupt, matchesSelectDown, matchesSelectUp } from "../keybinding-matchers";
36
+ import { getKeybindings } from "../keybindings";
35
37
  /** Session lifecycle status presented by the picker. */
36
38
  export type SessionSelectorStatus = "complete" | "interrupted" | "aborted" | "error" | "pending" | "unknown";
37
39
 
@@ -51,8 +53,10 @@ export interface SessionSelectorEntry {
51
53
  parentSessionPath?: string;
52
54
  }
53
55
  import { shortenPath } from "../render/render-utils";
56
+ import { formTheme } from "../chrome/form-theme";
54
57
  import { HookSelectorComponent } from "./hook-selector";
55
58
  import { bottomBorder, OverlayPanel, row, topBorder } from "../chrome/overlay-box";
59
+ import { TextFormField } from "../components/form";
56
60
  import { MenuSelection, getMenuWindow } from "../components/menu-selection";
57
61
  import { formatKeyHint, formatKeyHints } from "../app-keybindings";
58
62
  import { boundKeys, interruptKey } from "../chrome/keybinding-hints";
@@ -518,6 +522,8 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
518
522
  readonly #getTerminalRows: () => number;
519
523
 
520
524
  onDeleteRequest?: (session: T) => void;
525
+ onRenameRequest?: (session: T) => void;
526
+ onPinRequest?: (session: T, pinned: boolean) => void;
521
527
 
522
528
  #allSessions: T[];
523
529
  #showCwd: boolean;
@@ -585,7 +591,7 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
585
591
  this.#getCurrentSessionPath =
586
592
  typeof currentSessionPath === "function" ? currentSessionPath : () => currentSessionPath;
587
593
  this.#historyMatcher = historyMatcher;
588
- this.#menu = new MenuSelection<T>(sessions, {
594
+ this.#menu = new MenuSelection<T>(this.#pinnedFirst(sessions), {
589
595
  getKey: session => session.path,
590
596
  getSearchText: sessionSearchText,
591
597
  });
@@ -661,8 +667,9 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
661
667
  this.#hadFilterQuery = tokens.length > 0;
662
668
  this.#lastFilterQuery = query;
663
669
  if (tokens.length === 0) {
664
- const keepIndex = Math.min(this.#menu.selectedIndex, Math.max(0, this.#allSessions.length - 1));
665
- this.#menu.setItems(this.#allSessions, keepIndex >= 0 ? this.#allSessions[keepIndex]?.path : undefined);
670
+ const items = this.#pinnedFirst(this.#allSessions);
671
+ const keepIndex = Math.min(this.#menu.selectedIndex, Math.max(0, items.length - 1));
672
+ this.#menu.setItems(items, keepIndex >= 0 ? items[keepIndex]?.path : undefined);
666
673
  if (hadQuery) this.#selectCurrentSession();
667
674
  this.#scheduleHistoryMerge(query);
668
675
  return;
@@ -736,8 +743,9 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
736
743
  }
737
744
 
738
745
  /**
739
- * Rebuild the menu's visible list with title matches first, then other
740
- * prompt-history hits, literal matches (recency), and fuzzy-only hits (score).
746
+ * Rebuild the menu's visible list with pinned sessions first, then title
747
+ * matches, other prompt-history hits, literal matches (recency), and
748
+ * fuzzy-only hits (score).
741
749
  */
742
750
  #composeFiltered(): void {
743
751
  this.#itemsVersion++;
@@ -745,17 +753,31 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
745
753
  const base: T[] = [];
746
754
  for (const match of this.#literalRanked) base.push(match.session);
747
755
  for (const match of this.#fuzzyRanked) base.push(match.session);
748
- const composed = prioritizeTitleMatches(
749
- this.#historyIds.length > 0 ? mergeSessionRanking(this.#allSessions, base, this.#historyIds) : base,
750
- tokenizeSessionQuery(this.#searchInput.getValue()),
751
- this.#literalRanked,
756
+ const composed = this.#pinnedFirst(
757
+ prioritizeTitleMatches(
758
+ this.#historyIds.length > 0 ? mergeSessionRanking(this.#allSessions, base, this.#historyIds) : base,
759
+ tokenizeSessionQuery(this.#searchInput.getValue()),
760
+ this.#literalRanked,
761
+ ),
752
762
  );
753
- // The fuzzy scan and the history merge only clamp the cursor so an arrow
754
- // selection survives recomposition; the query path resets explicitly.
763
+ // A late pinned or history match can land above the cursor: a moved
764
+ // selection follows its session, an untouched one keeps the top rank.
765
+ // The query path resets explicitly.
766
+ if (this.#selectionMoved) {
767
+ this.#menu.setItems(composed);
768
+ return;
769
+ }
755
770
  const keepIndex = Math.min(this.#menu.selectedIndex, Math.max(0, composed.length - 1));
756
771
  this.#menu.setItems(composed, keepIndex >= 0 ? composed[keepIndex]?.path : undefined);
757
772
  }
758
773
 
774
+ /** Stable partition: pinned sessions first, each group in its incoming order. */
775
+ #pinnedFirst(sessions: readonly T[]): readonly T[] {
776
+ const pins = this.#pinnedIds;
777
+ const pinned = pins.size > 0 ? sessions.filter(session => pins.has(session.id)) : [];
778
+ return pinned.length > 0 ? [...pinned, ...sessions.filter(session => !pins.has(session.id))] : sessions;
779
+ }
780
+
759
781
  /**
760
782
  * Augment ranked results with prompt-history matches without replacing them.
761
783
  * The session-list corpus only sees the first 4KB of each session, so a prompt
@@ -810,6 +832,22 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
810
832
  }
811
833
  }
812
834
 
835
+ /** Update a session's title in place and refresh the visible list, keeping the selection. */
836
+ renameSessionTitle(sessionPath: string, title: string): void {
837
+ const entry = this.#allSessions.find(s => s.path === sessionPath);
838
+ if (!entry) return;
839
+ this.#datasetVersion++;
840
+ entry.title = title;
841
+ // The cached native item embeds the old title, and the search haystack
842
+ // caches it too: drop both so the next describe rebuilds the row and
843
+ // the literal/fuzzy search paths match the new title. Selection is
844
+ // path-keyed, so the same-query refilter keeps the cursor on the
845
+ // renamed session.
846
+ delete (entry as NativeSessionInfo)[kNativeItem];
847
+ delete (entry as SearchableSessionInfo)[kSearchTextLower];
848
+ this.#filterSessions(this.#searchInput.getValue());
849
+ }
850
+
813
851
  /** Resolve a list-local rendered-line index to a filtered-session index. */
814
852
  hitTestSession(line: number): number | undefined {
815
853
  return this.#hitRows[line];
@@ -853,6 +891,43 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
853
891
  if (selected) this.onDeleteRequest?.(selected);
854
892
  }
855
893
 
894
+ /** F2: ask the parent to rename the selected session. */
895
+ requestRename(): void {
896
+ const selected = this.#menu.selectedItem;
897
+ if (selected) this.onRenameRequest?.(selected);
898
+ }
899
+
900
+ /** Pin keys: ask the parent to pin or unpin the selected session (default: flip it); no-op when already there. */
901
+ requestPin(pinned?: boolean): void {
902
+ const selected = this.#menu.selectedItem;
903
+ if (!selected) return;
904
+ const isPinned = this.#pinnedIds.has(selected.id);
905
+ if (pinned !== isPinned) this.onPinRequest?.(selected, !isPinned);
906
+ }
907
+
908
+ /** Apply a persisted pin change; the list re-partitions and the cursor follows the session. */
909
+ setPinned(sessionId: string, pinned: boolean): void {
910
+ const pinnedIds = new Set(this.#pinnedIds);
911
+ if (pinned) pinnedIds.add(sessionId);
912
+ else pinnedIds.delete(sessionId);
913
+ this.#pinnedIds = pinnedIds;
914
+ // Counts as moving the selection: it keeps the cursor on this session
915
+ // and a pending history merge from reordering under it.
916
+ this.#selectionMoved = true;
917
+ if (this.#hadFilterQuery) {
918
+ this.#composeFiltered();
919
+ } else {
920
+ this.#itemsVersion++;
921
+ this.#menu.setItems(this.#pinnedFirst(this.#allSessions));
922
+ }
923
+ }
924
+
925
+ /** Whether the selected session is pinned (picks the pin action's direction). */
926
+ get selectedPinned(): boolean {
927
+ const selected = this.#menu.selectedItem;
928
+ return selected !== undefined && this.#pinnedIds.has(selected.id);
929
+ }
930
+
856
931
  /** Empty the search query (the empty state's "Clear search"). */
857
932
  clearSearch(): void {
858
933
  this.#searchInput.setValue("");
@@ -902,7 +977,7 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
902
977
  if (tokens.length === 0) {
903
978
  const now = new Date();
904
979
  const startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
905
- // Pins lead the listing (`sortPinnedFirst`), so they get their own group ahead of the days.
980
+ // Pins lead the listing (`#pinnedFirst`), so they get their own group ahead of the days.
906
981
  const groups = visible.map(session =>
907
982
  this.#pinnedIds.has(session.id) ? PINNED_GROUP : sessionDayGroup(session.modified, startOfToday),
908
983
  );
@@ -1277,6 +1352,21 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
1277
1352
  this.requestDelete();
1278
1353
  return;
1279
1354
  }
1355
+ // F2 renames the selected session; as a non-printable key it never
1356
+ // collides with the search input.
1357
+ if (matchesKey(keyData, "f2")) {
1358
+ this.requestRename();
1359
+ return;
1360
+ }
1361
+ const keybindings = getKeybindings();
1362
+ if (keybindings.matches(keyData, "app.session.pin")) {
1363
+ this.requestPin(true);
1364
+ return;
1365
+ }
1366
+ if (keybindings.matches(keyData, "app.session.unpin")) {
1367
+ this.requestPin(false);
1368
+ return;
1369
+ }
1280
1370
  // Up arrow
1281
1371
  if (matchesSelectUp(keyData)) {
1282
1372
  this.#selectionMoved = true;
@@ -1331,6 +1421,14 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
1331
1421
 
1332
1422
  export interface SessionSelectorOptions<T extends SessionSelectorEntry = SessionSelectorEntry> {
1333
1423
  onDelete?: (session: T) => Promise<boolean>;
1424
+ /**
1425
+ * Rename the selected session to a user-supplied title; resolve with the
1426
+ * title as stored (the session canonicalizes it) or null when the rename
1427
+ * did not happen.
1428
+ */
1429
+ onRename?: (session: T, title: string) => Promise<string | null>;
1430
+ /** Persist the selected session's pin state (pin keys / the picker's Pin action). */
1431
+ onSetPinned?: (session: T, pinned: boolean) => Promise<void>;
1334
1432
  historyMatcher?: SessionHistoryMatcher;
1335
1433
  /** Loads sessions across all projects for the all-projects scope toggle (Tab). */
1336
1434
  loadAllSessions?: () => Promise<T[]>;
@@ -1378,15 +1476,21 @@ export interface SessionSelectorOptions<T extends SessionSelectorEntry = Session
1378
1476
  export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSelectorEntry> extends OverlayPanel {
1379
1477
  #sessionList: SessionList<T>;
1380
1478
  #confirmationDialog: HookSelectorComponent | null = null;
1381
- // Hosts whichever of `#sessionList` / `#confirmationDialog` is live this
1382
- // frame. The delete dialog REPLACES the list in this slot rather than being
1383
- // appended below the picker chrome, so the picker is always
1479
+ /** Open rename dialog: an OverlayPanel hosting the rename TextFormField. */
1480
+ #renameDialog: OverlayPanel | null = null;
1481
+ /** The rename dialog's input; keystrokes route here while the dialog is open. */
1482
+ #renameField: TextFormField | null = null;
1483
+ // Hosts whichever of `#sessionList` / `#confirmationDialog` / `#renameDialog`
1484
+ // is live this frame. The delete dialog REPLACES the list in this slot rather
1485
+ // than being appended below the picker chrome, so the picker is always
1384
1486
  // `chrome + max(list, dialog) + chrome` and never overflows the viewport
1385
1487
  // (issue #3283: an overflowing dialog frame committed the header into
1386
1488
  // scrollback, stranding it above the viewport once the dialog closed).
1387
1489
  #contentSlot: Container;
1388
1490
  #messageContainer: Container;
1389
1491
  #onDelete?: (session: T) => Promise<boolean>;
1492
+ #onRename?: (session: T, title: string) => Promise<string | null>;
1493
+ #onSetPinned?: (session: T, pinned: boolean) => Promise<void>;
1390
1494
  #onRequestRender?: () => void;
1391
1495
  readonly #loadAllSessions?: () => Promise<T[]>;
1392
1496
  #folderSessions: T[];
@@ -1431,6 +1535,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1431
1535
  message: SessionPickerMessage | undefined;
1432
1536
  errorOpen: boolean;
1433
1537
  choice: DeleteChoice<T> | null;
1538
+ rename: OverlayPanel | null;
1434
1539
  node: NativeNode;
1435
1540
  }
1436
1541
  | undefined;
@@ -1439,7 +1544,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1439
1544
  title: string;
1440
1545
  scope: "folder" | "all";
1441
1546
  message: SessionPickerMessage | undefined;
1442
- dialog: HookSelectorComponent | null;
1547
+ dialog: HookSelectorComponent | OverlayPanel | null;
1443
1548
  list: NativeNode;
1444
1549
  node: NativeNode;
1445
1550
  }
@@ -1456,6 +1561,8 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1456
1561
 
1457
1562
  this.#messageContainer = new Container();
1458
1563
  this.#onDelete = options.onDelete;
1564
+ this.#onRename = options.onRename;
1565
+ this.#onSetPinned = options.onSetPinned;
1459
1566
  this.#loadAllSessions = options.loadAllSessions;
1460
1567
  this.#folderSessions = sessions;
1461
1568
  // Storage directory, not recorded cwd: one folder's sessions may record
@@ -1505,6 +1612,16 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1505
1612
  this.#showDeleteConfirmation(session);
1506
1613
  };
1507
1614
  }
1615
+ if (this.#onRename) {
1616
+ this.#sessionList.onRenameRequest = (session: T) => {
1617
+ this.#showRenameDialog(session);
1618
+ };
1619
+ }
1620
+ if (this.#onSetPinned) {
1621
+ this.#sessionList.onPinRequest = (session: T, pinned: boolean) => {
1622
+ void this.#setPinned(session, pinned);
1623
+ };
1624
+ }
1508
1625
  if (this.#loadAllSessions || this.#globalSessions) {
1509
1626
  this.#sessionList.onToggleScope = () => {
1510
1627
  void this.#toggleScope();
@@ -1527,7 +1644,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1527
1644
  * never pays for the cross-project scan.
1528
1645
  */
1529
1646
  async #toggleScope(): Promise<void> {
1530
- if (this.#toggling || this.#confirmationDialog) return;
1647
+ if (this.#toggling || this.#confirmationDialog || this.#renameDialog) return;
1531
1648
  if (this.#scope === "folder") {
1532
1649
  let global = this.#globalSessions;
1533
1650
  if (!global) {
@@ -1651,6 +1768,107 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1651
1768
  this.#onRequestRender?.();
1652
1769
  }
1653
1770
 
1771
+ /**
1772
+ * Mirror a renamed title into the scope caches. The visible list holds
1773
+ * one entry per session, but the folder and all-projects caches can hold
1774
+ * their own copies of the same session, so a rename has to reach all of
1775
+ * them or a scope switch shows the old title again.
1776
+ */
1777
+ #syncScopeTitles(sessionPath: string, title: string): void {
1778
+ for (const cache of [this.#folderSessions, this.#globalSessions]) {
1779
+ if (!cache) continue;
1780
+ const entry = cache.find(s => s.path === sessionPath);
1781
+ if (!entry) continue;
1782
+ entry.title = title;
1783
+ delete (entry as NativeSessionInfo)[kNativeItem];
1784
+ delete (entry as SearchableSessionInfo)[kSearchTextLower];
1785
+ }
1786
+ }
1787
+
1788
+ /** Close the rename dialog without changes, restoring the session list. */
1789
+ #closeRenameDialog(): void {
1790
+ if (!this.#renameDialog) return;
1791
+ this.#renameDialog = null;
1792
+ this.#renameField = null;
1793
+ // Restore the SessionList into the content slot so the picker is back
1794
+ // to its normal layout on the very next render — the same frame the
1795
+ // dialog disappears.
1796
+ this.#contentSlot.clear();
1797
+ this.#contentSlot.addChild(this.#sessionList);
1798
+ this.#onRequestRender?.();
1799
+ }
1800
+
1801
+ #showRenameDialog(session: T): void {
1802
+ if (!this.#onRename || this.#confirmationDialog || this.#renameDialog || this.#toggling) return;
1803
+ // One submit at a time: a second Enter while the rename is still
1804
+ // awaiting disk I/O would queue a second write for the same session.
1805
+ let pending = false;
1806
+ // This editor's own identity: a submit that settles after the user
1807
+ // opened another editor must not close it.
1808
+ const owner = new OverlayPanel("Rename Session");
1809
+ const submit = async (value: string) => {
1810
+ if (pending) return;
1811
+ const title = value.trim();
1812
+ // Empty treated as cancel: Esc and a blank submit both leave the title.
1813
+ if (title.length === 0) {
1814
+ this.#closeRenameDialog();
1815
+ return;
1816
+ }
1817
+ const rename = this.#onRename;
1818
+ if (!rename) {
1819
+ this.#closeRenameDialog();
1820
+ return;
1821
+ }
1822
+ this.#clearError();
1823
+ pending = true;
1824
+ try {
1825
+ const stored = await rename(session, title);
1826
+ if (stored) {
1827
+ // The stored title is the canonical one (the session may
1828
+ // collapse whitespace), so the row and the search index
1829
+ // match what is on disk.
1830
+ this.#sessionList.renameSessionTitle(session.path, stored);
1831
+ this.#syncScopeTitles(session.path, stored);
1832
+ if (this.#preview?.session === session) this.#preview = undefined;
1833
+ } else {
1834
+ this.#showError("Failed to rename session.");
1835
+ }
1836
+ } catch (err) {
1837
+ this.#showError(err instanceof Error ? err.message : String(err));
1838
+ } finally {
1839
+ pending = false;
1840
+ }
1841
+ if (this.#renameDialog === owner) this.#closeRenameDialog();
1842
+ };
1843
+ const field = new TextFormField({
1844
+ theme: formTheme,
1845
+ label: "Rename session",
1846
+ initialValue: session.title ?? "",
1847
+ empty: "cancel",
1848
+ onSubmit: value => {
1849
+ void submit(value);
1850
+ },
1851
+ onCancel: () => {
1852
+ // A cancel while the rename is still in flight must not tear
1853
+ // the editor down underneath it; the submit closes it.
1854
+ if (pending) return;
1855
+ this.#closeRenameDialog();
1856
+ },
1857
+ });
1858
+ field.focused = true;
1859
+ owner.addChild(field);
1860
+ this.#renameDialog = owner;
1861
+ this.#renameField = field;
1862
+ // Swap the SessionList out of the content slot and mount the dialog in its
1863
+ // place: the dialog competes only with the SessionList's rendered budget,
1864
+ // never the SessionList AND the picker chrome, so the picker frame stays
1865
+ // inside the terminal viewport and the TUI never commits the header into
1866
+ // scrollback (issue #3283).
1867
+ this.#contentSlot.clear();
1868
+ this.#contentSlot.addChild(owner);
1869
+ this.#onRequestRender?.();
1870
+ }
1871
+
1654
1872
  /**
1655
1873
  * Render the panel directly so fill-height mode can keep its footer pinned
1656
1874
  * while sharing OverlayPanel's exact rounded-box chrome. Children receive
@@ -1675,14 +1893,37 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1675
1893
  return lines;
1676
1894
  }
1677
1895
 
1896
+ /** Persist a pin change, then reorder the list; a failure shows the error and leaves the list as it was. */
1897
+ async #setPinned(session: T, pinned: boolean): Promise<void> {
1898
+ if (!this.#onSetPinned) return;
1899
+ this.#clearError();
1900
+ try {
1901
+ await this.#onSetPinned(session, pinned);
1902
+ this.#sessionList.setPinned(session.id, pinned);
1903
+ } catch (err) {
1904
+ this.#showError(err instanceof Error ? err.message : String(err));
1905
+ }
1906
+ this.#onRequestRender?.();
1907
+ }
1908
+
1909
+ /** The pin action that applies to the selected session: unpin when it is pinned, else pin. */
1910
+ #pinAction(): { binding: "app.session.pin" | "app.session.unpin"; label: string } | undefined {
1911
+ if (!this.#onSetPinned) return undefined;
1912
+ return this.#sessionList.selectedPinned
1913
+ ? { binding: "app.session.unpin", label: "unpin" }
1914
+ : { binding: "app.session.pin", label: "pin" };
1915
+ }
1916
+
1678
1917
  /** Blank · keybinding hint · bottom border. Rendered by {@link render}. */
1679
1918
  #footerLines(width: number): string[] {
1680
1919
  const scopeHint = this.#scope === "all" ? "current folder" : "all projects";
1681
1920
  // Keys mirror SessionList#handleInput; cancel is `app.interrupt` (raw Escape when unbound).
1682
1921
  const cancel = interruptKey();
1922
+ const pin = this.#pinAction();
1923
+ const pinKey = pin && getKeybindings().getKeys(pin.binding)[0];
1683
1924
  const hint = theme.fg(
1684
1925
  "muted",
1685
- `[${this.#onDelete ? `${formatKeyHints(["delete", "backspace"])} delete · ` : ""}${formatKeyHint("enter")} select · ${formatKeyHint("tab")} ${scopeHint} · ${cancel} cancel]`,
1926
+ `[${this.#onDelete ? `${formatKeyHints(["delete", "backspace"])} delete · ` : ""}${this.#onRename ? `${formatKeyHint("f2")} rename · ` : ""}${pinKey ? `${formatKeyHint(pinKey)} ${pin.label} · ` : ""}${formatKeyHint("enter")} select · ${formatKeyHint("tab")} ${scopeHint} · ${cancel} cancel]`,
1686
1927
  );
1687
1928
  return [row("", width), row(hint, width), row("", width), bottomBorder(width)];
1688
1929
  }
@@ -1694,24 +1935,32 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1694
1935
 
1695
1936
  /** Over the transcript the picker is its own sheet (`layer`); the standalone app fills the screen surface. */
1696
1937
  nativeSheet(cx: DescribeContext): boolean {
1938
+ // A rename editor is a card with a text field, not a picker sheet: it
1939
+ // renders in place, like the generic composition does.
1940
+ if (this.#renameDialog) return false;
1697
1941
  return cx.supports("picker") && !this.#standalone;
1698
1942
  }
1699
1943
 
1700
1944
  /**
1701
1945
  * With the `picker` kind: the data-first session picker (§4.7). Otherwise
1702
1946
  * scope `tabs`, loading/error message, then the search `input` and session
1703
- * `list` — or the delete-confirmation dialog in their place, as on the ANSI
1704
- * path — and the key-hint footer.
1947
+ * `list` — or the delete-confirmation / rename dialog in their place, as on
1948
+ * the ANSI path — and the key-hint footer.
1705
1949
  */
1706
1950
  override describe(cx: DescribeContext): NativeNode {
1707
- if (cx.supports("picker")) return this.#describePicker();
1951
+ // The picker kind has no text-input affordance, so a rename would
1952
+ // capture every keystroke into an invisible field. While the rename
1953
+ // editor is open, describe the card path instead (the same fallback
1954
+ // the hook selector uses for its slider and countdown).
1955
+ if (cx.supports("picker") && !this.#renameDialog) return this.#describePicker();
1708
1956
  const list = this.#sessionList.describeList();
1957
+ const dialog = this.#confirmationDialog ?? this.#renameDialog;
1709
1958
  const memo = this.#nativeMemo;
1710
1959
  if (
1711
1960
  memo?.title === this.title &&
1712
1961
  memo.scope === this.#scope &&
1713
1962
  memo.message === this.#message &&
1714
- memo.dialog === this.#confirmationDialog &&
1963
+ memo.dialog === dialog &&
1715
1964
  memo.list === list
1716
1965
  ) {
1717
1966
  return memo.node;
@@ -1725,13 +1974,16 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1725
1974
  } else if (message) {
1726
1975
  children.push(node("text", { spans: [span(message.text, "error")] }, undefined, "message"));
1727
1976
  }
1728
- if (this.#confirmationDialog) {
1729
- children.push(this.#confirmationDialog);
1977
+ if (dialog) {
1978
+ children.push(dialog);
1730
1979
  } else {
1731
1980
  children.push(this.#sessionList.searchInput, list);
1732
1981
  }
1733
1982
  const hints: (NativeHint | undefined)[] = [];
1734
1983
  if (this.#onDelete) hints.push({ keys: ["delete", "backspace"], label: "delete" });
1984
+ if (this.#onRename) hints.push({ keys: ["f2"], label: "rename" });
1985
+ const pin = this.#pinAction();
1986
+ if (pin) hints.push(actionHint(pin.binding, pin.label));
1735
1987
  hints.push({ keys: ["enter"], label: "select" });
1736
1988
  if (this.#sessionList.onToggleScope) {
1737
1989
  hints.push({ keys: ["tab"], label: this.#scope === "all" ? "current folder" : "all projects" });
@@ -1745,7 +1997,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1745
1997
  title: this.title,
1746
1998
  scope: this.#scope,
1747
1999
  message,
1748
- dialog: this.#confirmationDialog,
2000
+ dialog,
1749
2001
  list,
1750
2002
  node: result,
1751
2003
  };
@@ -1756,8 +2008,9 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1756
2008
  * `lg` cards sheet (`screen` for the standalone app): sessions grouped by
1757
2009
  * day (ranked flat while searching), the selected session's preview, the
1758
2010
  * delete confirm strip, and the actions of the keys Enter, Delete/Backspace,
1759
- * Tab (the scope toggle, labelled with the scope it switches to) and Esc.
1760
- * Untitled unless the caller named it; the placeholder says the scope.
2011
+ * F2 (rename), the pin keys (Pin / Unpin, whichever applies to the selected
2012
+ * session), Tab (the scope toggle, labelled with the scope it switches
2013
+ * to) and Esc. Untitled unless the caller named it; the placeholder says the scope.
1761
2014
  */
1762
2015
  #describePicker(): NativeNode {
1763
2016
  const list = this.#sessionList;
@@ -1766,6 +2019,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1766
2019
  const message = this.#message;
1767
2020
  const errorOpen = this.#pickerErrorOpen && message?.kind === "error";
1768
2021
  const choice = this.#deleteChoice;
2022
+ const rename = this.#renameDialog;
1769
2023
  const memo = this.#pickerMemo;
1770
2024
  if (
1771
2025
  memo?.view === view &&
@@ -1773,7 +2027,8 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1773
2027
  memo.scope === this.#scope &&
1774
2028
  memo.message === message &&
1775
2029
  memo.errorOpen === errorOpen &&
1776
- memo.choice === choice
2030
+ memo.choice === choice &&
2031
+ memo.rename === rename
1777
2032
  ) {
1778
2033
  return memo.node;
1779
2034
  }
@@ -1781,6 +2036,9 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1781
2036
  const toggle = list.onToggleScope !== undefined;
1782
2037
  const actions = [pickerAction("resume", this.#actionLabel, "enter", { primary: true })];
1783
2038
  if (this.#onDelete) actions.push(pickerAction("delete", "Delete", "backspace"));
2039
+ if (this.#onRename) actions.push(pickerAction("rename", "Rename", "f2"));
2040
+ const pin = this.#pinAction();
2041
+ if (pin) actions.push(pickerAction("pin", pin.label === "pin" ? "Pin" : "Unpin", bindingKeys(pin.binding)));
1784
2042
  if (toggle) {
1785
2043
  actions.push(pickerAction("scope", this.#scope === "all" ? "This folder" : "All projects", "tab"));
1786
2044
  }
@@ -1831,7 +2089,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1831
2089
  },
1832
2090
  preview,
1833
2091
  );
1834
- this.#pickerMemo = { view, preview, scope: this.#scope, message, errorOpen, choice, node: result };
2092
+ this.#pickerMemo = { view, preview, scope: this.#scope, message, errorOpen, choice, rename, node: result };
1835
2093
  return result;
1836
2094
  }
1837
2095
 
@@ -1867,27 +2125,32 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1867
2125
 
1868
2126
  /**
1869
2127
  * Picker pointer events run the keys' paths: a row click selects (arrows),
1870
- * a second click or `Resume` resumes (Enter), `Delete` asks (Delete), the
1871
- * tab or `All projects` toggles scope (Tab), `Close` cancels (Esc), and
1872
- * the confirm strip answers the delete dialog (Yes / Esc).
2128
+ * a second click or `Resume` resumes (Enter), `Delete` asks (Delete),
2129
+ * `Rename` renames (F2), `Pin` / `Unpin` flips the pin, the tab or `All projects` toggles scope (Tab),
2130
+ * `Close` cancels (Esc), and the confirm strip answers the delete dialog (Yes / Esc).
1873
2131
  */
1874
2132
  #handlePickerEvent(ev: PickerEvent): void {
1875
2133
  const list = this.#sessionList;
1876
2134
  const choice = this.#deleteChoice;
1877
2135
  if (ev.kind !== "action") {
1878
- if (choice) return;
2136
+ if (choice || this.#renameDialog) return;
1879
2137
  if (ev.kind === "select") list.selectSession(ev.item);
1880
2138
  else list.confirmSession(ev.item);
1881
2139
  return;
1882
2140
  }
1883
2141
  if (ev.act === "delete-confirm") choice?.confirm();
1884
- else if (ev.act === "cancel") choice?.cancel();
1885
- else if (ev.act === "close") {
2142
+ else if (ev.act === "cancel") {
2143
+ if (choice) choice.cancel();
2144
+ else this.#closeRenameDialog();
2145
+ } else if (ev.act === "close") {
1886
2146
  if (choice) choice.cancel();
2147
+ else if (this.#renameDialog) this.#closeRenameDialog();
1887
2148
  else list.onCancel?.();
1888
- } else if (choice) return;
2149
+ } else if (choice || this.#renameDialog) return;
1889
2150
  else if (ev.act === "resume") list.resumeSelected();
1890
2151
  else if (ev.act === "delete") list.requestDelete();
2152
+ else if (ev.act === "rename") list.requestRename();
2153
+ else if (ev.act === "pin") list.requestPin();
1891
2154
  else if (ev.act === "scope") {
1892
2155
  list.onToggleScope?.();
1893
2156
  } else if (ev.act === "clear") list.clearSearch();
@@ -1907,7 +2170,8 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1907
2170
  if (event.type === "select" && event.item !== this.#scope) void this.#toggleScope();
1908
2171
  return;
1909
2172
  }
1910
- if (event.key === "list" && !this.#confirmationDialog) this.#sessionList.confirmSession(event.item);
2173
+ if (event.key === "list" && !this.#confirmationDialog && !this.#renameDialog)
2174
+ this.#sessionList.confirmSession(event.item);
1911
2175
  }
1912
2176
 
1913
2177
  handleInput(keyData: string): void {
@@ -1919,6 +2183,8 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1919
2183
  }
1920
2184
  if (this.#confirmationDialog) {
1921
2185
  this.#confirmationDialog.handleInput(keyData);
2186
+ } else if (this.#renameDialog) {
2187
+ this.#renameField?.handleInput(keyData);
1922
2188
  } else {
1923
2189
  this.#sessionList.handleInput(keyData);
1924
2190
  }
@@ -1931,7 +2197,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
1931
2197
  * pointer. Mouse is inert while the delete-confirmation dialog is open.
1932
2198
  */
1933
2199
  #handleMouse(data: string): void {
1934
- if (this.#confirmationDialog) return;
2200
+ if (this.#confirmationDialog || this.#renameDialog) return;
1935
2201
  routeSgrMouseInput(data, event => {
1936
2202
  if (event.wheel !== null) {
1937
2203
  this.#sessionList.handleWheel(event.wheel);
@@ -435,22 +435,15 @@ function clockTime(date: Date): string {
435
435
  }
436
436
 
437
437
  /**
438
- * When a window resets, relative to `nowMs`: `resets 18:00` today, `resets
439
- * Tue 18:00` within the week, `resets 3 Oct` beyond; the title carries the
440
- * absolute date and the countdown.
438
+ * When a window resets, `resetMs` from `nowMs`: the countdown (`resets in
439
+ * 2h30m`), which reads the same in every time zone; the title carries the
440
+ * local date and time.
441
441
  */
442
442
  function resetLabel(nowMs: number, resetMs: number): { text: string; title: string } {
443
443
  const at = new Date(nowMs + resetMs);
444
- const now = new Date(nowMs);
445
- const sameDay = at.toDateString() === now.toDateString();
446
- const text = sameDay
447
- ? `resets ${clockTime(at)}`
448
- : resetMs < 6 * 86_400_000
449
- ? `resets ${WEEKDAY_NAMES[at.getDay()]} ${clockTime(at)}`
450
- : `resets ${at.getDate()} ${MONTH_NAMES[at.getMonth()]}`;
451
444
  return {
452
- text,
453
- title: `Resets ${shortDate(at)} ${at.getFullYear()}, ${clockTime(at)} (in ${formatDuration(resetMs)})`,
445
+ text: `resets in ${formatDuration(resetMs)}`,
446
+ title: `Resets ${shortDate(at)} ${at.getFullYear()}, ${clockTime(at)}`,
454
447
  };
455
448
  }
456
449