@justanarthur/modo-ui-ai 0.0.0-stage → 0.2.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 (343) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSE.fluid-functionalism +21 -0
  3. package/README.md +105 -2
  4. package/blocks/conversation/agent-prompt/examples.mdx +44 -0
  5. package/blocks/conversation/agent-prompt/index.tsx +114 -0
  6. package/blocks/conversation/composer/draft.css +25 -0
  7. package/blocks/conversation/composer/draft.tsx +589 -0
  8. package/blocks/conversation/composer/examples.mdx +114 -0
  9. package/blocks/conversation/composer/file-preview-tile.tsx +59 -0
  10. package/blocks/conversation/composer/file-thumbnail.tsx +146 -0
  11. package/blocks/conversation/composer/index.tsx +517 -0
  12. package/blocks/conversation/composer/queued-row.tsx +102 -0
  13. package/blocks/conversation/composer/shared.ts +38 -0
  14. package/blocks/conversation/composer/suggestion-row.tsx +64 -0
  15. package/blocks/conversation/composer/use-composer-files.ts +142 -0
  16. package/blocks/conversation/composer/use-history-nav.ts +60 -0
  17. package/blocks/conversation/composer/use-message-queue.ts +108 -0
  18. package/blocks/conversation/composer/use-region-height.ts +34 -0
  19. package/blocks/conversation/failure-states/examples.mdx +58 -0
  20. package/blocks/conversation/failure-states/index.tsx +274 -0
  21. package/blocks/conversation/transcript/examples.mdx +43 -0
  22. package/blocks/conversation/transcript/index.tsx +204 -0
  23. package/blocks/conversation/transcript-search/examples.mdx +50 -0
  24. package/blocks/conversation/transcript-search/index.tsx +469 -0
  25. package/blocks/dialogs/command-palette/examples.mdx +33 -0
  26. package/blocks/dialogs/command-palette/index.tsx +232 -0
  27. package/blocks/dialogs/hook-dialog/examples.mdx +44 -0
  28. package/blocks/dialogs/hook-dialog/index.tsx +286 -0
  29. package/blocks/dialogs/mcp-server-dialog/examples.mdx +57 -0
  30. package/blocks/dialogs/mcp-server-dialog/index.tsx +415 -0
  31. package/blocks/dialogs/shortcuts-sheet/examples.mdx +36 -0
  32. package/blocks/dialogs/shortcuts-sheet/index.tsx +186 -0
  33. package/blocks/panes/artifacts-pane/examples.mdx +23 -0
  34. package/blocks/panes/artifacts-pane/index.tsx +82 -0
  35. package/blocks/panes/changes-pane/examples.mdx +23 -0
  36. package/blocks/panes/changes-pane/index.tsx +248 -0
  37. package/blocks/panes/file-pane/examples.mdx +13 -0
  38. package/blocks/panes/file-pane/index.tsx +102 -0
  39. package/blocks/panes/pr-pane/examples.mdx +13 -0
  40. package/blocks/panes/pr-pane/index.tsx +191 -0
  41. package/blocks/panes/side-pane/examples.mdx +58 -0
  42. package/blocks/panes/side-pane/index.tsx +187 -0
  43. package/blocks/panes/tasks-pane/examples.mdx +23 -0
  44. package/blocks/panes/tasks-pane/index.tsx +127 -0
  45. package/blocks/panes/terminal-pane/examples.mdx +13 -0
  46. package/blocks/panes/terminal-pane/index.tsx +99 -0
  47. package/blocks/panes/usage-pane/examples.mdx +13 -0
  48. package/blocks/panes/usage-pane/index.tsx +75 -0
  49. package/blocks/profiles/profile-onboarding/examples.mdx +80 -0
  50. package/blocks/profiles/profile-onboarding/index.tsx +580 -0
  51. package/blocks/profiles/profile-switcher/examples.mdx +18 -0
  52. package/blocks/profiles/profile-switcher/index.tsx +197 -0
  53. package/blocks/profiles/profile-usage/examples.mdx +21 -0
  54. package/blocks/profiles/profile-usage/index.tsx +127 -0
  55. package/blocks/sessions/inbox/examples.mdx +35 -0
  56. package/blocks/sessions/inbox/index.tsx +372 -0
  57. package/blocks/sessions/session-board/examples.mdx +34 -0
  58. package/blocks/sessions/session-board/index.tsx +570 -0
  59. package/blocks/sessions/session-sidebar/examples.mdx +43 -0
  60. package/blocks/sessions/session-sidebar/index.tsx +442 -0
  61. package/blocks/settings/extensions/examples.mdx +10 -0
  62. package/blocks/settings/extensions/index.tsx +72 -0
  63. package/blocks/settings/hooks/examples.mdx +16 -0
  64. package/blocks/settings/hooks/index.tsx +127 -0
  65. package/blocks/settings/mcp-servers/examples.mdx +26 -0
  66. package/blocks/settings/mcp-servers/index.tsx +204 -0
  67. package/blocks/settings/memory/examples.mdx +22 -0
  68. package/blocks/settings/memory/index.tsx +113 -0
  69. package/blocks/settings/notifications/examples.mdx +8 -0
  70. package/blocks/settings/notifications/index.tsx +63 -0
  71. package/blocks/settings/permission-rules/examples.mdx +37 -0
  72. package/blocks/settings/permission-rules/index.tsx +317 -0
  73. package/blocks/settings/plugin-catalog/examples.mdx +52 -0
  74. package/blocks/settings/plugin-catalog/index.tsx +407 -0
  75. package/blocks/settings/plugins/examples.mdx +10 -0
  76. package/blocks/settings/plugins/index.tsx +72 -0
  77. package/blocks/settings/settings-window/examples.mdx +40 -0
  78. package/blocks/settings/settings-window/index.tsx +188 -0
  79. package/blocks/settings/worktrees/examples.mdx +17 -0
  80. package/blocks/settings/worktrees/index.tsx +145 -0
  81. package/components/conversation/agent-run/examples.mdx +30 -0
  82. package/components/conversation/agent-run/index.tsx +82 -0
  83. package/components/conversation/chapter-nav/examples.mdx +30 -0
  84. package/components/conversation/chapter-nav/index.tsx +123 -0
  85. package/components/conversation/message/examples.mdx +53 -0
  86. package/components/conversation/message/index.tsx +128 -0
  87. package/components/conversation/message/working.tsx +102 -0
  88. package/components/conversation/reasoning/examples.mdx +22 -0
  89. package/components/conversation/reasoning/index.tsx +54 -0
  90. package/components/conversation/recap/examples.mdx +21 -0
  91. package/components/conversation/recap/index.tsx +67 -0
  92. package/components/conversation/todo-list/examples.mdx +32 -0
  93. package/components/conversation/todo-list/index.tsx +106 -0
  94. package/components/conversation/tool-call/examples.mdx +48 -0
  95. package/components/conversation/tool-call/index.tsx +142 -0
  96. package/components/conversation/work-summary/examples.mdx +50 -0
  97. package/components/conversation/work-summary/index.tsx +87 -0
  98. package/components/prompts/permission-request/examples.mdx +32 -0
  99. package/components/prompts/permission-request/index.tsx +74 -0
  100. package/components/prompts/plan-approval/examples.mdx +37 -0
  101. package/components/prompts/plan-approval/index.tsx +76 -0
  102. package/components/prompts/prompt-card/examples.mdx +31 -0
  103. package/components/prompts/prompt-card/index.tsx +82 -0
  104. package/components/prompts/question-prompt/examples.mdx +46 -0
  105. package/components/prompts/question-prompt/index.tsx +118 -0
  106. package/dist/blocks/conversation/agent-prompt/index.d.ts +7 -0
  107. package/dist/blocks/conversation/agent-prompt/index.js +13 -0
  108. package/dist/blocks/conversation/composer/index.d.ts +4 -0
  109. package/dist/blocks/conversation/composer/index.js +15 -0
  110. package/dist/blocks/conversation/failure-states/index.d.ts +4 -0
  111. package/dist/blocks/conversation/failure-states/index.js +8 -0
  112. package/dist/blocks/conversation/transcript/index.d.ts +50 -0
  113. package/dist/blocks/conversation/transcript/index.js +17 -0
  114. package/dist/blocks/conversation/transcript-search/index.d.ts +4 -0
  115. package/dist/blocks/conversation/transcript-search/index.js +11 -0
  116. package/dist/blocks/dialogs/command-palette/index.d.ts +5 -0
  117. package/dist/blocks/dialogs/command-palette/index.js +20 -0
  118. package/dist/blocks/dialogs/hook-dialog/index.d.ts +3 -0
  119. package/dist/blocks/dialogs/hook-dialog/index.js +12 -0
  120. package/dist/blocks/dialogs/mcp-server-dialog/index.d.ts +5 -0
  121. package/dist/blocks/dialogs/mcp-server-dialog/index.js +12 -0
  122. package/dist/blocks/dialogs/shortcuts-sheet/index.d.ts +2 -0
  123. package/dist/blocks/dialogs/shortcuts-sheet/index.js +11 -0
  124. package/dist/blocks/panes/artifacts-pane/index.d.ts +3 -0
  125. package/dist/blocks/panes/artifacts-pane/index.js +9 -0
  126. package/dist/blocks/panes/changes-pane/index.d.ts +3 -0
  127. package/dist/blocks/panes/changes-pane/index.js +9 -0
  128. package/dist/blocks/panes/file-pane/index.d.ts +3 -0
  129. package/dist/blocks/panes/file-pane/index.js +9 -0
  130. package/dist/blocks/panes/pr-pane/index.d.ts +3 -0
  131. package/dist/blocks/panes/pr-pane/index.js +10 -0
  132. package/dist/blocks/panes/side-pane/index.d.ts +5 -0
  133. package/dist/blocks/panes/side-pane/index.js +21 -0
  134. package/dist/blocks/panes/tasks-pane/index.d.ts +3 -0
  135. package/dist/blocks/panes/tasks-pane/index.js +10 -0
  136. package/dist/blocks/panes/terminal-pane/index.d.ts +3 -0
  137. package/dist/blocks/panes/terminal-pane/index.js +9 -0
  138. package/dist/blocks/panes/usage-pane/index.d.ts +4 -0
  139. package/dist/blocks/panes/usage-pane/index.js +11 -0
  140. package/dist/blocks/profiles/profile-onboarding/index.d.ts +4 -0
  141. package/dist/blocks/profiles/profile-onboarding/index.js +11 -0
  142. package/dist/blocks/profiles/profile-switcher/index.d.ts +4 -0
  143. package/dist/blocks/profiles/profile-switcher/index.js +11 -0
  144. package/dist/blocks/profiles/profile-usage/index.d.ts +4 -0
  145. package/dist/blocks/profiles/profile-usage/index.js +10 -0
  146. package/dist/blocks/sessions/inbox/index.d.ts +2 -0
  147. package/dist/blocks/sessions/inbox/index.js +11 -0
  148. package/dist/blocks/sessions/session-board/index.d.ts +4 -0
  149. package/dist/blocks/sessions/session-board/index.js +26 -0
  150. package/dist/blocks/sessions/session-sidebar/index.d.ts +5 -0
  151. package/dist/blocks/sessions/session-sidebar/index.js +15 -0
  152. package/dist/blocks/settings/extensions/index.d.ts +2 -0
  153. package/dist/blocks/settings/extensions/index.js +9 -0
  154. package/dist/blocks/settings/hooks/index.d.ts +4 -0
  155. package/dist/blocks/settings/hooks/index.js +9 -0
  156. package/dist/blocks/settings/mcp-servers/index.d.ts +4 -0
  157. package/dist/blocks/settings/mcp-servers/index.js +9 -0
  158. package/dist/blocks/settings/memory/index.d.ts +4 -0
  159. package/dist/blocks/settings/memory/index.js +8 -0
  160. package/dist/blocks/settings/notifications/index.d.ts +2 -0
  161. package/dist/blocks/settings/notifications/index.js +8 -0
  162. package/dist/blocks/settings/permission-rules/index.d.ts +3 -0
  163. package/dist/blocks/settings/permission-rules/index.js +10 -0
  164. package/dist/blocks/settings/plugin-catalog/index.d.ts +2 -0
  165. package/dist/blocks/settings/plugin-catalog/index.js +11 -0
  166. package/dist/blocks/settings/plugins/index.d.ts +4 -0
  167. package/dist/blocks/settings/plugins/index.js +9 -0
  168. package/dist/blocks/settings/settings-window/index.d.ts +4 -0
  169. package/dist/blocks/settings/settings-window/index.js +8 -0
  170. package/dist/blocks/settings/worktrees/index.d.ts +4 -0
  171. package/dist/blocks/settings/worktrees/index.js +9 -0
  172. package/dist/components/conversation/agent-run/index.d.ts +3 -0
  173. package/dist/components/conversation/agent-run/index.js +10 -0
  174. package/dist/components/conversation/chapter-nav/index.d.ts +2 -0
  175. package/dist/components/conversation/chapter-nav/index.js +11 -0
  176. package/dist/components/conversation/message/index.d.ts +2 -0
  177. package/dist/components/conversation/message/index.js +15 -0
  178. package/dist/components/conversation/reasoning/index.d.ts +2 -0
  179. package/dist/components/conversation/reasoning/index.js +8 -0
  180. package/dist/components/conversation/recap/index.d.ts +2 -0
  181. package/dist/components/conversation/recap/index.js +9 -0
  182. package/dist/components/conversation/todo-list/index.d.ts +2 -0
  183. package/dist/components/conversation/todo-list/index.js +9 -0
  184. package/dist/components/conversation/tool-call/index.d.ts +3 -0
  185. package/dist/components/conversation/tool-call/index.js +13 -0
  186. package/dist/components/conversation/work-summary/index.d.ts +2 -0
  187. package/dist/components/conversation/work-summary/index.js +10 -0
  188. package/dist/components/prompts/permission-request/index.d.ts +2 -0
  189. package/dist/components/prompts/permission-request/index.js +9 -0
  190. package/dist/components/prompts/plan-approval/index.d.ts +2 -0
  191. package/dist/components/prompts/plan-approval/index.js +9 -0
  192. package/dist/components/prompts/prompt-card/index.d.ts +3 -0
  193. package/dist/components/prompts/prompt-card/index.js +8 -0
  194. package/dist/components/prompts/question-prompt/index.d.ts +2 -0
  195. package/dist/components/prompts/question-prompt/index.js +9 -0
  196. package/dist/index.d.ts +50 -0
  197. package/dist/index.js +231 -0
  198. package/dist/lib/config-parts.d.ts +2 -0
  199. package/dist/lib/config-parts.js +16 -0
  200. package/dist/lib/icons.d.ts +2 -0
  201. package/dist/lib/icons.js +10 -0
  202. package/dist/lib/pace-bar.d.ts +11 -0
  203. package/dist/lib/pace-bar.js +6 -0
  204. package/dist/lib/pace.d.ts +4 -0
  205. package/dist/lib/pace.js +12 -0
  206. package/dist/lib/pane-parts.d.ts +25 -0
  207. package/dist/lib/pane-parts.js +11 -0
  208. package/dist/lib/row-trigger.d.ts +5 -0
  209. package/dist/lib/row-trigger.js +7 -0
  210. package/dist/lib/settings-parts.d.ts +70 -0
  211. package/dist/lib/settings-parts.js +24 -0
  212. package/dist/lib/side-pane-types.d.ts +2 -0
  213. package/dist/lib/side-pane-types.js +1 -0
  214. package/dist/lib/status-glyph.d.ts +8 -0
  215. package/dist/lib/status-glyph.js +12 -0
  216. package/dist/lib/types.d.ts +3 -0
  217. package/dist/lib/types.js +1 -0
  218. package/dist/shared/chunk-04a497rr.js +21 -0
  219. package/dist/shared/chunk-13yf0mza.d.ts +70 -0
  220. package/dist/shared/chunk-1aq2xzv5.js +558 -0
  221. package/dist/shared/chunk-1f96cz69.js +45 -0
  222. package/dist/shared/chunk-1yt061np.d.ts +64 -0
  223. package/dist/shared/chunk-218qabm5.js +250 -0
  224. package/dist/shared/chunk-2fk5aq60.js +313 -0
  225. package/dist/shared/chunk-4248zvmh.js +177 -0
  226. package/dist/shared/chunk-45rqgey6.d.ts +25 -0
  227. package/dist/shared/chunk-4n0v64qx.js +179 -0
  228. package/dist/shared/chunk-4zvhpf2x.js +55 -0
  229. package/dist/shared/chunk-57hzzmjd.d.ts +67 -0
  230. package/dist/shared/chunk-58qvny6a.d.ts +29 -0
  231. package/dist/shared/chunk-5fhkkn39.js +130 -0
  232. package/dist/shared/chunk-5hw0525a.d.ts +33 -0
  233. package/dist/shared/chunk-5k6xwqfj.d.ts +68 -0
  234. package/dist/shared/chunk-5meda998.js +238 -0
  235. package/dist/shared/chunk-5pqksw7z.js +91 -0
  236. package/dist/shared/chunk-6220dy5n.js +70 -0
  237. package/dist/shared/chunk-64bnh22t.d.ts +59 -0
  238. package/dist/shared/chunk-66sh633m.d.ts +60 -0
  239. package/dist/shared/chunk-6cmf27g3.d.ts +81 -0
  240. package/dist/shared/chunk-6g4970a6.d.ts +20 -0
  241. package/dist/shared/chunk-75zwypyr.d.ts +43 -0
  242. package/dist/shared/chunk-7rzjmcnh.d.ts +30 -0
  243. package/dist/shared/chunk-7zvb39cf.d.ts +26 -0
  244. package/dist/shared/chunk-8mecznyr.js +357 -0
  245. package/dist/shared/chunk-8pag6vmd.js +255 -0
  246. package/dist/shared/chunk-8xg5gwwy.js +38 -0
  247. package/dist/shared/chunk-9kw6m047.d.ts +32 -0
  248. package/dist/shared/chunk-a4s440b6.js +79 -0
  249. package/dist/shared/chunk-at0jje23.d.ts +110 -0
  250. package/dist/shared/chunk-awd573h9.js +34 -0
  251. package/dist/shared/chunk-b171wjge.d.ts +25 -0
  252. package/dist/shared/chunk-bh2b5d1z.js +98 -0
  253. package/dist/shared/chunk-bzs6amnv.js +187 -0
  254. package/dist/shared/chunk-c36qvrwq.d.ts +30 -0
  255. package/dist/shared/chunk-c8wp058j.js +153 -0
  256. package/dist/shared/chunk-cd4f87as.d.ts +28 -0
  257. package/dist/shared/chunk-cmwby8f9.js +467 -0
  258. package/dist/shared/chunk-d2t72h4x.d.ts +35 -0
  259. package/dist/shared/chunk-dh3qy5fj.js +49 -0
  260. package/dist/shared/chunk-e46apgve.d.ts +40 -0
  261. package/dist/shared/chunk-ejtknc0w.js +21 -0
  262. package/dist/shared/chunk-eqajdxn8.js +82 -0
  263. package/dist/shared/chunk-fbn0h7cr.js +123 -0
  264. package/dist/shared/chunk-fqhcz6ss.d.ts +29 -0
  265. package/dist/shared/chunk-g28hweee.d.ts +35 -0
  266. package/dist/shared/chunk-g88hweqh.d.ts +70 -0
  267. package/dist/shared/chunk-gewnsgza.js +61 -0
  268. package/dist/shared/chunk-gkyk663q.d.ts +53 -0
  269. package/dist/shared/chunk-hd4gtj5z.d.ts +23 -0
  270. package/dist/shared/chunk-hxjgey30.d.ts +36 -0
  271. package/dist/shared/chunk-jkkdq1mh.d.ts +213 -0
  272. package/dist/shared/chunk-jpq101w3.js +91 -0
  273. package/dist/shared/chunk-k3bv9k1v.d.ts +56 -0
  274. package/dist/shared/chunk-k5zegxje.d.ts +81 -0
  275. package/dist/shared/chunk-kreypnzp.d.ts +34 -0
  276. package/dist/shared/chunk-kw9npka5.js +224 -0
  277. package/dist/shared/chunk-mrb3fp2f.d.ts +30 -0
  278. package/dist/shared/chunk-n1qq2wp9.js +6 -0
  279. package/dist/shared/chunk-n4742y54.js +39 -0
  280. package/dist/shared/chunk-ndjvdkv7.d.ts +29 -0
  281. package/dist/shared/chunk-nk4578dr.js +73 -0
  282. package/dist/shared/chunk-paezqfg1.js +106 -0
  283. package/dist/shared/chunk-qemm9e3r.d.ts +21 -0
  284. package/dist/shared/chunk-qhxz1etk.js +96 -0
  285. package/dist/shared/chunk-qj5ev9ak.js +531 -0
  286. package/dist/shared/chunk-qnwggvjy.js +150 -0
  287. package/dist/shared/chunk-r5hz78pb.js +129 -0
  288. package/dist/shared/chunk-r6nb21kz.d.ts +102 -0
  289. package/dist/shared/chunk-rjfwje37.d.ts +234 -0
  290. package/dist/shared/chunk-rqrpvvz4.d.ts +107 -0
  291. package/dist/shared/chunk-rzajcn44.d.ts +49 -0
  292. package/dist/shared/chunk-s3r759ec.js +80 -0
  293. package/dist/shared/chunk-sdtjrw9w.d.ts +98 -0
  294. package/dist/shared/chunk-sfqvyzcs.d.ts +68 -0
  295. package/dist/shared/chunk-skg3m9m0.js +56 -0
  296. package/dist/shared/chunk-szkvrqg1.d.ts +54 -0
  297. package/dist/shared/chunk-t21t9x7e.js +188 -0
  298. package/dist/shared/chunk-tc75ng2c.js +235 -0
  299. package/dist/shared/chunk-tkx1krwc.js +88 -0
  300. package/dist/shared/chunk-tprdqtb1.d.ts +30 -0
  301. package/dist/shared/chunk-tv9a1sek.js +137 -0
  302. package/dist/shared/chunk-tvbd27hg.d.ts +43 -0
  303. package/dist/shared/chunk-v6yevw62.d.ts +28 -0
  304. package/dist/shared/chunk-v9q38p0x.js +258 -0
  305. package/dist/shared/chunk-vd59gzzd.js +86 -0
  306. package/dist/shared/chunk-vgh4f3sv.js +118 -0
  307. package/dist/shared/chunk-vjht1zn1.js +391 -0
  308. package/dist/shared/chunk-vsrkb0sp.d.ts +21 -0
  309. package/dist/shared/chunk-w5z8qnf8.js +175 -0
  310. package/dist/shared/chunk-wgvzavx1.js +1488 -0
  311. package/dist/shared/chunk-whsx7yp9.d.ts +37 -0
  312. package/dist/shared/chunk-x7az5x1y.d.ts +57 -0
  313. package/dist/shared/chunk-x9jf26yb.js +318 -0
  314. package/dist/shared/chunk-xbrrt07s.d.ts +23 -0
  315. package/dist/shared/chunk-xkchhs2z.js +129 -0
  316. package/dist/shared/chunk-xzfrskd7.js +202 -0
  317. package/dist/shared/chunk-y4cj4y54.js +423 -0
  318. package/dist/shared/chunk-y934at6m.js +7 -0
  319. package/dist/shared/chunk-zbpwhpjy.d.ts +75 -0
  320. package/dist/shared/chunk-zfhmbb7n.js +63 -0
  321. package/dist/shared/chunk-zk0t4vq5.js +71 -0
  322. package/dist/shared/chunk-znp9gna7.d.ts +23 -0
  323. package/dist/styles.css +467 -0
  324. package/index.ts +49 -0
  325. package/lib/config-parts.tsx +97 -0
  326. package/lib/icons.tsx +149 -0
  327. package/lib/pace-bar.tsx +24 -0
  328. package/lib/pace.ts +74 -0
  329. package/lib/pane-parts.tsx +76 -0
  330. package/lib/row-trigger.tsx +44 -0
  331. package/lib/settings-parts.tsx +232 -0
  332. package/lib/side-pane-types.ts +75 -0
  333. package/lib/status-glyph.tsx +25 -0
  334. package/lib/types.ts +204 -0
  335. package/mock/demo-reply.tsx +33 -0
  336. package/mock/demo-session.tsx +150 -0
  337. package/mock/mock-config.ts +173 -0
  338. package/mock/mock-extras.ts +288 -0
  339. package/mock/mock-panes.ts +190 -0
  340. package/mock/mock-settings.ts +92 -0
  341. package/mock/mock.ts +548 -0
  342. package/mock/screen-frame.tsx +49 -0
  343. package/package.json +114 -4
@@ -0,0 +1,442 @@
1
+ /*!
2
+ * Local addition: the AI app's sessions sidebar, composed on Sidebar
3
+ * the way the SidebarApp block is: the profile switcher, a "New session" row
4
+ * and search in the header; pinned sessions, project groups and the user's
5
+ * own sections, an archive; and a settings row in the footer. A session row
6
+ * shows its run state (running, needs input, unread, idle), its last activity
7
+ * and, on hover, pin, archive and a row menu with "Open in split view".
8
+ * Linked child sessions fold under their parent. On the overview the list
9
+ * gives way to filters for its board (state, project, profile).
10
+ */
11
+
12
+ 'use client'
13
+
14
+ import { SidebarSearchField } from '@justanarthur/modo-ui/blocks/sidebar-app'
15
+ import Kbd from '@justanarthur/modo-ui/components/data-display/kbd'
16
+ import Sidebar from '@justanarthur/modo-ui/components/navigation/sidebar'
17
+ import {
18
+ DropdownContent,
19
+ DropdownMenu,
20
+ DropdownTrigger,
21
+ MenuItem,
22
+ } from '@justanarthur/modo-ui/components/overlays/dropdown'
23
+ import Tooltip from '@justanarthur/modo-ui/components/overlays/tooltip'
24
+ import Sortable, { useSortableHandle } from '@justanarthur/modo-ui/primitives/layout/sortable'
25
+ import { useMemo } from 'react'
26
+ import { type IconComponent, useIcon } from '../../../lib/icons'
27
+ import { STATUS_GLYPH, STATUS_LABEL } from '../../../lib/status-glyph'
28
+ import type { Profile, Session, SessionGroup, SessionStatus } from '../../../lib/types'
29
+ import { ProfileTile } from '../../profiles/profile-switcher'
30
+ import ProfileUsage from '../../profiles/profile-usage'
31
+ import Inbox, { type InboxAction, type InboxItem } from '../inbox'
32
+ import type { SessionFilter } from '../session-board'
33
+
34
+ const STATES: { status: SessionStatus; label: string }[] = [
35
+ { status: 'waiting', label: 'Needs you' },
36
+ { status: 'running', label: 'Running' },
37
+ { status: 'unread', label: 'To review' },
38
+ { status: 'idle', label: 'Idle' },
39
+ ]
40
+
41
+ /** Every live session, children included, with the project it belongs to. */
42
+ function everySession(pinned: Session[], groups: SessionGroup[]) {
43
+ const withChildren = (s: Session, project?: string) =>
44
+ [s, ...(s.children ?? [])].map(c => ({ ...c, project: s.project ?? project }))
45
+ return [
46
+ ...pinned.flatMap(s => withChildren(s)),
47
+ ...groups.flatMap(g => g.sessions.flatMap(s => withChildren(s, g.label))),
48
+ ]
49
+ }
50
+
51
+ /** A pinned row's grip: drag it, or focus it and press Space, to move the row among the pinned. */
52
+ function ReorderAction() {
53
+ const Grip = useIcon('grip-vertical')
54
+ const handle = useSortableHandle()
55
+ return (
56
+ <Sidebar.MenuAction {...handle} className="cursor-grab touch-none active:cursor-grabbing">
57
+ <Grip />
58
+ </Sidebar.MenuAction>
59
+ )
60
+ }
61
+
62
+ interface SessionRowProps {
63
+ session: Session
64
+ /** Inside the pinned Sortable: the actions lead with a grip. */
65
+ reorder?: boolean
66
+ onOpenSplit?: (id: string) => void
67
+ }
68
+
69
+ function SessionRow({ session, reorder, onOpenSplit }: SessionRowProps) {
70
+ const Pin = useIcon('pin')
71
+ const Archive = useIcon('archive')
72
+ const More = useIcon('more-vertical')
73
+ const Pencil = useIcon('pencil')
74
+ const Columns = useIcon('columns-2')
75
+ const Dot = useIcon('circle-dot')
76
+ const Branch = useIcon('git-branch')
77
+ const glyph = STATUS_GLYPH[session.status]
78
+ const children = session.children ?? []
79
+
80
+ return (
81
+ <Sidebar.MenuItem
82
+ collapsible={children.length > 0 ? true : undefined}
83
+ defaultOpen={children.length > 0 ? true : undefined}
84
+ >
85
+ <Sidebar.MenuButton
86
+ value={session.id}
87
+ icon={glyph}
88
+ status={glyph ? undefined : session.status === 'unread' ? 'unread' : 'idle'}
89
+ title={`${session.title} · ${STATUS_LABEL[session.status]} · ${session.profile}`}
90
+ >
91
+ <span className="truncate">{session.title}</span>
92
+ </Sidebar.MenuButton>
93
+ <Sidebar.MenuBadge>{session.updated}</Sidebar.MenuBadge>
94
+ <Sidebar.MenuActions showOnHover>
95
+ {/* Filtered: the cluster sizes the row's gutter by its child count, nulls included. A pinned row trades Archive (in its menu) for the grip. */}
96
+ {[
97
+ reorder && <ReorderAction key="reorder" />,
98
+ <Tooltip key="pin" content={session.pinned ? 'Unpin' : 'Pin'} side="top">
99
+ <Sidebar.MenuAction aria-label={session.pinned ? 'Unpin' : 'Pin'}>
100
+ <Pin />
101
+ </Sidebar.MenuAction>
102
+ </Tooltip>,
103
+ !reorder && (
104
+ <Tooltip key="archive" content="Archive" side="top">
105
+ <Sidebar.MenuAction aria-label="Archive">
106
+ <Archive />
107
+ </Sidebar.MenuAction>
108
+ </Tooltip>
109
+ ),
110
+ <DropdownMenu key="more">
111
+ <DropdownTrigger
112
+ render={
113
+ <Sidebar.MenuAction aria-label="More options">
114
+ <More />
115
+ </Sidebar.MenuAction>
116
+ }
117
+ />
118
+ <DropdownContent className="w-[240px] min-w-0" align="start" sideOffset={4}>
119
+ <MenuItem
120
+ index={0}
121
+ icon={Columns}
122
+ label="Open in split view"
123
+ onSelect={() => onOpenSplit?.(session.id)}
124
+ />
125
+ <MenuItem index={1} icon={Pencil} label="Rename" />
126
+ <MenuItem index={2} icon={Dot} label="Mark as unread" />
127
+ <MenuItem index={3} icon={Branch} label="Fork into a new session" />
128
+ {reorder && <MenuItem index={4} icon={Archive} label="Archive" />}
129
+ </DropdownContent>
130
+ </DropdownMenu>,
131
+ ].filter(Boolean)}
132
+ </Sidebar.MenuActions>
133
+ {children.length > 0 && (
134
+ <Sidebar.MenuSub>
135
+ {children.map(child => (
136
+ <Sidebar.MenuSubItem key={child.id}>
137
+ <Sidebar.MenuSubButton value={child.id} icon={STATUS_GLYPH[child.status] ?? Branch}>
138
+ {child.title}
139
+ </Sidebar.MenuSubButton>
140
+ </Sidebar.MenuSubItem>
141
+ ))}
142
+ </Sidebar.MenuSub>
143
+ )}
144
+ </Sidebar.MenuItem>
145
+ )
146
+ }
147
+
148
+ /** The overview's job for the list: narrow the board to one state, project or profile, with counts. */
149
+ function SessionFilters({
150
+ pinned,
151
+ groups,
152
+ profiles,
153
+ }: {
154
+ pinned: Session[]
155
+ groups: SessionGroup[]
156
+ profiles: Profile[]
157
+ }) {
158
+ const Folder = useIcon('folder')
159
+ const all = everySession(pinned, groups)
160
+ const count = (match: (s: Session) => boolean) => all.filter(match).length
161
+ const projects = groups.filter(g => g.kind === 'project')
162
+ const used = profiles.filter(p => all.some(s => s.profile === p.id))
163
+ // Built once per profile list: a component made during render would remount its row's icon every time.
164
+ const icons = useMemo(
165
+ () =>
166
+ Object.fromEntries(
167
+ profiles.map(profile => [profile.id, (() => <ProfileTile profile={profile} size="sm" />) as IconComponent]),
168
+ ),
169
+ [profiles],
170
+ )
171
+
172
+ return (
173
+ <>
174
+ <Sidebar.Group>
175
+ <Sidebar.GroupLabel>State</Sidebar.GroupLabel>
176
+ <Sidebar.Menu>
177
+ {STATES.map(({ status, label }) => (
178
+ <Sidebar.MenuItem key={status}>
179
+ <Sidebar.MenuButton
180
+ value={`state:${status}` satisfies SessionFilter}
181
+ icon={STATUS_GLYPH[status]}
182
+ status={STATUS_GLYPH[status] ? undefined : status === 'unread' ? 'unread' : 'idle'}
183
+ >
184
+ {label}
185
+ </Sidebar.MenuButton>
186
+ <Sidebar.MenuBadge>{count(s => s.status === status)}</Sidebar.MenuBadge>
187
+ </Sidebar.MenuItem>
188
+ ))}
189
+ </Sidebar.Menu>
190
+ </Sidebar.Group>
191
+
192
+ <Sidebar.Group>
193
+ <Sidebar.GroupLabel>Projects</Sidebar.GroupLabel>
194
+ <Sidebar.Menu>
195
+ {projects.map(({ label }) => (
196
+ <Sidebar.MenuItem key={label}>
197
+ <Sidebar.MenuButton value={`project:${label}` satisfies SessionFilter} icon={Folder}>
198
+ {label}
199
+ </Sidebar.MenuButton>
200
+ <Sidebar.MenuBadge>{count(s => s.project === label)}</Sidebar.MenuBadge>
201
+ </Sidebar.MenuItem>
202
+ ))}
203
+ </Sidebar.Menu>
204
+ </Sidebar.Group>
205
+
206
+ <Sidebar.Group>
207
+ <Sidebar.GroupLabel>Profiles</Sidebar.GroupLabel>
208
+ <Sidebar.Menu>
209
+ {used.map(profile => (
210
+ <Sidebar.MenuItem key={profile.id}>
211
+ <Sidebar.MenuButton value={`profile:${profile.id}` satisfies SessionFilter} icon={icons[profile.id]}>
212
+ {profile.name}
213
+ </Sidebar.MenuButton>
214
+ <Sidebar.MenuBadge>{count(s => s.profile === profile.id)}</Sidebar.MenuBadge>
215
+ </Sidebar.MenuItem>
216
+ ))}
217
+ </Sidebar.Menu>
218
+ </Sidebar.Group>
219
+ </>
220
+ )
221
+ }
222
+
223
+ interface SessionSidebarProps {
224
+ /** Pinned sessions, above every group, in the order you dragged them into. */
225
+ pinned: Session[]
226
+ /** Called with the pinned sessions' ids after one is dragged to a new place. */
227
+ onPinnedOrderChange?: (ids: string[]) => void
228
+ /** Project folders and the user's own sections, in order. */
229
+ groups: SessionGroup[]
230
+ /** Archived sessions, folded at the bottom. */
231
+ archived: Session[]
232
+ /** The profiles the sessions run under, for the footer's usage and the profile filters. */
233
+ profiles: Profile[]
234
+ /** What the content lists: the sessions, or (on the overview, whose board is that list widened) filters for the board by state, project and profile, with counts. Defaults to `'sessions'`. */
235
+ list?: 'sessions' | 'filters'
236
+ /** Controlled selected session id. Pair with `onValueChange`. */
237
+ value?: string
238
+ /** Initial selected session id, for an uncontrolled sidebar. */
239
+ defaultValue?: string
240
+ /** Called with the session id when a row is picked. */
241
+ onValueChange?: (value: string) => void
242
+ /** Called when a row's menu asks to open its session in split view. */
243
+ onOpenSplit?: (id: string) => void
244
+ /** What needs you across sessions: a header row opens them, with the unread count. Omit for no inbox row. */
245
+ inbox?: InboxItem[]
246
+ /** Called when an inbox row is answered or opened. */
247
+ onInboxAction?: (item: InboxItem, action: InboxAction) => void
248
+ /** Called when the search field is clicked or Enter is pressed in it: open your ⌘K palette. Omit to keep it a plain field. */
249
+ onSearch?: () => void
250
+ /** Called by the footer's settings row. */
251
+ onOpenSettings?: () => void
252
+ /** The sidebar's layout (see Sidebar). Defaults to `'inset'`. */
253
+ variant?: 'sidebar' | 'floating' | 'inset'
254
+ /** Classes for the sidebar. */
255
+ className?: string
256
+ }
257
+
258
+ /**
259
+ * The AI app's sessions rail: every session of every profile,
260
+ * grouped by project, with what each one is doing right now.
261
+ *
262
+ * Sessions of every profile sit side by side, so there is no profile to
263
+ * switch: the header opens the overview of every session (see the session
264
+ * board), starts a new session and searches, and the footer shows how much
265
+ * each profile has left (see the profile usage). Below it come the pinned sessions, which you
266
+ * reorder by a row's grip (drag it, or focus it, press Space and use the
267
+ * arrows), then one group
268
+ * per project folder and per section you made, then the archive, folded.
269
+ * A row's leading glyph is its state: an arc turning while it runs, an
270
+ * amber dot while it waits for you, a filled dot for an unread reply and a
271
+ * ring when idle; its badge is the last activity. Hover a row for pin,
272
+ * archive and a menu that opens the session in split view, renames it or
273
+ * forks it. Sessions started from another one fold under it as linked
274
+ * children. Pick a row and the active background melts over to it.
275
+ *
276
+ * On the overview, whose board is the session list widened, `list="filters"`
277
+ * trades the list for filters: by state, project and profile, each with its
278
+ * count; a row's `value` (`'state:waiting'`, `'project:modo'`,
279
+ * `'profile:work'`) is the board's `filter`.
280
+ *
281
+ * Put it inside a `Sidebar.Provider`, next to the `Sidebar.Inset` that holds
282
+ * the session.
283
+ *
284
+ * @example {@include ./examples.mdx}
285
+ */
286
+ export default function SessionSidebar({
287
+ pinned,
288
+ groups,
289
+ archived,
290
+ profiles,
291
+ onPinnedOrderChange,
292
+ list = 'sessions',
293
+ value,
294
+ defaultValue,
295
+ onValueChange,
296
+ onOpenSplit,
297
+ onOpenSettings,
298
+ inbox,
299
+ onInboxAction,
300
+ onSearch,
301
+ variant = 'inset',
302
+ className,
303
+ }: SessionSidebarProps) {
304
+ const Plus = useIcon('plus')
305
+ const Board = useIcon('layout-dashboard')
306
+ const Settings = useIcon('settings')
307
+ const Filter = useIcon('sliders-horizontal')
308
+ const Bell = useIcon('bell')
309
+ const unread = inbox?.filter(item => !item.read).length ?? 0
310
+ const waiting = everySession(pinned, groups).filter(s => s.status === 'waiting').length
311
+
312
+ return (
313
+ <Sidebar
314
+ variant={variant}
315
+ className={className}
316
+ value={value}
317
+ defaultValue={value === undefined ? defaultValue : undefined}
318
+ onValueChange={onValueChange}
319
+ >
320
+ <Sidebar.Header>
321
+ <div className="flex flex-col gap-0.5">
322
+ <Sidebar.Menu>
323
+ <Sidebar.MenuItem>
324
+ <Sidebar.MenuButton icon={Board} value="overview">
325
+ Overview
326
+ <span className="ml-auto text-micro tabular-nums text-muted-foreground">{waiting} need you</span>
327
+ </Sidebar.MenuButton>
328
+ </Sidebar.MenuItem>
329
+ {inbox && (
330
+ <Sidebar.MenuItem>
331
+ <Inbox
332
+ items={inbox}
333
+ onAction={onInboxAction}
334
+ side="right"
335
+ align="start"
336
+ trigger={
337
+ <Sidebar.MenuButton icon={Bell} aria-label={unread > 0 ? `Inbox, ${unread} unread` : 'Inbox'}>
338
+ Inbox
339
+ </Sidebar.MenuButton>
340
+ }
341
+ />
342
+ {unread > 0 && <Sidebar.MenuBadge>{unread}</Sidebar.MenuBadge>}
343
+ </Sidebar.MenuItem>
344
+ )}
345
+ <Sidebar.MenuItem>
346
+ <Sidebar.MenuButton icon={Plus} value="new">
347
+ New session
348
+ <Kbd variant="plain" className="ml-auto">
349
+ ⌘N
350
+ </Kbd>
351
+ </Sidebar.MenuButton>
352
+ </Sidebar.MenuItem>
353
+ </Sidebar.Menu>
354
+ <SidebarSearchField
355
+ placeholder="Search sessions"
356
+ {...(onSearch && {
357
+ readOnly: true,
358
+ onClick: onSearch,
359
+ onKeyDown: e => {
360
+ if (e.key === 'Enter') onSearch()
361
+ },
362
+ })}
363
+ />
364
+ </div>
365
+ </Sidebar.Header>
366
+
367
+ {/* No hairline at the scroll edges: the fade alone says the list goes on. */}
368
+ <Sidebar.Content className="before:!content-none after:!content-none">
369
+ {list === 'filters' && <SessionFilters pinned={pinned} groups={groups} profiles={profiles} />}
370
+ {list === 'sessions' && (
371
+ <>
372
+ <Sidebar.Group collapsible>
373
+ <Sidebar.GroupLabel>Pinned</Sidebar.GroupLabel>
374
+ <Sidebar.Menu>
375
+ <Sortable
376
+ as="none"
377
+ handle
378
+ items={pinned.map(session => ({
379
+ id: session.id,
380
+ label: session.title,
381
+ content: <SessionRow session={session} reorder onOpenSplit={onOpenSplit} />,
382
+ }))}
383
+ onOrderChange={onPinnedOrderChange}
384
+ />
385
+ </Sidebar.Menu>
386
+ </Sidebar.Group>
387
+
388
+ {groups.map(group => (
389
+ <Sidebar.Group key={group.label} collapsible>
390
+ <Sidebar.GroupLabel>{group.label}</Sidebar.GroupLabel>
391
+ <Sidebar.GroupActions>
392
+ <Tooltip content={group.kind === 'project' ? `New session in ${group.label}` : 'Filter'} side="top">
393
+ <Sidebar.GroupAction
394
+ aria-label={group.kind === 'project' ? `New session in ${group.label}` : 'Filter'}
395
+ >
396
+ {group.kind === 'project' ? <Plus /> : <Filter />}
397
+ </Sidebar.GroupAction>
398
+ </Tooltip>
399
+ </Sidebar.GroupActions>
400
+ <Sidebar.Menu>
401
+ {group.sessions.map(session => (
402
+ <SessionRow key={session.id} session={session} onOpenSplit={onOpenSplit} />
403
+ ))}
404
+ </Sidebar.Menu>
405
+ </Sidebar.Group>
406
+ ))}
407
+
408
+ <Sidebar.Group collapsible defaultOpen={false}>
409
+ <Sidebar.GroupLabel>Archived</Sidebar.GroupLabel>
410
+ <Sidebar.Menu>
411
+ {archived.map(session => (
412
+ <SessionRow key={session.id} session={session} onOpenSplit={onOpenSplit} />
413
+ ))}
414
+ </Sidebar.Menu>
415
+ </Sidebar.Group>
416
+ </>
417
+ )}
418
+ </Sidebar.Content>
419
+
420
+ <Sidebar.Footer>
421
+ <Sidebar.Group collapsible>
422
+ <Sidebar.GroupLabel>Usage</Sidebar.GroupLabel>
423
+ <ProfileUsage profiles={profiles} onManage={onOpenSettings} />
424
+ </Sidebar.Group>
425
+ <Sidebar.Menu>
426
+ <Sidebar.MenuItem>
427
+ <Sidebar.MenuButton icon={Settings} onClick={onOpenSettings}>
428
+ Settings
429
+ <Kbd variant="plain" className="ml-auto">
430
+ ⌘,
431
+ </Kbd>
432
+ </Sidebar.MenuButton>
433
+ </Sidebar.MenuItem>
434
+ </Sidebar.Menu>
435
+ </Sidebar.Footer>
436
+ </Sidebar>
437
+ )
438
+ }
439
+
440
+ export type { SessionSidebarProps }
441
+
442
+ export { SessionSidebar }
@@ -0,0 +1,10 @@
1
+ import Extensions from './index'
2
+ import { EXTENSIONS } from '../../../mock/mock-settings'
3
+
4
+ # Extensions
5
+
6
+ Your own features, built as MCP servers, plugins, skills and hooks.
7
+
8
+ <div className="@container w-full max-w-3xl">
9
+ <Extensions extensions={EXTENSIONS} />
10
+ </div>
@@ -0,0 +1,72 @@
1
+ /*!
2
+ * Local addition: the settings screen's extensions section — your own
3
+ * panes, commands, actions and hooks, each a switch.
4
+ */
5
+
6
+ 'use client'
7
+
8
+ import Button from '@justanarthur/modo-ui/components/actions/button'
9
+ import Switch from '@justanarthur/modo-ui/components/inputs/switch'
10
+ import { useIcon } from '../../../lib/icons'
11
+ import { Group, Section, Toggles } from '../../../lib/settings-parts'
12
+
13
+ export interface Extension {
14
+ name: string
15
+ /** What it adds: a pane, a command, an action, a hook. */
16
+ kind: string
17
+ /** What it is built as and ships in: an MCP server, a plugin, a settings file. */
18
+ source: string
19
+ description: string
20
+ enabled: boolean
21
+ }
22
+
23
+ interface ExtensionsProps {
24
+ /** The installed extensions. */
25
+ extensions: Extension[]
26
+ /** Called when "New extension" is pressed. */
27
+ onNew?: () => void
28
+ /** Called when an extension's switch flips, with its new state. */
29
+ onToggle?: (extension: Extension, enabled: boolean) => void
30
+ }
31
+
32
+ /**
33
+ * Your own features in the app: panes, commands, actions and hooks.
34
+ *
35
+ * They are built as MCP servers, plugins, skills and hooks, so they work in
36
+ * the CLI too. Each is a switch whose description says what kind it is, what
37
+ * it does and where it comes from.
38
+ *
39
+ * @example {@include ./examples.mdx}
40
+ */
41
+ export default function Extensions({ extensions, onNew, onToggle }: ExtensionsProps) {
42
+ const Plus = useIcon('plus')
43
+ return (
44
+ <Section
45
+ title="Extensions"
46
+ lead="Your own features: panes, commands, actions and hooks, built as MCP servers, plugins, skills and hooks, so they work in the CLI too."
47
+ actions={
48
+ <Button size="compact" leadingIcon={Plus} onClick={onNew}>
49
+ New extension
50
+ </Button>
51
+ }
52
+ >
53
+ <Group title="Installed" aside={<span className="tabular-nums">{extensions.length}</span>}>
54
+ <Toggles label="Extensions">
55
+ {extensions.map(extension => (
56
+ <Switch
57
+ key={extension.name}
58
+ label={extension.name}
59
+ description={`${extension.kind} · ${extension.description} · from ${extension.source}`}
60
+ defaultChecked={extension.enabled}
61
+ onCheckedChange={enabled => onToggle?.(extension, enabled)}
62
+ />
63
+ ))}
64
+ </Toggles>
65
+ </Group>
66
+ </Section>
67
+ )
68
+ }
69
+
70
+ export type { ExtensionsProps }
71
+
72
+ export { Extensions }
@@ -0,0 +1,16 @@
1
+ import Hooks from './index'
2
+ import { HOOKS } from '../../../mock/mock'
3
+
4
+ # Hooks
5
+
6
+ A row opens into its command, timeout and last run; one that failed says so in the row.
7
+
8
+ <div className="@container w-full max-w-3xl">
9
+ <Hooks hooks={HOOKS} configDir="~/.claude-jobiflow" />
10
+ </div>
11
+
12
+ # Open
13
+
14
+ <div className="@container w-full max-w-3xl">
15
+ <Hooks hooks={HOOKS} configDir="~/.claude-jobiflow" defaultOpen={[HOOKS[0].event + '-' + HOOKS[0].command]} />
16
+ </div>
@@ -0,0 +1,127 @@
1
+ /*!
2
+ * Local addition: the settings screen's hooks section — each hook's event
3
+ * and matcher, opening into its command, timeout and last run.
4
+ */
5
+
6
+ 'use client'
7
+
8
+ import Button from '@justanarthur/modo-ui/components/actions/button'
9
+ import Badge from '@justanarthur/modo-ui/components/data-display/badge'
10
+ import { cn } from '@justanarthur/modo-ui/lib/utils'
11
+ import type { ReactNode } from 'react'
12
+ import { useIcon } from '../../../lib/icons'
13
+ import { CardCode, Details, Facts, Footer, Group, Mono, Row, Section } from '../../../lib/settings-parts'
14
+ import type { Hook } from '../../../lib/types'
15
+
16
+ const key = (hook: Hook) => `${hook.event}-${hook.command}`
17
+
18
+ function HookCard({
19
+ hook,
20
+ configDir,
21
+ onRun,
22
+ onEdit,
23
+ }: {
24
+ hook: Hook
25
+ configDir: string
26
+ onRun?: () => void
27
+ onEdit?: () => void
28
+ }) {
29
+ const Play = useIcon('play')
30
+ const facts: [string, ReactNode][] = [
31
+ ['Event', hook.event],
32
+ ['Matcher', <Mono key="m">{hook.matcher}</Mono>],
33
+ ['Timeout', `${hook.timeout ?? 60} s`],
34
+ ]
35
+ if (hook.lastRun) {
36
+ facts.push([
37
+ 'Last run',
38
+ <span key="r" className={cn(hook.lastRun.exit !== 0 && 'text-destructive')}>
39
+ {hook.lastRun.when} · exit {hook.lastRun.exit}
40
+ </span>,
41
+ ])
42
+ }
43
+ return (
44
+ <>
45
+ <CardCode language="bash">{hook.command}</CardCode>
46
+ <Facts items={facts} />
47
+ <Footer source={hook.scope === 'project' ? '.claude/settings.json' : `${configDir}/settings.json`}>
48
+ <Button size="compact" variant="ghost" leadingIcon={Play} onClick={onRun}>
49
+ Run now
50
+ </Button>
51
+ <Button size="compact" variant="ghost" onClick={onEdit}>
52
+ Edit
53
+ </Button>
54
+ </Footer>
55
+ </>
56
+ )
57
+ }
58
+
59
+ interface HooksProps {
60
+ /** The hooks the scope's settings and the project's list. */
61
+ hooks: Hook[]
62
+ /** The config dir being edited: where user-scoped hooks live. */
63
+ configDir: string
64
+ /** Hook keys (`<event>-<command>`) whose rows start open. Defaults to `[]`. */
65
+ defaultOpen?: string[]
66
+ /** Called when "Add hook" is pressed. */
67
+ onAdd?: () => void
68
+ /** Called when an open hook's "Run now" is pressed. */
69
+ onRun?: (hook: Hook) => void
70
+ /** Called when an open hook's Edit is pressed. */
71
+ onEdit?: (hook: Hook) => void
72
+ }
73
+
74
+ /**
75
+ * The commands the harness runs on session events, before and after tools.
76
+ *
77
+ * A row names the event and matcher over the command, with its scope on the
78
+ * right; a hook whose last run exited non-zero says Failed there. Press a row
79
+ * and it lifts into a card with the command, the timeout, the last run and
80
+ * which settings file it comes from, with Run now and Edit.
81
+ *
82
+ * @example {@include ./examples.mdx}
83
+ */
84
+ export default function Hooks({ hooks, configDir, defaultOpen, onAdd, onRun, onEdit }: HooksProps) {
85
+ const Plus = useIcon('plus')
86
+ return (
87
+ <Section
88
+ title="Hooks"
89
+ lead="Commands the harness runs on session events, before and after tools. Project hooks come from the repo's .claude/settings.json."
90
+ actions={
91
+ <Button size="compact" leadingIcon={Plus} onClick={onAdd}>
92
+ Add hook
93
+ </Button>
94
+ }
95
+ >
96
+ <Group title="Hooks" aside={<span className="tabular-nums">{hooks.length}</span>}>
97
+ <Details label="Hooks" defaultOpen={defaultOpen}>
98
+ {hooks.map((hook, i) => (
99
+ <Row
100
+ key={key(hook)}
101
+ value={key(hook)}
102
+ index={i}
103
+ label={`${hook.event} · ${hook.matcher}`}
104
+ caption={<span className="font-mono">{hook.command}</span>}
105
+ meta={
106
+ <>
107
+ {hook.lastRun && hook.lastRun.exit !== 0 && (
108
+ <Badge size="compact" variant="dot" color="red">
109
+ Failed
110
+ </Badge>
111
+ )}
112
+ <span className="text-caption">{hook.scope}</span>
113
+ </>
114
+ }
115
+ >
116
+ <HookCard hook={hook} configDir={configDir} onRun={() => onRun?.(hook)} onEdit={() => onEdit?.(hook)} />
117
+ </Row>
118
+ ))}
119
+ </Details>
120
+ </Group>
121
+ </Section>
122
+ )
123
+ }
124
+
125
+ export type { HooksProps }
126
+
127
+ export { Hooks }