@kabmo-labs/kabmo 0.46.1 → 0.47.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.
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +439 -435
- package/dist/client/static/js/{CsvGrid-qdkmv8bj.js → CsvGrid-vfgttmym.js} +2 -2
- package/dist/client/static/js/{DocxView-k84ns803.js → DocxView-dc41t6rp.js} +2 -2
- package/dist/client/static/js/{DrawioView-r1n717f7.js → DrawioView-wpwr38d9.js} +2 -2
- package/dist/client/static/js/HtmlPreview-23n7t5cs.js +1 -0
- package/dist/client/static/js/ImageView-mvjb3qh1.js +1 -0
- package/dist/client/static/js/LayoutWrapper-eenx0hp2.js +2 -0
- package/dist/client/static/js/{Modal-xe6h99jn.js → Modal-dsqhas10.js} +13 -13
- package/dist/client/static/js/{PdfView-ffg4mccg.js → PdfView-cpvsbfk0.js} +1 -1
- package/dist/client/static/js/{SessionsView-cdcbsee9.js → SessionsView-s0crtcm8.js} +1 -1
- package/dist/client/static/js/{SheetView-89sscpz6.js → SheetView-n6mst0hq.js} +13 -13
- package/dist/client/static/js/{SvgPreview-68c0ccbv.js → SvgPreview-g2aqq812.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-h3a5s259.js → abnfDiagram-O67JEVCF-3vac8sq4.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-b5w9mnn5.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-983p0jgn.js → architectureDiagram-NJMV4G6O-1nh4htz2.js} +3 -3
- package/dist/client/static/js/{astro-hyj5wege.js → astro-63zcysj7.js} +1 -1
- package/dist/client/static/js/bash-hv3167gh.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-16pse5mh.js → blockDiagram-BEXU5L5S-62z6kaar.js} +2 -2
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-mvnb00zt.js → c4Diagram-YGBWAQC7-rts5zgx4.js} +3 -3
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-kmpd91xb.js → classDiagram-v2-NBCMYWYE-tnpww186.js} +1 -1
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-3ek5r5se.js → cose-bilkent-JH36ORCC-8vsjbzwa.js} +1 -1
- package/dist/client/static/js/cpp-v2mqp8j7.js +1 -0
- package/dist/client/static/js/css-x7gyc3ta.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-kdj8rjc1.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-jkbh84zn.js → cynefinDiagram-VND7K2PF-005gc8km.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-4fdc0sgn.js → dagre-6A5THRUB-41zsteyd.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-hbk61nq9.js → diagram-22UHCM2B-prsm18a1.js} +3 -3
- package/dist/client/static/js/{diagram-3UASUU5V-hfpbr9qh.js → diagram-3UASUU5V-5nx9wf04.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-fn0nt71a.js → diagram-ATOU4E4O-k3d4z3aq.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-ssswxjeb.js → diagram-CDSNMT55-x2c5x5j2.js} +2 -2
- package/dist/client/static/js/{diagram-MLGK6HIB-whnzxv6f.js → diagram-MLGK6HIB-nvr76jqh.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-hk1chzxk.js → diagram-MPIPVDR6-v1jpzp9p.js} +1 -1
- package/dist/client/static/js/{dockerfile-zmsj8r4g.js → dockerfile-vz6va73h.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-q1vkg5mr.js → ebnfDiagram-ZINNZB2B-0v4tqr9v.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-kt98vg8j.js → elk-276RUBZZ-qfn4r7xj.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-ey3avsn9.js → erDiagram-OPXOYQCR-cd667n9f.js} +4 -4
- package/dist/client/static/js/{erlang-814e8qy5.js → erlang-vk66vt7q.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-m57b7ytw.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-fasj2gxy.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-a9k1at43.js → ganttDiagram-FUAMR5RP-ps0h3drm.js} +1 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-wvzsc4ph.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-gnekjfym.js → gitGraphDiagram-X574FWY7-fts23jer.js} +2 -2
- package/dist/client/static/js/graphql-a4gbqpj9.js +1 -0
- package/dist/client/static/js/{index-xq5f3nxa.js → index-0dkc6z8e.js} +2 -2
- package/dist/client/static/js/{index-m4k054wz.js → index-1d8bxjsz.js} +3 -3
- package/dist/client/static/js/{index-kty4ncsr.js → index-1whzs9kb.js} +2 -2
- package/dist/client/static/js/{index-qfxn7yh5.js → index-396r53n0.js} +2 -2
- package/dist/client/static/js/{index-kbhrvep8.js → index-39d8zbkx.js} +3 -3
- package/dist/client/static/js/{index-dn7hg4em.js → index-3nsrnyqr.js} +2 -2
- package/dist/client/static/js/{index-1ax52p0q.js → index-4jzsr1ky.js} +2 -2
- package/dist/client/static/js/{index-2a6qp9y6.js → index-4wnzs76g.js} +1 -1
- package/dist/client/static/js/{index-hgzntg2j.js → index-4x9p7hf9.js} +2 -2
- package/dist/client/static/js/{index-fzngzhww.js → index-52nd4hgm.js} +1 -1
- package/dist/client/static/js/{index-pavvxrsz.js → index-54mkp2r2.js} +1 -1
- package/dist/client/static/js/{index-abs635a1.js → index-56rtb871.js} +25 -25
- package/dist/client/static/js/{index-dxvtjn6a.js → index-5f4b44ay.js} +2 -2
- package/dist/client/static/js/{index-q9ytjey8.js → index-6009v8jf.js} +1 -1
- package/dist/client/static/js/{index-e9cxje00.js → index-62jgcgfd.js} +5 -5
- package/dist/client/static/js/{index-nw5mvcaj.js → index-64p1dncg.js} +2 -2
- package/dist/client/static/js/{index-fj5rsp5v.js → index-6d6hxwb5.js} +2 -2
- package/dist/client/static/js/{index-19x11s5w.js → index-70g527sb.js} +2 -2
- package/dist/client/static/js/{index-ykm7a3cp.js → index-7zeah164.js} +2 -2
- package/dist/client/static/js/{index-z25ss7xj.js → index-7zedprz3.js} +1 -1
- package/dist/client/static/js/{index-g7s0wsag.js → index-9ab6xaxd.js} +2 -2
- package/dist/client/static/js/index-9vqkyj58.js +3 -0
- package/dist/client/static/js/{index-60v30k5h.js → index-9xsf8162.js} +35 -35
- package/dist/client/static/js/{index-3x7h2eqj.js → index-a4h5np9r.js} +2 -2
- package/dist/client/static/js/{index-9vv7wr1n.js → index-an2wv33f.js} +2 -2
- package/dist/client/static/js/{index-64sqfr4a.js → index-c5hjht5e.js} +2 -2
- package/dist/client/static/js/{index-84fyq5a6.js → index-c63qyysm.js} +1 -1
- package/dist/client/static/js/{index-atq9q1s7.js → index-ccgzzydx.js} +1 -1
- package/dist/client/static/js/{index-b5dfvget.js → index-cra9mgkq.js} +4 -4
- package/dist/client/static/js/index-cvyqp8nz.css +1 -0
- package/dist/client/static/js/index-d2xtbabt.js +2 -0
- package/dist/client/static/js/{index-wrcdc9vz.js → index-dxkefysk.js} +1 -1
- package/dist/client/static/js/index-dxp2yvy7.js +2 -0
- package/dist/client/static/js/{index-vjmg7kn5.js → index-dyc886cc.js} +1 -1
- package/dist/client/static/js/{index-5wz0y88c.js → index-dzeyd153.js} +2 -2
- package/dist/client/static/js/{index-qf3y3ahx.js → index-e5j5gc4h.js} +2 -2
- package/dist/client/static/js/{index-2ks0m8ss.js → index-evmcc5qh.js} +2 -2
- package/dist/client/static/js/{index-b2e5pwx7.js → index-f2ahkev0.js} +5 -5
- package/dist/client/static/js/{index-65afr75v.js → index-fjex1y0t.js} +2 -2
- package/dist/client/static/js/{index-kb14dhrx.js → index-fxd8dfj4.js} +2 -2
- package/dist/client/static/js/{index-trvqvb1v.js → index-g4kkapka.js} +2 -2
- package/dist/client/static/js/{index-561gkvve.js → index-gzkzwgzv.js} +2 -2
- package/dist/client/static/js/{index-yf93db65.js → index-n1yr4khe.js} +1 -1
- package/dist/client/static/js/{index-d23eacf2.js → index-nkahe229.js} +2 -2
- package/dist/client/static/js/{index-dt6q3rws.js → index-p6s3fz6b.js} +11 -11
- package/dist/client/static/js/{index-hnb66d3s.js → index-q4ke39rh.js} +2 -2
- package/dist/client/static/js/index-qtd0e38d.js +1 -0
- package/dist/client/static/js/{index-x9r7zfp4.js → index-tqgj7rd9.js} +2 -2
- package/dist/client/static/js/{index-wbws16ag.js → index-x0xspam4.js} +2 -2
- package/dist/client/static/js/{index-4cag7w6k.js → index-x2v1zmth.js} +185 -185
- package/dist/client/static/js/{index-amsa0tfs.js → index-x9hfvbz6.js} +1 -1
- package/dist/client/static/js/{index-8g7q8mz4.js → index-xk1cqjkn.js} +3 -3
- package/dist/client/static/js/{index-c9e417cs.js → index-y6ke70e6.js} +2 -2
- package/dist/client/static/js/{index-bsr7wmj2.js → index-zhjjpvcc.js} +1 -1
- package/dist/client/static/js/info-A6RAGUB7-ym2xevn8.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-r1p25738.js → infoDiagram-VRGFBTTK-88qbtpq5.js} +1 -1
- package/dist/client/static/js/ini-80p6sp79.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-afgrqdrt.js → ishikawaDiagram-OU5B5YK6-s8bagk00.js} +1 -1
- package/dist/client/static/js/java-mm2b3s9b.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-hepa4wk7.js → journeyDiagram-ZHPQQLJL-hz8z0b9x.js} +2 -2
- package/dist/client/static/js/json-fzy76fkw.js +1 -0
- package/dist/client/static/js/jsx-c7v2f8s7.js +1 -0
- package/dist/client/static/js/{julia-yv2j8qd0.js → julia-dm0j9apa.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-jysft8ya.js → kanban-definition-PNTS6WVX-sjjnjb51.js} +1 -1
- package/dist/client/static/js/lua-ppfdxrmv.js +1 -0
- package/dist/client/static/js/markdown-xed7y3ds.js +1 -0
- package/dist/client/static/js/{mermaid.core-0m90b0s8.js → mermaid.core-zvwygxbh.js} +7 -7
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-x2rrzpvr.js → mindmap-definition-NLK3R4M7-kgj8enan.js} +2 -2
- package/dist/client/static/js/one-dark-pro-mq6sn6a2.js +1 -0
- package/dist/client/static/js/one-light-pt6t6vax.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-01vcsy6x.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-z7vb7f1z.js → pegDiagram-GJSIUBJH-gxzw1qwa.js} +1 -1
- package/dist/client/static/js/{perl-917pjq5a.js → perl-4jcm2jxv.js} +1 -1
- package/dist/client/static/js/{php-hwz75qzt.js → php-q32mec74.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-053gzkmh.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-jqv6v4e6.js → pieDiagram-5QR66LMP-pdqwyqcm.js} +1 -1
- package/dist/client/static/js/properties-8ysbq2n2.js +1 -0
- package/dist/client/static/js/python-4ysexc8s.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-w2h8yxrv.js → quadrantDiagram-O4NWA36T-yx2t364p.js} +1 -1
- package/dist/client/static/js/r-hrsw5arc.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-bkpby8am.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-67bxrjgw.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-xj9ymacg.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-2xxpbnf6.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-78w88znz.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-nd09yac3.js → railroadDiagram-XR7U4H2S-800fdzkr.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-t61zxh5v.js → requirementDiagram-PLB6GJNP-vc5rpgtm.js} +1 -1
- package/dist/client/static/js/{ruby-er7ayhte.js → ruby-npmpb290.js} +1 -1
- package/dist/client/static/js/{rust-avnkhh0p.js → rust-waks43wh.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-2f7h2cmw.js → sankeyDiagram-IPEJSGJF-ccjk8zgn.js} +2 -2
- package/dist/client/static/js/{sass-n47tt136.js → sass-502a4r7y.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-kfb5d7zd.js → sequenceDiagram-PO4LG4MO-c0tk7gfn.js} +6 -6
- package/dist/client/static/js/{sizeCapture-INFHLROL-amfg19se.js → sizeCapture-INFHLROL-fma9p1vy.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-k5hx7btx.js → stateDiagram-v2-GCMORJYK-d8f24b7j.js} +2 -2
- package/dist/client/static/js/{svelte-2pmz35vx.js → svelte-c15d0421.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-wv3rp8kk.js → swimlanes-2SLR337P-sdt7qy36.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-rz309qrx.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-0re95wtn.js → timeline-definition-EJHVYXUP-rv8qyr8b.js} +2 -2
- package/dist/client/static/js/treeView-Q6P3EWNA-g2bkjr4z.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-pj7yw9rw.js +1 -0
- package/dist/client/static/js/tsx-xjp2ds8g.js +1 -0
- package/dist/client/static/js/typescript-yg97da8h.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-yrje14qp.js → usecaseDiagram-POWQR4AR-w6ew1red.js} +2 -2
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-jxkmrfy5.js → vennDiagram-UO4OBE2U-p9axw7ch.js} +1 -1
- package/dist/client/static/js/{vue-d5gpjfgn.js → vue-xpemy62d.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-c7ekf8r2.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-d3v2m9b1.js → wardleyDiagram-VNRHLVJA-5ewc8s4p.js} +1 -1
- package/dist/client/static/js/xml-nrb23phz.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-9a1s1rjt.js → xychartDiagram-PMCCYNJV-7n4gn7k6.js} +2 -2
- package/dist/client/static/js/yaml-sqs6pjpx.js +1 -0
- package/marketplace/marketplace.json +34 -7
- package/marketplace/plugins/kanban/README.md +143 -0
- package/marketplace/plugins/kanban/icon.svg +5 -0
- package/marketplace/plugins/kanban/package.json +30 -0
- package/marketplace/plugins/kanban/src/app.tsx +34 -0
- package/marketplace/plugins/kanban/src/mcp-tools.ts +296 -0
- package/marketplace/plugins/kanban/src/mcp.test.ts +199 -0
- package/marketplace/plugins/kanban/src/mcp.ts +148 -0
- package/marketplace/plugins/kanban/src/panel/CardSheet.tsx +319 -0
- package/marketplace/plugins/kanban/src/panel/CardTile.tsx +97 -0
- package/marketplace/plugins/kanban/src/panel/StageColumn.tsx +116 -0
- package/marketplace/plugins/kanban/src/panel/StageSheet.tsx +249 -0
- package/marketplace/plugins/kanban/src/panel/catalogs.ts +114 -0
- package/marketplace/plugins/kanban/src/panel/index.tsx +327 -0
- package/marketplace/plugins/kanban/src/panel/panel.test.ts +219 -0
- package/marketplace/plugins/kanban/src/panel/start-work.ts +132 -0
- package/marketplace/plugins/kanban/src/panel/use-board.ts +148 -0
- package/marketplace/plugins/kanban/src/panel/use-card-detail.ts +70 -0
- package/marketplace/plugins/kanban/src/panel/use-writes.ts +123 -0
- package/marketplace/plugins/kanban/src/protocol.ts +180 -0
- package/marketplace/plugins/kanban/src/server.test.ts +113 -0
- package/marketplace/plugins/kanban/src/server.ts +227 -0
- package/marketplace/plugins/kanban/src/store/board.test.ts +311 -0
- package/marketplace/plugins/kanban/src/store/board.ts +147 -0
- package/marketplace/plugins/kanban/src/store/cards.ts +228 -0
- package/marketplace/plugins/kanban/src/store/fs.ts +159 -0
- package/marketplace/plugins/kanban/src/store/ops.ts +245 -0
- package/marketplace/plugins/kanban/src/store/resolve.test.ts +82 -0
- package/marketplace/plugins/kanban/src/store/resolve.ts +135 -0
- package/marketplace/plugins/kanban/tsconfig.json +26 -0
- package/package.json +2 -2
- package/src/client/components/common/file-icon/index.tsx +1 -1
- package/src/client/components/layout/desktop-layout/LeftColumn.tsx +12 -3
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +34 -7
- package/src/client/components/layout/desktop-layout/index.tsx +17 -22
- package/src/client/components/mobile/mobile-right-sidebar/EditorSurface.tsx +2 -0
- package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +11 -3
- package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.test.tsx +21 -0
- package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.tsx +8 -4
- package/src/client/components/settings/categories/appearance-settings/ThemeCard.tsx +8 -2
- package/src/client/components/settings/categories/appearance-settings/ThemeGrid.tsx +15 -4
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.test.ts +21 -0
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +7 -1
- package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +3 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +1 -1
- package/src/client/components/workspace/editor/FilePane.tsx +4 -2
- package/src/client/components/workspace/editor/Tabs.tsx +7 -1
- package/src/client/components/workspace/editor/Toolbar.tsx +7 -1
- package/src/client/components/workspace/editor/chrome-rows.test.tsx +126 -0
- package/src/client/components/workspace/editor/viewers/HtmlPreview.test.tsx +94 -0
- package/src/client/components/workspace/editor/viewers/HtmlPreview.tsx +71 -0
- package/src/client/components/workspace/editor/viewers/bytes.ts +1 -1
- package/src/client/components/workspace/editor/viewers/dispatch.tsx +18 -2
- package/src/client/components/workspace/editor/viewers/viewers.test.ts +14 -1
- package/src/client/components/workspace/panel-header/index.test.tsx +2 -1
- package/src/client/components/workspace/panel-header/index.tsx +6 -4
- package/src/client/hooks/editor/resolve-viewer.ts +1 -1
- package/src/client/hooks/editor/use-editor-drop.ts +14 -0
- package/src/client/hooks/editor/use-editor-tab-state.ts +5 -4
- package/src/client/hooks/ui/media-query.ts +27 -0
- package/src/client/hooks/workspace/file-tabs.ts +10 -0
- package/src/client/hooks/workspace/right-panel-presence.test.ts +152 -0
- package/src/client/hooks/workspace/right-panel-presence.ts +119 -0
- package/src/client/lib/router/search-params.test.ts +83 -0
- package/src/client/lib/router/search-params.ts +14 -3
- package/src/server/lib/mcp/session-mcp.test.ts +64 -1
- package/src/server/lib/mcp/session-overlay.server.ts +7 -4
- package/src/server/lib/omp/rpc/constants.test.ts +31 -0
- package/src/server/lib/omp/rpc/constants.ts +19 -0
- package/src/server/lib/omp/rpc/session-new.ts +78 -0
- package/src/server/lib/omp/rpc/session-registry.ts +22 -49
- package/src/server/lib/omp/rpc/spawn-mcp.ts +8 -1
- package/src/server/lib/omp/session/blobs.server.ts +2 -1
- package/src/server/lib/plugins/e2e.test.ts +71 -2
- package/src/server/lib/plugins/loader.server.ts +20 -1
- package/src/server/lib/plugins/module-import.server.ts +45 -0
- package/src/server/routes/agent/new-prompt.test.ts +81 -0
- package/src/server/routes/agent/new.ts +78 -4
- package/src/server/routes/fs/raw.test.ts +12 -0
- package/src/server/routes/fs/raw.ts +2 -6
- package/src/server/routes/wiki/asset.ts +1 -1
- package/src/shared/lib/fs/document-kind.test.ts +39 -2
- package/src/shared/lib/fs/document-kind.ts +49 -1
- package/src/shared/lib/fs/file-kind.test.ts +30 -3
- package/src/shared/lib/fs/file-kind.ts +7 -104
- package/src/shared/lib/fs/mime.ts +159 -0
- package/src/shared/lib/workspace/sidebar-width.test.ts +34 -0
- package/src/shared/lib/workspace/sidebar-width.ts +33 -0
- package/src/shared/lib/workspace/workspace-panel-widths.test.ts +124 -0
- package/src/shared/lib/workspace/workspace-panel-widths.ts +115 -18
- package/dist/client/static/js/ImageView-jkrdrq8v.js +0 -1
- package/dist/client/static/js/LayoutWrapper-sh634350.js +0 -2
- package/dist/client/static/js/architecture-7GRP2DOG-pvb4d65d.js +0 -1
- package/dist/client/static/js/bash-8d8z8zrg.js +0 -1
- package/dist/client/static/js/cpp-620mvjkk.js +0 -1
- package/dist/client/static/js/css-bt76kxbq.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-gmx4vean.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-vrnheyh7.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-7gvtpn3d.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-n6wnc8st.js +0 -1
- package/dist/client/static/js/graphql-j1a6zp7m.js +0 -1
- package/dist/client/static/js/index-5ka2tyf9.js +0 -3
- package/dist/client/static/js/index-83rkg916.js +0 -2
- package/dist/client/static/js/index-dpy3ewrn.css +0 -1
- package/dist/client/static/js/index-vkqb4dnt.js +0 -1
- package/dist/client/static/js/index-xwjbq003.js +0 -2
- package/dist/client/static/js/info-A6RAGUB7-1xtdxjz2.js +0 -1
- package/dist/client/static/js/ini-5f4zqtqr.js +0 -1
- package/dist/client/static/js/java-jj41mty3.js +0 -1
- package/dist/client/static/js/json-rnh2h17x.js +0 -1
- package/dist/client/static/js/jsx-4gecrt29.js +0 -1
- package/dist/client/static/js/lua-zszaw2f7.js +0 -1
- package/dist/client/static/js/markdown-nm6gw4v4.js +0 -1
- package/dist/client/static/js/one-dark-pro-09d8p5vy.js +0 -1
- package/dist/client/static/js/one-light-g3ednt6p.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-zm1r82x5.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-sqa7321j.js +0 -1
- package/dist/client/static/js/properties-rkptax7r.js +0 -1
- package/dist/client/static/js/python-qf1se1mj.js +0 -1
- package/dist/client/static/js/r-ms0cygq2.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-z3z82syp.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-z6swcqq2.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-33km6py4.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-1zbf1xmq.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-wte1xzzy.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-6y8zdbm4.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-pvgx6n22.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-3n9zm628.js +0 -1
- package/dist/client/static/js/tsx-gx7td06z.js +0 -1
- package/dist/client/static/js/typescript-1a808spn.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-7m07ewc4.js +0 -1
- package/dist/client/static/js/xml-3117mxd9.js +0 -1
- package/dist/client/static/js/yaml-dmvh8vyt.js +0 -1
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The tool table: what an agent can do to a board, in its own vocabulary.
|
|
8
|
+
*
|
|
9
|
+
* Split from the protocol handler so each file reads as one thing — the table is
|
|
10
|
+
* the CONTRACT (names, schemas, and the operation behind each), while `mcp.ts`
|
|
11
|
+
* owns framing and refusals.
|
|
12
|
+
*
|
|
13
|
+
* Every tool calls the same `store/ops` function the panel's RPC calls, so the
|
|
14
|
+
* two writers cannot drift: an agent's move and a drag both go through
|
|
15
|
+
* `moveCard`, with the same lock, the same validation and the same answer.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { CARD_ID, STAGE_ID, type AgentSpec, type BoardSnapshot } from './protocol';
|
|
19
|
+
import { KanbanError } from './store/fs';
|
|
20
|
+
import {
|
|
21
|
+
addCard,
|
|
22
|
+
cardDetail,
|
|
23
|
+
claimCard,
|
|
24
|
+
linkSession,
|
|
25
|
+
moveCard,
|
|
26
|
+
nextCard,
|
|
27
|
+
removeCard,
|
|
28
|
+
saveDefaults,
|
|
29
|
+
saveStages,
|
|
30
|
+
snapshot,
|
|
31
|
+
updateCard,
|
|
32
|
+
} from './store/ops';
|
|
33
|
+
import { resolveAgent } from './store/resolve';
|
|
34
|
+
|
|
35
|
+
/** One tool as `tools/list` describes it. */
|
|
36
|
+
interface ToolDefinition {
|
|
37
|
+
name: string;
|
|
38
|
+
description: string;
|
|
39
|
+
inputSchema: Record<string, unknown>;
|
|
40
|
+
run: (dataDir: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function stringArg(args: Record<string, unknown>, key: string): string | undefined {
|
|
44
|
+
const value = args[key];
|
|
45
|
+
return typeof value === 'string' && value.trim() ? value.trim() : undefined;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function requireString(args: Record<string, unknown>, key: string): string {
|
|
49
|
+
const value = stringArg(args, key);
|
|
50
|
+
if (!value) throw new KanbanError('invalid', `"${key}" is required.`);
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** A workspace argument: a path, or `null` for the global bucket, or absent. */
|
|
55
|
+
function workspaceArg(args: Record<string, unknown>): string | null | undefined {
|
|
56
|
+
if (!('workspace' in args)) return undefined;
|
|
57
|
+
const value = args.workspace;
|
|
58
|
+
if (value === null) return null;
|
|
59
|
+
return typeof value === 'string' ? value : undefined;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** The slim row a list answer carries. */
|
|
63
|
+
function row(card: BoardSnapshot['cards'][number]): Record<string, unknown> {
|
|
64
|
+
return {
|
|
65
|
+
id: card.id,
|
|
66
|
+
title: card.title,
|
|
67
|
+
status: card.status,
|
|
68
|
+
priority: card.priority,
|
|
69
|
+
workspace: card.workspace,
|
|
70
|
+
sessionId: card.sessionId,
|
|
71
|
+
updatedAt: card.updatedAt,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Every tool, and each one is the same operation the panel performs.
|
|
77
|
+
*
|
|
78
|
+
* `kanban_move` is the reason the tools exist: an agent that finished the work
|
|
79
|
+
* moves its own card, and the answer tells it whether the stage needs a session
|
|
80
|
+
* (`next: "start_work_required"`) — it never spawns one, because a spawn nobody
|
|
81
|
+
* asked for is worse than one click in the panel.
|
|
82
|
+
*/
|
|
83
|
+
export const TOOLS: readonly ToolDefinition[] = [
|
|
84
|
+
{
|
|
85
|
+
name: 'kanban_list',
|
|
86
|
+
description: 'List board cards as slim rows. Optional workspace and status filters.',
|
|
87
|
+
inputSchema: {
|
|
88
|
+
type: 'object',
|
|
89
|
+
properties: {
|
|
90
|
+
workspace: { type: ['string', 'null'], description: 'Absolute workspace path, or null for unfiled cards.' },
|
|
91
|
+
status: { type: 'string', description: 'A stage id from board.json.' },
|
|
92
|
+
limit: { type: 'number', description: 'At most this many rows (default 50).' },
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
async run(dataDir, args) {
|
|
96
|
+
const board = await snapshot(dataDir);
|
|
97
|
+
const workspace = workspaceArg(args);
|
|
98
|
+
const status = stringArg(args, 'status');
|
|
99
|
+
const limit = typeof args.limit === 'number' && args.limit > 0 ? Math.min(args.limit, 500) : 50;
|
|
100
|
+
const cards = board.cards
|
|
101
|
+
.filter((card) => (workspace === undefined ? true : card.workspace === workspace))
|
|
102
|
+
.filter((card) => (status ? card.status === status : true))
|
|
103
|
+
.slice(0, limit);
|
|
104
|
+
return { cards: cards.map(row), stages: board.board.stages.map((stage) => ({ id: stage.id, label: stage.label })) };
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'kanban_next',
|
|
109
|
+
description: 'The highest-priority card that is not done, with the stage prompt that applies to it.',
|
|
110
|
+
inputSchema: {
|
|
111
|
+
type: 'object',
|
|
112
|
+
properties: { workspace: { type: ['string', 'null'], description: 'Restrict to one workspace.' } },
|
|
113
|
+
},
|
|
114
|
+
async run(dataDir, args) {
|
|
115
|
+
const card = await nextCard(dataDir, workspaceArg(args));
|
|
116
|
+
if (!card) return { card: null };
|
|
117
|
+
const { board } = await cardDetail(dataDir, card.id);
|
|
118
|
+
const stage = board.stages.find((entry) => entry.id === card.status);
|
|
119
|
+
const resolved = resolveAgent(card, stage, board);
|
|
120
|
+
return {
|
|
121
|
+
card: { ...row({ ...card, hasPrompt: card.task.prompt.length > 0, imageCount: card.task.images.length }), prompt: card.task.prompt },
|
|
122
|
+
agent: { harness: resolved.harness, model: resolved.model, thinking: resolved.thinking, prompt: resolved.prompt },
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: 'kanban_get',
|
|
128
|
+
description: 'One card, its stage, and the resolved agent settings.',
|
|
129
|
+
inputSchema: { type: 'object', properties: { id: { type: 'string' } }, required: ['id'] },
|
|
130
|
+
async run(dataDir, args) {
|
|
131
|
+
const id = requireString(args, 'id');
|
|
132
|
+
const { card, board } = await cardDetail(dataDir, id);
|
|
133
|
+
const stage = board.stages.find((entry) => entry.id === card.status);
|
|
134
|
+
return { card, stage: stage ?? null, agent: resolveAgent(card, stage, board), defaults: board.defaults };
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: 'kanban_create',
|
|
139
|
+
description: 'Create a card. `workspace` defaults to the caller\'s cwd when one is given.',
|
|
140
|
+
inputSchema: {
|
|
141
|
+
type: 'object',
|
|
142
|
+
properties: {
|
|
143
|
+
title: { type: 'string' },
|
|
144
|
+
prompt: { type: 'string' },
|
|
145
|
+
workspace: { type: ['string', 'null'] },
|
|
146
|
+
status: { type: 'string' },
|
|
147
|
+
priority: { type: 'number', description: '0 (urgent) .. 4 (backlog)' },
|
|
148
|
+
},
|
|
149
|
+
required: ['title'],
|
|
150
|
+
},
|
|
151
|
+
async run(dataDir, args) {
|
|
152
|
+
const card = await addCard(dataDir, {
|
|
153
|
+
title: requireString(args, 'title'),
|
|
154
|
+
status: stringArg(args, 'status'),
|
|
155
|
+
workspace: workspaceArg(args) ?? null,
|
|
156
|
+
priority: typeof args.priority === 'number' ? args.priority : undefined,
|
|
157
|
+
task: { prompt: stringArg(args, 'prompt') ?? '' },
|
|
158
|
+
});
|
|
159
|
+
return { card };
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: 'kanban_move',
|
|
164
|
+
description: 'Move a card to another stage. Answers next="start_work_required" when that stage runs a session and none is linked.',
|
|
165
|
+
inputSchema: {
|
|
166
|
+
type: 'object',
|
|
167
|
+
properties: { id: { type: 'string' }, status: { type: 'string' }, baseUpdatedAt: { type: 'string' } },
|
|
168
|
+
required: ['id', 'status'],
|
|
169
|
+
},
|
|
170
|
+
async run(dataDir, args) {
|
|
171
|
+
const status = requireString(args, 'status');
|
|
172
|
+
if (!STAGE_ID.test(status)) throw new KanbanError('invalid', `"${status}" is not a stage id.`);
|
|
173
|
+
const moved = await moveCard(dataDir, requireString(args, 'id'), status, stringArg(args, 'baseUpdatedAt'));
|
|
174
|
+
return { card: moved.card, ...(moved.next ? { next: moved.next } : {}) };
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: 'kanban_claim',
|
|
179
|
+
description: 'Claim a card for a session: record the session and move it to the working stage.',
|
|
180
|
+
inputSchema: {
|
|
181
|
+
type: 'object',
|
|
182
|
+
properties: { id: { type: 'string' }, session_id: { type: 'string' } },
|
|
183
|
+
required: ['id'],
|
|
184
|
+
},
|
|
185
|
+
async run(dataDir, args) {
|
|
186
|
+
return { card: await claimCard(dataDir, requireString(args, 'id'), stringArg(args, 'session_id')) };
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: 'kanban_update',
|
|
191
|
+
description: 'Change a card\'s control fields: title, priority, workspace, or the task prompt.',
|
|
192
|
+
inputSchema: {
|
|
193
|
+
type: 'object',
|
|
194
|
+
properties: {
|
|
195
|
+
id: { type: 'string' },
|
|
196
|
+
title: { type: 'string' },
|
|
197
|
+
priority: { type: 'number' },
|
|
198
|
+
workspace: { type: ['string', 'null'] },
|
|
199
|
+
prompt: { type: 'string' },
|
|
200
|
+
baseUpdatedAt: { type: 'string' },
|
|
201
|
+
},
|
|
202
|
+
required: ['id'],
|
|
203
|
+
},
|
|
204
|
+
async run(dataDir, args) {
|
|
205
|
+
const id = requireString(args, 'id');
|
|
206
|
+
const prompt = stringArg(args, 'prompt');
|
|
207
|
+
return {
|
|
208
|
+
card: await updateCard(
|
|
209
|
+
dataDir,
|
|
210
|
+
id,
|
|
211
|
+
{
|
|
212
|
+
title: stringArg(args, 'title'),
|
|
213
|
+
priority: typeof args.priority === 'number' ? args.priority : undefined,
|
|
214
|
+
workspace: workspaceArg(args),
|
|
215
|
+
...(prompt !== undefined ? { task: { prompt } } : {}),
|
|
216
|
+
},
|
|
217
|
+
stringArg(args, 'baseUpdatedAt'),
|
|
218
|
+
),
|
|
219
|
+
};
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
name: 'kanban_link_session',
|
|
224
|
+
description: 'Link (or unlink, with session_id=null) a chat session to a card.',
|
|
225
|
+
inputSchema: {
|
|
226
|
+
type: 'object',
|
|
227
|
+
properties: { id: { type: 'string' }, session_id: { type: ['string', 'null'] } },
|
|
228
|
+
required: ['id', 'session_id'],
|
|
229
|
+
},
|
|
230
|
+
async run(dataDir, args) {
|
|
231
|
+
const session = args.session_id;
|
|
232
|
+
if (session !== null && typeof session !== 'string') throw new KanbanError('invalid', 'session_id must be a string or null.');
|
|
233
|
+
return { card: await linkSession(dataDir, requireString(args, 'id'), session) };
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
name: 'kanban_delete',
|
|
238
|
+
description: 'Delete a card file.',
|
|
239
|
+
inputSchema: { type: 'object', properties: { id: { type: 'string' } }, required: ['id'] },
|
|
240
|
+
async run(dataDir, args) {
|
|
241
|
+
const id = requireString(args, 'id');
|
|
242
|
+
if (!CARD_ID.test(id)) throw new KanbanError('invalid', `"${id}" is not a card id.`);
|
|
243
|
+
await removeCard(dataDir, id);
|
|
244
|
+
return { deleted: id };
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
name: 'kanban_stages',
|
|
249
|
+
description: 'Read or replace the stage list. Replacing takes the WHOLE list, so read it first.',
|
|
250
|
+
inputSchema: {
|
|
251
|
+
type: 'object',
|
|
252
|
+
properties: {
|
|
253
|
+
stages: {
|
|
254
|
+
type: 'array',
|
|
255
|
+
description: 'The complete list. Omit to read.',
|
|
256
|
+
items: {
|
|
257
|
+
type: 'object',
|
|
258
|
+
properties: {
|
|
259
|
+
id: { type: 'string' },
|
|
260
|
+
label: { type: 'string' },
|
|
261
|
+
hidden: { type: 'boolean' },
|
|
262
|
+
session: { type: 'boolean' },
|
|
263
|
+
},
|
|
264
|
+
required: ['id', 'label'],
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
defaults: { type: 'object', description: 'Board defaults: harness, model, thinking, access, prompt, skills.' },
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
async run(dataDir, args) {
|
|
271
|
+
if (Array.isArray(args.stages)) {
|
|
272
|
+
const stages = args.stages.map((entry) => {
|
|
273
|
+
const record = entry as Record<string, unknown>;
|
|
274
|
+
return {
|
|
275
|
+
id: String(record.id ?? ''),
|
|
276
|
+
label: String(record.label ?? ''),
|
|
277
|
+
hidden: record.hidden === true,
|
|
278
|
+
session: record.session === true,
|
|
279
|
+
};
|
|
280
|
+
});
|
|
281
|
+
return { board: (await saveStages(dataDir, stages)).board };
|
|
282
|
+
}
|
|
283
|
+
if (args.defaults && typeof args.defaults === 'object') {
|
|
284
|
+
return { board: (await saveDefaults(dataDir, args.defaults as AgentSpec)).board };
|
|
285
|
+
}
|
|
286
|
+
const board = await snapshot(dataDir);
|
|
287
|
+
return { stages: board.board.stages, defaults: board.board.defaults };
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
];
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
/** The tool by name, or undefined. */
|
|
294
|
+
export function toolNamed(name: string): ToolDefinition | undefined {
|
|
295
|
+
return TOOLS.find((tool) => tool.name === name);
|
|
296
|
+
}
|
|
@@ -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
|
+
}
|