@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
|
@@ -34,6 +34,8 @@ import { readPluginManifest } from '@/server/lib/panels/files.server';
|
|
|
34
34
|
import { toManifest } from '@/server/lib/panels/manifest';
|
|
35
35
|
import { pluginSettingsDefinitions } from '@/server/lib/panels/settings-schema.server';
|
|
36
36
|
import { createPluginStorage } from '@/server/lib/plugins/storage.server';
|
|
37
|
+
import { getDataDir } from '@/server/lib/lifecycle/paths';
|
|
38
|
+
import { importPluginModule } from '@/server/lib/plugins/module-import.server';
|
|
37
39
|
import { createPluginSettings, clearPluginSettingListeners } from '@/server/lib/plugins/settings.server';
|
|
38
40
|
import { registerRpcMethod, clearPluginRpcMethods } from '@/server/lib/plugins/rpc.server';
|
|
39
41
|
import { createPluginHttp, clearPluginHttpRoutes } from '@/server/lib/plugins/http.server';
|
|
@@ -154,6 +156,16 @@ export function loadedPlugins(): LoadedPlugin[] {
|
|
|
154
156
|
* only plugins reachable here are ones the scan already admitted — installed,
|
|
155
157
|
* enabled, and compatible.
|
|
156
158
|
*/
|
|
159
|
+
/**
|
|
160
|
+
* Import a plugin's server bundle, busting the module cache.
|
|
161
|
+
*
|
|
162
|
+
* Bun keys an ESM module by its resolved URL, so re-importing the SAME path
|
|
163
|
+
* returns the module it loaded the first time — measured: a rebuilt plugin kept
|
|
164
|
+
* serving its previous code until the whole process restarted, which made
|
|
165
|
+
* Rebuild look like a no-op and an update look like it did nothing. The query is
|
|
166
|
+
* the file's mtime + size, so a changed bundle is a changed URL and an unchanged
|
|
167
|
+
* one still hits the cache.
|
|
168
|
+
*/
|
|
157
169
|
export async function loadPluginServer(pluginId: string): Promise<LoadedPlugin> {
|
|
158
170
|
const existing = loaded().get(pluginId);
|
|
159
171
|
if (existing) return existing;
|
|
@@ -173,7 +185,8 @@ export async function loadPluginServer(pluginId: string): Promise<LoadedPlugin>
|
|
|
173
185
|
const settings = await pluginSettingsDefinitions(dir, parsed);
|
|
174
186
|
if ('error' in settings) throw new Error(`plugin "${pluginId}" has an invalid settings schema: ${settings.error}`);
|
|
175
187
|
|
|
176
|
-
const
|
|
188
|
+
const loadedModule = await importPluginModule(entry);
|
|
189
|
+
const module = loadedModule.module as { default?: unknown };
|
|
177
190
|
if (typeof module.default !== 'function') {
|
|
178
191
|
throw new Error(`plugin "${pluginId}" has no server factory default export (export default function plugin(api) {})`);
|
|
179
192
|
}
|
|
@@ -207,12 +220,18 @@ export async function loadPluginServer(pluginId: string): Promise<LoadedPlugin>
|
|
|
207
220
|
events: events,
|
|
208
221
|
background: background.api,
|
|
209
222
|
mcp: createPluginMcp(pluginId),
|
|
223
|
+
// The host's own resolution, handed over rather than re-derived: a plugin
|
|
224
|
+
// that reads `~/.kabmo` itself is wrong on every XDG/relocated install.
|
|
225
|
+
paths: { dataDir: getDataDir() },
|
|
210
226
|
onDispose(hook) {
|
|
211
227
|
if (typeof hook !== 'function') throw new Error('onDispose expects a function');
|
|
212
228
|
track(hook);
|
|
213
229
|
},
|
|
214
230
|
};
|
|
215
231
|
|
|
232
|
+
// Registered FIRST so it runs LAST: the module's own disposers may still read
|
|
233
|
+
// files beside the bundle (a copied entry that spawns itself).
|
|
234
|
+
track(loadedModule.cleanup);
|
|
216
235
|
const record: LoadedPlugin = { pluginId, api, background: background.handle, disposers };
|
|
217
236
|
// Registered BEFORE the factory runs: a factory that registers something and
|
|
218
237
|
// then throws still needs its partial registrations disposed, and the only
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Importing a plugin's server bundle as a module Bun has not seen.
|
|
8
|
+
*
|
|
9
|
+
* A plain `import(entry)` is cached by resolved URL, and **Bun ignores a query
|
|
10
|
+
* string on a file specifier** (measured in one process: `?v=1` then `?v=2`
|
|
11
|
+
* returned the SAME module object). So a rebuilt plugin kept running its previous
|
|
12
|
+
* code until Kabmo restarted, and Rebuild looked like a no-op.
|
|
13
|
+
*
|
|
14
|
+
* The workaround is a COPY in the same directory, imported under its own name: a
|
|
15
|
+
* fresh URL, and `import.meta.url` still resolves to a real file in the plugin's
|
|
16
|
+
* own directory — which matters, because a plugin that ships an MCP server spawns
|
|
17
|
+
* itself from that URL. The copy is removed on dispose, never immediately: an
|
|
18
|
+
* unlinked path would make that spawn fail.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import fs from 'fs';
|
|
22
|
+
import { basename, dirname, join } from 'path';
|
|
23
|
+
import { pathToFileURL } from 'node:url';
|
|
24
|
+
|
|
25
|
+
/** Never reused: each load is a fresh module, so a Rebuild always takes effect. */
|
|
26
|
+
let moduleLoadSeq = 0;
|
|
27
|
+
|
|
28
|
+
export async function importPluginModule(entry: string): Promise<{
|
|
29
|
+
module: unknown;
|
|
30
|
+
cleanup: () => Promise<void>;
|
|
31
|
+
}> {
|
|
32
|
+
// A dot prefix keeps the copy out of the bundle route and out of a directory
|
|
33
|
+
// listing a reader would mistake for a real entry.
|
|
34
|
+
const copy = join(dirname(entry), `.${basename(entry)}.load-${++moduleLoadSeq}.mjs`);
|
|
35
|
+
await fs.promises.copyFile(entry, copy);
|
|
36
|
+
try {
|
|
37
|
+
return {
|
|
38
|
+
module: await import(pathToFileURL(copy).href),
|
|
39
|
+
cleanup: () => fs.promises.rm(copy, { force: true }),
|
|
40
|
+
};
|
|
41
|
+
} catch (cause) {
|
|
42
|
+
await fs.promises.rm(copy, { force: true });
|
|
43
|
+
throw cause;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The spawn-time system prompt a stage asks for.
|
|
8
|
+
*
|
|
9
|
+
* Two rules are load-bearing and each was a silent failure before the plumbing
|
|
10
|
+
* existed: omp can only take the prompt at SPAWN (so the request has to carry
|
|
11
|
+
* it), and ACP has no field for it at all (so the prompt has to ride the first
|
|
12
|
+
* turn, delimited). Both are asserted here, plus the refusals that keep an
|
|
13
|
+
* over-long argv and a comma-split glob from reaching a child.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { describe, expect, test } from 'bun:test';
|
|
17
|
+
import {
|
|
18
|
+
MAX_SKILL_GLOBS,
|
|
19
|
+
MAX_SYSTEM_PROMPT_CHARS,
|
|
20
|
+
readSpawnPrompt,
|
|
21
|
+
withSystemPrompt,
|
|
22
|
+
} from '@/server/routes/agent/new';
|
|
23
|
+
|
|
24
|
+
describe('readSpawnPrompt', () => {
|
|
25
|
+
test('a trimmed prompt and its globs survive', () => {
|
|
26
|
+
expect(readSpawnPrompt({ systemPrompt: ' Work the card. ', skills: ['review-*', ' pr-* '] })).toEqual({
|
|
27
|
+
ok: true,
|
|
28
|
+
prompt: { systemPrompt: 'Work the card.', skills: ['review-*', 'pr-*'] },
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('nothing asked for is an empty snapshot, not a refusal', () => {
|
|
33
|
+
expect(readSpawnPrompt({})).toEqual({ ok: true, prompt: {} });
|
|
34
|
+
expect(readSpawnPrompt({ systemPrompt: ' ', skills: [] })).toEqual({ ok: true, prompt: {} });
|
|
35
|
+
expect(readSpawnPrompt({ skills: ['', ' '] })).toEqual({ ok: true, prompt: {} });
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('a non-string prompt is refused by name', () => {
|
|
39
|
+
expect(readSpawnPrompt({ systemPrompt: 42 })).toEqual({ ok: false, error: 'systemPrompt must be a string' });
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('an over-long prompt is refused rather than truncated', () => {
|
|
43
|
+
// Truncating would silently drop the half of the instructions that came
|
|
44
|
+
// last, which is exactly where a stage puts "do not edit code".
|
|
45
|
+
const long = 'x'.repeat(MAX_SYSTEM_PROMPT_CHARS + 1);
|
|
46
|
+
expect(readSpawnPrompt({ systemPrompt: long }).ok).toBe(false);
|
|
47
|
+
expect(readSpawnPrompt({ systemPrompt: 'x'.repeat(MAX_SYSTEM_PROMPT_CHARS) }).ok).toBe(true);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('a glob with a comma is refused: the flag is a comma-separated list', () => {
|
|
51
|
+
expect(readSpawnPrompt({ skills: ['a,b'] })).toEqual({
|
|
52
|
+
ok: false,
|
|
53
|
+
error: 'a skill glob may not contain a comma',
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test('the glob list is bounded', () => {
|
|
58
|
+
const many = Array.from({ length: MAX_SKILL_GLOBS + 1 }, (_, index) => `s${index}-*`);
|
|
59
|
+
expect(readSpawnPrompt({ skills: many }).ok).toBe(false);
|
|
60
|
+
expect(readSpawnPrompt({ skills: many.slice(0, MAX_SKILL_GLOBS) }).ok).toBe(true);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('a non-array skills field is refused', () => {
|
|
64
|
+
expect(readSpawnPrompt({ skills: 'review-*' })).toEqual({
|
|
65
|
+
ok: false,
|
|
66
|
+
error: 'skills must be an array of globs',
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
describe('withSystemPrompt', () => {
|
|
72
|
+
test('ACP gets the instructions in a delimited block above the task', () => {
|
|
73
|
+
expect(withSystemPrompt('Review it.', 'Look at the diff.')).toBe(
|
|
74
|
+
'<stage_instructions>\nReview it.\n</stage_instructions>\n\nLook at the diff.',
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('no prompt leaves the message byte-identical', () => {
|
|
79
|
+
expect(withSystemPrompt(undefined, 'Look at the diff.')).toBe('Look at the diff.');
|
|
80
|
+
});
|
|
81
|
+
});
|
|
@@ -2,6 +2,7 @@ import { json } from '@/server/lib/remix-compat';
|
|
|
2
2
|
import type { ActionFunctionArgs } from '@/server/lib/remix-compat';
|
|
3
3
|
import { getDb } from '@/server/db.server';
|
|
4
4
|
import { startNewRpcSession } from '@/server/lib/omp/rpc/manager';
|
|
5
|
+
import type { SessionPromptArgs } from '@/server/lib/omp/rpc/constants';
|
|
5
6
|
import { isApprovalMode, type ApprovalMode } from '@/shared/lib/omp/config/access-mode';
|
|
6
7
|
import { loadPersistedAccessMode } from '@/shared/lib/omp/config/access-mode.server';
|
|
7
8
|
import { rpcErrorResponse } from '@/server/lib/omp/rpc/errors';
|
|
@@ -38,6 +39,65 @@ async function loadPersistedModel(): Promise<{ provider: string; modelId: string
|
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
|
|
42
|
+
/** A refusal names the field, so the caller can fix it without reading the route. */
|
|
43
|
+
export type SpawnPromptResult =
|
|
44
|
+
| { ok: true; prompt: SessionPromptArgs }
|
|
45
|
+
| { ok: false; error: string };
|
|
46
|
+
|
|
47
|
+
/** A stage's instructions are capped: a spawn argv is not a document store. */
|
|
48
|
+
export const MAX_SYSTEM_PROMPT_CHARS = 8_192;
|
|
49
|
+
/** How many skill globs one spawn may carry (`--skills=a,b,c`). */
|
|
50
|
+
export const MAX_SKILL_GLOBS = 32;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The spawn-time prompt a caller asked for, or the sentence explaining why it
|
|
54
|
+
* was refused.
|
|
55
|
+
*
|
|
56
|
+
* `systemPrompt` is APPENDED to omp's own coding prompt (a substitution would
|
|
57
|
+
* drop the tool contract), and `skills` narrows the catalog for this child
|
|
58
|
+
* only. Both are spawn flags, so they cannot be applied to a live session —
|
|
59
|
+
* which is why a caller that names one must start the chat here.
|
|
60
|
+
*/
|
|
61
|
+
export function readSpawnPrompt(input: { systemPrompt?: unknown; skills?: unknown }): SpawnPromptResult {
|
|
62
|
+
const prompt: SessionPromptArgs = {};
|
|
63
|
+
if (input.systemPrompt !== undefined && input.systemPrompt !== null) {
|
|
64
|
+
if (typeof input.systemPrompt !== 'string') return { ok: false, error: 'systemPrompt must be a string' };
|
|
65
|
+
const text = input.systemPrompt.trim();
|
|
66
|
+
if (text.length > MAX_SYSTEM_PROMPT_CHARS) {
|
|
67
|
+
return { ok: false, error: `systemPrompt is limited to ${MAX_SYSTEM_PROMPT_CHARS} characters` };
|
|
68
|
+
}
|
|
69
|
+
if (text) prompt.systemPrompt = text;
|
|
70
|
+
}
|
|
71
|
+
if (input.skills !== undefined && input.skills !== null) {
|
|
72
|
+
if (!Array.isArray(input.skills)) return { ok: false, error: 'skills must be an array of globs' };
|
|
73
|
+
const globs: string[] = [];
|
|
74
|
+
for (const entry of input.skills) {
|
|
75
|
+
if (typeof entry !== 'string') return { ok: false, error: 'skills must be an array of globs' };
|
|
76
|
+
const glob = entry.trim();
|
|
77
|
+
if (!glob) continue;
|
|
78
|
+
// The flag is a COMMA-SEPARATED list, so a comma inside one glob would
|
|
79
|
+
// silently become two.
|
|
80
|
+
if (glob.includes(',')) return { ok: false, error: 'a skill glob may not contain a comma' };
|
|
81
|
+
globs.push(glob);
|
|
82
|
+
}
|
|
83
|
+
if (globs.length > MAX_SKILL_GLOBS) {
|
|
84
|
+
return { ok: false, error: `at most ${MAX_SKILL_GLOBS} skill globs are allowed` };
|
|
85
|
+
}
|
|
86
|
+
if (globs.length) prompt.skills = globs;
|
|
87
|
+
}
|
|
88
|
+
return { ok: true, prompt };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* ACP's `session/new` carries no system prompt, so the stage's instructions ride
|
|
93
|
+
* the first turn in a fenced block. Delimited rather than concatenated: an agent
|
|
94
|
+
* that quotes its prompt back must be able to tell instructions from the task.
|
|
95
|
+
*/
|
|
96
|
+
export function withSystemPrompt(systemPrompt: string | undefined, message: string): string {
|
|
97
|
+
if (!systemPrompt) return message;
|
|
98
|
+
return `<stage_instructions>\n${systemPrompt}\n</stage_instructions>\n\n${message}`;
|
|
99
|
+
}
|
|
100
|
+
|
|
41
101
|
// POST /api/agent/new — spawn a brand-new omp session and send the first
|
|
42
102
|
// prompt. Mirrors omp-web's /api/agent/new: the session id is generated by
|
|
43
103
|
// omp itself, so Kabmo adopts it via the URL param after the response.
|
|
@@ -60,6 +120,14 @@ export async function action({ request }: ActionFunctionArgs) {
|
|
|
60
120
|
return json({ error: 'cwd is required', code: 'cwd_required' }, { status: 400 });
|
|
61
121
|
}
|
|
62
122
|
|
|
123
|
+
// A stage's instructions, when the caller has them. Validated HERE rather
|
|
124
|
+
// than at the spawn, because an over-long argv is a caller error and the
|
|
125
|
+
// child would only report it as an opaque exit.
|
|
126
|
+
const spawnPrompt = readSpawnPrompt({ systemPrompt: body.systemPrompt, skills: body.skills });
|
|
127
|
+
if (!spawnPrompt.ok) {
|
|
128
|
+
return json({ error: spawnPrompt.error, code: 'invalid_system_prompt' }, { status: 400 });
|
|
129
|
+
}
|
|
130
|
+
|
|
63
131
|
// Trust a client-supplied mode only when valid; else use the persisted pick.
|
|
64
132
|
const accessMode = isApprovalMode(body.accessMode) ? body.accessMode : await loadPersistedAccessMode();
|
|
65
133
|
// The composer's Plan/Goal selection rides the spawn ENVIRONMENT, because a
|
|
@@ -92,9 +160,12 @@ export async function action({ request }: ActionFunctionArgs) {
|
|
|
92
160
|
body: body as Record<string, unknown>,
|
|
93
161
|
model: body.provider && body.modelId ? { provider: String(body.provider), modelId: String(body.modelId) } : null,
|
|
94
162
|
accessMode,
|
|
163
|
+
systemPrompt: spawnPrompt.prompt.systemPrompt,
|
|
95
164
|
});
|
|
96
165
|
}
|
|
97
|
-
|
|
166
|
+
// A system prompt is a SPAWN flag, so `startNewRpcSession` refuses a
|
|
167
|
+
// prewarmed child when one is asked for (see the registry).
|
|
168
|
+
const { session, realSessionId } = await startNewRpcSession(cwd, accessMode, modeEnv, spawnPrompt.prompt);
|
|
98
169
|
|
|
99
170
|
const { type, message, images, provider, modelId, thinkingLevel } = body as {
|
|
100
171
|
type: string;
|
|
@@ -154,12 +225,14 @@ export async function action({ request }: ActionFunctionArgs) {
|
|
|
154
225
|
* (`{sessionId, model}` / `{sessionId, data}`), and a client must not be able to
|
|
155
226
|
* tell which transport served a new chat.
|
|
156
227
|
*/
|
|
157
|
-
async function startAcpChat({ harness, cwd, body, model, accessMode }: {
|
|
228
|
+
async function startAcpChat({ harness, cwd, body, model, accessMode, systemPrompt }: {
|
|
158
229
|
harness: HarnessId;
|
|
159
230
|
cwd: string;
|
|
160
231
|
body: Record<string, unknown>;
|
|
161
232
|
model: { provider: string; modelId: string } | null;
|
|
162
233
|
accessMode: ApprovalMode;
|
|
234
|
+
/** ACP cannot take one at `session/new`; it is prepended to the first turn. */
|
|
235
|
+
systemPrompt?: string;
|
|
163
236
|
}): Promise<Response> {
|
|
164
237
|
const type = String(body.type ?? '');
|
|
165
238
|
const thinkingLevel = typeof body.thinkingLevel === 'string' ? body.thinkingLevel : null;
|
|
@@ -195,12 +268,13 @@ async function startAcpChat({ harness, cwd, body, model, accessMode }: {
|
|
|
195
268
|
return json({ success: true, sessionId: realSessionId, model: session.runModel, data: null, harness });
|
|
196
269
|
}
|
|
197
270
|
if (type === 'prompt') {
|
|
271
|
+
const typed = typeof body.message === 'string' ? body.message : '';
|
|
198
272
|
const ack = await session.send({
|
|
199
273
|
type: 'prompt',
|
|
200
|
-
message:
|
|
274
|
+
message: withSystemPrompt(systemPrompt, typed),
|
|
201
275
|
...(Array.isArray(body.images) && body.images.length > 0 ? { images: body.images } : {}),
|
|
202
276
|
});
|
|
203
|
-
await recordPrompt(realSessionId,
|
|
277
|
+
await recordPrompt(realSessionId, typed);
|
|
204
278
|
return json({ success: true, sessionId: realSessionId, data: ack, harness });
|
|
205
279
|
}
|
|
206
280
|
return json({ error: `Unsupported command: ${type}` }, { status: 400 });
|
|
@@ -117,6 +117,18 @@ describe('fs raw route', () => {
|
|
|
117
117
|
expect(res.headers.get('content-disposition')).toContain('report.pdf');
|
|
118
118
|
});
|
|
119
119
|
|
|
120
|
+
// The HTML preview loads a page's relative assets through this route, inside
|
|
121
|
+
// a sandboxed frame where the browser enforces strict MIME checking: a
|
|
122
|
+
// stylesheet served as `application/octet-stream` is refused and the page
|
|
123
|
+
// paints unstyled.
|
|
124
|
+
test('a stylesheet is served with a stylesheet type', async () => {
|
|
125
|
+
write('style.css', new TextEncoder().encode('body { color: red; }'));
|
|
126
|
+
const res = await raw('style.css');
|
|
127
|
+
|
|
128
|
+
expect(res.status).toBe(200);
|
|
129
|
+
expect(res.headers.get('content-type')).toBe('text/css; charset=utf-8');
|
|
130
|
+
});
|
|
131
|
+
|
|
120
132
|
test('a missing file is a 404', async () => {
|
|
121
133
|
const res = await raw('ghost.pdf');
|
|
122
134
|
expect(res.status).toBe(404);
|
|
@@ -7,12 +7,8 @@ import { json, type LoaderFunctionArgs } from '@/server/lib/remix-compat';
|
|
|
7
7
|
import { errorResponse } from '@/server/lib/route-adapter';
|
|
8
8
|
import { isMockMode } from '@/server/mock.server';
|
|
9
9
|
import { getDefaultFsRoot, resolveRoot, resolveWithinRoot } from '@/server/lib/fs/root';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
getFileExtension,
|
|
13
|
-
getRawContentType,
|
|
14
|
-
unsupportedEditorMessage,
|
|
15
|
-
} from '@/shared/lib/fs/file-kind';
|
|
10
|
+
import { EDITOR_MAX_BYTES_BY_EXT, unsupportedEditorMessage } from '@/shared/lib/fs/file-kind';
|
|
11
|
+
import { getFileExtension, getRawContentType } from '@/shared/lib/fs/mime';
|
|
16
12
|
|
|
17
13
|
/**
|
|
18
14
|
* GET /api/fs/raw?path=<rel>&root=<abs>&repo=<rel> — the file's bytes, verbatim.
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
import { json, type LoaderFunctionArgs } from '@/server/lib/remix-compat';
|
|
23
23
|
import { resolveRoot } from '@/server/lib/fs/root';
|
|
24
24
|
import { scopeToRepo } from '@/server/lib/fs/repo-scope';
|
|
25
|
-
import { getImageMimeType } from '@/shared/lib/fs/
|
|
25
|
+
import { getImageMimeType } from '@/shared/lib/fs/mime';
|
|
26
26
|
import { gitRun } from '@/server/lib/wiki/git';
|
|
27
27
|
import { ensureWikiMirror, readWikiAsset } from '@/server/lib/wiki/mirror.server';
|
|
28
28
|
import { parseWikiRemote } from '@/server/lib/wiki/remote';
|
|
@@ -13,13 +13,24 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { describe, expect, test } from 'bun:test';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
BINARY_VIEWERS,
|
|
18
|
+
DEFAULT_PREVIEW,
|
|
19
|
+
RENDERED_VIEWERS,
|
|
20
|
+
VIEWER_LABELS,
|
|
21
|
+
opensInPreview,
|
|
22
|
+
viewerKindFor,
|
|
23
|
+
type ViewerKind,
|
|
24
|
+
} from '@/shared/lib/fs/document-kind';
|
|
17
25
|
import { MAX_CSV_COLUMNS, MAX_CSV_ROWS, parseCsv, sniffDelimiter } from '@/shared/lib/fs/csv';
|
|
18
26
|
|
|
19
27
|
describe('viewerKindFor', () => {
|
|
20
28
|
test('each family maps to its viewer', () => {
|
|
21
29
|
expect(viewerKindFor('a.md')).toBe('markdown');
|
|
22
30
|
expect(viewerKindFor('a.markdown')).toBe('markdown');
|
|
31
|
+
expect(viewerKindFor('page.html')).toBe('html');
|
|
32
|
+
expect(viewerKindFor('page.htm')).toBe('html');
|
|
33
|
+
expect(viewerKindFor('PAGE.HTML')).toBe('html');
|
|
23
34
|
expect(viewerKindFor('a.csv')).toBe('csv');
|
|
24
35
|
expect(viewerKindFor('a.tsv')).toBe('csv');
|
|
25
36
|
expect(viewerKindFor('a.png')).toBe('image');
|
|
@@ -59,10 +70,11 @@ describe('viewerKindFor', () => {
|
|
|
59
70
|
});
|
|
60
71
|
|
|
61
72
|
test('every kind has a row in both lookup tables', () => {
|
|
62
|
-
const kinds: ViewerKind[] = ['code', 'markdown', 'svg', 'csv', 'image', 'pdf', 'docx', 'spreadsheet', 'drawio'];
|
|
73
|
+
const kinds: ViewerKind[] = ['code', 'markdown', 'html', 'svg', 'csv', 'image', 'pdf', 'docx', 'spreadsheet', 'drawio'];
|
|
63
74
|
for (const kind of kinds) {
|
|
64
75
|
expect(kind in BINARY_VIEWERS).toBe(true);
|
|
65
76
|
expect(kind in RENDERED_VIEWERS).toBe(true);
|
|
77
|
+
expect(kind in DEFAULT_PREVIEW).toBe(true);
|
|
66
78
|
// The status strip's word has to exist for every kind too, or a byte
|
|
67
79
|
// viewer's footer prints `undefined` where the viewer's name belongs.
|
|
68
80
|
expect(VIEWER_LABELS[kind].length).toBeGreaterThan(0);
|
|
@@ -78,6 +90,10 @@ describe('viewerKindFor', () => {
|
|
|
78
90
|
// form — the eye toggle's pair — and no byte fetch.
|
|
79
91
|
expect(RENDERED_VIEWERS.drawio).toBe(true);
|
|
80
92
|
expect(BINARY_VIEWERS.drawio).toBeUndefined();
|
|
93
|
+
// An HTML page is editable text with a rendered form, exactly like markdown.
|
|
94
|
+
expect(RENDERED_VIEWERS.html).toBe(true);
|
|
95
|
+
expect(BINARY_VIEWERS.html).toBeUndefined();
|
|
96
|
+
expect(VIEWER_LABELS.html).toBe('HTML');
|
|
81
97
|
// A byte viewer's label is its document kind, never the language badge the
|
|
82
98
|
// empty buffer would otherwise produce.
|
|
83
99
|
expect(VIEWER_LABELS.pdf).toBe('PDF');
|
|
@@ -85,6 +101,27 @@ describe('viewerKindFor', () => {
|
|
|
85
101
|
});
|
|
86
102
|
});
|
|
87
103
|
|
|
104
|
+
describe('opensInPreview', () => {
|
|
105
|
+
// What the user opened the file to READ opens rendered; an HTML page opens
|
|
106
|
+
// its source, because editing one is the common case and a page that runs
|
|
107
|
+
// scripts must not start doing so the instant the tab appears.
|
|
108
|
+
test('a document opens rendered; an html page opens its source', () => {
|
|
109
|
+
for (const kind of ['markdown', 'svg', 'csv', 'drawio'] as const) {
|
|
110
|
+
expect(opensInPreview(kind)).toBe(true);
|
|
111
|
+
}
|
|
112
|
+
expect(opensInPreview('html')).toBe(false);
|
|
113
|
+
expect(opensInPreview('code')).toBe(false);
|
|
114
|
+
expect(opensInPreview('pdf')).toBe(false);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
// The two tables answer different questions, and collapsing them would hide
|
|
118
|
+
// the eye button on the one kind whose default is the source.
|
|
119
|
+
test('html keeps its toggle even though it opens on source', () => {
|
|
120
|
+
expect(RENDERED_VIEWERS.html).toBe(true);
|
|
121
|
+
expect(DEFAULT_PREVIEW.html).toBeUndefined();
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
|
|
88
125
|
describe('sniffDelimiter', () => {
|
|
89
126
|
test('a .tsv extension wins outright', () => {
|
|
90
127
|
expect(sniffDelimiter('a,b,c', 'x.tsv')).toBe('\t');
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* file has a rendered form.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
import { getFileExtension, getImageMimeType } from '@/shared/lib/fs/
|
|
23
|
+
import { getFileExtension, getImageMimeType } from '@/shared/lib/fs/mime';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* The surface that draws a file.
|
|
@@ -31,6 +31,7 @@ import { getFileExtension, getImageMimeType } from '@/shared/lib/fs/file-kind';
|
|
|
31
31
|
export type ViewerKind =
|
|
32
32
|
| 'code'
|
|
33
33
|
| 'markdown'
|
|
34
|
+
| 'html'
|
|
34
35
|
| 'svg'
|
|
35
36
|
| 'csv'
|
|
36
37
|
| 'image'
|
|
@@ -55,6 +56,9 @@ const CSV_EXTENSIONS: Record<string, true> = { csv: true, tsv: true };
|
|
|
55
56
|
/** Markdown, whose preview is the rendered document. */
|
|
56
57
|
const MARKDOWN_EXTENSIONS: Record<string, true> = { md: true, markdown: true, mdx: true };
|
|
57
58
|
|
|
59
|
+
/** Web pages, whose preview is the document the browser draws. */
|
|
60
|
+
const HTML_EXTENSIONS: Record<string, true> = { html: true, htm: true };
|
|
61
|
+
|
|
58
62
|
/**
|
|
59
63
|
* drawio diagrams. `.dio` is the same format under the older extension; the
|
|
60
64
|
* `.drawio.svg`/`.drawio.png` exports are NOT here — those are an SVG and a
|
|
@@ -78,6 +82,7 @@ export const BINARY_VIEWERS: Record<ViewerKind, true | undefined> = {
|
|
|
78
82
|
spreadsheet: true,
|
|
79
83
|
code: undefined,
|
|
80
84
|
markdown: undefined,
|
|
85
|
+
html: undefined,
|
|
81
86
|
svg: undefined,
|
|
82
87
|
csv: undefined,
|
|
83
88
|
drawio: undefined,
|
|
@@ -90,12 +95,41 @@ export const BINARY_VIEWERS: Record<ViewerKind, true | undefined> = {
|
|
|
90
95
|
* the preview and the raw text is the code surface, which is exactly the pair
|
|
91
96
|
* the toggle switches between. `image` and the document kinds are not — they
|
|
92
97
|
* have no text form to toggle to.
|
|
98
|
+
*
|
|
99
|
+
* This answers "is there a toggle", NOT "which side opens first" — that is
|
|
100
|
+
* `DEFAULT_PREVIEW`, and an HTML page is the case where the two answers differ.
|
|
93
101
|
*/
|
|
94
102
|
export const RENDERED_VIEWERS: Record<ViewerKind, true | undefined> = {
|
|
103
|
+
markdown: true,
|
|
104
|
+
html: true,
|
|
105
|
+
svg: true,
|
|
106
|
+
csv: true,
|
|
107
|
+
drawio: true,
|
|
108
|
+
code: undefined,
|
|
109
|
+
image: undefined,
|
|
110
|
+
pdf: undefined,
|
|
111
|
+
docx: undefined,
|
|
112
|
+
spreadsheet: undefined,
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The side a rendered kind opens on, when the user has not chosen one.
|
|
117
|
+
*
|
|
118
|
+
* A markdown page, a CSV grid, an SVG and a drawio diagram open RENDERED: that
|
|
119
|
+
* is what the user opened them to read. An HTML page opens its SOURCE instead,
|
|
120
|
+
* because editing one is the common case and a page that runs scripts would
|
|
121
|
+
* otherwise start doing so the instant the tab appears.
|
|
122
|
+
*
|
|
123
|
+
* Kept separate from `RENDERED_VIEWERS` because the two questions are different
|
|
124
|
+
* and collapsing them makes the eye button disappear from the one kind whose
|
|
125
|
+
* default is the source.
|
|
126
|
+
*/
|
|
127
|
+
export const DEFAULT_PREVIEW: Record<ViewerKind, true | undefined> = {
|
|
95
128
|
markdown: true,
|
|
96
129
|
svg: true,
|
|
97
130
|
csv: true,
|
|
98
131
|
drawio: true,
|
|
132
|
+
html: undefined,
|
|
99
133
|
code: undefined,
|
|
100
134
|
image: undefined,
|
|
101
135
|
pdf: undefined,
|
|
@@ -103,6 +137,18 @@ export const RENDERED_VIEWERS: Record<ViewerKind, true | undefined> = {
|
|
|
103
137
|
spreadsheet: undefined,
|
|
104
138
|
};
|
|
105
139
|
|
|
140
|
+
/**
|
|
141
|
+
* Whether a kind opens on its rendered side when the user has not chosen.
|
|
142
|
+
*
|
|
143
|
+
* The single spelling of `DEFAULT_PREVIEW[kind] === true`, because both editors
|
|
144
|
+
* need the answer and "the table's entry is undefined" is not a fact a call site
|
|
145
|
+
* should have to re-derive: one of them would eventually write `?? hasPreview`
|
|
146
|
+
* and quietly turn HTML back into a preview-on-open file.
|
|
147
|
+
*/
|
|
148
|
+
export function opensInPreview(kind: ViewerKind): boolean {
|
|
149
|
+
return DEFAULT_PREVIEW[kind] === true;
|
|
150
|
+
}
|
|
151
|
+
|
|
106
152
|
/**
|
|
107
153
|
* The word a status strip prints for a viewer kind.
|
|
108
154
|
*
|
|
@@ -115,6 +161,7 @@ export const RENDERED_VIEWERS: Record<ViewerKind, true | undefined> = {
|
|
|
115
161
|
export const VIEWER_LABELS: Record<ViewerKind, string> = {
|
|
116
162
|
code: 'Text',
|
|
117
163
|
markdown: 'Markdown',
|
|
164
|
+
html: 'HTML',
|
|
118
165
|
svg: 'SVG',
|
|
119
166
|
csv: 'CSV',
|
|
120
167
|
image: 'Image',
|
|
@@ -139,6 +186,7 @@ export function viewerKindFor(filePath: string | undefined | null): ViewerKind {
|
|
|
139
186
|
if (ext === 'svg') return 'svg';
|
|
140
187
|
if (DRAWIO_EXTENSIONS[ext]) return 'drawio';
|
|
141
188
|
if (MARKDOWN_EXTENSIONS[ext]) return 'markdown';
|
|
189
|
+
if (HTML_EXTENSIONS[ext]) return 'html';
|
|
142
190
|
if (getImageMimeType(filePath)) return 'image';
|
|
143
191
|
if (ext === 'pdf') return 'pdf';
|
|
144
192
|
if (DOCX_EXTENSIONS[ext]) return 'docx';
|
|
@@ -17,18 +17,24 @@
|
|
|
17
17
|
|
|
18
18
|
import { describe, expect, test } from 'bun:test';
|
|
19
19
|
|
|
20
|
+
import {
|
|
21
|
+
classifyEditorFile,
|
|
22
|
+
getImageMimeFromBytes,
|
|
23
|
+
looksLikeSvg,
|
|
24
|
+
} from '@/shared/lib/fs/file-kind';
|
|
25
|
+
// The MIME answers live in `mime.ts`; they are asserted here because the
|
|
26
|
+
// classifier is their consumer and a wrong table is what makes a picture paint
|
|
27
|
+
// as mojibake.
|
|
20
28
|
import {
|
|
21
29
|
DOCUMENT_MIME_BY_EXT,
|
|
22
30
|
getDocumentMimeType,
|
|
23
31
|
getFileExtension,
|
|
24
|
-
getImageMimeFromBytes,
|
|
25
32
|
getImageMimeType,
|
|
26
33
|
getPaintableImageMimeType,
|
|
27
34
|
getRawContentType,
|
|
28
35
|
IMAGE_MIME_BY_EXT,
|
|
29
|
-
looksLikeSvg,
|
|
30
36
|
SVG_MIME,
|
|
31
|
-
} from '@/shared/lib/fs/
|
|
37
|
+
} from '@/shared/lib/fs/mime';
|
|
32
38
|
|
|
33
39
|
const bytes = (...values: number[]): Uint8Array => new Uint8Array(values);
|
|
34
40
|
|
|
@@ -180,6 +186,27 @@ describe('getRawContentType', () => {
|
|
|
180
186
|
expect(getRawContentType('a.ts')).toBeNull();
|
|
181
187
|
expect(getRawContentType(undefined)).toBeNull();
|
|
182
188
|
});
|
|
189
|
+
|
|
190
|
+
// The HTML preview's frame is sandboxed, and a sandboxed frame is an opaque
|
|
191
|
+
// origin where the browser applies strict MIME checking: a stylesheet or
|
|
192
|
+
// script answered as `application/octet-stream` is refused, so a page with a
|
|
193
|
+
// relative `<link>` or `<script>` painted unstyled.
|
|
194
|
+
test('a web asset a rendered page loads is named', () => {
|
|
195
|
+
expect(getRawContentType('style.css')).toBe('text/css; charset=utf-8');
|
|
196
|
+
expect(getRawContentType('app.js')).toBe('text/javascript; charset=utf-8');
|
|
197
|
+
expect(getRawContentType('app.mjs')).toBe('text/javascript; charset=utf-8');
|
|
198
|
+
expect(getRawContentType('data.json')).toBe('application/json; charset=utf-8');
|
|
199
|
+
expect(getRawContentType('font.woff2')).toBe('font/woff2');
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
// And naming them here must NOT reclassify them: a stylesheet stays an
|
|
203
|
+
// editable text file rather than becoming a byte document the editor refuses
|
|
204
|
+
// to edit.
|
|
205
|
+
test('a web asset is still classified as text', () => {
|
|
206
|
+
expect(getDocumentMimeType('style.css')).toBeNull();
|
|
207
|
+
expect(classifyEditorFile({ path: 'style.css', size: 64 })).toBe('text');
|
|
208
|
+
expect(classifyEditorFile({ path: 'app.js', size: 64 })).toBe('text');
|
|
209
|
+
});
|
|
183
210
|
});
|
|
184
211
|
|
|
185
212
|
describe('getPaintableImageMimeType', () => {
|