@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,148 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The board's client state: one read, one invalidation topic, one lens.
8
+ *
9
+ * The snapshot comes from `openBoard` and is re-read when the plugin's own topic
10
+ * moves. The topic carries a REVISION, never the board, because two writers exist
11
+ * — this panel and the MCP child an agent talks to — and the only thing the
12
+ * panel can cheaply learn from another process is "something changed".
13
+ *
14
+ * The lens is per SESSION state (`useSessionState`), not component state: a
15
+ * plugin panel is unmounted whenever another view is on screen, so a lens kept in
16
+ * `useState` would reset every time the user glanced at Files.
17
+ */
18
+
19
+ import { useCallback, useEffect, useMemo, useState } from 'preact/hooks';
20
+ import { useRpc, useRealtime, useSessionState, usePanelInfo } from '@kabmo-labs/kabmo-ui';
21
+
22
+ import type { BoardRead, BoardSignal, CardSummary } from '../protocol';
23
+
24
+ /** The three lenses a board can show. `null` is the global bucket. */
25
+ export type Lens = 'all' | 'workspace' | 'unfiled';
26
+
27
+ /** Which cards the current lens keeps. */
28
+ export function lensCards(cards: readonly CardSummary[], lens: Lens, workspace: string | null): CardSummary[] {
29
+ if (lens === 'workspace') return workspace ? cards.filter((card) => card.workspace === workspace) : [];
30
+ if (lens === 'unfiled') return cards.filter((card) => card.workspace === null);
31
+ return [...cards];
32
+ }
33
+
34
+ /** The lens a board opens on: this workspace when one is open, else everything. */
35
+ export function defaultLens(workspace: string | null): Lens {
36
+ return workspace ? 'workspace' : 'all';
37
+ }
38
+
39
+ /** How many cards each lens holds, so the chips can say "9 elsewhere". */
40
+ export function lensCounts(cards: readonly CardSummary[], workspace: string | null): Record<Lens, number> {
41
+ return {
42
+ all: cards.length,
43
+ workspace: workspace ? cards.filter((card) => card.workspace === workspace).length : 0,
44
+ unfiled: cards.filter((card) => card.workspace === null).length,
45
+ };
46
+ }
47
+
48
+ export interface BoardState {
49
+ /** The board, or `{ exists: false }` when there is none yet. */
50
+ snapshot: BoardRead | null;
51
+ cards: CardSummary[];
52
+ lens: Lens;
53
+ setLens: (lens: Lens) => void;
54
+ counts: Record<Lens, number>;
55
+ isLoading: boolean;
56
+ /** A read refusal, or the server's sentence when the board cannot be read. */
57
+ error: string | null;
58
+ /** True while the plugin topic says the value may be behind. */
59
+ stale: boolean;
60
+ reload: () => void;
61
+ createBoard: () => Promise<void>;
62
+ /** A write that answers the fresh snapshot, so the panel does not wait for the topic. */
63
+ refreshAfter: <T>(work: () => Promise<T>) => Promise<T>;
64
+ }
65
+
66
+ /** Read the board, follow its topic, and keep the lens. */
67
+ export function useBoard(): BoardState {
68
+ const { workspacePath } = usePanelInfo();
69
+ const rpc = useRpc<Record<string, never>, BoardRead>('openBoard');
70
+ const init = useRpc<Record<string, never>, BoardRead>('initBoard');
71
+ const signal = useRealtime<BoardSignal>();
72
+ const [snapshot, setSnapshot] = useState<BoardRead | null>(null);
73
+ const [error, setError] = useState<string | null>(null);
74
+ const [isLoading, setIsLoading] = useState(true);
75
+ const [storedLens, setStoredLens] = useSessionState<Lens | null>('kanban.lens', null);
76
+
77
+ // A workspace is open → that lens; none → everything. A stored choice wins
78
+ // only while it still names something, so a lens picked in one workspace does
79
+ // not hide the board in a session that has no workspace at all.
80
+ const lens: Lens = storedLens ?? defaultLens(workspacePath);
81
+ const setLens = useCallback((next: Lens) => setStoredLens(next), [setStoredLens]);
82
+
83
+ const read = useCallback(async () => {
84
+ const outcome = await rpc.call({});
85
+ if (outcome.ok) {
86
+ // Absence is a value (`exists: false`), so this branch is the only place
87
+ // the panel decides between the board and the Create screen.
88
+ setSnapshot(outcome.value as BoardRead);
89
+ setError(null);
90
+ } else {
91
+ setError(outcome.error.message);
92
+ }
93
+ setIsLoading(false);
94
+ }, [rpc]);
95
+
96
+ useEffect(() => {
97
+ void read();
98
+ // `read` is stable per method id; a mount is the only trigger here.
99
+ // eslint-disable-next-line react-hooks/exhaustive-deps
100
+ }, []);
101
+
102
+ // The topic moves for THIS panel's writes and for an agent's (the watcher).
103
+ useEffect(() => {
104
+ if (!signal.value) return;
105
+ void read();
106
+ // eslint-disable-next-line react-hooks/exhaustive-deps
107
+ }, [signal.value?.revision]);
108
+
109
+ const createBoard = useCallback(async () => {
110
+ const outcome = await init.call({});
111
+ if (outcome.ok) {
112
+ setSnapshot(outcome.value as BoardRead);
113
+ setError(null);
114
+ } else {
115
+ setError(outcome.error.message);
116
+ }
117
+ }, [init]);
118
+
119
+ const refreshAfter = useCallback(
120
+ async <T,>(work: () => Promise<T>): Promise<T> => {
121
+ const value = await work();
122
+ await read();
123
+ return value;
124
+ },
125
+ [read],
126
+ );
127
+
128
+ const boardCards = snapshot?.exists ? snapshot.cards : [];
129
+ const cards = useMemo(() => lensCards(boardCards, lens, workspacePath), [boardCards, lens, workspacePath]);
130
+ const counts = useMemo(
131
+ () => lensCounts(boardCards, workspacePath),
132
+ [boardCards, workspacePath],
133
+ );
134
+
135
+ return {
136
+ snapshot,
137
+ cards,
138
+ lens,
139
+ setLens,
140
+ counts,
141
+ isLoading,
142
+ error,
143
+ stale: signal.stale,
144
+ reload: () => void read(),
145
+ createBoard,
146
+ refreshAfter,
147
+ };
148
+ }
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * One card's detail, read on demand.
8
+ *
9
+ * The board's snapshot is deliberately slim (no prompt, no images), so opening a
10
+ * card is its own read. That keeps a 500-card board cheap and still gives the
11
+ * sheet everything it needs — including the stage the card belongs to and the
12
+ * agent that stage resolves to.
13
+ */
14
+
15
+ import { useCallback, useState } from 'preact/hooks';
16
+ import { useRpc } from '@kabmo-labs/kabmo-ui';
17
+
18
+ import type { Card, ResolvedAgent, Stage } from '../protocol';
19
+
20
+ /** What `readCard` answers. */
21
+ export interface CardDetailAnswer {
22
+ card: Card;
23
+ board: { stages: Stage[]; defaults: Record<string, unknown> };
24
+ stage: Stage | null;
25
+ agent: ResolvedAgent;
26
+ }
27
+
28
+ /** The card on screen, and the read that fetched it. */
29
+ export function useCardDetail(): {
30
+ card: Card | null;
31
+ agent: ResolvedAgent | null;
32
+ error: string | null;
33
+ load: (id: string) => Promise<void>;
34
+ clear: () => void;
35
+ } {
36
+ const rpc = useRpc<{ id: string }, CardDetailAnswer>('readCard');
37
+ const [card, setCard] = useState<Card | null>(null);
38
+ const [agent, setAgent] = useState<ResolvedAgent | null>(null);
39
+ const [error, setError] = useState<string | null>(null);
40
+
41
+ const load = useCallback(
42
+ async (id: string) => {
43
+ const outcome = await rpc.call({ id });
44
+ if (outcome.ok) {
45
+ const answer = outcome.value as CardDetailAnswer;
46
+ setCard(answer.card);
47
+ setAgent(answer.agent);
48
+ setError(null);
49
+ } else {
50
+ // The card vanished under us (an agent deleted it): say so and close.
51
+ setCard(null);
52
+ setAgent(null);
53
+ setError(outcome.error.message);
54
+ }
55
+ },
56
+ [rpc],
57
+ );
58
+
59
+ return {
60
+ card,
61
+ agent,
62
+ error,
63
+ load,
64
+ clear: () => {
65
+ setCard(null);
66
+ setAgent(null);
67
+ setError(null);
68
+ },
69
+ };
70
+ }
@@ -0,0 +1,123 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The board's writes, in one place so the panel never builds a call by hand.
8
+ *
9
+ * Two kinds of write live here and they are deliberately different:
10
+ *
11
+ * - **Board writes** go through the plugin's own RPC, which takes the file lock
12
+ * and answers the fresh snapshot.
13
+ * - **Starting work** goes to `/api/agent/new`, the route the chat composer
14
+ * itself uses. The board does not spawn anything: it fills the request from
15
+ * `resolveAgent` and links the session id the route answers with.
16
+ *
17
+ * A refusal is returned, never thrown: the sheet shows the server's own sentence
18
+ * ("This card changed on disk", "Pick a workspace") instead of a stack trace.
19
+ */
20
+
21
+ import { useCallback } from 'preact/hooks';
22
+ import { useRpc } from '@kabmo-labs/kabmo-ui';
23
+
24
+ import type { Card, ResolvedAgent, Stage } from '../protocol';
25
+ import { startWork, type StartWorkBody, type StartWorkOutcome } from './start-work';
26
+
27
+ /** What a write answers. */
28
+ export type WriteOutcome<T> = { ok: true; value: T } | { ok: false; error: string };
29
+
30
+ /** The answer `moveCard` gives, which carries the Start-work hint. */
31
+ export interface MoveAnswer {
32
+ card: Card;
33
+ next?: 'start_work_required';
34
+ revision: number;
35
+ }
36
+
37
+ /** The POST the panel makes to spawn a chat. */
38
+ async function postStartWork(body: StartWorkBody): Promise<Record<string, unknown>> {
39
+ const response = await fetch('/api/agent/new', {
40
+ method: 'POST',
41
+ headers: { 'content-type': 'application/json' },
42
+ credentials: 'same-origin',
43
+ body: JSON.stringify(body),
44
+ });
45
+ return (await response.json().catch(() => ({}))) as Record<string, unknown>;
46
+ }
47
+
48
+ /** The RPC methods the panel calls, with the outcome flattened to one shape. */
49
+ export function useWrites(onChanged: () => void) {
50
+ const create = useRpc('createCard');
51
+ const update = useRpc('updateCard');
52
+ const move = useRpc('moveCard');
53
+ const remove = useRpc('deleteCard');
54
+ const link = useRpc('linkSession');
55
+ const claim = useRpc('claimCard');
56
+ const stages = useRpc('saveStages');
57
+ const defaults = useRpc('saveDefaults');
58
+
59
+ const settle = useCallback(
60
+ async <T,>(outcome: { ok: boolean; value?: unknown; error?: { message: string } }): Promise<WriteOutcome<T>> => {
61
+ if (outcome.ok) {
62
+ onChanged();
63
+ return { ok: true, value: outcome.value as T };
64
+ }
65
+ return { ok: false, error: outcome.error?.message ?? 'The board refused that write.' };
66
+ },
67
+ [onChanged],
68
+ );
69
+
70
+ return {
71
+ createCard: useCallback(
72
+ async (input: { title: string; status?: string; workspace?: string | null; priority?: number }) =>
73
+ settle<{ card: Card }>(await create.call(input)),
74
+ [create, settle],
75
+ ),
76
+ updateCard: useCallback(
77
+ async (id: string, patch: Record<string, unknown>, baseUpdatedAt?: string) =>
78
+ settle<{ card: Card }>(await update.call({ id, patch, baseUpdatedAt })),
79
+ [settle, update],
80
+ ),
81
+ moveCard: useCallback(
82
+ async (id: string, status: string, baseUpdatedAt?: string) =>
83
+ settle<MoveAnswer>(await move.call({ id, status, baseUpdatedAt })),
84
+ [move, settle],
85
+ ),
86
+ deleteCard: useCallback(async (id: string) => settle<unknown>(await remove.call({ id })), [remove, settle]),
87
+ linkSession: useCallback(
88
+ async (id: string, sessionId: string | null) => settle<{ card: Card }>(await link.call({ id, sessionId })),
89
+ [link, settle],
90
+ ),
91
+ claimCard: useCallback(
92
+ async (id: string, sessionId?: string) => settle<{ card: Card }>(await claim.call({ id, sessionId })),
93
+ [claim, settle],
94
+ ),
95
+ saveStages: useCallback(
96
+ async (next: Stage[]) => settle<{ board: { stages: Stage[] } }>(await stages.call({ stages: next })),
97
+ [settle, stages],
98
+ ),
99
+ saveDefaults: useCallback(
100
+ async (next: Record<string, unknown>) => settle<{ board: unknown }>(await defaults.call({ defaults: next })),
101
+ [defaults, settle],
102
+ ),
103
+ /**
104
+ * Start the card's chat, then link it.
105
+ *
106
+ * The link is a SECOND write and it is deliberate: the spawn already
107
+ * happened, so a failed link must not read as a failed start. The sentence
108
+ * names which half landed.
109
+ */
110
+ startWork: useCallback(
111
+ async (card: Card, resolved: ResolvedAgent): Promise<StartWorkOutcome> => {
112
+ const started = await startWork(card, resolved, postStartWork);
113
+ if (!started.ok) return started;
114
+ const linked = await settle<{ card: Card }>(await claim.call({ id: card.id, sessionId: started.sessionId }));
115
+ if (!linked.ok) {
116
+ return { ok: false, error: `The chat started (${started.sessionId.slice(0, 8)}…) but the card was not linked: ${linked.error}` };
117
+ }
118
+ return started;
119
+ },
120
+ [claim, settle],
121
+ ),
122
+ };
123
+ }
@@ -0,0 +1,180 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The shapes both halves of the Kanban share.
8
+ *
9
+ * The panel (a browser), the plugin's server half (Kabmo's process) and the MCP
10
+ * child (its own process) all read and write the SAME files, so every type here
11
+ * is the file format itself rather than a wire-only shape. Two rules follow:
12
+ *
13
+ * - **A card is a CONTROL record.** Title, stage, priority, workspace, the task
14
+ * (prompt + images + agent picks) and the linked session. No description, no
15
+ * comments, no labels — the board drives work, it does not hold knowledge.
16
+ * - **A stage carries the agent configuration**, so moving a card into Review
17
+ * can change the harness and the system prompt. Resolution is per FIELD and
18
+ * its chain is `card → stage → board defaults → host default`, which is what
19
+ * `resolveAgent` reports so the sheet can say where each value came from.
20
+ */
21
+
22
+ /** The agent settings a card, a stage or the board may name. Every field optional. */
23
+ export interface AgentSpec {
24
+ /** A harness id from the host's catalog (`omp-rpc`, `claude`, …). */
25
+ harness?: string;
26
+ /** `provider` + `modelId`, as the host's pickers name them. */
27
+ model?: { provider: string; modelId: string } | null;
28
+ /** A thinking level the harness publishes, or `null` for its own default. */
29
+ thinking?: string | null;
30
+ /** An approval mode (`always-ask`, `write`, `yolo`). */
31
+ access?: string;
32
+ /** Appended to omp's own system prompt; prepended to the first turn on ACP. */
33
+ prompt?: string;
34
+ /** Comma-free globs that narrow the skill catalog for a spawned session. */
35
+ skills?: string[];
36
+ }
37
+
38
+ /** One stage (a column). `session` marks the stages that run an agent. */
39
+ export interface Stage {
40
+ id: string;
41
+ label: string;
42
+ hidden: boolean;
43
+ /** True when landing here should start (or continue) a session. */
44
+ session: boolean;
45
+ agent?: AgentSpec;
46
+ }
47
+
48
+ /** `board.json`. */
49
+ export interface Board {
50
+ schema: 2;
51
+ defaults: AgentSpec;
52
+ stages: Stage[];
53
+ updatedAt: string;
54
+ }
55
+
56
+ /** One image a card carries, in the shape the queue persists. */
57
+ export interface TaskImage {
58
+ name: string;
59
+ mimeType: string;
60
+ dataBase64: string;
61
+ }
62
+
63
+ /** The task a card dispatches — a queue message with picks. */
64
+ export interface CardTask {
65
+ prompt: string;
66
+ images: TaskImage[];
67
+ agent?: AgentSpec;
68
+ }
69
+
70
+ /** `cards/<id>.json`. */
71
+ export interface Card {
72
+ schema: 2;
73
+ id: string;
74
+ title: string;
75
+ status: string;
76
+ priority: number;
77
+ workspace: string | null;
78
+ task: CardTask;
79
+ sessionId: string | null;
80
+ createdAt: string;
81
+ updatedAt: string;
82
+ movedAt: string | null;
83
+ }
84
+
85
+ /** A card as the board list carries it: no prompt, no images. */
86
+ export type CardSummary = Omit<Card, 'task'> & { hasPrompt: boolean; imageCount: number };
87
+
88
+ /** One file the board could not read, named so the panel can show it. */
89
+ export interface BoardError {
90
+ path: string;
91
+ message: string;
92
+ }
93
+
94
+ /** One card plus the board it belongs to — what the card sheet reads. */
95
+ export interface CardDetail {
96
+ card: Card;
97
+ board: Board;
98
+ }
99
+
100
+ /** What `openBoard` answers. */
101
+ export interface BoardSnapshot {
102
+ dataDir: string;
103
+ revision: number;
104
+ board: Board;
105
+ cards: CardSummary[];
106
+ errors: BoardError[];
107
+ }
108
+
109
+ /**
110
+ * What `openBoard` answers.
111
+ *
112
+ * "No board yet" is a STATE, not a transport error: a panel that had to parse a
113
+ * refusal CODE to decide whether to offer Create would break the day the plugin
114
+ * route re-wrapped its errors (it does — a thrown handler becomes
115
+ * `handler_error`). The absence is therefore a value the type can see.
116
+ */
117
+ export type BoardRead = ({ exists: true } & BoardSnapshot) | { exists: false; dataDir: string };
118
+
119
+ /** The plugin's realtime topic: an invalidation signal, never the board itself. */
120
+ export interface BoardSignal {
121
+ revision: number;
122
+ at: string;
123
+ }
124
+
125
+ /** Which level a resolved field came from. */
126
+ export type AgentOrigin = 'card' | 'stage' | 'defaults' | 'host';
127
+
128
+ /** A resolved agent, with the origin of every field the sheet displays. */
129
+ export interface ResolvedAgent {
130
+ harness: string;
131
+ model: { provider: string; modelId: string } | null;
132
+ thinking: string | null;
133
+ access: string;
134
+ prompt: string;
135
+ skills: string[];
136
+ origin: {
137
+ harness: AgentOrigin;
138
+ model: AgentOrigin;
139
+ thinking: AgentOrigin;
140
+ access: AgentOrigin;
141
+ prompt: AgentOrigin;
142
+ skills: AgentOrigin;
143
+ };
144
+ /** How the prompt reaches the agent on this transport. */
145
+ promptDelivery: 'appended' | 'prepended';
146
+ }
147
+
148
+ /** The RPC refusal codes. A refusal is a value, never a thrown transport error. */
149
+ export type KanbanErrorCode =
150
+ | 'no_board'
151
+ | 'not_found'
152
+ | 'invalid'
153
+ | 'stale'
154
+ | 'no_workspace'
155
+ | 'io';
156
+
157
+ /** The stages a fresh board starts with. `session` marks the working lanes. */
158
+ export const DEFAULT_STAGES: readonly Stage[] = [
159
+ { id: 'backlog', label: 'Backlog', hidden: false, session: false },
160
+ { id: 'open', label: 'Todo', hidden: false, session: false },
161
+ { id: 'in_progress', label: 'In Progress', hidden: false, session: true },
162
+ { id: 'review', label: 'Review', hidden: true, session: true },
163
+ { id: 'test', label: 'Test', hidden: true, session: false },
164
+ { id: 'done', label: 'Done', hidden: false, session: false },
165
+ ];
166
+
167
+ /** The stage a card moves to when work starts on it. */
168
+ export const START_STAGE = 'in_progress';
169
+
170
+ /** A stage id: lowercase, underscore-separated, and short enough to be a filename. */
171
+ export const STAGE_ID = /^[a-z][a-z0-9_]{0,31}$/;
172
+ /** A card id. Six hex characters after the prefix. */
173
+ export const CARD_ID = /^k-[0-9a-f]{6}$/;
174
+
175
+ /** The largest system prompt a stage may carry (the host caps it again). */
176
+ export const MAX_PROMPT_CHARS = 8_192;
177
+ /** How many images one card may hold. */
178
+ export const MAX_IMAGES = 4;
179
+ /** The byte ceiling for one card's images, decoded. */
180
+ export const MAX_IMAGE_BYTES = 2 * 1024 * 1024;
@@ -0,0 +1,113 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The plugin's server half, driven through the SDK's own API object.
8
+ *
9
+ * What this pins is the ONE thing the store cannot: an agent's write is a FILE
10
+ * EVENT, and the panel only learns about it because this half publishes a new
11
+ * revision. The MCP child is a separate process, so nothing else in the plugin
12
+ * could notice.
13
+ */
14
+
15
+ import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
16
+ import fs from 'fs';
17
+ import os from 'os';
18
+ import path from 'path';
19
+
20
+ import type { KabmoPluginApi, PluginJson } from '@kabmo-labs/kabmo-sdk';
21
+
22
+ import plugin from './server';
23
+ import { addCard, createBoard, moveCard } from './store/ops';
24
+ import { cardFile } from './store/fs';
25
+ import type { BoardSignal } from './protocol';
26
+
27
+ let dataDir = '';
28
+ let published: BoardSignal[] = [];
29
+ let disposed: (() => void | Promise<void>)[] = [];
30
+
31
+ /** The smallest API that satisfies the members `plugin()` touches. */
32
+ function fakeApi(): KabmoPluginApi {
33
+ return {
34
+ pluginId: 'kanban',
35
+ paths: { dataDir },
36
+ log: { debug() {}, info() {}, warn() {}, error() {} },
37
+ realtime: {
38
+ seed(value: PluginJson) {
39
+ published = [value as unknown as BoardSignal];
40
+ },
41
+ publish(value: PluginJson) {
42
+ published.push(value as unknown as BoardSignal);
43
+ },
44
+ current: () => published[published.length - 1],
45
+ },
46
+ rpc: { register: () => () => {} },
47
+ mcp: { register: () => undefined },
48
+ onDispose(hook: () => void | Promise<void>) {
49
+ disposed.push(hook);
50
+ },
51
+ } as unknown as KabmoPluginApi;
52
+ }
53
+
54
+ beforeEach(() => {
55
+ dataDir = fs.mkdtempSync(path.join(os.tmpdir(), 'kanban-server-'));
56
+ published = [];
57
+ disposed = [];
58
+ });
59
+
60
+ afterEach(async () => {
61
+ for (const hook of disposed) await hook();
62
+ fs.rmSync(dataDir, { recursive: true, force: true });
63
+ });
64
+
65
+ describe('the board watcher', () => {
66
+ test('an agent writing a card file publishes a new revision', async () => {
67
+ await createBoard(dataDir);
68
+ plugin(fakeApi());
69
+ // Seeded at load, so a subscriber that arrives first has a value.
70
+ expect(published).toHaveLength(1);
71
+ expect(published[0]).toEqual({ revision: 0, at: expect.any(String) });
72
+
73
+ const card = await addCard(dataDir, { title: 'Agent work' });
74
+ await moveCard(dataDir, card.id, 'review');
75
+
76
+ // `fs.watch` delivery is asynchronous, so the wait polls — but it must not
77
+ // KEEP WRITING: the publish is debounced, and a write every 50 ms clears the
78
+ // timer before it can fire (measured: the loop starved its own assertion).
79
+ const deadline = Date.now() + 5_000;
80
+ while (published.length < 2 && Date.now() < deadline) await Bun.sleep(25);
81
+ expect(published.length).toBeGreaterThan(1);
82
+ expect(published[published.length - 1]!.revision).toBeGreaterThan(0);
83
+ }, 10_000);
84
+
85
+ test('a burst of writes collapses into one publish', async () => {
86
+ await createBoard(dataDir);
87
+ plugin(fakeApi());
88
+ const before = published.length;
89
+ const card = await addCard(dataDir, { title: 'Burst' });
90
+ for (const status of ['backlog', 'open', 'in_progress', 'review', 'test', 'done']) {
91
+ await moveCard(dataDir, card.id, status);
92
+ }
93
+ await Bun.sleep(400);
94
+ // Six writes in a few milliseconds must not be six frames.
95
+ expect(published.length - before).toBeLessThan(3);
96
+ }, 10_000);
97
+
98
+ test('dispose closes the watcher: a later write publishes nothing', async () => {
99
+ await createBoard(dataDir);
100
+ plugin(fakeApi());
101
+ for (const hook of disposed) await hook();
102
+ const before = published.length;
103
+ await addCard(dataDir, { title: 'After dispose' });
104
+ await Bun.sleep(300);
105
+ expect(published.length).toBe(before);
106
+ }, 10_000);
107
+
108
+ test('the board directory is created so a first run has somewhere to watch', () => {
109
+ plugin(fakeApi());
110
+ expect(fs.existsSync(path.join(dataDir, 'kanban', 'cards'))).toBe(true);
111
+ expect(fs.existsSync(cardFile(dataDir, 'k-abcdef'))).toBe(false);
112
+ });
113
+ });