@datalayer/agent-runtimes 1.5.21 → 1.5.22
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-embed/chunks/{AgentDetails-C7tCazwB.js → AgentDetails-B6vekLFY.js} +1 -1
- package/dist-embed/chunks/{AgentDetailsDialog-Cwps4GeH.js → AgentDetailsDialog-C-o8qFsS.js} +1 -1
- package/dist-embed/chunks/{AgentInspector-Gk7jbg8t.js → AgentInspector-EiBHJgc9.js} +1 -1
- package/dist-embed/chunks/{AgentInspectorDialog-BSSDOFrT.js → AgentInspectorDialog-3fbLXnLP.js} +1 -1
- package/dist-embed/chunks/{CellSidebarExtension-p2BAkwis.js → CellSidebarExtension-BBXRIRgA.js} +8 -8
- package/dist-embed/chunks/ChatView-BjZ993Ch.js +32 -0
- package/dist-embed/chunks/{ContextPie-bd_YOjzP.js → ContextPie-Daf19Ivt.js} +1 -1
- package/dist-embed/chunks/{DeckComponent-4gxuEH4A.js → DeckComponent-C76a8LYD.js} +2 -2
- package/dist-embed/chunks/{DocumentView-BZSYqTh_.js → DocumentView-BZhbQkbP.js} +1 -1
- package/dist-embed/chunks/{EphemeralDocument-Cevnk5OF.js → EphemeralDocument-Bzv1mPpG.js} +1 -1
- package/dist-embed/chunks/{EphemeralNotebook-JvALIbK2.js → EphemeralNotebook-C4_wmSgk.js} +1 -1
- package/dist-embed/chunks/{ExcalidrawComponent-CbghNk-F.js → ExcalidrawComponent-DVOnRDkN.js} +1 -1
- package/dist-embed/chunks/{ExcalidrawModal-BOVvWzYQ.js → ExcalidrawModal-B0h_-M3l.js} +1 -1
- package/dist-embed/chunks/{JupyterLexicalExtension-CRccZ2h7.js → JupyterLexicalExtension-B2PQrLXS.js} +29 -29
- package/dist-embed/chunks/{KernelVariables-ompObBEM.js → KernelVariables-trZsXNAi.js} +1 -1
- package/dist-embed/chunks/{LexicalToolRegistry-BlBEZPP4.js → LexicalToolRegistry-8wJyLumb.js} +1 -1
- package/dist-embed/chunks/{NotebookToolSurfaces-DP8sWqVy.js → NotebookToolSurfaces-BuKcXArX.js} +1 -1
- package/dist-embed/chunks/{NotebookView-DC6BDVEp.js → NotebookView-Em4y6Een.js} +1 -1
- package/dist-embed/chunks/{Output-C4hBhZ5k.js → Output-DA8Udq91.js} +1 -1
- package/dist-embed/chunks/{SandboxDetailsDialog-CX8wvCLJ.js → SandboxDetailsDialog-o2z6YFyb.js} +1 -1
- package/dist-embed/chunks/{SchemaForm-BuhXDyz6.js → SchemaForm-DCt_mqR1.js} +1 -1
- package/dist-embed/chunks/{WidgetVariableView-C2X5Ehcg.js → WidgetVariableView-CDEFi0p0.js} +1 -1
- package/dist-embed/chunks/{YouTubePlugin-CjgOnMCz.js → YouTubePlugin-DxRPFzvS.js} +1 -1
- package/dist-embed/chunks/{abnfDiagram-VCTEODGH-wvUaPpVC.js → abnfDiagram-VCTEODGH-Cit223SC.js} +1 -1
- package/dist-embed/chunks/{abnfDiagram-VCTEODGH-kzVu7pzT.js → abnfDiagram-VCTEODGH-CsoEWluu.js} +1 -1
- package/dist-embed/chunks/{ar-SA-G6X2FPQ2-ArgZTGSp.js → ar-SA-G6X2FPQ2-CjJtC55z.js} +1 -1
- package/dist-embed/chunks/{architectureDiagram-5GKGNRK7-DVZUrWEx.js → architectureDiagram-5GKGNRK7-DfqpfKOB.js} +1 -1
- package/dist-embed/chunks/{architectureDiagram-5GKGNRK7-CwbfxDHw.js → architectureDiagram-5GKGNRK7-DyQuZM-c.js} +1 -1
- package/dist-embed/chunks/{az-AZ-76LH7QW2-DQgz6n32.js → az-AZ-76LH7QW2-B7KkL6wt.js} +1 -1
- package/dist-embed/chunks/{bg-BG-XCXSNQG7-Cx0dPt6-.js → bg-BG-XCXSNQG7-D7UwtEhO.js} +1 -1
- package/dist-embed/chunks/{blockDiagram-868be97b-DEQh5CUO.js → blockDiagram-868be97b-jJKAH_Up.js} +1 -1
- package/dist-embed/chunks/{blockDiagram-I7D4REHJ-C6gbEBfg.js → blockDiagram-I7D4REHJ-BcQwB7-r.js} +1 -1
- package/dist-embed/chunks/{blockDiagram-I7D4REHJ-DUIcpkIN.js → blockDiagram-I7D4REHJ-z3xnLtdG.js} +1 -1
- package/dist-embed/chunks/{bn-BD-2XOGV67Q-BkekmuYO.js → bn-BD-2XOGV67Q-pDDWE9Mn.js} +1 -1
- package/dist-embed/chunks/{c4Diagram-3f4bdde3-CUcRctJE.js → c4Diagram-3f4bdde3-DU_-LipO.js} +1 -1
- package/dist-embed/chunks/{c4Diagram-7LVT6UL2-DSQiEaxC.js → c4Diagram-7LVT6UL2-BeMfCOG_.js} +1 -1
- package/dist-embed/chunks/{c4Diagram-7LVT6UL2-f7UaZWVg.js → c4Diagram-7LVT6UL2-DjfnLrWZ.js} +1 -1
- package/dist-embed/chunks/{ca-ES-6MX7JW3Y-Yr14RtMP.js → ca-ES-6MX7JW3Y-By1uEeFx.js} +1 -1
- package/dist-embed/chunks/{celltoolbartracker-Bx9x9aeh.js → celltoolbartracker-DcYHi8Du.js} +1 -1
- package/dist-embed/chunks/{chunk-2Q5K7J3B-DbzMjK_L.js → chunk-2Q5K7J3B-BGvvv_gg.js} +1 -1
- package/dist-embed/chunks/{chunk-2Q5K7J3B-BBPiCQqO.js → chunk-2Q5K7J3B-YWpfqKnX.js} +1 -1
- package/dist-embed/chunks/{chunk-5VM5RSS4-CcNPo9qP.js → chunk-5VM5RSS4-4bCWL_eZ.js} +1 -1
- package/dist-embed/chunks/{chunk-5VM5RSS4-rEZEdbpi.js → chunk-5VM5RSS4-t-8mwHFb.js} +1 -1
- package/dist-embed/chunks/{chunk-F27PBJKO-DTgjd0wN.js → chunk-F27PBJKO-3yGsHIDd.js} +1 -1
- package/dist-embed/chunks/{chunk-F27PBJKO-BH7lDumP.js → chunk-F27PBJKO-De9ONU-g.js} +1 -1
- package/dist-embed/chunks/{chunk-IMKFNOWR-DuzpuE1w.js → chunk-IMKFNOWR-Bvbi7lre.js} +1 -1
- package/dist-embed/chunks/{chunk-IMKFNOWR-BA-vmq_V.js → chunk-IMKFNOWR-DA2KJGep.js} +1 -1
- package/dist-embed/chunks/{chunk-JWPE2WC7-BfRI4eJ2.js → chunk-JWPE2WC7-CVkDZh_H.js} +1 -1
- package/dist-embed/chunks/{chunk-JWPE2WC7-CAdvd3EQ.js → chunk-JWPE2WC7-w_AaYpEU.js} +1 -1
- package/dist-embed/chunks/{chunk-POPQ4Y6H-B7pT6rUf.js → chunk-POPQ4Y6H-C1mg0obI.js} +1 -1
- package/dist-embed/chunks/{chunk-POPQ4Y6H-Dw1h_9lT.js → chunk-POPQ4Y6H-DnstozKC.js} +1 -1
- package/dist-embed/chunks/{chunk-SVP7TREG-VsO48dck.js → chunk-SVP7TREG-CVLd6GtA.js} +1 -1
- package/dist-embed/chunks/{chunk-SVP7TREG-BxpYXJab.js → chunk-SVP7TREG-DmKkKduL.js} +1 -1
- package/dist-embed/chunks/{chunk-TICWLB2K-LCiyX33a.js → chunk-TICWLB2K-C-lEt3p0.js} +1 -1
- package/dist-embed/chunks/{chunk-TICWLB2K-CU2oQRJ9.js → chunk-TICWLB2K-xv7MPgmq.js} +1 -1
- package/dist-embed/chunks/{chunk-XXDRQBXY-CL1cUI4w.js → chunk-XXDRQBXY-Cq8wF2xQ.js} +1 -1
- package/dist-embed/chunks/{chunk-XXDRQBXY-islJGiCO.js → chunk-XXDRQBXY-j7xuWjIK.js} +1 -1
- package/dist-embed/chunks/{classDiagram-ZZMXUADV-Ctw7VU-m.js → classDiagram-ZZMXUADV-DRPRMTvC.js} +1 -1
- package/dist-embed/chunks/{classDiagram-ZZMXUADV-C7-Ca_nP.js → classDiagram-ZZMXUADV-Dvh08RMu.js} +1 -1
- package/dist-embed/chunks/{classDiagram-f62afe4f-BaJUb6H9.js → classDiagram-f62afe4f-B8-b8b-t.js} +1 -1
- package/dist-embed/chunks/{classDiagram-v2-604399ef-s6LKeK41.js → classDiagram-v2-604399ef-CHogX84-.js} +1 -1
- package/dist-embed/chunks/{classDiagram-v2-VYDZK3BY-Ctw7VU-m.js → classDiagram-v2-VYDZK3BY-DRPRMTvC.js} +1 -1
- package/dist-embed/chunks/{classDiagram-v2-VYDZK3BY-C7-Ca_nP.js → classDiagram-v2-VYDZK3BY-Dvh08RMu.js} +1 -1
- package/dist-embed/chunks/{code-block-IT6T5CEO-BieLU8ls.js → code-block-IT6T5CEO-Dbm1cj5T.js} +1 -1
- package/dist-embed/chunks/{component-p2xkjXeh.js → component-CsXw-w1P.js} +1 -1
- package/dist-embed/chunks/{cose-bilkent-JH36ORCC-BkezndW_.js → cose-bilkent-JH36ORCC-BrisaBwh.js} +1 -1
- package/dist-embed/chunks/{cose-bilkent-JH36ORCC-DrOmRWVI.js → cose-bilkent-JH36ORCC-DGpwW9PH.js} +1 -1
- package/dist-embed/chunks/{createText-aed3d8b3-Dw8k7JC8.js → createText-aed3d8b3-C8C5hNtS.js} +1 -1
- package/dist-embed/chunks/{cs-CZ-2BRQDIVT-DYR-S6bD.js → cs-CZ-2BRQDIVT-TB9QxoL2.js} +1 -1
- package/dist-embed/chunks/{cynefinDiagram-5FMLGOSQ-qZ6StjuY.js → cynefinDiagram-5FMLGOSQ-B37BRKcq.js} +1 -1
- package/dist-embed/chunks/{cynefinDiagram-5FMLGOSQ-DqoI6t3s.js → cynefinDiagram-5FMLGOSQ-NXny6Mot.js} +1 -1
- package/dist-embed/chunks/{da-DK-5WZEPLOC-DhaHIgKI.js → da-DK-5WZEPLOC-CLl8TZ2P.js} +1 -1
- package/dist-embed/chunks/{dagre-GXQ25YYZ-pcAHu_bK.js → dagre-GXQ25YYZ-b03jeXc5.js} +1 -1
- package/dist-embed/chunks/{dagre-GXQ25YYZ-Bb0_WA3x.js → dagre-GXQ25YYZ-mM6SsGs8.js} +1 -1
- package/dist-embed/chunks/{de-DE-XR44H4JA-CJpRH2Fy.js → de-DE-XR44H4JA-6gY_Hl4H.js} +1 -1
- package/dist-embed/chunks/{diagram-S7CK7UJ4-W17wgXHY.js → diagram-S7CK7UJ4-C8TF_Y_V.js} +1 -1
- package/dist-embed/chunks/{diagram-S7CK7UJ4-CwINt91M.js → diagram-S7CK7UJ4-fpaH_1xM.js} +1 -1
- package/dist-embed/chunks/{diagram-UQ7AKVKN-mH7QBO8y.js → diagram-UQ7AKVKN-CcqaQfbU.js} +1 -1
- package/dist-embed/chunks/{diagram-UQ7AKVKN-CXRpfLBt.js → diagram-UQ7AKVKN-G8fspx37.js} +1 -1
- package/dist-embed/chunks/{diagram-VSXAHHWV-CFHqpDaB.js → diagram-VSXAHHWV-B3Q41FOl.js} +1 -1
- package/dist-embed/chunks/{diagram-VSXAHHWV-Bg68Bv82.js → diagram-VSXAHHWV-DLhWEHn-.js} +1 -1
- package/dist-embed/chunks/{diagram-VX7I27RA-DQ6XlKLw.js → diagram-VX7I27RA-Dnbm3teD.js} +1 -1
- package/dist-embed/chunks/{diagram-VX7I27RA-BEO0D7jE.js → diagram-VX7I27RA-Dy-IHeZr.js} +1 -1
- package/dist-embed/chunks/{diagram-Z3DM3KII-BLJQK61P.js → diagram-Z3DM3KII-BkiB9_Ay.js} +1 -1
- package/dist-embed/chunks/{diagram-Z3DM3KII-Cenqf76m.js → diagram-Z3DM3KII-hE5FTtNp.js} +1 -1
- package/dist-embed/chunks/{ebnfDiagram-PWID7BFC-6H6OSebp.js → ebnfDiagram-PWID7BFC-DJhj6Mbd.js} +1 -1
- package/dist-embed/chunks/{ebnfDiagram-PWID7BFC-Cqmnghct.js → ebnfDiagram-PWID7BFC-DZiCEGSK.js} +1 -1
- package/dist-embed/chunks/{edges-b2856ca0-ChO7JKaP.js → edges-b2856ca0-DuBY_rn3.js} +1 -1
- package/dist-embed/chunks/{el-GR-BZB4AONW-DPGB1p8K.js → el-GR-BZB4AONW-CFGi_gqP.js} +1 -1
- package/dist-embed/chunks/{erDiagram-5d81789a-jzhAXdZi.js → erDiagram-5d81789a-BYOejxuX.js} +1 -1
- package/dist-embed/chunks/{erDiagram-RLTQ6QDP-DEAWMrMT.js → erDiagram-RLTQ6QDP-Bg2UfSBM.js} +1 -1
- package/dist-embed/chunks/{erDiagram-RLTQ6QDP-hAbP0vV0.js → erDiagram-RLTQ6QDP-v1tF2vX5.js} +1 -1
- package/dist-embed/chunks/{es-ES-U4NZUMDT-CLztgM3g.js → es-ES-U4NZUMDT-D_HQumEp.js} +1 -1
- package/dist-embed/chunks/{eu-ES-A7QVB2H4--ffZf65_.js → eu-ES-A7QVB2H4-CvUID20p.js} +1 -1
- package/dist-embed/chunks/{fa-IR-HGAKTJCU-Cwwej6FC.js → fa-IR-HGAKTJCU-C7_Vi5QP.js} +1 -1
- package/dist-embed/chunks/{fi-FI-Z5N7JZ37-Tw-dUSxy.js → fi-FI-Z5N7JZ37-SBYxKS7Q.js} +1 -1
- package/dist-embed/chunks/{flowDb-185abca5-DDUaXZ_Q.js → flowDb-185abca5-C_IywhMB.js} +1 -1
- package/dist-embed/chunks/{flowDiagram-1629c991-DpvDtFPK.js → flowDiagram-1629c991-C8JQo90r.js} +1 -1
- package/dist-embed/chunks/{flowDiagram-HODETNUW-DENY4Bvt.js → flowDiagram-HODETNUW-BigtRRvu.js} +1 -1
- package/dist-embed/chunks/{flowDiagram-HODETNUW-Hr-elwWq.js → flowDiagram-HODETNUW-Cd1y1bVx.js} +1 -1
- package/dist-embed/chunks/{flowDiagram-v2-1d953310-TxFSXMN7.js → flowDiagram-v2-1d953310-DTH8N-sj.js} +1 -1
- package/dist-embed/chunks/{flowchart-elk-definition-6df44142-BGFxwidp.js → flowchart-elk-definition-6df44142-W8s7oFgJ.js} +1 -1
- package/dist-embed/chunks/{fr-FR-RHASNOE6-CT1NyjSV.js → fr-FR-RHASNOE6-fAErz4Nf.js} +1 -1
- package/dist-embed/chunks/{ganttDiagram-3b0b3873-DJqKtGUz.js → ganttDiagram-3b0b3873-D_XwfPDh.js} +1 -1
- package/dist-embed/chunks/{ganttDiagram-EL5Y4UJY-3bErrKpg.js → ganttDiagram-EL5Y4UJY-BIsU1Bcw.js} +1 -1
- package/dist-embed/chunks/{ganttDiagram-EL5Y4UJY-Ddh9hVkO.js → ganttDiagram-EL5Y4UJY-VT_s02F9.js} +1 -1
- package/dist-embed/chunks/{gitGraphDiagram-WWUBYQGX-B3BVHs36.js → gitGraphDiagram-WWUBYQGX-BDdr_2gq.js} +1 -1
- package/dist-embed/chunks/{gitGraphDiagram-WWUBYQGX-BiEolUQH.js → gitGraphDiagram-WWUBYQGX-BvxzF9hn.js} +1 -1
- package/dist-embed/chunks/{gitGraphDiagram-f01e8bc2-vOvP_sU8.js → gitGraphDiagram-f01e8bc2-UBa5a0HV.js} +1 -1
- package/dist-embed/chunks/{gl-ES-HMX3MZ6V-BKTaXj_2.js → gl-ES-HMX3MZ6V-DCciQOEM.js} +1 -1
- package/dist-embed/chunks/{he-IL-6SHJWFNN-BJ5SwTG5.js → he-IL-6SHJWFNN-CuQhQVb2.js} +1 -1
- package/dist-embed/chunks/{hi-IN-IWLTKZ5I-D5ZQxogx.js → hi-IN-IWLTKZ5I-BlH8AK2z.js} +1 -1
- package/dist-embed/chunks/{hu-HU-A5ZG7DT2-CoAAAzpy.js → hu-HU-A5ZG7DT2-BaBGhZVQ.js} +1 -1
- package/dist-embed/chunks/{id-ID-SAP4L64H-DFWbGjYj.js → id-ID-SAP4L64H-Dkm1zS1g.js} +1 -1
- package/dist-embed/chunks/{index-9bae90f3-YA-Pbv-C.js → index-9bae90f3-CvHGNDGk.js} +1 -1
- package/dist-embed/chunks/{index-BVzIb3Wy.js → index-B9aqZrHy.js} +1 -1
- package/dist-embed/chunks/{index-Db1qHC1a.js → index-BDs-ntTo.js} +1 -1
- package/dist-embed/chunks/{index-BfMo5nXi.js → index-BQp4l7hT.js} +2 -2
- package/dist-embed/chunks/{index-1MXuxaax.js → index-BcdbHyzT.js} +1 -1
- package/dist-embed/chunks/{index-B9vBhR-p.js → index-BqDJ3hYN.js} +1 -1
- package/dist-embed/chunks/{index-DMf0f7ny.js → index-CFP9psRB.js} +2 -2
- package/dist-embed/chunks/{index-CkOZcvYl.js → index-CUAnjzKL.js} +1 -1
- package/dist-embed/chunks/{index-FbZJIbu_.js → index-CWwj0zW9.js} +1 -1
- package/dist-embed/chunks/{index-CxIZHPCc.js → index-CecqH6mN.js} +1 -1
- package/dist-embed/chunks/{index-BuyZwxeT.js → index-CoxYszKx.js} +1 -1
- package/dist-embed/chunks/{index-BzQxauhZ.js → index-CozDzMOf.js} +1 -1
- package/dist-embed/chunks/{index-B0MhQWhs.js → index-CrL-deXT.js} +1 -1
- package/dist-embed/chunks/{index-fQxrRXLD.js → index-CtEseCtc.js} +1 -1
- package/dist-embed/chunks/{index-DPzPvDBn.js → index-D2vkNPmG.js} +1 -1
- package/dist-embed/chunks/{index-8Jy3Vws8.js → index-D5xVRNk8.js} +6 -6
- package/dist-embed/chunks/{index-DTCcg1ap.js → index-D8wHLHbt.js} +1 -1
- package/dist-embed/chunks/{index-DSgHh0-i.js → index-DAZUOPnd.js} +1 -1
- package/dist-embed/chunks/{index-CCA_V9Td.js → index-DE_JTiwB.js} +1 -1
- package/dist-embed/chunks/{index-B8y71UkT.js → index-DMll0Yzi.js} +1 -1
- package/dist-embed/chunks/{index-B0omKuYl.js → index-DN-cizG6.js} +1 -1
- package/dist-embed/chunks/{index-JhvHCMRQ.js → index-DPHM1WLM.js} +1 -1
- package/dist-embed/chunks/{index-C7os26P7.js → index-DSN70XMH.js} +2 -2
- package/dist-embed/chunks/{index-6feFd5AZ.js → index-Dc5AqaeZ.js} +1 -1
- package/dist-embed/chunks/{index-BL4KuFQP.js → index-DdmqZZnv.js} +1 -1
- package/dist-embed/chunks/{index-D62kZnWZ.js → index-DlYw1KQn.js} +5 -5
- package/dist-embed/chunks/{index-BgWf1G8H.js → index-Dobs-OKl.js} +1 -1
- package/dist-embed/chunks/{index-CIDdX0nc.js → index-Dp3JEvYy.js} +1 -1
- package/dist-embed/chunks/{index-DTbF6Y7O.js → index-DsMBsL3g.js} +1 -1
- package/dist-embed/chunks/{index-TDpnbl90.js → index-DvyxBamA.js} +4 -4
- package/dist-embed/chunks/{index-BNFZYAJT.js → index-SsFECYMb.js} +1 -1
- package/dist-embed/chunks/{index-Dw1P-H6s.js → index-YVrQYH-H.js} +1 -1
- package/dist-embed/chunks/{index-DpJpQnPn.js → index-a9o1fYab.js} +1 -1
- package/dist-embed/chunks/{index-BTeNnRc_.js → index-bC_5dTbf.js} +4 -4
- package/dist-embed/chunks/{index-DiBcWu6d.js → index-jJxXKHoT.js} +1 -1
- package/dist-embed/chunks/{index.esm-B6P80s3J.js → index.esm-p0OnSU9h.js} +1 -1
- package/dist-embed/chunks/{index.esm-z-R1Ypx2.js → index.esm-q_fIJH5v.js} +1 -1
- package/dist-embed/chunks/{infoDiagram-27XIBGKW-8DlnjSdf.js → infoDiagram-27XIBGKW-DIeaDzEK.js} +1 -1
- package/dist-embed/chunks/{infoDiagram-27XIBGKW-CZPNcDbH.js → infoDiagram-27XIBGKW-DZ6Xhv3K.js} +1 -1
- package/dist-embed/chunks/{infoDiagram-a29d40f1-Di_kmyTC.js → infoDiagram-a29d40f1-B9PMyz4X.js} +1 -1
- package/dist-embed/chunks/{isEqual-D0eOPSLC.js → isEqual-Cwjr2skl.js} +1 -1
- package/dist-embed/chunks/{ishikawaDiagram-5VMMS53U-ri4cvaWs.js → ishikawaDiagram-5VMMS53U-BP4Q8nEu.js} +1 -1
- package/dist-embed/chunks/{ishikawaDiagram-5VMMS53U-DD5TaPvH.js → ishikawaDiagram-5VMMS53U-CwrdITPn.js} +1 -1
- package/dist-embed/chunks/{it-IT-JPQ66NNP-C7p9bCWQ.js → it-IT-JPQ66NNP-BrcctIsI.js} +1 -1
- package/dist-embed/chunks/{ja-JP-DBVTYXUO-DupAM7Cv.js → ja-JP-DBVTYXUO-CKuJ3Sod.js} +1 -1
- package/dist-embed/chunks/{journeyDiagram-3NMN7TZE-1NqbTyL4.js → journeyDiagram-3NMN7TZE-iJrCUeL0.js} +1 -1
- package/dist-embed/chunks/{journeyDiagram-3NMN7TZE-BpYgEBLO.js → journeyDiagram-3NMN7TZE-wI34jsXX.js} +1 -1
- package/dist-embed/chunks/{journeyDiagram-95396277-xr9Xk_mL.js → journeyDiagram-95396277-B6WhL2Fl.js} +1 -1
- package/dist-embed/chunks/{kaa-6HZHGXH3-DrthOcPY.js → kaa-6HZHGXH3-ChFYZBwI.js} +1 -1
- package/dist-embed/chunks/{kab-KAB-ZGHBKWFO-C4hr0kbU.js → kab-KAB-ZGHBKWFO-C7C7EuVk.js} +1 -1
- package/dist-embed/chunks/{kanban-definition-UXKFOSKX-DlSwjr3b.js → kanban-definition-UXKFOSKX-B8AB0LN4.js} +1 -1
- package/dist-embed/chunks/{kanban-definition-UXKFOSKX-B5nUu45Q.js → kanban-definition-UXKFOSKX-gqU76cK9.js} +1 -1
- package/dist-embed/chunks/{kk-KZ-P5N5QNE5-CrjDkh9r.js → kk-KZ-P5N5QNE5-Bff18CC1.js} +1 -1
- package/dist-embed/chunks/{km-KH-HSX4SM5Z-JHWf7VZ6.js → km-KH-HSX4SM5Z-DU2YQt8I.js} +1 -1
- package/dist-embed/chunks/{ko-KR-MTYHY66A-CJ4JxKMG.js → ko-KR-MTYHY66A-CQruDlRn.js} +1 -1
- package/dist-embed/chunks/{ku-TR-6OUDTVRD-YSlLPag_.js → ku-TR-6OUDTVRD-DoySMeIi.js} +1 -1
- package/dist-embed/chunks/{layout-5FOjTADt.js → layout-CJFemkl6.js} +1 -1
- package/dist-embed/chunks/{layout-Bdtul_rg.js → layout-DbdaqszO.js} +1 -1
- package/dist-embed/chunks/{lexicalHooks-eqXJbnX9.js → lexicalHooks-Pqoe8h_O.js} +1 -1
- package/dist-embed/chunks/{lt-LT-XHIRWOB4-2v6r2YYq.js → lt-LT-XHIRWOB4-72Vmr8iW.js} +1 -1
- package/dist-embed/chunks/{lv-LV-5QDEKY6T-DVGd68q4.js → lv-LV-5QDEKY6T-CxtO97qO.js} +1 -1
- package/dist-embed/chunks/{mermaid.core-DY5DKOtx.js → mermaid.core-CAzPWd8O.js} +3 -3
- package/dist-embed/chunks/{mermaid.core-BU1Nkb56.js → mermaid.core-DaZxhAXO.js} +5 -5
- package/dist-embed/chunks/{mindmap-definition-YA3MSWOX-sSfUfKt8.js → mindmap-definition-YA3MSWOX-D8W0sJ7P.js} +1 -1
- package/dist-embed/chunks/{mindmap-definition-YA3MSWOX-CEuIjXO2.js → mindmap-definition-YA3MSWOX-DPl-uWpT.js} +1 -1
- package/dist-embed/chunks/{mindmap-definition-e4c1d938-btrk6STt.js → mindmap-definition-e4c1d938-CGXwlH4A.js} +1 -1
- package/dist-embed/chunks/{mr-IN-CRQNXWMA-D1q8zjMr.js → mr-IN-CRQNXWMA-BNGEl_QE.js} +1 -1
- package/dist-embed/chunks/{my-MM-5M5IBNSE-CCWuEpIN.js → my-MM-5M5IBNSE-4wIAMvGF.js} +1 -1
- package/dist-embed/chunks/{nb-NO-T6EIAALU-eJ92wx2h.js → nb-NO-T6EIAALU-z-1s9yX9.js} +1 -1
- package/dist-embed/chunks/{nl-NL-IS3SIHDZ-DmkMgsvp.js → nl-NL-IS3SIHDZ-CYKGEVB8.js} +1 -1
- package/dist-embed/chunks/{nn-NO-6E72VCQL-CWYEaXBn.js → nn-NO-6E72VCQL-DwQFIFpO.js} +1 -1
- package/dist-embed/chunks/{oc-FR-POXYY2M6-CayriaEZ.js → oc-FR-POXYY2M6-mH2n3eM_.js} +1 -1
- package/dist-embed/chunks/{pa-IN-N4M65BXN-CydiKcR8.js → pa-IN-N4M65BXN-DbixE6jQ.js} +1 -1
- package/dist-embed/chunks/{pegDiagram-XKGWAZYB-CqRRvKft.js → pegDiagram-XKGWAZYB-D3qs3UBw.js} +1 -1
- package/dist-embed/chunks/{pegDiagram-XKGWAZYB--dcG-x2B.js → pegDiagram-XKGWAZYB-DJmZupPa.js} +1 -1
- package/dist-embed/chunks/{percentages-BXMCSKIN-fzYCDL7m.js → percentages-BXMCSKIN-5Q9KX_WU.js} +5 -5
- package/dist-embed/chunks/{pieDiagram-E7YTZNPT-CkHpKSua.js → pieDiagram-E7YTZNPT-C58cd6s7.js} +1 -1
- package/dist-embed/chunks/{pieDiagram-E7YTZNPT-D-uncTun.js → pieDiagram-E7YTZNPT-CrZQ-dOy.js} +1 -1
- package/dist-embed/chunks/{pieDiagram-c941bede-BoVaJIdw.js → pieDiagram-c941bede-Dn3GMx6q.js} +1 -1
- package/dist-embed/chunks/{pl-PL-T2D74RX3-DhiK4YSC.js → pl-PL-T2D74RX3-jOVonFYe.js} +1 -1
- package/dist-embed/chunks/{pt-BR-5N22H2LF-CwSVxIqs.js → pt-BR-5N22H2LF-Cx4MrqgK.js} +1 -1
- package/dist-embed/chunks/{pt-PT-UZXXM6DQ-BnxquNJT.js → pt-PT-UZXXM6DQ-B2PzNwuF.js} +1 -1
- package/dist-embed/chunks/{quadrantDiagram-AXDQQJYC-nOA8Q9nG.js → quadrantDiagram-AXDQQJYC-CJn8hkR8.js} +1 -1
- package/dist-embed/chunks/{quadrantDiagram-AXDQQJYC-ClE_bWPS.js → quadrantDiagram-AXDQQJYC-haT-kxqE.js} +1 -1
- package/dist-embed/chunks/{quadrantDiagram-cf8b8fe0-V_e2KgDu.js → quadrantDiagram-cf8b8fe0-B3wudq14.js} +1 -1
- package/dist-embed/chunks/{railroadDiagram-O6MQD6OU-CkhmY0tS.js → railroadDiagram-O6MQD6OU-T23yIHww.js} +1 -1
- package/dist-embed/chunks/{railroadDiagram-O6MQD6OU-D-SNyKIn.js → railroadDiagram-O6MQD6OU-Ty6XXjBy.js} +1 -1
- package/dist-embed/chunks/{renderer-BwlsmtXF.js → renderer-Au1S-H5k.js} +1 -1
- package/dist-embed/chunks/{requirementDiagram-53bda41b-BZw7Ipej.js → requirementDiagram-53bda41b-B-eAYQ6c.js} +1 -1
- package/dist-embed/chunks/{requirementDiagram-BXWQKSXE-BXwXUXrr.js → requirementDiagram-BXWQKSXE-CgkHdmYF.js} +1 -1
- package/dist-embed/chunks/{requirementDiagram-BXWQKSXE-1A97ivzl.js → requirementDiagram-BXWQKSXE-fpBmgh7Q.js} +1 -1
- package/dist-embed/chunks/{ro-RO-JPDTUUEW-D3G2f_fQ.js → ro-RO-JPDTUUEW-BCQxuLcc.js} +1 -1
- package/dist-embed/chunks/{ru-RU-B4JR7IUQ-SnVfNwaW.js → ru-RU-B4JR7IUQ-CqSiHvqj.js} +1 -1
- package/dist-embed/chunks/{sankeyDiagram-P5KCCOFB-ktT6v9aY.js → sankeyDiagram-P5KCCOFB-DEGMK43Q.js} +1 -1
- package/dist-embed/chunks/{sankeyDiagram-P5KCCOFB-0B_Kvjm2.js → sankeyDiagram-P5KCCOFB-hDbZE81L.js} +1 -1
- package/dist-embed/chunks/{sankeyDiagram-c3ef121a-e1QLivkZ.js → sankeyDiagram-c3ef121a-O14jOeqO.js} +1 -1
- package/dist-embed/chunks/{sequenceDiagram-82a5b84f-N-16oABv.js → sequenceDiagram-82a5b84f-BFFzLElQ.js} +1 -1
- package/dist-embed/chunks/{sequenceDiagram-WJ2MYXX4-CtbkJYCv.js → sequenceDiagram-WJ2MYXX4-MrC4K4SC.js} +1 -1
- package/dist-embed/chunks/{sequenceDiagram-WJ2MYXX4-DYY-dZgX.js → sequenceDiagram-WJ2MYXX4-wongMGVN.js} +1 -1
- package/dist-embed/chunks/{sessions-C9DBCyZI.js → sessions-BRALW9Yv.js} +1 -1
- package/dist-embed/chunks/{si-LK-N5RQ5JYF-Da7Bfexz.js → si-LK-N5RQ5JYF-Dbgk5YHt.js} +1 -1
- package/dist-embed/chunks/{sizeCapture-INFHLROL-B3xt8UaI.js → sizeCapture-INFHLROL-CiOiAAo5.js} +1 -1
- package/dist-embed/chunks/{sizeCapture-INFHLROL-DJOph387.js → sizeCapture-INFHLROL-j4-sCda0.js} +1 -1
- package/dist-embed/chunks/{sk-SK-C5VTKIMK-BB-Ks1b-.js → sk-SK-C5VTKIMK-OBAaNvVw.js} +1 -1
- package/dist-embed/chunks/{sl-SI-NN7IZMDC-DF3fUKHX.js → sl-SI-NN7IZMDC-DqLxi4IM.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-43e79a5f-BJcJNr41.js → stateDiagram-43e79a5f-BZm5gFdu.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-D77RDMKH-LjWP-fRB.js → stateDiagram-D77RDMKH-D7_xyy8n.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-D77RDMKH-DVd0MOrg.js → stateDiagram-D77RDMKH-DXrbH1aM.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-v2-2041ed4f-DTEruWg2.js → stateDiagram-v2-2041ed4f-DiXOgJsK.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-v2-MP3YSRHH-CJD5_Eji.js → stateDiagram-v2-MP3YSRHH-DLsY6ysL.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-v2-MP3YSRHH-_xCQcvgo.js → stateDiagram-v2-MP3YSRHH-ngWpJn6k.js} +1 -1
- package/dist-embed/chunks/{styles-455b33cd-OIhmfs6N.js → styles-455b33cd-CrHizSU7.js} +1 -1
- package/dist-embed/chunks/{styles-f932cba9-CwLjreIv.js → styles-f932cba9-YuCN7fSa.js} +1 -1
- package/dist-embed/chunks/{styles-fcc2142b-DP74dQpR.js → styles-fcc2142b-tjrOPOh4.js} +1 -1
- package/dist-embed/chunks/{subset-shared.chunk-Cf9zgTA9.js → subset-shared.chunk-Du2agLgk.js} +1 -1
- package/dist-embed/chunks/{subset-worker.chunk-WYW3AHku.js → subset-worker.chunk-BXR8pgHc.js} +1 -1
- package/dist-embed/chunks/{sv-SE-XGPEYMSR-CeR-pJHy.js → sv-SE-XGPEYMSR-BbgHKxhC.js} +1 -1
- package/dist-embed/chunks/{svgDrawCommon-148a3cd9-CgE5QJIv.js → svgDrawCommon-148a3cd9-DTqtvo5_.js} +1 -1
- package/dist-embed/chunks/{swimlanes-42K2YHIH-CZyflHYJ.js → swimlanes-42K2YHIH-B289Mbni.js} +1 -1
- package/dist-embed/chunks/{swimlanes-42K2YHIH-Cj4fdAYa.js → swimlanes-42K2YHIH-B3H_wpMu.js} +1 -1
- package/dist-embed/chunks/{swimlanesDiagram-VR7AAH4N-B2gk37ys.js → swimlanesDiagram-VR7AAH4N-D0ZHzw-_.js} +1 -1
- package/dist-embed/chunks/{swimlanesDiagram-VR7AAH4N-Bmr6N4fj.js → swimlanesDiagram-VR7AAH4N-qWg-2xN_.js} +1 -1
- package/dist-embed/chunks/{ta-IN-2NMHFXQM-lmsodGuU.js → ta-IN-2NMHFXQM-0pH7gQyu.js} +1 -1
- package/dist-embed/chunks/{th-TH-HPSO5L25-DQCWr96I.js → th-TH-HPSO5L25-Dvbu09CU.js} +1 -1
- package/dist-embed/chunks/{timeline-definition-24CTP7MA-DqY5EM6p.js → timeline-definition-24CTP7MA-DUc18SdK.js} +1 -1
- package/dist-embed/chunks/{timeline-definition-24CTP7MA-D5dMAy5U.js → timeline-definition-24CTP7MA-DpMq7g2g.js} +1 -1
- package/dist-embed/chunks/{timeline-definition-7545f45a-B8wMEyZY.js → timeline-definition-7545f45a--4ypi4BE.js} +1 -1
- package/dist-embed/chunks/{tr-TR-DEFEU3FU-CqnvlGZW.js → tr-TR-DEFEU3FU-B6YS3iEB.js} +1 -1
- package/dist-embed/chunks/{uk-UA-QMV73CPH-DdWFjbHe.js → uk-UA-QMV73CPH-DMG9vIVp.js} +1 -1
- package/dist-embed/chunks/{vennDiagram-4TSXK5OY-63-O_xI8.js → vennDiagram-4TSXK5OY-CS12EGJw.js} +1 -1
- package/dist-embed/chunks/{vennDiagram-4TSXK5OY-BMg6wc5A.js → vennDiagram-4TSXK5OY-CvEXE1xX.js} +1 -1
- package/dist-embed/chunks/{vi-VN-M7AON7JQ-CydTT0Fi.js → vi-VN-M7AON7JQ-DB3ZrpeP.js} +1 -1
- package/dist-embed/chunks/{wardleyDiagram-VM6X3IG4-C5wMQ_qe.js → wardleyDiagram-VM6X3IG4-8LfGni9_.js} +1 -1
- package/dist-embed/chunks/{wardleyDiagram-VM6X3IG4-C9vLUvHf.js → wardleyDiagram-VM6X3IG4-Bj02LzjH.js} +1 -1
- package/dist-embed/chunks/{xychartDiagram-3f383b91-BfoQg8n9.js → xychartDiagram-3f383b91-CE_OY5QR.js} +1 -1
- package/dist-embed/chunks/{xychartDiagram-S5SC5T6Z-BZr3T3n_.js → xychartDiagram-S5SC5T6Z-BdZi5x4a.js} +1 -1
- package/dist-embed/chunks/{xychartDiagram-S5SC5T6Z-DthHDnAV.js → xychartDiagram-S5SC5T6Z-DXqC0l3r.js} +1 -1
- package/dist-embed/chunks/{zh-CN-LNUGB5OW-DEn1TFfK.js → zh-CN-LNUGB5OW-VV-lg83H.js} +1 -1
- package/dist-embed/chunks/{zh-HK-E62DVLB3-DJQRmOHH.js → zh-HK-E62DVLB3-DLoyC6Q9.js} +1 -1
- package/dist-embed/chunks/{zh-TW-RAJ6MFWO-B7s9vmSf.js → zh-TW-RAJ6MFWO-DhFllgOW.js} +1 -1
- package/dist-embed/datalayer-app-main.js +21 -21
- package/lib/apps/apps/records.d.ts +0 -29
- package/lib/apps/apps/records.js +11 -34
- package/lib/apps/apps/threads.d.ts +2 -21
- package/lib/apps/apps/threads.js +0 -75
- package/lib/apps/embed/embedSession.d.ts +0 -8
- package/lib/apps/embed/embedSession.js +1 -38
- package/lib/apps/embed/visitorApp.d.ts +22 -3
- package/lib/apps/embed/visitorApp.js +42 -4
- package/lib/apps/plugins/chat/ChatView.js +2 -1
- package/lib/chat/base/ChatBase.js +1 -1
- package/lib/chat/base/fullContextMessages.js +1 -1
- package/lib/hooks/useAgUi.js +1 -1
- package/lib/hooks/useToolApprovals.d.ts +1 -1
- package/lib/hooks/useToolApprovals.js +1 -1
- package/lib/{protocols → portable}/agUiRefusal.d.ts +1 -1
- package/lib/{protocols → portable}/agUiRefusal.js +1 -1
- package/lib/portable/agui.d.ts +72 -0
- package/lib/portable/agui.js +174 -0
- package/lib/portable/conversation.d.ts +124 -0
- package/lib/portable/conversation.js +357 -0
- package/lib/portable/index.d.ts +11 -6
- package/lib/portable/index.js +14 -11
- package/lib/portable/records.d.ts +27 -0
- package/lib/portable/records.js +46 -0
- package/lib/portable/sessions.d.ts +92 -0
- package/lib/portable/sessions.js +134 -0
- package/lib/portable/thread.d.ts +41 -0
- package/lib/portable/thread.js +102 -0
- package/lib/protocols/AGUIAdapter.d.ts +0 -2
- package/lib/protocols/AGUIAdapter.js +39 -74
- package/package.json +1 -1
- package/dist-embed/chunks/ChatView-fHb_i4kH.js +0 -32
- /package/lib/{utils → portable}/approvals.d.ts +0 -0
- /package/lib/{utils → portable}/approvals.js +0 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/** What the page says when a run's stream closes before the run said how it ended. */
|
|
6
|
+
export const RUN_CUT_SHORT = 'The run stopped before it finished, without an answer or an error: send it again.';
|
|
7
|
+
/**
|
|
8
|
+
* The name of `reactor.ui` (Reactor's `AGUI_NAME`): its ops come over the
|
|
9
|
+
* conversation's ui socket, never a run stream (REACTOR_UI RU-W). Held here
|
|
10
|
+
* so that a reader of a run needs no Reactor module; a test holds it to
|
|
11
|
+
* Reactor's.
|
|
12
|
+
*/
|
|
13
|
+
export const REACTOR_UI_NAME = 'reactor.ui';
|
|
14
|
+
/** What the page says when a `reactor.ui` op comes on a run stream. */
|
|
15
|
+
export const UI_ON_RUN = 'A reactor.ui op came on the run stream: it comes over the ui socket (REACTOR_UI RU-W).';
|
|
16
|
+
/** What is said when the `fetch` given cannot read a response as it streams. */
|
|
17
|
+
export const NOT_STREAMING = 'This fetch does not stream a response: give one whose response body has getReader (expo/fetch on a phone).';
|
|
18
|
+
/** Whether an event ends a run: the run said how it ended. */
|
|
19
|
+
export const endsRun = (event) => event.type === 'RUN_FINISHED' || event.type === 'RUN_ERROR';
|
|
20
|
+
/**
|
|
21
|
+
* The `text/event-stream` of a run, read as it arrives: text in, one AG-UI
|
|
22
|
+
* event out per frame. A frame is its `data:` lines up to a blank line; a
|
|
23
|
+
* frame whose data is not JSON is handed to `malformed`, never guessed at.
|
|
24
|
+
*/
|
|
25
|
+
export class AgUiFrames {
|
|
26
|
+
malformed;
|
|
27
|
+
buffer = '';
|
|
28
|
+
data = [];
|
|
29
|
+
constructor(malformed = () => { }) {
|
|
30
|
+
this.malformed = malformed;
|
|
31
|
+
}
|
|
32
|
+
/** The events the text completes. */
|
|
33
|
+
push(text) {
|
|
34
|
+
this.buffer += text;
|
|
35
|
+
const lines = this.buffer.split(/\r?\n/);
|
|
36
|
+
this.buffer = lines.pop() ?? '';
|
|
37
|
+
const events = [];
|
|
38
|
+
for (const line of lines) {
|
|
39
|
+
this.line(line, events);
|
|
40
|
+
}
|
|
41
|
+
return events;
|
|
42
|
+
}
|
|
43
|
+
/** The events left when the stream closes: a last frame without its blank line. */
|
|
44
|
+
end() {
|
|
45
|
+
const events = [];
|
|
46
|
+
if (this.buffer) {
|
|
47
|
+
this.line(this.buffer, events);
|
|
48
|
+
this.buffer = '';
|
|
49
|
+
}
|
|
50
|
+
this.dispatch(events);
|
|
51
|
+
return events;
|
|
52
|
+
}
|
|
53
|
+
line(line, events) {
|
|
54
|
+
if (line === '') {
|
|
55
|
+
this.dispatch(events);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (line.startsWith('data:')) {
|
|
59
|
+
const value = line.slice('data:'.length);
|
|
60
|
+
this.data.push(value.startsWith(' ') ? value.slice(1) : value);
|
|
61
|
+
}
|
|
62
|
+
// `event:`, `id:`, `retry:` and comments name nothing AG-UI reads.
|
|
63
|
+
}
|
|
64
|
+
dispatch(events) {
|
|
65
|
+
if (!this.data.length) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const data = this.data.join('\n');
|
|
69
|
+
this.data = [];
|
|
70
|
+
let parsed;
|
|
71
|
+
try {
|
|
72
|
+
parsed = JSON.parse(data);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
this.malformed(data);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (parsed &&
|
|
79
|
+
typeof parsed === 'object' &&
|
|
80
|
+
typeof parsed.type === 'string') {
|
|
81
|
+
events.push(parsed);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
this.malformed(data);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** Every event a complete stream's text holds: a stream already read whole. */
|
|
89
|
+
export function eventsOfStream(text) {
|
|
90
|
+
const frames = new AgUiFrames();
|
|
91
|
+
return [...frames.push(text), ...frames.end()];
|
|
92
|
+
}
|
|
93
|
+
/** A text decoder that keeps a character split between two chunks whole. */
|
|
94
|
+
function decoderOf() {
|
|
95
|
+
if (typeof TextDecoder === 'undefined') {
|
|
96
|
+
throw new Error('This JavaScript runtime has no TextDecoder to read a run stream with.');
|
|
97
|
+
}
|
|
98
|
+
const decoder = new TextDecoder();
|
|
99
|
+
return chunk => typeof chunk === 'string' ? chunk : decoder.decode(chunk, { stream: true });
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Read a run's stream to its end, each event handed to `onEvent` as it
|
|
103
|
+
* arrives. Throws `RUN_CUT_SHORT` when the stream closes before the run said
|
|
104
|
+
* how it ended, and `NOT_STREAMING` for a response that cannot be read as it
|
|
105
|
+
* streams. An abort ends the reading with the caller's `AbortError`.
|
|
106
|
+
*/
|
|
107
|
+
export async function readRunStream(response, onEvent, malformed) {
|
|
108
|
+
const body = response.body;
|
|
109
|
+
if (!body || typeof body.getReader !== 'function') {
|
|
110
|
+
throw new Error(NOT_STREAMING);
|
|
111
|
+
}
|
|
112
|
+
const reader = body.getReader();
|
|
113
|
+
const decode = decoderOf();
|
|
114
|
+
const frames = new AgUiFrames(malformed);
|
|
115
|
+
let ended = false;
|
|
116
|
+
const handle = (events) => {
|
|
117
|
+
for (const event of events) {
|
|
118
|
+
if (endsRun(event)) {
|
|
119
|
+
ended = true;
|
|
120
|
+
}
|
|
121
|
+
onEvent(event);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
try {
|
|
125
|
+
for (;;) {
|
|
126
|
+
const { done, value } = await reader.read();
|
|
127
|
+
if (done) {
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
if (value !== undefined) {
|
|
131
|
+
handle(frames.push(decode(value)));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
handle(frames.end());
|
|
135
|
+
}
|
|
136
|
+
finally {
|
|
137
|
+
reader.releaseLock();
|
|
138
|
+
}
|
|
139
|
+
if (!ended) {
|
|
140
|
+
throw new Error(RUN_CUT_SHORT);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A tool result's content, read as the chat reads it: JSON when it is JSON,
|
|
145
|
+
* and failed when the execution result says so (`execution_ok: false`, a
|
|
146
|
+
* `code_error`, or an `error` without `success`).
|
|
147
|
+
*/
|
|
148
|
+
export function toolResultOf(content) {
|
|
149
|
+
let result = content;
|
|
150
|
+
if (typeof result === 'string') {
|
|
151
|
+
try {
|
|
152
|
+
result = JSON.parse(result);
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
// Words, kept as they are.
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const said = result && typeof result === 'object'
|
|
159
|
+
? result
|
|
160
|
+
: undefined;
|
|
161
|
+
const failed = said?.execution_ok === false ||
|
|
162
|
+
said?.code_error != null ||
|
|
163
|
+
(said?.error != null && !said?.success);
|
|
164
|
+
if (!failed) {
|
|
165
|
+
return { result, success: true };
|
|
166
|
+
}
|
|
167
|
+
const codeError = said?.code_error;
|
|
168
|
+
const error = (typeof said?.execution_error === 'string' && said.execution_error) ||
|
|
169
|
+
(typeof said?.error === 'string' && said.error) ||
|
|
170
|
+
(codeError
|
|
171
|
+
? `${codeError.name || 'Error'}: ${codeError.value || ''}`
|
|
172
|
+
: undefined);
|
|
173
|
+
return { result, success: false, error };
|
|
174
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A conversation as a run stream builds it, for a client that draws it
|
|
3
|
+
* natively (Datalayer Mobile): one pure reducer over the AG-UI events of an
|
|
4
|
+
* application's session or an agent's run, and the person's own actions.
|
|
5
|
+
*
|
|
6
|
+
* It reads the stream as the web chat reads it — `TEXT_MESSAGE_*` into one
|
|
7
|
+
* message streamed in place, `TOOL_CALL_*` into a collapsed row whose result
|
|
8
|
+
* is read by `toolResultOf`, `STEP_*` into a step row, a `MESSAGES_SNAPSHOT`
|
|
9
|
+
* through `messagesOfThread`, a `reactor.ui` op on the run refused — and adds
|
|
10
|
+
* what a session says besides: `loop.session`, the question its application
|
|
11
|
+
* asks (`RUN_FINISHED` with `result.asking`, LOOP `loop.ask`), and a turn
|
|
12
|
+
* that ended without words said by how it ended (`answered`, `stopped`,
|
|
13
|
+
* `gone`).
|
|
14
|
+
*
|
|
15
|
+
* Bounded: a long tool run cannot grow it without end. Each tool's arguments
|
|
16
|
+
* and result keep their first `TOOL_TEXT_LIMIT` characters, an answer its
|
|
17
|
+
* first `MESSAGE_TEXT_LIMIT`, the conversation its last `ITEM_LIMIT` rows
|
|
18
|
+
* (`dropped` counts the rest), and an event it does not draw is kept only as
|
|
19
|
+
* its type and name, the last `DIAGNOSTIC_LIMIT` of them — never its payload.
|
|
20
|
+
*
|
|
21
|
+
* @module portable/conversation
|
|
22
|
+
*/
|
|
23
|
+
import { type AgUiEvent } from './agui';
|
|
24
|
+
/** How many rows a conversation keeps: its newest. */
|
|
25
|
+
export declare const ITEM_LIMIT = 400;
|
|
26
|
+
/** How many characters of an answer are kept. */
|
|
27
|
+
export declare const MESSAGE_TEXT_LIMIT = 100000;
|
|
28
|
+
/** How many characters of a tool's arguments, and of its result, are kept. */
|
|
29
|
+
export declare const TOOL_TEXT_LIMIT = 4000;
|
|
30
|
+
/** How many events it does not draw are kept, by type and name. */
|
|
31
|
+
export declare const DIAGNOSTIC_LIMIT = 50;
|
|
32
|
+
/** What is said after a text cut at its limit. */
|
|
33
|
+
export declare const CUT_MARK = "\u2026 (cut: too long to keep on this device)";
|
|
34
|
+
/** How a turn ended without words of its own: `RUN_END_WORDS`'s. */
|
|
35
|
+
export type TurnEnd = 'answered' | 'stopped' | 'gone';
|
|
36
|
+
/** One row of a conversation. */
|
|
37
|
+
export type ConversationItem = {
|
|
38
|
+
kind: 'message';
|
|
39
|
+
id: string;
|
|
40
|
+
role: 'user' | 'assistant';
|
|
41
|
+
text: string;
|
|
42
|
+
/** Its words are still arriving. */
|
|
43
|
+
streaming: boolean;
|
|
44
|
+
} | {
|
|
45
|
+
kind: 'tool';
|
|
46
|
+
id: string;
|
|
47
|
+
name: string;
|
|
48
|
+
/** Its arguments as they streamed: JSON, cut at its limit. */
|
|
49
|
+
args: string;
|
|
50
|
+
status: 'running' | 'complete' | 'error';
|
|
51
|
+
/** Its result in words, cut at its limit. */
|
|
52
|
+
result: string;
|
|
53
|
+
error: string;
|
|
54
|
+
} | {
|
|
55
|
+
kind: 'step';
|
|
56
|
+
id: string;
|
|
57
|
+
name: string;
|
|
58
|
+
status: 'running' | 'complete';
|
|
59
|
+
} | {
|
|
60
|
+
kind: 'end';
|
|
61
|
+
id: string;
|
|
62
|
+
end: TurnEnd;
|
|
63
|
+
words: string;
|
|
64
|
+
} | {
|
|
65
|
+
kind: 'error';
|
|
66
|
+
id: string;
|
|
67
|
+
text: string;
|
|
68
|
+
};
|
|
69
|
+
/** What an application asks the person (`loop.ask`): its kind and what answers it. */
|
|
70
|
+
export type ConversationQuestion = {
|
|
71
|
+
kind: 'text' | 'choice' | 'form' | 'file';
|
|
72
|
+
prompt: string;
|
|
73
|
+
/** A choice's options. */
|
|
74
|
+
options: string[];
|
|
75
|
+
/** A form's JSON Schema. */
|
|
76
|
+
schema: Record<string, unknown> | null;
|
|
77
|
+
/** A file's kinds. */
|
|
78
|
+
accept: string[];
|
|
79
|
+
};
|
|
80
|
+
/** A conversation, as the stream and the person built it. */
|
|
81
|
+
export type ConversationState = {
|
|
82
|
+
items: ConversationItem[];
|
|
83
|
+
/** A turn is streaming. */
|
|
84
|
+
running: boolean;
|
|
85
|
+
/** The session as `loop.session` said it last, or `null` (an agent's run). */
|
|
86
|
+
session: Record<string, unknown> | null;
|
|
87
|
+
/** What the application waits for an answer to, or `null`. */
|
|
88
|
+
asking: ConversationQuestion | null;
|
|
89
|
+
/** How many of its oldest rows were not kept. */
|
|
90
|
+
dropped: number;
|
|
91
|
+
/** The events it does not draw, by type and name only. */
|
|
92
|
+
diagnostics: {
|
|
93
|
+
type: string;
|
|
94
|
+
name: string;
|
|
95
|
+
}[];
|
|
96
|
+
/** How many rows the turn streaming added: whether it said anything. */
|
|
97
|
+
turnRows: number;
|
|
98
|
+
};
|
|
99
|
+
/** A conversation with nothing in it yet. */
|
|
100
|
+
export declare const emptyConversation: () => ConversationState;
|
|
101
|
+
/** The question an application asks, as `RUN_FINISHED`'s `result.asking` or a session says it. */
|
|
102
|
+
export declare function questionOf(raw: unknown): ConversationQuestion | null;
|
|
103
|
+
/** The person's prompt, added before it is sent: its own row. */
|
|
104
|
+
export declare function withPrompt(state: ConversationState, id: string, words: string): ConversationState;
|
|
105
|
+
/**
|
|
106
|
+
* The turn ended without the stream saying so: the person stopped it
|
|
107
|
+
* (`stopped`), or its client went before the answer (`gone`). What streamed
|
|
108
|
+
* stops streaming; a turn that said nothing is said by how it ended.
|
|
109
|
+
*/
|
|
110
|
+
export declare function withTurnEnded(state: ConversationState, end: Exclude<TurnEnd, 'answered'>): ConversationState;
|
|
111
|
+
/** A failure said in the conversation (a refusal, a stream cut short): the turn stops with it. */
|
|
112
|
+
export declare function withError(state: ConversationState, words: string): ConversationState;
|
|
113
|
+
/** A conversation with one more event of its stream. */
|
|
114
|
+
export declare function reduceConversation(state: ConversationState, event: AgUiEvent): ConversationState;
|
|
115
|
+
/** The question in words with what answers it, for a screen reader or a row. */
|
|
116
|
+
export declare function questionWords(question: ConversationQuestion): string;
|
|
117
|
+
/** The fields a form question asks, in order, with their titles: what a native form draws. */
|
|
118
|
+
export declare function formFieldsOf(schema: Record<string, unknown> | null): {
|
|
119
|
+
name: string;
|
|
120
|
+
title: string;
|
|
121
|
+
type: string;
|
|
122
|
+
options: string[];
|
|
123
|
+
required: boolean;
|
|
124
|
+
}[];
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* A conversation as a run stream builds it, for a client that draws it
|
|
7
|
+
* natively (Datalayer Mobile): one pure reducer over the AG-UI events of an
|
|
8
|
+
* application's session or an agent's run, and the person's own actions.
|
|
9
|
+
*
|
|
10
|
+
* It reads the stream as the web chat reads it — `TEXT_MESSAGE_*` into one
|
|
11
|
+
* message streamed in place, `TOOL_CALL_*` into a collapsed row whose result
|
|
12
|
+
* is read by `toolResultOf`, `STEP_*` into a step row, a `MESSAGES_SNAPSHOT`
|
|
13
|
+
* through `messagesOfThread`, a `reactor.ui` op on the run refused — and adds
|
|
14
|
+
* what a session says besides: `loop.session`, the question its application
|
|
15
|
+
* asks (`RUN_FINISHED` with `result.asking`, LOOP `loop.ask`), and a turn
|
|
16
|
+
* that ended without words said by how it ended (`answered`, `stopped`,
|
|
17
|
+
* `gone`).
|
|
18
|
+
*
|
|
19
|
+
* Bounded: a long tool run cannot grow it without end. Each tool's arguments
|
|
20
|
+
* and result keep their first `TOOL_TEXT_LIMIT` characters, an answer its
|
|
21
|
+
* first `MESSAGE_TEXT_LIMIT`, the conversation its last `ITEM_LIMIT` rows
|
|
22
|
+
* (`dropped` counts the rest), and an event it does not draw is kept only as
|
|
23
|
+
* its type and name, the last `DIAGNOSTIC_LIMIT` of them — never its payload.
|
|
24
|
+
*
|
|
25
|
+
* @module portable/conversation
|
|
26
|
+
*/
|
|
27
|
+
import { REACTOR_UI_NAME, toolResultOf, UI_ON_RUN, } from './agui';
|
|
28
|
+
import { RUN_END_WORDS } from './records';
|
|
29
|
+
import { messagesOfThread } from './thread';
|
|
30
|
+
/** How many rows a conversation keeps: its newest. */
|
|
31
|
+
export const ITEM_LIMIT = 400;
|
|
32
|
+
/** How many characters of an answer are kept. */
|
|
33
|
+
export const MESSAGE_TEXT_LIMIT = 100_000;
|
|
34
|
+
/** How many characters of a tool's arguments, and of its result, are kept. */
|
|
35
|
+
export const TOOL_TEXT_LIMIT = 4_000;
|
|
36
|
+
/** How many events it does not draw are kept, by type and name. */
|
|
37
|
+
export const DIAGNOSTIC_LIMIT = 50;
|
|
38
|
+
/** What is said after a text cut at its limit. */
|
|
39
|
+
export const CUT_MARK = '… (cut: too long to keep on this device)';
|
|
40
|
+
/** A conversation with nothing in it yet. */
|
|
41
|
+
export const emptyConversation = () => ({
|
|
42
|
+
items: [],
|
|
43
|
+
running: false,
|
|
44
|
+
session: null,
|
|
45
|
+
asking: null,
|
|
46
|
+
dropped: 0,
|
|
47
|
+
diagnostics: [],
|
|
48
|
+
turnRows: 0,
|
|
49
|
+
});
|
|
50
|
+
const text = (value) => typeof value === 'string' ? value : '';
|
|
51
|
+
const cut = (value, limit) => value.length > limit ? `${value.slice(0, limit)}${CUT_MARK}` : value;
|
|
52
|
+
/** Text appended to what is kept, never past its limit. */
|
|
53
|
+
const appended = (kept, delta, limit) => {
|
|
54
|
+
if (kept.endsWith(CUT_MARK)) {
|
|
55
|
+
return kept;
|
|
56
|
+
}
|
|
57
|
+
return cut(kept + delta, limit);
|
|
58
|
+
};
|
|
59
|
+
/** A result in words. */
|
|
60
|
+
function said(result) {
|
|
61
|
+
if (result === undefined || result === null) {
|
|
62
|
+
return '';
|
|
63
|
+
}
|
|
64
|
+
return typeof result === 'string' ? result : JSON.stringify(result);
|
|
65
|
+
}
|
|
66
|
+
/** The question an application asks, as `RUN_FINISHED`'s `result.asking` or a session says it. */
|
|
67
|
+
export function questionOf(raw) {
|
|
68
|
+
if (!raw || typeof raw !== 'object') {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
const asked = raw;
|
|
72
|
+
const kind = asked.kind;
|
|
73
|
+
if (kind !== 'text' &&
|
|
74
|
+
kind !== 'choice' &&
|
|
75
|
+
kind !== 'form' &&
|
|
76
|
+
kind !== 'file') {
|
|
77
|
+
throw new Error(`The application asks something no client knows: ${String(kind)}.`);
|
|
78
|
+
}
|
|
79
|
+
const strings = (value) => Array.isArray(value)
|
|
80
|
+
? value.filter((item) => typeof item === 'string')
|
|
81
|
+
: [];
|
|
82
|
+
const schema = asked.schema;
|
|
83
|
+
return {
|
|
84
|
+
kind,
|
|
85
|
+
prompt: text(asked.prompt),
|
|
86
|
+
options: strings(asked.options),
|
|
87
|
+
schema: schema && typeof schema === 'object' && !Array.isArray(schema)
|
|
88
|
+
? schema
|
|
89
|
+
: null,
|
|
90
|
+
accept: strings(asked.accept),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function withItems(state, items, added = 0) {
|
|
94
|
+
const over = items.length - ITEM_LIMIT;
|
|
95
|
+
return {
|
|
96
|
+
...state,
|
|
97
|
+
items: over > 0 ? items.slice(over) : items,
|
|
98
|
+
dropped: state.dropped + Math.max(0, over),
|
|
99
|
+
turnRows: state.turnRows + added,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function changed(state, id, change) {
|
|
103
|
+
const at = state.items.findIndex(item => item.id === id);
|
|
104
|
+
if (at < 0) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
const items = state.items.slice();
|
|
108
|
+
items[at] = change(items[at]);
|
|
109
|
+
return { ...state, items };
|
|
110
|
+
}
|
|
111
|
+
function noted(state, event) {
|
|
112
|
+
const entry = {
|
|
113
|
+
type: event.type,
|
|
114
|
+
name: text(event.name) || text(event.activityType),
|
|
115
|
+
};
|
|
116
|
+
return {
|
|
117
|
+
...state,
|
|
118
|
+
diagnostics: [...state.diagnostics, entry].slice(-DIAGNOSTIC_LIMIT),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
let rowCount = 0;
|
|
122
|
+
const rowId = (prefix) => `${prefix}-${Date.now().toString(36)}-${(rowCount += 1)}`;
|
|
123
|
+
/** The person's prompt, added before it is sent: its own row. */
|
|
124
|
+
export function withPrompt(state, id, words) {
|
|
125
|
+
return withItems({ ...state, asking: null }, [
|
|
126
|
+
...state.items,
|
|
127
|
+
{ kind: 'message', id, role: 'user', text: words, streaming: false },
|
|
128
|
+
]);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The turn ended without the stream saying so: the person stopped it
|
|
132
|
+
* (`stopped`), or its client went before the answer (`gone`). What streamed
|
|
133
|
+
* stops streaming; a turn that said nothing is said by how it ended.
|
|
134
|
+
*/
|
|
135
|
+
export function withTurnEnded(state, end) {
|
|
136
|
+
const items = state.items.map(item => item.kind === 'message' && item.streaming
|
|
137
|
+
? { ...item, streaming: false }
|
|
138
|
+
: item.kind === 'tool' && item.status === 'running'
|
|
139
|
+
? { ...item, status: 'error', error: RUN_END_WORDS[end] }
|
|
140
|
+
: item.kind === 'step' && item.status === 'running'
|
|
141
|
+
? { ...item, status: 'complete' }
|
|
142
|
+
: item);
|
|
143
|
+
const ended = { ...state, items, running: false };
|
|
144
|
+
return withItems(ended, [
|
|
145
|
+
...items,
|
|
146
|
+
{ kind: 'end', id: rowId('end'), end, words: RUN_END_WORDS[end] },
|
|
147
|
+
]);
|
|
148
|
+
}
|
|
149
|
+
/** A failure said in the conversation (a refusal, a stream cut short): the turn stops with it. */
|
|
150
|
+
export function withError(state, words) {
|
|
151
|
+
const items = state.items.map(item => item.kind === 'message' && item.streaming
|
|
152
|
+
? { ...item, streaming: false }
|
|
153
|
+
: item.kind === 'tool' && item.status === 'running'
|
|
154
|
+
? { ...item, status: 'error' }
|
|
155
|
+
: item.kind === 'step' && item.status === 'running'
|
|
156
|
+
? { ...item, status: 'complete' }
|
|
157
|
+
: item);
|
|
158
|
+
return withItems({ ...state, running: false }, [
|
|
159
|
+
...items,
|
|
160
|
+
{ kind: 'error', id: rowId('error'), text: words },
|
|
161
|
+
]);
|
|
162
|
+
}
|
|
163
|
+
/** A conversation with one more event of its stream. */
|
|
164
|
+
export function reduceConversation(state, event) {
|
|
165
|
+
switch (event.type) {
|
|
166
|
+
case 'RUN_STARTED':
|
|
167
|
+
return { ...state, running: true, asking: null, turnRows: 0 };
|
|
168
|
+
case 'TEXT_MESSAGE_START': {
|
|
169
|
+
const id = text(event.messageId) || rowId('message');
|
|
170
|
+
if (state.items.some(item => item.id === id)) {
|
|
171
|
+
return state;
|
|
172
|
+
}
|
|
173
|
+
const role = event.role === 'user' ? 'user' : 'assistant';
|
|
174
|
+
return withItems(state, [
|
|
175
|
+
...state.items,
|
|
176
|
+
{ kind: 'message', id, role, text: '', streaming: true },
|
|
177
|
+
], 1);
|
|
178
|
+
}
|
|
179
|
+
case 'TEXT_MESSAGE_CONTENT':
|
|
180
|
+
case 'TEXT_MESSAGE_CHUNK': {
|
|
181
|
+
const delta = text(event.delta);
|
|
182
|
+
const id = text(event.messageId);
|
|
183
|
+
const grown = changed(state, id, item => item.kind === 'message'
|
|
184
|
+
? { ...item, text: appended(item.text, delta, MESSAGE_TEXT_LIMIT) }
|
|
185
|
+
: item);
|
|
186
|
+
if (grown) {
|
|
187
|
+
return grown;
|
|
188
|
+
}
|
|
189
|
+
return withItems(state, [
|
|
190
|
+
...state.items,
|
|
191
|
+
{
|
|
192
|
+
kind: 'message',
|
|
193
|
+
id: id || rowId('message'),
|
|
194
|
+
role: event.role === 'user' ? 'user' : 'assistant',
|
|
195
|
+
text: cut(delta, MESSAGE_TEXT_LIMIT),
|
|
196
|
+
streaming: event.type === 'TEXT_MESSAGE_CONTENT',
|
|
197
|
+
},
|
|
198
|
+
], 1);
|
|
199
|
+
}
|
|
200
|
+
case 'TEXT_MESSAGE_END':
|
|
201
|
+
return (changed(state, text(event.messageId), item => item.kind === 'message' ? { ...item, streaming: false } : item) ?? state);
|
|
202
|
+
case 'TOOL_CALL_START': {
|
|
203
|
+
const id = text(event.toolCallId) || rowId('tool');
|
|
204
|
+
if (state.items.some(item => item.id === id)) {
|
|
205
|
+
return state;
|
|
206
|
+
}
|
|
207
|
+
return withItems(state, [
|
|
208
|
+
...state.items,
|
|
209
|
+
{
|
|
210
|
+
kind: 'tool',
|
|
211
|
+
id,
|
|
212
|
+
name: text(event.toolCallName) || text(event.name),
|
|
213
|
+
args: '',
|
|
214
|
+
status: 'running',
|
|
215
|
+
result: '',
|
|
216
|
+
error: '',
|
|
217
|
+
},
|
|
218
|
+
], 1);
|
|
219
|
+
}
|
|
220
|
+
case 'TOOL_CALL_ARGS':
|
|
221
|
+
return (changed(state, text(event.toolCallId), item => item.kind === 'tool'
|
|
222
|
+
? {
|
|
223
|
+
...item,
|
|
224
|
+
args: appended(item.args, text(event.delta), TOOL_TEXT_LIMIT),
|
|
225
|
+
}
|
|
226
|
+
: item) ?? state);
|
|
227
|
+
case 'TOOL_CALL_END':
|
|
228
|
+
return state;
|
|
229
|
+
case 'TOOL_CALL_RESULT': {
|
|
230
|
+
const result = toolResultOf(event.content);
|
|
231
|
+
return (changed(state, text(event.toolCallId), item => item.kind === 'tool'
|
|
232
|
+
? {
|
|
233
|
+
...item,
|
|
234
|
+
status: result.success ? 'complete' : 'error',
|
|
235
|
+
result: cut(said(result.result), TOOL_TEXT_LIMIT),
|
|
236
|
+
error: result.error ?? '',
|
|
237
|
+
}
|
|
238
|
+
: item) ?? noted(state, event));
|
|
239
|
+
}
|
|
240
|
+
case 'STEP_STARTED': {
|
|
241
|
+
const name = text(event.stepName) || text(event.name);
|
|
242
|
+
return withItems(state, [
|
|
243
|
+
...state.items,
|
|
244
|
+
{ kind: 'step', id: rowId('step'), name, status: 'running' },
|
|
245
|
+
], 1);
|
|
246
|
+
}
|
|
247
|
+
case 'STEP_FINISHED': {
|
|
248
|
+
const name = text(event.stepName) || text(event.name);
|
|
249
|
+
const at = state.items
|
|
250
|
+
.map((item, index) => ({ item, index }))
|
|
251
|
+
.reverse()
|
|
252
|
+
.find(({ item }) => item.kind === 'step' &&
|
|
253
|
+
item.name === name &&
|
|
254
|
+
item.status === 'running');
|
|
255
|
+
if (!at) {
|
|
256
|
+
return noted(state, event);
|
|
257
|
+
}
|
|
258
|
+
const items = state.items.slice();
|
|
259
|
+
items[at.index] = {
|
|
260
|
+
...at.item,
|
|
261
|
+
status: 'complete',
|
|
262
|
+
};
|
|
263
|
+
return { ...state, items };
|
|
264
|
+
}
|
|
265
|
+
case 'MESSAGES_SNAPSHOT': {
|
|
266
|
+
const messages = messagesOfThread(event.messages);
|
|
267
|
+
return withItems({ ...state, dropped: 0 }, messages.map(message => ({
|
|
268
|
+
kind: 'message',
|
|
269
|
+
id: message.id,
|
|
270
|
+
role: message.role === 'user'
|
|
271
|
+
? 'user'
|
|
272
|
+
: 'assistant',
|
|
273
|
+
text: cut(typeof message.content === 'string' ? message.content : '', MESSAGE_TEXT_LIMIT),
|
|
274
|
+
streaming: false,
|
|
275
|
+
})),
|
|
276
|
+
// The conversation said again is what this turn says (a resume):
|
|
277
|
+
// never also said as a wordless answer.
|
|
278
|
+
1);
|
|
279
|
+
}
|
|
280
|
+
case 'CUSTOM': {
|
|
281
|
+
if (event.name === REACTOR_UI_NAME) {
|
|
282
|
+
return withError(state, UI_ON_RUN);
|
|
283
|
+
}
|
|
284
|
+
if (event.name === 'loop.session' &&
|
|
285
|
+
event.value &&
|
|
286
|
+
typeof event.value === 'object') {
|
|
287
|
+
const session = event.value;
|
|
288
|
+
return {
|
|
289
|
+
...state,
|
|
290
|
+
session,
|
|
291
|
+
asking: questionOf(session.asking) ?? state.asking,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
return noted(state, event);
|
|
295
|
+
}
|
|
296
|
+
case 'ACTIVITY_SNAPSHOT':
|
|
297
|
+
case 'ACTIVITY_DELTA':
|
|
298
|
+
if (event.activityType === REACTOR_UI_NAME) {
|
|
299
|
+
return withError(state, UI_ON_RUN);
|
|
300
|
+
}
|
|
301
|
+
return noted(state, event);
|
|
302
|
+
case 'RUN_FINISHED': {
|
|
303
|
+
const result = event.result && typeof event.result === 'object'
|
|
304
|
+
? event.result
|
|
305
|
+
: {};
|
|
306
|
+
const asking = questionOf(result.asking);
|
|
307
|
+
const items = state.items.map(item => item.kind === 'message' && item.streaming
|
|
308
|
+
? { ...item, streaming: false }
|
|
309
|
+
: item);
|
|
310
|
+
const finished = { ...state, items, running: false, asking };
|
|
311
|
+
if (asking || state.turnRows > 0) {
|
|
312
|
+
return finished;
|
|
313
|
+
}
|
|
314
|
+
// Answered without a word: said by how it ended (RUN_END_WORDS).
|
|
315
|
+
return withItems(finished, [
|
|
316
|
+
...items,
|
|
317
|
+
{
|
|
318
|
+
kind: 'end',
|
|
319
|
+
id: rowId('end'),
|
|
320
|
+
end: 'answered',
|
|
321
|
+
words: RUN_END_WORDS.answered,
|
|
322
|
+
},
|
|
323
|
+
]);
|
|
324
|
+
}
|
|
325
|
+
case 'RUN_ERROR':
|
|
326
|
+
return withError(state, text(event.message) || 'Run failed');
|
|
327
|
+
default:
|
|
328
|
+
return noted(state, event);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
/** The question in words with what answers it, for a screen reader or a row. */
|
|
332
|
+
export function questionWords(question) {
|
|
333
|
+
switch (question.kind) {
|
|
334
|
+
case 'choice':
|
|
335
|
+
return `${question.prompt} (${question.options.join(' or ')})`;
|
|
336
|
+
case 'file':
|
|
337
|
+
return `${question.prompt} (a file: ${question.accept.join(', ') || 'any file'})`;
|
|
338
|
+
default:
|
|
339
|
+
return question.prompt;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
/** The fields a form question asks, in order, with their titles: what a native form draws. */
|
|
343
|
+
export function formFieldsOf(schema) {
|
|
344
|
+
const properties = schema?.properties && typeof schema.properties === 'object'
|
|
345
|
+
? schema.properties
|
|
346
|
+
: {};
|
|
347
|
+
const required = Array.isArray(schema?.required)
|
|
348
|
+
? schema?.required
|
|
349
|
+
: [];
|
|
350
|
+
return Object.entries(properties).map(([name, field]) => ({
|
|
351
|
+
name,
|
|
352
|
+
title: text(field?.title) || name,
|
|
353
|
+
type: text(field?.type) || 'string',
|
|
354
|
+
options: Array.isArray(field?.enum) ? field.enum.map(String) : [],
|
|
355
|
+
required: required.includes(name),
|
|
356
|
+
}));
|
|
357
|
+
}
|
package/lib/portable/index.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* What any JavaScript runtime can import from Agent Runtimes: no React, DOM,
|
|
3
|
-
* Jupyter or Node
|
|
4
|
-
*
|
|
3
|
+
* Jupyter, Reactor or Node module. Every module it reaches at run time lives
|
|
4
|
+
* in this folder (a test holds it to that), so that Datalayer Mobile's Metro
|
|
5
|
+
* graph takes `lib/portable/*` and nothing else of Agent Runtimes.
|
|
5
6
|
*
|
|
6
7
|
* @module portable
|
|
7
8
|
*/
|
|
8
|
-
export { messageOfApproval, normalizeApproval, whyAsked, type ApprovalArgs, type ApprovalRecord, type MessageAsked, } from '
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export
|
|
9
|
+
export { messageOfApproval, normalizeApproval, whyAsked, type ApprovalArgs, type ApprovalRecord, type MessageAsked, } from './approvals';
|
|
10
|
+
export { AgUiFrames, endsRun, eventsOfStream, NOT_STREAMING, REACTOR_UI_NAME, readRunStream, RUN_CUT_SHORT, toolResultOf, UI_ON_RUN, type AgUiEvent, type ToolResultSaid, } from './agui';
|
|
11
|
+
export { AG_UI_NOT_ALLOWED, AG_UI_NOT_ON_RUNTIME, agUiRefusal, refusalBody, refusalDetail, } from './agUiRefusal';
|
|
12
|
+
export { ASKED_FOR_TAG, askedOf, RUN_END_WORDS } from './records';
|
|
13
|
+
export { messagesOfThread, openThread, snapshotOfStream, THREAD_WORDS, } from './thread';
|
|
14
|
+
export { CUT_MARK, DIAGNOSTIC_LIMIT, emptyConversation, formFieldsOf, ITEM_LIMIT, MESSAGE_TEXT_LIMIT, questionOf, questionWords, reduceConversation, TOOL_TEXT_LIMIT, withError, withPrompt, withTurnEnded, type ConversationItem, type ConversationQuestion, type ConversationState, type TurnEnd, } from './conversation';
|
|
15
|
+
export { agentRunClient, agentRuntimesUrlOf, appSessionsClient, RuntimeRefusal, type AgentRunClient, type AgentTurn, type AppSessionsClient, type RuntimeClientOptions, type SessionStart, type StreamOptions, } from './sessions';
|
|
16
|
+
export type { ChatMessage } from '../types/messages';
|