omnigateway 0.7.0 → 0.7.2
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/README.md +21 -6
- package/bin/omni.js +6035 -5841
- package/gateway.js +6326 -5555
- package/package.json +1 -1
- package/public/assets/{Chip-BWxO0uV7.js → Chip-BOyBT5TP.js} +1 -1
- package/public/assets/{CopyValue-DIR5A6PG.js → CopyValue-DRHHQlN_.js} +3 -3
- package/public/assets/{Field-DI5YTYOX.js → Field-DK5zaBVA.js} +1 -1
- package/public/assets/Lamp-ZlMzNs5N.js +25 -0
- package/public/assets/{Panel-BCpZVY4U.js → Panel-CYQvfI3L.js} +19 -19
- package/public/assets/Rack-D798XvPQ.js +466 -0
- package/public/assets/{Readout-B0TZE8aA.js → Readout-D6-aurU8.js} +1 -1
- package/public/assets/{RequestTable-D4z82uxG.js → RequestTable-CEBhwDs7.js} +2 -2
- package/public/assets/{SummaryDeck-CzozuXOu.js → SummaryDeck-DBCSHihY.js} +2 -2
- package/public/assets/{Toggle-ByxBCMfb.js → Toggle-CdCCoDEo.js} +1 -1
- package/public/assets/{TokenBreakdown-BMEiZhRX.js → TokenBreakdown-DDI9uTPW.js} +1 -1
- package/public/assets/{WindowChart-nxC4SCRC.js → WindowChart-C-Y6U3WF.js} +2 -2
- package/public/assets/_app-BWNEo1e-.js +1 -0
- package/public/assets/_app.accounts-CLLLwN77.js +59 -0
- package/public/assets/{_app.console-D6lrTxJt.js → _app.console-Dr9qxU7J.js} +3 -3
- package/public/assets/{_app.database-Y3lFDxoP.js → _app.database-D0W0pcxC.js} +4 -4
- package/public/assets/{_app.index-DUFa7RRT.js → _app.index-CyxnfhVX.js} +8 -8
- package/public/assets/{_app.keys-DRfXCzMJ.js → _app.keys-D9qmw9Tj.js} +11 -11
- package/public/assets/{_app.logs-BQT3kFZr.js → _app.logs-DtXUZETW.js} +4 -4
- package/public/assets/{_app.models-CDpbIYHW.js → _app.models-CNxwXyFl.js} +11 -11
- package/public/assets/{_app.plugins._pluginId-jaswB8Z5.js → _app.plugins._pluginId-87Ox_hkW.js} +1 -1
- package/public/assets/_app.plugins._pluginId-CZWipH1n.js +2 -0
- package/public/assets/_app.settings-DjiMSl1Y.js +88 -0
- package/public/assets/{_app.usage-BaT54Vee.js → _app.usage-CZz9raYR.js} +6 -6
- package/public/assets/{chevron-right-0adI8395.js → chevron-right-CPoaXYHw.js} +1 -1
- package/public/assets/client-CZnyYbay.js +39 -0
- package/public/assets/{index-BRrBGt1i.js → index-DNSPtYpM.js} +3 -3
- package/public/assets/{login-BSWCo_Fz.js → login-BtlMmyKj.js} +3 -3
- package/public/assets/login-dV42ZQIA.js +2 -0
- package/public/assets/plus-_zo43Lvf.js +1 -0
- package/public/assets/{preload-helper-CD37DT-E.js → preload-helper-4wSmu2-E.js} +1 -1
- package/public/assets/{shared-dShKzjig.js → shared-OJcoRCqT.js} +1 -1
- package/public/assets/{stream-BD4FhzLn.js → stream-CEb81tzM.js} +1 -1
- package/public/assets/{trash-2-DrDlpCqO.js → trash-2-BjpqTubo.js} +1 -1
- package/public/index.html +8 -8
- package/public/assets/Lamp-DN2EKL4m.js +0 -25
- package/public/assets/Rack-B03tpeW-.js +0 -466
- package/public/assets/_app-D9B6OIjd.js +0 -1
- package/public/assets/_app.accounts-BiRGhH3s.js +0 -59
- package/public/assets/_app.plugins._pluginId-CtEAGvad.js +0 -2
- package/public/assets/_app.settings-CG63splg.js +0 -58
- package/public/assets/client-_6YMm6vh.js +0 -39
- package/public/assets/login-C7v-Fr28.js +0 -2
- package/public/assets/plus-B_f8M9yB.js +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{Ct as e,E as t,Ft as n,H as r,ft as i,kt as a,lt as o,mt as s,xt as c}from"./Lamp-
|
|
1
|
+
import{Ct as e,E as t,Ft as n,H as r,ft as i,kt as a,lt as o,mt as s,xt as c}from"./Lamp-ZlMzNs5N.js";import{C as l,D as u,O as d,S as f,_ as p,a as m,b as h,i as g,o as _,r as v,t as y,v as b,w as x}from"./Panel-CYQvfI3L.js";import{b as S,m as C,r as w,t as T}from"./Rack-D798XvPQ.js";import{t as E}from"./plus-_zo43Lvf.js";import{t as D}from"./trash-2-BjpqTubo.js";import{t as O}from"./Toggle-CdCCoDEo.js";import{n as ee,t as k}from"./Chip-BOyBT5TP.js";import{i as A,n as j,r as M,t as N}from"./Field-DK5zaBVA.js";import{t as P}from"./Meter-stpt3vQu.js";import{useEffect as te,useId as ne,useState as F}from"react";import{Fragment as I,jsx as L,jsxs as R}from"react/jsx-runtime";import z from"styled-components";var re=S(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),ie=S(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),B=[`tier`,`health`,`quota`,`cost`,`latency`,`load`],ae={tier:`How preferred this tier is`,health:`Consecutive failures and breaker state`,quota:`Headroom in the tightest window, against how much of it is left`,cost:`Price of this request against the other candidates`,latency:`Observed time to first token`,load:`Requests in flight on this pair right now`},oe=z.li`
|
|
2
2
|
padding: ${({theme:e})=>e.space(2)} 0;
|
|
3
3
|
border-bottom: 1px solid ${({theme:e})=>e.color.rule};
|
|
4
4
|
|
|
5
5
|
&:last-child {
|
|
6
6
|
border-bottom: 0;
|
|
7
7
|
}
|
|
8
|
-
`,se=z(
|
|
8
|
+
`,se=z(b)`
|
|
9
9
|
width: 22px;
|
|
10
10
|
color: ${({theme:e})=>e.color.inkFaint};
|
|
11
11
|
flex: none;
|
|
@@ -34,7 +34,7 @@ import{Ct as e,E as t,Ft as n,H as r,ft as i,kt as a,lt as o,mt as s,xt as c}fro
|
|
|
34
34
|
align-items: center;
|
|
35
35
|
gap: ${({theme:e})=>e.space(2)};
|
|
36
36
|
padding: 5px 0;
|
|
37
|
-
`,pe=z(
|
|
37
|
+
`,pe=z(h)`
|
|
38
38
|
gap: ${({theme:e})=>e.space(3)};
|
|
39
39
|
flex-wrap: wrap;
|
|
40
40
|
`,V=z.label`
|
|
@@ -46,7 +46,7 @@ import{Ct as e,E as t,Ft as n,H as r,ft as i,kt as a,lt as o,mt as s,xt as c}fro
|
|
|
46
46
|
`,me=z.p`
|
|
47
47
|
font-size: 12px;
|
|
48
48
|
color: ${({theme:e})=>e.color.down};
|
|
49
|
-
`;function H(e,t,n){return(e[t]??0)*n[t]}function he({modelId:e}){let[t,r]=F({tools:!1,images:!1,reasoning:!1}),[i,a]=F(null),[o,c]=F(null),
|
|
49
|
+
`;function H(e,t,n){return(e[t]??0)*n[t]}function he({modelId:e}){let[t,r]=F({tools:!1,images:!1,reasoning:!1}),[i,a]=F(null),[o,c]=F(null),d=n(),m=s(),g=d.data?.weights,S=()=>{e!==null&&(c(null),m.mutate({modelId:e,need:t},{onSuccess:e=>a(e),onError:e=>{a(null),c(_(e))}}))},C=new Map(B.map(e=>[e,Math.max(1e-4,...(i?.candidates??[]).map(t=>g===void 0?0:Math.abs(H(t.reasons,e,g))))]));return L(y,{legend:`Explain`,meta:e??`no model selected`,actions:R(u,{type:`button`,$size:`sm`,$variant:`primary`,disabled:e===null||m.isPending,onClick:S,children:[L(re,{}),m.isPending?`Ranking…`:`Rank candidates`]}),children:R(l,{$gap:3,children:[R(l,{$gap:1,children:[L(p,{children:`Pretend the request needs`}),R(pe,{children:[R(V,{children:[L(O,{checked:t.tools,label:`Probe request uses tools`,onCheckedChange:e=>r({...t,tools:e})}),`Tools`]}),R(V,{children:[L(O,{checked:t.images,label:`Probe request includes an image`,onCheckedChange:e=>r({...t,images:e})}),`Images`]}),R(V,{children:[L(O,{checked:t.reasoning,label:`Probe request asks for reasoning`,onCheckedChange:e=>r({...t,reasoning:e})}),`Reasoning`]})]})]}),o===null?null:L(me,{children:o}),i===null?L(v,{legend:`Not ranked yet`,message:e===null?`Select a model to see which account the router would pick for it.`:`Run the ranking to see which account wins, by how much, and what was filtered out.`}):R(l,{$gap:3,children:[R(h,{$gap:2,$wrap:!0,children:[L(k,{$tone:`accent`,children:i.strategy}),i.deterministic?null:L(k,{$tone:`warn`,children:`order varies per request`}),L(f,{}),R(p,{children:[i.candidates.length,` eligible · `,i.excluded.length,` filtered out`]})]}),i.candidates.length===0?L(v,{legend:`Nothing eligible`,message:`Every target was filtered out. The reasons below say which rule removed each one.`}):L(`ul`,{children:i.candidates.map((e,t)=>R(oe,{children:[R(h,{$gap:2,children:[L(se,{children:t+1}),L(ee,{provider:e.provider}),L(x,{style:{maxWidth:`22ch`},children:e.credentialLabel}),L(b,{$dim:!0,children:e.model}),R(k,{children:[`tier `,e.tier]}),L(f,{}),t===0?L(ce,{children:`would be used`}):null,L(b,{children:e.score.toFixed(2)})]}),g===void 0?null:L(le,{children:B.map(t=>{let n=H(e.reasons,t,g),r=C.get(t)??1;return R(ue,{title:ae[t],children:[R(de,{children:[L(p,{children:t}),L(b,{$dim:!0,$size:`10.5px`,children:n.toFixed(2)})]}),L(P,{fraction:Math.abs(n)/r,height:4,tone:`var(--accent)`,label:`${t} contributes ${n.toFixed(2)} of ${e.score.toFixed(2)}`})]},t)})})]},`${e.credentialId}:${e.model}`))}),i.excluded.length===0?null:R(l,{$gap:1,children:[L(p,{children:`Filtered out`}),L(`ul`,{children:i.excluded.map(e=>R(fe,{children:[L(b,{$dim:!0,children:e.model}),L(b,{$dim:!0,children:e.credentialId}),L(f,{}),L(k,{$tone:e.reason.startsWith(`capability`)?`warn`:`down`,children:e.reason})]},`${e.credentialId}:${e.model}:${e.reason}`))})]})]})]})})}function U(e,t,n){return r(e,t)?.models.find(e=>e.id===n)}function W(e,t,n){let i=r(e,t);return i===void 0?null:i.models.find(e=>e.id===n)?.auth??i.authTypes}var G=[{id:`score`,label:`Best score`,blurb:`Rank every eligible target by the routing weights and take the best one.`},{id:`priority`,label:`Lowest tier`,blurb:`Always prefer the lowest tier. Score only breaks ties inside a tier.`},{id:`roundRobin`,label:`Round robin`,blurb:`Take whichever eligible target has been idle longest, to spread load evenly.`},{id:`weighted`,label:`Weighted draw`,blurb:`Pick at random, biased by weight. The order differs from request to request.`}],K=0;function q(){return K+=1,`target-${K}`}function J(e,t,n){let r=U(e,t,n)?.pricing;return r===void 0?null:{costInput:String(r.input),costOutput:String(r.output),costCacheRead:String(r.cacheRead),costCacheWrite5m:String(r.cacheWrite5m),costCacheWrite1h:String(r.cacheWrite1h)}}function ge(e,t,n){let r=U(e,t,n)?.limits;return r===void 0?null:{contextWindow:String(r.contextWindow),maxOutputTokens:String(r.maxOutputTokens)}}var _e={oauth:`OAuth`,apiKey:`an API key`};function Y(e){return e.map(e=>_e[e]).join(` or `)}function ve(e){let t=Object.create(null);for(let n of e){let e=t[n.provider]??[];e.includes(n.authType)||e.push(n.authType),t[n.provider]=e}return t}function X(e,t,n,r){let i=r[t];if(i===void 0||i.length===0)return!0;let a=W(e,t,n);return a===null||a.some(e=>i.includes(e))}function ye(e,t,n){let i=r(e,t);return i===void 0?[]:i.models.filter(r=>X(e,t,r.id,n))}function be(e,t,n,r){if(n.trim().length===0||X(e,t,n,r))return null;let i=r[t]??[];return`${t} serves this model to ${Y(W(e,t,n)??[])} only, and every ${t} account here is ${Y(i)}. Requests routed here will fail.`}function xe(e,n){let r={provider:e.provider,endpointId:e.endpointId};return n.filter(e=>t(r,e)).map(e=>({id:e.id,label:e.accountEmail??e.label}))}function Se(e,t,n){return e.length===0||n.length===0||xe(t,n).some(t=>t.id===e)?null:`No connected account has this id. Requests routed here will fail rather than falling back to another account.`}function Ce(e,t){return{...e,endpointId:t,...t===e.endpointId?{}:{credentialId:``}}}function we(e,t,n){return{...t,...n,...J(e,n.provider,n.model)??{},...n.provider===t.provider?{}:{credentialId:``},contextWindow:``,maxOutputTokens:``}}function Te(e,t){let n=t??e[0]?.id??`anthropic`,i=r(e,n)?.defaultModel??``,a=J(e,n,i);return{key:q(),provider:n,endpointId:``,model:i,tier:`1`,weight:`1`,costInput:a?.costInput??`0`,costOutput:a?.costOutput??`0`,costCacheRead:a?.costCacheRead??``,costCacheWrite5m:a?.costCacheWrite5m??``,costCacheWrite1h:a?.costCacheWrite1h??``,contextWindow:``,maxOutputTokens:``,credentialId:``,tools:!0,images:!0,reasoning:!0}}function Ee(e){return{id:``,strategy:`score`,isAlias:!1,targets:[Te(e)]}}function De(e){return{id:e.id,strategy:e.strategy,isAlias:e.isAlias,targets:e.targets.map(e=>({key:q(),provider:e.provider,endpointId:e.provider===`custom`?e.endpointId??``:``,model:e.model,tier:String(e.tier),weight:String(e.weight),costInput:String(e.costPerMTok.input),costOutput:String(e.costPerMTok.output),costCacheRead:e.costPerMTok.cacheRead===void 0?``:String(e.costPerMTok.cacheRead),costCacheWrite5m:e.costPerMTok.cacheWrite5m===void 0?``:String(e.costPerMTok.cacheWrite5m),costCacheWrite1h:e.costPerMTok.cacheWrite1h===void 0?``:String(e.costPerMTok.cacheWrite1h),contextWindow:e.contextWindow===void 0?``:String(e.contextWindow),maxOutputTokens:e.maxOutputTokens===void 0?``:String(e.maxOutputTokens),credentialId:e.credentialId??``,tools:e.capabilities.tools,images:e.capabilities.images,reasoning:e.capabilities.reasoning}))}}function Oe(e){let t=e.id.trim();if(t.length===0)return{ok:!1,problem:`Give the model a name clients will ask for.`};if(e.targets.length===0)return{ok:!1,problem:`A model needs at least one target to route to.`};let n=[];for(let[t,r]of e.targets.entries()){let e=`Target ${t+1}`,i=r.endpointId.trim(),a=r.credentialId.trim();if(r.provider===`custom`&&i.length===0)return{ok:!1,problem:`${e} needs a custom endpoint.`};let o=r.model.trim();if(o.length===0)return{ok:!1,problem:`${e} needs a provider model name.`};let s=Number(r.tier);if(!Number.isInteger(s)||s<1)return{ok:!1,problem:`${e}: tier must be a whole number of 1 or more.`};let c=Number(r.weight);if(!Number.isFinite(c)||c<=0)return{ok:!1,problem:`${e}: weight must be greater than zero.`};let l=Number(r.costInput),u=Number(r.costOutput);if(!Number.isFinite(l)||l<0||!Number.isFinite(u)||u<0)return{ok:!1,problem:`${e}: prices cannot be negative.`};let d=r.costCacheRead.trim().length>0,f=Number(r.costCacheRead);if(d&&(!Number.isFinite(f)||f<0))return{ok:!1,problem:`${e}: the cache-read price cannot be negative.`};let p=r.costCacheWrite5m.trim().length>0,m=Number(r.costCacheWrite5m);if(p&&(!Number.isFinite(m)||m<0))return{ok:!1,problem:`${e}: the 5m cache-write price must be a number of 0 or more.`};let h=r.costCacheWrite1h.trim().length>0,g=Number(r.costCacheWrite1h);if(h&&(!Number.isFinite(g)||g<0))return{ok:!1,problem:`${e}: the 1h cache-write price must be a number of 0 or more.`};let _=r.contextWindow.trim().length>0,v=Number(r.contextWindow);if(_&&(!Number.isInteger(v)||v<1))return{ok:!1,problem:`${e}: the context window must be a whole number of tokens.`};let y=r.maxOutputTokens.trim().length>0,b=Number(r.maxOutputTokens);if(y&&(!Number.isInteger(b)||b<1))return{ok:!1,problem:`${e}: the output limit must be a whole number of tokens.`};n.push({provider:r.provider,...r.provider===`custom`?{endpointId:i}:{},model:o,tier:s,weight:c,costPerMTok:{input:l,output:u,...d?{cacheRead:f}:{},...p?{cacheWrite5m:m}:{},...h?{cacheWrite1h:g}:{}},..._?{contextWindow:v}:{},...y?{maxOutputTokens:b}:{},...a.length>0?{credentialId:a}:{},capabilities:{tools:r.tools,images:r.images,reasoning:r.reasoning}})}return{ok:!0,model:{id:t,strategy:e.strategy,isAlias:e.isAlias,targets:n}}}var ke=z.fieldset`
|
|
50
50
|
border: 1px solid ${({theme:e})=>e.color.rule};
|
|
51
51
|
border-left: 3px solid ${({$provider:e})=>C(e)};
|
|
52
52
|
border-radius: ${({theme:e})=>e.radius.control};
|
|
@@ -76,7 +76,7 @@ import{Ct as e,E as t,Ft as n,H as r,ft as i,kt as a,lt as o,mt as s,xt as c}fro
|
|
|
76
76
|
flex-direction: column;
|
|
77
77
|
gap: 4px;
|
|
78
78
|
min-width: 0;
|
|
79
|
-
`,Me=z(
|
|
79
|
+
`,Me=z(h)`
|
|
80
80
|
gap: ${({theme:e})=>e.space(3)};
|
|
81
81
|
flex-wrap: wrap;
|
|
82
82
|
`,Ne=z.p`
|
|
@@ -88,7 +88,7 @@ import{Ct as e,E as t,Ft as n,H as r,ft as i,kt as a,lt as o,mt as s,xt as c}fro
|
|
|
88
88
|
align-items: center;
|
|
89
89
|
gap: 6px;
|
|
90
90
|
cursor: pointer;
|
|
91
|
-
`;function Pe({target:e,index:t,onChange:n,onRemove:i,removable:a,catalog:o,endpoints:s,held:c,credentials:
|
|
91
|
+
`;function Pe({target:e,index:t,onChange:n,onRemove:i,removable:a,catalog:o,endpoints:s,held:c,credentials:m}){let g=ne(),_=r(o,e.provider),v=ye(o,e.provider,c),y=be(o,e.provider,e.model,c),b=xe(e,m),x=Se(e.credentialId,e,m),S=(t,r)=>{n({...e,[t]:r})},C=J(o,e.provider,e.model),w=ge(o,e.provider,e.model),T=t=>{n(we(o,e,t))};return R(ke,{$provider:e.provider,children:[R(h,{$gap:2,children:[R(p,{as:`legend`,children:[`Target `,t+1]}),L(f,{}),L(d,{type:`button`,$variant:`ghost`,$size:`sm`,disabled:!a,"aria-label":`Remove target ${t+1}`,title:a?`Remove target ${t+1}`:`A model needs at least one target`,onClick:i,children:L(D,{})})]}),R(Ae,{children:[R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-provider`,children:`Provider`}),R(A,{id:`${g}-provider`,value:e.provider,onChange:t=>{let n=t.target.value,i=r(o,n),a=i?.models.some(t=>t.id===e.model)??!1;T({provider:n,model:a?e.model:i?.defaultModel??``})},children:[o.map(e=>L(`option`,{value:e.id,children:e.label},e.id)),_===void 0?R(`option`,{value:e.provider,children:[e.provider,` (not in the catalog)`]}):null]})]}),e.provider===`custom`?R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-endpoint`,children:`Endpoint`}),R(A,{id:`${g}-endpoint`,value:e.endpointId,onChange:t=>n(Ce(e,t.target.value)),children:[L(`option`,{value:``,children:`Choose endpoint`}),s.map(e=>L(`option`,{value:e.id,children:e.label},e.id))]})]}):null,R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-model`,children:`Provider model`}),L(j,{id:`${g}-model`,list:`${g}-catalog`,value:e.model,placeholder:_?.defaultModel??``,onChange:t=>T({provider:e.provider,model:t.target.value})}),L(`datalist`,{id:`${g}-catalog`,children:v.map(e=>L(`option`,{value:e.id,children:e.label},e.id))}),y===null?null:L(Ne,{role:`note`,children:y})]}),R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-tier`,children:`Tier`}),L(M,{id:`${g}-tier`,min:1,step:1,value:e.tier,onChange:e=>S(`tier`,e.target.value)})]}),R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-weight`,children:`Weight`}),L(M,{id:`${g}-weight`,min:0,step:.1,value:e.weight,onChange:e=>S(`weight`,e.target.value)})]})]}),L(l,{$gap:1,children:R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-account`,children:`Account`}),R(A,{id:`${g}-account`,value:e.credentialId,onChange:e=>S(`credentialId`,e.target.value),children:[L(`option`,{value:``,children:`Any account`}),b.map(e=>L(`option`,{value:e.id,children:e.label},e.id)),x===null?null:R(`option`,{value:e.credentialId,children:[e.credentialId,` (removed)`]})]}),x===null?null:L(Ne,{role:`note`,children:x})]})}),R(l,{$gap:1,children:[R(h,{$gap:2,children:[L(p,{children:`Price per million tokens`}),L(f,{}),C===null?L(p,{as:`span`,children:`not in the catalog — price it yourself`}):R(u,{type:`button`,$size:`sm`,$variant:`ghost`,disabled:e.costInput===C.costInput&&e.costOutput===C.costOutput&&e.costCacheRead===C.costCacheRead&&e.costCacheWrite5m===C.costCacheWrite5m&&e.costCacheWrite1h===C.costCacheWrite1h,onClick:()=>n({...e,...C}),children:[L(ie,{}),`Use list price`]})]}),R(je,{children:[R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-in`,children:`Input`}),L(M,{id:`${g}-in`,min:0,step:.01,value:e.costInput,onChange:e=>S(`costInput`,e.target.value)})]}),R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-out`,children:`Output`}),L(M,{id:`${g}-out`,min:0,step:.01,value:e.costOutput,onChange:e=>S(`costOutput`,e.target.value)})]}),R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-cache`,children:`Cache read`}),L(M,{id:`${g}-cache`,min:0,step:.01,placeholder:`same as input`,value:e.costCacheRead,onChange:e=>S(`costCacheRead`,e.target.value)})]}),R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-write5m`,children:`Cache write 5m`}),L(M,{id:`${g}-write5m`,min:0,step:.01,placeholder:`1.25x input`,value:e.costCacheWrite5m,onChange:e=>S(`costCacheWrite5m`,e.target.value)})]}),R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-write1h`,children:`Cache write 1h`}),L(M,{id:`${g}-write1h`,min:0,step:.01,placeholder:`2x input`,value:e.costCacheWrite1h,onChange:e=>S(`costCacheWrite1h`,e.target.value)})]})]})]}),R(l,{$gap:1,children:[R(h,{$gap:2,children:[L(p,{children:`Token limits`}),L(f,{}),w===null?L(p,{as:`span`,children:`not in the catalog — state them yourself`}):L(p,{as:`span`,children:`left empty, the published figures are used — and for an OpenAI target, the narrower ones its OAuth backend allows`})]}),R(je,{children:[R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-context`,children:`Context window`}),L(M,{id:`${g}-context`,min:1,step:1024,placeholder:w?.contextWindow??`published`,value:e.contextWindow,onChange:e=>S(`contextWindow`,e.target.value)})]}),R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-maxout`,children:`Max output`}),L(M,{id:`${g}-maxout`,min:1,step:1024,placeholder:w?.maxOutputTokens??`published`,value:e.maxOutputTokens,onChange:e=>S(`maxOutputTokens`,e.target.value)})]})]})]}),R(l,{$gap:1,children:[L(p,{children:`Capabilities`}),R(Me,{children:[R(Q,{children:[L(O,{checked:e.tools,label:`Target ${t+1} supports tools`,onCheckedChange:e=>S(`tools`,e)}),`Tools`]}),R(Q,{children:[L(O,{checked:e.images,label:`Target ${t+1} supports images`,onCheckedChange:e=>S(`images`,e)}),`Images`]}),R(Q,{children:[L(O,{checked:e.reasoning,label:`Target ${t+1} supports reasoning`,onCheckedChange:e=>S(`reasoning`,e)}),`Reasoning`]})]})]})]})}var Fe=z.p`
|
|
92
92
|
font-size: 11.5px;
|
|
93
93
|
color: ${({theme:e})=>e.color.inkDim};
|
|
94
94
|
`,Ie=z.p`
|
|
@@ -97,9 +97,9 @@ import{Ct as e,E as t,Ft as n,H as r,ft as i,kt as a,lt as o,mt as s,xt as c}fro
|
|
|
97
97
|
`,Le=z.p`
|
|
98
98
|
font-size: 12px;
|
|
99
99
|
color: ${({theme:e})=>e.color.ok};
|
|
100
|
-
`,Re=z(
|
|
100
|
+
`,Re=z(h)`
|
|
101
101
|
gap: 8px;
|
|
102
|
-
`;function ze({model:t,onSaved:n,onDeleted:r}){let s=e().data??[],[c,
|
|
102
|
+
`;function ze({model:t,onSaved:n,onDeleted:r}){let s=e().data??[],[c,d]=F(()=>t===null?Ee(s):De(t)),[m,g]=F(null),[v,b]=F(!1),[x,S]=F(!1),C=a(),T=i(),D=o(),ee=ve(D.data??[]),k=(D.data??[]).filter(e=>e.provider===`custom`).map(e=>({id:String(e.providerData.endpointId??``),label:String(e.providerData.endpointLabel??e.providerData.endpointId??``)})).filter((e,t,n)=>e.id.length>0&&n.findIndex(t=>t.id===e.id)===t),M=t?.id??null;te(()=>{d(t===null?Ee(s):De(t)),g(null),b(!1)},[M]);let P=G.find(e=>e.id===c.strategy);return R(I,{children:[L(y,{legend:t===null?`New model`:`Edit model`,meta:t===null?void 0:t.id,actions:R(I,{children:[t===null?null:L(u,{type:`button`,$variant:`danger`,$size:`sm`,onClick:()=>S(!0),children:`Delete`}),L(u,{type:`button`,$variant:`primary`,$size:`sm`,disabled:C.isPending,onClick:()=>{b(!1);let e=Oe(c);if(!e.ok){g(e.problem);return}g(null),C.mutate(e.model,{onSuccess:()=>{b(!0),n(e.model.id)},onError:e=>g(_(e))})},children:C.isPending?`Saving…`:t===null?`Create model`:`Save changes`})]}),children:R(l,{$gap:3,children:[L(N,{label:`Model name`,hint:t===null?`What clients send as the model. Anything not listed here is rejected.`:`Fixed once created. To rename, create a model under the new name and delete this one.`,children:e=>L(j,{...e,value:c.id,disabled:t!==null,placeholder:`fast`,onChange:e=>d({...c,id:e.target.value})})}),L(N,{label:`Routing strategy`,children:e=>L(A,{...e,value:c.strategy,onChange:e=>d({...c,strategy:e.target.value}),children:G.map(e=>L(`option`,{value:e.id,children:e.label},e.id))})}),P===void 0?null:L(Fe,{children:P.blurb}),R(Re,{children:[L(O,{checked:c.isAlias,label:`This model is an alias for a provider model name`,onCheckedChange:e=>d({...c,isAlias:e})}),R(l,{$gap:0,children:[L(p,{as:`span`,children:`Alias`}),L(Fe,{children:`Mark this when the name mirrors a provider's own model name.`})]})]}),R(l,{$gap:2,children:[R(h,{children:[L(p,{children:`Targets`}),L(f,{}),R(u,{type:`button`,$size:`sm`,onClick:()=>d({...c,targets:[...c.targets,Te(s,c.targets.at(-1)?.provider)]}),children:[L(E,{}),`Add target`]})]}),c.targets.map((e,t)=>L(Pe,{target:e,index:t,removable:c.targets.length>1,catalog:s,endpoints:k,held:ee,credentials:D.data??[],onChange:t=>d({...c,targets:c.targets.map(n=>n.key===e.key?t:n)}),onRemove:()=>d({...c,targets:c.targets.filter(t=>t.key!==e.key)})},e.key))]}),m===null?null:L(Ie,{role:`alert`,children:m}),v&&m===null?L(Le,{role:`status`,children:`Saved.`}):null]})}),L(w,{open:x,onOpenChange:S,title:`Delete model`,body:t===null?``:`Deleting "${t.id}" makes it unroutable. Clients asking for it will get a model-unavailable error, and any key allowlisting it keeps a name that no longer resolves.`,confirmLabel:`Delete model`,busy:T.isPending,onConfirm:()=>{t!==null&&T.mutate(t.id,{onSuccess:()=>{S(!1),r()},onError:e=>{S(!1),g(_(e))}})}})]})}var Be=z.div`
|
|
103
103
|
display: grid;
|
|
104
104
|
grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
|
|
105
105
|
gap: ${({theme:e})=>e.space(4)};
|
|
@@ -108,7 +108,7 @@ import{Ct as e,E as t,Ft as n,H as r,ft as i,kt as a,lt as o,mt as s,xt as c}fro
|
|
|
108
108
|
@media (max-width: 980px) {
|
|
109
109
|
grid-template-columns: minmax(0, 1fr);
|
|
110
110
|
}
|
|
111
|
-
`,Ve=z(
|
|
111
|
+
`,Ve=z(l)`
|
|
112
112
|
gap: ${({theme:e})=>e.space(4)};
|
|
113
113
|
min-width: 0;
|
|
114
114
|
`,He=z.button`
|
|
@@ -132,7 +132,7 @@ import{Ct as e,E as t,Ft as n,H as r,ft as i,kt as a,lt as o,mt as s,xt as c}fro
|
|
|
132
132
|
&:last-child {
|
|
133
133
|
border-bottom: 0;
|
|
134
134
|
}
|
|
135
|
-
`,Ue=z(
|
|
135
|
+
`,Ue=z(x)`
|
|
136
136
|
font-family: ${({theme:e})=>e.font.mono};
|
|
137
137
|
font-size: 12.5px;
|
|
138
138
|
display: block;
|
|
@@ -145,4 +145,4 @@ import{Ct as e,E as t,Ft as n,H as r,ft as i,kt as a,lt as o,mt as s,xt as c}fro
|
|
|
145
145
|
height: 3px;
|
|
146
146
|
border-radius: 1px;
|
|
147
147
|
background: ${({$provider:e})=>C(e)};
|
|
148
|
-
`,$=`\0new`;function Ke(){let e=c(),[t,n]=F(null),r=e.data??[],i=t===$?null:r.find(e=>e.id===t)??null,a=t===$||t===null&&!e.isLoading&&r.length===0;te(()=>{t===null&&r.length!==0&&n(r[0]?.id??null)},[r,t]);let o=e.isLoading?`Reading configured models…`:r.length===0?`No virtual models exist yet, so no client request can resolve to an upstream.`:`${r.length} model${r.length===1?``:`s`} routing to ${r.reduce((e,t)=>e+t.targets.length,0)} targets.`;return R(I,{children:[L(T,{legend:`Models`,title:`Virtual models`,summary:o,actions:R(
|
|
148
|
+
`,$=`\0new`;function Ke(){let e=c(),[t,n]=F(null),r=e.data??[],i=t===$?null:r.find(e=>e.id===t)??null,a=t===$||t===null&&!e.isLoading&&r.length===0;te(()=>{t===null&&r.length!==0&&n(r[0]?.id??null)},[r,t]);let o=e.isLoading?`Reading configured models…`:r.length===0?`No virtual models exist yet, so no client request can resolve to an upstream.`:`${r.length} model${r.length===1?``:`s`} routing to ${r.reduce((e,t)=>e+t.targets.length,0)} targets.`;return R(I,{children:[L(T,{legend:`Models`,title:`Virtual models`,summary:o,actions:R(u,{type:`button`,$variant:`primary`,onClick:()=>n($),children:[L(E,{}),`New model`]})}),R(Be,{children:[L(y,{legend:`Configured`,meta:`${r.length}`,flush:!0,children:e.isError?L(g,{error:e.error,onRetry:()=>void e.refetch()}):e.isLoading?L(`div`,{style:{padding:12},children:L(m,{rows:4})}):r.length===0?L(v,{legend:`No models`,message:`Create a model to give clients something to ask for.`,action:L(u,{type:`button`,$size:`sm`,$variant:`primary`,onClick:()=>n($),children:`New model`})}):L(`div`,{children:r.map(e=>{let r=[...new Set(e.targets.map(e=>e.provider))];return R(He,{type:`button`,$selected:e.id===t,"aria-pressed":e.id===t,onClick:()=>n(e.id),children:[R(h,{$gap:2,style:{width:`100%`},children:[L(Ue,{title:e.id,children:e.id}),L(f,{}),e.isAlias?L(k,{children:`alias`}):null]}),R(h,{$gap:2,style:{width:`100%`},children:[L(We,{children:r.map(e=>L(Ge,{$provider:e,title:e},e))}),L(p,{children:e.strategy}),L(f,{}),R(b,{$dim:!0,$size:`11px`,children:[e.targets.length,` target`,e.targets.length===1?``:`s`]})]})]},e.id)})})}),R(Ve,{children:[i===null&&!a?L(y,{legend:`Editor`,children:e.isLoading?L(m,{rows:5}):L(v,{legend:`Nothing selected`,message:`Pick a model on the left to change its targets, or create a new one.`})}):L(ze,{model:i,onSaved:t=>{n(t),e.refetch()},onDeleted:()=>{n(null),e.refetch()}}),L(he,{modelId:i?.id??null})]})]})]})}var qe=Ke;export{qe as component};
|
package/public/assets/{_app.plugins._pluginId-jaswB8Z5.js → _app.plugins._pluginId-87Ox_hkW.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{St as e}from"./Lamp-
|
|
1
|
+
import{St as e}from"./Lamp-ZlMzNs5N.js";import{t}from"./preload-helper-4wSmu2-E.js";import{C as n,a as r,c as i,d as a,f as o,i as s,l as c,r as l,t as u}from"./Panel-CYQvfI3L.js";import{t as d}from"./Rack-D798XvPQ.js";import{t as f}from"./_app.plugins._pluginId-CZWipH1n.js";import{Component as p,Suspense as m,createContext as h,lazy as g,useContext as _,useMemo as v}from"react";import{Fragment as y,jsx as b,jsxs as x}from"react/jsx-runtime";import S from"styled-components";import{pluginApiPath as C}from"@omnigateway/dashboard-sdk";var w=new Map;function T(e){let t=w.get(e);if(t!==void 0)return t;let n={get:(t,n)=>c(C(e,t),n),post:(t,n)=>a(C(e,t),n),put:(t,n)=>o(C(e,t),n),del:t=>i(C(e,t))};return w.set(e,n),n}var E=h(e=>t(()=>import(e),[]));E.Provider;function D(){return _(E)}function O(e,t){let n=e?.default;if(n==null)throw Error(`plugin ${t} has no default export from definePluginUI`);if(typeof n.mount!=`function`)throw Error(`plugin ${t} exported a default without a mount function`);return n}function k(e,t,n){return g(async()=>{let r=O(await n(t),e);return{default:()=>r.mount({pluginId:e,api:T(e)})}})}var A=S.p`
|
|
2
2
|
font-size: 13px;
|
|
3
3
|
color: ${({theme:e})=>e.color.down};
|
|
4
4
|
`,j=S.p`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_app.plugins._pluginId-87Ox_hkW.js","assets/Lamp-ZlMzNs5N.js","assets/Panel-CYQvfI3L.js","assets/preload-helper-4wSmu2-E.js","assets/Rack-D798XvPQ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,r as t,t as n}from"./preload-helper-4wSmu2-E.js";var r=t(`/_app/plugins/$pluginId`)({component:e(()=>n(()=>import(`./_app.plugins._pluginId-87Ox_hkW.js`),__vite__mapDeps([0,1,2,3,4])),`component`)});export{r as t};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import{Ft as e,J as t,K as n,Pt as r,Y as i,jt as a,xt as o,zt as s}from"./Lamp-ZlMzNs5N.js";import{C as c,D as l,S as u,_ as d,a as f,b as p,g as m,h,i as g,o as _,t as v,v as y}from"./Panel-CYQvfI3L.js";import{t as ee}from"./Rack-D798XvPQ.js";import{t as b}from"./Toggle-CdCCoDEo.js";import{i as x,n as S,t as C}from"./Field-DK5zaBVA.js";import{t as te}from"./Meter-stpt3vQu.js";import{n as w}from"./reasons-Du1OBWAM.js";import{useEffect as ne,useId as T,useState as E}from"react";import{Fragment as D,jsx as O,jsxs as k}from"react/jsx-runtime";import A from"styled-components";var j=12,M=A.p`
|
|
2
|
+
font-size: 12px;
|
|
3
|
+
color: ${({theme:e})=>e.color.inkDim};
|
|
4
|
+
max-width: 62ch;
|
|
5
|
+
`,N=A.p`
|
|
6
|
+
font-size: 12px;
|
|
7
|
+
color: ${({theme:e})=>e.color.down};
|
|
8
|
+
`,re=A.p`
|
|
9
|
+
font-size: 12px;
|
|
10
|
+
color: ${({theme:e})=>e.color.ok};
|
|
11
|
+
`,P=A(c)`
|
|
12
|
+
max-width: 320px;
|
|
13
|
+
`,F=A(d)`
|
|
14
|
+
color: ${({theme:e})=>e.color.inkDim};
|
|
15
|
+
`;function I(){let e=i(),[t,n]=E(``),[r,a]=E(``),[o,s]=E(``),[u,d]=E(null);return k(c,{$gap:2,children:[O(F,{children:`Admin password`}),O(M,{children:`Changing this signs every session out, including this one.`}),k(P,{$gap:2,children:[O(C,{label:`Current password`,children:e=>O(S,{...e,type:`password`,autoComplete:`current-password`,value:t,onChange:e=>n(e.target.value)})}),O(C,{label:`New password`,hint:`At least ${j} characters.`,children:e=>O(S,{...e,type:`password`,autoComplete:`new-password`,value:r,onChange:e=>a(e.target.value)})}),O(C,{label:`Repeat new password`,children:e=>O(S,{...e,type:`password`,autoComplete:`new-password`,value:o,onChange:e=>s(e.target.value)})}),O(p,{$gap:2,children:O(l,{type:`button`,$variant:`primary`,onClick:()=>{if(r.length<j){d(`A password must be at least ${j} characters.`);return}if(r!==o){d(`The two new passwords do not match.`);return}d(null),e.mutate({current:t,password:r},{onSuccess:()=>w(`password-changed`),onError:e=>d(_(e))})},disabled:e.isPending||t.length===0||r.length===0,children:`Change password`})})]}),u===null?null:O(N,{role:`alert`,children:u})]})}function L(){let e=s(),t=r(),[n,i]=E(``),[a,o]=E(null),[u,d]=E(null),f=e.data?.viewerConfigured===!0;return k(c,{$gap:2,children:[O(F,{children:`Read-only password`}),k(M,{children:[`Opens a read-only console: every screen, without mutations, snapshot downloads, or request bodies.`,` `,e.isPending?`Checking whether one is set…`:f?`One is set. A new one replaces it; withdrawing ends read-only sessions at once.`:`None is set, so nobody can sign in read-only. There is no default password.`]}),k(P,{$gap:2,children:[O(C,{label:f?`Replace read-only password`:`Set read-only password`,hint:`At least ${j} characters.`,children:e=>O(S,{...e,type:`password`,autoComplete:`new-password`,value:n,onChange:e=>i(e.target.value)})}),k(p,{$gap:2,children:[O(l,{type:`button`,$variant:`primary`,onClick:()=>{if(n.length<j){o(`A password must be at least ${j} characters.`);return}o(null),t.mutate(n,{onSuccess:()=>{i(``),d(f?`Read-only password replaced.`:`Read-only access granted.`)},onError:e=>o(_(e))})},disabled:t.isPending||n.length===0,children:f?`Replace`:`Set`}),f?O(l,{type:`button`,$variant:`danger`,onClick:()=>{o(null),t.mutate(null,{onSuccess:()=>d(`Read-only access withdrawn.`),onError:e=>o(_(e))})},disabled:t.isPending,children:`Withdraw access`}):null]})]}),a===null?null:O(N,{role:`alert`,children:a}),u===null||a!==null?null:O(re,{role:`status`,children:u})]})}function R(){return O(v,{legend:`Access`,children:k(c,{$gap:3,children:[O(I,{}),O(h,{}),O(L,{})]})})}var z=[{id:`claude`,label:`Claude Code`,where:`settings.json under ~/.claude`},{id:`opencode`,label:`opencode`,where:`opencode.json in your project`}],ie=A(y)`
|
|
16
|
+
display: block;
|
|
17
|
+
white-space: pre;
|
|
18
|
+
overflow-x: auto;
|
|
19
|
+
padding: 0.75rem;
|
|
20
|
+
background: ${({theme:e})=>e.color.panelSunk};
|
|
21
|
+
border: 1px solid ${({theme:e})=>e.color.rule};
|
|
22
|
+
border-radius: 4px;
|
|
23
|
+
font-size: 0.8125rem;
|
|
24
|
+
line-height: 1.5;
|
|
25
|
+
`,ae=A.div`
|
|
26
|
+
color: ${({theme:e})=>e.color.inkDim};
|
|
27
|
+
font-size: 0.8125rem;
|
|
28
|
+
margin-bottom: 0.25rem;
|
|
29
|
+
`,B=A.p`
|
|
30
|
+
color: ${({theme:e})=>e.color.inkDim};
|
|
31
|
+
font-size: 0.8125rem;
|
|
32
|
+
margin: 0;
|
|
33
|
+
`,oe=A.div`
|
|
34
|
+
display: grid;
|
|
35
|
+
grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
|
|
36
|
+
gap: ${({theme:e})=>e.space(2)};
|
|
37
|
+
`,se=[{key:`defaultModel`,label:`Default model`,required:!0},{key:`fableModel`,label:`Fable model`,required:!1},{key:`opusModel`,label:`Opus model`,required:!1},{key:`sonnetModel`,label:`Sonnet model`,required:!1},{key:`haikuModel`,label:`Haiku model`,required:!1}];function V(){let[e,t]=E(`claude`),[r,i]=E(()=>({claude:{},opencode:{}})),a=o(),s=r[e],u=typeof s.defaultModel==`string`&&s.defaultModel!==``?s:void 0,d=n(e,u),m=z.find(t=>t.id===e);return O(v,{legend:`Agent setup`,children:k(c,{children:[O(p,{children:z.map(n=>O(l,{type:`button`,$variant:n.id===e?`primary`:`ghost`,onClick:()=>t(n.id),children:n.label},n.id))}),k(B,{children:[m?.where,`. The key is a placeholder — paste your own over it. Or run`,` `,k(y,{children:[`omni setup `,e]}),` to write these files directly.`]}),(a.data?.length??0)>0?O(oe,{children:se.map(t=>O(C,{label:t.label,children:n=>k(x,{...n,value:s[t.key]??``,onChange:n=>i(r=>({...r,[e]:{...r[e],[t.key]:n.target.value||void 0}})),children:[O(`option`,{value:``,children:t.required?`Choose a pool`:`Not mapped`}),a.data?.map(e=>O(`option`,{value:e.id,children:e.id},e.id))]})},t.key))}):null,a.isLoading?O(f,{rows:2}):d.isError?O(g,{error:d.error,onRetry:()=>void d.refetch()}):d.isLoading?O(f,{rows:4}):(a.data?.length??0)===0?O(B,{children:`No virtual models configured yet, so there is nothing to point a client at.`}):u===void 0?k(B,{children:[`Choose a default model to generate `,m?.label,` settings.`]}):d.data===void 0||d.data.length===0?O(B,{children:`No virtual models configured yet, so there is nothing to point a client at.`}):d.data.map(e=>k(`div`,{children:[O(ae,{children:e.path}),O(ie,{as:`pre`,children:e.contents.trimEnd()})]},e.path)),d.isError?O(B,{children:_(d.error)}):null]})})}var H={off:`Off`,lite:`Lite — names the lazier option`,full:`Full — the ladder enforced`,ultra:`Ultra — challenges the requirement`},U=[{id:`tier`,label:`Tier`,blurb:`Prefers a lower tier.`},{id:`health`,label:`Health`,blurb:`Penalises recent failures and an open breaker.`},{id:`quota`,label:`Quota`,blurb:`Prefers accounts ahead of their window's burn rate.`},{id:`cost`,label:`Cost`,blurb:`Prefers the cheaper candidate.`},{id:`latency`,label:`Latency`,blurb:`Prefers the faster observed first token.`},{id:`load`,label:`Load`,blurb:`Prefers accounts with fewer requests in flight.`}],W=[{id:`maxAttempts`,label:`Attempts per request`,hint:`Candidates dispatch may try. 1 disables failover.`,unit:`attempts`,step:1,min:1},{id:`requestDeadlineMs`,label:`Request deadline`,hint:`Across all attempts. 0 disables only OmniGateway's deadline.`,unit:`ms`,step:1e3,min:0},{id:`breakerThreshold`,label:`Breaker threshold`,hint:`Consecutive failures before an account and model leaves rotation.`,unit:`failures`,step:1,min:1},{id:`breakerCooldownMs`,label:`Breaker cooldown`,hint:`Wait before a tripped account is probed. Doubles per extra failure.`,unit:`ms`,step:1e3,min:1},{id:`logRetentionDays`,label:`Log retention`,hint:`How long request rows are kept before pruning.`,unit:`days`,step:1,min:1},{id:`quotaPollIntervalMs`,label:`Quota poll interval`,hint:`How often a provider is asked for remaining quota. 0 disables. Needs a restart.`,unit:`ms`,step:6e4,min:0}],G=A.div`
|
|
38
|
+
display: grid;
|
|
39
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
40
|
+
gap: ${({theme:e})=>e.space(3)};
|
|
41
|
+
`,K=A(c)`
|
|
42
|
+
gap: 6px;
|
|
43
|
+
`,q=A.p`
|
|
44
|
+
font-size: 11px;
|
|
45
|
+
color: ${({theme:e})=>e.color.inkDim};
|
|
46
|
+
`,J=A.div`
|
|
47
|
+
display: grid;
|
|
48
|
+
grid-template-columns: 1fr;
|
|
49
|
+
gap: ${({theme:e})=>e.space(2)};
|
|
50
|
+
align-items: start;
|
|
51
|
+
`,Y=A.div`
|
|
52
|
+
display: grid;
|
|
53
|
+
grid-template-columns: auto 1fr;
|
|
54
|
+
column-gap: ${({theme:e})=>e.space(2)};
|
|
55
|
+
row-gap: 4px;
|
|
56
|
+
align-items: center;
|
|
57
|
+
padding: ${({theme:e})=>e.space(2)};
|
|
58
|
+
background: ${({theme:e})=>e.color.panelSunk};
|
|
59
|
+
border: 1px solid ${({theme:e})=>e.color.rule};
|
|
60
|
+
border-radius: 3px;
|
|
61
|
+
`,X=A(q)`
|
|
62
|
+
grid-column: 2;
|
|
63
|
+
`,Z=A.label`
|
|
64
|
+
font-size: 12px;
|
|
65
|
+
font-weight: 600;
|
|
66
|
+
color: ${({theme:e})=>e.color.ink};
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
`,ce=A(Y)`
|
|
69
|
+
grid-template-columns: 1fr;
|
|
70
|
+
|
|
71
|
+
${X} {
|
|
72
|
+
grid-column: 1;
|
|
73
|
+
}
|
|
74
|
+
`;function le({label:e,children:t,blurb:n}){let r=T();return k(ce,{children:[O(Z,{htmlFor:r,children:e}),t({id:r}),O(X,{children:n})]})}function Q({label:e,checked:t,disabled:n,onCheckedChange:r,children:i}){let a=T();return k(Y,{children:[O(b,{id:a,checked:t,onCheckedChange:r,label:e,...n===void 0?{}:{disabled:n}}),O(Z,{htmlFor:a,children:e}),O(X,{children:i})]})}var $=A.p`
|
|
75
|
+
font-size: 12px;
|
|
76
|
+
color: ${({theme:e})=>e.color.down};
|
|
77
|
+
`,ue=A.p`
|
|
78
|
+
font-size: 12px;
|
|
79
|
+
color: ${({theme:e})=>e.color.ok};
|
|
80
|
+
`,de=A.p`
|
|
81
|
+
font-size: 12px;
|
|
82
|
+
color: ${({theme:e})=>e.color.warn};
|
|
83
|
+
max-width: 72ch;
|
|
84
|
+
|
|
85
|
+
code {
|
|
86
|
+
font-family: ${({theme:e})=>e.font.mono};
|
|
87
|
+
}
|
|
88
|
+
`;function fe(e){let t={};for(let n of U)t[`w.${n.id}`]=String(e.weights[n.id]);for(let n of W)t[n.id]=String(e[n.id]);return t.rtkEnabled=String(e.rtkEnabled),t.autoCacheEnabled=String(e.autoCacheEnabled),t.ponytailMode=e.ponytailMode,t.bodyLoggingEnabled=String(e.bodyLoggingEnabled),t.bodyLoggingCaptureStreamChunks=String(e.bodyLoggingCaptureStreamChunks),t}function pe(e){let t={};for(let n of U){let r=(e[`w.${n.id}`]??``).trim(),i=Number(r);if(r.length===0||!Number.isFinite(i))return{ok:!1,problem:`${n.label} must be a number.`};t[n.id]=i}let n={};for(let t of W){let r=(e[t.id]??``).trim(),i=Number(r);if(r.length===0||!Number.isInteger(i)||i<t.min)return{ok:!1,problem:`${t.label} must be a whole number of ${t.min} or more.`};n[t.id]=i}return n.maxAttempts>10?{ok:!1,problem:`Attempts per request cannot exceed 10.`}:{ok:!0,settings:{weights:t,...n,rtkEnabled:e.rtkEnabled===`true`,autoCacheEnabled:e.autoCacheEnabled===`true`,ponytailMode:e.ponytailMode!==void 0&&Object.hasOwn(H,e.ponytailMode)?e.ponytailMode:`off`,bodyLoggingEnabled:e.bodyLoggingEnabled===`true`,bodyLoggingCaptureStreamChunks:e.bodyLoggingCaptureStreamChunks===`true`}}}function me(){let n=e(),r=t(),i=a(),[o,s]=E({}),[h,b]=E(null),[w,T]=E(!1);ne(()=>{n.data!==void 0&&s(fe(n.data))},[n.data]);let A=Math.max(1e-4,...U.map(e=>Math.abs(Number(o[`w.${e.id}`])||0)));return k(D,{children:[O(ee,{legend:`Settings`,title:`Routing and retention`,summary:`Applied to every request the gateway routes. Changes take effect on the next request; nothing restarts.`,actions:O(l,{type:`button`,$variant:`primary`,disabled:i.isPending||n.isLoading,onClick:()=>{T(!1);let e=pe(o);if(!e.ok){b(e.problem);return}b(null),i.mutate(e.settings,{onSuccess:()=>T(!0),onError:e=>b(_(e))})},children:i.isPending?`Saving…`:`Save changes`})}),n.isError?O(v,{legend:`Settings`,children:O(g,{error:n.error,onRetry:()=>void n.refetch()})}):n.isLoading?O(v,{legend:`Settings`,children:O(f,{rows:6})}):k(c,{$gap:4,children:[O(v,{legend:`Scoring weights`,meta:`relative to each other`,footer:k(p,{children:[O(d,{children:`Score is the sum of each term times its weight, then multiplied by the account and target weights.`}),O(u,{})]}),children:O(G,{children:U.map(e=>{let t=Number(o[`w.${e.id}`])||0;return k(K,{children:[O(C,{label:e.label,children:t=>O(S,{...t,type:`number`,step:.5,value:o[`w.${e.id}`]??``,onChange:t=>s({...o,[`w.${e.id}`]:t.target.value})})}),O(te,{fraction:Math.abs(t)/A,height:4,tone:`var(--accent)`,label:`${e.label} weight ${t}`}),O(q,{children:e.blurb})]},e.id)})})}),O(v,{legend:`Limits`,children:O(G,{children:W.map(e=>O(K,{children:O(C,{label:e.label,hint:e.hint,children:t=>k(p,{$gap:2,children:[O(S,{...t,type:`number`,min:e.min,step:e.step,value:o[e.id]??``,onChange:t=>s({...o,[e.id]:t.target.value})}),O(d,{children:e.unit})]})})},e.id))})}),k(m,{$min:`380px`,$stretch:!0,children:[O(v,{legend:`Request handling`,meta:`applied before dispatch`,children:k(J,{children:[O(Q,{label:`Enable RTK compression`,checked:o.rtkEnabled===`true`,onCheckedChange:e=>s({...o,rtkEnabled:String(e)}),children:`Compresses recognized historical tool results. Confirmed non-shell tools are excluded; unknown-origin results may be compressed only when a detector recognizes shell output. Lossy.`}),O(Q,{label:`Add a cache breakpoint when a client sends none`,checked:o.autoCacheEnabled===`true`,onCheckedChange:e=>s({...o,autoCacheEnabled:String(e)}),children:`Marks the end of the system prompt on Anthropic requests carrying no breakpoint of their own. Requests that mark one are untouched.`}),O(le,{label:`Lazy senior dev mode`,blurb:`Appends the ponytail ruleset, about 1,240 tokens, to every system prompt. A request already carrying it is left alone.`,children:e=>O(x,{...e,value:o.ponytailMode??`off`,onChange:e=>s({...o,ponytailMode:e.target.value}),children:Object.entries(H).map(([e,t])=>O(`option`,{value:e,children:t},e))})})]})}),O(v,{legend:`Request and response bodies`,meta:r.data===!0?`permitted by the environment`:`not permitted`,children:k(c,{$gap:2,children:[r.data===!0?null:k(de,{children:[`This gateway started without `,O(`code`,{children:`OMNI_BODY_LOGGING_ALLOWED`}),`, so nothing below can record anything. Set it in the installation's `,O(`code`,{children:`.env`}),` and restart first.`]}),k(J,{children:[O(Q,{label:`Capture request and response bodies`,checked:o.bodyLoggingEnabled===`true`,disabled:r.data!==!0,onCheckedChange:e=>s({...o,bodyLoggingEnabled:String(e)}),children:`Stores what each client sent and each provider returned, encrypted beside the database. Tokens and keys are masked; headers are never captured. Expires on the log retention window above.`}),O(Q,{label:`Also keep raw stream frames`,checked:o.bodyLoggingCaptureStreamChunks===`true`,disabled:r.data!==!0||o.bodyLoggingEnabled!==`true`,onCheckedChange:e=>s({...o,bodyLoggingCaptureStreamChunks:String(e)}),children:`Also keeps the raw SSE frames of each attempt. The most expensive thing capture stores.`})]})]})})]}),h===null?null:O($,{role:`alert`,children:h}),w&&h===null?O(ue,{role:`status`,children:`Settings saved.`}):null,k(m,{$min:`380px`,$stretch:!0,children:[O(V,{}),O(R,{})]}),O(v,{legend:`Known limits`,children:k(c,{$gap:2,children:[k(p,{$gap:2,$align:`start`,children:[O(y,{$dim:!0,children:`rate limits`}),O(q,{children:`Counted per gateway process and reset when it restarts. Not shared across instances.`})]}),k(p,{$gap:2,$align:`start`,children:[O(y,{$dim:!0,children:`logs`}),O(q,{children:`Request rows record routing and token counts only. Prompts and responses only when body capture is on, to a separate encrypted store. Credentials to neither.`})]})]})})]})]})}var he=me;export{he as component};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e,A as t,At as n,B as r,C as i,Ct as a,D as o,Dt as s,E as c,Et as l,F as u,G as d,H as f,I as p,J as m,K as h,L as g,M as _,N as v,O as y,Ot as b,P as x,Q as S,R as C,S as w,St as T,T as E,Tt as D,U as ee,V as O,W as te,X as ne,Y as re,Z as ie,_ as ae,_t as oe,a as k,at as se,b as ce,bt as le,c as ue,ct as de,d as fe,dt as pe,et as me,f as he,ft as ge,g as _e,gt as ve,h as ye,ht as be,i as xe,it as Se,j as Ce,k as we,kt as Te,l as A,lt as Ee,m as De,mt as Oe,n as ke,nt as Ae,o as je,ot as Me,p as Ne,pt as Pe,q as Fe,r as Ie,rt as Le,s as j,st as Re,t as ze,tt as Be,u as M,ut as Ve,v as N,vt as P,w as He,wt as Ue,x as We,xt as Ge,y as F,yt as Ke,z as qe}from"./shared-dShKzjig.js";import{A as I,Ct as Je,H as Ye,I as L,N as Xe,P as Ze,Vt as R,gt as Qe,lt as $e,xt as et}from"./Lamp-DN2EKL4m.js";import{C as tt,S as z,_ as B,b as nt,g as rt,h as it,t as at,y as V}from"./Panel-BCpZVY4U.js";import{_ as ot,f as st,m as ct,t as lt}from"./Rack-B03tpeW-.js";import{i as ut,n as H,r as U,t as dt}from"./Table-CVDZ69Zx.js";import{i as W,n as ft,r as pt,t as mt}from"./SummaryDeck-CzozuXOu.js";import*as G from"react";import{PureComponent as ht,forwardRef as gt,useMemo as K,useRef as _t,useState as q}from"react";import{jsx as J,jsxs as Y}from"react/jsx-runtime";import X from"styled-components";function vt(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.xAxisId??0}function yt(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.yAxisId??0}var bt=(e,t,n)=>ne(e,`xAxis`,vt(e,t),n),xt=(e,t,n)=>S(e,`xAxis`,vt(e,t),n),St=(e,t,n)=>ne(e,`yAxis`,yt(e,t),n),Ct=(e,t,n)=>S(e,`yAxis`,yt(e,t),n),wt=P([Me,bt,St,xt,Ct],(e,t,n,r,i)=>ve(e,`xAxis`)?pe(t,r,!1):pe(n,i,!1)),Tt=P([e,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`area`).find(e=>e.id===t)),Et=e=>{var t=Me(e);return ve(t,`xAxis`)?`yAxis`:`xAxis`},Dt=(e,t)=>Et(e)===`yAxis`?yt(e,t):vt(e,t),Ot=(e,t,n)=>ie(e,Et(e),Dt(e,t),n),kt=P([Tt,Ot],(e,t)=>{if(e!=null&&t!=null){var n=e.stackId,r=me(e);if(n!=null&&r!=null){var i=(t[n]?.stackedData)?.find(e=>e.key===r);if(i!=null)return i.map(e=>[e[0],e[1]])}}}),At=P([Tt,Ot],(e,t)=>{if(e!=null&&e.stackId!=null&&t!=null){var n=t[e.stackId];if(n!=null)return n.graphicalItems.map(e=>e.dataKey).filter(a)}}),jt=P([Me,bt,St,xt,Ct,kt,Le,wt,Tt,Ae,At],(e,t,n,r,i,a,o,s,c,l,u)=>{var d=o.chartData,f=o.dataStartIndex,p=o.dataEndIndex;if(!(c==null||e!==`horizontal`&&e!==`vertical`||t==null||n==null||r==null||i==null||r.length===0||i.length===0||s==null)){var m=c.data,h=m&&m.length>0?m:d?.slice(f,p+1);if(h!=null)return un({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:a,displayedData:h,chartBaseValue:l,bandSize:s,stackDataKeys:u})}}),Mt=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`layout`,`isRange`,`stroke`,`connectNulls`],Nt=[`id`,`baseLine`];function Pt(){return Pt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Pt.apply(null,arguments)}function Ft(e,t){if(e==null)return{};var n,r,i=It(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function It(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Lt(e){var t=e.alpha,n=e.baseLine,r=e.points,i=e.strokeWidth,a=r[0]?.x,o=r[r.length-1]?.x;if(!oe(a)||!oe(o))return null;var s=t*Math.abs(a-o),c=Math.max(...r.map(e=>e.y||0));return D(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(e=>e.y||0),c)),D(c)?G.createElement(`rect`,{x:a<o?a:a-s,y:0,width:s,height:Math.floor(c+(i?parseInt(`${i}`,10):1))}):null}function Rt(e){var t=e.alpha,n=e.baseLine,r=e.points,i=e.strokeWidth,a=r[0]?.y,o=r[r.length-1]?.y;if(!oe(a)||!oe(o))return null;var s=t*Math.abs(a-o),c=Math.max(...r.map(e=>e.x||0));return D(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(e=>e.x||0),c)),D(c)?G.createElement(`rect`,{x:0,y:a<o?a:a-s,width:c+(i?parseInt(`${i}`,10):1),height:Math.floor(s)}):null}function zt(e){var t=e.alpha,n=e.layout,r=e.points,i=e.baseLine,a=e.strokeWidth;return n===`vertical`?G.createElement(Rt,{alpha:t,points:r,baseLine:i,strokeWidth:a}):G.createElement(Lt,{alpha:t,points:r,baseLine:i,strokeWidth:a})}function Bt(e){var t=e.animationElapsedTime,n=t===void 0?1:t,r=e.isAnimating,i=r!==void 0&&r,a=e.isEntrance,o=a!==void 0&&a,c=e.layout,l=e.isRange,u=e.stroke,d=e.connectNulls,f=Ft(e,Mt),p=c===`vertical`?`vertical`:`horizontal`,m=d??!1,h=x(),g=f.id,_=f.baseLine,v=Ft(f,Nt),y=Te(v),b=G.createElement(Se,Pt({},f,{id:g,baseLine:_,connectNulls:m,stroke:`none`,className:`recharts-area-area`,layout:p})),S=u!==`none`&&G.createElement(Se,Pt({},y,{className:`recharts-area-curve`,layout:p,type:f.type,connectNulls:m,fill:`none`,stroke:u,points:f.points})),C=u!==`none`&&l&&Array.isArray(_)&&G.createElement(Se,Pt({},y,{className:`recharts-area-curve`,layout:p,type:f.type,connectNulls:m,fill:`none`,stroke:u,points:_}));return o&&(i||n<1)?G.createElement(s,null,G.createElement(`defs`,null,G.createElement(`clipPath`,{id:h},G.createElement(zt,{alpha:n,points:f.points??[],baseLine:_,layout:p,strokeWidth:f.strokeWidth}))),G.createElement(s,{clipPath:`url(#${h})`},b,S,C)):G.createElement(G.Fragment,null,b,S,C)}var Vt=[`id`],Ht=[`activeDot`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`fill`,`fillOpacity`,`hide`,`isAnimationActive`,`legendType`,`stroke`,`xAxisId`,`yAxisId`];function Ut(){return Ut=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ut.apply(null,arguments)}function Wt(e,t){if(e==null)return{};var n,r,i=Gt(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Gt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Kt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Z(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Kt(Object(n),!0).forEach(function(t){qt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function qt(e,t,n){return(t=Jt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jt(e){var t=Yt(e,`string`);return typeof t==`symbol`?t:t+``}function Yt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Xt={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,animationMatchBy:qe,animationInterpolateFn:(e,t)=>e==null?[]:t===1?e.flatMap(e=>e.status===`removed`?[]:[e.next]):e.flatMap(e=>e.status===`matched`?[Z(Z({},e.next),{},{x:Ge(e.prev.x,e.next.x,t),y:Ge(e.prev.y,e.next.y,t)})]:e.status===`added`?[e.next]:[]),connectNulls:!1,dot:!1,fill:`#3182bd`,fillOpacity:.6,hide:!1,isAnimationActive:`auto`,legendType:`line`,stroke:`#3182bd`,strokeWidth:1,type:`linear`,label:!1,shape:Bt,xAxisId:0,yAxisId:0,zIndex:Be.area};function Zt(e,t){return e&&e!==`none`?e:t}var Qt=e=>{var t=e.dataKey,n=e.name,r=e.stroke,i=e.fill,a=e.legendType;return[{inactive:e.hide,dataKey:t,type:a,color:Zt(r,i),value:Oe(n,t),payload:e}]},$t=G.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,o=e.name,s=e.hide,c=e.unit,u=e.formatter,d=e.tooltipType,f=e.id,p={dataDefinedOnItem:n,getPosition:l,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:Oe(o,t),hide:s,type:d,color:Zt(r,a),unit:c,formatter:u,graphicalItemId:f}};return G.createElement(O,{tooltipEntrySettings:p})});function en(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.needClip,a=r.dot,o=r.dataKey,s=Te(r);return G.createElement(Ce,{points:n,dot:a,className:`recharts-area-dots`,dotClassName:`recharts-area-dot`,dataKey:o,baseProps:s,needClip:i,clipPathId:t})}function tn(e){var t=e.showLabels,n=e.children,r=e.points.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return Z(Z({},t),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:t,fill:void 0})});return G.createElement(te,{value:t?r:void 0},n)}function nn(e){var t=e.points,n=e.baseLine,r=e.needClip,i=e.clipPathId,a=e.props,o=e.animationElapsedTime,c=e.isAnimating,l=e.isEntrance,u=a.layout,d=a.type,p=a.stroke,m=a.connectNulls,h=a.isRange,g=a.shape,_=a.id,v=Wt(a,Vt),y=Z(Z({},b(v)),{},{id:_,points:t,connectNulls:m,type:d,baseLine:n,layout:u,stroke:p,isRange:h,animationElapsedTime:o,isAnimating:c,isEntrance:l});return G.createElement(G.Fragment,null,t?.length>1&&G.createElement(s,{clipPath:r?`url(#clipPath-${i})`:void 0},G.createElement(f,{option:g,DefaultShape:Xt.shape,shapeProps:y})),G.createElement(en,{points:t,props:v,clipPathId:i}))}function rn(e,t,n){if(D(e)){var r=D(t)?t:void 0;return Ge(r,e,n)}if(Ue(e)||T(e)){var i=D(t)?t:void 0;return Ge(i,0,n)}return e}function an(e){var t=e.needClip,n=e.clipPathId,r=e.props,i=e.previousPointsRef,a=e.previousBaselineRef,o=r.points,s=r.baseLine,c=r.isAnimationActive,l=r.animationBegin,f=r.animationDuration,m=r.animationEasing,h=r.animationMatchBy,_=r.animationInterpolateFn,v=K(()=>({points:o,baseLine:s}),[o,s]),y=g(v,a),b=Re(),x=p(r.onAnimationStart,r.onAnimationEnd),S=x.isAnimating,w=x.handleAnimationStart,T=x.handleAnimationEnd,E=y.startValue;if(b==null)return null;var D=Array.isArray(s)&&Array.isArray(E)?C(E,s,h):Array.isArray(s)?C(null,s,h):null;return G.createElement(u,{animationInput:v,animationIdPrefix:`recharts-area-`,items:o,previousItemsRef:i,isAnimationActive:c,animationBegin:l,animationDuration:f,animationEasing:m,onAnimationStart:w,onAnimationEnd:T,animationInterpolateFn:_,animationMatchBy:h,layout:b},(e,i,a)=>{var c=i===1?s:Array.isArray(s)?_(D,i,b):a?s:rn(s,E,i);return y.syncStepValue(c,i),G.createElement(tn,{showLabels:!S,points:o},r.children,G.createElement(nn,{points:e,baseLine:c,needClip:t,clipPathId:n,props:r,animationElapsedTime:i,isAnimating:S||i<1,isEntrance:a}),G.createElement(d,{label:r.label}))})}function on(e){var t=e.needClip,n=e.clipPathId,r=e.props,i=_t(null),a=_t();return G.createElement(an,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}var sn=class extends ht{render(){var e=this.props,t=e.hide,r=e.dot,i=e.points,a=e.className,o=e.top,l=e.left,u=e.needClip,d=e.xAxisId,f=e.yAxisId,p=e.width,h=e.height,g=e.id,_=e.baseLine,v=e.zIndex;if(t)return null;var y=n(`recharts-area`,a),b=g,x=E(r),S=x.r,C=x.strokeWidth,w=ee(r),T=S*2+C,D=u?`url(#clipPath-${w?``:`dots-`}${b})`:void 0;return G.createElement(m,{zIndex:v},G.createElement(s,{className:y},u&&G.createElement(`defs`,null,G.createElement(c,{clipPathId:b,xAxisId:d,yAxisId:f}),!w&&G.createElement(`clipPath`,{id:`clipPath-dots-${b}`},G.createElement(`rect`,{x:l-T/2,y:o-T/2,width:p+T,height:h+T}))),G.createElement(on,{needClip:u,clipPathId:b,props:this.props})),G.createElement(we,{points:i,mainColor:Zt(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:D}),this.props.isRange&&Array.isArray(_)&&G.createElement(we,{points:_,mainColor:Zt(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:D}))}};function cn(e){var n=e.activeDot,r=e.animationBegin,i=e.animationDuration,a=e.animationEasing,s=e.connectNulls,c=e.dot,l=e.fill,u=e.fillOpacity,d=e.hide,f=e.isAnimationActive,p=e.legendType,m=e.stroke,h=e.xAxisId,g=e.yAxisId,_=Wt(e,Ht),v=de(),y=re(),b=o(h,g).needClip,x=Ve(),S=Ke(t=>jt(t,e.id,x))??{},C=S.points,w=S.isRange,T=S.baseLine,E=t();if(v!==`horizontal`&&v!==`vertical`||E==null||y!==`AreaChart`&&y!==`ComposedChart`)return null;var D=E.height,ee=E.width,O=E.x,te=E.y;return!C||!C.length?null:G.createElement(sn,Ut({},_,{activeDot:n,animationBegin:r,animationDuration:i,animationEasing:a,baseLine:T,connectNulls:s,dot:c,fill:l,fillOpacity:u,height:D,hide:d,layout:v,isAnimationActive:f,isRange:w,legendType:p,needClip:b,points:C,stroke:m,width:ee,left:O,top:te,xAxisId:h,yAxisId:g}))}var ln=(e,t,n,r,i)=>{var a=n??t;if(D(a))return a;var o=e===`horizontal`?i:r,s=o.scale.domain();if(o.type===`number`){var c=Math.max(s[0],s[1]),l=Math.min(s[0],s[1]);return a===`dataMin`?l:a===`dataMax`||c<0?c:Math.max(Math.min(s[0],s[1]),0)}return a===`dataMin`?s[0]:a===`dataMax`?s[1]:s[0]};function un(e){var t=e.areaSettings,n=t.connectNulls,r=t.baseValue,i=t.dataKey,a=e.stackedData,o=e.layout,s=e.chartBaseValue,c=e.xAxis,l=e.yAxis,u=e.displayedData,d=e.dataStartIndex,f=e.xAxisTicks,p=e.yAxisTicks,m=e.bandSize,h=e.stackDataKeys,g=a&&a.length,_=ln(o,s,r,c,l),v=o===`horizontal`,y=!1,b=u.map((e,t)=>{var r;if(g)r=a[d+t];else{var o=be(e,i);Array.isArray(o)?(r=o,y=!0):r=[_,o]}var s=r?.[1]??null,u=be(e,i),b=g&&u==null&&h!=null&&h.length>0&&h.every(t=>be(e,t)==null),x=s==null||g&&!n&&u==null||b;return v?{x:ge({axis:c,ticks:f,bandSize:m,entry:e,index:t}),y:x?null:l.scale.map(s)??null,value:r,payload:e}:{x:x?null:c.scale.map(s)??null,y:ge({axis:l,ticks:p,bandSize:m,entry:e,index:t}),value:r,payload:e}});return{points:b,baseLine:(g||y?b.map(e=>{var t=Array.isArray(e.value)?e.value[0]:null;return v?{x:e.x,y:t!=null&&e.y!=null?l.scale.map(t)??null:null,payload:e.payload}:{x:t==null?null:c.scale.map(t)??null,y:e.y,payload:e.payload}}):v?l.scale.map(_):c.scale.map(_))??0,isRange:y}}function dn(e){var t=le(e,Xt),n=Ve();return G.createElement(v,{id:t.id,type:`area`},e=>G.createElement(G.Fragment,null,G.createElement(r,{legendPayload:Qt(t)}),G.createElement($t,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),G.createElement(_,{type:`area`,id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:Pe(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),G.createElement(cn,Ut({},t,{id:e}))))}var fn=G.memo(dn,se);fn.displayName=`Area`;var pn=[`axis`],mn=gt((e,t)=>G.createElement(We,{chartName:`AreaChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:pn,tooltipPayloadSearcher:Fe,categoricalChartProps:e,ref:t})),hn=[`axis`],gn=gt((e,t)=>G.createElement(We,{chartName:`ComposedChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:hn,tooltipPayloadSearcher:Fe,categoricalChartProps:e,ref:t})),_n=53,Q=9,$=2,vn=X.div`
|
|
1
|
+
import{$ as e,A as t,At as n,B as r,C as i,Ct as a,D as o,Dt as s,E as c,Et as l,F as u,G as d,H as f,I as p,J as m,K as h,L as g,M as _,N as v,O as y,Ot as b,P as x,Q as S,R as C,S as w,St as T,T as E,Tt as D,U as ee,V as O,W as te,X as ne,Y as re,Z as ie,_ as ae,_t as oe,a as k,at as se,b as ce,bt as le,c as ue,ct as de,d as fe,dt as pe,et as me,f as he,ft as ge,g as _e,gt as ve,h as ye,ht as be,i as xe,it as Se,j as Ce,k as we,kt as Te,l as A,lt as Ee,m as De,mt as Oe,n as ke,nt as Ae,o as je,ot as Me,p as Ne,pt as Pe,q as Fe,r as Ie,rt as Le,s as j,st as Re,t as ze,tt as Be,u as M,ut as Ve,v as N,vt as P,w as He,wt as Ue,x as We,xt as Ge,y as F,yt as Ke,z as qe}from"./shared-OJcoRCqT.js";import{A as I,Ct as Je,H as Ye,I as L,N as Xe,P as Ze,Vt as R,gt as Qe,lt as $e,xt as et}from"./Lamp-ZlMzNs5N.js";import{C as z,_ as tt,b as B,g as nt,t as rt,v as V,w as it,x as at}from"./Panel-CYQvfI3L.js";import{_ as ot,f as st,m as ct,t as lt}from"./Rack-D798XvPQ.js";import{i as ut,n as H,r as U,t as dt}from"./Table-CVDZ69Zx.js";import{i as W,n as ft,r as pt,t as mt}from"./SummaryDeck-DBCSHihY.js";import*as G from"react";import{PureComponent as ht,forwardRef as gt,useMemo as K,useRef as _t,useState as q}from"react";import{jsx as J,jsxs as Y}from"react/jsx-runtime";import X from"styled-components";function vt(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.xAxisId??0}function yt(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.yAxisId??0}var bt=(e,t,n)=>ne(e,`xAxis`,vt(e,t),n),xt=(e,t,n)=>S(e,`xAxis`,vt(e,t),n),St=(e,t,n)=>ne(e,`yAxis`,yt(e,t),n),Ct=(e,t,n)=>S(e,`yAxis`,yt(e,t),n),wt=P([Me,bt,St,xt,Ct],(e,t,n,r,i)=>ve(e,`xAxis`)?pe(t,r,!1):pe(n,i,!1)),Tt=P([e,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`area`).find(e=>e.id===t)),Et=e=>{var t=Me(e);return ve(t,`xAxis`)?`yAxis`:`xAxis`},Dt=(e,t)=>Et(e)===`yAxis`?yt(e,t):vt(e,t),Ot=(e,t,n)=>ie(e,Et(e),Dt(e,t),n),kt=P([Tt,Ot],(e,t)=>{if(e!=null&&t!=null){var n=e.stackId,r=me(e);if(n!=null&&r!=null){var i=(t[n]?.stackedData)?.find(e=>e.key===r);if(i!=null)return i.map(e=>[e[0],e[1]])}}}),At=P([Tt,Ot],(e,t)=>{if(e!=null&&e.stackId!=null&&t!=null){var n=t[e.stackId];if(n!=null)return n.graphicalItems.map(e=>e.dataKey).filter(a)}}),jt=P([Me,bt,St,xt,Ct,kt,Le,wt,Tt,Ae,At],(e,t,n,r,i,a,o,s,c,l,u)=>{var d=o.chartData,f=o.dataStartIndex,p=o.dataEndIndex;if(!(c==null||e!==`horizontal`&&e!==`vertical`||t==null||n==null||r==null||i==null||r.length===0||i.length===0||s==null)){var m=c.data,h=m&&m.length>0?m:d?.slice(f,p+1);if(h!=null)return un({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:a,displayedData:h,chartBaseValue:l,bandSize:s,stackDataKeys:u})}}),Mt=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`layout`,`isRange`,`stroke`,`connectNulls`],Nt=[`id`,`baseLine`];function Pt(){return Pt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Pt.apply(null,arguments)}function Ft(e,t){if(e==null)return{};var n,r,i=It(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function It(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Lt(e){var t=e.alpha,n=e.baseLine,r=e.points,i=e.strokeWidth,a=r[0]?.x,o=r[r.length-1]?.x;if(!oe(a)||!oe(o))return null;var s=t*Math.abs(a-o),c=Math.max(...r.map(e=>e.y||0));return D(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(e=>e.y||0),c)),D(c)?G.createElement(`rect`,{x:a<o?a:a-s,y:0,width:s,height:Math.floor(c+(i?parseInt(`${i}`,10):1))}):null}function Rt(e){var t=e.alpha,n=e.baseLine,r=e.points,i=e.strokeWidth,a=r[0]?.y,o=r[r.length-1]?.y;if(!oe(a)||!oe(o))return null;var s=t*Math.abs(a-o),c=Math.max(...r.map(e=>e.x||0));return D(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(e=>e.x||0),c)),D(c)?G.createElement(`rect`,{x:0,y:a<o?a:a-s,width:c+(i?parseInt(`${i}`,10):1),height:Math.floor(s)}):null}function zt(e){var t=e.alpha,n=e.layout,r=e.points,i=e.baseLine,a=e.strokeWidth;return n===`vertical`?G.createElement(Rt,{alpha:t,points:r,baseLine:i,strokeWidth:a}):G.createElement(Lt,{alpha:t,points:r,baseLine:i,strokeWidth:a})}function Bt(e){var t=e.animationElapsedTime,n=t===void 0?1:t,r=e.isAnimating,i=r!==void 0&&r,a=e.isEntrance,o=a!==void 0&&a,c=e.layout,l=e.isRange,u=e.stroke,d=e.connectNulls,f=Ft(e,Mt),p=c===`vertical`?`vertical`:`horizontal`,m=d??!1,h=x(),g=f.id,_=f.baseLine,v=Ft(f,Nt),y=Te(v),b=G.createElement(Se,Pt({},f,{id:g,baseLine:_,connectNulls:m,stroke:`none`,className:`recharts-area-area`,layout:p})),S=u!==`none`&&G.createElement(Se,Pt({},y,{className:`recharts-area-curve`,layout:p,type:f.type,connectNulls:m,fill:`none`,stroke:u,points:f.points})),C=u!==`none`&&l&&Array.isArray(_)&&G.createElement(Se,Pt({},y,{className:`recharts-area-curve`,layout:p,type:f.type,connectNulls:m,fill:`none`,stroke:u,points:_}));return o&&(i||n<1)?G.createElement(s,null,G.createElement(`defs`,null,G.createElement(`clipPath`,{id:h},G.createElement(zt,{alpha:n,points:f.points??[],baseLine:_,layout:p,strokeWidth:f.strokeWidth}))),G.createElement(s,{clipPath:`url(#${h})`},b,S,C)):G.createElement(G.Fragment,null,b,S,C)}var Vt=[`id`],Ht=[`activeDot`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`fill`,`fillOpacity`,`hide`,`isAnimationActive`,`legendType`,`stroke`,`xAxisId`,`yAxisId`];function Ut(){return Ut=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ut.apply(null,arguments)}function Wt(e,t){if(e==null)return{};var n,r,i=Gt(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Gt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Kt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Z(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Kt(Object(n),!0).forEach(function(t){qt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function qt(e,t,n){return(t=Jt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jt(e){var t=Yt(e,`string`);return typeof t==`symbol`?t:t+``}function Yt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Xt={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,animationMatchBy:qe,animationInterpolateFn:(e,t)=>e==null?[]:t===1?e.flatMap(e=>e.status===`removed`?[]:[e.next]):e.flatMap(e=>e.status===`matched`?[Z(Z({},e.next),{},{x:Ge(e.prev.x,e.next.x,t),y:Ge(e.prev.y,e.next.y,t)})]:e.status===`added`?[e.next]:[]),connectNulls:!1,dot:!1,fill:`#3182bd`,fillOpacity:.6,hide:!1,isAnimationActive:`auto`,legendType:`line`,stroke:`#3182bd`,strokeWidth:1,type:`linear`,label:!1,shape:Bt,xAxisId:0,yAxisId:0,zIndex:Be.area};function Zt(e,t){return e&&e!==`none`?e:t}var Qt=e=>{var t=e.dataKey,n=e.name,r=e.stroke,i=e.fill,a=e.legendType;return[{inactive:e.hide,dataKey:t,type:a,color:Zt(r,i),value:Oe(n,t),payload:e}]},$t=G.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,o=e.name,s=e.hide,c=e.unit,u=e.formatter,d=e.tooltipType,f=e.id,p={dataDefinedOnItem:n,getPosition:l,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:Oe(o,t),hide:s,type:d,color:Zt(r,a),unit:c,formatter:u,graphicalItemId:f}};return G.createElement(O,{tooltipEntrySettings:p})});function en(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.needClip,a=r.dot,o=r.dataKey,s=Te(r);return G.createElement(Ce,{points:n,dot:a,className:`recharts-area-dots`,dotClassName:`recharts-area-dot`,dataKey:o,baseProps:s,needClip:i,clipPathId:t})}function tn(e){var t=e.showLabels,n=e.children,r=e.points.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return Z(Z({},t),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:t,fill:void 0})});return G.createElement(te,{value:t?r:void 0},n)}function nn(e){var t=e.points,n=e.baseLine,r=e.needClip,i=e.clipPathId,a=e.props,o=e.animationElapsedTime,c=e.isAnimating,l=e.isEntrance,u=a.layout,d=a.type,p=a.stroke,m=a.connectNulls,h=a.isRange,g=a.shape,_=a.id,v=Wt(a,Vt),y=Z(Z({},b(v)),{},{id:_,points:t,connectNulls:m,type:d,baseLine:n,layout:u,stroke:p,isRange:h,animationElapsedTime:o,isAnimating:c,isEntrance:l});return G.createElement(G.Fragment,null,t?.length>1&&G.createElement(s,{clipPath:r?`url(#clipPath-${i})`:void 0},G.createElement(f,{option:g,DefaultShape:Xt.shape,shapeProps:y})),G.createElement(en,{points:t,props:v,clipPathId:i}))}function rn(e,t,n){if(D(e)){var r=D(t)?t:void 0;return Ge(r,e,n)}if(Ue(e)||T(e)){var i=D(t)?t:void 0;return Ge(i,0,n)}return e}function an(e){var t=e.needClip,n=e.clipPathId,r=e.props,i=e.previousPointsRef,a=e.previousBaselineRef,o=r.points,s=r.baseLine,c=r.isAnimationActive,l=r.animationBegin,f=r.animationDuration,m=r.animationEasing,h=r.animationMatchBy,_=r.animationInterpolateFn,v=K(()=>({points:o,baseLine:s}),[o,s]),y=g(v,a),b=Re(),x=p(r.onAnimationStart,r.onAnimationEnd),S=x.isAnimating,w=x.handleAnimationStart,T=x.handleAnimationEnd,E=y.startValue;if(b==null)return null;var D=Array.isArray(s)&&Array.isArray(E)?C(E,s,h):Array.isArray(s)?C(null,s,h):null;return G.createElement(u,{animationInput:v,animationIdPrefix:`recharts-area-`,items:o,previousItemsRef:i,isAnimationActive:c,animationBegin:l,animationDuration:f,animationEasing:m,onAnimationStart:w,onAnimationEnd:T,animationInterpolateFn:_,animationMatchBy:h,layout:b},(e,i,a)=>{var c=i===1?s:Array.isArray(s)?_(D,i,b):a?s:rn(s,E,i);return y.syncStepValue(c,i),G.createElement(tn,{showLabels:!S,points:o},r.children,G.createElement(nn,{points:e,baseLine:c,needClip:t,clipPathId:n,props:r,animationElapsedTime:i,isAnimating:S||i<1,isEntrance:a}),G.createElement(d,{label:r.label}))})}function on(e){var t=e.needClip,n=e.clipPathId,r=e.props,i=_t(null),a=_t();return G.createElement(an,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}var sn=class extends ht{render(){var e=this.props,t=e.hide,r=e.dot,i=e.points,a=e.className,o=e.top,l=e.left,u=e.needClip,d=e.xAxisId,f=e.yAxisId,p=e.width,h=e.height,g=e.id,_=e.baseLine,v=e.zIndex;if(t)return null;var y=n(`recharts-area`,a),b=g,x=E(r),S=x.r,C=x.strokeWidth,w=ee(r),T=S*2+C,D=u?`url(#clipPath-${w?``:`dots-`}${b})`:void 0;return G.createElement(m,{zIndex:v},G.createElement(s,{className:y},u&&G.createElement(`defs`,null,G.createElement(c,{clipPathId:b,xAxisId:d,yAxisId:f}),!w&&G.createElement(`clipPath`,{id:`clipPath-dots-${b}`},G.createElement(`rect`,{x:l-T/2,y:o-T/2,width:p+T,height:h+T}))),G.createElement(on,{needClip:u,clipPathId:b,props:this.props})),G.createElement(we,{points:i,mainColor:Zt(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:D}),this.props.isRange&&Array.isArray(_)&&G.createElement(we,{points:_,mainColor:Zt(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:D}))}};function cn(e){var n=e.activeDot,r=e.animationBegin,i=e.animationDuration,a=e.animationEasing,s=e.connectNulls,c=e.dot,l=e.fill,u=e.fillOpacity,d=e.hide,f=e.isAnimationActive,p=e.legendType,m=e.stroke,h=e.xAxisId,g=e.yAxisId,_=Wt(e,Ht),v=de(),y=re(),b=o(h,g).needClip,x=Ve(),S=Ke(t=>jt(t,e.id,x))??{},C=S.points,w=S.isRange,T=S.baseLine,E=t();if(v!==`horizontal`&&v!==`vertical`||E==null||y!==`AreaChart`&&y!==`ComposedChart`)return null;var D=E.height,ee=E.width,O=E.x,te=E.y;return!C||!C.length?null:G.createElement(sn,Ut({},_,{activeDot:n,animationBegin:r,animationDuration:i,animationEasing:a,baseLine:T,connectNulls:s,dot:c,fill:l,fillOpacity:u,height:D,hide:d,layout:v,isAnimationActive:f,isRange:w,legendType:p,needClip:b,points:C,stroke:m,width:ee,left:O,top:te,xAxisId:h,yAxisId:g}))}var ln=(e,t,n,r,i)=>{var a=n??t;if(D(a))return a;var o=e===`horizontal`?i:r,s=o.scale.domain();if(o.type===`number`){var c=Math.max(s[0],s[1]),l=Math.min(s[0],s[1]);return a===`dataMin`?l:a===`dataMax`||c<0?c:Math.max(Math.min(s[0],s[1]),0)}return a===`dataMin`?s[0]:a===`dataMax`?s[1]:s[0]};function un(e){var t=e.areaSettings,n=t.connectNulls,r=t.baseValue,i=t.dataKey,a=e.stackedData,o=e.layout,s=e.chartBaseValue,c=e.xAxis,l=e.yAxis,u=e.displayedData,d=e.dataStartIndex,f=e.xAxisTicks,p=e.yAxisTicks,m=e.bandSize,h=e.stackDataKeys,g=a&&a.length,_=ln(o,s,r,c,l),v=o===`horizontal`,y=!1,b=u.map((e,t)=>{var r;if(g)r=a[d+t];else{var o=be(e,i);Array.isArray(o)?(r=o,y=!0):r=[_,o]}var s=r?.[1]??null,u=be(e,i),b=g&&u==null&&h!=null&&h.length>0&&h.every(t=>be(e,t)==null),x=s==null||g&&!n&&u==null||b;return v?{x:ge({axis:c,ticks:f,bandSize:m,entry:e,index:t}),y:x?null:l.scale.map(s)??null,value:r,payload:e}:{x:x?null:c.scale.map(s)??null,y:ge({axis:l,ticks:p,bandSize:m,entry:e,index:t}),value:r,payload:e}});return{points:b,baseLine:(g||y?b.map(e=>{var t=Array.isArray(e.value)?e.value[0]:null;return v?{x:e.x,y:t!=null&&e.y!=null?l.scale.map(t)??null:null,payload:e.payload}:{x:t==null?null:c.scale.map(t)??null,y:e.y,payload:e.payload}}):v?l.scale.map(_):c.scale.map(_))??0,isRange:y}}function dn(e){var t=le(e,Xt),n=Ve();return G.createElement(v,{id:t.id,type:`area`},e=>G.createElement(G.Fragment,null,G.createElement(r,{legendPayload:Qt(t)}),G.createElement($t,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),G.createElement(_,{type:`area`,id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:Pe(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),G.createElement(cn,Ut({},t,{id:e}))))}var fn=G.memo(dn,se);fn.displayName=`Area`;var pn=[`axis`],mn=gt((e,t)=>G.createElement(We,{chartName:`AreaChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:pn,tooltipPayloadSearcher:Fe,categoricalChartProps:e,ref:t})),hn=[`axis`],gn=gt((e,t)=>G.createElement(We,{chartName:`ComposedChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:hn,tooltipPayloadSearcher:Fe,categoricalChartProps:e,ref:t})),_n=53,Q=9,$=2,vn=X.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
gap: ${$}px;
|
|
4
4
|
`,yn=X.div`
|
|
@@ -43,12 +43,12 @@ import{$ as e,A as t,At as n,B as r,C as i,Ct as a,D as o,Dt as s,E as c,Et as l
|
|
|
43
43
|
outline: 1px solid var(--ink-dim);
|
|
44
44
|
outline-offset: 1px;
|
|
45
45
|
}
|
|
46
|
-
`,En=X(
|
|
46
|
+
`,En=X(B)`
|
|
47
47
|
gap: ${$}px;
|
|
48
|
-
`,Dn=X(
|
|
48
|
+
`,Dn=X(V)`
|
|
49
49
|
color: ${({theme:e})=>e.color.inkDim};
|
|
50
50
|
font-size: 11px;
|
|
51
|
-
`;function On(e){let t=e.filter(e=>e>0).sort((e,t)=>e-t);if(t.length===0)return[0,0,0];let n=e=>t[Math.min(t.length-1,Math.floor(t.length*e))]??0;return[n(.25),n(.5),n(.75)]}function kn(e,[t,n,r]){return e<=0?0:e<=t?1:e<=n?2:e<=r?3:4}function An({days:e,now:t}){let[n,r]=q(`tokens`),[i,a]=q(null),o=De(n),s=K(()=>{let n=new Map;for(let t of e){let e=Number(t.key);Number.isFinite(e)&&n.set(ae(e),{requests:t.requests,errors:t.errors,costUsd:t.costUsd,inputTokens:t.inputTokens,outputTokens:t.outputTokens,cacheReadTokens:t.cacheReadTokens,cacheWriteTokens:t.cacheWriteTokens,rtkSavedTokens:t.rtkSavedTokens,rtkAppliedRequests:t.rtkAppliedRequests,durationMsSum:t.durationMsSum})}let r=new Date(ae(t));r.setDate(r.getDate()+(6-r.getDay())-370);let i=ae(t);return Array.from({length:_n},()=>Array.from({length:7},()=>{let e=r.getTime();return r.setDate(r.getDate()+1),{at:e,totals:n.get(e)??j,future:e>i}}))},[e,t]),c=s.flat(),l=On(c.map(e=>o.of({key:``,...e.totals}))),u=c.reduce((e,t)=>ue(e,M(t.totals)),j),d=c.reduce((e,t)=>e+ +(t.totals.requests>0),0),f=(e,t)=>`${e}: ${I(t.requests)} requests, ${I(A(t))} tokens, ${L(t.costUsd)}`;return J(
|
|
51
|
+
`;function On(e){let t=e.filter(e=>e>0).sort((e,t)=>e-t);if(t.length===0)return[0,0,0];let n=e=>t[Math.min(t.length-1,Math.floor(t.length*e))]??0;return[n(.25),n(.5),n(.75)]}function kn(e,[t,n,r]){return e<=0?0:e<=t?1:e<=n?2:e<=r?3:4}function An({days:e,now:t}){let[n,r]=q(`tokens`),[i,a]=q(null),o=De(n),s=K(()=>{let n=new Map;for(let t of e){let e=Number(t.key);Number.isFinite(e)&&n.set(ae(e),{requests:t.requests,errors:t.errors,costUsd:t.costUsd,inputTokens:t.inputTokens,outputTokens:t.outputTokens,cacheReadTokens:t.cacheReadTokens,cacheWriteTokens:t.cacheWriteTokens,rtkSavedTokens:t.rtkSavedTokens,rtkAppliedRequests:t.rtkAppliedRequests,durationMsSum:t.durationMsSum})}let r=new Date(ae(t));r.setDate(r.getDate()+(6-r.getDay())-370);let i=ae(t);return Array.from({length:_n},()=>Array.from({length:7},()=>{let e=r.getTime();return r.setDate(r.getDate()+1),{at:e,totals:n.get(e)??j,future:e>i}}))},[e,t]),c=s.flat(),l=On(c.map(e=>o.of({key:``,...e.totals}))),u=c.reduce((e,t)=>ue(e,M(t.totals)),j),d=c.reduce((e,t)=>e+ +(t.totals.requests>0),0),f=(e,t)=>`${e}: ${I(t.requests)} requests, ${I(A(t))} tokens, ${L(t.costUsd)}`;return J(rt,{legend:`Activity`,meta:i===null?`${I(d)} active days`:void 0,actions:J(ft,{children:Ie.map(e=>J(pt,{type:`button`,$size:`sm`,$on:e.id===n,"aria-pressed":e.id===n,onClick:()=>r(e.id),children:e.label},e.id))}),children:Y(z,{$gap:2,children:[J(at,{children:J(z,{$gap:1,style:{width:611},children:Y(vn,{children:[J(yn,{"aria-hidden":`true`,children:[``,`Mon`,``,`Wed`,``,`Fri`,``].map((e,t)=>J(bn,{children:e},t))}),Y(z,{$gap:1,children:[J(xn,{"aria-hidden":`true`,children:s.map((e,t)=>{let n=e[0],r=s[t-1]?.[0],i=n!==void 0&&(r===void 0||new Date(r.at).getMonth()!==new Date(n.at).getMonth());return J(Sn,{children:i&&n!==void 0?new Date(n.at).toLocaleDateString(`en-GB`,{month:`short`}):``},n?.at??t)})}),J(Cn,{role:`grid`,"aria-label":`${o.label} per day over the last year`,children:s.map(e=>J(wn,{role:`row`,children:e.map(e=>J(Tn,{role:`gridcell`,tabIndex:-1,"aria-label":f(he(e.at),e.totals),title:f(he(e.at),e.totals),$future:e.future,$level:e.future?0:kn(o.of({key:``,...e.totals}),l),onMouseEnter:()=>a(e),onMouseLeave:()=>a(null)},e.at))},e[0]?.at))})]})]})})}),Y(B,{$justify:`space-between`,$wrap:!0,children:[J(Dn,{children:i===null?f(`Last 12 months`,u):f(he(i.at),i.totals)}),Y(B,{$gap:1,children:[J(tt,{children:`Less`}),J(En,{"aria-hidden":`true`,children:[0,1,2,3,4].map(e=>J(Tn,{$level:e,$future:!1},e))}),J(tt,{children:`More`})]})]})]})})}function jn({buckets:e,by:t,since:n,until:r,metric:i,names:a}){let o=F(n,r,t),s=new Map,c=new Map;for(let n of e){let e=n.split??`unknown`;s.set(e,ue(s.get(e)??j,n));let r=c.get(e)??new Map,a=Ne(n.key,t);r.set(a,(r.get(a)??0)+i.of(n)),c.set(e,r)}let l=[...s.entries()].sort((e,t)=>i.of(M(t[1]))-i.of(M(e[1])));return J(at,{children:Y(dt,{children:[J(`thead`,{children:Y(`tr`,{children:[J(U,{children:`Key`}),J(U,{children:`Trend`}),J(U,{$align:`right`,children:`Requests`}),J(U,{$align:`right`,children:`Failed`}),J(U,{$align:`right`,children:`Tokens`}),J(U,{$align:`right`,children:`Mean`}),J(U,{$align:`right`,children:`Cost`})]})}),J(`tbody`,{children:l.map(([e,t])=>{let n=c.get(e)??new Map,r=e===`unknown`?`Unattributed`:a.get(e)??e;return Y(ut,{children:[J(H,{children:J(it,{style:{display:`block`,maxWidth:`28ch`},children:r})}),J(H,{style:{width:120},children:J(st,{values:o.map(e=>n.get(e)??0),height:20,label:`${r}: ${i.format(i.of(M(t)))} over the window`})}),J(H,{$align:`right`,$mono:!0,children:I(t.requests)}),J(H,{$align:`right`,$mono:!0,style:t.errors>0?{color:`var(--down)`}:void 0,children:Ze(t.requests===0?0:t.errors/t.requests,0)}),J(H,{$align:`right`,$mono:!0,children:I(A(t))}),J(H,{$align:`right`,$mono:!0,children:Xe(t.requests===0?null:t.durationMsSum/t.requests)}),J(H,{$align:`right`,$mono:!0,children:L(t.costUsd)})]},e)})})]})})}var Mn=6,Nn=`__other__`,Pn=`unknown`;function Fn(e,t,n){let r=n.get(t);return r===void 0?e.find(e=>e.models.some(e=>e.id===t))?.id??null:r}function In(e,t){return e===null?`var(--ink-faint)`:`color-mix(in oklch, ${ct(e)} ${Math.max(30,100-t*22)}%, var(--panel))`}function Ln({buckets:e,by:t,since:n,until:r,metric:a,providers:o}){let s=Je().data??[],c=[...fe(e,a).entries()],l=c.slice(0,Mn),u=c.slice(Mn),d=[...new Set(l.map(([e])=>Fn(s,e,o)))].filter(e=>e!==null&&Ye(s,e)===void 0).sort(),f=[];for(let e of[...s.map(e=>e.id),...d,null])l.filter(([t])=>Fn(s,t,o)===e).forEach(([t,n],r)=>{f.push({name:t,label:t===Pn?`Unresolved`:t,color:In(e,r),totals:n})});u.length>0&&f.push({name:Nn,label:`${u.length} more`,color:`var(--ink-faint)`,totals:u.reduce((e,[,t])=>ue(e,M(t)),j)});let p=new Set(l.map(([e])=>e)),m=new Map;for(let n of e){let e=n.split??Pn,r=`${Ne(n.key,t)} ${p.has(e)?e:Nn}`;m.set(r,(m.get(r)??0)+a.of(n))}let g=F(n,r,t).map(e=>{let t={at:e};for(let n of f)t[n.name]=m.get(`${e} ${n.name}`)??0;return t}),_=new Map(f.map(e=>[e.name,e.label]));return Y(z,{$gap:2,children:[J(ze,{$height:220,children:J(Ee,{width:`100%`,height:`100%`,children:Y(mn,{data:g,margin:{top:4,right:4,bottom:4,left:4},children:[J(y,{stroke:`var(--rule)`,vertical:!1}),J(i,{dataKey:`at`,tickFormatter:e=>N(e,t),tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,interval:`preserveStartEnd`,minTickGap:28}),J(w,{tickFormatter:e=>a.format(e),tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,width:40}),J(h,{cursor:{stroke:`var(--rule-strong)`},content:({active:e,payload:n,label:r})=>{if(e!==!0||n===void 0||n.length===0)return null;let i=n.filter(e=>Number(e.value??0)>0);return Y(je,{children:[J(`div`,{children:N(Number(r),t)}),i.length===0?J(`div`,{children:`No ${a.label.toLowerCase()}`}):i.map(e=>Y(`div`,{children:[_.get(String(e.dataKey))??String(e.dataKey),` `,a.format(Number(e.value??0))]},String(e.dataKey)))]})}}),f.map(e=>J(fn,{type:`monotone`,dataKey:e.name,stackId:`models`,stroke:e.color,strokeWidth:2,fill:e.color,fillOpacity:.22,isAnimationActive:!1},e.name))]})})}),J(ke,{children:f.map(e=>Y(`span`,{children:[J(k,{$color:e.color}),` `,J(it,{title:`${e.label}: ${a.format(a.of(M(e.totals)))} ${a.label.toLowerCase()}`,style:{display:`inline-block`,maxWidth:`24ch`,verticalAlign:`bottom`},children:e.label})]},e.name))})]})}var Rn=`unknown`;function zn(e,t){return Ye(e,t)===void 0?`var(--ink-faint)`:ct(t)}function Bn(e,t){return t===Rn?`Unresolved`:Ye(e,t)?.label??t}function Vn({buckets:e,by:t,since:n,until:r,metric:a}){let o=Je().data??[],s=fe(e,a),c=[...s.keys()].filter(e=>e!==Rn&&Ye(o,e)===void 0).sort(),l=[...o.map(e=>e.id),...c,Rn].map(e=>({name:e,totals:s.get(e)})).filter(e=>e.totals!==void 0),u=l.map(e=>e.name),d=F(n,r,t),f=_e(e,d,t,a),p=[...s.values()].reduce((e,t)=>e+t.requests,0);return Y(z,{$gap:3,children:[J(ze,{$height:200,children:J(Ee,{width:`100%`,height:`100%`,children:Y(mn,{data:f,margin:{top:4,right:4,bottom:4,left:4},children:[J(y,{stroke:`var(--rule)`,vertical:!1}),J(i,{dataKey:`at`,tickFormatter:e=>N(e,t),tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,interval:`preserveStartEnd`,minTickGap:28}),J(w,{tickFormatter:e=>a.format(e),tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,width:48}),J(h,{cursor:{stroke:`var(--rule-strong)`},content:({active:e,payload:n,label:r})=>e!==!0||n===void 0||n.length===0?null:Y(je,{children:[J(`div`,{children:N(Number(r),t)}),n.map(e=>Y(`div`,{children:[Bn(o,String(e.dataKey)),` `,a.format(Number(e.value??0))]},String(e.dataKey)))]})}),u.map(e=>J(fn,{type:`monotone`,dataKey:e,stackId:`providers`,stroke:zn(o,e),strokeWidth:2,fill:zn(o,e),fillOpacity:.22,isAnimationActive:!1},e))]})})}),J(ke,{children:u.map(e=>Y(`span`,{children:[J(k,{$color:zn(o,e)}),` `,Bn(o,e)]},e))}),Y(dt,{children:[J(`thead`,{children:Y(`tr`,{children:[J(U,{children:`Provider`}),J(U,{$align:`right`,children:`Share`}),J(U,{$align:`right`,children:`Requests`}),J(U,{$align:`right`,children:`Failed`}),J(U,{$align:`right`,children:`Tokens`}),J(U,{$align:`right`,children:`Cost`})]})}),J(`tbody`,{children:l.map(({name:e,totals:t})=>Y(ut,{children:[Y(H,{children:[J(k,{$color:zn(o,e)}),` `,Bn(o,e)]}),J(H,{$align:`right`,$mono:!0,children:Ze(p===0?0:t.requests/p,0)}),J(H,{$align:`right`,$mono:!0,children:I(t.requests)}),J(H,{$align:`right`,$mono:!0,style:t.errors>0?{color:`var(--down)`}:void 0,children:I(t.errors)}),J(H,{$align:`right`,$mono:!0,children:I(A(t))}),J(H,{$align:`right`,$mono:!0,children:L(t.costUsd)})]},e))})]})]})}var Hn=X.li`
|
|
52
52
|
display: grid;
|
|
53
53
|
grid-template-columns: minmax(0, 20ch) 1fr auto;
|
|
54
54
|
align-items: center;
|
|
@@ -69,8 +69,8 @@ import{$ as e,A as t,At as n,B as r,C as i,Ct as a,D as o,Dt as s,E as c,Et as l
|
|
|
69
69
|
border-radius: 0 2px 2px 0;
|
|
70
70
|
background: ${({theme:e,$fault:t})=>t?e.color.down:e.color.accent};
|
|
71
71
|
opacity: 0.85;
|
|
72
|
-
`,Kn=X(
|
|
72
|
+
`,Kn=X(it)`
|
|
73
73
|
display: block;
|
|
74
74
|
font-family: ${({theme:e})=>e.font.mono};
|
|
75
75
|
font-size: 12px;
|
|
76
|
-
`,qn=12;function Jn({buckets:e,metric:t,names:n,unknownLabel:r}){let i=new Map;for(let t of e)i.set(t.key,ue(i.get(t.key)??j,t));let a=e=>e===`unknown`?r??`Unattributed`:n?.get(e)??e,o=[...i.entries()].map(([e,n])=>({name:a(e),entry:n,value:t.of(M(n))})).sort((e,t)=>t.value-e.value),s=o.slice(0,qn),c=o.slice(qn),l=s[0]?.value??0;return Y(z,{$gap:3,children:[J(Un,{children:s.map(({name:e,entry:n,value:r})=>Y(Hn,{children:[J(Kn,{title:e,children:e}),J(Wn,{children:J(Gn,{$share:l===0?0:r/l,$fault:n.requests>0&&n.errors===n.requests})}),Y(
|
|
76
|
+
`,qn=12;function Jn({buckets:e,metric:t,names:n,unknownLabel:r}){let i=new Map;for(let t of e)i.set(t.key,ue(i.get(t.key)??j,t));let a=e=>e===`unknown`?r??`Unattributed`:n?.get(e)??e,o=[...i.entries()].map(([e,n])=>({name:a(e),entry:n,value:t.of(M(n))})).sort((e,t)=>t.value-e.value),s=o.slice(0,qn),c=o.slice(qn),l=s[0]?.value??0;return Y(z,{$gap:3,children:[J(Un,{children:s.map(({name:e,entry:n,value:r})=>Y(Hn,{children:[J(Kn,{title:e,children:e}),J(Wn,{children:J(Gn,{$share:l===0?0:r/l,$fault:n.requests>0&&n.errors===n.requests})}),Y(B,{$gap:2,children:[J(V,{$size:`12px`,children:t.format(r)}),J(V,{$size:`11px`,$dim:!0,children:L(n.costUsd)})]})]},e))}),c.length===0?null:J(V,{$size:`11px`,$dim:!0,children:`+ ${c.length} more, ${I(c.reduce((e,t)=>e+t.entry.requests,0))} requests`})]})}var Yn=[{id:`inputTokens`,label:`Uncached input`,opacity:.95},{id:`outputTokens`,label:`Output`,opacity:.7},{id:`cacheReadTokens`,label:`Cache read`,opacity:.45},{id:`cacheWriteTokens`,label:`Cache write`,opacity:.22}];function Xn({buckets:e,by:t,since:n,until:r}){let a=new Map;for(let n of e)a.set(Ne(n.key,t),n);let o=F(n,r,t).map(e=>{let t=a.get(e);return{at:e,inputTokens:t?.inputTokens??0,outputTokens:t?.outputTokens??0,cacheReadTokens:t?.cacheReadTokens??0,cacheWriteTokens:t?.cacheWriteTokens??0}}),s=Yn.map(e=>({...e,value:o.reduce((t,n)=>t+n[e.id],0)})),c=s.reduce((e,t)=>e+t.value,0);return Y(z,{$gap:3,children:[J(ze,{$height:200,children:J(Ee,{width:`100%`,height:`100%`,children:Y(mn,{data:o,margin:{top:4,right:4,bottom:4,left:4},children:[J(y,{stroke:`var(--rule)`,vertical:!1}),J(i,{dataKey:`at`,tickFormatter:e=>N(e,t),tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,interval:`preserveStartEnd`,minTickGap:28}),J(w,{tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,width:44,tickFormatter:e=>I(e)}),J(h,{cursor:{stroke:`var(--rule-strong)`},content:({active:e,payload:n,label:r})=>e!==!0||n===void 0||n.length===0?null:Y(je,{children:[J(`div`,{children:N(Number(r),t)}),Yn.map(e=>Y(`div`,{children:[e.label,` `,I(Number(n.find(t=>t.dataKey===e.id)?.value??0))]},e.id))]})}),Yn.map(e=>J(fn,{type:`monotone`,dataKey:e.id,stackId:`tokens`,stroke:`var(--accent)`,strokeOpacity:e.opacity,strokeWidth:1.5,fill:`var(--accent)`,fillOpacity:e.opacity*.5,isAnimationActive:!1},e.id))]})})}),J(ke,{children:s.map(e=>Y(B,{$gap:1,children:[J(k,{$color:`var(--accent)`,style:{opacity:e.opacity}}),J(`span`,{children:e.label}),J(V,{$size:`11px`,children:I(e.value)}),J(V,{$size:`11px`,$dim:!0,children:Ze(c===0?0:e.value/c,0)})]},e.id))})]})}function Zn({buckets:e,by:t,since:n,until:r}){let a=new Map;for(let n of e)a.set(Ne(n.key,t),n);let o=F(n,r,t).map(e=>{let n=a.get(e);return{at:e,label:N(e,t),requests:n?.requests??0,errors:n?.errors??0,costUsd:n?.costUsd??0,tokens:n===void 0?0:A(n)}});return Y(z,{$gap:2,children:[J(ze,{$height:220,children:J(Ee,{width:`100%`,height:`100%`,children:Y(gn,{data:o,margin:{top:4,right:4,bottom:4,left:4},children:[J(y,{stroke:`var(--rule)`,vertical:!1}),J(i,{dataKey:`label`,tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,interval:`preserveStartEnd`,minTickGap:28}),J(w,{tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,width:40}),J(h,{cursor:{stroke:`var(--rule-strong)`},content:({active:e,payload:t})=>{if(e!==!0||t===void 0||t.length===0)return null;let n=t[0]?.payload;return n===void 0?null:Y(je,{children:[J(`div`,{children:n.label}),Y(`div`,{children:[I(n.requests),` requests`]}),Y(`div`,{children:[I(n.errors),` failed`]}),Y(`div`,{children:[I(n.tokens),` tokens`]}),J(`div`,{children:L(n.costUsd)})]})}}),J(fn,{type:`monotone`,dataKey:`requests`,stroke:`none`,fill:`var(--accent)`,fillOpacity:.12,isAnimationActive:!1}),J(He,{type:`monotone`,dataKey:`requests`,stroke:`var(--accent)`,strokeWidth:2,dot:!1,activeDot:{r:4,stroke:`var(--panel)`,strokeWidth:2},isAnimationActive:!1}),J(He,{type:`monotone`,dataKey:`errors`,stroke:`var(--down)`,strokeWidth:2,dot:!1,activeDot:{r:4,stroke:`var(--panel)`,strokeWidth:2},isAnimationActive:!1})]})})}),Y(ke,{children:[Y(`span`,{children:[J(k,{$color:`var(--accent)`}),` Requests`]}),Y(`span`,{children:[J(k,{$color:`var(--down)`}),` Failed`]})]})]})}var Qn=864e5,$n=[{id:`requestedModel`,label:`As requested`,column:`Virtual model`},{id:`model`,label:`As served`,column:`Upstream model`}];function er(){let{cadence:e}=ot(),[t,n]=q(`24h`),[r,i]=q(`tokens`),[a,o]=q(`model`),s=ye(t),c=De(r),l=K(()=>s.grain===`daily`?ae(Date.now()-s.ms):Math.floor((Date.now()-s.ms)/6e4)*6e4,[s]),u=K(()=>l+s.ms,[l,s]),d=K(()=>ae(Date.now()-371*Qn),[]),f={since:l,grain:s.grain},p=R({...f,groupBy:s.by},e(6e4,`res:usage`)),m=R({...f,groupBy:s.by,splitBy:`provider`},e(6e4,`res:usage`)),h=R({...f,groupBy:s.by,splitBy:`model`},e(6e4,`res:usage`)),g=R({...f,groupBy:s.by,splitBy:`apiKey`},e(6e4,`res:usage`)),_=R({...f,groupBy:a},e(6e4,`res:usage`)),v=R({...f,groupBy:`credential`},e(6e4,`res:usage`)),y=R({since:d,grain:`daily`,groupBy:`day`},e(3e5,`res:usage`)),b=Qe(),x=$e(),S=et(),C=K(()=>{let e=new Map;for(let t of S.data??[])for(let n of t.targets)e.set(n.model,n.provider);return e},[S.data]),w=K(()=>{let e=new Map;for(let t of b.data??[])e.set(t.id,t.label);return e},[b.data]),T=K(()=>{let e=new Map;for(let t of x.data??[])e.set(t.id,t.label);return e},[x.data]),E=p.data??[],D=ce(E),ee=A(D),O={legend:`Nothing recorded`,message:`No requests landed in this window. Widen the range, or send traffic through the gateway.`};return Y(z,{$gap:4,children:[J(lt,{legend:`Usage`,title:`Requests, tokens, and spend`,summary:p.isLoading?`Reading usage…`:`${I(D.requests)} requests and ${L(D.costUsd)} over the last ${s.label}.`,actions:J(ft,{children:xe.map(e=>J(pt,{type:`button`,$size:`sm`,$on:e.id===t,"aria-pressed":e.id===t,onClick:()=>n(e.id),children:e.id},e.id))})}),J(mt,{buckets:E,since:l,until:u,by:s.by,rangeLabel:s.label}),J(W,{legend:`Traffic`,meta:s.by===`hour`?`By hour`:`By day`,query:p,isEmpty:E.length===0,empty:O,children:J(Zn,{buckets:E,by:s.by,since:l,until:u})}),J(ft,{children:Ie.map(e=>J(pt,{type:`button`,$size:`sm`,$on:e.id===r,"aria-pressed":e.id===r,onClick:()=>i(e.id),children:`Rank by ${e.label.toLowerCase()}`},e.id))}),J(W,{legend:`Traffic by upstream model`,meta:`${c.label}, ${s.by===`hour`?`by hour`:`by day`}`,query:h,isEmpty:(h.data??[]).length===0,empty:O,children:J(Ln,{buckets:h.data??[],by:s.by,since:l,until:u,metric:c,providers:C})}),Y(nt,{$min:`480px`,$gap:4,children:[Y(z,{$gap:4,children:[J(W,{legend:`Providers`,meta:c.label,query:m,isEmpty:(m.data??[]).length===0,empty:O,children:J(Vn,{buckets:m.data??[],by:s.by,since:l,until:u,metric:c})}),J(An,{days:y.data??[],now:Date.now()})]}),Y(z,{$gap:4,children:[J(W,{legend:`Token mix`,meta:I(ee),query:p,isEmpty:E.length===0,empty:O,children:J(Xn,{buckets:E,by:s.by,since:l,until:u})}),J(W,{legend:`Models`,meta:$n.find(e=>e.id===a)?.column,query:_,isEmpty:(_.data??[]).length===0,empty:O,actions:J(ft,{children:$n.map(e=>J(pt,{type:`button`,$size:`sm`,$on:e.id===a,"aria-pressed":e.id===a,onClick:()=>o(e.id),children:e.label},e.id))}),children:J(Jn,{buckets:_.data??[],metric:c})}),J(W,{legend:`Accounts`,meta:c.label,query:v,isEmpty:(v.data??[]).length===0,empty:O,children:J(Jn,{buckets:v.data??[],metric:c,names:T,unknownLabel:`No account`})})]})]}),J(W,{legend:`API keys`,meta:c.label,query:g,isEmpty:(g.data??[]).length===0,empty:O,children:J(jn,{buckets:g.data??[],by:s.by,since:l,until:u,metric:c,names:w})})]})}var tr=er;export{tr as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as e}from"./Rack-
|
|
1
|
+
import{b as e}from"./Rack-D798XvPQ.js";var t=e(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),n=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t as n,n as t};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import{_ as e,h as t,i as n}from"./shared-OJcoRCqT.js";import{$ as r,A as i,B as ee,F as a,I as o,P as s,Q as te,X as c,Z as ne,et as re,g as l,l as ie,r as u,tt as d,u as ae}from"./Lamp-ZlMzNs5N.js";import{C as f,D as oe,O as se,_ as p,a as ce,b as m,i as le,t as ue,v as h,x as g,y as _}from"./Panel-CYQvfI3L.js";import{_ as de,d as v,i as fe,t as pe}from"./Rack-D798XvPQ.js";import{n as me,t as y}from"./chevron-right-CPoaXYHw.js";import{n as b,t as x}from"./stream-CEb81tzM.js";import{i as S,n as he}from"./Field-DK5zaBVA.js";import{t as C}from"./Meter-stpt3vQu.js";import{i as w,n as T,r as E,t as D}from"./Table-CVDZ69Zx.js";import{n as ge,r as O}from"./WindowChart-C-Y6U3WF.js";import{i as _e,n as ve,r as ye,t as be}from"./RequestTable-CEBhwDs7.js";import{i as k,n as A,r as xe,t as Se}from"./SummaryDeck-DBCSHihY.js";import{Fragment as Ce,useMemo as j,useState as M}from"react";import{jsx as N,jsxs as P}from"react/jsx-runtime";import F from"styled-components";var I=F.div`
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-areas:
|
|
4
|
+
"chassis"
|
|
5
|
+
"main";
|
|
6
|
+
grid-template-columns: minmax(0, 1fr);
|
|
7
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
8
|
+
height: 100vh;
|
|
9
|
+
min-height: 0;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
`,L=F.main`
|
|
12
|
+
grid-area: main;
|
|
13
|
+
padding: ${({theme:e})=>e.space(4)};
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
gap: ${({theme:e})=>e.space(4)};
|
|
17
|
+
min-width: 0;
|
|
18
|
+
min-height: 0;
|
|
19
|
+
overflow-y: auto;
|
|
20
|
+
|
|
21
|
+
@media (max-width: 720px) {
|
|
22
|
+
padding: ${({theme:e})=>e.space(3)};
|
|
23
|
+
}
|
|
24
|
+
`;function R({children:e}){let{cadence:t}=de(),n=c(),r=ne(200,t(1e4,`res:logs`));return P(I,{"data-testid":`client-shell`,children:[N(v,{logs:r.data??[],logsFailed:r.isError,signOut:{pending:n.isPending,run:()=>{n.mutate(void 0,{onSuccess:()=>window.location.assign(`/login`)})}}}),N(L,{children:e})]})}var z=[20,50,100,250],B={"1m":`per minute`,"5h":`per 5 hours`,"1w":`per week`};function we({reading:e}){let t=e.window===null?`concurrent requests`:`${e.dimension} ${B[e.window]??e.window}`,n=e.dimension===`spend`?o:i,r=e.used===null?null:e.limit===0?1:e.used/e.limit;return P(w,{children:[N(T,{children:t}),N(T,{$align:`right`,$mono:!0,children:e.used===null?N(_,{children:`unknown`}):n(e.used)}),N(T,{$align:`right`,$mono:!0,children:n(e.limit)}),N(T,{children:r===null?null:N(C,{fraction:r,label:`${t}, ${Math.round(Math.min(1,r)*100)}% used`})})]})}function V(e){return{observedAt:e.observedAt,windowType:e.windowType,windowMs:e.windowMs,resetsAt:e.resetsAt,usedRatio:e.usedRatio}}function H(e){return{stale:e.stale,rolledOver:e.rolledOver,estimateStale:e.stale||e.rolledOver,survives:e.survives,exhaustsAt:e.exhaustsAt}}var U=F.div`
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
gap: 4px;
|
|
28
|
+
`,W=F.div`
|
|
29
|
+
display: grid;
|
|
30
|
+
/* Bar, figure, legend — the accounts page's own three columns, so the two
|
|
31
|
+
screens read the same way and the legends stay aligned down the stack. */
|
|
32
|
+
grid-template-columns: 96px 34px 1fr;
|
|
33
|
+
align-items: center;
|
|
34
|
+
min-width: 208px;
|
|
35
|
+
gap: 6px;
|
|
36
|
+
`,G=F(h)`
|
|
37
|
+
font-size: 11px;
|
|
38
|
+
text-align: right;
|
|
39
|
+
`;function Te({windows:e,open:t,onToggle:n}){let r=e[0],i=e.filter(e=>e.usedRatio!==null);return P(w,{children:[N(T,{children:r.label}),N(T,{children:i.length===0?N(_,{children:`unknown`}):N(U,{children:i.map(e=>P(W,{children:[N(C,{fraction:e.usedRatio,label:`${e.label} ${e.windowType} window, ${Math.round(e.usedRatio*100)}% used`}),N(G,{children:s(e.usedRatio,0)}),N(p,{children:l(e,H(e),Date.now(),a)})]},e.windowType))})}),N(T,{$align:`right`,children:N(se,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-expanded":t,"aria-label":`${t?`Hide`:`Show`} quota history for ${r.label}`,title:`${t?`Hide`:`Show`} quota history for ${r.label}`,onClick:n,children:N(t?me:y,{})})})]})}function K(){let{cadence:a,live:c}=de(),[l,se]=M(`24h`),[v,me]=M(`all`),[y,b]=M(``),[x,C]=M(z[0]),[F,I]=M(null),[L,R]=M(null),B=t(l),H=j(()=>B.grain===`daily`?e(Date.now()-B.ms):Math.floor((Date.now()-B.ms)/6e4)*6e4,[B]),U=j(()=>H+B.ms,[H,B]),W=re(),G={since:H,grain:B.grain},K=d({...G,groupBy:B.by},a(6e4,`res:usage`)),q=d({...G,groupBy:`model`},a(6e4,`res:usage`)),J=ne(x,a(ee,`res:logs`)),Y=te(6e4),X=Y.data??[],Ee=j(()=>{let e=new Map;for(let t of X){let n=e.get(t.provider)??new Map,r=n.get(t.credentialId);r===void 0?n.set(t.credentialId,[t]):r.push(t),e.set(t.provider,n)}return[...e.entries()].map(([e,t])=>[e,[...t.entries()].map(([e,t])=>({credentialId:e,windows:[...t].sort((e,t)=>u[e.windowType]-u[t.windowType])}))])},[X]),Z=X.map(e=>O(V(e))).filter(e=>e!==null),De=Z.length===0?0:Math.floor(Math.min(...Z)/6e4)*6e4,Oe=r({since:De},L!==null&&Z.length>0),ke=(J.data??[]).some(ae),Ae=_e(c&&ke),Q=ye(J.data??[],v,y),je=(J.data??[]).filter(ie).length,$=K.data??[],Me=$.reduce((e,t)=>e+t.requests,0),Ne=$.reduce((e,t)=>e+t.costUsd,0);return P(f,{$gap:4,children:[N(pe,{legend:`Client`,title:`Your usage`,summary:K.isLoading?`Reading your usage…`:`${i(Me)} requests and ${o(Ne)} over the last ${B.label}.`,actions:N(A,{children:n.map(e=>N(xe,{type:`button`,$size:`sm`,$on:e.id===l,"aria-pressed":e.id===l,onClick:()=>se(e.id),children:e.id},e.id))})}),N(ue,{legend:`Your key`,meta:W.data===void 0?void 0:P(h,{$dim:!0,children:[W.data.prefix,`…`]}),children:W.isPending?N(ce,{rows:2}):W.isError?N(le,{legend:`Could not read your key`,error:W.error}):P(f,{$gap:2,children:[P(m,{$gap:2,$wrap:!0,children:[N(p,{children:W.data.label}),W.data.bodyLoggingOptOut?N(_,{children:`Request bodies are never stored for this key.`}):null]}),W.data.modelAllowlist===null?N(_,{children:`Every model this gateway serves.`}):W.data.modelAllowlist.length===0?N(_,{children:`No models. This key cannot serve a request.`}):N(m,{$gap:1,$wrap:!0,children:W.data.modelAllowlist.map(e=>N(h,{children:e},e))})]})}),N(Se,{buckets:$,since:H,until:U,by:B.by,rangeLabel:B.label}),N(k,{legend:`By model`,meta:B.label,query:{isLoading:q.isLoading,isError:q.isError,error:q.error,refetch:()=>void q.refetch()},failure:`Could not read usage`,empty:{legend:`No traffic`,message:`Nothing served in this window.`},isEmpty:(q.data??[]).length===0,children:N(g,{children:P(D,{children:[N(`thead`,{children:P(`tr`,{children:[N(E,{children:`Model`}),N(E,{$align:`right`,children:`Requests`}),N(E,{$align:`right`,children:`Tokens`}),N(E,{$align:`right`,children:`Spend`})]})}),N(`tbody`,{children:(q.data??[]).map(e=>P(w,{children:[N(T,{$mono:!0,children:e.key}),N(T,{$align:`right`,$mono:!0,children:i(e.requests)}),N(T,{$align:`right`,$mono:!0,children:i(e.inputTokens+e.outputTokens+e.cacheReadTokens+e.cacheWriteTokens)}),N(T,{$align:`right`,$mono:!0,children:o(e.costUsd)})]},e.key))})]})})}),N(k,{legend:`Your limits`,query:{isLoading:W.isLoading,isError:W.isError,error:W.error,refetch:()=>void W.refetch()},failure:`Could not read your limits`,empty:W.data?.limits===null?{legend:`Limits unreadable`,message:`This key's limits could not be read. Requests are refused until an operator repairs it.`}:{legend:`No limits`,message:`This key is not rate limited.`},isEmpty:W.data?.limits===null||(W.data?.limitUsage.length??0)===0,footer:N(_,{children:`Counted from completed requests, so a burst in flight right now may not be included yet.`}),children:N(g,{children:P(D,{children:[N(`thead`,{children:P(`tr`,{children:[N(E,{children:`Limit`}),N(E,{$align:`right`,children:`Used`}),N(E,{$align:`right`,children:`Ceiling`}),N(E,{$width:`30%`,children:`Consumption`})]})}),N(`tbody`,{children:(W.data?.limitUsage??[]).map(e=>N(we,{reading:e},`${e.dimension}:${e.window??`gauge`}`))})]})})}),N(k,{legend:`Provider headroom`,query:{isLoading:Y.isLoading,isError:Y.isError,error:Y.error,refetch:()=>void Y.refetch()},failure:`Could not read provider headroom`,empty:{legend:`No data`,message:`No provider has reported a usage window.`},isEmpty:X.length===0,footer:N(_,{children:`What each account serving this gateway has left. A request is served by whichever account of a provider can take it.`}),children:N(f,{$gap:4,children:Ee.map(([e,t])=>P(f,{$gap:1,children:[N(p,{children:e}),N(g,{children:P(D,{children:[N(`thead`,{children:P(`tr`,{children:[N(E,{children:`Account`}),N(E,{$width:`60%`,children:`Quota`}),N(E,{})]})}),N(`tbody`,{children:t.map(({credentialId:e,windows:t})=>P(Ce,{children:[N(Te,{windows:t,open:L===e,onToggle:()=>R(L===e?null:e)}),L===e?N(w,{children:N(T,{colSpan:3,children:N(f,{$gap:4,children:t.map(e=>{let t=V(e),n=O(t),r=(Oe.data?.samples??[]).filter(t=>t.credentialId===e.credentialId&&t.windowType===e.windowType&&t.observedAt>=(n??0));return N(ge,{live:t,samples:r.map(e=>({observedAt:e.observedAt,windowType:e.windowType,windowMs:e.windowMs,resetsAt:e.resetsAt,usedRatio:e.usedRatio})),since:n,now:Date.now(),truncated:Oe.data?.truncated===!0&&n!==null&&r.length>0&&(r[0]?.observedAt??0)>n,ratePerHourRatio:e.ratePerHourRatio,exhaustsAt:e.exhaustsAt,survives:e.survives,stale:e.stale,rolledOver:e.rolledOver,spent:e.usedRatio===null?`no ceiling reported`:`${s(e.usedRatio,0)} used`,rateText:e.ratePerHourRatio===null?`unknown`:`${s(e.ratePerHourRatio,1)}/h`},e.windowType)})})})}):null]},e))})]})})]},e))})}),N(k,{legend:`Recent requests`,meta:`${Q.length} shown`,actions:P(A,{children:[N(he,{value:y,placeholder:`Filter by model or error`,"aria-label":`Filter requests`,style:{width:200},onChange:e=>b(e.target.value)}),P(S,{value:v,"aria-label":`Show which requests`,style:{width:`auto`},onChange:e=>me(e.target.value),children:[N(`option`,{value:`all`,children:`All requests`}),N(`option`,{value:`failed`,children:`Failed only`})]}),N(S,{value:x,"aria-label":`How many requests to fetch`,style:{width:`auto`},onChange:e=>C(Number(e.target.value)),children:z.map(e=>P(`option`,{value:e,children:[`last `,e]},e))})]}),query:{isLoading:J.isLoading,isError:J.isError,error:J.error,refetch:()=>void J.refetch()},failure:`Could not read your requests`,empty:{legend:`No requests`,message:(J.data??[]).length===0?`Nothing served through this key yet.`:`No request in this window matches the filter. Clear it to see everything.`},isEmpty:Q.length===0,footer:P(_,{children:[i(je),` of the last `,i((J.data??[]).length),` failed.`]}),children:N(g,{children:N(ve,{rows:Q,now:Ae,onOpen:I})})}),N(fe,{open:F!==null,onOpenChange:e=>{e||I(null)},title:`Request detail`,width:`640px`,footer:N(oe,{type:`button`,onClick:()=>I(null),children:`Close`}),children:F===null?null:N(be,{log:F})})]})}var q=()=>N(x,{children:N(b,{children:N(R,{children:N(K,{})})})});export{q as component};
|