@kabmo-labs/kabmo 0.46.1 → 0.48.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 (339) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +506 -502
  3. package/dist/client/static/js/Body-3tspyjtk.js +3 -0
  4. package/dist/client/static/js/{CsvGrid-qdkmv8bj.js → CsvGrid-3pwsfmxp.js} +2 -2
  5. package/dist/client/static/js/{DocxView-k84ns803.js → DocxView-xcg9jktb.js} +3 -3
  6. package/dist/client/static/js/{DrawioView-r1n717f7.js → DrawioView-2q19tgkx.js} +2 -2
  7. package/dist/client/static/js/HtmlPreview-92cadvbr.js +1 -0
  8. package/dist/client/static/js/ImageView-pr4h38hb.js +1 -0
  9. package/dist/client/static/js/LayoutWrapper-n4tzhjes.js +2 -0
  10. package/dist/client/static/js/MergeDiffView-0t15nh9f.js +1 -0
  11. package/dist/client/static/js/{Modal-xe6h99jn.js → Modal-77hgx4dw.js} +20 -20
  12. package/dist/client/static/js/{PdfView-ffg4mccg.js → PdfView-gzxhvxe8.js} +1 -1
  13. package/dist/client/static/js/{SessionsView-cdcbsee9.js → SessionsView-2tdqrvk0.js} +1 -1
  14. package/dist/client/static/js/{SheetView-89sscpz6.js → SheetView-w5w2m2de.js} +22 -22
  15. package/dist/client/static/js/{SvgPreview-68c0ccbv.js → SvgPreview-mtk6de6h.js} +1 -1
  16. package/dist/client/static/js/{abnfDiagram-O67JEVCF-h3a5s259.js → abnfDiagram-O67JEVCF-tha4j2fn.js} +1 -1
  17. package/dist/client/static/js/architecture-7GRP2DOG-zs15nydj.js +1 -0
  18. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-983p0jgn.js → architectureDiagram-NJMV4G6O-heep78p6.js} +6 -6
  19. package/dist/client/static/js/{astro-hyj5wege.js → astro-r4dp34pw.js} +1 -1
  20. package/dist/client/static/js/bash-8d3wrx5c.js +1 -0
  21. package/dist/client/static/js/{blockDiagram-BEXU5L5S-16pse5mh.js → blockDiagram-BEXU5L5S-6mzgfqh8.js} +5 -5
  22. package/dist/client/static/js/c-rn3z0csz.js +1 -0
  23. package/dist/client/static/js/{c4Diagram-YGBWAQC7-mvnb00zt.js → c4Diagram-YGBWAQC7-sfkcw7g9.js} +4 -4
  24. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-kmpd91xb.js → classDiagram-v2-NBCMYWYE-v530ny5e.js} +6 -6
  25. package/dist/client/static/js/{cose-bilkent-JH36ORCC-3ek5r5se.js → cose-bilkent-JH36ORCC-ybv1ttbx.js} +1 -1
  26. package/dist/client/static/js/cpp-99ws9nak.js +1 -0
  27. package/dist/client/static/js/css-narcr42w.js +1 -0
  28. package/dist/client/static/js/cynefin-OW5HDTMX-p3y1b4ap.js +1 -0
  29. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-jkbh84zn.js → cynefinDiagram-VND7K2PF-k8f3z0mm.js} +2 -2
  30. package/dist/client/static/js/{dagre-6A5THRUB-4fdc0sgn.js → dagre-6A5THRUB-gk0gp124.js} +2 -2
  31. package/dist/client/static/js/{diagram-22UHCM2B-hbk61nq9.js → diagram-22UHCM2B-2zh2957c.js} +15 -15
  32. package/dist/client/static/js/{diagram-3UASUU5V-hfpbr9qh.js → diagram-3UASUU5V-bzstt5e2.js} +2 -2
  33. package/dist/client/static/js/{diagram-ATOU4E4O-fn0nt71a.js → diagram-ATOU4E4O-16adx4g0.js} +3 -3
  34. package/dist/client/static/js/{diagram-CDSNMT55-ssswxjeb.js → diagram-CDSNMT55-1ja98ens.js} +5 -5
  35. package/dist/client/static/js/{diagram-MLGK6HIB-whnzxv6f.js → diagram-MLGK6HIB-f9nnyjbq.js} +2 -2
  36. package/dist/client/static/js/{diagram-MPIPVDR6-hk1chzxk.js → diagram-MPIPVDR6-3qgadfjz.js} +2 -2
  37. package/dist/client/static/js/{dockerfile-zmsj8r4g.js → dockerfile-04tc68pq.js} +1 -1
  38. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-q1vkg5mr.js → ebnfDiagram-ZINNZB2B-022cz603.js} +1 -1
  39. package/dist/client/static/js/{elixir-80wq7gak.js → elixir-61gbjv6c.js} +1 -1
  40. package/dist/client/static/js/{elk-276RUBZZ-kt98vg8j.js → elk-276RUBZZ-2anf1c36.js} +1 -1
  41. package/dist/client/static/js/{erDiagram-OPXOYQCR-ey3avsn9.js → erDiagram-OPXOYQCR-ndd27fz1.js} +7 -7
  42. package/dist/client/static/js/{erlang-814e8qy5.js → erlang-bh5cbm8m.js} +1 -1
  43. package/dist/client/static/js/eventmodeling-NTZA5JFV-sx2cwkz3.js +1 -0
  44. package/dist/client/static/js/flowDiagram-KWPJA3E3-dsc17mty.js +1 -0
  45. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-a9k1at43.js → ganttDiagram-FUAMR5RP-9gm6hkgn.js} +4 -4
  46. package/dist/client/static/js/gitGraph-4MIJSDKK-yqhbscsd.js +1 -0
  47. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-gnekjfym.js → gitGraphDiagram-X574FWY7-78bxa67c.js} +8 -8
  48. package/dist/client/static/js/graphql-tr0jcndy.js +1 -0
  49. package/dist/client/static/js/html-n8fdvrdk.js +1 -0
  50. package/dist/client/static/js/index-0e51wknc.js +10 -0
  51. package/dist/client/static/js/{index-z25ss7xj.js → index-13g17wa3.js} +1 -1
  52. package/dist/client/static/js/index-1hb8fvw9.js +1 -0
  53. package/dist/client/static/js/{index-1c2jvnyh.js → index-2bsnywea.js} +2 -2
  54. package/dist/client/static/js/{index-g7s0wsag.js → index-2n1fgpjv.js} +2 -2
  55. package/dist/client/static/js/{index-3x7h2eqj.js → index-30a8py59.js} +2 -2
  56. package/dist/client/static/js/{index-qf3y3ahx.js → index-34aq5bz5.js} +2 -2
  57. package/dist/client/static/js/index-3en15m75.js +2 -0
  58. package/dist/client/static/js/{index-nw5mvcaj.js → index-417fbrqk.js} +2 -2
  59. package/dist/client/static/js/{index-z4530r3c.js → index-45p59fxq.js} +2 -2
  60. package/dist/client/static/js/index-4n7t26ap.js +2 -0
  61. package/dist/client/static/js/{index-kty4ncsr.js → index-55pqvh82.js} +2 -2
  62. package/dist/client/static/js/index-5mpv57fn.js +12 -0
  63. package/dist/client/static/js/{index-x9r7zfp4.js → index-7pz6n3pg.js} +2 -2
  64. package/dist/client/static/js/{index-1ax52p0q.js → index-7whstwc7.js} +2 -2
  65. package/dist/client/static/js/index-869vdnz8.js +2 -0
  66. package/dist/client/static/js/{index-fzngzhww.js → index-8tvrzce0.js} +2 -2
  67. package/dist/client/static/js/index-9a78xmkk.js +462 -0
  68. package/dist/client/static/js/{index-33qxg79j.js → index-a58rkn3f.js} +5 -5
  69. package/dist/client/static/js/{index-60v30k5h.js → index-aa3hmn6j.js} +64 -64
  70. package/dist/client/static/js/{index-wrcdc9vz.js → index-aabp7nt6.js} +1 -1
  71. package/dist/client/static/js/{index-64sqfr4a.js → index-abrrqhne.js} +2 -2
  72. package/dist/client/static/js/{index-9vv7wr1n.js → index-ac2q5903.js} +2 -2
  73. package/dist/client/static/js/index-axtm1aq8.js +2 -0
  74. package/dist/client/static/js/index-b2cs4c51.js +4 -0
  75. package/dist/client/static/js/{index-8g7q8mz4.js → index-c250nzm1.js} +3 -3
  76. package/dist/client/static/js/{index-abs635a1.js → index-dxnkwf39.js} +48 -48
  77. package/dist/client/static/js/{index-kbhrvep8.js → index-e6ny4gd9.js} +6 -6
  78. package/dist/client/static/js/index-ebf50mrs.js +9 -0
  79. package/dist/client/static/js/{index-trvqvb1v.js → index-ep6bqcmg.js} +2 -2
  80. package/dist/client/static/js/{index-qfxn7yh5.js → index-fb2s080r.js} +2 -2
  81. package/dist/client/static/js/index-fryp0kgf.js +2 -0
  82. package/dist/client/static/js/{index-2ks0m8ss.js → index-g3rg6vsd.js} +2 -2
  83. package/dist/client/static/js/{index-sa1675y0.js → index-g8rpydkr.js} +2 -2
  84. package/dist/client/static/js/{index-bsr7wmj2.js → index-gkmn4y1v.js} +1 -1
  85. package/dist/client/static/js/{index-xq5f3nxa.js → index-gpmcth0x.js} +2 -2
  86. package/dist/client/static/js/{index-e9cxje00.js → index-hcmhdpp4.js} +10 -10
  87. package/dist/client/static/js/{index-kb14dhrx.js → index-he4k2j91.js} +2 -2
  88. package/dist/client/static/js/{index-wbws16ag.js → index-hq28918s.js} +2 -2
  89. package/dist/client/static/js/{index-84fyq5a6.js → index-hwzxdwwg.js} +1 -1
  90. package/dist/client/static/js/{index-2a6qp9y6.js → index-jnkc9p53.js} +1 -1
  91. package/dist/client/static/js/{index-pavvxrsz.js → index-k39be93q.js} +1 -1
  92. package/dist/client/static/js/{index-c9e417cs.js → index-kaxvwh07.js} +2 -2
  93. package/dist/client/static/js/{index-ykm7a3cp.js → index-kjr68pcj.js} +2 -2
  94. package/dist/client/static/js/{index-b5dfvget.js → index-m0fatq7c.js} +4 -4
  95. package/dist/client/static/js/{index-atq9q1s7.js → index-m39gbcxn.js} +1 -1
  96. package/dist/client/static/js/{index-hnb66d3s.js → index-mqzgf7rw.js} +2 -2
  97. package/dist/client/static/js/{index-5wz0y88c.js → index-pzsp1src.js} +2 -2
  98. package/dist/client/static/js/{index-yf93db65.js → index-qe0vfv6s.js} +1 -1
  99. package/dist/client/static/js/{index-q9ytjey8.js → index-qek9mt5w.js} +1 -1
  100. package/dist/client/static/js/{index-d23eacf2.js → index-qxzj780x.js} +2 -2
  101. package/dist/client/static/js/index-rgxg0azs.css +1 -0
  102. package/dist/client/static/js/{index-m4k054wz.js → index-rq4dk4tp.js} +4 -4
  103. package/dist/client/static/js/{index-fj5rsp5v.js → index-seekt5k3.js} +2 -2
  104. package/dist/client/static/js/{index-561gkvve.js → index-sng4prpr.js} +2 -2
  105. package/dist/client/static/js/{index-vjmg7kn5.js → index-t4s10406.js} +2 -2
  106. package/dist/client/static/js/{index-b2e5pwx7.js → index-tzz5gp8a.js} +5 -5
  107. package/dist/client/static/js/index-vnv9z0a1.js +1 -0
  108. package/dist/client/static/js/{index-19x11s5w.js → index-x7rajphe.js} +2 -2
  109. package/dist/client/static/js/{index-dxvtjn6a.js → index-xny7vsfz.js} +2 -2
  110. package/dist/client/static/js/index-xr4hjv01.js +2 -0
  111. package/dist/client/static/js/{index-65afr75v.js → index-ya9yqj5w.js} +2 -2
  112. package/dist/client/static/js/{index-z0fkfphe.js → index-zcgqacvx.js} +2 -2
  113. package/dist/client/static/js/info-A6RAGUB7-0sd3zzgg.js +1 -0
  114. package/dist/client/static/js/{infoDiagram-VRGFBTTK-r1p25738.js → infoDiagram-VRGFBTTK-bxk0g0pe.js} +2 -2
  115. package/dist/client/static/js/ini-tnaw7zjy.js +1 -0
  116. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-afgrqdrt.js → ishikawaDiagram-OU5B5YK6-d1kdkhth.js} +3 -3
  117. package/dist/client/static/js/java-m4dpc2vw.js +1 -0
  118. package/dist/client/static/js/javascript-8y26t991.js +1 -0
  119. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-hepa4wk7.js → journeyDiagram-ZHPQQLJL-cahg3zjq.js} +4 -4
  120. package/dist/client/static/js/json-azm7bdqd.js +1 -0
  121. package/dist/client/static/js/jsx-p9j1k773.js +1 -0
  122. package/dist/client/static/js/{julia-yv2j8qd0.js → julia-2n5k898q.js} +1 -1
  123. package/dist/client/static/js/{kanban-definition-PNTS6WVX-jysft8ya.js → kanban-definition-PNTS6WVX-nq7t83en.js} +6 -6
  124. package/dist/client/static/js/lua-hbm9rhz9.js +1 -0
  125. package/dist/client/static/js/markdown-tk3cd3vs.js +1 -0
  126. package/dist/client/static/js/{mermaid.core-0m90b0s8.js → mermaid.core-6nw0853j.js} +8 -8
  127. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-x2rrzpvr.js → mindmap-definition-NLK3R4M7-cm7ykxf2.js} +3 -3
  128. package/dist/client/static/js/one-dark-pro-2cdc2nk7.js +1 -0
  129. package/dist/client/static/js/one-light-bt6z4jf0.js +1 -0
  130. package/dist/client/static/js/packet-AYTQ26CC-13w2v5bb.js +1 -0
  131. package/dist/client/static/js/{pegDiagram-GJSIUBJH-z7vb7f1z.js → pegDiagram-GJSIUBJH-xwxz8nsq.js} +1 -1
  132. package/dist/client/static/js/{perl-917pjq5a.js → perl-66vb5pz7.js} +1 -1
  133. package/dist/client/static/js/{php-hwz75qzt.js → php-4e9we8am.js} +1 -1
  134. package/dist/client/static/js/pie-WAS4IAKB-swtnysgn.js +1 -0
  135. package/dist/client/static/js/{pieDiagram-5QR66LMP-jqv6v4e6.js → pieDiagram-5QR66LMP-n910k9th.js} +3 -3
  136. package/dist/client/static/js/properties-6911ckw7.js +1 -0
  137. package/dist/client/static/js/python-44cvj250.js +1 -0
  138. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-w2h8yxrv.js → quadrantDiagram-O4NWA36T-dxkwxbqb.js} +6 -6
  139. package/dist/client/static/js/r-t3sepzm4.js +1 -0
  140. package/dist/client/static/js/radar-RG4KPBEZ-vtvxkx55.js +1 -0
  141. package/dist/client/static/js/railroad-74A4TZTK-5sp2d63r.js +1 -0
  142. package/dist/client/static/js/railroad-abnf-HS5TGJTU-kg706fan.js +1 -0
  143. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-4ra1gzx5.js +1 -0
  144. package/dist/client/static/js/railroad-peg-WCYAUIDC-hms3zpjm.js +1 -0
  145. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-nd09yac3.js → railroadDiagram-XR7U4H2S-xb1smt7r.js} +1 -1
  146. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-t61zxh5v.js → requirementDiagram-PLB6GJNP-6kb21b9f.js} +6 -6
  147. package/dist/client/static/js/{ruby-er7ayhte.js → ruby-v7nmcvyr.js} +1 -1
  148. package/dist/client/static/js/{rust-avnkhh0p.js → rust-5ersd7be.js} +1 -1
  149. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-2f7h2cmw.js → sankeyDiagram-IPEJSGJF-74z0fskw.js} +4 -4
  150. package/dist/client/static/js/{sass-n47tt136.js → sass-h3nvy4c8.js} +1 -1
  151. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-kfb5d7zd.js → sequenceDiagram-PO4LG4MO-apn6kezn.js} +17 -17
  152. package/dist/client/static/js/{sizeCapture-INFHLROL-amfg19se.js → sizeCapture-INFHLROL-2drzcjb8.js} +1 -1
  153. package/dist/client/static/js/sql-zdkawqx3.js +1 -0
  154. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-k5hx7btx.js → stateDiagram-v2-GCMORJYK-ma09vhby.js} +3 -3
  155. package/dist/client/static/js/{svelte-2pmz35vx.js → svelte-dhspkgss.js} +1 -1
  156. package/dist/client/static/js/{swimlanes-2SLR337P-wv3rp8kk.js → swimlanes-2SLR337P-f6y9xqnx.js} +1 -1
  157. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-3dwas56m.js +8 -0
  158. package/dist/client/static/js/{timeline-definition-EJHVYXUP-0re95wtn.js → timeline-definition-EJHVYXUP-zmcmvq00.js} +5 -5
  159. package/dist/client/static/js/treeView-Q6P3EWNA-7t5k6rs2.js +1 -0
  160. package/dist/client/static/js/treemap-WGGIJYW6-w56ry3bg.js +1 -0
  161. package/dist/client/static/js/tsx-b7eabr17.js +1 -0
  162. package/dist/client/static/js/typescript-nnkvhwfy.js +1 -0
  163. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-yrje14qp.js → usecaseDiagram-POWQR4AR-wfaa019a.js} +24 -24
  164. package/dist/client/static/js/{vennDiagram-UO4OBE2U-jxkmrfy5.js → vennDiagram-UO4OBE2U-46wf2pgd.js} +8 -8
  165. package/dist/client/static/js/{vue-d5gpjfgn.js → vue-ffngx2b3.js} +1 -1
  166. package/dist/client/static/js/wardley-WFR3VGLG-rtjb9kgv.js +1 -0
  167. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-d3v2m9b1.js → wardleyDiagram-VNRHLVJA-10ph3bzq.js} +4 -4
  168. package/dist/client/static/js/xml-xy1tw6b2.js +1 -0
  169. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-9a1s1rjt.js → xychartDiagram-PMCCYNJV-2ba825z9.js} +5 -5
  170. package/dist/client/static/js/yaml-0fexqg2d.js +1 -0
  171. package/marketplace/marketplace.json +34 -7
  172. package/marketplace/plugins/kanban/README.md +143 -0
  173. package/marketplace/plugins/kanban/icon.svg +5 -0
  174. package/marketplace/plugins/kanban/package.json +30 -0
  175. package/marketplace/plugins/kanban/src/app.tsx +34 -0
  176. package/marketplace/plugins/kanban/src/mcp-tools.ts +296 -0
  177. package/marketplace/plugins/kanban/src/mcp.test.ts +199 -0
  178. package/marketplace/plugins/kanban/src/mcp.ts +148 -0
  179. package/marketplace/plugins/kanban/src/panel/CardSheet.tsx +319 -0
  180. package/marketplace/plugins/kanban/src/panel/CardTile.tsx +97 -0
  181. package/marketplace/plugins/kanban/src/panel/StageColumn.tsx +116 -0
  182. package/marketplace/plugins/kanban/src/panel/StageSheet.tsx +249 -0
  183. package/marketplace/plugins/kanban/src/panel/catalogs.ts +114 -0
  184. package/marketplace/plugins/kanban/src/panel/index.tsx +327 -0
  185. package/marketplace/plugins/kanban/src/panel/panel.test.ts +219 -0
  186. package/marketplace/plugins/kanban/src/panel/start-work.ts +132 -0
  187. package/marketplace/plugins/kanban/src/panel/use-board.ts +148 -0
  188. package/marketplace/plugins/kanban/src/panel/use-card-detail.ts +70 -0
  189. package/marketplace/plugins/kanban/src/panel/use-writes.ts +123 -0
  190. package/marketplace/plugins/kanban/src/protocol.ts +180 -0
  191. package/marketplace/plugins/kanban/src/server.test.ts +113 -0
  192. package/marketplace/plugins/kanban/src/server.ts +227 -0
  193. package/marketplace/plugins/kanban/src/store/board.test.ts +311 -0
  194. package/marketplace/plugins/kanban/src/store/board.ts +147 -0
  195. package/marketplace/plugins/kanban/src/store/cards.ts +228 -0
  196. package/marketplace/plugins/kanban/src/store/fs.ts +159 -0
  197. package/marketplace/plugins/kanban/src/store/ops.ts +245 -0
  198. package/marketplace/plugins/kanban/src/store/resolve.test.ts +82 -0
  199. package/marketplace/plugins/kanban/src/store/resolve.ts +135 -0
  200. package/marketplace/plugins/kanban/tsconfig.json +26 -0
  201. package/package.json +2 -2
  202. package/src/client/components/common/file-icon/index.tsx +1 -1
  203. package/src/client/components/layout/desktop-layout/LeftColumn.tsx +12 -3
  204. package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +34 -7
  205. package/src/client/components/layout/desktop-layout/index.tsx +17 -22
  206. package/src/client/components/mobile/mobile-right-sidebar/EditorSurface.tsx +2 -0
  207. package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +11 -3
  208. package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.test.tsx +21 -0
  209. package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.tsx +8 -4
  210. package/src/client/components/settings/categories/appearance-settings/ThemeCard.tsx +8 -2
  211. package/src/client/components/settings/categories/appearance-settings/ThemeGrid.tsx +15 -4
  212. package/src/client/components/settings/categories/usage-settings/LimitsSection.tsx +10 -3
  213. package/src/client/components/settings/categories/usage-settings/ProviderDetail.tsx +27 -4
  214. package/src/client/components/settings/categories/usage-settings/TokenHarborCard.tsx +160 -0
  215. package/src/client/components/settings/categories/usage-settings/TokenPortalCard.tsx +104 -0
  216. package/src/client/components/settings/categories/usage-settings/format.ts +35 -0
  217. package/src/client/components/settings/categories/usage-settings/limits-section.test.tsx +16 -0
  218. package/src/client/components/settings/categories/usage-settings/providers.ts +26 -4
  219. package/src/client/components/settings/categories/usage-settings/token-harbor-card.test.tsx +114 -0
  220. package/src/client/components/settings/categories/usage-settings/token-harbor-hint.test.ts +68 -0
  221. package/src/client/components/settings/categories/usage-settings/token-portal-card.test.tsx +81 -0
  222. package/src/client/components/settings/categories/usage-settings/usage-and-picker.test.ts +66 -0
  223. package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.test.ts +21 -0
  224. package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +7 -1
  225. package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +3 -1
  226. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +1 -1
  227. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/DiffView.test.ts +13 -0
  228. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/DiffView.tsx +41 -18
  229. package/src/client/components/workspace/editor/BodyLazy.tsx +40 -0
  230. package/src/client/components/workspace/editor/FilePane.tsx +4 -2
  231. package/src/client/components/workspace/editor/Tabs.tsx +7 -1
  232. package/src/client/components/workspace/editor/Toolbar.tsx +7 -1
  233. package/src/client/components/workspace/editor/chrome-rows.test.tsx +126 -0
  234. package/src/client/components/workspace/editor/index.tsx +2 -2
  235. package/src/client/components/workspace/editor/viewers/HtmlPreview.test.tsx +94 -0
  236. package/src/client/components/workspace/editor/viewers/HtmlPreview.tsx +71 -0
  237. package/src/client/components/workspace/editor/viewers/bytes.ts +1 -1
  238. package/src/client/components/workspace/editor/viewers/dispatch.tsx +18 -2
  239. package/src/client/components/workspace/editor/viewers/viewers.test.ts +14 -1
  240. package/src/client/components/workspace/panel-header/index.test.tsx +2 -1
  241. package/src/client/components/workspace/panel-header/index.tsx +6 -4
  242. package/src/client/data/settings/omp-schema.json +33 -10
  243. package/src/client/hooks/editor/resolve-viewer.ts +1 -1
  244. package/src/client/hooks/editor/use-editor-drop.ts +14 -0
  245. package/src/client/hooks/editor/use-editor-tab-state.ts +5 -4
  246. package/src/client/hooks/ui/media-query.ts +27 -0
  247. package/src/client/hooks/workspace/file-tabs.ts +10 -0
  248. package/src/client/hooks/workspace/right-panel-presence.test.ts +152 -0
  249. package/src/client/hooks/workspace/right-panel-presence.ts +119 -0
  250. package/src/client/lib/router/search-params.test.ts +83 -0
  251. package/src/client/lib/router/search-params.ts +14 -3
  252. package/src/server/lib/mcp/session-mcp.test.ts +64 -1
  253. package/src/server/lib/mcp/session-overlay.server.ts +7 -4
  254. package/src/server/lib/omp/rpc/constants.test.ts +31 -0
  255. package/src/server/lib/omp/rpc/constants.ts +19 -0
  256. package/src/server/lib/omp/rpc/session-new.ts +78 -0
  257. package/src/server/lib/omp/rpc/session-registry.ts +22 -49
  258. package/src/server/lib/omp/rpc/spawn-mcp.ts +8 -1
  259. package/src/server/lib/omp/session/blobs.server.ts +2 -1
  260. package/src/server/lib/plugins/e2e.test.ts +71 -2
  261. package/src/server/lib/plugins/loader.server.ts +20 -1
  262. package/src/server/lib/plugins/module-import.server.ts +45 -0
  263. package/src/server/lib/usage/provider-key.ts +18 -0
  264. package/src/server/lib/usage/providers.server.ts +27 -3
  265. package/src/server/lib/usage/report.server.ts +24 -0
  266. package/src/server/lib/usage/token-harbor.test.ts +191 -0
  267. package/src/server/lib/usage/token-harbor.ts +207 -0
  268. package/src/server/lib/usage/token-portal.test.ts +140 -0
  269. package/src/server/lib/usage/token-portal.ts +179 -0
  270. package/src/server/lib/usage/vendor-http.test.ts +52 -0
  271. package/src/server/lib/usage/vendor-http.ts +9 -2
  272. package/src/server/routes/agent/new-prompt.test.ts +81 -0
  273. package/src/server/routes/agent/new.ts +78 -4
  274. package/src/server/routes/fs/raw.test.ts +12 -0
  275. package/src/server/routes/fs/raw.ts +2 -6
  276. package/src/server/routes/wiki/asset.ts +1 -1
  277. package/src/shared/lib/fs/document-kind.test.ts +39 -2
  278. package/src/shared/lib/fs/document-kind.ts +49 -1
  279. package/src/shared/lib/fs/file-kind.test.ts +30 -3
  280. package/src/shared/lib/fs/file-kind.ts +7 -104
  281. package/src/shared/lib/fs/mime.ts +159 -0
  282. package/src/shared/lib/omp/config/schema-releases.test.ts +22 -0
  283. package/src/shared/lib/workspace/sidebar-width.test.ts +34 -0
  284. package/src/shared/lib/workspace/sidebar-width.ts +33 -0
  285. package/src/shared/lib/workspace/workspace-panel-widths.test.ts +124 -0
  286. package/src/shared/lib/workspace/workspace-panel-widths.ts +115 -18
  287. package/src/shared/types/settings/usage.ts +89 -2
  288. package/dist/client/static/js/ImageView-jkrdrq8v.js +0 -1
  289. package/dist/client/static/js/LayoutWrapper-sh634350.js +0 -2
  290. package/dist/client/static/js/architecture-7GRP2DOG-pvb4d65d.js +0 -1
  291. package/dist/client/static/js/bash-8d8z8zrg.js +0 -1
  292. package/dist/client/static/js/c-acmn1zc9.js +0 -1
  293. package/dist/client/static/js/cpp-620mvjkk.js +0 -1
  294. package/dist/client/static/js/css-bt76kxbq.js +0 -1
  295. package/dist/client/static/js/cynefin-OW5HDTMX-gmx4vean.js +0 -1
  296. package/dist/client/static/js/eventmodeling-NTZA5JFV-vrnheyh7.js +0 -1
  297. package/dist/client/static/js/flowDiagram-KWPJA3E3-7gvtpn3d.js +0 -1
  298. package/dist/client/static/js/gitGraph-4MIJSDKK-n6wnc8st.js +0 -1
  299. package/dist/client/static/js/graphql-j1a6zp7m.js +0 -1
  300. package/dist/client/static/js/html-m0megrvb.js +0 -1
  301. package/dist/client/static/js/index-4cag7w6k.js +0 -479
  302. package/dist/client/static/js/index-5ka2tyf9.js +0 -3
  303. package/dist/client/static/js/index-83rkg916.js +0 -2
  304. package/dist/client/static/js/index-amsa0tfs.js +0 -2
  305. package/dist/client/static/js/index-dn7hg4em.js +0 -2
  306. package/dist/client/static/js/index-dpy3ewrn.css +0 -1
  307. package/dist/client/static/js/index-dt6q3rws.js +0 -12
  308. package/dist/client/static/js/index-hgzntg2j.js +0 -2
  309. package/dist/client/static/js/index-vkqb4dnt.js +0 -1
  310. package/dist/client/static/js/index-xwjbq003.js +0 -2
  311. package/dist/client/static/js/info-A6RAGUB7-1xtdxjz2.js +0 -1
  312. package/dist/client/static/js/ini-5f4zqtqr.js +0 -1
  313. package/dist/client/static/js/java-jj41mty3.js +0 -1
  314. package/dist/client/static/js/javascript-n9w9p97f.js +0 -1
  315. package/dist/client/static/js/json-rnh2h17x.js +0 -1
  316. package/dist/client/static/js/jsx-4gecrt29.js +0 -1
  317. package/dist/client/static/js/lua-zszaw2f7.js +0 -1
  318. package/dist/client/static/js/markdown-nm6gw4v4.js +0 -1
  319. package/dist/client/static/js/one-dark-pro-09d8p5vy.js +0 -1
  320. package/dist/client/static/js/one-light-g3ednt6p.js +0 -1
  321. package/dist/client/static/js/packet-AYTQ26CC-zm1r82x5.js +0 -1
  322. package/dist/client/static/js/pie-WAS4IAKB-sqa7321j.js +0 -1
  323. package/dist/client/static/js/properties-rkptax7r.js +0 -1
  324. package/dist/client/static/js/python-qf1se1mj.js +0 -1
  325. package/dist/client/static/js/r-ms0cygq2.js +0 -1
  326. package/dist/client/static/js/radar-RG4KPBEZ-z3z82syp.js +0 -1
  327. package/dist/client/static/js/railroad-74A4TZTK-z6swcqq2.js +0 -1
  328. package/dist/client/static/js/railroad-abnf-HS5TGJTU-33km6py4.js +0 -1
  329. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-1zbf1xmq.js +0 -1
  330. package/dist/client/static/js/railroad-peg-WCYAUIDC-wte1xzzy.js +0 -1
  331. package/dist/client/static/js/sql-hd42h8wx.js +0 -1
  332. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-6y8zdbm4.js +0 -8
  333. package/dist/client/static/js/treeView-Q6P3EWNA-pvgx6n22.js +0 -1
  334. package/dist/client/static/js/treemap-WGGIJYW6-3n9zm628.js +0 -1
  335. package/dist/client/static/js/tsx-gx7td06z.js +0 -1
  336. package/dist/client/static/js/typescript-1a808spn.js +0 -1
  337. package/dist/client/static/js/wardley-WFR3VGLG-7m07ewc4.js +0 -1
  338. package/dist/client/static/js/xml-3117mxd9.js +0 -1
  339. package/dist/client/static/js/yaml-dmvh8vyt.js +0 -1
@@ -0,0 +1,327 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The Kanban panel: the board, its lens chips, and the two sheets.
8
+ *
9
+ * ## What this view is
10
+ *
11
+ * A control surface. A card is a task — a prompt, an agent, a stage — and the
12
+ * board's job is to move it. There is no description, no comments and no
13
+ * labels, because a board that accumulates knowledge stops being read.
14
+ *
15
+ * ## Two writers, one board
16
+ *
17
+ * An agent can move its own cards through the plugin's MCP tools. That write
18
+ * happens in a DIFFERENT process, so the panel cannot learn about it from its own
19
+ * state: it follows the plugin topic, which the server half publishes whenever
20
+ * `cards/` changes. That is why a card can move while this view is open and
21
+ * nothing here polls.
22
+ *
23
+ * ## The lens
24
+ *
25
+ * One board, two lenses: this workspace (the default when one is open) and
26
+ * everything. A card carries the workspace it belongs to, so switching a lens
27
+ * filters rather than moving anything, and a card whose folder is gone is still
28
+ * on the board.
29
+ */
30
+
31
+ import { useCallback, useMemo, useState } from 'preact/hooks';
32
+ import { experimental_useSidebarThreads, usePanelInfo } from '@kabmo-labs/kabmo-ui';
33
+
34
+ import type { Card, CardSummary, ResolvedAgent, Stage } from '../protocol';
35
+ import { useBoard, type Lens } from './use-board';
36
+ import { useWrites } from './use-writes';
37
+ import { useCatalogs } from './catalogs';
38
+ import { StageColumn } from './StageColumn';
39
+ import { CardSheet } from './CardSheet';
40
+ import { StageSheet } from './StageSheet';
41
+ import { useCardDetail } from './use-card-detail';
42
+
43
+ /** The chips' labels, in order. */
44
+ function lensLabel(lens: Lens, counts: Record<Lens, number>): string {
45
+ if (lens === 'all') return `All ${counts.all}`;
46
+ if (lens === 'workspace') return `This workspace ${counts.workspace}`;
47
+ return `Unfiled ${counts.unfiled}`;
48
+ }
49
+
50
+ /** Which stages to draw: hidden ones only while they hold cards. */
51
+ export function visibleStages(stages: readonly Stage[], cards: readonly CardSummary[]): Stage[] {
52
+ return stages.filter(
53
+ (stage) => !stage.hidden || cards.some((card) => card.status === stage.id),
54
+ );
55
+ }
56
+
57
+ /** Cards whose stage matches no stage id, shown rather than dropped. */
58
+ export function unplacedCards(stages: readonly Stage[], cards: readonly CardSummary[]): CardSummary[] {
59
+ const known = new Set(stages.map((stage) => stage.id));
60
+ return cards.filter((card) => !known.has(card.status));
61
+ }
62
+
63
+ /** The board panel. */
64
+ export function KanbanPanel() {
65
+ const board = useBoard();
66
+ const { workspacePath, sessionId } = usePanelInfo();
67
+ const writes = useWrites(board.reload);
68
+ const catalogs = useCatalogs(true);
69
+ const threads = experimental_useSidebarThreads();
70
+ const detail = useCardDetail();
71
+ const [openCardId, setOpenCardId] = useState<string | null>(null);
72
+ const [stagesOpen, setStagesOpen] = useState(false);
73
+ const [draggingId, setDraggingId] = useState<string | null>(null);
74
+ const [dropTarget, setDropTarget] = useState<string | null>(null);
75
+ const [notice, setNotice] = useState<string | null>(null);
76
+
77
+ const sessionStateOf = useCallback(
78
+ (card: CardSummary): 'running' | 'needs-you' | 'idle' | 'none' => {
79
+ if (!card.sessionId) return 'none';
80
+ const thread = threads.threads.find((entry) => entry.id === card.sessionId);
81
+ if (!thread) return 'idle';
82
+ if (thread.awaitingInput) return 'needs-you';
83
+ return thread.isRunning ? 'running' : 'idle';
84
+ },
85
+ [threads.threads],
86
+ );
87
+
88
+ // `exists` is checked ONCE here: everything below draws a real board.
89
+ const live = board.snapshot?.exists ? board.snapshot : null;
90
+ const stages = useMemo(
91
+ () => (live ? visibleStages(live.board.stages, board.cards) : []),
92
+ [live, board.cards],
93
+ );
94
+ const unplaced = useMemo(
95
+ () => (live ? unplacedCards(live.board.stages, board.cards) : []),
96
+ [live, board.cards],
97
+ );
98
+
99
+ const drop = useCallback(
100
+ async (stageId: string) => {
101
+ const id = draggingId;
102
+ setDraggingId(null);
103
+ setDropTarget(null);
104
+ if (!id) return;
105
+ const card = board.cards.find((entry) => entry.id === id);
106
+ if (!card || card.status === stageId) return;
107
+ const outcome = await writes.moveCard(id, stageId);
108
+ if (!outcome.ok) setNotice(outcome.error);
109
+ else if (outcome.value.next === 'start_work_required') {
110
+ setNotice('Moved. This stage runs a chat — press Start work on the card.');
111
+ }
112
+ },
113
+ [board.cards, draggingId, writes],
114
+ );
115
+
116
+ const startWork = useCallback(
117
+ async (card: Card, resolved: ResolvedAgent) => {
118
+ const outcome = await writes.startWork(card, resolved);
119
+ if (!outcome.ok) return { ok: false as const, error: outcome.error };
120
+ setOpenCardId(null);
121
+ return { ok: true as const, value: outcome };
122
+ },
123
+ [writes],
124
+ );
125
+
126
+ // The board is the plugin's only surface, so every state it can be in is here.
127
+ if (board.isLoading) {
128
+ return <p class="p-3 text-xs text-ink/45">Reading the board…</p>;
129
+ }
130
+
131
+ if (board.error) {
132
+ return (
133
+ <div class="flex flex-col gap-2 p-3">
134
+ <p class="text-xs text-ink">Could not read the board.</p>
135
+ <p class="text-[11px] text-[var(--theme-error)]">{board.error}</p>
136
+ <button type="button" class="self-start rounded-md border border-ink/20 px-2 py-1 text-[11px]" onClick={board.reload}>
137
+ Retry
138
+ </button>
139
+ </div>
140
+ );
141
+ }
142
+
143
+ if (!live) {
144
+ return (
145
+ <div class="flex flex-col gap-2 p-3">
146
+ <p class="text-xs text-ink">No board yet.</p>
147
+ <p class="text-[11px] text-ink/50">It will be created in this Kabmo's data directory.</p>
148
+ <button
149
+ type="button"
150
+ class="self-start rounded-md border border-ink/20 bg-ink/5 px-2 py-1 text-[11px]"
151
+ onClick={() => void board.createBoard()}
152
+ >
153
+ Create board
154
+ </button>
155
+ </div>
156
+ );
157
+ }
158
+
159
+ const openCard = openCardId ? detail.card : null;
160
+ const showWorkspace = board.lens === 'all';
161
+
162
+ return (
163
+ <div class="flex h-full min-h-0 w-full bg-paper text-ink">
164
+ <div class="flex flex-col flex-1 min-w-0 min-h-0">
165
+ <header class="flex items-center gap-2 px-2.5 h-10 flex-none border-b border-ink/10">
166
+ <span class="text-xs font-semibold">Kanban</span>
167
+ <span class="text-[10px] text-ink/40">{live.cards.length}</span>
168
+ <div class="flex items-center gap-1 ml-2">
169
+ {(['all', 'workspace', 'unfiled'] as const).map((lens) => (
170
+ <button
171
+ key={lens}
172
+ type="button"
173
+ class={[
174
+ 'rounded-full border px-2 py-0.5 text-[10px]',
175
+ board.lens === lens ? 'border-ink/30 bg-ink/5 text-ink' : 'border-ink/10 text-ink/55',
176
+ ].join(' ')}
177
+ aria-pressed={board.lens === lens}
178
+ onClick={() => board.setLens(lens)}
179
+ >
180
+ {lensLabel(lens, board.counts)}
181
+ </button>
182
+ ))}
183
+ </div>
184
+ <button
185
+ type="button"
186
+ class="ml-auto rounded-md border border-ink/15 px-2 py-0.5 text-[10px] text-ink/70"
187
+ onClick={() => setStagesOpen(true)}
188
+ >
189
+ Stages…
190
+ </button>
191
+ <button
192
+ type="button"
193
+ class="rounded-md border border-ink/15 px-2 py-0.5 text-[10px] text-ink/70"
194
+ onClick={board.reload}
195
+ >
196
+ Refresh
197
+ </button>
198
+ </header>
199
+
200
+ {live.errors.length > 0 ? (
201
+ <ul class="px-2.5 py-1.5 border-b border-ink/10 flex flex-col gap-0.5">
202
+ {live.errors.map((entry) => (
203
+ <li key={entry.path} class="text-[10px] text-[var(--theme-error)] font-mono">
204
+ {entry.path} — {entry.message}
205
+ </li>
206
+ ))}
207
+ </ul>
208
+ ) : null}
209
+
210
+ {notice ? (
211
+ <p class="px-2.5 py-1.5 border-b border-ink/10 text-[11px] text-ink/60" role="status">
212
+ {notice}
213
+ </p>
214
+ ) : null}
215
+
216
+ <div class="flex-1 min-h-0 overflow-x-auto overflow-y-hidden p-2">
217
+ <div class="flex gap-2 h-full min-h-0">
218
+ {stages.map((stage) => (
219
+ <StageColumn
220
+ key={stage.id}
221
+ stage={stage}
222
+ cards={board.cards.filter((card) => card.status === stage.id)}
223
+ showWorkspace={showWorkspace}
224
+ sessionStateOf={sessionStateOf}
225
+ draggingId={draggingId}
226
+ dropTarget={dropTarget}
227
+ onOpenCard={(id) => {
228
+ setOpenCardId(id);
229
+ void detail.load(id);
230
+ }}
231
+ onAddCard={(stageId) => {
232
+ void writes
233
+ .createCard({ title: 'New card', status: stageId, workspace: workspacePath })
234
+ .then((outcome) => {
235
+ if (outcome.ok) setNotice('Card created. Open it to write the task.');
236
+ else setNotice(outcome.error);
237
+ });
238
+ }}
239
+ onDragStart={setDraggingId}
240
+ onDragEnd={() => {
241
+ setDraggingId(null);
242
+ setDropTarget(null);
243
+ }}
244
+ onDropOn={(stageId) => void drop(stageId)}
245
+ onDragOver={setDropTarget}
246
+ />
247
+ ))}
248
+ {unplaced.length > 0 ? (
249
+ <StageColumn
250
+ stage={{ id: 'unplaced', label: 'Unplaced', hidden: false, session: false }}
251
+ cards={unplaced}
252
+ showWorkspace={showWorkspace}
253
+ sessionStateOf={sessionStateOf}
254
+ draggingId={draggingId}
255
+ dropTarget={dropTarget}
256
+ onOpenCard={(id) => {
257
+ setOpenCardId(id);
258
+ void detail.load(id);
259
+ }}
260
+ onAddCard={() => undefined}
261
+ onDragStart={setDraggingId}
262
+ onDragEnd={() => setDraggingId(null)}
263
+ onDropOn={(stageId) => void drop(stageId)}
264
+ onDragOver={setDropTarget}
265
+ />
266
+ ) : null}
267
+ </div>
268
+ </div>
269
+ </div>
270
+
271
+ {openCard ? (
272
+ <CardSheet
273
+ card={openCard}
274
+ stages={live.board.stages}
275
+ board={{ defaults: live.board.defaults as Record<string, unknown>, stages: live.board.stages }}
276
+ catalogs={catalogs}
277
+ activeSessionId={sessionId}
278
+ sessionState={sessionStateOf({
279
+ ...openCard,
280
+ hasPrompt: openCard.task.prompt.length > 0,
281
+ imageCount: openCard.task.images.length,
282
+ })}
283
+ onClose={() => setOpenCardId(null)}
284
+ onSave={async (patch, base) => {
285
+ const outcome = await writes.updateCard(openCard.id, patch, base);
286
+ if (outcome.ok) void detail.load(openCard.id);
287
+ return outcome;
288
+ }}
289
+ onMove={async (status, base) => {
290
+ const outcome = await writes.moveCard(openCard.id, status, base);
291
+ if (outcome.ok) void detail.load(openCard.id);
292
+ return outcome;
293
+ }}
294
+ onDelete={async () => {
295
+ const outcome = await writes.deleteCard(openCard.id);
296
+ if (outcome.ok) setOpenCardId(null);
297
+ return outcome;
298
+ }}
299
+ onStartWork={startWork}
300
+ onLinkSession={async (linkId) => {
301
+ const outcome = await writes.linkSession(openCard.id, linkId);
302
+ if (outcome.ok) void detail.load(openCard.id);
303
+ return outcome;
304
+ }}
305
+ />
306
+ ) : null}
307
+
308
+ {stagesOpen ? (
309
+ <StageSheet
310
+ board={live.board}
311
+ catalogs={catalogs}
312
+ onClose={() => setStagesOpen(false)}
313
+ onSave={async (next) => {
314
+ const outcome = await writes.saveStages(next);
315
+ if (outcome.ok) board.reload();
316
+ return outcome;
317
+ }}
318
+ onSaveDefaults={async (next) => {
319
+ const outcome = await writes.saveDefaults(next);
320
+ if (outcome.ok) board.reload();
321
+ return outcome;
322
+ }}
323
+ />
324
+ ) : null}
325
+ </div>
326
+ );
327
+ }
@@ -0,0 +1,219 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The board's pure view logic, and the request a card dispatches.
8
+ *
9
+ * These are the rules a reader would otherwise have to infer from a render: which
10
+ * stage a hidden lane keeps, which lens a fresh board opens on, and exactly what
11
+ * a Start-work request carries. Each one is a silent bug when wrong — a hidden
12
+ * lane that loses cards, a lens that hides the board, a spawn with the stage
13
+ * prompt in the wrong place.
14
+ */
15
+
16
+ import { describe, expect, test } from 'bun:test';
17
+
18
+ import type { Card, CardSummary, ResolvedAgent, Stage } from '../protocol';
19
+ import { defaultBoard } from '../store/board';
20
+ import { resolveAgent } from '../store/resolve';
21
+ import { followUpBody, modelCommands, startWorkBody, startWork } from './start-work';
22
+ import { defaultLens, lensCards, lensCounts } from './use-board';
23
+ import { visibleStages, unplacedCards } from './index';
24
+ import { originLabel, isOverridden } from './CardSheet';
25
+ import { priorityLabel, promptPreview, workspaceLabel } from './CardTile';
26
+
27
+ function summary(overrides: Partial<CardSummary> = {}): CardSummary {
28
+ return {
29
+ schema: 2,
30
+ id: 'k-aaaaaa',
31
+ title: 'A card',
32
+ status: 'open',
33
+ priority: 2,
34
+ workspace: '/w/alpha',
35
+ sessionId: null,
36
+ createdAt: '2026-01-01T00:00:00.000Z',
37
+ updatedAt: '2026-01-01T00:00:00.000Z',
38
+ movedAt: null,
39
+ hasPrompt: true,
40
+ imageCount: 0,
41
+ ...overrides,
42
+ };
43
+ }
44
+
45
+ function card(overrides: Partial<Card> = {}): Card {
46
+ return {
47
+ schema: 2,
48
+ id: 'k-aaaaaa',
49
+ title: 'A card',
50
+ status: 'in_progress',
51
+ priority: 1,
52
+ workspace: '/w/alpha',
53
+ task: { prompt: 'Fix the portal.', images: [] },
54
+ sessionId: null,
55
+ createdAt: '2026-01-01T00:00:00.000Z',
56
+ updatedAt: '2026-01-01T00:00:00.000Z',
57
+ movedAt: null,
58
+ ...overrides,
59
+ };
60
+ }
61
+
62
+ describe('lenses', () => {
63
+ const cards = [summary(), summary({ id: 'k-bbbbbb', workspace: '/w/beta' }), summary({ id: 'k-cccccc', workspace: null })];
64
+
65
+ test('a workspace is open → that lens; none → everything', () => {
66
+ expect(defaultLens('/w/alpha')).toBe('workspace');
67
+ expect(defaultLens(null)).toBe('all');
68
+ });
69
+
70
+ test('a lens filters and never moves', () => {
71
+ expect(lensCards(cards, 'all', '/w/alpha')).toHaveLength(3);
72
+ expect(lensCards(cards, 'workspace', '/w/alpha').map((entry) => entry.id)).toEqual(['k-aaaaaa']);
73
+ expect(lensCards(cards, 'unfiled', '/w/alpha').map((entry) => entry.id)).toEqual(['k-cccccc']);
74
+ // No workspace open means the workspace lens is empty, not "everything".
75
+ expect(lensCards(cards, 'workspace', null)).toEqual([]);
76
+ });
77
+
78
+ test('the counts let a chip say what is elsewhere', () => {
79
+ expect(lensCounts(cards, '/w/alpha')).toEqual({ all: 3, workspace: 1, unfiled: 1 });
80
+ expect(lensCounts(cards, null)).toEqual({ all: 3, workspace: 0, unfiled: 1 });
81
+ });
82
+ });
83
+
84
+ describe('stages drawn', () => {
85
+ const stages: Stage[] = defaultBoard('2026-01-01T00:00:00.000Z').stages;
86
+
87
+ test('a hidden stage with cards still renders', () => {
88
+ // Hiding quiets a lane; it must never make a card disappear.
89
+ const withReview = [...stages];
90
+ const drawn = visibleStages(withReview, [summary({ status: 'review' })]);
91
+ expect(drawn.map((stage) => stage.id)).toContain('review');
92
+ });
93
+
94
+ test('a hidden empty stage does not', () => {
95
+ expect(visibleStages(stages, [summary()]).map((stage) => stage.id)).not.toContain('review');
96
+ });
97
+
98
+ test('a card whose status matches no stage is Unplaced, not dropped', () => {
99
+ const orphans = unplacedCards(stages, [summary({ status: 'doing' })]);
100
+ expect(orphans.map((entry) => entry.status)).toEqual(['doing']);
101
+ });
102
+ });
103
+
104
+ describe('card face', () => {
105
+ test('priority clamps into P0..P4', () => {
106
+ expect(priorityLabel(0)).toBe('P0');
107
+ expect(priorityLabel(9)).toBe('P4');
108
+ expect(priorityLabel(-1)).toBe('P0');
109
+ });
110
+
111
+ test('the prompt preview says whether there is one, and how many images', () => {
112
+ expect(promptPreview(summary({ hasPrompt: false }))).toBe('no prompt');
113
+ expect(promptPreview(summary({ hasPrompt: true }))).toBe('prompt');
114
+ expect(promptPreview(summary({ hasPrompt: true, imageCount: 2 }))).toBe('prompt · 2 images');
115
+ });
116
+
117
+ test('a workspace reads as its last segment, and null reads as unfiled', () => {
118
+ expect(workspaceLabel('/Users/x/projects/kabmo')).toBe('kabmo');
119
+ expect(workspaceLabel('C:\\work\\alpha')).toBe('alpha');
120
+ expect(workspaceLabel(null)).toBe('unfiled');
121
+ });
122
+ });
123
+
124
+ describe('origin labels', () => {
125
+ const stage: Stage = { id: 'in_progress', label: 'In Progress', hidden: false, session: true };
126
+
127
+ test('each level names itself, so an override is visible before it is made', () => {
128
+ expect(originLabel('card', stage)).toBe('this card');
129
+ expect(originLabel('stage', stage)).toBe('stage: In Progress');
130
+ expect(originLabel('defaults', stage)).toBe('board default');
131
+ expect(originLabel('host', stage)).toBe('host default');
132
+ });
133
+
134
+ test('only a card-level value is an override', () => {
135
+ expect(isOverridden('card')).toBe(true);
136
+ expect(isOverridden('stage')).toBe(false);
137
+ });
138
+ });
139
+
140
+ describe('start work', () => {
141
+ const board = defaultBoard('2026-01-01T00:00:00.000Z');
142
+ const stage = board.stages.find((entry) => entry.id === 'in_progress');
143
+
144
+ test('omp gets the stage prompt as a system prompt and the task as the message', () => {
145
+ const resolved: ResolvedAgent = { ...resolveAgent(card(), stage, board), prompt: 'Work it.' };
146
+ const body = startWorkBody(card(), resolved);
147
+ expect(body.harness).toBe('omp-rpc');
148
+ expect(body.systemPrompt).toBe('Work it.');
149
+ expect(body.message).toBe('Fix the portal.');
150
+ expect(body.cwd).toBe('/w/alpha');
151
+ expect(body.accessMode).toBe('always-ask');
152
+ });
153
+
154
+ test('ACP gets both in the message, because session/new has no field for one', () => {
155
+ // The delivery is derived from the HARNESS, so the stage has to be the one
156
+ // that names an ACP agent — spreading `harness` alone would keep omp's
157
+ // `appended` delivery and quietly test the wrong branch.
158
+ const acpStage: Stage = { ...stage!, agent: { harness: 'claude', prompt: 'Review it.' } };
159
+ const resolved = resolveAgent(card(), acpStage, board);
160
+ expect(resolved.promptDelivery).toBe('prepended');
161
+ const body = startWorkBody(card(), resolved);
162
+ expect(body.systemPrompt).toBeUndefined();
163
+ expect(body.message).toContain('<stage_instructions>');
164
+ expect(body.message).toContain('Review it.');
165
+ expect(body.message.endsWith('Fix the portal.')).toBe(true);
166
+ });
167
+
168
+ test('a card with no workspace is refused before any request is built', () => {
169
+ expect(() => startWorkBody(card({ workspace: null }), resolveAgent(card(), stage, board))).toThrow(/workspace/i);
170
+ });
171
+
172
+ test('a refusal from the route is surfaced verbatim', async () => {
173
+ const resolved = resolveAgent(card(), stage, board);
174
+ const refused = await startWork(card(), resolved, async () => ({ error: 'Mock mode runs no agent process', code: 'mock_mode' }));
175
+ expect(refused).toEqual({ ok: false, error: 'Mock mode runs no agent process' });
176
+ });
177
+
178
+ test('an empty prompt never reaches the route', async () => {
179
+ const resolved = resolveAgent(card(), stage, board);
180
+ let called = false;
181
+ const refused = await startWork(card({ task: { prompt: ' ', images: [] } }), resolved, async () => {
182
+ called = true;
183
+ return { success: true, sessionId: 'x' };
184
+ });
185
+ expect(called).toBe(false);
186
+ expect(refused.ok).toBe(false);
187
+ });
188
+
189
+ test('the answered session id is what links the card', async () => {
190
+ const resolved = resolveAgent(card(), stage, board);
191
+ const started = await startWork(card(), resolved, async () => ({ success: true, sessionId: 'sess-42' }));
192
+ expect(started).toEqual({ ok: true, sessionId: 'sess-42' });
193
+ });
194
+
195
+ test('images ride the request in the shape the route takes', () => {
196
+ const resolved = resolveAgent(card(), stage, board);
197
+ const withImage = card({ task: { prompt: 'Look.', images: [{ name: 'a.png', mimeType: 'image/png', dataBase64: 'AAAA' }] } });
198
+ expect(startWorkBody(withImage, resolved).images).toEqual([{ data: 'AAAA', mimeType: 'image/png' }]);
199
+ });
200
+
201
+ test('a follow-up always prepends, because a live session cannot take a flag', () => {
202
+ const resolved: ResolvedAgent = { ...resolveAgent(card(), stage, board), prompt: 'Rules.' };
203
+ const body = followUpBody(card(), resolved) as { message: string };
204
+ expect(body.message).toContain('<stage_instructions>');
205
+ });
206
+
207
+ test('the model commands are separate verbs, model first', () => {
208
+ const resolved: ResolvedAgent = {
209
+ ...resolveAgent(card(), stage, board),
210
+ model: { provider: 'p', modelId: 'm' },
211
+ thinking: 'high',
212
+ };
213
+ expect(modelCommands(resolved)).toEqual([
214
+ { type: 'set_model', provider: 'p', modelId: 'm' },
215
+ { type: 'set_thinking_level', level: 'high' },
216
+ ]);
217
+ expect(modelCommands({ ...resolved, model: null, thinking: null })).toEqual([]);
218
+ });
219
+ });
@@ -0,0 +1,132 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * Starting work on a card: one call to the route the composer itself uses.
8
+ *
9
+ * `POST /api/agent/new` already does everything a chat's first send does — it
10
+ * resolves the model when the request names none (project default, then the
11
+ * persisted pick), applies `set_model`/`set_thinking_level`, spawns omp or an
12
+ * ACP harness, and runs the first prompt. So the board is not a second spawn
13
+ * path: it fills the request from `resolveAgent` and then records the session id
14
+ * the route answers with.
15
+ *
16
+ * That answer is why there is no pending-session heuristic here. `openNew()`
17
+ * returns nothing and the real id arrives later; this route returns it now, so
18
+ * the card is linked on the same response.
19
+ */
20
+
21
+ import type { Card, ResolvedAgent } from '../protocol';
22
+ import { dispatchText } from '../store/resolve';
23
+
24
+ /** What the route takes, built from a card and its resolved agent. */
25
+ export interface StartWorkBody {
26
+ type: 'prompt';
27
+ cwd: string;
28
+ harness: string;
29
+ message: string;
30
+ accessMode: string;
31
+ systemPrompt?: string;
32
+ provider?: string;
33
+ modelId?: string;
34
+ thinkingLevel?: string;
35
+ skills?: string[];
36
+ images?: { data: string; mimeType: string }[];
37
+ }
38
+
39
+ /**
40
+ * The request a card dispatches.
41
+ *
42
+ * `cwd` is the card's workspace. A card with none cannot be started — the
43
+ * alternative is a chat born in the server's own directory, which is a project
44
+ * nobody chose — so the caller refuses before building this.
45
+ */
46
+ export function startWorkBody(card: Card, resolved: ResolvedAgent): StartWorkBody {
47
+ if (!card.workspace) {
48
+ throw new Error('Pick a workspace for this card before starting work.');
49
+ }
50
+ const { systemPrompt, message } = dispatchText(resolved, card.task.prompt);
51
+ return {
52
+ type: 'prompt',
53
+ cwd: card.workspace,
54
+ harness: resolved.harness,
55
+ message,
56
+ accessMode: resolved.access,
57
+ ...(systemPrompt ? { systemPrompt } : {}),
58
+ ...(resolved.model ? { provider: resolved.model.provider, modelId: resolved.model.modelId } : {}),
59
+ ...(resolved.thinking ? { thinkingLevel: resolved.thinking } : {}),
60
+ ...(resolved.skills.length ? { skills: resolved.skills } : {}),
61
+ ...(card.task.images.length
62
+ ? { images: card.task.images.map((image) => ({ data: image.dataBase64, mimeType: image.mimeType })) }
63
+ : {}),
64
+ };
65
+ }
66
+
67
+ /** What the route answers. */
68
+ interface StartWorkAnswer {
69
+ success?: boolean;
70
+ sessionId?: string;
71
+ error?: string;
72
+ code?: string;
73
+ }
74
+
75
+ export type StartWorkOutcome = { ok: true; sessionId: string } | { ok: false; error: string };
76
+
77
+ /**
78
+ * Spawn the chat for a card.
79
+ *
80
+ * A refusal keeps the sentence the server wrote — `mock_mode`, a missing cwd, an
81
+ * over-long system prompt — because each names something the board cannot
82
+ * reconstruct, and a generic "could not start" would hide which.
83
+ */
84
+ export async function startWork(
85
+ card: Card,
86
+ resolved: ResolvedAgent,
87
+ post: (body: StartWorkBody) => Promise<StartWorkAnswer>,
88
+ ): Promise<StartWorkOutcome> {
89
+ let body: StartWorkBody;
90
+ try {
91
+ body = startWorkBody(card, resolved);
92
+ } catch (cause) {
93
+ return { ok: false, error: cause instanceof Error ? cause.message : String(cause) };
94
+ }
95
+ if (!body.message.trim()) return { ok: false, error: 'This card has no prompt to send.' };
96
+ const answer = await post(body);
97
+ if (answer.success === true && answer.sessionId) return { ok: true, sessionId: answer.sessionId };
98
+ return { ok: false, error: answer.error ?? 'The chat could not be started.' };
99
+ }
100
+
101
+ /**
102
+ * Continue a card's existing session.
103
+ *
104
+ * The stage prompt is PREPENDED here, because a live session's spawn flags are
105
+ * already fixed — the same sentence the card sheet shows.
106
+ */
107
+ export function followUpBody(card: Card, resolved: ResolvedAgent): Record<string, unknown> {
108
+ const { message } = dispatchText({ ...resolved, promptDelivery: 'prepended' }, card.task.prompt);
109
+ return {
110
+ type: 'prompt',
111
+ message,
112
+ ...(card.task.images.length
113
+ ? { images: card.task.images.map((image) => ({ data: image.dataBase64, mimeType: image.mimeType })) }
114
+ : {}),
115
+ };
116
+ }
117
+
118
+ /**
119
+ * The commands a follow-up applies before its prompt.
120
+ *
121
+ * Two commands, not one: `set_model` and `set_thinking_level` are separate RPC
122
+ * verbs, and the queue's delivery applies them in this order for the same
123
+ * reason — a thinking level is only meaningful against the model it will run on.
124
+ */
125
+ export function modelCommands(resolved: ResolvedAgent): Record<string, unknown>[] {
126
+ const commands: Record<string, unknown>[] = [];
127
+ if (resolved.model) {
128
+ commands.push({ type: 'set_model', provider: resolved.model.provider, modelId: resolved.model.modelId });
129
+ }
130
+ if (resolved.thinking) commands.push({ type: 'set_thinking_level', level: resolved.thinking });
131
+ return commands;
132
+ }