@kabmo-labs/kabmo 0.48.0 → 0.49.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 +521 -507
- package/dist/client/static/js/{Body-3tspyjtk.js → Body-9h5hd351.js} +3 -3
- package/dist/client/static/js/{CsvGrid-3pwsfmxp.js → CsvGrid-s05k1q18.js} +2 -2
- package/dist/client/static/js/{DocxView-xcg9jktb.js → DocxView-x6sjw5ht.js} +22 -22
- package/dist/client/static/js/{DrawioView-2q19tgkx.js → DrawioView-jashn8sf.js} +2 -2
- package/dist/client/static/js/{HtmlPreview-92cadvbr.js → HtmlPreview-eygzgtyc.js} +1 -1
- package/dist/client/static/js/ImageView-g50pk5pt.js +1 -0
- package/dist/client/static/js/LayoutWrapper-tag0qpts.js +2 -0
- package/dist/client/static/js/MergeDiffView-c4mb8m1w.js +1 -0
- package/dist/client/static/js/Modal-pf9p6m1k.js +59 -0
- package/dist/client/static/js/PdfView-syhjmyqf.js +1 -0
- package/dist/client/static/js/SessionsView-2r1grxxs.js +1 -0
- package/dist/client/static/js/{SheetView-w5w2m2de.js → SheetView-26r0e506.js} +45 -45
- package/dist/client/static/js/{SvgPreview-mtk6de6h.js → SvgPreview-2fk85jzz.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-tha4j2fn.js → abnfDiagram-O67JEVCF-fdka7pxr.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-ee9wjsht.js +1 -0
- package/dist/client/static/js/architectureDiagram-NJMV4G6O-278nx8rt.js +36 -0
- package/dist/client/static/js/{astro-r4dp34pw.js → astro-rn2bvwpm.js} +1 -1
- package/dist/client/static/js/bash-36shcpcw.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-6mzgfqh8.js → blockDiagram-BEXU5L5S-vpcmd3vx.js} +9 -9
- package/dist/client/static/js/c-kxeqssf9.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-sfkcw7g9.js → c4Diagram-YGBWAQC7-1rgpdnbq.js} +3 -3
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-v530ny5e.js → classDiagram-v2-NBCMYWYE-fbsejvb9.js} +9 -9
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-ybv1ttbx.js → cose-bilkent-JH36ORCC-ydq7mvy0.js} +1 -1
- package/dist/client/static/js/cpp-wtk1s3d7.js +1 -0
- package/dist/client/static/js/css-0a0r6rp3.js +1 -0
- package/dist/client/static/js/css-xhnrhg4e.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-gs16zjqa.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-k8f3z0mm.js → cynefinDiagram-VND7K2PF-7ta5vbrw.js} +2 -2
- package/dist/client/static/js/dagre-6A5THRUB-b8gtt32x.js +4 -0
- package/dist/client/static/js/{diagram-22UHCM2B-2zh2957c.js → diagram-22UHCM2B-7emepy7h.js} +30 -30
- package/dist/client/static/js/{diagram-3UASUU5V-bzstt5e2.js → diagram-3UASUU5V-06nptkzc.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-16adx4g0.js → diagram-ATOU4E4O-t113exk3.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-1ja98ens.js → diagram-CDSNMT55-pyj3x97y.js} +5 -5
- package/dist/client/static/js/{diagram-MLGK6HIB-f9nnyjbq.js → diagram-MLGK6HIB-183sgpjh.js} +2 -2
- package/dist/client/static/js/{diagram-MPIPVDR6-3qgadfjz.js → diagram-MPIPVDR6-fmbj4hcx.js} +2 -2
- package/dist/client/static/js/{dockerfile-04tc68pq.js → dockerfile-qay672za.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-022cz603.js → ebnfDiagram-ZINNZB2B-eafvfws2.js} +1 -1
- package/dist/client/static/js/{elixir-61gbjv6c.js → elixir-t8bep87c.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-2anf1c36.js → elk-276RUBZZ-573f1vfs.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-ndd27fz1.js → erDiagram-OPXOYQCR-4z1r88ej.js} +14 -14
- package/dist/client/static/js/{erlang-bh5cbm8m.js → erlang-261km7r1.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-ftz7zrz5.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-ax0qfmp3.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-9gm6hkgn.js → ganttDiagram-FUAMR5RP-49jd7msz.js} +4 -4
- package/dist/client/static/js/gitGraph-4MIJSDKK-3rtkds4s.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-78bxa67c.js → gitGraphDiagram-X574FWY7-5p9mgq7n.js} +22 -22
- package/dist/client/static/js/graphql-w9ajhndp.js +1 -0
- package/dist/client/static/js/html-krfbq5wp.js +1 -0
- package/dist/client/static/js/index-05n22cg9.js +4 -0
- package/dist/client/static/js/{index-he4k2j91.js → index-0857zpr0.js} +2 -2
- package/dist/client/static/js/{index-2n1fgpjv.js → index-0w4jqzqk.js} +2 -2
- package/dist/client/static/js/{index-4n7t26ap.js → index-14dgbjsm.js} +1 -1
- package/dist/client/static/js/{index-mqzgf7rw.js → index-1p880x6e.js} +2 -2
- package/dist/client/static/js/{index-34aq5bz5.js → index-1yq96wpa.js} +2 -2
- package/dist/client/static/js/{index-hq28918s.js → index-2bf0txsp.js} +2 -2
- package/dist/client/static/js/index-2jgx68m0.js +1 -0
- package/dist/client/static/js/{index-g3rg6vsd.js → index-2yzt8h3d.js} +2 -2
- package/dist/client/static/js/{index-m39gbcxn.js → index-333rq9yy.js} +1 -1
- package/dist/client/static/js/{index-aa3hmn6j.js → index-38g2eevc.js} +76 -76
- package/dist/client/static/js/{index-aabp7nt6.js → index-3v8k8ms3.js} +1 -1
- package/dist/client/static/js/{index-0e51wknc.js → index-473hk8nb.js} +10 -10
- package/dist/client/static/js/{index-xny7vsfz.js → index-4ccs971z.js} +2 -2
- package/dist/client/static/js/{index-ya9yqj5w.js → index-4dnc1kys.js} +2 -2
- package/dist/client/static/js/{index-7whstwc7.js → index-4z5ram7g.js} +2 -2
- package/dist/client/static/js/{index-pzsp1src.js → index-5dn4159w.js} +2 -2
- package/dist/client/static/js/{index-k39be93q.js → index-5p8dwr4y.js} +1 -1
- package/dist/client/static/js/{index-2bsnywea.js → index-5ztdqm1w.js} +2 -2
- package/dist/client/static/js/{index-m0fatq7c.js → index-7dqq7cjp.js} +13 -13
- package/dist/client/static/js/{index-417fbrqk.js → index-7ff9scbm.js} +2 -2
- package/dist/client/static/js/{index-zcgqacvx.js → index-7rmps91t.js} +2 -2
- package/dist/client/static/js/{index-gpmcth0x.js → index-80fjn77c.js} +2 -2
- package/dist/client/static/js/{index-rgxg0azs.css → index-9wc36am3.css} +1 -1
- package/dist/client/static/js/{index-kaxvwh07.js → index-a4636gt1.js} +2 -2
- package/dist/client/static/js/{index-hwzxdwwg.js → index-bmaktvm2.js} +1 -1
- package/dist/client/static/js/index-bvpzzhn2.js +4 -0
- package/dist/client/static/js/{index-dxnkwf39.js → index-c3whkrwa.js} +47 -47
- package/dist/client/static/js/{index-kjr68pcj.js → index-dh060b7r.js} +2 -2
- package/dist/client/static/js/{index-hkz2mz34.js → index-dmc82cxb.js} +2 -2
- package/dist/client/static/js/index-e19dbqd3.js +2 -0
- package/dist/client/static/js/{index-ep6bqcmg.js → index-e8mt8rag.js} +2 -2
- package/dist/client/static/js/index-epzvftkq.js +1 -0
- package/dist/client/static/js/{index-ac2q5903.js → index-fbg5vhhw.js} +2 -2
- package/dist/client/static/js/{index-qxzj780x.js → index-gaqjrzdb.js} +2 -2
- package/dist/client/static/js/{index-3en15m75.js → index-gg910gpv.js} +2 -2
- package/dist/client/static/js/{index-qe0vfv6s.js → index-gr8sqjpz.js} +1 -1
- package/dist/client/static/js/{index-13g17wa3.js → index-gz7kvpnm.js} +1 -1
- package/dist/client/static/js/{index-x7rajphe.js → index-h8hjcdj1.js} +2 -2
- package/dist/client/static/js/{index-jnkc9p53.js → index-j37m7pn9.js} +2 -2
- package/dist/client/static/js/{index-e6ny4gd9.js → index-mbtenbyc.js} +6 -6
- package/dist/client/static/js/{index-7pz6n3pg.js → index-nbm5r9g1.js} +2 -2
- package/dist/client/static/js/{index-8tvrzce0.js → index-nzvte8s5.js} +2 -2
- package/dist/client/static/js/index-pv4z2mp2.js +463 -0
- package/dist/client/static/js/{index-abrrqhne.js → index-pygy21w5.js} +2 -2
- package/dist/client/static/js/{index-g8rpydkr.js → index-qs4n116g.js} +2 -2
- package/dist/client/static/js/{index-seekt5k3.js → index-qwxawph7.js} +2 -2
- package/dist/client/static/js/index-rz0tz4hg.js +1 -0
- package/dist/client/static/js/{index-sng4prpr.js → index-s5vegk6q.js} +2 -2
- package/dist/client/static/js/{index-c250nzm1.js → index-t522tpxt.js} +3 -3
- package/dist/client/static/js/{index-30a8py59.js → index-taev57jw.js} +2 -2
- package/dist/client/static/js/{index-t4s10406.js → index-tb35a328.js} +2 -2
- package/dist/client/static/js/{index-fb2s080r.js → index-tc6k8qt7.js} +2 -2
- package/dist/client/static/js/{index-hcmhdpp4.js → index-tcfpzqb9.js} +36 -36
- package/dist/client/static/js/{index-45p59fxq.js → index-wbsvg1d9.js} +2 -2
- package/dist/client/static/js/{index-axtm1aq8.js → index-xw1bptp5.js} +2 -2
- package/dist/client/static/js/{index-a58rkn3f.js → index-yg083mk0.js} +6 -6
- package/dist/client/static/js/{index-tzz5gp8a.js → index-ykc14gez.js} +5 -5
- package/dist/client/static/js/index-yr3exz70.js +2 -0
- package/dist/client/static/js/{index-55pqvh82.js → index-yyjw1ty9.js} +2 -2
- package/dist/client/static/js/{index-ebf50mrs.js → index-z6y8j93w.js} +7 -7
- package/dist/client/static/js/{index-869vdnz8.js → index-zdw8bd5t.js} +2 -2
- package/dist/client/static/js/{index-5mpv57fn.js → index-zp40g8ah.js} +12 -12
- package/dist/client/static/js/{index-gkmn4y1v.js → index-zyefab6q.js} +1 -1
- package/dist/client/static/js/info-A6RAGUB7-vr5mxm6f.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-bxk0g0pe.js → infoDiagram-VRGFBTTK-xsar9j6v.js} +2 -2
- package/dist/client/static/js/ini-zx7x1jj1.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-d1kdkhth.js → ishikawaDiagram-OU5B5YK6-g2rvt9jp.js} +6 -6
- package/dist/client/static/js/java-bbw6kdcr.js +1 -0
- package/dist/client/static/js/javascript-p2a8rbpw.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-cahg3zjq.js → journeyDiagram-ZHPQQLJL-q95v18zc.js} +5 -5
- package/dist/client/static/js/json-zh7m2fyg.js +1 -0
- package/dist/client/static/js/jsx-3zyyt0eh.js +1 -0
- package/dist/client/static/js/{julia-2n5k898q.js → julia-pe5vpc2m.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-nq7t83en.js → kanban-definition-PNTS6WVX-2e7m7ds3.js} +11 -11
- package/dist/client/static/js/lua-d656k76a.js +1 -0
- package/dist/client/static/js/markdown-b5w681mm.js +1 -0
- package/dist/client/static/js/{mermaid.core-6nw0853j.js → mermaid.core-dzajkp0g.js} +7 -7
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-cm7ykxf2.js → mindmap-definition-NLK3R4M7-banecvf8.js} +4 -4
- package/dist/client/static/js/one-dark-pro-z965dedc.js +1 -0
- package/dist/client/static/js/one-light-capdx801.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-ncb5xxtn.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-xwxz8nsq.js → pegDiagram-GJSIUBJH-6erykm1c.js} +1 -1
- package/dist/client/static/js/{perl-66vb5pz7.js → perl-cc2eqye8.js} +1 -1
- package/dist/client/static/js/{php-4e9we8am.js → php-p9bvnpsv.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-ff8fpvc4.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-n910k9th.js → pieDiagram-5QR66LMP-jn1d905q.js} +3 -3
- package/dist/client/static/js/properties-3c6rmnqp.js +1 -0
- package/dist/client/static/js/python-a3x3zpv1.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-dxkwxbqb.js → quadrantDiagram-O4NWA36T-sz4afnp1.js} +6 -6
- package/dist/client/static/js/r-7h3gwype.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-gbj4b1hf.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-ndv5tqgr.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-yjzj09s1.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-e6pw7e5z.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-9734dxy4.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-xb1smt7r.js → railroadDiagram-XR7U4H2S-ewzhhth2.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-6kb21b9f.js → requirementDiagram-PLB6GJNP-fcs3xd42.js} +7 -7
- package/dist/client/static/js/{ruby-v7nmcvyr.js → ruby-65s2ca5d.js} +1 -1
- package/dist/client/static/js/{rust-5ersd7be.js → rust-ec1j2hwy.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-74z0fskw.js → sankeyDiagram-IPEJSGJF-2r829rjf.js} +4 -4
- package/dist/client/static/js/{sass-h3nvy4c8.js → sass-p6cssgq8.js} +1 -1
- package/dist/client/static/js/{scss-kvev49ga.js → scss-qfx8wt3b.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-apn6kezn.js → sequenceDiagram-PO4LG4MO-3mnte9tv.js} +21 -21
- package/dist/client/static/js/{sizeCapture-INFHLROL-2drzcjb8.js → sizeCapture-INFHLROL-r6hf9265.js} +1 -1
- package/dist/client/static/js/sql-7a5vavm0.js +1 -0
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-ma09vhby.js → stateDiagram-v2-GCMORJYK-hm2f0wdb.js} +6 -6
- package/dist/client/static/js/{svelte-dhspkgss.js → svelte-jz3a190v.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-f6y9xqnx.js → swimlanes-2SLR337P-s58xzqhw.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-z4pt2kn1.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-zmcmvq00.js → timeline-definition-EJHVYXUP-ezm1c4pz.js} +7 -7
- package/dist/client/static/js/treeView-Q6P3EWNA-rs10d4p5.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-ey6c5x9f.js +1 -0
- package/dist/client/static/js/tsx-4a9b8tqf.js +1 -0
- package/dist/client/static/js/typescript-kas107wb.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-wfaa019a.js → usecaseDiagram-POWQR4AR-ryvgs5ac.js} +47 -47
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-46wf2pgd.js → vennDiagram-UO4OBE2U-rd5prsf1.js} +7 -7
- package/dist/client/static/js/{vue-ffngx2b3.js → vue-rv4pea8r.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-kd9swrdr.js +1 -0
- package/dist/client/static/js/wardleyDiagram-VNRHLVJA-1kt8q8a4.js +78 -0
- package/dist/client/static/js/xml-3g4bdtpa.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-2ba825z9.js → xychartDiagram-PMCCYNJV-q39bbgq4.js} +5 -5
- package/dist/client/static/js/yaml-ktxjn917.js +1 -0
- package/package.json +1 -1
- package/src/client/components/common/MarkdownRenderer.tsx +29 -28
- package/src/client/components/common/header-controls/index.test.tsx +1 -0
- package/src/client/components/common/header-controls/phone-row.test.tsx +1 -0
- package/src/client/components/common/header-controls/plugin-entry.test.tsx +1 -0
- package/src/client/components/common/header-controls/shell-chrome.test.tsx +1 -0
- package/src/client/components/layout/ActivityBar.tsx +2 -1
- package/src/client/components/layout/LeftActivityBar.test.ts +1 -0
- package/src/client/components/settings/Modal.tsx +1 -1
- package/src/client/components/settings/Sidebar.tsx +2 -1
- package/src/client/components/settings/apply-side-effects.ts +8 -0
- package/src/client/components/settings/categories/DictationSettings.test.tsx +152 -0
- package/src/client/components/settings/categories/DictationSettings.tsx +76 -0
- package/src/client/components/settings/categories/VoiceSettings.tsx +77 -0
- package/src/client/components/settings/categories/dictation-settings/CaptureSection.tsx +153 -0
- package/src/client/components/settings/categories/dictation-settings/EngineSection.tsx +123 -0
- package/src/client/components/settings/categories/dictation-settings/ExternalSection.tsx +221 -0
- package/src/client/components/settings/categories/dictation-settings/LanguageSection.tsx +73 -0
- package/src/client/components/settings/categories/panel-plugins/InstallForm.tsx +24 -17
- package/src/client/components/settings/categories/panel-plugins/Registries.test.tsx +164 -0
- package/src/client/components/settings/categories/panel-plugins/Registries.tsx +180 -0
- package/src/client/components/settings/categories/panel-plugins/Section.tsx +15 -6
- package/src/client/components/settings/categories/voice-settings/SpeechSettings.test.tsx +112 -0
- package/src/client/components/settings/categories/voice-settings/SpeechSettings.tsx +84 -0
- package/src/client/components/settings/categories/voice-settings/groups.test.ts +23 -0
- package/src/client/components/settings/categories/voice-settings/groups.ts +48 -0
- package/src/client/components/settings/categories/voice-settings/speech/AutoplaySection.tsx +49 -0
- package/src/client/components/settings/categories/voice-settings/speech/EndpointSection.tsx +161 -0
- package/src/client/components/settings/categories/voice-settings/speech/EngineSection.tsx +108 -0
- package/src/client/components/settings/categories/voice-settings/speech/TestSection.tsx +56 -0
- package/src/client/components/settings/categories/voice-settings/speech/VoiceSection.tsx +157 -0
- package/src/client/components/settings/categories/voice-settings/speech/styles.ts +15 -0
- package/src/client/components/settings/category-content.tsx +3 -0
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.speech.test.tsx +140 -0
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +41 -97
- package/src/client/components/workspace/chat-timeline/AiMessageFooterSheet.tsx +143 -0
- package/src/client/components/workspace/chat-timeline/MessageItem.tsx +5 -1
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +1 -0
- package/src/client/components/workspace/chat-timeline/RunFooter.tsx +1 -0
- package/src/client/components/workspace/chat-timeline/SpeechButton.tsx +110 -0
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.test.ts +26 -10
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +13 -8
- package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +9 -2
- package/src/client/components/workspace/chat-timeline/chat-input/ComposerRows.tsx +6 -0
- package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.tsx +18 -7
- package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.tsx +4 -2
- package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +4 -4
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +19 -11
- package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +8 -6
- package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +38 -30
- package/src/client/components/workspace/chat-timeline/chat-input/narrow.test.tsx +185 -0
- package/src/client/components/workspace/chat-timeline/chat-input/paste-attach.test.tsx +194 -0
- package/src/client/components/workspace/chat-timeline/index.tsx +4 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/index.tsx +5 -11
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.test.ts +10 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Edit.tsx +2 -7
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/task-rows.ts +6 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/registry.test.ts +38 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/registry.ts +10 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/tool-input.ts +5 -5
- package/src/client/hooks/chat/composer/attachments.ts +18 -2
- package/src/client/hooks/chat/composer/capture.test.ts +282 -0
- package/src/client/hooks/chat/composer/capture.ts +166 -0
- package/src/client/hooks/chat/composer/dictation-settings.ts +53 -0
- package/src/client/hooks/chat/composer/narrow.test.ts +130 -0
- package/src/client/hooks/chat/composer/narrow.ts +82 -0
- package/src/client/hooks/chat/composer/paste-attachments.test.ts +215 -0
- package/src/client/hooks/chat/composer/paste-attachments.ts +173 -0
- package/src/client/hooks/chat/composer/pipeline.ts +16 -3
- package/src/client/hooks/chat/composer/speech-to-text.test.tsx +314 -0
- package/src/client/hooks/chat/composer/speech-to-text.ts +158 -134
- package/src/client/hooks/chat/composer/voice-input.ts +24 -9
- package/src/client/hooks/chat/timeline/scroll.test.ts +44 -3
- package/src/client/hooks/chat/timeline/scroll.ts +31 -14
- package/src/client/hooks/chat/timeline/send-helpers.ts +3 -0
- package/src/client/hooks/chat/timeline/send.ts +5 -1
- package/src/client/hooks/settings/dictation.ts +153 -0
- package/src/client/hooks/settings/speech.ts +170 -0
- package/src/client/hooks/tts/provider.tsx +50 -0
- package/src/client/hooks/tts/tts-context.ts +39 -0
- package/src/client/hooks/tts/use-speech-autoplay.test.tsx +122 -0
- package/src/client/hooks/tts/use-speech-autoplay.ts +106 -0
- package/src/client/hooks/tts/use-tts-player.ts +33 -0
- package/src/client/hooks/ui/markdown-hydration.test.tsx +83 -0
- package/src/client/hooks/ui/markdown-hydration.ts +31 -0
- package/src/client/hooks/ui/markdown-render.ts +119 -0
- package/src/client/hooks/workspace/journal-diff.ts +8 -1
- package/src/client/hooks/workspace/panel-actions.ts +184 -0
- package/src/client/hooks/workspace/panel-registry.ts +6 -139
- package/src/client/hooks/workspace/panel-visibility-menu.ts +2 -1
- package/src/client/lib/plugins/bootstrap.test.ts +1 -0
- package/src/client/lib/tts/player.test.ts +103 -0
- package/src/client/lib/tts/player.ts +213 -0
- package/src/client/tailwind.css +11 -0
- package/src/server/lib/changes/capture-bash.server.ts +6 -3
- package/src/server/lib/changes/capture-fs.server.ts +2 -2
- package/src/server/lib/changes/capture-races.test.ts +33 -1
- package/src/server/lib/changes/capture-scan.test.ts +1 -1
- package/src/server/lib/changes/capture-test-util.ts +1 -1
- package/src/server/lib/changes/capture-types.ts +1 -1
- package/src/server/lib/changes/capture.server.ts +1 -1
- package/src/server/lib/changes/journal-read.server.ts +21 -0
- package/src/server/lib/changes/reader.server.ts +92 -14
- package/src/server/lib/changes/reader.test.ts +99 -0
- package/src/server/lib/changes/records.ts +2 -0
- package/src/server/lib/dictation/capability.server.test.ts +113 -0
- package/src/server/lib/dictation/capability.server.ts +57 -0
- package/src/server/lib/dictation/engines/adapter.ts +147 -0
- package/src/server/lib/dictation/engines/adapters.test.ts +215 -0
- package/src/server/lib/dictation/engines/deepgram.ts +77 -0
- package/src/server/lib/dictation/engines/elevenlabs.ts +44 -0
- package/src/server/lib/dictation/engines/index.ts +55 -0
- package/src/server/lib/dictation/engines/openai.ts +51 -0
- package/src/server/lib/dictation/language.server.test.ts +21 -22
- package/src/server/lib/dictation/language.server.ts +16 -19
- package/src/server/lib/dictation/omp-stt-worker.test.ts +183 -0
- package/src/server/lib/dictation/omp-stt-worker.ts +130 -78
- package/src/server/lib/dictation/settings.server.ts +74 -0
- package/src/server/lib/dictation/speech-frames.test.ts +125 -0
- package/src/server/lib/dictation/speech-frames.ts +146 -0
- package/src/server/lib/dictation/worker-process.ts +122 -0
- package/src/server/lib/harness/acp/calls.ts +20 -0
- package/src/server/lib/harness/acp/client-capabilities.ts +8 -1
- package/src/server/lib/harness/acp/client-fs.ts +17 -5
- package/src/server/lib/harness/acp/client-initialize.test.ts +32 -1
- package/src/server/lib/harness/acp/client-initialize.ts +51 -6
- package/src/server/lib/harness/acp/client-requests.ts +49 -0
- package/src/server/lib/harness/acp/client.ts +33 -36
- package/src/server/lib/harness/acp/frames-rows.test.ts +144 -0
- package/src/server/lib/harness/acp/frames-tool-shapes.test.ts +238 -0
- package/src/server/lib/harness/acp/frames-v2.test.ts +21 -0
- package/src/server/lib/harness/acp/frames.test.ts +3 -15
- package/src/server/lib/harness/acp/frames.ts +43 -67
- package/src/server/lib/harness/acp/grants.ts +20 -5
- package/src/server/lib/harness/acp/mapper.test.ts +40 -1
- package/src/server/lib/harness/acp/mapper.ts +69 -9
- package/src/server/lib/harness/acp/message-rows.ts +219 -0
- package/src/server/lib/harness/acp/prompt.ts +20 -2
- package/src/server/lib/harness/acp/protocol.ts +24 -0
- package/src/server/lib/harness/acp/replay-window.test.ts +66 -0
- package/src/server/lib/harness/acp/replay.ts +33 -8
- package/src/server/lib/harness/acp/session-addressing.test.ts +99 -0
- package/src/server/lib/harness/acp/session-approvals.ts +4 -0
- package/src/server/lib/harness/acp/session-cancel-policy.test.ts +86 -0
- package/src/server/lib/harness/acp/session-close.test.ts +89 -0
- package/src/server/lib/harness/acp/session-config.ts +8 -3
- package/src/server/lib/harness/acp/session-handshake.ts +6 -0
- package/src/server/lib/harness/acp/session-inbound.ts +126 -0
- package/src/server/lib/harness/acp/session-intake.ts +9 -2
- package/src/server/lib/harness/acp/session-lifecycle.ts +25 -0
- package/src/server/lib/harness/acp/session-notifications.ts +36 -0
- package/src/server/lib/harness/acp/session-permissions.ts +22 -1
- package/src/server/lib/harness/acp/session-requests.ts +19 -1
- package/src/server/lib/harness/acp/session-stop.ts +54 -0
- package/src/server/lib/harness/acp/session-wiring.ts +1 -0
- package/src/server/lib/harness/acp/session.test-util.ts +8 -3
- package/src/server/lib/harness/acp/session.ts +75 -75
- package/src/server/lib/harness/acp/stdio.ts +8 -1
- package/src/server/lib/harness/acp/subagent-frames.test.ts +82 -0
- package/src/server/lib/harness/acp/subagent-frames.ts +124 -0
- package/src/server/lib/harness/acp/subagents.test.ts +124 -0
- package/src/server/lib/harness/acp/subagents.ts +182 -0
- package/src/server/lib/harness/acp/tool-calls.ts +115 -45
- package/src/server/lib/harness/acp/tool-identity.test.ts +8 -0
- package/src/server/lib/harness/acp/tool-identity.ts +13 -1
- package/src/server/lib/harness/acp/tool-shape.ts +99 -0
- package/src/server/lib/harness/acp/turn.test.ts +1 -0
- package/src/server/lib/harness/acp/turn.ts +4 -1
- package/src/server/lib/harness/acp/v2.test.ts +21 -1
- package/src/server/lib/harness/acp/v2.ts +6 -1
- package/src/server/lib/lifecycle/paths.ts +22 -0
- package/src/server/lib/omp/session/changes-patch.test.ts +120 -0
- package/src/server/lib/omp/session/changes-patch.ts +190 -0
- package/src/server/lib/omp/session/changes.test.ts +55 -61
- package/src/server/lib/omp/session/changes.ts +79 -127
- package/src/server/lib/omp/session/merge-stored.ts +2 -0
- package/src/server/lib/panels/catalog-offers.server.ts +1 -1
- package/src/server/lib/panels/catalog.server.test.ts +71 -2
- package/src/server/lib/panels/catalog.server.ts +80 -0
- package/src/server/lib/panels/install.server.test.ts +15 -0
- package/src/server/lib/panels/install.server.ts +7 -0
- package/src/server/lib/panels/manifest.test.ts +1 -76
- package/src/server/lib/panels/manifest.ts +3 -60
- package/src/server/lib/panels/marketplace-catalog.server.test.ts +154 -0
- package/src/server/lib/panels/marketplace-catalog.server.ts +131 -0
- package/src/server/lib/panels/offers.server.test.ts +5 -5
- package/src/server/lib/panels/offers.server.ts +20 -2
- package/src/server/lib/panels/registries.server.test.ts +216 -0
- package/src/server/lib/panels/registries.server.ts +118 -0
- package/src/server/lib/panels/registry-cache.server.ts +104 -0
- package/src/server/lib/panels/registry-refresh.server.ts +195 -0
- package/src/server/lib/panels/registry.server.test.ts +2 -2
- package/src/server/lib/panels/registry.server.ts +19 -1
- package/src/server/lib/panels/seed.server.ts +4 -1
- package/src/server/lib/tts/engines/adapter.ts +133 -0
- package/src/server/lib/tts/engines/adapters.test.ts +129 -0
- package/src/server/lib/tts/engines/deepgram.ts +43 -0
- package/src/server/lib/tts/engines/elevenlabs.ts +53 -0
- package/src/server/lib/tts/engines/index.ts +75 -0
- package/src/server/lib/tts/engines/openai.ts +52 -0
- package/src/server/lib/tts/engines/xai.ts +44 -0
- package/src/server/lib/tts/local.server.ts +160 -0
- package/src/server/lib/tts/settings.server.ts +103 -0
- package/src/server/routes/dictation/ws.ts +99 -27
- package/src/server/routes/index.ts +2 -0
- package/src/server/routes/panels/install-route.test.ts +110 -0
- package/src/server/routes/panels/install.ts +82 -3
- package/src/server/routes/sessions/index.ts +5 -0
- package/src/server/routes/sessions/local-image.test.ts +94 -0
- package/src/server/routes/sessions/local-image.ts +141 -0
- package/src/server/routes/settings/dictation.test.ts +139 -0
- package/src/server/routes/settings/dictation.ts +86 -0
- package/src/server/routes/settings/index.ts +4 -0
- package/src/server/routes/settings/speech.test.ts +156 -0
- package/src/server/routes/settings/speech.ts +98 -0
- package/src/server/routes/tts/index.ts +11 -0
- package/src/server/routes/tts/speak.test.ts +160 -0
- package/src/server/routes/tts/speak.ts +87 -0
- package/src/shared/lib/chat/attachments.ts +17 -3
- package/src/shared/lib/chat/composer/attachment-labels.test.ts +154 -0
- package/src/shared/lib/chat/composer/attachment-labels.ts +166 -0
- package/src/shared/lib/chat/omp/subagent-card-fold.test.ts +75 -0
- package/src/shared/lib/chat/timeline/changed-files.test.ts +13 -0
- package/src/shared/lib/chat/timeline/changed-files.ts +4 -2
- package/src/shared/lib/chat/timeline/local-image.test.ts +88 -0
- package/src/shared/lib/chat/timeline/local-image.ts +110 -0
- package/src/shared/lib/chat/timeline/omp-callbacks.ts +3 -2
- package/src/shared/lib/chat/timeline/run-signals.ts +2 -2
- package/src/shared/lib/chat/timeline/stream-callbacks.ts +8 -6
- package/src/shared/lib/chat/timeline/stream-coalescer.ts +7 -0
- package/src/shared/lib/chat/timeline/stream.test.ts +3 -1
- package/src/shared/lib/chat/timeline/tool-verbs.test.ts +5 -0
- package/src/shared/lib/chat/timeline/tool-verbs.ts +3 -1
- package/src/shared/lib/chat/todo/parser.test.ts +54 -0
- package/src/shared/lib/chat/todo/parser.ts +56 -0
- package/src/shared/lib/chat/tool/tool-aliases.test.ts +37 -0
- package/src/shared/lib/chat/tool/tool-aliases.ts +75 -0
- package/src/shared/lib/chat/tool/tool-input-path.test.ts +44 -0
- package/src/shared/lib/chat/tool/tool-input-path.ts +47 -0
- package/src/shared/lib/dictation/capability.ts +32 -0
- package/src/shared/lib/dictation/constraints.test.ts +41 -0
- package/src/shared/lib/dictation/constraints.ts +48 -0
- package/src/shared/lib/dictation/engines.test.ts +117 -0
- package/src/shared/lib/dictation/engines.ts +190 -0
- package/src/shared/lib/dictation/gate.test.ts +118 -0
- package/src/shared/lib/dictation/gate.ts +85 -0
- package/src/shared/lib/dictation/languages.test.ts +88 -0
- package/src/shared/lib/dictation/languages.ts +90 -0
- package/src/shared/lib/dictation/models.ts +9 -5
- package/src/shared/lib/dictation/protocol.ts +74 -34
- package/src/shared/lib/dictation/settings.test.ts +94 -0
- package/src/shared/lib/dictation/settings.ts +111 -0
- package/src/shared/lib/dictation/wav.test.ts +66 -0
- package/src/shared/lib/dictation/wav.ts +48 -0
- package/src/shared/lib/fs/journal-unavailable.test.ts +30 -0
- package/src/shared/lib/fs/journal-unavailable.ts +35 -0
- package/src/shared/lib/icons/tint-hues.generated.ts +35 -35
- package/src/shared/lib/net/base-url.test.ts +25 -0
- package/src/shared/lib/net/base-url.ts +29 -0
- package/src/shared/lib/omp/config/schema-extras.ts +9 -8
- package/src/shared/lib/omp/session/parse-message-blocks.ts +2 -2
- package/src/shared/lib/panels/plugin-repo.test.ts +113 -0
- package/src/shared/lib/panels/plugin-repo.ts +149 -0
- package/src/shared/lib/settings/defaults.ts +4 -0
- package/src/shared/lib/tts/capability.ts +16 -0
- package/src/shared/lib/tts/engines.test.ts +79 -0
- package/src/shared/lib/tts/engines.ts +313 -0
- package/src/shared/lib/tts/settings.test.ts +56 -0
- package/src/shared/lib/tts/settings.ts +108 -0
- package/src/shared/lib/tts/speakable.test.ts +76 -0
- package/src/shared/lib/tts/speakable.ts +179 -0
- package/src/shared/types/chat.ts +8 -1
- package/src/shared/types/panels-registry.ts +32 -0
- package/src/shared/types/panels.ts +23 -0
- package/src/shared/types/session-changes.ts +15 -1
- package/src/shared/types/settings/state.ts +25 -0
- package/src/test-support/pristine-globals.ts +5 -0
- package/dist/client/static/js/ImageView-pr4h38hb.js +0 -1
- package/dist/client/static/js/LayoutWrapper-n4tzhjes.js +0 -2
- package/dist/client/static/js/MergeDiffView-0t15nh9f.js +0 -1
- package/dist/client/static/js/Modal-77hgx4dw.js +0 -59
- package/dist/client/static/js/PdfView-gzxhvxe8.js +0 -1
- package/dist/client/static/js/SessionsView-2tdqrvk0.js +0 -1
- package/dist/client/static/js/architecture-7GRP2DOG-zs15nydj.js +0 -1
- package/dist/client/static/js/architectureDiagram-NJMV4G6O-heep78p6.js +0 -36
- package/dist/client/static/js/bash-8d3wrx5c.js +0 -1
- package/dist/client/static/js/c-rn3z0csz.js +0 -1
- package/dist/client/static/js/cpp-99ws9nak.js +0 -1
- package/dist/client/static/js/css-drfs4n12.js +0 -1
- package/dist/client/static/js/css-narcr42w.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-p3y1b4ap.js +0 -1
- package/dist/client/static/js/dagre-6A5THRUB-gk0gp124.js +0 -4
- package/dist/client/static/js/eventmodeling-NTZA5JFV-sx2cwkz3.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-dsc17mty.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-yqhbscsd.js +0 -1
- package/dist/client/static/js/graphql-tr0jcndy.js +0 -1
- package/dist/client/static/js/html-n8fdvrdk.js +0 -1
- package/dist/client/static/js/index-1hb8fvw9.js +0 -1
- package/dist/client/static/js/index-9a78xmkk.js +0 -462
- package/dist/client/static/js/index-b2cs4c51.js +0 -4
- package/dist/client/static/js/index-fryp0kgf.js +0 -2
- package/dist/client/static/js/index-qek9mt5w.js +0 -1
- package/dist/client/static/js/index-rq4dk4tp.js +0 -4
- package/dist/client/static/js/index-vnv9z0a1.js +0 -1
- package/dist/client/static/js/index-xr4hjv01.js +0 -2
- package/dist/client/static/js/info-A6RAGUB7-0sd3zzgg.js +0 -1
- package/dist/client/static/js/ini-tnaw7zjy.js +0 -1
- package/dist/client/static/js/java-m4dpc2vw.js +0 -1
- package/dist/client/static/js/javascript-8y26t991.js +0 -1
- package/dist/client/static/js/json-azm7bdqd.js +0 -1
- package/dist/client/static/js/jsx-p9j1k773.js +0 -1
- package/dist/client/static/js/lua-hbm9rhz9.js +0 -1
- package/dist/client/static/js/markdown-tk3cd3vs.js +0 -1
- package/dist/client/static/js/one-dark-pro-2cdc2nk7.js +0 -1
- package/dist/client/static/js/one-light-bt6z4jf0.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-13w2v5bb.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-swtnysgn.js +0 -1
- package/dist/client/static/js/properties-6911ckw7.js +0 -1
- package/dist/client/static/js/python-44cvj250.js +0 -1
- package/dist/client/static/js/r-t3sepzm4.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-vtvxkx55.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-5sp2d63r.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-kg706fan.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-4ra1gzx5.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-hms3zpjm.js +0 -1
- package/dist/client/static/js/sql-zdkawqx3.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-3dwas56m.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-7t5k6rs2.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-w56ry3bg.js +0 -1
- package/dist/client/static/js/tsx-b7eabr17.js +0 -1
- package/dist/client/static/js/typescript-nnkvhwfy.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-rtjb9kgv.js +0 -1
- package/dist/client/static/js/wardleyDiagram-VNRHLVJA-10ph3bzq.js +0 -78
- package/dist/client/static/js/xml-xy1tw6b2.js +0 -1
- package/dist/client/static/js/yaml-0fexqg2d.js +0 -1
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The SHAPES one ACP tool call is reported in, split from the accumulator that
|
|
8
|
+
* sequences them.
|
|
9
|
+
*
|
|
10
|
+
* `tool-calls.ts` owns the lifecycle (create on first sight, patch afterwards,
|
|
11
|
+
* close on a final status). What is here is the per-frame translation, because
|
|
12
|
+
* each function exists for a measured adapter quirk rather than for the
|
|
13
|
+
* lifecycle:
|
|
14
|
+
*
|
|
15
|
+
* - `toolArgs` — `rawInput` is a bare object, but the field is `unknown`;
|
|
16
|
+
* - `blockOf` — the card the timeline renders, built from accumulated fields
|
|
17
|
+
* so a patch can replace it in place;
|
|
18
|
+
* - `terminalMeta` — pi-acp reports a shell result ONLY as
|
|
19
|
+
* `_meta.terminal_output.data` + `_meta.terminal_exit.exit_code`;
|
|
20
|
+
* - `KIND_TOOL_NAME` — codex-acp's file change arrives with no name at all.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { isRecord } from '@/shared/lib/util/guards';
|
|
24
|
+
import type { AcpToolKind } from '@/server/lib/harness/acp/protocol';
|
|
25
|
+
|
|
26
|
+
/** The message block a tool card renders from. */
|
|
27
|
+
export interface ToolCallBlock {
|
|
28
|
+
type: 'toolCall';
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
arguments?: Record<string, unknown>;
|
|
32
|
+
toolKind?: AcpToolKind;
|
|
33
|
+
toolType?: string;
|
|
34
|
+
/** The adapter's own kind, when it is not one of the spec's ten. */
|
|
35
|
+
rawKind?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** The tool name a call takes when the adapter sent none but DID send a kind.
|
|
39
|
+
* `other`/`switch_mode` are absent on purpose: they name no operation, and a
|
|
40
|
+
* plan-mode toggle must not be drawn as a todo list. */
|
|
41
|
+
export const KIND_TOOL_NAME: Partial<Record<AcpToolKind, string>> = {
|
|
42
|
+
read: 'read',
|
|
43
|
+
edit: 'edit',
|
|
44
|
+
delete: 'edit',
|
|
45
|
+
move: 'edit',
|
|
46
|
+
search: 'grep',
|
|
47
|
+
execute: 'bash',
|
|
48
|
+
fetch: 'web_search',
|
|
49
|
+
think: 'think',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/** The object form of `rawInput`, or undefined for an absent/non-object one. */
|
|
53
|
+
export function toolArgs(rawInput: unknown): Record<string, unknown> | undefined {
|
|
54
|
+
return isRecord(rawInput) ? Object.fromEntries(Object.entries(rawInput)) : undefined;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The command facts an adapter sends in `_meta` instead of the result.
|
|
59
|
+
*
|
|
60
|
+
* `pi-acp` reports a shell result ONLY this way: its `tool_call` carries
|
|
61
|
+
* `_meta.terminal_info` and a `{type:"terminal"}` content block, and its
|
|
62
|
+
* `tool_call_update` carries `_meta.terminal_output.data` plus
|
|
63
|
+
* `_meta.terminal_exit.exit_code` — no text content at all, because it expects
|
|
64
|
+
* the client to own a terminal. Kabmo advertises no terminal, so without this
|
|
65
|
+
* the card had a title and an empty body.
|
|
66
|
+
*/
|
|
67
|
+
export function terminalMeta(meta: unknown): { output?: string; exitCode?: number } {
|
|
68
|
+
if (!isRecord(meta)) return {};
|
|
69
|
+
const output = isRecord(meta.terminal_output) && typeof meta.terminal_output.data === 'string'
|
|
70
|
+
? meta.terminal_output.data
|
|
71
|
+
: undefined;
|
|
72
|
+
const exit = isRecord(meta.terminal_exit) && typeof meta.terminal_exit.exit_code === 'number'
|
|
73
|
+
? meta.terminal_exit.exit_code
|
|
74
|
+
: undefined;
|
|
75
|
+
return {
|
|
76
|
+
...(output ? { output } : {}),
|
|
77
|
+
...(exit !== undefined ? { exitCode: exit } : {}),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** The message block a card draws from the call's accumulated fields. */
|
|
82
|
+
export function blockOf(call: {
|
|
83
|
+
id: string;
|
|
84
|
+
name: string;
|
|
85
|
+
kind?: AcpToolKind;
|
|
86
|
+
args?: Record<string, unknown>;
|
|
87
|
+
toolType?: string;
|
|
88
|
+
rawKind?: string;
|
|
89
|
+
}): ToolCallBlock {
|
|
90
|
+
return {
|
|
91
|
+
type: 'toolCall',
|
|
92
|
+
id: call.id,
|
|
93
|
+
name: call.name,
|
|
94
|
+
...(call.args ? { arguments: call.args } : {}),
|
|
95
|
+
...(call.kind ? { toolKind: call.kind } : {}),
|
|
96
|
+
...(call.rawKind ? { rawKind: call.rawKind } : {}),
|
|
97
|
+
...(call.toolType ? { toolType: call.toolType } : {}),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
@@ -52,6 +52,8 @@ export interface AcpTurnSeams {
|
|
|
52
52
|
resetMapper: () => void;
|
|
53
53
|
/** Flush the message the turn left open. */
|
|
54
54
|
closeMessage: () => AgentEvent[];
|
|
55
|
+
/** The turn's blocks as ONE message, after `closeMessage` (rows are split). */
|
|
56
|
+
turnMessage: () => Record<string, unknown> | null;
|
|
55
57
|
/** Tool calls the turn abandoned, by id. */
|
|
56
58
|
openCalls: () => string[];
|
|
57
59
|
/**
|
|
@@ -310,7 +312,8 @@ export class AcpTurns {
|
|
|
310
312
|
this.#silence.stop();
|
|
311
313
|
const flushed = this.seams.closeMessage();
|
|
312
314
|
for (const event of flushed) this.seams.emit(event);
|
|
313
|
-
|
|
315
|
+
// The whole turn: rows are split, and the probe reads its tool calls.
|
|
316
|
+
const closed = this.seams.turnMessage() ?? flushed.find((event) => event.type === 'message_end')?.message;
|
|
314
317
|
const abandoned = this.seams.openCalls();
|
|
315
318
|
for (const toolCallId of abandoned) {
|
|
316
319
|
this.seams.emit({ type: 'tool_execution_end', toolCallId, isError: true, result: { output: 'Cancelled' } });
|
|
@@ -45,7 +45,10 @@ describe('normalizeInitializeResult', () => {
|
|
|
45
45
|
expect(init.agentInfo).toEqual({ name: 'agent', title: 'Agent', version: '2.0.0' });
|
|
46
46
|
expect(init.agentCapabilities).toMatchObject({
|
|
47
47
|
loadSession: false,
|
|
48
|
-
|
|
48
|
+
// `embeddedContext` is present only when the agent said something about
|
|
49
|
+
// it: an absent v2 field is not a refusal, and the prompt builder
|
|
50
|
+
// downgrades `resource_link` blocks only on an explicit `false`.
|
|
51
|
+
promptCapabilities: { image: true, audio: false },
|
|
49
52
|
mcpCapabilities: { http: true, sse: false },
|
|
50
53
|
sessionCapabilities: {
|
|
51
54
|
list: {},
|
|
@@ -59,6 +62,23 @@ describe('normalizeInitializeResult', () => {
|
|
|
59
62
|
expect(init._meta).toMatchObject({ steering: { supported: true } });
|
|
60
63
|
});
|
|
61
64
|
|
|
65
|
+
test('a v2 prompt capability is a support marker, and absence is unknown', () => {
|
|
66
|
+
const supported = normalizeInitializeResult({
|
|
67
|
+
protocolVersion: 2,
|
|
68
|
+
info: { name: 'x', version: '1' },
|
|
69
|
+
capabilities: { session: { prompt: { embeddedContext: {} } } },
|
|
70
|
+
});
|
|
71
|
+
expect(supported.agentCapabilities?.promptCapabilities?.embeddedContext).toBe(true);
|
|
72
|
+
const silent = normalizeInitializeResult({
|
|
73
|
+
protocolVersion: 2,
|
|
74
|
+
info: { name: 'x', version: '1' },
|
|
75
|
+
capabilities: { session: { prompt: {} } },
|
|
76
|
+
});
|
|
77
|
+
// Not `false`: v2 has no way to say "refused", and reading absence as a
|
|
78
|
+
// refusal would strip `resource_link` blocks from agents that accept them.
|
|
79
|
+
expect(silent.agentCapabilities?.promptCapabilities?.embeddedContext).toBeUndefined();
|
|
80
|
+
});
|
|
81
|
+
|
|
62
82
|
test('an agent without capabilities.session claims no session methods', () => {
|
|
63
83
|
const init = normalizeInitializeResult({ protocolVersion: 2, info: { name: 'x', version: '1' }, capabilities: {} });
|
|
64
84
|
expect(init.agentCapabilities?.sessionCapabilities).toEqual({});
|
|
@@ -96,10 +96,15 @@ export function normalizeInitializeResult(raw: Record<string, unknown>): AcpInit
|
|
|
96
96
|
: {}),
|
|
97
97
|
agentCapabilities: {
|
|
98
98
|
loadSession: false,
|
|
99
|
+
// Only a PRESENT v2 field is a verdict. Writing `false` for an absent
|
|
100
|
+
// one would make "the agent never mentioned embedded context" look like
|
|
101
|
+
// an explicit refusal, and the prompt builder downgrades on a refusal.
|
|
99
102
|
promptCapabilities: {
|
|
100
103
|
image: advertised(prompt?.image),
|
|
101
104
|
audio: advertised(prompt?.audio),
|
|
102
|
-
embeddedContext
|
|
105
|
+
...(prompt && 'embeddedContext' in prompt
|
|
106
|
+
? { embeddedContext: advertised(prompt.embeddedContext) }
|
|
107
|
+
: {}),
|
|
103
108
|
},
|
|
104
109
|
mcpCapabilities: { http: advertised(mcp?.http), sse: false },
|
|
105
110
|
sessionCapabilities,
|
|
@@ -106,6 +106,28 @@ export function getAuthPath(): string {
|
|
|
106
106
|
return path.join(getDataDir(), 'auth.json');
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
/**
|
|
110
|
+
* `<data>/dictation.json` — the external transcription engine's API key.
|
|
111
|
+
*
|
|
112
|
+
* A file rather than an `app_settings` row because that table is injected into
|
|
113
|
+
* the page as `__OMP_BOOTSTRAP__.appSettings`, where any script on the origin
|
|
114
|
+
* could read it. Written 0600.
|
|
115
|
+
*/
|
|
116
|
+
export function getDictationSecretPath(): string {
|
|
117
|
+
return path.join(getDataDir(), 'dictation.json');
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* `<data>/tts.json` — the speech engines' API keys, one per hosted engine.
|
|
122
|
+
*
|
|
123
|
+
* Same rule as `dictation.json`: the settings blob ships to the browser, so a
|
|
124
|
+
* credential cannot live there. A map rather than one key because a user may
|
|
125
|
+
* keep keys for several engines and switch between them. Written 0600.
|
|
126
|
+
*/
|
|
127
|
+
export function getTtsSecretPath(): string {
|
|
128
|
+
return path.join(getDataDir(), 'tts.json');
|
|
129
|
+
}
|
|
130
|
+
|
|
109
131
|
/** `<data>/run/<port>.lock` — held only while a port handover is in progress. */
|
|
110
132
|
export function getLockPath(port: number | string): string {
|
|
111
133
|
return path.join(getRunDir(), `${port}.lock`);
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Rebuilding omp 19's patch journal.
|
|
8
|
+
*
|
|
9
|
+
* The writer stores hunks, not blob keys, and the tests pin the parts a wrong
|
|
10
|
+
* rebuild would silently corrupt: the line split (a trailing newline is a
|
|
11
|
+
* trailing empty line), the chain from a record with no `base`, a hunk list
|
|
12
|
+
* that lives in a blob, and the checksum gate that refuses a diff which does
|
|
13
|
+
* not reproduce the recorded `sum`.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
|
|
17
|
+
import * as fsp from 'node:fs/promises';
|
|
18
|
+
import * as os from 'node:os';
|
|
19
|
+
import * as path from 'node:path';
|
|
20
|
+
import { patchExistence, readPatchSides } from '@/server/lib/omp/session/changes-patch';
|
|
21
|
+
import { clearSessionFileCaches } from '@/server/lib/omp/session/files';
|
|
22
|
+
|
|
23
|
+
const SESSION_ID = '01a20b52-7000-7000-8000-000000000001';
|
|
24
|
+
let agentDir = '';
|
|
25
|
+
let journalDir = '';
|
|
26
|
+
|
|
27
|
+
const sum = (text: string): string => Bun.hash(text).toString(36);
|
|
28
|
+
|
|
29
|
+
async function blob(text: string): Promise<string> {
|
|
30
|
+
const key = `${Buffer.byteLength(text).toString(36)}-${sum(text)}`;
|
|
31
|
+
await fsp.mkdir(path.join(journalDir, 'blobs'), { recursive: true });
|
|
32
|
+
await fsp.writeFile(path.join(journalDir, 'blobs', key), Bun.gzipSync(Buffer.from(text, 'utf8')));
|
|
33
|
+
return key;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
beforeAll(async () => {
|
|
37
|
+
agentDir = await fsp.mkdtemp(path.join(os.tmpdir(), 'omp-changes-patch-'));
|
|
38
|
+
process.env.PI_CODING_AGENT_DIR = agentDir;
|
|
39
|
+
const cwdDir = path.join(agentDir, 'sessions', '-tmp-project');
|
|
40
|
+
await fsp.mkdir(cwdDir, { recursive: true });
|
|
41
|
+
const sessionFile = path.join(cwdDir, `2026-01-01T00-00-00-000Z_${SESSION_ID}.jsonl`);
|
|
42
|
+
await fsp.writeFile(sessionFile, `${JSON.stringify({ type: 'session', version: 3, id: SESSION_ID, cwd: '/tmp/project' })}\n`);
|
|
43
|
+
journalDir = sessionFile.slice(0, -'.jsonl'.length);
|
|
44
|
+
await fsp.mkdir(journalDir, { recursive: true });
|
|
45
|
+
clearSessionFileCaches();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
afterAll(async () => {
|
|
49
|
+
delete process.env.PI_CODING_AGENT_DIR;
|
|
50
|
+
clearSessionFileCaches();
|
|
51
|
+
await fsp.rm(agentDir, { recursive: true, force: true });
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe('readPatchSides', () => {
|
|
55
|
+
test('a create rebuilds from a null base', async () => {
|
|
56
|
+
const sides = await readPatchSides(SESSION_ID, [
|
|
57
|
+
{ base: null, edit: [[0, 0, ['one', 'two', '']]], sum: sum('one\ntwo\n') },
|
|
58
|
+
]);
|
|
59
|
+
expect(sides[0]).toEqual({ before: null, after: 'one\ntwo\n' });
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test('a record with no base continues the previous after, through a gap', async () => {
|
|
63
|
+
const sides = await readPatchSides(SESSION_ID, [
|
|
64
|
+
{ base: null, edit: [[0, 0, ['a', 'b', '']]], sum: sum('a\nb\n') },
|
|
65
|
+
// Someone else moved the file on between the two writes: `gap` is the
|
|
66
|
+
// step from the cached after to this record's real before.
|
|
67
|
+
{ gap: [[1, 1, ['B']]], edit: [[0, 2, ['A', 'B']]], sum: sum('A\nB\n') },
|
|
68
|
+
]);
|
|
69
|
+
expect(sides[1]).toEqual({ before: 'a\nB\n', after: 'A\nB\n' });
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('a hunk list stored as a blob is read back', async () => {
|
|
73
|
+
const hunks = JSON.stringify([[0, 0, ['blob', '']]]);
|
|
74
|
+
const key = await blob(hunks);
|
|
75
|
+
const sides = await readPatchSides(SESSION_ID, [{ base: null, edit: key, sum: sum('blob\n') }]);
|
|
76
|
+
expect(sides[0]?.after).toBe('blob\n');
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('a base stored as a blob key resolves the before side', async () => {
|
|
80
|
+
const key = await blob('old\n');
|
|
81
|
+
const sides = await readPatchSides(SESSION_ID, [{ base: key, edit: [[0, 1, ['new']]], sum: sum('new\n') }]);
|
|
82
|
+
expect(sides[0]).toEqual({ before: 'old\n', after: 'new\n' });
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test('a checksum that does not match is unknown, never a diff', async () => {
|
|
86
|
+
const sides = await readPatchSides(SESSION_ID, [
|
|
87
|
+
{ base: null, edit: [[0, 0, ['wrong', '']]], sum: sum('right\n') },
|
|
88
|
+
]);
|
|
89
|
+
expect(sides[0]).toBeUndefined();
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
test('a delete leaves the after side absent', async () => {
|
|
93
|
+
const sides = await readPatchSides(SESSION_ID, [
|
|
94
|
+
{ base: await blob('gone\n'), edit: [[0, 2, []]], sum: '-' },
|
|
95
|
+
]);
|
|
96
|
+
expect(sides[0]).toEqual({ before: 'gone\n', after: null });
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test('a record with no patch is unknown and ends the chain', async () => {
|
|
100
|
+
const sides = await readPatchSides(SESSION_ID, [
|
|
101
|
+
undefined,
|
|
102
|
+
{ edit: [[0, 0, ['x', '']]], sum: sum('x\n') },
|
|
103
|
+
]);
|
|
104
|
+
expect(sides).toEqual([undefined, undefined]);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
describe('patchExistence', () => {
|
|
109
|
+
test('a break in the chain leaves existence unknown, not guessed', () => {
|
|
110
|
+
expect(patchExistence([
|
|
111
|
+
{ base: null, sum: sum('a\n') },
|
|
112
|
+
undefined,
|
|
113
|
+
{ edit: [], sum: sum('b\n') },
|
|
114
|
+
])).toEqual([
|
|
115
|
+
{ existedBefore: false, existsAfter: true },
|
|
116
|
+
{},
|
|
117
|
+
{ existsAfter: true },
|
|
118
|
+
]);
|
|
119
|
+
});
|
|
120
|
+
});
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* omp 19's patch journal: a `change` record stores hunks, not blob keys.
|
|
8
|
+
*
|
|
9
|
+
* omp 18 wrote `before`/`after` as content-addressed blob keys. From 19 on the
|
|
10
|
+
* writer records `{base, gap, edit, sum}` instead:
|
|
11
|
+
*
|
|
12
|
+
* - `base` — the before content as a blob key; `null` when the file did not
|
|
13
|
+
* exist. Omitted when the writer's own cache already held the previous
|
|
14
|
+
* text of this path, which is why a record's before can require its
|
|
15
|
+
* predecessor.
|
|
16
|
+
* - `gap` — the step from that cached text to this record's before.
|
|
17
|
+
* - `edit` — the step from before to after, one `[start, deleteCount, lines]`
|
|
18
|
+
* hunk each.
|
|
19
|
+
* - `sum` — `Bun.hash(after)` in base36, or `-` when the file was deleted.
|
|
20
|
+
*
|
|
21
|
+
* A hunk list larger than 4 KB is itself stored as a blob, so `gap` and `edit`
|
|
22
|
+
* are either an inline array or a key. A record with none of the four fields is
|
|
23
|
+
* one omp could not store (over 8 MB, or NUL bytes): unknown, never guessed.
|
|
24
|
+
*
|
|
25
|
+
* The reconstruction follows `snapshots()` in omp's writer, including its
|
|
26
|
+
* checksum gate: a record whose rebuilt after does not hash to `sum` is
|
|
27
|
+
* reported unknown rather than shown as a diff that never existed.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import path from 'node:path';
|
|
31
|
+
import { findSessionFileById } from '@/server/lib/omp/session/locator';
|
|
32
|
+
import { siblingDirForSession } from '@/server/lib/omp/subagent/history/paths';
|
|
33
|
+
|
|
34
|
+
export interface OmpPatch {
|
|
35
|
+
base?: string | null;
|
|
36
|
+
gap?: unknown;
|
|
37
|
+
edit?: unknown;
|
|
38
|
+
sum?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** The two full texts of one patch record. */
|
|
42
|
+
export interface OmpPatchSides {
|
|
43
|
+
before: string | null;
|
|
44
|
+
after: string | null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** The created/deleted facts a patch states without reading a blob. */
|
|
48
|
+
export interface OmpPatchExistence {
|
|
49
|
+
existedBefore?: boolean;
|
|
50
|
+
existsAfter?: boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** omp's marker for a deleted file in `sum`. */
|
|
54
|
+
const DELETED = '-';
|
|
55
|
+
|
|
56
|
+
function splitLines(text: string | null): string[] {
|
|
57
|
+
return text === null ? [] : text.split('\n');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function joinLines(lines: string[]): string | null {
|
|
61
|
+
return lines.length === 0 ? null : lines.join('\n');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function checksum(text: string | null): string {
|
|
65
|
+
return text === null ? DELETED : Bun.hash(text).toString(36);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Apply omp's hunks; `undefined` when one addresses a range that is not there. */
|
|
69
|
+
function applyHunks(lines: string[], hunks: unknown): string[] | undefined {
|
|
70
|
+
if (!Array.isArray(hunks)) return undefined;
|
|
71
|
+
const out: string[] = [];
|
|
72
|
+
let cursor = 0;
|
|
73
|
+
for (const hunk of hunks) {
|
|
74
|
+
if (!Array.isArray(hunk) || hunk.length !== 3) return undefined;
|
|
75
|
+
const [start, count, inserted] = hunk;
|
|
76
|
+
if (typeof start !== 'number' || !Number.isInteger(start)) return undefined;
|
|
77
|
+
if (typeof count !== 'number' || !Number.isInteger(count) || count < 0) return undefined;
|
|
78
|
+
if (!Array.isArray(inserted)) return undefined;
|
|
79
|
+
if (start < cursor || start + count > lines.length) return undefined;
|
|
80
|
+
out.push(...lines.slice(cursor, start), ...inserted);
|
|
81
|
+
cursor = start + count;
|
|
82
|
+
}
|
|
83
|
+
out.push(...lines.slice(cursor));
|
|
84
|
+
return out;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** The session's omp blob directory, or `null` when it has no session file. */
|
|
88
|
+
export async function ompBlobDir(sessionId: string): Promise<string | null> {
|
|
89
|
+
const sessionFile = await findSessionFileById(sessionId);
|
|
90
|
+
return sessionFile ? path.join(siblingDirForSession(sessionFile), 'blobs') : null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async function readBlobText(dir: string | null, key: string): Promise<string | undefined> {
|
|
94
|
+
if (!dir) return undefined;
|
|
95
|
+
try {
|
|
96
|
+
const bytes = await Bun.file(path.join(dir, key)).bytes();
|
|
97
|
+
return new TextDecoder().decode(Bun.gunzipSync(bytes));
|
|
98
|
+
} catch {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** A hunk list, inline or behind a blob key. */
|
|
104
|
+
async function readHunks(value: unknown, dir: string | null): Promise<unknown> {
|
|
105
|
+
if (typeof value !== 'string') return value;
|
|
106
|
+
const text = await readBlobText(dir, value);
|
|
107
|
+
if (text === undefined) return undefined;
|
|
108
|
+
try {
|
|
109
|
+
return JSON.parse(text) as unknown;
|
|
110
|
+
} catch {
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async function resolveBefore(
|
|
116
|
+
patch: OmpPatch,
|
|
117
|
+
previous: { lines: string[]; text: string | null } | undefined,
|
|
118
|
+
dir: string | null,
|
|
119
|
+
): Promise<{ lines: string[]; text: string | null } | undefined> {
|
|
120
|
+
if (patch.base !== undefined) {
|
|
121
|
+
const text = patch.base === null ? null : await readBlobText(dir, patch.base);
|
|
122
|
+
if (text === undefined) return undefined;
|
|
123
|
+
return { lines: splitLines(text), text };
|
|
124
|
+
}
|
|
125
|
+
if (!previous || patch.gap === undefined) return previous;
|
|
126
|
+
const hunks = await readHunks(patch.gap, dir);
|
|
127
|
+
if (hunks === undefined) return undefined;
|
|
128
|
+
const lines = applyHunks(previous.lines, hunks);
|
|
129
|
+
return lines ? { lines, text: joinLines(lines) } : undefined;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The two sides of each patch for ONE path, in journal order.
|
|
134
|
+
*
|
|
135
|
+
* An entry is `undefined` where the chain cannot be rebuilt. A later break does
|
|
136
|
+
* not invalidate an earlier pair — each is verified against its own `sum` — but
|
|
137
|
+
* it does end the chain, so a following record with no `base` is unknown too.
|
|
138
|
+
*/
|
|
139
|
+
export async function readPatchSides(
|
|
140
|
+
sessionId: string,
|
|
141
|
+
patches: readonly (OmpPatch | undefined)[],
|
|
142
|
+
): Promise<(OmpPatchSides | undefined)[]> {
|
|
143
|
+
const dir = await ompBlobDir(sessionId);
|
|
144
|
+
const sides: (OmpPatchSides | undefined)[] = [];
|
|
145
|
+
let previous: { lines: string[]; text: string | null } | undefined;
|
|
146
|
+
for (const patch of patches) {
|
|
147
|
+
if (!patch) {
|
|
148
|
+
sides.push(undefined);
|
|
149
|
+
previous = undefined;
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
const before = await resolveBefore(patch, previous, dir);
|
|
153
|
+
const hunks = patch.edit === undefined ? undefined : await readHunks(patch.edit, dir);
|
|
154
|
+
const afterLines = before && hunks !== undefined ? applyHunks(before.lines, hunks) : undefined;
|
|
155
|
+
const after = afterLines ? { lines: afterLines, text: joinLines(afterLines) } : undefined;
|
|
156
|
+
previous = after;
|
|
157
|
+
if (!before || !after || checksum(after.text) !== patch.sum) {
|
|
158
|
+
sides.push(undefined);
|
|
159
|
+
previous = undefined;
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
sides.push({ before: before.text, after: after.text });
|
|
163
|
+
}
|
|
164
|
+
return sides;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* The created/deleted facts of one path's patches, in journal order.
|
|
169
|
+
*
|
|
170
|
+
* Metadata only, so the per-run file list can label `A`/`D` without reading
|
|
171
|
+
* content: `base: null` is a first write to a missing file, `sum: '-'` is a
|
|
172
|
+
* deletion, and a record with no `base` inherits existence from the previous
|
|
173
|
+
* `after` in the chain. A record without a patch ends the chain.
|
|
174
|
+
*/
|
|
175
|
+
export function patchExistence(patches: readonly (OmpPatch | undefined)[]): OmpPatchExistence[] {
|
|
176
|
+
let previous: boolean | undefined;
|
|
177
|
+
return patches.map((patch) => {
|
|
178
|
+
if (!patch) {
|
|
179
|
+
previous = undefined;
|
|
180
|
+
return {};
|
|
181
|
+
}
|
|
182
|
+
const existedBefore = patch.base === undefined ? previous : patch.base !== null;
|
|
183
|
+
const existsAfter = patch.sum === undefined ? undefined : patch.sum !== DELETED;
|
|
184
|
+
previous = existsAfter;
|
|
185
|
+
return {
|
|
186
|
+
...(existedBefore === undefined ? {} : { existedBefore }),
|
|
187
|
+
...(existsAfter === undefined ? {} : { existsAfter }),
|
|
188
|
+
};
|
|
189
|
+
});
|
|
190
|
+
}
|
|
@@ -18,7 +18,7 @@ import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
|
|
|
18
18
|
import * as fsp from 'node:fs/promises';
|
|
19
19
|
import * as os from 'node:os';
|
|
20
20
|
import * as path from 'node:path';
|
|
21
|
-
import {
|
|
21
|
+
import { readSessionChangeIndex, readSessionChangeList } from '@/server/lib/omp/session/changes';
|
|
22
22
|
import { clearSessionFileCaches } from '@/server/lib/omp/session/files';
|
|
23
23
|
|
|
24
24
|
const SESSION_ID = '01a0cc50-fd62-7417-899c-e24ff8c8608c';
|
|
@@ -93,47 +93,49 @@ describe('readSessionChangeIndex', () => {
|
|
|
93
93
|
});
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
-
describe('
|
|
97
|
-
test('
|
|
98
|
-
const
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const diff = await readSessionChangeDiff(SESSION_ID, file, 2000, 2001);
|
|
106
|
-
expect(diff?.status).toBe('modified');
|
|
107
|
-
expect(diff?.oldContent).toBe('line one\nline two\n');
|
|
108
|
-
expect(diff?.newContent).toBe('line one\nline TWO\nline three\n');
|
|
109
|
-
expect(diff?.diff).toContain('+line three');
|
|
110
|
-
expect(diff?.unavailable).toBe(false);
|
|
111
|
-
});
|
|
96
|
+
describe('patch records (omp 19)', () => {
|
|
97
|
+
test('a created file states its sides without a blob key', async () => {
|
|
98
|
+
const text = 'one\ntwo\n';
|
|
99
|
+
const file = `${CWD}/src/patch-create.ts`;
|
|
100
|
+
await append({
|
|
101
|
+
type: 'change', at: 7000, agent: 'Main', tool: 'bash', path: file,
|
|
102
|
+
base: null, edit: [[0, 0, ['one', 'two', '']]], sum: Bun.hash(text).toString(36),
|
|
103
|
+
});
|
|
112
104
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
expect(added?.status).toBe('added');
|
|
119
|
-
expect(added?.oldContent).toBe('');
|
|
120
|
-
|
|
121
|
-
const deletedPath = `${CWD}/src/deleted.ts`;
|
|
122
|
-
await append({ type: 'change', at: 3001, agent: 'Main', tool: 'write', path: deletedPath, before: created, after: null });
|
|
123
|
-
const deleted = await readSessionChangeDiff(SESSION_ID, deletedPath, 3001, 3001);
|
|
124
|
-
expect(deleted?.status).toBe('deleted');
|
|
125
|
-
expect(deleted?.newContent).toBe('');
|
|
105
|
+
const [record] = (await readSessionChangeIndex(SESSION_ID)).filter((entry) => entry.path === file);
|
|
106
|
+
expect(record?.before).toBeNull();
|
|
107
|
+
expect(record?.existedBefore).toBe(false);
|
|
108
|
+
expect(record?.existsAfter).toBe(true);
|
|
109
|
+
expect(record?.patch?.base).toBeNull();
|
|
126
110
|
});
|
|
127
111
|
|
|
128
|
-
test('a
|
|
129
|
-
const file = `${CWD}/src/
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
112
|
+
test('a chained write inherits existence, and a delete states its own', async () => {
|
|
113
|
+
const file = `${CWD}/src/patch-chain.ts`;
|
|
114
|
+
const recordsFor = [
|
|
115
|
+
{ at: 7100, base: null, edit: [[0, 0, ['one', 'two', '']]], sum: Bun.hash('one\ntwo\n').toString(36) },
|
|
116
|
+
{ at: 7101, edit: [[1, 1, ['TWO']]], sum: Bun.hash('one\nTWO\n').toString(36) },
|
|
117
|
+
{ at: 7102, edit: [[0, 2, []]], sum: '-' },
|
|
118
|
+
];
|
|
119
|
+
for (const record of recordsFor) {
|
|
120
|
+
await append({ type: 'change', agent: 'Main', tool: 'bash', path: file, ...record });
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const records = (await readSessionChangeIndex(SESSION_ID)).filter((entry) => entry.path === file);
|
|
124
|
+
expect(records.map((record) => [record.existedBefore, record.existsAfter])).toEqual([
|
|
125
|
+
[false, true],
|
|
126
|
+
[true, true],
|
|
127
|
+
[true, false],
|
|
128
|
+
]);
|
|
133
129
|
});
|
|
134
130
|
|
|
135
|
-
test('a
|
|
136
|
-
|
|
131
|
+
test('a record omp could not store has no patch and keeps the before unknown', async () => {
|
|
132
|
+
const file = `${CWD}/src/patch-unstored.ts`;
|
|
133
|
+
await append({ type: 'change', at: 7200, agent: 'Main', tool: 'bash', path: file });
|
|
134
|
+
|
|
135
|
+
const [record] = (await readSessionChangeIndex(SESSION_ID)).filter((entry) => entry.path === file);
|
|
136
|
+
expect(record?.patch).toBeUndefined();
|
|
137
|
+
expect(record?.before).toBeUndefined();
|
|
138
|
+
expect(record?.existedBefore).toBeUndefined();
|
|
137
139
|
});
|
|
138
140
|
});
|
|
139
141
|
|
|
@@ -168,34 +170,26 @@ describe('readSessionChangeList', () => {
|
|
|
168
170
|
});
|
|
169
171
|
});
|
|
170
172
|
|
|
171
|
-
describe('
|
|
172
|
-
test('
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
await append({ type: 'change', at: 5000, agent: 'Main', tool: 'edit', path: file, before, after: middle });
|
|
178
|
-
await append({ type: 'change', at: 5001, agent: 'Main', tool: 'edit', path: file, before: middle, after });
|
|
179
|
-
|
|
180
|
-
expect(await readSessionChangeStats(SESSION_ID, 5000, 5001)).toEqual({
|
|
181
|
-
[file]: { added: 2, removed: 1 },
|
|
173
|
+
describe('readSessionChangeList with patch records', () => {
|
|
174
|
+
test('drops a created-then-deleted patch path, from the patch metadata', async () => {
|
|
175
|
+
const file = `${CWD}/src/patch-gone.ts`;
|
|
176
|
+
await append({
|
|
177
|
+
type: 'change', at: 8000, agent: 'Main', tool: 'bash', path: file,
|
|
178
|
+
base: null, edit: [[0, 0, ['gone', '']]], sum: Bun.hash('gone\n').toString(36),
|
|
182
179
|
});
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
test('a created file counts its lines as additions', async () => {
|
|
186
|
-
const created = await blob('s4', 'one\ntwo\n');
|
|
187
|
-
const file = `${CWD}/src/created-stats.ts`;
|
|
188
|
-
await append({ type: 'change', at: 5100, agent: 'Main', tool: 'write', path: file, before: null, after: created });
|
|
180
|
+
await append({ type: 'change', at: 8001, agent: 'Main', tool: 'bash', path: file, edit: [[0, 1, []]], sum: '-' });
|
|
189
181
|
|
|
190
|
-
expect(await
|
|
191
|
-
[file]: { added: 2, removed: 0 },
|
|
192
|
-
});
|
|
182
|
+
expect((await readSessionChangeList(SESSION_ID)).some((record) => record.path === file)).toBe(false);
|
|
193
183
|
});
|
|
194
184
|
|
|
195
|
-
test('a
|
|
196
|
-
const file =
|
|
197
|
-
await
|
|
185
|
+
test('keeps a patch record whose file still exists', async () => {
|
|
186
|
+
const file = path.join(agentDir, 'patch-here.ts');
|
|
187
|
+
await fsp.writeFile(file, 'here\n');
|
|
188
|
+
await append({
|
|
189
|
+
type: 'change', at: 8002, agent: 'Main', tool: 'bash', path: file,
|
|
190
|
+
base: null, edit: [[0, 0, ['here', '']]], sum: Bun.hash('here\n').toString(36),
|
|
191
|
+
});
|
|
198
192
|
|
|
199
|
-
expect(await
|
|
193
|
+
expect((await readSessionChangeList(SESSION_ID)).some((record) => record.path === file)).toBe(true);
|
|
200
194
|
});
|
|
201
195
|
});
|