@kabmo-labs/kabmo 0.47.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 +535 -521
- package/dist/client/static/js/Body-9h5hd351.js +3 -0
- package/dist/client/static/js/{CsvGrid-vfgttmym.js → CsvGrid-s05k1q18.js} +2 -2
- package/dist/client/static/js/{DocxView-dc41t6rp.js → DocxView-x6sjw5ht.js} +22 -22
- package/dist/client/static/js/{DrawioView-wpwr38d9.js → DrawioView-jashn8sf.js} +2 -2
- package/dist/client/static/js/{HtmlPreview-23n7t5cs.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-n6mst0hq.js → SheetView-26r0e506.js} +45 -45
- package/dist/client/static/js/{SvgPreview-g2aqq812.js → SvgPreview-2fk85jzz.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-3vac8sq4.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-63zcysj7.js → astro-rn2bvwpm.js} +1 -1
- package/dist/client/static/js/bash-36shcpcw.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-62z6kaar.js → blockDiagram-BEXU5L5S-vpcmd3vx.js} +9 -9
- package/dist/client/static/js/c-kxeqssf9.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-rts5zgx4.js → c4Diagram-YGBWAQC7-1rgpdnbq.js} +4 -4
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-tnpww186.js → classDiagram-v2-NBCMYWYE-fbsejvb9.js} +9 -9
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-8vsjbzwa.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-005gc8km.js → cynefinDiagram-VND7K2PF-7ta5vbrw.js} +1 -1
- package/dist/client/static/js/dagre-6A5THRUB-b8gtt32x.js +4 -0
- package/dist/client/static/js/{diagram-22UHCM2B-prsm18a1.js → diagram-22UHCM2B-7emepy7h.js} +28 -28
- package/dist/client/static/js/{diagram-3UASUU5V-5nx9wf04.js → diagram-3UASUU5V-06nptkzc.js} +2 -2
- package/dist/client/static/js/{diagram-ATOU4E4O-k3d4z3aq.js → diagram-ATOU4E4O-t113exk3.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-x2c5x5j2.js → diagram-CDSNMT55-pyj3x97y.js} +4 -4
- package/dist/client/static/js/{diagram-MLGK6HIB-nvr76jqh.js → diagram-MLGK6HIB-183sgpjh.js} +2 -2
- package/dist/client/static/js/{diagram-MPIPVDR6-v1jpzp9p.js → diagram-MPIPVDR6-fmbj4hcx.js} +2 -2
- package/dist/client/static/js/{dockerfile-vz6va73h.js → dockerfile-qay672za.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-0v4tqr9v.js → ebnfDiagram-ZINNZB2B-eafvfws2.js} +1 -1
- package/dist/client/static/js/{elixir-80wq7gak.js → elixir-t8bep87c.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-qfn4r7xj.js → elk-276RUBZZ-573f1vfs.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-cd667n9f.js → erDiagram-OPXOYQCR-4z1r88ej.js} +14 -14
- package/dist/client/static/js/{erlang-vk66vt7q.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-ps0h3drm.js → ganttDiagram-FUAMR5RP-49jd7msz.js} +5 -5
- package/dist/client/static/js/gitGraph-4MIJSDKK-3rtkds4s.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-fts23jer.js → gitGraphDiagram-X574FWY7-5p9mgq7n.js} +26 -26
- 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-fxd8dfj4.js → index-0857zpr0.js} +2 -2
- package/dist/client/static/js/{index-9ab6xaxd.js → index-0w4jqzqk.js} +2 -2
- package/dist/client/static/js/index-14dgbjsm.js +2 -0
- package/dist/client/static/js/{index-q4ke39rh.js → index-1p880x6e.js} +2 -2
- package/dist/client/static/js/{index-e5j5gc4h.js → index-1yq96wpa.js} +2 -2
- package/dist/client/static/js/{index-x0xspam4.js → index-2bf0txsp.js} +2 -2
- package/dist/client/static/js/index-2jgx68m0.js +1 -0
- package/dist/client/static/js/{index-evmcc5qh.js → index-2yzt8h3d.js} +2 -2
- package/dist/client/static/js/{index-ccgzzydx.js → index-333rq9yy.js} +1 -1
- package/dist/client/static/js/{index-9xsf8162.js → index-38g2eevc.js} +80 -80
- package/dist/client/static/js/{index-dxkefysk.js → index-3v8k8ms3.js} +1 -1
- package/dist/client/static/js/index-473hk8nb.js +10 -0
- package/dist/client/static/js/{index-5f4b44ay.js → index-4ccs971z.js} +2 -2
- package/dist/client/static/js/{index-fjex1y0t.js → index-4dnc1kys.js} +2 -2
- package/dist/client/static/js/{index-4jzsr1ky.js → index-4z5ram7g.js} +2 -2
- package/dist/client/static/js/{index-dzeyd153.js → index-5dn4159w.js} +2 -2
- package/dist/client/static/js/{index-54mkp2r2.js → index-5p8dwr4y.js} +1 -1
- package/dist/client/static/js/{index-1c2jvnyh.js → index-5ztdqm1w.js} +2 -2
- package/dist/client/static/js/{index-cra9mgkq.js → index-7dqq7cjp.js} +13 -13
- package/dist/client/static/js/{index-64p1dncg.js → index-7ff9scbm.js} +2 -2
- package/dist/client/static/js/{index-z0fkfphe.js → index-7rmps91t.js} +2 -2
- package/dist/client/static/js/{index-0dkc6z8e.js → index-80fjn77c.js} +2 -2
- package/dist/client/static/js/{index-cvyqp8nz.css → index-9wc36am3.css} +1 -1
- package/dist/client/static/js/{index-y6ke70e6.js → index-a4636gt1.js} +2 -2
- package/dist/client/static/js/{index-c63qyysm.js → index-bmaktvm2.js} +1 -1
- package/dist/client/static/js/index-bvpzzhn2.js +4 -0
- package/dist/client/static/js/{index-56rtb871.js → index-c3whkrwa.js} +58 -58
- package/dist/client/static/js/{index-7zeah164.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-g4kkapka.js → index-e8mt8rag.js} +2 -2
- package/dist/client/static/js/index-epzvftkq.js +1 -0
- package/dist/client/static/js/{index-an2wv33f.js → index-fbg5vhhw.js} +2 -2
- package/dist/client/static/js/{index-nkahe229.js → index-gaqjrzdb.js} +2 -2
- package/dist/client/static/js/index-gg910gpv.js +2 -0
- package/dist/client/static/js/{index-n1yr4khe.js → index-gr8sqjpz.js} +1 -1
- package/dist/client/static/js/{index-7zedprz3.js → index-gz7kvpnm.js} +1 -1
- package/dist/client/static/js/{index-70g527sb.js → index-h8hjcdj1.js} +2 -2
- package/dist/client/static/js/{index-4wnzs76g.js → index-j37m7pn9.js} +2 -2
- package/dist/client/static/js/{index-39d8zbkx.js → index-mbtenbyc.js} +6 -6
- package/dist/client/static/js/{index-tqgj7rd9.js → index-nbm5r9g1.js} +2 -2
- package/dist/client/static/js/{index-52nd4hgm.js → index-nzvte8s5.js} +2 -2
- package/dist/client/static/js/index-pv4z2mp2.js +463 -0
- package/dist/client/static/js/{index-c5hjht5e.js → index-pygy21w5.js} +2 -2
- package/dist/client/static/js/{index-sa1675y0.js → index-qs4n116g.js} +2 -2
- package/dist/client/static/js/{index-6d6hxwb5.js → index-qwxawph7.js} +2 -2
- package/dist/client/static/js/index-rz0tz4hg.js +1 -0
- package/dist/client/static/js/{index-gzkzwgzv.js → index-s5vegk6q.js} +2 -2
- package/dist/client/static/js/{index-xk1cqjkn.js → index-t522tpxt.js} +3 -3
- package/dist/client/static/js/{index-a4h5np9r.js → index-taev57jw.js} +2 -2
- package/dist/client/static/js/{index-dyc886cc.js → index-tb35a328.js} +2 -2
- package/dist/client/static/js/{index-396r53n0.js → index-tc6k8qt7.js} +2 -2
- package/dist/client/static/js/{index-62jgcgfd.js → index-tcfpzqb9.js} +36 -36
- package/dist/client/static/js/{index-z4530r3c.js → index-wbsvg1d9.js} +2 -2
- package/dist/client/static/js/index-xw1bptp5.js +2 -0
- package/dist/client/static/js/{index-33qxg79j.js → index-yg083mk0.js} +6 -6
- package/dist/client/static/js/{index-f2ahkev0.js → index-ykc14gez.js} +5 -5
- package/dist/client/static/js/index-yr3exz70.js +2 -0
- package/dist/client/static/js/{index-1whzs9kb.js → index-yyjw1ty9.js} +2 -2
- package/dist/client/static/js/index-z6y8j93w.js +9 -0
- package/dist/client/static/js/index-zdw8bd5t.js +2 -0
- package/dist/client/static/js/index-zp40g8ah.js +12 -0
- package/dist/client/static/js/{index-zhjjpvcc.js → index-zyefab6q.js} +1 -1
- package/dist/client/static/js/info-A6RAGUB7-vr5mxm6f.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-88qbtpq5.js → infoDiagram-VRGFBTTK-xsar9j6v.js} +2 -2
- package/dist/client/static/js/ini-zx7x1jj1.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-s8bagk00.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-hz8z0b9x.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-dm0j9apa.js → julia-pe5vpc2m.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-sjjnjb51.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-zvwygxbh.js → mermaid.core-dzajkp0g.js} +8 -8
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-kgj8enan.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-gxzw1qwa.js → pegDiagram-GJSIUBJH-6erykm1c.js} +1 -1
- package/dist/client/static/js/{perl-4jcm2jxv.js → perl-cc2eqye8.js} +1 -1
- package/dist/client/static/js/{php-q32mec74.js → php-p9bvnpsv.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-ff8fpvc4.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-pdqwyqcm.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-yx2t364p.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-800fdzkr.js → railroadDiagram-XR7U4H2S-ewzhhth2.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-vc5rpgtm.js → requirementDiagram-PLB6GJNP-fcs3xd42.js} +8 -8
- package/dist/client/static/js/{ruby-npmpb290.js → ruby-65s2ca5d.js} +1 -1
- package/dist/client/static/js/{rust-waks43wh.js → rust-ec1j2hwy.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-ccjk8zgn.js → sankeyDiagram-IPEJSGJF-2r829rjf.js} +4 -4
- package/dist/client/static/js/{sass-502a4r7y.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-3mnte9tv.js +169 -0
- package/dist/client/static/js/{sizeCapture-INFHLROL-fma9p1vy.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-d8f24b7j.js → stateDiagram-v2-GCMORJYK-hm2f0wdb.js} +6 -6
- package/dist/client/static/js/{svelte-c15d0421.js → svelte-jz3a190v.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-sdt7qy36.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-rv8qyr8b.js → timeline-definition-EJHVYXUP-ezm1c4pz.js} +8 -8
- 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-w6ew1red.js → usecaseDiagram-POWQR4AR-ryvgs5ac.js} +48 -48
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-p9axw7ch.js → vennDiagram-UO4OBE2U-rd5prsf1.js} +6 -6
- package/dist/client/static/js/{vue-xpemy62d.js → vue-rv4pea8r.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-kd9swrdr.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-5ewc8s4p.js → wardleyDiagram-VNRHLVJA-1kt8q8a4.js} +4 -4
- package/dist/client/static/js/xml-3g4bdtpa.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-7n4gn7k6.js → xychartDiagram-PMCCYNJV-q39bbgq4.js} +4 -4
- 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/usage-settings/LimitsSection.tsx +10 -3
- package/src/client/components/settings/categories/usage-settings/ProviderDetail.tsx +27 -4
- package/src/client/components/settings/categories/usage-settings/TokenHarborCard.tsx +160 -0
- package/src/client/components/settings/categories/usage-settings/TokenPortalCard.tsx +104 -0
- package/src/client/components/settings/categories/usage-settings/format.ts +35 -0
- package/src/client/components/settings/categories/usage-settings/limits-section.test.tsx +16 -0
- package/src/client/components/settings/categories/usage-settings/providers.ts +26 -4
- package/src/client/components/settings/categories/usage-settings/token-harbor-card.test.tsx +114 -0
- package/src/client/components/settings/categories/usage-settings/token-harbor-hint.test.ts +68 -0
- package/src/client/components/settings/categories/usage-settings/token-portal-card.test.tsx +81 -0
- package/src/client/components/settings/categories/usage-settings/usage-and-picker.test.ts +66 -0
- 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/DiffView.test.ts +13 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/DiffView.tsx +41 -18
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/tool-input.ts +5 -5
- package/src/client/components/workspace/editor/BodyLazy.tsx +40 -0
- package/src/client/components/workspace/editor/index.tsx +2 -2
- package/src/client/data/settings/omp-schema.json +33 -10
- 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/lib/usage/provider-key.ts +18 -0
- package/src/server/lib/usage/providers.server.ts +27 -3
- package/src/server/lib/usage/report.server.ts +24 -0
- package/src/server/lib/usage/token-harbor.test.ts +191 -0
- package/src/server/lib/usage/token-harbor.ts +207 -0
- package/src/server/lib/usage/token-portal.test.ts +140 -0
- package/src/server/lib/usage/token-portal.ts +179 -0
- package/src/server/lib/usage/vendor-http.test.ts +52 -0
- package/src/server/lib/usage/vendor-http.ts +9 -2
- 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/config/schema-releases.test.ts +22 -0
- 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/shared/types/settings/usage.ts +89 -2
- package/src/test-support/pristine-globals.ts +5 -0
- package/dist/client/static/js/ImageView-mvjb3qh1.js +0 -1
- package/dist/client/static/js/LayoutWrapper-eenx0hp2.js +0 -2
- package/dist/client/static/js/Modal-dsqhas10.js +0 -59
- package/dist/client/static/js/PdfView-cpvsbfk0.js +0 -1
- package/dist/client/static/js/SessionsView-s0crtcm8.js +0 -1
- package/dist/client/static/js/architecture-7GRP2DOG-b5w9mnn5.js +0 -1
- package/dist/client/static/js/architectureDiagram-NJMV4G6O-1nh4htz2.js +0 -36
- package/dist/client/static/js/bash-hv3167gh.js +0 -1
- package/dist/client/static/js/c-acmn1zc9.js +0 -1
- package/dist/client/static/js/cpp-v2mqp8j7.js +0 -1
- package/dist/client/static/js/css-drfs4n12.js +0 -1
- package/dist/client/static/js/css-x7gyc3ta.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-kdj8rjc1.js +0 -1
- package/dist/client/static/js/dagre-6A5THRUB-41zsteyd.js +0 -4
- package/dist/client/static/js/eventmodeling-NTZA5JFV-m57b7ytw.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-fasj2gxy.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-wvzsc4ph.js +0 -1
- package/dist/client/static/js/graphql-a4gbqpj9.js +0 -1
- package/dist/client/static/js/html-m0megrvb.js +0 -1
- package/dist/client/static/js/index-1d8bxjsz.js +0 -4
- package/dist/client/static/js/index-3nsrnyqr.js +0 -2
- package/dist/client/static/js/index-4x9p7hf9.js +0 -2
- package/dist/client/static/js/index-6009v8jf.js +0 -1
- package/dist/client/static/js/index-9vqkyj58.js +0 -3
- package/dist/client/static/js/index-d2xtbabt.js +0 -2
- package/dist/client/static/js/index-dxp2yvy7.js +0 -2
- package/dist/client/static/js/index-p6s3fz6b.js +0 -12
- package/dist/client/static/js/index-qtd0e38d.js +0 -1
- package/dist/client/static/js/index-x2v1zmth.js +0 -479
- package/dist/client/static/js/index-x9hfvbz6.js +0 -2
- package/dist/client/static/js/info-A6RAGUB7-ym2xevn8.js +0 -1
- package/dist/client/static/js/ini-80p6sp79.js +0 -1
- package/dist/client/static/js/java-mm2b3s9b.js +0 -1
- package/dist/client/static/js/javascript-n9w9p97f.js +0 -1
- package/dist/client/static/js/json-fzy76fkw.js +0 -1
- package/dist/client/static/js/jsx-c7v2f8s7.js +0 -1
- package/dist/client/static/js/lua-ppfdxrmv.js +0 -1
- package/dist/client/static/js/markdown-xed7y3ds.js +0 -1
- package/dist/client/static/js/one-dark-pro-mq6sn6a2.js +0 -1
- package/dist/client/static/js/one-light-pt6t6vax.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-01vcsy6x.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-053gzkmh.js +0 -1
- package/dist/client/static/js/properties-8ysbq2n2.js +0 -1
- package/dist/client/static/js/python-4ysexc8s.js +0 -1
- package/dist/client/static/js/r-hrsw5arc.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-bkpby8am.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-67bxrjgw.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-xj9ymacg.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-2xxpbnf6.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-78w88znz.js +0 -1
- package/dist/client/static/js/sequenceDiagram-PO4LG4MO-c0tk7gfn.js +0 -169
- package/dist/client/static/js/sql-hd42h8wx.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-rz309qrx.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-g2bkjr4z.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-pj7yw9rw.js +0 -1
- package/dist/client/static/js/tsx-xjp2ds8g.js +0 -1
- package/dist/client/static/js/typescript-yg97da8h.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-c7ekf8r2.js +0 -1
- package/dist/client/static/js/xml-nrb23phz.js +0 -1
- package/dist/client/static/js/yaml-sqs6pjpx.js +0 -1
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The subagent registry: the patch rules the RFD defines, and the status the
|
|
8
|
+
* card badge derives from the CHILD's own state.
|
|
9
|
+
*
|
|
10
|
+
* The bug these pin: a parent that announced a child had no record of it, so
|
|
11
|
+
* the child's frames folded into the parent transcript and a child's permission
|
|
12
|
+
* was parked under the parent's session id.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { describe, expect, test } from 'bun:test';
|
|
16
|
+
import {
|
|
17
|
+
AcpSubagents,
|
|
18
|
+
subagentCardStatus,
|
|
19
|
+
subagentFinished,
|
|
20
|
+
} from '@/server/lib/harness/acp/subagents';
|
|
21
|
+
|
|
22
|
+
describe('ACP subagent registry', () => {
|
|
23
|
+
test('an announcement registers the child with its association fields', () => {
|
|
24
|
+
const subagents = new AcpSubagents();
|
|
25
|
+
const record = subagents.apply({
|
|
26
|
+
sessionId: 'child-1',
|
|
27
|
+
title: 'Investigator',
|
|
28
|
+
description: 'Looks into failures',
|
|
29
|
+
capabilities: { cancel: {} },
|
|
30
|
+
cwd: '/work',
|
|
31
|
+
});
|
|
32
|
+
expect(record).toMatchObject({
|
|
33
|
+
sessionId: 'child-1',
|
|
34
|
+
title: 'Investigator',
|
|
35
|
+
description: 'Looks into failures',
|
|
36
|
+
canCancel: true,
|
|
37
|
+
cwd: '/work',
|
|
38
|
+
state: 'unknown',
|
|
39
|
+
});
|
|
40
|
+
expect(subagents.has('child-1')).toBe(true);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('omitted fields are unchanged and null clears them', () => {
|
|
44
|
+
const subagents = new AcpSubagents();
|
|
45
|
+
subagents.apply({ sessionId: 'child-1', title: 'Investigator', capabilities: { cancel: {} } });
|
|
46
|
+
subagents.apply({ sessionId: 'child-1' });
|
|
47
|
+
expect(subagents.get('child-1')).toMatchObject({ title: 'Investigator', canCancel: true });
|
|
48
|
+
|
|
49
|
+
subagents.apply({ sessionId: 'child-1', title: null, capabilities: null });
|
|
50
|
+
expect(subagents.get('child-1')).toMatchObject({ title: undefined, canCancel: false });
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('an update with no session id is not a record', () => {
|
|
54
|
+
expect(new AcpSubagents().apply({ title: 'nameless' })).toBeNull();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test('the child’s own state decides the card status', () => {
|
|
58
|
+
const subagents = new AcpSubagents();
|
|
59
|
+
subagents.apply({ sessionId: 'child-1' });
|
|
60
|
+
expect(subagentCardStatus(subagents.get('child-1')!)).toBe('running');
|
|
61
|
+
|
|
62
|
+
subagents.absorb('child-1', { sessionUpdate: 'state_update', state: 'idle', stopReason: 'end_turn' });
|
|
63
|
+
expect(subagentCardStatus(subagents.get('child-1')!)).toBe('completed');
|
|
64
|
+
expect(subagentFinished(subagents.get('child-1')!)).toBe(true);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test('an idle child that stopped with an error is failed, not completed', () => {
|
|
68
|
+
const subagents = new AcpSubagents();
|
|
69
|
+
subagents.apply({ sessionId: 'child-1' });
|
|
70
|
+
subagents.absorb('child-1', {
|
|
71
|
+
sessionUpdate: 'state_update',
|
|
72
|
+
state: 'idle',
|
|
73
|
+
stopReason: 'error',
|
|
74
|
+
error: { message: 'provider refused' },
|
|
75
|
+
});
|
|
76
|
+
const record = subagents.get('child-1')!;
|
|
77
|
+
expect(subagentCardStatus(record)).toBe('failed');
|
|
78
|
+
expect(record.error).toBe('provider refused');
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test('an idle child that was cancelled says so', () => {
|
|
82
|
+
const subagents = new AcpSubagents();
|
|
83
|
+
subagents.apply({ sessionId: 'child-1' });
|
|
84
|
+
subagents.absorb('child-1', { sessionUpdate: 'state_update', state: 'idle', stopReason: 'cancelled' });
|
|
85
|
+
expect(subagentCardStatus(subagents.get('child-1')!)).toBe('cancelled');
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('child prose accumulates and is what the card shows', () => {
|
|
89
|
+
const subagents = new AcpSubagents();
|
|
90
|
+
subagents.apply({ sessionId: 'child-1' });
|
|
91
|
+
subagents.absorb('child-1', {
|
|
92
|
+
sessionUpdate: 'agent_message_chunk',
|
|
93
|
+
content: { type: 'text', text: 'Reading ' },
|
|
94
|
+
});
|
|
95
|
+
subagents.absorb('child-1', {
|
|
96
|
+
sessionUpdate: 'agent_message_chunk',
|
|
97
|
+
content: { type: 'text', text: 'the file' },
|
|
98
|
+
});
|
|
99
|
+
expect(subagents.get('child-1')!.activity).toBe('Reading the file');
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test('a frame from an unannounced session is not adopted', () => {
|
|
103
|
+
const subagents = new AcpSubagents();
|
|
104
|
+
expect(subagents.absorb('stranger', { sessionUpdate: 'state_update', state: 'idle' })).toBeUndefined();
|
|
105
|
+
expect(subagents.list()).toHaveLength(0);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test('liveness keeps a parent from being reclaimed under a working child', () => {
|
|
109
|
+
const subagents = new AcpSubagents();
|
|
110
|
+
subagents.apply({ sessionId: 'child-1', state: { state: 'running' } });
|
|
111
|
+
expect(subagents.anyRunning()).toBe(true);
|
|
112
|
+
subagents.absorb('child-1', { sessionUpdate: 'state_update', state: 'idle', stopReason: 'end_turn' });
|
|
113
|
+
expect(subagents.anyRunning()).toBe(false);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test('a dead parent closes every unfinished child', () => {
|
|
117
|
+
const subagents = new AcpSubagents();
|
|
118
|
+
subagents.apply({ sessionId: 'child-1', state: { state: 'running' } });
|
|
119
|
+
subagents.apply({ sessionId: 'child-2', state: { state: 'idle', stopReason: 'end_turn' } });
|
|
120
|
+
const changed = subagents.finishAll();
|
|
121
|
+
expect(changed.map((record) => record.sessionId)).toEqual(['child-1']);
|
|
122
|
+
expect(subagents.get('child-1')).toMatchObject({ state: 'idle', stopReason: 'cancelled' });
|
|
123
|
+
});
|
|
124
|
+
});
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The subagent sessions one ACP parent owns.
|
|
8
|
+
*
|
|
9
|
+
* The subagents RFD makes a child a SESSION on the parent's connection: the
|
|
10
|
+
* parent announces it with `subagent_update` (on the parent's stream, naming the
|
|
11
|
+
* child in `sessionId`), and every later frame the child produces arrives with
|
|
12
|
+
* the child's own `sessionId`. Before this module the session applied neither —
|
|
13
|
+
* a child's frames were folded into the parent's transcript and a permission it
|
|
14
|
+
* asked for was parked under the parent's id. That is the defect the gate in
|
|
15
|
+
* `session-notifications.ts` now prevents.
|
|
16
|
+
*
|
|
17
|
+
* Association fields follow the RFD's PATCH semantics exactly (omitted =
|
|
18
|
+
* unchanged, `null` = cleared), because a title reported once and a `cwd`
|
|
19
|
+
* cleared later are two different updates of one record. Activity is the
|
|
20
|
+
* child's own stream reduced to the last thing it said, which is what the card
|
|
21
|
+
* shows; it is deliberately not a second transcript.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { acpContentText } from '@/server/lib/harness/acp/mapper';
|
|
25
|
+
import { isRecord } from '@/shared/lib/util/guards';
|
|
26
|
+
import type { AcpSubagentUpdate } from '@/server/lib/harness/acp/protocol';
|
|
27
|
+
|
|
28
|
+
/** One child session, as the parent has described it so far. */
|
|
29
|
+
export interface AcpSubagentRecord {
|
|
30
|
+
/** The CHILD's ACP session id — the key every child frame carries. */
|
|
31
|
+
sessionId: string;
|
|
32
|
+
title?: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
/** The parent allows this client to cancel the child's current work. */
|
|
35
|
+
canCancel: boolean;
|
|
36
|
+
cwd?: string;
|
|
37
|
+
additionalDirectories?: string[];
|
|
38
|
+
/** The child's own `state_update.state`; `unknown` until it reports one. */
|
|
39
|
+
state: string;
|
|
40
|
+
stopReason?: string;
|
|
41
|
+
error?: string;
|
|
42
|
+
/** The last text the child produced, capped. Empty until it says something. */
|
|
43
|
+
activity: string;
|
|
44
|
+
announcedAt: number;
|
|
45
|
+
updatedAt: number;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** What the card's badge says. Derived from the child's own state, never from
|
|
49
|
+
* the parent turn: a child outlives the turn that spawned it. */
|
|
50
|
+
export type SubagentCardStatus = 'running' | 'completed' | 'failed' | 'cancelled' | 'idle';
|
|
51
|
+
|
|
52
|
+
const ACTIVITY_LIMIT = 4_000;
|
|
53
|
+
|
|
54
|
+
/** The card status a record's state names. */
|
|
55
|
+
export function subagentCardStatus(record: AcpSubagentRecord): SubagentCardStatus {
|
|
56
|
+
if (record.state === 'running' || record.state === 'requires_action' || record.state === 'unknown') {
|
|
57
|
+
return 'running';
|
|
58
|
+
}
|
|
59
|
+
if (record.state !== 'idle') return 'running';
|
|
60
|
+
if (record.stopReason === 'cancelled') return 'cancelled';
|
|
61
|
+
if (record.stopReason === 'error' || record.error) return 'failed';
|
|
62
|
+
if (record.stopReason) return 'completed';
|
|
63
|
+
return 'idle';
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Whether the child's work has ended (its card must stop spinning). */
|
|
67
|
+
export function subagentFinished(record: AcpSubagentRecord): boolean {
|
|
68
|
+
return record.state === 'idle';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export class AcpSubagents {
|
|
72
|
+
private readonly records = new Map<string, AcpSubagentRecord>();
|
|
73
|
+
|
|
74
|
+
/** Apply one `subagent_update`; null when it names no child. */
|
|
75
|
+
apply(raw: Record<string, unknown>): AcpSubagentRecord | null {
|
|
76
|
+
const update = raw as unknown as AcpSubagentUpdate;
|
|
77
|
+
const sessionId = (typeof update.sessionId === 'string' ? update.sessionId : '');
|
|
78
|
+
if (!sessionId) return null;
|
|
79
|
+
const now = Date.now();
|
|
80
|
+
const record = this.records.get(sessionId) ?? {
|
|
81
|
+
sessionId,
|
|
82
|
+
canCancel: false,
|
|
83
|
+
state: 'unknown',
|
|
84
|
+
activity: '',
|
|
85
|
+
announcedAt: now,
|
|
86
|
+
updatedAt: now,
|
|
87
|
+
};
|
|
88
|
+
if ('title' in update) record.title = typeof update.title === 'string' && update.title ? update.title : undefined;
|
|
89
|
+
if ('description' in update) record.description = typeof update.description === 'string' && update.description ? update.description : undefined;
|
|
90
|
+
if ('cwd' in update) record.cwd = typeof update.cwd === 'string' && update.cwd ? update.cwd : undefined;
|
|
91
|
+
if ('additionalDirectories' in update) {
|
|
92
|
+
const dirs = Array.isArray(update.additionalDirectories)
|
|
93
|
+
? update.additionalDirectories.filter((entry): entry is string => typeof entry === 'string')
|
|
94
|
+
: [];
|
|
95
|
+
record.additionalDirectories = dirs.length > 0 ? dirs : undefined;
|
|
96
|
+
}
|
|
97
|
+
if ('capabilities' in update) {
|
|
98
|
+
// Capabilities are replaced as a whole: `{cancel: null}` disables it.
|
|
99
|
+
record.canCancel = isRecord(update.capabilities) && update.capabilities.cancel != null;
|
|
100
|
+
}
|
|
101
|
+
if ('state' in update) this.applyState(record, update.state);
|
|
102
|
+
record.updatedAt = now;
|
|
103
|
+
this.records.set(sessionId, record);
|
|
104
|
+
return record;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Fold one of the CHILD's own frames into its record. Undefined when the
|
|
108
|
+
* id names no known child — the caller drops that traffic. */
|
|
109
|
+
absorb(sessionId: string, update: Record<string, unknown>): AcpSubagentRecord | undefined {
|
|
110
|
+
const record = this.records.get(sessionId);
|
|
111
|
+
if (!record) return undefined;
|
|
112
|
+
const kind = typeof update.sessionUpdate === 'string' ? update.sessionUpdate : '';
|
|
113
|
+
if (kind === 'state_update') {
|
|
114
|
+
this.applyState(record, update);
|
|
115
|
+
} else if (kind === 'agent_message_chunk' || kind === 'agent_message') {
|
|
116
|
+
const text = acpContentText(update.content);
|
|
117
|
+
if (text) {
|
|
118
|
+
record.activity = kind === 'agent_message'
|
|
119
|
+
? text.slice(-ACTIVITY_LIMIT)
|
|
120
|
+
: `${record.activity}${text}`.slice(-ACTIVITY_LIMIT);
|
|
121
|
+
}
|
|
122
|
+
} else if (kind === 'session_info_update' && typeof update.title === 'string' && update.title) {
|
|
123
|
+
record.title = update.title;
|
|
124
|
+
}
|
|
125
|
+
record.updatedAt = Date.now();
|
|
126
|
+
return record;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Mark every unfinished child cancelled — the parent is going away and no
|
|
130
|
+
* later frame will ever report their outcome. */
|
|
131
|
+
finishAll(reason = 'The parent session ended'): AcpSubagentRecord[] {
|
|
132
|
+
const changed: AcpSubagentRecord[] = [];
|
|
133
|
+
for (const record of this.records.values()) {
|
|
134
|
+
if (record.state === 'idle') continue;
|
|
135
|
+
record.state = 'idle';
|
|
136
|
+
record.stopReason = 'cancelled';
|
|
137
|
+
record.error = reason;
|
|
138
|
+
record.updatedAt = Date.now();
|
|
139
|
+
changed.push(record);
|
|
140
|
+
}
|
|
141
|
+
return changed;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
get(sessionId: string): AcpSubagentRecord | undefined {
|
|
145
|
+
return this.records.get(sessionId);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
has(sessionId: string): boolean {
|
|
149
|
+
return this.records.has(sessionId);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** Whether any child is still working. A parent that reclaims its child
|
|
153
|
+
* mid-run takes work the operator is waiting for. */
|
|
154
|
+
anyRunning(): boolean {
|
|
155
|
+
for (const record of this.records.values()) if (record.state !== 'idle') return true;
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
list(): AcpSubagentRecord[] {
|
|
160
|
+
return [...this.records.values()].sort((left, right) => left.announcedAt - right.announcedAt);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
clear(): void {
|
|
164
|
+
this.records.clear();
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
private applyState(record: AcpSubagentRecord, state: unknown): void {
|
|
168
|
+
if (state === null || state === undefined) {
|
|
169
|
+
record.state = 'unknown';
|
|
170
|
+
record.stopReason = undefined;
|
|
171
|
+
record.error = undefined;
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (!isRecord(state)) return;
|
|
175
|
+
record.state = typeof state.state === 'string' && state.state ? state.state : 'unknown';
|
|
176
|
+
record.stopReason = typeof state.stopReason === 'string' && state.stopReason ? state.stopReason : undefined;
|
|
177
|
+
const error = isRecord(state.error) && typeof state.error.message === 'string' && state.error.message
|
|
178
|
+
? state.error.message
|
|
179
|
+
: undefined;
|
|
180
|
+
record.error = error;
|
|
181
|
+
}
|
|
182
|
+
}
|