@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
|
@@ -115,19 +115,32 @@ function handleToolExecutionEnd(host: SessionFrameHost): void {
|
|
|
115
115
|
* 20 s run, and the first prompt was stored twice in Kabmo's copy of the
|
|
116
116
|
* conversation.
|
|
117
117
|
*
|
|
118
|
-
* The RUN is the attribution, and it covers every sender: while
|
|
119
|
-
*
|
|
120
|
-
*
|
|
118
|
+
* The RUN is the attribution, and it covers every sender: while a run is in
|
|
119
|
+
* flight, a prompt that opened no turn cannot be the settle of the turn the
|
|
120
|
+
* operator is watching. The auto-title request window is not sufficient on its
|
|
121
121
|
* own — it is armed around the `/rename`, and omp answers it in the same tick
|
|
122
122
|
* (~3 ms), so a frame that won that race reached the client regardless (the leak
|
|
123
123
|
* this replaces). Its flags are left alone too, exactly as the dispatcher leaves
|
|
124
124
|
* a non-owning command's (see `session-commands.ts`): the live run owns them.
|
|
125
125
|
*
|
|
126
|
+
* `streaming` alone is too narrow, and that is the second leak: it flips at
|
|
127
|
+
* `agent_start`, so the window between the prompt's DISPATCH and its first frame
|
|
128
|
+
* was open. A background command answered there — measured on a fresh session
|
|
129
|
+
* (omp 18.22.2): the plan-review `republish` the client fires on spawn adoption
|
|
130
|
+
* (`usePlanReview`) reached the child 43 ms after the prompt and omp answered it
|
|
131
|
+
* `agentInvoked:false` 160 ms before `agent_start`. The frame was forwarded, the
|
|
132
|
+
* client settled the optimistic turn, and the user echo that followed appended a
|
|
133
|
+
* second bubble — 57 of 58 first prompts rendered twice. `promptRunning` is set
|
|
134
|
+
* before the prompt is written and cleared only by a settle, so it covers the
|
|
135
|
+
* whole run; the dispatcher's own decline path (`session-commands.ts`, the
|
|
136
|
+
* `ack.agentInvoked === false` branch) still emits its own frame, so a prompt
|
|
137
|
+
* that genuinely opened no turn is still settled.
|
|
138
|
+
*
|
|
126
139
|
* A builtin the operator typed while the agent is IDLE still passes through
|
|
127
140
|
* untouched — the case this frame exists for.
|
|
128
141
|
*/
|
|
129
142
|
function handlePromptResult(host: SessionFrameHost, event: AgentEvent): boolean {
|
|
130
|
-
if (event.agentInvoked === false && host.streaming) return true;
|
|
143
|
+
if (event.agentInvoked === false && (host.promptRunning || host.streaming)) return true;
|
|
131
144
|
host.promptRunning = false;
|
|
132
145
|
host.awaitingAgentStart = false;
|
|
133
146
|
host.awaitingAgentStartDeadline = 0;
|
|
@@ -118,6 +118,40 @@ describe('readBlobImage', () => {
|
|
|
118
118
|
expect(image?.bytes).toEqual(JPEG_BYTES);
|
|
119
119
|
});
|
|
120
120
|
|
|
121
|
+
test('a WEBP blob is labelled from its RIFF/WEBP tag', async () => {
|
|
122
|
+
// A `read` of a `.webp` answers with an image block, and omp externalizes it
|
|
123
|
+
// to the store; the tag at offset 8 is the only evidence left once the
|
|
124
|
+
// sibling link is pruned.
|
|
125
|
+
const hash = 'e'.repeat(64);
|
|
126
|
+
const webpBytes = Buffer.from([0x52, 0x49, 0x46, 0x46, 0x20, 0x00, 0x00, 0x00, 0x57, 0x45, 0x42, 0x50]);
|
|
127
|
+
await fsp.writeFile(path.join(getBlobStoreDir(), hash), webpBytes);
|
|
128
|
+
const image = await readBlobImage(hash);
|
|
129
|
+
expect(image?.mimeType).toBe('image/webp');
|
|
130
|
+
expect(image?.bytes).toEqual(webpBytes);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test('an SVG blob is labelled from its own text', async () => {
|
|
134
|
+
// No magic table catches an SVG; it used to answer
|
|
135
|
+
// `application/octet-stream`, which no browser paints.
|
|
136
|
+
const hash = 'f'.repeat(64);
|
|
137
|
+
const svgBytes = Buffer.from('<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8"/>');
|
|
138
|
+
await fsp.writeFile(path.join(getBlobStoreDir(), hash), svgBytes);
|
|
139
|
+
const image = await readBlobImage(hash);
|
|
140
|
+
expect(image?.mimeType).toBe('image/svg+xml');
|
|
141
|
+
expect(image?.bytes).toEqual(svgBytes);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
test('an SVG whose head the text check rejects still answers from its link', async () => {
|
|
145
|
+
// A document that opens with a comment or a doctype is not recognised from
|
|
146
|
+
// the first tag; the hardlink omp writes beside the blob is the fallback.
|
|
147
|
+
const hash = '9'.repeat(64);
|
|
148
|
+
const svgBytes = Buffer.from('<!-- exported --><svg xmlns="http://www.w3.org/2000/svg"/>');
|
|
149
|
+
await fsp.writeFile(path.join(getBlobStoreDir(), hash), svgBytes);
|
|
150
|
+
await fsp.writeFile(path.join(getBlobStoreDir(), `${hash}.svg`), svgBytes);
|
|
151
|
+
const image = await readBlobImage(hash);
|
|
152
|
+
expect(image?.mimeType).toBe('image/svg+xml');
|
|
153
|
+
});
|
|
154
|
+
|
|
121
155
|
test('a missing blob yields null', async () => {
|
|
122
156
|
expect(await readBlobImage('d'.repeat(64))).toBeNull();
|
|
123
157
|
});
|
|
@@ -28,7 +28,7 @@ import * as fsp from 'node:fs/promises';
|
|
|
28
28
|
import { existsSync } from 'node:fs';
|
|
29
29
|
import * as path from 'node:path';
|
|
30
30
|
import { getAgentDir } from '@/server/lib/omp/core/paths';
|
|
31
|
-
import { getImageMimeFromBytes,
|
|
31
|
+
import { getImageMimeFromBytes, getPaintableImageMimeType } from '@/shared/lib/fs/file-kind';
|
|
32
32
|
|
|
33
33
|
const BLOB_PREFIX = 'blob:sha256:';
|
|
34
34
|
|
|
@@ -77,7 +77,7 @@ export async function readBlobRef(ref: string): Promise<Buffer | null> {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/** Extensions omp writes onto a blob's hardlink beside it (`mimeToExtension`). */
|
|
80
|
-
const BLOB_IMAGE_EXTENSIONS = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'avif', 'bmp', 'tiff', 'ico'];
|
|
80
|
+
const BLOB_IMAGE_EXTENSIONS = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'avif', 'bmp', 'tiff', 'ico', 'svg'];
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
83
|
* A blob's bytes plus the content type to serve them with, or null when the
|
|
@@ -89,6 +89,11 @@ const BLOB_IMAGE_EXTENSIONS = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'avif', 'bmp
|
|
|
89
89
|
* has the bytes, and a wrong `content-type` makes a browser download the image
|
|
90
90
|
* instead of painting it. `image/jpeg` is the honest answer for a `.png` that
|
|
91
91
|
* omp converted on read (measured: a 96×96 PNG read came back as a JPEG blob).
|
|
92
|
+
*
|
|
93
|
+
* An SVG has no magic signature, which is why the sniff reads its head as text
|
|
94
|
+
* (`looksLikeSvg`); `svg` is also in the link list, for a document that opens
|
|
95
|
+
* with a comment or a doctype the head check does not accept. Without either,
|
|
96
|
+
* an SVG blob was labelled `application/octet-stream` and painted nothing.
|
|
92
97
|
*/
|
|
93
98
|
export async function readBlobImage(hash: string): Promise<{ bytes: Buffer; mimeType: string } | null> {
|
|
94
99
|
const bytes = await readBlob(hash);
|
|
@@ -100,7 +105,7 @@ export async function readBlobImage(hash: string): Promise<{ bytes: Buffer; mime
|
|
|
100
105
|
const dir = getBlobStoreDir();
|
|
101
106
|
for (const ext of BLOB_IMAGE_EXTENSIONS) {
|
|
102
107
|
if (!existsSync(path.join(dir, `${hash}.${ext}`))) continue;
|
|
103
|
-
const byExtension =
|
|
108
|
+
const byExtension = getPaintableImageMimeType(`x.${ext}`);
|
|
104
109
|
if (byExtension) return { bytes, mimeType: byExtension };
|
|
105
110
|
}
|
|
106
111
|
|
|
@@ -70,6 +70,10 @@ const SESSION_ROW_DELETES: readonly (readonly [string, string])[] = [
|
|
|
70
70
|
['queued_messages', 'session_id'],
|
|
71
71
|
['prompt_history', 'session_id'],
|
|
72
72
|
['chat_sessions', 'session_id'],
|
|
73
|
+
// The server-side recorder's fallback for a chat no tab ever wrote. It is a
|
|
74
|
+
// second copy of the same conversation, so a delete that left it behind would
|
|
75
|
+
// resurrect the transcript on the next open.
|
|
76
|
+
['acp_transcripts', 'session_id'],
|
|
73
77
|
['files', 'session_id'],
|
|
74
78
|
// An ACP chat has no transcript for the scan to lose: `harness_sessions` IS
|
|
75
79
|
// its row, so leaving it behind both refused the delete as "not found" (nothing
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
import { afterAll, afterEach, describe, expect, test } from 'bun:test';
|
|
28
28
|
import fs from 'fs';
|
|
29
|
+
import * as os from 'os';
|
|
29
30
|
import * as path from 'path';
|
|
30
31
|
|
|
31
32
|
import { loadSidebarActivity } from '@/server/lib/omp/session/sidebar-activity.server';
|
|
@@ -43,7 +44,7 @@ const previousAgentDir = process.env.PI_CODING_AGENT_DIR;
|
|
|
43
44
|
* path, so they are cleared before and after.
|
|
44
45
|
*/
|
|
45
46
|
function useAgentDir(): string {
|
|
46
|
-
const dir = fs.mkdtempSync(path.join(
|
|
47
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'kabmo-activity-'));
|
|
47
48
|
tempDirs.push(dir);
|
|
48
49
|
process.env.PI_CODING_AGENT_DIR = dir;
|
|
49
50
|
clearSessionFileCaches();
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Who may be replayed into Kabmo's transcript.
|
|
8
|
+
*
|
|
9
|
+
* The gate used to be `origin === 'imported'`, which assumed every chat Kabmo
|
|
10
|
+
* spawned had a client-written transcript. A child spawned SERVER-SIDE (an
|
|
11
|
+
* orchestration worker, a CLI child) has no tab, so that assumption left its
|
|
12
|
+
* timeline empty. The gate is now the local transcript itself.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { describe, expect, test } from 'bun:test';
|
|
16
|
+
import { restoreEligible } from '@/server/routes/agent/harness-command';
|
|
17
|
+
import { hasAssistantRow } from '@/shared/lib/chat/transcript-rows';
|
|
18
|
+
import type { HarnessSessionRecord } from '@/server/lib/harness/session-store.server';
|
|
19
|
+
|
|
20
|
+
function record(overrides: Partial<HarnessSessionRecord> = {}): HarnessSessionRecord {
|
|
21
|
+
return {
|
|
22
|
+
sessionId: 'child-1',
|
|
23
|
+
harness: 'claude',
|
|
24
|
+
agentSessionId: 'child-1',
|
|
25
|
+
cwd: '/work',
|
|
26
|
+
origin: '',
|
|
27
|
+
...overrides,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
describe('restoreEligible', () => {
|
|
32
|
+
test('a spawned child with no local transcript is eligible', () => {
|
|
33
|
+
expect(restoreEligible(record(), [])).toBe(true);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('an imported chat is eligible', () => {
|
|
37
|
+
expect(restoreEligible(record({ origin: 'imported' }), [])).toBe(true);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('a user-only row is not a transcript yet', () => {
|
|
41
|
+
expect(restoreEligible(record(), [{ role: 'user', content: 'do the task' }])).toBe(true);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('a local assistant row is a transcript and is not replayed', () => {
|
|
45
|
+
expect(restoreEligible(record(), [
|
|
46
|
+
{ role: 'user', content: 'do the task' },
|
|
47
|
+
{ role: 'ai', content: 'done' },
|
|
48
|
+
])).toBe(false);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('omp owns its own transcript and is never replayed', () => {
|
|
52
|
+
expect(restoreEligible(record({ harness: 'omp-rpc' }), [])).toBe(false);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('a record with no cwd cannot be resumed', () => {
|
|
56
|
+
expect(restoreEligible(record({ cwd: '' }), [])).toBe(false);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test('no record is not eligible', () => {
|
|
60
|
+
expect(restoreEligible(null, [])).toBe(false);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
describe('hasAssistantRow', () => {
|
|
65
|
+
test('recognises both spellings of the assistant role', () => {
|
|
66
|
+
expect(hasAssistantRow([{ role: 'ai' }])).toBe(true);
|
|
67
|
+
expect(hasAssistantRow([{ role: 'assistant' }])).toBe(true);
|
|
68
|
+
expect(hasAssistantRow([{ role: 'user' }])).toBe(false);
|
|
69
|
+
expect(hasAssistantRow(null)).toBe(false);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -18,6 +18,7 @@ import { startAcpSession, takeAcpReplayEvents } from '@/server/lib/harness/spawn
|
|
|
18
18
|
import { mintAgentEnvironment, rememberAgentToken } from '@/server/lib/sessions/agent-token.server';
|
|
19
19
|
import {
|
|
20
20
|
knownHarness, loadHarnessSession, loadHarnessSessionTitle, repointHarnessSession,
|
|
21
|
+
type HarnessSessionRecord,
|
|
21
22
|
} from '@/server/lib/harness/session-store.server';
|
|
22
23
|
import { transcriptFromReplay } from '@/server/lib/harness/acp/replay-transcript';
|
|
23
24
|
import { getDb } from '@/server/db.server';
|
|
@@ -31,6 +32,7 @@ import { saveAcpPlanState } from '@/server/lib/harness/acp/acp-goal-state.server
|
|
|
31
32
|
import type { HarnessSession } from '@/server/lib/harness/session';
|
|
32
33
|
import type { ModeRequest } from '@/server/lib/omp/mode/request';
|
|
33
34
|
import type { ApprovalMode } from '@/shared/lib/omp/config/access-mode';
|
|
35
|
+
import { hasAssistantRow } from '@/shared/lib/chat/transcript-rows';
|
|
34
36
|
|
|
35
37
|
/**
|
|
36
38
|
* Respawn the ACP session a recorded non-omp chat belongs to, or null when this
|
|
@@ -101,18 +103,28 @@ export async function resumeRecordedHarnessSession(
|
|
|
101
103
|
}
|
|
102
104
|
|
|
103
105
|
/**
|
|
104
|
-
*
|
|
106
|
+
* Whether a recorded chat can be replayed into Kabmo's transcript.
|
|
105
107
|
*
|
|
106
|
-
* The
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
* The gate is the LOCAL TRANSCRIPT, not `origin`: an imported chat has none,
|
|
109
|
+
* and neither does a child Kabmo spawned SERVER-SIDE (an orchestration worker,
|
|
110
|
+
* a CLI child) — no tab ever wrote its turns. A chat with an assistant row
|
|
111
|
+
* already has the conversation and must not replay it twice.
|
|
112
|
+
*/
|
|
113
|
+
export function restoreEligible(record: HarnessSessionRecord | null, localMessages: unknown): boolean {
|
|
114
|
+
if (!record || !record.cwd) return false;
|
|
115
|
+
if (record.harness === 'omp-rpc') return false;
|
|
116
|
+
return !hasAssistantRow(localMessages);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Replay a chat's retained history into Kabmo's own transcript.
|
|
112
121
|
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
122
|
+
* The sidebar shows a row because `harness_sessions` lists it, but the agent
|
|
123
|
+
* holds the conversation: Kabmo never received those turns, so the open tab
|
|
124
|
+
* would be empty. A v2 agent replays its history when `session/resume` carries
|
|
125
|
+
* `replayFrom`; the frames are collected before the session is usable and
|
|
126
|
+
* reduced to the rows the timeline reads. Persisting the result is the point of
|
|
127
|
+
* the exercise — every later open is an ordinary read.
|
|
116
128
|
*/
|
|
117
129
|
export async function restoreRecordedHarnessSession(
|
|
118
130
|
sessionId: string,
|
|
@@ -120,20 +132,22 @@ export async function restoreRecordedHarnessSession(
|
|
|
120
132
|
): Promise<{ session: HarnessSession; harness: string; messages: number } | null> {
|
|
121
133
|
const record = await loadHarnessSession(sessionId);
|
|
122
134
|
const harness = knownHarness(record?.harness, HARNESS_IDS);
|
|
123
|
-
if (!record ||
|
|
135
|
+
if (!record || !harness) return null;
|
|
124
136
|
|
|
125
137
|
const db = await getDb();
|
|
126
138
|
const existing = (await db.get('SELECT messages FROM chat_sessions WHERE session_id = ?', [sessionId])) as {
|
|
127
139
|
messages?: string;
|
|
128
140
|
} | null;
|
|
141
|
+
let localMessages: unknown = [];
|
|
129
142
|
if (existing?.messages) {
|
|
130
143
|
try {
|
|
131
|
-
|
|
132
|
-
if (Array.isArray(parsed) && parsed.length > 0) return null;
|
|
144
|
+
localMessages = JSON.parse(existing.messages);
|
|
133
145
|
} catch {
|
|
134
146
|
// A corrupt local copy is not a transcript: replay and replace it.
|
|
147
|
+
localMessages = [];
|
|
135
148
|
}
|
|
136
149
|
}
|
|
150
|
+
if (!restoreEligible(record, localMessages)) return null;
|
|
137
151
|
|
|
138
152
|
const probe = await freshProbe(harness);
|
|
139
153
|
const label = harnessDescriptor(harness)?.label ?? harness;
|
|
@@ -23,9 +23,12 @@ export interface ImportedChat {
|
|
|
23
23
|
|
|
24
24
|
export async function importedChat(sessionId: string): Promise<ImportedChat> {
|
|
25
25
|
const record = await loadHarnessSession(sessionId).catch(() => null);
|
|
26
|
-
if (record
|
|
26
|
+
if (!record) return { imported: false, title: '', harness: '' };
|
|
27
|
+
// The title and the harness are facts about the ROW, not about how it got
|
|
28
|
+
// here: a spawned child needs both to name its header and to decide whether
|
|
29
|
+
// its agent can replay a transcript Kabmo never received.
|
|
27
30
|
return {
|
|
28
|
-
imported:
|
|
31
|
+
imported: record.origin === 'imported',
|
|
29
32
|
title: await loadHarnessSessionTitle(sessionId).catch(() => ''),
|
|
30
33
|
harness: record.harness,
|
|
31
34
|
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The fields a LIVE non-omp session adds to the chat payload.
|
|
8
|
+
*
|
|
9
|
+
* Split out of the loader so every branch that answers a session states these
|
|
10
|
+
* once: the file-backed branch, the stored-row branch and the seed branch all
|
|
11
|
+
* spread the same object, and a branch that forgot one of them is how a
|
|
12
|
+
* reopened ACP chat named a model its agent never ran.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { LiveHarnessModels } from '@/shared/types/harness';
|
|
16
|
+
|
|
17
|
+
/** What a LIVE non-omp session adds to the session payload: its resolved model,
|
|
18
|
+
* its thinking level, and the selector lists it published. */
|
|
19
|
+
export interface LiveSessionMeta {
|
|
20
|
+
model?: { provider: string; modelId: string };
|
|
21
|
+
thinkingLevel?: string;
|
|
22
|
+
harness?: string;
|
|
23
|
+
liveModels?: LiveHarnessModels;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Spread into the `session` payload so every branch states these fields once.
|
|
27
|
+
* `recorded` is the last run's model from `session_stream_state`, used only
|
|
28
|
+
* when no live session can answer. */
|
|
29
|
+
export function liveMetaFields(
|
|
30
|
+
liveMeta: LiveSessionMeta | null,
|
|
31
|
+
recorded?: { provider: string; modelId: string },
|
|
32
|
+
recordedThinkingLevel?: string,
|
|
33
|
+
): Record<string, unknown> {
|
|
34
|
+
const model = liveMeta?.model ?? recorded;
|
|
35
|
+
const thinkingLevel = liveMeta?.thinkingLevel ?? recordedThinkingLevel;
|
|
36
|
+
return {
|
|
37
|
+
...(model ? { model } : {}),
|
|
38
|
+
...(thinkingLevel ? { thinkingLevel } : {}),
|
|
39
|
+
...(liveMeta?.harness ? { harness: liveMeta.harness } : {}),
|
|
40
|
+
...(liveMeta?.liveModels?.models.length ? { liveModels: liveMeta.liveModels } : {}),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -17,6 +17,7 @@ import fs from 'node:fs';
|
|
|
17
17
|
import { tmpdir } from 'node:os';
|
|
18
18
|
import { join } from 'node:path';
|
|
19
19
|
import { isolateDb, releaseDb } from '@/test-support/isolated-db';
|
|
20
|
+
import { getDb } from '@/server/db.server';
|
|
20
21
|
import { loader } from '@/server/routes/chat/session';
|
|
21
22
|
import { registerAcpSession } from '@/server/lib/harness/register.server';
|
|
22
23
|
import { claimHarness } from '@/server/lib/harness/registry';
|
|
@@ -238,3 +239,112 @@ describe('chat session loader on a live ACP chat', () => {
|
|
|
238
239
|
expect(body.session.model).toEqual({ provider: 'claude', modelId: 'sonnet' });
|
|
239
240
|
});
|
|
240
241
|
});
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* A child Kabmo spawned SERVER-SIDE (an orchestration worker, a CLI child) has
|
|
245
|
+
* no tab, so the client never wrote `chat_sessions`. The recorder's
|
|
246
|
+
* `acp_transcripts` row is the transcript; when even that is missing, the
|
|
247
|
+
* loader must ask for a replay instead of drawing an empty timeline.
|
|
248
|
+
*/
|
|
249
|
+
describe('chat session loader on a server-spawned ACP child', () => {
|
|
250
|
+
const CHILD = 'child-worker-1';
|
|
251
|
+
const PARENT = 'parent-orchestrator-1';
|
|
252
|
+
async function recordChild(options: { transcript?: unknown[]; local?: unknown[] } = {}): Promise<void> {
|
|
253
|
+
const db = await getDb();
|
|
254
|
+
const now = Date.now();
|
|
255
|
+
await db.run(
|
|
256
|
+
`INSERT INTO harness_sessions (session_id, harness, agent_session_id, cwd, title, origin, created_at, updated_at)
|
|
257
|
+
VALUES (?, 'claude', ?, '/tmp', 'Worker task', '', ?, ?)`,
|
|
258
|
+
[CHILD, CHILD, now, now],
|
|
259
|
+
);
|
|
260
|
+
await db.run(
|
|
261
|
+
`INSERT INTO session_relations (session_id, parent_session_id, lifecycle_owner_session_id, visibility, parent_notifications, depth, created_at)
|
|
262
|
+
VALUES (?, ?, ?, 'visible', 'auto', 1, ?)`,
|
|
263
|
+
[CHILD, PARENT, PARENT, now],
|
|
264
|
+
);
|
|
265
|
+
if (options.transcript) {
|
|
266
|
+
await db.run(
|
|
267
|
+
'INSERT INTO acp_transcripts (session_id, messages, updated_at) VALUES (?, ?, ?)',
|
|
268
|
+
[CHILD, JSON.stringify(options.transcript), now],
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
if (options.local) {
|
|
272
|
+
await db.run(
|
|
273
|
+
'INSERT INTO chat_sessions (session_id, title, messages, updated_at) VALUES (?, ?, ?, CURRENT_TIMESTAMP)',
|
|
274
|
+
[CHILD, `Session ${CHILD}`, JSON.stringify(options.local)],
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
test('serves the recorded transcript and the harness title', async () => {
|
|
279
|
+
await recordChild({
|
|
280
|
+
transcript: [
|
|
281
|
+
{ id: 'u1', role: 'user', content: 'do the task' },
|
|
282
|
+
{ id: 'a1', role: 'ai', content: 'done' },
|
|
283
|
+
],
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
const body = (await (await load(CHILD)).json()) as {
|
|
287
|
+
session: { title: string; messages: Array<{ content: string }>; restore?: boolean };
|
|
288
|
+
};
|
|
289
|
+
expect(body.session.messages.map((row) => row.content)).toEqual(['do the task', 'done']);
|
|
290
|
+
expect(body.session.title).toBe('Worker task');
|
|
291
|
+
expect(body.session.restore).toBeUndefined();
|
|
292
|
+
});
|
|
293
|
+
test('an empty local row falls back to the recorded transcript', async () => {
|
|
294
|
+
await recordChild({
|
|
295
|
+
local: [],
|
|
296
|
+
transcript: [
|
|
297
|
+
{ id: 'u1', role: 'user', content: 'do the task' },
|
|
298
|
+
{ id: 'a1', role: 'ai', content: 'done' },
|
|
299
|
+
],
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
const body = (await (await load(CHILD)).json()) as {
|
|
303
|
+
session: { messages: Array<{ content: string }>; restore?: boolean };
|
|
304
|
+
};
|
|
305
|
+
expect(body.session.messages.map((row) => row.content)).toEqual(['do the task', 'done']);
|
|
306
|
+
expect(body.session.restore).toBeUndefined();
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
test('a user-only local row still falls back to the recorded answer', async () => {
|
|
310
|
+
await recordChild({
|
|
311
|
+
local: [{ id: 'u1', role: 'user', content: 'do the task' }],
|
|
312
|
+
transcript: [
|
|
313
|
+
{ id: 'u1', role: 'user', content: 'do the task' },
|
|
314
|
+
{ id: 'a1', role: 'ai', content: 'done' },
|
|
315
|
+
],
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
const body = (await (await load(CHILD)).json()) as {
|
|
319
|
+
session: { messages: Array<{ content: string }>; restore?: boolean };
|
|
320
|
+
};
|
|
321
|
+
expect(body.session.messages.map((row) => row.content)).toEqual(['do the task', 'done']);
|
|
322
|
+
expect(body.session.restore).toBeUndefined();
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
test('no transcript at all asks for a replay, with the harness title', async () => {
|
|
326
|
+
await recordChild();
|
|
327
|
+
|
|
328
|
+
const body = (await (await load(CHILD)).json()) as {
|
|
329
|
+
session: { title: string; messages: unknown[]; restore?: boolean };
|
|
330
|
+
};
|
|
331
|
+
expect(body.session.messages).toEqual([]);
|
|
332
|
+
expect(body.session.restore).toBe(true);
|
|
333
|
+
expect(body.session.title).toBe('Worker task');
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
test('a local assistant row is a transcript and is not replayed', async () => {
|
|
337
|
+
await recordChild({
|
|
338
|
+
local: [
|
|
339
|
+
{ id: 'u1', role: 'user', content: 'do the task' },
|
|
340
|
+
{ id: 'a1', role: 'ai', content: 'done' },
|
|
341
|
+
],
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
const body = (await (await load(CHILD)).json()) as {
|
|
345
|
+
session: { messages: Array<{ content: string }>; restore?: boolean };
|
|
346
|
+
};
|
|
347
|
+
expect(body.session.messages.map((row) => row.content)).toEqual(['do the task', 'done']);
|
|
348
|
+
expect(body.session.restore).toBeUndefined();
|
|
349
|
+
});
|
|
350
|
+
});
|
|
@@ -10,13 +10,16 @@ import { mergeOmpAttachments, overlayRowsForOmpSession } from '@/server/lib/omp/
|
|
|
10
10
|
import { readRawHeaderLine } from '@/server/lib/omp/session/files';
|
|
11
11
|
import { formatNewSessionTitle } from '@/shared/lib/omp/session/default-title';
|
|
12
12
|
import { importedChat } from '@/server/routes/chat/imported';
|
|
13
|
+
import { loadAcpTranscript } from '@/server/lib/harness/acp/session-transcript.server';
|
|
14
|
+
import { getSessionRelation } from '@/server/lib/sessions/relations.server';
|
|
13
15
|
import { windowMessages } from '@/server/routes/chat/window';
|
|
14
16
|
import { readCodexRolloutTranscript } from '@/server/lib/harness/codex/transcript.server';
|
|
15
17
|
import { getLiveRunSessionIds, getLiveSession, harnessOfSession } from '@/server/lib/omp/rpc/session-registry';
|
|
16
18
|
import { loadStreamStates } from '@/shared/lib/omp/session/stream-state.server';
|
|
17
19
|
import { configByCategory, selectValues } from '@/server/lib/harness/launch';
|
|
18
20
|
import type { AcpConfigOption } from '@/server/lib/harness/acp/protocol';
|
|
19
|
-
import type
|
|
21
|
+
import { liveMetaFields, type LiveSessionMeta } from '@/server/routes/chat/live-meta';
|
|
22
|
+
import { hasAssistantRow } from '@/shared/lib/chat/transcript-rows';
|
|
20
23
|
|
|
21
24
|
/** Newest-message window served by default for omp JSONL sessions; the client
|
|
22
25
|
* pages further back via `?before=` when the user scrolls to the top. Large
|
|
@@ -24,33 +27,6 @@ import type { LiveHarnessModels } from '@/shared/types/harness';
|
|
|
24
27
|
* payload (and the mobile parse+mount cost) bounded. */
|
|
25
28
|
const DEFAULT_MESSAGE_WINDOW = 120;
|
|
26
29
|
|
|
27
|
-
/** What a LIVE non-omp session adds to the session payload: its resolved model,
|
|
28
|
-
* its thinking level, and the selector lists it published. */
|
|
29
|
-
interface LiveSessionMeta {
|
|
30
|
-
model?: { provider: string; modelId: string };
|
|
31
|
-
thinkingLevel?: string;
|
|
32
|
-
harness?: string;
|
|
33
|
-
liveModels?: LiveHarnessModels;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/** Spread into the `session` payload so every branch states these fields once.
|
|
37
|
-
* `recorded` is the last run's model from `session_stream_state`, used only
|
|
38
|
-
* when no live session can answer. */
|
|
39
|
-
function liveMetaFields(
|
|
40
|
-
liveMeta: LiveSessionMeta | null,
|
|
41
|
-
recorded?: { provider: string; modelId: string },
|
|
42
|
-
recordedThinkingLevel?: string,
|
|
43
|
-
): Record<string, unknown> {
|
|
44
|
-
const model = liveMeta?.model ?? recorded;
|
|
45
|
-
const thinkingLevel = liveMeta?.thinkingLevel ?? recordedThinkingLevel;
|
|
46
|
-
return {
|
|
47
|
-
...(model ? { model } : {}),
|
|
48
|
-
...(thinkingLevel ? { thinkingLevel } : {}),
|
|
49
|
-
...(liveMeta?.harness ? { harness: liveMeta.harness } : {}),
|
|
50
|
-
...(liveMeta?.liveModels?.models.length ? { liveModels: liveMeta.liveModels } : {}),
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
30
|
export async function loader({ params, request }: LoaderFunctionArgs) {
|
|
55
31
|
const { sessionId } = params;
|
|
56
32
|
if (!sessionId) {
|
|
@@ -180,6 +156,14 @@ export async function loader({ params, request }: LoaderFunctionArgs) {
|
|
|
180
156
|
const { imported, title: harnessTitle, harness: recordedHarness } = mock
|
|
181
157
|
? { imported: false, title: '', harness: '' }
|
|
182
158
|
: await importedChat(sessionId);
|
|
159
|
+
// A child spawned SERVER-SIDE (an orchestration worker, a CLI child) has no
|
|
160
|
+
// tab, so the client never wrote its transcript. Its agent still holds the
|
|
161
|
+
// conversation, and `session/load` can replay it — the same path an
|
|
162
|
+
// imported chat uses. The relation is what tells the two apart from a
|
|
163
|
+
// brand-new top-level chat, which must not spawn an agent just to replay
|
|
164
|
+
// nothing.
|
|
165
|
+
const isChild = !mock && Boolean((await getSessionRelation(sessionId).catch(() => null))?.parentSessionId);
|
|
166
|
+
const canRestore = !mock && (imported || isChild) && recordedHarness !== '' && recordedHarness !== 'omp-rpc';
|
|
183
167
|
// A Codex session open in another client refuses `session/resume`, so a
|
|
184
168
|
// restore cannot show it. The rollout is readable while that client holds
|
|
185
169
|
// the thread, and it is only consulted when the local transcript is empty.
|
|
@@ -220,12 +204,22 @@ export async function loader({ params, request }: LoaderFunctionArgs) {
|
|
|
220
204
|
const firstUserContent = Array.isArray(parsedMessages)
|
|
221
205
|
? parsedMessages.find((m: { role?: string; content?: string }) => m?.role === 'user')?.content
|
|
222
206
|
: undefined;
|
|
223
|
-
|
|
207
|
+
// The server-side recorder is the fallback for a chat no tab ever wrote:
|
|
208
|
+
// an orchestration worker, a CLI child. `chat_sessions` still wins when
|
|
209
|
+
// it holds an ANSWER, because an open tab's copy carries the attachment
|
|
210
|
+
// chips and notice rows this fold does not build. A user-only row is a
|
|
211
|
+
// prompt the client wrote before its tab closed, not a transcript.
|
|
212
|
+
const localHasAnswer = hasAssistantRow(parsedMessages);
|
|
213
|
+
const recordedMessages = localHasAnswer ? [] : await loadAcpTranscript(sessionId);
|
|
214
|
+
const messages = localHasAnswer
|
|
215
|
+
? parsedMessages
|
|
216
|
+
: (recordedMessages.length > 0 ? recordedMessages : (codexMessages.length > 0 ? codexMessages : parsedMessages));
|
|
224
217
|
const localTitle = hasDefaultTitle && firstUserContent ? firstUserContent.slice(0, 120) : existing.title;
|
|
225
218
|
// The imported row's name is in `harness_sessions`; the empty local row
|
|
226
219
|
// an earlier open created carries the UUID stamp instead, which put a
|
|
227
|
-
// second spelling of the chat's name in the header.
|
|
228
|
-
|
|
220
|
+
// second spelling of the chat's name in the header. A spawned child has
|
|
221
|
+
// the same problem: its title is the harness's, not the UUID.
|
|
222
|
+
const title = (imported || isChild) && (!localTitle || String(localTitle).startsWith('Session '))
|
|
229
223
|
? harnessTitle || localTitle || `Session ${sessionId}`
|
|
230
224
|
: localTitle || `Session ${sessionId}`;
|
|
231
225
|
return json({
|
|
@@ -233,7 +227,7 @@ export async function loader({ params, request }: LoaderFunctionArgs) {
|
|
|
233
227
|
id: existing.session_id,
|
|
234
228
|
title,
|
|
235
229
|
messages,
|
|
236
|
-
...(
|
|
230
|
+
...(canRestore && !hasAssistantRow(messages) ? { restore: true } : {}),
|
|
237
231
|
...liveMetaFields(liveMeta, recordedModel),
|
|
238
232
|
},
|
|
239
233
|
isMock: mock,
|
|
@@ -247,8 +241,11 @@ export async function loader({ params, request }: LoaderFunctionArgs) {
|
|
|
247
241
|
messages: [],
|
|
248
242
|
};
|
|
249
243
|
|
|
244
|
+
const recordedMessages = await loadAcpTranscript(sessionId);
|
|
250
245
|
const seedTitle = harnessTitle || initial.title;
|
|
251
|
-
const seededMessages =
|
|
246
|
+
const seededMessages = recordedMessages.length > 0
|
|
247
|
+
? recordedMessages
|
|
248
|
+
: (codexMessages.length > 0 ? codexMessages : initial.messages);
|
|
252
249
|
await db.run(
|
|
253
250
|
'INSERT OR REPLACE INTO chat_sessions (session_id, title, messages, updated_at) VALUES (?, ?, ?, CURRENT_TIMESTAMP)',
|
|
254
251
|
[sessionId, seedTitle, JSON.stringify(initial.messages)]
|
|
@@ -259,7 +256,7 @@ export async function loader({ params, request }: LoaderFunctionArgs) {
|
|
|
259
256
|
...initial,
|
|
260
257
|
title: seedTitle,
|
|
261
258
|
messages: seededMessages,
|
|
262
|
-
...(
|
|
259
|
+
...(canRestore && !hasAssistantRow(seededMessages) ? { restore: true } : {}),
|
|
263
260
|
...liveMetaFields(liveMeta, recordedModel),
|
|
264
261
|
},
|
|
265
262
|
isMock: mock,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* What a stored transcript already holds.
|
|
8
|
+
*
|
|
9
|
+
* A user-only row is a prompt the client wrote before its tab closed; the
|
|
10
|
+
* answer is still only in the agent, so it is not a transcript yet. Both the
|
|
11
|
+
* loader (which decides whether to read the recorder's fallback) and the
|
|
12
|
+
* restore gate (which decides whether to replay) ask this one question.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** Whether a transcript already holds an assistant answer. */
|
|
16
|
+
export function hasAssistantRow(messages: unknown): boolean {
|
|
17
|
+
if (!Array.isArray(messages)) return false;
|
|
18
|
+
return messages.some((row) => {
|
|
19
|
+
const role = (row as { role?: unknown } | null)?.role;
|
|
20
|
+
return role === 'ai' || role === 'assistant';
|
|
21
|
+
});
|
|
22
|
+
}
|