@kabmo-labs/kabmo 0.46.0 → 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-br4j001k.js → CsvGrid-vfgttmym.js} +2 -2
- package/dist/client/static/js/{DocxView-kmtkbmmw.js → DocxView-dc41t6rp.js} +2 -2
- package/dist/client/static/js/{DrawioView-3df0g3jr.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-tmxhxd6q.js → Modal-dsqhas10.js} +13 -13
- package/dist/client/static/js/{PdfView-p5z7c7eg.js → PdfView-cpvsbfk0.js} +1 -1
- package/dist/client/static/js/{SessionsView-t06h6zfx.js → SessionsView-s0crtcm8.js} +1 -1
- package/dist/client/static/js/{SheetView-agw459v2.js → SheetView-n6mst0hq.js} +13 -13
- package/dist/client/static/js/{SvgPreview-b9rfy1h6.js → SvgPreview-g2aqq812.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-wbnhzcnj.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-t2sgevea.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-v2nzp54a.js → blockDiagram-BEXU5L5S-62z6kaar.js} +2 -2
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-7h03146b.js → c4Diagram-YGBWAQC7-rts5zgx4.js} +3 -3
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-m57e9kp1.js → classDiagram-v2-NBCMYWYE-tnpww186.js} +1 -1
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-c4tnh4mg.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-mjf6njey.js → cynefinDiagram-VND7K2PF-005gc8km.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-6yma9ch3.js → dagre-6A5THRUB-41zsteyd.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-1q4ce2gb.js → diagram-22UHCM2B-prsm18a1.js} +3 -3
- package/dist/client/static/js/{diagram-3UASUU5V-0ttps29p.js → diagram-3UASUU5V-5nx9wf04.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-1mzexgv1.js → diagram-ATOU4E4O-k3d4z3aq.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-4ae89t23.js → diagram-CDSNMT55-x2c5x5j2.js} +2 -2
- package/dist/client/static/js/{diagram-MLGK6HIB-057jaqvh.js → diagram-MLGK6HIB-nvr76jqh.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-p6yyq5sx.js → diagram-MPIPVDR6-v1jpzp9p.js} +1 -1
- package/dist/client/static/js/{dockerfile-00hqsk9c.js → dockerfile-vz6va73h.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-bsk7dvm4.js → ebnfDiagram-ZINNZB2B-0v4tqr9v.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-dsq91er5.js → elk-276RUBZZ-qfn4r7xj.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-p7p13mbh.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-bwgnttyk.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-ca0gj5am.js → gitGraphDiagram-X574FWY7-fts23jer.js} +2 -2
- package/dist/client/static/js/graphql-a4gbqpj9.js +1 -0
- package/dist/client/static/js/{index-y2z8nsvw.js → index-0dkc6z8e.js} +2 -2
- package/dist/client/static/js/{index-eqhjs1yv.js → index-1d8bxjsz.js} +4 -4
- 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-qn200x1b.js → index-39d8zbkx.js} +6 -6
- package/dist/client/static/js/{index-dn7hg4em.js → index-3nsrnyqr.js} +2 -2
- package/dist/client/static/js/{index-jkay7aw7.js → index-4jzsr1ky.js} +2 -2
- package/dist/client/static/js/{index-064vdkrs.js → index-4wnzs76g.js} +1 -1
- package/dist/client/static/js/{index-16sd19f0.js → index-4x9p7hf9.js} +2 -2
- package/dist/client/static/js/{index-zq0qxb17.js → index-52nd4hgm.js} +1 -1
- package/dist/client/static/js/{index-8pksqzwq.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-95kese1h.js → index-6009v8jf.js} +1 -1
- package/dist/client/static/js/{index-29npynva.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-9d3n04vb.js → index-7zeah164.js} +2 -2
- package/dist/client/static/js/{index-5h8y54t6.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-x1fqhhpp.js → index-9xsf8162.js} +35 -35
- package/dist/client/static/js/{index-j718pxb3.js → index-a4h5np9r.js} +2 -2
- package/dist/client/static/js/{index-bjv5ga2e.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-aagt3382.js → index-c63qyysm.js} +1 -1
- package/dist/client/static/js/{index-red856x6.js → index-ccgzzydx.js} +1 -1
- package/dist/client/static/js/{index-ex5dtdx2.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-7055hdx1.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-f7te27n5.js → index-f2ahkev0.js} +5 -5
- package/dist/client/static/js/{index-5gf52a6d.js → index-fjex1y0t.js} +2 -2
- package/dist/client/static/js/{index-bafe7hmd.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-twsbv1yn.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-3bf7r7z4.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-ncpwteyt.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-amys498v.js → index-x2v1zmth.js} +186 -186
- package/dist/client/static/js/{index-pwe6chtp.js → index-x9hfvbz6.js} +1 -1
- package/dist/client/static/js/{index-dr5hca5b.js → index-xk1cqjkn.js} +3 -3
- package/dist/client/static/js/{index-k5zfzgez.js → index-y6ke70e6.js} +2 -2
- package/dist/client/static/js/{index-zedt16w7.js → index-zhjjpvcc.js} +1 -1
- package/dist/client/static/js/info-A6RAGUB7-ym2xevn8.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-7q58qdf1.js → infoDiagram-VRGFBTTK-88qbtpq5.js} +1 -1
- package/dist/client/static/js/ini-80p6sp79.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-9jmeszag.js → ishikawaDiagram-OU5B5YK6-s8bagk00.js} +1 -1
- package/dist/client/static/js/java-mm2b3s9b.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-0d7xe845.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-7p83rwdn.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-hwhzw0wv.js → mermaid.core-zvwygxbh.js} +7 -7
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-hy0rtr7t.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-kd8t53tx.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-h3x03f80.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-y2b1ncbg.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-x188rcxf.js → railroadDiagram-XR7U4H2S-800fdzkr.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-g5e9fk17.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-1v8xbxn9.js → rust-waks43wh.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-y9ht91gf.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-pp8s63rt.js → sequenceDiagram-PO4LG4MO-c0tk7gfn.js} +6 -6
- package/dist/client/static/js/{sizeCapture-INFHLROL-k6dhfxex.js → sizeCapture-INFHLROL-fma9p1vy.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-y3akpsm4.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-89081dr3.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-tz6r8g3q.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-yq2y1b09.js → usecaseDiagram-POWQR4AR-w6ew1red.js} +2 -2
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-qdmjf6x3.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-3n2sm7rj.js → wardleyDiagram-VNRHLVJA-5ewc8s4p.js} +1 -1
- package/dist/client/static/js/xml-nrb23phz.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-d7n2av2t.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 +14 -4
- package/src/client/components/layout/desktop-layout/RightColumn.test.tsx +204 -0
- package/src/client/components/layout/desktop-layout/RightColumn.tsx +37 -16
- 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/RightSidebar.tsx +10 -8
- 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/mobile/mobile-session-sidebar/use-drawer-tabs.ts +2 -1
- 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/MessageList.test.ts +11 -0
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +29 -21
- 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/chat/timeline/row-measure.ts +75 -0
- package/src/client/hooks/chat/timeline/row-window.test.ts +41 -21
- package/src/client/hooks/chat/timeline/row-window.ts +6 -24
- 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/panel-tabs-reveal.test.tsx +20 -17
- package/src/client/hooks/workspace/panel-tabs-reveal.ts +29 -17
- package/src/client/hooks/workspace/panel-tabs.ts +3 -2
- 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/hooks/workspace/session-state/index.test.tsx +145 -0
- package/src/client/hooks/workspace/session-state/index.ts +28 -16
- 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-2r8p5z3y.js +0 -1
- package/dist/client/static/js/LayoutWrapper-rq3d2a4e.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-7b4w6phx.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-3qnjdjg2.js +0 -1
- package/dist/client/static/js/index-4bqssvt6.js +0 -2
- package/dist/client/static/js/index-dpy3ewrn.css +0 -1
- package/dist/client/static/js/index-gq5w5w8x.js +0 -2
- package/dist/client/static/js/index-ta6gpcpw.js +0 -3
- 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-4b8er03c.js +0 -1
- package/dist/client/static/js/one-light-e6r3vsz4.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-3q2a15wc.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,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The shapes both halves of the Kanban share.
|
|
8
|
+
*
|
|
9
|
+
* The panel (a browser), the plugin's server half (Kabmo's process) and the MCP
|
|
10
|
+
* child (its own process) all read and write the SAME files, so every type here
|
|
11
|
+
* is the file format itself rather than a wire-only shape. Two rules follow:
|
|
12
|
+
*
|
|
13
|
+
* - **A card is a CONTROL record.** Title, stage, priority, workspace, the task
|
|
14
|
+
* (prompt + images + agent picks) and the linked session. No description, no
|
|
15
|
+
* comments, no labels — the board drives work, it does not hold knowledge.
|
|
16
|
+
* - **A stage carries the agent configuration**, so moving a card into Review
|
|
17
|
+
* can change the harness and the system prompt. Resolution is per FIELD and
|
|
18
|
+
* its chain is `card → stage → board defaults → host default`, which is what
|
|
19
|
+
* `resolveAgent` reports so the sheet can say where each value came from.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/** The agent settings a card, a stage or the board may name. Every field optional. */
|
|
23
|
+
export interface AgentSpec {
|
|
24
|
+
/** A harness id from the host's catalog (`omp-rpc`, `claude`, …). */
|
|
25
|
+
harness?: string;
|
|
26
|
+
/** `provider` + `modelId`, as the host's pickers name them. */
|
|
27
|
+
model?: { provider: string; modelId: string } | null;
|
|
28
|
+
/** A thinking level the harness publishes, or `null` for its own default. */
|
|
29
|
+
thinking?: string | null;
|
|
30
|
+
/** An approval mode (`always-ask`, `write`, `yolo`). */
|
|
31
|
+
access?: string;
|
|
32
|
+
/** Appended to omp's own system prompt; prepended to the first turn on ACP. */
|
|
33
|
+
prompt?: string;
|
|
34
|
+
/** Comma-free globs that narrow the skill catalog for a spawned session. */
|
|
35
|
+
skills?: string[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** One stage (a column). `session` marks the stages that run an agent. */
|
|
39
|
+
export interface Stage {
|
|
40
|
+
id: string;
|
|
41
|
+
label: string;
|
|
42
|
+
hidden: boolean;
|
|
43
|
+
/** True when landing here should start (or continue) a session. */
|
|
44
|
+
session: boolean;
|
|
45
|
+
agent?: AgentSpec;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** `board.json`. */
|
|
49
|
+
export interface Board {
|
|
50
|
+
schema: 2;
|
|
51
|
+
defaults: AgentSpec;
|
|
52
|
+
stages: Stage[];
|
|
53
|
+
updatedAt: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** One image a card carries, in the shape the queue persists. */
|
|
57
|
+
export interface TaskImage {
|
|
58
|
+
name: string;
|
|
59
|
+
mimeType: string;
|
|
60
|
+
dataBase64: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** The task a card dispatches — a queue message with picks. */
|
|
64
|
+
export interface CardTask {
|
|
65
|
+
prompt: string;
|
|
66
|
+
images: TaskImage[];
|
|
67
|
+
agent?: AgentSpec;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** `cards/<id>.json`. */
|
|
71
|
+
export interface Card {
|
|
72
|
+
schema: 2;
|
|
73
|
+
id: string;
|
|
74
|
+
title: string;
|
|
75
|
+
status: string;
|
|
76
|
+
priority: number;
|
|
77
|
+
workspace: string | null;
|
|
78
|
+
task: CardTask;
|
|
79
|
+
sessionId: string | null;
|
|
80
|
+
createdAt: string;
|
|
81
|
+
updatedAt: string;
|
|
82
|
+
movedAt: string | null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** A card as the board list carries it: no prompt, no images. */
|
|
86
|
+
export type CardSummary = Omit<Card, 'task'> & { hasPrompt: boolean; imageCount: number };
|
|
87
|
+
|
|
88
|
+
/** One file the board could not read, named so the panel can show it. */
|
|
89
|
+
export interface BoardError {
|
|
90
|
+
path: string;
|
|
91
|
+
message: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** One card plus the board it belongs to — what the card sheet reads. */
|
|
95
|
+
export interface CardDetail {
|
|
96
|
+
card: Card;
|
|
97
|
+
board: Board;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** What `openBoard` answers. */
|
|
101
|
+
export interface BoardSnapshot {
|
|
102
|
+
dataDir: string;
|
|
103
|
+
revision: number;
|
|
104
|
+
board: Board;
|
|
105
|
+
cards: CardSummary[];
|
|
106
|
+
errors: BoardError[];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* What `openBoard` answers.
|
|
111
|
+
*
|
|
112
|
+
* "No board yet" is a STATE, not a transport error: a panel that had to parse a
|
|
113
|
+
* refusal CODE to decide whether to offer Create would break the day the plugin
|
|
114
|
+
* route re-wrapped its errors (it does — a thrown handler becomes
|
|
115
|
+
* `handler_error`). The absence is therefore a value the type can see.
|
|
116
|
+
*/
|
|
117
|
+
export type BoardRead = ({ exists: true } & BoardSnapshot) | { exists: false; dataDir: string };
|
|
118
|
+
|
|
119
|
+
/** The plugin's realtime topic: an invalidation signal, never the board itself. */
|
|
120
|
+
export interface BoardSignal {
|
|
121
|
+
revision: number;
|
|
122
|
+
at: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** Which level a resolved field came from. */
|
|
126
|
+
export type AgentOrigin = 'card' | 'stage' | 'defaults' | 'host';
|
|
127
|
+
|
|
128
|
+
/** A resolved agent, with the origin of every field the sheet displays. */
|
|
129
|
+
export interface ResolvedAgent {
|
|
130
|
+
harness: string;
|
|
131
|
+
model: { provider: string; modelId: string } | null;
|
|
132
|
+
thinking: string | null;
|
|
133
|
+
access: string;
|
|
134
|
+
prompt: string;
|
|
135
|
+
skills: string[];
|
|
136
|
+
origin: {
|
|
137
|
+
harness: AgentOrigin;
|
|
138
|
+
model: AgentOrigin;
|
|
139
|
+
thinking: AgentOrigin;
|
|
140
|
+
access: AgentOrigin;
|
|
141
|
+
prompt: AgentOrigin;
|
|
142
|
+
skills: AgentOrigin;
|
|
143
|
+
};
|
|
144
|
+
/** How the prompt reaches the agent on this transport. */
|
|
145
|
+
promptDelivery: 'appended' | 'prepended';
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** The RPC refusal codes. A refusal is a value, never a thrown transport error. */
|
|
149
|
+
export type KanbanErrorCode =
|
|
150
|
+
| 'no_board'
|
|
151
|
+
| 'not_found'
|
|
152
|
+
| 'invalid'
|
|
153
|
+
| 'stale'
|
|
154
|
+
| 'no_workspace'
|
|
155
|
+
| 'io';
|
|
156
|
+
|
|
157
|
+
/** The stages a fresh board starts with. `session` marks the working lanes. */
|
|
158
|
+
export const DEFAULT_STAGES: readonly Stage[] = [
|
|
159
|
+
{ id: 'backlog', label: 'Backlog', hidden: false, session: false },
|
|
160
|
+
{ id: 'open', label: 'Todo', hidden: false, session: false },
|
|
161
|
+
{ id: 'in_progress', label: 'In Progress', hidden: false, session: true },
|
|
162
|
+
{ id: 'review', label: 'Review', hidden: true, session: true },
|
|
163
|
+
{ id: 'test', label: 'Test', hidden: true, session: false },
|
|
164
|
+
{ id: 'done', label: 'Done', hidden: false, session: false },
|
|
165
|
+
];
|
|
166
|
+
|
|
167
|
+
/** The stage a card moves to when work starts on it. */
|
|
168
|
+
export const START_STAGE = 'in_progress';
|
|
169
|
+
|
|
170
|
+
/** A stage id: lowercase, underscore-separated, and short enough to be a filename. */
|
|
171
|
+
export const STAGE_ID = /^[a-z][a-z0-9_]{0,31}$/;
|
|
172
|
+
/** A card id. Six hex characters after the prefix. */
|
|
173
|
+
export const CARD_ID = /^k-[0-9a-f]{6}$/;
|
|
174
|
+
|
|
175
|
+
/** The largest system prompt a stage may carry (the host caps it again). */
|
|
176
|
+
export const MAX_PROMPT_CHARS = 8_192;
|
|
177
|
+
/** How many images one card may hold. */
|
|
178
|
+
export const MAX_IMAGES = 4;
|
|
179
|
+
/** The byte ceiling for one card's images, decoded. */
|
|
180
|
+
export const MAX_IMAGE_BYTES = 2 * 1024 * 1024;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The plugin's server half, driven through the SDK's own API object.
|
|
8
|
+
*
|
|
9
|
+
* What this pins is the ONE thing the store cannot: an agent's write is a FILE
|
|
10
|
+
* EVENT, and the panel only learns about it because this half publishes a new
|
|
11
|
+
* revision. The MCP child is a separate process, so nothing else in the plugin
|
|
12
|
+
* could notice.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
16
|
+
import fs from 'fs';
|
|
17
|
+
import os from 'os';
|
|
18
|
+
import path from 'path';
|
|
19
|
+
|
|
20
|
+
import type { KabmoPluginApi, PluginJson } from '@kabmo-labs/kabmo-sdk';
|
|
21
|
+
|
|
22
|
+
import plugin from './server';
|
|
23
|
+
import { addCard, createBoard, moveCard } from './store/ops';
|
|
24
|
+
import { cardFile } from './store/fs';
|
|
25
|
+
import type { BoardSignal } from './protocol';
|
|
26
|
+
|
|
27
|
+
let dataDir = '';
|
|
28
|
+
let published: BoardSignal[] = [];
|
|
29
|
+
let disposed: (() => void | Promise<void>)[] = [];
|
|
30
|
+
|
|
31
|
+
/** The smallest API that satisfies the members `plugin()` touches. */
|
|
32
|
+
function fakeApi(): KabmoPluginApi {
|
|
33
|
+
return {
|
|
34
|
+
pluginId: 'kanban',
|
|
35
|
+
paths: { dataDir },
|
|
36
|
+
log: { debug() {}, info() {}, warn() {}, error() {} },
|
|
37
|
+
realtime: {
|
|
38
|
+
seed(value: PluginJson) {
|
|
39
|
+
published = [value as unknown as BoardSignal];
|
|
40
|
+
},
|
|
41
|
+
publish(value: PluginJson) {
|
|
42
|
+
published.push(value as unknown as BoardSignal);
|
|
43
|
+
},
|
|
44
|
+
current: () => published[published.length - 1],
|
|
45
|
+
},
|
|
46
|
+
rpc: { register: () => () => {} },
|
|
47
|
+
mcp: { register: () => undefined },
|
|
48
|
+
onDispose(hook: () => void | Promise<void>) {
|
|
49
|
+
disposed.push(hook);
|
|
50
|
+
},
|
|
51
|
+
} as unknown as KabmoPluginApi;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
beforeEach(() => {
|
|
55
|
+
dataDir = fs.mkdtempSync(path.join(os.tmpdir(), 'kanban-server-'));
|
|
56
|
+
published = [];
|
|
57
|
+
disposed = [];
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
afterEach(async () => {
|
|
61
|
+
for (const hook of disposed) await hook();
|
|
62
|
+
fs.rmSync(dataDir, { recursive: true, force: true });
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe('the board watcher', () => {
|
|
66
|
+
test('an agent writing a card file publishes a new revision', async () => {
|
|
67
|
+
await createBoard(dataDir);
|
|
68
|
+
plugin(fakeApi());
|
|
69
|
+
// Seeded at load, so a subscriber that arrives first has a value.
|
|
70
|
+
expect(published).toHaveLength(1);
|
|
71
|
+
expect(published[0]).toEqual({ revision: 0, at: expect.any(String) });
|
|
72
|
+
|
|
73
|
+
const card = await addCard(dataDir, { title: 'Agent work' });
|
|
74
|
+
await moveCard(dataDir, card.id, 'review');
|
|
75
|
+
|
|
76
|
+
// `fs.watch` delivery is asynchronous, so the wait polls — but it must not
|
|
77
|
+
// KEEP WRITING: the publish is debounced, and a write every 50 ms clears the
|
|
78
|
+
// timer before it can fire (measured: the loop starved its own assertion).
|
|
79
|
+
const deadline = Date.now() + 5_000;
|
|
80
|
+
while (published.length < 2 && Date.now() < deadline) await Bun.sleep(25);
|
|
81
|
+
expect(published.length).toBeGreaterThan(1);
|
|
82
|
+
expect(published[published.length - 1]!.revision).toBeGreaterThan(0);
|
|
83
|
+
}, 10_000);
|
|
84
|
+
|
|
85
|
+
test('a burst of writes collapses into one publish', async () => {
|
|
86
|
+
await createBoard(dataDir);
|
|
87
|
+
plugin(fakeApi());
|
|
88
|
+
const before = published.length;
|
|
89
|
+
const card = await addCard(dataDir, { title: 'Burst' });
|
|
90
|
+
for (const status of ['backlog', 'open', 'in_progress', 'review', 'test', 'done']) {
|
|
91
|
+
await moveCard(dataDir, card.id, status);
|
|
92
|
+
}
|
|
93
|
+
await Bun.sleep(400);
|
|
94
|
+
// Six writes in a few milliseconds must not be six frames.
|
|
95
|
+
expect(published.length - before).toBeLessThan(3);
|
|
96
|
+
}, 10_000);
|
|
97
|
+
|
|
98
|
+
test('dispose closes the watcher: a later write publishes nothing', async () => {
|
|
99
|
+
await createBoard(dataDir);
|
|
100
|
+
plugin(fakeApi());
|
|
101
|
+
for (const hook of disposed) await hook();
|
|
102
|
+
const before = published.length;
|
|
103
|
+
await addCard(dataDir, { title: 'After dispose' });
|
|
104
|
+
await Bun.sleep(300);
|
|
105
|
+
expect(published.length).toBe(before);
|
|
106
|
+
}, 10_000);
|
|
107
|
+
|
|
108
|
+
test('the board directory is created so a first run has somewhere to watch', () => {
|
|
109
|
+
plugin(fakeApi());
|
|
110
|
+
expect(fs.existsSync(path.join(dataDir, 'kanban', 'cards'))).toBe(true);
|
|
111
|
+
expect(fs.existsSync(cardFile(dataDir, 'k-abcdef'))).toBe(false);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The plugin's server half: the RPC surface the panel calls, the invalidation
|
|
8
|
+
* topic, and the watcher that notices an AGENT's write.
|
|
9
|
+
*
|
|
10
|
+
* The watcher is the half that makes decision 3 visible. An agent moves a card
|
|
11
|
+
* through the MCP child, which is a different process; the panel only learns
|
|
12
|
+
* about it because `cards/` changed and this half publishes a new revision. So
|
|
13
|
+
* the topic carries `{ revision, at }` rather than the board — a 500-card board
|
|
14
|
+
* on every file event would be the socket doing a database's job.
|
|
15
|
+
*
|
|
16
|
+
* Nothing here resolves a model or spawns a session. `resolveAgent` reports the
|
|
17
|
+
* chain and the PANEL calls `/api/agent/new` with it, because that route already
|
|
18
|
+
* owns the fallbacks (project default, persisted pick, approval mode) and a
|
|
19
|
+
* second copy of that rule is how the board and the composer would drift.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import fs from 'fs';
|
|
23
|
+
import path from 'path';
|
|
24
|
+
import { fileURLToPath } from 'node:url';
|
|
25
|
+
|
|
26
|
+
import type { KabmoPluginApi } from '@kabmo-labs/kabmo-sdk';
|
|
27
|
+
|
|
28
|
+
import type { BoardSignal, ResolvedAgent } from './protocol';
|
|
29
|
+
import { KanbanError, boardDir, cardsDir } from './store/fs';
|
|
30
|
+
import {
|
|
31
|
+
addCard,
|
|
32
|
+
cardDetail,
|
|
33
|
+
claimCard,
|
|
34
|
+
createBoard,
|
|
35
|
+
linkSession,
|
|
36
|
+
moveCard,
|
|
37
|
+
readBoardState,
|
|
38
|
+
removeCard,
|
|
39
|
+
saveDefaults,
|
|
40
|
+
saveStages,
|
|
41
|
+
updateCard,
|
|
42
|
+
} from './store/ops';
|
|
43
|
+
import { readBoard } from './store/board';
|
|
44
|
+
import { resolveAgent } from './store/resolve';
|
|
45
|
+
import { runMcpServer } from './mcp';
|
|
46
|
+
|
|
47
|
+
/** The debounce a burst of file events collapses into. */
|
|
48
|
+
const WATCH_DEBOUNCE_MS = 150;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The MCP bootstrap lives HERE, not in the app bundle.
|
|
52
|
+
*
|
|
53
|
+
* `dist/server.js` is the one file built for Bun and spawned as a process, so it
|
|
54
|
+
* is the only place a stdio server can live. `import.meta.main` is what keeps the
|
|
55
|
+
* two uses apart: Kabmo IMPORTS this module as a factory, and an MCP client RUNS
|
|
56
|
+
* it with `--mcp` — without the guard, importing the plugin would start a server
|
|
57
|
+
* on Kabmo's own stdin.
|
|
58
|
+
*/
|
|
59
|
+
if (import.meta.main && Bun.argv.includes('--mcp')) {
|
|
60
|
+
// The HOST's data dir, not the board dir: `boardDir()` appends `kanban`, and
|
|
61
|
+
// handing it a board dir would nest a second one.
|
|
62
|
+
const dir = Bun.env.KANBAN_DATA_DIR;
|
|
63
|
+
if (!dir) {
|
|
64
|
+
// Loud, because an empty board is worse than a refusal: a client pointed at
|
|
65
|
+
// the wrong directory would read cards that are not there and act on them.
|
|
66
|
+
process.stderr.write('kanban: KANBAN_DATA_DIR is required when running as an MCP server.\n');
|
|
67
|
+
process.exit(2);
|
|
68
|
+
}
|
|
69
|
+
await runMcpServer(dir);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export default function plugin(api: KabmoPluginApi): void {
|
|
73
|
+
const dataDir = api.paths.dataDir;
|
|
74
|
+
let revision = 0;
|
|
75
|
+
api.realtime.seed({ revision: 0, at: new Date().toISOString() } satisfies BoardSignal);
|
|
76
|
+
|
|
77
|
+
const publish = () => {
|
|
78
|
+
revision += 1;
|
|
79
|
+
api.realtime.publish({ revision, at: new Date().toISOString() } satisfies BoardSignal);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/** Run an operation, publish, and answer the fresh revision with it. */
|
|
83
|
+
const mutate = async <T>(work: () => Promise<T>): Promise<T & { revision: number }> => {
|
|
84
|
+
const value = await work();
|
|
85
|
+
publish();
|
|
86
|
+
return { ...value, revision: revision + 1 };
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// `openBoard` answers absence as a VALUE (`exists: false`), because the panel
|
|
90
|
+
// needs to offer Create — and the route re-wraps a thrown refusal as
|
|
91
|
+
// `handler_error`, so a code the client matched on would never arrive.
|
|
92
|
+
api.rpc.register('openBoard', { handler: () => readBoardState(dataDir) });
|
|
93
|
+
api.rpc.register('initBoard', { handler: async () => ({ exists: true, ...(await createBoard(dataDir)) }) });
|
|
94
|
+
api.rpc.register('readCard', {
|
|
95
|
+
handler: async (input) => {
|
|
96
|
+
const { id } = input as { id: string };
|
|
97
|
+
const { card, board } = await cardDetail(dataDir, id);
|
|
98
|
+
const stage = board.stages.find((entry) => entry.id === card.status);
|
|
99
|
+
return { card, board, stage: stage ?? null, agent: resolveAgent(card, stage, board) };
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
api.rpc.register('createCard', {
|
|
103
|
+
handler: (input) => mutate(async () => ({ card: await addCard(dataDir, input as never) })),
|
|
104
|
+
});
|
|
105
|
+
api.rpc.register('updateCard', {
|
|
106
|
+
handler: (input) => {
|
|
107
|
+
const { id, patch, baseUpdatedAt } = input as { id: string; patch: never; baseUpdatedAt?: string };
|
|
108
|
+
return mutate(async () => ({ card: await updateCard(dataDir, id, patch, baseUpdatedAt) }));
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
api.rpc.register('moveCard', {
|
|
112
|
+
handler: (input) => {
|
|
113
|
+
const { id, status, baseUpdatedAt } = input as { id: string; status: string; baseUpdatedAt?: string };
|
|
114
|
+
return mutate(async () => moveCard(dataDir, id, status, baseUpdatedAt));
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
api.rpc.register('deleteCard', {
|
|
118
|
+
handler: (input) => {
|
|
119
|
+
const { id } = input as { id: string };
|
|
120
|
+
return mutate(async () => {
|
|
121
|
+
await removeCard(dataDir, id);
|
|
122
|
+
return {};
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
api.rpc.register('linkSession', {
|
|
127
|
+
handler: (input) => {
|
|
128
|
+
const { id, sessionId } = input as { id: string; sessionId: string | null };
|
|
129
|
+
return mutate(async () => ({ card: await linkSession(dataDir, id, sessionId) }));
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
api.rpc.register('claimCard', {
|
|
133
|
+
handler: (input) => {
|
|
134
|
+
const { id, sessionId } = input as { id: string; sessionId?: string };
|
|
135
|
+
return mutate(async () => ({ card: await claimCard(dataDir, id, sessionId) }));
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
api.rpc.register('saveStages', {
|
|
139
|
+
handler: (input) => {
|
|
140
|
+
const { stages } = input as { stages: never };
|
|
141
|
+
return mutate(async () => ({ board: (await saveStages(dataDir, stages)).board }));
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
api.rpc.register('saveDefaults', {
|
|
145
|
+
handler: (input) => {
|
|
146
|
+
const { defaults } = input as { defaults: never };
|
|
147
|
+
return mutate(async () => ({ board: (await saveDefaults(dataDir, defaults)).board }));
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
/** The chain, reported so the sheet can name where every field came from. */
|
|
151
|
+
api.rpc.register('resolveAgent', {
|
|
152
|
+
handler: async (input) => {
|
|
153
|
+
const { id } = input as { id: string };
|
|
154
|
+
const { card, board } = await cardDetail(dataDir, id);
|
|
155
|
+
const stage = board.stages.find((entry) => entry.id === card.status);
|
|
156
|
+
return { agent: resolveAgent(card, stage, board) satisfies ResolvedAgent };
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
/** The board's defaults and stages, for a sheet that has no card selected. */
|
|
160
|
+
api.rpc.register('readStages', { handler: () => readBoard(dataDir) });
|
|
161
|
+
api.rpc.register('watchTick', {
|
|
162
|
+
// Exposed for the panel's manual Refresh: the same publish a file event does.
|
|
163
|
+
handler: () => {
|
|
164
|
+
publish();
|
|
165
|
+
return { revision };
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
/**
|
|
169
|
+
* Watch the board directory.
|
|
170
|
+
*
|
|
171
|
+
* `fs.watch` on the directory (not each file) so a card CREATED by an agent is
|
|
172
|
+
* noticed too. The watcher is best-effort: a platform that cannot watch leaves
|
|
173
|
+
* the panel's Refresh button as the way to catch up, which is stated rather
|
|
174
|
+
* than hidden.
|
|
175
|
+
*/
|
|
176
|
+
let watcher: fs.FSWatcher | null = null;
|
|
177
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
178
|
+
const schedule = () => {
|
|
179
|
+
clearTimeout(timer);
|
|
180
|
+
timer = setTimeout(() => {
|
|
181
|
+
timer = undefined;
|
|
182
|
+
publish();
|
|
183
|
+
}, WATCH_DEBOUNCE_MS);
|
|
184
|
+
};
|
|
185
|
+
try {
|
|
186
|
+
fs.mkdirSync(cardsDir(dataDir), { recursive: true });
|
|
187
|
+
watcher = fs.watch(cardsDir(dataDir), { persistent: false }, schedule);
|
|
188
|
+
} catch (cause) {
|
|
189
|
+
api.log.warn('the board is not being watched; Refresh still re-reads', {
|
|
190
|
+
message: cause instanceof Error ? cause.message : String(cause),
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
api.onDispose(() => {
|
|
195
|
+
clearTimeout(timer);
|
|
196
|
+
watcher?.close();
|
|
197
|
+
watcher = null;
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* The agent's tool surface, declared once and delivered by the host.
|
|
202
|
+
*
|
|
203
|
+
* `env` is what makes this work with no `cwd` on a plugin MCP server: the child
|
|
204
|
+
* is TOLD where Kabmo keeps its state instead of guessing from the agent's
|
|
205
|
+
* directory.
|
|
206
|
+
* `fileURLToPath`, not `.pathname`, because the latter yields `/C:/…` on
|
|
207
|
+
* Windows. `--mcp` is the guard `server.ts` checks with `import.meta.main`, so
|
|
208
|
+
* this file is both the plugin and the MCP server.
|
|
209
|
+
*/
|
|
210
|
+
api.mcp.register({
|
|
211
|
+
id: 'board',
|
|
212
|
+
transport: 'stdio',
|
|
213
|
+
command: Bun.which('bun') ?? 'bun',
|
|
214
|
+
args: [fileURLToPath(import.meta.url), '--mcp'],
|
|
215
|
+
env: { KANBAN_DATA_DIR: dataDir },
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
api.log.info('kanban server half loaded', { board: boardDir(dataDir) });
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/** Re-exported so the RPC route can answer a refusal as a value, not a throw. */
|
|
222
|
+
export { KanbanError };
|
|
223
|
+
|
|
224
|
+
/** The card file path, for the panel's "Show file" action. */
|
|
225
|
+
export function cardPath(dataDir: string, id: string): string {
|
|
226
|
+
return path.join(cardsDir(dataDir), `${id}.json`);
|
|
227
|
+
}
|