@kabmo-labs/kabmo 0.39.1 → 0.41.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 +364 -363
- package/dist/client/static/js/{CsvGrid-7synegzg.js → CsvGrid-60njj97j.js} +2 -2
- package/dist/client/static/js/{DocxView-v5d9n5yw.js → DocxView-rsv0j46a.js} +5 -5
- package/dist/client/static/js/{DrawioView-ww7y98tt.js → DrawioView-n2g5df3a.js} +2 -2
- package/dist/client/static/js/ImageView-t330jx6y.js +1 -0
- package/dist/client/static/js/LayoutWrapper-qp6nsw65.js +2 -0
- package/dist/client/static/js/{Modal-qj39shgb.js → Modal-sbya4ahp.js} +17 -17
- package/dist/client/static/js/{PdfView-t9v4datp.js → PdfView-1r7a0qkp.js} +1 -1
- package/dist/client/static/js/SessionsView-yqs5m8tj.js +1 -0
- package/dist/client/static/js/{SheetView-6zkxbjd4.js → SheetView-bt5pp042.js} +24 -24
- package/dist/client/static/js/{SvgPreview-7rt2p1y1.js → SvgPreview-vfmqgmrx.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-888zn5zg.js → abnfDiagram-O67JEVCF-8k5hk1yx.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-1wqga929.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-b04e26rb.js → architectureDiagram-NJMV4G6O-7jcb7fgy.js} +3 -3
- package/dist/client/static/js/{astro-4ybhkc9b.js → astro-0rh34hha.js} +1 -1
- package/dist/client/static/js/bash-vv2ysp0a.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-32ph2m52.js → blockDiagram-BEXU5L5S-04sbtdth.js} +5 -5
- package/dist/client/static/js/c-67jyc7sg.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-hwnaa333.js → c4Diagram-YGBWAQC7-vwac9za0.js} +2 -2
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-2kg7dqeb.js → classDiagram-v2-NBCMYWYE-18cc0bsb.js} +5 -5
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-tj2sbtyv.js → cose-bilkent-JH36ORCC-dk683zvp.js} +1 -1
- package/dist/client/static/js/cpp-crfbnwv8.js +1 -0
- package/dist/client/static/js/css-2re5mbea.js +1 -0
- package/dist/client/static/js/css-983fbv00.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-j2dpdgkh.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-wx2y8dhm.js → cynefinDiagram-VND7K2PF-m2sx8d8s.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-5v3rzdxd.js → dagre-6A5THRUB-qf3pr59p.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-7er2jwy1.js → diagram-22UHCM2B-twnz23mt.js} +11 -11
- package/dist/client/static/js/{diagram-3UASUU5V-2b7nmdha.js → diagram-3UASUU5V-417bas6t.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-yf61ftn0.js → diagram-ATOU4E4O-n63cpdnx.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-cn3rs9xn.js → diagram-CDSNMT55-v86p14dd.js} +3 -3
- package/dist/client/static/js/{diagram-MLGK6HIB-7kvtsj6c.js → diagram-MLGK6HIB-7a0h1hs3.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-g3zg3r5e.js → diagram-MPIPVDR6-w75bftmd.js} +2 -2
- package/dist/client/static/js/{dockerfile-f9j396wm.js → dockerfile-g5qbaeq3.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-ft02nzne.js → ebnfDiagram-ZINNZB2B-vdzm3tsv.js} +1 -1
- package/dist/client/static/js/{elixir-v9bbxsgg.js → elixir-gpez1k9m.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-87fvkn2k.js → elk-276RUBZZ-2fsbb484.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-gh9mp6j8.js → erDiagram-OPXOYQCR-vnkztq7d.js} +5 -5
- package/dist/client/static/js/{erlang-55r0skxa.js → erlang-jqqa3ehb.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-xjvjawd3.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-j21f2bfg.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-227xs61z.js → ganttDiagram-FUAMR5RP-pbvcch52.js} +2 -2
- package/dist/client/static/js/{ghostty-web-2gt2tp72.js → ghostty-web-22pdvhta.js} +4 -4
- package/dist/client/static/js/gitGraph-4MIJSDKK-r0zbk95f.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-4671gdym.js → gitGraphDiagram-X574FWY7-dkvktvzr.js} +2 -2
- package/dist/client/static/js/graphql-npbd9fdx.js +1 -0
- package/dist/client/static/js/html-1cpe2xc8.js +1 -0
- package/dist/client/static/js/{index-enmh3w27.js → index-0c6vpk89.js} +2 -2
- package/dist/client/static/js/{index-35mh9kbs.js → index-0xaz2eyv.js} +3 -3
- package/dist/client/static/js/{index-668chrpq.js → index-1sw00wm0.js} +1 -1
- package/dist/client/static/js/index-2z9wrb46.js +2 -0
- package/dist/client/static/js/{index-qbnd827h.js → index-3rymer2w.js} +1 -1
- package/dist/client/static/js/{index-f1nqk6z6.js → index-4jk8ngjg.js} +2 -2
- package/dist/client/static/js/index-55hq7tnj.js +1 -0
- package/dist/client/static/js/{index-8egjccbq.js → index-6fx2t6y7.js} +52 -52
- package/dist/client/static/js/{index-8xasfxf3.js → index-7fwppdkn.js} +1 -1
- package/dist/client/static/js/{index-28a5kf88.js → index-7w3gqw2b.js} +1 -1
- package/dist/client/static/js/{index-c1be3rva.js → index-9dnkfpx4.js} +2 -2
- package/dist/client/static/js/{index-s80x8d58.js → index-9fnzcg2x.js} +2 -2
- package/dist/client/static/js/{index-h8rr48px.js → index-a4ed3mks.js} +4 -4
- package/dist/client/static/js/{index-j2g39xq7.js → index-ae91g8ka.js} +5 -5
- package/dist/client/static/js/{index-xrp2zv8z.js → index-agdbjh5k.js} +2 -2
- package/dist/client/static/js/{index-2rs03vfy.js → index-ajjq0b8y.js} +2 -2
- package/dist/client/static/js/{index-xfr6r539.js → index-amawahyh.js} +2 -2
- package/dist/client/static/js/{index-y5ymgp20.js → index-b6cyn4hr.js} +50 -50
- package/dist/client/static/js/index-c6kx7s6a.js +2 -0
- package/dist/client/static/js/{index-k7sdsmgv.js → index-ce4vytm6.js} +2 -2
- package/dist/client/static/js/{index-b08hx4tw.js → index-cytks03p.js} +2 -2
- package/dist/client/static/js/{index-cfnxda13.js → index-djv15k5s.js} +2 -2
- package/dist/client/static/js/{index-kkfbd1db.js → index-ds6a2cx7.js} +5 -5
- package/dist/client/static/js/{index-tmnnafht.js → index-e6qjfcz9.js} +1 -1
- package/dist/client/static/js/{index-442mbhwb.js → index-e7yf273s.js} +2 -2
- package/dist/client/static/js/{index-f73v86a3.js → index-efn233xp.js} +4 -4
- package/dist/client/static/js/index-esx3zwnt.js +1 -0
- package/dist/client/static/js/{index-d3prrt2q.js → index-f8pq132s.js} +1 -1
- package/dist/client/static/js/index-fbbp5cwj.js +2 -0
- package/dist/client/static/js/{index-drjtwfp5.js → index-fg965t62.js} +2 -2
- package/dist/client/static/js/{index-xnk1500f.js → index-g1cggqgx.js} +12 -12
- package/dist/client/static/js/index-ghsdzs4m.js +1 -0
- package/dist/client/static/js/{index-4wvtar0v.js → index-gn92c6hp.js} +2 -2
- package/dist/client/static/js/{index-4c2zcvem.js → index-gs7ytgdw.js} +180 -180
- package/dist/client/static/js/{index-q0bph5x0.js → index-haaz8t7e.js} +2 -2
- package/dist/client/static/js/{index-t6gznaxm.js → index-hz177dr2.js} +2 -2
- package/dist/client/static/js/{index-7qc2avfy.js → index-j5ram1ve.js} +2 -2
- package/dist/client/static/js/{index-cst843zs.css → index-jqs23cc7.css} +1 -1
- package/dist/client/static/js/{index-y91j4t1q.js → index-ne131hmw.js} +2 -2
- package/dist/client/static/js/{index-1sgad84m.js → index-ngk9h0v9.js} +2 -2
- package/dist/client/static/js/{index-4wtr5wjp.js → index-ntcqyqd5.js} +2 -2
- package/dist/client/static/js/{index-m847wafq.js → index-pbsm2vw7.js} +2 -2
- package/dist/client/static/js/{index-vb3srfyc.js → index-pfbyfab5.js} +2 -2
- package/dist/client/static/js/{index-qsrw5c67.js → index-pn91shfp.js} +2 -2
- package/dist/client/static/js/{index-6rs8e8ng.js → index-qjsy6p86.js} +1 -1
- package/dist/client/static/js/{index-fjnkzk12.js → index-qsw5edtk.js} +5 -5
- package/dist/client/static/js/{index-72289dgx.js → index-rc8wrs2a.js} +2 -2
- package/dist/client/static/js/{index-w0rbyw47.js → index-rdqn92tc.js} +2 -2
- package/dist/client/static/js/{index-phm1zb8m.js → index-re1xz433.js} +1 -1
- package/dist/client/static/js/{index-mtadrbxt.js → index-rebnv57p.js} +2 -2
- package/dist/client/static/js/{index-9d6x1f3t.js → index-s78n0dtv.js} +2 -2
- package/dist/client/static/js/{index-c36pag9y.js → index-sj4y8kj2.js} +2 -2
- package/dist/client/static/js/{index-87qandgr.js → index-tgper3yy.js} +2 -2
- package/dist/client/static/js/index-x2kb1kx5.js +3 -0
- package/dist/client/static/js/{index-0j518hqm.js → index-xf36nmbm.js} +2 -2
- package/dist/client/static/js/{index-hdd8nqz8.js → index-xfa5hswh.js} +1 -1
- package/dist/client/static/js/{index-9gepbvdt.js → index-yq9vnd1y.js} +2 -2
- package/dist/client/static/js/{index-y3qxrs90.js → index-yzg9mbsv.js} +2 -2
- package/dist/client/static/js/{index-wgvysmnr.js → index-zfykeg7x.js} +10 -10
- package/dist/client/static/js/{index-rj81xrvw.js → index-zye9309h.js} +2 -2
- package/dist/client/static/js/info-A6RAGUB7-a8xap43w.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-k1jnhhbp.js → infoDiagram-VRGFBTTK-mh6yks62.js} +1 -1
- package/dist/client/static/js/ini-df5bw23e.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-ar94x2gr.js → ishikawaDiagram-OU5B5YK6-hnfqppnv.js} +2 -2
- package/dist/client/static/js/java-8j33rj1p.js +1 -0
- package/dist/client/static/js/javascript-zegm06a1.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-ntfp0w54.js → journeyDiagram-ZHPQQLJL-s4nv1f3q.js} +3 -3
- package/dist/client/static/js/json-g5ggnd94.js +1 -0
- package/dist/client/static/js/jsx-f6p72qpc.js +1 -0
- package/dist/client/static/js/{julia-jhe2vd4f.js → julia-yre4bxb9.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-q5rsr6j3.js → kanban-definition-PNTS6WVX-t8kbfefp.js} +8 -8
- package/dist/client/static/js/lua-bahx6qze.js +1 -0
- package/dist/client/static/js/markdown-9dhg1fax.js +1 -0
- package/dist/client/static/js/{mermaid.core-0gafsqrm.js → mermaid.core-0784021p.js} +7 -7
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-jgz6nyhk.js → mindmap-definition-NLK3R4M7-swkkze8c.js} +8 -8
- package/dist/client/static/js/one-dark-pro-h5tmw145.js +1 -0
- package/dist/client/static/js/one-light-x7vj1pxr.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-b5bvg6v1.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-b3e9ma2c.js → pegDiagram-GJSIUBJH-jqayzh7z.js} +1 -1
- package/dist/client/static/js/{perl-qhj6tk7k.js → perl-weeskn1v.js} +1 -1
- package/dist/client/static/js/{php-arycc4w7.js → php-vf3045p9.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-77ee73zg.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-66mn2qnt.js → pieDiagram-5QR66LMP-w03a65ky.js} +2 -2
- package/dist/client/static/js/properties-49mfnee4.js +1 -0
- package/dist/client/static/js/python-qb69wp1s.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-n7warg0e.js → quadrantDiagram-O4NWA36T-2j7sfa9s.js} +3 -3
- package/dist/client/static/js/r-s3mf2tch.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-cp79xtvb.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-dcpgqhcb.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-qasqv686.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-e46908rd.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-7009t6bk.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-k8j43rxj.js → railroadDiagram-XR7U4H2S-jtkkgy34.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-ef2v7nyq.js → requirementDiagram-PLB6GJNP-t85ckjdb.js} +3 -3
- package/dist/client/static/js/{ruby-fb6zzevm.js → ruby-1a2ryzy6.js} +1 -1
- package/dist/client/static/js/{rust-jvkbr060.js → rust-736r0f0v.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-3njbd1yd.js → sankeyDiagram-IPEJSGJF-5pfkw8ne.js} +3 -3
- package/dist/client/static/js/{sass-fzs6a0kr.js → sass-tq4vw7hd.js} +1 -1
- package/dist/client/static/js/{scss-gdb52d0c.js → scss-x7ddw6gb.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-k2wqc0qt.js → sequenceDiagram-PO4LG4MO-55vs9zv5.js} +7 -7
- package/dist/client/static/js/{sizeCapture-INFHLROL-cpnd12ee.js → sizeCapture-INFHLROL-pzqqd7f4.js} +1 -1
- package/dist/client/static/js/sql-aczp05f2.js +1 -0
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-1ydpxaeg.js → stateDiagram-v2-GCMORJYK-6nhrph8n.js} +3 -3
- package/dist/client/static/js/{svelte-8s3k6qjd.js → svelte-0hv6pak2.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-4md43da2.js → swimlanes-2SLR337P-6tcnxfbv.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-7xrkrkpa.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-sp32bf3e.js → timeline-definition-EJHVYXUP-1dz46nt5.js} +4 -4
- package/dist/client/static/js/treeView-Q6P3EWNA-tpn62q8j.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-w910f1g4.js +1 -0
- package/dist/client/static/js/tsx-s1shkfg9.js +1 -0
- package/dist/client/static/js/typescript-htx9v6bf.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-p2ssettn.js → usecaseDiagram-POWQR4AR-b3jfveq6.js} +28 -28
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-ejqq8b82.js → vennDiagram-UO4OBE2U-dnc3jqvp.js} +3 -3
- package/dist/client/static/js/{vue-k3f3chre.js → vue-zccj3qa5.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-pt9tq808.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-tkk79rsn.js → wardleyDiagram-VNRHLVJA-466m8400.js} +3 -3
- package/dist/client/static/js/xml-wr1dxav5.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-zhgrsqpb.js → xychartDiagram-PMCCYNJV-kryrpqp1.js} +3 -3
- package/dist/client/static/js/yaml-0y9fdskg.js +1 -0
- package/marketplace/plugins/command-runner/package.json +2 -2
- package/marketplace/plugins/command-runner/src/panel/Custom.test.tsx +1 -0
- package/marketplace/plugins/command-runner/src/panel/Groups.test.tsx +10 -0
- package/marketplace/plugins/command-runner/src/panel/Groups.tsx +24 -3
- package/marketplace/plugins/command-runner/src/panel/index.tsx +1 -0
- package/marketplace/plugins/command-runner/src/protocol.ts +10 -0
- package/marketplace/plugins/command-runner/src/server/discovery.test.ts +30 -0
- package/marketplace/plugins/command-runner/src/server/scan.ts +16 -3
- package/package.json +1 -1
- package/src/client/components/common/header-controls/MoreMenu.tsx +24 -14
- package/src/client/components/common/header-controls/index.test.tsx +22 -0
- package/src/client/components/common/header-controls/index.tsx +8 -2
- package/src/client/components/layout/desktop-layout/LeftColumn.tsx +7 -0
- package/src/client/components/layout/session-sidebar/SessionsView.tsx +2 -1
- package/src/client/components/layout/session-sidebar/about-modal/index.test.tsx +1 -1
- package/src/client/components/mobile/LayoutWrapper.tsx +19 -2
- package/src/client/components/mobile/RightSidebar.tsx +49 -1
- package/src/client/components/mobile/SessionSidebar.tsx +29 -1
- package/src/client/components/mobile/header-titlebar.test.tsx +17 -0
- package/src/client/components/mobile/mobile-main-view/Header.test.tsx +43 -0
- package/src/client/components/mobile/mobile-main-view/Header.tsx +30 -0
- package/src/client/components/mobile/mobile-session-sidebar/Dock.tsx +5 -1
- package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +12 -1
- package/src/client/components/mobile/panel-chips.test.tsx +13 -0
- package/src/client/components/mobile/panel-chips.tsx +9 -2
- package/src/client/components/settings/categories/connect-settings/DeviceTable.test.tsx +92 -0
- package/src/client/components/settings/categories/connect-settings/DeviceTable.tsx +22 -3
- package/src/client/components/workspace/chat-timeline/MessageList.test.ts +19 -19
- package/src/client/components/workspace/git-panel/commit-modal/Header.test.tsx +21 -0
- package/src/client/components/workspace/git-panel/commit-modal/Header.tsx +13 -9
- package/src/client/components/workspace/terminal-panel/focus-target.test.ts +121 -0
- package/src/client/components/workspace/terminal-panel/focus-target.ts +54 -0
- package/src/client/components/workspace/terminal-panel/index.tsx +7 -1
- package/src/client/components/workspace/terminal-panel/instance.ts +82 -0
- package/src/client/components/workspace/terminal-panel/mount.ts +22 -63
- package/src/client/components/workspace/terminal-panel/soft-keyboard.ts +29 -0
- package/src/client/hooks/commands/use-command-runtime.ts +15 -0
- package/src/client/hooks/ui/touch-device.ts +8 -3
- 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/visibility-menu-trigger.test.ts +155 -0
- package/src/client/hooks/ui/visibility-menu-trigger.ts +85 -0
- package/src/client/hooks/workspace/panel-visibility-menu.ts +50 -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/lib/ui/soft-keyboard.test.ts +103 -0
- package/src/client/lib/ui/soft-keyboard.ts +90 -0
- package/src/client/main.tsx +9 -0
- package/src/server/lib/auth/guard.ts +8 -2
- 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/connect/devices.server.test.ts +70 -0
- package/src/server/lib/connect/devices.server.ts +43 -1
- package/src/server/lib/connect/last-connect.gate.test.ts +52 -0
- package/src/server/routes/connect/devices.ts +5 -4
- package/src/shared/lib/commands/catalog.test.ts +36 -0
- package/src/shared/lib/commands/catalog.ts +16 -0
- package/src/shared/lib/connect/types.ts +1 -0
- package/src/shared/lib/updates/popup-state.ts +11 -0
- package/dist/client/static/js/ImageView-t3rkypzs.js +0 -1
- package/dist/client/static/js/LayoutWrapper-th2pd4yt.js +0 -2
- package/dist/client/static/js/SessionsView-yqy0a1xg.js +0 -1
- package/dist/client/static/js/architecture-7GRP2DOG-y0zb4vqa.js +0 -1
- package/dist/client/static/js/bash-k6p3y3pr.js +0 -1
- package/dist/client/static/js/c-ve09y19q.js +0 -1
- package/dist/client/static/js/cpp-vhqp7bcy.js +0 -1
- package/dist/client/static/js/css-77mvf0ca.js +0 -1
- package/dist/client/static/js/css-tys2rrny.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-nt1ed192.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-v4edaxx7.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-6gc6gd1d.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-adzhec96.js +0 -1
- package/dist/client/static/js/graphql-g97hycb3.js +0 -1
- package/dist/client/static/js/html-2syect3n.js +0 -1
- package/dist/client/static/js/index-1jeyjqkh.js +0 -2
- package/dist/client/static/js/index-4ry8kz8h.js +0 -3
- package/dist/client/static/js/index-fjqp03xe.js +0 -2
- package/dist/client/static/js/index-fs3pbqwn.js +0 -1
- package/dist/client/static/js/index-jze0zg3z.js +0 -2
- package/dist/client/static/js/index-w0xvdda9.js +0 -1
- package/dist/client/static/js/index-wfcgqjzr.js +0 -1
- package/dist/client/static/js/info-A6RAGUB7-2ye26vqn.js +0 -1
- package/dist/client/static/js/ini-7ffv28px.js +0 -1
- package/dist/client/static/js/java-4x5yky4a.js +0 -1
- package/dist/client/static/js/javascript-4kw2j9t3.js +0 -1
- package/dist/client/static/js/json-h3kwpty2.js +0 -1
- package/dist/client/static/js/jsx-jk20f0dr.js +0 -1
- package/dist/client/static/js/lua-k02dpxq8.js +0 -1
- package/dist/client/static/js/markdown-fhhg7ms6.js +0 -1
- package/dist/client/static/js/one-dark-pro-n0as47q7.js +0 -1
- package/dist/client/static/js/one-light-05nw3mzj.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-b0j3te0q.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-28qq62fn.js +0 -1
- package/dist/client/static/js/properties-qhvcxc13.js +0 -1
- package/dist/client/static/js/python-3qsrs510.js +0 -1
- package/dist/client/static/js/r-z2ng7mza.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-fyrcbpyd.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-9s62qncd.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-f7yjmhrk.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-sfrw8gkz.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-4mm4cern.js +0 -1
- package/dist/client/static/js/sql-ypk53ntb.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-d48g5gjf.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-a5vgg4gz.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-ctqhajgg.js +0 -1
- package/dist/client/static/js/tsx-zy7hb2hw.js +0 -1
- package/dist/client/static/js/typescript-2hr53c8j.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-ns7e0fqf.js +0 -1
- package/dist/client/static/js/xml-p4742r9b.js +0 -1
- package/dist/client/static/js/yaml-qbckg671.js +0 -1
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
* from the frame in place right after the raw listeners return.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
import path from 'node:path';
|
|
32
31
|
import { isRecord } from '@/shared/lib/util/guards';
|
|
33
32
|
import type { AgentEvent } from '@/server/lib/omp/rpc/constants';
|
|
34
33
|
import { classifyCommand } from '@/server/lib/changes/classify-command';
|
|
@@ -48,7 +47,8 @@ import type {
|
|
|
48
47
|
ShellTrace,
|
|
49
48
|
} from '@/server/lib/changes/capture-types';
|
|
50
49
|
import { readHeadContent, takeScan, type GitScan } from '@/server/lib/changes/scan.server';
|
|
51
|
-
import { isBuildPath, isExcludedTempPath } from '@/server/lib/changes/temp-path';
|
|
50
|
+
import { isBuildPath, isExcludedTempPath, isInside } from '@/server/lib/changes/temp-path';
|
|
51
|
+
import { captureTargets } from '@/server/lib/changes/capture-targets';
|
|
52
52
|
import { reconstructEdit, resolveRacedWrite } from '@/server/lib/changes/capture-write.server';
|
|
53
53
|
import { MAX_BLOB_BYTES } from '@/server/lib/changes/blobs.server';
|
|
54
54
|
|
|
@@ -166,15 +166,20 @@ export class ChangeCapture {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
async #snapshotBefore(pending: PendingCall): Promise<void> {
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
// ACP agents name their shell tool `exec_command`, `shell`, or even the
|
|
170
|
+
// command itself; the `command` argument is the one stable signal.
|
|
171
|
+
const command = typeof pending.args.command === 'string' ? pending.args.command : '';
|
|
172
|
+
if (pending.tool === 'bash' || command) {
|
|
171
173
|
pending.command = command;
|
|
172
|
-
pending.
|
|
174
|
+
const commandCwd = typeof pending.args.cwd === 'string' && isInside(pending.args.cwd, this.deps.cwd)
|
|
175
|
+
? pending.args.cwd
|
|
176
|
+
: this.deps.cwd;
|
|
177
|
+
pending.plan = classifyCommand(command, commandCwd, this.deps.home);
|
|
173
178
|
if (pending.plan.scan) {
|
|
174
179
|
pending.scan = await this.#takeScan(this.deps.cwd);
|
|
175
180
|
}
|
|
176
181
|
}
|
|
177
|
-
for (const absolute of
|
|
182
|
+
for (const absolute of captureTargets(pending, this.deps.cwd)) {
|
|
178
183
|
if (pending.before.has(absolute)) continue;
|
|
179
184
|
const info = await this.#statFile(absolute);
|
|
180
185
|
const text = await this.#readCapped(absolute);
|
|
@@ -182,27 +187,6 @@ export class ChangeCapture {
|
|
|
182
187
|
}
|
|
183
188
|
}
|
|
184
189
|
|
|
185
|
-
#targets(pending: PendingCall): string[] {
|
|
186
|
-
if (pending.tool === 'bash') {
|
|
187
|
-
const paths: string[] = [];
|
|
188
|
-
for (const mutation of pending.plan?.mutations ?? []) {
|
|
189
|
-
paths.push(mutation.path);
|
|
190
|
-
if (mutation.from) paths.push(mutation.from);
|
|
191
|
-
}
|
|
192
|
-
return paths;
|
|
193
|
-
}
|
|
194
|
-
const args = pending.args;
|
|
195
|
-
const raw: unknown[] = [args.path, args.file_path, args.moveTo, args.destination];
|
|
196
|
-
if (Array.isArray(args.paths)) raw.push(...args.paths);
|
|
197
|
-
if (Array.isArray(args.files)) raw.push(...args.files);
|
|
198
|
-
const paths: string[] = [];
|
|
199
|
-
for (const value of raw) {
|
|
200
|
-
if (typeof value !== 'string' || !value || value.includes('://')) continue;
|
|
201
|
-
paths.push(path.isAbsolute(value) ? path.normalize(value) : path.resolve(this.deps.cwd, value));
|
|
202
|
-
}
|
|
203
|
-
return paths;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
190
|
async #end(event: AgentEvent): Promise<void> {
|
|
207
191
|
const toolCallId = typeof event.toolCallId === 'string' ? event.toolCallId : '';
|
|
208
192
|
if (!toolCallId) return;
|
|
@@ -214,12 +198,13 @@ export class ChangeCapture {
|
|
|
214
198
|
// resumes later.
|
|
215
199
|
const trace = extractTrace(event);
|
|
216
200
|
await pending.ready;
|
|
217
|
-
|
|
201
|
+
const isShell = pending.tool === 'bash' || typeof pending.args.command === 'string';
|
|
202
|
+
if (isShell) await this.#endBash(pending, trace);
|
|
218
203
|
else await this.#endFileTool(pending);
|
|
219
204
|
}
|
|
220
205
|
|
|
221
206
|
async #endFileTool(pending: PendingCall): Promise<void> {
|
|
222
|
-
const targets =
|
|
207
|
+
const targets = captureTargets(pending, this.deps.cwd);
|
|
223
208
|
if (targets.length === 0) {
|
|
224
209
|
// A read-only tool (`read`, `glob`, `grep`) has no adapter and no
|
|
225
210
|
// mutation; only a tool whose NAME promises a write is worth a note.
|
|
@@ -4,11 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* The capture layer
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* command is a `note`, and a subagent's write is attributed to the child.
|
|
7
|
+
* The capture layer, at the tool adapter: an `edit`, a `write` and an
|
|
8
|
+
* `apply_patch` become journal records, an ACP agent's arg spellings are read,
|
|
9
|
+
* and a write under the OS temp dir or a build directory is not journaled.
|
|
10
|
+
* The shell half (trace, scan, subagents) is `capture-shell.test.ts`.
|
|
12
11
|
*
|
|
13
12
|
* The fake filesystem is a `Map`, so the before/after pair is deterministic:
|
|
14
13
|
* `flush()` after the start frame proves the snapshot ran before the test
|
|
@@ -21,7 +20,6 @@ import * as fsp from 'node:fs/promises';
|
|
|
21
20
|
import * as os from 'node:os';
|
|
22
21
|
import * as path from 'node:path';
|
|
23
22
|
import { makeCapture, records, REPO } from '@/server/lib/changes/capture-test-util';
|
|
24
|
-
import { ChangeJournal } from '@/server/lib/changes/journal.server';
|
|
25
23
|
import { readSessionChangeDiff } from '@/server/lib/changes/reader.server';
|
|
26
24
|
|
|
27
25
|
let dataDir = '';
|
|
@@ -135,199 +133,121 @@ describe('build paths', () => {
|
|
|
135
133
|
});
|
|
136
134
|
});
|
|
137
135
|
|
|
138
|
-
describe('
|
|
139
|
-
test('
|
|
140
|
-
const files = new Map([[at('
|
|
141
|
-
const capture = makeCapture('cap-
|
|
136
|
+
describe('apply_patch', () => {
|
|
137
|
+
test('a patch names its paths and the change is recorded', async () => {
|
|
138
|
+
const files = new Map([[at('a.txt'), 'old']]);
|
|
139
|
+
const capture = makeCapture('cap-patch', files);
|
|
142
140
|
capture.onFrame({
|
|
143
141
|
type: 'tool_execution_start',
|
|
144
142
|
toolCallId: 'c1',
|
|
145
|
-
toolName: '
|
|
146
|
-
args: {
|
|
143
|
+
toolName: 'apply_patch',
|
|
144
|
+
args: { input: '*** Begin Patch\n*** Update File: a.txt\n@@\n-old\n+new\n*** End Patch' },
|
|
147
145
|
});
|
|
148
146
|
await capture.flush();
|
|
149
|
-
files.
|
|
150
|
-
capture.onFrame({
|
|
151
|
-
type: 'tool_execution_end',
|
|
152
|
-
toolCallId: 'c1',
|
|
153
|
-
toolName: 'bash',
|
|
154
|
-
result: { details: { trace: { status: 0, units: [{ nodes: [{ k: 'simple', argv: ['rm', '-f', 'c.ts'], st: 0 }] }] } } },
|
|
155
|
-
});
|
|
147
|
+
files.set(at('a.txt'), 'new');
|
|
148
|
+
capture.onFrame({ type: 'tool_execution_end', toolCallId: 'c1', toolName: 'apply_patch' });
|
|
156
149
|
await capture.flush();
|
|
157
150
|
|
|
158
|
-
const
|
|
159
|
-
expect(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
test('sed -i is an update', async () => {
|
|
164
|
-
const files = new Map([[at('d.ts'), 'a']]);
|
|
165
|
-
const capture = makeCapture('cap-sed', files);
|
|
166
|
-
capture.onFrame({
|
|
167
|
-
type: 'tool_execution_start',
|
|
168
|
-
toolCallId: 'c1',
|
|
169
|
-
toolName: 'bash',
|
|
170
|
-
args: { command: "sed -i 's/a/b/' d.ts" },
|
|
171
|
-
});
|
|
172
|
-
await capture.flush();
|
|
173
|
-
files.set(at('d.ts'), 'b');
|
|
174
|
-
capture.onFrame({
|
|
175
|
-
type: 'tool_execution_end',
|
|
176
|
-
toolCallId: 'c1',
|
|
177
|
-
toolName: 'bash',
|
|
178
|
-
result: { details: { trace: { status: 0, units: [{ nodes: [{ k: 'simple', argv: ['sed', '-i', 's/a/b/', 'd.ts'], st: 0 }] }] } } },
|
|
179
|
-
});
|
|
180
|
-
await capture.flush();
|
|
181
|
-
|
|
182
|
-
const diff = await readSessionChangeDiff('cap-sed', at('d.ts'), 0, WINDOW_END);
|
|
183
|
-
expect(diff?.status).toBe('modified');
|
|
184
|
-
expect(diff?.oldContent).toBe('a');
|
|
185
|
-
expect(diff?.newContent).toBe('b');
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
test('a redirect is a create the trace does not name', async () => {
|
|
189
|
-
const files = new Map<string, string>();
|
|
190
|
-
const capture = makeCapture('cap-redirect', files);
|
|
191
|
-
capture.onFrame({
|
|
192
|
-
type: 'tool_execution_start',
|
|
193
|
-
toolCallId: 'c1',
|
|
194
|
-
toolName: 'bash',
|
|
195
|
-
args: { command: 'echo hi > e.txt' },
|
|
196
|
-
});
|
|
197
|
-
await capture.flush();
|
|
198
|
-
files.set(at('e.txt'), 'hi\n');
|
|
199
|
-
capture.onFrame({
|
|
200
|
-
type: 'tool_execution_end',
|
|
201
|
-
toolCallId: 'c1',
|
|
202
|
-
toolName: 'bash',
|
|
203
|
-
result: { details: { trace: { status: 0, units: [{ nodes: [{ k: 'simple', argv: ['echo', 'hi'], st: 0 }] }] } } },
|
|
204
|
-
});
|
|
205
|
-
await capture.flush();
|
|
206
|
-
|
|
207
|
-
const diff = await readSessionChangeDiff('cap-redirect', at('e.txt'), 0, WINDOW_END);
|
|
208
|
-
expect(diff?.status).toBe('added');
|
|
209
|
-
expect(diff?.newContent).toBe('hi\n');
|
|
151
|
+
const change = (await records('cap-patch')).find((line) => line.type === 'change');
|
|
152
|
+
expect(change?.type).toBe('change');
|
|
153
|
+
if (change?.type !== 'change') throw new Error('expected a change');
|
|
154
|
+
expect(change.op).toBe('update');
|
|
155
|
+
expect(change.path).toBe(at('a.txt'));
|
|
210
156
|
});
|
|
157
|
+
});
|
|
211
158
|
|
|
212
|
-
|
|
159
|
+
describe('ACP shell tools', () => {
|
|
160
|
+
test('exec_command with a command is captured as a shell call', async () => {
|
|
213
161
|
const files = new Map<string, string>();
|
|
214
|
-
const capture = makeCapture('cap-
|
|
162
|
+
const capture = makeCapture('cap-acp-exec', files);
|
|
215
163
|
capture.onFrame({
|
|
216
164
|
type: 'tool_execution_start',
|
|
217
165
|
toolCallId: 'c1',
|
|
218
|
-
toolName: '
|
|
219
|
-
args: { command: '
|
|
166
|
+
toolName: 'exec_command',
|
|
167
|
+
args: { command: 'printf hello > a.txt', cwd: REPO },
|
|
220
168
|
});
|
|
221
169
|
await capture.flush();
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
toolCallId: 'c1',
|
|
225
|
-
toolName: 'bash',
|
|
226
|
-
result: { details: { trace: { status: 0, units: [{ nodes: [{ k: 'simple', argv: ['bun', 'test'], st: 0 }] }] } } },
|
|
227
|
-
});
|
|
170
|
+
files.set(at('a.txt'), 'hello');
|
|
171
|
+
capture.onFrame({ type: 'tool_execution_end', toolCallId: 'c1', toolName: 'exec_command' });
|
|
228
172
|
await capture.flush();
|
|
229
173
|
|
|
230
|
-
const
|
|
231
|
-
expect(
|
|
232
|
-
|
|
233
|
-
expect(
|
|
234
|
-
|
|
235
|
-
expect(note.reason).toBe('opaque-command');
|
|
174
|
+
const change = (await records('cap-acp-exec')).find((line) => line.type === 'change');
|
|
175
|
+
expect(change?.type).toBe('change');
|
|
176
|
+
if (change?.type !== 'change') throw new Error('expected a change');
|
|
177
|
+
expect(change.op).toBe('create');
|
|
178
|
+
expect(change.path).toBe(at('a.txt'));
|
|
236
179
|
});
|
|
237
|
-
});
|
|
238
180
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
const files = new Map([[at('g.ts'), 'old']]);
|
|
181
|
+
test('a shell tool named after the command is captured', async () => {
|
|
182
|
+
const files = new Map([[at('rm.txt'), 'hello']]);
|
|
242
183
|
const scans = [
|
|
243
|
-
{ root: REPO, dirty: new Map([[at('
|
|
244
|
-
{ root: REPO, dirty: new Map
|
|
184
|
+
{ root: REPO, dirty: new Map([[at('rm.txt'), 'hello']]), truncated: false },
|
|
185
|
+
{ root: REPO, dirty: new Map<string, string | null>(), truncated: false },
|
|
245
186
|
];
|
|
246
|
-
const capture = makeCapture('cap-
|
|
187
|
+
const capture = makeCapture('cap-acp-rm', files, {
|
|
247
188
|
takeScan: async () => scans.shift() ?? null,
|
|
248
189
|
readHead: async () => null,
|
|
249
190
|
});
|
|
250
191
|
capture.onFrame({
|
|
251
192
|
type: 'tool_execution_start',
|
|
252
193
|
toolCallId: 'c1',
|
|
253
|
-
toolName: '
|
|
254
|
-
args: { command: '
|
|
194
|
+
toolName: 'rm -f rm.txt',
|
|
195
|
+
args: { command: "/bin/zsh -lc 'rm -f rm.txt'", cwd: REPO },
|
|
255
196
|
});
|
|
256
197
|
await capture.flush();
|
|
257
|
-
files.
|
|
258
|
-
capture.onFrame({
|
|
259
|
-
type: 'tool_execution_end',
|
|
260
|
-
toolCallId: 'c1',
|
|
261
|
-
toolName: 'bash',
|
|
262
|
-
result: { details: { trace: { status: 0, units: [{ nodes: [{ k: 'simple', argv: ['git', 'reset', '--hard'], st: 0 }] }] } } },
|
|
263
|
-
});
|
|
198
|
+
files.delete(at('rm.txt'));
|
|
199
|
+
capture.onFrame({ type: 'tool_execution_end', toolCallId: 'c1', toolName: 'rm -f rm.txt' });
|
|
264
200
|
await capture.flush();
|
|
265
201
|
|
|
266
|
-
const
|
|
267
|
-
expect(
|
|
268
|
-
|
|
269
|
-
expect(
|
|
202
|
+
const change = (await records('cap-acp-rm')).find((line) => line.type === 'change');
|
|
203
|
+
expect(change?.type).toBe('change');
|
|
204
|
+
if (change?.type !== 'change') throw new Error('expected a change');
|
|
205
|
+
expect(change.op).toBe('delete');
|
|
206
|
+
expect(change.path).toBe(at('rm.txt'));
|
|
270
207
|
});
|
|
271
208
|
});
|
|
272
209
|
|
|
273
|
-
describe('
|
|
274
|
-
test('a
|
|
275
|
-
const other = new ChangeJournal('cap-other', REPO);
|
|
276
|
-
await other.recordChange({
|
|
277
|
-
at: Date.now(), agent: 'Main', tool: 'edit', op: 'update', path: at('file4.txt'),
|
|
278
|
-
displayPath: 'file4.txt', before: 'a', after: 'b', source: 'tool',
|
|
279
|
-
});
|
|
280
|
-
await other.flush();
|
|
281
|
-
|
|
210
|
+
describe('ACP arg spellings', () => {
|
|
211
|
+
test('a write with filePath is recorded', async () => {
|
|
282
212
|
const files = new Map<string, string>();
|
|
283
|
-
const
|
|
284
|
-
{ root: REPO, dirty: new Map<string, string | null>(), truncated: false },
|
|
285
|
-
{ root: REPO, dirty: new Map([[at('file4.txt'), 'python']]), truncated: false },
|
|
286
|
-
];
|
|
287
|
-
const capture = makeCapture('cap-cross', files, {
|
|
288
|
-
takeScan: async () => scans.shift() ?? null,
|
|
289
|
-
readHead: async () => null,
|
|
290
|
-
});
|
|
213
|
+
const capture = makeCapture('cap-acp-write', files);
|
|
291
214
|
capture.onFrame({
|
|
292
215
|
type: 'tool_execution_start',
|
|
293
216
|
toolCallId: 'c1',
|
|
294
|
-
toolName: '
|
|
295
|
-
args: {
|
|
217
|
+
toolName: 'write',
|
|
218
|
+
args: { filePath: 'a.txt', content: 'hello' },
|
|
296
219
|
});
|
|
297
220
|
await capture.flush();
|
|
298
|
-
files.set(at('
|
|
299
|
-
capture.onFrame({
|
|
300
|
-
type: 'tool_execution_end',
|
|
301
|
-
toolCallId: 'c1',
|
|
302
|
-
toolName: 'bash',
|
|
303
|
-
result: { details: { trace: { status: 0, units: [{ nodes: [{ k: 'simple', argv: ['python3', '-'], st: 0 }] }] } } },
|
|
304
|
-
});
|
|
221
|
+
files.set(at('a.txt'), 'hello');
|
|
222
|
+
capture.onFrame({ type: 'tool_execution_end', toolCallId: 'c1', toolName: 'write' });
|
|
305
223
|
await capture.flush();
|
|
306
224
|
|
|
307
|
-
const
|
|
308
|
-
expect(
|
|
225
|
+
const change = (await records('cap-acp-write')).find((line) => line.type === 'change');
|
|
226
|
+
expect(change?.type).toBe('change');
|
|
227
|
+
if (change?.type !== 'change') throw new Error('expected a change');
|
|
228
|
+
expect(change.op).toBe('create');
|
|
229
|
+
expect(change.path).toBe(at('a.txt'));
|
|
309
230
|
});
|
|
310
|
-
});
|
|
311
231
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
const
|
|
315
|
-
const capture = makeCapture('cap-sub', files);
|
|
232
|
+
test('an edit with oldString/newString is reconstructed', async () => {
|
|
233
|
+
const files = new Map([[at('b.txt'), 'old']]);
|
|
234
|
+
const capture = makeCapture('cap-acp-edit', files);
|
|
316
235
|
capture.onFrame({
|
|
317
|
-
type: '
|
|
318
|
-
|
|
236
|
+
type: 'tool_execution_start',
|
|
237
|
+
toolCallId: 'c1',
|
|
238
|
+
toolName: 'edit',
|
|
239
|
+
args: { filePath: 'b.txt', oldString: 'old', newString: 'new' },
|
|
319
240
|
});
|
|
320
241
|
await capture.flush();
|
|
321
|
-
files.set(at('
|
|
322
|
-
capture.onFrame({
|
|
323
|
-
type: 'subagent_event',
|
|
324
|
-
payload: { type: 'tool_execution_end', toolCallId: 's1', toolName: 'edit', agent: 'Child' },
|
|
325
|
-
});
|
|
242
|
+
files.set(at('b.txt'), 'new');
|
|
243
|
+
capture.onFrame({ type: 'tool_execution_end', toolCallId: 'c1', toolName: 'edit' });
|
|
326
244
|
await capture.flush();
|
|
327
245
|
|
|
328
|
-
const change = (await records('cap-
|
|
246
|
+
const change = (await records('cap-acp-edit')).find((line) => line.type === 'change');
|
|
329
247
|
expect(change?.type).toBe('change');
|
|
330
248
|
if (change?.type !== 'change') throw new Error('expected a change');
|
|
331
|
-
expect(change.
|
|
249
|
+
expect(change.op).toBe('update');
|
|
250
|
+
expect(change.path).toBe(at('b.txt'));
|
|
332
251
|
});
|
|
333
252
|
});
|
|
253
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Paths named by an `apply_patch` payload.
|
|
8
|
+
*
|
|
9
|
+
* The codex/Claude patch tool sends the patch as text (`args.input`,
|
|
10
|
+
* `args.patch`, `args.patchText`), not as a path. The headers are the only
|
|
11
|
+
* place the paths appear:
|
|
12
|
+
*
|
|
13
|
+
* *** Begin Patch
|
|
14
|
+
* *** Update File: src/a.ts
|
|
15
|
+
* *** Add File: src/b.ts
|
|
16
|
+
* *** Delete File: src/c.ts
|
|
17
|
+
* *** Move to: src/d.ts
|
|
18
|
+
* *** End Patch
|
|
19
|
+
*
|
|
20
|
+
* A `Move to` names the destination; the source is the preceding `Update File`
|
|
21
|
+
* header, so both are returned and the capture snapshots both sides.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const FILE_HEADER = /^\*\*\* (?:Update|Add|Delete) File: (.+)$/;
|
|
25
|
+
const MOVE_HEADER = /^\*\*\* Move to: (.+)$/;
|
|
26
|
+
|
|
27
|
+
export function patchPaths(text: string): string[] {
|
|
28
|
+
const paths: string[] = [];
|
|
29
|
+
for (const line of text.split('\n')) {
|
|
30
|
+
const trimmed = line.trim();
|
|
31
|
+
const file = FILE_HEADER.exec(trimmed);
|
|
32
|
+
if (file?.[1]) paths.push(file[1].trim());
|
|
33
|
+
const move = MOVE_HEADER.exec(trimmed);
|
|
34
|
+
if (move?.[1]) paths.push(move[1].trim());
|
|
35
|
+
}
|
|
36
|
+
return paths;
|
|
37
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The last-connect timestamp.
|
|
8
|
+
*
|
|
9
|
+
* The Settings page reads `last_seen_at` as "Last connect", and the only writer
|
|
10
|
+
* that fires on ordinary use is the auth gate's `markDeviceConnected`. Pairing
|
|
11
|
+
* alone is not a connect: a device that redeemed a code but never opened the
|
|
12
|
+
* console must stay unmarked, which is what the first case pins.
|
|
13
|
+
*
|
|
14
|
+
* The throttle is deliberate — the gate runs on every request, so a write per
|
|
15
|
+
* frame would be a database write in front of every page load. The second case
|
|
16
|
+
* pins that a burst of requests moves the timestamp once.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
20
|
+
|
|
21
|
+
import { getDb } from '@/server/db.server';
|
|
22
|
+
import {
|
|
23
|
+
ensureConnectSchema,
|
|
24
|
+
listPairedDevices,
|
|
25
|
+
markDeviceConnected,
|
|
26
|
+
mintDeviceToken,
|
|
27
|
+
} from '@/server/lib/connect/devices.server';
|
|
28
|
+
import { isolateDb, releaseDb } from '@/test-support/isolated-db';
|
|
29
|
+
|
|
30
|
+
beforeEach(async () => {
|
|
31
|
+
await isolateDb();
|
|
32
|
+
globalThis.__kabmoDeviceMarks = new Map();
|
|
33
|
+
globalThis.__kabmoDeviceTokens = new Map();
|
|
34
|
+
await ensureConnectSchema(await getDb());
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
afterEach(async () => {
|
|
38
|
+
await releaseDb();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
describe('last connect', () => {
|
|
42
|
+
test('a freshly paired device has not connected yet', async () => {
|
|
43
|
+
await mintDeviceToken({ name: 'Phone', platform: 'ios' });
|
|
44
|
+
const [device] = await listPairedDevices();
|
|
45
|
+
expect(device?.lastSeenAt).toBeNull();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('a token use records the time', async () => {
|
|
49
|
+
const device = await mintDeviceToken({ name: 'Phone', platform: 'ios' });
|
|
50
|
+
const before = Date.now();
|
|
51
|
+
await markDeviceConnected(device.id);
|
|
52
|
+
|
|
53
|
+
const [listed] = await listPairedDevices();
|
|
54
|
+
expect(listed?.lastSeenAt).not.toBeNull();
|
|
55
|
+
const at = Date.parse(listed?.lastSeenAt ?? '');
|
|
56
|
+
expect(at).toBeGreaterThanOrEqual(before);
|
|
57
|
+
expect(at).toBeLessThanOrEqual(Date.now());
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('a burst of requests moves the timestamp once per window', async () => {
|
|
61
|
+
const device = await mintDeviceToken({ name: 'Phone', platform: 'ios' });
|
|
62
|
+
await markDeviceConnected(device.id);
|
|
63
|
+
const first = (await listPairedDevices())[0]?.lastSeenAt;
|
|
64
|
+
|
|
65
|
+
await markDeviceConnected(device.id);
|
|
66
|
+
await markDeviceConnected(device.id);
|
|
67
|
+
|
|
68
|
+
expect((await listPairedDevices())[0]?.lastSeenAt).toBe(first ?? null);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
@@ -36,6 +36,8 @@ interface DeviceRow {
|
|
|
36
36
|
declare global {
|
|
37
37
|
// eslint-disable-next-line no-var
|
|
38
38
|
var __kabmoDeviceTokens: Map<string, string> | undefined;
|
|
39
|
+
// eslint-disable-next-line no-var
|
|
40
|
+
var __kabmoDeviceMarks: Map<string, number> | undefined;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
function tokenCache(): Map<string, string> {
|
|
@@ -43,6 +45,42 @@ function tokenCache(): Map<string, string> {
|
|
|
43
45
|
return globalThis.__kabmoDeviceTokens;
|
|
44
46
|
}
|
|
45
47
|
|
|
48
|
+
/**
|
|
49
|
+
* How often one device's connect timestamp is written.
|
|
50
|
+
*
|
|
51
|
+
* The gate runs on every request — pages, frames, WebSocket upgrades — so the
|
|
52
|
+
* timestamp is throttled in memory: the first request after the window records,
|
|
53
|
+
* and the next minute of traffic is free of writes.
|
|
54
|
+
*/
|
|
55
|
+
const CONNECT_MARK_INTERVAL_MS = 60_000;
|
|
56
|
+
|
|
57
|
+
function connectMarks(): Map<string, number> {
|
|
58
|
+
globalThis.__kabmoDeviceMarks ??= new Map();
|
|
59
|
+
return globalThis.__kabmoDeviceMarks;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Record that `id` just used its token.
|
|
64
|
+
*
|
|
65
|
+
* This is the "last connect" the Settings page shows, and it is deliberately a
|
|
66
|
+
* report of USE rather than of pairing: a device that paired last week and is
|
|
67
|
+
* open right now must not read "last seen: last week". Never throws — the
|
|
68
|
+
* request is already authorized and the timestamp is a display fact, not a
|
|
69
|
+
* credential — and a failed write is retried by the next allowed window.
|
|
70
|
+
*/
|
|
71
|
+
export async function markDeviceConnected(id: string): Promise<void> {
|
|
72
|
+
const marks = connectMarks();
|
|
73
|
+
const now = Date.now();
|
|
74
|
+
if (now - (marks.get(id) ?? 0) < CONNECT_MARK_INTERVAL_MS) return;
|
|
75
|
+
marks.set(id, now);
|
|
76
|
+
try {
|
|
77
|
+
const db = await getDb();
|
|
78
|
+
await db.run('UPDATE paired_devices SET last_seen_at = ? WHERE id = ?', [now, id]);
|
|
79
|
+
} catch {
|
|
80
|
+
// The device stays authorized; the next connection retries.
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
46
84
|
export async function ensureConnectSchema(db: DbClient): Promise<void> {
|
|
47
85
|
await db.exec(`
|
|
48
86
|
CREATE TABLE IF NOT EXISTS paired_devices (
|
|
@@ -167,6 +205,7 @@ export async function revokeDevice(id: string): Promise<boolean> {
|
|
|
167
205
|
if (!row) return false;
|
|
168
206
|
await db.run('UPDATE paired_devices SET revoked_at = ? WHERE id = ?', [Date.now(), id]);
|
|
169
207
|
tokenCache().delete(row.token_hash);
|
|
208
|
+
connectMarks().delete(id);
|
|
170
209
|
return true;
|
|
171
210
|
}
|
|
172
211
|
|
|
@@ -182,10 +221,13 @@ export async function touchDevice(
|
|
|
182
221
|
): Promise<void> {
|
|
183
222
|
try {
|
|
184
223
|
const db = await getDb();
|
|
224
|
+
const now = Date.now();
|
|
185
225
|
await db.run(
|
|
186
226
|
'UPDATE paired_devices SET last_seen_at = ?, route = COALESCE(?, route), rtt_ms = COALESCE(?, rtt_ms) WHERE id = ?',
|
|
187
|
-
[
|
|
227
|
+
[now, report?.route ?? null, report?.rttMs ?? null, id],
|
|
188
228
|
);
|
|
229
|
+
// The gate would otherwise write the same timestamp immediately after.
|
|
230
|
+
connectMarks().set(id, now);
|
|
189
231
|
} catch {
|
|
190
232
|
// See above: a display fact, not a credential.
|
|
191
233
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The gate is what records "last connect".
|
|
8
|
+
*
|
|
9
|
+
* No shell reports its connection after pairing, so a timestamp written only by
|
|
10
|
+
* `POST /api/connect/devices` would leave every real device reading "Never
|
|
11
|
+
* connected" while it is open. This case starts at the actual entry point — a
|
|
12
|
+
* request carrying the device token — and reads the row the Settings page
|
|
13
|
+
* reads back.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { afterEach, beforeEach, expect, test } from 'bun:test';
|
|
17
|
+
import path from 'node:path';
|
|
18
|
+
|
|
19
|
+
import { authGate, initAuth } from '@/server/lib/auth/guard';
|
|
20
|
+
import { getDb } from '@/server/db.server';
|
|
21
|
+
import {
|
|
22
|
+
ensureConnectSchema,
|
|
23
|
+
listPairedDevices,
|
|
24
|
+
mintDeviceToken,
|
|
25
|
+
} from '@/server/lib/connect/devices.server';
|
|
26
|
+
import { isolateDb, releaseDb } from '@/test-support/isolated-db';
|
|
27
|
+
|
|
28
|
+
beforeEach(async () => {
|
|
29
|
+
const dbPath = await isolateDb();
|
|
30
|
+
Bun.env.KABMO_DATA_DIR = path.dirname(dbPath);
|
|
31
|
+
globalThis.__kabmoDeviceMarks = new Map();
|
|
32
|
+
globalThis.__kabmoDeviceTokens = new Map();
|
|
33
|
+
await ensureConnectSchema(await getDb());
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
afterEach(async () => {
|
|
37
|
+
await initAuth(null);
|
|
38
|
+
delete Bun.env.KABMO_DATA_DIR;
|
|
39
|
+
await releaseDb();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('an authenticated device request moves the last-connect timestamp', async () => {
|
|
43
|
+
await initAuth('correct horse battery staple');
|
|
44
|
+
const device = await mintDeviceToken({ name: 'Phone', platform: 'ios' });
|
|
45
|
+
expect((await listPairedDevices())[0]?.lastSeenAt).toBeNull();
|
|
46
|
+
|
|
47
|
+
const request = new Request('http://localhost/api/settings', {
|
|
48
|
+
headers: { authorization: `Bearer ${device.token}` },
|
|
49
|
+
});
|
|
50
|
+
expect(await authGate(request)).toBeUndefined();
|
|
51
|
+
expect((await listPairedDevices())[0]?.lastSeenAt).not.toBeNull();
|
|
52
|
+
});
|
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
* `DELETE /api/connect/devices?id=…` — revoke one.
|
|
9
9
|
* `POST /api/connect/devices` — a device reports the route it is using.
|
|
10
10
|
*
|
|
11
|
-
* The report is a POST rather than a side effect of every request: the
|
|
12
|
-
* runs on every call and
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* The route report is a POST rather than a side effect of every request: the
|
|
12
|
+
* auth gate runs on every call, and the fact it records is only that the device
|
|
13
|
+
* connected (throttled to one write per minute per device). A device reports its
|
|
14
|
+
* route and round trip once when it chooses one, because the server cannot
|
|
15
|
+
* measure either.
|
|
15
16
|
*/
|
|
16
17
|
|
|
17
18
|
import { json, NO_STORE_HEADERS, type ActionFunctionArgs } from '@/server/lib/remix-compat';
|