@lunora/studio 1.0.0-alpha.376 → 1.0.0-alpha.378

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.
Files changed (222) hide show
  1. package/dist/index.d.mts +16 -5
  2. package/dist/index.d.ts +16 -5
  3. package/dist/index.mjs +1 -1
  4. package/dist/mount.d.mts +1 -1
  5. package/dist/mount.d.ts +1 -1
  6. package/dist/mount.mjs +1 -1
  7. package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -1
  8. package/dist/packem_chunks/ApiTab.mjs +1 -1
  9. package/dist/packem_chunks/AuditPanel.mjs +1 -1
  10. package/dist/packem_chunks/ExportImportPanel.mjs +1 -1
  11. package/dist/packem_chunks/FileBrowser.mjs +1 -1
  12. package/dist/packem_chunks/FunctionRunner.mjs +1 -1
  13. package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -1
  14. package/dist/packem_chunks/HealthPanel.mjs +1 -1
  15. package/dist/packem_chunks/InsightsPanel.mjs +1 -1
  16. package/dist/packem_chunks/LogsPanel.mjs +1 -1
  17. package/dist/packem_chunks/MailPanel.mjs +1 -1
  18. package/dist/packem_chunks/MetricsPanel.mjs +1 -1
  19. package/dist/packem_chunks/NotificationsPanel.mjs +1 -1
  20. package/dist/packem_chunks/PitrPanel.mjs +1 -1
  21. package/dist/packem_chunks/SchemaViewer.mjs +1 -1
  22. package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -1
  23. package/dist/packem_chunks/SettingsPanel.mjs +1 -1
  24. package/dist/packem_chunks/SqlEditorPanel.mjs +1 -1
  25. package/dist/packem_chunks/TableEditor.mjs +1 -1
  26. package/dist/packem_chunks/agents-panel.mjs +1 -1
  27. package/dist/packem_chunks/ai-knowledge.mjs +1 -1
  28. package/dist/packem_chunks/ai-usage-panel.mjs +1 -1
  29. package/dist/packem_chunks/assistant-panel.mjs +1 -1
  30. package/dist/packem_chunks/auth-audit-panel.mjs +1 -1
  31. package/dist/packem_chunks/containers-panel.mjs +1 -1
  32. package/dist/packem_chunks/dashboards-panel.mjs +1 -1
  33. package/dist/packem_chunks/evals-panel.mjs +1 -1
  34. package/dist/packem_chunks/fanout-panel.mjs +1 -1
  35. package/dist/packem_chunks/flags-panel.mjs +1 -1
  36. package/dist/packem_chunks/issues-panel.mjs +1 -1
  37. package/dist/packem_chunks/kv-browser.mjs +1 -1
  38. package/dist/packem_chunks/migrations-route.mjs +1 -1
  39. package/dist/packem_chunks/payments-panel.mjs +1 -1
  40. package/dist/packem_chunks/permissions-panel.mjs +1 -1
  41. package/dist/packem_chunks/privacy-requests-panel.mjs +1 -1
  42. package/dist/packem_chunks/queues-panel.mjs +1 -1
  43. package/dist/packem_chunks/reactors-panel.mjs +1 -1
  44. package/dist/packem_chunks/rls-panel.mjs +1 -1
  45. package/dist/packem_chunks/schedule-panel.mjs +1 -1
  46. package/dist/packem_chunks/storage-rules-panel.mjs +1 -1
  47. package/dist/packem_chunks/subscriptions-panel.mjs +1 -1
  48. package/dist/packem_chunks/traces-panel.mjs +1 -1
  49. package/dist/packem_chunks/workflows-panel.mjs +1 -1
  50. package/dist/packem_shared/ADMIN_FUNCTIONS-DAHZ35kM.mjs +1 -0
  51. package/dist/packem_shared/{ApiDocsPanel-xqgxgYCy.mjs → ApiDocsPanel-sEDqUNQq.mjs} +1 -1
  52. package/dist/packem_shared/{DataBrowser-BR2nrvMW.mjs → DataBrowser-CkVOu6py.mjs} +1 -1
  53. package/dist/packem_shared/{GlobalDataBrowser-Df5S1NxG.mjs → GlobalDataBrowser-l2ECwXCm.mjs} +1 -1
  54. package/dist/packem_shared/{HomePanel-CHq9VBrh.mjs → HomePanel-c7as4tvl.mjs} +1 -1
  55. package/dist/packem_shared/{MigrationsPanel-BWGgOwmX.mjs → MigrationsPanel-BQol4Un1.mjs} +1 -1
  56. package/dist/packem_shared/{Studio-JuMI1hpi.mjs → Studio-BmbkaUrx.mjs} +1 -1
  57. package/dist/packem_shared/{StudioApp-02dw_keu.mjs → StudioApp-CsyDnrg2.mjs} +1 -1
  58. package/dist/packem_shared/{advisor-view-Dj-mZPAq.mjs → advisor-view-gtf_DhUU.mjs} +1 -1
  59. package/dist/packem_shared/{app.d-BXrVLb99.d.mts → app.d-DpxFQ0qO.d.mts} +14 -0
  60. package/dist/packem_shared/{app.d-BXrVLb99.d.ts → app.d-DpxFQ0qO.d.ts} +14 -0
  61. package/dist/packem_shared/{assistant-provider-BQG7QZAu.mjs → assistant-provider-Dw0roZh3.mjs} +1 -1
  62. package/dist/packem_shared/{error-alert-BzZfqmf4.mjs → error-alert-3AR_-s_s.mjs} +1 -1
  63. package/dist/packem_shared/{home-panel-DTWHlX5S.mjs → home-panel-TpxiaHgB.mjs} +1 -1
  64. package/dist/packem_shared/log-fields-PjFFEqv0.mjs +8 -0
  65. package/dist/packem_shared/log-line-DnvvQnY5.mjs +1 -0
  66. package/dist/packem_shared/{studio-DtxNxSjs.mjs → studio-DZlpp4Vx.mjs} +1 -1
  67. package/dist/packem_shared/{table-list-sidebar-C8qPvzGk.mjs → table-list-sidebar-Bfmg04MD.mjs} +1 -1
  68. package/dist/packem_shared/{use-assistant-rpc-DCC6ph2u.mjs → use-assistant-rpc-AKu8hvPm.mjs} +1 -1
  69. package/dist/standalone/{chunk-SW52HGM4.js → chunk-27YLJQRE.js} +1 -1
  70. package/dist/standalone/{chunk-J45HAKBU.js → chunk-2KTN53PK.js} +1 -1
  71. package/dist/standalone/chunk-2NUCBQFU.js +1 -0
  72. package/dist/standalone/{chunk-CCETXQNF.js → chunk-2Q66YTBU.js} +1 -1
  73. package/dist/standalone/{chunk-WSG35SRF.js → chunk-2RL5YVB7.js} +1 -1
  74. package/dist/standalone/chunk-2SWWUGUK.js +1 -0
  75. package/dist/standalone/{chunk-VXZAS5VS.js → chunk-3OVNOP65.js} +1 -1
  76. package/dist/standalone/{chunk-AFVVESAA.js → chunk-3PRGO2WY.js} +1 -1
  77. package/dist/standalone/{chunk-N3FNOCHB.js → chunk-3RZB5QXH.js} +1 -1
  78. package/dist/standalone/{chunk-4EPW63HS.js → chunk-4AG356VE.js} +1 -1
  79. package/dist/standalone/{chunk-IJNP6YSD.js → chunk-4I23RURI.js} +1 -1
  80. package/dist/standalone/{chunk-ZSWW2UGP.js → chunk-4KPATTV6.js} +1 -1
  81. package/dist/standalone/chunk-4S7ZIMWI.js +33 -0
  82. package/dist/standalone/{chunk-HFBSWKJS.js → chunk-4SY2N2RS.js} +1 -1
  83. package/dist/standalone/{chunk-25WEL5RI.js → chunk-4XNMLHOA.js} +1 -1
  84. package/dist/standalone/{chunk-4NKJV7YX.js → chunk-4YENBZSS.js} +1 -1
  85. package/dist/standalone/{chunk-645S7KRU.js → chunk-5G2OOLMF.js} +1 -1
  86. package/dist/standalone/{chunk-B76HLC52.js → chunk-66PQJM66.js} +1 -1
  87. package/dist/standalone/{chunk-K3MVWN6E.js → chunk-6DKBHMBL.js} +1 -1
  88. package/dist/standalone/{chunk-YTPE33AO.js → chunk-6EPIINAW.js} +1 -1
  89. package/dist/standalone/{chunk-QURCU2N2.js → chunk-6IECLZ2U.js} +1 -1
  90. package/dist/standalone/{chunk-SUUBCPUD.js → chunk-77PKR3WU.js} +1 -1
  91. package/dist/standalone/{chunk-6BH5TIGF.js → chunk-7MQI2RNF.js} +1 -1
  92. package/dist/standalone/chunk-7WGZSDRS.js +2 -0
  93. package/dist/standalone/{chunk-64LU3VU6.js → chunk-A5HJXHD2.js} +1 -1
  94. package/dist/standalone/{chunk-MWYGLPDV.js → chunk-A5INOAIL.js} +1 -1
  95. package/dist/standalone/{chunk-FEHRNTIU.js → chunk-A6E46F3B.js} +1 -1
  96. package/dist/standalone/{chunk-GWNGVKLG.js → chunk-A6TVTNKO.js} +1 -1
  97. package/dist/standalone/{chunk-6G3E4PJ2.js → chunk-ADABTCDI.js} +1 -1
  98. package/dist/standalone/{chunk-GXTSE66Z.js → chunk-AFLNQEZ5.js} +1 -1
  99. package/dist/standalone/{chunk-CLQKKJHL.js → chunk-AKC4XWCD.js} +1 -1
  100. package/dist/standalone/{chunk-BE3FD3E6.js → chunk-APTQ5BDE.js} +1 -1
  101. package/dist/standalone/{chunk-B4PRNI7H.js → chunk-ASSIQ4W7.js} +1 -1
  102. package/dist/standalone/{chunk-PEVNCIZQ.js → chunk-BEC2C3JD.js} +1 -1
  103. package/dist/standalone/{chunk-HSI24FPH.js → chunk-BMGCCYQL.js} +1 -1
  104. package/dist/standalone/{chunk-F4S2YEYW.js → chunk-BMS6CAKT.js} +1 -1
  105. package/dist/standalone/{chunk-D3DZZHZA.js → chunk-BOYBN3TE.js} +1 -1
  106. package/dist/standalone/{chunk-BQS3C5V3.js → chunk-BR2A4DYH.js} +1 -1
  107. package/dist/standalone/{chunk-OSHODLMU.js → chunk-CB22PV3X.js} +1 -1
  108. package/dist/standalone/chunk-CX2T7TTB.js +5 -0
  109. package/dist/standalone/{chunk-WB6VGH7X.js → chunk-CXAPSZF2.js} +1 -1
  110. package/dist/standalone/{chunk-CAEJQOMU.js → chunk-D5VO54BI.js} +1 -1
  111. package/dist/standalone/chunk-DKEK4ZO6.js +8 -0
  112. package/dist/standalone/{chunk-G6VBT4AU.js → chunk-DQWEVUGA.js} +1 -1
  113. package/dist/standalone/{chunk-2DT3QG6Q.js → chunk-DRHZZ7IN.js} +1 -1
  114. package/dist/standalone/{chunk-GMT66LBU.js → chunk-EA3RERQQ.js} +1 -1
  115. package/dist/standalone/{chunk-3D67ZJRW.js → chunk-EDL46BPM.js} +1 -1
  116. package/dist/standalone/{chunk-EYJX6GXU.js → chunk-ELXPUNSN.js} +1 -1
  117. package/dist/standalone/{chunk-4PI2OSSP.js → chunk-EOFWXI3T.js} +1 -1
  118. package/dist/standalone/{chunk-UBTKEHX6.js → chunk-F2EGC6HE.js} +1 -1
  119. package/dist/standalone/{chunk-HPD2PZP2.js → chunk-F32O6VAS.js} +1 -1
  120. package/dist/standalone/{chunk-X72A525Z.js → chunk-F5DCBRCJ.js} +1 -1
  121. package/dist/standalone/{chunk-OT2YNQPU.js → chunk-FBG5SSXS.js} +1 -1
  122. package/dist/standalone/chunk-FFQISGOB.js +1 -0
  123. package/dist/standalone/{chunk-QAQ3KMY6.js → chunk-FGEN2V4E.js} +1 -1
  124. package/dist/standalone/{chunk-7LCGAQWG.js → chunk-FNE6FFFN.js} +1 -1
  125. package/dist/standalone/{chunk-RDS46R5R.js → chunk-FOURRGSO.js} +1 -1
  126. package/dist/standalone/chunk-FPRVR763.js +8 -0
  127. package/dist/standalone/{chunk-PUU56AIE.js → chunk-FXSY2FCG.js} +1 -1
  128. package/dist/standalone/{chunk-C4BS3LHQ.js → chunk-FXZ6GEUP.js} +1 -1
  129. package/dist/standalone/{chunk-HAK2T6YN.js → chunk-H5AOMWTU.js} +1 -1
  130. package/dist/standalone/{chunk-2EB7FN5S.js → chunk-H6VTIXVB.js} +1 -1
  131. package/dist/standalone/{chunk-LQCF6SZW.js → chunk-HNNAMZHQ.js} +1 -1
  132. package/dist/standalone/{chunk-2BQNNRAP.js → chunk-IIIAOQ22.js} +1 -1
  133. package/dist/standalone/{chunk-LKML3CX4.js → chunk-IO3TEFOW.js} +1 -1
  134. package/dist/standalone/{chunk-KTK4NDWQ.js → chunk-IQ5CIBXJ.js} +1 -1
  135. package/dist/standalone/{chunk-QGAWQTUE.js → chunk-J76P372V.js} +1 -1
  136. package/dist/standalone/{chunk-7SNL633X.js → chunk-J7M7G2BA.js} +1 -1
  137. package/dist/standalone/{chunk-2MZLFQR5.js → chunk-JAY3ZKY6.js} +1 -1
  138. package/dist/standalone/{chunk-ELUYMLPL.js → chunk-JLPBW5EC.js} +1 -1
  139. package/dist/standalone/{chunk-HCOF7HOM.js → chunk-JNWK5MJC.js} +1 -1
  140. package/dist/standalone/{chunk-4DIRNQHR.js → chunk-KEICHBPK.js} +1 -1
  141. package/dist/standalone/{chunk-F5WJCL3F.js → chunk-KFDOGDD2.js} +1 -1
  142. package/dist/standalone/{chunk-MGFELY5Q.js → chunk-KMEDIMYZ.js} +1 -1
  143. package/dist/standalone/{chunk-YUVGMKHG.js → chunk-L27FKJTG.js} +1 -1
  144. package/dist/standalone/chunk-LDWYV63L.js +1 -0
  145. package/dist/standalone/{chunk-UBX5ZPLV.js → chunk-LMCBMC2V.js} +1 -1
  146. package/dist/standalone/chunk-LYVYUTQY.js +1 -0
  147. package/dist/standalone/{chunk-JIBRGVA7.js → chunk-MFVL3BKJ.js} +1 -1
  148. package/dist/standalone/chunk-MHZNDDGI.js +1 -0
  149. package/dist/standalone/{chunk-FERYOTLW.js → chunk-MSZMSG3J.js} +1 -1
  150. package/dist/standalone/{chunk-X45MVUVK.js → chunk-N5A7KU32.js} +1 -1
  151. package/dist/standalone/{chunk-QRA7AKYO.js → chunk-N7FOBAV3.js} +1 -1
  152. package/dist/standalone/{chunk-ZFEDRJ7R.js → chunk-NIGA74BG.js} +1 -1
  153. package/dist/standalone/{chunk-RTE7SDRS.js → chunk-NOJMUWHR.js} +1 -1
  154. package/dist/standalone/{chunk-QXNMGPXW.js → chunk-NSPPZR3Q.js} +1 -1
  155. package/dist/standalone/{chunk-CURIWKKC.js → chunk-O5NP5MVG.js} +1 -1
  156. package/dist/standalone/{chunk-TW4O2BA5.js → chunk-O5QATFN3.js} +3 -3
  157. package/dist/standalone/{chunk-PYQUCCUO.js → chunk-O65MHZCA.js} +1 -1
  158. package/dist/standalone/{chunk-6FPV3EK2.js → chunk-ODEIAS3V.js} +1 -1
  159. package/dist/standalone/{chunk-D65UVZIA.js → chunk-OWRWDDJT.js} +1 -1
  160. package/dist/standalone/{chunk-VUOEJJUH.js → chunk-OZID3UYF.js} +1 -1
  161. package/dist/standalone/{chunk-K46QTJR6.js → chunk-PKOFJJA2.js} +1 -1
  162. package/dist/standalone/{chunk-UVNJG3UL.js → chunk-PLONGJJL.js} +1 -1
  163. package/dist/standalone/{chunk-W2FHSEQW.js → chunk-QEQGGAZQ.js} +1 -1
  164. package/dist/standalone/{chunk-VNH4OBJS.js → chunk-QF743FSL.js} +1 -1
  165. package/dist/standalone/{chunk-ONTGYVAN.js → chunk-QLZGKBOW.js} +1 -1
  166. package/dist/standalone/chunk-R3RIZDUS.js +1 -0
  167. package/dist/standalone/{chunk-4RGKUS3H.js → chunk-R55GP52Y.js} +1 -1
  168. package/dist/standalone/{chunk-WAIESA3E.js → chunk-R6B5XFEW.js} +1 -1
  169. package/dist/standalone/chunk-SAV5V3DG.js +7 -0
  170. package/dist/standalone/{chunk-JYCGHNPF.js → chunk-SBY32RYL.js} +1 -1
  171. package/dist/standalone/{chunk-JMZT3CEW.js → chunk-SCTYLLJT.js} +1 -1
  172. package/dist/standalone/{chunk-BYUXIOPZ.js → chunk-SHTZR3TU.js} +1 -1
  173. package/dist/standalone/{chunk-KBYFBEG2.js → chunk-SZCXVIVT.js} +1 -1
  174. package/dist/standalone/{chunk-O3AZ7JKE.js → chunk-T7UKRA6J.js} +1 -1
  175. package/dist/standalone/{chunk-EX2DUBRT.js → chunk-TOBQK3ZF.js} +1 -1
  176. package/dist/standalone/{chunk-M4TCBPSY.js → chunk-TRJMN2YI.js} +1 -1
  177. package/dist/standalone/{chunk-ZCXG3567.js → chunk-TU2IB3GT.js} +1 -1
  178. package/dist/standalone/{chunk-EVJSGZXV.js → chunk-UA7DC3LX.js} +1 -1
  179. package/dist/standalone/{chunk-ALNEZ5D2.js → chunk-UCOKDCSX.js} +1 -1
  180. package/dist/standalone/{chunk-SWFSB4QT.js → chunk-UEM26EYR.js} +1 -1
  181. package/dist/standalone/{chunk-SZBLYYV6.js → chunk-UL5GMSAW.js} +1 -1
  182. package/dist/standalone/{chunk-EYMLYHWK.js → chunk-UVMD7C4J.js} +1 -1
  183. package/dist/standalone/{chunk-6YBEKVUG.js → chunk-V4D77Q45.js} +1 -1
  184. package/dist/standalone/{chunk-D6CDIHHL.js → chunk-VONBNFUJ.js} +1 -1
  185. package/dist/standalone/{chunk-3D2E7WXH.js → chunk-VY5KDMVO.js} +1 -1
  186. package/dist/standalone/{chunk-CHIQ3CJZ.js → chunk-W46UJQN7.js} +1 -1
  187. package/dist/standalone/{chunk-AQ62YJJ5.js → chunk-W5LH6U6X.js} +1 -1
  188. package/dist/standalone/{chunk-S36FVTKK.js → chunk-W7CLOQOU.js} +1 -1
  189. package/dist/standalone/{chunk-FWOOA2ZR.js → chunk-X26D3KTK.js} +1 -1
  190. package/dist/standalone/chunk-X2KZTOZR.js +1 -0
  191. package/dist/standalone/chunk-Y6OVSHPH.js +1 -0
  192. package/dist/standalone/{chunk-B3TXCZUI.js → chunk-YIOJWQ3G.js} +1 -1
  193. package/dist/standalone/{chunk-XLYFGUEF.js → chunk-YNCZVYCO.js} +1 -1
  194. package/dist/standalone/{chunk-OVEOTKK5.js → chunk-YU67D2FL.js} +1 -1
  195. package/dist/standalone/{chunk-AERXMIND.js → chunk-YV6YBDCS.js} +1 -1
  196. package/dist/standalone/{chunk-A2Q3TGIQ.js → chunk-YYJGL32M.js} +1 -1
  197. package/dist/standalone/{chunk-R3P6KKUH.js → chunk-YZUJTBSJ.js} +1 -1
  198. package/dist/standalone/{chunk-42RZZFLX.js → chunk-ZBP4ZBS6.js} +1 -1
  199. package/dist/standalone/{chunk-QHKR5JW4.js → chunk-ZF4WXT7S.js} +1 -1
  200. package/dist/standalone/{chunk-JAAXDIR5.js → chunk-ZK2HQFGQ.js} +1 -1
  201. package/dist/standalone/studio.js +3 -3
  202. package/dist/styles.css +1 -1
  203. package/package.json +10 -10
  204. package/dist/packem_shared/ADMIN_FUNCTIONS-C6U-ugro.mjs +0 -1
  205. package/dist/packem_shared/log-fields-BolUoZ9g.mjs +0 -1
  206. package/dist/packem_shared/log-line-BH0iWiBv.mjs +0 -1
  207. package/dist/standalone/chunk-3BQ6FMEA.js +0 -5
  208. package/dist/standalone/chunk-6A6AELDJ.js +0 -1
  209. package/dist/standalone/chunk-ASD6UAND.js +0 -1
  210. package/dist/standalone/chunk-BG2CJOVS.js +0 -1
  211. package/dist/standalone/chunk-BKI3JMXQ.js +0 -1
  212. package/dist/standalone/chunk-CZA2P2TU.js +0 -1
  213. package/dist/standalone/chunk-KGLIQIZU.js +0 -1
  214. package/dist/standalone/chunk-PFPJA2HR.js +0 -7
  215. package/dist/standalone/chunk-PUK3H4RN.js +0 -33
  216. package/dist/standalone/chunk-QAOZXPLU.js +0 -1
  217. package/dist/standalone/chunk-RTS5G3ET.js +0 -2
  218. package/dist/standalone/chunk-RWMOWRJX.js +0 -1
  219. package/dist/standalone/chunk-U4X2I55T.js +0 -1
  220. package/dist/standalone/chunk-YORPLSI5.js +0 -1
  221. package/dist/standalone/chunk-Z7ZGAQ5J.js +0 -8
  222. /package/dist/standalone/{chunk-NGVP66OH.js → chunk-QHVUXMRV.js} +0 -0
@@ -1 +1 @@
1
- import{c as O}from"react/compiler-runtime";import{LunoraAdminClient as G}from"@lunora/client/admin";import{LunoraProvider as H}from"@lunora/react";import{useState as B,useEffect as $}from"react";import{ErrorBoundary as z}from"./ErrorBoundary-BWNF98VF.mjs";import{u as U,B as V,T as Y,a as q,S as J}from"./studio-DtxNxSjs.mjs";import Q from"./useDebounced-DVeQ5-oW.mjs";import{useT as j,createStudioI18n as X}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{StudioI18nProvider as D}from"./StudioI18nProvider-CGXCPnQn.mjs";import{r as Z}from"./internal-hIuTpSbx.mjs";import{w as R}from"./recording-client-z4CBi0y8.mjs";import F from"./STUDIO_ROOT_CLASS-C6MccdVk.mjs";import{a as K}from"./browser-storage-BH1MxLZs.mjs";import{c as W}from"./utils-bhneXptQ.mjs";import{B as ee}from"./button-q0UYSmrn.mjs";import{I as te}from"./input-CXhxesPC.mjs";import{jsx as f,jsxs as C}from"react/jsx-runtime";const M="lunora-studio-admin-token",oe=()=>{try{return K("session")?.getItem(M)??""}catch{return""}},ne=m=>{const e=K("session");if(e!==void 0)try{m===""?e.removeItem(M):e.setItem(M,m)}catch{}},ie="/_lunora/admin/ws-token",se=1e4,le=m=>{const e=m;return typeof e?.token=="string"&&e.token.length>0&&typeof e.expiresAtMs=="number"},re=m=>{const{adminToken:e,baseUrl:a}=m,o=m.fetchImpl??fetch;let l=a;for(;l.endsWith("/");)l=l.slice(0,-1);const r=`${l}${ie}`;let t,n;const i=async()=>{const s=await o(r,{headers:{authorization:`Bearer ${e}`},method:"POST"});if(!s.ok)throw new Error(`ws-token mint failed: ${String(s.status)}`);const u=await s.json().catch(()=>{});if(!le(u))throw new Error("ws-token mint failed: malformed response body");return t=u,u.token};return{getToken:async()=>t!==void 0&&t.expiresAtMs-se>Date.now()?t.token:(n??=i().finally(()=>{n=void 0}),n),invalidate:()=>{t=void 0}}},ae=m=>{const e=O(42),{onSubmit:a}=m,o=j(),[l,r]=B("");let t;e[0]!==l?(t=l.trim(),e[0]=l,e[1]=t):t=e[1];const n=t;let i;e[2]!==a||e[3]!==n?(i=_=>{_.preventDefault(),n!==""&&a(n)},e[2]=a,e[3]=n,e[4]=i):i=e[4];const s=i;let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=f("div",{className:"h-10 w-10 text-foreground",children:f(V,{})}),e[5]=u):u=e[5];let d;e[6]!==o?(d=o("Connect to Lunora Studio"),e[6]=o,e[7]=d):d=e[7];let v;e[8]!==d?(v=f("h1",{className:"text-base font-semibold text-foreground",children:d}),e[8]=d,e[9]=v):v=e[9];let k;e[10]!==o?(k=o("Enter your admin token to access the studio."),e[10]=o,e[11]=k):k=e[11];let p;e[12]!==k?(p=f("p",{className:"text-[13px] text-muted-foreground",children:k}),e[12]=k,e[13]=p):p=e[13];let h;e[14]!==v||e[15]!==p?(h=C("div",{className:"flex flex-col items-center gap-3 text-center",children:[u,C("div",{className:"flex flex-col gap-1",children:[v,p]})]}),e[14]=v,e[15]=p,e[16]=h):h=e[16];let g;e[17]!==o?(g=o("admin token"),e[17]=o,e[18]=g):g=e[18];let c;e[19]!==g?(c=f("label",{className:"text-xs font-medium text-foreground",htmlFor:"lunora-studio-login-token",children:g}),e[19]=g,e[20]=c):c=e[20];let b;e[21]===Symbol.for("react.memo_cache_sentinel")?(b=_=>{r(_.target.value)},e[21]=b):b=e[21];let x;e[22]!==l?(x=f(te,{autoComplete:"off",autoFocus:!0,"data-testid":"lunora-studio-login-token",id:"lunora-studio-login-token",onChange:b,placeholder:"LUNORA_ADMIN_TOKEN",type:"password",value:l}),e[22]=l,e[23]=x):x=e[23];let T;e[24]!==o?(T=o("From your worker's LUNORA_ADMIN_TOKEN — your project's .dev.vars in dev, or a deployment secret in production."),e[24]=o,e[25]=T):T=e[25];let I;e[26]!==T?(I=f("p",{className:"text-[11px] text-muted-foreground",children:T}),e[26]=T,e[27]=I):I=e[27];let S;e[28]!==c||e[29]!==x||e[30]!==I?(S=C("div",{className:"flex flex-col gap-1.5",children:[c,x,I]}),e[28]=c,e[29]=x,e[30]=I,e[31]=S):S=e[31];const E=n==="";let y;e[32]!==o?(y=o("Connect"),e[32]=o,e[33]=y):y=e[33];let w;e[34]!==E||e[35]!==y?(w=f(ee,{"data-testid":"lunora-studio-login-submit",disabled:E,type:"submit",children:y}),e[34]=E,e[35]=y,e[36]=w):w=e[36];let N;return e[37]!==s||e[38]!==S||e[39]!==w||e[40]!==h?(N=C("form",{className:"flex w-full max-w-sm flex-col gap-5 rounded-xl border border-border bg-card p-7 shadow-lg","data-testid":"lunora-studio-login",onSubmit:s,children:[h,S,w]}),e[37]=s,e[38]=S,e[39]=w,e[40]=h,e[41]=N):N=e[41],N},de=m=>{const e=O(10),{i18n:a,onSubmit:o}=m,{resolvedTheme:l}=U(),r=l==="dark"&&"dark";let t;e[0]!==r?(t=W(F,r,"flex h-dvh items-center justify-center bg-sidebar p-6 text-sm text-foreground"),e[0]=r,e[1]=t):t=e[1];let n;e[2]!==o?(n=f(ae,{onSubmit:o}),e[2]=o,e[3]=n):n=e[3];let i;e[4]!==a||e[5]!==n?(i=f(D,{i18n:a,children:n}),e[4]=a,e[5]=n,e[6]=i):i=e[6];let s;return e[7]!==t||e[8]!==i?(s=f("div",{className:t,"data-testid":"lunora-studio-login-root",children:i}),e[7]=t,e[8]=i,e[9]=s):s=e[9],s},ce=m=>{const e=O(15),{basePath:a,chrome:o,studio:l}=m,r=j();let t;e[0]!==r?(t=r("Studio failed"),e[0]=r,e[1]=t):t=e[1];let n;e[2]!==r?(n=r("Studio"),e[2]=r,e[3]=n):n=e[3];let i;e[4]!==r?(i=r("Try again"),e[4]=r,e[5]=i):i=e[5];let s;e[6]!==a||e[7]!==o||e[8]!==l?(s=f(J,{...l,basePath:a,chrome:o}),e[6]=a,e[7]=o,e[8]=l,e[9]=s):s=e[9];let u;return e[10]!==t||e[11]!==n||e[12]!==i||e[13]!==s?(u=f(z,{fallbackTitle:t,label:n,retryLabel:i,children:s}),e[10]=t,e[11]=n,e[12]=i,e[13]=s,e[14]=u):u=e[14],u},fe=m=>{const e=O(20),{basePath:a,clearToken:o,client:l,i18n:r,onTokenChange:t,rulesInstalled:n,studio:i,token:s}=m,{resolvedTheme:u}=U();let d;e[0]!==o||e[1]!==t||e[2]!==n||e[3]!==s?(d={clearToken:o,onTokenChange:t,rulesInstalled:n,token:s},e[0]=o,e[1]=t,e[2]=n,e[3]=s,e[4]=d):d=e[4];const v=d,k=u==="dark"&&"dark";let p;e[5]!==k?(p=W(F,k,"flex h-dvh flex-col overflow-hidden bg-sidebar text-sm text-foreground"),e[5]=k,e[6]=p):p=e[6];let h;e[7]!==a||e[8]!==v||e[9]!==i?(h=f(q,{children:f(ce,{basePath:a,chrome:v,studio:i})}),e[7]=a,e[8]=v,e[9]=i,e[10]=h):h=e[10];let g;e[11]!==r||e[12]!==h?(g=f(D,{i18n:r,children:h}),e[11]=r,e[12]=h,e[13]=g):g=e[13];let c;e[14]!==l||e[15]!==g?(c=f(H,{client:l,children:g}),e[14]=l,e[15]=g,e[16]=c):c=e[16];let b;return e[17]!==p||e[18]!==c?(b=f("div",{className:p,"data-testid":"lunora-studio-app",children:c}),e[17]=p,e[18]=c,e[19]=b):b=e[19],b},Ee=m=>{const e=O(28);let a;e[0]!==m?(a=m===void 0?{}:m,e[0]=m,e[1]=a):a=e[1];const{adminToken:o,basePath:l,baseUrl:r,client:t,rulesInstalled:n,studio:i,locale:s}=a;let u;e[2]!==o?(u=()=>o??oe(),e[2]=o,e[3]=u):u=e[3];const[d,v]=B(u);let k,p;e[4]!==d?(k=()=>{ne(d)},p=[d],e[4]=d,e[5]=k,e[6]=p):(k=e[5],p=e[6]),$(k,p);const h=Q(d,300,d==="");let g;e:{if(t!==void 0){let A;e[7]!==t?(A=R(t),e[7]=t,e[8]=A):A=e[8],g=A;break e}let _;if(e[9]!==r||e[10]!==h){const A=Z(r),P=h===""?void 0:re({adminToken:h,baseUrl:A}),L=new G({url:A,...P===void 0?{}:{wsTicket:P.getToken}});P!==void 0&&(L.setAuthToken(h),L.onTokenExpired(P.invalidate)),_=R(L),e[9]=r,e[10]=h,e[11]=_}else _=e[11];g=_}const c=g;let b,x;e[12]!==c||e[13]!==t?(b=()=>()=>{t===void 0&&c.close()},x=[c,t],e[12]=c,e[13]=t,e[14]=b,e[15]=x):(b=e[14],x=e[15]),$(b,x);let T;e[16]===Symbol.for("react.memo_cache_sentinel")?(T=_=>{v(_.target.value)},e[16]=T):T=e[16];const I=T;let S;e[17]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{v("")},e[17]=S):S=e[17];const E=S;let y;e[18]!==s?(y=X(s),e[18]=s,e[19]=y):y=e[19];const w=y;let N;return e[20]!==l||e[21]!==c||e[22]!==w||e[23]!==t||e[24]!==n||e[25]!==i||e[26]!==d?(N=f(Y,{children:d===""&&t===void 0?f(de,{i18n:w,onSubmit:v}):f(fe,{basePath:l,clearToken:E,client:c,i18n:w,onTokenChange:I,rulesInstalled:n,studio:i,token:d})}),e[20]=l,e[21]=c,e[22]=w,e[23]=t,e[24]=n,e[25]=i,e[26]=d,e[27]=N):N=e[27],N};export{Ee as StudioApp};
1
+ import{c as O}from"react/compiler-runtime";import{LunoraAdminClient as G}from"@lunora/client/admin";import{LunoraProvider as H}from"@lunora/react";import{useState as B,useEffect as $}from"react";import{ErrorBoundary as z}from"./ErrorBoundary-BWNF98VF.mjs";import{u as U,B as V,T as Y,a as q,S as J}from"./studio-DZlpp4Vx.mjs";import Q from"./useDebounced-DVeQ5-oW.mjs";import{useT as j,createStudioI18n as X}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{StudioI18nProvider as D}from"./StudioI18nProvider-CGXCPnQn.mjs";import{r as Z}from"./internal-hIuTpSbx.mjs";import{w as R}from"./recording-client-z4CBi0y8.mjs";import F from"./STUDIO_ROOT_CLASS-C6MccdVk.mjs";import{a as K}from"./browser-storage-BH1MxLZs.mjs";import{c as W}from"./utils-bhneXptQ.mjs";import{B as ee}from"./button-q0UYSmrn.mjs";import{I as te}from"./input-CXhxesPC.mjs";import{jsx as f,jsxs as C}from"react/jsx-runtime";const M="lunora-studio-admin-token",oe=()=>{try{return K("session")?.getItem(M)??""}catch{return""}},ne=m=>{const e=K("session");if(e!==void 0)try{m===""?e.removeItem(M):e.setItem(M,m)}catch{}},ie="/_lunora/admin/ws-token",se=1e4,le=m=>{const e=m;return typeof e?.token=="string"&&e.token.length>0&&typeof e.expiresAtMs=="number"},re=m=>{const{adminToken:e,baseUrl:a}=m,o=m.fetchImpl??fetch;let l=a;for(;l.endsWith("/");)l=l.slice(0,-1);const r=`${l}${ie}`;let t,n;const i=async()=>{const s=await o(r,{headers:{authorization:`Bearer ${e}`},method:"POST"});if(!s.ok)throw new Error(`ws-token mint failed: ${String(s.status)}`);const u=await s.json().catch(()=>{});if(!le(u))throw new Error("ws-token mint failed: malformed response body");return t=u,u.token};return{getToken:async()=>t!==void 0&&t.expiresAtMs-se>Date.now()?t.token:(n??=i().finally(()=>{n=void 0}),n),invalidate:()=>{t=void 0}}},ae=m=>{const e=O(42),{onSubmit:a}=m,o=j(),[l,r]=B("");let t;e[0]!==l?(t=l.trim(),e[0]=l,e[1]=t):t=e[1];const n=t;let i;e[2]!==a||e[3]!==n?(i=_=>{_.preventDefault(),n!==""&&a(n)},e[2]=a,e[3]=n,e[4]=i):i=e[4];const s=i;let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=f("div",{className:"h-10 w-10 text-foreground",children:f(V,{})}),e[5]=u):u=e[5];let d;e[6]!==o?(d=o("Connect to Lunora Studio"),e[6]=o,e[7]=d):d=e[7];let v;e[8]!==d?(v=f("h1",{className:"text-base font-semibold text-foreground",children:d}),e[8]=d,e[9]=v):v=e[9];let k;e[10]!==o?(k=o("Enter your admin token to access the studio."),e[10]=o,e[11]=k):k=e[11];let p;e[12]!==k?(p=f("p",{className:"text-[13px] text-muted-foreground",children:k}),e[12]=k,e[13]=p):p=e[13];let h;e[14]!==v||e[15]!==p?(h=C("div",{className:"flex flex-col items-center gap-3 text-center",children:[u,C("div",{className:"flex flex-col gap-1",children:[v,p]})]}),e[14]=v,e[15]=p,e[16]=h):h=e[16];let g;e[17]!==o?(g=o("admin token"),e[17]=o,e[18]=g):g=e[18];let c;e[19]!==g?(c=f("label",{className:"text-xs font-medium text-foreground",htmlFor:"lunora-studio-login-token",children:g}),e[19]=g,e[20]=c):c=e[20];let b;e[21]===Symbol.for("react.memo_cache_sentinel")?(b=_=>{r(_.target.value)},e[21]=b):b=e[21];let x;e[22]!==l?(x=f(te,{autoComplete:"off",autoFocus:!0,"data-testid":"lunora-studio-login-token",id:"lunora-studio-login-token",onChange:b,placeholder:"LUNORA_ADMIN_TOKEN",type:"password",value:l}),e[22]=l,e[23]=x):x=e[23];let T;e[24]!==o?(T=o("From your worker's LUNORA_ADMIN_TOKEN — your project's .dev.vars in dev, or a deployment secret in production."),e[24]=o,e[25]=T):T=e[25];let I;e[26]!==T?(I=f("p",{className:"text-[11px] text-muted-foreground",children:T}),e[26]=T,e[27]=I):I=e[27];let S;e[28]!==c||e[29]!==x||e[30]!==I?(S=C("div",{className:"flex flex-col gap-1.5",children:[c,x,I]}),e[28]=c,e[29]=x,e[30]=I,e[31]=S):S=e[31];const E=n==="";let y;e[32]!==o?(y=o("Connect"),e[32]=o,e[33]=y):y=e[33];let w;e[34]!==E||e[35]!==y?(w=f(ee,{"data-testid":"lunora-studio-login-submit",disabled:E,type:"submit",children:y}),e[34]=E,e[35]=y,e[36]=w):w=e[36];let N;return e[37]!==s||e[38]!==S||e[39]!==w||e[40]!==h?(N=C("form",{className:"flex w-full max-w-sm flex-col gap-5 rounded-xl border border-border bg-card p-7 shadow-lg","data-testid":"lunora-studio-login",onSubmit:s,children:[h,S,w]}),e[37]=s,e[38]=S,e[39]=w,e[40]=h,e[41]=N):N=e[41],N},de=m=>{const e=O(10),{i18n:a,onSubmit:o}=m,{resolvedTheme:l}=U(),r=l==="dark"&&"dark";let t;e[0]!==r?(t=W(F,r,"flex h-dvh items-center justify-center bg-sidebar p-6 text-sm text-foreground"),e[0]=r,e[1]=t):t=e[1];let n;e[2]!==o?(n=f(ae,{onSubmit:o}),e[2]=o,e[3]=n):n=e[3];let i;e[4]!==a||e[5]!==n?(i=f(D,{i18n:a,children:n}),e[4]=a,e[5]=n,e[6]=i):i=e[6];let s;return e[7]!==t||e[8]!==i?(s=f("div",{className:t,"data-testid":"lunora-studio-login-root",children:i}),e[7]=t,e[8]=i,e[9]=s):s=e[9],s},ce=m=>{const e=O(15),{basePath:a,chrome:o,studio:l}=m,r=j();let t;e[0]!==r?(t=r("Studio failed"),e[0]=r,e[1]=t):t=e[1];let n;e[2]!==r?(n=r("Studio"),e[2]=r,e[3]=n):n=e[3];let i;e[4]!==r?(i=r("Try again"),e[4]=r,e[5]=i):i=e[5];let s;e[6]!==a||e[7]!==o||e[8]!==l?(s=f(J,{...l,basePath:a,chrome:o}),e[6]=a,e[7]=o,e[8]=l,e[9]=s):s=e[9];let u;return e[10]!==t||e[11]!==n||e[12]!==i||e[13]!==s?(u=f(z,{fallbackTitle:t,label:n,retryLabel:i,children:s}),e[10]=t,e[11]=n,e[12]=i,e[13]=s,e[14]=u):u=e[14],u},fe=m=>{const e=O(20),{basePath:a,clearToken:o,client:l,i18n:r,onTokenChange:t,rulesInstalled:n,studio:i,token:s}=m,{resolvedTheme:u}=U();let d;e[0]!==o||e[1]!==t||e[2]!==n||e[3]!==s?(d={clearToken:o,onTokenChange:t,rulesInstalled:n,token:s},e[0]=o,e[1]=t,e[2]=n,e[3]=s,e[4]=d):d=e[4];const v=d,k=u==="dark"&&"dark";let p;e[5]!==k?(p=W(F,k,"flex h-dvh flex-col overflow-hidden bg-sidebar text-sm text-foreground"),e[5]=k,e[6]=p):p=e[6];let h;e[7]!==a||e[8]!==v||e[9]!==i?(h=f(q,{children:f(ce,{basePath:a,chrome:v,studio:i})}),e[7]=a,e[8]=v,e[9]=i,e[10]=h):h=e[10];let g;e[11]!==r||e[12]!==h?(g=f(D,{i18n:r,children:h}),e[11]=r,e[12]=h,e[13]=g):g=e[13];let c;e[14]!==l||e[15]!==g?(c=f(H,{client:l,children:g}),e[14]=l,e[15]=g,e[16]=c):c=e[16];let b;return e[17]!==p||e[18]!==c?(b=f("div",{className:p,"data-testid":"lunora-studio-app",children:c}),e[17]=p,e[18]=c,e[19]=b):b=e[19],b},Ee=m=>{const e=O(28);let a;e[0]!==m?(a=m===void 0?{}:m,e[0]=m,e[1]=a):a=e[1];const{adminToken:o,basePath:l,baseUrl:r,client:t,rulesInstalled:n,studio:i,locale:s}=a;let u;e[2]!==o?(u=()=>o??oe(),e[2]=o,e[3]=u):u=e[3];const[d,v]=B(u);let k,p;e[4]!==d?(k=()=>{ne(d)},p=[d],e[4]=d,e[5]=k,e[6]=p):(k=e[5],p=e[6]),$(k,p);const h=Q(d,300,d==="");let g;e:{if(t!==void 0){let A;e[7]!==t?(A=R(t),e[7]=t,e[8]=A):A=e[8],g=A;break e}let _;if(e[9]!==r||e[10]!==h){const A=Z(r),P=h===""?void 0:re({adminToken:h,baseUrl:A}),L=new G({url:A,...P===void 0?{}:{wsTicket:P.getToken}});P!==void 0&&(L.setAuthToken(h),L.onTokenExpired(P.invalidate)),_=R(L),e[9]=r,e[10]=h,e[11]=_}else _=e[11];g=_}const c=g;let b,x;e[12]!==c||e[13]!==t?(b=()=>()=>{t===void 0&&c.close()},x=[c,t],e[12]=c,e[13]=t,e[14]=b,e[15]=x):(b=e[14],x=e[15]),$(b,x);let T;e[16]===Symbol.for("react.memo_cache_sentinel")?(T=_=>{v(_.target.value)},e[16]=T):T=e[16];const I=T;let S;e[17]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{v("")},e[17]=S):S=e[17];const E=S;let y;e[18]!==s?(y=X(s),e[18]=s,e[19]=y):y=e[19];const w=y;let N;return e[20]!==l||e[21]!==c||e[22]!==w||e[23]!==t||e[24]!==n||e[25]!==i||e[26]!==d?(N=f(Y,{children:d===""&&t===void 0?f(de,{i18n:w,onSubmit:v}):f(fe,{basePath:l,clearToken:E,client:c,i18n:w,onTokenChange:I,rulesInstalled:n,studio:i,token:d})}),e[20]=l,e[21]=c,e[22]=w,e[23]=t,e[24]=n,e[25]=i,e[26]=d,e[27]=N):N=e[27],N};export{Ee as StudioApp};
@@ -1,4 +1,4 @@
1
- import{useState as v}from"react";import{u as N}from"./assistant-provider-BQG7QZAu.mjs";import{E as T}from"./error-alert-BzZfqmf4.mjs";import{C as E,a as k}from"./card-By2O8ULa.mjs";import{T as A,a as L,b as m,c as p,d as w,e as l}from"./table-D0SBiDu-.mjs";import{useT as C}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{c as R}from"./utils-bhneXptQ.mjs";import{jsxs as a,jsx as s}from"react/jsx-runtime";const $={ERROR:"error",INFO:"info",WARN:"warning"},J=t=>{const n=typeof t.metadata.table=="string"?t.metadata.table:void 0;return{description:`${t.detail} ${t.remediation}`,entity:n,issueType:t.title,key:t.cacheKey,level:$[t.level]}},V=["error","warning","info"],I={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},O=(t,n)=>({error:t("Errors"),info:t("Info"),warning:t("Warnings")})[n],S=(t,n,i)=>({error:t("{count} errors",{count:i}),info:t("{count} suggestions",{count:i}),warning:t("{count} warnings",{count:i})})[n],D=(t,n)=>({error:t("No errors detected"),info:t("No suggestions"),warning:t("No warnings detected")})[n],H=t=>{const n={error:0,info:0,warning:0};for(const i of t??[])n[i.level]+=1;return n},K=({error:t=null,errorSource:n,rows:i,shardKey:u,testId:o,toolbar:f})=>{const r=C(),c=N(),h=c!==void 0&&!c.unavailable,[d,b]=v("error"),x=H(i),g=(i??[]).filter(e=>e.level===d),y=e=>{b(e.currentTarget.dataset.level)};return a("div",{className:"flex flex-col gap-3","data-testid":o,children:[s("div",{className:"flex border-b border-border",role:"tablist",children:V.map(e=>a("button",{"aria-selected":d===e,className:"flex min-w-32 flex-col gap-0.5 border-b-2 border-transparent px-4 py-2 text-start outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 aria-selected:border-foreground","data-level":e,"data-testid":`${o}-tab-${e}`,onClick:y,role:"tab",type:"button",children:[a("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[s("span",{"aria-hidden":"true",className:R("size-2 rounded-sm",I[e])}),O(r,e)]}),s("span",{className:"ps-4 text-xs text-muted-foreground",children:S(r,e,x[e])})]},e))}),f!==void 0&&s("div",{className:"flex flex-wrap items-center gap-2",children:f}),t!==null&&s(T,{error:n??t,shardKey:u,testId:`${o}-error`}),s(E,{className:"overflow-hidden py-0",children:s(k,{className:"px-0",children:a(A,{children:[s(L,{children:a(m,{children:[s(p,{children:r("Issue type")}),s(p,{children:r("Entity/item")}),s(p,{children:r("Description")})]})}),s(w,{children:g.length===0?s(m,{children:a(l,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${o}-empty`,children:[s("span",{className:"block text-sm font-medium text-foreground",children:D(r,d)}),s("span",{className:"block text-sm",children:r("Nothing to report for this deployment.")})]})}):g.map(e=>a(m,{children:[s(l,{className:"font-medium text-foreground",children:e.issueType}),s(l,{className:"font-mono text-xs text-muted-foreground",children:e.entity??"—"}),a(l,{className:"text-muted-foreground",children:[s("span",{children:e.description}),(e.action!==void 0||h)&&a("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[e.action,h&&s("button",{className:"text-xs underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"advisor-ask-assistant",onClick:()=>{c.openAssistant({ask:r(`The Lunora advisor reported: {finding}.
1
+ import{useState as v}from"react";import{u as N}from"./assistant-provider-Dw0roZh3.mjs";import{E as T}from"./error-alert-3AR_-s_s.mjs";import{C as E,a as k}from"./card-By2O8ULa.mjs";import{T as A,a as L,b as m,c as p,d as w,e as l}from"./table-D0SBiDu-.mjs";import{useT as C}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{c as R}from"./utils-bhneXptQ.mjs";import{jsxs as a,jsx as s}from"react/jsx-runtime";const $={ERROR:"error",INFO:"info",WARN:"warning"},J=t=>{const n=typeof t.metadata.table=="string"?t.metadata.table:void 0;return{description:`${t.detail} ${t.remediation}`,entity:n,issueType:t.title,key:t.cacheKey,level:$[t.level]}},V=["error","warning","info"],I={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},O=(t,n)=>({error:t("Errors"),info:t("Info"),warning:t("Warnings")})[n],S=(t,n,i)=>({error:t("{count} errors",{count:i}),info:t("{count} suggestions",{count:i}),warning:t("{count} warnings",{count:i})})[n],D=(t,n)=>({error:t("No errors detected"),info:t("No suggestions"),warning:t("No warnings detected")})[n],H=t=>{const n={error:0,info:0,warning:0};for(const i of t??[])n[i.level]+=1;return n},K=({error:t=null,errorSource:n,rows:i,shardKey:u,testId:o,toolbar:f})=>{const r=C(),c=N(),h=c!==void 0&&!c.unavailable,[d,b]=v("error"),x=H(i),g=(i??[]).filter(e=>e.level===d),y=e=>{b(e.currentTarget.dataset.level)};return a("div",{className:"flex flex-col gap-3","data-testid":o,children:[s("div",{className:"flex border-b border-border",role:"tablist",children:V.map(e=>a("button",{"aria-selected":d===e,className:"flex min-w-32 flex-col gap-0.5 border-b-2 border-transparent px-4 py-2 text-start outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 aria-selected:border-foreground","data-level":e,"data-testid":`${o}-tab-${e}`,onClick:y,role:"tab",type:"button",children:[a("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[s("span",{"aria-hidden":"true",className:R("size-2 rounded-sm",I[e])}),O(r,e)]}),s("span",{className:"ps-4 text-xs text-muted-foreground",children:S(r,e,x[e])})]},e))}),f!==void 0&&s("div",{className:"flex flex-wrap items-center gap-2",children:f}),t!==null&&s(T,{error:n??t,shardKey:u,testId:`${o}-error`}),s(E,{className:"overflow-hidden py-0",children:s(k,{className:"px-0",children:a(A,{children:[s(L,{children:a(m,{children:[s(p,{children:r("Issue type")}),s(p,{children:r("Entity/item")}),s(p,{children:r("Description")})]})}),s(w,{children:g.length===0?s(m,{children:a(l,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${o}-empty`,children:[s("span",{className:"block text-sm font-medium text-foreground",children:D(r,d)}),s("span",{className:"block text-sm",children:r("Nothing to report for this deployment.")})]})}):g.map(e=>a(m,{children:[s(l,{className:"font-medium text-foreground",children:e.issueType}),s(l,{className:"font-mono text-xs text-muted-foreground",children:e.entity??"—"}),a(l,{className:"text-muted-foreground",children:[s("span",{children:e.description}),(e.action!==void 0||h)&&a("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[e.action,h&&s("button",{className:"text-xs underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"advisor-ask-assistant",onClick:()=>{c.openAssistant({ask:r(`The Lunora advisor reported: {finding}.
2
2
 
3
3
  {description}
4
4
 
@@ -149,6 +149,20 @@ interface FunctionDescriptor {
149
149
  /** Outcome of a single `FunctionRunner` invocation. */
150
150
  type RunStatus = "error" | "idle" | "running" | "success";
151
151
  interface StudioProps {
152
+ /**
153
+ * The worker this Studio talks to has the companion advisor Worker deployed
154
+ * (`studio.companion` in `lunora.config.ts`). Off by default: a hosted Studio
155
+ * with no companion would otherwise request a route that is expected to 404.
156
+ * A dev host does not need it, since it serves the list from its own origin.
157
+ */
158
+ readonly advisorCompanion?: boolean;
159
+ /**
160
+ * The host serves `/__lunora/advisor-procedures`, which the Advisors Health tab
161
+ * reads as its score denominator. Off by default. Set by the dev hosts only; kept
162
+ * apart from {@link StudioProps.schemaEditable} because a host can serve the
163
+ * schema editor without this route.
164
+ */
165
+ readonly advisorProcedures?: boolean;
152
166
  /**
153
167
  * Resolve one Analytics tab panel by its key (`"volume"`, `"latency"`,
154
168
  * `"hotShards"`). Supply a runner that calls an action in your app which
@@ -149,6 +149,20 @@ interface FunctionDescriptor {
149
149
  /** Outcome of a single `FunctionRunner` invocation. */
150
150
  type RunStatus = "error" | "idle" | "running" | "success";
151
151
  interface StudioProps {
152
+ /**
153
+ * The worker this Studio talks to has the companion advisor Worker deployed
154
+ * (`studio.companion` in `lunora.config.ts`). Off by default: a hosted Studio
155
+ * with no companion would otherwise request a route that is expected to 404.
156
+ * A dev host does not need it, since it serves the list from its own origin.
157
+ */
158
+ readonly advisorCompanion?: boolean;
159
+ /**
160
+ * The host serves `/__lunora/advisor-procedures`, which the Advisors Health tab
161
+ * reads as its score denominator. Off by default. Set by the dev hosts only; kept
162
+ * apart from {@link StudioProps.schemaEditable} because a host can serve the
163
+ * schema editor without this route.
164
+ */
165
+ readonly advisorProcedures?: boolean;
152
166
  /**
153
167
  * Resolve one Analytics tab panel by its key (`"volume"`, `"latency"`,
154
168
  * `"hotShards"`). Supply a runner that calls an action in your app which
@@ -1 +1 @@
1
- import{c as R}from"react/compiler-runtime";import{use as b,createContext as u,useState as k}from"react";import{u as K}from"./use-admin-query-CaOm4JS3.mjs";import{ADMIN_FUNCTIONS as x}from"./ADMIN_FUNCTIONS-C6U-ugro.mjs";import{jsx as w}from"react/jsx-runtime";const S=u(void 0),C={},N="New chat",F=(t,s)=>({id:t,name:s?.title??N,schema:s?.schema??[],shardKey:s?.shardKey,suggestions:s?.suggestions??[],turns:[]}),T=(t,s)=>[...t.sessions,s].slice(-10),f=(t,s)=>{const n=`chat-${String(t.seq+1)}`;return{activeId:n,draft:s?.draft===void 0?void 0:{id:t.seq+1,text:s.draft},hasEditor:t.hasEditor,insertRequest:void 0,open:!0,pendingAsk:s?.ask===void 0?void 0:{id:t.seq+1,sessionId:n,text:s.ask},seq:t.seq+1,sessions:T(t,F(n,s))}},l=(t,s)=>t.find(n=>n.id===s),D=(t,s,n)=>t.map(v=>v.id===s?{...v,schema:n}:v),O=(t,s,n)=>t.map(v=>v.id===s?{...v,schema:[],shardKey:n}:v),U=(t,s)=>t.filter(n=>n.id!==s),y=(t,s,n)=>t.map(v=>v.id===s?{...v,turns:n}:v),P=t=>{const s=R(16),{children:n}=t;let v;s[0]===Symbol.for("react.memo_cache_sentinel")?(v={shardKey:""},s[0]=v):v=s[0];const E=K(x.aiAvailable,C,v);let m;s[1]===Symbol.for("react.memo_cache_sentinel")?(m={activeId:void 0,draft:void 0,hasEditor:!1,insertRequest:void 0,open:!1,pendingAsk:void 0,seq:0,sessions:[]},s[1]=m):m=s[1];const[a,h]=k(m);let c;s[2]===Symbol.for("react.memo_cache_sentinel")?(c=()=>({close:()=>{h($)},deleteChat:i=>{h(e=>{const o=U(e.sessions,i);return{...e,activeId:e.activeId===i?o.at(-1)?.id:e.activeId,open:o.length===0?!1:e.open,sessions:o}})},newChat:i=>{h(e=>f(e,i))},openAssistant:i=>{h(e=>{const o=e.activeId===void 0?void 0:l(e.sessions,e.activeId);return i?.ask!==void 0||o===void 0||(i?.shardKey??"")!==(o.shardKey??"")?f(e,i):{...e,draft:i?.draft===void 0?e.draft:{id:e.seq+1,text:i.draft},open:!0,sessions:i?.schema===void 0?e.sessions:D(e.sessions,o.id,i.schema),seq:e.seq+1}})},rebindShard:(i,e)=>{h(o=>{const d=o.activeId===void 0?void 0:l(o.sessions,o.activeId);return!o.open||d===void 0||(d.shardKey??"")!==i||i===e?o:d.turns.length===0?{...o,sessions:O(o.sessions,d.id,e)}:f(o,{shardKey:e,title:d.name})})},requestInsert:i=>{h(e=>({...e,insertRequest:{id:e.seq+1,sql:i},seq:e.seq+1}))},setHasEditor:i=>{h(e=>e.hasEditor===i?e:{...e,hasEditor:i})},takeInsert:i=>{h(e=>e.insertRequest?.id===i?{...e,insertRequest:void 0}:e)},selectChat:i=>{h(e=>({...e,activeId:i,open:!0}))},branchFrom:(i,e)=>{h(o=>{const d=l(o.sessions,i);if(d===void 0)return o;const g=f(o,{schema:d.schema,shardKey:d.shardKey,title:d.name});return{...g,sessions:y(g.sessions,g.activeId??"",d.turns.slice(0,e+1))}})},setTurns:(i,e)=>{h(o=>{const d=l(o.sessions,i);return d===void 0?o:{...o,sessions:y(o.sessions,i,typeof e=="function"?e(d.turns):e)}})},toggle:()=>{h(j)},truncateFrom:(i,e)=>{h(o=>{const d=l(o.sessions,i);return d===void 0?o:{...o,sessions:y(o.sessions,i,d.turns.slice(0,e))}})},takeAsk:i=>{h(e=>e.pendingAsk?.id===i?{...e,pendingAsk:void 0}:e)}}),s[2]=c):c=s[2];const[I]=k(c),q=E.data?.available!==!0;let p;s[3]!==I||s[4]!==a.activeId||s[5]!==a.draft||s[6]!==a.hasEditor||s[7]!==a.insertRequest||s[8]!==a.open||s[9]!==a.pendingAsk||s[10]!==a.sessions||s[11]!==q?(p={...I,activeId:a.activeId,draft:a.draft,hasEditor:a.hasEditor,insertRequest:a.insertRequest,open:a.open,pendingAsk:a.pendingAsk,sessions:a.sessions,unavailable:q},s[3]=I,s[4]=a.activeId,s[5]=a.draft,s[6]=a.hasEditor,s[7]=a.insertRequest,s[8]=a.open,s[9]=a.pendingAsk,s[10]=a.sessions,s[11]=q,s[12]=p):p=s[12];const A=p;let r;return s[13]!==n||s[14]!==A?(r=w(S,{value:A,children:n}),s[13]=n,s[14]=A,s[15]=r):r=s[15],r},Q=()=>b(S);function $(t){return{...t,open:!1}}function j(t){return!t.open&&t.activeId===void 0?f(t,void 0):{...t,open:!t.open}}export{P as A,Q as u};
1
+ import{c as R}from"react/compiler-runtime";import{use as b,createContext as u,useState as k}from"react";import{u as K}from"./use-admin-query-CaOm4JS3.mjs";import{ADMIN_FUNCTIONS as x}from"./ADMIN_FUNCTIONS-DAHZ35kM.mjs";import{jsx as w}from"react/jsx-runtime";const S=u(void 0),C={},N="New chat",F=(t,s)=>({id:t,name:s?.title??N,schema:s?.schema??[],shardKey:s?.shardKey,suggestions:s?.suggestions??[],turns:[]}),T=(t,s)=>[...t.sessions,s].slice(-10),f=(t,s)=>{const n=`chat-${String(t.seq+1)}`;return{activeId:n,draft:s?.draft===void 0?void 0:{id:t.seq+1,text:s.draft},hasEditor:t.hasEditor,insertRequest:void 0,open:!0,pendingAsk:s?.ask===void 0?void 0:{id:t.seq+1,sessionId:n,text:s.ask},seq:t.seq+1,sessions:T(t,F(n,s))}},l=(t,s)=>t.find(n=>n.id===s),D=(t,s,n)=>t.map(v=>v.id===s?{...v,schema:n}:v),O=(t,s,n)=>t.map(v=>v.id===s?{...v,schema:[],shardKey:n}:v),U=(t,s)=>t.filter(n=>n.id!==s),y=(t,s,n)=>t.map(v=>v.id===s?{...v,turns:n}:v),P=t=>{const s=R(16),{children:n}=t;let v;s[0]===Symbol.for("react.memo_cache_sentinel")?(v={shardKey:""},s[0]=v):v=s[0];const E=K(x.aiAvailable,C,v);let m;s[1]===Symbol.for("react.memo_cache_sentinel")?(m={activeId:void 0,draft:void 0,hasEditor:!1,insertRequest:void 0,open:!1,pendingAsk:void 0,seq:0,sessions:[]},s[1]=m):m=s[1];const[a,h]=k(m);let c;s[2]===Symbol.for("react.memo_cache_sentinel")?(c=()=>({close:()=>{h($)},deleteChat:i=>{h(e=>{const o=U(e.sessions,i);return{...e,activeId:e.activeId===i?o.at(-1)?.id:e.activeId,open:o.length===0?!1:e.open,sessions:o}})},newChat:i=>{h(e=>f(e,i))},openAssistant:i=>{h(e=>{const o=e.activeId===void 0?void 0:l(e.sessions,e.activeId);return i?.ask!==void 0||o===void 0||(i?.shardKey??"")!==(o.shardKey??"")?f(e,i):{...e,draft:i?.draft===void 0?e.draft:{id:e.seq+1,text:i.draft},open:!0,sessions:i?.schema===void 0?e.sessions:D(e.sessions,o.id,i.schema),seq:e.seq+1}})},rebindShard:(i,e)=>{h(o=>{const d=o.activeId===void 0?void 0:l(o.sessions,o.activeId);return!o.open||d===void 0||(d.shardKey??"")!==i||i===e?o:d.turns.length===0?{...o,sessions:O(o.sessions,d.id,e)}:f(o,{shardKey:e,title:d.name})})},requestInsert:i=>{h(e=>({...e,insertRequest:{id:e.seq+1,sql:i},seq:e.seq+1}))},setHasEditor:i=>{h(e=>e.hasEditor===i?e:{...e,hasEditor:i})},takeInsert:i=>{h(e=>e.insertRequest?.id===i?{...e,insertRequest:void 0}:e)},selectChat:i=>{h(e=>({...e,activeId:i,open:!0}))},branchFrom:(i,e)=>{h(o=>{const d=l(o.sessions,i);if(d===void 0)return o;const g=f(o,{schema:d.schema,shardKey:d.shardKey,title:d.name});return{...g,sessions:y(g.sessions,g.activeId??"",d.turns.slice(0,e+1))}})},setTurns:(i,e)=>{h(o=>{const d=l(o.sessions,i);return d===void 0?o:{...o,sessions:y(o.sessions,i,typeof e=="function"?e(d.turns):e)}})},toggle:()=>{h(j)},truncateFrom:(i,e)=>{h(o=>{const d=l(o.sessions,i);return d===void 0?o:{...o,sessions:y(o.sessions,i,d.turns.slice(0,e))}})},takeAsk:i=>{h(e=>e.pendingAsk?.id===i?{...e,pendingAsk:void 0}:e)}}),s[2]=c):c=s[2];const[I]=k(c),q=E.data?.available!==!0;let p;s[3]!==I||s[4]!==a.activeId||s[5]!==a.draft||s[6]!==a.hasEditor||s[7]!==a.insertRequest||s[8]!==a.open||s[9]!==a.pendingAsk||s[10]!==a.sessions||s[11]!==q?(p={...I,activeId:a.activeId,draft:a.draft,hasEditor:a.hasEditor,insertRequest:a.insertRequest,open:a.open,pendingAsk:a.pendingAsk,sessions:a.sessions,unavailable:q},s[3]=I,s[4]=a.activeId,s[5]=a.draft,s[6]=a.hasEditor,s[7]=a.insertRequest,s[8]=a.open,s[9]=a.pendingAsk,s[10]=a.sessions,s[11]=q,s[12]=p):p=s[12];const A=p;let r;return s[13]!==n||s[14]!==A?(r=w(S,{value:A,children:n}),s[13]=n,s[14]=A,s[15]=r):r=s[15],r},Q=()=>b(S);function $(t){return{...t,open:!1}}function j(t){return!t.open&&t.activeId===void 0?f(t,void 0):{...t,open:!t.open}}export{P as A,Q as u};
@@ -1,4 +1,4 @@
1
- import{c as U}from"react/compiler-runtime";import{flattenHint as D}from"@lunora/errors";import{useT as V}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{e as $,a as K,b as E}from"./internal-hIuTpSbx.mjs";import{o as M}from"./recording-client-z4CBi0y8.mjs";import{u as W}from"./assistant-provider-BQG7QZAu.mjs";import{u as _}from"./operation-console-provider-DoloEvon.mjs";import{A as z}from"./alert-PB5W11MM.mjs";import{jsx as x,jsxs as B}from"react/jsx-runtime";const Z=H=>{const e=U(51),{className:I,error:t,shardKey:T,testId:O}=H,s=V(),o=_(),v=W(),j=v!==void 0&&!v.unavailable;let l,a,n,c,m,u,d,r,i,f;if(e[0]!==v||e[1]!==I||e[2]!==t||e[3]!==o||e[4]!==T||e[5]!==s||e[6]!==O){const w=$(t);let y;e[17]!==t?(y=K(t),e[17]=t,e[18]=y):y=e[18],n=y;let A;e[19]!==t?(A=M(t),e[19]=t,e[20]=A):A=e[20];const q=A,N=t?.why;let C;e[21]!==o||e[22]!==q?(C=()=>{o?.openConsole({errorsOnly:!0,seq:q})},e[21]=o,e[22]=q,e[23]=C):C=e[23],c=C,a=()=>{const S=w===void 0?"":`
1
+ import{c as U}from"react/compiler-runtime";import{flattenHint as D}from"@lunora/errors";import{useT as V}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{e as $,a as K,b as E}from"./internal-hIuTpSbx.mjs";import{o as M}from"./recording-client-z4CBi0y8.mjs";import{u as W}from"./assistant-provider-Dw0roZh3.mjs";import{u as _}from"./operation-console-provider-DoloEvon.mjs";import{A as z}from"./alert-PB5W11MM.mjs";import{jsx as x,jsxs as B}from"react/jsx-runtime";const Z=H=>{const e=U(51),{className:I,error:t,shardKey:T,testId:O}=H,s=V(),o=_(),v=W(),j=v!==void 0&&!v.unavailable;let l,a,n,c,m,u,d,r,i,f;if(e[0]!==v||e[1]!==I||e[2]!==t||e[3]!==o||e[4]!==T||e[5]!==s||e[6]!==O){const w=$(t);let y;e[17]!==t?(y=K(t),e[17]=t,e[18]=y):y=e[18],n=y;let A;e[19]!==t?(A=M(t),e[19]=t,e[20]=A):A=e[20];const q=A,N=t?.why;let C;e[21]!==o||e[22]!==q?(C=()=>{o?.openConsole({errorsOnly:!0,seq:q})},e[21]=o,e[22]=q,e[23]=C):C=e[23],c=C,a=()=>{const S=w===void 0?"":`
2
2
 
3
3
  ${s("The studio suggested: {hint}",{hint:D(w)})}`;v?.openAssistant({ask:s(`The studio reported this error:
4
4
  {message}{detail}
@@ -1,3 +1,3 @@
1
- import{c as _}from"react/compiler-runtime";import{useNavigate as Xe}from"@tanstack/react-router";import{B as et}from"./badge-r_5B4LHP.mjs";import{C as P,a as tt}from"./card-By2O8ULa.mjs";import{E as nt}from"./empty-state-D7jEML_T.mjs";import{u as ve}from"./use-admin-query-CaOm4JS3.mjs";import{useT as T}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as ye}from"./ADMIN_FUNCTIONS-C6U-ugro.mjs";import{c as lt,f as Ne,d as at,w as rt,g as ot,n as it}from"./internal-hIuTpSbx.mjs";import{c as st}from"./utils-bhneXptQ.mjs";import{deriveInsights as ct}from"./DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs";import{useState as Ue,useEffect as qe}from"react";import{u as Ke}from"./use-studio-client-DCA50tF2.mjs";import{jsx as a,jsxs as h}from"react/jsx-runtime";import{B as He}from"./button-q0UYSmrn.mjs";const dt=lt(ye.studioFeatures),We={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,privacy:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},ut=t=>{if(t===null||typeof t!="object")return;const{id:e,name:n,unsupported:s}=t;if(!(typeof e!="string"||typeof n!="string"||!Array.isArray(s)))return{id:e,name:n,unsupported:s.filter(l=>typeof l=="string")}},mt=t=>{if(t===null||typeof t!="object")return We;const e=t,n=s=>typeof e[s]=="boolean"?e[s]:!0;return{analytics:n("analytics"),auth:n("auth"),containers:n("containers"),flags:n("flags"),kv:n("kv"),mail:n("mail"),notifications:n("notifications"),payments:n("payments"),privacy:n("privacy"),platform:ut(e.platform),queues:n("queues"),scheduler:n("scheduler"),storage:n("storage"),vectors:n("vectors"),workflows:n("workflows")}},ft={...We,settled:!1},pt=()=>{const t=_(3),e=Ke(),[n,s]=Ue(void 0);let l,r;return t[0]!==e?(l=()=>{const i=new AbortController;return Ne((async()=>{let o;try{o={...mt(await e.query(dt,{},at(""))),settled:!0}}catch{o={...We,settled:!0}}i.signal.aborted||s({client:e,features:o})})()),()=>{i.abort()}},r=[e],t[0]=e,t[1]=l,t[2]=r):(l=t[1],r=t[2]),qe(l,r),n?.client===e?n.features:ft},ht=()=>{const t=_(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:a("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},gt=t=>{const e=_(24),{group:n}=t,s=T(),l=Xe();let r;e[0]!==n.tab||e[1]!==l?(r=()=>{Ne(l({to:`/${n.tab}`}))},e[0]=n.tab,e[1]=l,e[2]=r):r=e[2];const i=r,o=n.bindings.length;let c;e[3]!==n.label?(c=a("span",{className:"text-sm font-medium text-foreground",children:n.label}),e[3]=n.label,e[4]=c):c=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=a(ht,{}),e[5]=u):u=e[5];let m;e[6]!==c?(m=h("div",{className:"flex items-center justify-between",children:[c,u]}),e[6]=c,e[7]=m):m=e[7];let d;e[8]!==o||e[9]!==s?(d=o===1?s("1 binding"):s("{count} bindings",{count:o}),e[8]=o,e[9]=s,e[10]=d):d=e[10];let f;e[11]!==d?(f=a("span",{className:"text-xs text-muted-foreground",children:d}),e[11]=d,e[12]=f):f=e[12];let p;e[13]!==o||e[14]!==n.bindings?(p=o>0&&a("div",{className:"flex flex-wrap gap-1.5",children:n.bindings.map(yt)}),e[13]=o,e[14]=n.bindings,e[15]=p):p=e[15];let g;e[16]!==m||e[17]!==f||e[18]!==p?(g=h(tt,{className:"flex flex-col gap-2 py-4",children:[m,f,p]}),e[16]=m,e[17]=f,e[18]=p,e[19]=g):g=e[19];let x;return e[20]!==n.testId||e[21]!==i||e[22]!==g?(x=a(P,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":n.testId,onClick:i,children:g}),e[20]=n.testId,e[21]=i,e[22]=g,e[23]=x):x=e[23],x},Ve=["kv","files","vectors"],xt=(t,e)=>[...t.filter(n=>n.tab!==e.tab),e].toSorted((n,s)=>Ve.indexOf(n.tab)-Ve.indexOf(s.tab)),bt=()=>{const t=_(19),e=Ke(),n=pt(),s=T();let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=[],t[0]=l):l=t[0];const[r,i]=Ue(l);let o,c;if(t[1]!==e||t[2]!==n.kv||t[3]!==n.storage||t[4]!==n.vectors||t[5]!==s?(o=()=>{const g={cancelled:!1},x=[{enabled:n.kv,label:s("KV Namespaces"),load:async()=>(await e.listKvNamespaces()).map(vt),tab:"kv",testId:"home-binding-kv"},{enabled:n.storage,label:s("R2 Buckets"),load:()=>e.listStorageBuckets(),tab:"files",testId:"home-binding-r2"},{enabled:n.vectors,label:s("Vectorize Indexes"),load:async()=>(await e.listVectorIndexes()).map(Nt),tab:"vectors",testId:"home-binding-vectors"}];for(const b of x)b.enabled&&Ne((async()=>{try{const v=await b.load();if(!g.cancelled){const S={bindings:v,label:b.label,tab:b.tab,testId:b.testId};i(w=>xt(w,S))}}catch{}})());return()=>{g.cancelled=!0}},c=[e,n.kv,n.storage,n.vectors,s],t[1]=e,t[2]=n.kv,t[3]=n.storage,t[4]=n.vectors,t[5]=s,t[6]=o,t[7]=c):(o=t[6],c=t[7]),qe(o,c),r.length===0)return null;let u;t[8]!==s?(u=s("Bindings"),t[8]=s,t[9]=u):u=t[9];let m;t[10]!==u?(m=a("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:u}),t[10]=u,t[11]=m):m=t[11];let d;t[12]!==r?(d=r.map(_t),t[12]=r,t[13]=d):d=t[13];let f;t[14]!==d?(f=a("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:d}),t[14]=d,t[15]=f):f=t[15];let p;return t[16]!==m||t[17]!==f?(p=h("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[m,f]}),t[16]=m,t[17]=f,t[18]=p):p=t[18],p};function yt(t){return a(et,{variant:"secondary",children:t},t)}function vt(t){return t.binding}function Nt(t){return t.name}function _t(t){return a(gt,{group:t},t.tab)}const St=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation — writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action — writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],wt=t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),kt=t=>{const e=St.map(n=>`- ${n.name} — ${n.summary}`).join(`
1
+ import{c as _}from"react/compiler-runtime";import{useNavigate as Xe}from"@tanstack/react-router";import{B as et}from"./badge-r_5B4LHP.mjs";import{C as P,a as tt}from"./card-By2O8ULa.mjs";import{E as nt}from"./empty-state-D7jEML_T.mjs";import{u as ve}from"./use-admin-query-CaOm4JS3.mjs";import{useT as T}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as ye}from"./ADMIN_FUNCTIONS-DAHZ35kM.mjs";import{c as lt,f as Ne,d as at,w as rt,g as ot,n as it}from"./internal-hIuTpSbx.mjs";import{c as st}from"./utils-bhneXptQ.mjs";import{deriveInsights as ct}from"./DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs";import{useState as Ue,useEffect as qe}from"react";import{u as Ke}from"./use-studio-client-DCA50tF2.mjs";import{jsx as a,jsxs as h}from"react/jsx-runtime";import{B as He}from"./button-q0UYSmrn.mjs";const dt=lt(ye.studioFeatures),We={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,privacy:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},ut=t=>{if(t===null||typeof t!="object")return;const{id:e,name:n,unsupported:s}=t;if(!(typeof e!="string"||typeof n!="string"||!Array.isArray(s)))return{id:e,name:n,unsupported:s.filter(l=>typeof l=="string")}},mt=t=>{if(t===null||typeof t!="object")return We;const e=t,n=s=>typeof e[s]=="boolean"?e[s]:!0;return{analytics:n("analytics"),auth:n("auth"),containers:n("containers"),flags:n("flags"),kv:n("kv"),mail:n("mail"),notifications:n("notifications"),payments:n("payments"),privacy:n("privacy"),platform:ut(e.platform),queues:n("queues"),scheduler:n("scheduler"),storage:n("storage"),vectors:n("vectors"),workflows:n("workflows")}},ft={...We,settled:!1},pt=()=>{const t=_(3),e=Ke(),[n,s]=Ue(void 0);let l,r;return t[0]!==e?(l=()=>{const i=new AbortController;return Ne((async()=>{let o;try{o={...mt(await e.query(dt,{},at(""))),settled:!0}}catch{o={...We,settled:!0}}i.signal.aborted||s({client:e,features:o})})()),()=>{i.abort()}},r=[e],t[0]=e,t[1]=l,t[2]=r):(l=t[1],r=t[2]),qe(l,r),n?.client===e?n.features:ft},ht=()=>{const t=_(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:a("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},gt=t=>{const e=_(24),{group:n}=t,s=T(),l=Xe();let r;e[0]!==n.tab||e[1]!==l?(r=()=>{Ne(l({to:`/${n.tab}`}))},e[0]=n.tab,e[1]=l,e[2]=r):r=e[2];const i=r,o=n.bindings.length;let c;e[3]!==n.label?(c=a("span",{className:"text-sm font-medium text-foreground",children:n.label}),e[3]=n.label,e[4]=c):c=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=a(ht,{}),e[5]=u):u=e[5];let m;e[6]!==c?(m=h("div",{className:"flex items-center justify-between",children:[c,u]}),e[6]=c,e[7]=m):m=e[7];let d;e[8]!==o||e[9]!==s?(d=o===1?s("1 binding"):s("{count} bindings",{count:o}),e[8]=o,e[9]=s,e[10]=d):d=e[10];let f;e[11]!==d?(f=a("span",{className:"text-xs text-muted-foreground",children:d}),e[11]=d,e[12]=f):f=e[12];let p;e[13]!==o||e[14]!==n.bindings?(p=o>0&&a("div",{className:"flex flex-wrap gap-1.5",children:n.bindings.map(yt)}),e[13]=o,e[14]=n.bindings,e[15]=p):p=e[15];let g;e[16]!==m||e[17]!==f||e[18]!==p?(g=h(tt,{className:"flex flex-col gap-2 py-4",children:[m,f,p]}),e[16]=m,e[17]=f,e[18]=p,e[19]=g):g=e[19];let x;return e[20]!==n.testId||e[21]!==i||e[22]!==g?(x=a(P,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":n.testId,onClick:i,children:g}),e[20]=n.testId,e[21]=i,e[22]=g,e[23]=x):x=e[23],x},Ve=["kv","files","vectors"],xt=(t,e)=>[...t.filter(n=>n.tab!==e.tab),e].toSorted((n,s)=>Ve.indexOf(n.tab)-Ve.indexOf(s.tab)),bt=()=>{const t=_(19),e=Ke(),n=pt(),s=T();let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=[],t[0]=l):l=t[0];const[r,i]=Ue(l);let o,c;if(t[1]!==e||t[2]!==n.kv||t[3]!==n.storage||t[4]!==n.vectors||t[5]!==s?(o=()=>{const g={cancelled:!1},x=[{enabled:n.kv,label:s("KV Namespaces"),load:async()=>(await e.listKvNamespaces()).map(vt),tab:"kv",testId:"home-binding-kv"},{enabled:n.storage,label:s("R2 Buckets"),load:()=>e.listStorageBuckets(),tab:"files",testId:"home-binding-r2"},{enabled:n.vectors,label:s("Vectorize Indexes"),load:async()=>(await e.listVectorIndexes()).map(Nt),tab:"vectors",testId:"home-binding-vectors"}];for(const b of x)b.enabled&&Ne((async()=>{try{const v=await b.load();if(!g.cancelled){const S={bindings:v,label:b.label,tab:b.tab,testId:b.testId};i(w=>xt(w,S))}}catch{}})());return()=>{g.cancelled=!0}},c=[e,n.kv,n.storage,n.vectors,s],t[1]=e,t[2]=n.kv,t[3]=n.storage,t[4]=n.vectors,t[5]=s,t[6]=o,t[7]=c):(o=t[6],c=t[7]),qe(o,c),r.length===0)return null;let u;t[8]!==s?(u=s("Bindings"),t[8]=s,t[9]=u):u=t[9];let m;t[10]!==u?(m=a("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:u}),t[10]=u,t[11]=m):m=t[11];let d;t[12]!==r?(d=r.map(_t),t[12]=r,t[13]=d):d=t[13];let f;t[14]!==d?(f=a("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:d}),t[14]=d,t[15]=f):f=t[15];let p;return t[16]!==m||t[17]!==f?(p=h("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[m,f]}),t[16]=m,t[17]=f,t[18]=p):p=t[18],p};function yt(t){return a(et,{variant:"secondary",children:t},t)}function vt(t){return t.binding}function Nt(t){return t.name}function _t(t){return a(gt,{group:t},t.tab)}const St=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation — writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action — writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],wt=t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),kt=t=>{const e=St.map(n=>`- ${n.name} — ${n.summary}`).join(`
2
2
  `);return[`You have a Lunora MCP server connected to the deployment at ${t}.`,"It exposes this backend's functions and schema so you can inspect and operate it:",e,"",`Start by calling lunora_list_functions and lunora_list_tables to learn what exists, then lunora_get_function_schema before any run call. The full HTTP API is also documented at ${t}/_lunora/admin/openapi (that endpoint needs the same admin token the MCP server is configured with).`].join(`
3
3
  `)},Ct=1500,At=()=>{const t=_(40),e=T(),{url:n}=Ke();let s;t[0]!==n?(s=rt(n),t[0]=n,t[1]=s):s=t[1];const l=s,[r,i]=Ue(null);let o,c;t[2]!==r?(o=()=>{if(r===null)return;const I=globalThis.setTimeout(()=>{i(null)},Ct);return()=>{globalThis.clearTimeout(I)}},c=[r],t[2]=r,t[3]=o,t[4]=c):(o=t[3],c=t[4]),qe(o,c);let u;t[5]===Symbol.for("react.memo_cache_sentinel")?(u=(I,L)=>{ot(L)&&i(I)},t[5]=u):u=t[5];const m=u;let d;t[6]!==l?(d=()=>{m("config",wt(l))},t[6]=l,t[7]=d):d=t[7];const f=d;let p;t[8]!==l?(p=()=>{m("prompt",kt(l))},t[8]=l,t[9]=p):p=t[9];const g=p;let x;t[10]!==e?(x=e("Connect an AI agent"),t[10]=e,t[11]=x):x=t[11];let b;t[12]!==x?(b=a("span",{className:"text-sm font-medium text-foreground",children:x}),t[12]=x,t[13]=b):b=t[13];let v;t[14]!==e?(v=e("Drive this deployment from an AI agent over the Model Context Protocol — it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[14]=e,t[15]=v):v=t[15];let S;t[16]!==v?(S=a("span",{className:"text-xs text-muted-foreground",children:v}),t[16]=v,t[17]=S):S=t[17];let w;t[18]!==b||t[19]!==S?(w=h("div",{className:"flex flex-col gap-1.5 p-4",children:[b,S]}),t[18]=b,t[19]=S,t[20]=w):w=t[20];let $;t[21]===Symbol.for("react.memo_cache_sentinel")?($=a("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[21]=$):$=t[21];let y;t[22]!==r||t[23]!==e?(y=e(r==="config"?"Copied":"Copy MCP config"),t[22]=r,t[23]=e,t[24]=y):y=t[24];let k;t[25]!==f||t[26]!==y?(k=a(He,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:y}),t[25]=f,t[26]=y,t[27]=k):k=t[27];let C;t[28]!==r||t[29]!==e?(C=e(r==="prompt"?"Copied":"Copy agent prompt"),t[28]=r,t[29]=e,t[30]=C):C=t[30];let A;t[31]!==g||t[32]!==C?(A=a(He,{"data-testid":"home-connect-agent-copy-prompt",onClick:g,size:"xs",variant:"outline",children:C}),t[31]=g,t[32]=C,t[33]=A):A=t[33];let N;t[34]!==k||t[35]!==A?(N=h("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[$,h("div",{className:"flex flex-wrap gap-2",children:[k,A]})]}),t[34]=k,t[35]=A,t[36]=N):N=t[36];let M;return t[37]!==w||t[38]!==N?(M=h(P,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[w,N]}),t[37]=w,t[38]=N,t[39]=M):M=t[39],M},Mt=112,Qe=32,Le=5,Ge=1,$t=3,It=t=>{const e=t.slice(-16),n=Math.max(0,...e),s=Qe-Le*2,l=(Mt-Le*2)/e.length;return e.map((r,i)=>{const o=n>0?Math.max(0,r)/n*s:0;return{height:Math.max(0,o-$t),width:Math.max(0,l-Ge*2),x:Le+i*l+Ge,y:Qe-Le-o}})},Tt=t=>{const e=_(4),{data:n}=t;let s;e[0]!==n?(s=It(n).map(Lt),e[0]=n,e[1]=s):s=e[1];let l;return e[2]!==s?(l=a("svg",{"aria-hidden":"true",className:"h-8 w-28 fill-foreground","data-testid":"home-sparkline",viewBox:"0 0 112 32",children:s}),e[2]=s,e[3]=l):l=e[3],l};function Lt(t){return a("rect",{height:t.height,rx:2,width:t.width,x:t.x,y:t.y},t.x)}const Ot=3,Rt=(t,e)=>{if(e==null)return t("cache not enabled");const n=e.hits+e.misses;return n===0?t("no cache traffic yet"):`${Math.round(e.hits/n*100).toString()}% ${t("cache hit")}`},Fe=t=>{if(t<1e3)return`${String(Math.round(t))}ms`;const e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},Et=(t,e)=>{const n=Math.max(0,Math.round((e-t)/1e3));if(n<60)return`${String(n)}s ago`;const s=Math.round(n/60);if(s<60)return`${String(s)}m ago`;const l=Math.round(s/60);return l<24?`${String(l)}h ago`:`${String(Math.round(l/24))}d ago`},Je=(t,e)=>{if(t===void 0||t.length===0)return[];const n=new Map;for(const s of t)n.set(s.bucketMs,(n.get(s.bucketMs)??0)+s[e]);return[...n.entries()].toSorted(([s],[l])=>s-l).map(([,s])=>s)},Ye=(t,e=!0)=>{if(t.length<4)return null;const n=Math.floor(t.length/2),s=t.slice(0,n).reduce((i,o)=>i+o,0),l=t.slice(n).reduce((i,o)=>i+o,0);if(s===0)return null;const r=(l-s)/s*100;return{positive:e?r>=0:r<=0,text:`${r>=0?"+":""}${r.toFixed(1)}%`}},Oe=t=>{const e=_(24),{delta:n,footer:s,label:l,trend:r,unit:i,value:o}=t,c=T();let u;e[0]!==l?(u=a("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[0]=l,e[1]=u):u=e[1];let m;e[2]!==o?(m=a("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:o}),e[2]=o,e[3]=m):m=e[3];let d;e[4]!==i?(d=i!==void 0&&a("span",{className:"text-xs text-muted-foreground",children:i}),e[4]=i,e[5]=d):d=e[5];let f;e[6]!==m||e[7]!==d?(f=h("span",{className:"flex items-baseline gap-1.5",children:[m,d]}),e[6]=m,e[7]=d,e[8]=f):f=e[8];let p;e[9]!==r?(p=r!==void 0&&r.length>=Ot&&a(Tt,{data:r}),e[9]=r,e[10]=p):p=e[10];let g;e[11]!==f||e[12]!==p?(g=h("div",{className:"flex items-center justify-between gap-3",children:[f,p]}),e[11]=f,e[12]=p,e[13]=g):g=e[13];let x;e[14]!==u||e[15]!==g?(x=h("div",{className:"flex flex-col gap-2.5 p-4",children:[u,g]}),e[14]=u,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==n||e[18]!==s||e[19]!==c?(b=n==null?s!=null&&a("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:s}):h("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[a("span",{className:st("font-semibold",n.positive?"text-success":"text-destructive"),children:n.text})," ",a("span",{className:"text-muted-foreground",children:c("vs. prev.")})]}),e[17]=n,e[18]=s,e[19]=c,e[20]=b):b=e[20];let v;return e[21]!==x||e[22]!==b?(v=h(P,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=v):v=e[23],v},Bt=()=>{const t=_(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:a("path",{d:"m9 6 6 6-6 6"})}),t[0]=e):e=t[0],e},je=t=>{const e=_(7),{command:n,label:s}=t;let l;e[0]!==s?(l=a("div",{className:"p-4",children:a("span",{className:"text-sm font-medium text-foreground",children:s})}),e[0]=s,e[1]=l):l=e[1];let r;e[2]!==n?(r=a("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5",children:a("code",{className:"font-mono text-xs text-muted-foreground",children:n})}),e[2]=n,e[3]=r):r=e[3];let i;return e[4]!==l||e[5]!==r?(i=h(P,{className:"justify-between gap-0 py-0",children:[l,r]}),e[4]=l,e[5]=r,e[6]=i):i=e[6],i},Ze=t=>{const e=_(18),{count:n,onView:s,testId:l,title:r}=t,i=T();let o;e[0]!==r?(o=a("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[0]=r,e[1]=o):o=e[1];let c;e[2]!==n||e[3]!==i?(c=n===null?a("span",{className:"text-xs text-muted-foreground",children:i("No data yet")}):a(et,{variant:n>0?"destructive":"success",children:n>0?n:i("All clear")}),e[2]=n,e[3]=i,e[4]=c):c=e[4];let u;e[5]!==o||e[6]!==c?(u=h("div",{className:"flex items-start justify-between gap-2 p-4",children:[o,c]}),e[5]=o,e[6]=c,e[7]=u):u=e[7];let m;e[8]!==i?(m=i("View"),e[8]=i,e[9]=m):m=e[9];let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=a(Bt,{}),e[10]=d):d=e[10];let f;e[11]!==s||e[12]!==m?(f=h("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:s,type:"button",children:[m,d]}),e[11]=s,e[12]=m,e[13]=f):f=e[13];let p;return e[14]!==u||e[15]!==f||e[16]!==l?(p=h(P,{className:"justify-between gap-0 py-0","data-testid":l,children:[u,f]}),e[14]=u,e[15]=f,e[16]=l,e[17]=p):p=e[17],p},Pt=t=>{const e=_(7),{functions:n}=t,s=T();let l;if(e[0]!==n||e[1]!==s){const r=[...n].toSorted(Ut).slice(0,5);let i;e[3]!==s?(i=s("Top functions"),e[3]=s,e[4]=i):i=e[4];let o;e[5]!==i?(o=a("div",{className:"border-b border-border px-4 py-3",children:a("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i})}),e[5]=i,e[6]=o):o=e[6],l=h(P,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[o,r.length===0?a("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:s("No functions called yet.")}):h("div",{className:"divide-y divide-border",children:[h("div",{className:"grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:[a("span",{children:s("Function")}),a("span",{className:"text-end",children:s("Calls")}),a("span",{className:"w-12 text-end",children:s("Avg")}),a("span",{className:"w-8 text-end",children:s("Err")})]}),r.map(qt)]})]}),e[0]=n,e[1]=s,e[2]=l}else l=e[2];return l},Dt=t=>{const e=_(26),{subs:n}=t,s=T();let l;e[0]!==s?(l=s("Live connections"),e[0]=s,e[1]=l):l=e[1];let r;e[2]!==l?(r=a("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[2]=l,e[3]=r):r=e[3];const i=n?.totalConnections??0;let o;e[4]!==i?(o=i.toLocaleString(),e[4]=i,e[5]=o):o=e[5];let c;e[6]!==o?(c=a("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:o}),e[6]=o,e[7]=c):c=e[7];let u;e[8]!==s?(u=s("sockets"),e[8]=s,e[9]=u):u=e[9];let m;e[10]!==u?(m=a("span",{className:"text-xs text-muted-foreground",children:u}),e[10]=u,e[11]=m):m=e[11];let d;e[12]!==c||e[13]!==m?(d=h("span",{className:"flex items-baseline gap-1.5",children:[c,m]}),e[12]=c,e[13]=m,e[14]=d):d=e[14];const f=n?.totalSubscriptions??0;let p;e[15]!==f?(p=f.toLocaleString(),e[15]=f,e[16]=p):p=e[16];let g;e[17]!==s?(g=s("active subscriptions"),e[17]=s,e[18]=g):g=e[18];let x;e[19]!==p||e[20]!==g?(x=h("span",{className:"text-[11px] text-muted-foreground",children:[p," ",g]}),e[19]=p,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==r||e[24]!==d?(b=a(P,{"data-testid":"home-live-connections",children:h(tt,{className:"flex flex-col gap-2.5 py-4",children:[r,d,x]})}),e[22]=x,e[23]=r,e[24]=d,e[25]=b):b=e[25],b},jt=t=>{const e=_(7),{entries:n}=t,s=T();let l;if(e[0]!==n||e[1]!==s){const r=Date.now();let i;e[3]!==s?(i=s("Recent activity"),e[3]=s,e[4]=i):i=e[4];let o;e[5]!==i?(o=a("div",{className:"border-b border-border px-4 py-3",children:a("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i})}),e[5]=i,e[6]=o):o=e[6],l=h(P,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[o,n.length===0?a("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:s("No recent activity.")}):a("ul",{className:"divide-y divide-border",children:n.slice(0,5).map(c=>h("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[h("span",{className:"flex min-w-0 items-center gap-2",children:[a("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),h("span",{className:"truncate text-foreground",children:[c.op,c.table!==void 0&&h("span",{className:"text-muted-foreground",children:[" · ",c.table,c.id===void 0?"":`#${c.id}`]})]})]}),a("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:Et(c.ts,r)})]},c.seq))})]}),e[0]=n,e[1]=s,e[2]=l}else l=e[2];return l},Ft=t=>{const e=t.reduce((n,s)=>n+s.calls,0);return e===0?null:t.reduce((n,s)=>n+s.totalDurationMs,0)/e},as=t=>{const e=_(149),{initialShardKey:n}=t,s=T(),l=Xe(),r=n??"";let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let o;e[1]!==r?(o={shardKey:r},e[1]=r,e[2]=o):o=e[2];const c=ve(ye.getMetrics,i,o);let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u={},e[3]=u):u=e[3];let m;e[4]!==r?(m={shardKey:r},e[4]=r,e[5]=m):m=e[5];const d=ve(ye.getFunctionStats,u,m);let f,p;e[6]===Symbol.for("react.memo_cache_sentinel")?(f={},p={shardKey:""},e[6]=f,e[7]=p):(f=e[6],p=e[7]);const g=ve(ye.getSecurityAudit,f,p);let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==r?(b={shardKey:r},e[9]=r,e[10]=b):b=e[10];const v=ve(ye.listSubscriptions,x,b);let S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S={},e[11]=S):S=e[11];let w;e[12]!==r?(w={shardKey:r},e[12]=r,e[13]=w):w=e[13];const $=ve(ye.getAuditLog,S,w),y=c.data??null;let k,C,A,N,M,I,L,O,R,D,j,F,E,B,U,q,K,W;if(e[14]!==$.data||e[15]!==g.data||e[16]!==y||e[17]!==c.data||e[18]!==l||e[19]!==d.data||e[20]!==v.data||e[21]!==s){N=Array.isArray(d.data?.functions)?d.data.functions:[],L=v.data??null;let ke;e[40]!==$.data?(ke=Array.isArray($.data?.entries)?$.data.entries:[],e[40]=$.data,e[41]=ke):ke=e[41],C=ke,M=c.data===void 0||d.data===void 0?null:ct(y,N).length,I=Array.isArray(g.data?.findings)?g.data.findings.length:null;let Ce;e[42]!==l?(Ce=()=>{Ne(l({to:"/security"}))},e[42]=l,e[43]=Ce):Ce=e[43],W=Ce;let Ae;e[44]!==l?(Ae=()=>{Ne(l({to:"/insights"}))},e[44]=l,e[45]=Ae):Ae=e[45],K=Ae;const Me=Je(y?.history,"calls"),$e=Je(y?.history,"errors"),ze=Ft(N),Ie=Math.max(0,...N.map(Kt));let Te;e[46]!==y||e[47]!==s?(Te=y===null?void 0:Rt(s,y.cache),e[46]=y,e[47]=s,e[48]=Te):Te=e[48],A=Te,U="flex flex-col gap-6",q="lunora-home",j="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",F="home-health";const Ee=Ye(Me);let he;e[49]!==s?(he=s("Requests"),e[49]=s,e[50]=he):he=e[50];const Be=y?.requests??0;let ge;e[51]!==Be?(ge=Be.toLocaleString(),e[51]=Be,e[52]=ge):ge=e[52],e[53]!==Me||e[54]!==Ee||e[55]!==he||e[56]!==ge?(E=a(Oe,{delta:Ee,label:he,trend:Me,value:ge}),e[53]=Me,e[54]=Ee,e[55]=he,e[56]=ge,e[57]=E):E=e[57];const Pe=Ye($e,!1);let xe;e[58]!==s?(xe=s("Errors"),e[58]=s,e[59]=xe):xe=e[59];const De=y?.errors??0;let be;e[60]!==De?(be=De.toLocaleString(),e[60]=De,e[61]=be):be=e[61],e[62]!==$e||e[63]!==Pe||e[64]!==xe||e[65]!==be?(B=a(Oe,{delta:Pe,label:xe,trend:$e,value:be}),e[62]=$e,e[63]=Pe,e[64]=xe,e[65]=be,e[66]=B):B=e[66],k=Oe,e[67]!==Ie||e[68]!==s?(O=Ie>0?`${s("max")} ${Fe(Ie)}`:void 0,e[67]=Ie,e[68]=s,e[69]=O):O=e[69],e[70]!==s?(R=s("Avg latency"),e[70]=s,e[71]=R):R=e[71],D=ze===null?"—":Fe(ze),e[14]=$.data,e[15]=g.data,e[16]=y,e[17]=c.data,e[18]=l,e[19]=d.data,e[20]=v.data,e[21]=s,e[22]=k,e[23]=C,e[24]=A,e[25]=N,e[26]=M,e[27]=I,e[28]=L,e[29]=O,e[30]=R,e[31]=D,e[32]=j,e[33]=F,e[34]=E,e[35]=B,e[36]=U,e[37]=q,e[38]=K,e[39]=W}else k=e[22],C=e[23],A=e[24],N=e[25],M=e[26],I=e[27],L=e[28],O=e[29],R=e[30],D=e[31],j=e[32],F=e[33],E=e[34],B=e[35],U=e[36],q=e[37],K=e[38],W=e[39];let z;e[72]!==k||e[73]!==O||e[74]!==R||e[75]!==D?(z=a(k,{footer:O,label:R,value:D}),e[72]=k,e[73]=O,e[74]=R,e[75]=D,e[76]=z):z=e[76];let H;e[77]!==s?(H=s("Database size"),e[77]=s,e[78]=H):H=e[78];const Re=y?.databaseSize??null;let V;e[79]!==Re?(V=it(Re),e[79]=Re,e[80]=V):V=e[80];let Q;e[81]!==A||e[82]!==H||e[83]!==V?(Q=a(Oe,{footer:A,label:H,value:V}),e[81]=A,e[82]=H,e[83]=V,e[84]=Q):Q=e[84];let G;e[85]!==j||e[86]!==F||e[87]!==E||e[88]!==B||e[89]!==z||e[90]!==Q?(G=h("div",{className:j,"data-testid":F,children:[E,B,z,Q]}),e[85]=j,e[86]=F,e[87]=E,e[88]=B,e[89]=z,e[90]=Q,e[91]=G):G=e[91];let _e;e[92]===Symbol.for("react.memo_cache_sentinel")?(_e=a(bt,{}),e[92]=_e):_e=e[92];let J;e[93]!==N?(J=a("div",{className:"lg:col-span-2",children:a(Pt,{functions:N})}),e[93]=N,e[94]=J):J=e[94];let Y;e[95]!==L?(Y=a(Dt,{subs:L}),e[95]=L,e[96]=Y):Y=e[96];let Z;e[97]!==C?(Z=a(jt,{entries:C}),e[97]=C,e[98]=Z):Z=e[98];let X;e[99]!==Y||e[100]!==Z?(X=h("div",{className:"flex flex-col gap-3",children:[Y,Z]}),e[99]=Y,e[100]=Z,e[101]=X):X=e[101];let ee;e[102]!==J||e[103]!==X?(ee=h("div",{className:"grid gap-3 lg:grid-cols-3",children:[J,X]}),e[102]=J,e[103]=X,e[104]=ee):ee=e[104];let te;e[105]!==s?(te=s("Advisors"),e[105]=s,e[106]=te):te=e[106];let se;e[107]!==te?(se=a("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:te}),e[107]=te,e[108]=se):se=e[108];let ne;e[109]!==M||e[110]!==I||e[111]!==s||e[112]!==K||e[113]!==W?(ne=I===0&&M===0?a(nt,{description:s("No security or performance issues detected."),icon:h("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[a("path",{d:"M12 3 4 6v5c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V6l-8-3Z"}),a("path",{d:"m9 12 2 2 4-4"})]}),testId:"home-advisors-clear",title:s("No issues found")}):h("div",{className:"grid gap-3 sm:grid-cols-2",children:[a(Ze,{count:I,onView:W,testId:"home-security",title:s("Security findings")}),a(Ze,{count:M,onView:K,testId:"home-performance",title:s("Performance issues")})]}),e[109]=M,e[110]=I,e[111]=s,e[112]=K,e[113]=W,e[114]=ne):ne=e[114];let le;e[115]!==se||e[116]!==ne?(le=h("section",{className:"flex flex-col gap-3","data-testid":"home-advisors",children:[se,ne]}),e[115]=se,e[116]=ne,e[117]=le):le=e[117];let ae;e[118]!==s?(ae=s("Get connected"),e[118]=s,e[119]=ae):ae=e[119];let re;e[120]!==ae?(re=a("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ae}),e[120]=ae,e[121]=re):re=e[121];let oe;e[122]!==s?(oe=s("Client SDK"),e[122]=s,e[123]=oe):oe=e[123];let ie;e[124]!==oe?(ie=a(je,{command:"npm i @lunora/client",label:oe}),e[124]=oe,e[125]=ie):ie=e[125];let ce;e[126]!==s?(ce=s("React"),e[126]=s,e[127]=ce):ce=e[127];let de;e[128]!==ce?(de=a(je,{command:"npm i @lunora/react",label:ce}),e[128]=ce,e[129]=de):de=e[129];let ue;e[130]!==s?(ue=s("CLI"),e[130]=s,e[131]=ue):ue=e[131];let me;e[132]!==ue?(me=a(je,{command:"lunora dev",label:ue}),e[132]=ue,e[133]=me):me=e[133];let fe;e[134]!==ie||e[135]!==de||e[136]!==me?(fe=h("div",{className:"grid gap-3 sm:grid-cols-3",children:[ie,de,me]}),e[134]=ie,e[135]=de,e[136]=me,e[137]=fe):fe=e[137];let Se;e[138]===Symbol.for("react.memo_cache_sentinel")?(Se=a(At,{}),e[138]=Se):Se=e[138];let pe;e[139]!==re||e[140]!==fe?(pe=h("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[re,fe,Se]}),e[139]=re,e[140]=fe,e[141]=pe):pe=e[141];let we;return e[142]!==U||e[143]!==q||e[144]!==G||e[145]!==ee||e[146]!==le||e[147]!==pe?(we=h("div",{className:U,"data-testid":q,children:[G,_e,ee,le,pe]}),e[142]=U,e[143]=q,e[144]=G,e[145]=ee,e[146]=le,e[147]=pe,e[148]=we):we=e[148],we};function Ut(t,e){return e.calls-t.calls}function qt(t){return h("div",{className:"grid grid-cols-[1fr_auto_auto_auto] items-center gap-4 px-4 py-2 text-[13px]",children:[a("span",{className:"truncate font-mono text-xs text-foreground",children:t.path}),a("span",{className:"text-end tabular-nums",children:t.calls.toLocaleString()}),a("span",{className:"w-12 text-end tabular-nums text-muted-foreground",children:Fe(t.calls>0?t.totalDurationMs/t.calls:0)}),a("span",{className:st("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}function Kt(t){return t.maxDurationMs}export{as as H,Rt as c,pt as u};
@@ -0,0 +1,8 @@
1
+ const R=t=>{if(typeof t=="string")return t;if(t instanceof Error)return String(t);try{return JSON.stringify(t)??String(t)}catch{return String(t)}};const a=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),$=t=>a(t)&&typeof t.name=="string"&&typeof t.message=="string"?t:void 0,d=t=>{let s=t;if(typeof t=="string"){if(!t.startsWith("{")||!t.endsWith("}"))return;try{s=JSON.parse(t)}catch{return}}const r=$(s);return r!==void 0&&(typeof r.stack=="string"||r.cause!==void 0||Array.isArray(r.errors))?r:void 0},E=t=>t.message===""?t.name:`${t.name}: ${t.message}`,A=/^[\w$.]+$/u,p=t=>{if(typeof t.stack!="string")return[];let s=t.stack;const r=t.message===""?-1:s.indexOf(t.message),n=r===-1?"":s.slice(0,r);return r>0&&n.endsWith(": ")&&!n.includes(`
2
+ `)?s=s.slice(r+t.message.length):t.message===""&&A.test(s.split(`
3
+ `,1)[0]??"")&&(s=s.slice((s.split(`
4
+ `,1)[0]??"").length)),s.split(`
5
+ `).map(e=>e.trim()).filter(e=>e!=="")},y=(t,s,r=0)=>{const n=`${s} `,e=[E(t),...p(t).map(i=>`${n}${i}`)],o=(i,c)=>{const f=$(c);return f===void 0?`${s}${i}: ${R(c)}`:`${s}${i}: ${r>=4?E(f):y(f,n,r+1).join(`
6
+ `)}`};return Array.isArray(t.errors)&&t.errors.slice(0,10).forEach((i,c)=>{e.push(o(`errors[${String(c)}]`,i))}),t.cause!==void 0&&e.push(o("caused by",t.cause)),e},m=(t,s="")=>t.map(([r,n])=>`${s}${r}: ${y(n,`${s} `).join(`
7
+ `)}`).join(`
8
+ `);const _=t=>{if(typeof t!="string")return t;if(!(!(t.startsWith("{")&&t.endsWith("}"))&&!(t.startsWith("[")&&t.endsWith("]"))))try{return JSON.parse(t)}catch{return}},g=(t,s,r,n)=>{if(n.length>=10||r>=8||typeof t!="object"||t===null)return;const e=d(t);if(e!==void 0){n.push([s,e]);return}if(Array.isArray(t)){t.forEach((o,i)=>{g(o,`${s}[${String(i)}]`,r+1,n)});return}for(const[o,i]of Object.entries(t))g(i,`${s}.${o}`,r+1,n)},h=t=>{if(!a(t))return{errors:[],text:""};const s=[],r=[];for(const[n,e]of Object.entries(t)){const o=d(e);if(o===void 0){r.push(`${n}=${R(e)}`);const i=[];g(_(e),n,0,i),s.push(...i)}else s.push([n,o]),r.push(`${n}=${E(o)}`)}return{errors:s,text:r.join(" ")}},O=t=>h(t).text;export{O as a,m as f,h as r};
@@ -0,0 +1 @@
1
+ import{c as x}from"react/compiler-runtime";import{f as v,r as w}from"./log-fields-PjFFEqv0.mjs";import{B as N}from"./badge-r_5B4LHP.mjs";import{h as b}from"./internal-hIuTpSbx.mjs";import{useState as k}from"react";import{useT as L}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{jsx as f,jsxs as h,Fragment as y}from"react/jsx-runtime";const E={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},_=u=>{const e=x(19),{errors:t}=u,a=L(),[r,m]=k(!1);let l,c;if(e[0]!==t||e[1]!==r||e[2]!==a){const g=t.map(j).join(", ");l=r,c=a(r?"Hide the stack and cause of {field}":"Show the stack and cause of {field}",{field:g}),e[0]=t,e[1]=r,e[2]=a,e[3]=l,e[4]=c}else l=e[3],c=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{m(F)},e[5]=i):i=e[5];const p=r?"▾":"▸";let s;e[6]!==a?(s=a("Error details"),e[6]=a,e[7]=s):s=e[7];let o;e[8]!==l||e[9]!==c||e[10]!==p||e[11]!==s?(o=h("button",{"aria-expanded":l,"aria-label":c,className:"shrink-0 pl-2 text-[11px] text-destructive underline-offset-2 hover:underline","data-testid":"lg-error-toggle",onClick:i,type:"button",children:[p," ",s]}),e[8]=l,e[9]=c,e[10]=p,e[11]=s,e[12]=o):o=e[12];let n;e[13]!==t||e[14]!==r?(n=r?f("pre",{className:"order-last mt-1 basis-full overflow-x-auto whitespace-pre rounded-md bg-muted/50 p-2 font-mono text-[11px] leading-snug text-muted-foreground","data-testid":"lg-error-detail",children:v(t)}):null,e[13]=t,e[14]=r,e[15]=n):n=e[15];let d;return e[16]!==o||e[17]!==n?(d=h(y,{children:[o,n]}),e[16]=o,e[17]=n,e[18]=d):d=e[18],d};function j(u){const[e]=u;return e}function F(u){return!u}const D=u=>{const e=x(24),{entry:t}=u;let a;e[0]!==t.fields?(a=w(t.fields),e[0]=t.fields,e[1]=a):a=e[1];const r=a;let m;e[2]!==t.timestamp?(m=b(t.timestamp),e[2]=t.timestamp,e[3]=m):m=e[3];let l;e[4]!==m?(l=f("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:m}),e[4]=m,e[5]=l):l=e[5];const c=E[t.level];let i;e[6]!==t.level||e[7]!==c?(i=f("span",{className:"w-20 shrink-0",role:"gridcell",children:f(N,{variant:c,children:t.level})}),e[6]=t.level,e[7]=c,e[8]=i):i=e[8];const p=t.functionPath??"—";let s;e[9]!==p?(s=f("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:p}),e[9]=p,e[10]=s):s=e[10];let o;e[11]!==r.text?(o=r.text===""?null:f("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:r.text}),e[11]=r.text,e[12]=o):o=e[12];let n;e[13]!==t.message||e[14]!==o?(n=h("span",{className:"min-w-0 flex-1 truncate",role:"gridcell",children:[t.message,o]}),e[13]=t.message,e[14]=o,e[15]=n):n=e[15];let d;e[16]!==r.errors?(d=r.errors.length===0?null:f("span",{className:"contents",role:"gridcell",children:f(_,{errors:r.errors})}),e[16]=r.errors,e[17]=d):d=e[17];let g;return e[18]!==d||e[19]!==l||e[20]!==i||e[21]!==s||e[22]!==n?(g=h("div",{className:"flex min-w-0 flex-1 flex-wrap items-center",role:"none",children:[l,i,s,n,d]}),e[18]=d,e[19]=l,e[20]=i,e[21]=s,e[22]=n,e[23]=g):g=e[23],g};export{D as L,E as a,_ as b};