@lunora/studio 1.0.0-alpha.361 → 1.0.0-alpha.363
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/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.mjs +1 -1
- package/dist/mount.mjs +1 -1
- package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -1
- package/dist/packem_chunks/ApiTab.mjs +1 -1
- package/dist/packem_chunks/AuditPanel.mjs +1 -1
- package/dist/packem_chunks/ExportImportPanel.mjs +1 -1
- package/dist/packem_chunks/FileBrowser.mjs +1 -1
- package/dist/packem_chunks/FunctionRunner.mjs +1 -1
- package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -1
- package/dist/packem_chunks/HealthPanel.mjs +1 -1
- package/dist/packem_chunks/InsightsPanel.mjs +1 -1
- package/dist/packem_chunks/LogsPanel.mjs +1 -1
- package/dist/packem_chunks/MailPanel.mjs +1 -1
- package/dist/packem_chunks/MetricsPanel.mjs +1 -1
- package/dist/packem_chunks/NotificationsPanel.mjs +1 -1
- package/dist/packem_chunks/PitrPanel.mjs +1 -1
- package/dist/packem_chunks/SchemaViewer.mjs +1 -1
- package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -1
- package/dist/packem_chunks/SettingsPanel.mjs +1 -1
- package/dist/packem_chunks/SqlEditorPanel.mjs +24 -9
- package/dist/packem_chunks/TableEditor.mjs +1 -1
- package/dist/packem_chunks/agents-panel.mjs +1 -1
- package/dist/packem_chunks/ai-knowledge.mjs +1 -0
- package/dist/packem_chunks/ai-usage-panel.mjs +1 -1
- package/dist/packem_chunks/assistant-panel.mjs +3 -0
- package/dist/packem_chunks/auth-audit-panel.mjs +1 -1
- package/dist/packem_chunks/containers-panel.mjs +1 -1
- package/dist/packem_chunks/dashboards-panel.mjs +1 -1
- package/dist/packem_chunks/evals-panel.mjs +1 -1
- package/dist/packem_chunks/fanout-panel.mjs +1 -1
- package/dist/packem_chunks/flags-panel.mjs +1 -1
- package/dist/packem_chunks/issues-panel.mjs +1 -1
- package/dist/packem_chunks/kv-browser.mjs +1 -1
- package/dist/packem_chunks/log-drains-panel.mjs +1 -1
- package/dist/packem_chunks/migrations-route.mjs +1 -1
- package/dist/packem_chunks/payments-panel.mjs +1 -1
- package/dist/packem_chunks/permissions-panel.mjs +1 -1
- package/dist/packem_chunks/privacy-requests-panel.mjs +1 -1
- package/dist/packem_chunks/queues-panel.mjs +1 -1
- package/dist/packem_chunks/reactors-panel.mjs +1 -1
- package/dist/packem_chunks/rls-panel.mjs +1 -1
- package/dist/packem_chunks/schedule-panel.mjs +1 -1
- package/dist/packem_chunks/storage-rules-panel.mjs +1 -1
- package/dist/packem_chunks/subscriptions-panel.mjs +1 -1
- package/dist/packem_chunks/traces-panel.mjs +1 -1
- package/dist/packem_chunks/workflows-panel.mjs +1 -1
- package/dist/packem_shared/ADMIN_FUNCTIONS-DUXsXId1.mjs +1 -0
- package/dist/packem_shared/{ApiDocsPanel-DD2Uns6b.mjs → ApiDocsPanel-B9S9l1Ce.mjs} +1 -1
- package/dist/packem_shared/{DataBrowser-CVRWnNWu.mjs → DataBrowser-Dm-jhIUP.mjs} +2 -2
- package/dist/packem_shared/{GlobalDataBrowser-DC47T6Zl.mjs → GlobalDataBrowser-C1Y8GUhe.mjs} +1 -1
- package/dist/packem_shared/{HomePanel-D12HxHQo.mjs → HomePanel-B5ytwPIo.mjs} +1 -1
- package/dist/packem_shared/{MigrationsPanel-DMkxSXNl.mjs → MigrationsPanel-CwLikxDT.mjs} +1 -1
- package/dist/packem_shared/Studio-B89ZNMOD.mjs +1 -0
- package/dist/packem_shared/{StudioApp-isdWpF9P.mjs → StudioApp-C9l1a3A8.mjs} +1 -1
- package/dist/packem_shared/advisor-view-CzieqKMe.mjs +5 -0
- package/dist/packem_shared/assistant-provider-Bp72uWsq.mjs +1 -0
- package/dist/packem_shared/assistant-reason-D6EwMCxT.mjs +1 -0
- package/dist/packem_shared/{cf-links-CBJ5SywP.mjs → cf-links-C4DVTr8A.mjs} +1 -1
- package/dist/packem_shared/error-alert-DKXm5h19.mjs +6 -0
- package/dist/packem_shared/{home-panel-CDVTuTF8.mjs → home-panel-5fGktYeD.mjs} +1 -1
- package/dist/packem_shared/recording-client-z4CBi0y8.mjs +1 -0
- package/dist/packem_shared/studio-gZfpz1wC.mjs +2 -0
- package/dist/packem_shared/{table-list-sidebar-CNadcIgG.mjs → table-list-sidebar-kpHaDWjy.mjs} +1 -1
- package/dist/packem_shared/use-assistant-rpc-GCUK2zPa.mjs +1 -0
- package/dist/standalone/chunk-2DT3QG6Q.js +1 -0
- package/dist/standalone/chunk-2EB7FN5S.js +1 -0
- package/dist/standalone/chunk-2H6VLY2M.js +1 -0
- package/dist/standalone/chunk-2NGKUO32.js +1 -0
- package/dist/standalone/chunk-2SNHKJXK.js +1 -0
- package/dist/standalone/chunk-2W4UO5BC.js +1 -0
- package/dist/standalone/chunk-32V7XGNC.js +1 -0
- package/dist/standalone/{chunk-SLIDAWNX.js → chunk-3D67ZJRW.js} +1 -1
- package/dist/standalone/chunk-3X3NXJBR.js +1 -0
- package/dist/standalone/chunk-4EPW63HS.js +1 -0
- package/dist/standalone/chunk-4L55URI5.js +2 -0
- package/dist/standalone/chunk-4N76XUNG.js +1 -0
- package/dist/standalone/{chunk-WS36BO4R.js → chunk-4NKJV7YX.js} +1 -1
- package/dist/standalone/chunk-4PI2OSSP.js +1 -0
- package/dist/standalone/chunk-53XKGQEE.js +1 -0
- package/dist/standalone/chunk-5GYHGDIF.js +8 -0
- package/dist/standalone/chunk-5PEAXTYQ.js +1 -0
- package/dist/standalone/chunk-5QUTVSHM.js +1 -0
- package/dist/standalone/{chunk-BYOGQ2IV.js → chunk-5RX5CQSU.js} +2 -2
- package/dist/standalone/{chunk-O2NMPIV2.js → chunk-5WNGRT7N.js} +1 -1
- package/dist/standalone/chunk-5Z2U4KBN.js +1 -0
- package/dist/standalone/chunk-66BMMNUR.js +1 -0
- package/dist/standalone/chunk-6FPV3EK2.js +1 -0
- package/dist/standalone/chunk-6G3E4PJ2.js +1 -0
- package/dist/standalone/chunk-75TRPM7O.js +1 -0
- package/dist/standalone/chunk-7MLX5CGD.js +1 -0
- package/dist/standalone/chunk-7QEZ2SFW.js +1 -0
- package/dist/standalone/chunk-7TQ7BZ67.js +1 -0
- package/dist/standalone/chunk-A2Q3TGIQ.js +1 -0
- package/dist/standalone/chunk-AD5J2ANS.js +1 -0
- package/dist/standalone/chunk-ALR4VAUE.js +1 -0
- package/dist/standalone/chunk-AXE2SDRU.js +1 -0
- package/dist/standalone/chunk-AZIKM5BA.js +1 -0
- package/dist/standalone/chunk-BAEIW3YS.js +1 -0
- package/dist/standalone/chunk-BBDTJG2K.js +1 -0
- package/dist/standalone/chunk-BCUOQNI2.js +1 -0
- package/dist/standalone/chunk-BG2CJOVS.js +1 -0
- package/dist/standalone/chunk-BI6MZHZJ.js +1 -0
- package/dist/standalone/chunk-BKI3JMXQ.js +1 -0
- package/dist/standalone/chunk-CKEQX655.js +1 -0
- package/dist/standalone/{chunk-DX55P3KZ.js → chunk-CL3JOU6F.js} +1 -1
- package/dist/standalone/chunk-CP7QNLR4.js +1 -0
- package/dist/standalone/chunk-CVSIFPI5.js +1 -0
- package/dist/standalone/chunk-D57B4MFK.js +1 -0
- package/dist/standalone/chunk-D65UVZIA.js +1 -0
- package/dist/standalone/{chunk-DBVJ5VLI.js → chunk-DA2CAFXI.js} +1 -1
- package/dist/standalone/chunk-DB6QX4X6.js +1 -0
- package/dist/standalone/chunk-DZFXH55R.js +1 -0
- package/dist/standalone/chunk-ELSQ4FVH.js +1 -0
- package/dist/standalone/chunk-EPWCW2DF.js +1 -0
- package/dist/standalone/chunk-FHLODLBC.js +1 -0
- package/dist/standalone/chunk-FJLRSFTE.js +1 -0
- package/dist/standalone/{chunk-3FS22LNI.js → chunk-FVCBNFQW.js} +3 -3
- package/dist/standalone/{chunk-VEWQWS3J.js → chunk-FWM5Z6CH.js} +1 -1
- package/dist/standalone/chunk-GJXCPZDN.js +1 -0
- package/dist/standalone/chunk-GNI37YCV.js +33 -0
- package/dist/standalone/chunk-GVQPNM3T.js +3 -0
- package/dist/standalone/chunk-GWNGVKLG.js +1 -0
- package/dist/standalone/chunk-GXTSE66Z.js +1 -0
- package/dist/standalone/chunk-H3EIPYRZ.js +1 -0
- package/dist/standalone/chunk-H5TMLWIS.js +1 -0
- package/dist/standalone/{chunk-XIRKBJPD.js → chunk-HBG6SSE2.js} +5 -5
- package/dist/standalone/chunk-HC2B7SXW.js +1 -0
- package/dist/standalone/chunk-HCOF7HOM.js +1 -0
- package/dist/standalone/chunk-HGCOTYPV.js +1 -0
- package/dist/standalone/chunk-HLHMHCXS.js +1 -0
- package/dist/standalone/chunk-HSF2DCJ2.js +30 -0
- package/dist/standalone/chunk-HZDLUAWS.js +1 -0
- package/dist/standalone/{chunk-3PAYDWHN.js → chunk-I3SSF2T6.js} +2 -2
- package/dist/standalone/chunk-I5QX75DE.js +1 -0
- package/dist/standalone/chunk-ICHZ2IBL.js +1 -0
- package/dist/standalone/{chunk-7ZIYHKLX.js → chunk-IG5VD7R7.js} +3 -3
- package/dist/standalone/{chunk-SU5DTRGK.js → chunk-IHGRWY3Y.js} +1 -1
- package/dist/standalone/chunk-J45HAKBU.js +1 -0
- package/dist/standalone/chunk-J4PQAVOF.js +1 -0
- package/dist/standalone/chunk-JD6PRRFO.js +1 -0
- package/dist/standalone/chunk-JOPNP4EO.js +1 -0
- package/dist/standalone/chunk-JVP3TR3A.js +1 -0
- package/dist/standalone/chunk-KGLIQIZU.js +1 -0
- package/dist/standalone/{chunk-ONWGX5Y4.js → chunk-KH6OXCG3.js} +1 -1
- package/dist/standalone/chunk-KKMQUBYH.js +1 -0
- package/dist/standalone/chunk-L2FYX4FN.js +1 -0
- package/dist/standalone/chunk-LDHJRHPZ.js +1 -0
- package/dist/standalone/chunk-LSEUUZN4.js +1 -0
- package/dist/standalone/chunk-MNYDT3RH.js +1 -0
- package/dist/standalone/chunk-MT4ICMXJ.js +1 -0
- package/dist/standalone/chunk-MXJTD2OX.js +1 -0
- package/dist/standalone/chunk-NGZNXNRD.js +1 -0
- package/dist/standalone/chunk-O3AZ7JKE.js +1 -0
- package/dist/standalone/chunk-OK2QU2EV.js +1 -0
- package/dist/standalone/{chunk-IH2CJZF2.js → chunk-ONTGYVAN.js} +1 -1
- package/dist/standalone/chunk-OWRKSQPE.js +1 -0
- package/dist/standalone/chunk-OZAOWE7T.js +1 -0
- package/dist/standalone/chunk-P5EVJEGC.js +1 -0
- package/dist/standalone/chunk-PDBW6GTJ.js +1 -0
- package/dist/standalone/chunk-PJUVJTDR.js +1 -0
- package/dist/standalone/chunk-Q3IA6HPX.js +1 -0
- package/dist/standalone/chunk-QAOZXPLU.js +1 -0
- package/dist/standalone/chunk-QKUVJIRX.js +1 -0
- package/dist/standalone/chunk-QNM2J7MG.js +1 -0
- package/dist/standalone/chunk-QRA7AKYO.js +1 -0
- package/dist/standalone/chunk-RBIVXSXT.js +1 -0
- package/dist/standalone/chunk-RCXNYW7P.js +1 -0
- package/dist/standalone/{chunk-TDVDZ7XQ.js → chunk-RIAOZECW.js} +1 -1
- package/dist/standalone/{chunk-LUHXNZI4.js → chunk-RTS5G3ET.js} +1 -1
- package/dist/standalone/chunk-S36FVTKK.js +1 -0
- package/dist/standalone/chunk-SDDEOSQB.js +1 -0
- package/dist/standalone/chunk-SHHGIT7M.js +7 -0
- package/dist/standalone/chunk-SR6CPTRT.js +1 -0
- package/dist/standalone/chunk-SVQWZPO4.js +1 -0
- package/dist/standalone/chunk-T3ZCW3RG.js +1 -0
- package/dist/standalone/chunk-TEMI7MVE.js +1 -0
- package/dist/standalone/chunk-TKBTZX4K.js +1 -0
- package/dist/standalone/chunk-TW4O2BA5.js +159 -0
- package/dist/standalone/chunk-U5MPNEM2.js +1 -0
- package/dist/standalone/chunk-UD5REVU2.js +1 -0
- package/dist/standalone/chunk-ULQNADMJ.js +1 -0
- package/dist/standalone/chunk-UPPNZ6MI.js +1 -0
- package/dist/standalone/{chunk-PQH2LSJX.js → chunk-UQA2AJGI.js} +1 -1
- package/dist/standalone/chunk-UTQLJKHH.js +1 -0
- package/dist/standalone/chunk-UVG3ZISC.js +1 -0
- package/dist/standalone/chunk-UXBNXITB.js +1 -0
- package/dist/standalone/chunk-UZ2ZXB74.js +1 -0
- package/dist/standalone/chunk-V3BE427M.js +1 -0
- package/dist/standalone/chunk-VQDTA4P6.js +1 -0
- package/dist/standalone/chunk-W4LJQYCI.js +1 -0
- package/dist/standalone/chunk-WLHQ4FKC.js +1 -0
- package/dist/standalone/chunk-XPFVUAPX.js +1 -0
- package/dist/standalone/{chunk-SYGCASPT.js → chunk-Y2YLTUMD.js} +1 -1
- package/dist/standalone/chunk-Y3IGTWUE.js +1 -0
- package/dist/standalone/chunk-Y64STA6O.js +1 -0
- package/dist/standalone/chunk-YEVTA35E.js +1 -0
- package/dist/standalone/chunk-YEXTJUKQ.js +6 -0
- package/dist/standalone/chunk-YFTPHGS2.js +1 -0
- package/dist/standalone/{chunk-R36QXQZX.js → chunk-YORPLSI5.js} +1 -1
- package/dist/standalone/chunk-Z64BZNPS.js +1 -0
- package/dist/standalone/chunk-Z6VILGGP.js +5 -0
- package/dist/standalone/chunk-ZBOB33BA.js +1 -0
- package/dist/standalone/{chunk-5R2YO7HF.js → chunk-ZOKSVUID.js} +4 -4
- package/dist/standalone/{chunk-H7HZ42JY.js → chunk-ZPQBVYNN.js} +1 -1
- package/dist/standalone/chunk-ZSWW2UGP.js +1 -0
- package/dist/standalone/studio.js +2 -2
- package/dist/styles.css +1 -1
- package/package.json +7 -6
- package/dist/packem_shared/ADMIN_FUNCTIONS-4aGsMs95.mjs +0 -1
- package/dist/packem_shared/Studio-MA8kKZLu.mjs +0 -1
- package/dist/packem_shared/advisor-view-tBumWci_.mjs +0 -1
- package/dist/packem_shared/error-alert-C0R39DO1.mjs +0 -1
- package/dist/packem_shared/recording-client-DAipTA_n.mjs +0 -1
- package/dist/packem_shared/studio-UhUrPz5J.mjs +0 -2
- package/dist/packem_shared/use-sql-assistant-rZPs3LC3.mjs +0 -1
- package/dist/standalone/chunk-2AH4ABE5.js +0 -1
- package/dist/standalone/chunk-2G57ENH5.js +0 -1
- package/dist/standalone/chunk-3GXPALXG.js +0 -1
- package/dist/standalone/chunk-3GYLOE4V.js +0 -1
- package/dist/standalone/chunk-473JK2PQ.js +0 -1
- package/dist/standalone/chunk-4C4THJUD.js +0 -1
- package/dist/standalone/chunk-4DAKKAK7.js +0 -1
- package/dist/standalone/chunk-4M57OYFX.js +0 -1
- package/dist/standalone/chunk-4SQBAPY6.js +0 -1
- package/dist/standalone/chunk-5DNGK3NT.js +0 -1
- package/dist/standalone/chunk-5GIQ6C5N.js +0 -1
- package/dist/standalone/chunk-5WJG7FMH.js +0 -1
- package/dist/standalone/chunk-63KDHS3H.js +0 -1
- package/dist/standalone/chunk-6B6ARRMI.js +0 -1
- package/dist/standalone/chunk-6LMO2D54.js +0 -1
- package/dist/standalone/chunk-6M7FLLMT.js +0 -1
- package/dist/standalone/chunk-6QEXGYWH.js +0 -1
- package/dist/standalone/chunk-6UTZXEW3.js +0 -1
- package/dist/standalone/chunk-6VAY6L4J.js +0 -1
- package/dist/standalone/chunk-7PADVGQX.js +0 -1
- package/dist/standalone/chunk-7RGYCU6F.js +0 -1
- package/dist/standalone/chunk-7UM5ROG6.js +0 -1
- package/dist/standalone/chunk-A566HCBX.js +0 -1
- package/dist/standalone/chunk-A5JISKHE.js +0 -1
- package/dist/standalone/chunk-ADNRFCMZ.js +0 -1
- package/dist/standalone/chunk-AP4PC2M4.js +0 -1
- package/dist/standalone/chunk-BFE2DRP6.js +0 -33
- package/dist/standalone/chunk-BPEB4KFE.js +0 -1
- package/dist/standalone/chunk-BVX45MU5.js +0 -7
- package/dist/standalone/chunk-C6GN7ZXJ.js +0 -1
- package/dist/standalone/chunk-CL2VZNDI.js +0 -1
- package/dist/standalone/chunk-CNA3TVUK.js +0 -1
- package/dist/standalone/chunk-CZ6HBDIL.js +0 -1
- package/dist/standalone/chunk-D6S7MXW4.js +0 -1
- package/dist/standalone/chunk-E26OT26O.js +0 -1
- package/dist/standalone/chunk-FCAXVYAX.js +0 -1
- package/dist/standalone/chunk-FXPAJDES.js +0 -1
- package/dist/standalone/chunk-HHRYM6UW.js +0 -1
- package/dist/standalone/chunk-HPRF5LMA.js +0 -1
- package/dist/standalone/chunk-IB22LETR.js +0 -1
- package/dist/standalone/chunk-IBJVVHV5.js +0 -1
- package/dist/standalone/chunk-IENQRRQT.js +0 -1
- package/dist/standalone/chunk-IQ4TTHQT.js +0 -1
- package/dist/standalone/chunk-ITH5LRWM.js +0 -1
- package/dist/standalone/chunk-J6VFG6M5.js +0 -1
- package/dist/standalone/chunk-JSDKOE4U.js +0 -1
- package/dist/standalone/chunk-JTGGWF7R.js +0 -1
- package/dist/standalone/chunk-JZD7ZN3F.js +0 -1
- package/dist/standalone/chunk-K3CWB3AM.js +0 -1
- package/dist/standalone/chunk-KNFB3FGW.js +0 -1
- package/dist/standalone/chunk-KNXWDE4N.js +0 -1
- package/dist/standalone/chunk-KRPXOSBL.js +0 -1
- package/dist/standalone/chunk-KRY7BYHT.js +0 -1
- package/dist/standalone/chunk-KYAG2YMF.js +0 -1
- package/dist/standalone/chunk-KZCEJFZF.js +0 -1
- package/dist/standalone/chunk-KZILJQX3.js +0 -8
- package/dist/standalone/chunk-LEYUH5TS.js +0 -1
- package/dist/standalone/chunk-LFM672WN.js +0 -1
- package/dist/standalone/chunk-LIGOLZND.js +0 -1
- package/dist/standalone/chunk-LPU6YTSU.js +0 -1
- package/dist/standalone/chunk-MWJC3S62.js +0 -1
- package/dist/standalone/chunk-NP2AQOLE.js +0 -1
- package/dist/standalone/chunk-NVKLYDOH.js +0 -1
- package/dist/standalone/chunk-O2X2XYCM.js +0 -1
- package/dist/standalone/chunk-O3MDWYXF.js +0 -1
- package/dist/standalone/chunk-ONG4JEZD.js +0 -1
- package/dist/standalone/chunk-OS26JXYA.js +0 -1
- package/dist/standalone/chunk-OXFKZ4BM.js +0 -1
- package/dist/standalone/chunk-PGTEGUAB.js +0 -1
- package/dist/standalone/chunk-PTBUWRBY.js +0 -1
- package/dist/standalone/chunk-Q6HA3L2H.js +0 -1
- package/dist/standalone/chunk-QGV5ARD2.js +0 -1
- package/dist/standalone/chunk-QWRK4ESB.js +0 -1
- package/dist/standalone/chunk-RL2ITK2N.js +0 -1
- package/dist/standalone/chunk-RTJO3AR4.js +0 -1
- package/dist/standalone/chunk-SFY646MC.js +0 -1
- package/dist/standalone/chunk-T5UMHPAB.js +0 -1
- package/dist/standalone/chunk-T6HV2FQP.js +0 -2
- package/dist/standalone/chunk-T7ZKNNGX.js +0 -1
- package/dist/standalone/chunk-TCYPNSTV.js +0 -1
- package/dist/standalone/chunk-TQM6XHBA.js +0 -1
- package/dist/standalone/chunk-TRMWBRRU.js +0 -1
- package/dist/standalone/chunk-TW7KJSMR.js +0 -15
- package/dist/standalone/chunk-TYD3V4NB.js +0 -1
- package/dist/standalone/chunk-TZKLK52W.js +0 -1
- package/dist/standalone/chunk-U4RXQSQ7.js +0 -1
- package/dist/standalone/chunk-UNZ2UBVL.js +0 -1
- package/dist/standalone/chunk-VJRNOSRY.js +0 -1
- package/dist/standalone/chunk-W2BCSK5S.js +0 -1
- package/dist/standalone/chunk-W7MRISE3.js +0 -1
- package/dist/standalone/chunk-WM72PRE3.js +0 -1
- package/dist/standalone/chunk-X4WHMCOZ.js +0 -1
- package/dist/standalone/chunk-X74GEPSG.js +0 -1
- package/dist/standalone/chunk-XKPD4SFN.js +0 -1
- package/dist/standalone/chunk-XMSNLMWU.js +0 -1
- package/dist/standalone/chunk-XOPFDWXX.js +0 -1
- package/dist/standalone/chunk-XQLOVFPP.js +0 -1
- package/dist/standalone/chunk-XSHYZPGF.js +0 -1
- package/dist/standalone/chunk-XST3UEHU.js +0 -1
- package/dist/standalone/chunk-XYR5NST4.js +0 -1
- package/dist/standalone/chunk-Y74LIFSL.js +0 -1
- package/dist/standalone/chunk-YHTHRYP5.js +0 -1
- package/dist/standalone/chunk-YMEKCV27.js +0 -1
- package/dist/standalone/chunk-Z5EV64KS.js +0 -1
- package/dist/standalone/chunk-ZBON5T5A.js +0 -1
- package/dist/standalone/chunk-ZGSL4DPP.js +0 -1
- package/dist/standalone/chunk-ZOQTXWPK.js +0 -1
- package/dist/standalone/chunk-ZTOREMGH.js +0 -1
- package/dist/standalone/chunk-ZZ5GICTF.js +0 -1
- /package/dist/standalone/{chunk-UYEZR3BI.js → chunk-P6VNMPWR.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const s=[{headings:["Vocabulary","The mental model","The components","Request lifecycle","The data tiers","Compute tiers","The consistency model","The real-time engine"],id:"architecture",summary:"The full picture — topology, request lifecycle, the data tiers, the consistency model, and the design decisions behind them.",title:"Architecture"},{headings:["How telemetry reaches the cloud","Traces","Issues","Logs","Metrics","Scoped ingest keys","Bring your own OpenTelemetry","Retention & scale"],id:"cloud/monitoring",summary:"The Lunora cloud is a managed OpenTelemetry backend + control plane — deploy to it and your traces, logs, metrics, and AI generations flow i",title:"Monitoring"},{headings:["When to use an action vs a mutation","ActionCtx","Calling queries and mutations from an action","Scheduling follow-up work"],id:"concepts/actions",summary:"Non-deterministic functions for external APIs and side effects — the action builder and its ActionCtx.",title:"Actions"},{headings:["Keep your session authority","Declare ownership once","Call Lunora from your own Worker","Dev proxy: two silent failures","Run both engines during the migration","Test it without a worker","When something is stuck"],id:"concepts/adopt-in-an-existing-app",summary:"Add Lunora to a working product that already has its own auth, Worker, and data layer — without rewriting either.",title:"Adopt in an existing app"},{headings:["Static lints","Runtime lints","Running advisors"],id:"concepts/advisors",summary:"Splinter-style lints that catch schema, performance, and security problems — many before you deploy.",title:"Advisors"},{headings:["Agent skills","Agent mode","The docs server","The local server","The MCP server","Keeping generated types honest"],id:"concepts/ai-tooling",summary:"Teach Claude Code, Cursor, and Copilot how to use Lunora — agent skills, agent-aware dev mode, the docs server, and the MCP server.",title:"AI coding agents"},{headings:["What lands in your project","Wire it up","The cards","Enabling the optional flows","Password rules","Username availability","Being an OAuth provider","Avatar and logo uploads"],id:"concepts/auth-ui",summary:"Copy-in sign-in, settings, and organization screens for React, Vue, Svelte, Solid, and Angular — the code lands in your project and you own ",title:"Auth UI"},{headings:["ctx.auth inside functions","@lunora/auth on the server","Routing /api/auth/*","The client side","Feeding row-level security","See also"],id:"concepts/authentication",summary:"How ctx.auth threads the signed-in user through queries, mutations, and actions — and feeds row-level security.",title:"Authentication"},{headings:["Point-in-time recovery","Snapshot backups","Export and import","Streaming data out continuously","Practising a restore"],id:"concepts/backups",summary:"Snapshot a deployment, recover a shard to any moment in the last 30 days, and move data in and out as NDJSON.",title:"Backups, export & import"},{headings:["Schema first","Reads","Writes","Inputs and safety","Scaling","Lean on Advisors"],id:"concepts/best-practices",summary:"The opinionated idioms that keep a Lunora app fast, safe, and reactive.",title:"Best practices"},{headings:["Enabling Workers Cache","Declarative cache headers on httpRoute","Programmatic cache purging","Why only HTTP actions?","Memoizing an expensive action result","Scaffolding cache-aware routes","Best practices"],id:"concepts/caching",summary:"Edge caching with Cloudflare Workers Cache — declarative headers on HTTP routes and programmatic cache purging from actions.",title:"Caching"},{headings:["The short version","Rows or events?","Live topics, whispers and rooms","Streams","Write a row, then tell the page","Things to know before you rely on a live topic"],id:"concepts/choosing-a-data-channel",summary:"Live query, stream, live topic, whisper, room or socket? Which one to use for which job.",title:"Choosing a data channel"},{headings:["Declaring it","What _commitSeq guarantees","Refreshed on every write","Three things it is not","When to reach for it"],id:"concepts/commit-ordering",summary:"Declare .commitOrdered() so every row carries _commitSeq — a per-shard sequence that orders commits, and the cursor a changefeed can page on",title:"Commit ordering"},{headings:["Defining one","Installing one","What the namespace guarantees","What a component does NOT get","In the architecture view","Migrations","See also"],id:"concepts/components",summary:"Package backend features — tables, functions, and context — as an installable unit that cannot collide with the app that installs it.",title:"Components"},{headings:["Constraint kinds","Unique","Non-null","Foreign-key integrity","Error codes"],id:"concepts/constraints",summary:"Unique, non-null and foreign-key integrity declared on the schema and enforced at write time.",title:"Constraints"},{headings:["What it pins","Pinning auth and voice","Pinning mail","Set it once: changing it strands data","Runbook: moving an app to a new jurisdiction"],id:"concepts/data-residency",summary:"Pin Durable Objects to a Cloudflare jurisdiction with .jurisdiction(), and the export→import runbook for moving regions.",title:"Data residency"},{headings:["The type table","Numbers, bigints, and dates","Optional versus null","Values that JSON cannot carry","Size limits","Types outside the schema"],id:"concepts/data-types",summary:"The value types a Lunora document can hold, how each is stored, and which ones need the wire codec to survive JSON.",title:"Data types"},{headings:["Start with lunora doctor","Catch it before it runs","The error overlay","Structured logging with ctx.log","The Studio","Find the slow or failing function","Watch production","Debugging authentication"],id:"concepts/debugging",summary:"The tools to reach for when something is broken — doctor, the error overlay, ctx.log, the Studio, insights, and live logs.",title:"Debugging"},{headings:["How ids are minted","Typing a reference with v.id","Reading and following ids","Validating an id that came from outside","Ids in exports and imports"],id:"concepts/document-ids",summary:"Every row carries an _id and a _creationTime — how they are minted, how v.id types a reference, and what an id does and does not guarantee.",title:"Document IDs"},{headings:["Locally: .dev.vars","In production: secrets and vars","Accessing env inside your app","The rule: never commit secrets"],id:"concepts/environment-variables",summary:"Configure secrets and vars — .dev.vars locally, wrangler secrets in production, env bindings inside functions.",title:"Environment variables"},{headings:["Multiple environments","Linking a checkout to a deployment","Preview deployments","Moving traffic between versions","Build once, deploy many","Custom domains","Trying a deploy without an account","Who changed what"],id:"concepts/environments",summary:"Running staging next to production, shipping a preview per pull request, and rolling traffic back when something goes wrong.",title:"Environments & releases"},{headings:["Throwing from a handler","Expected vs. unexpected","Reading error state on the client","Optimistic updates roll back on rejection","See also"],id:"concepts/error-handling",summary:"Throwing inside handlers, how errors travel to the client, and reading error state without losing optimistic safety.",title:"Error handling"},{headings:["What reaches your tracker","Wire it once, to both halves","Sentry","PostHog","Datadog, Axiom, Better Stack, and the rest","Source maps","Privacy"],id:"concepts/error-tracking",summary:"Send Lunora's failed calls and error logs to Sentry, PostHog, Datadog, or any error tracker, with the thrown error's real stack and nothing ",title:"Error tracking"},{headings:["External provider or @lunora/auth?","The resolver","Client: hand over the token, refresh it","WebSockets and live queries","RLS with org claims","Memoization and revocation","Composing with @lunora/auth or Cloudflare Access","Walkthrough: Clerk"],id:"concepts/external-auth",summary:"Use Clerk, WorkOS AuthKit, Auth0, Supabase or any OIDC JWT issuer as your identity provider — verify its token at the Worker and feed ctx.au",title:"External auth"},{headings:["Which contexts expose what","Uploading","Serving files","Named buckets","Deleting","See also"],id:"concepts/file-storage",summary:"Typed R2 buckets exposed as ctx.storage — uploading, serving via signed URLs, and deleting files from your functions.",title:"File storage"},{headings:["Where the work happens","Choosing between them","When a bare filter is fine","How the advisors catch this","Composing","Inside an object column"],id:"concepts/filtering",summary:".filter() is a JavaScript predicate applied after rows are loaded — when to use it, and when to reach for an index instead.",title:"Filtering"},{headings:["The three context types","Surfaces on every ctx","ctx field matrix","Add-on surfaces (codegen-wired)"],id:"concepts/function-context",summary:"The ctx object passed to every query, mutation, and action — and what each kind is allowed to do with it.",title:"Function context"},{headings:["api.ts and internal.ts: function references","server.ts: typed helpers","dataModel.ts: Id and Doc","Importing the generated code","lunora/* vs @lunora/* imports","Linting and formatting","Regenerating"],id:"concepts/generated-code",summary:"What @lunora/codegen emits from your schema.ts, and how api / Id / Doc keep server and client in sync.",title:"Generated code"},{headings:["Declaring a point column and a geo index",'"Places near me": near(point, radiusMeters)',"Bounding box: within(box)","Single-shard scope","How the Advisors catch geo mistakes"],id:"concepts/geospatial",summary:'Store lat/lng points with v.geoPoint, index them with .geoIndex, and answer "places near me" and bounding-box reads with withGeoIndex.',title:"Geospatial"},{headings:["httpAction","HttpActionCtx","Typed routes with httpRoute","How routes mount in the worker"],id:"concepts/http-endpoints",summary:"Public HTTP routes with httpAction and the Hono-based httpRouter.",title:"HTTP endpoints"},{headings:["Declaring an index","Querying with withIndex","Why every filtered read should hit an index","How the Advisors catch unindexed reads","Checking a read with explain","Aggregate indexes"],id:"concepts/indexes",summary:"Declare B-tree indexes on tables and query them with withIndex — every filtered read should hit one.",title:"Indexes"},{headings:["Calling internal functions","Internal functions and scheduling"],id:"concepts/internal-functions",summary:"internalQuery / internalMutation / internalAction — server-only functions never exposed to the client.",title:"Internal functions"},{headings:["Declare the stream","Publish","Follow a topic in the browser","Authorization","Where delivery stops","Platform support","React Native"],id:"concepts/live-streams",summary:"Publish events to named topics from the server and follow many of them over one SSE connection.",title:"Live topic streams"},{headings:["Turn CDC on first","Why the DO topology fits","Shapes — partial replication","The poke diff protocol","Custom mutators — optimistic, server-authoritative","The client store","Cross-shard joins — the one limit"],id:"concepts/local-first",summary:"Shapes, the poke diff protocol, and custom mutators — the Zero-class sync engine.",title:"Local-first sync"},{headings:["Strategies","Roles and bypass","What's masked, what isn't","Sensitive arguments","Tooling","See also"],id:"concepts/masking",summary:"Column-level redaction on the read path — the companion to row-level security.",title:"Data masking"},{headings:["The lifetime","Rebuilding: onShardInit","What .memory() buys, and what it does not","Restrictions","Choosing between .memory() and .ttl()"],id:"concepts/memory-tables",summary:"Declare .memory() for state the shard rebuilds rather than remembers — presence, cursors, live counters — and onShardInit to bring it back a",title:"Memory tables"},{headings:["Attaching middleware","Augmenting ctx","Composing concerns"],id:"concepts/middleware",summary:"Compose cross-cutting concerns — auth checks, rate limiting, logging — and augment ctx for downstream handlers.",title:"Middleware"},{headings:["The deploy gate tells you when you need one","Schema migrations (global tables)","Data migrations (sharded tables)","Inspecting run-state in the Studio","One-off data edits without a deploy","Resetting local state"],id:"concepts/migrations",summary:"Schema-change SQL for global tables and online, resumable data migrations.",title:"Migrations"},{headings:["Queues and topics","What you get","Table ownership","Installed components"],id:"concepts/modules",summary:"Group lunora/ folders into modules and get a module catalog and an architecture diagram from codegen.",title:"Modules"},{headings:["Running as one node in a dev graph","Deploying from external IaC","Consuming the generated API from a sibling package","Calling the backend from a sibling Worker"],id:"concepts/monorepos-and-iac",summary:"Running the Lunora worker as one node in a larger dev graph, deploying it from Terraform/Pulumi/Alchemy, and consuming its generated API fro",title:"Monorepos and external IaC"},{headings:["The output is pinned to your CLI version","Wiring it into your project","What you get, and what you don't","Conformance"],id:"concepts/non-js-sdks",summary:"Generate a typed, self-contained Lunora client for Python, Go, Ruby, Rust, Swift, Java, Kotlin or Dart/Flutter — vendored into your project ",title:"Non-JS SDKs"},{headings:["Configure defineNotify","VAPID / FCM config via .dev.vars","Register a browser push subscription","Send from an action","Queue-backed fan-out"],id:"concepts/notifications",summary:"Configure defineNotify in lunora/notify.ts for Web Push + FCM, register browser subscriptions, and send via ctx.notify / ctx.push from an ac",title:"Push notifications"},{headings:["Sinks","Structured logging with ctx.log","Tracing sub-operations with ctx.trace","Database telemetry (ctx.db and ctx.sql)","Trace sampling","Source maps","Application metrics with ctx.metrics","Container telemetry"],id:"concepts/observability",summary:"Ship Lunora's logs, traces, and metrics to any OTLP collector — the otlpSink worker option, ctx.log/ctx.trace/ctx.metrics, the zero-config c",title:"Observability"},{headings:["Mutations are serialized, not retried","Where conflicts still happen","Handling a conflict on the client","Diagnosing a persistent conflict","Atomicity across shards",".global() tables"],id:"concepts/occ",summary:"Why mutations in one shard are serialized rather than retried, where optimistic-concurrency conflicts still arise, and what atomicity means ",title:"OCC & atomicity"},{headings:["Passing the adapters explicitly","What gets persisted","Surviving a breaking deploy","Multiple tabs","Sync status","Connection status UI","Boot with no network (the app shell)","The reconciliation model"],id:"concepts/offline-first",summary:"Persist reads and writes to disk so the app boots, renders, and accepts edits with no network.",title:"Offline-first"},{headings:["PaginationOptions","PaginationResult","Paging through a query","Ordering rows that hold NULL","Load more / infinite lists on the client",'Total count ("42 of 1,203")'],id:"concepts/pagination",summary:"Keyset pagination with .paginate(options) — page through a query and build an infinite list on the client.",title:"Pagination"},{headings:["ctx.db","ctx.auth","ctx.scheduler"],id:"concepts/queries-mutations",summary:"query / mutation / action — what each is for and how ctx is shaped.",title:"Queries & mutations"},{headings:["How this differs from a trigger","The convergence contract","What the handler receives","Execution and identity","Reads that should not wake you","Watching them work"],id:"concepts/reactors",summary:"Declare onQueryChange to run server logic when a query's result changes — the actor pattern, with no client on the other end and nothing pol",title:"Reactors (server-side reactivity)"},{headings:["Where a shard is created","Replica reads","Sockets near the client"],id:"concepts/read-replicas",summary:"Serve one-shot queries from a copy of the shard in the caller's region, pin where a shard is created, and terminate sockets near the client.",title:"Read replicas & placement"},{headings:["Hibernation","How an update reaches a subscriber","Reconnect","When WebSockets are blocked","Durable streams","Whispers (ephemeral peer messages)","Why no MQTT / Pub/Sub"],id:"concepts/realtime",summary:"How subscriptions, deltas, and hibernation fit together.",title:"Real-time"},{headings:["Using items","The manifest","Validation","Building the catalog","Distributing"],id:"concepts/registry-items",summary:"Package a reusable capability — schema, functions, bindings and env vars — as a registry item others install with one command.",title:"Authoring registry items"},{headings:["A worked example","The edge set","Directions","Depth, limit and score","Cycles and paging","It is an ordinary read","Fusing the graph into retrieval","From an AI agent"],id:"concepts/relation-graph",summary:"Traverse the foreign-key graph your schema already declares with ctx.db.related — depth-bounded, cycle-safe, scored by proximity, and fusabl",title:"Relation graph"},{headings:["The descriptors","Many-to-many","Index your foreign keys","Querying across a relation","Writing through a relation","Relations vs the relation graph"],id:"concepts/relations",summary:"Modeling many-to-one, one-to-many and many-to-many relationships with the one / many relation descriptors, foreign-key columns, join tables ",title:"Relations"},{headings:["Default-closed","URLs and methods","Arguments","Choosing a shard","Authentication","Rate limiting","Caching","OpenAPI"],id:"concepts/rest-api",summary:"Publish a query, mutation, or action as a plain REST endpoint with .expose({ rest: true }) — default-closed, routed through the procedure so",title:"Public REST API"},{headings:["Policies","Permissions and roles","Relation predicates","What's covered, what isn't","Testing policies","See also"],id:"concepts/rls",summary:"Server-side authorization that decides which rows a procedure can read or write.",title:"Row-level security"},{headings:["Node compatibility","Where the constraints bite","Bundling","The worker entry","Build once, deploy many"],id:"concepts/runtime",summary:"Everything runs on the Workers runtime — what that means for Node APIs, dependencies, and the 64 MiB bundle you have to fit into.",title:"Runtime & bundling"},{headings:["Deferring a function","Recurring jobs (Cron Triggers)","How dispatch works","See also"],id:"concepts/scheduling",summary:"Defer follow-up work with ctx.scheduler.runAfter / runAt, and run recurring jobs via Cron Triggers.",title:"Scheduling"},{headings:["Validators","Tier modifiers","Indexes"],id:"concepts/schema",summary:"Declarative tables, validators, indexes and sharding.",title:"Schema"},{headings:["Declaring a search index","Language","Running a search query","Matching rules","Filter fields","Relevance ordering, .take(n) and pagination","Limits","Backfill and staged"],id:"concepts/search",summary:"Declare a search index on a table and run relevance-ordered full-text queries.",title:"Full-text search"},{headings:["The HTTP edge","Auth, cookies, and secrets","Protecting public procedures","Securing sharded access","Advisor catalog","Config-time validation"],id:"concepts/security",summary:"Lunora's secure-by-default posture — the protections you get for free, how to opt out, and the advisor lints that catch the gaps.",title:"Security"},{headings:["From an SSR loader","From a script","From the terminal","From Python","From any language, over HTTP","Writing a new SDK"],id:"concepts/server-clients",summary:"Calling a Lunora deployment without a live subscription — from SSR loaders, scripts, other languages, or plain HTTP.",title:"Server-side & non-reactive clients"},{headings:["Declare a service","Call it from an action","What Lunora wires","Test an action that calls one","Make the service private","Smart Placement","Platforms","Migrating from URLs and HMAC"],id:"concepts/services",summary:"Call sibling Cloudflare Workers from actions over typed service bindings, run them in one dev session, and deploy them before the app.",title:"Services"},{headings:["When to shard","Migrating a populated table","What stays in the root DO","Going global","Cross-shard reads","The shard registry","Securing shard access"],id:"concepts/sharding",summary:"Default __root__ DO, opt-in .shardBy(), and .global() escape hatch.",title:"Sharding"},{headings:["The one caveat that matters","The read surface","_scheduled_functions","_storage"],id:"concepts/system-tables",summary:"Read pending scheduled jobs and stored file metadata through ctx.db.system — a read-only, eventually consistent view outside the mutation sn",title:"System tables"},{headings:["Install","Configure","Write a test","Run in CI"],id:"concepts/testing-ai-features",summary:"Drive a Lunora app's AI flows in a real browser with the e2e runner, and judge non-deterministic model output with natural-language assertio",title:"Testing AI features end to end"},{headings:["The in-memory harness","Asserting reactive results","Mail-catcher helpers (E2E)","Running in CI"],id:"concepts/testing",summary:"Unit-test queries, mutations, and actions in memory with lunoraTest — no worker, no network.",title:"Testing"},{headings:["Declaring a TTL","Sweep semantics: coarse, batched, bounded","Not on .global() tables","Interaction with soft delete","How the Advisors catch TTL mistakes"],id:"concepts/ttl",summary:"Declare a table-level .ttl() so a DO alarm sweep auto-deletes expired rows — sessions, OTPs, and other ephemeral data.",title:"TTL & auto-expiry"},{headings:["Where types come from","Do not restate what is inferred","Reach for Doc and Id","Pin the client contract with .output()","Optional versus null in types","Bringing your own validators","Project configuration","Keeping types honest in CI"],id:"concepts/typescript",summary:"Getting the most out of Lunora's end-to-end types — where types come from, what to annotate, and what to let inference do.",title:"TypeScript"},{headings:["Job 1: column types in defineTable","Job 2: argument and return validation","Return-type inference to the client","Common validators","Coming from zod","ValidationError"],id:"concepts/validation",summary:"The v.* validators that type your columns and parse query / mutation / action inputs and outputs end to end.",title:"Validation"},{headings:["Declaring an index","Automatic write sync","ctx.vectors","RAG with @lunora/ai","Binding & config wiring"],id:"concepts/vector-search",summary:"Typed Vectorize indexes on ctx.vectors — automatic write sync, similarity search, and RAG with embeddings.",title:"Vector search"},{headings:["The specification","Conformance fixtures","SDKs built on it"],id:"concepts/wire-protocol",summary:"The language-independent Lunora client↔server wire protocol and the golden fixtures every SDK is tested against.",title:"Wire protocol"},{headings:["wrangler.jsonc","lunora.config.ts","Secrets","Containers","Deploy","Durable Object class limit","Worker size","Streaming logs"],id:"deployment",summary:"Wrangler bindings, secrets, and the deploy flow.",title:"Deployment"},{headings:["Redacted codes","Build-time errors","Throwing your own","Error codes"],id:"errors",summary:"Every well-known Lunora error code — its HTTP status, what it means, and what to do about it.",title:"Errors & warnings reference"},{headings:["Branching on one","The same number, in the document","Where the numbers come from","From your own code"],id:"exit-codes",summary:"The exit code every lunora command terminates with — what each number means, and how it is derived from the error catalog.",title:"CLI exit codes"},{headings:["Install","Provide the client","Live queries","Mutations","Connection status","Reactive loaders"],id:"frameworks/angular",summary:"Use Lunora with Angular — provideLunora in your app config, signal-based liveQuery, imperative mutate, and a connectionStatus signal.",title:"Angular"},{headings:["Install","Exports","The integration","Single-worker composition with withLunora","Reactive-loader server helpers","Deploy"],id:"frameworks/astro",summary:"Compose Astro's @astrojs/cloudflare worker with Lunora realtime, plus reactive-loader server helpers for .astro frontmatter.",title:"Astro"},{headings:["One worker, two dispatch flows","Mount Lunora inside your framework","The per-framework matrix","Client adapters","Scaffolding","Vite composition"],id:"frameworks/bring-your-framework",summary:"Compose any meta-framework's SSR with Lunora realtime in one Cloudflare Worker.",title:"Bring your framework"},{headings:["One worker, two dispatch flows","Class A: Lunora owns the worker entry","Class B: the framework owns the CF adapter","Class C: SPA / SSR-less","Wrangler reconciliation"],id:"frameworks/deploy",summary:"One worker, one deploy — how a composed Lunora + meta-framework app ships to Cloudflare.",title:"Deploy your framework"},{headings:["Why two workers","Wiring them together","Client and server entry points","Loading data in a Server Component","Providing the client","Developing","Deploying"],id:"frameworks/nextjs",summary:"Run Lunora alongside Next.js on Cloudflare with the two-worker split — RSC loaders that hydrate into live subscriptions.",title:"Next.js"},{headings:["Install","Setup","How it works","Provide the client","Reactive loaders","Feature flags","Verify before deploy","Alternative: two-worker split"],id:"frameworks/nuxt",summary:"Run Lunora and Nuxt as one Cloudflare Worker — the @lunora/nuxt module mounts /_lunora/** into Nitro, plus reactive-loader server helpers.",title:"Nuxt"},{headings:["Scaffold a new app","Install","Create the client","Provide it","Live queries and mutations","HTTP streams","Local-first (shapes, custom mutators, TanStack DB)","Authentication (better-auth + Expo)"],id:"frameworks/react-native",summary:"Use Lunora in a React Native / Expo app — the same live hooks, plus an AsyncStorage-backed client and a better-auth Expo bridge.",title:"React Native / Expo"},{headings:["Install","Provide the client","Live queries","Mutations","Auth","Reactive loaders","One worker, one deploy"],id:"frameworks/react",summary:"Use Lunora with React — a provider, live useQuery/useMutation hooks, and the SSR-seed → live reactive-loader handoff.",title:"React"},{headings:["The problem with static loaders","The handoff","Why there's no flash","Identity continuity (SSR → client)","Sharding carries through","Status"],id:"frameworks/reactive-loaders",summary:"Your loaders are live — SSR data that hydrates into a real-time subscription with no flash.",title:"Reactive loaders"},{headings:["Install","Solid 1.x and Solid 2.0","Provide the client","Live queries","Mutations","Reactive loaders"],id:"frameworks/solid",summary:"Use Lunora with SolidJS — a provider, live createQuery/createMutation primitives, and the SSR-seed → live reactive-loader handoff.",title:"Solid"},{headings:["Install","Provide the client","Live queries","Mutations","Reactive loaders","One worker, one deploy"],id:"frameworks/svelte",summary:"Use Lunora with Svelte 5 / SvelteKit — context-provided client, live query/mutation stores, and the SSR-seed → live reactive-loader handoff.",title:"Svelte"},{headings:["What you're proving","1. Scaffold","2. Dev","3. Prove SSR preload (curl the raw HTML)","4. Prove the live subscription attaches","5. Prove live update (two tabs)","Identity check (optional, with auth)",'What "pass" looks like'],id:"frameworks/verify-live-loaders",summary:"How to actually prove live loaders work — scaffold, SSR-curl the preloaded value, two-tab live update.",title:"Manual end-to-end verification"},{headings:["Install","Provide the client","Live queries","Mutations","Reactive loaders","Worker composition"],id:"frameworks/vue",summary:"Use Lunora with Vue 3 — a client plugin, live useQuery/useMutation composables, and the SSR-seed → live reactive-loader handoff.",title:"Vue"},{headings:["Requirements"],id:"getting-started",summary:"Scaffold a Lunora app and run the dev loop in under a minute.",title:"Getting started"},{headings:["Durable Objects","Statement limits (Durable Objects **and** D1)","D1","R2","Workers","Worker startup (error 10021)","Queues","Pipelines"],id:"limits",summary:"Cloudflare ceilings you should keep in your head.",title:"Limits"},{headings:["Two translations, not one","Schema: transposing the relation graph","Procedures: the shape deltas","Writes: .returning() does not survive","Components decompose by hand"],id:"migrating/from-a-convex-toolkit",summary:"The second translation step a Drizzle-style schema DSL and a tRPC-style procedure builder add on top of the raw Convex mapping.",title:"Migrating from a Convex toolkit"},{headings:["Bump strategy","Breaking changes already landed","Recommended (non-breaking) follow-ups","See also"],id:"migrating/from-alpha",summary:"How a 1.0.0-alpha.* app moves to stable — dependency bumps plus every breaking change already landed on the road to 1.0.",title:"Upgrading from alpha to 1.0"},{headings:["At a glance","Schema","Queries, mutations, actions","React","Auth","Scheduler","File storage","Subscriptions"],id:"migrating/from-convex",summary:"Side-by-side mapping — schema, queries, mutations, actions, React hooks.",title:"Migrating from Convex"},{headings:["At a glance","Schema","Reads: onSnapshot → useQuery","Writes: setDoc → mutation","Cloud Functions → actions","Auth","File storage","Scheduled work"],id:"migrating/from-firebase",summary:"Side-by-side mapping — Firestore, Cloud Functions, Auth, Storage, and real-time listeners.",title:"Migrating from Firebase"},{headings:["At a glance","Schema","Reads: supabase.from(...).select() → useQuery","Writes: .insert() → mutation","Row-level security","Edge Functions → actions","Auth","File storage"],id:"migrating/from-supabase",summary:"Side-by-side mapping — Postgres tables, RLS, Edge Functions, Auth, Storage, and Realtime.",title:"Migrating from Supabase"},{headings:["No arbitrary external SQL or ad-hoc cross-dataset joins","RPC-first, not REST-first","Cross-shard writes are eventual, not atomic","No data warehouse hosting in the framework","No managed control plane as a hard dependency","Also deliberately absent","See also"],id:"non-goals",summary:"The things Lunora deliberately does not do — each with the reason it's a boundary and the escape hatch when you need past it.",title:"Design boundaries"},{headings:["Why Lunora","Own it, or let us run it","How Lunora compares","Where it's rough","What ships in v1.0.0-alpha.1","Start building"],id:"overview",summary:"The Convex-style real-time backend that runs on your own Cloudflare account — typed end to end, live by default, ~$0 at idle.",title:"Overview"},{headings:["Bindings and wrangler config","Secrets","LUNORA_ADMIN_TOKEN and the admin plane","Rate limiting and abuse","Auth and row-level security","Migrations","Observability","Health and readiness endpoint"],id:"production-checklist",summary:"Everything to verify before a Lunora app takes real traffic — bindings, secrets, admin tokens, rate limits, RLS, migrations, observability.",title:"Production checklist"},{headings:["Pick a starting point","Adding Lunora to an app you already have","What you get either way","Next steps"],id:"quickstarts",summary:"Every starting point Lunora scaffolds — pick your framework, run one command, and get a live backend wired to it.",title:"Quickstarts"},{headings:["1. See where you stand","2. Create the usage alerts","3. Add the budget alert by hand","4. Check delivery","In CI"],id:"runaway-bill",summary:"Set Cloudflare usage alerts well above normal with `lunora cloudflare alerts`, add the budget alert the API cannot, and check what actually ",title:"Protect yourself from a runaway bill"},{headings:["Why startup grows with the app","Measure it locally","The fix: load function modules on demand","Keep heavy packages off the startup path"],id:"startup-cpu-limit",summary:'Why a large app fails to deploy with "Script startup exceeded CPU time limit", how to measure it, and how lazy function loading and lighter ',title:"Worker startup CPU limit (error 10021)"},{headings:["1. Scaffold","2. Model the data","3. Generate the migration","4. Write the query","5. Write the mutation","6. Wire the React app","7. Run the dev loop","8. Deploy"],id:"tutorial/realtime-chat",summary:"End-to-end Lunora walkthrough — schema, query, mutation, subscription, React, sharding.",title:"Build a real-time chat app in 15 minutes"},{headings:["Know when to act","Step 1: shard the messages","Step 2: put identities in a global table","Step 3: keep fan-out off the hot path","Step 4: lock down shard access","Step 5: migrate the data you already have","Checking your work","What you learned"],id:"tutorial/scaling",summary:"Take the chat app from one Durable Object to many — shard by channel, put identities in a global table, and keep cross-shard reads off the h",title:"Tutorial: scaling the chat app"},{headings:["Release channels","What SemVer means here","Stability tiers",'What "experimental" means',"See also"],id:"versioning",summary:"What SemVer means for Lunora packages — release channels, stability tiers, and the experimental surface.",title:"Versioning & stability"}],d="https://lunora.sh/docs/",h=4,u=3,m=200,g=4,p=3,y=2,f=1,w=t=>t.slice(0,m).toLowerCase().split(/[^a-z0-9.]+/u).filter(a=>a.length>=u),v=(t,a)=>{const i=t.id.toLowerCase(),e=t.title.toLowerCase(),r=t.summary.toLowerCase(),l=t.headings.map(n=>n.toLowerCase());let o=0;for(const n of a)i.includes(n)&&(o+=g),e.includes(n)&&(o+=p),l.some(c=>c.includes(n))&&(o+=y),r.includes(n)&&(o+=f);return o},b=t=>{const a=w(typeof t=="string"?t:""),i=a.length===0?[]:s.map(e=>({candidate:e,rank:v(e,a)})).filter(e=>e.rank>0).sort((e,r)=>r.rank-e.rank).slice(0,h).map(e=>({...e.candidate,url:`${d}${e.candidate.id}`}));return{entries:i.length===0?s.map(e=>e.id):i}},k=t=>{const{entries:a}=b(t);return a.every(i=>typeof i=="string")?[`Documentation pages under ${d}: ${a.join(", ")}`]:a.map(i=>{const e=i;return`${e.title} (${e.url}): ${e.summary} Sections: ${e.headings.join(", ")}`})};export{k as knowledgeExcerpts};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as E}from"react/compiler-runtime";import{E as de}from"../packem_shared/error-alert-C0R39DO1.mjs";import{ShardInput as ue}from"../packem_shared/ShardInput-CoySruKZ.mjs";import{S as K}from"../packem_shared/stat-card-BAv73QtB.mjs";import{B}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as D,a as me,b as te,c as se}from"../packem_shared/card-By2O8ULa.mjs";import{E as pe}from"../packem_shared/empty-state-D7jEML_T.mjs";import{c as _,a as oe,b as R,e as M,d as ne,T as re}from"../packem_shared/table-D0SBiDu-.mjs";import{u as X}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{u as fe}from"../packem_shared/use-open-trace-BJKMJjeS.mjs";import{u as he}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{useT as w}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as z}from"../packem_shared/ADMIN_FUNCTIONS-4aGsMs95.mjs";import{h as Te}from"../packem_shared/internal-hIuTpSbx.mjs";import{f as $,a as O}from"../packem_shared/metrics-format-1sNGG47R.mjs";import{S as ve}from"../packem_shared/sparkline-B_sPPO_8.mjs";import{jsx as r,jsxs as I,Fragment as ke}from"react/jsx-runtime";const H="gen_ai.usage.input_tokens",W="gen_ai.usage.output_tokens",j="gen_ai.usage.cost",ie="gen_ai.request.model",ye="lunora.usage.cost.source",Ce=new Set(["ai.embed","ai.generate","ai.stream"]),G=6e4,be=1440,le="unknown",q=()=>({calls:0,estimatedCost:0,inputTokens:0,outputTokens:0,providerCost:0}),J=(o,e)=>{const s=o?.[e];return typeof s=="string"&&s!==""?s:void 0},L=(o,e)=>{const s=o?.[e];return typeof s=="number"&&Number.isFinite(s)?s:void 0},Q=o=>J(o,ye)==="provider"?"provider":"estimated",Y=(o,e)=>o.reduce((s,n)=>s+e(n),0),F=o=>o.providerCost+o.estimatedCost,ae=o=>o.estimatedCost>0?o.providerCost>0?"mixed":"estimated":o.providerCost>0?"provider":"none",ce=(o,e)=>({calls:o.calls+e.calls,estimatedCost:o.estimatedCost+e.estimatedCost,inputTokens:o.inputTokens+e.inputTokens,outputTokens:o.outputTokens+e.outputTokens,providerCost:o.providerCost+e.providerCost}),ge=o=>{const e=q();let s=0,n=0,t=0;for(const c of o){const l=Y(c.points,a=>a.sum),i=Y(c.points,a=>a.count);c.name===H?(e.inputTokens+=l,s+=i):c.name===W?(e.outputTokens+=l,n+=i):(t+=i,Q(c.attributes)==="provider"?e.providerCost+=l:e.estimatedCost+=l)}return e.calls=Math.max(s,n,t),e},Ne=(o,e)=>F(e)-F(o)||e.inputTokens+e.outputTokens-(o.inputTokens+o.outputTokens)||o.key.localeCompare(e.key),Z=(o,e)=>{const s=new Map;for(const n of o){const t=e(n);s.set(t,{key:t,...ce(s.get(t)??q(),n)})}return[...s.values()].toSorted(Ne)},xe=o=>(o?.series??[]).filter(e=>e.name===H||e.name===W||e.name===j),Se=o=>J(o.attributes,ie)??le,Ie=o=>{const e=new Map;for(const s of o){const n=Se(s),t=JSON.stringify([s.functionPath,n]),c=e.get(t)??{functionPath:s.functionPath,model:n,series:[]};c.series.push(s),e.set(t,c)}return[...e.values()].map(({functionPath:s,model:n,series:t})=>({functionPath:s,model:n,...ge(t)}))},_e=o=>{const e=new Map;for(const i of o){if(i.name!==j)continue;const a=Q(i.attributes)==="provider";for(const u of i.points){const m=e.get(u.bucketMs)??{bucketMs:u.bucketMs,estimatedCost:0,providerCost:0};a?m.providerCost+=u.sum:m.estimatedCost+=u.sum,e.set(u.bucketMs,m)}}const s=[...e.keys()].toSorted((i,a)=>i-a),n=s[0],t=s.at(-1);if(n===void 0||t===void 0)return[];const c=Math.max(n,t-(be-1)*G),l=[];for(let i=c;i<=t;i+=G)l.push(e.get(i)??{bucketMs:i,estimatedCost:0,providerCost:0});return l},Me=o=>{const e=[];for(const s of o)for(const n of s.spans){if(!Ce.has(n.name))continue;const{attributes:t}=n,c=L(t,j),l=L(t,H),i=L(t,W);e.push({...c===void 0?{}:{cost:c,costSource:Q(t)},functionPath:s.functionPath,...l===void 0?{}:{inputTokens:l},model:J(t,ie)??le,ok:n.ok,...i===void 0?{}:{outputTokens:i},startTs:s.startTs+n.offsetMs,streaming:n.name==="ai.stream",traceId:s.traceId})}return e.toSorted((s,n)=>n.startTs-s.startTs)},Oe=o=>o.map(e=>{const s=e.cost??0;return{calls:1,estimatedCost:e.costSource==="provider"?0:s,functionPath:e.functionPath,inputTokens:e.inputTokens??0,model:e.model,outputTokens:e.outputTokens??0,providerCost:e.costSource==="provider"?s:0}}),Ae=(o,e)=>{const s=xe(o),n=Me(e),t=s.length>0,c=t?Ie(s):Oe(n);let l=q(),i="none";for(const a of c)l=ce(l,a);return t?i="history":n.length>0&&(i="live"),{byFunction:Z(c,a=>a.functionPath),byModel:Z(c,a=>a.model),calls:n,source:i,totals:l,trend:t?_e(s):[]}},Ee=o=>Array.isArray(o?.traces)?o.traces:[],we=25,V=o=>{const e=E(16),{provenance:s,value:n}=o,t=w();if(s==="none"){let m;return e[0]===Symbol.for("react.memo_cache_sentinel")?(m=r("span",{className:"text-muted-foreground",children:"—"}),e[0]=m):m=e[0],m}let c;e[1]!==s||e[2]!==n?(c=s==="provider"?$(n):`~${$(n)}`,e[1]=s,e[2]=n,e[3]=c):c=e[3];let l;e[4]!==c?(l=r("span",{className:"tabular-nums",children:c}),e[4]=c,e[5]=l):l=e[5];let i;e[6]!==s||e[7]!==t?(i=s==="estimated"?r(B,{title:t("Derived from a price table, not reported by the provider."),variant:"warning",children:t("Estimated")}):null,e[6]=s,e[7]=t,e[8]=i):i=e[8];let a;e[9]!==s||e[10]!==t?(a=s==="mixed"?r(B,{title:t("Includes cost derived from a price table, not reported by the provider."),variant:"warning",children:t("Partly estimated")}):null,e[9]=s,e[10]=t,e[11]=a):a=e[11];let u;return e[12]!==l||e[13]!==i||e[14]!==a?(u=I("span",{className:"inline-flex items-center gap-2",children:[l,i,a]}),e[12]=l,e[13]=i,e[14]=a,e[15]=u):u=e[15],u},ee=o=>{const e=E(40),{keyLabel:s,rows:n,testId:t,title:c}=o,l=w();let i;e[0]!==c?(i=r(te,{className:"px-4 py-3",children:r(se,{children:c})}),e[0]=c,e[1]=i):i=e[1];let a;e[2]!==s?(a=r(_,{children:s}),e[2]=s,e[3]=a):a=e[3];let u;e[4]!==l?(u=l("Calls"),e[4]=l,e[5]=u):u=e[5];let m;e[6]!==u?(m=r(_,{className:"text-end",children:u}),e[6]=u,e[7]=m):m=e[7];let T;e[8]!==l?(T=l("Input tokens"),e[8]=l,e[9]=T):T=e[9];let v;e[10]!==T?(v=r(_,{className:"text-end",children:T}),e[10]=T,e[11]=v):v=e[11];let k;e[12]!==l?(k=l("Output tokens"),e[12]=l,e[13]=k):k=e[13];let C;e[14]!==k?(C=r(_,{className:"text-end",children:k}),e[14]=k,e[15]=C):C=e[15];let y;e[16]!==l?(y=l("Cost"),e[16]=l,e[17]=y):y=e[17];let d;e[18]!==y?(d=r(_,{className:"text-end",children:y}),e[18]=y,e[19]=d):d=e[19];let b;e[20]!==d||e[21]!==a||e[22]!==m||e[23]!==v||e[24]!==C?(b=r(oe,{children:I(R,{children:[a,m,v,C,d]})}),e[20]=d,e[21]=a,e[22]=m,e[23]=v,e[24]=C,e[25]=b):b=e[25];let p;if(e[26]!==n||e[27]!==t){let x;e[29]!==t?(x=S=>I(R,{"data-testid":`${t}-row`,children:[r(M,{className:"max-w-[280px] truncate font-mono",title:S.key,children:S.key}),r(M,{className:"text-end tabular-nums",children:O(S.calls)}),r(M,{className:"text-end tabular-nums",children:O(S.inputTokens)}),r(M,{className:"text-end tabular-nums",children:O(S.outputTokens)}),r(M,{className:"text-end",children:r(V,{provenance:ae(S),value:F(S)})})]},S.key),e[29]=t,e[30]=x):x=e[30],p=n.map(x),e[26]=n,e[27]=t,e[28]=p}else p=e[28];let f;e[31]!==p?(f=r(ne,{children:p}),e[31]=p,e[32]=f):f=e[32];let h;e[33]!==b||e[34]!==f?(h=I(re,{children:[b,f]}),e[33]=b,e[34]=f,e[35]=h):h=e[35];let g;return e[36]!==i||e[37]!==h||e[38]!==t?(g=I(D,{className:"gap-0 py-0","data-testid":t,children:[i,h]}),e[36]=i,e[37]=h,e[38]=t,e[39]=g):g=e[39],g},Pe=o=>{const e=E(55),{calls:s,onOpenTrace:n}=o,t=w();let c;e[0]!==t?(c=t("Recent calls"),e[0]=t,e[1]=c):c=e[1];let l;e[2]!==c?(l=r(te,{className:"px-4 py-3",children:r(se,{children:c})}),e[2]=c,e[3]=l):l=e[3];let i;e[4]!==t?(i=t("When"),e[4]=t,e[5]=i):i=e[5];let a;e[6]!==i?(a=r(_,{children:i}),e[6]=i,e[7]=a):a=e[7];let u;e[8]!==t?(u=t("Function"),e[8]=t,e[9]=u):u=e[9];let m;e[10]!==u?(m=r(_,{children:u}),e[10]=u,e[11]=m):m=e[11];let T;e[12]!==t?(T=t("Model"),e[12]=t,e[13]=T):T=e[13];let v;e[14]!==T?(v=r(_,{children:T}),e[14]=T,e[15]=v):v=e[15];let k;e[16]!==t?(k=t("Input tokens"),e[16]=t,e[17]=k):k=e[17];let C;e[18]!==k?(C=r(_,{className:"text-end",children:k}),e[18]=k,e[19]=C):C=e[19];let y;e[20]!==t?(y=t("Output tokens"),e[20]=t,e[21]=y):y=e[21];let d;e[22]!==y?(d=r(_,{className:"text-end",children:y}),e[22]=y,e[23]=d):d=e[23];let b;e[24]!==t?(b=t("Cost"),e[24]=t,e[25]=b):b=e[25];let p;e[26]!==b?(p=r(_,{className:"text-end",children:b}),e[26]=b,e[27]=p):p=e[27];let f;e[28]!==t?(f=t("Trace"),e[28]=t,e[29]=f):f=e[29];let h;e[30]!==f?(h=r(_,{children:f}),e[30]=f,e[31]=h):h=e[31];let g;e[32]!==C||e[33]!==d||e[34]!==p||e[35]!==h||e[36]!==a||e[37]!==m||e[38]!==v?(g=r(oe,{children:I(R,{children:[a,m,v,C,d,p,h]})}),e[32]=C,e[33]=d,e[34]=p,e[35]=h,e[36]=a,e[37]=m,e[38]=v,e[39]=g):g=e[39];let x;if(e[40]!==s||e[41]!==n||e[42]!==t){let U;e[44]!==n||e[45]!==t?(U=N=>I(R,{"data-testid":"ai-call",children:[r(M,{className:"font-mono text-muted-foreground",children:Te(N.startTs)}),r(M,{className:"font-mono",children:I("span",{className:"inline-flex items-center gap-2",children:[N.functionPath,N.streaming?r(B,{variant:"outline",children:t("stream")}):null,N.ok?null:r(B,{variant:"destructive",children:t("failed")})]})}),r(M,{className:"max-w-[240px] truncate font-mono",title:N.model,children:N.model}),r(M,{className:"text-end tabular-nums",children:N.inputTokens===void 0?"—":O(N.inputTokens)}),r(M,{className:"text-end tabular-nums",children:N.outputTokens===void 0?"—":O(N.outputTokens)}),r(M,{className:"text-end",children:r(V,{provenance:N.cost===void 0?"none":N.costSource??"estimated",value:N.cost??0})}),r(M,{children:r("button",{className:"font-mono text-muted-foreground underline-offset-2 hover:underline",onClick:()=>{n(N.traceId)},title:t("Open the trace {trace}",{trace:N.traceId}),type:"button",children:N.traceId.slice(0,8)})})]},`${N.traceId}:${N.startTs.toString()}:${N.model}`),e[44]=n,e[45]=t,e[46]=U):U=e[46],x=s.slice(0,we).map(U),e[40]=s,e[41]=n,e[42]=t,e[43]=x}else x=e[43];let S;e[47]!==x?(S=r(ne,{children:x}),e[47]=x,e[48]=S):S=e[48];let A;e[49]!==g||e[50]!==S?(A=I(re,{children:[g,S]}),e[49]=g,e[50]=S,e[51]=A):A=e[51];let P;return e[52]!==l||e[53]!==A?(P=I(D,{className:"gap-0 py-0","data-testid":"ai-calls",children:[l,A]}),e[52]=l,e[53]=A,e[54]=P):P=e[54],P},Ue=o=>{const e=E(48),{totals:s,trend:n}=o,t=w();let c;e[0]!==s?(c=ae(s),e[0]=s,e[1]=c):c=e[1];const l=c;let i;e[2]!==t||e[3]!==n?(i=n.length>=2?r(ve,{ariaLabel:t("Cost per minute"),className:"h-7 w-24",series:n,testId:"ai-trend"}):void 0,e[2]=t,e[3]=n,e[4]=i):i=e[4];let a;e[5]!==l||e[6]!==t||e[7]!==s.estimatedCost||e[8]!==s.providerCost?(a=l==="none"?t("No cost reported"):r("span",{"data-testid":"ai-cost-split",children:t("{provider} provider-reported · {estimated} estimated",{estimated:$(s.estimatedCost),provider:$(s.providerCost)})}),e[5]=l,e[6]=t,e[7]=s.estimatedCost,e[8]=s.providerCost,e[9]=a):a=e[9];let u;e[10]!==t?(u=t("Total cost"),e[10]=t,e[11]=u):u=e[11];let m;e[12]!==s?(m=F(s),e[12]=s,e[13]=m):m=e[13];let T;e[14]!==l||e[15]!==m?(T=r(V,{provenance:l,value:m}),e[14]=l,e[15]=m,e[16]=T):T=e[16];let v;e[17]!==i||e[18]!==a||e[19]!==u||e[20]!==T?(v=r(K,{chart:i,footer:a,label:u,testId:"ai-total-cost",value:T}),e[17]=i,e[18]=a,e[19]=u,e[20]=T,e[21]=v):v=e[21];let k;e[22]!==t?(k=t("Input tokens"),e[22]=t,e[23]=k):k=e[23];let C;e[24]!==s.inputTokens?(C=O(s.inputTokens),e[24]=s.inputTokens,e[25]=C):C=e[25];let y;e[26]!==k||e[27]!==C?(y=r(K,{label:k,testId:"ai-input-tokens",value:C}),e[26]=k,e[27]=C,e[28]=y):y=e[28];let d;e[29]!==t?(d=t("Output tokens"),e[29]=t,e[30]=d):d=e[30];let b;e[31]!==s.outputTokens?(b=O(s.outputTokens),e[31]=s.outputTokens,e[32]=b):b=e[32];let p;e[33]!==d||e[34]!==b?(p=r(K,{label:d,testId:"ai-output-tokens",value:b}),e[33]=d,e[34]=b,e[35]=p):p=e[35];let f;e[36]!==t?(f=t("Calls"),e[36]=t,e[37]=f):f=e[37];let h;e[38]!==s.calls?(h=O(s.calls),e[38]=s.calls,e[39]=h):h=e[39];let g;e[40]!==f||e[41]!==h?(g=r(K,{label:f,testId:"ai-calls-total",value:h}),e[40]=f,e[41]=h,e[42]=g):g=e[42];let x;return e[43]!==y||e[44]!==p||e[45]!==g||e[46]!==v?(x=I("dl",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"ai-totals",children:[v,y,p,g]}),e[43]=y,e[44]=p,e[45]=g,e[46]=v,e[47]=x):x=e[47],x},Ze=o=>{const e=E(28),{initialShardKey:s}=o,n=w(),{queryShardKey:t,setShardKey:c,shardKey:l}=he(s),i=fe(t);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let u;e[1]!==t?(u={live:!0,shardKey:t},e[1]=t,e[2]=u):u=e[2];const{data:m,error:T}=X(z.getTraces,a,u);let v;e[3]===Symbol.for("react.memo_cache_sentinel")?(v={},e[3]=v):v=e[3];let k;e[4]!==t?(k={live:!0,shardKey:t},e[4]=t,e[5]=k):k=e[5];const{data:C}=X(z.getMetricHistory,v,k);let y,d;e[6]!==m||e[7]!==C?(d=Ae(C,Ee(m)),y=d.trend.map(Ke),e[6]=m,e[7]=C,e[8]=y,e[9]=d):(y=e[8],d=e[9]);const b=y;let p;e[10]!==c||e[11]!==l?(p=r(ue,{onChange:c,testId:"ai-shard-input",value:l}),e[10]=c,e[11]=l,e[12]=p):p=e[12];let f;e[13]!==T?(f=T===null?null:r(de,{error:T,testId:"ai-error"}),e[13]=T,e[14]=f):f=e[14];let h;e[15]!==i||e[16]!==n||e[17]!==b||e[18]!==d.byFunction||e[19]!==d.byModel||e[20]!==d.calls||e[21]!==d.source||e[22]!==d.totals?(h=d.source==="none"?r(pe,{description:n("Spend shows up here once an action calls ctx.ai.model(...) — tokens and cost per function and per model."),testId:"ai-empty",title:n("No AI usage recorded")}):I(ke,{children:[d.source==="live"?r("p",{className:"text-xs text-muted-foreground","data-testid":"ai-live-only",children:n("No durable history yet — these totals come from the live trace ring and reset when the shard hibernates.")}):r("p",{className:"text-xs text-muted-foreground","data-testid":"ai-window",children:n("Totals cover the retained metric history (up to the last 24 hours).")}),r(Ue,{totals:d.totals,trend:b}),I("div",{className:"grid gap-3 xl:grid-cols-2",children:[r(ee,{keyLabel:n("Function"),rows:d.byFunction,testId:"ai-by-function",title:n("By function")}),r(ee,{keyLabel:n("Model"),rows:d.byModel,testId:"ai-by-model",title:n("By model")})]}),d.calls.length===0?r(D,{children:r(me,{className:"p-4 text-xs text-muted-foreground","data-testid":"ai-no-calls",children:n("No recent calls in the live trace ring — it empties when the shard hibernates.")})}):r(Pe,{calls:d.calls,onOpenTrace:i})]}),e[15]=i,e[16]=n,e[17]=b,e[18]=d.byFunction,e[19]=d.byModel,e[20]=d.calls,e[21]=d.source,e[22]=d.totals,e[23]=h):h=e[23];let g;return e[24]!==p||e[25]!==f||e[26]!==h?(g=I("section",{className:"flex flex-col gap-4","data-testid":"ai-panel",children:[p,f,h]}),e[24]=p,e[25]=f,e[26]=h,e[27]=g):g=e[27],g};function Ke(o){return o.providerCost+o.estimatedCost}export{Ze as default};
|
|
1
|
+
import{c as E}from"react/compiler-runtime";import{E as de}from"../packem_shared/error-alert-DKXm5h19.mjs";import{ShardInput as ue}from"../packem_shared/ShardInput-CoySruKZ.mjs";import{S as U}from"../packem_shared/stat-card-BAv73QtB.mjs";import{B}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as D,a as me,b as te,c as se}from"../packem_shared/card-By2O8ULa.mjs";import{E as pe}from"../packem_shared/empty-state-D7jEML_T.mjs";import{c as _,a as oe,b as R,e as M,d as ne,T as re}from"../packem_shared/table-D0SBiDu-.mjs";import{u as X}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{u as fe}from"../packem_shared/use-open-trace-BJKMJjeS.mjs";import{u as he}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{useT as w}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as z}from"../packem_shared/ADMIN_FUNCTIONS-DUXsXId1.mjs";import{h as Te}from"../packem_shared/internal-hIuTpSbx.mjs";import{f as $,a as O}from"../packem_shared/metrics-format-1sNGG47R.mjs";import{S as ve}from"../packem_shared/sparkline-B_sPPO_8.mjs";import{jsx as r,jsxs as I,Fragment as ke}from"react/jsx-runtime";const H="gen_ai.usage.input_tokens",W="gen_ai.usage.output_tokens",j="gen_ai.usage.cost",ie="gen_ai.request.model",ye="lunora.usage.cost.source",Ce=new Set(["ai.embed","ai.generate","ai.stream"]),G=6e4,be=1440,le="unknown",q=()=>({calls:0,estimatedCost:0,inputTokens:0,outputTokens:0,providerCost:0}),J=(o,e)=>{const s=o?.[e];return typeof s=="string"&&s!==""?s:void 0},L=(o,e)=>{const s=o?.[e];return typeof s=="number"&&Number.isFinite(s)?s:void 0},Q=o=>J(o,ye)==="provider"?"provider":"estimated",Y=(o,e)=>o.reduce((s,n)=>s+e(n),0),F=o=>o.providerCost+o.estimatedCost,ae=o=>o.estimatedCost>0?o.providerCost>0?"mixed":"estimated":o.providerCost>0?"provider":"none",ce=(o,e)=>({calls:o.calls+e.calls,estimatedCost:o.estimatedCost+e.estimatedCost,inputTokens:o.inputTokens+e.inputTokens,outputTokens:o.outputTokens+e.outputTokens,providerCost:o.providerCost+e.providerCost}),ge=o=>{const e=q();let s=0,n=0,t=0;for(const c of o){const l=Y(c.points,a=>a.sum),i=Y(c.points,a=>a.count);c.name===H?(e.inputTokens+=l,s+=i):c.name===W?(e.outputTokens+=l,n+=i):(t+=i,Q(c.attributes)==="provider"?e.providerCost+=l:e.estimatedCost+=l)}return e.calls=Math.max(s,n,t),e},Ne=(o,e)=>F(e)-F(o)||e.inputTokens+e.outputTokens-(o.inputTokens+o.outputTokens)||o.key.localeCompare(e.key),Z=(o,e)=>{const s=new Map;for(const n of o){const t=e(n);s.set(t,{key:t,...ce(s.get(t)??q(),n)})}return[...s.values()].toSorted(Ne)},xe=o=>(o?.series??[]).filter(e=>e.name===H||e.name===W||e.name===j),Se=o=>J(o.attributes,ie)??le,Ie=o=>{const e=new Map;for(const s of o){const n=Se(s),t=JSON.stringify([s.functionPath,n]),c=e.get(t)??{functionPath:s.functionPath,model:n,series:[]};c.series.push(s),e.set(t,c)}return[...e.values()].map(({functionPath:s,model:n,series:t})=>({functionPath:s,model:n,...ge(t)}))},_e=o=>{const e=new Map;for(const i of o){if(i.name!==j)continue;const a=Q(i.attributes)==="provider";for(const u of i.points){const m=e.get(u.bucketMs)??{bucketMs:u.bucketMs,estimatedCost:0,providerCost:0};a?m.providerCost+=u.sum:m.estimatedCost+=u.sum,e.set(u.bucketMs,m)}}const s=[...e.keys()].toSorted((i,a)=>i-a),n=s[0],t=s.at(-1);if(n===void 0||t===void 0)return[];const c=Math.max(n,t-(be-1)*G),l=[];for(let i=c;i<=t;i+=G)l.push(e.get(i)??{bucketMs:i,estimatedCost:0,providerCost:0});return l},Me=o=>{const e=[];for(const s of o)for(const n of s.spans){if(!Ce.has(n.name))continue;const{attributes:t}=n,c=L(t,j),l=L(t,H),i=L(t,W);e.push({...c===void 0?{}:{cost:c,costSource:Q(t)},functionPath:s.functionPath,...l===void 0?{}:{inputTokens:l},model:J(t,ie)??le,ok:n.ok,...i===void 0?{}:{outputTokens:i},startTs:s.startTs+n.offsetMs,streaming:n.name==="ai.stream",traceId:s.traceId})}return e.toSorted((s,n)=>n.startTs-s.startTs)},Oe=o=>o.map(e=>{const s=e.cost??0;return{calls:1,estimatedCost:e.costSource==="provider"?0:s,functionPath:e.functionPath,inputTokens:e.inputTokens??0,model:e.model,outputTokens:e.outputTokens??0,providerCost:e.costSource==="provider"?s:0}}),Ae=(o,e)=>{const s=xe(o),n=Me(e),t=s.length>0,c=t?Ie(s):Oe(n);let l=q(),i="none";for(const a of c)l=ce(l,a);return t?i="history":n.length>0&&(i="live"),{byFunction:Z(c,a=>a.functionPath),byModel:Z(c,a=>a.model),calls:n,source:i,totals:l,trend:t?_e(s):[]}},Ee=o=>Array.isArray(o?.traces)?o.traces:[],we=25,V=o=>{const e=E(16),{provenance:s,value:n}=o,t=w();if(s==="none"){let m;return e[0]===Symbol.for("react.memo_cache_sentinel")?(m=r("span",{className:"text-muted-foreground",children:"—"}),e[0]=m):m=e[0],m}let c;e[1]!==s||e[2]!==n?(c=s==="provider"?$(n):`~${$(n)}`,e[1]=s,e[2]=n,e[3]=c):c=e[3];let l;e[4]!==c?(l=r("span",{className:"tabular-nums",children:c}),e[4]=c,e[5]=l):l=e[5];let i;e[6]!==s||e[7]!==t?(i=s==="estimated"?r(B,{title:t("Derived from a price table, not reported by the provider."),variant:"warning",children:t("Estimated")}):null,e[6]=s,e[7]=t,e[8]=i):i=e[8];let a;e[9]!==s||e[10]!==t?(a=s==="mixed"?r(B,{title:t("Includes cost derived from a price table, not reported by the provider."),variant:"warning",children:t("Partly estimated")}):null,e[9]=s,e[10]=t,e[11]=a):a=e[11];let u;return e[12]!==l||e[13]!==i||e[14]!==a?(u=I("span",{className:"inline-flex items-center gap-2",children:[l,i,a]}),e[12]=l,e[13]=i,e[14]=a,e[15]=u):u=e[15],u},ee=o=>{const e=E(40),{keyLabel:s,rows:n,testId:t,title:c}=o,l=w();let i;e[0]!==c?(i=r(te,{className:"px-4 py-3",children:r(se,{children:c})}),e[0]=c,e[1]=i):i=e[1];let a;e[2]!==s?(a=r(_,{children:s}),e[2]=s,e[3]=a):a=e[3];let u;e[4]!==l?(u=l("Calls"),e[4]=l,e[5]=u):u=e[5];let m;e[6]!==u?(m=r(_,{className:"text-end",children:u}),e[6]=u,e[7]=m):m=e[7];let T;e[8]!==l?(T=l("Input tokens"),e[8]=l,e[9]=T):T=e[9];let v;e[10]!==T?(v=r(_,{className:"text-end",children:T}),e[10]=T,e[11]=v):v=e[11];let k;e[12]!==l?(k=l("Output tokens"),e[12]=l,e[13]=k):k=e[13];let C;e[14]!==k?(C=r(_,{className:"text-end",children:k}),e[14]=k,e[15]=C):C=e[15];let y;e[16]!==l?(y=l("Cost"),e[16]=l,e[17]=y):y=e[17];let d;e[18]!==y?(d=r(_,{className:"text-end",children:y}),e[18]=y,e[19]=d):d=e[19];let b;e[20]!==d||e[21]!==a||e[22]!==m||e[23]!==v||e[24]!==C?(b=r(oe,{children:I(R,{children:[a,m,v,C,d]})}),e[20]=d,e[21]=a,e[22]=m,e[23]=v,e[24]=C,e[25]=b):b=e[25];let p;if(e[26]!==n||e[27]!==t){let x;e[29]!==t?(x=S=>I(R,{"data-testid":`${t}-row`,children:[r(M,{className:"max-w-[280px] truncate font-mono",title:S.key,children:S.key}),r(M,{className:"text-end tabular-nums",children:O(S.calls)}),r(M,{className:"text-end tabular-nums",children:O(S.inputTokens)}),r(M,{className:"text-end tabular-nums",children:O(S.outputTokens)}),r(M,{className:"text-end",children:r(V,{provenance:ae(S),value:F(S)})})]},S.key),e[29]=t,e[30]=x):x=e[30],p=n.map(x),e[26]=n,e[27]=t,e[28]=p}else p=e[28];let f;e[31]!==p?(f=r(ne,{children:p}),e[31]=p,e[32]=f):f=e[32];let h;e[33]!==b||e[34]!==f?(h=I(re,{children:[b,f]}),e[33]=b,e[34]=f,e[35]=h):h=e[35];let g;return e[36]!==i||e[37]!==h||e[38]!==t?(g=I(D,{className:"gap-0 py-0","data-testid":t,children:[i,h]}),e[36]=i,e[37]=h,e[38]=t,e[39]=g):g=e[39],g},Pe=o=>{const e=E(55),{calls:s,onOpenTrace:n}=o,t=w();let c;e[0]!==t?(c=t("Recent calls"),e[0]=t,e[1]=c):c=e[1];let l;e[2]!==c?(l=r(te,{className:"px-4 py-3",children:r(se,{children:c})}),e[2]=c,e[3]=l):l=e[3];let i;e[4]!==t?(i=t("When"),e[4]=t,e[5]=i):i=e[5];let a;e[6]!==i?(a=r(_,{children:i}),e[6]=i,e[7]=a):a=e[7];let u;e[8]!==t?(u=t("Function"),e[8]=t,e[9]=u):u=e[9];let m;e[10]!==u?(m=r(_,{children:u}),e[10]=u,e[11]=m):m=e[11];let T;e[12]!==t?(T=t("Model"),e[12]=t,e[13]=T):T=e[13];let v;e[14]!==T?(v=r(_,{children:T}),e[14]=T,e[15]=v):v=e[15];let k;e[16]!==t?(k=t("Input tokens"),e[16]=t,e[17]=k):k=e[17];let C;e[18]!==k?(C=r(_,{className:"text-end",children:k}),e[18]=k,e[19]=C):C=e[19];let y;e[20]!==t?(y=t("Output tokens"),e[20]=t,e[21]=y):y=e[21];let d;e[22]!==y?(d=r(_,{className:"text-end",children:y}),e[22]=y,e[23]=d):d=e[23];let b;e[24]!==t?(b=t("Cost"),e[24]=t,e[25]=b):b=e[25];let p;e[26]!==b?(p=r(_,{className:"text-end",children:b}),e[26]=b,e[27]=p):p=e[27];let f;e[28]!==t?(f=t("Trace"),e[28]=t,e[29]=f):f=e[29];let h;e[30]!==f?(h=r(_,{children:f}),e[30]=f,e[31]=h):h=e[31];let g;e[32]!==C||e[33]!==d||e[34]!==p||e[35]!==h||e[36]!==a||e[37]!==m||e[38]!==v?(g=r(oe,{children:I(R,{children:[a,m,v,C,d,p,h]})}),e[32]=C,e[33]=d,e[34]=p,e[35]=h,e[36]=a,e[37]=m,e[38]=v,e[39]=g):g=e[39];let x;if(e[40]!==s||e[41]!==n||e[42]!==t){let K;e[44]!==n||e[45]!==t?(K=N=>I(R,{"data-testid":"ai-call",children:[r(M,{className:"font-mono text-muted-foreground",children:Te(N.startTs)}),r(M,{className:"font-mono",children:I("span",{className:"inline-flex items-center gap-2",children:[N.functionPath,N.streaming?r(B,{variant:"outline",children:t("stream")}):null,N.ok?null:r(B,{variant:"destructive",children:t("failed")})]})}),r(M,{className:"max-w-[240px] truncate font-mono",title:N.model,children:N.model}),r(M,{className:"text-end tabular-nums",children:N.inputTokens===void 0?"—":O(N.inputTokens)}),r(M,{className:"text-end tabular-nums",children:N.outputTokens===void 0?"—":O(N.outputTokens)}),r(M,{className:"text-end",children:r(V,{provenance:N.cost===void 0?"none":N.costSource??"estimated",value:N.cost??0})}),r(M,{children:r("button",{className:"font-mono text-muted-foreground underline-offset-2 hover:underline",onClick:()=>{n(N.traceId)},title:t("Open the trace {trace}",{trace:N.traceId}),type:"button",children:N.traceId.slice(0,8)})})]},`${N.traceId}:${N.startTs.toString()}:${N.model}`),e[44]=n,e[45]=t,e[46]=K):K=e[46],x=s.slice(0,we).map(K),e[40]=s,e[41]=n,e[42]=t,e[43]=x}else x=e[43];let S;e[47]!==x?(S=r(ne,{children:x}),e[47]=x,e[48]=S):S=e[48];let A;e[49]!==g||e[50]!==S?(A=I(re,{children:[g,S]}),e[49]=g,e[50]=S,e[51]=A):A=e[51];let P;return e[52]!==l||e[53]!==A?(P=I(D,{className:"gap-0 py-0","data-testid":"ai-calls",children:[l,A]}),e[52]=l,e[53]=A,e[54]=P):P=e[54],P},Ke=o=>{const e=E(48),{totals:s,trend:n}=o,t=w();let c;e[0]!==s?(c=ae(s),e[0]=s,e[1]=c):c=e[1];const l=c;let i;e[2]!==t||e[3]!==n?(i=n.length>=2?r(ve,{ariaLabel:t("Cost per minute"),className:"h-7 w-24",series:n,testId:"ai-trend"}):void 0,e[2]=t,e[3]=n,e[4]=i):i=e[4];let a;e[5]!==l||e[6]!==t||e[7]!==s.estimatedCost||e[8]!==s.providerCost?(a=l==="none"?t("No cost reported"):r("span",{"data-testid":"ai-cost-split",children:t("{provider} provider-reported · {estimated} estimated",{estimated:$(s.estimatedCost),provider:$(s.providerCost)})}),e[5]=l,e[6]=t,e[7]=s.estimatedCost,e[8]=s.providerCost,e[9]=a):a=e[9];let u;e[10]!==t?(u=t("Total cost"),e[10]=t,e[11]=u):u=e[11];let m;e[12]!==s?(m=F(s),e[12]=s,e[13]=m):m=e[13];let T;e[14]!==l||e[15]!==m?(T=r(V,{provenance:l,value:m}),e[14]=l,e[15]=m,e[16]=T):T=e[16];let v;e[17]!==i||e[18]!==a||e[19]!==u||e[20]!==T?(v=r(U,{chart:i,footer:a,label:u,testId:"ai-total-cost",value:T}),e[17]=i,e[18]=a,e[19]=u,e[20]=T,e[21]=v):v=e[21];let k;e[22]!==t?(k=t("Input tokens"),e[22]=t,e[23]=k):k=e[23];let C;e[24]!==s.inputTokens?(C=O(s.inputTokens),e[24]=s.inputTokens,e[25]=C):C=e[25];let y;e[26]!==k||e[27]!==C?(y=r(U,{label:k,testId:"ai-input-tokens",value:C}),e[26]=k,e[27]=C,e[28]=y):y=e[28];let d;e[29]!==t?(d=t("Output tokens"),e[29]=t,e[30]=d):d=e[30];let b;e[31]!==s.outputTokens?(b=O(s.outputTokens),e[31]=s.outputTokens,e[32]=b):b=e[32];let p;e[33]!==d||e[34]!==b?(p=r(U,{label:d,testId:"ai-output-tokens",value:b}),e[33]=d,e[34]=b,e[35]=p):p=e[35];let f;e[36]!==t?(f=t("Calls"),e[36]=t,e[37]=f):f=e[37];let h;e[38]!==s.calls?(h=O(s.calls),e[38]=s.calls,e[39]=h):h=e[39];let g;e[40]!==f||e[41]!==h?(g=r(U,{label:f,testId:"ai-calls-total",value:h}),e[40]=f,e[41]=h,e[42]=g):g=e[42];let x;return e[43]!==y||e[44]!==p||e[45]!==g||e[46]!==v?(x=I("dl",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"ai-totals",children:[v,y,p,g]}),e[43]=y,e[44]=p,e[45]=g,e[46]=v,e[47]=x):x=e[47],x},Ze=o=>{const e=E(29),{initialShardKey:s}=o,n=w(),{queryShardKey:t,setShardKey:c,shardKey:l}=he(s),i=fe(t);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let u;e[1]!==t?(u={live:!0,shardKey:t},e[1]=t,e[2]=u):u=e[2];const{data:m,error:T}=X(z.getTraces,a,u);let v;e[3]===Symbol.for("react.memo_cache_sentinel")?(v={},e[3]=v):v=e[3];let k;e[4]!==t?(k={live:!0,shardKey:t},e[4]=t,e[5]=k):k=e[5];const{data:C}=X(z.getMetricHistory,v,k);let y,d;e[6]!==m||e[7]!==C?(d=Ae(C,Ee(m)),y=d.trend.map(Ue),e[6]=m,e[7]=C,e[8]=y,e[9]=d):(y=e[8],d=e[9]);const b=y;let p;e[10]!==c||e[11]!==l?(p=r(ue,{onChange:c,testId:"ai-shard-input",value:l}),e[10]=c,e[11]=l,e[12]=p):p=e[12];let f;e[13]!==T||e[14]!==t?(f=T===null?null:r(de,{error:T,shardKey:t,testId:"ai-error"}),e[13]=T,e[14]=t,e[15]=f):f=e[15];let h;e[16]!==i||e[17]!==n||e[18]!==b||e[19]!==d.byFunction||e[20]!==d.byModel||e[21]!==d.calls||e[22]!==d.source||e[23]!==d.totals?(h=d.source==="none"?r(pe,{description:n("Spend shows up here once an action calls ctx.ai.model(...) — tokens and cost per function and per model."),testId:"ai-empty",title:n("No AI usage recorded")}):I(ke,{children:[d.source==="live"?r("p",{className:"text-xs text-muted-foreground","data-testid":"ai-live-only",children:n("No durable history yet — these totals come from the live trace ring and reset when the shard hibernates.")}):r("p",{className:"text-xs text-muted-foreground","data-testid":"ai-window",children:n("Totals cover the retained metric history (up to the last 24 hours).")}),r(Ke,{totals:d.totals,trend:b}),I("div",{className:"grid gap-3 xl:grid-cols-2",children:[r(ee,{keyLabel:n("Function"),rows:d.byFunction,testId:"ai-by-function",title:n("By function")}),r(ee,{keyLabel:n("Model"),rows:d.byModel,testId:"ai-by-model",title:n("By model")})]}),d.calls.length===0?r(D,{children:r(me,{className:"p-4 text-xs text-muted-foreground","data-testid":"ai-no-calls",children:n("No recent calls in the live trace ring — it empties when the shard hibernates.")})}):r(Pe,{calls:d.calls,onOpenTrace:i})]}),e[16]=i,e[17]=n,e[18]=b,e[19]=d.byFunction,e[20]=d.byModel,e[21]=d.calls,e[22]=d.source,e[23]=d.totals,e[24]=h):h=e[24];let g;return e[25]!==p||e[26]!==f||e[27]!==h?(g=I("section",{className:"flex flex-col gap-4","data-testid":"ai-panel",children:[p,f,h]}),e[25]=p,e[26]=f,e[27]=h,e[28]=g):g=e[28],g};function Ue(o){return o.providerCost+o.estimatedCost}export{Ze as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{c as S}from"react/compiler-runtime";import{u as J}from"../packem_shared/use-assistant-rpc-GCUK2zPa.mjs";import{useT as B}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{B as E}from"../packem_shared/button-q0UYSmrn.mjs";import{I as Q}from"../packem_shared/input-CXhxesPC.mjs";import{jsx as c,jsxs as w,Fragment as V}from"react/jsx-runtime";import{Streamdown as X}from"streamdown";import{a as Z}from"../packem_shared/assistant-reason-D6EwMCxT.mjs";import{g as tt,f as et}from"../packem_shared/internal-hIuTpSbx.mjs";import{useState as L,useRef as st,useEffect as Y}from"react";const nt=h=>{const t=S(28),{draft:e,onDraftChange:a,onSend:l,pending:n}=h,i=B();let s;t[0]!==i?(s=i("Ask about your data"),t[0]=i,t[1]=s):s=t[1];let o;t[2]!==a?(o=g=>{a(g.target.value)},t[2]=a,t[3]=o):o=t[3];let r;t[4]!==l?(r=g=>{g.key==="Enter"&&(g.preventDefault(),l())},t[4]=l,t[5]=r):r=t[5];let d;t[6]!==i?(d=i("Ask about your data"),t[6]=i,t[7]=d):d=t[7];let f;t[8]!==e||t[9]!==n||t[10]!==s||t[11]!==o||t[12]!==r||t[13]!==d?(f=c(Q,{"aria-label":s,"data-testid":"assistant-input",disabled:n,onChange:o,onKeyDown:r,placeholder:d,value:e}),t[8]=e,t[9]=n,t[10]=s,t[11]=o,t[12]=r,t[13]=d,t[14]=f):f=t[14];let p;t[15]!==e||t[16]!==n?(p=n||e.trim()==="",t[15]=e,t[16]=n,t[17]=p):p=t[17];let u;t[18]!==n||t[19]!==i?(u=i(n?"Thinking…":"Send"),t[18]=n,t[19]=i,t[20]=u):u=t[20];let m;t[21]!==l||t[22]!==p||t[23]!==u?(m=c(E,{"data-testid":"assistant-send",disabled:p,onClick:l,size:"xs",type:"button",children:u}),t[21]=l,t[22]=p,t[23]=u,t[24]=m):m=t[24];let x;return t[25]!==f||t[26]!==m?(x=w("div",{className:"flex items-center gap-2 border-t border-border px-3 py-2",children:[f,m]}),t[25]=f,t[26]=m,t[27]=x):x=t[27],x},lt=h=>{const t=S(17),{onClose:e}=h,a=B();let l;t[0]!==a?(l=a("Assistant"),t[0]=a,t[1]=l):l=t[1];let n;t[2]!==l?(n=c("span",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:l}),t[2]=l,t[3]=n):n=t[3];let i;t[4]!==a?(i=a("Answers are suggestions — nothing runs until you insert and run it."),t[4]=a,t[5]=i):i=t[5];let s;t[6]!==i?(s=c("span",{className:"text-[11px] text-muted-foreground",children:i}),t[6]=i,t[7]=s):s=t[7];let o;t[8]!==a?(o=a("Close assistant"),t[8]=a,t[9]=o):o=t[9];let r;t[10]!==e||t[11]!==o?(r=c(E,{"aria-label":o,className:"ms-auto","data-testid":"assistant-close",onClick:e,size:"xs",type:"button",variant:"ghost",children:"×"}),t[10]=e,t[11]=o,t[12]=r):r=t[12];let d;return t[13]!==n||t[14]!==s||t[15]!==r?(d=w("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1.5",children:[n,s,r]}),t[13]=n,t[14]=s,t[15]=r,t[16]=d):d=t[16],d},it={img:()=>null},U=h=>{const t=S(2),{text:e}=h;let a;return t[0]!==e?(a=c("div",{className:"prose-sm max-w-none text-xs","data-testid":"assistant-turn-body",children:c(X,{components:it,children:e})}),t[0]=e,t[1]=a):a=t[1],a},W=h=>{const t=S(6),{children:e,label:a,testId:l}=h;let n;t[0]!==a?(n=c("span",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a}),t[0]=a,t[1]=n):n=t[1];let i;return t[2]!==e||t[3]!==n||t[4]!==l?(i=w("li",{className:"flex flex-col gap-1 border-b border-border px-3 py-2 last:border-b-0","data-testid":l,children:[n,e]}),t[2]=e,t[3]=n,t[4]=l,t[5]=i):i=t[5],i},ot=h=>{const t=S(7),{text:e}=h,a=B();let l;t[0]!==a?(l=a("Assistant"),t[0]=a,t[1]=l):l=t[1];let n;t[2]!==e?(n=c(U,{text:e}),t[2]=e,t[3]=n):n=t[3];let i;return t[4]!==l||t[5]!==n?(i=c(W,{label:l,testId:"assistant-turn-live",children:n}),t[4]=l,t[5]=n,t[6]=i):i=t[6],i},at=h=>{const t=S(20),{activeId:e,onDelete:a,onNew:l,onSelect:n,sessions:i}=h,s=B();let o;if(t[0]!==e||t[1]!==a||t[2]!==n||t[3]!==i||t[4]!==s){let p;t[6]!==e||t[7]!==a||t[8]!==n||t[9]!==i.length||t[10]!==s?(p=u=>w("span",{className:"flex shrink-0 items-center",children:[c(E,{"data-testid":"assistant-session",onClick:()=>{n(u.id)},size:"xs",type:"button",variant:u.id===e?"secondary":"ghost",children:u.name}),i.length>1&&c(E,{"aria-label":s("Close chat"),"data-testid":"assistant-session-close",onClick:()=>{a(u.id)},size:"xs",type:"button",variant:"ghost",children:"×"})]},u.id),t[6]=e,t[7]=a,t[8]=n,t[9]=i.length,t[10]=s,t[11]=p):p=t[11],o=i.map(p),t[0]=e,t[1]=a,t[2]=n,t[3]=i,t[4]=s,t[5]=o}else o=t[5];let r;t[12]!==s?(r=s("New chat"),t[12]=s,t[13]=r):r=t[13];let d;t[14]!==l||t[15]!==r?(d=c(E,{"aria-label":r,className:"shrink-0","data-testid":"assistant-session-new",onClick:l,size:"xs",type:"button",variant:"ghost",children:"+"}),t[14]=l,t[15]=r,t[16]=d):d=t[16];let f;return t[17]!==o||t[18]!==d?(f=w("div",{className:"flex shrink-0 items-center gap-1 overflow-x-auto border-b border-border px-2 py-1","data-testid":"assistant-sessions",children:[o,d]}),t[17]=o,t[18]=d,t[19]=f):f=t[19],f},rt=h=>{const t=S(9),{reason:e,truncated:a}=h,l=B();let n;t[0]!==l||t[1]!==a?(n=a&&c("p",{className:"px-3 py-1 text-[11px] text-muted-foreground","data-testid":"assistant-truncated",children:l("Older turns were dropped to fit the context budget.")}),t[0]=l,t[1]=a,t[2]=n):n=t[2];let i;t[3]!==e||t[4]!==l?(i=e!==void 0&&c("p",{className:"px-3 py-1 text-[11px] text-destructive","data-testid":"assistant-error",children:Z(e,l)}),t[3]=e,t[4]=l,t[5]=i):i=t[5];let s;return t[6]!==n||t[7]!==i?(s=w(V,{children:[n,i]}),t[6]=n,t[7]=i,t[8]=s):s=t[8],s},dt=h=>{const t=S(12),{onPick:e,suggestions:a}=h,l=B();let n;t[0]!==l?(n=l("Try asking"),t[0]=l,t[1]=n):n=t[1];let i;t[2]!==n?(i=c("span",{className:"text-[11px] text-muted-foreground",children:n}),t[2]=n,t[3]=i):i=t[3];let s;if(t[4]!==e||t[5]!==a){let r;t[7]!==e?(r=d=>c("button",{className:"self-start rounded-md border border-border px-2 py-1 text-start text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"assistant-suggestion",onClick:()=>{e(d)},type:"button",children:d},d),t[7]=e,t[8]=r):r=t[8],s=a.map(r),t[4]=e,t[5]=a,t[6]=s}else s=t[6];let o;return t[9]!==i||t[10]!==s?(o=w("div",{className:"flex flex-col gap-1 px-3 py-2","data-testid":"assistant-suggestions",children:[i,s]}),t[9]=i,t[10]=s,t[11]=o):o=t[11],o},M="```",ct=h=>{if(h.startsWith(M))return h.slice(M.length).trim().toLowerCase()==="sql"?"sql":"foreign"},ft=h=>{const t=[],e=h.split(`
|
|
2
|
+
`);let a,l=!1;for(const n of e){const i=n.trim();if(l){l=i!==M;continue}if(a===void 0){const s=ct(i);s==="sql"?a=[]:s==="foreign"&&(l=!0);continue}if(i===M){const s=a.join(`
|
|
3
|
+
`).trim();s!==""&&t.push(s),a=void 0;continue}a.push(n)}return t},ut=h=>{const t=S(29),{approval:e,onDecide:a}=h,l=B();let n;t[0]!==l?(n=l("The assistant wants to read rows before answering. Nothing runs until you allow it."),t[0]=l,t[1]=n):n=t[1];let i;t[2]!==n?(i=c("span",{className:"text-[11px] text-muted-foreground",children:n}),t[2]=n,t[3]=i):i=t[3];let s;t[4]!==e.sql?(s=c("pre",{className:"overflow-x-auto rounded bg-background p-1.5 font-mono text-[11px]","data-testid":"assistant-approval-sql",children:e.sql}),t[4]=e.sql,t[5]=s):s=t[5];let o;t[6]!==e||t[7]!==a?(o=()=>{a(!0,e)},t[6]=e,t[7]=a,t[8]=o):o=t[8];let r;t[9]!==l?(r=l("Allow"),t[9]=l,t[10]=r):r=t[10];let d;t[11]!==o||t[12]!==r?(d=c(E,{"data-testid":"assistant-approval-allow",onClick:o,size:"xs",type:"button",children:r}),t[11]=o,t[12]=r,t[13]=d):d=t[13];let f;t[14]!==e||t[15]!==a?(f=()=>{a(!1,e)},t[14]=e,t[15]=a,t[16]=f):f=t[16];let p;t[17]!==l?(p=l("Deny"),t[17]=l,t[18]=p):p=t[18];let u;t[19]!==f||t[20]!==p?(u=c(E,{"data-testid":"assistant-approval-deny",onClick:f,size:"xs",type:"button",variant:"secondary",children:p}),t[19]=f,t[20]=p,t[21]=u):u=t[21];let m;t[22]!==d||t[23]!==u?(m=w("div",{className:"flex gap-2",children:[d,u]}),t[22]=d,t[23]=u,t[24]=m):m=t[24];let x;return t[25]!==m||t[26]!==i||t[27]!==s?(x=w("div",{className:"flex flex-col gap-1.5 rounded-md border border-border bg-muted/40 p-2","data-testid":"assistant-approval",children:[i,s,m]}),t[25]=m,t[26]=i,t[27]=s,t[28]=x):x=t[28],x},pt=h=>{const t=S(15),{level:e,turn:a}=h,l=B();let n;t[0]!==a.toolCalls?(n=a.toolCalls??[],t[0]=a.toolCalls,t[1]=n):n=t[1];const i=n;if(i.length===0&&a.partial!==!0)return null;let s;if(t[2]!==i||t[3]!==e||t[4]!==l){let d;t[6]!==e||t[7]!==l?(d=(f,p)=>w("li",{children:[c("span",{className:"font-mono",children:f.name??l("(no such tool)")}),f.sql===void 0?null:c("span",{className:"ms-1 font-mono opacity-80",children:f.sql}),f.refused===void 0?null:c("span",{className:"ms-1 text-destructive",children:l("refused")}),f.needs===void 0?null:c("span",{className:"block text-muted-foreground","data-testid":"assistant-tool-needs",children:l("Needs the {needs} data-sharing level; this deployment is set to {level}. Change LUNORA_AI_OPT_IN in wrangler.jsonc.",{level:e??l("a lower level"),needs:f.needs})})]},`${String(p)}:${f.name??"?"}`),t[6]=e,t[7]=l,t[8]=d):d=t[8],s=i.map(d),t[2]=i,t[3]=e,t[4]=l,t[5]=s}else s=t[5];let o;t[9]!==l||t[10]!==a.partial?(o=a.partial===!0&&c("li",{"data-testid":"assistant-turn-partial",children:l("Stopped early — this answer is incomplete.")}),t[9]=l,t[10]=a.partial,t[11]=o):o=t[11];let r;return t[12]!==s||t[13]!==o?(r=w("ul",{className:"flex flex-col gap-0.5 border-s border-border ps-2 text-[11px] text-muted-foreground","data-testid":"assistant-tool-calls",children:[s,o]}),t[12]=s,t[13]=o,t[14]=r):r=t[14],r},ht=h=>{const t=S(60),{index:e,level:a,onBranch:l,onDecide:n,onInsert:i,onTruncate:s,turn:o}=h,r=B();let d,f,p,u,m;if(t[0]!==i||t[1]!==r||t[2]!==o.role||t[3]!==o.text){const P=o.role==="assistant"&&i!==void 0?ft(o.text):[];d=W,t[9]!==r||t[10]!==o.role?(f=o.role==="user"?r("You"):r("Assistant"),t[9]=r,t[10]=o.role,t[11]=f):f=t[11],p=`assistant-turn-${o.role}`,t[12]!==o.role||t[13]!==o.text?(u=o.role==="assistant"?c(U,{text:o.text}):c("p",{className:"text-xs whitespace-pre-wrap","data-testid":"assistant-turn-body",children:o.text}),t[12]=o.role,t[13]=o.text,t[14]=u):u=t[14];let R;t[15]!==i||t[16]!==r?(R=($,z)=>c(E,{className:"self-start","data-testid":"assistant-insert",onClick:()=>{i?.($)},size:"xs",type:"button",variant:"secondary",children:r("Insert into editor")},`${String(z)}:${$.slice(0,32)}`),t[15]=i,t[16]=r,t[17]=R):R=t[17],m=P.map(R),t[0]=i,t[1]=r,t[2]=o.role,t[3]=o.text,t[4]=d,t[5]=f,t[6]=p,t[7]=u,t[8]=m}else d=t[4],f=t[5],p=t[6],u=t[7],m=t[8];let x;t[18]!==n||t[19]!==o.pendingApproval?(x=o.pendingApproval!==void 0&&n!==void 0&&c(ut,{approval:o.pendingApproval,onDecide:n}),t[18]=n,t[19]=o.pendingApproval,t[20]=x):x=t[20];let g;t[21]!==a||t[22]!==o?(g=o.role==="assistant"&&c(pt,{level:a,turn:o}),t[21]=a,t[22]=o,t[23]=g):g=t[23];let q;t[24]!==o.text?(q=()=>{tt(o.text)},t[24]=o.text,t[25]=q):q=t[25];let T;t[26]!==r?(T=r("Copy"),t[26]=r,t[27]=T):T=t[27];let b;t[28]!==q||t[29]!==T?(b=c("button",{className:"underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"assistant-copy",onClick:q,type:"button",children:T}),t[28]=q,t[29]=T,t[30]=b):b=t[30];let y;t[31]!==e||t[32]!==l?(y=()=>{l(e)},t[31]=e,t[32]=l,t[33]=y):y=t[33];let v;t[34]!==r?(v=r("Branch from here"),t[34]=r,t[35]=v):v=t[35];let N;t[36]!==y||t[37]!==v?(N=c("button",{className:"underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"assistant-branch",onClick:y,type:"button",children:v}),t[36]=y,t[37]=v,t[38]=N):N=t[38];let k;t[39]!==e||t[40]!==s?(k=()=>{s(e)},t[39]=e,t[40]=s,t[41]=k):k=t[41];let A;t[42]!==r?(A=r("Delete from here"),t[42]=r,t[43]=A):A=t[43];let I;t[44]!==k||t[45]!==A?(I=c("button",{className:"underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"assistant-truncate",onClick:k,type:"button",children:A}),t[44]=k,t[45]=A,t[46]=I):I=t[46];let C;t[47]!==N||t[48]!==I||t[49]!==b?(C=w("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[b,N,I]}),t[47]=N,t[48]=I,t[49]=b,t[50]=C):C=t[50];let F;return t[51]!==d||t[52]!==f||t[53]!==C||t[54]!==p||t[55]!==u||t[56]!==m||t[57]!==x||t[58]!==g?(F=w(d,{label:f,testId:p,children:[u,m,x,g,C]}),t[51]=d,t[52]=f,t[53]=C,t[54]=p,t[55]=u,t[56]=m,t[57]=x,t[58]=g,t[59]=F):F=t[59],F},mt=({assistant:h,ops:t,session:e})=>{const[a,l]=L(""),[n,i]=L(e?.id);e?.id!==n&&(i(e?.id),l(""));const[s,o]=L(void 0),[r,d]=L(void 0),[f,p]=L(void 0),[u,m]=L(void 0),x=st(void 0);Y(()=>()=>{x.current?.abort()},[]);const g=t.pending("chat"),q=t.reason("chat"),{setTurns:T,takeAsk:b,unavailable:y}=h,v=e?.id,N=q==="ai-disabled"||q==="no-ai-binding"||f===v?q:void 0,k=$=>{v!==void 0&&h.branchFrom(v,$)},A=$=>{v!==void 0&&h.truncateFrom(v,$)},I=($,z,j)=>{if($===""||g||x.current!==void 0||e===void 0)return;const H=new AbortController;x.current=H;const K={role:"user",text:$},G=[...z,K];T(e.id,G),o({sessionId:e.id,text:""}),p(e.id),et(t.chat($,z.map(D=>({role:D.role,text:D.text})),e.schema,j,D=>{o(O=>O?.sessionId===e.id?{sessionId:e.id,text:D.type==="delta"?`${O.text}${D.text}`:""}:O)},H.signal).then(D=>{if(D!==void 0&&!H.signal.aborted){d(D.truncated?e.id:void 0);const O={partial:D.partial,...D.pendingApproval===void 0?{}:{pendingApproval:D.pendingApproval},role:"assistant",text:D.reply,toolCalls:D.toolCalls};T(e.id,_=>_.at(-1)===K?[..._,O]:_)}return D}).finally(()=>{x.current=void 0,o(void 0)}))},C=$=>{const z=($??a).trim();z===""||g||x.current!==void 0||e===void 0||(l(""),I(z,e.turns))},F=($,z)=>{if(e===void 0||g||x.current!==void 0)return;const j=e.turns.slice(0,-1),H=j.at(-1);H?.role==="user"&&I(H.text,j.slice(0,-1),{allow:$,sql:z.sql,ticket:z.ticket})},P=h.draft;P!==void 0&&P.id!==u&&(m(P.id),l(P.text));const R=h.pendingAsk;return Y(()=>{R===void 0||R.sessionId!==v||g||y||(b(R.id),queueMicrotask(()=>{C(R.text)}))},[R,v,b,g,y]),{branchHere:k,decide:F,draft:a,live:s,pending:g,reason:N,send:C,setDraft:l,truncatedFor:r,truncateHere:A}},It=h=>{const t=S(39),{assistant:e}=h,a=B();let l;t[0]!==e.activeId?(l=C=>C.id===e.activeId,t[0]=e.activeId,t[1]=l):l=t[1];const n=e.sessions.find(l),i=J(n?.shardKey??""),s=mt({assistant:e,ops:i,session:n});if(i.unavailable||n===void 0)return null;const{turns:o}=n;let r;t[2]!==a?(r=a("Assistant"),t[2]=a,t[3]=r):r=t[3];const d="flex h-full w-96 min-w-0 shrink-0 flex-col border-s border-border bg-card",f="assistant-panel";let p;t[4]!==e.close?(p=c(lt,{onClose:e.close}),t[4]=e.close,t[5]=p):p=t[5];let u;t[6]!==e||t[7]!==a?(u=()=>{e.newChat({title:a("New chat")})},t[6]=e,t[7]=a,t[8]=u):u=t[8];let m;t[9]!==e.activeId||t[10]!==e.deleteChat||t[11]!==e.selectChat||t[12]!==e.sessions||t[13]!==u?(m=c(at,{activeId:e.activeId,onDelete:e.deleteChat,onNew:u,onSelect:e.selectChat,sessions:e.sessions}),t[9]=e.activeId,t[10]=e.deleteChat,t[11]=e.selectChat,t[12]=e.sessions,t[13]=u,t[14]=m):m=t[14];const x=o.length===0&&n.suggestions.length>0&&c(dt,{onPick:C=>{s.send(C)},suggestions:n.suggestions}),g="min-h-0 flex-1 overflow-y-auto",q="assistant-turns",T=o.map((C,F)=>c(ht,{index:F,level:i.level,onBranch:s.branchHere,onDecide:F===o.length-1?s.decide:void 0,onInsert:e.hasEditor?e.requestInsert:void 0,onTruncate:s.truncateHere,turn:C},`${String(F)}:${C.role}`));let b;t[15]!==s.live||t[16]!==n.id?(b=s.live?.sessionId===n.id&&s.live.text!==""&&c(ot,{text:s.live.text}),t[15]=s.live,t[16]=n.id,t[17]=b):b=t[17];let y;t[18]!==T||t[19]!==b?(y=w("ul",{className:g,"data-testid":q,children:[T,b]}),t[18]=T,t[19]=b,t[20]=y):y=t[20];const v=s.truncatedFor===n.id;let N;t[21]!==s.reason||t[22]!==v?(N=c(rt,{reason:s.reason,truncated:v}),t[21]=s.reason,t[22]=v,t[23]=N):N=t[23];let k;t[24]!==s?(k=()=>{s.send()},t[24]=s,t[25]=k):k=t[25];let A;t[26]!==s.draft||t[27]!==s.pending||t[28]!==s.setDraft||t[29]!==k?(A=c(nt,{draft:s.draft,onDraftChange:s.setDraft,onSend:k,pending:s.pending}),t[26]=s.draft,t[27]=s.pending,t[28]=s.setDraft,t[29]=k,t[30]=A):A=t[30];let I;return t[31]!==y||t[32]!==N||t[33]!==A||t[34]!==r||t[35]!==p||t[36]!==m||t[37]!==x?(I=w("section",{"aria-label":r,className:d,"data-testid":f,children:[p,m,x,y,N,A]}),t[31]=y,t[32]=N,t[33]=A,t[34]=r,t[35]=p,t[36]=m,t[37]=x,t[38]=I):I=t[38],I};export{It as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as R}from"react/compiler-runtime";import{useState as k}from"react";import{E as q}from"../packem_shared/error-alert-
|
|
1
|
+
import{c as R}from"react/compiler-runtime";import{useState as k}from"react";import{E as q}from"../packem_shared/error-alert-DKXm5h19.mjs";import{B as j}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as z}from"../packem_shared/button-q0UYSmrn.mjs";import{C as D,a as M}from"../packem_shared/card-By2O8ULa.mjs";import{E as O}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as Q}from"../packem_shared/input-CXhxesPC.mjs";import{T as U,a as $,b as F,c as N,d as G,e as w}from"../packem_shared/table-D0SBiDu-.mjs";import{u as J}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{useT as K}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as V}from"../packem_shared/ADMIN_FUNCTIONS-DUXsXId1.mjs";import{h as W}from"../packem_shared/internal-hIuTpSbx.mjs";import{jsx as a,jsxs as l}from"react/jsx-runtime";const ne=()=>{const e=R(39),t=K(),[o,H]=k("");let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const{data:L,error:i,errorSource:S,isLoading:E,refetch:B}=J(V.getAuthAuditLog,b);let A;if(e[1]!==L?.entries||e[2]!==o){const r=L?.entries??[],x=o.trim().toLowerCase();A=x===""?r:r.filter(C=>C.event.toLowerCase().includes(x)||(C.actorId??"").toLowerCase().includes(x)||(C.actorEmail??"").toLowerCase().includes(x)||(C.ip??"").toLowerCase().includes(x)||C.outcome.toLowerCase().includes(x)),e[1]=L?.entries,e[2]=o,e[3]=A}else A=e[3];const s=A;let I;e[4]===Symbol.for("react.memo_cache_sentinel")?(I=r=>{H(r.target.value)},e[4]=I):I=e[4];const P=I;let c;e[5]!==t?(c=t("Filter security events"),e[5]=t,e[6]=c):c=e[6];let n;e[7]!==t?(n=t("filter event, actor, IP"),e[7]=t,e[8]=n):n=e[8];let d;e[9]!==o||e[10]!==c||e[11]!==n?(d=a(Q,{"aria-label":c,className:"h-8 w-56","data-testid":"aa-search",onChange:P,placeholder:n,value:o}),e[9]=o,e[10]=c,e[11]=n,e[12]=d):d=e[12];let m;e[13]!==B?(m=()=>{B()},e[13]=B,e[14]=m):m=e[14];let u;e[15]!==t?(u=t("Refresh"),e[15]=t,e[16]=u):u=e[16];let h;e[17]!==m||e[18]!==u?(h=a(z,{"data-testid":"aa-refresh",onClick:m,size:"xs",type:"button",variant:"ghost",children:u}),e[17]=m,e[18]=u,e[19]=h):h=e[19];let f;e[20]!==d||e[21]!==h?(f=l("div",{className:"flex flex-wrap items-center gap-2",children:[d,h]}),e[20]=d,e[21]=h,e[22]=f):f=e[22];let p;e[23]!==i||e[24]!==S?(p=i!==null&&a(q,{error:S,testId:"aa-error"}),e[23]=i,e[24]=S,e[25]=p):p=e[25];let g;e[26]!==i||e[27]!==s.length||e[28]!==E||e[29]!==t?(g=i===null&&!E&&s.length===0&&a(O,{description:t("Authentication and security events are recorded here."),testId:"aa-empty",title:t("No security events.")}),e[26]=i,e[27]=s.length,e[28]=E,e[29]=t,e[30]=g):g=e[30];let v;e[31]!==s||e[32]!==t?(v=s.length>0&&a(D,{className:"overflow-hidden py-0",children:a(M,{className:"max-h-[30rem] overflow-auto px-0",children:l(U,{"data-testid":"aa-table",children:[a($,{children:l(F,{children:[a(N,{children:t("time")}),a(N,{children:t("event")}),a(N,{children:t("actor")}),a(N,{children:t("ip / user agent")}),a(N,{children:t("outcome")})]})}),a(G,{children:s.map(r=>l(F,{"data-testid":"aa-row",children:[a(w,{className:"text-muted-foreground tabular-nums",children:W(r.ts,"—")}),a(w,{children:a(j,{variant:"secondary",children:r.event})}),a(w,{className:"max-w-[24ch] truncate font-mono text-xs",title:r.actorId??void 0,children:r.actorEmail??r.actorId??a("span",{className:"text-muted-foreground",children:"—"})}),l(w,{className:"max-w-[28ch] truncate text-xs text-muted-foreground",title:r.userAgent??void 0,children:[r.ip??a("span",{className:"text-muted-foreground",children:"—"}),r.userAgent!==void 0&&l("span",{className:"ml-1 opacity-70",children:["· ",r.userAgent]})]}),a(w,{children:a(j,{variant:r.outcome==="failure"?"destructive":"outline",children:t(r.outcome)})})]},r.seq))})]})})}),e[31]=s,e[32]=t,e[33]=v):v=e[33];let T;return e[34]!==p||e[35]!==g||e[36]!==v||e[37]!==f?(T=l("div",{className:"flex flex-col gap-4","data-testid":"lunora-auth-audit",children:[f,p,g,v]}),e[34]=p,e[35]=g,e[36]=v,e[37]=f,e[38]=T):T=e[38],T};export{ne as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as C}from"react/compiler-runtime";import{L as T}from"../packem_shared/live-status-D1GasNsH.mjs";import{B as b}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as E,a as A}from"../packem_shared/card-By2O8ULa.mjs";import{E as I}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as S,a as _,b as y,c as l,d as L,e as d}from"../packem_shared/table-D0SBiDu-.mjs";import{u as O}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{useT as $}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as k}from"../packem_shared/ADMIN_FUNCTIONS-
|
|
1
|
+
import{c as C}from"react/compiler-runtime";import{L as T}from"../packem_shared/live-status-D1GasNsH.mjs";import{B as b}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as E,a as A}from"../packem_shared/card-By2O8ULa.mjs";import{E as I}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as S,a as _,b as y,c as l,d as L,e as d}from"../packem_shared/table-D0SBiDu-.mjs";import{u as O}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{useT as $}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as k}from"../packem_shared/ADMIN_FUNCTIONS-DUXsXId1.mjs";import{jsxs as h,jsx as n}from"react/jsx-runtime";const g="container:",R={error:"error",sleep:"sleeping",start:"running",stop:"stopped"},B=e=>{const t=e.indexOf(":");if(t===-1)return{event:e.trim()};const a=e.slice(t+1).trim(),s=e.slice(0,t).trim();return a===""?{event:s}:{detail:a,event:s}},D=e=>{const t=new Map;for(const a of e){const s=a.functionPath??"";if(!s.startsWith(g))continue;const i=s.slice(g.length);if(i==="")continue;const r=JSON.stringify([i,a.instance??""]),o=t.get(r);if(o!==void 0&&o.timestamp>=a.timestamp)continue;const{detail:u,event:c}=B(a.message);t.set(r,{detail:u,event:c,exitCode:a.exitCode,instance:a.instance,level:a.level,name:i,state:R[c]??"unknown",timestamp:a.timestamp})}return[...t.values()].toSorted((a,s)=>a.name.localeCompare(s.name)||(a.instance??"").localeCompare(s.instance??""))},M={error:"destructive",running:"success",sleeping:"info",stopped:"outline",unknown:"secondary"},P=e=>{const{entries:t}=e??{};return Array.isArray(t)?t:[]},q=()=>{const e=C(19),t=$();let a,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},s={live:!0,shardKey:""},e[0]=a,e[1]=s):(a=e[0],s=e[1]);const{data:i,error:r,liveError:o}=O(k.getLogs,a,s),u=i!==void 0;let c;if(e[2]!==i||e[3]!==r||e[4]!==o||e[5]!==u||e[6]!==t){const N=D(P(i));let x;e[8]!==r?(x=r!==null&&n("p",{className:"text-sm text-destructive","data-testid":"containers-error",role:"alert",children:r}),e[8]=r,e[9]=x):x=e[9];let m;e[10]!==t?(m=t("Cloudflare Containers are observed from their lifecycle log stream. This shows the current state per instance — ports and health checks aren't carried in that stream."),e[10]=t,e[11]=m):m=e[11];let f;e[12]!==m?(f=n("p",{className:"text-sm text-muted-foreground",children:m}),e[12]=m,e[13]=f):f=e[13];let p;e[14]!==o?(p=n(T,{message:o,prefix:"containers"}),e[14]=o,e[15]=p):p=e[15];let v;e[16]!==f||e[17]!==p?(v=h("div",{className:"flex flex-wrap items-center gap-2",children:[f,p]}),e[16]=f,e[17]=p,e[18]=v):v=e[18],c=h("div",{className:"flex flex-col gap-6","data-testid":"lunora-containers-panel",children:[x,v,u&&N.length===0?n(I,{description:t("No container lifecycle activity yet. Instances declared with defineContainer show up here once they start, sleep, stop, or error."),testId:"containers-empty",title:t("No container activity")}):n(E,{className:"overflow-hidden py-0",children:n(A,{className:"px-0",children:h(S,{"data-testid":"containers-table",children:[n(_,{children:h(y,{children:[n(l,{children:t("Container")}),n(l,{children:t("Instance")}),n(l,{children:t("State")}),n(l,{children:t("Last event")}),n(l,{children:t("Detail")}),n(l,{children:t("Exit")}),n(l,{children:t("When")})]})}),n(L,{children:N.map(j)})]})})})]}),e[2]=i,e[3]=r,e[4]=o,e[5]=u,e[6]=t,e[7]=c}else c=e[7];return c};function j(e){return h(y,{"data-testid":`containers-row-${e.name}${e.instance===void 0?"":`-${e.instance}`}`,children:[n(d,{className:"font-mono text-xs",children:e.name}),n(d,{className:"max-w-40 truncate font-mono text-xs text-muted-foreground",title:e.instance,children:e.instance??"—"}),n(d,{children:n(b,{variant:M[e.state],children:e.state})}),n(d,{className:"font-mono text-xs text-muted-foreground",children:e.event}),n(d,{className:"max-w-64 truncate text-xs text-muted-foreground",title:e.detail,children:e.detail??"—"}),n(d,{className:"font-mono text-xs tabular-nums text-muted-foreground",children:e.exitCode??"—"}),n(d,{className:"text-xs tabular-nums text-muted-foreground",children:new Date(e.timestamp).toLocaleString()})]},`${e.name}/${e.instance??""}`)}export{q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as J}from"react/compiler-runtime";import{useState as X,useEffect as fe,useRef as ue}from"react";import{A as ne}from"../packem_shared/alert-PB5W11MM.mjs";import{B as Y}from"../packem_shared/button-q0UYSmrn.mjs";import{c as he,b as ge,a as re,C as ae}from"../packem_shared/card-By2O8ULa.mjs";import{E as me}from"../packem_shared/empty-state-D7jEML_T.mjs";import{useT as te}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{u as be,n as ve}from"../packem_shared/browser-storage-BH1MxLZs.mjs";import{c as pe,d as xe,b as Ce,f as de,l as ke}from"../packem_shared/internal-hIuTpSbx.mjs";import{u as ye}from"../packem_shared/use-sql-assistant-rZPs3LC3.mjs";import{S as we,a as Se}from"../packem_shared/sql-result-table-DCwooMGW.mjs";import{u as Ne}from"../packem_shared/use-studio-client-DCA50tF2.mjs";import{ADMIN_FUNCTIONS as Ke}from"../packem_shared/ADMIN_FUNCTIONS-4aGsMs95.mjs";import{jsx as d,jsxs as Z}from"react/jsx-runtime";const Re=pe(Ke.runSql),Le=(b,e)=>{const t=J(11),n=Ne(),[r,s]=X(void 0),[a,o]=X(void 0),[c,v]=X(!0);let h;t[0]!==n||t[1]!==e||t[2]!==b?(h=async f=>{v(!0);try{const y=await n.query(Re,{sql:b},xe(e));f.cancelled||(s(y),o(void 0))}catch(y){const x=y;f.cancelled||(s(void 0),o(Ce(x)))}f.cancelled||v(!1)},t[0]=n,t[1]=e,t[2]=b,t[3]=h):h=t[3];const i=h;let l,g;t[4]!==i?(l=()=>{const f={cancelled:!1};return de(i(f)),()=>{f.cancelled=!0}},g=[i],t[4]=i,t[5]=l,t[6]=g):(l=t[5],g=t[6]),fe(l,g);let N;return t[7]!==a||t[8]!==c||t[9]!==r?(N={error:a,loading:c,result:r},t[7]=a,t[8]=c,t[9]=r,t[10]=N):N=t[10],N},Me=b=>{b.preventDefault()},le=b=>b.kind??"chart",ce=b=>{const e=J(80),{actions:t,children:n,draggedRef:r,first:s,last:a,onEdit:o,onMove:c,onRemove:v,onReorder:h,widget:i}=b,l=te();let g;e[0]!==c||e[1]!==i.id?(g=()=>{c(i.id,-1)},e[0]=c,e[1]=i.id,e[2]=g):g=e[2];const N=g;let f;e[3]!==c||e[4]!==i.id?(f=()=>{c(i.id,1)},e[3]=c,e[4]=i.id,e[5]=f):f=e[5];const y=f;let x;e[6]!==o||e[7]!==i.id?(x=()=>{o(i.id)},e[6]=o,e[7]=i.id,e[8]=x):x=e[8];const q=x;let O;e[9]!==v||e[10]!==i.id?(O=()=>{v(i.id)},e[9]=v,e[10]=i.id,e[11]=O):O=e[11];const E=O;let z;e[12]!==r||e[13]!==i.id?(z=()=>{r.current=i.id},e[12]=r,e[13]=i.id,e[14]=z):z=e[14];const C=z;let K;e[15]!==r||e[16]!==h||e[17]!==i.id?(K=()=>{const se=r.current;r.current=null,se!==null&&se!==i.id&&h(se,i.id)},e[15]=r,e[16]=h,e[17]=i.id,e[18]=K):K=e[18];const W=K,S=`dashboards-widget-${i.id}`;let k;e[19]!==i.title?(k=d(he,{className:"min-w-0 cursor-grab truncate",title:i.title,children:i.title}),e[19]=i.title,e[20]=k):k=e[20];let w;e[21]!==l?(w=l("Move widget up"),e[21]=l,e[22]=w):w=e[22];const _=`dashboards-move-up-${i.id}`;let Q;e[23]!==l?(Q=l("Move widget up"),e[23]=l,e[24]=Q):Q=e[24];let B;e[25]===Symbol.for("react.memo_cache_sentinel")?(B=d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"m6 15 6-6 6 6"})}),e[25]=B):B=e[25];let I;e[26]!==s||e[27]!==N||e[28]!==_||e[29]!==Q||e[30]!==w?(I=d(Y,{"aria-label":w,"data-testid":_,disabled:s,onClick:N,size:"icon-xs",title:Q,type:"button",variant:"ghost",children:B}),e[26]=s,e[27]=N,e[28]=_,e[29]=Q,e[30]=w,e[31]=I):I=e[31];let R;e[32]!==l?(R=l("Move widget down"),e[32]=l,e[33]=R):R=e[33];const $=`dashboards-move-down-${i.id}`;let L;e[34]!==l?(L=l("Move widget down"),e[34]=l,e[35]=L):L=e[35];let A;e[36]===Symbol.for("react.memo_cache_sentinel")?(A=d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"m6 9 6 6 6-6"})}),e[36]=A):A=e[36];let M;e[37]!==a||e[38]!==y||e[39]!==R||e[40]!==$||e[41]!==L?(M=d(Y,{"aria-label":R,"data-testid":$,disabled:a,onClick:y,size:"icon-xs",title:L,type:"button",variant:"ghost",children:A}),e[37]=a,e[38]=y,e[39]=R,e[40]=$,e[41]=L,e[42]=M):M=e[42];let D;e[43]!==l?(D=l("Edit widget"),e[43]=l,e[44]=D):D=e[44];const j=`dashboards-widget-edit-${i.id}`;let T;e[45]!==l?(T=l("Edit widget"),e[45]=l,e[46]=T):T=e[46];let p;e[47]===Symbol.for("react.memo_cache_sentinel")?(p=d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"M4 20h4L18 10l-4-4L4 16v4ZM14 6l4 4"})}),e[47]=p):p=e[47];let m;e[48]!==q||e[49]!==D||e[50]!==j||e[51]!==T?(m=d(Y,{"aria-label":D,"data-testid":j,onClick:q,size:"icon-xs",title:T,type:"button",variant:"ghost",children:p}),e[48]=q,e[49]=D,e[50]=j,e[51]=T,e[52]=m):m=e[52];let u;e[53]!==l?(u=l("Remove widget"),e[53]=l,e[54]=u):u=e[54];const F=`dashboards-widget-remove-${i.id}`;let U;e[55]!==l?(U=l("Remove widget"),e[55]=l,e[56]=U):U=e[56];let V;e[57]===Symbol.for("react.memo_cache_sentinel")?(V=d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"})}),e[57]=V):V=e[57];let H;e[58]!==E||e[59]!==u||e[60]!==F||e[61]!==U?(H=d(Y,{"aria-label":u,"data-testid":F,onClick:E,size:"icon-xs",title:U,type:"button",variant:"ghost",children:V}),e[58]=E,e[59]=u,e[60]=F,e[61]=U,e[62]=H):H=e[62];let P;e[63]!==t||e[64]!==I||e[65]!==M||e[66]!==m||e[67]!==H?(P=Z("div",{className:"flex shrink-0 items-center gap-1",children:[t,I,M,m,H]}),e[63]=t,e[64]=I,e[65]=M,e[66]=m,e[67]=H,e[68]=P):P=e[68];let G;e[69]!==P||e[70]!==k?(G=Z(ge,{className:"flex flex-row items-start justify-between gap-2 border-b pb-3",children:[k,P]}),e[69]=P,e[70]=k,e[71]=G):G=e[71];let ee;e[72]!==n?(ee=d(re,{className:"min-h-32 py-2",children:n}),e[72]=n,e[73]=ee):ee=e[73];let ie;return e[74]!==C||e[75]!==W||e[76]!==G||e[77]!==ee||e[78]!==S?(ie=Z(ae,{"data-testid":S,draggable:!0,onDragOver:Me,onDragStart:C,onDrop:W,children:[G,ee]}),e[74]=C,e[75]=W,e[76]=G,e[77]=ee,e[78]=S,e[79]=ie):ie=e[79],ie},qe=b=>{const e=J(10),{result:t}=b,n=te(),r=t.columns[0],s=r===void 0?void 0:t.rows[0]?.[r];let a;e[0]!==s||e[1]!==n?(a=s===void 0?n("—"):ke(s),e[0]=s,e[1]=n,e[2]=a):a=e[2];let o;e[3]!==a?(o=d("p",{className:"truncate font-mono text-3xl font-semibold text-foreground",children:a}),e[3]=a,e[4]=o):o=e[4];let c;e[5]!==r?(c=r!==void 0&&d("p",{className:"truncate text-xs text-muted-foreground",children:r}),e[5]=r,e[6]=c):c=e[6];let v;return e[7]!==o||e[8]!==c?(v=Z("div",{className:"flex h-full flex-col justify-center gap-1 p-4","data-testid":"dashboards-kpi",children:[o,c]}),e[7]=o,e[8]=c,e[9]=v):v=e[9],v},Ee=b=>{const e=J(12),{draggedRef:t,first:n,last:r,onEdit:s,onMove:a,onRemove:o,onReorder:c,widget:v}=b,h=v.text??"";let i;e[0]!==h?(i=d("p",{className:"p-2 text-sm whitespace-pre-wrap text-muted-foreground","data-testid":"dashboards-text",children:h}),e[0]=h,e[1]=i):i=e[1];let l;return e[2]!==t||e[3]!==n||e[4]!==r||e[5]!==s||e[6]!==a||e[7]!==o||e[8]!==c||e[9]!==i||e[10]!==v?(l=d(ce,{draggedRef:t,first:n,last:r,onEdit:s,onMove:a,onRemove:o,onReorder:c,widget:v,children:i}),e[2]=t,e[3]=n,e[4]=r,e[5]=s,e[6]=a,e[7]=o,e[8]=c,e[9]=i,e[10]=v,e[11]=l):l=e[11],l},Ae=b=>{const e=J(52),{draggedRef:t,first:n,inferring:r,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,onSuggest:h,widget:i}=b,l=te(),{error:g,loading:N,result:f}=Le(i.sql,i.shardKey??"");let y;e[0]!==i?(y=le(i),e[0]=i,e[1]=y):y=e[1];const x=y;let q;e[2]!==h||e[3]!==f||e[4]!==i.id?(q=()=>{f!==void 0&&h?.(i.id,f)},e[2]=h,e[3]=f,e[4]=i.id,e[5]=q):q=e[5];const O=q;let E;e[6]!==r||e[7]!==x||e[8]!==h||e[9]!==O||e[10]!==f||e[11]!==l||e[12]!==i.id?(E=x==="chart"&&h!==void 0&&f!==void 0?d(Y,{"aria-label":l("Suggest chart"),"data-testid":`dashboards-widget-suggest-${i.id}`,disabled:r,onClick:O,size:"icon-xs",title:l(r?"Suggesting…":"Suggest chart"),type:"button",variant:"ghost",children:d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"m12 3 1.9 4.6L18.5 9.5 13.9 11.4 12 16l-1.9-4.6L5.5 9.5l4.6-1.9L12 3ZM18 15l.9 2.1 2.1.9-2.1.9L18 21l-.9-2.1-2.1-.9 2.1-.9L18 15Z"})})}):void 0,e[6]=r,e[7]=x,e[8]=h,e[9]=O,e[10]=f,e[11]=l,e[12]=i.id,e[13]=E):E=e[13];const z=E;let C;e[14]!==g||e[15]!==i.id?(C=g!==void 0&&d(ne,{className:"font-mono text-xs",testId:`dashboards-widget-error-${i.id}`,variant:"destructive",children:g}),e[14]=g,e[15]=i.id,e[16]=C):C=e[16];let K;e[17]!==g||e[18]!==N||e[19]!==f||e[20]!==l||e[21]!==i.id?(K=g===void 0&&N&&f===void 0&&d("p",{className:"p-4 text-sm text-muted-foreground","data-testid":`dashboards-widget-loading-${i.id}`,children:l("Running…")}),e[17]=g,e[18]=N,e[19]=f,e[20]=l,e[21]=i.id,e[22]=K):K=e[22];let W;e[23]!==g||e[24]!==x||e[25]!==f||e[26]!==i.chartAxes||e[27]!==i.chartKind?(W=g===void 0&&f!==void 0&&x==="chart"&&d(we,{axes:i.chartAxes,kind:i.chartKind,result:f}),e[23]=g,e[24]=x,e[25]=f,e[26]=i.chartAxes,e[27]=i.chartKind,e[28]=W):W=e[28];let S;e[29]!==g||e[30]!==x||e[31]!==f?(S=g===void 0&&f!==void 0&&x==="kpi"&&d(qe,{result:f}),e[29]=g,e[30]=x,e[31]=f,e[32]=S):S=e[32];let k;e[33]!==g||e[34]!==x||e[35]!==f?(k=g===void 0&&f!==void 0&&x==="table"&&d("div",{className:"max-h-72 overflow-auto",children:d(Se,{result:f})}),e[33]=g,e[34]=x,e[35]=f,e[36]=k):k=e[36];let w;return e[37]!==t||e[38]!==n||e[39]!==s||e[40]!==a||e[41]!==o||e[42]!==c||e[43]!==v||e[44]!==z||e[45]!==C||e[46]!==K||e[47]!==W||e[48]!==S||e[49]!==k||e[50]!==i?(w=Z(ce,{actions:z,draggedRef:t,first:n,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,widget:i,children:[C,K,W,S,k]}),e[37]=t,e[38]=n,e[39]=s,e[40]=a,e[41]=o,e[42]=c,e[43]=v,e[44]=z,e[45]=C,e[46]=K,e[47]=W,e[48]=S,e[49]=k,e[50]=i,e[51]=w):w=e[51],w},Te=b=>{const e=J(11),{draggedRef:t,first:n,inferring:r,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,onSuggest:h,widget:i}=b;let l;return e[0]!==t||e[1]!==n||e[2]!==r||e[3]!==s||e[4]!==a||e[5]!==o||e[6]!==c||e[7]!==v||e[8]!==h||e[9]!==i?(l=le(i)==="text"?d(Ee,{draggedRef:t,first:n,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,widget:i}):d(Ae,{draggedRef:t,first:n,inferring:r,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,onSuggest:h,widget:i}),e[0]=t,e[1]=n,e[2]=r,e[3]=s,e[4]=a,e[5]=o,e[6]=c,e[7]=v,e[8]=h,e[9]=i,e[10]=l):l=e[10],l},We=["bar","line","area"],Ie=["chart","kpi","table","text"],$e="lunora-studio-dashboards",oe={chartKind:"bar",kind:"chart",shardKey:"",sql:"",text:"",title:""},De=(b,e)=>t=>t.map(n=>n.id===b?{...n,chartAxes:e,chartKind:e.kind}:n),je=(b,e)=>t=>{const n=t.find(a=>a.id===b),r=t.filter(a=>a.id!==b),s=r.findIndex(a=>a.id===e);return n===void 0||s===-1?t:[...r.slice(0,s),n,...r.slice(s)]},ze=(b,e)=>e(b==="line"?"Line":b==="area"?"Area":"Bar"),Be=(b,e)=>e(b==="kpi"?"Single value":b==="table"?"Table":b==="text"?"Text":"Chart"),Fe=b=>{const e=J(82),{draft:t,editing:n,onCancel:r,onChange:s,onSubmit:a}=b,o=te();let c;e[0]!==t||e[1]!==s?(c=u=>{s({...t,title:u.target.value})},e[0]=t,e[1]=s,e[2]=c):c=e[2];const v=c;let h;e[3]!==t||e[4]!==s?(h=u=>{s({...t,sql:u.target.value})},e[3]=t,e[4]=s,e[5]=h):h=e[5];const i=h;let l;e[6]!==t||e[7]!==s?(l=u=>{s({...t,text:u.target.value})},e[6]=t,e[7]=s,e[8]=l):l=e[8];const g=l;let N;e[9]!==t||e[10]!==s?(N=u=>{s({...t,shardKey:u.target.value})},e[9]=t,e[10]=s,e[11]=N):N=e[11];const f=N;let y;e[12]!==t||e[13]!==s?(y=u=>{s({...t,chartKind:u.target.value})},e[12]=t,e[13]=s,e[14]=y):y=e[14];const x=y;let q;e[15]!==t||e[16]!==s?(q=u=>{s({...t,kind:u.target.value})},e[15]=t,e[16]=s,e[17]=q):q=e[17];const O=q;let E;e[18]!==a?(E=()=>{a()},e[18]=a,e[19]=E):E=e[19];const z=E,C=t.kind==="text";let K;e[20]!==t.sql||e[21]!==t.text||e[22]!==t.title||e[23]!==C?(K=t.title.trim()!==""&&(C?t.text.trim()!=="":t.sql.trim()!==""),e[20]=t.sql,e[21]=t.text,e[22]=t.title,e[23]=C,e[24]=K):K=e[24];const W=K;let S;e[25]!==o?(S=o("Widget title"),e[25]=o,e[26]=S):S=e[26];let k;e[27]!==o?(k=o("Widget title"),e[27]=o,e[28]=k):k=e[28];let w;e[29]!==t.title||e[30]!==v||e[31]!==k||e[32]!==S?(w=d("input",{"aria-label":S,className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-title",onChange:v,placeholder:k,type:"text",value:t.title}),e[29]=t.title,e[30]=v,e[31]=k,e[32]=S,e[33]=w):w=e[33];let _;e[34]!==o?(_=o("Widget type"),e[34]=o,e[35]=_):_=e[35];const Q=t.kind;let B;e[36]!==o?(B=Ie.map(u=>d("option",{value:u,children:Be(u,o)},u)),e[36]=o,e[37]=B):B=e[37];let I;e[38]!==t.kind||e[39]!==O||e[40]!==_||e[41]!==B?(I=d("select",{"aria-label":_,className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-widget-kind",onChange:O,value:Q,children:B}),e[38]=t.kind,e[39]=O,e[40]=_,e[41]=B,e[42]=I):I=e[42];let R;e[43]!==t.sql||e[44]!==t.text||e[45]!==C||e[46]!==i||e[47]!==g||e[48]!==o?(R=C?d("textarea",{"aria-label":o("Text"),className:"min-h-24 resize-y rounded-md border border-border bg-background p-2 text-xs leading-5 outline-none focus-visible:border-ring","data-testid":"dashboards-form-text",onChange:g,placeholder:o("Notes for whoever reads this dashboard."),value:t.text}):d("textarea",{"aria-label":o("SQL query"),className:"min-h-24 resize-y rounded-md border border-border bg-background p-2 font-mono text-xs leading-5 outline-none focus-visible:border-ring","data-testid":"dashboards-form-sql",onChange:i,placeholder:"SELECT author, COUNT(*) AS messages FROM …",spellCheck:!1,value:t.sql}),e[43]=t.sql,e[44]=t.text,e[45]=C,e[46]=i,e[47]=g,e[48]=o,e[49]=R):R=e[49];let $;e[50]!==t.chartKind||e[51]!==t.kind||e[52]!==x||e[53]!==o?($=t.kind==="chart"&&d("select",{"aria-label":o("Chart type"),className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-kind",onChange:x,value:t.chartKind,children:We.map(u=>d("option",{value:u,children:ze(u,o)},u))}),e[50]=t.chartKind,e[51]=t.kind,e[52]=x,e[53]=o,e[54]=$):$=e[54];let L;e[55]!==t.shardKey||e[56]!==C||e[57]!==f||e[58]!==o?(L=!C&&d("input",{"aria-label":o("Shard key (optional)"),className:"h-8 rounded-md border border-border bg-background px-2 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-shard",onChange:f,placeholder:o("Shard key (optional)"),type:"text",value:t.shardKey}),e[55]=t.shardKey,e[56]=C,e[57]=f,e[58]=o,e[59]=L):L=e[59];let A;e[60]!==o?(A=o("Cancel"),e[60]=o,e[61]=A):A=e[61];let M;e[62]!==r||e[63]!==A?(M=d(Y,{"data-testid":"dashboards-form-cancel",onClick:r,size:"sm",type:"button",variant:"outline",children:A}),e[62]=r,e[63]=A,e[64]=M):M=e[64];const D=!W;let j;e[65]!==n||e[66]!==o?(j=o(n?"Save widget":"Add widget"),e[65]=n,e[66]=o,e[67]=j):j=e[67];let T;e[68]!==z||e[69]!==D||e[70]!==j?(T=d(Y,{"data-testid":"dashboards-form-save",disabled:D,onClick:z,size:"sm",type:"button",children:j}),e[68]=z,e[69]=D,e[70]=j,e[71]=T):T=e[71];let p;e[72]!==M||e[73]!==T?(p=Z("div",{className:"flex items-center justify-end gap-2",children:[M,T]}),e[72]=M,e[73]=T,e[74]=p):p=e[74];let m;return e[75]!==w||e[76]!==I||e[77]!==R||e[78]!==$||e[79]!==L||e[80]!==p?(m=d(ae,{"data-testid":"dashboards-form",children:Z(re,{className:"flex flex-col gap-3 py-4",children:[w,I,R,$,L,p]})}),e[75]=w,e[76]=I,e[77]=R,e[78]=$,e[79]=L,e[80]=p,e[81]=m):m=e[81],m},it=b=>{const e=J(53),{initialShardKey:t}=b,n=te(),[r,s]=be($e),[a,o]=X(oe),[c,v]=X(null),[h,i]=X(!1),l=ye(t??""),[g,N]=X(null),f=ue(null);let y;e[0]!==t?(y=()=>{v(null),o({...oe,shardKey:t??""}),i(!0)},e[0]=t,e[1]=y):y=e[1];const x=y;let q;e[2]===Symbol.for("react.memo_cache_sentinel")?(q=()=>{i(!1),v(null),o(oe)},e[2]=q):q=e[2];const O=q;let E;e[3]!==r?(E=p=>{const m=r.find(u=>u.id===p);m!==void 0&&(v(p),o({chartKind:m.chartKind??"bar",kind:le(m),shardKey:m.shardKey??"",sql:m.sql,text:m.text??"",title:m.title}),i(!0))},e[3]=r,e[4]=E):E=e[4];const z=E;let C;e[5]!==l||e[6]!==s?(C=(p,m)=>{N(p),de((async()=>{const F=await l.inferChart({columns:m.columns,rowCount:m.rowCount});F!==void 0&&s(De(p,F))})().finally(()=>{N(F=>F===p?null:F)}))},e[5]=l,e[6]=s,e[7]=C):C=e[7];const K=C;let W;e[8]!==s?(W=p=>{s(m=>m.filter(u=>u.id!==p))},e[8]=s,e[9]=W):W=e[9];const S=W;let k;e[10]!==s?(k=(p,m)=>{s(je(p,m))},e[10]=s,e[11]=k):k=e[11];const w=k;let _;e[12]!==s?(_=(p,m)=>{s(u=>{const F=u.findIndex(G=>G.id===p),U=F+m;if(F===-1||U<0||U>=u.length)return u;const V=[...u],H=V[F],P=V[U];return H===void 0||P===void 0?u:(V[F]=P,V[U]=H,V)})},e[12]=s,e[13]=_):_=e[13];const Q=_;let B;e[14]!==a||e[15]!==c||e[16]!==s?(B=()=>{const p=a.title.trim(),m=a.sql.trim(),u=a.text.trim(),{chartKind:F,kind:U}=a;if(p===""||(U==="text"?u==="":m===""))return;const V={chartKind:F,kind:U,shardKey:a.shardKey.trim(),sql:m,text:u,title:p};s(c===null?H=>[...H,{...V,id:ve("w")}]:H=>H.map(P=>P.id===c?{...P,...V}:P)),O()},e[14]=a,e[15]=c,e[16]=s,e[17]=B):B=e[17];const I=B;let R;e[18]!==n?(R=n("Charts, values, tables, and notes. Drag a tile to reorder."),e[18]=n,e[19]=R):R=e[19];let $;e[20]!==R?($=d("p",{className:"text-sm text-muted-foreground",children:R}),e[20]=R,e[21]=$):$=e[21];let L;e[22]!==h||e[23]!==x||e[24]!==n?(L=!h&&d(Y,{"data-testid":"dashboards-add",onClick:x,size:"sm",type:"button",children:n("Add widget")}),e[22]=h,e[23]=x,e[24]=n,e[25]=L):L=e[25];let A;e[26]!==$||e[27]!==L?(A=Z("div",{className:"flex items-center justify-between",children:[$,L]}),e[26]=$,e[27]=L,e[28]=A):A=e[28];let M;e[29]!==l||e[30]!==n?(M=l.reason("chart")!==void 0&&d(ne,{className:"text-xs",testId:"dashboards-suggest-error",variant:"destructive",children:n("Could not suggest a chart for that result.")}),e[29]=l,e[30]=n,e[31]=M):M=e[31];let D;e[32]!==a||e[33]!==c||e[34]!==h||e[35]!==I?(D=h&&d(Fe,{draft:a,editing:c!==null,onCancel:O,onChange:o,onSubmit:I}),e[32]=a,e[33]=c,e[34]=h,e[35]=I,e[36]=D):D=e[36];let j;e[37]!==l.unavailable||e[38]!==h||e[39]!==g||e[40]!==z||e[41]!==Q||e[42]!==S||e[43]!==w||e[44]!==K||e[45]!==n||e[46]!==r?(j=r.length===0&&!h?d(me,{description:n("Add a chart, a single value, a table, or a note. Everything is saved on this browser."),testId:"dashboards-empty",title:n("No widgets yet")}):d("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3","data-testid":"dashboards-grid",children:r.map((p,m)=>d(Te,{draggedRef:f,first:m===0,inferring:g===p.id,last:m===r.length-1,onEdit:z,onMove:Q,onRemove:S,onReorder:w,onSuggest:l.unavailable?void 0:K,widget:p},p.id))}),e[37]=l.unavailable,e[38]=h,e[39]=g,e[40]=z,e[41]=Q,e[42]=S,e[43]=w,e[44]=K,e[45]=n,e[46]=r,e[47]=j):j=e[47];let T;return e[48]!==A||e[49]!==M||e[50]!==D||e[51]!==j?(T=Z("div",{className:"flex flex-col gap-4","data-testid":"lunora-dashboards",children:[A,M,D,j]}),e[48]=A,e[49]=M,e[50]=D,e[51]=j,e[52]=T):T=e[52],T};export{it as default};
|
|
1
|
+
import{c as J}from"react/compiler-runtime";import{useState as X,useEffect as fe,useRef as ue}from"react";import{A as ne}from"../packem_shared/alert-PB5W11MM.mjs";import{B as Y}from"../packem_shared/button-q0UYSmrn.mjs";import{c as he,b as ge,a as re,C as ae}from"../packem_shared/card-By2O8ULa.mjs";import{E as me}from"../packem_shared/empty-state-D7jEML_T.mjs";import{u as be}from"../packem_shared/use-assistant-rpc-GCUK2zPa.mjs";import{useT as te}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{u as ve,n as pe}from"../packem_shared/browser-storage-BH1MxLZs.mjs";import{c as xe,d as Ce,b as ke,f as de,l as ye}from"../packem_shared/internal-hIuTpSbx.mjs";import{S as we,a as Se}from"../packem_shared/sql-result-table-DCwooMGW.mjs";import{u as Ne}from"../packem_shared/use-studio-client-DCA50tF2.mjs";import{ADMIN_FUNCTIONS as Re}from"../packem_shared/ADMIN_FUNCTIONS-DUXsXId1.mjs";import{jsx as d,jsxs as Z}from"react/jsx-runtime";const Ke=xe(Re.runSql),Le=(b,e)=>{const t=J(11),n=Ne(),[r,s]=X(void 0),[a,o]=X(void 0),[c,v]=X(!0);let h;t[0]!==n||t[1]!==e||t[2]!==b?(h=async f=>{v(!0);try{const y=await n.query(Ke,{sql:b},Ce(e));f.cancelled||(s(y),o(void 0))}catch(y){const x=y;f.cancelled||(s(void 0),o(ke(x)))}f.cancelled||v(!1)},t[0]=n,t[1]=e,t[2]=b,t[3]=h):h=t[3];const i=h;let l,g;t[4]!==i?(l=()=>{const f={cancelled:!1};return de(i(f)),()=>{f.cancelled=!0}},g=[i],t[4]=i,t[5]=l,t[6]=g):(l=t[5],g=t[6]),fe(l,g);let N;return t[7]!==a||t[8]!==c||t[9]!==r?(N={error:a,loading:c,result:r},t[7]=a,t[8]=c,t[9]=r,t[10]=N):N=t[10],N},Me=b=>{b.preventDefault()},le=b=>b.kind??"chart",ce=b=>{const e=J(80),{actions:t,children:n,draggedRef:r,first:s,last:a,onEdit:o,onMove:c,onRemove:v,onReorder:h,widget:i}=b,l=te();let g;e[0]!==c||e[1]!==i.id?(g=()=>{c(i.id,-1)},e[0]=c,e[1]=i.id,e[2]=g):g=e[2];const N=g;let f;e[3]!==c||e[4]!==i.id?(f=()=>{c(i.id,1)},e[3]=c,e[4]=i.id,e[5]=f):f=e[5];const y=f;let x;e[6]!==o||e[7]!==i.id?(x=()=>{o(i.id)},e[6]=o,e[7]=i.id,e[8]=x):x=e[8];const E=x;let O;e[9]!==v||e[10]!==i.id?(O=()=>{v(i.id)},e[9]=v,e[10]=i.id,e[11]=O):O=e[11];const q=O;let z;e[12]!==r||e[13]!==i.id?(z=()=>{r.current=i.id},e[12]=r,e[13]=i.id,e[14]=z):z=e[14];const C=z;let R;e[15]!==r||e[16]!==h||e[17]!==i.id?(R=()=>{const se=r.current;r.current=null,se!==null&&se!==i.id&&h(se,i.id)},e[15]=r,e[16]=h,e[17]=i.id,e[18]=R):R=e[18];const W=R,S=`dashboards-widget-${i.id}`;let k;e[19]!==i.title?(k=d(he,{className:"min-w-0 cursor-grab truncate",title:i.title,children:i.title}),e[19]=i.title,e[20]=k):k=e[20];let w;e[21]!==l?(w=l("Move widget up"),e[21]=l,e[22]=w):w=e[22];const _=`dashboards-move-up-${i.id}`;let Q;e[23]!==l?(Q=l("Move widget up"),e[23]=l,e[24]=Q):Q=e[24];let B;e[25]===Symbol.for("react.memo_cache_sentinel")?(B=d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"m6 15 6-6 6 6"})}),e[25]=B):B=e[25];let I;e[26]!==s||e[27]!==N||e[28]!==_||e[29]!==Q||e[30]!==w?(I=d(Y,{"aria-label":w,"data-testid":_,disabled:s,onClick:N,size:"icon-xs",title:Q,type:"button",variant:"ghost",children:B}),e[26]=s,e[27]=N,e[28]=_,e[29]=Q,e[30]=w,e[31]=I):I=e[31];let K;e[32]!==l?(K=l("Move widget down"),e[32]=l,e[33]=K):K=e[33];const $=`dashboards-move-down-${i.id}`;let L;e[34]!==l?(L=l("Move widget down"),e[34]=l,e[35]=L):L=e[35];let A;e[36]===Symbol.for("react.memo_cache_sentinel")?(A=d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"m6 9 6 6 6-6"})}),e[36]=A):A=e[36];let M;e[37]!==a||e[38]!==y||e[39]!==K||e[40]!==$||e[41]!==L?(M=d(Y,{"aria-label":K,"data-testid":$,disabled:a,onClick:y,size:"icon-xs",title:L,type:"button",variant:"ghost",children:A}),e[37]=a,e[38]=y,e[39]=K,e[40]=$,e[41]=L,e[42]=M):M=e[42];let D;e[43]!==l?(D=l("Edit widget"),e[43]=l,e[44]=D):D=e[44];const j=`dashboards-widget-edit-${i.id}`;let T;e[45]!==l?(T=l("Edit widget"),e[45]=l,e[46]=T):T=e[46];let p;e[47]===Symbol.for("react.memo_cache_sentinel")?(p=d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"M4 20h4L18 10l-4-4L4 16v4ZM14 6l4 4"})}),e[47]=p):p=e[47];let m;e[48]!==E||e[49]!==D||e[50]!==j||e[51]!==T?(m=d(Y,{"aria-label":D,"data-testid":j,onClick:E,size:"icon-xs",title:T,type:"button",variant:"ghost",children:p}),e[48]=E,e[49]=D,e[50]=j,e[51]=T,e[52]=m):m=e[52];let u;e[53]!==l?(u=l("Remove widget"),e[53]=l,e[54]=u):u=e[54];const F=`dashboards-widget-remove-${i.id}`;let U;e[55]!==l?(U=l("Remove widget"),e[55]=l,e[56]=U):U=e[56];let V;e[57]===Symbol.for("react.memo_cache_sentinel")?(V=d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"})}),e[57]=V):V=e[57];let H;e[58]!==q||e[59]!==u||e[60]!==F||e[61]!==U?(H=d(Y,{"aria-label":u,"data-testid":F,onClick:q,size:"icon-xs",title:U,type:"button",variant:"ghost",children:V}),e[58]=q,e[59]=u,e[60]=F,e[61]=U,e[62]=H):H=e[62];let P;e[63]!==t||e[64]!==I||e[65]!==M||e[66]!==m||e[67]!==H?(P=Z("div",{className:"flex shrink-0 items-center gap-1",children:[t,I,M,m,H]}),e[63]=t,e[64]=I,e[65]=M,e[66]=m,e[67]=H,e[68]=P):P=e[68];let G;e[69]!==P||e[70]!==k?(G=Z(ge,{className:"flex flex-row items-start justify-between gap-2 border-b pb-3",children:[k,P]}),e[69]=P,e[70]=k,e[71]=G):G=e[71];let ee;e[72]!==n?(ee=d(re,{className:"min-h-32 py-2",children:n}),e[72]=n,e[73]=ee):ee=e[73];let ie;return e[74]!==C||e[75]!==W||e[76]!==G||e[77]!==ee||e[78]!==S?(ie=Z(ae,{"data-testid":S,draggable:!0,onDragOver:Me,onDragStart:C,onDrop:W,children:[G,ee]}),e[74]=C,e[75]=W,e[76]=G,e[77]=ee,e[78]=S,e[79]=ie):ie=e[79],ie},Ee=b=>{const e=J(10),{result:t}=b,n=te(),r=t.columns[0],s=r===void 0?void 0:t.rows[0]?.[r];let a;e[0]!==s||e[1]!==n?(a=s===void 0?n("—"):ye(s),e[0]=s,e[1]=n,e[2]=a):a=e[2];let o;e[3]!==a?(o=d("p",{className:"truncate font-mono text-3xl font-semibold text-foreground",children:a}),e[3]=a,e[4]=o):o=e[4];let c;e[5]!==r?(c=r!==void 0&&d("p",{className:"truncate text-xs text-muted-foreground",children:r}),e[5]=r,e[6]=c):c=e[6];let v;return e[7]!==o||e[8]!==c?(v=Z("div",{className:"flex h-full flex-col justify-center gap-1 p-4","data-testid":"dashboards-kpi",children:[o,c]}),e[7]=o,e[8]=c,e[9]=v):v=e[9],v},qe=b=>{const e=J(12),{draggedRef:t,first:n,last:r,onEdit:s,onMove:a,onRemove:o,onReorder:c,widget:v}=b,h=v.text??"";let i;e[0]!==h?(i=d("p",{className:"p-2 text-sm whitespace-pre-wrap text-muted-foreground","data-testid":"dashboards-text",children:h}),e[0]=h,e[1]=i):i=e[1];let l;return e[2]!==t||e[3]!==n||e[4]!==r||e[5]!==s||e[6]!==a||e[7]!==o||e[8]!==c||e[9]!==i||e[10]!==v?(l=d(ce,{draggedRef:t,first:n,last:r,onEdit:s,onMove:a,onRemove:o,onReorder:c,widget:v,children:i}),e[2]=t,e[3]=n,e[4]=r,e[5]=s,e[6]=a,e[7]=o,e[8]=c,e[9]=i,e[10]=v,e[11]=l):l=e[11],l},Ae=b=>{const e=J(52),{draggedRef:t,first:n,inferring:r,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,onSuggest:h,widget:i}=b,l=te(),{error:g,loading:N,result:f}=Le(i.sql,i.shardKey??"");let y;e[0]!==i?(y=le(i),e[0]=i,e[1]=y):y=e[1];const x=y;let E;e[2]!==h||e[3]!==f||e[4]!==i.id?(E=()=>{f!==void 0&&h?.(i.id,f)},e[2]=h,e[3]=f,e[4]=i.id,e[5]=E):E=e[5];const O=E;let q;e[6]!==r||e[7]!==x||e[8]!==h||e[9]!==O||e[10]!==f||e[11]!==l||e[12]!==i.id?(q=x==="chart"&&h!==void 0&&f!==void 0?d(Y,{"aria-label":l("Suggest chart"),"data-testid":`dashboards-widget-suggest-${i.id}`,disabled:r,onClick:O,size:"icon-xs",title:l(r?"Suggesting…":"Suggest chart"),type:"button",variant:"ghost",children:d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"m12 3 1.9 4.6L18.5 9.5 13.9 11.4 12 16l-1.9-4.6L5.5 9.5l4.6-1.9L12 3ZM18 15l.9 2.1 2.1.9-2.1.9L18 21l-.9-2.1-2.1-.9 2.1-.9L18 15Z"})})}):void 0,e[6]=r,e[7]=x,e[8]=h,e[9]=O,e[10]=f,e[11]=l,e[12]=i.id,e[13]=q):q=e[13];const z=q;let C;e[14]!==g||e[15]!==i.id?(C=g!==void 0&&d(ne,{className:"font-mono text-xs",testId:`dashboards-widget-error-${i.id}`,variant:"destructive",children:g}),e[14]=g,e[15]=i.id,e[16]=C):C=e[16];let R;e[17]!==g||e[18]!==N||e[19]!==f||e[20]!==l||e[21]!==i.id?(R=g===void 0&&N&&f===void 0&&d("p",{className:"p-4 text-sm text-muted-foreground","data-testid":`dashboards-widget-loading-${i.id}`,children:l("Running…")}),e[17]=g,e[18]=N,e[19]=f,e[20]=l,e[21]=i.id,e[22]=R):R=e[22];let W;e[23]!==g||e[24]!==x||e[25]!==f||e[26]!==i.chartAxes||e[27]!==i.chartKind?(W=g===void 0&&f!==void 0&&x==="chart"&&d(we,{axes:i.chartAxes,kind:i.chartKind,result:f}),e[23]=g,e[24]=x,e[25]=f,e[26]=i.chartAxes,e[27]=i.chartKind,e[28]=W):W=e[28];let S;e[29]!==g||e[30]!==x||e[31]!==f?(S=g===void 0&&f!==void 0&&x==="kpi"&&d(Ee,{result:f}),e[29]=g,e[30]=x,e[31]=f,e[32]=S):S=e[32];let k;e[33]!==g||e[34]!==x||e[35]!==f?(k=g===void 0&&f!==void 0&&x==="table"&&d("div",{className:"max-h-72 overflow-auto",children:d(Se,{result:f})}),e[33]=g,e[34]=x,e[35]=f,e[36]=k):k=e[36];let w;return e[37]!==t||e[38]!==n||e[39]!==s||e[40]!==a||e[41]!==o||e[42]!==c||e[43]!==v||e[44]!==z||e[45]!==C||e[46]!==R||e[47]!==W||e[48]!==S||e[49]!==k||e[50]!==i?(w=Z(ce,{actions:z,draggedRef:t,first:n,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,widget:i,children:[C,R,W,S,k]}),e[37]=t,e[38]=n,e[39]=s,e[40]=a,e[41]=o,e[42]=c,e[43]=v,e[44]=z,e[45]=C,e[46]=R,e[47]=W,e[48]=S,e[49]=k,e[50]=i,e[51]=w):w=e[51],w},Te=b=>{const e=J(11),{draggedRef:t,first:n,inferring:r,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,onSuggest:h,widget:i}=b;let l;return e[0]!==t||e[1]!==n||e[2]!==r||e[3]!==s||e[4]!==a||e[5]!==o||e[6]!==c||e[7]!==v||e[8]!==h||e[9]!==i?(l=le(i)==="text"?d(qe,{draggedRef:t,first:n,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,widget:i}):d(Ae,{draggedRef:t,first:n,inferring:r,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,onSuggest:h,widget:i}),e[0]=t,e[1]=n,e[2]=r,e[3]=s,e[4]=a,e[5]=o,e[6]=c,e[7]=v,e[8]=h,e[9]=i,e[10]=l):l=e[10],l},We=["bar","line","area"],Ie=["chart","kpi","table","text"],$e="lunora-studio-dashboards",oe={chartKind:"bar",kind:"chart",shardKey:"",sql:"",text:"",title:""},De=(b,e)=>t=>t.map(n=>n.id===b?{...n,chartAxes:e,chartKind:e.kind}:n),je=(b,e)=>t=>{const n=t.find(a=>a.id===b),r=t.filter(a=>a.id!==b),s=r.findIndex(a=>a.id===e);return n===void 0||s===-1?t:[...r.slice(0,s),n,...r.slice(s)]},ze=(b,e)=>e(b==="line"?"Line":b==="area"?"Area":"Bar"),Be=(b,e)=>e(b==="kpi"?"Single value":b==="table"?"Table":b==="text"?"Text":"Chart"),Fe=b=>{const e=J(82),{draft:t,editing:n,onCancel:r,onChange:s,onSubmit:a}=b,o=te();let c;e[0]!==t||e[1]!==s?(c=u=>{s({...t,title:u.target.value})},e[0]=t,e[1]=s,e[2]=c):c=e[2];const v=c;let h;e[3]!==t||e[4]!==s?(h=u=>{s({...t,sql:u.target.value})},e[3]=t,e[4]=s,e[5]=h):h=e[5];const i=h;let l;e[6]!==t||e[7]!==s?(l=u=>{s({...t,text:u.target.value})},e[6]=t,e[7]=s,e[8]=l):l=e[8];const g=l;let N;e[9]!==t||e[10]!==s?(N=u=>{s({...t,shardKey:u.target.value})},e[9]=t,e[10]=s,e[11]=N):N=e[11];const f=N;let y;e[12]!==t||e[13]!==s?(y=u=>{s({...t,chartKind:u.target.value})},e[12]=t,e[13]=s,e[14]=y):y=e[14];const x=y;let E;e[15]!==t||e[16]!==s?(E=u=>{s({...t,kind:u.target.value})},e[15]=t,e[16]=s,e[17]=E):E=e[17];const O=E;let q;e[18]!==a?(q=()=>{a()},e[18]=a,e[19]=q):q=e[19];const z=q,C=t.kind==="text";let R;e[20]!==t.sql||e[21]!==t.text||e[22]!==t.title||e[23]!==C?(R=t.title.trim()!==""&&(C?t.text.trim()!=="":t.sql.trim()!==""),e[20]=t.sql,e[21]=t.text,e[22]=t.title,e[23]=C,e[24]=R):R=e[24];const W=R;let S;e[25]!==o?(S=o("Widget title"),e[25]=o,e[26]=S):S=e[26];let k;e[27]!==o?(k=o("Widget title"),e[27]=o,e[28]=k):k=e[28];let w;e[29]!==t.title||e[30]!==v||e[31]!==k||e[32]!==S?(w=d("input",{"aria-label":S,className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-title",onChange:v,placeholder:k,type:"text",value:t.title}),e[29]=t.title,e[30]=v,e[31]=k,e[32]=S,e[33]=w):w=e[33];let _;e[34]!==o?(_=o("Widget type"),e[34]=o,e[35]=_):_=e[35];const Q=t.kind;let B;e[36]!==o?(B=Ie.map(u=>d("option",{value:u,children:Be(u,o)},u)),e[36]=o,e[37]=B):B=e[37];let I;e[38]!==t.kind||e[39]!==O||e[40]!==_||e[41]!==B?(I=d("select",{"aria-label":_,className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-widget-kind",onChange:O,value:Q,children:B}),e[38]=t.kind,e[39]=O,e[40]=_,e[41]=B,e[42]=I):I=e[42];let K;e[43]!==t.sql||e[44]!==t.text||e[45]!==C||e[46]!==i||e[47]!==g||e[48]!==o?(K=C?d("textarea",{"aria-label":o("Text"),className:"min-h-24 resize-y rounded-md border border-border bg-background p-2 text-xs leading-5 outline-none focus-visible:border-ring","data-testid":"dashboards-form-text",onChange:g,placeholder:o("Notes for whoever reads this dashboard."),value:t.text}):d("textarea",{"aria-label":o("SQL query"),className:"min-h-24 resize-y rounded-md border border-border bg-background p-2 font-mono text-xs leading-5 outline-none focus-visible:border-ring","data-testid":"dashboards-form-sql",onChange:i,placeholder:"SELECT author, COUNT(*) AS messages FROM …",spellCheck:!1,value:t.sql}),e[43]=t.sql,e[44]=t.text,e[45]=C,e[46]=i,e[47]=g,e[48]=o,e[49]=K):K=e[49];let $;e[50]!==t.chartKind||e[51]!==t.kind||e[52]!==x||e[53]!==o?($=t.kind==="chart"&&d("select",{"aria-label":o("Chart type"),className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-kind",onChange:x,value:t.chartKind,children:We.map(u=>d("option",{value:u,children:ze(u,o)},u))}),e[50]=t.chartKind,e[51]=t.kind,e[52]=x,e[53]=o,e[54]=$):$=e[54];let L;e[55]!==t.shardKey||e[56]!==C||e[57]!==f||e[58]!==o?(L=!C&&d("input",{"aria-label":o("Shard key (optional)"),className:"h-8 rounded-md border border-border bg-background px-2 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-shard",onChange:f,placeholder:o("Shard key (optional)"),type:"text",value:t.shardKey}),e[55]=t.shardKey,e[56]=C,e[57]=f,e[58]=o,e[59]=L):L=e[59];let A;e[60]!==o?(A=o("Cancel"),e[60]=o,e[61]=A):A=e[61];let M;e[62]!==r||e[63]!==A?(M=d(Y,{"data-testid":"dashboards-form-cancel",onClick:r,size:"sm",type:"button",variant:"outline",children:A}),e[62]=r,e[63]=A,e[64]=M):M=e[64];const D=!W;let j;e[65]!==n||e[66]!==o?(j=o(n?"Save widget":"Add widget"),e[65]=n,e[66]=o,e[67]=j):j=e[67];let T;e[68]!==z||e[69]!==D||e[70]!==j?(T=d(Y,{"data-testid":"dashboards-form-save",disabled:D,onClick:z,size:"sm",type:"button",children:j}),e[68]=z,e[69]=D,e[70]=j,e[71]=T):T=e[71];let p;e[72]!==M||e[73]!==T?(p=Z("div",{className:"flex items-center justify-end gap-2",children:[M,T]}),e[72]=M,e[73]=T,e[74]=p):p=e[74];let m;return e[75]!==w||e[76]!==I||e[77]!==K||e[78]!==$||e[79]!==L||e[80]!==p?(m=d(ae,{"data-testid":"dashboards-form",children:Z(re,{className:"flex flex-col gap-3 py-4",children:[w,I,K,$,L,p]})}),e[75]=w,e[76]=I,e[77]=K,e[78]=$,e[79]=L,e[80]=p,e[81]=m):m=e[81],m},it=b=>{const e=J(53),{initialShardKey:t}=b,n=te(),[r,s]=ve($e),[a,o]=X(oe),[c,v]=X(null),[h,i]=X(!1),l=be(t??""),[g,N]=X(null),f=ue(null);let y;e[0]!==t?(y=()=>{v(null),o({...oe,shardKey:t??""}),i(!0)},e[0]=t,e[1]=y):y=e[1];const x=y;let E;e[2]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{i(!1),v(null),o(oe)},e[2]=E):E=e[2];const O=E;let q;e[3]!==r?(q=p=>{const m=r.find(u=>u.id===p);m!==void 0&&(v(p),o({chartKind:m.chartKind??"bar",kind:le(m),shardKey:m.shardKey??"",sql:m.sql,text:m.text??"",title:m.title}),i(!0))},e[3]=r,e[4]=q):q=e[4];const z=q;let C;e[5]!==l||e[6]!==s?(C=(p,m)=>{N(p),de((async()=>{const F=await l.inferChart({columns:m.columns,rowCount:m.rowCount});F!==void 0&&s(De(p,F))})().finally(()=>{N(F=>F===p?null:F)}))},e[5]=l,e[6]=s,e[7]=C):C=e[7];const R=C;let W;e[8]!==s?(W=p=>{s(m=>m.filter(u=>u.id!==p))},e[8]=s,e[9]=W):W=e[9];const S=W;let k;e[10]!==s?(k=(p,m)=>{s(je(p,m))},e[10]=s,e[11]=k):k=e[11];const w=k;let _;e[12]!==s?(_=(p,m)=>{s(u=>{const F=u.findIndex(G=>G.id===p),U=F+m;if(F===-1||U<0||U>=u.length)return u;const V=[...u],H=V[F],P=V[U];return H===void 0||P===void 0?u:(V[F]=P,V[U]=H,V)})},e[12]=s,e[13]=_):_=e[13];const Q=_;let B;e[14]!==a||e[15]!==c||e[16]!==s?(B=()=>{const p=a.title.trim(),m=a.sql.trim(),u=a.text.trim(),{chartKind:F,kind:U}=a;if(p===""||(U==="text"?u==="":m===""))return;const V={chartKind:F,kind:U,shardKey:a.shardKey.trim(),sql:m,text:u,title:p};s(c===null?H=>[...H,{...V,id:pe("w")}]:H=>H.map(P=>P.id===c?{...P,...V}:P)),O()},e[14]=a,e[15]=c,e[16]=s,e[17]=B):B=e[17];const I=B;let K;e[18]!==n?(K=n("Charts, values, tables, and notes. Drag a tile to reorder."),e[18]=n,e[19]=K):K=e[19];let $;e[20]!==K?($=d("p",{className:"text-sm text-muted-foreground",children:K}),e[20]=K,e[21]=$):$=e[21];let L;e[22]!==h||e[23]!==x||e[24]!==n?(L=!h&&d(Y,{"data-testid":"dashboards-add",onClick:x,size:"sm",type:"button",children:n("Add widget")}),e[22]=h,e[23]=x,e[24]=n,e[25]=L):L=e[25];let A;e[26]!==$||e[27]!==L?(A=Z("div",{className:"flex items-center justify-between",children:[$,L]}),e[26]=$,e[27]=L,e[28]=A):A=e[28];let M;e[29]!==l||e[30]!==n?(M=l.reason("chart")!==void 0&&d(ne,{className:"text-xs",testId:"dashboards-suggest-error",variant:"destructive",children:n("Could not suggest a chart for that result.")}),e[29]=l,e[30]=n,e[31]=M):M=e[31];let D;e[32]!==a||e[33]!==c||e[34]!==h||e[35]!==I?(D=h&&d(Fe,{draft:a,editing:c!==null,onCancel:O,onChange:o,onSubmit:I}),e[32]=a,e[33]=c,e[34]=h,e[35]=I,e[36]=D):D=e[36];let j;e[37]!==l.unavailable||e[38]!==h||e[39]!==g||e[40]!==z||e[41]!==Q||e[42]!==S||e[43]!==w||e[44]!==R||e[45]!==n||e[46]!==r?(j=r.length===0&&!h?d(me,{description:n("Add a chart, a single value, a table, or a note. Everything is saved on this browser."),testId:"dashboards-empty",title:n("No widgets yet")}):d("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3","data-testid":"dashboards-grid",children:r.map((p,m)=>d(Te,{draggedRef:f,first:m===0,inferring:g===p.id,last:m===r.length-1,onEdit:z,onMove:Q,onRemove:S,onReorder:w,onSuggest:l.unavailable?void 0:R,widget:p},p.id))}),e[37]=l.unavailable,e[38]=h,e[39]=g,e[40]=z,e[41]=Q,e[42]=S,e[43]=w,e[44]=R,e[45]=n,e[46]=r,e[47]=j):j=e[47];let T;return e[48]!==A||e[49]!==M||e[50]!==D||e[51]!==j?(T=Z("div",{className:"flex flex-col gap-4","data-testid":"lunora-dashboards",children:[A,M,D,j]}),e[48]=A,e[49]=M,e[50]=D,e[51]=j,e[52]=T):T=e[52],T};export{it as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as I}from"react/compiler-runtime";import{E as
|
|
1
|
+
import{c as I}from"react/compiler-runtime";import{E as _}from"../packem_shared/error-alert-DKXm5h19.mjs";import{ShardInput as O}from"../packem_shared/ShardInput-CoySruKZ.mjs";import{B as w}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as M,a as $}from"../packem_shared/card-By2O8ULa.mjs";import{E as j}from"../packem_shared/empty-state-D7jEML_T.mjs";import{u as T}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{u as A}from"../packem_shared/use-open-trace-BJKMJjeS.mjs";import{u as k}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{useT as C}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as E}from"../packem_shared/ADMIN_FUNCTIONS-DUXsXId1.mjs";import{h as R}from"../packem_shared/internal-hIuTpSbx.mjs";import{S as B}from"../packem_shared/sparkline-B_sPPO_8.mjs";import{jsxs as g,jsx as c}from"react/jsx-runtime";const F=n=>n.length===0?void 0:{max:Math.max(...n),mean:n.reduce((e,t)=>e+t,0)/n.length,min:Math.min(...n)},K=/^gen_ai\.evaluation\.(.+)\.score$/u,q=n=>{const e=[];for(const t of n)for(const r of t.spans)for(const[a,l]of Object.entries(r.attributes??{})){const o=K.exec(a);if(!o||typeof l!="number")continue;const m=o[1],i=r.attributes?.[`gen_ai.evaluation.${m}.label`];e.push({...typeof i=="string"?{label:i}:{},name:m,score:l,spanName:r.name,startTs:t.startTs+r.offsetMs,traceId:t.traceId})}return e.toSorted((t,r)=>r.startTs-t.startTs)},D=n=>{const e=[];for(const t of n?.series??[]){const r=K.exec(t.name);r&&e.push({name:r[1],points:t.points})}return e},H=(n,e)=>{const t=new Set([...n.map(a=>a.name),...e.map(a=>a.name)]),r=[];for(const a of t){const l=n.filter(s=>s.name===a),o=e.find(s=>s.name===a)?.points??[],m=o.at(-1)?.last??l[0]?.score,i=o.length>0?{max:Math.max(...o.map(s=>s.max)),mean:o.reduce((s,d)=>s+d.sum,0)/o.reduce((s,d)=>s+d.count,0),min:Math.min(...o.map(s=>s.min))}:F(l.map(s=>s.score));r.push({...m===void 0?{}:{latest:m},...i,name:a,points:o,runs:l})}return r.toSorted((a,l)=>a.name.localeCompare(l.name))},L=n=>Array.isArray(n?.traces)?n.traces:[],y=n=>n===void 0?"—":n.toFixed(2),P=n=>{const e=I(34),{card:t,onOpenTrace:r}=n,a=C();let l;e[0]!==t.name?(l=c("h3",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"ev-name",children:t.name}),e[0]=t.name,e[1]=l):l=e[1];let o;e[2]!==t.latest?(o=y(t.latest),e[2]=t.latest,e[3]=o):o=e[3];let m;e[4]!==o?(m=c("span",{className:"font-mono text-lg text-foreground","data-testid":"ev-latest",children:o}),e[4]=o,e[5]=m):m=e[5];let i;e[6]!==l||e[7]!==m?(i=g("div",{className:"flex items-baseline justify-between gap-3",children:[l,m]}),e[6]=l,e[7]=m,e[8]=i):i=e[8];let s;e[9]!==t.max||e[10]!==t.mean||e[11]!==t.min||e[12]!==a?(s=a("min {min} · mean {mean} · max {max}",{max:y(t.max),mean:y(t.mean),min:y(t.min)}),e[9]=t.max,e[10]=t.mean,e[11]=t.min,e[12]=a,e[13]=s):s=e[13];let d;e[14]!==s?(d=c("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"ev-summary",children:s}),e[14]=s,e[15]=d):d=e[15];let f;e[16]!==t.name||e[17]!==t.points||e[18]!==a?(f=t.points.length>1?c(B,{ariaLabel:a("Score trend for {name}",{name:t.name}),className:"h-10 w-full",series:t.points.map(Q),testId:"ev-trend"}):c("p",{className:"text-xs text-muted-foreground","data-testid":"ev-no-trend",children:a("No durable history yet — pass ctx.metrics to recordEvaluation to chart a trend.")}),e[16]=t.name,e[17]=t.points,e[18]=a,e[19]=f):f=e[19];let u;if(e[20]!==t.runs||e[21]!==r||e[22]!==a){let x;e[24]!==r||e[25]!==a?(x=p=>g("div",{className:"flex items-center justify-between gap-2 font-mono text-xs","data-testid":"ev-run",children:[g("span",{className:"truncate text-muted-foreground",children:[R(p.startTs)," · ",p.spanName]}),g("span",{className:"flex items-center gap-2",children:[p.label===void 0?null:c(w,{variant:"outline",children:p.label}),c("span",{className:"text-foreground",children:y(p.score)}),r===void 0?null:c("button",{className:"text-muted-foreground underline-offset-2 hover:underline",onClick:()=>{r(p.traceId)},title:a("Open the trace {trace}",{trace:p.traceId}),type:"button",children:p.traceId.slice(0,8)})]})]},`${p.traceId}:${p.spanName}`),e[24]=r,e[25]=a,e[26]=x):x=e[26],u=t.runs.slice(0,5).map(x),e[20]=t.runs,e[21]=r,e[22]=a,e[23]=u}else u=e[23];let h;e[27]!==u?(h=c("div",{className:"flex flex-col gap-1",children:u}),e[27]=u,e[28]=h):h=e[28];let v;return e[29]!==i||e[30]!==d||e[31]!==f||e[32]!==h?(v=c(M,{"data-testid":"ev-card",children:g($,{className:"flex flex-col gap-3 p-4",children:[i,d,f,h]})}),e[29]=i,e[30]=d,e[31]=f,e[32]=h,e[33]=v):v=e[33],v},re=n=>{const e=I(21),{initialShardKey:t}=n,r=C(),{queryShardKey:a,setShardKey:l,shardKey:o}=k(t),m=A(a);let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let s;e[1]!==a?(s={live:!0,shardKey:a},e[1]=a,e[2]=s):s=e[2];const{data:d,error:f}=T(E.getTraces,i,s);let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u={},e[3]=u):u=e[3];let h;e[4]!==a?(h={live:!0,shardKey:a},e[4]=a,e[5]=h):h=e[5];const{data:v}=T(E.getMetricHistory,u,h);let x;if(e[6]!==d||e[7]!==f||e[8]!==v||e[9]!==m||e[10]!==a||e[11]!==l||e[12]!==o||e[13]!==r){const p=H(q(L(d)),D(v));let N;e[15]!==l||e[16]!==o?(N=c(O,{onChange:l,testId:"ev-shard-input",value:o}),e[15]=l,e[16]=o,e[17]=N):N=e[17];let b;e[18]!==f||e[19]!==a?(b=f===null?null:c(_,{error:f,shardKey:a,testId:"ev-error"}),e[18]=f,e[19]=a,e[20]=b):b=e[20],x=g("section",{className:"flex flex-col gap-4","data-testid":"ev-panel",children:[N,b,p.length===0?c(j,{description:r("Call recordEvaluation from a graded run and its score shows up here."),testId:"ev-empty",title:r("No evals recorded")}):c("div",{className:"grid gap-3 md:grid-cols-2",children:p.map(S=>c(P,{card:S,onOpenTrace:m},S.name))})]}),e[6]=d,e[7]=f,e[8]=v,e[9]=m,e[10]=a,e[11]=l,e[12]=o,e[13]=r,e[14]=x}else x=e[14];return x};function Q(n){return n.last}export{re as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as R}from"react/compiler-runtime";import{E as B}from"../packem_shared/error-alert-
|
|
1
|
+
import{c as R}from"react/compiler-runtime";import{E as B}from"../packem_shared/error-alert-DKXm5h19.mjs";import{ShardInput as E}from"../packem_shared/ShardInput-CoySruKZ.mjs";import{S as I}from"../packem_shared/stat-card-BAv73QtB.mjs";import{B as M}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as _}from"../packem_shared/card-By2O8ULa.mjs";import{E as j}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as G,a as H,b as A,c as w,d as L,e as K}from"../packem_shared/table-D0SBiDu-.mjs";import{u as Q}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{useAutoRefresh as W}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-Py5Yx7rP.mjs";import{u as q}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{useT as O}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as U}from"../packem_shared/ADMIN_FUNCTIONS-DUXsXId1.mjs";import{jsxs as m,jsx as l,Fragment as z}from"react/jsx-runtime";const D=d=>`${d.toString()} ms`,J=d=>d.totalConnections===0&&d.shapePoke.passes===0&&d.whisper.passes===0&&d.shapeProbe.run===0&&d.shapeProbe.served===0&&d.globalPoll.drains===0&&d.globalPoll.pairsSkipped===0,F=d=>{const e=R(48),{counters:o,includeTiming:t,prefix:r,t:a,title:u}=d,c=`${r}-section`;let n;e[0]!==u?(n=l("h3",{className:"text-sm font-medium text-foreground",children:u}),e[0]=u,e[1]=n):n=e[1];const s=`${r}-stats`;let i;e[2]!==a?(i=a("Passes"),e[2]=a,e[3]=i):i=e[3];const f=`${r}-passes`;let N;e[4]!==o.passes||e[5]!==i||e[6]!==f?(N=l(I,{label:i,testId:f,value:o.passes}),e[4]=o.passes,e[5]=i,e[6]=f,e[7]=N):N=e[7];let g;e[8]!==a?(g=a("Sockets iterated"),e[8]=a,e[9]=g):g=e[9];const y=`${r}-iterated`;let p;e[10]!==o.socketsIterated||e[11]!==g||e[12]!==y?(p=l(I,{label:g,testId:y,value:o.socketsIterated}),e[10]=o.socketsIterated,e[11]=g,e[12]=y,e[13]=p):p=e[13];let h;e[14]!==a?(h=a("Delivered"),e[14]=a,e[15]=h):h=e[15];const k=`${r}-delivered`;let b;e[16]!==o.socketsDelivered||e[17]!==h||e[18]!==k?(b=l(I,{label:h,testId:k,value:o.socketsDelivered}),e[16]=o.socketsDelivered,e[17]=h,e[18]=k,e[19]=b):b=e[19];let x;e[20]!==a?(x=a("Peak width"),e[20]=a,e[21]=x):x=e[21];const S=`${r}-peak`;let v;e[22]!==o.peakSocketsIterated||e[23]!==x||e[24]!==S?(v=l(I,{label:x,testId:S,value:o.peakSocketsIterated}),e[22]=o.peakSocketsIterated,e[23]=x,e[24]=S,e[25]=v):v=e[25];let C;e[26]!==o.totalMs||e[27]!==t||e[28]!==r||e[29]!==a?(C=t&&l(I,{label:a("Total time"),testId:`${r}-total-ms`,value:D(o.totalMs)}),e[26]=o.totalMs,e[27]=t,e[28]=r,e[29]=a,e[30]=C):C=e[30];let P;e[31]!==o.maxMs||e[32]!==t||e[33]!==r||e[34]!==a?(P=t&&l(I,{label:a("Max time"),testId:`${r}-max-ms`,value:D(o.maxMs)}),e[31]=o.maxMs,e[32]=t,e[33]=r,e[34]=a,e[35]=P):P=e[35];let $;e[36]!==b||e[37]!==v||e[38]!==C||e[39]!==P||e[40]!==s||e[41]!==N||e[42]!==p?($=m("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":s,children:[N,p,b,v,C,P]}),e[36]=b,e[37]=v,e[38]=C,e[39]=P,e[40]=s,e[41]=N,e[42]=p,e[43]=$):$=e[43];let T;return e[44]!==c||e[45]!==$||e[46]!==n?(T=m("section",{className:"flex flex-col gap-2","data-testid":c,children:[n,$]}),e[44]=c,e[45]=$,e[46]=n,e[47]=T):T=e[47],T},V=d=>{const e=R(20),{counters:o,t}=d;let r;e[0]!==t?(r=t("Membership probes"),e[0]=t,e[1]=r):r=e[1];let a;e[2]!==r?(a=l("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=a):a=e[3];let u;e[4]!==t?(u=t("Queries run"),e[4]=t,e[5]=u):u=e[5];let c;e[6]!==o.run||e[7]!==u?(c=l(I,{label:u,testId:"fanout-probe-run",value:o.run}),e[6]=o.run,e[7]=u,e[8]=c):c=e[8];let n;e[9]!==t?(n=t("Shared from cache"),e[9]=t,e[10]=n):n=e[10];let s;e[11]!==o.served||e[12]!==n?(s=l(I,{label:n,testId:"fanout-probe-served",value:o.served}),e[11]=o.served,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==c||e[15]!==s?(i=m("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-probe-stats",children:[c,s]}),e[14]=c,e[15]=s,e[16]=i):i=e[16];let f;return e[17]!==a||e[18]!==i?(f=m("section",{className:"flex flex-col gap-2","data-testid":"fanout-probe-section",children:[a,i]}),e[17]=a,e[18]=i,e[19]=f):f=e[19],f},X=d=>{const e=R(20),{counters:o,t}=d;let r;e[0]!==t?(r=t("Global shape polls"),e[0]=t,e[1]=r):r=e[1];let a;e[2]!==r?(a=l("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=a):a=e[3];let u;e[4]!==t?(u=t("Global reads"),e[4]=t,e[5]=u):u=e[5];let c;e[6]!==o.drains||e[7]!==u?(c=l(I,{label:u,testId:"fanout-global-poll-drains",value:o.drains}),e[6]=o.drains,e[7]=u,e[8]=c):c=e[8];let n;e[9]!==t?(n=t("Pairs skipped"),e[9]=t,e[10]=n):n=e[10];let s;e[11]!==o.pairsSkipped||e[12]!==n?(s=l(I,{label:n,testId:"fanout-global-poll-pairs-skipped",value:o.pairsSkipped}),e[11]=o.pairsSkipped,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==c||e[15]!==s?(i=m("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-global-poll-stats",children:[c,s]}),e[14]=c,e[15]=s,e[16]=i):i=e[16];let f;return e[17]!==a||e[18]!==i?(f=m("section",{className:"flex flex-col gap-2","data-testid":"fanout-global-poll-section",children:[a,i]}),e[17]=a,e[18]=i,e[19]=f):f=e[19],f},me=d=>{const e=R(32),{initialShardKey:o}=d,t=O(),{queryShardKey:r,setShardKey:a,shardKey:u}=q(o);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];let n;e[1]!==r?(n={keepPreviousData:!0,shardKey:r},e[1]=r,e[2]=n):n=e[2];const{data:s,error:i,errorSource:f,poll:N}=Q(U.getFanoutMetrics,c,n);W(N,!0);let g;e[3]!==s?(g=s!==void 0&&J(s),e[3]=s,e[4]=g):g=e[4];const y=g;let p;e[5]!==a||e[6]!==u?(p=l(E,{onChange:a,testId:"fanout-shard-input",value:u}),e[5]=a,e[6]=u,e[7]=p):p=e[7];let h;e[8]!==s||e[9]!==t?(h=s!==void 0&&m("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[s.promoted&&l(M,{"data-testid":"fanout-promoted",variant:s.relayCount>=s.maxRelays?"destructive":"default",children:s.relayCount>=s.maxRelays?t("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:s.maxRelays,relayCount:s.relayCount}):t("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:s.maxRelays,relayCount:s.relayCount})}),l(M,{variant:"secondary",children:t("{count} connections",{count:s.totalConnections})}),l(M,{variant:"secondary",children:t("peak {count} subscribers",{count:s.peakSubscribers})})]}),e[8]=s,e[9]=t,e[10]=h):h=e[10];let k;e[11]!==p||e[12]!==h?(k=m("div",{className:"flex flex-wrap items-center gap-2",children:[p,h]}),e[11]=p,e[12]=h,e[13]=k):k=e[13];let b;e[14]!==i||e[15]!==f||e[16]!==r?(b=i!==null&&l(B,{error:f,shardKey:r,testId:"fanout-error"}),e[14]=i,e[15]=f,e[16]=r,e[17]=b):b=e[17];let x;e[18]!==i||e[19]!==y||e[20]!==t?(x=i===null&&y&&l(j,{description:t("Realtime fan-out cost and per-topic subscriber counts for this shard."),icon:l("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:l("path",{d:"M4 12h4l3 7 4-14 3 7h2"})}),testId:"fanout-empty",title:t("No fan-out activity yet.")}),e[18]=i,e[19]=y,e[20]=t,e[21]=x):x=e[21];let S;e[22]!==i||e[23]!==y||e[24]!==s||e[25]!==t?(S=i===null&&s!==void 0&&!y&&m(z,{children:[s.topics.length>0&&m("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[l("h3",{className:"text-sm font-medium text-foreground",children:t("Hot topics")}),l(_,{className:"overflow-hidden py-0",children:m(G,{"data-testid":"fanout-topics-table",children:[l(H,{children:m(A,{children:[l(w,{children:t("Topic")}),l(w,{children:t("Kind")}),l(w,{className:"text-right",children:t("Subscribers")})]})}),l(L,{children:s.topics.map(Y)})]})})]}),m("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[l("h2",{className:"text-sm font-medium text-muted-foreground",children:t("Fan-out cost since this instance woke")}),l(F,{counters:s.shapePoke,includeTiming:!0,prefix:"fanout-poke",t,title:t("Shape pokes")}),l(F,{counters:s.whisper,includeTiming:!1,prefix:"fanout-whisper",t,title:t("Whisper broadcasts")}),l(V,{counters:s.shapeProbe,t}),l(X,{counters:s.globalPoll,t})]})]}),e[22]=i,e[23]=y,e[24]=s,e[25]=t,e[26]=S):S=e[26];let v;return e[27]!==k||e[28]!==b||e[29]!==x||e[30]!==S?(v=m("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[k,b,x,S]}),e[27]=k,e[28]=b,e[29]=x,e[30]=S,e[31]=v):v=e[31],v};function Y(d){return m(A,{"data-testid":"fanout-topic-row",children:[l(K,{className:"font-mono text-xs",children:d.topic}),l(K,{children:l(M,{variant:"outline",children:d.kind})}),l(K,{className:"text-right font-medium tabular-nums",children:d.subscribers})]},`${d.kind}:${d.topic}`)}export{me as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useState as C}from"react";import{E as
|
|
1
|
+
import{useState as C}from"react";import{E as w}from"../packem_shared/error-alert-DKXm5h19.mjs";import{B as A}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as S,a as k}from"../packem_shared/card-By2O8ULa.mjs";import{E as g}from"../packem_shared/empty-state-D7jEML_T.mjs";import{L as E}from"../packem_shared/label-DKFzyHq6.mjs";import{T as O,a as F,b as x,c as s,d as j,e as n}from"../packem_shared/table-D0SBiDu-.mjs";import{T as I}from"../packem_shared/textarea--40GKAyz.mjs";import{u as J}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{useT as L}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as B}from"../packem_shared/ADMIN_FUNCTIONS-DUXsXId1.mjs";import{jsx as e,jsxs as l}from"react/jsx-runtime";const H=a=>{const t=a.trim();if(t.length===0)return{context:void 0,error:null};try{const o=JSON.parse(t);return o===null||typeof o!="object"||Array.isArray(o)?{context:void 0,error:"Targeting context must be a JSON object."}:{context:o,error:null}}catch{return{context:void 0,error:"Targeting context is not valid JSON."}}},K='{ "targetingKey": "user-123", "plan": "premium" }',R=a=>a.type==="object"?JSON.stringify(a.value):String(a.value),W=({initialShardKey:a=""})=>{const t=L(),[o,p]=C(""),{context:c,error:f}=H(o),h=c===void 0?{}:{context:c},{data:i,error:y,errorSource:v,liveError:N}=J(B.listFlags,h,{live:!0,shardKey:a}),m=i!==void 0,b=i?.configured??!1,u=Array.isArray(i?.flags)?[...i.flags].toSorted((r,T)=>r.key.localeCompare(T.key)):[];let d;return m&&!b?d=e(g,{description:t("No @lunora/flags provider is wired in this deployment. Add lunora/flags.ts with defineFlags({ provider }) to gate code paths on feature flags."),testId:"flags-unconfigured",title:t("No flags provider configured")}):m&&u.length===0?d=e(g,{description:t('A flags provider is configured, but no handler reads a flag yet. Call ctx.flags.boolean("key", false) in a query, mutation, or action.'),testId:"flags-empty",title:t("No flags read")}):d=e(S,{className:"overflow-hidden py-0",children:e(k,{className:"px-0",children:l(O,{"data-testid":"flags-table",children:[e(F,{children:l(x,{children:[e(s,{children:t("Key")}),e(s,{children:t("Type")}),e(s,{children:t("Value")}),e(s,{children:t("Reason")}),e(s,{children:t("Variant")})]})}),e(j,{children:u.map(r=>l(x,{"data-testid":`flags-row-${r.key}`,children:[e(n,{className:"font-mono text-xs",children:r.key}),e(n,{className:"font-mono text-xs text-muted-foreground",children:r.type}),e(n,{className:"font-mono text-xs",children:R(r)}),e(n,{children:r.errorCode===void 0?e("span",{className:"font-mono text-xs text-muted-foreground",children:r.reason??"—"}):e(A,{"data-testid":`flags-error-${r.key}`,variant:"destructive",children:r.errorCode})}),e(n,{className:"font-mono text-xs text-muted-foreground",children:r.variant??"—"})]},r.key))})]})})}),l("div",{className:"flex flex-col gap-6","data-testid":"lunora-flags-panel",children:[y!==null&&e(w,{error:v,shardKey:a,testId:"flags-error"}),e("p",{className:"text-sm text-muted-foreground",children:t('Feature flags are read in code with ctx.flags.<type>("key", default). They evaluate through the OpenFeature provider configured in lunora/flags.ts; edit the targeting context below to see how each flag resolves for a given audience.')}),l("div",{className:"flex flex-col gap-2",children:[e(E,{htmlFor:"flags-targeting-context",children:t("Targeting context (JSON)")}),e(I,{className:"font-mono text-xs","data-testid":"flags-context-input",id:"flags-targeting-context",onChange:r=>{p(r.target.value)},placeholder:K,rows:3,value:o}),f!==null&&e("p",{className:"text-xs text-destructive","data-testid":"flags-context-error",role:"alert",children:t(f)}),N!==void 0&&e("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"flags-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")})]}),d]})};export{W as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as xe}from"react/compiler-runtime";import{findIssueSolution as we,flattenHint as Ee}from"@lunora/errors";import{useState as ne}from"react";import{L as Te}from"../packem_shared/live-status-D1GasNsH.mjs";import{ShardInput as $e}from"../packem_shared/ShardInput-CoySruKZ.mjs";import{B as pe}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as oe}from"../packem_shared/button-q0UYSmrn.mjs";import{C as Ae,a as Ce}from"../packem_shared/card-By2O8ULa.mjs";import{E as _e}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as ke}from"../packem_shared/input-CXhxesPC.mjs";import{S as Me,a as Re,b as Ke,c as Ne,d as Ve}from"../packem_shared/select-DPyS18Vy.mjs";import{T as Le,a as Oe,b as ye,c as F,d as Ue,e as B}from"../packem_shared/table-D0SBiDu-.mjs";import{u as Be}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{u as Fe}from"../packem_shared/use-async-submit-D0r7-m2J.mjs";import{u as ze}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{u as be}from"../packem_shared/use-studio-client-DCA50tF2.mjs";import{useT as Se}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as ie}from"../packem_shared/ADMIN_FUNCTIONS-4aGsMs95.mjs";import{h as He,f as re,c as de,d as Ie,b as je}from"../packem_shared/internal-hIuTpSbx.mjs";import{jsx as s,jsxs as w,Fragment as De}from"react/jsx-runtime";const ge="none",qe=["all","open","resolved","ignored"],Ge=["critical","high","medium","low"],Pe=de(ie.resolveIssue),We=de(ie.ignoreIssue),ve=de(ie.assignIssue),Ye=de(ie.setIssueSeverity),Qe=de(ie.explainIssue),Xe=n=>Array.isArray(n?.issues)?n.issues:[],Je=n=>n==="resolved"?"success":n==="ignored"?"secondary":"warning",Ze=n=>n==="critical"?"destructive":n==="high"?"warning":n==="medium"?"info":"secondary",et=n=>{const e=xe(44),{expanded:h,issue:t,shardKey:E}=n,i=be(),r=Se(),[a,o]=ne(void 0),{busy:R,error:A,run:V}=Fe();let C;e[0]!==i||e[1]!==t||e[2]!==V||e[3]!==E?(C=()=>{o(void 0),V(async()=>{const f={culprit:t.culprit,sampleMessage:t.sampleMessage,title:t.title},I=await i.query(Qe,f,Ie(E));o(I)})},e[0]=i,e[1]=t,e[2]=V,e[3]=E,e[4]=C):C=e[4];const K=C;if(!h)return null;let T;if(e[5]!==t.sampleMessage){const f=we(t.sampleMessage);T=f===void 0?void 0:Ee(f.body),e[5]=t.sampleMessage,e[6]=T}else T=e[6];const _=T,M=`issues-detail-${t.hash}`;let d;e[7]!==t.sampleMessage?(d=s("p",{className:"whitespace-pre-wrap font-mono text-xs text-muted-foreground",children:t.sampleMessage}),e[7]=t.sampleMessage,e[8]=d):d=e[8];let g;e[9]!==r?(g=r("Suggested fix"),e[9]=r,e[10]=g):g=e[10];let $;e[11]!==g?($=s("div",{className:"text-xs font-medium text-muted-foreground",children:g}),e[11]=g,e[12]=$):$=e[12];let x;e[13]!==_||e[14]!==t.hash||e[15]!==r?(x=_===void 0?s("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":`issues-hint-empty-${t.hash}`,children:r("No known fix for this error yet.")}):s("p",{className:"mt-1 whitespace-pre-wrap text-sm","data-testid":`issues-hint-${t.hash}`,children:_}),e[13]=_,e[14]=t.hash,e[15]=r,e[16]=x):x=e[16];let y;e[17]!==$||e[18]!==x?(y=w("div",{children:[$,x]}),e[17]=$,e[18]=x,e[19]=y):y=e[19];const v=`issues-explain-${t.hash}`;let N;e[20]!==R||e[21]!==r?(N=r(R?"Explaining…":"Explain in plain language"),e[20]=R,e[21]=r,e[22]=N):N=e[22];let u;e[23]!==R||e[24]!==K||e[25]!==N||e[26]!==v?(u=s("div",{children:s(oe,{"data-testid":v,disabled:R,onClick:K,size:"sm",type:"button",variant:"outline",children:N})}),e[23]=R,e[24]=K,e[25]=N,e[26]=v,e[27]=u):u=e[27];let p;e[28]!==A||e[29]!==t.hash?(p=A!==null&&s("p",{className:"text-xs text-destructive","data-testid":`issues-explain-error-${t.hash}`,role:"alert",children:A}),e[28]=A,e[29]=t.hash,e[30]=p):p=e[30];let m;e[31]!==a||e[32]!==t.hash||e[33]!==r?(m=a!==void 0&&(a.degraded?s("p",{className:"text-xs text-muted-foreground","data-testid":`issues-degraded-${t.hash}`,children:a.reason==="no-ai-binding"?r("No AI binding is configured. Wire an AI binding to enable plain-language explanations — the suggested fix above is always available."):r("The AI model could not explain this error right now. The suggested fix above still applies.")}):w("div",{"data-testid":`issues-explanation-${t.hash}`,children:[s("div",{className:"text-xs font-medium text-muted-foreground",children:r("AI explanation")}),s("p",{className:"mt-1 whitespace-pre-wrap text-sm",children:a.explanation}),a.groundedId===void 0&&s("p",{className:"mt-1 text-xs text-muted-foreground","data-testid":`issues-ungrounded-${t.hash}`,children:r("No catalog fix matched this error, so this explanation is the model's own reading of the message. Verify before acting on it.")}),s("p",{className:"mt-1 text-[0.7rem] text-muted-foreground",children:r("Generated by {model}",{model:a.model})})]})),e[31]=a,e[32]=t.hash,e[33]=r,e[34]=m):m=e[34];let c;e[35]!==u||e[36]!==p||e[37]!==m||e[38]!==d||e[39]!==y?(c=s(B,{className:"bg-muted/30",colSpan:7,children:w("div",{className:"flex flex-col gap-3 py-1",children:[d,y,u,p,m]})}),e[35]=u,e[36]=p,e[37]=m,e[38]=d,e[39]=y,e[40]=c):c=e[40];let b;return e[41]!==c||e[42]!==M?(b=s(ye,{"data-testid":M,children:c}),e[41]=c,e[42]=M,e[43]=b):b=e[43],b},tt=n=>{const e=xe(119),{busy:h,issue:t,rowError:E,runTriage:i,shardKey:r}=n,a=Se(),[o,R]=ne(!1);let A;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{R(st)},e[0]=A):A=e[0];const V=A;let C;e[1]!==t.hash||e[2]!==i?(C=ae=>{const he=ae===null||ae===ge?null:ae;re(i(t.hash,Ye,{severity:he}))},e[1]=t.hash,e[2]=i,e[3]=C):C=e[3];const K=C;let T;e[4]!==t.hash||e[5]!==i?(T=ae=>{if(ae.key!=="Enter")return;const he=ae.currentTarget.value.trim();re(i(t.hash,ve,{assignee:he===""?null:he}))},e[4]=t.hash,e[5]=i,e[6]=T):T=e[6];const _=T,M=`issues-row-${t.hash}`;let d;e[7]!==a?(d=a("Toggle issue details"),e[7]=a,e[8]=d):d=e[8];const g=`issues-toggle-${t.hash}`,$=`mt-1 size-3 shrink-0 text-muted-foreground transition-transform ${o?"rotate-90":""}`;let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=s("path",{d:"m9 6 6 6-6 6"}),e[9]=x):x=e[9];let y;e[10]!==$?(y=s("svg",{"aria-hidden":"true",className:$,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:x}),e[10]=$,e[11]=y):y=e[11];let v;e[12]!==t.title?(v=s("span",{className:"block truncate font-medium",title:t.title,children:t.title}),e[12]=t.title,e[13]=v):v=e[13];let N;e[14]!==t.culprit?(N=s("span",{className:"block truncate font-mono text-xs text-muted-foreground",title:t.culprit,children:t.culprit}),e[14]=t.culprit,e[15]=N):N=e[15];let u;e[16]!==v||e[17]!==N?(u=w("span",{className:"min-w-0",children:[v,N]}),e[16]=v,e[17]=N,e[18]=u):u=e[18];let p;e[19]!==o||e[20]!==u||e[21]!==d||e[22]!==g||e[23]!==y?(p=w("button",{"aria-expanded":o,"aria-label":d,className:"flex w-full items-start gap-2 text-left","data-testid":g,onClick:V,type:"button",children:[y,u]}),e[19]=o,e[20]=u,e[21]=d,e[22]=g,e[23]=y,e[24]=p):p=e[24];let m;e[25]!==t.hash||e[26]!==E?(m=E!==void 0&&s("p",{className:"mt-1 text-xs text-destructive","data-testid":`issues-action-error-${t.hash}`,role:"alert",children:E}),e[25]=t.hash,e[26]=E,e[27]=m):m=e[27];let c;e[28]!==p||e[29]!==m?(c=w(B,{className:"max-w-80",children:[p,m]}),e[28]=p,e[29]=m,e[30]=c):c=e[30];const b=`issues-status-${t.hash}`;let f;e[31]!==t.status?(f=Je(t.status),e[31]=t.status,e[32]=f):f=e[32];let I;e[33]!==t.status||e[34]!==b||e[35]!==f?(I=s(B,{children:s(pe,{"data-testid":b,variant:f,children:t.status})}),e[33]=t.status,e[34]=b,e[35]=f,e[36]=I):I=e[36];const L=t.severity??ge;let l;e[37]!==a?(l=a("Set severity"),e[37]=a,e[38]=l):l=e[38];const le=`issues-severity-${t.hash}`;let O;e[39]!==a?(O=a("—"),e[39]=a,e[40]=O):O=e[40];let S;e[41]!==t.severity||e[42]!==a?(S=t.severity===void 0?s("span",{className:"text-muted-foreground",children:a("—")}):s(pe,{variant:Ze(t.severity),children:t.severity}),e[41]=t.severity,e[42]=a,e[43]=S):S=e[43];let k;e[44]!==O||e[45]!==S?(k=s(Me,{placeholder:O,children:S}),e[44]=O,e[45]=S,e[46]=k):k=e[46];let U;e[47]!==l||e[48]!==le||e[49]!==k?(U=s(Re,{"aria-label":l,className:"h-7 w-[110px]","data-testid":le,children:k}),e[47]=l,e[48]=le,e[49]=k,e[50]=U):U=e[50];let z;e[51]===Symbol.for("react.memo_cache_sentinel")?(z=Ge.map(at),e[51]=z):z=e[51];let H;e[52]!==a?(H=a("Clear"),e[52]=a,e[53]=H):H=e[53];let j;e[54]!==H?(j=w(Ke,{children:[z,s(Ne,{value:ge,children:H})]}),e[54]=H,e[55]=j):j=e[55];let D;e[56]!==h||e[57]!==K||e[58]!==L||e[59]!==U||e[60]!==j?(D=s(B,{children:w(Ve,{disabled:h,onValueChange:K,value:L,children:[U,j]})}),e[56]=h,e[57]=K,e[58]=L,e[59]=U,e[60]=j,e[61]=D):D=e[61];let q;e[62]!==a?(q=a("Assignee"),e[62]=a,e[63]=q):q=e[63];const ue=`issues-assignee-${t.hash}`,me=t.assignee??"",fe=t.assignee??"";let G;e[64]!==a?(G=a("Unassigned"),e[64]=a,e[65]=G):G=e[65];let P;e[66]!==h||e[67]!==_||e[68]!==q||e[69]!==ue||e[70]!==me||e[71]!==fe||e[72]!==G?(P=s(B,{children:s(ke,{"aria-label":q,className:"h-7 w-32","data-testid":ue,defaultValue:me,disabled:h,onKeyDown:_,placeholder:G},fe)}),e[66]=h,e[67]=_,e[68]=q,e[69]=ue,e[70]=me,e[71]=fe,e[72]=G,e[73]=P):P=e[73];let W;e[74]!==t.count?(W=s(B,{className:"text-right",children:s(pe,{variant:"secondary",children:t.count})}),e[74]=t.count,e[75]=W):W=e[75];let Y;e[76]!==t.lastSeen?(Y=He(t.lastSeen),e[76]=t.lastSeen,e[77]=Y):Y=e[77];let Q;e[78]!==Y?(Q=s(B,{className:"text-xs tabular-nums text-muted-foreground",children:Y}),e[78]=Y,e[79]=Q):Q=e[79];let X;e[80]!==h||e[81]!==t.hash||e[82]!==t.status||e[83]!==i||e[84]!==a?(X=t.status!=="resolved"&&s(oe,{"data-testid":`issues-resolve-${t.hash}`,disabled:h,onClick:()=>{re(i(t.hash,Pe,{}))},size:"xs",variant:"outline",children:a("Resolve")}),e[80]=h,e[81]=t.hash,e[82]=t.status,e[83]=i,e[84]=a,e[85]=X):X=e[85];let J;e[86]!==h||e[87]!==t.hash||e[88]!==t.status||e[89]!==i||e[90]!==a?(J=t.status!=="ignored"&&s(oe,{"data-testid":`issues-ignore-${t.hash}`,disabled:h,onClick:()=>{re(i(t.hash,We,{}))},size:"xs",variant:"ghost",children:a("Ignore")}),e[86]=h,e[87]=t.hash,e[88]=t.status,e[89]=i,e[90]=a,e[91]=J):J=e[91];let Z;e[92]!==h||e[93]!==t.assignee||e[94]!==t.hash||e[95]!==t.status||e[96]!==i||e[97]!==a?(Z=t.status!=="open"&&s(oe,{"data-testid":`issues-reopen-${t.hash}`,disabled:h,onClick:()=>{re(i(t.hash,ve,{assignee:t.assignee??null}))},size:"xs",variant:"ghost",children:a("Reopen")}),e[92]=h,e[93]=t.assignee,e[94]=t.hash,e[95]=t.status,e[96]=i,e[97]=a,e[98]=Z):Z=e[98];let ee;e[99]!==X||e[100]!==J||e[101]!==Z?(ee=s(B,{className:"text-right",children:w("div",{className:"flex justify-end gap-1",children:[X,J,Z]})}),e[99]=X,e[100]=J,e[101]=Z,e[102]=ee):ee=e[102];let te;e[103]!==c||e[104]!==I||e[105]!==D||e[106]!==P||e[107]!==W||e[108]!==Q||e[109]!==M||e[110]!==ee?(te=w(ye,{"data-testid":M,children:[c,I,D,P,W,Q,ee]}),e[103]=c,e[104]=I,e[105]=D,e[106]=P,e[107]=W,e[108]=Q,e[109]=M,e[110]=ee,e[111]=te):te=e[111];let se;e[112]!==o||e[113]!==t||e[114]!==r?(se=s(et,{expanded:o,issue:t,shardKey:r},t.sampleMessage),e[112]=o,e[113]=t,e[114]=r,e[115]=se):se=e[115];let ce;return e[116]!==te||e[117]!==se?(ce=w(De,{children:[te,se]}),e[116]=te,e[117]=se,e[118]=ce):ce=e[118],ce},Tt=n=>{const e=xe(38),{initialShardKey:h}=n,t=Se(),E=be(),{queryShardKey:i,setShardKey:r,shardKey:a}=ze(h),[o,R]=ne("all"),[A,V]=ne(it),[C,K]=ne(lt);let T;e[0]!==o?(T=o==="all"?{}:{status:o},e[0]=o,e[1]=T):T=e[1];let _;e[2]!==i?(_={live:!0,shardKey:i},e[2]=i,e[3]=_):_=e[3];const{data:M,error:d,liveError:g}=Be(ie.getIssues,T,_),$=M!==void 0;let x;if(e[4]!==C||e[5]!==A||e[6]!==E||e[7]!==M||e[8]!==d||e[9]!==g||e[10]!==$||e[11]!==i||e[12]!==r||e[13]!==a||e[14]!==o||e[15]!==t){const y=Xe(M);let v;e[17]!==E||e[18]!==i?(v=async(l,le,O)=>{K(S=>{if(!S.has(l))return S;const k=new Map(S);return k.delete(l),k}),V(S=>new Set(S).add(l));try{await E.query(le,{...O,hash:l},Ie(i))}catch(S){const U=je(S);K(z=>new Map(z).set(l,U))}V(S=>{const k=new Set(S);return k.delete(l),k})},e[17]=E,e[18]=i,e[19]=v):v=e[19];const N=v;let u;e[20]!==t?(u=l=>t(l==="all"?"All":l==="open"?"Open":l==="resolved"?"Resolved":"Ignored"),e[20]=t,e[21]=u):u=e[21];const p=u;let m;e[22]!==d?(m=d!==null&&s("p",{className:"text-sm text-destructive","data-testid":"issues-error",role:"alert",children:d}),e[22]=d,e[23]=m):m=e[23];let c;e[24]!==r||e[25]!==a?(c=s($e,{onChange:r,testId:"issues-shard-input",value:a}),e[24]=r,e[25]=a,e[26]=c):c=e[26];let b;e[27]!==g?(b=s(Te,{message:g,prefix:"issues"}),e[27]=g,e[28]=b):b=e[28];let f;e[29]!==o||e[30]!==p?(f=qe.map(l=>s(oe,{"data-active":o===l?"":void 0,"data-testid":`issues-filter-${l}`,onClick:()=>{R(l)},size:"xs",variant:o===l?"default":"outline",children:p(l)},l)),e[29]=o,e[30]=p,e[31]=f):f=e[31];let I;e[32]!==f?(I=s("div",{className:"ms-auto flex items-center gap-1","data-testid":"issues-status-filter",role:"group",children:f}),e[32]=f,e[33]=I):I=e[33];let L;e[34]!==I||e[35]!==c||e[36]!==b?(L=w("div",{className:"flex flex-wrap items-center gap-2",children:[c,b,I]}),e[34]=I,e[35]=c,e[36]=b,e[37]=L):L=e[37],x=w("div",{className:"flex flex-col gap-6","data-testid":"lunora-issues-panel",children:[m,L,$&&y.length===0?s(_e,{description:t("No grouped errors yet. When a function throws or a container crashes, matching errors fold into a single issue here."),testId:"issues-empty",title:t("No issues")}):s(Ae,{className:"overflow-hidden py-0",children:s(Ce,{className:"px-0",children:w(Le,{"data-testid":"issues-table",children:[s(Oe,{children:w(ye,{children:[s(F,{children:t("Issue")}),s(F,{children:t("Status")}),s(F,{children:t("Severity")}),s(F,{children:t("Assignee")}),s(F,{className:"text-right",children:t("Events")}),s(F,{children:t("Last seen")}),s(F,{className:"text-right",children:t("Actions")})]})}),s(Ue,{children:y.map(l=>s(tt,{busy:A.has(l.hash),issue:l,rowError:C.get(l.hash),runTriage:N,shardKey:i},l.hash))})]})})})]}),e[4]=C,e[5]=A,e[6]=E,e[7]=M,e[8]=d,e[9]=g,e[10]=$,e[11]=i,e[12]=r,e[13]=a,e[14]=o,e[15]=t,e[16]=x}else x=e[16];return x};function st(n){return!n}function at(n){return s(Ne,{value:n,children:n},n)}function it(){return new Set}function lt(){return new Map}export{Tt as default};
|
|
1
|
+
import{c as xe}from"react/compiler-runtime";import{findIssueSolution as we,flattenHint as Ee}from"@lunora/errors";import{useState as ne}from"react";import{L as Te}from"../packem_shared/live-status-D1GasNsH.mjs";import{ShardInput as $e}from"../packem_shared/ShardInput-CoySruKZ.mjs";import{B as pe}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as oe}from"../packem_shared/button-q0UYSmrn.mjs";import{C as Ae,a as Ce}from"../packem_shared/card-By2O8ULa.mjs";import{E as _e}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as ke}from"../packem_shared/input-CXhxesPC.mjs";import{S as Me,a as Re,b as Ke,c as Ne,d as Ve}from"../packem_shared/select-DPyS18Vy.mjs";import{T as Le,a as Oe,b as ye,c as F,d as Ue,e as B}from"../packem_shared/table-D0SBiDu-.mjs";import{u as Be}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{u as Fe}from"../packem_shared/use-async-submit-D0r7-m2J.mjs";import{u as ze}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{u as be}from"../packem_shared/use-studio-client-DCA50tF2.mjs";import{useT as Se}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as ie}from"../packem_shared/ADMIN_FUNCTIONS-DUXsXId1.mjs";import{h as He,f as re,c as de,d as Ie,b as je}from"../packem_shared/internal-hIuTpSbx.mjs";import{jsx as s,jsxs as w,Fragment as De}from"react/jsx-runtime";const ge="none",qe=["all","open","resolved","ignored"],Ge=["critical","high","medium","low"],Pe=de(ie.resolveIssue),We=de(ie.ignoreIssue),ve=de(ie.assignIssue),Ye=de(ie.setIssueSeverity),Qe=de(ie.explainIssue),Xe=n=>Array.isArray(n?.issues)?n.issues:[],Je=n=>n==="resolved"?"success":n==="ignored"?"secondary":"warning",Ze=n=>n==="critical"?"destructive":n==="high"?"warning":n==="medium"?"info":"secondary",et=n=>{const e=xe(44),{expanded:h,issue:t,shardKey:E}=n,i=be(),r=Se(),[a,o]=ne(void 0),{busy:R,error:A,run:V}=Fe();let C;e[0]!==i||e[1]!==t||e[2]!==V||e[3]!==E?(C=()=>{o(void 0),V(async()=>{const f={culprit:t.culprit,sampleMessage:t.sampleMessage,title:t.title},I=await i.query(Qe,f,Ie(E));o(I)})},e[0]=i,e[1]=t,e[2]=V,e[3]=E,e[4]=C):C=e[4];const K=C;if(!h)return null;let T;if(e[5]!==t.sampleMessage){const f=we(t.sampleMessage);T=f===void 0?void 0:Ee(f.body),e[5]=t.sampleMessage,e[6]=T}else T=e[6];const _=T,M=`issues-detail-${t.hash}`;let d;e[7]!==t.sampleMessage?(d=s("p",{className:"whitespace-pre-wrap font-mono text-xs text-muted-foreground",children:t.sampleMessage}),e[7]=t.sampleMessage,e[8]=d):d=e[8];let g;e[9]!==r?(g=r("Suggested fix"),e[9]=r,e[10]=g):g=e[10];let $;e[11]!==g?($=s("div",{className:"text-xs font-medium text-muted-foreground",children:g}),e[11]=g,e[12]=$):$=e[12];let x;e[13]!==_||e[14]!==t.hash||e[15]!==r?(x=_===void 0?s("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":`issues-hint-empty-${t.hash}`,children:r("No known fix for this error yet.")}):s("p",{className:"mt-1 whitespace-pre-wrap text-sm","data-testid":`issues-hint-${t.hash}`,children:_}),e[13]=_,e[14]=t.hash,e[15]=r,e[16]=x):x=e[16];let y;e[17]!==$||e[18]!==x?(y=w("div",{children:[$,x]}),e[17]=$,e[18]=x,e[19]=y):y=e[19];const v=`issues-explain-${t.hash}`;let N;e[20]!==R||e[21]!==r?(N=r(R?"Explaining…":"Explain in plain language"),e[20]=R,e[21]=r,e[22]=N):N=e[22];let u;e[23]!==R||e[24]!==K||e[25]!==N||e[26]!==v?(u=s("div",{children:s(oe,{"data-testid":v,disabled:R,onClick:K,size:"sm",type:"button",variant:"outline",children:N})}),e[23]=R,e[24]=K,e[25]=N,e[26]=v,e[27]=u):u=e[27];let p;e[28]!==A||e[29]!==t.hash?(p=A!==null&&s("p",{className:"text-xs text-destructive","data-testid":`issues-explain-error-${t.hash}`,role:"alert",children:A}),e[28]=A,e[29]=t.hash,e[30]=p):p=e[30];let m;e[31]!==a||e[32]!==t.hash||e[33]!==r?(m=a!==void 0&&(a.degraded?s("p",{className:"text-xs text-muted-foreground","data-testid":`issues-degraded-${t.hash}`,children:a.reason==="no-ai-binding"?r("No AI binding is configured. Wire an AI binding to enable plain-language explanations — the suggested fix above is always available."):r("The AI model could not explain this error right now. The suggested fix above still applies.")}):w("div",{"data-testid":`issues-explanation-${t.hash}`,children:[s("div",{className:"text-xs font-medium text-muted-foreground",children:r("AI explanation")}),s("p",{className:"mt-1 whitespace-pre-wrap text-sm",children:a.explanation}),a.groundedId===void 0&&s("p",{className:"mt-1 text-xs text-muted-foreground","data-testid":`issues-ungrounded-${t.hash}`,children:r("No catalog fix matched this error, so this explanation is the model's own reading of the message. Verify before acting on it.")}),s("p",{className:"mt-1 text-[0.7rem] text-muted-foreground",children:r("Generated by {model}",{model:a.model})})]})),e[31]=a,e[32]=t.hash,e[33]=r,e[34]=m):m=e[34];let c;e[35]!==u||e[36]!==p||e[37]!==m||e[38]!==d||e[39]!==y?(c=s(B,{className:"bg-muted/30",colSpan:7,children:w("div",{className:"flex flex-col gap-3 py-1",children:[d,y,u,p,m]})}),e[35]=u,e[36]=p,e[37]=m,e[38]=d,e[39]=y,e[40]=c):c=e[40];let b;return e[41]!==c||e[42]!==M?(b=s(ye,{"data-testid":M,children:c}),e[41]=c,e[42]=M,e[43]=b):b=e[43],b},tt=n=>{const e=xe(119),{busy:h,issue:t,rowError:E,runTriage:i,shardKey:r}=n,a=Se(),[o,R]=ne(!1);let A;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{R(st)},e[0]=A):A=e[0];const V=A;let C;e[1]!==t.hash||e[2]!==i?(C=ae=>{const he=ae===null||ae===ge?null:ae;re(i(t.hash,Ye,{severity:he}))},e[1]=t.hash,e[2]=i,e[3]=C):C=e[3];const K=C;let T;e[4]!==t.hash||e[5]!==i?(T=ae=>{if(ae.key!=="Enter")return;const he=ae.currentTarget.value.trim();re(i(t.hash,ve,{assignee:he===""?null:he}))},e[4]=t.hash,e[5]=i,e[6]=T):T=e[6];const _=T,M=`issues-row-${t.hash}`;let d;e[7]!==a?(d=a("Toggle issue details"),e[7]=a,e[8]=d):d=e[8];const g=`issues-toggle-${t.hash}`,$=`mt-1 size-3 shrink-0 text-muted-foreground transition-transform ${o?"rotate-90":""}`;let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=s("path",{d:"m9 6 6 6-6 6"}),e[9]=x):x=e[9];let y;e[10]!==$?(y=s("svg",{"aria-hidden":"true",className:$,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:x}),e[10]=$,e[11]=y):y=e[11];let v;e[12]!==t.title?(v=s("span",{className:"block truncate font-medium",title:t.title,children:t.title}),e[12]=t.title,e[13]=v):v=e[13];let N;e[14]!==t.culprit?(N=s("span",{className:"block truncate font-mono text-xs text-muted-foreground",title:t.culprit,children:t.culprit}),e[14]=t.culprit,e[15]=N):N=e[15];let u;e[16]!==v||e[17]!==N?(u=w("span",{className:"min-w-0",children:[v,N]}),e[16]=v,e[17]=N,e[18]=u):u=e[18];let p;e[19]!==o||e[20]!==u||e[21]!==d||e[22]!==g||e[23]!==y?(p=w("button",{"aria-expanded":o,"aria-label":d,className:"flex w-full items-start gap-2 text-left","data-testid":g,onClick:V,type:"button",children:[y,u]}),e[19]=o,e[20]=u,e[21]=d,e[22]=g,e[23]=y,e[24]=p):p=e[24];let m;e[25]!==t.hash||e[26]!==E?(m=E!==void 0&&s("p",{className:"mt-1 text-xs text-destructive","data-testid":`issues-action-error-${t.hash}`,role:"alert",children:E}),e[25]=t.hash,e[26]=E,e[27]=m):m=e[27];let c;e[28]!==p||e[29]!==m?(c=w(B,{className:"max-w-80",children:[p,m]}),e[28]=p,e[29]=m,e[30]=c):c=e[30];const b=`issues-status-${t.hash}`;let f;e[31]!==t.status?(f=Je(t.status),e[31]=t.status,e[32]=f):f=e[32];let I;e[33]!==t.status||e[34]!==b||e[35]!==f?(I=s(B,{children:s(pe,{"data-testid":b,variant:f,children:t.status})}),e[33]=t.status,e[34]=b,e[35]=f,e[36]=I):I=e[36];const L=t.severity??ge;let l;e[37]!==a?(l=a("Set severity"),e[37]=a,e[38]=l):l=e[38];const le=`issues-severity-${t.hash}`;let O;e[39]!==a?(O=a("—"),e[39]=a,e[40]=O):O=e[40];let S;e[41]!==t.severity||e[42]!==a?(S=t.severity===void 0?s("span",{className:"text-muted-foreground",children:a("—")}):s(pe,{variant:Ze(t.severity),children:t.severity}),e[41]=t.severity,e[42]=a,e[43]=S):S=e[43];let k;e[44]!==O||e[45]!==S?(k=s(Me,{placeholder:O,children:S}),e[44]=O,e[45]=S,e[46]=k):k=e[46];let U;e[47]!==l||e[48]!==le||e[49]!==k?(U=s(Re,{"aria-label":l,className:"h-7 w-[110px]","data-testid":le,children:k}),e[47]=l,e[48]=le,e[49]=k,e[50]=U):U=e[50];let z;e[51]===Symbol.for("react.memo_cache_sentinel")?(z=Ge.map(at),e[51]=z):z=e[51];let H;e[52]!==a?(H=a("Clear"),e[52]=a,e[53]=H):H=e[53];let j;e[54]!==H?(j=w(Ke,{children:[z,s(Ne,{value:ge,children:H})]}),e[54]=H,e[55]=j):j=e[55];let D;e[56]!==h||e[57]!==K||e[58]!==L||e[59]!==U||e[60]!==j?(D=s(B,{children:w(Ve,{disabled:h,onValueChange:K,value:L,children:[U,j]})}),e[56]=h,e[57]=K,e[58]=L,e[59]=U,e[60]=j,e[61]=D):D=e[61];let q;e[62]!==a?(q=a("Assignee"),e[62]=a,e[63]=q):q=e[63];const ue=`issues-assignee-${t.hash}`,me=t.assignee??"",fe=t.assignee??"";let G;e[64]!==a?(G=a("Unassigned"),e[64]=a,e[65]=G):G=e[65];let P;e[66]!==h||e[67]!==_||e[68]!==q||e[69]!==ue||e[70]!==me||e[71]!==fe||e[72]!==G?(P=s(B,{children:s(ke,{"aria-label":q,className:"h-7 w-32","data-testid":ue,defaultValue:me,disabled:h,onKeyDown:_,placeholder:G},fe)}),e[66]=h,e[67]=_,e[68]=q,e[69]=ue,e[70]=me,e[71]=fe,e[72]=G,e[73]=P):P=e[73];let W;e[74]!==t.count?(W=s(B,{className:"text-right",children:s(pe,{variant:"secondary",children:t.count})}),e[74]=t.count,e[75]=W):W=e[75];let Y;e[76]!==t.lastSeen?(Y=He(t.lastSeen),e[76]=t.lastSeen,e[77]=Y):Y=e[77];let Q;e[78]!==Y?(Q=s(B,{className:"text-xs tabular-nums text-muted-foreground",children:Y}),e[78]=Y,e[79]=Q):Q=e[79];let X;e[80]!==h||e[81]!==t.hash||e[82]!==t.status||e[83]!==i||e[84]!==a?(X=t.status!=="resolved"&&s(oe,{"data-testid":`issues-resolve-${t.hash}`,disabled:h,onClick:()=>{re(i(t.hash,Pe,{}))},size:"xs",variant:"outline",children:a("Resolve")}),e[80]=h,e[81]=t.hash,e[82]=t.status,e[83]=i,e[84]=a,e[85]=X):X=e[85];let J;e[86]!==h||e[87]!==t.hash||e[88]!==t.status||e[89]!==i||e[90]!==a?(J=t.status!=="ignored"&&s(oe,{"data-testid":`issues-ignore-${t.hash}`,disabled:h,onClick:()=>{re(i(t.hash,We,{}))},size:"xs",variant:"ghost",children:a("Ignore")}),e[86]=h,e[87]=t.hash,e[88]=t.status,e[89]=i,e[90]=a,e[91]=J):J=e[91];let Z;e[92]!==h||e[93]!==t.assignee||e[94]!==t.hash||e[95]!==t.status||e[96]!==i||e[97]!==a?(Z=t.status!=="open"&&s(oe,{"data-testid":`issues-reopen-${t.hash}`,disabled:h,onClick:()=>{re(i(t.hash,ve,{assignee:t.assignee??null}))},size:"xs",variant:"ghost",children:a("Reopen")}),e[92]=h,e[93]=t.assignee,e[94]=t.hash,e[95]=t.status,e[96]=i,e[97]=a,e[98]=Z):Z=e[98];let ee;e[99]!==X||e[100]!==J||e[101]!==Z?(ee=s(B,{className:"text-right",children:w("div",{className:"flex justify-end gap-1",children:[X,J,Z]})}),e[99]=X,e[100]=J,e[101]=Z,e[102]=ee):ee=e[102];let te;e[103]!==c||e[104]!==I||e[105]!==D||e[106]!==P||e[107]!==W||e[108]!==Q||e[109]!==M||e[110]!==ee?(te=w(ye,{"data-testid":M,children:[c,I,D,P,W,Q,ee]}),e[103]=c,e[104]=I,e[105]=D,e[106]=P,e[107]=W,e[108]=Q,e[109]=M,e[110]=ee,e[111]=te):te=e[111];let se;e[112]!==o||e[113]!==t||e[114]!==r?(se=s(et,{expanded:o,issue:t,shardKey:r},t.sampleMessage),e[112]=o,e[113]=t,e[114]=r,e[115]=se):se=e[115];let ce;return e[116]!==te||e[117]!==se?(ce=w(De,{children:[te,se]}),e[116]=te,e[117]=se,e[118]=ce):ce=e[118],ce},Tt=n=>{const e=xe(38),{initialShardKey:h}=n,t=Se(),E=be(),{queryShardKey:i,setShardKey:r,shardKey:a}=ze(h),[o,R]=ne("all"),[A,V]=ne(it),[C,K]=ne(lt);let T;e[0]!==o?(T=o==="all"?{}:{status:o},e[0]=o,e[1]=T):T=e[1];let _;e[2]!==i?(_={live:!0,shardKey:i},e[2]=i,e[3]=_):_=e[3];const{data:M,error:d,liveError:g}=Be(ie.getIssues,T,_),$=M!==void 0;let x;if(e[4]!==C||e[5]!==A||e[6]!==E||e[7]!==M||e[8]!==d||e[9]!==g||e[10]!==$||e[11]!==i||e[12]!==r||e[13]!==a||e[14]!==o||e[15]!==t){const y=Xe(M);let v;e[17]!==E||e[18]!==i?(v=async(l,le,O)=>{K(S=>{if(!S.has(l))return S;const k=new Map(S);return k.delete(l),k}),V(S=>new Set(S).add(l));try{await E.query(le,{...O,hash:l},Ie(i))}catch(S){const U=je(S);K(z=>new Map(z).set(l,U))}V(S=>{const k=new Set(S);return k.delete(l),k})},e[17]=E,e[18]=i,e[19]=v):v=e[19];const N=v;let u;e[20]!==t?(u=l=>t(l==="all"?"All":l==="open"?"Open":l==="resolved"?"Resolved":"Ignored"),e[20]=t,e[21]=u):u=e[21];const p=u;let m;e[22]!==d?(m=d!==null&&s("p",{className:"text-sm text-destructive","data-testid":"issues-error",role:"alert",children:d}),e[22]=d,e[23]=m):m=e[23];let c;e[24]!==r||e[25]!==a?(c=s($e,{onChange:r,testId:"issues-shard-input",value:a}),e[24]=r,e[25]=a,e[26]=c):c=e[26];let b;e[27]!==g?(b=s(Te,{message:g,prefix:"issues"}),e[27]=g,e[28]=b):b=e[28];let f;e[29]!==o||e[30]!==p?(f=qe.map(l=>s(oe,{"data-active":o===l?"":void 0,"data-testid":`issues-filter-${l}`,onClick:()=>{R(l)},size:"xs",variant:o===l?"default":"outline",children:p(l)},l)),e[29]=o,e[30]=p,e[31]=f):f=e[31];let I;e[32]!==f?(I=s("div",{className:"ms-auto flex items-center gap-1","data-testid":"issues-status-filter",role:"group",children:f}),e[32]=f,e[33]=I):I=e[33];let L;e[34]!==I||e[35]!==c||e[36]!==b?(L=w("div",{className:"flex flex-wrap items-center gap-2",children:[c,b,I]}),e[34]=I,e[35]=c,e[36]=b,e[37]=L):L=e[37],x=w("div",{className:"flex flex-col gap-6","data-testid":"lunora-issues-panel",children:[m,L,$&&y.length===0?s(_e,{description:t("No grouped errors yet. When a function throws or a container crashes, matching errors fold into a single issue here."),testId:"issues-empty",title:t("No issues")}):s(Ae,{className:"overflow-hidden py-0",children:s(Ce,{className:"px-0",children:w(Le,{"data-testid":"issues-table",children:[s(Oe,{children:w(ye,{children:[s(F,{children:t("Issue")}),s(F,{children:t("Status")}),s(F,{children:t("Severity")}),s(F,{children:t("Assignee")}),s(F,{className:"text-right",children:t("Events")}),s(F,{children:t("Last seen")}),s(F,{className:"text-right",children:t("Actions")})]})}),s(Ue,{children:y.map(l=>s(tt,{busy:A.has(l.hash),issue:l,rowError:C.get(l.hash),runTriage:N,shardKey:i},l.hash))})]})})})]}),e[4]=C,e[5]=A,e[6]=E,e[7]=M,e[8]=d,e[9]=g,e[10]=$,e[11]=i,e[12]=r,e[13]=a,e[14]=o,e[15]=t,e[16]=x}else x=e[16];return x};function st(n){return!n}function at(n){return s(Ne,{value:n,children:n},n)}function it(){return new Set}function lt(){return new Map}export{Tt as default};
|