@datalayer/agent-runtimes 1.6.89 → 1.6.91
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-DdSlGfQV.js → AgentDetails-syhFobKk.js} +5 -5
- package/dist-embed/chunks/{AgentDetailsDialog-C7rvaKS1.js → AgentDetailsDialog-CO8g0VoW.js} +1 -1
- package/dist-embed/chunks/{CellSidebarExtension-CrgdhbHy.js → CellSidebarExtension-B_Bqi3Eh.js} +1 -1
- package/dist-embed/chunks/{CollapsiblePlugin-ng8VFSwH.js → CollapsiblePlugin-DPGnrmLj.js} +1 -1
- package/dist-embed/chunks/{ContextPie-Duhkymga.js → ContextPie-h_II4EDU.js} +1 -1
- package/dist-embed/chunks/{DeckComponent-BhyoCP90.js → DeckComponent-oBh8nbTa.js} +2 -2
- package/dist-embed/chunks/{DocumentView-Dn2adk7S.js → DocumentView-C8G8fA7K.js} +1 -1
- package/dist-embed/chunks/{EphemeralDocument-BiQZswSQ.js → EphemeralDocument-Bm1w17Zw.js} +1 -1
- package/dist-embed/chunks/{EphemeralNotebook-C04wMmoE.js → EphemeralNotebook-jQ7FGCY-.js} +1 -1
- package/dist-embed/chunks/{ExcalidrawComponent-GkzKDk_S.js → ExcalidrawComponent-BgjhoJC3.js} +1 -1
- package/dist-embed/chunks/{ExcalidrawModal-Ct44VSBv.js → ExcalidrawModal-DtdsEiaS.js} +1 -1
- package/dist-embed/chunks/{JupyterLexicalExtension-BYde4Hzz.js → JupyterLexicalExtension-Dr8dgCst.js} +8 -8
- package/dist-embed/chunks/{KernelVariables-DvfwDxTX.js → KernelVariables-cH-x-Hrc.js} +1 -1
- package/dist-embed/chunks/{NotebookToolSurfaces-BvKDvb3M.js → NotebookToolSurfaces-BcIduPcQ.js} +1 -1
- package/dist-embed/chunks/{NotebookView-Wo8VVvUY.js → NotebookView-LJ0GBHTQ.js} +1 -1
- package/dist-embed/chunks/{Output-BmVt4DpZ.js → Output-Do1CYRIF.js} +1 -1
- package/dist-embed/chunks/{SandboxDetailsDialog-CCmkIp8x.js → SandboxDetailsDialog-DjP6mCWy.js} +1 -1
- package/dist-embed/chunks/{SchemaForm-YDAPV6Rb.js → SchemaForm-1QzMu6Zk.js} +1 -1
- package/dist-embed/chunks/{SheetTabs-PG3DQn2N.js → SheetTabs-DJG69znU.js} +1 -1
- package/dist-embed/chunks/{SpreadsheetPreviewView-CpUuO1Di.js → SpreadsheetPreviewView-5marsdKE.js} +1 -1
- package/dist-embed/chunks/{SpreadsheetView-CsSXGqRw.js → SpreadsheetView-CmD-dAjn.js} +1 -1
- package/dist-embed/chunks/{WidgetVariableView-BBupZR8G.js → WidgetVariableView-BQoMV999.js} +1 -1
- package/dist-embed/chunks/{YouTubePlugin-BOnLCvAR.js → YouTubePlugin-BCHN7vdi.js} +1 -1
- package/dist-embed/chunks/{abnfDiagram-VCTEODGH-DN0kRlog.js → abnfDiagram-VCTEODGH-BSmEjUJk.js} +1 -1
- package/dist-embed/chunks/{abnfDiagram-VCTEODGH-C5V-1V3E.js → abnfDiagram-VCTEODGH-CF8QpiZa.js} +1 -1
- package/dist-embed/chunks/{abnfDiagram-VCTEODGH-CvZ8usho.js → abnfDiagram-VCTEODGH-GnaR64st.js} +1 -1
- package/dist-embed/chunks/{ar-SA-G6X2FPQ2-DloHADQr.js → ar-SA-G6X2FPQ2-4AR7vABL.js} +1 -1
- package/dist-embed/chunks/{architectureDiagram-5GKGNRK7-Bwqgkba9.js → architectureDiagram-5GKGNRK7-ByAYkSMW.js} +1 -1
- package/dist-embed/chunks/{architectureDiagram-5GKGNRK7-DRfUn2vu.js → architectureDiagram-5GKGNRK7-Cy6c9GhS.js} +1 -1
- package/dist-embed/chunks/{architectureDiagram-5GKGNRK7-BeTQQNyc.js → architectureDiagram-5GKGNRK7-b_EnmOeS.js} +1 -1
- package/dist-embed/chunks/{az-AZ-76LH7QW2-ZZtVb3rf.js → az-AZ-76LH7QW2-DQ2RQ6Bt.js} +1 -1
- package/dist-embed/chunks/{bg-BG-XCXSNQG7-9xliuV5e.js → bg-BG-XCXSNQG7-BRTYabxb.js} +1 -1
- package/dist-embed/chunks/{blockDiagram-868be97b-DQhIB20U.js → blockDiagram-868be97b-C6Xxmbgc.js} +1 -1
- package/dist-embed/chunks/{blockDiagram-I7D4REHJ-BjW3QpXh.js → blockDiagram-I7D4REHJ-BBd_q6Z7.js} +1 -1
- package/dist-embed/chunks/{blockDiagram-I7D4REHJ-DUfJri3_.js → blockDiagram-I7D4REHJ-Clrwi7_Q.js} +1 -1
- package/dist-embed/chunks/{blockDiagram-I7D4REHJ-BjLfxD7u.js → blockDiagram-I7D4REHJ-zXh6gZYF.js} +1 -1
- package/dist-embed/chunks/{bn-BD-2XOGV67Q-Bhkca3_3.js → bn-BD-2XOGV67Q-DJpR_aiV.js} +1 -1
- package/dist-embed/chunks/{c4Diagram-3f4bdde3-dS_U3gYR.js → c4Diagram-3f4bdde3-BhBNs69f.js} +1 -1
- package/dist-embed/chunks/{c4Diagram-7LVT6UL2-O_rZefrz.js → c4Diagram-7LVT6UL2-BWQ9xHoN.js} +1 -1
- package/dist-embed/chunks/{c4Diagram-7LVT6UL2-Da5uNT8x.js → c4Diagram-7LVT6UL2-DcCc8HaH.js} +1 -1
- package/dist-embed/chunks/{c4Diagram-7LVT6UL2-BK8yvli2.js → c4Diagram-7LVT6UL2-p14SIG7V.js} +1 -1
- package/dist-embed/chunks/{ca-ES-6MX7JW3Y-jpG1o3Op.js → ca-ES-6MX7JW3Y-BrHrTXrx.js} +1 -1
- package/dist-embed/chunks/{chunk-2Q5K7J3B-BX9u1bBi.js → chunk-2Q5K7J3B-BkzWX8eg.js} +1 -1
- package/dist-embed/chunks/{chunk-2Q5K7J3B-DiqqlJZw.js → chunk-2Q5K7J3B-CWx-QJ0-.js} +1 -1
- package/dist-embed/chunks/{chunk-2Q5K7J3B-JhdIsXWp.js → chunk-2Q5K7J3B-CtmdieBX.js} +1 -1
- package/dist-embed/chunks/{chunk-5VM5RSS4-C5X9VB1v.js → chunk-5VM5RSS4-C7mbT2Vq.js} +1 -1
- package/dist-embed/chunks/{chunk-5VM5RSS4-BbOPwJfe.js → chunk-5VM5RSS4-Ciba-ybC.js} +1 -1
- package/dist-embed/chunks/{chunk-5VM5RSS4-box8kQsT.js → chunk-5VM5RSS4-O8p7luYq.js} +1 -1
- package/dist-embed/chunks/{chunk-F27PBJKO-BUeWPnw5.js → chunk-F27PBJKO-Bo5boRfj.js} +1 -1
- package/dist-embed/chunks/{chunk-F27PBJKO-CQM02DXR.js → chunk-F27PBJKO-CZHz6AS9.js} +1 -1
- package/dist-embed/chunks/{chunk-F27PBJKO-syxUNYMu.js → chunk-F27PBJKO-WqHcL2s0.js} +1 -1
- package/dist-embed/chunks/{chunk-IMKFNOWR-CPIe37ka.js → chunk-IMKFNOWR-BJR6rkFo.js} +1 -1
- package/dist-embed/chunks/{chunk-IMKFNOWR-B87sc0vl.js → chunk-IMKFNOWR-CPdtPffh.js} +1 -1
- package/dist-embed/chunks/{chunk-IMKFNOWR-rg2BEcj6.js → chunk-IMKFNOWR-Csfu1kFU.js} +1 -1
- package/dist-embed/chunks/{chunk-JWPE2WC7-BGdc9-bH.js → chunk-JWPE2WC7-BVXd-ICe.js} +1 -1
- package/dist-embed/chunks/{chunk-JWPE2WC7-NvLQtuoq.js → chunk-JWPE2WC7-Bf4pFlIJ.js} +1 -1
- package/dist-embed/chunks/{chunk-JWPE2WC7-DXZeG2qg.js → chunk-JWPE2WC7-Cq6Q947j.js} +1 -1
- package/dist-embed/chunks/{chunk-POPQ4Y6H-UAJm0Siu.js → chunk-POPQ4Y6H-B_rWRGt2.js} +1 -1
- package/dist-embed/chunks/{chunk-POPQ4Y6H-BgR92oKl.js → chunk-POPQ4Y6H-DhNnPwZp.js} +1 -1
- package/dist-embed/chunks/{chunk-POPQ4Y6H-DWWKSDND.js → chunk-POPQ4Y6H-s1yt1ZtK.js} +1 -1
- package/dist-embed/chunks/{chunk-SVP7TREG-lMq3S-u-.js → chunk-SVP7TREG-8oKVa2mm.js} +1 -1
- package/dist-embed/chunks/{chunk-SVP7TREG-BE97ZGVE.js → chunk-SVP7TREG-CHN6fclq.js} +1 -1
- package/dist-embed/chunks/{chunk-SVP7TREG-BGHt1HDi.js → chunk-SVP7TREG-CsFEUe5B.js} +1 -1
- package/dist-embed/chunks/{chunk-TICWLB2K-CeH9Mpzc.js → chunk-TICWLB2K-BsCtCkEM.js} +1 -1
- package/dist-embed/chunks/{chunk-TICWLB2K-BdUzhQPw.js → chunk-TICWLB2K-CSCMv_QA.js} +1 -1
- package/dist-embed/chunks/{chunk-TICWLB2K-D6WJ64X6.js → chunk-TICWLB2K-InZQ5ZEH.js} +1 -1
- package/dist-embed/chunks/{chunk-XXDRQBXY-BU32lP3z.js → chunk-XXDRQBXY-Y8pSpMzF.js} +1 -1
- package/dist-embed/chunks/{chunk-XXDRQBXY-CjAMT3RS.js → chunk-XXDRQBXY-sm2AIgJ5.js} +1 -1
- package/dist-embed/chunks/{chunk-XXDRQBXY-B8THsPMh.js → chunk-XXDRQBXY-z8go8Kjf.js} +1 -1
- package/dist-embed/chunks/{classDiagram-ZZMXUADV-Cy9bb-Ja.js → classDiagram-ZZMXUADV-BjEOw29S.js} +1 -1
- package/dist-embed/chunks/{classDiagram-ZZMXUADV-dVm_zkxF.js → classDiagram-ZZMXUADV-DJ40c8si.js} +1 -1
- package/dist-embed/chunks/{classDiagram-ZZMXUADV-HBhnoh6h.js → classDiagram-ZZMXUADV-G9WI_1Zg.js} +1 -1
- package/dist-embed/chunks/{classDiagram-f62afe4f-jrNOgtbP.js → classDiagram-f62afe4f-Blm1wT1_.js} +1 -1
- package/dist-embed/chunks/{classDiagram-v2-604399ef-CIao-4MQ.js → classDiagram-v2-604399ef-DtWqjJhW.js} +1 -1
- package/dist-embed/chunks/{classDiagram-v2-VYDZK3BY-Cy9bb-Ja.js → classDiagram-v2-VYDZK3BY-BjEOw29S.js} +1 -1
- package/dist-embed/chunks/{classDiagram-v2-VYDZK3BY-dVm_zkxF.js → classDiagram-v2-VYDZK3BY-DJ40c8si.js} +1 -1
- package/dist-embed/chunks/{classDiagram-v2-VYDZK3BY-HBhnoh6h.js → classDiagram-v2-VYDZK3BY-G9WI_1Zg.js} +1 -1
- package/dist-embed/chunks/{code-block-IT6T5CEO-Rra2QX20.js → code-block-IT6T5CEO-PC_FMPVL.js} +8 -8
- package/dist-embed/chunks/{core-trN55qc5.js → core-BrYTRvTy.js} +1 -1
- package/dist-embed/chunks/{cose-bilkent-JH36ORCC-DFWJgtSE.js → cose-bilkent-JH36ORCC-C73aLaB-.js} +1 -1
- package/dist-embed/chunks/{cose-bilkent-JH36ORCC-DGrxjlJ4.js → cose-bilkent-JH36ORCC-DCtKiRmD.js} +1 -1
- package/dist-embed/chunks/{cose-bilkent-JH36ORCC-D2gVNaYW.js → cose-bilkent-JH36ORCC-j_7L0NF5.js} +1 -1
- package/dist-embed/chunks/{createText-aed3d8b3-DoLPKXK1.js → createText-aed3d8b3-B0tLexrf.js} +1 -1
- package/dist-embed/chunks/{cs-CZ-2BRQDIVT-BMA1Xu87.js → cs-CZ-2BRQDIVT-CmCt0bDq.js} +1 -1
- package/dist-embed/chunks/{cynefinDiagram-5FMLGOSQ-DhFh7Gts.js → cynefinDiagram-5FMLGOSQ-BSwaTAfL.js} +1 -1
- package/dist-embed/chunks/{cynefinDiagram-5FMLGOSQ-BZ1LtKUy.js → cynefinDiagram-5FMLGOSQ-DLyDkFEh.js} +1 -1
- package/dist-embed/chunks/{cynefinDiagram-5FMLGOSQ-DExZ3BYo.js → cynefinDiagram-5FMLGOSQ-DXr1M_CB.js} +1 -1
- package/dist-embed/chunks/{da-DK-5WZEPLOC-smzK_QPz.js → da-DK-5WZEPLOC-Bow4-dps.js} +1 -1
- package/dist-embed/chunks/{dagre-GXQ25YYZ-CQ05bX5J.js → dagre-GXQ25YYZ-Bfxayyi1.js} +1 -1
- package/dist-embed/chunks/{dagre-GXQ25YYZ-4P90jeEC.js → dagre-GXQ25YYZ-CPu-St26.js} +1 -1
- package/dist-embed/chunks/{dagre-GXQ25YYZ-MXGi4287.js → dagre-GXQ25YYZ-DTWZ8vY1.js} +1 -1
- package/dist-embed/chunks/{de-DE-XR44H4JA-CfWQxGGf.js → de-DE-XR44H4JA-DOrKYiYP.js} +1 -1
- package/dist-embed/chunks/{diagram-S7CK7UJ4-CvR2q_hg.js → diagram-S7CK7UJ4-Biw5mnoN.js} +1 -1
- package/dist-embed/chunks/{diagram-S7CK7UJ4-Ccq8-Zxr.js → diagram-S7CK7UJ4-ERKr1j6v.js} +1 -1
- package/dist-embed/chunks/{diagram-S7CK7UJ4-xgW0lqt_.js → diagram-S7CK7UJ4-ewBgYmRN.js} +1 -1
- package/dist-embed/chunks/{diagram-UQ7AKVKN-Csc8IuSs.js → diagram-UQ7AKVKN-B-f2Afei.js} +1 -1
- package/dist-embed/chunks/{diagram-UQ7AKVKN-D6nWV9sq.js → diagram-UQ7AKVKN-C-6kzgTn.js} +1 -1
- package/dist-embed/chunks/{diagram-UQ7AKVKN-DM05uJg0.js → diagram-UQ7AKVKN-CGNA7gub.js} +1 -1
- package/dist-embed/chunks/{diagram-VSXAHHWV-CBb3q1Lt.js → diagram-VSXAHHWV-7M08zFHc.js} +1 -1
- package/dist-embed/chunks/{diagram-VSXAHHWV-ChcqzpvG.js → diagram-VSXAHHWV-CTQu2IBp.js} +1 -1
- package/dist-embed/chunks/{diagram-VSXAHHWV-C0Dte6B4.js → diagram-VSXAHHWV-DRVoe_PH.js} +1 -1
- package/dist-embed/chunks/{diagram-VX7I27RA-DA3s85ZI.js → diagram-VX7I27RA-B_LkfTnq.js} +1 -1
- package/dist-embed/chunks/{diagram-VX7I27RA-DFBWpFKi.js → diagram-VX7I27RA-DHwSWNj4.js} +1 -1
- package/dist-embed/chunks/{diagram-VX7I27RA-D8OyA7LV.js → diagram-VX7I27RA-vkcQI8-t.js} +1 -1
- package/dist-embed/chunks/{diagram-Z3DM3KII-DpwpLNON.js → diagram-Z3DM3KII-BZ9tmKdd.js} +1 -1
- package/dist-embed/chunks/{diagram-Z3DM3KII-CWv5dRb1.js → diagram-Z3DM3KII-D0Xt6xwn.js} +1 -1
- package/dist-embed/chunks/{diagram-Z3DM3KII-DViUyD1V.js → diagram-Z3DM3KII-YAo8QSYR.js} +1 -1
- package/dist-embed/chunks/{ebnfDiagram-PWID7BFC-DogBQteX.js → ebnfDiagram-PWID7BFC-C2oLjL45.js} +1 -1
- package/dist-embed/chunks/{ebnfDiagram-PWID7BFC-CeZcQDV3.js → ebnfDiagram-PWID7BFC-DN2tb-X8.js} +1 -1
- package/dist-embed/chunks/{ebnfDiagram-PWID7BFC-ZbRTmpLY.js → ebnfDiagram-PWID7BFC-Dk5WVIim.js} +1 -1
- package/dist-embed/chunks/{edges-b2856ca0-D_o-rhcf.js → edges-b2856ca0-BSzU9ga-.js} +1 -1
- package/dist-embed/chunks/{el-GR-BZB4AONW-B66N5_hN.js → el-GR-BZB4AONW-BTtxEAc0.js} +1 -1
- package/dist-embed/chunks/{erDiagram-5d81789a-Fv2KfQrA.js → erDiagram-5d81789a--wvCe6Ur.js} +1 -1
- package/dist-embed/chunks/{erDiagram-RLTQ6QDP-BGg8orkr.js → erDiagram-RLTQ6QDP-BDw_Db3e.js} +1 -1
- package/dist-embed/chunks/{erDiagram-RLTQ6QDP-CmahDLTF.js → erDiagram-RLTQ6QDP-BTXMcY7Y.js} +1 -1
- package/dist-embed/chunks/{erDiagram-RLTQ6QDP-QI_LQlaL.js → erDiagram-RLTQ6QDP-BsU1EeJN.js} +1 -1
- package/dist-embed/chunks/{es-ES-U4NZUMDT-B9FR_uSt.js → es-ES-U4NZUMDT-DhrLOB7I.js} +1 -1
- package/dist-embed/chunks/{esm-BaCqpqKi.js → esm-BFRTiV0k.js} +1 -1
- package/dist-embed/chunks/{esm--zHizpYG.js → esm-VjpQWsU9.js} +1 -1
- package/dist-embed/chunks/{eu-ES-A7QVB2H4-BOXiXCGc.js → eu-ES-A7QVB2H4-CdpglPNY.js} +1 -1
- package/dist-embed/chunks/{fa-IR-HGAKTJCU-DZGgNuMT.js → fa-IR-HGAKTJCU-Ea2hzNvl.js} +1 -1
- package/dist-embed/chunks/{fi-FI-Z5N7JZ37-CaWIHowf.js → fi-FI-Z5N7JZ37-D6KBS1-v.js} +1 -1
- package/dist-embed/chunks/{flowDb-185abca5-Bme86bTZ.js → flowDb-185abca5-CBeP2_ZY.js} +1 -1
- package/dist-embed/chunks/{flowDiagram-1629c991-Dgzjtx-J.js → flowDiagram-1629c991-LZzO5ZR8.js} +1 -1
- package/dist-embed/chunks/{flowDiagram-HODETNUW-CgvZqEVs.js → flowDiagram-HODETNUW-DNjEQlAR.js} +1 -1
- package/dist-embed/chunks/{flowDiagram-HODETNUW-CmuRDMmw.js → flowDiagram-HODETNUW-DP1PWdQF.js} +1 -1
- package/dist-embed/chunks/{flowDiagram-HODETNUW-OUrVNdIM.js → flowDiagram-HODETNUW-_U05MBMl.js} +1 -1
- package/dist-embed/chunks/{flowDiagram-v2-1d953310-C0-FfyAn.js → flowDiagram-v2-1d953310-DeqYSBVG.js} +1 -1
- package/dist-embed/chunks/{flowchart-elk-definition-6df44142-Cj7Q5rsQ.js → flowchart-elk-definition-6df44142-Dg5bSBS4.js} +1 -1
- package/dist-embed/chunks/{fr-FR-RHASNOE6-JbYWEs2C.js → fr-FR-RHASNOE6-CeDw1EdR.js} +1 -1
- package/dist-embed/chunks/{ganttDiagram-3b0b3873-11vGPr5M.js → ganttDiagram-3b0b3873-D9Pr_Kxk.js} +1 -1
- package/dist-embed/chunks/{ganttDiagram-EL5Y4UJY-BKVYCh-L.js → ganttDiagram-EL5Y4UJY-Baccn166.js} +1 -1
- package/dist-embed/chunks/{ganttDiagram-EL5Y4UJY-DjmeWOsd.js → ganttDiagram-EL5Y4UJY-DmwhuzrV.js} +1 -1
- package/dist-embed/chunks/{ganttDiagram-EL5Y4UJY-sX30iW6f.js → ganttDiagram-EL5Y4UJY-Qz5HuyzZ.js} +1 -1
- package/dist-embed/chunks/{gitGraphDiagram-WWUBYQGX-CVcSYkDK.js → gitGraphDiagram-WWUBYQGX-BUlSUrle.js} +1 -1
- package/dist-embed/chunks/{gitGraphDiagram-WWUBYQGX-BuldyYGe.js → gitGraphDiagram-WWUBYQGX-CF5nE-hV.js} +1 -1
- package/dist-embed/chunks/{gitGraphDiagram-WWUBYQGX-D5bCd_Fv.js → gitGraphDiagram-WWUBYQGX-ZgEb3qK-.js} +1 -1
- package/dist-embed/chunks/{gitGraphDiagram-f01e8bc2-CWnInLhH.js → gitGraphDiagram-f01e8bc2-BqpGV-_U.js} +1 -1
- package/dist-embed/chunks/{gl-ES-HMX3MZ6V-DHOQCvQH.js → gl-ES-HMX3MZ6V-DK2-uVTg.js} +1 -1
- package/dist-embed/chunks/{he-IL-6SHJWFNN-T-2jEF-H.js → he-IL-6SHJWFNN-Fk0F_rV-.js} +1 -1
- package/dist-embed/chunks/{hi-IN-IWLTKZ5I-DnwHC230.js → hi-IN-IWLTKZ5I-03USmwuM.js} +1 -1
- package/dist-embed/chunks/{hu-HU-A5ZG7DT2-CXi3BH37.js → hu-HU-A5ZG7DT2-BSbsIqRs.js} +1 -1
- package/dist-embed/chunks/{id-ID-SAP4L64H-CLNAMqbr.js → id-ID-SAP4L64H-Def1ERB7.js} +1 -1
- package/dist-embed/chunks/{index-9bae90f3-iredpvJb.js → index-9bae90f3-9T5x-xqi.js} +1 -1
- package/dist-embed/chunks/{index-BeJsO4Vc.js → index-CHu5zo1L.js} +1 -1
- package/dist-embed/chunks/{index-DqWZNFUh.js → index-DB6fbGKT.js} +1 -1
- package/dist-embed/chunks/{index-s25RSqvt.js → index-DObGLuCI.js} +4 -4
- package/dist-embed/chunks/{index-CLB4KPZs.js → index-Df2MkvAW.js} +4 -4
- package/dist-embed/chunks/{index-5os8HYj-.js → index-DrrVr0x3.js} +1 -1
- package/dist-embed/chunks/{index-C5HZB8ue.js → index-z8PItpd8.js} +2 -2
- package/dist-embed/chunks/{index.esm-CDmg415B.js → index.esm-BA_6VWW2.js} +1 -1
- package/dist-embed/chunks/index.esm-CjezntnN.js +1 -0
- package/dist-embed/chunks/{infoDiagram-27XIBGKW-r53wKy7u.js → infoDiagram-27XIBGKW-B4XVsJvC.js} +1 -1
- package/dist-embed/chunks/{infoDiagram-27XIBGKW-ZpA0pyod.js → infoDiagram-27XIBGKW-Cs7bZlH6.js} +1 -1
- package/dist-embed/chunks/{infoDiagram-27XIBGKW-C5jY9v4i.js → infoDiagram-27XIBGKW-D3fIZzte.js} +1 -1
- package/dist-embed/chunks/{infoDiagram-a29d40f1-Knwr4YPu.js → infoDiagram-a29d40f1-DkWa9MRC.js} +1 -1
- package/dist-embed/chunks/{ishikawaDiagram-5VMMS53U-_ZSb2XNA.js → ishikawaDiagram-5VMMS53U-B6nIkJxX.js} +1 -1
- package/dist-embed/chunks/{ishikawaDiagram-5VMMS53U-DyyVsa6G.js → ishikawaDiagram-5VMMS53U-BB-Kv-Mj.js} +1 -1
- package/dist-embed/chunks/{ishikawaDiagram-5VMMS53U-DZTg3ecD.js → ishikawaDiagram-5VMMS53U-BIytcjnR.js} +1 -1
- package/dist-embed/chunks/{it-IT-JPQ66NNP-txSVmIqw.js → it-IT-JPQ66NNP-SLcJY1NM.js} +1 -1
- package/dist-embed/chunks/{ja-JP-DBVTYXUO-DOImz4yG.js → ja-JP-DBVTYXUO-Cc9AUQ4A.js} +1 -1
- package/dist-embed/chunks/{journeyDiagram-3NMN7TZE-Bc9JVKJo.js → journeyDiagram-3NMN7TZE-Bs6ObzT9.js} +1 -1
- package/dist-embed/chunks/{journeyDiagram-3NMN7TZE-DAnc386V.js → journeyDiagram-3NMN7TZE-C3yCP95B.js} +1 -1
- package/dist-embed/chunks/{journeyDiagram-3NMN7TZE-ChyAFriv.js → journeyDiagram-3NMN7TZE-DjgUmoWA.js} +1 -1
- package/dist-embed/chunks/{journeyDiagram-95396277-BebgPn4W.js → journeyDiagram-95396277-Dj4xwdzk.js} +1 -1
- package/dist-embed/chunks/{kaa-6HZHGXH3-B2yEdYaM.js → kaa-6HZHGXH3-CzXQn7ER.js} +1 -1
- package/dist-embed/chunks/{kab-KAB-ZGHBKWFO-sLTnjbMU.js → kab-KAB-ZGHBKWFO-Cd1AWKsn.js} +1 -1
- package/dist-embed/chunks/{kanban-definition-UXKFOSKX-CaaDxJqC.js → kanban-definition-UXKFOSKX-B9DSJpj9.js} +1 -1
- package/dist-embed/chunks/{kanban-definition-UXKFOSKX-Ceyuj1Ce.js → kanban-definition-UXKFOSKX-Chsw2-Nq.js} +1 -1
- package/dist-embed/chunks/{kanban-definition-UXKFOSKX-C2nVULib.js → kanban-definition-UXKFOSKX-_mcHB773.js} +1 -1
- package/dist-embed/chunks/{kk-KZ-P5N5QNE5-BDlGvfGX.js → kk-KZ-P5N5QNE5-CoeOUA0W.js} +1 -1
- package/dist-embed/chunks/{km-KH-HSX4SM5Z-CooQACBW.js → km-KH-HSX4SM5Z-Newj9En6.js} +1 -1
- package/dist-embed/chunks/{ko-KR-MTYHY66A-Bj_rlaK_.js → ko-KR-MTYHY66A-B0HPCdz1.js} +1 -1
- package/dist-embed/chunks/{ku-TR-6OUDTVRD-Bj6Ypm8A.js → ku-TR-6OUDTVRD-DGP0qnbh.js} +1 -1
- package/dist-embed/chunks/{layout-BjpOdFu2.js → layout-DTdkd155.js} +1 -1
- package/dist-embed/chunks/{layout-DQIVAfpO.js → layout-D_LOxL0l.js} +1 -1
- package/dist-embed/chunks/{layout-Dqr0Lpzq.js → layout-W4AzWc9F.js} +1 -1
- package/dist-embed/chunks/{lib-BQq_nDIJ.js → lib-B8KSw9bH.js} +1 -1
- package/dist-embed/chunks/{lib-CZdsrJQn.js → lib-B8ebpTVD.js} +1 -1
- package/dist-embed/chunks/{lib-RkdqeSxj.js → lib-BSeAgx1v.js} +1 -1
- package/dist-embed/chunks/{lib-Bi3C17qp.js → lib-BYzUzQ6H.js} +1 -1
- package/dist-embed/chunks/{lib-DTFhY99t.js → lib-Bc3R7boK.js} +1 -1
- package/dist-embed/chunks/{lib-4swlpTXy.js → lib-CADgZZ9y.js} +1 -1
- package/dist-embed/chunks/{lib-ZCrl6o8i.js → lib-CLcIUOT7.js} +1 -1
- package/dist-embed/chunks/{lib-14GbWfrY.js → lib-CXGDRspZ.js} +1 -1
- package/dist-embed/chunks/{lib-CFjofO2V.js → lib-CaukawRB.js} +1 -1
- package/dist-embed/chunks/{lib-CjtFb8n-.js → lib-Cn7qCM0u.js} +1 -1
- package/dist-embed/chunks/{lib-D-SlE5VC.js → lib-Coc8tcSm.js} +1 -1
- package/dist-embed/chunks/{lib-Dte5toRY.js → lib-CrCTDU2F.js} +1 -1
- package/dist-embed/chunks/{lib-Df9xZsJQ.js → lib-DDbDl1bK.js} +1 -1
- package/dist-embed/chunks/{lib-epJftt6F.js → lib-DKIJv0vv.js} +1 -1
- package/dist-embed/chunks/{lib-CxLkAp-u.js → lib-Enno6S7H.js} +1 -1
- package/dist-embed/chunks/{lib-D8GpP3sJ.js → lib-EuT6O3Jf.js} +1 -1
- package/dist-embed/chunks/{lib-B_Y-fFGM.js → lib-Y90USIm4.js} +1 -1
- package/dist-embed/chunks/{lib-XPaJtC26.js → lib-YvkJZ6Rp.js} +1 -1
- package/dist-embed/chunks/{lib-BnWPn-3C.js → lib-nq0B6NsD.js} +1 -1
- package/dist-embed/chunks/{lt-LT-XHIRWOB4-tCy9B-KD.js → lt-LT-XHIRWOB4-BIsLadFj.js} +1 -1
- package/dist-embed/chunks/{lv-LV-5QDEKY6T-D7otgK4T.js → lv-LV-5QDEKY6T-C8HmZZBF.js} +1 -1
- package/dist-embed/chunks/{mermaid.core-DySu4CMa.js → mermaid.core-By9AWIOp.js} +3 -3
- package/dist-embed/chunks/{mermaid.core-DMHnDUdQ.js → mermaid.core-Dd-D7tJ4.js} +4 -4
- package/dist-embed/chunks/{mindmap-definition-YA3MSWOX-BxYK9vLg.js → mindmap-definition-YA3MSWOX-CCpwK8vh.js} +1 -1
- package/dist-embed/chunks/{mindmap-definition-YA3MSWOX-DQSoT62j.js → mindmap-definition-YA3MSWOX-CmGscTNk.js} +1 -1
- package/dist-embed/chunks/{mindmap-definition-YA3MSWOX-BXfU9jpH.js → mindmap-definition-YA3MSWOX-Uv7-26v7.js} +1 -1
- package/dist-embed/chunks/{mindmap-definition-e4c1d938-GSsr5zyA.js → mindmap-definition-e4c1d938-aCX0qYqH.js} +1 -1
- package/dist-embed/chunks/{mr-IN-CRQNXWMA-C_WuMJ-7.js → mr-IN-CRQNXWMA-DKYnEuji.js} +1 -1
- package/dist-embed/chunks/{my-MM-5M5IBNSE-ljxQ9hC9.js → my-MM-5M5IBNSE-MY3GKeMd.js} +1 -1
- package/dist-embed/chunks/{nb-NO-T6EIAALU-D2s2RIr7.js → nb-NO-T6EIAALU-txIp5vuE.js} +1 -1
- package/dist-embed/chunks/{nl-NL-IS3SIHDZ-BnT13jFW.js → nl-NL-IS3SIHDZ-C6xelwh4.js} +1 -1
- package/dist-embed/chunks/{nn-NO-6E72VCQL-obFqc-dJ.js → nn-NO-6E72VCQL-BFYvN5n1.js} +1 -1
- package/dist-embed/chunks/{oc-FR-POXYY2M6-Dp0fg3-H.js → oc-FR-POXYY2M6-uGpH7RML.js} +1 -1
- package/dist-embed/chunks/{pa-IN-N4M65BXN-BefFR002.js → pa-IN-N4M65BXN-Cg4Z-vtz.js} +1 -1
- package/dist-embed/chunks/{pegDiagram-XKGWAZYB-GlLsdSxR.js → pegDiagram-XKGWAZYB-C1R8Kk6K.js} +1 -1
- package/dist-embed/chunks/{pegDiagram-XKGWAZYB-FSobI14k.js → pegDiagram-XKGWAZYB-DLONs192.js} +1 -1
- package/dist-embed/chunks/{pegDiagram-XKGWAZYB-iCCMOEMa.js → pegDiagram-XKGWAZYB-dwQNJiaW.js} +1 -1
- package/dist-embed/chunks/{percentages-BXMCSKIN-D1a6fCH1.js → percentages-BXMCSKIN-9RttMFHC.js} +5 -5
- package/dist-embed/chunks/{pieDiagram-E7YTZNPT-CIfzhxTy.js → pieDiagram-E7YTZNPT-CH60iHt1.js} +1 -1
- package/dist-embed/chunks/{pieDiagram-E7YTZNPT-ffhUIieA.js → pieDiagram-E7YTZNPT-Cm-wzRi8.js} +1 -1
- package/dist-embed/chunks/{pieDiagram-E7YTZNPT-BLVqNMWJ.js → pieDiagram-E7YTZNPT-DiT0kFGb.js} +1 -1
- package/dist-embed/chunks/{pieDiagram-c941bede-nYu7i5OI.js → pieDiagram-c941bede-BF587JLB.js} +1 -1
- package/dist-embed/chunks/{pl-PL-T2D74RX3-BO36IHPS.js → pl-PL-T2D74RX3-Dv_CTL10.js} +1 -1
- package/dist-embed/chunks/{plugin-m2JrXH0S.js → plugin-Bvp_HQZg.js} +1 -1
- package/dist-embed/chunks/{pt-BR-5N22H2LF-DeQn8LGc.js → pt-BR-5N22H2LF-CK-yjA9j.js} +1 -1
- package/dist-embed/chunks/{pt-PT-UZXXM6DQ-BY1iT-VW.js → pt-PT-UZXXM6DQ-DYb7ailg.js} +1 -1
- package/dist-embed/chunks/{quadrantDiagram-AXDQQJYC-DbYIZcyN.js → quadrantDiagram-AXDQQJYC-B1wf6Zth.js} +1 -1
- package/dist-embed/chunks/{quadrantDiagram-AXDQQJYC-Dpzqg33f.js → quadrantDiagram-AXDQQJYC-DWDtOx8-.js} +1 -1
- package/dist-embed/chunks/{quadrantDiagram-AXDQQJYC-BE9RPE6m.js → quadrantDiagram-AXDQQJYC-mkOZIUHb.js} +1 -1
- package/dist-embed/chunks/{quadrantDiagram-cf8b8fe0-nVG6Aygu.js → quadrantDiagram-cf8b8fe0-CE6GwviF.js} +1 -1
- package/dist-embed/chunks/{railroadDiagram-O6MQD6OU-CwaTW3Mo.js → railroadDiagram-O6MQD6OU-DEB7gRmX.js} +1 -1
- package/dist-embed/chunks/{railroadDiagram-O6MQD6OU-jikRRl2W.js → railroadDiagram-O6MQD6OU-DjA_m2-o.js} +1 -1
- package/dist-embed/chunks/{railroadDiagram-O6MQD6OU-CEl2l0ZE.js → railroadDiagram-O6MQD6OU-DrkBEH1z.js} +1 -1
- package/dist-embed/chunks/{renderer-CCsq5PXp.js → renderer-B_98xkGt.js} +1 -1
- package/dist-embed/chunks/{requirementDiagram-53bda41b-CXGOrv-O.js → requirementDiagram-53bda41b-BsRjuGBf.js} +1 -1
- package/dist-embed/chunks/{requirementDiagram-BXWQKSXE-DEQBP2xS.js → requirementDiagram-BXWQKSXE-82Ybj2ki.js} +1 -1
- package/dist-embed/chunks/{requirementDiagram-BXWQKSXE-ClYVmNTl.js → requirementDiagram-BXWQKSXE-C8d0kJ1A.js} +1 -1
- package/dist-embed/chunks/{requirementDiagram-BXWQKSXE-Bd0fV1Bn.js → requirementDiagram-BXWQKSXE-S8WT8VJ1.js} +1 -1
- package/dist-embed/chunks/{ro-RO-JPDTUUEW-BJDoWheT.js → ro-RO-JPDTUUEW-1Cu9X8j1.js} +1 -1
- package/dist-embed/chunks/{ru-RU-B4JR7IUQ-tTkTCAO1.js → ru-RU-B4JR7IUQ-Bl3rV2YR.js} +1 -1
- package/dist-embed/chunks/{sankeyDiagram-P5KCCOFB-CLR82118.js → sankeyDiagram-P5KCCOFB-C2LowYxA.js} +1 -1
- package/dist-embed/chunks/{sankeyDiagram-P5KCCOFB-CuMdtMPP.js → sankeyDiagram-P5KCCOFB-CKqSAqcJ.js} +1 -1
- package/dist-embed/chunks/{sankeyDiagram-P5KCCOFB-DH-uxGJV.js → sankeyDiagram-P5KCCOFB-eNBOyfBR.js} +1 -1
- package/dist-embed/chunks/{sankeyDiagram-c3ef121a-nnS5nxSr.js → sankeyDiagram-c3ef121a-BAS8V2Ov.js} +1 -1
- package/dist-embed/chunks/{sequenceDiagram-82a5b84f-BXXPsnTm.js → sequenceDiagram-82a5b84f-BWNvF-m7.js} +1 -1
- package/dist-embed/chunks/{sequenceDiagram-WJ2MYXX4-D00NbcmA.js → sequenceDiagram-WJ2MYXX4-C_2alFNp.js} +1 -1
- package/dist-embed/chunks/{sequenceDiagram-WJ2MYXX4-CkWCOxWE.js → sequenceDiagram-WJ2MYXX4-CxH0MlFa.js} +1 -1
- package/dist-embed/chunks/{sequenceDiagram-WJ2MYXX4-VyUqwKEJ.js → sequenceDiagram-WJ2MYXX4-fsR56p6L.js} +1 -1
- package/dist-embed/chunks/{si-LK-N5RQ5JYF-D4AT7z9z.js → si-LK-N5RQ5JYF-C2t5ES1t.js} +1 -1
- package/dist-embed/chunks/{sizeCapture-INFHLROL-B_CNNL_v.js → sizeCapture-INFHLROL-BCe0IiFV.js} +1 -1
- package/dist-embed/chunks/{sizeCapture-INFHLROL-_h3QW8w5.js → sizeCapture-INFHLROL-BsZaIjAU.js} +1 -1
- package/dist-embed/chunks/{sizeCapture-INFHLROL-cLmnJm7s.js → sizeCapture-INFHLROL-Y7lBmAj6.js} +1 -1
- package/dist-embed/chunks/{sk-SK-C5VTKIMK-zTXKcnhq.js → sk-SK-C5VTKIMK-BPwM2QoN.js} +1 -1
- package/dist-embed/chunks/{sl-SI-NN7IZMDC-DrxXPVrt.js → sl-SI-NN7IZMDC-BCS7eO-5.js} +1 -1
- package/dist-embed/chunks/{state-CGa66Nqd.js → state-DeMGhTAB.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-43e79a5f-CKwOZnPj.js → stateDiagram-43e79a5f-2cuSVith.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-D77RDMKH-Ns0E2Xy4.js → stateDiagram-D77RDMKH-3P7AgNud.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-D77RDMKH-CEvuFuTH.js → stateDiagram-D77RDMKH-DosU0FIz.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-D77RDMKH-BVJqlFiv.js → stateDiagram-D77RDMKH-ul2eLf5Q.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-v2-2041ed4f-Dx6MQIKx.js → stateDiagram-v2-2041ed4f-Ur2pX7Zl.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-v2-MP3YSRHH-DXcA38of.js → stateDiagram-v2-MP3YSRHH-BvlJBilq.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-v2-MP3YSRHH-C_JHNwKt.js → stateDiagram-v2-MP3YSRHH-D0rhfnrW.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-v2-MP3YSRHH-ok1qePbZ.js → stateDiagram-v2-MP3YSRHH-DeEmivLr.js} +1 -1
- package/dist-embed/chunks/{styles-455b33cd-CyGhxLIv.js → styles-455b33cd-DPOVDa0x.js} +1 -1
- package/dist-embed/chunks/{styles-f932cba9-Yfe3P5e2.js → styles-f932cba9-Dev7yXQc.js} +1 -1
- package/dist-embed/chunks/{styles-fcc2142b-CoUogcOD.js → styles-fcc2142b-70zGEKfV.js} +1 -1
- package/dist-embed/chunks/{subset-shared.chunk-Ez82ye3f.js → subset-shared.chunk-Cs06OLE4.js} +1 -1
- package/dist-embed/chunks/{subset-worker.chunk-BJr6TVB9.js → subset-worker.chunk-C-vXxYep.js} +1 -1
- package/dist-embed/chunks/{substates-Bs9ZMVGa.js → substates-BuHNVWkx.js} +1 -1
- package/dist-embed/chunks/{sv-SE-XGPEYMSR-CVuCUAbC.js → sv-SE-XGPEYMSR-sUR_yJ3Z.js} +1 -1
- package/dist-embed/chunks/{svgDrawCommon-148a3cd9-Vfy_vJEN.js → svgDrawCommon-148a3cd9-zokUeLzq.js} +1 -1
- package/dist-embed/chunks/{swimlanes-42K2YHIH-CpRw9PHz.js → swimlanes-42K2YHIH-CIW2hU2l.js} +1 -1
- package/dist-embed/chunks/{swimlanes-42K2YHIH-DO1ZzP4k.js → swimlanes-42K2YHIH-DOkKP2_2.js} +1 -1
- package/dist-embed/chunks/{swimlanes-42K2YHIH-BMEa5pc_.js → swimlanes-42K2YHIH-x4BMo9Cs.js} +1 -1
- package/dist-embed/chunks/{swimlanesDiagram-VR7AAH4N-BucpGmoC.js → swimlanesDiagram-VR7AAH4N-9yw92Xx_.js} +1 -1
- package/dist-embed/chunks/{swimlanesDiagram-VR7AAH4N-BYKvE-MW.js → swimlanesDiagram-VR7AAH4N-BlFZ7eQS.js} +1 -1
- package/dist-embed/chunks/{swimlanesDiagram-VR7AAH4N-BCaTTDxJ.js → swimlanesDiagram-VR7AAH4N-zOAH82Ya.js} +1 -1
- package/dist-embed/chunks/{ta-IN-2NMHFXQM-BURg7Kc1.js → ta-IN-2NMHFXQM-c1DneC5B.js} +1 -1
- package/dist-embed/chunks/{th-TH-HPSO5L25-CxVkDzOV.js → th-TH-HPSO5L25-TIsXPiQR.js} +1 -1
- package/dist-embed/chunks/{timeline-definition-24CTP7MA-DUJPQe9n.js → timeline-definition-24CTP7MA-BfM-0614.js} +1 -1
- package/dist-embed/chunks/{timeline-definition-24CTP7MA-C_RPFzcS.js → timeline-definition-24CTP7MA-C9Ed6D0K.js} +1 -1
- package/dist-embed/chunks/{timeline-definition-24CTP7MA-CRpA2xfq.js → timeline-definition-24CTP7MA-kHlycslq.js} +1 -1
- package/dist-embed/chunks/{timeline-definition-7545f45a-BPBA2KPg.js → timeline-definition-7545f45a-B4ECAP9Q.js} +1 -1
- package/dist-embed/chunks/{tr-TR-DEFEU3FU-DzMZjlaq.js → tr-TR-DEFEU3FU-Bvb4Ep_L.js} +1 -1
- package/dist-embed/chunks/{uk-UA-QMV73CPH-DBHj_NAU.js → uk-UA-QMV73CPH-BNgdD_2E.js} +1 -1
- package/dist-embed/chunks/{vennDiagram-4TSXK5OY-C4cLgb45.js → vennDiagram-4TSXK5OY-7gMUaOyw.js} +1 -1
- package/dist-embed/chunks/{vennDiagram-4TSXK5OY-CRiS0wYe.js → vennDiagram-4TSXK5OY-CrE30dtz.js} +1 -1
- package/dist-embed/chunks/{vennDiagram-4TSXK5OY-ByKQXzaL.js → vennDiagram-4TSXK5OY-Dt9fBhlj.js} +1 -1
- package/dist-embed/chunks/{vi-VN-M7AON7JQ-B8B39qmP.js → vi-VN-M7AON7JQ-T0aYX7Py.js} +1 -1
- package/dist-embed/chunks/{wardleyDiagram-VM6X3IG4-CnxCRlDr.js → wardleyDiagram-VM6X3IG4-6HRbbvDt.js} +1 -1
- package/dist-embed/chunks/{wardleyDiagram-VM6X3IG4-CLayLpj4.js → wardleyDiagram-VM6X3IG4-AvAVDPLG.js} +1 -1
- package/dist-embed/chunks/{wardleyDiagram-VM6X3IG4-BbgqGTmD.js → wardleyDiagram-VM6X3IG4-CsR-8GhP.js} +1 -1
- package/dist-embed/chunks/{xychartDiagram-3f383b91-zh1CmS72.js → xychartDiagram-3f383b91-C09F8RkF.js} +1 -1
- package/dist-embed/chunks/{xychartDiagram-S5SC5T6Z-CYJl0Gtl.js → xychartDiagram-S5SC5T6Z-CkZtbHvK.js} +1 -1
- package/dist-embed/chunks/{xychartDiagram-S5SC5T6Z-CoRCml5l.js → xychartDiagram-S5SC5T6Z-VWPR98LV.js} +1 -1
- package/dist-embed/chunks/{xychartDiagram-S5SC5T6Z-RhhCg-yn.js → xychartDiagram-S5SC5T6Z-ZZD1fZ1L.js} +1 -1
- package/dist-embed/chunks/{zh-CN-LNUGB5OW-OOkUvmDB.js → zh-CN-LNUGB5OW-CpDHeCAz.js} +1 -1
- package/dist-embed/chunks/{zh-HK-E62DVLB3-r2T4uQQz.js → zh-HK-E62DVLB3-B5Kmyhoq.js} +1 -1
- package/dist-embed/chunks/{zh-TW-RAJ6MFWO-CVJ2FptU.js → zh-TW-RAJ6MFWO-D-Gvp4EC.js} +1 -1
- package/dist-embed/datalayer-app-main.js +66 -51
- package/lib/agents/AgentDetails.js +1 -1
- package/lib/apps/Application.d.ts +22 -0
- package/lib/apps/Application.js +23 -3
- package/lib/apps/embed/AppEmbed.d.ts +8 -2
- package/lib/apps/embed/AppEmbed.js +3 -1
- package/lib/apps/embed/LoopEmbed.js +14 -0
- package/lib/apps/embed/element.d.ts +5 -0
- package/lib/apps/embed/element.js +8 -2
- package/lib/apps/embed/embedTheme.js +15 -0
- package/lib/apps/embed/visitorApp.d.ts +10 -0
- package/lib/apps/embed/visitorApp.js +9 -3
- package/lib/apps/presets.d.ts +3 -0
- package/lib/apps/presets.js +3 -2
- package/lib/apps/shell/LeftPanel.d.ts +40 -4
- package/lib/apps/shell/LeftPanel.js +46 -15
- package/lib/apps/shell/index.d.ts +1 -1
- package/lib/chat/anonymous/AnonymousChat.d.ts +7 -5
- package/lib/chat/anonymous/AnonymousChat.js +9 -6
- package/lib/chat/anonymous/anonymousMode.d.ts +17 -0
- package/lib/chat/header/ChatHeaderBase.d.ts +2 -0
- package/lib/chat/header/ChatHeaderBase.js +8 -2
- package/lib/specs/apps.d.ts +1 -1
- package/lib/specs/apps.js +7 -7
- package/package.json +1 -1
- package/dist-embed/chunks/index.esm-BLnMhA7S.js +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{J as te,r as z,j as e,B as n,H as F,dv as ae,T as i,v as L,fa as
|
|
2
|
-
`),l=new Blob([r],{type:"text/csv;charset=utf-8;"}),o=URL.createObjectURL(l),a=document.createElement("a");a.href=o;const d=new Date().toISOString().replace(/[:.]/g,"-");a.download=`context-usage-${t.agentId}-${d}.csv`,a.style.display="none",document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(o)}function Tt(t){switch(t.toLowerCase()){case"messages":case"history":return Ge;case"tools":case"tool definitions":return Be;case"system":case"system prompts":return qe;case"cache":return De;default:return me}}function At({agentId:t,apiBase:s,liveData:r,messageCount:l=0,defaultView:o="overview",chartHeight:a="200px"}){const[d,c]=z.useState(o),[h,f]=z.useState(!1),S=r!==void 0,u=r,b=!S,m=z.useMemo(()=>{if(!u?.perRequestUsage||u.perRequestUsage.length===0)return null;const g=u.perRequestUsage;let C=0,N=0;const B=[],M=[],w=[],X=[];return g.forEach(W=>{C+=W.inputTokens,N+=W.outputTokens,B.push(`#${W.requestNum}`),M.push(C),w.push(N),X.push(C+N)}),{tooltip:{trigger:"axis",formatter:W=>{let U=`<strong>${W[0]?.axisValue||""}</strong><br/>`;return W.forEach($=>{U+=`${$.marker} ${$.seriesName}: ${D($.value)}<br/>`}),U}},legend:{data:["Input","Output","Total"],bottom:0,textStyle:{fontSize:10}},grid:{left:45,right:15,top:10,bottom:35},xAxis:{type:"category",data:B,axisLabel:{fontSize:10}},yAxis:{type:"value",axisLabel:{fontSize:10,formatter:W=>D(W)}},series:[{name:"Input",type:"line",data:M,smooth:!0,lineStyle:{width:2},areaStyle:{opacity:.2},itemStyle:{color:"#3B82F6"}},{name:"Output",type:"line",data:w,smooth:!0,lineStyle:{width:2},areaStyle:{opacity:.2},itemStyle:{color:"#10B981"}},{name:"Total",type:"line",data:X,smooth:!0,lineStyle:{width:2,type:"dashed"},itemStyle:{color:"#8B5CF6"}}]}},[u?.perRequestUsage]),R=z.useMemo(()=>{if(!u?.distribution)return null;const{distribution:g}=u,C=g.children&&g.children.length>0;return{tooltip:{formatter:N=>`${N.name}: ${D(N.value)} tokens`},series:[{type:"treemap",data:C?g.children:[{name:"No data",value:1}],roam:!1,breadcrumb:{show:!1},label:{show:!0,formatter:"{b}",fontSize:11},itemStyle:{borderColor:"#fff",borderWidth:2},levels:[{itemStyle:{borderColor:"#777",borderWidth:0,gapWidth:1}},{itemStyle:{borderColor:"#555",borderWidth:5,gapWidth:1},colorSaturation:[.35,.5]},{colorSaturation:[.35,.5]}]}]}},[u?.distribution]);if(b)return e.jsxs(n,{children:[e.jsx(F,{as:"h4",sx:{fontSize:1,fontWeight:"semibold",mb:2,color:"fg.muted"},children:"Context Usage"}),e.jsxs(n,{p:3,bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",display:"flex",alignItems:"center",gap:2,children:[e.jsx(ae,{size:"small"}),e.jsx(i,{sx:{fontSize:1,color:"fg.muted"},children:"Loading context details..."})]})]});if(!u)return e.jsxs(n,{children:[e.jsx(F,{as:"h4",sx:{fontSize:1,fontWeight:"semibold",mb:2,color:"fg.muted"},children:"Context Usage"}),e.jsx(n,{p:3,bg:"attention.subtle",borderRadius:2,border:"1px solid",borderColor:"attention.muted",children:e.jsx(i,{sx:{fontSize:1,color:"attention.fg"},children:"Waiting for context data from WebSocket stream..."})})]});const{totalTokens:P,contextWindow:y,sessionUsage:p,turnUsage:j,distribution:E}=u,I=l>0?l:Math.max(p?.turns??0,u.perRequestUsage?.length>0?1:0),O=E?.children&&E.children.length>0;return e.jsxs(n,{children:[e.jsxs(n,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,children:[e.jsx(F,{as:"h4",sx:{fontSize:1,fontWeight:"semibold",color:"fg.muted"},children:"Context Usage"}),e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[I>0&&e.jsxs(i,{sx:{fontSize:0,color:"fg.muted"},children:[I," ",I===1?"message sent":"messages sent"]}),e.jsx(L,{size:"small",variant:"invisible",leadingVisual:Re,onClick:()=>It(u),children:"Download"})]})]}),e.jsxs(n,{p:3,bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",children:[e.jsx(n,{mb:3,children:e.jsxs(i,{sx:{fontSize:1,fontWeight:"semibold"},children:["Total usage: ",D(P)]})}),(p||j)&&e.jsxs(n,{display:"flex",gap:3,mb:3,flexWrap:"wrap",children:[p&&e.jsxs(n,{flex:1,minWidth:120,p:2,bg:"canvas.default",borderRadius:2,border:"1px solid",borderColor:"border.muted",children:[e.jsxs(i,{sx:{fontSize:0,color:"fg.muted",display:"block"},children:["Session (",p.turns," turns)"]}),e.jsx(i,{sx:{fontSize:1,fontWeight:"semibold"},children:D(p.inputTokens+p.outputTokens)}),e.jsxs(i,{sx:{fontSize:0,color:"fg.muted"},children:[" ","in ",Te(p.durationSeconds)]})]}),j&&e.jsxs(n,{flex:1,minWidth:120,p:2,bg:"canvas.default",borderRadius:2,border:"1px solid",borderColor:"border.muted",children:[e.jsxs(i,{sx:{fontSize:0,color:"fg.muted",display:"block"},children:["Last Turn (",j.requests," reqs)"]}),e.jsx(i,{sx:{fontSize:1,fontWeight:"semibold"},children:D(j.inputTokens+j.outputTokens)}),e.jsxs(i,{sx:{fontSize:0,color:"fg.muted"},children:[" ","in ",Te(j.durationSeconds)]})]})]}),e.jsxs(n,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,children:[e.jsxs(le,{"aria-label":"View mode",size:"small",onChange:g=>{c(["overview","distribution","history"][g])},children:[e.jsx(le.IconButton,{"aria-label":"Overview",selected:d==="overview",icon:He}),e.jsx(le.IconButton,{"aria-label":"Distribution",selected:d==="distribution",icon:jt,disabled:!O}),e.jsx(le.IconButton,{"aria-label":"History",selected:d==="history",icon:Ve})]}),d==="overview"&&e.jsx(L,{size:"small",variant:"invisible",onClick:()=>f(!h),children:h?"Less":"More"})]}),d==="overview"&&e.jsxs(n,{children:[e.jsxs(n,{display:"flex",flexDirection:"column",gap:2,children:[O&&E.children.map(g=>{const C=Tt(g.name),N=g.value/y*100;return e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(n,{color:"fg.muted",width:20,children:e.jsx(C,{size:16})}),e.jsx(i,{sx:{fontSize:1,flex:1},children:g.name}),e.jsx(i,{sx:{fontSize:0,color:"fg.muted",minWidth:60},children:D(g.value)}),e.jsx(n,{width:80,children:e.jsx($e,{progress:N,sx:{height:4}})})]},g.name)}),!O&&e.jsx(i,{sx:{color:"fg.muted",fontSize:1,textAlign:"center",py:2},children:"No context data yet. Start a conversation to see usage."})]}),h&&O&&e.jsxs(n,{mt:3,p:2,bg:"canvas.default",borderRadius:2,border:"1px solid",borderColor:"border.muted",fontSize:0,children:[u.systemPromptTokens>0&&e.jsxs(n,{mb:2,children:[e.jsxs(i,{sx:{fontWeight:"semibold"},children:["System Prompts:"," ",D(u.systemPromptTokens)," tokens"]}),u.systemPrompts.slice(0,2).map((g,C)=>e.jsxs(i,{sx:{display:"block",ml:2,mt:1,color:"fg.muted"},children:["•"," ",g.length>80?g.slice(0,80)+"...":g]},C))]}),u.toolTokens>0&&e.jsxs(n,{mb:2,children:[e.jsxs(i,{sx:{fontWeight:"semibold"},children:["Tools: ",D(u.toolTokens)," tokens (",u.tools.length," tools)"]}),e.jsxs(n,{ml:2,mt:1,children:[u.tools.slice(0,4).map((g,C)=>e.jsxs(i,{sx:{display:"block",color:"fg.muted"},children:["• ",g.name,": ",D(g.totalTokens)]},C)),u.tools.length>4&&e.jsxs(i,{sx:{color:"fg.muted",fontStyle:"italic"},children:["...and ",u.tools.length-4," more"]})]})]}),(u.userMessageTokens>0||u.assistantMessageTokens>0)&&e.jsxs(n,{mb:2,children:[e.jsxs(i,{sx:{fontWeight:"semibold"},children:["Messages:"," ",D(u.userMessageTokens+u.assistantMessageTokens)," ","tokens"]}),e.jsxs(n,{ml:2,mt:1,children:[e.jsxs(i,{sx:{display:"block",color:"fg.muted"},children:["• User: ",D(u.userMessageTokens)]}),e.jsxs(i,{sx:{display:"block",color:"fg.muted"},children:["• Assistant:"," ",D(u.assistantMessageTokens)]}),u.toolCallTokens>0&&e.jsxs(i,{sx:{display:"block",color:"fg.muted"},children:["• Tool calls:"," ",D(u.toolCallTokens)]})]})]})]})]}),d==="distribution"&&R&&e.jsx(Ie,{option:R,style:{height:a},opts:{renderer:"svg"}}),d==="history"&&m&&e.jsxs(n,{children:[e.jsx(Ie,{option:m,style:{height:a},opts:{renderer:"svg"}}),h&&u.perRequestUsage.length>0&&e.jsx(n,{mt:2,maxHeight:"150px",overflowY:"auto",fontSize:0,children:u.perRequestUsage.slice(-10).reverse().map((g,C)=>e.jsxs(n,{display:"flex",gap:2,py:1,borderBottom:C<9?"1px solid":"none",borderColor:"border.muted",children:[e.jsxs(i,{sx:{fontWeight:"semibold",minWidth:30},children:["#",g.requestNum]}),e.jsxs(i,{sx:{color:"#3B82F6"},children:["↓",D(g.inputTokens)]}),e.jsxs(i,{sx:{color:"#10B981"},children:["↑",D(g.outputTokens)]}),g.toolNames.length>0&&e.jsxs(i,{sx:{color:"fg.muted"},children:["🔧 ",g.toolNames.join(", ")]})]},g.requestNum))})]}),d==="history"&&!m&&e.jsx(n,{py:3,children:e.jsx(i,{sx:{color:"fg.muted",fontSize:1},children:"No history"})})]})]})}function q(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString()}function ee({title:t,icon:s,count:r,tokens:l,defaultExpanded:o=!1,children:a}){const[d,c]=z.useState(o);return e.jsxs(n,{mb:2,children:[e.jsxs(n,{as:"button",onClick:()=>c(!d),display:"flex",alignItems:"center",gap:2,width:"100%",p:2,bg:"canvas.subtle",border:"1px solid",borderColor:"border.default",borderRadius:2,cursor:"pointer",hover:{bg:"canvas.inset"},children:[d?e.jsx(Ye,{size:16}):e.jsx(Xe,{size:16}),te.createElement(s,{size:16}),e.jsx(i,{sx:{fontWeight:"semibold",flex:1,textAlign:"left"},children:t}),r!==void 0&&e.jsx(A,{variant:"secondary",size:"small",children:r}),l!==void 0&&l>0&&e.jsxs(i,{sx:{fontSize:0,color:"fg.muted"},children:[q(l)," tokens"]})]}),d&&e.jsx(n,{border:"1px solid",borderColor:"border.default",borderTop:"none",borderRadius:"0 0 6px 6px",p:2,children:a})]})}function Et({tool:t}){const[s,r]=z.useState(!1),[l,o]=z.useState(!1);return e.jsxs(n,{p:2,mb:2,bg:"canvas.default",border:"1px solid",borderColor:"border.muted",borderRadius:2,children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,mb:1,children:[e.jsx(i,{sx:{fontWeight:"bold",fontFamily:"mono",fontSize:1},children:t.name}),e.jsx(A,{size:"small",variant:"secondary",children:t.sourceType}),t.isAsync&&e.jsx(A,{size:"small",variant:"accent",children:"async"}),t.requiresApproval&&e.jsx(A,{size:"small",variant:"attention",children:"requires approval"}),e.jsxs(i,{sx:{fontSize:0,color:"fg.muted",ml:"auto"},children:[q(t.totalTokens)," tokens"]})]}),t.description&&e.jsx(i,{sx:{fontSize:1,color:"fg.muted",display:"block",mb:2},children:t.description}),e.jsxs(n,{display:"flex",gap:2,children:[e.jsxs(L,{size:"small",variant:"invisible",onClick:()=>r(!s),children:[s?"Hide":"Show"," Schema"]}),t.sourceCode&&e.jsxs(L,{size:"small",variant:"invisible",onClick:()=>o(!l),children:[l?"Hide":"Show"," Source"]})]}),s&&e.jsx(n,{as:"pre",mt:2,p:2,bg:"canvas.inset",borderRadius:2,fontSize:0,overflow:"auto",maxHeight:200,children:JSON.stringify(t.parametersSchema,null,2)}),l&&t.sourceCode&&e.jsx(n,{as:"pre",mt:2,p:2,bg:"canvas.inset",borderRadius:2,fontSize:0,overflow:"auto",maxHeight:300,children:t.sourceCode})]})}function Ut({agentId:t,apiBase:s,liveData:r}){const l=r!==void 0,o=r;if(!l)return e.jsx(n,{p:3,display:"flex",alignItems:"center",justifyContent:"center",children:e.jsx(i,{sx:{color:"fg.muted"},children:"Waiting for context data from WebSocket stream..."})});if(!o)return e.jsx(n,{p:3,bg:"attention.subtle",borderRadius:2,border:"1px solid",borderColor:"attention.muted",children:e.jsx(i,{sx:{color:"attention.fg"},children:"No context data available."})});if(o.error)return e.jsx(n,{p:3,bg:"attention.subtle",borderRadius:2,border:"1px solid",borderColor:"attention.muted",children:e.jsx(i,{sx:{color:"attention.fg"},children:o.error})});const{tokenSummary:a,modelConfiguration:d}=o;return e.jsxs(n,{children:[e.jsxs(n,{mb:3,children:[e.jsxs(i,{sx:{fontSize:1,fontWeight:"semibold"},children:["Total usage: ",q(a.total)," /"," ",q(a.contextWindow)," (",Math.round(a.usagePercent),"%)"]}),e.jsx($e,{progress:Math.min(a.usagePercent,100),sx:{mt:2,height:8},bg:a.usagePercent>90?"danger.emphasis":a.usagePercent>70?"attention.emphasis":"success.emphasis"}),e.jsxs(n,{display:"flex",gap:3,mt:2,flexWrap:"wrap",fontSize:0,color:"fg.muted",children:[e.jsxs(i,{children:["System: ",q(a.systemPrompts)]}),e.jsxs(i,{children:["Tools: ",q(a.tools)]}),a.memory>0&&e.jsxs(i,{children:["Memory: ",q(a.memory)]}),e.jsxs(i,{children:["History: ",q(a.history)]}),e.jsxs(i,{children:["Current: ",q(a.current)]})]})]}),e.jsx(ee,{title:"Model Configuration",icon:Ke,defaultExpanded:!1,children:e.jsxs(n,{display:"grid",gridTemplateColumns:"1fr 2fr",gap:2,children:[e.jsx(i,{sx:{fontWeight:"semibold",fontSize:1},children:"Model:"}),e.jsx(i,{sx:{fontSize:1,fontFamily:"mono"},children:d.modelName||"Not specified"}),e.jsx(i,{sx:{fontWeight:"semibold",fontSize:1},children:"Context Window:"}),e.jsxs(i,{sx:{fontSize:1},children:[q(d.contextWindow)," tokens"]}),Object.keys(d.settings).length>0&&e.jsxs(e.Fragment,{children:[e.jsx(i,{sx:{fontWeight:"semibold",fontSize:1},children:"Settings:"}),e.jsx(n,{as:"pre",fontSize:0,p:2,bg:"canvas.inset",borderRadius:2,overflow:"auto",children:JSON.stringify(d.settings,null,2)})]})]})}),e.jsx(ee,{title:"System Prompts",icon:Je,count:o.systemPrompts.length,tokens:o.systemPromptTokens,children:o.systemPrompts.length===0?e.jsx(i,{sx:{color:"fg.muted",fontSize:1},children:"No system prompts configured"}):o.systemPrompts.map((c,h)=>e.jsxs(n,{p:2,mb:2,bg:"canvas.inset",borderRadius:2,border:"1px solid",borderColor:"border.muted",children:[e.jsxs(n,{display:"flex",justifyContent:"space-between",mb:1,children:[e.jsxs(i,{sx:{fontWeight:"semibold",fontSize:0},children:["Prompt ",h+1]}),e.jsxs(i,{sx:{fontSize:0,color:"fg.muted"},children:[q(c.tokens)," tokens"]})]}),e.jsx(i,{as:"pre",sx:{fontSize:0,whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:200,overflow:"auto"},children:c.content})]},h))}),e.jsx(ee,{title:"Tool Definitions",icon:St,count:o.tools.length,tokens:o.toolTokens,children:o.tools.length===0?e.jsx(i,{sx:{color:"fg.muted",fontSize:1},children:"No tools configured"}):o.tools.map((c,h)=>e.jsx(Et,{tool:c},h))}),o.memoryBlocks.length>0&&e.jsx(ee,{title:"Memory Blocks",icon:De,count:o.memoryBlocks.length,tokens:o.memoryTokens,children:o.memoryBlocks.map((c,h)=>e.jsx(n,{as:"pre",p:2,mb:2,bg:"canvas.inset",borderRadius:2,fontSize:0,overflow:"auto",children:JSON.stringify(c,null,2)},h))}),Object.keys(o.toolEnvironment).length>0&&e.jsx(ee,{title:"Tool Environment",icon:H,count:Object.keys(o.toolEnvironment).length,children:e.jsx(n,{display:"grid",gridTemplateColumns:"1fr 2fr",gap:2,children:Object.entries(o.toolEnvironment).map(([c,h])=>e.jsxs(te.Fragment,{children:[e.jsx(i,{sx:{fontFamily:"mono",fontSize:1,fontWeight:"semibold"},children:c}),e.jsx(i,{sx:{fontFamily:"mono",fontSize:1,color:"fg.muted"},children:h})]},c))})}),o.toolRules.length>0&&e.jsx(ee,{title:"Tool Rules",icon:ce,count:o.toolRules.length,children:o.toolRules.map((c,h)=>e.jsx(n,{as:"pre",p:2,mb:2,bg:"canvas.inset",borderRadius:2,fontSize:0,overflow:"auto",children:JSON.stringify(c,null,2)},h))})]})}const ye={provider:"github",displayName:"GitHub",iconUrl:"https://github.githubassets.com/favicons/favicon.svg",authorizationUrl:"https://github.com/login/oauth/authorize",tokenUrl:"https://github.com/login/oauth/access_token",userInfoUrl:"https://api.github.com/user",revocationUrl:"https://api.github.com/applications/{client_id}/token",defaultScopes:["read:user","user:email"]},je={provider:"google",displayName:"Google",iconUrl:"https://www.google.com/favicon.ico",authorizationUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",userInfoUrl:"https://www.googleapis.com/oauth2/v2/userinfo",revocationUrl:"https://oauth2.googleapis.com/revoke",defaultScopes:["openid","email","profile"],additionalParams:{access_type:"offline",prompt:"consent"}},Se={provider:"kaggle",displayName:"Kaggle",iconUrl:"https://www.kaggle.com/static/images/favicon.ico",authorizationUrl:"https://www.kaggle.com/oauth/authorize",tokenUrl:"https://www.kaggle.com/oauth/token",userInfoUrl:"https://www.kaggle.com/api/v1/me",defaultScopes:["datasets:read","notebooks:read"]};function _t(t=64){const s=Math.max(43,Math.min(128,t)),r=new Uint8Array(s);return crypto.getRandomValues(r),we(r)}async function Rt(t){const r=new TextEncoder().encode(t),l=await crypto.subtle.digest("SHA-256",r);return we(new Uint8Array(l))}function Dt(){const t=new Uint8Array(32);return crypto.getRandomValues(t),we(t)}function we(t){let s="";const r=new Uint8Array(t);for(let l=0;l<r.length;l++)s+=String.fromCharCode(r[l]);return s=btoa(s),s.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}async function Pt(){const t=_t(),s=await Rt(t);return{codeVerifier:t,codeChallenge:s}}const Ot="datalayer-agent-identities",Ae="/api/v1/identity/oauth/token",Mt="/api/v1/identity/oauth/userinfo",Wt="/api/v1/identity/oauth/revoke",$t={identities:new Map,pendingAuthorization:null,providerConfigs:new Map,isLoading:!1,error:null};function Nt(t,s,r,l){const o=new URLSearchParams({client_id:t.clientId,redirect_uri:t.redirectUri,response_type:"code",scope:s.join(" "),state:r,code_challenge:l,code_challenge_method:"S256",...t.additionalParams});return`${t.authorizationUrl}?${o.toString()}`}const T=Qe()(Ze(et(tt((t,s)=>({...$t,configureProvider:r=>{t(l=>{const o=new Map(l.providerConfigs);return o.set(r.provider,r),{providerConfigs:o}})},startAuthorization:async(r,l,o)=>{const d=s().providerConfigs.get(r);if(!d)throw new Error(`Provider ${r} is not configured`);const{codeVerifier:c,codeChallenge:h}=await Pt(),f=Dt(),S=l||d.defaultScopes,u=Nt(d,S,f,h),b={requestId:`auth-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,provider:r,authUrl:u,state:f,codeVerifier:c,scopes:S,requestedAt:Date.now(),onComplete:o?.onComplete,onError:o?.onError};return t({pendingAuthorization:b,error:null}),u},completeAuthorization:async r=>{const l=s(),o=l.pendingAuthorization;if(!o)throw new Error("No pending authorization request");if(r.state!==o.state){const a=new Error("State mismatch - possible CSRF attack");throw o.onError?.(a),t({pendingAuthorization:null,error:a}),a}if(r.error){const a=new Error(r.errorDescription||r.error);throw o.onError?.(a),t({pendingAuthorization:null,error:a}),a}t({isLoading:!0});try{const a=l.providerConfigs.get(o.provider);if(!a)throw new Error(`Provider ${o.provider} is not configured`);const d=a.redirectUri.split("/").slice(0,3).join("/"),c=await fetch(`${d}${Ae}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:o.provider,code:r.code,code_verifier:o.codeVerifier,redirect_uri:a.redirectUri})});if(!c.ok){const b=await c.json().catch(()=>({}));throw new Error(b.detail||`Token exchange failed: ${c.status}`)}const h=await c.json(),f={accessToken:h.access_token,tokenType:h.token_type||"Bearer",expiresAt:h.expires_in?Date.now()+h.expires_in*1e3:void 0,refreshToken:h.refresh_token,scopes:o.scopes};let S;if(a.userInfoUrl)try{const b=await fetch(`${d}${Mt}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:o.provider,access_token:f.accessToken})});if(b.ok){const m=await b.json();S={id:m.id?.toString()||m.sub,username:m.login||m.username,name:m.name,email:m.email,avatarUrl:m.avatar_url||m.picture,profileUrl:m.html_url||m.profile,raw:m}}}catch(b){console.warn("Failed to fetch user info:",b)}const u={provider:o.provider,displayName:a.displayName,iconUrl:a.iconUrl,scopes:o.scopes,isConnected:!0,connectedAt:Date.now(),userInfo:S,token:f};return t(b=>{const m=new Map(b.identities);return m.set(o.provider,u),{identities:m,pendingAuthorization:null,isLoading:!1,error:null}}),o.onComplete?.(u),u}catch(a){const d=a instanceof Error?a:new Error(String(a));throw o.onError?.(d),t({isLoading:!1,error:d,pendingAuthorization:null}),d}},cancelAuthorization:()=>{const r=s().pendingAuthorization;r?.onError&&r.onError(new Error("Authorization cancelled")),t({pendingAuthorization:null})},connectWithToken:async(r,l,o)=>{t({isLoading:!0,error:null});try{const a={accessToken:l,tokenType:"Bearer",scopes:[]},d={kaggle:{displayName:"Kaggle",iconUrl:"https://www.kaggle.com/static/images/favicon.ico"}}[r]||{displayName:r,iconUrl:void 0},c={provider:r,authType:"token",displayName:o?.displayName||d.displayName,iconUrl:o?.iconUrl||d.iconUrl,scopes:[],isConnected:!0,connectedAt:Date.now(),userInfo:o?.userInfo,token:a};return t(h=>{const f=new Map(h.identities);return f.set(r,c),{identities:f,isLoading:!1,error:null}}),c}catch(a){const d=a instanceof Error?a:new Error(String(a));throw t({isLoading:!1,error:d}),d}},disconnect:async r=>{const l=s(),o=l.identities.get(r),a=l.providerConfigs.get(r);if(!o||!o.token){t(d=>{const c=new Map(d.identities);return c.delete(r),{identities:c}});return}if(o.authType==="token"){t(d=>{const c=new Map(d.identities);return c.delete(r),{identities:c}});return}if(a?.revocationUrl)try{const d=a.redirectUri.split("/").slice(0,3).join("/");await fetch(`${d}${Wt}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r,access_token:o.token.accessToken})})}catch(d){console.warn("Failed to revoke token:",d)}t(d=>{const c=new Map(d.identities);return c.delete(r),{identities:c}})},refreshToken:async r=>{const l=s(),o=l.identities.get(r),a=l.providerConfigs.get(r);if(!o||!o.token?.refreshToken)throw new Error(`No refresh token available for ${r}`);if(!a)throw new Error(`Provider ${r} is not configured`);const d=a.redirectUri.split("/").slice(0,3).join("/"),c=await fetch(`${d}${Ae}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r,grant_type:"refresh_token",refresh_token:o.token.refreshToken})});if(!c.ok)throw new Error(`Token refresh failed: ${c.status}`);const h=await c.json(),f={accessToken:h.access_token,tokenType:h.token_type||"Bearer",expiresAt:h.expires_in?Date.now()+h.expires_in*1e3:void 0,refreshToken:h.refresh_token||o.token.refreshToken,scopes:o.scopes};return t(S=>{const u=new Map(S.identities);return u.set(r,{...o,token:f}),{identities:u}}),f},getIdentity:r=>s().identities.get(r),isConnected:r=>s().identities.get(r)?.isConnected??!1,getToken:async r=>{const o=s().identities.get(r);if(!o||!o.token)return null;const a=o.token.expiresAt;if(a&&a-Date.now()<300*1e3){if(o.token.refreshToken)try{return await s().refreshToken(r)}catch(d){return console.warn("Token refresh failed:",d),null}return null}return o.token},clearAll:()=>{t({identities:new Map,pendingAuthorization:null,error:null})},setError:r=>{t({error:r})}}),{name:Ot,storage:{getItem:t=>{const s=localStorage.getItem(t);if(!s)return null;const r=JSON.parse(s),l=new URLSearchParams(window.location.search),o=l.has("code")&&l.has("state");return{state:{...r.state,identities:new Map(r.state.identities||[]),providerConfigs:new Map(r.state.providerConfigs||[]),pendingAuthorization:o&&r.state.pendingAuthorization||null,isLoading:!1,error:null}}},setItem:(t,s)=>{const r={state:{...s.state,identities:Array.from(s.state.identities.entries()),providerConfigs:Array.from(s.state.providerConfigs.entries()),pendingAuthorization:s.state.pendingAuthorization?{...s.state.pendingAuthorization,onComplete:void 0,onError:void 0}:null,isLoading:!1,error:null}};localStorage.setItem(t,JSON.stringify(r))},removeItem:t=>localStorage.removeItem(t)},partialize:t=>({identities:t.identities,providerConfigs:t.providerConfigs,pendingAuthorization:t.pendingAuthorization})})),{name:"IdentityStore"}));function Lt(){return T(Ne(t=>Array.from(t.identities.values()).filter(s=>s.isConnected)))}function Ft(){return T(Ne(t=>Array.from(t.identities.entries()).filter(([s,r])=>r.isConnected).map(([s])=>s)))}function Ht(){return T(t=>t.pendingAuthorization)}function Vt(){return T(t=>t.isLoading)}function qt(){return T(t=>t.error)}function pe(t){const s=T.getState();t.github&&s.configureProvider({...ye,clientId:t.github.clientId,redirectUri:t.github.redirectUri}),t.google&&s.configureProvider({...je,clientId:t.google.clientId,redirectUri:t.google.redirectUri}),t.kaggle&&s.configureProvider({...Se,clientId:t.kaggle.clientId,redirectUri:t.kaggle.redirectUri})}function ke(t={}){const{providers:s,baseUrl:r=typeof window<"u"?window.location.origin:"",callbackPath:l=typeof window<"u"?window.location.pathname:"/oauth/callback",autoHandleCallback:o=!0}=t,a=Lt(),d=Ft(),c=Ht(),h=Vt(),f=qt(),S=T(x=>x.startAuthorization),u=T(x=>x.completeAuthorization),b=T(x=>x.cancelAuthorization),m=T(x=>x.disconnect),R=T(x=>x.getIdentity),P=T(x=>x.isConnected),y=T(x=>x.getToken),p=T(x=>x.configureProvider);z.useEffect(()=>{if(!s)return;const x=`${r}${l}`;s.github&&pe({github:{clientId:s.github.clientId,redirectUri:s.github.redirectUri||x}}),s.google&&pe({google:{clientId:s.google.clientId,redirectUri:s.google.redirectUri||x}}),s.kaggle&&pe({kaggle:{clientId:s.kaggle.clientId,redirectUri:s.kaggle.redirectUri||x}}),s.custom&&s.custom.forEach(U=>{p(U)})},[s,r,l,p]),z.useEffect(()=>{if(!o||typeof window>"u")return;const x=new URLSearchParams(window.location.search),U=x.get("code"),$=x.get("state"),G=x.get("error"),V=x.get("error_description");(U&&$||G)&&u({code:U||"",state:$||"",error:G||void 0,errorDescription:V||void 0}).then(()=>{const K=window.location.pathname;window.history.replaceState({},"",K)}).catch(K=>{console.error("OAuth callback error:",K);const Q=window.location.pathname;window.history.replaceState({},"",Q)})},[o,u]);const j=z.useCallback(async(x,U)=>{const $=await S(x,U);window.location.href=$},[S]),E=z.useCallback(async(x,U)=>{const $=await S(x,U,{onComplete:()=>{},onError:()=>{}});return new Promise((G,V)=>{const K=T.getState();K.pendingAuthorization&&(K.pendingAuthorization.onComplete=G,K.pendingAuthorization.onError=V);const Q=600,k=700,ue=window.screenX+(window.outerWidth-Q)/2,v=window.screenY+(window.outerHeight-k)/2,_=window.open($,"oauth_popup",`width=${Q},height=${k},left=${ue},top=${v},toolbar=no,menubar=no`);if(!_){V(new Error("Failed to open popup window"));return}const J=Y=>{if(Y.origin===window.location.origin)if(Y.data?.type==="oauth-callback-success"){window.removeEventListener("message",J),clearInterval(oe),_.close();const ie=Y.data.provider,re=Y.data.identity;if(console.debug("[Identity] Received oauth-callback-success for provider:",ie),console.debug("[Identity] Identity from popup:",re),re){const ve=T.getState().identities,Z=new Map(ve);Z.set(ie,re),T.setState({identities:Z,pendingAuthorization:null}),console.debug("[Identity] Store updated with identity from popup, identities count:",Z.size),G(re);return}setTimeout(()=>{const Z=localStorage.getItem("agent-runtimes-identity");if(console.debug("[Identity] Fallback: reading from localStorage"),Z)try{const Le=JSON.parse(Z).state?.identities||[],fe=new Map(Le).get(ie);if(fe){const Fe=T.getState().identities,Ce=new Map(Fe);Ce.set(ie,fe),T.setState({identities:Ce,pendingAuthorization:null}),G(fe);return}}catch(ze){console.error("[Identity] Failed to parse identity from localStorage:",ze)}T.setState({pendingAuthorization:null}),V(new Error("Identity not found after OAuth success"))},100)}else Y.data?.type==="oauth-callback-error"?(window.removeEventListener("message",J),clearInterval(oe),_.close(),T.setState({pendingAuthorization:null}),V(new Error(Y.data.error||"OAuth authentication failed"))):Y.data?.type==="oauth_callback"&&(window.removeEventListener("message",J),clearInterval(oe),_.close(),u(Y.data.payload).then(G).catch(V))};window.addEventListener("message",J);const oe=setInterval(()=>{_.closed&&(clearInterval(oe),window.removeEventListener("message",J),T.getState().pendingAuthorization&&(b(),V(new Error("Popup closed by user"))))},500)})},[S,u,b]),I=T(x=>x.connectWithToken),O=z.useCallback(async(x,U,$)=>I(x,U,$),[I]),g=z.useCallback(async x=>{await m(x)},[m]),C=z.useCallback(async x=>u(x),[u]),N=z.useCallback(()=>{b()},[b]),B=z.useCallback(x=>P(x),[P]),M=z.useCallback(x=>R(x),[R]),w=z.useCallback(async x=>(await y(x))?.accessToken??null,[y]),X=z.useCallback(x=>{p(x)},[p]),W=c!==null;return z.useMemo(()=>({identities:a,connectedProviders:d,isAuthorizing:W,isLoading:h,error:f,pendingAuthorization:c,connect:j,connectWithPopup:E,connectWithToken:O,disconnect:g,completeAuthorization:C,cancelAuthorization:N,isConnected:B,getIdentity:M,getAccessToken:w,configureProvider:X}),[a,d,W,h,f,c,j,E,O,g,C,N,B,M,w,X])}const Ee={github:{name:"GitHub",icon:Me,color:"#24292f",description:"Access GitHub repositories and APIs"},google:{name:"Google",icon:H,color:"#4285f4",description:"Access Google services and APIs"},kaggle:{name:"Kaggle",icon:H,color:"#20beff",description:"Access Kaggle datasets and notebooks"},linkedin:{name:"LinkedIn",icon:H,color:"#0077b5",description:"Access LinkedIn profile and connections"},slack:{name:"Slack",icon:H,color:"#4a154b",description:"Access Slack workspaces and channels"},notion:{name:"Notion",icon:H,color:"#000000",description:"Access Notion pages and databases"},custom:{name:"Custom",icon:de,color:"#6f42c1",description:"Custom OAuth provider"}},Bt={github:["read:user","user:email"],google:["openid","profile","email"],kaggle:["read"],linkedin:["r_liteprofile","r_emailaddress"],slack:["users:read","channels:read"],notion:["read_content"],custom:[]},Gt=({provider:t,clientId:s,providerConfig:r,scopes:l,disabled:o=!1,size:a="medium",variant:d="full",onConnect:c,onDisconnect:h,onError:f})=>{const{identities:S,isAuthorizing:u,error:b,connectWithPopup:m,disconnect:R,configureProvider:P}=ke(),y=Ee[t]||Ee.custom,p=S.find(g=>g.provider===t),j=!!p,E=u;te.useEffect(()=>{if(s){const g=t==="github"?ye:t==="google"?je:t==="kaggle"?Se:void 0;if(g){const C=r?.redirectUri||(typeof window<"u"?`${window.location.origin}${window.location.pathname}`:"");P({...g,...r,provider:t,clientId:s,redirectUri:C})}}},[s,t,r,P]);const I=z.useCallback(async()=>{try{if(j)await R(t),h?.(t);else{const g=await m(t,l||Bt[t]);c?.(g)}}catch(g){const C=g instanceof Error?g.message:String(g);C!=="Popup closed by user"&&f?.(g instanceof Error?g:new Error(C))}},[j,t,l,m,R,c,h,f]);te.useEffect(()=>{b&&f?.(b instanceof Error?b:new Error(String(b)))},[b,f]);const O={onClick:I,disabled:o||E||!s&&!j,size:a==="large"?"large":a==="small"?"small":"medium"};return d==="icon"?e.jsx(L,{...O,variant:j?"primary":"default","aria-label":j?`Disconnect ${y.name}`:`Connect ${y.name}`,sx:{width:a==="small"?28:a==="large"?44:36,height:a==="small"?28:a==="large"?44:36,p:0},children:E?e.jsx(n,{as:"span",className:"anim-rotate",display:"inline-block",children:"⏳"}):e.jsx(y.icon,{size:a==="small"?14:18})}):d==="compact"?e.jsx(L,{...O,variant:j?"primary":"default",leadingVisual:y.icon,trailingVisual:j?Pe:void 0,children:E?"Connecting...":y.name}):e.jsxs(n,{display:"flex",flexDirection:"column",gap:2,p:2,border:"1px solid",borderColor:j?"success.muted":"border.default",borderRadius:2,backgroundColor:j?"success.subtle":"canvas.subtle",children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(n,{width:40,height:40,borderRadius:2,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:y.color,color:"white",children:e.jsx(y.icon,{size:20})}),e.jsxs(n,{flex:1,children:[e.jsx(i,{sx:{fontWeight:"bold",display:"block"},children:y.name}),e.jsx(i,{sx:{fontSize:0,color:"fg.muted",display:"block"},children:j&&p?.userInfo?`Connected as ${p.userInfo.name||p.userInfo.email}`:y.description})]}),!j&&e.jsx(L,{...O,variant:"primary",leadingVisual:de,children:E?"Working...":"Connect"})]}),j&&p&&e.jsxs(n,{display:"flex",flexDirection:"column",gap:2,children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,pl:1,children:[p.userInfo?.avatarUrl&&e.jsx("a",{href:p.userInfo.profileUrl||`https://github.com/${p.userInfo.username}`,target:"_blank",rel:"noopener noreferrer",style:{display:"block",lineHeight:0},children:e.jsx("img",{src:p.userInfo.avatarUrl,alt:p.userInfo.name||"User avatar",style:{width:32,height:32,borderRadius:"50%",cursor:"pointer"}})}),e.jsxs(n,{flex:1,children:[p.userInfo?.username&&e.jsx("a",{href:p.userInfo.profileUrl||`https://github.com/${p.userInfo.username}`,target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none"},children:e.jsxs(i,{sx:{fontSize:1,color:"fg.muted",display:"block",":hover":{textDecoration:"underline"}},children:["@",p.userInfo.username]})}),e.jsx(i,{sx:{fontSize:0,color:"fg.muted",display:"block"},children:p.token?.expiresAt?`Expires ${new Date(p.token.expiresAt).toLocaleDateString()}`:"Token does not expire"})]})]}),p.scopes&&p.scopes.length>0&&e.jsx(n,{display:"flex",flexWrap:"wrap",gap:1,pl:1,children:p.scopes.map(g=>e.jsx(i,{sx:{fontSize:0,px:2,py:1,bg:"neutral.muted",borderRadius:2,color:"fg.muted"},children:g},g))}),e.jsxs(L,{...O,variant:"danger",leadingVisual:We,children:["Disconnect from ",y.name]})]})]})},Ue={github:{name:"GitHub",icon:Me,color:"#24292f",description:"Access GitHub repositories and APIs"},google:{name:"Google",icon:H,color:"#4285f4",description:"Access Google services and APIs"},kaggle:{name:"Kaggle",icon:H,color:"#20beff",description:"Access Kaggle datasets and notebooks"},linkedin:{name:"LinkedIn",icon:H,color:"#0077b5",description:"Access LinkedIn profile"},slack:{name:"Slack",icon:H,color:"#4a154b",description:"Access Slack workspaces"},notion:{name:"Notion",icon:H,color:"#000000",description:"Access Notion pages"},custom:{name:"Custom",icon:de,color:"#6f42c1",description:"Custom OAuth provider"}},Kt={github:["read:user","user:email","repo"],google:["openid","profile","email"],kaggle:["read"],linkedin:["r_liteprofile","r_emailaddress"],slack:["users:read","channels:read"],notion:["read_content"],custom:[]};function Jt(t){if(!t)return{isExpired:!1,isExpiringSoon:!1};const s=Date.now(),r=new Date(t),l=t-s,o=s-t,a=300*1e3;return{isExpired:l<0,isExpiringSoon:l>0&&l<a,expiresAt:r,timeUntilExpiry:l>0?l:void 0,timeSinceExpiry:l<0?o:void 0}}function he(t){const s=Math.floor(t/1e3),r=Math.floor(s/60),l=Math.floor(r/60),o=Math.floor(l/24);return o>0?o===1?"1 day":`${o} days`:l>0?l===1?"1 hour":`${l} hours`:r>0?r===1?"1 minute":`${r} minutes`:s===1?"1 second":`${s} seconds`}function Yt(t){return t.isExpired&&t.timeSinceExpiry?`Expired ${he(t.timeSinceExpiry)} ago`:t.timeUntilExpiry?t.isExpiringSoon?`Expires in ${he(t.timeUntilExpiry)}`:`Expires in ${he(t.timeUntilExpiry)}`:"Token does not expire"}function Xt({identity:t,providerConfig:s,showExpirationDetails:r=!0,allowReconnect:l=!0,onConnect:o,onDisconnect:a,onError:d}){const{connect:c,disconnect:h,configureProvider:f,isAuthorizing:S}=ke(),u=t.provider,b=Ue[u]||Ue.custom,m=z.useMemo(()=>Jt(t.token?.expiresAt),[t.token?.expiresAt]);te.useEffect(()=>{if(s?.clientId){const y=u==="github"?ye:u==="google"?je:u==="kaggle"?Se:void 0;if(y){const p=s.config?.redirectUri||(typeof window<"u"?`${window.location.origin}${window.location.pathname}`:"");f({...y,...s.config,provider:u,clientId:s.clientId,redirectUri:p})}}},[s,u,f]);const R=z.useCallback(async()=>{try{const y=s?.scopes||Kt[u];await c(u,y)}catch(y){d?.(y instanceof Error?y:new Error(String(y)))}},[u,s?.scopes,c,d]),P=z.useCallback(async()=>{try{await h(u),a?.(u)}catch(y){d?.(y instanceof Error?y:new Error(String(y)))}},[u,h,a,d]);return e.jsxs(n,{display:"flex",flexDirection:"column",gap:2,p:3,border:"1px solid",borderColor:m.isExpired?"danger.muted":m.isExpiringSoon?"attention.muted":"success.muted",borderRadius:2,backgroundColor:m.isExpired?"danger.subtle":m.isExpiringSoon?"attention.subtle":"success.subtle",children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(n,{width:32,height:32,borderRadius:2,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:b.color,color:"white",children:e.jsx(b.icon,{size:16})}),e.jsxs(n,{flex:1,display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontWeight:"semibold",fontSize:1},children:b.name}),e.jsx(A,{size:"small",variant:"secondary",children:t.authType==="token"?"API Key":"OAuth"})]}),m.isExpired?e.jsx(A,{variant:"danger",size:"small",children:e.jsxs(n,{display:"inline-flex",alignItems:"center",gap:1,children:[e.jsx(st,{size:12})," Expired"]})}):m.isExpiringSoon?e.jsx(A,{variant:"attention",size:"small",children:e.jsxs(n,{display:"inline-flex",alignItems:"center",gap:1,children:[e.jsx(me,{size:12})," Expiring Soon"]})}):e.jsx(A,{variant:"success",size:"small",children:e.jsxs(n,{display:"inline-flex",alignItems:"center",gap:1,children:[e.jsx(Pe,{size:12})," Connected"]})})]}),e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[t.userInfo?.avatarUrl&&e.jsx("a",{href:t.userInfo.profileUrl||(u==="github"?`https://github.com/${t.userInfo.username}`:void 0),target:"_blank",rel:"noopener noreferrer",style:{display:"block",lineHeight:0},children:e.jsx(kt,{src:t.userInfo.avatarUrl,size:32,alt:t.userInfo.name||t.userInfo.username||b.name,sx:{cursor:"pointer"}})}),e.jsxs(n,{flex:1,minWidth:0,children:[t.userInfo?.name&&e.jsx(i,{sx:{fontWeight:"semibold",fontSize:1,display:"block"},children:t.userInfo.name}),(t.userInfo?.username||t.userInfo?.email)&&e.jsx("a",{href:t.userInfo.profileUrl||(u==="github"?`https://github.com/${t.userInfo.username}`:void 0),target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none"},children:e.jsx(i,{sx:{fontSize:0,color:"fg.muted",display:"block",":hover":{textDecoration:"underline"}},children:t.userInfo.username?`@${t.userInfo.username}`:t.userInfo.email})})]})]}),r&&e.jsxs(n,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(me,{size:12}),e.jsx(i,{sx:{fontSize:0,color:m.isExpired?"danger.fg":m.isExpiringSoon?"attention.fg":"fg.muted"},children:Yt(m)})]}),t.scopes&&t.scopes.length>0&&e.jsx(n,{display:"flex",flexWrap:"wrap",gap:1,children:t.scopes.map(y=>e.jsx(A,{size:"small",variant:"secondary",children:y},y))}),e.jsxs(n,{display:"flex",gap:2,mt:1,children:[m.isExpired&&l&&s?.clientId&&e.jsx(ot,{text:"Reconnect to refresh token",children:e.jsx(L,{variant:"primary",size:"small",leadingVisual:it,onClick:R,disabled:S,children:S?"Connecting...":"Reconnect"})}),e.jsxs(L,{variant:m.isExpired?"invisible":"danger",size:"small",leadingVisual:We,onClick:P,disabled:S,children:["Disconnect from ",b.name]})]})]})}function Qt({providers:t,title:s="Connected Accounts",showHeader:r=!0,showDescription:l=!0,description:o="Connected identities for this agent. Agents can use these to access external services on your behalf.",showExpirationDetails:a=!0,allowReconnect:d=!0,onConnect:c,onDisconnect:h,onError:f}){const{identities:S,error:u}=ke(),b=z.useMemo(()=>{if(t){const p=Object.keys(t);return S.filter(j=>p.includes(j.provider)||j.authType==="token"&&j.isConnected)}return S},[S,t]),m=z.useMemo(()=>new Set(S.map(p=>p.provider)),[S]),R=z.useMemo(()=>{if(!t)return{};const p=Object.keys(t),j={};for(const E of p)m.has(E)||(j[E]=t[E]);return j},[t,m]),P=Object.keys(R).length>0,y=z.useCallback(p=>j=>{f?.(p,j)},[f]);return b.length===0&&!t?null:e.jsxs(n,{children:[r&&e.jsxs(n,{display:"flex",alignItems:"center",gap:2,mb:2,children:[e.jsx(H,{size:16}),e.jsx(i,{sx:{fontSize:1,fontWeight:"semibold",color:"fg.muted"},children:s})]}),e.jsxs(n,{p:3,bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",children:[l&&e.jsx(i,{sx:{fontSize:0,color:"fg.muted",display:"block",mb:b.length>0?3:0},children:o}),u&&e.jsx(nt,{variant:"danger",sx:{mb:3},children:u instanceof Error?u.message:String(u)}),b.length>0?e.jsx(n,{display:"flex",flexDirection:"column",gap:2,children:b.map(p=>e.jsx(Xt,{identity:p,providerConfig:t?.[p.provider],showExpirationDetails:a,allowReconnect:d,onConnect:c,onDisconnect:h,onError:y(p.provider)},p.provider))}):P?null:e.jsxs(n,{display:"flex",alignItems:"center",gap:2,color:"fg.muted",children:[e.jsx(de,{size:16}),e.jsx(i,{sx:{fontSize:1},children:"No connected accounts"})]}),P&&e.jsxs(n,{mt:b.length>0?3:0,children:[b.length>0&&e.jsx(i,{sx:{fontSize:0,color:"fg.muted",display:"block",mb:2},children:"Connect additional accounts:"}),e.jsx(n,{display:"flex",flexDirection:"column",gap:2,children:Object.keys(R).map(p=>{const j=R[p];return e.jsx(Gt,{provider:p,clientId:j.clientId,scopes:j.scopes,providerConfig:j.config,size:"medium",variant:"full",onConnect:c,onDisconnect:h,onError:y(p)},p)})})]})]})]})}const ge=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),xe=t=>{if(t==null)return"null";if(typeof t=="number"||typeof t=="boolean")return String(t);const s=String(t);return s===""?"''":/^[a-zA-Z0-9._/-]+$/.test(s)?s:JSON.stringify(s)},be=(t,s=0)=>{const r=" ".repeat(s);if(Array.isArray(t))return t.length===0?"[]":t.map(l=>ge(l)||Array.isArray(l)?`${r}-
|
|
1
|
+
import{J as te,r as z,j as e,B as n,H as F,dv as ae,T as i,v as L,fa as De,fm as le,fn as He,fo as qe,fp as me,fq as Pe,fr as Be,fs as Ge,ft as Ke,fu as Je,fv as Ye,fw as V,Y as ce,bu as Xe,du as Qe,L as A,b2 as Ze,fx as et,fy as tt,fz as nt,fA as de,fB as Oe,dt as st,fC as ot,fD as it,dr as rt,I as Me,f7 as lt,fE as at,fF as ct,fG as dt,fH as ut,fI as ft,fJ as pt,fK as ht,fL as gt,fM as xt,fN as mt,fO as ne,fP as se,ds as bt,fQ as yt}from"../datalayer-app-main.js";import{A as Ie}from"./ArrowLeftIcon-sX3iNMG1.js";import{A as jt,T as St,M as We,U as $e,F as wt}from"./UnlinkIcon-fXwOyjzQ.js";import Te from"./esm-VjpQWsU9.js";import{P as Ne}from"./index-BaRoLDk0.js";import{A as kt}from"./Avatar-DUPBQXVt.js";import"./core-BrYTRvTy.js";function vt(t,s){if(Object.is(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;if(t instanceof Map&&s instanceof Map){if(t.size!==s.size)return!1;for(const[l,o]of t)if(!Object.is(o,s.get(l)))return!1;return!0}if(t instanceof Set&&s instanceof Set){if(t.size!==s.size)return!1;for(const l of t)if(!s.has(l))return!1;return!0}const r=Object.keys(t);if(r.length!==Object.keys(s).length)return!1;for(const l of r)if(!Object.prototype.hasOwnProperty.call(s,l)||!Object.is(t[l],s[l]))return!1;return!0}const{useRef:zt}=te;function Le(t){const s=zt();return r=>{const l=t(r);return vt(s.current,l)?s.current:s.current=l}}function D(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString()}function Ae(t){if(!Number.isFinite(t)||Number.isNaN(t)||t<0)return"0ms";if(t<1)return`${Math.max(0,Math.round(t*1e3))}ms`;if(t<60)return`${t.toFixed(1)}s`;const s=Math.floor(t/60),r=Math.round(t%60);return`${s}m ${r}s`}function Ct(t){const s=String(t??"");return/[",\n]/.test(s)?`"${s.replace(/"/g,'""')}"`:s}function It(t){const s=[];s.push(["Context Usage Snapshot for Agent",t.agentId]),s.push(["Generated At",new Date().toISOString()]),s.push([]),s.push(["Summary"]),s.push(["Total Tokens",t.totalTokens]),s.push(["Context Window",t.contextWindow]),s.push(["System Prompt Tokens",t.systemPromptTokens]),s.push(["Tool Tokens",t.toolTokens]),s.push(["History Tokens",t.historyTokens]),s.push(["Current Message Tokens",t.currentMessageTokens]),s.push(["User Message Tokens",t.userMessageTokens]),s.push(["Assistant Message Tokens",t.assistantMessageTokens]),s.push([]),t.sessionUsage&&(s.push(["Session Usage"]),s.push(["Input Tokens",t.sessionUsage.inputTokens]),s.push(["Output Tokens",t.sessionUsage.outputTokens]),s.push(["Requests",t.sessionUsage.requests]),s.push(["Tool Calls",t.sessionUsage.toolCalls]),s.push(["Turns",t.sessionUsage.turns]),s.push(["Duration Seconds",t.sessionUsage.durationSeconds]),s.push([])),t.turnUsage&&(s.push(["Last Turn Usage"]),s.push(["Input Tokens",t.turnUsage.inputTokens]),s.push(["Output Tokens",t.turnUsage.outputTokens]),s.push(["Requests",t.turnUsage.requests]),s.push(["Tool Calls",t.turnUsage.toolCalls]),s.push(["Duration Seconds",t.turnUsage.durationSeconds]),s.push([])),s.push(["Distribution"]),s.push(["Category","Tokens"]);for(const c of t.distribution?.children??[])s.push([c.name,c.value]);if(s.push([]),t.perRequestUsage.length>0){s.push(["Per Request Usage"]),s.push(["Request #","Input Tokens","Output Tokens","Duration Ms","Tool Names","Timestamp","Turn ID"]);for(const c of t.perRequestUsage)s.push([c.requestNum,c.inputTokens,c.outputTokens,c.durationMs,c.toolNames.join("; "),c.timestamp??"",c.turnId??""])}const r=s.map(c=>c.map(Ct).join(",")).join(`
|
|
2
|
+
`),l=new Blob([r],{type:"text/csv;charset=utf-8;"}),o=URL.createObjectURL(l),a=document.createElement("a");a.href=o;const d=new Date().toISOString().replace(/[:.]/g,"-");a.download=`context-usage-${t.agentId}-${d}.csv`,a.style.display="none",document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(o)}function Tt(t){switch(t.toLowerCase()){case"messages":case"history":return Ke;case"tools":case"tool definitions":return Ge;case"system":case"system prompts":return Be;case"cache":return Pe;default:return me}}function At({agentId:t,apiBase:s,liveData:r,messageCount:l=0,defaultView:o="overview",chartHeight:a="200px"}){const[d,c]=z.useState(o),[h,f]=z.useState(!1),S=r!==void 0,u=r,b=!S,m=z.useMemo(()=>{if(!u?.perRequestUsage||u.perRequestUsage.length===0)return null;const g=u.perRequestUsage;let C=0,N=0;const B=[],M=[],w=[],X=[];return g.forEach(W=>{C+=W.inputTokens,N+=W.outputTokens,B.push(`#${W.requestNum}`),M.push(C),w.push(N),X.push(C+N)}),{tooltip:{trigger:"axis",formatter:W=>{let U=`<strong>${W[0]?.axisValue||""}</strong><br/>`;return W.forEach($=>{U+=`${$.marker} ${$.seriesName}: ${D($.value)}<br/>`}),U}},legend:{data:["Input","Output","Total"],bottom:0,textStyle:{fontSize:10}},grid:{left:45,right:15,top:10,bottom:35},xAxis:{type:"category",data:B,axisLabel:{fontSize:10}},yAxis:{type:"value",axisLabel:{fontSize:10,formatter:W=>D(W)}},series:[{name:"Input",type:"line",data:M,smooth:!0,lineStyle:{width:2},areaStyle:{opacity:.2},itemStyle:{color:"#3B82F6"}},{name:"Output",type:"line",data:w,smooth:!0,lineStyle:{width:2},areaStyle:{opacity:.2},itemStyle:{color:"#10B981"}},{name:"Total",type:"line",data:X,smooth:!0,lineStyle:{width:2,type:"dashed"},itemStyle:{color:"#8B5CF6"}}]}},[u?.perRequestUsage]),R=z.useMemo(()=>{if(!u?.distribution)return null;const{distribution:g}=u,C=g.children&&g.children.length>0;return{tooltip:{formatter:N=>`${N.name}: ${D(N.value)} tokens`},series:[{type:"treemap",data:C?g.children:[{name:"No data",value:1}],roam:!1,breadcrumb:{show:!1},label:{show:!0,formatter:"{b}",fontSize:11},itemStyle:{borderColor:"#fff",borderWidth:2},levels:[{itemStyle:{borderColor:"#777",borderWidth:0,gapWidth:1}},{itemStyle:{borderColor:"#555",borderWidth:5,gapWidth:1},colorSaturation:[.35,.5]},{colorSaturation:[.35,.5]}]}]}},[u?.distribution]);if(b)return e.jsxs(n,{children:[e.jsx(F,{as:"h4",sx:{fontSize:1,fontWeight:"semibold",mb:2,color:"fg.muted"},children:"Context Usage"}),e.jsxs(n,{p:3,bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",display:"flex",alignItems:"center",gap:2,children:[e.jsx(ae,{size:"small"}),e.jsx(i,{sx:{fontSize:1,color:"fg.muted"},children:"Loading context details..."})]})]});if(!u)return e.jsxs(n,{children:[e.jsx(F,{as:"h4",sx:{fontSize:1,fontWeight:"semibold",mb:2,color:"fg.muted"},children:"Context Usage"}),e.jsx(n,{p:3,bg:"attention.subtle",borderRadius:2,border:"1px solid",borderColor:"attention.muted",children:e.jsx(i,{sx:{fontSize:1,color:"attention.fg"},children:"Waiting for context data from WebSocket stream..."})})]});const{totalTokens:P,contextWindow:y,sessionUsage:p,turnUsage:j,distribution:E}=u,I=l>0?l:Math.max(p?.turns??0,u.perRequestUsage?.length>0?1:0),O=E?.children&&E.children.length>0;return e.jsxs(n,{children:[e.jsxs(n,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,children:[e.jsx(F,{as:"h4",sx:{fontSize:1,fontWeight:"semibold",color:"fg.muted"},children:"Context Usage"}),e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[I>0&&e.jsxs(i,{sx:{fontSize:0,color:"fg.muted"},children:[I," ",I===1?"message sent":"messages sent"]}),e.jsx(L,{size:"small",variant:"invisible",leadingVisual:De,onClick:()=>It(u),children:"Download"})]})]}),e.jsxs(n,{p:3,bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",children:[e.jsx(n,{mb:3,children:e.jsxs(i,{sx:{fontSize:1,fontWeight:"semibold"},children:["Total usage: ",D(P)]})}),(p||j)&&e.jsxs(n,{display:"flex",gap:3,mb:3,flexWrap:"wrap",children:[p&&e.jsxs(n,{flex:1,minWidth:120,p:2,bg:"canvas.default",borderRadius:2,border:"1px solid",borderColor:"border.muted",children:[e.jsxs(i,{sx:{fontSize:0,color:"fg.muted",display:"block"},children:["Session (",p.turns," turns)"]}),e.jsx(i,{sx:{fontSize:1,fontWeight:"semibold"},children:D(p.inputTokens+p.outputTokens)}),e.jsxs(i,{sx:{fontSize:0,color:"fg.muted"},children:[" ","in ",Ae(p.durationSeconds)]})]}),j&&e.jsxs(n,{flex:1,minWidth:120,p:2,bg:"canvas.default",borderRadius:2,border:"1px solid",borderColor:"border.muted",children:[e.jsxs(i,{sx:{fontSize:0,color:"fg.muted",display:"block"},children:["Last Turn (",j.requests," reqs)"]}),e.jsx(i,{sx:{fontSize:1,fontWeight:"semibold"},children:D(j.inputTokens+j.outputTokens)}),e.jsxs(i,{sx:{fontSize:0,color:"fg.muted"},children:[" ","in ",Ae(j.durationSeconds)]})]})]}),e.jsxs(n,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,children:[e.jsxs(le,{"aria-label":"View mode",size:"small",onChange:g=>{c(["overview","distribution","history"][g])},children:[e.jsx(le.IconButton,{"aria-label":"Overview",selected:d==="overview",icon:He}),e.jsx(le.IconButton,{"aria-label":"Distribution",selected:d==="distribution",icon:jt,disabled:!O}),e.jsx(le.IconButton,{"aria-label":"History",selected:d==="history",icon:qe})]}),d==="overview"&&e.jsx(L,{size:"small",variant:"invisible",onClick:()=>f(!h),children:h?"Less":"More"})]}),d==="overview"&&e.jsxs(n,{children:[e.jsxs(n,{display:"flex",flexDirection:"column",gap:2,children:[O&&E.children.map(g=>{const C=Tt(g.name),N=g.value/y*100;return e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(n,{color:"fg.muted",width:20,children:e.jsx(C,{size:16})}),e.jsx(i,{sx:{fontSize:1,flex:1},children:g.name}),e.jsx(i,{sx:{fontSize:0,color:"fg.muted",minWidth:60},children:D(g.value)}),e.jsx(n,{width:80,children:e.jsx(Ne,{progress:N,sx:{height:4}})})]},g.name)}),!O&&e.jsx(i,{sx:{color:"fg.muted",fontSize:1,textAlign:"center",py:2},children:"No context data yet. Start a conversation to see usage."})]}),h&&O&&e.jsxs(n,{mt:3,p:2,bg:"canvas.default",borderRadius:2,border:"1px solid",borderColor:"border.muted",fontSize:0,children:[u.systemPromptTokens>0&&e.jsxs(n,{mb:2,children:[e.jsxs(i,{sx:{fontWeight:"semibold"},children:["System Prompts:"," ",D(u.systemPromptTokens)," tokens"]}),u.systemPrompts.slice(0,2).map((g,C)=>e.jsxs(i,{sx:{display:"block",ml:2,mt:1,color:"fg.muted"},children:["•"," ",g.length>80?g.slice(0,80)+"...":g]},C))]}),u.toolTokens>0&&e.jsxs(n,{mb:2,children:[e.jsxs(i,{sx:{fontWeight:"semibold"},children:["Tools: ",D(u.toolTokens)," tokens (",u.tools.length," tools)"]}),e.jsxs(n,{ml:2,mt:1,children:[u.tools.slice(0,4).map((g,C)=>e.jsxs(i,{sx:{display:"block",color:"fg.muted"},children:["• ",g.name,": ",D(g.totalTokens)]},C)),u.tools.length>4&&e.jsxs(i,{sx:{color:"fg.muted",fontStyle:"italic"},children:["...and ",u.tools.length-4," more"]})]})]}),(u.userMessageTokens>0||u.assistantMessageTokens>0)&&e.jsxs(n,{mb:2,children:[e.jsxs(i,{sx:{fontWeight:"semibold"},children:["Messages:"," ",D(u.userMessageTokens+u.assistantMessageTokens)," ","tokens"]}),e.jsxs(n,{ml:2,mt:1,children:[e.jsxs(i,{sx:{display:"block",color:"fg.muted"},children:["• User: ",D(u.userMessageTokens)]}),e.jsxs(i,{sx:{display:"block",color:"fg.muted"},children:["• Assistant:"," ",D(u.assistantMessageTokens)]}),u.toolCallTokens>0&&e.jsxs(i,{sx:{display:"block",color:"fg.muted"},children:["• Tool calls:"," ",D(u.toolCallTokens)]})]})]})]})]}),d==="distribution"&&R&&e.jsx(Te,{option:R,style:{height:a},opts:{renderer:"svg"}}),d==="history"&&m&&e.jsxs(n,{children:[e.jsx(Te,{option:m,style:{height:a},opts:{renderer:"svg"}}),h&&u.perRequestUsage.length>0&&e.jsx(n,{mt:2,maxHeight:"150px",overflowY:"auto",fontSize:0,children:u.perRequestUsage.slice(-10).reverse().map((g,C)=>e.jsxs(n,{display:"flex",gap:2,py:1,borderBottom:C<9?"1px solid":"none",borderColor:"border.muted",children:[e.jsxs(i,{sx:{fontWeight:"semibold",minWidth:30},children:["#",g.requestNum]}),e.jsxs(i,{sx:{color:"#3B82F6"},children:["↓",D(g.inputTokens)]}),e.jsxs(i,{sx:{color:"#10B981"},children:["↑",D(g.outputTokens)]}),g.toolNames.length>0&&e.jsxs(i,{sx:{color:"fg.muted"},children:["🔧 ",g.toolNames.join(", ")]})]},g.requestNum))})]}),d==="history"&&!m&&e.jsx(n,{py:3,children:e.jsx(i,{sx:{color:"fg.muted",fontSize:1},children:"No history"})})]})]})}function q(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString()}function ee({title:t,icon:s,count:r,tokens:l,defaultExpanded:o=!1,children:a}){const[d,c]=z.useState(o);return e.jsxs(n,{mb:2,children:[e.jsxs(n,{as:"button",onClick:()=>c(!d),display:"flex",alignItems:"center",gap:2,width:"100%",p:2,bg:"canvas.subtle",border:"1px solid",borderColor:"border.default",borderRadius:2,cursor:"pointer",hover:{bg:"canvas.inset"},children:[d?e.jsx(Xe,{size:16}):e.jsx(Qe,{size:16}),te.createElement(s,{size:16}),e.jsx(i,{sx:{fontWeight:"semibold",flex:1,textAlign:"left"},children:t}),r!==void 0&&e.jsx(A,{variant:"secondary",size:"small",children:r}),l!==void 0&&l>0&&e.jsxs(i,{sx:{fontSize:0,color:"fg.muted"},children:[q(l)," tokens"]})]}),d&&e.jsx(n,{border:"1px solid",borderColor:"border.default",borderTop:"none",borderRadius:"0 0 6px 6px",p:2,children:a})]})}function Et({tool:t}){const[s,r]=z.useState(!1),[l,o]=z.useState(!1);return e.jsxs(n,{p:2,mb:2,bg:"canvas.default",border:"1px solid",borderColor:"border.muted",borderRadius:2,children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,mb:1,children:[e.jsx(i,{sx:{fontWeight:"bold",fontFamily:"mono",fontSize:1},children:t.name}),e.jsx(A,{size:"small",variant:"secondary",children:t.sourceType}),t.isAsync&&e.jsx(A,{size:"small",variant:"accent",children:"async"}),t.requiresApproval&&e.jsx(A,{size:"small",variant:"attention",children:"requires approval"}),e.jsxs(i,{sx:{fontSize:0,color:"fg.muted",ml:"auto"},children:[q(t.totalTokens)," tokens"]})]}),t.description&&e.jsx(i,{sx:{fontSize:1,color:"fg.muted",display:"block",mb:2},children:t.description}),e.jsxs(n,{display:"flex",gap:2,children:[e.jsxs(L,{size:"small",variant:"invisible",onClick:()=>r(!s),children:[s?"Hide":"Show"," Schema"]}),t.sourceCode&&e.jsxs(L,{size:"small",variant:"invisible",onClick:()=>o(!l),children:[l?"Hide":"Show"," Source"]})]}),s&&e.jsx(n,{as:"pre",mt:2,p:2,bg:"canvas.inset",borderRadius:2,fontSize:0,overflow:"auto",maxHeight:200,children:JSON.stringify(t.parametersSchema,null,2)}),l&&t.sourceCode&&e.jsx(n,{as:"pre",mt:2,p:2,bg:"canvas.inset",borderRadius:2,fontSize:0,overflow:"auto",maxHeight:300,children:t.sourceCode})]})}function Ut({agentId:t,apiBase:s,liveData:r}){const l=r!==void 0,o=r;if(!l)return e.jsx(n,{p:3,display:"flex",alignItems:"center",justifyContent:"center",children:e.jsx(i,{sx:{color:"fg.muted"},children:"Waiting for context data from WebSocket stream..."})});if(!o)return e.jsx(n,{p:3,bg:"attention.subtle",borderRadius:2,border:"1px solid",borderColor:"attention.muted",children:e.jsx(i,{sx:{color:"attention.fg"},children:"No context data available."})});if(o.error)return e.jsx(n,{p:3,bg:"attention.subtle",borderRadius:2,border:"1px solid",borderColor:"attention.muted",children:e.jsx(i,{sx:{color:"attention.fg"},children:o.error})});const{tokenSummary:a,modelConfiguration:d}=o;return e.jsxs(n,{children:[e.jsxs(n,{mb:3,children:[e.jsxs(i,{sx:{fontSize:1,fontWeight:"semibold"},children:["Total usage: ",q(a.total)," /"," ",q(a.contextWindow)," (",Math.round(a.usagePercent),"%)"]}),e.jsx(Ne,{progress:Math.min(a.usagePercent,100),sx:{mt:2,height:8},bg:a.usagePercent>90?"danger.emphasis":a.usagePercent>70?"attention.emphasis":"success.emphasis"}),e.jsxs(n,{display:"flex",gap:3,mt:2,flexWrap:"wrap",fontSize:0,color:"fg.muted",children:[e.jsxs(i,{children:["System: ",q(a.systemPrompts)]}),e.jsxs(i,{children:["Tools: ",q(a.tools)]}),a.memory>0&&e.jsxs(i,{children:["Memory: ",q(a.memory)]}),e.jsxs(i,{children:["History: ",q(a.history)]}),e.jsxs(i,{children:["Current: ",q(a.current)]})]})]}),e.jsx(ee,{title:"Model Configuration",icon:Je,defaultExpanded:!1,children:e.jsxs(n,{display:"grid",gridTemplateColumns:"1fr 2fr",gap:2,children:[e.jsx(i,{sx:{fontWeight:"semibold",fontSize:1},children:"Model:"}),e.jsx(i,{sx:{fontSize:1,fontFamily:"mono"},children:d.modelName||"Not specified"}),e.jsx(i,{sx:{fontWeight:"semibold",fontSize:1},children:"Context Window:"}),e.jsxs(i,{sx:{fontSize:1},children:[q(d.contextWindow)," tokens"]}),Object.keys(d.settings).length>0&&e.jsxs(e.Fragment,{children:[e.jsx(i,{sx:{fontWeight:"semibold",fontSize:1},children:"Settings:"}),e.jsx(n,{as:"pre",fontSize:0,p:2,bg:"canvas.inset",borderRadius:2,overflow:"auto",children:JSON.stringify(d.settings,null,2)})]})]})}),e.jsx(ee,{title:"System Prompts",icon:Ye,count:o.systemPrompts.length,tokens:o.systemPromptTokens,children:o.systemPrompts.length===0?e.jsx(i,{sx:{color:"fg.muted",fontSize:1},children:"No system prompts configured"}):o.systemPrompts.map((c,h)=>e.jsxs(n,{p:2,mb:2,bg:"canvas.inset",borderRadius:2,border:"1px solid",borderColor:"border.muted",children:[e.jsxs(n,{display:"flex",justifyContent:"space-between",mb:1,children:[e.jsxs(i,{sx:{fontWeight:"semibold",fontSize:0},children:["Prompt ",h+1]}),e.jsxs(i,{sx:{fontSize:0,color:"fg.muted"},children:[q(c.tokens)," tokens"]})]}),e.jsx(i,{as:"pre",sx:{fontSize:0,whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:200,overflow:"auto"},children:c.content})]},h))}),e.jsx(ee,{title:"Tool Definitions",icon:St,count:o.tools.length,tokens:o.toolTokens,children:o.tools.length===0?e.jsx(i,{sx:{color:"fg.muted",fontSize:1},children:"No tools configured"}):o.tools.map((c,h)=>e.jsx(Et,{tool:c},h))}),o.memoryBlocks.length>0&&e.jsx(ee,{title:"Memory Blocks",icon:Pe,count:o.memoryBlocks.length,tokens:o.memoryTokens,children:o.memoryBlocks.map((c,h)=>e.jsx(n,{as:"pre",p:2,mb:2,bg:"canvas.inset",borderRadius:2,fontSize:0,overflow:"auto",children:JSON.stringify(c,null,2)},h))}),Object.keys(o.toolEnvironment).length>0&&e.jsx(ee,{title:"Tool Environment",icon:V,count:Object.keys(o.toolEnvironment).length,children:e.jsx(n,{display:"grid",gridTemplateColumns:"1fr 2fr",gap:2,children:Object.entries(o.toolEnvironment).map(([c,h])=>e.jsxs(te.Fragment,{children:[e.jsx(i,{sx:{fontFamily:"mono",fontSize:1,fontWeight:"semibold"},children:c}),e.jsx(i,{sx:{fontFamily:"mono",fontSize:1,color:"fg.muted"},children:h})]},c))})}),o.toolRules.length>0&&e.jsx(ee,{title:"Tool Rules",icon:ce,count:o.toolRules.length,children:o.toolRules.map((c,h)=>e.jsx(n,{as:"pre",p:2,mb:2,bg:"canvas.inset",borderRadius:2,fontSize:0,overflow:"auto",children:JSON.stringify(c,null,2)},h))})]})}const ye={provider:"github",displayName:"GitHub",iconUrl:"https://github.githubassets.com/favicons/favicon.svg",authorizationUrl:"https://github.com/login/oauth/authorize",tokenUrl:"https://github.com/login/oauth/access_token",userInfoUrl:"https://api.github.com/user",revocationUrl:"https://api.github.com/applications/{client_id}/token",defaultScopes:["read:user","user:email"]},je={provider:"google",displayName:"Google",iconUrl:"https://www.google.com/favicon.ico",authorizationUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",userInfoUrl:"https://www.googleapis.com/oauth2/v2/userinfo",revocationUrl:"https://oauth2.googleapis.com/revoke",defaultScopes:["openid","email","profile"],additionalParams:{access_type:"offline",prompt:"consent"}},Se={provider:"kaggle",displayName:"Kaggle",iconUrl:"https://www.kaggle.com/static/images/favicon.ico",authorizationUrl:"https://www.kaggle.com/oauth/authorize",tokenUrl:"https://www.kaggle.com/oauth/token",userInfoUrl:"https://www.kaggle.com/api/v1/me",defaultScopes:["datasets:read","notebooks:read"]};function _t(t=64){const s=Math.max(43,Math.min(128,t)),r=new Uint8Array(s);return crypto.getRandomValues(r),we(r)}async function Rt(t){const r=new TextEncoder().encode(t),l=await crypto.subtle.digest("SHA-256",r);return we(new Uint8Array(l))}function Dt(){const t=new Uint8Array(32);return crypto.getRandomValues(t),we(t)}function we(t){let s="";const r=new Uint8Array(t);for(let l=0;l<r.length;l++)s+=String.fromCharCode(r[l]);return s=btoa(s),s.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}async function Pt(){const t=_t(),s=await Rt(t);return{codeVerifier:t,codeChallenge:s}}const Ot="datalayer-agent-identities",Ee="/api/v1/identity/oauth/token",Mt="/api/v1/identity/oauth/userinfo",Wt="/api/v1/identity/oauth/revoke",$t={identities:new Map,pendingAuthorization:null,providerConfigs:new Map,isLoading:!1,error:null};function Nt(t,s,r,l){const o=new URLSearchParams({client_id:t.clientId,redirect_uri:t.redirectUri,response_type:"code",scope:s.join(" "),state:r,code_challenge:l,code_challenge_method:"S256",...t.additionalParams});return`${t.authorizationUrl}?${o.toString()}`}const T=Ze()(et(tt(nt((t,s)=>({...$t,configureProvider:r=>{t(l=>{const o=new Map(l.providerConfigs);return o.set(r.provider,r),{providerConfigs:o}})},startAuthorization:async(r,l,o)=>{const d=s().providerConfigs.get(r);if(!d)throw new Error(`Provider ${r} is not configured`);const{codeVerifier:c,codeChallenge:h}=await Pt(),f=Dt(),S=l||d.defaultScopes,u=Nt(d,S,f,h),b={requestId:`auth-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,provider:r,authUrl:u,state:f,codeVerifier:c,scopes:S,requestedAt:Date.now(),onComplete:o?.onComplete,onError:o?.onError};return t({pendingAuthorization:b,error:null}),u},completeAuthorization:async r=>{const l=s(),o=l.pendingAuthorization;if(!o)throw new Error("No pending authorization request");if(r.state!==o.state){const a=new Error("State mismatch - possible CSRF attack");throw o.onError?.(a),t({pendingAuthorization:null,error:a}),a}if(r.error){const a=new Error(r.errorDescription||r.error);throw o.onError?.(a),t({pendingAuthorization:null,error:a}),a}t({isLoading:!0});try{const a=l.providerConfigs.get(o.provider);if(!a)throw new Error(`Provider ${o.provider} is not configured`);const d=a.redirectUri.split("/").slice(0,3).join("/"),c=await fetch(`${d}${Ee}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:o.provider,code:r.code,code_verifier:o.codeVerifier,redirect_uri:a.redirectUri})});if(!c.ok){const b=await c.json().catch(()=>({}));throw new Error(b.detail||`Token exchange failed: ${c.status}`)}const h=await c.json(),f={accessToken:h.access_token,tokenType:h.token_type||"Bearer",expiresAt:h.expires_in?Date.now()+h.expires_in*1e3:void 0,refreshToken:h.refresh_token,scopes:o.scopes};let S;if(a.userInfoUrl)try{const b=await fetch(`${d}${Mt}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:o.provider,access_token:f.accessToken})});if(b.ok){const m=await b.json();S={id:m.id?.toString()||m.sub,username:m.login||m.username,name:m.name,email:m.email,avatarUrl:m.avatar_url||m.picture,profileUrl:m.html_url||m.profile,raw:m}}}catch(b){console.warn("Failed to fetch user info:",b)}const u={provider:o.provider,displayName:a.displayName,iconUrl:a.iconUrl,scopes:o.scopes,isConnected:!0,connectedAt:Date.now(),userInfo:S,token:f};return t(b=>{const m=new Map(b.identities);return m.set(o.provider,u),{identities:m,pendingAuthorization:null,isLoading:!1,error:null}}),o.onComplete?.(u),u}catch(a){const d=a instanceof Error?a:new Error(String(a));throw o.onError?.(d),t({isLoading:!1,error:d,pendingAuthorization:null}),d}},cancelAuthorization:()=>{const r=s().pendingAuthorization;r?.onError&&r.onError(new Error("Authorization cancelled")),t({pendingAuthorization:null})},connectWithToken:async(r,l,o)=>{t({isLoading:!0,error:null});try{const a={accessToken:l,tokenType:"Bearer",scopes:[]},d={kaggle:{displayName:"Kaggle",iconUrl:"https://www.kaggle.com/static/images/favicon.ico"}}[r]||{displayName:r,iconUrl:void 0},c={provider:r,authType:"token",displayName:o?.displayName||d.displayName,iconUrl:o?.iconUrl||d.iconUrl,scopes:[],isConnected:!0,connectedAt:Date.now(),userInfo:o?.userInfo,token:a};return t(h=>{const f=new Map(h.identities);return f.set(r,c),{identities:f,isLoading:!1,error:null}}),c}catch(a){const d=a instanceof Error?a:new Error(String(a));throw t({isLoading:!1,error:d}),d}},disconnect:async r=>{const l=s(),o=l.identities.get(r),a=l.providerConfigs.get(r);if(!o||!o.token){t(d=>{const c=new Map(d.identities);return c.delete(r),{identities:c}});return}if(o.authType==="token"){t(d=>{const c=new Map(d.identities);return c.delete(r),{identities:c}});return}if(a?.revocationUrl)try{const d=a.redirectUri.split("/").slice(0,3).join("/");await fetch(`${d}${Wt}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r,access_token:o.token.accessToken})})}catch(d){console.warn("Failed to revoke token:",d)}t(d=>{const c=new Map(d.identities);return c.delete(r),{identities:c}})},refreshToken:async r=>{const l=s(),o=l.identities.get(r),a=l.providerConfigs.get(r);if(!o||!o.token?.refreshToken)throw new Error(`No refresh token available for ${r}`);if(!a)throw new Error(`Provider ${r} is not configured`);const d=a.redirectUri.split("/").slice(0,3).join("/"),c=await fetch(`${d}${Ee}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r,grant_type:"refresh_token",refresh_token:o.token.refreshToken})});if(!c.ok)throw new Error(`Token refresh failed: ${c.status}`);const h=await c.json(),f={accessToken:h.access_token,tokenType:h.token_type||"Bearer",expiresAt:h.expires_in?Date.now()+h.expires_in*1e3:void 0,refreshToken:h.refresh_token||o.token.refreshToken,scopes:o.scopes};return t(S=>{const u=new Map(S.identities);return u.set(r,{...o,token:f}),{identities:u}}),f},getIdentity:r=>s().identities.get(r),isConnected:r=>s().identities.get(r)?.isConnected??!1,getToken:async r=>{const o=s().identities.get(r);if(!o||!o.token)return null;const a=o.token.expiresAt;if(a&&a-Date.now()<300*1e3){if(o.token.refreshToken)try{return await s().refreshToken(r)}catch(d){return console.warn("Token refresh failed:",d),null}return null}return o.token},clearAll:()=>{t({identities:new Map,pendingAuthorization:null,error:null})},setError:r=>{t({error:r})}}),{name:Ot,storage:{getItem:t=>{const s=localStorage.getItem(t);if(!s)return null;const r=JSON.parse(s),l=new URLSearchParams(window.location.search),o=l.has("code")&&l.has("state");return{state:{...r.state,identities:new Map(r.state.identities||[]),providerConfigs:new Map(r.state.providerConfigs||[]),pendingAuthorization:o&&r.state.pendingAuthorization||null,isLoading:!1,error:null}}},setItem:(t,s)=>{const r={state:{...s.state,identities:Array.from(s.state.identities.entries()),providerConfigs:Array.from(s.state.providerConfigs.entries()),pendingAuthorization:s.state.pendingAuthorization?{...s.state.pendingAuthorization,onComplete:void 0,onError:void 0}:null,isLoading:!1,error:null}};localStorage.setItem(t,JSON.stringify(r))},removeItem:t=>localStorage.removeItem(t)},partialize:t=>({identities:t.identities,providerConfigs:t.providerConfigs,pendingAuthorization:t.pendingAuthorization})})),{name:"IdentityStore"}));function Lt(){return T(Le(t=>Array.from(t.identities.values()).filter(s=>s.isConnected)))}function Ft(){return T(Le(t=>Array.from(t.identities.entries()).filter(([s,r])=>r.isConnected).map(([s])=>s)))}function Vt(){return T(t=>t.pendingAuthorization)}function Ht(){return T(t=>t.isLoading)}function qt(){return T(t=>t.error)}function pe(t){const s=T.getState();t.github&&s.configureProvider({...ye,clientId:t.github.clientId,redirectUri:t.github.redirectUri}),t.google&&s.configureProvider({...je,clientId:t.google.clientId,redirectUri:t.google.redirectUri}),t.kaggle&&s.configureProvider({...Se,clientId:t.kaggle.clientId,redirectUri:t.kaggle.redirectUri})}function ke(t={}){const{providers:s,baseUrl:r=typeof window<"u"?window.location.origin:"",callbackPath:l=typeof window<"u"?window.location.pathname:"/oauth/callback",autoHandleCallback:o=!0}=t,a=Lt(),d=Ft(),c=Vt(),h=Ht(),f=qt(),S=T(x=>x.startAuthorization),u=T(x=>x.completeAuthorization),b=T(x=>x.cancelAuthorization),m=T(x=>x.disconnect),R=T(x=>x.getIdentity),P=T(x=>x.isConnected),y=T(x=>x.getToken),p=T(x=>x.configureProvider);z.useEffect(()=>{if(!s)return;const x=`${r}${l}`;s.github&&pe({github:{clientId:s.github.clientId,redirectUri:s.github.redirectUri||x}}),s.google&&pe({google:{clientId:s.google.clientId,redirectUri:s.google.redirectUri||x}}),s.kaggle&&pe({kaggle:{clientId:s.kaggle.clientId,redirectUri:s.kaggle.redirectUri||x}}),s.custom&&s.custom.forEach(U=>{p(U)})},[s,r,l,p]),z.useEffect(()=>{if(!o||typeof window>"u")return;const x=new URLSearchParams(window.location.search),U=x.get("code"),$=x.get("state"),G=x.get("error"),H=x.get("error_description");(U&&$||G)&&u({code:U||"",state:$||"",error:G||void 0,errorDescription:H||void 0}).then(()=>{const K=window.location.pathname;window.history.replaceState({},"",K)}).catch(K=>{console.error("OAuth callback error:",K);const Q=window.location.pathname;window.history.replaceState({},"",Q)})},[o,u]);const j=z.useCallback(async(x,U)=>{const $=await S(x,U);window.location.href=$},[S]),E=z.useCallback(async(x,U)=>{const $=await S(x,U,{onComplete:()=>{},onError:()=>{}});return new Promise((G,H)=>{const K=T.getState();K.pendingAuthorization&&(K.pendingAuthorization.onComplete=G,K.pendingAuthorization.onError=H);const Q=600,k=700,ue=window.screenX+(window.outerWidth-Q)/2,v=window.screenY+(window.outerHeight-k)/2,_=window.open($,"oauth_popup",`width=${Q},height=${k},left=${ue},top=${v},toolbar=no,menubar=no`);if(!_){H(new Error("Failed to open popup window"));return}const J=Y=>{if(Y.origin===window.location.origin)if(Y.data?.type==="oauth-callback-success"){window.removeEventListener("message",J),clearInterval(oe),_.close();const ie=Y.data.provider,re=Y.data.identity;if(console.debug("[Identity] Received oauth-callback-success for provider:",ie),console.debug("[Identity] Identity from popup:",re),re){const ve=T.getState().identities,Z=new Map(ve);Z.set(ie,re),T.setState({identities:Z,pendingAuthorization:null}),console.debug("[Identity] Store updated with identity from popup, identities count:",Z.size),G(re);return}setTimeout(()=>{const Z=localStorage.getItem("agent-runtimes-identity");if(console.debug("[Identity] Fallback: reading from localStorage"),Z)try{const Fe=JSON.parse(Z).state?.identities||[],fe=new Map(Fe).get(ie);if(fe){const Ve=T.getState().identities,Ce=new Map(Ve);Ce.set(ie,fe),T.setState({identities:Ce,pendingAuthorization:null}),G(fe);return}}catch(ze){console.error("[Identity] Failed to parse identity from localStorage:",ze)}T.setState({pendingAuthorization:null}),H(new Error("Identity not found after OAuth success"))},100)}else Y.data?.type==="oauth-callback-error"?(window.removeEventListener("message",J),clearInterval(oe),_.close(),T.setState({pendingAuthorization:null}),H(new Error(Y.data.error||"OAuth authentication failed"))):Y.data?.type==="oauth_callback"&&(window.removeEventListener("message",J),clearInterval(oe),_.close(),u(Y.data.payload).then(G).catch(H))};window.addEventListener("message",J);const oe=setInterval(()=>{_.closed&&(clearInterval(oe),window.removeEventListener("message",J),T.getState().pendingAuthorization&&(b(),H(new Error("Popup closed by user"))))},500)})},[S,u,b]),I=T(x=>x.connectWithToken),O=z.useCallback(async(x,U,$)=>I(x,U,$),[I]),g=z.useCallback(async x=>{await m(x)},[m]),C=z.useCallback(async x=>u(x),[u]),N=z.useCallback(()=>{b()},[b]),B=z.useCallback(x=>P(x),[P]),M=z.useCallback(x=>R(x),[R]),w=z.useCallback(async x=>(await y(x))?.accessToken??null,[y]),X=z.useCallback(x=>{p(x)},[p]),W=c!==null;return z.useMemo(()=>({identities:a,connectedProviders:d,isAuthorizing:W,isLoading:h,error:f,pendingAuthorization:c,connect:j,connectWithPopup:E,connectWithToken:O,disconnect:g,completeAuthorization:C,cancelAuthorization:N,isConnected:B,getIdentity:M,getAccessToken:w,configureProvider:X}),[a,d,W,h,f,c,j,E,O,g,C,N,B,M,w,X])}const Ue={github:{name:"GitHub",icon:We,color:"#24292f",description:"Access GitHub repositories and APIs"},google:{name:"Google",icon:V,color:"#4285f4",description:"Access Google services and APIs"},kaggle:{name:"Kaggle",icon:V,color:"#20beff",description:"Access Kaggle datasets and notebooks"},linkedin:{name:"LinkedIn",icon:V,color:"#0077b5",description:"Access LinkedIn profile and connections"},slack:{name:"Slack",icon:V,color:"#4a154b",description:"Access Slack workspaces and channels"},notion:{name:"Notion",icon:V,color:"#000000",description:"Access Notion pages and databases"},custom:{name:"Custom",icon:de,color:"#6f42c1",description:"Custom OAuth provider"}},Bt={github:["read:user","user:email"],google:["openid","profile","email"],kaggle:["read"],linkedin:["r_liteprofile","r_emailaddress"],slack:["users:read","channels:read"],notion:["read_content"],custom:[]},Gt=({provider:t,clientId:s,providerConfig:r,scopes:l,disabled:o=!1,size:a="medium",variant:d="full",onConnect:c,onDisconnect:h,onError:f})=>{const{identities:S,isAuthorizing:u,error:b,connectWithPopup:m,disconnect:R,configureProvider:P}=ke(),y=Ue[t]||Ue.custom,p=S.find(g=>g.provider===t),j=!!p,E=u;te.useEffect(()=>{if(s){const g=t==="github"?ye:t==="google"?je:t==="kaggle"?Se:void 0;if(g){const C=r?.redirectUri||(typeof window<"u"?`${window.location.origin}${window.location.pathname}`:"");P({...g,...r,provider:t,clientId:s,redirectUri:C})}}},[s,t,r,P]);const I=z.useCallback(async()=>{try{if(j)await R(t),h?.(t);else{const g=await m(t,l||Bt[t]);c?.(g)}}catch(g){const C=g instanceof Error?g.message:String(g);C!=="Popup closed by user"&&f?.(g instanceof Error?g:new Error(C))}},[j,t,l,m,R,c,h,f]);te.useEffect(()=>{b&&f?.(b instanceof Error?b:new Error(String(b)))},[b,f]);const O={onClick:I,disabled:o||E||!s&&!j,size:a==="large"?"large":a==="small"?"small":"medium"};return d==="icon"?e.jsx(L,{...O,variant:j?"primary":"default","aria-label":j?`Disconnect ${y.name}`:`Connect ${y.name}`,sx:{width:a==="small"?28:a==="large"?44:36,height:a==="small"?28:a==="large"?44:36,p:0},children:E?e.jsx(n,{as:"span",className:"anim-rotate",display:"inline-block",children:"⏳"}):e.jsx(y.icon,{size:a==="small"?14:18})}):d==="compact"?e.jsx(L,{...O,variant:j?"primary":"default",leadingVisual:y.icon,trailingVisual:j?Oe:void 0,children:E?"Connecting...":y.name}):e.jsxs(n,{display:"flex",flexDirection:"column",gap:2,p:2,border:"1px solid",borderColor:j?"success.muted":"border.default",borderRadius:2,backgroundColor:j?"success.subtle":"canvas.subtle",children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(n,{width:40,height:40,borderRadius:2,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:y.color,color:"white",children:e.jsx(y.icon,{size:20})}),e.jsxs(n,{flex:1,children:[e.jsx(i,{sx:{fontWeight:"bold",display:"block"},children:y.name}),e.jsx(i,{sx:{fontSize:0,color:"fg.muted",display:"block"},children:j&&p?.userInfo?`Connected as ${p.userInfo.name||p.userInfo.email}`:y.description})]}),!j&&e.jsx(L,{...O,variant:"primary",leadingVisual:de,children:E?"Working...":"Connect"})]}),j&&p&&e.jsxs(n,{display:"flex",flexDirection:"column",gap:2,children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,pl:1,children:[p.userInfo?.avatarUrl&&e.jsx("a",{href:p.userInfo.profileUrl||`https://github.com/${p.userInfo.username}`,target:"_blank",rel:"noopener noreferrer",style:{display:"block",lineHeight:0},children:e.jsx("img",{src:p.userInfo.avatarUrl,alt:p.userInfo.name||"User avatar",style:{width:32,height:32,borderRadius:"50%",cursor:"pointer"}})}),e.jsxs(n,{flex:1,children:[p.userInfo?.username&&e.jsx("a",{href:p.userInfo.profileUrl||`https://github.com/${p.userInfo.username}`,target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none"},children:e.jsxs(i,{sx:{fontSize:1,color:"fg.muted",display:"block",":hover":{textDecoration:"underline"}},children:["@",p.userInfo.username]})}),e.jsx(i,{sx:{fontSize:0,color:"fg.muted",display:"block"},children:p.token?.expiresAt?`Expires ${new Date(p.token.expiresAt).toLocaleDateString()}`:"Token does not expire"})]})]}),p.scopes&&p.scopes.length>0&&e.jsx(n,{display:"flex",flexWrap:"wrap",gap:1,pl:1,children:p.scopes.map(g=>e.jsx(i,{sx:{fontSize:0,px:2,py:1,bg:"neutral.muted",borderRadius:2,color:"fg.muted"},children:g},g))}),e.jsxs(L,{...O,variant:"danger",leadingVisual:$e,children:["Disconnect from ",y.name]})]})]})},_e={github:{name:"GitHub",icon:We,color:"#24292f",description:"Access GitHub repositories and APIs"},google:{name:"Google",icon:V,color:"#4285f4",description:"Access Google services and APIs"},kaggle:{name:"Kaggle",icon:V,color:"#20beff",description:"Access Kaggle datasets and notebooks"},linkedin:{name:"LinkedIn",icon:V,color:"#0077b5",description:"Access LinkedIn profile"},slack:{name:"Slack",icon:V,color:"#4a154b",description:"Access Slack workspaces"},notion:{name:"Notion",icon:V,color:"#000000",description:"Access Notion pages"},custom:{name:"Custom",icon:de,color:"#6f42c1",description:"Custom OAuth provider"}},Kt={github:["read:user","user:email","repo"],google:["openid","profile","email"],kaggle:["read"],linkedin:["r_liteprofile","r_emailaddress"],slack:["users:read","channels:read"],notion:["read_content"],custom:[]};function Jt(t){if(!t)return{isExpired:!1,isExpiringSoon:!1};const s=Date.now(),r=new Date(t),l=t-s,o=s-t,a=300*1e3;return{isExpired:l<0,isExpiringSoon:l>0&&l<a,expiresAt:r,timeUntilExpiry:l>0?l:void 0,timeSinceExpiry:l<0?o:void 0}}function he(t){const s=Math.floor(t/1e3),r=Math.floor(s/60),l=Math.floor(r/60),o=Math.floor(l/24);return o>0?o===1?"1 day":`${o} days`:l>0?l===1?"1 hour":`${l} hours`:r>0?r===1?"1 minute":`${r} minutes`:s===1?"1 second":`${s} seconds`}function Yt(t){return t.isExpired&&t.timeSinceExpiry?`Expired ${he(t.timeSinceExpiry)} ago`:t.timeUntilExpiry?t.isExpiringSoon?`Expires in ${he(t.timeUntilExpiry)}`:`Expires in ${he(t.timeUntilExpiry)}`:"Token does not expire"}function Xt({identity:t,providerConfig:s,showExpirationDetails:r=!0,allowReconnect:l=!0,onConnect:o,onDisconnect:a,onError:d}){const{connect:c,disconnect:h,configureProvider:f,isAuthorizing:S}=ke(),u=t.provider,b=_e[u]||_e.custom,m=z.useMemo(()=>Jt(t.token?.expiresAt),[t.token?.expiresAt]);te.useEffect(()=>{if(s?.clientId){const y=u==="github"?ye:u==="google"?je:u==="kaggle"?Se:void 0;if(y){const p=s.config?.redirectUri||(typeof window<"u"?`${window.location.origin}${window.location.pathname}`:"");f({...y,...s.config,provider:u,clientId:s.clientId,redirectUri:p})}}},[s,u,f]);const R=z.useCallback(async()=>{try{const y=s?.scopes||Kt[u];await c(u,y)}catch(y){d?.(y instanceof Error?y:new Error(String(y)))}},[u,s?.scopes,c,d]),P=z.useCallback(async()=>{try{await h(u),a?.(u)}catch(y){d?.(y instanceof Error?y:new Error(String(y)))}},[u,h,a,d]);return e.jsxs(n,{display:"flex",flexDirection:"column",gap:2,p:3,border:"1px solid",borderColor:m.isExpired?"danger.muted":m.isExpiringSoon?"attention.muted":"success.muted",borderRadius:2,backgroundColor:m.isExpired?"danger.subtle":m.isExpiringSoon?"attention.subtle":"success.subtle",children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(n,{width:32,height:32,borderRadius:2,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:b.color,color:"white",children:e.jsx(b.icon,{size:16})}),e.jsxs(n,{flex:1,display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontWeight:"semibold",fontSize:1},children:b.name}),e.jsx(A,{size:"small",variant:"secondary",children:t.authType==="token"?"API Key":"OAuth"})]}),m.isExpired?e.jsx(A,{variant:"danger",size:"small",children:e.jsxs(n,{display:"inline-flex",alignItems:"center",gap:1,children:[e.jsx(ot,{size:12})," Expired"]})}):m.isExpiringSoon?e.jsx(A,{variant:"attention",size:"small",children:e.jsxs(n,{display:"inline-flex",alignItems:"center",gap:1,children:[e.jsx(me,{size:12})," Expiring Soon"]})}):e.jsx(A,{variant:"success",size:"small",children:e.jsxs(n,{display:"inline-flex",alignItems:"center",gap:1,children:[e.jsx(Oe,{size:12})," Connected"]})})]}),e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[t.userInfo?.avatarUrl&&e.jsx("a",{href:t.userInfo.profileUrl||(u==="github"?`https://github.com/${t.userInfo.username}`:void 0),target:"_blank",rel:"noopener noreferrer",style:{display:"block",lineHeight:0},children:e.jsx(kt,{src:t.userInfo.avatarUrl,size:32,alt:t.userInfo.name||t.userInfo.username||b.name,sx:{cursor:"pointer"}})}),e.jsxs(n,{flex:1,minWidth:0,children:[t.userInfo?.name&&e.jsx(i,{sx:{fontWeight:"semibold",fontSize:1,display:"block"},children:t.userInfo.name}),(t.userInfo?.username||t.userInfo?.email)&&e.jsx("a",{href:t.userInfo.profileUrl||(u==="github"?`https://github.com/${t.userInfo.username}`:void 0),target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none"},children:e.jsx(i,{sx:{fontSize:0,color:"fg.muted",display:"block",":hover":{textDecoration:"underline"}},children:t.userInfo.username?`@${t.userInfo.username}`:t.userInfo.email})})]})]}),r&&e.jsxs(n,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(me,{size:12}),e.jsx(i,{sx:{fontSize:0,color:m.isExpired?"danger.fg":m.isExpiringSoon?"attention.fg":"fg.muted"},children:Yt(m)})]}),t.scopes&&t.scopes.length>0&&e.jsx(n,{display:"flex",flexWrap:"wrap",gap:1,children:t.scopes.map(y=>e.jsx(A,{size:"small",variant:"secondary",children:y},y))}),e.jsxs(n,{display:"flex",gap:2,mt:1,children:[m.isExpired&&l&&s?.clientId&&e.jsx(it,{text:"Reconnect to refresh token",children:e.jsx(L,{variant:"primary",size:"small",leadingVisual:rt,onClick:R,disabled:S,children:S?"Connecting...":"Reconnect"})}),e.jsxs(L,{variant:m.isExpired?"invisible":"danger",size:"small",leadingVisual:$e,onClick:P,disabled:S,children:["Disconnect from ",b.name]})]})]})}function Qt({providers:t,title:s="Connected Accounts",showHeader:r=!0,showDescription:l=!0,description:o="Connected identities for this agent. Agents can use these to access external services on your behalf.",showExpirationDetails:a=!0,allowReconnect:d=!0,onConnect:c,onDisconnect:h,onError:f}){const{identities:S,error:u}=ke(),b=z.useMemo(()=>{if(t){const p=Object.keys(t);return S.filter(j=>p.includes(j.provider)||j.authType==="token"&&j.isConnected)}return S},[S,t]),m=z.useMemo(()=>new Set(S.map(p=>p.provider)),[S]),R=z.useMemo(()=>{if(!t)return{};const p=Object.keys(t),j={};for(const E of p)m.has(E)||(j[E]=t[E]);return j},[t,m]),P=Object.keys(R).length>0,y=z.useCallback(p=>j=>{f?.(p,j)},[f]);return b.length===0&&!t?null:e.jsxs(n,{children:[r&&e.jsxs(n,{display:"flex",alignItems:"center",gap:2,mb:2,children:[e.jsx(V,{size:16}),e.jsx(i,{sx:{fontSize:1,fontWeight:"semibold",color:"fg.muted"},children:s})]}),e.jsxs(n,{p:3,bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",children:[l&&e.jsx(i,{sx:{fontSize:0,color:"fg.muted",display:"block",mb:b.length>0?3:0},children:o}),u&&e.jsx(st,{variant:"danger",sx:{mb:3},children:u instanceof Error?u.message:String(u)}),b.length>0?e.jsx(n,{display:"flex",flexDirection:"column",gap:2,children:b.map(p=>e.jsx(Xt,{identity:p,providerConfig:t?.[p.provider],showExpirationDetails:a,allowReconnect:d,onConnect:c,onDisconnect:h,onError:y(p.provider)},p.provider))}):P?null:e.jsxs(n,{display:"flex",alignItems:"center",gap:2,color:"fg.muted",children:[e.jsx(de,{size:16}),e.jsx(i,{sx:{fontSize:1},children:"No connected accounts"})]}),P&&e.jsxs(n,{mt:b.length>0?3:0,children:[b.length>0&&e.jsx(i,{sx:{fontSize:0,color:"fg.muted",display:"block",mb:2},children:"Connect additional accounts:"}),e.jsx(n,{display:"flex",flexDirection:"column",gap:2,children:Object.keys(R).map(p=>{const j=R[p];return e.jsx(Gt,{provider:p,clientId:j.clientId,scopes:j.scopes,providerConfig:j.config,size:"medium",variant:"full",onConnect:c,onDisconnect:h,onError:y(p)},p)})})]})]})]})}const ge=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),xe=t=>{if(t==null)return"null";if(typeof t=="number"||typeof t=="boolean")return String(t);const s=String(t);return s===""?"''":/^[a-zA-Z0-9._/-]+$/.test(s)?s:JSON.stringify(s)},be=(t,s=0)=>{const r=" ".repeat(s);if(Array.isArray(t))return t.length===0?"[]":t.map(l=>ge(l)||Array.isArray(l)?`${r}-
|
|
3
3
|
${be(l,s+1)}`:`${r}- ${xe(l)}`).join(`
|
|
4
4
|
`);if(ge(t)){const l=Object.entries(t).filter(([,o])=>o!==void 0);return l.length===0?"{}":l.map(([o,a])=>ge(a)||Array.isArray(a)?`${r}${o}:
|
|
5
5
|
${be(a,s+1)}`:`${r}${o}: ${xe(a)}`).join(`
|
|
6
|
-
`)}return`${r}${xe(t)}`};function Zt(t){return be(t)}function en({spec:t,onClose:s,title:r="Spec Payload Preview (YAML)"}){return z.useEffect(()=>{const l=o=>{o.key==="Escape"&&s()};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[s]),e.jsxs(n,{role:"dialog","aria-label":r,"aria-modal":"true",position:"fixed",inset:24,zIndex:300,bg:"canvas.default",border:"1px solid",borderColor:"border.default",borderRadius:1,boxShadow:"shadow.large",display:"flex",flexDirection:"column",children:[e.jsxs(n,{display:"flex",alignItems:"center",justifyContent:"space-between",px:3,py:2,borderBottom:"1px solid",borderColor:"border.default",children:[e.jsx(i,{sx:{fontWeight:"bold"},children:r}),e.jsx(
|
|
7
|
-
`),d=new Blob([a],{type:"text/csv;charset=utf-8;"}),c=document.createElement("a"),h=URL.createObjectURL(d);c.setAttribute("href",h),c.setAttribute("download",`context-snapshot-${t}-${new Date().toISOString().slice(0,10)}.csv`),c.style.visibility="hidden",document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(h)}function un({name:t="AI Agent",icon:s,emoji:r,protocol:l,url:o,messageCount:a,agentId:d,apiBase:c,identityProviders:h,onIdentityConnect:f,onIdentityDisconnect:S,onBack:u,showBackHeader:b=!0,showUsage:m=!0,padded:R=!0,mcpStatusData:P,codemodeStatusData:y,contextSnapshotData:p,fullContextData:j,runtime:E=!0,summary:I}){const O=lt(),g=at(),C=ct(),N=dt(),B=ut(),M=P??O,w=y??g,X=p??C,W=j??N,x=P!==void 0||B!=="closed",U=y!==void 0||B!=="closed",$=B==="connecting"&&!M,G=B==="connecting"&&!w,V=ft({mutationFn:async v=>{const _=_e(c),J=await fetch(`${_}/api/v1/configure/codemode/toggle`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:v})});if(!J.ok)throw new Error("Failed to toggle codemode");return J.json()},onSuccess:()=>{}}),[K,Q]=z.useState(!1),{data:k,isLoading:ue}=pt({queryKey:["agent-spec",d,c],queryFn:async()=>{const v=_e(c),_=await fetch(`${v}/api/v1/configure/agents/${encodeURIComponent(d)}/spec`);if(!_.ok)throw new Error("Failed to fetch agent spec");return _.json()},enabled:!!d&&E});return e.jsxs(n,{display:"flex",flexDirection:"column",height:"100%",bg:"canvas.default",overflow:"auto",children:[b&&e.jsxs(n,{display:"flex",alignItems:"center",gap:2,p:3,borderBottom:"1px solid",borderColor:"border.default",children:[e.jsx(Oe,{icon:yt,"aria-label":"Back to chat",variant:"invisible",onClick:u}),e.jsx(F,{as:"h2",sx:{fontSize:3,fontWeight:"semibold"},children:"Agent Details"})]}),e.jsxs(n,{p:R?3:0,display:"flex",flexDirection:"column",gap:4,children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:3,p:3,bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",children:[e.jsx(n,{p:2,bg:"accent.subtle",borderRadius:2,children:s?e.jsx(n,{display:"inline-flex",color:"accent.fg",children:s}):r?e.jsx(i,{sx:{fontSize:5,lineHeight:1},children:r}):e.jsx(ht,{colored:!0,size:32})}),e.jsxs(n,{flex:1,children:[e.jsx(F,{as:"h3",sx:{fontSize:2,fontWeight:"semibold",mb:1},children:t}),d&&e.jsxs(i,{sx:{fontSize:0,color:"fg.muted"},children:["ID: ",d]})]})]}),I&&(I.spec||I.model||I.where||I.description||I.skills?.length)&&e.jsxs(n,{"data-agent-details-summary":"",children:[e.jsx(F,{as:"h4",sx:{fontSize:1,fontWeight:"semibold",mb:2,color:"fg.muted"},children:"Agent"}),e.jsxs(n,{p:3,bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",display:"flex",flexDirection:"column",gap:1,children:[I.description&&e.jsx(i,{as:"p",sx:{fontSize:1,m:0,mb:1},children:I.description}),[["Spec",I.spec],["Model",I.model],["Runs",I.where]].filter(([,v])=>v).map(([v,_])=>e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsxs(i,{sx:{fontSize:0,color:"fg.muted",width:100},children:[v,":"]}),e.jsx(i,{sx:{fontSize:0,fontFamily:"mono"},children:_})]},v)),I.skills&&I.skills.length>0&&e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100},children:"Skills:"}),e.jsx(n,{display:"flex",gap:1,flexWrap:"wrap",children:I.skills.map(v=>e.jsx(A,{variant:"secondary",size:"small",children:v},v))})]})]})]}),o&&e.jsx(e.Fragment,{children:e.jsxs(n,{children:[e.jsx(F,{as:"h4",sx:{fontSize:1,fontWeight:"semibold",mb:2,color:"fg.muted"},children:"Connection"}),e.jsx(n,{p:3,bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",children:e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(A,{variant:"accent",size:"small",children:l.toUpperCase().replace(/-/g," ")}),e.jsx(i,{sx:{fontSize:1,fontFamily:"mono",wordBreak:"break-all"},children:o})]})})]})}),E&&e.jsxs(e.Fragment,{children:[e.jsxs(n,{children:[e.jsx(F,{as:"h4",sx:{fontSize:1,fontWeight:"semibold",mb:2,color:"fg.muted"},children:"Agentspec"}),e.jsx(n,{p:3,bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",children:ue?e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(ae,{size:"small"}),e.jsx(i,{sx:{fontSize:1,color:"fg.muted"},children:"Loading agent spec..."})]}):k?e.jsxs(n,{display:"flex",flexDirection:"column",gap:3,children:[e.jsx(n,{children:e.jsx(L,{size:"small",leadingVisual:wt,onClick:()=>Q(!0),children:"View spec payload"})}),e.jsxs(n,{display:"flex",flexDirection:"column",gap:1,children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100},children:"Model:"}),e.jsx(i,{sx:{fontSize:0,fontFamily:"mono",color:"fg.default"},children:k.model})]}),e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100},children:"Library:"}),e.jsx(A,{variant:"secondary",size:"small",children:k.agent_library})]}),e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100},children:"Codemode:"}),e.jsx(A,{variant:k.enable_codemode?"accent":"secondary",size:"small",children:k.enable_codemode?"Enabled":"Disabled"})]}),k.enable_skills&&k.skills.length>0&&e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100},children:"Skills:"}),e.jsx(n,{display:"flex",gap:1,flexWrap:"wrap",children:k.skills.map(v=>e.jsx(A,{variant:"secondary",size:"small",children:v},v))})]})]}),e.jsxs(n,{display:"flex",flexDirection:"column",gap:1,children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(gt,{size:16}),e.jsx(i,{sx:{fontSize:0,fontWeight:"semibold",color:"fg.muted"},children:"System Prompt"})]}),e.jsx(n,{p:2,bg:"canvas.default",borderRadius:2,border:"1px solid",borderColor:"border.default",maxHeight:200,overflow:"auto",children:e.jsx(i,{sx:{fontSize:0,fontFamily:"mono",whiteSpace:"pre-wrap",wordBreak:"break-word",color:"fg.default"},children:k.system_prompt})})]}),k.system_prompt_codemode_addons&&e.jsxs(n,{display:"flex",flexDirection:"column",gap:1,children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(ce,{size:16}),e.jsx(i,{sx:{fontSize:0,fontWeight:"semibold",color:"fg.muted"},children:"Codemode Addon Prompt"}),k.enable_codemode?e.jsx(A,{variant:"accent",size:"small",children:"Active"}):e.jsx(A,{variant:"secondary",size:"small",children:"Inactive"})]}),e.jsx(n,{p:2,bg:"canvas.default",borderRadius:2,border:"1px solid",borderColor:"border.default",maxHeight:200,overflow:"auto",children:e.jsx(i,{sx:{fontSize:0,fontFamily:"mono",whiteSpace:"pre-wrap",wordBreak:"break-word",color:"fg.default"},children:k.system_prompt_codemode_addons})})]})]}):e.jsx(i,{sx:{fontSize:1,color:"fg.muted"},children:"No agent spec available"})})]}),k?.sandbox&&e.jsxs(n,{children:[e.jsx(F,{as:"h4",sx:{fontSize:1,fontWeight:"semibold",mb:2,color:"fg.muted"},children:"Code Sandbox"}),e.jsx(n,{p:3,bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",children:e.jsxs(n,{display:"flex",flexDirection:"column",gap:2,children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(xt,{size:16}),e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100},children:"Variant:"}),e.jsx(A,{variant:k.sandbox.variant==="jupyter-server"?"accent":"secondary",size:"small",children:k.sandbox.variant})]}),e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100,pl:4},children:"Running:"}),k.sandbox.sandbox_running?e.jsxs(n,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(ne,{size:12,fill:"success.fg"}),e.jsx(i,{sx:{fontSize:0,color:"success.fg"},children:"Yes"})]}):e.jsxs(n,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(se,{size:12,fill:"fg.muted"}),e.jsx(i,{sx:{fontSize:0,color:"fg.muted"},children:"No"})]})]}),k.sandbox.variant==="jupyter-server"&&e.jsxs(e.Fragment,{children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100,pl:4},children:"Jupyter URL:"}),e.jsx(i,{sx:{fontSize:0,fontFamily:"mono",color:"fg.default",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.jupyter_sandbox||k.sandbox.jupyter_url||"Not configured"})]}),e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100,pl:4},children:"Connection:"}),k.sandbox.jupyter_connected?e.jsxs(n,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(ne,{size:12,fill:"success.fg"}),e.jsx(i,{sx:{fontSize:0,color:"success.fg"},children:"Connected"})]}):e.jsxs(n,{display:"flex",flexDirection:"column",gap:1,children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(se,{size:12,fill:"danger.fg"}),e.jsx(i,{sx:{fontSize:0,color:"danger.fg"},children:"Not Connected"})]}),k.sandbox.jupyter_error&&e.jsx(i,{sx:{fontSize:0,color:"danger.fg",fontFamily:"mono",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:k.sandbox.jupyter_error})]})]})]}),k.sandbox.generated_path&&e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100,pl:4},children:"Generated:"}),e.jsx(i,{sx:{fontSize:0,fontFamily:"mono",color:"fg.default",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:k.sandbox.generated_path,children:k.sandbox.generated_path})]}),k.sandbox.skills_path&&e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100,pl:4},children:"Skills:"}),e.jsx(i,{sx:{fontSize:0,fontFamily:"mono",color:"fg.default",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:k.sandbox.skills_path,children:k.sandbox.skills_path})]}),k.sandbox.python_path&&e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100,pl:4},children:"Python:"}),e.jsx(i,{sx:{fontSize:0,fontFamily:"mono",color:"fg.default",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:k.sandbox.python_path,children:k.sandbox.python_path})]})]})})]}),e.jsxs(n,{children:[e.jsx(F,{as:"h4",sx:{fontSize:1,fontWeight:"semibold",mb:2,color:"fg.muted"},children:"Config MCP Servers"}),e.jsx(n,{p:3,bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",children:!x&&$?e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(ae,{size:"small"}),e.jsx(i,{sx:{fontSize:1,color:"fg.muted"},children:"Loading MCP status..."})]}):M?e.jsxs(n,{display:"flex",flexDirection:"column",gap:2,children:[e.jsx(n,{display:"flex",alignItems:"center",gap:2,children:e.jsxs(i,{sx:{fontSize:1},children:[e.jsx(i,{as:"span",sx:{fontWeight:"semibold"},children:M.ready_count})," ","ready,"," ",e.jsx(i,{as:"span",sx:{fontWeight:"semibold"},children:M.failed_count})," ","failed"]})}),M.ready_servers.length>0&&e.jsxs(n,{display:"flex",flexDirection:"column",gap:1,children:[e.jsx(i,{sx:{fontSize:0,fontWeight:"semibold",color:"fg.muted"},children:"Ready:"}),M.ready_servers.map(v=>e.jsxs(n,{display:"flex",alignItems:"center",gap:2,pl:2,children:[e.jsx(ne,{size:16,fill:"success.fg"}),e.jsx(i,{sx:{fontSize:1},children:v})]},v))]}),Object.keys(M.failed_servers).length>0&&e.jsxs(n,{display:"flex",flexDirection:"column",gap:1,children:[e.jsx(i,{sx:{fontSize:0,fontWeight:"semibold",color:"fg.muted"},children:"Failed:"}),Object.entries(M.failed_servers).map(([v,_])=>e.jsxs(n,{display:"flex",flexDirection:"column",gap:1,pl:2,children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(se,{size:16,fill:"danger.fg"}),e.jsx(i,{sx:{fontSize:1},children:v})]}),e.jsx(i,{sx:{fontSize:0,color:"danger.fg",fontFamily:"mono",pl:4,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:_.split(`
|
|
8
|
-
`)[0]})]},v))]})]}):x?e.jsx(i,{sx:{fontSize:1,color:"fg.muted"},children:"Waiting for MCP status from WebSocket stream..."}):e.jsx(i,{sx:{fontSize:1,color:"fg.muted"},children:"Failed to load MCP status"})})]}),e.jsxs(n,{children:[e.jsx(F,{as:"h4",sx:{fontSize:1,fontWeight:"semibold",mb:2,color:"fg.muted"},children:"Codemode"}),e.jsx(n,{p:3,bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",children:!U&&G?e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(ae,{size:"small"}),e.jsx(i,{sx:{fontSize:1,color:"fg.muted"},children:"Loading Codemode status..."})]}):w?e.jsxs(n,{display:"flex",flexDirection:"column",gap:3,children:[e.jsxs(n,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(ce,{size:16}),e.jsxs(n,{children:[e.jsx(i,{id:"codemode-toggle-label",sx:{fontSize:1,fontWeight:"semibold"},children:"Codemode"}),e.jsx(i,{sx:{fontSize:0,color:"fg.muted",marginLeft:1},children:"MCP servers become programmatic tools"})]})]}),e.jsx(
|
|
6
|
+
`)}return`${r}${xe(t)}`};function Zt(t){return be(t)}function en({spec:t,onClose:s,title:r="Spec Payload Preview (YAML)"}){return z.useEffect(()=>{const l=o=>{o.key==="Escape"&&s()};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[s]),e.jsxs(n,{role:"dialog","aria-label":r,"aria-modal":"true",position:"fixed",inset:24,zIndex:300,bg:"canvas.default",border:"1px solid",borderColor:"border.default",borderRadius:1,boxShadow:"shadow.large",display:"flex",flexDirection:"column",children:[e.jsxs(n,{display:"flex",alignItems:"center",justifyContent:"space-between",px:3,py:2,borderBottom:"1px solid",borderColor:"border.default",children:[e.jsx(i,{sx:{fontWeight:"bold"},children:r}),e.jsx(Me,{icon:lt,"aria-label":"Close spec preview",size:"small",variant:"invisible",onClick:s})]}),e.jsx(n,{p:3,overflow:"auto",flex:1,children:e.jsx(n,{as:"pre",m:0,whiteSpace:"pre",fontFamily:"monospace",fontSize:0,lineHeight:"20px",children:Zt(t)})})]})}function Re(t){if(t)return t.replace(/\/+$/,"").replace(/\/api\/v1\/configure$/,"");if(typeof window>"u")return"";const s=window.location.hostname;return s==="localhost"||s==="127.0.0.1"?"http://127.0.0.1:8765":""}async function tn(t,s,r){if(!r)throw new Error("No context data available for CSV export. Data is delivered via WebSocket.");const l=r,o=[];o.push(["Context Snapshot for Agent",l.agentId]),o.push(["Generated At",new Date().toISOString()]),o.push([]),o.push(["=== Model Configuration ==="]),o.push(["Model Name",l.modelConfiguration?.modelName||"Not specified"]),o.push(["Context Window",String(l.modelConfiguration?.contextWindow||0)]),o.push([]),o.push(["=== Token Summary ==="]),o.push(["Category","Tokens"]),o.push(["System Prompts",String(l.tokenSummary?.systemPrompts||0)]),o.push(["Tools",String(l.tokenSummary?.tools||0)]),o.push(["Memory",String(l.tokenSummary?.memory||0)]),o.push(["History",String(l.tokenSummary?.history||0)]),o.push(["Current",String(l.tokenSummary?.current||0)]),o.push(["Total",String(l.tokenSummary?.total||0)]),o.push(["Context Window",String(l.tokenSummary?.contextWindow||0)]),o.push(["Usage Percent",`${(l.tokenSummary?.usagePercent||0).toFixed(2)}%`]),o.push([]),l.systemPrompts?.length>0&&(o.push(["=== System Prompts ==="]),o.push(["Index","Tokens","Content"]),l.systemPrompts.forEach((f,S)=>{o.push([String(S+1),String(f.tokens),f.content.replace(/"/g,'""')])}),o.push([])),l.tools?.length>0&&(o.push(["=== Tools ==="]),o.push(["Name","Description","Source Type","Is Async","Requires Approval","Total Tokens"]),l.tools.forEach(f=>{o.push([f.name,(f.description||"").replace(/"/g,'""'),f.sourceType,String(f.isAsync),String(f.requiresApproval),String(f.totalTokens)])}),o.push([])),l.messages?.length>0&&(o.push(["=== Messages ==="]),o.push(["Role","In Context","Estimated Tokens","Tool Name","Is Tool Call","Is Tool Result","Timestamp","Content"]),l.messages.forEach(f=>{o.push([f.role,String(f.inContext),String(f.estimatedTokens),f.toolName||"",String(f.isToolCall),String(f.isToolResult),f.timestamp||"",f.content.replace(/"/g,'""')])}),o.push([])),l.memoryBlocks?.length>0&&(o.push(["=== Memory Blocks ==="]),o.push(["Index","Content (JSON)"]),l.memoryBlocks.forEach((f,S)=>{o.push([String(S+1),JSON.stringify(f).replace(/"/g,'""')])}),o.push([])),l.toolEnvironment&&Object.keys(l.toolEnvironment).length>0&&(o.push(["=== Tool Environment ==="]),o.push(["Key","Value"]),Object.entries(l.toolEnvironment).forEach(([f,S])=>{o.push([f,S])}),o.push([]));const a=o.map(f=>f.map(S=>`"${S}"`).join(",")).join(`
|
|
7
|
+
`),d=new Blob([a],{type:"text/csv;charset=utf-8;"}),c=document.createElement("a"),h=URL.createObjectURL(d);c.setAttribute("href",h),c.setAttribute("download",`context-snapshot-${t}-${new Date().toISOString().slice(0,10)}.csv`),c.style.visibility="hidden",document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(h)}function un({name:t="AI Agent",icon:s,emoji:r,protocol:l,url:o,messageCount:a,agentId:d,apiBase:c,identityProviders:h,onIdentityConnect:f,onIdentityDisconnect:S,onBack:u,showBackHeader:b=!0,showUsage:m=!0,padded:R=!0,mcpStatusData:P,codemodeStatusData:y,contextSnapshotData:p,fullContextData:j,runtime:E=!0,summary:I}){const O=at(),g=ct(),C=dt(),N=ut(),B=ft(),M=P??O,w=y??g,X=p??C,W=j??N,x=P!==void 0||B!=="closed",U=y!==void 0||B!=="closed",$=B==="connecting"&&!M,G=B==="connecting"&&!w,H=pt({mutationFn:async v=>{const _=Re(c),J=await fetch(`${_}/api/v1/configure/codemode/toggle`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:v})});if(!J.ok)throw new Error("Failed to toggle codemode");return J.json()},onSuccess:()=>{}}),[K,Q]=z.useState(!1),{data:k,isLoading:ue}=ht({queryKey:["agent-spec",d,c],queryFn:async()=>{const v=Re(c),_=await fetch(`${v}/api/v1/configure/agents/${encodeURIComponent(d)}/spec`);if(!_.ok)throw new Error("Failed to fetch agent spec");return _.json()},enabled:!!d&&E});return e.jsxs(n,{display:"flex",flexDirection:"column",height:"100%",bg:"canvas.default",overflow:"auto",children:[b&&e.jsxs(n,{display:"flex",alignItems:"center",gap:2,p:3,borderBottom:"1px solid",borderColor:"border.default",children:[e.jsx(Me,{icon:Ie,"aria-label":"Back to chat",variant:"invisible",onClick:u}),e.jsx(F,{as:"h2",sx:{fontSize:3,fontWeight:"semibold"},children:"Agent Details"})]}),e.jsxs(n,{p:R?3:0,display:"flex",flexDirection:"column",gap:4,children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:3,p:3,bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",children:[e.jsx(n,{p:2,bg:"accent.subtle",borderRadius:2,children:s?e.jsx(n,{display:"inline-flex",color:"accent.fg",children:s}):r?e.jsx(i,{sx:{fontSize:5,lineHeight:1},children:r}):e.jsx(gt,{colored:!0,size:32})}),e.jsxs(n,{flex:1,children:[e.jsx(F,{as:"h3",sx:{fontSize:2,fontWeight:"semibold",mb:1},children:t}),d&&e.jsxs(i,{sx:{fontSize:0,color:"fg.muted"},children:["ID: ",d]})]})]}),I&&(I.spec||I.model||I.where||I.description||I.skills?.length)&&e.jsxs(n,{"data-agent-details-summary":"",children:[e.jsx(F,{as:"h4",sx:{fontSize:1,fontWeight:"semibold",mb:2,color:"fg.muted"},children:"Agent"}),e.jsxs(n,{p:3,bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",display:"flex",flexDirection:"column",gap:1,children:[I.description&&e.jsx(i,{as:"p",sx:{fontSize:1,m:0,mb:1},children:I.description}),[["Spec",I.spec],["Model",I.model],["Runs",I.where]].filter(([,v])=>v).map(([v,_])=>e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsxs(i,{sx:{fontSize:0,color:"fg.muted",width:100},children:[v,":"]}),e.jsx(i,{sx:{fontSize:0,fontFamily:"mono"},children:_})]},v)),I.skills&&I.skills.length>0&&e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100},children:"Skills:"}),e.jsx(n,{display:"flex",gap:1,flexWrap:"wrap",children:I.skills.map(v=>e.jsx(A,{variant:"secondary",size:"small",children:v},v))})]})]})]}),o&&e.jsx(e.Fragment,{children:e.jsxs(n,{children:[e.jsx(F,{as:"h4",sx:{fontSize:1,fontWeight:"semibold",mb:2,color:"fg.muted"},children:"Connection"}),e.jsx(n,{p:3,bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",children:e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(A,{variant:"accent",size:"small",children:l.toUpperCase().replace(/-/g," ")}),e.jsx(i,{sx:{fontSize:1,fontFamily:"mono",wordBreak:"break-all"},children:o})]})})]})}),E&&e.jsxs(e.Fragment,{children:[e.jsxs(n,{children:[e.jsx(F,{as:"h4",sx:{fontSize:1,fontWeight:"semibold",mb:2,color:"fg.muted"},children:"Agentspec"}),e.jsx(n,{p:3,bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",children:ue?e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(ae,{size:"small"}),e.jsx(i,{sx:{fontSize:1,color:"fg.muted"},children:"Loading agent spec..."})]}):k?e.jsxs(n,{display:"flex",flexDirection:"column",gap:3,children:[e.jsx(n,{children:e.jsx(L,{size:"small",leadingVisual:wt,onClick:()=>Q(!0),children:"View spec payload"})}),e.jsxs(n,{display:"flex",flexDirection:"column",gap:1,children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100},children:"Model:"}),e.jsx(i,{sx:{fontSize:0,fontFamily:"mono",color:"fg.default"},children:k.model})]}),e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100},children:"Library:"}),e.jsx(A,{variant:"secondary",size:"small",children:k.agent_library})]}),e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100},children:"Codemode:"}),e.jsx(A,{variant:k.enable_codemode?"accent":"secondary",size:"small",children:k.enable_codemode?"Enabled":"Disabled"})]}),k.enable_skills&&k.skills.length>0&&e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100},children:"Skills:"}),e.jsx(n,{display:"flex",gap:1,flexWrap:"wrap",children:k.skills.map(v=>e.jsx(A,{variant:"secondary",size:"small",children:v},v))})]})]}),e.jsxs(n,{display:"flex",flexDirection:"column",gap:1,children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(xt,{size:16}),e.jsx(i,{sx:{fontSize:0,fontWeight:"semibold",color:"fg.muted"},children:"System Prompt"})]}),e.jsx(n,{p:2,bg:"canvas.default",borderRadius:2,border:"1px solid",borderColor:"border.default",maxHeight:200,overflow:"auto",children:e.jsx(i,{sx:{fontSize:0,fontFamily:"mono",whiteSpace:"pre-wrap",wordBreak:"break-word",color:"fg.default"},children:k.system_prompt})})]}),k.system_prompt_codemode_addons&&e.jsxs(n,{display:"flex",flexDirection:"column",gap:1,children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(ce,{size:16}),e.jsx(i,{sx:{fontSize:0,fontWeight:"semibold",color:"fg.muted"},children:"Codemode Addon Prompt"}),k.enable_codemode?e.jsx(A,{variant:"accent",size:"small",children:"Active"}):e.jsx(A,{variant:"secondary",size:"small",children:"Inactive"})]}),e.jsx(n,{p:2,bg:"canvas.default",borderRadius:2,border:"1px solid",borderColor:"border.default",maxHeight:200,overflow:"auto",children:e.jsx(i,{sx:{fontSize:0,fontFamily:"mono",whiteSpace:"pre-wrap",wordBreak:"break-word",color:"fg.default"},children:k.system_prompt_codemode_addons})})]})]}):e.jsx(i,{sx:{fontSize:1,color:"fg.muted"},children:"No agent spec available"})})]}),k?.sandbox&&e.jsxs(n,{children:[e.jsx(F,{as:"h4",sx:{fontSize:1,fontWeight:"semibold",mb:2,color:"fg.muted"},children:"Code Sandbox"}),e.jsx(n,{p:3,bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",children:e.jsxs(n,{display:"flex",flexDirection:"column",gap:2,children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(mt,{size:16}),e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100},children:"Variant:"}),e.jsx(A,{variant:k.sandbox.variant==="jupyter-server"?"accent":"secondary",size:"small",children:k.sandbox.variant})]}),e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100,pl:4},children:"Running:"}),k.sandbox.sandbox_running?e.jsxs(n,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(ne,{size:12,fill:"success.fg"}),e.jsx(i,{sx:{fontSize:0,color:"success.fg"},children:"Yes"})]}):e.jsxs(n,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(se,{size:12,fill:"fg.muted"}),e.jsx(i,{sx:{fontSize:0,color:"fg.muted"},children:"No"})]})]}),k.sandbox.variant==="jupyter-server"&&e.jsxs(e.Fragment,{children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100,pl:4},children:"Jupyter URL:"}),e.jsx(i,{sx:{fontSize:0,fontFamily:"mono",color:"fg.default",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.jupyter_sandbox||k.sandbox.jupyter_url||"Not configured"})]}),e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100,pl:4},children:"Connection:"}),k.sandbox.jupyter_connected?e.jsxs(n,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(ne,{size:12,fill:"success.fg"}),e.jsx(i,{sx:{fontSize:0,color:"success.fg"},children:"Connected"})]}):e.jsxs(n,{display:"flex",flexDirection:"column",gap:1,children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(se,{size:12,fill:"danger.fg"}),e.jsx(i,{sx:{fontSize:0,color:"danger.fg"},children:"Not Connected"})]}),k.sandbox.jupyter_error&&e.jsx(i,{sx:{fontSize:0,color:"danger.fg",fontFamily:"mono",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:k.sandbox.jupyter_error})]})]})]}),k.sandbox.generated_path&&e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100,pl:4},children:"Generated:"}),e.jsx(i,{sx:{fontSize:0,fontFamily:"mono",color:"fg.default",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:k.sandbox.generated_path,children:k.sandbox.generated_path})]}),k.sandbox.skills_path&&e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100,pl:4},children:"Skills:"}),e.jsx(i,{sx:{fontSize:0,fontFamily:"mono",color:"fg.default",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:k.sandbox.skills_path,children:k.sandbox.skills_path})]}),k.sandbox.python_path&&e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:100,pl:4},children:"Python:"}),e.jsx(i,{sx:{fontSize:0,fontFamily:"mono",color:"fg.default",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:k.sandbox.python_path,children:k.sandbox.python_path})]})]})})]}),e.jsxs(n,{children:[e.jsx(F,{as:"h4",sx:{fontSize:1,fontWeight:"semibold",mb:2,color:"fg.muted"},children:"Config MCP Servers"}),e.jsx(n,{p:3,bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",children:!x&&$?e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(ae,{size:"small"}),e.jsx(i,{sx:{fontSize:1,color:"fg.muted"},children:"Loading MCP status..."})]}):M?e.jsxs(n,{display:"flex",flexDirection:"column",gap:2,children:[e.jsx(n,{display:"flex",alignItems:"center",gap:2,children:e.jsxs(i,{sx:{fontSize:1},children:[e.jsx(i,{as:"span",sx:{fontWeight:"semibold"},children:M.ready_count})," ","ready,"," ",e.jsx(i,{as:"span",sx:{fontWeight:"semibold"},children:M.failed_count})," ","failed"]})}),M.ready_servers.length>0&&e.jsxs(n,{display:"flex",flexDirection:"column",gap:1,children:[e.jsx(i,{sx:{fontSize:0,fontWeight:"semibold",color:"fg.muted"},children:"Ready:"}),M.ready_servers.map(v=>e.jsxs(n,{display:"flex",alignItems:"center",gap:2,pl:2,children:[e.jsx(ne,{size:16,fill:"success.fg"}),e.jsx(i,{sx:{fontSize:1},children:v})]},v))]}),Object.keys(M.failed_servers).length>0&&e.jsxs(n,{display:"flex",flexDirection:"column",gap:1,children:[e.jsx(i,{sx:{fontSize:0,fontWeight:"semibold",color:"fg.muted"},children:"Failed:"}),Object.entries(M.failed_servers).map(([v,_])=>e.jsxs(n,{display:"flex",flexDirection:"column",gap:1,pl:2,children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(se,{size:16,fill:"danger.fg"}),e.jsx(i,{sx:{fontSize:1},children:v})]}),e.jsx(i,{sx:{fontSize:0,color:"danger.fg",fontFamily:"mono",pl:4,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:_.split(`
|
|
8
|
+
`)[0]})]},v))]})]}):x?e.jsx(i,{sx:{fontSize:1,color:"fg.muted"},children:"Waiting for MCP status from WebSocket stream..."}):e.jsx(i,{sx:{fontSize:1,color:"fg.muted"},children:"Failed to load MCP status"})})]}),e.jsxs(n,{children:[e.jsx(F,{as:"h4",sx:{fontSize:1,fontWeight:"semibold",mb:2,color:"fg.muted"},children:"Codemode"}),e.jsx(n,{p:3,bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",children:!U&&G?e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(ae,{size:"small"}),e.jsx(i,{sx:{fontSize:1,color:"fg.muted"},children:"Loading Codemode status..."})]}):w?e.jsxs(n,{display:"flex",flexDirection:"column",gap:3,children:[e.jsxs(n,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(ce,{size:16}),e.jsxs(n,{children:[e.jsx(i,{id:"codemode-toggle-label",sx:{fontSize:1,fontWeight:"semibold"},children:"Codemode"}),e.jsx(i,{sx:{fontSize:0,color:"fg.muted",marginLeft:1},children:"MCP servers become programmatic tools"})]})]}),e.jsx(bt,{"aria-labelledby":"codemode-toggle-label",checked:w.enabled,onClick:()=>H.mutate(!w.enabled),disabled:H.isPending,size:"small"})]}),w.sandbox&&e.jsxs(n,{display:"flex",flexDirection:"column",gap:2,p:2,bg:"canvas.default",borderRadius:2,border:"1px solid",borderColor:"border.default",children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(ce,{size:16}),e.jsx(i,{sx:{fontSize:0,fontWeight:"semibold",color:"fg.muted"},children:"Code Sandbox"})]}),e.jsxs(n,{display:"flex",flexDirection:"column",gap:1,pl:4,children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:80},children:"Variant:"}),e.jsx(A,{variant:w.sandbox.variant==="jupyter-server"?"accent":"secondary",size:"small",children:w.sandbox.variant})]}),w.sandbox.variant==="jupyter-server"&&e.jsxs(e.Fragment,{children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:80},children:"URL:"}),e.jsx(i,{sx:{fontSize:0,fontFamily:"mono",color:"fg.default",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:w.sandbox.jupyter_url||"Not configured"})]}),e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:80},children:"Status:"}),w.sandbox.jupyter_connected?e.jsxs(n,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(ne,{size:12,fill:"success.fg"}),e.jsx(i,{sx:{fontSize:0,color:"success.fg"},children:"Connected"})]}):e.jsxs(n,{display:"flex",flexDirection:"column",gap:1,children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(se,{size:12,fill:"danger.fg"}),e.jsx(i,{sx:{fontSize:0,color:"danger.fg"},children:"Not Connected"})]}),w.sandbox.jupyter_error&&e.jsx(i,{sx:{fontSize:0,color:"danger.fg",fontFamily:"mono",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:w.sandbox.jupyter_error})]})]})]}),e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:80},children:"Running:"}),w.sandbox.sandbox_running?e.jsxs(n,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(ne,{size:12,fill:"success.fg"}),e.jsx(i,{sx:{fontSize:0,color:"success.fg"},children:"Yes"})]}):e.jsxs(n,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(se,{size:12,fill:"fg.muted"}),e.jsx(i,{sx:{fontSize:0,color:"fg.muted"},children:"No"})]})]}),w.sandbox.generated_path&&e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:80},children:"Generated:"}),e.jsx(i,{sx:{fontSize:0,fontFamily:"mono",color:"fg.default",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:w.sandbox.generated_path,children:w.sandbox.generated_path})]}),w.sandbox.skills_path&&e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:80},children:"Skills:"}),e.jsx(i,{sx:{fontSize:0,fontFamily:"mono",color:"fg.default",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:w.sandbox.skills_path,children:w.sandbox.skills_path})]}),w.sandbox.python_path&&e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(i,{sx:{fontSize:0,color:"fg.muted",width:80},children:"Python Path:"}),e.jsx(i,{sx:{fontSize:0,fontFamily:"mono",color:"fg.default",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:w.sandbox.python_path,children:w.sandbox.python_path})]})]})]}),w.skills.length>0&&e.jsxs(n,{display:"flex",flexDirection:"column",gap:1,children:[e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(yt,{size:16}),e.jsxs(i,{sx:{fontSize:0,fontWeight:"semibold",color:"fg.muted"},children:["Active Skills (",w.skills.length,")"]})]}),w.skills.map(v=>e.jsxs(n,{display:"flex",flexDirection:"column",gap:1,pl:4,py:1,borderLeft:"2px solid",borderColor:"accent.emphasis",children:[e.jsx(i,{sx:{fontSize:1,fontWeight:"semibold"},children:v.name}),v.description&&e.jsx(i,{sx:{fontSize:0,color:"fg.muted"},children:v.description}),v.tags&&v.tags.length>0&&e.jsx(n,{display:"flex",gap:1,flexWrap:"wrap",children:v.tags.map(_=>e.jsx(A,{variant:"secondary",size:"small",children:_},_))})]},v.name))]}),w.available_skills.length>0&&w.skills.length===0&&e.jsxs(n,{display:"flex",flexDirection:"column",gap:1,children:[e.jsxs(i,{sx:{fontSize:0,fontWeight:"semibold",color:"fg.muted"},children:["Available Skills (",w.available_skills.length,")"]}),e.jsx(i,{sx:{fontSize:0,color:"fg.muted"},children:"Enable skills via CLI with --skills flag"}),e.jsx(n,{display:"flex",gap:1,flexWrap:"wrap",mt:1,children:w.available_skills.map(v=>e.jsx(A,{variant:"secondary",size:"small",children:v.name},v.name))})]}),w.available_skills.length===0&&e.jsx(i,{sx:{fontSize:0,color:"fg.muted"},children:"No CodeMode skills are available for this agent. You can still use MCP tools by selecting MCP servers."})]}):U?e.jsx(i,{sx:{fontSize:1,color:"fg.muted"},children:"Waiting for Codemode status from WebSocket stream..."}):e.jsx(i,{sx:{fontSize:1,color:"fg.muted"},children:"Failed to load Codemode status"})})]}),m&&d&&e.jsx(At,{agentId:d,apiBase:c,liveData:X,messageCount:a,chartHeight:"200px"}),m&&d&&e.jsxs(n,{mt:3,children:[e.jsxs(n,{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2,children:[e.jsx(F,{as:"h4",sx:{fontSize:1,fontWeight:"semibold",color:"fg.muted"},children:"Context Snapshot"}),e.jsx(L,{size:"small",variant:"invisible",leadingVisual:De,onClick:()=>tn(d,c,W),children:"Download"})]}),e.jsx(n,{p:3,bg:"canvas.subtle",borderRadius:2,border:"1px solid",borderColor:"border.default",children:e.jsx(Ut,{agentId:d,apiBase:c,liveData:W})})]}),e.jsx(Qt,{providers:h,title:"Connected Accounts",showHeader:!0,showDescription:!0,description:"OAuth identities connected to this agent. Agents can use these to access external services like GitHub repositories on your behalf.",showExpirationDetails:!0,allowReconnect:!!h,onConnect:f,onDisconnect:S})]}),b&&e.jsx(n,{mt:2,children:e.jsx(L,{leadingVisual:Ie,onClick:u,children:"Back to chat"})})]}),K&&k?e.jsx(en,{spec:k,onClose:()=>Q(!1)}):null]})}export{un as AgentDetails,un as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,Q as l,j as s,D as o,h as m}from"../datalayer-app-main.js";import{AgentDetails as p}from"./AgentDetails-
|
|
1
|
+
import{r as a,Q as l,j as s,D as o,h as m}from"../datalayer-app-main.js";import{AgentDetails as p}from"./AgentDetails-syhFobKk.js";import"./ArrowLeftIcon-sX3iNMG1.js";import"./UnlinkIcon-fXwOyjzQ.js";import"./esm-VjpQWsU9.js";import"./core-BrYTRvTy.js";import"./index-BaRoLDk0.js";import"./Avatar-DUPBQXVt.js";function B({about:e,name:r,onClose:t}){const n=a.useMemo(()=>new l,[]),i=!!(e.agentId&&e.apiBase);return s.jsx(o,{title:`${e.name??r} · Agent Details`,onClose:t,width:"xlarge",height:"large",children:s.jsx("div",{"data-assistant-agent-details":"",children:s.jsx(m,{client:n,children:s.jsx(p,{name:e.name??r,protocol:e.protocol??(i?"agent-runtimes":"browser"),url:e.url??"",messageCount:0,agentId:e.agentId,apiBase:e.apiBase,onBack:t,showBackHeader:!1,showUsage:i,padded:!1,runtime:i,summary:{spec:e.spec,model:e.model,where:e.where,description:e.description,skills:e.skills}})})})})}export{B as AgentDetailsDialog,B as default};
|
package/dist-embed/chunks/{CellSidebarExtension-CrgdhbHy.js → CellSidebarExtension-B_Bqi3Eh.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as v,J as Xe,j as m,ke as Dt,I as J,f7 as Ke,cC as me,bm as ge,v as Y,fC as At,fv as Ze,fO as jt,kf as It,kg as Nt,kh as Qe,ki as et,ch as V,kj as Lt,kk as Rt,kl as Ot,bN as je,km as ft,kn as mt,ko as Ft,kp as ue,aO as Bt,bO as Ue,kq as gt,kr as Wt,ks as tt,aa as N,kt as nt,ku as fe,kv as Vt,kw as Gt,kx as Ht,aE as pe,ky as Le,kz as st,aF as ke,aG as ee,bh as $t,eM as zt,ce as U,ka as Kt,az as Ut,cn as qt,aB as Z,dE as Jt,e1 as Yt,iW as We,iU as pt,kA as xe,ex as Se,kB as be,kC as Xt,kD as Zt,aJ as Qt,aC as en,k8 as tn,kE as _t,iG as K,kF as nn,kG as R,kH as sn,dy as on,kI as vt,kJ as rn,kK as an,kL as ln,Z as ne,B as he,dL as dn,_ as cn,av as hn,eB as ot,eC as de,eD as un,cs as fn,k as mn,kM as gn,kN as yt,gP as pn,kO as ae,bl as D,z as le,dp as it,bx as Ct,e9 as _n,du as vn,bu as Me,V as yn,U as Cn,aK as bn,aR as wn}from"../datalayer-app-main.js";import{b as kn,c as xn,f as ce,P as Re,d as Sn,W as Mn,r as En,g as Tn,h as Pn,i as Dn,C as An,a as jn}from"./index--Rl4aMiU.js";import{c as In,N as Ve}from"./NotebookSkeleton-GSdyJDf_.js";import{H as Nn}from"./hoverbox-CStlKQWE.js";import{R as bt,L as Ln}from"./index-5os8HYj-.js";import{a as Rn,W as rt}from"./renderer-CCsq5PXp.js";import{C as Ee,S as Te}from"./SquareIcon-Dy3l3VdH.js";function On(...r){return v.useCallback(e=>{for(const t of r)typeof t=="function"?t(e):t&&(t.current=e)},r)}var Q={Banner:"prc-Banner-Banner-IR8eJ",BannerContainer:"prc-Banner-BannerContainer-lbx3d",BannerContent:"prc-Banner-BannerContent-zTITK",BannerActions:"prc-Banner-BannerActions-XCfHL",BannerTitle:"prc-Banner-BannerTitle-TcuJl",BannerIcon:"prc-Banner-BannerIcon-WuOyf",BannerDismiss:"prc-Banner-BannerDismiss-uBZVm",BannerActionsContainer:"prc-Banner-BannerActionsContainer-ukGMH"};const Fn={critical:m.jsx(It,{}),info:m.jsx(Ze,{}),success:m.jsx(jt,{}),upsell:m.jsx(Ze,{}),warning:m.jsx(At,{})},Bn={critical:"Critical",info:"Information",success:"Success",upsell:"Recommendation",warning:"Warning"},Wn=Xe.forwardRef(function({"aria-label":e,children:t,className:n,description:s,hideTitle:o,icon:i,onDismiss:a,primaryAction:l,secondaryAction:d,title:c,variant:h="info",...u},f){const _=!!a,y=l||d,A=Xe.useRef(null),j=On(f,A),p=h==="info"||h==="upsell";return m.jsxs("section",{...u,"aria-label":e??Bn[h],className:me(n,Q.Banner),"data-dismissible":a?"":void 0,"data-title-hidden":o?"":void 0,"data-variant":h,tabIndex:-1,ref:j,children:[m.jsx("div",{className:Q.BannerIcon,children:i&&p?i:Fn[h]}),m.jsxs("div",{className:Q.BannerContainer,children:[m.jsxs("div",{className:Q.BannerContent,children:[c?o?m.jsx(Dt,{children:m.jsx(Ge,{children:c})}):m.jsx(Ge,{children:c}):null,s?m.jsx(wt,{children:s}):null,t]}),y?m.jsx(Vn,{primaryAction:l,secondaryAction:d}):null]}),_?m.jsx(J,{"aria-label":"Dismiss banner",onClick:a,className:Q.BannerDismiss,icon:Ke,variant:"invisible"}):null]})});function Ge(r){const e=ge.c(12);let t,n,s,o;e[0]!==r?({as:o,className:n,children:t,...s}=r,e[0]=r,e[1]=t,e[2]=n,e[3]=s,e[4]=o):(t=e[1],n=e[2],s=e[3],o=e[4]);const i=o===void 0?"h2":o;let a;e[5]!==n?(a=me(n,Q.BannerTitle),e[5]=n,e[6]=a):a=e[6];let l;return e[7]!==i||e[8]!==t||e[9]!==s||e[10]!==a?(l=m.jsx(i,{...s,className:a,"data-banner-title":"",children:t}),e[7]=i,e[8]=t,e[9]=s,e[10]=a,e[11]=l):l=e[11],l}function wt(r){const e=ge.c(10);let t,n,s;e[0]!==r?({children:t,className:n,...s}=r,e[0]=r,e[1]=t,e[2]=n,e[3]=s):(t=e[1],n=e[2],s=e[3]);let o;e[4]!==n?(o=me("BannerDescription",n),e[4]=n,e[5]=o):o=e[5];let i;return e[6]!==t||e[7]!==s||e[8]!==o?(i=m.jsx("div",{...s,className:o,children:t}),e[6]=t,e[7]=s,e[8]=o,e[9]=i):i=e[9],i}function Vn(r){const e=ge.c(9),{primaryAction:t,secondaryAction:n}=r,s=n??null,o=t??null;let i;e[0]!==s||e[1]!==o?(i=m.jsxs("div",{className:Q.BannerActionsContainer,"data-primary-action":"trailing",children:[s,o]}),e[0]=s,e[1]=o,e[2]=i):i=e[2];const a=t??null,l=n??null;let d;e[3]!==a||e[4]!==l?(d=m.jsxs("div",{className:Q.BannerActionsContainer,"data-primary-action":"leading",children:[a,l]}),e[3]=a,e[4]=l,e[5]=d):d=e[5];let c;return e[6]!==i||e[7]!==d?(c=m.jsxs("div",{className:Q.BannerActions,children:[i,d]}),e[6]=i,e[7]=d,e[8]=c):c=e[8],c}const kt=v.forwardRef((r,e)=>{const t=ge.c(11);let n,s,o;t[0]!==r?({children:n,className:s,...o}=r,t[0]=r,t[1]=n,t[2]=s,t[3]=o):(n=t[1],s=t[2],o=t[3]);let i;t[4]!==s?(i=me("BannerPrimaryAction",s),t[4]=s,t[5]=i):i=t[5];let a;return t[6]!==n||t[7]!==e||t[8]!==o||t[9]!==i?(a=m.jsx(Y,{ref:e,className:i,variant:"default",...o,children:n}),t[6]=n,t[7]=e,t[8]=o,t[9]=i,t[10]=a):a=t[10],a});kt.displayName="BannerPrimaryAction";const xt=v.forwardRef((r,e)=>{const t=ge.c(11);let n,s,o;t[0]!==r?({children:n,className:s,...o}=r,t[0]=r,t[1]=n,t[2]=s,t[3]=o):(n=t[1],s=t[2],o=t[3]);let i;t[4]!==s?(i=me("BannerPrimaryAction",s),t[4]=s,t[5]=i):i=t[5];let a;return t[6]!==n||t[7]!==e||t[8]!==o||t[9]!==i?(a=m.jsx(Y,{ref:e,className:i,variant:"link",...o,children:n}),t[6]=n,t[7]=e,t[8]=o,t[9]=i,t[10]=a):a=t[10],a});xt.displayName="BannerSecondaryAction";const Gn=Object.assign(Wn,{Title:Ge,Description:wt,PrimaryAction:kt,SecondaryAction:xt}),_e=Rt.define({combine(r){return r[r.length-1]}}),Hn=je.baseTheme({".jp-remote-cursor":{borderLeft:"1px solid black",marginLeft:"-1px"},".jp-remote-cursor.jp-mod-primary":{borderLeftWidth:"2px"},".jp-remote-selection":{opacity:.5},".cm-tooltip":{border:"none"},".cm-tooltip.jp-remote-userInfo":{color:"var(--fgColor-onEmphasis, #ffffff)",padding:"0px 2px"}});function qe(r,e){const t=r?.username||r?.display_name||r?.name||String(e),{theme:n,colorMode:s}=Bt.getState(),o=s==="auto"?typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light":s;return In(t,n,o)}const Ie=Ot.define();class St{style;marker;constructor(e,t){this.style=e,this.marker=t}draw(){const e=this.marker.draw();for(const[t,n]of Object.entries(this.style))e.style[t]=n;return e}eq(e){return this.marker.eq(e.marker)&&V.deepEqual(this.style,e.style)}update(e,t){for(const[n,s]of Object.entries(this.style))e.style[n]=s;return this.marker.update(e,t.marker)}}const $n=ft({above:!0,markers(r){const{awareness:e,ytext:t}=r.state.facet(_e),n=t.doc,s=[];return e.getStates().forEach((o,i)=>{if(i===e.doc.clientID)return;const a=o.cursors;for(const l of a??[]){if(!l?.anchor||!l?.head)return;const d=ue(l.anchor,n),c=ue(l.head,n);if(d?.type!==t||c?.type!==t)return;const h=l.primary??!0?"jp-remote-cursor jp-mod-primary":"jp-remote-cursor",u=Ue.cursor(c.index,c.index>d.index?-1:1);for(const f of gt.forRange(r,h,u))s.push(new St({borderLeftColor:qe(o.user,i)},f))}}),s},update(r,e){return!!r.transactions.find(t=>t.annotation(Ie))},class:"jp-remote-cursors"});function at(r){const e=new Array,{awareness:t,ytext:n}=r.facet(_e),s=n.doc;for(const[o,i]of t.getStates())if(o!==t.doc.clientID)for(const a of i.cursors??[]){if(!a?.head)continue;const l=ue(a.head,s);l?.type===n&&e.push({pos:l.index,above:!0,create:()=>{const d=document.createElement("div");return d.classList.add("jp-remote-userInfo"),d.style.backgroundColor=qe(i.user,o),d.textContent=i.user?.display_name??"Anonymous",{dom:d}}})}return e}const zn=mt.define({create:at,update(r,e){return e.annotation(Ie)?at(e.state):r},provide(r){return Ft.computeN([r],e=>e.field(r))}}),Kn=ft({above:!1,markers(r){const{awareness:e,ytext:t}=r.state.facet(_e),n=t.doc,s=[];return e.getStates().forEach((o,i)=>{if(i===e.doc.clientID)return;const a=o.cursors;for(const l of a??[]){if((l.empty??!0)||!l?.anchor||!l?.head)return;const d=ue(l.anchor,n),c=ue(l.head,n);if(d?.type!==t||c?.type!==t)return;const h="jp-remote-selection";for(const u of gt.forRange(r,h,Ue.range(d.index,c.index)))s.push(new St({backgroundColor:qe(o.user,i)},u))}}),s},update(r,e){return!!r.transactions.find(t=>t.annotation(Ie))},class:"jp-remote-selections"}),Un=Nt.fromClass(class{editorAwareness;_listener;constructor(r){this.editorAwareness=r.state.facet(_e),this._listener=({added:e,updated:t,removed:n})=>{e.concat(t).concat(n).findIndex(o=>o!==this.editorAwareness.awareness.doc.clientID)>=0&&r.dispatch({annotations:[Ie.of([])]})},this.editorAwareness.awareness.on("change",this._listener)}destroy(){this.editorAwareness.awareness.off("change",this._listener)}update(r){if(!r.docChanged&&!r.selectionSet)return;const{awareness:e,ytext:t}=this.editorAwareness,n=e.getLocalState();if(n){const s=r.view.hasFocus&&r.view.dom.ownerDocument.hasFocus(),o=r.state.selection,i=new Array;if(s&&o){for(const a of o.ranges){const l=a===o.main,d=Qe(t,a.anchor),c=Qe(t,a.head);i.push({anchor:d,head:c,primary:l,empty:a.empty})}if(!n.cursors||i.length>0){const a=n.cursors?.map(l=>({...l,anchor:l?.anchor?et(l.anchor):null,head:l?.head?et(l.head):null}));V.deepEqual(i,a)||e.setLocalStateField("cursors",i)}}}}},{provide:()=>[Hn,$n,Kn,zn,Lt({position:"absolute",parent:document.body})]});function qn(r){return[_e.of(r),Un]}class Ne extends Wt{constructor(e={}){var t;super(),this.version="2.0.0",this.ymeta=this.ydoc.getMap("meta"),this._onMetaChanged=n=>{const s=n.find(i=>i.target===this.ymeta.get("metadata"));if(s){const i=s.changes.keys,a=this.ymeta.get("metadata");s.changes.keys.forEach((l,d)=>{switch(l.action){case"add":this._metadataChanged.emit({key:d,type:"add",newValue:a.get(d)});break;case"delete":this._metadataChanged.emit({key:d,type:"remove",oldValue:l.oldValue});break;case"update":{const c=a.get(d),h=l.oldValue;let u=!0;typeof h=="object"&&typeof c=="object"?u=V.deepEqual(h,c):u=h===c,u||this._metadataChanged.emit({key:d,type:"change",oldValue:h,newValue:c})}break}}),this._changed.emit({metadataChange:i})}const o=n.find(i=>i.target===this.ymeta);if(o){if(o.keysChanged.has("metadata")){const i=o.changes.keys.get("metadata");if(i?.action==="add"&&!i.oldValue){const a=new Map;for(const l of Object.keys(this.metadata))a.set(l,{action:"add",oldValue:void 0}),this._metadataChanged.emit({key:l,type:"add",newValue:this.getMetadata(l)});this._changed.emit({metadataChange:a})}}if(o.keysChanged.has("nbformat")){const i=o.changes.keys.get("nbformat"),a={key:"nbformat",oldValue:i?.oldValue?i.oldValue:void 0,newValue:this.nbformat};this._changed.emit({nbformatChanged:a})}if(o.keysChanged.has("nbformat_minor")){const i=o.changes.keys.get("nbformat_minor"),a={key:"nbformat_minor",oldValue:i?.oldValue?i.oldValue:void 0,newValue:this.nbformat_minor};this._changed.emit({nbformatChanged:a})}}},this._onYCellsChanged=n=>{n.changes.added.forEach(i=>{const a=i.content.type;if(!this._ycellMapping.has(a)){const l=tt(a,{notebook:this});this._ycellMapping.set(a,l)}}),n.changes.deleted.forEach(i=>{const a=i.content.type,l=this._ycellMapping.get(a);l&&(l.dispose(),this._ycellMapping.delete(a))});let s=0;const o=[];n.changes.delta.forEach(i=>{if(i.insert!=null){const a=i.insert.map(l=>this._ycellMapping.get(l));o.push({insert:a}),this.cells.splice(s,0,...a),s+=i.insert.length}else i.delete!=null?(o.push(i),this.cells.splice(s,i.delete)):i.retain!=null&&(o.push(i),s+=i.retain)}),this._changed.emit({cellsChange:o})},this._metadataChanged=new N(this),this._ycells=this.ydoc.getArray("cells"),this._ycellMapping=new WeakMap,this._disableDocumentWideUndoRedo=(t=e.disableDocumentWideUndoRedo)!==null&&t!==void 0?t:!1,this.cells=this._ycells.toArray().map(n=>(this._ycellMapping.has(n)||this._ycellMapping.set(n,tt(n,{notebook:this})),this._ycellMapping.get(n))),this.undoManager.addToScope(this._ycells),this._ycells.observe(this._onYCellsChanged),this.ymeta.observeDeep(this._onMetaChanged)}static create(e={}){var t,n,s,o,i,a,l,d,c;const h=new Ne({disableDocumentWideUndoRedo:(t=e.disableDocumentWideUndoRedo)!==null&&t!==void 0?t:!1}),u={cells:(s=(n=e.data)===null||n===void 0?void 0:n.cells)!==null&&s!==void 0?s:[],nbformat:(i=(o=e.data)===null||o===void 0?void 0:o.nbformat)!==null&&i!==void 0?i:4,nbformat_minor:(l=(a=e.data)===null||a===void 0?void 0:a.nbformat_minor)!==null&&l!==void 0?l:5,metadata:(c=(d=e.data)===null||d===void 0?void 0:d.metadata)!==null&&c!==void 0?c:{}};return h.setSource(u),h}get disableDocumentWideUndoRedo(){return this._disableDocumentWideUndoRedo}get metadata(){return this.getMetadata()}set metadata(e){this.setMetadata(e)}get metadataChanged(){return this._metadataChanged}get nbformat(){return this.ymeta.get("nbformat")}set nbformat(e){this.transact(()=>{this.ymeta.set("nbformat",e)},!1)}get nbformat_minor(){return this.ymeta.get("nbformat_minor")}set nbformat_minor(e){this.transact(()=>{this.ymeta.set("nbformat_minor",e)},!1)}dispose(){this.isDisposed||(this._ycells.unobserve(this._onYCellsChanged),this.ymeta.unobserveDeep(this._onMetaChanged),super.dispose())}getCell(e){return this.cells[e]}addCell(e){return this.insertCell(this._ycells.length,e)}insertCell(e,t){return this.insertCells(e,[t])[0]}insertCells(e,t){const n=t.map(s=>{const o=nt(s,this);return this._ycellMapping.set(o.ymodel,o),o});return this.transact(()=>{this._ycells.insert(e,n.map(s=>s.ymodel))}),this.dirty=!0,n}moveCell(e,t){this.moveCells(e,t)}moveCells(e,t,n=1){const s=new Array(n).fill(!0).map((o,i)=>this.getCell(e+i).toJSON());this.transact(()=>{this._ycells.delete(e,n),this._ycells.insert(e>t?t:t-n+1,s.map(o=>nt(o,this).ymodel))}),this.dirty=!0}deleteCell(e){this.deleteCellRange(e,e+1)}deleteCellRange(e,t){this.transact(()=>{this._ycells.delete(e,t-e)}),this.dirty=!0}deleteMetadata(e){if(typeof this.getMetadata(e)>"u")return;const t=this.metadata;delete t[e],this.setMetadata(t)}getMetadata(e){const t=this.ymeta.get("metadata");if(t!==void 0)if(typeof e=="string"){const n=t.get(e);return typeof n>"u"?void 0:V.deepCopy(n)}else return V.deepCopy(t.toJSON())}setMetadata(e,t){var n;if(typeof e=="string"){if(typeof t>"u")throw new TypeError(`Metadata value for ${e} cannot be 'undefined'; use deleteMetadata.`);if(V.deepEqual((n=this.getMetadata(e))!==null&&n!==void 0?n:null,t))return;const s={};s[e]=t,this.updateMetadata(s)}else if(!this.metadata||!V.deepEqual(this.metadata,e)){const s=V.deepCopy(e),o=this.ymeta.get("metadata");if(o===void 0)return;this.transact(()=>{o.clear();for(const[i,a]of Object.entries(s))o.set(i,a)}),this.dirty=!0}}updateMetadata(e){const t=V.deepCopy(e),n=this.ymeta.get("metadata");n!==void 0&&(this.transact(()=>{for(const[s,o]of Object.entries(t))n.set(s,o)}),this.dirty=!0)}getSource(){return this.toJSON()}setSource(e){this.fromJSON(e),this.dirty=!1}fromJSON(e){this.transact(()=>{this.nbformat=e.nbformat,this.nbformat_minor=e.nbformat_minor;const t=e.metadata;if(t.orig_nbformat!==void 0&&delete t.orig_nbformat,this.metadata)this.metadata=t;else{const o=new fe;for(const[i,a]of Object.entries(t))o.set(i,a);this.ymeta.set("metadata",o)}const n=e.nbformat===4&&e.nbformat_minor>=5,s=e.cells.map(o=>(n||delete o.id,o));this.insertCells(this.cells.length,s),this.deleteCellRange(0,this.cells.length)})}toJSON(){const e=this.nbformat===4&&this.nbformat_minor<=4;return He({metadata:this.metadata,nbformat_minor:this.nbformat_minor,nbformat:this.nbformat,cells:this.cells.map(t=>{const n=t.toJSON();return e&&delete n.id,n})})}}function He(r){if(Array.isArray(r))return r.map(e=>He(e));if(r!==null&&typeof r=="object"){const e={},t=Object.entries(r).sort(([n],[s])=>n<s?-1:n>s?1:0);for(const[n,s]of t)Object.defineProperty(e,n,{value:He(s),enumerable:!0,writable:!0,configurable:!0});return e}return r}class Jn{constructor(e){this.model=e,this._cellMap=new WeakMap,this._changed=new N(this),this._isDisposed=!1,this._insertCells(0,this.model.cells),this.model.changed.connect(this._onSharedModelChanged,this)}get changed(){return this._changed}get isDisposed(){return this._isDisposed}get length(){return this.model.cells.length}*[Symbol.iterator](){for(const e of this.model.cells)yield this._cellMap.get(e)}dispose(){var e;if(!this._isDisposed){this._isDisposed=!0;for(const t of this.model.cells)(e=this._cellMap.get(t))===null||e===void 0||e.dispose();N.clearData(this)}}get(e){return this._cellMap.get(this.model.cells[e])}_insertCells(e,t){return t.forEach(n=>{let s;switch(n.cell_type){case"code":{s=new Ht({sharedModel:n});break}case"markdown":{s=new Gt({sharedModel:n});break}default:s=new Vt({sharedModel:n})}this._cellMap.set(n,s),n.disposed.connect(()=>{s.dispose(),this._cellMap.delete(n)})}),this.length}_onSharedModelChanged(e,t){var n;let s=0;const o=new Array;(n=t.cellsChange)===null||n===void 0||n.forEach(i=>{i.insert!=null?(this._insertCells(s,i.insert),o.push({type:"add",newIndex:s,newValues:i.insert.map(a=>this._cellMap.get(a)),oldIndex:-2,oldValues:[]}),s+=i.insert.length):i.delete!=null?o.push({type:"remove",newIndex:-1,newValues:[],oldIndex:s,oldValues:new Array(i.delete).fill(void 0)}):i.retain!=null&&(s+=i.retain)}),o.forEach(i=>this._changed.emit(i))}}class Yn{constructor(e){this._requestBatchSize=10,this._cursor=0,this._hasSession=!1,this._history=[],this._placeholder="",this._kernelSession="",this._setByHistory=!1,this._isDisposed=!1,this._editor=null,this._filtered=[],this._kernel=null,this._sessionContext=e.sessionContext,this._trans=(e.translator||pe).load("jupyterlab"),this._toRequest=this._requestBatchSize,this._handleKernel().then(()=>{this._sessionContext.kernelChanged.connect(this._handleKernel,this)})}get editor(){return this._editor}set editor(e){if(this._editor===e)return;const t=this._editor;t&&t.model.sharedModel.changed.disconnect(this.onTextChange,this),this._editor=e,e&&e.model.sharedModel.changed.connect(this.onTextChange,this)}get placeholder(){return this._placeholder}get kernelSession(){return this._kernelSession}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed=!0,this._history.length=0,N.clearData(this)}async checkSession(e){var t;this._hasSession||(await this._retrieveHistory(),this._hasSession=!0,this.editor=e.editor,this._placeholder=((t=this._editor)===null||t===void 0?void 0:t.model.sharedModel.getSource())||"",this.setFilter(this._placeholder),this._cursor=this._filtered.length-1)}async back(e){return await this.checkSession(e),--this._cursor,this._cursor<0&&await this.fetchBatch(),this._cursor=Math.max(0,this._cursor),this._filtered[this._cursor]}async forward(e){return await this.checkSession(e),++this._cursor,this._cursor=Math.min(this._filtered.length-1,this._cursor),this._filtered[this._cursor]}updateEditor(e,t){var n,s;if(e){const o=(n=e.editor)===null||n===void 0?void 0:n.model,i=o?.sharedModel.getSource();if(this.isDisposed||!t||i===t)return;this._setByHistory=!0,o?.sharedModel.setSource(t);let a=0;a=t.indexOf(`
|
|
1
|
+
import{r as v,J as Xe,j as m,ke as Dt,I as J,f7 as Ke,cC as me,bm as ge,v as Y,fC as At,fv as Ze,fO as jt,kf as It,kg as Nt,kh as Qe,ki as et,ch as V,kj as Lt,kk as Rt,kl as Ot,bN as je,km as ft,kn as mt,ko as Ft,kp as ue,aO as Bt,bO as Ue,kq as gt,kr as Wt,ks as tt,aa as N,kt as nt,ku as fe,kv as Vt,kw as Gt,kx as Ht,aE as pe,ky as Le,kz as st,aF as ke,aG as ee,bh as $t,eM as zt,ce as U,ka as Kt,az as Ut,cn as qt,aB as Z,dE as Jt,e1 as Yt,iW as We,iU as pt,kA as xe,ex as Se,kB as be,kC as Xt,kD as Zt,aJ as Qt,aC as en,k8 as tn,kE as _t,iG as K,kF as nn,kG as R,kH as sn,dy as on,kI as vt,kJ as rn,kK as an,kL as ln,Z as ne,B as he,dL as dn,_ as cn,av as hn,eB as ot,eC as de,eD as un,cs as fn,k as mn,kM as gn,kN as yt,gP as pn,kO as ae,bl as D,z as le,dp as it,bx as Ct,e9 as _n,du as vn,bu as Me,V as yn,U as Cn,aK as bn,aR as wn}from"../datalayer-app-main.js";import{b as kn,c as xn,f as ce,P as Re,d as Sn,W as Mn,r as En,g as Tn,h as Pn,i as Dn,C as An,a as jn}from"./index--Rl4aMiU.js";import{c as In,N as Ve}from"./NotebookSkeleton-GSdyJDf_.js";import{H as Nn}from"./hoverbox-CStlKQWE.js";import{R as bt,L as Ln}from"./index-DrrVr0x3.js";import{a as Rn,W as rt}from"./renderer-B_98xkGt.js";import{C as Ee,S as Te}from"./SquareIcon-Dy3l3VdH.js";function On(...r){return v.useCallback(e=>{for(const t of r)typeof t=="function"?t(e):t&&(t.current=e)},r)}var Q={Banner:"prc-Banner-Banner-IR8eJ",BannerContainer:"prc-Banner-BannerContainer-lbx3d",BannerContent:"prc-Banner-BannerContent-zTITK",BannerActions:"prc-Banner-BannerActions-XCfHL",BannerTitle:"prc-Banner-BannerTitle-TcuJl",BannerIcon:"prc-Banner-BannerIcon-WuOyf",BannerDismiss:"prc-Banner-BannerDismiss-uBZVm",BannerActionsContainer:"prc-Banner-BannerActionsContainer-ukGMH"};const Fn={critical:m.jsx(It,{}),info:m.jsx(Ze,{}),success:m.jsx(jt,{}),upsell:m.jsx(Ze,{}),warning:m.jsx(At,{})},Bn={critical:"Critical",info:"Information",success:"Success",upsell:"Recommendation",warning:"Warning"},Wn=Xe.forwardRef(function({"aria-label":e,children:t,className:n,description:s,hideTitle:o,icon:i,onDismiss:a,primaryAction:l,secondaryAction:d,title:c,variant:h="info",...u},f){const _=!!a,y=l||d,A=Xe.useRef(null),j=On(f,A),p=h==="info"||h==="upsell";return m.jsxs("section",{...u,"aria-label":e??Bn[h],className:me(n,Q.Banner),"data-dismissible":a?"":void 0,"data-title-hidden":o?"":void 0,"data-variant":h,tabIndex:-1,ref:j,children:[m.jsx("div",{className:Q.BannerIcon,children:i&&p?i:Fn[h]}),m.jsxs("div",{className:Q.BannerContainer,children:[m.jsxs("div",{className:Q.BannerContent,children:[c?o?m.jsx(Dt,{children:m.jsx(Ge,{children:c})}):m.jsx(Ge,{children:c}):null,s?m.jsx(wt,{children:s}):null,t]}),y?m.jsx(Vn,{primaryAction:l,secondaryAction:d}):null]}),_?m.jsx(J,{"aria-label":"Dismiss banner",onClick:a,className:Q.BannerDismiss,icon:Ke,variant:"invisible"}):null]})});function Ge(r){const e=ge.c(12);let t,n,s,o;e[0]!==r?({as:o,className:n,children:t,...s}=r,e[0]=r,e[1]=t,e[2]=n,e[3]=s,e[4]=o):(t=e[1],n=e[2],s=e[3],o=e[4]);const i=o===void 0?"h2":o;let a;e[5]!==n?(a=me(n,Q.BannerTitle),e[5]=n,e[6]=a):a=e[6];let l;return e[7]!==i||e[8]!==t||e[9]!==s||e[10]!==a?(l=m.jsx(i,{...s,className:a,"data-banner-title":"",children:t}),e[7]=i,e[8]=t,e[9]=s,e[10]=a,e[11]=l):l=e[11],l}function wt(r){const e=ge.c(10);let t,n,s;e[0]!==r?({children:t,className:n,...s}=r,e[0]=r,e[1]=t,e[2]=n,e[3]=s):(t=e[1],n=e[2],s=e[3]);let o;e[4]!==n?(o=me("BannerDescription",n),e[4]=n,e[5]=o):o=e[5];let i;return e[6]!==t||e[7]!==s||e[8]!==o?(i=m.jsx("div",{...s,className:o,children:t}),e[6]=t,e[7]=s,e[8]=o,e[9]=i):i=e[9],i}function Vn(r){const e=ge.c(9),{primaryAction:t,secondaryAction:n}=r,s=n??null,o=t??null;let i;e[0]!==s||e[1]!==o?(i=m.jsxs("div",{className:Q.BannerActionsContainer,"data-primary-action":"trailing",children:[s,o]}),e[0]=s,e[1]=o,e[2]=i):i=e[2];const a=t??null,l=n??null;let d;e[3]!==a||e[4]!==l?(d=m.jsxs("div",{className:Q.BannerActionsContainer,"data-primary-action":"leading",children:[a,l]}),e[3]=a,e[4]=l,e[5]=d):d=e[5];let c;return e[6]!==i||e[7]!==d?(c=m.jsxs("div",{className:Q.BannerActions,children:[i,d]}),e[6]=i,e[7]=d,e[8]=c):c=e[8],c}const kt=v.forwardRef((r,e)=>{const t=ge.c(11);let n,s,o;t[0]!==r?({children:n,className:s,...o}=r,t[0]=r,t[1]=n,t[2]=s,t[3]=o):(n=t[1],s=t[2],o=t[3]);let i;t[4]!==s?(i=me("BannerPrimaryAction",s),t[4]=s,t[5]=i):i=t[5];let a;return t[6]!==n||t[7]!==e||t[8]!==o||t[9]!==i?(a=m.jsx(Y,{ref:e,className:i,variant:"default",...o,children:n}),t[6]=n,t[7]=e,t[8]=o,t[9]=i,t[10]=a):a=t[10],a});kt.displayName="BannerPrimaryAction";const xt=v.forwardRef((r,e)=>{const t=ge.c(11);let n,s,o;t[0]!==r?({children:n,className:s,...o}=r,t[0]=r,t[1]=n,t[2]=s,t[3]=o):(n=t[1],s=t[2],o=t[3]);let i;t[4]!==s?(i=me("BannerPrimaryAction",s),t[4]=s,t[5]=i):i=t[5];let a;return t[6]!==n||t[7]!==e||t[8]!==o||t[9]!==i?(a=m.jsx(Y,{ref:e,className:i,variant:"link",...o,children:n}),t[6]=n,t[7]=e,t[8]=o,t[9]=i,t[10]=a):a=t[10],a});xt.displayName="BannerSecondaryAction";const Gn=Object.assign(Wn,{Title:Ge,Description:wt,PrimaryAction:kt,SecondaryAction:xt}),_e=Rt.define({combine(r){return r[r.length-1]}}),Hn=je.baseTheme({".jp-remote-cursor":{borderLeft:"1px solid black",marginLeft:"-1px"},".jp-remote-cursor.jp-mod-primary":{borderLeftWidth:"2px"},".jp-remote-selection":{opacity:.5},".cm-tooltip":{border:"none"},".cm-tooltip.jp-remote-userInfo":{color:"var(--fgColor-onEmphasis, #ffffff)",padding:"0px 2px"}});function qe(r,e){const t=r?.username||r?.display_name||r?.name||String(e),{theme:n,colorMode:s}=Bt.getState(),o=s==="auto"?typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light":s;return In(t,n,o)}const Ie=Ot.define();class St{style;marker;constructor(e,t){this.style=e,this.marker=t}draw(){const e=this.marker.draw();for(const[t,n]of Object.entries(this.style))e.style[t]=n;return e}eq(e){return this.marker.eq(e.marker)&&V.deepEqual(this.style,e.style)}update(e,t){for(const[n,s]of Object.entries(this.style))e.style[n]=s;return this.marker.update(e,t.marker)}}const $n=ft({above:!0,markers(r){const{awareness:e,ytext:t}=r.state.facet(_e),n=t.doc,s=[];return e.getStates().forEach((o,i)=>{if(i===e.doc.clientID)return;const a=o.cursors;for(const l of a??[]){if(!l?.anchor||!l?.head)return;const d=ue(l.anchor,n),c=ue(l.head,n);if(d?.type!==t||c?.type!==t)return;const h=l.primary??!0?"jp-remote-cursor jp-mod-primary":"jp-remote-cursor",u=Ue.cursor(c.index,c.index>d.index?-1:1);for(const f of gt.forRange(r,h,u))s.push(new St({borderLeftColor:qe(o.user,i)},f))}}),s},update(r,e){return!!r.transactions.find(t=>t.annotation(Ie))},class:"jp-remote-cursors"});function at(r){const e=new Array,{awareness:t,ytext:n}=r.facet(_e),s=n.doc;for(const[o,i]of t.getStates())if(o!==t.doc.clientID)for(const a of i.cursors??[]){if(!a?.head)continue;const l=ue(a.head,s);l?.type===n&&e.push({pos:l.index,above:!0,create:()=>{const d=document.createElement("div");return d.classList.add("jp-remote-userInfo"),d.style.backgroundColor=qe(i.user,o),d.textContent=i.user?.display_name??"Anonymous",{dom:d}}})}return e}const zn=mt.define({create:at,update(r,e){return e.annotation(Ie)?at(e.state):r},provide(r){return Ft.computeN([r],e=>e.field(r))}}),Kn=ft({above:!1,markers(r){const{awareness:e,ytext:t}=r.state.facet(_e),n=t.doc,s=[];return e.getStates().forEach((o,i)=>{if(i===e.doc.clientID)return;const a=o.cursors;for(const l of a??[]){if((l.empty??!0)||!l?.anchor||!l?.head)return;const d=ue(l.anchor,n),c=ue(l.head,n);if(d?.type!==t||c?.type!==t)return;const h="jp-remote-selection";for(const u of gt.forRange(r,h,Ue.range(d.index,c.index)))s.push(new St({backgroundColor:qe(o.user,i)},u))}}),s},update(r,e){return!!r.transactions.find(t=>t.annotation(Ie))},class:"jp-remote-selections"}),Un=Nt.fromClass(class{editorAwareness;_listener;constructor(r){this.editorAwareness=r.state.facet(_e),this._listener=({added:e,updated:t,removed:n})=>{e.concat(t).concat(n).findIndex(o=>o!==this.editorAwareness.awareness.doc.clientID)>=0&&r.dispatch({annotations:[Ie.of([])]})},this.editorAwareness.awareness.on("change",this._listener)}destroy(){this.editorAwareness.awareness.off("change",this._listener)}update(r){if(!r.docChanged&&!r.selectionSet)return;const{awareness:e,ytext:t}=this.editorAwareness,n=e.getLocalState();if(n){const s=r.view.hasFocus&&r.view.dom.ownerDocument.hasFocus(),o=r.state.selection,i=new Array;if(s&&o){for(const a of o.ranges){const l=a===o.main,d=Qe(t,a.anchor),c=Qe(t,a.head);i.push({anchor:d,head:c,primary:l,empty:a.empty})}if(!n.cursors||i.length>0){const a=n.cursors?.map(l=>({...l,anchor:l?.anchor?et(l.anchor):null,head:l?.head?et(l.head):null}));V.deepEqual(i,a)||e.setLocalStateField("cursors",i)}}}}},{provide:()=>[Hn,$n,Kn,zn,Lt({position:"absolute",parent:document.body})]});function qn(r){return[_e.of(r),Un]}class Ne extends Wt{constructor(e={}){var t;super(),this.version="2.0.0",this.ymeta=this.ydoc.getMap("meta"),this._onMetaChanged=n=>{const s=n.find(i=>i.target===this.ymeta.get("metadata"));if(s){const i=s.changes.keys,a=this.ymeta.get("metadata");s.changes.keys.forEach((l,d)=>{switch(l.action){case"add":this._metadataChanged.emit({key:d,type:"add",newValue:a.get(d)});break;case"delete":this._metadataChanged.emit({key:d,type:"remove",oldValue:l.oldValue});break;case"update":{const c=a.get(d),h=l.oldValue;let u=!0;typeof h=="object"&&typeof c=="object"?u=V.deepEqual(h,c):u=h===c,u||this._metadataChanged.emit({key:d,type:"change",oldValue:h,newValue:c})}break}}),this._changed.emit({metadataChange:i})}const o=n.find(i=>i.target===this.ymeta);if(o){if(o.keysChanged.has("metadata")){const i=o.changes.keys.get("metadata");if(i?.action==="add"&&!i.oldValue){const a=new Map;for(const l of Object.keys(this.metadata))a.set(l,{action:"add",oldValue:void 0}),this._metadataChanged.emit({key:l,type:"add",newValue:this.getMetadata(l)});this._changed.emit({metadataChange:a})}}if(o.keysChanged.has("nbformat")){const i=o.changes.keys.get("nbformat"),a={key:"nbformat",oldValue:i?.oldValue?i.oldValue:void 0,newValue:this.nbformat};this._changed.emit({nbformatChanged:a})}if(o.keysChanged.has("nbformat_minor")){const i=o.changes.keys.get("nbformat_minor"),a={key:"nbformat_minor",oldValue:i?.oldValue?i.oldValue:void 0,newValue:this.nbformat_minor};this._changed.emit({nbformatChanged:a})}}},this._onYCellsChanged=n=>{n.changes.added.forEach(i=>{const a=i.content.type;if(!this._ycellMapping.has(a)){const l=tt(a,{notebook:this});this._ycellMapping.set(a,l)}}),n.changes.deleted.forEach(i=>{const a=i.content.type,l=this._ycellMapping.get(a);l&&(l.dispose(),this._ycellMapping.delete(a))});let s=0;const o=[];n.changes.delta.forEach(i=>{if(i.insert!=null){const a=i.insert.map(l=>this._ycellMapping.get(l));o.push({insert:a}),this.cells.splice(s,0,...a),s+=i.insert.length}else i.delete!=null?(o.push(i),this.cells.splice(s,i.delete)):i.retain!=null&&(o.push(i),s+=i.retain)}),this._changed.emit({cellsChange:o})},this._metadataChanged=new N(this),this._ycells=this.ydoc.getArray("cells"),this._ycellMapping=new WeakMap,this._disableDocumentWideUndoRedo=(t=e.disableDocumentWideUndoRedo)!==null&&t!==void 0?t:!1,this.cells=this._ycells.toArray().map(n=>(this._ycellMapping.has(n)||this._ycellMapping.set(n,tt(n,{notebook:this})),this._ycellMapping.get(n))),this.undoManager.addToScope(this._ycells),this._ycells.observe(this._onYCellsChanged),this.ymeta.observeDeep(this._onMetaChanged)}static create(e={}){var t,n,s,o,i,a,l,d,c;const h=new Ne({disableDocumentWideUndoRedo:(t=e.disableDocumentWideUndoRedo)!==null&&t!==void 0?t:!1}),u={cells:(s=(n=e.data)===null||n===void 0?void 0:n.cells)!==null&&s!==void 0?s:[],nbformat:(i=(o=e.data)===null||o===void 0?void 0:o.nbformat)!==null&&i!==void 0?i:4,nbformat_minor:(l=(a=e.data)===null||a===void 0?void 0:a.nbformat_minor)!==null&&l!==void 0?l:5,metadata:(c=(d=e.data)===null||d===void 0?void 0:d.metadata)!==null&&c!==void 0?c:{}};return h.setSource(u),h}get disableDocumentWideUndoRedo(){return this._disableDocumentWideUndoRedo}get metadata(){return this.getMetadata()}set metadata(e){this.setMetadata(e)}get metadataChanged(){return this._metadataChanged}get nbformat(){return this.ymeta.get("nbformat")}set nbformat(e){this.transact(()=>{this.ymeta.set("nbformat",e)},!1)}get nbformat_minor(){return this.ymeta.get("nbformat_minor")}set nbformat_minor(e){this.transact(()=>{this.ymeta.set("nbformat_minor",e)},!1)}dispose(){this.isDisposed||(this._ycells.unobserve(this._onYCellsChanged),this.ymeta.unobserveDeep(this._onMetaChanged),super.dispose())}getCell(e){return this.cells[e]}addCell(e){return this.insertCell(this._ycells.length,e)}insertCell(e,t){return this.insertCells(e,[t])[0]}insertCells(e,t){const n=t.map(s=>{const o=nt(s,this);return this._ycellMapping.set(o.ymodel,o),o});return this.transact(()=>{this._ycells.insert(e,n.map(s=>s.ymodel))}),this.dirty=!0,n}moveCell(e,t){this.moveCells(e,t)}moveCells(e,t,n=1){const s=new Array(n).fill(!0).map((o,i)=>this.getCell(e+i).toJSON());this.transact(()=>{this._ycells.delete(e,n),this._ycells.insert(e>t?t:t-n+1,s.map(o=>nt(o,this).ymodel))}),this.dirty=!0}deleteCell(e){this.deleteCellRange(e,e+1)}deleteCellRange(e,t){this.transact(()=>{this._ycells.delete(e,t-e)}),this.dirty=!0}deleteMetadata(e){if(typeof this.getMetadata(e)>"u")return;const t=this.metadata;delete t[e],this.setMetadata(t)}getMetadata(e){const t=this.ymeta.get("metadata");if(t!==void 0)if(typeof e=="string"){const n=t.get(e);return typeof n>"u"?void 0:V.deepCopy(n)}else return V.deepCopy(t.toJSON())}setMetadata(e,t){var n;if(typeof e=="string"){if(typeof t>"u")throw new TypeError(`Metadata value for ${e} cannot be 'undefined'; use deleteMetadata.`);if(V.deepEqual((n=this.getMetadata(e))!==null&&n!==void 0?n:null,t))return;const s={};s[e]=t,this.updateMetadata(s)}else if(!this.metadata||!V.deepEqual(this.metadata,e)){const s=V.deepCopy(e),o=this.ymeta.get("metadata");if(o===void 0)return;this.transact(()=>{o.clear();for(const[i,a]of Object.entries(s))o.set(i,a)}),this.dirty=!0}}updateMetadata(e){const t=V.deepCopy(e),n=this.ymeta.get("metadata");n!==void 0&&(this.transact(()=>{for(const[s,o]of Object.entries(t))n.set(s,o)}),this.dirty=!0)}getSource(){return this.toJSON()}setSource(e){this.fromJSON(e),this.dirty=!1}fromJSON(e){this.transact(()=>{this.nbformat=e.nbformat,this.nbformat_minor=e.nbformat_minor;const t=e.metadata;if(t.orig_nbformat!==void 0&&delete t.orig_nbformat,this.metadata)this.metadata=t;else{const o=new fe;for(const[i,a]of Object.entries(t))o.set(i,a);this.ymeta.set("metadata",o)}const n=e.nbformat===4&&e.nbformat_minor>=5,s=e.cells.map(o=>(n||delete o.id,o));this.insertCells(this.cells.length,s),this.deleteCellRange(0,this.cells.length)})}toJSON(){const e=this.nbformat===4&&this.nbformat_minor<=4;return He({metadata:this.metadata,nbformat_minor:this.nbformat_minor,nbformat:this.nbformat,cells:this.cells.map(t=>{const n=t.toJSON();return e&&delete n.id,n})})}}function He(r){if(Array.isArray(r))return r.map(e=>He(e));if(r!==null&&typeof r=="object"){const e={},t=Object.entries(r).sort(([n],[s])=>n<s?-1:n>s?1:0);for(const[n,s]of t)Object.defineProperty(e,n,{value:He(s),enumerable:!0,writable:!0,configurable:!0});return e}return r}class Jn{constructor(e){this.model=e,this._cellMap=new WeakMap,this._changed=new N(this),this._isDisposed=!1,this._insertCells(0,this.model.cells),this.model.changed.connect(this._onSharedModelChanged,this)}get changed(){return this._changed}get isDisposed(){return this._isDisposed}get length(){return this.model.cells.length}*[Symbol.iterator](){for(const e of this.model.cells)yield this._cellMap.get(e)}dispose(){var e;if(!this._isDisposed){this._isDisposed=!0;for(const t of this.model.cells)(e=this._cellMap.get(t))===null||e===void 0||e.dispose();N.clearData(this)}}get(e){return this._cellMap.get(this.model.cells[e])}_insertCells(e,t){return t.forEach(n=>{let s;switch(n.cell_type){case"code":{s=new Ht({sharedModel:n});break}case"markdown":{s=new Gt({sharedModel:n});break}default:s=new Vt({sharedModel:n})}this._cellMap.set(n,s),n.disposed.connect(()=>{s.dispose(),this._cellMap.delete(n)})}),this.length}_onSharedModelChanged(e,t){var n;let s=0;const o=new Array;(n=t.cellsChange)===null||n===void 0||n.forEach(i=>{i.insert!=null?(this._insertCells(s,i.insert),o.push({type:"add",newIndex:s,newValues:i.insert.map(a=>this._cellMap.get(a)),oldIndex:-2,oldValues:[]}),s+=i.insert.length):i.delete!=null?o.push({type:"remove",newIndex:-1,newValues:[],oldIndex:s,oldValues:new Array(i.delete).fill(void 0)}):i.retain!=null&&(s+=i.retain)}),o.forEach(i=>this._changed.emit(i))}}class Yn{constructor(e){this._requestBatchSize=10,this._cursor=0,this._hasSession=!1,this._history=[],this._placeholder="",this._kernelSession="",this._setByHistory=!1,this._isDisposed=!1,this._editor=null,this._filtered=[],this._kernel=null,this._sessionContext=e.sessionContext,this._trans=(e.translator||pe).load("jupyterlab"),this._toRequest=this._requestBatchSize,this._handleKernel().then(()=>{this._sessionContext.kernelChanged.connect(this._handleKernel,this)})}get editor(){return this._editor}set editor(e){if(this._editor===e)return;const t=this._editor;t&&t.model.sharedModel.changed.disconnect(this.onTextChange,this),this._editor=e,e&&e.model.sharedModel.changed.connect(this.onTextChange,this)}get placeholder(){return this._placeholder}get kernelSession(){return this._kernelSession}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed=!0,this._history.length=0,N.clearData(this)}async checkSession(e){var t;this._hasSession||(await this._retrieveHistory(),this._hasSession=!0,this.editor=e.editor,this._placeholder=((t=this._editor)===null||t===void 0?void 0:t.model.sharedModel.getSource())||"",this.setFilter(this._placeholder),this._cursor=this._filtered.length-1)}async back(e){return await this.checkSession(e),--this._cursor,this._cursor<0&&await this.fetchBatch(),this._cursor=Math.max(0,this._cursor),this._filtered[this._cursor]}async forward(e){return await this.checkSession(e),++this._cursor,this._cursor=Math.min(this._filtered.length-1,this._cursor),this._filtered[this._cursor]}updateEditor(e,t){var n,s;if(e){const o=(n=e.editor)===null||n===void 0?void 0:n.model,i=o?.sharedModel.getSource();if(this.isDisposed||!t||i===t)return;this._setByHistory=!0,o?.sharedModel.setSource(t);let a=0;a=t.indexOf(`
|
|
2
2
|
`),a<0&&(a=t.length),(s=e.editor)===null||s===void 0||s.setCursorPosition({line:0,column:a})}}reset(){this._hasSession=!1,this._placeholder="",this._toRequest=this._requestBatchSize}async fetchBatch(){this._toRequest+=this._requestBatchSize;let e=this._filtered.slice().reverse(),t=this._history.slice();await this._retrieveHistory().then(()=>{this.setFilter(this._placeholder);let n=0,s=this._filtered.slice().reverse();for(let o=0;o<e.length;o++){let i=e[o];for(let a=o+n;a<s.length&&i!==s[a];a++)n+=1}this._cursor=this._filtered.length-(e.length+1)-n}),this._cursor<0&&this._history.length>t.length&&await this.fetchBatch()}onHistory(e,t){this._history.length=0;let n=["","",""],s=["","",""],o="";if(e.content.status==="ok"){for(let i=0;i<e.content.history.length;i++)s=e.content.history[i],s!==n&&(o=e.content.history[i][0],this._history.push(n=s));this.kernelSession||s[2]==t?.model.sharedModel.getSource()&&(this._kernelSession=o)}}onTextChange(){if(this._setByHistory){this._setByHistory=!1;return}this.reset()}async _handleKernel(){var e;if(this._kernel=(e=this._sessionContext.session)===null||e===void 0?void 0:e.kernel,!this._kernel){this._history.length=0;return}await this._retrieveHistory().catch()}async _retrieveHistory(e){var t;return await((t=this._kernel)===null||t===void 0?void 0:t.requestHistory(Xn(this._toRequest)).then(n=>{this.onHistory(n,e)}).catch(()=>{console.warn(this._trans.__("History was unable to be retrieved"))}))}setFilter(e=""){this._filtered.length=0;let t="",n="";for(let s=0;s<this._history.length;s++)n=this._history[s][2],n!==t&&e!==n&&this._filtered.push(t=n);this._filtered.push(e)}}function Xn(r){return{output:!1,raw:!0,hist_access_type:"tail",n:r}}class $e{constructor(e={}){var t,n;this.standaloneModel=!1,this._readOnly=!1,this._contentChanged=new N(this),this._stateChanged=new N(this),this._isDisposed=!1,this._metadataChanged=new N(this),this.standaloneModel=typeof e.sharedModel>"u",e.sharedModel?this.sharedModel=e.sharedModel:this.sharedModel=Ne.create({disableDocumentWideUndoRedo:(t=e.disableDocumentWideUndoRedo)!==null&&t!==void 0?t:!0,data:{nbformat:st,nbformat_minor:Le,metadata:{kernelspec:{name:"",display_name:""},language_info:{name:(n=e.languagePreference)!==null&&n!==void 0?n:""}}}}),this._cells=new Jn(this.sharedModel),this._trans=(e.translator||pe).load("jupyterlab"),this._deletedCells=[],this._collaborationEnabled=!!e?.collaborationEnabled,this._cells.changed.connect(this._onCellsChanged,this),this.sharedModel.changed.connect(this._onStateChanged,this),this.sharedModel.metadataChanged.connect(this._onMetadataChanged,this)}get contentChanged(){return this._contentChanged}get metadataChanged(){return this._metadataChanged}get stateChanged(){return this._stateChanged}get cells(){return this._cells}get dirty(){return this.sharedModel.dirty}set dirty(e){const t=this.dirty;e!==t&&(this.sharedModel.dirty=e)}get readOnly(){return this._readOnly}set readOnly(e){if(e===this._readOnly)return;const t=this._readOnly;this._readOnly=e,this.triggerStateChange({name:"readOnly",oldValue:t,newValue:e})}get metadata(){return this.sharedModel.metadata}get nbformat(){return this.sharedModel.nbformat}get nbformatMinor(){return this.sharedModel.nbformat_minor}get defaultKernelName(){var e;const t=this.getMetadata("kernelspec");return(e=t?.name)!==null&&e!==void 0?e:""}get deletedCells(){return this._deletedCells}get defaultKernelLanguage(){var e;const t=this.getMetadata("language_info");return(e=t?.name)!==null&&e!==void 0?e:""}get collaborative(){return this._collaborationEnabled}dispose(){if(this.isDisposed)return;this._isDisposed=!0;const e=this.cells;this._cells=null,e.dispose(),this.standaloneModel&&this.sharedModel.dispose(),N.clearData(this)}deleteMetadata(e){return this.sharedModel.deleteMetadata(e)}getMetadata(e){return this.sharedModel.getMetadata(e)}setMetadata(e,t){typeof t>"u"?this.sharedModel.deleteMetadata(e):this.sharedModel.setMetadata(e,t)}toString(){return JSON.stringify(this.toJSON())}fromString(e){this.fromJSON(JSON.parse(e))}toJSON(){return this._ensureMetadata(),this.sharedModel.toJSON()}fromJSON(e){var t,n;const s=V.deepCopy(e),o=e.metadata.orig_nbformat;if(s.nbformat=Math.max(e.nbformat,st),(s.nbformat!==e.nbformat||s.nbformat_minor<Le)&&(s.nbformat_minor=Le),o!==void 0&&s.nbformat!==o){const i=s.nbformat>o;let a;i?a=this._trans.__(`This notebook has been converted from an older notebook format (v%1)
|
|
3
3
|
to the current notebook format (v%2).
|
|
4
4
|
The next time you save this notebook, the current notebook format (v%2) will be used.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ab as t,r as i}from"../datalayer-app-main.js";import{I as p,r as e}from"./JupyterLexicalExtension-
|
|
1
|
+
import{ab as t,r as i}from"../datalayer-app-main.js";import{I as p,r as e}from"./JupyterLexicalExtension-Dr8dgCst.js";import{$ as R,a as h,b as j,c as k,d as q,e as v,C as w,f as y,g as z}from"./JupyterLexicalExtension-Dr8dgCst.js";import"./NotebookSkeleton-GSdyJDf_.js";import"./Avatar-DUPBQXVt.js";import"./url-DY3jeuF8.js";import"./isSymbol-BLtK9CV6.js";import"./toNumber-B1wj8-wx.js";import"./StrikethroughIcon-CbiEuPT-.js";import"./VideoIcon-C3wcjUxu.js";import"./ArrowUpIcon-y5enrVH9.js";import"./SortDescIcon-Qif6E10I.js";import"./PaintbrushIcon-CFBHU-3l.js";import"./PrismCss-c7kvMU60.js";import"./Output-Do1CYRIF.js";import"./index-i9IsP_xD.js";import"./hoverbox-CStlKQWE.js";import"./index--Rl4aMiU.js";import"./index-DrrVr0x3.js";import"./dayjs.min-u3zuoSR8.js";import"./isEqual-DXPB_0fo.js";import"./d3-color-Jd8hXty2.js";import"./dist-Frc5TvpU.js";import"./index-BaRoLDk0.js";import"./RestartIcon-DvpOf5Mf.js";import"./LexicalToolRegistry-rXaW8uXA.js";function _(){const[o]=t();return i.useEffect(()=>e(o),[o]),null}export{R as $createCollapsibleContainerNode,h as $createCollapsibleContentNode,j as $createCollapsibleTitleNode,k as $isCollapsibleContainerNode,q as $isCollapsibleContentNode,v as $isCollapsibleTitleNode,w as CollapsibleContainerNode,y as CollapsibleContentNode,_ as CollapsiblePlugin,z as CollapsibleTitleNode,p as INSERT_COLLAPSIBLE_COMMAND,_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as x,j as e,B as n,T as s,a0 as i}from"../datalayer-app-main.js";import j from"./esm
|
|
1
|
+
import{r as x,j as e,B as n,T as s,a0 as i}from"../datalayer-app-main.js";import j from"./esm-VjpQWsU9.js";import"./core-BrYTRvTy.js";function F({agentUsage:o,padding:y,showContextRing:T=!1}){const[k,h]=x.useState(!1),v=x.useRef(null),c=x.useRef(null),g=!!o.turnUsage,C=!!o.sessionUsage,w=!!o.costUsage&&(o.costUsage.cumulativeCostUsd>0||o.costUsage.lastTurnCostUsd>0),m=o.sessionUsage,p=o.turnUsage,b=o.costUsage,d=t=>t<.01?`$${t.toFixed(4)}`:t<1?`$${t.toFixed(3)}`:`$${t.toFixed(2)}`,f=o.totalTokens,u=o.contextWindow,S=Math.max(0,u-f),a=u>0?f/u*100:0,r=[];if(o.distribution?.children?.length){const t={"System Prompts":"#8250df","Tool Definitions":"#bf8700","User Messages":"#16A085","Assistant Messages":"#1a7f37","Tool Usage":"#cf222e"};for(const l of o.distribution.children)r.push({name:l.name,value:l.value,color:t[l.name]||"#6e7781"})}else{o.systemPromptTokens>0&&r.push({name:"System Prompts",value:o.systemPromptTokens,color:"#8250df"}),o.toolTokens>0&&r.push({name:"Tool Definitions",value:o.toolTokens,color:"#bf8700"});const t=(o.userMessageTokens||0)+(o.assistantMessageTokens||0);t>0&&r.push({name:"Messages",value:t,color:"#16A085"});const l=(o.toolCallTokens||0)+(o.toolReturnTokens||0);l>0&&r.push({name:"Tool Results",value:l,color:"#cf222e"})}const z=a>90?"#cf222e":a>70?"#bf8700":"#16A085",W="var(--bgColor-muted, #f6f8fa)",R="var(--borderColor-default, #d1d9e0)",M={animation:!1,series:[{type:"pie",radius:[0,"90%"],center:["50%","50%"],silent:!0,label:{show:!1},labelLine:{show:!1},data:[{value:f,itemStyle:{color:z}},{value:S,itemStyle:{color:W}}]}]},P={animation:!1,series:[{type:"pie",radius:["45%","80%"],center:["50%","50%"],silent:!0,label:{show:!1},labelLine:{show:!1},itemStyle:{borderColor:"var(--bgColor-default, #ffffff)",borderWidth:1},data:[...r.map(t=>({value:t.value,itemStyle:{color:t.color}})),{value:S,itemStyle:{color:R}}]}]};return e.jsxs(n,{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2,py:1,px:y,bg:"canvas.subtle",flexWrap:"nowrap",overflow:"visible",whiteSpace:"nowrap",minWidth:0,children:[T&&e.jsxs(n,{position:"relative",flexShrink:0,onMouseEnter:()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>h(!0),150)},onMouseLeave:()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>h(!1),250)},children:[e.jsx(n,{ref:v,cursor:"pointer",width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid",borderColor:"border.default",borderRadius:"50%",children:e.jsx(j,{option:M,style:{width:18,height:18},opts:{renderer:"svg"}})}),k&&e.jsxs(n,{position:"absolute",bottom:"100%",left:0,mb:1,p:3,width:260,bg:"canvas.overlay",borderRadius:2,boxShadow:"shadow.large",border:"1px solid",borderColor:"border.default",zIndex:100,children:[e.jsx(s,{sx:{fontWeight:"bold",fontSize:1,color:"fg.default",display:"block",mb:2},children:"Context"}),e.jsxs(s,{sx:{fontSize:0,color:"fg.muted",display:"block",mb:1},children:[e.jsx(s,{as:"span",sx:{fontWeight:"semibold",color:"fg.default"},children:i(f)})," / ",i(u)," tokens"]}),o.costUsage&&e.jsxs(s,{sx:{fontSize:0,color:"fg.muted",display:"block",mb:2},children:["cost ",e.jsx(s,{as:"span",sx:{fontWeight:"semibold",color:"fg.default"},children:d(o.costUsage.lastTurnCostUsd)})," turn · ",e.jsx(s,{as:"span",sx:{fontWeight:"semibold",color:"fg.default"},children:d(o.costUsage.cumulativeCostUsd)})," total"]}),e.jsxs(s,{sx:{fontSize:0,color:a>90?"danger.fg":a>70?"attention.fg":"fg.muted",fontWeight:"semibold",display:"block",mb:2},children:["• ",a.toFixed(0),"%"]}),e.jsx(n,{display:"flex",justifyContent:"center",mb:2,children:e.jsx(j,{option:P,style:{width:80,height:80},opts:{renderer:"svg"}})}),e.jsx(n,{display:"flex",flexDirection:"column",gap:1,children:r.map(t=>{const l=f>0?t.value/f*100:0;return e.jsxs(n,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(n,{width:8,height:8,borderRadius:"50%",bg:t.color,flexShrink:0}),e.jsx(s,{sx:{fontSize:0,color:"fg.muted",flex:1},children:t.name}),e.jsxs(s,{sx:{fontSize:0,color:"fg.default",fontWeight:"semibold"},children:[l.toFixed(1),"%"]})]},t.name)})}),a>70&&e.jsx(s,{sx:{fontSize:0,color:"attention.fg",display:"block",mt:2,fontStyle:"italic"},children:"Quality may decline as limit nears."})]})]}),e.jsxs(s,{sx:{fontSize:0,color:"fg.muted",flexShrink:0},children:[e.jsx(s,{as:"span",sx:{fontWeight:"semibold",color:"fg.default",fontSize:0},children:i(o.totalTokens)})," / ",i(o.contextWindow)," ctx"]}),w&&e.jsxs(s,{sx:{fontSize:0,color:"fg.muted",flexShrink:0},children:["· cost ",e.jsx(s,{as:"span",sx:{fontWeight:"semibold",color:"fg.default",fontSize:0},children:d(b?.lastTurnCostUsd??0)})," turn / ",e.jsx(s,{as:"span",sx:{fontWeight:"semibold",color:"fg.default",fontSize:0},children:d(b?.cumulativeCostUsd??0)})]}),C&&e.jsxs(s,{sx:{fontSize:0,color:"fg.muted",flexShrink:0},children:["· session ",i(m?.inputTokens??0),e.jsx(s,{as:"span",sx:{color:"success.fg",fontSize:0},children:"▲"})," ",i(m?.outputTokens??0),e.jsx(s,{as:"span",sx:{color:"attention.fg",fontSize:0},children:"▼"})]}),g&&e.jsxs(s,{sx:{fontSize:0,color:"fg.muted",flexShrink:0},children:["· turn ",i(p?.inputTokens??0),e.jsx(s,{as:"span",sx:{color:"success.fg",fontSize:0},children:"▲"})," ",i(p?.outputTokens??0),e.jsx(s,{as:"span",sx:{color:"attention.fg",fontSize:0},children:"▼"})]})]})}export{F as ContextPie};
|