@kabmo-labs/kabmo 0.32.1 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +542 -535
- package/dist/client/static/js/{CsvGrid-4gx0jevc.js → CsvGrid-fncjbg6j.js} +2 -2
- package/dist/client/static/js/{DocxView-0667nr8h.js → DocxView-c9v2vr3r.js} +2 -2
- package/dist/client/static/js/{DrawioView-522v0d0r.js → DrawioView-vxjksm12.js} +2 -2
- package/dist/client/static/js/{ImageView-t8xp60hm.js → ImageView-a3g5k226.js} +1 -1
- package/dist/client/static/js/LayoutWrapper-hnjfwsjh.js +2 -0
- package/dist/client/static/js/Modal-qtftcp2t.js +38 -0
- package/dist/client/static/js/{PdfView-3fx172xh.js → PdfView-ksaes53y.js} +1 -1
- package/dist/client/static/js/{SessionsView-n3agmf5t.js → SessionsView-30vcr95v.js} +1 -1
- package/dist/client/static/js/{SheetView-nmrdb1b8.js → SheetView-vc484scg.js} +6 -6
- package/dist/client/static/js/{SvgPreview-0xsc6xam.js → SvgPreview-tph89jet.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-jj31rs62.js → abnfDiagram-O67JEVCF-xbar278c.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-tavtgb8a.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-ay3yr7pf.js → architectureDiagram-NJMV4G6O-s171n2z6.js} +3 -3
- package/dist/client/static/js/{astro-qgx1r159.js → astro-80bs6hvg.js} +1 -1
- package/dist/client/static/js/bash-b3rwyg5p.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-4x33e16k.js → blockDiagram-BEXU5L5S-gzx6rv9n.js} +2 -2
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-dtb81cgz.js → c4Diagram-YGBWAQC7-7f00skch.js} +2 -2
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-vk5a2n9w.js → classDiagram-v2-NBCMYWYE-j79v95nc.js} +4 -4
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-6rbjbe19.js → cose-bilkent-JH36ORCC-5fkn7ee5.js} +1 -1
- package/dist/client/static/js/css-6vj0d308.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-cdh3n2z2.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-vyjksedr.js → cynefinDiagram-VND7K2PF-cfs1yvrd.js} +2 -2
- package/dist/client/static/js/{dagre-6A5THRUB-7hey38z5.js → dagre-6A5THRUB-44bgc48p.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-aes06jde.js → diagram-22UHCM2B-a4g4x83k.js} +14 -14
- package/dist/client/static/js/{diagram-3UASUU5V-3cfkgm3x.js → diagram-3UASUU5V-gm4rg5na.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-z8mfhwpy.js → diagram-ATOU4E4O-a95y41vk.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-t4821ctz.js → diagram-CDSNMT55-t3j93mmc.js} +5 -5
- package/dist/client/static/js/{diagram-MLGK6HIB-23yxbfrx.js → diagram-MLGK6HIB-c2wdez02.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-chhtf7v0.js → diagram-MPIPVDR6-gya9jhs5.js} +2 -2
- package/dist/client/static/js/{dockerfile-5b87ghm7.js → dockerfile-a7q6174s.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-9jejcvfr.js → ebnfDiagram-ZINNZB2B-jjhkza6t.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-xhhtkf58.js → elk-276RUBZZ-f7re45mw.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-mt2apjjb.js → erDiagram-OPXOYQCR-tpm9g5te.js} +6 -6
- package/dist/client/static/js/{erlang-6m6tpt72.js → erlang-qt876zrq.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-as97tpyp.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-ggm06d12.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-8cm7a29w.js → ganttDiagram-FUAMR5RP-fz43n12d.js} +3 -3
- package/dist/client/static/js/gitGraph-4MIJSDKK-eqz7p9ng.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-5s0gbnx2.js → gitGraphDiagram-X574FWY7-f61hgbn6.js} +9 -9
- package/dist/client/static/js/graphql-n43pd5fs.js +1 -0
- package/dist/client/static/js/{index-z5s27s26.js → index-03h3bkcf.js} +1 -1
- package/dist/client/static/js/{index-360d7j0d.js → index-0e40xskg.js} +1 -1
- package/dist/client/static/js/{index-z4v1xmh1.js → index-0n5wwe60.js} +2 -2
- package/dist/client/static/js/{index-pf7syd7t.js → index-0tf0arsp.js} +3 -3
- package/dist/client/static/js/{index-fdbfzshx.js → index-14vndmcr.js} +2 -2
- package/dist/client/static/js/{index-7n68yx6m.js → index-1a0zkj8h.js} +2 -2
- package/dist/client/static/js/{index-p7btwjvj.js → index-1xqs14fr.js} +3 -3
- package/dist/client/static/js/{index-brj8qwa6.js → index-1y9r4frb.js} +2 -2
- package/dist/client/static/js/{index-6q80csr0.js → index-2svnq5gg.js} +1 -1
- package/dist/client/static/js/{index-9sd0vjmh.js → index-2x5f66t6.js} +2 -2
- package/dist/client/static/js/{index-dt7e1328.js → index-354mqqra.js} +2 -2
- package/dist/client/static/js/{index-5x95n3hx.js → index-3rcjx70v.js} +1 -1
- package/dist/client/static/js/{index-532btjmp.js → index-3zc1b0dv.js} +2 -2
- package/dist/client/static/js/{index-wzma5n54.js → index-5tgq7aqx.js} +1 -1
- package/dist/client/static/js/{index-xya34x4v.js → index-76zb4m0n.js} +2 -2
- package/dist/client/static/js/{index-2xj14800.js → index-7y6rpsrp.js} +2 -2
- package/dist/client/static/js/{index-h06bcfds.js → index-8239j2v1.js} +1 -1
- package/dist/client/static/js/{index-dq1kdt03.js → index-9fjt5anh.js} +1 -1
- package/dist/client/static/js/{index-ehcpzk5b.js → index-9y3gjdj7.js} +1 -1
- package/dist/client/static/js/{index-sa9cp6km.js → index-ahv9y42z.js} +2 -2
- package/dist/client/static/js/{index-vd0e25p0.js → index-ajs3jj6j.js} +1 -1
- package/dist/client/static/js/{index-qnwqaczk.js → index-apvkd37e.js} +3 -3
- package/dist/client/static/js/index-at6bhjyf.js +1 -0
- package/dist/client/static/js/index-bkye8mz4.js +2 -0
- package/dist/client/static/js/{index-dnp07j57.js → index-d495kfm0.js} +1 -1
- package/dist/client/static/js/{index-gbfg0anm.js → index-dbe6afkf.js} +2 -2
- package/dist/client/static/js/{index-g33knza2.js → index-djmg1d7h.js} +1 -1
- package/dist/client/static/js/{index-629kfbcb.js → index-e4p4cd3r.js} +2 -2
- package/dist/client/static/js/{index-5y7c62sm.js → index-eyzeya95.js} +5 -5
- package/dist/client/static/js/{index-3vhznzgr.js → index-gcs49f3p.js} +1 -1
- package/dist/client/static/js/{index-59jb53v3.js → index-gs6f0qwa.js} +2 -2
- package/dist/client/static/js/{index-7fdp9c7m.js → index-hf52f59k.js} +2 -2
- package/dist/client/static/js/{index-qkscve6n.js → index-j0r5hj0j.js} +2 -2
- package/dist/client/static/js/{index-ay34b398.js → index-js7t1vb1.js} +17 -17
- package/dist/client/static/js/{index-a0bdavdr.js → index-km2zb6wk.js} +2 -2
- package/dist/client/static/js/{index-ye3sr7db.js → index-m73za75e.js} +2 -2
- package/dist/client/static/js/{index-kpspnztv.js → index-pbe4yed4.js} +2 -2
- package/dist/client/static/js/{index-a6k2hqke.js → index-pxv2nw9w.js} +1 -1
- package/dist/client/static/js/{index-jz9fpznk.js → index-q2w6s8n7.js} +5 -5
- package/dist/client/static/js/{index-h7pn9qw6.js → index-qckv9nte.js} +2 -2
- package/dist/client/static/js/{index-a733k69t.js → index-qsm2z36d.js} +2 -2
- package/dist/client/static/js/{index-pf5sbesf.js → index-rytaa8ca.js} +2 -2
- package/dist/client/static/js/{index-c0x6s6f7.js → index-sdtye3jy.js} +2 -2
- package/dist/client/static/js/index-sffjtm5w.js +12 -0
- package/dist/client/static/js/{index-ejgd8w3s.js → index-trm9x02n.js} +28 -28
- package/dist/client/static/js/{index-c93sp4yh.js → index-vw4brsdx.js} +1 -1
- package/dist/client/static/js/{index-hc2jmzpx.js → index-vw5k8csz.js} +46 -46
- package/dist/client/static/js/{index-2gfc25tq.js → index-w0fwb80e.js} +1 -1
- package/dist/client/static/js/{index-bbggh3f8.js → index-ypx3qmhq.js} +2 -2
- package/dist/client/static/js/{index-4s8ttfxj.js → index-zt75xpq0.js} +193 -193
- package/dist/client/static/js/{index-jppt5mgc.js → index-zvfvqvn9.js} +2 -2
- package/dist/client/static/js/info-A6RAGUB7-4pkzh1qx.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-3w1yz32c.js → infoDiagram-VRGFBTTK-1qj804sn.js} +1 -1
- package/dist/client/static/js/ini-j5dyq6gm.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-ckt471dy.js → ishikawaDiagram-OU5B5YK6-4j4qsnzw.js} +3 -3
- package/dist/client/static/js/java-g4dgwbfd.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-kfvn4w7e.js → journeyDiagram-ZHPQQLJL-j0brnfft.js} +4 -4
- package/dist/client/static/js/jsx-7t5ecz9s.js +1 -0
- package/dist/client/static/js/{julia-0j0gsjvc.js → julia-4ghmfy3e.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-0q36cm83.js → kanban-definition-PNTS6WVX-qqc22br0.js} +2 -2
- package/dist/client/static/js/lua-1g6w30de.js +1 -0
- package/dist/client/static/js/markdown-afx21x8c.js +1 -0
- package/dist/client/static/js/{mermaid.core-b1ssa824.js → mermaid.core-vv3wbe65.js} +6 -6
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-e2ym5en8.js → mindmap-definition-NLK3R4M7-y5b2z8zp.js} +2 -2
- package/dist/client/static/js/one-dark-pro-hm3f56n1.js +1 -0
- package/dist/client/static/js/one-light-xrz49rct.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-yg71sp88.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-t8bbdyhe.js → pegDiagram-GJSIUBJH-0be07mqs.js} +1 -1
- package/dist/client/static/js/{perl-7n7e9ncg.js → perl-sd00t4b4.js} +1 -1
- package/dist/client/static/js/{php-32vy69vd.js → php-2zfyqa61.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-89wd6np0.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-envv4brj.js → pieDiagram-5QR66LMP-544w86jk.js} +2 -2
- package/dist/client/static/js/properties-thd83wey.js +1 -0
- package/dist/client/static/js/python-264ns4xw.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-72rk137a.js → quadrantDiagram-O4NWA36T-p09e7z5s.js} +4 -4
- package/dist/client/static/js/r-qw82kkv9.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-avn0b8r9.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-de27xv5w.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-rg4zzj7x.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-d84fhj8v.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-dvf8xrmc.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-1ej0f5hr.js → railroadDiagram-XR7U4H2S-de830ed2.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-rvdaknpd.js → requirementDiagram-PLB6GJNP-b47d74p1.js} +4 -4
- package/dist/client/static/js/{ruby-5ty7fys7.js → ruby-v9qaqhby.js} +1 -1
- package/dist/client/static/js/{rust-2geezrcs.js → rust-fkt0qyrs.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-nxvhtdaw.js → sankeyDiagram-IPEJSGJF-6ezc2fpj.js} +5 -5
- package/dist/client/static/js/{sass-mey5150f.js → sass-9bxped7y.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-n5cn5qrt.js → sequenceDiagram-PO4LG4MO-by5zqj6w.js} +18 -18
- package/dist/client/static/js/{sizeCapture-INFHLROL-r074kj7s.js → sizeCapture-INFHLROL-q85r06j6.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-vxghxdb0.js → stateDiagram-v2-GCMORJYK-ep5pyexs.js} +3 -3
- package/dist/client/static/js/{svelte-3ewx0hzx.js → svelte-mwtx07d9.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-qkkv894p.js → swimlanes-2SLR337P-95fcqkh8.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-xs2en5dv.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-5tbq4ex2.js → timeline-definition-EJHVYXUP-461e615g.js} +2 -2
- package/dist/client/static/js/treeView-Q6P3EWNA-mham0bh6.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-mxrxax86.js +1 -0
- package/dist/client/static/js/tsx-nm94hed6.js +1 -0
- package/dist/client/static/js/typescript-0s2t05jj.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-6p8hf0b7.js → usecaseDiagram-POWQR4AR-ftqfnvhg.js} +37 -37
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-7k5jsxf9.js → vennDiagram-UO4OBE2U-7t96h6ez.js} +7 -7
- package/dist/client/static/js/{vue-06rdf4wh.js → vue-j8vb9d7r.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-8vrvh9p3.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-km2x4er8.js → wardleyDiagram-VNRHLVJA-0de8w8c6.js} +4 -4
- package/dist/client/static/js/xml-dz51p1m3.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-kr3sgr4m.js → xychartDiagram-PMCCYNJV-dez9phkf.js} +5 -5
- package/dist/client/static/js/yaml-2cfkd30t.js +1 -0
- package/package.json +1 -1
- package/src/client/components/common/context-usage-button/McpSection.test.tsx +98 -0
- package/src/client/components/common/context-usage-button/McpSection.tsx +12 -5
- package/src/client/components/common/context-usage-button/SessionStats.tsx +80 -0
- package/src/client/components/common/context-usage-button/index.test.tsx +26 -0
- package/src/client/components/common/context-usage-button/index.tsx +36 -28
- package/src/client/components/common/harness-glyph/brands.ts +8 -0
- package/src/client/components/mobile/LayoutWrapper.tsx +12 -3
- package/src/client/components/mobile/mobile-right-sidebar/FullDiff.tsx +9 -2
- package/src/client/components/settings/apply-side-effects.test.ts +11 -0
- package/src/client/components/settings/apply-side-effects.ts +7 -0
- package/src/client/components/settings/categories/ChatSettings.test.tsx +1 -1
- package/src/client/components/settings/categories/ChatSettings.tsx +2 -0
- package/src/client/components/settings/categories/NotificationSettings.tsx +1 -1
- package/src/client/components/settings/categories/chat-settings/ChangedFilesSection.tsx +79 -0
- package/src/client/components/settings/categories/chat-settings/groups.ts +4 -3
- package/src/client/components/workspace/chat-timeline/ChangedFilesSummary.tsx +101 -0
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +33 -1
- package/src/client/components/workspace/chat-timeline/RunFooter.tsx +21 -1
- package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +13 -0
- package/src/client/components/workspace/chat-timeline/index.tsx +1 -1
- package/src/client/components/workspace/diff-panel/Toolbar.tsx +17 -51
- package/src/client/components/workspace/diff-panel/index.tsx +23 -4
- package/src/client/components/workspace/diff-panel/toolbar-git-actions.tsx +94 -0
- package/src/client/components/workspace/editor/Body.tsx +2 -0
- package/src/client/data/settings/omp-schema.json +73 -3
- package/src/client/hooks/chat/timeline/changed-files-setting.test.ts +31 -0
- package/src/client/hooks/chat/timeline/changed-files-setting.ts +60 -0
- package/src/client/hooks/chat/timeline/session-changes.ts +51 -0
- package/src/client/hooks/ui/notification-events.test.ts +3 -0
- package/src/client/hooks/ui/notification-events.ts +3 -1
- package/src/client/hooks/ui/notification-sound.ts +13 -6
- package/src/client/hooks/ui/ui-sounds.test.ts +15 -0
- package/src/client/hooks/workspace/diff-file.ts +11 -4
- package/src/client/hooks/workspace/file-tabs.ts +13 -4
- package/src/client/hooks/workspace/journal-diff.ts +97 -0
- package/src/client/lib/notifications/native-banner-sound.test.ts +93 -0
- package/src/client/lib/notifications/native-banner-sound.ts +46 -0
- package/src/client/lib/notifications/os.test.ts +14 -5
- package/src/client/lib/notifications/os.ts +8 -0
- package/src/server/lib/harness/launch-table.ts +10 -0
- package/src/server/lib/omp/session/changes.test.ts +138 -0
- package/src/server/lib/omp/session/changes.ts +220 -0
- package/src/server/lib/omp/session/session-discovery.test.ts +4 -4
- package/src/server/lib/omp/session/sidebar-activity.server.test.ts +6 -2
- package/src/server/lib/omp/session/subagent-presence-scan.ts +54 -0
- package/src/server/lib/omp/session/subagent-presence-store.test.ts +1 -1
- package/src/server/lib/omp/session/subagent-presence.test.ts +115 -0
- package/src/server/lib/omp/session/subagent-presence.ts +12 -3
- package/src/server/lib/omp/session/telemetry/compute.ts +68 -0
- package/src/server/lib/omp/session/telemetry.test.ts +81 -0
- package/src/server/routes/sessions/changes.test.ts +90 -0
- package/src/server/routes/sessions/changes.ts +55 -0
- package/src/server/routes/sessions/index.ts +6 -0
- package/src/shared/lib/chat/duration.ts +34 -0
- package/src/shared/lib/chat/timeline/changed-files.test.ts +121 -0
- package/src/shared/lib/chat/timeline/changed-files.ts +71 -0
- package/src/shared/lib/chat/timeline/fork-anchor.test.ts +3 -0
- package/src/shared/lib/format/duration.test.ts +31 -0
- package/src/shared/lib/format/duration.ts +27 -0
- package/src/shared/lib/fs/unified-diff.test.ts +53 -0
- package/src/shared/lib/fs/unified-diff.ts +127 -0
- package/src/shared/lib/harness/brand-color.ts +3 -0
- package/src/shared/lib/harness/catalog.test.ts +13 -0
- package/src/shared/lib/harness/catalog.ts +8 -1
- package/src/shared/lib/harness/fork.ts +4 -2
- package/src/shared/lib/harness/mcp-facts.ts +3 -0
- package/src/shared/lib/harness/provider-facts.ts +14 -0
- package/src/shared/lib/harness/updates.ts +5 -0
- package/src/shared/lib/icons/tint-hues.generated.ts +27 -27
- package/src/shared/lib/omp/config/schema.test.ts +4 -2
- package/src/shared/lib/settings/defaults.ts +1 -0
- package/src/shared/lib/workspace/file-tab-id.ts +9 -0
- package/src/shared/types/context.ts +18 -0
- package/src/shared/types/fs.ts +21 -0
- package/src/shared/types/index.ts +1 -0
- package/src/shared/types/omp/session.ts +6 -0
- package/src/shared/types/session-changes.ts +58 -0
- package/src/shared/types/settings/state.ts +8 -0
- package/dist/client/static/js/LayoutWrapper-xjnveecv.js +0 -2
- package/dist/client/static/js/Modal-k2jr9hc4.js +0 -38
- package/dist/client/static/js/architecture-7GRP2DOG-1y9zvsyt.js +0 -1
- package/dist/client/static/js/bash-m0qjsyy0.js +0 -1
- package/dist/client/static/js/css-t4ngafan.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-k2188qcq.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-pdr0qn0n.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-zvz0mxne.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-wmqf046s.js +0 -1
- package/dist/client/static/js/graphql-692h0n2x.js +0 -1
- package/dist/client/static/js/index-61tm0v57.js +0 -1
- package/dist/client/static/js/index-kg86e3sy.js +0 -12
- package/dist/client/static/js/index-nmmxb4va.js +0 -2
- package/dist/client/static/js/info-A6RAGUB7-zg3twte6.js +0 -1
- package/dist/client/static/js/ini-cg0a5wm3.js +0 -1
- package/dist/client/static/js/java-vcck089n.js +0 -1
- package/dist/client/static/js/jsx-ht9zyzwa.js +0 -1
- package/dist/client/static/js/lua-ke895s2q.js +0 -1
- package/dist/client/static/js/markdown-gwmsh53r.js +0 -1
- package/dist/client/static/js/one-dark-pro-4geyzhjj.js +0 -1
- package/dist/client/static/js/one-light-tqssjm9t.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-3pav51g0.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-wqfh7zdk.js +0 -1
- package/dist/client/static/js/properties-mzvvbqg5.js +0 -1
- package/dist/client/static/js/python-3w64wsyd.js +0 -1
- package/dist/client/static/js/r-32re2zwb.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-w7qjdr2g.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-rhr99kkj.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-c4jeea3m.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-x2ee66ex.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-yw8wjfwg.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-y81h9n27.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-ekz05ccs.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-aq6qymjr.js +0 -1
- package/dist/client/static/js/tsx-0p183w2f.js +0 -1
- package/dist/client/static/js/typescript-t9a5jyvv.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-z34tj4y3.js +0 -1
- package/dist/client/static/js/xml-81hxjjt4.js +0 -1
- package/dist/client/static/js/yaml-yssayv8a.js +0 -1
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Read one session's agent change journal (`changes.jsonl`) and the blobs it
|
|
8
|
+
* points at.
|
|
9
|
+
*
|
|
10
|
+
* omp writes the journal beside the session file — `<sessionFile minus
|
|
11
|
+
* .jsonl>/changes.jsonl`, with content-addressed gzip blobs under `blobs/` —
|
|
12
|
+
* from 18.20.1 on. Each `change` record is one edit-tool write: the absolute
|
|
13
|
+
* path, the agent, the tool, and the content before and after as blob keys
|
|
14
|
+
* (`null` = the file did not exist / was deleted, `undefined` = not stored
|
|
15
|
+
* because it exceeded 8 MB).
|
|
16
|
+
*
|
|
17
|
+
* Two reads sit on top:
|
|
18
|
+
*
|
|
19
|
+
* - {@link readSessionChangeIndex} — every record, with a display path, for
|
|
20
|
+
* the chat's per-run file list. No blob content, so it stays small.
|
|
21
|
+
* - {@link readSessionChangeDiff} — the net change of one path inside one
|
|
22
|
+
* run window: the first record's `before` and the last record's `after`.
|
|
23
|
+
*
|
|
24
|
+
* The journal is append-only and can grow to megabytes, so the parse is cached
|
|
25
|
+
* by size+mtime (the same rule `plans.ts` follows). A session with no journal
|
|
26
|
+
* (older omp, or no artifacts directory) answers an empty list, never an error.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { stat } from 'node:fs/promises';
|
|
30
|
+
import type { Stats } from 'node:fs';
|
|
31
|
+
import path from 'node:path';
|
|
32
|
+
import { readRawHeaderLine } from '@/server/lib/omp/session/files';
|
|
33
|
+
import { findSessionFileById } from '@/server/lib/omp/session/locator';
|
|
34
|
+
import { siblingDirForSession } from '@/server/lib/omp/subagent/history/paths';
|
|
35
|
+
import { unifiedDiff } from '@/shared/lib/fs/unified-diff';
|
|
36
|
+
import type { SessionChangeDiff, SessionChangeRecord } from '@/shared/types/session-changes';
|
|
37
|
+
|
|
38
|
+
const JOURNAL_FILE = 'changes.jsonl';
|
|
39
|
+
const BLOB_DIR = 'blobs';
|
|
40
|
+
|
|
41
|
+
/** One raw `change` line, before the display path is resolved. */
|
|
42
|
+
interface RawChangeRecord {
|
|
43
|
+
at: number;
|
|
44
|
+
agent: string;
|
|
45
|
+
parent?: string;
|
|
46
|
+
tool: string;
|
|
47
|
+
path: string;
|
|
48
|
+
before: string | null | undefined;
|
|
49
|
+
after: string | null | undefined;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface JournalCacheEntry {
|
|
53
|
+
size: number;
|
|
54
|
+
mtimeMs: number;
|
|
55
|
+
dir: string;
|
|
56
|
+
cwd: string | null;
|
|
57
|
+
records: RawChangeRecord[];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
interface JournalCacheHost {
|
|
61
|
+
entries: Map<string, JournalCacheEntry>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare global {
|
|
65
|
+
// eslint-disable-next-line no-var
|
|
66
|
+
var __kabmoSessionChanges: JournalCacheHost | undefined;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function cache(): JournalCacheHost {
|
|
70
|
+
if (!globalThis.__kabmoSessionChanges) globalThis.__kabmoSessionChanges = { entries: new Map() };
|
|
71
|
+
return globalThis.__kabmoSessionChanges;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* `path` relative to the session cwd when it is inside it, else unchanged.
|
|
76
|
+
*
|
|
77
|
+
* The relative branch is a display path, not a filesystem one, so its separator
|
|
78
|
+
* is normalised to `/`: Windows' `path.relative` answers `src\a.ts`, which the
|
|
79
|
+
* chat list and the diff header would otherwise show beside forward-slash paths
|
|
80
|
+
* from every other producer.
|
|
81
|
+
*/
|
|
82
|
+
function displayPathFor(absolute: string, cwd: string | null): string {
|
|
83
|
+
if (!cwd) return absolute;
|
|
84
|
+
const relative = path.relative(cwd, absolute);
|
|
85
|
+
if (!relative || relative.startsWith('..') || path.isAbsolute(relative)) return absolute;
|
|
86
|
+
return relative.replaceAll('\\', '/');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Parse the journal's `change` lines; a torn final line is skipped, not fatal. */
|
|
90
|
+
function parseJournal(text: string): RawChangeRecord[] {
|
|
91
|
+
const records: RawChangeRecord[] = [];
|
|
92
|
+
for (const line of text.split('\n')) {
|
|
93
|
+
if (!line) continue;
|
|
94
|
+
try {
|
|
95
|
+
const record = JSON.parse(line) as Record<string, unknown>;
|
|
96
|
+
if (record?.type !== 'change') continue;
|
|
97
|
+
if (typeof record.at !== 'number' || typeof record.path !== 'string') continue;
|
|
98
|
+
if (typeof record.agent !== 'string' || typeof record.tool !== 'string') continue;
|
|
99
|
+
records.push({
|
|
100
|
+
at: record.at,
|
|
101
|
+
agent: record.agent,
|
|
102
|
+
...(typeof record.parent === 'string' ? { parent: record.parent } : {}),
|
|
103
|
+
tool: record.tool,
|
|
104
|
+
path: record.path,
|
|
105
|
+
before: record.before as string | null | undefined,
|
|
106
|
+
after: record.after as string | null | undefined,
|
|
107
|
+
});
|
|
108
|
+
} catch {
|
|
109
|
+
// A torn final line from a crash mid-append; earlier records stay valid.
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return records;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** The session's journal, cached by size+mtime; `null` when it has none. */
|
|
116
|
+
async function readJournal(sessionId: string): Promise<JournalCacheEntry | null> {
|
|
117
|
+
const sessionFile = await findSessionFileById(sessionId);
|
|
118
|
+
if (!sessionFile) return null;
|
|
119
|
+
const dir = siblingDirForSession(sessionFile);
|
|
120
|
+
const journalPath = path.join(dir, JOURNAL_FILE);
|
|
121
|
+
let info: Stats;
|
|
122
|
+
try {
|
|
123
|
+
info = await stat(journalPath);
|
|
124
|
+
} catch {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
const cached = cache().entries.get(sessionId);
|
|
128
|
+
if (cached && cached.size === info.size && cached.mtimeMs === info.mtimeMs) return cached;
|
|
129
|
+
|
|
130
|
+
const text = await Bun.file(journalPath).text();
|
|
131
|
+
const header = await readRawHeaderLine(sessionFile).catch(() => null);
|
|
132
|
+
const cwd = header && typeof header.cwd === 'string' ? header.cwd : null;
|
|
133
|
+
const entry: JournalCacheEntry = {
|
|
134
|
+
size: info.size,
|
|
135
|
+
mtimeMs: info.mtimeMs,
|
|
136
|
+
dir,
|
|
137
|
+
cwd,
|
|
138
|
+
records: parseJournal(text),
|
|
139
|
+
};
|
|
140
|
+
cache().entries.set(sessionId, entry);
|
|
141
|
+
return entry;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** Blob content for a key; `null` = absent file, `undefined` = not stored/missing. */
|
|
145
|
+
async function resolveBlob(dir: string, key: string | null | undefined): Promise<string | null | undefined> {
|
|
146
|
+
if (key === null) return null;
|
|
147
|
+
if (key === undefined) return undefined;
|
|
148
|
+
try {
|
|
149
|
+
const bytes = await Bun.file(path.join(dir, BLOB_DIR, key)).bytes();
|
|
150
|
+
return new TextDecoder().decode(Bun.gunzipSync(bytes));
|
|
151
|
+
} catch {
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** Every change record of one session, oldest first, with display paths. */
|
|
157
|
+
export async function readSessionChangeIndex(sessionId: string): Promise<SessionChangeRecord[]> {
|
|
158
|
+
const journal = await readJournal(sessionId);
|
|
159
|
+
if (!journal) return [];
|
|
160
|
+
return journal.records.map((record) => ({
|
|
161
|
+
at: record.at,
|
|
162
|
+
agent: record.agent,
|
|
163
|
+
...(record.parent ? { parent: record.parent } : {}),
|
|
164
|
+
tool: record.tool,
|
|
165
|
+
path: record.path,
|
|
166
|
+
displayPath: displayPathFor(record.path, journal.cwd),
|
|
167
|
+
before: record.before,
|
|
168
|
+
after: record.after,
|
|
169
|
+
}));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The net change of `absolutePath` inside `[from, to]`: the first record's
|
|
174
|
+
* `before` and the last record's `after`. `null` when the path has no record in
|
|
175
|
+
* the range.
|
|
176
|
+
*/
|
|
177
|
+
export async function readSessionChangeDiff(
|
|
178
|
+
sessionId: string,
|
|
179
|
+
absolutePath: string,
|
|
180
|
+
from: number,
|
|
181
|
+
to: number,
|
|
182
|
+
): Promise<SessionChangeDiff | null> {
|
|
183
|
+
const journal = await readJournal(sessionId);
|
|
184
|
+
if (!journal) return null;
|
|
185
|
+
const inRange = journal.records
|
|
186
|
+
.filter((record) => record.path === absolutePath && record.at >= from && record.at <= to)
|
|
187
|
+
.sort((a, b) => a.at - b.at);
|
|
188
|
+
if (inRange.length === 0) return null;
|
|
189
|
+
|
|
190
|
+
const first = inRange[0];
|
|
191
|
+
const last = inRange[inRange.length - 1];
|
|
192
|
+
const displayPath = displayPathFor(absolutePath, journal.cwd);
|
|
193
|
+
const status = first.before === null ? 'added' : last.after === null ? 'deleted' : 'modified';
|
|
194
|
+
const [before, after] = await Promise.all([
|
|
195
|
+
resolveBlob(journal.dir, first.before),
|
|
196
|
+
resolveBlob(journal.dir, last.after),
|
|
197
|
+
]);
|
|
198
|
+
if (before === undefined || after === undefined) {
|
|
199
|
+
return {
|
|
200
|
+
path: absolutePath,
|
|
201
|
+
displayPath,
|
|
202
|
+
status,
|
|
203
|
+
oldContent: '',
|
|
204
|
+
newContent: '',
|
|
205
|
+
diff: '',
|
|
206
|
+
unavailable: true,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
const oldContent = before ?? '';
|
|
210
|
+
const newContent = after ?? '';
|
|
211
|
+
return {
|
|
212
|
+
path: absolutePath,
|
|
213
|
+
displayPath,
|
|
214
|
+
status,
|
|
215
|
+
oldContent,
|
|
216
|
+
newContent,
|
|
217
|
+
diff: unifiedDiff(displayPath, oldContent, newContent),
|
|
218
|
+
unavailable: false,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
@@ -212,8 +212,9 @@ describe('sessionHasSubagents', () => {
|
|
|
212
212
|
test('a sibling artifacts directory holding a transcript reports subagents', async () => {
|
|
213
213
|
const dir = tempDir('sub');
|
|
214
214
|
const file = writeSessionFile(join(dir, 'parent.jsonl'), [header('parent')]);
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
// A subagent transcript is a session file whose header names its parent;
|
|
216
|
+
// an empty `.jsonl` (or `changes.jsonl`) is not one.
|
|
217
|
+
writeSessionFile(join(dir, 'parent', 'AlphaBeta.jsonl'), [header('child', { parentSession: file })]);
|
|
217
218
|
expect(await sessionHasSubagents(file, '2026-09-01T00:00:00.000Z')).toBe(true);
|
|
218
219
|
});
|
|
219
220
|
|
|
@@ -237,8 +238,7 @@ describe('sessionHasSubagents', () => {
|
|
|
237
238
|
const dir = tempDir('sub');
|
|
238
239
|
const file = writeSessionFile(join(dir, 'parent.jsonl'), [header('parent')]);
|
|
239
240
|
const sibling = join(dir, 'parent');
|
|
240
|
-
|
|
241
|
-
fs.writeFileSync(join(sibling, 'AlphaBeta.jsonl'), '');
|
|
241
|
+
writeSessionFile(join(sibling, 'AlphaBeta.jsonl'), [header('child', { parentSession: file })]);
|
|
242
242
|
expect(await sessionHasSubagents(file, '2026-09-01T00:00:00.000Z')).toBe(true);
|
|
243
243
|
// Same last-entry timestamp, but the sibling dir is gone: the version
|
|
244
244
|
// changed, so the cached answer must not survive.
|
|
@@ -81,11 +81,15 @@ function writeSession(agentDir: string, fixture: SessionFixture): string {
|
|
|
81
81
|
|
|
82
82
|
if (fixture.subagents?.length) {
|
|
83
83
|
// A sibling directory named after the session file, holding one .jsonl per
|
|
84
|
-
// subagent — the shape `sessionHasSubagents` reads.
|
|
84
|
+
// subagent — the shape `sessionHasSubagents` reads. The header must name
|
|
85
|
+
// its parent: a bare `.jsonl` is not a subagent transcript.
|
|
85
86
|
const sibling = file.replace(/\.jsonl$/, '');
|
|
86
87
|
fs.mkdirSync(sibling, { recursive: true });
|
|
87
88
|
for (const id of fixture.subagents) {
|
|
88
|
-
fs.writeFileSync(
|
|
89
|
+
fs.writeFileSync(
|
|
90
|
+
path.join(sibling, `${id}.jsonl`),
|
|
91
|
+
`${JSON.stringify({ type: 'session', id, cwd: '/tmp/project', parentSession: file })}\n`,
|
|
92
|
+
);
|
|
89
93
|
}
|
|
90
94
|
}
|
|
91
95
|
clearSessionFileCaches();
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
* could not have matched.
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
|
+
import { join } from 'path';
|
|
34
35
|
import { isRecord } from '@/shared/lib/util/guards';
|
|
35
36
|
import { parseSubagentProgress } from '@/shared/lib/omp/subagent/parse';
|
|
36
37
|
import { SUBAGENT_ID_RE } from '@/server/lib/omp/subagent/history/paths';
|
|
@@ -117,4 +118,57 @@ export async function sessionFileHasSubagents(filePath: string): Promise<boolean
|
|
|
117
118
|
}
|
|
118
119
|
pending += decoder.decode();
|
|
119
120
|
return lineAdmitsSubagent(pending.trim());
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Enough of a transcript to hold its title and session header lines. */
|
|
124
|
+
const TRANSCRIPT_HEADER_BYTES = 8 * 1024;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Whether one sibling artifact is a SUBAGENT transcript.
|
|
128
|
+
*
|
|
129
|
+
* The sibling directory also holds omp's own per-session artifacts —
|
|
130
|
+
* `changes.jsonl` (the tool-call log), `blobs/`, `*.bash.log` — and
|
|
131
|
+
* `changes.jsonl` ends in `.jsonl` exactly like a subagent transcript does.
|
|
132
|
+
* Counting it made every session that ran a tool claim a subagent, so the row
|
|
133
|
+
* drew a chevron whose branch was empty: the roster is derived from the
|
|
134
|
+
* parent's `task` toolResults, and there are none.
|
|
135
|
+
*
|
|
136
|
+
* A subagent transcript is a session file whose header names its parent, so the
|
|
137
|
+
* test is that header — not the extension, and not a substring of the body
|
|
138
|
+
* (a bash label can quote `parentSession`).
|
|
139
|
+
*/
|
|
140
|
+
async function isSubagentTranscript(filePath: string): Promise<boolean> {
|
|
141
|
+
try {
|
|
142
|
+
const head = await Bun.file(filePath).slice(0, TRANSCRIPT_HEADER_BYTES).text();
|
|
143
|
+
for (const line of head.split('\n')) {
|
|
144
|
+
if (line.length === 0) continue;
|
|
145
|
+
let parsed: unknown;
|
|
146
|
+
try {
|
|
147
|
+
parsed = JSON.parse(line);
|
|
148
|
+
} catch {
|
|
149
|
+
// A torn first line is not a header; keep looking at the next one.
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
if (!isRecord(parsed) || parsed.type !== 'session') continue;
|
|
153
|
+
return typeof parsed.parentSession === 'string' && parsed.parentSession.length > 0;
|
|
154
|
+
}
|
|
155
|
+
return false;
|
|
156
|
+
} catch {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* True when the sibling artifacts directory holds at least one subagent
|
|
163
|
+
* transcript. `files` is the directory listing the caller already read.
|
|
164
|
+
*/
|
|
165
|
+
export async function siblingDirHasSubagentTranscript(
|
|
166
|
+
dir: string,
|
|
167
|
+
files: readonly string[],
|
|
168
|
+
): Promise<boolean> {
|
|
169
|
+
for (const file of files) {
|
|
170
|
+
if (!file.endsWith('.jsonl')) continue;
|
|
171
|
+
if (await isSubagentTranscript(join(dir, file))) return true;
|
|
172
|
+
}
|
|
173
|
+
return false;
|
|
120
174
|
}
|
|
@@ -115,6 +115,6 @@ describe('saved presence verdict', () => {
|
|
|
115
115
|
await closeDb();
|
|
116
116
|
expect(await sessionHasSubagents(file, 'entry-1')).toBe(true);
|
|
117
117
|
// Asking the store again is a miss, not an error: no handle means no cache.
|
|
118
|
-
expect(await readPresenceVerdict(file, 'entry-1:0')).toBeNull();
|
|
118
|
+
expect(await readPresenceVerdict(file, 'v2:entry-1:0')).toBeNull();
|
|
119
119
|
});
|
|
120
120
|
});
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The presence badge must agree with the roster it opens.
|
|
8
|
+
*
|
|
9
|
+
* The sibling artifacts directory holds omp's own per-session files beside the
|
|
10
|
+
* subagent transcripts, and `changes.jsonl` (the tool-call log) ends in
|
|
11
|
+
* `.jsonl` like a transcript does. Counting it made every session that ran a
|
|
12
|
+
* tool draw a chevron whose branch was empty — the roster is derived from the
|
|
13
|
+
* parent's `task` toolResults, and there are none. These tests pin the rule
|
|
14
|
+
* that replaced the extension check:
|
|
15
|
+
*
|
|
16
|
+
* - a sibling `.jsonl` counts only when its header names a `parentSession`;
|
|
17
|
+
* - a `changes.jsonl` that merely QUOTES `parentSession` in a label does not;
|
|
18
|
+
* - a verdict saved under the old rule is not read back (the rule version is
|
|
19
|
+
* part of the cache key), so the phantom chevron clears on the next load.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
23
|
+
import fs from 'fs';
|
|
24
|
+
import { dirname, join } from 'path';
|
|
25
|
+
import { tmpdir } from 'node:os';
|
|
26
|
+
|
|
27
|
+
import { getDb } from '@/server/db.server';
|
|
28
|
+
import { isolateDb, releaseDb } from '@/test-support/isolated-db';
|
|
29
|
+
import { clearSubagentPresenceCache, sessionHasSubagents } from '@/server/lib/omp/session/subagent-presence';
|
|
30
|
+
import { writePresenceVerdict } from '@/server/lib/omp/session/subagent-presence-store';
|
|
31
|
+
|
|
32
|
+
const tempDirs: string[] = [];
|
|
33
|
+
|
|
34
|
+
function tempDir(): string {
|
|
35
|
+
const dir = fs.mkdtempSync(join(tmpdir(), 'presence-rule-'));
|
|
36
|
+
tempDirs.push(dir);
|
|
37
|
+
return dir;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function writeSession(name: string, lines: unknown[]): string {
|
|
41
|
+
const file = join(tempDir(), name);
|
|
42
|
+
fs.mkdirSync(dirname(file), { recursive: true });
|
|
43
|
+
fs.writeFileSync(file, `${lines.map((line) => JSON.stringify(line)).join('\n')}\n`);
|
|
44
|
+
return file;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function header(): Record<string, unknown> {
|
|
48
|
+
return { type: 'session', version: 3, id: 's1', cwd: '/tmp/proj', timestamp: '2026-09-01T00:00:00.000Z' };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function taskResult(): Record<string, unknown> {
|
|
52
|
+
return {
|
|
53
|
+
type: 'message',
|
|
54
|
+
timestamp: '2026-09-01T00:00:10.000Z',
|
|
55
|
+
message: { role: 'toolResult', toolName: 'task', details: { progress: [{ id: 'AlphaBeta', agent: 'task', status: 'running' }] } },
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function writeSibling(file: string, name: string, lines: unknown[]): void {
|
|
60
|
+
const dir = join(dirname(file), file.slice(dirname(file).length + 1, -'.jsonl'.length));
|
|
61
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
62
|
+
fs.writeFileSync(join(dir, name), `${lines.map((line) => JSON.stringify(line)).join('\n')}\n`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
beforeEach(async () => {
|
|
66
|
+
await isolateDb();
|
|
67
|
+
await getDb();
|
|
68
|
+
clearSubagentPresenceCache();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
afterEach(async () => {
|
|
72
|
+
clearSubagentPresenceCache();
|
|
73
|
+
await releaseDb();
|
|
74
|
+
for (const dir of tempDirs) fs.rmSync(dir, { recursive: true, force: true });
|
|
75
|
+
tempDirs.length = 0;
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
describe('subagent presence rule', () => {
|
|
79
|
+
test('a sibling changes.jsonl is not a subagent', async () => {
|
|
80
|
+
const file = writeSession('tool-run.jsonl', [header()]);
|
|
81
|
+
writeSibling(file, 'changes.jsonl', [
|
|
82
|
+
{ type: 'call', agent: 'Main', tool: 'bash', start: 1, end: 2, label: 'ls' },
|
|
83
|
+
]);
|
|
84
|
+
expect(await sessionHasSubagents(file, 'entry-1')).toBe(false);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('a changes.jsonl that quotes parentSession in a label is still not a subagent', async () => {
|
|
88
|
+
const file = writeSession('quoted.jsonl', [header()]);
|
|
89
|
+
writeSibling(file, 'changes.jsonl', [
|
|
90
|
+
{ type: 'call', agent: 'Main', tool: 'bash', start: 1, end: 2, label: 'rg "parentSession" src' },
|
|
91
|
+
]);
|
|
92
|
+
expect(await sessionHasSubagents(file, 'entry-1')).toBe(false);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test('a sibling transcript whose header names its parent is a subagent', async () => {
|
|
96
|
+
const file = writeSession('spawned.jsonl', [header()]);
|
|
97
|
+
writeSibling(file, 'AlphaBeta.jsonl', [
|
|
98
|
+
{ type: 'title', v: 1, title: '' },
|
|
99
|
+
{ type: 'session', version: 3, id: 'child', cwd: '/tmp/proj', parentSession: file },
|
|
100
|
+
]);
|
|
101
|
+
expect(await sessionHasSubagents(file, 'entry-1')).toBe(true);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test('a task toolResult in the parent transcript is still a subagent', async () => {
|
|
105
|
+
const file = writeSession('task-result.jsonl', [header(), taskResult()]);
|
|
106
|
+
expect(await sessionHasSubagents(file, 'entry-1')).toBe(true);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
test('a verdict saved under the old rule is not read back', async () => {
|
|
110
|
+
const file = writeSession('stale.jsonl', [header()]);
|
|
111
|
+
// The pre-v2 key: no rule version, and `true` from the changes.jsonl bug.
|
|
112
|
+
await writePresenceVerdict(file, 'entry-1:0', true);
|
|
113
|
+
expect(await sessionHasSubagents(file, 'entry-1')).toBe(false);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
*/
|
|
37
37
|
|
|
38
38
|
import { promises as fs, statSync } from 'fs';
|
|
39
|
-
import { sessionFileHasSubagents } from '@/server/lib/omp/session/subagent-presence-scan';
|
|
39
|
+
import { sessionFileHasSubagents, siblingDirHasSubagentTranscript } from '@/server/lib/omp/session/subagent-presence-scan';
|
|
40
40
|
import { readPresenceVerdict, writePresenceVerdict } from '@/server/lib/omp/session/subagent-presence-store';
|
|
41
41
|
import { siblingDirForSession } from '@/server/lib/omp/subagent/history/paths';
|
|
42
42
|
|
|
@@ -48,6 +48,15 @@ interface PresenceEntry {
|
|
|
48
48
|
/** Bounded so a long-lived server with many sessions cannot grow unbounded. */
|
|
49
49
|
const MAX_ENTRIES = 2_000;
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Bumped whenever the VERDICT RULE changes, so a verdict saved under the old
|
|
53
|
+
* rule is not read back. `v2`: a sibling `.jsonl` must be a subagent transcript
|
|
54
|
+
* (its header names a `parentSession`), not any artifact — `changes.jsonl` made
|
|
55
|
+
* every tool-running session claim a subagent, and the saved `true` outlived
|
|
56
|
+
* the code that produced it.
|
|
57
|
+
*/
|
|
58
|
+
const PRESENCE_RULE_VERSION = 'v2';
|
|
59
|
+
|
|
51
60
|
const cache = new Map<string, PresenceEntry>();
|
|
52
61
|
|
|
53
62
|
/** Record a verdict in the in-process map, evicting the oldest when full. */
|
|
@@ -103,7 +112,7 @@ export async function sessionHasSubagents(
|
|
|
103
112
|
): Promise<boolean> {
|
|
104
113
|
const siblingDir = siblingDirForSession(sessionPath);
|
|
105
114
|
const siblingMtime = siblingDirVersion(siblingDir);
|
|
106
|
-
const version = `${sessionLastEntryAt}:${siblingMtime}`;
|
|
115
|
+
const version = `${PRESENCE_RULE_VERSION}:${sessionLastEntryAt}:${siblingMtime}`;
|
|
107
116
|
|
|
108
117
|
const cached = cache.get(sessionPath);
|
|
109
118
|
if (cached && cached.version === version) return cached.hasSubagents;
|
|
@@ -122,7 +131,7 @@ export async function sessionHasSubagents(
|
|
|
122
131
|
if (siblingMtime !== 0) {
|
|
123
132
|
try {
|
|
124
133
|
const files = await fs.readdir(siblingDir);
|
|
125
|
-
hasSubagents =
|
|
134
|
+
hasSubagents = await siblingDirHasSubagentTranscript(siblingDir, files);
|
|
126
135
|
} catch {
|
|
127
136
|
hasSubagents = false;
|
|
128
137
|
}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { formatNewSessionTitle } from '@/shared/lib/omp/session/default-title';
|
|
2
2
|
import { contentProfile } from '@/shared/lib/omp/session/telemetry-blocks';
|
|
3
|
+
import { toEpochMs } from '@/shared/lib/omp/session/timestamps';
|
|
4
|
+
import { isRecord } from '@/shared/lib/util/guards';
|
|
3
5
|
import type { RawMessageItem, SessionContextTelemetry } from '@/shared/types/context';
|
|
4
6
|
import type { OmpMessageEntry, OmpUsage } from '@/shared/types/omp/session';
|
|
5
7
|
import { CONTEXT_LIMIT, buildInfo, contextAnchorTokens, emptyTelemetry, formatCost, formatTs, textOf, tokensOf } from '@/server/lib/omp/session/telemetry/format';
|
|
6
8
|
import { loadModelsWithCache } from '@/server/lib/models/registry.server';
|
|
7
9
|
import { scanSessionEntries } from '@/server/lib/omp/session/telemetry/scan';
|
|
8
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Below this a request's tokens/second is noise: a cached or instant response
|
|
13
|
+
* divides by almost nothing and reports an absurd rate. Same floor omp's own
|
|
14
|
+
* usage row applies (`pi-tui/overlays/usage-row.ts`).
|
|
15
|
+
*/
|
|
16
|
+
const MIN_RATE_DURATION_MS = 100;
|
|
17
|
+
|
|
9
18
|
/**
|
|
10
19
|
* Compute real `SessionContextTelemetry` for a session file (all-zero on
|
|
11
20
|
* unreadable/empty). `rawLimit` caps materialized raw items (0 = none): the
|
|
@@ -56,6 +65,17 @@ export async function computeRealSessionTelemetry(
|
|
|
56
65
|
let messagesCount = 0;
|
|
57
66
|
const rawMessages: RawMessageItem[] = [];
|
|
58
67
|
let cwd = '';
|
|
68
|
+
// Timing: `duration`/`ttft` are per assistant message; a tool call's span runs
|
|
69
|
+
// from its `tool_execution_start` entry to its `toolResult` timestamp. The
|
|
70
|
+
// join is the same one the chat reload path performs (messages-map.ts), so a
|
|
71
|
+
// call states one duration whichever surface reads it.
|
|
72
|
+
let llmDurationMs = 0;
|
|
73
|
+
let toolDurationMs = 0;
|
|
74
|
+
let ttftSum = 0;
|
|
75
|
+
let ttftCount = 0;
|
|
76
|
+
let lastOutputTokens = 0;
|
|
77
|
+
let lastDurationMs: number | undefined;
|
|
78
|
+
const toolStarts = new Map<string, number>();
|
|
59
79
|
|
|
60
80
|
await scanSessionEntries(filePath, (entry, index) => {
|
|
61
81
|
// Modern session files start with a fixed-width title slot line, so the
|
|
@@ -72,6 +92,17 @@ export async function computeRealSessionTelemetry(
|
|
|
72
92
|
return;
|
|
73
93
|
}
|
|
74
94
|
if (entry.type === 'compaction' && typeof entry.shortSummary === 'string' && !shortSummary) shortSummary = entry.shortSummary;
|
|
95
|
+
// omp records each call's begin as its own `custom` entry; the result entry
|
|
96
|
+
// carries no duration. The map is exact by call id and costs one entry.
|
|
97
|
+
if (entry.type === 'custom' && entry.customType === 'tool_execution_start') {
|
|
98
|
+
const data = isRecord(entry.data) ? entry.data : undefined;
|
|
99
|
+
const callId = typeof data?.toolCallId === 'string' ? data.toolCallId : undefined;
|
|
100
|
+
if (callId) {
|
|
101
|
+
const startedAt = toEpochMs(data?.startedAt) ?? toEpochMs(entry.timestamp);
|
|
102
|
+
if (startedAt !== undefined) toolStarts.set(callId, startedAt);
|
|
103
|
+
}
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
75
106
|
if (entry.type !== 'message' || !entry.message) return;
|
|
76
107
|
|
|
77
108
|
const msg = entry.message;
|
|
@@ -81,6 +112,17 @@ export async function computeRealSessionTelemetry(
|
|
|
81
112
|
const info = buildInfo(entry, msg, cwd, index);
|
|
82
113
|
const tokens = tokensOf(msg.usage);
|
|
83
114
|
|
|
115
|
+
// A result closes the span its `tool_execution_start` opened. A call still
|
|
116
|
+
// running when the file was read has no result and adds nothing.
|
|
117
|
+
if (role === 'toolResult') {
|
|
118
|
+
const callId = typeof msg.toolCallId === 'string' ? msg.toolCallId : undefined;
|
|
119
|
+
const startedAt = callId ? toolStarts.get(callId) : undefined;
|
|
120
|
+
const endedAt = toEpochMs(msg.timestamp) ?? toEpochMs(entry.timestamp);
|
|
121
|
+
if (startedAt !== undefined && endedAt !== undefined && endedAt >= startedAt) {
|
|
122
|
+
toolDurationMs += endedAt - startedAt;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
84
126
|
toolChars += profile.toolChars;
|
|
85
127
|
|
|
86
128
|
if (role === 'user') {
|
|
@@ -93,6 +135,16 @@ export async function computeRealSessionTelemetry(
|
|
|
93
135
|
if (msg.usage) lastAsstUsage = msg.usage;
|
|
94
136
|
const anchor = contextAnchorTokens(msg);
|
|
95
137
|
if (anchor !== undefined) contextAnchor = anchor;
|
|
138
|
+
const duration = typeof msg.duration === 'number' && Number.isFinite(msg.duration) ? msg.duration : undefined;
|
|
139
|
+
if (duration !== undefined && duration > 0) {
|
|
140
|
+
llmDurationMs += duration;
|
|
141
|
+
lastDurationMs = duration;
|
|
142
|
+
lastOutputTokens = tokens.output;
|
|
143
|
+
}
|
|
144
|
+
if (typeof msg.ttft === 'number' && Number.isFinite(msg.ttft) && msg.ttft > 0) {
|
|
145
|
+
ttftSum += msg.ttft;
|
|
146
|
+
ttftCount += 1;
|
|
147
|
+
}
|
|
96
148
|
}
|
|
97
149
|
|
|
98
150
|
if (msg.usage) {
|
|
@@ -177,6 +229,15 @@ export async function computeRealSessionTelemetry(
|
|
|
177
229
|
const cacheHitPercent = lastAsstUsage && lastTokens.input + lastTokens.output + lastTokens.cacheRead > 0 ? Number(((lastTokens.cacheRead / (lastTokens.input + lastTokens.output + lastTokens.cacheRead)) * 100).toFixed(1)) : 0;
|
|
178
230
|
const cacheHitAverage = cacheAvgInput + cacheAvgCacheRead > 0 ? Number(((cacheAvgCacheRead / (cacheAvgInput + cacheAvgCacheRead)) * 100).toFixed(1)) : 0;
|
|
179
231
|
|
|
232
|
+
// Output tokens per second, over the whole request duration — the same
|
|
233
|
+
// arithmetic omp's usage row prints, so the popover and the TUI agree.
|
|
234
|
+
const lastTps = lastDurationMs !== undefined && lastDurationMs > MIN_RATE_DURATION_MS && lastOutputTokens > 0
|
|
235
|
+
? (lastOutputTokens / lastDurationMs) * 1000
|
|
236
|
+
: undefined;
|
|
237
|
+
const avgTps = llmDurationMs > MIN_RATE_DURATION_MS && sumOutput > 0
|
|
238
|
+
? (sumOutput / llmDurationMs) * 1000
|
|
239
|
+
: undefined;
|
|
240
|
+
|
|
180
241
|
return {
|
|
181
242
|
sessionId,
|
|
182
243
|
sessionTitle: effectiveTitle || shortSummary || firstUserText
|
|
@@ -192,6 +253,13 @@ export async function computeRealSessionTelemetry(
|
|
|
192
253
|
assistantCount,
|
|
193
254
|
totalCost,
|
|
194
255
|
costFormatted: formatCost(totalCost),
|
|
256
|
+
timing: {
|
|
257
|
+
llmMs: Math.round(llmDurationMs),
|
|
258
|
+
toolMs: Math.round(toolDurationMs),
|
|
259
|
+
...(ttftCount > 0 ? { ttftAvgMs: Math.round(ttftSum / ttftCount) } : {}),
|
|
260
|
+
...(lastTps !== undefined ? { lastTps } : {}),
|
|
261
|
+
...(avgTps !== undefined ? { avgTps } : {}),
|
|
262
|
+
},
|
|
195
263
|
cacheHitAverage,
|
|
196
264
|
costBreakdown: { input: costInput, output: costOutput, cacheRead: costCacheRead, cacheWrite: costCacheWrite, total: totalCost },
|
|
197
265
|
lastMessage: {
|