@kabmo-labs/kabmo 0.42.1 → 0.43.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/README.md +1 -1
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +619 -582
- package/dist/client/static/js/{CsvGrid-8gdp5b49.js → CsvGrid-3fr85032.js} +2 -2
- package/dist/client/static/js/{DocxView-j9sphgra.js → DocxView-pqbp2fpd.js} +4 -4
- package/dist/client/static/js/{DrawioView-xsgjc7d8.js → DrawioView-m0vecq1m.js} +2 -2
- package/dist/client/static/js/ImageView-rbejbjwg.js +1 -0
- package/dist/client/static/js/LayoutWrapper-mxfsqh57.js +2 -0
- package/dist/client/static/js/Modal-vnwg4xn3.js +59 -0
- package/dist/client/static/js/{PdfView-afd5cg54.js → PdfView-wmg0vk2p.js} +1 -1
- package/dist/client/static/js/SessionsView-90z2t4qe.js +1 -0
- package/dist/client/static/js/{SheetView-gfzgxb4r.js → SheetView-rg5gkcd7.js} +13 -13
- package/dist/client/static/js/{SvgPreview-225pkb99.js → SvgPreview-wpb7b0ez.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-z70sk69m.js → abnfDiagram-O67JEVCF-4pxqt66j.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-7j23x20s.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-pf1gpkje.js → architectureDiagram-NJMV4G6O-kwt1va5y.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-sr25kbn6.js → blockDiagram-BEXU5L5S-hbj5v7n7.js} +7 -7
- package/dist/client/static/js/c-8jf64j6h.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-znstpg86.js → c4Diagram-YGBWAQC7-epfzh8dw.js} +6 -6
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-7n0pdcd8.js → classDiagram-v2-NBCMYWYE-kbks4qgz.js} +6 -6
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-zn3qw4c4.js → cose-bilkent-JH36ORCC-dvdmckrf.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-3z41vtzs.js → cynefinDiagram-VND7K2PF-r084stj5.js} +2 -2
- package/dist/client/static/js/{dagre-6A5THRUB-5j3zn883.js → dagre-6A5THRUB-64qc51n1.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-ryw1w2kh.js → diagram-22UHCM2B-70qtb1rm.js} +16 -16
- package/dist/client/static/js/{diagram-3UASUU5V-p91q4gkh.js → diagram-3UASUU5V-dgkvnsme.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-22dn73g4.js → diagram-ATOU4E4O-rnpsp26v.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-589p9n53.js → diagram-CDSNMT55-26hthh60.js} +5 -5
- package/dist/client/static/js/{diagram-MLGK6HIB-ezw06wbx.js → diagram-MLGK6HIB-nc1s85r5.js} +2 -2
- package/dist/client/static/js/{diagram-MPIPVDR6-cfwrsvk1.js → diagram-MPIPVDR6-e4dckqhv.js} +3 -3
- package/dist/client/static/js/{dockerfile-r4k7q34y.js → dockerfile-rxtyyhr1.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-3rv2wvbf.js → ebnfDiagram-ZINNZB2B-3w9h8qk7.js} +1 -1
- package/dist/client/static/js/{elixir-szk51ehr.js → elixir-5ewfhvfh.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-ma40kneq.js → elk-276RUBZZ-httpkyb1.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-xwstsfqa.js → erDiagram-OPXOYQCR-3qhvf7se.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-1jat076e.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-qxyx9tr9.js → ganttDiagram-FUAMR5RP-t53m50e5.js} +6 -6
- package/dist/client/static/js/gitGraph-4MIJSDKK-tjhkv71w.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-v6sg7bkh.js → gitGraphDiagram-X574FWY7-b5wn9eht.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-p0ez6hqd.js → index-181p91hf.js} +1 -1
- package/dist/client/static/js/{index-kh6vp5w5.js → index-1dwdgp27.js} +1 -1
- package/dist/client/static/js/{index-df4yxfzd.js → index-2q23dwrs.js} +2 -2
- package/dist/client/static/js/{index-4cncqz8j.js → index-38v0781h.js} +2 -2
- package/dist/client/static/js/{index-mvykbyhe.js → index-4banz7gr.js} +1 -1
- package/dist/client/static/js/{index-nh29fkk9.js → index-7dp90ad1.js} +2 -2
- package/dist/client/static/js/{index-b37ewyvk.js → index-7z9tz4ze.js} +2 -2
- package/dist/client/static/js/{index-3d40c0a7.js → index-7zc1z9z9.js} +4 -4
- package/dist/client/static/js/{index-8pdz41yh.js → index-8y51kgan.js} +3 -3
- package/dist/client/static/js/{index-qh753ynv.js → index-axszsg7a.js} +1 -1
- package/dist/client/static/js/{index-pxtff3ez.js → index-bvjct7sp.js} +2 -2
- package/dist/client/static/js/{index-8b3t2y77.js → index-cqnpsw2m.js} +2 -2
- package/dist/client/static/js/{index-869bpqcs.js → index-d8r84zjd.js} +12 -12
- package/dist/client/static/js/{index-mq6s2faf.js → index-dg3b0mfk.js} +2 -2
- package/dist/client/static/js/index-dkqgmacr.js +4 -0
- package/dist/client/static/js/{index-pkes9492.js → index-e7yf273s.js} +2 -2
- package/dist/client/static/js/{index-0p43qr4k.js → index-egd0vfey.js} +1 -1
- package/dist/client/static/js/{index-x7m6dmt4.js → index-enb6chty.js} +1 -1
- package/dist/client/static/js/{index-6eq445nn.js → index-f4fqvct6.js} +22 -22
- package/dist/client/static/js/{index-pysqpc5n.js → index-fg965t62.js} +2 -2
- package/dist/client/static/js/{index-sr7sdm2t.js → index-fgyenbv8.js} +4 -4
- package/dist/client/static/js/{index-qsw5edtk.js → index-fjnkzk12.js} +5 -5
- package/dist/client/static/js/{index-0nca2nhp.js → index-g3a9j9hf.js} +1 -1
- package/dist/client/static/js/{index-x7a5jpvq.js → index-g4rsmakg.js} +3 -3
- package/dist/client/static/js/{index-qx6x4z0y.js → index-gmnmnfm0.js} +2 -2
- package/dist/client/static/js/{index-313ctswm.js → index-gwqb7m8g.js} +1 -1
- package/dist/client/static/js/{index-w5q9ymf4.js → index-j60gtvw8.js} +1 -1
- package/dist/client/static/js/index-jvs2fvqz.js +2 -0
- package/dist/client/static/js/{index-r8cc80w5.js → index-jz93j0at.js} +2 -2
- package/dist/client/static/js/{index-2w9j2nj4.js → index-k9ws464d.js} +2 -2
- package/dist/client/static/js/{index-b3d2k7ec.js → index-kc3c2gzb.js} +1 -1
- package/dist/client/static/js/{index-9hzfvjrb.js → index-kccp6tgd.js} +2 -2
- package/dist/client/static/js/{index-9ss64g4g.js → index-kmzd0adv.js} +1 -1
- package/dist/client/static/js/{index-8fvmyv7t.js → index-ksph3kpr.js} +2 -2
- 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-mphhvgm9.js → index-q1gwgmxt.js} +2 -2
- 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-qzw4jnnv.js +1 -0
- package/dist/client/static/js/{index-xsts4pqm.js → index-r11bbnek.js} +78 -78
- package/dist/client/static/js/{index-q3qpm7jn.js → index-rv4qs3wm.js} +2 -2
- package/dist/client/static/js/{index-hga3e13s.js → index-s78n0dtv.js} +2 -2
- package/dist/client/static/js/{index-03pyvmcz.js → index-sesghshh.js} +2 -2
- package/dist/client/static/js/index-tnv3dryk.js +9 -0
- package/dist/client/static/js/{index-v5dbrq83.js → index-tzbzehqd.js} +1 -1
- package/dist/client/static/js/index-vcrh95gf.css +1 -0
- package/dist/client/static/js/{index-4y0ayjfx.js → index-vmgzhp41.js} +1 -1
- package/dist/client/static/js/{index-6dxs0tvg.js → index-wmv3crye.js} +2 -2
- 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/index-zqthmaxq.js +478 -0
- package/dist/client/static/js/info-A6RAGUB7-m6qz24p8.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-0anekyhb.js → infoDiagram-VRGFBTTK-qv7438m3.js} +1 -1
- package/dist/client/static/js/ini-1x0ad976.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-zxpmfkjb.js → ishikawaDiagram-OU5B5YK6-p1w6zg5y.js} +4 -4
- package/dist/client/static/js/java-3944nq02.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-1e86fzra.js → journeyDiagram-ZHPQQLJL-ywk6xqxr.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-e85hhmr1.js → kanban-definition-PNTS6WVX-gtrmhggc.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-jpcrnzyw.js → mermaid.core-5s24b4hh.js} +6 -6
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-xwy5928e.js → mindmap-definition-NLK3R4M7-3wx7abqn.js} +4 -4
- package/dist/client/static/js/one-dark-pro-3vya9z02.js +1 -0
- package/dist/client/static/js/one-light-1yrwn9my.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-ng6wq5xj.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-7dy6pw26.js → pegDiagram-GJSIUBJH-yvyqnjya.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-nrv2t5yn.js → pieDiagram-5QR66LMP-26x6pj38.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-3nt63xr8.js → quadrantDiagram-O4NWA36T-qhe8h0j9.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-evm05hzp.js → railroadDiagram-XR7U4H2S-dwy3k2jx.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-tzrcmktj.js → requirementDiagram-PLB6GJNP-hcmgfesg.js} +4 -4
- package/dist/client/static/js/{ruby-s2bqr910.js → ruby-9qyx7knh.js} +1 -1
- package/dist/client/static/js/{rust-pcvgybk3.js → rust-bmb4ee5w.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-jvjd5rz8.js → sankeyDiagram-IPEJSGJF-s6d3k4zs.js} +6 -6
- package/dist/client/static/js/{sass-bm32bb5k.js → sass-07rteya0.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-0zvjwx29.js → sequenceDiagram-PO4LG4MO-0fcmzgdy.js} +19 -19
- package/dist/client/static/js/{sizeCapture-INFHLROL-6t6g0edv.js → sizeCapture-INFHLROL-t8fcm7rq.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-nb13b23a.js → stateDiagram-v2-GCMORJYK-jr80hfeg.js} +6 -6
- package/dist/client/static/js/{svelte-ztkaww47.js → svelte-w365cpwa.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-ef8vmg6f.js → swimlanes-2SLR337P-x1ay6w39.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-xj123xrp.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-3bfph698.js → timeline-definition-EJHVYXUP-qz0g6msb.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-vj6yj6tc.js → usecaseDiagram-POWQR4AR-sxzrv8ht.js} +43 -43
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-9xyyabaq.js → vennDiagram-UO4OBE2U-qsqgnjcv.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-zpcwgv9d.js → wardleyDiagram-VNRHLVJA-rvwxn458.js} +4 -4
- package/dist/client/static/js/xml-6ct32gys.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-pdr2rms2.js → xychartDiagram-PMCCYNJV-nb4w7rcg.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/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/Wait.tsx +3 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolBody.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolRowActions.tsx +45 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/tool-view.ts +14 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Card.tsx +2 -12
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Compact.tsx +42 -38
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Minimal.tsx +25 -21
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Trace.tsx +41 -29
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.tsx +47 -43
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/parity.test.tsx +136 -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/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/chat/session-store.server.ts +22 -1
- 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/one-shot.server.ts +141 -0
- package/src/server/lib/harness/acp/raw-listeners.ts +30 -0
- package/src/server/lib/harness/acp/session-handshake.ts +11 -3
- package/src/server/lib/harness/acp/session.test-util.ts +2 -0
- package/src/server/lib/harness/acp/session.ts +8 -0
- 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 +2 -0
- package/src/server/lib/omp/session/goal-auditor.server.ts +10 -48
- package/src/server/lib/omp/session/scan.ts +15 -2
- package/src/server/lib/omp/session/session-discovery.test.ts +21 -0
- 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/timeline/tool-render-mode.ts +3 -3
- 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/operator-title.test.ts +21 -0
- package/src/shared/lib/omp/session/operator-title.ts +28 -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/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-ve9hc519.js +0 -1
- package/dist/client/static/js/LayoutWrapper-5mqffvkc.js +0 -2
- package/dist/client/static/js/Modal-50whypff.js +0 -38
- package/dist/client/static/js/SessionsView-7719nvy0.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-evp84v09.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-001vebsp.js +0 -2
- package/dist/client/static/js/index-5599dngt.js +0 -1
- package/dist/client/static/js/index-5asf5625.js +0 -4
- package/dist/client/static/js/index-cqaz1281.js +0 -2
- package/dist/client/static/js/index-f4vr1c6e.css +0 -1
- package/dist/client/static/js/index-rt6ac0kk.js +0 -478
- package/dist/client/static/js/index-y1p3bdsw.js +0 -9
- 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-r0tswz8r.js +0 -1
- package/dist/client/static/js/one-light-xzcfrptf.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-f4sx355z.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
|
@@ -15,20 +15,17 @@
|
|
|
15
15
|
* omp RPC child is involved.
|
|
16
16
|
*
|
|
17
17
|
* The session is disposable: no registry entry, no stream row, no title, no
|
|
18
|
-
* goal driver. Only the assistant text is kept.
|
|
18
|
+
* goal driver. Only the assistant text is kept. The transport itself lives in
|
|
19
|
+
* `one-shot.server.ts`, shared with the commit-message generator.
|
|
19
20
|
*/
|
|
20
21
|
|
|
21
|
-
import {
|
|
22
|
-
import { loadHarnessConfig, resolveLaunch } from '@/server/lib/harness/config.server';
|
|
23
|
-
import { sessionLaunchCommand } from '@/server/lib/harness/launch';
|
|
22
|
+
import { runAcpOneShot } from '@/server/lib/harness/acp/one-shot.server';
|
|
24
23
|
import {
|
|
25
24
|
buildGoalAuditPrompt,
|
|
26
25
|
readGoalAuditAnswers,
|
|
27
26
|
type GoalAuditAnswers,
|
|
28
27
|
} from '@/server/lib/omp/session/goal-auditor.server';
|
|
29
|
-
import { extractTextFromContent } from '@/shared/lib/omp/session/mapper';
|
|
30
28
|
import type { HarnessId } from '@/shared/lib/harness/catalog';
|
|
31
|
-
import type { AgentEvent } from '@/server/lib/omp/rpc/constants';
|
|
32
29
|
|
|
33
30
|
export interface AcpGoalAuditRequest {
|
|
34
31
|
harness: HarnessId;
|
|
@@ -40,9 +37,6 @@ export interface AcpGoalAuditRequest {
|
|
|
40
37
|
timeoutMs?: number;
|
|
41
38
|
}
|
|
42
39
|
|
|
43
|
-
/** How long one audit may take. The harness may be slower than print mode. */
|
|
44
|
-
const DEFAULT_TIMEOUT_MS = 90_000;
|
|
45
|
-
|
|
46
40
|
/**
|
|
47
41
|
* Ask the ACP agent to classify the last turn's report.
|
|
48
42
|
*
|
|
@@ -50,58 +44,15 @@ const DEFAULT_TIMEOUT_MS = 90_000;
|
|
|
50
44
|
* reply); the driver treats that the same way it treats an omp audit failure.
|
|
51
45
|
*/
|
|
52
46
|
export async function runAcpGoalAudit(request: AcpGoalAuditRequest): Promise<GoalAuditAnswers | null> {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
{
|
|
63
|
-
harness: request.harness,
|
|
64
|
-
command: sessionLaunchCommand(request.harness, launch.command),
|
|
65
|
-
...(launch.env ? { env: launch.env } : {}),
|
|
66
|
-
model: request.model,
|
|
67
|
-
// A classification, not a task: the cheapest level the agent offers.
|
|
68
|
-
thinkingLevel: 'off',
|
|
69
|
-
accessMode: 'yolo',
|
|
70
|
-
},
|
|
71
|
-
request.cwd,
|
|
72
|
-
);
|
|
73
|
-
// A disposable reader: no stream row, no turn settle, no queue, no title.
|
|
74
|
-
session.markStream = () => {};
|
|
75
|
-
session.onTurnEnded = async () => {};
|
|
76
|
-
|
|
77
|
-
const events: AgentEvent[] = [];
|
|
78
|
-
session.onEvent((event) => events.push(event));
|
|
79
|
-
const ended = Promise.withResolvers<void>();
|
|
80
|
-
const stop = session.onEvent((event) => {
|
|
81
|
-
if (event.type === 'agent_end') ended.resolve();
|
|
47
|
+
const outcome = await runAcpOneShot({
|
|
48
|
+
harness: request.harness,
|
|
49
|
+
cwd: request.cwd,
|
|
50
|
+
model: request.model,
|
|
51
|
+
prompt: buildGoalAuditPrompt(request.objective, request.answer),
|
|
52
|
+
...(request.timeoutMs !== undefined ? { timeoutMs: request.timeoutMs } : {}),
|
|
53
|
+
// The audit is a classification, not a task: the agent may use its own
|
|
54
|
+
// tools to read the report, and the prompt is the only thing it is asked.
|
|
55
|
+
denyTools: false,
|
|
82
56
|
});
|
|
83
|
-
|
|
84
|
-
void session.destroyAndWait();
|
|
85
|
-
ended.resolve();
|
|
86
|
-
}, request.timeoutMs ?? DEFAULT_TIMEOUT_MS);
|
|
87
|
-
|
|
88
|
-
try {
|
|
89
|
-
await session.start();
|
|
90
|
-
// `synthetic` keeps the audit prompt from becoming this session's title.
|
|
91
|
-
await session.send({
|
|
92
|
-
type: 'prompt',
|
|
93
|
-
message: buildGoalAuditPrompt(request.objective, request.answer),
|
|
94
|
-
synthetic: true,
|
|
95
|
-
});
|
|
96
|
-
await ended.promise;
|
|
97
|
-
const message = [...events].reverse().find((event) => event.type === 'message_end')?.message;
|
|
98
|
-
if (!message || typeof message !== 'object' || !('content' in message)) return null;
|
|
99
|
-
return readGoalAuditAnswers(extractTextFromContent((message as { content: unknown }).content));
|
|
100
|
-
} catch {
|
|
101
|
-
return null;
|
|
102
|
-
} finally {
|
|
103
|
-
clearTimeout(timer);
|
|
104
|
-
stop();
|
|
105
|
-
await session.destroyAndWait().catch(() => {});
|
|
106
|
-
}
|
|
57
|
+
return outcome.ok ? readGoalAuditAnswers(outcome.text) : null;
|
|
107
58
|
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The raw ACP frame log.
|
|
8
|
+
*
|
|
9
|
+
* The transcript is Kabmo's fold; the raw panel must show the original
|
|
10
|
+
* `session/update` payloads. These cases pin the write path (batched, ordered),
|
|
11
|
+
* the role mapping the panel filters on, and the page reader's `rawPayload`.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { afterAll, beforeEach, describe, expect, test } from 'bun:test';
|
|
15
|
+
import { isolateDb, releaseDb } from '@/test-support/isolated-db';
|
|
16
|
+
import { AcpFrameRecorder, frameRole, loadAcpFramesPage } from '@/server/lib/harness/acp/acp-frames.server';
|
|
17
|
+
|
|
18
|
+
const SESSION = 'frame-session';
|
|
19
|
+
|
|
20
|
+
beforeEach(async () => {
|
|
21
|
+
await isolateDb();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
afterAll(async () => {
|
|
25
|
+
await releaseDb();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('frameRole', () => {
|
|
29
|
+
test('maps the message kinds the panel filters on', () => {
|
|
30
|
+
expect(frameRole('user_message_chunk')).toBe('user');
|
|
31
|
+
expect(frameRole('agent_message_chunk')).toBe('assistant');
|
|
32
|
+
expect(frameRole('agent_thought_chunk')).toBe('assistant');
|
|
33
|
+
expect(frameRole('tool_call')).toBe('assistant');
|
|
34
|
+
expect(frameRole('usage_update')).toBe('system');
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
describe('AcpFrameRecorder', () => {
|
|
39
|
+
test('stores the original payload and pages it newest first', async () => {
|
|
40
|
+
const recorder = new AcpFrameRecorder(() => SESSION);
|
|
41
|
+
recorder.record('session/update', {
|
|
42
|
+
sessionId: SESSION,
|
|
43
|
+
update: { sessionUpdate: 'user_message_chunk', content: { type: 'text', text: 'hello' } },
|
|
44
|
+
});
|
|
45
|
+
recorder.record('session/update', {
|
|
46
|
+
sessionId: SESSION,
|
|
47
|
+
update: { sessionUpdate: 'agent_message_chunk', content: { type: 'text', text: 'hi there' } },
|
|
48
|
+
});
|
|
49
|
+
recorder.record('session/update', {
|
|
50
|
+
sessionId: SESSION,
|
|
51
|
+
update: { sessionUpdate: 'usage_update', used: 1200, size: 200000, cost: { amount: 0.01, currency: 'USD' } },
|
|
52
|
+
});
|
|
53
|
+
await recorder.flush();
|
|
54
|
+
|
|
55
|
+
const page = await loadAcpFramesPage(SESSION, 1, 10, 'all', { modelId: 'claude/sonnet', cwd: '/tmp/p' });
|
|
56
|
+
expect(page.total).toBe(3);
|
|
57
|
+
expect(page.filteredTotal).toBe(3);
|
|
58
|
+
expect(page.items.map((item) => item.type)).toEqual(['usage_update', 'agent_message_chunk', 'user_message_chunk']);
|
|
59
|
+
|
|
60
|
+
const usage = page.items[0];
|
|
61
|
+
expect(usage.tokenSummary).toBe('1,200 / 200,000');
|
|
62
|
+
expect(usage.info.cost).toBe(0.01);
|
|
63
|
+
expect(usage.rawPayload).toEqual({
|
|
64
|
+
sessionId: SESSION,
|
|
65
|
+
update: { sessionUpdate: 'usage_update', used: 1200, size: 200000, cost: { amount: 0.01, currency: 'USD' } },
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const assistant = page.items[1];
|
|
69
|
+
expect(assistant.info.role).toBe('assistant');
|
|
70
|
+
expect(assistant.info.modelID).toBe('claude/sonnet');
|
|
71
|
+
expect(assistant.info.path).toEqual({ cwd: '/tmp/p', root: '/tmp/p' });
|
|
72
|
+
expect(assistant.badgeLabel).toBe('agent_message_chunk: hi there');
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('filters by role and pages without re-reading the payloads', async () => {
|
|
76
|
+
const recorder = new AcpFrameRecorder(() => SESSION);
|
|
77
|
+
for (let i = 0; i < 5; i += 1) {
|
|
78
|
+
recorder.record('session/update', {
|
|
79
|
+
sessionId: SESSION,
|
|
80
|
+
update: { sessionUpdate: i % 2 === 0 ? 'user_message_chunk' : 'agent_message_chunk', content: { type: 'text', text: `m${i}` } },
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
await recorder.flush();
|
|
84
|
+
|
|
85
|
+
const users = await loadAcpFramesPage(SESSION, 1, 10, 'user');
|
|
86
|
+
expect(users.total).toBe(5);
|
|
87
|
+
expect(users.filteredTotal).toBe(3);
|
|
88
|
+
expect(users.items.every((item) => item.info.role === 'user')).toBe(true);
|
|
89
|
+
|
|
90
|
+
const second = await loadAcpFramesPage(SESSION, 2, 2, 'all');
|
|
91
|
+
expect(second.items).toHaveLength(2);
|
|
92
|
+
expect(second.items.map((item) => item.type)).toEqual(['user_message_chunk', 'agent_message_chunk']);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test('a dispose flushes the buffered frames', async () => {
|
|
96
|
+
const recorder = new AcpFrameRecorder(() => SESSION);
|
|
97
|
+
recorder.record('session/update', {
|
|
98
|
+
sessionId: SESSION,
|
|
99
|
+
update: { sessionUpdate: 'agent_message_chunk', content: { type: 'text', text: 'last' } },
|
|
100
|
+
});
|
|
101
|
+
await recorder.dispose();
|
|
102
|
+
const page = await loadAcpFramesPage(SESSION, 1, 10, 'all');
|
|
103
|
+
expect(page.total).toBe(1);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The raw `session/update` frames an ACP session received, and the page the
|
|
8
|
+
* context panel's Raw Messages view reads.
|
|
9
|
+
*
|
|
10
|
+
* The transcript (`acp_transcripts`) is Kabmo's REFACTORED view: one row per
|
|
11
|
+
* message, tool calls folded in, chunks merged. The raw panel exists to show
|
|
12
|
+
* what the agent actually sent, so it reads these frames — the original ACP
|
|
13
|
+
* payloads — and never the fold. A frame is written once, in arrival order,
|
|
14
|
+
* with the `sessionUpdate` kind and the role it maps to denormalized so the
|
|
15
|
+
* panel can page and filter without parsing every payload.
|
|
16
|
+
*
|
|
17
|
+
* Writes are batched on the same debounce as the transcript recorder: a turn
|
|
18
|
+
* emits a frame per chunk, and one INSERT per chunk would put SQLite on the
|
|
19
|
+
* hot path of every token.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { getDb } from '@/server/db.server';
|
|
23
|
+
import type { RawMessageItem } from '@/shared/types/context';
|
|
24
|
+
|
|
25
|
+
const FLUSH_DEBOUNCE_MS = 250;
|
|
26
|
+
|
|
27
|
+
export type AcpFrameRole = 'user' | 'assistant' | 'system';
|
|
28
|
+
|
|
29
|
+
/** The role the panel's filter uses for one `sessionUpdate` kind. */
|
|
30
|
+
export function frameRole(kind: string): AcpFrameRole {
|
|
31
|
+
if (kind === 'user_message_chunk') return 'user';
|
|
32
|
+
if (
|
|
33
|
+
kind === 'agent_message_chunk' ||
|
|
34
|
+
kind === 'agent_thought_chunk' ||
|
|
35
|
+
kind === 'tool_call' ||
|
|
36
|
+
kind === 'tool_call_update'
|
|
37
|
+
) {
|
|
38
|
+
return 'assistant';
|
|
39
|
+
}
|
|
40
|
+
return 'system';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface BufferedFrame {
|
|
44
|
+
method: string;
|
|
45
|
+
kind: string;
|
|
46
|
+
role: AcpFrameRole;
|
|
47
|
+
payload: string;
|
|
48
|
+
createdAt: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** The text a frame carries, for the collapsed row's badge. */
|
|
52
|
+
function frameText(update: Record<string, unknown>): string {
|
|
53
|
+
const content = update.content;
|
|
54
|
+
if (content && typeof content === 'object' && !Array.isArray(content)) {
|
|
55
|
+
const text = (content as Record<string, unknown>).text;
|
|
56
|
+
if (typeof text === 'string') return text;
|
|
57
|
+
}
|
|
58
|
+
if (typeof update.title === 'string') return update.title;
|
|
59
|
+
if (typeof update.text === 'string') return update.text;
|
|
60
|
+
return '';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** One stored frame, in the shape the raw panel draws. */
|
|
64
|
+
function frameItem(
|
|
65
|
+
row: { id: number; method: string; kind: string; role: string; payload: string; created_at: number },
|
|
66
|
+
context: { modelId?: string; cwd?: string },
|
|
67
|
+
): RawMessageItem {
|
|
68
|
+
let params: Record<string, unknown> = {};
|
|
69
|
+
try {
|
|
70
|
+
const parsed: unknown = JSON.parse(row.payload);
|
|
71
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) params = parsed as Record<string, unknown>;
|
|
72
|
+
} catch {
|
|
73
|
+
params = {};
|
|
74
|
+
}
|
|
75
|
+
const update = params.update && typeof params.update === 'object' && !Array.isArray(params.update)
|
|
76
|
+
? (params.update as Record<string, unknown>)
|
|
77
|
+
: {};
|
|
78
|
+
const text = frameText(update);
|
|
79
|
+
const usage = row.kind === 'usage_update' ? update : null;
|
|
80
|
+
const used = usage && typeof usage.used === 'number' ? usage.used : 0;
|
|
81
|
+
const size = usage && typeof usage.size === 'number' ? usage.size : 0;
|
|
82
|
+
const cost = usage && usage.cost && typeof usage.cost === 'object' && typeof (usage.cost as Record<string, unknown>).amount === 'number'
|
|
83
|
+
? Number((usage.cost as Record<string, unknown>).amount)
|
|
84
|
+
: 0;
|
|
85
|
+
const timestamp = new Date(row.created_at).toLocaleString('en-US', {
|
|
86
|
+
month: 'numeric',
|
|
87
|
+
day: 'numeric',
|
|
88
|
+
hour: 'numeric',
|
|
89
|
+
minute: '2-digit',
|
|
90
|
+
hour12: true,
|
|
91
|
+
});
|
|
92
|
+
const role = row.role === 'user' || row.role === 'assistant' ? row.role : 'system';
|
|
93
|
+
return {
|
|
94
|
+
id: `frame-${row.id}`,
|
|
95
|
+
type: row.kind || row.method,
|
|
96
|
+
badgeLabel: `${row.kind || row.method}${text ? `: ${text.slice(0, 60)}` : ''}`,
|
|
97
|
+
tokenSummary: usage ? `${used.toLocaleString()} / ${size.toLocaleString()}` : '',
|
|
98
|
+
timestamp,
|
|
99
|
+
info: {
|
|
100
|
+
id: `frame-${row.id}`,
|
|
101
|
+
role,
|
|
102
|
+
modelID: context.modelId ?? '',
|
|
103
|
+
...(context.cwd ? { path: { cwd: context.cwd, root: context.cwd } } : {}),
|
|
104
|
+
cost,
|
|
105
|
+
tokens: { total: 0, input: 0, output: 0, reasoning: 0, cache: { write: 0, read: 0 } },
|
|
106
|
+
...(text ? { contentSnippet: text.slice(0, 200) } : {}),
|
|
107
|
+
timestamp,
|
|
108
|
+
},
|
|
109
|
+
rawPayload: params,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* One session's frame writer. `record` is called for every `session/update`
|
|
115
|
+
* the live session receives; `flush` runs on the debounce and on dispose.
|
|
116
|
+
*/
|
|
117
|
+
export class AcpFrameRecorder {
|
|
118
|
+
private readonly frames: BufferedFrame[] = [];
|
|
119
|
+
private timer: ReturnType<typeof setTimeout> | undefined;
|
|
120
|
+
private disposed = false;
|
|
121
|
+
|
|
122
|
+
constructor(private readonly sessionId: () => string) {}
|
|
123
|
+
|
|
124
|
+
record(method: string, params: Record<string, unknown>): void {
|
|
125
|
+
if (this.disposed) return;
|
|
126
|
+
const update = params.update;
|
|
127
|
+
const kind = update && typeof update === 'object' && !Array.isArray(update)
|
|
128
|
+
&& typeof (update as Record<string, unknown>).sessionUpdate === 'string'
|
|
129
|
+
? String((update as Record<string, unknown>).sessionUpdate)
|
|
130
|
+
: '';
|
|
131
|
+
this.frames.push({
|
|
132
|
+
method,
|
|
133
|
+
kind,
|
|
134
|
+
role: frameRole(kind),
|
|
135
|
+
payload: JSON.stringify(params),
|
|
136
|
+
createdAt: Date.now(),
|
|
137
|
+
});
|
|
138
|
+
this.schedule();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async flush(): Promise<void> {
|
|
142
|
+
if (this.frames.length === 0 || this.disposed) return;
|
|
143
|
+
const sessionId = this.sessionId();
|
|
144
|
+
if (!sessionId) return;
|
|
145
|
+
const rows = this.frames.splice(0);
|
|
146
|
+
try {
|
|
147
|
+
const db = await getDb();
|
|
148
|
+
await db.writeMany(
|
|
149
|
+
'INSERT INTO acp_frames (session_id, method, kind, role, payload, created_at) VALUES (?, ?, ?, ?, ?, ?)',
|
|
150
|
+
rows.map((row) => [sessionId, row.method, row.kind, row.role, row.payload, row.createdAt]),
|
|
151
|
+
);
|
|
152
|
+
} catch (error) {
|
|
153
|
+
// A failed write is not a lost turn: the next frame retries, and the
|
|
154
|
+
// transcript still holds the conversation.
|
|
155
|
+
this.frames.unshift(...rows);
|
|
156
|
+
console.error('[harness] could not record the ACP frames:', error);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
async dispose(): Promise<void> {
|
|
161
|
+
clearTimeout(this.timer);
|
|
162
|
+
this.timer = undefined;
|
|
163
|
+
await this.flush();
|
|
164
|
+
this.disposed = true;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
private schedule(): void {
|
|
168
|
+
if (this.timer !== undefined) return;
|
|
169
|
+
this.timer = setTimeout(() => {
|
|
170
|
+
this.timer = undefined;
|
|
171
|
+
void this.flush();
|
|
172
|
+
}, FLUSH_DEBOUNCE_MS);
|
|
173
|
+
this.timer.unref?.();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface AcpFramesPage {
|
|
178
|
+
items: RawMessageItem[];
|
|
179
|
+
total: number;
|
|
180
|
+
filteredTotal: number;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* One page of a session's raw frames, newest first. `role` filters on the
|
|
185
|
+
* denormalized column, so a page costs one indexed read rather than a parse of
|
|
186
|
+
* every payload.
|
|
187
|
+
*/
|
|
188
|
+
export async function loadAcpFramesPage(
|
|
189
|
+
sessionId: string,
|
|
190
|
+
page: number,
|
|
191
|
+
pageSize: number,
|
|
192
|
+
role: 'all' | 'assistant' | 'user',
|
|
193
|
+
context: { modelId?: string; cwd?: string } = {},
|
|
194
|
+
): Promise<AcpFramesPage> {
|
|
195
|
+
const db = await getDb();
|
|
196
|
+
const where = role === 'all' ? 'session_id = ?' : 'session_id = ? AND role = ?';
|
|
197
|
+
const params: (string | number)[] = role === 'all' ? [sessionId] : [sessionId, role];
|
|
198
|
+
const totalRow = await db.get<{ n: number }>('SELECT COUNT(*) AS n FROM acp_frames WHERE session_id = ?', [sessionId]);
|
|
199
|
+
const filteredRow = await db.get<{ n: number }>(`SELECT COUNT(*) AS n FROM acp_frames WHERE ${where}`, params);
|
|
200
|
+
const rows = await db.all<{
|
|
201
|
+
id: number;
|
|
202
|
+
method: string;
|
|
203
|
+
kind: string;
|
|
204
|
+
role: string;
|
|
205
|
+
payload: string;
|
|
206
|
+
created_at: number;
|
|
207
|
+
}>(
|
|
208
|
+
`SELECT id, method, kind, role, payload, created_at FROM acp_frames
|
|
209
|
+
WHERE ${where} ORDER BY id DESC LIMIT ? OFFSET ?`,
|
|
210
|
+
[...params, pageSize, (page - 1) * pageSize],
|
|
211
|
+
);
|
|
212
|
+
return {
|
|
213
|
+
items: rows.map((row) => frameItem(row, context)),
|
|
214
|
+
total: totalRow?.n ?? 0,
|
|
215
|
+
filteredTotal: filteredRow?.n ?? 0,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The ACP raw-message rows state what the transcript holds.
|
|
8
|
+
*
|
|
9
|
+
* The omp-shaped estimator this replaces invented a model id, a cwd and token
|
|
10
|
+
* counts from character lengths, so an opencode chat's raw panel claimed
|
|
11
|
+
* `deepseek/deepseek-v4-flash` and a `/Users/…/Workspace` path the agent never
|
|
12
|
+
* sent. These cases pin the honest fields: the row's own usage when present,
|
|
13
|
+
* zeros when not, and the row itself as `rawPayload`.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { describe, expect, test } from 'bun:test';
|
|
17
|
+
import { buildAcpRawMessages } from '@/server/lib/harness/acp/acp-raw-messages.server';
|
|
18
|
+
import type { ChatMessageData } from '@/shared/types/chat';
|
|
19
|
+
|
|
20
|
+
const user: ChatMessageData = {
|
|
21
|
+
id: 'u1',
|
|
22
|
+
role: 'user',
|
|
23
|
+
content: 'hello there',
|
|
24
|
+
startedAt: 1_700_000_000_000,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const assistant: ChatMessageData = {
|
|
28
|
+
id: 'a1',
|
|
29
|
+
role: 'assistant',
|
|
30
|
+
content: 'done',
|
|
31
|
+
model: 'opencode/hy4-flash-free',
|
|
32
|
+
startedAt: 1_700_000_001_000,
|
|
33
|
+
usage: { input: 120, output: 30, cacheRead: 10, totalTokens: 160, cost: { total: 0.002 } },
|
|
34
|
+
toolCalls: [{ id: 't1', type: 'bash', title: 'Run', name: 'bash' }],
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
describe('buildAcpRawMessages', () => {
|
|
38
|
+
test('keeps the row model and usage, and never invents a token count', () => {
|
|
39
|
+
const [first, second] = buildAcpRawMessages([user, assistant], { cwd: '/tmp/project' });
|
|
40
|
+
|
|
41
|
+
expect(first.info.modelID).toBe('');
|
|
42
|
+
expect(first.info.tokens).toEqual({ total: 0, input: 0, output: 0, reasoning: 0, cache: { write: 0, read: 0 } });
|
|
43
|
+
expect(first.tokenSummary).toBe('');
|
|
44
|
+
expect(first.info.path).toEqual({ cwd: '/tmp/project', root: '/tmp/project' });
|
|
45
|
+
|
|
46
|
+
expect(second.info.modelID).toBe('opencode/hy4-flash-free');
|
|
47
|
+
expect(second.info.tokens).toEqual({ total: 160, input: 120, output: 30, reasoning: 0, cache: { write: 0, read: 10 } });
|
|
48
|
+
expect(second.info.cost).toBe(0.002);
|
|
49
|
+
expect(second.tokenSummary).toBe('120 / 30');
|
|
50
|
+
expect(second.badgeLabel).toBe('text + bash');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('the raw payload is the stored row, not a synthesized omp entry', () => {
|
|
54
|
+
const [row] = buildAcpRawMessages([assistant]);
|
|
55
|
+
expect(row.rawPayload).toBe(assistant);
|
|
56
|
+
expect(row.rawPayload).not.toHaveProperty('info');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test('a row with no clock and no cwd leaves both empty', () => {
|
|
60
|
+
const [row] = buildAcpRawMessages([{ id: 'x', role: 'assistant', content: 'hi' }]);
|
|
61
|
+
expect(row.timestamp).toBe('');
|
|
62
|
+
expect(row.info.path).toBeUndefined();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('the context model fills a row that did not record one', () => {
|
|
66
|
+
const [row] = buildAcpRawMessages([user], { modelId: 'claude/sonnet' });
|
|
67
|
+
expect(row.info.modelID).toBe('claude/sonnet');
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The raw-message rows for an ACP chat.
|
|
8
|
+
*
|
|
9
|
+
* omp's raw panel reads its JSONL, where every entry carries the provider's own
|
|
10
|
+
* token counts, model id and cwd. An ACP agent writes no such file: Kabmo's
|
|
11
|
+
* transcript rows are the only record, and they carry a per-turn `usage` only
|
|
12
|
+
* when the agent reported one. This builder therefore states what the row
|
|
13
|
+
* actually holds and leaves the rest EMPTY — a fabricated model id or token
|
|
14
|
+
* count is worse than a blank, because the panel is the place a user goes to
|
|
15
|
+
* check what the agent really sent.
|
|
16
|
+
*
|
|
17
|
+
* `rawPayload` is the row itself, not a synthesized omp entry: the JSON viewer
|
|
18
|
+
* is the "raw" half of the panel, and it must show the data Kabmo stored.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import type { ChatMessageData } from '@/shared/types/chat';
|
|
22
|
+
import type { RawMessageItem } from '@/shared/types/context';
|
|
23
|
+
|
|
24
|
+
const ZERO_TOKENS = {
|
|
25
|
+
total: 0,
|
|
26
|
+
input: 0,
|
|
27
|
+
output: 0,
|
|
28
|
+
reasoning: 0,
|
|
29
|
+
cache: { write: 0, read: 0 },
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** The row's own clock, in the panel's short form. */
|
|
33
|
+
function timestampOf(row: ChatMessageData): string {
|
|
34
|
+
if (row.date) return row.date;
|
|
35
|
+
if (row.timestamp) return row.timestamp;
|
|
36
|
+
if (typeof row.startedAt === 'number' && row.startedAt > 0) {
|
|
37
|
+
return new Date(row.startedAt).toLocaleString('en-US', {
|
|
38
|
+
month: 'numeric',
|
|
39
|
+
day: 'numeric',
|
|
40
|
+
hour: 'numeric',
|
|
41
|
+
minute: '2-digit',
|
|
42
|
+
hour12: true,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return '';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** The badge the collapsed row draws: what this turn actually contains. */
|
|
49
|
+
function badgeOf(row: ChatMessageData): { type: string; badgeLabel: string } {
|
|
50
|
+
if (row.role === 'user') {
|
|
51
|
+
const snippet = row.content.slice(0, 70);
|
|
52
|
+
return {
|
|
53
|
+
type: 'user',
|
|
54
|
+
badgeLabel: `user: ${snippet}${row.content.length > 70 ? '...' : ''}`,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const parts: string[] = [];
|
|
58
|
+
if (row.thinking) parts.push('reasoning');
|
|
59
|
+
if (row.content) parts.push('text');
|
|
60
|
+
for (const call of row.toolCalls ?? []) {
|
|
61
|
+
const name = call.name || call.type;
|
|
62
|
+
if (name && !parts.includes(name)) parts.push(name);
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
type: parts.join('_') || 'text',
|
|
66
|
+
badgeLabel: parts.join(' + ') || 'text',
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface AcpRawMessageContext {
|
|
71
|
+
/** The model the session ran, when Kabmo recorded one. */
|
|
72
|
+
modelId?: string;
|
|
73
|
+
/** The session's working directory, when the record has one. */
|
|
74
|
+
cwd?: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* One `RawMessageItem` per stored row, oldest first (the route pages and
|
|
79
|
+
* reverses for display, exactly like the omp path).
|
|
80
|
+
*/
|
|
81
|
+
export function buildAcpRawMessages(
|
|
82
|
+
messages: readonly ChatMessageData[],
|
|
83
|
+
context: AcpRawMessageContext = {},
|
|
84
|
+
): RawMessageItem[] {
|
|
85
|
+
return messages.map((row, index) => {
|
|
86
|
+
const role: 'user' | 'assistant' = row.role === 'user' ? 'user' : 'assistant';
|
|
87
|
+
const { type, badgeLabel } = badgeOf(row);
|
|
88
|
+
const usage = row.usage;
|
|
89
|
+
const tokens = usage
|
|
90
|
+
? {
|
|
91
|
+
total: usage.totalTokens ?? 0,
|
|
92
|
+
input: usage.input ?? 0,
|
|
93
|
+
output: usage.output ?? 0,
|
|
94
|
+
reasoning: usage.reasoningTokens ?? 0,
|
|
95
|
+
cache: { write: usage.cacheWrite ?? 0, read: usage.cacheRead ?? 0 },
|
|
96
|
+
}
|
|
97
|
+
: { ...ZERO_TOKENS, cache: { ...ZERO_TOKENS.cache } };
|
|
98
|
+
const cost = usage?.cost?.total ?? 0;
|
|
99
|
+
const timestamp = timestampOf(row);
|
|
100
|
+
const modelId = row.model || context.modelId || '';
|
|
101
|
+
const toolNames = (row.toolCalls ?? []).map((call) => call.name || call.type).filter(Boolean);
|
|
102
|
+
const info = {
|
|
103
|
+
id: row.id,
|
|
104
|
+
...(index > 0 ? { parentID: messages[index - 1].id } : {}),
|
|
105
|
+
role,
|
|
106
|
+
modelID: modelId,
|
|
107
|
+
...(context.cwd ? { path: { cwd: context.cwd, root: context.cwd } } : {}),
|
|
108
|
+
cost,
|
|
109
|
+
tokens,
|
|
110
|
+
...(row.content ? { contentSnippet: row.content.slice(0, 200) } : {}),
|
|
111
|
+
...(toolNames.length > 0 ? { toolSummary: toolNames.join(', ') } : {}),
|
|
112
|
+
...(timestamp ? { timestamp } : {}),
|
|
113
|
+
};
|
|
114
|
+
return {
|
|
115
|
+
id: row.id,
|
|
116
|
+
type,
|
|
117
|
+
badgeLabel,
|
|
118
|
+
// ACP reports usage per SESSION, not per message. A row that carries its
|
|
119
|
+
// own usage prints it; every other row prints nothing rather than a
|
|
120
|
+
// number the agent never sent.
|
|
121
|
+
tokenSummary: tokens.input > 0 || tokens.output > 0
|
|
122
|
+
? `${tokens.input.toLocaleString()} / ${tokens.output.toLocaleString()}`
|
|
123
|
+
: '',
|
|
124
|
+
timestamp,
|
|
125
|
+
info,
|
|
126
|
+
rawPayload: row as unknown as Record<string, unknown>,
|
|
127
|
+
};
|
|
128
|
+
});
|
|
129
|
+
}
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
import type { SessionContextTelemetry } from '@/shared/types/context';
|
|
21
21
|
import { getDb } from '@/server/db.server';
|
|
22
|
+
import { getLiveSession, harnessOfSession } from '@/server/lib/omp/rpc/session-registry';
|
|
22
23
|
|
|
23
24
|
/** What the live session exposes for this bridge. */
|
|
24
25
|
export interface AcpTelemetrySession {
|
|
@@ -131,3 +132,21 @@ export function buildAcpTelemetry(
|
|
|
131
132
|
rawMessages: [],
|
|
132
133
|
};
|
|
133
134
|
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The ACP snapshot for one session: the live session's own counters when it is
|
|
138
|
+
* running, else the last usage it reported. `null` means this session has no
|
|
139
|
+
* ACP usage at all, and the caller must draw its empty state rather than an
|
|
140
|
+
* estimate — the omp-shaped estimator invents tokens and a model id.
|
|
141
|
+
*/
|
|
142
|
+
export async function acpTelemetryFor(
|
|
143
|
+
sessionId: string,
|
|
144
|
+
title: string | null | undefined,
|
|
145
|
+
): Promise<SessionContextTelemetry | null> {
|
|
146
|
+
const live = getLiveSession(sessionId);
|
|
147
|
+
if (live && harnessOfSession(live) !== 'omp-rpc') {
|
|
148
|
+
return buildAcpTelemetry(live as unknown as AcpTelemetrySession, title);
|
|
149
|
+
}
|
|
150
|
+
const stored = await loadAcpUsage(sessionId);
|
|
151
|
+
return stored ? buildAcpTelemetry(stored, title) : null;
|
|
152
|
+
}
|