@draht/coding-agent 2026.11.19 → 2026.11.21-1

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 (210) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/bundle/chunks/{anthropic-messages-W6HN7XZW.js → anthropic-messages-JAAJVU3F.js} +1 -1
  3. package/dist/bundle/chunks/{azure-openai-responses-IYU6JN7E.js → azure-openai-responses-N4SHTXJ6.js} +1 -1
  4. package/dist/bundle/chunks/bedrock-converse-stream.js +23 -23
  5. package/dist/bundle/chunks/{chunk-MXA4WY3C.js → chunk-2DUHHN23.js} +1 -1
  6. package/dist/bundle/chunks/chunk-2JZLKNZ4.js +3 -0
  7. package/dist/bundle/chunks/{chunk-3YSKFWGJ.js → chunk-4MO4FSW4.js} +2 -2
  8. package/dist/bundle/chunks/chunk-6M3D4XVD.js +2 -0
  9. package/dist/bundle/chunks/{chunk-WZMHLLKP.js → chunk-7VQD47PF.js} +1 -1
  10. package/dist/bundle/chunks/chunk-A6BJNLBN.js +16 -0
  11. package/dist/bundle/chunks/{chunk-GRGZRSVX.js → chunk-BHLOLWW6.js} +60 -57
  12. package/dist/bundle/chunks/{chunk-J5PACQAM.js → chunk-BSVP25DF.js} +1 -1
  13. package/dist/bundle/chunks/{chunk-XY64T2H6.js → chunk-EGJQSI6O.js} +10 -10
  14. package/dist/bundle/chunks/{chunk-G7DJ6PIU.js → chunk-EHGC5YA6.js} +3 -3
  15. package/dist/bundle/chunks/{chunk-SYW5VSBL.js → chunk-EJUBHUKG.js} +1 -1
  16. package/dist/bundle/chunks/{chunk-GYCFH7QD.js → chunk-FHUNJPUZ.js} +1 -1
  17. package/dist/bundle/chunks/chunk-GBFVS2SF.js +12 -0
  18. package/dist/bundle/chunks/{chunk-ITP6IDBA.js → chunk-GQXRTK54.js} +2 -2
  19. package/dist/bundle/chunks/{chunk-K4FC3EMH.js → chunk-ICD4T57T.js} +10 -10
  20. package/dist/bundle/chunks/chunk-IUK7PQZQ.js +9 -0
  21. package/dist/bundle/chunks/chunk-J6WPFP55.js +30 -0
  22. package/dist/bundle/chunks/{chunk-QVGSXIKT.js → chunk-KFREX3FS.js} +1 -1
  23. package/dist/bundle/chunks/chunk-LHWSZITO.js +2 -0
  24. package/dist/bundle/chunks/chunk-LO6CVU2L.js +6 -0
  25. package/dist/bundle/chunks/{chunk-AQ4POXF4.js → chunk-TQH3TSOY.js} +1 -1
  26. package/dist/bundle/chunks/{chunk-5K3TBDND.js → chunk-U7QL6N7M.js} +12 -12
  27. package/dist/bundle/chunks/chunk-X7F5FNNE.js +31 -0
  28. package/dist/bundle/chunks/{chunk-6QA6EP5G.js → chunk-XP47TR6S.js} +1 -1
  29. package/dist/bundle/chunks/{chunk-RHXTTWD5.js → chunk-ZWE4WYUP.js} +1 -1
  30. package/dist/bundle/chunks/{cli-KSFELY3W.js → cli-FQY4GIEZ.js} +1 -1
  31. package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-WIIL62VL.js → cloudflare-workers-ai-system-one-UZT2D6OE.js} +1 -1
  32. package/dist/bundle/chunks/{execute-YOMYOVUT.js → execute-7ZBBCFJX.js} +1 -1
  33. package/dist/bundle/chunks/github-copilot.js +1 -1
  34. package/dist/bundle/chunks/{google-generative-ai-NZVCFKM4.js → google-generative-ai-V4OXSUYB.js} +1 -1
  35. package/dist/bundle/chunks/{google-vertex-BL3BF2VF.js → google-vertex-FHE7WELO.js} +1 -1
  36. package/dist/bundle/chunks/https-proxy-agent-WQIRL24U.js +13 -0
  37. package/dist/bundle/chunks/lib-ULKZYRGD.js +9 -0
  38. package/dist/bundle/chunks/{llama-cpp-classify-GP2X3HGE.js → llama-cpp-classify-OOBHWVRW.js} +1 -1
  39. package/dist/bundle/chunks/{mistral-conversations-2REUBSZJ.js → mistral-conversations-P2UXS4YP.js} +2 -2
  40. package/dist/bundle/chunks/{multipart-parser-AZP5BX2W.js → multipart-parser-HMCXZ4BD.js} +1 -1
  41. package/dist/bundle/chunks/{node-BZAVEWJ3.js → node-DXZFQBEO.js} +1 -1
  42. package/dist/bundle/chunks/{node-C2JGH2OB.js → node-LBZLUIBE.js} +1 -1
  43. package/dist/bundle/chunks/openai-codex-responses-6EVE5GBS.js +10 -0
  44. package/dist/bundle/chunks/{openai-completions-MTNKQNK4.js → openai-completions-J455OHQY.js} +2 -2
  45. package/dist/bundle/chunks/{openai-decisions-UYPZJCVG.js → openai-decisions-3YUUL56O.js} +1 -1
  46. package/dist/bundle/chunks/{openai-responses-QVXIRAUW.js → openai-responses-T6LS2BDK.js} +1 -1
  47. package/dist/bundle/chunks/{openrouter-images-E6VXUX3T.js → openrouter-images-3QKLSH5X.js} +1 -1
  48. package/dist/bundle/chunks/{pi-messages-KPT6QQD4.js → pi-messages-SMJVFBS5.js} +1 -1
  49. package/dist/bundle/chunks/{runtime-S5WBSLTE.js → runtime-FZKS2BWI.js} +1 -1
  50. package/dist/bundle/chunks/{runtime-3ZSEARRN.js → runtime-ZTL2QJTC.js} +1 -1
  51. package/dist/bundle/chunks/{settings-manager-H3QEOPQ3.js → settings-manager-DB22TF7G.js} +1 -1
  52. package/dist/bundle/chunks/src-KDGO7EGF.js +4 -0
  53. package/dist/bundle/chunks/{typesafe-system-one-5RPPTQ5S.js → typesafe-system-one-OLZERWYH.js} +1 -1
  54. package/dist/bundle/chunks/{virtual-modules-HCLXUIRY.js → virtual-modules-GB7JDLCJ.js} +1 -1
  55. package/dist/bundle/cli-runtime.js +1 -1
  56. package/dist/bundle/index.js +1 -1
  57. package/dist/bundle/rpc-entry.js +1 -1
  58. package/dist/cli/config-selector.d.ts.map +1 -1
  59. package/dist/cli/config-selector.js +9 -6
  60. package/dist/cli/config-selector.js.map +1 -1
  61. package/dist/cli/session-picker.d.ts.map +1 -1
  62. package/dist/cli/session-picker.js +9 -6
  63. package/dist/cli/session-picker.js.map +1 -1
  64. package/dist/cli/startup-ui.d.ts.map +1 -1
  65. package/dist/cli/startup-ui.js +4 -0
  66. package/dist/cli/startup-ui.js.map +1 -1
  67. package/dist/core/agent-session-runtime.d.ts +11 -0
  68. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  69. package/dist/core/agent-session-runtime.js +19 -0
  70. package/dist/core/agent-session-runtime.js.map +1 -1
  71. package/dist/core/agent-session.d.ts +1 -0
  72. package/dist/core/agent-session.d.ts.map +1 -1
  73. package/dist/core/agent-session.js +4 -5
  74. package/dist/core/agent-session.js.map +1 -1
  75. package/dist/core/export-html/ansi-to-html.d.ts +1 -1
  76. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  77. package/dist/core/export-html/ansi-to-html.js.map +1 -1
  78. package/dist/core/export-html/tool-renderer.js.map +1 -1
  79. package/dist/core/extensions/loader.d.ts.map +1 -1
  80. package/dist/core/extensions/loader.js +18 -1
  81. package/dist/core/extensions/loader.js.map +1 -1
  82. package/dist/core/extensions/runner.d.ts.map +1 -1
  83. package/dist/core/extensions/runner.js +5 -0
  84. package/dist/core/extensions/runner.js.map +1 -1
  85. package/dist/core/extensions/types.d.ts +5 -0
  86. package/dist/core/extensions/types.d.ts.map +1 -1
  87. package/dist/core/extensions/types.js.map +1 -1
  88. package/dist/core/model-resolver.d.ts +0 -7
  89. package/dist/core/model-resolver.d.ts.map +1 -1
  90. package/dist/core/model-resolver.js +3 -60
  91. package/dist/core/model-resolver.js.map +1 -1
  92. package/dist/core/package-manager.d.ts +16 -0
  93. package/dist/core/package-manager.d.ts.map +1 -1
  94. package/dist/core/package-manager.js +46 -3
  95. package/dist/core/package-manager.js.map +1 -1
  96. package/dist/core/resource-loader.d.ts +5 -1
  97. package/dist/core/resource-loader.d.ts.map +1 -1
  98. package/dist/core/resource-loader.js +2 -0
  99. package/dist/core/resource-loader.js.map +1 -1
  100. package/dist/core/session-manager.d.ts.map +1 -1
  101. package/dist/core/session-manager.js +3 -1
  102. package/dist/core/session-manager.js.map +1 -1
  103. package/dist/core/tools/bash.js +1 -1
  104. package/dist/core/tools/bash.js.map +1 -1
  105. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  106. package/dist/core/tools/output-accumulator.js +3 -2
  107. package/dist/core/tools/output-accumulator.js.map +1 -1
  108. package/dist/core/tools/truncate.d.ts +1 -1
  109. package/dist/core/tools/truncate.d.ts.map +1 -1
  110. package/dist/core/tools/truncate.js +11 -5
  111. package/dist/core/tools/truncate.js.map +1 -1
  112. package/dist/extensions/llama/provider.d.ts.map +1 -1
  113. package/dist/extensions/llama/provider.js +5 -3
  114. package/dist/extensions/llama/provider.js.map +1 -1
  115. package/dist/main.d.ts.map +1 -1
  116. package/dist/main.js +30 -12
  117. package/dist/main.js.map +1 -1
  118. package/dist/modes/diagnostics-stderr.d.ts +4 -0
  119. package/dist/modes/diagnostics-stderr.d.ts.map +1 -0
  120. package/dist/modes/diagnostics-stderr.js +11 -0
  121. package/dist/modes/diagnostics-stderr.js.map +1 -0
  122. package/dist/modes/interactive/components/assistant-message.d.ts +2 -1
  123. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  124. package/dist/modes/interactive/components/assistant-message.js +9 -3
  125. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  126. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  127. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  128. package/dist/modes/interactive/components/config-selector.js +5 -2
  129. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  130. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  131. package/dist/modes/interactive/components/model-selector.js +5 -2
  132. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  133. package/dist/modes/interactive/components/oauth-selector.d.ts +1 -1
  134. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  135. package/dist/modes/interactive/components/oauth-selector.js +7 -3
  136. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  137. package/dist/modes/interactive/components/radius-login-selector.d.ts.map +1 -1
  138. package/dist/modes/interactive/components/radius-login-selector.js +2 -1
  139. package/dist/modes/interactive/components/radius-login-selector.js.map +1 -1
  140. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  141. package/dist/modes/interactive/components/scoped-models-selector.js +9 -1
  142. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  143. package/dist/modes/interactive/components/session-selector.d.ts +2 -0
  144. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  145. package/dist/modes/interactive/components/session-selector.js +18 -4
  146. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  147. package/dist/modes/interactive/components/settings-submenu.d.ts +1 -1
  148. package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -1
  149. package/dist/modes/interactive/components/settings-submenu.js +5 -1
  150. package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
  151. package/dist/modes/interactive/components/themed-text.d.ts +1 -1
  152. package/dist/modes/interactive/components/themed-text.d.ts.map +1 -1
  153. package/dist/modes/interactive/components/themed-text.js.map +1 -1
  154. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  155. package/dist/modes/interactive/components/thinking-selector.js +5 -1
  156. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  157. package/dist/modes/interactive/components/tool-execution.d.ts +1 -1
  158. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  159. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  160. package/dist/modes/interactive/components/user-message.d.ts +2 -1
  161. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  162. package/dist/modes/interactive/components/user-message.js +9 -3
  163. package/dist/modes/interactive/components/user-message.js.map +1 -1
  164. package/dist/modes/interactive/components/visual-truncate.d.ts +2 -2
  165. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
  166. package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
  167. package/dist/modes/interactive/interactive-mode.d.ts +1 -1
  168. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  169. package/dist/modes/interactive/interactive-mode.js +79 -38
  170. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  171. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  172. package/dist/modes/interactive/theme/theme.js +1 -0
  173. package/dist/modes/interactive/theme/theme.js.map +1 -1
  174. package/dist/modes/print-mode.d.ts.map +1 -1
  175. package/dist/modes/print-mode.js +16 -13
  176. package/dist/modes/print-mode.js.map +1 -1
  177. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  178. package/dist/modes/rpc/rpc-mode.js +15 -23
  179. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  180. package/dist/utils/changelog.d.ts.map +1 -1
  181. package/dist/utils/changelog.js +3 -2
  182. package/dist/utils/changelog.js.map +1 -1
  183. package/dist/utils/flush-stdout.d.ts +8 -0
  184. package/dist/utils/flush-stdout.d.ts.map +1 -0
  185. package/dist/utils/flush-stdout.js +23 -0
  186. package/dist/utils/flush-stdout.js.map +1 -0
  187. package/docs/models-configuration.md +11 -2
  188. package/docs/tui.md +2 -0
  189. package/package.json +9 -9
  190. package/schemas/models.schema.json +1 -1
  191. package/dist/bundle/chunks/chunk-2CHTECAU.js +0 -2
  192. package/dist/bundle/chunks/chunk-6MSE6LZ3.js +0 -6
  193. package/dist/bundle/chunks/chunk-736QBNUZ.js +0 -12
  194. package/dist/bundle/chunks/chunk-BIBUE2PO.js +0 -2
  195. package/dist/bundle/chunks/chunk-CLONDAPI.js +0 -9
  196. package/dist/bundle/chunks/chunk-IRBBJMGW.js +0 -16
  197. package/dist/bundle/chunks/chunk-KVH4HR57.js +0 -31
  198. package/dist/bundle/chunks/chunk-SM2YWAF2.js +0 -30
  199. package/dist/bundle/chunks/chunk-TIA2T6EO.js +0 -3
  200. package/dist/bundle/chunks/https-proxy-agent-O2PVUIOI.js +0 -13
  201. package/dist/bundle/chunks/lib-XOG5PI3Y.js +0 -9
  202. package/dist/bundle/chunks/openai-codex-responses-7MQGGA7O.js +0 -10
  203. package/dist/bundle/chunks/src-TIBHS42X.js +0 -4
  204. package/dist/utils/deprecation.d.ts +0 -4
  205. package/dist/utils/deprecation.d.ts.map +0 -1
  206. package/dist/utils/deprecation.js +0 -13
  207. package/dist/utils/deprecation.js.map +0 -1
  208. /package/dist/bundle/chunks/{chunk-OPLOTJXH.js → chunk-ATYP3OSV.js} +0 -0
  209. /package/dist/bundle/chunks/{chunk-PX3CDFUB.js → chunk-ITKDPD4D.js} +0 -0
  210. /package/dist/bundle/chunks/{chunk-ZZD35WKM.js → chunk-MOOADNVS.js} +0 -0
@@ -517,8 +517,7 @@ class SessionList {
517
517
  // Only triggers deletion when the query is empty; otherwise it is forwarded to the input
518
518
  if (kb.matches(keyData, "app.session.deleteNoninvasive")) {
519
519
  if (this.searchInput.getValue().length > 0) {
520
- this.searchInput.handleInput(keyData);
521
- this.filterSessions(this.searchInput.getValue());
520
+ this.handleSearchInput(keyData);
522
521
  return;
523
522
  }
524
523
  this.startDeleteConfirmationForSelectedSession();
@@ -557,10 +556,25 @@ class SessionList {
557
556
  }
558
557
  // Pass everything else to search input
559
558
  else {
560
- this.searchInput.handleInput(keyData);
561
- this.filterSessions(this.searchInput.getValue());
559
+ this.handleSearchInput(keyData);
562
560
  }
563
561
  }
562
+ /** Applies a key to the search query; a changed, non-empty query selects the top row, the best match. */
563
+ handleSearchInput(keyData) {
564
+ const previousQuery = this.searchInput.getValue();
565
+ this.searchInput.handleInput(keyData);
566
+ const query = this.searchInput.getValue();
567
+ // Cursor keys leave the query as it is and must not move the selection.
568
+ if (query === previousQuery)
569
+ return;
570
+ this.filterSessions(query);
571
+ if (!query.trim())
572
+ return;
573
+ this.selectedIndex = 0;
574
+ // Untouched, sessions that are still loading keep the selection on the top row instead of on this session.
575
+ this.selectionTouched = false;
576
+ this.pendingSelectedPath = undefined;
577
+ }
564
578
  }
565
579
  /**
566
580
  * Delete a session file, trying the `trash` CLI first, then falling back to unlink
@@ -1 +1 @@
1
- {"version":3,"file":"session-selector.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/session-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,S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C;QACpF,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;QACtF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,QAAQ,IAAI,EAAE,EAAE,IAAI,CAAC,KAAK,KAAK,KAAK,EAAE,OAAO,IAAI,QAAQ,KAAK,IAAI,CAAC,CAAC;QACjG,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,QAAQ,KAAK,IAAI,IAAI,CAAC,OAAO;YAAE,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpE,CAAC;IAED,cAAc;QACb,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;CACD","sourcesContent":["import { spawnSync } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport { unlink } from \"node:fs/promises\";\nimport {\n\ttype Component,\n\tContainer,\n\ttype Focusable,\n\tgetKeybindings,\n\tInput,\n\tSpacer,\n\tText,\n\ttruncateToWidth,\n\tvisibleWidth,\n} from \"@draht/tui\";\nimport { KeybindingsManager } from \"../../../core/keybindings.js\";\nimport type { SessionInfo, SessionListProgress } from \"../../../core/session-manager.js\";\nimport { comparablePath } from \"../../../utils/canonical-path.js\";\nimport { getPathComparisonKey, shortenHomePath } from \"../../../utils/paths.js\";\nimport { theme } from \"../theme/theme.js\";\nimport { DynamicBorder } from \"./dynamic-border.js\";\nimport { keyHint, keyText } from \"./keybinding-hints.js\";\nimport { filterAndSortSessions, hasSessionName, type NameFilter, type SortMode } from \"./session-selector-search.js\";\n\ntype SessionScope = \"current\" | \"all\";\n\nfunction formatSessionDate(date: Date): string {\n\tconst now = new Date();\n\tconst diffMs = now.getTime() - date.getTime();\n\tconst diffMins = Math.floor(diffMs / 60000);\n\tconst diffHours = Math.floor(diffMs / 3600000);\n\tconst diffDays = Math.floor(diffMs / 86400000);\n\n\tif (diffMins < 1) return \"now\";\n\tif (diffMins < 60) return `${diffMins}m`;\n\tif (diffHours < 24) return `${diffHours}h`;\n\tif (diffDays < 7) return `${diffDays}d`;\n\tif (diffDays < 30) return `${Math.floor(diffDays / 7)}w`;\n\tif (diffDays < 365) return `${Math.floor(diffDays / 30)}mo`;\n\treturn `${Math.floor(diffDays / 365)}y`;\n}\n\n// Called per row per render, and the walk costs a syscall per segment. Session files are\n// append-only, so a path's identity does not change under us.\nconst sessionPathKeyCache = new Map<string, string>();\n\n/** Comparison key for a session file path; follows symlinks and ignores case on Windows. */\nfunction getSessionPathKey(path: string): string {\n\tconst cached = sessionPathKeyCache.get(path);\n\tif (cached !== undefined) return cached;\n\tconst key = getPathComparisonKey(comparablePath(path));\n\tsessionPathKeyCache.set(path, key);\n\treturn key;\n}\n\nclass SessionSelectorHeader implements Component {\n\tprivate scope: SessionScope;\n\tprivate sortMode: SortMode;\n\tprivate nameFilter: NameFilter;\n\tprivate requestRender: () => void;\n\tprivate loading = false;\n\tprivate loadProgress: { loaded: number; total: number } | null = null;\n\tprivate showPath = false;\n\tprivate confirmingDeletePath: string | null = null;\n\tprivate statusMessage: { type: \"info\" | \"error\"; message: string } | null = null;\n\tprivate statusTimeout: ReturnType<typeof setTimeout> | null = null;\n\tprivate showRenameHint = false;\n\n\tconstructor(scope: SessionScope, sortMode: SortMode, nameFilter: NameFilter, requestRender: () => void) {\n\t\tthis.scope = scope;\n\t\tthis.sortMode = sortMode;\n\t\tthis.nameFilter = nameFilter;\n\t\tthis.requestRender = requestRender;\n\t}\n\n\tsetScope(scope: SessionScope): void {\n\t\tthis.scope = scope;\n\t}\n\n\tsetSortMode(sortMode: SortMode): void {\n\t\tthis.sortMode = sortMode;\n\t}\n\n\tsetNameFilter(nameFilter: NameFilter): void {\n\t\tthis.nameFilter = nameFilter;\n\t}\n\n\tsetLoading(loading: boolean): void {\n\t\tthis.loading = loading;\n\t\t// Progress is scoped to the current load; clear whenever the loading state is set\n\t\tthis.loadProgress = null;\n\t}\n\n\tsetProgress(loaded: number, total: number): void {\n\t\tthis.loadProgress = { loaded, total };\n\t}\n\n\tsetShowPath(showPath: boolean): void {\n\t\tthis.showPath = showPath;\n\t}\n\n\tsetShowRenameHint(show: boolean): void {\n\t\tthis.showRenameHint = show;\n\t}\n\n\tsetConfirmingDeletePath(path: string | null): void {\n\t\tthis.confirmingDeletePath = path;\n\t}\n\n\tprivate clearStatusTimeout(): void {\n\t\tif (!this.statusTimeout) return;\n\t\tclearTimeout(this.statusTimeout);\n\t\tthis.statusTimeout = null;\n\t}\n\n\tsetStatusMessage(msg: { type: \"info\" | \"error\"; message: string } | null, autoHideMs?: number): void {\n\t\tthis.clearStatusTimeout();\n\t\tthis.statusMessage = msg;\n\t\tif (!msg || !autoHideMs) return;\n\n\t\tthis.statusTimeout = setTimeout(() => {\n\t\t\tthis.statusMessage = null;\n\t\t\tthis.statusTimeout = null;\n\t\t\tthis.requestRender();\n\t\t}, autoHideMs);\n\t}\n\n\tinvalidate(): void {}\n\n\trender(width: number): string[] {\n\t\tconst title = this.scope === \"current\" ? \"Resume Session (Current Folder)\" : \"Resume Session (All)\";\n\t\tconst leftText = theme.bold(title);\n\n\t\tconst sortLabel = this.sortMode === \"threaded\" ? \"Threaded\" : this.sortMode === \"recent\" ? \"Recent\" : \"Fuzzy\";\n\t\tconst sortText = theme.fg(\"muted\", \"Sort: \") + theme.fg(\"accent\", sortLabel);\n\n\t\tconst nameLabel = this.nameFilter === \"all\" ? \"All\" : \"Named\";\n\t\tconst nameText = theme.fg(\"muted\", \"Name: \") + theme.fg(\"accent\", nameLabel);\n\n\t\tlet scopeText: string;\n\t\tif (this.loading) {\n\t\t\tconst progressText = this.loadProgress ? `${this.loadProgress.loaded}/${this.loadProgress.total}` : \"...\";\n\t\t\tscopeText = `${theme.fg(\"muted\", \"○ Current Folder | \")}${theme.fg(\"accent\", `Loading ${progressText}`)}`;\n\t\t} else if (this.scope === \"current\") {\n\t\t\tscopeText = `${theme.fg(\"accent\", \"◉ Current Folder\")}${theme.fg(\"muted\", \" | ○ All\")}`;\n\t\t} else {\n\t\t\tscopeText = `${theme.fg(\"muted\", \"○ Current Folder | \")}${theme.fg(\"accent\", \"◉ All\")}`;\n\t\t}\n\n\t\tconst rightText = truncateToWidth(`${scopeText} ${nameText} ${sortText}`, width, \"\");\n\t\tconst availableLeft = Math.max(0, width - visibleWidth(rightText) - 1);\n\t\tconst left = truncateToWidth(leftText, availableLeft, \"\");\n\t\tconst spacing = Math.max(0, width - visibleWidth(left) - visibleWidth(rightText));\n\n\t\t// Build hint lines - changes based on state (all branches truncate to width)\n\t\tlet hintLine1: string;\n\t\tlet hintLine2: string;\n\t\tif (this.confirmingDeletePath !== null) {\n\t\t\tconst confirmHint = `Delete session? ${keyHint(\"tui.select.confirm\", \"confirm\")} · ${keyHint(\"tui.select.cancel\", \"cancel\")}`;\n\t\t\thintLine1 = theme.fg(\"error\", truncateToWidth(confirmHint, width, \"…\"));\n\t\t\thintLine2 = \"\";\n\t\t} else if (this.statusMessage) {\n\t\t\tconst color = this.statusMessage.type === \"error\" ? \"error\" : \"accent\";\n\t\t\thintLine1 = theme.fg(color, truncateToWidth(this.statusMessage.message, width, \"…\"));\n\t\t\thintLine2 = \"\";\n\t\t} else {\n\t\t\tconst pathState = this.showPath ? \"(on)\" : \"(off)\";\n\t\t\tconst sep = theme.fg(\"muted\", \" · \");\n\t\t\tconst hint1 =\n\t\t\t\tkeyHint(\"tui.input.tab\", \"scope\") + sep + theme.fg(\"muted\", 're:<pattern> regex · \"phrase\" exact');\n\t\t\tconst hint2Parts = [\n\t\t\t\tkeyHint(\"app.session.toggleSort\", \"sort\"),\n\t\t\t\tkeyHint(\"app.session.toggleNamedFilter\", \"named\"),\n\t\t\t\tkeyHint(\"app.session.delete\", \"delete\"),\n\t\t\t\tkeyHint(\"app.session.togglePath\", `path ${pathState}`),\n\t\t\t];\n\t\t\tif (this.showRenameHint) {\n\t\t\t\thint2Parts.push(keyHint(\"app.session.rename\", \"rename\"));\n\t\t\t}\n\t\t\tconst hint2 = hint2Parts.join(sep);\n\t\t\thintLine1 = truncateToWidth(hint1, width, \"…\");\n\t\t\thintLine2 = truncateToWidth(hint2, width, \"…\");\n\t\t}\n\n\t\treturn [`${left}${\" \".repeat(spacing)}${rightText}`, hintLine1, hintLine2];\n\t}\n}\n\n/** A session tree node for hierarchical display */\ninterface SessionTreeNode {\n\tsession: SessionInfo;\n\tchildren: SessionTreeNode[];\n\tlatestActivity: number;\n}\n\n/** Flattened node for display with tree structure info */\ninterface FlatSessionNode {\n\tsession: SessionInfo;\n\tdepth: number;\n\tisLast: boolean;\n\t/** For each ancestor level, whether there are more siblings after it */\n\tancestorContinues: boolean[];\n}\n\n/**\n * Build a tree structure from sessions based on parentSessionPath.\n * Returns root nodes sorted by modified date (descending).\n */\nfunction buildSessionTree(sessions: SessionInfo[]): SessionTreeNode[] {\n\tconst byPath = new Map<string, SessionTreeNode>();\n\n\tfor (const session of sessions) {\n\t\tconst sessionPath = getSessionPathKey(session.path);\n\t\tbyPath.set(sessionPath, { session, children: [], latestActivity: session.modified.getTime() });\n\t}\n\n\tconst roots: SessionTreeNode[] = [];\n\n\tfor (const session of sessions) {\n\t\tconst sessionPath = getSessionPathKey(session.path);\n\t\tconst node = byPath.get(sessionPath)!;\n\t\tconst parentPath = session.parentSessionPath ? getSessionPathKey(session.parentSessionPath) : undefined;\n\n\t\tif (parentPath && byPath.has(parentPath)) {\n\t\t\tbyPath.get(parentPath)!.children.push(node);\n\t\t} else {\n\t\t\troots.push(node);\n\t\t}\n\t}\n\n\tconst updateLatestActivity = (node: SessionTreeNode): number => {\n\t\tlet latestActivity = node.session.modified.getTime();\n\t\tfor (const child of node.children) {\n\t\t\tlatestActivity = Math.max(latestActivity, updateLatestActivity(child));\n\t\t}\n\t\tnode.latestActivity = latestActivity;\n\t\treturn latestActivity;\n\t};\n\n\tfor (const root of roots) {\n\t\tupdateLatestActivity(root);\n\t}\n\n\t// Sort children and roots by latest activity in each subtree (descending)\n\tconst sortNodes = (nodes: SessionTreeNode[]): void => {\n\t\tnodes.sort((a, b) => b.latestActivity - a.latestActivity);\n\t\tfor (const node of nodes) {\n\t\t\tsortNodes(node.children);\n\t\t}\n\t};\n\tsortNodes(roots);\n\n\treturn roots;\n}\n\n/**\n * Flatten tree into display list with tree structure metadata.\n */\nfunction flattenSessionTree(roots: SessionTreeNode[]): FlatSessionNode[] {\n\tconst result: FlatSessionNode[] = [];\n\n\tconst walk = (node: SessionTreeNode, depth: number, ancestorContinues: boolean[], isLast: boolean): void => {\n\t\tresult.push({ session: node.session, depth, isLast, ancestorContinues });\n\n\t\tfor (let i = 0; i < node.children.length; i++) {\n\t\t\tconst childIsLast = i === node.children.length - 1;\n\t\t\t// Only show continuation line for non-root ancestors\n\t\t\tconst continues = depth > 0 ? !isLast : false;\n\t\t\twalk(node.children[i]!, depth + 1, [...ancestorContinues, continues], childIsLast);\n\t\t}\n\t};\n\n\tfor (let i = 0; i < roots.length; i++) {\n\t\twalk(roots[i]!, 0, [], i === roots.length - 1);\n\t}\n\n\treturn result;\n}\n\n/**\n * Custom session list component with multi-line items and search\n */\nclass SessionList implements Component, Focusable {\n\tpublic getSelectedSessionPath(): string | undefined {\n\t\tconst selected = this.filteredSessions[this.selectedIndex];\n\t\treturn selected?.session.path;\n\t}\n\tprivate allSessions: SessionInfo[] = [];\n\tprivate filteredSessions: FlatSessionNode[] = [];\n\tprivate selectedIndex: number = 0;\n\tprivate selectionTouched = false;\n\t// Session to select once it appears, while a progressive reload has not yet delivered it\n\tprivate pendingSelectedPath?: string;\n\tprivate searchInput: Input;\n\tprivate showCwd = false;\n\tprivate sortMode: SortMode = \"threaded\";\n\tprivate nameFilter: NameFilter = \"all\";\n\tprivate keybindings: KeybindingsManager;\n\tprivate showPath = false;\n\tprivate confirmingDeletePath: string | null = null;\n\tprivate currentSessionPathKey?: string;\n\tpublic onSelect?: (sessionPath: string) => void;\n\tpublic onCancel?: () => void;\n\tpublic onExit: () => void = () => {};\n\tpublic onToggleScope?: () => void;\n\tpublic onToggleSort?: () => void;\n\tpublic onToggleNameFilter?: () => void;\n\tpublic onTogglePath?: (showPath: boolean) => void;\n\tpublic onDeleteConfirmationChange?: (path: string | null) => void;\n\tpublic onDeleteSession?: (sessionPath: string) => Promise<void>;\n\tpublic onRenameSession?: (sessionPath: string) => void;\n\tpublic onError?: (message: string) => void;\n\tprivate maxVisible: number = 10; // Max sessions visible (one line each)\n\n\t// Focusable implementation - propagate to searchInput for IME cursor positioning\n\tprivate _focused = false;\n\tget focused(): boolean {\n\t\treturn this._focused;\n\t}\n\tset focused(value: boolean) {\n\t\tthis._focused = value;\n\t\tthis.searchInput.focused = value;\n\t}\n\n\tconstructor(\n\t\tsessions: SessionInfo[],\n\t\tshowCwd: boolean,\n\t\tsortMode: SortMode,\n\t\tnameFilter: NameFilter,\n\t\tkeybindings: KeybindingsManager,\n\t\tcurrentSessionFilePath?: string,\n\t) {\n\t\tthis.allSessions = sessions;\n\t\tthis.filteredSessions = [];\n\t\tthis.searchInput = new Input();\n\t\tthis.showCwd = showCwd;\n\t\tthis.sortMode = sortMode;\n\t\tthis.nameFilter = nameFilter;\n\t\tthis.keybindings = keybindings;\n\t\tthis.currentSessionPathKey = currentSessionFilePath ? getSessionPathKey(currentSessionFilePath) : undefined;\n\t\tthis.filterSessions(\"\");\n\n\t\t// Handle Enter in search input - select current item\n\t\tthis.searchInput.onSubmit = () => {\n\t\t\tif (this.filteredSessions[this.selectedIndex]) {\n\t\t\t\tconst selected = this.filteredSessions[this.selectedIndex];\n\t\t\t\tif (this.onSelect) {\n\t\t\t\t\tthis.onSelect(selected.session.path);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n\n\tsetSortMode(sortMode: SortMode): void {\n\t\tthis.sortMode = sortMode;\n\t\tthis.filterSessions(this.searchInput.getValue());\n\t}\n\n\tsetNameFilter(nameFilter: NameFilter): void {\n\t\tthis.nameFilter = nameFilter;\n\t\tthis.filterSessions(this.searchInput.getValue());\n\t}\n\n\t/**\n\t * @param partial true when more sessions are still loading; a selected session missing from a\n\t * partial list stays the selection target until it arrives\n\t */\n\tsetSessions(sessions: SessionInfo[], showCwd: boolean, partial = false): void {\n\t\tconst pendingPath = this.selectionTouched ? this.pendingSelectedPath : undefined;\n\t\tconst selectedPath = this.selectionTouched ? (pendingPath ?? this.getSelectedSessionPath()) : undefined;\n\t\tthis.allSessions = sessions;\n\t\tthis.showCwd = showCwd;\n\t\tthis.filterSessions(this.searchInput.getValue());\n\t\tif (!this.selectionTouched) {\n\t\t\tthis.selectedIndex = 0;\n\t\t} else if (selectedPath) {\n\t\t\tconst selectedIndex = this.filteredSessions.findIndex((node) => node.session.path === selectedPath);\n\t\t\tif (selectedIndex >= 0) {\n\t\t\t\tthis.selectedIndex = selectedIndex;\n\t\t\t\tthis.pendingSelectedPath = undefined;\n\t\t\t} else if (partial) {\n\t\t\t\t// The selected session may not have loaded yet: keep it as the target instead of\n\t\t\t\t// adopting whichever session the index now points to.\n\t\t\t\tthis.pendingSelectedPath = selectedPath;\n\t\t\t} else {\n\t\t\t\tthis.pendingSelectedPath = undefined;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate filterSessions(query: string): void {\n\t\tconst trimmed = query.trim();\n\t\tconst nameFiltered =\n\t\t\tthis.nameFilter === \"all\" ? this.allSessions : this.allSessions.filter((session) => hasSessionName(session));\n\n\t\tif (this.sortMode === \"threaded\" && !trimmed) {\n\t\t\t// Threaded mode without search: show tree structure\n\t\t\tconst roots = buildSessionTree(nameFiltered);\n\t\t\tthis.filteredSessions = flattenSessionTree(roots);\n\t\t} else {\n\t\t\t// Other modes or with search: flat list\n\t\t\tconst filtered = filterAndSortSessions(nameFiltered, query, this.sortMode, \"all\");\n\t\t\tthis.filteredSessions = filtered.map((session) => ({\n\t\t\t\tsession,\n\t\t\t\tdepth: 0,\n\t\t\t\tisLast: true,\n\t\t\t\tancestorContinues: [],\n\t\t\t}));\n\t\t}\n\t\tthis.selectedIndex = Math.min(this.selectedIndex, Math.max(0, this.filteredSessions.length - 1));\n\t}\n\n\tprivate setConfirmingDeletePath(path: string | null): void {\n\t\tthis.confirmingDeletePath = path;\n\t\tthis.onDeleteConfirmationChange?.(path);\n\t}\n\n\tprivate startDeleteConfirmationForSelectedSession(): void {\n\t\tconst selected = this.filteredSessions[this.selectedIndex];\n\t\tif (!selected) return;\n\n\t\t// Prevent deleting current session\n\t\tif (this.isCurrentSessionPath(selected.session.path)) {\n\t\t\tthis.onError?.(\"Cannot delete the currently active session\");\n\t\t\treturn;\n\t\t}\n\n\t\tthis.setConfirmingDeletePath(selected.session.path);\n\t}\n\n\tprivate isCurrentSessionPath(path: string): boolean {\n\t\tif (!this.currentSessionPathKey) return false;\n\t\treturn getSessionPathKey(path) === this.currentSessionPathKey;\n\t}\n\n\tinvalidate(): void {}\n\n\trender(width: number): string[] {\n\t\tconst lines: string[] = [];\n\n\t\t// Render search input\n\t\tlines.push(...this.searchInput.render(width));\n\t\tlines.push(\"\"); // Blank line after search\n\n\t\tif (this.filteredSessions.length === 0) {\n\t\t\tlet emptyMessage: string;\n\t\t\tif (this.nameFilter === \"named\") {\n\t\t\t\tconst toggleKey = keyText(\"app.session.toggleNamedFilter\");\n\t\t\t\tif (this.showCwd) {\n\t\t\t\t\temptyMessage = ` No named sessions found. Press ${toggleKey} to show all.`;\n\t\t\t\t} else {\n\t\t\t\t\temptyMessage = ` No named sessions in current folder. Press ${toggleKey} to show all, or Tab to view all.`;\n\t\t\t\t}\n\t\t\t} else if (this.showCwd) {\n\t\t\t\t// \"All\" scope - no sessions anywhere that match filter\n\t\t\t\temptyMessage = \" No sessions found\";\n\t\t\t} else {\n\t\t\t\t// \"Current folder\" scope - hint to try \"all\"\n\t\t\t\temptyMessage = \" No sessions in current folder. Press Tab to view all.\";\n\t\t\t}\n\t\t\tlines.push(theme.fg(\"muted\", truncateToWidth(emptyMessage, width, \"…\")));\n\t\t\treturn lines;\n\t\t}\n\n\t\t// Calculate visible range with scrolling\n\t\tconst startIndex = Math.max(\n\t\t\t0,\n\t\t\tMath.min(this.selectedIndex - Math.floor(this.maxVisible / 2), this.filteredSessions.length - this.maxVisible),\n\t\t);\n\t\tconst endIndex = Math.min(startIndex + this.maxVisible, this.filteredSessions.length);\n\n\t\t// Render visible sessions (one line each with tree structure)\n\t\tfor (let i = startIndex; i < endIndex; i++) {\n\t\t\tconst node = this.filteredSessions[i]!;\n\t\t\tconst session = node.session;\n\t\t\tconst isSelected = i === this.selectedIndex;\n\t\t\tconst isConfirmingDelete = session.path === this.confirmingDeletePath;\n\t\t\tconst isCurrent = this.isCurrentSessionPath(session.path);\n\n\t\t\t// Build tree prefix\n\t\t\tconst prefix = this.buildTreePrefix(node);\n\n\t\t\t// Session display text (name or first message)\n\t\t\tconst hasName = !!session.name;\n\t\t\tconst displayText = session.name ?? session.firstMessage;\n\t\t\tconst normalizedMessage = displayText.replace(/[\\x00-\\x1f\\x7f]/g, \" \").trim();\n\n\t\t\t// Right side: message count and age\n\t\t\tconst age = formatSessionDate(session.modified);\n\t\t\tconst msgCount = String(session.messageCount);\n\t\t\tlet rightPart = `${msgCount} ${age}`;\n\t\t\tif (this.showCwd && session.cwd) {\n\t\t\t\trightPart = `${shortenHomePath(session.cwd)} ${rightPart}`;\n\t\t\t}\n\t\t\tif (this.showPath) {\n\t\t\t\trightPart = `${shortenHomePath(session.path)} ${rightPart}`;\n\t\t\t}\n\n\t\t\t// Cursor\n\t\t\tconst cursor = isSelected ? theme.fg(\"accent\", \"› \") : \" \";\n\n\t\t\t// Calculate available width for message\n\t\t\tconst prefixWidth = visibleWidth(prefix);\n\t\t\tconst rightWidth = visibleWidth(rightPart) + 2; // +2 for spacing\n\t\t\tconst availableForMsg = width - 2 - prefixWidth - rightWidth; // -2 for cursor\n\n\t\t\tconst truncatedMsg = truncateToWidth(normalizedMessage, Math.max(10, availableForMsg), \"…\");\n\n\t\t\t// Style message\n\t\t\tlet messageColor: \"error\" | \"warning\" | \"accent\" | null = null;\n\t\t\tif (isConfirmingDelete) {\n\t\t\t\tmessageColor = \"error\";\n\t\t\t} else if (isCurrent) {\n\t\t\t\tmessageColor = \"accent\";\n\t\t\t} else if (hasName) {\n\t\t\t\tmessageColor = \"warning\";\n\t\t\t}\n\t\t\tlet styledMsg = messageColor ? theme.fg(messageColor, truncatedMsg) : truncatedMsg;\n\t\t\tif (isSelected) {\n\t\t\t\tstyledMsg = theme.bold(styledMsg);\n\t\t\t}\n\n\t\t\t// Build line\n\t\t\tconst leftPart = cursor + theme.fg(\"dim\", prefix) + styledMsg;\n\t\t\tconst leftWidth = visibleWidth(leftPart);\n\t\t\tconst spacing = Math.max(1, width - leftWidth - visibleWidth(rightPart));\n\t\t\tconst styledRight = theme.fg(isConfirmingDelete ? \"error\" : \"dim\", rightPart);\n\n\t\t\tlet line = leftPart + \" \".repeat(spacing) + styledRight;\n\t\t\tif (isSelected) {\n\t\t\t\tline = theme.bg(\"selectedBg\", line);\n\t\t\t}\n\t\t\tlines.push(truncateToWidth(line, width));\n\t\t}\n\n\t\t// Add scroll indicator if needed\n\t\tif (startIndex > 0 || endIndex < this.filteredSessions.length) {\n\t\t\tconst scrollText = ` (${this.selectedIndex + 1}/${this.filteredSessions.length})`;\n\t\t\tconst scrollInfo = theme.fg(\"muted\", truncateToWidth(scrollText, width, \"\"));\n\t\t\tlines.push(scrollInfo);\n\t\t}\n\n\t\treturn lines;\n\t}\n\n\tprivate buildTreePrefix(node: FlatSessionNode): string {\n\t\tif (node.depth === 0) {\n\t\t\treturn \"\";\n\t\t}\n\n\t\tconst parts = node.ancestorContinues.map((continues) => (continues ? \"│ \" : \" \"));\n\t\tconst branch = node.isLast ? \"└─ \" : \"├─ \";\n\t\treturn parts.join(\"\") + branch;\n\t}\n\n\thandleInput(keyData: string): void {\n\t\tconst kb = getKeybindings();\n\n\t\t// Handle delete confirmation state first - intercept all keys\n\t\tif (this.confirmingDeletePath !== null) {\n\t\t\tif (kb.matches(keyData, \"tui.select.confirm\")) {\n\t\t\t\tconst pathToDelete = this.confirmingDeletePath;\n\t\t\t\tthis.setConfirmingDeletePath(null);\n\t\t\t\tvoid this.onDeleteSession?.(pathToDelete);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (kb.matches(keyData, \"tui.select.cancel\")) {\n\t\t\t\tthis.setConfirmingDeletePath(null);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Ignore all other keys while confirming\n\t\t\treturn;\n\t\t}\n\n\t\tif (kb.matches(keyData, \"tui.input.tab\")) {\n\t\t\tif (this.onToggleScope) {\n\t\t\t\tthis.onToggleScope();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (kb.matches(keyData, \"app.session.toggleSort\")) {\n\t\t\tthis.onToggleSort?.();\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.keybindings.matches(keyData, \"app.session.toggleNamedFilter\")) {\n\t\t\tthis.onToggleNameFilter?.();\n\t\t\treturn;\n\t\t}\n\n\t\t// Ctrl+P: toggle path display\n\t\tif (kb.matches(keyData, \"app.session.togglePath\")) {\n\t\t\tthis.showPath = !this.showPath;\n\t\t\tthis.onTogglePath?.(this.showPath);\n\t\t\treturn;\n\t\t}\n\n\t\t// Ctrl+D: initiate delete confirmation (useful on terminals that don't distinguish Ctrl+Backspace from Backspace)\n\t\tif (kb.matches(keyData, \"app.session.delete\")) {\n\t\t\tthis.startDeleteConfirmationForSelectedSession();\n\t\t\treturn;\n\t\t}\n\n\t\t// Rename selected session\n\t\tif (kb.matches(keyData, \"app.session.rename\")) {\n\t\t\tconst selected = this.filteredSessions[this.selectedIndex];\n\t\t\tif (selected) {\n\t\t\t\tthis.onRenameSession?.(selected.session.path);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Ctrl+Backspace: non-invasive convenience alias for delete\n\t\t// Only triggers deletion when the query is empty; otherwise it is forwarded to the input\n\t\tif (kb.matches(keyData, \"app.session.deleteNoninvasive\")) {\n\t\t\tif (this.searchInput.getValue().length > 0) {\n\t\t\t\tthis.searchInput.handleInput(keyData);\n\t\t\t\tthis.filterSessions(this.searchInput.getValue());\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.startDeleteConfirmationForSelectedSession();\n\t\t\treturn;\n\t\t}\n\n\t\tthis.selectionTouched = true;\n\t\tthis.pendingSelectedPath = undefined;\n\t\t// Up arrow\n\t\tif (kb.matches(keyData, \"tui.select.up\")) {\n\t\t\tthis.selectedIndex = Math.max(0, this.selectedIndex - 1);\n\t\t}\n\t\t// Down arrow\n\t\telse if (kb.matches(keyData, \"tui.select.down\")) {\n\t\t\tthis.selectedIndex = Math.min(this.filteredSessions.length - 1, this.selectedIndex + 1);\n\t\t}\n\t\t// Page up - jump up by maxVisible items\n\t\telse if (kb.matches(keyData, \"tui.select.pageUp\")) {\n\t\t\tthis.selectedIndex = Math.max(0, this.selectedIndex - this.maxVisible);\n\t\t}\n\t\t// Page down - jump down by maxVisible items\n\t\telse if (kb.matches(keyData, \"tui.select.pageDown\")) {\n\t\t\tthis.selectedIndex = Math.min(this.filteredSessions.length - 1, this.selectedIndex + this.maxVisible);\n\t\t}\n\t\t// Enter\n\t\telse if (kb.matches(keyData, \"tui.select.confirm\")) {\n\t\t\tconst selected = this.filteredSessions[this.selectedIndex];\n\t\t\tif (selected && this.onSelect) {\n\t\t\t\tthis.onSelect(selected.session.path);\n\t\t\t}\n\t\t}\n\t\t// Escape - cancel\n\t\telse if (kb.matches(keyData, \"tui.select.cancel\")) {\n\t\t\tif (this.onCancel) {\n\t\t\t\tthis.onCancel();\n\t\t\t}\n\t\t}\n\t\t// Pass everything else to search input\n\t\telse {\n\t\t\tthis.searchInput.handleInput(keyData);\n\t\t\tthis.filterSessions(this.searchInput.getValue());\n\t\t}\n\t}\n}\n\ntype SessionsLoader = (onProgress?: SessionListProgress, signal?: AbortSignal) => Promise<SessionInfo[]>;\n\n/**\n * Delete a session file, trying the `trash` CLI first, then falling back to unlink\n */\nasync function deleteSessionFile(\n\tsessionPath: string,\n): Promise<{ ok: boolean; method: \"trash\" | \"unlink\"; error?: string }> {\n\t// Try `trash` first (if installed)\n\tconst trashArgs = sessionPath.startsWith(\"-\") ? [\"--\", sessionPath] : [sessionPath];\n\tconst trashResult = spawnSync(\"trash\", trashArgs, { encoding: \"utf-8\" });\n\n\tconst getTrashErrorHint = (): string | null => {\n\t\tconst parts: string[] = [];\n\t\tif (trashResult.error) {\n\t\t\tparts.push(trashResult.error.message);\n\t\t}\n\t\tconst stderr = trashResult.stderr?.trim();\n\t\tif (stderr) {\n\t\t\tparts.push(stderr.split(\"\\n\")[0] ?? stderr);\n\t\t}\n\t\tif (parts.length === 0) return null;\n\t\treturn `trash: ${parts.join(\" · \").slice(0, 200)}`;\n\t};\n\n\t// If trash reports success, or the file is gone afterwards, treat it as successful\n\tif (trashResult.status === 0 || !existsSync(sessionPath)) {\n\t\treturn { ok: true, method: \"trash\" };\n\t}\n\n\t// Fallback to permanent deletion\n\ttry {\n\t\tawait unlink(sessionPath);\n\t\treturn { ok: true, method: \"unlink\" };\n\t} catch (err) {\n\t\tconst unlinkError = err instanceof Error ? err.message : String(err);\n\t\tconst trashErrorHint = getTrashErrorHint();\n\t\tconst error = trashErrorHint ? `${unlinkError} (${trashErrorHint})` : unlinkError;\n\t\treturn { ok: false, method: \"unlink\", error };\n\t}\n}\n\n/**\n * Component that renders a session selector\n */\nexport class SessionSelectorComponent extends Container implements Focusable {\n\tget capturesViewportInput(): boolean {\n\t\treturn this.mode !== \"rename\";\n\t}\n\n\thandleInput(data: string): void {\n\t\tif (this.mode === \"rename\") {\n\t\t\tconst kb = getKeybindings();\n\t\t\tif (kb.matches(data, \"tui.select.cancel\")) {\n\t\t\t\tthis.exitRenameMode();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.renameInput.handleInput(data);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.sessionList.handleInput(data);\n\t}\n\n\tprivate canRename = true;\n\tprivate sessionList: SessionList;\n\tprivate header: SessionSelectorHeader;\n\tprivate keybindings: KeybindingsManager;\n\tprivate scope: SessionScope = \"current\";\n\tprivate sortMode: SortMode = \"threaded\";\n\tprivate nameFilter: NameFilter = \"all\";\n\tprivate currentSessions: SessionInfo[] | null = null;\n\tprivate allSessions: SessionInfo[] | null = null;\n\tprivate currentSessionsLoader: SessionsLoader;\n\tprivate allSessionsLoader: SessionsLoader;\n\tprivate requestRender: () => void;\n\tprivate renameSession?: (sessionPath: string, currentName: string | undefined) => Promise<void>;\n\tprivate currentLoad: AbortController | null = null;\n\tprivate allLoad: AbortController | null = null;\n\n\tprivate mode: \"list\" | \"rename\" = \"list\";\n\tprivate renameInput = new Input();\n\tprivate renameTargetPath: string | null = null;\n\n\t// Focusable implementation - propagate to sessionList for IME cursor positioning\n\tprivate _focused = false;\n\tget focused(): boolean {\n\t\treturn this._focused;\n\t}\n\tset focused(value: boolean) {\n\t\tthis._focused = value;\n\t\tthis.sessionList.focused = value;\n\t\tthis.renameInput.focused = value;\n\t\tif (value && this.mode === \"rename\") {\n\t\t\tthis.renameInput.focused = true;\n\t\t}\n\t}\n\n\tprivate buildBaseLayout(content: Component, options?: { showHeader?: boolean }): void {\n\t\tthis.clear();\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild(new DynamicBorder((s) => theme.fg(\"accent\", s)));\n\t\tthis.addChild(new Spacer(1));\n\t\tif (options?.showHeader ?? true) {\n\t\t\tthis.addChild(this.header);\n\t\t\tthis.addChild(new Spacer(1));\n\t\t}\n\t\tthis.addChild(content);\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild(new DynamicBorder((s) => theme.fg(\"accent\", s)));\n\t}\n\n\tconstructor(\n\t\tcurrentSessionsLoader: SessionsLoader,\n\t\tallSessionsLoader: SessionsLoader,\n\t\tonSelect: (sessionPath: string) => void,\n\t\tonCancel: () => void,\n\t\tonExit: () => void,\n\t\trequestRender: () => void,\n\t\toptions?: {\n\t\t\trenameSession?: (sessionPath: string, currentName: string | undefined) => Promise<void>;\n\t\t\tshowRenameHint?: boolean;\n\t\t\tkeybindings?: KeybindingsManager;\n\t\t},\n\t\tcurrentSessionFilePath?: string,\n\t) {\n\t\tsuper();\n\t\tthis.keybindings = options?.keybindings ?? KeybindingsManager.create();\n\t\tthis.currentSessionsLoader = currentSessionsLoader;\n\t\tthis.allSessionsLoader = allSessionsLoader;\n\t\tthis.requestRender = requestRender;\n\t\tthis.header = new SessionSelectorHeader(this.scope, this.sortMode, this.nameFilter, this.requestRender);\n\t\tconst renameSession = options?.renameSession;\n\t\tthis.renameSession = renameSession;\n\t\tthis.canRename = !!renameSession;\n\t\tthis.header.setShowRenameHint(options?.showRenameHint ?? this.canRename);\n\n\t\t// Create session list (starts empty, will be populated after load)\n\t\tthis.sessionList = new SessionList(\n\t\t\t[],\n\t\t\tfalse,\n\t\t\tthis.sortMode,\n\t\t\tthis.nameFilter,\n\t\t\tthis.keybindings,\n\t\t\tcurrentSessionFilePath,\n\t\t);\n\n\t\tthis.buildBaseLayout(this.sessionList);\n\n\t\tthis.renameInput.onSubmit = (value) => {\n\t\t\tvoid this.confirmRename(value);\n\t\t};\n\n\t\t// Ensure header status timeouts are cleared when leaving the selector\n\t\tconst clearStatusMessage = () => this.header.setStatusMessage(null);\n\t\tthis.sessionList.onSelect = (sessionPath) => {\n\t\t\tclearStatusMessage();\n\t\t\tthis.cancelLoads();\n\t\t\tonSelect(sessionPath);\n\t\t};\n\t\tthis.sessionList.onCancel = () => {\n\t\t\tclearStatusMessage();\n\t\t\tthis.cancelLoads();\n\t\t\tonCancel();\n\t\t};\n\t\tthis.sessionList.onExit = () => {\n\t\t\tclearStatusMessage();\n\t\t\tthis.cancelLoads();\n\t\t\tonExit();\n\t\t};\n\t\tthis.sessionList.onToggleScope = () => this.toggleScope();\n\t\tthis.sessionList.onToggleSort = () => this.toggleSortMode();\n\t\tthis.sessionList.onToggleNameFilter = () => this.toggleNameFilter();\n\t\tthis.sessionList.onRenameSession = (sessionPath) => {\n\t\t\tif (!renameSession) return;\n\t\t\tif (this.scope === \"current\" ? this.currentLoad : this.allLoad) return;\n\n\t\t\tconst sessions = this.scope === \"all\" ? (this.allSessions ?? []) : (this.currentSessions ?? []);\n\t\t\tconst session = sessions.find((s) => s.path === sessionPath);\n\t\t\tthis.enterRenameMode(sessionPath, session?.name);\n\t\t};\n\n\t\t// Sync list events to header\n\t\tthis.sessionList.onTogglePath = (showPath) => {\n\t\t\tthis.header.setShowPath(showPath);\n\t\t\tthis.requestRender();\n\t\t};\n\t\tthis.sessionList.onDeleteConfirmationChange = (path) => {\n\t\t\tthis.header.setConfirmingDeletePath(path);\n\t\t\tthis.requestRender();\n\t\t};\n\t\tthis.sessionList.onError = (msg) => {\n\t\t\tthis.header.setStatusMessage({ type: \"error\", message: msg }, 3000);\n\t\t\tthis.requestRender();\n\t\t};\n\n\t\t// Handle session deletion\n\t\tthis.sessionList.onDeleteSession = async (sessionPath: string) => {\n\t\t\tconst result = await deleteSessionFile(sessionPath);\n\n\t\t\tif (result.ok) {\n\t\t\t\tif (this.currentSessions) {\n\t\t\t\t\tthis.currentSessions = this.currentSessions.filter((s) => s.path !== sessionPath);\n\t\t\t\t}\n\t\t\t\tif (this.allSessions) {\n\t\t\t\t\tthis.allSessions = this.allSessions.filter((s) => s.path !== sessionPath);\n\t\t\t\t}\n\n\t\t\t\tconst sessions = this.scope === \"all\" ? (this.allSessions ?? []) : (this.currentSessions ?? []);\n\t\t\t\tconst showCwd = this.scope === \"all\";\n\t\t\t\tthis.sessionList.setSessions(sessions, showCwd);\n\n\t\t\t\tconst msg = result.method === \"trash\" ? \"Session moved to trash\" : \"Session deleted\";\n\t\t\t\tthis.header.setStatusMessage({ type: \"info\", message: msg }, 2000);\n\t\t\t\tawait this.refreshSessionsAfterMutation();\n\t\t\t} else {\n\t\t\t\tconst errorMessage = result.error ?? \"Unknown error\";\n\t\t\t\tthis.header.setStatusMessage({ type: \"error\", message: `Failed to delete: ${errorMessage}` }, 3000);\n\t\t\t}\n\n\t\t\tthis.requestRender();\n\t\t};\n\n\t\t// Start loading current sessions immediately\n\t\tvoid this.loadScope(\"current\");\n\t}\n\n\tprivate cancelLoads(): void {\n\t\tif (this.currentLoad) {\n\t\t\tthis.currentLoad.abort();\n\t\t\tthis.currentLoad = null;\n\t\t\tthis.currentSessions = null;\n\t\t}\n\t\tif (this.allLoad) {\n\t\t\tthis.allLoad.abort();\n\t\t\tthis.allLoad = null;\n\t\t\tthis.allSessions = null;\n\t\t}\n\t}\n\n\tprivate enterRenameMode(sessionPath: string, currentName: string | undefined): void {\n\t\tthis.mode = \"rename\";\n\t\tthis.renameTargetPath = sessionPath;\n\t\tthis.renameInput.setValue(currentName ?? \"\");\n\t\tthis.renameInput.focused = true;\n\n\t\tconst panel = new Container();\n\t\tpanel.addChild(new Text(theme.bold(\"Rename Session\"), 1, 0));\n\t\tpanel.addChild(new Spacer(1));\n\t\tpanel.addChild(this.renameInput);\n\t\tpanel.addChild(new Spacer(1));\n\t\tpanel.addChild(\n\t\t\tnew Text(\n\t\t\t\ttheme.fg(\"muted\", `${keyText(\"tui.select.confirm\")} to save · ${keyText(\"tui.select.cancel\")} to cancel`),\n\t\t\t\t1,\n\t\t\t\t0,\n\t\t\t),\n\t\t);\n\n\t\tthis.buildBaseLayout(panel, { showHeader: false });\n\t\tthis.requestRender();\n\t}\n\n\tprivate exitRenameMode(): void {\n\t\tthis.mode = \"list\";\n\t\tthis.renameTargetPath = null;\n\n\t\tthis.buildBaseLayout(this.sessionList);\n\n\t\tthis.requestRender();\n\t}\n\n\tprivate async confirmRename(value: string): Promise<void> {\n\t\tconst next = value.trim();\n\t\tif (!next) return;\n\t\tconst target = this.renameTargetPath;\n\t\tif (!target) {\n\t\t\tthis.exitRenameMode();\n\t\t\treturn;\n\t\t}\n\n\t\t// Find current name for callback\n\t\tconst renameSession = this.renameSession;\n\t\tif (!renameSession) {\n\t\t\tthis.exitRenameMode();\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait renameSession(target, next);\n\t\t\tawait this.refreshSessionsAfterMutation();\n\t\t} finally {\n\t\t\tthis.exitRenameMode();\n\t\t}\n\t}\n\n\tprivate async loadScope(scope: SessionScope): Promise<void> {\n\t\tif (scope === \"current\" ? this.currentLoad : this.allLoad) return;\n\n\t\tconst showCwd = scope === \"all\";\n\t\tconst controller = new AbortController();\n\t\tif (scope === \"current\") {\n\t\t\tthis.currentLoad = controller;\n\t\t} else {\n\t\t\tthis.allLoad = controller;\n\t\t}\n\t\tthis.header.setScope(scope);\n\t\tthis.header.setLoading(true);\n\t\tthis.requestRender();\n\n\t\tconst isActive = () => (scope === \"current\" ? this.currentLoad : this.allLoad) === controller;\n\t\tconst onProgress: SessionListProgress = (loaded, total, partialSessions) => {\n\t\t\tif (!isActive()) return;\n\t\t\tif (partialSessions) {\n\t\t\t\tconst sessions = [...partialSessions];\n\t\t\t\tif (scope === \"current\") {\n\t\t\t\t\tthis.currentSessions = sessions;\n\t\t\t\t} else {\n\t\t\t\t\tthis.allSessions = sessions;\n\t\t\t\t}\n\t\t\t\tif (scope === this.scope) this.sessionList.setSessions(sessions, showCwd, true);\n\t\t\t}\n\t\t\tif (scope !== this.scope) return;\n\t\t\tthis.header.setProgress(loaded, total);\n\t\t\tthis.requestRender();\n\t\t};\n\n\t\ttry {\n\t\t\tconst sessions = await (scope === \"current\"\n\t\t\t\t? this.currentSessionsLoader(onProgress, controller.signal)\n\t\t\t\t: this.allSessionsLoader(onProgress, controller.signal));\n\t\t\tif (!isActive()) return;\n\n\t\t\tif (scope === \"current\") {\n\t\t\t\tthis.currentSessions = sessions;\n\t\t\t\tthis.currentLoad = null;\n\t\t\t} else {\n\t\t\t\tthis.allSessions = sessions;\n\t\t\t\tthis.allLoad = null;\n\t\t\t}\n\n\t\t\tif (scope !== this.scope) return;\n\t\t\tthis.header.setLoading(false);\n\t\t\tthis.sessionList.setSessions(sessions, showCwd);\n\t\t\tthis.requestRender();\n\t\t} catch (err) {\n\t\t\tif (!isActive()) return;\n\t\t\tif (scope === \"current\") {\n\t\t\t\tthis.currentLoad = null;\n\t\t\t\tthis.currentSessions = null;\n\t\t\t} else {\n\t\t\t\tthis.allLoad = null;\n\t\t\t\tthis.allSessions = null;\n\t\t\t}\n\t\t\tif (scope !== this.scope) return;\n\n\t\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\t\tthis.header.setLoading(false);\n\t\t\tthis.header.setStatusMessage({ type: \"error\", message: `Failed to load sessions: ${message}` }, 4000);\n\t\t\tthis.sessionList.setSessions([], showCwd);\n\t\t\tthis.requestRender();\n\t\t}\n\t}\n\n\tprivate toggleSortMode(): void {\n\t\t// Cycle: threaded -> recent -> relevance -> threaded\n\t\tthis.sortMode = this.sortMode === \"threaded\" ? \"recent\" : this.sortMode === \"recent\" ? \"relevance\" : \"threaded\";\n\t\tthis.header.setSortMode(this.sortMode);\n\t\tthis.sessionList.setSortMode(this.sortMode);\n\t\tthis.requestRender();\n\t}\n\n\tprivate toggleNameFilter(): void {\n\t\tthis.nameFilter = this.nameFilter === \"all\" ? \"named\" : \"all\";\n\t\tthis.header.setNameFilter(this.nameFilter);\n\t\tthis.sessionList.setNameFilter(this.nameFilter);\n\t\tthis.requestRender();\n\t}\n\n\tprivate async refreshSessionsAfterMutation(): Promise<void> {\n\t\tthis.cancelLoads();\n\t\tthis.currentSessions = null;\n\t\tthis.allSessions = null;\n\t\tawait this.loadScope(this.scope);\n\t}\n\n\tprivate toggleScope(): void {\n\t\tthis.scope = this.scope === \"current\" ? \"all\" : \"current\";\n\t\tconst sessions = this.scope === \"current\" ? this.currentSessions : this.allSessions;\n\t\tconst loading = (this.scope === \"current\" ? this.currentLoad : this.allLoad) !== null;\n\t\tthis.header.setScope(this.scope);\n\t\tthis.header.setLoading(loading);\n\t\tthis.sessionList.setSessions(sessions ?? [], this.scope === \"all\", loading || sessions === null);\n\t\tthis.requestRender();\n\t\tif (sessions === null && !loading) void this.loadScope(this.scope);\n\t}\n\n\tgetSessionList(): SessionList {\n\t\treturn this.sessionList;\n\t}\n}\n"]}
1
+ {"version":3,"file":"session-selector.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/session-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAEN,SAAS,EAET,cAAc,EACd,KAAK,EACL,MAAM,EACN,IAAI,EACJ,eAAe,EACf,YAAY,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAkC,MAAM,8BAA8B,CAAC;AAIrH,SAAS,iBAAiB,CAAC,IAAU;IACpC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;IAC9C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,C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;IACpE,CAAC;IAED,cAAc;QACb,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;CACD","sourcesContent":["import { spawnSync } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport { unlink } from \"node:fs/promises\";\nimport {\n\ttype Component,\n\tContainer,\n\ttype Focusable,\n\tgetKeybindings,\n\tInput,\n\tSpacer,\n\tText,\n\ttruncateToWidth,\n\tvisibleWidth,\n} from \"@draht/tui\";\nimport { KeybindingsManager } from \"../../../core/keybindings.js\";\nimport type { SessionInfo, SessionListProgress } from \"../../../core/session-manager.js\";\nimport { comparablePath } from \"../../../utils/canonical-path.js\";\nimport { getPathComparisonKey, shortenHomePath } from \"../../../utils/paths.js\";\nimport { theme } from \"../theme/theme.js\";\nimport { DynamicBorder } from \"./dynamic-border.js\";\nimport { keyHint, keyText } from \"./keybinding-hints.js\";\nimport { filterAndSortSessions, hasSessionName, type NameFilter, type SortMode } from \"./session-selector-search.js\";\n\ntype SessionScope = \"current\" | \"all\";\n\nfunction formatSessionDate(date: Date): string {\n\tconst now = new Date();\n\tconst diffMs = now.getTime() - date.getTime();\n\tconst diffMins = Math.floor(diffMs / 60000);\n\tconst diffHours = Math.floor(diffMs / 3600000);\n\tconst diffDays = Math.floor(diffMs / 86400000);\n\n\tif (diffMins < 1) return \"now\";\n\tif (diffMins < 60) return `${diffMins}m`;\n\tif (diffHours < 24) return `${diffHours}h`;\n\tif (diffDays < 7) return `${diffDays}d`;\n\tif (diffDays < 30) return `${Math.floor(diffDays / 7)}w`;\n\tif (diffDays < 365) return `${Math.floor(diffDays / 30)}mo`;\n\treturn `${Math.floor(diffDays / 365)}y`;\n}\n\n// Called per row per render, and the walk costs a syscall per segment. Session files are\n// append-only, so a path's identity does not change under us.\nconst sessionPathKeyCache = new Map<string, string>();\n\n/** Comparison key for a session file path; follows symlinks and ignores case on Windows. */\nfunction getSessionPathKey(path: string): string {\n\tconst cached = sessionPathKeyCache.get(path);\n\tif (cached !== undefined) return cached;\n\tconst key = getPathComparisonKey(comparablePath(path));\n\tsessionPathKeyCache.set(path, key);\n\treturn key;\n}\n\nclass SessionSelectorHeader implements Component {\n\tprivate scope: SessionScope;\n\tprivate sortMode: SortMode;\n\tprivate nameFilter: NameFilter;\n\tprivate requestRender: () => void;\n\tprivate loading = false;\n\tprivate loadProgress: { loaded: number; total: number } | null = null;\n\tprivate showPath = false;\n\tprivate confirmingDeletePath: string | null = null;\n\tprivate statusMessage: { type: \"info\" | \"error\"; message: string } | null = null;\n\tprivate statusTimeout: ReturnType<typeof setTimeout> | null = null;\n\tprivate showRenameHint = false;\n\n\tconstructor(scope: SessionScope, sortMode: SortMode, nameFilter: NameFilter, requestRender: () => void) {\n\t\tthis.scope = scope;\n\t\tthis.sortMode = sortMode;\n\t\tthis.nameFilter = nameFilter;\n\t\tthis.requestRender = requestRender;\n\t}\n\n\tsetScope(scope: SessionScope): void {\n\t\tthis.scope = scope;\n\t}\n\n\tsetSortMode(sortMode: SortMode): void {\n\t\tthis.sortMode = sortMode;\n\t}\n\n\tsetNameFilter(nameFilter: NameFilter): void {\n\t\tthis.nameFilter = nameFilter;\n\t}\n\n\tsetLoading(loading: boolean): void {\n\t\tthis.loading = loading;\n\t\t// Progress is scoped to the current load; clear whenever the loading state is set\n\t\tthis.loadProgress = null;\n\t}\n\n\tsetProgress(loaded: number, total: number): void {\n\t\tthis.loadProgress = { loaded, total };\n\t}\n\n\tsetShowPath(showPath: boolean): void {\n\t\tthis.showPath = showPath;\n\t}\n\n\tsetShowRenameHint(show: boolean): void {\n\t\tthis.showRenameHint = show;\n\t}\n\n\tsetConfirmingDeletePath(path: string | null): void {\n\t\tthis.confirmingDeletePath = path;\n\t}\n\n\tprivate clearStatusTimeout(): void {\n\t\tif (!this.statusTimeout) return;\n\t\tclearTimeout(this.statusTimeout);\n\t\tthis.statusTimeout = null;\n\t}\n\n\tsetStatusMessage(msg: { type: \"info\" | \"error\"; message: string } | null, autoHideMs?: number): void {\n\t\tthis.clearStatusTimeout();\n\t\tthis.statusMessage = msg;\n\t\tif (!msg || !autoHideMs) return;\n\n\t\tthis.statusTimeout = setTimeout(() => {\n\t\t\tthis.statusMessage = null;\n\t\t\tthis.statusTimeout = null;\n\t\t\tthis.requestRender();\n\t\t}, autoHideMs);\n\t}\n\n\tinvalidate(): void {}\n\n\trender(width: number): string[] {\n\t\tconst title = this.scope === \"current\" ? \"Resume Session (Current Folder)\" : \"Resume Session (All)\";\n\t\tconst leftText = theme.bold(title);\n\n\t\tconst sortLabel = this.sortMode === \"threaded\" ? \"Threaded\" : this.sortMode === \"recent\" ? \"Recent\" : \"Fuzzy\";\n\t\tconst sortText = theme.fg(\"muted\", \"Sort: \") + theme.fg(\"accent\", sortLabel);\n\n\t\tconst nameLabel = this.nameFilter === \"all\" ? \"All\" : \"Named\";\n\t\tconst nameText = theme.fg(\"muted\", \"Name: \") + theme.fg(\"accent\", nameLabel);\n\n\t\tlet scopeText: string;\n\t\tif (this.loading) {\n\t\t\tconst progressText = this.loadProgress ? `${this.loadProgress.loaded}/${this.loadProgress.total}` : \"...\";\n\t\t\tscopeText = `${theme.fg(\"muted\", \"○ Current Folder | \")}${theme.fg(\"accent\", `Loading ${progressText}`)}`;\n\t\t} else if (this.scope === \"current\") {\n\t\t\tscopeText = `${theme.fg(\"accent\", \"◉ Current Folder\")}${theme.fg(\"muted\", \" | ○ All\")}`;\n\t\t} else {\n\t\t\tscopeText = `${theme.fg(\"muted\", \"○ Current Folder | \")}${theme.fg(\"accent\", \"◉ All\")}`;\n\t\t}\n\n\t\tconst rightText = truncateToWidth(`${scopeText} ${nameText} ${sortText}`, width, \"\");\n\t\tconst availableLeft = Math.max(0, width - visibleWidth(rightText) - 1);\n\t\tconst left = truncateToWidth(leftText, availableLeft, \"\");\n\t\tconst spacing = Math.max(0, width - visibleWidth(left) - visibleWidth(rightText));\n\n\t\t// Build hint lines - changes based on state (all branches truncate to width)\n\t\tlet hintLine1: string;\n\t\tlet hintLine2: string;\n\t\tif (this.confirmingDeletePath !== null) {\n\t\t\tconst confirmHint = `Delete session? ${keyHint(\"tui.select.confirm\", \"confirm\")} · ${keyHint(\"tui.select.cancel\", \"cancel\")}`;\n\t\t\thintLine1 = theme.fg(\"error\", truncateToWidth(confirmHint, width, \"…\"));\n\t\t\thintLine2 = \"\";\n\t\t} else if (this.statusMessage) {\n\t\t\tconst color = this.statusMessage.type === \"error\" ? \"error\" : \"accent\";\n\t\t\thintLine1 = theme.fg(color, truncateToWidth(this.statusMessage.message, width, \"…\"));\n\t\t\thintLine2 = \"\";\n\t\t} else {\n\t\t\tconst pathState = this.showPath ? \"(on)\" : \"(off)\";\n\t\t\tconst sep = theme.fg(\"muted\", \" · \");\n\t\t\tconst hint1 =\n\t\t\t\tkeyHint(\"tui.input.tab\", \"scope\") + sep + theme.fg(\"muted\", 're:<pattern> regex · \"phrase\" exact');\n\t\t\tconst hint2Parts = [\n\t\t\t\tkeyHint(\"app.session.toggleSort\", \"sort\"),\n\t\t\t\tkeyHint(\"app.session.toggleNamedFilter\", \"named\"),\n\t\t\t\tkeyHint(\"app.session.delete\", \"delete\"),\n\t\t\t\tkeyHint(\"app.session.togglePath\", `path ${pathState}`),\n\t\t\t];\n\t\t\tif (this.showRenameHint) {\n\t\t\t\thint2Parts.push(keyHint(\"app.session.rename\", \"rename\"));\n\t\t\t}\n\t\t\tconst hint2 = hint2Parts.join(sep);\n\t\t\thintLine1 = truncateToWidth(hint1, width, \"…\");\n\t\t\thintLine2 = truncateToWidth(hint2, width, \"…\");\n\t\t}\n\n\t\treturn [`${left}${\" \".repeat(spacing)}${rightText}`, hintLine1, hintLine2];\n\t}\n}\n\n/** A session tree node for hierarchical display */\ninterface SessionTreeNode {\n\tsession: SessionInfo;\n\tchildren: SessionTreeNode[];\n\tlatestActivity: number;\n}\n\n/** Flattened node for display with tree structure info */\ninterface FlatSessionNode {\n\tsession: SessionInfo;\n\tdepth: number;\n\tisLast: boolean;\n\t/** For each ancestor level, whether there are more siblings after it */\n\tancestorContinues: boolean[];\n}\n\n/**\n * Build a tree structure from sessions based on parentSessionPath.\n * Returns root nodes sorted by modified date (descending).\n */\nfunction buildSessionTree(sessions: SessionInfo[]): SessionTreeNode[] {\n\tconst byPath = new Map<string, SessionTreeNode>();\n\n\tfor (const session of sessions) {\n\t\tconst sessionPath = getSessionPathKey(session.path);\n\t\tbyPath.set(sessionPath, { session, children: [], latestActivity: session.modified.getTime() });\n\t}\n\n\tconst roots: SessionTreeNode[] = [];\n\n\tfor (const session of sessions) {\n\t\tconst sessionPath = getSessionPathKey(session.path);\n\t\tconst node = byPath.get(sessionPath)!;\n\t\tconst parentPath = session.parentSessionPath ? getSessionPathKey(session.parentSessionPath) : undefined;\n\n\t\tif (parentPath && byPath.has(parentPath)) {\n\t\t\tbyPath.get(parentPath)!.children.push(node);\n\t\t} else {\n\t\t\troots.push(node);\n\t\t}\n\t}\n\n\tconst updateLatestActivity = (node: SessionTreeNode): number => {\n\t\tlet latestActivity = node.session.modified.getTime();\n\t\tfor (const child of node.children) {\n\t\t\tlatestActivity = Math.max(latestActivity, updateLatestActivity(child));\n\t\t}\n\t\tnode.latestActivity = latestActivity;\n\t\treturn latestActivity;\n\t};\n\n\tfor (const root of roots) {\n\t\tupdateLatestActivity(root);\n\t}\n\n\t// Sort children and roots by latest activity in each subtree (descending)\n\tconst sortNodes = (nodes: SessionTreeNode[]): void => {\n\t\tnodes.sort((a, b) => b.latestActivity - a.latestActivity);\n\t\tfor (const node of nodes) {\n\t\t\tsortNodes(node.children);\n\t\t}\n\t};\n\tsortNodes(roots);\n\n\treturn roots;\n}\n\n/**\n * Flatten tree into display list with tree structure metadata.\n */\nfunction flattenSessionTree(roots: SessionTreeNode[]): FlatSessionNode[] {\n\tconst result: FlatSessionNode[] = [];\n\n\tconst walk = (node: SessionTreeNode, depth: number, ancestorContinues: boolean[], isLast: boolean): void => {\n\t\tresult.push({ session: node.session, depth, isLast, ancestorContinues });\n\n\t\tfor (let i = 0; i < node.children.length; i++) {\n\t\t\tconst childIsLast = i === node.children.length - 1;\n\t\t\t// Only show continuation line for non-root ancestors\n\t\t\tconst continues = depth > 0 ? !isLast : false;\n\t\t\twalk(node.children[i]!, depth + 1, [...ancestorContinues, continues], childIsLast);\n\t\t}\n\t};\n\n\tfor (let i = 0; i < roots.length; i++) {\n\t\twalk(roots[i]!, 0, [], i === roots.length - 1);\n\t}\n\n\treturn result;\n}\n\n/**\n * Custom session list component with multi-line items and search\n */\nclass SessionList implements Component, Focusable {\n\tpublic getSelectedSessionPath(): string | undefined {\n\t\tconst selected = this.filteredSessions[this.selectedIndex];\n\t\treturn selected?.session.path;\n\t}\n\tprivate allSessions: SessionInfo[] = [];\n\tprivate filteredSessions: FlatSessionNode[] = [];\n\tprivate selectedIndex: number = 0;\n\tprivate selectionTouched = false;\n\t// Session to select once it appears, while a progressive reload has not yet delivered it\n\tprivate pendingSelectedPath?: string;\n\tprivate searchInput: Input;\n\tprivate showCwd = false;\n\tprivate sortMode: SortMode = \"threaded\";\n\tprivate nameFilter: NameFilter = \"all\";\n\tprivate keybindings: KeybindingsManager;\n\tprivate showPath = false;\n\tprivate confirmingDeletePath: string | null = null;\n\tprivate currentSessionPathKey?: string;\n\tpublic onSelect?: (sessionPath: string) => void;\n\tpublic onCancel?: () => void;\n\tpublic onExit: () => void = () => {};\n\tpublic onToggleScope?: () => void;\n\tpublic onToggleSort?: () => void;\n\tpublic onToggleNameFilter?: () => void;\n\tpublic onTogglePath?: (showPath: boolean) => void;\n\tpublic onDeleteConfirmationChange?: (path: string | null) => void;\n\tpublic onDeleteSession?: (sessionPath: string) => Promise<void>;\n\tpublic onRenameSession?: (sessionPath: string) => void;\n\tpublic onError?: (message: string) => void;\n\tprivate maxVisible: number = 10; // Max sessions visible (one line each)\n\n\t// Focusable implementation - propagate to searchInput for IME cursor positioning\n\tprivate _focused = false;\n\tget focused(): boolean {\n\t\treturn this._focused;\n\t}\n\tset focused(value: boolean) {\n\t\tthis._focused = value;\n\t\tthis.searchInput.focused = value;\n\t}\n\n\tconstructor(\n\t\tsessions: SessionInfo[],\n\t\tshowCwd: boolean,\n\t\tsortMode: SortMode,\n\t\tnameFilter: NameFilter,\n\t\tkeybindings: KeybindingsManager,\n\t\tcurrentSessionFilePath?: string,\n\t) {\n\t\tthis.allSessions = sessions;\n\t\tthis.filteredSessions = [];\n\t\tthis.searchInput = new Input();\n\t\tthis.showCwd = showCwd;\n\t\tthis.sortMode = sortMode;\n\t\tthis.nameFilter = nameFilter;\n\t\tthis.keybindings = keybindings;\n\t\tthis.currentSessionPathKey = currentSessionFilePath ? getSessionPathKey(currentSessionFilePath) : undefined;\n\t\tthis.filterSessions(\"\");\n\n\t\t// Handle Enter in search input - select current item\n\t\tthis.searchInput.onSubmit = () => {\n\t\t\tif (this.filteredSessions[this.selectedIndex]) {\n\t\t\t\tconst selected = this.filteredSessions[this.selectedIndex];\n\t\t\t\tif (this.onSelect) {\n\t\t\t\t\tthis.onSelect(selected.session.path);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n\n\tsetSortMode(sortMode: SortMode): void {\n\t\tthis.sortMode = sortMode;\n\t\tthis.filterSessions(this.searchInput.getValue());\n\t}\n\n\tsetNameFilter(nameFilter: NameFilter): void {\n\t\tthis.nameFilter = nameFilter;\n\t\tthis.filterSessions(this.searchInput.getValue());\n\t}\n\n\t/**\n\t * @param partial true when more sessions are still loading; a selected session missing from a\n\t * partial list stays the selection target until it arrives\n\t */\n\tsetSessions(sessions: SessionInfo[], showCwd: boolean, partial = false): void {\n\t\tconst pendingPath = this.selectionTouched ? this.pendingSelectedPath : undefined;\n\t\tconst selectedPath = this.selectionTouched ? (pendingPath ?? this.getSelectedSessionPath()) : undefined;\n\t\tthis.allSessions = sessions;\n\t\tthis.showCwd = showCwd;\n\t\tthis.filterSessions(this.searchInput.getValue());\n\t\tif (!this.selectionTouched) {\n\t\t\tthis.selectedIndex = 0;\n\t\t} else if (selectedPath) {\n\t\t\tconst selectedIndex = this.filteredSessions.findIndex((node) => node.session.path === selectedPath);\n\t\t\tif (selectedIndex >= 0) {\n\t\t\t\tthis.selectedIndex = selectedIndex;\n\t\t\t\tthis.pendingSelectedPath = undefined;\n\t\t\t} else if (partial) {\n\t\t\t\t// The selected session may not have loaded yet: keep it as the target instead of\n\t\t\t\t// adopting whichever session the index now points to.\n\t\t\t\tthis.pendingSelectedPath = selectedPath;\n\t\t\t} else {\n\t\t\t\tthis.pendingSelectedPath = undefined;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate filterSessions(query: string): void {\n\t\tconst trimmed = query.trim();\n\t\tconst nameFiltered =\n\t\t\tthis.nameFilter === \"all\" ? this.allSessions : this.allSessions.filter((session) => hasSessionName(session));\n\n\t\tif (this.sortMode === \"threaded\" && !trimmed) {\n\t\t\t// Threaded mode without search: show tree structure\n\t\t\tconst roots = buildSessionTree(nameFiltered);\n\t\t\tthis.filteredSessions = flattenSessionTree(roots);\n\t\t} else {\n\t\t\t// Other modes or with search: flat list\n\t\t\tconst filtered = filterAndSortSessions(nameFiltered, query, this.sortMode, \"all\");\n\t\t\tthis.filteredSessions = filtered.map((session) => ({\n\t\t\t\tsession,\n\t\t\t\tdepth: 0,\n\t\t\t\tisLast: true,\n\t\t\t\tancestorContinues: [],\n\t\t\t}));\n\t\t}\n\t\tthis.selectedIndex = Math.min(this.selectedIndex, Math.max(0, this.filteredSessions.length - 1));\n\t}\n\n\tprivate setConfirmingDeletePath(path: string | null): void {\n\t\tthis.confirmingDeletePath = path;\n\t\tthis.onDeleteConfirmationChange?.(path);\n\t}\n\n\tprivate startDeleteConfirmationForSelectedSession(): void {\n\t\tconst selected = this.filteredSessions[this.selectedIndex];\n\t\tif (!selected) return;\n\n\t\t// Prevent deleting current session\n\t\tif (this.isCurrentSessionPath(selected.session.path)) {\n\t\t\tthis.onError?.(\"Cannot delete the currently active session\");\n\t\t\treturn;\n\t\t}\n\n\t\tthis.setConfirmingDeletePath(selected.session.path);\n\t}\n\n\tprivate isCurrentSessionPath(path: string): boolean {\n\t\tif (!this.currentSessionPathKey) return false;\n\t\treturn getSessionPathKey(path) === this.currentSessionPathKey;\n\t}\n\n\tinvalidate(): void {}\n\n\trender(width: number): string[] {\n\t\tconst lines: string[] = [];\n\n\t\t// Render search input\n\t\tlines.push(...this.searchInput.render(width));\n\t\tlines.push(\"\"); // Blank line after search\n\n\t\tif (this.filteredSessions.length === 0) {\n\t\t\tlet emptyMessage: string;\n\t\t\tif (this.nameFilter === \"named\") {\n\t\t\t\tconst toggleKey = keyText(\"app.session.toggleNamedFilter\");\n\t\t\t\tif (this.showCwd) {\n\t\t\t\t\temptyMessage = ` No named sessions found. Press ${toggleKey} to show all.`;\n\t\t\t\t} else {\n\t\t\t\t\temptyMessage = ` No named sessions in current folder. Press ${toggleKey} to show all, or Tab to view all.`;\n\t\t\t\t}\n\t\t\t} else if (this.showCwd) {\n\t\t\t\t// \"All\" scope - no sessions anywhere that match filter\n\t\t\t\temptyMessage = \" No sessions found\";\n\t\t\t} else {\n\t\t\t\t// \"Current folder\" scope - hint to try \"all\"\n\t\t\t\temptyMessage = \" No sessions in current folder. Press Tab to view all.\";\n\t\t\t}\n\t\t\tlines.push(theme.fg(\"muted\", truncateToWidth(emptyMessage, width, \"…\")));\n\t\t\treturn lines;\n\t\t}\n\n\t\t// Calculate visible range with scrolling\n\t\tconst startIndex = Math.max(\n\t\t\t0,\n\t\t\tMath.min(this.selectedIndex - Math.floor(this.maxVisible / 2), this.filteredSessions.length - this.maxVisible),\n\t\t);\n\t\tconst endIndex = Math.min(startIndex + this.maxVisible, this.filteredSessions.length);\n\n\t\t// Render visible sessions (one line each with tree structure)\n\t\tfor (let i = startIndex; i < endIndex; i++) {\n\t\t\tconst node = this.filteredSessions[i]!;\n\t\t\tconst session = node.session;\n\t\t\tconst isSelected = i === this.selectedIndex;\n\t\t\tconst isConfirmingDelete = session.path === this.confirmingDeletePath;\n\t\t\tconst isCurrent = this.isCurrentSessionPath(session.path);\n\n\t\t\t// Build tree prefix\n\t\t\tconst prefix = this.buildTreePrefix(node);\n\n\t\t\t// Session display text (name or first message)\n\t\t\tconst hasName = !!session.name;\n\t\t\tconst displayText = session.name ?? session.firstMessage;\n\t\t\tconst normalizedMessage = displayText.replace(/[\\x00-\\x1f\\x7f]/g, \" \").trim();\n\n\t\t\t// Right side: message count and age\n\t\t\tconst age = formatSessionDate(session.modified);\n\t\t\tconst msgCount = String(session.messageCount);\n\t\t\tlet rightPart = `${msgCount} ${age}`;\n\t\t\tif (this.showCwd && session.cwd) {\n\t\t\t\trightPart = `${shortenHomePath(session.cwd)} ${rightPart}`;\n\t\t\t}\n\t\t\tif (this.showPath) {\n\t\t\t\trightPart = `${shortenHomePath(session.path)} ${rightPart}`;\n\t\t\t}\n\n\t\t\t// Cursor\n\t\t\tconst cursor = isSelected ? theme.fg(\"accent\", \"› \") : \" \";\n\n\t\t\t// Calculate available width for message\n\t\t\tconst prefixWidth = visibleWidth(prefix);\n\t\t\tconst rightWidth = visibleWidth(rightPart) + 2; // +2 for spacing\n\t\t\tconst availableForMsg = width - 2 - prefixWidth - rightWidth; // -2 for cursor\n\n\t\t\tconst truncatedMsg = truncateToWidth(normalizedMessage, Math.max(10, availableForMsg), \"…\");\n\n\t\t\t// Style message\n\t\t\tlet messageColor: \"error\" | \"warning\" | \"accent\" | null = null;\n\t\t\tif (isConfirmingDelete) {\n\t\t\t\tmessageColor = \"error\";\n\t\t\t} else if (isCurrent) {\n\t\t\t\tmessageColor = \"accent\";\n\t\t\t} else if (hasName) {\n\t\t\t\tmessageColor = \"warning\";\n\t\t\t}\n\t\t\tlet styledMsg = messageColor ? theme.fg(messageColor, truncatedMsg) : truncatedMsg;\n\t\t\tif (isSelected) {\n\t\t\t\tstyledMsg = theme.bold(styledMsg);\n\t\t\t}\n\n\t\t\t// Build line\n\t\t\tconst leftPart = cursor + theme.fg(\"dim\", prefix) + styledMsg;\n\t\t\tconst leftWidth = visibleWidth(leftPart);\n\t\t\tconst spacing = Math.max(1, width - leftWidth - visibleWidth(rightPart));\n\t\t\tconst styledRight = theme.fg(isConfirmingDelete ? \"error\" : \"dim\", rightPart);\n\n\t\t\tlet line = leftPart + \" \".repeat(spacing) + styledRight;\n\t\t\tif (isSelected) {\n\t\t\t\tline = theme.bg(\"selectedBg\", line);\n\t\t\t}\n\t\t\tlines.push(truncateToWidth(line, width));\n\t\t}\n\n\t\t// Add scroll indicator if needed\n\t\tif (startIndex > 0 || endIndex < this.filteredSessions.length) {\n\t\t\tconst scrollText = ` (${this.selectedIndex + 1}/${this.filteredSessions.length})`;\n\t\t\tconst scrollInfo = theme.fg(\"muted\", truncateToWidth(scrollText, width, \"\"));\n\t\t\tlines.push(scrollInfo);\n\t\t}\n\n\t\treturn lines;\n\t}\n\n\tprivate buildTreePrefix(node: FlatSessionNode): string {\n\t\tif (node.depth === 0) {\n\t\t\treturn \"\";\n\t\t}\n\n\t\tconst parts = node.ancestorContinues.map((continues) => (continues ? \"│ \" : \" \"));\n\t\tconst branch = node.isLast ? \"└─ \" : \"├─ \";\n\t\treturn parts.join(\"\") + branch;\n\t}\n\n\thandleInput(keyData: string): void {\n\t\tconst kb = getKeybindings();\n\n\t\t// Handle delete confirmation state first - intercept all keys\n\t\tif (this.confirmingDeletePath !== null) {\n\t\t\tif (kb.matches(keyData, \"tui.select.confirm\")) {\n\t\t\t\tconst pathToDelete = this.confirmingDeletePath;\n\t\t\t\tthis.setConfirmingDeletePath(null);\n\t\t\t\tvoid this.onDeleteSession?.(pathToDelete);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (kb.matches(keyData, \"tui.select.cancel\")) {\n\t\t\t\tthis.setConfirmingDeletePath(null);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Ignore all other keys while confirming\n\t\t\treturn;\n\t\t}\n\n\t\tif (kb.matches(keyData, \"tui.input.tab\")) {\n\t\t\tif (this.onToggleScope) {\n\t\t\t\tthis.onToggleScope();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (kb.matches(keyData, \"app.session.toggleSort\")) {\n\t\t\tthis.onToggleSort?.();\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.keybindings.matches(keyData, \"app.session.toggleNamedFilter\")) {\n\t\t\tthis.onToggleNameFilter?.();\n\t\t\treturn;\n\t\t}\n\n\t\t// Ctrl+P: toggle path display\n\t\tif (kb.matches(keyData, \"app.session.togglePath\")) {\n\t\t\tthis.showPath = !this.showPath;\n\t\t\tthis.onTogglePath?.(this.showPath);\n\t\t\treturn;\n\t\t}\n\n\t\t// Ctrl+D: initiate delete confirmation (useful on terminals that don't distinguish Ctrl+Backspace from Backspace)\n\t\tif (kb.matches(keyData, \"app.session.delete\")) {\n\t\t\tthis.startDeleteConfirmationForSelectedSession();\n\t\t\treturn;\n\t\t}\n\n\t\t// Rename selected session\n\t\tif (kb.matches(keyData, \"app.session.rename\")) {\n\t\t\tconst selected = this.filteredSessions[this.selectedIndex];\n\t\t\tif (selected) {\n\t\t\t\tthis.onRenameSession?.(selected.session.path);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Ctrl+Backspace: non-invasive convenience alias for delete\n\t\t// Only triggers deletion when the query is empty; otherwise it is forwarded to the input\n\t\tif (kb.matches(keyData, \"app.session.deleteNoninvasive\")) {\n\t\t\tif (this.searchInput.getValue().length > 0) {\n\t\t\t\tthis.handleSearchInput(keyData);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.startDeleteConfirmationForSelectedSession();\n\t\t\treturn;\n\t\t}\n\n\t\tthis.selectionTouched = true;\n\t\tthis.pendingSelectedPath = undefined;\n\t\t// Up arrow\n\t\tif (kb.matches(keyData, \"tui.select.up\")) {\n\t\t\tthis.selectedIndex = Math.max(0, this.selectedIndex - 1);\n\t\t}\n\t\t// Down arrow\n\t\telse if (kb.matches(keyData, \"tui.select.down\")) {\n\t\t\tthis.selectedIndex = Math.min(this.filteredSessions.length - 1, this.selectedIndex + 1);\n\t\t}\n\t\t// Page up - jump up by maxVisible items\n\t\telse if (kb.matches(keyData, \"tui.select.pageUp\")) {\n\t\t\tthis.selectedIndex = Math.max(0, this.selectedIndex - this.maxVisible);\n\t\t}\n\t\t// Page down - jump down by maxVisible items\n\t\telse if (kb.matches(keyData, \"tui.select.pageDown\")) {\n\t\t\tthis.selectedIndex = Math.min(this.filteredSessions.length - 1, this.selectedIndex + this.maxVisible);\n\t\t}\n\t\t// Enter\n\t\telse if (kb.matches(keyData, \"tui.select.confirm\")) {\n\t\t\tconst selected = this.filteredSessions[this.selectedIndex];\n\t\t\tif (selected && this.onSelect) {\n\t\t\t\tthis.onSelect(selected.session.path);\n\t\t\t}\n\t\t}\n\t\t// Escape - cancel\n\t\telse if (kb.matches(keyData, \"tui.select.cancel\")) {\n\t\t\tif (this.onCancel) {\n\t\t\t\tthis.onCancel();\n\t\t\t}\n\t\t}\n\t\t// Pass everything else to search input\n\t\telse {\n\t\t\tthis.handleSearchInput(keyData);\n\t\t}\n\t}\n\n\t/** Applies a key to the search query; a changed, non-empty query selects the top row, the best match. */\n\tprivate handleSearchInput(keyData: string): void {\n\t\tconst previousQuery = this.searchInput.getValue();\n\t\tthis.searchInput.handleInput(keyData);\n\t\tconst query = this.searchInput.getValue();\n\t\t// Cursor keys leave the query as it is and must not move the selection.\n\t\tif (query === previousQuery) return;\n\t\tthis.filterSessions(query);\n\t\tif (!query.trim()) return;\n\t\tthis.selectedIndex = 0;\n\t\t// Untouched, sessions that are still loading keep the selection on the top row instead of on this session.\n\t\tthis.selectionTouched = false;\n\t\tthis.pendingSelectedPath = undefined;\n\t}\n}\n\ntype SessionsLoader = (onProgress?: SessionListProgress, signal?: AbortSignal) => Promise<SessionInfo[]>;\n\n/**\n * Delete a session file, trying the `trash` CLI first, then falling back to unlink\n */\nasync function deleteSessionFile(\n\tsessionPath: string,\n): Promise<{ ok: boolean; method: \"trash\" | \"unlink\"; error?: string }> {\n\t// Try `trash` first (if installed)\n\tconst trashArgs = sessionPath.startsWith(\"-\") ? [\"--\", sessionPath] : [sessionPath];\n\tconst trashResult = spawnSync(\"trash\", trashArgs, { encoding: \"utf-8\" });\n\n\tconst getTrashErrorHint = (): string | null => {\n\t\tconst parts: string[] = [];\n\t\tif (trashResult.error) {\n\t\t\tparts.push(trashResult.error.message);\n\t\t}\n\t\tconst stderr = trashResult.stderr?.trim();\n\t\tif (stderr) {\n\t\t\tparts.push(stderr.split(\"\\n\")[0] ?? stderr);\n\t\t}\n\t\tif (parts.length === 0) return null;\n\t\treturn `trash: ${parts.join(\" · \").slice(0, 200)}`;\n\t};\n\n\t// If trash reports success, or the file is gone afterwards, treat it as successful\n\tif (trashResult.status === 0 || !existsSync(sessionPath)) {\n\t\treturn { ok: true, method: \"trash\" };\n\t}\n\n\t// Fallback to permanent deletion\n\ttry {\n\t\tawait unlink(sessionPath);\n\t\treturn { ok: true, method: \"unlink\" };\n\t} catch (err) {\n\t\tconst unlinkError = err instanceof Error ? err.message : String(err);\n\t\tconst trashErrorHint = getTrashErrorHint();\n\t\tconst error = trashErrorHint ? `${unlinkError} (${trashErrorHint})` : unlinkError;\n\t\treturn { ok: false, method: \"unlink\", error };\n\t}\n}\n\n/**\n * Component that renders a session selector\n */\nexport class SessionSelectorComponent extends Container implements Focusable {\n\tget capturesViewportInput(): boolean {\n\t\treturn this.mode !== \"rename\";\n\t}\n\n\thandleInput(data: string): void {\n\t\tif (this.mode === \"rename\") {\n\t\t\tconst kb = getKeybindings();\n\t\t\tif (kb.matches(data, \"tui.select.cancel\")) {\n\t\t\t\tthis.exitRenameMode();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.renameInput.handleInput(data);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.sessionList.handleInput(data);\n\t}\n\n\tprivate canRename = true;\n\tprivate sessionList: SessionList;\n\tprivate header: SessionSelectorHeader;\n\tprivate keybindings: KeybindingsManager;\n\tprivate scope: SessionScope = \"current\";\n\tprivate sortMode: SortMode = \"threaded\";\n\tprivate nameFilter: NameFilter = \"all\";\n\tprivate currentSessions: SessionInfo[] | null = null;\n\tprivate allSessions: SessionInfo[] | null = null;\n\tprivate currentSessionsLoader: SessionsLoader;\n\tprivate allSessionsLoader: SessionsLoader;\n\tprivate requestRender: () => void;\n\tprivate renameSession?: (sessionPath: string, currentName: string | undefined) => Promise<void>;\n\tprivate currentLoad: AbortController | null = null;\n\tprivate allLoad: AbortController | null = null;\n\n\tprivate mode: \"list\" | \"rename\" = \"list\";\n\tprivate renameInput = new Input();\n\tprivate renameTargetPath: string | null = null;\n\n\t// Focusable implementation - propagate to sessionList for IME cursor positioning\n\tprivate _focused = false;\n\tget focused(): boolean {\n\t\treturn this._focused;\n\t}\n\tset focused(value: boolean) {\n\t\tthis._focused = value;\n\t\tthis.sessionList.focused = value;\n\t\tthis.renameInput.focused = value;\n\t\tif (value && this.mode === \"rename\") {\n\t\t\tthis.renameInput.focused = true;\n\t\t}\n\t}\n\n\tprivate buildBaseLayout(content: Component, options?: { showHeader?: boolean }): void {\n\t\tthis.clear();\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild(new DynamicBorder((s) => theme.fg(\"accent\", s)));\n\t\tthis.addChild(new Spacer(1));\n\t\tif (options?.showHeader ?? true) {\n\t\t\tthis.addChild(this.header);\n\t\t\tthis.addChild(new Spacer(1));\n\t\t}\n\t\tthis.addChild(content);\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild(new DynamicBorder((s) => theme.fg(\"accent\", s)));\n\t}\n\n\tconstructor(\n\t\tcurrentSessionsLoader: SessionsLoader,\n\t\tallSessionsLoader: SessionsLoader,\n\t\tonSelect: (sessionPath: string) => void,\n\t\tonCancel: () => void,\n\t\tonExit: () => void,\n\t\trequestRender: () => void,\n\t\toptions?: {\n\t\t\trenameSession?: (sessionPath: string, currentName: string | undefined) => Promise<void>;\n\t\t\tshowRenameHint?: boolean;\n\t\t\tkeybindings?: KeybindingsManager;\n\t\t},\n\t\tcurrentSessionFilePath?: string,\n\t) {\n\t\tsuper();\n\t\tthis.keybindings = options?.keybindings ?? KeybindingsManager.create();\n\t\tthis.currentSessionsLoader = currentSessionsLoader;\n\t\tthis.allSessionsLoader = allSessionsLoader;\n\t\tthis.requestRender = requestRender;\n\t\tthis.header = new SessionSelectorHeader(this.scope, this.sortMode, this.nameFilter, this.requestRender);\n\t\tconst renameSession = options?.renameSession;\n\t\tthis.renameSession = renameSession;\n\t\tthis.canRename = !!renameSession;\n\t\tthis.header.setShowRenameHint(options?.showRenameHint ?? this.canRename);\n\n\t\t// Create session list (starts empty, will be populated after load)\n\t\tthis.sessionList = new SessionList(\n\t\t\t[],\n\t\t\tfalse,\n\t\t\tthis.sortMode,\n\t\t\tthis.nameFilter,\n\t\t\tthis.keybindings,\n\t\t\tcurrentSessionFilePath,\n\t\t);\n\n\t\tthis.buildBaseLayout(this.sessionList);\n\n\t\tthis.renameInput.onSubmit = (value) => {\n\t\t\tvoid this.confirmRename(value);\n\t\t};\n\n\t\t// Ensure header status timeouts are cleared when leaving the selector\n\t\tconst clearStatusMessage = () => this.header.setStatusMessage(null);\n\t\tthis.sessionList.onSelect = (sessionPath) => {\n\t\t\tclearStatusMessage();\n\t\t\tthis.cancelLoads();\n\t\t\tonSelect(sessionPath);\n\t\t};\n\t\tthis.sessionList.onCancel = () => {\n\t\t\tclearStatusMessage();\n\t\t\tthis.cancelLoads();\n\t\t\tonCancel();\n\t\t};\n\t\tthis.sessionList.onExit = () => {\n\t\t\tclearStatusMessage();\n\t\t\tthis.cancelLoads();\n\t\t\tonExit();\n\t\t};\n\t\tthis.sessionList.onToggleScope = () => this.toggleScope();\n\t\tthis.sessionList.onToggleSort = () => this.toggleSortMode();\n\t\tthis.sessionList.onToggleNameFilter = () => this.toggleNameFilter();\n\t\tthis.sessionList.onRenameSession = (sessionPath) => {\n\t\t\tif (!renameSession) return;\n\t\t\tif (this.scope === \"current\" ? this.currentLoad : this.allLoad) return;\n\n\t\t\tconst sessions = this.scope === \"all\" ? (this.allSessions ?? []) : (this.currentSessions ?? []);\n\t\t\tconst session = sessions.find((s) => s.path === sessionPath);\n\t\t\tthis.enterRenameMode(sessionPath, session?.name);\n\t\t};\n\n\t\t// Sync list events to header\n\t\tthis.sessionList.onTogglePath = (showPath) => {\n\t\t\tthis.header.setShowPath(showPath);\n\t\t\tthis.requestRender();\n\t\t};\n\t\tthis.sessionList.onDeleteConfirmationChange = (path) => {\n\t\t\tthis.header.setConfirmingDeletePath(path);\n\t\t\tthis.requestRender();\n\t\t};\n\t\tthis.sessionList.onError = (msg) => {\n\t\t\tthis.header.setStatusMessage({ type: \"error\", message: msg }, 3000);\n\t\t\tthis.requestRender();\n\t\t};\n\n\t\t// Handle session deletion\n\t\tthis.sessionList.onDeleteSession = async (sessionPath: string) => {\n\t\t\tconst result = await deleteSessionFile(sessionPath);\n\n\t\t\tif (result.ok) {\n\t\t\t\tif (this.currentSessions) {\n\t\t\t\t\tthis.currentSessions = this.currentSessions.filter((s) => s.path !== sessionPath);\n\t\t\t\t}\n\t\t\t\tif (this.allSessions) {\n\t\t\t\t\tthis.allSessions = this.allSessions.filter((s) => s.path !== sessionPath);\n\t\t\t\t}\n\n\t\t\t\tconst sessions = this.scope === \"all\" ? (this.allSessions ?? []) : (this.currentSessions ?? []);\n\t\t\t\tconst showCwd = this.scope === \"all\";\n\t\t\t\tthis.sessionList.setSessions(sessions, showCwd);\n\n\t\t\t\tconst msg = result.method === \"trash\" ? \"Session moved to trash\" : \"Session deleted\";\n\t\t\t\tthis.header.setStatusMessage({ type: \"info\", message: msg }, 2000);\n\t\t\t\tawait this.refreshSessionsAfterMutation();\n\t\t\t} else {\n\t\t\t\tconst errorMessage = result.error ?? \"Unknown error\";\n\t\t\t\tthis.header.setStatusMessage({ type: \"error\", message: `Failed to delete: ${errorMessage}` }, 3000);\n\t\t\t}\n\n\t\t\tthis.requestRender();\n\t\t};\n\n\t\t// Start loading current sessions immediately\n\t\tvoid this.loadScope(\"current\");\n\t}\n\n\tprivate cancelLoads(): void {\n\t\tif (this.currentLoad) {\n\t\t\tthis.currentLoad.abort();\n\t\t\tthis.currentLoad = null;\n\t\t\tthis.currentSessions = null;\n\t\t}\n\t\tif (this.allLoad) {\n\t\t\tthis.allLoad.abort();\n\t\t\tthis.allLoad = null;\n\t\t\tthis.allSessions = null;\n\t\t}\n\t}\n\n\tprivate enterRenameMode(sessionPath: string, currentName: string | undefined): void {\n\t\tthis.mode = \"rename\";\n\t\tthis.renameTargetPath = sessionPath;\n\t\tthis.renameInput.setValue(currentName ?? \"\");\n\t\tthis.renameInput.focused = true;\n\n\t\tconst panel = new Container();\n\t\tpanel.addChild(new Text(theme.bold(\"Rename Session\"), 1, 0));\n\t\tpanel.addChild(new Spacer(1));\n\t\tpanel.addChild(this.renameInput);\n\t\tpanel.addChild(new Spacer(1));\n\t\tpanel.addChild(\n\t\t\tnew Text(\n\t\t\t\ttheme.fg(\"muted\", `${keyText(\"tui.select.confirm\")} to save · ${keyText(\"tui.select.cancel\")} to cancel`),\n\t\t\t\t1,\n\t\t\t\t0,\n\t\t\t),\n\t\t);\n\n\t\tthis.buildBaseLayout(panel, { showHeader: false });\n\t\tthis.requestRender();\n\t}\n\n\tprivate exitRenameMode(): void {\n\t\tthis.mode = \"list\";\n\t\tthis.renameTargetPath = null;\n\n\t\tthis.buildBaseLayout(this.sessionList);\n\n\t\tthis.requestRender();\n\t}\n\n\tprivate async confirmRename(value: string): Promise<void> {\n\t\tconst next = value.trim();\n\t\tif (!next) return;\n\t\tconst target = this.renameTargetPath;\n\t\tif (!target) {\n\t\t\tthis.exitRenameMode();\n\t\t\treturn;\n\t\t}\n\n\t\t// Find current name for callback\n\t\tconst renameSession = this.renameSession;\n\t\tif (!renameSession) {\n\t\t\tthis.exitRenameMode();\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait renameSession(target, next);\n\t\t\tawait this.refreshSessionsAfterMutation();\n\t\t} finally {\n\t\t\tthis.exitRenameMode();\n\t\t}\n\t}\n\n\tprivate async loadScope(scope: SessionScope): Promise<void> {\n\t\tif (scope === \"current\" ? this.currentLoad : this.allLoad) return;\n\n\t\tconst showCwd = scope === \"all\";\n\t\tconst controller = new AbortController();\n\t\tif (scope === \"current\") {\n\t\t\tthis.currentLoad = controller;\n\t\t} else {\n\t\t\tthis.allLoad = controller;\n\t\t}\n\t\tthis.header.setScope(scope);\n\t\tthis.header.setLoading(true);\n\t\tthis.requestRender();\n\n\t\tconst isActive = () => (scope === \"current\" ? this.currentLoad : this.allLoad) === controller;\n\t\tconst onProgress: SessionListProgress = (loaded, total, partialSessions) => {\n\t\t\tif (!isActive()) return;\n\t\t\tif (partialSessions) {\n\t\t\t\tconst sessions = [...partialSessions];\n\t\t\t\tif (scope === \"current\") {\n\t\t\t\t\tthis.currentSessions = sessions;\n\t\t\t\t} else {\n\t\t\t\t\tthis.allSessions = sessions;\n\t\t\t\t}\n\t\t\t\tif (scope === this.scope) this.sessionList.setSessions(sessions, showCwd, true);\n\t\t\t}\n\t\t\tif (scope !== this.scope) return;\n\t\t\tthis.header.setProgress(loaded, total);\n\t\t\tthis.requestRender();\n\t\t};\n\n\t\ttry {\n\t\t\tconst sessions = await (scope === \"current\"\n\t\t\t\t? this.currentSessionsLoader(onProgress, controller.signal)\n\t\t\t\t: this.allSessionsLoader(onProgress, controller.signal));\n\t\t\tif (!isActive()) return;\n\n\t\t\tif (scope === \"current\") {\n\t\t\t\tthis.currentSessions = sessions;\n\t\t\t\tthis.currentLoad = null;\n\t\t\t} else {\n\t\t\t\tthis.allSessions = sessions;\n\t\t\t\tthis.allLoad = null;\n\t\t\t}\n\n\t\t\tif (scope !== this.scope) return;\n\t\t\tthis.header.setLoading(false);\n\t\t\tthis.sessionList.setSessions(sessions, showCwd);\n\t\t\tthis.requestRender();\n\t\t} catch (err) {\n\t\t\tif (!isActive()) return;\n\t\t\tif (scope === \"current\") {\n\t\t\t\tthis.currentLoad = null;\n\t\t\t\tthis.currentSessions = null;\n\t\t\t} else {\n\t\t\t\tthis.allLoad = null;\n\t\t\t\tthis.allSessions = null;\n\t\t\t}\n\t\t\tif (scope !== this.scope) return;\n\n\t\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\t\tthis.header.setLoading(false);\n\t\t\tthis.header.setStatusMessage({ type: \"error\", message: `Failed to load sessions: ${message}` }, 4000);\n\t\t\tthis.sessionList.setSessions([], showCwd);\n\t\t\tthis.requestRender();\n\t\t}\n\t}\n\n\tprivate toggleSortMode(): void {\n\t\t// Cycle: threaded -> recent -> relevance -> threaded\n\t\tthis.sortMode = this.sortMode === \"threaded\" ? \"recent\" : this.sortMode === \"recent\" ? \"relevance\" : \"threaded\";\n\t\tthis.header.setSortMode(this.sortMode);\n\t\tthis.sessionList.setSortMode(this.sortMode);\n\t\tthis.requestRender();\n\t}\n\n\tprivate toggleNameFilter(): void {\n\t\tthis.nameFilter = this.nameFilter === \"all\" ? \"named\" : \"all\";\n\t\tthis.header.setNameFilter(this.nameFilter);\n\t\tthis.sessionList.setNameFilter(this.nameFilter);\n\t\tthis.requestRender();\n\t}\n\n\tprivate async refreshSessionsAfterMutation(): Promise<void> {\n\t\tthis.cancelLoads();\n\t\tthis.currentSessions = null;\n\t\tthis.allSessions = null;\n\t\tawait this.loadScope(this.scope);\n\t}\n\n\tprivate toggleScope(): void {\n\t\tthis.scope = this.scope === \"current\" ? \"all\" : \"current\";\n\t\tconst sessions = this.scope === \"current\" ? this.currentSessions : this.allSessions;\n\t\tconst loading = (this.scope === \"current\" ? this.currentLoad : this.allLoad) !== null;\n\t\tthis.header.setScope(this.scope);\n\t\tthis.header.setLoading(loading);\n\t\tthis.sessionList.setSessions(sessions ?? [], this.scope === \"all\", loading || sessions === null);\n\t\tthis.requestRender();\n\t\tif (sessions === null && !loading) void this.loadScope(this.scope);\n\t}\n\n\tgetSessionList(): SessionList {\n\t\treturn this.sessionList;\n\t}\n}\n"]}
@@ -64,7 +64,7 @@ export declare class SteppedSubmenu extends Container {
64
64
  private context;
65
65
  constructor(steps: SteppedSubmenuStep[], onComplete: (context: Record<string, string>) => void, onCancel: () => void, opts?: SteppedSubmenuOptions);
66
66
  private buildStep;
67
- render(width: number): string[];
67
+ render(width: number): readonly string[];
68
68
  handleInput(data: string): void;
69
69
  invalidate(): void;
70
70
  }
@@ -1 +1 @@
1
- {"version":3,"file":"settings-submenu.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/settings-submenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,SAAS,EAIT,KAAK,UAAU,EAEf,KAAK,uBAAuB,EAG5B,MAAM,YAAY,CAAC;AAQpB,MAAM,WAAW,oBAAoB;IACpC,6CAA6C;IAC7C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uDAAuD;IACvD,MAAM,CAAC,EAAE,uBAAuB,CAAC;CACjC;AAED;;;GAGG;AACH,qBAAa,aAAc,SAAQ,SAAS;IAC3C,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,UAAU,CAAe;IACjC,OAAO,CAAC,UAAU,CAA0B;IAC5C,OAAO,CAAC,WAAW,CAAoB;IACvC,OAAO,CAAC,UAAU,CAA0B;IAC5C,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,mBAAmB,CAAC,CAA0B;IAEtD,YACC,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,UAAU,EAAE,EACrB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,EACjC,QAAQ,EAAE,MAAM,IAAI,EACpB,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,EAC3C,cAAc,CAAC,EAAE,oBAAoB,EA2CrC;IAED,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,WAAW;IAUnB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAmB9B;CACD;AAMD,4CAA4C;AAC5C,MAAM,WAAW,kBAAkB;IAClC,2FAA2F;IAC3F,GAAG,EAAE,MA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,IAAI,EACrD,QAAQ,EAAE,MAAM,IAAI,EACpB,IAAI,GAAE,qBAA0B,EAShC;IAED,OAAO,CAAC,SAAS;IA8CjB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAE9B;IAED,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE9B;IAED,UAAU,IAAI,IAAI,CAEjB;CACD"}
1
+ {"version":3,"file":"settings-submenu.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/settings-submenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,SAAS,EAIT,KAAK,UAAU,EAEf,KAAK,uBAAuB,EAG5B,MAAM,YAAY,CAAC;AAQpB,MAAM,WAAW,oBAAoB;IACpC,6CAA6C;IAC7C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uDAAuD;IACvD,MAAM,CAAC,EAAE,uBAAuB,CAAC;CACjC;AAED;;;GAGG;AACH,qBAAa,aAAc,SAAQ,SAAS;IAC3C,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,UAAU,CAAe;IACjC,OAAO,CAAC,UAAU,CAA0B;IAC5C,OAAO,CAAC,WAAW,CAAoB;IACvC,OAAO,CAAC,UAAU,CAA0B;IAC5C,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,mBAAmB,CAAC,CAA0B;IAEtD,YACC,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,UAAU,EAAE,EACrB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,EACjC,QAAQ,EAAE,MAAM,IAAI,EACpB,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,EAC3C,cAAc,CAAC,EAAE,oBAAoB,EA2CrC;IAED,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,WAAW;IAUnB,WAAW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OAAO,CAAyB;IAExC,YACC,KAAK,EAAE,kBAAkB,EAAE,EAC3B,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,EACrD,QAAQ,EAAE,MAAM,IAAI,EACpB,IAAI,GAAE,qBAA0B,EAShC;IAED,OAAO,CAAC,SAAS;IA8CjB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAEvC;IAED,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE9B;IAED,UAAU,IAAI,IAAI,CAEjB;CACD"}
@@ -87,8 +87,12 @@ export class SelectSubmenu extends Container {
87
87
  this.selectList.handleInput(data);
88
88
  }
89
89
  else {
90
+ // Cursor keys leave the query as it is and must not move the selection.
91
+ const previousQuery = this.searchInput.getValue();
90
92
  this.searchInput.handleInput(data);
91
- this.applyFilter(this.searchInput.getValue());
93
+ const query = this.searchInput.getValue();
94
+ if (query !== previousQuery)
95
+ this.applyFilter(query);
92
96
  }
93
97
  }
94
98
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"settings-submenu.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/settings-submenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,SAAS,EACT,WAAW,EACX,cAAc,EACd,KAAK,EAEL,UAAU,EAEV,MAAM,EACN,IAAI,GACJ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE9D,MAAM,0BAA0B,GAA4B;IAC3D,qBAAqB,EAAE,EAAE;IACzB,qBAAqB,EAAE,EAAE;CACzB,CAAC;AASF;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,SAAS;IACnC,UAAU,CAAa;IACvB,cAAc,CAAS;IACvB,UAAU,CAAe;IACzB,UAAU,CAA0B;IACpC,WAAW,CAAoB;IAC/B,UAAU,CAA0B;IACpC,UAAU,CAAa;IACvB,mBAAmB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ACP,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACjB,CAAC;YACF,CAAC;QACF,CAAC,EACD,GAAG,EAAE;YACJ,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;gBACnB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBAC9B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;YACtD,CAAC;iBAAM,CAAC;gBACP,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjB,CAAC;QACF,CAAC,EACD,SAAS,EACT,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CACjG,CAAC;IACH,CAAC;IAED,MAAM,CAAC,KAAa;QACnB,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,WAAW,CAAC,IAAY;QACvB,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED,UAAU;QACT,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,EAAE,CAAC;IACrC,CAAC;CACD","sourcesContent":["import {\n\ttype Component,\n\tContainer,\n\tfuzzyFilter,\n\tgetKeybindings,\n\tInput,\n\ttype SelectItem,\n\tSelectList,\n\ttype SelectListLayoutOptions,\n\tSpacer,\n\tText,\n} from \"@draht/tui\";\nimport { getSelectListTheme, theme } from \"../theme/theme.ts\";\n\nconst SUBMENU_SELECT_LIST_LAYOUT: SelectListLayoutOptions = {\n\tminPrimaryColumnWidth: 12,\n\tmaxPrimaryColumnWidth: 32,\n};\n\nexport interface SelectSubmenuOptions {\n\t/** Enable type-to-search fuzzy filtering. */\n\tsearchable?: boolean;\n\t/** Override the select list layout (column widths). */\n\tlayout?: SelectListLayoutOptions;\n}\n\n/**\n * Single-step submenu that shows a titled select list.\n * With `searchable: true`, typing filters the list using fuzzy matching.\n */\nexport class SelectSubmenu extends Container {\n\tprivate selectList: SelectList;\n\tprivate listChildIndex: number;\n\tprivate allOptions: SelectItem[];\n\tprivate listLayout: SelectListLayoutOptions;\n\tprivate searchInput: Input | undefined;\n\tprivate onSelectCb: (value: string) => void;\n\tprivate onCancelCb: () => void;\n\tprivate onSelectionChangeCb?: (value: string) => void;\n\n\tconstructor(\n\t\ttitle: string,\n\t\tdescription: string,\n\t\toptions: SelectItem[],\n\t\tcurrentValue: string,\n\t\tonSelect: (value: string) => void,\n\t\tonCancel: () => void,\n\t\tonSelectionChange?: (value: string) => void,\n\t\tsubmenuOptions?: SelectSubmenuOptions,\n\t) {\n\t\tsuper();\n\n\t\tthis.allOptions = options;\n\t\tthis.listLayout = submenuOptions?.layout ?? SUBMENU_SELECT_LIST_LAYOUT;\n\t\tthis.onSelectCb = onSelect;\n\t\tthis.onCancelCb = onCancel;\n\t\tthis.onSelectionChangeCb = onSelectionChange;\n\n\t\t// Title\n\t\tthis.addChild(new Text(theme.bold(theme.fg(\"accent\", title)), 0, 0));\n\n\t\t// Description\n\t\tif (description) {\n\t\t\tthis.addChild(new Spacer(1));\n\t\t\tthis.addChild(new Text(theme.fg(\"muted\", description), 0, 0));\n\t\t}\n\n\t\t// Search input\n\t\tif (submenuOptions?.searchable) {\n\t\t\tthis.addChild(new Spacer(1));\n\t\t\tthis.searchInput = new Input();\n\t\t\tthis.searchInput.onSubmit = () => {\n\t\t\t\tthis.selectList.confirmSelection();\n\t\t\t};\n\t\t\tthis.addChild(this.searchInput);\n\t\t}\n\n\t\t// Spacer\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// Select list\n\t\tthis.selectList = this.buildSelectList(options, currentValue);\n\t\tthis.listChildIndex = this.children.length;\n\t\tthis.addChild(this.selectList);\n\n\t\t// Hint\n\t\tthis.addChild(new Spacer(1));\n\t\tconst hint = submenuOptions?.searchable\n\t\t\t? \" Type to filter \\u00b7 Enter to select \\u00b7 Esc to go back\"\n\t\t\t: \" Enter to select \\u00b7 Esc to go back\";\n\t\tthis.addChild(new Text(theme.fg(\"dim\", hint), 0, 0));\n\t}\n\n\tprivate buildSelectList(options: SelectItem[], preselect: string): SelectList {\n\t\tconst list = new SelectList(options, Math.min(options.length, 10), getSelectListTheme(), this.listLayout);\n\n\t\tconst idx = options.findIndex((o) => o.value === preselect);\n\t\tif (idx !== -1) list.setSelectedIndex(idx);\n\n\t\tlist.onSelect = (item) => this.onSelectCb(item.value);\n\t\tlist.onCancel = this.onCancelCb;\n\t\tif (this.onSelectionChangeCb) {\n\t\t\tconst cb = this.onSelectionChangeCb;\n\t\t\tlist.onSelectionChange = (item) => cb(item.value);\n\t\t}\n\n\t\treturn list;\n\t}\n\n\tprivate applyFilter(query: string): void {\n\t\tconst filtered = query\n\t\t\t? fuzzyFilter(this.allOptions, query, (item) => `${item.label} ${item.description ?? \"\"}`)\n\t\t\t: this.allOptions;\n\n\t\tconst newList = this.buildSelectList(filtered, \"\");\n\t\tthis.children[this.listChildIndex] = newList;\n\t\tthis.selectList = newList;\n\t}\n\n\thandleInput(data: string): void {\n\t\tif (this.searchInput) {\n\t\t\tconst kb = getKeybindings();\n\t\t\tconst isNav =\n\t\t\t\tkb.matches(data, \"tui.select.up\") ||\n\t\t\t\tkb.matches(data, \"tui.select.down\") ||\n\t\t\t\tkb.matches(data, \"tui.select.pageUp\") ||\n\t\t\t\tkb.matches(data, \"tui.select.pageDown\") ||\n\t\t\t\tkb.matches(data, \"tui.select.confirm\") ||\n\t\t\t\tkb.matches(data, \"tui.select.cancel\");\n\t\t\tif (isNav) {\n\t\t\t\tthis.selectList.handleInput(data);\n\t\t\t} else {\n\t\t\t\tthis.searchInput.handleInput(data);\n\t\t\t\tthis.applyFilter(this.searchInput.getValue());\n\t\t\t}\n\t\t} else {\n\t\t\tthis.selectList.handleInput(data);\n\t\t}\n\t}\n}\n\n// ============================================================================\n// SteppedSubmenu — reusable multi-step selector\n// ============================================================================\n\n/** One step in a {@link SteppedSubmenu}. */\nexport interface SteppedSubmenuStep {\n\t/** Unique key \\u2014 the selected value is stored in the result context under this key. */\n\tkey: string;\n\t/** Title shown at the top of the step. Receives prior selections. */\n\ttitle: string | ((context: Record<string, string>) => string);\n\t/** Description shown below the title. Receives prior selections. */\n\tdescription: string | ((context: Record<string, string>) => string);\n\t/** Build the option list for this step. Called fresh each time the step is shown. */\n\toptions: (context: Record<string, string>) => SelectItem[];\n\t/** Optionally pre-select a value when entering this step. */\n\tpreselect?: (context: Record<string, string>) => string | undefined;\n\t/** Enable type-to-search fuzzy filtering for this step. */\n\tsearchable?: boolean;\n\t/** Override the select list layout (column widths) for this step. */\n\tlayout?: SelectListLayoutOptions;\n}\n\ninterface SteppedSubmenuOptions {\n\t/** Start at this step index (0-based), skipping earlier steps. Requires initialContext for skipped keys. */\n\tstartAtStep?: number;\n\t/** Pre-fill selections for skipped steps. */\n\tinitialContext?: Record<string, string>;\n\t/** After completing the last step, loop back to step 0 instead of closing. */\n\tloop?: boolean;\n}\n\n/**\n * Generic N-step submenu built on top of {@link SelectSubmenu}.\n *\n * Each step's options can depend on prior selections via the shared context.\n * Esc goes back one step; Esc at step 0 cancels.\n * With `loop: true`, completing the final step invokes `onComplete` then returns to step 0.\n */\nexport class SteppedSubmenu extends Container {\n\tprivate readonly steps: SteppedSubmenuStep[];\n\tprivate readonly onComplete: (context: Record<string, string>) => void;\n\tprivate readonly onCancel: () => void;\n\tprivate readonly opts: SteppedSubmenuOptions;\n\tprivate activeComponent: Component;\n\tprivate context: Record<string, string>;\n\n\tconstructor(\n\t\tsteps: SteppedSubmenuStep[],\n\t\tonComplete: (context: Record<string, string>) => void,\n\t\tonCancel: () => void,\n\t\topts: SteppedSubmenuOptions = {},\n\t) {\n\t\tsuper();\n\t\tthis.steps = steps;\n\t\tthis.onComplete = onComplete;\n\t\tthis.onCancel = onCancel;\n\t\tthis.opts = opts;\n\t\tthis.context = { ...(opts.initialContext ?? {}) };\n\t\tthis.activeComponent = this.buildStep(opts.startAtStep ?? 0);\n\t}\n\n\tprivate buildStep(stepIndex: number): Component {\n\t\tconst step = this.steps[stepIndex];\n\t\tconst total = this.steps.length;\n\t\tconst stepLabel = total > 1 ? `Step ${stepIndex + 1}/${total} \\u00b7 ` : \"\";\n\n\t\tconst title = typeof step.title === \"function\" ? step.title(this.context) : step.title;\n\t\tconst desc = typeof step.description === \"function\" ? step.description(this.context) : step.description;\n\t\tconst items = step.options(this.context);\n\t\tconst preselect = step.preselect?.(this.context) ?? \"\";\n\n\t\treturn new SelectSubmenu(\n\t\t\ttitle,\n\t\t\t`${stepLabel}${desc}`,\n\t\t\titems,\n\t\t\tpreselect,\n\t\t\t(value) => {\n\t\t\t\tthis.context[step.key] = value;\n\n\t\t\t\tif (stepIndex < total - 1) {\n\t\t\t\t\t// Advance to next step\n\t\t\t\t\tthis.activeComponent = this.buildStep(stepIndex + 1);\n\t\t\t\t} else {\n\t\t\t\t\t// Final step \\u2014 deliver result\n\t\t\t\t\tthis.onComplete({ ...this.context });\n\n\t\t\t\t\tif (this.opts.loop) {\n\t\t\t\t\t\tthis.context = {};\n\t\t\t\t\t\tthis.activeComponent = this.buildStep(0);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.onCancel();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tif (stepIndex > 0) {\n\t\t\t\t\tdelete this.context[step.key];\n\t\t\t\t\tthis.activeComponent = this.buildStep(stepIndex - 1);\n\t\t\t\t} else {\n\t\t\t\t\tthis.onCancel();\n\t\t\t\t}\n\t\t\t},\n\t\t\tundefined,\n\t\t\tstep.searchable || step.layout ? { searchable: step.searchable, layout: step.layout } : undefined,\n\t\t);\n\t}\n\n\trender(width: number): string[] {\n\t\treturn this.activeComponent.render(width);\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.activeComponent.handleInput?.(data);\n\t}\n\n\tinvalidate(): void {\n\t\tthis.activeComponent.invalidate?.();\n\t}\n}\n"]}
1
+ {"version":3,"file":"settings-submenu.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/settings-submenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,SAAS,EACT,WAAW,EACX,cAAc,EACd,KAAK,EAEL,UAAU,EAEV,MAAM,EACN,IAAI,GACJ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE9D,MAAM,0BAA0B,GAA4B;IAC3D,qBAAqB,EAAE,EAAE;IACzB,qBAAqB,EAAE,EAAE;CACzB,CAAC;AASF;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,SAAS;IACnC,UAAU,CAAa;IACvB,cAAc,CAAS;IACvB,UAAU,CAAe;IACzB,UAAU,CAA0B;IACpC,WAAW,CAAoB;IAC/B,UAAU,CAA0B;IACpC,UAAU,CAAa;IACvB,mBAAmB,CAA2B;IAEtD,YACC,KAAa,EACb,WAAmB,EACnB,OAAqB,EACrB,YAAoB,EACpB,QAAiC,EACjC,QAAoB,EACpB,iBAA2C,EAC3C,cAAqC;QAErC,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,cAAc,EAAE,MAAM,IAAI,0BAA0B,CAAC;QACvE,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC;QAC3B,IAAI,CAAC,mBAAmB,GAAG,iBAAiB,CAAC;QAE7C,QAAQ;QACR,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAErE,cAAc;QACd,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AAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CACjG,CAAC;IACH,CAAC;IAED,MAAM,CAAC,KAAa;QACnB,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,WAAW,CAAC,IAAY;QACvB,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED,UAAU;QACT,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,EAAE,CAAC;IACrC,CAAC;CACD","sourcesContent":["import {\n\ttype Component,\n\tContainer,\n\tfuzzyFilter,\n\tgetKeybindings,\n\tInput,\n\ttype SelectItem,\n\tSelectList,\n\ttype SelectListLayoutOptions,\n\tSpacer,\n\tText,\n} from \"@draht/tui\";\nimport { getSelectListTheme, theme } from \"../theme/theme.ts\";\n\nconst SUBMENU_SELECT_LIST_LAYOUT: SelectListLayoutOptions = {\n\tminPrimaryColumnWidth: 12,\n\tmaxPrimaryColumnWidth: 32,\n};\n\nexport interface SelectSubmenuOptions {\n\t/** Enable type-to-search fuzzy filtering. */\n\tsearchable?: boolean;\n\t/** Override the select list layout (column widths). */\n\tlayout?: SelectListLayoutOptions;\n}\n\n/**\n * Single-step submenu that shows a titled select list.\n * With `searchable: true`, typing filters the list using fuzzy matching.\n */\nexport class SelectSubmenu extends Container {\n\tprivate selectList: SelectList;\n\tprivate listChildIndex: number;\n\tprivate allOptions: SelectItem[];\n\tprivate listLayout: SelectListLayoutOptions;\n\tprivate searchInput: Input | undefined;\n\tprivate onSelectCb: (value: string) => void;\n\tprivate onCancelCb: () => void;\n\tprivate onSelectionChangeCb?: (value: string) => void;\n\n\tconstructor(\n\t\ttitle: string,\n\t\tdescription: string,\n\t\toptions: SelectItem[],\n\t\tcurrentValue: string,\n\t\tonSelect: (value: string) => void,\n\t\tonCancel: () => void,\n\t\tonSelectionChange?: (value: string) => void,\n\t\tsubmenuOptions?: SelectSubmenuOptions,\n\t) {\n\t\tsuper();\n\n\t\tthis.allOptions = options;\n\t\tthis.listLayout = submenuOptions?.layout ?? SUBMENU_SELECT_LIST_LAYOUT;\n\t\tthis.onSelectCb = onSelect;\n\t\tthis.onCancelCb = onCancel;\n\t\tthis.onSelectionChangeCb = onSelectionChange;\n\n\t\t// Title\n\t\tthis.addChild(new Text(theme.bold(theme.fg(\"accent\", title)), 0, 0));\n\n\t\t// Description\n\t\tif (description) {\n\t\t\tthis.addChild(new Spacer(1));\n\t\t\tthis.addChild(new Text(theme.fg(\"muted\", description), 0, 0));\n\t\t}\n\n\t\t// Search input\n\t\tif (submenuOptions?.searchable) {\n\t\t\tthis.addChild(new Spacer(1));\n\t\t\tthis.searchInput = new Input();\n\t\t\tthis.searchInput.onSubmit = () => {\n\t\t\t\tthis.selectList.confirmSelection();\n\t\t\t};\n\t\t\tthis.addChild(this.searchInput);\n\t\t}\n\n\t\t// Spacer\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// Select list\n\t\tthis.selectList = this.buildSelectList(options, currentValue);\n\t\tthis.listChildIndex = this.children.length;\n\t\tthis.addChild(this.selectList);\n\n\t\t// Hint\n\t\tthis.addChild(new Spacer(1));\n\t\tconst hint = submenuOptions?.searchable\n\t\t\t? \" Type to filter \\u00b7 Enter to select \\u00b7 Esc to go back\"\n\t\t\t: \" Enter to select \\u00b7 Esc to go back\";\n\t\tthis.addChild(new Text(theme.fg(\"dim\", hint), 0, 0));\n\t}\n\n\tprivate buildSelectList(options: SelectItem[], preselect: string): SelectList {\n\t\tconst list = new SelectList(options, Math.min(options.length, 10), getSelectListTheme(), this.listLayout);\n\n\t\tconst idx = options.findIndex((o) => o.value === preselect);\n\t\tif (idx !== -1) list.setSelectedIndex(idx);\n\n\t\tlist.onSelect = (item) => this.onSelectCb(item.value);\n\t\tlist.onCancel = this.onCancelCb;\n\t\tif (this.onSelectionChangeCb) {\n\t\t\tconst cb = this.onSelectionChangeCb;\n\t\t\tlist.onSelectionChange = (item) => cb(item.value);\n\t\t}\n\n\t\treturn list;\n\t}\n\n\tprivate applyFilter(query: string): void {\n\t\tconst filtered = query\n\t\t\t? fuzzyFilter(this.allOptions, query, (item) => `${item.label} ${item.description ?? \"\"}`)\n\t\t\t: this.allOptions;\n\n\t\tconst newList = this.buildSelectList(filtered, \"\");\n\t\tthis.children[this.listChildIndex] = newList;\n\t\tthis.selectList = newList;\n\t}\n\n\thandleInput(data: string): void {\n\t\tif (this.searchInput) {\n\t\t\tconst kb = getKeybindings();\n\t\t\tconst isNav =\n\t\t\t\tkb.matches(data, \"tui.select.up\") ||\n\t\t\t\tkb.matches(data, \"tui.select.down\") ||\n\t\t\t\tkb.matches(data, \"tui.select.pageUp\") ||\n\t\t\t\tkb.matches(data, \"tui.select.pageDown\") ||\n\t\t\t\tkb.matches(data, \"tui.select.confirm\") ||\n\t\t\t\tkb.matches(data, \"tui.select.cancel\");\n\t\t\tif (isNav) {\n\t\t\t\tthis.selectList.handleInput(data);\n\t\t\t} else {\n\t\t\t\t// Cursor keys leave the query as it is and must not move the selection.\n\t\t\t\tconst previousQuery = this.searchInput.getValue();\n\t\t\t\tthis.searchInput.handleInput(data);\n\t\t\t\tconst query = this.searchInput.getValue();\n\t\t\t\tif (query !== previousQuery) this.applyFilter(query);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.selectList.handleInput(data);\n\t\t}\n\t}\n}\n\n// ============================================================================\n// SteppedSubmenu — reusable multi-step selector\n// ============================================================================\n\n/** One step in a {@link SteppedSubmenu}. */\nexport interface SteppedSubmenuStep {\n\t/** Unique key \\u2014 the selected value is stored in the result context under this key. */\n\tkey: string;\n\t/** Title shown at the top of the step. Receives prior selections. */\n\ttitle: string | ((context: Record<string, string>) => string);\n\t/** Description shown below the title. Receives prior selections. */\n\tdescription: string | ((context: Record<string, string>) => string);\n\t/** Build the option list for this step. Called fresh each time the step is shown. */\n\toptions: (context: Record<string, string>) => SelectItem[];\n\t/** Optionally pre-select a value when entering this step. */\n\tpreselect?: (context: Record<string, string>) => string | undefined;\n\t/** Enable type-to-search fuzzy filtering for this step. */\n\tsearchable?: boolean;\n\t/** Override the select list layout (column widths) for this step. */\n\tlayout?: SelectListLayoutOptions;\n}\n\ninterface SteppedSubmenuOptions {\n\t/** Start at this step index (0-based), skipping earlier steps. Requires initialContext for skipped keys. */\n\tstartAtStep?: number;\n\t/** Pre-fill selections for skipped steps. */\n\tinitialContext?: Record<string, string>;\n\t/** After completing the last step, loop back to step 0 instead of closing. */\n\tloop?: boolean;\n}\n\n/**\n * Generic N-step submenu built on top of {@link SelectSubmenu}.\n *\n * Each step's options can depend on prior selections via the shared context.\n * Esc goes back one step; Esc at step 0 cancels.\n * With `loop: true`, completing the final step invokes `onComplete` then returns to step 0.\n */\nexport class SteppedSubmenu extends Container {\n\tprivate readonly steps: SteppedSubmenuStep[];\n\tprivate readonly onComplete: (context: Record<string, string>) => void;\n\tprivate readonly onCancel: () => void;\n\tprivate readonly opts: SteppedSubmenuOptions;\n\tprivate activeComponent: Component;\n\tprivate context: Record<string, string>;\n\n\tconstructor(\n\t\tsteps: SteppedSubmenuStep[],\n\t\tonComplete: (context: Record<string, string>) => void,\n\t\tonCancel: () => void,\n\t\topts: SteppedSubmenuOptions = {},\n\t) {\n\t\tsuper();\n\t\tthis.steps = steps;\n\t\tthis.onComplete = onComplete;\n\t\tthis.onCancel = onCancel;\n\t\tthis.opts = opts;\n\t\tthis.context = { ...(opts.initialContext ?? {}) };\n\t\tthis.activeComponent = this.buildStep(opts.startAtStep ?? 0);\n\t}\n\n\tprivate buildStep(stepIndex: number): Component {\n\t\tconst step = this.steps[stepIndex];\n\t\tconst total = this.steps.length;\n\t\tconst stepLabel = total > 1 ? `Step ${stepIndex + 1}/${total} \\u00b7 ` : \"\";\n\n\t\tconst title = typeof step.title === \"function\" ? step.title(this.context) : step.title;\n\t\tconst desc = typeof step.description === \"function\" ? step.description(this.context) : step.description;\n\t\tconst items = step.options(this.context);\n\t\tconst preselect = step.preselect?.(this.context) ?? \"\";\n\n\t\treturn new SelectSubmenu(\n\t\t\ttitle,\n\t\t\t`${stepLabel}${desc}`,\n\t\t\titems,\n\t\t\tpreselect,\n\t\t\t(value) => {\n\t\t\t\tthis.context[step.key] = value;\n\n\t\t\t\tif (stepIndex < total - 1) {\n\t\t\t\t\t// Advance to next step\n\t\t\t\t\tthis.activeComponent = this.buildStep(stepIndex + 1);\n\t\t\t\t} else {\n\t\t\t\t\t// Final step \\u2014 deliver result\n\t\t\t\t\tthis.onComplete({ ...this.context });\n\n\t\t\t\t\tif (this.opts.loop) {\n\t\t\t\t\t\tthis.context = {};\n\t\t\t\t\t\tthis.activeComponent = this.buildStep(0);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.onCancel();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tif (stepIndex > 0) {\n\t\t\t\t\tdelete this.context[step.key];\n\t\t\t\t\tthis.activeComponent = this.buildStep(stepIndex - 1);\n\t\t\t\t} else {\n\t\t\t\t\tthis.onCancel();\n\t\t\t\t}\n\t\t\t},\n\t\t\tundefined,\n\t\t\tstep.searchable || step.layout ? { searchable: step.searchable, layout: step.layout } : undefined,\n\t\t);\n\t}\n\n\trender(width: number): readonly string[] {\n\t\treturn this.activeComponent.render(width);\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.activeComponent.handleInput?.(data);\n\t}\n\n\tinvalidate(): void {\n\t\tthis.activeComponent.invalidate?.();\n\t}\n}\n"]}
@@ -12,6 +12,6 @@ export declare class ThemedText extends Text {
12
12
  private stale;
13
13
  constructor(build: () => string, paddingX?: number, paddingY?: number);
14
14
  invalidate(): void;
15
- render(width: number): string[];
15
+ render(width: number): readonly string[];
16
16
  }
17
17
  //# sourceMappingURL=themed-text.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"themed-text.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/themed-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC;;;;;;;GAOG;AACH,qBAAa,UAAW,SAAQ,IAAI;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;IACrC,OAAO,CAAC,KAAK,CAAQ;IAErB,YAAY,KAAK,EAAE,MAAM,MAAM,EAAE,QAAQ,SAAI,EAAE,QAAQ,SAAI,EAG1D;IAEQ,UAAU,IAAI,IAAI,CAG1B;IAEQ,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAMvC;CACD"}
1
+ {"version":3,"file":"themed-text.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/themed-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC;;;;;;;GAOG;AACH,qBAAa,UAAW,SAAQ,IAAI;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;IACrC,OAAO,CAAC,KAAK,CAAQ;IAErB,YAAY,KAAK,EAAE,MAAM,MAAM,EAAE,QAAQ,SAAI,EAAE,QAAQ,SAAI,EAG1D;IAEQ,UAAU,IAAI,IAAI,CAG1B;IAEQ,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAMhD;CACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"themed-text.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/themed-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,OAAO,UAAW,SAAQ,IAAI;IAClB,KAAK,CAAe;IAC7B,KAAK,GAAG,IAAI,CAAC;IAErB,YAAY,KAAmB,EAAE,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,CAAC;QAC1D,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACpB,CAAC;IAEQ,UAAU;QAClB,KAAK,CAAC,UAAU,EAAE,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACnB,CAAC;IAEQ,MAAM,CAAC,KAAa;QAC5B,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;YACnB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAC5B,CAAC;QACD,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;CACD","sourcesContent":["import { Text } from \"@draht/tui\";\n\n/**\n * Text whose content applies theme colors. Plain `Text` keeps the colors its string was built with, so\n * a theme change, or the system theme receiving the terminal's colors, would leave it stale. This\n * rebuilds the string from `build` after every invalidation, which the UI performs on theme changes.\n *\n * `build` must return the same content each time, apart from colors. Snapshot changing data before\n * creating the component, or call `invalidate()` after changing state that `build` reads.\n */\nexport class ThemedText extends Text {\n\tprivate readonly build: () => string;\n\tprivate stale = true;\n\n\tconstructor(build: () => string, paddingX = 1, paddingY = 1) {\n\t\tsuper(\"\", paddingX, paddingY);\n\t\tthis.build = build;\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tthis.stale = true;\n\t}\n\n\toverride render(width: number): string[] {\n\t\tif (this.stale) {\n\t\t\tthis.stale = false;\n\t\t\tthis.setText(this.build());\n\t\t}\n\t\treturn super.render(width);\n\t}\n}\n"]}
1
+ {"version":3,"file":"themed-text.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/themed-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,OAAO,UAAW,SAAQ,IAAI;IAClB,KAAK,CAAe;IAC7B,KAAK,GAAG,IAAI,CAAC;IAErB,YAAY,KAAmB,EAAE,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,CAAC;QAC1D,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACpB,CAAC;IAEQ,UAAU;QAClB,KAAK,CAAC,UAAU,EAAE,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACnB,CAAC;IAEQ,MAAM,CAAC,KAAa;QAC5B,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;YACnB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAC5B,CAAC;QACD,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;CACD","sourcesContent":["import { Text } from \"@draht/tui\";\n\n/**\n * Text whose content applies theme colors. Plain `Text` keeps the colors its string was built with, so\n * a theme change, or the system theme receiving the terminal's colors, would leave it stale. This\n * rebuilds the string from `build` after every invalidation, which the UI performs on theme changes.\n *\n * `build` must return the same content each time, apart from colors. Snapshot changing data before\n * creating the component, or call `invalidate()` after changing state that `build` reads.\n */\nexport class ThemedText extends Text {\n\tprivate readonly build: () => string;\n\tprivate stale = true;\n\n\tconstructor(build: () => string, paddingX = 1, paddingY = 1) {\n\t\tsuper(\"\", paddingX, paddingY);\n\t\tthis.build = build;\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tthis.stale = true;\n\t}\n\n\toverride render(width: number): readonly string[] {\n\t\tif (this.stale) {\n\t\t\tthis.stale = false;\n\t\t\tthis.setText(this.build());\n\t\t}\n\t\treturn super.render(width);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"thinking-selector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/thinking-selector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACN,SAAS,EACT,KAAK,SAAS,EAKd,UAAU,EAIV,MAAM,YAAY,CAAC;AAoBpB;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,SAAU,YAAW,SAAS;IAC5E,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,oBAAoB,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,QAAQ,CAAiC;IACjD,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,iBAAiB,CAAC,CAAiC;IAC3D,OAAO,CAAC,QAAQ,CAAS;IAEzB,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAGzB;IAED,YACC,YAAY,EAAE,aAAa,EAC3B,eAAe,EAAE,aAAa,EAAE,EAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,EACxC,QAAQ,EAAE,MAAM,IAAI,EACpB,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,EAClD,oBAAoB,CAAC,EAAE,aAAa,EA6CpC;IAED,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,WAAW;IAUnB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAoBjC;IAED,aAAa,IAAI,UAAU,CAE1B;CACD"}
1
+ {"version":3,"file":"thinking-selector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/thinking-selector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACN,SAAS,EACT,KAAK,SAAS,EAKd,UAAU,EAIV,MAAM,YAAY,CAAC;AAoBpB;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,SAAU,YAAW,SAAS;IAC5E,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,oBAAoB,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,QAAQ,CAAiC;IACjD,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,iBAAiB,CAAC,CAAiC;IAC3D,OAAO,CAAC,QAAQ,CAAS;IAEzB,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAGzB;IAED,YACC,YAAY,EAAE,aAAa,EAC3B,eAAe,EAAE,aAAa,EAAE,EAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,EACxC,QAAQ,EAAE,MAAM,IAAI,EACpB,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,EAClD,oBAAoB,CAAC,EAAE,aAAa,EA6CpC;IAED,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,WAAW;IAUnB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAuBjC;IAED,aAAa,IAAI,UAAU,CAE1B;CACD"}
@@ -99,8 +99,12 @@ export class ThinkingSelectorComponent extends Container {
99
99
  this.selectList.handleInput(keyData);
100
100
  return;
101
101
  }
102
+ // Cursor keys leave the query as it is and must not rebuild the list.
103
+ const previousQuery = this.searchInput.getValue();
102
104
  this.searchInput.handleInput(keyData);
103
- this.applyFilter(this.searchInput.getValue());
105
+ const query = this.searchInput.getValue();
106
+ if (query !== previousQuery)
107
+ this.applyFilter(query);
104
108
  }
105
109
  getSelectList() {
106
110
  return this.selectList;