@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
|
@@ -26,6 +26,7 @@ import { AcpTurns } from '@/server/lib/harness/acp/turn';
|
|
|
26
26
|
import { SessionListeners } from '@/server/lib/harness/acp/session-listeners';
|
|
27
27
|
import { RawNotificationSink } from '@/server/lib/harness/acp/raw-listeners';
|
|
28
28
|
import { PendingPermissions } from '@/server/lib/harness/acp/permissions';
|
|
29
|
+
import { AcpSubagents } from '@/server/lib/harness/acp/subagents';
|
|
29
30
|
import { acpConfigView } from '@/server/lib/harness/acp/session-config-view';
|
|
30
31
|
import { stampMessageModel } from '@/server/lib/harness/acp/session-config';
|
|
31
32
|
import type { AgentEvent } from '@/server/lib/omp/rpc/constants';
|
|
@@ -142,6 +143,7 @@ export function mountSession(options: { busyWaitMs?: number } = {}): MountedSess
|
|
|
142
143
|
abandonPrompt: () => proc.abandonPrompt(),
|
|
143
144
|
resetMapper: () => mapper.reset(),
|
|
144
145
|
closeMessage: () => mapper.closeMessage().map((event) => stampMessageModel(event, session.runModel)),
|
|
146
|
+
turnMessage: () => mapper.turnMessage(),
|
|
145
147
|
openCalls: () => mapper.openCalls(),
|
|
146
148
|
onTurnEnd: (info) => {
|
|
147
149
|
(session as unknown as { onTurnEnded: (info: { stopReason?: string; closedMessage: boolean }) => void })
|
|
@@ -171,6 +173,7 @@ export function mountSession(options: { busyWaitMs?: number } = {}): MountedSess
|
|
|
171
173
|
turns,
|
|
172
174
|
mapper,
|
|
173
175
|
permissions: new PendingPermissions(),
|
|
176
|
+
subagents: new AcpSubagents(),
|
|
174
177
|
// The config view is a constructor field; a prototype mount has none, and
|
|
175
178
|
// `set_model` writes through it.
|
|
176
179
|
config: acpConfigView(
|
|
@@ -226,11 +229,13 @@ export function mountSession(options: { busyWaitMs?: number } = {}): MountedSess
|
|
|
226
229
|
};
|
|
227
230
|
}
|
|
228
231
|
|
|
229
|
-
/** Push one `session/update` at the session, as the process would.
|
|
230
|
-
|
|
232
|
+
/** Push one `session/update` at the session, as the process would. `sessionId`
|
|
233
|
+
* is the ADDRESS the frame carried; omitting it models an adapter that does not
|
|
234
|
+
* tag its frames. */
|
|
235
|
+
export function notify(session: AcpSession, update: Record<string, unknown>, sessionId?: string): void {
|
|
231
236
|
(session as unknown as { onNotification: (method: string, params: unknown) => void }).onNotification.call(
|
|
232
237
|
session,
|
|
233
238
|
'session/update',
|
|
234
|
-
{ update },
|
|
239
|
+
sessionId ? { sessionId, update } : { update },
|
|
235
240
|
);
|
|
236
241
|
}
|
|
@@ -5,15 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* One live ACP session: the bridge between `AcpProcess` + `AcpFrameMapper` and
|
|
8
|
-
* the `HarnessSession` contract every route
|
|
8
|
+
* the `HarnessSession` contract every route speaks. It owns STATE only — the
|
|
9
|
+
* id, selectors, model, run flags and approval queue. Every RULE lives beside
|
|
10
|
+
* it, one module per concern (`session-handshake`, `session-intake`, `turn`,
|
|
11
|
+
* `session-stop`, `session-lifecycle`, `session-inbound`, `session-web-state`).
|
|
9
12
|
*
|
|
10
|
-
*
|
|
11
|
-
* the commands and the approval queue. The RULES live beside it, one module per
|
|
12
|
-
* concern: `session-handshake.ts` (setup), `session-intake.ts` (what a prompt
|
|
13
|
-
* sends), `turn.ts` (the turn), `session-config.ts`, `session-permissions.ts`,
|
|
14
|
-
* `session-lifecycle.ts` and `session-web-state.ts`.
|
|
15
|
-
*
|
|
16
|
-
* `send()` takes the SAME command vocabulary the routes already send omp, so
|
|
13
|
+
* `send()` takes the SAME command vocabulary the routes send omp, so
|
|
17
14
|
* `routes/agent/command.ts` needs no second dispatch table.
|
|
18
15
|
*/
|
|
19
16
|
|
|
@@ -33,25 +30,26 @@ import type {
|
|
|
33
30
|
AcpSessionModels,
|
|
34
31
|
} from '@/server/lib/harness/acp/protocol';
|
|
35
32
|
import { promptContent, startAcpPrompt } from '@/server/lib/harness/acp/session-intake';
|
|
36
|
-
import {
|
|
33
|
+
import { cancelAcpTurn, dropAcpSession, endAcpSessionTurn } from '@/server/lib/harness/acp/session-stop';
|
|
37
34
|
import { setAcpConfig, setAcpMode, type AcpConfigWriter } from '@/server/lib/harness/acp/session-config';
|
|
38
35
|
import { acpConfigView, type AcpConfigProcess } from '@/server/lib/harness/acp/session-config-view';
|
|
39
36
|
import * as verbs from '@/server/lib/harness/acp/verbs';
|
|
40
37
|
import { acpPendingDialogs, answerAcpDialog } from '@/server/lib/harness/acp/session-approvals';
|
|
41
|
-
import { beginAcpTurn
|
|
38
|
+
import { beginAcpTurn } from '@/server/lib/harness/acp/session-turns';
|
|
42
39
|
import { capabilitiesFrom } from '@/server/lib/harness/launch';
|
|
43
40
|
import { PendingPermissions } from '@/server/lib/harness/acp/permissions';
|
|
44
|
-
import { cancelAllAcpPermissions } from '@/server/lib/harness/acp/session-permissions';
|
|
45
41
|
import { handleAcpNotification } from '@/server/lib/harness/acp/session-notify';
|
|
46
42
|
import { RawNotificationSink, type RawNotificationListener } from '@/server/lib/harness/acp/raw-listeners';
|
|
47
43
|
import { AcpUsageMeter, type AcpContextUsage } from '@/server/lib/harness/acp/session-usage';
|
|
48
44
|
import { handleAcpClientRequest, type AcpClientRequestAnswer } from '@/server/lib/harness/acp/session-requests';
|
|
49
45
|
import { reportAcpExit, type AcpExitInfo } from '@/server/lib/harness/acp/session-exit';
|
|
50
|
-
import { acpExited, destroyAcp } from '@/server/lib/harness/acp/session-lifecycle';
|
|
46
|
+
import { acpExited, closeAcpSession, destroyAcp } from '@/server/lib/harness/acp/session-lifecycle';
|
|
51
47
|
import { SessionListeners } from '@/server/lib/harness/acp/session-listeners';
|
|
52
48
|
import type { AcpBackgroundProbe } from '@/server/lib/harness/acp/background-work';
|
|
53
49
|
import { acpWebState } from '@/server/lib/harness/acp/session-web-state';
|
|
54
50
|
import { acpIdleReaper } from '@/server/lib/harness/acp/session-idle';
|
|
51
|
+
import { AcpSubagents, type AcpSubagentRecord } from '@/server/lib/harness/acp/subagents';
|
|
52
|
+
import { AcpInbound } from '@/server/lib/harness/acp/session-inbound';
|
|
55
53
|
import { DEFAULT_APPROVAL_MODE, isApprovalMode, type ApprovalMode } from '@/shared/lib/omp/config/access-mode';
|
|
56
54
|
import { dispatchCommand, type AcpCommandHost } from '@/server/lib/harness/acp/commands';
|
|
57
55
|
import { markStreamStatus } from '@/shared/lib/omp/session/stream-state.server';
|
|
@@ -112,6 +110,8 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
|
|
|
112
110
|
models: AcpSessionModels | null = null;
|
|
113
111
|
/** Whether the agent advertised `promptCapabilities.image`. */
|
|
114
112
|
acceptsImages = false;
|
|
113
|
+
/** Set only when the agent explicitly refused embedded context. */
|
|
114
|
+
acceptsEmbeddedContext: boolean | undefined = undefined;
|
|
115
115
|
/** MCP servers every session request carries; empty when none are configured. */
|
|
116
116
|
readonly mcpServers: AcpMcpServer[];
|
|
117
117
|
private readonly proc: AcpProcess;
|
|
@@ -125,6 +125,19 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
|
|
|
125
125
|
* `session-notify.ts` can feed it before the mapper folds a frame. */
|
|
126
126
|
readonly rawSink = new RawNotificationSink();
|
|
127
127
|
readonly permissions = new PendingPermissions();
|
|
128
|
+
/** Child sessions this parent announced (the subagents RFD). */
|
|
129
|
+
readonly subagents = new AcpSubagents();
|
|
130
|
+
/** Admission, addressing and child cards — see `session-inbound.ts`.
|
|
131
|
+
* Lazy: a test mounts this class on its prototype, where a field initializer
|
|
132
|
+
* never runs, and `onNotification` must still work there. */
|
|
133
|
+
private inboundState: AcpInbound | null = null;
|
|
134
|
+
private get inbound(): AcpInbound {
|
|
135
|
+
return this.inboundState ??= new AcpInbound({
|
|
136
|
+
subagents: this.subagents,
|
|
137
|
+
emit: (event) => this.emit(event),
|
|
138
|
+
replaying: () => this.replay.isActive,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
128
141
|
private destroyHook: (() => void) | null = null;
|
|
129
142
|
destroyed = false;
|
|
130
143
|
/** True only for a restore: replay frames are accepted and collected. */
|
|
@@ -162,47 +175,48 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
|
|
|
162
175
|
private readonly requested: AcpHandshakeSelections;
|
|
163
176
|
/** `initialize` + `session/new|load|resume`, then the requested selections. */
|
|
164
177
|
async start(sessionIdToLoad?: string, forkFromSessionId?: string, forkMeta?: Record<string, unknown>): Promise<{ sessionId: string }> {
|
|
165
|
-
|
|
178
|
+
// Frames that arrive BEFORE the setup answer is applied cannot be routed:
|
|
179
|
+
// the session id they belong to is not known yet. They are held, not
|
|
180
|
+
// dropped, and replayed in arrival order once it is.
|
|
181
|
+
return this.inbound.run(
|
|
182
|
+
() => startAcpSession(this, this.proc, this.mapper, this.replay, this.wantsReplay, this.requested, sessionIdToLoad, forkFromSessionId, forkMeta),
|
|
183
|
+
(method, params) => handleAcpNotification(this, method, params),
|
|
184
|
+
);
|
|
166
185
|
}
|
|
167
186
|
|
|
168
187
|
get protocol(): AcpProtocolVersion { return this.proc.protocolVersion === 2 ? 2 : 1; }
|
|
169
188
|
/** The OS pid of the agent child, for the Stats panel's lease. */
|
|
170
189
|
get pid(): number | undefined { return this.proc.pid; }
|
|
190
|
+
get process(): AcpProcess { return this.proc; }
|
|
171
191
|
/** Set by the handshake as soon as `initialize` answers. */
|
|
172
192
|
onProtocol(version: AcpProtocolVersion): void { this.turns.completion = version === 2 ? 'state' : 'response'; }
|
|
173
193
|
isAlive(): boolean { return !this.destroyed && this.proc.isAlive; }
|
|
174
194
|
get isStreaming(): boolean { return this.turns.isStreaming; }
|
|
175
195
|
get isPromptRunning(): boolean { return this.turns.isPromptRunning; }
|
|
176
196
|
isRunning(): boolean { return this.isAlive() && (this.turns.isPromptRunning || this.turns.isStreaming); }
|
|
177
|
-
|
|
197
|
+
/** A child outlives its turn: reclaiming the parent under it kills work. */
|
|
198
|
+
isBusy(): boolean { return this.isRunning() || this.permissions.size() > 0 || this.subagents.anyRunning(); }
|
|
178
199
|
onEvent(listener: (event: AgentEvent) => void): () => void { return this.events.add(listener); }
|
|
179
|
-
/**
|
|
200
|
+
/** Raw `session/update` payloads, before the mapper folds them. */
|
|
180
201
|
onRawNotification(listener: RawNotificationListener): () => void { return this.rawSink.add(listener); }
|
|
181
202
|
emit(event: AgentEvent): void { this.replay.push(event); this.events.emit(event); }
|
|
182
203
|
/** Run the single destroy callback the registry installed. */
|
|
183
204
|
runDestroyHook(): void { this.destroyHook?.(); }
|
|
184
205
|
|
|
185
|
-
/**
|
|
186
|
-
*
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
206
|
+
/** Teardown seams: methods, not fields, because a test mounts this class on
|
|
207
|
+
* its prototype and a field initializer never runs there. */
|
|
208
|
+
disposeProcess(): Promise<void> { return this.proc.dispose(); }
|
|
209
|
+
closeAgentSession(): Promise<void> { return closeAcpSession(this); }
|
|
210
|
+
reportExit(info: AcpExitInfo): Promise<void> { return reportAcpExit(this, info); }
|
|
191
211
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
/** The dispatcher's command surface — see `commands.ts` for the rules. */
|
|
197
|
-
dispatch(command: Record<string, unknown>): Promise<unknown> {
|
|
198
|
-
// A command is the clearest sign the session is still wanted.
|
|
212
|
+
/** The dispatcher's command surface — see `commands.ts`. A command is also
|
|
213
|
+
* the clearest sign the session is still wanted. */
|
|
214
|
+
send(command: Record<string, unknown>): Promise<unknown> {
|
|
199
215
|
this.idle.reset();
|
|
200
216
|
return dispatchCommand(this, command);
|
|
201
217
|
}
|
|
202
218
|
|
|
203
|
-
getPendingUiDialogs(): Record<string, unknown>[] {
|
|
204
|
-
return acpPendingDialogs(this.permissions);
|
|
205
|
-
}
|
|
219
|
+
getPendingUiDialogs(): Record<string, unknown>[] { return acpPendingDialogs(this.permissions); }
|
|
206
220
|
|
|
207
221
|
resolvePendingUiDialog(id: string): void {
|
|
208
222
|
// A dialog the client dismissed is a REFUSAL, not a no-answer.
|
|
@@ -213,22 +227,15 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
|
|
|
213
227
|
this.destroyHook = callback;
|
|
214
228
|
}
|
|
215
229
|
|
|
216
|
-
send(command: Record<string, unknown>): Promise<unknown> {
|
|
217
|
-
return this.dispatch(command);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
230
|
/** Dispatcher seam: one steering send. */
|
|
221
231
|
steer(blocks: unknown[], queue: 'steering' | 'followUp'): Promise<unknown> {
|
|
222
232
|
return this.proc.steer(this.sessionId, blocks, queue);
|
|
223
233
|
}
|
|
224
234
|
|
|
225
235
|
/** The blocks one prompt sends (text, images, `@path` links). */
|
|
226
|
-
blocksFor(message: string, images: unknown): Promise<unknown[]> {
|
|
227
|
-
return promptContent(this, message, images);
|
|
228
|
-
}
|
|
236
|
+
blocksFor(message: string, images: unknown): Promise<unknown[]> { return promptContent(this, message, images); }
|
|
229
237
|
|
|
230
|
-
/**
|
|
231
|
-
* it is dispatched as the next turn instead of refused or lost. */
|
|
238
|
+
/** Hold an input the agent has no mid-turn channel for. */
|
|
232
239
|
queueTurnInput(message: string, images: unknown): void {
|
|
233
240
|
this.turns.queue(message, images);
|
|
234
241
|
}
|
|
@@ -236,47 +243,25 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
|
|
|
236
243
|
/** Record a mid-turn user message; the mapper drops live user frames. */
|
|
237
244
|
recordUserTurn(message: string, images: unknown): void { this.emit({ type: 'user_turn', message, images }); }
|
|
238
245
|
|
|
239
|
-
/** The durable run marker
|
|
240
|
-
* field so a unit test can stub it. */
|
|
246
|
+
/** The durable run marker a reattaching tab reads; a field so a test stubs it. */
|
|
241
247
|
markStream: (status: 'stream' | 'finish' | 'abort', failure?: string | null) => void = (status, failure) => {
|
|
242
248
|
if (!this.sessionId) return;
|
|
243
249
|
void markStreamStatus(this.sessionId, status, status === 'stream' ? this.runModel : undefined, failure).catch(() => {});
|
|
244
250
|
};
|
|
245
251
|
|
|
246
|
-
/** Turn-end bookkeeping the panels read — see `
|
|
247
|
-
|
|
248
|
-
onTurnEnded(info: AcpTurnEndInfo): Promise<void> {
|
|
249
|
-
const reported = endAcpTurn(this, info);
|
|
250
|
-
// A held input is the NEXT turn: the queue lives in the turn machine, and a
|
|
251
|
-
// session that never drains it loses the message silently.
|
|
252
|
-
const next = this.turns.takeQueued();
|
|
253
|
-
if (next) {
|
|
254
|
-
try {
|
|
255
|
-
this.startTurn(next.message, next.images);
|
|
256
|
-
} catch {
|
|
257
|
-
// A turn that reopened first (a background interval) wins; the input is
|
|
258
|
-
// dropped rather than re-queued behind an indefinite run.
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
return reported;
|
|
262
|
-
}
|
|
252
|
+
/** Turn-end bookkeeping the panels read — see `session-stop.ts`. */
|
|
253
|
+
onTurnEnded(info: AcpTurnEndInfo): Promise<void> { return endAcpSessionTurn(this, info); }
|
|
263
254
|
|
|
264
|
-
/** Drop this session so the next command respawns it
|
|
265
|
-
|
|
266
|
-
dropLostSession(): void {
|
|
267
|
-
this.emit({ type: 'notice', level: 'warning', message: LOST_SESSION_NOTICE });
|
|
268
|
-
void this.destroyAndWait();
|
|
269
|
-
}
|
|
255
|
+
/** Drop this session so the next command respawns it — see `session-stop.ts`. */
|
|
256
|
+
dropLostSession(): void { dropAcpSession(this); }
|
|
270
257
|
|
|
271
|
-
/** Dispatcher seam: stop the turn and
|
|
258
|
+
/** Dispatcher seam: stop the turn and settle what it parked. */
|
|
272
259
|
cancelTurn(): void {
|
|
273
|
-
this
|
|
274
|
-
this.turns.cancel();
|
|
275
|
-
cancelAllAcpPermissions(this.permissions, this.proc);
|
|
260
|
+
cancelAcpTurn(this);
|
|
276
261
|
}
|
|
277
262
|
|
|
278
|
-
/**
|
|
279
|
-
*
|
|
263
|
+
/** Adopt the composer's access pick. ACP answers approvals in-process, so no
|
|
264
|
+
* respawn is needed — unlike omp's spawn-time flag. */
|
|
280
265
|
setAccessMode(mode: ApprovalMode): void {
|
|
281
266
|
this.accessMode = mode;
|
|
282
267
|
}
|
|
@@ -293,11 +278,13 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
|
|
|
293
278
|
|
|
294
279
|
/** Answer a pending approval — every exit answers the agent, or it hangs. */
|
|
295
280
|
resolvePermission(dialogId: string, confirmed: boolean, optionId?: string): unknown {
|
|
296
|
-
answerAcpDialog(this.permissions, this.proc, dialogId, confirmed, optionId);
|
|
281
|
+
answerAcpDialog(this.permissions, this.proc, dialogId, confirmed, optionId, this.sessionId);
|
|
297
282
|
return null;
|
|
298
283
|
}
|
|
299
284
|
|
|
300
|
-
webState(): Record<string, unknown> {
|
|
285
|
+
webState(): Record<string, unknown> {
|
|
286
|
+
return { ...acpWebState(this), protocolVersion: this.protocol, subagents: this.subagents.list() };
|
|
287
|
+
}
|
|
301
288
|
|
|
302
289
|
/** Run one turn — see `session-intake.ts` for the refusal and the ACK. */
|
|
303
290
|
startTurn(message: string, images: unknown): unknown {
|
|
@@ -309,9 +296,12 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
|
|
|
309
296
|
return beginAcpTurn(this, this.turns, message, images);
|
|
310
297
|
}
|
|
311
298
|
|
|
312
|
-
/** One agent notification, routed — see `session-notify.ts`.
|
|
299
|
+
/** One agent notification, routed — see `session-notify.ts`.
|
|
300
|
+
*
|
|
301
|
+
* Held while the handshake is open: the address gate needs the session id,
|
|
302
|
+
* and a setup-time frame dropped there is output the user never sees. */
|
|
313
303
|
private onNotification(method: string, params: Record<string, unknown>): void {
|
|
314
|
-
handleAcpNotification(this,
|
|
304
|
+
this.inbound.admit(method, params, (nextMethod, nextParams) => handleAcpNotification(this, nextMethod, nextParams));
|
|
315
305
|
}
|
|
316
306
|
|
|
317
307
|
absorbUsage(update: Record<string, unknown>): void { this.usage.absorb(update); }
|
|
@@ -320,6 +310,16 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
|
|
|
320
310
|
mapUpdate(update: Record<string, unknown>): AgentEvent[] { return this.mapper.mapUpdate(update); }
|
|
321
311
|
onStateUpdate(update: Record<string, unknown>): void { this.turns.onStateUpdate(update); this.replay.markIdle(update.state); }
|
|
322
312
|
respond(id: AcpId, result: unknown): void { this.proc.respond(id, result); }
|
|
313
|
+
/** Emit the card frames for one child record. */
|
|
314
|
+
subagentFrame(record: AcpSubagentRecord): void {
|
|
315
|
+
this.inbound.emitSubagent(record);
|
|
316
|
+
}
|
|
317
|
+
/** v2's explicit end-of-replay marker. */
|
|
318
|
+
onReplayComplete(): void { this.replay.markSettled(); }
|
|
319
|
+
/** Close every child card when the parent goes away. */
|
|
320
|
+
finishSubagents(): void {
|
|
321
|
+
this.inbound.closeSubagents();
|
|
322
|
+
}
|
|
323
323
|
/** Agent→client requests: every branch answers or refuses. */
|
|
324
324
|
private onClientRequest(id: AcpId, method: string, params: Record<string, unknown>): Promise<AcpClientRequestAnswer> {
|
|
325
325
|
this.idle.reset();
|
|
@@ -36,6 +36,9 @@ export interface AgentStdioHandlers {
|
|
|
36
36
|
onStderr?: (line: string) => void;
|
|
37
37
|
/** The child is gone. Fires once, after `exited`. */
|
|
38
38
|
onExit: (info: { code: number | null; stderrTail: string }) => void;
|
|
39
|
+
/** The pipe closed. A transport whose stdout ended can answer nothing more,
|
|
40
|
+
* even while the process is still alive. */
|
|
41
|
+
onStdoutClosed?: () => void;
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
export class AgentStdio {
|
|
@@ -69,7 +72,11 @@ export class AgentStdio {
|
|
|
69
72
|
);
|
|
70
73
|
}
|
|
71
74
|
|
|
72
|
-
void readLines(this.child.stdout, (line) => handlers.onLine(line))
|
|
75
|
+
void readLines(this.child.stdout, (line) => handlers.onLine(line)).then(() => {
|
|
76
|
+
// EOF without an exit: a child that closed stdout answers nothing more,
|
|
77
|
+
// and every pending call would otherwise wait out its own timeout.
|
|
78
|
+
handlers.onStdoutClosed?.();
|
|
79
|
+
});
|
|
73
80
|
void readLines(this.child.stderr, (line) => {
|
|
74
81
|
this.#tail = `${this.#tail}${line}\n`.slice(-STDERR_TAIL_LIMIT);
|
|
75
82
|
handlers.onStderr?.(line);
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The frames one subagent record becomes.
|
|
8
|
+
*
|
|
9
|
+
* These are the rules the timeline depends on: a child's FIRST frame opens a
|
|
10
|
+
* row, later ones patch it, and a finished child CLOSES the card — an open
|
|
11
|
+
* `task` card spins forever and nothing else will ever end it.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { describe, expect, test } from 'bun:test';
|
|
15
|
+
import { AcpSubagents, subagentCardStatus } from '@/server/lib/harness/acp/subagents';
|
|
16
|
+
import { subagentFrames, subagentRowId, subagentToolCallId } from '@/server/lib/harness/acp/subagent-frames';
|
|
17
|
+
|
|
18
|
+
function recordOf(fields: Record<string, unknown>) {
|
|
19
|
+
const subagents = new AcpSubagents();
|
|
20
|
+
subagents.apply({ sessionId: 'child-1', title: 'Investigator', ...fields });
|
|
21
|
+
return subagents.get('child-1')!;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
describe('ACP subagent card frames', () => {
|
|
25
|
+
test('the first frame opens a row and starts a task card', () => {
|
|
26
|
+
const record = recordOf({ state: { state: 'running' } });
|
|
27
|
+
const frames = subagentFrames(record, null);
|
|
28
|
+
expect(frames.map((frame) => frame.type)).toEqual([
|
|
29
|
+
'message_start',
|
|
30
|
+
'tool_execution_start',
|
|
31
|
+
'tool_execution_update',
|
|
32
|
+
]);
|
|
33
|
+
expect(frames[0]?.message).toMatchObject({
|
|
34
|
+
role: 'assistant',
|
|
35
|
+
id: subagentRowId('child-1'),
|
|
36
|
+
content: [{ type: 'toolCall', id: subagentToolCallId('child-1'), name: 'task', toolType: 'task' }],
|
|
37
|
+
});
|
|
38
|
+
expect(frames[1]).toMatchObject({
|
|
39
|
+
toolCallId: subagentToolCallId('child-1'),
|
|
40
|
+
toolName: 'task',
|
|
41
|
+
intent: 'Investigator',
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test('a later update patches the row instead of opening another', () => {
|
|
46
|
+
const record = recordOf({ state: { state: 'running' } });
|
|
47
|
+
const frames = subagentFrames(record, subagentCardStatus(record));
|
|
48
|
+
expect(frames.map((frame) => frame.type)).toEqual(['message_update', 'tool_execution_update']);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('a finished child closes its card and carries its state as the body', () => {
|
|
52
|
+
const subagents = new AcpSubagents();
|
|
53
|
+
subagents.apply({ sessionId: 'child-1', title: 'Investigator', description: 'Checks the build' });
|
|
54
|
+
subagents.absorb('child-1', { sessionUpdate: 'agent_message_chunk', content: { type: 'text', text: 'All green' } });
|
|
55
|
+
subagents.absorb('child-1', { sessionUpdate: 'state_update', state: 'idle', stopReason: 'end_turn' });
|
|
56
|
+
const record = subagents.get('child-1')!;
|
|
57
|
+
const frames = subagentFrames(record, 'running');
|
|
58
|
+
|
|
59
|
+
expect(frames.map((frame) => frame.type)).toEqual([
|
|
60
|
+
'message_update',
|
|
61
|
+
'tool_execution_end',
|
|
62
|
+
'message_end',
|
|
63
|
+
]);
|
|
64
|
+
const end = frames[1]!;
|
|
65
|
+
expect(end.isError).toBe(false);
|
|
66
|
+
expect(String(end.output)).toContain('All green');
|
|
67
|
+
expect(String(end.output)).toContain('State: idle (end_turn)');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('a failed child is an error card, not a success with a note', () => {
|
|
71
|
+
const subagents = new AcpSubagents();
|
|
72
|
+
subagents.apply({ sessionId: 'child-1' });
|
|
73
|
+
subagents.absorb('child-1', {
|
|
74
|
+
sessionUpdate: 'state_update',
|
|
75
|
+
state: 'idle',
|
|
76
|
+
stopReason: 'error',
|
|
77
|
+
error: { message: 'provider refused' },
|
|
78
|
+
});
|
|
79
|
+
const frames = subagentFrames(subagents.get('child-1')!, 'running');
|
|
80
|
+
expect(frames.find((frame) => frame.type === 'tool_execution_end')?.isError).toBe(true);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* One subagent record as the timeline frames Kabmo already renders.
|
|
8
|
+
*
|
|
9
|
+
* The card is a `task` tool call inside its own assistant row, not a new
|
|
10
|
+
* renderer: the transcript recorder, the fold and the reload path all already
|
|
11
|
+
* understand `message_*` + `tool_execution_*`, so a child survives a reload and
|
|
12
|
+
* needs no client change. The row id is derived from the CHILD's session id, so
|
|
13
|
+
* every update patches one card instead of appending a new one.
|
|
14
|
+
*
|
|
15
|
+
* The frame set is emitted from a session-level object rather than through
|
|
16
|
+
* `AcpFrameMapper`: a child outlives the parent turn (that is the RFD's whole
|
|
17
|
+
* point), and the mapper's blocks are reset per turn. Closing the card here is
|
|
18
|
+
* what stops it spinning once the child reports `idle`.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { subagentCardStatus, type AcpSubagentRecord, type SubagentCardStatus } from '@/server/lib/harness/acp/subagents';
|
|
22
|
+
import type { AgentEvent } from '@/server/lib/omp/rpc/constants';
|
|
23
|
+
|
|
24
|
+
export function subagentRowId(sessionId: string): string {
|
|
25
|
+
return `subagent-${sessionId}`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function subagentToolCallId(sessionId: string): string {
|
|
29
|
+
return `subagent:${sessionId}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** The label the card's header and its task row both read. */
|
|
33
|
+
export function subagentLabel(record: AcpSubagentRecord): string {
|
|
34
|
+
return record.title ?? record.description ?? 'Subagent';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function outputText(record: AcpSubagentRecord): string {
|
|
38
|
+
const stateLine = record.stopReason
|
|
39
|
+
? `State: ${record.state} (${record.stopReason})`
|
|
40
|
+
: `State: ${record.state}`;
|
|
41
|
+
return [record.description, record.activity, stateLine, record.error ? `Error: ${record.error}` : '']
|
|
42
|
+
.filter((part): part is string => typeof part === 'string' && part.length > 0)
|
|
43
|
+
.join('\n\n')
|
|
44
|
+
.slice(0, 8_000);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function cardMessage(record: AcpSubagentRecord, completedAt?: number): Record<string, unknown> {
|
|
48
|
+
const label = subagentLabel(record);
|
|
49
|
+
return {
|
|
50
|
+
role: 'assistant',
|
|
51
|
+
id: subagentRowId(record.sessionId),
|
|
52
|
+
timestamp: record.announcedAt,
|
|
53
|
+
content: [{
|
|
54
|
+
type: 'toolCall',
|
|
55
|
+
id: subagentToolCallId(record.sessionId),
|
|
56
|
+
name: 'task',
|
|
57
|
+
toolType: 'task',
|
|
58
|
+
arguments: {
|
|
59
|
+
description: label,
|
|
60
|
+
...(record.description ? { prompt: record.description } : {}),
|
|
61
|
+
...(record.title ? { subagent_type: record.title } : {}),
|
|
62
|
+
},
|
|
63
|
+
}],
|
|
64
|
+
...(completedAt !== undefined
|
|
65
|
+
? { completedAt, duration: Math.max(0, completedAt - record.announcedAt) }
|
|
66
|
+
: {}),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Frames for one update. `previous` is the status already shown, or null when
|
|
72
|
+
* this is the child's first card — the only state that decides whether the row
|
|
73
|
+
* is opened or patched.
|
|
74
|
+
*/
|
|
75
|
+
export function subagentFrames(record: AcpSubagentRecord, previous: SubagentCardStatus | null): AgentEvent[] {
|
|
76
|
+
const status = subagentCardStatus(record);
|
|
77
|
+
const toolCallId = subagentToolCallId(record.sessionId);
|
|
78
|
+
const label = subagentLabel(record);
|
|
79
|
+
const output = outputText(record);
|
|
80
|
+
const message = cardMessage(record);
|
|
81
|
+
const args = {
|
|
82
|
+
description: label,
|
|
83
|
+
...(record.description ? { prompt: record.description } : {}),
|
|
84
|
+
...(record.title ? { subagent_type: record.title } : {}),
|
|
85
|
+
};
|
|
86
|
+
const frames: AgentEvent[] = [];
|
|
87
|
+
|
|
88
|
+
if (previous === null) {
|
|
89
|
+
frames.push({ type: 'message_start', message });
|
|
90
|
+
frames.push({
|
|
91
|
+
type: 'tool_execution_start',
|
|
92
|
+
toolCallId,
|
|
93
|
+
toolName: 'task',
|
|
94
|
+
toolType: 'task',
|
|
95
|
+
intent: label,
|
|
96
|
+
args,
|
|
97
|
+
});
|
|
98
|
+
} else {
|
|
99
|
+
frames.push({ type: 'message_update', message });
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (status === 'running') {
|
|
103
|
+
frames.push({
|
|
104
|
+
type: 'tool_execution_update',
|
|
105
|
+
toolCallId,
|
|
106
|
+
toolName: 'task',
|
|
107
|
+
partialResult: { output },
|
|
108
|
+
output,
|
|
109
|
+
});
|
|
110
|
+
return frames;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const completedAt = Date.now();
|
|
114
|
+
frames.push({
|
|
115
|
+
type: 'tool_execution_end',
|
|
116
|
+
toolCallId,
|
|
117
|
+
toolName: 'task',
|
|
118
|
+
result: { output },
|
|
119
|
+
isError: status === 'failed',
|
|
120
|
+
output,
|
|
121
|
+
});
|
|
122
|
+
frames.push({ type: 'message_end', message: cardMessage(record, completedAt) });
|
|
123
|
+
return frames;
|
|
124
|
+
}
|