@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,16 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
2
+ /* @jsxImportSource @opentui/react */
3
+ // Vendored from termcn (opentui/confirm). CrewCoder changes:
4
+ // - No global useKeyboard: upstream answered on a bare `y`/`n` from anywhere,
5
+ // the same hazard as upstream tool-approval. The choice is controlled
6
+ // (`selected`) and keys are routed by App through DEFAULT_APP_KEYBINDINGS.
7
+ // - The message row is omitted when `message` is empty (the question card
8
+ // draws its own wrapped title); the answer row sets flexDirection="row" and
9
+ // height 1; each answer is clickable.
10
+ import { useTheme } from "../../hooks/use-theme.js";
11
+ export const Confirm = ({ message, selected, onConfirm, onCancel, confirmLabel = "Yes", cancelLabel = "No", variant = "default", }) => {
12
+ const theme = useTheme();
13
+ const yesColor = variant === "danger" ? theme.colors.error : theme.colors.primary;
14
+ return (_jsxs("box", { flexDirection: "column", flexShrink: 0, children: [message ? (_jsxs("box", { flexDirection: "row", height: 1, children: [_jsx("text", { fg: theme.colors.primary, wrapMode: "none", children: "? " }), _jsx("text", { fg: theme.colors.foreground, wrapMode: "none", children: message })] })) : null, _jsxs("box", { flexDirection: "row", gap: 2, height: 1, children: [_jsx("text", { fg: selected ? yesColor : theme.colors.mutedForeground, wrapMode: "none", onMouseUp: onConfirm, children: selected ? _jsx("b", { children: `› ${confirmLabel}` }) : ` ${confirmLabel}` }), _jsx("text", { fg: selected ? theme.colors.mutedForeground : theme.colors.foreground, wrapMode: "none", onMouseUp: onCancel, children: selected ? ` ${cancelLabel}` : _jsx("b", { children: `› ${cancelLabel}` }) })] })] }));
15
+ };
16
+ //# sourceMappingURL=confirm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirm.js","sourceRoot":"","sources":["../../../src/components/ui/confirm.tsx"],"names":[],"mappings":";AAAA,qCAAqC;AACrC,6DAA6D;AAC7D,8EAA8E;AAC9E,wEAAwE;AACxE,6EAA6E;AAC7E,0EAA0E;AAC1E,8EAA8E;AAC9E,wCAAwC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAapD,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EACtB,OAAO,EACP,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,YAAY,GAAG,KAAK,EACpB,WAAW,GAAG,IAAI,EAClB,OAAO,GAAG,SAAS,GACN,EAAE,EAAE;IACjB,MAAM,KAAK,GAAG,QAAQ,EAA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vendored from termcn (opentui/confirm). CrewCoder changes:\n// - No global useKeyboard: upstream answered on a bare `y`/`n` from anywhere,\n// the same hazard as upstream tool-approval. The choice is controlled\n// (`selected`) and keys are routed by App through DEFAULT_APP_KEYBINDINGS.\n// - The message row is omitted when `message` is empty (the question card\n// draws its own wrapped title); the answer row sets flexDirection=\"row\" and\n// height 1; each answer is clickable.\nimport { useTheme } from \"../../hooks/use-theme.js\";\n\nexport interface ConfirmProps {\n message?: string;\n /** true = the confirm label is highlighted. */\n selected: boolean;\n onConfirm?: () => void;\n onCancel?: () => void;\n confirmLabel?: string;\n cancelLabel?: string;\n variant?: \"default\" | \"danger\";\n}\n\nexport const Confirm = ({\n message,\n selected,\n onConfirm,\n onCancel,\n confirmLabel = \"Yes\",\n cancelLabel = \"No\",\n variant = \"default\",\n}: ConfirmProps) => {\n const theme = useTheme();\n const yesColor = variant === \"danger\" ? theme.colors.error : theme.colors.primary;\n return (\n <box flexDirection=\"column\" flexShrink={0}>\n {message ? (\n <box flexDirection=\"row\" height={1}>\n <text fg={theme.colors.primary} wrapMode=\"none\">{\"? \"}</text>\n <text fg={theme.colors.foreground} wrapMode=\"none\">{message}</text>\n </box>\n ) : null}\n <box flexDirection=\"row\" gap={2} height={1}>\n <text fg={selected ? yesColor : theme.colors.mutedForeground} wrapMode=\"none\" onMouseUp={onConfirm}>\n {selected ? <b>{`› ${confirmLabel}`}</b> : ` ${confirmLabel}`}\n </text>\n <text fg={selected ? theme.colors.mutedForeground : theme.colors.foreground} wrapMode=\"none\" onMouseUp={onCancel}>\n {selected ? ` ${cancelLabel}` : <b>{`› ${cancelLabel}`}</b>}\n </text>\n </box>\n </box>\n );\n};\n"]}
@@ -0,0 +1,11 @@
1
+ import type { OptionRow } from "../../question-model.js";
2
+ export interface SelectProps {
3
+ rows: readonly OptionRow[];
4
+ /** Index of the highlighted option. */
5
+ active: number;
6
+ onChoose?: (option: number) => void;
7
+ cursor?: string;
8
+ emptyText?: string;
9
+ }
10
+ export declare const Select: ({ rows, active, onChoose, cursor, emptyText }: SelectProps) => import("react").ReactNode;
11
+ //# sourceMappingURL=select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/components/ui/select.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,SAAS,EAAE,CAAC;IAC3B,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,MAAM,GAAI,+CAA+E,WAAW,8BA6BhH,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
2
+ /* @jsxImportSource @opentui/react */
3
+ // Vendored from termcn (opentui/select). CrewCoder changes:
4
+ // - No global useKeyboard: upstream moved and submitted on every arrow/Enter,
5
+ // even while another field had focus. The cursor is controlled (`active`)
6
+ // and keys are routed by App through DEFAULT_APP_KEYBINDINGS.
7
+ // - Renders precomputed, wrapped `OptionRow`s (question-model.ts) instead of
8
+ // one unwrapped row per option, so long labels and descriptions wrap and the
9
+ // height is known to the split-footer sizer.
10
+ // - Rows set flexDirection="row" and height 1; hardcoded "#666" replaced with
11
+ // theme tokens; a click on any row of an option chooses it.
12
+ import { useTheme } from "../../hooks/use-theme.js";
13
+ export const Select = ({ rows, active, onChoose, cursor = "›", emptyText = "(no options provided)" }) => {
14
+ const theme = useTheme();
15
+ if (rows.length === 0) {
16
+ return _jsx("text", { fg: theme.colors.mutedForeground, height: 1, wrapMode: "none", flexShrink: 0, children: emptyText });
17
+ }
18
+ return (_jsx("box", { flexDirection: "column", flexShrink: 0, children: rows.map((row, index) => {
19
+ const isActive = row.option === active;
20
+ const choose = row.option >= 0 && onChoose ? () => onChoose(row.option) : undefined;
21
+ if (row.kind === "spacer")
22
+ return _jsx("text", { height: 1 }, index);
23
+ if (row.kind === "description") {
24
+ return (_jsx("text", { fg: isActive ? theme.colors.foreground : theme.colors.mutedForeground, height: 1, wrapMode: "none", paddingLeft: 4, onMouseUp: choose, children: row.text }, index));
25
+ }
26
+ return (_jsxs("box", { flexDirection: "row", height: 1, gap: 1, onMouseUp: choose, children: [_jsx("text", { fg: theme.colors.primary, wrapMode: "none", children: isActive && row.leading ? cursor : " " }), _jsx("text", { fg: isActive ? theme.colors.primary : theme.colors.foreground, wrapMode: "none", children: isActive ? _jsx("b", { children: row.text }) : row.text })] }, index));
27
+ }) }));
28
+ };
29
+ //# sourceMappingURL=select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/components/ui/select.tsx"],"names":[],"mappings":";AAAA,qCAAqC;AACrC,4DAA4D;AAC5D,8EAA8E;AAC9E,4EAA4E;AAC5E,gEAAgE;AAChE,6EAA6E;AAC7E,+EAA+E;AAC/E,+CAA+C;AAC/C,8EAA8E;AAC9E,8DAA8D;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAYpD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,GAAG,EAAE,SAAS,GAAG,uBAAuB,EAAe,EAAE,EAAE;IACnH,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,eAAM,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAC,MAAM,EAAC,UAAU,EAAE,CAAC,YAAG,SAAS,GAAQ,CAAC;IAC9G,CAAC;IACD,OAAO,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AAE,QAAQ,EAAC,MAAM,YACjF,QAAQ,CAAC,CAAC,CAAC,sBAAI,GAAG,CAAC,IAAI,GAAK,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,GACnC,KAJC,KAAK,CAKT,CACP,CAAC;QACJ,CAAC,CAAC,GACE,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/* @jsxImportSource @opentui/react */\n// Vendored from termcn (opentui/select). CrewCoder changes:\n// - No global useKeyboard: upstream moved and submitted on every arrow/Enter,\n// even while another field had focus. The cursor is controlled (`active`)\n// and keys are routed by App through DEFAULT_APP_KEYBINDINGS.\n// - Renders precomputed, wrapped `OptionRow`s (question-model.ts) instead of\n// one unwrapped row per option, so long labels and descriptions wrap and the\n// height is known to the split-footer sizer.\n// - Rows set flexDirection=\"row\" and height 1; hardcoded \"#666\" replaced with\n// theme tokens; a click on any row of an option chooses it.\nimport { useTheme } from \"../../hooks/use-theme.js\";\nimport type { OptionRow } from \"../../question-model.js\";\n\nexport interface SelectProps {\n rows: readonly OptionRow[];\n /** Index of the highlighted option. */\n active: number;\n onChoose?: (option: number) => void;\n cursor?: string;\n emptyText?: string;\n}\n\nexport const Select = ({ rows, active, onChoose, cursor = \"›\", emptyText = \"(no options provided)\" }: SelectProps) => {\n const theme = useTheme();\n if (rows.length === 0) {\n return <text fg={theme.colors.mutedForeground} height={1} wrapMode=\"none\" flexShrink={0}>{emptyText}</text>;\n }\n return (\n <box flexDirection=\"column\" flexShrink={0}>\n {rows.map((row, index) => {\n const isActive = row.option === active;\n const choose = row.option >= 0 && onChoose ? () => onChoose(row.option) : undefined;\n if (row.kind === \"spacer\") return <text key={index} height={1} />;\n if (row.kind === \"description\") {\n return (\n <text key={index} fg={isActive ? theme.colors.foreground : theme.colors.mutedForeground} height={1} wrapMode=\"none\" paddingLeft={4} onMouseUp={choose}>\n {row.text}\n </text>\n );\n }\n return (\n <box key={index} flexDirection=\"row\" height={1} gap={1} onMouseUp={choose}>\n <text fg={theme.colors.primary} wrapMode=\"none\">{isActive && row.leading ? cursor : \" \"}</text>\n <text fg={isActive ? theme.colors.primary : theme.colors.foreground} wrapMode=\"none\">\n {isActive ? <b>{row.text}</b> : row.text}\n </text>\n </box>\n );\n })}\n </box>\n );\n};\n"]}
@@ -0,0 +1,14 @@
1
+ import type { SpinnerName } from "cli-spinners";
2
+ type OpenTUIBoxProps = Record<string, unknown>;
3
+ export type SpinnerType = SpinnerName;
4
+ export declare const spinnerNames: SpinnerName[];
5
+ export interface SpinnerProps extends OpenTUIBoxProps {
6
+ type?: SpinnerType;
7
+ label?: string;
8
+ color?: string;
9
+ fps?: number;
10
+ frames?: string[];
11
+ }
12
+ export declare const Spinner: ({ type, label, color, fps, frames: customFrames, ...props }: SpinnerProps) => import("react").ReactNode;
13
+ export {};
14
+ //# sourceMappingURL=spinner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/components/ui/spinner.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAKhD,KAAK,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE/C,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC;AAEtC,eAAO,MAAM,YAAY,EAA+B,WAAW,EAAE,CAAC;AAEtE,MAAM,WAAW,YAAa,SAAQ,eAAe;IACnD,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,eAAO,MAAM,OAAO,GAAI,6DAOrB,YAAY,8BAiBd,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
2
+ /* @jsxImportSource @opentui/react */
3
+ import cliSpinners from "cli-spinners";
4
+ import { useAnimation } from "../../hooks/use-animation.js";
5
+ import { useTheme } from "../../hooks/use-theme.js";
6
+ export const spinnerNames = Object.keys(cliSpinners);
7
+ export const Spinner = ({ type = "dots", label, color, fps = 12, frames: customFrames, ...props }) => {
8
+ const theme = useTheme();
9
+ const builtin = cliSpinners[type] ?? cliSpinners.dots;
10
+ const useCustomFrames = customFrames !== undefined;
11
+ const frames = useCustomFrames ? customFrames : builtin.frames;
12
+ const frame = useAnimation(useCustomFrames ? fps : { intervalMs: builtin.interval });
13
+ const icon = frames[frame % frames.length];
14
+ const resolvedColor = color ?? theme.colors.primary;
15
+ return (_jsxs("box", { alignItems: "center", flexDirection: "row", ...props, children: [_jsx("text", { fg: resolvedColor, children: icon }), label ? _jsx("text", { marginLeft: 1, children: label }) : null] }));
16
+ };
17
+ //# sourceMappingURL=spinner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../../src/components/ui/spinner.tsx"],"names":[],"mappings":";AAAA,qCAAqC;AACrC,OAAO,WAAW,MAAM,cAAc,CAAC;AAGvC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAMpD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAkB,CAAC;AAUtE,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EACtB,IAAI,GAAG,MAAM,EACb,KAAK,EACL,KAAK,EACL,GAAG,GAAG,EAAE,EACR,MAAM,EAAE,YAAY,EACpB,GAAG,KAAK,EACK,EAAE,EAAE;IACjB,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC;IACtD,MAAM,eAAe,GAAG,YAAY,KAAK,SAAS,CAAC;IACnD,MAAM,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IAC/D,MAAM,KAAK,GAAG,YAAY,CACxB,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,QAAQ,EAAE,CACzD,CAAC;IACF,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,aAAa,GAAG,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;IAEpD,OAAO,CACL,eAAK,UAAU,EAAC,QAAQ,EAAC,aAAa,EAAC,KAAK,KAAK,KAAK,aACpD,eAAM,EAAE,EAAE,aAAa,YAAG,IAAI,GAAQ,EACrC,KAAK,CAAC,CAAC,CAAC,eAAM,UAAU,EAAE,CAAC,YAAG,KAAK,GAAQ,CAAC,CAAC,CAAC,IAAI,IAC/C,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/* @jsxImportSource @opentui/react */\nimport cliSpinners from \"cli-spinners\";\nimport type { SpinnerName } from \"cli-spinners\";\n\nimport { useAnimation } from \"../../hooks/use-animation.js\";\nimport { useTheme } from \"../../hooks/use-theme.js\";\n\ntype OpenTUIBoxProps = Record<string, unknown>;\n\nexport type SpinnerType = SpinnerName;\n\nexport const spinnerNames = Object.keys(cliSpinners) as SpinnerName[];\n\nexport interface SpinnerProps extends OpenTUIBoxProps {\n type?: SpinnerType;\n label?: string;\n color?: string;\n fps?: number;\n frames?: string[];\n}\n\nexport const Spinner = ({\n type = \"dots\",\n label,\n color,\n fps = 12,\n frames: customFrames,\n ...props\n}: SpinnerProps) => {\n const theme = useTheme();\n const builtin = cliSpinners[type] ?? cliSpinners.dots;\n const useCustomFrames = customFrames !== undefined;\n const frames = useCustomFrames ? customFrames : builtin.frames;\n const frame = useAnimation(\n useCustomFrames ? fps : { intervalMs: builtin.interval }\n );\n const icon = frames[frame % frames.length];\n const resolvedColor = color ?? theme.colors.primary;\n\n return (\n <box alignItems=\"center\" flexDirection=\"row\" {...props}>\n <text fg={resolvedColor}>{icon}</text>\n {label ? <text marginLeft={1}>{label}</text> : null}\n </box>\n );\n};\n"]}
@@ -0,0 +1,14 @@
1
+ export type RiskLevel = "low" | "medium" | "high";
2
+ export interface ToolApprovalProps {
3
+ name: string;
4
+ description?: string;
5
+ args?: Record<string, unknown>;
6
+ risk?: RiskLevel;
7
+ onApprove: () => void;
8
+ onDeny: () => void;
9
+ maxArgs?: number;
10
+ }
11
+ /** Rows the card occupies, including its border. Must match the layout below. */
12
+ export declare const toolApprovalHeight: ({ description, args, maxArgs }: Pick<ToolApprovalProps, "description" | "args" | "maxArgs">) => number;
13
+ export declare const ToolApproval: ({ name, description, args, risk, onApprove, onDeny, maxArgs, }: ToolApprovalProps) => import("react").ReactNode;
14
+ //# sourceMappingURL=tool-approval.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-approval.d.ts","sourceRoot":"","sources":["../../../src/components/ui/tool-approval.tsx"],"names":[],"mappings":"AAaA,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAElD,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID,iFAAiF;AACjF,eAAO,MAAM,kBAAkB,GAAI,gCAAmD,IAAI,CAAC,iBAAiB,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAAC,KAAG,MAInJ,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,gEAQ1B,iBAAiB,8BAmEnB,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
2
+ /* @jsxImportSource @opentui/react */
3
+ // Vendored from termcn (opentui/tool-approval). CrewCoder changes:
4
+ // - Inline rows set flexDirection="row": OpenTUI (Yoga) defaults to column,
5
+ // unlike Ink, so upstream rows stacked and collapsed inside height-1 boxes.
6
+ // - No global useKeyboard. Approval is resolved by the caller's configured
7
+ // chords or by selecting the visible mouse controls.
8
+ // - No auto-deny timer; approvals wait for an explicit decision.
9
+ // - `risk` has no default: an unknown risk shows no badge instead of claiming
10
+ // LOW RISK.
11
+ // - One-line, non-wrapping rows with a bounded argument list, so the height is
12
+ // deterministic (see toolApprovalHeight) for split-footer sizing.
13
+ import { useTheme } from "../../hooks/use-theme.js";
14
+ const DEFAULT_MAX_ARGS = 3;
15
+ /** Rows the card occupies, including its border. Must match the layout below. */
16
+ export const toolApprovalHeight = ({ description, args, maxArgs = DEFAULT_MAX_ARGS }) => {
17
+ const argCount = args ? Object.keys(args).length : 0;
18
+ const argRows = argCount === 0 ? 0 : 1 + Math.min(argCount, maxArgs) + (argCount > maxArgs ? 1 : 0);
19
+ return 2 + 1 + 1 + (description ? 1 : 0) + argRows + 1;
20
+ };
21
+ export const ToolApproval = ({ name, description, args, risk, onApprove, onDeny, maxArgs = DEFAULT_MAX_ARGS, }) => {
22
+ const theme = useTheme();
23
+ const muted = theme.colors.mutedForeground;
24
+ const riskColor = {
25
+ high: theme.colors.error,
26
+ low: theme.colors.success,
27
+ medium: theme.colors.warning,
28
+ };
29
+ const entries = args ? Object.entries(args) : [];
30
+ const shown = entries.slice(0, maxArgs);
31
+ return (_jsxs("box", { flexDirection: "column", flexShrink: 0, border: true, borderStyle: "rounded", borderColor: risk ? riskColor[risk] : theme.colors.warning, paddingLeft: 1, paddingRight: 1, children: [_jsxs("box", { flexDirection: "row", gap: 2, height: 1, children: [_jsx("text", { fg: theme.colors.foreground, wrapMode: "none", children: _jsx("b", { children: "Tool Approval Required" }) }), risk ? (_jsx("text", { fg: riskColor[risk], wrapMode: "none", children: _jsx("b", { children: `[${risk.toUpperCase()} RISK]` }) })) : null] }), _jsxs("box", { flexDirection: "row", gap: 1, height: 1, children: [_jsx("text", { fg: muted, children: "Tool:" }), _jsx("text", { fg: theme.colors.primary, wrapMode: "none", children: _jsx("b", { children: name }) })] }), description ? (_jsx("text", { fg: muted, height: 1, wrapMode: "none", children: description })) : null, entries.length > 0 ? (_jsxs("box", { flexDirection: "column", children: [_jsx("text", { fg: muted, height: 1, children: "Arguments:" }), shown.map(([k, v]) => (_jsxs("box", { flexDirection: "row", gap: 1, height: 1, paddingLeft: 2, children: [_jsx("text", { fg: theme.colors.accent, wrapMode: "none", children: `${k}:` }), _jsx("text", { fg: muted, wrapMode: "none", children: oneLine(v) })] }, k))), entries.length > maxArgs ? (_jsx("text", { fg: muted, height: 1, paddingLeft: 2, children: `… ${entries.length - maxArgs} more` })) : null] })) : null, _jsxs("box", { flexDirection: "row", gap: 1, height: 1, children: [_jsx("box", { height: 1, paddingLeft: 1, paddingRight: 1, backgroundColor: theme.colors.secondary, onMouseUp: onApprove, children: _jsx("text", { fg: theme.colors.success, wrapMode: "none", children: _jsx("b", { children: "Approve" }) }) }), _jsx("box", { height: 1, paddingLeft: 1, paddingRight: 1, backgroundColor: theme.colors.secondary, onMouseUp: onDeny, children: _jsx("text", { fg: theme.colors.error, wrapMode: "none", children: _jsx("b", { children: "Deny" }) }) })] })] }));
32
+ };
33
+ const oneLine = (value) => {
34
+ const text = typeof value === "string" ? value : JSON.stringify(value) ?? String(value);
35
+ return text.replace(/\s+/g, " ");
36
+ };
37
+ //# sourceMappingURL=tool-approval.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-approval.js","sourceRoot":"","sources":["../../../src/components/ui/tool-approval.tsx"],"names":[],"mappings":";AAAA,qCAAqC;AACrC,mEAAmE;AACnE,4EAA4E;AAC5E,8EAA8E;AAC9E,2EAA2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AW,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,YACzG,eAAM,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAC,MAAM,YAAC,+BAAW,GAAO,GAC5D,IACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,CAAC,KAAc,EAAU,EAAE;IACzC,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;IACxF,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACnC,CAAC,CAAC","sourcesContent":["/* @jsxImportSource @opentui/react */\n// Vendored from termcn (opentui/tool-approval). CrewCoder changes:\n// - Inline rows set flexDirection=\"row\": OpenTUI (Yoga) defaults to column,\n// unlike Ink, so upstream rows stacked and collapsed inside height-1 boxes.\n// - No global useKeyboard. Approval is resolved by the caller's configured\n// chords or by selecting the visible mouse controls.\n// - No auto-deny timer; approvals wait for an explicit decision.\n// - `risk` has no default: an unknown risk shows no badge instead of claiming\n// LOW RISK.\n// - One-line, non-wrapping rows with a bounded argument list, so the height is\n// deterministic (see toolApprovalHeight) for split-footer sizing.\nimport { useTheme } from \"../../hooks/use-theme.js\";\n\nexport type RiskLevel = \"low\" | \"medium\" | \"high\";\n\nexport interface ToolApprovalProps {\n name: string;\n description?: string;\n args?: Record<string, unknown>;\n risk?: RiskLevel;\n onApprove: () => void;\n onDeny: () => void;\n maxArgs?: number;\n}\n\nconst DEFAULT_MAX_ARGS = 3;\n\n/** Rows the card occupies, including its border. Must match the layout below. */\nexport const toolApprovalHeight = ({ description, args, maxArgs = DEFAULT_MAX_ARGS }: Pick<ToolApprovalProps, \"description\" | \"args\" | \"maxArgs\">): number => {\n const argCount = args ? Object.keys(args).length : 0;\n const argRows = argCount === 0 ? 0 : 1 + Math.min(argCount, maxArgs) + (argCount > maxArgs ? 1 : 0);\n return 2 + 1 + 1 + (description ? 1 : 0) + argRows + 1;\n};\n\nexport const ToolApproval = ({\n name,\n description,\n args,\n risk,\n onApprove,\n onDeny,\n maxArgs = DEFAULT_MAX_ARGS,\n}: ToolApprovalProps) => {\n const theme = useTheme();\n const muted = theme.colors.mutedForeground;\n const riskColor: Record<RiskLevel, string> = {\n high: theme.colors.error,\n low: theme.colors.success,\n medium: theme.colors.warning,\n };\n const entries = args ? Object.entries(args) : [];\n const shown = entries.slice(0, maxArgs);\n\n return (\n <box\n flexDirection=\"column\"\n flexShrink={0}\n border\n borderStyle=\"rounded\"\n borderColor={risk ? riskColor[risk] : theme.colors.warning}\n paddingLeft={1}\n paddingRight={1}\n >\n <box flexDirection=\"row\" gap={2} height={1}>\n <text fg={theme.colors.foreground} wrapMode=\"none\">\n <b>Tool Approval Required</b>\n </text>\n {risk ? (\n <text fg={riskColor[risk]} wrapMode=\"none\">\n <b>{`[${risk.toUpperCase()} RISK]`}</b>\n </text>\n ) : null}\n </box>\n\n <box flexDirection=\"row\" gap={1} height={1}>\n <text fg={muted}>Tool:</text>\n <text fg={theme.colors.primary} wrapMode=\"none\">\n <b>{name}</b>\n </text>\n </box>\n {description ? (\n <text fg={muted} height={1} wrapMode=\"none\">{description}</text>\n ) : null}\n\n {entries.length > 0 ? (\n <box flexDirection=\"column\">\n <text fg={muted} height={1}>Arguments:</text>\n {shown.map(([k, v]) => (\n <box key={k} flexDirection=\"row\" gap={1} height={1} paddingLeft={2}>\n <text fg={theme.colors.accent} wrapMode=\"none\">{`${k}:`}</text>\n <text fg={muted} wrapMode=\"none\">{oneLine(v)}</text>\n </box>\n ))}\n {entries.length > maxArgs ? (\n <text fg={muted} height={1} paddingLeft={2}>{`… ${entries.length - maxArgs} more`}</text>\n ) : null}\n </box>\n ) : null}\n\n <box flexDirection=\"row\" gap={1} height={1}>\n <box height={1} paddingLeft={1} paddingRight={1} backgroundColor={theme.colors.secondary} onMouseUp={onApprove}>\n <text fg={theme.colors.success} wrapMode=\"none\"><b>Approve</b></text>\n </box>\n <box height={1} paddingLeft={1} paddingRight={1} backgroundColor={theme.colors.secondary} onMouseUp={onDeny}>\n <text fg={theme.colors.error} wrapMode=\"none\"><b>Deny</b></text>\n </box>\n </box>\n </box>\n );\n};\n\nconst oneLine = (value: unknown): string => {\n const text = typeof value === \"string\" ? value : JSON.stringify(value) ?? String(value);\n return text.replace(/\\s+/g, \" \");\n};\n"]}
@@ -0,0 +1,12 @@
1
+ export type ToolCallStatus = "pending" | "running" | "success" | "error";
2
+ export interface ToolCallProps {
3
+ name: string;
4
+ args?: Record<string, unknown>;
5
+ status: ToolCallStatus;
6
+ result?: unknown;
7
+ duration?: number;
8
+ collapsible?: boolean;
9
+ collapsed?: boolean;
10
+ }
11
+ export declare const ToolCall: ({ name, args, status, result, duration, collapsible, collapsed, }: ToolCallProps) => import("react").ReactNode;
12
+ //# sourceMappingURL=tool-call.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-call.d.ts","sourceRoot":"","sources":["../../../src/components/ui/tool-call.tsx"],"names":[],"mappings":"AAYA,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAEzE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAID,eAAO,MAAM,QAAQ,GAAI,mEAQtB,aAAa,8BA6Ff,CAAC"}
@@ -0,0 +1,69 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
2
+ /* @jsxImportSource @opentui/react */
3
+ // Vendored from termcn (opentui/tool-call). CrewCoder changes:
4
+ // - Inline rows set flexDirection="row": OpenTUI (Yoga) defaults to column,
5
+ // unlike Ink, so upstream rows stacked instead of sitting side by side.
6
+ // - No global useKeyboard (it toggled every instance on Enter/Space, including
7
+ // while typing in the composer); `collapsed` is controlled by the caller.
8
+ // - The spinner and elapsed timer only run while the tool is running.
9
+ // - Theme tokens replace hardcoded #666.
10
+ import { useEffect, useState } from "react";
11
+ import { useTheme } from "../../hooks/use-theme.js";
12
+ const SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
13
+ export const ToolCall = ({ name, args, status, result, duration, collapsible = true, collapsed = true, }) => {
14
+ const theme = useTheme();
15
+ const [elapsed, setElapsed] = useState(0);
16
+ const [frame, setFrame] = useState(0);
17
+ const muted = theme.colors.mutedForeground;
18
+ useEffect(() => {
19
+ if (status !== "running") {
20
+ return;
21
+ }
22
+ const startedAt = Date.now();
23
+ const id = setInterval(() => {
24
+ setFrame((f) => f + 1);
25
+ setElapsed(Date.now() - startedAt);
26
+ }, Math.round(1000 / 12));
27
+ return () => clearInterval(id);
28
+ }, [status]);
29
+ const statusIcon = () => {
30
+ switch (status) {
31
+ case "pending": {
32
+ return _jsx("text", { fg: muted, children: "\u25CB" });
33
+ }
34
+ case "running": {
35
+ return _jsx("text", { fg: theme.colors.primary, children: SPINNER_FRAMES[frame % SPINNER_FRAMES.length] ?? "⠋" });
36
+ }
37
+ case "success": {
38
+ return _jsx("text", { fg: theme.colors.success, children: "\u2713" });
39
+ }
40
+ case "error": {
41
+ return _jsx("text", { fg: theme.colors.error, children: "\u2717" });
42
+ }
43
+ }
44
+ };
45
+ let durationText;
46
+ if (duration === undefined) {
47
+ durationText = status === "running" ? `${elapsed}ms` : null;
48
+ }
49
+ else {
50
+ durationText = `${duration}ms`;
51
+ }
52
+ let nameColor;
53
+ if (status === "error") {
54
+ nameColor = theme.colors.error;
55
+ }
56
+ else if (status === "success") {
57
+ nameColor = theme.colors.success;
58
+ }
59
+ else if (status === "running") {
60
+ nameColor = theme.colors.primary;
61
+ }
62
+ else {
63
+ nameColor = muted;
64
+ }
65
+ return (_jsxs("box", { flexDirection: "column", children: [_jsxs("box", { flexDirection: "row", gap: 1, children: [statusIcon(), _jsx("text", { fg: nameColor, children: status !== "pending" ? _jsx("b", { children: name }) : name }), durationText && (_jsx("text", { fg: muted, children: `(${durationText})` })), collapsible && _jsx("text", { fg: muted, children: collapsed ? "▶" : "▼" })] }), !collapsed && (_jsxs("box", { flexDirection: "column", paddingLeft: 2, children: [args && Object.keys(args).length > 0 && (_jsxs("box", { flexDirection: "column", children: [_jsx("text", { fg: muted, children: "Args:" }), Object.entries(args).map(([k, v]) => (_jsxs("box", { flexDirection: "row", gap: 1, children: [_jsx("text", { fg: theme.colors.accent, children: `${k}:` }), _jsx("text", { fg: muted, children: JSON.stringify(v) })] }, k)))] })), result !== undefined && (_jsxs("box", { flexDirection: "column", children: [_jsx("text", { fg: muted, children: "Result:" }), _jsx("text", { fg: muted, children: typeof result === "string"
66
+ ? result
67
+ : JSON.stringify(result, null, 2) })] }))] }))] }));
68
+ };
69
+ //# sourceMappingURL=tool-call.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-call.js","sourceRoot":"","sources":["../../../src/components/ui/tool-call.tsx"],"names":[],"mappings":";AAAA,qCAAqC;AACrC,+DAA+D;AAC/D,4EAA4E;AAC5E,0EAA0E;AAC1E,+EAA+E;AAC/E,4EAA4E;AAC5E,sEAAsE;AACtE,yCAAyC;AACzC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAcpD,MAAM,cAAc,GAAG,CAAC,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G,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/* @jsxImportSource @opentui/react */\n// Vendored from termcn (opentui/tool-call). CrewCoder changes:\n// - Inline rows set flexDirection=\"row\": OpenTUI (Yoga) defaults to column,\n// unlike Ink, so upstream rows stacked instead of sitting side by side.\n// - No global useKeyboard (it toggled every instance on Enter/Space, including\n// while typing in the composer); `collapsed` is controlled by the caller.\n// - The spinner and elapsed timer only run while the tool is running.\n// - Theme tokens replace hardcoded #666.\nimport { useEffect, useState } from \"react\";\n\nimport { useTheme } from \"../../hooks/use-theme.js\";\n\nexport type ToolCallStatus = \"pending\" | \"running\" | \"success\" | \"error\";\n\nexport interface ToolCallProps {\n name: string;\n args?: Record<string, unknown>;\n status: ToolCallStatus;\n result?: unknown;\n duration?: number;\n collapsible?: boolean;\n collapsed?: boolean;\n}\n\nconst SPINNER_FRAMES = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\n\nexport const ToolCall = ({\n name,\n args,\n status,\n result,\n duration,\n collapsible = true,\n collapsed = true,\n}: ToolCallProps) => {\n const theme = useTheme();\n const [elapsed, setElapsed] = useState(0);\n const [frame, setFrame] = useState(0);\n const muted = theme.colors.mutedForeground;\n\n useEffect(() => {\n if (status !== \"running\") {\n return;\n }\n const startedAt = Date.now();\n const id = setInterval(() => {\n setFrame((f) => f + 1);\n setElapsed(Date.now() - startedAt);\n }, Math.round(1000 / 12));\n return () => clearInterval(id);\n }, [status]);\n\n const statusIcon = () => {\n switch (status) {\n case \"pending\": {\n return <text fg={muted}>○</text>;\n }\n case \"running\": {\n return <text fg={theme.colors.primary}>{SPINNER_FRAMES[frame % SPINNER_FRAMES.length] ?? \"⠋\"}</text>;\n }\n case \"success\": {\n return <text fg={theme.colors.success}>✓</text>;\n }\n case \"error\": {\n return <text fg={theme.colors.error}>✗</text>;\n }\n }\n };\n\n let durationText: string | null;\n if (duration === undefined) {\n durationText = status === \"running\" ? `${elapsed}ms` : null;\n } else {\n durationText = `${duration}ms`;\n }\n\n let nameColor: string;\n if (status === \"error\") {\n nameColor = theme.colors.error;\n } else if (status === \"success\") {\n nameColor = theme.colors.success;\n } else if (status === \"running\") {\n nameColor = theme.colors.primary;\n } else {\n nameColor = muted;\n }\n\n return (\n <box flexDirection=\"column\">\n <box flexDirection=\"row\" gap={1}>\n {statusIcon()}\n <text fg={nameColor}>\n {status !== \"pending\" ? <b>{name}</b> : name}\n </text>\n {durationText && (\n <text fg={muted}>{`(${durationText})`}</text>\n )}\n {collapsible && <text fg={muted}>{collapsed ? \"▶\" : \"▼\"}</text>}\n </box>\n\n {!collapsed && (\n <box flexDirection=\"column\" paddingLeft={2}>\n {args && Object.keys(args).length > 0 && (\n <box flexDirection=\"column\">\n <text fg={muted}>Args:</text>\n {Object.entries(args).map(([k, v]) => (\n <box key={k} flexDirection=\"row\" gap={1}>\n <text fg={theme.colors.accent}>{`${k}:`}</text>\n <text fg={muted}>{JSON.stringify(v)}</text>\n </box>\n ))}\n </box>\n )}\n {result !== undefined && (\n <box flexDirection=\"column\">\n <text fg={muted}>Result:</text>\n <text fg={muted}>\n {typeof result === \"string\"\n ? result\n : JSON.stringify(result, null, 2)}\n </text>\n </box>\n )}\n </box>\n )}\n </box>\n );\n};\n"]}
@@ -0,0 +1,82 @@
1
+ import type { ReactNode } from "react";
2
+ export type BorderStyle = "single" | "double" | "rounded" | "heavy";
3
+ export interface ColorTokens {
4
+ primary: string;
5
+ primaryForeground: string;
6
+ secondary: string;
7
+ secondaryForeground: string;
8
+ accent: string;
9
+ accentForeground: string;
10
+ success: string;
11
+ successForeground: string;
12
+ warning: string;
13
+ warningForeground: string;
14
+ error: string;
15
+ errorForeground: string;
16
+ info: string;
17
+ infoForeground: string;
18
+ background: string;
19
+ foreground: string;
20
+ muted: string;
21
+ mutedForeground: string;
22
+ border: string;
23
+ focusRing: string;
24
+ selection: string;
25
+ selectionForeground: string;
26
+ }
27
+ export interface SpacingTokens {
28
+ 0: number;
29
+ 1: number;
30
+ 2: number;
31
+ 3: number;
32
+ 4: number;
33
+ 6: number;
34
+ 8: number;
35
+ }
36
+ export interface TypographyTokens {
37
+ bold: boolean;
38
+ sm: string;
39
+ base: string;
40
+ lg: string;
41
+ xl: string;
42
+ }
43
+ export interface BorderTokens {
44
+ style: BorderStyle;
45
+ color: string;
46
+ focusColor: string;
47
+ }
48
+ export interface Theme {
49
+ name: string;
50
+ colors: ColorTokens;
51
+ spacing: SpacingTokens;
52
+ typography: TypographyTokens;
53
+ border: BorderTokens;
54
+ }
55
+ export interface MotionContextValue {
56
+ reduced: boolean;
57
+ }
58
+ export interface UnicodeContextValue {
59
+ unicode: boolean;
60
+ }
61
+ export interface ThemeContextValue {
62
+ setTheme: (theme: Theme) => void;
63
+ theme: Theme;
64
+ }
65
+ export interface ThemeProviderProps {
66
+ children: ReactNode;
67
+ theme?: Theme;
68
+ }
69
+ export interface MotionProviderProps {
70
+ children: ReactNode;
71
+ reducedMotion?: boolean;
72
+ }
73
+ export interface UnicodeProviderProps {
74
+ children: ReactNode;
75
+ unicode?: boolean;
76
+ }
77
+ export interface AutoThemeProviderProps {
78
+ children: ReactNode;
79
+ darkTheme: Theme;
80
+ lightTheme: Theme;
81
+ }
82
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ui/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAEpE,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,gBAA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AAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,KAAK,EAAE,KAAK,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,EAAE,KAAK,CAAC;IACjB,UAAU,EAAE,KAAK,CAAC;CACnB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/ui/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from \"react\";\n\nexport type BorderStyle = \"single\" | \"double\" | \"rounded\" | \"heavy\";\n\nexport interface ColorTokens {\n primary: string;\n primaryForeground: string;\n secondary: string;\n secondaryForeground: string;\n accent: string;\n accentForeground: string;\n success: string;\n successForeground: string;\n warning: string;\n warningForeground: string;\n error: string;\n errorForeground: string;\n info: string;\n infoForeground: string;\n background: string;\n foreground: string;\n muted: string;\n mutedForeground: string;\n border: string;\n focusRing: string;\n selection: string;\n selectionForeground: string;\n}\n\nexport interface SpacingTokens {\n 0: number;\n 1: number;\n 2: number;\n 3: number;\n 4: number;\n 6: number;\n 8: number;\n}\n\nexport interface TypographyTokens {\n bold: boolean;\n sm: string;\n base: string;\n lg: string;\n xl: string;\n}\n\nexport interface BorderTokens {\n style: BorderStyle;\n color: string;\n focusColor: string;\n}\n\nexport interface Theme {\n name: string;\n colors: ColorTokens;\n spacing: SpacingTokens;\n typography: TypographyTokens;\n border: BorderTokens;\n}\n\nexport interface MotionContextValue {\n reduced: boolean;\n}\n\nexport interface UnicodeContextValue {\n unicode: boolean;\n}\n\nexport interface ThemeContextValue {\n setTheme: (theme: Theme) => void;\n theme: Theme;\n}\n\nexport interface ThemeProviderProps {\n children: ReactNode;\n theme?: Theme;\n}\n\nexport interface MotionProviderProps {\n children: ReactNode;\n reducedMotion?: boolean;\n}\n\nexport interface UnicodeProviderProps {\n children: ReactNode;\n unicode?: boolean;\n}\n\nexport interface AutoThemeProviderProps {\n children: ReactNode;\n darkTheme: Theme;\n lightTheme: Theme;\n}\n"]}
@@ -0,0 +1,51 @@
1
+ import { type ProviderRecord, type SessionRecord } from "@onpoint-dev-tools/crewcoder-tui-core/bridge/crewcoder-process";
2
+ export type CliResult = {
3
+ stdout: string;
4
+ stderr: string;
5
+ exitCode: number;
6
+ };
7
+ /**
8
+ * One-shot CrewCoder CLI calls the pickers need. The shared core resolves
9
+ * local vs. remote (SSH) invocation, so every call here is remote-safe.
10
+ */
11
+ export type CrewCoderCli = {
12
+ exec(args: string[]): Promise<CliResult>;
13
+ providers(): Promise<ProviderRecord[]>;
14
+ sessions(): Promise<SessionRecord[]>;
15
+ /** Fork a saved session; resolves to the new session id. */
16
+ branch(sessionId: string): Promise<string>;
17
+ };
18
+ export declare const processCli: CrewCoderCli;
19
+ export type WorkerSummary = {
20
+ name: string;
21
+ active: boolean;
22
+ ownerName: string | null;
23
+ };
24
+ export type NamedEntry = {
25
+ name: string;
26
+ description?: string;
27
+ path?: string;
28
+ };
29
+ export type LoadedSkill = {
30
+ name: string;
31
+ description: string;
32
+ body: string;
33
+ };
34
+ export type LoadedPromptCommand = {
35
+ content: string;
36
+ missingArguments?: string[];
37
+ };
38
+ export type RewindPreview = {
39
+ restoreFiles: string[];
40
+ deleteFiles: string[];
41
+ };
42
+ export type RewindResult = {
43
+ restoredFiles: number;
44
+ deletedFiles: number;
45
+ };
46
+ /** Run a command and return stdout, or throw with the CLI's own error text. */
47
+ export declare function cliText(cli: CrewCoderCli, args: string[]): Promise<string>;
48
+ export declare function cliJson<T>(cli: CrewCoderCli, args: string[], fallback: T): Promise<T>;
49
+ export declare function readToolMode(cli: CrewCoderCli): Promise<"native" | "crewcoder">;
50
+ export declare function errorMessage(error: unknown): string;
51
+ //# sourceMappingURL=crewcoder-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crewcoder-cli.d.ts","sourceRoot":"","sources":["../src/crewcoder-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,gEAAgE,CAAC;AAExE,MAAM,MAAM,SAAS,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7E;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IACzC,SAAS,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IACvC,QAAQ,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IACrC,4DAA4D;IAC5D,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,YAKxB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AACxF,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAC/E,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAC9E,MAAM,MAAM,mBAAmB,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AACnF,MAAM,MAAM,aAAa,GAAG;IAAE,YAAY,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAC9E,MAAM,MAAM,YAAY,GAAG;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3E,+EAA+E;AAC/E,wBAAsB,OAAO,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAIhF;AAED,wBAAsB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAG3F;AAED,wBAAsB,YAAY,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,WAAW,CAAC,CAGrF;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEnD"}
@@ -0,0 +1,26 @@
1
+ import { branchCrewCoderSession, execCrewCoderCommand, listCrewCoderProviders, listCrewCoderSessions } from "@onpoint-dev-tools/crewcoder-tui-core/bridge/crewcoder-process";
2
+ export const processCli = {
3
+ exec: execCrewCoderCommand,
4
+ providers: listCrewCoderProviders,
5
+ sessions: listCrewCoderSessions,
6
+ branch: branchCrewCoderSession
7
+ };
8
+ /** Run a command and return stdout, or throw with the CLI's own error text. */
9
+ export async function cliText(cli, args) {
10
+ const { stdout, stderr, exitCode } = await cli.exec(args);
11
+ if (exitCode !== 0)
12
+ throw new Error(stderr.trim() || `crewcoder ${args.slice(0, 2).join(" ")} exited with code ${exitCode}`);
13
+ return stdout;
14
+ }
15
+ export async function cliJson(cli, args, fallback) {
16
+ const stdout = await cliText(cli, args);
17
+ return stdout.trim() ? JSON.parse(stdout) : fallback;
18
+ }
19
+ export async function readToolMode(cli) {
20
+ const config = await cliJson(cli, ["config", "show"], {});
21
+ return config.toolMode === "crewcoder" ? "crewcoder" : "native";
22
+ }
23
+ export function errorMessage(error) {
24
+ return error instanceof Error ? error.message : String(error);
25
+ }
26
+ //# sourceMappingURL=crewcoder-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crewcoder-cli.js","sourceRoot":"","sources":["../src/crewcoder-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EAGtB,MAAM,gEAAgE,CAAC;AAgBxE,MAAM,CAAC,MAAM,UAAU,GAAiB;IACtC,IAAI,EAAE,oBAAoB;IAC1B,SAAS,EAAE,sBAAsB;IACjC,QAAQ,EAAE,qBAAqB;IAC/B,MAAM,EAAE,sBAAsB;CAC/B,CAAC;AASF,+EAA+E;AAC/E,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,GAAiB,EAAE,IAAc;IAC7D,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1D,IAAI,QAAQ,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,aAAa,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,qBAAqB,QAAQ,EAAE,CAAC,CAAC;IAC7H,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,OAAO,CAAI,GAAiB,EAAE,IAAc,EAAE,QAAW;IAC7E,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC5D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAiB;IAClD,MAAM,MAAM,GAAG,MAAM,OAAO,CAA0B,GAAG,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;IACnF,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC","sourcesContent":["import {\n branchCrewCoderSession,\n execCrewCoderCommand,\n listCrewCoderProviders,\n listCrewCoderSessions,\n type ProviderRecord,\n type SessionRecord\n} from \"@onpoint-dev-tools/crewcoder-tui-core/bridge/crewcoder-process\";\n\nexport type CliResult = { stdout: string; stderr: string; exitCode: number };\n\n/**\n * One-shot CrewCoder CLI calls the pickers need. The shared core resolves\n * local vs. remote (SSH) invocation, so every call here is remote-safe.\n */\nexport type CrewCoderCli = {\n exec(args: string[]): Promise<CliResult>;\n providers(): Promise<ProviderRecord[]>;\n sessions(): Promise<SessionRecord[]>;\n /** Fork a saved session; resolves to the new session id. */\n branch(sessionId: string): Promise<string>;\n};\n\nexport const processCli: CrewCoderCli = {\n exec: execCrewCoderCommand,\n providers: listCrewCoderProviders,\n sessions: listCrewCoderSessions,\n branch: branchCrewCoderSession\n};\n\nexport type WorkerSummary = { name: string; active: boolean; ownerName: string | null };\nexport type NamedEntry = { name: string; description?: string; path?: string };\nexport type LoadedSkill = { name: string; description: string; body: string };\nexport type LoadedPromptCommand = { content: string; missingArguments?: string[] };\nexport type RewindPreview = { restoreFiles: string[]; deleteFiles: string[] };\nexport type RewindResult = { restoredFiles: number; deletedFiles: number };\n\n/** Run a command and return stdout, or throw with the CLI's own error text. */\nexport async function cliText(cli: CrewCoderCli, args: string[]): Promise<string> {\n const { stdout, stderr, exitCode } = await cli.exec(args);\n if (exitCode !== 0) throw new Error(stderr.trim() || `crewcoder ${args.slice(0, 2).join(\" \")} exited with code ${exitCode}`);\n return stdout;\n}\n\nexport async function cliJson<T>(cli: CrewCoderCli, args: string[], fallback: T): Promise<T> {\n const stdout = await cliText(cli, args);\n return stdout.trim() ? JSON.parse(stdout) as T : fallback;\n}\n\nexport async function readToolMode(cli: CrewCoderCli): Promise<\"native\" | \"crewcoder\"> {\n const config = await cliJson<Record<string, unknown>>(cli, [\"config\", \"show\"], {});\n return config.toolMode === \"crewcoder\" ? \"crewcoder\" : \"native\";\n}\n\nexport function errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import { type LineAnchors } from "./tool-diff.js";
2
+ import type { ToolBlock } from "./transcript.js";
3
+ /** Reads a workspace file's text, or undefined when it cannot or should not be read. */
4
+ export type FileReader = (absolutePath: string) => Promise<string | undefined>;
5
+ export declare const readLocalFile: FileReader;
6
+ /**
7
+ * Where each find/replace edit of a finished tool call landed in its file, so
8
+ * its diff gets real line numbers. Read once, right after the tool ends: later
9
+ * edits move lines, and the diff should show where this edit happened. An edit
10
+ * whose new text is not found (deleted lines, a later rewrite) gets no anchor
11
+ * and renders as a plain +/- diff.
12
+ */
13
+ export declare function computeLineAnchors(block: ToolBlock, cwd: string, read?: FileReader): Promise<LineAnchors | undefined>;
14
+ //# sourceMappingURL=diff-anchors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff-anchors.d.ts","sourceRoot":"","sources":["../src/diff-anchors.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmD,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACnG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,wFAAwF;AACxF,MAAM,MAAM,UAAU,GAAG,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAK/E,eAAO,MAAM,aAAa,EAAE,UAQ3B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,UAA0B,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAc1I"}
@@ -0,0 +1,43 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { anchorKey, findAnchor, isEditTool, snippetEdits } from "./tool-diff.js";
4
+ /** Files above this are not read just to number a diff. */
5
+ const MAX_ANCHOR_FILE_BYTES = 4 * 1024 * 1024;
6
+ export const readLocalFile = async (absolutePath) => {
7
+ try {
8
+ const stat = await fs.stat(absolutePath);
9
+ if (!stat.isFile() || stat.size > MAX_ANCHOR_FILE_BYTES)
10
+ return undefined;
11
+ return await fs.readFile(absolutePath, "utf8");
12
+ }
13
+ catch {
14
+ return undefined;
15
+ }
16
+ };
17
+ /**
18
+ * Where each find/replace edit of a finished tool call landed in its file, so
19
+ * its diff gets real line numbers. Read once, right after the tool ends: later
20
+ * edits move lines, and the diff should show where this edit happened. An edit
21
+ * whose new text is not found (deleted lines, a later rewrite) gets no anchor
22
+ * and renders as a plain +/- diff.
23
+ */
24
+ export async function computeLineAnchors(block, cwd, read = readLocalFile) {
25
+ if (block.status !== "done" || !isEditTool(block))
26
+ return undefined;
27
+ const edits = snippetEdits(block);
28
+ if (edits.length === 0)
29
+ return undefined;
30
+ const files = new Map();
31
+ const anchors = new Map();
32
+ for (const edit of edits) {
33
+ const file = path.resolve(cwd, edit.path);
34
+ if (!files.has(file))
35
+ files.set(file, read(file));
36
+ const text = await files.get(file);
37
+ const line = text === undefined ? undefined : findAnchor(text, edit.after);
38
+ if (line !== undefined)
39
+ anchors.set(anchorKey(edit), line);
40
+ }
41
+ return anchors.size > 0 ? anchors : undefined;
42
+ }
43
+ //# sourceMappingURL=diff-anchors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff-anchors.js","sourceRoot":"","sources":["../src/diff-anchors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAoB,MAAM,gBAAgB,CAAC;AAMnG,2DAA2D;AAC3D,MAAM,qBAAqB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9C,MAAM,CAAC,MAAM,aAAa,GAAe,KAAK,EAAE,YAAY,EAAE,EAAE;IAC9D,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,IAAI,CAAC,IAAI,GAAG,qBAAqB;YAAE,OAAO,SAAS,CAAC;QAC1E,OAAO,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,KAAgB,EAAE,GAAW,EAAE,OAAmB,aAAa;IACtG,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACpE,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IAClC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACzC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAuC,CAAC;IAC7D,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAClD,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACnC,MAAM,IAAI,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3E,IAAI,IAAI,KAAK,SAAS;YAAE,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AAChD,CAAC","sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { anchorKey, findAnchor, isEditTool, snippetEdits, type LineAnchors } from \"./tool-diff.js\";\nimport type { ToolBlock } from \"./transcript.js\";\n\n/** Reads a workspace file's text, or undefined when it cannot or should not be read. */\nexport type FileReader = (absolutePath: string) => Promise<string | undefined>;\n\n/** Files above this are not read just to number a diff. */\nconst MAX_ANCHOR_FILE_BYTES = 4 * 1024 * 1024;\n\nexport const readLocalFile: FileReader = async (absolutePath) => {\n try {\n const stat = await fs.stat(absolutePath);\n if (!stat.isFile() || stat.size > MAX_ANCHOR_FILE_BYTES) return undefined;\n return await fs.readFile(absolutePath, \"utf8\");\n } catch {\n return undefined;\n }\n};\n\n/**\n * Where each find/replace edit of a finished tool call landed in its file, so\n * its diff gets real line numbers. Read once, right after the tool ends: later\n * edits move lines, and the diff should show where this edit happened. An edit\n * whose new text is not found (deleted lines, a later rewrite) gets no anchor\n * and renders as a plain +/- diff.\n */\nexport async function computeLineAnchors(block: ToolBlock, cwd: string, read: FileReader = readLocalFile): Promise<LineAnchors | undefined> {\n if (block.status !== \"done\" || !isEditTool(block)) return undefined;\n const edits = snippetEdits(block);\n if (edits.length === 0) return undefined;\n const files = new Map<string, Promise<string | undefined>>();\n const anchors = new Map<string, number>();\n for (const edit of edits) {\n const file = path.resolve(cwd, edit.path);\n if (!files.has(file)) files.set(file, read(file));\n const text = await files.get(file);\n const line = text === undefined ? undefined : findAnchor(text, edit.after);\n if (line !== undefined) anchors.set(anchorKey(edit), line);\n }\n return anchors.size > 0 ? anchors : undefined;\n}\n"]}