@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,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The `omp __omp_worker_stt` process: spawn it, frame what it says, keep what it
|
|
8
|
+
* complains about.
|
|
9
|
+
*
|
|
10
|
+
* This is the half that has to be right about *processes* — one decoder per
|
|
11
|
+
* child, stderr drained, an exit that belongs to a named handle — so the client
|
|
12
|
+
* above it can be about *requests*. The transport itself is `speech-frames.ts`.
|
|
13
|
+
*
|
|
14
|
+
* Two measured facts shaped it:
|
|
15
|
+
*
|
|
16
|
+
* - **A stale server kills this child.** omp 19's worker reads
|
|
17
|
+
* `Bun.stdin.stream()` and SIGKILLs itself in ~35 ms when that stream is
|
|
18
|
+
* `'ignore'`, which is how a pre-framing Kabmo build spawned it. So `stdin`
|
|
19
|
+
* must be a pipe the client writes frames into.
|
|
20
|
+
* - **A full stderr pipe blocks the child.** Nobody reads stderr in a healthy
|
|
21
|
+
* run, and 64 KB of transformers.js chatter is enough to wedge a decode. The
|
|
22
|
+
* tail is kept anyway, because a worker that dies before answering usually
|
|
23
|
+
* said why.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import type { Subprocess } from 'bun';
|
|
27
|
+
import { SpeechFrameDecoder, encodeSpeechFrame, type SpeechFrame } from '@/server/lib/dictation/speech-frames';
|
|
28
|
+
|
|
29
|
+
type WorkerChild = Subprocess<'pipe', 'pipe', 'pipe'>;
|
|
30
|
+
|
|
31
|
+
/** How much of the child's stderr to keep for the operator's log. */
|
|
32
|
+
const STDERR_TAIL_BYTES = 2_000;
|
|
33
|
+
|
|
34
|
+
/** What the client sees of a running worker. */
|
|
35
|
+
export interface SttWorkerProcess {
|
|
36
|
+
/** Write one frame; a closed pipe is the exit handler's news, not an error here. */
|
|
37
|
+
send(frame: Record<string, unknown>): void;
|
|
38
|
+
kill(): void;
|
|
39
|
+
/** The last of the child's stderr, for a failure that needs a reason. */
|
|
40
|
+
stderrTail(): string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface SttWorkerHandlers {
|
|
44
|
+
/** One decoded frame from the child. */
|
|
45
|
+
onFrame(frame: SpeechFrame): void;
|
|
46
|
+
/** The child is gone — it exited, or its stream broke. */
|
|
47
|
+
onExit(reason: 'exit' | 'broken', error?: Error): void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Start the worker and wire its three pipes.
|
|
52
|
+
*
|
|
53
|
+
* The handlers are bound to THIS process: a child killed a moment ago reports
|
|
54
|
+
* its exit after its replacement has spawned, and a handler that did not know
|
|
55
|
+
* which process it belonged to would tear the replacement down.
|
|
56
|
+
*/
|
|
57
|
+
export function startSttWorkerProcess(bin: string, handlers: SttWorkerHandlers): SttWorkerProcess {
|
|
58
|
+
const child = Bun.spawn({
|
|
59
|
+
cmd: [bin, '__omp_worker_stt'],
|
|
60
|
+
stdin: 'pipe',
|
|
61
|
+
stdout: 'pipe',
|
|
62
|
+
stderr: 'pipe',
|
|
63
|
+
env: process.env,
|
|
64
|
+
onExit: () => handlers.onExit('exit'),
|
|
65
|
+
}) as unknown as WorkerChild;
|
|
66
|
+
|
|
67
|
+
let stderrTail = '';
|
|
68
|
+
|
|
69
|
+
const pump = async () => {
|
|
70
|
+
// One decoder per child: a late chunk from a previous process must not be
|
|
71
|
+
// framed together with the new one's bytes.
|
|
72
|
+
const decoder = new SpeechFrameDecoder();
|
|
73
|
+
const reader = child.stdout.getReader();
|
|
74
|
+
try {
|
|
75
|
+
for (;;) {
|
|
76
|
+
const { done, value } = await reader.read();
|
|
77
|
+
if (done) return;
|
|
78
|
+
for (const frame of decoder.push(value)) handlers.onFrame(frame);
|
|
79
|
+
}
|
|
80
|
+
} catch (error) {
|
|
81
|
+
handlers.onExit('broken', error instanceof Error ? error : new Error(String(error)));
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const drainStderr = async () => {
|
|
86
|
+
const reader = child.stderr.getReader();
|
|
87
|
+
const decoder = new TextDecoder();
|
|
88
|
+
try {
|
|
89
|
+
for (;;) {
|
|
90
|
+
const { done, value } = await reader.read();
|
|
91
|
+
if (done) return;
|
|
92
|
+
stderrTail = (stderrTail + decoder.decode(value, { stream: true })).slice(-STDERR_TAIL_BYTES);
|
|
93
|
+
}
|
|
94
|
+
} catch {
|
|
95
|
+
// A closed stream is not a failure of its own; the exit handler reports.
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
void pump();
|
|
100
|
+
void drainStderr();
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
send: (frame) => {
|
|
104
|
+
try {
|
|
105
|
+
child.stdin.write(encodeSpeechFrame(frame));
|
|
106
|
+
// Buffered writes stay ordered; the flush is what puts the frame on the
|
|
107
|
+
// wire before a decode that can take a second.
|
|
108
|
+
void child.stdin.flush();
|
|
109
|
+
} catch {
|
|
110
|
+
// Closed pipe: the exit handler is what reports it.
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
kill: () => {
|
|
114
|
+
try {
|
|
115
|
+
child.kill();
|
|
116
|
+
} catch {
|
|
117
|
+
// already gone
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
stderrTail: () => stderrTail,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import type { AcpId, AcpResponse } from '@/server/lib/harness/acp/protocol';
|
|
20
|
+
import { ACP_ERROR } from '@/server/lib/harness/acp/protocol';
|
|
20
21
|
|
|
21
22
|
/** What the table does when a request's own deadline expires. A timeout is the
|
|
22
23
|
* client's verdict, not the agent's: without telling it, the agent keeps
|
|
@@ -121,4 +122,23 @@ export class PendingCalls {
|
|
|
121
122
|
entry.reject(error);
|
|
122
123
|
}
|
|
123
124
|
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Withdraw this session's control calls, returning their ids so the transport
|
|
128
|
+
* can tell the agent (`$/cancel_request`). `session/prompt` is deliberately
|
|
129
|
+
* excluded: cancelling a turn is `session/cancel`'s job, and settling the
|
|
130
|
+
* prompt belongs to the turn machine's grace window.
|
|
131
|
+
*/
|
|
132
|
+
cancelRequestsOf(sessionId: string, exclude: readonly string[] = ['session/prompt']): AcpId[] {
|
|
133
|
+
const ids: AcpId[] = [];
|
|
134
|
+
for (const [id, entry] of this.map) {
|
|
135
|
+
if (exclude.includes(entry.method)) continue;
|
|
136
|
+
if (String(entry.params.sessionId ?? '') !== sessionId) continue;
|
|
137
|
+
this.map.delete(id);
|
|
138
|
+
clearTimeout(entry.timer);
|
|
139
|
+
entry.reject(new AcpRequestError('Request cancelled', ACP_ERROR.cancelled));
|
|
140
|
+
ids.push(id);
|
|
141
|
+
}
|
|
142
|
+
return ids;
|
|
143
|
+
}
|
|
124
144
|
}
|
|
@@ -37,10 +37,17 @@
|
|
|
37
37
|
* `session.compaction` IS advertised: the frame mapper turns a compaction into a
|
|
38
38
|
* notice, which is the surface the timeline already has, so an agent may report
|
|
39
39
|
* one instead of falling back to modelling it as conversation text.
|
|
40
|
+
*
|
|
41
|
+
* `session.plan` and `subagents` are advertised because both now have a
|
|
42
|
+
* consumer: `plan`/`plan_update` feed the Todos panel, and `subagents.ts` +
|
|
43
|
+
* `subagent-frames.ts` track and draw each child the parent announces. The
|
|
44
|
+
* subagents RFD forbids a v1 agent from sending `subagent_update` unless the
|
|
45
|
+
* client advertised it, so the handlers were unreachable before this entry.
|
|
40
46
|
*/
|
|
41
47
|
export const KABMO_CLIENT_CAPABILITIES = {
|
|
42
48
|
fs: { readTextFile: true, writeTextFile: true },
|
|
43
|
-
session: { notices: {}, compaction: {} },
|
|
49
|
+
session: { notices: {}, compaction: {}, plan: {} },
|
|
50
|
+
subagents: {},
|
|
44
51
|
} as const;
|
|
45
52
|
|
|
46
53
|
/** The latest protocol major this client sends; it also speaks v1. */
|
|
@@ -32,6 +32,13 @@ import { ACP_ERROR } from '@/server/lib/harness/acp/protocol';
|
|
|
32
32
|
export interface AcpFsHost {
|
|
33
33
|
readonly cwd: string;
|
|
34
34
|
readonly sessionId: string;
|
|
35
|
+
/** The working directory of an ADDRESSED session: a subagent announced its
|
|
36
|
+
* own `cwd`, and confining its reads to the parent's tree would refuse paths
|
|
37
|
+
* it legitimately owns. Absent means every session shares `cwd`. */
|
|
38
|
+
cwdFor?(sessionId: string | undefined): string;
|
|
39
|
+
/** Whether this client serves the addressed session: itself, or a child it
|
|
40
|
+
* announced. Absent means only `sessionId` itself. */
|
|
41
|
+
owns?(sessionId: string): boolean;
|
|
35
42
|
/** Publish the write so the timeline's change journal records it. A write the
|
|
36
43
|
* AGENT performed through this client runs no tool of its own: without this
|
|
37
44
|
* frame its file change never reached the journal or the diff panel. */
|
|
@@ -53,10 +60,14 @@ export async function handleAcpFsRequest(
|
|
|
53
60
|
params: Record<string, unknown>,
|
|
54
61
|
): Promise<AcpFsAnswer> {
|
|
55
62
|
const requestedSession = params.sessionId;
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
if (
|
|
63
|
+
// A session this client does not serve names something it was never given:
|
|
64
|
+
// a second chat on the same process, or a child nobody announced. Serving it
|
|
65
|
+
// would let that session reach a workspace it does not own.
|
|
66
|
+
if (
|
|
67
|
+
typeof requestedSession === 'string'
|
|
68
|
+
&& requestedSession !== host.sessionId
|
|
69
|
+
&& !host.owns?.(requestedSession)
|
|
70
|
+
) {
|
|
60
71
|
return refuse(ACP_ERROR.invalidParams, `Unknown session: ${requestedSession}`);
|
|
61
72
|
}
|
|
62
73
|
const target = params.path;
|
|
@@ -66,7 +77,8 @@ export async function handleAcpFsRequest(
|
|
|
66
77
|
if (!path.isAbsolute(target)) {
|
|
67
78
|
return refuse(ACP_ERROR.invalidParams, `Path must be absolute: ${target}`);
|
|
68
79
|
}
|
|
69
|
-
|
|
80
|
+
const root = host.cwdFor?.(typeof requestedSession === 'string' ? requestedSession : undefined) ?? host.cwd;
|
|
81
|
+
if (!(await pathHolds(root, target))) {
|
|
70
82
|
return refuse(ACP_ERROR.invalidParams, `Path is outside this session's workspace: ${target}`);
|
|
71
83
|
}
|
|
72
84
|
|
|
@@ -40,7 +40,13 @@ describe('initializeAcpAgent', () => {
|
|
|
40
40
|
protocolVersion: 2,
|
|
41
41
|
capabilities: {},
|
|
42
42
|
info: { name: 'kabmo', version: '0.1' },
|
|
43
|
-
clientCapabilities: {
|
|
43
|
+
clientCapabilities: {
|
|
44
|
+
fs: { readTextFile: true, writeTextFile: true },
|
|
45
|
+
// Advertised because both have a consumer now: `plan` feeds the Todos
|
|
46
|
+
// panel, `subagents` is what lets a v1 agent announce a child at all.
|
|
47
|
+
session: { notices: {}, compaction: {}, plan: {} },
|
|
48
|
+
subagents: {},
|
|
49
|
+
},
|
|
44
50
|
});
|
|
45
51
|
expect(result.protocolVersion).toBe(2);
|
|
46
52
|
expect(result.agentCapabilities?.promptCapabilities?.image).toBe(true);
|
|
@@ -67,4 +73,29 @@ describe('initializeAcpAgent', () => {
|
|
|
67
73
|
}))).rejects.toThrow('ACP agent exited');
|
|
68
74
|
expect(calls).toBe(1);
|
|
69
75
|
});
|
|
76
|
+
|
|
77
|
+
test('does not retry a refusal that is not about the version', async () => {
|
|
78
|
+
// Re-sending `initialize` to an agent that refused for its own reason hid
|
|
79
|
+
// the real error behind a second attempt, and reported the pair as a
|
|
80
|
+
// version problem it was not.
|
|
81
|
+
let calls = 0;
|
|
82
|
+
await expect(initializeAcpAgent(invokeAnswering(async () => {
|
|
83
|
+
calls += 1;
|
|
84
|
+
throw new AcpRequestError('Invalid params: unknown field "capabilities"', -32602);
|
|
85
|
+
}))).rejects.toThrow('Invalid params');
|
|
86
|
+
expect(calls).toBe(1);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test('retries when the refusal lists only v1 as supported', async () => {
|
|
90
|
+
const versions: unknown[] = [];
|
|
91
|
+
const result = await initializeAcpAgent(invokeAnswering(async (params) => {
|
|
92
|
+
versions.push(params.protocolVersion);
|
|
93
|
+
if (params.protocolVersion === 2) {
|
|
94
|
+
throw new AcpRequestError('Protocol version not supported', -32602, { requested: 2, supported: [1] });
|
|
95
|
+
}
|
|
96
|
+
return { protocolVersion: 1 };
|
|
97
|
+
}));
|
|
98
|
+
expect(versions).toEqual([2, 1]);
|
|
99
|
+
expect(result.protocolVersion).toBe(1);
|
|
100
|
+
});
|
|
70
101
|
});
|
|
@@ -20,6 +20,13 @@
|
|
|
20
20
|
* is still uninitialized after a failed `initialize`, so one clean v1 retry is
|
|
21
21
|
* allowed and is what keeps such an agent working.
|
|
22
22
|
*
|
|
23
|
+
* **Only a VERSION refusal is retried.** The first version of this retried on
|
|
24
|
+
* any `AcpRequestError`, which re-sent `initialize` to an agent that had refused
|
|
25
|
+
* it for its own reasons (`Invalid params`, a broken config) and reported the
|
|
26
|
+
* second failure as if the version were at fault. The retry now needs evidence
|
|
27
|
+
* that v2 is the problem: the spec's version-mismatch code, a `supported` list
|
|
28
|
+
* that excludes 2, or the adapter's own "unsupported version" wording.
|
|
29
|
+
*
|
|
23
30
|
* The result is normalized into the v1-shaped record the rest of Kabmo reads
|
|
24
31
|
* (`normalizeInitializeResult`); the negotiated major is kept on it.
|
|
25
32
|
*/
|
|
@@ -38,6 +45,9 @@ export type AcpInitializeInvoke = <T>(method: string, params: unknown, timeoutMs
|
|
|
38
45
|
|
|
39
46
|
const CLIENT_INFO = { name: 'kabmo', title: 'Kabmo', version: '0.1' };
|
|
40
47
|
|
|
48
|
+
/** The spec's `-32022`, answered with the majors the agent does support. */
|
|
49
|
+
const UNSUPPORTED_PROTOCOL_VERSION = -32022;
|
|
50
|
+
|
|
41
51
|
/** v1 capabilities for a v1 peer; v2 removed fs/terminal and Kabmo advertises neither. */
|
|
42
52
|
function v1Request(capabilities: Record<string, unknown>): Record<string, unknown> {
|
|
43
53
|
return {
|
|
@@ -58,24 +68,59 @@ function hybridRequest(capabilities: Record<string, unknown>): Record<string, un
|
|
|
58
68
|
};
|
|
59
69
|
}
|
|
60
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Whether a refused `initialize` is a VERSION mismatch, which is the only
|
|
73
|
+
* refusal a v1 retry can fix.
|
|
74
|
+
*/
|
|
75
|
+
export function isVersionRefusal(error: unknown): boolean {
|
|
76
|
+
if (!(error instanceof AcpRequestError)) return false;
|
|
77
|
+
if (error.code === UNSUPPORTED_PROTOCOL_VERSION) return true;
|
|
78
|
+
const data = asRecord(error.data);
|
|
79
|
+
const supported = data?.supported;
|
|
80
|
+
if (Array.isArray(supported)) {
|
|
81
|
+
const versions = supported.filter((value): value is number => typeof value === 'number');
|
|
82
|
+
if (versions.length > 0 && !versions.includes(2)) return true;
|
|
83
|
+
}
|
|
84
|
+
return /unsupported\s+(protocol\s+)?version|protocol version .*not supported/i.test(error.message);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The major this client ASKS for. `KABMO_ACP_PROTOCOL=1` pins every connection
|
|
89
|
+
* to v1 — the kill switch for an adapter that misbehaves under the v2 dialect
|
|
90
|
+
* (which upstream still ships behind an unstable feature). Unset means the
|
|
91
|
+
* hybrid v2 request with a v1 retry.
|
|
92
|
+
*/
|
|
93
|
+
export function acpProtocolPreference(): 1 | 2 {
|
|
94
|
+
return Bun.env.KABMO_ACP_PROTOCOL === '1' ? 1 : 2;
|
|
95
|
+
}
|
|
96
|
+
|
|
61
97
|
export async function initializeAcpAgent(
|
|
62
98
|
request: AcpInitializeInvoke,
|
|
63
99
|
capabilities: Record<string, unknown> = KABMO_CLIENT_CAPABILITIES,
|
|
64
100
|
timeoutMs = 60_000,
|
|
65
101
|
): Promise<AcpInitializeResult> {
|
|
102
|
+
const pinned = acpProtocolPreference();
|
|
66
103
|
let raw: Record<string, unknown>;
|
|
67
104
|
try {
|
|
68
|
-
raw = asRecord(
|
|
105
|
+
raw = asRecord(
|
|
106
|
+
await request<unknown>('initialize', pinned === 1 ? v1Request(capabilities) : hybridRequest(capabilities), timeoutMs),
|
|
107
|
+
) ?? {};
|
|
108
|
+
if (pinned === 1) {
|
|
109
|
+
const result = normalizeInitializeResult(raw);
|
|
110
|
+
assertProtocolVersion(result);
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
69
113
|
} catch (first) {
|
|
70
|
-
//
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
if (!(first
|
|
114
|
+
// A dead process or a timeout has nothing to renegotiate, and neither does
|
|
115
|
+
// an agent that refused for its own reason: re-sending would hide the real
|
|
116
|
+
// error behind a second attempt.
|
|
117
|
+
if (!isVersionRefusal(first)) throw first;
|
|
118
|
+
const firstMessage = first instanceof Error ? first.message : String(first);
|
|
74
119
|
try {
|
|
75
120
|
raw = asRecord(await request<unknown>('initialize', v1Request(capabilities), timeoutMs)) ?? {};
|
|
76
121
|
} catch (retry) {
|
|
77
122
|
const b = retry instanceof Error ? retry.message : String(retry);
|
|
78
|
-
throw new Error(`initialize failed (v2 attempt: ${
|
|
123
|
+
throw new Error(`initialize failed (v2 attempt: ${firstMessage}; v1 attempt: ${b})`);
|
|
79
124
|
}
|
|
80
125
|
}
|
|
81
126
|
const result = normalizeInitializeResult(raw);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Answering a call the AGENT made on this client.
|
|
8
|
+
*
|
|
9
|
+
* Split out of `client.ts` for the per-file ceiling, and because the rule is
|
|
10
|
+
* its own subject: an unanswered agent→client call parks the turn, so every
|
|
11
|
+
* branch here either answers, defers (the approval dialog answers later through
|
|
12
|
+
* `respond`), or refuses WITH a code the agent can act on. Dropping a call is
|
|
13
|
+
* the one outcome this module must never produce.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import type { AcpId } from '@/server/lib/harness/acp/protocol';
|
|
17
|
+
import type { AcpClientRequestHandler } from '@/server/lib/harness/acp/client';
|
|
18
|
+
|
|
19
|
+
/** The transport seams one answer needs. */
|
|
20
|
+
export interface AgentRequestResponder {
|
|
21
|
+
respond(id: AcpId, result: unknown): void;
|
|
22
|
+
respondError(id: AcpId, message: string, code?: number): void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export async function answerAgentRequest(
|
|
26
|
+
responder: AgentRequestResponder,
|
|
27
|
+
ask: AcpClientRequestHandler | undefined,
|
|
28
|
+
id: AcpId,
|
|
29
|
+
method: string,
|
|
30
|
+
params: unknown,
|
|
31
|
+
): Promise<void> {
|
|
32
|
+
const bag = (params ?? {}) as Record<string, unknown>;
|
|
33
|
+
try {
|
|
34
|
+
const handled = await ask?.(id, method, bag);
|
|
35
|
+
if (handled?.answered) {
|
|
36
|
+
responder.respond(id, handled.result);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
// A deferred call is answered LATER through `respond(id, …)` — the approval
|
|
40
|
+
// dialog works this way, and sending a refusal here would answer the same
|
|
41
|
+
// request twice.
|
|
42
|
+
if (handled && 'deferred' in handled) return;
|
|
43
|
+
// A refusal is REQUIRED, and the code travels with it so the agent can fall
|
|
44
|
+
// back (`-32601` is "this client lacks the method", not "it broke").
|
|
45
|
+
responder.respondError(id, handled?.message ?? `Kabmo does not implement ${method}`, handled?.code);
|
|
46
|
+
} catch (error) {
|
|
47
|
+
responder.respondError(id, error instanceof Error ? error.message : String(error));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
* `_auth/status_update` ~3.4 s after `initialize` with nobody asking. Unknown
|
|
21
21
|
* notifications are forwarded, never treated as errors.
|
|
22
22
|
* - **agent→client requests.** `fs/read_text_file`, `terminal/*`, and
|
|
23
|
-
* `session/request_permission` are calls the AGENT makes on the CLIENT
|
|
24
|
-
*
|
|
25
|
-
* explicitly refused — never dropped.
|
|
23
|
+
* `session/request_permission` are calls the AGENT makes on the CLIENT; the
|
|
24
|
+
* answering rule lives in `client-requests.ts`.
|
|
26
25
|
*/
|
|
27
26
|
|
|
28
27
|
import { PendingCalls } from '@/server/lib/harness/acp/calls';
|
|
29
28
|
import { AgentStdio } from '@/server/lib/harness/acp/stdio';
|
|
30
29
|
import * as verbs from '@/server/lib/harness/acp/verbs';
|
|
31
30
|
import { initializeAcpAgent } from '@/server/lib/harness/acp/client-initialize';
|
|
31
|
+
import { answerAgentRequest } from '@/server/lib/harness/acp/client-requests';
|
|
32
32
|
import { ACP_ERROR } from '@/server/lib/harness/acp/protocol';
|
|
33
33
|
import type {
|
|
34
34
|
AcpId,
|
|
@@ -109,7 +109,21 @@ export class AcpProcess {
|
|
|
109
109
|
{
|
|
110
110
|
onLine: (line) => this.handleLine(line),
|
|
111
111
|
onStderr: (line) => this.sinks.onStderr?.(line),
|
|
112
|
+
onStdoutClosed: () => {
|
|
113
|
+
// The transport is one-way now: answering is impossible, so every
|
|
114
|
+
// parked call is refused instead of waiting out its budget, and the
|
|
115
|
+
// child is reported as gone even while its PID is still alive —
|
|
116
|
+
// otherwise `isAlive` would keep a chat that can never answer.
|
|
117
|
+
if (this.exited) return;
|
|
118
|
+
this.exited = true;
|
|
119
|
+
this.rejectAll(new Error('ACP agent closed its output stream'));
|
|
120
|
+
this.sinks.onExit?.({ code: null, signal: null, stderrTail: this.stdio.stderrTail });
|
|
121
|
+
void this.stdio.dispose(1_000);
|
|
122
|
+
},
|
|
112
123
|
onExit: ({ code, stderrTail }) => {
|
|
124
|
+
// EOF can report the exit first; the real `exited` callback must not
|
|
125
|
+
// report the same death twice.
|
|
126
|
+
if (this.exited) return;
|
|
113
127
|
this.exited = true;
|
|
114
128
|
// The agent's own last words, when it left any: `exited (code 0)` is
|
|
115
129
|
// what a shadowed/deprecated binary prints while it explains itself on
|
|
@@ -123,21 +137,13 @@ export class AcpProcess {
|
|
|
123
137
|
);
|
|
124
138
|
}
|
|
125
139
|
|
|
126
|
-
get isAlive(): boolean {
|
|
127
|
-
|
|
128
|
-
}
|
|
140
|
+
get isAlive(): boolean { return !this.exited; }
|
|
141
|
+
get pid(): number | undefined { return this.stdio.pid; }
|
|
129
142
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* `initialize`; the client advertises exactly what it can serve.
|
|
136
|
-
*
|
|
137
|
-
* Idempotent: a prewarmed process has already answered, and the session that
|
|
138
|
-
* adopts it must not pay a second round trip (or, worse, send a second
|
|
139
|
-
* `initialize` the agent may refuse).
|
|
140
|
-
*/
|
|
143
|
+
/** `initialize`; the client advertises exactly what it can serve.
|
|
144
|
+
* Idempotent: a prewarmed process has already answered, and the session that
|
|
145
|
+
* adopts it must not pay a second round trip (or send a second `initialize`
|
|
146
|
+
* the agent may refuse). */
|
|
141
147
|
initialize(capabilities?: Record<string, unknown>, timeoutMs = 60_000): Promise<AcpInitializeResult> {
|
|
142
148
|
this.init ??= initializeAcpAgent(this.call, capabilities, timeoutMs).then((result) => {
|
|
143
149
|
this.protocolVersion = result.protocolVersion === 2 ? 2 : 1;
|
|
@@ -208,6 +214,14 @@ export class AcpProcess {
|
|
|
208
214
|
this.pending.abandonPrompt(sessionId);
|
|
209
215
|
}
|
|
210
216
|
|
|
217
|
+
/** Withdraw this session's open control calls and tell the agent. Prompts are
|
|
218
|
+
* left to `session/cancel` + the turn machine's grace window. */
|
|
219
|
+
cancelControlRequests(sessionId: string): void {
|
|
220
|
+
for (const id of this.pending.cancelRequestsOf(sessionId)) {
|
|
221
|
+
this.notify('$/cancel_request', { requestId: id });
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
211
225
|
setConfigOption(sessionId: string, configId: string, value: string | boolean, timeoutMs?: number) {
|
|
212
226
|
return verbs.setConfigOption(this.call, sessionId, configId, value, timeoutMs, this.protocolVersion);
|
|
213
227
|
}
|
|
@@ -325,24 +339,7 @@ export class AcpProcess {
|
|
|
325
339
|
}
|
|
326
340
|
|
|
327
341
|
/** Answer (or refuse) a call the AGENT made on this client. */
|
|
328
|
-
private
|
|
329
|
-
|
|
330
|
-
try {
|
|
331
|
-
const handled = await this.sinks.onClientRequest?.(id, method, bag);
|
|
332
|
-
if (handled?.answered) {
|
|
333
|
-
this.respond(id, handled.result);
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
// A deferred call is answered LATER through `respond(id, …)` — the
|
|
337
|
-
// approval dialog works this way, and sending a refusal here would answer
|
|
338
|
-
// the same request twice.
|
|
339
|
-
if (handled && 'deferred' in handled) return;
|
|
340
|
-
// A refusal is REQUIRED: an unanswered agent→client call parks the turn.
|
|
341
|
-
// The code travels with it so the agent can fall back accordingly.
|
|
342
|
-
this.respondError(id, handled?.message ?? `Kabmo does not implement ${method}`, handled?.code);
|
|
343
|
-
} catch (error) {
|
|
344
|
-
this.respondError(id, error instanceof Error ? error.message : String(error));
|
|
345
|
-
}
|
|
342
|
+
private handleAgentRequest(id: AcpId, method: string, params: unknown): Promise<void> {
|
|
343
|
+
return answerAgentRequest(this, this.sinks.onClientRequest, id, method, params);
|
|
346
344
|
}
|
|
347
|
-
|
|
348
345
|
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Where a row ENDS. The timeline draws a row's blocks in a fixed order —
|
|
8
|
+
* thinking, then the answer text, then the tool cards — so a row that holds a
|
|
9
|
+
* card and the prose written after it draws the ANSWER first. Measured on
|
|
10
|
+
* session 9ea5a178 (antigravity): frames arrived `tool_call run_command` →
|
|
11
|
+
* `tool_execution_end` → thought → `agent_message_chunk` "Ini gambarnya!…", the
|
|
12
|
+
* merged row rendered `"Ini gambarnya!Run Command… Done"`, and the same
|
|
13
|
+
* transcript split rendered `"Run Command… DoneIni gambarnya!"` — arrival order.
|
|
14
|
+
*
|
|
15
|
+
* Split from `frames.test.ts` to stay under the file ceiling.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { describe, expect, test } from 'bun:test';
|
|
19
|
+
import { AcpFrameMapper } from '@/server/lib/harness/acp/frames';
|
|
20
|
+
|
|
21
|
+
const anonymousChunk = (text: string) => ({
|
|
22
|
+
sessionUpdate: 'agent_message_chunk',
|
|
23
|
+
content: { type: 'text', text },
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const messageIdOf = (frame: unknown): string | undefined => {
|
|
27
|
+
if (!frame || typeof frame !== 'object' || !('message' in frame)) return undefined;
|
|
28
|
+
const message = frame.message;
|
|
29
|
+
if (!message || typeof message !== 'object' || !('id' in message)) return undefined;
|
|
30
|
+
return typeof message.id === 'string' ? message.id : undefined;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const contentOf = (frame: unknown): { type: string; text?: string; thinking?: string }[] => {
|
|
34
|
+
if (!frame || typeof frame !== 'object' || !('message' in frame)) return [];
|
|
35
|
+
const message = frame.message;
|
|
36
|
+
if (!message || typeof message !== 'object' || !('content' in message)) return [];
|
|
37
|
+
const content = message.content;
|
|
38
|
+
return Array.isArray(content) ? (content as { type: string; text?: string; thinking?: string }[]) : [];
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
describe('acp frame mapper — row boundaries', () => {
|
|
42
|
+
test('a tool call and the prose after it are TWO rows, in arrival order', () => {
|
|
43
|
+
const mapper = new AcpFrameMapper();
|
|
44
|
+
const opened = mapper.mapUpdate({
|
|
45
|
+
sessionUpdate: 'tool_call',
|
|
46
|
+
toolCallId: 't1',
|
|
47
|
+
title: 'Read',
|
|
48
|
+
status: 'in_progress',
|
|
49
|
+
});
|
|
50
|
+
const frames = mapper.mapUpdate(anonymousChunk('done'));
|
|
51
|
+
expect(frames.map((frame) => frame.type)).toEqual(['message_end', 'message_update']);
|
|
52
|
+
expect(messageIdOf(frames[1])).not.toBe(messageIdOf(opened[0]));
|
|
53
|
+
// The closed row is the CARD's row, not a copy of the answer.
|
|
54
|
+
expect(contentOf(frames[0]).map((block) => block.type)).toEqual(['toolCall']);
|
|
55
|
+
expect(messageIdOf(mapper.closeMessage()[0])).toBe(messageIdOf(frames[1]));
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test('prose before a card stays in its own row', () => {
|
|
59
|
+
const mapper = new AcpFrameMapper();
|
|
60
|
+
mapper.mapUpdate(anonymousChunk('checking'));
|
|
61
|
+
const frames = mapper.mapUpdate({
|
|
62
|
+
sessionUpdate: 'tool_call',
|
|
63
|
+
toolCallId: 't2',
|
|
64
|
+
title: 'Read',
|
|
65
|
+
status: 'in_progress',
|
|
66
|
+
});
|
|
67
|
+
expect(frames.map((frame) => frame.type)).toEqual([
|
|
68
|
+
'message_end',
|
|
69
|
+
'message_update',
|
|
70
|
+
'tool_execution_start',
|
|
71
|
+
]);
|
|
72
|
+
expect(contentOf(frames[0])).toEqual([{ type: 'text', text: 'checking' }]);
|
|
73
|
+
// The card row is fresh, not the closed prose row's identity.
|
|
74
|
+
expect(messageIdOf(frames[1])).not.toBe(messageIdOf(frames[0]));
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test('thinking written after a card is its own row too', () => {
|
|
78
|
+
const mapper = new AcpFrameMapper();
|
|
79
|
+
mapper.mapUpdate({
|
|
80
|
+
sessionUpdate: 'tool_call',
|
|
81
|
+
toolCallId: 't3',
|
|
82
|
+
title: 'Read',
|
|
83
|
+
status: 'in_progress',
|
|
84
|
+
});
|
|
85
|
+
const frames = mapper.mapUpdate({
|
|
86
|
+
sessionUpdate: 'agent_thought_chunk',
|
|
87
|
+
content: { type: 'text', text: 'hmm' },
|
|
88
|
+
});
|
|
89
|
+
expect(frames.map((frame) => frame.type)).toEqual(['message_end', 'message_update']);
|
|
90
|
+
expect(contentOf(frames[1])).toEqual([{ type: 'thinking', thinking: 'hmm' }]);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('consecutive cards share ONE row', () => {
|
|
94
|
+
const mapper = new AcpFrameMapper();
|
|
95
|
+
const first = mapper.mapUpdate({
|
|
96
|
+
sessionUpdate: 'tool_call',
|
|
97
|
+
toolCallId: 'a1',
|
|
98
|
+
title: 'Read',
|
|
99
|
+
status: 'in_progress',
|
|
100
|
+
});
|
|
101
|
+
const second = mapper.mapUpdate({
|
|
102
|
+
sessionUpdate: 'tool_call',
|
|
103
|
+
toolCallId: 'b1',
|
|
104
|
+
title: 'Read',
|
|
105
|
+
status: 'in_progress',
|
|
106
|
+
});
|
|
107
|
+
expect(second.map((frame) => frame.type)).toEqual(['message_update', 'tool_execution_start']);
|
|
108
|
+
expect(messageIdOf(second[0])).toBe(messageIdOf(first[0]));
|
|
109
|
+
expect(contentOf(second[0]).map((block) => block.type)).toEqual(['toolCall', 'toolCall']);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test('the turn-level message keeps every row, for the background probe', () => {
|
|
113
|
+
// Rows are split for the timeline, but `endAcpTurn` asks the closed turn
|
|
114
|
+
// whether it handed work to a background worker and what its answer was.
|
|
115
|
+
// The last row alone answered "no tool call" for a turn that spawned one.
|
|
116
|
+
const mapper = new AcpFrameMapper();
|
|
117
|
+
mapper.reset();
|
|
118
|
+
mapper.mapUpdate({
|
|
119
|
+
sessionUpdate: 'tool_call',
|
|
120
|
+
toolCallId: 'c1',
|
|
121
|
+
name: 'invoke_subagent',
|
|
122
|
+
status: 'in_progress',
|
|
123
|
+
});
|
|
124
|
+
mapper.mapUpdate(anonymousChunk('done'));
|
|
125
|
+
mapper.closeMessage();
|
|
126
|
+
const content = mapper.turnMessage()?.content as { type: string }[];
|
|
127
|
+
expect(content.map((block) => block.type)).toEqual(['toolCall', 'text']);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
test('a new turn starts an empty aggregate', () => {
|
|
131
|
+
const mapper = new AcpFrameMapper();
|
|
132
|
+
mapper.mapUpdate(anonymousChunk('one'));
|
|
133
|
+
mapper.closeMessage();
|
|
134
|
+
mapper.reset();
|
|
135
|
+
expect(mapper.turnMessage()).toBeNull();
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test('closing an already-closed row emits nothing', () => {
|
|
139
|
+
const mapper = new AcpFrameMapper();
|
|
140
|
+
mapper.mapUpdate(anonymousChunk('one'));
|
|
141
|
+
expect(mapper.closeMessage()).toHaveLength(1);
|
|
142
|
+
expect(mapper.closeMessage()).toEqual([]);
|
|
143
|
+
});
|
|
144
|
+
});
|