@lunora/studio 1.0.0-alpha.144 → 1.0.0-alpha.145
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +1 -1
- package/dist/mount.d.mts +1 -1
- package/dist/mount.d.ts +1 -1
- package/dist/mount.mjs +1 -1
- package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -1
- package/dist/packem_chunks/ApiTab.mjs +1 -1
- package/dist/packem_chunks/AuditPanel.mjs +1 -1
- package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -1
- package/dist/packem_chunks/ExportImportPanel.mjs +1 -1
- package/dist/packem_chunks/FileBrowser.mjs +1 -1
- package/dist/packem_chunks/FunctionRunner.mjs +1 -1
- package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -1
- package/dist/packem_chunks/HealthPanel.mjs +1 -1
- package/dist/packem_chunks/InsightsPanel.mjs +1 -1
- package/dist/packem_chunks/LogsPanel.mjs +1 -1
- package/dist/packem_chunks/MailPanel.mjs +1 -1
- package/dist/packem_chunks/MetricsPanel.mjs +1 -1
- package/dist/packem_chunks/NotificationsPanel.mjs +1 -1
- package/dist/packem_chunks/PitrPanel.mjs +1 -1
- package/dist/packem_chunks/SchemaViewer.mjs +1 -1
- package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -1
- package/dist/packem_chunks/SettingsPanel.mjs +1 -1
- package/dist/packem_chunks/SqlEditorPanel.mjs +1 -1
- package/dist/packem_chunks/TableEditor.mjs +1 -1
- package/dist/packem_chunks/agents-panel.mjs +1 -1
- package/dist/packem_chunks/analytics-panel.mjs +1 -1
- package/dist/packem_chunks/auth-audit-panel.mjs +1 -1
- package/dist/packem_chunks/auth-config-panel.mjs +1 -1
- package/dist/packem_chunks/auth-sessions-panel.mjs +1 -1
- package/dist/packem_chunks/containers-panel.mjs +1 -1
- package/dist/packem_chunks/dashboards-panel.mjs +1 -1
- package/dist/packem_chunks/evals-panel.mjs +1 -1
- package/dist/packem_chunks/fanout-panel.mjs +1 -1
- package/dist/packem_chunks/flags-panel.mjs +1 -1
- package/dist/packem_chunks/issues-panel.mjs +1 -1
- package/dist/packem_chunks/kv-browser.mjs +1 -1
- package/dist/packem_chunks/log-drains-panel.mjs +1 -1
- package/dist/packem_chunks/migrations-route.mjs +1 -1
- package/dist/packem_chunks/organizations-panel.mjs +1 -1
- package/dist/packem_chunks/payments-panel.mjs +1 -1
- package/dist/packem_chunks/permissions-panel.mjs +1 -1
- package/dist/packem_chunks/queues-panel.mjs +1 -1
- package/dist/packem_chunks/reactors-panel.mjs +1 -1
- package/dist/packem_chunks/rls-panel.mjs +1 -1
- package/dist/packem_chunks/schedule-panel.mjs +1 -1
- package/dist/packem_chunks/storage-rules-panel.mjs +1 -1
- package/dist/packem_chunks/subscriptions-panel.mjs +1 -1
- package/dist/packem_chunks/sync-client-panel.mjs +1 -1
- package/dist/packem_chunks/traces-panel.mjs +1 -1
- package/dist/packem_chunks/users-panel.mjs +1 -1
- package/dist/packem_chunks/vector-browser.mjs +1 -1
- package/dist/packem_chunks/workflows-panel.mjs +1 -1
- package/dist/packem_shared/{ApiDocsPanel-l4DQX1Vq.mjs → ApiDocsPanel-CHCIjzZu.mjs} +1 -1
- package/dist/packem_shared/{ApiReferencePanel--YThTzHb.mjs → ApiReferencePanel-Cqy9Z7mO.mjs} +1 -1
- package/dist/packem_shared/{CommandPalette-C4UrhLxv.mjs → CommandPalette-DtLEYVhX.mjs} +1 -1
- package/dist/packem_shared/DataBrowser-Bf32rBcr.mjs +4 -0
- package/dist/packem_shared/{GlobalDataBrowser-DK4fgb7h.mjs → GlobalDataBrowser-CDpzXZxj.mjs} +1 -1
- package/dist/packem_shared/{HomePanel-B869m6wb.mjs → HomePanel-4gpRjcch.mjs} +1 -1
- package/dist/packem_shared/{MigrationsPanel-BZJ_Rv4t.mjs → MigrationsPanel-Cz0x3Pv6.mjs} +1 -1
- package/dist/packem_shared/{OpenRpcReferencePanel-Bn5UVD7s.mjs → OpenRpcReferencePanel-DZicbIOf.mjs} +1 -1
- package/dist/packem_shared/{ScheduledJobs-Db0HZ8R9.mjs → ScheduledJobs-BWziDVZO.mjs} +1 -1
- package/dist/packem_shared/{Studio-UxOpDgEl.mjs → Studio-C_yEjXcG.mjs} +1 -1
- package/dist/packem_shared/StudioApp-BQAxVB3v.mjs +1 -0
- package/dist/packem_shared/{advisor-view-DoSv436g.mjs → advisor-view-DyXQCN4y.mjs} +1 -1
- package/dist/packem_shared/{app.d-DFjg4Uki.d.mts → app.d-BbmO2HA2.d.mts} +25 -8
- package/dist/packem_shared/{app.d-DFjg4Uki.d.ts → app.d-BbmO2HA2.d.ts} +25 -8
- package/dist/packem_shared/{data-grid-BqNXJ9PF.mjs → data-grid-B8WGnT-5.mjs} +1 -1
- package/dist/packem_shared/{error-alert-CWs6gA3I.mjs → error-alert-ClpDVYvo.mjs} +1 -1
- package/dist/packem_shared/{grid-features-D8w5isjt.mjs → grid-features-CGs2pKcr.mjs} +1 -1
- package/dist/packem_shared/{home-panel-ChKczU0I.mjs → home-panel-CHtt8k50.mjs} +1 -1
- package/dist/packem_shared/{internal-CwaF9YNk.mjs → internal-D4gBuklE.mjs} +1 -1
- package/dist/packem_shared/{log-line-Dzg4YZ-K.mjs → log-line-DpRfHaVQ.mjs} +1 -1
- package/dist/packem_shared/{recording-client-BGyq5_JP.mjs → recording-client-CMvFFEC0.mjs} +1 -1
- package/dist/packem_shared/{reference-view-CZxBZSRo.mjs → reference-view-DS7FFPpP.mjs} +1 -1
- package/dist/packem_shared/{schema-diagram-DU83ObYH.mjs → schema-diagram-C27ETi10.mjs} +1 -1
- package/dist/packem_shared/{sql-result-table-DysT8h5P.mjs → sql-result-table-BLIMecXM.mjs} +1 -1
- package/dist/packem_shared/{studio-DE8N0tIQ.mjs → studio-DF0GqQBP.mjs} +1 -1
- package/dist/packem_shared/{table-list-sidebar-T7--Fv-V.mjs → table-list-sidebar-DKpSAP6p.mjs} +1 -1
- package/dist/packem_shared/use-admin-query-BvZH4unR.mjs +1 -0
- package/dist/packem_shared/{use-async-submit-DAKymxcP.mjs → use-async-submit-C1A11ka9.mjs} +1 -1
- package/dist/packem_shared/{use-auth-config-o-FcIXzR.mjs → use-auth-config-DocoJ5uQ.mjs} +1 -1
- package/dist/packem_shared/{use-open-trace-B5LJ96_0.mjs → use-open-trace-CTQIPjo9.mjs} +1 -1
- package/dist/packem_shared/{use-sql-assistant-Ib7Ik6cw.mjs → use-sql-assistant-BGoWYcGL.mjs} +1 -1
- package/dist/packem_shared/{wire-codec-DGcjNTbZ.mjs → wire-codec-BE-vgg1L.mjs} +1 -1
- package/dist/standalone/{chunk-N6Q4ORVH.js → chunk-2IRZXHAZ.js} +1 -1
- package/dist/standalone/{chunk-WQWZR452.js → chunk-2IUHQB2Q.js} +1 -1
- package/dist/standalone/{chunk-MFXZDB7X.js → chunk-2KAH7DVZ.js} +1 -1
- package/dist/standalone/{chunk-JWORA33E.js → chunk-3BFUVYWS.js} +1 -1
- package/dist/standalone/{chunk-3ILVYCWG.js → chunk-3DL3MLWV.js} +1 -1
- package/dist/standalone/{chunk-X6GR3SDI.js → chunk-3HEXTCWR.js} +1 -1
- package/dist/standalone/{chunk-NBC6NJFJ.js → chunk-3JV5F5SY.js} +1 -1
- package/dist/standalone/{chunk-S6K7T563.js → chunk-447V2Q3F.js} +1 -1
- package/dist/standalone/{chunk-E3AFG6TS.js → chunk-46XX646F.js} +1 -1
- package/dist/standalone/{chunk-7QRRR3K6.js → chunk-5JEYBOS6.js} +1 -1
- package/dist/standalone/{chunk-DNNLYDKX.js → chunk-5L3SHBMK.js} +1 -1
- package/dist/standalone/{chunk-2WVC52MX.js → chunk-6NO6WOSN.js} +1 -1
- package/dist/standalone/{chunk-DEJLINCJ.js → chunk-6T3STPM7.js} +1 -1
- package/dist/standalone/chunk-7AU5QSY7.js +1 -0
- package/dist/standalone/{chunk-YBWZUB6A.js → chunk-7B3OQXWL.js} +1 -1
- package/dist/standalone/{chunk-ZQ2PIQE4.js → chunk-7MJY23GU.js} +1 -1
- package/dist/standalone/{chunk-MMSQ35RC.js → chunk-AJQKSUVQ.js} +1 -1
- package/dist/standalone/{chunk-4RPBRBOA.js → chunk-B5WPIRI3.js} +1 -1
- package/dist/standalone/{chunk-BAKGFOG4.js → chunk-BN5TOI5O.js} +1 -1
- package/dist/standalone/chunk-BQ4P3PLU.js +1 -0
- package/dist/standalone/{chunk-HD7R6NQT.js → chunk-CIQRB2ET.js} +1 -1
- package/dist/standalone/{chunk-KASQ7MFV.js → chunk-CKKZCUAV.js} +1 -1
- package/dist/standalone/{chunk-P3MCKI2S.js → chunk-CZU3LZ2O.js} +1 -1
- package/dist/standalone/{chunk-FSOA4SEY.js → chunk-DDI4VSJH.js} +1 -1
- package/dist/standalone/{chunk-SNHEWTJY.js → chunk-DMPVOWA7.js} +1 -1
- package/dist/standalone/{chunk-BOEMUL7H.js → chunk-E6LDY3TC.js} +1 -1
- package/dist/standalone/{chunk-IFLTA2OD.js → chunk-E723DEAW.js} +1 -1
- package/dist/standalone/{chunk-URVSYGSQ.js → chunk-EDYGNYP2.js} +1 -1
- package/dist/standalone/{chunk-WISI2EBQ.js → chunk-EX33M5EE.js} +1 -1
- package/dist/standalone/{chunk-24XD27OU.js → chunk-FZKQX74O.js} +1 -1
- package/dist/standalone/{chunk-YW3RHFAI.js → chunk-GMEE5NFG.js} +1 -1
- package/dist/standalone/{chunk-BGAQFHQC.js → chunk-H3UCYGKY.js} +1 -1
- package/dist/standalone/{chunk-VGGVQFKU.js → chunk-H5PZ7JXM.js} +1 -1
- package/dist/standalone/{chunk-6HKQM3CN.js → chunk-HDWOQTDN.js} +1 -1
- package/dist/standalone/{chunk-FOILW5QP.js → chunk-HLE46T7J.js} +1 -1
- package/dist/standalone/{chunk-VNK6MRM6.js → chunk-HQPQTWW4.js} +1 -1
- package/dist/standalone/{chunk-NK7VUSL2.js → chunk-IAWCSJRR.js} +1 -1
- package/dist/standalone/chunk-IB3MWLG4.js +1 -0
- package/dist/standalone/{chunk-Y3YXQ6EU.js → chunk-IDB7SMQU.js} +1 -1
- package/dist/standalone/{chunk-IYS3RM7B.js → chunk-IYYZMNOB.js} +1 -1
- package/dist/standalone/{chunk-DZVEJZ3C.js → chunk-JMNCMGSE.js} +1 -1
- package/dist/standalone/chunk-JOQUDV7F.js +1 -0
- package/dist/standalone/{chunk-V4EMZ3HJ.js → chunk-JRN7SEJN.js} +1 -1
- package/dist/standalone/{chunk-XDLUQ6RQ.js → chunk-JSXJND3V.js} +1 -1
- package/dist/standalone/{chunk-SOUQNAE7.js → chunk-KLQEN4KA.js} +1 -1
- package/dist/standalone/{chunk-S73X6JFA.js → chunk-L2OWXMYF.js} +1 -1
- package/dist/standalone/{chunk-2BN33A2H.js → chunk-L3JA4OKZ.js} +1 -1
- package/dist/standalone/{chunk-6DHQ3IIO.js → chunk-MDVH5C5A.js} +1 -1
- package/dist/standalone/{chunk-ADDPGZY7.js → chunk-MHLBCDVW.js} +1 -1
- package/dist/standalone/{chunk-V7665E6Y.js → chunk-MJG6GTPL.js} +1 -1
- package/dist/standalone/{chunk-Y4Q25F6X.js → chunk-NXKPFGOP.js} +1 -1
- package/dist/standalone/{chunk-LSRUM2JJ.js → chunk-OUD7BAWE.js} +1 -1
- package/dist/standalone/{chunk-DMAQKIMP.js → chunk-PEEGF7YA.js} +2 -2
- package/dist/standalone/{chunk-TFNVT4ZJ.js → chunk-PWHV7BUN.js} +1 -1
- package/dist/standalone/{chunk-H2GRI4BS.js → chunk-QPVND4TE.js} +1 -1
- package/dist/standalone/{chunk-2V436GDL.js → chunk-RFTFYKFL.js} +1 -1
- package/dist/standalone/{chunk-UODFNQOY.js → chunk-RIO2HPN7.js} +4 -4
- package/dist/standalone/{chunk-Q2Q4UUXS.js → chunk-RNZ7XXND.js} +1 -1
- package/dist/standalone/{chunk-SSNHCN4D.js → chunk-SMVAE2AQ.js} +1 -1
- package/dist/standalone/{chunk-I5OKDKON.js → chunk-TWXJF4C2.js} +1 -1
- package/dist/standalone/{chunk-OJN5A2JI.js → chunk-UKQTCLDK.js} +4 -4
- package/dist/standalone/{chunk-7MXYEEMC.js → chunk-UZ5QI3PB.js} +1 -1
- package/dist/standalone/{chunk-MZXZ2XVQ.js → chunk-V5M356X3.js} +1 -1
- package/dist/standalone/{chunk-2OLPNCFW.js → chunk-VHMOFAJT.js} +1 -1
- package/dist/standalone/{chunk-MFMUFECI.js → chunk-VSHZE77Y.js} +1 -1
- package/dist/standalone/{chunk-6VDI4D53.js → chunk-VXWAQW3F.js} +1 -1
- package/dist/standalone/chunk-W3Q32C24.js +11 -0
- package/dist/standalone/{chunk-KDELXUQD.js → chunk-XABVLLMA.js} +1 -1
- package/dist/standalone/{chunk-ESVQSHW2.js → chunk-XGPF7VOP.js} +1 -1
- package/dist/standalone/{chunk-XTMBNA4V.js → chunk-YL7OENDU.js} +1 -1
- package/dist/standalone/{chunk-VAMUCQ75.js → chunk-YWYJLVEP.js} +1 -1
- package/dist/standalone/{chunk-OOKV3V3X.js → chunk-ZZENQM5W.js} +1 -1
- package/dist/standalone/studio.js +2 -2
- package/package.json +6 -6
- package/dist/packem_shared/DataBrowser-C2B-HNOL.mjs +0 -4
- package/dist/packem_shared/StudioApp-BdisV3FN.mjs +0 -1
- package/dist/packem_shared/use-admin-query-C7JRlFIE.mjs +0 -1
- package/dist/standalone/chunk-5NCE6W7L.js +0 -1
- package/dist/standalone/chunk-HWBXHONF.js +0 -1
- package/dist/standalone/chunk-IP6LZ2OL.js +0 -1
- package/dist/standalone/chunk-OT4I4LMO.js +0 -1
- package/dist/standalone/chunk-PPNBTM7O.js +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useState as Y}from"react";import{E as I}from"../packem_shared/error-alert-
|
|
1
|
+
import{useState as Y}from"react";import{E as I}from"../packem_shared/error-alert-ClpDVYvo.mjs";import{B as N}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as q}from"../packem_shared/button-q0UYSmrn.mjs";import{C as R,a as $}from"../packem_shared/card--2hKx4L2.mjs";import{E as j}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as K,a as L,b as p,c as o,d as P,e as d}from"../packem_shared/table-D0SBiDu-.mjs";import{u as f}from"../packem_shared/use-admin-query-BvZH4unR.mjs";import{useT as Z}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as x}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{i as ee}from"../packem_shared/internal-D4gBuklE.mjs";import{jsx as e,jsxs as l}from"react/jsx-runtime";const D="agent_threads",te="agent_messages",M="agent_run_queue",H=100,ae=250,se={},re={filters:[],limit:H,offset:0,orderBy:{column:"updatedAt",direction:"desc"},skipCount:!0,table:D},i=(r,t)=>{const s=r[t];return typeof s=="string"?s:void 0},A=(r,t)=>{const s=r[t];return typeof s=="number"?s:void 0},U=r=>{const{usage:t}=r;if(t===null||typeof t!="object")return;const{totalTokens:s}=t;return typeof s=="number"?s:void 0},ne=r=>{const{toolCalls:t}=r;return Array.isArray(t)?t.map(s=>s!==null&&typeof s=="object"?s.name:void 0).filter(s=>typeof s=="string"):[]},oe=r=>{switch(r){case"awaiting_input":return"warning";case"cancelled":return"warning";case"error":return"destructive";case"running":return"info";default:return"outline"}},de=r=>{switch(r){case"approved":return"success";case"rejected":return"destructive";default:return"warning"}},be=({initialShardKey:r=""})=>{const t=Z(),[s,T]=Y(void 0),{data:c}=f(x.listTables,se,{live:!0,shardKey:r}),G=c!==void 0,m=Array.isArray(c)&&c.some(a=>a.name===D),Q=Array.isArray(c)&&c.some(a=>a.name===M),{data:E,error:_,errorSource:z,liveError:O}=f(x.readTablePage,re,{enabled:m,live:!0,shardKey:r}),V={filters:[{column:"threadKey",operator:"eq",value:s??""}],limit:ae,offset:0,orderBy:{column:"seq",direction:"asc"},skipCount:!0,table:te},{data:S}=f(x.readTablePage,{limit:H,offset:0,orderBy:{column:"position",direction:"asc"},skipCount:!0,table:M},{enabled:Q,live:!0,shardKey:r}),{data:k,error:F,errorSource:J}=f(x.readTablePage,V,{enabled:m&&s!==void 0,live:!0,shardKey:r}),v=Array.isArray(E?.rows)?E.rows:[],W=Array.isArray(S?.rows)?S.rows:[],w=a=>W.filter(n=>i(n,"threadKey")===a).length,C=Array.isArray(k?.rows)?k.rows:[],B=v.find(a=>i(a,"key")===s);let h;return G&&!m?h=e(j,{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")}):m&&v.length===0?h=e(j,{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=l("div",{className:"flex flex-col gap-6",children:[e(R,{className:"overflow-hidden py-0",children:e($,{className:"px-0",children:l(K,{"data-testid":"agents-threads-table",children:[e(L,{children:l(p,{children:[e(o,{children:t("Agent")}),e(o,{children:t("Key")}),e(o,{children:t("Status")}),e(o,{children:t("Queued")}),e(o,{children:t("Messages")}),e(o,{children:t("Tokens")}),e(o,{children:t("Updated")}),e(o,{"aria-label":t("Actions")})]})}),e(P,{children:v.map(a=>{const n=i(a,"key")??"",u=i(a,"status"),g=U(a);return l(p,{"data-active":n===s?"":void 0,"data-testid":`agents-thread-${n}`,children:[e(d,{className:"font-mono text-xs",children:i(a,"agent")??"—"}),e(d,{className:"font-mono text-xs text-muted-foreground",children:n}),e(d,{children:e(N,{"data-testid":`agents-thread-status-${n}`,variant:oe(u),children:u??"—"})}),e(d,{className:"tabular-nums",children:w(n)===0?e("span",{className:"text-muted-foreground",children:"—"}):e(N,{"data-testid":`agents-thread-queued-${n}`,variant:"warning",children:w(n)})}),e(d,{className:"tabular-nums",children:A(a,"messageCount")??"—"}),e(d,{className:"tabular-nums text-muted-foreground",children:g??"—"}),e(d,{className:"text-muted-foreground tabular-nums",children:ee(A(a,"updatedAt"),"—")}),e(d,{className:"text-right",children:e(q,{"data-testid":`agents-thread-open-${n}`,onClick:()=>{T(n)},size:"sm",type:"button",variant:"outline",children:t("Timeline")})})]},n)})})]})})}),F!==null&&e(I,{error:J,testId:"agents-messages-error"}),s!==void 0&&e(R,{className:"overflow-hidden py-0","data-testid":"agents-thread-detail",children:l($,{className:"flex flex-col gap-3 px-4 py-3",children:[l("div",{className:"flex items-center justify-between gap-2",children:[l("span",{className:"font-mono text-xs",children:[t("Timeline")," · ",s,B!==void 0&&l("span",{className:"text-muted-foreground",children:[" · ",t("Usage"),": ",U(B)??0," ",t("Tokens")]})]}),e(q,{"data-testid":"agents-thread-detail-close",onClick:()=>{T(void 0)},size:"xs",type:"button",variant:"ghost",children:t("Close")})]}),C.length===0?e("p",{className:"text-xs text-muted-foreground",children:t("This thread has no messages yet.")}):l(K,{"data-testid":"agents-messages-table",children:[e(L,{children:l(p,{children:[e(o,{children:t("Role")}),e(o,{children:t("Content")}),e(o,{children:t("Tool")}),e(o,{children:t("Approval")})]})}),e(P,{children:C.map((a,n)=>{const u=i(a,"role")??"—",g=ne(a),X=i(a,"toolName"),y=i(a,"status"),b=A(a,"seq")??n;return l(p,{"data-testid":`agents-message-${String(b)}`,children:[e(d,{className:"font-mono text-xs align-top text-muted-foreground",children:u}),e(d,{className:"max-w-md font-mono text-xs whitespace-pre-wrap break-words",children:i(a,"content")??"—"}),e(d,{className:"font-mono text-xs align-top text-muted-foreground",children:X??(g.length>0?g.join(", "):"—")}),e(d,{className:"align-top",children:y===void 0?e("span",{className:"text-xs text-muted-foreground",children:"—"}):e(N,{"data-testid":`agents-message-approval-${String(b)}`,variant:de(y),children:y})})]},i(a,"messageKey")??`${u}:${String(b)}`)})})]})]})})]}),l("div",{className:"flex flex-col gap-6","data-testid":"lunora-agents-panel",children:[_!==null&&e(I,{error:z,testId:"agents-error"}),e("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.")}),O!==void 0&&e("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]})};export{be as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as R}from"react/compiler-runtime";import{useState as L,useCallback as k,useEffect as C}from"react";import{C as I}from"../packem_shared/card--2hKx4L2.mjs";import{E as N}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as w,a as _,b as E,d as M,e as v,c as O}from"../packem_shared/table-D0SBiDu-.mjs";import{useT as S}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{b as B,f as D,h as P}from"../packem_shared/internal-
|
|
1
|
+
import{c as R}from"react/compiler-runtime";import{useState as L,useCallback as k,useEffect as C}from"react";import{C as I}from"../packem_shared/card--2hKx4L2.mjs";import{E as N}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as w,a as _,b as E,d as M,e as v,c as O}from"../packem_shared/table-D0SBiDu-.mjs";import{useT as S}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{b as B,f as D,h as P}from"../packem_shared/internal-D4gBuklE.mjs";import{jsx as l,jsxs as x}from"react/jsx-runtime";const q="ANALYTICS",g=[{key:"volume",sql:a=>`SELECT blob2 AS fn, count() AS calls FROM ${a} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY calls DESC LIMIT 25`,title:"Request volume per function"},{key:"latency",sql:a=>`SELECT blob2 AS fn, quantileWeighted(0.50)(double1, _sample_interval) AS p50, quantileWeighted(0.95)(double1, _sample_interval) AS p95 FROM ${a} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY p95 DESC LIMIT 25`,title:"Latency p50 / p95 per function"},{key:"hotShards",sql:a=>`SELECT blob3 AS shard, count() AS calls FROM ${a} WHERE blob1 = 'function_call' GROUP BY shard ORDER BY calls DESC LIMIT 25`,title:"Hot shards"}],Y={error:null,loading:!0,result:null},H=a=>{const e=R(27),{state:h,title:d}=a,s=S(),{error:n,loading:r,result:t}=h,i=`analytics-panel-${d}`;let o;e[0]!==s||e[1]!==d?(o=s(d),e[0]=s,e[1]=d,e[2]=o):o=e[2];let c;e[3]!==o?(c=l("header",{className:"border-b border-border px-4 py-3",children:l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[3]=o,e[4]=c):c=e[4];let u;e[5]!==r||e[6]!==s?(u=r&&l("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-loading",children:s("Loading…")}),e[5]=r,e[6]=s,e[7]=u):u=e[7];let p;e[8]!==n||e[9]!==r?(p=!r&&n!==null&&l("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"analytics-error",role:"alert",children:n}),e[8]=n,e[9]=r,e[10]=p):p=e[10];let f;e[11]!==n||e[12]!==r||e[13]!==t||e[14]!==s?(f=!r&&n===null&&t!==null&&t.rows.length===0&&l("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-empty-rows",children:s("No data points yet.")}),e[11]=n,e[12]=r,e[13]=t,e[14]=s,e[15]=f):f=e[15];let m;e[16]!==n||e[17]!==r||e[18]!==t?(m=!r&&n===null&&t!==null&&t.rows.length>0&&x(w,{children:[l(_,{children:l(E,{children:t.columns.map(W)})}),l(M,{children:t.rows.map((T,A)=>l(E,{children:t.columns.map(b=>l(v,{className:"font-mono text-xs",children:P(T[b.name])},b.name))},A))})]}),e[16]=n,e[17]=r,e[18]=t,e[19]=m):m=e[19];let y;return e[20]!==i||e[21]!==c||e[22]!==u||e[23]!==p||e[24]!==f||e[25]!==m?(y=x(I,{className:"gap-0 py-0","data-testid":i,children:[c,u,p,f,m]}),e[20]=i,e[21]=c,e[22]=u,e[23]=p,e[24]=f,e[25]=m,e[26]=y):y=e[26],y},J=({dataset:a=q,runQuery:e}={})=>{const h=S(),[d,s]=L({}),n=e??null,r=k(async t=>{if(n!==null)for(const i of g){if(t.cancelled)return;s(o=>({...o,[i.key]:{error:null,loading:!0,result:null}}));try{const o=await n(i.sql(a));t.cancelled||s(c=>({...c,[i.key]:{error:null,loading:!1,result:o}}))}catch(o){t.cancelled||s(c=>({...c,[i.key]:{error:B(o),loading:!1,result:null}}))}}},[n,a]);return C(()=>{const t={cancelled:!1};return D(r(t)),()=>{t.cancelled=!0}},[r]),n===null?l(N,{description:h("Analytics Engine reads need an account-scoped Cloudflare API token, which cannot be shipped to a browser. The host must pass studio.analyticsQuery — a runner that proxies the SQL through your worker — to enable these panels."),icon:l("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:l("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"})}),testId:"analytics-not-configured",title:h("Analytics usage panels are not wired up.")}):l("div",{className:"flex flex-col gap-4","data-testid":"lunora-analytics-panel",children:g.map(t=>l(H,{state:d[t.key]??Y,title:t.title},t.key))})};function W(a){return l(O,{children:a.name},a.name)}export{J as AnalyticsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as R}from"react/compiler-runtime";import{useState as k}from"react";import{E as q}from"../packem_shared/error-alert-
|
|
1
|
+
import{c as R}from"react/compiler-runtime";import{useState as k}from"react";import{E as q}from"../packem_shared/error-alert-ClpDVYvo.mjs";import{B as j}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as z}from"../packem_shared/button-q0UYSmrn.mjs";import{C as D,a as M}from"../packem_shared/card--2hKx4L2.mjs";import{E as O}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as Q}from"../packem_shared/input-CXhxesPC.mjs";import{T as U,a as $,b as F,c as N,d as G,e as w}from"../packem_shared/table-D0SBiDu-.mjs";import{u as J}from"../packem_shared/use-admin-query-BvZH4unR.mjs";import{useT as K}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as V}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{i as W}from"../packem_shared/internal-D4gBuklE.mjs";import{jsx as a,jsxs as l}from"react/jsx-runtime";const ne=()=>{const e=R(39),t=K(),[o,H]=k("");let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const{data:L,error:i,errorSource:S,isLoading:E,refetch:B}=J(V.getAuthAuditLog,b);let A;if(e[1]!==L?.entries||e[2]!==o){const r=L?.entries??[],x=o.trim().toLowerCase();A=x===""?r:r.filter(C=>C.event.toLowerCase().includes(x)||(C.actorId??"").toLowerCase().includes(x)||(C.actorEmail??"").toLowerCase().includes(x)||(C.ip??"").toLowerCase().includes(x)||C.outcome.toLowerCase().includes(x)),e[1]=L?.entries,e[2]=o,e[3]=A}else A=e[3];const s=A;let I;e[4]===Symbol.for("react.memo_cache_sentinel")?(I=r=>{H(r.target.value)},e[4]=I):I=e[4];const P=I;let c;e[5]!==t?(c=t("Filter security events"),e[5]=t,e[6]=c):c=e[6];let n;e[7]!==t?(n=t("filter event, actor, IP"),e[7]=t,e[8]=n):n=e[8];let d;e[9]!==o||e[10]!==c||e[11]!==n?(d=a(Q,{"aria-label":c,className:"h-8 w-56","data-testid":"aa-search",onChange:P,placeholder:n,value:o}),e[9]=o,e[10]=c,e[11]=n,e[12]=d):d=e[12];let m;e[13]!==B?(m=()=>{B()},e[13]=B,e[14]=m):m=e[14];let u;e[15]!==t?(u=t("Refresh"),e[15]=t,e[16]=u):u=e[16];let h;e[17]!==m||e[18]!==u?(h=a(z,{"data-testid":"aa-refresh",onClick:m,size:"xs",type:"button",variant:"ghost",children:u}),e[17]=m,e[18]=u,e[19]=h):h=e[19];let f;e[20]!==d||e[21]!==h?(f=l("div",{className:"flex flex-wrap items-center gap-2",children:[d,h]}),e[20]=d,e[21]=h,e[22]=f):f=e[22];let p;e[23]!==i||e[24]!==S?(p=i!==null&&a(q,{error:S,testId:"aa-error"}),e[23]=i,e[24]=S,e[25]=p):p=e[25];let g;e[26]!==i||e[27]!==s.length||e[28]!==E||e[29]!==t?(g=i===null&&!E&&s.length===0&&a(O,{description:t("Authentication and security events are recorded here."),testId:"aa-empty",title:t("No security events.")}),e[26]=i,e[27]=s.length,e[28]=E,e[29]=t,e[30]=g):g=e[30];let v;e[31]!==s||e[32]!==t?(v=s.length>0&&a(D,{className:"overflow-hidden py-0",children:a(M,{className:"max-h-[30rem] overflow-auto px-0",children:l(U,{"data-testid":"aa-table",children:[a($,{children:l(F,{children:[a(N,{children:t("time")}),a(N,{children:t("event")}),a(N,{children:t("actor")}),a(N,{children:t("ip / user agent")}),a(N,{children:t("outcome")})]})}),a(G,{children:s.map(r=>l(F,{"data-testid":"aa-row",children:[a(w,{className:"text-muted-foreground tabular-nums",children:W(r.ts,"—")}),a(w,{children:a(j,{variant:"secondary",children:r.event})}),a(w,{className:"max-w-[24ch] truncate font-mono text-xs",title:r.actorId??void 0,children:r.actorEmail??r.actorId??a("span",{className:"text-muted-foreground",children:"—"})}),l(w,{className:"max-w-[28ch] truncate text-xs text-muted-foreground",title:r.userAgent??void 0,children:[r.ip??a("span",{className:"text-muted-foreground",children:"—"}),r.userAgent!==void 0&&l("span",{className:"ml-1 opacity-70",children:["· ",r.userAgent]})]}),a(w,{children:a(j,{variant:r.outcome==="failure"?"destructive":"outline",children:t(r.outcome)})})]},r.seq))})]})})}),e[31]=s,e[32]=t,e[33]=v):v=e[33];let T;return e[34]!==p||e[35]!==g||e[36]!==v||e[37]!==f?(T=l("div",{className:"flex flex-col gap-4","data-testid":"lunora-auth-audit",children:[f,p,g,v]}),e[34]=p,e[35]=g,e[36]=v,e[37]=f,e[38]=T):T=e[38],T};export{ne as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as N}from"react/compiler-runtime";import{useLunora as C}from"@lunora/react";import{B as x}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as w,a as I}from"../packem_shared/card--2hKx4L2.mjs";import{b as A}from"../packem_shared/use-admin-query-
|
|
1
|
+
import{c as N}from"react/compiler-runtime";import{useLunora as C}from"@lunora/react";import{B as x}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as w,a as I}from"../packem_shared/card--2hKx4L2.mjs";import{b as A}from"../packem_shared/use-admin-query-BvZH4unR.mjs";import{useT as $}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{jsx as t,jsxs as d,Fragment as y}from"react/jsx-runtime";const S=[{key:"accounts",label:"Accounts"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],v=e=>{if(e===void 0)return"—";const i=[[86400,"d"],[3600,"h"],[60,"m"]];for(const[a,o]of i)if(e>=a&&e%a===0)return`${String(e/a)}${o}`;return`${String(e)}s`},h=e=>{const i=N(8),{children:a,heading:o,testId:r}=e;let l;i[0]!==o?(l=t("header",{className:"border-b border-border px-4 py-3",children:t("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),i[0]=o,i[1]=l):l=i[1];let s;i[2]!==a?(s=t(I,{className:"p-3",children:a}),i[2]=a,i[3]=s):s=i[3];let u;return i[4]!==l||i[5]!==s||i[6]!==r?(u=d(w,{className:"gap-0 py-0","data-testid":r,children:[l,s]}),i[4]=l,i[5]=s,i[6]=r,i[7]=u):u=i[7],u},c=e=>{const i=N(7),{label:a,value:o}=e;let r;i[0]!==a?(r=t("span",{className:"text-sm",children:a}),i[0]=a,i[1]=r):r=i[1];let l;i[2]!==o?(l=t("span",{className:"text-sm text-muted-foreground tabular-nums",children:o}),i[2]=o,i[3]=l):l=i[3];let s;return i[4]!==r||i[5]!==l?(s=d("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs",children:[r,l]}),i[4]=r,i[5]=l,i[6]=s):s=i[6],s},O=()=>{const e=N(20),i=C(),a=$();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-auth-config"],e[0]=o):o=e[0];let r;e[1]!==i?(r=()=>i.getAuthConfig(),e[1]=i,e[2]=r):r=e[2];const{data:l,error:s}=A(o,r);let u;e[3]!==a?(u=n=>t(x,{variant:n?"success":"outline",children:a(n?"Enabled":"Disabled")}),e[3]=a,e[4]=u):u=e[4];const m=u;let f;e[5]!==s?(f=s!==null&&t("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:s}),e[5]=s,e[6]=f):f=e[6];let g;e[7]!==l||e[8]!==s||e[9]!==a?(g=s===null&&l===void 0&&t("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:a("Loading auth configuration…")}),e[7]=l,e[8]=s,e[9]=a,e[10]=g):g=e[10];let p;e[11]!==l||e[12]!==s||e[13]!==m||e[14]!==a?(p=s===null&&l!==void 0&&d(y,{children:[t(h,{heading:a("Enabled capabilities"),testId:"auth-config-capabilities",children:t("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:S.map(n=>{const k=l.capabilities[n.key];return d("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-cap-${n.key}`,children:[t("span",{className:"text-sm",children:a(n.label)}),m(k)]},n.key)})})}),t(h,{heading:a("Plugins"),testId:"auth-config-plugins",children:l.plugins.length===0?t("p",{className:"text-sm text-muted-foreground",children:a("No plugins enabled.")}):t("div",{className:"flex flex-wrap gap-2",children:l.plugins.map(P)})}),t(h,{heading:a("Sign-in methods"),testId:"auth-config-signin",children:d("div",{className:"flex flex-col gap-2",children:[t(c,{label:a("Email & password"),value:m(l.emailAndPassword)}),t(c,{label:a("Social providers"),value:l.socialProviders.length===0?a("None"):t("span",{className:"flex flex-wrap justify-end gap-1",children:l.socialProviders.map(z)})})]})}),l.organization.enabled&&t(h,{heading:a("Organizations"),testId:"auth-config-org",children:d("div",{className:"flex flex-col gap-2",children:[t(c,{label:a("Teams"),value:m(l.organization.teams)}),t(c,{label:a("Custom roles"),value:m(l.organization.roles)})]})}),t(h,{heading:a("Session policy"),testId:"auth-config-session",children:d("div",{className:"flex flex-col gap-2",children:[t(c,{label:a("Expires in"),value:v(l.session.expiresIn)}),t(c,{label:a("Refresh after"),value:v(l.session.updateAge)}),t(c,{label:a("Fresh window"),value:v(l.session.freshAge)}),t(c,{label:a("Cookie cache"),value:m(l.session.cookieCache===!0)})]})}),t(h,{heading:a("Rate limit"),testId:"auth-config-ratelimit",children:d("div",{className:"flex flex-col gap-2",children:[t(c,{label:a("Status"),value:m(l.rateLimit.enabled)}),l.rateLimit.enabled&&d(y,{children:[t(c,{label:a("Max requests"),value:l.rateLimit.max??"—"}),t(c,{label:a("Window"),value:v(l.rateLimit.window)})]})]})}),l.userFields.length>0&&t(h,{heading:a("Plugin user fields"),testId:"auth-config-user-fields",children:t("ul",{className:"flex flex-col gap-2",children:l.userFields.map(n=>d("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-user-field-${n.name}`,children:[d("span",{className:"flex flex-col",children:[t("span",{className:"font-mono text-xs",children:n.name}),n.plugin!==void 0&&t("span",{className:"text-[11px] text-muted-foreground",children:n.plugin})]}),d("span",{className:"flex items-center gap-1",children:[t(x,{variant:"outline",children:n.type}),n.required&&t(x,{variant:"secondary",children:a("required")}),n.unique&&t(x,{variant:"secondary",children:a("unique")})]})]},n.name))})}),t(w,{className:"gap-0 py-0",children:t("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children:a("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output.")})})]}),e[11]=l,e[12]=s,e[13]=m,e[14]=a,e[15]=p):p=e[15];let b;return e[16]!==f||e[17]!==g||e[18]!==p?(b=d("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[f,g,p]}),e[16]=f,e[17]=g,e[18]=p,e[19]=b):b=e[19],b};function P(e){return t(x,{"data-testid":`auth-config-plugin-${e}`,variant:"outline",children:e},e)}function z(e){return t(x,{"data-testid":`auth-config-provider-${e}`,variant:"outline",children:e},e)}export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as A}from"react/compiler-runtime";import{useLunora as g}from"@lunora/react";import{B as S}from"../packem_shared/button-q0UYSmrn.mjs";import{C,a as k}from"../packem_shared/card--2hKx4L2.mjs";import{E as w}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as I,a as B,b as T,c,d as R,e as m}from"../packem_shared/table-D0SBiDu-.mjs";import{b as E}from"../packem_shared/use-admin-query-
|
|
1
|
+
import{c as A}from"react/compiler-runtime";import{useLunora as g}from"@lunora/react";import{B as S}from"../packem_shared/button-q0UYSmrn.mjs";import{C,a as k}from"../packem_shared/card--2hKx4L2.mjs";import{E as w}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as I,a as B,b as T,c,d as R,e as m}from"../packem_shared/table-D0SBiDu-.mjs";import{b as E}from"../packem_shared/use-admin-query-BvZH4unR.mjs";import{useAutoRefresh as _}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs";import{useT as $}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{i as j,f as H}from"../packem_shared/internal-D4gBuklE.mjs";import{jsx as t,jsxs as y}from"react/jsx-runtime";const v=200,K=()=>{const e=A(21),i=g(),s=$();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=["lunora-auth-sessions",v],e[0]=h):h=e[0];let u;e[1]!==i?(u=()=>i.listAuthSessions({limit:v}),e[1]=i,e[2]=u):u=e[2];const l=E(h,u),{error:f}=l,r=l.data?.rows??null;let p;e[3]!==l?(p=()=>{l.refetch()},e[3]=l,e[4]=p):p=e[4],_(p,!0);let x;e[5]!==i||e[6]!==l?(x=a=>{H((async()=>{await i.revokeAuthSession({sessionId:a}),l.refetch()})())},e[5]=i,e[6]=l,e[7]=x):x=e[7];const N=x;let o;e[8]!==f?(o=f!==null&&t("p",{className:"text-sm text-destructive","data-testid":"auth-sessions-error",role:"alert",children:f}),e[8]=f,e[9]=o):o=e[9];let n;e[10]!==r||e[11]!==s?(n=r!==null&&r.length===0&&t(w,{testId:"auth-sessions-empty",title:s("No active sessions.")}),e[10]=r,e[11]=s,e[12]=n):n=e[12];let d;e[13]!==N||e[14]!==r||e[15]!==s?(d=r!==null&&r.length>0&&t(C,{className:"overflow-hidden py-0",children:t(k,{className:"px-0",children:y(I,{"data-testid":"auth-sessions-table",children:[t(B,{children:y(T,{children:[t(c,{children:s("user")}),t(c,{children:s("expires")}),t(c,{children:s("ip")}),t(c,{children:s("user agent")}),t(c,{children:s("impersonated by")}),t(c,{"aria-label":s("Actions")})]})}),t(R,{children:r.map(a=>y(T,{"data-testid":`auth-session-${a.id}`,children:[t(m,{className:"font-mono text-xs",children:a.userId}),t(m,{className:"text-muted-foreground tabular-nums",children:j(a.expiresAt)}),t(m,{children:a.ipAddress??""}),t(m,{className:"max-w-40 truncate",children:a.userAgent??""}),t(m,{className:"font-mono text-xs",children:a.impersonatedBy??""}),t(m,{children:t(S,{"data-testid":`auth-session-revoke-${a.id}`,onClick:()=>{N(a.id)},size:"xs",type:"button",variant:"ghost",children:s("Revoke")})})]},a.id))})]})})}),e[13]=N,e[14]=r,e[15]=s,e[16]=d):d=e[16];let b;return e[17]!==o||e[18]!==n||e[19]!==d?(b=y("div",{className:"flex flex-col gap-4","data-testid":"auth-sessions",children:[o,n,d]}),e[17]=o,e[18]=n,e[19]=d,e[20]=b):b=e[20],b};export{K as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as C}from"react/compiler-runtime";import{L as T}from"../packem_shared/live-status-BuJdUZFU.mjs";import{B as b}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as E,a as A}from"../packem_shared/card--2hKx4L2.mjs";import{E as I}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as S,a as _,b as y,c as l,d as L,e as d}from"../packem_shared/table-D0SBiDu-.mjs";import{u as O}from"../packem_shared/use-admin-query-
|
|
1
|
+
import{c as C}from"react/compiler-runtime";import{L as T}from"../packem_shared/live-status-BuJdUZFU.mjs";import{B as b}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as E,a as A}from"../packem_shared/card--2hKx4L2.mjs";import{E as I}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as S,a as _,b as y,c as l,d as L,e as d}from"../packem_shared/table-D0SBiDu-.mjs";import{u as O}from"../packem_shared/use-admin-query-BvZH4unR.mjs";import{useT as $}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as k}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{jsxs as h,jsx as n}from"react/jsx-runtime";const g="container:",R={error:"error",sleep:"sleeping",start:"running",stop:"stopped"},B=e=>{const t=e.indexOf(":");if(t===-1)return{event:e.trim()};const a=e.slice(t+1).trim(),s=e.slice(0,t).trim();return a===""?{event:s}:{detail:a,event:s}},D=e=>{const t=new Map;for(const a of e){const s=a.functionPath??"";if(!s.startsWith(g))continue;const i=s.slice(g.length);if(i==="")continue;const r=JSON.stringify([i,a.instance??""]),o=t.get(r);if(o!==void 0&&o.timestamp>=a.timestamp)continue;const{detail:u,event:c}=B(a.message);t.set(r,{detail:u,event:c,exitCode:a.exitCode,instance:a.instance,level:a.level,name:i,state:R[c]??"unknown",timestamp:a.timestamp})}return[...t.values()].toSorted((a,s)=>a.name.localeCompare(s.name)||(a.instance??"").localeCompare(s.instance??""))},M={error:"destructive",running:"success",sleeping:"info",stopped:"outline",unknown:"secondary"},P=e=>{const{entries:t}=e??{};return Array.isArray(t)?t:[]},q=()=>{const e=C(19),t=$();let a,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},s={live:!0,shardKey:""},e[0]=a,e[1]=s):(a=e[0],s=e[1]);const{data:i,error:r,liveError:o}=O(k.getLogs,a,s),u=i!==void 0;let c;if(e[2]!==i||e[3]!==r||e[4]!==o||e[5]!==u||e[6]!==t){const N=D(P(i));let x;e[8]!==r?(x=r!==null&&n("p",{className:"text-sm text-destructive","data-testid":"containers-error",role:"alert",children:r}),e[8]=r,e[9]=x):x=e[9];let m;e[10]!==t?(m=t("Cloudflare Containers are observed from their lifecycle log stream. This shows the current state per instance — ports and health checks aren't carried in that stream."),e[10]=t,e[11]=m):m=e[11];let f;e[12]!==m?(f=n("p",{className:"text-sm text-muted-foreground",children:m}),e[12]=m,e[13]=f):f=e[13];let p;e[14]!==o?(p=n(T,{message:o,prefix:"containers"}),e[14]=o,e[15]=p):p=e[15];let v;e[16]!==f||e[17]!==p?(v=h("div",{className:"flex flex-wrap items-center gap-2",children:[f,p]}),e[16]=f,e[17]=p,e[18]=v):v=e[18],c=h("div",{className:"flex flex-col gap-6","data-testid":"lunora-containers-panel",children:[x,v,u&&N.length===0?n(I,{description:t("No container lifecycle activity yet. Instances declared with defineContainer show up here once they start, sleep, stop, or error."),testId:"containers-empty",title:t("No container activity")}):n(E,{className:"overflow-hidden py-0",children:n(A,{className:"px-0",children:h(S,{"data-testid":"containers-table",children:[n(_,{children:h(y,{children:[n(l,{children:t("Container")}),n(l,{children:t("Instance")}),n(l,{children:t("State")}),n(l,{children:t("Last event")}),n(l,{children:t("Detail")}),n(l,{children:t("Exit")}),n(l,{children:t("When")})]})}),n(L,{children:N.map(j)})]})})})]}),e[2]=i,e[3]=r,e[4]=o,e[5]=u,e[6]=t,e[7]=c}else c=e[7];return c};function j(e){return h(y,{"data-testid":`containers-row-${e.name}${e.instance===void 0?"":`-${e.instance}`}`,children:[n(d,{className:"font-mono text-xs",children:e.name}),n(d,{className:"max-w-40 truncate font-mono text-xs text-muted-foreground",title:e.instance,children:e.instance??"—"}),n(d,{children:n(b,{variant:M[e.state],children:e.state})}),n(d,{className:"font-mono text-xs text-muted-foreground",children:e.event}),n(d,{className:"max-w-64 truncate text-xs text-muted-foreground",title:e.detail,children:e.detail??"—"}),n(d,{className:"font-mono text-xs tabular-nums text-muted-foreground",children:e.exitCode??"—"}),n(d,{className:"text-xs tabular-nums text-muted-foreground",children:new Date(e.timestamp).toLocaleString()})]},`${e.name}/${e.instance??""}`)}export{q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as J}from"react/compiler-runtime";import{useState as X,useEffect as fe,useRef as ue}from"react";import{A as ne}from"../packem_shared/alert-PB5W11MM.mjs";import{B as Y}from"../packem_shared/button-q0UYSmrn.mjs";import{b as he,c as ge,a as re,C as ae}from"../packem_shared/card--2hKx4L2.mjs";import{E as me}from"../packem_shared/empty-state-D7jEML_T.mjs";import{useT as te}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{u as be,n as ve}from"../packem_shared/browser-storage-BH1MxLZs.mjs";import{c as pe,d as xe,b as Ce,f as de,h as ke}from"../packem_shared/internal-CwaF9YNk.mjs";import{u as ye}from"../packem_shared/use-sql-assistant-Ib7Ik6cw.mjs";import{S as we,a as Se}from"../packem_shared/sql-result-table-DysT8h5P.mjs";import{useLunora as Ne}from"@lunora/react";import{ADMIN_FUNCTIONS as Ke}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{jsx as d,jsxs as Z}from"react/jsx-runtime";const Re=pe(Ke.runSql),Le=(b,e)=>{const t=J(11),n=Ne(),[r,s]=X(void 0),[a,o]=X(void 0),[c,v]=X(!0);let h;t[0]!==n||t[1]!==e||t[2]!==b?(h=async f=>{v(!0);try{const y=await n.query(Re,{sql:b},xe(e));f.cancelled||(s(y),o(void 0))}catch(y){const x=y;f.cancelled||(s(void 0),o(Ce(x)))}f.cancelled||v(!1)},t[0]=n,t[1]=e,t[2]=b,t[3]=h):h=t[3];const i=h;let l,g;t[4]!==i?(l=()=>{const f={cancelled:!1};return de(i(f)),()=>{f.cancelled=!0}},g=[i],t[4]=i,t[5]=l,t[6]=g):(l=t[5],g=t[6]),fe(l,g);let N;return t[7]!==a||t[8]!==c||t[9]!==r?(N={error:a,loading:c,result:r},t[7]=a,t[8]=c,t[9]=r,t[10]=N):N=t[10],N},Me=b=>{b.preventDefault()},le=b=>b.kind??"chart",ce=b=>{const e=J(80),{actions:t,children:n,draggedRef:r,first:s,last:a,onEdit:o,onMove:c,onRemove:v,onReorder:h,widget:i}=b,l=te();let g;e[0]!==c||e[1]!==i.id?(g=()=>{c(i.id,-1)},e[0]=c,e[1]=i.id,e[2]=g):g=e[2];const N=g;let f;e[3]!==c||e[4]!==i.id?(f=()=>{c(i.id,1)},e[3]=c,e[4]=i.id,e[5]=f):f=e[5];const y=f;let x;e[6]!==o||e[7]!==i.id?(x=()=>{o(i.id)},e[6]=o,e[7]=i.id,e[8]=x):x=e[8];const q=x;let O;e[9]!==v||e[10]!==i.id?(O=()=>{v(i.id)},e[9]=v,e[10]=i.id,e[11]=O):O=e[11];const E=O;let z;e[12]!==r||e[13]!==i.id?(z=()=>{r.current=i.id},e[12]=r,e[13]=i.id,e[14]=z):z=e[14];const C=z;let K;e[15]!==r||e[16]!==h||e[17]!==i.id?(K=()=>{const se=r.current;r.current=null,se!==null&&se!==i.id&&h(se,i.id)},e[15]=r,e[16]=h,e[17]=i.id,e[18]=K):K=e[18];const W=K,S=`dashboards-widget-${i.id}`;let k;e[19]!==i.title?(k=d(he,{className:"min-w-0 cursor-grab truncate",title:i.title,children:i.title}),e[19]=i.title,e[20]=k):k=e[20];let w;e[21]!==l?(w=l("Move widget up"),e[21]=l,e[22]=w):w=e[22];const _=`dashboards-move-up-${i.id}`;let Q;e[23]!==l?(Q=l("Move widget up"),e[23]=l,e[24]=Q):Q=e[24];let B;e[25]===Symbol.for("react.memo_cache_sentinel")?(B=d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"m6 15 6-6 6 6"})}),e[25]=B):B=e[25];let I;e[26]!==s||e[27]!==N||e[28]!==_||e[29]!==Q||e[30]!==w?(I=d(Y,{"aria-label":w,"data-testid":_,disabled:s,onClick:N,size:"icon-xs",title:Q,type:"button",variant:"ghost",children:B}),e[26]=s,e[27]=N,e[28]=_,e[29]=Q,e[30]=w,e[31]=I):I=e[31];let R;e[32]!==l?(R=l("Move widget down"),e[32]=l,e[33]=R):R=e[33];const $=`dashboards-move-down-${i.id}`;let L;e[34]!==l?(L=l("Move widget down"),e[34]=l,e[35]=L):L=e[35];let A;e[36]===Symbol.for("react.memo_cache_sentinel")?(A=d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"m6 9 6 6 6-6"})}),e[36]=A):A=e[36];let M;e[37]!==a||e[38]!==y||e[39]!==R||e[40]!==$||e[41]!==L?(M=d(Y,{"aria-label":R,"data-testid":$,disabled:a,onClick:y,size:"icon-xs",title:L,type:"button",variant:"ghost",children:A}),e[37]=a,e[38]=y,e[39]=R,e[40]=$,e[41]=L,e[42]=M):M=e[42];let D;e[43]!==l?(D=l("Edit widget"),e[43]=l,e[44]=D):D=e[44];const j=`dashboards-widget-edit-${i.id}`;let T;e[45]!==l?(T=l("Edit widget"),e[45]=l,e[46]=T):T=e[46];let p;e[47]===Symbol.for("react.memo_cache_sentinel")?(p=d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"M4 20h4L18 10l-4-4L4 16v4ZM14 6l4 4"})}),e[47]=p):p=e[47];let m;e[48]!==q||e[49]!==D||e[50]!==j||e[51]!==T?(m=d(Y,{"aria-label":D,"data-testid":j,onClick:q,size:"icon-xs",title:T,type:"button",variant:"ghost",children:p}),e[48]=q,e[49]=D,e[50]=j,e[51]=T,e[52]=m):m=e[52];let u;e[53]!==l?(u=l("Remove widget"),e[53]=l,e[54]=u):u=e[54];const F=`dashboards-widget-remove-${i.id}`;let U;e[55]!==l?(U=l("Remove widget"),e[55]=l,e[56]=U):U=e[56];let V;e[57]===Symbol.for("react.memo_cache_sentinel")?(V=d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"})}),e[57]=V):V=e[57];let H;e[58]!==E||e[59]!==u||e[60]!==F||e[61]!==U?(H=d(Y,{"aria-label":u,"data-testid":F,onClick:E,size:"icon-xs",title:U,type:"button",variant:"ghost",children:V}),e[58]=E,e[59]=u,e[60]=F,e[61]=U,e[62]=H):H=e[62];let P;e[63]!==t||e[64]!==I||e[65]!==M||e[66]!==m||e[67]!==H?(P=Z("div",{className:"flex shrink-0 items-center gap-1",children:[t,I,M,m,H]}),e[63]=t,e[64]=I,e[65]=M,e[66]=m,e[67]=H,e[68]=P):P=e[68];let G;e[69]!==P||e[70]!==k?(G=Z(ge,{className:"flex flex-row items-start justify-between gap-2 border-b pb-3",children:[k,P]}),e[69]=P,e[70]=k,e[71]=G):G=e[71];let ee;e[72]!==n?(ee=d(re,{className:"min-h-32 py-2",children:n}),e[72]=n,e[73]=ee):ee=e[73];let ie;return e[74]!==C||e[75]!==W||e[76]!==G||e[77]!==ee||e[78]!==S?(ie=Z(ae,{"data-testid":S,draggable:!0,onDragOver:Me,onDragStart:C,onDrop:W,children:[G,ee]}),e[74]=C,e[75]=W,e[76]=G,e[77]=ee,e[78]=S,e[79]=ie):ie=e[79],ie},qe=b=>{const e=J(10),{result:t}=b,n=te(),r=t.columns[0],s=r===void 0?void 0:t.rows[0]?.[r];let a;e[0]!==s||e[1]!==n?(a=s===void 0?n("—"):ke(s),e[0]=s,e[1]=n,e[2]=a):a=e[2];let o;e[3]!==a?(o=d("p",{className:"truncate font-mono text-3xl font-semibold text-foreground",children:a}),e[3]=a,e[4]=o):o=e[4];let c;e[5]!==r?(c=r!==void 0&&d("p",{className:"truncate text-xs text-muted-foreground",children:r}),e[5]=r,e[6]=c):c=e[6];let v;return e[7]!==o||e[8]!==c?(v=Z("div",{className:"flex h-full flex-col justify-center gap-1 p-4","data-testid":"dashboards-kpi",children:[o,c]}),e[7]=o,e[8]=c,e[9]=v):v=e[9],v},Ee=b=>{const e=J(12),{draggedRef:t,first:n,last:r,onEdit:s,onMove:a,onRemove:o,onReorder:c,widget:v}=b,h=v.text??"";let i;e[0]!==h?(i=d("p",{className:"p-2 text-sm whitespace-pre-wrap text-muted-foreground","data-testid":"dashboards-text",children:h}),e[0]=h,e[1]=i):i=e[1];let l;return e[2]!==t||e[3]!==n||e[4]!==r||e[5]!==s||e[6]!==a||e[7]!==o||e[8]!==c||e[9]!==i||e[10]!==v?(l=d(ce,{draggedRef:t,first:n,last:r,onEdit:s,onMove:a,onRemove:o,onReorder:c,widget:v,children:i}),e[2]=t,e[3]=n,e[4]=r,e[5]=s,e[6]=a,e[7]=o,e[8]=c,e[9]=i,e[10]=v,e[11]=l):l=e[11],l},Ae=b=>{const e=J(52),{draggedRef:t,first:n,inferring:r,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,onSuggest:h,widget:i}=b,l=te(),{error:g,loading:N,result:f}=Le(i.sql,i.shardKey??"");let y;e[0]!==i?(y=le(i),e[0]=i,e[1]=y):y=e[1];const x=y;let q;e[2]!==h||e[3]!==f||e[4]!==i.id?(q=()=>{f!==void 0&&h?.(i.id,f)},e[2]=h,e[3]=f,e[4]=i.id,e[5]=q):q=e[5];const O=q;let E;e[6]!==r||e[7]!==x||e[8]!==h||e[9]!==O||e[10]!==f||e[11]!==l||e[12]!==i.id?(E=x==="chart"&&h!==void 0&&f!==void 0?d(Y,{"aria-label":l("Suggest chart"),"data-testid":`dashboards-widget-suggest-${i.id}`,disabled:r,onClick:O,size:"icon-xs",title:l(r?"Suggesting…":"Suggest chart"),type:"button",variant:"ghost",children:d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"m12 3 1.9 4.6L18.5 9.5 13.9 11.4 12 16l-1.9-4.6L5.5 9.5l4.6-1.9L12 3ZM18 15l.9 2.1 2.1.9-2.1.9L18 21l-.9-2.1-2.1-.9 2.1-.9L18 15Z"})})}):void 0,e[6]=r,e[7]=x,e[8]=h,e[9]=O,e[10]=f,e[11]=l,e[12]=i.id,e[13]=E):E=e[13];const z=E;let C;e[14]!==g||e[15]!==i.id?(C=g!==void 0&&d(ne,{className:"font-mono text-xs",testId:`dashboards-widget-error-${i.id}`,variant:"destructive",children:g}),e[14]=g,e[15]=i.id,e[16]=C):C=e[16];let K;e[17]!==g||e[18]!==N||e[19]!==f||e[20]!==l||e[21]!==i.id?(K=g===void 0&&N&&f===void 0&&d("p",{className:"p-4 text-sm text-muted-foreground","data-testid":`dashboards-widget-loading-${i.id}`,children:l("Running…")}),e[17]=g,e[18]=N,e[19]=f,e[20]=l,e[21]=i.id,e[22]=K):K=e[22];let W;e[23]!==g||e[24]!==x||e[25]!==f||e[26]!==i.chartAxes||e[27]!==i.chartKind?(W=g===void 0&&f!==void 0&&x==="chart"&&d(we,{axes:i.chartAxes,kind:i.chartKind,result:f}),e[23]=g,e[24]=x,e[25]=f,e[26]=i.chartAxes,e[27]=i.chartKind,e[28]=W):W=e[28];let S;e[29]!==g||e[30]!==x||e[31]!==f?(S=g===void 0&&f!==void 0&&x==="kpi"&&d(qe,{result:f}),e[29]=g,e[30]=x,e[31]=f,e[32]=S):S=e[32];let k;e[33]!==g||e[34]!==x||e[35]!==f?(k=g===void 0&&f!==void 0&&x==="table"&&d("div",{className:"max-h-72 overflow-auto",children:d(Se,{result:f})}),e[33]=g,e[34]=x,e[35]=f,e[36]=k):k=e[36];let w;return e[37]!==t||e[38]!==n||e[39]!==s||e[40]!==a||e[41]!==o||e[42]!==c||e[43]!==v||e[44]!==z||e[45]!==C||e[46]!==K||e[47]!==W||e[48]!==S||e[49]!==k||e[50]!==i?(w=Z(ce,{actions:z,draggedRef:t,first:n,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,widget:i,children:[C,K,W,S,k]}),e[37]=t,e[38]=n,e[39]=s,e[40]=a,e[41]=o,e[42]=c,e[43]=v,e[44]=z,e[45]=C,e[46]=K,e[47]=W,e[48]=S,e[49]=k,e[50]=i,e[51]=w):w=e[51],w},Te=b=>{const e=J(11),{draggedRef:t,first:n,inferring:r,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,onSuggest:h,widget:i}=b;let l;return e[0]!==t||e[1]!==n||e[2]!==r||e[3]!==s||e[4]!==a||e[5]!==o||e[6]!==c||e[7]!==v||e[8]!==h||e[9]!==i?(l=le(i)==="text"?d(Ee,{draggedRef:t,first:n,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,widget:i}):d(Ae,{draggedRef:t,first:n,inferring:r,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,onSuggest:h,widget:i}),e[0]=t,e[1]=n,e[2]=r,e[3]=s,e[4]=a,e[5]=o,e[6]=c,e[7]=v,e[8]=h,e[9]=i,e[10]=l):l=e[10],l},We=["bar","line","area"],Ie=["chart","kpi","table","text"],$e="lunora-studio-dashboards",oe={chartKind:"bar",kind:"chart",shardKey:"",sql:"",text:"",title:""},De=(b,e)=>t=>t.map(n=>n.id===b?{...n,chartAxes:e,chartKind:e.kind}:n),je=(b,e)=>t=>{const n=t.find(a=>a.id===b),r=t.filter(a=>a.id!==b),s=r.findIndex(a=>a.id===e);return n===void 0||s===-1?t:[...r.slice(0,s),n,...r.slice(s)]},ze=(b,e)=>e(b==="line"?"Line":b==="area"?"Area":"Bar"),Be=(b,e)=>e(b==="kpi"?"Single value":b==="table"?"Table":b==="text"?"Text":"Chart"),Fe=b=>{const e=J(82),{draft:t,editing:n,onCancel:r,onChange:s,onSubmit:a}=b,o=te();let c;e[0]!==t||e[1]!==s?(c=u=>{s({...t,title:u.target.value})},e[0]=t,e[1]=s,e[2]=c):c=e[2];const v=c;let h;e[3]!==t||e[4]!==s?(h=u=>{s({...t,sql:u.target.value})},e[3]=t,e[4]=s,e[5]=h):h=e[5];const i=h;let l;e[6]!==t||e[7]!==s?(l=u=>{s({...t,text:u.target.value})},e[6]=t,e[7]=s,e[8]=l):l=e[8];const g=l;let N;e[9]!==t||e[10]!==s?(N=u=>{s({...t,shardKey:u.target.value})},e[9]=t,e[10]=s,e[11]=N):N=e[11];const f=N;let y;e[12]!==t||e[13]!==s?(y=u=>{s({...t,chartKind:u.target.value})},e[12]=t,e[13]=s,e[14]=y):y=e[14];const x=y;let q;e[15]!==t||e[16]!==s?(q=u=>{s({...t,kind:u.target.value})},e[15]=t,e[16]=s,e[17]=q):q=e[17];const O=q;let E;e[18]!==a?(E=()=>{a()},e[18]=a,e[19]=E):E=e[19];const z=E,C=t.kind==="text";let K;e[20]!==t.sql||e[21]!==t.text||e[22]!==t.title||e[23]!==C?(K=t.title.trim()!==""&&(C?t.text.trim()!=="":t.sql.trim()!==""),e[20]=t.sql,e[21]=t.text,e[22]=t.title,e[23]=C,e[24]=K):K=e[24];const W=K;let S;e[25]!==o?(S=o("Widget title"),e[25]=o,e[26]=S):S=e[26];let k;e[27]!==o?(k=o("Widget title"),e[27]=o,e[28]=k):k=e[28];let w;e[29]!==t.title||e[30]!==v||e[31]!==k||e[32]!==S?(w=d("input",{"aria-label":S,className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-title",onChange:v,placeholder:k,type:"text",value:t.title}),e[29]=t.title,e[30]=v,e[31]=k,e[32]=S,e[33]=w):w=e[33];let _;e[34]!==o?(_=o("Widget type"),e[34]=o,e[35]=_):_=e[35];const Q=t.kind;let B;e[36]!==o?(B=Ie.map(u=>d("option",{value:u,children:Be(u,o)},u)),e[36]=o,e[37]=B):B=e[37];let I;e[38]!==t.kind||e[39]!==O||e[40]!==_||e[41]!==B?(I=d("select",{"aria-label":_,className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-widget-kind",onChange:O,value:Q,children:B}),e[38]=t.kind,e[39]=O,e[40]=_,e[41]=B,e[42]=I):I=e[42];let R;e[43]!==t.sql||e[44]!==t.text||e[45]!==C||e[46]!==i||e[47]!==g||e[48]!==o?(R=C?d("textarea",{"aria-label":o("Text"),className:"min-h-24 resize-y rounded-md border border-border bg-background p-2 text-xs leading-5 outline-none focus-visible:border-ring","data-testid":"dashboards-form-text",onChange:g,placeholder:o("Notes for whoever reads this dashboard."),value:t.text}):d("textarea",{"aria-label":o("SQL query"),className:"min-h-24 resize-y rounded-md border border-border bg-background p-2 font-mono text-xs leading-5 outline-none focus-visible:border-ring","data-testid":"dashboards-form-sql",onChange:i,placeholder:"SELECT author, COUNT(*) AS messages FROM …",spellCheck:!1,value:t.sql}),e[43]=t.sql,e[44]=t.text,e[45]=C,e[46]=i,e[47]=g,e[48]=o,e[49]=R):R=e[49];let $;e[50]!==t.chartKind||e[51]!==t.kind||e[52]!==x||e[53]!==o?($=t.kind==="chart"&&d("select",{"aria-label":o("Chart type"),className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-kind",onChange:x,value:t.chartKind,children:We.map(u=>d("option",{value:u,children:ze(u,o)},u))}),e[50]=t.chartKind,e[51]=t.kind,e[52]=x,e[53]=o,e[54]=$):$=e[54];let L;e[55]!==t.shardKey||e[56]!==C||e[57]!==f||e[58]!==o?(L=!C&&d("input",{"aria-label":o("Shard key (optional)"),className:"h-8 rounded-md border border-border bg-background px-2 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-shard",onChange:f,placeholder:o("Shard key (optional)"),type:"text",value:t.shardKey}),e[55]=t.shardKey,e[56]=C,e[57]=f,e[58]=o,e[59]=L):L=e[59];let A;e[60]!==o?(A=o("Cancel"),e[60]=o,e[61]=A):A=e[61];let M;e[62]!==r||e[63]!==A?(M=d(Y,{"data-testid":"dashboards-form-cancel",onClick:r,size:"sm",type:"button",variant:"outline",children:A}),e[62]=r,e[63]=A,e[64]=M):M=e[64];const D=!W;let j;e[65]!==n||e[66]!==o?(j=o(n?"Save widget":"Add widget"),e[65]=n,e[66]=o,e[67]=j):j=e[67];let T;e[68]!==z||e[69]!==D||e[70]!==j?(T=d(Y,{"data-testid":"dashboards-form-save",disabled:D,onClick:z,size:"sm",type:"button",children:j}),e[68]=z,e[69]=D,e[70]=j,e[71]=T):T=e[71];let p;e[72]!==M||e[73]!==T?(p=Z("div",{className:"flex items-center justify-end gap-2",children:[M,T]}),e[72]=M,e[73]=T,e[74]=p):p=e[74];let m;return e[75]!==w||e[76]!==I||e[77]!==R||e[78]!==$||e[79]!==L||e[80]!==p?(m=d(ae,{"data-testid":"dashboards-form",children:Z(re,{className:"flex flex-col gap-3 py-4",children:[w,I,R,$,L,p]})}),e[75]=w,e[76]=I,e[77]=R,e[78]=$,e[79]=L,e[80]=p,e[81]=m):m=e[81],m},it=b=>{const e=J(53),{initialShardKey:t}=b,n=te(),[r,s]=be($e),[a,o]=X(oe),[c,v]=X(null),[h,i]=X(!1),l=ye(t??""),[g,N]=X(null),f=ue(null);let y;e[0]!==t?(y=()=>{v(null),o({...oe,shardKey:t??""}),i(!0)},e[0]=t,e[1]=y):y=e[1];const x=y;let q;e[2]===Symbol.for("react.memo_cache_sentinel")?(q=()=>{i(!1),v(null),o(oe)},e[2]=q):q=e[2];const O=q;let E;e[3]!==r?(E=p=>{const m=r.find(u=>u.id===p);m!==void 0&&(v(p),o({chartKind:m.chartKind??"bar",kind:le(m),shardKey:m.shardKey??"",sql:m.sql,text:m.text??"",title:m.title}),i(!0))},e[3]=r,e[4]=E):E=e[4];const z=E;let C;e[5]!==l||e[6]!==s?(C=(p,m)=>{N(p),de((async()=>{const F=await l.inferChart({columns:m.columns,rowCount:m.rowCount});F!==void 0&&s(De(p,F))})().finally(()=>{N(F=>F===p?null:F)}))},e[5]=l,e[6]=s,e[7]=C):C=e[7];const K=C;let W;e[8]!==s?(W=p=>{s(m=>m.filter(u=>u.id!==p))},e[8]=s,e[9]=W):W=e[9];const S=W;let k;e[10]!==s?(k=(p,m)=>{s(je(p,m))},e[10]=s,e[11]=k):k=e[11];const w=k;let _;e[12]!==s?(_=(p,m)=>{s(u=>{const F=u.findIndex(G=>G.id===p),U=F+m;if(F===-1||U<0||U>=u.length)return u;const V=[...u],H=V[F],P=V[U];return H===void 0||P===void 0?u:(V[F]=P,V[U]=H,V)})},e[12]=s,e[13]=_):_=e[13];const Q=_;let B;e[14]!==a||e[15]!==c||e[16]!==s?(B=()=>{const p=a.title.trim(),m=a.sql.trim(),u=a.text.trim(),{chartKind:F,kind:U}=a;if(p===""||(U==="text"?u==="":m===""))return;const V={chartKind:F,kind:U,shardKey:a.shardKey.trim(),sql:m,text:u,title:p};s(c===null?H=>[...H,{...V,id:ve("w")}]:H=>H.map(P=>P.id===c?{...P,...V}:P)),O()},e[14]=a,e[15]=c,e[16]=s,e[17]=B):B=e[17];const I=B;let R;e[18]!==n?(R=n("Charts, values, tables, and notes. Drag a tile to reorder."),e[18]=n,e[19]=R):R=e[19];let $;e[20]!==R?($=d("p",{className:"text-sm text-muted-foreground",children:R}),e[20]=R,e[21]=$):$=e[21];let L;e[22]!==h||e[23]!==x||e[24]!==n?(L=!h&&d(Y,{"data-testid":"dashboards-add",onClick:x,size:"sm",type:"button",children:n("Add widget")}),e[22]=h,e[23]=x,e[24]=n,e[25]=L):L=e[25];let A;e[26]!==$||e[27]!==L?(A=Z("div",{className:"flex items-center justify-between",children:[$,L]}),e[26]=$,e[27]=L,e[28]=A):A=e[28];let M;e[29]!==l||e[30]!==n?(M=l.reason("chart")!==void 0&&d(ne,{className:"text-xs",testId:"dashboards-suggest-error",variant:"destructive",children:n("Could not suggest a chart for that result.")}),e[29]=l,e[30]=n,e[31]=M):M=e[31];let D;e[32]!==a||e[33]!==c||e[34]!==h||e[35]!==I?(D=h&&d(Fe,{draft:a,editing:c!==null,onCancel:O,onChange:o,onSubmit:I}),e[32]=a,e[33]=c,e[34]=h,e[35]=I,e[36]=D):D=e[36];let j;e[37]!==l.unavailable||e[38]!==h||e[39]!==g||e[40]!==z||e[41]!==Q||e[42]!==S||e[43]!==w||e[44]!==K||e[45]!==n||e[46]!==r?(j=r.length===0&&!h?d(me,{description:n("Add a chart, a single value, a table, or a note. Everything is saved on this browser."),testId:"dashboards-empty",title:n("No widgets yet")}):d("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3","data-testid":"dashboards-grid",children:r.map((p,m)=>d(Te,{draggedRef:f,first:m===0,inferring:g===p.id,last:m===r.length-1,onEdit:z,onMove:Q,onRemove:S,onReorder:w,onSuggest:l.unavailable?void 0:K,widget:p},p.id))}),e[37]=l.unavailable,e[38]=h,e[39]=g,e[40]=z,e[41]=Q,e[42]=S,e[43]=w,e[44]=K,e[45]=n,e[46]=r,e[47]=j):j=e[47];let T;return e[48]!==A||e[49]!==M||e[50]!==D||e[51]!==j?(T=Z("div",{className:"flex flex-col gap-4","data-testid":"lunora-dashboards",children:[A,M,D,j]}),e[48]=A,e[49]=M,e[50]=D,e[51]=j,e[52]=T):T=e[52],T};export{it as default};
|
|
1
|
+
import{c as J}from"react/compiler-runtime";import{useState as X,useEffect as fe,useRef as ue}from"react";import{A as ne}from"../packem_shared/alert-PB5W11MM.mjs";import{B as Y}from"../packem_shared/button-q0UYSmrn.mjs";import{b as he,c as ge,a as re,C as ae}from"../packem_shared/card--2hKx4L2.mjs";import{E as me}from"../packem_shared/empty-state-D7jEML_T.mjs";import{useT as te}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{u as be,n as ve}from"../packem_shared/browser-storage-BH1MxLZs.mjs";import{c as pe,d as xe,b as Ce,f as de,h as ke}from"../packem_shared/internal-D4gBuklE.mjs";import{u as ye}from"../packem_shared/use-sql-assistant-BGoWYcGL.mjs";import{S as we,a as Se}from"../packem_shared/sql-result-table-BLIMecXM.mjs";import{useLunora as Ne}from"@lunora/react";import{ADMIN_FUNCTIONS as Ke}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{jsx as d,jsxs as Z}from"react/jsx-runtime";const Re=pe(Ke.runSql),Le=(b,e)=>{const t=J(11),n=Ne(),[r,s]=X(void 0),[a,o]=X(void 0),[c,v]=X(!0);let h;t[0]!==n||t[1]!==e||t[2]!==b?(h=async f=>{v(!0);try{const y=await n.query(Re,{sql:b},xe(e));f.cancelled||(s(y),o(void 0))}catch(y){const x=y;f.cancelled||(s(void 0),o(Ce(x)))}f.cancelled||v(!1)},t[0]=n,t[1]=e,t[2]=b,t[3]=h):h=t[3];const i=h;let l,g;t[4]!==i?(l=()=>{const f={cancelled:!1};return de(i(f)),()=>{f.cancelled=!0}},g=[i],t[4]=i,t[5]=l,t[6]=g):(l=t[5],g=t[6]),fe(l,g);let N;return t[7]!==a||t[8]!==c||t[9]!==r?(N={error:a,loading:c,result:r},t[7]=a,t[8]=c,t[9]=r,t[10]=N):N=t[10],N},Me=b=>{b.preventDefault()},le=b=>b.kind??"chart",ce=b=>{const e=J(80),{actions:t,children:n,draggedRef:r,first:s,last:a,onEdit:o,onMove:c,onRemove:v,onReorder:h,widget:i}=b,l=te();let g;e[0]!==c||e[1]!==i.id?(g=()=>{c(i.id,-1)},e[0]=c,e[1]=i.id,e[2]=g):g=e[2];const N=g;let f;e[3]!==c||e[4]!==i.id?(f=()=>{c(i.id,1)},e[3]=c,e[4]=i.id,e[5]=f):f=e[5];const y=f;let x;e[6]!==o||e[7]!==i.id?(x=()=>{o(i.id)},e[6]=o,e[7]=i.id,e[8]=x):x=e[8];const q=x;let O;e[9]!==v||e[10]!==i.id?(O=()=>{v(i.id)},e[9]=v,e[10]=i.id,e[11]=O):O=e[11];const E=O;let z;e[12]!==r||e[13]!==i.id?(z=()=>{r.current=i.id},e[12]=r,e[13]=i.id,e[14]=z):z=e[14];const C=z;let K;e[15]!==r||e[16]!==h||e[17]!==i.id?(K=()=>{const se=r.current;r.current=null,se!==null&&se!==i.id&&h(se,i.id)},e[15]=r,e[16]=h,e[17]=i.id,e[18]=K):K=e[18];const W=K,S=`dashboards-widget-${i.id}`;let k;e[19]!==i.title?(k=d(he,{className:"min-w-0 cursor-grab truncate",title:i.title,children:i.title}),e[19]=i.title,e[20]=k):k=e[20];let w;e[21]!==l?(w=l("Move widget up"),e[21]=l,e[22]=w):w=e[22];const _=`dashboards-move-up-${i.id}`;let Q;e[23]!==l?(Q=l("Move widget up"),e[23]=l,e[24]=Q):Q=e[24];let B;e[25]===Symbol.for("react.memo_cache_sentinel")?(B=d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"m6 15 6-6 6 6"})}),e[25]=B):B=e[25];let I;e[26]!==s||e[27]!==N||e[28]!==_||e[29]!==Q||e[30]!==w?(I=d(Y,{"aria-label":w,"data-testid":_,disabled:s,onClick:N,size:"icon-xs",title:Q,type:"button",variant:"ghost",children:B}),e[26]=s,e[27]=N,e[28]=_,e[29]=Q,e[30]=w,e[31]=I):I=e[31];let R;e[32]!==l?(R=l("Move widget down"),e[32]=l,e[33]=R):R=e[33];const $=`dashboards-move-down-${i.id}`;let L;e[34]!==l?(L=l("Move widget down"),e[34]=l,e[35]=L):L=e[35];let A;e[36]===Symbol.for("react.memo_cache_sentinel")?(A=d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"m6 9 6 6 6-6"})}),e[36]=A):A=e[36];let M;e[37]!==a||e[38]!==y||e[39]!==R||e[40]!==$||e[41]!==L?(M=d(Y,{"aria-label":R,"data-testid":$,disabled:a,onClick:y,size:"icon-xs",title:L,type:"button",variant:"ghost",children:A}),e[37]=a,e[38]=y,e[39]=R,e[40]=$,e[41]=L,e[42]=M):M=e[42];let D;e[43]!==l?(D=l("Edit widget"),e[43]=l,e[44]=D):D=e[44];const j=`dashboards-widget-edit-${i.id}`;let T;e[45]!==l?(T=l("Edit widget"),e[45]=l,e[46]=T):T=e[46];let p;e[47]===Symbol.for("react.memo_cache_sentinel")?(p=d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"M4 20h4L18 10l-4-4L4 16v4ZM14 6l4 4"})}),e[47]=p):p=e[47];let m;e[48]!==q||e[49]!==D||e[50]!==j||e[51]!==T?(m=d(Y,{"aria-label":D,"data-testid":j,onClick:q,size:"icon-xs",title:T,type:"button",variant:"ghost",children:p}),e[48]=q,e[49]=D,e[50]=j,e[51]=T,e[52]=m):m=e[52];let u;e[53]!==l?(u=l("Remove widget"),e[53]=l,e[54]=u):u=e[54];const F=`dashboards-widget-remove-${i.id}`;let U;e[55]!==l?(U=l("Remove widget"),e[55]=l,e[56]=U):U=e[56];let V;e[57]===Symbol.for("react.memo_cache_sentinel")?(V=d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"})}),e[57]=V):V=e[57];let H;e[58]!==E||e[59]!==u||e[60]!==F||e[61]!==U?(H=d(Y,{"aria-label":u,"data-testid":F,onClick:E,size:"icon-xs",title:U,type:"button",variant:"ghost",children:V}),e[58]=E,e[59]=u,e[60]=F,e[61]=U,e[62]=H):H=e[62];let P;e[63]!==t||e[64]!==I||e[65]!==M||e[66]!==m||e[67]!==H?(P=Z("div",{className:"flex shrink-0 items-center gap-1",children:[t,I,M,m,H]}),e[63]=t,e[64]=I,e[65]=M,e[66]=m,e[67]=H,e[68]=P):P=e[68];let G;e[69]!==P||e[70]!==k?(G=Z(ge,{className:"flex flex-row items-start justify-between gap-2 border-b pb-3",children:[k,P]}),e[69]=P,e[70]=k,e[71]=G):G=e[71];let ee;e[72]!==n?(ee=d(re,{className:"min-h-32 py-2",children:n}),e[72]=n,e[73]=ee):ee=e[73];let ie;return e[74]!==C||e[75]!==W||e[76]!==G||e[77]!==ee||e[78]!==S?(ie=Z(ae,{"data-testid":S,draggable:!0,onDragOver:Me,onDragStart:C,onDrop:W,children:[G,ee]}),e[74]=C,e[75]=W,e[76]=G,e[77]=ee,e[78]=S,e[79]=ie):ie=e[79],ie},qe=b=>{const e=J(10),{result:t}=b,n=te(),r=t.columns[0],s=r===void 0?void 0:t.rows[0]?.[r];let a;e[0]!==s||e[1]!==n?(a=s===void 0?n("—"):ke(s),e[0]=s,e[1]=n,e[2]=a):a=e[2];let o;e[3]!==a?(o=d("p",{className:"truncate font-mono text-3xl font-semibold text-foreground",children:a}),e[3]=a,e[4]=o):o=e[4];let c;e[5]!==r?(c=r!==void 0&&d("p",{className:"truncate text-xs text-muted-foreground",children:r}),e[5]=r,e[6]=c):c=e[6];let v;return e[7]!==o||e[8]!==c?(v=Z("div",{className:"flex h-full flex-col justify-center gap-1 p-4","data-testid":"dashboards-kpi",children:[o,c]}),e[7]=o,e[8]=c,e[9]=v):v=e[9],v},Ee=b=>{const e=J(12),{draggedRef:t,first:n,last:r,onEdit:s,onMove:a,onRemove:o,onReorder:c,widget:v}=b,h=v.text??"";let i;e[0]!==h?(i=d("p",{className:"p-2 text-sm whitespace-pre-wrap text-muted-foreground","data-testid":"dashboards-text",children:h}),e[0]=h,e[1]=i):i=e[1];let l;return e[2]!==t||e[3]!==n||e[4]!==r||e[5]!==s||e[6]!==a||e[7]!==o||e[8]!==c||e[9]!==i||e[10]!==v?(l=d(ce,{draggedRef:t,first:n,last:r,onEdit:s,onMove:a,onRemove:o,onReorder:c,widget:v,children:i}),e[2]=t,e[3]=n,e[4]=r,e[5]=s,e[6]=a,e[7]=o,e[8]=c,e[9]=i,e[10]=v,e[11]=l):l=e[11],l},Ae=b=>{const e=J(52),{draggedRef:t,first:n,inferring:r,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,onSuggest:h,widget:i}=b,l=te(),{error:g,loading:N,result:f}=Le(i.sql,i.shardKey??"");let y;e[0]!==i?(y=le(i),e[0]=i,e[1]=y):y=e[1];const x=y;let q;e[2]!==h||e[3]!==f||e[4]!==i.id?(q=()=>{f!==void 0&&h?.(i.id,f)},e[2]=h,e[3]=f,e[4]=i.id,e[5]=q):q=e[5];const O=q;let E;e[6]!==r||e[7]!==x||e[8]!==h||e[9]!==O||e[10]!==f||e[11]!==l||e[12]!==i.id?(E=x==="chart"&&h!==void 0&&f!==void 0?d(Y,{"aria-label":l("Suggest chart"),"data-testid":`dashboards-widget-suggest-${i.id}`,disabled:r,onClick:O,size:"icon-xs",title:l(r?"Suggesting…":"Suggest chart"),type:"button",variant:"ghost",children:d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"m12 3 1.9 4.6L18.5 9.5 13.9 11.4 12 16l-1.9-4.6L5.5 9.5l4.6-1.9L12 3ZM18 15l.9 2.1 2.1.9-2.1.9L18 21l-.9-2.1-2.1-.9 2.1-.9L18 15Z"})})}):void 0,e[6]=r,e[7]=x,e[8]=h,e[9]=O,e[10]=f,e[11]=l,e[12]=i.id,e[13]=E):E=e[13];const z=E;let C;e[14]!==g||e[15]!==i.id?(C=g!==void 0&&d(ne,{className:"font-mono text-xs",testId:`dashboards-widget-error-${i.id}`,variant:"destructive",children:g}),e[14]=g,e[15]=i.id,e[16]=C):C=e[16];let K;e[17]!==g||e[18]!==N||e[19]!==f||e[20]!==l||e[21]!==i.id?(K=g===void 0&&N&&f===void 0&&d("p",{className:"p-4 text-sm text-muted-foreground","data-testid":`dashboards-widget-loading-${i.id}`,children:l("Running…")}),e[17]=g,e[18]=N,e[19]=f,e[20]=l,e[21]=i.id,e[22]=K):K=e[22];let W;e[23]!==g||e[24]!==x||e[25]!==f||e[26]!==i.chartAxes||e[27]!==i.chartKind?(W=g===void 0&&f!==void 0&&x==="chart"&&d(we,{axes:i.chartAxes,kind:i.chartKind,result:f}),e[23]=g,e[24]=x,e[25]=f,e[26]=i.chartAxes,e[27]=i.chartKind,e[28]=W):W=e[28];let S;e[29]!==g||e[30]!==x||e[31]!==f?(S=g===void 0&&f!==void 0&&x==="kpi"&&d(qe,{result:f}),e[29]=g,e[30]=x,e[31]=f,e[32]=S):S=e[32];let k;e[33]!==g||e[34]!==x||e[35]!==f?(k=g===void 0&&f!==void 0&&x==="table"&&d("div",{className:"max-h-72 overflow-auto",children:d(Se,{result:f})}),e[33]=g,e[34]=x,e[35]=f,e[36]=k):k=e[36];let w;return e[37]!==t||e[38]!==n||e[39]!==s||e[40]!==a||e[41]!==o||e[42]!==c||e[43]!==v||e[44]!==z||e[45]!==C||e[46]!==K||e[47]!==W||e[48]!==S||e[49]!==k||e[50]!==i?(w=Z(ce,{actions:z,draggedRef:t,first:n,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,widget:i,children:[C,K,W,S,k]}),e[37]=t,e[38]=n,e[39]=s,e[40]=a,e[41]=o,e[42]=c,e[43]=v,e[44]=z,e[45]=C,e[46]=K,e[47]=W,e[48]=S,e[49]=k,e[50]=i,e[51]=w):w=e[51],w},Te=b=>{const e=J(11),{draggedRef:t,first:n,inferring:r,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,onSuggest:h,widget:i}=b;let l;return e[0]!==t||e[1]!==n||e[2]!==r||e[3]!==s||e[4]!==a||e[5]!==o||e[6]!==c||e[7]!==v||e[8]!==h||e[9]!==i?(l=le(i)==="text"?d(Ee,{draggedRef:t,first:n,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,widget:i}):d(Ae,{draggedRef:t,first:n,inferring:r,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,onSuggest:h,widget:i}),e[0]=t,e[1]=n,e[2]=r,e[3]=s,e[4]=a,e[5]=o,e[6]=c,e[7]=v,e[8]=h,e[9]=i,e[10]=l):l=e[10],l},We=["bar","line","area"],Ie=["chart","kpi","table","text"],$e="lunora-studio-dashboards",oe={chartKind:"bar",kind:"chart",shardKey:"",sql:"",text:"",title:""},De=(b,e)=>t=>t.map(n=>n.id===b?{...n,chartAxes:e,chartKind:e.kind}:n),je=(b,e)=>t=>{const n=t.find(a=>a.id===b),r=t.filter(a=>a.id!==b),s=r.findIndex(a=>a.id===e);return n===void 0||s===-1?t:[...r.slice(0,s),n,...r.slice(s)]},ze=(b,e)=>e(b==="line"?"Line":b==="area"?"Area":"Bar"),Be=(b,e)=>e(b==="kpi"?"Single value":b==="table"?"Table":b==="text"?"Text":"Chart"),Fe=b=>{const e=J(82),{draft:t,editing:n,onCancel:r,onChange:s,onSubmit:a}=b,o=te();let c;e[0]!==t||e[1]!==s?(c=u=>{s({...t,title:u.target.value})},e[0]=t,e[1]=s,e[2]=c):c=e[2];const v=c;let h;e[3]!==t||e[4]!==s?(h=u=>{s({...t,sql:u.target.value})},e[3]=t,e[4]=s,e[5]=h):h=e[5];const i=h;let l;e[6]!==t||e[7]!==s?(l=u=>{s({...t,text:u.target.value})},e[6]=t,e[7]=s,e[8]=l):l=e[8];const g=l;let N;e[9]!==t||e[10]!==s?(N=u=>{s({...t,shardKey:u.target.value})},e[9]=t,e[10]=s,e[11]=N):N=e[11];const f=N;let y;e[12]!==t||e[13]!==s?(y=u=>{s({...t,chartKind:u.target.value})},e[12]=t,e[13]=s,e[14]=y):y=e[14];const x=y;let q;e[15]!==t||e[16]!==s?(q=u=>{s({...t,kind:u.target.value})},e[15]=t,e[16]=s,e[17]=q):q=e[17];const O=q;let E;e[18]!==a?(E=()=>{a()},e[18]=a,e[19]=E):E=e[19];const z=E,C=t.kind==="text";let K;e[20]!==t.sql||e[21]!==t.text||e[22]!==t.title||e[23]!==C?(K=t.title.trim()!==""&&(C?t.text.trim()!=="":t.sql.trim()!==""),e[20]=t.sql,e[21]=t.text,e[22]=t.title,e[23]=C,e[24]=K):K=e[24];const W=K;let S;e[25]!==o?(S=o("Widget title"),e[25]=o,e[26]=S):S=e[26];let k;e[27]!==o?(k=o("Widget title"),e[27]=o,e[28]=k):k=e[28];let w;e[29]!==t.title||e[30]!==v||e[31]!==k||e[32]!==S?(w=d("input",{"aria-label":S,className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-title",onChange:v,placeholder:k,type:"text",value:t.title}),e[29]=t.title,e[30]=v,e[31]=k,e[32]=S,e[33]=w):w=e[33];let _;e[34]!==o?(_=o("Widget type"),e[34]=o,e[35]=_):_=e[35];const Q=t.kind;let B;e[36]!==o?(B=Ie.map(u=>d("option",{value:u,children:Be(u,o)},u)),e[36]=o,e[37]=B):B=e[37];let I;e[38]!==t.kind||e[39]!==O||e[40]!==_||e[41]!==B?(I=d("select",{"aria-label":_,className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-widget-kind",onChange:O,value:Q,children:B}),e[38]=t.kind,e[39]=O,e[40]=_,e[41]=B,e[42]=I):I=e[42];let R;e[43]!==t.sql||e[44]!==t.text||e[45]!==C||e[46]!==i||e[47]!==g||e[48]!==o?(R=C?d("textarea",{"aria-label":o("Text"),className:"min-h-24 resize-y rounded-md border border-border bg-background p-2 text-xs leading-5 outline-none focus-visible:border-ring","data-testid":"dashboards-form-text",onChange:g,placeholder:o("Notes for whoever reads this dashboard."),value:t.text}):d("textarea",{"aria-label":o("SQL query"),className:"min-h-24 resize-y rounded-md border border-border bg-background p-2 font-mono text-xs leading-5 outline-none focus-visible:border-ring","data-testid":"dashboards-form-sql",onChange:i,placeholder:"SELECT author, COUNT(*) AS messages FROM …",spellCheck:!1,value:t.sql}),e[43]=t.sql,e[44]=t.text,e[45]=C,e[46]=i,e[47]=g,e[48]=o,e[49]=R):R=e[49];let $;e[50]!==t.chartKind||e[51]!==t.kind||e[52]!==x||e[53]!==o?($=t.kind==="chart"&&d("select",{"aria-label":o("Chart type"),className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-kind",onChange:x,value:t.chartKind,children:We.map(u=>d("option",{value:u,children:ze(u,o)},u))}),e[50]=t.chartKind,e[51]=t.kind,e[52]=x,e[53]=o,e[54]=$):$=e[54];let L;e[55]!==t.shardKey||e[56]!==C||e[57]!==f||e[58]!==o?(L=!C&&d("input",{"aria-label":o("Shard key (optional)"),className:"h-8 rounded-md border border-border bg-background px-2 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-shard",onChange:f,placeholder:o("Shard key (optional)"),type:"text",value:t.shardKey}),e[55]=t.shardKey,e[56]=C,e[57]=f,e[58]=o,e[59]=L):L=e[59];let A;e[60]!==o?(A=o("Cancel"),e[60]=o,e[61]=A):A=e[61];let M;e[62]!==r||e[63]!==A?(M=d(Y,{"data-testid":"dashboards-form-cancel",onClick:r,size:"sm",type:"button",variant:"outline",children:A}),e[62]=r,e[63]=A,e[64]=M):M=e[64];const D=!W;let j;e[65]!==n||e[66]!==o?(j=o(n?"Save widget":"Add widget"),e[65]=n,e[66]=o,e[67]=j):j=e[67];let T;e[68]!==z||e[69]!==D||e[70]!==j?(T=d(Y,{"data-testid":"dashboards-form-save",disabled:D,onClick:z,size:"sm",type:"button",children:j}),e[68]=z,e[69]=D,e[70]=j,e[71]=T):T=e[71];let p;e[72]!==M||e[73]!==T?(p=Z("div",{className:"flex items-center justify-end gap-2",children:[M,T]}),e[72]=M,e[73]=T,e[74]=p):p=e[74];let m;return e[75]!==w||e[76]!==I||e[77]!==R||e[78]!==$||e[79]!==L||e[80]!==p?(m=d(ae,{"data-testid":"dashboards-form",children:Z(re,{className:"flex flex-col gap-3 py-4",children:[w,I,R,$,L,p]})}),e[75]=w,e[76]=I,e[77]=R,e[78]=$,e[79]=L,e[80]=p,e[81]=m):m=e[81],m},it=b=>{const e=J(53),{initialShardKey:t}=b,n=te(),[r,s]=be($e),[a,o]=X(oe),[c,v]=X(null),[h,i]=X(!1),l=ye(t??""),[g,N]=X(null),f=ue(null);let y;e[0]!==t?(y=()=>{v(null),o({...oe,shardKey:t??""}),i(!0)},e[0]=t,e[1]=y):y=e[1];const x=y;let q;e[2]===Symbol.for("react.memo_cache_sentinel")?(q=()=>{i(!1),v(null),o(oe)},e[2]=q):q=e[2];const O=q;let E;e[3]!==r?(E=p=>{const m=r.find(u=>u.id===p);m!==void 0&&(v(p),o({chartKind:m.chartKind??"bar",kind:le(m),shardKey:m.shardKey??"",sql:m.sql,text:m.text??"",title:m.title}),i(!0))},e[3]=r,e[4]=E):E=e[4];const z=E;let C;e[5]!==l||e[6]!==s?(C=(p,m)=>{N(p),de((async()=>{const F=await l.inferChart({columns:m.columns,rowCount:m.rowCount});F!==void 0&&s(De(p,F))})().finally(()=>{N(F=>F===p?null:F)}))},e[5]=l,e[6]=s,e[7]=C):C=e[7];const K=C;let W;e[8]!==s?(W=p=>{s(m=>m.filter(u=>u.id!==p))},e[8]=s,e[9]=W):W=e[9];const S=W;let k;e[10]!==s?(k=(p,m)=>{s(je(p,m))},e[10]=s,e[11]=k):k=e[11];const w=k;let _;e[12]!==s?(_=(p,m)=>{s(u=>{const F=u.findIndex(G=>G.id===p),U=F+m;if(F===-1||U<0||U>=u.length)return u;const V=[...u],H=V[F],P=V[U];return H===void 0||P===void 0?u:(V[F]=P,V[U]=H,V)})},e[12]=s,e[13]=_):_=e[13];const Q=_;let B;e[14]!==a||e[15]!==c||e[16]!==s?(B=()=>{const p=a.title.trim(),m=a.sql.trim(),u=a.text.trim(),{chartKind:F,kind:U}=a;if(p===""||(U==="text"?u==="":m===""))return;const V={chartKind:F,kind:U,shardKey:a.shardKey.trim(),sql:m,text:u,title:p};s(c===null?H=>[...H,{...V,id:ve("w")}]:H=>H.map(P=>P.id===c?{...P,...V}:P)),O()},e[14]=a,e[15]=c,e[16]=s,e[17]=B):B=e[17];const I=B;let R;e[18]!==n?(R=n("Charts, values, tables, and notes. Drag a tile to reorder."),e[18]=n,e[19]=R):R=e[19];let $;e[20]!==R?($=d("p",{className:"text-sm text-muted-foreground",children:R}),e[20]=R,e[21]=$):$=e[21];let L;e[22]!==h||e[23]!==x||e[24]!==n?(L=!h&&d(Y,{"data-testid":"dashboards-add",onClick:x,size:"sm",type:"button",children:n("Add widget")}),e[22]=h,e[23]=x,e[24]=n,e[25]=L):L=e[25];let A;e[26]!==$||e[27]!==L?(A=Z("div",{className:"flex items-center justify-between",children:[$,L]}),e[26]=$,e[27]=L,e[28]=A):A=e[28];let M;e[29]!==l||e[30]!==n?(M=l.reason("chart")!==void 0&&d(ne,{className:"text-xs",testId:"dashboards-suggest-error",variant:"destructive",children:n("Could not suggest a chart for that result.")}),e[29]=l,e[30]=n,e[31]=M):M=e[31];let D;e[32]!==a||e[33]!==c||e[34]!==h||e[35]!==I?(D=h&&d(Fe,{draft:a,editing:c!==null,onCancel:O,onChange:o,onSubmit:I}),e[32]=a,e[33]=c,e[34]=h,e[35]=I,e[36]=D):D=e[36];let j;e[37]!==l.unavailable||e[38]!==h||e[39]!==g||e[40]!==z||e[41]!==Q||e[42]!==S||e[43]!==w||e[44]!==K||e[45]!==n||e[46]!==r?(j=r.length===0&&!h?d(me,{description:n("Add a chart, a single value, a table, or a note. Everything is saved on this browser."),testId:"dashboards-empty",title:n("No widgets yet")}):d("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3","data-testid":"dashboards-grid",children:r.map((p,m)=>d(Te,{draggedRef:f,first:m===0,inferring:g===p.id,last:m===r.length-1,onEdit:z,onMove:Q,onRemove:S,onReorder:w,onSuggest:l.unavailable?void 0:K,widget:p},p.id))}),e[37]=l.unavailable,e[38]=h,e[39]=g,e[40]=z,e[41]=Q,e[42]=S,e[43]=w,e[44]=K,e[45]=n,e[46]=r,e[47]=j):j=e[47];let T;return e[48]!==A||e[49]!==M||e[50]!==D||e[51]!==j?(T=Z("div",{className:"flex flex-col gap-4","data-testid":"lunora-dashboards",children:[A,M,D,j]}),e[48]=A,e[49]=M,e[50]=D,e[51]=j,e[52]=T):T=e[52],T};export{it as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as I}from"react/compiler-runtime";import{E as K}from"../packem_shared/error-alert-
|
|
1
|
+
import{c as I}from"react/compiler-runtime";import{E as K}from"../packem_shared/error-alert-ClpDVYvo.mjs";import{ShardInput as O}from"../packem_shared/ShardInput-C6mjgAh4.mjs";import{B as w}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as M,a as $}from"../packem_shared/card--2hKx4L2.mjs";import{E as j}from"../packem_shared/empty-state-D7jEML_T.mjs";import{u as T}from"../packem_shared/use-admin-query-BvZH4unR.mjs";import{u as A}from"../packem_shared/use-open-trace-CTQIPjo9.mjs";import{u as k}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{useT as C}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as E}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{i as R}from"../packem_shared/internal-D4gBuklE.mjs";import{S as B}from"../packem_shared/sparkline-B_sPPO_8.mjs";import{jsxs as g,jsx as c}from"react/jsx-runtime";const F=n=>n.length===0?void 0:{max:Math.max(...n),mean:n.reduce((e,t)=>e+t,0)/n.length,min:Math.min(...n)},_=/^gen_ai\.evaluation\.(.+)\.score$/u,q=n=>{const e=[];for(const t of n)for(const r of t.spans)for(const[a,l]of Object.entries(r.attributes??{})){const o=_.exec(a);if(!o||typeof l!="number")continue;const i=o[1],m=r.attributes?.[`gen_ai.evaluation.${i}.label`];e.push({...typeof m=="string"?{label:m}:{},name:i,score:l,spanName:r.name,startTs:t.startTs+r.offsetMs,traceId:t.traceId})}return e.toSorted((t,r)=>r.startTs-t.startTs)},D=n=>{const e=[];for(const t of n?.series??[]){const r=_.exec(t.name);r&&e.push({name:r[1],points:t.points})}return e},H=(n,e)=>{const t=new Set([...n.map(a=>a.name),...e.map(a=>a.name)]),r=[];for(const a of t){const l=n.filter(s=>s.name===a),o=e.find(s=>s.name===a)?.points??[],i=o.at(-1)?.last??l[0]?.score,m=o.length>0?{max:Math.max(...o.map(s=>s.max)),mean:o.reduce((s,d)=>s+d.sum,0)/o.reduce((s,d)=>s+d.count,0),min:Math.min(...o.map(s=>s.min))}:F(l.map(s=>s.score));r.push({...i===void 0?{}:{latest:i},...m,name:a,points:o,runs:l})}return r.toSorted((a,l)=>a.name.localeCompare(l.name))},L=n=>Array.isArray(n?.traces)?n.traces:[],y=n=>n===void 0?"—":n.toFixed(2),P=n=>{const e=I(34),{card:t,onOpenTrace:r}=n,a=C();let l;e[0]!==t.name?(l=c("h3",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"ev-name",children:t.name}),e[0]=t.name,e[1]=l):l=e[1];let o;e[2]!==t.latest?(o=y(t.latest),e[2]=t.latest,e[3]=o):o=e[3];let i;e[4]!==o?(i=c("span",{className:"font-mono text-lg text-foreground","data-testid":"ev-latest",children:o}),e[4]=o,e[5]=i):i=e[5];let m;e[6]!==l||e[7]!==i?(m=g("div",{className:"flex items-baseline justify-between gap-3",children:[l,i]}),e[6]=l,e[7]=i,e[8]=m):m=e[8];let s;e[9]!==t.max||e[10]!==t.mean||e[11]!==t.min||e[12]!==a?(s=a("min {min} · mean {mean} · max {max}",{max:y(t.max),mean:y(t.mean),min:y(t.min)}),e[9]=t.max,e[10]=t.mean,e[11]=t.min,e[12]=a,e[13]=s):s=e[13];let d;e[14]!==s?(d=c("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"ev-summary",children:s}),e[14]=s,e[15]=d):d=e[15];let f;e[16]!==t.name||e[17]!==t.points||e[18]!==a?(f=t.points.length>1?c(B,{ariaLabel:a("Score trend for {name}",{name:t.name}),className:"h-10 w-full",series:t.points.map(Q),testId:"ev-trend"}):c("p",{className:"text-xs text-muted-foreground","data-testid":"ev-no-trend",children:a("No durable history yet — pass ctx.metrics to recordEvaluation to chart a trend.")}),e[16]=t.name,e[17]=t.points,e[18]=a,e[19]=f):f=e[19];let u;if(e[20]!==t.runs||e[21]!==r||e[22]!==a){let x;e[24]!==r||e[25]!==a?(x=p=>g("div",{className:"flex items-center justify-between gap-2 font-mono text-xs","data-testid":"ev-run",children:[g("span",{className:"truncate text-muted-foreground",children:[R(p.startTs)," · ",p.spanName]}),g("span",{className:"flex items-center gap-2",children:[p.label===void 0?null:c(w,{variant:"outline",children:p.label}),c("span",{className:"text-foreground",children:y(p.score)}),r===void 0?null:c("button",{className:"text-muted-foreground underline-offset-2 hover:underline",onClick:()=>{r(p.traceId)},title:a("Open the trace {trace}",{trace:p.traceId}),type:"button",children:p.traceId.slice(0,8)})]})]},`${p.traceId}:${p.spanName}`),e[24]=r,e[25]=a,e[26]=x):x=e[26],u=t.runs.slice(0,5).map(x),e[20]=t.runs,e[21]=r,e[22]=a,e[23]=u}else u=e[23];let h;e[27]!==u?(h=c("div",{className:"flex flex-col gap-1",children:u}),e[27]=u,e[28]=h):h=e[28];let v;return e[29]!==m||e[30]!==d||e[31]!==f||e[32]!==h?(v=c(M,{"data-testid":"ev-card",children:g($,{className:"flex flex-col gap-3 p-4",children:[m,d,f,h]})}),e[29]=m,e[30]=d,e[31]=f,e[32]=h,e[33]=v):v=e[33],v},re=n=>{const e=I(19),{initialShardKey:t}=n,r=C(),{queryShardKey:a,setShardKey:l,shardKey:o}=k(t),i=A(a);let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={},e[0]=m):m=e[0];let s;e[1]!==a?(s={live:!0,shardKey:a},e[1]=a,e[2]=s):s=e[2];const{data:d,error:f}=T(E.getTraces,m,s);let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u={},e[3]=u):u=e[3];let h;e[4]!==a?(h={live:!0,shardKey:a},e[4]=a,e[5]=h):h=e[5];const{data:v}=T(E.getMetricHistory,u,h);let x;if(e[6]!==d||e[7]!==f||e[8]!==v||e[9]!==i||e[10]!==l||e[11]!==o||e[12]!==r){const p=H(q(L(d)),D(v));let N;e[14]!==l||e[15]!==o?(N=c(O,{onChange:l,testId:"ev-shard-input",value:o}),e[14]=l,e[15]=o,e[16]=N):N=e[16];let b;e[17]!==f?(b=f===null?null:c(K,{error:f,testId:"ev-error"}),e[17]=f,e[18]=b):b=e[18],x=g("section",{className:"flex flex-col gap-4","data-testid":"ev-panel",children:[N,b,p.length===0?c(j,{description:r("Call recordEvaluation from a graded run and its score shows up here."),testId:"ev-empty",title:r("No evals recorded")}):c("div",{className:"grid gap-3 md:grid-cols-2",children:p.map(S=>c(P,{card:S,onOpenTrace:i},S.name))})]}),e[6]=d,e[7]=f,e[8]=v,e[9]=i,e[10]=l,e[11]=o,e[12]=r,e[13]=x}else x=e[13];return x};function Q(n){return n.last}export{re as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as R}from"react/compiler-runtime";import{E as B}from"../packem_shared/error-alert-
|
|
1
|
+
import{c as R}from"react/compiler-runtime";import{E as B}from"../packem_shared/error-alert-ClpDVYvo.mjs";import{ShardInput as E}from"../packem_shared/ShardInput-C6mjgAh4.mjs";import{S as I}from"../packem_shared/stat-card-D0Fe04cX.mjs";import{B as M}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as _}from"../packem_shared/card--2hKx4L2.mjs";import{E as j}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as G,a as H,b as A,c as w,d as L,e as K}from"../packem_shared/table-D0SBiDu-.mjs";import{u as Q}from"../packem_shared/use-admin-query-BvZH4unR.mjs";import{useAutoRefresh as W}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs";import{u as q}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{useT as O}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as U}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{jsxs as m,jsx as l,Fragment as z}from"react/jsx-runtime";const D=d=>`${d.toString()} ms`,J=d=>d.totalConnections===0&&d.shapePoke.passes===0&&d.whisper.passes===0&&d.shapeProbe.run===0&&d.shapeProbe.served===0&&d.globalPoll.drains===0&&d.globalPoll.pairsSkipped===0,F=d=>{const e=R(48),{counters:o,includeTiming:t,prefix:r,t:a,title:u}=d,c=`${r}-section`;let n;e[0]!==u?(n=l("h3",{className:"text-sm font-medium text-foreground",children:u}),e[0]=u,e[1]=n):n=e[1];const s=`${r}-stats`;let i;e[2]!==a?(i=a("Passes"),e[2]=a,e[3]=i):i=e[3];const f=`${r}-passes`;let N;e[4]!==o.passes||e[5]!==i||e[6]!==f?(N=l(I,{label:i,testId:f,value:o.passes}),e[4]=o.passes,e[5]=i,e[6]=f,e[7]=N):N=e[7];let g;e[8]!==a?(g=a("Sockets iterated"),e[8]=a,e[9]=g):g=e[9];const k=`${r}-iterated`;let p;e[10]!==o.socketsIterated||e[11]!==g||e[12]!==k?(p=l(I,{label:g,testId:k,value:o.socketsIterated}),e[10]=o.socketsIterated,e[11]=g,e[12]=k,e[13]=p):p=e[13];let h;e[14]!==a?(h=a("Delivered"),e[14]=a,e[15]=h):h=e[15];const y=`${r}-delivered`;let b;e[16]!==o.socketsDelivered||e[17]!==h||e[18]!==y?(b=l(I,{label:h,testId:y,value:o.socketsDelivered}),e[16]=o.socketsDelivered,e[17]=h,e[18]=y,e[19]=b):b=e[19];let x;e[20]!==a?(x=a("Peak width"),e[20]=a,e[21]=x):x=e[21];const S=`${r}-peak`;let v;e[22]!==o.peakSocketsIterated||e[23]!==x||e[24]!==S?(v=l(I,{label:x,testId:S,value:o.peakSocketsIterated}),e[22]=o.peakSocketsIterated,e[23]=x,e[24]=S,e[25]=v):v=e[25];let C;e[26]!==o.totalMs||e[27]!==t||e[28]!==r||e[29]!==a?(C=t&&l(I,{label:a("Total time"),testId:`${r}-total-ms`,value:D(o.totalMs)}),e[26]=o.totalMs,e[27]=t,e[28]=r,e[29]=a,e[30]=C):C=e[30];let P;e[31]!==o.maxMs||e[32]!==t||e[33]!==r||e[34]!==a?(P=t&&l(I,{label:a("Max time"),testId:`${r}-max-ms`,value:D(o.maxMs)}),e[31]=o.maxMs,e[32]=t,e[33]=r,e[34]=a,e[35]=P):P=e[35];let $;e[36]!==b||e[37]!==v||e[38]!==C||e[39]!==P||e[40]!==s||e[41]!==N||e[42]!==p?($=m("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":s,children:[N,p,b,v,C,P]}),e[36]=b,e[37]=v,e[38]=C,e[39]=P,e[40]=s,e[41]=N,e[42]=p,e[43]=$):$=e[43];let T;return e[44]!==c||e[45]!==$||e[46]!==n?(T=m("section",{className:"flex flex-col gap-2","data-testid":c,children:[n,$]}),e[44]=c,e[45]=$,e[46]=n,e[47]=T):T=e[47],T},V=d=>{const e=R(20),{counters:o,t}=d;let r;e[0]!==t?(r=t("Membership probes"),e[0]=t,e[1]=r):r=e[1];let a;e[2]!==r?(a=l("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=a):a=e[3];let u;e[4]!==t?(u=t("Queries run"),e[4]=t,e[5]=u):u=e[5];let c;e[6]!==o.run||e[7]!==u?(c=l(I,{label:u,testId:"fanout-probe-run",value:o.run}),e[6]=o.run,e[7]=u,e[8]=c):c=e[8];let n;e[9]!==t?(n=t("Shared from cache"),e[9]=t,e[10]=n):n=e[10];let s;e[11]!==o.served||e[12]!==n?(s=l(I,{label:n,testId:"fanout-probe-served",value:o.served}),e[11]=o.served,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==c||e[15]!==s?(i=m("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-probe-stats",children:[c,s]}),e[14]=c,e[15]=s,e[16]=i):i=e[16];let f;return e[17]!==a||e[18]!==i?(f=m("section",{className:"flex flex-col gap-2","data-testid":"fanout-probe-section",children:[a,i]}),e[17]=a,e[18]=i,e[19]=f):f=e[19],f},X=d=>{const e=R(20),{counters:o,t}=d;let r;e[0]!==t?(r=t("Global shape polls"),e[0]=t,e[1]=r):r=e[1];let a;e[2]!==r?(a=l("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=a):a=e[3];let u;e[4]!==t?(u=t("Global reads"),e[4]=t,e[5]=u):u=e[5];let c;e[6]!==o.drains||e[7]!==u?(c=l(I,{label:u,testId:"fanout-global-poll-drains",value:o.drains}),e[6]=o.drains,e[7]=u,e[8]=c):c=e[8];let n;e[9]!==t?(n=t("Pairs skipped"),e[9]=t,e[10]=n):n=e[10];let s;e[11]!==o.pairsSkipped||e[12]!==n?(s=l(I,{label:n,testId:"fanout-global-poll-pairs-skipped",value:o.pairsSkipped}),e[11]=o.pairsSkipped,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==c||e[15]!==s?(i=m("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-global-poll-stats",children:[c,s]}),e[14]=c,e[15]=s,e[16]=i):i=e[16];let f;return e[17]!==a||e[18]!==i?(f=m("section",{className:"flex flex-col gap-2","data-testid":"fanout-global-poll-section",children:[a,i]}),e[17]=a,e[18]=i,e[19]=f):f=e[19],f},me=d=>{const e=R(31),{initialShardKey:o}=d,t=O(),{queryShardKey:r,setShardKey:a,shardKey:u}=q(o);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];let n;e[1]!==r?(n={keepPreviousData:!0,shardKey:r},e[1]=r,e[2]=n):n=e[2];const{data:s,error:i,errorSource:f,refetch:N}=Q(U.getFanoutMetrics,c,n);W(N,!0);let g;e[3]!==s?(g=s!==void 0&&J(s),e[3]=s,e[4]=g):g=e[4];const k=g;let p;e[5]!==a||e[6]!==u?(p=l(E,{onChange:a,testId:"fanout-shard-input",value:u}),e[5]=a,e[6]=u,e[7]=p):p=e[7];let h;e[8]!==s||e[9]!==t?(h=s!==void 0&&m("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[s.promoted&&l(M,{"data-testid":"fanout-promoted",variant:s.relayCount>=s.maxRelays?"destructive":"default",children:s.relayCount>=s.maxRelays?t("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:s.maxRelays,relayCount:s.relayCount}):t("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:s.maxRelays,relayCount:s.relayCount})}),l(M,{variant:"secondary",children:t("{count} connections",{count:s.totalConnections})}),l(M,{variant:"secondary",children:t("peak {count} subscribers",{count:s.peakSubscribers})})]}),e[8]=s,e[9]=t,e[10]=h):h=e[10];let y;e[11]!==p||e[12]!==h?(y=m("div",{className:"flex flex-wrap items-center gap-2",children:[p,h]}),e[11]=p,e[12]=h,e[13]=y):y=e[13];let b;e[14]!==i||e[15]!==f?(b=i!==null&&l(B,{error:f,testId:"fanout-error"}),e[14]=i,e[15]=f,e[16]=b):b=e[16];let x;e[17]!==i||e[18]!==k||e[19]!==t?(x=i===null&&k&&l(j,{description:t("Realtime fan-out cost and per-topic subscriber counts for this shard."),icon:l("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:l("path",{d:"M4 12h4l3 7 4-14 3 7h2"})}),testId:"fanout-empty",title:t("No fan-out activity yet.")}),e[17]=i,e[18]=k,e[19]=t,e[20]=x):x=e[20];let S;e[21]!==i||e[22]!==k||e[23]!==s||e[24]!==t?(S=i===null&&s!==void 0&&!k&&m(z,{children:[s.topics.length>0&&m("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[l("h3",{className:"text-sm font-medium text-foreground",children:t("Hot topics")}),l(_,{className:"overflow-hidden py-0",children:m(G,{"data-testid":"fanout-topics-table",children:[l(H,{children:m(A,{children:[l(w,{children:t("Topic")}),l(w,{children:t("Kind")}),l(w,{className:"text-right",children:t("Subscribers")})]})}),l(L,{children:s.topics.map(Y)})]})})]}),m("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[l("h2",{className:"text-sm font-medium text-muted-foreground",children:t("Fan-out cost since this instance woke")}),l(F,{counters:s.shapePoke,includeTiming:!0,prefix:"fanout-poke",t,title:t("Shape pokes")}),l(F,{counters:s.whisper,includeTiming:!1,prefix:"fanout-whisper",t,title:t("Whisper broadcasts")}),l(V,{counters:s.shapeProbe,t}),l(X,{counters:s.globalPoll,t})]})]}),e[21]=i,e[22]=k,e[23]=s,e[24]=t,e[25]=S):S=e[25];let v;return e[26]!==y||e[27]!==b||e[28]!==x||e[29]!==S?(v=m("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[y,b,x,S]}),e[26]=y,e[27]=b,e[28]=x,e[29]=S,e[30]=v):v=e[30],v};function Y(d){return m(A,{"data-testid":"fanout-topic-row",children:[l(K,{className:"font-mono text-xs",children:d.topic}),l(K,{children:l(M,{variant:"outline",children:d.kind})}),l(K,{className:"text-right font-medium tabular-nums",children:d.subscribers})]},`${d.kind}:${d.topic}`)}export{me as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useState as C}from"react";import{E as S}from"../packem_shared/error-alert-
|
|
1
|
+
import{useState as C}from"react";import{E as S}from"../packem_shared/error-alert-ClpDVYvo.mjs";import{B as w}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as A,a as k}from"../packem_shared/card--2hKx4L2.mjs";import{E as g}from"../packem_shared/empty-state-D7jEML_T.mjs";import{L as E}from"../packem_shared/label-DKFzyHq6.mjs";import{T as O,a as F,b as x,c as s,d as j,e as n}from"../packem_shared/table-D0SBiDu-.mjs";import{T as I}from"../packem_shared/textarea--40GKAyz.mjs";import{u as J}from"../packem_shared/use-admin-query-BvZH4unR.mjs";import{useT as L}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as B}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{jsx as e,jsxs as l}from"react/jsx-runtime";const H=a=>{const t=a.trim();if(t.length===0)return{context:void 0,error:null};try{const o=JSON.parse(t);return o===null||typeof o!="object"||Array.isArray(o)?{context:void 0,error:"Targeting context must be a JSON object."}:{context:o,error:null}}catch{return{context:void 0,error:"Targeting context is not valid JSON."}}},K='{ "targetingKey": "user-123", "plan": "premium" }',R=a=>a.type==="object"?JSON.stringify(a.value):String(a.value),W=({initialShardKey:a=""})=>{const t=L(),[o,p]=C(""),{context:c,error:f}=H(o),h=c===void 0?{}:{context:c},{data:i,error:y,errorSource:v,liveError:N}=J(B.listFlags,h,{live:!0,shardKey:a}),m=i!==void 0,b=i?.configured??!1,u=Array.isArray(i?.flags)?[...i.flags].toSorted((r,T)=>r.key.localeCompare(T.key)):[];let d;return m&&!b?d=e(g,{description:t("No @lunora/flags provider is wired in this deployment. Add lunora/flags.ts with defineFlags({ provider }) to gate code paths on feature flags."),testId:"flags-unconfigured",title:t("No flags provider configured")}):m&&u.length===0?d=e(g,{description:t('A flags provider is configured, but no handler reads a flag yet. Call ctx.flags.boolean("key", false) in a query, mutation, or action.'),testId:"flags-empty",title:t("No flags read")}):d=e(A,{className:"overflow-hidden py-0",children:e(k,{className:"px-0",children:l(O,{"data-testid":"flags-table",children:[e(F,{children:l(x,{children:[e(s,{children:t("Key")}),e(s,{children:t("Type")}),e(s,{children:t("Value")}),e(s,{children:t("Reason")}),e(s,{children:t("Variant")})]})}),e(j,{children:u.map(r=>l(x,{"data-testid":`flags-row-${r.key}`,children:[e(n,{className:"font-mono text-xs",children:r.key}),e(n,{className:"font-mono text-xs text-muted-foreground",children:r.type}),e(n,{className:"font-mono text-xs",children:R(r)}),e(n,{children:r.errorCode===void 0?e("span",{className:"font-mono text-xs text-muted-foreground",children:r.reason??"—"}):e(w,{"data-testid":`flags-error-${r.key}`,variant:"destructive",children:r.errorCode})}),e(n,{className:"font-mono text-xs text-muted-foreground",children:r.variant??"—"})]},r.key))})]})})}),l("div",{className:"flex flex-col gap-6","data-testid":"lunora-flags-panel",children:[y!==null&&e(S,{error:v,testId:"flags-error"}),e("p",{className:"text-sm text-muted-foreground",children:t('Feature flags are read in code with ctx.flags.<type>("key", default). They evaluate through the OpenFeature provider configured in lunora/flags.ts; edit the targeting context below to see how each flag resolves for a given audience.')}),l("div",{className:"flex flex-col gap-2",children:[e(E,{htmlFor:"flags-targeting-context",children:t("Targeting context (JSON)")}),e(I,{className:"font-mono text-xs","data-testid":"flags-context-input",id:"flags-targeting-context",onChange:r=>{p(r.target.value)},placeholder:K,rows:3,value:o}),f!==null&&e("p",{className:"text-xs text-destructive","data-testid":"flags-context-error",role:"alert",children:t(f)}),N!==void 0&&e("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"flags-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")})]}),d]})};export{W as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as xe}from"react/compiler-runtime";import{findIssueSolution as we,flattenHint as Ee}from"@lunora/errors";import{useLunora as Ne}from"@lunora/react";import{useState as ne}from"react";import{L as Te}from"../packem_shared/live-status-BuJdUZFU.mjs";import{ShardInput as $e}from"../packem_shared/ShardInput-C6mjgAh4.mjs";import{B as pe}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as oe}from"../packem_shared/button-q0UYSmrn.mjs";import{C as Ae,a as Ce}from"../packem_shared/card--2hKx4L2.mjs";import{E as _e}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as ke}from"../packem_shared/input-CXhxesPC.mjs";import{S as Me,a as Re,b as Ke,c as be,d as Le}from"../packem_shared/select-DPyS18Vy.mjs";import{T as Ve,a as Oe,b as ye,c as F,d as Ue,e as B}from"../packem_shared/table-D0SBiDu-.mjs";import{u as Be}from"../packem_shared/use-admin-query-C7JRlFIE.mjs";import{u as Fe}from"../packem_shared/use-async-submit-DAKymxcP.mjs";import{u as ze}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{useT as ve}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as ie}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{i as He,f as re,c as de,d as Ie,b as je}from"../packem_shared/internal-CwaF9YNk.mjs";import{jsx as s,jsxs as w,Fragment as De}from"react/jsx-runtime";const ge="none",qe=["all","open","resolved","ignored"],Ge=["critical","high","medium","low"],Pe=de(ie.resolveIssue),We=de(ie.ignoreIssue),Se=de(ie.assignIssue),Ye=de(ie.setIssueSeverity),Qe=de(ie.explainIssue),Xe=n=>Array.isArray(n?.issues)?n.issues:[],Je=n=>n==="resolved"?"success":n==="ignored"?"secondary":"warning",Ze=n=>n==="critical"?"destructive":n==="high"?"warning":n==="medium"?"info":"secondary",et=n=>{const e=xe(44),{expanded:h,issue:t,shardKey:E}=n,i=Ne(),r=ve(),[a,o]=ne(void 0),{busy:R,error:A,run:L}=Fe();let C;e[0]!==i||e[1]!==t||e[2]!==L||e[3]!==E?(C=()=>{o(void 0),L(async()=>{const f={culprit:t.culprit,sampleMessage:t.sampleMessage,title:t.title},I=await i.query(Qe,f,Ie(E));o(I)})},e[0]=i,e[1]=t,e[2]=L,e[3]=E,e[4]=C):C=e[4];const K=C;if(!h)return null;let T;if(e[5]!==t.sampleMessage){const f=we(t.sampleMessage);T=f===void 0?void 0:Ee(f.body),e[5]=t.sampleMessage,e[6]=T}else T=e[6];const _=T,M=`issues-detail-${t.hash}`;let d;e[7]!==t.sampleMessage?(d=s("p",{className:"whitespace-pre-wrap font-mono text-xs text-muted-foreground",children:t.sampleMessage}),e[7]=t.sampleMessage,e[8]=d):d=e[8];let g;e[9]!==r?(g=r("Suggested fix"),e[9]=r,e[10]=g):g=e[10];let $;e[11]!==g?($=s("div",{className:"text-xs font-medium text-muted-foreground",children:g}),e[11]=g,e[12]=$):$=e[12];let x;e[13]!==_||e[14]!==t.hash||e[15]!==r?(x=_===void 0?s("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":`issues-hint-empty-${t.hash}`,children:r("No known fix for this error yet.")}):s("p",{className:"mt-1 whitespace-pre-wrap text-sm","data-testid":`issues-hint-${t.hash}`,children:_}),e[13]=_,e[14]=t.hash,e[15]=r,e[16]=x):x=e[16];let y;e[17]!==$||e[18]!==x?(y=w("div",{children:[$,x]}),e[17]=$,e[18]=x,e[19]=y):y=e[19];const S=`issues-explain-${t.hash}`;let N;e[20]!==R||e[21]!==r?(N=r(R?"Explaining…":"Explain in plain language"),e[20]=R,e[21]=r,e[22]=N):N=e[22];let u;e[23]!==R||e[24]!==K||e[25]!==N||e[26]!==S?(u=s("div",{children:s(oe,{"data-testid":S,disabled:R,onClick:K,size:"sm",type:"button",variant:"outline",children:N})}),e[23]=R,e[24]=K,e[25]=N,e[26]=S,e[27]=u):u=e[27];let p;e[28]!==A||e[29]!==t.hash?(p=A!==null&&s("p",{className:"text-xs text-destructive","data-testid":`issues-explain-error-${t.hash}`,role:"alert",children:A}),e[28]=A,e[29]=t.hash,e[30]=p):p=e[30];let m;e[31]!==a||e[32]!==t.hash||e[33]!==r?(m=a!==void 0&&(a.degraded?s("p",{className:"text-xs text-muted-foreground","data-testid":`issues-degraded-${t.hash}`,children:a.reason==="no-ai-binding"?r("No AI binding is configured. Wire an AI binding to enable plain-language explanations — the suggested fix above is always available."):r("The AI model could not explain this error right now. The suggested fix above still applies.")}):w("div",{"data-testid":`issues-explanation-${t.hash}`,children:[s("div",{className:"text-xs font-medium text-muted-foreground",children:r("AI explanation")}),s("p",{className:"mt-1 whitespace-pre-wrap text-sm",children:a.explanation}),a.groundedId===void 0&&s("p",{className:"mt-1 text-xs text-muted-foreground","data-testid":`issues-ungrounded-${t.hash}`,children:r("No catalog fix matched this error, so this explanation is the model's own reading of the message. Verify before acting on it.")}),s("p",{className:"mt-1 text-[0.7rem] text-muted-foreground",children:r("Generated by {model}",{model:a.model})})]})),e[31]=a,e[32]=t.hash,e[33]=r,e[34]=m):m=e[34];let c;e[35]!==u||e[36]!==p||e[37]!==m||e[38]!==d||e[39]!==y?(c=s(B,{className:"bg-muted/30",colSpan:7,children:w("div",{className:"flex flex-col gap-3 py-1",children:[d,y,u,p,m]})}),e[35]=u,e[36]=p,e[37]=m,e[38]=d,e[39]=y,e[40]=c):c=e[40];let b;return e[41]!==c||e[42]!==M?(b=s(ye,{"data-testid":M,children:c}),e[41]=c,e[42]=M,e[43]=b):b=e[43],b},tt=n=>{const e=xe(119),{busy:h,issue:t,rowError:E,runTriage:i,shardKey:r}=n,a=ve(),[o,R]=ne(!1);let A;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{R(st)},e[0]=A):A=e[0];const L=A;let C;e[1]!==t.hash||e[2]!==i?(C=ae=>{const he=ae===null||ae===ge?null:ae;re(i(t.hash,Ye,{severity:he}))},e[1]=t.hash,e[2]=i,e[3]=C):C=e[3];const K=C;let T;e[4]!==t.hash||e[5]!==i?(T=ae=>{if(ae.key!=="Enter")return;const he=ae.currentTarget.value.trim();re(i(t.hash,Se,{assignee:he===""?null:he}))},e[4]=t.hash,e[5]=i,e[6]=T):T=e[6];const _=T,M=`issues-row-${t.hash}`;let d;e[7]!==a?(d=a("Toggle issue details"),e[7]=a,e[8]=d):d=e[8];const g=`issues-toggle-${t.hash}`,$=`mt-1 size-3 shrink-0 text-muted-foreground transition-transform ${o?"rotate-90":""}`;let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=s("path",{d:"m9 6 6 6-6 6"}),e[9]=x):x=e[9];let y;e[10]!==$?(y=s("svg",{"aria-hidden":"true",className:$,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:x}),e[10]=$,e[11]=y):y=e[11];let S;e[12]!==t.title?(S=s("span",{className:"block truncate font-medium",title:t.title,children:t.title}),e[12]=t.title,e[13]=S):S=e[13];let N;e[14]!==t.culprit?(N=s("span",{className:"block truncate font-mono text-xs text-muted-foreground",title:t.culprit,children:t.culprit}),e[14]=t.culprit,e[15]=N):N=e[15];let u;e[16]!==S||e[17]!==N?(u=w("span",{className:"min-w-0",children:[S,N]}),e[16]=S,e[17]=N,e[18]=u):u=e[18];let p;e[19]!==o||e[20]!==u||e[21]!==d||e[22]!==g||e[23]!==y?(p=w("button",{"aria-expanded":o,"aria-label":d,className:"flex w-full items-start gap-2 text-left","data-testid":g,onClick:L,type:"button",children:[y,u]}),e[19]=o,e[20]=u,e[21]=d,e[22]=g,e[23]=y,e[24]=p):p=e[24];let m;e[25]!==t.hash||e[26]!==E?(m=E!==void 0&&s("p",{className:"mt-1 text-xs text-destructive","data-testid":`issues-action-error-${t.hash}`,role:"alert",children:E}),e[25]=t.hash,e[26]=E,e[27]=m):m=e[27];let c;e[28]!==p||e[29]!==m?(c=w(B,{className:"max-w-80",children:[p,m]}),e[28]=p,e[29]=m,e[30]=c):c=e[30];const b=`issues-status-${t.hash}`;let f;e[31]!==t.status?(f=Je(t.status),e[31]=t.status,e[32]=f):f=e[32];let I;e[33]!==t.status||e[34]!==b||e[35]!==f?(I=s(B,{children:s(pe,{"data-testid":b,variant:f,children:t.status})}),e[33]=t.status,e[34]=b,e[35]=f,e[36]=I):I=e[36];const V=t.severity??ge;let l;e[37]!==a?(l=a("Set severity"),e[37]=a,e[38]=l):l=e[38];const le=`issues-severity-${t.hash}`;let O;e[39]!==a?(O=a("—"),e[39]=a,e[40]=O):O=e[40];let v;e[41]!==t.severity||e[42]!==a?(v=t.severity===void 0?s("span",{className:"text-muted-foreground",children:a("—")}):s(pe,{variant:Ze(t.severity),children:t.severity}),e[41]=t.severity,e[42]=a,e[43]=v):v=e[43];let k;e[44]!==O||e[45]!==v?(k=s(Me,{placeholder:O,children:v}),e[44]=O,e[45]=v,e[46]=k):k=e[46];let U;e[47]!==l||e[48]!==le||e[49]!==k?(U=s(Re,{"aria-label":l,className:"h-7 w-[110px]","data-testid":le,children:k}),e[47]=l,e[48]=le,e[49]=k,e[50]=U):U=e[50];let z;e[51]===Symbol.for("react.memo_cache_sentinel")?(z=Ge.map(at),e[51]=z):z=e[51];let H;e[52]!==a?(H=a("Clear"),e[52]=a,e[53]=H):H=e[53];let j;e[54]!==H?(j=w(Ke,{children:[z,s(be,{value:ge,children:H})]}),e[54]=H,e[55]=j):j=e[55];let D;e[56]!==h||e[57]!==K||e[58]!==V||e[59]!==U||e[60]!==j?(D=s(B,{children:w(Le,{disabled:h,onValueChange:K,value:V,children:[U,j]})}),e[56]=h,e[57]=K,e[58]=V,e[59]=U,e[60]=j,e[61]=D):D=e[61];let q;e[62]!==a?(q=a("Assignee"),e[62]=a,e[63]=q):q=e[63];const ue=`issues-assignee-${t.hash}`,me=t.assignee??"",fe=t.assignee??"";let G;e[64]!==a?(G=a("Unassigned"),e[64]=a,e[65]=G):G=e[65];let P;e[66]!==h||e[67]!==_||e[68]!==q||e[69]!==ue||e[70]!==me||e[71]!==fe||e[72]!==G?(P=s(B,{children:s(ke,{"aria-label":q,className:"h-7 w-32","data-testid":ue,defaultValue:me,disabled:h,onKeyDown:_,placeholder:G},fe)}),e[66]=h,e[67]=_,e[68]=q,e[69]=ue,e[70]=me,e[71]=fe,e[72]=G,e[73]=P):P=e[73];let W;e[74]!==t.count?(W=s(B,{className:"text-right",children:s(pe,{variant:"secondary",children:t.count})}),e[74]=t.count,e[75]=W):W=e[75];let Y;e[76]!==t.lastSeen?(Y=He(t.lastSeen),e[76]=t.lastSeen,e[77]=Y):Y=e[77];let Q;e[78]!==Y?(Q=s(B,{className:"text-xs tabular-nums text-muted-foreground",children:Y}),e[78]=Y,e[79]=Q):Q=e[79];let X;e[80]!==h||e[81]!==t.hash||e[82]!==t.status||e[83]!==i||e[84]!==a?(X=t.status!=="resolved"&&s(oe,{"data-testid":`issues-resolve-${t.hash}`,disabled:h,onClick:()=>{re(i(t.hash,Pe,{}))},size:"xs",variant:"outline",children:a("Resolve")}),e[80]=h,e[81]=t.hash,e[82]=t.status,e[83]=i,e[84]=a,e[85]=X):X=e[85];let J;e[86]!==h||e[87]!==t.hash||e[88]!==t.status||e[89]!==i||e[90]!==a?(J=t.status!=="ignored"&&s(oe,{"data-testid":`issues-ignore-${t.hash}`,disabled:h,onClick:()=>{re(i(t.hash,We,{}))},size:"xs",variant:"ghost",children:a("Ignore")}),e[86]=h,e[87]=t.hash,e[88]=t.status,e[89]=i,e[90]=a,e[91]=J):J=e[91];let Z;e[92]!==h||e[93]!==t.assignee||e[94]!==t.hash||e[95]!==t.status||e[96]!==i||e[97]!==a?(Z=t.status!=="open"&&s(oe,{"data-testid":`issues-reopen-${t.hash}`,disabled:h,onClick:()=>{re(i(t.hash,Se,{assignee:t.assignee??null}))},size:"xs",variant:"ghost",children:a("Reopen")}),e[92]=h,e[93]=t.assignee,e[94]=t.hash,e[95]=t.status,e[96]=i,e[97]=a,e[98]=Z):Z=e[98];let ee;e[99]!==X||e[100]!==J||e[101]!==Z?(ee=s(B,{className:"text-right",children:w("div",{className:"flex justify-end gap-1",children:[X,J,Z]})}),e[99]=X,e[100]=J,e[101]=Z,e[102]=ee):ee=e[102];let te;e[103]!==c||e[104]!==I||e[105]!==D||e[106]!==P||e[107]!==W||e[108]!==Q||e[109]!==M||e[110]!==ee?(te=w(ye,{"data-testid":M,children:[c,I,D,P,W,Q,ee]}),e[103]=c,e[104]=I,e[105]=D,e[106]=P,e[107]=W,e[108]=Q,e[109]=M,e[110]=ee,e[111]=te):te=e[111];let se;e[112]!==o||e[113]!==t||e[114]!==r?(se=s(et,{expanded:o,issue:t,shardKey:r},t.sampleMessage),e[112]=o,e[113]=t,e[114]=r,e[115]=se):se=e[115];let ce;return e[116]!==te||e[117]!==se?(ce=w(De,{children:[te,se]}),e[116]=te,e[117]=se,e[118]=ce):ce=e[118],ce},Tt=n=>{const e=xe(38),{initialShardKey:h}=n,t=ve(),E=Ne(),{queryShardKey:i,setShardKey:r,shardKey:a}=ze(h),[o,R]=ne("all"),[A,L]=ne(it),[C,K]=ne(lt);let T;e[0]!==o?(T=o==="all"?{}:{status:o},e[0]=o,e[1]=T):T=e[1];let _;e[2]!==i?(_={live:!0,shardKey:i},e[2]=i,e[3]=_):_=e[3];const{data:M,error:d,liveError:g}=Be(ie.getIssues,T,_),$=M!==void 0;let x;if(e[4]!==C||e[5]!==A||e[6]!==E||e[7]!==M||e[8]!==d||e[9]!==g||e[10]!==$||e[11]!==i||e[12]!==r||e[13]!==a||e[14]!==o||e[15]!==t){const y=Xe(M);let S;e[17]!==E||e[18]!==i?(S=async(l,le,O)=>{K(v=>{if(!v.has(l))return v;const k=new Map(v);return k.delete(l),k}),L(v=>new Set(v).add(l));try{await E.query(le,{...O,hash:l},Ie(i))}catch(v){const U=je(v);K(z=>new Map(z).set(l,U))}L(v=>{const k=new Set(v);return k.delete(l),k})},e[17]=E,e[18]=i,e[19]=S):S=e[19];const N=S;let u;e[20]!==t?(u=l=>t(l==="all"?"All":l==="open"?"Open":l==="resolved"?"Resolved":"Ignored"),e[20]=t,e[21]=u):u=e[21];const p=u;let m;e[22]!==d?(m=d!==null&&s("p",{className:"text-sm text-destructive","data-testid":"issues-error",role:"alert",children:d}),e[22]=d,e[23]=m):m=e[23];let c;e[24]!==r||e[25]!==a?(c=s($e,{onChange:r,testId:"issues-shard-input",value:a}),e[24]=r,e[25]=a,e[26]=c):c=e[26];let b;e[27]!==g?(b=s(Te,{message:g,prefix:"issues"}),e[27]=g,e[28]=b):b=e[28];let f;e[29]!==o||e[30]!==p?(f=qe.map(l=>s(oe,{"data-active":o===l?"":void 0,"data-testid":`issues-filter-${l}`,onClick:()=>{R(l)},size:"xs",variant:o===l?"default":"outline",children:p(l)},l)),e[29]=o,e[30]=p,e[31]=f):f=e[31];let I;e[32]!==f?(I=s("div",{className:"ms-auto flex items-center gap-1","data-testid":"issues-status-filter",role:"group",children:f}),e[32]=f,e[33]=I):I=e[33];let V;e[34]!==I||e[35]!==c||e[36]!==b?(V=w("div",{className:"flex flex-wrap items-center gap-2",children:[c,b,I]}),e[34]=I,e[35]=c,e[36]=b,e[37]=V):V=e[37],x=w("div",{className:"flex flex-col gap-6","data-testid":"lunora-issues-panel",children:[m,V,$&&y.length===0?s(_e,{description:t("No grouped errors yet. When a function throws or a container crashes, matching errors fold into a single issue here."),testId:"issues-empty",title:t("No issues")}):s(Ae,{className:"overflow-hidden py-0",children:s(Ce,{className:"px-0",children:w(Ve,{"data-testid":"issues-table",children:[s(Oe,{children:w(ye,{children:[s(F,{children:t("Issue")}),s(F,{children:t("Status")}),s(F,{children:t("Severity")}),s(F,{children:t("Assignee")}),s(F,{className:"text-right",children:t("Events")}),s(F,{children:t("Last seen")}),s(F,{className:"text-right",children:t("Actions")})]})}),s(Ue,{children:y.map(l=>s(tt,{busy:A.has(l.hash),issue:l,rowError:C.get(l.hash),runTriage:N,shardKey:i},l.hash))})]})})})]}),e[4]=C,e[5]=A,e[6]=E,e[7]=M,e[8]=d,e[9]=g,e[10]=$,e[11]=i,e[12]=r,e[13]=a,e[14]=o,e[15]=t,e[16]=x}else x=e[16];return x};function st(n){return!n}function at(n){return s(be,{value:n,children:n},n)}function it(){return new Set}function lt(){return new Map}export{Tt as default};
|
|
1
|
+
import{c as xe}from"react/compiler-runtime";import{findIssueSolution as we,flattenHint as Ee}from"@lunora/errors";import{useLunora as Ne}from"@lunora/react";import{useState as ne}from"react";import{L as Te}from"../packem_shared/live-status-BuJdUZFU.mjs";import{ShardInput as $e}from"../packem_shared/ShardInput-C6mjgAh4.mjs";import{B as pe}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as oe}from"../packem_shared/button-q0UYSmrn.mjs";import{C as Ae,a as Ce}from"../packem_shared/card--2hKx4L2.mjs";import{E as _e}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as ke}from"../packem_shared/input-CXhxesPC.mjs";import{S as Me,a as Re,b as Ke,c as be,d as Le}from"../packem_shared/select-DPyS18Vy.mjs";import{T as Ve,a as Oe,b as ye,c as F,d as Ue,e as B}from"../packem_shared/table-D0SBiDu-.mjs";import{u as Be}from"../packem_shared/use-admin-query-BvZH4unR.mjs";import{u as Fe}from"../packem_shared/use-async-submit-C1A11ka9.mjs";import{u as ze}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{useT as ve}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as ie}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{i as He,f as re,c as de,d as Ie,b as je}from"../packem_shared/internal-D4gBuklE.mjs";import{jsx as s,jsxs as w,Fragment as De}from"react/jsx-runtime";const ge="none",qe=["all","open","resolved","ignored"],Ge=["critical","high","medium","low"],Pe=de(ie.resolveIssue),We=de(ie.ignoreIssue),Se=de(ie.assignIssue),Ye=de(ie.setIssueSeverity),Qe=de(ie.explainIssue),Xe=n=>Array.isArray(n?.issues)?n.issues:[],Je=n=>n==="resolved"?"success":n==="ignored"?"secondary":"warning",Ze=n=>n==="critical"?"destructive":n==="high"?"warning":n==="medium"?"info":"secondary",et=n=>{const e=xe(44),{expanded:h,issue:t,shardKey:E}=n,i=Ne(),r=ve(),[a,o]=ne(void 0),{busy:R,error:A,run:L}=Fe();let C;e[0]!==i||e[1]!==t||e[2]!==L||e[3]!==E?(C=()=>{o(void 0),L(async()=>{const f={culprit:t.culprit,sampleMessage:t.sampleMessage,title:t.title},I=await i.query(Qe,f,Ie(E));o(I)})},e[0]=i,e[1]=t,e[2]=L,e[3]=E,e[4]=C):C=e[4];const K=C;if(!h)return null;let T;if(e[5]!==t.sampleMessage){const f=we(t.sampleMessage);T=f===void 0?void 0:Ee(f.body),e[5]=t.sampleMessage,e[6]=T}else T=e[6];const _=T,M=`issues-detail-${t.hash}`;let d;e[7]!==t.sampleMessage?(d=s("p",{className:"whitespace-pre-wrap font-mono text-xs text-muted-foreground",children:t.sampleMessage}),e[7]=t.sampleMessage,e[8]=d):d=e[8];let g;e[9]!==r?(g=r("Suggested fix"),e[9]=r,e[10]=g):g=e[10];let $;e[11]!==g?($=s("div",{className:"text-xs font-medium text-muted-foreground",children:g}),e[11]=g,e[12]=$):$=e[12];let x;e[13]!==_||e[14]!==t.hash||e[15]!==r?(x=_===void 0?s("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":`issues-hint-empty-${t.hash}`,children:r("No known fix for this error yet.")}):s("p",{className:"mt-1 whitespace-pre-wrap text-sm","data-testid":`issues-hint-${t.hash}`,children:_}),e[13]=_,e[14]=t.hash,e[15]=r,e[16]=x):x=e[16];let y;e[17]!==$||e[18]!==x?(y=w("div",{children:[$,x]}),e[17]=$,e[18]=x,e[19]=y):y=e[19];const S=`issues-explain-${t.hash}`;let N;e[20]!==R||e[21]!==r?(N=r(R?"Explaining…":"Explain in plain language"),e[20]=R,e[21]=r,e[22]=N):N=e[22];let u;e[23]!==R||e[24]!==K||e[25]!==N||e[26]!==S?(u=s("div",{children:s(oe,{"data-testid":S,disabled:R,onClick:K,size:"sm",type:"button",variant:"outline",children:N})}),e[23]=R,e[24]=K,e[25]=N,e[26]=S,e[27]=u):u=e[27];let p;e[28]!==A||e[29]!==t.hash?(p=A!==null&&s("p",{className:"text-xs text-destructive","data-testid":`issues-explain-error-${t.hash}`,role:"alert",children:A}),e[28]=A,e[29]=t.hash,e[30]=p):p=e[30];let m;e[31]!==a||e[32]!==t.hash||e[33]!==r?(m=a!==void 0&&(a.degraded?s("p",{className:"text-xs text-muted-foreground","data-testid":`issues-degraded-${t.hash}`,children:a.reason==="no-ai-binding"?r("No AI binding is configured. Wire an AI binding to enable plain-language explanations — the suggested fix above is always available."):r("The AI model could not explain this error right now. The suggested fix above still applies.")}):w("div",{"data-testid":`issues-explanation-${t.hash}`,children:[s("div",{className:"text-xs font-medium text-muted-foreground",children:r("AI explanation")}),s("p",{className:"mt-1 whitespace-pre-wrap text-sm",children:a.explanation}),a.groundedId===void 0&&s("p",{className:"mt-1 text-xs text-muted-foreground","data-testid":`issues-ungrounded-${t.hash}`,children:r("No catalog fix matched this error, so this explanation is the model's own reading of the message. Verify before acting on it.")}),s("p",{className:"mt-1 text-[0.7rem] text-muted-foreground",children:r("Generated by {model}",{model:a.model})})]})),e[31]=a,e[32]=t.hash,e[33]=r,e[34]=m):m=e[34];let c;e[35]!==u||e[36]!==p||e[37]!==m||e[38]!==d||e[39]!==y?(c=s(B,{className:"bg-muted/30",colSpan:7,children:w("div",{className:"flex flex-col gap-3 py-1",children:[d,y,u,p,m]})}),e[35]=u,e[36]=p,e[37]=m,e[38]=d,e[39]=y,e[40]=c):c=e[40];let b;return e[41]!==c||e[42]!==M?(b=s(ye,{"data-testid":M,children:c}),e[41]=c,e[42]=M,e[43]=b):b=e[43],b},tt=n=>{const e=xe(119),{busy:h,issue:t,rowError:E,runTriage:i,shardKey:r}=n,a=ve(),[o,R]=ne(!1);let A;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{R(st)},e[0]=A):A=e[0];const L=A;let C;e[1]!==t.hash||e[2]!==i?(C=ae=>{const he=ae===null||ae===ge?null:ae;re(i(t.hash,Ye,{severity:he}))},e[1]=t.hash,e[2]=i,e[3]=C):C=e[3];const K=C;let T;e[4]!==t.hash||e[5]!==i?(T=ae=>{if(ae.key!=="Enter")return;const he=ae.currentTarget.value.trim();re(i(t.hash,Se,{assignee:he===""?null:he}))},e[4]=t.hash,e[5]=i,e[6]=T):T=e[6];const _=T,M=`issues-row-${t.hash}`;let d;e[7]!==a?(d=a("Toggle issue details"),e[7]=a,e[8]=d):d=e[8];const g=`issues-toggle-${t.hash}`,$=`mt-1 size-3 shrink-0 text-muted-foreground transition-transform ${o?"rotate-90":""}`;let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=s("path",{d:"m9 6 6 6-6 6"}),e[9]=x):x=e[9];let y;e[10]!==$?(y=s("svg",{"aria-hidden":"true",className:$,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:x}),e[10]=$,e[11]=y):y=e[11];let S;e[12]!==t.title?(S=s("span",{className:"block truncate font-medium",title:t.title,children:t.title}),e[12]=t.title,e[13]=S):S=e[13];let N;e[14]!==t.culprit?(N=s("span",{className:"block truncate font-mono text-xs text-muted-foreground",title:t.culprit,children:t.culprit}),e[14]=t.culprit,e[15]=N):N=e[15];let u;e[16]!==S||e[17]!==N?(u=w("span",{className:"min-w-0",children:[S,N]}),e[16]=S,e[17]=N,e[18]=u):u=e[18];let p;e[19]!==o||e[20]!==u||e[21]!==d||e[22]!==g||e[23]!==y?(p=w("button",{"aria-expanded":o,"aria-label":d,className:"flex w-full items-start gap-2 text-left","data-testid":g,onClick:L,type:"button",children:[y,u]}),e[19]=o,e[20]=u,e[21]=d,e[22]=g,e[23]=y,e[24]=p):p=e[24];let m;e[25]!==t.hash||e[26]!==E?(m=E!==void 0&&s("p",{className:"mt-1 text-xs text-destructive","data-testid":`issues-action-error-${t.hash}`,role:"alert",children:E}),e[25]=t.hash,e[26]=E,e[27]=m):m=e[27];let c;e[28]!==p||e[29]!==m?(c=w(B,{className:"max-w-80",children:[p,m]}),e[28]=p,e[29]=m,e[30]=c):c=e[30];const b=`issues-status-${t.hash}`;let f;e[31]!==t.status?(f=Je(t.status),e[31]=t.status,e[32]=f):f=e[32];let I;e[33]!==t.status||e[34]!==b||e[35]!==f?(I=s(B,{children:s(pe,{"data-testid":b,variant:f,children:t.status})}),e[33]=t.status,e[34]=b,e[35]=f,e[36]=I):I=e[36];const V=t.severity??ge;let l;e[37]!==a?(l=a("Set severity"),e[37]=a,e[38]=l):l=e[38];const le=`issues-severity-${t.hash}`;let O;e[39]!==a?(O=a("—"),e[39]=a,e[40]=O):O=e[40];let v;e[41]!==t.severity||e[42]!==a?(v=t.severity===void 0?s("span",{className:"text-muted-foreground",children:a("—")}):s(pe,{variant:Ze(t.severity),children:t.severity}),e[41]=t.severity,e[42]=a,e[43]=v):v=e[43];let k;e[44]!==O||e[45]!==v?(k=s(Me,{placeholder:O,children:v}),e[44]=O,e[45]=v,e[46]=k):k=e[46];let U;e[47]!==l||e[48]!==le||e[49]!==k?(U=s(Re,{"aria-label":l,className:"h-7 w-[110px]","data-testid":le,children:k}),e[47]=l,e[48]=le,e[49]=k,e[50]=U):U=e[50];let z;e[51]===Symbol.for("react.memo_cache_sentinel")?(z=Ge.map(at),e[51]=z):z=e[51];let H;e[52]!==a?(H=a("Clear"),e[52]=a,e[53]=H):H=e[53];let j;e[54]!==H?(j=w(Ke,{children:[z,s(be,{value:ge,children:H})]}),e[54]=H,e[55]=j):j=e[55];let D;e[56]!==h||e[57]!==K||e[58]!==V||e[59]!==U||e[60]!==j?(D=s(B,{children:w(Le,{disabled:h,onValueChange:K,value:V,children:[U,j]})}),e[56]=h,e[57]=K,e[58]=V,e[59]=U,e[60]=j,e[61]=D):D=e[61];let q;e[62]!==a?(q=a("Assignee"),e[62]=a,e[63]=q):q=e[63];const ue=`issues-assignee-${t.hash}`,me=t.assignee??"",fe=t.assignee??"";let G;e[64]!==a?(G=a("Unassigned"),e[64]=a,e[65]=G):G=e[65];let P;e[66]!==h||e[67]!==_||e[68]!==q||e[69]!==ue||e[70]!==me||e[71]!==fe||e[72]!==G?(P=s(B,{children:s(ke,{"aria-label":q,className:"h-7 w-32","data-testid":ue,defaultValue:me,disabled:h,onKeyDown:_,placeholder:G},fe)}),e[66]=h,e[67]=_,e[68]=q,e[69]=ue,e[70]=me,e[71]=fe,e[72]=G,e[73]=P):P=e[73];let W;e[74]!==t.count?(W=s(B,{className:"text-right",children:s(pe,{variant:"secondary",children:t.count})}),e[74]=t.count,e[75]=W):W=e[75];let Y;e[76]!==t.lastSeen?(Y=He(t.lastSeen),e[76]=t.lastSeen,e[77]=Y):Y=e[77];let Q;e[78]!==Y?(Q=s(B,{className:"text-xs tabular-nums text-muted-foreground",children:Y}),e[78]=Y,e[79]=Q):Q=e[79];let X;e[80]!==h||e[81]!==t.hash||e[82]!==t.status||e[83]!==i||e[84]!==a?(X=t.status!=="resolved"&&s(oe,{"data-testid":`issues-resolve-${t.hash}`,disabled:h,onClick:()=>{re(i(t.hash,Pe,{}))},size:"xs",variant:"outline",children:a("Resolve")}),e[80]=h,e[81]=t.hash,e[82]=t.status,e[83]=i,e[84]=a,e[85]=X):X=e[85];let J;e[86]!==h||e[87]!==t.hash||e[88]!==t.status||e[89]!==i||e[90]!==a?(J=t.status!=="ignored"&&s(oe,{"data-testid":`issues-ignore-${t.hash}`,disabled:h,onClick:()=>{re(i(t.hash,We,{}))},size:"xs",variant:"ghost",children:a("Ignore")}),e[86]=h,e[87]=t.hash,e[88]=t.status,e[89]=i,e[90]=a,e[91]=J):J=e[91];let Z;e[92]!==h||e[93]!==t.assignee||e[94]!==t.hash||e[95]!==t.status||e[96]!==i||e[97]!==a?(Z=t.status!=="open"&&s(oe,{"data-testid":`issues-reopen-${t.hash}`,disabled:h,onClick:()=>{re(i(t.hash,Se,{assignee:t.assignee??null}))},size:"xs",variant:"ghost",children:a("Reopen")}),e[92]=h,e[93]=t.assignee,e[94]=t.hash,e[95]=t.status,e[96]=i,e[97]=a,e[98]=Z):Z=e[98];let ee;e[99]!==X||e[100]!==J||e[101]!==Z?(ee=s(B,{className:"text-right",children:w("div",{className:"flex justify-end gap-1",children:[X,J,Z]})}),e[99]=X,e[100]=J,e[101]=Z,e[102]=ee):ee=e[102];let te;e[103]!==c||e[104]!==I||e[105]!==D||e[106]!==P||e[107]!==W||e[108]!==Q||e[109]!==M||e[110]!==ee?(te=w(ye,{"data-testid":M,children:[c,I,D,P,W,Q,ee]}),e[103]=c,e[104]=I,e[105]=D,e[106]=P,e[107]=W,e[108]=Q,e[109]=M,e[110]=ee,e[111]=te):te=e[111];let se;e[112]!==o||e[113]!==t||e[114]!==r?(se=s(et,{expanded:o,issue:t,shardKey:r},t.sampleMessage),e[112]=o,e[113]=t,e[114]=r,e[115]=se):se=e[115];let ce;return e[116]!==te||e[117]!==se?(ce=w(De,{children:[te,se]}),e[116]=te,e[117]=se,e[118]=ce):ce=e[118],ce},Tt=n=>{const e=xe(38),{initialShardKey:h}=n,t=ve(),E=Ne(),{queryShardKey:i,setShardKey:r,shardKey:a}=ze(h),[o,R]=ne("all"),[A,L]=ne(it),[C,K]=ne(lt);let T;e[0]!==o?(T=o==="all"?{}:{status:o},e[0]=o,e[1]=T):T=e[1];let _;e[2]!==i?(_={live:!0,shardKey:i},e[2]=i,e[3]=_):_=e[3];const{data:M,error:d,liveError:g}=Be(ie.getIssues,T,_),$=M!==void 0;let x;if(e[4]!==C||e[5]!==A||e[6]!==E||e[7]!==M||e[8]!==d||e[9]!==g||e[10]!==$||e[11]!==i||e[12]!==r||e[13]!==a||e[14]!==o||e[15]!==t){const y=Xe(M);let S;e[17]!==E||e[18]!==i?(S=async(l,le,O)=>{K(v=>{if(!v.has(l))return v;const k=new Map(v);return k.delete(l),k}),L(v=>new Set(v).add(l));try{await E.query(le,{...O,hash:l},Ie(i))}catch(v){const U=je(v);K(z=>new Map(z).set(l,U))}L(v=>{const k=new Set(v);return k.delete(l),k})},e[17]=E,e[18]=i,e[19]=S):S=e[19];const N=S;let u;e[20]!==t?(u=l=>t(l==="all"?"All":l==="open"?"Open":l==="resolved"?"Resolved":"Ignored"),e[20]=t,e[21]=u):u=e[21];const p=u;let m;e[22]!==d?(m=d!==null&&s("p",{className:"text-sm text-destructive","data-testid":"issues-error",role:"alert",children:d}),e[22]=d,e[23]=m):m=e[23];let c;e[24]!==r||e[25]!==a?(c=s($e,{onChange:r,testId:"issues-shard-input",value:a}),e[24]=r,e[25]=a,e[26]=c):c=e[26];let b;e[27]!==g?(b=s(Te,{message:g,prefix:"issues"}),e[27]=g,e[28]=b):b=e[28];let f;e[29]!==o||e[30]!==p?(f=qe.map(l=>s(oe,{"data-active":o===l?"":void 0,"data-testid":`issues-filter-${l}`,onClick:()=>{R(l)},size:"xs",variant:o===l?"default":"outline",children:p(l)},l)),e[29]=o,e[30]=p,e[31]=f):f=e[31];let I;e[32]!==f?(I=s("div",{className:"ms-auto flex items-center gap-1","data-testid":"issues-status-filter",role:"group",children:f}),e[32]=f,e[33]=I):I=e[33];let V;e[34]!==I||e[35]!==c||e[36]!==b?(V=w("div",{className:"flex flex-wrap items-center gap-2",children:[c,b,I]}),e[34]=I,e[35]=c,e[36]=b,e[37]=V):V=e[37],x=w("div",{className:"flex flex-col gap-6","data-testid":"lunora-issues-panel",children:[m,V,$&&y.length===0?s(_e,{description:t("No grouped errors yet. When a function throws or a container crashes, matching errors fold into a single issue here."),testId:"issues-empty",title:t("No issues")}):s(Ae,{className:"overflow-hidden py-0",children:s(Ce,{className:"px-0",children:w(Ve,{"data-testid":"issues-table",children:[s(Oe,{children:w(ye,{children:[s(F,{children:t("Issue")}),s(F,{children:t("Status")}),s(F,{children:t("Severity")}),s(F,{children:t("Assignee")}),s(F,{className:"text-right",children:t("Events")}),s(F,{children:t("Last seen")}),s(F,{className:"text-right",children:t("Actions")})]})}),s(Ue,{children:y.map(l=>s(tt,{busy:A.has(l.hash),issue:l,rowError:C.get(l.hash),runTriage:N,shardKey:i},l.hash))})]})})})]}),e[4]=C,e[5]=A,e[6]=E,e[7]=M,e[8]=d,e[9]=g,e[10]=$,e[11]=i,e[12]=r,e[13]=a,e[14]=o,e[15]=t,e[16]=x}else x=e[16];return x};function st(n){return!n}function at(n){return s(be,{value:n,children:n},n)}function it(){return new Set}function lt(){return new Map}export{Tt as default};
|