1import{n as e}from"./react-vendor-DFL1nm8W.js";import{dE as g,aI as o,c4 as p}from"./index-0OXLTLwZ.js";import{Q as f,aZ as h,D as b}from"./icons-DLwhnzNO.js";import"./observability-CpuVIdFQ.js";import"./supabase-Cu8OEJLt.js";import"./ui-misc-B_J65-S9.js";import"./radix-CZ7UK4NX.js";import"./markdown-QmhVvByN.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};r.SENTRY_RELEASE={id:"9a108aca192d7b7afbf5d7ebd7c82f76f7079c22"};var s=new r.Error().stack;s&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[s]="9f9ec205-840f-442c-b4bc-9f337344b26e",r._sentryDebugIdIdentifier="sentry-dbid-9f9ec205-840f-442c-b4bc-9f337344b26e")}catch{}})();const y={message:"bg-primary/15 text-primary",research:"bg-[#4DD9B8]/15 text-[#4DD9B8]",signal:"bg-[#7EB8F7]/15 text-[#7EB8F7]",vault:"bg-[#F5C842]/15 text-[#F5C842]"};function a({k:r,v:s,note:n,warn:i}){return e.jsxs("div",{className:o("rounded-xl border p-4",i?"border-primary/40 bg-primary/5":"border-border bg-background-surface"),children:[e.jsx("p",{className:"text-[10.5px] font-bold uppercase tracking-wider text-muted-foreground",children:r}),e.jsx("p",{className:o("text-2xl font-extrabold mt-1 tabular-nums",i&&"text-primary"),children:s}),n&&e.jsx("p",{className:"text-[11.5px] text-muted-foreground mt-0.5",children:n})]})}function u(r){if(!r)return"no activity recorded";const s=Math.round((Date.now()-new Date(r).getTime())/6e4);return s<60?`${s}m ago`:s<60*24?`${Math.round(s/60)}h ago`:`${Math.round(s/(60*24))}d ago`}function F(){var c,l,m,x;const r=g({queryKey:["admin_dogfood"],queryFn:async()=>{const{data:t,error:d}=await p.functions.invoke("admin-dogfood",{body:{}});if(d)throw new Error(d.message);if(t!=null&&t.error)throw new Error(t.error);return t},staleTime:6e4}),s=(c=r.data)==null?void 0:c.summary,n=((l=r.data)==null?void 0:l.by_day)??[],i=Math.max(1,...n.map(t=>t.messages));return e.jsxs("div",{className:"p-6 max-w-[1100px]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("h1",{className:"text-xl font-bold flex items-center gap-2",children:[e.jsx(f,{className:"w-5 h-5 text-primary"}),"Dogfood pulse"]}),e.jsxs("button",{onClick:()=>r.refetch(),className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(h,{className:o("w-3.5 h-3.5",r.isFetching&&"animate-spin")}),"Refresh"]})]}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["The Volt26 org, running Volt26. Launch story health: is it being used, what does it cost, what is it producing.",s&&e.jsxs(e.Fragment,{children:[" Last activity: ",e.jsx("span",{className:"text-foreground font-medium",children:u(s.last_activity_at)}),"."]})]}),r.isLoading&&e.jsx("p",{className:"text-sm text-muted-foreground py-10 text-center",children:"Loadingâ¦"}),r.error&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive py-6",children:[e.jsx(b,{className:"w-4 h-4"})," ",r.error.message]}),s&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6",children:[e.jsx(a,{k:"Founder messages, 7d",v:s.founder_messages_7d,note:`${s.messages_7d} total incl. agents`,warn:s.founder_messages_7d===0}),e.jsx(a,{k:"Research runs, 30d",v:s.research_runs_30d,warn:s.research_runs_30d===0}),e.jsx(a,{k:"Signals worked, 30d",v:s.signals_actioned_30d,note:`${s.signals_open} open now`,warn:s.signals_actioned_30d===0}),e.jsx(a,{k:"Decisions awaiting",v:s.decisions_awaiting,note:"inbox should converge to zero",warn:s.decisions_awaiting>3}),e.jsx(a,{k:"Spend, 7d",v:`$${s.spend_7d.toFixed(2)}`,note:`$${s.spend_30d.toFixed(2)} over 30d`}),e.jsx(a,{k:"Vault docs, 30d",v:s.vault_docs_30d}),e.jsx(a,{k:"Products",v:s.products,note:`${s.threads} threads`}),e.jsx(a,{k:"Members",v:s.members,note:"Sammy + Daniel"})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-background-surface p-5 mb-6",children:[e.jsx("p",{className:"text-[10.5px] font-bold uppercase tracking-wider text-muted-foreground mb-3",children:"Daily activity, last 14 days"}),e.jsx("div",{className:"space-y-1",children:n.map(t=>{const d=t.day===new Date().toISOString().slice(0,10);return e.jsxs("div",{className:"grid grid-cols-[76px_1fr_120px] items-center gap-3 text-[11px]",children:[e.jsx("span",{className:o("text-muted-foreground tabular-nums",d&&"text-foreground font-bold"),children:new Date(t.day+"T00:00:00Z").toLocaleDateString("en-NZ",{month:"short",day:"numeric",timeZone:"UTC"})}),e.jsx("div",{className:"h-3 bg-background-elevated rounded-sm overflow-hidden",title:`${t.messages} messages`,children:e.jsx("div",{className:o("h-full rounded-sm",t.messages>0?"bg-primary/70":"bg-transparent"),style:{width:`${Math.max(t.messages>0?2:0,t.messages/i*100)}%`}})}),e.jsxs("span",{className:"text-right text-muted-foreground tabular-nums",children:[t.messages," msg · $",t.cost_usd.toFixed(2)]})]},t.day)})})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-background-surface p-5",children:[e.jsx("p",{className:"text-[10.5px] font-bold uppercase tracking-wider text-muted-foreground mb-3",children:"Recent activity"}),(((m=r.data)==null?void 0:m.recent)??[]).length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"Nothing recorded in the last 30 days â the dogfood story needs feeding."}),e.jsx("div",{className:"space-y-1.5",children:(((x=r.data)==null?void 0:x.recent)??[]).map((t,d)=>e.jsxs("div",{className:"flex items-center gap-3 text-[13px]",children:[e.jsx("span",{className:o("text-[9.5px] font-bold uppercase tracking-wide px-2 py-0.5 rounded-full shrink-0",y[t.kind]??"bg-muted text-muted-foreground"),children:t.kind}),e.jsx("span",{className:"truncate text-muted-foreground",children:t.label}),e.jsx("span",{className:"ml-auto shrink-0 text-[11px] text-muted-foreground
1/70 tabular-nums",children:u(t.at)})]},d))})]})]})]})}export{F as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.