@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,199 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The MCP surface an agent actually uses.
8
+ *
9
+ * Two properties are what make this worth a test rather than a smoke check:
10
+ *
11
+ * - **A refusal is a RESULT.** The agent has to read "stage \"nope\" does not
12
+ * exist" and retry with a real one; a JSON-RPC error frame would look like a
13
+ * broken server and most clients stop calling.
14
+ * - **A move into a session stage does NOT spawn anything.** It answers
15
+ * `next: "start_work_required"`, which is the contract the panel relies on to
16
+ * offer the button instead of a chat appearing from nowhere.
17
+ */
18
+
19
+ import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
20
+ import fs from 'fs';
21
+ import os from 'os';
22
+ import path from 'path';
23
+
24
+ import { handleRpcFrame, type JsonRpcReply } from './mcp';
25
+ import { TOOLS } from './mcp-tools';
26
+ import { addCard, createBoard, linkSession } from './store/ops';
27
+
28
+ let dataDir = '';
29
+
30
+ beforeEach(async () => {
31
+ dataDir = fs.mkdtempSync(path.join(os.tmpdir(), 'kanban-mcp-'));
32
+ await createBoard(dataDir);
33
+ });
34
+
35
+ afterEach(() => {
36
+ fs.rmSync(dataDir, { recursive: true, force: true });
37
+ });
38
+
39
+ /** The text a tool result carries, validated rather than cast. */
40
+ function resultText(reply: JsonRpcReply | null, name: string): { text: string; isError: boolean } {
41
+ const result = reply?.result;
42
+ if (!result || typeof result !== 'object' || !('content' in result)) {
43
+ throw new Error(`no result for ${name}: ${JSON.stringify(reply)}`);
44
+ }
45
+ const { content, isError } = result as { content?: unknown; isError?: unknown };
46
+ if (!Array.isArray(content) || content.length === 0) throw new Error(`no content for ${name}`);
47
+ const first: unknown = content[0];
48
+ if (!first || typeof first !== 'object' || !('text' in first) || typeof first.text !== 'string') {
49
+ throw new Error(`no text for ${name}`);
50
+ }
51
+ return { text: first.text, isError: isError === true };
52
+ }
53
+
54
+ /** Call one tool the way a client does, and parse the JSON the result carries. */
55
+ async function call<T>(name: string, args: Record<string, unknown>): Promise<{ value: T; isError: boolean }> {
56
+ const reply = await handleRpcFrame(dataDir, {
57
+ jsonrpc: '2.0',
58
+ id: 1,
59
+ method: 'tools/call',
60
+ params: { name, arguments: args },
61
+ });
62
+ const { text, isError } = resultText(reply, name);
63
+ return { value: JSON.parse(text) as T, isError };
64
+ }
65
+
66
+ describe('protocol', () => {
67
+ test('initialize names the server and its tool capability', async () => {
68
+ const reply = await handleRpcFrame(dataDir, { jsonrpc: '2.0', id: 1, method: 'initialize' });
69
+ const result = reply?.result as { serverInfo: { name: string }; capabilities: { tools: unknown } };
70
+ expect(result.serverInfo.name).toBe('kanban');
71
+ expect(result.capabilities.tools).toBeDefined();
72
+ });
73
+
74
+ test('tools/list describes every tool with an input schema', async () => {
75
+ const reply = await handleRpcFrame(dataDir, { jsonrpc: '2.0', id: 2, method: 'tools/list' });
76
+ const tools = (reply?.result as { tools: { name: string; inputSchema: unknown }[] }).tools;
77
+ expect(tools.map((tool) => tool.name)).toEqual(TOOLS.map((tool) => tool.name));
78
+ for (const tool of tools) expect(tool.inputSchema).toBeDefined();
79
+ });
80
+
81
+ test('a notification gets no reply, and an unknown method is refused', async () => {
82
+ expect(await handleRpcFrame(dataDir, { jsonrpc: '2.0', method: 'notifications/initialized' })).toBeNull();
83
+ const reply = await handleRpcFrame(dataDir, { jsonrpc: '2.0', id: 3, method: 'nope' });
84
+ expect(reply?.error?.code).toBe(-32601);
85
+ });
86
+
87
+ test('an unknown tool is a protocol error naming it', async () => {
88
+ const reply = await handleRpcFrame(dataDir, {
89
+ jsonrpc: '2.0', id: 4, method: 'tools/call', params: { name: 'nope', arguments: {} },
90
+ });
91
+ expect(reply?.error?.message).toContain('nope');
92
+ });
93
+ });
94
+
95
+ describe('the tools', () => {
96
+ test('create then list round-trips through the same files the panel reads', async () => {
97
+ const created = await call('kanban_create', { title: 'From the agent', prompt: 'do it', workspace: '/w' });
98
+ const card = (created.value as { card: { id: string; status: string } }).card;
99
+ expect(card.id).toMatch(/^k-/);
100
+ expect(card.status).toBe('open');
101
+
102
+ const listed = await call('kanban_list', {});
103
+ const rows = (listed.value as { cards: { id: string; title: string }[] }).cards;
104
+ expect(rows).toHaveLength(1);
105
+ expect(rows[0]!.id).toBe(card.id);
106
+ // The row is SLIM: a board of 500 cards must not carry 500 prompts.
107
+ expect(rows[0]).not.toHaveProperty('task');
108
+ });
109
+
110
+ test('move into a working stage asks for Start work and spawns nothing', async () => {
111
+ const created = await call('kanban_create', { title: 'Work' });
112
+ const id = (created.value as { card: { id: string } }).card.id;
113
+ const moved = await call('kanban_move', { id, status: 'in_progress' });
114
+ expect(moved.isError).toBe(false);
115
+ expect((moved.value as { next?: string }).next).toBe('start_work_required');
116
+ });
117
+
118
+ test('a linked card moves without asking', async () => {
119
+ const created = await call('kanban_create', { title: 'Linked' });
120
+ const id = (created.value as { card: { id: string } }).card.id;
121
+ await linkSession(dataDir, id, 'sess-1');
122
+ const moved = await call('kanban_move', { id, status: 'review' });
123
+ expect((moved.value as { next?: string }).next).toBeUndefined();
124
+ });
125
+
126
+ test('claim records the session and lands in the working stage', async () => {
127
+ const created = await call('kanban_create', { title: 'Claim' });
128
+ const id = (created.value as { card: { id: string } }).card.id;
129
+ const claimed = await call('kanban_claim', { id, session_id: 'sess-7' });
130
+ const card = (claimed.value as { card: { status: string; sessionId: string } }).card;
131
+ expect(card.sessionId).toBe('sess-7');
132
+ expect(card.status).toBe('in_progress');
133
+ });
134
+
135
+ test('next offers the highest priority card with its stage prompt', async () => {
136
+ const low = await call('kanban_create', { title: 'Low', priority: 4 });
137
+ const urgent = await call('kanban_create', { title: 'Urgent', priority: 0 });
138
+ const next = await call('kanban_next', {});
139
+ const value = next.value as { card: { id: string }; agent: { harness: string } };
140
+ expect(value.card.id).toBe((urgent.value as { card: { id: string } }).card.id);
141
+ expect(value.card.id).not.toBe((low.value as { card: { id: string } }).card.id);
142
+ expect(value.agent.harness).toBe('omp-rpc');
143
+ });
144
+
145
+ test('an unknown stage is a readable refusal, not a broken server', async () => {
146
+ const created = await call('kanban_create', { title: 'x' });
147
+ const id = (created.value as { card: { id: string } }).card.id;
148
+ const moved = await call('kanban_move', { id, status: 'nope' });
149
+ expect(moved.isError).toBe(true);
150
+ expect((moved.value as { code: string; message: string }).code).toBe('invalid');
151
+ expect((moved.value as { message: string }).message).toContain('nope');
152
+ });
153
+
154
+ test('a bad id never reaches the filesystem', async () => {
155
+ const moved = await call('kanban_move', { id: '../../etc/passwd', status: 'open' });
156
+ expect(moved.isError).toBe(true);
157
+ const read = await call('kanban_get', { id: '../../etc/passwd' });
158
+ expect(read.isError).toBe(true);
159
+ });
160
+
161
+ test('get carries the resolved agent and the stage it came from', async () => {
162
+ const created = await call('kanban_create', { title: 'Detail' });
163
+ const id = (created.value as { card: { id: string } }).card.id;
164
+ const detail = await call('kanban_get', { id });
165
+ const value = detail.value as { stage: { id: string } | null; agent: { harness: string; origin: { harness: string } } };
166
+ expect(value.stage?.id).toBe('open');
167
+ expect(value.agent.origin.harness).toBe('host');
168
+ });
169
+
170
+ test('update touches only the fields named', async () => {
171
+ const created = await call('kanban_create', { title: 'Edit me', prompt: 'first' });
172
+ const id = (created.value as { card: { id: string } }).card.id;
173
+ await call('kanban_update', { id, priority: 1 });
174
+ const detail = await call('kanban_get', { id });
175
+ const card = (detail.value as { card: { priority: number; task: { prompt: string }; title: string } }).card;
176
+ expect(card.priority).toBe(1);
177
+ expect(card.task.prompt).toBe('first');
178
+ expect(card.title).toBe('Edit me');
179
+ });
180
+
181
+ test('stages can be read and replaced, and a bad id is refused', async () => {
182
+ const read = await call('kanban_stages', {});
183
+ const stages = (read.value as { stages: { id: string; label: string }[] }).stages;
184
+ expect(stages.length).toBe(6);
185
+
186
+ const replaced = await call('kanban_stages', { stages: [...stages, { id: 'ship', label: 'Ship' }] });
187
+ expect((replaced.value as { board: { stages: { id: string }[] } }).board.stages.map((stage) => stage.id)).toContain('ship');
188
+
189
+ const refused = await call('kanban_stages', { stages: [{ id: 'Bad Id', label: 'X' }] });
190
+ expect(refused.isError).toBe(true);
191
+ });
192
+
193
+ test('delete removes the file', async () => {
194
+ const card = await addCard(dataDir, { title: 'Bye' });
195
+ const removed = await call('kanban_delete', { id: card.id });
196
+ expect((removed.value as { deleted: string }).deleted).toBe(card.id);
197
+ expect(fs.existsSync(path.join(dataDir, 'kanban', 'cards', `${card.id}.json`))).toBe(false);
198
+ });
199
+ });
@@ -0,0 +1,148 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The MCP server an agent talks to.
8
+ *
9
+ * It is the SAME bundle as the plugin's server half: `server.js --mcp` runs this
10
+ * module's `runMcpServer` instead of registering a plugin. That is deliberate —
11
+ * one build, one copy of the store rules, and no second package to publish.
12
+ *
13
+ * Transport is stdio with newline-delimited JSON-RPC 2.0, which is what every
14
+ * MCP client speaks for a local server. The three methods that matter are
15
+ * `initialize`, `tools/list` and `tools/call`; anything else answers a protocol
16
+ * error rather than silence, because a client that gets no reply waits.
17
+ *
18
+ * The board's data directory arrives in the environment (`KANBAN_DATA_DIR`), not
19
+ * as an argument: a plugin MCP registration has no `cwd` field, and a child that
20
+ * guessed from the agent's directory would read a different board than the panel.
21
+ *
22
+ * The tool table itself is `mcp-tools.ts`; this file owns framing and refusals.
23
+ */
24
+
25
+ import { KanbanError } from './store/fs';
26
+ import { TOOLS, toolNamed } from './mcp-tools';
27
+
28
+ /** A JSON-RPC reply frame. */
29
+ export interface JsonRpcReply {
30
+ jsonrpc: '2.0';
31
+ id: unknown;
32
+ result?: unknown;
33
+ error?: { code: number; message: string; data?: unknown };
34
+ }
35
+
36
+ /**
37
+ * Handle one JSON-RPC frame. Exported so a test can drive the protocol without
38
+ * spawning a process.
39
+ */
40
+ export async function handleRpcFrame(dataDir: string, frame: unknown): Promise<JsonRpcReply | null> {
41
+ const request = (frame ?? {}) as Record<string, unknown>;
42
+ const id = request.id ?? null;
43
+ const method = typeof request.method === 'string' ? request.method : '';
44
+ // A NOTIFICATION (no id) never gets a reply — that is the protocol, not a bug.
45
+ const isNotification = request.id === undefined;
46
+
47
+ try {
48
+ if (method === 'initialize') {
49
+ return {
50
+ jsonrpc: '2.0',
51
+ id,
52
+ result: {
53
+ protocolVersion: '2024-11-05',
54
+ capabilities: { tools: { listChanged: false } },
55
+ serverInfo: { name: 'kanban', version: '1.0.0' },
56
+ },
57
+ };
58
+ }
59
+ if (method === 'tools/list') {
60
+ return {
61
+ jsonrpc: '2.0',
62
+ id,
63
+ result: {
64
+ tools: TOOLS.map((tool) => ({
65
+ name: tool.name,
66
+ description: tool.description,
67
+ inputSchema: tool.inputSchema,
68
+ })),
69
+ },
70
+ };
71
+ }
72
+ if (method === 'tools/call') {
73
+ const params = (request.params ?? {}) as Record<string, unknown>;
74
+ const name = typeof params.name === 'string' ? params.name : '';
75
+ const tool = toolNamed(name);
76
+ if (!tool) {
77
+ return { jsonrpc: '2.0', id, error: { code: -32602, message: `Unknown tool "${name}".` } };
78
+ }
79
+ const args = (params.arguments ?? {}) as Record<string, unknown>;
80
+ try {
81
+ const value = await tool.run(dataDir, args);
82
+ return {
83
+ jsonrpc: '2.0',
84
+ id,
85
+ result: { content: [{ type: 'text', text: JSON.stringify(value, null, 2) }], isError: false },
86
+ };
87
+ } catch (cause) {
88
+ // A refusal is a RESULT the agent can read and act on, not a transport
89
+ // error: it must see "stage does not exist", not "the server broke".
90
+ const error = cause instanceof KanbanError ? cause : null;
91
+ const message = cause instanceof Error ? cause.message : String(cause);
92
+ return {
93
+ jsonrpc: '2.0',
94
+ id,
95
+ result: {
96
+ content: [{ type: 'text', text: JSON.stringify({ ok: false, code: error?.code ?? 'io', message }) }],
97
+ isError: true,
98
+ },
99
+ };
100
+ }
101
+ }
102
+ if (method === 'notifications/initialized' || method === 'initialized') return null;
103
+ if (method === 'ping') return { jsonrpc: '2.0', id, result: {} };
104
+ return isNotification ? null : { jsonrpc: '2.0', id, error: { code: -32601, message: `Unknown method "${method}".` } };
105
+ } catch (cause) {
106
+ return {
107
+ jsonrpc: '2.0',
108
+ id,
109
+ error: { code: -32603, message: cause instanceof Error ? cause.message : String(cause) },
110
+ };
111
+ }
112
+ }
113
+
114
+ /**
115
+ * Serve stdio until the client closes it.
116
+ *
117
+ * Newline-delimited frames, because that is the framing every stdio MCP client
118
+ * uses; a partial line is buffered rather than dropped.
119
+ */
120
+ export async function runMcpServer(dataDir: string): Promise<void> {
121
+ let buffer = '';
122
+ const write = (reply: JsonRpcReply | null) => {
123
+ if (!reply) return;
124
+ process.stdout.write(`${JSON.stringify(reply)}\n`);
125
+ };
126
+ const { promise, resolve } = Promise.withResolvers<void>();
127
+ process.stdin.setEncoding('utf8');
128
+ process.stdin.on('data', (chunk: string) => {
129
+ buffer += chunk;
130
+ const lines = buffer.split('\n');
131
+ buffer = lines.pop() ?? '';
132
+ for (const line of lines) {
133
+ const trimmed = line.trim();
134
+ if (!trimmed) continue;
135
+ let frame: unknown;
136
+ try {
137
+ frame = JSON.parse(trimmed);
138
+ } catch {
139
+ write({ jsonrpc: '2.0', id: null, error: { code: -32700, message: 'Parse error.' } });
140
+ continue;
141
+ }
142
+ void handleRpcFrame(dataDir, frame).then(write);
143
+ }
144
+ });
145
+ process.stdin.on('end', resolve);
146
+ process.stdin.on('close', resolve);
147
+ await promise;
148
+ }
@@ -0,0 +1,319 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The card sheet: the task composer, the resolved agent, and the session.
8
+ *
9
+ * It is a side sheet on a wide panel and a full-height one on a phone; the
10
+ * difference is one class, so both layouts draw the same fields.
11
+ *
12
+ * Two rules are the whole point of this file:
13
+ *
14
+ * - **An inherited value says so.** Every picker renders the value that WON and
15
+ * the level it came from ("stage: in_progress"), because a board whose
16
+ * fallback chain is invisible makes an override impossible to reason about.
17
+ * - **The stage prompt's delivery is stated.** omp appends it to its own system
18
+ * prompt at spawn; an ACP harness has no such field, so the text rides the
19
+ * first turn instead. A reader who is about to write "do not edit code" needs
20
+ * to know which of those they are getting.
21
+ */
22
+
23
+ import { useEffect, useMemo, useState } from 'preact/hooks';
24
+ import { experimental_useSidebarThreadActions } from '@kabmo-labs/kabmo-ui';
25
+
26
+ import { MAX_IMAGES, type AgentOrigin, type Card, type ResolvedAgent, type Stage } from '../protocol';
27
+ import { resolveAgent } from '../store/resolve';
28
+ import type { WriteOutcome } from './use-writes';
29
+ import type { Catalogs } from './catalogs';
30
+
31
+ export interface CardSheetProps {
32
+ card: Card;
33
+ stages: Stage[];
34
+ /** The board's defaults, for the resolution the sheet reports. */
35
+ board: { defaults: Record<string, unknown>; stages: Stage[] };
36
+ catalogs: Catalogs;
37
+ /** The active chat, for "Link this chat". */
38
+ activeSessionId: string | null;
39
+ sessionState: 'running' | 'needs-you' | 'idle' | 'none';
40
+ onClose: () => void;
41
+ onSave: (patch: Record<string, unknown>, baseUpdatedAt: string) => Promise<WriteOutcome<unknown>>;
42
+ onMove: (status: string, baseUpdatedAt: string) => Promise<WriteOutcome<unknown>>;
43
+ onDelete: () => Promise<WriteOutcome<unknown>>;
44
+ onStartWork: (card: Card, resolved: ResolvedAgent) => Promise<WriteOutcome<unknown>>;
45
+ onLinkSession: (sessionId: string | null) => Promise<WriteOutcome<unknown>>;
46
+ }
47
+
48
+ /** How a picker names where its value came from. */
49
+ export function originLabel(origin: AgentOrigin, stage: Stage | undefined): string {
50
+ if (origin === 'card') return 'this card';
51
+ if (origin === 'stage') return stage ? `stage: ${stage.label}` : 'stage';
52
+ if (origin === 'defaults') return 'board default';
53
+ return 'host default';
54
+ }
55
+
56
+ /** The inherited-vs-overridden marker a picker shows. */
57
+ export function isOverridden(origin: AgentOrigin): boolean {
58
+ return origin === 'card';
59
+ }
60
+
61
+ /** A stage's label by id, for the header. */
62
+ function stageLabel(stages: readonly Stage[], id: string): string {
63
+ return stages.find((stage) => stage.id === id)?.label ?? id;
64
+ }
65
+
66
+ /** The card sheet. */
67
+ export function CardSheet(props: CardSheetProps) {
68
+ const { card, stages, board, catalogs, activeSessionId, sessionState } = props;
69
+ const [title, setTitle] = useState(card.title);
70
+ const [prompt, setPrompt] = useState(card.task.prompt);
71
+ const [priority, setPriority] = useState(card.priority);
72
+ const [workspace, setWorkspace] = useState(card.workspace ?? '');
73
+ const [harness, setHarness] = useState(card.task.agent?.harness ?? '');
74
+ const [thinking, setThinking] = useState(card.task.agent?.thinking ?? '');
75
+ const actions = experimental_useSidebarThreadActions();
76
+ const [busy, setBusy] = useState<string | null>(null);
77
+ const [notice, setNotice] = useState<string | null>(null);
78
+ const [error, setError] = useState<string | null>(null);
79
+
80
+ // The sheet follows the card: a write answered a fresh snapshot, and the
81
+ // fields must not keep the previous card's text after a move.
82
+ useEffect(() => {
83
+ setTitle(card.title);
84
+ setPrompt(card.task.prompt);
85
+ setPriority(card.priority);
86
+ setWorkspace(card.workspace ?? '');
87
+ setHarness(card.task.agent?.harness ?? '');
88
+ setThinking(card.task.agent?.thinking ?? '');
89
+ }, [card]);
90
+
91
+ const stage = stages.find((entry) => entry.id === card.status);
92
+ const resolved = useMemo(() => resolveAgent(card, stage, board as never), [card, stage, board]);
93
+ const models = catalogs.modelsFor(resolved.harness);
94
+ const thinkingLevels = catalogs.thinkingFor(resolved.harness);
95
+ const blocked = catalogs.blockedFor(resolved.harness);
96
+
97
+ const run = async (label: string, work: () => Promise<WriteOutcome<unknown>>) => {
98
+ setBusy(label);
99
+ setError(null);
100
+ setNotice(null);
101
+ const outcome = await work();
102
+ setBusy(null);
103
+ if (outcome.ok) setNotice(`${label} saved.`);
104
+ else setError(outcome.error);
105
+ };
106
+
107
+ const patch = () => {
108
+ // Spread the card's EXISTING agent first: saving a title must not wipe a
109
+ // model, an access mode or a skill filter the sheet has no input for.
110
+ const agent: Record<string, unknown> = { ...(card.task.agent ?? {}) };
111
+ if (harness) agent.harness = harness;
112
+ else delete agent.harness;
113
+ if (thinking) agent.thinking = thinking;
114
+ else delete agent.thinking;
115
+ return {
116
+ title,
117
+ priority,
118
+ workspace: workspace.trim() || null,
119
+ task: { prompt, ...(Object.keys(agent).length ? { agent } : {}) },
120
+ };
121
+ };
122
+
123
+ const startDisabled = busy !== null || !card.workspace || !prompt.trim();
124
+
125
+ return (
126
+ <aside class="flex flex-col h-full min-h-0 w-full md:w-[420px] md:flex-none border-l border-ink/10 bg-paper">
127
+ <header class="flex items-center gap-2 px-3 h-10 flex-none border-b border-ink/10">
128
+ <span class="text-[10px] font-mono text-ink/45">{card.id}</span>
129
+ <span class="text-xs text-ink/70 truncate">{stageLabel(stages, card.status)}</span>
130
+ <span class="ml-auto text-[10px] font-mono text-ink/60">P{priority}</span>
131
+ <button type="button" class="text-ink/50 hover:text-ink px-1" aria-label="Close" onClick={props.onClose}>
132
+ ×
133
+ </button>
134
+ </header>
135
+
136
+ <div class="flex-1 min-h-0 overflow-y-auto px-3 py-3 flex flex-col gap-3">
137
+ <label class="flex flex-col gap-1">
138
+ <span class="text-[10px] uppercase font-mono text-ink/40">Title</span>
139
+ <input
140
+ class="w-full rounded-md border border-ink/15 bg-paper px-2 py-1 text-xs text-ink"
141
+ value={title}
142
+ onInput={(event) => setTitle(event.currentTarget.value)}
143
+ />
144
+ </label>
145
+
146
+ <div class="flex gap-2">
147
+ <label class="flex-1 flex flex-col gap-1">
148
+ <span class="text-[10px] uppercase font-mono text-ink/40">Stage</span>
149
+ <select
150
+ class="rounded-md border border-ink/15 bg-paper px-2 py-1 text-xs text-ink"
151
+ value={card.status}
152
+ onChange={(event) => void run('Stage', () => props.onMove(event.currentTarget.value, card.updatedAt))}
153
+ >
154
+ {stages.map((entry) => (
155
+ <option key={entry.id} value={entry.id}>
156
+ {entry.label}
157
+ </option>
158
+ ))}
159
+ </select>
160
+ </label>
161
+ <label class="flex-1 flex flex-col gap-1">
162
+ <span class="text-[10px] uppercase font-mono text-ink/40">Priority</span>
163
+ <select
164
+ class="rounded-md border border-ink/15 bg-paper px-2 py-1 text-xs text-ink"
165
+ value={String(priority)}
166
+ onChange={(event) => setPriority(Number(event.currentTarget.value))}
167
+ >
168
+ {['P0 urgent', 'P1 high', 'P2 medium', 'P3 low', 'P4 backlog'].map((label, index) => (
169
+ <option key={label} value={String(index)}>
170
+ {label}
171
+ </option>
172
+ ))}
173
+ </select>
174
+ </label>
175
+ </div>
176
+
177
+ <label class="flex flex-col gap-1">
178
+ <span class="text-[10px] uppercase font-mono text-ink/40">Workspace</span>
179
+ <input
180
+ class="w-full rounded-md border border-ink/15 bg-paper px-2 py-1 text-[11px] font-mono text-ink"
181
+ placeholder="absolute path, or empty for the global bucket"
182
+ value={workspace}
183
+ onInput={(event) => setWorkspace(event.currentTarget.value)}
184
+ />
185
+ </label>
186
+
187
+ <label class="flex flex-col gap-1">
188
+ <span class="text-[10px] uppercase font-mono text-ink/40">Prompt — the task, like a queue message</span>
189
+ <textarea
190
+ class="w-full min-h-[96px] rounded-md border border-ink/15 bg-paper px-2 py-1 text-xs text-ink resize-y"
191
+ value={prompt}
192
+ placeholder="What should the agent do?"
193
+ onInput={(event) => setPrompt(event.currentTarget.value)}
194
+ />
195
+ </label>
196
+ <span class="text-[10px] text-ink/40">
197
+ {card.task.images.length} of {MAX_IMAGES} images · images are attached when work starts
198
+ </span>
199
+
200
+ <fieldset class="flex flex-col gap-2 border-t border-ink/10 pt-3">
201
+ <legend class="text-[10px] uppercase font-mono text-ink/40">Agent</legend>
202
+ <div class="flex gap-2">
203
+ <label class="flex-1 flex flex-col gap-1">
204
+ <span class="text-[10px] text-ink/45">Harness · {originLabel(resolved.origin.harness, stage)}</span>
205
+ <select
206
+ class="rounded-md border border-ink/15 bg-paper px-2 py-1 text-xs text-ink"
207
+ value={harness}
208
+ onChange={(event) => setHarness(event.currentTarget.value)}
209
+ >
210
+ <option value="">inherit ({resolved.harness})</option>
211
+ {catalogs.harnesses.map((entry) => (
212
+ <option key={entry.id} value={entry.id}>
213
+ {entry.label}
214
+ </option>
215
+ ))}
216
+ </select>
217
+ </label>
218
+ <label class="flex-1 flex flex-col gap-1">
219
+ <span class="text-[10px] text-ink/45">Thinking · {originLabel(resolved.origin.thinking, stage)}</span>
220
+ <select
221
+ class="rounded-md border border-ink/15 bg-paper px-2 py-1 text-xs text-ink"
222
+ value={thinking}
223
+ onChange={(event) => setThinking(event.currentTarget.value)}
224
+ >
225
+ <option value="">inherit ({resolved.thinking ?? 'harness default'})</option>
226
+ {thinkingLevels.map((level) => (
227
+ <option key={level} value={level}>
228
+ {level}
229
+ </option>
230
+ ))}
231
+ </select>
232
+ </label>
233
+ </div>
234
+ <p class="text-[10px] text-ink/40">
235
+ Model: {resolved.model ? `${resolved.model.provider}/${resolved.model.modelId}` : 'host default'} ·{' '}
236
+ {originLabel(resolved.origin.model, stage)} · {models.length} available
237
+ {blocked ? ` · ${blocked}` : ''}
238
+ </p>
239
+ <p class="text-[10px] text-ink/40">
240
+ Stage prompt: {resolved.prompt ? `${resolved.prompt.length} chars` : 'none'} ·{' '}
241
+ {resolved.promptDelivery === 'appended' ? 'appended to omp’s system prompt' : 'prepended to the first turn'}
242
+ </p>
243
+ </fieldset>
244
+
245
+ <fieldset class="flex flex-col gap-2 border-t border-ink/10 pt-3">
246
+ <legend class="text-[10px] uppercase font-mono text-ink/40">Session</legend>
247
+ {card.sessionId ? (
248
+ <>
249
+ <p class="text-[11px] font-mono text-ink/70">
250
+ {card.sessionId.slice(0, 8)}… · {sessionState}
251
+ </p>
252
+ <div class="flex gap-2">
253
+ <button
254
+ type="button"
255
+ class="rounded-md border border-ink/15 px-2 py-1 text-[11px] text-ink"
256
+ onClick={() => {
257
+ if (card.sessionId) actions.open(card.sessionId);
258
+ }}
259
+ >
260
+ Open chat
261
+ </button>
262
+ <button
263
+ type="button"
264
+ class="rounded-md border border-ink/15 px-2 py-1 text-[11px] text-ink"
265
+ disabled={busy !== null}
266
+ onClick={() => void run('Unlink', () => props.onLinkSession(null))}
267
+ >
268
+ Unlink
269
+ </button>
270
+ </div>
271
+ </>
272
+ ) : (
273
+ <div class="flex gap-2">
274
+ <button
275
+ type="button"
276
+ class="rounded-md border border-ink/20 bg-ink/5 px-2 py-1 text-[11px] text-ink disabled:opacity-40"
277
+ disabled={startDisabled}
278
+ title={card.workspace ? undefined : 'Pick a workspace first'}
279
+ onClick={() => void run('Start work', () => props.onStartWork(card, resolved))}
280
+ >
281
+ {busy === 'Start work' ? 'Starting…' : 'Start work'}
282
+ </button>
283
+ <button
284
+ type="button"
285
+ class="rounded-md border border-ink/15 px-2 py-1 text-[11px] text-ink disabled:opacity-40"
286
+ disabled={!activeSessionId || busy !== null}
287
+ onClick={() => void run('Link', () => props.onLinkSession(activeSessionId))}
288
+ >
289
+ Link this chat
290
+ </button>
291
+ </div>
292
+ )}
293
+ </fieldset>
294
+
295
+ {error ? <p class="text-[11px] text-[var(--theme-error)]">{error}</p> : null}
296
+ {notice ? <p class="text-[11px] text-ink/50">{notice}</p> : null}
297
+ </div>
298
+
299
+ <footer class="flex items-center gap-2 px-3 h-11 flex-none border-t border-ink/10">
300
+ <button
301
+ type="button"
302
+ class="rounded-md border border-ink/20 bg-ink/5 px-2 py-1 text-[11px] text-ink disabled:opacity-40"
303
+ disabled={busy !== null}
304
+ onClick={() => void run('Card', () => props.onSave(patch(), card.updatedAt))}
305
+ >
306
+ {busy === 'Card' ? 'Saving…' : 'Save'}
307
+ </button>
308
+ <button
309
+ type="button"
310
+ class="ml-auto rounded-md border border-ink/15 px-2 py-1 text-[11px] text-[var(--theme-error)]"
311
+ disabled={busy !== null}
312
+ onClick={() => void run('Delete', () => props.onDelete())}
313
+ >
314
+ Delete
315
+ </button>
316
+ </footer>
317
+ </aside>
318
+ );
319
+ }