@kabmo-labs/kabmo 0.42.2 → 0.43.1
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/README.md +1 -1
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +721 -675
- package/dist/client/static/js/{CsvGrid-g6rek8y9.js → CsvGrid-g67pk2zy.js} +2 -2
- package/dist/client/static/js/{DocxView-41t9ryws.js → DocxView-pyh6p2kb.js} +4 -4
- package/dist/client/static/js/{DrawioView-mfxhfz1h.js → DrawioView-g48r6y2m.js} +2 -2
- package/dist/client/static/js/ImageView-rnzf5tve.js +1 -0
- package/dist/client/static/js/LayoutWrapper-rekrgth6.js +2 -0
- package/dist/client/static/js/Modal-edw446r8.js +59 -0
- package/dist/client/static/js/{PdfView-bek8k888.js → PdfView-6z3cgj37.js} +1 -1
- package/dist/client/static/js/SessionsView-e84tjbcr.js +1 -0
- package/dist/client/static/js/{SheetView-vezssf6b.js → SheetView-64076z1j.js} +13 -13
- package/dist/client/static/js/{SvgPreview-f1qaw73k.js → SvgPreview-dmpgavgd.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-4qn94h52.js → abnfDiagram-O67JEVCF-nfz5z1vw.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-7j23x20s.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-tbewzdya.js → architectureDiagram-NJMV4G6O-jra2jyzw.js} +11 -11
- package/dist/client/static/js/{astro-nn7xg0we.js → astro-dpfdhc5e.js} +1 -1
- package/dist/client/static/js/bash-vv2ysp0a.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-njgnwckz.js → blockDiagram-BEXU5L5S-3szktxam.js} +7 -7
- package/dist/client/static/js/c-8jf64j6h.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-f58pcvbk.js → c4Diagram-YGBWAQC7-xe9vbppt.js} +6 -6
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-52g73vyw.js → classDiagram-v2-NBCMYWYE-egzhj1xn.js} +6 -6
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-ptdnshzh.js → cose-bilkent-JH36ORCC-dfrk1wnr.js} +1 -1
- package/dist/client/static/js/cpp-vh94zee0.js +1 -0
- package/dist/client/static/js/css-p57h1fme.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-me5xnx6a.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-qabfdkzr.js → cynefinDiagram-VND7K2PF-xefpcmpg.js} +2 -2
- package/dist/client/static/js/{dagre-6A5THRUB-kyf5jetf.js → dagre-6A5THRUB-vtzjnrt9.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-bxrsjtv9.js → diagram-22UHCM2B-4vvn790v.js} +16 -16
- package/dist/client/static/js/{diagram-3UASUU5V-0f41s00j.js → diagram-3UASUU5V-tmht3bew.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-0z1zx9h1.js → diagram-ATOU4E4O-p5wa5ztx.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-znrmr6bk.js → diagram-CDSNMT55-8myesjfc.js} +5 -5
- package/dist/client/static/js/{diagram-MLGK6HIB-jfe2jhk0.js → diagram-MLGK6HIB-9t3x2d5f.js} +2 -2
- package/dist/client/static/js/{diagram-MPIPVDR6-2kaawmwa.js → diagram-MPIPVDR6-8ahgnmhy.js} +3 -3
- package/dist/client/static/js/{dockerfile-12exatm9.js → dockerfile-x8aa0543.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-s5n37rfp.js → ebnfDiagram-ZINNZB2B-5semw111.js} +1 -1
- package/dist/client/static/js/{elixir-szk51ehr.js → elixir-5ewfhvfh.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-433rd9fp.js → elk-276RUBZZ-jmhs58ww.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-key6ah0b.js → erDiagram-OPXOYQCR-31wvbpdr.js} +8 -8
- package/dist/client/static/js/{erlang-zwy7cqdk.js → erlang-jqqa3ehb.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-5zbvjj84.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-36ygrbvm.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-4efkhmca.js → ganttDiagram-FUAMR5RP-c2dycjrf.js} +6 -6
- package/dist/client/static/js/gitGraph-4MIJSDKK-tjhkv71w.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-ac376y2k.js → gitGraphDiagram-X574FWY7-y4k4pdd8.js} +14 -14
- package/dist/client/static/js/graphql-kesh8gk0.js +1 -0
- package/dist/client/static/js/html-sxpfydga.js +1 -0
- package/dist/client/static/js/{index-e1yz59fa.js → index-0c6vpk89.js} +2 -2
- package/dist/client/static/js/{index-0pabfaac.js → index-0q2qfcjn.js} +1 -1
- package/dist/client/static/js/{index-p0ez6hqd.js → index-181p91hf.js} +1 -1
- package/dist/client/static/js/{index-zs73zwjz.js → index-2b46dzw8.js} +4 -4
- package/dist/client/static/js/{index-02543wk3.js → index-2cbnjc32.js} +2 -2
- package/dist/client/static/js/{index-7a2efrbj.js → index-3588r3wg.js} +2 -2
- package/dist/client/static/js/{index-4cncqz8j.js → index-38v0781h.js} +2 -2
- package/dist/client/static/js/{index-z78bzryw.js → index-48gh56ka.js} +3 -3
- package/dist/client/static/js/{index-0e9nkc0g.js → index-48pb18zj.js} +2 -2
- package/dist/client/static/js/{index-77t0nvt1.js → index-4rv388z7.js} +2 -2
- package/dist/client/static/js/index-52xmdeh2.js +1 -0
- package/dist/client/static/js/{index-5jnvz9hw.js → index-6fpd55cq.js} +2 -2
- package/dist/client/static/js/{index-nh29fkk9.js → index-7dp90ad1.js} +2 -2
- package/dist/client/static/js/{index-yzda8j2d.js → index-8kqepehd.js} +12 -12
- package/dist/client/static/js/{index-raca8tsh.js → index-aar68x31.js} +4 -4
- package/dist/client/static/js/{index-pxtff3ez.js → index-bvjct7sp.js} +2 -2
- package/dist/client/static/js/{index-cz50ha6x.js → index-cgzw43bc.js} +78 -78
- package/dist/client/static/js/{index-50mdqev0.js → index-cje5gg45.js} +1 -1
- package/dist/client/static/js/{index-zndbhb9w.js → index-cjhvtzdd.js} +2 -2
- package/dist/client/static/js/{index-8b3t2y77.js → index-cqnpsw2m.js} +2 -2
- package/dist/client/static/js/{index-r9db1gsf.js → index-dkwhs38j.js} +2 -2
- package/dist/client/static/js/{index-pkes9492.js → index-e7yf273s.js} +2 -2
- package/dist/client/static/js/{index-8kbp24xg.js → index-efra065v.js} +1 -1
- package/dist/client/static/js/index-f77c3ag0.js +479 -0
- package/dist/client/static/js/{index-yjmm73jm.js → index-f7djda1g.js} +2 -2
- package/dist/client/static/js/{index-8k7vjp8b.js → index-fbcg8y95.js} +1 -1
- package/dist/client/static/js/{index-pysqpc5n.js → index-fg965t62.js} +2 -2
- package/dist/client/static/js/{index-qsw5edtk.js → index-fjnkzk12.js} +5 -5
- package/dist/client/static/js/{index-s4gv0rpk.js → index-g3shdymf.js} +1 -1
- package/dist/client/static/js/{index-qx6x4z0y.js → index-gmnmnfm0.js} +2 -2
- package/dist/client/static/js/{index-gp57dx2v.js → index-h5n1btqy.js} +1 -1
- package/dist/client/static/js/{index-r8cc80w5.js → index-jz93j0at.js} +2 -2
- package/dist/client/static/js/{index-dtj73vs1.js → index-kc5znr75.js} +2 -2
- package/dist/client/static/js/index-m1n4v0z7.js +9 -0
- package/dist/client/static/js/{index-1t5ybx9v.js → index-m94f4ngb.js} +3 -3
- package/dist/client/static/js/{index-dfqmwm7j.js → index-m9s9rg5k.js} +2 -2
- package/dist/client/static/js/{index-gsxebrq9.js → index-n9scbxy5.js} +2 -2
- package/dist/client/static/js/{index-zs7sjv6x.js → index-nt7nhchn.js} +1 -1
- package/dist/client/static/js/{index-v3f7we4n.js → index-pt8440xh.js} +22 -22
- package/dist/client/static/js/{index-b42t14wk.js → index-q81rxwh7.js} +35 -35
- package/dist/client/static/js/{index-ktbrmp29.js → index-qhytrsyb.js} +2 -2
- package/dist/client/static/js/index-rn8w29pv.js +2 -0
- package/dist/client/static/js/{index-1y3rzw6b.js → index-s00j9042.js} +1 -1
- package/dist/client/static/js/{index-hga3e13s.js → index-s78n0dtv.js} +2 -2
- package/dist/client/static/js/index-s7rfbydk.js +4 -0
- package/dist/client/static/js/{index-03pyvmcz.js → index-sesghshh.js} +2 -2
- package/dist/client/static/js/{index-ykfd2fyj.js → index-sg6sz3g8.js} +1 -1
- package/dist/client/static/js/index-vcrh95gf.css +1 -0
- package/dist/client/static/js/{index-82vk27q1.js → index-vyw4tbn8.js} +2 -2
- package/dist/client/static/js/{index-dzmar8jr.js → index-w5rw8f7w.js} +1 -1
- package/dist/client/static/js/{index-f33c4paw.js → index-x6v37h3j.js} +1 -1
- package/dist/client/static/js/{index-b0v6gwym.js → index-ycks7gyg.js} +2 -2
- package/dist/client/static/js/{index-hw14rhen.js → index-ynaxep06.js} +2 -2
- package/dist/client/static/js/{index-rab39785.js → index-ys0xpw3q.js} +2 -2
- package/dist/client/static/js/{index-feffxxss.js → index-yvgbr7ek.js} +2 -2
- package/dist/client/static/js/info-A6RAGUB7-m6qz24p8.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-4e7ej63f.js → infoDiagram-VRGFBTTK-z3pqx7w8.js} +1 -1
- package/dist/client/static/js/ini-1x0ad976.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-k3yet1ec.js → ishikawaDiagram-OU5B5YK6-f5v6z8yr.js} +4 -4
- package/dist/client/static/js/java-3944nq02.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-qe352kyd.js → journeyDiagram-ZHPQQLJL-js1yxatk.js} +5 -5
- package/dist/client/static/js/json-g5ggnd94.js +1 -0
- package/dist/client/static/js/jsx-f6p72qpc.js +1 -0
- package/dist/client/static/js/{julia-2eekpjq8.js → julia-0h9krgsd.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-58hag75n.js → kanban-definition-PNTS6WVX-m0a6069c.js} +5 -5
- package/dist/client/static/js/lua-edn2b3wn.js +1 -0
- package/dist/client/static/js/markdown-9dhg1fax.js +1 -0
- package/dist/client/static/js/{mermaid.core-6e89h6vm.js → mermaid.core-6xvbnm63.js} +6 -6
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-ncsam2fm.js → mindmap-definition-NLK3R4M7-a9f9yzc0.js} +4 -4
- package/dist/client/static/js/one-dark-pro-hteqzfb0.js +1 -0
- package/dist/client/static/js/one-light-dapnh0rs.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-ng6wq5xj.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-b5ckc39d.js → pegDiagram-GJSIUBJH-4v4pf1h1.js} +1 -1
- package/dist/client/static/js/{perl-dtn1fccw.js → perl-rptyx23q.js} +1 -1
- package/dist/client/static/js/{php-7av78hch.js → php-sagvq3wz.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-rf6jhxf6.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-s4d47ve8.js → pieDiagram-5QR66LMP-a54yrmfm.js} +3 -3
- package/dist/client/static/js/properties-fcmj08pv.js +1 -0
- package/dist/client/static/js/python-532d8ezm.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-zm0ekvjz.js → quadrantDiagram-O4NWA36T-1twhvnp2.js} +6 -6
- package/dist/client/static/js/r-ptmdxs2a.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-ygp6hxq4.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-rxgnrb2g.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-xkv52a2p.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-bvcktbqh.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-9c3v7jsq.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-52vdqf53.js → railroadDiagram-XR7U4H2S-83tqfdcy.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-7kf8bmk9.js → requirementDiagram-PLB6GJNP-73e3pzw6.js} +4 -4
- package/dist/client/static/js/{ruby-s2bqr910.js → ruby-9qyx7knh.js} +1 -1
- package/dist/client/static/js/{rust-q98kssv3.js → rust-jds4e4r7.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-bcb9f54a.js → sankeyDiagram-IPEJSGJF-1bzwj6sb.js} +6 -6
- package/dist/client/static/js/{sass-bm32bb5k.js → sass-07rteya0.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-76ywvj7g.js → sequenceDiagram-PO4LG4MO-yh3h988k.js} +19 -19
- package/dist/client/static/js/{sizeCapture-INFHLROL-p9bsf5dc.js → sizeCapture-INFHLROL-1n121yp6.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-1ecfb3fs.js → stateDiagram-v2-GCMORJYK-0tdrzn06.js} +6 -6
- package/dist/client/static/js/{svelte-ztkaww47.js → svelte-w365cpwa.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-2pyjr946.js → swimlanes-2SLR337P-77n1ttdw.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-akjqm31r.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-4csxwmn2.js → timeline-definition-EJHVYXUP-b6r0k3e8.js} +2 -2
- package/dist/client/static/js/treeView-Q6P3EWNA-fb58a7z1.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-ej4qhksx.js +1 -0
- package/dist/client/static/js/typescript-683kkkaw.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-0p1jnbsn.js → usecaseDiagram-POWQR4AR-efq58m3m.js} +43 -43
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-y1hgdet4.js → vennDiagram-UO4OBE2U-ad4gvd5r.js} +5 -5
- package/dist/client/static/js/{vue-cbqm4bed.js → vue-d6cesny1.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-mkp0kanv.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-p578yrgm.js → wardleyDiagram-VNRHLVJA-v89tys2p.js} +4 -4
- package/dist/client/static/js/xml-6ct32gys.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-b08b4ah0.js → xychartDiagram-PMCCYNJV-xtgzmknw.js} +5 -5
- package/dist/client/static/js/yaml-1d5m3bfj.js +1 -0
- package/marketplace/plugins/command-runner/package.json +2 -2
- package/marketplace/plugins/command-runner/src/app.test.tsx +161 -0
- package/marketplace/plugins/command-runner/src/app.tsx +37 -3
- package/marketplace/plugins/command-runner/src/panel/Glyph.tsx +22 -4
- package/marketplace/plugins/git-forge/package.json +2 -2
- package/marketplace/plugins/git-forge/src/panel/Glyph.tsx +22 -3
- package/marketplace/plugins/git-forge/src/panel/index.tsx +21 -3
- package/marketplace/plugins/git-forge/src/panel/refresh.test.tsx +192 -0
- package/marketplace/plugins/git-forge/src/panel/use-forge.ts +4 -2
- package/marketplace/plugins/git-forge/src/panel/write.test.tsx +21 -0
- package/marketplace/plugins/stats/package.json +2 -2
- package/marketplace/plugins/stats/src/RefreshButton.tsx +9 -7
- package/marketplace/plugins/stats/src/app.tsx +15 -1
- package/marketplace/plugins/stats/src/refresh.test.tsx +166 -0
- package/package.json +1 -1
- package/src/client/components/common/anchored-menu/index.tsx +26 -8
- package/src/client/components/common/context-usage-button/McpSection.test.tsx +34 -5
- package/src/client/components/common/context-usage-button/McpSection.tsx +25 -3
- package/src/client/components/common/harness-glyph/brands.ts +3 -0
- package/src/client/components/common/harness-glyph/omo.ts +22 -0
- package/src/client/components/common/server-control/Panel.tsx +24 -86
- package/src/client/components/common/server-control/Row.tsx +98 -0
- package/src/client/components/common/server-control/index.test.tsx +69 -9
- package/src/client/components/layout/VisibilityMenu.tsx +18 -6
- package/src/client/components/layout/new-workspace-host/index.test.tsx +84 -0
- package/src/client/components/layout/new-workspace-host/index.tsx +35 -0
- package/src/client/components/mobile/header-titlebar.test.tsx +38 -3
- package/src/client/components/settings/Sidebar.tsx +2 -1
- package/src/client/components/settings/categories/GitSettings.tsx +31 -0
- package/src/client/components/settings/categories/git-settings/CommitMessageSection.tsx +292 -0
- package/src/client/components/settings/categories/git-settings/IdentitySection.tsx +215 -0
- package/src/client/components/settings/category-content.tsx +3 -0
- package/src/client/components/workspace/chat-timeline/MessageItem.tsx +8 -0
- package/src/client/components/workspace/chat-timeline/MessageList.test.ts +55 -2
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +13 -1
- package/src/client/components/workspace/chat-timeline/PendingChatView.tsx +56 -50
- package/src/client/components/workspace/chat-timeline/ThinkingSection.test.tsx +38 -2
- package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +13 -1
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.test.tsx +50 -0
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +20 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/index.tsx +21 -9
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +2 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Proc.tsx +1 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/TaskResult.tsx +18 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +3 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/task-rows.ts +47 -0
- package/src/client/components/workspace/git-panel/CommitBox.test.tsx +98 -0
- package/src/client/components/workspace/git-panel/CommitBox.tsx +68 -3
- package/src/client/components/workspace/git-panel/index.test.ts +12 -0
- package/src/client/components/workspace/git-panel/index.tsx +20 -1
- package/src/client/components/workspace/repo-picker/index.test.tsx +20 -0
- package/src/client/components/workspace/repo-picker/index.tsx +5 -6
- package/src/client/data/settings/omp-schema.json +134 -8
- package/src/client/hooks/chat/context/mcp.ts +19 -1
- package/src/client/hooks/chat/omp/index.ts +2 -6
- package/src/client/hooks/chat/timeline/jump-rail.ts +1 -0
- package/src/client/hooks/chat/timeline/row-window.test.ts +38 -3
- package/src/client/hooks/chat/timeline/row-window.ts +33 -9
- package/src/client/hooks/chat/timeline/scroll-geometry.ts +19 -1
- package/src/client/hooks/chat/timeline/scroll.ts +15 -0
- package/src/client/hooks/chat/timeline/thinking-open.ts +10 -4
- package/src/client/hooks/workspace/commit-box.test.ts +62 -1
- package/src/client/hooks/workspace/commit-box.ts +94 -2
- package/src/client/hooks/workspace/git-panel-data.ts +15 -7
- package/src/client/hooks/workspace/repo-scope/index.test.ts +10 -3
- package/src/client/hooks/workspace/repo-scope/index.ts +21 -9
- package/src/client/lib/plugins/repo-scope-service.ts +7 -25
- package/src/server/lib/changes/capture-client-write.server.ts +45 -0
- package/src/server/lib/changes/capture.server.ts +20 -5
- package/src/server/lib/chat/session-store.server.ts +22 -1
- package/src/server/lib/db/schema.ts +3 -0
- package/src/server/lib/fs/git-commit-context.test.ts +111 -0
- package/src/server/lib/fs/git-commit-context.ts +85 -0
- package/src/server/lib/fs/git-commit-message.server.ts +251 -0
- package/src/server/lib/fs/git-commit-message.test.ts +211 -0
- package/src/server/lib/fs/git-commit-prompt.test.ts +69 -0
- package/src/server/lib/fs/git-commit-prompt.ts +57 -0
- package/src/server/lib/fs/git-commit-settings.server.ts +42 -0
- package/src/server/lib/fs/git-identity.server.test.ts +129 -0
- package/src/server/lib/fs/git-identity.server.ts +130 -0
- package/src/server/lib/harness/acp/acp-audit.server.ts +13 -62
- package/src/server/lib/harness/acp/acp-frames.server.test.ts +105 -0
- package/src/server/lib/harness/acp/acp-frames.server.ts +217 -0
- package/src/server/lib/harness/acp/acp-raw-messages.server.test.ts +69 -0
- package/src/server/lib/harness/acp/acp-raw-messages.server.ts +129 -0
- package/src/server/lib/harness/acp/acp-telemetry.server.ts +19 -0
- package/src/server/lib/harness/acp/auth.test.ts +69 -0
- package/src/server/lib/harness/acp/auth.ts +71 -0
- package/src/server/lib/harness/acp/background-replay.test.ts +139 -0
- package/src/server/lib/harness/acp/background-replay.ts +87 -0
- package/src/server/lib/harness/acp/background-work.ts +50 -33
- package/src/server/lib/harness/acp/calls.test.ts +68 -0
- package/src/server/lib/harness/acp/calls.ts +13 -0
- package/src/server/lib/harness/acp/client-capabilities.ts +5 -2
- package/src/server/lib/harness/acp/client-fs.test.ts +13 -0
- package/src/server/lib/harness/acp/client-fs.ts +16 -2
- package/src/server/lib/harness/acp/client.ts +22 -23
- package/src/server/lib/harness/acp/commands.test.ts +19 -0
- package/src/server/lib/harness/acp/commands.ts +26 -8
- package/src/server/lib/harness/acp/frames.ts +16 -1
- package/src/server/lib/harness/acp/grants.server.ts +75 -0
- package/src/server/lib/harness/acp/grants.test.ts +65 -0
- package/src/server/lib/harness/acp/grants.ts +79 -0
- package/src/server/lib/harness/acp/one-shot.server.ts +141 -0
- package/src/server/lib/harness/acp/permissions.test.ts +9 -0
- package/src/server/lib/harness/acp/permissions.ts +56 -36
- package/src/server/lib/harness/acp/prompt-files.test.ts +69 -0
- package/src/server/lib/harness/acp/prompt-files.ts +58 -0
- package/src/server/lib/harness/acp/prompt.ts +50 -11
- package/src/server/lib/harness/acp/protocol.ts +20 -1
- package/src/server/lib/harness/acp/raw-listeners.ts +30 -0
- package/src/server/lib/harness/acp/session-approvals.ts +45 -0
- package/src/server/lib/harness/acp/session-config-view.ts +81 -0
- package/src/server/lib/harness/acp/session-config.ts +48 -9
- package/src/server/lib/harness/acp/session-handshake.test.ts +71 -2
- package/src/server/lib/harness/acp/session-handshake.ts +139 -56
- package/src/server/lib/harness/acp/session-intake.test.ts +93 -0
- package/src/server/lib/harness/acp/session-intake.ts +75 -0
- package/src/server/lib/harness/acp/session-lifecycle.ts +50 -0
- package/src/server/lib/harness/acp/session-lost.test.ts +44 -0
- package/src/server/lib/harness/acp/session-lost.ts +34 -0
- package/src/server/lib/harness/acp/session-notify.ts +47 -0
- package/src/server/lib/harness/acp/session-observers.test.ts +4 -4
- package/src/server/lib/harness/acp/session-permissions.test.ts +64 -0
- package/src/server/lib/harness/acp/session-permissions.ts +9 -4
- package/src/server/lib/harness/acp/session-requests.ts +6 -0
- package/src/server/lib/harness/acp/session-roots.server.ts +47 -0
- package/src/server/lib/harness/acp/session-roots.test.ts +31 -0
- package/src/server/lib/harness/acp/session-start.ts +7 -0
- package/src/server/lib/harness/acp/session-turns.ts +11 -0
- package/src/server/lib/harness/acp/session-wiring.ts +100 -0
- package/src/server/lib/harness/acp/session.test-util.ts +36 -2
- package/src/server/lib/harness/acp/session.test.ts +10 -10
- package/src/server/lib/harness/acp/session.ts +149 -139
- package/src/server/lib/harness/acp/tool-calls.ts +27 -15
- package/src/server/lib/harness/acp/tool-identity.test.ts +136 -0
- package/src/server/lib/harness/acp/tool-identity.ts +121 -0
- package/src/server/lib/harness/acp/turn-cancel.test.ts +79 -0
- package/src/server/lib/harness/acp/turn-cancel.ts +61 -0
- package/src/server/lib/harness/acp/turn-dispatch.test.ts +103 -0
- package/src/server/lib/harness/acp/turn-dispatch.ts +61 -0
- package/src/server/lib/harness/acp/turn-queue.ts +43 -0
- package/src/server/lib/harness/acp/turn-verdict.ts +102 -0
- package/src/server/lib/harness/acp/turn.ts +86 -88
- package/src/server/lib/harness/acp/v2.test.ts +9 -0
- package/src/server/lib/harness/acp/v2.ts +13 -0
- package/src/server/lib/harness/acp/verbs.ts +35 -4
- package/src/server/lib/harness/capabilities.ts +11 -0
- package/src/server/lib/harness/launch-table.ts +19 -0
- package/src/server/lib/harness/launch.ts +4 -0
- package/src/server/lib/harness/schema.server.ts +23 -0
- package/src/server/lib/harness/spawn.server.ts +18 -2
- package/src/server/lib/mcp/agent-config.server.test.ts +111 -0
- package/src/server/lib/mcp/agent-config.server.ts +205 -0
- package/src/server/lib/mcp/probe.server.ts +7 -1
- package/src/server/lib/mcp/registry.server.ts +4 -3
- package/src/server/lib/mcp/secrets.server.test.ts +85 -0
- package/src/server/lib/mcp/secrets.server.ts +108 -0
- package/src/server/lib/omp/core/print.server.ts +100 -0
- package/src/server/lib/omp/rpc/frame-fold.ts +4 -0
- package/src/server/lib/omp/session/artifacts.server.test.ts +15 -5
- package/src/server/lib/omp/session/artifacts.server.ts +41 -26
- package/src/server/lib/omp/session/delete.server.ts +5 -0
- package/src/server/lib/omp/session/goal-auditor.server.ts +10 -48
- package/src/server/lib/realtime/topics/session-data.server.ts +6 -14
- package/src/server/routes/fs/git-message.test.ts +101 -0
- package/src/server/routes/fs/git-message.ts +60 -0
- package/src/server/routes/fs/index.ts +2 -0
- package/src/server/routes/omp/artifact.ts +4 -3
- package/src/server/routes/sessions/mcp.test.ts +65 -1
- package/src/server/routes/sessions/mcp.ts +77 -5
- package/src/server/routes/settings/git-identity.test.ts +77 -0
- package/src/server/routes/settings/git-identity.ts +47 -0
- package/src/server/routes/settings/index.ts +2 -0
- package/src/server/routes/telemetry/acp-telemetry.test.ts +149 -0
- package/src/server/routes/telemetry/context.ts +31 -0
- package/src/server/routes/telemetry/raw-messages.ts +34 -0
- package/src/shared/lib/chat/tool/artifact.test.ts +4 -2
- package/src/shared/lib/chat/tool/artifact.ts +6 -1
- package/src/shared/lib/chat/tool/proc-facts.ts +2 -1
- package/src/shared/lib/fs/paths.test.ts +2 -0
- package/src/shared/lib/fs/repo-label.test.ts +22 -1
- package/src/shared/lib/fs/repo-label.ts +29 -0
- package/src/shared/lib/git/commit-prompt.test.ts +47 -0
- package/src/shared/lib/git/commit-prompt.ts +72 -0
- package/src/shared/lib/git/identity.test.ts +46 -0
- package/src/shared/lib/git/identity.ts +70 -0
- package/src/shared/lib/harness/brand-color.ts +3 -0
- package/src/shared/lib/harness/catalog.test.ts +14 -0
- package/src/shared/lib/harness/catalog.ts +9 -1
- package/src/shared/lib/harness/mcp-facts.ts +4 -0
- package/src/shared/lib/harness/provider-facts.test.ts +11 -0
- package/src/shared/lib/harness/provider-facts.ts +14 -0
- package/src/shared/lib/harness/providers.ts +2 -2
- package/src/shared/lib/harness/updates.test.ts +8 -0
- package/src/shared/lib/harness/updates.ts +9 -0
- package/src/shared/lib/omp/session/proc-daemon.ts +124 -0
- package/src/shared/lib/omp/session/proc.test.ts +30 -3
- package/src/shared/lib/omp/session/proc.ts +6 -82
- package/src/shared/lib/omp/session/wait-idle.test.ts +15 -4
- package/src/shared/lib/omp/session/wait-idle.ts +11 -4
- package/src/shared/lib/settings/defaults.ts +5 -0
- package/src/shared/lib/workspace/new-workspace.ts +20 -0
- package/src/shared/types/omp/agent.ts +14 -5
- package/src/shared/types/settings/mcp.ts +2 -2
- package/src/shared/types/settings/state.ts +16 -0
- package/src/test-support/preload.ts +1 -0
- package/dist/client/static/js/ImageView-bxqw3t4k.js +0 -1
- package/dist/client/static/js/LayoutWrapper-zt14rv9m.js +0 -2
- package/dist/client/static/js/Modal-cm35g20x.js +0 -38
- package/dist/client/static/js/SessionsView-gn53zyn7.js +0 -1
- package/dist/client/static/js/architecture-7GRP2DOG-cagtcfhk.js +0 -1
- package/dist/client/static/js/bash-fjzhxy10.js +0 -1
- package/dist/client/static/js/c-wqtyezvw.js +0 -1
- package/dist/client/static/js/cpp-y0nzwner.js +0 -1
- package/dist/client/static/js/css-n2waj098.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-6g2ydrss.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-b774qbn2.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-nznq0n36.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-b047d6vk.js +0 -1
- package/dist/client/static/js/graphql-gvb7e2eb.js +0 -1
- package/dist/client/static/js/html-tbz83eke.js +0 -1
- package/dist/client/static/js/index-0gbj4270.js +0 -2
- package/dist/client/static/js/index-38xv8h4t.js +0 -1
- package/dist/client/static/js/index-f4vr1c6e.css +0 -1
- package/dist/client/static/js/index-fb6pw9xb.js +0 -2
- package/dist/client/static/js/index-pzvr1699.js +0 -478
- package/dist/client/static/js/index-rf29f3fq.js +0 -9
- package/dist/client/static/js/index-zw621xez.js +0 -4
- package/dist/client/static/js/info-A6RAGUB7-n495k952.js +0 -1
- package/dist/client/static/js/ini-2gvjwh83.js +0 -1
- package/dist/client/static/js/java-1xwcq79s.js +0 -1
- package/dist/client/static/js/json-4pqjabgq.js +0 -1
- package/dist/client/static/js/jsx-wcsss15s.js +0 -1
- package/dist/client/static/js/lua-h7vjcn0h.js +0 -1
- package/dist/client/static/js/markdown-f30jjjh9.js +0 -1
- package/dist/client/static/js/one-dark-pro-qmyne0tn.js +0 -1
- package/dist/client/static/js/one-light-dj0ecjcj.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-zajj62z6.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-1ve78y5f.js +0 -1
- package/dist/client/static/js/properties-ymexza6q.js +0 -1
- package/dist/client/static/js/python-31ycwa66.js +0 -1
- package/dist/client/static/js/r-t2nne4xp.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-8rqadb58.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-v6ppm8dy.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-9j6bae14.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-56cpyt0g.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-yfdmspf4.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-qr5hdxm4.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-vwpg3wp8.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-htfxwd32.js +0 -1
- package/dist/client/static/js/typescript-p3syh43m.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-hapfjkzq.js +0 -1
- package/dist/client/static/js/xml-4enq788a.js +0 -1
- package/dist/client/static/js/yaml-pjtt3jsc.js +0 -1
|
@@ -35,16 +35,56 @@ import { methodNotAllowedResponse } from '@/server/lib/route-adapter';
|
|
|
35
35
|
import { resolveSessionRef } from '@/server/lib/sessions/resolve.server';
|
|
36
36
|
import { asOmpSession, getLiveSession, harnessOfSession } from '@/server/lib/omp/rpc/session-registry';
|
|
37
37
|
import { reloadChildMcp } from '@/server/lib/omp/rpc/reload-mcp';
|
|
38
|
-
import { mcpServerEntriesFor, type McpServerSource } from '@/server/lib/mcp/registry.server';
|
|
38
|
+
import { mcpServerEntriesFor, type McpServerEntry, type McpServerSource } from '@/server/lib/mcp/registry.server';
|
|
39
|
+
import { agentMcpEntriesFor } from '@/server/lib/mcp/agent-config.server';
|
|
39
40
|
import { readSessionMcpOverrides, writeSessionMcpOverrides } from '@/server/lib/mcp/session-state.server';
|
|
40
41
|
import { ensureSessionMcpOverlay } from '@/server/lib/mcp/session-overlay.server';
|
|
41
42
|
import { cachedMcpProbe, probeMcpServer } from '@/server/lib/mcp/probe.server';
|
|
43
|
+
import { loadProbes, probes } from '@/server/lib/harness/probe-cache.server';
|
|
42
44
|
import { mcpDelivery } from '@/shared/lib/harness/mcp-facts';
|
|
43
45
|
import { isRecord } from '@/shared/lib/util/guards';
|
|
46
|
+
import type { McpTransport } from '@/shared/types';
|
|
44
47
|
|
|
45
48
|
/** The sources omp's RPC mode can actually read: its own `mcp.json` files. */
|
|
46
49
|
const FILE_SOURCES: readonly McpServerSource[] = ['user', 'project'];
|
|
47
50
|
|
|
51
|
+
/**
|
|
52
|
+
* The transports an ACP agent advertised, or null when no probe has run.
|
|
53
|
+
*
|
|
54
|
+
* stdio is the ACP baseline; `http`/`sse` are optional and an agent that does
|
|
55
|
+
* not advertise one cannot accept it. The handshake applies the same filter,
|
|
56
|
+
* so the list cannot claim a server the agent never received.
|
|
57
|
+
*/
|
|
58
|
+
async function acpTransports(harness: string | null): Promise<{ http: boolean; sse: boolean } | null> {
|
|
59
|
+
if (!harness) return null;
|
|
60
|
+
const probe = probes().get(harness) ?? (await loadProbes()).get(harness);
|
|
61
|
+
return probe?.capabilities.mcpCapabilities ?? null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Drop the transports the agent did not advertise. */
|
|
65
|
+
function visibleForAcp<T extends { transport: McpTransport }>(
|
|
66
|
+
servers: T[],
|
|
67
|
+
caps: { http: boolean; sse: boolean } | null,
|
|
68
|
+
): T[] {
|
|
69
|
+
if (!caps) return servers;
|
|
70
|
+
return servers.filter((server) =>
|
|
71
|
+
server.transport === 'stdio' || (server.transport === 'http' ? caps.http : caps.sse),
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The injected list plus the servers the agent loads from its own config.
|
|
77
|
+
*
|
|
78
|
+
* The injected entry wins a name collision: it is the one Kabmo sent on
|
|
79
|
+
* `session/new`, and the agent's own file is the fallback for names Kabmo does
|
|
80
|
+
* not know. The agent's own rows are never filtered by `mcpCapabilities` —
|
|
81
|
+
* the agent already accepted them when it loaded its config.
|
|
82
|
+
*/
|
|
83
|
+
function withAgentServers(injected: McpServerEntry[], agent: McpServerEntry[]): McpServerEntry[] {
|
|
84
|
+
const seen = new Set(injected.map((entry) => entry.name.toLowerCase()));
|
|
85
|
+
return [...injected, ...agent.filter((entry) => !seen.has(entry.name.toLowerCase()))];
|
|
86
|
+
}
|
|
87
|
+
|
|
48
88
|
export async function getSessionMcp({ params }: LoaderFunctionArgs) {
|
|
49
89
|
const sessionId = params.sessionId;
|
|
50
90
|
if (!sessionId) return json({ error: 'Missing session id' }, { status: 400 });
|
|
@@ -52,12 +92,22 @@ export async function getSessionMcp({ params }: LoaderFunctionArgs) {
|
|
|
52
92
|
const ref = await resolveSessionRef(sessionId);
|
|
53
93
|
const overrides = await readSessionMcpOverrides(sessionId);
|
|
54
94
|
const delivery = ref.harness ? mcpDelivery(ref.harness) : null;
|
|
55
|
-
const
|
|
95
|
+
const injected = ref.cwd
|
|
56
96
|
? await mcpServerEntriesFor(ref.cwd, {
|
|
57
97
|
overrides,
|
|
58
98
|
sources: delivery === 'omp-config' ? FILE_SOURCES : undefined,
|
|
59
99
|
})
|
|
60
100
|
: [];
|
|
101
|
+
const visible = delivery === 'acp'
|
|
102
|
+
? visibleForAcp(injected, await acpTransports(ref.harness))
|
|
103
|
+
: injected;
|
|
104
|
+
// An ACP agent also loads its own config; those servers are part of what the
|
|
105
|
+
// chat actually has, so the list is the union rather than Kabmo's injection
|
|
106
|
+
// alone (which is why it used to look identical to an omp-rpc chat).
|
|
107
|
+
const agent = delivery === 'acp' && ref.harness && ref.cwd
|
|
108
|
+
? await agentMcpEntriesFor(ref.harness, ref.cwd)
|
|
109
|
+
: [];
|
|
110
|
+
const servers = withAgentServers(visible, agent);
|
|
61
111
|
|
|
62
112
|
return json({
|
|
63
113
|
sessionId,
|
|
@@ -97,6 +147,18 @@ export async function setSessionMcp({ request, params }: ActionFunctionArgs) {
|
|
|
97
147
|
const base = await mcpServerEntriesFor(ref.cwd, { sources });
|
|
98
148
|
const target = base.find((entry) => entry.name === name);
|
|
99
149
|
if (!target) {
|
|
150
|
+
// A name the agent loads from its own config is real, but Kabmo cannot
|
|
151
|
+
// change it: the file belongs to the agent. Say so instead of a 404 that
|
|
152
|
+
// reads as "no such server".
|
|
153
|
+
const agent = delivery === 'acp' && ref.harness
|
|
154
|
+
? await agentMcpEntriesFor(ref.harness, ref.cwd)
|
|
155
|
+
: [];
|
|
156
|
+
if (agent.some((entry) => entry.name === name)) {
|
|
157
|
+
return json(
|
|
158
|
+
{ error: `MCP server "${name}" is configured by the agent, not by Kabmo` },
|
|
159
|
+
{ status: 409 },
|
|
160
|
+
);
|
|
161
|
+
}
|
|
100
162
|
return json({ error: `MCP server "${name}" is not configured for this session` }, { status: 404 });
|
|
101
163
|
}
|
|
102
164
|
|
|
@@ -107,7 +169,14 @@ export async function setSessionMcp({ request, params }: ActionFunctionArgs) {
|
|
|
107
169
|
await writeSessionMcpOverrides(sessionId, next);
|
|
108
170
|
|
|
109
171
|
const applied = await applySessionMcpChange(sessionId, ref.cwd, next);
|
|
110
|
-
const
|
|
172
|
+
const entries = await mcpServerEntriesFor(ref.cwd, { overrides: next, sources });
|
|
173
|
+
const visible = delivery === 'acp'
|
|
174
|
+
? visibleForAcp(entries, await acpTransports(ref.harness))
|
|
175
|
+
: entries;
|
|
176
|
+
const agent = delivery === 'acp' && ref.harness
|
|
177
|
+
? await agentMcpEntriesFor(ref.harness, ref.cwd)
|
|
178
|
+
: [];
|
|
179
|
+
const servers = withAgentServers(visible, agent);
|
|
111
180
|
return json({
|
|
112
181
|
success: true,
|
|
113
182
|
sessionId,
|
|
@@ -140,11 +209,14 @@ export async function probeSessionMcp({ request, params }: ActionFunctionArgs) {
|
|
|
140
209
|
if (!ref.cwd) return json({ error: 'Session has no working directory' }, { status: 400 });
|
|
141
210
|
const delivery = ref.harness ? mcpDelivery(ref.harness) : null;
|
|
142
211
|
const overrides = await readSessionMcpOverrides(sessionId);
|
|
143
|
-
const
|
|
212
|
+
const injected = await mcpServerEntriesFor(ref.cwd, {
|
|
144
213
|
overrides,
|
|
145
214
|
sources: delivery === 'omp-config' ? FILE_SOURCES : undefined,
|
|
146
215
|
});
|
|
147
|
-
const
|
|
216
|
+
const agent = delivery === 'acp' && ref.harness
|
|
217
|
+
? await agentMcpEntriesFor(ref.harness, ref.cwd)
|
|
218
|
+
: [];
|
|
219
|
+
const entry = withAgentServers(injected, agent).find((candidate) => candidate.name === name);
|
|
148
220
|
if (!entry) {
|
|
149
221
|
return json({ error: `MCP server "${name}" is not configured for this session` }, { status: 404 });
|
|
150
222
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The global identity route's request shape.
|
|
8
|
+
*
|
|
9
|
+
* The apply/restore logic is tested against a temp config file in
|
|
10
|
+
* `git-identity.server.test.ts`; this file never writes the developer's real
|
|
11
|
+
* global config. It covers the read, the body guard, and the unknown-id refusal.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
15
|
+
import { action, loader } from '@/server/routes/settings/git-identity';
|
|
16
|
+
import { getDb } from '@/server/db.server';
|
|
17
|
+
import { writeSettingsJson } from '@/server/lib/db/settings-store';
|
|
18
|
+
import { SETTINGS_BLOB_KEY } from '@/shared/lib/settings/keys';
|
|
19
|
+
import { isolateDb, releaseDb } from '@/test-support/isolated-db';
|
|
20
|
+
|
|
21
|
+
const API = 'http://localhost/api/settings/git-identity';
|
|
22
|
+
|
|
23
|
+
async function post(body: unknown): Promise<{ status: number; body: { error?: string; global?: unknown; appliedId?: string | null } }> {
|
|
24
|
+
const response = await action({
|
|
25
|
+
request: new Request(API, {
|
|
26
|
+
method: 'POST',
|
|
27
|
+
headers: { 'content-type': 'application/json' },
|
|
28
|
+
body: JSON.stringify(body),
|
|
29
|
+
}),
|
|
30
|
+
} as never) as Response;
|
|
31
|
+
return { status: response.status, body: (await response.json()) as { error?: string; global?: unknown; appliedId?: string | null } };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
beforeEach(async () => {
|
|
35
|
+
await isolateDb();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
afterEach(async () => {
|
|
39
|
+
await releaseDb();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('GET /api/settings/git-identity', () => {
|
|
43
|
+
test('answers the global identity shape', async () => {
|
|
44
|
+
const response = await loader({ request: new Request(API) } as never) as Response;
|
|
45
|
+
const body = await response.json() as { success?: boolean; global?: unknown; appliedId?: string | null };
|
|
46
|
+
|
|
47
|
+
expect(response.status).toBe(200);
|
|
48
|
+
expect(body.success).toBe(true);
|
|
49
|
+
expect('global' in body).toBe(true);
|
|
50
|
+
expect('appliedId' in body).toBe(true);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe('POST /api/settings/git-identity', () => {
|
|
55
|
+
test('an unreadable body is a 400', async () => {
|
|
56
|
+
const response = await action({
|
|
57
|
+
request: new Request(API, {
|
|
58
|
+
method: 'POST',
|
|
59
|
+
headers: { 'content-type': 'application/json' },
|
|
60
|
+
body: '{',
|
|
61
|
+
}),
|
|
62
|
+
} as never) as Response;
|
|
63
|
+
expect(response.status).toBe(400);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test('an unknown identity is refused before touching git', async () => {
|
|
67
|
+
const db = await getDb();
|
|
68
|
+
await writeSettingsJson(db, SETTINGS_BLOB_KEY, {
|
|
69
|
+
gitIdentities: [{ id: 'work', name: 'Work User', email: 'work@example.invalid' }],
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const result = await post({ identityId: 'missing' });
|
|
73
|
+
|
|
74
|
+
expect(result.status).toBe(400);
|
|
75
|
+
expect(result.body.error).toContain('no longer exists');
|
|
76
|
+
});
|
|
77
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* `GET/POST /api/settings/git-identity` — the global commit identity.
|
|
8
|
+
*
|
|
9
|
+
* A settings route rather than a git action: the write is `git config --global`,
|
|
10
|
+
* which has no repository operand. The saved identities are read from Kabmo's
|
|
11
|
+
* settings blob; the applied one is written to the user's global git config.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { json, type ActionFunctionArgs, type LoaderFunctionArgs } from '@/server/lib/remix-compat';
|
|
15
|
+
import { methodNotAllowed } from '@/server/lib/route-adapter';
|
|
16
|
+
import {
|
|
17
|
+
applyGitIdentity,
|
|
18
|
+
readGitIdentity,
|
|
19
|
+
readGitIdentitySettings,
|
|
20
|
+
} from '@/server/lib/fs/git-identity.server';
|
|
21
|
+
|
|
22
|
+
export async function loader({ request: _request }: LoaderFunctionArgs) {
|
|
23
|
+
return json({ success: true, ...(await readGitIdentity()) });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export async function action({ request, params }: ActionFunctionArgs) {
|
|
27
|
+
if (request.method !== 'POST') {
|
|
28
|
+
return methodNotAllowed({ request, params });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const body = await request.json().catch(() => null) as { identityId?: unknown } | null;
|
|
32
|
+
if (!body || typeof body !== 'object' || Array.isArray(body)) {
|
|
33
|
+
return json({ error: 'Invalid JSON body' }, { status: 400 });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const identityId = typeof body.identityId === 'string' ? body.identityId.trim() : '';
|
|
37
|
+
if (!identityId) {
|
|
38
|
+
return json({ success: true, ...(await applyGitIdentity(null)) });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const { identities } = await readGitIdentitySettings();
|
|
42
|
+
const identity = identities.find((entry) => entry.id === identityId);
|
|
43
|
+
if (!identity) {
|
|
44
|
+
return json({ error: 'That identity no longer exists.' }, { status: 400 });
|
|
45
|
+
}
|
|
46
|
+
return json({ success: true, ...(await applyGitIdentity(identity)) });
|
|
47
|
+
}
|
|
@@ -3,6 +3,7 @@ import * as settingsRoot from '@/server/routes/settings/root';
|
|
|
3
3
|
import * as settingsAgents from '@/server/routes/settings/agents';
|
|
4
4
|
import * as settingsBehavior from '@/server/routes/settings/behavior';
|
|
5
5
|
import * as settingsCommands from '@/server/routes/settings/commands';
|
|
6
|
+
import * as settingsGitIdentity from '@/server/routes/settings/git-identity';
|
|
6
7
|
import * as settingsMcp from '@/server/routes/settings/mcp';
|
|
7
8
|
import * as settingsModelOverride from '@/server/routes/settings/model-override';
|
|
8
9
|
import * as settingsMcpTest from '@/server/routes/settings/mcp-test';
|
|
@@ -25,6 +26,7 @@ export const settingsBindings: HandlerBinding[] = [
|
|
|
25
26
|
...bindingsFor(settingsAgents, '/api/settings/agents'),
|
|
26
27
|
...bindingsFor(settingsBehavior, '/api/settings/behavior'),
|
|
27
28
|
...bindingsFor(settingsCommands, '/api/settings/commands'),
|
|
29
|
+
...bindingsFor(settingsGitIdentity, '/api/settings/git-identity'),
|
|
28
30
|
...bindingsFor(settingsMcp, '/api/settings/mcp'),
|
|
29
31
|
...bindingsFor(settingsModelOverride, '/api/settings/model-override'),
|
|
30
32
|
...bindingsFor(settingsMcpTest, '/api/settings/mcp-test'),
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The context panel's two reads for an ACP chat.
|
|
8
|
+
*
|
|
9
|
+
* An ACP agent writes no JSONL, so both endpoints used to fall through to the
|
|
10
|
+
* omp-shaped estimator: the raw list invented a model id, a cwd and token
|
|
11
|
+
* counts, and the summary invented a cost. These cases pin the real source —
|
|
12
|
+
* the recorder's transcript and the agent's own `usage_update` — and the
|
|
13
|
+
* absence of a fabricated field.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { afterAll, beforeEach, describe, expect, test } from 'bun:test';
|
|
17
|
+
import { isolateDb, releaseDb } from '@/test-support/isolated-db';
|
|
18
|
+
import { getDb } from '@/server/db.server';
|
|
19
|
+
import { saveHarnessSession } from '@/server/lib/harness/session-store.server';
|
|
20
|
+
import { loader as rawLoader } from '@/server/routes/telemetry/raw-messages';
|
|
21
|
+
import { loader as contextLoader } from '@/server/routes/telemetry/context';
|
|
22
|
+
import type { LoaderFunctionArgs } from '@/server/lib/remix-compat';
|
|
23
|
+
import type { SessionContextTelemetry } from '@/shared/types';
|
|
24
|
+
|
|
25
|
+
const SESSION = 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee';
|
|
26
|
+
const CWD = '/tmp/kabmo-acp-telemetry';
|
|
27
|
+
|
|
28
|
+
function args(path: string): LoaderFunctionArgs {
|
|
29
|
+
return {
|
|
30
|
+
params: {},
|
|
31
|
+
request: new Request(`http://localhost${path}?sessionId=${SESSION}`),
|
|
32
|
+
} as LoaderFunctionArgs;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
beforeEach(async () => {
|
|
36
|
+
await isolateDb();
|
|
37
|
+
await saveHarnessSession({ sessionId: SESSION, harness: 'claude', agentSessionId: '', cwd: CWD });
|
|
38
|
+
const db = await getDb();
|
|
39
|
+
await db.run(
|
|
40
|
+
'INSERT INTO acp_transcripts (session_id, messages, updated_at) VALUES (?, ?, ?)',
|
|
41
|
+
[
|
|
42
|
+
SESSION,
|
|
43
|
+
JSON.stringify([
|
|
44
|
+
{ id: 'u1', role: 'user', content: 'hello', startedAt: 1_700_000_000_000 },
|
|
45
|
+
{
|
|
46
|
+
id: 'a1',
|
|
47
|
+
role: 'assistant',
|
|
48
|
+
content: 'done',
|
|
49
|
+
model: 'claude/sonnet',
|
|
50
|
+
startedAt: 1_700_000_001_000,
|
|
51
|
+
usage: { input: 10, output: 5, totalTokens: 15 },
|
|
52
|
+
},
|
|
53
|
+
]),
|
|
54
|
+
Date.now(),
|
|
55
|
+
],
|
|
56
|
+
);
|
|
57
|
+
await db.run(
|
|
58
|
+
`INSERT INTO harness_usage_state
|
|
59
|
+
(session_id, used, size, cost, messages, prompts, assistants, model_provider, model_id, updated_at)
|
|
60
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
61
|
+
[SESSION, 48_000, 1_000_000, 0.25, 2, 1, 1, 'claude', 'sonnet', Date.now()],
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
afterAll(async () => {
|
|
66
|
+
await releaseDb();
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
describe('GET /api/telemetry/raw-messages for an ACP chat', () => {
|
|
70
|
+
test('reads the recorder transcript and states only what the rows hold', async () => {
|
|
71
|
+
const response = await rawLoader(args('/api/telemetry/raw-messages'));
|
|
72
|
+
const data = (await response.json()) as {
|
|
73
|
+
source: string;
|
|
74
|
+
total: number;
|
|
75
|
+
items: { info: { modelID: string; path?: { cwd: string }; tokens: { input: number } }; rawPayload: unknown }[];
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
expect(data.source).toBe('acp-transcript');
|
|
79
|
+
expect(data.total).toBe(2);
|
|
80
|
+
const assistant = data.items.find((item) => item.info.modelID === 'claude/sonnet');
|
|
81
|
+
expect(assistant).toBeDefined();
|
|
82
|
+
expect(assistant?.info.path?.cwd).toBe(CWD);
|
|
83
|
+
expect(assistant?.info.tokens.input).toBe(10);
|
|
84
|
+
// The user row carries no usage: zero, never an estimate.
|
|
85
|
+
const user = data.items.find((item) => item.info.modelID === 'claude/sonnet' && item.info.tokens.input === 0);
|
|
86
|
+
expect(user).toBeDefined();
|
|
87
|
+
expect(assistant?.rawPayload).toHaveProperty('role', 'assistant');
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test('prefers the original ACP frames over the folded transcript', async () => {
|
|
91
|
+
const db = await getDb();
|
|
92
|
+
await db.run(
|
|
93
|
+
'INSERT INTO acp_frames (session_id, method, kind, role, payload, created_at) VALUES (?, ?, ?, ?, ?, ?)',
|
|
94
|
+
[
|
|
95
|
+
SESSION,
|
|
96
|
+
'session/update',
|
|
97
|
+
'agent_message_chunk',
|
|
98
|
+
'assistant',
|
|
99
|
+
JSON.stringify({
|
|
100
|
+
sessionId: SESSION,
|
|
101
|
+
update: { sessionUpdate: 'agent_message_chunk', content: { type: 'text', text: 'raw from acp' } },
|
|
102
|
+
}),
|
|
103
|
+
Date.now(),
|
|
104
|
+
],
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const response = await rawLoader(args('/api/telemetry/raw-messages'));
|
|
108
|
+
const data = (await response.json()) as {
|
|
109
|
+
source: string;
|
|
110
|
+
total: number;
|
|
111
|
+
items: { type: string; rawPayload: { update?: { sessionUpdate?: string } } }[];
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
expect(data.source).toBe('acp-frames');
|
|
115
|
+
expect(data.total).toBe(1);
|
|
116
|
+
expect(data.items[0].type).toBe('agent_message_chunk');
|
|
117
|
+
expect(data.items[0].rawPayload.update?.sessionUpdate).toBe('agent_message_chunk');
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
describe('GET /api/telemetry/context for an ACP chat', () => {
|
|
122
|
+
test('reports the agent usage instead of an estimate', async () => {
|
|
123
|
+
const response = await contextLoader(args('/api/telemetry/context'));
|
|
124
|
+
const data = (await response.json()) as { source: string; telemetry: SessionContextTelemetry };
|
|
125
|
+
|
|
126
|
+
expect(data.source).toBe('acp-usage');
|
|
127
|
+
expect(data.telemetry.contextUsed).toBe(48_000);
|
|
128
|
+
expect(data.telemetry.contextLimit).toBe(1_000_000);
|
|
129
|
+
expect(data.telemetry.messagesCount).toBe(2);
|
|
130
|
+
expect(data.telemetry.modelId).toBe('claude/sonnet');
|
|
131
|
+
expect(data.telemetry.costFormatted).toBe('$0.2500');
|
|
132
|
+
expect(data.telemetry.rawMessages).toEqual([]);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
test('a chat with no reported usage still counts its turns', async () => {
|
|
136
|
+
const db = await getDb();
|
|
137
|
+
await db.run('DELETE FROM harness_usage_state WHERE session_id = ?', [SESSION]);
|
|
138
|
+
|
|
139
|
+
const response = await contextLoader(args('/api/telemetry/context'));
|
|
140
|
+
const data = (await response.json()) as { source: string; telemetry: SessionContextTelemetry };
|
|
141
|
+
|
|
142
|
+
expect(data.source).toBe('acp-transcript');
|
|
143
|
+
expect(data.telemetry.messagesCount).toBe(2);
|
|
144
|
+
expect(data.telemetry.userCount).toBe(1);
|
|
145
|
+
expect(data.telemetry.assistantCount).toBe(1);
|
|
146
|
+
expect(data.telemetry.contextUsed).toBe(0);
|
|
147
|
+
expect(data.telemetry.modelId).toBe('claude/sonnet');
|
|
148
|
+
});
|
|
149
|
+
});
|
|
@@ -6,6 +6,8 @@ import { loadSessionSource } from '@/server/lib/chat/session-store.server';
|
|
|
6
6
|
import { computeRealSessionTelemetry } from '@/server/lib/omp/session/telemetry';
|
|
7
7
|
import { CONTEXT_LIMIT } from '@/server/lib/omp/session/telemetry/format';
|
|
8
8
|
import { resolveSelectedModelContextLimit } from '@/server/lib/models/selected-context-limit.server';
|
|
9
|
+
import { resolveSessionRef } from '@/server/lib/sessions/resolve.server';
|
|
10
|
+
import { acpTelemetryFor } from '@/server/lib/harness/acp/acp-telemetry.server';
|
|
9
11
|
import type { SessionContextTelemetry } from '@/shared/types';
|
|
10
12
|
|
|
11
13
|
/**
|
|
@@ -45,6 +47,35 @@ export async function loader({ request }: LoaderFunctionArgs) {
|
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
if (source?.kind === 'messages') {
|
|
50
|
+
// An ACP chat's numbers come from the agent's own `usage_update`, not
|
|
51
|
+
// from an estimate over the transcript. The omp-shaped computation below
|
|
52
|
+
// invents token counts, a cost and a model id, which is exactly what the
|
|
53
|
+
// panel must not show for a harness that reports real usage.
|
|
54
|
+
const ref = sessionId ? await resolveSessionRef(sessionId) : null;
|
|
55
|
+
if (ref?.harness && ref.harness !== 'omp-rpc') {
|
|
56
|
+
const acp = await acpTelemetryFor(sessionId!, source.title);
|
|
57
|
+
if (acp) return json({ telemetry: stripRawMessages(acp), isMock: false, source: 'acp-usage' });
|
|
58
|
+
// No usage was ever reported (a chat that has not run, or one whose
|
|
59
|
+
// agent sends none). The transcript still says how many turns exist,
|
|
60
|
+
// so the panel shows a started session with zero usage rather than
|
|
61
|
+
// "not started" over a conversation that is on screen.
|
|
62
|
+
const rows = source.messages as { role?: string; model?: string }[];
|
|
63
|
+
const userCount = rows.filter((row) => row.role === 'user').length;
|
|
64
|
+
const model = rows.find((row) => typeof row.model === 'string' && row.model)?.model ?? '';
|
|
65
|
+
const base = emptyTelemetry(sessionId || 'default', source.title, selectedLimit);
|
|
66
|
+
return json({
|
|
67
|
+
telemetry: {
|
|
68
|
+
...base,
|
|
69
|
+
messagesCount: rows.length,
|
|
70
|
+
userCount,
|
|
71
|
+
assistantCount: rows.length - userCount,
|
|
72
|
+
modelId: model,
|
|
73
|
+
modelName: model,
|
|
74
|
+
},
|
|
75
|
+
isMock: false,
|
|
76
|
+
source: 'acp-transcript',
|
|
77
|
+
});
|
|
78
|
+
}
|
|
48
79
|
const telemetry = computeSessionContextTelemetry(sessionId, source.title, source.messages, selectedLimit);
|
|
49
80
|
return json({ telemetry: stripRawMessages(telemetry), isMock: false });
|
|
50
81
|
}
|
|
@@ -4,6 +4,11 @@ import { isMockMode } from '@/server/mock.server';
|
|
|
4
4
|
import { loadSessionSource } from '@/server/lib/chat/session-store.server';
|
|
5
5
|
import { computeSessionContextTelemetry } from '@/client/data/context-data';
|
|
6
6
|
import { computeRawMessagesPage, type RawMessageRole } from '@/server/lib/omp/session/telemetry-raw';
|
|
7
|
+
import { resolveSessionRef } from '@/server/lib/sessions/resolve.server';
|
|
8
|
+
import { buildAcpRawMessages } from '@/server/lib/harness/acp/acp-raw-messages.server';
|
|
9
|
+
import { loadAcpFramesPage } from '@/server/lib/harness/acp/acp-frames.server';
|
|
10
|
+
import { loadAcpUsage } from '@/server/lib/harness/acp/acp-telemetry.server';
|
|
11
|
+
import type { ChatMessageData } from '@/shared/types/chat';
|
|
7
12
|
import type { RawMessageItem } from '@/shared/types';
|
|
8
13
|
|
|
9
14
|
const MAX_PAGE_SIZE = 100;
|
|
@@ -47,6 +52,35 @@ export async function loader({ request }: LoaderFunctionArgs) {
|
|
|
47
52
|
return json({ ...result, page, pageSize, isMock: false, source: 'omp-jsonl' });
|
|
48
53
|
}
|
|
49
54
|
|
|
55
|
+
// An ACP chat has no JSONL: the raw panel reads the ORIGINAL
|
|
56
|
+
// `session/update` payloads the agent sent, not Kabmo's folded transcript.
|
|
57
|
+
// A session recorded before the frame log existed falls back to the
|
|
58
|
+
// transcript rows, which are still truthful (no invented tokens/model).
|
|
59
|
+
const ref = sessionId ? await resolveSessionRef(sessionId) : null;
|
|
60
|
+
if (ref?.harness && ref.harness !== 'omp-rpc') {
|
|
61
|
+
const usage = await loadAcpUsage(sessionId!).catch(() => null);
|
|
62
|
+
const modelId = usage?.runModel
|
|
63
|
+
? `${usage.runModel.provider}/${usage.runModel.modelId}`
|
|
64
|
+
: undefined;
|
|
65
|
+
const context = {
|
|
66
|
+
...(modelId ? { modelId } : {}),
|
|
67
|
+
...(ref.cwd ? { cwd: ref.cwd } : {}),
|
|
68
|
+
};
|
|
69
|
+
const frames = await loadAcpFramesPage(sessionId!, page, pageSize, role, context);
|
|
70
|
+
if (frames.total > 0) {
|
|
71
|
+
return json({ ...frames, page, pageSize, isMock: false, source: 'acp-frames' });
|
|
72
|
+
}
|
|
73
|
+
if (source?.kind === 'messages') {
|
|
74
|
+
const items = buildAcpRawMessages(source.messages as ChatMessageData[], context);
|
|
75
|
+
return json({
|
|
76
|
+
...pagedFromList(items, page, pageSize, role, items.length),
|
|
77
|
+
isMock: false,
|
|
78
|
+
source: 'acp-transcript',
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return json({ items: [], total: 0, filteredTotal: 0, page, pageSize, isMock: false, source: 'acp-frames' });
|
|
82
|
+
}
|
|
83
|
+
|
|
50
84
|
if (source?.kind === 'messages') {
|
|
51
85
|
const telemetry = computeSessionContextTelemetry(sessionId, source.title, source.messages);
|
|
52
86
|
return json(pagedFromList(telemetry.rawMessages, page, pageSize, role, telemetry.messagesCount));
|
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* The
|
|
7
|
+
* The spill reference a truncated result carries.
|
|
8
8
|
*
|
|
9
9
|
* The shape is omp's own, taken from a real result: the id sits under
|
|
10
10
|
* `details.meta.limits.columnTruncated.artifactId`, and the kind is NOT in that
|
|
11
11
|
* record — it comes from the tool that produced the result, which is what tells
|
|
12
|
-
* an `eval` artifact from a `bash` one under the same id.
|
|
12
|
+
* an `eval` artifact from a `bash` one under the same id. omp 19.0.0 names the
|
|
13
|
+
* file `local://<id>.log` and drops the kind from the path; the `details`
|
|
14
|
+
* record is unchanged, so this reader is too.
|
|
13
15
|
*
|
|
14
16
|
* Pure function, no mounting.
|
|
15
17
|
*/
|
|
@@ -4,7 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* The
|
|
7
|
+
* The spill reference a rewritten or truncated tool result carries.
|
|
8
|
+
*
|
|
9
|
+
* omp 19.0.0 names the file `local://<id>.log` at the session's `local://`
|
|
10
|
+
* root; before it the URL was `artifact://<id>` and the file carried the tool's
|
|
11
|
+
* kind. The `details` record is the same either way, so only the reader's path
|
|
12
|
+
* changed (`artifacts.server.ts`).
|
|
8
13
|
*
|
|
9
14
|
* Two records name one, and both are read here:
|
|
10
15
|
*
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
* line count and a `read`'s the service log as a file size.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import { bashServiceOf,
|
|
16
|
+
import { bashServiceOf, jobTone, procOpLabel, procViewOf } from '@/shared/lib/omp/session/proc';
|
|
17
|
+
import { daemonTone, formatProcDuration, procUptime } from '@/shared/lib/omp/session/proc-daemon';
|
|
17
18
|
import { countPhrase } from '@/shared/lib/chat/tool/labels';
|
|
18
19
|
import type { ToolCallData } from '@/shared/types/chat';
|
|
19
20
|
import type { ToolFact } from '@/shared/lib/chat/tool/summary';
|
|
@@ -70,6 +70,8 @@ describe('isVirtualPath', () => {
|
|
|
70
70
|
expect(isVirtualPath('agent://Sleeper')).toBe(true);
|
|
71
71
|
expect(isVirtualPath('skill://pr-review')).toBe(true);
|
|
72
72
|
expect(isVirtualPath('artifact://17')).toBe(true);
|
|
73
|
+
// omp 19.0.0's spill URL, which replaced `artifact://<id>`.
|
|
74
|
+
expect(isVirtualPath('local://17.log')).toBe(true);
|
|
73
75
|
});
|
|
74
76
|
|
|
75
77
|
test('leaves a real path alone', () => {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
import { describe, expect, test } from 'bun:test';
|
|
17
17
|
import { groupRepos, repoNameWithinGroup } from '@/shared/lib/fs/repo-groups';
|
|
18
|
-
import { repoLabel, repoShortLabel, workspaceFolderName } from '@/shared/lib/fs/repo-label';
|
|
18
|
+
import { repoLabel, repoRows, repoShortLabel, workspaceFolderName } from '@/shared/lib/fs/repo-label';
|
|
19
19
|
|
|
20
20
|
describe('workspaceFolderName', () => {
|
|
21
21
|
test('names the root by its last path segment', () => {
|
|
@@ -63,6 +63,27 @@ describe('repoShortLabel', () => {
|
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
+
describe('repoRows', () => {
|
|
67
|
+
test('synthesizes the root row when discovery did not report it', () => {
|
|
68
|
+
// The reported bug: a workspace root that is a folder of nested repos is
|
|
69
|
+
// not itself a repo, so discovery omits `'.'` — and the picker lost the
|
|
70
|
+
// root, leaving the trigger on the first nested repo while the panel was
|
|
71
|
+
// still browsing the root.
|
|
72
|
+
const rows = repoRows('/home/dev/Workspace', ['projects/a', 'projects/b']);
|
|
73
|
+
expect(rows.map((row) => row.repo)).toEqual(['.', 'projects/a', 'projects/b']);
|
|
74
|
+
expect(rows[0]).toEqual({ repo: '.', label: 'Workspace', short: 'Workspace' });
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test('leads with the root whatever order discovery returned', () => {
|
|
78
|
+
const rows = repoRows('/ws', ['projects/a', '.', 'zzz']);
|
|
79
|
+
expect(rows.map((row) => row.repo)).toEqual(['.', 'projects/a', 'zzz']);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test('an empty discovery still offers the root', () => {
|
|
83
|
+
expect(repoRows('/ws', []).map((row) => row.repo)).toEqual(['.']);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
66
87
|
describe('groupRepos', () => {
|
|
67
88
|
test('groups by first path segment, root first then folders alphabetically', () => {
|
|
68
89
|
const groups = groupRepos(['projects/b/two', 'projects/a/one', '.', 'other/x']);
|
|
@@ -53,3 +53,32 @@ export function repoShortLabel(repo: string, rootPath: string | undefined): stri
|
|
|
53
53
|
if (repo === '.') return workspaceFolderName(rootPath);
|
|
54
54
|
return repo.split('/').pop() || repo;
|
|
55
55
|
}
|
|
56
|
+
|
|
57
|
+
/** One choice a repo picker draws: the path it sends back, and its two labels. */
|
|
58
|
+
export interface RepoRow {
|
|
59
|
+
repo: string;
|
|
60
|
+
label: string;
|
|
61
|
+
short: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The rows a repo picker draws: the workspace root first, then discovery's
|
|
66
|
+
* order.
|
|
67
|
+
*
|
|
68
|
+
* The root is a legitimate choice even when it is not itself a repository — a
|
|
69
|
+
* folder of nested repos is a normal workspace, and Files/Search/Terminal browse
|
|
70
|
+
* it — so the row is SYNTHESIZED when discovery did not report it. Discovery
|
|
71
|
+
* omits `'.'` for a root that is not a repo (the git route's implicit-repo
|
|
72
|
+
* fallback depends on that), and a picker that mapped the list straight through
|
|
73
|
+
* therefore lost the root the moment the walk found a nested repo: the trigger
|
|
74
|
+
* fell back to the first nested repo while the panel was still browsing the
|
|
75
|
+
* root.
|
|
76
|
+
*/
|
|
77
|
+
export function repoRows(rootPath: string | undefined, repos: readonly string[]): RepoRow[] {
|
|
78
|
+
const rest = repos.filter((repo) => repo !== '.');
|
|
79
|
+
return ['.', ...rest].map((repo) => ({
|
|
80
|
+
repo,
|
|
81
|
+
label: repoLabel(repo, rootPath),
|
|
82
|
+
short: repoShortLabel(repo, rootPath),
|
|
83
|
+
}));
|
|
84
|
+
}
|