@kabmo-labs/kabmo 0.36.0 → 0.38.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 +547 -528
- package/dist/client/static/js/{CsvGrid-1h3bcak7.js → CsvGrid-90zfbn7f.js} +2 -2
- package/dist/client/static/js/{DocxView-ndca8jch.js → DocxView-vwq2rf16.js} +2 -2
- package/dist/client/static/js/{DrawioView-kpzd6y0b.js → DrawioView-bvx7eqcz.js} +2 -2
- package/dist/client/static/js/{ImageView-79prn3dg.js → ImageView-q6xfmbrq.js} +1 -1
- package/dist/client/static/js/{LayoutWrapper-v2wn2sb2.js → LayoutWrapper-qatdaw3n.js} +2 -2
- package/dist/client/static/js/{Modal-99j0zz3z.js → Modal-6jx1fvfb.js} +15 -15
- package/dist/client/static/js/{PdfView-2rjd87ay.js → PdfView-tkv2d2zs.js} +1 -1
- package/dist/client/static/js/{SessionsView-t7f3s71b.js → SessionsView-rbnecykz.js} +1 -1
- package/dist/client/static/js/{SheetView-ehb976st.js → SheetView-t08g8kdr.js} +4 -4
- package/dist/client/static/js/{SvgPreview-de2bbba6.js → SvgPreview-9vh6mdcp.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-nx9jzn7m.js → abnfDiagram-O67JEVCF-bxcn33e1.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-r8sz34h3.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-170v67rr.js → architectureDiagram-NJMV4G6O-40ggw6e8.js} +2 -2
- package/dist/client/static/js/{astro-80bs6hvg.js → astro-p3f5p9p2.js} +1 -1
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-16q285n1.js → blockDiagram-BEXU5L5S-k41cvjrd.js} +6 -6
- package/dist/client/static/js/c-jkdstn33.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-rn3qt45h.js → c4Diagram-YGBWAQC7-rdcmn6ac.js} +2 -2
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-r26wg74e.js → classDiagram-v2-NBCMYWYE-txbmbkxv.js} +5 -5
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-82kwe7ha.js → cose-bilkent-JH36ORCC-bxzh3qj1.js} +1 -1
- package/dist/client/static/js/cpp-9d3xdpe3.js +1 -0
- package/dist/client/static/js/css-r3wja1ze.js +1 -0
- package/dist/client/static/js/css-sebxkh5f.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-w2f2vev7.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-tcxdn6pa.js → cynefinDiagram-VND7K2PF-abx5343b.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-g833ata3.js → dagre-6A5THRUB-baj278kt.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-f1fq8xec.js → diagram-22UHCM2B-vqvhdc5m.js} +7 -7
- package/dist/client/static/js/{diagram-3UASUU5V-6j2w016f.js → diagram-3UASUU5V-w328rfx0.js} +2 -2
- package/dist/client/static/js/{diagram-ATOU4E4O-6t2qxsk4.js → diagram-ATOU4E4O-zzcmwnm8.js} +2 -2
- package/dist/client/static/js/{diagram-CDSNMT55-7abar8s7.js → diagram-CDSNMT55-8yw39mmj.js} +1 -1
- package/dist/client/static/js/{diagram-MLGK6HIB-s68rgy16.js → diagram-MLGK6HIB-zgc386pv.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-azgkm6w8.js → diagram-MPIPVDR6-efmvvscm.js} +1 -1
- package/dist/client/static/js/{dockerfile-47e33kqa.js → dockerfile-bp5dre33.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-esrjz750.js → ebnfDiagram-ZINNZB2B-p66h0dzq.js} +1 -1
- package/dist/client/static/js/{elixir-rpa1g4gy.js → elixir-jwphgp8j.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-fhr4b4jj.js → elk-276RUBZZ-g0jjxcqd.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-5r3fmdnz.js → erDiagram-OPXOYQCR-39gat96z.js} +4 -4
- package/dist/client/static/js/{erlang-bh5cbm8m.js → erlang-6m6tpt72.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-k5n61zzh.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-f6jpcqyq.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-j4pf6rdn.js → ganttDiagram-FUAMR5RP-nsjv1zt4.js} +2 -2
- package/dist/client/static/js/gitGraph-4MIJSDKK-2gf053bx.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-x5epk0gr.js → gitGraphDiagram-X574FWY7-r4vnkcy3.js} +2 -2
- package/dist/client/static/js/graphql-p4cskvad.js +1 -0
- package/dist/client/static/js/html-f26r6vv5.js +1 -0
- package/dist/client/static/js/{index-c1j0xb0w.js → index-0kxqzafy.js} +1 -1
- package/dist/client/static/js/{index-3kgrcaq1.js → index-11bdd235.js} +1 -1
- package/dist/client/static/js/{index-b48p8d1j.js → index-1qszrvzk.js} +2 -2
- package/dist/client/static/js/{index-3vdmwpbh.js → index-24yyj78e.js} +2 -2
- package/dist/client/static/js/{index-63c6t75t.js → index-2drjp9ks.js} +1 -1
- package/dist/client/static/js/{index-d2km9egp.js → index-2ndq1ngv.js} +4 -4
- package/dist/client/static/js/{index-0j518hqm.js → index-3az1w5f8.js} +2 -2
- package/dist/client/static/js/{index-ye450a7z.js → index-50z4ek83.js} +1 -1
- package/dist/client/static/js/{index-60ceydzn.js → index-5ebhb94w.js} +1 -1
- package/dist/client/static/js/{index-ctgefatv.js → index-5y0bvq4q.js} +34 -34
- package/dist/client/static/js/{index-40ve7zzv.js → index-6ax2z70w.js} +1 -1
- package/dist/client/static/js/{index-9t82sx0w.js → index-6k3e5dph.js} +2 -2
- package/dist/client/static/js/{index-6xzfta4b.js → index-73jwm4d5.js} +1 -1
- package/dist/client/static/js/{index-8cy3x2y8.js → index-7fdp9c7m.js} +2 -2
- package/dist/client/static/js/{index-zvfvqvn9.js → index-9wd9y6m0.js} +2 -2
- package/dist/client/static/js/{index-q5t4sy22.js → index-9wtg6ywn.js} +4 -4
- package/dist/client/static/js/{index-nws03exw.js → index-a74k07z2.js} +2 -2
- package/dist/client/static/js/{index-982jyfsb.js → index-ashpbfqv.js} +2 -2
- package/dist/client/static/js/{index-zp73zexp.js → index-b9b2nwdd.js} +2 -2
- package/dist/client/static/js/{index-h1e1abpt.js → index-c15r8jd3.js} +2 -2
- package/dist/client/static/js/{index-5rzk1226.js → index-da10qpns.js} +2 -2
- package/dist/client/static/js/{index-ky0prc71.js → index-dfgdn3fj.js} +9 -9
- package/dist/client/static/js/{index-c09a5s1n.js → index-dkseg29t.js} +9 -9
- package/dist/client/static/js/{index-w3n97x4b.js → index-dt7e1328.js} +2 -2
- package/dist/client/static/js/{index-sar2ggde.js → index-e1pr3k50.js} +2 -2
- package/dist/client/static/js/{index-0b1kwsam.js → index-fghst0kd.js} +32 -32
- package/dist/client/static/js/{index-af24nes6.js → index-gbfg0anm.js} +2 -2
- package/dist/client/static/js/{index-vtbbfwx0.js → index-gr6jng0x.js} +2 -2
- package/dist/client/static/js/{index-44qrckd2.js → index-gwhx66f4.js} +1 -1
- package/dist/client/static/js/{index-55pqvh82.js → index-h7pn9qw6.js} +2 -2
- package/dist/client/static/js/{index-97t3mv1v.js → index-h8h5c2r8.js} +1 -1
- package/dist/client/static/js/{index-v5t761a1.js → index-ha75kff0.js} +2 -2
- package/dist/client/static/js/{index-ydvfc9td.js → index-hzx81cjq.js} +4 -4
- package/dist/client/static/js/{index-be6gevq8.js → index-k9xsvab3.js} +1 -1
- package/dist/client/static/js/{index-v8qd8ypc.js → index-nd4p98mc.js} +2 -2
- package/dist/client/static/js/{index-dmgawfhw.js → index-qkscve6n.js} +2 -2
- package/dist/client/static/js/{index-w7xbfv44.js → index-qn4pkjfh.js} +2 -2
- package/dist/client/static/js/{index-zdtsvnpq.js → index-r83kr4s5.js} +2 -2
- package/dist/client/static/js/{index-htt8qxm3.js → index-ra38ggke.js} +1 -1
- package/dist/client/static/js/{index-skm6k5w2.js → index-rf0p3v7q.js} +5 -5
- package/dist/client/static/js/{index-7r1hw2gd.js → index-rgp69pa8.js} +1 -1
- package/dist/client/static/js/{index-8e15fzax.js → index-rqrcw8nj.js} +2 -2
- package/dist/client/static/js/{index-63jbb4kf.js → index-sa9cp6km.js} +2 -2
- package/dist/client/static/js/{index-75haaj8g.js → index-st202rjv.js} +184 -184
- package/dist/client/static/js/{index-mm1rf116.js → index-t5t71dhp.js} +2 -2
- package/dist/client/static/js/{index-ktvbsj6w.js → index-tfsaj5d1.js} +2 -2
- package/dist/client/static/js/{index-k1xt92h4.js → index-tv61v3t3.js} +1 -1
- package/dist/client/static/js/index-tzm90bsz.js +1 -0
- package/dist/client/static/js/{index-z6g74h7g.js → index-vb6t44dw.js} +2 -2
- package/dist/client/static/js/{index-pyx8n25s.js → index-vnn7m9yp.js} +3 -3
- package/dist/client/static/js/{index-5kjpacvd.js → index-vxd4gykh.js} +2 -2
- package/dist/client/static/js/{index-r8pckaqe.js → index-xya34x4v.js} +2 -2
- package/dist/client/static/js/{index-a293pdg7.js → index-y3hdv561.js} +2 -2
- package/dist/client/static/js/{index-9gf8b73w.js → index-z0cpp5bc.js} +2 -2
- package/dist/client/static/js/info-A6RAGUB7-3tr0y3s6.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-ktc8nb8g.js → infoDiagram-VRGFBTTK-e39pvm4j.js} +1 -1
- package/dist/client/static/js/ini-cg0a5wm3.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-n3dk6227.js → ishikawaDiagram-OU5B5YK6-rqhszgvp.js} +2 -2
- package/dist/client/static/js/java-vcck089n.js +1 -0
- package/dist/client/static/js/javascript-nyf39d5r.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-f0p1h8qn.js → journeyDiagram-ZHPQQLJL-wgy5qrsv.js} +3 -3
- package/dist/client/static/js/jsx-ht9zyzwa.js +1 -0
- package/dist/client/static/js/{julia-73zjh2w6.js → julia-237yk557.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-7jdt7dv1.js → kanban-definition-PNTS6WVX-b8bxn0h1.js} +3 -3
- package/dist/client/static/js/lua-86fjqj8v.js +1 -0
- package/dist/client/static/js/markdown-gwmsh53r.js +1 -0
- package/dist/client/static/js/{mermaid.core-e8rzrjt9.js → mermaid.core-vb5ehtre.js} +6 -6
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-7shv6ge0.js → mindmap-definition-NLK3R4M7-t4p38s38.js} +3 -3
- package/dist/client/static/js/one-dark-pro-dhybn1ff.js +1 -0
- package/dist/client/static/js/one-light-bqg77ay0.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-xbsyjzrh.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-17ak2zx3.js → pegDiagram-GJSIUBJH-3gp4madx.js} +1 -1
- package/dist/client/static/js/{perl-8z46dmze.js → perl-dvz4y1tb.js} +1 -1
- package/dist/client/static/js/{php-6qvnp2t6.js → php-n6y7dzhm.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-j2tpz0cs.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-at4x1g4q.js → pieDiagram-5QR66LMP-0cbm773h.js} +2 -2
- package/dist/client/static/js/properties-mzvvbqg5.js +1 -0
- package/dist/client/static/js/python-3w64wsyd.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-apzhwrn4.js → quadrantDiagram-O4NWA36T-jwg7fc9f.js} +1 -1
- package/dist/client/static/js/r-32re2zwb.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-m3tsyfv0.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-5p202a4q.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-hj0y9tgn.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-8c5dct8f.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-3tx8z65q.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-rw8cj5f3.js → railroadDiagram-XR7U4H2S-38xh691s.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-qyrse7mb.js → requirementDiagram-PLB6GJNP-gpddawxh.js} +4 -4
- package/dist/client/static/js/{ruby-qy8mhstq.js → ruby-7zye3g0e.js} +1 -1
- package/dist/client/static/js/{rust-fpshqnk0.js → rust-bx3ecv4n.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-254qr59q.js → sankeyDiagram-IPEJSGJF-s6t6bbhk.js} +1 -1
- package/dist/client/static/js/{sass-kbwea482.js → sass-m0h9yzfb.js} +1 -1
- package/dist/client/static/js/{scss-zphrqp25.js → scss-2pwwfkvn.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-y9xjxfc5.js → sequenceDiagram-PO4LG4MO-wkq51pmb.js} +3 -3
- package/dist/client/static/js/{sizeCapture-INFHLROL-sc5e60t3.js → sizeCapture-INFHLROL-xtwexf8k.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-r134s4xr.js → stateDiagram-v2-GCMORJYK-jnwsqa7y.js} +3 -3
- package/dist/client/static/js/{svelte-mwtx07d9.js → svelte-x8f8c8hq.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-xc7rbawt.js → swimlanes-2SLR337P-mnkkqcbx.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-6xmrz03n.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-cgjd8shk.js → timeline-definition-EJHVYXUP-rxq6heqh.js} +2 -2
- package/dist/client/static/js/treeView-Q6P3EWNA-mf0rb2yv.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-0x5gf06b.js +1 -0
- package/dist/client/static/js/typescript-5nmrzgkj.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-9qsmjhm6.js → usecaseDiagram-POWQR4AR-dz94f57t.js} +13 -13
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-4grw9awx.js → vennDiagram-UO4OBE2U-5mmvkhsq.js} +1 -1
- package/dist/client/static/js/{vue-j8vb9d7r.js → vue-myjjd0gd.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-x7ej8dms.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-8gxy0wat.js → wardleyDiagram-VNRHLVJA-dctdntpa.js} +1 -1
- package/dist/client/static/js/xml-3dd1pter.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-5sh7tdrx.js → xychartDiagram-PMCCYNJV-njyfrqkv.js} +2 -2
- package/dist/client/static/js/yaml-yssayv8a.js +1 -0
- package/package.json +1 -1
- package/src/client/components/common/ComposerPicker.tsx +24 -12
- package/src/client/components/common/ComposerTextarea.tsx +1 -0
- package/src/client/components/layout/session-sidebar/scheduler-modal/ModelFields.tsx +1 -1
- package/src/client/components/settings/apply-side-effects.test.ts +5 -4
- package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/index.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FormAsk.test.tsx +210 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FormAsk.tsx +342 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/LooseFieldAsk.tsx +44 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OrphanAsks.test.tsx +44 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OrphanAsks.tsx +10 -5
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/PluginPendingInteractions.test.ts +1 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/drafts.ts +19 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/form-picks.ts +52 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.test.ts +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.tsx +53 -4
- package/src/client/components/workspace/model-dropdown/index.tsx +1 -1
- package/src/client/components/workspace/model-dropdown/use-catalog.ts +3 -32
- package/src/client/data/settings/omp-schema.json +55 -1
- package/src/client/hooks/chat/composer/harness-model-picker.ts +84 -0
- package/src/client/hooks/chat/composer/index.ts +26 -6
- package/src/client/hooks/chat/timeline/ask-frames.test.ts +80 -7
- package/src/client/hooks/chat/timeline/ask-frames.ts +95 -21
- package/src/client/hooks/models/use-harnesses.ts +15 -2
- package/src/client/hooks/ui/icon-style.ts +7 -4
- package/src/client/hooks/ui/style-attributes.test.ts +11 -11
- package/src/client/hooks/ui/surface-style.ts +8 -5
- package/src/server/lib/assets/shell-attributes.server.ts +12 -9
- package/src/server/lib/assets/shell-attributes.test.ts +18 -13
- package/src/server/lib/auth/agent-gate.server.ts +64 -0
- package/src/server/lib/auth/agent-tree-gate.test.ts +121 -0
- package/src/server/lib/auth/guard.test.ts +18 -18
- package/src/server/lib/auth/guard.ts +15 -11
- package/src/server/lib/auth/handover-guard.test.ts +1 -1
- package/src/server/lib/changes/attach.server.ts +57 -0
- package/src/server/lib/changes/attach.test.ts +94 -0
- package/src/server/lib/changes/blobs.server.ts +52 -0
- package/src/server/lib/changes/capture-bash.server.ts +106 -0
- package/src/server/lib/changes/capture-fs.server.ts +64 -0
- package/src/server/lib/changes/capture-runs.test.ts +136 -0
- package/src/server/lib/changes/capture-test-util.ts +46 -0
- package/src/server/lib/changes/capture-types.ts +62 -0
- package/src/server/lib/changes/capture.server.ts +333 -0
- package/src/server/lib/changes/capture.test.ts +245 -0
- package/src/server/lib/changes/classify-command.test.ts +172 -0
- package/src/server/lib/changes/classify-command.ts +272 -0
- package/src/server/lib/changes/classify-git.ts +88 -0
- package/src/server/lib/changes/classify-paths.ts +112 -0
- package/src/server/lib/changes/classify-tokenize.ts +185 -0
- package/src/server/lib/changes/journal.server.ts +183 -0
- package/src/server/lib/changes/journal.test.ts +125 -0
- package/src/server/lib/changes/merge.test.ts +137 -0
- package/src/server/lib/changes/paths.server.ts +37 -0
- package/src/server/lib/changes/purge.server.ts +32 -0
- package/src/server/lib/changes/reader.server.ts +322 -0
- package/src/server/lib/changes/reader.test.ts +137 -0
- package/src/server/lib/changes/records.ts +120 -0
- package/src/server/lib/changes/scan.server.ts +89 -0
- package/src/server/lib/harness/register.server.ts +3 -0
- package/src/server/lib/omp/rpc/event-fanout.test.ts +58 -0
- package/src/server/lib/omp/rpc/event-fanout.ts +19 -0
- package/src/server/lib/omp/rpc/manager.ts +4 -3
- package/src/server/lib/omp/rpc/session-registration.ts +5 -0
- package/src/server/lib/omp/rpc/session-registry.ts +4 -5
- package/src/server/lib/omp/session/delete.server.ts +4 -0
- package/src/server/lib/sessions/agent-token.server.test.ts +28 -5
- package/src/server/lib/sessions/agent-token.server.ts +42 -6
- package/src/server/lib/sessions/relation-access.server.test.ts +96 -0
- package/src/server/lib/sessions/relation-access.server.ts +71 -0
- package/src/server/routes/sessions/changes.ts +1 -1
- package/src/shared/lib/chat/ask-form/fields.ts +1 -0
- package/src/shared/lib/chat/ask-form/types.ts +6 -0
- package/src/shared/lib/chat/ask-questions.ts +56 -3
- package/src/shared/lib/chat/composer/delegation.ts +2 -13
- package/src/shared/lib/chat/composer/filter.test.ts +39 -0
- package/src/shared/lib/chat/composer/filter.ts +23 -13
- package/src/shared/lib/chat/composer/harness-model-items.test.ts +54 -0
- package/src/shared/lib/chat/composer/harness-model-items.ts +41 -0
- package/src/shared/lib/chat/composer/trigger.test.ts +50 -0
- package/src/shared/lib/chat/composer/trigger.ts +29 -1
- package/src/shared/lib/chat/timeline/changed-files.test.ts +16 -0
- package/src/shared/lib/chat/timeline/changed-files.ts +102 -25
- package/src/shared/lib/harness/catalog.ts +21 -0
- package/src/{client/components/workspace/model-dropdown/harness-models.test.ts → shared/lib/harness/models.test.ts} +1 -1
- package/src/shared/lib/icons/icon-paint-authority.ts +5 -3
- package/src/shared/lib/models/option.ts +46 -0
- package/src/shared/lib/omp/config/schema.test.ts +20 -0
- package/src/shared/lib/theme/icon-style.test.ts +8 -5
- package/src/shared/lib/theme/icon-style.ts +15 -7
- package/src/shared/lib/theme/surface-style.test.ts +8 -5
- package/src/shared/lib/theme/surface-style.ts +17 -7
- package/src/shared/lib/workspace/sidebar-style.test.ts +7 -8
- package/src/shared/lib/workspace/sidebar-style.ts +7 -8
- package/src/shared/types/chat.ts +12 -6
- package/src/shared/types/omp/agent.ts +9 -0
- package/src/shared/types/session-changes.ts +4 -0
- package/dist/client/static/js/architecture-7GRP2DOG-aqft2erp.js +0 -1
- package/dist/client/static/js/c-wkgxb1t1.js +0 -1
- package/dist/client/static/js/cpp-y0t6mynx.js +0 -1
- package/dist/client/static/js/css-r2nhvzff.js +0 -1
- package/dist/client/static/js/css-tf1s0nb7.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-v2sz60t6.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-8qbefe4m.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-krsvgcq7.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-9bx1a38k.js +0 -1
- package/dist/client/static/js/graphql-xnpp5gn9.js +0 -1
- package/dist/client/static/js/html-pv88ny12.js +0 -1
- package/dist/client/static/js/index-dh1vd0d9.js +0 -1
- package/dist/client/static/js/info-A6RAGUB7-j51t7jhh.js +0 -1
- package/dist/client/static/js/ini-ygfyhprj.js +0 -1
- package/dist/client/static/js/java-gm49vw59.js +0 -1
- package/dist/client/static/js/javascript-4kw2j9t3.js +0 -1
- package/dist/client/static/js/jsx-ksxw1byz.js +0 -1
- package/dist/client/static/js/lua-53gzb9bx.js +0 -1
- package/dist/client/static/js/markdown-tk3cd3vs.js +0 -1
- package/dist/client/static/js/one-dark-pro-39bt34v9.js +0 -1
- package/dist/client/static/js/one-light-xec0sehr.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-n83gfj2g.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-5c5pctwz.js +0 -1
- package/dist/client/static/js/properties-2tcybqjk.js +0 -1
- package/dist/client/static/js/python-qph3dntq.js +0 -1
- package/dist/client/static/js/r-gd26x93y.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-52e5n99a.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-44nqxxpy.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-25jxgwg7.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-64pqpf2y.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-0p5sxzpx.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-kdcdamkj.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-8j14nnd1.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-esf993kk.js +0 -1
- package/dist/client/static/js/typescript-0s2t05jj.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-v4dxm2sb.js +0 -1
- package/dist/client/static/js/xml-0py2vkw7.js +0 -1
- package/dist/client/static/js/yaml-vghdz0f0.js +0 -1
- /package/src/{client/components/workspace/model-dropdown/harness-models.ts → shared/lib/harness/models.ts} +0 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The Kabmo change journal's line shapes.
|
|
8
|
+
*
|
|
9
|
+
* One JSON object per line, append-only. The journal is Kabmo's own record of
|
|
10
|
+
* what a run did to the working tree — not omp's `changes.jsonl`, which only
|
|
11
|
+
* sees the edit tools. The extra fields are the point: `toolCallId` joins a
|
|
12
|
+
* write to the call that made it, `source` says which capture layer saw it, and
|
|
13
|
+
* `command`/`exit` make a `bash` mutation explainable.
|
|
14
|
+
*
|
|
15
|
+
* `before`/`after` are blob keys, `null` when the file did not exist, and
|
|
16
|
+
* `undefined` when the content was not stored (over the cap). A `note` line is
|
|
17
|
+
* how the journal says "I could not capture this" instead of guessing.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import type { MutationOp } from '@/server/lib/changes/classify-command';
|
|
21
|
+
|
|
22
|
+
export interface JournalSessionRecord {
|
|
23
|
+
v: 1;
|
|
24
|
+
type: 'session';
|
|
25
|
+
at: number;
|
|
26
|
+
sessionId: string;
|
|
27
|
+
cwd: string;
|
|
28
|
+
omp?: string;
|
|
29
|
+
kabmo?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface JournalRunRecord {
|
|
33
|
+
v: 1;
|
|
34
|
+
type: 'run';
|
|
35
|
+
phase: 'start' | 'end';
|
|
36
|
+
runId: string;
|
|
37
|
+
at: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface JournalCallRecord {
|
|
41
|
+
v: 1;
|
|
42
|
+
type: 'call';
|
|
43
|
+
at: number;
|
|
44
|
+
/** The run this call belongs to; absent on a journal written before runs. */
|
|
45
|
+
runId?: string;
|
|
46
|
+
/** The run's `agent_start` time, so a reader can map it to a chat run. */
|
|
47
|
+
runAt?: number;
|
|
48
|
+
toolCallId: string;
|
|
49
|
+
agent: string;
|
|
50
|
+
parent?: string;
|
|
51
|
+
tool: string;
|
|
52
|
+
intent?: string;
|
|
53
|
+
/** The call's arguments, truncated to a bounded JSON string. */
|
|
54
|
+
args?: unknown;
|
|
55
|
+
argsTruncated?: boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface JournalChangeRecord {
|
|
59
|
+
v: 1;
|
|
60
|
+
type: 'change';
|
|
61
|
+
at: number;
|
|
62
|
+
runId?: string;
|
|
63
|
+
runAt?: number;
|
|
64
|
+
toolCallId?: string;
|
|
65
|
+
agent: string;
|
|
66
|
+
parent?: string;
|
|
67
|
+
tool: string;
|
|
68
|
+
op: MutationOp;
|
|
69
|
+
/** Absolute path after the write. */
|
|
70
|
+
path: string;
|
|
71
|
+
/** Absolute source path, for a rename. */
|
|
72
|
+
from?: string;
|
|
73
|
+
displayPath: string;
|
|
74
|
+
before: string | null | undefined;
|
|
75
|
+
after: string | null | undefined;
|
|
76
|
+
beforeMtimeMs?: number;
|
|
77
|
+
afterMtimeMs?: number;
|
|
78
|
+
source: 'tool' | 'trace' | 'scan' | 'omp-import';
|
|
79
|
+
command?: string;
|
|
80
|
+
exit?: number;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface JournalCommitRecord {
|
|
84
|
+
v: 1;
|
|
85
|
+
type: 'commit';
|
|
86
|
+
at: number;
|
|
87
|
+
sha: string;
|
|
88
|
+
paths: string[];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface JournalNoteRecord {
|
|
92
|
+
v: 1;
|
|
93
|
+
type: 'note';
|
|
94
|
+
at: number;
|
|
95
|
+
runId?: string;
|
|
96
|
+
runAt?: number;
|
|
97
|
+
toolCallId?: string;
|
|
98
|
+
reason: 'too-large' | 'opaque-command' | 'scan-budget' | 'snapshot-race' | 'unknown-tool';
|
|
99
|
+
detail?: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export type JournalRecord =
|
|
103
|
+
| JournalSessionRecord
|
|
104
|
+
| JournalRunRecord
|
|
105
|
+
| JournalCallRecord
|
|
106
|
+
| JournalChangeRecord
|
|
107
|
+
| JournalCommitRecord
|
|
108
|
+
| JournalNoteRecord;
|
|
109
|
+
|
|
110
|
+
/** Parse one journal line; `null` for a torn or foreign line. */
|
|
111
|
+
export function parseJournalLine(line: string): JournalRecord | null {
|
|
112
|
+
if (!line) return null;
|
|
113
|
+
try {
|
|
114
|
+
const value = JSON.parse(line) as Record<string, unknown>;
|
|
115
|
+
if (value?.v !== 1 || typeof value.type !== 'string') return null;
|
|
116
|
+
return value as unknown as JournalRecord;
|
|
117
|
+
} catch {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The filesystem reconciliation pass: what an opaque command changed.
|
|
8
|
+
*
|
|
9
|
+
* A `git reset --hard`, a `bun install`, a shell script — the classifier cannot
|
|
10
|
+
* name their targets from `argv`, so the journal takes a cheap snapshot before
|
|
11
|
+
* and after and journals the delta. The snapshot is `git status --porcelain`
|
|
12
|
+
* plus the content of the dirty paths (bounded), because a path that was
|
|
13
|
+
* already dirty has no HEAD version to fall back on.
|
|
14
|
+
*
|
|
15
|
+
* A path that was CLEAN at start has an exact before side: `git show HEAD:path`.
|
|
16
|
+
* A path that was dirty at start is read at snapshot time, so a command that
|
|
17
|
+
* rewrites it is still caught. A path outside the repo, or a repo that is not
|
|
18
|
+
* there, answers `null` and the caller writes a note instead of a guess.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import path from 'node:path';
|
|
22
|
+
import { childEnv } from '@/server/lib/fs/child-env';
|
|
23
|
+
|
|
24
|
+
const SCAN_BUDGET_FILES = 200;
|
|
25
|
+
const GIT_TIMEOUT_MS = 5_000;
|
|
26
|
+
|
|
27
|
+
export interface GitScan {
|
|
28
|
+
root: string;
|
|
29
|
+
/** Absolute path → content at snapshot time, for paths that were dirty. */
|
|
30
|
+
dirty: Map<string, string | null>;
|
|
31
|
+
/** The budget cut the dirty set; the caller says so rather than pretending. */
|
|
32
|
+
truncated: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function runGit(cwd: string, args: string[]): Promise<string | null> {
|
|
36
|
+
try {
|
|
37
|
+
const proc = Bun.spawn(['git', '-C', cwd, ...args], {
|
|
38
|
+
env: childEnv(),
|
|
39
|
+
stdout: 'pipe',
|
|
40
|
+
stderr: 'ignore',
|
|
41
|
+
signal: AbortSignal.timeout(GIT_TIMEOUT_MS),
|
|
42
|
+
});
|
|
43
|
+
const [text, code] = await Promise.all([new Response(proc.stdout).text(), proc.exited]);
|
|
44
|
+
return code === 0 ? text : null;
|
|
45
|
+
} catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** `XY <path>\0` entries; a rename's second entry (the old path) is skipped. */
|
|
51
|
+
function parseStatus(output: string): string[] {
|
|
52
|
+
const paths: string[] = [];
|
|
53
|
+
for (const entry of output.split('\0')) {
|
|
54
|
+
if (entry.length < 4 || entry[2] !== ' ') continue;
|
|
55
|
+
paths.push(entry.slice(3));
|
|
56
|
+
}
|
|
57
|
+
return paths;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function readText(absolute: string): Promise<string | null> {
|
|
61
|
+
try {
|
|
62
|
+
return await Bun.file(absolute).text();
|
|
63
|
+
} catch {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Snapshot the repo's dirty set and its content; `null` outside a repo. */
|
|
69
|
+
export async function takeGitScan(cwd: string): Promise<GitScan | null> {
|
|
70
|
+
const root = (await runGit(cwd, ['rev-parse', '--show-toplevel']))?.trim();
|
|
71
|
+
if (!root) return null;
|
|
72
|
+
const status = await runGit(root, ['status', '--porcelain=v1', '-z']);
|
|
73
|
+
if (status === null) return null;
|
|
74
|
+
|
|
75
|
+
const entries = parseStatus(status);
|
|
76
|
+
const dirty = new Map<string, string | null>();
|
|
77
|
+
for (const relative of entries.slice(0, SCAN_BUDGET_FILES)) {
|
|
78
|
+
const absolute = path.resolve(root, relative);
|
|
79
|
+
dirty.set(absolute, await readText(absolute));
|
|
80
|
+
}
|
|
81
|
+
return { root, dirty, truncated: entries.length > SCAN_BUDGET_FILES };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** The content at HEAD for a path that was clean; `null` when it did not exist. */
|
|
85
|
+
export async function readHeadContent(root: string, absolute: string): Promise<string | null> {
|
|
86
|
+
const relative = path.relative(root, absolute);
|
|
87
|
+
if (!relative || relative.startsWith('..') || path.isAbsolute(relative)) return null;
|
|
88
|
+
return runGit(root, ['show', `HEAD:${relative.replaceAll('\\', '/')}`]);
|
|
89
|
+
}
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import type { HarnessSession } from '@/server/lib/harness/session';
|
|
18
|
+
import { attachChangeJournal } from '@/server/lib/changes/attach.server';
|
|
18
19
|
|
|
19
20
|
/** Pulled from the omp registry module so there is one map, not two. */
|
|
20
21
|
export function registerAcpSession(
|
|
@@ -27,7 +28,9 @@ export function registerAcpSession(
|
|
|
27
28
|
const registry = liveRegistry();
|
|
28
29
|
registry.set(session.sessionId, session);
|
|
29
30
|
if (requestedId && requestedId !== session.sessionId) registry.set(requestedId, session);
|
|
31
|
+
const journal = attachChangeJournal(session);
|
|
30
32
|
session.onDestroy(() => {
|
|
33
|
+
journal.detach();
|
|
31
34
|
if (registry.get(session.sessionId) === session) registry.delete(session.sessionId);
|
|
32
35
|
if (registry.get(requestedId) === session) registry.delete(requestedId);
|
|
33
36
|
// The caller's cleanup rides the SAME hook: `onDestroy` holds one callback,
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The fan-out's two listener lists.
|
|
8
|
+
*
|
|
9
|
+
* `on` is the ordinary stream every subscriber reads; `onRaw` runs first, before
|
|
10
|
+
* `stripShellTrace` mutates the frame in place. The change journal is the only
|
|
11
|
+
* raw listener: it needs the shell trace, and every other subscriber must not
|
|
12
|
+
* pay for it.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { describe, expect, test } from 'bun:test';
|
|
16
|
+
import { EventFanout } from '@/server/lib/omp/rpc/event-fanout';
|
|
17
|
+
import type { AgentEvent } from '@/server/lib/omp/rpc/constants';
|
|
18
|
+
|
|
19
|
+
describe('EventFanout raw listeners', () => {
|
|
20
|
+
test('a raw listener sees the shell trace before the strip', () => {
|
|
21
|
+
const fanout = new EventFanout();
|
|
22
|
+
let rawTrace: unknown;
|
|
23
|
+
let normalTrace: unknown;
|
|
24
|
+
fanout.onRaw((event) => {
|
|
25
|
+
rawTrace = (event.result as { details?: { trace?: unknown } } | undefined)?.details?.trace;
|
|
26
|
+
});
|
|
27
|
+
fanout.on((event) => {
|
|
28
|
+
normalTrace = (event.result as { details?: { trace?: unknown } } | undefined)?.details?.trace;
|
|
29
|
+
});
|
|
30
|
+
fanout.emit({
|
|
31
|
+
type: 'tool_execution_end',
|
|
32
|
+
result: { content: [], details: { exitCode: 0, trace: { v: 1 } } },
|
|
33
|
+
} as unknown as AgentEvent);
|
|
34
|
+
expect(rawTrace).toEqual({ v: 1 });
|
|
35
|
+
expect(normalTrace).toBeUndefined();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('a throwing raw listener does not starve the ordinary ones', () => {
|
|
39
|
+
const fanout = new EventFanout();
|
|
40
|
+
const seen: number[] = [];
|
|
41
|
+
fanout.onRaw(() => {
|
|
42
|
+
throw new Error('journal failed');
|
|
43
|
+
});
|
|
44
|
+
fanout.on((event) => seen.push(event.n as number));
|
|
45
|
+
expect(() => fanout.emit({ type: 'message_update', n: 3 })).not.toThrow();
|
|
46
|
+
expect(seen).toEqual([3]);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('an unsubscribed raw listener no longer fires', () => {
|
|
50
|
+
const fanout = new EventFanout();
|
|
51
|
+
let calls = 0;
|
|
52
|
+
const off = fanout.onRaw(() => calls++);
|
|
53
|
+
fanout.emit({ type: 'message_update' });
|
|
54
|
+
off();
|
|
55
|
+
fanout.emit({ type: 'message_update' });
|
|
56
|
+
expect(calls).toBe(1);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -29,8 +29,18 @@ import { stripShellTrace } from '@/shared/lib/omp/session/shell-trace';
|
|
|
29
29
|
|
|
30
30
|
export class EventFanout {
|
|
31
31
|
readonly #listeners: EventListener[] = [];
|
|
32
|
+
readonly #rawListeners: EventListener[] = [];
|
|
32
33
|
|
|
33
34
|
emit(event: AgentEvent): void {
|
|
35
|
+
// Raw listeners run BEFORE the strip: the change journal needs the shell
|
|
36
|
+
// trace, and the strip mutates the frame in place.
|
|
37
|
+
for (const listener of this.#rawListeners) {
|
|
38
|
+
try {
|
|
39
|
+
listener(event);
|
|
40
|
+
} catch {
|
|
41
|
+
// Deliberately swallowed: see the module doc.
|
|
42
|
+
}
|
|
43
|
+
}
|
|
34
44
|
stripShellTrace(event);
|
|
35
45
|
for (const listener of this.#listeners) {
|
|
36
46
|
try {
|
|
@@ -49,4 +59,13 @@ export class EventFanout {
|
|
|
49
59
|
if (index !== -1) this.#listeners.splice(index, 1);
|
|
50
60
|
};
|
|
51
61
|
}
|
|
62
|
+
|
|
63
|
+
/** Register a listener that sees the frame before the shell trace is stripped. */
|
|
64
|
+
onRaw(listener: EventListener): () => void {
|
|
65
|
+
this.#rawListeners.push(listener);
|
|
66
|
+
return () => {
|
|
67
|
+
const index = this.#rawListeners.indexOf(listener);
|
|
68
|
+
if (index !== -1) this.#rawListeners.splice(index, 1);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
52
71
|
}
|
|
@@ -259,9 +259,10 @@ export class AgentSessionWrapper {
|
|
|
259
259
|
this.fanout.emit(event);
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
onEvent(listener: EventListener): () => void {
|
|
263
|
-
|
|
264
|
-
|
|
262
|
+
onEvent(listener: EventListener): () => void { return this.fanout.on(listener); }
|
|
263
|
+
|
|
264
|
+
/** Frames before the shell trace is stripped — the change journal's tap. */
|
|
265
|
+
onRawEvent(listener: EventListener): () => void { return this.fanout.onRaw(listener); }
|
|
265
266
|
|
|
266
267
|
/** Dialogs omp is still blocked on, oldest first. A client reattaching to a
|
|
267
268
|
* live session replays these so the modal it lost on reload comes back. */
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import type { AgentSessionWrapper } from '@/server/lib/omp/rpc/manager';
|
|
19
19
|
import type { HarnessSession } from '@/server/lib/harness/session';
|
|
20
|
+
import { attachChangeJournal } from '@/server/lib/changes/attach.server';
|
|
20
21
|
|
|
21
22
|
/** Any session this registry can hold: the function only touches `sessionId` and
|
|
22
23
|
* `onDestroy`, which both transports provide. */
|
|
@@ -51,7 +52,11 @@ export function registerSpawnedSession(
|
|
|
51
52
|
requestedId: string,
|
|
52
53
|
realSessionId: string,
|
|
53
54
|
): void {
|
|
55
|
+
// The journal starts with the session and stops with it. `onDestroy` holds
|
|
56
|
+
// one callback, so the detach rides the same one as the registry cleanup.
|
|
57
|
+
const journal = attachChangeJournal(created);
|
|
54
58
|
created.onDestroy(() => {
|
|
59
|
+
journal.detach();
|
|
55
60
|
if (registry.get(created.sessionId) === created) registry.delete(created.sessionId);
|
|
56
61
|
if (registry.get(realSessionId) === created) registry.delete(realSessionId);
|
|
57
62
|
// The alias must go too, or a dead wrapper would answer for the requested id
|
|
@@ -332,11 +332,10 @@ export async function startNewRpcSession(
|
|
|
332
332
|
|
|
333
333
|
const registry = getRegistry();
|
|
334
334
|
const realSessionId = wrapper.sessionId;
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
registry.set(realSessionId, wrapper);
|
|
335
|
+
// The same registration the cold path uses: it installs the destroy cleanup
|
|
336
|
+
// AND starts the change journal, so a prewarmed session is not a second
|
|
337
|
+
// convention.
|
|
338
|
+
registerSpawnedSession(registry, wrapper, realSessionId, realSessionId);
|
|
340
339
|
// A prewarmed process is adopted here, not in `startRpcSession`, so this is
|
|
341
340
|
// the only spawn path that sees it — a session's cwd may sit outside every
|
|
342
341
|
// registered workspace, and the discovery watcher has to learn it. Awaited
|
|
@@ -43,6 +43,7 @@ import { siblingDirForSession } from '@/server/lib/omp/subagent/history/paths';
|
|
|
43
43
|
import { isSinglePathSegment } from '@/server/lib/fs/path-segment';
|
|
44
44
|
import { deleteSessionRelations } from '@/server/lib/sessions/relations.server';
|
|
45
45
|
import { removeSessionMcpOverlay } from '@/server/lib/mcp/session-overlay.server';
|
|
46
|
+
import { purgeChangeJournal } from '@/server/lib/changes/purge.server';
|
|
46
47
|
|
|
47
48
|
export interface SessionPurgeResult {
|
|
48
49
|
/** Something keyed to this id existed — a transcript, a mock session row, or
|
|
@@ -147,6 +148,9 @@ export async function purgeSessionData(sessionId: string): Promise<SessionPurgeR
|
|
|
147
148
|
// The overlay is a temp directory, not a row: a deleted session must not
|
|
148
149
|
// leave one behind for a future id to inherit.
|
|
149
150
|
await removeSessionMcpOverlay(sessionId);
|
|
151
|
+
// The change journal holds file contents; a deleted session must not keep a
|
|
152
|
+
// copy of every file the run touched.
|
|
153
|
+
await purgeChangeJournal(sessionId);
|
|
150
154
|
|
|
151
155
|
// A prompt waiting on this session will never be released: the dependency is
|
|
152
156
|
// gone. Fail it BY NAME rather than letting it wait for a session that no
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
createAgentToken,
|
|
13
13
|
hashAgentToken,
|
|
14
14
|
initAgentTokens,
|
|
15
|
+
lookupAgentToken,
|
|
15
16
|
rememberAgentToken,
|
|
16
17
|
revokeAgentToken,
|
|
17
18
|
verifyAgentToken,
|
|
@@ -53,12 +54,34 @@ describe('agent tokens', () => {
|
|
|
53
54
|
});
|
|
54
55
|
|
|
55
56
|
test('the path scope names the session it may touch', () => {
|
|
56
|
-
expect(agentTokenScopeForPath('/api/sessions/spawn')).
|
|
57
|
-
expect(agentTokenScopeForPath('/api/agent/s1')).
|
|
58
|
-
expect(agentTokenScopeForPath('/api/chat/s1')).
|
|
59
|
-
expect(agentTokenScopeForPath('/api/sessions/s1/fork')).
|
|
60
|
-
expect(agentTokenScopeForPath('/api/sessions/s1/relations')).
|
|
57
|
+
expect(agentTokenScopeForPath('/api/sessions/spawn')).toEqual({ kind: 'any' });
|
|
58
|
+
expect(agentTokenScopeForPath('/api/agent/s1')).toEqual({ kind: 'tree', target: 's1' });
|
|
59
|
+
expect(agentTokenScopeForPath('/api/chat/s1')).toEqual({ kind: 'tree', target: 's1' });
|
|
60
|
+
expect(agentTokenScopeForPath('/api/sessions/s1/fork')).toEqual({ kind: 'tree', target: 's1' });
|
|
61
|
+
expect(agentTokenScopeForPath('/api/sessions/s1/relations')).toEqual({ kind: 'tree', target: 's1' });
|
|
61
62
|
expect(agentTokenScopeForPath('/api/sessions/s1/archive')).toBeNull();
|
|
62
63
|
expect(agentTokenScopeForPath('/api/settings')).toBeNull();
|
|
63
64
|
});
|
|
65
|
+
|
|
66
|
+
test('a token this process never minted is found in the table', async () => {
|
|
67
|
+
// The peer-instance case: the owning process spawned the session, so this
|
|
68
|
+
// process's cache is empty while the row exists.
|
|
69
|
+
const token = createAgentToken();
|
|
70
|
+
await rememberAgentToken('s1', token);
|
|
71
|
+
globalThis.__kabmoAgentTokens = undefined;
|
|
72
|
+
|
|
73
|
+
expect(verifyAgentToken(token)).toBeNull();
|
|
74
|
+
expect(await lookupAgentToken(token)).toBe('s1');
|
|
75
|
+
// The read warms the cache, so the next call costs nothing.
|
|
76
|
+
expect(verifyAgentToken(token)).toBe('s1');
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('a revoked token is not resurrected by the table fallback', async () => {
|
|
80
|
+
const token = createAgentToken();
|
|
81
|
+
await rememberAgentToken('s1', token);
|
|
82
|
+
await revokeAgentToken('s1');
|
|
83
|
+
globalThis.__kabmoAgentTokens = undefined;
|
|
84
|
+
|
|
85
|
+
expect(await lookupAgentToken(token)).toBeNull();
|
|
86
|
+
});
|
|
64
87
|
});
|
|
@@ -104,15 +104,51 @@ export function agentEnvironment(token: string): Record<string, string> {
|
|
|
104
104
|
* What a token may touch, by path.
|
|
105
105
|
*
|
|
106
106
|
* `'any'` is only spawn: a child must be allowed to create its own children.
|
|
107
|
-
* Every other path
|
|
108
|
-
*
|
|
107
|
+
* Every other path names a session, and the token must belong to that session's
|
|
108
|
+
* TREE — itself, an ancestor, or a descendant. The tree rule is what makes the
|
|
109
|
+
* shipped orchestration contract work: a worker tells its coordinator, and a
|
|
110
|
+
* coordinator reads its worker. A token is not an admin credential, and a
|
|
111
|
+
* sibling is not in the tree.
|
|
112
|
+
*
|
|
113
|
+
* The scope is a KIND, not an id, because the gate has to know which question
|
|
114
|
+
* to ask. Returning the id alone made the gate compare it to the token's
|
|
115
|
+
* session, which refused both directions of the parent/child edge.
|
|
109
116
|
*/
|
|
110
|
-
export
|
|
111
|
-
|
|
117
|
+
export type AgentPathScope =
|
|
118
|
+
| { kind: 'any' }
|
|
119
|
+
| { kind: 'tree'; target: string };
|
|
120
|
+
|
|
121
|
+
export function agentTokenScopeForPath(pathname: string): AgentPathScope | null {
|
|
122
|
+
if (pathname === '/api/sessions/spawn') return { kind: 'any' };
|
|
112
123
|
const direct = /^\/api\/(?:agent|chat)\/([^/]+)$/.exec(pathname);
|
|
113
|
-
if (direct) return direct[1]
|
|
124
|
+
if (direct?.[1]) return { kind: 'tree', target: direct[1] };
|
|
114
125
|
const sub = /^\/api\/sessions\/([^/]+)\/(?:fork|relations|answer)$/.exec(pathname);
|
|
115
|
-
return sub?.[1]
|
|
126
|
+
return sub?.[1] ? { kind: 'tree', target: sub[1] } : null;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The session a bearer token identifies, reading the table when the cache does
|
|
131
|
+
* not know it.
|
|
132
|
+
*
|
|
133
|
+
* The cache is per process and is filled at boot plus on every local spawn. A
|
|
134
|
+
* PEER instance that owns the session never saw that spawn, so a cache-only
|
|
135
|
+
* check answered 401 to a relayed agent request — the same class of failure the
|
|
136
|
+
* tree rule exists to remove. One indexed read on a miss, then the cache is
|
|
137
|
+
* warm for the rest of the process.
|
|
138
|
+
*/
|
|
139
|
+
export async function lookupAgentToken(token: string | null): Promise<string | null> {
|
|
140
|
+
const cached = verifyAgentToken(token);
|
|
141
|
+
if (cached) return cached;
|
|
142
|
+
if (!token) return null;
|
|
143
|
+
const hash = hashAgentToken(token);
|
|
144
|
+
const db = await getDb();
|
|
145
|
+
const row = await db.get<{ session_id: string }>(
|
|
146
|
+
'SELECT session_id FROM session_agent_tokens WHERE token_hash = ? AND revoked_at IS NULL',
|
|
147
|
+
[hash],
|
|
148
|
+
);
|
|
149
|
+
if (!row) return null;
|
|
150
|
+
cache().set(hash, { sessionId: row.session_id });
|
|
151
|
+
return row.session_id;
|
|
116
152
|
}
|
|
117
153
|
|
|
118
154
|
/** Drop the in-memory entry for a session whose rows are being purged. */
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The tree rule, pinned.
|
|
8
|
+
*
|
|
9
|
+
* These cases are the contract the agent token gate relies on: a worker may
|
|
10
|
+
* reach its coordinator, a coordinator may reach its workers, and a sibling is
|
|
11
|
+
* a different branch. The fork case is here because a fork row has a SOURCE
|
|
12
|
+
* edge and no parent edge — a walk that ignored `origin_kind` would let a
|
|
13
|
+
* source's parent address the fork.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
17
|
+
import { isolateDb, releaseDb } from '@/test-support/isolated-db';
|
|
18
|
+
import { getDb } from '@/server/db.server';
|
|
19
|
+
import { ensureSessionRelationsSchema } from '@/server/lib/sessions/schema.server';
|
|
20
|
+
import { resolveAgentAccess } from '@/server/lib/sessions/relation-access.server';
|
|
21
|
+
|
|
22
|
+
async function relation(
|
|
23
|
+
sessionId: string,
|
|
24
|
+
parentSessionId: string | null,
|
|
25
|
+
sourceSessionId: string | null = null,
|
|
26
|
+
): Promise<void> {
|
|
27
|
+
const db = await getDb();
|
|
28
|
+
await db.run(
|
|
29
|
+
`INSERT INTO session_relations
|
|
30
|
+
(session_id, parent_session_id, source_session_id, origin_kind, created_at)
|
|
31
|
+
VALUES (?, ?, ?, ?, ?)`,
|
|
32
|
+
[sessionId, parentSessionId, sourceSessionId, sourceSessionId ? 'fork' : null, Date.now()],
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
beforeEach(async () => {
|
|
37
|
+
await isolateDb();
|
|
38
|
+
await ensureSessionRelationsSchema(await getDb());
|
|
39
|
+
// C is the orchestrator; W1/W2 are its workers; H1 is W1's helper; F is a fork
|
|
40
|
+
// of W1, which therefore has no parent edge.
|
|
41
|
+
await relation('C', null);
|
|
42
|
+
await relation('W1', 'C');
|
|
43
|
+
await relation('W2', 'C');
|
|
44
|
+
await relation('H1', 'W1');
|
|
45
|
+
await relation('F', null, 'W1');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
afterEach(async () => {
|
|
49
|
+
await releaseDb();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe('agent access follows the session tree', () => {
|
|
53
|
+
test('a session may act on itself', async () => {
|
|
54
|
+
expect(await resolveAgentAccess('C', 'C')).toBe('self');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test('a coordinator may act on its workers and their helpers', async () => {
|
|
58
|
+
expect(await resolveAgentAccess('C', 'W1')).toBe('descendant');
|
|
59
|
+
expect(await resolveAgentAccess('C', 'H1')).toBe('descendant');
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test('a worker may act on its coordinator and grandparent', async () => {
|
|
63
|
+
expect(await resolveAgentAccess('W1', 'C')).toBe('ancestor');
|
|
64
|
+
expect(await resolveAgentAccess('H1', 'C')).toBe('ancestor');
|
|
65
|
+
expect(await resolveAgentAccess('H1', 'W1')).toBe('ancestor');
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('a sibling is a different branch', async () => {
|
|
69
|
+
expect(await resolveAgentAccess('W1', 'W2')).toBeNull();
|
|
70
|
+
expect(await resolveAgentAccess('W2', 'H1')).toBeNull();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test('a fork is not reachable through its source', async () => {
|
|
74
|
+
expect(await resolveAgentAccess('C', 'F')).toBeNull();
|
|
75
|
+
expect(await resolveAgentAccess('W1', 'F')).toBeNull();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('an unknown session is not in anyone’s tree', async () => {
|
|
79
|
+
expect(await resolveAgentAccess('X', 'C')).toBeNull();
|
|
80
|
+
expect(await resolveAgentAccess('C', 'X')).toBeNull();
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test('a session with no relation row is a root', async () => {
|
|
84
|
+
expect(await resolveAgentAccess('ROOT', 'C')).toBeNull();
|
|
85
|
+
expect(await resolveAgentAccess('C', 'ROOT')).toBeNull();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('a cyclic row terminates instead of hanging', async () => {
|
|
89
|
+
// Corrupt data, not a legal tree: the depth guard is what keeps the walk
|
|
90
|
+
// finite. A policy check inside the recursion would hang here.
|
|
91
|
+
const db = await getDb();
|
|
92
|
+
await db.run("UPDATE session_relations SET parent_session_id = 'H1' WHERE session_id = 'C'");
|
|
93
|
+
expect(await resolveAgentAccess('C', 'W2')).toBe('descendant');
|
|
94
|
+
expect(await resolveAgentAccess('W2', 'C')).toBe('ancestor');
|
|
95
|
+
});
|
|
96
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Whether one session's agent token may act on another session.
|
|
8
|
+
*
|
|
9
|
+
* The rule is the TREE, not one id: a session may act on itself, on its
|
|
10
|
+
* ancestors, and on its descendants. That is exactly the two directions the
|
|
11
|
+
* orchestration contract uses — a worker tells its coordinator, a coordinator
|
|
12
|
+
* reads its worker — and nothing else. A sibling is a different branch, and a
|
|
13
|
+
* fork has a source edge rather than a parent edge, so neither is reachable.
|
|
14
|
+
*
|
|
15
|
+
* Why this module exists at all: the gate used to compare the id in the path to
|
|
16
|
+
* the token's session, which refused BOTH directions. With UI authentication
|
|
17
|
+
* off the gate returns before that comparison, so the defect was invisible in
|
|
18
|
+
* the measured three-worker run and fatal on a password-protected console.
|
|
19
|
+
*
|
|
20
|
+
* The walk is two recursive CTEs over `session_relations`, both bounded by a
|
|
21
|
+
* depth guard. The guard is 8, not `MAX_SESSION_DEPTH` (4): 4 is the policy the
|
|
22
|
+
* spawn service enforces, 8 is what stops a corrupt row from looping forever.
|
|
23
|
+
* A policy check inside the recursion would turn bad data into a hang.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { getDb } from '@/server/db.server';
|
|
27
|
+
|
|
28
|
+
export type AgentAccess = 'self' | 'ancestor' | 'descendant' | null;
|
|
29
|
+
|
|
30
|
+
/** How far a walk may go before it is treated as corrupt data, not a tree. */
|
|
31
|
+
const WALK_GUARD = 8;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The relationship between the caller and the target, or null when the target
|
|
35
|
+
* is outside the caller's tree.
|
|
36
|
+
*
|
|
37
|
+
* A session with no relation row is a root: it may act on itself and on nothing
|
|
38
|
+
* else. A fork row has `parent_session_id = NULL`, so it never appears in
|
|
39
|
+
* either walk — that is the schema, not a special case here.
|
|
40
|
+
*/
|
|
41
|
+
export async function resolveAgentAccess(caller: string, target: string): Promise<AgentAccess> {
|
|
42
|
+
if (caller === target) return 'self';
|
|
43
|
+
const db = await getDb();
|
|
44
|
+
|
|
45
|
+
// Down: start at the caller and follow parent edges forward.
|
|
46
|
+
const down = await db.get<{ hit: number }>(
|
|
47
|
+
`WITH RECURSIVE down(id, depth) AS (
|
|
48
|
+
SELECT session_id, 0 FROM session_relations WHERE session_id = ?
|
|
49
|
+
UNION ALL
|
|
50
|
+
SELECT r.session_id, down.depth + 1
|
|
51
|
+
FROM session_relations r JOIN down ON r.parent_session_id = down.id
|
|
52
|
+
WHERE down.depth < ${WALK_GUARD}
|
|
53
|
+
) SELECT 1 AS hit FROM down WHERE id = ? LIMIT 1`,
|
|
54
|
+
[caller, target],
|
|
55
|
+
);
|
|
56
|
+
if (down) return 'descendant';
|
|
57
|
+
|
|
58
|
+
// Up: start at the caller's parent and follow parent edges backward. Starting
|
|
59
|
+
// at the TARGET's parent would answer the descendant question a second time.
|
|
60
|
+
const up = await db.get<{ hit: number }>(
|
|
61
|
+
`WITH RECURSIVE up(id, depth) AS (
|
|
62
|
+
SELECT parent_session_id, 1 FROM session_relations WHERE session_id = ?
|
|
63
|
+
UNION ALL
|
|
64
|
+
SELECT r.parent_session_id, up.depth + 1
|
|
65
|
+
FROM session_relations r JOIN up ON r.session_id = up.id
|
|
66
|
+
WHERE up.depth < ${WALK_GUARD}
|
|
67
|
+
) SELECT 1 AS hit FROM up WHERE id = ? LIMIT 1`,
|
|
68
|
+
[caller, target],
|
|
69
|
+
);
|
|
70
|
+
return up ? 'ancestor' : null;
|
|
71
|
+
}
|