@kabmo-labs/kabmo 0.32.1 → 0.34.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 +805 -637
- package/dist/client/static/js/{CsvGrid-4gx0jevc.js → CsvGrid-vze4m5ag.js} +2 -2
- package/dist/client/static/js/{DocxView-0667nr8h.js → DocxView-jbf21gmh.js} +5 -5
- package/dist/client/static/js/{DrawioView-522v0d0r.js → DrawioView-b52qybx5.js} +2 -2
- package/dist/client/static/js/{ImageView-t8xp60hm.js → ImageView-mdgzj8px.js} +1 -1
- package/dist/client/static/js/LayoutWrapper-3c49dvtt.js +2 -0
- package/dist/client/static/js/Modal-sqp864vd.js +38 -0
- package/dist/client/static/js/{PdfView-3fx172xh.js → PdfView-g06rxqb1.js} +1 -1
- package/dist/client/static/js/{SessionsView-n3agmf5t.js → SessionsView-521adxyr.js} +1 -1
- package/dist/client/static/js/{SheetView-nmrdb1b8.js → SheetView-h8xmsz7q.js} +22 -22
- package/dist/client/static/js/{SvgPreview-0xsc6xam.js → SvgPreview-1j4jvcvz.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-jj31rs62.js → abnfDiagram-O67JEVCF-pasxh4b6.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-fc9kmq1w.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-ay3yr7pf.js → architectureDiagram-NJMV4G6O-ms14g0bm.js} +4 -4
- 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-ycn78fcq.js} +4 -4
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-dtb81cgz.js → c4Diagram-YGBWAQC7-vn2gpjfm.js} +5 -5
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-vk5a2n9w.js → classDiagram-v2-NBCMYWYE-fyrm1pr5.js} +5 -5
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-6rbjbe19.js → cose-bilkent-JH36ORCC-ea5nwvgq.js} +1 -1
- package/dist/client/static/js/css-6vj0d308.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-a4t8992q.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-vyjksedr.js → cynefinDiagram-VND7K2PF-j6bsjpre.js} +2 -2
- package/dist/client/static/js/{dagre-6A5THRUB-7hey38z5.js → dagre-6A5THRUB-4smdkwv8.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-aes06jde.js → diagram-22UHCM2B-9sm4kqwc.js} +19 -19
- package/dist/client/static/js/{diagram-3UASUU5V-3cfkgm3x.js → diagram-3UASUU5V-2h3qxaed.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-z8mfhwpy.js → diagram-ATOU4E4O-1981bc94.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-t4821ctz.js → diagram-CDSNMT55-3vgsxavc.js} +5 -5
- package/dist/client/static/js/{diagram-MLGK6HIB-23yxbfrx.js → diagram-MLGK6HIB-c9gf2r3f.js} +2 -2
- package/dist/client/static/js/{diagram-MPIPVDR6-chhtf7v0.js → diagram-MPIPVDR6-gjqeq92d.js} +2 -2
- package/dist/client/static/js/{dockerfile-5b87ghm7.js → dockerfile-8v935dkn.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-9jejcvfr.js → ebnfDiagram-ZINNZB2B-4vbsgh99.js} +1 -1
- package/dist/client/static/js/{elixir-rpa1g4gy.js → elixir-vcbg60wv.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-xhhtkf58.js → elk-276RUBZZ-nca3t891.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-mt2apjjb.js → erDiagram-OPXOYQCR-5kfkev03.js} +6 -6
- package/dist/client/static/js/{erlang-6m6tpt72.js → erlang-qt876zrq.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-18bdrkv5.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-fg0yqx0h.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-8cm7a29w.js → ganttDiagram-FUAMR5RP-mxc73wmq.js} +3 -3
- package/dist/client/static/js/gitGraph-4MIJSDKK-8fa6y40p.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-5s0gbnx2.js → gitGraphDiagram-X574FWY7-7en3ag0e.js} +12 -12
- package/dist/client/static/js/graphql-n43pd5fs.js +1 -0
- package/dist/client/static/js/html-dbrwss36.js +1 -0
- package/dist/client/static/js/{index-ye3sr7db.js → index-0vm41je9.js} +4 -4
- package/dist/client/static/js/{index-5y7c62sm.js → index-1b0t1428.js} +5 -5
- package/dist/client/static/js/{index-9sd0vjmh.js → index-1ksg88qf.js} +2 -2
- package/dist/client/static/js/{index-brj8qwa6.js → index-1y9r4frb.js} +2 -2
- package/dist/client/static/js/index-231241f4.js +12 -0
- package/dist/client/static/js/index-2mx9ej4k.css +1 -0
- package/dist/client/static/js/{index-6q80csr0.js → index-2svnq5gg.js} +1 -1
- package/dist/client/static/js/{index-dt7e1328.js → index-354mqqra.js} +2 -2
- package/dist/client/static/js/{index-532btjmp.js → index-3zc1b0dv.js} +2 -2
- package/dist/client/static/js/{index-h06bcfds.js → index-4g46wbdw.js} +1 -1
- package/dist/client/static/js/{index-p7btwjvj.js → index-4qwzxj81.js} +3 -3
- package/dist/client/static/js/{index-3vhznzgr.js → index-52rqxgya.js} +1 -1
- package/dist/client/static/js/index-6sf2vsp2.js +1 -0
- package/dist/client/static/js/{index-xya34x4v.js → index-76zb4m0n.js} +2 -2
- package/dist/client/static/js/{index-jz9fpznk.js → index-7a64yjrm.js} +6 -6
- package/dist/client/static/js/{index-2xj14800.js → index-7y6rpsrp.js} +2 -2
- package/dist/client/static/js/{index-rg8jpbsw.js → index-8acv5b77.js} +2 -2
- package/dist/client/static/js/{index-ay34b398.js → index-a0fmsv1d.js} +19 -19
- package/dist/client/static/js/{index-2gfc25tq.js → index-ag2rmtas.js} +1 -1
- package/dist/client/static/js/{index-sa9cp6km.js → index-ahv9y42z.js} +2 -2
- package/dist/client/static/js/{index-g33knza2.js → index-b29afsjh.js} +1 -1
- package/dist/client/static/js/{index-629kfbcb.js → index-c3ek61zv.js} +2 -2
- package/dist/client/static/js/{index-360d7j0d.js → index-cd65zqba.js} +1 -1
- package/dist/client/static/js/{index-4s8ttfxj.js → index-cgzrpvzj.js} +211 -211
- package/dist/client/static/js/{index-gbfg0anm.js → index-dbe6afkf.js} +2 -2
- package/dist/client/static/js/{index-z4v1xmh1.js → index-ev3yt353.js} +2 -2
- package/dist/client/static/js/{index-ehcpzk5b.js → index-eyfcm0cy.js} +1 -1
- package/dist/client/static/js/{index-a733k69t.js → index-f7jhhqtk.js} +2 -2
- package/dist/client/static/js/{index-hc2jmzpx.js → index-fta1y9pc.js} +65 -65
- package/dist/client/static/js/{index-vd0e25p0.js → index-fvmfge3p.js} +1 -1
- package/dist/client/static/js/{index-a6k2hqke.js → index-g2dyfze9.js} +1 -1
- package/dist/client/static/js/index-h5bn97p6.js +2 -0
- 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-ejgd8w3s.js → index-j51d5a5m.js} +28 -28
- package/dist/client/static/js/{index-kpspnztv.js → index-jsyekbx9.js} +2 -2
- package/dist/client/static/js/{index-a0bdavdr.js → index-km2zb6wk.js} +2 -2
- package/dist/client/static/js/{index-59jb53v3.js → index-nccwxv0s.js} +2 -2
- package/dist/client/static/js/{index-dnp07j57.js → index-p0nz38bm.js} +1 -1
- package/dist/client/static/js/{index-c0x6s6f7.js → index-pm6xxwz1.js} +2 -2
- package/dist/client/static/js/{index-5x95n3hx.js → index-ptcrwswj.js} +1 -1
- package/dist/client/static/js/{index-fdbfzshx.js → index-ptcwae2n.js} +2 -2
- package/dist/client/static/js/{index-h7pn9qw6.js → index-qckv9nte.js} +2 -2
- package/dist/client/static/js/{index-wzma5n54.js → index-r014brzs.js} +2 -2
- package/dist/client/static/js/{index-xj9649ac.js → index-ray2czf6.js} +7 -7
- package/dist/client/static/js/{index-qnwqaczk.js → index-rs80cwsv.js} +3 -3
- package/dist/client/static/js/{index-pf5sbesf.js → index-rytaa8ca.js} +2 -2
- package/dist/client/static/js/{index-c93sp4yh.js → index-rzxcj7cg.js} +1 -1
- package/dist/client/static/js/{index-a293pdg7.js → index-s7gkkkyz.js} +2 -2
- package/dist/client/static/js/{index-7n68yx6m.js → index-sd66wv26.js} +2 -2
- package/dist/client/static/js/{index-bbggh3f8.js → index-vhqe0y82.js} +2 -2
- package/dist/client/static/js/{index-dq1kdt03.js → index-vy6termr.js} +1 -1
- package/dist/client/static/js/{index-pf7syd7t.js → index-xx6mqpxm.js} +3 -3
- package/dist/client/static/js/{index-z5s27s26.js → index-ybm2x4vh.js} +1 -1
- package/dist/client/static/js/{index-jppt5mgc.js → index-zvfvqvn9.js} +2 -2
- package/dist/client/static/js/info-A6RAGUB7-3hk844f7.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-3w1yz32c.js → infoDiagram-VRGFBTTK-sef80132.js} +2 -2
- package/dist/client/static/js/ini-j5dyq6gm.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-ckt471dy.js → ishikawaDiagram-OU5B5YK6-yhvepp1q.js} +6 -6
- package/dist/client/static/js/java-g4dgwbfd.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-kfvn4w7e.js → journeyDiagram-ZHPQQLJL-5w77y95w.js} +5 -5
- package/dist/client/static/js/jsx-7t5ecz9s.js +1 -0
- package/dist/client/static/js/{julia-0j0gsjvc.js → julia-d4j6wgvf.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-0q36cm83.js → kanban-definition-PNTS6WVX-02znqtna.js} +6 -6
- 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-a6e6vck4.js} +6 -6
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-e2ym5en8.js → mindmap-definition-NLK3R4M7-y4n74q9x.js} +8 -8
- package/dist/client/static/js/one-dark-pro-vwhfpzr8.js +1 -0
- package/dist/client/static/js/one-light-y5t9x6zh.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-4nj2yy10.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-t8bbdyhe.js → pegDiagram-GJSIUBJH-pr7ehgzb.js} +1 -1
- package/dist/client/static/js/{perl-7n7e9ncg.js → perl-srptw5vm.js} +1 -1
- package/dist/client/static/js/{php-32vy69vd.js → php-n89g3fk7.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-k7rde3f9.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-envv4brj.js → pieDiagram-5QR66LMP-39wpsk08.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-esm913km.js} +4 -4
- package/dist/client/static/js/r-qw82kkv9.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-513dpw4f.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-9bqnst9c.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-7367d5bv.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-b806b1mj.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-5a67rwf8.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-1ej0f5hr.js → railroadDiagram-XR7U4H2S-wy2mgya6.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-rvdaknpd.js → requirementDiagram-PLB6GJNP-6z9xdgbq.js} +4 -4
- package/dist/client/static/js/{ruby-5ty7fys7.js → ruby-r81ytgcm.js} +1 -1
- package/dist/client/static/js/{rust-2geezrcs.js → rust-frn3szvc.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-nxvhtdaw.js → sankeyDiagram-IPEJSGJF-rtmxk3ys.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-awzcrafg.js} +18 -18
- package/dist/client/static/js/{sizeCapture-INFHLROL-r074kj7s.js → sizeCapture-INFHLROL-03gy196j.js} +1 -1
- package/dist/client/static/js/sql-0e9mnrda.js +1 -0
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-vxghxdb0.js → stateDiagram-v2-GCMORJYK-an8v3q5n.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-n9yb4wcs.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-nx5nfnf0.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-5tbq4ex2.js → timeline-definition-EJHVYXUP-jceb575g.js} +4 -4
- package/dist/client/static/js/treeView-Q6P3EWNA-kcy40evb.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-fsrvqxf4.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-888h3100.js} +39 -39
- package/dist/client/static/js/vennDiagram-UO4OBE2U-wbfz0rzv.js +34 -0
- package/dist/client/static/js/{vue-06rdf4wh.js → vue-c0rtg1wf.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-36dmxww4.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-km2x4er8.js → wardleyDiagram-VNRHLVJA-rn8c5qf9.js} +4 -4
- package/dist/client/static/js/xml-dz51p1m3.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-kr3sgr4m.js → xychartDiagram-PMCCYNJV-8sn1apt6.js} +5 -5
- package/dist/client/static/js/yaml-2cfkd30t.js +1 -0
- package/package.json +4 -1
- package/src/client/components/auth/login-screen/index.tsx +1 -0
- package/src/client/components/common/MarkdownRenderer.tsx +9 -12
- 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/Modal.tsx +14 -84
- package/src/client/components/settings/Sidebar.tsx +3 -1
- 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/ConnectSettings.tsx +105 -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/settings/categories/connect-settings/DeviceTable.tsx +145 -0
- package/src/client/components/settings/categories/connect-settings/PairDialog.tsx +160 -0
- package/src/client/components/settings/categories/connect-settings/QrCode.tsx +73 -0
- package/src/client/components/settings/categories/connect-settings/ServerCard.tsx +94 -0
- package/src/client/components/settings/categories/connect-settings/TunnelRow.tsx +127 -0
- package/src/client/components/settings/category-content.tsx +116 -0
- package/src/client/components/workspace/chat-timeline/ChangedFilesSummary.test.tsx +120 -0
- package/src/client/components/workspace/chat-timeline/ChangedFilesSummary.tsx +137 -0
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +33 -1
- package/src/client/components/workspace/chat-timeline/RunFooter.tsx +22 -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/change-stats.ts +57 -0
- 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/connect/use-connect-status.ts +116 -0
- package/src/client/hooks/connect/use-pairing.ts +100 -0
- package/src/client/hooks/ui/clipboard.ts +26 -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/client/tailwind.css +5 -0
- package/src/server/index.ts +2 -0
- package/src/server/lib/assets/font-css.server.test.ts +19 -0
- package/src/server/lib/auth/client-address.test.ts +58 -0
- package/src/server/lib/auth/client-address.ts +37 -3
- package/src/server/lib/auth/guard.ts +31 -4
- package/src/server/lib/auth/rate-limit.test.ts +25 -8
- package/src/server/lib/auth/rate-limit.ts +8 -5
- package/src/server/lib/connect/cloudflared.lifecycle.test.ts +88 -0
- package/src/server/lib/connect/cloudflared.server.test.ts +65 -0
- package/src/server/lib/connect/cloudflared.server.ts +206 -0
- package/src/server/lib/connect/devices.server.ts +192 -0
- package/src/server/lib/connect/identity.server.ts +81 -0
- package/src/server/lib/connect/pairing.server.test.ts +56 -0
- package/src/server/lib/connect/pairing.server.ts +113 -0
- package/src/server/lib/connect/qr.roundtrip.test.ts +106 -0
- package/src/server/lib/connect/qr.server.ts +36 -0
- package/src/server/lib/connect/run.server.ts +101 -0
- package/src/server/lib/connect/status.server.ts +177 -0
- package/src/server/lib/connect/tailscale.server.test.ts +117 -0
- package/src/server/lib/connect/tailscale.server.ts +172 -0
- package/src/server/lib/db/schema.ts +4 -0
- package/src/server/lib/harness/launch-table.ts +10 -0
- package/src/server/lib/omp/session/changes.test.ts +201 -0
- package/src/server/lib/omp/session/changes.ts +313 -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/connect/devices.ts +56 -0
- package/src/server/routes/connect/index.ts +15 -0
- package/src/server/routes/connect/pair-page.ts +177 -0
- package/src/server/routes/connect/pair.ts +158 -0
- package/src/server/routes/connect/status.ts +19 -0
- package/src/server/routes/connect/tunnels.ts +76 -0
- package/src/server/routes/health/probe.ts +5 -0
- package/src/server/routes/index.ts +2 -0
- package/src/server/routes/sessions/changes.test.ts +99 -0
- package/src/server/routes/sessions/changes.ts +79 -0
- package/src/server/routes/sessions/index.ts +7 -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/connect/payload.test.ts +144 -0
- package/src/shared/lib/connect/payload.ts +229 -0
- package/src/shared/lib/connect/tier.test.ts +73 -0
- package/src/shared/lib/connect/tier.ts +105 -0
- package/src/shared/lib/connect/types.ts +99 -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/markdown/fira-code-fonts.css +65 -6
- package/src/shared/lib/markdown/marked.ts +7 -4
- package/src/shared/lib/markdown/mermaid-actions.test.ts +78 -0
- package/src/shared/lib/markdown/mermaid-actions.ts +45 -0
- package/src/shared/lib/markdown/mermaid.ts +41 -7
- package/src/shared/lib/omp/config/schema.test.ts +4 -2
- package/src/shared/lib/settings/defaults.ts +1 -0
- package/src/shared/lib/settings/sections.ts +6 -1
- 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 +64 -0
- package/src/shared/types/settings/state.ts +10 -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/html-pv88ny12.js +0 -1
- package/dist/client/static/js/index-61tm0v57.js +0 -1
- package/dist/client/static/js/index-e94a1en0.css +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/sql-g8wcshpc.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/vennDiagram-UO4OBE2U-7k5jsxf9.js +0 -34
- 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,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Minting a pairing code, and the countdown that makes its life visible.
|
|
8
|
+
*
|
|
9
|
+
* The code is single-use and expires in two minutes, so the dialog has to say
|
|
10
|
+
* both things and show the clock. A code that silently stops working is
|
|
11
|
+
* indistinguishable from a broken camera, and the user's next move — rescan,
|
|
12
|
+
* restart the app — is the wrong one.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { useCallback, useEffect, useState } from 'preact/hooks';
|
|
16
|
+
import type { ConnectCandidate } from '@/shared/lib/connect/types';
|
|
17
|
+
|
|
18
|
+
export interface PairingCode {
|
|
19
|
+
pairingId: string;
|
|
20
|
+
expiresAt: string;
|
|
21
|
+
/** The `kabmo://` deep link, for a native shell that registers the scheme. */
|
|
22
|
+
link: string;
|
|
23
|
+
/** The `https://…/pair#…` link a browser can open. This is what the QR holds. */
|
|
24
|
+
webLink: string;
|
|
25
|
+
candidates: ConnectCandidate[];
|
|
26
|
+
qr: { size: number; rows: string[] };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface UsePairingResult {
|
|
30
|
+
code: PairingCode | null;
|
|
31
|
+
error: string | null;
|
|
32
|
+
busy: boolean;
|
|
33
|
+
/** Seconds left before the code stops working; 0 once it has. */
|
|
34
|
+
secondsLeft: number;
|
|
35
|
+
create: () => Promise<void>;
|
|
36
|
+
reset: () => void;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface PairingEnvelope extends Partial<PairingCode> {
|
|
40
|
+
error?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function usePairing(): UsePairingResult {
|
|
44
|
+
const [code, setCode] = useState<PairingCode | null>(null);
|
|
45
|
+
const [error, setError] = useState<string | null>(null);
|
|
46
|
+
const [busy, setBusy] = useState(false);
|
|
47
|
+
const [secondsLeft, setSecondsLeft] = useState(0);
|
|
48
|
+
|
|
49
|
+
const create = useCallback(async () => {
|
|
50
|
+
setBusy(true);
|
|
51
|
+
setError(null);
|
|
52
|
+
try {
|
|
53
|
+
const response = await fetch('/api/connect/pair', {
|
|
54
|
+
method: 'POST',
|
|
55
|
+
headers: { 'content-type': 'application/json' },
|
|
56
|
+
body: JSON.stringify({ action: 'create' }),
|
|
57
|
+
});
|
|
58
|
+
const payload = (await response.json().catch(() => null)) as PairingEnvelope | null;
|
|
59
|
+
if (!response.ok || !payload?.qr || !payload.link) {
|
|
60
|
+
setError(payload?.error ?? `Could not create a pairing code (HTTP ${response.status}).`);
|
|
61
|
+
setCode(null);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
setCode({
|
|
65
|
+
pairingId: payload.pairingId ?? '',
|
|
66
|
+
expiresAt: payload.expiresAt ?? '',
|
|
67
|
+
link: payload.link,
|
|
68
|
+
webLink: payload.webLink ?? payload.link,
|
|
69
|
+
candidates: payload.candidates ?? [],
|
|
70
|
+
qr: payload.qr,
|
|
71
|
+
});
|
|
72
|
+
} catch (cause) {
|
|
73
|
+
setError(cause instanceof Error ? cause.message : 'Could not create a pairing code.');
|
|
74
|
+
setCode(null);
|
|
75
|
+
} finally {
|
|
76
|
+
setBusy(false);
|
|
77
|
+
}
|
|
78
|
+
}, []);
|
|
79
|
+
|
|
80
|
+
const reset = useCallback(() => {
|
|
81
|
+
setCode(null);
|
|
82
|
+
setError(null);
|
|
83
|
+
setSecondsLeft(0);
|
|
84
|
+
}, []);
|
|
85
|
+
|
|
86
|
+
// The countdown is derived from the server's own `expiresAt`, not from a
|
|
87
|
+
// local two-minute timer: a clock that started when the dialog opened would
|
|
88
|
+
// keep counting through a slow request and claim time the code never had.
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (!code) return;
|
|
91
|
+
const deadline = Date.parse(code.expiresAt);
|
|
92
|
+
if (!Number.isFinite(deadline)) return;
|
|
93
|
+
const tick = () => setSecondsLeft(Math.max(0, Math.round((deadline - Date.now()) / 1000)));
|
|
94
|
+
tick();
|
|
95
|
+
const timer = setInterval(tick, 1_000);
|
|
96
|
+
return () => clearInterval(timer);
|
|
97
|
+
}, [code]);
|
|
98
|
+
|
|
99
|
+
return { code, error, busy, secondsLeft, create, reset };
|
|
100
|
+
}
|
|
@@ -48,3 +48,29 @@ export async function readClipboardText(): Promise<string | null> {
|
|
|
48
48
|
return null;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
+
|
|
52
|
+
const COPY_ICON =
|
|
53
|
+
'<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>';
|
|
54
|
+
const CHECK_ICON =
|
|
55
|
+
'<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>';
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Copy a code block's text and flash the checkmark on its button.
|
|
59
|
+
*
|
|
60
|
+
* The button is markup the markdown renderer injected, so the swap is DOM work
|
|
61
|
+
* rather than component state — and it belongs next to the clipboard call it
|
|
62
|
+
* reports, not in the renderer's delegated click handler.
|
|
63
|
+
*/
|
|
64
|
+
export function copyFromButton(button: HTMLButtonElement): void {
|
|
65
|
+
const text = button.dataset.copy ?? '';
|
|
66
|
+
if (!text) return;
|
|
67
|
+
void copyToClipboard(text).then((ok) => {
|
|
68
|
+
if (!ok) return;
|
|
69
|
+
button.setAttribute('data-copied', 'true');
|
|
70
|
+
button.innerHTML = CHECK_ICON;
|
|
71
|
+
setTimeout(() => {
|
|
72
|
+
button.removeAttribute('data-copied');
|
|
73
|
+
button.innerHTML = COPY_ICON;
|
|
74
|
+
}, 2000);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
@@ -115,6 +115,9 @@ describe('useNotificationEvents', () => {
|
|
|
115
115
|
params: {
|
|
116
116
|
title: 'Fix the build',
|
|
117
117
|
body: 'The run ended with error',
|
|
118
|
+
// The shell picks its chime from this: `ask` is the attention cue, the
|
|
119
|
+
// others the completion chime.
|
|
120
|
+
kind: 'error',
|
|
118
121
|
tag: 'error:s-1',
|
|
119
122
|
sessionId: 's-1',
|
|
120
123
|
// The event's own moment travels with it: a banner delivered later must
|
|
@@ -44,12 +44,14 @@ export function useNotificationEvents(): void {
|
|
|
44
44
|
const event = asNotificationEvent(frame.payload);
|
|
45
45
|
if (!event) return;
|
|
46
46
|
// The chime is its own preference and plays for an ask regardless of
|
|
47
|
-
// whether this device is allowed a system banner
|
|
47
|
+
// whether this device is allowed a system banner; inside a shell the
|
|
48
|
+
// banner plays it instead (see `native-banner-sound`).
|
|
48
49
|
if (event.kind === 'ask') triggerInputRequiredSound();
|
|
49
50
|
if (!isNotificationPlatformEnabled(notificationPlatformForClient())) return;
|
|
50
51
|
void showOsNotification({
|
|
51
52
|
title: event.title,
|
|
52
53
|
body: event.body,
|
|
54
|
+
kind: event.kind,
|
|
53
55
|
tag: notificationTag(event),
|
|
54
56
|
sessionId: event.sessionId,
|
|
55
57
|
at: event.at,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useCallback } from 'preact/hooks';
|
|
2
2
|
import { readKabmoSetting } from '@/shared/lib/settings/client';
|
|
3
|
+
import { nativeBannerPlaysSound } from '@/client/lib/notifications/native-banner-sound';
|
|
3
4
|
|
|
4
5
|
interface WebkitWindow extends Window {
|
|
5
6
|
webkitAudioContext?: typeof AudioContext;
|
|
@@ -138,22 +139,28 @@ export function isChatSoundEnabled(appSettings?: Record<string, any>): boolean {
|
|
|
138
139
|
|
|
139
140
|
/**
|
|
140
141
|
* Triggers the completion notification sound if the user setting is enabled.
|
|
142
|
+
*
|
|
143
|
+
* Silent inside a shell: its banner plays the same chime, and playing both is
|
|
144
|
+
* the double sound this design removes.
|
|
141
145
|
*/
|
|
142
146
|
export function triggerChatCompletionSound(appSettings?: Record<string, any>) {
|
|
143
|
-
if (isChatSoundEnabled(appSettings))
|
|
144
|
-
|
|
145
|
-
|
|
147
|
+
if (!isChatSoundEnabled(appSettings)) return;
|
|
148
|
+
if (nativeBannerPlaysSound('finish', appSettings)) return;
|
|
149
|
+
playNotificationSound();
|
|
146
150
|
}
|
|
147
151
|
|
|
148
152
|
/**
|
|
149
153
|
* Triggers the input-required cue, gated by the same notification preference as
|
|
150
154
|
* the completion chime. Reads settings from the primed snapshot: the alert fires
|
|
151
155
|
* from the app-wide session list, which has no settings props to thread.
|
|
156
|
+
*
|
|
157
|
+
* Silent inside a shell, like the completion chime — the shell's banner plays
|
|
158
|
+
* the attention cue instead.
|
|
152
159
|
*/
|
|
153
160
|
export function triggerInputRequiredSound() {
|
|
154
|
-
if (isChatSoundEnabled())
|
|
155
|
-
|
|
156
|
-
|
|
161
|
+
if (!isChatSoundEnabled()) return;
|
|
162
|
+
if (nativeBannerPlaysSound('ask')) return;
|
|
163
|
+
playInputRequiredSound();
|
|
157
164
|
}
|
|
158
165
|
|
|
159
166
|
export function useNotificationSound() {
|
|
@@ -38,6 +38,7 @@ afterEach(() => {
|
|
|
38
38
|
jest.useRealTimers();
|
|
39
39
|
FakeAudioContext.instances.length = 0;
|
|
40
40
|
(win as unknown as Record<string, unknown>).AudioContext = FakeAudioContext;
|
|
41
|
+
delete window.__kabmoCall;
|
|
41
42
|
});
|
|
42
43
|
/** The alert mounts the real hook, so every constructed context is a cue. */
|
|
43
44
|
|
|
@@ -241,6 +242,20 @@ describe('isChatSoundEnabled', () => {
|
|
|
241
242
|
triggerChatCompletionSound();
|
|
242
243
|
expect(FakeAudioContext.instances).toHaveLength(1);
|
|
243
244
|
});
|
|
245
|
+
|
|
246
|
+
test('inside a shell the banner plays the chime instead', () => {
|
|
247
|
+
window.__kabmoCall = () => Promise.resolve(null);
|
|
248
|
+
primeKabmoSettings({ chatCompletionSound: true, notifyOnFinish: true });
|
|
249
|
+
|
|
250
|
+
triggerChatCompletionSound();
|
|
251
|
+
expect(FakeAudioContext.instances).toEqual([]);
|
|
252
|
+
|
|
253
|
+
// The same setting with the shell's banner switched off: nothing else is
|
|
254
|
+
// making sound, so the page must.
|
|
255
|
+
primeKabmoSettings({ chatCompletionSound: true, notifyOnFinish: false });
|
|
256
|
+
triggerChatCompletionSound();
|
|
257
|
+
expect(FakeAudioContext.instances).toHaveLength(1);
|
|
258
|
+
});
|
|
244
259
|
});
|
|
245
260
|
|
|
246
261
|
/** The snapshot and the DOM globals are module/global state shared across the whole `bun test` process. */
|
|
@@ -6,6 +6,12 @@ interface UseFileDiffOptions {
|
|
|
6
6
|
isStaged: boolean;
|
|
7
7
|
repo: string;
|
|
8
8
|
root?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Whether this hook owns the read. A journal diff tab passes `false`: its two
|
|
11
|
+
* sides come from the session's change journal, and a git read would be a
|
|
12
|
+
* second, wrong answer for the same panel.
|
|
13
|
+
*/
|
|
14
|
+
enabled?: boolean;
|
|
9
15
|
}
|
|
10
16
|
|
|
11
17
|
export interface FileDiffState {
|
|
@@ -33,7 +39,7 @@ export interface FileDiffState {
|
|
|
33
39
|
* earlier read overwriting a newer one, and a dependency on the staged/status
|
|
34
40
|
* copies re-keying the callback and firing a fetch per render.
|
|
35
41
|
*/
|
|
36
|
-
export function useFileDiff({ filePath, status, isStaged, repo, root }: UseFileDiffOptions): FileDiffState {
|
|
42
|
+
export function useFileDiff({ filePath, status, isStaged, repo, root, enabled = true }: UseFileDiffOptions): FileDiffState {
|
|
37
43
|
const [rawDiff, setRawDiff] = useState<string>('');
|
|
38
44
|
const [oldContent, setOldContent] = useState<string>('');
|
|
39
45
|
const [newContent, setNewContent] = useState<string>('');
|
|
@@ -53,7 +59,7 @@ export function useFileDiff({ filePath, status, isStaged, repo, root }: UseFileD
|
|
|
53
59
|
const fetchSeqRef = useRef(0);
|
|
54
60
|
|
|
55
61
|
const fetchDiff = useCallback(async (overrides: { staged?: boolean; status?: string } = {}) => {
|
|
56
|
-
if (!filePath) return;
|
|
62
|
+
if (!enabled || !filePath) return;
|
|
57
63
|
const seq = ++fetchSeqRef.current;
|
|
58
64
|
setIsLoading(true);
|
|
59
65
|
setErrorMessage(null);
|
|
@@ -109,7 +115,7 @@ export function useFileDiff({ filePath, status, isStaged, repo, root }: UseFileD
|
|
|
109
115
|
} finally {
|
|
110
116
|
if (seq === fetchSeqRef.current) setIsLoading(false);
|
|
111
117
|
}
|
|
112
|
-
}, [filePath, repo, root]);
|
|
118
|
+
}, [filePath, repo, root, enabled]);
|
|
113
119
|
|
|
114
120
|
/**
|
|
115
121
|
* The read is keyed on the pair the caller asked for, not only on the path.
|
|
@@ -121,12 +127,13 @@ export function useFileDiff({ filePath, status, isStaged, repo, root }: UseFileD
|
|
|
121
127
|
* seeded first: `fetchDiff` reads them, and the state copies lag a render.
|
|
122
128
|
*/
|
|
123
129
|
useEffect(() => {
|
|
130
|
+
if (!enabled) return;
|
|
124
131
|
stagedRef.current = isStaged;
|
|
125
132
|
statusRef.current = status;
|
|
126
133
|
setCurrentStatus(status);
|
|
127
134
|
setCurrentStaged(isStaged);
|
|
128
135
|
void fetchDiff();
|
|
129
|
-
}, [fetchDiff, isStaged, status]);
|
|
136
|
+
}, [fetchDiff, isStaged, status, enabled]);
|
|
130
137
|
|
|
131
138
|
const adoptState = useCallback((next: { staged?: boolean; status?: string }) => {
|
|
132
139
|
if (typeof next.staged === 'boolean') {
|
|
@@ -2,14 +2,14 @@ import { useCallback, useEffect, useRef } from 'preact/hooks';
|
|
|
2
2
|
import { useSessionState } from '@/client/hooks/workspace/session-state';
|
|
3
3
|
import { useSessionStateContext } from '@/client/hooks/workspace/session-state/context';
|
|
4
4
|
import { useKabmoEvent } from '@/client/hooks/ui/window-event';
|
|
5
|
-
import { diffTabId, diffTabName, fileTabId } from '@/shared/lib/workspace/file-tab-id';
|
|
5
|
+
import { diffTabId, diffTabName, fileTabId, journalDiffTabId } from '@/shared/lib/workspace/file-tab-id';
|
|
6
6
|
import { getSessionValue, setSessionKey } from '@/shared/lib/workspace/session-state/store';
|
|
7
7
|
import {
|
|
8
8
|
SCROLL_POSITIONS_KEY,
|
|
9
9
|
dropScrollPosition,
|
|
10
10
|
type ScrollPositions,
|
|
11
11
|
} from '@/shared/lib/workspace/scroll-positions';
|
|
12
|
-
import type { OpenedFile } from '@/shared/types/fs';
|
|
12
|
+
import type { JournalDiffRef, OpenedFile } from '@/shared/types/fs';
|
|
13
13
|
|
|
14
14
|
export interface OpenFileInput {
|
|
15
15
|
id?: number | string;
|
|
@@ -135,10 +135,16 @@ export function useFileTabs(
|
|
|
135
135
|
status?: string;
|
|
136
136
|
repo?: string;
|
|
137
137
|
root?: string;
|
|
138
|
+
/** `journal` reads the agent's own before/after snapshots, not the worktree. */
|
|
139
|
+
source?: 'journal';
|
|
140
|
+
journal?: JournalDiffRef;
|
|
138
141
|
}) => {
|
|
139
142
|
const rawPath = diffInfo.file.replace(/^\/+/, '');
|
|
140
143
|
const isStaged = Boolean(diffInfo.staged);
|
|
141
|
-
const
|
|
144
|
+
const journal = diffInfo.source === 'journal' ? diffInfo.journal : undefined;
|
|
145
|
+
const diffId = journal
|
|
146
|
+
? journalDiffTabId(journal.path, journal.from, journal.to)
|
|
147
|
+
: diffTabId(rawPath, isStaged);
|
|
142
148
|
|
|
143
149
|
const diffEntry: OpenedFile = {
|
|
144
150
|
id: diffId,
|
|
@@ -149,11 +155,12 @@ export function useFileTabs(
|
|
|
149
155
|
diffStaged: isStaged,
|
|
150
156
|
repo: diffInfo.repo || '.',
|
|
151
157
|
root: diffInfo.root ?? activeProjectPath ?? undefined,
|
|
158
|
+
...(journal ? { diffSource: 'journal' as const, journalDiff: journal } : {}),
|
|
152
159
|
};
|
|
153
160
|
|
|
154
161
|
setOpenedFiles(prev => {
|
|
155
162
|
const existing = prev.find(
|
|
156
|
-
f => f.id === diffId || (f.isDiff && f.path === rawPath && f.diffStaged === isStaged)
|
|
163
|
+
f => f.id === diffId || (!journal && f.isDiff && f.path === rawPath && f.diffStaged === isStaged)
|
|
157
164
|
);
|
|
158
165
|
if (existing) {
|
|
159
166
|
setActiveFileId(existing.id);
|
|
@@ -289,6 +296,8 @@ export function useFileTabs(
|
|
|
289
296
|
status?: string;
|
|
290
297
|
repo?: string;
|
|
291
298
|
root?: string;
|
|
299
|
+
source?: 'journal';
|
|
300
|
+
journal?: JournalDiffRef;
|
|
292
301
|
}>;
|
|
293
302
|
if (!customEvent.detail || !customEvent.detail.file) return;
|
|
294
303
|
handleOpenDiff(customEvent.detail);
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The diff panel's read for a journal tab: the agent's own before/after
|
|
8
|
+
* snapshots for one path inside one run window.
|
|
9
|
+
*
|
|
10
|
+
* Same shape as {@link useFileDiff} so the panel can swap the source without a
|
|
11
|
+
* second renderer. The two differences are the endpoint and the status
|
|
12
|
+
* vocabulary: the journal answers `added` / `modified` / `deleted`, which the
|
|
13
|
+
* panel's badge already understands as `A` / `M` / `D`.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { useCallback, useEffect, useRef, useState } from 'preact/hooks';
|
|
17
|
+
import type { FileDiffState } from '@/client/hooks/workspace/diff-file';
|
|
18
|
+
import type { JournalDiffRef } from '@/shared/types/fs';
|
|
19
|
+
|
|
20
|
+
interface JournalDiffResponse {
|
|
21
|
+
success?: boolean;
|
|
22
|
+
oldContent?: string;
|
|
23
|
+
newContent?: string;
|
|
24
|
+
diff?: string;
|
|
25
|
+
status?: 'added' | 'modified' | 'deleted';
|
|
26
|
+
unavailable?: boolean;
|
|
27
|
+
error?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** `A` / `M` / `D` for the panel's status badge. */
|
|
31
|
+
function statusLetter(status: JournalDiffResponse['status']): string {
|
|
32
|
+
if (status === 'added') return 'A';
|
|
33
|
+
if (status === 'deleted') return 'D';
|
|
34
|
+
return 'M';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function useJournalDiff(ref: JournalDiffRef | undefined): FileDiffState {
|
|
38
|
+
const [rawDiff, setRawDiff] = useState('');
|
|
39
|
+
const [oldContent, setOldContent] = useState('');
|
|
40
|
+
const [newContent, setNewContent] = useState('');
|
|
41
|
+
const [currentStatus, setCurrentStatus] = useState('M');
|
|
42
|
+
const [isLoading, setIsLoading] = useState(Boolean(ref));
|
|
43
|
+
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
|
44
|
+
const seqRef = useRef(0);
|
|
45
|
+
|
|
46
|
+
const sessionId = ref?.sessionId;
|
|
47
|
+
const path = ref?.path;
|
|
48
|
+
const from = ref?.from;
|
|
49
|
+
const to = ref?.to;
|
|
50
|
+
|
|
51
|
+
const fetchDiff = useCallback(async () => {
|
|
52
|
+
if (!sessionId || !path || from === undefined || to === undefined) return;
|
|
53
|
+
const seq = ++seqRef.current;
|
|
54
|
+
setIsLoading(true);
|
|
55
|
+
setErrorMessage(null);
|
|
56
|
+
try {
|
|
57
|
+
const params = new URLSearchParams({ path, from: String(from), to: String(to) });
|
|
58
|
+
const res = await fetch(`/api/sessions/${encodeURIComponent(sessionId)}/changes/diff?${params.toString()}`);
|
|
59
|
+
const data = (await res.json().catch(() => null)) as JournalDiffResponse | null;
|
|
60
|
+
if (seq !== seqRef.current) return;
|
|
61
|
+
if (data?.success) {
|
|
62
|
+
setOldContent(data.oldContent ?? '');
|
|
63
|
+
setNewContent(data.newContent ?? '');
|
|
64
|
+
setRawDiff(data.diff ?? '');
|
|
65
|
+
setCurrentStatus(statusLetter(data.status));
|
|
66
|
+
if (data.unavailable) {
|
|
67
|
+
setErrorMessage('The journal did not store this file’s content (over 8 MB), so the two sides are unknown.');
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
setErrorMessage(data?.error || `Failed to load the journal diff (HTTP ${res.status})`);
|
|
71
|
+
}
|
|
72
|
+
} catch (err: unknown) {
|
|
73
|
+
if (seq !== seqRef.current) return;
|
|
74
|
+
setErrorMessage(err instanceof Error ? err.message : 'Error fetching the journal diff');
|
|
75
|
+
} finally {
|
|
76
|
+
if (seq === seqRef.current) setIsLoading(false);
|
|
77
|
+
}
|
|
78
|
+
}, [sessionId, path, from, to]);
|
|
79
|
+
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
void fetchDiff();
|
|
82
|
+
}, [fetchDiff]);
|
|
83
|
+
|
|
84
|
+
const adoptState = useCallback(() => {}, []);
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
rawDiff,
|
|
88
|
+
oldContent,
|
|
89
|
+
newContent,
|
|
90
|
+
currentStatus,
|
|
91
|
+
currentStaged: false,
|
|
92
|
+
isLoading,
|
|
93
|
+
errorMessage,
|
|
94
|
+
fetchDiff,
|
|
95
|
+
adoptState,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The one rule that removes the double chime: a shell's banner plays the Kabmo
|
|
8
|
+
* sound itself, so the page must not play the cue on top of it.
|
|
9
|
+
*
|
|
10
|
+
* Every branch here is a sound the user either hears twice or never — neither
|
|
11
|
+
* throws, neither logs, so this is the only place the decision is visible.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
15
|
+
import { Window } from 'happy-dom';
|
|
16
|
+
|
|
17
|
+
import { nativeBannerPlaysSound } from '@/client/lib/notifications/native-banner-sound';
|
|
18
|
+
import { notificationPlatformForClient } from '@/client/lib/notifications/platform';
|
|
19
|
+
import { primeKabmoSettings } from '@/shared/lib/settings/client';
|
|
20
|
+
|
|
21
|
+
const DOM_GLOBALS = ['window', 'document', 'navigator'] as const;
|
|
22
|
+
const nativeGlobals: Partial<Record<(typeof DOM_GLOBALS)[number], unknown>> = {};
|
|
23
|
+
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
const win = new Window({ url: 'http://localhost' });
|
|
26
|
+
const target = globalThis as unknown as Record<string, unknown>;
|
|
27
|
+
for (const key of DOM_GLOBALS) {
|
|
28
|
+
if (!(key in nativeGlobals)) nativeGlobals[key] = target[key];
|
|
29
|
+
target[key] = (win as unknown as Record<string, unknown>)[key];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
afterEach(() => {
|
|
34
|
+
primeKabmoSettings({});
|
|
35
|
+
delete window.__kabmoCall;
|
|
36
|
+
const target = globalThis as unknown as Record<string, unknown>;
|
|
37
|
+
for (const key of DOM_GLOBALS) {
|
|
38
|
+
if (nativeGlobals[key] === undefined) delete target[key];
|
|
39
|
+
else target[key] = nativeGlobals[key];
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
/** A shell that answers everything, so `hasShellBridge()` is true. */
|
|
44
|
+
function installShell(): void {
|
|
45
|
+
window.__kabmoCall = () => Promise.resolve(null);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
describe('nativeBannerPlaysSound', () => {
|
|
49
|
+
test('a browser keeps the Web Audio cue', () => {
|
|
50
|
+
primeKabmoSettings({ notifyOnFinish: true, notifyOnAsk: true });
|
|
51
|
+
expect(nativeBannerPlaysSound('finish')).toBe(false);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('a shell with the event switch on owns the sound', () => {
|
|
55
|
+
installShell();
|
|
56
|
+
primeKabmoSettings({ notifyOnFinish: true });
|
|
57
|
+
expect(nativeBannerPlaysSound('finish')).toBe(true);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('the event switch ships off, so the page stays audible', () => {
|
|
61
|
+
installShell();
|
|
62
|
+
primeKabmoSettings({});
|
|
63
|
+
expect(nativeBannerPlaysSound('finish')).toBe(false);
|
|
64
|
+
expect(nativeBannerPlaysSound('ask')).toBe(false);
|
|
65
|
+
expect(nativeBannerPlaysSound('error')).toBe(false);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('a silenced device class falls back to the page cue', () => {
|
|
69
|
+
installShell();
|
|
70
|
+
const master = notificationPlatformForClient() === 'mobile'
|
|
71
|
+
? 'notifyMobileEnabled'
|
|
72
|
+
: 'notifyDesktopEnabled';
|
|
73
|
+
primeKabmoSettings({ notifyOnFinish: true, [master]: false });
|
|
74
|
+
expect(nativeBannerPlaysSound('finish')).toBe(false);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test('the other device class does not silence this one', () => {
|
|
78
|
+
installShell();
|
|
79
|
+
const other = notificationPlatformForClient() === 'mobile'
|
|
80
|
+
? 'notifyDesktopEnabled'
|
|
81
|
+
: 'notifyMobileEnabled';
|
|
82
|
+
primeKabmoSettings({ notifyOnAsk: true, [other]: false });
|
|
83
|
+
expect(nativeBannerPlaysSound('ask')).toBe(true);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test('each event is gated by its own switch', () => {
|
|
87
|
+
installShell();
|
|
88
|
+
primeKabmoSettings({ notifyOnAsk: true });
|
|
89
|
+
expect(nativeBannerPlaysSound('ask')).toBe(true);
|
|
90
|
+
expect(nativeBannerPlaysSound('finish')).toBe(false);
|
|
91
|
+
expect(nativeBannerPlaysSound('error')).toBe(false);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Whether the NATIVE banner owns the chime for this event.
|
|
8
|
+
*
|
|
9
|
+
* Inside a Kabmo shell the OS notification plays the Kabmo sound itself
|
|
10
|
+
* (`packages/notification-sound/`). The page must then NOT play its Web Audio
|
|
11
|
+
* cue: the two arrive for the same event within a few hundred milliseconds, and
|
|
12
|
+
* hearing the same chime twice is the bug this module exists to prevent.
|
|
13
|
+
*
|
|
14
|
+
* A browser — desktop Chrome, an installed PWA — has no sound slot on its
|
|
15
|
+
* `Notification`, so the page keeps playing the cue there. That is the whole
|
|
16
|
+
* rule: the sound follows whoever can carry it, exactly once.
|
|
17
|
+
*
|
|
18
|
+
* Three conditions, all required:
|
|
19
|
+
*
|
|
20
|
+
* - a shell bridge, because only a shell can put a sound in a notification;
|
|
21
|
+
* - the platform master ON for this device class, because a silenced shell posts
|
|
22
|
+
* no banner — and then the page's cue is the only sound there is;
|
|
23
|
+
* - the event switch ON, because the server does not even record a silenced
|
|
24
|
+
* event, so no banner (and no chime) would arrive.
|
|
25
|
+
*
|
|
26
|
+
* The event switches ship FALSE, which is why the page still plays its cue on a
|
|
27
|
+
* fresh install: nothing has been switched on, so nothing else is making sound.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import { hasShellBridge } from '@/client/lib/shell/transport';
|
|
31
|
+
import { notificationPlatformForClient } from '@/client/lib/notifications/platform';
|
|
32
|
+
import {
|
|
33
|
+
isNotificationEnabled,
|
|
34
|
+
isNotificationPlatformEnabled,
|
|
35
|
+
type NotificationEvent,
|
|
36
|
+
} from '@/shared/lib/notifications/settings';
|
|
37
|
+
|
|
38
|
+
export function nativeBannerPlaysSound(
|
|
39
|
+
event: NotificationEvent,
|
|
40
|
+
appSettings?: Record<string, any>,
|
|
41
|
+
): boolean {
|
|
42
|
+
if (typeof window === 'undefined') return false;
|
|
43
|
+
if (!hasShellBridge()) return false;
|
|
44
|
+
if (!isNotificationPlatformEnabled(notificationPlatformForClient(), appSettings)) return false;
|
|
45
|
+
return isNotificationEnabled(event, appSettings);
|
|
46
|
+
}
|
|
@@ -37,7 +37,7 @@ describe('a browser without the Notification API', () => {
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
test('drops the banner instead of throwing', async () => {
|
|
40
|
-
await expect(showOsNotification({ title: 'Kabmo', body: 'Done.' })).resolves.toBeUndefined();
|
|
40
|
+
await expect(showOsNotification({ title: 'Kabmo', body: 'Done.', kind: 'finish' })).resolves.toBeUndefined();
|
|
41
41
|
});
|
|
42
42
|
});
|
|
43
43
|
|
|
@@ -65,6 +65,7 @@ describe('inside a Kabmo shell', () => {
|
|
|
65
65
|
await showOsNotification({
|
|
66
66
|
title: 'Fix the build',
|
|
67
67
|
body: 'Waiting for you.',
|
|
68
|
+
kind: 'ask',
|
|
68
69
|
tag: 'ask:s1',
|
|
69
70
|
sessionId: 's1',
|
|
70
71
|
});
|
|
@@ -73,7 +74,13 @@ describe('inside a Kabmo shell', () => {
|
|
|
73
74
|
{ method: 'notification_request', params: {} },
|
|
74
75
|
{
|
|
75
76
|
method: 'notification_show',
|
|
76
|
-
params: {
|
|
77
|
+
params: {
|
|
78
|
+
title: 'Fix the build',
|
|
79
|
+
body: 'Waiting for you.',
|
|
80
|
+
kind: 'ask',
|
|
81
|
+
tag: 'ask:s1',
|
|
82
|
+
sessionId: 's1',
|
|
83
|
+
},
|
|
77
84
|
},
|
|
78
85
|
]);
|
|
79
86
|
});
|
|
@@ -84,6 +91,7 @@ describe('inside a Kabmo shell', () => {
|
|
|
84
91
|
await showOsNotification({
|
|
85
92
|
title: 'Fix the build',
|
|
86
93
|
body: 'The run finished.',
|
|
94
|
+
kind: 'finish',
|
|
87
95
|
tag: 'finish:s1',
|
|
88
96
|
sessionId: 's1',
|
|
89
97
|
at: 1_763_000_000_000,
|
|
@@ -95,6 +103,7 @@ describe('inside a Kabmo shell', () => {
|
|
|
95
103
|
expect(calls[0]?.params).toEqual({
|
|
96
104
|
title: 'Fix the build',
|
|
97
105
|
body: 'The run finished.',
|
|
106
|
+
kind: 'finish',
|
|
98
107
|
tag: 'finish:s1',
|
|
99
108
|
sessionId: 's1',
|
|
100
109
|
when: '1763000000000',
|
|
@@ -104,10 +113,10 @@ describe('inside a Kabmo shell', () => {
|
|
|
104
113
|
|
|
105
114
|
test('an untagged notification does not send an empty tag', async () => {
|
|
106
115
|
const calls = installShell(() => null);
|
|
107
|
-
await showOsNotification({ title: 'Kabmo', body: 'Done.' });
|
|
116
|
+
await showOsNotification({ title: 'Kabmo', body: 'Done.', kind: 'finish' });
|
|
108
117
|
expect(calls[0]).toEqual({
|
|
109
118
|
method: 'notification_show',
|
|
110
|
-
params: { title: 'Kabmo', body: 'Done.' },
|
|
119
|
+
params: { title: 'Kabmo', body: 'Done.', kind: 'finish' },
|
|
111
120
|
});
|
|
112
121
|
});
|
|
113
122
|
|
|
@@ -115,6 +124,6 @@ describe('inside a Kabmo shell', () => {
|
|
|
115
124
|
window.__kabmoCall = () => Promise.reject(new Error('This shell does not support notification_request.'));
|
|
116
125
|
expect(await requestNotificationPermission()).toBe(false);
|
|
117
126
|
// The refusal must not escape as an unhandled rejection.
|
|
118
|
-
await expect(showOsNotification({ title: 'Kabmo', body: 'Done.' })).resolves.toBeUndefined();
|
|
127
|
+
await expect(showOsNotification({ title: 'Kabmo', body: 'Done.', kind: 'finish' })).resolves.toBeUndefined();
|
|
119
128
|
});
|
|
120
129
|
});
|
|
@@ -23,10 +23,17 @@
|
|
|
23
23
|
|
|
24
24
|
import { callShell, hasShellBridge } from '@/client/lib/shell/transport';
|
|
25
25
|
import { openSessionInUrl } from '@/client/lib/router/open-session';
|
|
26
|
+
import type { NotificationKind } from '@/shared/lib/notifications/events';
|
|
26
27
|
|
|
27
28
|
export interface OsNotification {
|
|
28
29
|
title: string;
|
|
29
30
|
body: string;
|
|
31
|
+
/**
|
|
32
|
+
* Which event this is. The shells play a different chime for `ask` (the
|
|
33
|
+
* console's "the agent is blocked on you" cue) than for `finish`/`error`; a
|
|
34
|
+
* browser's own notification has no sound slot, so it is ignored there.
|
|
35
|
+
*/
|
|
36
|
+
kind: NotificationKind;
|
|
30
37
|
/** Replaces an earlier notification for the same thing (a session, a run). */
|
|
31
38
|
tag?: string;
|
|
32
39
|
/** The session a click opens, when the event is about one. */
|
|
@@ -90,6 +97,7 @@ export async function showOsNotification(notification: OsNotification): Promise<
|
|
|
90
97
|
await callShell('notification_show', {
|
|
91
98
|
title: notification.title,
|
|
92
99
|
body: notification.body,
|
|
100
|
+
kind: notification.kind,
|
|
93
101
|
...(notification.tag ? { tag: notification.tag } : {}),
|
|
94
102
|
...(notification.sessionId ? { sessionId: notification.sessionId } : {}),
|
|
95
103
|
// The shells render what they can: Android puts `when` on the shade's
|