@tickernelz/paperclip-pro-ui 2026.1007.2 → 2026.1008.0
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/assets/{AgentAvatar-CJxUMdmk.js → AgentAvatar-SJDPbZfK.js} +1 -1
- package/dist/assets/{AgentIdentity-D9ti_IEi.js → AgentIdentity-BW3dAZQD.js} +1 -1
- package/dist/assets/{Agents.production-CQk3vdUE.js → Agents.production-BG82xP3I.js} +2 -2
- package/dist/assets/{CompanyActivity.production-CYOblDJ_.js → CompanyActivity.production-woUD9oNT.js} +1 -1
- package/dist/assets/{CompanyExport-fZQCAxR3.js → CompanyExport-B7LRHKGs.js} +4 -4
- package/dist/assets/{CompanySkills.production-DZ9QO3Qb.js → CompanySkills.production-DObYIR8Z.js} +2 -2
- package/dist/assets/Costs.production--VN7RT_9.js +1 -0
- package/dist/assets/{EmptyState-BZtI8X0G.js → EmptyState-Cpsu2EbU.js} +1 -1
- package/dist/assets/{MarkdownBody-C_h6YRQp.js → MarkdownBody-DRqRjF-_.js} +8 -8
- package/dist/assets/{MarkdownEditor-BOTosEGR.js → MarkdownEditor-DqSHOPon.js} +2 -2
- package/dist/assets/{OrgChart.production-DKLPpvm-.js → OrgChart.production-DIn23yrs.js} +1 -1
- package/dist/assets/{PageSkeleton-Cy0AuFsD.js → PageSkeleton-Boeat-pa.js} +1 -1
- package/dist/assets/{RoutineDetail.production-Cgm2eWNX.js → RoutineDetail.production-B0SwbVFq.js} +1 -1
- package/dist/assets/{RoutineRunVariablesDialog-DCnWm09I.js → RoutineRunVariablesDialog-BHfjTN1x.js} +2 -2
- package/dist/assets/{Routines.production-BfGvfmpS.js → Routines.production-CG5ixad2.js} +1 -1
- package/dist/assets/{SidebarContext-zupbpsOa.js → SidebarContext--Pt-RovF.js} +1 -1
- package/dist/assets/{StatusIcon-mIm27nQw.js → StatusIcon-CMOBM0cz.js} +1 -1
- package/dist/assets/{agent-avatar-url-BcyFoVtv.js → agent-avatar-url-COB3FyNh.js} +10 -10
- package/dist/assets/{agents-DQx-dvSi.js → agents-Bce8O2iW.js} +1 -1
- package/dist/assets/{badge-BqqBOTVc.js → badge-CUxm7Dtn.js} +1 -1
- package/dist/assets/{bot-DKL-W8OH.js → bot-Dsp1n_bc.js} +1 -1
- package/dist/assets/{boxes-tcjFwFpA.js → boxes-B17SB309.js} +3 -3
- package/dist/assets/{button-BY21O8GT.js → button-B-wjguAV.js} +1 -1
- package/dist/assets/{card-De_lOmuE.js → card-DBEYqFNF.js} +1 -1
- package/dist/assets/{check-CnODEUG9.js → check-BMyl919B.js} +1 -1
- package/dist/assets/{checkbox-I5XQmb-K.js → checkbox-iAfQowi2.js} +1 -1
- package/dist/assets/{chevron-down-DFUcku8q.js → chevron-down-CUaHIP4O.js} +1 -1
- package/dist/assets/{chevron-right-B6d9r4Ro.js → chevron-right-Dz0Hakt6.js} +1 -1
- package/dist/assets/{clipboard-DHhOZMRn.js → clipboard-B0eiwEg1.js} +1 -1
- package/dist/assets/{company-members-Dzwzy-as.js → company-members-2JwSIlm7.js} +1 -1
- package/dist/assets/{definition-CZKX1H5T.js → definition-BCKL7Z75.js} +1 -1
- package/dist/assets/{dist-BCtf-vM2.js → dist-CKsixJWn.js} +1 -1
- package/dist/assets/{dist-C42YHTVB.js → dist-L4Fio05O.js} +1 -1
- package/dist/assets/{environments-B7NZX_ky.js → environments-BAip07cp.js} +1 -1
- package/dist/assets/{external-link-C19HtmzW.js → external-link-C16DZ_8E.js} +1 -1
- package/dist/assets/{file-text-CeE8_Vjy.js → file-text-CGuZU4dO.js} +1 -1
- package/dist/assets/{health-CQndBw_N.js → health-Boo6Fbfs.js} +1 -1
- package/dist/assets/{heartbeats-DF-m9cYQ.js → heartbeats-C0D9bcc5.js} +1 -1
- package/dist/assets/{index-Cblntx1v.js → index-DlP9bxBd.js} +156 -156
- package/dist/assets/{input-B204XBDT.js → input-D907RXni.js} +1 -1
- package/dist/assets/{label-CZQ8NWbL.js → label-DghWCun3.js} +1 -1
- package/dist/assets/{loader-circle-Bq0tfpSr.js → loader-circle-BqmoALPC.js} +1 -1
- package/dist/assets/{mention-chips-D_n_qKFh.js → mention-chips-gWjq0PC7.js} +1 -1
- package/dist/assets/{octagon-alert-D4baqyHT.js → octagon-alert-CnEZnFXW.js} +1 -1
- package/dist/assets/{rotate-ccw-LNlo9y5X.js → rotate-ccw-lfP1J5rp.js} +1 -1
- package/dist/assets/{router-DesWEj2C.js → router-BOhyEQ-H.js} +3 -3
- package/dist/assets/{save-DDenfr8W.js → save-COX6cDHs.js} +1 -1
- package/dist/assets/{select-CTeNTKSP.js → select-BA5jC_nQ.js} +1 -1
- package/dist/assets/{sheet-DaK7uiF0.js → sheet-BByJ5Lv5.js} +1 -1
- package/dist/assets/skeleton-D17djeDO.js +1 -0
- package/dist/assets/{tabs-De8GZtQI.js → tabs-DIoJxDqx.js} +1 -1
- package/dist/assets/{triangle-alert-6xzP6adj.js → triangle-alert-CDiu0Pgq.js} +1 -1
- package/dist/assets/{use-adapter-capabilities-BoIn6U4T.js → use-adapter-capabilities-qYdYowvE.js} +1 -1
- package/dist/assets/{useHiddenSettings-Cx5eN_RQ.js → useHiddenSettings-DscFeNyr.js} +1 -1
- package/dist/index.html +45 -45
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/dist/assets/Costs.production-DGzfBw_5.js +0 -1
- package/dist/assets/skeleton-CLIvalUo.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var ot=Object.defineProperty;var o=(i,h)=>ot(i,"name",{value:h,configurable:!0});import{i as _e}from"./rolldown-runtime-ZpX3ckPj.js";import{N as M,Oi as dt,R as Z,S as Ie,T as m,W as lt,Xr as S,Yr as qe,Z as v,ji as ct,ki as ut,x as mt}from"./agent-avatar-url-COB3FyNh.js";import{i as z,n as B,r as pt,t as te}from"./tabs-DIoJxDqx.js";import{r as gt,t as xt}from"./EmptyState-Cpsu2EbU.js";import{t as ht}from"./chevron-down-CUaHIP4O.js";import{t as bt}from"./chevron-right-Dz0Hakt6.js";import{t as vt}from"./button-B-wjguAV.js";import{t as yt}from"./AgentIdentity-BW3dAZQD.js";import{i as _,o as $,r as F,s as L,t as q}from"./card-DBEYqFNF.js";import{t as se}from"./PageSkeleton-Boeat-pa.js";import{C as De,Cn as re,D as Ae,E as jt,Kn as ft,Ln as ne,O as Fe,Rn as ie,S as Nt,T as Ct,Wn as oe,b as wt,k as N,qt as kt,tn as Ke,vt as Tt,w as Ee,x as St,yt as ae}from"./index-DlP9bxBd.js";var l=_e(ct(),1),e=_e(ut(),1),Bt="__none__";function Mt(){const i=new Date,h=i.getDay(),y=h===0?-6:1-h,u=new Date(i.getFullYear(),i.getMonth(),i.getDate()+y,0,0,0,0),j=new Date(u.getFullYear(),u.getMonth(),u.getDate()+6,23,59,59,999);return{from:u.toISOString(),to:j.toISOString()}}o(Mt,"currentWeekRange");function Pt({provider:i,rows:h}){const y=h.reduce((j,b)=>j+b.inputTokens+b.cachedInputTokens+b.outputTokens,0),u=h.reduce((j,b)=>j+b.costCents,0);return(0,e.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,e.jsx)("span",{children:Z(i)}),(0,e.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:M(y)}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:m(u)})]})}o(Pt,"ProviderTabLabel");function It({biller:i,rows:h}){const y=h.reduce((j,b)=>j+b.inputTokens+b.cachedInputTokens+b.outputTokens,0),u=h.reduce((j,b)=>j+b.costCents,0);return(0,e.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,e.jsx)("span",{children:Z(i)}),(0,e.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:M(y)}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:m(u)})]})}o(It,"BillerTabLabel");function C({label:i,value:h,subtitle:y,icon:u}){return(0,e.jsx)(q,{className:"block p-4",children:(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) uppercase tracking-(--tracking-eyebrow) text-muted-foreground",children:i}),(0,e.jsx)("div",{className:"mt-2 text-2xl font-semibold tabular-nums",children:h}),(0,e.jsx)("div",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:y})]}),(0,e.jsx)("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-md border border-border",children:(0,e.jsx)(u,{className:"h-4 w-4 text-muted-foreground"})})]})})}o(C,"MetricTile");function Re({debitCents:i,creditCents:h,netCents:y,estimatedDebitCents:u,eventCount:j}){return(0,e.jsxs)(q,{children:[(0,e.jsxs)($,{className:"px-5 pt-5 pb-2",children:[(0,e.jsx)(L,{className:"text-base",children:"Finance ledger"}),(0,e.jsx)(_,{children:"Account-level charges that do not map to a single inference request."})]}),(0,e.jsxs)(F,{className:"grid gap-3 px-5 pb-5 pt-2 sm:grid-cols-2 xl:grid-cols-4",children:[(0,e.jsx)(C,{label:"Debits",value:m(i),subtitle:`${j} total event${j===1?"":"s"} in range`,icon:oe}),(0,e.jsx)(C,{label:"Credits",value:m(h),subtitle:"Refunds, offsets, and credit returns",icon:ft}),(0,e.jsx)(C,{label:"Net",value:m(y),subtitle:"Debit minus credit for the selected period",icon:re}),(0,e.jsx)(C,{label:"Estimated",value:m(u),subtitle:"Estimated debits that are not yet invoice-authoritative",icon:ie})]})]})}o(Re,"FinanceSummaryCard");function zt(){const{selectedCompanyId:i}=lt(),{setBreadcrumbs:h}=gt(),y=dt(),[u,j]=(0,l.useState)("overview"),[b,de]=(0,l.useState)("all"),[O,le]=(0,l.useState)("all"),{preset:K,setPreset:$e,customFrom:Le,setCustomFrom:Oe,customTo:We,setCustomTo:ze,from:g,to:x,customReady:D}=Nt();(0,l.useEffect)(()=>{h([{label:"Costs"}])},[h]);const[Qe,Ye]=(0,l.useState)(()=>new Date().toDateString()),G=(0,l.useRef)(null);(0,l.useEffect)(()=>{const t=o(()=>{const s=new Date,n=new Date(s.getFullYear(),s.getMonth(),s.getDate()+1).getTime()-s.getTime();G.current=setTimeout(()=>{Ye(new Date().toDateString()),t()},n)},"schedule");return t(),()=>{G.current!=null&&clearTimeout(G.current)}},[]);const P=(0,l.useMemo)(()=>Mt(),[Qe]),d=i??Bt,{data:A,isLoading:Ve,error:ce}=S({queryKey:v.budgets.overview(d),queryFn:o(()=>ae.overview(d),"queryFn"),enabled:!!i&&D,refetchInterval:3e4,staleTime:5e3}),ue=o(()=>{i&&(y.invalidateQueries({queryKey:v.budgets.overview(i)}),y.invalidateQueries({queryKey:v.dashboard(i)}),y.invalidateQueries({queryKey:v.agents.list(i)}),y.invalidateQueries({queryKey:v.projects.all(i)}))},"invalidateBudgetViews"),me=qe({mutationFn:o(t=>ae.upsertPolicy(d,{scopeType:t.scopeType,scopeId:t.scopeId,amount:t.amount,windowKind:t.windowKind}),"mutationFn"),onSuccess:ue}),E=qe({mutationFn:o(t=>ae.resolveIncident(d,t.incidentId,t),"mutationFn"),onSuccess:ue}),{data:a,isLoading:Ue,error:He}=S({queryKey:v.costs(d,g||void 0,x||void 0),queryFn:o(async()=>{const[t,s,n,r]=await Promise.all([N.summary(d,g||void 0,x||void 0),N.byAgent(d,g||void 0,x||void 0),N.byProject(d,g||void 0,x||void 0),N.byAgentModel(d,g||void 0,x||void 0)]);return{summary:t,byAgent:s,byProject:n,byAgentModel:r}},"queryFn"),enabled:!!i&&D}),{data:p,isLoading:pe,error:J}=S({queryKey:[v.financeSummary(d,g||void 0,x||void 0),v.financeByBiller(d,g||void 0,x||void 0),v.financeByKind(d,g||void 0,x||void 0),v.financeEvents(d,g||void 0,x||void 0,18)],queryFn:o(async()=>{const[t,s,n,r]=await Promise.all([N.financeSummary(d,g||void 0,x||void 0),N.financeByBiller(d,g||void 0,x||void 0),N.financeByKind(d,g||void 0,x||void 0),N.financeEvents(d,g||void 0,x||void 0,18)]);return{summary:t,byBiller:s,byKind:n,events:r}},"queryFn"),enabled:!!i&&D}),[Xe,ge]=(0,l.useState)(new Set);(0,l.useEffect)(()=>{ge(new Set)},[d,g,x]);function Ze(t){ge(s=>{const n=new Set(s);return n.has(t)?n.delete(t):n.add(t),n})}o(Ze,"toggleAgent");const Ge=(0,l.useMemo)(()=>{const t=new Map;for(const s of a?.byAgentModel??[]){const n=t.get(s.agentId)??[];n.push(s),t.set(s.agentId,n)}for(const[s,n]of t)t.set(s,n.slice().sort((r,c)=>c.costCents-r.costCents));return t},[a?.byAgentModel]),{data:Q}=S({queryKey:v.usageByProvider(d,g||void 0,x||void 0),queryFn:o(()=>N.byProvider(d,g||void 0,x||void 0),"queryFn"),enabled:!!i&&D&&(u==="providers"||u==="billers"),refetchInterval:3e4,staleTime:1e4}),{data:xe}=S({queryKey:v.usageByBiller(d,g||void 0,x||void 0),queryFn:o(()=>N.byBiller(d,g||void 0,x||void 0),"queryFn"),enabled:!!i&&D&&u==="billers",refetchInterval:3e4,staleTime:1e4}),{data:he}=S({queryKey:v.usageByProvider(d,P.from,P.to),queryFn:o(()=>N.byProvider(d,P.from,P.to),"queryFn"),enabled:!!i&&(u==="providers"||u==="billers"),refetchInterval:3e4,staleTime:1e4}),{data:be}=S({queryKey:v.usageByBiller(d,P.from,P.to),queryFn:o(()=>N.byBiller(d,P.from,P.to),"queryFn"),enabled:!!i&&u==="billers",refetchInterval:3e4,staleTime:1e4}),{data:ve}=S({queryKey:v.usageWindowSpend(d),queryFn:o(()=>N.windowSpend(d),"queryFn"),enabled:!!i&&u==="providers",refetchInterval:3e4,staleTime:1e4}),{data:R,isLoading:ye}=S({queryKey:v.usageQuotaWindows(d),queryFn:o(()=>N.quotaWindows(d),"queryFn"),enabled:!!i&&u==="providers",refetchInterval:3e5,staleTime:6e4}),w=(0,l.useMemo)(()=>{const t=new Map;for(const s of Q??[]){const n=t.get(s.provider)??[];n.push(s),t.set(s.provider,n)}return t},[Q]),T=(0,l.useMemo)(()=>{const t=new Map;for(const s of xe??[]){const n=t.get(s.biller)??[];n.push(s),t.set(s.biller,n)}return t},[xe]),je=(0,l.useMemo)(()=>{const t=new Map;for(const s of he??[])t.set(s.provider,(t.get(s.provider)??0)+s.costCents);return t},[he]),fe=(0,l.useMemo)(()=>{const t=new Map;for(const s of be??[])t.set(s.biller,(t.get(s.biller)??0)+s.costCents);return t},[be]),Ne=(0,l.useMemo)(()=>{const t=new Map;for(const s of ve??[]){const n=t.get(s.provider)??[];n.push(s),t.set(s.provider,n)}return t},[ve]),Ce=(0,l.useMemo)(()=>{const t=new Map;for(const s of R??[])s.ok&&s.windows.length>0&&t.set(s.provider,s.windows);return t},[R]),we=(0,l.useMemo)(()=>{const t=new Map;for(const s of R??[])!s.ok&&s.error&&t.set(s.provider,s.error);return t},[R]),ke=(0,l.useMemo)(()=>{const t=new Map;for(const s of R??[])typeof s.source=="string"&&s.source.length>0&&t.set(s.provider,s.source);return t},[R]),Te=(0,l.useMemo)(()=>{const t=new Map;if(K!=="mtd")return t;const s=a?.summary.budgetCents??0;if(s<=0)return t;const n=a?.summary.spendCents??0,r=new Date,c=r.getDate(),k=new Date(r.getFullYear(),r.getMonth()+1,0).getDate();for(const[f,nt]of w){const ee=nt.reduce((rt,it)=>rt+it.costCents,0),Pe=s*(n>0?ee/n:0);if(Pe<=0){t.set(f,!1);continue}const at=ee/Math.max(c,1);t.set(f,ee+at*(k-c)>Pe)}return t},[K,a,w]),Y=(0,l.useMemo)(()=>Array.from(w.keys()),[w]),V=(0,l.useMemo)(()=>Array.from(T.keys()),[T]),U=b==="all"||Y.includes(b)?b:"all";(0,l.useEffect)(()=>{U!==b&&de("all")},[U,b]);const H=O==="all"||V.includes(O)?O:"all";(0,l.useEffect)(()=>{H!==O&&le("all")},[H,O]);const Je=(0,l.useMemo)(()=>{const t=Array.from(w.keys()),s=t.reduce((r,c)=>r+(w.get(c)?.reduce((k,f)=>k+f.inputTokens+f.cachedInputTokens+f.outputTokens,0)??0),0),n=t.reduce((r,c)=>r+(w.get(c)?.reduce((k,f)=>k+f.costCents,0)??0),0);return[{value:"all",label:(0,e.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,e.jsx)("span",{children:"All providers"}),t.length>0?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:M(s)}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:m(n)})]}):null]})},...t.map(r=>({value:r,label:(0,e.jsx)(Pt,{provider:r,rows:w.get(r)??[]})}))]},[w]),et=(0,l.useMemo)(()=>{const t=Array.from(T.keys()),s=t.reduce((r,c)=>r+(T.get(c)?.reduce((k,f)=>k+f.inputTokens+f.cachedInputTokens+f.outputTokens,0)??0),0),n=t.reduce((r,c)=>r+(T.get(c)?.reduce((k,f)=>k+f.costCents,0)??0),0);return[{value:"all",label:(0,e.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,e.jsx)("span",{children:"All billers"}),t.length>0?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:M(s)}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:m(n)})]}):null]})},...t.map(r=>({value:r,label:(0,e.jsx)(It,{biller:r,rows:T.get(r)??[]})}))]},[T]),Se=(a?.byAgent??[]).reduce((t,s)=>t+s.inputTokens+s.cachedInputTokens+s.outputTokens,0),Be=p?.events??[],W=A?.policies??[],I=A?.activeIncidents??[],tt=(0,l.useMemo)(()=>({company:W.filter(t=>t.scopeType==="company"),agent:W.filter(t=>t.scopeType==="agent"),project:W.filter(t=>t.scopeType==="project")}),[W]);if(!i)return(0,e.jsx)(xt,{icon:ne,message:"Select a company to view costs."});const X=K==="custom"&&!D,st=(Ue||pe)&&D,Me=He??J;return(0,e.jsxs)("div",{className:"space-y-6",children:[(0,e.jsxs)("div",{className:"space-y-5",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:"Costs"}),(0,e.jsx)("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-muted-foreground",children:"Inference spend, platform fees, credits, and live quota windows."})]}),(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:wt.map(t=>(0,e.jsx)(vt,{variant:K===t?"secondary":"ghost",size:"sm",onClick:o(()=>$e(t),"onClick"),"aria-pressed":K===t,children:St[t]},t))})]}),K==="custom"?(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border border-border p-3",children:[(0,e.jsx)("input",{type:"date",value:Le,onChange:o(t=>Oe(t.target.value),"onChange"),className:"h-9 rounded-md border border-input bg-background px-3 text-sm text-foreground"}),(0,e.jsx)("span",{className:"text-sm text-muted-foreground",children:"to"}),(0,e.jsx)("input",{type:"date",value:We,onChange:o(t=>ze(t.target.value),"onChange"),className:"h-9 rounded-md border border-input bg-background px-3 text-sm text-foreground"})]}):null,(0,e.jsxs)("div",{className:"grid gap-3 lg:grid-cols-4",children:[(0,e.jsx)(C,{label:"Inference spend",value:m(a?.summary.spendCents??0),subtitle:`${M(Se)} tokens across request-scoped events`,icon:ne}),(0,e.jsx)(C,{label:"Budget",value:I.length>0?String(I.length):a?.summary.budgetCents&&a.summary.budgetCents>0?`${a.summary.utilizationPercent}%`:"Open",subtitle:I.length>0?`${A?.pausedAgentCount??0} agents paused · ${A?.pausedProjectCount??0} projects paused`:a?.summary.budgetCents&&a.summary.budgetCents>0?`${m(a.summary.spendCents)} of ${m(a.summary.budgetCents)}`:"No monthly cap configured",icon:ie}),(0,e.jsx)(C,{label:"Finance net",value:m(p?.summary.netCents??0),subtitle:`${m(p?.summary.debitCents??0)} debits · ${m(p?.summary.creditCents??0)} credits`,icon:re}),(0,e.jsx)(C,{label:"Finance events",value:String(p?.summary.eventCount??0),subtitle:`${m(p?.summary.estimatedDebitCents??0)} estimated in range`,icon:oe})]})]}),(0,e.jsxs)(te,{value:u,onValueChange:o(t=>j(t),"onValueChange"),children:[(0,e.jsxs)(pt,{variant:"line",className:"justify-start",children:[(0,e.jsx)(z,{value:"overview",children:"Overview"}),(0,e.jsx)(z,{value:"budgets",children:"Budgets"}),(0,e.jsx)(z,{value:"providers",children:"Providers"}),(0,e.jsx)(z,{value:"billers",children:"Billers"}),(0,e.jsx)(z,{value:"finance",children:"Finance"})]}),(0,e.jsx)(B,{value:"overview",className:"mt-4 space-y-4",children:X?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select a start and end date to load data."}):st?(0,e.jsx)(se,{variant:"costs"}):Me?(0,e.jsx)("p",{className:"text-sm text-destructive",children:Me.message}):(0,e.jsxs)(e.Fragment,{children:[I.length>0?(0,e.jsx)("div",{className:"grid gap-4 xl:grid-cols-2",children:I.slice(0,2).map(t=>(0,e.jsx)(Ae,{incident:t,isMutating:E.isPending,onKeepPaused:o(()=>E.mutate({incidentId:t.id,action:"keep_paused"}),"onKeepPaused"),onRaiseAndResume:o(s=>E.mutate({incidentId:t.id,action:"raise_budget_and_resume",amount:s}),"onRaiseAndResume")},t.id))}):null,(0,e.jsxs)("div",{className:"grid gap-4 xl:grid-cols-(--gtc-31)",children:[(0,e.jsxs)(q,{children:[(0,e.jsxs)($,{className:"px-5 pt-5 pb-2",children:[(0,e.jsx)(L,{className:"text-base",children:"Inference ledger"}),(0,e.jsx)(_,{children:"Request-scoped inference spend for the selected period."})]}),(0,e.jsxs)(F,{className:"space-y-4 px-5 pb-5 pt-2",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-3xl font-semibold tabular-nums",children:m(a?.summary.spendCents??0)}),(0,e.jsx)("div",{className:"mt-1 text-sm text-muted-foreground",children:a?.summary.budgetCents&&a.summary.budgetCents>0?`Budget ${m(a.summary.budgetCents)}`:"Unlimited budget"})]}),(0,e.jsxs)("div",{className:"border border-border px-4 py-3 text-right",children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) uppercase tracking-(--tracking-eyebrow) text-muted-foreground",children:"usage"}),(0,e.jsx)("div",{className:"mt-1 text-lg font-medium tabular-nums",children:M(Se)})]})]}),a?.summary.budgetCents&&a.summary.budgetCents>0?(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("div",{className:"h-2 overflow-hidden bg-muted",children:(0,e.jsx)("div",{className:Ie("h-full transition-(--tp-width-background-color) duration-150",a.summary.utilizationPercent>90?"bg-(--status-task-blocked)":a.summary.utilizationPercent>70?"bg-(--status-task-todo)":"bg-(--status-task-done)"),style:{width:`${Math.min(100,a.summary.utilizationPercent)}%`}})}),(0,e.jsxs)("div",{className:"text-xs text-muted-foreground",children:[a.summary.utilizationPercent,"% of monthly budget consumed in this range."]})]}):null]})]}),(0,e.jsx)(Re,{debitCents:p?.summary.debitCents??0,creditCents:p?.summary.creditCents??0,netCents:p?.summary.netCents??0,estimatedDebitCents:p?.summary.estimatedDebitCents??0,eventCount:p?.summary.eventCount??0})]}),(0,e.jsxs)("div",{className:"grid gap-4 xl:grid-cols-(--gtc-32)",children:[(0,e.jsxs)(q,{children:[(0,e.jsxs)($,{className:"px-5 pt-5 pb-2",children:[(0,e.jsx)(L,{className:"text-base",children:"By agent"}),(0,e.jsx)(_,{children:"What each agent consumed in the selected period."})]}),(0,e.jsx)(F,{className:"space-y-2 px-5 pb-5 pt-2",children:(a?.byAgent.length??0)===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No cost events yet."}):a?.byAgent.map(t=>{const s=Ge.get(t.agentId)??[],n=Xe.has(t.agentId),r=s.length>0;return(0,e.jsxs)("div",{className:"border border-border px-4 py-3",children:[(0,e.jsxs)("div",{className:Ie("flex items-start justify-between gap-3",r?"cursor-pointer select-none":""),onClick:o(()=>r&&Ze(t.agentId),"onClick"),children:[(0,e.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[r?n?(0,e.jsx)(ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):(0,e.jsx)(bt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):(0,e.jsx)("span",{className:"h-3 w-3 shrink-0"}),(0,e.jsx)(yt,{agent:{id:t.agentId,name:t.agentName??t.agentId,appearance:t.agentAppearance},size:"sm"}),t.agentStatus==="terminated"?(0,e.jsx)(kt,{status:"terminated"}):null]}),(0,e.jsxs)("div",{className:"text-right text-sm tabular-nums",children:[(0,e.jsx)("div",{className:"font-medium",children:m(t.costCents)}),(0,e.jsxs)("div",{className:"text-xs text-muted-foreground",children:["in ",M(t.inputTokens+t.cachedInputTokens)," · out ",M(t.outputTokens)]}),t.apiRunCount>0||t.subscriptionRunCount>0?(0,e.jsxs)("div",{className:"text-xs text-muted-foreground",children:[t.apiRunCount>0?`${t.apiRunCount} api`:"0 api"," · ",t.subscriptionRunCount>0?`${t.subscriptionRunCount} subscription`:"0 subscription"]}):null]})]}),n&&s.length>0?(0,e.jsx)("div",{className:"mt-3 space-y-2 border-l border-border pl-4",children:s.map(c=>{const k=t.costCents>0?Math.round(c.costCents/t.costCents*100):0;return(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3 text-xs",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsxs)("div",{className:"truncate font-medium text-foreground",children:[Z(c.provider),(0,e.jsx)("span",{className:"mx-1 text-border",children:"/"}),(0,e.jsx)("span",{className:"font-mono",children:c.model})]}),(0,e.jsxs)("div",{className:"truncate text-muted-foreground",children:[Z(c.biller)," · ",mt(c.billingType)]})]}),(0,e.jsxs)("div",{className:"text-right tabular-nums",children:[(0,e.jsxs)("div",{className:"font-medium",children:[m(c.costCents),(0,e.jsxs)("span",{className:"ml-1 font-normal text-muted-foreground",children:["(",k,"%)"]})]}),(0,e.jsxs)("div",{className:"text-muted-foreground",children:[M(c.inputTokens+c.cachedInputTokens+c.outputTokens)," tok"]})]})]},`${c.provider}:${c.model}:${c.billingType}`)})}):null]},t.agentId)})})]}),(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)(q,{children:[(0,e.jsxs)($,{className:"px-5 pt-5 pb-2",children:[(0,e.jsx)(L,{className:"text-base",children:"By project"}),(0,e.jsx)(_,{children:"Run costs attributed through project-linked tasks."})]}),(0,e.jsx)(F,{className:"space-y-2 px-5 pb-5 pt-2",children:(a?.byProject.length??0)===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No project-attributed run costs yet."}):a?.byProject.map((t,s)=>(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3 border border-border px-3 py-2 text-sm",children:[(0,e.jsx)("span",{className:"truncate",children:t.projectName??t.projectId??"Unattributed"}),(0,e.jsx)("span",{className:"font-medium tabular-nums",children:m(t.costCents)})]},t.projectId??`unattributed-${s}`))})]}),(0,e.jsx)(Ee,{rows:Be.slice(0,6),emptyMessage:"No finance events yet. Add account-level charges once biller invoices or credits land."})]})]})]})}),(0,e.jsx)(B,{value:"budgets",className:"mt-4 space-y-4",children:Ve?(0,e.jsx)(se,{variant:"costs"}):ce?(0,e.jsx)("p",{className:"text-sm text-destructive",children:ce.message}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(q,{className:"border-border/70 bg-(image:--gradient-extract-2)",children:[(0,e.jsxs)($,{className:"px-5 pt-5 pb-3",children:[(0,e.jsx)(L,{className:"text-base",children:"Budget control plane"}),(0,e.jsx)(_,{children:"Hard-stop spend limits for agents and projects. Provider subscription quota stays separate and appears under Providers."})]}),(0,e.jsxs)(F,{className:"grid gap-3 px-5 pb-5 pt-0 md:grid-cols-4",children:[(0,e.jsx)(C,{label:"Active incidents",value:String(I.length),subtitle:"Open soft or hard threshold crossings",icon:re}),(0,e.jsx)(C,{label:"Pending approvals",value:String(A?.pendingApprovalCount??0),subtitle:"Budget override approvals awaiting board action",icon:oe}),(0,e.jsx)(C,{label:"Paused agents",value:String(A?.pausedAgentCount??0),subtitle:"Agent heartbeats blocked by budget",icon:ie}),(0,e.jsx)(C,{label:"Paused projects",value:String(A?.pausedProjectCount??0),subtitle:"Project execution blocked by budget",icon:ne})]})]}),I.length>0?(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-lg font-semibold",children:"Active incidents"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Resolve hard stops here by raising the budget or explicitly keeping the scope paused."})]}),(0,e.jsx)("div",{className:"grid gap-4 xl:grid-cols-2",children:I.map(t=>(0,e.jsx)(Ae,{incident:t,isMutating:E.isPending,onKeepPaused:o(()=>E.mutate({incidentId:t.id,action:"keep_paused"}),"onKeepPaused"),onRaiseAndResume:o(s=>E.mutate({incidentId:t.id,action:"raise_budget_and_resume",amount:s}),"onRaiseAndResume")},t.id))})]}):null,(0,e.jsxs)("div",{className:"space-y-5",children:[["company","agent","project"].map(t=>{const s=tt[t];return s.length===0?null:(0,e.jsxs)("section",{className:"space-y-3",children:[(0,e.jsxs)("div",{children:[(0,e.jsxs)("h2",{className:"text-lg font-semibold capitalize",children:[t," budgets"]}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:t==="company"?"Company-wide monthly policy.":t==="agent"?"Recurring monthly spend policies for individual agents.":"Lifetime spend policies for execution-bound projects."})]}),(0,e.jsx)("div",{className:"grid gap-4 xl:grid-cols-2",children:s.map(n=>(0,e.jsx)(Tt,{summary:n,isSaving:me.isPending,onSave:o(r=>me.mutate({scopeType:n.scopeType,scopeId:n.scopeId,amount:r,windowKind:n.windowKind}),"onSave")},n.policyId))})]},t)}),W.length===0?(0,e.jsx)(q,{children:(0,e.jsx)(F,{className:"px-5 py-8 text-sm text-muted-foreground",children:"No budget policies yet. Set agent and project budgets from their detail pages, or use the existing company monthly budget control."})}):null]})]})}),(0,e.jsx)(B,{value:"providers",className:"mt-4 space-y-4",children:X?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select a start and end date to load data."}):(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)(te,{value:U,onValueChange:de,children:[(0,e.jsx)(Ke,{items:Je,value:U}),(0,e.jsx)(B,{value:"all",className:"mt-4",children:Y.length===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No cost events in this period."}):(0,e.jsx)("div",{className:"grid gap-4 md:grid-cols-2",children:Y.map(t=>(0,e.jsx)(De,{provider:t,rows:w.get(t)??[],budgetMonthlyCents:a?.summary.budgetCents??0,totalCompanySpendCents:a?.summary.spendCents??0,weekSpendCents:je.get(t)??0,windowRows:Ne.get(t)??[],showDeficitNotch:Te.get(t)??!1,quotaWindows:Ce.get(t)??[],quotaError:we.get(t)??null,quotaSource:ke.get(t)??null,quotaLoading:ye},t))})}),Y.map(t=>(0,e.jsx)(B,{value:t,className:"mt-4",children:(0,e.jsx)(De,{provider:t,rows:w.get(t)??[],budgetMonthlyCents:a?.summary.budgetCents??0,totalCompanySpendCents:a?.summary.spendCents??0,weekSpendCents:je.get(t)??0,windowRows:Ne.get(t)??[],showDeficitNotch:Te.get(t)??!1,quotaWindows:Ce.get(t)??[],quotaError:we.get(t)??null,quotaSource:ke.get(t)??null,quotaLoading:ye})},t))]})})}),(0,e.jsx)(B,{value:"billers",className:"mt-4 space-y-4",children:X?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select a start and end date to load data."}):(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)(te,{value:H,onValueChange:le,children:[(0,e.jsx)(Ke,{items:et,value:H}),(0,e.jsx)(B,{value:"all",className:"mt-4",children:V.length===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No billable events in this period."}):(0,e.jsx)("div",{className:"grid gap-4 md:grid-cols-2",children:V.map(t=>{const s=(T.get(t)??[])[0];if(!s)return null;const n=(Q??[]).filter(r=>r.biller===t);return(0,e.jsx)(Fe,{row:s,weekSpendCents:fe.get(t)??0,budgetMonthlyCents:a?.summary.budgetCents??0,totalCompanySpendCents:a?.summary.spendCents??0,providerRows:n},t)})})}),V.map(t=>{const s=(T.get(t)??[])[0];if(!s)return null;const n=(Q??[]).filter(r=>r.biller===t);return(0,e.jsx)(B,{value:t,className:"mt-4",children:(0,e.jsx)(Fe,{row:s,weekSpendCents:fe.get(t)??0,budgetMonthlyCents:a?.summary.budgetCents??0,totalCompanySpendCents:a?.summary.spendCents??0,providerRows:n})},t)})]})})}),(0,e.jsx)(B,{value:"finance",className:"mt-4 space-y-4",children:X?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select a start and end date to load data."}):pe?(0,e.jsx)(se,{variant:"costs"}):J?(0,e.jsx)("p",{className:"text-sm text-destructive",children:J.message}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Re,{debitCents:p?.summary.debitCents??0,creditCents:p?.summary.creditCents??0,netCents:p?.summary.netCents??0,estimatedDebitCents:p?.summary.estimatedDebitCents??0,eventCount:p?.summary.eventCount??0}),(0,e.jsxs)("div",{className:"grid gap-4 xl:grid-cols-(--gtc-33)",children:[(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)(q,{children:[(0,e.jsxs)($,{className:"px-5 pt-5 pb-2",children:[(0,e.jsx)(L,{className:"text-base",children:"By biller"}),(0,e.jsx)(_,{children:"Account-level financial events grouped by who charged or credited them."})]}),(0,e.jsx)(F,{className:"grid gap-4 px-5 pb-5 pt-2 md:grid-cols-2",children:(p?.byBiller.length??0)===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No finance events yet."}):p?.byBiller.map(t=>(0,e.jsx)(jt,{row:t},t.biller))})]}),(0,e.jsx)(Ee,{rows:Be})]}),(0,e.jsx)(Ct,{rows:p?.byKind??[]})]})]})})]})]})}o(zt,"Costs");export{zt as Costs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var P=Object.defineProperty;var l=(e,r)=>P(e,"name",{value:r,configurable:!0});import{i as
|
|
1
|
+
var P=Object.defineProperty;var l=(e,r)=>P(e,"name",{value:r,configurable:!0});import{i as h}from"./rolldown-runtime-ZpX3ckPj.js";import{S as w,ji as D,ki as N,t as u}from"./agent-avatar-url-COB3FyNh.js";import{A as x,T as E,j as z,k as I,t as q}from"./button-B-wjguAV.js";var p={name:"ban",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]]};p.node;var K=u(p),y={name:"circle-dashed",size:24,node:[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]]};y.node;var f=u(y),v={name:"circle-dot",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]};v.node;var $=u(v),g={name:"circle-minus",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],aliases:["minus-circle"]};g.node;var k=u(g),t=h(N(),1),A={sm:14,md:16,lg:20},F=u("TaskProgressSpinner",[["circle",{cx:"12",cy:"12",r:"10",pathLength:"100",strokeDasharray:"80 20",key:"progress"}]]),L={idle:x,backlog:f,todo:x,in_progress:F,in_review:$,done:z,blocked:k,cancelled:K,in_queue:k},U=f;function Q({status:e,size:r="md",className:a,title:s}){const c=A[r],i=L[e]??U,d=E[e]??"--status-task-icon-backlog",m=s?{role:"img","aria-label":s}:{"aria-hidden":!0};return(0,t.jsx)(i,{size:c,className:w("inline-block shrink-0 align-middle",e==="in_progress"&&"motion-safe:animate-spin",a),style:{color:`var(${d})`},...m,children:s?(0,t.jsx)("title",{children:s}):null})}l(Q,"StatusGlyph");var n=h(D(),1),_=(0,n.createContext)(null);function V(e,r){if(e===r)return!0;if(e.length!==r.length)return!1;for(let a=0;a<e.length;a+=1)if(e[a]?.label!==r[a]?.label||e[a]?.onClick!==r[a]?.onClick||e[a]?.href!==r[a]?.href||e[a]?.identifier!==r[a]?.identifier||e[a]?.leadingKey!==r[a]?.leadingKey||e[a]?.trailingKey!==r[a]?.trailingKey)return!1;return!0}l(V,"breadcrumbsEqual");function O(e,r){const a=e.length===0?[]:[...e].reverse().map(c=>c.label),s=r?.trim()?[r.trim()]:[];return[...a,...s,"Paperclip"].join(" • ")}l(O,"buildDocumentTitle");function R({children:e,companyName:r}){const[a,s]=(0,n.useState)([]),[c,i]=(0,n.useState)(null),[d,m]=(0,n.useState)(null),[j,C]=(0,n.useState)(null),S=(0,n.useCallback)(o=>{s(b=>V(b,o)?b:o)},[]),T=(0,n.useCallback)(o=>{C(o)},[]),M=(0,n.useCallback)(o=>{i(o)},[]),B=(0,n.useCallback)(o=>{m(o)},[]);return(0,n.useEffect)(()=>{document.title=O(a,r)},[a,r]),(0,t.jsx)(_.Provider,{value:{breadcrumbs:a,setBreadcrumbs:S,breadcrumbToolbar:c,setBreadcrumbToolbar:M,breadcrumbPanelControl:d,setBreadcrumbPanelControl:B,mobileToolbar:j,setMobileToolbar:T},children:e})}l(R,"BreadcrumbProvider");function W(){const e=(0,n.useContext)(_);if(!e)throw new Error("useBreadcrumbs must be used within BreadcrumbProvider");return e}l(W,"useBreadcrumbs");function Y({icon:e,title:r,message:a,description:s,action:c,onAction:i,hideActionIcon:d=!1}){return(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,t.jsx)("div",{className:"bg-muted/50 p-4 mb-4",children:(0,t.jsx)(e,{className:"h-10 w-10 text-muted-foreground/50"})}),r?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"text-base font-semibold text-foreground mb-1.5",children:r}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground mb-4 max-w-md",children:a})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"text-sm font-medium text-foreground mb-1",children:a}),s&&(0,t.jsx)("p",{className:"max-w-md text-sm text-muted-foreground mb-4",children:s})]}),c&&i&&(0,t.jsxs)(q,{onClick:i,children:[!d&&(0,t.jsx)(I,{className:"h-4 w-4 mr-1.5"}),c]})]})}l(Y,"EmptyState");export{k as a,K as c,Q as i,R as n,$ as o,W as r,f as s,Y as t};
|