@kabmo-labs/kabmo 0.40.0 → 0.42.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 +533 -517
- package/dist/client/static/js/{CsvGrid-j9nvnhq1.js → CsvGrid-20k047ht.js} +2 -2
- package/dist/client/static/js/{DocxView-87gnpm81.js → DocxView-qpvhfcmg.js} +5 -5
- package/dist/client/static/js/{DrawioView-a351t8f8.js → DrawioView-178skky8.js} +2 -2
- package/dist/client/static/js/ImageView-460th5qa.js +1 -0
- package/dist/client/static/js/LayoutWrapper-5cv0dty8.js +2 -0
- package/dist/client/static/js/Modal-wks6p4r5.js +38 -0
- package/dist/client/static/js/{PdfView-n6bwcvc8.js → PdfView-y51g03nr.js} +1 -1
- package/dist/client/static/js/SessionsView-rsmvn7ks.js +1 -0
- package/dist/client/static/js/{SheetView-k8ymr87w.js → SheetView-z7yvb05v.js} +25 -25
- package/dist/client/static/js/{SvgPreview-5pcp444e.js → SvgPreview-yehgzhem.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-psav75bx.js → abnfDiagram-O67JEVCF-6zxpcy8b.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-9q06651f.js +1 -0
- package/dist/client/static/js/architectureDiagram-NJMV4G6O-m98sgh3c.js +36 -0
- package/dist/client/static/js/{astro-0rh34hha.js → astro-nn7xg0we.js} +1 -1
- package/dist/client/static/js/bash-fjzhxy10.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-17xsf182.js → blockDiagram-BEXU5L5S-cp7rervg.js} +5 -5
- package/dist/client/static/js/c-wqtyezvw.js +1 -0
- package/dist/client/static/js/c4Diagram-YGBWAQC7-t31recqm.js +38 -0
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-663z1g1r.js → classDiagram-v2-NBCMYWYE-fy8x3dkx.js} +5 -5
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-vp4yvx8x.js → cose-bilkent-JH36ORCC-va7ybm9e.js} +1 -1
- package/dist/client/static/js/cpp-y0nzwner.js +1 -0
- package/dist/client/static/js/css-a13jmmnc.js +1 -0
- package/dist/client/static/js/css-n2waj098.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-w7a38g4g.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-dagkrjbh.js → cynefinDiagram-VND7K2PF-4k0k429c.js} +2 -2
- package/dist/client/static/js/{dagre-6A5THRUB-8qgwpb5a.js → dagre-6A5THRUB-ykdhxq6t.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-671xtp0d.js → diagram-22UHCM2B-5nvwx7b6.js} +8 -8
- package/dist/client/static/js/{diagram-3UASUU5V-8nn5fha8.js → diagram-3UASUU5V-hc7zsjgw.js} +1 -1
- package/dist/client/static/js/diagram-ATOU4E4O-97ae07y7.js +3 -0
- package/dist/client/static/js/diagram-CDSNMT55-b56nnbbs.js +30 -0
- package/dist/client/static/js/{diagram-MLGK6HIB-tp6dwxdb.js → diagram-MLGK6HIB-37rygr9k.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-qgx8c8ee.js → diagram-MPIPVDR6-wv3vhhfk.js} +2 -2
- package/dist/client/static/js/{dockerfile-hk0s4qaw.js → dockerfile-0efb1z6e.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-nmf9r33z.js → ebnfDiagram-ZINNZB2B-13fv7vxg.js} +1 -1
- package/dist/client/static/js/{elixir-gpez1k9m.js → elixir-mabagxwa.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-dheh5ngz.js → elk-276RUBZZ-xam60ktz.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-8837mk18.js → erDiagram-OPXOYQCR-24ctv2ee.js} +6 -6
- package/dist/client/static/js/{erlang-w9gmf866.js → erlang-zwy7cqdk.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-6wrjccyw.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-19vjkg84.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-g68mvnje.js → ganttDiagram-FUAMR5RP-766a8fqw.js} +2 -2
- package/dist/client/static/js/gitGraph-4MIJSDKK-4je2p50v.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-ymk81cdj.js → gitGraphDiagram-X574FWY7-fmwjkgh6.js} +2 -2
- package/dist/client/static/js/graphql-gvb7e2eb.js +1 -0
- package/dist/client/static/js/html-bwyt0ayy.js +1 -0
- package/dist/client/static/js/{index-rc8wrs2a.js → index-03pyvmcz.js} +2 -2
- package/dist/client/static/js/index-13dr1t1r.js +314 -0
- package/dist/client/static/js/{index-mxpgfj6p.js → index-13xbwcbz.js} +2 -2
- package/dist/client/static/js/{index-4j5jwb54.js → index-1c0pnsjd.js} +2 -2
- package/dist/client/static/js/index-1rxa9zxp.js +1 -0
- package/dist/client/static/js/{index-aznkfx1z.js → index-2hpy58d0.js} +2 -2
- package/dist/client/static/js/{index-4j1g7m8g.js → index-2x9eqztp.js} +1 -1
- package/dist/client/static/js/{index-vv9ytx0t.js → index-4cncqz8j.js} +2 -2
- package/dist/client/static/js/index-4j8rgr4p.js +1 -0
- package/dist/client/static/js/{index-pp6mss9b.js → index-4mstdh41.js} +3 -3
- package/dist/client/static/js/index-4z4ax55k.js +12 -0
- package/dist/client/static/js/{index-q1bqg4f6.js → index-6ge6gk9w.js} +1 -1
- package/dist/client/static/js/{index-c003wb3r.js → index-7t63akyt.js} +1 -1
- package/dist/client/static/js/{index-ys4t1am4.js → index-8b3t2y77.js} +2 -2
- package/dist/client/static/js/index-8hgm0abr.js +474 -0
- package/dist/client/static/js/index-8jqawh3r.js +2 -0
- package/dist/client/static/js/index-95en3p3g.js +9 -0
- package/dist/client/static/js/{index-dj7y2df7.js → index-97qst4k9.js} +2 -2
- package/dist/client/static/js/{index-018ehs1n.js → index-9vdbnvmk.js} +1 -1
- package/dist/client/static/js/{index-harsfp4x.js → index-a9t9gdew.js} +9 -9
- package/dist/client/static/js/{index-8888hgj8.js → index-b4y5g48d.js} +5 -5
- package/dist/client/static/js/{index-gx2xefdg.js → index-czagykbq.js} +2 -2
- package/dist/client/static/js/{index-r1fe56cn.js → index-dfqmwm7j.js} +2 -2
- package/dist/client/static/js/{index-cccrappc.js → index-dydwcp3n.js} +2 -2
- package/dist/client/static/js/{index-jy91r3ap.js → index-e1yz59fa.js} +2 -2
- package/dist/client/static/js/{index-ce4vytm6.js → index-e6any867.js} +2 -2
- package/dist/client/static/js/{index-wy05jt00.js → index-ejdnjh5c.js} +2 -2
- package/dist/client/static/js/index-f4vr1c6e.css +1 -0
- package/dist/client/static/js/{index-9wjnbb3q.js → index-feffxxss.js} +2 -2
- package/dist/client/static/js/{index-547h1b8j.js → index-grczkttn.js} +13 -13
- package/dist/client/static/js/{index-s78n0dtv.js → index-hga3e13s.js} +2 -2
- package/dist/client/static/js/{index-d1vearmk.js → index-hw14rhen.js} +2 -2
- package/dist/client/static/js/index-hzwr5fm9.js +4 -0
- package/dist/client/static/js/{index-sj4y8kj2.js → index-j17h4z6f.js} +2 -2
- package/dist/client/static/js/{index-y5hxhr7q.js → index-ka2rc2cr.js} +5 -5
- package/dist/client/static/js/{index-b612vske.js → index-ktbrmp29.js} +2 -2
- package/dist/client/static/js/{index-ag78jnva.js → index-nbexks3x.js} +1 -1
- package/dist/client/static/js/{index-vwc8pdy3.js → index-nh29fkk9.js} +2 -2
- package/dist/client/static/js/{index-gn92c6hp.js → index-p0ez6hqd.js} +2 -2
- package/dist/client/static/js/{index-173x4bh0.js → index-pkes9492.js} +2 -2
- package/dist/client/static/js/{index-fg965t62.js → index-pysqpc5n.js} +2 -2
- package/dist/client/static/js/index-qj34r6d0.js +1 -0
- package/dist/client/static/js/{index-ek4gwrm8.js → index-qx6x4z0y.js} +2 -2
- package/dist/client/static/js/{index-agdbjh5k.js → index-r8cc80w5.js} +2 -2
- package/dist/client/static/js/{index-2kg3r5jw.js → index-rab39785.js} +2 -2
- package/dist/client/static/js/{index-haaz8t7e.js → index-sk9ej289.js} +2 -2
- package/dist/client/static/js/{index-8ggxxp8c.js → index-sq3r1xhf.js} +2 -2
- package/dist/client/static/js/{index-wsqgp9jw.js → index-sx809d6d.js} +2 -2
- package/dist/client/static/js/{index-p2812ygk.js → index-sz3mxjvy.js} +1 -1
- package/dist/client/static/js/{index-69xe17c1.js → index-tqycj126.js} +2 -2
- package/dist/client/static/js/{index-js81yrmy.js → index-vcn1kcpy.js} +3 -3
- package/dist/client/static/js/{index-rvjc19x7.js → index-x7f5ysch.js} +2 -2
- package/dist/client/static/js/index-xe5cqwnf.js +1 -0
- package/dist/client/static/js/index-xxe52zrm.js +2 -0
- package/dist/client/static/js/{index-ek7hqfp0.js → index-yvxa7hd8.js} +2 -2
- package/dist/client/static/js/{index-qw5aqk2d.js → index-z6kpc98a.js} +1 -1
- package/dist/client/static/js/{index-yzg9mbsv.js → index-zjydzxhm.js} +1 -1
- package/dist/client/static/js/{index-6wtx7a9x.js → index-zvazj4va.js} +2 -2
- package/dist/client/static/js/info-A6RAGUB7-k0z5qdew.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-11trzn8c.js → infoDiagram-VRGFBTTK-tqytmzp1.js} +1 -1
- package/dist/client/static/js/ini-2gvjwh83.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-8xnnymb5.js → ishikawaDiagram-OU5B5YK6-rp77ff6m.js} +1 -1
- package/dist/client/static/js/java-1xwcq79s.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-wd47j0hy.js → journeyDiagram-ZHPQQLJL-c7bxrhf1.js} +2 -2
- package/dist/client/static/js/json-4pqjabgq.js +1 -0
- package/dist/client/static/js/jsx-wcsss15s.js +1 -0
- package/dist/client/static/js/{julia-c2q0vwpd.js → julia-2eekpjq8.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-s5rgcp44.js → kanban-definition-PNTS6WVX-j2pxewqq.js} +8 -8
- package/dist/client/static/js/lua-h7vjcn0h.js +1 -0
- package/dist/client/static/js/markdown-f30jjjh9.js +1 -0
- package/dist/client/static/js/{mermaid.core-9fxp8nt2.js → mermaid.core-cqqe1krg.js} +6 -6
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-4fyewtst.js → mindmap-definition-NLK3R4M7-s03k32p9.js} +9 -9
- package/dist/client/static/js/one-dark-pro-9tt0a020.js +1 -0
- package/dist/client/static/js/one-light-5fg4r0ra.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-6cnvmb2z.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-s2xe2e2k.js → pegDiagram-GJSIUBJH-dfg2j0zc.js} +1 -1
- package/dist/client/static/js/{perl-6pa0tn3b.js → perl-5vxax0nr.js} +1 -1
- package/dist/client/static/js/{php-1zy994pz.js → php-hgrgdq63.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-m9z1mztn.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-1szpjbzy.js → pieDiagram-5QR66LMP-pshd1j79.js} +1 -1
- package/dist/client/static/js/properties-ymexza6q.js +1 -0
- package/dist/client/static/js/python-31ycwa66.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-mv3ee2qa.js → quadrantDiagram-O4NWA36T-cvvvmtk2.js} +4 -4
- package/dist/client/static/js/r-t2nne4xp.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-8m9rkex6.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-wc55emj8.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-2y2rnrzq.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-zzcc9x0v.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-z82na5nb.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-hgdqjpm9.js → railroadDiagram-XR7U4H2S-h53p3sha.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-yrfjp9wx.js → requirementDiagram-PLB6GJNP-bdv2fkxd.js} +4 -4
- package/dist/client/static/js/{ruby-arvs7kz4.js → ruby-8pxcn21w.js} +1 -1
- package/dist/client/static/js/{rust-3ahjk339.js → rust-j80dxgjg.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-k7k871xa.js → sankeyDiagram-IPEJSGJF-xqnnvmhy.js} +2 -2
- package/dist/client/static/js/{sass-cmkf7nwd.js → sass-bm32bb5k.js} +1 -1
- package/dist/client/static/js/{scss-x7ddw6gb.js → scss-e2dndbfa.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-gd80m0as.js → sequenceDiagram-PO4LG4MO-3p67305f.js} +10 -10
- package/dist/client/static/js/{sizeCapture-INFHLROL-jv6p4834.js → sizeCapture-INFHLROL-f87525h7.js} +1 -1
- package/dist/client/static/js/sql-bwnasywx.js +1 -0
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-tvphxq2h.js → stateDiagram-v2-GCMORJYK-e5st1fy3.js} +6 -6
- package/dist/client/static/js/{svelte-0hv6pak2.js → svelte-ztkaww47.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-3dt7nxj2.js → swimlanes-2SLR337P-ceghkbez.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-vc8hvfya.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-40vvf856.js → timeline-definition-EJHVYXUP-f7evs443.js} +3 -3
- package/dist/client/static/js/treeView-Q6P3EWNA-kzh6cm3f.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-wz5ed560.js +1 -0
- package/dist/client/static/js/tsx-zfy727zs.js +1 -0
- package/dist/client/static/js/typescript-p3syh43m.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-g1j5x0xh.js → usecaseDiagram-POWQR4AR-0gpn21p7.js} +27 -27
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-5b8789qk.js → vennDiagram-UO4OBE2U-4spzy428.js} +3 -3
- package/dist/client/static/js/{vue-zccj3qa5.js → vue-xm1dxpmy.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-zewbfccz.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-c7x3za3w.js → wardleyDiagram-VNRHLVJA-745xr2pa.js} +4 -4
- package/dist/client/static/js/xml-4enq788a.js +1 -0
- package/dist/client/static/js/xychartDiagram-PMCCYNJV-7dr9qwx5.js +7 -0
- package/dist/client/static/js/yaml-pjtt3jsc.js +1 -0
- package/package.json +1 -1
- package/src/client/components/common/batch-selection/folder-state.ts +2 -2
- package/src/client/components/common/server-control/Panel.tsx +16 -5
- package/src/client/components/common/server-control/index.test.tsx +63 -9
- package/src/client/components/common/session-row/TrailingSlot.tsx +8 -0
- package/src/client/components/common/session-row/index.tsx +16 -9
- package/src/client/components/layout/desktop-layout/LeftColumn.tsx +7 -0
- package/src/client/components/layout/session-sidebar/CategoryItem.tsx +1 -1
- package/src/client/components/layout/session-sidebar/ClassicView.tsx +13 -0
- package/src/client/components/layout/session-sidebar/HarnessFilter.tsx +175 -0
- package/src/client/components/layout/session-sidebar/SessionList.tsx +9 -1
- package/src/client/components/layout/session-sidebar/SessionsView.tsx +8 -1
- package/src/client/components/layout/session-sidebar/about-modal/index.test.tsx +1 -1
- package/src/client/components/layout/session-sidebar/harness-filter.test.tsx +173 -0
- package/src/client/components/layout/session-sidebar/modern/FilterChips.tsx +63 -18
- package/src/client/components/layout/session-sidebar/modern/SearchField.tsx +1 -1
- package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +21 -12
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +1 -1
- package/src/client/components/layout/session-sidebar/modern/index.tsx +11 -2
- package/src/client/components/layout/session-sidebar/modern/search-field.test.tsx +96 -0
- package/src/client/components/layout/session-sidebar/session-list-states.test.tsx +3 -0
- package/src/client/components/layout/session-sidebar/variant-props.ts +7 -0
- package/src/client/components/mobile/SessionSidebar.tsx +14 -21
- package/src/client/components/mobile/mobile-session-sidebar/ClassicDrawer.tsx +19 -0
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +1 -1
- package/src/client/components/settings/categories/omp-settings/EngineHeader.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/MessageList.test.ts +19 -19
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.image.test.ts +147 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.test.ts +51 -83
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +44 -63
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ReadDirectory.tsx +72 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ReadImage.tsx +51 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/read-test-util.ts +91 -0
- package/src/client/components/workspace/git-panel/commit-modal/CommitRow.test.ts +80 -62
- package/src/client/components/workspace/git-panel/commit-modal/CommitRow.tsx +15 -33
- package/src/client/components/workspace/git-panel/commit-modal/Header.tsx +1 -1
- package/src/client/components/workspace/terminal-panel/copy.test.ts +179 -0
- package/src/client/components/workspace/terminal-panel/copy.ts +76 -0
- package/src/client/components/workspace/terminal-panel/mount.ts +13 -0
- package/src/client/data/settings/omp-schema.json +39 -18
- package/src/client/hooks/chat/omp/pending-child.test.ts +1 -1
- package/src/client/hooks/chat/omp/session-sidebar-controller.test.ts +61 -0
- package/src/client/hooks/chat/omp/session-sidebar-controller.ts +37 -39
- package/src/client/hooks/chat/omp/sidebar-filter.ts +62 -0
- package/src/client/hooks/chat/timeline/session-changes.test.ts +85 -0
- package/src/client/hooks/chat/timeline/session-changes.ts +8 -5
- package/src/client/hooks/commands/use-command-runtime.ts +15 -0
- package/src/client/hooks/shell/servers.ts +60 -2
- package/src/client/hooks/ui/updates/check-request.ts +41 -0
- package/src/client/hooks/ui/updates/index.ts +13 -5
- package/src/client/hooks/ui/updates/mobile-flow.ts +56 -0
- package/src/client/lib/native/run-command.test.ts +95 -0
- package/src/client/lib/native/run-command.ts +52 -0
- package/src/client/lib/router/open-session.test.ts +26 -1
- package/src/client/lib/router/open-session.ts +21 -0
- package/src/client/main.tsx +9 -0
- package/src/client/tailwind.css +58 -0
- package/src/server/lib/changes/capture-shell.test.ts +253 -0
- package/src/server/lib/changes/capture-targets.test.ts +83 -0
- package/src/server/lib/changes/capture-targets.ts +51 -0
- package/src/server/lib/changes/capture-write.server.ts +2 -2
- package/src/server/lib/changes/capture.server.ts +14 -29
- package/src/server/lib/changes/capture.test.ts +69 -149
- package/src/server/lib/changes/patch-paths.ts +37 -0
- package/src/server/lib/harness/acp/commands.test.ts +1 -0
- package/src/server/lib/harness/acp/commands.ts +12 -4
- package/src/server/lib/harness/acp/replay-transcript.ts +32 -13
- package/src/server/lib/harness/acp/session-transcript.server.test.ts +162 -0
- package/src/server/lib/harness/acp/session-transcript.server.ts +350 -0
- package/src/server/lib/harness/acp/session.ts +6 -1
- package/src/server/lib/harness/schema.server.ts +18 -0
- package/src/server/lib/harness/spawn.server.ts +14 -1
- package/src/server/lib/models/provider-icon-fetch.ts +2 -2
- package/src/server/lib/models/provider-icon-parse.test.ts +0 -12
- package/src/server/lib/models/provider-icon-parse.ts +0 -8
- package/src/server/lib/omp/rpc/frame-fold.test.ts +16 -1
- package/src/server/lib/omp/rpc/frame-fold.ts +17 -4
- package/src/server/lib/omp/session/blobs.server.test.ts +34 -0
- package/src/server/lib/omp/session/blobs.server.ts +8 -3
- package/src/server/lib/omp/session/delete.server.ts +4 -0
- package/src/server/lib/omp/session/sidebar-activity.server.test.ts +2 -1
- package/src/server/routes/agent/harness-command.test.ts +71 -0
- package/src/server/routes/agent/harness-command.ts +27 -13
- package/src/server/routes/chat/imported.ts +5 -2
- package/src/server/routes/chat/live-meta.ts +42 -0
- package/src/server/routes/chat/session.test.ts +110 -0
- package/src/server/routes/chat/session.ts +31 -34
- package/src/shared/lib/chat/transcript-rows.ts +22 -0
- package/src/shared/lib/commands/catalog.test.ts +36 -0
- package/src/shared/lib/commands/catalog.ts +16 -0
- package/src/shared/lib/fs/file-kind.test.ts +46 -3
- package/src/shared/lib/fs/file-kind.ts +40 -9
- package/src/shared/lib/omp/config/schema-releases.test.ts +29 -0
- package/src/shared/lib/updates/popup-state.ts +11 -0
- package/src/shared/lib/workspace/harness-filter.test.ts +89 -0
- package/src/shared/lib/workspace/harness-filter.ts +75 -0
- package/src/{client/lib → shared/lib/workspace}/session-tree.test.ts +1 -1
- package/src/shared/lib/workspace/session-visibility.test.ts +71 -0
- package/src/shared/lib/workspace/session-visibility.ts +48 -23
- package/src/shared/lib/workspace/sidebar-filter-row.test.ts +64 -23
- package/src/shared/lib/workspace/sidebar-filter-row.ts +89 -31
- package/dist/client/static/js/ImageView-c139r891.js +0 -1
- package/dist/client/static/js/LayoutWrapper-08axzr3a.js +0 -2
- package/dist/client/static/js/Modal-0weqfqvk.js +0 -38
- package/dist/client/static/js/SessionsView-awef8ehj.js +0 -1
- package/dist/client/static/js/architecture-7GRP2DOG-6rbq97t9.js +0 -1
- package/dist/client/static/js/architectureDiagram-NJMV4G6O-9bk6ykn7.js +0 -36
- package/dist/client/static/js/bash-vv2ysp0a.js +0 -1
- package/dist/client/static/js/c-67jyc7sg.js +0 -1
- package/dist/client/static/js/c4Diagram-YGBWAQC7-jn9j4n04.js +0 -38
- package/dist/client/static/js/cpp-crfbnwv8.js +0 -1
- package/dist/client/static/js/css-983fbv00.js +0 -1
- package/dist/client/static/js/css-zj4qzw6r.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-zafxcz2k.js +0 -1
- package/dist/client/static/js/diagram-ATOU4E4O-dnar0ktg.js +0 -3
- package/dist/client/static/js/diagram-CDSNMT55-bt0fhk7n.js +0 -30
- package/dist/client/static/js/eventmodeling-NTZA5JFV-cq3dvz7e.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-spzh2jxq.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-epgk26pj.js +0 -1
- package/dist/client/static/js/graphql-dewsj5g1.js +0 -1
- package/dist/client/static/js/html-1cpe2xc8.js +0 -1
- package/dist/client/static/js/index-bdz08fe2.js +0 -12
- package/dist/client/static/js/index-bgpcf3mr.js +0 -1
- package/dist/client/static/js/index-bj3wn9je.js +0 -1
- package/dist/client/static/js/index-dhrp656p.js +0 -1
- package/dist/client/static/js/index-g10nr8m6.js +0 -9
- package/dist/client/static/js/index-j4ks5s41.js +0 -474
- package/dist/client/static/js/index-jqs23cc7.css +0 -1
- package/dist/client/static/js/index-qnt118mp.js +0 -2
- package/dist/client/static/js/index-qntpsp98.js +0 -2
- package/dist/client/static/js/index-w130cs7d.js +0 -1
- package/dist/client/static/js/index-wv36ddd5.js +0 -314
- package/dist/client/static/js/index-y82bk3hr.js +0 -4
- package/dist/client/static/js/info-A6RAGUB7-0an46pag.js +0 -1
- package/dist/client/static/js/ini-09e0scxh.js +0 -1
- package/dist/client/static/js/java-vnaesxzs.js +0 -1
- package/dist/client/static/js/json-g5ggnd94.js +0 -1
- package/dist/client/static/js/jsx-xz71aed4.js +0 -1
- package/dist/client/static/js/lua-e4wenyzt.js +0 -1
- package/dist/client/static/js/markdown-yv3p1p7m.js +0 -1
- package/dist/client/static/js/one-dark-pro-ahch85zb.js +0 -1
- package/dist/client/static/js/one-light-9706jgqt.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-5e397pav.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-0zzmzg64.js +0 -1
- package/dist/client/static/js/properties-0ag74bdj.js +0 -1
- package/dist/client/static/js/python-zsn5tdbj.js +0 -1
- package/dist/client/static/js/r-mwtqhnw3.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-mtar9742.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-d6a6j9fq.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-1257kd8x.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-v8b6qmas.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-jxpbx410.js +0 -1
- package/dist/client/static/js/sql-aczp05f2.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-aqnh1hhp.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-q3qr7ew7.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-zgbdydeq.js +0 -1
- package/dist/client/static/js/tsx-s1shkfg9.js +0 -1
- package/dist/client/static/js/typescript-htx9v6bf.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-b230aajh.js +0 -1
- package/dist/client/static/js/xml-23y6pgvx.js +0 -1
- package/dist/client/static/js/xychartDiagram-PMCCYNJV-h0fy45tg.js +0 -7
- package/dist/client/static/js/yaml-vrayja34.js +0 -1
- /package/src/{client/lib → shared/lib/workspace}/session-tree.ts +0 -0
|
@@ -34,7 +34,13 @@ import {
|
|
|
34
34
|
import { markPendingSessionWaiting } from '@/client/hooks/chat/omp/pending-waiting';
|
|
35
35
|
import { useWaitingPrompts } from '@/client/hooks/chat/waiting/store';
|
|
36
36
|
import { withPendingRows } from '@/client/hooks/chat/omp/pending-rows';
|
|
37
|
+
import { filterFoldersBySearch } from '@/client/hooks/chat/omp/sidebar-filter';
|
|
37
38
|
import { useFolderAutoExpand } from '@/client/hooks/chat/omp/folder-auto-expand';
|
|
39
|
+
import {
|
|
40
|
+
harnessFilterFolders,
|
|
41
|
+
harnessFilterOptions,
|
|
42
|
+
type HarnessFilterOption,
|
|
43
|
+
} from '@/shared/lib/workspace/harness-filter';
|
|
38
44
|
import { writeSetting } from '@/shared/lib/settings/client';
|
|
39
45
|
import { subscribeSessionKey } from '@/shared/lib/workspace/session-state/listeners';
|
|
40
46
|
import { CHAT_DRAFT_ATTACHMENTS_KEY, CHAT_DRAFT_KEY } from '@/shared/lib/chat/composer/draft';
|
|
@@ -81,6 +87,11 @@ export interface SessionSidebarController {
|
|
|
81
87
|
setOptionsOpen: (value: boolean) => void;
|
|
82
88
|
sortOption: SessionSortOption;
|
|
83
89
|
handleSortChange: (opt: SessionSortOption) => void;
|
|
90
|
+
/** The harness the list is narrowed to, or null for every harness. */
|
|
91
|
+
harnessFilter: string | null;
|
|
92
|
+
setHarnessFilter: (harness: string | null) => void;
|
|
93
|
+
/** The harnesses the list holds, with row counts — the filter's menu. */
|
|
94
|
+
harnessOptions: HarnessFilterOption[];
|
|
84
95
|
processedFolders: WorkspaceFolderData[];
|
|
85
96
|
sessionStatus: Record<string, 'stream' | 'finish' | 'abort'>;
|
|
86
97
|
handleSelectSession: (id: number | string) => void;
|
|
@@ -113,6 +124,9 @@ export function useSessionSidebarController(
|
|
|
113
124
|
|
|
114
125
|
const [searchQuery, setSearchQuery] = useState('');
|
|
115
126
|
const [showArchived, setShowArchived] = useState(false);
|
|
127
|
+
// Which agent ran the chat. In-memory like the search and the archive toggle:
|
|
128
|
+
// a filter is a way of looking at the list, not a preference about it.
|
|
129
|
+
const [harnessFilter, setHarnessFilter] = useState<string | null>(null);
|
|
116
130
|
const [optionsOpen, setOptionsOpen] = useState(false);
|
|
117
131
|
// Seeded from the server (app_settings.omp_sidebar_sort) so the SSR HTML and
|
|
118
132
|
// the first client render agree. With no stored preference the sidebar opens
|
|
@@ -265,45 +279,28 @@ export function useSessionSidebarController(
|
|
|
265
279
|
onAfterSelect?.();
|
|
266
280
|
};
|
|
267
281
|
|
|
268
|
-
//
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
282
|
+
// The list before any filter: the server's folders plus the pending rows. A
|
|
283
|
+
// pending row joins BEFORE the filters — the row exists because omp's
|
|
284
|
+
// transcript scan cannot see the session yet, and a row the user's own search
|
|
285
|
+
// hides is a row the search never offered to find.
|
|
286
|
+
const baseFolders = useMemo(
|
|
287
|
+
() => withPendingRows(folders, pendingEntries, {
|
|
274
288
|
activeId: sessionParam,
|
|
275
289
|
urlFolderId: folderIdParam,
|
|
276
290
|
titleFor: titleHint,
|
|
277
|
-
})
|
|
291
|
+
}),
|
|
292
|
+
[folders, pendingEntries, sessionParam, folderIdParam, titleHint],
|
|
293
|
+
);
|
|
278
294
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
const matchFolder = folder.name.toLowerCase().includes(q);
|
|
289
|
-
const matchSession = folder.sessions?.some(matchesSession);
|
|
290
|
-
return matchFolder || matchSession;
|
|
291
|
-
}).map(folder => {
|
|
292
|
-
// If we are searching, we also filter the sessions within the folder
|
|
293
|
-
const filteredSessions = folder.sessions?.filter((s) =>
|
|
294
|
-
folder.name.toLowerCase().includes(q) || matchesSession(s)
|
|
295
|
-
);
|
|
296
|
-
return { ...folder, sessions: filteredSessions, isExpanded: true };
|
|
297
|
-
});
|
|
298
|
-
} else {
|
|
299
|
-
result = result.map(folder => {
|
|
300
|
-
const matchesFolderName = folder.name.toLowerCase().includes(q);
|
|
301
|
-
const filteredSessions = (folder.sessions || []).filter(matchesSession);
|
|
302
|
-
if (matchesFolderName) return folder;
|
|
303
|
-
return { ...folder, sessions: filteredSessions };
|
|
304
|
-
}).filter(f => f.sessions && f.sessions.length > 0);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
295
|
+
// Counted over the list BEFORE the search and the harness filter, so an
|
|
296
|
+
// entry's number is a fact about the workspaces rather than about what is on
|
|
297
|
+
// screen — "3 claude" stays readable while the list is narrowed to `codex`.
|
|
298
|
+
const harnessOptions = useMemo(() => harnessFilterOptions(baseFolders), [baseFolders]);
|
|
299
|
+
|
|
300
|
+
// Filter and sort folders
|
|
301
|
+
const processedFolders = useMemo(() => {
|
|
302
|
+
let result = filterFoldersBySearch(baseFolders, searchQuery, expandSearchMatches);
|
|
303
|
+
result = harnessFilterFolders(result, harnessFilter);
|
|
307
304
|
|
|
308
305
|
// A run in flight opens its folder in the SAME frame the spinner appears,
|
|
309
306
|
// and keeps it open if the toggle write is refused. The write below makes
|
|
@@ -315,10 +312,8 @@ export function useSessionSidebarController(
|
|
|
315
312
|
}
|
|
316
313
|
|
|
317
314
|
// Ordering is shared with the other sidebar so the two cannot drift.
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
return result;
|
|
321
|
-
}, [folders, pendingEntries, searchQuery, sortOption, sessionParam, folderIdParam, expandSearchMatches, titleHint, runningFolderIds]);
|
|
315
|
+
return sortFolders(result, sortOption);
|
|
316
|
+
}, [baseFolders, searchQuery, harnessFilter, sortOption, expandSearchMatches, runningFolderIds]);
|
|
322
317
|
|
|
323
318
|
return {
|
|
324
319
|
folders,
|
|
@@ -338,6 +333,9 @@ export function useSessionSidebarController(
|
|
|
338
333
|
setOptionsOpen,
|
|
339
334
|
sortOption,
|
|
340
335
|
handleSortChange,
|
|
336
|
+
harnessFilter,
|
|
337
|
+
setHarnessFilter,
|
|
338
|
+
harnessOptions,
|
|
341
339
|
processedFolders,
|
|
342
340
|
sessionStatus,
|
|
343
341
|
handleSelectSession,
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The sidebar's row filters, as pure functions.
|
|
8
|
+
*
|
|
9
|
+
* Extracted from the controller so the controller stays a wiring module: the
|
|
10
|
+
* search rule is the one with a subtle branch (the desktop force-expands a
|
|
11
|
+
* match, the phone does not), and it is easier to read — and to test — beside
|
|
12
|
+
* the harness rule than inside a 300-line hook.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { WorkspaceFolderData } from '@/shared/types';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Narrow the list to what the query names.
|
|
19
|
+
*
|
|
20
|
+
* A session matches on its title OR its id: the id is what "Copy session ID"
|
|
21
|
+
* puts on the clipboard, and a search that could not find the string it just
|
|
22
|
+
* handed the user would be a dead end.
|
|
23
|
+
*
|
|
24
|
+
* `expandMatches` is the desktop's rule — a folder whose NAME matched keeps all
|
|
25
|
+
* its rows and opens, because the user asked for the workspace. The phone
|
|
26
|
+
* filters without expanding and drops a folder that has nothing left to show.
|
|
27
|
+
*/
|
|
28
|
+
export function filterFoldersBySearch(
|
|
29
|
+
folders: readonly WorkspaceFolderData[],
|
|
30
|
+
query: string,
|
|
31
|
+
expandMatches: boolean,
|
|
32
|
+
): WorkspaceFolderData[] {
|
|
33
|
+
if (!query.trim()) return folders as WorkspaceFolderData[];
|
|
34
|
+
const q = query.toLowerCase();
|
|
35
|
+
const matchesSession = (session: { id: number | string; title: string }) =>
|
|
36
|
+
session.title.toLowerCase().includes(q) || String(session.id).toLowerCase().includes(q);
|
|
37
|
+
|
|
38
|
+
if (expandMatches) {
|
|
39
|
+
return folders
|
|
40
|
+
.filter((folder) => {
|
|
41
|
+
const matchFolder = folder.name.toLowerCase().includes(q);
|
|
42
|
+
const matchSession = folder.sessions?.some(matchesSession);
|
|
43
|
+
return matchFolder || matchSession;
|
|
44
|
+
})
|
|
45
|
+
.map((folder) => {
|
|
46
|
+
// If we are searching, we also filter the sessions within the folder
|
|
47
|
+
const filteredSessions = folder.sessions?.filter((session) =>
|
|
48
|
+
folder.name.toLowerCase().includes(q) || matchesSession(session)
|
|
49
|
+
);
|
|
50
|
+
return { ...folder, sessions: filteredSessions, isExpanded: true };
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return folders
|
|
55
|
+
.map((folder) => {
|
|
56
|
+
const matchesFolderName = folder.name.toLowerCase().includes(q);
|
|
57
|
+
const filteredSessions = (folder.sessions || []).filter(matchesSession);
|
|
58
|
+
if (matchesFolderName) return folder;
|
|
59
|
+
return { ...folder, sessions: filteredSessions };
|
|
60
|
+
})
|
|
61
|
+
.filter((folder) => folder.sessions && folder.sessions.length > 0);
|
|
62
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The change list's read timing.
|
|
8
|
+
*
|
|
9
|
+
* A reader who opens a LIVE session must still see the settled runs' file
|
|
10
|
+
* lists. The hook used to skip the read while `isGenerating`, so a session
|
|
11
|
+
* opened mid-run showed no changes section at all — even though the journal
|
|
12
|
+
* already held every earlier run. The mid-run read is safe: the current run's
|
|
13
|
+
* partial records are bucketed into a run whose footer is not rendered yet.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
|
|
17
|
+
import { Window } from 'happy-dom';
|
|
18
|
+
import { h, render } from 'preact';
|
|
19
|
+
import { act } from 'preact/test-utils';
|
|
20
|
+
import { useSessionChanges } from '@/client/hooks/chat/timeline/session-changes';
|
|
21
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
22
|
+
|
|
23
|
+
let container: HTMLElement;
|
|
24
|
+
const mounted: HTMLElement[] = [];
|
|
25
|
+
let originalFetch: typeof fetch;
|
|
26
|
+
|
|
27
|
+
beforeAll(() => {
|
|
28
|
+
installDomGlobals(new Window({ url: 'http://localhost' }));
|
|
29
|
+
originalFetch = globalThis.fetch;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
afterEach(() => {
|
|
33
|
+
for (const node of mounted.splice(0)) render(null, node);
|
|
34
|
+
globalThis.fetch = originalFetch;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
afterAll(() => {
|
|
38
|
+
restoreDomGlobals();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
function Probe({ sessionId, isGenerating }: { sessionId: string; isGenerating: boolean }) {
|
|
42
|
+
const records = useSessionChanges(sessionId, isGenerating);
|
|
43
|
+
return h('div', { 'data-count': String(records.length) });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
describe('useSessionChanges', () => {
|
|
47
|
+
test('reads on mount even while generating, so settled runs show', async () => {
|
|
48
|
+
let calls = 0;
|
|
49
|
+
let release: (response: Response) => void = () => {};
|
|
50
|
+
const pending = new Promise<Response>((resolve) => {
|
|
51
|
+
release = resolve;
|
|
52
|
+
});
|
|
53
|
+
globalThis.fetch = (() => {
|
|
54
|
+
calls += 1;
|
|
55
|
+
return pending;
|
|
56
|
+
}) as unknown as typeof fetch;
|
|
57
|
+
|
|
58
|
+
container = document.createElement('div');
|
|
59
|
+
document.body.appendChild(container);
|
|
60
|
+
mounted.push(container);
|
|
61
|
+
|
|
62
|
+
await act(async () => {
|
|
63
|
+
render(h(Probe, { sessionId: 's1', isGenerating: true }), container);
|
|
64
|
+
});
|
|
65
|
+
expect(calls).toBe(1);
|
|
66
|
+
|
|
67
|
+
await act(async () => {
|
|
68
|
+
release(
|
|
69
|
+
new Response(
|
|
70
|
+
JSON.stringify({
|
|
71
|
+
records: [
|
|
72
|
+
{ at: 1, agent: 'Main', tool: 'edit', path: '/repo/a.ts', displayPath: 'a.ts', before: 'a', after: 'b' },
|
|
73
|
+
],
|
|
74
|
+
}),
|
|
75
|
+
{ status: 200 },
|
|
76
|
+
),
|
|
77
|
+
);
|
|
78
|
+
await pending;
|
|
79
|
+
// Let the hook's `res.json()` and `setRecords` run before the act flushes.
|
|
80
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
expect(container.querySelector('div')?.getAttribute('data-count')).toBe('1');
|
|
84
|
+
});
|
|
85
|
+
});
|
|
@@ -6,10 +6,14 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* The session's agent change journal, for the chat's per-run file list.
|
|
8
8
|
*
|
|
9
|
-
* Read
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* Read on mount and again when a run settles. The mid-run read is deliberate:
|
|
10
|
+
* the journal is written while the agent works, so the CURRENT run's records
|
|
11
|
+
* are partial — but the settled runs' records are complete, and a reader who
|
|
12
|
+
* opens a live session must still see their file lists. The current run's
|
|
13
|
+
* partial records are bucketed into a run whose footer is not rendered yet, so
|
|
14
|
+
* they do not show until the settle read. A failed read keeps the previous
|
|
15
|
+
* list — a transient 500 is not a reason to blank a summary the reader is
|
|
16
|
+
* looking at.
|
|
13
17
|
*/
|
|
14
18
|
|
|
15
19
|
import { useEffect, useState } from 'preact/hooks';
|
|
@@ -31,7 +35,6 @@ export function useSessionChanges(
|
|
|
31
35
|
setRecords([]);
|
|
32
36
|
return;
|
|
33
37
|
}
|
|
34
|
-
if (isGenerating) return;
|
|
35
38
|
let cancelled = false;
|
|
36
39
|
void (async () => {
|
|
37
40
|
try {
|
|
@@ -19,6 +19,8 @@ import { setUserKeybindings } from '@/client/lib/commands/keymap';
|
|
|
19
19
|
import { registerCommand } from '@/client/lib/commands/registry';
|
|
20
20
|
import { editorCommandTarget } from '@/client/lib/commands/editor-target';
|
|
21
21
|
import { openKeyBindingHelp, openPalette } from '@/client/lib/commands/overlays';
|
|
22
|
+
import { openEmptyWorkspace } from '@/client/lib/router/open-session';
|
|
23
|
+
import { UPDATE_CHECK_EVENT } from '@/shared/lib/updates/popup-state';
|
|
22
24
|
import type { EditorCommand } from '@/shared/lib/code/editor/keymap';
|
|
23
25
|
import { readUserKeybindings } from '@/shared/lib/commands/user-keybindings';
|
|
24
26
|
import { isMacPlatform, isWindowsPlatform } from '@/shared/lib/util/platform';
|
|
@@ -42,6 +44,19 @@ export function useCommandRuntime(): void {
|
|
|
42
44
|
registerCommand('workspace.commandPalette', () => openPalette('commands')),
|
|
43
45
|
registerCommand('workspace.quickOpen', () => openPalette('files')),
|
|
44
46
|
registerCommand('workspace.keyBindings', () => openKeyBindingHelp()),
|
|
47
|
+
// The sidebar's primary action, reachable from the native File menu and
|
|
48
|
+
// the palette. It clears the routing state rather than minting a pending
|
|
49
|
+
// chat — see `SessionsView.handleNewSession`.
|
|
50
|
+
registerCommand('workspace.newSession', () => {
|
|
51
|
+
openEmptyWorkspace();
|
|
52
|
+
}),
|
|
53
|
+
// The native App menu's "Check for Updates…" asks the page, because the
|
|
54
|
+
// check and its verdict live in `useUpdates` on whichever sidebar is
|
|
55
|
+
// mounted. A second copy of the request here would be a second source of
|
|
56
|
+
// truth for the same state.
|
|
57
|
+
registerCommand('workspace.checkUpdates', () => {
|
|
58
|
+
window.dispatchEvent(new CustomEvent(UPDATE_CHECK_EVENT));
|
|
59
|
+
}),
|
|
45
60
|
registerCommand('workspace.saveFile', () => editorCommandTarget()?.saveNow()),
|
|
46
61
|
registerCommand('editor.run', (args) => {
|
|
47
62
|
const command = (args as { command?: EditorCommand } | undefined)?.command;
|
|
@@ -38,8 +38,13 @@ export interface ShellServersStore {
|
|
|
38
38
|
state: ShellServersState | null;
|
|
39
39
|
/** A request is in flight; the panel disables its controls rather than queueing. */
|
|
40
40
|
busy: boolean;
|
|
41
|
+
/** A MANUAL refresh is in flight; the button spins. The 4-second poll does not. */
|
|
42
|
+
refreshing: boolean;
|
|
41
43
|
error: string | null;
|
|
42
44
|
reload: () => Promise<void>;
|
|
45
|
+
/** Re-read the list for the refresh button, with a visible spin. */
|
|
46
|
+
refresh: () => Promise<void>;
|
|
47
|
+
dismissError: () => void;
|
|
43
48
|
activate: (id: string) => Promise<boolean>;
|
|
44
49
|
add: (label: string, url: string) => Promise<boolean>;
|
|
45
50
|
remove: (id: string) => Promise<boolean>;
|
|
@@ -58,16 +63,27 @@ export interface ShellServersStore {
|
|
|
58
63
|
*/
|
|
59
64
|
const REFRESH_INTERVAL_MS = 4000;
|
|
60
65
|
|
|
66
|
+
/**
|
|
67
|
+
* How long the refresh button keeps spinning, at minimum.
|
|
68
|
+
*
|
|
69
|
+
* A local list answers in a few milliseconds, so a spin tied only to the request
|
|
70
|
+
* would be over before the eye caught it and the button would read as dead. The
|
|
71
|
+
* floor is feedback, not a delay: the read has already happened, and the button
|
|
72
|
+
* is disabled for exactly as long as it is drawn as working.
|
|
73
|
+
*/
|
|
74
|
+
const MIN_REFRESH_MS = 400;
|
|
75
|
+
|
|
61
76
|
export function useShellServers(open: boolean): ShellServersStore {
|
|
62
77
|
const available = hasShellBridge();
|
|
63
78
|
const [state, setState] = useState<ShellServersState | null>(null);
|
|
64
79
|
const [busy, setBusy] = useState(false);
|
|
80
|
+
const [refreshing, setRefreshing] = useState(false);
|
|
65
81
|
const [error, setError] = useState<string | null>(null);
|
|
66
82
|
// A mutation and a poll can overlap; the poll must not overwrite the answer
|
|
67
83
|
// the user's own click produced. The counter is what tells them apart.
|
|
68
84
|
const mutationsRef = useRef(0);
|
|
69
85
|
|
|
70
|
-
const
|
|
86
|
+
const read = useCallback(async () => {
|
|
71
87
|
if (!available) return;
|
|
72
88
|
const ticket = mutationsRef.current;
|
|
73
89
|
try {
|
|
@@ -78,6 +94,27 @@ export function useShellServers(open: boolean): ShellServersStore {
|
|
|
78
94
|
}
|
|
79
95
|
}, [available]);
|
|
80
96
|
|
|
97
|
+
const reload = useCallback(() => read(), [read]);
|
|
98
|
+
|
|
99
|
+
const refresh = useCallback(async () => {
|
|
100
|
+
if (!available) return;
|
|
101
|
+
setRefreshing(true);
|
|
102
|
+
const started = Date.now();
|
|
103
|
+
try {
|
|
104
|
+
await read();
|
|
105
|
+
} finally {
|
|
106
|
+
const remaining = MIN_REFRESH_MS - (Date.now() - started);
|
|
107
|
+
if (remaining > 0) {
|
|
108
|
+
const { promise, resolve } = Promise.withResolvers<void>();
|
|
109
|
+
setTimeout(resolve, remaining);
|
|
110
|
+
await promise;
|
|
111
|
+
}
|
|
112
|
+
setRefreshing(false);
|
|
113
|
+
}
|
|
114
|
+
}, [available, read]);
|
|
115
|
+
|
|
116
|
+
const dismissError = useCallback(() => setError(null), []);
|
|
117
|
+
|
|
81
118
|
const run = useCallback(
|
|
82
119
|
async (action: () => Promise<ShellServersState>) => {
|
|
83
120
|
mutationsRef.current += 1;
|
|
@@ -101,6 +138,13 @@ export function useShellServers(open: boolean): ShellServersStore {
|
|
|
101
138
|
void reload();
|
|
102
139
|
}, [available, reload]);
|
|
103
140
|
|
|
141
|
+
// The error belongs to the panel session that produced it. Closing the panel
|
|
142
|
+
// is the user saying they are done with it; keeping the sentence for the next
|
|
143
|
+
// open is how a failed Start left a warning on screen until the page reloaded.
|
|
144
|
+
useEffect(() => {
|
|
145
|
+
if (!open) setError(null);
|
|
146
|
+
}, [open]);
|
|
147
|
+
|
|
104
148
|
useEffect(() => {
|
|
105
149
|
if (!available || !open) return;
|
|
106
150
|
const timer = setInterval(() => void reload(), REFRESH_INTERVAL_MS);
|
|
@@ -125,5 +169,19 @@ export function useShellServers(open: boolean): ShellServersStore {
|
|
|
125
169
|
|
|
126
170
|
const stop = useCallback((id: string) => run(() => stopLocalServer(id)), [run]);
|
|
127
171
|
|
|
128
|
-
return {
|
|
172
|
+
return {
|
|
173
|
+
available,
|
|
174
|
+
state,
|
|
175
|
+
busy,
|
|
176
|
+
refreshing,
|
|
177
|
+
error,
|
|
178
|
+
reload,
|
|
179
|
+
refresh,
|
|
180
|
+
dismissError,
|
|
181
|
+
activate,
|
|
182
|
+
add,
|
|
183
|
+
remove,
|
|
184
|
+
start,
|
|
185
|
+
stop,
|
|
186
|
+
};
|
|
129
187
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The native App menu's "Check for Updates…", shared by both layouts.
|
|
8
|
+
*
|
|
9
|
+
* The menu row cannot read the console's update state, and a second copy of the
|
|
10
|
+
* request would be a second source of truth for the same check. The row
|
|
11
|
+
* dispatches `omp:update-check`; whichever sidebar is mounted owns `useUpdates`
|
|
12
|
+
* and runs the ONE check, then reports the verdict — the popup when a release is
|
|
13
|
+
* available, a sentence when there is not.
|
|
14
|
+
*
|
|
15
|
+
* Both sidebars mount this hook because only one of them is on screen at a time,
|
|
16
|
+
* and the rule "one check, one verdict" is easier to keep in one place than in
|
|
17
|
+
* two handlers that have to stay identical.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { useKabmoEvent } from '@/client/hooks/ui/window-event';
|
|
21
|
+
import type { UseUpdatesResult } from '@/client/hooks/ui/updates';
|
|
22
|
+
import { UPDATE_CHECK_EVENT, UPDATE_POPUP_OPEN_EVENT } from '@/shared/lib/updates/popup-state';
|
|
23
|
+
import type { ToastTone } from '@/shared/lib/ui/toast-duration';
|
|
24
|
+
|
|
25
|
+
export function useUpdateCheckRequest(
|
|
26
|
+
updates: UseUpdatesResult,
|
|
27
|
+
pushToast: (message: string, type?: ToastTone) => void,
|
|
28
|
+
): void {
|
|
29
|
+
useKabmoEvent(UPDATE_CHECK_EVENT, () => {
|
|
30
|
+
void updates.check().then((result) => {
|
|
31
|
+
// A failed check already has its own sentence in `updates.error`, and the
|
|
32
|
+
// About modal shows it; a toast here would only repeat it.
|
|
33
|
+
if (!result) return;
|
|
34
|
+
if (result.kabmo.updateAvailable) {
|
|
35
|
+
window.dispatchEvent(new CustomEvent(UPDATE_POPUP_OPEN_EVENT));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
pushToast('Kabmo is up to date.', 'success');
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
@@ -25,7 +25,12 @@ export interface UseUpdatesResult {
|
|
|
25
25
|
progress: UpdateLogState | null;
|
|
26
26
|
error: string | null;
|
|
27
27
|
hasUpdate: boolean;
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* The verdict, not just "done": a caller that asked for the check (the native
|
|
30
|
+
* menu's row) has to report it, and reading `info` from state right after the
|
|
31
|
+
* promise resolves is a race the returned value does not have.
|
|
32
|
+
*/
|
|
33
|
+
check: () => Promise<UpdateCheckResult | null>;
|
|
29
34
|
apply: (target: UpdateTarget) => Promise<UpdateApplyResult | null>;
|
|
30
35
|
}
|
|
31
36
|
|
|
@@ -81,16 +86,16 @@ export function useUpdates(options: UseUpdatesOptions = {}): UseUpdatesResult {
|
|
|
81
86
|
const [applying, setApplying] = useState<UpdateTarget | null>(null);
|
|
82
87
|
const [progress, setProgress] = useState<UpdateLogState | null>(null);
|
|
83
88
|
const [error, setError] = useState<string | null>(null);
|
|
84
|
-
const inFlightCheckRef = useRef<Promise<
|
|
89
|
+
const inFlightCheckRef = useRef<Promise<UpdateCheckResult | null> | null>(null);
|
|
85
90
|
const lastCheckAtRef = useRef(0);
|
|
86
91
|
const didAutoCheckRef = useRef(false);
|
|
87
92
|
const applyAbortRef = useRef<AbortController | null>(null);
|
|
88
93
|
|
|
89
|
-
const check = useCallback(() => {
|
|
94
|
+
const check = useCallback((): Promise<UpdateCheckResult | null> => {
|
|
90
95
|
if (inFlightCheckRef.current) return inFlightCheckRef.current;
|
|
91
96
|
|
|
92
97
|
lastCheckAtRef.current = Date.now();
|
|
93
|
-
const request = (async () => {
|
|
98
|
+
const request = (async (): Promise<UpdateCheckResult | null> => {
|
|
94
99
|
setChecking(true);
|
|
95
100
|
setError(null);
|
|
96
101
|
|
|
@@ -100,9 +105,12 @@ export function useUpdates(options: UseUpdatesOptions = {}): UseUpdatesResult {
|
|
|
100
105
|
if (!response.ok) {
|
|
101
106
|
throw new Error(responseMessage(payload, `Update check failed (HTTP ${response.status})`));
|
|
102
107
|
}
|
|
103
|
-
|
|
108
|
+
const result = payload as UpdateCheckResult;
|
|
109
|
+
setInfo(result);
|
|
110
|
+
return result;
|
|
104
111
|
} catch (cause) {
|
|
105
112
|
setError(cause instanceof Error ? cause.message : 'Unable to check for updates.');
|
|
113
|
+
return null;
|
|
106
114
|
} finally {
|
|
107
115
|
setChecking(false);
|
|
108
116
|
inFlightCheckRef.current = null;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The phone drawer's update flow: the popup's "Update now" handover, the native
|
|
8
|
+
* menu's check, and the shell offer the footer draws.
|
|
9
|
+
*
|
|
10
|
+
* Extracted from `MobileSessionSidebar` because that file is the drawer's
|
|
11
|
+
* dispatcher and sits at the repo's per-file ceiling; the flow is one cohesive
|
|
12
|
+
* unit (it owns `useUpdates` and every listener that acts on it), not a wrapper
|
|
13
|
+
* around a single call.
|
|
14
|
+
*
|
|
15
|
+
* The handover is the phone's own rule: the popup's "Update now" must bring the
|
|
16
|
+
* drawer forward, or the About modal opens over the chat while the user is
|
|
17
|
+
* still looking at the session list they came from.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { useKabmoEvent } from '@/client/hooks/ui/window-event';
|
|
21
|
+
import { useUpdates, type UseUpdatesResult } from '@/client/hooks/ui/updates';
|
|
22
|
+
import { useUpdateCheckRequest } from '@/client/hooks/ui/updates/check-request';
|
|
23
|
+
import { useShellOffer, type ShellDownload } from '@/client/hooks/ui/updates/shell-download';
|
|
24
|
+
import { UPDATE_REQUEST_EVENT } from '@/shared/lib/updates/popup-state';
|
|
25
|
+
import { updateOutcomeTone, type ToastTone } from '@/shared/lib/ui/toast-duration';
|
|
26
|
+
|
|
27
|
+
export interface MobileUpdateFlow {
|
|
28
|
+
updates: UseUpdatesResult;
|
|
29
|
+
/** An update inside a native shell, an install on an Android browser, nothing
|
|
30
|
+
* elsewhere — see `useShellOffer`. */
|
|
31
|
+
shellDownload: ShellDownload | null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function useMobileUpdateFlow(args: {
|
|
35
|
+
/** Bring the drawer forward before the About modal opens. */
|
|
36
|
+
onClose: () => void;
|
|
37
|
+
openAbout: () => void;
|
|
38
|
+
pushToast: (message: string, type?: ToastTone) => void;
|
|
39
|
+
}): MobileUpdateFlow {
|
|
40
|
+
const updates = useUpdates();
|
|
41
|
+
const shellDownload = useShellOffer();
|
|
42
|
+
|
|
43
|
+
useKabmoEvent(UPDATE_REQUEST_EVENT, () => {
|
|
44
|
+
args.onClose();
|
|
45
|
+
args.openAbout();
|
|
46
|
+
void updates.apply('kabmo').then((result) => {
|
|
47
|
+
if (!result) return;
|
|
48
|
+
args.pushToast(result.message, updateOutcomeTone(result));
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// The same native row as the desktop's: one check, one verdict, drawer stays.
|
|
53
|
+
useUpdateCheckRequest(updates, args.pushToast);
|
|
54
|
+
|
|
55
|
+
return { updates, shellDownload };
|
|
56
|
+
}
|