omnigateway 0.1.6 → 0.1.8

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 (37) hide show
  1. package/README.md +24 -5
  2. package/bin/omni.js +805 -352
  3. package/gateway.js +622 -236
  4. package/package.json +1 -1
  5. package/public/assets/{Chip-Ccqsb_Mq.js → Chip-CM9ZMdr9.js} +2 -2
  6. package/public/assets/{CopyValue-cAwgC1sU.js → CopyValue-WrOTcHwq.js} +4 -4
  7. package/public/assets/{Field-Devm4K46.js → Field-Br6jKPz8.js} +8 -8
  8. package/public/assets/{Lamp-BXSUIAtG.js → Lamp-DO-sRDg2.js} +7 -7
  9. package/public/assets/{Meter-Fn8X7t60.js → Meter-BzMaum0C.js} +2 -2
  10. package/public/assets/{Modal-Dqir9wBz.js → Modal-lhjr949H.js} +8 -8
  11. package/public/assets/Rack-BFWC50ex.js +147 -0
  12. package/public/assets/{Readout-BKpOZIGX.js → Readout-DMJs4gYD.js} +5 -5
  13. package/public/assets/{States-DBzsiHjQ.js → States-BNeCLhZn.js} +10 -10
  14. package/public/assets/{Table-DPDJeeVc.js → Table-nOg_lgEJ.js} +1 -1
  15. package/public/assets/{Toggle-BhViDMm9.js → Toggle-DYoCVD37.js} +3 -3
  16. package/public/assets/_app-lXr06Xli.js +1 -0
  17. package/public/assets/_app.accounts-BTb5vHI_.js +51 -0
  18. package/public/assets/_app.console-DHUClMsI.js +25 -0
  19. package/public/assets/_app.index-DZ--9mKU.js +61 -0
  20. package/public/assets/_app.keys-B-cy-2DS.js +39 -0
  21. package/public/assets/_app.logs-BQjAIT2P.js +33 -0
  22. package/public/assets/{_app.models-CuD-JtGS.js → _app.models-BAmXHlf2.js} +27 -27
  23. package/public/assets/_app.settings-CG8bv_rm.js +34 -0
  24. package/public/assets/{_app.usage-DAyYUfIi.js → _app.usage-BLrQ2hB8.js} +28 -28
  25. package/public/assets/index-UAZ0O5y0.js +170 -0
  26. package/public/assets/{login-DXHM-Noj.js → login-BpUl6C5b.js} +8 -8
  27. package/public/assets/{queries-BMwc6EvM.js → queries-D_-Jj9vt.js} +12 -12
  28. package/public/assets/{trash-2-JF_uX2gE.js → trash-2-DjWP2u19.js} +1 -1
  29. package/public/index.html +2 -2
  30. package/public/assets/Rack-XtfiZ6GC.js +0 -147
  31. package/public/assets/_app-B8lqq_ks.js +0 -1
  32. package/public/assets/_app.accounts-DSMHSYBF.js +0 -51
  33. package/public/assets/_app.index-DXH5sH41.js +0 -61
  34. package/public/assets/_app.keys-DdEyVy_b.js +0 -39
  35. package/public/assets/_app.logs-Camxditb.js +0 -33
  36. package/public/assets/_app.settings-DA1aYcR4.js +0 -16
  37. package/public/assets/index-BtjyVE1i.js +0 -170
@@ -1,4 +1,4 @@
1
- import{A as e,I as t,M as n,O as r,Ot as i,R as a,T as o,V as s}from"./queries-BMwc6EvM.js";var c=i(),l=s.section`
1
+ import{B as e,G as t,H as n,I as r,Mt as i,O as a,P as o,j as s}from"./queries-D_-Jj9vt.js";var c=i(),l=t.section`
2
2
  background: ${({theme:e})=>e.color.panel};
3
3
  border: 1px solid ${({theme:e})=>e.color.rule};
4
4
  border-radius: ${({theme:e})=>e.radius.panel};
@@ -7,7 +7,7 @@ import{A as e,I as t,M as n,O as r,Ot as i,R as a,T as o,V as s}from"./queries-B
7
7
  display: flex;
8
8
  flex-direction: column;
9
9
  min-width: 0;
10
- `,u=s.header`
10
+ `,u=t.header`
11
11
  display: flex;
12
12
  align-items: center;
13
13
  gap: ${({theme:e})=>e.space(2)};
@@ -15,14 +15,14 @@ import{A as e,I as t,M as n,O as r,Ot as i,R as a,T as o,V as s}from"./queries-B
15
15
  border-bottom: 1px solid ${({theme:e})=>e.color.rule};
16
16
  background: ${({theme:e})=>e.color.panelSunk};
17
17
  min-height: 34px;
18
- `,d=s.div`
18
+ `,d=t.div`
19
19
  padding: ${({theme:e,$flush:t})=>t===!0?`0`:e.space(3)};
20
20
  min-width: 0;
21
- `,f=s.footer`
21
+ `,f=t.footer`
22
22
  padding: ${({theme:e})=>`${e.space(2)} ${e.space(3)}`};
23
23
  border-top: 1px solid ${({theme:e})=>e.color.rule};
24
24
  background: ${({theme:e})=>e.color.panelSunk};
25
- `;function p({legend:t,meta:i,actions:a,footer:o,flush:s,className:p,children:m}){return(0,c.jsxs)(l,{className:p,children:[(0,c.jsxs)(u,{children:[(0,c.jsx)(r,{children:t}),i===void 0?null:(0,c.jsx)(r,{as:`span`,children:i}),(0,c.jsx)(n,{}),a===void 0?null:(0,c.jsx)(e,{$gap:1,children:a})]}),(0,c.jsx)(d,{...s===!0?{$flush:!0}:{},children:m}),o===void 0?null:(0,c.jsx)(f,{children:o})]})}var m=s.div`
25
+ `;function p({legend:e,meta:t,actions:n,footer:i,flush:a,className:p,children:m}){return(0,c.jsxs)(l,{className:p,children:[(0,c.jsxs)(u,{children:[(0,c.jsx)(s,{children:e}),t===void 0?null:(0,c.jsx)(s,{as:`span`,children:t}),(0,c.jsx)(r,{}),n===void 0?null:(0,c.jsx)(o,{$gap:1,children:n})]}),(0,c.jsx)(d,{...a===!0?{$flush:!0}:{},children:m}),i===void 0?null:(0,c.jsx)(f,{children:i})]})}var m=t.div`
26
26
  display: flex;
27
27
  flex-direction: column;
28
28
  align-items: center;
@@ -30,23 +30,23 @@ import{A as e,I as t,M as n,O as r,Ot as i,R as a,T as o,V as s}from"./queries-B
30
30
  gap: ${({theme:e})=>e.space(2)};
31
31
  padding: ${({theme:e})=>e.space(8)} ${({theme:e})=>e.space(4)};
32
32
  text-align: center;
33
- `,h=s.p`
33
+ `,h=t.p`
34
34
  max-width: 44ch;
35
35
  font-size: 13px;
36
36
  color: ${({theme:e})=>e.color.inkDim};
37
- `;function g({legend:e,message:t,action:n}){return(0,c.jsxs)(m,{children:[(0,c.jsx)(r,{children:e}),(0,c.jsx)(h,{children:t}),n]})}var _=s(h)`
37
+ `;function g({legend:e,message:t,action:n}){return(0,c.jsxs)(m,{children:[(0,c.jsx)(s,{children:e}),(0,c.jsx)(h,{children:t}),n]})}var _=t(h)`
38
38
  color: ${({theme:e})=>e.color.down};
39
- `;function v(e){return e instanceof o||e instanceof Error?e.message:`The gateway did not answer.`}function y({legend:e=`Request failed`,error:n,onRetry:i}){return(0,c.jsxs)(m,{children:[(0,c.jsx)(r,{children:e}),(0,c.jsx)(_,{children:v(n)}),i===void 0?null:(0,c.jsx)(t,{type:`button`,$size:`sm`,onClick:i,children:`Try again`})]})}var b=a`
39
+ `;function v(e){return e instanceof a||e instanceof Error?e.message:`The gateway did not answer.`}function y({legend:t=`Request failed`,error:n,onRetry:r}){return(0,c.jsxs)(m,{children:[(0,c.jsx)(s,{children:t}),(0,c.jsx)(_,{children:v(n)}),r===void 0?null:(0,c.jsx)(e,{type:`button`,$size:`sm`,onClick:r,children:`Try again`})]})}var b=n`
40
40
  0% { opacity: 0.35; }
41
41
  50% { opacity: 0.7; }
42
42
  100% { opacity: 0.35; }
43
- `,x=s.div`
43
+ `,x=t.div`
44
44
  height: ${({$height:e})=>e??12}px;
45
45
  width: ${({$width:e})=>e??`100%`};
46
46
  border-radius: 2px;
47
47
  background: ${({theme:e})=>e.color.ruleStrong};
48
48
  animation: ${b} 1.4s ease-in-out infinite;
49
- `,S=s.div`
49
+ `,S=t.div`
50
50
  display: flex;
51
51
  flex-direction: column;
52
52
  gap: ${({theme:e})=>e.space(2)};
@@ -1,4 +1,4 @@
1
- import{V as e}from"./queries-BMwc6EvM.js";var t=e.table`
1
+ import{G as e}from"./queries-D_-Jj9vt.js";var t=e.table`
2
2
  width: 100%;
3
3
  border-collapse: collapse;
4
4
  font-size: 12.5px;
@@ -1,7 +1,7 @@
1
- import{I as e,Ot as t,V as n,kt as r,qt as i}from"./queries-BMwc6EvM.js";import{m as a}from"./Rack-XtfiZ6GC.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-Dqir9wBz.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=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=n.p`
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
2
  font-size: 13px;
3
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=n(k)`
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
5
  all: unset;
6
6
  width: 30px;
7
7
  height: 16px;
@@ -26,7 +26,7 @@ import{I as e,Ot as t,V as n,kt as r,qt as i}from"./queries-BMwc6EvM.js";import{
26
26
  outline: 2px solid ${({theme:e})=>e.color.accent};
27
27
  outline-offset: 2px;
28
28
  }
29
- `,z=n(j)`
29
+ `,z=t(j)`
30
30
  display: block;
31
31
  width: 12px;
32
32
  height: 12px;
@@ -0,0 +1 @@
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};
@@ -0,0 +1,51 @@
1
+ import{B as e,C as t,E as n,F as r,G as i,L as a,Mt as o,Nt as s,P as c,V as l,Zt as u,d,f,j as p,o as m,r as h,s as g,u as _}from"./queries-D_-Jj9vt.js";import{a as v,d as y,l as b,m as x,t as S}from"./Rack-BFWC50ex.js";import{t as C}from"./CopyValue-WrOTcHwq.js";import{n as w,r as T,t as ee}from"./Toggle-DYoCVD37.js";import{t as E}from"./trash-2-DjWP2u19.js";import{t as D}from"./Modal-lhjr949H.js";import{a as O,d as te,i as ne,n as re,t as k,u as A}from"./Lamp-DO-sRDg2.js";import{t as j}from"./Chip-CM9ZMdr9.js";import{i as M,n as N,r as P,t as F}from"./Field-Br6jKPz8.js";import{t as ie}from"./Meter-BzMaum0C.js";import{a as I,i as L,n as R,r as z,t as B}from"./States-BNeCLhZn.js";import{i as V,n as H,r as U,t as W}from"./Table-nOg_lgEJ.js";import{t as G}from"./catalog-C_OQ0icG.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=u(s(),1),J=o(),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=i.ol`
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: ${({theme:e})=>e.space(3)};
5
+ `,se=i.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=i.p`
15
+ font-size: 12px;
16
+ color: ${({theme:e})=>e.color.down};
17
+ `,le=i.p`
18
+ font-size: 12px;
19
+ color: ${({theme:e})=>e.color.inkDim};
20
+ `;function ue({open:t,onOpenChange:n,onConnected:r}){let[i,o]=(0,q.useState)(`anthropic`),[s,l]=(0,q.useState)(``),[u,d]=(0,q.useState)(null),[f,_]=(0,q.useState)(``),[v,y]=(0,q.useState)(null),b=g(),x=m(),S=(0,q.useCallback)(()=>{d(null),_(``),y(null),l(``),b.reset(),x.reset()},[b,x]),w=(0,q.useCallback)(e=>{e||S(),n(e)},[n,S]);return(0,q.useEffect)(()=>{if(u===null||u.kind!==`device`)return;let e=!1,t=async()=>{try{let t=await h(u.flowId);if(e)return;if(t.status===`complete`){S(),n(!1),r();return}}catch(t){if(e)return;y(L(t)),d(null);return}e||(i=setTimeout(()=>void t(),u.pollIntervalMs))},i=setTimeout(()=>void t(),u.pollIntervalMs);return()=>{e=!0,clearTimeout(i)}},[u,r,n,S]),(0,J.jsx)(D,{open:t,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)(e,{type:`button`,onClick:()=>w(!1),children:`Cancel`}),(0,J.jsx)(e,{type:`button`,$variant:`primary`,disabled:b.isPending,onClick:()=>{y(null),b.mutate({provider:i,label:s.trim().length===0?Y[i]:s.trim()},{onSuccess:e=>d(e),onError:e=>y(L(e))})},children:b.isPending?`Starting…`:`Start authorization`})]}):u.kind===`device`?(0,J.jsx)(e,{type:`button`,onClick:()=>w(!1),children:`Cancel`}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(e,{type:`button`,onClick:()=>w(!1),children:`Cancel`}),(0,J.jsx)(e,{type:`button`,$variant:`primary`,disabled:x.isPending||f.trim().length===0,onClick:()=>{u!==null&&(y(null),x.mutate({flowId:u.flowId,code:f.trim()},{onSuccess:()=>{S(),n(!1),r()},onError:e=>y(L(e))}))},children:x.isPending?`Finishing…`:`Finish connecting`})]}),children:(0,J.jsxs)(oe,{children:[u===null?(0,J.jsxs)(a,{$gap:3,children:[(0,J.jsx)(F,{label:`Provider`,children:e=>(0,J.jsx)(M,{...e,value:i,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:s,placeholder:Y[i],onChange:e=>l(e.target.value)})})]}):(0,J.jsxs)(a,{$gap:3,children:[(0,J.jsxs)(a,{$gap:1,children:[(0,J.jsx)(p,{children:`Step 1 — authorize`}),(0,J.jsx)(c,{$gap:2,children:(0,J.jsxs)(e,{as:`a`,href:u.authorizeUrl,target:`_blank`,rel:`noreferrer noopener`,$variant:`primary`,$size:`sm`,children:[(0,J.jsx)(K,{}),`Open `,Y[i]]})}),(0,J.jsx)(C,{value:u.authorizeUrl,label:`Copy authorization link`})]}),u.userCode===null?null:(0,J.jsxs)(a,{$gap:1,children:[(0,J.jsx)(p,{children:`Step 2 — enter this code`}),(0,J.jsx)(se,{children:u.userCode})]}),u.kind===`device`?(0,J.jsxs)(le,{children:[X[i],` Waiting for authorization…`]}):(0,J.jsx)(F,{label:`Authorization code`,hint:X[i],...v===null?{}:{problem:v},children:e=>(0,J.jsx)(N,{...e,value:f,autoFocus:!0,placeholder:i===`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=i(I)`
21
+ border-left: 3px solid ${({theme:e,$provider:t})=>e.provider[t]};
22
+ `,pe=i(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=i(P)`
37
+ width: 62px;
38
+ height: 26px;
39
+ `,me=i.span`
40
+ display: block;
41
+ padding-left: 9px;
42
+ font-size: 11px;
43
+ color: ${({theme:e})=>e.color.inkDim};
44
+ `,he=i(c)`
45
+ min-width: 130px;
46
+ gap: 6px;
47
+ `,ge=i.div`
48
+ display: flex;
49
+ flex-direction: column;
50
+ gap: 4px;
51
+ `;function $(){let e=n();return{pending:e.isPending,commit:(t,n)=>{e.mutate({id:t,patch:n})}}}function _e(){let{cadence:n}=v(),i=d(),o=_(n(1e4)),s=t(),u=f(),{commit:m}=$(),[h,g]=(0,q.useState)(!1),[x,C]=(0,q.useState)(null),D=Date.now(),M=i.data??[],N=O(o.data?.health??[],e=>e.credentialId),P=O(o.data?.quota??[],e=>e.credentialId),F=s.data?.quotaPollIntervalMs??3e5,L=M.filter(e=>e.enabled).length,G=i.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)(e,{type:`button`,$variant:`primary`,onClick:()=>g(!0),children:[(0,J.jsx)(T,{}),`Connect an account`]})}),i.isError?(0,J.jsx)(I,{legend:`Accounts`,children:(0,J.jsx)(R,{error:i.error,onRetry:()=>void i.refetch()})}):i.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)(e,{type:`button`,$variant:`primary`,$size:`sm`,onClick:()=>g(!0),children:`Connect an account`})})}):(0,J.jsx)(a,{$gap:4,children:de.filter(e=>M.some(t=>t.provider===e)).map(e=>{let t=M.filter(t=>t.provider===e);return(0,J.jsx)(fe,{$provider:e,legend:Z[e],meta:`${t.length} account${t.length===1?``:`s`}`,flush:!0,children:(0,J.jsx)(r,{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:t.map(e=>{let t=ne(N.get(e.id)??[],D,e.enabled,e.disabledReason),n=te(P.get(e.id)??[]);return(0,J.jsxs)(V,{children:[(0,J.jsxs)(H,{children:[(0,J.jsxs)(c,{$gap:2,children:[(0,J.jsx)(k,{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}m(e.id,{label:n})}})]}),t.note===``?null:(0,J.jsx)(me,{children:t.note})]}),(0,J.jsx)(H,{children:(0,J.jsxs)(c,{$gap:1,children:[(0,J.jsx)(j,{children:e.authType===`oauth`?`oauth`:`api key`}),e.accountEmail===null?null:(0,J.jsx)(p,{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}m(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}m(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=>m(e.id,{enabled:t})})}),(0,J.jsx)(H,{children:n.length===0?(0,J.jsx)(p,{children:`unknown`}):(0,J.jsx)(ge,{children:n.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)(p,{children:A(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)(l,{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)})})]})})},e)})}),(0,J.jsx)(ue,{open:h,onOpenChange:g,onConnected:()=>void i.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:u.isPending,onConfirm:()=>{x!==null&&u.mutate(x.id,{onSettled:()=>C(null)})}})]})}var ve=_e;export{ve as component};
@@ -0,0 +1,25 @@
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};
@@ -0,0 +1,61 @@
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};
@@ -0,0 +1,39 @@
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,b as u,h as d,j as f,l as p,y as m}from"./queries-D_-Jj9vt.js";import{c as h,t as g}from"./Rack-BFWC50ex.js";import{t as _}from"./CopyValue-WrOTcHwq.js";import{n as v,r as y,t as b}from"./Toggle-DYoCVD37.js";import{t as x}from"./Modal-lhjr949H.js";import{t as S}from"./Chip-CM9ZMdr9.js";import{n as C,t as w}from"./Field-Br6jKPz8.js";import{a as T,i as E,n as D,r as O,t as k}from"./States-BNeCLhZn.js";import{i as A,n as j,r as M,t as N}from"./Table-nOg_lgEJ.js";var P=l(o(),1),F=a(),I=n.div`
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 2px;
5
+ max-height: 190px;
6
+ overflow-y: auto;
7
+ padding: ${({theme:e})=>e.space(1)};
8
+ border: 1px solid ${({theme:e})=>e.color.ruleStrong};
9
+ border-radius: ${({theme:e})=>e.radius.control};
10
+ background: ${({theme:e})=>e.color.panelSunk};
11
+ `,L=n.label`
12
+ display: flex;
13
+ align-items: center;
14
+ gap: ${({theme:e})=>e.space(2)};
15
+ padding: 4px 6px;
16
+ border-radius: 2px;
17
+ cursor: pointer;
18
+ font-family: ${({theme:e})=>e.font.mono};
19
+ font-size: 12px;
20
+
21
+ &:hover {
22
+ background: ${({theme:e})=>e.color.panelRaised};
23
+ }
24
+ `,R=n.p`
25
+ font-size: 12px;
26
+ color: ${({theme:e})=>e.color.warn};
27
+ `,z=n.p`
28
+ font-size: 12px;
29
+ color: ${({theme:e})=>e.color.down};
30
+ `,B=n.p`
31
+ font-size: 12px;
32
+ color: ${({theme:e})=>e.color.inkDim};
33
+ `;function V({open:t,onOpenChange:n}){let a=m(),o=p(),[c,l]=(0,P.useState)(``),[u,d]=(0,P.useState)(!0),[h,g]=(0,P.useState)([]),[v,y]=(0,P.useState)(``),[S,T]=(0,P.useState)(null),[D,O]=(0,P.useState)(null),k=()=>{l(``),d(!0),g([]),y(``),T(null),O(null),o.reset()},A=e=>{e||k(),n(e)};return(0,F.jsx)(x,{open:t,onOpenChange:A,title:S===null?`Create an API key`:`Key created`,description:S===null?`Clients send this key as a bearer token or as x-api-key on every /v1 request.`:void 0,footer:S===null?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(e,{type:`button`,onClick:()=>A(!1),children:`Cancel`}),(0,F.jsx)(e,{type:`button`,$variant:`primary`,disabled:o.isPending,onClick:()=>{let e=v.trim(),t=e.length===0?null:Number(e);if(t!==null&&(!Number.isInteger(t)||t<1)){O(`The rate limit must be a whole number of requests per minute, or blank for none.`);return}O(null),o.mutate({label:c.trim().length===0?`api key`:c.trim(),modelAllowlist:u?null:h,rateLimitPerMin:t},{onSuccess:e=>T(e),onError:e=>O(E(e))})},children:o.isPending?`Creating…`:`Create key`})]}):(0,F.jsx)(e,{type:`button`,$variant:`primary`,onClick:()=>A(!1),children:`I have copied the key`}),children:S===null?(0,F.jsxs)(r,{$gap:3,children:[(0,F.jsx)(w,{label:`Label`,hint:`Names the client this key belongs to, e.g. laptop or CI.`,children:e=>(0,F.jsx)(C,{...e,value:c,placeholder:`api key`,onChange:e=>l(e.target.value)})}),(0,F.jsxs)(r,{$gap:2,children:[(0,F.jsxs)(s,{$gap:2,children:[(0,F.jsx)(b,{checked:u,label:`Allow every model`,onCheckedChange:d}),(0,F.jsx)(f,{as:`span`,children:`Allow every model`})]}),u?null:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(I,{children:(a.data??[]).map(e=>(0,F.jsxs)(L,{children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:h.includes(e.id),onChange:t=>g(n=>t.target.checked?[...n,e.id]:n.filter(t=>t!==e.id))}),e.id]},e.id))}),h.length===0?(0,F.jsx)(R,{children:`With no model selected this key is allowed nothing and every request it makes will be refused.`}):null]})]}),(0,F.jsx)(w,{label:`Rate limit`,hint:`Requests per minute for this key. Leave blank for no limit. Counted per process, and reset when the gateway restarts.`,children:e=>(0,F.jsx)(C,{...e,type:`number`,min:1,step:1,value:v,placeholder:`no limit`,onChange:e=>y(e.target.value)})}),D===null?null:(0,F.jsx)(z,{role:`alert`,children:D})]}):(0,F.jsxs)(r,{$gap:3,children:[(0,F.jsx)(B,{children:`This is the only time the key is shown. The gateway keeps a hash, so a lost key has to be replaced rather than recovered.`}),(0,F.jsx)(_,{value:S.key,label:`Copy API key`}),(0,F.jsxs)(s,{$gap:2,children:[(0,F.jsx)(f,{children:`Label`}),(0,F.jsx)(i,{children:S.label}),(0,F.jsx)(f,{children:`Prefix`}),(0,F.jsx)(i,{children:S.prefix})]})]})})}var H=n(s)`
34
+ gap: 4px;
35
+ flex-wrap: wrap;
36
+ max-width: 34ch;
37
+ `,U=n.span`
38
+ color: ${({theme:e})=>e.color.inkFaint};
39
+ `;function W(){let n=d(),r=u(),[i,a]=(0,P.useState)(!1),[o,s]=(0,P.useState)(null),l=n.data??[],p=l.filter(e=>e.revokedAt===null),m=n.isLoading?`Reading issued keys…`:l.length===0?`No keys exist, so nothing can call this gateway yet.`:`${p.length} active key${p.length===1?``:`s`} of ${l.length} ever issued.`;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(g,{legend:`Keys`,title:`Gateway API keys`,summary:m,actions:(0,F.jsxs)(e,{type:`button`,$variant:`primary`,onClick:()=>a(!0),children:[(0,F.jsx)(y,{}),`Create a key`]})}),(0,F.jsx)(T,{legend:`Issued keys`,meta:`${l.length}`,flush:!0,children:n.isError?(0,F.jsx)(D,{error:n.error,onRetry:()=>void n.refetch()}):n.isLoading?(0,F.jsx)(`div`,{style:{padding:12},children:(0,F.jsx)(O,{rows:4})}):l.length===0?(0,F.jsx)(k,{legend:`No keys`,message:`Create a key and give it to a client. The key is shown once, at creation.`,action:(0,F.jsx)(e,{type:`button`,$variant:`primary`,$size:`sm`,onClick:()=>a(!0),children:`Create a key`})}):(0,F.jsx)(t,{children:(0,F.jsxs)(N,{children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(M,{children:`Label`}),(0,F.jsx)(M,{children:`Prefix`}),(0,F.jsx)(M,{children:`Allowed models`}),(0,F.jsx)(M,{$align:`right`,children:`Rate limit`}),(0,F.jsx)(M,{$align:`right`,children:`Created`}),(0,F.jsx)(M,{children:`Status`}),(0,F.jsx)(M,{})]})}),(0,F.jsx)(`tbody`,{children:l.map(t=>(0,F.jsxs)(A,{children:[(0,F.jsx)(j,{children:(0,F.jsx)(c,{style:{maxWidth:`24ch`,display:`block`},children:t.label})}),(0,F.jsxs)(j,{$mono:!0,children:[t.prefix,`…`]}),(0,F.jsx)(j,{children:t.modelAllowlist===null?(0,F.jsx)(f,{children:`every model`}):t.modelAllowlist.length===0?(0,F.jsx)(S,{$tone:`down`,children:`no models`}):(0,F.jsx)(H,{children:t.modelAllowlist.map(e=>(0,F.jsx)(S,{children:e},e))})}),(0,F.jsx)(j,{$align:`right`,$mono:!0,children:t.rateLimitPerMin===null?`—`:`${t.rateLimitPerMin}/min`}),(0,F.jsx)(j,{$align:`right`,$mono:!0,children:h(t.createdAt)}),(0,F.jsx)(j,{children:t.revokedAt===null?(0,F.jsx)(S,{$tone:`ok`,children:`active`}):(0,F.jsx)(U,{title:h(t.revokedAt),children:(0,F.jsx)(S,{children:`revoked`})})}),(0,F.jsx)(j,{$align:`right`,children:t.revokedAt===null?(0,F.jsx)(e,{type:`button`,$variant:`danger`,$size:`sm`,onClick:()=>s(t),children:`Revoke`}):null})]},t.id))})]})})}),(0,F.jsx)(V,{open:i,onOpenChange:a}),(0,F.jsx)(v,{open:o!==null,onOpenChange:e=>{e||s(null)},title:`Revoke key`,body:o===null?``:`Revoking "${o.label}" refuses its next request. The key stays listed so past usage keeps its attribution, and it cannot be un-revoked.`,confirmLabel:`Revoke key`,busy:r.isPending,onConfirm:()=>{o!==null&&r.mutate(o.id,{onSettled:()=>s(null)})}})]})}var G=W;export{G as component};
@@ -0,0 +1,33 @@
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};