@onpoint-dev-tools/crewcoder-opentui 0.0.0-stage → 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 (325) hide show
  1. package/LICENSE +191 -0
  2. package/README.md +262 -2
  3. package/THIRD_PARTY_NOTICES.md +51 -0
  4. package/dist/App.d.ts +16 -0
  5. package/dist/App.d.ts.map +1 -0
  6. package/dist/App.js +428 -0
  7. package/dist/App.js.map +1 -0
  8. package/dist/Root.d.ts +11 -0
  9. package/dist/Root.d.ts.map +1 -0
  10. package/dist/Root.js +13 -0
  11. package/dist/Root.js.map +1 -0
  12. package/dist/alert-model.d.ts +31 -0
  13. package/dist/alert-model.d.ts.map +1 -0
  14. package/dist/alert-model.js +34 -0
  15. package/dist/alert-model.js.map +1 -0
  16. package/dist/args.d.ts +13 -0
  17. package/dist/args.d.ts.map +1 -0
  18. package/dist/args.js +63 -0
  19. package/dist/args.js.map +1 -0
  20. package/dist/attachments.d.ts +29 -0
  21. package/dist/attachments.d.ts.map +1 -0
  22. package/dist/attachments.js +38 -0
  23. package/dist/attachments.js.map +1 -0
  24. package/dist/block-panels.d.ts +43 -0
  25. package/dist/block-panels.d.ts.map +1 -0
  26. package/dist/block-panels.js +210 -0
  27. package/dist/block-panels.js.map +1 -0
  28. package/dist/cli.d.ts +3 -0
  29. package/dist/cli.d.ts.map +1 -0
  30. package/dist/cli.js +138 -0
  31. package/dist/cli.js.map +1 -0
  32. package/dist/command-format.d.ts +18 -0
  33. package/dist/command-format.d.ts.map +1 -0
  34. package/dist/command-format.js +66 -0
  35. package/dist/command-format.js.map +1 -0
  36. package/dist/command-runner.d.ts +128 -0
  37. package/dist/command-runner.d.ts.map +1 -0
  38. package/dist/command-runner.js +571 -0
  39. package/dist/command-runner.js.map +1 -0
  40. package/dist/commands.d.ts +47 -0
  41. package/dist/commands.d.ts.map +1 -0
  42. package/dist/commands.js +108 -0
  43. package/dist/commands.js.map +1 -0
  44. package/dist/components/AttachmentRow.d.ts +11 -0
  45. package/dist/components/AttachmentRow.d.ts.map +1 -0
  46. package/dist/components/AttachmentRow.js +17 -0
  47. package/dist/components/AttachmentRow.js.map +1 -0
  48. package/dist/components/Composer.d.ts +23 -0
  49. package/dist/components/Composer.d.ts.map +1 -0
  50. package/dist/components/Composer.js +45 -0
  51. package/dist/components/Composer.js.map +1 -0
  52. package/dist/components/ExtensionQuestion.d.ts +18 -0
  53. package/dist/components/ExtensionQuestion.d.ts.map +1 -0
  54. package/dist/components/ExtensionQuestion.js +45 -0
  55. package/dist/components/ExtensionQuestion.js.map +1 -0
  56. package/dist/components/GoalForm.d.ts +18 -0
  57. package/dist/components/GoalForm.d.ts.map +1 -0
  58. package/dist/components/GoalForm.js +26 -0
  59. package/dist/components/GoalForm.js.map +1 -0
  60. package/dist/components/Home.d.ts +21 -0
  61. package/dist/components/Home.d.ts.map +1 -0
  62. package/dist/components/Home.js +48 -0
  63. package/dist/components/Home.js.map +1 -0
  64. package/dist/components/MentionList.d.ts +14 -0
  65. package/dist/components/MentionList.d.ts.map +1 -0
  66. package/dist/components/MentionList.js +24 -0
  67. package/dist/components/MentionList.js.map +1 -0
  68. package/dist/components/SearchBar.d.ts +19 -0
  69. package/dist/components/SearchBar.d.ts.map +1 -0
  70. package/dist/components/SearchBar.js +28 -0
  71. package/dist/components/SearchBar.js.map +1 -0
  72. package/dist/components/Sidebar.d.ts +19 -0
  73. package/dist/components/Sidebar.d.ts.map +1 -0
  74. package/dist/components/Sidebar.js +35 -0
  75. package/dist/components/Sidebar.js.map +1 -0
  76. package/dist/components/SummaryEditor.d.ts +16 -0
  77. package/dist/components/SummaryEditor.d.ts.map +1 -0
  78. package/dist/components/SummaryEditor.js +21 -0
  79. package/dist/components/SummaryEditor.js.map +1 -0
  80. package/dist/components/Transcript.d.ts +37 -0
  81. package/dist/components/Transcript.d.ts.map +1 -0
  82. package/dist/components/Transcript.js +314 -0
  83. package/dist/components/Transcript.js.map +1 -0
  84. package/dist/components/ui/alert.d.ts +9 -0
  85. package/dist/components/ui/alert.d.ts.map +1 -0
  86. package/dist/components/ui/alert.js +18 -0
  87. package/dist/components/ui/alert.js.map +1 -0
  88. package/dist/components/ui/command-palette.d.ts +15 -0
  89. package/dist/components/ui/command-palette.d.ts.map +1 -0
  90. package/dist/components/ui/command-palette.js +14 -0
  91. package/dist/components/ui/command-palette.js.map +1 -0
  92. package/dist/components/ui/confirm.d.ts +12 -0
  93. package/dist/components/ui/confirm.d.ts.map +1 -0
  94. package/dist/components/ui/confirm.js +16 -0
  95. package/dist/components/ui/confirm.js.map +1 -0
  96. package/dist/components/ui/select.d.ts +11 -0
  97. package/dist/components/ui/select.d.ts.map +1 -0
  98. package/dist/components/ui/select.js +29 -0
  99. package/dist/components/ui/select.js.map +1 -0
  100. package/dist/components/ui/spinner.d.ts +14 -0
  101. package/dist/components/ui/spinner.d.ts.map +1 -0
  102. package/dist/components/ui/spinner.js +17 -0
  103. package/dist/components/ui/spinner.js.map +1 -0
  104. package/dist/components/ui/tool-approval.d.ts +14 -0
  105. package/dist/components/ui/tool-approval.d.ts.map +1 -0
  106. package/dist/components/ui/tool-approval.js +37 -0
  107. package/dist/components/ui/tool-approval.js.map +1 -0
  108. package/dist/components/ui/tool-call.d.ts +12 -0
  109. package/dist/components/ui/tool-call.d.ts.map +1 -0
  110. package/dist/components/ui/tool-call.js +69 -0
  111. package/dist/components/ui/tool-call.js.map +1 -0
  112. package/dist/components/ui/types.d.ts +82 -0
  113. package/dist/components/ui/types.d.ts.map +1 -0
  114. package/dist/components/ui/types.js +2 -0
  115. package/dist/components/ui/types.js.map +1 -0
  116. package/dist/crewcoder-cli.d.ts +51 -0
  117. package/dist/crewcoder-cli.d.ts.map +1 -0
  118. package/dist/crewcoder-cli.js +26 -0
  119. package/dist/crewcoder-cli.js.map +1 -0
  120. package/dist/diff-anchors.d.ts +14 -0
  121. package/dist/diff-anchors.d.ts.map +1 -0
  122. package/dist/diff-anchors.js +43 -0
  123. package/dist/diff-anchors.js.map +1 -0
  124. package/dist/footer-layout.d.ts +49 -0
  125. package/dist/footer-layout.d.ts.map +1 -0
  126. package/dist/footer-layout.js +79 -0
  127. package/dist/footer-layout.js.map +1 -0
  128. package/dist/glyphs.d.ts +32 -0
  129. package/dist/glyphs.d.ts.map +1 -0
  130. package/dist/glyphs.js +35 -0
  131. package/dist/glyphs.js.map +1 -0
  132. package/dist/goal-form.d.ts +47 -0
  133. package/dist/goal-form.d.ts.map +1 -0
  134. package/dist/goal-form.js +59 -0
  135. package/dist/goal-form.js.map +1 -0
  136. package/dist/hooks/use-animation.d.ts +6 -0
  137. package/dist/hooks/use-animation.d.ts.map +1 -0
  138. package/dist/hooks/use-animation.js +52 -0
  139. package/dist/hooks/use-animation.js.map +1 -0
  140. package/dist/hooks/use-app-colors.d.ts +6 -0
  141. package/dist/hooks/use-app-colors.d.ts.map +1 -0
  142. package/dist/hooks/use-app-colors.js +6 -0
  143. package/dist/hooks/use-app-colors.js.map +1 -0
  144. package/dist/hooks/use-glyph-set.d.ts +8 -0
  145. package/dist/hooks/use-glyph-set.d.ts.map +1 -0
  146. package/dist/hooks/use-glyph-set.js +22 -0
  147. package/dist/hooks/use-glyph-set.js.map +1 -0
  148. package/dist/hooks/use-motion.d.ts +6 -0
  149. package/dist/hooks/use-motion.d.ts.map +1 -0
  150. package/dist/hooks/use-motion.js +8 -0
  151. package/dist/hooks/use-motion.js.map +1 -0
  152. package/dist/hooks/use-terminal-focus.d.ts +16 -0
  153. package/dist/hooks/use-terminal-focus.d.ts.map +1 -0
  154. package/dist/hooks/use-terminal-focus.js +30 -0
  155. package/dist/hooks/use-terminal-focus.js.map +1 -0
  156. package/dist/hooks/use-theme.d.ts +6 -0
  157. package/dist/hooks/use-theme.d.ts.map +1 -0
  158. package/dist/hooks/use-theme.js +11 -0
  159. package/dist/hooks/use-theme.js.map +1 -0
  160. package/dist/hunk.d.ts +27 -0
  161. package/dist/hunk.d.ts.map +1 -0
  162. package/dist/hunk.js +43 -0
  163. package/dist/hunk.js.map +1 -0
  164. package/dist/image-view.d.ts +33 -0
  165. package/dist/image-view.d.ts.map +1 -0
  166. package/dist/image-view.js +51 -0
  167. package/dist/image-view.js.map +1 -0
  168. package/dist/keybindings.d.ts +28 -0
  169. package/dist/keybindings.d.ts.map +1 -0
  170. package/dist/keybindings.js +105 -0
  171. package/dist/keybindings.js.map +1 -0
  172. package/dist/lib/terminal-themes/default.d.ts +3 -0
  173. package/dist/lib/terminal-themes/default.d.ts.map +1 -0
  174. package/dist/lib/terminal-themes/default.js +49 -0
  175. package/dist/lib/terminal-themes/default.js.map +1 -0
  176. package/dist/logo-pulse.d.ts +23 -0
  177. package/dist/logo-pulse.d.ts.map +1 -0
  178. package/dist/logo-pulse.js +30 -0
  179. package/dist/logo-pulse.js.map +1 -0
  180. package/dist/markdown-style.d.ts +47 -0
  181. package/dist/markdown-style.d.ts.map +1 -0
  182. package/dist/markdown-style.js +138 -0
  183. package/dist/markdown-style.js.map +1 -0
  184. package/dist/mentions.d.ts +57 -0
  185. package/dist/mentions.d.ts.map +1 -0
  186. package/dist/mentions.js +109 -0
  187. package/dist/mentions.js.map +1 -0
  188. package/dist/palette-model.d.ts +42 -0
  189. package/dist/palette-model.d.ts.map +1 -0
  190. package/dist/palette-model.js +77 -0
  191. package/dist/palette-model.js.map +1 -0
  192. package/dist/path-suggestions.d.ts +50 -0
  193. package/dist/path-suggestions.d.ts.map +1 -0
  194. package/dist/path-suggestions.js +99 -0
  195. package/dist/path-suggestions.js.map +1 -0
  196. package/dist/picker-flows.d.ts +78 -0
  197. package/dist/picker-flows.d.ts.map +1 -0
  198. package/dist/picker-flows.js +444 -0
  199. package/dist/picker-flows.js.map +1 -0
  200. package/dist/pickers.d.ts +34 -0
  201. package/dist/pickers.d.ts.map +1 -0
  202. package/dist/pickers.js +136 -0
  203. package/dist/pickers.js.map +1 -0
  204. package/dist/prompt-history.d.ts +32 -0
  205. package/dist/prompt-history.d.ts.map +1 -0
  206. package/dist/prompt-history.js +40 -0
  207. package/dist/prompt-history.js.map +1 -0
  208. package/dist/providers/app-theme-provider.d.ts +12 -0
  209. package/dist/providers/app-theme-provider.d.ts.map +1 -0
  210. package/dist/providers/app-theme-provider.js +14 -0
  211. package/dist/providers/app-theme-provider.js.map +1 -0
  212. package/dist/providers/theme-provider.d.ts +10 -0
  213. package/dist/providers/theme-provider.d.ts.map +1 -0
  214. package/dist/providers/theme-provider.js +57 -0
  215. package/dist/providers/theme-provider.js.map +1 -0
  216. package/dist/question-model.d.ts +71 -0
  217. package/dist/question-model.d.ts.map +1 -0
  218. package/dist/question-model.js +176 -0
  219. package/dist/question-model.js.map +1 -0
  220. package/dist/search-controller.d.ts +46 -0
  221. package/dist/search-controller.d.ts.map +1 -0
  222. package/dist/search-controller.js +89 -0
  223. package/dist/search-controller.js.map +1 -0
  224. package/dist/search-jump.d.ts +27 -0
  225. package/dist/search-jump.d.ts.map +1 -0
  226. package/dist/search-jump.js +65 -0
  227. package/dist/search-jump.js.map +1 -0
  228. package/dist/session-controller.d.ts +268 -0
  229. package/dist/session-controller.d.ts.map +1 -0
  230. package/dist/session-controller.js +941 -0
  231. package/dist/session-controller.js.map +1 -0
  232. package/dist/sidebar-model.d.ts +45 -0
  233. package/dist/sidebar-model.d.ts.map +1 -0
  234. package/dist/sidebar-model.js +223 -0
  235. package/dist/sidebar-model.js.map +1 -0
  236. package/dist/sidebar.d.ts +49 -0
  237. package/dist/sidebar.d.ts.map +1 -0
  238. package/dist/sidebar.js +106 -0
  239. package/dist/sidebar.js.map +1 -0
  240. package/dist/status-line.d.ts +32 -0
  241. package/dist/status-line.d.ts.map +1 -0
  242. package/dist/status-line.js +69 -0
  243. package/dist/status-line.js.map +1 -0
  244. package/dist/syntax/filetype.d.ts +12 -0
  245. package/dist/syntax/filetype.d.ts.map +1 -0
  246. package/dist/syntax/filetype.js +28 -0
  247. package/dist/syntax/filetype.js.map +1 -0
  248. package/dist/syntax/grammars.d.ts +42 -0
  249. package/dist/syntax/grammars.d.ts.map +1 -0
  250. package/dist/syntax/grammars.js +52 -0
  251. package/dist/syntax/grammars.js.map +1 -0
  252. package/dist/text-offset.d.ts +5 -0
  253. package/dist/text-offset.d.ts.map +1 -0
  254. package/dist/text-offset.js +38 -0
  255. package/dist/text-offset.js.map +1 -0
  256. package/dist/text-wrap.d.ts +12 -0
  257. package/dist/text-wrap.d.ts.map +1 -0
  258. package/dist/text-wrap.js +53 -0
  259. package/dist/text-wrap.js.map +1 -0
  260. package/dist/theme-controller.d.ts +77 -0
  261. package/dist/theme-controller.d.ts.map +1 -0
  262. package/dist/theme-controller.js +178 -0
  263. package/dist/theme-controller.js.map +1 -0
  264. package/dist/theme.d.ts +51 -0
  265. package/dist/theme.d.ts.map +1 -0
  266. package/dist/theme.js +86 -0
  267. package/dist/theme.js.map +1 -0
  268. package/dist/tmux-check.d.ts +35 -0
  269. package/dist/tmux-check.d.ts.map +1 -0
  270. package/dist/tmux-check.js +66 -0
  271. package/dist/tmux-check.js.map +1 -0
  272. package/dist/tmux.d.ts +69 -0
  273. package/dist/tmux.d.ts.map +1 -0
  274. package/dist/tmux.js +135 -0
  275. package/dist/tmux.js.map +1 -0
  276. package/dist/tool-diff.d.ts +51 -0
  277. package/dist/tool-diff.d.ts.map +1 -0
  278. package/dist/tool-diff.js +158 -0
  279. package/dist/tool-diff.js.map +1 -0
  280. package/dist/tool-presentation.d.ts +46 -0
  281. package/dist/tool-presentation.d.ts.map +1 -0
  282. package/dist/tool-presentation.js +148 -0
  283. package/dist/tool-presentation.js.map +1 -0
  284. package/dist/tool-renderer-view.d.ts +14 -0
  285. package/dist/tool-renderer-view.d.ts.map +1 -0
  286. package/dist/tool-renderer-view.js +10 -0
  287. package/dist/tool-renderer-view.js.map +1 -0
  288. package/dist/transcript-search.d.ts +54 -0
  289. package/dist/transcript-search.d.ts.map +1 -0
  290. package/dist/transcript-search.js +160 -0
  291. package/dist/transcript-search.js.map +1 -0
  292. package/dist/transcript.d.ts +59 -0
  293. package/dist/transcript.d.ts.map +1 -0
  294. package/dist/transcript.js +123 -0
  295. package/dist/transcript.js.map +1 -0
  296. package/dist/workflow-tools.d.ts +42 -0
  297. package/dist/workflow-tools.d.ts.map +1 -0
  298. package/dist/workflow-tools.js +89 -0
  299. package/dist/workflow-tools.js.map +1 -0
  300. package/examples/themes/ember.json +75 -0
  301. package/grammars/bash/LICENSE +21 -0
  302. package/grammars/bash/highlights.scm +56 -0
  303. package/grammars/bash/tree-sitter-bash.wasm +0 -0
  304. package/grammars/css/LICENSE +21 -0
  305. package/grammars/css/highlights.scm +76 -0
  306. package/grammars/css/tree-sitter-css.wasm +0 -0
  307. package/grammars/go/LICENSE +21 -0
  308. package/grammars/go/highlights.scm +123 -0
  309. package/grammars/go/tree-sitter-go.wasm +0 -0
  310. package/grammars/html/LICENSE +21 -0
  311. package/grammars/html/highlights.scm +13 -0
  312. package/grammars/html/tree-sitter-html.wasm +0 -0
  313. package/grammars/json/LICENSE +21 -0
  314. package/grammars/json/highlights.scm +16 -0
  315. package/grammars/json/tree-sitter-json.wasm +0 -0
  316. package/grammars/python/LICENSE +21 -0
  317. package/grammars/python/highlights.scm +137 -0
  318. package/grammars/python/tree-sitter-python.wasm +0 -0
  319. package/grammars/rust/LICENSE +21 -0
  320. package/grammars/rust/highlights.scm +161 -0
  321. package/grammars/rust/tree-sitter-rust.wasm +0 -0
  322. package/grammars/yaml/LICENSE +20 -0
  323. package/grammars/yaml/highlights.scm +79 -0
  324. package/grammars/yaml/tree-sitter-yaml.wasm +0 -0
  325. package/package.json +56 -5
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-suggestions.js","sourceRoot":"","sources":["../src/path-suggestions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAoB7B,yDAAyD;AACzD,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAChC,+EAA+E;AAC/E,MAAM,CAAC,MA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AC,EAAE,IAAI,EAAE,GAAG,QAAQ,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;gBAC9F,MAAM,IAAI,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;YAC9B,CAAC;iBAAM,IAAI,KAAK,CAAC,MAAM,EAAE,IAAI,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC;gBAC5D,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;YACjD,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACnB,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF,SAAS,cAAc,CAAC,KAAa;IACnC,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AACpE,CAAC;AAED,oEAAoE;AACpE,SAAS,YAAY,CAAC,QAAgB,EAAE,KAAa;IACnD,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IACrC,OAAO,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,EAAE,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AAChH,CAAC","sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\n\n/**\n * `@` path suggestions in the composer, ported from the legacy\n * `crewcoder-tui/src/components/path-suggestions.ts`: the same walk, ignore\n * list, limits, and matching, plus the pure token and windowing helpers the\n * OpenTUI composer needs.\n */\nexport type PathSuggestion = {\n /** Workspace-relative, POSIX separators; directories end with `/`. */\n path: string;\n type: \"file\" | \"directory\";\n};\n\n/** Lists workspace paths for a query; injectable so tests never walk a real tree. */\nexport type PathLister = (cwd: string, query: string, limit: number) => Promise<PathSuggestion[]>;\n\n/** The `@token` around the cursor: `[start, end)` in the composer text, query without `@`. */\nexport type MentionToken = { start: number; end: number; query: string };\n\n/** Suggestions fetched per query, like the legacy UI. */\nexport const MENTION_LIMIT = 50;\n/** List rows shown under the composer; longer lists scroll with the cursor. */\nexport const MENTION_ROWS = 8;\n\nconst IGNORED = new Set([\".git\", \"node_modules\", \"dist\", \"build\", \".next\", \".turbo\", \"coverage\", \".cache\", \".crewcoder\"]);\nconst MAX_VISITED = 1500;\nconst MAX_DEPTH = 7;\n\n/**\n * The mention token the cursor is in, or undefined. A token starts after\n * whitespace (or at the start) with `@`, so `user@host` never triggers, and\n * holds only path characters.\n */\nexport function currentMention(text: string, cursor: number): MentionToken | undefined {\n const at = Math.max(0, Math.min(text.length, cursor));\n const before = text.slice(0, at);\n const start = Math.max(before.lastIndexOf(\" \"), before.lastIndexOf(\"\\n\"), before.lastIndexOf(\"\\t\")) + 1;\n if (text[start] !== \"@\") return undefined;\n const rest = text.slice(at).search(/\\s/);\n const end = rest === -1 ? text.length : at + rest;\n const token = text.slice(start, end);\n if (!/^@[A-Za-z0-9._/\\\\-]*$/.test(token)) return undefined;\n return { start, end, query: token.slice(1) };\n}\n\n/**\n * The composer text with the token replaced by the picked path, and the cursor\n * after it. A file gets a trailing space (done); a directory (`src/`) does\n * not, so its contents are suggested next.\n */\nexport function replaceMention(text: string, token: MentionToken, pick: PathSuggestion): { text: string; cursor: number } {\n const replacement = pick.type === \"directory\" ? `@${pick.path}` : `@${pick.path} `;\n return { text: text.slice(0, token.start) + replacement + text.slice(token.end), cursor: token.start + replacement.length };\n}\n\n/** First row to draw so `cursor` stays visible in `rows` rows. */\nexport function mentionWindowStart(count: number, cursor: number, rows: number = MENTION_ROWS): number {\n if (count <= rows) return 0;\n return Math.min(Math.max(0, cursor - rows + 1), count - rows);\n}\n\n/** Rows the suggestion list takes under the composer (one for the empty note). */\nexport function mentionRows(count: number, rows: number = MENTION_ROWS): number {\n return Math.max(1, Math.min(count, rows));\n}\n\n/**\n * Up to `limit` workspace paths matching `query`, directories first at each\n * level, skipping build output and VCS folders. Stops after MAX_VISITED\n * entries or MAX_DEPTH levels so a huge tree never stalls typing. Unreadable\n * directories are skipped.\n */\nexport const listPathSuggestions: PathLister = async (cwd, query, limit) => {\n const wanted = normalizeQuery(query);\n const results: PathSuggestion[] = [];\n let visited = 0;\n\n async function walk(dir: string, depth: number): Promise<void> {\n if (results.length >= limit || visited >= MAX_VISITED || depth > MAX_DEPTH) return;\n let entries: Array<{ name: string; isDirectory(): boolean; isFile(): boolean }>;\n try {\n entries = await fs.readdir(dir, { withFileTypes: true });\n } catch {\n return;\n }\n entries.sort((a, b) => Number(b.isDirectory()) - Number(a.isDirectory()) || a.name.localeCompare(b.name));\n for (const entry of entries) {\n if (results.length >= limit || visited >= MAX_VISITED) return;\n if (IGNORED.has(entry.name)) continue;\n const full = path.join(dir, entry.name);\n const relative = path.relative(cwd, full).split(path.sep).join(\"/\");\n visited += 1;\n if (entry.isDirectory()) {\n if (matchesQuery(relative, wanted)) results.push({ path: `${relative}/`, type: \"directory\" });\n await walk(full, depth + 1);\n } else if (entry.isFile() && matchesQuery(relative, wanted)) {\n results.push({ path: relative, type: \"file\" });\n }\n }\n }\n\n await walk(cwd, 0);\n return results.slice(0, limit);\n};\n\nfunction normalizeQuery(query: string): string {\n return query.replace(/^@/, \"\").replace(/^\\.\\//, \"\").toLowerCase();\n}\n\n/** Prefix of the path, of any path segment, or of the file name. */\nfunction matchesQuery(relative: string, query: string): boolean {\n if (!query) return true;\n const lower = relative.toLowerCase();\n return lower.startsWith(query) || lower.includes(`/${query}`) || path.posix.basename(lower).startsWith(query);\n}\n"]}
@@ -0,0 +1,78 @@
1
+ import type { ProviderRecord, SessionRecord } from "@onpoint-dev-tools/crewcoder-tui-core/bridge/crewcoder-process";
2
+ import { type TuiEventBlock, type TuiState } from "@onpoint-dev-tools/crewcoder-tui-core/state/tui-store";
3
+ import type { FooterAlert } from "./alert-model.js";
4
+ import { type CrewCoderCli, type LoadedSkill } from "./crewcoder-cli.js";
5
+ import type { PaletteCommand } from "./palette-model.js";
6
+ import type { ThemeController } from "./theme-controller.js";
7
+ import { type Picker, type PickerKind } from "./pickers.js";
8
+ /** What picker flows may do to the session. Implemented by SessionController. */
9
+ export interface PickerHost {
10
+ readonly state: TuiState;
11
+ readonly cli: CrewCoderCli;
12
+ readonly bridgeRunning: boolean;
13
+ openPicker(picker: Picker): void;
14
+ /** The open picker, used to drop results for a picker the user already left. */
15
+ readonly picker: Picker | undefined;
16
+ push(block: TuiEventBlock): void;
17
+ /** Show a status alert above the composer until the next key. */
18
+ alert(alert: FooterAlert): void;
19
+ changed(): void;
20
+ resumeSession(session: SessionRecord): void;
21
+ setComposerDraft(text: string): void;
22
+ attachSkill(skill: LoadedSkill): void;
23
+ /** The active theme, the `/theme` list, preview, and the saved pick. */
24
+ readonly themes: ThemeController;
25
+ }
26
+ export type OpenableKind = Exclude<PickerKind, "commands" | "menu" | "rewindConfirm" | "crewLaunch">;
27
+ export declare class PickerFlows {
28
+ private readonly host;
29
+ private providers;
30
+ private sessions;
31
+ private workers;
32
+ constructor(host: PickerHost);
33
+ open(kind: OpenableKind): void;
34
+ /** Apply a choice. The picker is already closed; a follow-up picker may open. */
35
+ select(kind: PickerKind, id: string): Promise<void>;
36
+ /**
37
+ * A picker command with an argument (`/effort high`, `/provider opencode`,
38
+ * `/rewind latest`, ...): apply it directly, through the same path as picking it.
39
+ */
40
+ applyArgument(kind: OpenableKind, arg: string): Promise<void>;
41
+ /** Picker Enter and `/theme <name>`: apply, save, and say where it is saved. */
42
+ private applyTheme;
43
+ /** Effort to resume a session with: its saved level when the model supports it. */
44
+ static resumeEffort(state: TuiState, saved: string | undefined): TuiState["effort"];
45
+ /** Drop cached providers and workers, then list providers again (`/reload`). */
46
+ reloadProviders(): Promise<ProviderRecord[]>;
47
+ /** Open `initial` (loading) and fill it in; ignored if the user already left it. */
48
+ load(initial: Picker, items: () => Promise<PaletteCommand[]>): void;
49
+ private loadProviders;
50
+ private loadWorkers;
51
+ private selectMode;
52
+ /** Typed provider: must be one CrewCoder knows; keeps a model the provider offers. */
53
+ private setProvider;
54
+ /** Typed mode or saved worker name. */
55
+ private selectModeOrWorker;
56
+ /**
57
+ * Fork a listed session and open the fork (Tab in /sessions, `/branch <id>`).
58
+ * The branch loads like a resume, with its conversation and saved settings, so
59
+ * the screen and new messages both belong to it; the original is untouched.
60
+ */
61
+ branch(id: string): Promise<void>;
62
+ /** `/branch <id>`: an exact id or a unique prefix from the session list. */
63
+ branchById(id: string): Promise<void>;
64
+ /** `/sessions <id>`: an exact id or a unique prefix. */
65
+ private resumeById;
66
+ /** Reload the list and match an exact id or a unique prefix; alerts and returns undefined otherwise. */
67
+ private findSession;
68
+ private usage;
69
+ private insertPromptCommand;
70
+ private setProfile;
71
+ private removeDirectory;
72
+ private previewRewind;
73
+ private restore;
74
+ private handoff;
75
+ private blockedWhileRunning;
76
+ private noSavedSession;
77
+ }
78
+ //# sourceMappingURL=picker-flows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"picker-flows.d.ts","sourceRoot":"","sources":["../src/picker-flows.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,gEAAgE,CAAC;AAGpH,OAAO,EAAa,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAE,MAAM,uDAAuD,CAAC;AACrH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAEL,KAAK,YAAY,EAA4B,KAAK,WAAW,EAC9D,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CA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M,GAAG,OAAO,CAAC,IAAI,CAAC;IAwDzD;;;OAGG;IACG,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuDnE,gFAAgF;IAChF,OAAO,CAAC,UAAU;IAIlB,mFAAmF;IACnF,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC,QAAQ,CAAC;IAKnF,gFAAgF;IAC1E,eAAe,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAMlD,oFAAoF;IACpF,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC,cAAc,EAAE,CAAC,GAAG,IAAI;YAcrD,aAAa;YAWb,WAAW;IAKzB,OAAO,CAAC,UAAU;IAgBlB,sFAAsF;YACxE,WAAW;IAezB,uCAAuC;YACzB,kBAAkB;IAehC;;;;OAIG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWvC,4EAA4E;IACtE,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK3C,wDAAwD;YAC1C,UAAU;IAKxB,wGAAwG;YAC1F,WAAW;IASzB,OAAO,CAAC,KAAK;YAIC,mBAAmB;YAQnB,UAAU;YAQV,eAAe;YAcf,aAAa;YAsBb,OAAO;YAOP,OAAO;IAkBrB,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,cAAc;CAGvB"}
@@ -0,0 +1,444 @@
1
+ import path from "node:path";
2
+ import { DEFAULT_EFFORT, effortLevelsForModel, normalizeEffort } from "@onpoint-dev-tools/crewcoder-tui-core/state/effort-levels";
3
+ import { builtinProviderDefaults, resolveProviderRecord } from "@onpoint-dev-tools/crewcoder-tui-core/state/provider-defaults";
4
+ import { isTuiMode } from "@onpoint-dev-tools/crewcoder-tui-core/state/tui-store";
5
+ import { cliJson, cliText, errorMessage, readToolMode } from "./crewcoder-cli.js";
6
+ import { actionLabel } from "./keybindings.js";
7
+ import { checkpointItems, directoryItems, effortItems, modeItems, modelItems, namedItems, profileItems, providerItems, rewindConfirmItems, sessionItems, toolModeItems, workerItems } from "./pickers.js";
8
+ const SESSION_HINT = `↑↓ navigate · Enter resume · ${actionLabel("sessionBranch")} branch · Esc close`;
9
+ const THEME_HINT = "↑↓ preview · Enter apply · Esc keep current";
10
+ const picker = (kind, title, items = [], loading = false, emptyText = "Nothing to pick") => ({ kind, title, placeholder: "Search…", emptyText, items, loading });
11
+ export class PickerFlows {
12
+ host;
13
+ providers;
14
+ sessions = [];
15
+ workers = [];
16
+ constructor(host) {
17
+ this.host = host;
18
+ }
19
+ open(kind) {
20
+ const { state } = this.host;
21
+ switch (kind) {
22
+ case "provider":
23
+ return this.load(picker("provider", "Provider", [], true), async () => providerItems(await this.loadProviders(), state.provider));
24
+ case "model":
25
+ return this.load(picker("model", "Model", [], true), async () => modelItems(state.provider, (await this.loadProviders()).find((item) => item.id === state.provider), state.model));
26
+ case "effort":
27
+ return this.host.openPicker(picker("effort", `Reasoning effort · ${state.model}`, effortItems(state.provider, state.model, state.effort)));
28
+ case "mode":
29
+ // Built-in modes show at once; saved workers fill in when listed.
30
+ return this.load(picker("mode", "Mode or worker", modeItems(state, this.workers), true), async () => modeItems(state, await this.loadWorkers().catch(() => this.workers)));
31
+ case "systemPrompt":
32
+ return this.load(picker("systemPrompt", "System prompt", [], true, "No system prompts in ~/.crewcoder/system-prompts/"), async () => namedItems(await cliJson(this.host.cli, ["system-prompt", "list", "--json"], []), state.systemPrompt));
33
+ case "promptCommand":
34
+ return this.load(picker("promptCommand", "Insert prompt command", [], true, "No prompt commands in ~/.crewcoder/commands/"), async () => namedItems(await cliJson(this.host.cli, ["command", "list", "--json"], [])));
35
+ case "skill":
36
+ return this.load(picker("skill", "Attach a skill", [], true, "No skills in ~/.crewcoder/skills/"), async () => namedItems(await cliJson(this.host.cli, ["skill", "list", "--json"], [])));
37
+ case "profile":
38
+ return this.host.openPicker(picker("profile", "Integration profile", profileItems(state.integrationProfile)));
39
+ case "toolMode":
40
+ if (this.blockedWhileRunning("changing Tool mode"))
41
+ return;
42
+ return this.load(picker("toolMode", "Tool mode for new sessions", [], true), async () => toolModeItems(await readToolMode(this.host.cli)));
43
+ case "removeDir":
44
+ if (!state.externalDirectories.length)
45
+ return this.host.alert({ variant: "info", title: "No external directories attached" });
46
+ return this.host.openPicker(picker("removeDir", "Remove external directory", directoryItems(state.externalDirectories)));
47
+ case "session":
48
+ return this.load({ ...picker("session", "Resume session", [], true, "No sessions found"), hint: SESSION_HINT }, async () => {
49
+ this.sessions = await this.host.cli.sessions();
50
+ return sessionItems(this.sessions, state.sessionId);
51
+ });
52
+ case "rewind":
53
+ if (!state.checkpoints.length) {
54
+ return this.host.alert({ variant: "warning", title: "No checkpoint found", body: "Run a mutating tool first, then use /rewind." });
55
+ }
56
+ return this.host.openPicker(picker("rewind", "Rewind to checkpoint", checkpointItems(state.checkpoints)));
57
+ case "handoff":
58
+ if (!hasSavedSession(state))
59
+ return this.noSavedSession("handing it off");
60
+ return this.load(picker("handoff", "Hand off to worker", [], true, "No workers. Create one with: crewcoder workers create <name>"), async () => workerItems(await this.loadWorkers()));
61
+ case "theme":
62
+ // Local UI files (also in --remote mode: the theme belongs to this terminal, not the workspace).
63
+ return this.host.openPicker({ ...picker("theme", "Theme", this.host.themes.items()), hint: THEME_HINT });
64
+ }
65
+ }
66
+ /** Apply a choice. The picker is already closed; a follow-up picker may open. */
67
+ async select(kind, id) {
68
+ const { state } = this.host;
69
+ switch (kind) {
70
+ case "commands":
71
+ case "menu":
72
+ case "crewLaunch":
73
+ return;
74
+ case "provider":
75
+ state.provider = id;
76
+ return this.open("model");
77
+ case "model": {
78
+ state.model = id;
79
+ const levels = effortLevelsForModel(state.provider, state.model);
80
+ if (!levels.includes(state.effort))
81
+ state.effort = levels[0] ?? state.effort;
82
+ return this.open("effort");
83
+ }
84
+ case "effort":
85
+ state.effort = normalizeEffort(id, effortLevelsForModel(state.provider, state.model)) ?? state.effort;
86
+ return;
87
+ case "mode":
88
+ return this.selectMode(id);
89
+ case "systemPrompt":
90
+ await cliText(this.host.cli, ["system-prompt", "show", id, "--json"]);
91
+ state.systemPrompt = id;
92
+ return this.host.alert({ variant: "success", title: `System prompt selected: ${id}` });
93
+ case "promptCommand":
94
+ return this.insertPromptCommand(id);
95
+ case "skill": {
96
+ const skill = await cliJson(this.host.cli, ["skill", "show", id, "--json"], null);
97
+ if (!skill)
98
+ throw new Error(`Skill not found: ${id}`);
99
+ return this.host.attachSkill(skill);
100
+ }
101
+ case "profile":
102
+ return this.setProfile(id === "crewcode" ? "crewcode" : "standalone");
103
+ case "toolMode":
104
+ await cliText(this.host.cli, ["config", "set", "toolMode", id]);
105
+ return this.host.alert({ variant: "success", title: `Tool mode set to ${id} for new sessions`, body: "Use /new to apply it; existing sessions keep their mode." });
106
+ case "removeDir":
107
+ return this.removeDirectory(id);
108
+ case "session": {
109
+ const session = this.sessions.find((item) => item.id === id);
110
+ if (session)
111
+ this.host.resumeSession(session);
112
+ return;
113
+ }
114
+ case "rewind":
115
+ return this.previewRewind(id);
116
+ case "rewindConfirm":
117
+ if (id.startsWith("restore:"))
118
+ return this.restore(id.slice("restore:".length));
119
+ return this.host.alert({ variant: "info", title: "Rewind cancelled" });
120
+ case "handoff":
121
+ return this.handoff(id);
122
+ case "theme":
123
+ return this.applyTheme(id);
124
+ }
125
+ }
126
+ /**
127
+ * A picker command with an argument (`/effort high`, `/provider opencode`,
128
+ * `/rewind latest`, ...): apply it directly, through the same path as picking it.
129
+ */
130
+ async applyArgument(kind, arg) {
131
+ const { state } = this.host;
132
+ switch (kind) {
133
+ case "provider":
134
+ return this.setProvider(arg);
135
+ case "model": {
136
+ state.model = arg;
137
+ const levels = effortLevelsForModel(state.provider, state.model);
138
+ if (!levels.includes(state.effort))
139
+ state.effort = levels[0] ?? state.effort;
140
+ return this.host.alert({ variant: "success", title: `Model: ${state.model}`, body: `Reasoning effort: ${state.effort}` });
141
+ }
142
+ case "effort": {
143
+ const levels = effortLevelsForModel(state.provider, state.model);
144
+ const effort = normalizeEffort(arg, levels);
145
+ if (!effort)
146
+ return this.host.alert({ variant: "error", title: `Unknown effort: ${arg}`, body: `${state.model} supports: ${levels.join(", ")}` });
147
+ state.effort = effort;
148
+ return this.host.alert({ variant: "success", title: `Reasoning effort: ${effort}` });
149
+ }
150
+ case "mode":
151
+ return this.selectModeOrWorker(arg);
152
+ case "promptCommand": {
153
+ const [name = "", ...args] = arg.split(/\s+/);
154
+ return this.insertPromptCommand(name, args);
155
+ }
156
+ case "profile":
157
+ if (arg !== "standalone" && arg !== "crewcode")
158
+ return this.usage("/profile standalone|crewcode");
159
+ return this.setProfile(arg);
160
+ case "toolMode":
161
+ if (arg === "status") {
162
+ const mode = await readToolMode(this.host.cli);
163
+ return this.host.alert({ variant: "info", title: `Tool mode for new sessions: ${mode}`, body: "Existing sessions keep their saved mode; host policy takes precedence." });
164
+ }
165
+ if (arg !== "native" && arg !== "crewcoder")
166
+ return this.usage("/tool-mode native|crewcoder|status");
167
+ if (this.blockedWhileRunning("changing Tool mode"))
168
+ return;
169
+ return this.select("toolMode", arg);
170
+ case "session":
171
+ return this.resumeById(arg);
172
+ case "rewind": {
173
+ const id = arg === "latest" ? state.checkpoints.at(-1)?.id : arg;
174
+ if (!id)
175
+ return this.host.alert({ variant: "warning", title: "No checkpoint found", body: "Run a mutating tool with /checkpoints on, then use /rewind." });
176
+ return this.previewRewind(id);
177
+ }
178
+ case "handoff": {
179
+ const match = /^(?:worker:)?(\S+)(?:\s+([\s\S]+))?$/.exec(arg);
180
+ if (!match?.[1])
181
+ return this.usage("/handoff worker:<name> [continuation prompt]");
182
+ return this.handoff(match[1], match[2]?.trim());
183
+ }
184
+ case "systemPrompt":
185
+ case "skill":
186
+ case "removeDir":
187
+ case "theme":
188
+ return this.select(kind, arg);
189
+ }
190
+ }
191
+ /** Picker Enter and `/theme <name>`: apply, save, and say where it is saved. */
192
+ applyTheme(id) {
193
+ this.host.alert({ variant: "success", ...this.host.themes.apply(id) });
194
+ }
195
+ /** Effort to resume a session with: its saved level when the model supports it. */
196
+ static resumeEffort(state, saved) {
197
+ const levels = effortLevelsForModel(state.provider, state.model);
198
+ return normalizeEffort(saved, levels) ?? normalizeEffort(state.effort, levels) ?? DEFAULT_EFFORT;
199
+ }
200
+ /** Drop cached providers and workers, then list providers again (`/reload`). */
201
+ async reloadProviders() {
202
+ this.providers = undefined;
203
+ this.workers = [];
204
+ return this.loadProviders();
205
+ }
206
+ /** Open `initial` (loading) and fill it in; ignored if the user already left it. */
207
+ load(initial, items) {
208
+ this.host.openPicker(initial);
209
+ items().then((loaded) => {
210
+ if (this.host.picker !== initial)
211
+ return;
212
+ this.host.openPicker({ ...initial, items: loaded, loading: false });
213
+ }, (error) => {
214
+ if (this.host.picker !== initial)
215
+ return;
216
+ this.host.openPicker({ ...initial, loading: false, emptyText: `Error: ${errorMessage(error)}` });
217
+ });
218
+ }
219
+ async loadProviders() {
220
+ if (this.providers)
221
+ return this.providers;
222
+ try {
223
+ const providers = await this.host.cli.providers();
224
+ if (providers.length)
225
+ this.providers = providers;
226
+ }
227
+ catch {
228
+ // Offline or older CLI: fall back to the built-in catalog below.
229
+ }
230
+ return this.providers ?? builtinProviderDefaults;
231
+ }
232
+ async loadWorkers() {
233
+ this.workers = await cliJson(this.host.cli, ["workers", "list", "--json"], []);
234
+ return this.workers;
235
+ }
236
+ selectMode(id) {
237
+ const { state } = this.host;
238
+ if (id.startsWith("worker:")) {
239
+ // Per-session only: sent as --worker on each run; the global active worker is unchanged.
240
+ state.worker = id.slice("worker:".length);
241
+ return;
242
+ }
243
+ if (!isTuiMode(id))
244
+ return;
245
+ if (id === "plugin" && state.integrationProfile !== "crewcode") {
246
+ this.host.alert({ variant: "warning", title: "CrewCode integration is disabled for this project", body: "Enable it with /profile." });
247
+ return;
248
+ }
249
+ state.mode = id;
250
+ state.worker = undefined;
251
+ }
252
+ /** Typed provider: must be one CrewCoder knows; keeps a model the provider offers. */
253
+ async setProvider(id) {
254
+ const { state } = this.host;
255
+ const providers = await this.loadProviders();
256
+ const provider = providers.find((item) => item.id === id);
257
+ if (!provider) {
258
+ return this.host.alert({ variant: "error", title: `Unknown provider: ${id}`, body: `Available: ${providers.map((item) => item.id).join(", ")}` });
259
+ }
260
+ state.provider = provider.id;
261
+ const models = resolveProviderRecord(provider.id, provider);
262
+ if (models.models.length && !models.models.includes(state.model))
263
+ state.model = models.defaultModel ?? models.models[0] ?? state.model;
264
+ const levels = effortLevelsForModel(state.provider, state.model);
265
+ if (!levels.includes(state.effort))
266
+ state.effort = levels[0] ?? state.effort;
267
+ this.host.alert({ variant: "success", title: `Provider: ${state.provider}`, body: `Model: ${state.model} · effort ${state.effort}` });
268
+ }
269
+ /** Typed mode or saved worker name. */
270
+ async selectModeOrWorker(name) {
271
+ const { state } = this.host;
272
+ if (isTuiMode(name)) {
273
+ this.selectMode(name);
274
+ if (state.mode === name)
275
+ this.host.alert({ variant: "success", title: `Mode: ${name}` });
276
+ return;
277
+ }
278
+ const workers = await this.loadWorkers();
279
+ if (!workers.some((worker) => worker.name === name)) {
280
+ return this.host.alert({ variant: "error", title: `No mode or worker named ${name}`, body: `Modes: general, crewcoder, extension${this.host.state.integrationProfile === "crewcode" ? ", plugin" : ""}. Workers: ${workers.map((worker) => worker.name).join(", ") || "none"}` });
281
+ }
282
+ this.selectMode(`worker:${name}`);
283
+ this.host.alert({ variant: "success", title: `Worker: ${name}`, body: "This session only." });
284
+ }
285
+ /**
286
+ * Fork a listed session and open the fork (Tab in /sessions, `/branch <id>`).
287
+ * The branch loads like a resume, with its conversation and saved settings, so
288
+ * the screen and new messages both belong to it; the original is untouched.
289
+ */
290
+ async branch(id) {
291
+ if (this.blockedWhileRunning("branching a session"))
292
+ return;
293
+ const source = this.sessions.find((session) => session.id === id);
294
+ if (!source)
295
+ return this.host.alert({ variant: "error", title: `Session not found: ${id}`, body: "Run /sessions to pick from the list." });
296
+ this.host.alert({ variant: "info", title: "Branching session…" });
297
+ const branchedId = (await this.host.cli.branch(source.id)).trim();
298
+ if (!branchedId || branchedId === source.id)
299
+ throw new Error("session branch did not return a new session id.");
300
+ this.host.resumeSession({ ...source, id: branchedId });
301
+ this.host.alert({ variant: "success", title: "Branched session", body: "New messages go to the branch; the original session is unchanged." });
302
+ }
303
+ /** `/branch <id>`: an exact id or a unique prefix from the session list. */
304
+ async branchById(id) {
305
+ const session = await this.findSession(id);
306
+ if (session)
307
+ await this.branch(session.id);
308
+ }
309
+ /** `/sessions <id>`: an exact id or a unique prefix. */
310
+ async resumeById(id) {
311
+ const session = await this.findSession(id);
312
+ if (session)
313
+ this.host.resumeSession(session);
314
+ }
315
+ /** Reload the list and match an exact id or a unique prefix; alerts and returns undefined otherwise. */
316
+ async findSession(id) {
317
+ this.sessions = await this.host.cli.sessions();
318
+ const exact = this.sessions.find((session) => session.id === id);
319
+ const matches = exact ? [exact] : this.sessions.filter((session) => session.id.startsWith(id));
320
+ if (matches.length === 1 && matches[0])
321
+ return matches[0];
322
+ this.host.alert({ variant: "error", title: matches.length ? `${matches.length} sessions start with ${id}` : `Session not found: ${id}`, body: "Run /sessions to pick from the list." });
323
+ return undefined;
324
+ }
325
+ usage(text) {
326
+ this.host.alert({ variant: "warning", title: "Usage", body: text });
327
+ }
328
+ async insertPromptCommand(name, args = []) {
329
+ const command = await cliJson(this.host.cli, ["command", "show", name, "--json", ...(args.length ? ["--arg", ...args] : [])], { content: "" });
330
+ const content = command.content.trim();
331
+ if (!content)
332
+ throw new Error(`Prompt command is empty: ${name}`);
333
+ if (command.missingArguments?.length)
334
+ this.host.alert({ variant: "warning", title: "Missing command arguments", body: command.missingArguments.join(", ") });
335
+ this.host.setComposerDraft(content);
336
+ }
337
+ async setProfile(profile) {
338
+ const { state } = this.host;
339
+ const stdout = await cliText(this.host.cli, ["profile", "use", profile, "--project"]);
340
+ state.integrationProfile = profile;
341
+ if (profile === "standalone" && state.mode === "plugin")
342
+ state.mode = "general";
343
+ this.host.alert({ variant: "success", title: `Integration profile: ${profile}`, body: stdout.trim() || undefined });
344
+ }
345
+ async removeDirectory(directory) {
346
+ const { state } = this.host;
347
+ if (this.blockedWhileRunning("changing external directories"))
348
+ return;
349
+ const target = state.externalDirectories.find((existing) => existing === directory || existing === path.resolve(state.cwd, directory));
350
+ if (!target)
351
+ return this.host.alert({ variant: "error", title: "External directory is not attached", body: directory });
352
+ if (hasSavedSession(state)) {
353
+ const remaining = await cliJson(this.host.cli, ["session", "remove-dir", state.sessionId, target, "--json"], []);
354
+ state.externalDirectories = Array.isArray(remaining) ? remaining.filter((value) => typeof value === "string") : [];
355
+ }
356
+ else {
357
+ state.externalDirectories = state.externalDirectories.filter((existing) => existing !== target);
358
+ }
359
+ this.host.alert({ variant: "success", title: "External directory removed from this session", body: target });
360
+ }
361
+ async previewRewind(checkpointId) {
362
+ const { state } = this.host;
363
+ if (this.blockedWhileRunning("rewinding"))
364
+ return;
365
+ if (!hasSavedSession(state))
366
+ return this.noSavedSession("rewinding");
367
+ const preview = parsePreview(await cliJson(this.host.cli, ["session", "rewind-preview", state.sessionId, checkpointId, "--json"], {}));
368
+ const lines = [
369
+ ...preview.restoreFiles.slice(0, 5).map((file) => `restore ${file}`),
370
+ ...preview.deleteFiles.slice(0, 5).map((file) => `delete ${file}`)
371
+ ];
372
+ this.host.alert({
373
+ variant: preview.deleteFiles.length ? "warning" : "info",
374
+ title: `Rewind ${checkpointId}: restore ${preview.restoreFiles.length} files, delete ${preview.deleteFiles.length}`,
375
+ body: lines.join("\n")
376
+ });
377
+ // Deleting files the agent created is destructive; ask first, defaulting to Cancel.
378
+ if (preview.deleteFiles.length) {
379
+ this.host.openPicker(picker("rewindConfirm", `Rewind deletes ${preview.deleteFiles.length} files`, rewindConfirmItems(checkpointId, preview.deleteFiles.length)));
380
+ return;
381
+ }
382
+ await this.restore(checkpointId);
383
+ }
384
+ async restore(checkpointId) {
385
+ const { state } = this.host;
386
+ if (this.blockedWhileRunning("rewinding") || !hasSavedSession(state))
387
+ return;
388
+ const result = parseRewind(await cliJson(this.host.cli, ["session", "rewind", state.sessionId, checkpointId, "--json"], {}));
389
+ this.host.alert({ variant: "success", title: `Rewound to ${checkpointId}`, body: `Restored ${result.restoredFiles} files, deleted ${result.deletedFiles} files.` });
390
+ }
391
+ async handoff(worker, prompt) {
392
+ const { state } = this.host;
393
+ if (this.blockedWhileRunning("handing off"))
394
+ return;
395
+ if (!hasSavedSession(state))
396
+ return this.noSavedSession("handing it off");
397
+ const source = state.sessionId;
398
+ this.host.alert({ variant: "info", title: `Handing off ${source} to ${worker}…` });
399
+ const args = ["crew", "handoff", `worker:${worker}`, source, ...(prompt ? [prompt] : []), "--provider", state.provider, "--mode", state.mode, "--effort", state.effort, "--approval", state.fullAccess ? "full-access" : "review"];
400
+ if (state.model)
401
+ args.push("--model", state.model);
402
+ if (state.systemPrompt)
403
+ args.push("--system-prompt", state.systemPrompt);
404
+ const result = await cliJson(this.host.cli, [...args, "--json"], {});
405
+ if (!result.sessionId)
406
+ throw new Error("Handoff completed without a new session id.");
407
+ state.sessionId = result.sessionId;
408
+ state.worker = result.worker ?? worker;
409
+ state.changedFiles = [];
410
+ this.host.alert({ variant: "success", title: "Handoff complete", body: `${source} → ${result.sessionId} as ${state.worker}` });
411
+ if (result.summary)
412
+ this.host.push({ type: "assistant", text: result.summary });
413
+ }
414
+ blockedWhileRunning(action) {
415
+ if (!this.host.bridgeRunning && !this.host.state.running)
416
+ return false;
417
+ this.host.alert({ variant: "warning", title: `Wait for the current run to finish before ${action}`, body: "Use /stop to end it." });
418
+ return true;
419
+ }
420
+ noSavedSession(action) {
421
+ this.host.alert({ variant: "warning", title: `Start or resume a saved session before ${action}` });
422
+ }
423
+ }
424
+ function hasSavedSession(state) {
425
+ return Boolean(state.sessionId) && state.sessionId !== "new";
426
+ }
427
+ function stringList(value) {
428
+ return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
429
+ }
430
+ function record(value) {
431
+ return value && typeof value === "object" ? value : {};
432
+ }
433
+ function parsePreview(value) {
434
+ const fields = record(value);
435
+ return { restoreFiles: stringList(fields.restoreFiles), deleteFiles: stringList(fields.deleteFiles) };
436
+ }
437
+ function parseRewind(value) {
438
+ const fields = record(value);
439
+ return {
440
+ restoredFiles: typeof fields.restoredFiles === "number" ? fields.restoredFiles : 0,
441
+ deletedFiles: typeof fields.deletedFiles === "number" ? fields.deletedFiles : 0
442
+ };
443
+ }
444
+ //# sourceMappingURL=picker-flows.js.map