@timurproko/a1 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (455) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +68 -0
  3. package/bin/addone-supervisor.js +7 -0
  4. package/bin/addone-ui.js +20 -0
  5. package/bin/addone.js +26 -0
  6. package/dist/src/cli/dispatch.d.ts +26 -0
  7. package/dist/src/cli/dispatch.d.ts.map +1 -0
  8. package/dist/src/cli/dispatch.js +35 -0
  9. package/dist/src/cli/dispatch.js.map +1 -0
  10. package/dist/src/cli/index.d.ts +4 -0
  11. package/dist/src/cli/index.d.ts.map +1 -0
  12. package/dist/src/cli/index.js +4 -0
  13. package/dist/src/cli/index.js.map +1 -0
  14. package/dist/src/cli/version-stats.d.ts +17 -0
  15. package/dist/src/cli/version-stats.d.ts.map +1 -0
  16. package/dist/src/cli/version-stats.js +68 -0
  17. package/dist/src/cli/version-stats.js.map +1 -0
  18. package/dist/src/cli/version.d.ts +3 -0
  19. package/dist/src/cli/version.d.ts.map +1 -0
  20. package/dist/src/cli/version.js +23 -0
  21. package/dist/src/cli/version.js.map +1 -0
  22. package/dist/src/features/launch/development-launch.d.ts +9 -0
  23. package/dist/src/features/launch/development-launch.d.ts.map +1 -0
  24. package/dist/src/features/launch/development-launch.js +27 -0
  25. package/dist/src/features/launch/development-launch.js.map +1 -0
  26. package/dist/src/features/launch/index.d.ts +8 -0
  27. package/dist/src/features/launch/index.d.ts.map +1 -0
  28. package/dist/src/features/launch/index.js +8 -0
  29. package/dist/src/features/launch/index.js.map +1 -0
  30. package/dist/src/features/launch/initialize-profile.d.ts +7 -0
  31. package/dist/src/features/launch/initialize-profile.d.ts.map +1 -0
  32. package/dist/src/features/launch/initialize-profile.js +59 -0
  33. package/dist/src/features/launch/initialize-profile.js.map +1 -0
  34. package/dist/src/features/launch/intent.d.ts +8 -0
  35. package/dist/src/features/launch/intent.d.ts.map +1 -0
  36. package/dist/src/features/launch/intent.js +5 -0
  37. package/dist/src/features/launch/intent.js.map +1 -0
  38. package/dist/src/features/launch/prepare-launch.d.ts +14 -0
  39. package/dist/src/features/launch/prepare-launch.d.ts.map +1 -0
  40. package/dist/src/features/launch/prepare-launch.js +22 -0
  41. package/dist/src/features/launch/prepare-launch.js.map +1 -0
  42. package/dist/src/features/launch/profile-paths.d.ts +16 -0
  43. package/dist/src/features/launch/profile-paths.d.ts.map +1 -0
  44. package/dist/src/features/launch/profile-paths.js +30 -0
  45. package/dist/src/features/launch/profile-paths.js.map +1 -0
  46. package/dist/src/features/launch/profiles.d.ts +13 -0
  47. package/dist/src/features/launch/profiles.d.ts.map +1 -0
  48. package/dist/src/features/launch/profiles.js +27 -0
  49. package/dist/src/features/launch/profiles.js.map +1 -0
  50. package/dist/src/features/launch/runtime-selection.d.ts +15 -0
  51. package/dist/src/features/launch/runtime-selection.d.ts.map +1 -0
  52. package/dist/src/features/launch/runtime-selection.js +14 -0
  53. package/dist/src/features/launch/runtime-selection.js.map +1 -0
  54. package/dist/src/features/owned-ui/customization.d.ts +36 -0
  55. package/dist/src/features/owned-ui/customization.d.ts.map +1 -0
  56. package/dist/src/features/owned-ui/customization.js +110 -0
  57. package/dist/src/features/owned-ui/customization.js.map +1 -0
  58. package/dist/src/features/owned-ui/diagnostics.d.ts +34 -0
  59. package/dist/src/features/owned-ui/diagnostics.d.ts.map +1 -0
  60. package/dist/src/features/owned-ui/diagnostics.js +95 -0
  61. package/dist/src/features/owned-ui/diagnostics.js.map +1 -0
  62. package/dist/src/features/owned-ui/index.d.ts +5 -0
  63. package/dist/src/features/owned-ui/index.d.ts.map +1 -0
  64. package/dist/src/features/owned-ui/index.js +5 -0
  65. package/dist/src/features/owned-ui/index.js.map +1 -0
  66. package/dist/src/features/owned-ui/pi-session-shell.d.ts +97 -0
  67. package/dist/src/features/owned-ui/pi-session-shell.d.ts.map +1 -0
  68. package/dist/src/features/owned-ui/pi-session-shell.js +1437 -0
  69. package/dist/src/features/owned-ui/pi-session-shell.js.map +1 -0
  70. package/dist/src/features/owned-ui/run.d.ts +9 -0
  71. package/dist/src/features/owned-ui/run.d.ts.map +1 -0
  72. package/dist/src/features/owned-ui/run.js +21 -0
  73. package/dist/src/features/owned-ui/run.js.map +1 -0
  74. package/dist/src/features/workspace/capabilities.d.ts +32 -0
  75. package/dist/src/features/workspace/capabilities.d.ts.map +1 -0
  76. package/dist/src/features/workspace/capabilities.js +76 -0
  77. package/dist/src/features/workspace/capabilities.js.map +1 -0
  78. package/dist/src/features/workspace/index.d.ts +7 -0
  79. package/dist/src/features/workspace/index.d.ts.map +1 -0
  80. package/dist/src/features/workspace/index.js +7 -0
  81. package/dist/src/features/workspace/index.js.map +1 -0
  82. package/dist/src/features/workspace/presentation.d.ts +31 -0
  83. package/dist/src/features/workspace/presentation.d.ts.map +1 -0
  84. package/dist/src/features/workspace/presentation.js +69 -0
  85. package/dist/src/features/workspace/presentation.js.map +1 -0
  86. package/dist/src/features/workspace/reconciliation.d.ts +16 -0
  87. package/dist/src/features/workspace/reconciliation.d.ts.map +1 -0
  88. package/dist/src/features/workspace/reconciliation.js +83 -0
  89. package/dist/src/features/workspace/reconciliation.js.map +1 -0
  90. package/dist/src/features/workspace/reducer.d.ts +43 -0
  91. package/dist/src/features/workspace/reducer.d.ts.map +1 -0
  92. package/dist/src/features/workspace/reducer.js +214 -0
  93. package/dist/src/features/workspace/reducer.js.map +1 -0
  94. package/dist/src/features/workspace/router.d.ts +32 -0
  95. package/dist/src/features/workspace/router.d.ts.map +1 -0
  96. package/dist/src/features/workspace/router.js +125 -0
  97. package/dist/src/features/workspace/router.js.map +1 -0
  98. package/dist/src/features/workspace/store.d.ts +18 -0
  99. package/dist/src/features/workspace/store.d.ts.map +1 -0
  100. package/dist/src/features/workspace/store.js +55 -0
  101. package/dist/src/features/workspace/store.js.map +1 -0
  102. package/dist/src/foundation/lifecycle/index.d.ts +3 -0
  103. package/dist/src/foundation/lifecycle/index.d.ts.map +1 -0
  104. package/dist/src/foundation/lifecycle/index.js +3 -0
  105. package/dist/src/foundation/lifecycle/index.js.map +1 -0
  106. package/dist/src/foundation/lifecycle/model.d.ts +101 -0
  107. package/dist/src/foundation/lifecycle/model.d.ts.map +1 -0
  108. package/dist/src/foundation/lifecycle/model.js +40 -0
  109. package/dist/src/foundation/lifecycle/model.js.map +1 -0
  110. package/dist/src/foundation/lifecycle/paths.d.ts +11 -0
  111. package/dist/src/foundation/lifecycle/paths.d.ts.map +1 -0
  112. package/dist/src/foundation/lifecycle/paths.js +26 -0
  113. package/dist/src/foundation/lifecycle/paths.js.map +1 -0
  114. package/dist/src/foundation/native-host-protocol/codec.d.ts +12 -0
  115. package/dist/src/foundation/native-host-protocol/codec.d.ts.map +1 -0
  116. package/dist/src/foundation/native-host-protocol/codec.js +57 -0
  117. package/dist/src/foundation/native-host-protocol/codec.js.map +1 -0
  118. package/dist/src/foundation/native-host-protocol/evidence.d.ts +68 -0
  119. package/dist/src/foundation/native-host-protocol/evidence.d.ts.map +1 -0
  120. package/dist/src/foundation/native-host-protocol/evidence.js +141 -0
  121. package/dist/src/foundation/native-host-protocol/evidence.js.map +1 -0
  122. package/dist/src/foundation/native-host-protocol/index.d.ts +5 -0
  123. package/dist/src/foundation/native-host-protocol/index.d.ts.map +1 -0
  124. package/dist/src/foundation/native-host-protocol/index.js +5 -0
  125. package/dist/src/foundation/native-host-protocol/index.js.map +1 -0
  126. package/dist/src/foundation/native-host-protocol/messages.d.ts +57 -0
  127. package/dist/src/foundation/native-host-protocol/messages.d.ts.map +1 -0
  128. package/dist/src/foundation/native-host-protocol/messages.js +149 -0
  129. package/dist/src/foundation/native-host-protocol/messages.js.map +1 -0
  130. package/dist/src/foundation/native-host-protocol/proof-gate.d.ts +14 -0
  131. package/dist/src/foundation/native-host-protocol/proof-gate.d.ts.map +1 -0
  132. package/dist/src/foundation/native-host-protocol/proof-gate.js +34 -0
  133. package/dist/src/foundation/native-host-protocol/proof-gate.js.map +1 -0
  134. package/dist/src/foundation/owned-ui-contracts/extension-ui.d.ts +303 -0
  135. package/dist/src/foundation/owned-ui-contracts/extension-ui.d.ts.map +1 -0
  136. package/dist/src/foundation/owned-ui-contracts/extension-ui.js +69 -0
  137. package/dist/src/foundation/owned-ui-contracts/extension-ui.js.map +1 -0
  138. package/dist/src/foundation/owned-ui-contracts/index.d.ts +4 -0
  139. package/dist/src/foundation/owned-ui-contracts/index.d.ts.map +1 -0
  140. package/dist/src/foundation/owned-ui-contracts/index.js +4 -0
  141. package/dist/src/foundation/owned-ui-contracts/index.js.map +1 -0
  142. package/dist/src/foundation/owned-ui-contracts/model.d.ts +242 -0
  143. package/dist/src/foundation/owned-ui-contracts/model.d.ts.map +1 -0
  144. package/dist/src/foundation/owned-ui-contracts/model.js +2 -0
  145. package/dist/src/foundation/owned-ui-contracts/model.js.map +1 -0
  146. package/dist/src/foundation/owned-ui-contracts/validation.d.ts +12 -0
  147. package/dist/src/foundation/owned-ui-contracts/validation.d.ts.map +1 -0
  148. package/dist/src/foundation/owned-ui-contracts/validation.js +396 -0
  149. package/dist/src/foundation/owned-ui-contracts/validation.js.map +1 -0
  150. package/dist/src/foundation/pi-component-adapter/components.d.ts +5 -0
  151. package/dist/src/foundation/pi-component-adapter/components.d.ts.map +1 -0
  152. package/dist/src/foundation/pi-component-adapter/components.js +65 -0
  153. package/dist/src/foundation/pi-component-adapter/components.js.map +1 -0
  154. package/dist/src/foundation/pi-component-adapter/conformance.d.ts +17 -0
  155. package/dist/src/foundation/pi-component-adapter/conformance.d.ts.map +1 -0
  156. package/dist/src/foundation/pi-component-adapter/conformance.js +63 -0
  157. package/dist/src/foundation/pi-component-adapter/conformance.js.map +1 -0
  158. package/dist/src/foundation/pi-component-adapter/index.d.ts +13 -0
  159. package/dist/src/foundation/pi-component-adapter/index.d.ts.map +1 -0
  160. package/dist/src/foundation/pi-component-adapter/index.js +13 -0
  161. package/dist/src/foundation/pi-component-adapter/index.js.map +1 -0
  162. package/dist/src/foundation/pi-component-adapter/shell-components.d.ts +7 -0
  163. package/dist/src/foundation/pi-component-adapter/shell-components.d.ts.map +1 -0
  164. package/dist/src/foundation/pi-component-adapter/shell-components.js +7 -0
  165. package/dist/src/foundation/pi-component-adapter/shell-components.js.map +1 -0
  166. package/dist/src/foundation/pi-component-adapter/shell-editor-autocomplete.d.ts +12 -0
  167. package/dist/src/foundation/pi-component-adapter/shell-editor-autocomplete.d.ts.map +1 -0
  168. package/dist/src/foundation/pi-component-adapter/shell-editor-autocomplete.js +165 -0
  169. package/dist/src/foundation/pi-component-adapter/shell-editor-autocomplete.js.map +1 -0
  170. package/dist/src/foundation/pi-component-adapter/shell-extension-ui.d.ts +36 -0
  171. package/dist/src/foundation/pi-component-adapter/shell-extension-ui.d.ts.map +1 -0
  172. package/dist/src/foundation/pi-component-adapter/shell-extension-ui.js +280 -0
  173. package/dist/src/foundation/pi-component-adapter/shell-extension-ui.js.map +1 -0
  174. package/dist/src/foundation/pi-component-adapter/shell-footer-status.d.ts +8 -0
  175. package/dist/src/foundation/pi-component-adapter/shell-footer-status.d.ts.map +1 -0
  176. package/dist/src/foundation/pi-component-adapter/shell-footer-status.js +246 -0
  177. package/dist/src/foundation/pi-component-adapter/shell-footer-status.js.map +1 -0
  178. package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.d.ts +43 -0
  179. package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.d.ts.map +1 -0
  180. package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.js +397 -0
  181. package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.js.map +1 -0
  182. package/dist/src/foundation/pi-component-adapter/shell-selectors-dialogs.d.ts +106 -0
  183. package/dist/src/foundation/pi-component-adapter/shell-selectors-dialogs.d.ts.map +1 -0
  184. package/dist/src/foundation/pi-component-adapter/shell-selectors-dialogs.js +234 -0
  185. package/dist/src/foundation/pi-component-adapter/shell-selectors-dialogs.js.map +1 -0
  186. package/dist/src/foundation/pi-component-adapter/shell-shared-facade.d.ts +117 -0
  187. package/dist/src/foundation/pi-component-adapter/shell-shared-facade.d.ts.map +1 -0
  188. package/dist/src/foundation/pi-component-adapter/shell-shared-facade.js +88 -0
  189. package/dist/src/foundation/pi-component-adapter/shell-shared-facade.js.map +1 -0
  190. package/dist/src/foundation/pi-component-adapter/theme.d.ts +2 -0
  191. package/dist/src/foundation/pi-component-adapter/theme.d.ts.map +1 -0
  192. package/dist/src/foundation/pi-component-adapter/theme.js +2 -0
  193. package/dist/src/foundation/pi-component-adapter/theme.js.map +1 -0
  194. package/dist/src/foundation/pi-component-adapter/upstream/adjacent/core/keybindings.d.ts +423 -0
  195. package/dist/src/foundation/pi-component-adapter/upstream/adjacent/core/keybindings.d.ts.map +1 -0
  196. package/dist/src/foundation/pi-component-adapter/upstream/adjacent/core/keybindings.js +297 -0
  197. package/dist/src/foundation/pi-component-adapter/upstream/adjacent/core/keybindings.js.map +1 -0
  198. package/dist/src/foundation/pi-component-adapter/upstream/components/countdown-timer.d.ts +11 -0
  199. package/dist/src/foundation/pi-component-adapter/upstream/components/countdown-timer.d.ts.map +1 -0
  200. package/dist/src/foundation/pi-component-adapter/upstream/components/countdown-timer.js +30 -0
  201. package/dist/src/foundation/pi-component-adapter/upstream/components/countdown-timer.js.map +1 -0
  202. package/dist/src/foundation/pi-component-adapter/upstream/components/custom-entry.d.ts +18 -0
  203. package/dist/src/foundation/pi-component-adapter/upstream/components/custom-entry.d.ts.map +1 -0
  204. package/dist/src/foundation/pi-component-adapter/upstream/components/custom-entry.js +52 -0
  205. package/dist/src/foundation/pi-component-adapter/upstream/components/custom-entry.js.map +1 -0
  206. package/dist/src/foundation/pi-component-adapter/upstream/components/daxnuts.d.ts +23 -0
  207. package/dist/src/foundation/pi-component-adapter/upstream/components/daxnuts.d.ts.map +1 -0
  208. package/dist/src/foundation/pi-component-adapter/upstream/components/daxnuts.js +143 -0
  209. package/dist/src/foundation/pi-component-adapter/upstream/components/daxnuts.js.map +1 -0
  210. package/dist/src/foundation/pi-component-adapter/upstream/components/earendil-announcement.d.ts +5 -0
  211. package/dist/src/foundation/pi-component-adapter/upstream/components/earendil-announcement.d.ts.map +1 -0
  212. package/dist/src/foundation/pi-component-adapter/upstream/components/earendil-announcement.js +43 -0
  213. package/dist/src/foundation/pi-component-adapter/upstream/components/earendil-announcement.js.map +1 -0
  214. package/dist/src/foundation/pi-component-adapter/upstream/components/extension-editor.d.ts +18 -0
  215. package/dist/src/foundation/pi-component-adapter/upstream/components/extension-editor.d.ts.map +1 -0
  216. package/dist/src/foundation/pi-component-adapter/upstream/components/extension-editor.js +82 -0
  217. package/dist/src/foundation/pi-component-adapter/upstream/components/extension-editor.js.map +1 -0
  218. package/dist/src/foundation/pi-component-adapter/upstream/components/first-time-setup.d.ts +25 -0
  219. package/dist/src/foundation/pi-component-adapter/upstream/components/first-time-setup.d.ts.map +1 -0
  220. package/dist/src/foundation/pi-component-adapter/upstream/components/first-time-setup.js +106 -0
  221. package/dist/src/foundation/pi-component-adapter/upstream/components/first-time-setup.js.map +1 -0
  222. package/dist/src/foundation/pi-component-adapter/upstream/components/markdown-transform.d.ts +3 -0
  223. package/dist/src/foundation/pi-component-adapter/upstream/components/markdown-transform.d.ts.map +1 -0
  224. package/dist/src/foundation/pi-component-adapter/upstream/components/markdown-transform.js +19 -0
  225. package/dist/src/foundation/pi-component-adapter/upstream/components/markdown-transform.js.map +1 -0
  226. package/dist/src/foundation/pi-component-adapter/upstream/components/mermaid.d.ts +10 -0
  227. package/dist/src/foundation/pi-component-adapter/upstream/components/mermaid.d.ts.map +1 -0
  228. package/dist/src/foundation/pi-component-adapter/upstream/components/mermaid.js +78 -0
  229. package/dist/src/foundation/pi-component-adapter/upstream/components/mermaid.js.map +1 -0
  230. package/dist/src/foundation/pi-component-adapter/upstream/components/scoped-models-selector.d.ts +56 -0
  231. package/dist/src/foundation/pi-component-adapter/upstream/components/scoped-models-selector.d.ts.map +1 -0
  232. package/dist/src/foundation/pi-component-adapter/upstream/components/scoped-models-selector.js +343 -0
  233. package/dist/src/foundation/pi-component-adapter/upstream/components/scoped-models-selector.js.map +1 -0
  234. package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector-search.d.ts +23 -0
  235. package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector-search.d.ts.map +1 -0
  236. package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector-search.js +160 -0
  237. package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector-search.js.map +1 -0
  238. package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector.d.ts +96 -0
  239. package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector.d.ts.map +1 -0
  240. package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector.js +890 -0
  241. package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector.js.map +1 -0
  242. package/dist/src/foundation/pi-component-adapter/upstream/components/skill-invocation-message.d.ts +20 -0
  243. package/dist/src/foundation/pi-component-adapter/upstream/components/skill-invocation-message.d.ts.map +1 -0
  244. package/dist/src/foundation/pi-component-adapter/upstream/components/skill-invocation-message.js +45 -0
  245. package/dist/src/foundation/pi-component-adapter/upstream/components/skill-invocation-message.js.map +1 -0
  246. package/dist/src/foundation/pi-component-adapter/upstream/components/status-indicator.d.ts +31 -0
  247. package/dist/src/foundation/pi-component-adapter/upstream/components/status-indicator.d.ts.map +1 -0
  248. package/dist/src/foundation/pi-component-adapter/upstream/components/status-indicator.js +60 -0
  249. package/dist/src/foundation/pi-component-adapter/upstream/components/status-indicator.js.map +1 -0
  250. package/dist/src/foundation/pi-component-adapter/upstream/components/tree-selector.d.ts +99 -0
  251. package/dist/src/foundation/pi-component-adapter/upstream/components/tree-selector.d.ts.map +1 -0
  252. package/dist/src/foundation/pi-component-adapter/upstream/components/tree-selector.js +1273 -0
  253. package/dist/src/foundation/pi-component-adapter/upstream/components/tree-selector.js.map +1 -0
  254. package/dist/src/foundation/pi-component-adapter/upstream/components/trust-selector.d.ts +34 -0
  255. package/dist/src/foundation/pi-component-adapter/upstream/components/trust-selector.d.ts.map +1 -0
  256. package/dist/src/foundation/pi-component-adapter/upstream/components/trust-selector.js +77 -0
  257. package/dist/src/foundation/pi-component-adapter/upstream/components/trust-selector.js.map +1 -0
  258. package/dist/src/foundation/pi-component-adapter/upstream/external-editor.d.ts +10 -0
  259. package/dist/src/foundation/pi-component-adapter/upstream/external-editor.d.ts.map +1 -0
  260. package/dist/src/foundation/pi-component-adapter/upstream/external-editor.js +40 -0
  261. package/dist/src/foundation/pi-component-adapter/upstream/external-editor.js.map +1 -0
  262. package/dist/src/foundation/pi-component-adapter/upstream/model-search.d.ts +16 -0
  263. package/dist/src/foundation/pi-component-adapter/upstream/model-search.d.ts.map +1 -0
  264. package/dist/src/foundation/pi-component-adapter/upstream/model-search.js +15 -0
  265. package/dist/src/foundation/pi-component-adapter/upstream/model-search.js.map +1 -0
  266. package/dist/src/foundation/pi-component-adapter/upstream/theme/theme-controller.d.ts +26 -0
  267. package/dist/src/foundation/pi-component-adapter/upstream/theme/theme-controller.d.ts.map +1 -0
  268. package/dist/src/foundation/pi-component-adapter/upstream/theme/theme-controller.js +118 -0
  269. package/dist/src/foundation/pi-component-adapter/upstream/theme/theme-controller.js.map +1 -0
  270. package/dist/src/foundation/pi-component-adapter/upstream/theme/theme.d.ts +54 -0
  271. package/dist/src/foundation/pi-component-adapter/upstream/theme/theme.d.ts.map +1 -0
  272. package/dist/src/foundation/pi-component-adapter/upstream/theme/theme.js +311 -0
  273. package/dist/src/foundation/pi-component-adapter/upstream/theme/theme.js.map +1 -0
  274. package/dist/src/foundation/pi-engine-adapter/adapter.d.ts +343 -0
  275. package/dist/src/foundation/pi-engine-adapter/adapter.d.ts.map +1 -0
  276. package/dist/src/foundation/pi-engine-adapter/adapter.js +2365 -0
  277. package/dist/src/foundation/pi-engine-adapter/adapter.js.map +1 -0
  278. package/dist/src/foundation/pi-engine-adapter/conformance.d.ts +14 -0
  279. package/dist/src/foundation/pi-engine-adapter/conformance.d.ts.map +1 -0
  280. package/dist/src/foundation/pi-engine-adapter/conformance.js +85 -0
  281. package/dist/src/foundation/pi-engine-adapter/conformance.js.map +1 -0
  282. package/dist/src/foundation/pi-engine-adapter/index.d.ts +4 -0
  283. package/dist/src/foundation/pi-engine-adapter/index.d.ts.map +1 -0
  284. package/dist/src/foundation/pi-engine-adapter/index.js +4 -0
  285. package/dist/src/foundation/pi-engine-adapter/index.js.map +1 -0
  286. package/dist/src/foundation/pi-engine-adapter/workflows.d.ts +165 -0
  287. package/dist/src/foundation/pi-engine-adapter/workflows.d.ts.map +1 -0
  288. package/dist/src/foundation/pi-engine-adapter/workflows.js +61 -0
  289. package/dist/src/foundation/pi-engine-adapter/workflows.js.map +1 -0
  290. package/dist/src/foundation/pi-tui-runtime-adapter/adapter.d.ts +34 -0
  291. package/dist/src/foundation/pi-tui-runtime-adapter/adapter.d.ts.map +1 -0
  292. package/dist/src/foundation/pi-tui-runtime-adapter/adapter.js +485 -0
  293. package/dist/src/foundation/pi-tui-runtime-adapter/adapter.js.map +1 -0
  294. package/dist/src/foundation/pi-tui-runtime-adapter/conformance.d.ts +14 -0
  295. package/dist/src/foundation/pi-tui-runtime-adapter/conformance.d.ts.map +1 -0
  296. package/dist/src/foundation/pi-tui-runtime-adapter/conformance.js +132 -0
  297. package/dist/src/foundation/pi-tui-runtime-adapter/conformance.js.map +1 -0
  298. package/dist/src/foundation/pi-tui-runtime-adapter/contracts.d.ts +122 -0
  299. package/dist/src/foundation/pi-tui-runtime-adapter/contracts.d.ts.map +1 -0
  300. package/dist/src/foundation/pi-tui-runtime-adapter/contracts.js +2 -0
  301. package/dist/src/foundation/pi-tui-runtime-adapter/contracts.js.map +1 -0
  302. package/dist/src/foundation/pi-tui-runtime-adapter/index.d.ts +4 -0
  303. package/dist/src/foundation/pi-tui-runtime-adapter/index.d.ts.map +1 -0
  304. package/dist/src/foundation/pi-tui-runtime-adapter/index.js +4 -0
  305. package/dist/src/foundation/pi-tui-runtime-adapter/index.js.map +1 -0
  306. package/dist/src/foundation/protocol/client.d.ts +17 -0
  307. package/dist/src/foundation/protocol/client.d.ts.map +1 -0
  308. package/dist/src/foundation/protocol/client.js +127 -0
  309. package/dist/src/foundation/protocol/client.js.map +1 -0
  310. package/dist/src/foundation/protocol/index.d.ts +3 -0
  311. package/dist/src/foundation/protocol/index.d.ts.map +1 -0
  312. package/dist/src/foundation/protocol/index.js +3 -0
  313. package/dist/src/foundation/protocol/index.js.map +1 -0
  314. package/dist/src/foundation/protocol/messages.d.ts +90 -0
  315. package/dist/src/foundation/protocol/messages.d.ts.map +1 -0
  316. package/dist/src/foundation/protocol/messages.js +99 -0
  317. package/dist/src/foundation/protocol/messages.js.map +1 -0
  318. package/dist/src/foundation/release/bootstrap.d.ts +30 -0
  319. package/dist/src/foundation/release/bootstrap.d.ts.map +1 -0
  320. package/dist/src/foundation/release/bootstrap.js +283 -0
  321. package/dist/src/foundation/release/bootstrap.js.map +1 -0
  322. package/dist/src/foundation/release/cohort-selection.d.ts +40 -0
  323. package/dist/src/foundation/release/cohort-selection.d.ts.map +1 -0
  324. package/dist/src/foundation/release/cohort-selection.js +76 -0
  325. package/dist/src/foundation/release/cohort-selection.js.map +1 -0
  326. package/dist/src/foundation/release/cohort-state.d.ts +68 -0
  327. package/dist/src/foundation/release/cohort-state.d.ts.map +1 -0
  328. package/dist/src/foundation/release/cohort-state.js +201 -0
  329. package/dist/src/foundation/release/cohort-state.js.map +1 -0
  330. package/dist/src/foundation/release/development-preview-release.d.ts +49 -0
  331. package/dist/src/foundation/release/development-preview-release.d.ts.map +1 -0
  332. package/dist/src/foundation/release/development-preview-release.js +113 -0
  333. package/dist/src/foundation/release/development-preview-release.js.map +1 -0
  334. package/dist/src/foundation/release/index.d.ts +12 -0
  335. package/dist/src/foundation/release/index.d.ts.map +1 -0
  336. package/dist/src/foundation/release/index.js +12 -0
  337. package/dist/src/foundation/release/index.js.map +1 -0
  338. package/dist/src/foundation/release/process-cleanup.d.ts +15 -0
  339. package/dist/src/foundation/release/process-cleanup.d.ts.map +1 -0
  340. package/dist/src/foundation/release/process-cleanup.js +67 -0
  341. package/dist/src/foundation/release/process-cleanup.js.map +1 -0
  342. package/dist/src/foundation/release/release-gc.d.ts +6 -0
  343. package/dist/src/foundation/release/release-gc.d.ts.map +1 -0
  344. package/dist/src/foundation/release/release-gc.js +17 -0
  345. package/dist/src/foundation/release/release-gc.js.map +1 -0
  346. package/dist/src/foundation/release/release-store.d.ts +11 -0
  347. package/dist/src/foundation/release/release-store.d.ts.map +1 -0
  348. package/dist/src/foundation/release/release-store.js +115 -0
  349. package/dist/src/foundation/release/release-store.js.map +1 -0
  350. package/dist/src/foundation/release/release.d.ts +24 -0
  351. package/dist/src/foundation/release/release.d.ts.map +1 -0
  352. package/dist/src/foundation/release/release.js +151 -0
  353. package/dist/src/foundation/release/release.js.map +1 -0
  354. package/dist/src/foundation/release/stable-release.d.ts +30 -0
  355. package/dist/src/foundation/release/stable-release.d.ts.map +1 -0
  356. package/dist/src/foundation/release/stable-release.js +38 -0
  357. package/dist/src/foundation/release/stable-release.js.map +1 -0
  358. package/dist/src/foundation/release/update-transaction.d.ts +31 -0
  359. package/dist/src/foundation/release/update-transaction.d.ts.map +1 -0
  360. package/dist/src/foundation/release/update-transaction.js +88 -0
  361. package/dist/src/foundation/release/update-transaction.js.map +1 -0
  362. package/dist/src/foundation/release/update.d.ts +55 -0
  363. package/dist/src/foundation/release/update.d.ts.map +1 -0
  364. package/dist/src/foundation/release/update.js +316 -0
  365. package/dist/src/foundation/release/update.js.map +1 -0
  366. package/dist/src/foundation/storage/control-store.d.ts +61 -0
  367. package/dist/src/foundation/storage/control-store.d.ts.map +1 -0
  368. package/dist/src/foundation/storage/control-store.js +459 -0
  369. package/dist/src/foundation/storage/control-store.js.map +1 -0
  370. package/dist/src/foundation/storage/index.d.ts +2 -0
  371. package/dist/src/foundation/storage/index.d.ts.map +1 -0
  372. package/dist/src/foundation/storage/index.js +2 -0
  373. package/dist/src/foundation/storage/index.js.map +1 -0
  374. package/dist/src/foundation/structured-agent-runtime/backpressure.d.ts +47 -0
  375. package/dist/src/foundation/structured-agent-runtime/backpressure.d.ts.map +1 -0
  376. package/dist/src/foundation/structured-agent-runtime/backpressure.js +119 -0
  377. package/dist/src/foundation/structured-agent-runtime/backpressure.js.map +1 -0
  378. package/dist/src/foundation/structured-agent-runtime/commands.d.ts +53 -0
  379. package/dist/src/foundation/structured-agent-runtime/commands.d.ts.map +1 -0
  380. package/dist/src/foundation/structured-agent-runtime/commands.js +165 -0
  381. package/dist/src/foundation/structured-agent-runtime/commands.js.map +1 -0
  382. package/dist/src/foundation/structured-agent-runtime/handshake.d.ts +42 -0
  383. package/dist/src/foundation/structured-agent-runtime/handshake.d.ts.map +1 -0
  384. package/dist/src/foundation/structured-agent-runtime/handshake.js +151 -0
  385. package/dist/src/foundation/structured-agent-runtime/handshake.js.map +1 -0
  386. package/dist/src/foundation/structured-agent-runtime/index.d.ts +6 -0
  387. package/dist/src/foundation/structured-agent-runtime/index.d.ts.map +1 -0
  388. package/dist/src/foundation/structured-agent-runtime/index.js +6 -0
  389. package/dist/src/foundation/structured-agent-runtime/index.js.map +1 -0
  390. package/dist/src/foundation/structured-agent-runtime/reconnection.d.ts +38 -0
  391. package/dist/src/foundation/structured-agent-runtime/reconnection.d.ts.map +1 -0
  392. package/dist/src/foundation/structured-agent-runtime/reconnection.js +130 -0
  393. package/dist/src/foundation/structured-agent-runtime/reconnection.js.map +1 -0
  394. package/dist/src/foundation/structured-agent-runtime/state.d.ts +57 -0
  395. package/dist/src/foundation/structured-agent-runtime/state.d.ts.map +1 -0
  396. package/dist/src/foundation/structured-agent-runtime/state.js +119 -0
  397. package/dist/src/foundation/structured-agent-runtime/state.js.map +1 -0
  398. package/dist/src/foundation/supervision/index.d.ts +4 -0
  399. package/dist/src/foundation/supervision/index.d.ts.map +1 -0
  400. package/dist/src/foundation/supervision/index.js +4 -0
  401. package/dist/src/foundation/supervision/index.js.map +1 -0
  402. package/dist/src/foundation/supervision/main.d.ts +2 -0
  403. package/dist/src/foundation/supervision/main.d.ts.map +1 -0
  404. package/dist/src/foundation/supervision/main.js +40 -0
  405. package/dist/src/foundation/supervision/main.js.map +1 -0
  406. package/dist/src/foundation/supervision/paths.d.ts +2 -0
  407. package/dist/src/foundation/supervision/paths.d.ts.map +1 -0
  408. package/dist/src/foundation/supervision/paths.js +2 -0
  409. package/dist/src/foundation/supervision/paths.js.map +1 -0
  410. package/dist/src/foundation/supervision/server.d.ts +21 -0
  411. package/dist/src/foundation/supervision/server.d.ts.map +1 -0
  412. package/dist/src/foundation/supervision/server.js +283 -0
  413. package/dist/src/foundation/supervision/server.js.map +1 -0
  414. package/dist/src/foundation/transparent-terminal/command-resolution.d.ts +14 -0
  415. package/dist/src/foundation/transparent-terminal/command-resolution.d.ts.map +1 -0
  416. package/dist/src/foundation/transparent-terminal/command-resolution.js +70 -0
  417. package/dist/src/foundation/transparent-terminal/command-resolution.js.map +1 -0
  418. package/dist/src/foundation/transparent-terminal/foreground-broker.d.ts +33 -0
  419. package/dist/src/foundation/transparent-terminal/foreground-broker.d.ts.map +1 -0
  420. package/dist/src/foundation/transparent-terminal/foreground-broker.js +88 -0
  421. package/dist/src/foundation/transparent-terminal/foreground-broker.js.map +1 -0
  422. package/dist/src/foundation/transparent-terminal/index.d.ts +4 -0
  423. package/dist/src/foundation/transparent-terminal/index.d.ts.map +1 -0
  424. package/dist/src/foundation/transparent-terminal/index.js +4 -0
  425. package/dist/src/foundation/transparent-terminal/index.js.map +1 -0
  426. package/dist/src/foundation/transparent-terminal/main.d.ts +10 -0
  427. package/dist/src/foundation/transparent-terminal/main.d.ts.map +1 -0
  428. package/dist/src/foundation/transparent-terminal/main.js +107 -0
  429. package/dist/src/foundation/transparent-terminal/main.js.map +1 -0
  430. package/dist/src/foundation/transparent-terminal/native-launcher.d.ts +26 -0
  431. package/dist/src/foundation/transparent-terminal/native-launcher.d.ts.map +1 -0
  432. package/dist/src/foundation/transparent-terminal/native-launcher.js +147 -0
  433. package/dist/src/foundation/transparent-terminal/native-launcher.js.map +1 -0
  434. package/dist/src/foundation/workspace-contracts/index.d.ts +3 -0
  435. package/dist/src/foundation/workspace-contracts/index.d.ts.map +1 -0
  436. package/dist/src/foundation/workspace-contracts/index.js +3 -0
  437. package/dist/src/foundation/workspace-contracts/index.js.map +1 -0
  438. package/dist/src/foundation/workspace-contracts/model.d.ts +249 -0
  439. package/dist/src/foundation/workspace-contracts/model.d.ts.map +1 -0
  440. package/dist/src/foundation/workspace-contracts/model.js +3 -0
  441. package/dist/src/foundation/workspace-contracts/model.js.map +1 -0
  442. package/dist/src/foundation/workspace-contracts/validation.d.ts +14 -0
  443. package/dist/src/foundation/workspace-contracts/validation.d.ts.map +1 -0
  444. package/dist/src/foundation/workspace-contracts/validation.js +336 -0
  445. package/dist/src/foundation/workspace-contracts/validation.js.map +1 -0
  446. package/docs/architecture/boundaries.md +46 -0
  447. package/docs/architecture/project-structure.md +81 -0
  448. package/docs/architecture/resource-and-data-policy.md +55 -0
  449. package/docs/architecture/terminal-host-proof-gate.md +32 -0
  450. package/docs/architecture/terminal-host-provenance.md +69 -0
  451. package/docs/architecture/terminal-host-spike-evidence.md +39 -0
  452. package/docs/architecture/toolchain.md +66 -0
  453. package/docs/features/launch-profiles.md +50 -0
  454. package/docs/manual-transparent-checkpoint.md +53 -0
  455. package/package.json +73 -0
@@ -0,0 +1,890 @@
1
+ /**
2
+ * Source-synchronized from Pi 0.84.2
3
+ * packages/coding-agent/src/modes/interactive/components/session-selector.ts
4
+ * Mechanical changes: public component/type imports, owned keybindings/theme, and local canonical path helper.
5
+ */
6
+ import { spawnSync } from "node:child_process";
7
+ import { existsSync, realpathSync } from "node:fs";
8
+ import { unlink } from "node:fs/promises";
9
+ import * as os from "node:os";
10
+ import { Container, getKeybindings, Input, Spacer, Text, truncateToWidth, visibleWidth, } from "@earendil-works/pi-tui";
11
+ import { KeybindingsManager } from "../adjacent/core/keybindings.js";
12
+ import { DynamicBorder } from "@earendil-works/pi-coding-agent";
13
+ import { piTheme } from "../theme/theme.js";
14
+ const theme = new Proxy({}, {
15
+ get(_target, property) {
16
+ const active = piTheme();
17
+ const value = active[property];
18
+ return typeof value === "function" ? value.bind(active) : value;
19
+ },
20
+ });
21
+ function keyText(keybinding, keybindings) {
22
+ return keybindings.getKeys(keybinding).join("/");
23
+ }
24
+ function keyHint(keybinding, description, keybindings) {
25
+ return theme.fg("dim", keyText(keybinding, keybindings)) + theme.fg("muted", ` ${description}`);
26
+ }
27
+ import { filterAndSortSessions, hasSessionName } from "./session-selector-search.js";
28
+ function shortenPath(path) {
29
+ const home = os.homedir();
30
+ if (!path)
31
+ return path;
32
+ if (path.startsWith(home)) {
33
+ return `~${path.slice(home.length)}`;
34
+ }
35
+ return path;
36
+ }
37
+ function formatSessionDate(date) {
38
+ const now = new Date();
39
+ const diffMs = now.getTime() - date.getTime();
40
+ const diffMins = Math.floor(diffMs / 60000);
41
+ const diffHours = Math.floor(diffMs / 3600000);
42
+ const diffDays = Math.floor(diffMs / 86400000);
43
+ if (diffMins < 1)
44
+ return "now";
45
+ if (diffMins < 60)
46
+ return `${diffMins}m`;
47
+ if (diffHours < 24)
48
+ return `${diffHours}h`;
49
+ if (diffDays < 7)
50
+ return `${diffDays}d`;
51
+ if (diffDays < 30)
52
+ return `${Math.floor(diffDays / 7)}w`;
53
+ if (diffDays < 365)
54
+ return `${Math.floor(diffDays / 30)}mo`;
55
+ return `${Math.floor(diffDays / 365)}y`;
56
+ }
57
+ function canonicalizePath(path) {
58
+ if (!path)
59
+ return path;
60
+ try {
61
+ return realpathSync(path);
62
+ }
63
+ catch {
64
+ return path;
65
+ }
66
+ }
67
+ class SessionSelectorHeader {
68
+ scope;
69
+ sortMode;
70
+ nameFilter;
71
+ requestRender;
72
+ keybindings;
73
+ loading = false;
74
+ loadProgress = null;
75
+ showPath = false;
76
+ confirmingDeletePath = null;
77
+ statusMessage = null;
78
+ statusTimeout = null;
79
+ showRenameHint = false;
80
+ constructor(scope, sortMode, nameFilter, requestRender, keybindings) {
81
+ this.scope = scope;
82
+ this.sortMode = sortMode;
83
+ this.nameFilter = nameFilter;
84
+ this.requestRender = requestRender;
85
+ this.keybindings = keybindings;
86
+ }
87
+ setScope(scope) {
88
+ this.scope = scope;
89
+ }
90
+ setSortMode(sortMode) {
91
+ this.sortMode = sortMode;
92
+ }
93
+ setNameFilter(nameFilter) {
94
+ this.nameFilter = nameFilter;
95
+ }
96
+ setLoading(loading) {
97
+ this.loading = loading;
98
+ // Progress is scoped to the current load; clear whenever the loading state is set
99
+ this.loadProgress = null;
100
+ }
101
+ setProgress(loaded, total) {
102
+ this.loadProgress = { loaded, total };
103
+ }
104
+ setShowPath(showPath) {
105
+ this.showPath = showPath;
106
+ }
107
+ setShowRenameHint(show) {
108
+ this.showRenameHint = show;
109
+ }
110
+ setConfirmingDeletePath(path) {
111
+ this.confirmingDeletePath = path;
112
+ }
113
+ clearStatusTimeout() {
114
+ if (!this.statusTimeout)
115
+ return;
116
+ clearTimeout(this.statusTimeout);
117
+ this.statusTimeout = null;
118
+ }
119
+ setStatusMessage(msg, autoHideMs) {
120
+ this.clearStatusTimeout();
121
+ this.statusMessage = msg;
122
+ if (!msg || !autoHideMs)
123
+ return;
124
+ this.statusTimeout = setTimeout(() => {
125
+ this.statusMessage = null;
126
+ this.statusTimeout = null;
127
+ this.requestRender();
128
+ }, autoHideMs);
129
+ }
130
+ invalidate() { }
131
+ render(width) {
132
+ const title = this.scope === "current" ? "Resume Session (Current Folder)" : "Resume Session (All)";
133
+ const leftText = theme.bold(title);
134
+ const sortLabel = this.sortMode === "threaded" ? "Threaded" : this.sortMode === "recent" ? "Recent" : "Fuzzy";
135
+ const sortText = theme.fg("muted", "Sort: ") + theme.fg("accent", sortLabel);
136
+ const nameLabel = this.nameFilter === "all" ? "All" : "Named";
137
+ const nameText = theme.fg("muted", "Name: ") + theme.fg("accent", nameLabel);
138
+ let scopeText;
139
+ if (this.loading) {
140
+ const progressText = this.loadProgress ? `${this.loadProgress.loaded}/${this.loadProgress.total}` : "...";
141
+ scopeText = `${theme.fg("muted", "○ Current Folder | ")}${theme.fg("accent", `Loading ${progressText}`)}`;
142
+ }
143
+ else if (this.scope === "current") {
144
+ scopeText = `${theme.fg("accent", "◉ Current Folder")}${theme.fg("muted", " | ○ All")}`;
145
+ }
146
+ else {
147
+ scopeText = `${theme.fg("muted", "○ Current Folder | ")}${theme.fg("accent", "◉ All")}`;
148
+ }
149
+ const rightText = truncateToWidth(`${scopeText} ${nameText} ${sortText}`, width, "");
150
+ const availableLeft = Math.max(0, width - visibleWidth(rightText) - 1);
151
+ const left = truncateToWidth(leftText, availableLeft, "");
152
+ const spacing = Math.max(0, width - visibleWidth(left) - visibleWidth(rightText));
153
+ // Build hint lines - changes based on state (all branches truncate to width)
154
+ let hintLine1;
155
+ let hintLine2;
156
+ if (this.confirmingDeletePath !== null) {
157
+ const confirmHint = `Delete session? ${keyHint("tui.select.confirm", "confirm", this.keybindings)} · ${keyHint("tui.select.cancel", "cancel", this.keybindings)}`;
158
+ hintLine1 = theme.fg("error", truncateToWidth(confirmHint, width, "…"));
159
+ hintLine2 = "";
160
+ }
161
+ else if (this.statusMessage) {
162
+ const color = this.statusMessage.type === "error" ? "error" : "accent";
163
+ hintLine1 = theme.fg(color, truncateToWidth(this.statusMessage.message, width, "…"));
164
+ hintLine2 = "";
165
+ }
166
+ else {
167
+ const pathState = this.showPath ? "(on)" : "(off)";
168
+ const sep = theme.fg("muted", " · ");
169
+ const hint1 = keyHint("tui.input.tab", "scope", this.keybindings) + sep + theme.fg("muted", 're:<pattern> regex · "phrase" exact');
170
+ const hint2Parts = [
171
+ keyHint("app.session.toggleSort", "sort", this.keybindings),
172
+ keyHint("app.session.toggleNamedFilter", "named", this.keybindings),
173
+ keyHint("app.session.delete", "delete", this.keybindings),
174
+ keyHint("app.session.togglePath", `path ${pathState}`, this.keybindings),
175
+ ];
176
+ if (this.showRenameHint) {
177
+ hint2Parts.push(keyHint("app.session.rename", "rename", this.keybindings));
178
+ }
179
+ const hint2 = hint2Parts.join(sep);
180
+ hintLine1 = truncateToWidth(hint1, width, "…");
181
+ hintLine2 = truncateToWidth(hint2, width, "…");
182
+ }
183
+ return [`${left}${" ".repeat(spacing)}${rightText}`, hintLine1, hintLine2];
184
+ }
185
+ }
186
+ /**
187
+ * Build a tree structure from sessions based on parentSessionPath.
188
+ * Returns root nodes sorted by modified date (descending).
189
+ */
190
+ function buildSessionTree(sessions) {
191
+ const byPath = new Map();
192
+ for (const session of sessions) {
193
+ const sessionPath = canonicalizePath(session.path) ?? session.path;
194
+ byPath.set(sessionPath, { session, children: [], latestActivity: session.modified.getTime() });
195
+ }
196
+ const roots = [];
197
+ for (const session of sessions) {
198
+ const sessionPath = canonicalizePath(session.path) ?? session.path;
199
+ const node = byPath.get(sessionPath);
200
+ const parentPath = canonicalizePath(session.parentSessionPath);
201
+ if (parentPath && byPath.has(parentPath)) {
202
+ byPath.get(parentPath).children.push(node);
203
+ }
204
+ else {
205
+ roots.push(node);
206
+ }
207
+ }
208
+ const updateLatestActivity = (node) => {
209
+ let latestActivity = node.session.modified.getTime();
210
+ for (const child of node.children) {
211
+ latestActivity = Math.max(latestActivity, updateLatestActivity(child));
212
+ }
213
+ node.latestActivity = latestActivity;
214
+ return latestActivity;
215
+ };
216
+ for (const root of roots) {
217
+ updateLatestActivity(root);
218
+ }
219
+ // Sort children and roots by latest activity in each subtree (descending)
220
+ const sortNodes = (nodes) => {
221
+ nodes.sort((a, b) => b.latestActivity - a.latestActivity);
222
+ for (const node of nodes) {
223
+ sortNodes(node.children);
224
+ }
225
+ };
226
+ sortNodes(roots);
227
+ return roots;
228
+ }
229
+ /**
230
+ * Flatten tree into display list with tree structure metadata.
231
+ */
232
+ function flattenSessionTree(roots) {
233
+ const result = [];
234
+ const walk = (node, depth, ancestorContinues, isLast) => {
235
+ result.push({ session: node.session, depth, isLast, ancestorContinues });
236
+ for (let i = 0; i < node.children.length; i++) {
237
+ const childIsLast = i === node.children.length - 1;
238
+ // Only show continuation line for non-root ancestors
239
+ const continues = depth > 0 ? !isLast : false;
240
+ walk(node.children[i], depth + 1, [...ancestorContinues, continues], childIsLast);
241
+ }
242
+ };
243
+ for (let i = 0; i < roots.length; i++) {
244
+ walk(roots[i], 0, [], i === roots.length - 1);
245
+ }
246
+ return result;
247
+ }
248
+ /**
249
+ * Custom session list component with multi-line items and search
250
+ */
251
+ class SessionList {
252
+ getSelectedSessionPath() {
253
+ const selected = this.filteredSessions[this.selectedIndex];
254
+ return selected?.session.path;
255
+ }
256
+ allSessions = [];
257
+ filteredSessions = [];
258
+ selectedIndex = 0;
259
+ searchInput;
260
+ showCwd = false;
261
+ sortMode = "threaded";
262
+ nameFilter = "all";
263
+ keybindings;
264
+ showPath = false;
265
+ confirmingDeletePath = null;
266
+ currentSessionCanonicalPath;
267
+ onSelect;
268
+ onCancel;
269
+ onExit = () => { };
270
+ onToggleScope;
271
+ onToggleSort;
272
+ onToggleNameFilter;
273
+ onTogglePath;
274
+ onDeleteConfirmationChange;
275
+ onDeleteSession;
276
+ onRenameSession;
277
+ onError;
278
+ maxVisible = 10; // Max sessions visible (one line each)
279
+ // Focusable implementation - propagate to searchInput for IME cursor positioning
280
+ _focused = false;
281
+ get focused() {
282
+ return this._focused;
283
+ }
284
+ set focused(value) {
285
+ this._focused = value;
286
+ this.searchInput.focused = value;
287
+ }
288
+ constructor(sessions, showCwd, sortMode, nameFilter, keybindings, currentSessionFilePath) {
289
+ this.allSessions = sessions;
290
+ this.filteredSessions = [];
291
+ this.searchInput = new Input();
292
+ this.showCwd = showCwd;
293
+ this.sortMode = sortMode;
294
+ this.nameFilter = nameFilter;
295
+ this.keybindings = keybindings;
296
+ this.currentSessionCanonicalPath = canonicalizePath(currentSessionFilePath);
297
+ this.filterSessions("");
298
+ // Handle Enter in search input - select current item
299
+ this.searchInput.onSubmit = () => {
300
+ if (this.filteredSessions[this.selectedIndex]) {
301
+ const selected = this.filteredSessions[this.selectedIndex];
302
+ if (this.onSelect) {
303
+ this.onSelect(selected.session.path);
304
+ }
305
+ }
306
+ };
307
+ }
308
+ setSortMode(sortMode) {
309
+ this.sortMode = sortMode;
310
+ this.filterSessions(this.searchInput.getValue());
311
+ }
312
+ setNameFilter(nameFilter) {
313
+ this.nameFilter = nameFilter;
314
+ this.filterSessions(this.searchInput.getValue());
315
+ }
316
+ setSessions(sessions, showCwd) {
317
+ this.allSessions = sessions;
318
+ this.showCwd = showCwd;
319
+ this.filterSessions(this.searchInput.getValue());
320
+ }
321
+ filterSessions(query) {
322
+ const trimmed = query.trim();
323
+ const nameFiltered = this.nameFilter === "all" ? this.allSessions : this.allSessions.filter((session) => hasSessionName(session));
324
+ if (this.sortMode === "threaded" && !trimmed) {
325
+ // Threaded mode without search: show tree structure
326
+ const roots = buildSessionTree(nameFiltered);
327
+ this.filteredSessions = flattenSessionTree(roots);
328
+ }
329
+ else {
330
+ // Other modes or with search: flat list
331
+ const filtered = filterAndSortSessions(nameFiltered, query, this.sortMode, "all");
332
+ this.filteredSessions = filtered.map((session) => ({
333
+ session,
334
+ depth: 0,
335
+ isLast: true,
336
+ ancestorContinues: [],
337
+ }));
338
+ }
339
+ this.selectedIndex = Math.min(this.selectedIndex, Math.max(0, this.filteredSessions.length - 1));
340
+ }
341
+ setConfirmingDeletePath(path) {
342
+ this.confirmingDeletePath = path;
343
+ this.onDeleteConfirmationChange?.(path);
344
+ }
345
+ startDeleteConfirmationForSelectedSession() {
346
+ const selected = this.filteredSessions[this.selectedIndex];
347
+ if (!selected)
348
+ return;
349
+ // Prevent deleting current session
350
+ if (this.isCurrentSessionPath(selected.session.path)) {
351
+ this.onError?.("Cannot delete the currently active session");
352
+ return;
353
+ }
354
+ this.setConfirmingDeletePath(selected.session.path);
355
+ }
356
+ isCurrentSessionPath(path) {
357
+ if (!this.currentSessionCanonicalPath)
358
+ return false;
359
+ return (canonicalizePath(path) ?? path) === this.currentSessionCanonicalPath;
360
+ }
361
+ invalidate() { }
362
+ render(width) {
363
+ const lines = [];
364
+ // Render search input
365
+ lines.push(...this.searchInput.render(width));
366
+ lines.push(""); // Blank line after search
367
+ if (this.filteredSessions.length === 0) {
368
+ let emptyMessage;
369
+ if (this.nameFilter === "named") {
370
+ const toggleKey = keyText("app.session.toggleNamedFilter", this.keybindings);
371
+ if (this.showCwd) {
372
+ emptyMessage = ` No named sessions found. Press ${toggleKey} to show all.`;
373
+ }
374
+ else {
375
+ emptyMessage = ` No named sessions in current folder. Press ${toggleKey} to show all, or Tab to view all.`;
376
+ }
377
+ }
378
+ else if (this.showCwd) {
379
+ // "All" scope - no sessions anywhere that match filter
380
+ emptyMessage = " No sessions found";
381
+ }
382
+ else {
383
+ // "Current folder" scope - hint to try "all"
384
+ emptyMessage = " No sessions in current folder. Press Tab to view all.";
385
+ }
386
+ lines.push(theme.fg("muted", truncateToWidth(emptyMessage, width, "…")));
387
+ return lines;
388
+ }
389
+ // Calculate visible range with scrolling
390
+ const startIndex = Math.max(0, Math.min(this.selectedIndex - Math.floor(this.maxVisible / 2), this.filteredSessions.length - this.maxVisible));
391
+ const endIndex = Math.min(startIndex + this.maxVisible, this.filteredSessions.length);
392
+ // Render visible sessions (one line each with tree structure)
393
+ for (let i = startIndex; i < endIndex; i++) {
394
+ const node = this.filteredSessions[i];
395
+ const session = node.session;
396
+ const isSelected = i === this.selectedIndex;
397
+ const isConfirmingDelete = session.path === this.confirmingDeletePath;
398
+ const isCurrent = this.isCurrentSessionPath(session.path);
399
+ // Build tree prefix
400
+ const prefix = this.buildTreePrefix(node);
401
+ // Session display text (name or first message)
402
+ const hasName = !!session.name;
403
+ const displayText = session.name ?? session.firstMessage;
404
+ const normalizedMessage = displayText.replace(/[\x00-\x1f\x7f]/g, " ").trim();
405
+ // Right side: message count and age
406
+ const age = formatSessionDate(session.modified);
407
+ const msgCount = String(session.messageCount);
408
+ let rightPart = `${msgCount} ${age}`;
409
+ if (this.showCwd && session.cwd) {
410
+ rightPart = `${shortenPath(session.cwd)} ${rightPart}`;
411
+ }
412
+ if (this.showPath) {
413
+ rightPart = `${shortenPath(session.path)} ${rightPart}`;
414
+ }
415
+ // Cursor
416
+ const cursor = isSelected ? theme.fg("accent", "› ") : " ";
417
+ // Calculate available width for message
418
+ const prefixWidth = visibleWidth(prefix);
419
+ const rightWidth = visibleWidth(rightPart) + 2; // +2 for spacing
420
+ const availableForMsg = width - 2 - prefixWidth - rightWidth; // -2 for cursor
421
+ const truncatedMsg = truncateToWidth(normalizedMessage, Math.max(10, availableForMsg), "…");
422
+ // Style message
423
+ let messageColor = null;
424
+ if (isConfirmingDelete) {
425
+ messageColor = "error";
426
+ }
427
+ else if (isCurrent) {
428
+ messageColor = "accent";
429
+ }
430
+ else if (hasName) {
431
+ messageColor = "warning";
432
+ }
433
+ let styledMsg = messageColor ? theme.fg(messageColor, truncatedMsg) : truncatedMsg;
434
+ if (isSelected) {
435
+ styledMsg = theme.bold(styledMsg);
436
+ }
437
+ // Build line
438
+ const leftPart = cursor + theme.fg("dim", prefix) + styledMsg;
439
+ const leftWidth = visibleWidth(leftPart);
440
+ const spacing = Math.max(1, width - leftWidth - visibleWidth(rightPart));
441
+ const styledRight = theme.fg(isConfirmingDelete ? "error" : "dim", rightPart);
442
+ let line = leftPart + " ".repeat(spacing) + styledRight;
443
+ if (isSelected) {
444
+ line = theme.bg("selectedBg", line);
445
+ }
446
+ lines.push(truncateToWidth(line, width));
447
+ }
448
+ // Add scroll indicator if needed
449
+ if (startIndex > 0 || endIndex < this.filteredSessions.length) {
450
+ const scrollText = ` (${this.selectedIndex + 1}/${this.filteredSessions.length})`;
451
+ const scrollInfo = theme.fg("muted", truncateToWidth(scrollText, width, ""));
452
+ lines.push(scrollInfo);
453
+ }
454
+ return lines;
455
+ }
456
+ buildTreePrefix(node) {
457
+ if (node.depth === 0) {
458
+ return "";
459
+ }
460
+ const parts = node.ancestorContinues.map((continues) => (continues ? "│ " : " "));
461
+ const branch = node.isLast ? "└─ " : "├─ ";
462
+ return parts.join("") + branch;
463
+ }
464
+ handleInput(keyData) {
465
+ const kb = getKeybindings();
466
+ // Handle delete confirmation state first - intercept all keys
467
+ if (this.confirmingDeletePath !== null) {
468
+ if (kb.matches(keyData, "tui.select.confirm")) {
469
+ const pathToDelete = this.confirmingDeletePath;
470
+ this.setConfirmingDeletePath(null);
471
+ void this.onDeleteSession?.(pathToDelete);
472
+ return;
473
+ }
474
+ if (kb.matches(keyData, "tui.select.cancel")) {
475
+ this.setConfirmingDeletePath(null);
476
+ return;
477
+ }
478
+ // Ignore all other keys while confirming
479
+ return;
480
+ }
481
+ if (kb.matches(keyData, "tui.input.tab")) {
482
+ if (this.onToggleScope) {
483
+ this.onToggleScope();
484
+ }
485
+ return;
486
+ }
487
+ if (kb.matches(keyData, "app.session.toggleSort")) {
488
+ this.onToggleSort?.();
489
+ return;
490
+ }
491
+ if (this.keybindings.matches(keyData, "app.session.toggleNamedFilter")) {
492
+ this.onToggleNameFilter?.();
493
+ return;
494
+ }
495
+ // Ctrl+P: toggle path display
496
+ if (kb.matches(keyData, "app.session.togglePath")) {
497
+ this.showPath = !this.showPath;
498
+ this.onTogglePath?.(this.showPath);
499
+ return;
500
+ }
501
+ // Ctrl+D: initiate delete confirmation (useful on terminals that don't distinguish Ctrl+Backspace from Backspace)
502
+ if (kb.matches(keyData, "app.session.delete")) {
503
+ this.startDeleteConfirmationForSelectedSession();
504
+ return;
505
+ }
506
+ // Rename selected session
507
+ if (kb.matches(keyData, "app.session.rename")) {
508
+ const selected = this.filteredSessions[this.selectedIndex];
509
+ if (selected) {
510
+ this.onRenameSession?.(selected.session.path);
511
+ }
512
+ return;
513
+ }
514
+ // Ctrl+Backspace: non-invasive convenience alias for delete
515
+ // Only triggers deletion when the query is empty; otherwise it is forwarded to the input
516
+ if (kb.matches(keyData, "app.session.deleteNoninvasive")) {
517
+ if (this.searchInput.getValue().length > 0) {
518
+ this.searchInput.handleInput(keyData);
519
+ this.filterSessions(this.searchInput.getValue());
520
+ return;
521
+ }
522
+ this.startDeleteConfirmationForSelectedSession();
523
+ return;
524
+ }
525
+ // Up arrow
526
+ if (kb.matches(keyData, "tui.select.up")) {
527
+ this.selectedIndex = Math.max(0, this.selectedIndex - 1);
528
+ }
529
+ // Down arrow
530
+ else if (kb.matches(keyData, "tui.select.down")) {
531
+ this.selectedIndex = Math.min(this.filteredSessions.length - 1, this.selectedIndex + 1);
532
+ }
533
+ // Page up - jump up by maxVisible items
534
+ else if (kb.matches(keyData, "tui.select.pageUp")) {
535
+ this.selectedIndex = Math.max(0, this.selectedIndex - this.maxVisible);
536
+ }
537
+ // Page down - jump down by maxVisible items
538
+ else if (kb.matches(keyData, "tui.select.pageDown")) {
539
+ this.selectedIndex = Math.min(this.filteredSessions.length - 1, this.selectedIndex + this.maxVisible);
540
+ }
541
+ // Enter
542
+ else if (kb.matches(keyData, "tui.select.confirm")) {
543
+ const selected = this.filteredSessions[this.selectedIndex];
544
+ if (selected && this.onSelect) {
545
+ this.onSelect(selected.session.path);
546
+ }
547
+ }
548
+ // Escape - cancel
549
+ else if (kb.matches(keyData, "tui.select.cancel")) {
550
+ if (this.onCancel) {
551
+ this.onCancel();
552
+ }
553
+ }
554
+ // Pass everything else to search input
555
+ else {
556
+ this.searchInput.handleInput(keyData);
557
+ this.filterSessions(this.searchInput.getValue());
558
+ }
559
+ }
560
+ }
561
+ /**
562
+ * Delete a session file, trying the `trash` CLI first, then falling back to unlink
563
+ */
564
+ async function deleteSessionFile(sessionPath) {
565
+ // Try `trash` first (if installed)
566
+ const trashArgs = sessionPath.startsWith("-") ? ["--", sessionPath] : [sessionPath];
567
+ const trashResult = spawnSync("trash", trashArgs, { encoding: "utf-8" });
568
+ const getTrashErrorHint = () => {
569
+ const parts = [];
570
+ if (trashResult.error) {
571
+ parts.push(trashResult.error.message);
572
+ }
573
+ const stderr = trashResult.stderr?.trim();
574
+ if (stderr) {
575
+ parts.push(stderr.split("\n")[0] ?? stderr);
576
+ }
577
+ if (parts.length === 0)
578
+ return null;
579
+ return `trash: ${parts.join(" · ").slice(0, 200)}`;
580
+ };
581
+ // If trash reports success, or the file is gone afterwards, treat it as successful
582
+ if (trashResult.status === 0 || !existsSync(sessionPath)) {
583
+ return { ok: true, method: "trash" };
584
+ }
585
+ // Fallback to permanent deletion
586
+ try {
587
+ await unlink(sessionPath);
588
+ return { ok: true, method: "unlink" };
589
+ }
590
+ catch (err) {
591
+ const unlinkError = err instanceof Error ? err.message : String(err);
592
+ const trashErrorHint = getTrashErrorHint();
593
+ const error = trashErrorHint ? `${unlinkError} (${trashErrorHint})` : unlinkError;
594
+ return { ok: false, method: "unlink", error };
595
+ }
596
+ }
597
+ /**
598
+ * Component that renders a session selector
599
+ */
600
+ export class SessionSelectorComponent extends Container {
601
+ handleInput(data) {
602
+ if (this.mode === "rename") {
603
+ const kb = getKeybindings();
604
+ if (kb.matches(data, "tui.select.cancel")) {
605
+ this.exitRenameMode();
606
+ return;
607
+ }
608
+ this.renameInput.handleInput(data);
609
+ return;
610
+ }
611
+ this.sessionList.handleInput(data);
612
+ }
613
+ canRename = true;
614
+ sessionList;
615
+ header;
616
+ keybindings;
617
+ scope = "current";
618
+ sortMode = "threaded";
619
+ nameFilter = "all";
620
+ currentSessions = null;
621
+ allSessions = null;
622
+ currentSessionsLoader;
623
+ allSessionsLoader;
624
+ requestRender;
625
+ renameSession;
626
+ currentLoading = false;
627
+ allLoading = false;
628
+ allLoadSeq = 0;
629
+ mode = "list";
630
+ renameInput = new Input();
631
+ renameTargetPath = null;
632
+ // Focusable implementation - propagate to sessionList for IME cursor positioning
633
+ _focused = false;
634
+ get focused() {
635
+ return this._focused;
636
+ }
637
+ set focused(value) {
638
+ this._focused = value;
639
+ this.sessionList.focused = value;
640
+ this.renameInput.focused = value;
641
+ if (value && this.mode === "rename") {
642
+ this.renameInput.focused = true;
643
+ }
644
+ }
645
+ buildBaseLayout(content, options) {
646
+ this.clear();
647
+ this.addChild(new Spacer(1));
648
+ this.addChild(new DynamicBorder((s) => theme.fg("accent", s)));
649
+ this.addChild(new Spacer(1));
650
+ if (options?.showHeader ?? true) {
651
+ this.addChild(this.header);
652
+ this.addChild(new Spacer(1));
653
+ }
654
+ this.addChild(content);
655
+ this.addChild(new Spacer(1));
656
+ this.addChild(new DynamicBorder((s) => theme.fg("accent", s)));
657
+ }
658
+ constructor(currentSessionsLoader, allSessionsLoader, onSelect, onCancel, onExit, requestRender, options, currentSessionFilePath) {
659
+ super();
660
+ this.keybindings = options?.keybindings ?? KeybindingsManager.create();
661
+ this.currentSessionsLoader = currentSessionsLoader;
662
+ this.allSessionsLoader = allSessionsLoader;
663
+ this.requestRender = requestRender;
664
+ this.header = new SessionSelectorHeader(this.scope, this.sortMode, this.nameFilter, this.requestRender, this.keybindings);
665
+ const renameSession = options?.renameSession;
666
+ this.renameSession = renameSession;
667
+ this.canRename = !!renameSession;
668
+ this.header.setShowRenameHint(options?.showRenameHint ?? this.canRename);
669
+ // Create session list (starts empty, will be populated after load)
670
+ this.sessionList = new SessionList([], false, this.sortMode, this.nameFilter, this.keybindings, currentSessionFilePath);
671
+ this.buildBaseLayout(this.sessionList);
672
+ this.renameInput.onSubmit = (value) => {
673
+ void this.confirmRename(value);
674
+ };
675
+ // Ensure header status timeouts are cleared when leaving the selector
676
+ const clearStatusMessage = () => this.header.setStatusMessage(null);
677
+ this.sessionList.onSelect = (sessionPath) => {
678
+ clearStatusMessage();
679
+ onSelect(sessionPath);
680
+ };
681
+ this.sessionList.onCancel = () => {
682
+ clearStatusMessage();
683
+ onCancel();
684
+ };
685
+ this.sessionList.onExit = () => {
686
+ clearStatusMessage();
687
+ onExit();
688
+ };
689
+ this.sessionList.onToggleScope = () => this.toggleScope();
690
+ this.sessionList.onToggleSort = () => this.toggleSortMode();
691
+ this.sessionList.onToggleNameFilter = () => this.toggleNameFilter();
692
+ this.sessionList.onRenameSession = (sessionPath) => {
693
+ if (!renameSession)
694
+ return;
695
+ if (this.scope === "current" && this.currentLoading)
696
+ return;
697
+ if (this.scope === "all" && this.allLoading)
698
+ return;
699
+ const sessions = this.scope === "all" ? (this.allSessions ?? []) : (this.currentSessions ?? []);
700
+ const session = sessions.find((s) => s.path === sessionPath);
701
+ this.enterRenameMode(sessionPath, session?.name);
702
+ };
703
+ // Sync list events to header
704
+ this.sessionList.onTogglePath = (showPath) => {
705
+ this.header.setShowPath(showPath);
706
+ this.requestRender();
707
+ };
708
+ this.sessionList.onDeleteConfirmationChange = (path) => {
709
+ this.header.setConfirmingDeletePath(path);
710
+ this.requestRender();
711
+ };
712
+ this.sessionList.onError = (msg) => {
713
+ this.header.setStatusMessage({ type: "error", message: msg }, 3000);
714
+ this.requestRender();
715
+ };
716
+ // Handle session deletion
717
+ this.sessionList.onDeleteSession = async (sessionPath) => {
718
+ const result = await deleteSessionFile(sessionPath);
719
+ if (result.ok) {
720
+ if (this.currentSessions) {
721
+ this.currentSessions = this.currentSessions.filter((s) => s.path !== sessionPath);
722
+ }
723
+ if (this.allSessions) {
724
+ this.allSessions = this.allSessions.filter((s) => s.path !== sessionPath);
725
+ }
726
+ const sessions = this.scope === "all" ? (this.allSessions ?? []) : (this.currentSessions ?? []);
727
+ const showCwd = this.scope === "all";
728
+ this.sessionList.setSessions(sessions, showCwd);
729
+ const msg = result.method === "trash" ? "Session moved to trash" : "Session deleted";
730
+ this.header.setStatusMessage({ type: "info", message: msg }, 2000);
731
+ await this.refreshSessionsAfterMutation();
732
+ }
733
+ else {
734
+ const errorMessage = result.error ?? "Unknown error";
735
+ this.header.setStatusMessage({ type: "error", message: `Failed to delete: ${errorMessage}` }, 3000);
736
+ }
737
+ this.requestRender();
738
+ };
739
+ // Start loading current sessions immediately
740
+ this.loadCurrentSessions();
741
+ }
742
+ loadCurrentSessions() {
743
+ void this.loadScope("current", "initial");
744
+ }
745
+ enterRenameMode(sessionPath, currentName) {
746
+ this.mode = "rename";
747
+ this.renameTargetPath = sessionPath;
748
+ this.renameInput.setValue(currentName ?? "");
749
+ this.renameInput.focused = true;
750
+ const panel = new Container();
751
+ panel.addChild(new Text(theme.bold("Rename Session"), 1, 0));
752
+ panel.addChild(new Spacer(1));
753
+ panel.addChild(this.renameInput);
754
+ panel.addChild(new Spacer(1));
755
+ panel.addChild(new Text(theme.fg("muted", `${keyText("tui.select.confirm", this.keybindings)} to save · ${keyText("tui.select.cancel", this.keybindings)} to cancel`), 1, 0));
756
+ this.buildBaseLayout(panel, { showHeader: false });
757
+ this.requestRender();
758
+ }
759
+ exitRenameMode() {
760
+ this.mode = "list";
761
+ this.renameTargetPath = null;
762
+ this.buildBaseLayout(this.sessionList);
763
+ this.requestRender();
764
+ }
765
+ async confirmRename(value) {
766
+ const next = value.trim();
767
+ if (!next)
768
+ return;
769
+ const target = this.renameTargetPath;
770
+ if (!target) {
771
+ this.exitRenameMode();
772
+ return;
773
+ }
774
+ // Find current name for callback
775
+ const renameSession = this.renameSession;
776
+ if (!renameSession) {
777
+ this.exitRenameMode();
778
+ return;
779
+ }
780
+ try {
781
+ await renameSession(target, next);
782
+ await this.refreshSessionsAfterMutation();
783
+ }
784
+ finally {
785
+ this.exitRenameMode();
786
+ }
787
+ }
788
+ async loadScope(scope, reason) {
789
+ const showCwd = scope === "all";
790
+ // Mark loading
791
+ if (scope === "current") {
792
+ this.currentLoading = true;
793
+ }
794
+ else {
795
+ this.allLoading = true;
796
+ }
797
+ const seq = scope === "all" ? ++this.allLoadSeq : undefined;
798
+ this.header.setScope(scope);
799
+ this.header.setLoading(true);
800
+ this.requestRender();
801
+ const onProgress = (loaded, total) => {
802
+ if (scope !== this.scope)
803
+ return;
804
+ if (seq !== undefined && seq !== this.allLoadSeq)
805
+ return;
806
+ this.header.setProgress(loaded, total);
807
+ this.requestRender();
808
+ };
809
+ try {
810
+ const sessions = await (scope === "current"
811
+ ? this.currentSessionsLoader(onProgress)
812
+ : this.allSessionsLoader(onProgress));
813
+ if (scope === "current") {
814
+ this.currentSessions = sessions;
815
+ this.currentLoading = false;
816
+ }
817
+ else {
818
+ this.allSessions = sessions;
819
+ this.allLoading = false;
820
+ }
821
+ if (scope !== this.scope)
822
+ return;
823
+ if (seq !== undefined && seq !== this.allLoadSeq)
824
+ return;
825
+ this.header.setLoading(false);
826
+ this.sessionList.setSessions(sessions, showCwd);
827
+ this.requestRender();
828
+ }
829
+ catch (err) {
830
+ if (scope === "current") {
831
+ this.currentLoading = false;
832
+ }
833
+ else {
834
+ this.allLoading = false;
835
+ }
836
+ if (scope !== this.scope)
837
+ return;
838
+ if (seq !== undefined && seq !== this.allLoadSeq)
839
+ return;
840
+ const message = err instanceof Error ? err.message : String(err);
841
+ this.header.setLoading(false);
842
+ this.header.setStatusMessage({ type: "error", message: `Failed to load sessions: ${message}` }, 4000);
843
+ if (reason === "initial") {
844
+ this.sessionList.setSessions([], showCwd);
845
+ }
846
+ this.requestRender();
847
+ }
848
+ }
849
+ toggleSortMode() {
850
+ // Cycle: threaded -> recent -> relevance -> threaded
851
+ this.sortMode = this.sortMode === "threaded" ? "recent" : this.sortMode === "recent" ? "relevance" : "threaded";
852
+ this.header.setSortMode(this.sortMode);
853
+ this.sessionList.setSortMode(this.sortMode);
854
+ this.requestRender();
855
+ }
856
+ toggleNameFilter() {
857
+ this.nameFilter = this.nameFilter === "all" ? "named" : "all";
858
+ this.header.setNameFilter(this.nameFilter);
859
+ this.sessionList.setNameFilter(this.nameFilter);
860
+ this.requestRender();
861
+ }
862
+ async refreshSessionsAfterMutation() {
863
+ await this.loadScope(this.scope, "refresh");
864
+ }
865
+ toggleScope() {
866
+ if (this.scope === "current") {
867
+ this.scope = "all";
868
+ this.header.setScope(this.scope);
869
+ if (this.allSessions !== null) {
870
+ this.header.setLoading(false);
871
+ this.sessionList.setSessions(this.allSessions, true);
872
+ this.requestRender();
873
+ return;
874
+ }
875
+ if (!this.allLoading) {
876
+ void this.loadScope("all", "toggle");
877
+ }
878
+ return;
879
+ }
880
+ this.scope = "current";
881
+ this.header.setScope(this.scope);
882
+ this.header.setLoading(this.currentLoading);
883
+ this.sessionList.setSessions(this.currentSessions ?? [], false);
884
+ this.requestRender();
885
+ }
886
+ getSessionList() {
887
+ return this.sessionList;
888
+ }
889
+ }
890
+ //# sourceMappingURL=session-selector.js.map