@lunora/studio 1.0.0-alpha.78 → 1.0.0-alpha.79

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 (119) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/index.js +1 -1
  3. package/dist/mount.js +1 -1
  4. package/dist/packem_chunks/ApiTab.js +1 -1
  5. package/dist/packem_chunks/AuditPanel.js +1 -1
  6. package/dist/packem_chunks/ExportImportPanel.js +1 -1
  7. package/dist/packem_chunks/FileBrowser.js +1 -1
  8. package/dist/packem_chunks/FunctionRunner.js +1 -1
  9. package/dist/packem_chunks/FunctionStatsPanel.js +1 -1
  10. package/dist/packem_chunks/HealthPanel.js +1 -1
  11. package/dist/packem_chunks/InsightsPanel.js +1 -1
  12. package/dist/packem_chunks/LogsPanel.js +1 -1
  13. package/dist/packem_chunks/MailPanel.js +1 -1
  14. package/dist/packem_chunks/MetricsPanel.js +1 -1
  15. package/dist/packem_chunks/MigrationsPanel.js +1 -1
  16. package/dist/packem_chunks/NotificationsPanel.js +1 -1
  17. package/dist/packem_chunks/PitrPanel.js +1 -1
  18. package/dist/packem_chunks/SchemaViewer.js +1 -1
  19. package/dist/packem_chunks/SecurityAdvisorPanel.js +1 -1
  20. package/dist/packem_chunks/SettingsPanel.js +1 -1
  21. package/dist/packem_chunks/SqlEditorPanel.js +1 -1
  22. package/dist/packem_chunks/TableEditor.js +1 -1
  23. package/dist/packem_chunks/agents-panel.js +1 -1
  24. package/dist/packem_chunks/auth-audit-panel.js +1 -1
  25. package/dist/packem_chunks/containers-panel.js +1 -1
  26. package/dist/packem_chunks/dashboards-panel.js +1 -1
  27. package/dist/packem_chunks/fanout-panel.js +1 -1
  28. package/dist/packem_chunks/flags-panel.js +1 -1
  29. package/dist/packem_chunks/issues-panel.js +1 -1
  30. package/dist/packem_chunks/kv-browser.js +1 -1
  31. package/dist/packem_chunks/organizations-panel.js +1 -1
  32. package/dist/packem_chunks/payments-panel.js +1 -1
  33. package/dist/packem_chunks/permissions-panel.js +1 -1
  34. package/dist/packem_chunks/queues-panel.js +1 -1
  35. package/dist/packem_chunks/rls-panel.js +1 -1
  36. package/dist/packem_chunks/storage-rules-panel.js +1 -1
  37. package/dist/packem_chunks/subscriptions-panel.js +1 -1
  38. package/dist/packem_chunks/traces-panel.js +1 -1
  39. package/dist/packem_chunks/users-panel.js +1 -1
  40. package/dist/packem_chunks/workflows-panel.js +1 -1
  41. package/dist/packem_shared/ADMIN_FUNCTIONS-CpgIo9pj.js +1 -0
  42. package/dist/packem_shared/{ApiDocsPanel-eJYZlylw.js → ApiDocsPanel-CjdsxN1t.js} +1 -1
  43. package/dist/packem_shared/{DataBrowser-B8J5lHjP.js → DataBrowser-Bfstz_au.js} +1 -1
  44. package/dist/packem_shared/{HomePanel-DL1HupAN.js → HomePanel-B8EFM4u3.js} +1 -1
  45. package/dist/packem_shared/{Studio-BWBclm_C.js → Studio-BDtS9C5g.js} +1 -1
  46. package/dist/packem_shared/{StudioApp-BFm73yVr.js → StudioApp-DjLzIO9E.js} +1 -1
  47. package/dist/packem_shared/{home-panel-B-8BCffw.js → home-panel-Cm88Nvqh.js} +1 -1
  48. package/dist/packem_shared/{studio-BHA7hnI3.js → studio-BmWFd-Rz.js} +1 -1
  49. package/dist/packem_shared/use-async-submit-DLNCqLFq.js +1 -0
  50. package/dist/packem_shared/use-auth-config-9S_K_W-G.js +1 -0
  51. package/dist/standalone/{chunk-EVN46TVV.js → chunk-2SHUN7KF.js} +1 -1
  52. package/dist/standalone/{chunk-C43X4M5U.js → chunk-3EXLKL6V.js} +1 -1
  53. package/dist/standalone/{chunk-KDOC2DP5.js → chunk-3KAERFMC.js} +1 -1
  54. package/dist/standalone/{chunk-GSPTEMYN.js → chunk-4XDMVUS5.js} +1 -1
  55. package/dist/standalone/{chunk-YD5NF6UT.js → chunk-5YWJNF5X.js} +1 -1
  56. package/dist/standalone/chunk-66YJ3IOZ.js +1 -0
  57. package/dist/standalone/{chunk-2F7G7IWQ.js → chunk-6CULAILE.js} +1 -1
  58. package/dist/standalone/{chunk-D7XXWV4E.js → chunk-6KHEBRBB.js} +1 -1
  59. package/dist/standalone/{chunk-4WLYA3XE.js → chunk-6WCIFGDW.js} +1 -1
  60. package/dist/standalone/{chunk-OHKRN65U.js → chunk-7RG3AKPY.js} +1 -1
  61. package/dist/standalone/{chunk-65OTWFS3.js → chunk-A2FPLOMJ.js} +1 -1
  62. package/dist/standalone/chunk-AADILRJW.js +14 -0
  63. package/dist/standalone/chunk-AADXUXZO.js +1 -0
  64. package/dist/standalone/{chunk-L7N7F3DA.js → chunk-ARI4JTIH.js} +1 -1
  65. package/dist/standalone/chunk-AVZGVZZ7.js +1 -0
  66. package/dist/standalone/{chunk-5U2THBI7.js → chunk-BDO4J5AP.js} +1 -1
  67. package/dist/standalone/{chunk-XSD4Y6SQ.js → chunk-BMQJ4CAO.js} +1 -1
  68. package/dist/standalone/{chunk-5L2MD6F6.js → chunk-CMUP7HPS.js} +1 -1
  69. package/dist/standalone/{chunk-QGKAJTQQ.js → chunk-CP7AUUOU.js} +1 -1
  70. package/dist/standalone/{chunk-UIS34ZPB.js → chunk-DX3RMFQU.js} +1 -1
  71. package/dist/standalone/{chunk-5OWIOACV.js → chunk-E2CJUP53.js} +1 -1
  72. package/dist/standalone/{chunk-FGTK44LR.js → chunk-EIT7ERYE.js} +1 -1
  73. package/dist/standalone/{chunk-35II7U25.js → chunk-EN2QAEO4.js} +1 -1
  74. package/dist/standalone/{chunk-QVEHPYA5.js → chunk-FLYO3XY5.js} +1 -1
  75. package/dist/standalone/{chunk-DVOBKIUX.js → chunk-FWCKM2CU.js} +1 -1
  76. package/dist/standalone/{chunk-VPAXCQ2Y.js → chunk-GITJXQOS.js} +1 -1
  77. package/dist/standalone/{chunk-SA3MDZC3.js → chunk-GP6IRITM.js} +1 -1
  78. package/dist/standalone/{chunk-VGHSEUEX.js → chunk-GXU3ATKS.js} +1 -1
  79. package/dist/standalone/{chunk-FPLGBHY4.js → chunk-H5Y5NQPL.js} +1 -1
  80. package/dist/standalone/{chunk-34UVAASH.js → chunk-HALNNKTC.js} +1 -1
  81. package/dist/standalone/{chunk-UNUU7CJJ.js → chunk-HK4OVYG3.js} +1 -1
  82. package/dist/standalone/{chunk-ZNNAGR6N.js → chunk-HQEMYD2K.js} +1 -1
  83. package/dist/standalone/{chunk-F6GOKFMU.js → chunk-HYT2ZUNP.js} +2 -2
  84. package/dist/standalone/{chunk-7RXOPYR5.js → chunk-I4WGRDL2.js} +1 -1
  85. package/dist/standalone/{chunk-P24JBHEZ.js → chunk-ISZSYNTI.js} +1 -1
  86. package/dist/standalone/chunk-JWG3VRGB.js +1 -0
  87. package/dist/standalone/{chunk-RAA2RGG6.js → chunk-KDYNM3GV.js} +1 -1
  88. package/dist/standalone/{chunk-T2JIUFOD.js → chunk-KP6JQSH2.js} +1 -1
  89. package/dist/standalone/{chunk-IDNNI63H.js → chunk-LSEZN2ZL.js} +1 -1
  90. package/dist/standalone/{chunk-LJDP7NRB.js → chunk-LU3GW7HI.js} +1 -1
  91. package/dist/standalone/chunk-MVGE3JJN.js +1 -0
  92. package/dist/standalone/chunk-MXSHWB3M.js +1 -0
  93. package/dist/standalone/{chunk-BEH5N5ZA.js → chunk-NG6LYBPJ.js} +1 -1
  94. package/dist/standalone/{chunk-HP2UCWND.js → chunk-NL2DZKFI.js} +1 -1
  95. package/dist/standalone/{chunk-EXFBIISG.js → chunk-OGVCXKRL.js} +1 -1
  96. package/dist/standalone/{chunk-EKRN4ZQM.js → chunk-OPC233PZ.js} +1 -1
  97. package/dist/standalone/{chunk-TLHJRWNK.js → chunk-P4CWOYFL.js} +1 -1
  98. package/dist/standalone/{chunk-QLJJ5YYZ.js → chunk-PRJ4RJDU.js} +1 -1
  99. package/dist/standalone/{chunk-XEDU5FO4.js → chunk-PUY3YDXI.js} +1 -1
  100. package/dist/standalone/{chunk-FGTABSAK.js → chunk-QZMR6MUG.js} +1 -1
  101. package/dist/standalone/{chunk-F5QWLENA.js → chunk-W6TE2I2D.js} +1 -1
  102. package/dist/standalone/{chunk-PF7V3G2Z.js → chunk-WCWYSOCN.js} +1 -1
  103. package/dist/standalone/{chunk-BNUJ7QMG.js → chunk-WEO3YVP6.js} +1 -1
  104. package/dist/standalone/{chunk-6DWCIIHE.js → chunk-XIZNYKOD.js} +1 -1
  105. package/dist/standalone/{chunk-3FUFEZ65.js → chunk-XS6Q6GGV.js} +1 -1
  106. package/dist/standalone/{chunk-XQBTNJUQ.js → chunk-Y3CQDULJ.js} +1 -1
  107. package/dist/standalone/{chunk-7J5N6DGQ.js → chunk-YCRMVBPW.js} +1 -1
  108. package/dist/standalone/{chunk-H7NIIBHH.js → chunk-Z2JPEI2V.js} +1 -1
  109. package/dist/standalone/studio.js +1 -1
  110. package/dist/styles.css +1 -1
  111. package/package.json +6 -6
  112. package/dist/packem_shared/ADMIN_FUNCTIONS-BYNSbBVE.js +0 -1
  113. package/dist/packem_shared/use-async-submit-H68GHPz8.js +0 -1
  114. package/dist/standalone/chunk-3QRTYSSX.js +0 -1
  115. package/dist/standalone/chunk-B43FTQJ7.js +0 -1
  116. package/dist/standalone/chunk-GXZAXNZI.js +0 -1
  117. package/dist/standalone/chunk-LE56LPNH.js +0 -13
  118. package/dist/standalone/chunk-PWWHP76O.js +0 -1
  119. package/dist/standalone/chunk-YI3WYUXK.js +0 -1
@@ -1 +1 @@
1
- import{a as S}from"./chunk-UNUU7CJJ.js";import"./chunk-XXQUMVWH.js";import{b as p}from"./chunk-XSD4Y6SQ.js";import{a as C,b as K,c as j,d as m,e as n,f as o}from"./chunk-MIQTKZAR.js";import{a as A,e as k}from"./chunk-UZERI5YC.js";import{c as w}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as f}from"./chunk-GXZAXNZI.js";import"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as T}from"./chunk-XQCVZAGU.js";import{d as z,q as B}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as i,e as U,f as W,h as X}from"./chunk-3XIESWL4.js";var D=U(W(),1);var e=U(X(),1);var F="agent_threads",Y="agent_messages",Z=100,ee=250,te={},ae={filters:[],limit:Z,offset:0,orderBy:{column:"updatedAt",direction:"desc"},skipCount:!0,table:F},l=i((s,t)=>{let a=s[t];return typeof a=="string"?a:void 0},"d"),I=i((s,t)=>{let a=s[t];return typeof a=="number"?a:void 0},"b"),M=i(s=>{let{usage:t}=s;if(t===null||typeof t!="object")return;let{totalTokens:a}=t;return typeof a=="number"?a:void 0},"z"),re=i(s=>{let{toolCalls:t}=s;return Array.isArray(t)?t.map(a=>a!==null&&typeof a=="object"?a.name:void 0).filter(a=>typeof a=="string"):[]},"ee"),se=i(s=>{switch(s){case"awaiting_input":return"warning";case"cancelled":return"warning";case"error":return"destructive";case"running":return"info";default:return"outline"}},"te"),ne=i(s=>{switch(s){case"approved":return"success";case"rejected":return"destructive";default:return"warning"}},"ae"),fe=i(({initialShardKey:s=""})=>{let t=z(),[a,$]=(0,D.useState)(void 0),{data:x}=p(f.listTables,te,{live:!0,shardKey:s}),L=x!==void 0,u=Array.isArray(x)&&x.some(r=>r.name===F),{data:_,error:O,errorSource:R,liveError:G}=p(f.readTablePage,ae,{enabled:u,live:!0,shardKey:s}),H={filters:[{column:"threadKey",operator:"eq",value:a??""}],limit:ee,offset:0,orderBy:{column:"seq",direction:"asc"},skipCount:!0,table:Y},{data:q,error:J,errorSource:Q}=p(f.readTablePage,H,{enabled:u&&a!==void 0,live:!0,shardKey:s}),v=Array.isArray(_?.rows)?_.rows:[],E=Array.isArray(q?.rows)?q.rows:[],P=v.find(r=>l(r,"key")===a),h;return L&&!u?h=(0,e.jsx)(T,{description:t("No @lunora/agent tables found in this deployment. Add lunora/agents.ts with defineAgent(...) and merge the agent schema extension to run durable AI agents."),testId:"agents-unconfigured",title:t("No agents configured")}):u&&v.length===0?h=(0,e.jsx)(T,{description:t("No agent has run yet. Start a run with ctx.agents.<name>.run(...) and its thread appears here."),testId:"agents-empty",title:t("No agent threads yet")}):h=(0,e.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,e.jsx)(A,{className:"overflow-hidden py-0",children:(0,e.jsx)(k,{className:"px-0",children:(0,e.jsxs)(C,{"data-testid":"agents-threads-table",children:[(0,e.jsx)(K,{children:(0,e.jsxs)(m,{children:[(0,e.jsx)(n,{children:t("Agent")}),(0,e.jsx)(n,{children:t("Key")}),(0,e.jsx)(n,{children:t("Status")}),(0,e.jsx)(n,{children:t("Messages")}),(0,e.jsx)(n,{children:t("Tokens")}),(0,e.jsx)(n,{children:t("Updated")}),(0,e.jsx)(n,{"aria-label":t("Actions")})]})}),(0,e.jsx)(j,{children:v.map(r=>{let d=l(r,"key")??"",c=l(r,"status"),g=M(r);return(0,e.jsxs)(m,{"data-active":d===a?"":void 0,"data-testid":`agents-thread-${d}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:l(r,"agent")??"\u2014"}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:d}),(0,e.jsx)(o,{children:(0,e.jsx)(b,{"data-testid":`agents-thread-status-${d}`,variant:se(c),children:c??"\u2014"})}),(0,e.jsx)(o,{className:"tabular-nums",children:I(r,"messageCount")??"\u2014"}),(0,e.jsx)(o,{className:"tabular-nums text-muted-foreground",children:g??"\u2014"}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:B(I(r,"updatedAt"),"\u2014")}),(0,e.jsx)(o,{className:"text-right",children:(0,e.jsx)(w,{"data-testid":`agents-thread-open-${d}`,onClick:i(()=>{$(d)},"onClick"),size:"sm",type:"button",variant:"outline",children:t("Timeline")})})]},d)})})]})})}),J!==null&&(0,e.jsx)(S,{error:Q,testId:"agents-messages-error"}),a!==void 0&&(0,e.jsx)(A,{className:"overflow-hidden py-0","data-testid":"agents-thread-detail",children:(0,e.jsxs)(k,{className:"flex flex-col gap-3 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t("Timeline")," \xB7 ",a,P!==void 0&&(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",t("Usage"),": ",M(P)??0," ",t("Tokens")]})]}),(0,e.jsx)(w,{"data-testid":"agents-thread-detail-close",onClick:i(()=>{$(void 0)},"onClick"),size:"xs",type:"button",variant:"ghost",children:t("Close")})]}),E.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:t("This thread has no messages yet.")}):(0,e.jsxs)(C,{"data-testid":"agents-messages-table",children:[(0,e.jsx)(K,{children:(0,e.jsxs)(m,{children:[(0,e.jsx)(n,{children:t("Role")}),(0,e.jsx)(n,{children:t("Content")}),(0,e.jsx)(n,{children:t("Tool")}),(0,e.jsx)(n,{children:t("Approval")})]})}),(0,e.jsx)(j,{children:E.map((r,d)=>{let c=l(r,"role")??"\u2014",g=re(r),V=l(r,"toolName"),y=l(r,"status"),N=I(r,"seq")??d;return(0,e.jsxs)(m,{"data-testid":`agents-message-${String(N)}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs align-top text-muted-foreground",children:c}),(0,e.jsx)(o,{className:"max-w-md font-mono text-xs whitespace-pre-wrap break-words",children:l(r,"content")??"\u2014"}),(0,e.jsx)(o,{className:"font-mono text-xs align-top text-muted-foreground",children:V??(g.length>0?g.join(", "):"\u2014")}),(0,e.jsx)(o,{className:"align-top",children:y===void 0?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"}):(0,e.jsx)(b,{"data-testid":`agents-message-approval-${String(N)}`,variant:ne(y),children:y})})]},l(r,"messageKey")??`${c}:${String(N)}`)})})]})]})})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-agents-panel",children:[O!==null&&(0,e.jsx)(S,{error:R,testId:"agents-error"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:t("Agents run as durable workflows. Each run persists a thread of assistant and tool messages; select a thread to inspect its timeline, tool calls, approvals, and token usage.")}),G!==void 0&&(0,e.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"agents-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")}),h]})},"pe");export{fe as AgentsPanel};
1
+ import{a as S}from"./chunk-HK4OVYG3.js";import"./chunk-XXQUMVWH.js";import{b as p}from"./chunk-BMQJ4CAO.js";import{a as C,b as K,c as j,d as m,e as n,f as o}from"./chunk-MIQTKZAR.js";import{a as A,e as k}from"./chunk-UZERI5YC.js";import{c as w}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as f}from"./chunk-AADXUXZO.js";import"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{a as T}from"./chunk-XQCVZAGU.js";import{d as z,q as B}from"./chunk-4CGALXS3.js";import"./chunk-AADILRJW.js";import{a as i,e as U,f as W,h as X}from"./chunk-3XIESWL4.js";var D=U(W(),1);var e=U(X(),1);var F="agent_threads",Y="agent_messages",Z=100,ee=250,te={},ae={filters:[],limit:Z,offset:0,orderBy:{column:"updatedAt",direction:"desc"},skipCount:!0,table:F},l=i((s,t)=>{let a=s[t];return typeof a=="string"?a:void 0},"d"),I=i((s,t)=>{let a=s[t];return typeof a=="number"?a:void 0},"b"),M=i(s=>{let{usage:t}=s;if(t===null||typeof t!="object")return;let{totalTokens:a}=t;return typeof a=="number"?a:void 0},"z"),re=i(s=>{let{toolCalls:t}=s;return Array.isArray(t)?t.map(a=>a!==null&&typeof a=="object"?a.name:void 0).filter(a=>typeof a=="string"):[]},"ee"),se=i(s=>{switch(s){case"awaiting_input":return"warning";case"cancelled":return"warning";case"error":return"destructive";case"running":return"info";default:return"outline"}},"te"),ne=i(s=>{switch(s){case"approved":return"success";case"rejected":return"destructive";default:return"warning"}},"ae"),fe=i(({initialShardKey:s=""})=>{let t=z(),[a,$]=(0,D.useState)(void 0),{data:x}=p(f.listTables,te,{live:!0,shardKey:s}),L=x!==void 0,u=Array.isArray(x)&&x.some(r=>r.name===F),{data:_,error:O,errorSource:R,liveError:G}=p(f.readTablePage,ae,{enabled:u,live:!0,shardKey:s}),H={filters:[{column:"threadKey",operator:"eq",value:a??""}],limit:ee,offset:0,orderBy:{column:"seq",direction:"asc"},skipCount:!0,table:Y},{data:q,error:J,errorSource:Q}=p(f.readTablePage,H,{enabled:u&&a!==void 0,live:!0,shardKey:s}),v=Array.isArray(_?.rows)?_.rows:[],E=Array.isArray(q?.rows)?q.rows:[],P=v.find(r=>l(r,"key")===a),h;return L&&!u?h=(0,e.jsx)(T,{description:t("No @lunora/agent tables found in this deployment. Add lunora/agents.ts with defineAgent(...) and merge the agent schema extension to run durable AI agents."),testId:"agents-unconfigured",title:t("No agents configured")}):u&&v.length===0?h=(0,e.jsx)(T,{description:t("No agent has run yet. Start a run with ctx.agents.<name>.run(...) and its thread appears here."),testId:"agents-empty",title:t("No agent threads yet")}):h=(0,e.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,e.jsx)(A,{className:"overflow-hidden py-0",children:(0,e.jsx)(k,{className:"px-0",children:(0,e.jsxs)(C,{"data-testid":"agents-threads-table",children:[(0,e.jsx)(K,{children:(0,e.jsxs)(m,{children:[(0,e.jsx)(n,{children:t("Agent")}),(0,e.jsx)(n,{children:t("Key")}),(0,e.jsx)(n,{children:t("Status")}),(0,e.jsx)(n,{children:t("Messages")}),(0,e.jsx)(n,{children:t("Tokens")}),(0,e.jsx)(n,{children:t("Updated")}),(0,e.jsx)(n,{"aria-label":t("Actions")})]})}),(0,e.jsx)(j,{children:v.map(r=>{let d=l(r,"key")??"",c=l(r,"status"),g=M(r);return(0,e.jsxs)(m,{"data-active":d===a?"":void 0,"data-testid":`agents-thread-${d}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:l(r,"agent")??"\u2014"}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:d}),(0,e.jsx)(o,{children:(0,e.jsx)(b,{"data-testid":`agents-thread-status-${d}`,variant:se(c),children:c??"\u2014"})}),(0,e.jsx)(o,{className:"tabular-nums",children:I(r,"messageCount")??"\u2014"}),(0,e.jsx)(o,{className:"tabular-nums text-muted-foreground",children:g??"\u2014"}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:B(I(r,"updatedAt"),"\u2014")}),(0,e.jsx)(o,{className:"text-right",children:(0,e.jsx)(w,{"data-testid":`agents-thread-open-${d}`,onClick:i(()=>{$(d)},"onClick"),size:"sm",type:"button",variant:"outline",children:t("Timeline")})})]},d)})})]})})}),J!==null&&(0,e.jsx)(S,{error:Q,testId:"agents-messages-error"}),a!==void 0&&(0,e.jsx)(A,{className:"overflow-hidden py-0","data-testid":"agents-thread-detail",children:(0,e.jsxs)(k,{className:"flex flex-col gap-3 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t("Timeline")," \xB7 ",a,P!==void 0&&(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",t("Usage"),": ",M(P)??0," ",t("Tokens")]})]}),(0,e.jsx)(w,{"data-testid":"agents-thread-detail-close",onClick:i(()=>{$(void 0)},"onClick"),size:"xs",type:"button",variant:"ghost",children:t("Close")})]}),E.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:t("This thread has no messages yet.")}):(0,e.jsxs)(C,{"data-testid":"agents-messages-table",children:[(0,e.jsx)(K,{children:(0,e.jsxs)(m,{children:[(0,e.jsx)(n,{children:t("Role")}),(0,e.jsx)(n,{children:t("Content")}),(0,e.jsx)(n,{children:t("Tool")}),(0,e.jsx)(n,{children:t("Approval")})]})}),(0,e.jsx)(j,{children:E.map((r,d)=>{let c=l(r,"role")??"\u2014",g=re(r),V=l(r,"toolName"),y=l(r,"status"),N=I(r,"seq")??d;return(0,e.jsxs)(m,{"data-testid":`agents-message-${String(N)}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs align-top text-muted-foreground",children:c}),(0,e.jsx)(o,{className:"max-w-md font-mono text-xs whitespace-pre-wrap break-words",children:l(r,"content")??"\u2014"}),(0,e.jsx)(o,{className:"font-mono text-xs align-top text-muted-foreground",children:V??(g.length>0?g.join(", "):"\u2014")}),(0,e.jsx)(o,{className:"align-top",children:y===void 0?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"}):(0,e.jsx)(b,{"data-testid":`agents-message-approval-${String(N)}`,variant:ne(y),children:y})})]},l(r,"messageKey")??`${c}:${String(N)}`)})})]})]})})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-agents-panel",children:[O!==null&&(0,e.jsx)(S,{error:R,testId:"agents-error"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:t("Agents run as durable workflows. Each run persists a thread of assistant and tool messages; select a thread to inspect its timeline, tool calls, approvals, and token usage.")}),G!==void 0&&(0,e.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"agents-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")}),h]})},"pe");export{fe as AgentsPanel};
@@ -1 +1 @@
1
- import{a as z}from"./chunk-54MMVNPT.js";import{a as B}from"./chunk-LFKCLLPT.js";import{a as H}from"./chunk-UNUU7CJJ.js";import"./chunk-XXQUMVWH.js";import{b as E}from"./chunk-XSD4Y6SQ.js";import{a as O,b as U,c as q,d as j,e as T,f as D}from"./chunk-MIQTKZAR.js";import{a as K}from"./chunk-UZERI5YC.js";import{a as W}from"./chunk-LFXFP4IF.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import"./chunk-2OUPA2WJ.js";import{b as M}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as L}from"./chunk-GXZAXNZI.js";import"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as A}from"./chunk-XQCVZAGU.js";import{d as _}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as S,e as F,f as X,g as Y,h as Q}from"./chunk-3XIESWL4.js";var P=F(Y(),1),V=F(X(),1);var t=F(Q(),1);var G=S(n=>`${n.toString()} ms`,"E"),Z=S(n=>n.totalConnections===0&&n.shapePoke.passes===0&&n.whisper.passes===0,"G"),w=S(n=>{let e=(0,P.c)(8),{label:r,testId:a,value:l}=n,o;e[0]!==r?(o=(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[0]=r,e[1]=o):o=e[1];let i;e[2]!==a||e[3]!==l?(i=(0,t.jsx)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":a,children:l}),e[2]=a,e[3]=l,e[4]=i):i=e[4];let h;return e[5]!==o||e[6]!==i?(h=(0,t.jsx)(K,{className:"gap-0 py-0",children:(0,t.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[o,i]})}),e[5]=o,e[6]=i,e[7]=h):h=e[7],h},"R"),J=S(n=>{let e=(0,P.c)(48),{counters:r,includeTiming:a,prefix:l,t:o,title:i}=n,h=`${l}-section`,x;e[0]!==i?(x=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:i}),e[0]=i,e[1]=x):x=e[1];let b=`${l}-stats`,s;e[2]!==o?(s=o("Passes"),e[2]=o,e[3]=s):s=e[3];let c=`${l}-passes`,k;e[4]!==r.passes||e[5]!==s||e[6]!==c?(k=(0,t.jsx)(w,{label:s,testId:c,value:r.passes}),e[4]=r.passes,e[5]=s,e[6]=c,e[7]=k):k=e[7];let N;e[8]!==o?(N=o("Sockets iterated"),e[8]=o,e[9]=N):N=e[9];let I=`${l}-iterated`,d;e[10]!==r.socketsIterated||e[11]!==N||e[12]!==I?(d=(0,t.jsx)(w,{label:N,testId:I,value:r.socketsIterated}),e[10]=r.socketsIterated,e[11]=N,e[12]=I,e[13]=d):d=e[13];let m;e[14]!==o?(m=o("Delivered"),e[14]=o,e[15]=m):m=e[15];let v=`${l}-delivered`,u;e[16]!==r.socketsDelivered||e[17]!==m||e[18]!==v?(u=(0,t.jsx)(w,{label:m,testId:v,value:r.socketsDelivered}),e[16]=r.socketsDelivered,e[17]=m,e[18]=v,e[19]=u):u=e[19];let p;e[20]!==o?(p=o("Peak width"),e[20]=o,e[21]=p):p=e[21];let y=`${l}-peak`,f;e[22]!==r.peakSocketsIterated||e[23]!==p||e[24]!==y?(f=(0,t.jsx)(w,{label:p,testId:y,value:r.peakSocketsIterated}),e[22]=r.peakSocketsIterated,e[23]=p,e[24]=y,e[25]=f):f=e[25];let g;e[26]!==r.totalMs||e[27]!==a||e[28]!==l||e[29]!==o?(g=a&&(0,t.jsx)(w,{label:o("Total time"),testId:`${l}-total-ms`,value:G(r.totalMs)}),e[26]=r.totalMs,e[27]=a,e[28]=l,e[29]=o,e[30]=g):g=e[30];let C;e[31]!==r.maxMs||e[32]!==a||e[33]!==l||e[34]!==o?(C=a&&(0,t.jsx)(w,{label:o("Max time"),testId:`${l}-max-ms`,value:G(r.maxMs)}),e[31]=r.maxMs,e[32]=a,e[33]=l,e[34]=o,e[35]=C):C=e[35];let $;e[36]!==u||e[37]!==f||e[38]!==g||e[39]!==C||e[40]!==b||e[41]!==k||e[42]!==d?($=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":b,children:[k,d,u,f,g,C]}),e[36]=u,e[37]=f,e[38]=g,e[39]=C,e[40]=b,e[41]=k,e[42]=d,e[43]=$):$=e[43];let R;return e[44]!==h||e[45]!==$||e[46]!==x?(R=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":h,children:[x,$]}),e[44]=h,e[45]=$,e[46]=x,e[47]=R):R=e[47],R},"F"),ue=S(n=>{let e=(0,P.c)(32),{initialShardKey:r}=n,a=_(),[l,o]=(0,V.useState)(r??""),i;e[0]!==l?(i=l.trim(),e[0]=l,e[1]=i):i=e[1];let h=B(i,400),x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x={},e[2]=x):x=e[2];let b;e[3]!==h?(b={keepPreviousData:!0,shardKey:h},e[3]=h,e[4]=b):b=e[4];let{data:s,error:c,errorSource:k,refetch:N}=E(L.getFanoutMetrics,x,b);z(N,!0);let I;e[5]!==s?(I=s!==void 0&&Z(s),e[5]=s,e[6]=I):I=e[6];let d=I,m;e[7]!==l?(m=(0,t.jsx)(W,{onChange:o,testId:"fanout-shard-input",value:l}),e[7]=l,e[8]=m):m=e[8];let v;e[9]!==s||e[10]!==a?(v=s!==void 0&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[s.promoted&&(0,t.jsx)(M,{"data-testid":"fanout-promoted",variant:s.relayCount>=s.maxRelays?"destructive":"default",children:s.relayCount>=s.maxRelays?a("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:s.maxRelays,relayCount:s.relayCount}):a("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:s.maxRelays,relayCount:s.relayCount})}),(0,t.jsx)(M,{variant:"secondary",children:a("{count} connections",{count:s.totalConnections})}),(0,t.jsx)(M,{variant:"secondary",children:a("peak {count} subscribers",{count:s.peakSubscribers})})]}),e[9]=s,e[10]=a,e[11]=v):v=e[11];let u;e[12]!==m||e[13]!==v?(u=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[m,v]}),e[12]=m,e[13]=v,e[14]=u):u=e[14];let p;e[15]!==c||e[16]!==k?(p=c!==null&&(0,t.jsx)(H,{error:k,testId:"fanout-error"}),e[15]=c,e[16]=k,e[17]=p):p=e[17];let y;e[18]!==c||e[19]!==d||e[20]!==a?(y=c===null&&d&&(0,t.jsx)(A,{description:a("Realtime fan-out cost and per-topic subscriber counts for this shard."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 12h4l3 7 4-14 3 7h2"})}),testId:"fanout-empty",title:a("No fan-out activity yet.")}),e[18]=c,e[19]=d,e[20]=a,e[21]=y):y=e[21];let f;e[22]!==c||e[23]!==d||e[24]!==s||e[25]!==a?(f=c===null&&s!==void 0&&!d&&(0,t.jsxs)(t.Fragment,{children:[s.topics.length>0&&(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:a("Hot topics")}),(0,t.jsx)(K,{className:"overflow-hidden py-0",children:(0,t.jsxs)(O,{"data-testid":"fanout-topics-table",children:[(0,t.jsx)(U,{children:(0,t.jsxs)(j,{children:[(0,t.jsx)(T,{children:a("Topic")}),(0,t.jsx)(T,{children:a("Kind")}),(0,t.jsx)(T,{className:"text-right",children:a("Subscribers")})]})}),(0,t.jsx)(q,{children:s.topics.map(ee)})]})})]}),(0,t.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[(0,t.jsx)("h2",{className:"text-sm font-medium text-muted-foreground",children:a("Fan-out cost since this instance woke")}),(0,t.jsx)(J,{counters:s.shapePoke,includeTiming:!0,prefix:"fanout-poke",t:a,title:a("Shape pokes")}),(0,t.jsx)(J,{counters:s.whisper,includeTiming:!1,prefix:"fanout-whisper",t:a,title:a("Whisper broadcasts")})]})]}),e[22]=c,e[23]=d,e[24]=s,e[25]=a,e[26]=f):f=e[26];let g;return e[27]!==f||e[28]!==u||e[29]!==p||e[30]!==y?(g=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[u,p,y,f]}),e[27]=f,e[28]=u,e[29]=p,e[30]=y,e[31]=g):g=e[31],g},"ue");function ee(n){return(0,t.jsxs)(j,{"data-testid":"fanout-topic-row",children:[(0,t.jsx)(D,{className:"font-mono text-xs",children:n.topic}),(0,t.jsx)(D,{children:(0,t.jsx)(M,{variant:"outline",children:n.kind})}),(0,t.jsx)(D,{className:"text-right font-medium tabular-nums",children:n.subscribers})]},`${n.kind}:${n.topic}`)}S(ee,"J");export{ue as default};
1
+ import{a as z}from"./chunk-54MMVNPT.js";import{a as B}from"./chunk-LFKCLLPT.js";import{a as H}from"./chunk-HK4OVYG3.js";import"./chunk-XXQUMVWH.js";import{b as E}from"./chunk-BMQJ4CAO.js";import{a as O,b as U,c as q,d as j,e as T,f as D}from"./chunk-MIQTKZAR.js";import{a as K}from"./chunk-UZERI5YC.js";import{a as W}from"./chunk-LFXFP4IF.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import"./chunk-2OUPA2WJ.js";import{b as M}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as L}from"./chunk-AADXUXZO.js";import"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{a as A}from"./chunk-XQCVZAGU.js";import{d as _}from"./chunk-4CGALXS3.js";import"./chunk-AADILRJW.js";import{a as S,e as F,f as X,g as Y,h as Q}from"./chunk-3XIESWL4.js";var P=F(Y(),1),V=F(X(),1);var t=F(Q(),1);var G=S(n=>`${n.toString()} ms`,"E"),Z=S(n=>n.totalConnections===0&&n.shapePoke.passes===0&&n.whisper.passes===0,"G"),w=S(n=>{let e=(0,P.c)(8),{label:r,testId:a,value:l}=n,o;e[0]!==r?(o=(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[0]=r,e[1]=o):o=e[1];let i;e[2]!==a||e[3]!==l?(i=(0,t.jsx)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":a,children:l}),e[2]=a,e[3]=l,e[4]=i):i=e[4];let h;return e[5]!==o||e[6]!==i?(h=(0,t.jsx)(K,{className:"gap-0 py-0",children:(0,t.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[o,i]})}),e[5]=o,e[6]=i,e[7]=h):h=e[7],h},"R"),J=S(n=>{let e=(0,P.c)(48),{counters:r,includeTiming:a,prefix:l,t:o,title:i}=n,h=`${l}-section`,x;e[0]!==i?(x=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:i}),e[0]=i,e[1]=x):x=e[1];let b=`${l}-stats`,s;e[2]!==o?(s=o("Passes"),e[2]=o,e[3]=s):s=e[3];let c=`${l}-passes`,k;e[4]!==r.passes||e[5]!==s||e[6]!==c?(k=(0,t.jsx)(w,{label:s,testId:c,value:r.passes}),e[4]=r.passes,e[5]=s,e[6]=c,e[7]=k):k=e[7];let N;e[8]!==o?(N=o("Sockets iterated"),e[8]=o,e[9]=N):N=e[9];let I=`${l}-iterated`,d;e[10]!==r.socketsIterated||e[11]!==N||e[12]!==I?(d=(0,t.jsx)(w,{label:N,testId:I,value:r.socketsIterated}),e[10]=r.socketsIterated,e[11]=N,e[12]=I,e[13]=d):d=e[13];let m;e[14]!==o?(m=o("Delivered"),e[14]=o,e[15]=m):m=e[15];let v=`${l}-delivered`,u;e[16]!==r.socketsDelivered||e[17]!==m||e[18]!==v?(u=(0,t.jsx)(w,{label:m,testId:v,value:r.socketsDelivered}),e[16]=r.socketsDelivered,e[17]=m,e[18]=v,e[19]=u):u=e[19];let p;e[20]!==o?(p=o("Peak width"),e[20]=o,e[21]=p):p=e[21];let y=`${l}-peak`,f;e[22]!==r.peakSocketsIterated||e[23]!==p||e[24]!==y?(f=(0,t.jsx)(w,{label:p,testId:y,value:r.peakSocketsIterated}),e[22]=r.peakSocketsIterated,e[23]=p,e[24]=y,e[25]=f):f=e[25];let g;e[26]!==r.totalMs||e[27]!==a||e[28]!==l||e[29]!==o?(g=a&&(0,t.jsx)(w,{label:o("Total time"),testId:`${l}-total-ms`,value:G(r.totalMs)}),e[26]=r.totalMs,e[27]=a,e[28]=l,e[29]=o,e[30]=g):g=e[30];let C;e[31]!==r.maxMs||e[32]!==a||e[33]!==l||e[34]!==o?(C=a&&(0,t.jsx)(w,{label:o("Max time"),testId:`${l}-max-ms`,value:G(r.maxMs)}),e[31]=r.maxMs,e[32]=a,e[33]=l,e[34]=o,e[35]=C):C=e[35];let $;e[36]!==u||e[37]!==f||e[38]!==g||e[39]!==C||e[40]!==b||e[41]!==k||e[42]!==d?($=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":b,children:[k,d,u,f,g,C]}),e[36]=u,e[37]=f,e[38]=g,e[39]=C,e[40]=b,e[41]=k,e[42]=d,e[43]=$):$=e[43];let R;return e[44]!==h||e[45]!==$||e[46]!==x?(R=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":h,children:[x,$]}),e[44]=h,e[45]=$,e[46]=x,e[47]=R):R=e[47],R},"F"),ue=S(n=>{let e=(0,P.c)(32),{initialShardKey:r}=n,a=_(),[l,o]=(0,V.useState)(r??""),i;e[0]!==l?(i=l.trim(),e[0]=l,e[1]=i):i=e[1];let h=B(i,400),x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x={},e[2]=x):x=e[2];let b;e[3]!==h?(b={keepPreviousData:!0,shardKey:h},e[3]=h,e[4]=b):b=e[4];let{data:s,error:c,errorSource:k,refetch:N}=E(L.getFanoutMetrics,x,b);z(N,!0);let I;e[5]!==s?(I=s!==void 0&&Z(s),e[5]=s,e[6]=I):I=e[6];let d=I,m;e[7]!==l?(m=(0,t.jsx)(W,{onChange:o,testId:"fanout-shard-input",value:l}),e[7]=l,e[8]=m):m=e[8];let v;e[9]!==s||e[10]!==a?(v=s!==void 0&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[s.promoted&&(0,t.jsx)(M,{"data-testid":"fanout-promoted",variant:s.relayCount>=s.maxRelays?"destructive":"default",children:s.relayCount>=s.maxRelays?a("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:s.maxRelays,relayCount:s.relayCount}):a("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:s.maxRelays,relayCount:s.relayCount})}),(0,t.jsx)(M,{variant:"secondary",children:a("{count} connections",{count:s.totalConnections})}),(0,t.jsx)(M,{variant:"secondary",children:a("peak {count} subscribers",{count:s.peakSubscribers})})]}),e[9]=s,e[10]=a,e[11]=v):v=e[11];let u;e[12]!==m||e[13]!==v?(u=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[m,v]}),e[12]=m,e[13]=v,e[14]=u):u=e[14];let p;e[15]!==c||e[16]!==k?(p=c!==null&&(0,t.jsx)(H,{error:k,testId:"fanout-error"}),e[15]=c,e[16]=k,e[17]=p):p=e[17];let y;e[18]!==c||e[19]!==d||e[20]!==a?(y=c===null&&d&&(0,t.jsx)(A,{description:a("Realtime fan-out cost and per-topic subscriber counts for this shard."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 12h4l3 7 4-14 3 7h2"})}),testId:"fanout-empty",title:a("No fan-out activity yet.")}),e[18]=c,e[19]=d,e[20]=a,e[21]=y):y=e[21];let f;e[22]!==c||e[23]!==d||e[24]!==s||e[25]!==a?(f=c===null&&s!==void 0&&!d&&(0,t.jsxs)(t.Fragment,{children:[s.topics.length>0&&(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:a("Hot topics")}),(0,t.jsx)(K,{className:"overflow-hidden py-0",children:(0,t.jsxs)(O,{"data-testid":"fanout-topics-table",children:[(0,t.jsx)(U,{children:(0,t.jsxs)(j,{children:[(0,t.jsx)(T,{children:a("Topic")}),(0,t.jsx)(T,{children:a("Kind")}),(0,t.jsx)(T,{className:"text-right",children:a("Subscribers")})]})}),(0,t.jsx)(q,{children:s.topics.map(ee)})]})})]}),(0,t.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[(0,t.jsx)("h2",{className:"text-sm font-medium text-muted-foreground",children:a("Fan-out cost since this instance woke")}),(0,t.jsx)(J,{counters:s.shapePoke,includeTiming:!0,prefix:"fanout-poke",t:a,title:a("Shape pokes")}),(0,t.jsx)(J,{counters:s.whisper,includeTiming:!1,prefix:"fanout-whisper",t:a,title:a("Whisper broadcasts")})]})]}),e[22]=c,e[23]=d,e[24]=s,e[25]=a,e[26]=f):f=e[26];let g;return e[27]!==f||e[28]!==u||e[29]!==p||e[30]!==y?(g=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[u,p,y,f]}),e[27]=f,e[28]=u,e[29]=p,e[30]=y,e[31]=g):g=e[31],g},"ue");function ee(n){return(0,t.jsxs)(j,{"data-testid":"fanout-topic-row",children:[(0,t.jsx)(D,{className:"font-mono text-xs",children:n.topic}),(0,t.jsx)(D,{children:(0,t.jsx)(M,{variant:"outline",children:n.kind})}),(0,t.jsx)(D,{className:"text-right font-medium tabular-nums",children:n.subscribers})]},`${n.kind}:${n.topic}`)}S(ee,"J");export{ue as default};
@@ -0,0 +1 @@
1
+ import{h as o,m as n}from"./chunk-4CGALXS3.js";import{a as r,e as f,f as i}from"./chunk-3XIESWL4.js";var t=f(i(),1);var y=r(()=>{let[u,a]=(0,t.useState)(!1),[e,s]=(0,t.useState)(null);return{busy:u,error:e,run:r(l=>{n((async()=>{a(!0),s(null);try{await l()}catch(c){s(o(c))}finally{a(!1)}})())},"run")}},"c");export{y as a};
@@ -1 +1 @@
1
- import{a as G}from"./chunk-V53KNYRN.js";import{a as g}from"./chunk-5Y3QLNWX.js";import{a as B}from"./chunk-LFXFP4IF.js";import{b as U}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as O}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as h}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as w}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as M}from"./chunk-GXZAXNZI.js";import{f as D}from"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{d as K,e as _,f as z,h as P,m as q,q as E}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as s,e as T,f as ie,h as oe}from"./chunk-3XIESWL4.js";var i=T(ie(),1);var e=T(oe(),1);var de=s(r=>r.kind==="id"?r.table===void 0?"id":`id<${r.table}>`:r.kind==="array"?r.element===void 0?"array":`${r.element}[]`:r.kind,"ie"),le=s(r=>r===void 0||r.length===0?"()":`(${r.map(o=>`${o.name}${o.optional?"?":""}: ${de(o)}`).join(", ")})`,"oe"),ue=s(r=>{switch(r){case"array":return[];case"bigint":case"number":return 0;case"boolean":return!1;case"object":case"record":return{};default:return""}},"de"),ce=s(r=>{let o={};for(let a of r??[])a.optional||(o[a.name]=ue(a.kind));return JSON.stringify(o,void 0,2)},"le"),me=z(M.runAs),fe=10,pe=s(r=>r===void 0?"undefined":JSON.stringify(r,null,2),"me"),Fe=s(({functions:r,runAsIdentity:o=!1}={})=>{let a=K(),c=D(),[H,Q]=(0,i.useState)(null),[k,V]=(0,i.useState)(null),x=r??H??[],[I,S]=(0,i.useState)(""),[m,b]=(0,i.useState)("{}"),[u,F]=(0,i.useState)(""),[f,W]=(0,i.useState)(""),[v,p]=(0,i.useState)("idle"),[X,y]=(0,i.useState)(void 0),[C,N]=(0,i.useState)(null),[$,Y]=(0,i.useState)([]);(0,i.useEffect)(()=>{if(r!==void 0)return;let t=!1;return c.listFunctions().then(d=>(t||Q(d),d)).catch(d=>{t||V(P(d))}),()=>{t=!0}},[c,r]);let j=I===""?x[0]?.path??"":I,n=x.find(t=>t.path===j),Z=s(async()=>{if(!n)return;let t;try{t=m.trim()===""?{}:JSON.parse(m)}catch(l){p("error"),y(void 0),N(a("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:n.path},R=u.trim()===""?{}:{shardKey:u.trim()},A=o?f.trim():"",J=s(l=>{Y(L=>[{argsText:m,at:Date.now(),id:(L[0]?.id??0)+1,kind:n.kind,path:n.path,shardKey:u,status:l},...L].slice(0,fe))},"A");p("running"),N(null);try{let l=A===""?await _(c,n.kind,d,t,R):await c.query(me,{args:t,functionPath:n.path,userId:A},R);U(u),y(l),p("success"),J("success")}catch(l){y(void 0),N(l.message),p("error"),J("error")}},"_"),ee=s(t=>{S(t.path),b(t.argsText),F(t.shardKey)},"q"),te=s(t=>{S(t.target.value)},"B"),re=s(t=>{b(t.target.value)},"D"),ae=s(t=>{W(t.target.value)},"E"),se=s(()=>{q(Z())},"U"),ne=s(()=>{b(ce(n?.args))},"X");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[k!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:k}),(0,e.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)(g,{htmlFor:"function-select",children:a("Function")}),(0,e.jsx)("select",{"aria-label":a("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:te,value:j,children:x.map(t=>(0,e.jsxs)("option",{value:t.path,children:[t.path," (",t.kind,")"]},t.path))}),n!==void 0&&(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"mr-1.5 font-medium",children:a("Signature")}),(0,e.jsx)("code",{className:"font-mono","data-testid":"function-signature",children:le(n.args)})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)(g,{htmlFor:"args-input",children:a("Arguments")}),(0,e.jsx)(h,{"data-testid":"prefill-button",disabled:n===void 0,onClick:ne,size:"xs",type:"button",variant:"ghost",children:a("Prefill")})]}),(0,e.jsx)(G,{"aria-label":a("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:re,value:m})]}),(0,e.jsx)(B,{onChange:F,testId:"shard-input",value:u}),o&&(0,e.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,e.jsx)(g,{htmlFor:"run-as-input",children:a("Run as identity (userId)")}),(0,e.jsx)(O,{"aria-label":a("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:ae,placeholder:a("Leave empty to run as admin"),value:f}),(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground",children:a("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(h,{"data-testid":"run-button",disabled:v==="running"||n===void 0,onClick:se,type:"button",children:a("Run")}),n!==void 0&&(0,e.jsx)(w,{variant:"outline",children:n.kind}),o&&f.trim()!==""&&(0,e.jsx)(w,{"data-testid":"run-as-badge",variant:"secondary",children:a("as {userId}",{userId:f.trim()})})]})]}),v==="error"&&C!==null&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:C}),v==="success"&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:pe(X)}),$.length>0&&(0,e.jsx)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:$.map((t,d)=>(0,e.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,e.jsx)("span",{className:t.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${d.toString()}`,children:t.status==="success"?"\u2713":"\u2717"})," ",(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t.path," (",t.kind,")"]})," ",(0,e.jsx)("time",{className:"text-xs text-muted-foreground",children:E(t.at)})," ",(0,e.jsx)(h,{className:"ml-auto","data-testid":`fn-history-load-${d.toString()}`,onClick:s(()=>{ee(t)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Load")})]},t.id))})]})},"Ie");export{Fe as FunctionRunner};
1
+ import{a as G}from"./chunk-V53KNYRN.js";import{a as g}from"./chunk-5Y3QLNWX.js";import{a as B}from"./chunk-LFXFP4IF.js";import{b as U}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as O}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as h}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as w}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as M}from"./chunk-AADXUXZO.js";import{f as D}from"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{d as K,e as _,f as z,h as P,m as q,q as E}from"./chunk-4CGALXS3.js";import"./chunk-AADILRJW.js";import{a as s,e as T,f as ie,h as oe}from"./chunk-3XIESWL4.js";var i=T(ie(),1);var e=T(oe(),1);var de=s(r=>r.kind==="id"?r.table===void 0?"id":`id<${r.table}>`:r.kind==="array"?r.element===void 0?"array":`${r.element}[]`:r.kind,"ie"),le=s(r=>r===void 0||r.length===0?"()":`(${r.map(o=>`${o.name}${o.optional?"?":""}: ${de(o)}`).join(", ")})`,"oe"),ue=s(r=>{switch(r){case"array":return[];case"bigint":case"number":return 0;case"boolean":return!1;case"object":case"record":return{};default:return""}},"de"),ce=s(r=>{let o={};for(let a of r??[])a.optional||(o[a.name]=ue(a.kind));return JSON.stringify(o,void 0,2)},"le"),me=z(M.runAs),fe=10,pe=s(r=>r===void 0?"undefined":JSON.stringify(r,null,2),"me"),Fe=s(({functions:r,runAsIdentity:o=!1}={})=>{let a=K(),c=D(),[H,Q]=(0,i.useState)(null),[k,V]=(0,i.useState)(null),x=r??H??[],[I,S]=(0,i.useState)(""),[m,b]=(0,i.useState)("{}"),[u,F]=(0,i.useState)(""),[f,W]=(0,i.useState)(""),[v,p]=(0,i.useState)("idle"),[X,y]=(0,i.useState)(void 0),[C,N]=(0,i.useState)(null),[$,Y]=(0,i.useState)([]);(0,i.useEffect)(()=>{if(r!==void 0)return;let t=!1;return c.listFunctions().then(d=>(t||Q(d),d)).catch(d=>{t||V(P(d))}),()=>{t=!0}},[c,r]);let j=I===""?x[0]?.path??"":I,n=x.find(t=>t.path===j),Z=s(async()=>{if(!n)return;let t;try{t=m.trim()===""?{}:JSON.parse(m)}catch(l){p("error"),y(void 0),N(a("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:n.path},R=u.trim()===""?{}:{shardKey:u.trim()},A=o?f.trim():"",J=s(l=>{Y(L=>[{argsText:m,at:Date.now(),id:(L[0]?.id??0)+1,kind:n.kind,path:n.path,shardKey:u,status:l},...L].slice(0,fe))},"A");p("running"),N(null);try{let l=A===""?await _(c,n.kind,d,t,R):await c.query(me,{args:t,functionPath:n.path,userId:A},R);U(u),y(l),p("success"),J("success")}catch(l){y(void 0),N(l.message),p("error"),J("error")}},"_"),ee=s(t=>{S(t.path),b(t.argsText),F(t.shardKey)},"q"),te=s(t=>{S(t.target.value)},"B"),re=s(t=>{b(t.target.value)},"D"),ae=s(t=>{W(t.target.value)},"E"),se=s(()=>{q(Z())},"U"),ne=s(()=>{b(ce(n?.args))},"X");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[k!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:k}),(0,e.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)(g,{htmlFor:"function-select",children:a("Function")}),(0,e.jsx)("select",{"aria-label":a("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:te,value:j,children:x.map(t=>(0,e.jsxs)("option",{value:t.path,children:[t.path," (",t.kind,")"]},t.path))}),n!==void 0&&(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"mr-1.5 font-medium",children:a("Signature")}),(0,e.jsx)("code",{className:"font-mono","data-testid":"function-signature",children:le(n.args)})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)(g,{htmlFor:"args-input",children:a("Arguments")}),(0,e.jsx)(h,{"data-testid":"prefill-button",disabled:n===void 0,onClick:ne,size:"xs",type:"button",variant:"ghost",children:a("Prefill")})]}),(0,e.jsx)(G,{"aria-label":a("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:re,value:m})]}),(0,e.jsx)(B,{onChange:F,testId:"shard-input",value:u}),o&&(0,e.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,e.jsx)(g,{htmlFor:"run-as-input",children:a("Run as identity (userId)")}),(0,e.jsx)(O,{"aria-label":a("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:ae,placeholder:a("Leave empty to run as admin"),value:f}),(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground",children:a("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(h,{"data-testid":"run-button",disabled:v==="running"||n===void 0,onClick:se,type:"button",children:a("Run")}),n!==void 0&&(0,e.jsx)(w,{variant:"outline",children:n.kind}),o&&f.trim()!==""&&(0,e.jsx)(w,{"data-testid":"run-as-badge",variant:"secondary",children:a("as {userId}",{userId:f.trim()})})]})]}),v==="error"&&C!==null&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:C}),v==="success"&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:pe(X)}),$.length>0&&(0,e.jsx)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:$.map((t,d)=>(0,e.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,e.jsx)("span",{className:t.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${d.toString()}`,children:t.status==="success"?"\u2713":"\u2717"})," ",(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t.path," (",t.kind,")"]})," ",(0,e.jsx)("time",{className:"text-xs text-muted-foreground",children:E(t.at)})," ",(0,e.jsx)(h,{className:"ml-auto","data-testid":`fn-history-load-${d.toString()}`,onClick:s(()=>{ee(t)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Load")})]},t.id))})]})},"Ie");export{Fe as FunctionRunner};
@@ -1 +1 @@
1
- import{b as ee}from"./chunk-XSD4Y6SQ.js";import{a as z,b as D,c as F,d as w,e as l,f as o}from"./chunk-MIQTKZAR.js";import{a as E,e as j}from"./chunk-UZERI5YC.js";import{a as te}from"./chunk-V53KNYRN.js";import{R as Z}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as I}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import"./chunk-6ST5ECQA.js";import{a as K}from"./chunk-GXZAXNZI.js";import{f as G}from"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as P}from"./chunk-XQCVZAGU.js";import{d as H,f as Q,g as V,h as W,m as $}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as n,e as Y,f as ne,h as le}from"./chunk-3XIESWL4.js";var i=Y(ne(),1);var e=Y(le(),1);var oe=["queued","running","paused","waiting","complete","errored","terminated"],ie=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=n(c=>typeof c=="object"&&c!==null&&c.code===de,"de"),me=n(c=>{let r=c.error??c.output;if(r===void 0)return"\u2014";try{return JSON.stringify(r)}catch{return"(unserializable)"}},"ce"),ue=n(({loadDetail:c,loadInstances:r,readOnly:b,runAction:_,workflowName:h})=>{let A=G(),s=H(),[N,g]=(0,i.useState)(null),[S,O]=(0,i.useState)(null),[k,J]=(0,i.useState)(""),[v,p]=(0,i.useState)(null),[L,C]=(0,i.useState)(!1),[R,U]=(0,i.useState)(null),f=c??(a=>A.getWorkflowInstance(a)),x=b?void 0:_??(r===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),T=n(async()=>{p(null),C(!1);let a=k===""?void 0:k;try{if(r===void 0){let d=await A.listWorkflowInstances({name:h,status:a});if(d.configured===!1){g(null),C(!0);return}g(d.instances);return}g(await r({name:h,status:a}))}catch(d){g(null),ce(d)?C(!0):p(W(d))}},"O");(0,i.useEffect)(()=>{O(null),$(T())},[h,k]);let q=n(async a=>{p(null);try{O(await f({id:a,name:h}))}catch(d){p(W(d))}},"D"),M=n(async(a,d)=>{if(x!==void 0){U(a),p(null);try{await x({action:d,id:a,name:h}),await T()}catch(B){p(W(B))}finally{U(null)}}},"q");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:s("Instance history")}),(0,e.jsxs)("select",{"aria-label":s("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:n(a=>{J(a.target.value)},"onChange"),value:k,children:[(0,e.jsx)("option",{value:"",children:s("All statuses")}),oe.map(a=>(0,e.jsx)("option",{value:a,children:a},a))]})]}),v!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:v}),L&&(0,e.jsx)(P,{description:s("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:s("Workflow inspection not configured")}),!L&&N!==null&&N.length===0&&(0,e.jsx)(P,{description:s("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:s("No instances")}),N!==null&&N.length>0&&(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(z,{"data-testid":"workflow-instances-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(w,{children:[(0,e.jsx)(l,{children:s("Instance id")}),(0,e.jsx)(l,{children:s("Status")}),(0,e.jsx)(l,{children:s("Created")}),(0,e.jsx)(l,{children:s("Ended")}),(0,e.jsx)(l,{"aria-label":s("Actions")})]})}),(0,e.jsx)(F,{children:N.map(a=>(0,e.jsxs)(w,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:a.id}),(0,e.jsx)(o,{className:"font-mono text-xs",children:a.status}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"}),(0,e.jsx)(o,{className:"text-right",children:(0,e.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsx)(I,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:n(()=>{$(q(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:s("Steps")}),x!==void 0&&ie.map(d=>(0,e.jsx)(I,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:R===a.id,onClick:n(()=>{$(M(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:s(d)},d))]})})]},a.id))})]})})}),S!==null&&(0,e.jsx)(E,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxs)(j,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[s("Steps")," \xB7 ",S.id]}),(0,e.jsx)(I,{"data-testid":"workflow-instance-detail-close",onClick:n(()=>{O(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Close")})]}),S.steps.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:s("This instance has no recorded steps yet.")}):(0,e.jsxs)(z,{"data-testid":"workflow-instance-steps",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(w,{children:[(0,e.jsx)(l,{children:s("Step")}),(0,e.jsx)(l,{children:s("Type")}),(0,e.jsx)(l,{children:s("Attempts")}),(0,e.jsx)(l,{children:s("Started")}),(0,e.jsx)(l,{children:s("Output")})]})}),(0,e.jsx)(F,{children:S.steps.map((a,d)=>(0,e.jsxs)(w,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:a.name}),(0,e.jsx)(o,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"}),(0,e.jsx)(o,{className:"tabular-nums",children:a.attempts??"\u2014"}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:me(a)})]},`${a.name}:${String(d)}`))})]})]})})]})},"me"),fe=Q(K.createWorkflowInstance),he=Q(K.getWorkflowInstanceStatus),pe=n(c=>{if(c.error)return`${c.error.name}: ${c.error.message}`;if(c.output===void 0)return"\u2014";try{return JSON.stringify(c.output)}catch{return"(unserializable)"}},"he"),Ie=n(()=>{let c=G(),r=H(),{data:b,error:_}=ee(K.listWorkflows,{}),[h,A]=(0,i.useState)(""),[s,N]=(0,i.useState)(""),[g,S]=(0,i.useState)(""),[O,k]=(0,i.useState)(!1),[J,v]=(0,i.useState)(null),[p,L]=(0,i.useState)([]),[C,R]=(0,i.useState)(null),U=b!==void 0,f=(0,i.useMemo)(()=>Array.isArray(b?.workflows)?[...b.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],[b]),x=(0,i.useMemo)(()=>f.some(t=>t.exportName===h)?h:f[0]?.exportName??"",[f,h]),T=(0,i.useMemo)(()=>f.find(t=>t.exportName===x),[f,x]),q=n(t=>{L(u=>{let m=u.filter(y=>!(y.exportName===t.exportName&&y.id===t.id));return[t,...m]})},"D"),M=n(async()=>{let t=x;if(t==="")return;let u,m=g.trim();if(m!=="")try{u=JSON.parse(m)}catch{v(r("Params must be valid JSON"));return}k(!0),v(null);try{let y=s.trim(),X=await c.query(fe,{exportName:t,id:y===""?void 0:y,params:u},V(""));q({exportName:t,id:X.id,status:X.status}),N("")}catch(y){v(W(y))}finally{k(!1)}},"q"),a=n(()=>{$(M())},"a"),d=n(async(t,u)=>{R(u);try{let m=await c.query(he,{exportName:t,id:u},V(""));q({error:m.error,exportName:t,id:m.id,output:m.output,status:m.status})}catch(m){v(W(m))}finally{R(null)}},"l"),B=n(t=>{A(t.target.value)},"M"),ae=n(t=>{N(t.target.value)},"Z"),re=n(t=>{S(t.target.value)},"ee"),se=n(t=>{let{export:u,id:m}=t.currentTarget.dataset;u!==void 0&&m!==void 0&&$(d(u,m))},"te");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[_!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:_}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:r("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),U&&f.length===0?(0,e.jsx)(P,{description:r("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:r("No workflows defined")}):(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(z,{"data-testid":"workflows-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(w,{children:[(0,e.jsx)(l,{children:r("Export")}),(0,e.jsx)(l,{children:r("Name")}),(0,e.jsx)(l,{children:r("Class")}),(0,e.jsx)(l,{children:r("Binding")})]})}),(0,e.jsx)(F,{children:f.map(t=>(0,e.jsxs)(w,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:t.name}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:t.className}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:t.binding})]},t.exportName))})]})})}),f.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Start instance")}),J!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:J}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("select",{"aria-label":r("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:B,value:x,children:f.map(t=>(0,e.jsx)("option",{value:t.exportName,children:t.exportName},t.exportName))}),(0,e.jsx)(Z,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:ae,placeholder:r("Instance id (optional)"),value:s}),(0,e.jsx)(I,{"data-testid":"workflows-start-button",disabled:O||x==="",onClick:a,children:r(O?"Starting\u2026":"Start instance")})]}),(0,e.jsx)(te,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:re,placeholder:r("Params (JSON, optional)"),value:g})]}),p.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Instances")}),(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(z,{"data-testid":"workflows-instances-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(w,{children:[(0,e.jsx)(l,{children:r("Workflow")}),(0,e.jsx)(l,{children:r("Instance id")}),(0,e.jsx)(l,{children:r("Status")}),(0,e.jsx)(l,{children:r("Output")}),(0,e.jsx)(l,{})]})}),(0,e.jsx)(F,{children:p.map(t=>(0,e.jsxs)(w,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:t.id}),(0,e.jsx)(o,{className:"font-mono text-xs",children:t.status}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:pe(t)}),(0,e.jsx)(o,{children:(0,e.jsx)(I,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:C===t.id,onClick:se,size:"xs",variant:"outline",children:C===t.id?r("Refreshing\u2026"):r("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),T!==void 0&&(0,e.jsx)(ue,{workflowName:T.name})]})},"Oe");export{Ie as default};
1
+ import{b as ee}from"./chunk-BMQJ4CAO.js";import{a as z,b as D,c as F,d as w,e as l,f as o}from"./chunk-MIQTKZAR.js";import{a as E,e as j}from"./chunk-UZERI5YC.js";import{a as te}from"./chunk-V53KNYRN.js";import{R as Z}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as I}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import"./chunk-6ST5ECQA.js";import{a as K}from"./chunk-AADXUXZO.js";import{f as G}from"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{a as P}from"./chunk-XQCVZAGU.js";import{d as H,f as Q,g as V,h as W,m as $}from"./chunk-4CGALXS3.js";import"./chunk-AADILRJW.js";import{a as n,e as Y,f as ne,h as le}from"./chunk-3XIESWL4.js";var i=Y(ne(),1);var e=Y(le(),1);var oe=["queued","running","paused","waiting","complete","errored","terminated"],ie=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=n(c=>typeof c=="object"&&c!==null&&c.code===de,"de"),me=n(c=>{let r=c.error??c.output;if(r===void 0)return"\u2014";try{return JSON.stringify(r)}catch{return"(unserializable)"}},"ce"),ue=n(({loadDetail:c,loadInstances:r,readOnly:b,runAction:_,workflowName:h})=>{let A=G(),s=H(),[N,g]=(0,i.useState)(null),[S,O]=(0,i.useState)(null),[k,J]=(0,i.useState)(""),[v,p]=(0,i.useState)(null),[L,C]=(0,i.useState)(!1),[R,U]=(0,i.useState)(null),f=c??(a=>A.getWorkflowInstance(a)),x=b?void 0:_??(r===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),T=n(async()=>{p(null),C(!1);let a=k===""?void 0:k;try{if(r===void 0){let d=await A.listWorkflowInstances({name:h,status:a});if(d.configured===!1){g(null),C(!0);return}g(d.instances);return}g(await r({name:h,status:a}))}catch(d){g(null),ce(d)?C(!0):p(W(d))}},"O");(0,i.useEffect)(()=>{O(null),$(T())},[h,k]);let q=n(async a=>{p(null);try{O(await f({id:a,name:h}))}catch(d){p(W(d))}},"D"),M=n(async(a,d)=>{if(x!==void 0){U(a),p(null);try{await x({action:d,id:a,name:h}),await T()}catch(B){p(W(B))}finally{U(null)}}},"q");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:s("Instance history")}),(0,e.jsxs)("select",{"aria-label":s("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:n(a=>{J(a.target.value)},"onChange"),value:k,children:[(0,e.jsx)("option",{value:"",children:s("All statuses")}),oe.map(a=>(0,e.jsx)("option",{value:a,children:a},a))]})]}),v!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:v}),L&&(0,e.jsx)(P,{description:s("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:s("Workflow inspection not configured")}),!L&&N!==null&&N.length===0&&(0,e.jsx)(P,{description:s("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:s("No instances")}),N!==null&&N.length>0&&(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(z,{"data-testid":"workflow-instances-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(w,{children:[(0,e.jsx)(l,{children:s("Instance id")}),(0,e.jsx)(l,{children:s("Status")}),(0,e.jsx)(l,{children:s("Created")}),(0,e.jsx)(l,{children:s("Ended")}),(0,e.jsx)(l,{"aria-label":s("Actions")})]})}),(0,e.jsx)(F,{children:N.map(a=>(0,e.jsxs)(w,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:a.id}),(0,e.jsx)(o,{className:"font-mono text-xs",children:a.status}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"}),(0,e.jsx)(o,{className:"text-right",children:(0,e.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsx)(I,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:n(()=>{$(q(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:s("Steps")}),x!==void 0&&ie.map(d=>(0,e.jsx)(I,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:R===a.id,onClick:n(()=>{$(M(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:s(d)},d))]})})]},a.id))})]})})}),S!==null&&(0,e.jsx)(E,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxs)(j,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[s("Steps")," \xB7 ",S.id]}),(0,e.jsx)(I,{"data-testid":"workflow-instance-detail-close",onClick:n(()=>{O(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Close")})]}),S.steps.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:s("This instance has no recorded steps yet.")}):(0,e.jsxs)(z,{"data-testid":"workflow-instance-steps",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(w,{children:[(0,e.jsx)(l,{children:s("Step")}),(0,e.jsx)(l,{children:s("Type")}),(0,e.jsx)(l,{children:s("Attempts")}),(0,e.jsx)(l,{children:s("Started")}),(0,e.jsx)(l,{children:s("Output")})]})}),(0,e.jsx)(F,{children:S.steps.map((a,d)=>(0,e.jsxs)(w,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:a.name}),(0,e.jsx)(o,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"}),(0,e.jsx)(o,{className:"tabular-nums",children:a.attempts??"\u2014"}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:me(a)})]},`${a.name}:${String(d)}`))})]})]})})]})},"me"),fe=Q(K.createWorkflowInstance),he=Q(K.getWorkflowInstanceStatus),pe=n(c=>{if(c.error)return`${c.error.name}: ${c.error.message}`;if(c.output===void 0)return"\u2014";try{return JSON.stringify(c.output)}catch{return"(unserializable)"}},"he"),Ie=n(()=>{let c=G(),r=H(),{data:b,error:_}=ee(K.listWorkflows,{}),[h,A]=(0,i.useState)(""),[s,N]=(0,i.useState)(""),[g,S]=(0,i.useState)(""),[O,k]=(0,i.useState)(!1),[J,v]=(0,i.useState)(null),[p,L]=(0,i.useState)([]),[C,R]=(0,i.useState)(null),U=b!==void 0,f=(0,i.useMemo)(()=>Array.isArray(b?.workflows)?[...b.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],[b]),x=(0,i.useMemo)(()=>f.some(t=>t.exportName===h)?h:f[0]?.exportName??"",[f,h]),T=(0,i.useMemo)(()=>f.find(t=>t.exportName===x),[f,x]),q=n(t=>{L(u=>{let m=u.filter(y=>!(y.exportName===t.exportName&&y.id===t.id));return[t,...m]})},"D"),M=n(async()=>{let t=x;if(t==="")return;let u,m=g.trim();if(m!=="")try{u=JSON.parse(m)}catch{v(r("Params must be valid JSON"));return}k(!0),v(null);try{let y=s.trim(),X=await c.query(fe,{exportName:t,id:y===""?void 0:y,params:u},V(""));q({exportName:t,id:X.id,status:X.status}),N("")}catch(y){v(W(y))}finally{k(!1)}},"q"),a=n(()=>{$(M())},"a"),d=n(async(t,u)=>{R(u);try{let m=await c.query(he,{exportName:t,id:u},V(""));q({error:m.error,exportName:t,id:m.id,output:m.output,status:m.status})}catch(m){v(W(m))}finally{R(null)}},"l"),B=n(t=>{A(t.target.value)},"M"),ae=n(t=>{N(t.target.value)},"Z"),re=n(t=>{S(t.target.value)},"ee"),se=n(t=>{let{export:u,id:m}=t.currentTarget.dataset;u!==void 0&&m!==void 0&&$(d(u,m))},"te");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[_!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:_}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:r("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),U&&f.length===0?(0,e.jsx)(P,{description:r("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:r("No workflows defined")}):(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(z,{"data-testid":"workflows-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(w,{children:[(0,e.jsx)(l,{children:r("Export")}),(0,e.jsx)(l,{children:r("Name")}),(0,e.jsx)(l,{children:r("Class")}),(0,e.jsx)(l,{children:r("Binding")})]})}),(0,e.jsx)(F,{children:f.map(t=>(0,e.jsxs)(w,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:t.name}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:t.className}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:t.binding})]},t.exportName))})]})})}),f.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Start instance")}),J!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:J}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("select",{"aria-label":r("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:B,value:x,children:f.map(t=>(0,e.jsx)("option",{value:t.exportName,children:t.exportName},t.exportName))}),(0,e.jsx)(Z,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:ae,placeholder:r("Instance id (optional)"),value:s}),(0,e.jsx)(I,{"data-testid":"workflows-start-button",disabled:O||x==="",onClick:a,children:r(O?"Starting\u2026":"Start instance")})]}),(0,e.jsx)(te,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:re,placeholder:r("Params (JSON, optional)"),value:g})]}),p.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Instances")}),(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(z,{"data-testid":"workflows-instances-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(w,{children:[(0,e.jsx)(l,{children:r("Workflow")}),(0,e.jsx)(l,{children:r("Instance id")}),(0,e.jsx)(l,{children:r("Status")}),(0,e.jsx)(l,{children:r("Output")}),(0,e.jsx)(l,{})]})}),(0,e.jsx)(F,{children:p.map(t=>(0,e.jsxs)(w,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:t.id}),(0,e.jsx)(o,{className:"font-mono text-xs",children:t.status}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:pe(t)}),(0,e.jsx)(o,{children:(0,e.jsx)(I,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:C===t.id,onClick:se,size:"xs",variant:"outline",children:C===t.id?r("Refreshing\u2026"):r("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),T!==void 0&&(0,e.jsx)(ue,{workflowName:T.name})]})},"Oe");export{Ie as default};
@@ -1 +1 @@
1
- import{a as Q}from"./chunk-X2FQ6B5V.js";import{a as J}from"./chunk-7LQWFOEU.js";import{a as W}from"./chunk-LFKCLLPT.js";import{a as _}from"./chunk-UNUU7CJJ.js";import"./chunk-XXQUMVWH.js";import{b as O}from"./chunk-XSD4Y6SQ.js";import{a as $,b as G,c as H,d as x,e as t,f as n}from"./chunk-MIQTKZAR.js";import{a as j,e as K}from"./chunk-UZERI5YC.js";import{a as y}from"./chunk-5Y3QLNWX.js";import{a as U}from"./chunk-LFXFP4IF.js";import{b as P}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as S}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as D}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as E}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as v}from"./chunk-GXZAXNZI.js";import{f as L}from"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as z}from"./chunk-XQCVZAGU.js";import{d as M,f as A,g as B,h as F,m as T,q}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as s,e as I,f as lr,h as cr}from"./chunk-3XIESWL4.js";var i=I(lr(),1);var r=I(cr(),1);var mr=A(v.runMigration),Sr=s(({initialShardKey:V})=>{let X=L(),e=M(),[c,Y]=(0,i.useState)(V??""),[b,Z]=(0,i.useState)(""),[w,rr]=(0,i.useState)("up"),[h,er]=(0,i.useState)(!0),[m,N]=(0,i.useState)(!1),[d,p]=(0,i.useState)(null),[k,g]=(0,i.useState)(null),u=W(c.trim(),400),C=c.trim()===u,o=O(v.migrationStatus,{},{live:!0,shardKey:u}),l=o.data?.migrations??null,ar=o.error,{errorSource:ir,liveError:tr}=o;(0,i.useEffect)(()=>{o.data!==void 0&&P(u)},[o.data,u]);let nr=s(async()=>{let a=b.trim();if(a===""){g(e("Enter a migration id")),p(null);return}N(!0),g(null);try{let f=await X.query(mr,{direction:w,dryRun:h,id:a},B(c));p(f),o.refetch()}catch(f){p(null),g(F(f))}finally{N(!1)}},"K"),R=s(()=>{T(nr())},"N"),sr=s(a=>{Z(a.target.value)},"T"),or=s(a=>{rr(a.target.value==="down"?"down":"up")},"B"),dr=s(a=>{er(a.target.checked)},"F");return(0,r.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-migrations",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(U,{onChange:Y,testId:"mg-shard-input",value:c}),(0,r.jsx)(Q,{message:tr,prefix:"mg"})]}),ar!==null&&(0,r.jsx)(_,{error:ir,testId:"mg-status-error"}),l!==null&&l.length===0&&(0,r.jsx)(z,{description:e("Data migrations you run against this shard will be tracked here."),icon:(0,r.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})}),testId:"mg-empty",title:e("No migrations have run on this shard.")}),l!==null&&l.length>0&&(0,r.jsx)(j,{className:"overflow-hidden py-0",children:(0,r.jsx)(K,{className:"px-0",children:(0,r.jsxs)($,{"data-testid":"mg-table",children:[(0,r.jsx)(G,{children:(0,r.jsxs)(x,{children:[(0,r.jsx)(t,{children:e("id")}),(0,r.jsx)(t,{children:e("direction")}),(0,r.jsx)(t,{children:e("status")}),(0,r.jsx)(t,{children:e("processed")}),(0,r.jsx)(t,{children:e("changed")}),(0,r.jsx)(t,{children:e("updated")}),(0,r.jsx)(t,{children:e("error")})]})}),(0,r.jsx)(H,{children:l.map(a=>(0,r.jsxs)(x,{"data-testid":`mg-row-${a.id}`,children:[(0,r.jsx)(n,{children:a.id}),(0,r.jsx)(n,{children:a.direction}),(0,r.jsx)(n,{children:(0,r.jsx)(E,{variant:"secondary",children:a.status})}),(0,r.jsx)(n,{children:a.processed}),(0,r.jsx)(n,{children:a.changed}),(0,r.jsx)(n,{children:q(a.updatedAt)}),(0,r.jsx)(n,{children:a.error??""})]},a.id))})]})})}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,r.jsx)(y,{children:e("Run migration")}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(S,{"aria-label":e("Migration id"),className:"w-auto","data-testid":"mg-id-input",onChange:sr,placeholder:e("migration id"),value:b}),(0,r.jsxs)("select",{"aria-label":e("Direction"),className:"flex h-9 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"mg-direction",onChange:or,value:w,children:[(0,r.jsx)("option",{value:"up",children:e("up")}),(0,r.jsx)("option",{value:"down",children:e("down")})]}),(0,r.jsxs)(y,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[(0,r.jsx)("input",{checked:h,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:dr,type:"checkbox"}),e("Dry run")]}),h?(0,r.jsx)(D,{"data-testid":"mg-run",disabled:m||!C,onClick:R,size:"sm",type:"button",children:e(m?"Running\u2026":"Run")}):(0,r.jsx)(J,{confirmLabel:e(m?"Running\u2026":"Run migration?"),disabled:m||!C,onConfirm:R,testId:"mg-run",children:e("Run")})]})]}),k!==null&&(0,r.jsx)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:k}),d!==null&&(0,r.jsxs)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[d.dryRun?e("Dry run: "):"",e("{status} \u2014 processed",{status:d.status}),d.processed,e(", changed"),d.changed]})]})},"Er");export{Sr as MigrationsPanel};
1
+ import{a as Q}from"./chunk-X2FQ6B5V.js";import{a as J}from"./chunk-7LQWFOEU.js";import{a as W}from"./chunk-LFKCLLPT.js";import{a as _}from"./chunk-HK4OVYG3.js";import"./chunk-XXQUMVWH.js";import{b as O}from"./chunk-BMQJ4CAO.js";import{a as $,b as G,c as H,d as x,e as t,f as n}from"./chunk-MIQTKZAR.js";import{a as j,e as K}from"./chunk-UZERI5YC.js";import{a as y}from"./chunk-5Y3QLNWX.js";import{a as U}from"./chunk-LFXFP4IF.js";import{b as P}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as S}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as D}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as E}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as v}from"./chunk-AADXUXZO.js";import{f as L}from"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{a as z}from"./chunk-XQCVZAGU.js";import{d as M,f as A,g as B,h as F,m as T,q}from"./chunk-4CGALXS3.js";import"./chunk-AADILRJW.js";import{a as s,e as I,f as lr,h as cr}from"./chunk-3XIESWL4.js";var i=I(lr(),1);var r=I(cr(),1);var mr=A(v.runMigration),Sr=s(({initialShardKey:V})=>{let X=L(),e=M(),[c,Y]=(0,i.useState)(V??""),[b,Z]=(0,i.useState)(""),[w,rr]=(0,i.useState)("up"),[h,er]=(0,i.useState)(!0),[m,N]=(0,i.useState)(!1),[d,p]=(0,i.useState)(null),[k,g]=(0,i.useState)(null),u=W(c.trim(),400),C=c.trim()===u,o=O(v.migrationStatus,{},{live:!0,shardKey:u}),l=o.data?.migrations??null,ar=o.error,{errorSource:ir,liveError:tr}=o;(0,i.useEffect)(()=>{o.data!==void 0&&P(u)},[o.data,u]);let nr=s(async()=>{let a=b.trim();if(a===""){g(e("Enter a migration id")),p(null);return}N(!0),g(null);try{let f=await X.query(mr,{direction:w,dryRun:h,id:a},B(c));p(f),o.refetch()}catch(f){p(null),g(F(f))}finally{N(!1)}},"K"),R=s(()=>{T(nr())},"N"),sr=s(a=>{Z(a.target.value)},"T"),or=s(a=>{rr(a.target.value==="down"?"down":"up")},"B"),dr=s(a=>{er(a.target.checked)},"F");return(0,r.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-migrations",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(U,{onChange:Y,testId:"mg-shard-input",value:c}),(0,r.jsx)(Q,{message:tr,prefix:"mg"})]}),ar!==null&&(0,r.jsx)(_,{error:ir,testId:"mg-status-error"}),l!==null&&l.length===0&&(0,r.jsx)(z,{description:e("Data migrations you run against this shard will be tracked here."),icon:(0,r.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})}),testId:"mg-empty",title:e("No migrations have run on this shard.")}),l!==null&&l.length>0&&(0,r.jsx)(j,{className:"overflow-hidden py-0",children:(0,r.jsx)(K,{className:"px-0",children:(0,r.jsxs)($,{"data-testid":"mg-table",children:[(0,r.jsx)(G,{children:(0,r.jsxs)(x,{children:[(0,r.jsx)(t,{children:e("id")}),(0,r.jsx)(t,{children:e("direction")}),(0,r.jsx)(t,{children:e("status")}),(0,r.jsx)(t,{children:e("processed")}),(0,r.jsx)(t,{children:e("changed")}),(0,r.jsx)(t,{children:e("updated")}),(0,r.jsx)(t,{children:e("error")})]})}),(0,r.jsx)(H,{children:l.map(a=>(0,r.jsxs)(x,{"data-testid":`mg-row-${a.id}`,children:[(0,r.jsx)(n,{children:a.id}),(0,r.jsx)(n,{children:a.direction}),(0,r.jsx)(n,{children:(0,r.jsx)(E,{variant:"secondary",children:a.status})}),(0,r.jsx)(n,{children:a.processed}),(0,r.jsx)(n,{children:a.changed}),(0,r.jsx)(n,{children:q(a.updatedAt)}),(0,r.jsx)(n,{children:a.error??""})]},a.id))})]})})}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,r.jsx)(y,{children:e("Run migration")}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(S,{"aria-label":e("Migration id"),className:"w-auto","data-testid":"mg-id-input",onChange:sr,placeholder:e("migration id"),value:b}),(0,r.jsxs)("select",{"aria-label":e("Direction"),className:"flex h-9 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"mg-direction",onChange:or,value:w,children:[(0,r.jsx)("option",{value:"up",children:e("up")}),(0,r.jsx)("option",{value:"down",children:e("down")})]}),(0,r.jsxs)(y,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[(0,r.jsx)("input",{checked:h,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:dr,type:"checkbox"}),e("Dry run")]}),h?(0,r.jsx)(D,{"data-testid":"mg-run",disabled:m||!C,onClick:R,size:"sm",type:"button",children:e(m?"Running\u2026":"Run")}):(0,r.jsx)(J,{confirmLabel:e(m?"Running\u2026":"Run migration?"),disabled:m||!C,onConfirm:R,testId:"mg-run",children:e("Run")})]})]}),k!==null&&(0,r.jsx)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:k}),d!==null&&(0,r.jsxs)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[d.dryRun?e("Dry run: "):"",e("{status} \u2014 processed",{status:d.status}),d.processed,e(", changed"),d.changed]})]})},"Er");export{Sr as MigrationsPanel};
@@ -1 +1 @@
1
- import{a as T}from"./chunk-X2FQ6B5V.js";import{b as k}from"./chunk-XSD4Y6SQ.js";import{a as D,b as E,c as O,d as C,e as i,f as o}from"./chunk-MIQTKZAR.js";import{a as I,e as $}from"./chunk-UZERI5YC.js";import{b}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as A}from"./chunk-GXZAXNZI.js";import"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as L}from"./chunk-XQCVZAGU.js";import{d as S}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as v,e as w,f as K,g as M,h as P}from"./chunk-3XIESWL4.js";var j=w(M(),1),q=w(K(),1);var t=w(P(),1);var _="container:",W={error:"error",sleep:"sleeping",start:"running",stop:"stopped"},B=v(e=>{let n=e.indexOf(":");if(n===-1)return{event:e.trim()};let r=e.slice(n+1).trim(),a=e.slice(0,n).trim();return r===""?{event:a}:{detail:r,event:a}},"j"),F=v(e=>{let n=new Map;for(let r of e){let a=r.functionPath??"";if(!a.startsWith(_))continue;let s=a.slice(_.length);if(s==="")continue;let c=JSON.stringify([s,r.instance??""]),m=n.get(c);if(m!==void 0&&m.timestamp>=r.timestamp)continue;let{detail:g,event:l}=B(r.message);n.set(c,{detail:g,event:l,exitCode:r.exitCode,instance:r.instance,level:r.level,name:s,state:W[l]??"unknown",timestamp:r.timestamp})}return[...n.values()].toSorted((r,a)=>r.name.localeCompare(a.name)||(r.instance??"").localeCompare(a.instance??""))},"K"),J={error:"destructive",running:"success",sleeping:"info",stopped:"outline",unknown:"secondary"},U=v(e=>{let{entries:n}=e??{};return Array.isArray(n)?n:[]},"W"),ee=v(()=>{let e=(0,j.c)(23),n=S(),r,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},a={live:!0,shardKey:""},e[0]=r,e[1]=a):(r=e[0],a=e[1]);let{data:s,error:c,liveError:m}=k(A.getLogs,r,a),g=s!==void 0,l;e[2]!==s?(l=F(U(s)),e[2]=s,e[3]=l):l=e[3];let N=l,d;e[4]!==c?(d=c!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"containers-error",role:"alert",children:c}),e[4]=c,e[5]=d):d=e[5];let h;e[6]!==n?(h=n("Cloudflare Containers are observed from their lifecycle log stream. This shows the current state per instance \u2014 ports and health checks aren't carried in that stream."),e[6]=n,e[7]=h):h=e[7];let p;e[8]!==h?(p=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:h}),e[8]=h,e[9]=p):p=e[9];let u;e[10]!==m?(u=(0,t.jsx)(T,{message:m,prefix:"containers"}),e[10]=m,e[11]=u):u=e[11];let f;e[12]!==p||e[13]!==u?(f=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p,u]}),e[12]=p,e[13]=u,e[14]=f):f=e[14];let x;e[15]!==g||e[16]!==N||e[17]!==n?(x=g&&N.length===0?(0,t.jsx)(L,{description:n("No container lifecycle activity yet. Instances declared with defineContainer show up here once they start, sleep, stop, or error."),testId:"containers-empty",title:n("No container activity")}):(0,t.jsx)(I,{className:"overflow-hidden py-0",children:(0,t.jsx)($,{className:"px-0",children:(0,t.jsxs)(D,{"data-testid":"containers-table",children:[(0,t.jsx)(E,{children:(0,t.jsxs)(C,{children:[(0,t.jsx)(i,{children:n("Container")}),(0,t.jsx)(i,{children:n("Instance")}),(0,t.jsx)(i,{children:n("State")}),(0,t.jsx)(i,{children:n("Last event")}),(0,t.jsx)(i,{children:n("Detail")}),(0,t.jsx)(i,{children:n("Exit")}),(0,t.jsx)(i,{children:n("When")})]})}),(0,t.jsx)(O,{children:N.map(Y)})]})})}),e[15]=g,e[16]=N,e[17]=n,e[18]=x):x=e[18];let y;return e[19]!==d||e[20]!==f||e[21]!==x?(y=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-containers-panel",children:[d,f,x]}),e[19]=d,e[20]=f,e[21]=x,e[22]=y):y=e[22],y},"Y");function Y(e){return(0,t.jsxs)(C,{"data-testid":`containers-row-${e.name}${e.instance===void 0?"":`-${e.instance}`}`,children:[(0,t.jsx)(o,{className:"font-mono text-xs",children:e.name}),(0,t.jsx)(o,{className:"max-w-40 truncate font-mono text-xs text-muted-foreground",title:e.instance,children:e.instance??"\u2014"}),(0,t.jsx)(o,{children:(0,t.jsx)(b,{variant:J[e.state],children:e.state})}),(0,t.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:e.event}),(0,t.jsx)(o,{className:"max-w-64 truncate text-xs text-muted-foreground",title:e.detail,children:e.detail??"\u2014"}),(0,t.jsx)(o,{className:"font-mono text-xs tabular-nums text-muted-foreground",children:e.exitCode??"\u2014"}),(0,t.jsx)(o,{className:"text-xs tabular-nums text-muted-foreground",children:new Date(e.timestamp).toLocaleString()})]},`${e.name}/${e.instance??""}`)}v(Y,"B");export{ee as ContainersPanel};
1
+ import{a as T}from"./chunk-X2FQ6B5V.js";import{b as k}from"./chunk-BMQJ4CAO.js";import{a as D,b as E,c as O,d as C,e as i,f as o}from"./chunk-MIQTKZAR.js";import{a as I,e as $}from"./chunk-UZERI5YC.js";import{b}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as A}from"./chunk-AADXUXZO.js";import"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{a as L}from"./chunk-XQCVZAGU.js";import{d as S}from"./chunk-4CGALXS3.js";import"./chunk-AADILRJW.js";import{a as v,e as w,f as K,g as M,h as P}from"./chunk-3XIESWL4.js";var j=w(M(),1),q=w(K(),1);var t=w(P(),1);var _="container:",W={error:"error",sleep:"sleeping",start:"running",stop:"stopped"},B=v(e=>{let n=e.indexOf(":");if(n===-1)return{event:e.trim()};let r=e.slice(n+1).trim(),a=e.slice(0,n).trim();return r===""?{event:a}:{detail:r,event:a}},"j"),F=v(e=>{let n=new Map;for(let r of e){let a=r.functionPath??"";if(!a.startsWith(_))continue;let s=a.slice(_.length);if(s==="")continue;let c=JSON.stringify([s,r.instance??""]),m=n.get(c);if(m!==void 0&&m.timestamp>=r.timestamp)continue;let{detail:g,event:l}=B(r.message);n.set(c,{detail:g,event:l,exitCode:r.exitCode,instance:r.instance,level:r.level,name:s,state:W[l]??"unknown",timestamp:r.timestamp})}return[...n.values()].toSorted((r,a)=>r.name.localeCompare(a.name)||(r.instance??"").localeCompare(a.instance??""))},"K"),J={error:"destructive",running:"success",sleeping:"info",stopped:"outline",unknown:"secondary"},U=v(e=>{let{entries:n}=e??{};return Array.isArray(n)?n:[]},"W"),ee=v(()=>{let e=(0,j.c)(23),n=S(),r,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},a={live:!0,shardKey:""},e[0]=r,e[1]=a):(r=e[0],a=e[1]);let{data:s,error:c,liveError:m}=k(A.getLogs,r,a),g=s!==void 0,l;e[2]!==s?(l=F(U(s)),e[2]=s,e[3]=l):l=e[3];let N=l,d;e[4]!==c?(d=c!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"containers-error",role:"alert",children:c}),e[4]=c,e[5]=d):d=e[5];let h;e[6]!==n?(h=n("Cloudflare Containers are observed from their lifecycle log stream. This shows the current state per instance \u2014 ports and health checks aren't carried in that stream."),e[6]=n,e[7]=h):h=e[7];let p;e[8]!==h?(p=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:h}),e[8]=h,e[9]=p):p=e[9];let u;e[10]!==m?(u=(0,t.jsx)(T,{message:m,prefix:"containers"}),e[10]=m,e[11]=u):u=e[11];let f;e[12]!==p||e[13]!==u?(f=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p,u]}),e[12]=p,e[13]=u,e[14]=f):f=e[14];let x;e[15]!==g||e[16]!==N||e[17]!==n?(x=g&&N.length===0?(0,t.jsx)(L,{description:n("No container lifecycle activity yet. Instances declared with defineContainer show up here once they start, sleep, stop, or error."),testId:"containers-empty",title:n("No container activity")}):(0,t.jsx)(I,{className:"overflow-hidden py-0",children:(0,t.jsx)($,{className:"px-0",children:(0,t.jsxs)(D,{"data-testid":"containers-table",children:[(0,t.jsx)(E,{children:(0,t.jsxs)(C,{children:[(0,t.jsx)(i,{children:n("Container")}),(0,t.jsx)(i,{children:n("Instance")}),(0,t.jsx)(i,{children:n("State")}),(0,t.jsx)(i,{children:n("Last event")}),(0,t.jsx)(i,{children:n("Detail")}),(0,t.jsx)(i,{children:n("Exit")}),(0,t.jsx)(i,{children:n("When")})]})}),(0,t.jsx)(O,{children:N.map(Y)})]})})}),e[15]=g,e[16]=N,e[17]=n,e[18]=x):x=e[18];let y;return e[19]!==d||e[20]!==f||e[21]!==x?(y=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-containers-panel",children:[d,f,x]}),e[19]=d,e[20]=f,e[21]=x,e[22]=y):y=e[22],y},"Y");function Y(e){return(0,t.jsxs)(C,{"data-testid":`containers-row-${e.name}${e.instance===void 0?"":`-${e.instance}`}`,children:[(0,t.jsx)(o,{className:"font-mono text-xs",children:e.name}),(0,t.jsx)(o,{className:"max-w-40 truncate font-mono text-xs text-muted-foreground",title:e.instance,children:e.instance??"\u2014"}),(0,t.jsx)(o,{children:(0,t.jsx)(b,{variant:J[e.state],children:e.state})}),(0,t.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:e.event}),(0,t.jsx)(o,{className:"max-w-64 truncate text-xs text-muted-foreground",title:e.detail,children:e.detail??"\u2014"}),(0,t.jsx)(o,{className:"font-mono text-xs tabular-nums text-muted-foreground",children:e.exitCode??"\u2014"}),(0,t.jsx)(o,{className:"text-xs tabular-nums text-muted-foreground",children:new Date(e.timestamp).toLocaleString()})]},`${e.name}/${e.instance??""}`)}v(Y,"B");export{ee as ContainersPanel};
@@ -1 +1 @@
1
- import{a as He}from"./chunk-LEDWUPXM.js";import"./chunk-2PJNAWB3.js";import{a as Ge}from"./chunk-54MMVNPT.js";import"./chunk-BGBLQ563.js";import{a as Pe}from"./chunk-UNUU7CJJ.js";import{a as Ke}from"./chunk-XXQUMVWH.js";import{b as _e}from"./chunk-XSD4Y6SQ.js";import{a as De,b as ke,c as Be,d as G,e as w,f as C}from"./chunk-MIQTKZAR.js";import{a as Me,e as Te}from"./chunk-UZERI5YC.js";import{a as Ue}from"./chunk-V53KNYRN.js";import{R as We}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as U}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as le}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as z}from"./chunk-GXZAXNZI.js";import{f as Fe}from"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as ue}from"./chunk-XQCVZAGU.js";import{d as $,f as ie,g as ce,h as me,m as he,q as je}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as h,e as Ee,f as st,g as nt,h as rt}from"./chunk-3XIESWL4.js";var F=Ee(nt(),1);var A=Ee(st(),1);var t=Ee(rt(),1);var dt=h((n,e)=>{let a=new Set(n.map(s=>s.deadLetterQueue).filter(s=>typeof s=="string"&&s!=="")),u=n.filter(s=>(s.deadLetterQueue===void 0||s.deadLetterQueue==="")&&!a.has(s.name)),o=e.filter(s=>s.deadLettered).length;return{deadLetteredCount:o,queuesWithoutDlq:u,showReliabilityWarning:u.length>0||o>0}},"st"),ot=200,lt=ie(z.sendQueueMessage),ut=ie(z.replayQueueMessage),it=ie(z.clearQueueMessages),Ve=96,ct=h(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n)}catch{return"[unserializable]"}},"lt"),mt=h(n=>n.length>Ve?`${n.slice(0,Ve)}\u2026`:n,"ut"),ht=h(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","ct"),pt=h((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"it"),gt=h(n=>{let e=(0,F.c)(11),{loaded:a,queues:u}=n,o=$(),s;e[0]!==o?(s=o("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[0]=o,e[1]=s):s=e[1];let d;e[2]!==s?(d=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:s}),e[2]=s,e[3]=d):d=e[3];let r;e[4]!==a||e[5]!==u||e[6]!==o?(r=a&&u.length===0?(0,t.jsx)(ue,{description:o("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:o("No queues defined")}):(0,t.jsx)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Te,{className:"px-0",children:(0,t.jsxs)(De,{"data-testid":"queues-table",children:[(0,t.jsx)(ke,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(w,{children:o("Export")}),(0,t.jsx)(w,{children:o("Queue")}),(0,t.jsx)(w,{children:o("Mode")}),(0,t.jsx)(w,{children:o("Binding")}),(0,t.jsx)(w,{children:o("Dead-letter")})]})}),(0,t.jsx)(Be,{children:u.map(Nt)})]})})}),e[4]=a,e[5]=u,e[6]=o,e[7]=r):r=e[7];let p;return e[8]!==d||e[9]!==r?(p=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[d,r]}),e[8]=d,e[9]=r,e[10]=p):p=e[10],p},"mt"),ft=h(n=>{let e=(0,F.c)(67),{message:a,onReplay:u,replayingId:o}=n,s=$(),d,r,p,c,N,g,y,l,m,f;if(e[0]!==a.attempts||e[1]!==a.body||e[2]!==a.deadLettered||e[3]!==a.exportName||e[4]!==a.id||e[5]!==a.messageId||e[6]!==a.outcome||e[7]!==a.queue||e[8]!==s){let W=ct(a.body);r=G,g=`queues-message-${a.id}`;let j=a.exportName??a.queue;e[19]!==j?(y=(0,t.jsx)(C,{className:"font-mono text-xs",children:j}),e[19]=j,e[20]=y):y=e[20],e[21]!==a.messageId?(l=(0,t.jsx)(C,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:a.messageId,children:a.messageId}),e[21]=a.messageId,e[22]=l):l=e[22],e[23]!==a.attempts?(m=(0,t.jsx)(C,{className:"font-mono text-xs tabular-nums",children:a.attempts}),e[23]=a.attempts,e[24]=m):m=e[24];let M=`queues-outcome-${a.id}`,T;e[25]!==a.outcome?(T=ht(a.outcome),e[25]=a.outcome,e[26]=T):T=e[26];let Q;e[27]!==a.outcome||e[28]!==M||e[29]!==T?(Q=(0,t.jsx)(le,{"data-testid":M,variant:T,children:a.outcome}),e[27]=a.outcome,e[28]=M,e[29]=T,e[30]=Q):Q=e[30];let _;e[31]!==a.deadLettered||e[32]!==a.id||e[33]!==s?(_=a.deadLettered&&(0,t.jsx)(le,{"data-testid":`queues-dlq-${a.id}`,variant:"destructive",children:s("DLQ")}),e[31]=a.deadLettered,e[32]=a.id,e[33]=s,e[34]=_):_=e[34],e[35]!==Q||e[36]!==_?(f=(0,t.jsx)(C,{children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[Q,_]})}),e[35]=Q,e[36]=_,e[37]=f):f=e[37],d=C,p="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",c=W,N=mt(W),e[0]=a.attempts,e[1]=a.body,e[2]=a.deadLettered,e[3]=a.exportName,e[4]=a.id,e[5]=a.messageId,e[6]=a.outcome,e[7]=a.queue,e[8]=s,e[9]=d,e[10]=r,e[11]=p,e[12]=c,e[13]=N,e[14]=g,e[15]=y,e[16]=l,e[17]=m,e[18]=f}else d=e[9],r=e[10],p=e[11],c=e[12],N=e[13],g=e[14],y=e[15],l=e[16],m=e[17],f=e[18];let x;e[38]!==d||e[39]!==p||e[40]!==c||e[41]!==N?(x=(0,t.jsx)(d,{className:p,title:c,children:N}),e[38]=d,e[39]=p,e[40]=c,e[41]=N,e[42]=x):x=e[42];let q;e[43]!==a.capturedAt?(q=je(a.capturedAt,"\u2014"),e[43]=a.capturedAt,e[44]=q):q=e[44];let b;e[45]!==q?(b=(0,t.jsx)(C,{className:"text-xs text-muted-foreground tabular-nums",children:q}),e[45]=q,e[46]=b):b=e[46];let S=`queues-replay-${a.id}`,E=o!==null,I;e[47]!==a.id||e[48]!==o||e[49]!==s?(I=o===a.id?s("Replaying\u2026"):s("Replay"),e[47]=a.id,e[48]=o,e[49]=s,e[50]=I):I=e[50];let L;e[51]!==a.id||e[52]!==u||e[53]!==S||e[54]!==E||e[55]!==I?(L=(0,t.jsx)(C,{children:(0,t.jsx)(U,{"data-id":a.id,"data-testid":S,disabled:E,onClick:u,size:"xs",type:"button",variant:"outline",children:I})}),e[51]=a.id,e[52]=u,e[53]=S,e[54]=E,e[55]=I,e[56]=L):L=e[56];let D;return e[57]!==r||e[58]!==b||e[59]!==L||e[60]!==g||e[61]!==y||e[62]!==l||e[63]!==m||e[64]!==f||e[65]!==x?(D=(0,t.jsxs)(r,{"data-testid":g,children:[y,l,m,f,x,b,L]}),e[57]=r,e[58]=b,e[59]=L,e[60]=g,e[61]=y,e[62]=l,e[63]=m,e[64]=f,e[65]=x,e[66]=D):D=e[66],D},"ht"),xt=h(n=>{let e=(0,F.c)(26),{hasError:a,messages:u,onClear:o,onReplay:s,replayingId:d}=n,r=$(),p;e[0]!==r?(p=r("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=r,e[1]=p):p=e[1];let c;e[2]!==p?(c=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:p}),e[2]=p,e[3]=c):c=e[3];let N=u.length===0,g;e[4]!==r?(g=r("Clear log"),e[4]=r,e[5]=g):g=e[5];let y;e[6]!==o||e[7]!==N||e[8]!==g?(y=(0,t.jsx)(U,{className:"ml-auto","data-testid":"queues-clear",disabled:N,onClick:o,size:"sm",type:"button",variant:"outline",children:g}),e[6]=o,e[7]=N,e[8]=g,e[9]=y):y=e[9];let l;e[10]!==u.length||e[11]!==r?(l=u.length>0&&(0,t.jsx)(le,{"data-testid":"queues-count",variant:"secondary",children:r("{count} messages",{count:u.length})}),e[10]=u.length,e[11]=r,e[12]=l):l=e[12];let m;e[13]!==c||e[14]!==y||e[15]!==l?(m=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,y,l]}),e[13]=c,e[14]=y,e[15]=l,e[16]=m):m=e[16];let f;e[17]!==a||e[18]!==u||e[19]!==s||e[20]!==d||e[21]!==r?(f=!a&&u.length===0?(0,t.jsx)(ue,{description:r("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:r("No consumed messages yet.")}):(0,t.jsx)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Te,{className:"px-0",children:(0,t.jsx)(He,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxs)(De,{"data-testid":"queues-messages-table",children:[(0,t.jsx)(ke,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(w,{children:r("Export")}),(0,t.jsx)(w,{children:r("Message")}),(0,t.jsx)(w,{children:r("Attempts")}),(0,t.jsx)(w,{children:r("Outcome")}),(0,t.jsx)(w,{children:r("Body")}),(0,t.jsx)(w,{children:r("Captured")}),(0,t.jsx)(w,{})]})}),(0,t.jsx)(Be,{children:u.map(q=>(0,t.jsx)(ft,{message:q,onReplay:s,replayingId:d},q.id))})]})})})}),e[17]=a,e[18]=u,e[19]=s,e[20]=d,e[21]=r,e[22]=f):f=e[22];let x;return e[23]!==m||e[24]!==f?(x=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[m,f]}),e[23]=m,e[24]=f,e[25]=x):x=e[25],x},"pt"),yt=h(n=>{let e=(0,F.c)(20),{batchMode:a,bodyText:u,delayText:o,onBatchModeChange:s,onBodyChange:d,onDelayChange:r,onSelectExport:p,onSend:c,queues:N,selectedExportName:g,sending:y}=n,l=$(),m;e[0]!==l?(m=l("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=l,e[1]=m):m=e[1];let f;e[2]!==m?(f=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=f):f=e[3];let x;e[4]!==a||e[5]!==u||e[6]!==o||e[7]!==s||e[8]!==d||e[9]!==r||e[10]!==p||e[11]!==c||e[12]!==N||e[13]!==g||e[14]!==y||e[15]!==l?(x=N.length===0?(0,t.jsx)(ue,{description:l("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:l("No queues to send to")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("select",{"aria-label":l("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:p,value:g,children:N.map(bt)}),(0,t.jsx)(We,{"aria-label":l("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:r,placeholder:l("Delay (s)"),type:"number",value:o}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsx)("input",{checked:a,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:s,type:"checkbox"}),l("Send as batch (JSON array)")]}),(0,t.jsx)(U,{className:"ml-auto","data-testid":"queues-send-button",disabled:y||g==="",onClick:c,type:"button",children:l(y?"Sending\u2026":"Send message")})]}),(0,t.jsx)(Ue,{"aria-label":l("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:d,placeholder:a?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:u})]}),e[4]=a,e[5]=u,e[6]=o,e[7]=s,e[8]=d,e[9]=r,e[10]=p,e[11]=c,e[12]=N,e[13]=g,e[14]=y,e[15]=l,e[16]=x):x=e[16];let q;return e[17]!==f||e[18]!==x?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[f,x]}),e[17]=f,e[18]=x,e[19]=q):q=e[19],q},"gt"),Jt=h(n=>{let e=(0,F.c)(59),{limit:a}=n,u=a??ot,o=Fe(),s=$(),[d,r]=(0,A.useState)("declared"),[p,c]=(0,A.useState)(null),N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N={},e[0]=N):N=e[0];let{data:g,error:y,errorSource:l}=_e(z.listQueues,N),m;e[1]!==u?(m={limit:u},e[1]=u,e[2]=m):m=e[2];let{data:f,error:x,errorSource:q,refetch:b}=_e(z.getQueueMessages,m),S=Array.isArray(g?.queues)?[...g.queues].toSorted(qt):[],E=f?.entries??[],{deadLetteredCount:I,queuesWithoutDlq:L,showReliabilityWarning:D}=dt(S,E),[W,j]=(0,A.useState)(""),[M,T]=(0,A.useState)(""),[Q,_]=(0,A.useState)(""),[K,Xe]=(0,A.useState)(!1),[pe,Oe]=(0,A.useState)(!1),[ge,Re]=(0,A.useState)(null),H=S.some(i=>i.exportName===W)?W:S[0]?.exportName??"",Je=d==="messages"?x:y,Ye=d==="messages"?q:l,fe=Je??p,xe=Je===null?p:Ye,V;e[3]!==b?(V=h(()=>{b()},"K"),e[3]=b,e[4]=V):V=e[4],Ge(V,d==="messages");let ye=h(async()=>{c(null);let i=H;if(i==="")return;let v=null,$e=M.trim();if($e!=="")try{v=JSON.parse($e)}catch{c(s("Body must be valid JSON."));return}let Ae,ze=Q.trim();if(ze!==""){let P=Number(ze);if(!Number.isFinite(P)||P<0){c(s("Delay must be a non-negative number of seconds."));return}Ae=P}if(K&&!Array.isArray(v)){c(s("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}Oe(!0);let at=K?{batch:v,delaySeconds:Ae,exportName:i}:{body:v,delaySeconds:Ae,exportName:i};try{await o.query(lt,at,ce("")),b()}catch(P){c(me(P))}Oe(!1)},"me"),X;e[5]!==o||e[6]!==b?(X=h(async i=>{c(null),Re(i);try{await o.query(ut,{id:i},ce("")),b()}catch(v){c(me(v))}Re(null)},"H"),e[5]=o,e[6]=b,e[7]=X):X=e[7];let Ne=X,Y;e[8]!==o||e[9]!==b?(Y=h(async()=>{c(null);try{await o.query(it,{},ce("")),b()}catch(i){c(me(i))}},"V"),e[8]=o,e[9]=b,e[10]=Y):Y=e[10];let be=Y,Z;e[11]===Symbol.for("react.memo_cache_sentinel")?(Z=h(i=>{let v=i.currentTarget.dataset.tab;(v==="declared"||v==="messages"||v==="send")&&r(v)},"X"),e[11]=Z):Z=e[11];let Ze=Z,ee;e[12]===Symbol.for("react.memo_cache_sentinel")?(ee=h(i=>{j(i.currentTarget.value)},"Y"),e[12]=ee):ee=e[12];let qe=ee,te;e[13]===Symbol.for("react.memo_cache_sentinel")?(te=h(i=>{T(i.currentTarget.value)},"Z"),e[13]=te):te=e[13];let ve=te,ae;e[14]===Symbol.for("react.memo_cache_sentinel")?(ae=h(i=>{_(i.currentTarget.value)},"ee"),e[14]=ae):ae=e[14];let Se=ae,se;e[15]===Symbol.for("react.memo_cache_sentinel")?(se=h(i=>{Xe(i.currentTarget.checked)},"te"),e[15]=se):se=e[15];let we=se,ne;e[16]!==ye?(ne=h(()=>{he(ye())},"ae"),e[16]=ye,e[17]=ne):ne=e[17];let Ce=ne,re;e[18]!==Ne?(re=h(i=>{let{id:v}=i.currentTarget.dataset;v!==void 0&&he(Ne(v))},"se"),e[18]=Ne,e[19]=re):re=e[19];let Qe=re,de;e[20]!==be?(de=h(()=>{he(be())},"re"),e[20]=be,e[21]=de):de=e[21];let Ie=de,et="flex flex-col gap-6",tt="lunora-queues-panel",k;e[22]!==s||e[23]!==d?(k=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(i=>(0,t.jsx)(U,{"aria-selected":d===i,"data-tab":i,"data-testid":`queues-tab-${i}`,onClick:Ze,role:"tab",size:"sm",type:"button",variant:d===i?"secondary":"ghost",children:pt(i,s)},i))}),e[22]=s,e[23]=d,e[24]=k):k=e[24];let B;e[25]!==fe||e[26]!==xe?(B=fe!==null&&(0,t.jsx)(Pe,{error:xe,testId:"queues-error"}),e[25]=fe,e[26]=xe,e[27]=B):B=e[27];let Le=D&&(0,t.jsx)(Ke,{icon:(0,t.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[L.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"font-medium",children:s("No dead-letter queue on {queues}.",{queues:L.map(vt).join(", ")})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:s("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),I>0&&(0,t.jsx)("p",{className:L.length>0?"text-muted-foreground":"font-medium",children:I===1?s("1 message was recently dead-lettered."):s("{count} messages were recently dead-lettered.",{count:I})})]})}),O;e[28]!==S||e[29]!==g||e[30]!==d?(O=d==="declared"&&(0,t.jsx)(gt,{loaded:g!==void 0,queues:S}),e[28]=S,e[29]=g,e[30]=d,e[31]=O):O=e[31];let R;e[32]!==E||e[33]!==x||e[34]!==Ie||e[35]!==Qe||e[36]!==ge||e[37]!==d?(R=d==="messages"&&(0,t.jsx)(xt,{hasError:x!==null,messages:E,onClear:Ie,onReplay:Qe,replayingId:ge}),e[32]=E,e[33]=x,e[34]=Ie,e[35]=Qe,e[36]=ge,e[37]=d,e[38]=R):R=e[38];let J;e[39]!==K||e[40]!==M||e[41]!==Q||e[42]!==we||e[43]!==ve||e[44]!==Se||e[45]!==qe||e[46]!==Ce||e[47]!==S||e[48]!==H||e[49]!==pe||e[50]!==d?(J=d==="send"&&(0,t.jsx)(yt,{batchMode:K,bodyText:M,delayText:Q,onBatchModeChange:we,onBodyChange:ve,onDelayChange:Se,onSelectExport:qe,onSend:Ce,queues:S,selectedExportName:H,sending:pe}),e[39]=K,e[40]=M,e[41]=Q,e[42]=we,e[43]=ve,e[44]=Se,e[45]=qe,e[46]=Ce,e[47]=S,e[48]=H,e[49]=pe,e[50]=d,e[51]=J):J=e[51];let oe;return e[52]!==k||e[53]!==B||e[54]!==Le||e[55]!==O||e[56]!==R||e[57]!==J?(oe=(0,t.jsxs)("div",{className:et,"data-testid":tt,children:[k,B,Le,O,R,J]}),e[52]=k,e[53]=B,e[54]=Le,e[55]=O,e[56]=R,e[57]=J,e[58]=oe):oe=e[58],oe},"Bt");function Nt(n){return(0,t.jsxs)(G,{"data-testid":`queues-row-${n.exportName}`,children:[(0,t.jsx)(C,{className:"font-mono text-xs",children:n.exportName}),(0,t.jsx)(C,{className:"font-mono text-xs text-muted-foreground",children:n.name}),(0,t.jsx)(C,{className:"font-mono text-xs text-muted-foreground",children:n.mode}),(0,t.jsx)(C,{className:"font-mono text-xs text-muted-foreground",children:n.binding}),(0,t.jsx)(C,{className:"font-mono text-xs text-muted-foreground",children:n.deadLetterQueue??"\u2014"})]},n.exportName)}h(Nt,"ft");function bt(n){return(0,t.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}h(bt,"xt");function qt(n,e){return n.exportName.localeCompare(e.exportName)}h(qt,"yt");function vt(n){return n.name}h(vt,"Nt");export{Jt as default};
1
+ import{a as He}from"./chunk-LEDWUPXM.js";import"./chunk-2PJNAWB3.js";import{a as Ge}from"./chunk-54MMVNPT.js";import"./chunk-BGBLQ563.js";import{a as Pe}from"./chunk-HK4OVYG3.js";import{a as Ke}from"./chunk-XXQUMVWH.js";import{b as _e}from"./chunk-BMQJ4CAO.js";import{a as De,b as ke,c as Be,d as G,e as w,f as C}from"./chunk-MIQTKZAR.js";import{a as Me,e as Te}from"./chunk-UZERI5YC.js";import{a as Ue}from"./chunk-V53KNYRN.js";import{R as We}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as U}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as le}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as z}from"./chunk-AADXUXZO.js";import{f as Fe}from"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{a as ue}from"./chunk-XQCVZAGU.js";import{d as $,f as ie,g as ce,h as me,m as he,q as je}from"./chunk-4CGALXS3.js";import"./chunk-AADILRJW.js";import{a as h,e as Ee,f as st,g as nt,h as rt}from"./chunk-3XIESWL4.js";var F=Ee(nt(),1);var A=Ee(st(),1);var t=Ee(rt(),1);var dt=h((n,e)=>{let a=new Set(n.map(s=>s.deadLetterQueue).filter(s=>typeof s=="string"&&s!=="")),u=n.filter(s=>(s.deadLetterQueue===void 0||s.deadLetterQueue==="")&&!a.has(s.name)),o=e.filter(s=>s.deadLettered).length;return{deadLetteredCount:o,queuesWithoutDlq:u,showReliabilityWarning:u.length>0||o>0}},"st"),ot=200,lt=ie(z.sendQueueMessage),ut=ie(z.replayQueueMessage),it=ie(z.clearQueueMessages),Ve=96,ct=h(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n)}catch{return"[unserializable]"}},"lt"),mt=h(n=>n.length>Ve?`${n.slice(0,Ve)}\u2026`:n,"ut"),ht=h(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","ct"),pt=h((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"it"),gt=h(n=>{let e=(0,F.c)(11),{loaded:a,queues:u}=n,o=$(),s;e[0]!==o?(s=o("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[0]=o,e[1]=s):s=e[1];let d;e[2]!==s?(d=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:s}),e[2]=s,e[3]=d):d=e[3];let r;e[4]!==a||e[5]!==u||e[6]!==o?(r=a&&u.length===0?(0,t.jsx)(ue,{description:o("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:o("No queues defined")}):(0,t.jsx)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Te,{className:"px-0",children:(0,t.jsxs)(De,{"data-testid":"queues-table",children:[(0,t.jsx)(ke,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(w,{children:o("Export")}),(0,t.jsx)(w,{children:o("Queue")}),(0,t.jsx)(w,{children:o("Mode")}),(0,t.jsx)(w,{children:o("Binding")}),(0,t.jsx)(w,{children:o("Dead-letter")})]})}),(0,t.jsx)(Be,{children:u.map(Nt)})]})})}),e[4]=a,e[5]=u,e[6]=o,e[7]=r):r=e[7];let p;return e[8]!==d||e[9]!==r?(p=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[d,r]}),e[8]=d,e[9]=r,e[10]=p):p=e[10],p},"mt"),ft=h(n=>{let e=(0,F.c)(67),{message:a,onReplay:u,replayingId:o}=n,s=$(),d,r,p,c,N,g,y,l,m,f;if(e[0]!==a.attempts||e[1]!==a.body||e[2]!==a.deadLettered||e[3]!==a.exportName||e[4]!==a.id||e[5]!==a.messageId||e[6]!==a.outcome||e[7]!==a.queue||e[8]!==s){let W=ct(a.body);r=G,g=`queues-message-${a.id}`;let j=a.exportName??a.queue;e[19]!==j?(y=(0,t.jsx)(C,{className:"font-mono text-xs",children:j}),e[19]=j,e[20]=y):y=e[20],e[21]!==a.messageId?(l=(0,t.jsx)(C,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:a.messageId,children:a.messageId}),e[21]=a.messageId,e[22]=l):l=e[22],e[23]!==a.attempts?(m=(0,t.jsx)(C,{className:"font-mono text-xs tabular-nums",children:a.attempts}),e[23]=a.attempts,e[24]=m):m=e[24];let M=`queues-outcome-${a.id}`,T;e[25]!==a.outcome?(T=ht(a.outcome),e[25]=a.outcome,e[26]=T):T=e[26];let Q;e[27]!==a.outcome||e[28]!==M||e[29]!==T?(Q=(0,t.jsx)(le,{"data-testid":M,variant:T,children:a.outcome}),e[27]=a.outcome,e[28]=M,e[29]=T,e[30]=Q):Q=e[30];let _;e[31]!==a.deadLettered||e[32]!==a.id||e[33]!==s?(_=a.deadLettered&&(0,t.jsx)(le,{"data-testid":`queues-dlq-${a.id}`,variant:"destructive",children:s("DLQ")}),e[31]=a.deadLettered,e[32]=a.id,e[33]=s,e[34]=_):_=e[34],e[35]!==Q||e[36]!==_?(f=(0,t.jsx)(C,{children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[Q,_]})}),e[35]=Q,e[36]=_,e[37]=f):f=e[37],d=C,p="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",c=W,N=mt(W),e[0]=a.attempts,e[1]=a.body,e[2]=a.deadLettered,e[3]=a.exportName,e[4]=a.id,e[5]=a.messageId,e[6]=a.outcome,e[7]=a.queue,e[8]=s,e[9]=d,e[10]=r,e[11]=p,e[12]=c,e[13]=N,e[14]=g,e[15]=y,e[16]=l,e[17]=m,e[18]=f}else d=e[9],r=e[10],p=e[11],c=e[12],N=e[13],g=e[14],y=e[15],l=e[16],m=e[17],f=e[18];let x;e[38]!==d||e[39]!==p||e[40]!==c||e[41]!==N?(x=(0,t.jsx)(d,{className:p,title:c,children:N}),e[38]=d,e[39]=p,e[40]=c,e[41]=N,e[42]=x):x=e[42];let q;e[43]!==a.capturedAt?(q=je(a.capturedAt,"\u2014"),e[43]=a.capturedAt,e[44]=q):q=e[44];let b;e[45]!==q?(b=(0,t.jsx)(C,{className:"text-xs text-muted-foreground tabular-nums",children:q}),e[45]=q,e[46]=b):b=e[46];let S=`queues-replay-${a.id}`,E=o!==null,I;e[47]!==a.id||e[48]!==o||e[49]!==s?(I=o===a.id?s("Replaying\u2026"):s("Replay"),e[47]=a.id,e[48]=o,e[49]=s,e[50]=I):I=e[50];let L;e[51]!==a.id||e[52]!==u||e[53]!==S||e[54]!==E||e[55]!==I?(L=(0,t.jsx)(C,{children:(0,t.jsx)(U,{"data-id":a.id,"data-testid":S,disabled:E,onClick:u,size:"xs",type:"button",variant:"outline",children:I})}),e[51]=a.id,e[52]=u,e[53]=S,e[54]=E,e[55]=I,e[56]=L):L=e[56];let D;return e[57]!==r||e[58]!==b||e[59]!==L||e[60]!==g||e[61]!==y||e[62]!==l||e[63]!==m||e[64]!==f||e[65]!==x?(D=(0,t.jsxs)(r,{"data-testid":g,children:[y,l,m,f,x,b,L]}),e[57]=r,e[58]=b,e[59]=L,e[60]=g,e[61]=y,e[62]=l,e[63]=m,e[64]=f,e[65]=x,e[66]=D):D=e[66],D},"ht"),xt=h(n=>{let e=(0,F.c)(26),{hasError:a,messages:u,onClear:o,onReplay:s,replayingId:d}=n,r=$(),p;e[0]!==r?(p=r("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=r,e[1]=p):p=e[1];let c;e[2]!==p?(c=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:p}),e[2]=p,e[3]=c):c=e[3];let N=u.length===0,g;e[4]!==r?(g=r("Clear log"),e[4]=r,e[5]=g):g=e[5];let y;e[6]!==o||e[7]!==N||e[8]!==g?(y=(0,t.jsx)(U,{className:"ml-auto","data-testid":"queues-clear",disabled:N,onClick:o,size:"sm",type:"button",variant:"outline",children:g}),e[6]=o,e[7]=N,e[8]=g,e[9]=y):y=e[9];let l;e[10]!==u.length||e[11]!==r?(l=u.length>0&&(0,t.jsx)(le,{"data-testid":"queues-count",variant:"secondary",children:r("{count} messages",{count:u.length})}),e[10]=u.length,e[11]=r,e[12]=l):l=e[12];let m;e[13]!==c||e[14]!==y||e[15]!==l?(m=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,y,l]}),e[13]=c,e[14]=y,e[15]=l,e[16]=m):m=e[16];let f;e[17]!==a||e[18]!==u||e[19]!==s||e[20]!==d||e[21]!==r?(f=!a&&u.length===0?(0,t.jsx)(ue,{description:r("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:r("No consumed messages yet.")}):(0,t.jsx)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Te,{className:"px-0",children:(0,t.jsx)(He,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxs)(De,{"data-testid":"queues-messages-table",children:[(0,t.jsx)(ke,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(w,{children:r("Export")}),(0,t.jsx)(w,{children:r("Message")}),(0,t.jsx)(w,{children:r("Attempts")}),(0,t.jsx)(w,{children:r("Outcome")}),(0,t.jsx)(w,{children:r("Body")}),(0,t.jsx)(w,{children:r("Captured")}),(0,t.jsx)(w,{})]})}),(0,t.jsx)(Be,{children:u.map(q=>(0,t.jsx)(ft,{message:q,onReplay:s,replayingId:d},q.id))})]})})})}),e[17]=a,e[18]=u,e[19]=s,e[20]=d,e[21]=r,e[22]=f):f=e[22];let x;return e[23]!==m||e[24]!==f?(x=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[m,f]}),e[23]=m,e[24]=f,e[25]=x):x=e[25],x},"pt"),yt=h(n=>{let e=(0,F.c)(20),{batchMode:a,bodyText:u,delayText:o,onBatchModeChange:s,onBodyChange:d,onDelayChange:r,onSelectExport:p,onSend:c,queues:N,selectedExportName:g,sending:y}=n,l=$(),m;e[0]!==l?(m=l("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=l,e[1]=m):m=e[1];let f;e[2]!==m?(f=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=f):f=e[3];let x;e[4]!==a||e[5]!==u||e[6]!==o||e[7]!==s||e[8]!==d||e[9]!==r||e[10]!==p||e[11]!==c||e[12]!==N||e[13]!==g||e[14]!==y||e[15]!==l?(x=N.length===0?(0,t.jsx)(ue,{description:l("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:l("No queues to send to")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("select",{"aria-label":l("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:p,value:g,children:N.map(bt)}),(0,t.jsx)(We,{"aria-label":l("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:r,placeholder:l("Delay (s)"),type:"number",value:o}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsx)("input",{checked:a,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:s,type:"checkbox"}),l("Send as batch (JSON array)")]}),(0,t.jsx)(U,{className:"ml-auto","data-testid":"queues-send-button",disabled:y||g==="",onClick:c,type:"button",children:l(y?"Sending\u2026":"Send message")})]}),(0,t.jsx)(Ue,{"aria-label":l("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:d,placeholder:a?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:u})]}),e[4]=a,e[5]=u,e[6]=o,e[7]=s,e[8]=d,e[9]=r,e[10]=p,e[11]=c,e[12]=N,e[13]=g,e[14]=y,e[15]=l,e[16]=x):x=e[16];let q;return e[17]!==f||e[18]!==x?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[f,x]}),e[17]=f,e[18]=x,e[19]=q):q=e[19],q},"gt"),Jt=h(n=>{let e=(0,F.c)(59),{limit:a}=n,u=a??ot,o=Fe(),s=$(),[d,r]=(0,A.useState)("declared"),[p,c]=(0,A.useState)(null),N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N={},e[0]=N):N=e[0];let{data:g,error:y,errorSource:l}=_e(z.listQueues,N),m;e[1]!==u?(m={limit:u},e[1]=u,e[2]=m):m=e[2];let{data:f,error:x,errorSource:q,refetch:b}=_e(z.getQueueMessages,m),S=Array.isArray(g?.queues)?[...g.queues].toSorted(qt):[],E=f?.entries??[],{deadLetteredCount:I,queuesWithoutDlq:L,showReliabilityWarning:D}=dt(S,E),[W,j]=(0,A.useState)(""),[M,T]=(0,A.useState)(""),[Q,_]=(0,A.useState)(""),[K,Xe]=(0,A.useState)(!1),[pe,Oe]=(0,A.useState)(!1),[ge,Re]=(0,A.useState)(null),H=S.some(i=>i.exportName===W)?W:S[0]?.exportName??"",Je=d==="messages"?x:y,Ye=d==="messages"?q:l,fe=Je??p,xe=Je===null?p:Ye,V;e[3]!==b?(V=h(()=>{b()},"K"),e[3]=b,e[4]=V):V=e[4],Ge(V,d==="messages");let ye=h(async()=>{c(null);let i=H;if(i==="")return;let v=null,$e=M.trim();if($e!=="")try{v=JSON.parse($e)}catch{c(s("Body must be valid JSON."));return}let Ae,ze=Q.trim();if(ze!==""){let P=Number(ze);if(!Number.isFinite(P)||P<0){c(s("Delay must be a non-negative number of seconds."));return}Ae=P}if(K&&!Array.isArray(v)){c(s("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}Oe(!0);let at=K?{batch:v,delaySeconds:Ae,exportName:i}:{body:v,delaySeconds:Ae,exportName:i};try{await o.query(lt,at,ce("")),b()}catch(P){c(me(P))}Oe(!1)},"me"),X;e[5]!==o||e[6]!==b?(X=h(async i=>{c(null),Re(i);try{await o.query(ut,{id:i},ce("")),b()}catch(v){c(me(v))}Re(null)},"H"),e[5]=o,e[6]=b,e[7]=X):X=e[7];let Ne=X,Y;e[8]!==o||e[9]!==b?(Y=h(async()=>{c(null);try{await o.query(it,{},ce("")),b()}catch(i){c(me(i))}},"V"),e[8]=o,e[9]=b,e[10]=Y):Y=e[10];let be=Y,Z;e[11]===Symbol.for("react.memo_cache_sentinel")?(Z=h(i=>{let v=i.currentTarget.dataset.tab;(v==="declared"||v==="messages"||v==="send")&&r(v)},"X"),e[11]=Z):Z=e[11];let Ze=Z,ee;e[12]===Symbol.for("react.memo_cache_sentinel")?(ee=h(i=>{j(i.currentTarget.value)},"Y"),e[12]=ee):ee=e[12];let qe=ee,te;e[13]===Symbol.for("react.memo_cache_sentinel")?(te=h(i=>{T(i.currentTarget.value)},"Z"),e[13]=te):te=e[13];let ve=te,ae;e[14]===Symbol.for("react.memo_cache_sentinel")?(ae=h(i=>{_(i.currentTarget.value)},"ee"),e[14]=ae):ae=e[14];let Se=ae,se;e[15]===Symbol.for("react.memo_cache_sentinel")?(se=h(i=>{Xe(i.currentTarget.checked)},"te"),e[15]=se):se=e[15];let we=se,ne;e[16]!==ye?(ne=h(()=>{he(ye())},"ae"),e[16]=ye,e[17]=ne):ne=e[17];let Ce=ne,re;e[18]!==Ne?(re=h(i=>{let{id:v}=i.currentTarget.dataset;v!==void 0&&he(Ne(v))},"se"),e[18]=Ne,e[19]=re):re=e[19];let Qe=re,de;e[20]!==be?(de=h(()=>{he(be())},"re"),e[20]=be,e[21]=de):de=e[21];let Ie=de,et="flex flex-col gap-6",tt="lunora-queues-panel",k;e[22]!==s||e[23]!==d?(k=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(i=>(0,t.jsx)(U,{"aria-selected":d===i,"data-tab":i,"data-testid":`queues-tab-${i}`,onClick:Ze,role:"tab",size:"sm",type:"button",variant:d===i?"secondary":"ghost",children:pt(i,s)},i))}),e[22]=s,e[23]=d,e[24]=k):k=e[24];let B;e[25]!==fe||e[26]!==xe?(B=fe!==null&&(0,t.jsx)(Pe,{error:xe,testId:"queues-error"}),e[25]=fe,e[26]=xe,e[27]=B):B=e[27];let Le=D&&(0,t.jsx)(Ke,{icon:(0,t.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[L.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"font-medium",children:s("No dead-letter queue on {queues}.",{queues:L.map(vt).join(", ")})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:s("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),I>0&&(0,t.jsx)("p",{className:L.length>0?"text-muted-foreground":"font-medium",children:I===1?s("1 message was recently dead-lettered."):s("{count} messages were recently dead-lettered.",{count:I})})]})}),O;e[28]!==S||e[29]!==g||e[30]!==d?(O=d==="declared"&&(0,t.jsx)(gt,{loaded:g!==void 0,queues:S}),e[28]=S,e[29]=g,e[30]=d,e[31]=O):O=e[31];let R;e[32]!==E||e[33]!==x||e[34]!==Ie||e[35]!==Qe||e[36]!==ge||e[37]!==d?(R=d==="messages"&&(0,t.jsx)(xt,{hasError:x!==null,messages:E,onClear:Ie,onReplay:Qe,replayingId:ge}),e[32]=E,e[33]=x,e[34]=Ie,e[35]=Qe,e[36]=ge,e[37]=d,e[38]=R):R=e[38];let J;e[39]!==K||e[40]!==M||e[41]!==Q||e[42]!==we||e[43]!==ve||e[44]!==Se||e[45]!==qe||e[46]!==Ce||e[47]!==S||e[48]!==H||e[49]!==pe||e[50]!==d?(J=d==="send"&&(0,t.jsx)(yt,{batchMode:K,bodyText:M,delayText:Q,onBatchModeChange:we,onBodyChange:ve,onDelayChange:Se,onSelectExport:qe,onSend:Ce,queues:S,selectedExportName:H,sending:pe}),e[39]=K,e[40]=M,e[41]=Q,e[42]=we,e[43]=ve,e[44]=Se,e[45]=qe,e[46]=Ce,e[47]=S,e[48]=H,e[49]=pe,e[50]=d,e[51]=J):J=e[51];let oe;return e[52]!==k||e[53]!==B||e[54]!==Le||e[55]!==O||e[56]!==R||e[57]!==J?(oe=(0,t.jsxs)("div",{className:et,"data-testid":tt,children:[k,B,Le,O,R,J]}),e[52]=k,e[53]=B,e[54]=Le,e[55]=O,e[56]=R,e[57]=J,e[58]=oe):oe=e[58],oe},"Bt");function Nt(n){return(0,t.jsxs)(G,{"data-testid":`queues-row-${n.exportName}`,children:[(0,t.jsx)(C,{className:"font-mono text-xs",children:n.exportName}),(0,t.jsx)(C,{className:"font-mono text-xs text-muted-foreground",children:n.name}),(0,t.jsx)(C,{className:"font-mono text-xs text-muted-foreground",children:n.mode}),(0,t.jsx)(C,{className:"font-mono text-xs text-muted-foreground",children:n.binding}),(0,t.jsx)(C,{className:"font-mono text-xs text-muted-foreground",children:n.deadLetterQueue??"\u2014"})]},n.exportName)}h(Nt,"ft");function bt(n){return(0,t.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}h(bt,"xt");function qt(n,e){return n.exportName.localeCompare(e.exportName)}h(qt,"yt");function vt(n){return n.name}h(vt,"Nt");export{Jt as default};
@@ -0,0 +1,14 @@
1
+ import{a as o}from"./chunk-3XIESWL4.js";var n="https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/",s="https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-1xxx-errors/",l={BAD_REQUEST:{status:400,title:"Bad request"},UNAUTHORIZED:{status:401,title:"Unauthorized"},FORBIDDEN:{status:403,title:"Forbidden"},NOT_FOUND:{status:404,title:"Not found"},CONFLICT:{hint:["Another write changed this row while your mutation was running (optimistic concurrency conflict).","","Re-read the row and retry the mutation with the fresh value. Lunora serializes a DO's mutations, so a persistent conflict usually means the handler conflicts **with itself** (e.g. a trigger or cascade touching the same row) \u2014 split that work rather than adding a retry loop."],status:409,title:"Conflict"},NOT_UNIQUE:{hint:["`.unique()` matched more than one document \u2014 it expects the query to identify at most one row.","","- If several matches are legitimate, use `.first()` (take one) or `.collect()` (take all) instead.","- Otherwise tighten the query (e.g. filter on a unique/indexed field) so it can only match one row."],status:400,title:"Query matched more than one document"},VALIDATION_ERROR:{status:400,title:"Validation failed"},TOO_MANY_REQUESTS:{status:429,title:"Too many requests"},UNPROCESSABLE:{status:422,title:"Unprocessable"},NOT_IMPLEMENTED:{status:501,title:"Not implemented"},FUNCTION_NOT_FOUND:{status:404,title:"Function not found"},METHOD_NOT_ALLOWED:{status:405,title:"Method not allowed"},PAYLOAD_TOO_LARGE:{status:413,title:"Payload too large"},INTERNAL:{internal:!0,status:500,title:"Internal error"},INTERNAL_SERVER_ERROR:{internal:!0,status:500,title:"Internal error"},RPC_FAILED:{internal:!0,status:500,title:"Internal error"},COUNT_RLS_UNSUPPORTED:{status:422,title:"count() is unsupported under an RLS policy"},MASK_UNSUPPORTED:{status:422,title:"Aggregation over a masked column is unsupported"},RELATION_PREDICATE_UNSUPPORTED:{status:422,title:"Relation predicate is unsupported in a write policy"},RLS_REQUIRED:{hint:["This table is secure-by-default: it has no `.public()` marker and no RLS policy resolved for the caller, so the read fails closed.","","Add a read policy with `.rls(...)`, or mark the table `.public()` if it is intentionally world-readable."],status:403,title:"RLS policy required"},RUN_DEPTH_EXCEEDED:{internal:!0,status:500,title:"Run depth exceeded"},MIGRATION_NOT_FOUND:{status:404,title:"Data migration not found"},UNKNOWN_TABLE:{status:404,title:"Unknown table"},GLOBAL_TABLE_NOT_EDITABLE:{status:400,title:"Global table is not editable"},SHARD_ERROR:{status:503,title:"Shard error"},SHARD_UNAVAILABLE:{status:503,title:"Shard unavailable"},OFFLINE_IDENTITY_CHANGED:{status:409,title:"Offline identity changed"},CODEGEN_DIAGNOSTIC:{status:500,title:"Codegen diagnostic"},SCHEMA_SNAPSHOT_PARSE:{status:500,title:"Schema snapshot parse error"},ENV_INVALID:{internal:!0,status:500,title:"Invalid environment"},AUTH_HEADERS_MISSING:{internal:!0,status:500,title:"Auth headers missing"},EMAIL_DOMAIN_BLOCKED:{hint:["This address's domain is on the disposable/throwaway blocklist (or your configured deny-list).","","Sign up with a permanent mailbox. To tune the policy, pass `blockDisposable` / `allowDomains` / `denyDomains` to `emailGate(...)` (`@lunora/auth/email-guard`)."],status:400,title:"Email domain not allowed"},EMAIL_UNDELIVERABLE:{hint:["The address's domain publishes no MX (or fallback A/AAAA) records, so it can't receive mail.","","Check for a typo in the domain. MX verification is opt-in (`mx: true`) and needs DNS \u2014 leave it off on the edge path if DNS is unavailable."],status:400,title:"Email domain cannot receive mail"},ANALYTICS_SQL_ERROR:{status:502,title:"Analytics Engine SQL API error"},R2_SQL_ERROR:{status:502,title:"R2 SQL API error"},WORKFLOWS_REST_ERROR:{status:502,title:"Cloudflare Workflows REST API error"}},f=o(e=>Object.hasOwn(l,e)?l[e]:void 0,"h");var m=[{body:["Lunora codegen couldn't find a schema to generate from.","","Create `lunora/schema.ts` exporting a `defineSchema(...)` call:","","```ts",'import { defineSchema, defineTable, v } from "@lunora/server";',"","export default defineSchema({"," messages: defineTable({ body: v.string() }),","});","```","","Or run `lunora init` to scaffold Lunora (a sample `lunora/schema.ts` included) into your app."].join(`
2
+ `),header:"No Lunora schema found",id:"lunora-schema-missing",test:o(e=>e.includes("defineSchema() not found")||e.includes("schema.ts not found at"),"test")},{body:["`defineSchema(...)` must be called with an **inline object literal** mapping table names to `defineTable(...)`:","","```ts","export default defineSchema({"," todos: defineTable({ title: v.string(), done: v.boolean() }),","});","```","","Codegen reads the schema statically, so it can't follow a variable or a spread \u2014 pass the object literal directly."].join(`
3
+ `),header:"`defineSchema()` needs an inline object literal",id:"lunora-schema-not-object-literal",test:o(e=>e.includes("defineSchema() expects an object literal"),"test")},{body:["This table name collides with a built-in `ctx.db` member, so the generated client can't expose it.","","Rename the table to anything that isn't a reserved name (the error lists them) \u2014 e.g. `userAccounts` instead of `insert`."].join(`
4
+ `),header:"Table name is reserved",id:"lunora-table-reserved",test:o(e=>e.includes("is reserved")&&e.includes("ctx.db"),"test")},{body:["Two tables resolve to the same name \u2014 usually a base table and a schema **extension** both defining it.","","Rename one of them, or drop the duplicate from the extension. Each table name must be unique across `defineSchema(...)` and every `.extend(...)`."].join(`
5
+ `),header:"Duplicate table name",id:"lunora-table-duplicate",test:o(e=>e.includes("already exists")&&e.includes(".extend("),"test")},{body:['`.jurisdiction(...)` accepts only a **string literal** of `"eu"`, `"us"`, or `"fedramp"`:',"","```ts",'defineSchema({ /* \u2026 */ }).jurisdiction("eu");',"```"].join(`
6
+ `),header:"Invalid `.jurisdiction(...)` value",id:"lunora-jurisdiction",test:o(e=>e.includes("unknown jurisdiction")||e.includes("jurisdiction")&&e.includes('"eu", "us", or "fedramp"'),"test")},{body:["The `unique` flag on an index must be a **literal** `true` or `false`, not a computed value \u2014 codegen needs to read it statically:","","```ts",'defineTable({ email: v.string() }).index("by_email", ["email"], { unique: true });',"```"].join(`
7
+ `),header:"`unique` must be a literal",id:"lunora-unique-literal",test:o(e=>e.includes("must be a literal")&&e.includes("unique"),"test")},{body:["A declared container/workflow class isn't re-exported by your worker entry, so `wrangler deploy` would reject it.","","Add the generated re-export shown in the error to your worker entry (e.g. `src/index.ts`):","","```ts",'export * from "./lunora/_generated/containers";',"```"].join(`
8
+ `),header:"Binding not exported by your worker entry",id:"lunora-worker-entry-export-gap",test:o(e=>e.includes("not exported by your worker entry"),"test")},{body:["A row with the same value already exists in a `unique` index.","","- If you meant to upsert, use `ctx.db.<table>().upsert(...)` (or `.patch(...)` an existing row) instead of `.insert(...)`.",`- Otherwise pick a value that isn't already taken, and consider surfacing a friendly "already exists" message to the user.`].join(`
9
+ `),header:"Unique constraint violation",id:"lunora-runtime-unique",test:o(e=>e.includes("unique constraint violation on"),"test")},{body:l.CONFLICT.hint.join(`
10
+ `),header:"Optimistic concurrency conflict",id:"lunora-runtime-occ",test:o(e=>e.includes("optimistic concurrency conflict"),"test")}],d=[{causes:"the origin returned an empty, unknown, or malformed response Cloudflare couldn't interpret (often an origin crash or an oversized response header)",code:"520",docsUrl:n,family:"5xx",fix:"check your origin's logs for a crash, ensure it returns a valid HTTP response, and keep response headers under the size limit",summary:"Cloudflare got an unknown/empty response from your origin web server.",title:"Web server returns an unknown error"},{causes:"the origin refused the connection \u2014 the web server is down, or a firewall is blocking Cloudflare's IP ranges",code:"521",docsUrl:n,family:"5xx",fix:"confirm the origin process is running and allowlist Cloudflare's published IP ranges in your firewall/security groups",summary:"Cloudflare could not connect to your origin because it refused the connection.",title:"Web server is down"},{causes:"Cloudflare could not establish a TCP connection to the origin in time \u2014 the origin is overloaded, a firewall is dropping packets, or the origin IP is wrong",code:"522",docsUrl:n,family:"5xx",fix:"verify the origin is reachable and not overloaded, and that the DNS record points at the correct origin IP",summary:"The connection to your origin timed out before it was established.",title:"Connection timed out"},{causes:"Cloudflare cannot route to the origin at all \u2014 a bad DNS record, an origin IP that changed, or invalid routing",code:"523",docsUrl:n,family:"5xx",fix:"verify the DNS A/AAAA record points at a reachable origin IP and that no upstream network is blocking Cloudflare",summary:"Cloudflare could not reach your origin server.",title:"Origin is unreachable"},{causes:"Cloudflare made a TCP connection but the origin did not return an HTTP response within 100 seconds \u2014 a slow handler or long-running request",code:"524",docsUrl:n,family:"5xx",fix:"speed up the slow origin handler, or move long work off the request path into a background job (a Durable Object, Queue, or Workflow)",summary:"Cloudflare connected to your origin but it did not respond in time.",title:"A timeout occurred"},{causes:"the TLS handshake between Cloudflare and the origin failed \u2014 a missing/invalid origin certificate, or a cipher/SNI mismatch under Full (Strict) SSL",code:"525",docsUrl:n,family:"5xx",fix:"install a valid certificate on the origin and align your Cloudflare SSL/TLS mode with the origin's certificate setup",summary:"The SSL handshake with your origin failed.",title:"SSL handshake failed"},{causes:"Cloudflare could not validate the origin's certificate under Full (Strict) SSL \u2014 it is expired, self-signed, or issued for the wrong hostname",code:"526",docsUrl:n,family:"5xx",fix:"install a valid, publicly-trusted certificate on the origin (or use a Cloudflare Origin CA cert), matching the request hostname",summary:"Cloudflare could not validate your origin's SSL certificate.",title:"Invalid SSL certificate"},{causes:"a DNS record points at a Cloudflare IP or another prohibited address instead of your real origin",code:"1000",docsUrl:s,family:"1xxx",fix:"point the DNS record at your real origin IP, not a Cloudflare-owned or loopback address",summary:"DNS points to a prohibited IP.",title:"DNS points to prohibited IP"},{causes:"Cloudflare could not resolve the requested hostname \u2014 a Worker fetched an unresolvable host, or a DNS record is misconfigured",code:"1001",docsUrl:s,family:"1xxx",fix:"check the hostname you're requesting and the DNS records for the zone resolve to a valid origin",summary:"Cloudflare could not resolve the origin DNS.",title:"DNS resolution error"},{causes:"a Worker or DNS record targets a restricted IP (for example a Cloudflare-owned or loopback address)",code:"1002",docsUrl:s,family:"1xxx",fix:"change the Worker fetch target or DNS record to a valid, non-restricted origin address",summary:"DNS points to a prohibited IP (Worker/restricted).",title:"DNS points to a prohibited IP"},{causes:"the visitor's IP was blocked by an IP Access Rule, WAF rule, or security configuration on the zone",code:"1006",docsUrl:s,family:"1xxx",fix:"review the zone's Firewall/WAF and IP Access Rules to see why the address was banned, and adjust if it was blocked in error",summary:"Access denied: the visitor's IP has been banned.",title:"Access denied: your IP has been banned"},{causes:"your Worker threw an unhandled JavaScript exception during the request",code:"1101",docsUrl:s,family:"1xxx",fix:"reproduce with `wrangler tail` (or the Workers Logs / Studio Logs panel) to get the stack trace, then handle the throwing code path",summary:"A Worker threw a JavaScript exception.",title:"Worker threw a JavaScript exception"},{causes:"the Worker used more CPU time than a single invocation is allowed \u2014 usually a hot loop or heavy synchronous work",code:"1102",docsUrl:s,family:"1xxx",fix:"reduce per-request CPU (optimize hot loops, avoid heavy synchronous work) or offload the heavy work to a Durable Object, Queue, or Workflow",summary:"A Worker exceeded its CPU-time resource limit.",title:"Worker exceeded resource limits"}],u=o(e=>e!==void 0&&e>="0"&&e<="9","l"),g=o((e,t)=>{for(let i=e.indexOf(t);i!==-1;i=e.indexOf(t,i+t.length))if(!u(e[i-1])&&!u(e[i+t.length]))return!0;return!1},"m"),b=o((e,t)=>{for(let i of[`error ${t}`,`error: ${t}`])for(let r=e.indexOf(i);r!==-1;r=e.indexOf(i,r+i.length))if(!u(e[r+i.length]))return!0;return!1},"p"),S=/error|cloudflare/iu,h=o(e=>({body:[e.summary,"",`**Likely cause:** ${e.causes}.`,"",`**Fix:** ${e.fix}.`,"",`See [Cloudflare's ${e.family} error docs](${e.docsUrl}).`].join(`
11
+ `),header:`Cloudflare Error ${e.code}: ${e.title}`,id:`cloudflare-error-${e.code}`}),"c"),p=o(e=>{if(!S.test(e))return;let t=e.toLowerCase(),i=t.includes("error"),r=t.includes("cloudflare");if(i){for(let a of d)if(b(t,a.code))return h(a)}if(r){for(let a of d)if(g(t,a.code))return h(a)}},"g"),x=o(e=>(typeof e=="string"?e:e.join(`
12
+ `)).split(`
13
+ `).filter(t=>!t.startsWith("```")).join(`
14
+ `).replaceAll(/\*\*(.+?)\*\*/gu,"$1").replaceAll(/`([^`]+)`/gu,"$1"),"S"),y=o(e=>{for(let t of m)if(t.test(e))return{body:t.body,header:t.header,id:t.id}},"d"),E=o(e=>y(e)??p(e),"x");var c=class extends Error{static{o(this,"c")}type="VisulimaError";hint;title;loc;code;status;docsUrl;data;constructor(t,i,r={}){let a=f(t);super(i??t,r.cause===void 0?void 0:{cause:r.cause}),this.name=r.name??"LunoraError",this.hint=r.hint??a?.hint,this.title=r.title??a?.title,this.loc=r.location,this.code=t,this.status=r.status??a?.status??500,this.docsUrl=r.docsUrl??a?.docsUrl,this.data=r.data}};export{x as a,E as b,c};
@@ -0,0 +1 @@
1
+ var _={assignIssue:"__lunora_admin__:assignIssue",clearCapturedMail:"__lunora_admin__:clearCapturedMail",clearQueueMessages:"__lunora_admin__:clearQueueMessages",clearTable:"__lunora_admin__:clearTable",createWorkflowInstance:"__lunora_admin__:createWorkflowInstance",deleteRows:"__lunora_admin__:deleteRows",describeTable:"__lunora_admin__:describeTable",describeTables:"__lunora_admin__:describeTables",explainIssue:"__lunora_admin__:explainIssue",exportShard:"__lunora_admin__:exportShard",facetColumn:"__lunora_admin__:facetColumn",getAdvisories:"__lunora_admin__:getAdvisories",getAuditLog:"__lunora_admin__:getAuditLog",getAuthAuditLog:"__lunora_admin__:getAuthAuditLog",getAuthMetrics:"__lunora_admin__:getAuthMetrics",getCapturedMail:"__lunora_admin__:getCapturedMail",getFanoutMetrics:"__lunora_admin__:getFanoutMetrics",getFunctionStats:"__lunora_admin__:getFunctionStats",getIssues:"__lunora_admin__:getIssues",listFlags:"__lunora_admin__:listFlags",listPushSubscriptions:"__lunora_admin__:listPushSubscriptions",listQueues:"__lunora_admin__:listQueues",listSubscriptions:"__lunora_admin__:listSubscriptions",listTableIndexes:"__lunora_admin__:listTableIndexes",listWorkflows:"__lunora_admin__:listWorkflows",getLogs:"__lunora_admin__:getLogs",getMetricHistory:"__lunora_admin__:getMetricHistory",getMetricSeries:"__lunora_admin__:getMetricSeries",getMetrics:"__lunora_admin__:getMetrics",getPitrBookmark:"__lunora_admin__:getPitrBookmark",getQueueMessages:"__lunora_admin__:getQueueMessages",getRequestLog:"__lunora_admin__:getRequestLog",getSecurityAudit:"__lunora_admin__:getSecurityAudit",getSettings:"__lunora_admin__:getSettings",getTraces:"__lunora_admin__:getTraces",getWorkflowInstanceStatus:"__lunora_admin__:getWorkflowInstanceStatus",ignoreIssue:"__lunora_admin__:ignoreIssue",importShard:"__lunora_admin__:importShard",listTables:"__lunora_admin__:listTables",maskPolicies:"__lunora_admin__:maskPolicies",migrationStatus:"__lunora_admin__:migrationStatus",pitrRestore:"__lunora_admin__:pitrRestore",readTablePage:"__lunora_admin__:readTablePage",replayQueueMessage:"__lunora_admin__:replayQueueMessage",resolveIssue:"__lunora_admin__:resolveIssue",rlsPolicies:"__lunora_admin__:rlsPolicies",runAs:"__lunora_admin__:runAs",runMigration:"__lunora_admin__:runMigration",runSql:"__lunora_admin__:runSql",sendQueueMessage:"__lunora_admin__:sendQueueMessage",sendTestMail:"__lunora_admin__:sendTestMail",setIssueSeverity:"__lunora_admin__:setIssueSeverity",storageOrphans:"__lunora_admin__:storageOrphans",storageReferences:"__lunora_admin__:storageReferences",storageRules:"__lunora_admin__:storageRules",studioFeatures:"__lunora_admin__:studioFeatures",writeRow:"__lunora_admin__:writeRow"};export{_ as a};
@@ -1 +1 @@
1
- import{a as U}from"./chunk-54MMVNPT.js";import{a as C}from"./chunk-7LQWFOEU.js";import{a as f}from"./chunk-5Y3QLNWX.js";import{R as N}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as O}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as L}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as w}from"./chunk-GXZAXNZI.js";import{f as P}from"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{d as q,f as v,g as c,h,m as p}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as o,e as T,f as W,h as $}from"./chunk-3XIESWL4.js";var a=T(W(),1);var e=T($(),1);var R=v(w.getPitrBookmark),V=v(w.pitrRestore),ne=o(({initialShardKey:j})=>{let m=P(),r=q(),i=j??"",[z,x]=(0,a.useState)(null),[l,A]=(0,a.useState)(""),[B,I]=(0,a.useState)(null),[u,D]=(0,a.useState)(""),[k,E]=(0,a.useState)(!1),[s,K]=(0,a.useState)(null),[F,n]=(0,a.useState)(null),[b,d]=(0,a.useState)(!1),g=(0,a.useCallback)(async()=>{d(!0),n(null);try{let t=await m.query(R,{},c(i));x(t.current)}catch(t){n(h(t))}finally{d(!1)}},[m,i]);(0,a.useEffect)(()=>{p(g())},[g]),U(()=>{p((async()=>{try{let t=await m.query(R,{},c(i));x(t.current)}catch{}})())},!0);let M=o(t=>{A(t.target.value)},"U"),Z=o(t=>{D(t.target.value)},"j"),_=o(t=>{E(t.target.checked)},"M"),G=o(()=>{l.trim()!==""&&p((async()=>{d(!0),n(null);try{let t=await m.query(R,{time:l.trim()},c(i));I(t.forTime??null),x(t.current)}catch(t){I(null),n(h(t))}finally{d(!1)}})())},"z"),S=o(t=>{p((async()=>{d(!0),n(null);try{let y=await m.mutation(V,t,c(i));K(y),await g()}catch(y){n(h(y))}finally{d(!1)}})())},"R"),H=u.trim()!==""||l.trim()!=="",J=o(()=>{let t=k?{restart:!0}:{};u.trim()===""?t.time=l.trim():t.bookmark=u.trim(),S(t)},"$"),Q=o(()=>{s!==null&&S(k?{bookmark:s.undoBookmark,restart:!0}:{bookmark:s.undoBookmark})},"D");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-pitr",children:[(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[r("Shard"),": ",(0,e.jsx)("span",{className:"font-mono",children:i===""?r("root"):i})]})}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"pitr-note",children:r("In-place recovery to any moment in the last 30 days. For older or portable recovery, use the snapshot backup tier.")}),F!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"pitr-error",role:"alert",children:F}),(0,e.jsxs)("section",{className:"rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,e.jsx)("h3",{className:"mb-2 text-sm font-semibold",children:r("Current bookmark")}),(0,e.jsx)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-current",children:z??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]}),(0,e.jsxs)("section",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:r("Restore")}),(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)(f,{htmlFor:"pitr-time",children:r("Time (ISO or epoch-ms, last 30 days)")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(N,{"data-testid":"pitr-time",id:"pitr-time",onChange:M,placeholder:"2026-06-01T00:00:00.000Z",value:l}),(0,e.jsx)(O,{"data-testid":"pitr-preview",disabled:b||l.trim()==="",onClick:G,size:"sm",type:"button",variant:"outline",children:r("Preview")})]}),B!==null&&(0,e.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-preview-bookmark",children:[r("Bookmark for that time"),": ",B]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)(f,{htmlFor:"pitr-bookmark",children:r("Or an explicit bookmark (wins over time)")}),(0,e.jsx)(N,{"data-testid":"pitr-bookmark",id:"pitr-bookmark",onChange:Z,placeholder:r("bookmark string"),value:u})]}),(0,e.jsxs)(f,{className:"flex items-center gap-2 text-xs font-normal text-muted-foreground",htmlFor:"pitr-restart",children:[(0,e.jsx)("input",{checked:k,className:"size-4 accent-primary","data-testid":"pitr-restart",id:"pitr-restart",onChange:_,type:"checkbox"}),r("Restart the shard now so recovery applies immediately")]}),(0,e.jsx)("div",{children:(0,e.jsx)(C,{confirmLabel:r("Confirm restore"),disabled:b||!H,onConfirm:J,testId:"pitr-restore",children:r("Restore")})})]}),s!==null&&(0,e.jsxs)("section",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs","data-testid":"pitr-result",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:r("Restore armed")}),(0,e.jsx)(L,{variant:s.restarted?"destructive":"secondary",children:s.restarted?r("restarted now"):r("on next restart")})]}),(0,e.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground",children:[r("Restored to"),": ",s.restoredTo]}),(0,e.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-undo-bookmark",children:[r("Undo bookmark"),": ",s.undoBookmark]}),(0,e.jsx)("div",{children:(0,e.jsx)(C,{confirmLabel:r("Confirm undo"),disabled:b,onConfirm:Q,testId:"pitr-undo",children:r("Undo restore")})})]})]})},"de");export{ne as PitrPanel};
1
+ import{a as U}from"./chunk-54MMVNPT.js";import{a as C}from"./chunk-7LQWFOEU.js";import{a as f}from"./chunk-5Y3QLNWX.js";import{R as N}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as O}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as L}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as w}from"./chunk-AADXUXZO.js";import{f as P}from"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{d as q,f as v,g as c,h,m as p}from"./chunk-4CGALXS3.js";import"./chunk-AADILRJW.js";import{a as o,e as T,f as W,h as $}from"./chunk-3XIESWL4.js";var a=T(W(),1);var e=T($(),1);var R=v(w.getPitrBookmark),V=v(w.pitrRestore),ne=o(({initialShardKey:j})=>{let m=P(),r=q(),i=j??"",[z,x]=(0,a.useState)(null),[l,A]=(0,a.useState)(""),[B,I]=(0,a.useState)(null),[u,D]=(0,a.useState)(""),[k,E]=(0,a.useState)(!1),[s,K]=(0,a.useState)(null),[F,n]=(0,a.useState)(null),[b,d]=(0,a.useState)(!1),g=(0,a.useCallback)(async()=>{d(!0),n(null);try{let t=await m.query(R,{},c(i));x(t.current)}catch(t){n(h(t))}finally{d(!1)}},[m,i]);(0,a.useEffect)(()=>{p(g())},[g]),U(()=>{p((async()=>{try{let t=await m.query(R,{},c(i));x(t.current)}catch{}})())},!0);let M=o(t=>{A(t.target.value)},"U"),Z=o(t=>{D(t.target.value)},"j"),_=o(t=>{E(t.target.checked)},"M"),G=o(()=>{l.trim()!==""&&p((async()=>{d(!0),n(null);try{let t=await m.query(R,{time:l.trim()},c(i));I(t.forTime??null),x(t.current)}catch(t){I(null),n(h(t))}finally{d(!1)}})())},"z"),S=o(t=>{p((async()=>{d(!0),n(null);try{let y=await m.mutation(V,t,c(i));K(y),await g()}catch(y){n(h(y))}finally{d(!1)}})())},"R"),H=u.trim()!==""||l.trim()!=="",J=o(()=>{let t=k?{restart:!0}:{};u.trim()===""?t.time=l.trim():t.bookmark=u.trim(),S(t)},"$"),Q=o(()=>{s!==null&&S(k?{bookmark:s.undoBookmark,restart:!0}:{bookmark:s.undoBookmark})},"D");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-pitr",children:[(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[r("Shard"),": ",(0,e.jsx)("span",{className:"font-mono",children:i===""?r("root"):i})]})}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"pitr-note",children:r("In-place recovery to any moment in the last 30 days. For older or portable recovery, use the snapshot backup tier.")}),F!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"pitr-error",role:"alert",children:F}),(0,e.jsxs)("section",{className:"rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,e.jsx)("h3",{className:"mb-2 text-sm font-semibold",children:r("Current bookmark")}),(0,e.jsx)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-current",children:z??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]}),(0,e.jsxs)("section",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:r("Restore")}),(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)(f,{htmlFor:"pitr-time",children:r("Time (ISO or epoch-ms, last 30 days)")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(N,{"data-testid":"pitr-time",id:"pitr-time",onChange:M,placeholder:"2026-06-01T00:00:00.000Z",value:l}),(0,e.jsx)(O,{"data-testid":"pitr-preview",disabled:b||l.trim()==="",onClick:G,size:"sm",type:"button",variant:"outline",children:r("Preview")})]}),B!==null&&(0,e.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-preview-bookmark",children:[r("Bookmark for that time"),": ",B]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)(f,{htmlFor:"pitr-bookmark",children:r("Or an explicit bookmark (wins over time)")}),(0,e.jsx)(N,{"data-testid":"pitr-bookmark",id:"pitr-bookmark",onChange:Z,placeholder:r("bookmark string"),value:u})]}),(0,e.jsxs)(f,{className:"flex items-center gap-2 text-xs font-normal text-muted-foreground",htmlFor:"pitr-restart",children:[(0,e.jsx)("input",{checked:k,className:"size-4 accent-primary","data-testid":"pitr-restart",id:"pitr-restart",onChange:_,type:"checkbox"}),r("Restart the shard now so recovery applies immediately")]}),(0,e.jsx)("div",{children:(0,e.jsx)(C,{confirmLabel:r("Confirm restore"),disabled:b||!H,onConfirm:J,testId:"pitr-restore",children:r("Restore")})})]}),s!==null&&(0,e.jsxs)("section",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs","data-testid":"pitr-result",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:r("Restore armed")}),(0,e.jsx)(L,{variant:s.restarted?"destructive":"secondary",children:s.restarted?r("restarted now"):r("on next restart")})]}),(0,e.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground",children:[r("Restored to"),": ",s.restoredTo]}),(0,e.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-undo-bookmark",children:[r("Undo bookmark"),": ",s.undoBookmark]}),(0,e.jsx)("div",{children:(0,e.jsx)(C,{confirmLabel:r("Confirm undo"),disabled:b,onConfirm:Q,testId:"pitr-undo",children:r("Undo restore")})})]})]})},"de");export{ne as PitrPanel};
@@ -0,0 +1 @@
1
+ import{a as l}from"./chunk-BMQJ4CAO.js";import{f as c}from"./chunk-EN2QAEO4.js";import{a as r,e as f,g}from"./chunk-3XIESWL4.js";var m=f(g(),1);var p={capabilities:{accounts:!0,admin:!0,organization:!1,passkey:!1,twoFactor:!1},emailAndPassword:!1,organization:{enabled:!1,roles:!1,teams:!1},plugins:[],rateLimit:{enabled:!1},session:{},socialProviders:[],userFields:[]},y=r(()=>{let o=(0,m.c)(6),t=c(),a;o[0]===Symbol.for("react.memo_cache_sentinel")?(a=["lunora-auth-config"],o[0]=a):a=o[0];let e;o[1]!==t?(e=r(()=>t.getAuthConfig(),"o"),o[1]=t,o[2]=e):e=o[2];let{data:u,isLoading:d}=l(a,e),i=u??p,n=!d,s;return o[3]!==i||o[4]!==n?(s={config:i,ready:n},o[3]=i,o[4]=n,o[5]=s):s=o[5],s},"A");export{y as a};
@@ -1 +1 @@
1
- import{a as st}from"./chunk-X2FQ6B5V.js";import{a as Y}from"./chunk-LFKCLLPT.js";import{a as Z}from"./chunk-UNUU7CJJ.js";import"./chunk-XXQUMVWH.js";import{b as Q}from"./chunk-XSD4Y6SQ.js";import{a as tt,b as et,c as rt,d as z,e as n,f as o}from"./chunk-MIQTKZAR.js";import{a as W,e as G}from"./chunk-UZERI5YC.js";import{a as X}from"./chunk-LFXFP4IF.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as U}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as R}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as V}from"./chunk-GXZAXNZI.js";import"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as H}from"./chunk-XQCVZAGU.js";import{d as O,q as J}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a,e as q,f as mt,g as ht,h as ut,j as P}from"./chunk-3XIESWL4.js";var at=q(ht(),1),B=q(mt(),1);var e=q(ut(),1);var ft={action:"outline",mutation:"default",query:"secondary"},lt=a(r=>r<1e3?`${r<10?r.toFixed(1):Math.round(r).toString()}ms`:`${(r/1e3).toFixed(2)}s`,"O"),pt=a(r=>r.calls===0?"\u2014":r.errors===0?"0":`${r.errors.toString()} (${(r.errors/r.calls*100).toFixed(1)}%)`,"mt"),xt=a(r=>{let t=r.conflicts??0;return r.calls===0?"\u2014":t===0?"0":`${t.toString()} (${(t/r.calls*100).toFixed(1)}%)`},"ut"),gt={calls:a((r,t)=>t.calls-r.calls,"calls"),recent:a((r,t)=>t.lastCalledAt-r.lastCalledAt,"recent"),slowest:a((r,t)=>t.maxDurationMs-r.maxDurationMs,"slowest")},At=a(r=>{let t=(0,at.c)(47),{functions:A,initialShardKey:nt}=r,l=O(),[i,ot]=(0,B.useState)(nt??""),[c,it]=(0,B.useState)("recent"),M;t[0]!==i?(M=i.trim(),t[0]=i,t[1]=M):M=t[1];let j=Y(M,400),w;t[2]===Symbol.for("react.memo_cache_sentinel")?(w={},t[2]=w):w=t[2];let $;t[3]!==j?($={live:!0,shardKey:j},t[3]=j,t[4]=$):$=t[4];let{data:ct,error:d,errorSource:v,liveError:k}=Q(V.getFunctionStats,w,$),S=ct?.functions??null,C;t[5]!==A?(C=new Map((A??[]).map(Nt)),t[5]=A,t[6]=C):C=t[6];let K=C,F;t[7]===Symbol.for("react.memo_cache_sentinel")?(F=a(b=>{it(b.currentTarget.dataset.sort)},"C"),t[7]=F):F=t[7];let dt=F,D;if(t[8]!==d||t[9]!==v||t[10]!==K||t[11]!==k||t[12]!==i||t[13]!==c||t[14]!==S||t[15]!==l){let b=S===null?[]:S.toSorted(gt[c]),m;t[17]!==l?(m=l("Recent"),t[17]=l,t[18]=m):m=t[18];let h;t[19]!==m?(h={key:"recent",label:m},t[19]=m,t[20]=h):h=t[20];let u;t[21]!==l?(u=l("Most called"),t[21]=l,t[22]=u):u=t[22];let f;t[23]!==u?(f={key:"calls",label:u},t[23]=u,t[24]=f):f=t[24];let p;t[25]!==l?(p=l("Slowest"),t[25]=l,t[26]=p):p=t[26];let x;t[27]!==p?(x={key:"slowest",label:p},t[27]=p,t[28]=x):x=t[28];let I;t[29]!==f||t[30]!==x||t[31]!==h?(I=[h,f,x],t[29]=f,t[30]=x,t[31]=h,t[32]=I):I=t[32];let L=I,g;t[33]!==i?(g=(0,e.jsx)(X,{onChange:ot,testId:"fs-shard-input",value:i}),t[33]=i,t[34]=g):g=t[34];let N;t[35]!==k?(N=(0,e.jsx)(st,{message:k,prefix:"fs"}),t[35]=k,t[36]=N):N=t[36];let y;t[37]!==L||t[38]!==c?(y=(0,e.jsx)("div",{className:"ml-auto flex items-center gap-1",role:"group",children:L.map(s=>(0,e.jsx)(U,{"data-sort":s.key,"data-testid":`fs-sort-${s.key}`,onClick:dt,size:"sm",type:"button",variant:c===s.key?"secondary":"ghost",children:s.label},s.key))}),t[37]=L,t[38]=c,t[39]=y):y=t[39];let E;t[40]!==g||t[41]!==N||t[42]!==y?(E=(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[g,N,y]}),t[40]=g,t[41]=N,t[42]=y,t[43]=E):E=t[43];let _;t[44]!==d||t[45]!==v?(_=d!==null&&(0,e.jsx)(Z,{error:v,testId:"fs-error"}),t[44]=d,t[45]=v,t[46]=_):_=t[46],D=(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-stats",children:[E,_,S!==null&&b.length===0&&d===null&&(0,e.jsx)(H,{description:l("Per-function call counts, error rates, and latency land here after your first request."),icon:(0,e.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,e.jsx)("path",{d:"M3 3v18h18"}),(0,e.jsx)("path",{d:"M7 14l4-4 3 3 5-6"})]}),testId:"fs-empty",title:l("No functions have run on this shard yet.")}),b.length>0&&(0,e.jsx)(W,{className:"overflow-hidden py-0",children:(0,e.jsx)(G,{className:"px-0",children:(0,e.jsxs)(tt,{"data-testid":"fs-table",children:[(0,e.jsx)(et,{children:(0,e.jsxs)(z,{children:[(0,e.jsx)(n,{children:l("function")}),(0,e.jsx)(n,{children:l("kind")}),(0,e.jsx)(n,{className:"text-right",children:l("calls")}),(0,e.jsx)(n,{className:"text-right",children:l("errors")}),(0,e.jsx)(n,{className:"text-right",children:l("conflicts")}),(0,e.jsx)(n,{className:"text-right",children:l("avg")}),(0,e.jsx)(n,{className:"text-right",children:l("max")}),(0,e.jsx)(n,{children:l("last run")}),(0,e.jsx)(n,{children:l("last error")})]})}),(0,e.jsx)(rt,{children:b.map(s=>{let T=K.get(s.path);return(0,e.jsxs)(z,{"data-testid":`fs-row-${s.path}`,children:[(0,e.jsx)(o,{className:"font-medium",children:s.path}),(0,e.jsx)(o,{children:T===void 0?(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,e.jsx)(R,{variant:ft[T],children:T})}),(0,e.jsx)(o,{className:"text-right tabular-nums",children:s.calls}),(0,e.jsx)(o,{className:P("text-right tabular-nums",s.errors>0&&"text-destructive"),children:pt(s)}),(0,e.jsx)(o,{className:P("text-right tabular-nums",(s.conflicts??0)>0&&"text-warning"),children:xt(s)}),(0,e.jsx)(o,{className:"text-right tabular-nums",children:s.calls===0?"\u2014":lt(s.totalDurationMs/s.calls)}),(0,e.jsx)(o,{className:"text-right tabular-nums",children:s.calls===0?"\u2014":lt(s.maxDurationMs)}),(0,e.jsx)(o,{className:"text-muted-foreground",children:J(s.lastCalledAt,"\u2014")}),(0,e.jsx)(o,{className:"max-w-[24ch] truncate text-destructive",title:s.lastErrorMessage??void 0,children:s.lastErrorMessage??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},s.path)})})]})})})]}),t[8]=d,t[9]=v,t[10]=K,t[11]=k,t[12]=i,t[13]=c,t[14]=S,t[15]=l,t[16]=D}else D=t[16];return D},"Dt");function Nt(r){return[r.path,r.kind]}a(Nt,"ft");export{At as FunctionStatsPanel};
1
+ import{a as st}from"./chunk-X2FQ6B5V.js";import{a as Y}from"./chunk-LFKCLLPT.js";import{a as Z}from"./chunk-HK4OVYG3.js";import"./chunk-XXQUMVWH.js";import{b as Q}from"./chunk-BMQJ4CAO.js";import{a as tt,b as et,c as rt,d as z,e as n,f as o}from"./chunk-MIQTKZAR.js";import{a as W,e as G}from"./chunk-UZERI5YC.js";import{a as X}from"./chunk-LFXFP4IF.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as U}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as R}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as V}from"./chunk-AADXUXZO.js";import"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{a as H}from"./chunk-XQCVZAGU.js";import{d as O,q as J}from"./chunk-4CGALXS3.js";import"./chunk-AADILRJW.js";import{a,e as q,f as mt,g as ht,h as ut,j as P}from"./chunk-3XIESWL4.js";var at=q(ht(),1),B=q(mt(),1);var e=q(ut(),1);var ft={action:"outline",mutation:"default",query:"secondary"},lt=a(r=>r<1e3?`${r<10?r.toFixed(1):Math.round(r).toString()}ms`:`${(r/1e3).toFixed(2)}s`,"O"),pt=a(r=>r.calls===0?"\u2014":r.errors===0?"0":`${r.errors.toString()} (${(r.errors/r.calls*100).toFixed(1)}%)`,"mt"),xt=a(r=>{let t=r.conflicts??0;return r.calls===0?"\u2014":t===0?"0":`${t.toString()} (${(t/r.calls*100).toFixed(1)}%)`},"ut"),gt={calls:a((r,t)=>t.calls-r.calls,"calls"),recent:a((r,t)=>t.lastCalledAt-r.lastCalledAt,"recent"),slowest:a((r,t)=>t.maxDurationMs-r.maxDurationMs,"slowest")},At=a(r=>{let t=(0,at.c)(47),{functions:A,initialShardKey:nt}=r,l=O(),[i,ot]=(0,B.useState)(nt??""),[c,it]=(0,B.useState)("recent"),M;t[0]!==i?(M=i.trim(),t[0]=i,t[1]=M):M=t[1];let j=Y(M,400),w;t[2]===Symbol.for("react.memo_cache_sentinel")?(w={},t[2]=w):w=t[2];let $;t[3]!==j?($={live:!0,shardKey:j},t[3]=j,t[4]=$):$=t[4];let{data:ct,error:d,errorSource:v,liveError:k}=Q(V.getFunctionStats,w,$),S=ct?.functions??null,C;t[5]!==A?(C=new Map((A??[]).map(Nt)),t[5]=A,t[6]=C):C=t[6];let K=C,F;t[7]===Symbol.for("react.memo_cache_sentinel")?(F=a(b=>{it(b.currentTarget.dataset.sort)},"C"),t[7]=F):F=t[7];let dt=F,D;if(t[8]!==d||t[9]!==v||t[10]!==K||t[11]!==k||t[12]!==i||t[13]!==c||t[14]!==S||t[15]!==l){let b=S===null?[]:S.toSorted(gt[c]),m;t[17]!==l?(m=l("Recent"),t[17]=l,t[18]=m):m=t[18];let h;t[19]!==m?(h={key:"recent",label:m},t[19]=m,t[20]=h):h=t[20];let u;t[21]!==l?(u=l("Most called"),t[21]=l,t[22]=u):u=t[22];let f;t[23]!==u?(f={key:"calls",label:u},t[23]=u,t[24]=f):f=t[24];let p;t[25]!==l?(p=l("Slowest"),t[25]=l,t[26]=p):p=t[26];let x;t[27]!==p?(x={key:"slowest",label:p},t[27]=p,t[28]=x):x=t[28];let I;t[29]!==f||t[30]!==x||t[31]!==h?(I=[h,f,x],t[29]=f,t[30]=x,t[31]=h,t[32]=I):I=t[32];let L=I,g;t[33]!==i?(g=(0,e.jsx)(X,{onChange:ot,testId:"fs-shard-input",value:i}),t[33]=i,t[34]=g):g=t[34];let N;t[35]!==k?(N=(0,e.jsx)(st,{message:k,prefix:"fs"}),t[35]=k,t[36]=N):N=t[36];let y;t[37]!==L||t[38]!==c?(y=(0,e.jsx)("div",{className:"ml-auto flex items-center gap-1",role:"group",children:L.map(s=>(0,e.jsx)(U,{"data-sort":s.key,"data-testid":`fs-sort-${s.key}`,onClick:dt,size:"sm",type:"button",variant:c===s.key?"secondary":"ghost",children:s.label},s.key))}),t[37]=L,t[38]=c,t[39]=y):y=t[39];let E;t[40]!==g||t[41]!==N||t[42]!==y?(E=(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[g,N,y]}),t[40]=g,t[41]=N,t[42]=y,t[43]=E):E=t[43];let _;t[44]!==d||t[45]!==v?(_=d!==null&&(0,e.jsx)(Z,{error:v,testId:"fs-error"}),t[44]=d,t[45]=v,t[46]=_):_=t[46],D=(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-stats",children:[E,_,S!==null&&b.length===0&&d===null&&(0,e.jsx)(H,{description:l("Per-function call counts, error rates, and latency land here after your first request."),icon:(0,e.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,e.jsx)("path",{d:"M3 3v18h18"}),(0,e.jsx)("path",{d:"M7 14l4-4 3 3 5-6"})]}),testId:"fs-empty",title:l("No functions have run on this shard yet.")}),b.length>0&&(0,e.jsx)(W,{className:"overflow-hidden py-0",children:(0,e.jsx)(G,{className:"px-0",children:(0,e.jsxs)(tt,{"data-testid":"fs-table",children:[(0,e.jsx)(et,{children:(0,e.jsxs)(z,{children:[(0,e.jsx)(n,{children:l("function")}),(0,e.jsx)(n,{children:l("kind")}),(0,e.jsx)(n,{className:"text-right",children:l("calls")}),(0,e.jsx)(n,{className:"text-right",children:l("errors")}),(0,e.jsx)(n,{className:"text-right",children:l("conflicts")}),(0,e.jsx)(n,{className:"text-right",children:l("avg")}),(0,e.jsx)(n,{className:"text-right",children:l("max")}),(0,e.jsx)(n,{children:l("last run")}),(0,e.jsx)(n,{children:l("last error")})]})}),(0,e.jsx)(rt,{children:b.map(s=>{let T=K.get(s.path);return(0,e.jsxs)(z,{"data-testid":`fs-row-${s.path}`,children:[(0,e.jsx)(o,{className:"font-medium",children:s.path}),(0,e.jsx)(o,{children:T===void 0?(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,e.jsx)(R,{variant:ft[T],children:T})}),(0,e.jsx)(o,{className:"text-right tabular-nums",children:s.calls}),(0,e.jsx)(o,{className:P("text-right tabular-nums",s.errors>0&&"text-destructive"),children:pt(s)}),(0,e.jsx)(o,{className:P("text-right tabular-nums",(s.conflicts??0)>0&&"text-warning"),children:xt(s)}),(0,e.jsx)(o,{className:"text-right tabular-nums",children:s.calls===0?"\u2014":lt(s.totalDurationMs/s.calls)}),(0,e.jsx)(o,{className:"text-right tabular-nums",children:s.calls===0?"\u2014":lt(s.maxDurationMs)}),(0,e.jsx)(o,{className:"text-muted-foreground",children:J(s.lastCalledAt,"\u2014")}),(0,e.jsx)(o,{className:"max-w-[24ch] truncate text-destructive",title:s.lastErrorMessage??void 0,children:s.lastErrorMessage??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},s.path)})})]})})})]}),t[8]=d,t[9]=v,t[10]=K,t[11]=k,t[12]=i,t[13]=c,t[14]=S,t[15]=l,t[16]=D}else D=t[16];return D},"Dt");function Nt(r){return[r.path,r.kind]}a(Nt,"ft");export{At as FunctionStatsPanel};
@@ -1 +1 @@
1
- import{b as D,c as f,d as E,f as I}from"./chunk-35II7U25.js";import{f as p,g as y,h as P,m as b}from"./chunk-4CGALXS3.js";import{a as s,e as T,f as Q,g as S}from"./chunk-3XIESWL4.js";var g=T(S(),1);var d=T(Q(),1);var h=s((e,r,o)=>["lunora-admin",e,r,o.trim()],"y");function L(e,r,o={}){let{enabled:t=!0,keepPreviousData:n=!1,staleTime:i=0}=o,a=E({enabled:t,queryFn:r,placeholderData:n?D:void 0,queryKey:e,staleTime:i});return{data:a.data,error:a.error?P(a.error):a.error,errorSource:a.error??void 0,isLoading:a.isLoading,liveError:void 0,refetch:s(()=>{b(a.refetch())},"refetch")}}s(L,"N");function O(e,r,o={}){let t=I(),n=f(),{enabled:i=!0,keepPreviousData:a=!1,live:u=!1,shardKey:l="",staleTime:k}=o,m=h(e,r,l),q=L(m,()=>t.query(p(e),r,y(l)),{enabled:i,keepPreviousData:a,staleTime:k??(u?Number.POSITIVE_INFINITY:0)}),[K,v]=(0,d.useState)(void 0),N=JSON.stringify(m);return(0,d.useEffect)(()=>{if(!(!i||!u))return v(void 0),t.subscribe(p(e),r,c=>{v(void 0),n.setQueryData(m,c)},{...y(l),onError:s(c=>{v(c.message)},"onError")})},[N,i,u]),{...q,liveError:i&&u?K:void 0}}s(O,"_");var C=s(()=>{let e=(0,g.c)(2),r=f(),o;return e[0]!==r?(o=s((t,n,i)=>{let a=n===void 0?["lunora-admin",t]:h(t,n,i??"");b(r.invalidateQueries({queryKey:a}))},"a"),e[0]=r,e[1]=o):o=e[1],o},"x");export{L as a,O as b,C as c};
1
+ import{b as D,c as f,d as E,f as I}from"./chunk-EN2QAEO4.js";import{f as p,g as y,h as P,m as b}from"./chunk-4CGALXS3.js";import{a as s,e as T,f as Q,g as S}from"./chunk-3XIESWL4.js";var g=T(S(),1);var d=T(Q(),1);var h=s((e,r,o)=>["lunora-admin",e,r,o.trim()],"y");function L(e,r,o={}){let{enabled:t=!0,keepPreviousData:n=!1,staleTime:i=0}=o,a=E({enabled:t,queryFn:r,placeholderData:n?D:void 0,queryKey:e,staleTime:i});return{data:a.data,error:a.error?P(a.error):a.error,errorSource:a.error??void 0,isLoading:a.isLoading,liveError:void 0,refetch:s(()=>{b(a.refetch())},"refetch")}}s(L,"N");function O(e,r,o={}){let t=I(),n=f(),{enabled:i=!0,keepPreviousData:a=!1,live:u=!1,shardKey:l="",staleTime:k}=o,m=h(e,r,l),q=L(m,()=>t.query(p(e),r,y(l)),{enabled:i,keepPreviousData:a,staleTime:k??(u?Number.POSITIVE_INFINITY:0)}),[K,v]=(0,d.useState)(void 0),N=JSON.stringify(m);return(0,d.useEffect)(()=>{if(!(!i||!u))return v(void 0),t.subscribe(p(e),r,c=>{v(void 0),n.setQueryData(m,c)},{...y(l),onError:s(c=>{v(c.message)},"onError")})},[N,i,u]),{...q,liveError:i&&u?K:void 0}}s(O,"_");var C=s(()=>{let e=(0,g.c)(2),r=f(),o;return e[0]!==r?(o=s((t,n,i)=>{let a=n===void 0?["lunora-admin",t]:h(t,n,i??"");b(r.invalidateQueries({queryKey:a}))},"a"),e[0]=r,e[1]=o):o=e[1],o},"x");export{L as a,O as b,C as c};
@@ -1 +1 @@
1
- import{a as g,b}from"./chunk-PF7V3G2Z.js";import{a as c,e as p,g as y,h as M,j as d}from"./chunk-3XIESWL4.js";var w=c(e=>{let t=0,s=0,r=0,a=0,i=0,l=0,o=0;for(let{metrics:n}of e){if(n===null){i+=1;continue}a+=1,t+=n.requests,s+=n.errors,r+=n.databaseSize??0,n.cache!==null&&(l+=n.cache.hits,o+=n.cache.hits+n.cache.misses)}return{failed:i,hitRate:o===0?null:l/o,reachable:a,totalDatabaseSize:r,totalErrors:s,totalRequests:t}},"u"),C=c((e,t)=>{let s=new Set,r=[];for(let a of["",e.trim(),...t])s.has(a)||(s.add(a),r.push(a));return r},"h"),v=c((e,t)=>{if(e.length===0)return 0;if(e.sort((r,a)=>r-a),t<=0)return e[0]??0;if(t>=100)return e.at(-1)??0;let s=Math.ceil(t/100*e.length)-1;return e[s]??0},"i"),N=c(e=>{let t=e.functions;if(!t||t.length===0)return{p90:0,p95:0};let s=1e3,r=[];for(let a of t){if(a.calls<=0)continue;let i=a.totalDurationMs/a.calls,l=Math.min(a.calls,s);for(let o=0;o<l;o+=1)r.push(i)}return r.length===0?{p90:0,p95:0}:{p90:v([...r],90),p95:v([...r],95)}},"f");var q=c(e=>e.map(t=>({...t,avgDurationMs:t.execCount>0?t.totalDurationMs/t.execCount:0})),"g");var x=p(y(),1);var m=p(M(),1);var S={value:{colors:{dark:["var(--foreground)"],light:["var(--foreground)"]},label:""}},T=c(e=>{let t=(0,x.c)(12),{ariaLabel:s,className:r,series:a,testId:i}=e;if(a.length<2)return null;let l;t[0]!==a?(l=a.slice(-40).map(D),t[0]=a,t[1]=l):l=t[1];let o=l,n;t[2]!==r?(n=d("h-6 w-[120px]",r),t[2]=r,t[3]=n):n=t[3];let f;t[4]===Symbol.for("react.memo_cache_sentinel")?(f=(0,m.jsx)(b,{dataKey:"value"}),t[4]=f):f=t[4];let u;t[5]!==o?(u=(0,m.jsx)(g,{animationType:"none",barCategoryGap:1,className:"h-full w-full",config:S,data:o,children:f}),t[5]=o,t[6]=u):u=t[6];let h;return t[7]!==s||t[8]!==n||t[9]!==u||t[10]!==i?(h=(0,m.jsx)("div",{"aria-label":s,className:n,"data-testid":i,role:"img",children:u}),t[7]=s,t[8]=n,t[9]=u,t[10]=i,t[11]=h):h=t[11],h},"S");function D(e,t){return{index:t,value:e}}c(D,"b");export{w as a,C as b,N as c,q as d,T as e};
1
+ import{a as g,b}from"./chunk-WCWYSOCN.js";import{a as c,e as p,g as y,h as M,j as d}from"./chunk-3XIESWL4.js";var w=c(e=>{let t=0,s=0,r=0,a=0,i=0,l=0,o=0;for(let{metrics:n}of e){if(n===null){i+=1;continue}a+=1,t+=n.requests,s+=n.errors,r+=n.databaseSize??0,n.cache!==null&&(l+=n.cache.hits,o+=n.cache.hits+n.cache.misses)}return{failed:i,hitRate:o===0?null:l/o,reachable:a,totalDatabaseSize:r,totalErrors:s,totalRequests:t}},"u"),C=c((e,t)=>{let s=new Set,r=[];for(let a of["",e.trim(),...t])s.has(a)||(s.add(a),r.push(a));return r},"h"),v=c((e,t)=>{if(e.length===0)return 0;if(e.sort((r,a)=>r-a),t<=0)return e[0]??0;if(t>=100)return e.at(-1)??0;let s=Math.ceil(t/100*e.length)-1;return e[s]??0},"i"),N=c(e=>{let t=e.functions;if(!t||t.length===0)return{p90:0,p95:0};let s=1e3,r=[];for(let a of t){if(a.calls<=0)continue;let i=a.totalDurationMs/a.calls,l=Math.min(a.calls,s);for(let o=0;o<l;o+=1)r.push(i)}return r.length===0?{p90:0,p95:0}:{p90:v([...r],90),p95:v([...r],95)}},"f");var q=c(e=>e.map(t=>({...t,avgDurationMs:t.execCount>0?t.totalDurationMs/t.execCount:0})),"g");var x=p(y(),1);var m=p(M(),1);var S={value:{colors:{dark:["var(--foreground)"],light:["var(--foreground)"]},label:""}},T=c(e=>{let t=(0,x.c)(12),{ariaLabel:s,className:r,series:a,testId:i}=e;if(a.length<2)return null;let l;t[0]!==a?(l=a.slice(-40).map(D),t[0]=a,t[1]=l):l=t[1];let o=l,n;t[2]!==r?(n=d("h-6 w-[120px]",r),t[2]=r,t[3]=n):n=t[3];let f;t[4]===Symbol.for("react.memo_cache_sentinel")?(f=(0,m.jsx)(b,{dataKey:"value"}),t[4]=f):f=t[4];let u;t[5]!==o?(u=(0,m.jsx)(g,{animationType:"none",barCategoryGap:1,className:"h-full w-full",config:S,data:o,children:f}),t[5]=o,t[6]=u):u=t[6];let h;return t[7]!==s||t[8]!==n||t[9]!==u||t[10]!==i?(h=(0,m.jsx)("div",{"aria-label":s,className:n,"data-testid":i,role:"img",children:u}),t[7]=s,t[8]=n,t[9]=u,t[10]=i,t[11]=h):h=t[11],h},"S");function D(e,t){return{index:t,value:e}}c(D,"b");export{w as a,C as b,N as c,q as d,T as e};
@@ -1 +1 @@
1
- import{b as H}from"./chunk-SKHEGARW.js";import{a as q}from"./chunk-UNUU7CJJ.js";import"./chunk-XXQUMVWH.js";import{b as P}from"./chunk-XSD4Y6SQ.js";import{a as z,b as B,c as G,d as A,e as _,f as E}from"./chunk-MIQTKZAR.js";import{a as O,e as V}from"./chunk-UZERI5YC.js";import{b as M}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as R}from"./chunk-GXZAXNZI.js";import"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{d as F}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as S,e as L,f as W,g as $,h as X}from"./chunk-3XIESWL4.js";var J=L($(),1),te=L(W(),1);var r=L(X(),1);var Y={binding:"outline",secret:"destructive",var:"secondary"},me=S(s=>{let e=(0,J.c)(68),{initialShardKey:Q}=s,t=F(),N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N={},e[0]=N):N=e[0];let C=Q??"",k;e[1]!==C?(k={shardKey:C},e[1]=C,e[2]=k):k=e[2];let{data:w,error:d,errorSource:D,isLoading:K}=P(R.getSettings,N,k),j;e:{let a=w?.deploy;if(a===void 0){let n;e[3]===Symbol.for("react.memo_cache_sentinel")?(n=[],e[3]=n):n=e[3],j=n;break e}let i;if(e[4]!==a.deploymentId||e[5]!==a.environment||e[6]!==a.versionTag||e[7]!==a.workerUrl||e[8]!==t){if(i=[],a.workerUrl!==void 0){let n;e[10]!==t?(n=t("URL"),e[10]=t,e[11]=n):n=e[11];let l;e[12]!==a.workerUrl||e[13]!==n?(l={label:n,value:a.workerUrl},e[12]=a.workerUrl,e[13]=n,e[14]=l):l=e[14],i.push(l)}if(a.environment!==void 0){let n;e[15]!==t?(n=t("Environment"),e[15]=t,e[16]=n):n=e[16];let l;e[17]!==a.environment||e[18]!==n?(l={label:n,value:a.environment},e[17]=a.environment,e[18]=n,e[19]=l):l=e[19],i.push(l)}if(a.deploymentId!==void 0){let n;e[20]!==t?(n=t("Deployment"),e[20]=t,e[21]=n):n=e[21];let l;e[22]!==a.deploymentId||e[23]!==n?(l={label:n,value:a.deploymentId},e[22]=a.deploymentId,e[23]=n,e[24]=l):l=e[24],i.push(l)}if(a.versionTag!==void 0){let n;e[25]!==t?(n=t("Version"),e[25]=t,e[26]=n):n=e[26];let l;e[27]!==a.versionTag||e[28]!==n?(l={label:n,value:a.versionTag},e[27]=a.versionTag,e[28]=n,e[29]=l):l=e[29],i.push(l)}e[4]=a.deploymentId,e[5]=a.environment,e[6]=a.versionTag,e[7]=a.workerUrl,e[8]=t,e[9]=i}else i=e[9];j=i}let I=j,T;e[30]!==w?.settings?(T=w?.settings??[],e[30]=w?.settings,e[31]=T):T=e[31];let o=T,m;e[32]!==t?(m=t("Open in Cloudflare"),e[32]=t,e[33]=m):m=e[33];let c;e[34]!==m?(c=(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:H,rel:"noreferrer",target:"_blank",children:m})}),e[34]=m,e[35]=c):c=e[35];let p;e[36]!==t?(p=t("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[36]=t,e[37]=p):p=e[37];let h;e[38]!==p?(h=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:p}),e[38]=p,e[39]=h):h=e[39];let u;e[40]!==d||e[41]!==D?(u=d!==null&&(0,r.jsx)(q,{error:D,testId:"set-error"}),e[40]=d,e[41]=D,e[42]=u):u=e[42];let f;e[43]!==I||e[44]!==t?(f=I.length>0&&(0,r.jsxs)(O,{className:"py-0","data-testid":"set-deploy",children:[(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Deployment")})}),(0,r.jsx)(V,{className:"py-3",children:(0,r.jsx)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:I.map(Z)})})]}),e[43]=I,e[44]=t,e[45]=f):f=e[45];let g;e[46]!==t?(g=t("Environment & bindings"),e[46]=t,e[47]=g):g=e[47];let v;e[48]!==g?(v=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:g})}),e[48]=g,e[49]=v):v=e[49];let x;e[50]!==d||e[51]!==K||e[52]!==o.length||e[53]!==t?(x=d===null&&!K&&o.length===0&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:t("No environment variables or bindings.")}),e[50]=d,e[51]=K,e[52]=o.length,e[53]=t,e[54]=x):x=e[54];let y;e[55]!==o||e[56]!==t?(y=o.length>0&&(0,r.jsx)(V,{className:"px-0 py-0",children:(0,r.jsxs)(z,{"data-testid":"set-table",children:[(0,r.jsx)(B,{children:(0,r.jsxs)(A,{children:[(0,r.jsx)(_,{children:t("name")}),(0,r.jsx)(_,{children:t("kind")}),(0,r.jsx)(_,{children:t("value")})]})}),(0,r.jsx)(G,{children:o.map(ee)})]})}),e[55]=o,e[56]=t,e[57]=y):y=e[57];let b;e[58]!==v||e[59]!==x||e[60]!==y?(b=(0,r.jsxs)(O,{className:"py-0",children:[v,x,y]}),e[58]=v,e[59]=x,e[60]=y,e[61]=b):b=e[61];let U;return e[62]!==u||e[63]!==f||e[64]!==b||e[65]!==c||e[66]!==h?(U=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-settings",children:[c,h,u,f,b]}),e[62]=u,e[63]=f,e[64]=b,e[65]=c,e[66]=h,e[67]=U):U=e[67],U},"de");function Z(s){return(0,r.jsxs)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,r.jsx)("dt",{className:"text-muted-foreground",children:s.label}),(0,r.jsx)("dd",{className:"truncate font-mono text-xs",title:s.value,children:s.value})]},s.label)}S(Z,"H");function ee(s){return(0,r.jsxs)(A,{"data-testid":"set-row",children:[(0,r.jsx)(E,{className:"font-mono text-xs font-medium",children:s.name}),(0,r.jsx)(E,{children:(0,r.jsx)(M,{variant:Y[s.kind],children:s.bindingType??s.kind})}),(0,r.jsx)(E,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:s.value??(0,r.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},s.name)}S(ee,"Q");export{me as SettingsPanel};
1
+ import{b as H}from"./chunk-SKHEGARW.js";import{a as q}from"./chunk-HK4OVYG3.js";import"./chunk-XXQUMVWH.js";import{b as P}from"./chunk-BMQJ4CAO.js";import{a as z,b as B,c as G,d as A,e as _,f as E}from"./chunk-MIQTKZAR.js";import{a as O,e as V}from"./chunk-UZERI5YC.js";import{b as M}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as R}from"./chunk-AADXUXZO.js";import"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{d as F}from"./chunk-4CGALXS3.js";import"./chunk-AADILRJW.js";import{a as S,e as L,f as W,g as $,h as X}from"./chunk-3XIESWL4.js";var J=L($(),1),te=L(W(),1);var r=L(X(),1);var Y={binding:"outline",secret:"destructive",var:"secondary"},me=S(s=>{let e=(0,J.c)(68),{initialShardKey:Q}=s,t=F(),N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N={},e[0]=N):N=e[0];let C=Q??"",k;e[1]!==C?(k={shardKey:C},e[1]=C,e[2]=k):k=e[2];let{data:w,error:d,errorSource:D,isLoading:K}=P(R.getSettings,N,k),j;e:{let a=w?.deploy;if(a===void 0){let n;e[3]===Symbol.for("react.memo_cache_sentinel")?(n=[],e[3]=n):n=e[3],j=n;break e}let i;if(e[4]!==a.deploymentId||e[5]!==a.environment||e[6]!==a.versionTag||e[7]!==a.workerUrl||e[8]!==t){if(i=[],a.workerUrl!==void 0){let n;e[10]!==t?(n=t("URL"),e[10]=t,e[11]=n):n=e[11];let l;e[12]!==a.workerUrl||e[13]!==n?(l={label:n,value:a.workerUrl},e[12]=a.workerUrl,e[13]=n,e[14]=l):l=e[14],i.push(l)}if(a.environment!==void 0){let n;e[15]!==t?(n=t("Environment"),e[15]=t,e[16]=n):n=e[16];let l;e[17]!==a.environment||e[18]!==n?(l={label:n,value:a.environment},e[17]=a.environment,e[18]=n,e[19]=l):l=e[19],i.push(l)}if(a.deploymentId!==void 0){let n;e[20]!==t?(n=t("Deployment"),e[20]=t,e[21]=n):n=e[21];let l;e[22]!==a.deploymentId||e[23]!==n?(l={label:n,value:a.deploymentId},e[22]=a.deploymentId,e[23]=n,e[24]=l):l=e[24],i.push(l)}if(a.versionTag!==void 0){let n;e[25]!==t?(n=t("Version"),e[25]=t,e[26]=n):n=e[26];let l;e[27]!==a.versionTag||e[28]!==n?(l={label:n,value:a.versionTag},e[27]=a.versionTag,e[28]=n,e[29]=l):l=e[29],i.push(l)}e[4]=a.deploymentId,e[5]=a.environment,e[6]=a.versionTag,e[7]=a.workerUrl,e[8]=t,e[9]=i}else i=e[9];j=i}let I=j,T;e[30]!==w?.settings?(T=w?.settings??[],e[30]=w?.settings,e[31]=T):T=e[31];let o=T,m;e[32]!==t?(m=t("Open in Cloudflare"),e[32]=t,e[33]=m):m=e[33];let c;e[34]!==m?(c=(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:H,rel:"noreferrer",target:"_blank",children:m})}),e[34]=m,e[35]=c):c=e[35];let p;e[36]!==t?(p=t("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[36]=t,e[37]=p):p=e[37];let h;e[38]!==p?(h=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:p}),e[38]=p,e[39]=h):h=e[39];let u;e[40]!==d||e[41]!==D?(u=d!==null&&(0,r.jsx)(q,{error:D,testId:"set-error"}),e[40]=d,e[41]=D,e[42]=u):u=e[42];let f;e[43]!==I||e[44]!==t?(f=I.length>0&&(0,r.jsxs)(O,{className:"py-0","data-testid":"set-deploy",children:[(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Deployment")})}),(0,r.jsx)(V,{className:"py-3",children:(0,r.jsx)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:I.map(Z)})})]}),e[43]=I,e[44]=t,e[45]=f):f=e[45];let g;e[46]!==t?(g=t("Environment & bindings"),e[46]=t,e[47]=g):g=e[47];let v;e[48]!==g?(v=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:g})}),e[48]=g,e[49]=v):v=e[49];let x;e[50]!==d||e[51]!==K||e[52]!==o.length||e[53]!==t?(x=d===null&&!K&&o.length===0&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:t("No environment variables or bindings.")}),e[50]=d,e[51]=K,e[52]=o.length,e[53]=t,e[54]=x):x=e[54];let y;e[55]!==o||e[56]!==t?(y=o.length>0&&(0,r.jsx)(V,{className:"px-0 py-0",children:(0,r.jsxs)(z,{"data-testid":"set-table",children:[(0,r.jsx)(B,{children:(0,r.jsxs)(A,{children:[(0,r.jsx)(_,{children:t("name")}),(0,r.jsx)(_,{children:t("kind")}),(0,r.jsx)(_,{children:t("value")})]})}),(0,r.jsx)(G,{children:o.map(ee)})]})}),e[55]=o,e[56]=t,e[57]=y):y=e[57];let b;e[58]!==v||e[59]!==x||e[60]!==y?(b=(0,r.jsxs)(O,{className:"py-0",children:[v,x,y]}),e[58]=v,e[59]=x,e[60]=y,e[61]=b):b=e[61];let U;return e[62]!==u||e[63]!==f||e[64]!==b||e[65]!==c||e[66]!==h?(U=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-settings",children:[c,h,u,f,b]}),e[62]=u,e[63]=f,e[64]=b,e[65]=c,e[66]=h,e[67]=U):U=e[67],U},"de");function Z(s){return(0,r.jsxs)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,r.jsx)("dt",{className:"text-muted-foreground",children:s.label}),(0,r.jsx)("dd",{className:"truncate font-mono text-xs",title:s.value,children:s.value})]},s.label)}S(Z,"H");function ee(s){return(0,r.jsxs)(A,{"data-testid":"set-row",children:[(0,r.jsx)(E,{className:"font-mono text-xs font-medium",children:s.name}),(0,r.jsx)(E,{children:(0,r.jsx)(M,{variant:Y[s.kind],children:s.bindingType??s.kind})}),(0,r.jsx)(E,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:s.value??(0,r.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},s.name)}S(ee,"Q");export{me as SettingsPanel};