omnigateway 0.1.8 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +27 -33
  2. package/bin/omni.js +607 -78
  3. package/gateway.js +2877 -150
  4. package/package.json +1 -1
  5. package/public/assets/{Chip-CM9ZMdr9.js → Chip-BB_5C1Zp.js} +1 -1
  6. package/public/assets/Confirm-B6aAiVbT.js +4 -0
  7. package/public/assets/{CopyValue-WrOTcHwq.js → CopyValue-CRQDLo7k.js} +1 -1
  8. package/public/assets/{Field-Br6jKPz8.js → Field-uHZxl4fI.js} +1 -1
  9. package/public/assets/Lamp-B-5SjXbG.js +25 -0
  10. package/public/assets/{Meter-BzMaum0C.js → Meter-DI_BRUKt.js} +1 -1
  11. package/public/assets/Modal-CI6jk2D4.js +82 -0
  12. package/public/assets/{Rack-BFWC50ex.js → Rack-D1WJswv3.js} +8 -4
  13. package/public/assets/{Readout-DMJs4gYD.js → Readout-BocZ2HXP.js} +1 -1
  14. package/public/assets/{States-BNeCLhZn.js → States-Bbiu5cHE.js} +1 -1
  15. package/public/assets/{Table-nOg_lgEJ.js → Table-CdPWxYaz.js} +1 -1
  16. package/public/assets/Toggle-CiLC67Dw.js +39 -0
  17. package/public/assets/TokenBreakdown-B96iPBm9.js +28 -0
  18. package/public/assets/_app-BBOF6A0T.js +1 -0
  19. package/public/assets/{_app.accounts-BTb5vHI_.js → _app.accounts-BNkhpvaB.js} +8 -5
  20. package/public/assets/_app.console-Daz4aKhf.js +44 -0
  21. package/public/assets/_app.index-LO6d38oe.js +62 -0
  22. package/public/assets/{_app.keys-B-cy-2DS.js → _app.keys-kBqLqoFf.js} +3 -3
  23. package/public/assets/_app.logs-_wYNS47N.js +32 -0
  24. package/public/assets/{_app.models-BAmXHlf2.js → _app.models-Cjng8ohC.js} +5 -5
  25. package/public/assets/_app.settings-a0FKyQAi.js +38 -0
  26. package/public/assets/{_app.usage-BLrQ2hB8.js → _app.usage-D3KtgLrC.js} +9 -6
  27. package/public/assets/dist-C-IbPRiV.js +1 -0
  28. package/public/assets/index-PW6EvVh5.js +170 -0
  29. package/public/assets/{login-BpUl6C5b.js → login-CTvH_KAd.js} +1 -1
  30. package/public/assets/queries-D2o-X8Pj.js +144 -0
  31. package/public/assets/{trash-2-DjWP2u19.js → trash-2-BcZb-sCT.js} +1 -1
  32. package/public/index.html +2 -2
  33. package/public/assets/Lamp-DO-sRDg2.js +0 -25
  34. package/public/assets/Modal-lhjr949H.js +0 -82
  35. package/public/assets/Toggle-DYoCVD37.js +0 -42
  36. package/public/assets/_app-lXr06Xli.js +0 -1
  37. package/public/assets/_app.console-DHUClMsI.js +0 -25
  38. package/public/assets/_app.index-DZ--9mKU.js +0 -61
  39. package/public/assets/_app.logs-BQjAIT2P.js +0 -33
  40. package/public/assets/_app.settings-CG8bv_rm.js +0 -34
  41. package/public/assets/index-UAZ0O5y0.js +0 -170
  42. package/public/assets/queries-D_-Jj9vt.js +0 -144
@@ -1,42 +0,0 @@
1
- import{B as e,G as t,Mt as n,Nt as r,Zt as i}from"./queries-D_-Jj9vt.js";import{m as a}from"./Rack-BFWC50ex.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-lhjr949H.js";var p=a(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),m=i(r(),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=n(),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=t.p`
2
- font-size: 13px;
3
- color: ${({theme:e})=>e.color.inkDim};
4
- `;function L({open:t,onOpenChange:n,title:r,body:i,confirmLabel:a,busy:o,onConfirm:s}){return(0,v.jsx)(f,{open:t,onOpenChange:n,title:r,width:`420px`,footer:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(e,{type:`button`,onClick:()=>n(!1),children:`Cancel`}),(0,v.jsx)(e,{type:`button`,$variant:`danger`,disabled:o===!0,onClick:s,children:a})]}),children:(0,v.jsx)(I,{children:i})})}var R=t(k)`
5
- all: unset;
6
- width: 30px;
7
- height: 16px;
8
- padding: 2px;
9
- border-radius: 9px;
10
- background: ${({theme:e})=>e.color.ruleStrong};
11
- border: 1px solid ${({theme:e})=>e.color.rule};
12
- cursor: pointer;
13
- transition: background 140ms ease;
14
- flex: none;
15
-
16
- &[data-state="checked"] {
17
- background: ${({theme:e})=>e.color.ok};
18
- }
19
-
20
- &:disabled {
21
- opacity: 0.5;
22
- cursor: not-allowed;
23
- }
24
-
25
- &:focus-visible {
26
- outline: 2px solid ${({theme:e})=>e.color.accent};
27
- outline-offset: 2px;
28
- }
29
- `,z=t(j)`
30
- display: block;
31
- width: 12px;
32
- height: 12px;
33
- border-radius: 50%;
34
- background: ${({theme:e})=>e.color.panel};
35
- transition: transform 140ms ease;
36
- transform: translateX(0);
37
- will-change: transform;
38
-
39
- &[data-state="checked"] {
40
- transform: translateX(14px);
41
- }
42
- `;function B({checked:e,onCheckedChange:t,label:n,disabled:r,id:i}){return(0,v.jsx)(R,{checked:e,onCheckedChange:t,"aria-label":n,...r===void 0?{}:{disabled:r},...i===void 0?{}:{id:i},children:(0,v.jsx)(z,{})})}export{L as n,p as r,B as t};
@@ -1 +0,0 @@
1
- import{Mt as e}from"./queries-D_-Jj9vt.js";import{o as t}from"./index-UAZ0O5y0.js";import{i as n,n as r}from"./Rack-BFWC50ex.js";var i=e(),a=()=>(0,i.jsx)(n,{children:(0,i.jsx)(r,{children:(0,i.jsx)(t,{})})});export{a as component};
@@ -1,25 +0,0 @@
1
- import{G as e,Mt as t,N as n,Nt as r,P as i,Zt as a,c as o,t as s}from"./queries-D_-Jj9vt.js";import{a as c,s as l,t as u}from"./Rack-BFWC50ex.js";import{i as d}from"./Field-Br6jKPz8.js";import{a as f,n as p,r as m,t as h}from"./States-BNeCLhZn.js";var g=a(r(),1),_=t(),v=[100,200,500],y=[{value:``,label:`All levels`},{value:`debug`,label:`Debug and above`},{value:`info`,label:`Info and above`},{value:`warn`,label:`Warnings and errors`},{value:`error`,label:`Errors only`}],b=e(i)`
2
- gap: ${({theme:e})=>e.space(2)};
3
- flex-wrap: wrap;
4
- `,x=e(d)`
5
- width: auto;
6
- `,S=e.pre`
7
- margin: 0;
8
- padding: ${({theme:e})=>e.space(3)};
9
- font-family: ${({theme:e})=>e.font.mono};
10
- font-size: 12px;
11
- line-height: 1.65;
12
- overflow-x: auto;
13
- white-space: pre;
14
- `,C=e.div`
15
- color: ${({theme:e,$level:t})=>t===`error`?e.color.down:t===`warn`?e.color.warn:t===`debug`?e.color.inkFaint:e.color.ink};
16
- `,w=e.p`
17
- margin: 0;
18
- padding: ${({theme:e})=>`${e.space(2)} ${e.space(3)}`};
19
- border-top: 1px solid ${({theme:e})=>e.color.rule};
20
- color: ${({theme:e})=>e.color.inkDim};
21
- font-size: 12px;
22
- `,T=e.code`
23
- font-family: ${({theme:e})=>e.font.mono};
24
- word-break: break-all;
25
- `;function E({read:e}){return e.source===`file`?(0,_.jsxs)(w,{children:[`Reading `,(0,_.jsx)(T,{children:e.path}),`, named by `,(0,_.jsx)(T,{children:`OMNI_LOG_FILE`}),`. That variable says where the gateway's output is being captured; it does not redirect it.`]}):e.source===`journal`?(0,_.jsxs)(w,{children:[`Reading the systemd journal for `,(0,_.jsx)(T,{children:`omnigateway.service`}),`. To read a file instead, redirect the gateway's output to one and point `,(0,_.jsx)(T,{children:`OMNI_LOG_FILE`}),` at the same path.`]}):null}function D(){let{cadence:e}=c(),[t,r]=(0,g.useState)(200),[i,a]=(0,g.useState)(``),d=o(t,i,e(s)),w=d.data,T=w?.lines??[];return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(u,{legend:`Console`,title:`Gateway output`,summary:d.isLoading?`Reading the gateway's own output…`:`${l(T.length)} lines of what this process is doing. Requests are in Logs; prompt bodies, tokens and keys are never written here.`,actions:(0,_.jsxs)(b,{children:[(0,_.jsx)(x,{value:i,"aria-label":`Which levels to show`,onChange:e=>a(e.target.value),children:y.map(e=>(0,_.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,_.jsx)(x,{value:t,"aria-label":`How many lines to fetch`,onChange:e=>r(Number(e.target.value)),children:v.map(e=>(0,_.jsxs)(`option`,{value:e,children:[`last `,e]},e))})]})}),(0,_.jsx)(f,{legend:`Process output`,meta:w===void 0?void 0:(0,_.jsx)(n,{children:O(w)}),flush:!0,children:d.isError?(0,_.jsx)(p,{error:d.error,onRetry:()=>void d.refetch()}):d.isLoading?(0,_.jsx)(`div`,{style:{padding:12},children:(0,_.jsx)(m,{rows:10})}):w!==void 0&&w.source===`none`?(0,_.jsx)(h,{legend:`Nothing is capturing this gateway`,message:"Its output is going to a terminal, so there is nothing to read back. To capture it, run the gateway under systemd with `omni service install`, or start it with `omni start`, which redirects output to a file and points OMNI_LOG_FILE at it."}):(0,_.jsxs)(_.Fragment,{children:[T.length===0?(0,_.jsx)(h,{legend:`Nothing to show`,message:i===``?`This log is empty. The gateway writes here when it boots, refreshes a token, or polls a quota.`:`No line in this window is at that level. Widen the filter to see everything.`}):(0,_.jsx)(S,{children:T.map((e,t)=>(0,_.jsx)(C,{$level:e.level,children:e.raw},`${e.at??0}-${t}`))}),w===void 0?null:(0,_.jsx)(E,{read:w})]})})]})}function O(e){return e.source===`file`?`log file`:e.source===`journal`?`systemd journal`:`not captured`}var k=D;export{k as component};
@@ -1,61 +0,0 @@
1
- import{A as e,B as t,C as n,D as r,F as i,G as a,I as o,L as s,M as c,Mt as l,P as u,R as d,d as f,j as p,q as m,u as h,v as g,y as _}from"./queries-D_-Jj9vt.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-BFWC50ex.js";import{a as D,c as O,d as k,f as A,i as j,l as M,n as N,r as ee,s as P,t as F,u as I}from"./Lamp-DO-sRDg2.js";import{n as L,t as R}from"./Chip-CM9ZMdr9.js";import{t as z}from"./Meter-BzMaum0C.js";import{a as B,n as V,t as H}from"./States-BNeCLhZn.js";import{i as U,n as W,r as G,t as K}from"./Table-nOg_lgEJ.js";import{t as q}from"./Readout-DMJs4gYD.js";var J=l(),te=a(d)`
2
- font-weight: 500;
3
- display: block;
4
- max-width: 24ch;
5
- `,Y=a.span`
6
- font-size: 11px;
7
- color: ${({theme:e})=>e.color.inkDim};
8
- `,X=a.div`
9
- display: flex;
10
- align-items: center;
11
- gap: 6px;
12
- width: 118px;
13
- `,Z=a.div`
14
- display: flex;
15
- flex-direction: column;
16
- gap: 4px;
17
- `;function Q({credentials:e,health:n,quota:r,usage:a,quotaPollIntervalMs:o,now:s}){let c=D(n,e=>e.credentialId),l=D(r,e=>e.credentialId),d=new Map(a.map(e=>[e.key,e])),f={down:0,warn:1,ok:2,idle:3,live:3},h=e.map(e=>({credential:e,status:j(c.get(e.id)??[],s,e.enabled,e.disabledReason),quota:k(l.get(e.id)??[]),usage:d.get(e.id)})).sort((e,t)=>f[e.status.state]-f[t.status.state]||e.credential.tier-t.credential.tier);return(0,J.jsx)(B,{legend:`Accounts`,meta:`${e.length} connected`,flush:!0,actions:(0,J.jsx)(t,{as:m,to:`/accounts`,$size:`sm`,children:`Manage accounts`}),children:e.length===0?(0,J.jsx)(H,{legend:`No accounts`,message:`The gateway has no provider credentials, so every request will fail. Connect one to start routing.`,action:(0,J.jsx)(t,{as:m,to:`/accounts`,$variant:`primary`,$size:`sm`,children:`Connect an account`})}):(0,J.jsx)(i,{children:(0,J.jsxs)(K,{children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(G,{children:`Account`}),(0,J.jsx)(G,{children:`Provider`}),(0,J.jsx)(G,{$align:`right`,children:`Tier`}),(0,J.jsx)(G,{children:`Quota`}),(0,J.jsx)(G,{$align:`right`,children:`TTFT`}),(0,J.jsx)(G,{$align:`right`,children:`Requests`}),(0,J.jsx)(G,{$align:`right`,children:`Last used`})]})}),(0,J.jsx)(`tbody`,{children:h.map(({credential:e,status:t,quota:n,usage:r})=>(0,J.jsxs)(U,{children:[(0,J.jsx)(W,{children:(0,J.jsxs)(u,{$gap:2,children:[(0,J.jsx)(F,{state:t.state,label:t.note===``?`healthy`:t.note}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(te,{children:e.label}),t.note===``?null:(0,J.jsx)(Y,{children:t.note})]})]})}),(0,J.jsx)(W,{children:(0,J.jsx)(L,{provider:e.provider})}),(0,J.jsx)(W,{$align:`right`,$mono:!0,children:e.tier}),(0,J.jsx)(W,{children:n.length===0?(0,J.jsx)(Y,{children:`unknown`}):(0,J.jsx)(Z,{children:n.map(({window:e,fraction:t})=>(0,J.jsxs)(X,{children:[(0,J.jsx)(z,{fraction:t,label:`${N[e.windowType]} window, ${Math.round(t*100)}% used`}),(0,J.jsx)(p,{children:I(e,s,o,y)})]},e.windowType))})}),(0,J.jsx)(W,{$align:`right`,$mono:!0,children:x(t.ttftMs)}),(0,J.jsx)(W,{$align:`right`,$mono:!0,children:r===void 0?`—`:w(r.requests)}),(0,J.jsx)(W,{$align:`right`,$mono:!0,children:y(t.lastUsedAt,s)})]},e.id))})]})})})}var ne=a.ul`
18
- display: flex;
19
- flex-direction: column;
20
- `,re=a.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
- `,ie=a(d)`
31
- font-family: ${({theme:e})=>e.font.mono};
32
- font-size: 12px;
33
- max-width: 30ch;
34
- `,ae=a(c)`
35
- color: ${({theme:e})=>e.color.down};
36
- font-size: 11px;
37
- `;function oe({logs:e}){let n=e.slice(0,12);return(0,J.jsx)(B,{legend:`Activity`,meta:`most recent first`,flush:!0,actions:(0,J.jsx)(t,{as:m,to:`/logs`,$size:`sm`,children:`Open logs`}),children:n.length===0?(0,J.jsx)(H,{legend:`No traffic yet`,message:`Point a client at this gateway with an API key and the requests will appear here.`}):(0,J.jsx)(ne,{children:n.map(e=>(0,J.jsxs)(re,{children:[(0,J.jsx)(F,{state:M(e),label:O(e)}),(0,J.jsx)(c,{$dim:!0,children:S(e.at)}),(0,J.jsx)(ie,{title:e.requestedModel,children:e.requestedModel||`—`}),e.resolvedProvider===null?null:(0,J.jsx)(c,{$dim:!0,style:{color:`var(--p-${e.resolvedProvider})`},children:e.resolvedProvider}),(0,J.jsx)(o,{}),P(e)?null:(0,J.jsxs)(J.Fragment,{children:[e.errorCode===null?null:(0,J.jsx)(ae,{children:e.errorCode}),e.attempts>1?(0,J.jsxs)(c,{$dim:!0,children:[e.attempts,`×`]}):null,(0,J.jsx)(c,{$dim:!0,children:x(e.durationMs)}),(0,J.jsx)(c,{$dim:!0,children:b(e.costUsd)})]})]},e.id))})})}var se=a.ul`
38
- display: flex;
39
- flex-direction: column;
40
- gap: ${({theme:e})=>e.space(3)};
41
- `,ce=a(d)`
42
- font-family: ${({theme:e})=>e.font.mono};
43
- font-size: 12.5px;
44
- `,le=a.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
- `,ue=a.div`
52
- flex: ${({$grow:e})=>e} 0 0;
53
- background: ${({$color:e})=>e};
54
- opacity: 0.8;
55
- `,de=a.div`
56
- flex: ${({$grow:e})=>e} 0 0;
57
- `;function fe({models:e,logs:n}){let r=new Map;for(let e of n){let t=r.get(e.requestedModel)??{requests:0,costUsd:0};t.requests+=1,t.costUsd+=e.costUsd,r.set(e.requestedModel,t)}let i=Math.max(1,...[...r.values()].map(e=>e.requests)),a=[...e].map(e=>({model:e,used:r.get(e.id)})).sort((e,t)=>(t.used?.requests??0)-(e.used?.requests??0)).slice(0,8);return(0,J.jsx)(B,{legend:`Models`,meta:`${e.length} configured`,actions:(0,J.jsx)(t,{as:m,to:`/models`,$size:`sm`,children:`Edit routing`}),children:e.length===0?(0,J.jsx)(H,{legend:`No models`,message:`Nothing is routable yet. Create a virtual model and point it at one or more provider targets.`,action:(0,J.jsx)(t,{as:m,to:`/models`,$variant:`primary`,$size:`sm`,children:`Create a model`})}):(0,J.jsx)(se,{children:a.map(({model:e,used:t})=>{let n=(t?.requests??0)/i,r=[...new Set(e.targets.map(e=>e.provider))];return(0,J.jsxs)(`li`,{children:[(0,J.jsxs)(u,{$gap:2,children:[(0,J.jsx)(ce,{title:e.id,children:e.id}),e.isAlias?(0,J.jsx)(R,{children:`alias`}):null,(0,J.jsx)(R,{$tone:`accent`,children:e.strategy}),(0,J.jsx)(o,{}),(0,J.jsx)(c,{$dim:!0,children:w(t?.requests??0)}),(0,J.jsx)(p,{children:`req`}),(0,J.jsx)(c,{$dim:!0,children:b(t?.costUsd??0)})]}),(0,J.jsxs)(le,{style:{marginTop:6},title:`${Math.round(n*100)}% of the busiest model`,children:[r.map(e=>(0,J.jsx)(ue,{$color:`var(--p-${e})`,$grow:n/r.length},e)),(0,J.jsx)(de,{$grow:Math.max(0,1-n)})]})]},e.id)})})})}var pe=a.div`
58
- display: grid;
59
- grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
60
- gap: ${({theme:e})=>e.space(3)};
61
- `;function me({logs:e,windowMs:t,now:n}){let r=e.filter(e=>n-e.at<=t),i=A(r,t),a=ee(r,{now:n,spanMs:t,count:32}),o=i.errorRate>=.25?`down`:i.errorRate>=.05?`warn`:`ok`;return(0,J.jsxs)(pe,{children:[(0,J.jsx)(q,{legend:`Requests`,value:w(i.requests),unit:`${i.ratePerMin.toFixed(1)}/min`,trace:(0,J.jsx)(C,{values:a.map(e=>e.total),overlay:a.map(e=>e.errors),label:`${i.requests} requests, ${i.errors} of them failed`})}),(0,J.jsx)(q,{legend:`Error rate`,value:E(i.errorRate),unit:`${w(i.errors)} failed`,tone:i.requests===0?`ink`:o,trace:(0,J.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,J.jsx)(q,{legend:`Time to first token`,value:x(i.ttftP50),unit:`p95 ${x(i.ttftP95)}`,trace:(0,J.jsx)(C,{values:a.map(e=>e.ttftMs??0),color:`var(--ok)`,label:`median first-token latency, currently ${x(i.ttftP50)}`})}),(0,J.jsx)(q,{legend:`Spend`,value:b(i.costUsd),unit:`${w(i.inputTokens+i.outputTokens)} tokens`,trace:(0,J.jsx)(C,{values:a.map(e=>e.costUsd),color:`var(--warn)`,label:`spend over the window, ${b(i.costUsd)} total`})})]})}var $=36e5;function he(){let{cadence:t}=v(),i=f(),a=h(t(1e4)),o=_(),c=g(500,t(1e4)),l=n(),u=Date.now(),d=Math.floor((u-$)/6e4)*6e4,p=r({groupBy:`credential`,since:d},t(6e4)),m=i.data??[],y=D(a.data?.health??[],e=>e.credentialId),b=m.filter(e=>j(y.get(e.id)??[],u,e.enabled,e.disabledReason).state===`down`),x=i.isLoading||c.isLoading?`Reading the gateway…`:m.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 ${m.length} accounts are answering. Nothing needs attention.`;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(T,{legend:`Rack`,title:`Gateway`,summary:x}),c.isError?(0,J.jsx)(B,{legend:`Traffic`,children:(0,J.jsx)(V,{legend:`The gateway did not answer`,error:c.error,onRetry:()=>void c.refetch()})}):(0,J.jsxs)(s,{$gap:4,children:[(0,J.jsx)(me,{logs:c.data??[],windowMs:$,now:u}),(0,J.jsx)(Q,{credentials:m,health:a.data?.health??[],quota:a.data?.quota??[],usage:p.data??[],quotaPollIntervalMs:l.data?.quotaPollIntervalMs??3e5,now:u}),(0,J.jsxs)(e,{$min:`340px`,$gap:4,children:[(0,J.jsx)(fe,{models:o.data??[],logs:c.data??[]}),(0,J.jsx)(oe,{logs:c.data??[]})]})]})]})}var ge=he;export{ge as component};
@@ -1,33 +0,0 @@
1
- import{B as e,F as t,G as n,L as r,M as i,Mt as a,Nt as o,P as s,R as c,Zt as l,d as ee,h as te,j as u,n as d,v as f}from"./queries-D_-Jj9vt.js";import{a as p,c as m,f as h,l as g,m as _,o as ne,p as v,s as y,t as re}from"./Rack-BFWC50ex.js";import{t as b}from"./Modal-lhjr949H.js";import{c as x,l as S,o as C,s as w,t as T}from"./Lamp-DO-sRDg2.js";import{n as E,t as D}from"./Chip-CM9ZMdr9.js";import{i as O,n as k}from"./Field-Br6jKPz8.js";import{a as ie,n as ae,r as oe,t as se}from"./States-BNeCLhZn.js";import{i as ce,n as A,r as j,t as M}from"./Table-nOg_lgEJ.js";var N=_(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),P=_(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),F=_(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),I=l(o(),1),L=a(),R=[50,100,250,500],z=new Intl.NumberFormat(`en-US`);function B(e){return`${z.format(e.inputTokens)} input, ${z.format(e.outputTokens)} output, ${z.format(e.cacheReadTokens)} cache read, ${z.format(e.cacheWriteTokens)} cache write tokens`}var V=n(s)`
2
- gap: ${({theme:e})=>e.space(2)};
3
- flex-wrap: wrap;
4
- `,H=n(k)`
5
- width: 220px;
6
- `,U=n(O)`
7
- width: auto;
8
- `,W=n.span`
9
- display: inline-flex;
10
- align-items: center;
11
- gap: 6px;
12
- white-space: nowrap;
13
- `,G=n.span`
14
- display: inline-flex;
15
- align-items: center;
16
- gap: 2px;
17
-
18
- svg {
19
- width: 12px;
20
- height: 12px;
21
- stroke-width: 1.75;
22
- }
23
- `;function le(e){let[t,n]=(0,I.useState)(Date.now);return(0,I.useEffect)(()=>{if(!e)return;n(Date.now());let t=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(t)},[e]),t}function K({log:e}){if(w(e))return(0,L.jsx)(A,{$align:`right`,$mono:!0,children:`—`});let t=B(e);return(0,L.jsx)(A,{$align:`right`,$mono:!0,"aria-label":t,title:t,children:(0,L.jsxs)(W,{"aria-hidden":`true`,children:[(0,L.jsxs)(G,{children:[(0,L.jsx)(N,{}),y(e.inputTokens)]}),(0,L.jsxs)(G,{children:[(0,L.jsx)(P,{}),y(e.outputTokens)]}),(0,L.jsxs)(G,{children:[(0,L.jsx)(F,{}),(0,L.jsx)(N,{}),y(e.cacheReadTokens)]}),(0,L.jsxs)(G,{children:[(0,L.jsx)(F,{}),(0,L.jsx)(P,{}),y(e.cacheWriteTokens)]})]})})}var ue=n.dl`
24
- display: grid;
25
- grid-template-columns: minmax(120px, auto) minmax(0, 1fr);
26
- gap: 6px ${({theme:e})=>e.space(3)};
27
- margin: 0;
28
- font-size: 12.5px;
29
- `,q=n.dd`
30
- margin: 0;
31
- font-family: ${({theme:e})=>e.font.mono};
32
- word-break: break-all;
33
- `;function J(){let{cadence:n,live:a}=p(),[o,l]=(0,I.useState)(100),[_,O]=(0,I.useState)(`all`),[k,N]=(0,I.useState)(``),[P,F]=(0,I.useState)(null),z=f(o,n(d)),B=ee(),W=te(),G=(z.data??[]).some(w),J=le(a&&G),Y=(0,I.useMemo)(()=>{let e=new Map;for(let t of B.data??[])e.set(t.id,t.label);return e},[B.data]),X=(0,I.useMemo)(()=>{let e=new Map;for(let t of W.data??[])e.set(t.id,t.label);return e},[W.data]),Z=k.trim().toLowerCase(),Q=(z.data??[]).filter(e=>_===`failed`&&!C(e)?!1:Z.length===0||e.requestedModel.toLowerCase().includes(Z)||(e.resolvedModel??``).toLowerCase().includes(Z)||(e.errorCode??``).toLowerCase().includes(Z)||(e.credentialId===null?``:Y.get(e.credentialId)??``).toLowerCase().includes(Z)||(e.apiKeyId===null?``:X.get(e.apiKeyId)??e.apiKeyId).toLowerCase().includes(Z)),de=(z.data??[]).filter(C).length,$=(z.data??[]).filter(w).length;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(re,{legend:`Logs`,title:`Recent requests`,summary:z.isLoading?`Reading the request log…`:`${y(z.data?.length??0)} recent requests, ${y(de)} of them failed${$===0?``:`, ${y($)} still running`}. Prompt and response bodies are never recorded.`,actions:(0,L.jsxs)(V,{children:[(0,L.jsx)(H,{value:k,placeholder:`Filter by model, account, key, or error`,"aria-label":`Filter requests`,onChange:e=>N(e.target.value)}),(0,L.jsxs)(U,{value:_,"aria-label":`Show which requests`,onChange:e=>O(e.target.value),children:[(0,L.jsx)(`option`,{value:`all`,children:`All requests`}),(0,L.jsx)(`option`,{value:`failed`,children:`Failed only`})]}),(0,L.jsx)(U,{value:o,"aria-label":`How many requests to fetch`,onChange:e=>l(Number(e.target.value)),children:R.map(e=>(0,L.jsxs)(`option`,{value:e,children:[`last `,e]},e))})]})}),(0,L.jsx)(ie,{legend:`Request log`,meta:`${Q.length} shown`,flush:!0,children:z.isError?(0,L.jsx)(ae,{error:z.error,onRetry:()=>void z.refetch()}):z.isLoading?(0,L.jsx)(`div`,{style:{padding:12},children:(0,L.jsx)(oe,{rows:8})}):Q.length===0?(0,L.jsx)(se,{legend:`Nothing to show`,message:(z.data?.length??0)===0?`No requests have reached the gateway yet.`:`No request in this window matches the filter. Clear it to see everything.`}):(0,L.jsx)(t,{children:(0,L.jsxs)(M,{children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(j,{}),(0,L.jsx)(j,{$align:`right`,children:`Time`}),(0,L.jsx)(j,{children:`Requested`}),(0,L.jsx)(j,{children:`Routed to`}),(0,L.jsx)(j,{children:`Account`}),(0,L.jsx)(j,{children:`Key`}),(0,L.jsx)(j,{$align:`right`,children:`Try`}),(0,L.jsx)(j,{$align:`right`,children:`TTFT`}),(0,L.jsx)(j,{$align:`right`,children:`Total`}),(0,L.jsx)(j,{$align:`right`,children:`Tokens`}),(0,L.jsx)(j,{$align:`right`,children:`Cost`}),(0,L.jsx)(j,{children:`Outcome`})]})}),(0,L.jsx)(`tbody`,{children:Q.map(e=>(0,L.jsxs)(ce,{$selectable:!0,onClick:()=>F(e),children:[(0,L.jsx)(A,{children:(0,L.jsx)(T,{state:S(e),label:x(e)})}),(0,L.jsx)(A,{$align:`right`,$mono:!0,title:m(e.at),children:ne(e.at)}),(0,L.jsx)(A,{$mono:!0,children:(0,L.jsx)(c,{style:{display:`block`,maxWidth:`20ch`},children:e.requestedModel||`—`})}),(0,L.jsx)(A,{children:e.resolvedProvider===null?(0,L.jsx)(u,{children:w(e)?`routing…`:`not routed`}):(0,L.jsxs)(s,{$gap:1,children:[(0,L.jsx)(E,{provider:e.resolvedProvider}),(0,L.jsx)(i,{$dim:!0,children:e.resolvedModel??`—`})]})}),(0,L.jsx)(A,{children:(0,L.jsx)(c,{style:{display:`block`,maxWidth:`18ch`},children:e.credentialId===null?`—`:Y.get(e.credentialId)??v(e.credentialId)})}),(0,L.jsx)(A,{children:(0,L.jsx)(c,{style:{display:`block`,maxWidth:`16ch`},title:e.apiKeyId??void 0,children:e.apiKeyId===null?`—`:X.get(e.apiKeyId)??v(e.apiKeyId)})}),(0,L.jsx)(A,{$align:`right`,$mono:!0,children:w(e)?`—`:e.attempts}),(0,L.jsx)(A,{$align:`right`,$mono:!0,children:w(e)?`—`:g(e.ttftMs)}),(0,L.jsx)(A,{$align:`right`,$mono:!0,children:g(w(e)?Math.max(0,J-e.at):e.durationMs)}),(0,L.jsx)(K,{log:e}),(0,L.jsx)(A,{$align:`right`,$mono:!0,children:w(e)?`—`:h(e.costUsd)}),(0,L.jsx)(A,{children:w(e)?(0,L.jsx)(D,{$tone:`accent`,children:`live`}):e.errorCode===null?(0,L.jsx)(D,{$tone:`ok`,children:e.status}):(0,L.jsx)(D,{$tone:`down`,children:e.errorCode})})]},e.id))})]})})}),(0,L.jsx)(b,{open:P!==null,onOpenChange:e=>{e||F(null)},title:`Request detail`,width:`600px`,footer:(0,L.jsx)(e,{type:`button`,onClick:()=>F(null),children:`Close`}),children:P===null?null:(0,L.jsxs)(r,{$gap:3,children:[(0,L.jsxs)(ue,{children:[(0,L.jsx)(u,{as:`dt`,children:`Request id`}),(0,L.jsx)(q,{children:P.id}),(0,L.jsx)(u,{as:`dt`,children:`At`}),(0,L.jsx)(q,{children:m(P.at)}),(0,L.jsx)(u,{as:`dt`,children:`Requested model`}),(0,L.jsx)(q,{children:P.requestedModel||`—`}),(0,L.jsx)(u,{as:`dt`,children:`Routed to`}),(0,L.jsx)(q,{children:w(P)?`—`:P.resolvedProvider===null?`not routed`:`${P.resolvedProvider} · ${P.resolvedModel??`—`}`}),(0,L.jsx)(u,{as:`dt`,children:`Account`}),(0,L.jsx)(q,{children:P.credentialId===null?`—`:Y.get(P.credentialId)??P.credentialId}),(0,L.jsx)(u,{as:`dt`,children:`Key`}),(0,L.jsx)(q,{children:P.apiKeyId===null?`—`:X.get(P.apiKeyId)??P.apiKeyId}),(0,L.jsx)(u,{as:`dt`,children:`Attempts`}),(0,L.jsx)(q,{children:w(P)?`—`:P.attempts}),(0,L.jsx)(u,{as:`dt`,children:`Status`}),(0,L.jsx)(q,{children:w(P)?`in flight`:P.errorCode===null?P.status:`${P.status} ${P.errorCode}`}),(0,L.jsx)(u,{as:`dt`,children:`Timing`}),(0,L.jsx)(q,{children:w(P)?`—`:`first token ${g(P.ttftMs)} · total ${g(P.durationMs)}`}),(0,L.jsx)(u,{as:`dt`,children:`Tokens`}),(0,L.jsx)(q,{children:w(P)?`—`:(0,L.jsxs)(L.Fragment,{children:[y(P.inputTokens),` in · `,y(P.outputTokens),` out ·`,` `,y(P.cacheReadTokens),` cache read ·`,` `,y(P.cacheWriteTokens),` cache write`]})}),(0,L.jsx)(u,{as:`dt`,children:`Cost`}),(0,L.jsx)(q,{children:w(P)?`—`:h(P.costUsd)})]}),P.degradations.length===0?null:(0,L.jsxs)(r,{$gap:1,children:[(0,L.jsx)(u,{children:`Capabilities dropped to fit the target`}),(0,L.jsx)(s,{$gap:1,$wrap:!0,children:P.degradations.map(e=>(0,L.jsx)(D,{$tone:`warn`,children:e},e))})]})]})})]})}var Y=J;export{Y as component};
@@ -1,34 +0,0 @@
1
- import{B as e,C as t,G as n,I as r,L as i,M as a,Mt as o,Nt as s,P as c,S as l,Zt as u,a as d,j as f}from"./queries-D_-Jj9vt.js";import{t as p}from"./Rack-BFWC50ex.js";import{n as m,t as h}from"./Field-Br6jKPz8.js";import{t as g}from"./Meter-BzMaum0C.js";import{a as _,i as v,n as y,r as b}from"./States-BNeCLhZn.js";var x=u(s(),1),S=o(),C=[{id:`claude`,label:`Claude Code`,where:`one profile per model, under ~/.claude/profiles`},{id:`opencode`,label:`opencode`,where:`opencode.json in your project`}],w=n(a)`
2
- display: block;
3
- white-space: pre;
4
- overflow-x: auto;
5
- padding: 0.75rem;
6
- background: ${({theme:e})=>e.color.panelSunk};
7
- border: 1px solid ${({theme:e})=>e.color.rule};
8
- border-radius: 4px;
9
- font-size: 0.8125rem;
10
- line-height: 1.5;
11
- `,T=n.div`
12
- color: ${({theme:e})=>e.color.inkDim};
13
- font-size: 0.8125rem;
14
- margin-bottom: 0.25rem;
15
- `,E=n.p`
16
- color: ${({theme:e})=>e.color.inkDim};
17
- font-size: 0.8125rem;
18
- margin: 0;
19
- `;function D(){let[t,n]=(0,x.useState)(`claude`),r=d(t),o=C.find(e=>e.id===t);return(0,S.jsx)(_,{legend:`Agent setup`,children:(0,S.jsxs)(i,{children:[(0,S.jsx)(c,{children:C.map(r=>(0,S.jsx)(e,{type:`button`,$variant:r.id===t?`primary`:`ghost`,onClick:()=>n(r.id),children:r.label},r.id))}),(0,S.jsxs)(E,{children:[o?.where,`. The key is a placeholder — paste your own over it. Or run`,` `,(0,S.jsxs)(a,{children:[`omni setup `,t]}),` to write these files directly.`]}),r.isError?(0,S.jsx)(y,{error:r.error,onRetry:()=>void r.refetch()}):r.isLoading?(0,S.jsx)(b,{rows:4}):r.data===void 0||r.data.length===0?(0,S.jsx)(E,{children:`No virtual models configured yet, so there is nothing to point a client at.`}):r.data.map(e=>(0,S.jsxs)(`div`,{children:[(0,S.jsx)(T,{children:e.path}),(0,S.jsx)(w,{as:`pre`,children:e.contents.trimEnd()})]},e.path)),r.isError?(0,S.jsx)(E,{children:v(r.error)}):null]})})}var O=[{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.`}],k=[{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}],A=n.div`
20
- display: grid;
21
- grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
22
- gap: ${({theme:e})=>e.space(3)};
23
- `,j=n(i)`
24
- gap: 6px;
25
- `,M=n.p`
26
- font-size: 11px;
27
- color: ${({theme:e})=>e.color.inkDim};
28
- `,N=n.p`
29
- font-size: 12px;
30
- color: ${({theme:e})=>e.color.down};
31
- `,P=n.p`
32
- font-size: 12px;
33
- color: ${({theme:e})=>e.color.ok};
34
- `;function F(e){let t={};for(let n of O)t[`w.${n.id}`]=String(e.weights[n.id]);for(let n of k)t[n.id]=String(e[n.id]);return t}function I(e){let t={};for(let n of O){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 k){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}}}function L(){let n=t(),o=l(),[s,u]=(0,x.useState)({}),[d,C]=(0,x.useState)(null),[w,T]=(0,x.useState)(!1);(0,x.useEffect)(()=>{n.data!==void 0&&u(F(n.data))},[n.data]);let E=Math.max(1e-4,...O.map(e=>Math.abs(Number(s[`w.${e.id}`])||0)));return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(p,{legend:`Settings`,title:`Routing and retention`,summary:`These apply to every request the gateway routes. Changes take effect on the next request; nothing is restarted.`,actions:(0,S.jsx)(e,{type:`button`,$variant:`primary`,disabled:o.isPending||n.isLoading,onClick:()=>{T(!1);let e=I(s);if(!e.ok){C(e.problem);return}C(null),o.mutate(e.settings,{onSuccess:()=>T(!0),onError:e=>C(v(e))})},children:o.isPending?`Saving…`:`Save changes`})}),n.isError?(0,S.jsx)(_,{legend:`Settings`,children:(0,S.jsx)(y,{error:n.error,onRetry:()=>void n.refetch()})}):n.isLoading?(0,S.jsx)(_,{legend:`Settings`,children:(0,S.jsx)(b,{rows:6})}):(0,S.jsxs)(i,{$gap:4,children:[(0,S.jsx)(_,{legend:`Scoring weights`,meta:`relative to each other`,footer:(0,S.jsxs)(c,{children:[(0,S.jsx)(f,{children:`A candidate's score is the sum of each term times its weight, then multiplied by the account and target weights.`}),(0,S.jsx)(r,{})]}),children:(0,S.jsx)(A,{children:O.map(e=>{let t=Number(s[`w.${e.id}`])||0;return(0,S.jsxs)(j,{children:[(0,S.jsx)(h,{label:e.label,children:t=>(0,S.jsx)(m,{...t,type:`number`,step:.5,value:s[`w.${e.id}`]??``,onChange:t=>u({...s,[`w.${e.id}`]:t.target.value})})}),(0,S.jsx)(g,{fraction:Math.abs(t)/E,height:4,tone:`var(--accent)`,label:`${e.label} weight ${t}`}),(0,S.jsx)(M,{children:e.blurb})]},e.id)})})}),(0,S.jsx)(_,{legend:`Limits`,children:(0,S.jsx)(A,{children:k.map(e=>(0,S.jsx)(j,{children:(0,S.jsx)(h,{label:e.label,hint:e.hint,children:t=>(0,S.jsxs)(c,{$gap:2,children:[(0,S.jsx)(m,{...t,type:`number`,min:e.min,step:e.step,value:s[e.id]??``,onChange:t=>u({...s,[e.id]:t.target.value})}),(0,S.jsx)(f,{children:e.unit})]})})},e.id))})}),d===null?null:(0,S.jsx)(N,{role:`alert`,children:d}),w&&d===null?(0,S.jsx)(P,{role:`status`,children:`Settings saved.`}):null,(0,S.jsx)(D,{}),(0,S.jsx)(_,{legend:`Known limits`,children:(0,S.jsxs)(i,{$gap:2,children:[(0,S.jsxs)(c,{$gap:2,children:[(0,S.jsx)(a,{$dim:!0,children:`rate limits`}),(0,S.jsx)(M,{children:`Per-key rate limits are counted inside one gateway process and reset when it restarts. They are not shared across instances.`})]}),(0,S.jsxs)(c,{$gap:2,children:[(0,S.jsx)(a,{$dim:!0,children:`logs`}),(0,S.jsx)(M,{children:`Request rows record routing and token counts only. Prompts, responses, and credentials are never written.`})]})]})})]})]})}var R=L;export{R as component};