@aidotnet/server-win32-arm64 0.14.3115 → 0.14.3116
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/astra-server.exe +2 -2
- package/bin/wwwroot/assets/{ClientsPage-BhnTX0ew.js → ClientsPage--PWh6ozr.js} +2 -2
- package/bin/wwwroot/assets/{KeyPage-D8xcW85A.js → KeyPage-Ba3ujEEH.js} +1 -1
- package/bin/wwwroot/assets/{LibraryPage-BO51S5vR.js → LibraryPage-C6UNNxnM.js} +1 -1
- package/bin/wwwroot/assets/{McpPage-BFav-GE-.js → McpPage-ZqGX2X-C.js} +1 -1
- package/bin/wwwroot/assets/{ModelDetailPage-CRE3OFy5.js → ModelDetailPage-BXxaDBuf.js} +1 -1
- package/bin/wwwroot/assets/{ModelsPage-BsRk0_yk.js → ModelsPage-RS-BTSFJ.js} +1 -1
- package/bin/wwwroot/assets/{PluginsPage-blIrwXbf.js → PluginsPage-Cz_JmDlj.js} +1 -1
- package/bin/wwwroot/assets/{PrivacyPage-bKxw2Y54.js → PrivacyPage-DSVNG7Et.js} +1 -1
- package/bin/wwwroot/assets/{ProviderDetailPage-3YGtfo9v.js → ProviderDetailPage-CGiaHQQW.js} +1 -1
- package/bin/wwwroot/assets/{ProvidersPage-B0XULeAs.js → ProvidersPage-CSNuqB_1.js} +1 -1
- package/bin/wwwroot/assets/{RoutingGroupsPage-Dz-TTq1a.js → RoutingGroupsPage-DKSTVbGU.js} +1 -1
- package/bin/wwwroot/assets/{SettingsPage-CFVirZNv.js → SettingsPage-DAPUfR-h.js} +1 -1
- package/bin/wwwroot/assets/{SkillsPage-DI61DG2m.js → SkillsPage-DRtTyTNp.js} +1 -1
- package/bin/wwwroot/assets/{SmartRoutingPage-CpchDlXC.js → SmartRoutingPage-CY-7vgHw.js} +1 -1
- package/bin/wwwroot/assets/{TokenDetailPage-PqVFcudk.js → TokenDetailPage-Dsic3ZDE.js} +1 -1
- package/bin/wwwroot/assets/{TokenPoolEditor-IS5Zwuqf.js → TokenPoolEditor-B0smjOAZ.js} +1 -1
- package/bin/wwwroot/assets/{TokensPage-CXK5_J6v.js → TokensPage-Zd92s99T.js} +1 -1
- package/bin/wwwroot/assets/{ToolsPage-B_JZpB1h.js → ToolsPage-DkIZ14z2.js} +1 -1
- package/bin/wwwroot/assets/{TracesPage-CgbFQFzA.js → TracesPage-B5lkV7Kg.js} +1 -1
- package/bin/wwwroot/assets/{TrayPanelPage-Z4vWiyK-.js → TrayPanelPage-DDo9i5gp.js} +1 -1
- package/bin/wwwroot/assets/{TrayPanelView-Cauh6r_o.js → TrayPanelView-CGEASzOn.js} +1 -1
- package/bin/wwwroot/assets/{index-D2siu6xk.js → index-Chd2TNCi.js} +2 -2
- package/bin/wwwroot/index.html +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{$s as n,M as r,U as i,c as a,d as o,dt as s,w as c}from"./format-CskGUFYy.js";import{_ as l,b as u,d,f,g as p,h as m,j as h,l as g,m as _,p as v,u as y,v as b,y as x}from"./TrayTitleSource-B98nYas3.js";import{t as S}from"./arrow-down-right-D3a5SpdK.js";import{t as C}from"./arrow-up-right-LPOoQDJW.js";import{t as w}from"./ban-D3eujcIJ.js";import{t as T}from"./chevron-right-Bgtn3ze-.js";import{t as E}from"./chevrons-up-down-CyYxDvJJ.js";import{t as D}from"./copy-48gwhhDO.js";import{t as O}from"./ellipsis-CidyZaW2.js";import{t as k}from"./play-DqueJ6Li.js";import{t as A}from"./refresh-cw-CoLAai2c.js";import{t as j}from"./rotate-ccw-fsXoCwyv.js";import{t as M}from"./settings-BM4QjTnn.js";import{t as N}from"./triangle-alert-DMn3ceGk.js";import{t as P}from"./x-AFrW8zH7.js";import{S as F,_ as I,b as L,w as R}from"./index-D2siu6xk.js";var z=e(t(),1),B=n(),ee={green:`var(--success)`,orange:`var(--warning)`,red:`var(--danger)`},te=(0,z.forwardRef)(function({prefs:e,state:t,data:n,onCommand:i,onRefresh:a,onCopyAddress:o,onSwitchClient:l,preview:u,tab:d,onTabChange:f,className:p},m){let{t:h}=c(),[g,_]=(0,z.useState)(`overview`),v=t.activity!==null,y=t.running&&!v,b=e=>i?.(e),x=[`overview`];e.sections.quota&&(n.plans.length>0||n.hasSubscriptions)&&x.push(`quota`),e.sections.clients&&n.clients.some(e=>e.enabled)&&x.push(`clients`);let S=d??g,T=x.includes(S)?S:`overview`,E=e=>{_(e),f?.(e)},A=(t.running||v)&&x.length>1,F=n.settings?.gatewayBaseUrl.replace(/^https?:\/\//,``)??(t.port?`127.0.0.1:${t.port}`:``),I=t.activity?h(`tray.status.${t.activity}`):t.running?h(`tray.status.running`):h(`tray.status.stopped`);return(0,B.jsxs)(`div`,{ref:m,className:s(`chrome flex max-h-full flex-col overflow-hidden rounded-[14px] border border-[var(--border-strong)] bg-[var(--surface-raised)] text-[13px] text-[var(--foreground)]`,p),children:[(0,B.jsxs)(`header`,{"data-tray-part":`header`,className:`shrink-0 border-b border-[var(--border)] px-4 pt-3.5 pb-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(r,{tone:v?`orange`:t.running?`green`:`red`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[14px] font-semibold`,children:I}),(0,B.jsx)(V,{label:h(`tray.copyAddress`),onClick:o,disabled:!F,children:(0,B.jsx)(D,{className:`size-4`})}),(0,B.jsx)(V,{label:h(`tray.settings`),onClick:()=>b(`open-settings`),children:(0,B.jsx)(M,{className:`size-4`})}),(0,B.jsx)(V,{label:h(`tray.more`),onClick:()=>b(`menu`),children:(0,B.jsx)(O,{className:`size-4`})}),!u&&(0,B.jsx)(V,{label:h(`common.close`),onClick:()=>b(`hide`),children:(0,B.jsx)(P,{className:`size-4`})})]}),F&&(0,B.jsx)(`div`,{className:`selectable mt-0.5 truncate pl-4 font-mono text-[12px] text-[var(--text-secondary)]`,children:F}),(t.apiVersionMismatch||t.updateAvailable)&&(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 pl-4`,children:[t.apiVersionMismatch&&(0,B.jsxs)(H,{tone:`orange`,children:[(0,B.jsx)(N,{className:`size-3`}),h(`tray.mismatch`)]}),t.updateAvailable&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>b(`check-updates`),className:`cursor-default`,children:(0,B.jsx)(H,{tone:`accent`,children:h(`tray.update`)})})]})]}),(0,B.jsx)(`div`,{"data-tray-part":`tabs`,className:`shrink-0`,children:A&&(0,B.jsx)(U,{tabs:x,active:T,onChange:E})}),(0,B.jsx)(`div`,{className:`scroll min-h-0 flex-1 overflow-y-auto`,children:(0,B.jsx)(`div`,{"data-tray-part":`body`,className:`flex flex-col gap-3 px-4 py-3.5`,children:!t.running&&!v?(0,B.jsx)(K,{onStart:()=>b(`start`)}):(0,B.jsxs)(B.Fragment,{children:[T===`overview`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(G,{prefs:e,data:n,onViewQuota:()=>E(`quota`)}),(0,B.jsx)(J,{prefs:e,data:n,onRefresh:a}),e.sections.quota&&(0,B.jsx)(ne,{data:n,onViewAll:()=>E(`quota`)})]}),T===`quota`&&(0,B.jsx)(re,{data:n,plain:!0}),T===`clients`&&(0,B.jsx)(ae,{data:n,disabled:!y,onSwitch:l,plain:!0})]})})}),(0,B.jsxs)(`footer`,{"data-tray-part":`footer`,className:`flex shrink-0 items-center gap-1 border-t border-[var(--border)] px-3 py-2.5`,children:[t.running?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(V,{label:h(`tray.restart`),onClick:()=>b(`restart`),disabled:v,children:(0,B.jsx)(j,{className:`size-4`})}),(0,B.jsx)(V,{label:h(`tray.stop`),onClick:()=>b(`stop`),disabled:v,children:(0,B.jsx)(w,{className:`size-4`})})]}):(0,B.jsx)(V,{label:h(`shell.startService`),onClick:()=>b(`start`),disabled:v,children:(0,B.jsx)(k,{className:`size-4`})}),(0,B.jsx)(`div`,{className:`flex-1`}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>b(`quit`),className:`h-8 cursor-default rounded-[8px] px-2.5 text-[13px] text-[var(--text-secondary)] transition-colors hover:bg-[var(--surface-muted)] hover:text-[var(--foreground)]`,children:h(`tray.quit`)}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>b(`open`),className:`inline-flex h-8 cursor-default items-center gap-1.5 rounded-[8px] border border-[var(--border-strong)] px-3 text-[13px] font-medium transition-colors hover:bg-[var(--surface-muted)]`,children:[h(`tray.open`),(0,B.jsx)(C,{className:`size-3.5`})]})]})]})});function V({label:e,onClick:t,disabled:n,children:r}){return(0,B.jsx)(`button`,{type:`button`,title:e,"aria-label":e,disabled:n,onClick:t,className:`inline-flex size-8 shrink-0 cursor-default items-center justify-center rounded-[8px] text-[var(--text-secondary)] transition-colors hover:bg-[var(--surface-muted)] hover:text-[var(--foreground)] disabled:opacity-40 disabled:hover:bg-transparent`,children:r})}function H({tone:e,children:t,title:n}){let r={red:`var(--danger)`,orange:`var(--warning)`,accent:`var(--accent)`,neutral:`var(--text-secondary)`}[e];return(0,B.jsx)(`span`,{title:n,className:`inline-flex max-w-full items-center gap-1 rounded-[6px] border px-1.5 py-px text-[11.5px] leading-[18px] whitespace-nowrap`,style:{color:r,borderColor:`color-mix(in oklab, ${r} 45%, transparent)`,background:`color-mix(in oklab, ${r} 10%, transparent)`},children:t})}function U({tabs:e,active:t,onChange:n}){let{t:r}=c(),i={overview:r(`tray.tab.overview`),quota:r(`tray.tab.quota`),clients:r(`tray.clients`)};return(0,B.jsx)(`div`,{role:`tablist`,className:`flex gap-1 px-3 pt-2.5`,children:e.map(e=>(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e===t,onClick:()=>n(e),className:s(`h-7 cursor-default rounded-[7px] px-2.5 text-[12.5px] transition-colors`,e===t?`bg-[var(--surface-muted)] font-medium text-[var(--foreground)]`:`text-[var(--text-secondary)] hover:text-[var(--foreground)]`),children:i[e]},e))})}function W({tone:e,onClick:t,children:n}){let r=e===`red`?`var(--danger)`:`var(--warning)`,i={color:r,borderColor:`color-mix(in oklab, ${r} 45%, transparent)`,background:`color-mix(in oklab, ${r} 10%, transparent)`},a=`flex w-full items-center gap-1.5 rounded-[8px] border px-2.5 py-1.5 text-left text-[12.5px]`,o=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(N,{className:`size-3.5 shrink-0`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n})]});return t?(0,B.jsxs)(`button`,{type:`button`,onClick:t,className:s(a,`cursor-default`),style:i,children:[o,(0,B.jsx)(T,{className:`size-3.5 shrink-0`})]}):(0,B.jsx)(`div`,{className:a,style:i,children:o})}function G({prefs:e,data:t,onViewQuota:n}){let{t:r,locale:i}=c(),o=t.summary,s=e.sections.overview&&o?y(o):0,l=e.sections.quota?m(t.plans):null,u=l&&l.row.remaining<30?l:null;return!o||s===0&&!u?null:(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s>0&&(0,B.jsx)(W,{tone:`red`,children:r(`tray.alert.failures`,{count:s,share:a(s/o.requests)})}),u&&(0,B.jsx)(W,{tone:u.row.remaining<10?`red`:`orange`,onClick:n,children:r(`tray.alert.quota`,{plan:u.plan.providerName,window:Q(u.row,r,i),remaining:`${Math.round(u.row.remaining)}%`})})]})}function K({onStart:e}){let{t}=c();return(0,B.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-6 text-center`,children:[(0,B.jsx)(`div`,{className:`text-[13px] font-medium`,children:t(`tray.status.stopped`)}),(0,B.jsx)(`div`,{className:`max-w-[260px] text-[12px] text-[var(--text-secondary)]`,children:t(`tray.stoppedHint`)}),(0,B.jsxs)(`button`,{type:`button`,onClick:e,className:`mt-1 inline-flex h-8 cursor-default items-center gap-1.5 rounded-[8px] bg-[var(--accent)] px-3 text-[13px] font-medium text-[var(--on-accent)]`,children:[(0,B.jsx)(k,{className:`size-3.5`}),t(`shell.startService`)]})]})}function q(e=3e4){let[t,n]=(0,z.useState)(()=>Date.now());return(0,z.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function J({prefs:e,data:t,onRefresh:n}){let{t:r,locale:s}=c(),f=q(),p=t.summary,m=e.sections,h=m.overview||m.cost,_=p?p.inputTokens+p.outputTokens:0,v=b(t.updatedAt,s,r(`tray.justNow`),f),y=m.topModel?l(t.top,_):null,x=m.cacheHitRate&&p?I(p.cacheReadTokens,p.inputTokens):null,w=m.compareYesterday&&p?g(_,u(t.daily,new Date(f))):null,T=m.topModel||m.cacheHitRate||m.compareYesterday;return!h&&!m.chart&&!T?null:(0,B.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-[13px] text-[var(--text-secondary)]`,children:r(`tray.today`)}),(0,B.jsx)(`div`,{className:`flex-1`}),v&&(0,B.jsx)(`span`,{className:`text-[12px] text-[var(--text-muted)]`,children:r(`tray.updated`,{time:v})}),(0,B.jsx)(V,{label:r(`common.refresh`),onClick:n,children:(0,B.jsx)(A,{className:`size-3.5`})})]}),p?(0,B.jsxs)(B.Fragment,{children:[h&&(0,B.jsxs)(`div`,{className:`grid auto-cols-fr grid-flow-col gap-px overflow-hidden rounded-[10px] bg-[var(--border)]`,children:[m.overview&&(0,B.jsx)(Y,{label:r(`tray.requests`),value:o(p.requests,!0)}),m.overview&&(0,B.jsx)(Y,{label:r(`tray.tokens`),value:o(_,!0)}),m.cost&&(0,B.jsx)(Y,{label:r(`tray.cost`),value:d(p.costUsd)})]}),m.chart&&(0,B.jsx)(Z,{data:t,now:f}),T&&(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[y&&(0,B.jsxs)(X,{label:r(`tray.topModel`),title:y.model,children:[(0,B.jsx)(`span`,{className:`truncate`,children:y.model}),(0,B.jsxs)(`span`,{className:`shrink-0`,children:[`· `,a(y.share)]})]}),m.cacheHitRate&&(0,B.jsx)(X,{label:r(`tray.cacheHit`),children:(0,B.jsx)(`span`,{children:x==null?`—`:a(x)})}),m.compareYesterday&&(0,B.jsx)(X,{label:r(`tray.vsYesterday`),children:w==null?(0,B.jsx)(`span`,{children:`—`}):(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[w>=0?(0,B.jsx)(C,{className:`size-3`}):(0,B.jsx)(S,{className:`size-3`}),a(Math.abs(w))]})})]})]}):t.error?(0,B.jsx)(`div`,{className:`text-[12px] text-[var(--danger)]`,children:r(`tray.loadFailed`)}):(0,B.jsx)(i,{lines:2})]})}function Y({label:e,value:t}){return(0,B.jsxs)(`div`,{className:`min-w-0 bg-[var(--surface-muted)] px-3 py-2.5`,children:[(0,B.jsx)(`div`,{className:`truncate text-[12px] text-[var(--text-secondary)]`,children:e}),(0,B.jsx)(`div`,{className:`num mt-0.5 truncate text-[20px] leading-tight font-semibold`,title:t,children:t})]})}function X({label:e,title:t,children:n}){return(0,B.jsxs)(`span`,{title:t,className:`inline-flex max-w-full min-w-0 items-center gap-1.5 rounded-[7px] border border-[var(--border)] px-2 py-0.5 text-[12px]`,children:[(0,B.jsx)(`span`,{className:`shrink-0 text-[var(--text-secondary)]`,children:e}),(0,B.jsx)(`span`,{className:`flex min-w-0 items-center gap-1 font-medium`,children:n})]})}function Z({data:e,now:t}){let{t:n}=c(),r=f(e.hourly,new Date(t)),i=Math.max(1,...r.map(e=>e.value)),a=new Date(t).getHours();return(0,B.jsx)(`div`,{role:`img`,"aria-label":n(`tray.chartLabel`),className:`flex h-16 items-end gap-[3px]`,children:r.map((e,t)=>{let r=e.value>0?Math.max(4,Math.round(e.value/i*64)):2;return(0,B.jsx)(`span`,{title:n(`tray.hourBar`,{hour:`${String(t).padStart(2,`0`)}:00`,count:e.value}),className:`flex-1 rounded-[2px]`,style:{height:r,background:t===a?`var(--accent)`:e.value>0?`color-mix(in oklab, var(--foreground) 32%, transparent)`:`var(--border)`,opacity:t>a?.5:1}},e.bucket)})})}function ne({data:e,onViewAll:t}){let{t:n,locale:r}=c();if(e.plans.length===0)return e.hasSubscriptions?(0,B.jsx)(`div`,{className:`border-t border-[var(--border)] pt-3 text-[12px] text-[var(--text-muted)]`,children:n(`tray.quotaPending`)}):null;let i=p(e.plans,3),a=e.plans.reduce((e,t)=>e+t.rows.length,0);return(0,B.jsxs)(`section`,{className:`flex flex-col gap-2 border-t border-[var(--border)] pt-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center text-[12px] text-[var(--text-secondary)]`,children:[(0,B.jsx)(`span`,{className:`flex-1`,children:n(`tray.quotaTightest`)}),a>i.length&&(0,B.jsxs)(`button`,{type:`button`,onClick:t,className:`inline-flex cursor-default items-center gap-0.5 hover:text-[var(--foreground)]`,children:[n(`tray.viewAll`),(0,B.jsx)(T,{className:`size-3`})]})]}),i.map(({plan:e,row:t},i)=>(0,B.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_64px_40px_60px] items-center gap-2 text-[12.5px]`,children:[(0,B.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,B.jsx)(R,{name:e.providerName,icon:e.providerIcon,size:14}),(0,B.jsx)(`span`,{className:`truncate font-medium`,children:e.providerName}),(0,B.jsx)(`span`,{className:`shrink-0 text-[var(--text-secondary)]`,children:Q(t,n,r)})]}),(0,B.jsx)($,{row:t,locale:r})]},`${e.accountId}-${t.kind}-${i}`))]})}function re({data:e,plain:t}){let{t:n}=c();if(e.plans.length===0&&!e.hasSubscriptions)return null;let r=new Map;for(let t of e.plans)r.set(t.providerId,(r.get(t.providerId)??0)+1);return(0,B.jsxs)(`section`,{className:s(`flex flex-col gap-2`,!t&&`border-t border-[var(--border)] pt-3`),children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-[1fr_48px_72px] items-center gap-2 text-[12px] text-[var(--text-secondary)]`,children:[(0,B.jsx)(`span`,{children:n(`tray.quota`)}),(0,B.jsx)(`span`,{className:`text-right`,children:n(`tray.quotaRemaining`)}),(0,B.jsx)(`span`,{className:`text-right`,children:n(`tray.quotaReset`)})]}),e.plans.length===0?(0,B.jsx)(`div`,{className:`text-[12px] text-[var(--text-muted)]`,children:n(`tray.quotaPending`)}):e.plans.map(e=>(0,B.jsx)(ie,{plan:e,showAccount:(r.get(e.providerId)??0)>1},e.accountId))]})}function Q(e,t,n){return e.kind===`balance`?e.label??t(`tray.quotaBalance`):e.kind===`credits`||e.windowMinutes==null?t(`tray.quotaCredits`):x(e.windowMinutes,n)}function $({row:e,locale:t}){let n=e.remaining,r=n===null?void 0:ee[v(n)];return(0,B.jsxs)(B.Fragment,{children:[n===null?(0,B.jsx)(`span`,{}):(0,B.jsx)(`span`,{className:`h-1.5 overflow-hidden rounded-full bg-[var(--surface-muted)]`,children:(0,B.jsx)(`span`,{className:`block h-full rounded-full`,style:{width:`${n}%`,background:r}})}),e.amount?(0,B.jsx)(`span`,{className:`num col-span-2 truncate text-right font-medium`,children:h(e.amount.value,e.amount.unit,t)}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`num text-right font-medium`,children:n===null?`—`:`${Math.round(n)}%`}),(0,B.jsx)(`span`,{className:`truncate text-right text-[var(--text-secondary)]`,children:_(e.resetsAt,t)??`—`})]})]})}function ie({plan:e,showAccount:t}){let{t:n,locale:r}=c();return(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,B.jsx)(R,{name:e.providerName,icon:e.providerIcon,size:16}),(0,B.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e.providerName}),t&&(0,B.jsx)(`span`,{className:`truncate text-[12px] text-[var(--text-muted)]`,children:e.accountName})]}),e.rows.map((e,t)=>{let i=Q(e,n,r);return(0,B.jsxs)(`div`,{className:`grid grid-cols-[52px_1fr_48px_72px] items-center gap-2 pl-6 text-[12.5px]`,children:[(0,B.jsx)(`span`,{className:`truncate text-[var(--text-secondary)]`,title:i,children:i}),(0,B.jsx)($,{row:e,locale:r})]},`${e.kind}-${t}`)})]})}function ae({data:e,disabled:t,onSwitch:n,plain:r}){let{t:i}=c(),a=e.clients.filter(e=>e.enabled);if(a.length===0)return null;let o=t=>e.providers.find(e=>e.id===t)?.name??i(`tray.unbound`);return(0,B.jsxs)(`section`,{className:s(`flex flex-col gap-1`,!r&&`border-t border-[var(--border)] pt-3`),children:[(0,B.jsx)(`div`,{className:`mb-0.5 text-[12px] text-[var(--text-secondary)]`,children:i(`tray.clients`)}),a.map(e=>(0,B.jsxs)(`button`,{type:`button`,disabled:t||!n,onClick:()=>n?.(e),"aria-label":i(`tray.switchProvider`,{client:e.name}),className:`-mx-2 flex h-8 cursor-default items-center gap-2 rounded-[8px] px-2 text-left transition-colors enabled:hover:bg-[var(--surface-muted)]`,children:[e.kind in L&&(0,B.jsx)(F,{kind:e.kind,size:16}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,B.jsx)(`span`,{className:`max-w-[45%] truncate text-[12px] text-[var(--text-secondary)]`,children:o(e.providerId)}),n&&(0,B.jsx)(E,{className:`size-3.5 shrink-0 text-[var(--text-muted)]`})]},e.kind))]})}export{te as t};
|
|
1
|
+
import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{$s as n,M as r,U as i,c as a,d as o,dt as s,w as c}from"./format-CskGUFYy.js";import{_ as l,b as u,d,f,g as p,h as m,j as h,l as g,m as _,p as v,u as y,v as b,y as x}from"./TrayTitleSource-B98nYas3.js";import{t as S}from"./arrow-down-right-D3a5SpdK.js";import{t as C}from"./arrow-up-right-LPOoQDJW.js";import{t as w}from"./ban-D3eujcIJ.js";import{t as T}from"./chevron-right-Bgtn3ze-.js";import{t as E}from"./chevrons-up-down-CyYxDvJJ.js";import{t as D}from"./copy-48gwhhDO.js";import{t as O}from"./ellipsis-CidyZaW2.js";import{t as k}from"./play-DqueJ6Li.js";import{t as A}from"./refresh-cw-CoLAai2c.js";import{t as j}from"./rotate-ccw-fsXoCwyv.js";import{t as M}from"./settings-BM4QjTnn.js";import{t as N}from"./triangle-alert-DMn3ceGk.js";import{t as P}from"./x-AFrW8zH7.js";import{S as F,_ as I,b as L,w as R}from"./index-Chd2TNCi.js";var z=e(t(),1),B=n(),ee={green:`var(--success)`,orange:`var(--warning)`,red:`var(--danger)`},te=(0,z.forwardRef)(function({prefs:e,state:t,data:n,onCommand:i,onRefresh:a,onCopyAddress:o,onSwitchClient:l,preview:u,tab:d,onTabChange:f,className:p},m){let{t:h}=c(),[g,_]=(0,z.useState)(`overview`),v=t.activity!==null,y=t.running&&!v,b=e=>i?.(e),x=[`overview`];e.sections.quota&&(n.plans.length>0||n.hasSubscriptions)&&x.push(`quota`),e.sections.clients&&n.clients.some(e=>e.enabled)&&x.push(`clients`);let S=d??g,T=x.includes(S)?S:`overview`,E=e=>{_(e),f?.(e)},A=(t.running||v)&&x.length>1,F=n.settings?.gatewayBaseUrl.replace(/^https?:\/\//,``)??(t.port?`127.0.0.1:${t.port}`:``),I=t.activity?h(`tray.status.${t.activity}`):t.running?h(`tray.status.running`):h(`tray.status.stopped`);return(0,B.jsxs)(`div`,{ref:m,className:s(`chrome flex max-h-full flex-col overflow-hidden rounded-[14px] border border-[var(--border-strong)] bg-[var(--surface-raised)] text-[13px] text-[var(--foreground)]`,p),children:[(0,B.jsxs)(`header`,{"data-tray-part":`header`,className:`shrink-0 border-b border-[var(--border)] px-4 pt-3.5 pb-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(r,{tone:v?`orange`:t.running?`green`:`red`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[14px] font-semibold`,children:I}),(0,B.jsx)(V,{label:h(`tray.copyAddress`),onClick:o,disabled:!F,children:(0,B.jsx)(D,{className:`size-4`})}),(0,B.jsx)(V,{label:h(`tray.settings`),onClick:()=>b(`open-settings`),children:(0,B.jsx)(M,{className:`size-4`})}),(0,B.jsx)(V,{label:h(`tray.more`),onClick:()=>b(`menu`),children:(0,B.jsx)(O,{className:`size-4`})}),!u&&(0,B.jsx)(V,{label:h(`common.close`),onClick:()=>b(`hide`),children:(0,B.jsx)(P,{className:`size-4`})})]}),F&&(0,B.jsx)(`div`,{className:`selectable mt-0.5 truncate pl-4 font-mono text-[12px] text-[var(--text-secondary)]`,children:F}),(t.apiVersionMismatch||t.updateAvailable)&&(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 pl-4`,children:[t.apiVersionMismatch&&(0,B.jsxs)(H,{tone:`orange`,children:[(0,B.jsx)(N,{className:`size-3`}),h(`tray.mismatch`)]}),t.updateAvailable&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>b(`check-updates`),className:`cursor-default`,children:(0,B.jsx)(H,{tone:`accent`,children:h(`tray.update`)})})]})]}),(0,B.jsx)(`div`,{"data-tray-part":`tabs`,className:`shrink-0`,children:A&&(0,B.jsx)(U,{tabs:x,active:T,onChange:E})}),(0,B.jsx)(`div`,{className:`scroll min-h-0 flex-1 overflow-y-auto`,children:(0,B.jsx)(`div`,{"data-tray-part":`body`,className:`flex flex-col gap-3 px-4 py-3.5`,children:!t.running&&!v?(0,B.jsx)(K,{onStart:()=>b(`start`)}):(0,B.jsxs)(B.Fragment,{children:[T===`overview`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(G,{prefs:e,data:n,onViewQuota:()=>E(`quota`)}),(0,B.jsx)(J,{prefs:e,data:n,onRefresh:a}),e.sections.quota&&(0,B.jsx)(ne,{data:n,onViewAll:()=>E(`quota`)})]}),T===`quota`&&(0,B.jsx)(re,{data:n,plain:!0}),T===`clients`&&(0,B.jsx)(ae,{data:n,disabled:!y,onSwitch:l,plain:!0})]})})}),(0,B.jsxs)(`footer`,{"data-tray-part":`footer`,className:`flex shrink-0 items-center gap-1 border-t border-[var(--border)] px-3 py-2.5`,children:[t.running?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(V,{label:h(`tray.restart`),onClick:()=>b(`restart`),disabled:v,children:(0,B.jsx)(j,{className:`size-4`})}),(0,B.jsx)(V,{label:h(`tray.stop`),onClick:()=>b(`stop`),disabled:v,children:(0,B.jsx)(w,{className:`size-4`})})]}):(0,B.jsx)(V,{label:h(`shell.startService`),onClick:()=>b(`start`),disabled:v,children:(0,B.jsx)(k,{className:`size-4`})}),(0,B.jsx)(`div`,{className:`flex-1`}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>b(`quit`),className:`h-8 cursor-default rounded-[8px] px-2.5 text-[13px] text-[var(--text-secondary)] transition-colors hover:bg-[var(--surface-muted)] hover:text-[var(--foreground)]`,children:h(`tray.quit`)}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>b(`open`),className:`inline-flex h-8 cursor-default items-center gap-1.5 rounded-[8px] border border-[var(--border-strong)] px-3 text-[13px] font-medium transition-colors hover:bg-[var(--surface-muted)]`,children:[h(`tray.open`),(0,B.jsx)(C,{className:`size-3.5`})]})]})]})});function V({label:e,onClick:t,disabled:n,children:r}){return(0,B.jsx)(`button`,{type:`button`,title:e,"aria-label":e,disabled:n,onClick:t,className:`inline-flex size-8 shrink-0 cursor-default items-center justify-center rounded-[8px] text-[var(--text-secondary)] transition-colors hover:bg-[var(--surface-muted)] hover:text-[var(--foreground)] disabled:opacity-40 disabled:hover:bg-transparent`,children:r})}function H({tone:e,children:t,title:n}){let r={red:`var(--danger)`,orange:`var(--warning)`,accent:`var(--accent)`,neutral:`var(--text-secondary)`}[e];return(0,B.jsx)(`span`,{title:n,className:`inline-flex max-w-full items-center gap-1 rounded-[6px] border px-1.5 py-px text-[11.5px] leading-[18px] whitespace-nowrap`,style:{color:r,borderColor:`color-mix(in oklab, ${r} 45%, transparent)`,background:`color-mix(in oklab, ${r} 10%, transparent)`},children:t})}function U({tabs:e,active:t,onChange:n}){let{t:r}=c(),i={overview:r(`tray.tab.overview`),quota:r(`tray.tab.quota`),clients:r(`tray.clients`)};return(0,B.jsx)(`div`,{role:`tablist`,className:`flex gap-1 px-3 pt-2.5`,children:e.map(e=>(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e===t,onClick:()=>n(e),className:s(`h-7 cursor-default rounded-[7px] px-2.5 text-[12.5px] transition-colors`,e===t?`bg-[var(--surface-muted)] font-medium text-[var(--foreground)]`:`text-[var(--text-secondary)] hover:text-[var(--foreground)]`),children:i[e]},e))})}function W({tone:e,onClick:t,children:n}){let r=e===`red`?`var(--danger)`:`var(--warning)`,i={color:r,borderColor:`color-mix(in oklab, ${r} 45%, transparent)`,background:`color-mix(in oklab, ${r} 10%, transparent)`},a=`flex w-full items-center gap-1.5 rounded-[8px] border px-2.5 py-1.5 text-left text-[12.5px]`,o=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(N,{className:`size-3.5 shrink-0`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n})]});return t?(0,B.jsxs)(`button`,{type:`button`,onClick:t,className:s(a,`cursor-default`),style:i,children:[o,(0,B.jsx)(T,{className:`size-3.5 shrink-0`})]}):(0,B.jsx)(`div`,{className:a,style:i,children:o})}function G({prefs:e,data:t,onViewQuota:n}){let{t:r,locale:i}=c(),o=t.summary,s=e.sections.overview&&o?y(o):0,l=e.sections.quota?m(t.plans):null,u=l&&l.row.remaining<30?l:null;return!o||s===0&&!u?null:(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s>0&&(0,B.jsx)(W,{tone:`red`,children:r(`tray.alert.failures`,{count:s,share:a(s/o.requests)})}),u&&(0,B.jsx)(W,{tone:u.row.remaining<10?`red`:`orange`,onClick:n,children:r(`tray.alert.quota`,{plan:u.plan.providerName,window:Q(u.row,r,i),remaining:`${Math.round(u.row.remaining)}%`})})]})}function K({onStart:e}){let{t}=c();return(0,B.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-6 text-center`,children:[(0,B.jsx)(`div`,{className:`text-[13px] font-medium`,children:t(`tray.status.stopped`)}),(0,B.jsx)(`div`,{className:`max-w-[260px] text-[12px] text-[var(--text-secondary)]`,children:t(`tray.stoppedHint`)}),(0,B.jsxs)(`button`,{type:`button`,onClick:e,className:`mt-1 inline-flex h-8 cursor-default items-center gap-1.5 rounded-[8px] bg-[var(--accent)] px-3 text-[13px] font-medium text-[var(--on-accent)]`,children:[(0,B.jsx)(k,{className:`size-3.5`}),t(`shell.startService`)]})]})}function q(e=3e4){let[t,n]=(0,z.useState)(()=>Date.now());return(0,z.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function J({prefs:e,data:t,onRefresh:n}){let{t:r,locale:s}=c(),f=q(),p=t.summary,m=e.sections,h=m.overview||m.cost,_=p?p.inputTokens+p.outputTokens:0,v=b(t.updatedAt,s,r(`tray.justNow`),f),y=m.topModel?l(t.top,_):null,x=m.cacheHitRate&&p?I(p.cacheReadTokens,p.inputTokens):null,w=m.compareYesterday&&p?g(_,u(t.daily,new Date(f))):null,T=m.topModel||m.cacheHitRate||m.compareYesterday;return!h&&!m.chart&&!T?null:(0,B.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-[13px] text-[var(--text-secondary)]`,children:r(`tray.today`)}),(0,B.jsx)(`div`,{className:`flex-1`}),v&&(0,B.jsx)(`span`,{className:`text-[12px] text-[var(--text-muted)]`,children:r(`tray.updated`,{time:v})}),(0,B.jsx)(V,{label:r(`common.refresh`),onClick:n,children:(0,B.jsx)(A,{className:`size-3.5`})})]}),p?(0,B.jsxs)(B.Fragment,{children:[h&&(0,B.jsxs)(`div`,{className:`grid auto-cols-fr grid-flow-col gap-px overflow-hidden rounded-[10px] bg-[var(--border)]`,children:[m.overview&&(0,B.jsx)(Y,{label:r(`tray.requests`),value:o(p.requests,!0)}),m.overview&&(0,B.jsx)(Y,{label:r(`tray.tokens`),value:o(_,!0)}),m.cost&&(0,B.jsx)(Y,{label:r(`tray.cost`),value:d(p.costUsd)})]}),m.chart&&(0,B.jsx)(Z,{data:t,now:f}),T&&(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[y&&(0,B.jsxs)(X,{label:r(`tray.topModel`),title:y.model,children:[(0,B.jsx)(`span`,{className:`truncate`,children:y.model}),(0,B.jsxs)(`span`,{className:`shrink-0`,children:[`· `,a(y.share)]})]}),m.cacheHitRate&&(0,B.jsx)(X,{label:r(`tray.cacheHit`),children:(0,B.jsx)(`span`,{children:x==null?`—`:a(x)})}),m.compareYesterday&&(0,B.jsx)(X,{label:r(`tray.vsYesterday`),children:w==null?(0,B.jsx)(`span`,{children:`—`}):(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[w>=0?(0,B.jsx)(C,{className:`size-3`}):(0,B.jsx)(S,{className:`size-3`}),a(Math.abs(w))]})})]})]}):t.error?(0,B.jsx)(`div`,{className:`text-[12px] text-[var(--danger)]`,children:r(`tray.loadFailed`)}):(0,B.jsx)(i,{lines:2})]})}function Y({label:e,value:t}){return(0,B.jsxs)(`div`,{className:`min-w-0 bg-[var(--surface-muted)] px-3 py-2.5`,children:[(0,B.jsx)(`div`,{className:`truncate text-[12px] text-[var(--text-secondary)]`,children:e}),(0,B.jsx)(`div`,{className:`num mt-0.5 truncate text-[20px] leading-tight font-semibold`,title:t,children:t})]})}function X({label:e,title:t,children:n}){return(0,B.jsxs)(`span`,{title:t,className:`inline-flex max-w-full min-w-0 items-center gap-1.5 rounded-[7px] border border-[var(--border)] px-2 py-0.5 text-[12px]`,children:[(0,B.jsx)(`span`,{className:`shrink-0 text-[var(--text-secondary)]`,children:e}),(0,B.jsx)(`span`,{className:`flex min-w-0 items-center gap-1 font-medium`,children:n})]})}function Z({data:e,now:t}){let{t:n}=c(),r=f(e.hourly,new Date(t)),i=Math.max(1,...r.map(e=>e.value)),a=new Date(t).getHours();return(0,B.jsx)(`div`,{role:`img`,"aria-label":n(`tray.chartLabel`),className:`flex h-16 items-end gap-[3px]`,children:r.map((e,t)=>{let r=e.value>0?Math.max(4,Math.round(e.value/i*64)):2;return(0,B.jsx)(`span`,{title:n(`tray.hourBar`,{hour:`${String(t).padStart(2,`0`)}:00`,count:e.value}),className:`flex-1 rounded-[2px]`,style:{height:r,background:t===a?`var(--accent)`:e.value>0?`color-mix(in oklab, var(--foreground) 32%, transparent)`:`var(--border)`,opacity:t>a?.5:1}},e.bucket)})})}function ne({data:e,onViewAll:t}){let{t:n,locale:r}=c();if(e.plans.length===0)return e.hasSubscriptions?(0,B.jsx)(`div`,{className:`border-t border-[var(--border)] pt-3 text-[12px] text-[var(--text-muted)]`,children:n(`tray.quotaPending`)}):null;let i=p(e.plans,3),a=e.plans.reduce((e,t)=>e+t.rows.length,0);return(0,B.jsxs)(`section`,{className:`flex flex-col gap-2 border-t border-[var(--border)] pt-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center text-[12px] text-[var(--text-secondary)]`,children:[(0,B.jsx)(`span`,{className:`flex-1`,children:n(`tray.quotaTightest`)}),a>i.length&&(0,B.jsxs)(`button`,{type:`button`,onClick:t,className:`inline-flex cursor-default items-center gap-0.5 hover:text-[var(--foreground)]`,children:[n(`tray.viewAll`),(0,B.jsx)(T,{className:`size-3`})]})]}),i.map(({plan:e,row:t},i)=>(0,B.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_64px_40px_60px] items-center gap-2 text-[12.5px]`,children:[(0,B.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,B.jsx)(R,{name:e.providerName,icon:e.providerIcon,size:14}),(0,B.jsx)(`span`,{className:`truncate font-medium`,children:e.providerName}),(0,B.jsx)(`span`,{className:`shrink-0 text-[var(--text-secondary)]`,children:Q(t,n,r)})]}),(0,B.jsx)($,{row:t,locale:r})]},`${e.accountId}-${t.kind}-${i}`))]})}function re({data:e,plain:t}){let{t:n}=c();if(e.plans.length===0&&!e.hasSubscriptions)return null;let r=new Map;for(let t of e.plans)r.set(t.providerId,(r.get(t.providerId)??0)+1);return(0,B.jsxs)(`section`,{className:s(`flex flex-col gap-2`,!t&&`border-t border-[var(--border)] pt-3`),children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-[1fr_48px_72px] items-center gap-2 text-[12px] text-[var(--text-secondary)]`,children:[(0,B.jsx)(`span`,{children:n(`tray.quota`)}),(0,B.jsx)(`span`,{className:`text-right`,children:n(`tray.quotaRemaining`)}),(0,B.jsx)(`span`,{className:`text-right`,children:n(`tray.quotaReset`)})]}),e.plans.length===0?(0,B.jsx)(`div`,{className:`text-[12px] text-[var(--text-muted)]`,children:n(`tray.quotaPending`)}):e.plans.map(e=>(0,B.jsx)(ie,{plan:e,showAccount:(r.get(e.providerId)??0)>1},e.accountId))]})}function Q(e,t,n){return e.kind===`balance`?e.label??t(`tray.quotaBalance`):e.kind===`credits`||e.windowMinutes==null?t(`tray.quotaCredits`):x(e.windowMinutes,n)}function $({row:e,locale:t}){let n=e.remaining,r=n===null?void 0:ee[v(n)];return(0,B.jsxs)(B.Fragment,{children:[n===null?(0,B.jsx)(`span`,{}):(0,B.jsx)(`span`,{className:`h-1.5 overflow-hidden rounded-full bg-[var(--surface-muted)]`,children:(0,B.jsx)(`span`,{className:`block h-full rounded-full`,style:{width:`${n}%`,background:r}})}),e.amount?(0,B.jsx)(`span`,{className:`num col-span-2 truncate text-right font-medium`,children:h(e.amount.value,e.amount.unit,t)}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`num text-right font-medium`,children:n===null?`—`:`${Math.round(n)}%`}),(0,B.jsx)(`span`,{className:`truncate text-right text-[var(--text-secondary)]`,children:_(e.resetsAt,t)??`—`})]})]})}function ie({plan:e,showAccount:t}){let{t:n,locale:r}=c();return(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,B.jsx)(R,{name:e.providerName,icon:e.providerIcon,size:16}),(0,B.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e.providerName}),t&&(0,B.jsx)(`span`,{className:`truncate text-[12px] text-[var(--text-muted)]`,children:e.accountName})]}),e.rows.map((e,t)=>{let i=Q(e,n,r);return(0,B.jsxs)(`div`,{className:`grid grid-cols-[52px_1fr_48px_72px] items-center gap-2 pl-6 text-[12.5px]`,children:[(0,B.jsx)(`span`,{className:`truncate text-[var(--text-secondary)]`,title:i,children:i}),(0,B.jsx)($,{row:e,locale:r})]},`${e.kind}-${t}`)})]})}function ae({data:e,disabled:t,onSwitch:n,plain:r}){let{t:i}=c(),a=e.clients.filter(e=>e.enabled);if(a.length===0)return null;let o=t=>e.providers.find(e=>e.id===t)?.name??i(`tray.unbound`);return(0,B.jsxs)(`section`,{className:s(`flex flex-col gap-1`,!r&&`border-t border-[var(--border)] pt-3`),children:[(0,B.jsx)(`div`,{className:`mb-0.5 text-[12px] text-[var(--text-secondary)]`,children:i(`tray.clients`)}),a.map(e=>(0,B.jsxs)(`button`,{type:`button`,disabled:t||!n,onClick:()=>n?.(e),"aria-label":i(`tray.switchProvider`,{client:e.name}),className:`-mx-2 flex h-8 cursor-default items-center gap-2 rounded-[8px] px-2 text-left transition-colors enabled:hover:bg-[var(--surface-muted)]`,children:[e.kind in L&&(0,B.jsx)(F,{kind:e.kind,size:16}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,B.jsx)(`span`,{className:`max-w-[45%] truncate text-[12px] text-[var(--text-secondary)]`,children:o(e.providerId)}),n&&(0,B.jsx)(E,{className:`size-3.5 shrink-0 text-[var(--text-muted)]`})]},e.kind))]})}export{te as t};
|