omnigateway 0.4.9 → 0.4.11

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 (30) hide show
  1. package/bin/omni.js +163 -25
  2. package/gateway.js +190 -29
  3. package/package.json +1 -1
  4. package/public/assets/{CopyValue-CHZz2PLE.js → CopyValue-By5BAgv7.js} +1 -1
  5. package/public/assets/{Rack-ziQuyb2l.js → Rack-fDZClWZL.js} +2 -2
  6. package/public/assets/States-DtkkMzEu.js +54 -0
  7. package/public/assets/{Toggle-CNnMgEU1.js → Toggle-ClEeOh0F.js} +1 -1
  8. package/public/assets/{TokenBreakdown-hkwYCWT3.js → TokenBreakdown-D70VeZ2N.js} +1 -1
  9. package/public/assets/{_app-BD1K3SGD.js → _app-CDPKnQ72.js} +1 -1
  10. package/public/assets/_app.accounts-Dz0ox4Br.js +64 -0
  11. package/public/assets/{_app.console-BtLYkvSQ.js → _app.console-hPUmmYjp.js} +1 -1
  12. package/public/assets/{_app.database-ByLAAKXX.js → _app.database-DGtP4NdG.js} +2 -2
  13. package/public/assets/_app.index-COcCAmbH.js +62 -0
  14. package/public/assets/{_app.keys-Ce6Xd1RK.js → _app.keys-yTXTbKTA.js} +1 -1
  15. package/public/assets/{_app.logs-CmDNhsU4.js → _app.logs-BhMvO_Fx.js} +4 -4
  16. package/public/assets/{_app.models-mqdU56d8.js → _app.models-0S3rurIl.js} +1 -1
  17. package/public/assets/{_app.plugins._pluginId-C0VWWCD2.js → _app.plugins._pluginId-B-ZDQNPU.js} +1 -1
  18. package/public/assets/_app.settings-DTnFwTeA.js +46 -0
  19. package/public/assets/{_app.usage-BaB40kku.js → _app.usage-C2-VLiq9.js} +4 -4
  20. package/public/assets/{index-C3Fp8XmZ.js → index-COwhxKU7.js} +2 -2
  21. package/public/assets/{login-Bn1s6JI_.js → login-DjfMomJJ.js} +1 -1
  22. package/public/assets/plus-UDQ_BTEr.js +1 -0
  23. package/public/assets/{shared-DtfLcn24.js → shared-Cct_4xwp.js} +1 -1
  24. package/public/assets/{trash-2-B5fBDSkh.js → trash-2-U2ViYZum.js} +1 -1
  25. package/public/index.html +1 -1
  26. package/public/assets/States-Shs8nZi1.js +0 -54
  27. package/public/assets/_app.accounts-BDBEn5vF.js +0 -64
  28. package/public/assets/_app.index-3mAmJsCn.js +0 -62
  29. package/public/assets/_app.settings-BLJ-25xq.js +0 -46
  30. package/public/assets/plus-Cdyfj4uP.js +0 -1
@@ -1,46 +0,0 @@
1
- import{$ as e,L as t,O as n,at as r,c as i,et as a,it as o,lt as s,nt as c,o as l,z as u}from"./queries-CX9mStps.js";import{t as d}from"./Rack-ziQuyb2l.js";import{t as f}from"./Toggle-CNnMgEU1.js";import{i as p,n as m,r as h}from"./States-Shs8nZi1.js";import{i as g,n as _,t as v}from"./Field-B79Yxdit.js";import{t as y}from"./Meter-stpt3vQu.js";import{t as b}from"./Panel-CoulMx6R.js";import{useEffect as x,useState as S}from"react";import{Fragment as C,jsx as w,jsxs as T}from"react/jsx-runtime";import E from"styled-components";var D=[{id:`claude`,label:`Claude Code`,where:`settings.json under ~/.claude`},{id:`opencode`,label:`opencode`,where:`opencode.json in your project`}],O=E(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
- `,k=E.div`
12
- color: ${({theme:e})=>e.color.inkDim};
13
- font-size: 0.8125rem;
14
- margin-bottom: 0.25rem;
15
- `,A=E.p`
16
- color: ${({theme:e})=>e.color.inkDim};
17
- font-size: 0.8125rem;
18
- margin: 0;
19
- `,j=E.div`
20
- display: grid;
21
- grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
22
- gap: ${({theme:e})=>e.space(2)};
23
- `,M=[{key:`defaultModel`,label:`Default model`,required:!0},{key:`fableModel`,label:`Fable model`,required:!1},{key:`opusModel`,label:`Opus model`,required:!1},{key:`sonnetModel`,label:`Sonnet model`,required:!1},{key:`haikuModel`,label:`Haiku model`,required:!1}];function N(){let[e,t]=S(`claude`),[i,o]=S(()=>({claude:{},opencode:{}})),u=n(),d=i[e],f=typeof d.defaultModel==`string`&&d.defaultModel!==``?d:void 0,_=l(e,f),y=D.find(t=>t.id===e);return w(b,{legend:`Agent setup`,children:T(r,{children:[w(c,{children:D.map(n=>w(s,{type:`button`,$variant:n.id===e?`primary`:`ghost`,onClick:()=>t(n.id),children:n.label},n.id))}),T(A,{children:[y?.where,`. The key is a placeholder — paste your own over it. Or run`,` `,T(a,{children:[`omni setup `,e]}),` to write these files directly.`]}),(u.data?.length??0)>0?w(j,{children:M.map(t=>w(v,{label:t.label,children:n=>T(g,{...n,value:d[t.key]??``,onChange:n=>o(r=>({...r,[e]:{...r[e],[t.key]:n.target.value||void 0}})),children:[w(`option`,{value:``,children:t.required?`Choose a pool`:`Not mapped`}),u.data?.map(e=>w(`option`,{value:e.id,children:e.id},e.id))]})},t.key))}):null,u.isLoading?w(h,{rows:2}):_.isError?w(m,{error:_.error,onRetry:()=>void _.refetch()}):_.isLoading?w(h,{rows:4}):(u.data?.length??0)===0?w(A,{children:`No virtual models configured yet, so there is nothing to point a client at.`}):f===void 0?T(A,{children:[`Choose a default model to generate `,y?.label,` settings.`]}):_.data===void 0||_.data.length===0?w(A,{children:`No virtual models configured yet, so there is nothing to point a client at.`}):_.data.map(e=>T(`div`,{children:[w(k,{children:e.path}),w(O,{as:`pre`,children:e.contents.trimEnd()})]},e.path)),_.isError?w(A,{children:p(_.error)}):null]})})}var P=[{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:`load`,label:`Load`,blurb:`Preference for accounts with fewer requests in flight right now.`}],F=[{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 request may take across all attempts. 0 disables only OmniGateway's deadline.`,unit:`ms`,step:1e3,min:0},{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}],I=E.div`
24
- display: grid;
25
- grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
26
- gap: ${({theme:e})=>e.space(3)};
27
- `,L=E(r)`
28
- gap: 6px;
29
- `,R=E.p`
30
- font-size: 11px;
31
- color: ${({theme:e})=>e.color.inkDim};
32
- `,z=E.p`
33
- font-size: 12px;
34
- color: ${({theme:e})=>e.color.down};
35
- `,B=E.p`
36
- font-size: 12px;
37
- color: ${({theme:e})=>e.color.ok};
38
- `,V=E.p`
39
- font-size: 12px;
40
- color: ${({theme:e})=>e.color.warn};
41
- max-width: 72ch;
42
-
43
- code {
44
- font-family: ${({theme:e})=>e.font.mono};
45
- }
46
- `;function H(e){let t={};for(let n of P)t[`w.${n.id}`]=String(e.weights[n.id]);for(let n of F)t[n.id]=String(e[n.id]);return t.rtkEnabled=String(e.rtkEnabled),t.bodyLoggingEnabled=String(e.bodyLoggingEnabled),t.bodyLoggingCaptureStreamChunks=String(e.bodyLoggingCaptureStreamChunks),t}function U(e){let t={};for(let n of P){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 F){let r=(e[t.id]??``).trim(),i=Number(r);if(r.length===0||!Number.isInteger(i)||i<t.min)return{ok:!1,problem:`${t.label} must be a whole number of ${t.min} or more.`};n[t.id]=i}return n.maxAttempts>10?{ok:!1,problem:`Attempts per request cannot exceed 10.`}:{ok:!0,settings:{weights:t,...n,rtkEnabled:e.rtkEnabled===`true`,bodyLoggingEnabled:e.bodyLoggingEnabled===`true`,bodyLoggingCaptureStreamChunks:e.bodyLoggingCaptureStreamChunks===`true`}}}function W(){let n=u(),l=i(),g=t(),[E,D]=S({}),[O,k]=S(null),[A,j]=S(!1);x(()=>{n.data!==void 0&&D(H(n.data))},[n.data]);let M=Math.max(1e-4,...P.map(e=>Math.abs(Number(E[`w.${e.id}`])||0)));return T(C,{children:[w(d,{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:w(s,{type:`button`,$variant:`primary`,disabled:g.isPending||n.isLoading,onClick:()=>{j(!1);let e=U(E);if(!e.ok){k(e.problem);return}k(null),g.mutate(e.settings,{onSuccess:()=>j(!0),onError:e=>k(p(e))})},children:g.isPending?`Saving…`:`Save changes`})}),n.isError?w(b,{legend:`Settings`,children:w(m,{error:n.error,onRetry:()=>void n.refetch()})}):n.isLoading?w(b,{legend:`Settings`,children:w(h,{rows:6})}):T(r,{$gap:4,children:[w(b,{legend:`Scoring weights`,meta:`relative to each other`,footer:T(c,{children:[w(e,{children:`A candidate's score is the sum of each term times its weight, then multiplied by the account and target weights.`}),w(o,{})]}),children:w(I,{children:P.map(e=>{let t=Number(E[`w.${e.id}`])||0;return T(L,{children:[w(v,{label:e.label,children:t=>w(_,{...t,type:`number`,step:.5,value:E[`w.${e.id}`]??``,onChange:t=>D({...E,[`w.${e.id}`]:t.target.value})})}),w(y,{fraction:Math.abs(t)/M,height:4,tone:`var(--accent)`,label:`${e.label} weight ${t}`}),w(R,{children:e.blurb})]},e.id)})})}),w(b,{legend:`Limits`,children:w(I,{children:F.map(t=>w(L,{children:w(v,{label:t.label,hint:t.hint,children:n=>T(c,{$gap:2,children:[w(_,{...n,type:`number`,min:t.min,step:t.step,value:E[t.id]??``,onChange:e=>D({...E,[t.id]:e.target.value})}),w(e,{children:t.unit})]})})},t.id))})}),w(b,{legend:`Historical tool results`,children:T(c,{$gap:3,$align:`start`,children:[w(f,{checked:E.rtkEnabled===`true`,onCheckedChange:e=>D({...E,rtkEnabled:String(e)}),label:`Enable RTK compression`}),w(R,{children:`Compress recognized historical non-error tool results before provider dispatch. Confirmed non-shell tools are excluded; unknown-origin results may be compressed only when a built-in detector recognizes a high-confidence shell-output format. Compression is deterministic and lossy. Disabled by default.`})]})}),w(b,{legend:`Request and response bodies`,meta:l.data===!0?`permitted by the environment`:`not permitted`,children:T(r,{$gap:3,children:[l.data===!0?null:T(V,{children:[`This gateway was started without `,w(`code`,{children:`OMNI_BODY_LOGGING_ALLOWED`}),`, so nothing below can record anything. Set it in the installation's `,w(`code`,{children:`.env`}),` `,`and restart before turning capture on. Two keys mean an admin session on its own cannot start recording prompts.`]}),T(c,{$gap:3,$align:`start`,children:[w(f,{checked:E.bodyLoggingEnabled===`true`,disabled:l.data!==!0,onCheckedChange:e=>D({...E,bodyLoggingEnabled:String(e)}),label:`Capture request and response bodies`}),w(R,{children:`Stores what each client sent and what each provider returned, encrypted under OMNI_ENCRYPTION_KEY beside the database. Bearer tokens and API keys are masked first and headers are never captured. Bodies expire on the log retention window above, and the newest 100,000 requests are kept whatever that window says. Off by default.`})]}),T(c,{$gap:3,$align:`start`,children:[w(f,{checked:E.bodyLoggingCaptureStreamChunks===`true`,disabled:l.data!==!0||E.bodyLoggingEnabled!==`true`,onCheckedChange:e=>D({...E,bodyLoggingCaptureStreamChunks:String(e)}),label:`Also keep raw stream frames`}),w(R,{children:`Retains the raw SSE frames of each attempt as well as the reassembled response. The only way to debug stream framing itself, and by far the most expensive thing capture can store, so it is gated separately rather than implied.`})]})]})}),O===null?null:w(z,{role:`alert`,children:O}),A&&O===null?w(B,{role:`status`,children:`Settings saved.`}):null,w(N,{}),w(b,{legend:`Known limits`,children:T(r,{$gap:2,children:[T(c,{$gap:2,children:[w(a,{$dim:!0,children:`rate limits`}),w(R,{children:`Per-key rate limits are counted inside one gateway process and reset when it restarts. They are not shared across instances.`})]}),T(c,{$gap:2,children:[w(a,{$dim:!0,children:`logs`}),w(R,{children:`Request rows record routing and token counts only. Prompts and responses are written only when body capture above is on, and to a separate encrypted store; credentials are never written to either.`})]})]})})]})]})}var G=W;export{G as component};
@@ -1 +0,0 @@
1
- import{g as e}from"./Rack-ziQuyb2l.js";var t=e(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]);export{t};