omnigateway 0.1.0 → 0.1.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.
Files changed (27) hide show
  1. package/README.md +8 -8
  2. package/bin/omni.js +255 -118
  3. package/gateway.js +212 -45
  4. package/package.json +2 -2
  5. package/public/assets/{CopyValue-BwjFnqW2.js → CopyValue-bzKz2tiJ.js} +1 -1
  6. package/public/assets/{Lamp-CSv_5d5k.js → Lamp-WOotyOTd.js} +4 -4
  7. package/public/assets/{Modal-1tHwlj0o.js → Modal-Crr8uyWt.js} +1 -1
  8. package/public/assets/{Rack-DANVhi_U.js → Rack-uDxrjvaz.js} +1 -1
  9. package/public/assets/{Toggle-pWcL2A-N.js → Toggle-D0e4C94X.js} +1 -1
  10. package/public/assets/{_app-C5mYmzgk.js → _app-OSvB-Dv9.js} +1 -1
  11. package/public/assets/_app.accounts-BOE49WyS.js +51 -0
  12. package/public/assets/_app.index-CTRlqxOq.js +61 -0
  13. package/public/assets/{_app.keys-DTREQf0P.js → _app.keys-BNEOjtbu.js} +1 -1
  14. package/public/assets/{_app.logs-Co3QPpc1.js → _app.logs-BxxqeEhM.js} +1 -1
  15. package/public/assets/{_app.models-DPSKIyeq.js → _app.models-BJi-RGUO.js} +6 -6
  16. package/public/assets/{_app.settings-15ZMiM5O.js → _app.settings-C1gB4w7c.js} +1 -1
  17. package/public/assets/_app.usage-B0iHKzmI.js +163 -0
  18. package/public/assets/catalog-DVRPlBJJ.js +1 -0
  19. package/public/assets/{index-DnNTc35a.js → index--dA3FFSN.js} +2 -2
  20. package/public/assets/{login-DNvWG7Nv.js → login-D-FsWNX8.js} +1 -1
  21. package/public/assets/trash-2-Cep_aVLx.js +1 -0
  22. package/public/favicon.svg +25 -0
  23. package/public/index.html +3 -1
  24. package/public/assets/_app.accounts-e7Mbaxdc.js +0 -47
  25. package/public/assets/_app.index-CxunMQ_m.js +0 -57
  26. package/public/assets/_app.usage-BBffCDCD.js +0 -163
  27. package/public/assets/catalog-DmrbfYQe.js +0 -1
@@ -1,4 +1,4 @@
1
- import{B as e,D as t,Dt as n,F as r,H as i,I as a,Kt as o,O as s,Ot as c,P as l,W as u,j as d,k as f,m as p,p as m}from"./queries-vY5lJqBe.js";import{t as h}from"./index-DnNTc35a.js";import{c as g,r as _,t as v}from"./Lamp-CSv_5d5k.js";var y=o(c(),1),b=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),x=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),S=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),C=e=>{let t=S(e);return t.charAt(0).toUpperCase()+t.slice(1)},w={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},T=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},E=(0,y.createContext)({}),D=()=>(0,y.useContext)(E),O=(0,y.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=D()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,y.createElement)(`svg`,{ref:c,...w,width:t??l??w.width,height:t??l??w.height,stroke:e??f,strokeWidth:m,className:b(`lucide`,p,i),...!a&&!T(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,y.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),k=(e,t)=>{let n=(0,y.forwardRef)(({className:n,...r},i)=>(0,y.createElement)(O,{ref:i,iconNode:t,className:b(`lucide-${x(C(e))}`,`lucide-${e}`,n),...r}));return n.displayName=C(e),n},A=k(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),j=k(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),ee=k(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),te=k(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),ne=k(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),re=k(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),ie=k(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),ae=k(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),oe=k(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),se=k(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),ce=k(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),M=new Intl.NumberFormat(`en-US`,{notation:`compact`,maximumFractionDigits:1}),N=new Intl.NumberFormat(`en-US`);function P(e){return Number.isFinite(e)?e<1e4?N.format(Math.round(e)):M.format(e).toLowerCase():`—`}function F(e){return Number.isFinite(e)?e===0?`$0`:e<.01?`$${e.toFixed(4)}`:e<100?`$${e.toFixed(2)}`:`$${M.format(e).toLowerCase()}`:`—`}function I(e){return e==null||!Number.isFinite(e)?`—`:e<1e3?`${Math.round(e)}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.round(e/6e4)}m`}function L(e,t=1){return Number.isFinite(e)?`${(e*100).toFixed(t)}%`:`—`}var R=[[6e4,1e3,`s`],[36e5,6e4,`m`],[864e5,36e5,`h`],[1/0,864e5,`d`]];function z(e){let t=Math.abs(e);if(t<1e3)return`0s`;let n=R.find(([e])=>t<e);return n===void 0?`—`:`${Math.floor(t/n[1])}${n[2]}`}function B(e,t=Date.now()){if(e==null||!Number.isFinite(e))return`—`;let n=e-t;return Math.abs(n)<5e3?`just now`:n<0?`${z(n)} ago`:`in ${z(n)}`}function V(e){return new Date(e).toLocaleTimeString(`en-GB`,{hour12:!1})}function H(e){return e==null||!Number.isFinite(e)?`—`:new Date(e).toLocaleString(`en-GB`,{year:`numeric`,month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1})}function U(e,t=8){return e.length<=t?e:`${e.slice(0,t)}…`}var W=n(),G=(0,y.createContext)(null);function le({children:e}){let[t,n]=(0,y.useState)(!0),r=(0,y.useCallback)(()=>n(e=>!e),[]),i=(0,y.useMemo)(()=>({live:t,toggle:r,cadence:e=>t?e:!1}),[t,r]);return(0,W.jsx)(G,{value:i,children:e})}function K(){return(0,y.use)(G)??{live:!1,toggle:()=>{},cadence:()=>!1}}var ue=e.svg`
1
+ import{B as e,D as t,Dt as n,F as r,H as i,I as a,Kt as o,O as s,Ot as c,P as l,W as u,j as d,k as f,m as p,p as m}from"./queries-vY5lJqBe.js";import{t as h}from"./index--dA3FFSN.js";import{l as g,r as _,t as v}from"./Lamp-WOotyOTd.js";var y=o(c(),1),b=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),x=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),S=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),C=e=>{let t=S(e);return t.charAt(0).toUpperCase()+t.slice(1)},w={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},T=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},E=(0,y.createContext)({}),D=()=>(0,y.useContext)(E),O=(0,y.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=D()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,y.createElement)(`svg`,{ref:c,...w,width:t??l??w.width,height:t??l??w.height,stroke:e??f,strokeWidth:m,className:b(`lucide`,p,i),...!a&&!T(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,y.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),k=(e,t)=>{let n=(0,y.forwardRef)(({className:n,...r},i)=>(0,y.createElement)(O,{ref:i,iconNode:t,className:b(`lucide-${x(C(e))}`,`lucide-${e}`,n),...r}));return n.displayName=C(e),n},A=k(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),j=k(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),ee=k(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),te=k(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),ne=k(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),re=k(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),ie=k(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),ae=k(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),oe=k(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),se=k(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),ce=k(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),M=new Intl.NumberFormat(`en-US`,{notation:`compact`,maximumFractionDigits:1}),N=new Intl.NumberFormat(`en-US`);function P(e){return Number.isFinite(e)?e<1e4?N.format(Math.round(e)):M.format(e).toLowerCase():`—`}function F(e){return Number.isFinite(e)?e===0?`$0`:e<.01?`$${e.toFixed(4)}`:e<100?`$${e.toFixed(2)}`:`$${M.format(e).toLowerCase()}`:`—`}function I(e){return e==null||!Number.isFinite(e)?`—`:e<1e3?`${Math.round(e)}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.round(e/6e4)}m`}function L(e,t=1){return Number.isFinite(e)?`${(e*100).toFixed(t)}%`:`—`}var R=[[6e4,1e3,`s`],[36e5,6e4,`m`],[864e5,36e5,`h`],[1/0,864e5,`d`]];function z(e){let t=Math.abs(e);if(t<1e3)return`0s`;let n=R.find(([e])=>t<e);return n===void 0?`—`:`${Math.floor(t/n[1])}${n[2]}`}function B(e,t=Date.now()){if(e==null||!Number.isFinite(e))return`—`;let n=e-t;return Math.abs(n)<5e3?`just now`:n<0?`${z(n)} ago`:`in ${z(n)}`}function V(e){return new Date(e).toLocaleTimeString(`en-GB`,{hour12:!1})}function H(e){return e==null||!Number.isFinite(e)?`—`:new Date(e).toLocaleString(`en-GB`,{year:`numeric`,month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1})}function U(e,t=8){return e.length<=t?e:`${e.slice(0,t)}…`}var W=n(),G=(0,y.createContext)(null);function le({children:e}){let[t,n]=(0,y.useState)(!0),r=(0,y.useCallback)(()=>n(e=>!e),[]),i=(0,y.useMemo)(()=>({live:t,toggle:r,cadence:e=>t?e:!1}),[t,r]);return(0,W.jsx)(G,{value:i,children:e})}function K(){return(0,y.use)(G)??{live:!1,toggle:()=>{},cadence:()=>!1}}var ue=e.svg`
2
2
  display: block;
3
3
  width: 100%;
4
4
  height: 100%;
@@ -1,4 +1,4 @@
1
- import{B as e,Dt as t,F as n,Kt as r,Ot as i}from"./queries-vY5lJqBe.js";import{m as a}from"./Rack-DANVhi_U.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./Modal-1tHwlj0o.js";var p=a(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),m=r(i(),1),h=Object.defineProperty,g=(e,t)=>h(e,`name`,{value:t,configurable:!0});function _(e){let[t,n]=m.useState(void 0);return u(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}g(_,`useSize`);var v=t(),y=Object.defineProperty,b=(e,t)=>y(e,`name`,{value:t,configurable:!0}),x=`Switch`,[S,C]=o(x),[w,T]=S(x);function E(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:l,required:u,value:d=`on`,internal_do_not_use_render:f}=e,[p,h]=c({prop:n,defaultProp:i??!1,onChange:l,caller:x}),[g,_]=m.useState(null),[y,b]=m.useState(null),S=m.useRef(!1),[C,T]=m.useReducer(e=>e+1,0),E={checked:p,setChecked:h,disabled:a,control:g,setControl:_,name:s,form:o,value:d,hasConsumerStoppedPropagationRef:S,userInteractionCount:C,onUserInteraction:T,required:u,defaultChecked:i,isFormControl:!g||!!o||!!g.closest(`form`),bubbleInput:y,setBubbleInput:b};return(0,v.jsx)(w,{scope:t,...E,children:P(f)?f(E):r})}b(E,`SwitchProvider`);var D=`SwitchTrigger`,O=m.forwardRef(b(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,form:a,value:o,disabled:c,checked:u,required:f,setControl:p,setChecked:h,hasConsumerStoppedPropagationRef:g,onUserInteraction:_,isFormControl:y,bubbleInput:x}=T(D,e),S=d(r,p),C=m.useRef(u);return m.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=b(()=>h(C.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,h]),(0,v.jsx)(l.button,{type:`button`,role:`switch`,"aria-checked":u,"aria-required":f,"data-state":F(u),"data-disabled":c?``:void 0,disabled:c,value:o,...n,ref:S,onClick:s(t,e=>{_(),h(e=>!e),x&&y&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})})},`SwitchTrigger`)),k=m.forwardRef(b(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,v.jsx)(E,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(O,{...d,ref:t,__scopeSwitch:n}),e&&(0,v.jsx)(N,{__scopeSwitch:n})]})})},`Switch`)),A=`SwitchThumb`,j=m.forwardRef(b(function(e,t){let{__scopeSwitch:n,...r}=e,i=T(A,n);return(0,v.jsx)(l.span,{"data-state":F(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),M=`SwitchBubbleInput`,N=m.forwardRef(b(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:c,defaultChecked:u,required:f,disabled:p,name:h,value:g,form:y,bubbleInput:b,setBubbleInput:x}=T(M,e),S=d(r,x),C=_(i),w=m.useRef(!1),E=m.useRef(c),D=m.useRef(o);m.useEffect(()=>{let e=b;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==D.current;D.current=o;let i=E.current!==c;E.current=c;let s=!(r&&a.current);if(i&&n){w.current=!r;let t=new Event(`click`,{bubbles:s});n.call(e,c),e.dispatchEvent(t),w.current=!1}},[b,c,a,o]);let O=m.useRef(c);return(0,v.jsx)(l.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:u??O.current,required:f,disabled:p,name:h,value:g,form:y,...n,tabIndex:-1,ref:S,onClick:s(t,e=>{w.current&&e.stopPropagation()}),style:{...n.style,...C,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function P(e){return typeof e==`function`}b(P,`isFunction`);function F(e){return e?`checked`:`unchecked`}b(F,`getState`);var I=e.p`
1
+ import{B as e,Dt as t,F as n,Kt as r,Ot as i}from"./queries-vY5lJqBe.js";import{m as a}from"./Rack-uDxrjvaz.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./Modal-Crr8uyWt.js";var p=a(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),m=r(i(),1),h=Object.defineProperty,g=(e,t)=>h(e,`name`,{value:t,configurable:!0});function _(e){let[t,n]=m.useState(void 0);return u(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}g(_,`useSize`);var v=t(),y=Object.defineProperty,b=(e,t)=>y(e,`name`,{value:t,configurable:!0}),x=`Switch`,[S,C]=o(x),[w,T]=S(x);function E(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:l,required:u,value:d=`on`,internal_do_not_use_render:f}=e,[p,h]=c({prop:n,defaultProp:i??!1,onChange:l,caller:x}),[g,_]=m.useState(null),[y,b]=m.useState(null),S=m.useRef(!1),[C,T]=m.useReducer(e=>e+1,0),E={checked:p,setChecked:h,disabled:a,control:g,setControl:_,name:s,form:o,value:d,hasConsumerStoppedPropagationRef:S,userInteractionCount:C,onUserInteraction:T,required:u,defaultChecked:i,isFormControl:!g||!!o||!!g.closest(`form`),bubbleInput:y,setBubbleInput:b};return(0,v.jsx)(w,{scope:t,...E,children:P(f)?f(E):r})}b(E,`SwitchProvider`);var D=`SwitchTrigger`,O=m.forwardRef(b(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,form:a,value:o,disabled:c,checked:u,required:f,setControl:p,setChecked:h,hasConsumerStoppedPropagationRef:g,onUserInteraction:_,isFormControl:y,bubbleInput:x}=T(D,e),S=d(r,p),C=m.useRef(u);return m.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=b(()=>h(C.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,h]),(0,v.jsx)(l.button,{type:`button`,role:`switch`,"aria-checked":u,"aria-required":f,"data-state":F(u),"data-disabled":c?``:void 0,disabled:c,value:o,...n,ref:S,onClick:s(t,e=>{_(),h(e=>!e),x&&y&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})})},`SwitchTrigger`)),k=m.forwardRef(b(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,v.jsx)(E,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(O,{...d,ref:t,__scopeSwitch:n}),e&&(0,v.jsx)(N,{__scopeSwitch:n})]})})},`Switch`)),A=`SwitchThumb`,j=m.forwardRef(b(function(e,t){let{__scopeSwitch:n,...r}=e,i=T(A,n);return(0,v.jsx)(l.span,{"data-state":F(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),M=`SwitchBubbleInput`,N=m.forwardRef(b(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:c,defaultChecked:u,required:f,disabled:p,name:h,value:g,form:y,bubbleInput:b,setBubbleInput:x}=T(M,e),S=d(r,x),C=_(i),w=m.useRef(!1),E=m.useRef(c),D=m.useRef(o);m.useEffect(()=>{let e=b;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==D.current;D.current=o;let i=E.current!==c;E.current=c;let s=!(r&&a.current);if(i&&n){w.current=!r;let t=new Event(`click`,{bubbles:s});n.call(e,c),e.dispatchEvent(t),w.current=!1}},[b,c,a,o]);let O=m.useRef(c);return(0,v.jsx)(l.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:u??O.current,required:f,disabled:p,name:h,value:g,form:y,...n,tabIndex:-1,ref:S,onClick:s(t,e=>{w.current&&e.stopPropagation()}),style:{...n.style,...C,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function P(e){return typeof e==`function`}b(P,`isFunction`);function F(e){return e?`checked`:`unchecked`}b(F,`getState`);var I=e.p`
2
2
  font-size: 13px;
3
3
  color: ${({theme:e})=>e.color.inkDim};
4
4
  `;function L({open:e,onOpenChange:t,title:r,body:i,confirmLabel:a,busy:o,onConfirm:s}){return(0,v.jsx)(f,{open:e,onOpenChange:t,title:r,width:`420px`,footer:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(n,{type:`button`,onClick:()=>t(!1),children:`Cancel`}),(0,v.jsx)(n,{type:`button`,$variant:`danger`,disabled:o===!0,onClick:s,children:a})]}),children:(0,v.jsx)(I,{children:i})})}var R=e(k)`
@@ -1 +1 @@
1
- import{Dt as e}from"./queries-vY5lJqBe.js";import{o as t}from"./index-DnNTc35a.js";import{i as n,n as r}from"./Rack-DANVhi_U.js";var i=e(),a=()=>(0,i.jsx)(n,{children:(0,i.jsx)(r,{children:(0,i.jsx)(t,{})})});export{a as component};
1
+ import{Dt as e}from"./queries-vY5lJqBe.js";import{o as t}from"./index--dA3FFSN.js";import{i as n,n as r}from"./Rack-uDxrjvaz.js";var i=e(),a=()=>(0,i.jsx)(n,{children:(0,i.jsx)(r,{children:(0,i.jsx)(t,{})})});export{a as component};
@@ -0,0 +1,51 @@
1
+ import{A as e,B as t,D as n,Dt as r,F as i,I as a,Kt as o,M as s,Ot as c,S as l,c as u,i as d,k as f,o as p,r as m,s as h,t as g,y as _}from"./queries-vY5lJqBe.js";import{a as v,d as y,l as b,m as x,t as S}from"./Rack-uDxrjvaz.js";import{t as C}from"./CopyValue-bzKz2tiJ.js";import{n as w,r as T,t as ee}from"./Toggle-D0e4C94X.js";import{t as E}from"./trash-2-Cep_aVLx.js";import{t as D}from"./Modal-Crr8uyWt.js";import{a as O,c as te,i as ne,n as re,s as k,t as A}from"./Lamp-WOotyOTd.js";import{t as j}from"./Chip-D0YiqYkz.js";import{i as M,n as N,r as P,t as F}from"./Field-DdscQ9OO.js";import{t as ie}from"./Meter-Bm1oQE2U.js";import{a as I,i as L,n as R,r as z,t as B}from"./States-DPTTYUHL.js";import{i as V,n as H,r as U,t as W}from"./Table-LkPaHBsj.js";import{t as G}from"./catalog-DVRPlBJJ.js";var K=x(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),q=o(c(),1),J=r(),ae=Object.keys(G),Y={anthropic:`Anthropic`,openai:`OpenAI`,kimi:`Kimi`},X={anthropic:`Authorize in the browser, then paste the code Anthropic shows you.`,openai:`Authorize in the browser. When it redirects to localhost, paste the whole URL.`,kimi:`Enter the code on Kimi's device page. This dialog finishes on its own.`},oe=t.ol`
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: ${({theme:e})=>e.space(3)};
5
+ `,se=t.div`
6
+ font-family: ${({theme:e})=>e.font.mono};
7
+ font-size: 26px;
8
+ letter-spacing: 0.22em;
9
+ text-align: center;
10
+ padding: ${({theme:e})=>e.space(3)};
11
+ background: ${({theme:e})=>e.color.panelSunk};
12
+ border: 1px solid ${({theme:e})=>e.color.ruleStrong};
13
+ border-radius: ${({theme:e})=>e.radius.control};
14
+ `,ce=t.p`
15
+ font-size: 12px;
16
+ color: ${({theme:e})=>e.color.down};
17
+ `,le=t.p`
18
+ font-size: 12px;
19
+ color: ${({theme:e})=>e.color.inkDim};
20
+ `;function ue({open:e,onOpenChange:t,onConnected:r}){let[a,o]=(0,q.useState)(`anthropic`),[c,l]=(0,q.useState)(``),[u,p]=(0,q.useState)(null),[h,_]=(0,q.useState)(``),[v,y]=(0,q.useState)(null),b=d(),x=m(),S=(0,q.useCallback)(()=>{p(null),_(``),y(null),l(``),b.reset(),x.reset()},[b,x]),w=(0,q.useCallback)(e=>{e||S(),t(e)},[t,S]);return(0,q.useEffect)(()=>{if(u===null||u.kind!==`device`)return;let e=!1,n=async()=>{try{let n=await g(u.flowId);if(e)return;if(n.status===`complete`){S(),t(!1),r();return}}catch(t){if(e)return;y(L(t)),p(null);return}e||(i=setTimeout(()=>void n(),u.pollIntervalMs))},i=setTimeout(()=>void n(),u.pollIntervalMs);return()=>{e=!0,clearTimeout(i)}},[u,r,t,S]),(0,J.jsx)(D,{open:e,onOpenChange:w,title:`Connect an account`,description:`The gateway stores the resulting token encrypted. It is never shown again after this dialog.`,footer:u===null?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(i,{type:`button`,onClick:()=>w(!1),children:`Cancel`}),(0,J.jsx)(i,{type:`button`,$variant:`primary`,disabled:b.isPending,onClick:()=>{y(null),b.mutate({provider:a,label:c.trim().length===0?Y[a]:c.trim()},{onSuccess:e=>p(e),onError:e=>y(L(e))})},children:b.isPending?`Starting…`:`Start authorization`})]}):u.kind===`device`?(0,J.jsx)(i,{type:`button`,onClick:()=>w(!1),children:`Cancel`}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(i,{type:`button`,onClick:()=>w(!1),children:`Cancel`}),(0,J.jsx)(i,{type:`button`,$variant:`primary`,disabled:x.isPending||h.trim().length===0,onClick:()=>{u!==null&&(y(null),x.mutate({flowId:u.flowId,code:h.trim()},{onSuccess:()=>{S(),t(!1),r()},onError:e=>y(L(e))}))},children:x.isPending?`Finishing…`:`Finish connecting`})]}),children:(0,J.jsxs)(oe,{children:[u===null?(0,J.jsxs)(s,{$gap:3,children:[(0,J.jsx)(F,{label:`Provider`,children:e=>(0,J.jsx)(M,{...e,value:a,onChange:e=>o(e.target.value),children:ae.map(e=>(0,J.jsx)(`option`,{value:e,children:Y[e]},e))})}),(0,J.jsx)(F,{label:`Label`,hint:`How this account is named in the rack. Defaults to the provider.`,children:e=>(0,J.jsx)(N,{...e,value:c,placeholder:Y[a],onChange:e=>l(e.target.value)})})]}):(0,J.jsxs)(s,{$gap:3,children:[(0,J.jsxs)(s,{$gap:1,children:[(0,J.jsx)(n,{children:`Step 1 — authorize`}),(0,J.jsx)(f,{$gap:2,children:(0,J.jsxs)(i,{as:`a`,href:u.authorizeUrl,target:`_blank`,rel:`noreferrer noopener`,$variant:`primary`,$size:`sm`,children:[(0,J.jsx)(K,{}),`Open `,Y[a]]})}),(0,J.jsx)(C,{value:u.authorizeUrl,label:`Copy authorization link`})]}),u.userCode===null?null:(0,J.jsxs)(s,{$gap:1,children:[(0,J.jsx)(n,{children:`Step 2 — enter this code`}),(0,J.jsx)(se,{children:u.userCode})]}),u.kind===`device`?(0,J.jsxs)(le,{children:[X[a],` Waiting for authorization…`]}):(0,J.jsx)(F,{label:`Authorization code`,hint:X[a],...v===null?{}:{problem:v},children:e=>(0,J.jsx)(N,{...e,value:h,autoFocus:!0,placeholder:a===`openai`?`http://localhost:1455/auth/callback?code=…`:`code#state`,onChange:e=>_(e.target.value)})})]}),v===null||u?.kind===`pkce`?null:(0,J.jsx)(ce,{children:v})]})})}var de=[`anthropic`,`openai`,`kimi`],Z={anthropic:`Anthropic`,openai:`OpenAI`,kimi:`Kimi`},fe=t(I)`
21
+ border-left: 3px solid ${({theme:e,$provider:t})=>e.provider[t]};
22
+ `,pe=t(N)`
23
+ width: 100%;
24
+ min-width: 140px;
25
+ height: 26px;
26
+ font-family: ${({theme:e})=>e.font.sans};
27
+ font-size: 12.5px;
28
+ background: transparent;
29
+ border-color: transparent;
30
+
31
+ &:hover:not(:disabled),
32
+ &:focus {
33
+ background: ${({theme:e})=>e.color.panelSunk};
34
+ border-color: ${({theme:e})=>e.color.ruleStrong};
35
+ }
36
+ `,Q=t(P)`
37
+ width: 62px;
38
+ height: 26px;
39
+ `,me=t.span`
40
+ display: block;
41
+ padding-left: 9px;
42
+ font-size: 11px;
43
+ color: ${({theme:e})=>e.color.inkDim};
44
+ `,he=t(f)`
45
+ min-width: 130px;
46
+ gap: 6px;
47
+ `,ge=t.div`
48
+ display: flex;
49
+ flex-direction: column;
50
+ gap: 4px;
51
+ `;function $(){let e=l();return{pending:e.isPending,commit:(t,n)=>{e.mutate({id:t,patch:n})}}}function _e(){let{cadence:t}=v(),r=h(),o=p(t(1e4)),c=_(),l=u(),{commit:d}=$(),[m,g]=(0,q.useState)(!1),[x,C]=(0,q.useState)(null),D=Date.now(),M=r.data??[],N=O(o.data?.health??[],e=>e.credentialId),P=O(o.data?.quota??[],e=>e.credentialId),F=c.data?.quotaPollIntervalMs??3e5,L=M.filter(e=>e.enabled).length,G=r.isLoading?`Reading connected accounts…`:M.length===0?`No provider credentials are connected, so every request fails at the router.`:`${L} of ${M.length} accounts are enabled and eligible for routing.`;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(S,{legend:`Accounts`,title:`Provider accounts`,summary:G,actions:(0,J.jsxs)(i,{type:`button`,$variant:`primary`,onClick:()=>g(!0),children:[(0,J.jsx)(T,{}),`Connect an account`]})}),r.isError?(0,J.jsx)(I,{legend:`Accounts`,children:(0,J.jsx)(R,{error:r.error,onRetry:()=>void r.refetch()})}):r.isLoading?(0,J.jsx)(I,{legend:`Accounts`,children:(0,J.jsx)(z,{rows:5})}):M.length===0?(0,J.jsx)(I,{legend:`Accounts`,children:(0,J.jsx)(B,{legend:`Nothing connected`,message:`Connect a provider account to give the router something to dispatch to. Tokens are encrypted at rest and never shown again.`,action:(0,J.jsx)(i,{type:`button`,$variant:`primary`,$size:`sm`,onClick:()=>g(!0),children:`Connect an account`})})}):(0,J.jsx)(s,{$gap:4,children:de.filter(e=>M.some(t=>t.provider===e)).map(t=>{let r=M.filter(e=>e.provider===t);return(0,J.jsx)(fe,{$provider:t,legend:Z[t],meta:`${r.length} account${r.length===1?``:`s`}`,flush:!0,children:(0,J.jsx)(e,{children:(0,J.jsxs)(W,{children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(U,{$width:`24%`,children:`Account`}),(0,J.jsx)(U,{$width:`20%`,children:`Sign-in`}),(0,J.jsx)(U,{$align:`right`,$width:`86px`,children:`Tier`}),(0,J.jsx)(U,{$align:`right`,$width:`94px`,children:`Weight`}),(0,J.jsx)(U,{$align:`center`,$width:`86px`,children:`Enabled`}),(0,J.jsx)(U,{$width:`160px`,children:`Quota`}),(0,J.jsx)(U,{$align:`right`,$width:`88px`,children:`TTFT`}),(0,J.jsx)(U,{$align:`right`,$width:`130px`,children:`Token expires`}),(0,J.jsx)(U,{$width:`48px`})]})}),(0,J.jsx)(`tbody`,{children:r.map(e=>{let t=ne(N.get(e.id)??[],D,e.enabled,e.disabledReason),r=te(P.get(e.id)??[]);return(0,J.jsxs)(V,{children:[(0,J.jsxs)(H,{children:[(0,J.jsxs)(f,{$gap:2,children:[(0,J.jsx)(A,{state:t.state,label:t.note===``?`healthy`:t.note}),(0,J.jsx)(pe,{defaultValue:e.label,"aria-label":`Label for ${e.label}`,onBlur:t=>{let n=t.target.value.trim();if(n.length===0||n===e.label){t.target.value=e.label;return}d(e.id,{label:n})}})]}),t.note===``?null:(0,J.jsx)(me,{children:t.note})]}),(0,J.jsx)(H,{children:(0,J.jsxs)(f,{$gap:1,children:[(0,J.jsx)(j,{children:e.authType===`oauth`?`oauth`:`api key`}),e.accountEmail===null?null:(0,J.jsx)(n,{children:e.accountEmail})]})}),(0,J.jsx)(H,{$align:`right`,children:(0,J.jsx)(Q,{min:1,step:1,defaultValue:e.tier,"aria-label":`Tier for ${e.label}`,onBlur:t=>{let n=Number(t.target.value);if(!Number.isInteger(n)||n<1||n===e.tier){t.target.value=String(e.tier);return}d(e.id,{tier:n})}})}),(0,J.jsx)(H,{$align:`right`,children:(0,J.jsx)(Q,{min:.1,step:.1,defaultValue:e.weight,"aria-label":`Weight for ${e.label}`,onBlur:t=>{let n=Number(t.target.value);if(!Number.isFinite(n)||n<=0||n===e.weight){t.target.value=String(e.weight);return}d(e.id,{weight:n})}})}),(0,J.jsx)(H,{$align:`center`,children:(0,J.jsx)(ee,{checked:e.enabled,label:`Route to ${e.label}`,onCheckedChange:t=>d(e.id,{enabled:t})})}),(0,J.jsx)(H,{children:r.length===0?(0,J.jsx)(n,{children:`unknown`}):(0,J.jsx)(ge,{children:r.map(({window:e,fraction:t})=>(0,J.jsxs)(he,{children:[(0,J.jsx)(ie,{fraction:t,label:`${re[e.windowType]} window, ${Math.round(t*100)}% used`}),(0,J.jsx)(n,{children:k(e,D,F,y)})]},e.windowType))})}),(0,J.jsx)(H,{$align:`right`,$mono:!0,children:b(t.ttftMs)}),(0,J.jsx)(H,{$align:`right`,$mono:!0,children:e.expiresAt===null?`never`:y(e.expiresAt,D)}),(0,J.jsx)(H,{$align:`right`,children:(0,J.jsx)(a,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Remove ${e.label}`,title:`Remove ${e.label}`,onClick:()=>C(e),children:(0,J.jsx)(E,{})})})]},e.id)})})]})})},t)})}),(0,J.jsx)(ue,{open:m,onOpenChange:g,onConnected:()=>void r.refetch()}),(0,J.jsx)(w,{open:x!==null,onOpenChange:e=>{e||C(null)},title:`Remove account`,body:x===null?``:`Removing "${x.label}" deletes its stored token. Any model target pointing at ${Z[x.provider]} loses this account, and reconnecting means authorizing again.`,confirmLabel:`Remove account`,busy:l.isPending,onConfirm:()=>{x!==null&&l.mutate(x.id,{onSettled:()=>C(null)})}})]})}var ve=_e;export{ve as component};
@@ -0,0 +1,61 @@
1
+ import{A as e,B as t,C as n,D as r,Dt as i,E as a,F as o,H as s,M as c,N as l,O as u,h as d,j as f,k as p,m,o as h,s as g,y as _}from"./queries-vY5lJqBe.js";import{a as v,d as y,f as b,l as x,o as S,r as C,s as w,t as T,u as E}from"./Rack-uDxrjvaz.js";import{a as D,c as O,i as k,l as ee,n as A,o as j,r as M,s as N,t as P}from"./Lamp-WOotyOTd.js";import{n as F,t as I}from"./Chip-D0YiqYkz.js";import{t as L}from"./Meter-Bm1oQE2U.js";import{a as R,n as z,t as B}from"./States-DPTTYUHL.js";import{i as V,n as H,r as U,t as W}from"./Table-LkPaHBsj.js";import{t as G}from"./Readout-CYg6UOop.js";var K=i(),q=t(l)`
2
+ font-weight: 500;
3
+ display: block;
4
+ max-width: 24ch;
5
+ `,J=t.span`
6
+ font-size: 11px;
7
+ color: ${({theme:e})=>e.color.inkDim};
8
+ `,Y=t.div`
9
+ display: flex;
10
+ align-items: center;
11
+ gap: 6px;
12
+ width: 118px;
13
+ `,te=t.div`
14
+ display: flex;
15
+ flex-direction: column;
16
+ gap: 4px;
17
+ `;function X({credentials:t,health:n,quota:i,usage:a,quotaPollIntervalMs:c,now:l}){let u=D(n,e=>e.credentialId),d=D(i,e=>e.credentialId),f=new Map(a.map(e=>[e.key,e])),m={down:0,warn:1,ok:2,idle:3},h=t.map(e=>({credential:e,status:k(u.get(e.id)??[],l,e.enabled,e.disabledReason),quota:O(d.get(e.id)??[]),usage:f.get(e.id)})).sort((e,t)=>m[e.status.state]-m[t.status.state]||e.credential.tier-t.credential.tier);return(0,K.jsx)(R,{legend:`Accounts`,meta:`${t.length} connected`,flush:!0,actions:(0,K.jsx)(o,{as:s,to:`/accounts`,$size:`sm`,children:`Manage accounts`}),children:t.length===0?(0,K.jsx)(B,{legend:`No accounts`,message:`The gateway has no provider credentials, so every request will fail. Connect one to start routing.`,action:(0,K.jsx)(o,{as:s,to:`/accounts`,$variant:`primary`,$size:`sm`,children:`Connect an account`})}):(0,K.jsx)(e,{children:(0,K.jsxs)(W,{children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(U,{children:`Account`}),(0,K.jsx)(U,{children:`Provider`}),(0,K.jsx)(U,{$align:`right`,children:`Tier`}),(0,K.jsx)(U,{children:`Quota`}),(0,K.jsx)(U,{$align:`right`,children:`TTFT`}),(0,K.jsx)(U,{$align:`right`,children:`Requests`}),(0,K.jsx)(U,{$align:`right`,children:`Last used`})]})}),(0,K.jsx)(`tbody`,{children:h.map(({credential:e,status:t,quota:n,usage:i})=>(0,K.jsxs)(V,{children:[(0,K.jsx)(H,{children:(0,K.jsxs)(p,{$gap:2,children:[(0,K.jsx)(P,{state:t.state,label:t.note===``?`healthy`:t.note}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(q,{children:e.label}),t.note===``?null:(0,K.jsx)(J,{children:t.note})]})]})}),(0,K.jsx)(H,{children:(0,K.jsx)(F,{provider:e.provider})}),(0,K.jsx)(H,{$align:`right`,$mono:!0,children:e.tier}),(0,K.jsx)(H,{children:n.length===0?(0,K.jsx)(J,{children:`unknown`}):(0,K.jsx)(te,{children:n.map(({window:e,fraction:t})=>(0,K.jsxs)(Y,{children:[(0,K.jsx)(L,{fraction:t,label:`${A[e.windowType]} window, ${Math.round(t*100)}% used`}),(0,K.jsx)(r,{children:N(e,l,c,y)})]},e.windowType))})}),(0,K.jsx)(H,{$align:`right`,$mono:!0,children:x(t.ttftMs)}),(0,K.jsx)(H,{$align:`right`,$mono:!0,children:i===void 0?`—`:w(i.requests)}),(0,K.jsx)(H,{$align:`right`,$mono:!0,children:y(t.lastUsedAt,l)})]},e.id))})]})})})}var Z=t.ul`
18
+ display: flex;
19
+ flex-direction: column;
20
+ `,Q=t.li`
21
+ display: flex;
22
+ align-items: center;
23
+ gap: ${({theme:e})=>e.space(2)};
24
+ padding: 6px ${({theme:e})=>e.space(3)};
25
+ border-bottom: 1px solid ${({theme:e})=>e.color.rule};
26
+
27
+ &:last-child {
28
+ border-bottom: 0;
29
+ }
30
+ `,ne=t(l)`
31
+ font-family: ${({theme:e})=>e.font.mono};
32
+ font-size: 12px;
33
+ max-width: 30ch;
34
+ `,re=t(u)`
35
+ color: ${({theme:e})=>e.color.down};
36
+ font-size: 11px;
37
+ `;function ie({logs:e}){let t=e.slice(0,12);return(0,K.jsx)(R,{legend:`Activity`,meta:`most recent first`,flush:!0,actions:(0,K.jsx)(o,{as:s,to:`/logs`,$size:`sm`,children:`Open logs`}),children:t.length===0?(0,K.jsx)(B,{legend:`No traffic yet`,message:`Point a client at this gateway with an API key and the requests will appear here.`}):(0,K.jsx)(Z,{children:t.map(e=>(0,K.jsxs)(Q,{children:[(0,K.jsx)(P,{state:j(e)?`down`:`ok`,label:j(e)?`failed with ${e.status}`:`succeeded`}),(0,K.jsx)(u,{$dim:!0,children:S(e.at)}),(0,K.jsx)(ne,{title:e.requestedModel,children:e.requestedModel||`—`}),e.resolvedProvider===null?null:(0,K.jsx)(u,{$dim:!0,style:{color:`var(--p-${e.resolvedProvider})`},children:e.resolvedProvider}),(0,K.jsx)(f,{}),e.errorCode===null?null:(0,K.jsx)(re,{children:e.errorCode}),e.attempts>1?(0,K.jsxs)(u,{$dim:!0,children:[e.attempts,`×`]}):null,(0,K.jsx)(u,{$dim:!0,children:x(e.durationMs)}),(0,K.jsx)(u,{$dim:!0,children:b(e.costUsd)})]},e.id))})})}var ae=t.ul`
38
+ display: flex;
39
+ flex-direction: column;
40
+ gap: ${({theme:e})=>e.space(3)};
41
+ `,oe=t(l)`
42
+ font-family: ${({theme:e})=>e.font.mono};
43
+ font-size: 12.5px;
44
+ `,se=t.div`
45
+ display: flex;
46
+ height: 5px;
47
+ border-radius: 2px;
48
+ overflow: hidden;
49
+ background: ${({theme:e})=>e.color.panelSunk};
50
+ border: 1px solid ${({theme:e})=>e.color.rule};
51
+ `,ce=t.div`
52
+ flex: ${({$grow:e})=>e} 0 0;
53
+ background: ${({$color:e})=>e};
54
+ opacity: 0.8;
55
+ `,le=t.div`
56
+ flex: ${({$grow:e})=>e} 0 0;
57
+ `;function ue({models:e,logs:t}){let n=new Map;for(let e of t){let t=n.get(e.requestedModel)??{requests:0,costUsd:0};t.requests+=1,t.costUsd+=e.costUsd,n.set(e.requestedModel,t)}let i=Math.max(1,...[...n.values()].map(e=>e.requests)),a=[...e].map(e=>({model:e,used:n.get(e.id)})).sort((e,t)=>(t.used?.requests??0)-(e.used?.requests??0)).slice(0,8);return(0,K.jsx)(R,{legend:`Models`,meta:`${e.length} configured`,actions:(0,K.jsx)(o,{as:s,to:`/models`,$size:`sm`,children:`Edit routing`}),children:e.length===0?(0,K.jsx)(B,{legend:`No models`,message:`Nothing is routable yet. Create a virtual model and point it at one or more provider targets.`,action:(0,K.jsx)(o,{as:s,to:`/models`,$variant:`primary`,$size:`sm`,children:`Create a model`})}):(0,K.jsx)(ae,{children:a.map(({model:e,used:t})=>{let n=(t?.requests??0)/i,a=[...new Set(e.targets.map(e=>e.provider))];return(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(p,{$gap:2,children:[(0,K.jsx)(oe,{title:e.id,children:e.id}),e.isAlias?(0,K.jsx)(I,{children:`alias`}):null,(0,K.jsx)(I,{$tone:`accent`,children:e.strategy}),(0,K.jsx)(f,{}),(0,K.jsx)(u,{$dim:!0,children:w(t?.requests??0)}),(0,K.jsx)(r,{children:`req`}),(0,K.jsx)(u,{$dim:!0,children:b(t?.costUsd??0)})]}),(0,K.jsxs)(se,{style:{marginTop:6},title:`${Math.round(n*100)}% of the busiest model`,children:[a.map(e=>(0,K.jsx)(ce,{$color:`var(--p-${e})`,$grow:n/a.length},e)),(0,K.jsx)(le,{$grow:Math.max(0,1-n)})]})]},e.id)})})})}var de=t.div`
58
+ display: grid;
59
+ grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
60
+ gap: ${({theme:e})=>e.space(3)};
61
+ `;function fe({logs:e,windowMs:t,now:n}){let r=e.filter(e=>n-e.at<=t),i=ee(r,t),a=M(r,{now:n,spanMs:t,count:32}),o=i.errorRate>=.25?`down`:i.errorRate>=.05?`warn`:`ok`;return(0,K.jsxs)(de,{children:[(0,K.jsx)(G,{legend:`Requests`,value:w(i.requests),unit:`${i.ratePerMin.toFixed(1)}/min`,trace:(0,K.jsx)(C,{values:a.map(e=>e.total),overlay:a.map(e=>e.errors),label:`${i.requests} requests, ${i.errors} of them failed`})}),(0,K.jsx)(G,{legend:`Error rate`,value:E(i.errorRate),unit:`${w(i.errors)} failed`,tone:i.requests===0?`ink`:o,trace:(0,K.jsx)(C,{values:a.map(e=>e.errors),scaleTo:Math.max(...a.map(e=>e.total)),color:`var(--down)`,label:`${i.errors} failed requests against ${i.requests} total`})}),(0,K.jsx)(G,{legend:`Time to first token`,value:x(i.ttftP50),unit:`p95 ${x(i.ttftP95)}`,trace:(0,K.jsx)(C,{values:a.map(e=>e.ttftMs??0),color:`var(--ok)`,label:`median first-token latency, currently ${x(i.ttftP50)}`})}),(0,K.jsx)(G,{legend:`Spend`,value:b(i.costUsd),unit:`${w(i.inputTokens+i.outputTokens)} tokens`,trace:(0,K.jsx)(C,{values:a.map(e=>e.costUsd),color:`var(--warn)`,label:`spend over the window, ${b(i.costUsd)} total`})})]})}var $=36e5;function pe(){let{cadence:e}=v(),t=g(),r=h(e(1e4)),i=d(),o=m(500,e(1e4)),s=_(),l=Date.now(),u=Math.floor((l-$)/6e4)*6e4,f=n({groupBy:`credential`,since:u},e(6e4)),p=t.data??[],y=D(r.data?.health??[],e=>e.credentialId),b=p.filter(e=>k(y.get(e.id)??[],l,e.enabled,e.disabledReason).state===`down`),x=t.isLoading||o.isLoading?`Reading the gateway…`:p.length===0?`No accounts are connected, so every request fails at the router.`:b.length>0?`${b.length} account${b.length===1?` is`:`s are`} out of rotation.`:`All ${p.length} accounts are answering. Nothing needs attention.`;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(T,{legend:`Rack`,title:`Gateway`,summary:x}),o.isError?(0,K.jsx)(R,{legend:`Traffic`,children:(0,K.jsx)(z,{legend:`The gateway did not answer`,error:o.error,onRetry:()=>void o.refetch()})}):(0,K.jsxs)(c,{$gap:4,children:[(0,K.jsx)(fe,{logs:o.data??[],windowMs:$,now:l}),(0,K.jsx)(X,{credentials:p,health:r.data?.health??[],quota:r.data?.quota??[],usage:f.data??[],quotaPollIntervalMs:s.data?.quotaPollIntervalMs??3e5,now:l}),(0,K.jsxs)(a,{$min:`340px`,$gap:4,children:[(0,K.jsx)(ue,{models:i.data??[],logs:o.data??[]}),(0,K.jsx)(ie,{logs:o.data??[]})]})]})]})}var me=pe;export{me as component};
@@ -1,4 +1,4 @@
1
- import{A as e,B as t,D as n,Dt as r,F as i,Kt as a,M as o,N as s,O as c,Ot as l,a as u,d,g as f,h as p,k as m}from"./queries-vY5lJqBe.js";import{c as h,t as g}from"./Rack-DANVhi_U.js";import{t as _}from"./CopyValue-BwjFnqW2.js";import{n as v,r as y,t as b}from"./Toggle-pWcL2A-N.js";import{t as x}from"./Modal-1tHwlj0o.js";import{t as S}from"./Chip-D0YiqYkz.js";import{n as C,t as w}from"./Field-DdscQ9OO.js";import{a as T,i as E,n as D,r as O,t as k}from"./States-DPTTYUHL.js";import{i as A,n as j,r as M,t as N}from"./Table-LkPaHBsj.js";var P=a(l(),1),F=r(),I=t.div`
1
+ import{A as e,B as t,D as n,Dt as r,F as i,Kt as a,M as o,N as s,O as c,Ot as l,a as u,d,g as f,h as p,k as m}from"./queries-vY5lJqBe.js";import{c as h,t as g}from"./Rack-uDxrjvaz.js";import{t as _}from"./CopyValue-bzKz2tiJ.js";import{n as v,r as y,t as b}from"./Toggle-D0e4C94X.js";import{t as x}from"./Modal-Crr8uyWt.js";import{t as S}from"./Chip-D0YiqYkz.js";import{n as C,t as w}from"./Field-DdscQ9OO.js";import{a as T,i as E,n as D,r as O,t as k}from"./States-DPTTYUHL.js";import{i as A,n as j,r as M,t as N}from"./Table-LkPaHBsj.js";var P=a(l(),1),F=r(),I=t.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 2px;
@@ -1,4 +1,4 @@
1
- import{A as e,B as t,D as n,Dt as r,F as i,Kt as a,M as o,N as s,O as c,Ot as l,k as u,m as d,s as f}from"./queries-vY5lJqBe.js";import{a as p,c as m,f as h,l as g,o as _,p as v,s as y,t as b}from"./Rack-DANVhi_U.js";import{t as x}from"./Modal-1tHwlj0o.js";import{o as S,t as C}from"./Lamp-CSv_5d5k.js";import{n as w,t as T}from"./Chip-D0YiqYkz.js";import{i as E,n as D}from"./Field-DdscQ9OO.js";import{a as O,n as k,r as A,t as j}from"./States-DPTTYUHL.js";import{i as M,n as N,r as P,t as F}from"./Table-LkPaHBsj.js";var I=a(l(),1),L=r(),R=[50,100,250,500],z=t(u)`
1
+ import{A as e,B as t,D as n,Dt as r,F as i,Kt as a,M as o,N as s,O as c,Ot as l,k as u,m as d,s as f}from"./queries-vY5lJqBe.js";import{a as p,c as m,f as h,l as g,o as _,p as v,s as y,t as b}from"./Rack-uDxrjvaz.js";import{t as x}from"./Modal-Crr8uyWt.js";import{o as S,t as C}from"./Lamp-WOotyOTd.js";import{n as w,t as T}from"./Chip-D0YiqYkz.js";import{i as E,n as D}from"./Field-DdscQ9OO.js";import{a as O,n as k,r as A,t as j}from"./States-DPTTYUHL.js";import{i as M,n as N,r as P,t as F}from"./Table-LkPaHBsj.js";var I=a(l(),1),L=r(),R=[50,100,250,500],z=t(u)`
2
2
  gap: ${({theme:e})=>e.space(2)};
3
3
  flex-wrap: wrap;
4
4
  `,B=t(D)`
@@ -1,4 +1,4 @@
1
- import{B as e,D as t,Dt as n,F as r,I as i,Kt as a,M as o,N as s,O as c,Ot as l,_ as u,h as d,j as f,k as p,l as m,u as h,y as g}from"./queries-vY5lJqBe.js";import{m as _,t as v}from"./Rack-DANVhi_U.js";import{n as y,r as b,t as x}from"./Toggle-pWcL2A-N.js";import{n as S,r as C,t as w}from"./catalog-DmrbfYQe.js";import{n as ee,t as T}from"./Chip-D0YiqYkz.js";import{i as E,n as D,r as O,t as k}from"./Field-DdscQ9OO.js";import{t as te}from"./Meter-Bm1oQE2U.js";import{a as A,i as j,n as ne,r as M,t as N}from"./States-DPTTYUHL.js";var re=_(`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`}]]),P=_(`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`}]]),F=a(l(),1),I=n(),L=[`tier`,`health`,`quota`,`cost`,`latency`,`recency`],ie={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 against the other candidates`,latency:`Observed time to first token`,recency:`How long this pair has been idle`},ae=e.li`
1
+ import{B as e,D as t,Dt as n,F as r,I as i,Kt as a,M as o,N as s,O as c,Ot as l,_ as u,h as d,j as f,k as p,l as m,u as h,y as g}from"./queries-vY5lJqBe.js";import{m as _,t as v}from"./Rack-uDxrjvaz.js";import{n as y,r as b,t as x}from"./Toggle-D0e4C94X.js";import{t as S}from"./trash-2-Cep_aVLx.js";import{n as C,t as w}from"./Chip-D0YiqYkz.js";import{i as T,n as E,r as D,t as O}from"./Field-DdscQ9OO.js";import{t as ee}from"./Meter-Bm1oQE2U.js";import{a as k,i as A,n as te,r as j,t as M}from"./States-DPTTYUHL.js";import{n as ne,t as N}from"./catalog-DVRPlBJJ.js";var re=_(`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`}]]),P=_(`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`}]]),F=a(l(),1),I=n(),L=[`tier`,`health`,`quota`,`cost`,`latency`,`recency`],ie={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 against the other candidates`,latency:`Observed time to first token`,recency:`How long this pair has been idle`},ae=e.li`
2
2
  padding: ${({theme:e})=>e.space(2)} 0;
3
3
  border-bottom: 1px solid ${({theme:e})=>e.color.rule};
4
4
 
@@ -9,7 +9,7 @@ import{B as e,D as t,Dt as n,F as r,I as i,Kt as a,M as o,N as s,O as c,Ot as l,
9
9
  width: 22px;
10
10
  color: ${({theme:e})=>e.color.inkFaint};
11
11
  flex: none;
12
- `,se=e(T)`
12
+ `,se=e(w)`
13
13
  border-color: ${({theme:e})=>e.color.ok};
14
14
  color: ${({theme:e})=>e.color.ok};
15
15
  background: ${({theme:e})=>e.color.okWash};
@@ -46,7 +46,7 @@ import{B as e,D as t,Dt as n,F as r,I as i,Kt as a,M as o,N as s,O as c,Ot as l,
46
46
  `,z=e.p`
47
47
  font-size: 12px;
48
48
  color: ${({theme:e})=>e.color.down};
49
- `;function B(e,t,n){return(e[t]??0)*n[t]}function V({modelId:e}){let[n,i]=(0,F.useState)({tools:!1,images:!1,reasoning:!1}),[a,l]=(0,F.useState)(null),[u,d]=(0,F.useState)(null),m=g(),_=h(),v=m.data?.weights,y=()=>{e!==null&&(d(null),_.mutate({modelId:e,need:n},{onSuccess:e=>l(e),onError:e=>{l(null),d(j(e))}}))},b=new Map(L.map(e=>[e,Math.max(1e-4,...(a?.candidates??[]).map(t=>v===void 0?0:Math.abs(B(t.reasons,e,v))))]));return(0,I.jsx)(A,{legend:`Explain`,meta:e??`no model selected`,actions:(0,I.jsxs)(r,{type:`button`,$size:`sm`,$variant:`primary`,disabled:e===null||_.isPending,onClick:y,children:[(0,I.jsx)(re,{}),_.isPending?`Ranking…`:`Rank candidates`]}),children:(0,I.jsxs)(o,{$gap:3,children:[(0,I.jsxs)(o,{$gap:1,children:[(0,I.jsx)(t,{children:`Pretend the request needs`}),(0,I.jsxs)(fe,{children:[(0,I.jsxs)(R,{children:[(0,I.jsx)(x,{checked:n.tools,label:`Probe request uses tools`,onCheckedChange:e=>i({...n,tools:e})}),`Tools`]}),(0,I.jsxs)(R,{children:[(0,I.jsx)(x,{checked:n.images,label:`Probe request includes an image`,onCheckedChange:e=>i({...n,images:e})}),`Images`]}),(0,I.jsxs)(R,{children:[(0,I.jsx)(x,{checked:n.reasoning,label:`Probe request asks for reasoning`,onCheckedChange:e=>i({...n,reasoning:e})}),`Reasoning`]})]})]}),u===null?null:(0,I.jsx)(z,{children:u}),a===null?(0,I.jsx)(N,{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.`}):(0,I.jsxs)(o,{$gap:3,children:[(0,I.jsxs)(p,{$gap:2,$wrap:!0,children:[(0,I.jsx)(T,{$tone:`accent`,children:a.strategy}),a.deterministic?null:(0,I.jsx)(T,{$tone:`warn`,children:`order varies per request`}),(0,I.jsx)(f,{}),(0,I.jsxs)(t,{children:[a.candidates.length,` eligible · `,a.excluded.length,` filtered out`]})]}),a.candidates.length===0?(0,I.jsx)(N,{legend:`Nothing eligible`,message:`Every target was filtered out. The reasons below say which rule removed each one.`}):(0,I.jsx)(`ul`,{children:a.candidates.map((e,n)=>(0,I.jsxs)(ae,{children:[(0,I.jsxs)(p,{$gap:2,children:[(0,I.jsx)(oe,{children:n+1}),(0,I.jsx)(ee,{provider:e.provider}),(0,I.jsx)(s,{style:{maxWidth:`22ch`},children:e.credentialLabel}),(0,I.jsx)(c,{$dim:!0,children:e.model}),(0,I.jsxs)(T,{children:[`tier `,e.tier]}),(0,I.jsx)(f,{}),n===0?(0,I.jsx)(se,{children:`would be used`}):null,(0,I.jsx)(c,{children:e.score.toFixed(2)})]}),v===void 0?null:(0,I.jsx)(ce,{children:L.map(n=>{let r=B(e.reasons,n,v),i=b.get(n)??1;return(0,I.jsxs)(le,{title:ie[n],children:[(0,I.jsxs)(ue,{children:[(0,I.jsx)(t,{children:n}),(0,I.jsx)(c,{$dim:!0,$size:`10.5px`,children:r.toFixed(2)})]}),(0,I.jsx)(te,{fraction:Math.abs(r)/i,height:4,tone:`var(--accent)`,label:`${n} contributes ${r.toFixed(2)} of ${e.score.toFixed(2)}`})]},n)})})]},`${e.credentialId}:${e.model}`))}),a.excluded.length===0?null:(0,I.jsxs)(o,{$gap:1,children:[(0,I.jsx)(t,{children:`Filtered out`}),(0,I.jsx)(`ul`,{children:a.excluded.map(e=>(0,I.jsxs)(de,{children:[(0,I.jsx)(c,{$dim:!0,children:e.model}),(0,I.jsx)(f,{}),(0,I.jsx)(T,{$tone:e.reason.startsWith(`capability`)?`warn`:`down`,children:e.reason})]},`${e.credentialId}:${e.model}:${e.reason}`))})]})]})]})})}var H=[{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.`}],U=0;function W(){return U+=1,`target-${U}`}function G(e,t){let n=S(e,t);return n===null?null:{costInput:String(n.input),costOutput:String(n.output),costCacheRead:String(n.cacheRead)}}function K(e=`anthropic`){let t=w[e].defaultModel,n=G(e,t);return{key:W(),provider:e,model:t,tier:`1`,weight:`1`,costInput:n?.costInput??`0`,costOutput:n?.costOutput??`0`,costCacheRead:n?.costCacheRead??``,tools:!0,images:!0,reasoning:!0}}function q(){return{id:``,strategy:`score`,isAlias:!1,targets:[K()]}}function J(e){return{id:e.id,strategy:e.strategy,isAlias:e.isAlias,targets:e.targets.map(e=>({key:W(),provider:e.provider,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),tools:e.capabilities.tools,images:e.capabilities.images,reasoning:e.capabilities.reasoning}))}}function pe(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.model.trim();if(i.length===0)return{ok:!1,problem:`${e} needs a provider model name.`};let a=Number(r.tier);if(!Number.isInteger(a)||a<1)return{ok:!1,problem:`${e}: tier must be a whole number of 1 or more.`};let o=Number(r.weight);if(!Number.isFinite(o)||o<=0)return{ok:!1,problem:`${e}: weight must be greater than zero.`};let s=Number(r.costInput),c=Number(r.costOutput);if(!Number.isFinite(s)||s<0||!Number.isFinite(c)||c<0)return{ok:!1,problem:`${e}: prices cannot be negative.`};let l=r.costCacheRead.trim().length>0,u=Number(r.costCacheRead);if(l&&(!Number.isFinite(u)||u<0))return{ok:!1,problem:`${e}: the cache-read price cannot be negative.`};n.push({provider:r.provider,model:i,tier:a,weight:o,costPerMTok:{input:s,output:c,...l?{cacheRead:u}:{}},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 me=Object.keys(w),he=e.fieldset`
49
+ `;function B(e,t,n){return(e[t]??0)*n[t]}function V({modelId:e}){let[n,i]=(0,F.useState)({tools:!1,images:!1,reasoning:!1}),[a,l]=(0,F.useState)(null),[u,d]=(0,F.useState)(null),m=g(),_=h(),v=m.data?.weights,y=()=>{e!==null&&(d(null),_.mutate({modelId:e,need:n},{onSuccess:e=>l(e),onError:e=>{l(null),d(A(e))}}))},b=new Map(L.map(e=>[e,Math.max(1e-4,...(a?.candidates??[]).map(t=>v===void 0?0:Math.abs(B(t.reasons,e,v))))]));return(0,I.jsx)(k,{legend:`Explain`,meta:e??`no model selected`,actions:(0,I.jsxs)(r,{type:`button`,$size:`sm`,$variant:`primary`,disabled:e===null||_.isPending,onClick:y,children:[(0,I.jsx)(re,{}),_.isPending?`Ranking…`:`Rank candidates`]}),children:(0,I.jsxs)(o,{$gap:3,children:[(0,I.jsxs)(o,{$gap:1,children:[(0,I.jsx)(t,{children:`Pretend the request needs`}),(0,I.jsxs)(fe,{children:[(0,I.jsxs)(R,{children:[(0,I.jsx)(x,{checked:n.tools,label:`Probe request uses tools`,onCheckedChange:e=>i({...n,tools:e})}),`Tools`]}),(0,I.jsxs)(R,{children:[(0,I.jsx)(x,{checked:n.images,label:`Probe request includes an image`,onCheckedChange:e=>i({...n,images:e})}),`Images`]}),(0,I.jsxs)(R,{children:[(0,I.jsx)(x,{checked:n.reasoning,label:`Probe request asks for reasoning`,onCheckedChange:e=>i({...n,reasoning:e})}),`Reasoning`]})]})]}),u===null?null:(0,I.jsx)(z,{children:u}),a===null?(0,I.jsx)(M,{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.`}):(0,I.jsxs)(o,{$gap:3,children:[(0,I.jsxs)(p,{$gap:2,$wrap:!0,children:[(0,I.jsx)(w,{$tone:`accent`,children:a.strategy}),a.deterministic?null:(0,I.jsx)(w,{$tone:`warn`,children:`order varies per request`}),(0,I.jsx)(f,{}),(0,I.jsxs)(t,{children:[a.candidates.length,` eligible · `,a.excluded.length,` filtered out`]})]}),a.candidates.length===0?(0,I.jsx)(M,{legend:`Nothing eligible`,message:`Every target was filtered out. The reasons below say which rule removed each one.`}):(0,I.jsx)(`ul`,{children:a.candidates.map((e,n)=>(0,I.jsxs)(ae,{children:[(0,I.jsxs)(p,{$gap:2,children:[(0,I.jsx)(oe,{children:n+1}),(0,I.jsx)(C,{provider:e.provider}),(0,I.jsx)(s,{style:{maxWidth:`22ch`},children:e.credentialLabel}),(0,I.jsx)(c,{$dim:!0,children:e.model}),(0,I.jsxs)(w,{children:[`tier `,e.tier]}),(0,I.jsx)(f,{}),n===0?(0,I.jsx)(se,{children:`would be used`}):null,(0,I.jsx)(c,{children:e.score.toFixed(2)})]}),v===void 0?null:(0,I.jsx)(ce,{children:L.map(n=>{let r=B(e.reasons,n,v),i=b.get(n)??1;return(0,I.jsxs)(le,{title:ie[n],children:[(0,I.jsxs)(ue,{children:[(0,I.jsx)(t,{children:n}),(0,I.jsx)(c,{$dim:!0,$size:`10.5px`,children:r.toFixed(2)})]}),(0,I.jsx)(ee,{fraction:Math.abs(r)/i,height:4,tone:`var(--accent)`,label:`${n} contributes ${r.toFixed(2)} of ${e.score.toFixed(2)}`})]},n)})})]},`${e.credentialId}:${e.model}`))}),a.excluded.length===0?null:(0,I.jsxs)(o,{$gap:1,children:[(0,I.jsx)(t,{children:`Filtered out`}),(0,I.jsx)(`ul`,{children:a.excluded.map(e=>(0,I.jsxs)(de,{children:[(0,I.jsx)(c,{$dim:!0,children:e.model}),(0,I.jsx)(f,{}),(0,I.jsx)(w,{$tone:e.reason.startsWith(`capability`)?`warn`:`down`,children:e.reason})]},`${e.credentialId}:${e.model}:${e.reason}`))})]})]})]})})}var H=[{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.`}],U=0;function W(){return U+=1,`target-${U}`}function G(e,t){let n=ne(e,t);return n===null?null:{costInput:String(n.input),costOutput:String(n.output),costCacheRead:String(n.cacheRead)}}function K(e=`anthropic`){let t=N[e].defaultModel,n=G(e,t);return{key:W(),provider:e,model:t,tier:`1`,weight:`1`,costInput:n?.costInput??`0`,costOutput:n?.costOutput??`0`,costCacheRead:n?.costCacheRead??``,tools:!0,images:!0,reasoning:!0}}function q(){return{id:``,strategy:`score`,isAlias:!1,targets:[K()]}}function J(e){return{id:e.id,strategy:e.strategy,isAlias:e.isAlias,targets:e.targets.map(e=>({key:W(),provider:e.provider,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),tools:e.capabilities.tools,images:e.capabilities.images,reasoning:e.capabilities.reasoning}))}}function pe(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.model.trim();if(i.length===0)return{ok:!1,problem:`${e} needs a provider model name.`};let a=Number(r.tier);if(!Number.isInteger(a)||a<1)return{ok:!1,problem:`${e}: tier must be a whole number of 1 or more.`};let o=Number(r.weight);if(!Number.isFinite(o)||o<=0)return{ok:!1,problem:`${e}: weight must be greater than zero.`};let s=Number(r.costInput),c=Number(r.costOutput);if(!Number.isFinite(s)||s<0||!Number.isFinite(c)||c<0)return{ok:!1,problem:`${e}: prices cannot be negative.`};let l=r.costCacheRead.trim().length>0,u=Number(r.costCacheRead);if(l&&(!Number.isFinite(u)||u<0))return{ok:!1,problem:`${e}: the cache-read price cannot be negative.`};n.push({provider:r.provider,model:i,tier:a,weight:o,costPerMTok:{input:s,output:c,...l?{cacheRead:u}:{}},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 me=Object.keys(N),he=e.fieldset`
50
50
  border: 1px solid ${({theme:e})=>e.color.rule};
51
51
  border-left: 3px solid ${({theme:e,$provider:t})=>e.provider[t]};
52
52
  border-radius: ${({theme:e})=>e.radius.control};
@@ -84,7 +84,7 @@ import{B as e,D as t,Dt as n,F as r,I as i,Kt as a,M as o,N as s,O as c,Ot as l,
84
84
  align-items: center;
85
85
  gap: 6px;
86
86
  cursor: pointer;
87
- `;function ye({target:e,index:n,onChange:a,onRemove:s,removable:c}){let l=(0,F.useId)(),u=w[e.provider],d=(t,n)=>{a({...e,[t]:n})},m=G(e.provider,e.model),h=t=>{a({...e,...t,...G(t.provider,t.model)??{}})};return(0,I.jsxs)(he,{$provider:e.provider,children:[(0,I.jsxs)(p,{$gap:2,children:[(0,I.jsxs)(t,{as:`legend`,children:[`Target `,n+1]}),(0,I.jsx)(f,{}),(0,I.jsx)(i,{type:`button`,$variant:`ghost`,$size:`sm`,disabled:!c,"aria-label":`Remove target ${n+1}`,title:c?`Remove target ${n+1}`:`A model needs at least one target`,onClick:s,children:(0,I.jsx)(C,{})})]}),(0,I.jsxs)(ge,{children:[(0,I.jsxs)(Y,{children:[(0,I.jsx)(t,{as:`label`,htmlFor:`${l}-provider`,children:`Provider`}),(0,I.jsx)(E,{id:`${l}-provider`,value:e.provider,onChange:t=>{let n=t.target.value,r=w[n].models.some(t=>t.id===e.model);h({provider:n,model:r?e.model:w[n].defaultModel})},children:me.map(e=>(0,I.jsx)(`option`,{value:e,children:e},e))})]}),(0,I.jsxs)(Y,{children:[(0,I.jsx)(t,{as:`label`,htmlFor:`${l}-model`,children:`Provider model`}),(0,I.jsx)(D,{id:`${l}-model`,list:`${l}-catalog`,value:e.model,placeholder:u.defaultModel,onChange:t=>h({provider:e.provider,model:t.target.value})}),(0,I.jsx)(`datalist`,{id:`${l}-catalog`,children:u.models.map(e=>(0,I.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,I.jsxs)(Y,{children:[(0,I.jsx)(t,{as:`label`,htmlFor:`${l}-tier`,children:`Tier`}),(0,I.jsx)(O,{id:`${l}-tier`,min:1,step:1,value:e.tier,onChange:e=>d(`tier`,e.target.value)})]}),(0,I.jsxs)(Y,{children:[(0,I.jsx)(t,{as:`label`,htmlFor:`${l}-weight`,children:`Weight`}),(0,I.jsx)(O,{id:`${l}-weight`,min:0,step:.1,value:e.weight,onChange:e=>d(`weight`,e.target.value)})]})]}),(0,I.jsxs)(o,{$gap:1,children:[(0,I.jsxs)(p,{$gap:2,children:[(0,I.jsx)(t,{children:`Price per million tokens`}),(0,I.jsx)(f,{}),m===null?(0,I.jsx)(t,{as:`span`,children:`not in the catalog — price it yourself`}):(0,I.jsxs)(r,{type:`button`,$size:`sm`,$variant:`ghost`,disabled:e.costInput===m.costInput&&e.costOutput===m.costOutput&&e.costCacheRead===m.costCacheRead,onClick:()=>a({...e,...m}),children:[(0,I.jsx)(P,{}),`Use list price`]})]}),(0,I.jsxs)(_e,{children:[(0,I.jsxs)(Y,{children:[(0,I.jsx)(t,{as:`label`,htmlFor:`${l}-in`,children:`Input`}),(0,I.jsx)(O,{id:`${l}-in`,min:0,step:.01,value:e.costInput,onChange:e=>d(`costInput`,e.target.value)})]}),(0,I.jsxs)(Y,{children:[(0,I.jsx)(t,{as:`label`,htmlFor:`${l}-out`,children:`Output`}),(0,I.jsx)(O,{id:`${l}-out`,min:0,step:.01,value:e.costOutput,onChange:e=>d(`costOutput`,e.target.value)})]}),(0,I.jsxs)(Y,{children:[(0,I.jsx)(t,{as:`label`,htmlFor:`${l}-cache`,children:`Cache read`}),(0,I.jsx)(O,{id:`${l}-cache`,min:0,step:.01,placeholder:`same as input`,value:e.costCacheRead,onChange:e=>d(`costCacheRead`,e.target.value)})]})]})]}),(0,I.jsxs)(o,{$gap:1,children:[(0,I.jsx)(t,{children:`Capabilities`}),(0,I.jsxs)(ve,{children:[(0,I.jsxs)(X,{children:[(0,I.jsx)(x,{checked:e.tools,label:`Target ${n+1} supports tools`,onCheckedChange:e=>d(`tools`,e)}),`Tools`]}),(0,I.jsxs)(X,{children:[(0,I.jsx)(x,{checked:e.images,label:`Target ${n+1} supports images`,onCheckedChange:e=>d(`images`,e)}),`Images`]}),(0,I.jsxs)(X,{children:[(0,I.jsx)(x,{checked:e.reasoning,label:`Target ${n+1} supports reasoning`,onCheckedChange:e=>d(`reasoning`,e)}),`Reasoning`]})]})]})]})}var Z=e.p`
87
+ `;function ye({target:e,index:n,onChange:a,onRemove:s,removable:c}){let l=(0,F.useId)(),u=N[e.provider],d=(t,n)=>{a({...e,[t]:n})},m=G(e.provider,e.model),h=t=>{a({...e,...t,...G(t.provider,t.model)??{}})};return(0,I.jsxs)(he,{$provider:e.provider,children:[(0,I.jsxs)(p,{$gap:2,children:[(0,I.jsxs)(t,{as:`legend`,children:[`Target `,n+1]}),(0,I.jsx)(f,{}),(0,I.jsx)(i,{type:`button`,$variant:`ghost`,$size:`sm`,disabled:!c,"aria-label":`Remove target ${n+1}`,title:c?`Remove target ${n+1}`:`A model needs at least one target`,onClick:s,children:(0,I.jsx)(S,{})})]}),(0,I.jsxs)(ge,{children:[(0,I.jsxs)(Y,{children:[(0,I.jsx)(t,{as:`label`,htmlFor:`${l}-provider`,children:`Provider`}),(0,I.jsx)(T,{id:`${l}-provider`,value:e.provider,onChange:t=>{let n=t.target.value,r=N[n].models.some(t=>t.id===e.model);h({provider:n,model:r?e.model:N[n].defaultModel})},children:me.map(e=>(0,I.jsx)(`option`,{value:e,children:e},e))})]}),(0,I.jsxs)(Y,{children:[(0,I.jsx)(t,{as:`label`,htmlFor:`${l}-model`,children:`Provider model`}),(0,I.jsx)(E,{id:`${l}-model`,list:`${l}-catalog`,value:e.model,placeholder:u.defaultModel,onChange:t=>h({provider:e.provider,model:t.target.value})}),(0,I.jsx)(`datalist`,{id:`${l}-catalog`,children:u.models.map(e=>(0,I.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,I.jsxs)(Y,{children:[(0,I.jsx)(t,{as:`label`,htmlFor:`${l}-tier`,children:`Tier`}),(0,I.jsx)(D,{id:`${l}-tier`,min:1,step:1,value:e.tier,onChange:e=>d(`tier`,e.target.value)})]}),(0,I.jsxs)(Y,{children:[(0,I.jsx)(t,{as:`label`,htmlFor:`${l}-weight`,children:`Weight`}),(0,I.jsx)(D,{id:`${l}-weight`,min:0,step:.1,value:e.weight,onChange:e=>d(`weight`,e.target.value)})]})]}),(0,I.jsxs)(o,{$gap:1,children:[(0,I.jsxs)(p,{$gap:2,children:[(0,I.jsx)(t,{children:`Price per million tokens`}),(0,I.jsx)(f,{}),m===null?(0,I.jsx)(t,{as:`span`,children:`not in the catalog — price it yourself`}):(0,I.jsxs)(r,{type:`button`,$size:`sm`,$variant:`ghost`,disabled:e.costInput===m.costInput&&e.costOutput===m.costOutput&&e.costCacheRead===m.costCacheRead,onClick:()=>a({...e,...m}),children:[(0,I.jsx)(P,{}),`Use list price`]})]}),(0,I.jsxs)(_e,{children:[(0,I.jsxs)(Y,{children:[(0,I.jsx)(t,{as:`label`,htmlFor:`${l}-in`,children:`Input`}),(0,I.jsx)(D,{id:`${l}-in`,min:0,step:.01,value:e.costInput,onChange:e=>d(`costInput`,e.target.value)})]}),(0,I.jsxs)(Y,{children:[(0,I.jsx)(t,{as:`label`,htmlFor:`${l}-out`,children:`Output`}),(0,I.jsx)(D,{id:`${l}-out`,min:0,step:.01,value:e.costOutput,onChange:e=>d(`costOutput`,e.target.value)})]}),(0,I.jsxs)(Y,{children:[(0,I.jsx)(t,{as:`label`,htmlFor:`${l}-cache`,children:`Cache read`}),(0,I.jsx)(D,{id:`${l}-cache`,min:0,step:.01,placeholder:`same as input`,value:e.costCacheRead,onChange:e=>d(`costCacheRead`,e.target.value)})]})]})]}),(0,I.jsxs)(o,{$gap:1,children:[(0,I.jsx)(t,{children:`Capabilities`}),(0,I.jsxs)(ve,{children:[(0,I.jsxs)(X,{children:[(0,I.jsx)(x,{checked:e.tools,label:`Target ${n+1} supports tools`,onCheckedChange:e=>d(`tools`,e)}),`Tools`]}),(0,I.jsxs)(X,{children:[(0,I.jsx)(x,{checked:e.images,label:`Target ${n+1} supports images`,onCheckedChange:e=>d(`images`,e)}),`Images`]}),(0,I.jsxs)(X,{children:[(0,I.jsx)(x,{checked:e.reasoning,label:`Target ${n+1} supports reasoning`,onCheckedChange:e=>d(`reasoning`,e)}),`Reasoning`]})]})]})]})}var Z=e.p`
88
88
  font-size: 11.5px;
89
89
  color: ${({theme:e})=>e.color.inkDim};
90
90
  `,be=e.p`
@@ -95,7 +95,7 @@ import{B as e,D as t,Dt as n,F as r,I as i,Kt as a,M as o,N as s,O as c,Ot as l,
95
95
  color: ${({theme:e})=>e.color.ok};
96
96
  `,Q=e(p)`
97
97
  gap: 8px;
98
- `;function Se({model:e,onSaved:n,onDeleted:i}){let[a,s]=(0,F.useState)(()=>e===null?q():J(e)),[c,l]=(0,F.useState)(null),[d,h]=(0,F.useState)(!1),[g,_]=(0,F.useState)(!1),v=u(),S=m(),C=e?.id??null;(0,F.useEffect)(()=>{s(e===null?q():J(e)),l(null),h(!1)},[C]);let w=H.find(e=>e.id===a.strategy);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(A,{legend:e===null?`New model`:`Edit model`,meta:e===null?void 0:e.id,actions:(0,I.jsxs)(I.Fragment,{children:[e===null?null:(0,I.jsx)(r,{type:`button`,$variant:`danger`,$size:`sm`,onClick:()=>_(!0),children:`Delete`}),(0,I.jsx)(r,{type:`button`,$variant:`primary`,$size:`sm`,disabled:v.isPending,onClick:()=>{h(!1);let e=pe(a);if(!e.ok){l(e.problem);return}l(null),v.mutate(e.model,{onSuccess:()=>{h(!0),n(e.model.id)},onError:e=>l(j(e))})},children:v.isPending?`Saving…`:e===null?`Create model`:`Save changes`})]}),children:(0,I.jsxs)(o,{$gap:3,children:[(0,I.jsx)(k,{label:`Model name`,hint:e===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:t=>(0,I.jsx)(D,{...t,value:a.id,disabled:e!==null,placeholder:`fast`,onChange:e=>s({...a,id:e.target.value})})}),(0,I.jsx)(k,{label:`Routing strategy`,children:e=>(0,I.jsx)(E,{...e,value:a.strategy,onChange:e=>s({...a,strategy:e.target.value}),children:H.map(e=>(0,I.jsx)(`option`,{value:e.id,children:e.label},e.id))})}),w===void 0?null:(0,I.jsx)(Z,{children:w.blurb}),(0,I.jsxs)(Q,{children:[(0,I.jsx)(x,{checked:a.isAlias,label:`This model is an alias for a provider model name`,onCheckedChange:e=>s({...a,isAlias:e})}),(0,I.jsxs)(o,{$gap:0,children:[(0,I.jsx)(t,{as:`span`,children:`Alias`}),(0,I.jsx)(Z,{children:`Mark this when the name mirrors a provider's own model name.`})]})]}),(0,I.jsxs)(o,{$gap:2,children:[(0,I.jsxs)(p,{children:[(0,I.jsx)(t,{children:`Targets`}),(0,I.jsx)(f,{}),(0,I.jsxs)(r,{type:`button`,$size:`sm`,onClick:()=>s({...a,targets:[...a.targets,K(a.targets.at(-1)?.provider??`anthropic`)]}),children:[(0,I.jsx)(b,{}),`Add target`]})]}),a.targets.map((e,t)=>(0,I.jsx)(ye,{target:e,index:t,removable:a.targets.length>1,onChange:t=>s({...a,targets:a.targets.map(n=>n.key===e.key?t:n)}),onRemove:()=>s({...a,targets:a.targets.filter(t=>t.key!==e.key)})},e.key))]}),c===null?null:(0,I.jsx)(be,{role:`alert`,children:c}),d&&c===null?(0,I.jsx)(xe,{role:`status`,children:`Saved.`}):null]})}),(0,I.jsx)(y,{open:g,onOpenChange:_,title:`Delete model`,body:e===null?``:`Deleting "${e.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:S.isPending,onConfirm:()=>{e!==null&&S.mutate(e.id,{onSuccess:()=>{_(!1),i()},onError:e=>{_(!1),l(j(e))}})}})]})}var Ce=e.div`
98
+ `;function Se({model:e,onSaved:n,onDeleted:i}){let[a,s]=(0,F.useState)(()=>e===null?q():J(e)),[c,l]=(0,F.useState)(null),[d,h]=(0,F.useState)(!1),[g,_]=(0,F.useState)(!1),v=u(),S=m(),C=e?.id??null;(0,F.useEffect)(()=>{s(e===null?q():J(e)),l(null),h(!1)},[C]);let w=H.find(e=>e.id===a.strategy);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(k,{legend:e===null?`New model`:`Edit model`,meta:e===null?void 0:e.id,actions:(0,I.jsxs)(I.Fragment,{children:[e===null?null:(0,I.jsx)(r,{type:`button`,$variant:`danger`,$size:`sm`,onClick:()=>_(!0),children:`Delete`}),(0,I.jsx)(r,{type:`button`,$variant:`primary`,$size:`sm`,disabled:v.isPending,onClick:()=>{h(!1);let e=pe(a);if(!e.ok){l(e.problem);return}l(null),v.mutate(e.model,{onSuccess:()=>{h(!0),n(e.model.id)},onError:e=>l(A(e))})},children:v.isPending?`Saving…`:e===null?`Create model`:`Save changes`})]}),children:(0,I.jsxs)(o,{$gap:3,children:[(0,I.jsx)(O,{label:`Model name`,hint:e===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:t=>(0,I.jsx)(E,{...t,value:a.id,disabled:e!==null,placeholder:`fast`,onChange:e=>s({...a,id:e.target.value})})}),(0,I.jsx)(O,{label:`Routing strategy`,children:e=>(0,I.jsx)(T,{...e,value:a.strategy,onChange:e=>s({...a,strategy:e.target.value}),children:H.map(e=>(0,I.jsx)(`option`,{value:e.id,children:e.label},e.id))})}),w===void 0?null:(0,I.jsx)(Z,{children:w.blurb}),(0,I.jsxs)(Q,{children:[(0,I.jsx)(x,{checked:a.isAlias,label:`This model is an alias for a provider model name`,onCheckedChange:e=>s({...a,isAlias:e})}),(0,I.jsxs)(o,{$gap:0,children:[(0,I.jsx)(t,{as:`span`,children:`Alias`}),(0,I.jsx)(Z,{children:`Mark this when the name mirrors a provider's own model name.`})]})]}),(0,I.jsxs)(o,{$gap:2,children:[(0,I.jsxs)(p,{children:[(0,I.jsx)(t,{children:`Targets`}),(0,I.jsx)(f,{}),(0,I.jsxs)(r,{type:`button`,$size:`sm`,onClick:()=>s({...a,targets:[...a.targets,K(a.targets.at(-1)?.provider??`anthropic`)]}),children:[(0,I.jsx)(b,{}),`Add target`]})]}),a.targets.map((e,t)=>(0,I.jsx)(ye,{target:e,index:t,removable:a.targets.length>1,onChange:t=>s({...a,targets:a.targets.map(n=>n.key===e.key?t:n)}),onRemove:()=>s({...a,targets:a.targets.filter(t=>t.key!==e.key)})},e.key))]}),c===null?null:(0,I.jsx)(be,{role:`alert`,children:c}),d&&c===null?(0,I.jsx)(xe,{role:`status`,children:`Saved.`}):null]})}),(0,I.jsx)(y,{open:g,onOpenChange:_,title:`Delete model`,body:e===null?``:`Deleting "${e.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:S.isPending,onConfirm:()=>{e!==null&&S.mutate(e.id,{onSuccess:()=>{_(!1),i()},onError:e=>{_(!1),l(A(e))}})}})]})}var Ce=e.div`
99
99
  display: grid;
100
100
  grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
101
101
  gap: ${({theme:e})=>e.space(4)};
@@ -141,4 +141,4 @@ import{B as e,D as t,Dt as n,F as r,I as i,Kt as a,M as o,N as s,O as c,Ot as l,
141
141
  height: 3px;
142
142
  border-radius: 1px;
143
143
  background: ${({$provider:e})=>`var(--p-${e})`};
144
- `,$=`\0new`;function ke(){let e=d(),[n,i]=(0,F.useState)(null),a=e.data??[],o=n===$?null:a.find(e=>e.id===n)??null,s=n===$||n===null&&!e.isLoading&&a.length===0;(0,F.useEffect)(()=>{n===null&&a.length!==0&&i(a[0]?.id??null)},[a,n]);let l=e.isLoading?`Reading configured models…`:a.length===0?`No virtual models exist yet, so no client request can resolve to an upstream.`:`${a.length} model${a.length===1?``:`s`} routing to ${a.reduce((e,t)=>e+t.targets.length,0)} targets.`;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(v,{legend:`Models`,title:`Virtual models`,summary:l,actions:(0,I.jsxs)(r,{type:`button`,$variant:`primary`,onClick:()=>i($),children:[(0,I.jsx)(b,{}),`New model`]})}),(0,I.jsxs)(Ce,{children:[(0,I.jsx)(A,{legend:`Configured`,meta:`${a.length}`,flush:!0,children:e.isError?(0,I.jsx)(ne,{error:e.error,onRetry:()=>void e.refetch()}):e.isLoading?(0,I.jsx)(`div`,{style:{padding:12},children:(0,I.jsx)(M,{rows:4})}):a.length===0?(0,I.jsx)(N,{legend:`No models`,message:`Create a model to give clients something to ask for.`,action:(0,I.jsx)(r,{type:`button`,$size:`sm`,$variant:`primary`,onClick:()=>i($),children:`New model`})}):(0,I.jsx)(`div`,{children:a.map(e=>{let r=[...new Set(e.targets.map(e=>e.provider))];return(0,I.jsxs)(Te,{type:`button`,$selected:e.id===n,"aria-pressed":e.id===n,onClick:()=>i(e.id),children:[(0,I.jsxs)(p,{$gap:2,style:{width:`100%`},children:[(0,I.jsx)(Ee,{title:e.id,children:e.id}),(0,I.jsx)(f,{}),e.isAlias?(0,I.jsx)(T,{children:`alias`}):null]}),(0,I.jsxs)(p,{$gap:2,style:{width:`100%`},children:[(0,I.jsx)(De,{children:r.map(e=>(0,I.jsx)(Oe,{$provider:e,title:e},e))}),(0,I.jsx)(t,{children:e.strategy}),(0,I.jsx)(f,{}),(0,I.jsxs)(c,{$dim:!0,$size:`11px`,children:[e.targets.length,` target`,e.targets.length===1?``:`s`]})]})]},e.id)})})}),(0,I.jsxs)(we,{children:[o===null&&!s?(0,I.jsx)(A,{legend:`Editor`,children:e.isLoading?(0,I.jsx)(M,{rows:5}):(0,I.jsx)(N,{legend:`Nothing selected`,message:`Pick a model on the left to change its targets, or create a new one.`})}):(0,I.jsx)(Se,{model:o,onSaved:t=>{i(t),e.refetch()},onDeleted:()=>{i(null),e.refetch()}}),(0,I.jsx)(V,{modelId:o?.id??null})]})]})]})}var Ae=ke;export{Ae as component};
144
+ `,$=`\0new`;function ke(){let e=d(),[n,i]=(0,F.useState)(null),a=e.data??[],o=n===$?null:a.find(e=>e.id===n)??null,s=n===$||n===null&&!e.isLoading&&a.length===0;(0,F.useEffect)(()=>{n===null&&a.length!==0&&i(a[0]?.id??null)},[a,n]);let l=e.isLoading?`Reading configured models…`:a.length===0?`No virtual models exist yet, so no client request can resolve to an upstream.`:`${a.length} model${a.length===1?``:`s`} routing to ${a.reduce((e,t)=>e+t.targets.length,0)} targets.`;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(v,{legend:`Models`,title:`Virtual models`,summary:l,actions:(0,I.jsxs)(r,{type:`button`,$variant:`primary`,onClick:()=>i($),children:[(0,I.jsx)(b,{}),`New model`]})}),(0,I.jsxs)(Ce,{children:[(0,I.jsx)(k,{legend:`Configured`,meta:`${a.length}`,flush:!0,children:e.isError?(0,I.jsx)(te,{error:e.error,onRetry:()=>void e.refetch()}):e.isLoading?(0,I.jsx)(`div`,{style:{padding:12},children:(0,I.jsx)(j,{rows:4})}):a.length===0?(0,I.jsx)(M,{legend:`No models`,message:`Create a model to give clients something to ask for.`,action:(0,I.jsx)(r,{type:`button`,$size:`sm`,$variant:`primary`,onClick:()=>i($),children:`New model`})}):(0,I.jsx)(`div`,{children:a.map(e=>{let r=[...new Set(e.targets.map(e=>e.provider))];return(0,I.jsxs)(Te,{type:`button`,$selected:e.id===n,"aria-pressed":e.id===n,onClick:()=>i(e.id),children:[(0,I.jsxs)(p,{$gap:2,style:{width:`100%`},children:[(0,I.jsx)(Ee,{title:e.id,children:e.id}),(0,I.jsx)(f,{}),e.isAlias?(0,I.jsx)(w,{children:`alias`}):null]}),(0,I.jsxs)(p,{$gap:2,style:{width:`100%`},children:[(0,I.jsx)(De,{children:r.map(e=>(0,I.jsx)(Oe,{$provider:e,title:e},e))}),(0,I.jsx)(t,{children:e.strategy}),(0,I.jsx)(f,{}),(0,I.jsxs)(c,{$dim:!0,$size:`11px`,children:[e.targets.length,` target`,e.targets.length===1?``:`s`]})]})]},e.id)})})}),(0,I.jsxs)(we,{children:[o===null&&!s?(0,I.jsx)(k,{legend:`Editor`,children:e.isLoading?(0,I.jsx)(j,{rows:5}):(0,I.jsx)(M,{legend:`Nothing selected`,message:`Pick a model on the left to change its targets, or create a new one.`})}):(0,I.jsx)(Se,{model:o,onSaved:t=>{i(t),e.refetch()},onDeleted:()=>{i(null),e.refetch()}}),(0,I.jsx)(V,{modelId:o?.id??null})]})]})]})}var Ae=ke;export{Ae as component};
@@ -1,4 +1,4 @@
1
- import{B as e,D as t,Dt as n,F as r,Kt as i,M as a,O as o,Ot as s,j as c,k as l,v as u,y as d}from"./queries-vY5lJqBe.js";import{t as f}from"./Rack-DANVhi_U.js";import{n as p,t as m}from"./Field-DdscQ9OO.js";import{t as h}from"./Meter-Bm1oQE2U.js";import{a as g,i as _,n as v,r as y}from"./States-DPTTYUHL.js";var b=i(s(),1),x=n(),S=[{id:`tier`,label:`Tier`,blurb:`How strongly a lower tier is preferred.`},{id:`health`,label:`Health`,blurb:`Penalty for recent failures and an open breaker.`},{id:`quota`,label:`Quota`,blurb:`Preference for accounts keeping ahead of their window's burn rate.`},{id:`cost`,label:`Cost`,blurb:`Preference for the cheaper target of the candidates.`},{id:`latency`,label:`Latency`,blurb:`Preference for the faster observed first token.`},{id:`recency`,label:`Recency`,blurb:`Preference for accounts that have been idle.`}],C=[{id:`maxAttempts`,label:`Attempts per request`,hint:`How many candidates dispatch may try before giving up. 1 disables failover.`,unit:`attempts`,step:1,min:1},{id:`requestDeadlineMs`,label:`Request deadline`,hint:`How long a single client request may take across all attempts.`,unit:`ms`,step:1e3,min:1},{id:`breakerThreshold`,label:`Breaker threshold`,hint:`Consecutive failures on one account and model before it is taken out of rotation.`,unit:`failures`,step:1,min:1},{id:`breakerCooldownMs`,label:`Breaker cooldown`,hint:`Base wait before a tripped account is probed again. Doubles per extra failure.`,unit:`ms`,step:1e3,min:1},{id:`logRetentionDays`,label:`Log retention`,hint:`How long request rows are kept before maintenance prunes them.`,unit:`days`,step:1,min:1},{id:`quotaPollIntervalMs`,label:`Quota poll interval`,hint:`How often each account's provider is asked for its remaining quota. 0 disables polling. Takes effect on restart.`,unit:`ms`,step:6e4,min:0}],w=e.div`
1
+ import{B as e,D as t,Dt as n,F as r,Kt as i,M as a,O as o,Ot as s,j as c,k as l,v as u,y as d}from"./queries-vY5lJqBe.js";import{t as f}from"./Rack-uDxrjvaz.js";import{n as p,t as m}from"./Field-DdscQ9OO.js";import{t as h}from"./Meter-Bm1oQE2U.js";import{a as g,i as _,n as v,r as y}from"./States-DPTTYUHL.js";var b=i(s(),1),x=n(),S=[{id:`tier`,label:`Tier`,blurb:`How strongly a lower tier is preferred.`},{id:`health`,label:`Health`,blurb:`Penalty for recent failures and an open breaker.`},{id:`quota`,label:`Quota`,blurb:`Preference for accounts keeping ahead of their window's burn rate.`},{id:`cost`,label:`Cost`,blurb:`Preference for the cheaper target of the candidates.`},{id:`latency`,label:`Latency`,blurb:`Preference for the faster observed first token.`},{id:`recency`,label:`Recency`,blurb:`Preference for accounts that have been idle.`}],C=[{id:`maxAttempts`,label:`Attempts per request`,hint:`How many candidates dispatch may try before giving up. 1 disables failover.`,unit:`attempts`,step:1,min:1},{id:`requestDeadlineMs`,label:`Request deadline`,hint:`How long a single client request may take across all attempts.`,unit:`ms`,step:1e3,min:1},{id:`breakerThreshold`,label:`Breaker threshold`,hint:`Consecutive failures on one account and model before it is taken out of rotation.`,unit:`failures`,step:1,min:1},{id:`breakerCooldownMs`,label:`Breaker cooldown`,hint:`Base wait before a tripped account is probed again. Doubles per extra failure.`,unit:`ms`,step:1e3,min:1},{id:`logRetentionDays`,label:`Log retention`,hint:`How long request rows are kept before maintenance prunes them.`,unit:`days`,step:1,min:1},{id:`quotaPollIntervalMs`,label:`Quota poll interval`,hint:`How often each account's provider is asked for its remaining quota. 0 disables polling. Takes effect on restart.`,unit:`ms`,step:6e4,min:0}],w=e.div`
2
2
  display: grid;
3
3
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
4
4
  gap: ${({theme:e})=>e.space(3)};