@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
|
@@ -185,3 +185,84 @@ describe('computeRealSessionTelemetry raw items', () => {
|
|
|
185
185
|
expect(telemetry.rawMessages[0]?.id).toBe('u1');
|
|
186
186
|
});
|
|
187
187
|
});
|
|
188
|
+
|
|
189
|
+
describe('computeRealSessionTelemetry timing', () => {
|
|
190
|
+
/** The call's begin clock: a `custom` entry, the only start omp writes. */
|
|
191
|
+
function toolStart(callId: string, at: string): Record<string, unknown> {
|
|
192
|
+
return {
|
|
193
|
+
type: 'custom',
|
|
194
|
+
customType: 'tool_execution_start',
|
|
195
|
+
timestamp: at,
|
|
196
|
+
data: { toolCallId: callId, toolName: 'bash', startedAt: at },
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function toolResult(callId: string, at: string): Record<string, unknown> {
|
|
201
|
+
return {
|
|
202
|
+
type: 'message',
|
|
203
|
+
id: `r-${callId}`,
|
|
204
|
+
timestamp: at,
|
|
205
|
+
message: {
|
|
206
|
+
role: 'toolResult',
|
|
207
|
+
toolCallId: callId,
|
|
208
|
+
toolName: 'bash',
|
|
209
|
+
content: [{ type: 'text', text: 'ok' }],
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
test('sums LLM time, tool spans, TTFT and tokens/second', async () => {
|
|
215
|
+
const file = await writeSession([
|
|
216
|
+
header,
|
|
217
|
+
userMessage('u1', 'go'),
|
|
218
|
+
assistantMessage('a1', { duration: 2000, ttft: 500, usage: { input: 10, output: 100 } }),
|
|
219
|
+
toolStart('c1', '2026-09-16T02:32:00.000Z'),
|
|
220
|
+
toolResult('c1', '2026-09-16T02:32:01.500Z'),
|
|
221
|
+
assistantMessage('a2', { duration: 3000, ttft: 1000, usage: { input: 20, output: 150 } }),
|
|
222
|
+
]);
|
|
223
|
+
|
|
224
|
+
const { timing } = await computeRealSessionTelemetry(file, 'ses_telemetry');
|
|
225
|
+
expect(timing).toEqual({
|
|
226
|
+
llmMs: 5000,
|
|
227
|
+
toolMs: 1500,
|
|
228
|
+
ttftAvgMs: 750,
|
|
229
|
+
// last = 150 output / 3000 ms; avg = 250 output / 5000 ms — both 50/s.
|
|
230
|
+
lastTps: 50,
|
|
231
|
+
avgTps: 50,
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
test('reports no rate when the request is too short to mean anything', async () => {
|
|
236
|
+
const file = await writeSession([
|
|
237
|
+
header,
|
|
238
|
+
userMessage('u1', 'go'),
|
|
239
|
+
assistantMessage('a1', { duration: 80, usage: { input: 10, output: 5 } }),
|
|
240
|
+
]);
|
|
241
|
+
|
|
242
|
+
const { timing } = await computeRealSessionTelemetry(file, 'ses_telemetry');
|
|
243
|
+
// 80 ms is below the 100 ms floor: the span is real, the rate is not.
|
|
244
|
+
expect(timing).toEqual({ llmMs: 80, toolMs: 0 });
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
test('a tool call with no result contributes no time', async () => {
|
|
248
|
+
const file = await writeSession([
|
|
249
|
+
header,
|
|
250
|
+
userMessage('u1', 'go'),
|
|
251
|
+
toolStart('c1', '2026-09-16T02:32:00.000Z'),
|
|
252
|
+
]);
|
|
253
|
+
|
|
254
|
+
const { timing } = await computeRealSessionTelemetry(file, 'ses_telemetry');
|
|
255
|
+
expect(timing?.toolMs).toBe(0);
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
test('legacy messages without timing leave the rates unmeasured', async () => {
|
|
259
|
+
const file = await writeSession([
|
|
260
|
+
header,
|
|
261
|
+
userMessage('u1', 'go'),
|
|
262
|
+
assistantMessage('a1', { usage: { input: 10, output: 5 } }),
|
|
263
|
+
]);
|
|
264
|
+
|
|
265
|
+
const { timing } = await computeRealSessionTelemetry(file, 'ses_telemetry');
|
|
266
|
+
expect(timing).toEqual({ llmMs: 0, toolMs: 0 });
|
|
267
|
+
});
|
|
268
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The two journal routes' guards: a missing or unsafe session id, a diff read
|
|
8
|
+
* without its range, and a path with no record in the range. The data itself is
|
|
9
|
+
* covered by `changes.test.ts`; this file pins the HTTP answers a stale click
|
|
10
|
+
* or a crafted id receives.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
|
|
14
|
+
import * as fsp from 'node:fs/promises';
|
|
15
|
+
import * as os from 'node:os';
|
|
16
|
+
import * as path from 'node:path';
|
|
17
|
+
import type { LoaderFunctionArgs } from '@/server/lib/remix-compat';
|
|
18
|
+
import { clearSessionFileCaches } from '@/server/lib/omp/session/files';
|
|
19
|
+
import { getSessionChangeDiff, getSessionChanges } from '@/server/routes/sessions/changes';
|
|
20
|
+
|
|
21
|
+
const SESSION_ID = '01a0cc50-fd62-7417-899c-e24ff8c8608c';
|
|
22
|
+
const CWD = '/tmp/project';
|
|
23
|
+
let agentDir = '';
|
|
24
|
+
let journalDir = '';
|
|
25
|
+
|
|
26
|
+
function args(sessionId: string | undefined, query = ''): LoaderFunctionArgs {
|
|
27
|
+
return {
|
|
28
|
+
params: sessionId === undefined ? {} : { sessionId },
|
|
29
|
+
request: new Request(`http://localhost/api/sessions/${sessionId ?? ''}/changes${query}`),
|
|
30
|
+
context: {},
|
|
31
|
+
} as unknown as LoaderFunctionArgs;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
beforeAll(async () => {
|
|
35
|
+
agentDir = await fsp.mkdtemp(path.join(os.tmpdir(), 'omp-changes-route-'));
|
|
36
|
+
process.env.PI_CODING_AGENT_DIR = agentDir;
|
|
37
|
+
const cwdDir = path.join(agentDir, 'sessions', '-tmp-project');
|
|
38
|
+
await fsp.mkdir(cwdDir, { recursive: true });
|
|
39
|
+
const sessionFile = path.join(cwdDir, `2026-01-01T00-00-00-000Z_${SESSION_ID}.jsonl`);
|
|
40
|
+
await fsp.writeFile(
|
|
41
|
+
sessionFile,
|
|
42
|
+
`${JSON.stringify({ type: 'session', version: 3, id: SESSION_ID, timestamp: '2026-01-01T00:00:00.000Z', cwd: CWD })}\n`,
|
|
43
|
+
);
|
|
44
|
+
journalDir = sessionFile.slice(0, -'.jsonl'.length);
|
|
45
|
+
await fsp.mkdir(path.join(journalDir, 'blobs'), { recursive: true });
|
|
46
|
+
const after = 'a1';
|
|
47
|
+
await fsp.writeFile(path.join(journalDir, 'blobs', after), Bun.gzipSync(Buffer.from('one\n', 'utf8')));
|
|
48
|
+
await fsp.writeFile(
|
|
49
|
+
path.join(journalDir, 'changes.jsonl'),
|
|
50
|
+
`${JSON.stringify({ type: 'change', at: 1000, agent: 'Main', tool: 'write', path: `${CWD}/a.ts`, before: null, after })}\n`,
|
|
51
|
+
);
|
|
52
|
+
clearSessionFileCaches();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
afterAll(async () => {
|
|
56
|
+
delete process.env.PI_CODING_AGENT_DIR;
|
|
57
|
+
clearSessionFileCaches();
|
|
58
|
+
await fsp.rm(agentDir, { recursive: true, force: true });
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
describe('getSessionChanges', () => {
|
|
62
|
+
test('answers the records for a real session', async () => {
|
|
63
|
+
const response = (await getSessionChanges(args(SESSION_ID))) as Response;
|
|
64
|
+
expect(response.status).toBe(200);
|
|
65
|
+
const body = (await response.json()) as { records: Array<{ displayPath: string }> };
|
|
66
|
+
expect(body.records.map((record) => record.displayPath)).toEqual(['a.ts']);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('a missing id is a 400, an unsafe id a 404', async () => {
|
|
70
|
+
expect(((await getSessionChanges(args(undefined))) as Response).status).toBe(400);
|
|
71
|
+
expect(((await getSessionChanges(args('../escape'))) as Response).status).toBe(404);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
describe('getSessionChangeDiff', () => {
|
|
76
|
+
test('answers the net change for a path in range', async () => {
|
|
77
|
+
const query = `?path=${encodeURIComponent(`${CWD}/a.ts`)}&from=1000&to=1000`;
|
|
78
|
+
const response = (await getSessionChangeDiff(args(SESSION_ID, query))) as Response;
|
|
79
|
+
expect(response.status).toBe(200);
|
|
80
|
+
const body = (await response.json()) as { status: string; newContent: string };
|
|
81
|
+
expect(body.status).toBe('added');
|
|
82
|
+
expect(body.newContent).toBe('one\n');
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test('a missing range is a 400, an unknown path a 404', async () => {
|
|
86
|
+
expect(((await getSessionChangeDiff(args(SESSION_ID, '?path=x'))) as Response).status).toBe(400);
|
|
87
|
+
const query = `?path=${encodeURIComponent(`${CWD}/nope.ts`)}&from=1&to=2`;
|
|
88
|
+
expect(((await getSessionChangeDiff(args(SESSION_ID, query))) as Response).status).toBe(404);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The chat's per-run file list, read from the session's agent change journal.
|
|
8
|
+
*
|
|
9
|
+
* GET /api/sessions/:sessionId/changes
|
|
10
|
+
* Every `change` record, oldest first, with a display path. No blob
|
|
11
|
+
* content: the client buckets records into runs and only asks for a diff
|
|
12
|
+
* when a file is clicked.
|
|
13
|
+
*
|
|
14
|
+
* GET /api/sessions/:sessionId/changes/diff?path=<abs>&from=<ms>&to=<ms>
|
|
15
|
+
* The net change of one path inside one run window: the first record's
|
|
16
|
+
* `before` and the last record's `after`, plus a unified patch.
|
|
17
|
+
*
|
|
18
|
+
* A session with no journal (older omp, or no artifacts directory) answers an
|
|
19
|
+
* empty list — a normal state, not an error. The diff read answers 404 when the
|
|
20
|
+
* path has no record in the range, so a stale click reports the real problem.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { json } from '@/server/lib/remix-compat';
|
|
24
|
+
import type { LoaderFunctionArgs } from '@/server/lib/remix-compat';
|
|
25
|
+
import { isSinglePathSegment } from '@/server/lib/fs/path-segment';
|
|
26
|
+
import { readSessionChangeDiff, readSessionChangeIndex } from '@/server/lib/omp/session/changes';
|
|
27
|
+
|
|
28
|
+
/** GET /api/sessions/:sessionId/changes */
|
|
29
|
+
export async function getSessionChanges({ params }: LoaderFunctionArgs) {
|
|
30
|
+
const sessionId = params.sessionId;
|
|
31
|
+
if (!sessionId) return json({ error: 'Missing session id' }, { status: 400 });
|
|
32
|
+
if (!isSinglePathSegment(sessionId)) return json({ error: 'Session not found' }, { status: 404 });
|
|
33
|
+
return json({ sessionId, records: await readSessionChangeIndex(sessionId) });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** GET /api/sessions/:sessionId/changes/diff */
|
|
37
|
+
export async function getSessionChangeDiff({ params, request }: LoaderFunctionArgs) {
|
|
38
|
+
const sessionId = params.sessionId;
|
|
39
|
+
if (!sessionId) return json({ error: 'Missing session id' }, { status: 400 });
|
|
40
|
+
if (!isSinglePathSegment(sessionId)) return json({ error: 'Session not found' }, { status: 404 });
|
|
41
|
+
|
|
42
|
+
const url = new URL(request.url);
|
|
43
|
+
const file = url.searchParams.get('path');
|
|
44
|
+
const fromRaw = url.searchParams.get('from');
|
|
45
|
+
const toRaw = url.searchParams.get('to');
|
|
46
|
+
const from = fromRaw === null ? Number.NaN : Number(fromRaw);
|
|
47
|
+
const to = toRaw === null ? Number.NaN : Number(toRaw);
|
|
48
|
+
if (!file || !Number.isFinite(from) || !Number.isFinite(to)) {
|
|
49
|
+
return json({ error: 'path, from and to are required' }, { status: 400 });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const diff = await readSessionChangeDiff(sessionId, file, from, to);
|
|
53
|
+
if (!diff) return json({ error: 'No change for that path in the range' }, { status: 404 });
|
|
54
|
+
return json({ success: true, ...diff });
|
|
55
|
+
}
|
|
@@ -21,6 +21,7 @@ import { getSessionRelations, updateSessionParent } from '@/server/routes/sessio
|
|
|
21
21
|
import { forkSessionRoute } from '@/server/routes/sessions/fork';
|
|
22
22
|
import { getSessionAnswer } from '@/server/routes/sessions/answer';
|
|
23
23
|
import { getSessionMcp, probeSessionMcp, setSessionMcp } from '@/server/routes/sessions/mcp';
|
|
24
|
+
import { getSessionChangeDiff, getSessionChanges } from '@/server/routes/sessions/changes';
|
|
24
25
|
|
|
25
26
|
export const sessionsBindings: HandlerBinding[] = [
|
|
26
27
|
...bindingsFor(sessionsList, '/api/sessions/list'),
|
|
@@ -42,6 +43,11 @@ export const sessionsBindings: HandlerBinding[] = [
|
|
|
42
43
|
{ method: 'POST', path: '/api/sessions/:sessionId/parent', handler: updateSessionParent },
|
|
43
44
|
{ method: 'POST', path: '/api/sessions/:sessionId/fork', handler: forkSessionRoute },
|
|
44
45
|
{ method: 'GET', path: '/api/sessions/:sessionId/answer', handler: getSessionAnswer },
|
|
46
|
+
// The agent's own change journal: the per-run file list and one file's net
|
|
47
|
+
// diff. Static suffixes under the same `:sessionId` position, so the
|
|
48
|
+
// parameter name must stay `sessionId`.
|
|
49
|
+
{ method: 'GET', path: '/api/sessions/:sessionId/changes', handler: getSessionChanges },
|
|
50
|
+
{ method: 'GET', path: '/api/sessions/:sessionId/changes/diff', handler: getSessionChangeDiff },
|
|
45
51
|
// The MCP list this session has, and the per-session switch. A static suffix
|
|
46
52
|
// under the same `:sessionId` position, so the parameter name must stay
|
|
47
53
|
// `sessionId` (Elysia requires one name per position).
|
|
@@ -80,3 +80,37 @@ export function responseRunDurationMs(
|
|
|
80
80
|
if (start === null || end <= start) return null;
|
|
81
81
|
return end - start;
|
|
82
82
|
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Wall-clock window of one run: the opening row's start to the owner row's end.
|
|
86
|
+
*
|
|
87
|
+
* The change journal records epoch-ms write times and nothing that names a
|
|
88
|
+
* message, so this window is what buckets a write into the run that made it.
|
|
89
|
+
* `null` when either end is unmeasurable — a caller then shows no file list
|
|
90
|
+
* rather than guessing.
|
|
91
|
+
*/
|
|
92
|
+
export function runWindowMs(
|
|
93
|
+
messages: TimedMessage[],
|
|
94
|
+
runStartIndex: number,
|
|
95
|
+
ownerIndex: number,
|
|
96
|
+
): { start: number; end: number } | null {
|
|
97
|
+
// A session file can start mid-run: the first run then has no user row
|
|
98
|
+
// (`runStartIndex` is -1), and falling back to the OWNER row's start would
|
|
99
|
+
// begin the window at the last assistant message — after every write the run
|
|
100
|
+
// made. Walk forward from the first row instead.
|
|
101
|
+
const start = runStartIndex >= 0
|
|
102
|
+
? (msgStartMs(messages[runStartIndex]) ?? msgStartMs(messages[ownerIndex]))
|
|
103
|
+
: firstStartMs(messages, ownerIndex);
|
|
104
|
+
const end = msgEndMs(messages[ownerIndex]);
|
|
105
|
+
if (start === null || end === null || end < start) return null;
|
|
106
|
+
return { start, end };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** First measurable start at or before `lastIndex`, scanning from the top. */
|
|
110
|
+
function firstStartMs(messages: TimedMessage[], lastIndex: number): number | null {
|
|
111
|
+
for (let index = 0; index <= lastIndex; index++) {
|
|
112
|
+
const start = msgStartMs(messages[index]);
|
|
113
|
+
if (start !== null) return start;
|
|
114
|
+
}
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Bucketing the change journal into runs. The journal has no message id, so the
|
|
8
|
+
* run window is the whole contract: a write one millisecond outside it belongs
|
|
9
|
+
* to another run, and a file written twice must show the NET change, not the
|
|
10
|
+
* last write's pair.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { describe, expect, test } from 'bun:test';
|
|
14
|
+
import { bucketChangesByRun } from '@/shared/lib/chat/timeline/changed-files';
|
|
15
|
+
import type { RunFooterSlot } from '@/shared/lib/chat/timeline/run-footer';
|
|
16
|
+
import type { ChatMessageData, SessionChangeRecord } from '@/shared/types';
|
|
17
|
+
|
|
18
|
+
function message(overrides: Partial<ChatMessageData>): ChatMessageData {
|
|
19
|
+
return { id: 'm', role: 'ai', content: '', ...overrides };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function footer(ownerIndex: number, runStartIndex: number): RunFooterSlot {
|
|
23
|
+
return {
|
|
24
|
+
msg: message({ id: `owner-${ownerIndex}` }),
|
|
25
|
+
ownerIndex,
|
|
26
|
+
durationMs: null,
|
|
27
|
+
runStartIndex,
|
|
28
|
+
runUserId: `user-${runStartIndex}`,
|
|
29
|
+
answerText: '',
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function record(overrides: Partial<SessionChangeRecord>): SessionChangeRecord {
|
|
34
|
+
return {
|
|
35
|
+
at: 0,
|
|
36
|
+
agent: 'Main',
|
|
37
|
+
tool: 'edit',
|
|
38
|
+
path: '/repo/a.ts',
|
|
39
|
+
displayPath: 'a.ts',
|
|
40
|
+
before: 'b1',
|
|
41
|
+
after: 'b2',
|
|
42
|
+
...overrides,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
describe('bucketChangesByRun', () => {
|
|
47
|
+
const messages: ChatMessageData[] = [
|
|
48
|
+
message({ id: 'u1', role: 'user', startedAt: 1000 }),
|
|
49
|
+
message({ id: 'a1', role: 'ai', startedAt: 1100, completedAt: 2000 }),
|
|
50
|
+
message({ id: 'u2', role: 'user', startedAt: 3000 }),
|
|
51
|
+
message({ id: 'a2', role: 'ai', startedAt: 3100, completedAt: 4000 }),
|
|
52
|
+
];
|
|
53
|
+
const footers = [null, footer(1, 0), null, footer(3, 2)];
|
|
54
|
+
|
|
55
|
+
test('a write belongs to the run whose window contains it', () => {
|
|
56
|
+
const buckets = bucketChangesByRun(messages, footers, [
|
|
57
|
+
record({ at: 1500, path: '/repo/a.ts', displayPath: 'a.ts' }),
|
|
58
|
+
record({ at: 3500, path: '/repo/b.ts', displayPath: 'b.ts' }),
|
|
59
|
+
]);
|
|
60
|
+
expect(buckets.get(1)?.map((file) => file.displayPath)).toEqual(['a.ts']);
|
|
61
|
+
expect(buckets.get(3)?.map((file) => file.displayPath)).toEqual(['b.ts']);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('a write outside every window is dropped', () => {
|
|
65
|
+
const buckets = bucketChangesByRun(messages, footers, [record({ at: 2500 })]);
|
|
66
|
+
expect(buckets.size).toBe(0);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('a file written twice shows the net change', () => {
|
|
70
|
+
const buckets = bucketChangesByRun(messages, footers, [
|
|
71
|
+
record({ at: 1200, before: 'b1', after: 'b2' }),
|
|
72
|
+
record({ at: 1300, before: 'b2', after: 'b3' }),
|
|
73
|
+
]);
|
|
74
|
+
expect(buckets.get(1)).toEqual([
|
|
75
|
+
{ path: '/repo/a.ts', displayPath: 'a.ts', status: 'modified', agent: 'Main' },
|
|
76
|
+
]);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('created and deleted in one run is not a change', () => {
|
|
80
|
+
const buckets = bucketChangesByRun(messages, footers, [
|
|
81
|
+
record({ at: 1200, before: null, after: 'b2' }),
|
|
82
|
+
record({ at: 1300, before: 'b2', after: null }),
|
|
83
|
+
]);
|
|
84
|
+
expect(buckets.size).toBe(0);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('written back to the same blob is not a change', () => {
|
|
88
|
+
const buckets = bucketChangesByRun(messages, footers, [
|
|
89
|
+
record({ at: 1200, before: 'b1', after: 'b2' }),
|
|
90
|
+
record({ at: 1300, before: 'b2', after: 'b1' }),
|
|
91
|
+
]);
|
|
92
|
+
expect(buckets.size).toBe(0);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test('added and deleted statuses come from the first before and last after', () => {
|
|
96
|
+
const buckets = bucketChangesByRun(messages, footers, [
|
|
97
|
+
record({ at: 1200, path: '/repo/new.ts', displayPath: 'new.ts', before: null, after: 'b2' }),
|
|
98
|
+
record({ at: 1300, path: '/repo/gone.ts', displayPath: 'gone.ts', before: 'b1', after: null }),
|
|
99
|
+
]);
|
|
100
|
+
expect(buckets.get(1)?.map((file) => file.status)).toEqual(['deleted', 'added']);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test('a subagent write keeps its agent id', () => {
|
|
104
|
+
const buckets = bucketChangesByRun(messages, footers, [
|
|
105
|
+
record({ at: 1200, agent: 'AuthLoader' }),
|
|
106
|
+
]);
|
|
107
|
+
expect(buckets.get(1)?.[0]?.agent).toBe('AuthLoader');
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
test('a session that starts mid-run uses the first row as the window start', () => {
|
|
111
|
+
// The first run has no user row (`runStartIndex` is -1). Falling back to
|
|
112
|
+
// the OWNER row's start would begin the window at the last assistant
|
|
113
|
+
// message, after every write the run made.
|
|
114
|
+
const midRun: ChatMessageData[] = [
|
|
115
|
+
message({ id: 'a0', role: 'ai', startedAt: 1000, completedAt: 1200 }),
|
|
116
|
+
message({ id: 'a1', role: 'ai', startedAt: 1300, completedAt: 2000 }),
|
|
117
|
+
];
|
|
118
|
+
const buckets = bucketChangesByRun(midRun, [null, footer(1, -1)], [record({ at: 1500 })]);
|
|
119
|
+
expect(buckets.get(1)?.length).toBe(1);
|
|
120
|
+
});
|
|
121
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Bucket the agent change journal into chat runs.
|
|
8
|
+
*
|
|
9
|
+
* The journal records epoch-ms write times and nothing that names a message, so
|
|
10
|
+
* a write belongs to the run whose wall-clock window contains it. A run's
|
|
11
|
+
* window is its opening row's start to its owner row's end (`runWindowMs`).
|
|
12
|
+
*
|
|
13
|
+
* One file can be written several times in a run; the list shows the NET change
|
|
14
|
+
* — the first record's `before` to the last record's `after` — because that is
|
|
15
|
+
* what the run did to the file. A file created and deleted in the same run, or
|
|
16
|
+
* written back to the same blob, is not a change and is dropped.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import type { ChangedFile, ChatMessageData, SessionChangeRecord } from '@/shared/types';
|
|
20
|
+
import type { RunFooterSlot } from '@/shared/lib/chat/timeline/run-footer';
|
|
21
|
+
import { runWindowMs } from '@/shared/lib/chat/duration';
|
|
22
|
+
|
|
23
|
+
/** One file's first and last write inside a run. */
|
|
24
|
+
interface PathSpan {
|
|
25
|
+
first: SessionChangeRecord;
|
|
26
|
+
last: SessionChangeRecord;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* `ownerIndex → files` for every run that changed something. Runs with no
|
|
31
|
+
* journal records are absent, so a caller renders nothing for them.
|
|
32
|
+
*/
|
|
33
|
+
export function bucketChangesByRun(
|
|
34
|
+
messages: ChatMessageData[],
|
|
35
|
+
footers: (RunFooterSlot | null)[],
|
|
36
|
+
records: readonly SessionChangeRecord[],
|
|
37
|
+
): Map<number, ChangedFile[]> {
|
|
38
|
+
const byOwner = new Map<number, ChangedFile[]>();
|
|
39
|
+
if (records.length === 0) return byOwner;
|
|
40
|
+
const sorted = [...records].sort((a, b) => a.at - b.at);
|
|
41
|
+
|
|
42
|
+
for (const slot of footers) {
|
|
43
|
+
if (!slot) continue;
|
|
44
|
+
const window = runWindowMs(messages, slot.runStartIndex, slot.ownerIndex);
|
|
45
|
+
if (!window) continue;
|
|
46
|
+
const inWindow = sorted.filter((record) => record.at >= window.start && record.at <= window.end);
|
|
47
|
+
if (inWindow.length === 0) continue;
|
|
48
|
+
|
|
49
|
+
const byPath = new Map<string, PathSpan>();
|
|
50
|
+
for (const record of inWindow) {
|
|
51
|
+
const span = byPath.get(record.path);
|
|
52
|
+
if (span) span.last = record;
|
|
53
|
+
else byPath.set(record.path, { first: record, last: record });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const files: ChangedFile[] = [];
|
|
57
|
+
for (const [path, { first, last }] of byPath) {
|
|
58
|
+
// Created and deleted in the same run: no net change.
|
|
59
|
+
if (first.before === null && last.after === null) continue;
|
|
60
|
+
// Written back to the same content: no net change. Only a real blob key
|
|
61
|
+
// can prove that; `undefined` means "not stored", not "unchanged".
|
|
62
|
+
if (typeof first.before === 'string' && first.before === last.after) continue;
|
|
63
|
+
const status = first.before === null ? 'added' : last.after === null ? 'deleted' : 'modified';
|
|
64
|
+
files.push({ path, displayPath: last.displayPath, status, agent: last.agent });
|
|
65
|
+
}
|
|
66
|
+
if (files.length === 0) continue;
|
|
67
|
+
files.sort((a, b) => a.displayPath.localeCompare(b.displayPath));
|
|
68
|
+
byOwner.set(slot.ownerIndex, files);
|
|
69
|
+
}
|
|
70
|
+
return byOwner;
|
|
71
|
+
}
|
|
@@ -26,6 +26,9 @@ describe('forkCapability', () => {
|
|
|
26
26
|
expect(forkCapability('opencode')).toBe('tip');
|
|
27
27
|
expect(forkCapability('minimax')).toBe('tip');
|
|
28
28
|
expect(forkCapability('zcode')).toBe('tip');
|
|
29
|
+
// Hermes advertises `SessionForkCapabilities()` and its `fork_session` takes
|
|
30
|
+
// only cwd + session id, so the fork copies the whole conversation.
|
|
31
|
+
expect(forkCapability('hermes')).toBe('tip');
|
|
29
32
|
});
|
|
30
33
|
|
|
31
34
|
test('a harness with no session/fork is none', () => {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { describe, expect, test } from 'bun:test';
|
|
7
|
+
import { formatSpan } from '@/shared/lib/format/duration';
|
|
8
|
+
|
|
9
|
+
describe('formatSpan', () => {
|
|
10
|
+
test('prints sub-second spans to one decimal', () => {
|
|
11
|
+
expect(formatSpan(420)).toBe('0.4s');
|
|
12
|
+
expect(formatSpan(1500)).toBe('1.5s');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test('drops the decimal from ten seconds up', () => {
|
|
16
|
+
expect(formatSpan(9_999)).toBe('10.0s');
|
|
17
|
+
expect(formatSpan(12_000)).toBe('12s');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test('uses the largest two units past a minute', () => {
|
|
21
|
+
expect(formatSpan(134_000)).toBe('2m 14s');
|
|
22
|
+
expect(formatSpan(3_840_000)).toBe('1h 4m');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('returns undefined for a value it cannot state', () => {
|
|
26
|
+
expect(formatSpan(undefined)).toBeUndefined();
|
|
27
|
+
expect(formatSpan(0)).toBeUndefined();
|
|
28
|
+
expect(formatSpan(-5)).toBeUndefined();
|
|
29
|
+
expect(formatSpan(Number.NaN)).toBeUndefined();
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Wall-clock span label for statistics.
|
|
8
|
+
*
|
|
9
|
+
* Sub-second is the point: a fast tool call or a short LLM request is a real
|
|
10
|
+
* measurement, while the chat footer's `formatDuration` deliberately hides
|
|
11
|
+
* anything under a second. `formatSpan` prints `0.4s`, `12s`, `2m 14s`,
|
|
12
|
+
* `1h 4m` — one convention for every timing row in the context popover.
|
|
13
|
+
*
|
|
14
|
+
* Undefined, non-finite and non-positive values return `undefined`, so the
|
|
15
|
+
* caller omits the row instead of printing a measurement the source never made.
|
|
16
|
+
*/
|
|
17
|
+
export function formatSpan(ms: number | undefined): string | undefined {
|
|
18
|
+
if (typeof ms !== 'number' || !Number.isFinite(ms) || ms <= 0) return undefined;
|
|
19
|
+
if (ms < 10_000) return `${(ms / 1000).toFixed(1)}s`;
|
|
20
|
+
const totalSeconds = Math.round(ms / 1000);
|
|
21
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
22
|
+
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
|
23
|
+
const seconds = totalSeconds % 60;
|
|
24
|
+
if (hours > 0) return `${hours}h ${minutes}m`;
|
|
25
|
+
if (minutes > 0) return `${minutes}m ${seconds}s`;
|
|
26
|
+
return `${seconds}s`;
|
|
27
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The unified patch the journal diff tab copies. The panel renders the two
|
|
8
|
+
* sides itself, so this is the one place a wrong hunk header or a lost context
|
|
9
|
+
* line would reach the clipboard unnoticed.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { describe, expect, test } from 'bun:test';
|
|
13
|
+
import { unifiedDiff } from '@/shared/lib/fs/unified-diff';
|
|
14
|
+
|
|
15
|
+
describe('unifiedDiff', () => {
|
|
16
|
+
test('equal texts produce no patch', () => {
|
|
17
|
+
expect(unifiedDiff('a.ts', 'one\ntwo\n', 'one\ntwo\n')).toBe('');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test('a changed line keeps three lines of context and a correct header', () => {
|
|
21
|
+
const before = 'a\nb\nc\nd\ne\nf\ng\n';
|
|
22
|
+
const after = 'a\nb\nc\nD\ne\nf\ng\n';
|
|
23
|
+
const patch = unifiedDiff('src/x.ts', before, after);
|
|
24
|
+
expect(patch).toContain('--- a/src/x.ts');
|
|
25
|
+
expect(patch).toContain('+++ b/src/x.ts');
|
|
26
|
+
expect(patch).toContain('@@ -1,7 +1,7 @@');
|
|
27
|
+
expect(patch).toContain('-d');
|
|
28
|
+
expect(patch).toContain('+D');
|
|
29
|
+
expect(patch).toContain(' a');
|
|
30
|
+
expect(patch).toContain(' g');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('a created file is all additions', () => {
|
|
34
|
+
const patch = unifiedDiff('new.ts', '', 'one\ntwo\n');
|
|
35
|
+
expect(patch).toContain('@@ -0,0 +1,2 @@');
|
|
36
|
+
expect(patch).toContain('+one');
|
|
37
|
+
expect(patch).toContain('+two');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('a deleted file is all deletions', () => {
|
|
41
|
+
const patch = unifiedDiff('gone.ts', 'one\ntwo\n', '');
|
|
42
|
+
expect(patch).toContain('@@ -1,2 +0,0 @@');
|
|
43
|
+
expect(patch).toContain('-one');
|
|
44
|
+
expect(patch).toContain('-two');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('two distant changes become two hunks', () => {
|
|
48
|
+
const before = Array.from({ length: 40 }, (_, index) => `line ${index}`).join('\n');
|
|
49
|
+
const after = before.replace('line 1\n', 'LINE 1\n').replace('line 38', 'LINE 38');
|
|
50
|
+
const patch = unifiedDiff('big.ts', before, after);
|
|
51
|
+
expect(patch.match(/^@@ /gm)?.length).toBe(2);
|
|
52
|
+
});
|
|
53
|
+
});
|