@antseed/gateway-console 0.1.10 → 0.1.12
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/dist/assets/{Activity-jZYZ0SDm.js → Activity-BcXN_DqV.js} +1 -1
- package/dist/assets/Audit-nk0K4aQy.js +1 -0
- package/dist/assets/BrandIcon-6gq42Dg-.js +1 -0
- package/dist/assets/{ChainGate-In51TI2h.js → ChainGate-Do1wYOPQ.js} +1 -1
- package/dist/assets/{ChannelClose-D8CcISX0.js → ChannelClose-CdHUKMFm.js} +1 -1
- package/dist/assets/{Charts-doK0mDVf.js → Charts-BMsoEfDr.js} +1 -1
- package/dist/assets/Chat-C4DsUQG-.js +225 -0
- package/dist/assets/{ConnectWallet-DQ0PC6SO.js → ConnectWallet-BYdqZipy.js} +1 -1
- package/dist/assets/{DataTable-BTwj5g1m.js → DataTable-BCgVRqY6.js} +1 -1
- package/dist/assets/Disclosure-CQMtWM0M.js +1 -0
- package/dist/assets/KeyHolder-JK1zjm4r.js +1 -0
- package/dist/assets/Keys-BndDLQdj.js +1 -0
- package/dist/assets/Logs-DfacvRY6.js +1 -0
- package/dist/assets/Members-pSSyfBFp.js +1 -0
- package/dist/assets/{Migrate-BQYY5ty3.js → Migrate-Bqnu-HEP.js} +1 -1
- package/dist/assets/ModelDetails-Sgq3MjfG.js +1 -0
- package/dist/assets/Models-C6QzCAh4.js +1 -0
- package/dist/assets/{OperatorActions-DrRpfDBV.js → OperatorActions-DWX4uK6I.js} +1 -1
- package/dist/assets/{OperatorGateAlert-D92zhyXC.js → OperatorGateAlert-cpvsO9yT.js} +1 -1
- package/dist/assets/{Overview-CJmp6b7M.js → Overview-C4Bu8z8u.js} +1 -1
- package/dist/assets/{PeerPicker-BJfjL7Dy.js → PeerPicker-CcMSXxY3.js} +1 -1
- package/dist/assets/PolicyEditor-COREmE0O.js +1 -0
- package/dist/assets/PolicyField-ldIq_Yw-.js +1 -0
- package/dist/assets/Presets-DFKw93HK.js +4 -0
- package/dist/assets/Providers-D_0V31og.js +1 -0
- package/dist/assets/RequestLog-ChzJA1hM.js +1 -0
- package/dist/assets/{Rewards-DNNxx3NO.js → Rewards-Cgw7r3bc.js} +2 -2
- package/dist/assets/{RewardsClaim-nstcyJvi.js → RewardsClaim-Df0QQMHb.js} +1 -1
- package/dist/assets/Routing-KpWxzlwc.js +1 -0
- package/dist/assets/{Segmented-BelxPFkk.js → Segmented-DYnoemT9.js} +1 -1
- package/dist/assets/{SelectField-BWyF8Ku8.js → SelectField-m1sMIgMa.js} +1 -1
- package/dist/assets/Settings-D2MkmqAU.js +7 -0
- package/dist/assets/SidePanel-BFQArkoa.js +1 -0
- package/dist/assets/{Staking-DHwoflHG.js → Staking-2rSdK2Ob.js} +1 -1
- package/dist/assets/{StakingDashboard-DtOKTmys.js → StakingDashboard-DvLxJ1j4.js} +1 -1
- package/dist/assets/Switch-Db8Sm64J.js +1 -0
- package/dist/assets/{Tabs-yVL4Cd6z.js → Tabs-CCabxVNK.js} +1 -1
- package/dist/assets/{TextAreaField-B6jcl4RR.js → TextAreaField-BCi-qMua.js} +1 -1
- package/dist/assets/{UsageByModel-DhTF-c1H.js → UsageByModel-Fb68pvpD.js} +1 -1
- package/dist/assets/VerificationLinks-CWyl6ZEp.js +1 -0
- package/dist/assets/{Wallet-QXhhg_E-.js → Wallet-BVuVEAB5.js} +7 -7
- package/dist/assets/{WalletConfirm-CgWBuaMN.js → WalletConfirm-Bs7CFRaa.js} +1 -1
- package/dist/assets/{WalletFunding-Ydd9gD2t.js → WalletFunding-w9MlXB0t.js} +1 -1
- package/dist/assets/{WalletSignIn-DvVSFW4u.js → WalletSignIn-CFxQjhbw.js} +1 -1
- package/dist/assets/Workspaces-DktyLm08.js +1 -0
- package/dist/assets/{add-ChFb9YAz.js → add-CWU7ACA6.js} +1 -1
- package/dist/assets/{all-wallets-rdNweGUd.js → all-wallets-C7xN3fay.js} +1 -1
- package/dist/assets/{app-store-s294A1qn.js → app-store-C9LYdcrl.js} +1 -1
- package/dist/assets/{apple-Cs8Kx1eO.js → apple-DyeheYaR.js} +1 -1
- package/dist/assets/{arrow-bottom-BMmCEQIa.js → arrow-bottom-C-Ld0QTs.js} +1 -1
- package/dist/assets/{arrow-bottom-circle-CThmnDp3.js → arrow-bottom-circle-CBZDZ8Ab.js} +1 -1
- package/dist/assets/{arrow-left-BJxgCTi0.js → arrow-left-DpJrY7yH.js} +1 -1
- package/dist/assets/{arrow-right-CnLYkBsH.js → arrow-right-C12AYUbo.js} +1 -1
- package/dist/assets/{arrow-top-Dc0DLP-U.js → arrow-top-DTpoR1JD.js} +1 -1
- package/dist/assets/{bank-CSWOYeMW.js → bank-Ce19qcX5.js} +1 -1
- package/dist/assets/{basic-BHdv4O5I.js → basic-xSJded8g.js} +1 -1
- package/dist/assets/{browser-mp33aPgo.js → browser-efLjW-nE.js} +1 -1
- package/dist/assets/{bundle-full-CDQ5iC5h.js → bundle-full-Bo_XusKG.js} +1 -1
- package/dist/assets/{card-BcVuRQiM.js → card-C5hP1T57.js} +1 -1
- package/dist/assets/{ccip-O1XLvWon.js → ccip-B61TPyfu.js} +1 -1
- package/dist/assets/{checkmark-CQVJIWW1.js → checkmark-D6TDn2nt.js} +1 -1
- package/dist/assets/{checkmark-bold-DDU5XQfq.js → checkmark-bold-D6Dl_7lL.js} +1 -1
- package/dist/assets/{chevron-bottom-Bqi9FW2q.js → chevron-bottom-BN93pLQ-.js} +1 -1
- package/dist/assets/{chevron-left-Vd5st0yB.js → chevron-left-BRtPfxLq.js} +1 -1
- package/dist/assets/{chevron-right-BVwFrlss.js → chevron-right-q6ckJ6mb.js} +1 -1
- package/dist/assets/{chevron-top-D5dQ2xFn.js → chevron-top-C1AX5sm6.js} +1 -1
- package/dist/assets/{chrome-store-C9C4k8IO.js → chrome-store-Bo_BoLHJ.js} +1 -1
- package/dist/assets/{clock-Cuvc7bNo.js → clock-BhAO_7G0.js} +1 -1
- package/dist/assets/{close-fW1pJ13b.js → close-BtzdVDHu.js} +1 -1
- package/dist/assets/code-block-DqMh9vFo.js +3 -0
- package/dist/assets/{coinPlaceholder-CKymvNA8.js → coinPlaceholder-Di1b8fYJ.js} +1 -1
- package/dist/assets/{compass-D3h_6fr8.js → compass-C10lNmou.js} +1 -1
- package/dist/assets/{copy-CNGN_cOz.js → copy-B5e38uFc.js} +1 -1
- package/dist/assets/{core-LDeQm5nv.js → core-B0f6zAPS.js} +3 -3
- package/dist/assets/{cursor-transparent-BblOfv3t.js → cursor-transparent-DzGICXfN.js} +1 -1
- package/dist/assets/cursor-zACYQT2t.js +3 -0
- package/dist/assets/{desktop-gpVOlZ1-.js → desktop-DSb6a3DL.js} +1 -1
- package/dist/assets/{disconnect-C_phPN0_.js → disconnect-DRzHq1ok.js} +1 -1
- package/dist/assets/{discord-Dk_2Plhc.js → discord-c_RQc3fB.js} +1 -1
- package/dist/assets/{en_US-Y4ZOVFV4-CmhP8GU2.js → en_US-Y4ZOVFV4-Bkc-z49M.js} +4 -4
- package/dist/assets/{etherscan-Cyrh-2Lr.js → etherscan-CQGvGKJu.js} +1 -1
- package/dist/assets/{exclamation-triangle-SeeDwZ6A.js → exclamation-triangle-CPWxzsHw.js} +1 -1
- package/dist/assets/{extension-e_11O0GI.js → extension-ytWXOqXr.js} +1 -1
- package/dist/assets/{external-link-Dl0AqCn3.js → external-link-BYoSE2u3.js} +1 -1
- package/dist/assets/{facebook-Cp_-Axbh.js → facebook-CMBv0nnN.js} +1 -1
- package/dist/assets/{farcaster-Zwu26KYL.js → farcaster-CJmfWTQP.js} +1 -1
- package/dist/assets/{filters-CdkpWvgi.js → filters-DEiNVvyn.js} +1 -1
- package/dist/assets/{github-DuPUePDJ.js → github-CdMwJkf8.js} +1 -1
- package/dist/assets/{google-DlKW7Gx7.js → google-CHI5gfH8.js} +1 -1
- package/dist/assets/{help-circle-19xLhjPt.js → help-circle-dA36a8fM.js} +1 -1
- package/dist/assets/highlighted-body-KQOG7T2V-BFlyrf-z.js +1 -0
- package/dist/assets/{id-B4PjxpL6.js → id-Dm0-1g1D.js} +1 -1
- package/dist/assets/{image-CHz8w95r.js → image-BL3ODVX_.js} +1 -1
- package/dist/assets/{index-CfhMI0GY.css → index-BAcoKUeC.css} +1 -1
- package/dist/assets/{index-CAflmCbT.js → index-BRgGxCKs.js} +3 -3
- package/dist/assets/{index-CgyFWy7G.js → index-BXzZZOmS.js} +1 -1
- package/dist/assets/{index-CZbdRW9K.js → index-CHeO_lLD.js} +1 -1
- package/dist/assets/{index-BYZ6CM-r.js → index-D1OXThJP.js} +1 -1
- package/dist/assets/{index-DIcymBxc.js → index-DPXW_JSn.js} +25 -25
- package/dist/assets/{index.es-0kjt2ETS.js → index.es-XdMmjy3e.js} +3 -3
- package/dist/assets/{info-CFnwPck_.js → info-BbBzpLWs.js} +1 -1
- package/dist/assets/{info-circle-DNYjRzmq.js → info-circle-CKgnYdF-.js} +1 -1
- package/dist/assets/{lightbulb-DPrYcwVp.js → lightbulb-B6Xv9kMK.js} +1 -1
- package/dist/assets/{limits-D8_oE0N-.js → limits-uCwhqY-O.js} +1 -1
- package/dist/assets/{mail-Do_T12XQ.js → mail-BdCMypwE.js} +1 -1
- package/dist/assets/{mermaid-MCJ5UELQ-Cr83KTfF.js → mermaid-MCJ5UELQ-BaHsArCB.js} +3 -3
- package/dist/assets/{metamask-sdk-CHSvqgLD.js → metamask-sdk-BL7QLxcU.js} +1 -1
- package/dist/assets/{mobile-2wdwD-gm.js → mobile-F_82dhUb.js} +1 -1
- package/dist/assets/{more-CugjlKbm.js → more-CtMTtAsM.js} +1 -1
- package/dist/assets/{network-placeholder-D0CvRN9Z.js → network-placeholder-BRs4Lylz.js} +1 -1
- package/dist/assets/{nftPlaceholder-CjCtJ3VF.js → nftPlaceholder-DONTHyad.js} +1 -1
- package/dist/assets/{off-CjwzxGqC.js → off-Bwru40fy.js} +1 -1
- package/dist/assets/{play-store-ts_mM-L7.js → play-store-CDeNquGq.js} +1 -1
- package/dist/assets/{plus-CayVcA5r.js → plus-EcrYfJFM.js} +1 -1
- package/dist/assets/{qr-code-BJFXX7Ga.js → qr-code-CF-SIZQq.js} +1 -1
- package/dist/assets/{recycle-horizontal-Dxd_xbuW.js → recycle-horizontal-CQAPujmy.js} +1 -1
- package/dist/assets/{refresh-2tSMiCzO.js → refresh-BErGEy2b.js} +1 -1
- package/dist/assets/{reown-logo-C3tg9yiK.js → reown-logo-Ge2o4AAI.js} +1 -1
- package/dist/assets/{search-By38_AjN.js → search-Ca88O9BA.js} +1 -1
- package/dist/assets/selection-BV37SUs_.js +1 -0
- package/dist/assets/{send-DhLEHc2T.js → send-VS1TUwft.js} +1 -1
- package/dist/assets/{sendTransaction-CqpP3CZj.js → sendTransaction-k8aDYfd4.js} +1 -1
- package/dist/assets/stored-e0tX90bC.js +1 -0
- package/dist/assets/{swapHorizontal-BSy_Qzqy.js → swapHorizontal-UNJ9wJ3Z.js} +1 -1
- package/dist/assets/{swapHorizontalBold-B4pOkOa-.js → swapHorizontalBold-eQTpC4fd.js} +1 -1
- package/dist/assets/{swapHorizontalMedium-BbDDLHs6.js → swapHorizontalMedium-DaFWQu14.js} +1 -1
- package/dist/assets/{swapHorizontalRoundedBold-MzTdSarg.js → swapHorizontalRoundedBold-BbRZUmJZ.js} +1 -1
- package/dist/assets/{swapVertical-D0uKM7wm.js → swapVertical-CrZ6Be2R.js} +1 -1
- package/dist/assets/{telegram-Q_WwsPzx.js → telegram-CDAYT0ej.js} +1 -1
- package/dist/assets/{three-dots-Cpl_X23E.js → three-dots-CK__4w5S.js} +1 -1
- package/dist/assets/{twitch-B7x-eAo9.js → twitch-BS50nSpU.js} +1 -1
- package/dist/assets/{twitterIcon-BRMMjDzW.js → twitterIcon-BtVx5zJI.js} +1 -1
- package/dist/assets/{usage-DktoZRc8.js → usage-DQGKL0DJ.js} +1 -1
- package/dist/assets/{useInfiniteQuery-NenQ5Num.js → useInfiniteQuery-CAj47QRO.js} +1 -1
- package/dist/assets/{useTx-WkiDSW_A.js → useTx-DzRlz7Ez.js} +1 -1
- package/dist/assets/{verify-filled-CaKhO-hp.js → verify-filled-E4LyUumx.js} +1 -1
- package/dist/assets/{verify-BxTMhyZY.js → verify-hRAQBjoS.js} +1 -1
- package/dist/assets/{w3m-modal-DZ2_0Ukm.js → w3m-modal-CLSVKDRP.js} +1 -1
- package/dist/assets/{waitForCallsStatus-CtriTPoz.js → waitForCallsStatus-C51Vv8Tt.js} +1 -1
- package/dist/assets/{wallet-BeZF3I-Z.js → wallet-D-TGx4VA.js} +1 -1
- package/dist/assets/{wallet-placeholder-BDvuTJ6r.js → wallet-placeholder-SjwHckDA.js} +1 -1
- package/dist/assets/{walletconnect-U8tnyg6m.js → walletconnect-7nuI2nwG.js} +1 -1
- package/dist/assets/{warning-circle-Dg69jmuZ.js → warning-circle-BI2BfSeD.js} +1 -1
- package/dist/assets/{writeContract-DrAWt0yz.js → writeContract-CaMlmKcK.js} +1 -1
- package/dist/assets/{x-CJ-uWPue.js → x-DoGk7CZD.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/Audit-C-dFTX_u.js +0 -1
- package/dist/assets/Chat-CaImcsH1.js +0 -220
- package/dist/assets/KeyHolder-D90Uu-Jv.js +0 -1
- package/dist/assets/Keys-B5LppZtn.js +0 -1
- package/dist/assets/Logs-Dw4sZ9lo.js +0 -1
- package/dist/assets/Members-CnaHKFut.js +0 -1
- package/dist/assets/Models-zIuHewdV.js +0 -1
- package/dist/assets/PolicyEditor-BpoV34ra.js +0 -1
- package/dist/assets/PolicyField-CfRYcr_J.js +0 -1
- package/dist/assets/Presets-c1J4UwX0.js +0 -4
- package/dist/assets/Providers-B0LuYcAw.js +0 -1
- package/dist/assets/RequestLog-D2YGgG1C.js +0 -1
- package/dist/assets/Routing-B79eDIZL.js +0 -1
- package/dist/assets/Settings-Cws5Z--R.js +0 -7
- package/dist/assets/Switch-BwBYBnSS.js +0 -1
- package/dist/assets/Workspaces-DuxGwCQ2.js +0 -1
- package/dist/assets/code-block-Djv3iQ0G.js +0 -3
- package/dist/assets/cursor-CTNYpsWo.js +0 -3
- package/dist/assets/highlighted-body-KQOG7T2V-D7DB9nBd.js +0 -1
- package/dist/assets/models-CLos5_p0.js +0 -1
- package/dist/assets/stored-CFfx95Ep.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as n,B as i}from"./index-
|
|
1
|
+
import{j as n,B as i}from"./index-DPXW_JSn.js";import{C as c}from"./en_US-Y4ZOVFV4-Bkc-z49M.js";function u({label:e="Connect wallet",fullWidth:s=!0,size:r,variant:t}){return n.jsx(c.Custom,{children:({openConnectModal:a,mounted:l})=>n.jsx(i,{fullWidth:s,size:r,variant:t,disabled:!l,onClick:a,children:e})})}function h(){return n.jsx(c.Custom,{children:({account:e,chain:s,mounted:r,openAccountModal:t,openChainModal:a})=>!r||!e||!s?null:n.jsxs("div",{className:"gc-connected",children:[n.jsx("span",{className:"gc-connected__dot","aria-hidden":"true"}),n.jsxs("span",{children:["Connected ",n.jsx("code",{className:"gc-mono",children:e.displayName})]}),s.unsupported&&n.jsxs(n.Fragment,{children:[n.jsx("span",{"aria-hidden":"true",children:"·"}),n.jsx("span",{className:"gc-warn",children:"Wrong network"}),n.jsx(i,{variant:"link",size:"sm",onClick:a,children:"Switch network"})]}),n.jsx("span",{"aria-hidden":"true",children:"·"}),n.jsx(i,{variant:"link",size:"sm",onClick:t,children:"Change"})]})})}export{u as C,h as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as j,j as t,
|
|
1
|
+
import{r as j,j as t,aj as m,B as b}from"./index-DPXW_JSn.js";function _(e){return[e.align==="right"?"as-num":null,e.secondary?"as-secondary":null,e.optional?"as-optional":null].filter(Boolean).join(" ")||void 0}function A(e,s){if((e==null?void 0:e.key)===s)return e.direction==="asc"?"ascending":"descending"}function M(e,s){return(e==null?void 0:e.key)!==s?"":e.direction==="asc"?"↑":"↓"}function C({rows:e,columns:s,rowKey:p,onRowClick:r,rowLabel:l,actions:d,empty:u,label:y,initialSort:k,selectedKey:g}){const[n,v]=j.useState(k??null),N=j.useMemo(()=>{if(!n)return e;const a=s.find(h=>h.key===n.key);if(!(a!=null&&a.sortValue))return e;const c=a.sortValue,x=n.direction==="asc"?1:-1;return[...e].sort((h,i)=>{const f=c(h),o=c(i);return f===o?0:f===null?1:o===null?-1:(f<o?-1:1)*x})},[e,s,n]);return e.length===0&&u?t.jsx(t.Fragment,{children:u}):t.jsx("div",{className:"as-table-wrap",children:t.jsxs("table",{className:"as-table","aria-label":y,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[s.map(a=>{const c=(n==null?void 0:n.key)===a.key;return t.jsx("th",{className:_(a),style:a.width?{width:a.width}:void 0,"aria-sort":A(n,a.key),children:a.sortValue?t.jsxs("button",{type:"button",className:"as-table__sort",onClick:()=>v({key:a.key,direction:c&&n.direction==="desc"?"asc":"desc"}),children:[a.header,t.jsx("span",{"aria-hidden":"true",className:"as-table__arrow",children:M(n,a.key)})]}):a.header},a.key)}),d&&t.jsx("th",{className:"as-table__actions",children:t.jsx("span",{className:"as-sr",children:"Actions"})})]})}),t.jsx("tbody",{children:N.map(a=>{const c=p(a),x=g!=null&&c===g,h=[r?"as-table__row--click":null,x?"as-table__row--selected":null].filter(Boolean).join(" ");return t.jsxs("tr",{className:h||void 0,"aria-current":x?"true":void 0,onClick:r?()=>r(a):void 0,children:[s.map((i,f)=>t.jsx("td",{className:_(i),children:(()=>{const o=f===0&&r?t.jsx("button",{type:"button",className:"as-table__open","aria-label":l?`Open ${l(a)}`:void 0,onClick:P=>{P.stopPropagation(),r(a)},children:i.render(a)}):i.render(a);return i.after?t.jsxs("div",{className:"as-table__lead",children:[o,i.after(a)]}):o})()},i.key)),d&&t.jsx("td",{className:"as-table__actions",onClick:i=>i.stopPropagation(),children:t.jsx(m,{label:l?`Actions for ${l(a)}`:"Actions",items:d(a)})})]},c)})})]})})}function S(e,s,p=""){const[r,l]=j.useState(0);j.useEffect(()=>{l(0)},[p]);const d=Math.max(1,Math.ceil(e.length/s)),u=Math.min(r,d-1);return{items:e.slice(u*s,(u+1)*s),page:u,pages:d,total:e.length,setPage:l}}function E({pager:e,noun:s}){return e.pages<=1?null:t.jsxs("nav",{className:"as-pager","aria-label":`${s} pages`,children:[t.jsxs("span",{className:"as-pager__status",children:["Page ",e.page+1," of ",e.pages," · ",e.total," ",s]}),t.jsxs("div",{className:"as-pager__buttons",children:[t.jsx(b,{variant:"outline",size:"sm",disabled:e.page===0,onClick:()=>e.setPage(e.page-1),children:"Previous"}),t.jsx(b,{variant:"outline",size:"sm",disabled:e.page>=e.pages-1,onClick:()=>e.setPage(e.page+1),children:"Next"})]})]})}export{C as D,E as P,S as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as s}from"./index-DPXW_JSn.js";function n({title:i,summary:e,children:o,defaultOpen:r,className:a}){return s.jsxs("details",{className:["as-disclosure",a].filter(Boolean).join(" "),open:r,children:[s.jsxs("summary",{className:"as-disclosure__summary",children:[s.jsx("span",{className:"as-disclosure__title",children:i}),e!=null&&e!==""&&s.jsx("span",{className:"as-disclosure__meta",children:e}),s.jsx("svg",{className:"as-disclosure__chevron",width:"12",height:"12",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:s.jsx("path",{d:"M4 6l4 4 4-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),s.jsx("div",{className:"as-disclosure__body",children:o})]})}export{n as D};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a3 as v,a4 as N,e as g,q,j as e,a5 as k,a6 as x,a7 as w,B as R,I as S,P as B,v as y,a8 as E,S as P,a9 as _,g as n,l as d,Q as A,X as I,h as D,aa as K,ab as L,A as O,m as c,f as j,ac as T}from"./index-DPXW_JSn.js";import{R as F}from"./RequestLog-ChzJA1hM.js";import{r as M,e as Q}from"./usage-DQGKL0DJ.js";import{B as $}from"./Charts-BMsoEfDr.js";import"./useInfiniteQuery-CAj47QRO.js";import"./PeerPicker-CcMSXxY3.js";import"./selection-BV37SUs_.js";import"./DataTable-BCgVRqY6.js";function W(){var m;const h=v(),u=N(),s=((m=u.data)==null?void 0:m.kind)==="key"?u.data.me.key:null,l=Date.now(),o=M("30d",l),f=g({queryKey:q.usage({key:s==null?void 0:s.id,from:o,groupBy:"day"}),queryFn:()=>j.usage.report({key:s.id,from:o,to:l,groupBy:"day"}),enabled:!!s}),b=g({queryKey:["key-periods",s==null?void 0:s.id],enabled:!!s,queryFn:async()=>{const a=await Promise.all(["daily","weekly","monthly"].map(async i=>{const t=await j.usage.report({key:s.id,from:T(i,l)});return[i,c(t.totals.spent)]}));return Object.fromEntries([...a,["total",c(s.usage.spent)]])}});return e.jsxs("div",{className:"gc-keyholder",children:[e.jsxs("header",{className:"gc-topbar",children:[e.jsxs("div",{className:"gc-topbar__inner",children:[e.jsx(k,{to:null,tagged:!0}),e.jsx("div",{className:"gc-topbar__spacer"}),e.jsx(x,{className:"gc-endpoint--inline"}),e.jsx(w,{}),e.jsx(R,{variant:"outline",size:"sm",leadingIcon:e.jsx(S.logout,{size:14}),onClick:()=>void h(),children:"Sign out"})]}),e.jsx("div",{className:"gc-topbar__strip",children:e.jsx(x,{})})]}),e.jsx("main",{className:"gc-main",id:"gc-main",children:s&&e.jsxs("div",{className:"gc-page",children:[e.jsx(B,{title:s.label,description:e.jsxs(e.Fragment,{children:["Key ",e.jsx("code",{children:s.hint})," · ",s.status==="active"?e.jsx(y,{tone:"success",children:"Active"}):e.jsx(y,{tone:"danger",children:"Revoked"})]})}),e.jsx("div",{className:"gc-grid gc-grid--4",children:E.map(a=>{var p;const i=s.limits[a],t=((p=b.data)==null?void 0:p[a])??null,r=i===null?null:c(i);return e.jsx(P,{label:`${_[a]} spend`,value:t===null?"…":n(t),sub:r===null?"No limit":`${n(Math.max(r-(t??0),0))} left of ${n(r)}`,meter:r&&t!==null?t/r:null},a)})}),e.jsx(d,{title:"Spend, last 30 days",children:e.jsx(A,{query:f,rows:1,children:a=>e.jsx($,{format:n,label:"Daily spend",points:Q(a,o,l)})})}),e.jsx(d,{title:"Key details",children:e.jsx(I,{items:[["Requests",D(s.usage.requests)],["Spent in total",n(s.usage.spent)],["Last used",K(s.lastUsedAt)],["Expires",s.expiresAt?L(s.expiresAt):"Never"],["Top-ups",s.topupEnabled?"Allowed":"Off"],["Routing",O(s.routingPolicy)]]})}),e.jsx(d,{flush:!0,title:"Requests",children:e.jsx(F,{filter:{key:s.id},showKey:!1})})]})})]})}export{W as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ak as ke,r as m,aK as je,aL as fe,j as s,C as ne,aM as ve,Y as Se,B as S,u as le,a as Ce,i as ce,d as de,c as Pe,t as ie,P as Le,I as K,T as U,l as Ne,Q as Ae,aN as Te,z as ue,aO as X,A as me,g as ye,m as Ee,aa as Re,E as Z,aP as pe,D as De,q as F,f as C,v,ab as J,e as Ie,aQ as Me,aR as Ke,aS as Ue,aT as ee,o as Fe,X as Oe}from"./index-DPXW_JSn.js";import{u as se,a as _e,P as Ye}from"./PolicyField-ldIq_Yw-.js";import{T as Be}from"./Tabs-CCabxVNK.js";import{l as te,d as ae,L as qe}from"./limits-uCwhqY-O.js";import{t as ze}from"./dates-Pi3-Ywng.js";import{r as We,e as $e}from"./usage-DQGKL0DJ.js";import{S as he}from"./Switch-Db8Sm64J.js";import{D as Qe,u as Ve,P as He}from"./DataTable-BCgVRqY6.js";import{b as Ge}from"./Charts-BMsoEfDr.js";import{S as Xe}from"./SelectField-m1sMIgMa.js";import"./PolicyEditor-COREmE0O.js";import"./PeerPicker-CcMSXxY3.js";import"./Segmented-DYnoemT9.js";import"./roving-DkptacxO.js";import"./Disclosure-CQMtWM0M.js";function Ze({result:e,onClose:l}){var r;const o=ke(),[c,y]=m.useState("curl"),d=je((r=o.data)==null?void 0:r.publicUrl,window.location.origin),i=e?fe(d,e.secret):[],a=i.find(h=>h.id===c);return s.jsx(ne,{isOpen:e!==null,onClose:l,size:"lg",eyebrow:"API key",title:e?`${e.key.label} is ready`:"",children:e&&s.jsxs("div",{className:"gc-stack",children:[s.jsx(ve,{secret:e.secret}),s.jsxs("div",{children:[s.jsx("div",{className:"as-field__label",children:"Use it"}),s.jsxs("p",{className:"gc-muted",children:["Base URL ",s.jsxs("code",{children:[d,"/v1"]}),". Replace ",s.jsx("code",{children:"<model>"})," with a model from the Models page."]})]}),s.jsx(Be,{value:c,onChange:y,tabs:i.map(h=>({id:h.id,label:h.label}))}),a&&s.jsx(Se,{code:a.code}),s.jsx("div",{className:"gc-actions",children:s.jsx(S,{onClick:l,children:"Done"})})]})})}const Je="30d";function es({keyId:e}){const[l]=m.useState(()=>Date.now()),o=We(Je,l),c=Ie({queryKey:F.usage({key:e,from:o,groupBy:"day",spark:!0}),queryFn:()=>C.usage.report({key:e,from:o,to:l,groupBy:"day"}),staleTime:6e4});return c.data?s.jsx(Ge,{label:"Daily spend, last 30 days",format:ye,per:"a day",emptyText:"no spend",values:$e(c.data,o,l).map(y=>y.value)}):s.jsx("span",{className:"as-spark as-spark--empty","aria-hidden":"true"})}function ss(e){return e.status==="revoked"?s.jsx(v,{tone:"danger",children:"Revoked"}):e.expiresAt&&e.expiresAt<Date.now()?s.jsx(v,{tone:"warning",children:"Expired"}):e.expiresAt?s.jsxs(v,{tone:"neutral",title:`Expires ${J(e.expiresAt)}`,children:["Until ",J(e.expiresAt)]}):s.jsx(v,{tone:"success",children:"Active"})}function re({title:e,note:l,limits:o,policy:c}){return s.jsxs("div",{className:"gc-layer gc-layer--readonly",children:[s.jsxs("div",{className:"gc-inline gc-inline--between",children:[s.jsx("div",{className:"as-field__label",children:e}),s.jsx(v,{children:"Read only"})]}),s.jsx(Oe,{items:[["Spend limits",ue(o??null)],["Routing",me(c??null)]]}),s.jsx("p",{className:"gc-fineprint",children:l})]})}function oe({title:e,idPrefix:l,limits:o,onLimitsChange:c,limitsNote:y,policy:d}){return s.jsxs("div",{className:"gc-layer",children:[e&&s.jsx("div",{className:"as-field__label",children:e}),s.jsxs("div",{children:[s.jsx("div",{className:"as-field__label gc-label-row",children:"Spend limits (USD)"}),s.jsx(qe,{idPrefix:l,value:o,onChange:c}),s.jsx("p",{className:"gc-fineprint",children:y})]}),s.jsx(Ye,{draft:d.draft,setDraft:d.setDraft})]})}function ts({initial:e,layeredHint:l,onSaved:o,onCancel:c}){var W;const{workspace:y,viewer:d,me:i}=le(),a=ce(d),r=pe(e)?e:null,[h,k]=m.useState((e==null?void 0:e.label)??""),[b,P]=m.useState(te(e==null?void 0:e.limits)),[L,N]=m.useState(te(r?r.ownerLimits:e==null?void 0:e.limits)),[j,A]=m.useState(ze((e==null?void 0:e.expiresAt)??null)),[x,T]=m.useState((e==null?void 0:e.topupEnabled)??!1),[n,g]=m.useState((e==null?void 0:e.ownerMemberId)??i.member.id),w=se(e==null?void 0:e.routingPolicy),t=se(r?r.ownerRoutingPolicy:e==null?void 0:e.routingPolicy),p=Me(e,{memberId:i.member.id,workspaceAdmin:a},l),ge=Ke(y.id,a),O=((e==null?void 0:e.buyerIdentity)??((W=ge.data)==null?void 0:W.buyerIdentity))==="default",_=de(y.id,a&&!e),R=_e(),[Y,B]=m.useState(null),D=p.admin,q=e?p.owner&&(p.layered||!p.admin):!p.admin,E=e!==null&&p.layered;let z=null;E&&(z=p.admin?"Your restrictions as the key owner":"Your restrictions");const xe=e?"Save":"Create key",be=p.layered||!e?"UTC periods; weeks start Monday. Workspace, member and admin limits apply too.":"You can only tighten your key: a higher or cleared limit is ignored.",I=ie({mutationFn:async()=>{const u=j?Date.parse(`${j}T23:59:59Z`):null,$=D?w.build():null,Q=q?t.build():null,V=ae(b),H=ae(L);if(e){const f=Ue(p,e,{label:h.trim(),expiresAt:u,topupEnabled:x,adminLimits:V,adminPolicy:$,ownerLimits:H,ownerPolicy:Q}),G=await R.save([f.routingPolicy,f.ownerRoutingPolicy],we=>C.keys.update(e.id,f,we));return G===ee?ee:{key:G}}const M={label:h.trim(),workspaceId:y.id,limits:p.admin?V:H,routingPolicy:p.admin?$:Q,topupEnabled:p.admin?x:!1,expiresAt:u};return p.admin&&(M.ownerMemberId=n||null),R.save([M.routingPolicy],f=>C.keys.create(M,f))},onSuccess:o,invalidate:[F.group("keys")],toast:u=>u.secret?null:"Key saved",onError:B});return s.jsxs("form",{className:"gc-stack",onSubmit:u=>{u.preventDefault(),B(null),I.mutate()},children:[s.jsx(U,{label:"Name",required:!0,placeholder:"e.g. Production backend",value:h,onChange:u=>k(u.target.value)}),!e&&a&&_.data&&s.jsx(Xe,{label:"Owner",value:n,onChange:g,options:_.data.map(({member:u})=>({value:u.id,label:u.id===i.member.id?`${u.label} (you)`:u.label}))}),D&&s.jsx(oe,{title:E?"Workspace admin restrictions":null,idPrefix:"key-limit",limits:b,onLimitsChange:P,limitsNote:"UTC periods; weeks start Monday. The workspace and member budgets apply too.",policy:w}),!D&&E&&s.jsx(re,{title:"Set by workspace admins",limits:e.limits,policy:e.routingPolicy,note:"These always apply to this key. Your own restrictions below can only add to them."}),q&&s.jsx(oe,{title:z,idPrefix:"key-owner-limit",limits:L,onLimitsChange:N,limitsNote:be,policy:t}),E&&!p.owner&&s.jsx(re,{title:"Set by the key owner",limits:r==null?void 0:r.ownerLimits,policy:r==null?void 0:r.ownerRoutingPolicy,note:"Only the key's owner changes these. They apply on top of yours."}),s.jsx(U,{label:"Expires",type:"date",value:j,onChange:u=>A(u.target.value),hint:a?"Leave blank for no expiry.":"You can set or bring forward an expiry; only an admin can extend or remove it."}),a&&s.jsx(he,{checked:x,onChange:T,disabled:O&&!x,label:"Allow top-ups",description:O?"Keys paid from the default wallet cannot be topped up.":"Let the key holder add funds to this key with USDC (x402)."}),Y?s.jsx(Fe,{error:Y,title:"Could not save the key"}):null,s.jsxs("div",{className:"gc-actions",children:[s.jsx(S,{variant:"ghost",onClick:c,children:"Cancel"}),s.jsx(S,{type:"submit",disabled:I.isPending||!h.trim(),children:I.isPending?"Saving…":xe})]}),R.dialog]})}const as=25;function rs({list:e,search:l,showRevoked:o,ownerLabel:c,render:y}){const d=l.trim().toLowerCase(),i=m.useMemo(()=>e.filter(r=>(o||r.status==="active")&&(!d||r.label.toLowerCase().includes(d)||r.hint.toLowerCase().includes(d)||c(r).toLowerCase().includes(d))),[e,o,d,c]),a=Ve(i,as,`${d}|${o}`);return s.jsxs(s.Fragment,{children:[y(a.items,i.length===0&&e.length>0),s.jsx(He,{pager:a,noun:"keys"})]})}function os(e){return(e==null?void 0:e.kind)==="rotate"?{title:"Rotate this key?",confirmLabel:"Rotate key",tone:"primary",body:s.jsxs(s.Fragment,{children:["The current secret for ",s.jsx("strong",{children:e.key.label})," stops working now. You get a new secret to replace it."]})}:{title:"Revoke this key?",confirmLabel:"Revoke key",tone:"danger",body:s.jsxs(s.Fragment,{children:["Requests with ",s.jsx("strong",{children:e==null?void 0:e.key.label})," fail from now on. This cannot be undone."]})}}function js(){const{workspace:e,me:l,viewer:o}=le(),c=Ce(),y=ce(o),d=de(e.id,y),[i,a]=m.useState(()=>new URLSearchParams(window.location.search).get("new")==="1"?"new":null),[r,h]=m.useState(null),[k,b]=m.useState(null),[P,L]=m.useState(!1),[N,j]=m.useState(""),A=Pe(c),x=ie({mutationFn:async({kind:n,key:g})=>{n==="rotate"?h(await C.keys.rotate(g.id)):await C.keys.revoke(g.id)},onSuccess:()=>b(null),invalidate:[F.group("keys")],toast:(n,{kind:g})=>g==="revoke"?"Key revoked":null}),T=n=>{var g,w;return n.ownerMemberId?n.ownerMemberId===l.member.id?"You":((w=(g=d.data)==null?void 0:g.find(({member:t})=>t.id===n.ownerMemberId))==null?void 0:w.member.label)??"Another member":"—"};return s.jsxs("div",{className:"gc-page",children:[s.jsx(Le,{title:"API keys",description:`Keys for the ${e.name} workspace. Each key spends from this workspace's wallet.`,actions:s.jsx(S,{variant:"brand",leadingIcon:s.jsx(K.plus,{size:14}),onClick:()=>a("new"),children:"Create key"})}),s.jsxs("div",{className:"gc-toolbar",children:[s.jsx(U,{size:"sm",type:"search","aria-label":"Search keys",placeholder:"Search name, hint or owner",value:N,onChange:n=>j(n.target.value)}),s.jsx(he,{checked:P,onChange:L,label:"Show revoked"})]}),s.jsx(Ne,{flush:!0,children:s.jsx(Ae,{query:A,children:n=>s.jsx(rs,{list:n,search:N,showRevoked:P,ownerLabel:T,render:(g,w)=>s.jsx(Qe,{label:"API keys",rows:g,rowKey:t=>t.id,rowLabel:t=>t.label,onRowClick:t=>t.status==="active"&&a(t),actions:t=>t.status==="active"?[{label:"Edit",onSelect:()=>a(t)},{label:"Rotate secret",onSelect:()=>b({kind:"rotate",key:t})},{label:"Revoke",tone:"danger",onSelect:()=>b({kind:"revoke",key:t})}]:[],empty:w?s.jsx(Z,{icon:s.jsx(K.keys,{size:18}),title:"No keys match",body:"Try another search, or show revoked keys."}):s.jsx(Z,{icon:s.jsx(K.keys,{size:18}),title:"No keys yet",body:"Create a key to call models through this gateway.",action:s.jsx(S,{onClick:()=>a("new"),children:"Create key"})}),columns:[{key:"label",header:"Name",sortValue:t=>t.label,render:t=>s.jsx(Te,{name:t.label,hint:t.hint})},{key:"owner",header:"Owner",secondary:!0,render:T},{key:"limits",header:"Limits",secondary:!0,optional:!0,render:t=>s.jsx("span",{className:"gc-muted",children:ue(X(t).limits)})},{key:"policy",header:"Routing",secondary:!0,optional:!0,render:t=>s.jsx("span",{className:"gc-muted",children:me(X(t).policy)})},...y?[{key:"trend",header:"30 days",secondary:!0,render:t=>s.jsx(es,{keyId:t.id})}]:[],{key:"month",header:"This month",align:"right",sortValue:t=>Ee(t.usage.spentThisMonth),render:t=>ye(t.usage.spentThisMonth)},{key:"used",header:"Last used",secondary:!0,optional:!0,sortValue:t=>t.lastUsedAt,render:t=>Re(t.lastUsedAt)},{key:"status",header:"Status",secondary:!0,render:ss}]})})})}),s.jsx(ne,{isOpen:i!==null,onClose:()=>a(null),size:"lg",title:i==="new"?"Create API key":"Edit API key",children:i!==null&&s.jsx(ts,{initial:i==="new"?null:i,layeredHint:(A.data??[]).some(pe),onCancel:()=>a(null),onSaved:n=>{a(null),n.secret&&h({key:n.key,secret:n.secret})}})}),s.jsx(Ze,{result:r,onClose:()=>h(null)}),s.jsx(De,{isOpen:k!==null,busy:x.isPending,error:x.error,onClose:()=>{b(null),x.reset()},onConfirm:()=>k&&x.mutate(k),...os(k)})]})}export{js as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,a as q,c as M,aJ as N,b as P,j as e,P as A,B as z,I as B,f as L,T as v,l as K}from"./index-DPXW_JSn.js";import{R as _}from"./RequestLog-ChzJA1hM.js";import{f as k}from"./dates-Pi3-Ywng.js";import{p as H}from"./PeerPicker-CcMSXxY3.js";import{S as h}from"./SelectField-m1sMIgMa.js";import"./useInfiniteQuery-CAj47QRO.js";import"./usage-DQGKL0DJ.js";import"./selection-BV37SUs_.js";import"./DataTable-BCgVRqY6.js";function w(a,o=300){const[i,r]=s.useState(a);return s.useEffect(()=>{const n=window.setTimeout(()=>r(a),o);return()=>window.clearTimeout(n)},[a,o]),i}function $(){const a=q(),[o,i]=s.useState(""),[r,n]=s.useState(""),[l,g]=s.useState(""),[u,x]=s.useState(""),[b,f]=s.useState(""),[c,y]=s.useState(""),[d,S]=s.useState(""),D=M(a),E=N(a),U=P(),j=w(r.trim()),C=w(b.trim()),m=k(c,"start"),p=k(d,"end"),I=m!==void 0&&p!==void 0&&m>p,F=s.useMemo(()=>({...a,key:o||void 0,model:j||void 0,router:l||void 0,status:u||void 0,q:C||void 0,from:m,to:p}),[a.workspace,a.member,o,j,l,u,C,m,p]),R=!!(o||r||l||u||b||c||d),T=E.data??[];return e.jsxs("div",{className:"gc-page",children:[e.jsx(A,{title:"Logs",description:"Every request through this workspace's keys.",actions:e.jsx(z,{variant:"outline",size:"sm",href:L.usage.exportUrl(F),download:!0,leadingIcon:e.jsx(B.download,{size:14}),children:"Export CSV"})}),e.jsxs("div",{className:"gc-toolbar",children:[e.jsx(v,{size:"sm",type:"search","aria-label":"Search requests",placeholder:"Search model, key, end user or error",value:b,onChange:t=>f(t.target.value),className:"gc-toolbar__grow"}),e.jsx(h,{size:"sm","aria-label":"Filter by key",value:o,onChange:i,options:[{value:"",label:"All keys"},...(D.data??[]).map(t=>({value:t.id,label:t.label}))]}),e.jsx(v,{size:"sm","aria-label":"Filter by model",placeholder:"Model",value:r,onChange:t=>n(t.target.value)}),(T.length>0||l)&&e.jsx(h,{size:"sm","aria-label":"Filter by router",value:l,onChange:g,options:[{value:"",label:"Any router"},...T.map(t=>({value:t,label:H(U.data,t)}))]}),e.jsx(h,{size:"sm","aria-label":"Filter by status",value:u,onChange:x,options:[{value:"",label:"Any status"},{value:"success",label:"Succeeded"},{value:"error",label:"Failed"}]}),e.jsx(v,{size:"sm",type:"date","aria-label":"From date (UTC)",title:"From (UTC)",value:c,max:d||void 0,onChange:t=>y(t.target.value)}),e.jsx(v,{size:"sm",type:"date","aria-label":"To date (UTC)",title:"To (UTC)",value:d,min:c||void 0,onChange:t=>S(t.target.value),error:I?"Ends before it starts":void 0}),R&&e.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{i(""),n(""),g(""),x(""),f(""),y(""),S("")},children:"Clear filters"})]}),e.jsx(K,{flush:!0,children:e.jsx(_,{filter:F})})]})}export{$ as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as K,n as V,r as d,d as ce,U as G,t as N,j as e,P as de,B as f,I as q,l as H,Q,aU as _,z as me,A as ue,E as ae,C as B,D as T,f as w,G as ge,q as P,an as be,v as D,ab as se,aV as ne,aW as he,aa as J,T as I,af as X,o as ie,aM as pe,av as ve}from"./index-DPXW_JSn.js";import{u as xe,a as je,P as ye}from"./PolicyField-ldIq_Yw-.js";import{l as ke,d as fe,L as we}from"./limits-uCwhqY-O.js";import{D as Y}from"./DataTable-BCgVRqY6.js";import{S as M}from"./SelectField-m1sMIgMa.js";import"./PolicyEditor-COREmE0O.js";import"./PeerPicker-CcMSXxY3.js";import"./Segmented-DYnoemT9.js";import"./roving-DkptacxO.js";import"./Switch-Db8Sm64J.js";import"./Disclosure-CQMtWM0M.js";const z=(s,t)=>!!s&&!!t&&s.trim().toLowerCase()===t.trim().toLowerCase();function Ce(s,t,o){const n=[],m=Date.now();for(const i of t)z(i.email,s.email)?n.push(`${i.label} already uses ${i.email}.`):z(i.label,s.label)&&n.push(`A member named ${i.label} already exists${i.status==="invited"?" (invited, not joined yet)":""}.`);for(const i of o)i.expiresAt<m||(z(i.email,s.email)?n.push(`A pending invite already goes to ${i.email}.`):z(i.label,s.label)&&n.push(`A pending invite for ${i.label} already exists.`));return[...new Set(n)]}const F=[P.group("members"),P.group("workspaces"),P.group("keys")],W=[...F,P.group("invites")],te=[{value:"member",label:"Member"},{value:"admin",label:"Admin"}];function U(s){return s.status==="disabled"?e.jsx(D,{tone:"danger",children:"Disabled"}):s.status==="invited"?e.jsx(D,{tone:"warning",children:"Invited"}):e.jsx(D,{tone:"success",children:"Active"})}function le(s,t){return s==="owner"?["member","admin","owner"]:t?["member","admin"]:["member"]}function re(s){return s.map(t=>({value:t,label:_[t]}))}function Se({onCreated:s,onCancel:t}){const{me:o,viewer:n,workspace:m}=K(),i=V(n),C=o.workspaces.filter(a=>i||a.role==="admin").map(a=>a.workspace),[c,u]=d.useState(""),[g,p]=d.useState(""),[v,R]=d.useState("member"),[j,E]=d.useState("72"),[y,b]=d.useState({[m.id]:"member"}),S=G(i),L=ne(),x=Ce({label:c,email:g},S.data??[],L.data??[]),h=N({mutationFn:()=>{const a={label:c.trim(),email:g.trim()||null,orgRole:v,workspaces:Object.entries(y).filter(([,k])=>k).map(([k,O])=>({workspaceId:k,role:O})),expiresInHours:Number(j)||72};return w.invites.create(a)},onSuccess:s,invalidate:W}),l=x.length?"Create anyway":"Create invite link";return e.jsxs("form",{className:"gc-stack",onSubmit:a=>{a.preventDefault(),h.mutate()},children:[e.jsxs("div",{className:"gc-grid gc-grid--2",children:[e.jsx(I,{label:"Name",required:!0,value:c,onChange:a=>u(a.target.value)}),e.jsx(I,{label:"Email (optional)",type:"email",value:g,onChange:a=>p(a.target.value),hint:"Required when they will sign in with your identity provider."})]}),e.jsxs("div",{className:"gc-grid gc-grid--2",children:[e.jsx(M,{label:"Organization role",value:v,onChange:a=>R(a),options:re(le(o.member.orgRole,i)),hint:v==="member"?"Sees only the workspaces below.":"Can manage every workspace."}),e.jsx(M,{label:"Link expires after",value:j,onChange:E,options:[{value:"24",label:"1 day"},{value:"72",label:"3 days"},{value:"168",label:"7 days"}]})]}),e.jsxs("fieldset",{className:"gc-checks",children:[e.jsx("legend",{className:"as-field__label",children:"Workspaces"}),C.map(a=>e.jsxs("div",{className:"gc-inline gc-inline--between",children:[e.jsx("span",{children:a.name}),e.jsx(M,{"aria-label":`Role in ${a.name}`,value:y[a.id]??"",onChange:k=>b({...y,[a.id]:k}),options:[{value:"",label:"No access"},...te]})]},a.id))]}),x.length>0&&e.jsx(X,{tone:"warning",title:"Possible duplicate",children:e.jsx("ul",{className:"gc-list",children:x.map(a=>e.jsx("li",{children:a},a))})}),h.error?e.jsx(ie,{error:h.error,title:"Could not create the invite"}):null,e.jsxs("div",{className:"gc-actions",children:[e.jsx(f,{variant:"ghost",onClick:t,children:"Cancel"}),e.jsx(f,{type:"submit",disabled:h.isPending||!c.trim(),children:h.isPending?"Creating…":l})]})]})}function Ne({member:s,onDone:t}){const{me:o,viewer:n}=K(),m=V(n),[i,C]=d.useState(s.label),[c,u]=d.useState(s.email??""),[g,p]=d.useState(s.orgRole),[v,R]=d.useState(ke(s.limits)),[j,E]=d.useState(s.maxKeys===null?"":String(s.maxKeys)),y=xe(s.routingPolicy),[b,S]=d.useState(null),[L,x]=d.useState(!1),h=je(),l=N({mutationFn:async()=>{const r=j.trim()===""?null:Number(j);if(r!==null&&(!Number.isInteger(r)||r<0))throw new Error("Key limit must be a whole number.");const ee={label:i.trim(),email:c.trim()||null,limits:fe(v),maxKeys:r,routingPolicy:y.build(),...m?{orgRole:g}:{}};return h.save([ee.routingPolicy],oe=>w.members.update(s.id,ee,oe))},onSuccess:t,invalidate:F,toast:"Member saved"}),a=N({mutationFn:()=>s.status==="disabled"?w.members.enable(s.id):w.members.disable(s.id),onSuccess:()=>{x(!1),t()},invalidate:F}),k=N({mutationFn:r=>w.members.removeCredential(s.id,r),onSuccess:()=>{S(null),t()},invalidate:F}),O=s.id===o.member.id,A=s.status==="disabled",$=m&&(s.orgRole!=="owner"||o.member.orgRole==="owner"),Z=O&&s.credentials.length<=1;return e.jsxs("form",{className:"gc-stack",onSubmit:r=>{r.preventDefault(),l.mutate()},children:[e.jsxs("div",{className:"gc-grid gc-grid--2",children:[e.jsx(I,{label:"Name",value:i,onChange:r=>C(r.target.value)}),e.jsx(I,{label:"Email",type:"email",value:c,onChange:r=>u(r.target.value)})]}),e.jsxs("div",{className:"gc-grid gc-grid--2",children:[m&&e.jsx(M,{label:"Organization role",value:g,disabled:O||s.orgRole==="owner"&&o.member.orgRole!=="owner",onChange:r=>p(r),options:re(le(o.member.orgRole,!0))}),e.jsx(I,{label:"Keys they may create",inputMode:"numeric",placeholder:"No limit",value:j,onChange:r=>E(r.target.value)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"as-field__label gc-label-row",children:"Spend limits across their keys (USD)"}),e.jsx(we,{idPrefix:"member-limit",value:v,onChange:R})]}),e.jsx(ye,{draft:y.draft,setDraft:y.setDraft}),e.jsxs("div",{children:[e.jsx("div",{className:"as-field__label gc-label-row",children:"Sign-in methods"}),s.credentials.length===0?e.jsx("p",{className:"gc-muted",children:"None yet."}):e.jsx("ul",{className:"gc-list",children:s.credentials.map(r=>e.jsxs("li",{className:"gc-inline gc-inline--between",children:[e.jsxs("span",{children:[e.jsx(D,{children:r.kind})," ",r.label," ",e.jsxs("span",{className:"gc-muted",children:["· last used ",J(r.lastUsedAt)]})]}),$&&e.jsx(f,{variant:"ghost",size:"sm",disabled:Z,title:Z?"Add another sign-in method first":void 0,onClick:()=>S(r),children:"Remove"})]},r.id))})]}),!$&&e.jsx(X,{tone:"info",children:"Only an owner can change an owner's profile, status or sign-in methods."}),l.error?e.jsx(ie,{error:l.error,title:"Could not save"}):null,e.jsxs("div",{className:"gc-actions gc-actions--split",children:[$&&!O?e.jsx(f,{variant:A?"outline":"danger",size:"sm",onClick:()=>x(!0),children:A?"Enable member":"Disable member"}):e.jsx("span",{}),e.jsxs("div",{className:"gc-actions",children:[e.jsx(f,{variant:"ghost",onClick:t,children:"Cancel"}),$&&e.jsx(f,{type:"submit",disabled:l.isPending,children:l.isPending?"Saving…":"Save"})]})]}),e.jsx(T,{isOpen:L,busy:a.isPending,error:a.error,onClose:()=>x(!1),onConfirm:()=>a.mutate(),title:A?"Enable this member?":"Disable this member?",tone:A?"primary":"danger",confirmLabel:A?"Enable":"Disable",body:A?`${s.label} can sign in again. Their revoked keys stay revoked.`:`${s.label} is signed out and all of their keys are revoked.`}),e.jsx(T,{isOpen:b!==null,busy:k.isPending,error:k.error,onClose:()=>S(null),onConfirm:()=>b&&k.mutate(b.id),title:"Remove this sign-in method?",confirmLabel:"Remove",body:`${(b==null?void 0:b.label)??""} can no longer be used to sign in as ${s.label}.`}),h.dialog]})}function Re({member:s,role:t}){const{workspace:o,me:n}=K(),m=ge(),i=N({mutationFn:c=>w.workspaces.setMember(o.id,s.id,c),invalidate:s.id===n.member.id?[P.workspaceMembers(o.id),P.me]:[P.workspaceMembers(o.id)],toast:(c,u)=>`${s.label} is now a workspace ${u}`,onError:c=>m(`Could not change ${s.label}'s role: ${be(c)}`,"danger")}),C=s.orgRole!=="member";return e.jsx("div",{onClick:c=>c.stopPropagation(),children:e.jsx(M,{size:"sm","aria-label":`Workspace role for ${s.label}`,value:t,disabled:i.isPending||C,title:C?"Organization admins administer every workspace":void 0,onChange:c=>i.mutate(c),options:te})})}function Pe({onEdit:s}){const t=G();return e.jsx(H,{flush:!0,title:"Everyone in the organization",children:e.jsx(Q,{query:t,children:o=>e.jsx(Y,{label:"All members",rows:o,rowKey:n=>n.id,onRowClick:s,rowLabel:n=>n.label,actions:n=>[{label:"Edit member",onSelect:()=>s(n)}],columns:[{key:"name",header:"Name",sortValue:n=>n.label,render:n=>e.jsxs("span",{className:"gc-strong",children:[n.label,n.status!=="active"&&e.jsxs("span",{className:"gc-narrow-only",children:[" ",U(n)]})]})},{key:"email",header:"Email",secondary:!0,render:n=>n.email??"—"},{key:"role",header:"Role",render:n=>_[n.orgRole]},{key:"keys",header:"Key limit",secondary:!0,optional:!0,render:n=>n.maxKeys??"No limit"},{key:"since",header:"Joined",secondary:!0,sortValue:n=>n.createdAt,render:n=>n.status==="invited"?e.jsxs("span",{className:"gc-muted",children:["Invited ",se(n.createdAt)]}):se(n.createdAt)},{key:"status",header:"Status",secondary:!0,render:U}]})})})}function Ee(){const s=ne(),[t,o]=d.useState(null),n=N({mutationFn:m=>w.invites.revoke(m.id),onSuccess:()=>o(null),invalidate:W});return e.jsxs(H,{flush:!0,title:"Pending invites",children:[e.jsx(Q,{query:s,children:m=>e.jsx(Y,{label:"Pending invites",rows:m,rowKey:i=>i.id,rowLabel:i=>`invite for ${i.label}`,empty:e.jsx(ae,{icon:e.jsx(q.members,{size:18}),title:"No pending invites"}),actions:i=>[{label:"Revoke invite",tone:"danger",onSelect:()=>o(i)}],columns:[{key:"name",header:"Name",render:i=>e.jsx("span",{className:"gc-strong",children:i.label})},{key:"email",header:"Email",secondary:!0,render:i=>i.email??"—"},{key:"role",header:"Role",render:i=>_[i.orgRole]},{key:"expires",header:"Expires",secondary:!0,render:i=>e.jsx(he,{at:i.expiresAt,format:J})}]})}),e.jsx(T,{isOpen:t!==null,busy:n.isPending,error:n.error,onClose:()=>o(null),onConfirm:()=>t&&n.mutate(t),title:"Revoke this invite?",confirmLabel:"Revoke",body:"The link stops working."})]})}function Ae({invite:s,onClose:t}){return e.jsx(B,{isOpen:s!==null,onClose:t,title:"Invite link",size:"lg",children:s&&e.jsxs("div",{className:"gc-stack",children:[s.url?e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Send this link to ",e.jsx("strong",{children:s.label}),". It works once and expires ",J(s.expiresAt),"."]}),e.jsx(pe,{secret:s.url,note:"This link is shown only once. Anyone with it can join as this member."})]}):e.jsx(X,{tone:"warning",children:"The gateway did not return a link for this invite."}),e.jsxs("div",{className:"gc-actions",children:[s.url&&e.jsx(ve,{value:s.url,label:"Copy link",size:"md"}),e.jsx(f,{onClick:t,children:"Done"})]})]})})}function _e(){var h;const{viewer:s,workspace:t,me:o}=K(),n=V(s),[m,i]=d.useState(!1),[C,c]=d.useState(null),[u,g]=d.useState(null),[p,v]=d.useState(null),[R,j]=d.useState(""),E=ce(t.id),y=G(n),b=N({mutationFn:l=>w.workspaces.removeMember(t.id,l.id),onSuccess:()=>v(null),invalidate:W,toast:"Removed from workspace"}),S=N({mutationFn:l=>w.workspaces.setMember(t.id,l,"member"),onSuccess:()=>j(""),invalidate:W,toast:"Added to workspace"}),L=new Set((h=E.data)==null?void 0:h.map(({member:l})=>l.id)),x=(y.data??[]).filter(l=>!L.has(l.id)&&l.status==="active");return e.jsxs("div",{className:"gc-page",children:[e.jsx(de,{title:"Members",description:"Who can use this gateway, their budgets and routing.",actions:e.jsx(f,{variant:"brand",leadingIcon:e.jsx(q.plus,{size:14}),onClick:()=>i(!0),children:"Invite member"})}),e.jsx(H,{flush:!0,title:`${t.name} workspace`,actions:n&&x.length>0?e.jsxs("div",{className:"gc-inline",children:[e.jsx(M,{size:"sm","aria-label":"Add an existing member",value:R,onChange:j,options:[{value:"",label:"Add existing member…"},...x.map(l=>({value:l.id,label:l.label}))]}),e.jsx(f,{size:"sm",variant:"outline",disabled:!R||S.isPending,onClick:()=>S.mutate(R),children:"Add"})]}):void 0,children:e.jsx(Q,{query:E,children:l=>e.jsx(Y,{label:"Workspace members",rows:l,rowKey:a=>a.member.id,onRowClick:n?a=>g(a.member):void 0,rowLabel:a=>a.member.label,actions:a=>[n&&{label:"Edit member",onSelect:()=>g(a.member)},a.member.id!==o.member.id&&{label:"Remove from workspace",tone:"danger",onSelect:()=>v(a.member)}],empty:e.jsx(ae,{icon:e.jsx(q.members,{size:18}),title:"No members in this workspace"}),columns:[{key:"name",header:"Name",sortValue:a=>a.member.label,render:a=>e.jsxs("div",{children:[e.jsx("div",{className:"gc-strong",children:a.member.label}),e.jsx("div",{className:"gc-muted",children:a.member.email??_[a.member.orgRole]})]})},{key:"role",header:"Workspace role",render:a=>e.jsx(Re,{member:a.member,role:a.role})},{key:"limits",header:"Limits",secondary:!0,optional:!0,render:a=>e.jsx("span",{className:"gc-muted",children:me(a.member.limits)})},{key:"policy",header:"Routing",secondary:!0,optional:!0,render:a=>e.jsx("span",{className:"gc-muted",children:ue(a.member.routingPolicy)})},{key:"status",header:"Status",secondary:!0,render:a=>U(a.member)}]})})}),n&&e.jsx(Pe,{onEdit:g}),e.jsx(Ee,{}),e.jsx(B,{isOpen:m,onClose:()=>i(!1),size:"lg",title:"Invite a member",children:m&&e.jsx(Se,{onCancel:()=>i(!1),onCreated:l=>{i(!1),c(l)}})}),e.jsx(Ae,{invite:C,onClose:()=>c(null)}),e.jsx(B,{isOpen:u!==null,onClose:()=>g(null),size:"lg",title:(u==null?void 0:u.label)??"",eyebrow:"Member",children:u&&e.jsx(Ne,{member:u,onDone:()=>g(null)},u.id)}),e.jsx(T,{isOpen:p!==null,busy:b.isPending,error:b.error,onClose:()=>v(null),onConfirm:()=>p&&b.mutate(p),title:"Remove from workspace?",confirmLabel:"Remove",body:`${(p==null?void 0:p.label)??""} loses access to ${t.name}. Their keys in this workspace stop working.`})]})}export{_e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as v,
|
|
1
|
+
import{u as v,ak as _,r as g,al as f,am as N,n as k,j as e,af as p,P as S,I as l,l as x,T as j,Y as r,v as y}from"./index-DPXW_JSn.js";const T="https://antseed.com/docs/gateway/migrate",C="https://antseed.com/docs/tunnels",P={local:"This computer only",lan:"Your network only",public:"Public"};function o({n:s,title:a,children:t}){return e.jsxs("li",{className:"gc-migrate__step",children:[e.jsx("span",{className:"gc-migrate__num","aria-hidden":"true",children:s}),e.jsxs("div",{className:"gc-migrate__body",children:[e.jsx("h3",{className:"gc-migrate__title",children:a}),t]})]})}function d({icon:s,title:a,children:t}){return e.jsxs("div",{className:"gc-migrate__why",children:[e.jsx("span",{className:"gc-migrate__why-icon","aria-hidden":"true",children:s}),e.jsxs("div",{children:[e.jsx("div",{className:"gc-migrate__why-title",children:a}),e.jsx("p",{className:"gc-migrate__why-text",children:t})]})]})}function I({exposure:s}){return e.jsxs("div",{className:"gc-migrate__now",children:[e.jsxs("div",{className:"gc-migrate__now-head",children:[e.jsx("span",{className:"gc-muted",children:"Right now"}),e.jsx(y,{tone:s.mode==="public"?"neutral":"warning",children:P[s.mode]}),s.listenHost&&e.jsx("code",{className:"gc-migrate__addr",children:s.listenHost})]}),s.reasons.length>0&&e.jsx("ul",{className:"gc-migrate__reasons",children:s.reasons.map(a=>e.jsx("li",{children:a},a))})]})}function A(){var u;const{viewer:s}=v(),a=_(),[t,w]=g.useState(""),[h,b]=g.useState(""),m=f(t),n=N({domain:m,server:h}),i=(u=a.data)==null?void 0:u.exposure;return k(s)?e.jsxs("div",{className:"gc-page gc-migrate",children:[e.jsx(S,{title:"Move this gateway to a server",description:"Keep every key, member, workspace, wallet and its usage history. Your apps only need the new base URL."}),i&&e.jsx(I,{exposure:i}),(i==null?void 0:i.mode)==="public"&&e.jsxs(p,{tone:"info",title:"Already public",children:["This gateway has a public address (",i.publicUrl,"). You can still move it to another machine with the same steps."]}),e.jsxs("div",{className:"gc-migrate__whys",children:[e.jsx(d,{icon:e.jsx(l.activity,{size:16}),title:"Always on",children:"Keys keep working when your laptop sleeps, travels or restarts."}),e.jsx(d,{icon:e.jsx(l.shield,{size:16}),title:"HTTPS on your domain",children:"Automatic TLS at an address like https://llm.example.com, with passkeys and single sign-on."}),e.jsx(d,{icon:e.jsx(l.members,{size:16}),title:"Team access",children:"Teammates, CI and hosted tools reach it from anywhere, each with their own key and budget."})]}),e.jsxs(x,{title:e.jsxs("span",{className:"gc-inline",children:["Recommended: a small Linux server ",e.jsx(y,{tone:"neutral",children:"About 10 minutes"})]}),description:"Any VPS with a public IP works (1 vCPU, 1 GB RAM). Point a DNS name at it and open ports 80 and 443.",children:[e.jsxs("div",{className:"gc-migrate__inputs",children:[e.jsx(j,{label:"Domain for the gateway",placeholder:"llm.example.com",value:t,onChange:c=>w(c.target.value),error:t.trim()&&!m?"Enter a host name such as llm.example.com":void 0,spellCheck:!1,autoCapitalize:"off"}),e.jsx(j,{label:"Server SSH login",placeholder:"user@your-server",value:h,onChange:c=>b(c.target.value),spellCheck:!1,autoCapitalize:"off",mono:!0})]}),e.jsxs("ol",{className:"gc-migrate__steps",children:[e.jsxs(o,{n:1,title:"Export it on this computer",children:[e.jsx("p",{children:"Writes a password-protected bundle readable only by you. It holds the wallet keys, so keep the password apart from the file."}),e.jsx(r,{code:n.exportBundle,label:"This computer"})]}),e.jsx(o,{n:2,title:"Copy the bundle to the server",children:e.jsx(r,{code:n.copy,label:"This computer"})}),e.jsxs(o,{n:3,title:"Install the gateway on the server and import the bundle",children:[e.jsx("p",{children:"Installs the CLI, restores the bundle as the service user, starts the buyer and gateway with automatic HTTPS. It asks for the bundle password."}),e.jsx(r,{code:n.install,label:"Server"})]}),e.jsxs(o,{n:4,title:"Point your apps at the new address",children:[e.jsx("p",{children:"API keys stay the same. Only the base URL changes:"}),e.jsx(r,{code:n.baseUrl,label:"New base URL"})]}),e.jsxs(o,{n:5,title:"Stop the gateway on this computer",children:[e.jsxs("p",{children:["Press Ctrl+C where ",e.jsx("code",{children:"antseed gateway start"})," runs, which also stops the buyer it started (stop a buyer you run yourself too, or quit the desktop app's gateway), then delete the bundle on both machines. Never run both gateways: two buyers paying from the same wallet conflict."]}),e.jsx(r,{code:n.stop,label:"Both machines"})]})]}),e.jsxs("div",{className:"gc-migrate__note",children:[e.jsx("strong",{children:"Signing in afterwards."})," Everyone signs in again on the new address. Wallet and single sign-on keep working; passkeys are tied to the domain they were made on, so add a new one with a one-time link from the server:",e.jsx(r,{code:n.recover,label:"Server"})]}),e.jsxs("p",{className:"gc-fineprint",children:[e.jsx(l.shield,{size:12})," Wallet keys never pass through this browser: the console only shows commands. ",e.jsx("a",{className:"gc-link",href:T,target:"_blank",rel:"noreferrer",children:"Full guide"})]})]}),e.jsx(x,{title:"Alternative: keep it here behind a Cloudflare tunnel",description:"Gives this computer a public HTTPS address without moving anything.",children:e.jsxs("div",{className:"gc-stack",children:[e.jsx(r,{code:n.tunnel,label:"This computer, instead of gateway start"}),e.jsxs("ul",{className:"gc-migrate__caveats",children:[e.jsx("li",{children:"Keys still stop working whenever this computer sleeps, loses its connection or restarts."}),e.jsxs("li",{children:["Needs a Cloudflare account and a named tunnel whose public hostname points at ",e.jsx("code",{children:"http://localhost:8379"}),"."]}),e.jsx("li",{children:"Traffic and model responses run through your home or office connection."})]}),e.jsxs("a",{className:"gc-link",href:C,target:"_blank",rel:"noreferrer",children:["Tunnel guide ",e.jsx(l.external,{size:12})]})]})})]}):e.jsx(p,{tone:"warning",title:"Not available",children:"Only organization owners and admins can move the gateway."})}export{A as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aZ as M,r as y,j as e,a_ as A,Y as w,a$ as B,O as T,b0 as P,b1 as F,M as m,av as v,v as p,X as E,b2 as I,B as R,ad as _,ae as $,b3 as O,w as C,k as U}from"./index-DPXW_JSn.js";import{M as f,C as Y,P as S,a as D,p as V}from"./SidePanel-BFQArkoa.js";import{T as z,a as K}from"./Tabs-CCabxVNK.js";import{S as q}from"./stored-e0tX90bC.js";import{T as k,V as G}from"./VerificationLinks-CWyl6ZEp.js";import{S as X}from"./SelectField-m1sMIgMa.js";function Z({model:s,format:o,id:h="gc-api-call",unsupported:n}){const x=M(),[j,t]=y.useState("curl");if(!o)return e.jsx("p",{className:"gc-fineprint",children:n??"The gateway does not serve this model through its API."});const d=A(x,s,o),i=d.find(r=>r.id===j)??d[0];return e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsx(z,{id:h,label:"Request examples",value:i.id,onChange:t,className:"gc-connect-tabs",tabs:d.map(r=>({id:r.id,label:r.label}))}),e.jsx(K,{tabsId:h,tab:i.id,children:e.jsx(w,{code:i.code,label:i.label})}),e.jsxs("p",{className:"gc-fineprint",children:["Set ",e.jsx("code",{children:B})," to one of your API keys first. ",e.jsx(T,{to:"keys",children:"API keys"})]})]})}function H(s){return s===null?"—":String(Math.round(s))}function J(s){return s===null?"—":U(s)}function Q(s){return s.fullTeeSellers>0?"end-to-end":s.offers.some(o=>o.teeScope==="seller-node")?"seller-node":null}function g(s){return s.displayName??C(s.peerId,8,4)}function c(s){return`${s.peerId}:${s.serviceId}`}function ie({model:s,preview:o,previewLoading:h,pin:n}){const[x,j]=y.useState(""),t=n?s.offers.find(a=>a.peerId.toLowerCase()===n.peerId)??null:s.offers.find(a=>c(a)===x)??null,d=t?c(t):"",i=a=>{if(!n)return j(a);const u=s.offers.find(l=>c(l)===a);n.onChange(u?u.peerId.toLowerCase():null)},r=t?P(t.peerId,t.serviceId):s.id,N=F(s.type,t),L=s.offers.some(a=>a.usdPerImage!==null);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsxs("span",{className:"gc-seller__meta",children:[e.jsxs("span",{className:"gc-peer-id",children:[e.jsx(m,{title:s.id,children:s.id}),e.jsx(v,{iconOnly:!0,value:s.id,label:"Copy model id"})]}),e.jsx(p,{children:f[s.type]}),s.free&&e.jsx(p,{tone:"success",children:"Free"}),e.jsx(k,{tee:s.teeSellers>0,scope:Q(s)})]}),e.jsx(E,{items:[["Context",J(s.contextLength)],["Capabilities",s.capabilities.length?e.jsx("span",{className:"gc-badges",children:s.capabilities.map(a=>e.jsx(p,{children:Y[a]},a))}):"—"],["Tags",s.tags.length?e.jsx("span",{className:"gc-badges",children:s.tags.map(a=>e.jsx(p,{children:a},a))}):"—"],["Aliases",s.aliases.length?e.jsx(m,{children:s.aliases.join(", ")}):"—"],...L?[]:[["Input $/M",I(s.inputUsdPerMillion)],["Output $/M",I(s.outputUsdPerMillion)]]]})]}),e.jsx(q,{preview:o,loading:h,pin:n}),e.jsx(S,{title:`Providers (${s.offers.length})`,children:s.offers.length===0?e.jsx("p",{className:"gc-fineprint",children:"No provider offers this model right now."}):e.jsx("ul",{className:"gc-panel-rows","aria-label":"Providers offering this model",children:s.offers.map(a=>{var b;const u=P(a.peerId,a.serviceId),l=d===c(a);return e.jsx(D,{selected:l,title:e.jsx(T,{to:O("providers",a.peerId),children:g(a)}),meta:e.jsxs(e.Fragment,{children:[e.jsx("span",{children:V(a)}),e.jsxs("span",{children:["Trust ",H(a.trustScore)]}),a.firstTokenMsP50!==null&&e.jsxs("span",{children:[_(a.firstTokenMsP50)," first token"]}),a.tokensPerSecondP50!==null&&e.jsx("span",{children:$(a.tokensPerSecondP50)}),a.serviceId!==s.id&&e.jsx(m,{children:a.serviceId})]}),badges:(((b=a.verificationLinks)==null?void 0:b.length)||a.tee||a.free)&&e.jsxs("div",{className:"gc-badges",children:[e.jsx(G,{links:a.verificationLinks}),e.jsx(k,{tee:a.tee,scope:a.teeScope}),a.free&&e.jsx(p,{tone:"success",children:"Free"})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(v,{iconOnly:!0,value:u,label:`Copy ${g(a)}'s model id (peer@model)`}),e.jsx(R,{size:"sm",variant:l?"outline":"ghost","aria-pressed":l,title:n?"Send this chat to this provider":"Use this provider in the API call below",onClick:()=>i(l?"":c(a)),children:l?"Pinned":"Pin"})]})},c(a))})})}),e.jsxs(S,{title:"API call",actions:s.offers.length>0&&e.jsx(X,{size:"sm","aria-label":"Route the call",value:d,onChange:i,options:[{value:"",label:"Best provider (automatic)"},...s.offers.map(a=>({value:c(a),label:g(a)}))]}),children:[e.jsx("p",{className:"gc-fineprint",children:t?e.jsxs(e.Fragment,{children:["Pinned to ",g(t)," with ",e.jsx("code",{children:C(r,10,12)}),"."]}):e.jsxs(e.Fragment,{children:["The gateway picks the best provider for ",e.jsx("code",{children:s.id})," under your routing policy."]})}),e.jsx(Z,{id:"gc-model-call",model:r,format:N,unsupported:`${f[s.type]} models are not served through the gateway's /v1 API.`})]})]})}export{Z as A,ie as M,J as c,Q as m,H as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as s,aj as ce,I as k,R as de,br as ue,bc as me,bs as pe,bd as he,bt as ge,r as b,bu as fe,L as xe,E as z,l as O,Q as je,B as V,P as ke,T as ve,y as U,bv as ye,M as j,h as be,g as W,b2 as D,b3 as J,w as X,av as we,v as f,X as Y,O as Se,Y as Le,u as Ce,e as Ne,q as Pe,ah as Me,f as Te}from"./index-DPXW_JSn.js";import{c as Fe,s as Ee,A as Ie,M as Ae,m as Be}from"./ModelDetails-Sgq3MjfG.js";import{V as _e,T as Re}from"./VerificationLinks-CWyl6ZEp.js";import{M as $e,f as qe,S as ze,P as M}from"./SidePanel-BFQArkoa.js";import{s as Oe,l as Ve}from"./stored-e0tX90bC.js";import{r as Ue,B as Z}from"./BrandIcon-6gq42Dg-.js";import{D as De}from"./DataTable-BCgVRqY6.js";import"./Tabs-CCabxVNK.js";import"./roving-DkptacxO.js";import"./SelectField-m1sMIgMa.js";import"./selection-BV37SUs_.js";import"./Disclosure-CQMtWM0M.js";const Ye={anthropic:"Anthropic",openai:"OpenAI",codex:"OpenAI",gemini:"Google",kimi:"Moonshot",glm:"Z.ai",deepseek:"DeepSeek",qwen:"Qwen",grok:"xAI",mistral:"Mistral",minimax:"MiniMax",llama:"Meta"};function K(e){return Ye[Ue(e.provider,e.label)]??null}function Q({label:e,values:t,options:i,onChange:c,width:d=240}){const n=new Set(t),o=l=>c(n.has(l)?t.filter(h=>h!==l):[...t,l]);return s.jsx(ce,{label:`Filter by ${e.toLowerCase()}`,multiple:!0,align:"start",width:d,triggerStyle:"plain",className:"as-button as-button--outline as-button--sm gc-filter-menu",trigger:s.jsxs(s.Fragment,{children:[s.jsx("span",{children:e}),t.length>0&&s.jsx("span",{className:"gc-filter-menu__count",children:t.length}),s.jsx(k.down,{size:14})]}),items:[...i.map(l=>({label:l.label,checked:n.has(l.value),...l.icon?{icon:l.icon}:{},...l.section?{section:l.section}:{},onSelect:()=>o(l.value)})),t.length>0&&{label:"Clear",section:" ",onSelect:()=>c([])}]})}const F={search:"",types:[],tags:[],families:[],free:!1,tee:!1},E={...$e,router:"Router"},Ke=["text","image","video","decision","router"];function Qe(e,t){return[...e.map(i=>({kind:"model",key:i.id,model:i})),...t.map(i=>({kind:"router",key:i.id,router:i}))]}function S(e){return e.kind==="router"?"router":e.model.type}function w(e){return e.kind==="router"?e.router.name:e.model.name}function ee(e){return e.kind==="router"?[]:e.model.tags}function Ge(e){return e.kind==="router"?e.router.free:e.model.free}function He(e){return e.kind==="model"&&e.model.teeSellers>0}function I(e){var t;return e.kind==="router"?null:{provider:((t=e.model.offers[0])==null?void 0:t.provider)??"",label:`${e.model.name} ${e.model.id}`}}function We(e){if(e.kind==="router"){const{router:i}=e;return[i.name,i.id,i.serviceId,i.provider,i.sellerName??"",i.protocol,"router routing"].join(" ").toLowerCase()}const{model:t}=e;return[t.id,t.name,...t.aliases,...t.tags,...t.offers.map(i=>i.provider),E[t.type]].join(" ").toLowerCase()}function Je(e,t){const i=new Set(e.map(S)),c=new Set(e.flatMap(ee)),d=new Set(e.flatMap(n=>{const o=I(n),l=o?t(o):null;return l?[l]:[]}));return{types:Ke.filter(n=>i.has(n)),tags:[...c].sort((n,o)=>n.localeCompare(o)),families:[...d].sort((n,o)=>n.localeCompare(o))}}function Xe(e,t,i){const c=t.search.trim().toLowerCase(),d=new Set(t.types),n=new Set(t.families);return e.filter(o=>{if(d.size>0&&!d.has(S(o))||t.free&&!Ge(o)||t.tee&&!He(o))return!1;if(t.tags.length>0){const l=new Set(ee(o));if(!t.tags.every(h=>l.has(h)))return!1}if(n.size>0){const l=I(o),h=l?i(l):null;if(!h||!n.has(h))return!1}return!c||We(o).includes(c)})}function Ze(e){return!!(e.search.trim()||e.types.length||e.tags.length||e.families.length||e.free||e.tee)}function es(e,t){return t.flatMap(i=>{const c=i.toLowerCase(),d=e.find(n=>n.key.toLowerCase()===c)??e.find(n=>n.kind==="model"&&n.model.aliases.some(o=>o.toLowerCase()===c));return d?[d]:[]})}function G(e){return e.kind==="router"?1:e.model.sellers}function ss(e){var t;return e.kind==="router"?e.router.priceUsdPerRequest:((t=e.model.inputUsdPerMillion)==null?void 0:t.min)??null}const se="antseed-console-models:filter",T="Favorites";function te(e){return e.sellerName??X(e.peerId,8,4)}function ts(e){return e.priceUsdPerRequest===null?"No price advertised":e.free?"Free":`${W(e.priceUsdPerRequest)} per ranking`}function as(){const e=Ve(se,{});return{...F,...e,search:""}}function is({entry:e}){const t=I(e);return s.jsx("span",{className:"gc-model-name__mark","aria-hidden":"true",children:t?s.jsx(Z,{name:t.provider,hints:[t.label],size:18}):s.jsx(k.routing,{size:16})})}function ns({entry:e}){if(e.kind==="router")return s.jsxs("div",{className:"gc-badges",children:[s.jsx(f,{children:"Router"}),e.router.free&&s.jsx(f,{tone:"success",children:"Free"})]});const{model:t}=e;return s.jsxs("div",{className:"gc-badges",children:[t.free&&s.jsx(f,{tone:"success",children:"Free"}),s.jsx(Re,{tee:t.teeSellers>0,scope:Be(t)}),t.tags.slice(0,3).map(i=>s.jsx(f,{children:i},i))]})}function H({id:e,name:t,starred:i,onToggle:c}){return s.jsx(Me,{size:"sm",className:"gc-star",label:i?`Unstar ${t}`:`Star ${t}`,"aria-pressed":i,onClick:d=>{d.stopPropagation(),c(e,!i)},children:i?s.jsx(k.starFilled,{size:15}):s.jsx(k.star,{size:15})})}function ys(){const e=de(),t=ue(e.rest),i=me(),c=pe(),d=he(),n=ge(),[o,l]=b.useState(as),h=fe();b.useEffect(()=>{Oe(se,{...o,search:""})},[o]);const A=(r,g)=>l(p=>({...p,[r]:g})),x=b.useMemo(()=>Qe(i.data??[],c.data??[]),[i.data,c.data]),L=b.useMemo(()=>Je(x,K),[x]),B=b.useMemo(()=>new Set((d.data??[]).map(r=>r.toLowerCase())),[d.data]),C=r=>B.has(r.key.toLowerCase()),N=(r,g)=>n.mutate({id:r,favorite:g}),u=t?(c.data??[]).find(r=>r.id.toLowerCase()===t.toLowerCase())??null:null,m=t&&!u?qe(i.data,t):null,v=(u==null?void 0:u.id)??(m==null?void 0:m.id)??null,ae=t===null?null:{eyebrow:u?"Router":"Model",title:(u==null?void 0:u.name)??(m==null?void 0:m.name)??t,actions:v?s.jsx(H,{id:v,name:(u==null?void 0:u.name)??(m==null?void 0:m.name)??v,starred:B.has(v.toLowerCase()),onToggle:N}):void 0,body:i.isLoading||c.isLoading?s.jsx(xe,{rows:6}):u?s.jsx(ls,{router:u},u.id):m?s.jsx(rs,{model:m},m.id):s.jsx(z,{icon:s.jsx(k.models,{size:18}),title:"Model not found",body:`No provider on the network offers ${t} right now.`})},P=Ze(o),_=Xe(x,o,K),y=P?[]:es(x,d.data??[]),ie=y.length?_.filter(r=>!y.includes(r)):_,ne=[...L.types.map(r=>({value:`type:${r}`,label:E[r],section:"Type"})),{value:"free",label:"Free",section:"Price and privacy"},{value:"tee",label:"TEE",section:"Price and privacy"},...L.tags.map(r=>({value:`tag:${r}`,label:r,section:"Tags"}))],re=[...o.types.map(r=>`type:${r}`),...o.free?["free"]:[],...o.tee?["tee"]:[],...o.tags.map(r=>`tag:${r}`)],oe=r=>l(g=>({...g,types:r.filter(p=>p.startsWith("type:")).map(p=>p.slice(5)),tags:r.filter(p=>p.startsWith("tag:")).map(p=>p.slice(4)),free:r.includes("free"),tee:r.includes("tee")})),R=L.families.map(r=>({value:r,label:r,icon:s.jsx(Z,{name:r,hints:[r],size:16})})),$=(r,g,p)=>s.jsx(De,{label:r,rows:g,rowKey:a=>a.key,selectedKey:v,onRowClick:a=>U(J("models",a.key)),rowLabel:w,actions:a=>[{label:a.kind==="router"?"Copy router model id":"Copy model id",onSelect:()=>void h(a.key)},{label:C(a)?"Unstar":"Star",onSelect:()=>N(a.key,!C(a))}],initialSort:r===T?void 0:{key:"sellers",direction:"desc"},empty:p,columns:[{key:"model",header:"Model",sortValue:a=>w(a).toLowerCase(),render:a=>s.jsxs("div",{className:"gc-model-name",children:[s.jsx(is,{entry:a}),s.jsxs("div",{className:"gc-cell-lines",children:[s.jsx("div",{className:"gc-strong gc-ellipsis",title:a.key,children:w(a)}),a.kind==="router"?s.jsxs("div",{className:"gc-muted gc-ellipsis",children:["by ",te(a.router)," · ",s.jsx(j,{children:a.router.serviceId})]}):a.model.name!==a.model.id&&s.jsx("div",{className:"gc-muted gc-ellipsis",children:s.jsx(j,{children:a.model.id})}),s.jsx(ns,{entry:a})]})]}),after:a=>s.jsxs(s.Fragment,{children:[s.jsx(H,{id:a.key,name:w(a),starred:C(a),onToggle:N}),s.jsx(ye,{value:a.key,label:`Copy model id ${a.key}`})]})},{key:"type",header:"Type",secondary:!0,sortValue:S,render:a=>s.jsx("span",{className:"gc-muted",children:E[S(a)]})},{key:"sellers",header:"Providers",align:"right",sortValue:G,render:a=>be(G(a))},{key:"input",header:"Input $/M",align:"right",sortValue:ss,render:a=>a.kind==="router"?s.jsx("span",{className:"gc-muted",children:a.router.free?"Free":a.router.priceUsdPerRequest===null?"—":`${W(a.router.priceUsdPerRequest)}/ranking`}):D(a.model.inputUsdPerMillion)},{key:"output",header:"Output $/M",align:"right",secondary:!0,sortValue:a=>{var q;return a.kind==="model"?((q=a.model.outputUsdPerMillion)==null?void 0:q.min)??null:null},render:a=>a.kind==="model"?D(a.model.outputUsdPerMillion):"—"},{key:"context",header:"Context",align:"right",secondary:!0,optional:!0,sortValue:a=>a.kind==="model"?a.model.contextLength:null,render:a=>a.kind==="model"?Fe(a.model.contextLength):"—"}]}),le=s.jsxs("div",{className:"gc-stack",children:[y.length>0&&s.jsx(O,{flush:!0,title:T,children:$(T,y,null)}),s.jsx(O,{flush:!0,title:y.length>0?"All models":void 0,children:s.jsx(je,{query:i,rows:8,children:()=>$("Models",ie,s.jsx(z,{icon:s.jsx(k.models,{size:18}),title:x.length?"No models match these filters":"No models found yet",body:x.length?void 0:"The buyer is still discovering the network. Check back in a minute.",action:P?s.jsx(V,{variant:"outline",size:"sm",onClick:()=>l(F),children:"Clear filters"}):void 0}))})})]});return s.jsxs("div",{className:"gc-page",children:[s.jsx(ke,{title:"Models",description:"Every model and router on the network. Star the ones you use; open one to see its providers, copy its id and get a ready-to-run API call."}),s.jsxs("div",{className:"gc-toolbar",children:[s.jsx(ve,{size:"sm",type:"search","aria-label":"Search models or routers",placeholder:"Search models or routers",value:o.search,onChange:r=>A("search",r.target.value)}),s.jsx(Q,{label:"Type",values:re,options:ne,onChange:oe}),R.length>0&&s.jsx(Q,{label:"Family",values:o.families,options:R,onChange:r=>A("families",r)}),P&&s.jsx(V,{variant:"ghost",size:"sm",onClick:()=>l(F),children:"Clear filters"})]}),s.jsx(ze,{list:le,panel:ae,onClose:()=>U("models"),closeLabel:"Close model"})]})}function rs({model:e}){const{workspace:t}=Ce(),i=Ne({queryKey:Pe.routePreview({model:e.id,workspace:t.id}),queryFn:()=>Te.network.routePreview({model:e.id,workspace:t.id}),staleTime:3e4});return s.jsx(Ae,{model:e,preview:i.data,previewLoading:i.isLoading})}function os(e){return e.default===void 0?"—":String(e.default)}function ls({router:e}){var d;const t=((d=e.models)==null?void 0:d.includes("*"))??!1,i=(e.models??[]).filter(n=>n!=="*"),c=e.options.some(n=>n.key==="cost_quality_tradeoff")?JSON.stringify({model:e.id,routing:{cost_quality_tradeoff:3},messages:[{role:"user",content:"Hello"}]},null,2):null;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"gc-stack gc-stack--tight",children:[s.jsxs("span",{className:"gc-seller__meta",children:[s.jsxs("span",{className:"gc-peer-id",children:[s.jsx(j,{title:e.id,children:X(e.id,10,16)}),s.jsx(we,{iconOnly:!0,value:e.id,label:"Copy router model id"})]}),s.jsx(f,{children:"Router"}),e.free&&s.jsx(f,{tone:"success",children:"Free"})]}),s.jsxs("p",{className:"gc-fineprint",children:["Send ",s.jsx("code",{children:e.id})," as the model: the router ranks the models your key's routing policy allows and the gateway sends the request to its pick, falling back to the next one if a seller refuses. Logs show the router and the model it picked."]}),s.jsx(Y,{items:[["Offered by",s.jsx(Se,{to:J("providers",e.peerId),children:te(e)},"s")],["Service",s.jsx(j,{children:e.serviceId},"v")],["Protocol",s.jsx(j,{children:e.protocol||"—"},"p")],["Price",ts(e)],["Trust",Ee(e.trustScore)],...e.verificationLinks.length?[["Verified",s.jsx(_e,{links:e.verificationLinks},"l")]]:[]]})]}),e.options.length>0&&s.jsxs(M,{title:"Settings",children:[s.jsx(Y,{items:e.options.map(n=>[n.label,s.jsxs("div",{className:"gc-stack gc-stack--tight",children:[s.jsxs("span",{children:[s.jsx(j,{children:n.key})," · default ",os(n),"minimum"in n&&n.minimum!==void 0&&"maximum"in n&&n.maximum!==void 0?` · ${n.minimum}–${n.maximum}`:""]}),n.description&&s.jsx("span",{className:"gc-muted",children:n.description})]},n.key)])}),c&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"gc-fineprint",children:["Set them per request in a ",s.jsx("code",{children:"routing"})," object; they never reach the seller."]}),s.jsx(Le,{code:c,label:"Request body"})]})]}),s.jsx(M,{title:"Models it ranks",children:e.models===null?s.jsx("p",{className:"gc-fineprint",children:"This router did not list its models."}):t?s.jsx("p",{className:"gc-fineprint",children:"Any model: it ranks every model your key allows."}):i.length===0?s.jsx("p",{className:"gc-fineprint",children:"None listed."}):s.jsx("span",{className:"gc-badges",children:i.map(n=>s.jsx(f,{children:n},n))})}),s.jsx(M,{title:"API call",children:s.jsx(Ie,{id:"gc-router-call",model:e.id,format:"openai-chat-completions"})})]})}export{ys as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,u as te,F as ae,r as
|
|
1
|
+
import{j as e,u as te,F as ae,r as C,aq as q,af as I,ay as ne,az as re,w,Z as se,aA as y,B as N,aB as ie,aC as p,T as oe,D as le,aw as M,aD as ce,ao as de,aE as he,q as ue,aF as we,aG as fe,an as Y,aH as H,aI as R,$ as _}from"./index-DPXW_JSn.js";import{u as Z,a as G,T as K,D as k,s as V}from"./useTx-DzRlz7Ez.js";import{a as ge,C as J}from"./ConnectWallet-BYdqZipy.js";import{W as me,u as U,c as F,b as ye,r as Q}from"./en_US-Y4ZOVFV4-Bkc-z49M.js";import"./writeContract-CaMlmKcK.js";import"./sendTransaction-k8aDYfd4.js";import"./clsx-B-dksMZM.js";import"./index-BhwNCc8y.js";async function X(s,i,a){let c=await R.sync(s,i);for(let d=0;d<3&&!y(c.operator??p,a??p);d+=1)await new Promise(n=>setTimeout(n,3500)),c=await R.sync(s,i);return c}function ee(s){const i=F(),a=q(s,"deposits");return async c=>{if(!a)throw new M("The gateway did not report the deposits contract address.",!1);const[d,n]=await Promise.all([Q(i,{address:a,abi:k,functionName:"getOperator",args:[c],chainId:s.chainId}),Q(i,{address:a,abi:k,functionName:"getOperatorNonce",args:[c],chainId:s.chainId})]);return{operator:y(d,p)?null:d,nonce:n}}}function pe({workspaceId:s,state:i,chain:a,onChanged:c,onStale:d}){const{address:n}=U(),W=F(),o=Z(a.chainId),{writeContractAsync:B}=G(),{signMessageAsync:D}=ye(),{me:z}=te(),E=ae(),v=ee(a),[x,h]=C.useState(!1),[f,b]=C.useState(!1),[g,u]=C.useState(null),m=q(a,"deposits");if(!m)return e.jsx(I,{tone:"warning",children:"The gateway did not report the deposits contract address."});if(!n)return e.jsx(J,{label:"Connect the wallet to authorize"});const j=ne(i,n);async function A(r){try{const t=await R.authorize(s,r);return h(!1),t}catch(t){return _(t,"reauth_required")?(h("any"),o.setError(null),null):_(t,"reauth_other_credential")?(h("other"),o.setError(null),null):(_(t,"operator_already_set")&&d(),o.setError(Y(t)),null)}}async function S(r){u(r);let t=await A(r);if(!t)return;const O={depositsContract:m,chainId:a.chainId,operator:r},L=await o.run([{label:"Authorize wallet",check:async()=>{try{H(t,await v(t.buyer),O)}catch($){if(!($ instanceof M)||!$.retryAuth)throw $;o.setStatus("The operator nonce changed; getting a fresh authorization…");const P=await R.authorize(s,r);H(P,await v(P.buyer),O),t=P}await V(W,{account:n,address:m,abi:k,functionName:"setOperator",args:[t.buyer,r,BigInt(t.nonce),t.signature],chainId:a.chainId})},send:()=>B({address:m,abi:k,functionName:"setOperator",args:[t.buyer,r,BigInt(t.nonce),t.signature],chainId:a.chainId})}],{onStale:d});L&&c(await X(s,L,r))}async function l(r){b(!0),o.setError(null);try{const t=r==="passkey"?await ce():await de(n,O=>D({message:O}));if(he(t,z.member.id),E.setQueryData(ue.me,t),h(!1),g&&n&&!y(g,n)){o.setError(`Confirmed. Switch back to ${w(g)}, then authorize it.`);return}await S(g??n)}catch(t){o.setError(fe(t)?we:Y(t))}finally{b(!1)}}const T=re(i);return e.jsxs("div",{className:"gc-stack",children:[e.jsxs("p",{children:["Authorize ",e.jsx("code",{children:w(n)})," to withdraw this workspace's funds and claim its ANTS rewards. It will be the only wallet able to transfer or remove the role later."]}),T.length>0&&e.jsx("ul",{className:"gc-fineprint",children:T.map(r=>e.jsxs("li",{children:[e.jsx("code",{children:w(r.address)})," ",r.ready?"can be authorized":`can be authorized from ${se(r.eligibleAt)}`,y(r.address,n)?" (connected)":""]},r.address))}),j&&e.jsx(I,{tone:"warning",children:j}),x&&e.jsx(I,{tone:"info",title:"Confirm it is you",children:e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsx("span",{children:x==="other"?`Confirm with a different sign-in method than ${w(g??n)}, the wallet you are authorizing: a passkey, or another of your wallets (connect it, confirm, then switch back).`:"Authorizing a withdrawal wallet needs a fresh sign-in."}),e.jsxs("div",{className:"gc-inline gc-inline--wrap",children:[e.jsx(N,{size:"sm",disabled:f,onClick:()=>void l("passkey"),children:"Confirm with a passkey"}),e.jsx(N,{size:"sm",variant:"outline",disabled:f,onClick:()=>void l("wallet"),children:f?"Check your wallet…":`Confirm with ${w(n)}`})]})]})}),e.jsx(K,{chain:a,runner:o,done:"Wallet authorized."}),e.jsx(N,{fullWidth:!0,disabled:o.running||f||!!j,onClick:()=>void S(n),children:o.running?"Working…":"Authorize this wallet"}),e.jsxs("p",{className:"gc-fineprint",children:["You will sign in again, then confirm one transaction from this wallet (it pays the network fee in ETH on ",a.name,")."]})]})}function xe({workspaceId:s,state:i,chain:a,onChanged:c,onStale:d}){const{address:n}=U(),W=F(),o=Z(a.chainId),{writeContractAsync:B}=G(),D=ee(a),[z,E]=C.useState(""),[v,x]=C.useState(!1),[h,f]=C.useState(null),b=q(a,"deposits"),g=ie(i,n);if(!b)return e.jsx(I,{tone:"warning",children:"The gateway did not report the deposits contract address."});if(!n)return e.jsx(J,{label:`Connect ${w(i.operator)} to manage it`});if(!g.canManage)return e.jsx(I,{tone:"warning",children:g.manageHint??"Only the authorized wallet can transfer or remove the role."});const u=z.trim(),m=/^0x[0-9a-fA-F]{40}$/.test(u)&&!y(u,p),j=i.eligibleWallets.some(l=>y(l.address,u)),A=y(u,i.buyer);async function S(l){f(null);const T=await o.run([{label:l===p?"Remove authorized wallet":"Transfer authorization",check:async()=>{const r=await D(i.buyer);if(!y(r.operator,n))throw new M(`The authorized wallet is now ${r.operator?w(r.operator):"not set"}, not the connected wallet. The panel now shows it.`,!0);await V(W,{account:n,address:b,abi:k,functionName:"transferOperator",args:[i.buyer,l],chainId:a.chainId})},send:()=>B({address:b,abi:k,functionName:"transferOperator",args:[i.buyer,l],chainId:a.chainId})}],{onStale:d});T&&(E(""),x(!1),c(await X(s,T,l===p?null:l)))}return e.jsxs("div",{className:"gc-stack",children:[e.jsx("p",{children:"The connected wallet is the authorized wallet. You can hand the role to another wallet or remove it. Both are immediate and only the new wallet (or, after removal, the organization owner through the gateway) can change it again."}),e.jsx(oe,{label:"New authorized wallet",placeholder:"0x…",value:z,onChange:l=>{E(l.target.value),x(!1)},error:z&&!m?"Enter a 0x wallet address.":A?"That is the workspace wallet itself; the gateway CLI handles that case.":void 0}),m&&!A&&!j&&e.jsxs("label",{className:"gc-inline",children:[e.jsx("input",{type:"checkbox",checked:v,onChange:l=>x(l.target.checked)}),e.jsxs("span",{children:[w(u)," is not one of your sign-in wallets. I control it, or trust whoever does with this workspace's withdrawals and rewards."]})]}),e.jsx(K,{chain:a,runner:o,done:"Authorized wallet updated."}),e.jsxs("div",{className:"gc-inline gc-inline--wrap",children:[e.jsx(N,{disabled:o.running||!m||A||!j&&!v,onClick:()=>f("transfer"),children:"Transfer authorization"}),e.jsx(N,{variant:"outline",disabled:o.running,onClick:()=>f("clear"),children:"Remove authorized wallet"})]}),e.jsx(le,{isOpen:h!==null,onClose:()=>f(null),tone:"danger",title:h==="clear"?"Remove the authorized wallet?":`Transfer to ${w(u)}?`,confirmLabel:h==="clear"?"Remove":"Transfer",body:h==="clear"?"Nobody will be able to withdraw or claim rewards until the organization owner authorizes a wallet again through the gateway. Requests keep working.":`${w(u)} will receive all future withdrawals and ANTS rewards, and only it can change this again. Your connected wallet loses the role.`,onConfirm:()=>void S(h==="clear"?p:u)})]})}function Ie(s){return e.jsx(me,{chain:s.chain,children:e.jsxs("div",{className:"gc-stack",children:[e.jsx(ge,{}),s.mode==="authorize"?e.jsx(pe,{...s}):e.jsx(xe,{...s})]})})}export{Ie as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as o,
|
|
1
|
+
import{j as o,af as l,w as n,B as i,y as s}from"./index-DPXW_JSn.js";import{C as c}from"./ConnectWallet-BYdqZipy.js";function p({gate:r,state:t,connected:e,onAuthorize:a}){return o.jsxs("div",{className:"gc-stack",children:[o.jsx(l,{tone:r.operator?"warning":"info",title:r.operator?"Use the authorized wallet":"No authorized wallet",children:r.reason}),r.operator&&!e&&o.jsx(c,{label:`Connect ${n(r.operator)}`}),!r.operator&&(t==null?void 0:t.canAuthorize)&&o.jsx(i,{fullWidth:!0,onClick:a??(()=>s("wallet")),children:"Authorize a wallet"})]})}export{p as O};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var fe=s=>{throw TypeError(s)};var ee=(s,t,r)=>t.has(s)||fe("Cannot "+r);var l=(s,t,r)=>(ee(s,t,"read from private field"),r?r.call(s):t.get(s)),v=(s,t,r)=>t.has(s)?fe("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,r),y=(s,t,r,a)=>(ee(s,t,"write to private field"),a?a.call(s,r):t.set(s,r),r),k=(s,t,r)=>(ee(s,t,"access private method"),r);import{bz as $e,bA as oe,bB as Me,bC as Le,bp as Se,F as Qe,bD as Te,bE as _e,r as E,bF as Fe,bG as Pe,bH as Ie,bI as ze,bJ as we,bK as He,bL as De,as as Ke,m as $,u as Ee,a7 as ve,j as e,B as se,y as te,I as F,n as We,a8 as xe,a9 as je,a as Ue,i as Ge,b7 as Ve,bM as Je,aC as Xe,av as re,f as X,q as Y,e as ae,bN as Ye,c as Ze,P as ke,ah as Z,g as b,O as P,S as qe,h as z,l as I,L as pe,o as ye,bO as A,E as es,v as Ne,bP as ss}from"./index-DIcymBxc.js";import{U as ts,M as rs,c as as}from"./UsageByModel-DhTF-c1H.js";import{g as is}from"./usage-DktoZRc8.js";import{S as ns}from"./Segmented-BelxPFkk.js";import{c as os}from"./Charts-doK0mDVf.js";import"./roving-DkptacxO.js";function Re(s,t){const r=new Set(t);return s.filter(a=>!r.has(a))}function ls(s,t,r){const a=s.slice(0);return a[t]=r,a}var L,m,Q,T,x,q,H,D,K,W,p,le,ce,ue,de,he,Oe,cs=(Oe=class extends $e{constructor(t,r,a){super();v(this,p);v(this,L);v(this,m);v(this,Q);v(this,T);v(this,x);v(this,q);v(this,H);v(this,D);v(this,K);v(this,W,[]);y(this,L,t),y(this,T,a),y(this,Q,[]),y(this,x,[]),y(this,m,[]),this.setQueries(r)}onSubscribe(){this.listeners.size===1&&l(this,x).forEach(t=>{t.subscribe(r=>{k(this,p,de).call(this,t,r)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,l(this,x).forEach(t=>{t.destroy()})}setQueries(t,r){y(this,Q,t),y(this,T,r),oe.batch(()=>{const a=l(this,x),o=k(this,p,ue).call(this,l(this,Q));o.forEach(d=>d.observer.setOptions(d.defaultedQueryOptions));const i=o.map(d=>d.observer),n=i.map(d=>d.getCurrentResult()),c=a.length!==i.length,N=i.some((d,O)=>d!==a[O]),R=c||N,_=R?!0:n.some((d,O)=>{const C=l(this,m)[O];return!C||!Me(d,C)});!R&&!_||(R&&(y(this,W,o),y(this,x,i)),y(this,m,n),this.hasListeners()&&(R&&(Re(a,i).forEach(d=>{d.destroy()}),Re(i,a).forEach(d=>{d.subscribe(O=>{k(this,p,de).call(this,d,O)})})),k(this,p,he).call(this)))})}getCurrentResult(){return l(this,m)}getQueries(){return l(this,x).map(t=>t.getCurrentQuery())}getObservers(){return l(this,x)}getOptimisticResult(t,r){const a=k(this,p,ue).call(this,t),o=a.map(n=>n.observer.getOptimisticResult(n.defaultedQueryOptions)),i=a.map(n=>n.defaultedQueryOptions.queryHash);return[o,n=>k(this,p,ce).call(this,n??o,r,i),()=>k(this,p,le).call(this,o,a)]}},L=new WeakMap,m=new WeakMap,Q=new WeakMap,T=new WeakMap,x=new WeakMap,q=new WeakMap,H=new WeakMap,D=new WeakMap,K=new WeakMap,W=new WeakMap,p=new WeakSet,le=function(t,r){return r.map((a,o)=>{const i=t[o];return a.defaultedQueryOptions.notifyOnChangeProps?i:a.observer.trackResult(i,n=>{r.forEach(c=>{c.observer.trackProp(n)})})})},ce=function(t,r,a){if(r){const o=l(this,K),i=a!==void 0&&o!==void 0&&(o.length!==a.length||a.some((n,c)=>n!==o[c]));return(!l(this,q)||l(this,m)!==l(this,D)||i||r!==l(this,H))&&(y(this,H,r),y(this,D,l(this,m)),a!==void 0&&y(this,K,a),y(this,q,Le(l(this,q),r(t)))),l(this,q)}return t},ue=function(t){const r=new Map;l(this,x).forEach(o=>{const i=o.options.queryHash;if(!i)return;const n=r.get(i);n?n.push(o):r.set(i,[o])});const a=[];return t.forEach(o=>{var N;const i=l(this,L).defaultQueryOptions(o),c=((N=r.get(i.queryHash))==null?void 0:N.shift())??new Se(l(this,L),i);a.push({defaultedQueryOptions:i,observer:c})}),a},de=function(t,r){const a=l(this,x).indexOf(t);a!==-1&&(y(this,m,ls(l(this,m),a,r)),k(this,p,he).call(this))},he=function(){var t;if(this.hasListeners()){const r=l(this,q),a=k(this,p,le).call(this,l(this,m),l(this,W)),o=k(this,p,ce).call(this,a,(t=l(this,T))==null?void 0:t.combine);r!==o&&oe.batch(()=>{this.listeners.forEach(i=>{i(l(this,m))})})}},Oe);function us({queries:s,...t},r){const a=Qe(),o=Te(),i=_e(),n=E.useMemo(()=>s.map(h=>{const g=a.defaultQueryOptions(h);return g._optimisticResults=o?"isRestoring":"optimistic",g}),[s,a,o]);n.forEach(h=>{Fe(h);const g=a.getQueryCache().get(h.queryHash);Pe(h,i,g)}),Ie(i);const[c]=E.useState(()=>new cs(a,n,t)),[N,R,_]=c.getOptimisticResult(n,t.combine),d=!o&&t.subscribed!==!1;E.useSyncExternalStore(E.useCallback(h=>d?c.subscribe(oe.batchCalls(h)):ze,[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),E.useEffect(()=>{c.setQueries(n,t)},[n,t,c]);const C=N.some((h,g)=>we(n[g],h))?N.flatMap((h,g)=>{const f=n[g];if(f&&we(f,h)){const U=new Se(a,f);return He(f,U,i)}return[]}):[];if(C.length>0)throw Promise.all(C);const S=N.find((h,g)=>{const f=n[g];return f&&De({result:h,errorResetBoundary:i,throwOnError:f.throwOnError,query:a.getQueryCache().get(f.queryHash),suspense:f.suspense})});if(S!=null&&S.error)throw S.error;return R(_())}const ds=.8;function hs(s,t){if(!s)return[];const r=[];for(const[a,o]of t){const i=s[a];if(i===null||o===null)continue;const n=$(i),c=n===0?1:o/n;c>=ds&&r.push({period:a,label:Ke[a],spent:o,limit:n,fraction:c,reached:c>=1})}return r}function ps(s,t,r){const a=t/r,o=a>0?s/a:null,i=o===null?s<1:o<7;return{available:s,dailySpend:a,days:o,low:i}}function ie({title:s,body:t,action:r}){return e.jsxs("div",{className:"gc-setup",children:[e.jsxs("div",{className:"gc-setup__text",children:[e.jsx("div",{className:"gc-setup__title",children:s}),e.jsx("div",{className:"gc-setup__body",children:t})]}),r]})}const ys=e.jsxs("svg",{width:"28",height:"24",viewBox:"0 0 28 24","aria-hidden":"true",className:"gc-empty-tile__bars",children:[e.jsx("rect",{x:"2",y:"12",width:"6",height:"12",rx:"1.5"}),e.jsx("rect",{x:"11",y:"6",width:"6",height:"18",rx:"1.5"}),e.jsx("rect",{x:"20",y:"0",width:"6",height:"24",rx:"1.5"})]}),gs=[{id:"keys",title:"API keys",body:"Create keys for apps and people, with budgets and their own routing."},{id:"chat",title:"Chat",body:"Try any model on the network and see which seller answers."},{id:"wallet",title:"Wallet & Funding",body:"Fund the workspace wallet and authorize who can withdraw."},{id:"routing",title:"Routing",body:"Choose which sellers may serve, price caps, TEE only, fallbacks."},{id:"providers",title:"Providers",body:"Every provider this gateway sees, with prices, trust and latency."},{id:"models",title:"Models",body:"Every model on the network, its providers and a ready-to-run API call."},{id:"presets",title:"Presets",body:"Save a model, system prompt and parameters as @preset/<name>."},{id:"members",title:"Members",body:"Invite people and choose what each of them may do."},{id:"activity",title:"Activity",body:"Spend, requests and tokens by model, key and member."},{id:"settings",title:"Settings",body:"Buyer settings every policy starts from, observability and sign-in."}];function ms({hasKeys:s,fundsKnown:t,funded:r}){const{workspace:a,viewer:o}=Ee(),i=gs.filter(n=>ve(n.id,o));return e.jsxs(e.Fragment,{children:[!s&&e.jsx(ie,{title:"No API keys yet",body:"Create your first API key to start using this workspace from your apps.",action:e.jsx(se,{variant:"brand",leadingIcon:e.jsx(F.plus,{size:14}),onClick:()=>te("keys?new=1"),children:"Create API key"})}),t&&!r&&ve("wallet",o)&&e.jsx(ie,{title:"No funds yet",body:e.jsxs(e.Fragment,{children:["Requests to paid sellers are paid in USDC from the ",a.name," wallet. Free sellers work without funds."]}),action:e.jsx(se,{variant:"outline",onClick:()=>te("wallet?fund=1"),children:"Add funds"})}),We(o)&&e.jsx(ie,{title:"Review buyer settings",body:"Price caps, minimum trust (60 by default) and verification apply to every key.",action:e.jsx(se,{variant:"ghost",onClick:()=>te("settings"),children:"Open settings"})}),e.jsxs("div",{className:"gc-section-head",children:[e.jsx("h2",{children:"This week's usage"}),e.jsxs("a",{className:"gc-link",href:je("activity"),onClick:xe("activity"),children:["View activity ",e.jsx(F.right,{size:13})]})]}),e.jsx("div",{className:"gc-grid gc-grid--3",children:["No spend this week","No requests this week","No tokens this week"].map(n=>e.jsxs("div",{className:"gc-empty-tile",children:[ys,e.jsx("span",{children:n})]},n))}),e.jsx("div",{className:"gc-grid gc-grid--3",children:i.map(n=>{const c=F[n.id]??F.overview;return e.jsxs("a",{className:"gc-section-card",href:je(n.id),onClick:xe(n.id),children:[e.jsx("span",{className:"gc-section-card__icon",children:e.jsx(c,{size:16})}),e.jsxs("span",{className:"gc-section-card__text",children:[e.jsx("span",{className:"gc-section-card__title",children:n.title}),e.jsx("span",{className:"gc-section-card__body",children:n.body})]}),e.jsx(F.right,{size:14,className:"gc-section-card__chevron"})]},n.id)})})]})}const ne=[{period:"daily",label:"Today"},{period:"weekly",label:"This week"},{period:"monthly",label:"This month"}];function bs(s,t){return t&&s!==null?s/t:t===0?1:null}function fs({label:s,spent:t,limit:r}){const a=r===null?null:$(r);return e.jsx(qe,{label:`Spend ${s.toLowerCase()}`,value:t===null?"…":b(t),sub:a===null?"No budget":`of ${b(a)} budget`,meter:bs(t,a)})}function ws(s){return s?s.days===null?"No recent spend":Ae(s.days):"…"}function vs({wallet:s,funds:t}){return s.isLoading?e.jsx(pe,{rows:1,height:48}):s.error?e.jsx(ye,{error:s.error,onRetry:()=>void s.refetch()}):s.data?e.jsxs("div",{className:"gc-grid gc-grid--4 gc-figures",children:[e.jsx(A,{label:"Available",value:b(s.data.available),strong:!0}),e.jsx(A,{label:"Reserved in channels",value:b(s.data.reserved)}),e.jsx(A,{label:"In wallet, not deposited",value:b(s.data.walletUsdc)}),e.jsx(A,{label:"Runway",value:ws(t)})]}):null}function xs({status:s}){if(s.isLoading)return e.jsx(pe,{rows:1,height:40});if(s.error)return e.jsx(ye,{error:s.error});if(!s.data)return null;const{buyer:t}=s.data;return e.jsxs("div",{className:"gc-grid gc-grid--4 gc-figures",children:[e.jsx(A,{label:"Buyer",value:t.reachable?e.jsx(Ne,{tone:"success",children:"Connected"}):e.jsx(Ne,{tone:"danger",children:"Unreachable"})}),e.jsx(A,{label:"Sellers seen",value:z(t.peers)}),e.jsx(A,{label:"DHT nodes",value:z(t.dhtNodes)}),e.jsx(A,{label:"Buyer uptime",value:t.uptimeMs===null?"—":ss(t.uptimeMs)})]})}function qs(){var me,be;const{workspace:s,viewer:t}=Ee(),r=Ue(),a=Ge(t),o=Ve(s.id),i=Je(s.id,a),n=Xe(),c=Date.now(),[N]=E.useState(c),[R,_]=E.useState("spend"),d=E.useMemo(()=>({...r}),[r.workspace,r.member]),O=us({queries:ne.map(({period:u})=>{const w=re(u,c);return{queryKey:Y.usage({...r,from:w,groupBy:"day"}),queryFn:()=>X.usage.report({...r,from:w,groupBy:"day"})}})}),C=re("monthly",c),S=ae({queryKey:Y.usage({...r,from:C,groupBy:"key"}),queryFn:()=>X.usage.report({...r,from:C,groupBy:"key"})}),h=ae({queryKey:Y.usage({...r,from:C,groupBy:"model"}),queryFn:()=>X.usage.report({...r,from:C,groupBy:"model"})}),g=re("daily",c),f=g-7*864e5,U=ae({queryKey:Y.usage({workspace:s.id,from:f,to:g,groupBy:"day"}),queryFn:()=>X.usage.report({workspace:s.id,from:f,to:g-1,groupBy:"day"}),enabled:a}),B=Ye(),G=Ze({workspace:s.id}),V=((me=o.data)==null?void 0:me.limits)??null,M=(be=O[2])==null?void 0:be.data,ge=u=>{var J;const w=(J=O[u])==null?void 0:J.data;return w?$(w.totals.spent):null},Be=hs(V,ne.map(({period:u},w)=>[u,ge(w)])),j=i.data&&U.data?ps($(i.data.available),$(U.data.totals.spent),7):null;if(M!==void 0&&M.totals.requests===0&&G.data!==void 0&&G.data.every(u=>u.usage.requests===0)){const u=(G.data??[]).some(w=>w.status==="active"&&!w.label.startsWith("Web chat"));return e.jsxs("div",{className:"gc-page",children:[e.jsx(ke,{title:s.name,description:"Nothing has run through this workspace yet. Here is where to start."}),e.jsx(ms,{hasKeys:G.isLoading||u,fundsKnown:a&&i.data!==void 0,funded:i.data?$(i.data.available)>0:!0})]})}return e.jsxs("div",{className:"gc-page",children:[e.jsx(ke,{title:"Overview",description:`${s.name} workspace${r.member?" · your usage":""}`}),(j==null?void 0:j.low)&&e.jsx(Z,{tone:j.days!==null&&j.days<1?"danger":"warning",title:"Balance is running low",action:e.jsx(P,{to:"wallet",children:"Add funds"}),children:j.days===null?`Only ${b(j.available)} is available.`:`${b(j.available)} available lasts about ${Ae(j.days)} at last week's pace (${b(j.dailySpend)} a day).`}),B.currentMissingOperator&&e.jsx(Z,{tone:"warning",title:"No authorized wallet",action:e.jsx(P,{to:"wallet",children:B.canAuthorize?"Authorize a wallet":"View wallet"}),children:B.canAuthorize?`Nobody can withdraw ${s.name}'s funds or claim its ANTS rewards until you authorize one of your wallets. Requests keep working.`:`Nobody can withdraw ${s.name}'s funds or claim its ANTS rewards until the organization owner authorizes a wallet. Requests keep working.`}),B.withdrawable.count>0&&e.jsxs(Z,{tone:"warning",title:`${B.withdrawable.count} channel${B.withdrawable.count===1?"":"s"} ready to withdraw`,action:e.jsx(P,{to:"wallet",children:"Withdraw"}),children:["About ",b(B.withdrawable.amount)," of unused reserve can return to the balance."]}),Be.map(u=>e.jsx(Z,{tone:u.reached?"danger":"warning",title:u.reached?`${u.label} budget reached`:`${u.label} budget almost used`,children:u.reached?`${s.name} has spent ${b(u.spent)} of its ${b(u.limit)} ${u.label.toLowerCase()} budget. New requests are refused until the period resets.`:`${Math.round(u.fraction*100)}% of the ${b(u.limit)} ${u.label.toLowerCase()} budget is used.`},u.period)),e.jsxs("div",{className:"gc-grid gc-grid--4",children:[ne.map(({period:u,label:w},J)=>e.jsx(fs,{label:w,spent:ge(J),limit:(V==null?void 0:V[u])??null},u)),e.jsx(qe,{label:"Requests this month",value:M?z(M.totals.requests):"…",sub:M?`${z(M.totals.failedRequests)} failed`:void 0})]}),e.jsx(I,{title:"Last 7 days",description:as(R,"7d"),actions:e.jsxs(e.Fragment,{children:[e.jsx(ns,{label:"Chart metric",value:R,onChange:_,options:rs}),e.jsx(P,{to:"activity",children:"All activity"})]}),children:e.jsx(ts,{filter:d,range:"7d",now:N,metric:R,height:200})}),a&&e.jsx(I,{title:"Balance",actions:e.jsx(P,{to:"wallet",children:"Add funds"}),children:e.jsx(vs,{wallet:i,funds:j})}),e.jsxs("div",{className:"gc-grid gc-grid--2",children:[e.jsx(I,{title:"Top keys this month",children:e.jsx(Ce,{report:S.data,loading:S.isLoading,error:S.error,empty:"No spend this month."})}),e.jsx(I,{title:"Top models this month",children:e.jsx(Ce,{report:h.data,loading:h.isLoading,error:h.error,empty:"No spend this month."})})]}),e.jsx(I,{title:"Gateway",children:e.jsx(xs,{status:n})})]})}function Ae(s){return s<1?"under a day":s<60?`${Math.floor(s)} day${Math.floor(s)===1?"":"s"}`:`${Math.floor(s/30)} months`}function Ce({report:s,loading:t,error:r,empty:a}){if(t)return e.jsx(pe,{rows:4,height:22});if(r)return e.jsx(ye,{error:r});const o=((s==null?void 0:s.groups)??[]).map(i=>({label:is(i),value:$(i.spent),sub:`${z(i.requests)} requests`})).filter(i=>i.value>0).sort((i,n)=>n.value-i.value).slice(0,5);return o.length===0?e.jsx(es,{title:a}):e.jsx(os,{items:o,format:b})}export{qs as default};
|
|
1
|
+
var fe=s=>{throw TypeError(s)};var ee=(s,t,r)=>t.has(s)||fe("Cannot "+r);var l=(s,t,r)=>(ee(s,t,"read from private field"),r?r.call(s):t.get(s)),v=(s,t,r)=>t.has(s)?fe("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,r),y=(s,t,r,a)=>(ee(s,t,"write to private field"),a?a.call(s,r):t.set(s,r),r),k=(s,t,r)=>(ee(s,t,"access private method"),r);import{by as $e,bz as oe,bA as Me,bB as Qe,b7 as Se,F as Le,bC as Te,bD as _e,r as E,bE as Fe,bF as Pe,bG as Ie,bH as ze,bI as we,bJ as He,bK as De,a9 as Ke,m as $,u as Ee,bL as ve,j as e,B as se,y as te,I as F,n as We,bM as xe,bN as je,a as Ue,i as Ge,aR as Ve,bO as Je,ak as Xe,ac as re,f as X,q as Y,e as ae,bP as Ye,c as Ze,P as ke,af as Z,g as b,O as P,S as qe,h as z,l as I,L as pe,o as ye,bQ as A,E as es,v as Re,bR as ss}from"./index-DPXW_JSn.js";import{U as ts,M as rs,c as as}from"./UsageByModel-Fb68pvpD.js";import{g as is}from"./usage-DQGKL0DJ.js";import{S as ns}from"./Segmented-DYnoemT9.js";import{c as os}from"./Charts-BMsoEfDr.js";import"./roving-DkptacxO.js";function Ne(s,t){const r=new Set(t);return s.filter(a=>!r.has(a))}function ls(s,t,r){const a=s.slice(0);return a[t]=r,a}var Q,m,L,T,x,q,H,D,K,W,p,le,ce,ue,de,he,Oe,cs=(Oe=class extends $e{constructor(t,r,a){super();v(this,p);v(this,Q);v(this,m);v(this,L);v(this,T);v(this,x);v(this,q);v(this,H);v(this,D);v(this,K);v(this,W,[]);y(this,Q,t),y(this,T,a),y(this,L,[]),y(this,x,[]),y(this,m,[]),this.setQueries(r)}onSubscribe(){this.listeners.size===1&&l(this,x).forEach(t=>{t.subscribe(r=>{k(this,p,de).call(this,t,r)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,l(this,x).forEach(t=>{t.destroy()})}setQueries(t,r){y(this,L,t),y(this,T,r),oe.batch(()=>{const a=l(this,x),o=k(this,p,ue).call(this,l(this,L));o.forEach(d=>d.observer.setOptions(d.defaultedQueryOptions));const i=o.map(d=>d.observer),n=i.map(d=>d.getCurrentResult()),c=a.length!==i.length,R=i.some((d,O)=>d!==a[O]),N=c||R,_=N?!0:n.some((d,O)=>{const C=l(this,m)[O];return!C||!Me(d,C)});!N&&!_||(N&&(y(this,W,o),y(this,x,i)),y(this,m,n),this.hasListeners()&&(N&&(Ne(a,i).forEach(d=>{d.destroy()}),Ne(i,a).forEach(d=>{d.subscribe(O=>{k(this,p,de).call(this,d,O)})})),k(this,p,he).call(this)))})}getCurrentResult(){return l(this,m)}getQueries(){return l(this,x).map(t=>t.getCurrentQuery())}getObservers(){return l(this,x)}getOptimisticResult(t,r){const a=k(this,p,ue).call(this,t),o=a.map(n=>n.observer.getOptimisticResult(n.defaultedQueryOptions)),i=a.map(n=>n.defaultedQueryOptions.queryHash);return[o,n=>k(this,p,ce).call(this,n??o,r,i),()=>k(this,p,le).call(this,o,a)]}},Q=new WeakMap,m=new WeakMap,L=new WeakMap,T=new WeakMap,x=new WeakMap,q=new WeakMap,H=new WeakMap,D=new WeakMap,K=new WeakMap,W=new WeakMap,p=new WeakSet,le=function(t,r){return r.map((a,o)=>{const i=t[o];return a.defaultedQueryOptions.notifyOnChangeProps?i:a.observer.trackResult(i,n=>{r.forEach(c=>{c.observer.trackProp(n)})})})},ce=function(t,r,a){if(r){const o=l(this,K),i=a!==void 0&&o!==void 0&&(o.length!==a.length||a.some((n,c)=>n!==o[c]));return(!l(this,q)||l(this,m)!==l(this,D)||i||r!==l(this,H))&&(y(this,H,r),y(this,D,l(this,m)),a!==void 0&&y(this,K,a),y(this,q,Qe(l(this,q),r(t)))),l(this,q)}return t},ue=function(t){const r=new Map;l(this,x).forEach(o=>{const i=o.options.queryHash;if(!i)return;const n=r.get(i);n?n.push(o):r.set(i,[o])});const a=[];return t.forEach(o=>{var R;const i=l(this,Q).defaultQueryOptions(o),c=((R=r.get(i.queryHash))==null?void 0:R.shift())??new Se(l(this,Q),i);a.push({defaultedQueryOptions:i,observer:c})}),a},de=function(t,r){const a=l(this,x).indexOf(t);a!==-1&&(y(this,m,ls(l(this,m),a,r)),k(this,p,he).call(this))},he=function(){var t;if(this.hasListeners()){const r=l(this,q),a=k(this,p,le).call(this,l(this,m),l(this,W)),o=k(this,p,ce).call(this,a,(t=l(this,T))==null?void 0:t.combine);r!==o&&oe.batch(()=>{this.listeners.forEach(i=>{i(l(this,m))})})}},Oe);function us({queries:s,...t},r){const a=Le(),o=Te(),i=_e(),n=E.useMemo(()=>s.map(h=>{const g=a.defaultQueryOptions(h);return g._optimisticResults=o?"isRestoring":"optimistic",g}),[s,a,o]);n.forEach(h=>{Fe(h);const g=a.getQueryCache().get(h.queryHash);Pe(h,i,g)}),Ie(i);const[c]=E.useState(()=>new cs(a,n,t)),[R,N,_]=c.getOptimisticResult(n,t.combine),d=!o&&t.subscribed!==!1;E.useSyncExternalStore(E.useCallback(h=>d?c.subscribe(oe.batchCalls(h)):ze,[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),E.useEffect(()=>{c.setQueries(n,t)},[n,t,c]);const C=R.some((h,g)=>we(n[g],h))?R.flatMap((h,g)=>{const f=n[g];if(f&&we(f,h)){const U=new Se(a,f);return He(f,U,i)}return[]}):[];if(C.length>0)throw Promise.all(C);const S=R.find((h,g)=>{const f=n[g];return f&&De({result:h,errorResetBoundary:i,throwOnError:f.throwOnError,query:a.getQueryCache().get(f.queryHash),suspense:f.suspense})});if(S!=null&&S.error)throw S.error;return N(_())}const ds=.8;function hs(s,t){if(!s)return[];const r=[];for(const[a,o]of t){const i=s[a];if(i===null||o===null)continue;const n=$(i),c=n===0?1:o/n;c>=ds&&r.push({period:a,label:Ke[a],spent:o,limit:n,fraction:c,reached:c>=1})}return r}function ps(s,t,r){const a=t/r,o=a>0?s/a:null,i=o===null?s<1:o<7;return{available:s,dailySpend:a,days:o,low:i}}function ie({title:s,body:t,action:r}){return e.jsxs("div",{className:"gc-setup",children:[e.jsxs("div",{className:"gc-setup__text",children:[e.jsx("div",{className:"gc-setup__title",children:s}),e.jsx("div",{className:"gc-setup__body",children:t})]}),r]})}const ys=e.jsxs("svg",{width:"28",height:"24",viewBox:"0 0 28 24","aria-hidden":"true",className:"gc-empty-tile__bars",children:[e.jsx("rect",{x:"2",y:"12",width:"6",height:"12",rx:"1.5"}),e.jsx("rect",{x:"11",y:"6",width:"6",height:"18",rx:"1.5"}),e.jsx("rect",{x:"20",y:"0",width:"6",height:"24",rx:"1.5"})]}),gs=[{id:"keys",title:"API keys",body:"Create keys for apps and people, with budgets and their own routing."},{id:"chat",title:"Chat",body:"Try any model on the network and see which seller answers."},{id:"wallet",title:"Wallet & Funding",body:"Fund the workspace wallet and authorize who can withdraw."},{id:"routing",title:"Routing",body:"Choose which sellers may serve, price caps, TEE only, fallbacks."},{id:"providers",title:"Providers",body:"Every provider this gateway sees, with prices, trust and latency."},{id:"models",title:"Models",body:"Every model on the network, its providers and a ready-to-run API call."},{id:"presets",title:"Presets",body:"Save a model, system prompt and parameters as @preset/<name>."},{id:"members",title:"Members",body:"Invite people and choose what each of them may do."},{id:"activity",title:"Activity",body:"Spend, requests and tokens by model, key and member."},{id:"settings",title:"Settings",body:"Buyer settings every policy starts from, observability and sign-in."}];function ms({hasKeys:s,fundsKnown:t,funded:r}){const{workspace:a,viewer:o}=Ee(),i=gs.filter(n=>ve(n.id,o));return e.jsxs(e.Fragment,{children:[!s&&e.jsx(ie,{title:"No API keys yet",body:"Create your first API key to start using this workspace from your apps.",action:e.jsx(se,{variant:"brand",leadingIcon:e.jsx(F.plus,{size:14}),onClick:()=>te("keys?new=1"),children:"Create API key"})}),t&&!r&&ve("wallet",o)&&e.jsx(ie,{title:"No funds yet",body:e.jsxs(e.Fragment,{children:["Requests to paid sellers are paid in USDC from the ",a.name," wallet. Free sellers work without funds."]}),action:e.jsx(se,{variant:"outline",onClick:()=>te("wallet?fund=1"),children:"Add funds"})}),We(o)&&e.jsx(ie,{title:"Review buyer settings",body:"Price caps, minimum trust (60 by default) and verification apply to every key.",action:e.jsx(se,{variant:"ghost",onClick:()=>te("settings"),children:"Open settings"})}),e.jsxs("div",{className:"gc-section-head",children:[e.jsx("h2",{children:"This week's usage"}),e.jsxs("a",{className:"gc-link",href:je("activity"),onClick:xe("activity"),children:["View activity ",e.jsx(F.right,{size:13})]})]}),e.jsx("div",{className:"gc-grid gc-grid--3",children:["No spend this week","No requests this week","No tokens this week"].map(n=>e.jsxs("div",{className:"gc-empty-tile",children:[ys,e.jsx("span",{children:n})]},n))}),e.jsx("div",{className:"gc-grid gc-grid--3",children:i.map(n=>{const c=F[n.id]??F.overview;return e.jsxs("a",{className:"gc-section-card",href:je(n.id),onClick:xe(n.id),children:[e.jsx("span",{className:"gc-section-card__icon",children:e.jsx(c,{size:16})}),e.jsxs("span",{className:"gc-section-card__text",children:[e.jsx("span",{className:"gc-section-card__title",children:n.title}),e.jsx("span",{className:"gc-section-card__body",children:n.body})]}),e.jsx(F.right,{size:14,className:"gc-section-card__chevron"})]},n.id)})})]})}const ne=[{period:"daily",label:"Today"},{period:"weekly",label:"This week"},{period:"monthly",label:"This month"}];function bs(s,t){return t&&s!==null?s/t:t===0?1:null}function fs({label:s,spent:t,limit:r}){const a=r===null?null:$(r);return e.jsx(qe,{label:`Spend ${s.toLowerCase()}`,value:t===null?"…":b(t),sub:a===null?"No budget":`of ${b(a)} budget`,meter:bs(t,a)})}function ws(s){return s?s.days===null?"No recent spend":Ae(s.days):"…"}function vs({wallet:s,funds:t}){return s.isLoading?e.jsx(pe,{rows:1,height:48}):s.error?e.jsx(ye,{error:s.error,onRetry:()=>void s.refetch()}):s.data?e.jsxs("div",{className:"gc-grid gc-grid--4 gc-figures",children:[e.jsx(A,{label:"Available",value:b(s.data.available),strong:!0}),e.jsx(A,{label:"Reserved in channels",value:b(s.data.reserved)}),e.jsx(A,{label:"In wallet, not deposited",value:b(s.data.walletUsdc)}),e.jsx(A,{label:"Runway",value:ws(t)})]}):null}function xs({status:s}){if(s.isLoading)return e.jsx(pe,{rows:1,height:40});if(s.error)return e.jsx(ye,{error:s.error});if(!s.data)return null;const{buyer:t}=s.data;return e.jsxs("div",{className:"gc-grid gc-grid--4 gc-figures",children:[e.jsx(A,{label:"Buyer",value:t.reachable?e.jsx(Re,{tone:"success",children:"Connected"}):e.jsx(Re,{tone:"danger",children:"Unreachable"})}),e.jsx(A,{label:"Sellers seen",value:z(t.peers)}),e.jsx(A,{label:"DHT nodes",value:z(t.dhtNodes)}),e.jsx(A,{label:"Buyer uptime",value:t.uptimeMs===null?"—":ss(t.uptimeMs)})]})}function qs(){var me,be;const{workspace:s,viewer:t}=Ee(),r=Ue(),a=Ge(t),o=Ve(s.id),i=Je(s.id,a),n=Xe(),c=Date.now(),[R]=E.useState(c),[N,_]=E.useState("spend"),d=E.useMemo(()=>({...r}),[r.workspace,r.member]),O=us({queries:ne.map(({period:u})=>{const w=re(u,c);return{queryKey:Y.usage({...r,from:w,groupBy:"day"}),queryFn:()=>X.usage.report({...r,from:w,groupBy:"day"})}})}),C=re("monthly",c),S=ae({queryKey:Y.usage({...r,from:C,groupBy:"key"}),queryFn:()=>X.usage.report({...r,from:C,groupBy:"key"})}),h=ae({queryKey:Y.usage({...r,from:C,groupBy:"model"}),queryFn:()=>X.usage.report({...r,from:C,groupBy:"model"})}),g=re("daily",c),f=g-7*864e5,U=ae({queryKey:Y.usage({workspace:s.id,from:f,to:g,groupBy:"day"}),queryFn:()=>X.usage.report({workspace:s.id,from:f,to:g-1,groupBy:"day"}),enabled:a}),B=Ye(),G=Ze({workspace:s.id}),V=((me=o.data)==null?void 0:me.limits)??null,M=(be=O[2])==null?void 0:be.data,ge=u=>{var J;const w=(J=O[u])==null?void 0:J.data;return w?$(w.totals.spent):null},Be=hs(V,ne.map(({period:u},w)=>[u,ge(w)])),j=i.data&&U.data?ps($(i.data.available),$(U.data.totals.spent),7):null;if(M!==void 0&&M.totals.requests===0&&G.data!==void 0&&G.data.every(u=>u.usage.requests===0)){const u=(G.data??[]).some(w=>w.status==="active"&&!w.label.startsWith("Web chat"));return e.jsxs("div",{className:"gc-page",children:[e.jsx(ke,{title:s.name,description:"Nothing has run through this workspace yet. Here is where to start."}),e.jsx(ms,{hasKeys:G.isLoading||u,fundsKnown:a&&i.data!==void 0,funded:i.data?$(i.data.available)>0:!0})]})}return e.jsxs("div",{className:"gc-page",children:[e.jsx(ke,{title:"Overview",description:`${s.name} workspace${r.member?" · your usage":""}`}),(j==null?void 0:j.low)&&e.jsx(Z,{tone:j.days!==null&&j.days<1?"danger":"warning",title:"Balance is running low",action:e.jsx(P,{to:"wallet",children:"Add funds"}),children:j.days===null?`Only ${b(j.available)} is available.`:`${b(j.available)} available lasts about ${Ae(j.days)} at last week's pace (${b(j.dailySpend)} a day).`}),B.currentMissingOperator&&e.jsx(Z,{tone:"warning",title:"No authorized wallet",action:e.jsx(P,{to:"wallet",children:B.canAuthorize?"Authorize a wallet":"View wallet"}),children:B.canAuthorize?`Nobody can withdraw ${s.name}'s funds or claim its ANTS rewards until you authorize one of your wallets. Requests keep working.`:`Nobody can withdraw ${s.name}'s funds or claim its ANTS rewards until the organization owner authorizes a wallet. Requests keep working.`}),B.withdrawable.count>0&&e.jsxs(Z,{tone:"warning",title:`${B.withdrawable.count} channel${B.withdrawable.count===1?"":"s"} ready to withdraw`,action:e.jsx(P,{to:"wallet",children:"Withdraw"}),children:["About ",b(B.withdrawable.amount)," of unused reserve can return to the balance."]}),Be.map(u=>e.jsx(Z,{tone:u.reached?"danger":"warning",title:u.reached?`${u.label} budget reached`:`${u.label} budget almost used`,children:u.reached?`${s.name} has spent ${b(u.spent)} of its ${b(u.limit)} ${u.label.toLowerCase()} budget. New requests are refused until the period resets.`:`${Math.round(u.fraction*100)}% of the ${b(u.limit)} ${u.label.toLowerCase()} budget is used.`},u.period)),e.jsxs("div",{className:"gc-grid gc-grid--4",children:[ne.map(({period:u,label:w},J)=>e.jsx(fs,{label:w,spent:ge(J),limit:(V==null?void 0:V[u])??null},u)),e.jsx(qe,{label:"Requests this month",value:M?z(M.totals.requests):"…",sub:M?`${z(M.totals.failedRequests)} failed`:void 0})]}),e.jsx(I,{title:"Last 7 days",description:as(N,"7d"),actions:e.jsxs(e.Fragment,{children:[e.jsx(ns,{label:"Chart metric",value:N,onChange:_,options:rs}),e.jsx(P,{to:"activity",children:"All activity"})]}),children:e.jsx(ts,{filter:d,range:"7d",now:R,metric:N,height:200})}),a&&e.jsx(I,{title:"Balance",actions:e.jsx(P,{to:"wallet",children:"Add funds"}),children:e.jsx(vs,{wallet:i,funds:j})}),e.jsxs("div",{className:"gc-grid gc-grid--2",children:[e.jsx(I,{title:"Top keys this month",children:e.jsx(Ce,{report:S.data,loading:S.isLoading,error:S.error,empty:"No spend this month."})}),e.jsx(I,{title:"Top models this month",children:e.jsx(Ce,{report:h.data,loading:h.isLoading,error:h.error,empty:"No spend this month."})})]}),e.jsx(I,{title:"Gateway",children:e.jsx(xs,{status:n})})]})}function Ae(s){return s<1?"under a day":s<60?`${Math.floor(s)} day${Math.floor(s)===1?"":"s"}`:`${Math.floor(s/30)} months`}function Ce({report:s,loading:t,error:r,empty:a}){if(t)return e.jsx(pe,{rows:4,height:22});if(r)return e.jsx(ye,{error:r});const o=((s==null?void 0:s.groups)??[]).map(i=>({label:is(i),value:$(i.spent),sub:`${z(i.requests)} requests`})).filter(i=>i.value>0).sort((i,n)=>n.value-i.value).slice(0,5);return o.length===0?e.jsx(es,{title:a}):e.jsx(os,{items:o,format:b})}export{qs as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ag as g,w as k,r as o,j as s,ah as N,I as _,ai as b,B as w}from"./index-DPXW_JSn.js";function f(l,e){const c=l==null?void 0:l.find(n=>g(n.peerId,e));return(c==null?void 0:c.displayName)??k(e,8,4)}function z({value:l,onChange:e,peers:c,label:n,ordered:r,placeholder:m="Search sellers or paste a peer id"}){const[d,h]=o.useState(""),x=o.useId(),j=o.useId();function a(){const i=d.trim();if(!i)return;const t=c==null?void 0:c.find(p=>{var I;return((I=p.displayName)==null?void 0:I.toLowerCase())===i.toLowerCase()||p.peerId.toLowerCase()===i.toLowerCase()}),u=(t==null?void 0:t.peerId)??i;l.some(p=>p.toLowerCase()===u.toLowerCase())||e([...l,u]),h("")}return s.jsxs("div",{className:"gc-picker",children:[s.jsx("label",{className:"as-field__label",htmlFor:j,children:n}),l.length>0&&s.jsx("ol",{className:r?"gc-chips gc-chips--ordered":"gc-chips",children:l.map((i,t)=>s.jsxs("li",{className:"gc-chip",children:[r&&s.jsx("span",{className:"gc-chip__index",children:t+1}),s.jsx("span",{className:"gc-chip__label",title:i,children:f(c,i)}),r&&s.jsxs(s.Fragment,{children:[s.jsx(N,{label:`Move ${f(c,i)} up`,size:"sm",disabled:t===0,onClick:()=>e(b(l,t,-1)),children:s.jsx(_.up,{size:12})}),s.jsx(N,{label:`Move ${f(c,i)} down`,size:"sm",disabled:t===l.length-1,onClick:()=>e(b(l,t,1)),children:s.jsx(_.down,{size:12})})]}),s.jsx(N,{label:`Remove ${f(c,i)}`,size:"sm",onClick:()=>e(l.filter(u=>u!==i)),children:s.jsx(_.x,{size:12})})]},i))}),s.jsxs("div",{className:"gc-inline",children:[s.jsx("input",{id:j,className:"as-field__input gc-picker__input",list:x,value:d,placeholder:m,onChange:i=>h(i.target.value),onKeyDown:i=>{i.key==="Enter"&&(i.preventDefault(),a())}}),s.jsx("datalist",{id:x,children:c==null?void 0:c.map(i=>s.jsx("option",{value:i.peerId,children:i.displayName??k(i.peerId)},i.peerId))}),s.jsx(w,{variant:"outline",size:"sm",onClick:a,disabled:!d.trim(),children:"Add"})]})]})}function y({value:l,onChange:e,label:c,suggestions:n,placeholder:r}){const[m,d]=o.useState(""),h=o.useId(),x=o.useId();function j(){const a=m.trim();a&&!l.includes(a)&&e([...l,a]),d("")}return s.jsxs("div",{className:"gc-picker",children:[s.jsx("label",{className:"as-field__label",htmlFor:x,children:c}),l.length>0&&s.jsx("ul",{className:"gc-chips",children:l.map(a=>s.jsxs("li",{className:"gc-chip",children:[s.jsx("span",{className:"gc-chip__label",children:a}),s.jsx(N,{label:`Remove ${a}`,size:"sm",onClick:()=>e(l.filter(i=>i!==a)),children:s.jsx(_.x,{size:12})})]},a))}),s.jsxs("div",{className:"gc-inline",children:[s.jsx("input",{id:x,className:"as-field__input gc-picker__input",list:h,value:m,placeholder:r,onChange:a=>d(a.target.value),onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),j())}}),s.jsx("datalist",{id:h,children:n==null?void 0:n.map(a=>s.jsx("option",{value:a},a))}),s.jsx(w,{variant:"outline",size:"sm",onClick:j,disabled:!m.trim(),children:"Add"})]})]})}export{y as C,z as P,f as p};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,r as f,I as M,u as q,n as G,be as me,t as Y,q as Q,f as O,l as he,Q as pe,E as ge,C as E,D as K,B as P,b_ as J,M as fe,w as X,T as C,o as xe,b4 as b,b$ as y,bh as je,b6 as be,bi as ye,bf as Pe,bj as Z,bL as Ne,bM as ve,bN as we,c0 as D,c1 as A,c2 as V,bn as Ie,bw as ke,af as Se,c3 as Me,c4 as Ce,c5 as _e,c6 as $e}from"./index-DPXW_JSn.js";import{p as ee,P as S,C as Te}from"./PeerPicker-CcMSXxY3.js";import{D as Le}from"./DataTable-BCgVRqY6.js";import{S as $}from"./SelectField-m1sMIgMa.js";import{S as B}from"./Segmented-DYnoemT9.js";import{S as T}from"./Switch-Db8Sm64J.js";import{D as Oe}from"./Disclosure-CQMtWM0M.js";const qe="https://antseed.com/docs/reputation";function Ee({label:s,children:r}){const[n,l]=f.useState(!1),a=f.useId();return e.jsxs("span",{className:n?"gc-tip gc-tip--open":"gc-tip",onMouseLeave:()=>l(!1),children:[e.jsx("button",{type:"button",className:"gc-tip__button","aria-label":s,"aria-describedby":a,onClick:()=>l(i=>!i),onBlur:()=>l(!1),children:e.jsx(M.info,{size:14})}),e.jsx("span",{role:"tooltip",id:a,className:"gc-tip__bubble",children:r})]})}function Ue(){return e.jsxs(Ee,{label:"What is the trust score?",children:[e.jsx("span",{className:"gc-tip__title",children:"Trust score, 0 to 100"}),"Your buyer works it out for each seller from records it can check: service history (up to 50), usage last week (20), staked ANTS (10) and a verified GitHub or domain (20), plus 5 for a free model. Proven wash traders score 0."," ",e.jsx("a",{href:qe,target:"_blank",rel:"noreferrer",children:"How it works"})]})}function Fe(s){return r=>{r.preventDefault(),r.stopPropagation(),s()}}function se({initial:s,peers:r,onDone:n}){const[l,a]=f.useState((s==null?void 0:s.name)??""),[i,o]=f.useState((s==null?void 0:s.description)??""),[h,p]=f.useState((s==null?void 0:s.peerIds)??[]),m=Y({mutationFn:()=>{const u={name:l.trim(),description:i.trim()||null,peerIds:h};return s?O.network.updatePeerList(s.id,u):O.network.createPeerList(u)},onSuccess:n,invalidate:[Q.peerLists]});return e.jsxs("form",{className:"gc-stack",onSubmit:Fe(()=>m.mutate()),children:[e.jsx(C,{label:"Name",required:!0,placeholder:"e.g. Our own sellers",value:l,onChange:u=>a(u.target.value)}),e.jsx(C,{label:"Description",value:i,onChange:u=>o(u.target.value)}),e.jsx(S,{label:"Sellers",value:h,onChange:p,peers:r}),e.jsx("p",{className:"gc-fineprint",children:"Policies refer to a list by name, so editing it changes every policy that uses it."}),m.error?e.jsx(xe,{error:m.error,title:"Could not save the list"}):null,e.jsxs("div",{className:"gc-actions",children:[e.jsx(P,{variant:"ghost",onClick:n,children:"Cancel"}),e.jsx(P,{type:"submit",disabled:m.isPending||!l.trim(),children:m.isPending?"Saving…":"Save list"})]})]})}const le="Named groups of sellers that routing rules allow or block in one step. Editing a list changes every rule that uses it.";function Re(s,r){const n=s.peerIds.map(l=>ee(r,l));return n.length<=4?n.join(", "):`${n.slice(0,4).join(", ")} and ${n.length-4} more`}function ze({peers:s,inDialog:r=!1}){const{viewer:n}=q(),l=G(n),a=me(),[i,o]=f.useState(null),[h,p]=f.useState(null),m=Y({mutationFn:u=>O.network.removePeerList(u.id),onSuccess:()=>p(null),invalidate:[Q.peerLists]});return e.jsxs(he,{flush:!r,title:r?void 0:"Seller lists",description:r?void 0:`${le}${l?"":" Organization admins edit them."}`,actions:l&&e.jsx(P,{size:"sm",variant:"outline",leadingIcon:e.jsx(M.plus,{size:14}),onClick:()=>o("new"),children:"New list"}),children:[e.jsx(pe,{query:a,children:u=>e.jsx(Le,{label:"Seller lists",rows:u,rowKey:c=>c.id,rowLabel:c=>c.name,actions:c=>l?[{label:"Edit",onSelect:()=>o(c)},{label:"Delete",tone:"danger",onSelect:()=>p(c)}]:[],empty:e.jsx(ge,{icon:e.jsx(M.network,{size:18}),title:"No seller lists",body:"Group sellers you trust, or ones you run yourself, then allow or block the whole group in a routing rule."}),columns:[{key:"name",header:"Name",render:c=>e.jsx("span",{className:"gc-strong",children:e.jsx(te,{list:c,peers:s})})},{key:"sellers",header:"Sellers",render:c=>e.jsx("span",{className:"gc-muted",children:c.peerIds.length?Re(c,s):"Empty"})},{key:"count",header:"Count",align:"right",secondary:!0,render:c=>c.peerIds.length},{key:"desc",header:"Description",secondary:!0,optional:!0,render:c=>e.jsx("span",{className:"gc-muted",children:c.description??"—"})}]})}),e.jsx(E,{isOpen:i!==null,onClose:()=>o(null),title:i==="new"?"New seller list":"Edit seller list",size:"lg",children:i!==null&&e.jsx(se,{initial:i==="new"?null:i,peers:s,onDone:()=>o(null)})}),e.jsx(K,{isOpen:h!==null,busy:m.isPending,error:m.error,onClose:()=>p(null),onConfirm:()=>h&&m.mutate(h),title:"Delete this list?",confirmLabel:"Delete",body:"Policies refer to lists by reference: once deleted, the list adds no sellers to them. An allow list made only of deleted lists lets no seller serve."})]})}function De({peers:s,label:r="Manage seller lists"}){const[n,l]=f.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx(P,{variant:"link",size:"sm",onClick:()=>l(!0),children:r}),J.createPortal(e.jsx(E,{isOpen:n,onClose:()=>l(!1),title:"Seller lists",subtitle:le,size:"lg",children:e.jsx(ze,{peers:s,inDialog:!0})}),document.body)]})}function te({list:s,peers:r}){const{viewer:n}=q(),l=G(n),[a,i]=f.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"gc-link-button",title:l?`Edit the “${s.name}” list`:`See the “${s.name}” list`,onClick:()=>i(!0),children:s.name}),J.createPortal(e.jsx(E,{isOpen:a,onClose:()=>i(!1),title:l?"Edit seller list":s.name,size:"lg",subtitle:l?void 0:`${s.peerIds.length} seller${s.peerIds.length===1?"":"s"}. Organization admins edit seller lists.`,children:l?e.jsx(se,{initial:s,peers:r,onDone:()=>i(!1)}):s.peerIds.length?e.jsx("ul",{className:"gc-plain-list",children:s.peerIds.map(o=>e.jsxs("li",{children:[ee(r,o)," ",e.jsx(fe,{children:X(o,6,4)})]},o))}):e.jsx("p",{className:"gc-muted",children:"No sellers yet."})}),document.body)]})}function L(s,r,n=3){const l=s.map(a=>{var i;return((i=r==null?void 0:r.find(o=>y(o.peerId)===y(a)))==null?void 0:i.displayName)??X(a,8,4)});return l.length<=n?l.join(", "):`${l.slice(0,n).join(", ")} and ${l.length-n} more`}function W(s,r){return(s??[]).map(n=>{const l=r.find(a=>a.id===n);return l?`the “${l.name}” seller list (${l.peerIds.length})`:"a deleted seller list"}).join(", ")}function Ae(s,r,n=[]){var o,h,p,m;if(!s)return[];const l=s,a=[];if(l.allowedModels&&a.push(l.allowedModels.length===0?"No model is allowed.":`Only these models: ${l.allowedModels.join(", ")}.`),l.allowedPeerIds||l.allowedPeerLists){const u=[(o=l.allowedPeerIds)!=null&&o.length?L(l.allowedPeerIds,r):"",W(l.allowedPeerLists,n)].filter(Boolean);a.push(u.length?`Only these sellers: ${u.join(", ")}.`:"No seller is allowed.")}if((h=l.blockedPeerIds)!=null&&h.length||(p=l.blockedPeerLists)!=null&&p.length){const u=[(m=l.blockedPeerIds)!=null&&m.length?L(l.blockedPeerIds,r):"",W(l.blockedPeerLists,n)].filter(Boolean);a.push(`Never uses ${u.join(", ")}.`)}l.requireTee&&a.push("Only sellers running in a TEE."),l.requireVerified&&a.push("Only sellers with a verified domain or GitHub account."),l.minTrustScore!==void 0&&a.push(`Only sellers with trust ${l.minTrustScore} or more.`),l.minReputation!==void 0&&a.push(`Only sellers with reputation ${l.minReputation} or more.`);const i=[l.maxInputUsdPerMillion!==void 0?`${b(l.maxInputUsdPerMillion)}/M input`:null,l.maxOutputUsdPerMillion!==void 0?`${b(l.maxOutputUsdPerMillion)}/M output`:null,l.maxCachedInputUsdPerMillion!==void 0?`${b(l.maxCachedInputUsdPerMillion)}/M cached input`:null,l.maxImageUsdPerImage!==void 0?`$${l.maxImageUsdPerImage} per image`:null].filter(u=>u!==null);i.length&&a.push(`Pays at most ${i.join(", ")}.`);for(const[u,c]of Object.entries(l.modelRoutes??{}))a.push(`For ${u}: tries ${L(c.peerIds,r,4).replace(/, ([^,]*)$/,", then $1")} first${c.strict?", and no other seller":""}.`);return l.sort==="price"?a.push("Ranks the cheapest seller first."):l.sort==="latency"?a.push("Ranks the fastest seller first."):l.sort==="trust"&&a.push("Ranks the most trusted seller first."),l.preferFreePeers&&a.push("Free sellers first."),a}function Ve(s,r,n,l){var o,h;const a=y(r.peerId);if((o=s.blockedPeerIds)!=null&&o.some(p=>y(p)===a))return"blocks it";if(s.allowedPeerIds&&!s.allowedPeerIds.some(p=>y(p)===a))return"does not allow it";if(s.requireTee&&n&&!n.tee)return"requires a TEE";if(s.requireVerified&&n&&!n.verified)return"requires a verified seller";if(s.minTrustScore!==void 0&&(r.trustScore??0)<s.minTrustScore)return`requires trust ${s.minTrustScore}+ (it has ${Math.round(r.trustScore??0)})`;if(s.minReputation!==void 0&&n&&(n.reputationScore??0)<s.minReputation)return`requires reputation ${s.minReputation}+`;if(s.maxInputUsdPerMillion!==void 0&&r.inputUsdPerMillion!==null&&r.inputUsdPerMillion>s.maxInputUsdPerMillion)return`caps input at ${b(s.maxInputUsdPerMillion)}/M (it asks ${b(r.inputUsdPerMillion)})`;if(s.maxOutputUsdPerMillion!==void 0&&r.outputUsdPerMillion!==null&&r.outputUsdPerMillion>s.maxOutputUsdPerMillion)return`caps output at ${b(s.maxOutputUsdPerMillion)}/M (it asks ${b(r.outputUsdPerMillion)})`;const i=(h=s.modelRoutes)==null?void 0:h[l];return i!=null&&i.strict&&!i.peerIds.some(p=>y(p)===a)?"only allows its route for this model":null}function Be(s,r,n,l=[]){if(r.eligible)return[];const a=n==null?void 0:n.find(i=>y(i.peerId)===y(r.peerId));return s.sources.flatMap(i=>{if(!i.policy)return[];const o=Ve(je(i.policy,l),r,a,s.model);return o?[{level:i.level,levelId:i.id,rule:o}]:[]})}function es(s,r,n=[]){const l=new Map;for(const a of(s==null?void 0:s.candidates)??[])for(const i of new Set(Be(s,a,r,n).map(o=>o.level)))l.set(i,(l.get(i)??0)+1);return l}function We({draft:s,parent:r,above:n,peers:l,lists:a}){const i=f.useMemo(()=>{try{return Ie(s,a)}catch{return null}},[s,a]),o=f.useMemo(()=>!i||!l||l.length===0?null:{matched:ke(Z(r,i),l,a).length,total:l.length},[i,r,l,a]),h=i?Ae(i,l,a):[];return e.jsxs("section",{className:"gc-policy__summary","aria-live":"polite",children:[e.jsxs("div",{className:"gc-policy__summary-head",children:[e.jsx("span",{className:"gc-strong",children:"What this level does"}),o&&o.matched>0&&e.jsxs("span",{className:"gc-muted",children:[o.matched," of ",o.total," sellers can serve",n?` after ${n}`:""]})]}),h.length?e.jsx("ul",{className:"gc-funnel__rules",children:h.map(p=>e.jsx("li",{children:p},p))}):e.jsx("p",{className:"gc-funnel__none",children:"Nothing of its own yet: it passes on everything above."}),o&&o.matched===0&&e.jsxs(Se,{tone:"warning",title:"No seller matches this policy",children:["With ",n?`${n} and `:"","these settings, none of the ",o.total," sellers this gateway sees can serve a request. Requests will fail until you loosen it."]})]})}function w({title:s,help:r,children:n}){return e.jsxs("section",{className:"gc-policy__group",children:[e.jsxs("div",{className:"gc-policy__group-head",children:[e.jsx("h3",{children:s}),e.jsx("p",{className:"gc-fineprint",children:r})]}),e.jsx("div",{className:"gc-policy__group-body",children:n})]})}function ss({value:s,onChange:r,peers:n,lists:l,showTemplates:a=!0,parent:i,disabled:o}){const[h,p]=f.useState(""),[m,u]=f.useState(null),c=(t,x)=>r({...s,[t]:x}),v=be(n),j=ye(Pe().data),d=f.useMemo(()=>j||i?Z(j,i):null,[j,i]),ne=j&&i?"the buyer config and the levels above":j?"the buyer config":i?"the levels above":"",U=t=>(j==null?void 0:j[t])!==void 0&&j[t]===(d==null?void 0:d[t])?"The buyer config":"The levels above",{viewer:re}=q(),ie=Ne("settings",re)?e.jsx("a",{className:"gc-link",href:we("settings?tab=buyer"),onClick:ve("settings?tab=buyer"),children:"Change"}):null,ae=t=>U(t)==="The buyer config"?ie:null;function F(t,x=h){var z;let g;if(t==="own"){const k=l.find(ue=>ue.id===x);if(!k)return;g={allowMode:"only",allowedPeerIds:[],allowedListIds:[k.id]}}else g=Ce(_e(t));const N=$e(s,g),de=((z=D.find(k=>k.id===t))==null?void 0:z.label)??t;N.length>0?u({label:de,template:g,conflicts:N}):r(V(s,g))}function _(t,x){c("routes",s.routes.map((g,N)=>N===t?x:g))}const I=(t,x)=>e.jsx(C,{size:"sm",className:"gc-num",label:x,inputMode:"decimal",value:s[t],placeholder:(d==null?void 0:d[t])!==void 0?`≤ ${b(d[t])} above`:"No cap",onChange:g=>c(t,g.target.value)}),oe="",ce=t=>{if(t==="clear")return r(Me());if(t.startsWith("list:"))return p(t.slice(5)),F("own",t.slice(5));t&&F(t)},R=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"gc-policy__top",children:[e.jsx(We,{draft:s,parent:d,above:ne,peers:n,lists:l}),a&&!o&&e.jsx($,{size:"sm","aria-label":"Start from a template",value:oe,onChange:ce,options:[{value:"",label:"Start from…"},...D.filter(t=>t.id!=="own").map(t=>({value:t.id,label:`${t.label}: ${t.description}`})),...l.map(t=>({value:`list:${t.id}`,label:`Only the “${t.name}” list (${t.peerIds.length})`})),{value:"clear",label:"Clear every setting"}]})]}),e.jsxs(w,{title:"Sellers",help:e.jsxs(e.Fragment,{children:["Who may serve requests. Blocked sellers never serve. ",e.jsx(De,{peers:n})]}),children:[e.jsx(B,{label:"Which sellers may serve",value:s.allowMode,onChange:t=>c("allowMode",t),options:[{value:"any",label:"Any seller"},{value:"only",label:"Only these"}]}),s.allowMode==="only"&&e.jsxs(e.Fragment,{children:[e.jsx(H,{label:"Seller lists",lists:l,value:s.allowedListIds,onChange:t=>c("allowedListIds",t),peers:n}),e.jsx(S,{label:l.length?"And these sellers":"Allowed sellers",value:s.allowedPeerIds,onChange:t=>c("allowedPeerIds",t),peers:n}),s.allowedPeerIds.length===0&&s.allowedListIds.length===0&&e.jsx("p",{className:"gc-warn",children:"An empty allow list means no seller can serve."})]}),e.jsx(S,{label:"Never use",value:s.blockedPeerIds,onChange:t=>c("blockedPeerIds",t),peers:n}),e.jsx(H,{label:"Never use these lists",lists:l,value:s.blockedListIds,onChange:t=>c("blockedListIds",t),peers:n})]}),e.jsxs(w,{title:"Quality",help:"How trusted a seller must be, and what it must run, to serve.",children:[e.jsx(He,{label:"Minimum trust score",info:e.jsx(Ue,{}),value:s.minTrustScore,onChange:t=>c("minTrustScore",t),floor:d==null?void 0:d.minTrustScore,floorSource:U("minTrustScore"),floorAction:ae("minTrustScore")}),s.minReputation!==""&&e.jsxs("p",{className:"gc-fineprint",children:["This policy also asks for reputation ",s.minReputation," or more, an older score the trust score replaces."," ",e.jsx(P,{variant:"link",size:"sm",onClick:()=>c("minReputation",""),children:"Remove it"})]}),e.jsxs("div",{className:"gc-policy__switches",children:[e.jsx(T,{checked:s.requireTee||!!(d!=null&&d.requireTee),disabled:!!(d!=null&&d.requireTee),onChange:t=>c("requireTee",t),label:"TEE sellers only"}),e.jsx(T,{checked:s.requireVerified||!!(d!=null&&d.requireVerified),disabled:!!(d!=null&&d.requireVerified),onChange:t=>c("requireVerified",t),label:"Verified sellers only"})]}),((d==null?void 0:d.requireTee)||(d==null?void 0:d.requireVerified))&&e.jsxs("span",{className:"as-field__hint",children:[d.requireTee&&d.requireVerified?"TEE and verified sellers are":d.requireTee?"TEE sellers are":"Verified sellers are"," already required above."]})]}),e.jsx(w,{title:"Price limits",help:"Sellers asking more are skipped. Leave a field empty for no limit.",children:e.jsxs("div",{className:"gc-policy__caps",children:[I("maxInputUsdPerMillion","Input $/M"),I("maxOutputUsdPerMillion","Output $/M"),I("maxCachedInputUsdPerMillion","Cached input $/M"),I("maxImageUsdPerImage","$ per image")]})}),e.jsxs(w,{title:"Models",help:"Requests for any other model are refused.",children:[e.jsx(B,{label:"Which models may be used",value:s.modelsMode,onChange:t=>c("modelsMode",t),options:[{value:"any",label:"Any model"},{value:"only",label:"Only these models"}]}),s.modelsMode==="only"&&e.jsx(Te,{label:"Allowed models",value:s.allowedModels,onChange:t=>c("allowedModels",t),suggestions:v,placeholder:"Model id"})]}),e.jsxs(w,{title:"Ranking",help:"The order the allowed sellers are tried in. Inherit keeps automatic routing, which ranks by expected cost and success rate.",children:[e.jsxs("div",{className:"gc-policy__pair",children:[e.jsx($,{size:"sm",label:"Sort by",value:s.sort,onChange:t=>c("sort",t),options:[{value:"",label:"Inherit"},...Object.keys(A).map(t=>({value:t,label:A[t]}))]}),e.jsx($,{size:"sm",label:"Free sellers first",value:s.preferFreePeers,onChange:t=>c("preferFreePeers",t),options:[{value:"inherit",label:"Inherit"},{value:"yes",label:"Yes"},{value:"no",label:"No"}]})]}),e.jsxs(Oe,{title:"Fallback chains",summary:s.routes.length?`${s.routes.length} chain${s.routes.length===1?"":"s"}`:"None",defaultOpen:s.routes.length>0,children:[e.jsx("p",{className:"gc-fineprint",children:"Sellers to try first for a model, in order. After the chain, normal ranking continues unless the chain is strict."}),s.routes.map((t,x)=>e.jsxs("div",{className:"gc-route",children:[e.jsxs("div",{className:"gc-inline",children:[e.jsx(C,{size:"sm",label:"Model",list:"gc-policy-models",value:t.model,placeholder:"Model id",onChange:g=>_(x,{...t,model:g.target.value})}),e.jsx(T,{checked:t.strict,onChange:g=>_(x,{...t,strict:g}),label:"Strict"}),e.jsx(P,{variant:"ghost",size:"sm",onClick:()=>c("routes",s.routes.filter((g,N)=>N!==x)),children:"Remove"})]}),e.jsx(S,{label:"Sellers, in order",ordered:!0,value:t.peerIds,onChange:g=>_(x,{...t,peerIds:g}),peers:n})]},x)),e.jsx("datalist",{id:"gc-policy-models",children:v.map(t=>e.jsx("option",{value:t},t))}),e.jsx("div",{children:e.jsx(P,{variant:"outline",size:"sm",onClick:()=>c("routes",[...s.routes,{model:"",peerIds:[],strict:!1}]),children:"Add fallback chain"})})]})]}),e.jsx(K,{isOpen:m!==null,tone:"primary",title:`Apply “${(m==null?void 0:m.label)??""}”?`,confirmLabel:"Replace and apply",body:e.jsxs(e.Fragment,{children:["This template changes settings you already set: ",e.jsx("strong",{children:m==null?void 0:m.conflicts.join(", ")}),". Your other settings stay."]}),onClose:()=>u(null),onConfirm:()=>{m&&r(V(s,m.template)),u(null)}})]});return o?e.jsx("fieldset",{className:"gc-policy gc-policy--readonly",disabled:!0,children:R}):e.jsx("div",{className:"gc-policy",children:R})}function He({label:s,info:r,value:n,onChange:l,clearable:a=!0,hint:i,floor:o,floorSource:h="The levels above",floorAction:p}){const m=f.useId(),u=n!=="",c=o!==void 0&&o>0,v=c&&u&&Number(n)<=o,j=v?String(o):u?n:c?`${o} inherited`:"Inherit";return e.jsxs("div",{className:"gc-slider",children:[e.jsxs("div",{className:"gc-slider__head",children:[e.jsxs("span",{className:"gc-info-label",children:[e.jsx("span",{className:"as-field__label",id:m,children:s}),r]}),e.jsx("span",{className:u?"gc-slider__value":"gc-slider__value gc-slider__value--inherit",children:j})]}),e.jsxs("div",{className:"gc-inline",children:[e.jsx("input",{type:"range",min:0,max:100,step:5,value:u?Math.max(Number(n),c?o:0):c?o:0,"aria-labelledby":m,onChange:d=>l(String(Math.max(Number(d.target.value),c?o:0)))}),a&&u&&e.jsx(P,{variant:"ghost",size:"sm",onClick:()=>l(""),children:"Clear"})]}),c&&(u&&!v?e.jsxs("span",{className:"as-field__hint",children:[h," requires ≥ ",o,". Only a higher value narrows it."]}):e.jsxs("span",{className:"as-field__hint gc-override",children:[e.jsx(M.lock,{size:12})," Locked at ",o," by ",h.replace(/^The /,"the "),".",p?e.jsxs(e.Fragment,{children:[" ",p]}):null]})),i&&e.jsx("span",{className:"as-field__hint",children:i})]})}function H({label:s,lists:r,value:n,onChange:l,peers:a}){return r.length===0?null:e.jsxs("fieldset",{className:"gc-checks",children:[e.jsx("legend",{className:"as-field__label",children:s}),r.map(i=>e.jsxs("span",{className:"gc-check",children:[e.jsx("input",{type:"checkbox","aria-label":`${s}: ${i.name}`,checked:n.includes(i.id),onChange:o=>l(o.target.checked?[...n,i.id]:n.filter(h=>h!==i.id))}),e.jsx(te,{list:i,peers:a})," ",e.jsxs("span",{className:"gc-muted",children:["(",i.peerIds.length,")"]})]},i.id))]})}export{ze as P,He as S,Ue as T,es as a,ss as b,De as c,Be as e,Ae as p};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{be as p,r as d,j as e,D as m,bo as x,bp as b,bq as v,v as j,bl as y,bk as w,bn as f,b as C,B as h,C as k}from"./index-DPXW_JSn.js";import{b as S}from"./PolicyEditor-COREmE0O.js";function B(){const a=p(),[s,n]=d.useState(null),l=d.useRef(null),r=t=>new Promise(u=>{l.current=u,n(t)}),o=t=>{var u;n(null),(u=l.current)==null||u.call(l,t),l.current=null},i=(t,u)=>x(t.some(g=>b(g,a.data??null)),u,r),c=(s==null?void 0:s.kind)==="narrowed"?e.jsx(m,{isOpen:!0,tone:"primary",title:"The levels above allow less",confirmLabel:"Save anyway",cancelLabel:"Go back",onClose:()=>o(!1),onConfirm:()=>o(!0),body:e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsx("span",{children:"Part of this change has no effect, because a workspace, member or admin restriction above it is tighter. Saving stores it as you entered it; only what the levels above allow applies."}),s.lines.length>0&&e.jsx("ul",{className:"gc-list",children:s.lines.map(t=>e.jsx("li",{children:t},t))})]})}):e.jsx(m,{isOpen:(s==null?void 0:s.kind)==="empty",tone:"danger",title:"Save an empty allow list?",confirmLabel:"Save anyway",cancelLabel:"Go back",onClose:()=>o(!1),onConfirm:()=>o(!0),body:e.jsxs(e.Fragment,{children:["With this allow list ",e.jsx("strong",{children:"no seller can serve"})," requests here (it names no seller, or none the levels above allow), so they fail until you change it. To let any seller serve, choose “Any seller” instead."]})});return{save:i,dialog:c}}function P({policy:a,invalid:s,empty:n="Inherits everything"}){if(s)return e.jsx("span",{className:"gc-warn",children:"Has an invalid setting; open it to fix."});const l=v(a);return l.length===0?e.jsx("span",{className:"gc-muted",children:n}):e.jsx("span",{className:"gc-chiprow",children:l.map(r=>e.jsx(j,{children:r},r))})}function D(a){const[s,n]=d.useState(()=>y(a)),l=p();return{draft:s,setDraft:n,reset:r=>n(y(r)),build:()=>w(f(s,l.data??null))}}function N(a,s){try{return{policy:f(a,s),error:null}}catch(n){return{policy:null,error:n instanceof Error?n.message:String(n)}}}function O({draft:a,setDraft:s,title:n="Routing policy"}){const l=C(),r=p(),[o,i]=d.useState(null),c=N(a,r.data??null),t=()=>{o&&s(o),i(null)};return e.jsxs("div",{className:"gc-policy-row",children:[e.jsxs("div",{className:"gc-policy-row__text",children:[e.jsx("span",{className:"as-field__label",children:n}),e.jsx(P,{policy:c.policy,invalid:c.error!==null})]}),e.jsx(h,{size:"sm",variant:"outline",onClick:()=>i(a),children:"Edit"}),e.jsx(k,{isOpen:o!==null,onClose:()=>i(null),size:"xl",title:n,subtitle:"Blank settings inherit from the level above, which this can only narrow. Saved with the form.",footer:e.jsxs(e.Fragment,{children:[c.error&&e.jsx("span",{className:"gc-warn gc-footer-note",children:c.error}),e.jsx(h,{variant:"ghost",onClick:t,children:"Cancel"}),e.jsx(h,{onClick:()=>i(null),children:"Done"})]}),children:e.jsx(S,{value:a,onChange:s,peers:l.data,lists:r.data??[]})})]})}export{O as P,B as a,N as d,D as u};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{u as A,i as J,b5 as B,r as n,t as E,j as e,P as $,B as v,I as k,l as L,Q as R,M as Q,av as U,v as C,A as V,E as W,n as F,C as G,D as H,b as K,T as j,b6 as _,o as X,q as O,f as y}from"./index-DPXW_JSn.js";import{u as Y,a as Z,P as ee}from"./PolicyField-ldIq_Yw-.js";import{D as se}from"./DataTable-BCgVRqY6.js";import{S as re}from"./SelectField-m1sMIgMa.js";import{T as N}from"./TextAreaField-BCi-qMua.js";import"./PolicyEditor-COREmE0O.js";import"./PeerPicker-CcMSXxY3.js";import"./Segmented-DYnoemT9.js";import"./roving-DkptacxO.js";import"./Switch-Db8Sm64J.js";import"./Disclosure-CQMtWM0M.js";function D(s){return s.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)}function te(s){return/^[a-z0-9][a-z0-9-]{0,47}$/.test(s)}function ae(s){if(!s.trim())return{};let a;try{a=JSON.parse(s)}catch{throw new Error("Parameters must be valid JSON.")}if(!a||typeof a!="object"||Array.isArray(a))throw new Error('Parameters must be a JSON object, like {"temperature": 0.2}.');return a}function oe({initial:s,prefill:a,onDone:m}){const{workspace:p,viewer:c}=A(),u=K(),[o,g]=n.useState((s==null?void 0:s.name)??(a==null?void 0:a.name)??""),[l,d]=n.useState((s==null?void 0:s.slug)??(a?D(a.name):"")),[t,q]=n.useState(!!s),[h,I]=n.useState((s==null?void 0:s.model)??(a==null?void 0:a.model)??""),[b,M]=n.useState(s?s.workspaceId??"":p.id),[S,T]=n.useState((s==null?void 0:s.systemPrompt)??""),[w,z]=n.useState(s&&Object.keys(s.params).length?JSON.stringify(s.params,null,2):""),x=Y(s==null?void 0:s.routingPolicy),P=Z(),i=E({mutationFn:()=>{if(!te(l))throw new Error("Slug must be lowercase letters, numbers and dashes.");const r={name:o.trim(),slug:l,model:h.trim(),workspaceId:b||null,systemPrompt:S.trim()||null,params:ae(w),routingPolicy:x.build()};return P.save([r.routingPolicy],f=>s?y.presets.update(s.id,r,f):y.presets.create(r,f))},onSuccess:r=>m(r),invalidate:[O.group("presets")],toast:"Preset saved"});return e.jsxs("form",{className:"gc-stack",onSubmit:r=>{r.preventDefault(),i.mutate()},children:[e.jsxs("div",{className:"gc-grid gc-grid--2",children:[e.jsx(j,{label:"Name",required:!0,value:o,onChange:r=>{g(r.target.value),t||d(D(r.target.value))}}),e.jsx(j,{label:"Slug",required:!0,value:l,onChange:r=>{q(!0),d(r.target.value)},hint:e.jsxs(e.Fragment,{children:["Called as ",e.jsxs("code",{children:["@preset/",l||"slug"]})]})})]}),e.jsxs("div",{className:"gc-grid gc-grid--2",children:[e.jsx(j,{label:"Model",required:!0,list:"gc-preset-models",value:h,onChange:r=>I(r.target.value)}),e.jsx("datalist",{id:"gc-preset-models",children:_(u.data).map(r=>e.jsx("option",{value:r},r))}),e.jsx(re,{label:"Available in",value:b,onChange:M,options:[{value:p.id,label:`${p.name} workspace`},...F(c)?[{value:"",label:"All workspaces"}]:[]]})]}),e.jsx(N,{label:"System prompt",rows:4,value:S,onChange:r=>T(r.target.value),hint:"Added before the client's messages."}),e.jsx(N,{label:"Parameters (JSON)",rows:4,mono:!0,value:w,placeholder:`{
|
|
2
|
+
"temperature": 0.2,
|
|
3
|
+
"max_tokens": 2048
|
|
4
|
+
}`,onChange:r=>z(r.target.value),hint:"Defaults merged under the client's own parameters."}),e.jsx(ee,{draft:x.draft,setDraft:x.setDraft}),i.error?e.jsx(X,{error:i.error,title:"Could not save the preset"}):null,e.jsxs("div",{className:"gc-actions",children:[e.jsx(v,{variant:"ghost",onClick:()=>m(),children:"Cancel"}),e.jsx(v,{type:"submit",disabled:i.isPending||!o.trim()||!h.trim(),children:i.isPending?"Saving…":"Save preset"})]}),P.dialog]})}function je(){const{workspace:s,viewer:a}=A(),m=J(a),p=B(s.id),[c,u]=n.useState(null),[o,g]=n.useState(null),l=E({mutationFn:d=>y.presets.remove(d.id),onSuccess:()=>g(null),invalidate:[O.group("presets")]});return e.jsxs("div",{className:"gc-page",children:[e.jsx($,{title:"Presets",description:e.jsxs(e.Fragment,{children:["A saved model, prompt, parameters and routing. Use one by sending ",e.jsx("code",{children:'"model": "@preset/<slug>"'}),"."]}),actions:m&&e.jsx(v,{variant:"brand",leadingIcon:e.jsx(k.plus,{size:14}),onClick:()=>u("new"),children:"New preset"})}),e.jsx(L,{flush:!0,children:e.jsx(R,{query:p,children:d=>e.jsx(se,{label:"Presets",rows:d,rowKey:t=>t.id,rowLabel:t=>t.name,actions:t=>m&&(t.workspaceId||F(a))?[{label:"Edit",onSelect:()=>u(t)},{label:"Delete",tone:"danger",onSelect:()=>g(t)}]:[],empty:e.jsx(W,{icon:e.jsx(k.presets,{size:18}),title:"No presets yet",body:"Presets let every client share one tuned setup without changing code."}),columns:[{key:"name",header:"Name",render:t=>e.jsx("span",{className:"gc-strong",children:t.name})},{key:"usage",header:"Use as model",render:t=>e.jsxs("span",{className:"gc-inline gc-inline--wrap",children:[e.jsxs(Q,{children:["@preset/",t.slug]}),e.jsx(U,{value:`@preset/${t.slug}`})]})},{key:"model",header:"Model",secondary:!0,render:t=>t.model},{key:"scope",header:"Scope",secondary:!0,render:t=>t.workspaceId?e.jsx(C,{children:"Workspace"}):e.jsx(C,{tone:"info",children:"All workspaces"})},{key:"policy",header:"Routing",secondary:!0,optional:!0,render:t=>e.jsx("span",{className:"gc-muted",children:V(t.routingPolicy)})}]})})}),e.jsx(G,{isOpen:c!==null,onClose:()=>u(null),size:"lg",title:c==="new"?"New preset":"Edit preset",children:c!==null&&e.jsx(oe,{initial:c==="new"?null:c,onDone:()=>u(null)})}),e.jsx(H,{isOpen:o!==null,busy:l.isPending,error:l.error,onClose:()=>g(null),onConfirm:()=>o&&l.mutate(o),title:"Delete this preset?",confirmLabel:"Delete preset",body:e.jsxs(e.Fragment,{children:["Requests that use ",e.jsxs("code",{children:["@preset/",o==null?void 0:o.slug]})," will fail."]})})]})}export{oe as PresetForm,je as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bS as Ue,ag as me,aP as Ve,u as H,a as he,F as _e,G as ze,n as qe,i as ge,r as y,U as Ke,c as fe,e as Ge,bT as Qe,bm as Ye,$ as U,bU as He,bV as Je,f as q,an as We,j as s,C as we,af as K,o as pe,B as P,L as ye,A as Ze,w as A,M as be,av as ve,v as F,aa as Xe,bQ as I,ad as ke,ae as xe,h as je,Z as es,b0 as Pe,bW as Se,T as Ce,aZ as ss,b5 as ts,bX as as,Y as rs,a$ as ns,O as Ie,R as os,br as ls,b as is,b6 as cs,bY as ds,bu as us,E as re,I as ne,l as ms,Q as hs,bv as gs,b2 as oe,bZ as fs,y as le,b3 as ws,bL as ps,P as ys}from"./index-DPXW_JSn.js";import{p as G}from"./PeerPicker-CcMSXxY3.js";import{S as N}from"./SelectField-m1sMIgMa.js";import{V as $e,T as Ne}from"./VerificationLinks-CWyl6ZEp.js";import{P as Ae,a as bs,p as vs,S as ks}from"./SidePanel-BFQArkoa.js";import{c as xs}from"./PolicyEditor-COREmE0O.js";import{f as js}from"./ants-B38m9Phv.js";import{PresetForm as Ps}from"./Presets-DFKw93HK.js";import{T as Ss,a as Cs}from"./Tabs-CCabxVNK.js";import{D as Is}from"./DataTable-BCgVRqY6.js";import{S as Q}from"./Switch-Db8Sm64J.js";import"./Segmented-DYnoemT9.js";import"./roving-DkptacxO.js";import"./Disclosure-CQMtWM0M.js";import"./PolicyField-ldIq_Yw-.js";import"./TextAreaField-BCi-qMua.js";function Fe(e,t="admin"){return t==="owner"&&Ve(e)?"ownerRoutingPolicy":"routingPolicy"}async function Te(e,t){const r=(await e.keys.list({workspace:t.workspaceId})).find(n=>n.id===t.keyId);if(!r)throw new Error("That key no longer exists.");return r}async function Me(e,t){switch(t.kind){case"gateway":return e.network.gatewayPolicy();case"workspace-org":return(await e.workspaces.get(t.workspaceId)).orgRoutingPolicy;case"workspace":return(await e.workspaces.get(t.workspaceId)).routingPolicy;case"member":{const r=(await e.members.list()).find(n=>n.id===t.memberId);if(!r)throw new Error("That member no longer exists.");return r.routingPolicy}case"key":{const r=await Te(e,t);return r[Fe(r,t.layer)]??null}}}async function $s(e,t,r,n){const l=n!=null&&n.confirmEmpty||n!=null&&n.acceptNarrowed?[n]:[];switch(t.kind){case"gateway":await e.network.setGatewayPolicy(r??{},...l);return;case"workspace-org":await e.workspaces.update(t.workspaceId,{orgRoutingPolicy:r},...l);return;case"workspace":await e.workspaces.update(t.workspaceId,{routingPolicy:r},...l);return;case"member":await e.members.update(t.memberId,{routingPolicy:r},...l);return;case"key":{const o=t.layer==="owner"?Fe(await Te(e,t),"owner"):"routingPolicy";await e.keys.update(t.keyId,{[o]:r},...l);return}}}const ie=e=>JSON.stringify(e??{},Object.keys(e??{}).sort());async function Ns(e,t,r,n,l,o){const g=await Me(e,t),d=Ue(g,r,n,l),m=ie(g)!==ie(d)||JSON.stringify(g??{})!==JSON.stringify(d);return m&&await $s(e,t,d,o),{before:g,after:d,changed:m}}function As(e,t,r){return e.kind==="key"?{model:t,key:e.keyId,workspace:e.workspaceId}:e.kind==="member"?{model:t,member:e.memberId,workspace:r}:e.kind==="gateway"?{model:t,workspace:r}:{model:t,workspace:e.workspaceId}}const Fs={allow:"Allowed",block:"Blocked",prefer:"Preferred"};function Ts(e){const{action:t,name:r,scopeLabel:n,changed:l,model:o,preview:g,peerId:d}=e,m=Fs[t],k=t==="prefer"?`already first for ${o}`:`already ${m.toLowerCase()}`,h=l?`${m} ${r} ${t==="prefer"?`for ${o} `:""}on ${n}`:`${r} was ${k} on ${n}; nothing changed`;if(!g)return t==="block"?{tone:l?"success":"info",text:`${h}.`}:{tone:"info",text:`${h}. ${e.previewError?`Could not check whether it can serve: ${e.previewError}`:"Could not check whether it can serve."}`};const u=g.candidates.find(p=>me(p.peerId,d));if(t==="block")return u!=null&&u.eligible?{tone:"warning",text:`${h}, but the route preview still lists it as eligible for ${o}. Reload and check the policy.`}:{tone:l?"success":"info",text:`${h}.`};if(!g.modelAllowed)return{tone:"warning",text:`${h}, but ${o} is not an allowed model here, so it still cannot serve it.`};if(!u)return{tone:"info",text:`${h}. It does not offer ${o} right now, so the preview cannot show its rank.`};if(!u.eligible){const p=u.reasons.length?u.reasons.join("; "):"another level excludes it";return{tone:"warning",text:`${h}, but it still cannot serve ${o} here: ${p}.`}}return t==="prefer"&&u.rank!==null&&u.rank>1?{tone:"warning",text:`${h}, but it ranks #${u.rank} for ${o}: a fallback chain on another level comes first.`}:{tone:l?"success":"info",text:`${h}.${u.rank?` It ranks #${u.rank} for ${o}.`:""}`}}function Ms(e,t,r,n){return e==="gateway"?{kind:e}:e==="workspace"||e==="workspace-org"?{kind:e,workspaceId:r}:t?e==="member"?{kind:e,memberId:t}:{kind:"key",keyId:t,workspaceId:r,layer:n?"admin":"owner"}:null}function Ls(e){return e.canForce?"Not allowed above":e.tone==="warning"?"Check the result":"Done"}function Rs({fetching:e,error:t,ready:r,policy:n}){return e?s.jsx(ye,{rows:1}):t?s.jsx(pe,{error:t,title:"Could not load this scope's policy"}):r?s.jsxs("p",{className:"gc-muted",children:["Current policy: ",Ze(n)]}):null}const ce={allow:{title:"Allow seller",verb:"Allow"},block:{title:"Block seller",verb:"Block"},prefer:{title:"Prefer seller",verb:"Prefer"}};function Le({peer:e,action:t,onClose:r,peers:n}){var W,Z,X,ee;const{viewer:l,workspace:o,me:g}=H(),d=he(),m=_e(),k=ze(),h=qe(l),u=ge(l),p=[...h?[{value:"gateway",label:"Gateway default (everyone)"}]:[],...h?[{value:"workspace-org",label:`${o.name}: organization policy`}]:[],...u?[{value:"workspace",label:`${o.name}: workspace policy`}]:[],...h?[{value:"member",label:"A member"}]:[],{value:"key",label:"An API key"}],[w,$]=y.useState(p[0].value),[i,a]=y.useState(""),[b,R]=y.useState(""),B=Ke(w==="member"),E=fe(d,w==="key");y.useEffect(()=>{a("")},[w]),y.useEffect(()=>{var c;R(((c=e==null?void 0:e.services[0])==null?void 0:c.service)??"")},[e]);const f=(E.data??[]).filter(c=>c.status==="active"&&(u||c.ownerMemberId===g.member.id)),v=Ms(w,i,o.id,u),[S,M]=y.useState(null);y.useEffect(()=>{M(null)},[w,i,e]);const O=Ge({queryKey:["routing","scope-policy",v],queryFn:()=>Me(q,v),enabled:v!==null&&e!==null,staleTime:0}),D=v!==null&&O.isSuccess&&(t!=="prefer"||b!==""),C=O.data??null,Ee=t==="allow"&&D&&!(C!=null&&C.allowedPeerIds)&&!(C!=null&&C.allowedPeerLists),Oe=t==="block"&&D&&e!==null&&Qe(C,e.peerId);let L=((W=p.find(c=>c.value===w))==null?void 0:W.label.replace(/^A[n]? /,"the "))??"this scope";w==="key"&&(L=`key “${((Z=f.find(c=>c.id===i))==null?void 0:Z.label)??i}”`),w==="member"&&(L=`member “${((ee=(X=B.data)==null?void 0:X.find(c=>c.id===i))==null?void 0:ee.label)??i}”`);const x=Ye({mutationFn:async(c={})=>{var ae;if(!e||!v)return null;const j=b||((ae=e.services[0])==null?void 0:ae.service)||"",{changed:z}=await Ns(q,v,t,e.peerId,b||void 0,c);let se=null,te=null;if(j)try{se=await q.network.routePreview(As(v,j,o.id))}catch(De){te=We(De)}return Ts({action:t,name:G(n,e.peerId),scopeLabel:L,changed:z,model:j,preview:se,peerId:e.peerId,previewError:te})},onSuccess:c=>{for(const j of Je)m.invalidateQueries({queryKey:[j]});c&&(c.tone==="success"?(k(c.text),r()):M(c))},onError:c=>{const j=e?G(n,e.peerId):"this seller";if(U(c,"narrowed"))M({tone:"warning",canForce:!0,text:`Nothing changed yet. The levels above ${L} do not allow ${j}, so saving this would not let it serve. ${He(c.details).join(" ")}`.trim()});else if(U(c,"empty_allow_list")){const z=t==="block"?`Blocking ${j}`:`Allowing only ${j}`;M({tone:"warning",text:`Nothing changed. ${z} on ${L} would leave no seller that the levels above allow, so requests would fail. Change the policy on the Routing page if you really want that.`})}}}),_=e?G(n,e.peerId):"";return s.jsx(we,{isOpen:e!==null,onClose:r,title:ce[t].title,subtitle:_,children:s.jsxs("div",{className:"gc-stack",children:[s.jsx(N,{label:"Apply to",value:w,onChange:c=>$(c),options:p}),w==="member"&&s.jsx(N,{label:"Member",value:i,onChange:a,options:[{value:"",label:"Choose a member"},...(B.data??[]).filter(c=>c.status!=="disabled").map(c=>({value:c.id,label:c.label}))]}),w==="key"&&s.jsx(N,{label:"Key",value:i,onChange:a,options:[{value:"",label:f.length?"Choose a key":"No keys you can edit"},...f.map(c=>({value:c.id,label:c.label}))]}),t==="prefer"&&e&&s.jsx(N,{label:"For model",value:b,onChange:R,options:e.services.map(c=>({value:c.service,label:c.service})),hint:"The seller goes first in this model's fallback chain."}),s.jsx(Rs,{fetching:O.isFetching,error:O.error,ready:D,policy:C}),Ee&&s.jsxs(K,{tone:"warning",children:["This scope has no allow list yet. Allowing ",_," creates one, so only allowed sellers can serve it."]}),Oe&&s.jsxs(K,{tone:"warning",title:"This is the only allowed seller",children:["Blocking ",_," empties this scope's allow list, so the allow list is removed: any seller that is not blocked may serve it again."]}),t==="block"&&s.jsx("p",{className:"gc-muted",children:"Blocked sellers never serve this scope or anything under it."}),w==="key"&&!u&&s.jsx("p",{className:"gc-muted",children:"This changes your own restrictions on the key. Restrictions a workspace admin set still apply."}),x.error&&!U(x.error,"narrowed")&&!U(x.error,"empty_allow_list")?s.jsx(pe,{error:x.error,title:"Could not update the policy"}):null,S?s.jsxs(s.Fragment,{children:[s.jsx(K,{tone:S.tone,title:Ls(S),children:S.text}),s.jsxs("div",{className:"gc-actions",children:[S.canForce&&s.jsx(P,{variant:"ghost",disabled:x.isPending,onClick:()=>{M(null),x.mutate({acceptNarrowed:!0})},children:"Save it anyway"}),s.jsx(P,{onClick:r,children:S.canForce?"Cancel":"Done"})]})]}):s.jsxs("div",{className:"gc-actions",children:[s.jsx(P,{variant:"ghost",onClick:r,children:"Cancel"}),s.jsx(P,{variant:t==="block"?"danger":"primary",disabled:!D||x.isPending,onClick:()=>x.mutate({}),children:x.isPending?"Saving…":ce[t].verb})]})]})})}function Re(e,t){return t?e.services.filter(r=>r.service===t):e.services}function V(e,t,r=""){const n=Re(e,r).map(l=>l[t]).filter(l=>l!==null);return n.length?{min:Math.min(...n),max:Math.max(...n)}:null}function Bs(e,t=""){var r;return((r=V(e,"inputUsdPerMillion",t))==null?void 0:r.min)??null}function Es(e,t=""){var r;return((r=V(e,"outputUsdPerMillion",t))==null?void 0:r.min)??null}function J(e,t=""){return Re(e,t).some(r=>r.inputUsdPerMillion===0&&(r.outputUsdPerMillion??0)===0)}function Os(e,t){const r=t.search.trim().toLowerCase();return e.filter(n=>{var l;return!(r&&!n.peerId.toLowerCase().includes(r)&&!(n.displayName??"").toLowerCase().includes(r)&&!n.services.some(o=>o.service.toLowerCase().includes(r))||t.model&&!n.services.some(o=>o.service===t.model)||t.tee&&!n.tee||t.linked&&!((l=n.verificationLinks)!=null&&l.length)||t.free&&!J(n,t.model))})}const Be={"openai-chat-completions":"Chat completions","openai-responses":"Responses","anthropic-messages":"Messages","openai-images":"Images"};function de(e){return e===null?"—":String(Math.round(e))}function Y(e){return e.displayName??A(e.peerId,8,4)}function T(e){return`${e.provider}:${e.service}`}function Ds({peer:e}){const t=(e.health.coolingDownUntil??0)>Date.now();return s.jsxs("span",{className:"gc-seller__meta",children:[s.jsxs("span",{className:"gc-peer-id",children:[s.jsx(be,{title:e.peerId,children:A(e.peerId,6,4)}),s.jsx(ve,{iconOnly:!0,value:e.peerId,label:"Copy peer id"})]}),s.jsx($e,{links:e.verificationLinks}),s.jsx(Ne,{tee:e.tee,scope:e.teeScope}),J(e,"")&&s.jsx(F,{tone:"success",children:"Free"}),e.washFlagged&&s.jsx(F,{tone:"danger",children:"Flagged"}),t&&s.jsx(F,{tone:"warning",children:"Cooling down"}),s.jsxs("span",{className:"gc-muted",children:["Last seen ",Xe(e.lastSeen)]})]})}function Us({peer:e,showReputation:t}){const r=(e.health.coolingDownUntil??0)>Date.now();return s.jsxs("div",{className:"gc-grid gc-grid--2 gc-figures gc-panel-figures",children:[s.jsx(I,{label:"Trust score",value:de(e.trustScore)}),t&&s.jsx(I,{label:"Reputation",value:de(e.reputationScore)}),s.jsx(I,{label:"Stake",value:e.stakeAnts?js(e.stakeAnts):"—"}),s.jsx(I,{label:"Network usage share",value:e.usageShareBps===null?"—":`${(e.usageShareBps/100).toFixed(2)}%`}),s.jsx(I,{label:"First token p50 (this gateway)",value:ke(e.firstTokenMsP50)}),s.jsx(I,{label:"Speed p50 (this gateway)",value:xe(e.tokensPerSecondP50)}),s.jsx(I,{label:"Requests, 24h (this gateway)",value:je(e.requests24h)}),s.jsx(I,{label:"Failure streak",value:r?`${e.health.failureStreak}, cooling down until ${es(e.health.coolingDownUntil)}`:String(e.health.failureStreak)})]})}function Vs({peer:e,selected:t,onSelect:r}){const[n,l]=y.useState(""),o=n.trim().toLowerCase(),g=e.services.filter(d=>!o||d.service.toLowerCase().includes(o));return s.jsx(Ae,{title:`Models (${e.services.length})`,actions:e.services.length>6&&s.jsx(Ce,{size:"sm",type:"search","aria-label":"Search this provider's models",placeholder:"Search models",value:n,onChange:d=>l(d.target.value)}),children:g.length===0?s.jsx("p",{className:"gc-fineprint",children:o?"No models match.":"This provider lists no models."}):s.jsx("ul",{className:"gc-panel-rows","aria-label":"Models and prices",children:g.map(d=>{const m=t!==null&&T(t)===T(d);return s.jsx(bs,{selected:m,title:s.jsx("span",{className:"gc-strong",children:d.service}),meta:s.jsxs(s.Fragment,{children:[s.jsx("span",{children:vs(d)}),s.jsx("span",{children:Be[Se(d)]})]}),actions:s.jsxs(s.Fragment,{children:[s.jsx(ve,{iconOnly:!0,value:Pe(e.peerId,d.service),label:`Copy ${d.service} pinned to this provider (peer@model)`}),s.jsx(P,{size:"sm",variant:m?"outline":"ghost","aria-pressed":m,title:"Show the API call for this model",onClick:()=>r(d),children:"API call"})]})},T(d))})})})}function _s({peer:e,service:t,onSelect:r}){var E;const{workspace:n,viewer:l}=H(),o=he(),g=ss(),d=fe(o),m=ts(n.id),[k,h]=y.useState("curl"),[u,p]=y.useState(!1),w=Se(t),$=Pe(e.peerId,t.service),i=((E=m.data)==null?void 0:E.find(f=>f.model===$))??null,a=as(g,e.peerId,t.service,w,i?`@preset/${i.slug}`:null),b=a.find(f=>f.id===k)??a[0],R=(d.data??[]).some(f=>f.status==="active"),B=ge(l);return s.jsxs(Ae,{title:"API call",actions:e.services.length>1&&s.jsx(N,{size:"sm","aria-label":"Model",value:T(t),onChange:f=>{const v=e.services.find(S=>T(S)===f);v&&r(v)},options:e.services.map(f=>({value:T(f),label:f.service}))}),children:[s.jsxs("p",{className:"gc-fineprint",children:["Pinned to this provider with ",s.jsx("code",{children:A($,10,12)}),"."]}),s.jsx(Ss,{id:"gc-connect",label:"Ways to connect",value:b.id,onChange:h,className:"gc-connect-tabs",tabs:a.map(f=>({id:f.id,label:f.label}))}),s.jsxs(Cs,{tabsId:"gc-connect",tab:b.id,className:"gc-stack",children:[b.id==="codex"&&s.jsxs("div",{className:"gc-summary-row",children:[s.jsx("p",{className:"gc-fineprint gc-summary-row__text",children:i?s.jsxs(s.Fragment,{children:["Uses the preset ",s.jsxs("code",{children:["@preset/",i.slug]})," for this model. Codex needs a preset: with a raw GPT model name it switches to a tool format some sellers drop."]}):s.jsx(s.Fragment,{children:"Codex needs a preset, not a raw model name: with a GPT model name it switches to a tool format some sellers drop. Create one for this model, then use its slug."})}),!i&&B&&s.jsx(P,{size:"sm",variant:"outline",onClick:()=>p(!0),children:"Create preset for this model"})]}),b.id==="claude-code"&&w!=="anthropic-messages"&&s.jsxs("p",{className:"gc-fineprint",children:["This model speaks ",Be[w],"; the gateway translates Claude Code's requests for it."]}),s.jsx(rs,{code:b.code,label:`${t.service} · ${b.label}`})]}),s.jsxs("p",{className:"gc-fineprint",children:["Set ",s.jsx("code",{children:ns})," to one of your API keys first."," ",d.data&&!R&&s.jsx(Ie,{to:"keys",children:"Create an API key"})]}),s.jsx(we,{isOpen:u,onClose:()=>p(!1),size:"lg",title:"New preset",children:u&&s.jsx(Ps,{initial:null,prefill:{name:t.service,model:$},onDone:f=>{p(!1),f&&h("codex")}})})]})}function zs({peer:e,peers:t,showReputation:r}){const[n,l]=y.useState(null),[o,g]=y.useState(null),d=y.useRef(null),m=o??e.services[0]??null,k=h=>{var u;g(h),(u=d.current)==null||u.scrollIntoView({behavior:"smooth",block:"start"})};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"gc-stack",children:[s.jsx(Ds,{peer:e}),s.jsxs("div",{className:"gc-panel-actions",children:[s.jsx(P,{size:"sm",variant:"outline",onClick:()=>l("allow"),children:"Allow"}),s.jsx(P,{size:"sm",variant:"outline",onClick:()=>l("prefer"),children:"Prefer"}),s.jsx(P,{size:"sm",variant:"danger",onClick:()=>l("block"),children:"Block"})]}),s.jsx(Us,{peer:e,showReputation:r})]}),s.jsx(Vs,{peer:e,selected:m,onSelect:k}),m&&s.jsx("div",{ref:d,className:"gc-scroll-target",children:s.jsx(_s,{peer:e,service:m,onSelect:g})}),n&&s.jsx(Le,{peer:e,action:n,peers:t,onClose:()=>l(null)})]})}function ue(e){return e===null?"—":String(Math.round(e))}function qs({peer:e,model:t}){const r=(e.health.coolingDownUntil??0)>Date.now();return s.jsxs("div",{className:"gc-badges",children:[s.jsx(Ne,{tee:e.tee,scope:e.teeScope}),J(e,t)&&s.jsx(F,{tone:"success",children:"Free"}),e.washFlagged&&s.jsx(F,{tone:"danger",children:"Flagged"}),r&&s.jsx(F,{tone:"warning",children:"Cooling down"})]})}function lt(){const{viewer:e}=H(),t=os(),r=ls(t.rest),n=is(),l=y.useMemo(()=>{var i;return r?((i=n.data)==null?void 0:i.find(a=>me(a.peerId,r)))??null:null},[n.data,r]),[o,g]=y.useState({search:"",model:"",tee:!1,linked:!1,free:!1}),[d,m]=y.useState(null),k=y.useMemo(()=>cs(n.data),[n.data]),h=ds(n.data),u=us(),p=(i,a)=>g(b=>({...b,[i]:a})),w=r===null?null:{eyebrow:"Provider",title:l?Y(l):A(r,8,6),body:n.isLoading?s.jsx(ye,{rows:6}):l?s.jsx(zs,{peer:l,peers:n.data,showReputation:h},l.peerId):s.jsx(re,{icon:s.jsx(ne.providers,{size:18}),title:"Provider not found",body:`This gateway does not see ${A(r,8,6)} right now.`})},$=s.jsxs("div",{className:"gc-page",children:[s.jsx(ms,{flush:!0,children:s.jsx(hs,{query:n,rows:8,children:i=>s.jsx(Is,{label:"Providers",rows:Os(i,o),rowKey:a=>a.peerId,selectedKey:(l==null?void 0:l.peerId)??null,onRowClick:a=>le(ws("providers",a.peerId)),rowLabel:a=>Y(a),actions:a=>[o.model!==""&&fs(u,a.peerId,o.model),{label:"Allow…",onSelect:()=>m({peer:a,kind:"allow"})},{label:"Prefer…",onSelect:()=>m({peer:a,kind:"prefer"})},{label:"Block…",tone:"danger",onSelect:()=>m({peer:a,kind:"block"})}],initialSort:{key:"trust",direction:"desc"},empty:s.jsx(re,{icon:s.jsx(ne.providers,{size:18}),title:i.length?"No providers match these filters":"No providers found yet",body:i.length?void 0:"The buyer is still discovering the network. Check back in a minute."}),columns:[{key:"name",header:"Provider",sortValue:a=>a.displayName??a.peerId,render:a=>s.jsxs("div",{className:"gc-cell-lines",children:[s.jsx("div",{className:"gc-strong gc-ellipsis",title:a.displayName??a.peerId,children:Y(a)}),a.displayName&&s.jsx("div",{className:"gc-muted gc-ellipsis",children:s.jsx(be,{title:a.peerId,children:A(a.peerId,6,4)})}),s.jsx(qs,{peer:a,model:o.model})]}),after:a=>s.jsx(gs,{value:a.peerId,label:`Copy peer id ${a.peerId}`})},{key:"identity",header:"Domain / GitHub",secondary:!0,render:a=>{var b;return(b=a.verificationLinks)!=null&&b.length?s.jsx($e,{links:a.verificationLinks}):s.jsx("span",{className:"gc-muted",children:"—"})}},{key:"models",header:"Models",secondary:!0,optional:!0,render:a=>s.jsx("span",{className:"gc-muted",children:a.services.length})},{key:"input",header:"Input $/M",align:"right",sortValue:a=>Bs(a,o.model),render:a=>oe(V(a,"inputUsdPerMillion",o.model))},{key:"output",header:"Output $/M",align:"right",secondary:!0,sortValue:a=>Es(a,o.model),render:a=>oe(V(a,"outputUsdPerMillion",o.model))},{key:"trust",header:"Trust",align:"right",sortValue:a=>a.trustScore,render:a=>ue(a.trustScore)},...h?[{key:"reputation",header:"Reputation",align:"right",secondary:!0,optional:!0,sortValue:a=>a.reputationScore,render:a=>ue(a.reputationScore)}]:[],{key:"firstToken",header:"First token",align:"right",secondary:!0,optional:!0,sortValue:a=>a.firstTokenMsP50,render:a=>ke(a.firstTokenMsP50)},{key:"speed",header:"Speed",align:"right",secondary:!0,optional:!0,sortValue:a=>a.tokensPerSecondP50,render:a=>xe(a.tokensPerSecondP50)},{key:"usage",header:"Your 24h",align:"right",secondary:!0,sortValue:a=>a.requests24h,render:a=>je(a.requests24h)}]})})}),s.jsxs("p",{className:"gc-fineprint",children:["Seller lists group sellers that routing rules allow or block together:"," ",ps("routing",e)?s.jsx(Ie,{to:"routing",children:"Routing → Seller lists"}):s.jsx(xs,{peers:n.data,label:"See seller lists"}),"."]})]});return s.jsxs("div",{className:"gc-page",children:[s.jsx(ys,{title:"Providers",description:"Providers on the network this gateway can route to. Open one to copy its models and an API call, or allow, block or prefer it for any scope."}),s.jsxs("div",{className:"gc-toolbar",children:[s.jsx(Ce,{size:"sm",type:"search","aria-label":"Search providers",placeholder:"Search name, peer id or model",value:o.search,onChange:i=>p("search",i.target.value)}),s.jsx(N,{size:"sm","aria-label":"Filter by model",value:o.model,onChange:i=>p("model",i),options:[{value:"",label:"All models"},...k.map(i=>({value:i,label:i}))]}),s.jsx(Q,{checked:o.linked,onChange:i=>p("linked",i),label:"Domain or GitHub"}),s.jsx(Q,{checked:o.tee,onChange:i=>p("tee",i),label:"TEE"}),s.jsx(Q,{checked:o.free,onChange:i=>p("free",i),label:"Free"})]}),s.jsx(ks,{list:$,panel:w,onClose:()=>le("providers"),closeLabel:"Close provider"}),d&&s.jsx(Le,{peer:d.peer,action:d.kind,peers:n.data,onClose:()=>m(null)})]})}export{lt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as M,j as e,L as j,o as y,Z as f,ad as c,ae as k,h as i,E as w,I,B as A,W as C,f as N,q,v as d,b as v,M as l,g as u,e as L,$ as D,af as E,X as $,Y as O}from"./index-DPXW_JSn.js";import{u as K}from"./useInfiniteQuery-CAj47QRO.js";import{p as S}from"./PeerPicker-CcMSXxY3.js";import{f as g,h as W}from"./usage-DQGKL0DJ.js";import{h as _,p as z,s as J}from"./selection-BV37SUs_.js";import{D as Q}from"./DataTable-BCgVRqY6.js";const U=50;function h(s){return s===null?e.jsx(d,{tone:"info",children:"In flight"}):s<400?e.jsx(d,{tone:"success",children:s}):s<500?e.jsx(d,{tone:"warning",children:s}):e.jsx(d,{tone:"danger",children:s})}function b({entry:s}){const n=g(s,Date.now());return n==="video-charged"?e.jsx("span",{className:"gc-muted",title:"Charged on the request that downloaded this video",children:u(s.video.charged)}):n==="on-delivery"?e.jsx("span",{className:"gc-muted",title:"A video is charged when its finished file is downloaded",children:"on delivery"}):n==="not-charged"?e.jsx("span",{className:"gc-muted",title:"A video status check is not charged",children:"—"}):n==="free"?e.jsx("span",{className:"gc-muted",title:"Served by a free seller: $0",children:"Free"}):n==="pending"?e.jsx("span",{className:"gc-muted",title:"The buyer reports spend a moment after the response",children:"pending"}):n==="not-recorded"?e.jsx("span",{className:"gc-muted",title:"No spend was reported for this request: the buyer lost it",children:"not recorded"}):e.jsx(e.Fragment,{children:u(s.spent)})}function R({peerId:s,full:n=!1}){const t=v(),o=S(t.data,s);return n?e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsx("span",{children:o}),e.jsx(l,{children:s})]}):e.jsx("span",{className:"gc-ellipsis",title:s,children:o})}function T({entry:s}){return s.servedModel?e.jsxs(e.Fragment,{children:[s.model??"—"," ",e.jsxs("span",{className:"gc-muted",children:["→ ",s.servedModel]})]}):e.jsx(e.Fragment,{children:s.model??"—"})}function Z(s){const n=s.model??"Request";return s.servedModel?`${n} → ${s.servedModel}`:n}function G({router:s,status:n}){const t=v();return e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsx("span",{children:S(t.data,s.peerId)}),e.jsx(l,{children:s.peerId}),e.jsxs("span",{className:"gc-muted",children:[s.service?`${s.service} · `:"",W(s.rank,n)]})]})}function V({entry:s}){if(s.routingSpent)return e.jsx(e.Fragment,{children:u(s.routingSpent)});const n=g(s,Date.now());return n==="pending"?e.jsx("span",{className:"gc-muted",children:"pending"}):n==="spent"||n==="free"?e.jsx("span",{className:"gc-muted",title:"The router reported no charge for this ranking",children:"Free"}):e.jsx("span",{className:"gc-muted",children:"—"})}function X(s){try{return JSON.stringify(JSON.parse(s),null,2)}catch{return s}}function x({title:s,body:n}){return e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsx("div",{className:"as-field__label",children:s}),e.jsx(O,{code:X(n)})]})}function Y({detail:s}){return!s.requestBody&&!s.responseBody?e.jsx("p",{className:"gc-fineprint",children:"Bodies are not stored for this request. Turn on content logging under Settings → Observability to keep them."}):e.jsxs(e.Fragment,{children:[s.requestBody&&e.jsx(x,{title:"Request body",body:s.requestBody}),s.responseBody&&e.jsx(x,{title:"Response body",body:s.responseBody})]})}function H({selection:s,at:n}){const t=_(s,n);return e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsx("span",{children:z(s)}),e.jsxs("span",{className:"gc-muted",children:["At the time: ",J(s).join(" · ")]}),t&&e.jsx("span",{className:"gc-muted",children:t})]})}function ee({entry:s}){const n=L({queryKey:q.request(s.tag),queryFn:()=>N.usage.request(s.tag),retry:!1,staleTime:6e4}),t=n.data??s,o=D(n.error)&&n.error.status===404;return e.jsxs(e.Fragment,{children:[t.errorCode||t.errorMessage?e.jsx(E,{tone:"danger",title:t.errorCode??"Request failed",children:t.errorMessage??"No message was returned."}):null,e.jsx($,{items:[["Status",h(t.status)],["Request",e.jsxs(l,{children:[t.method," ",t.path]},"p")],["Model",e.jsx(T,{entry:t},"m")],["Key",t.keyLabel],["End user",t.endUser??"—"],...t.router?[["Router",e.jsx(G,{router:t.router,status:t.status},"r")]]:[],["Seller",t.sellerPeerId?e.jsx(R,{peerId:t.sellerPeerId,full:!0},"s"):"—"],...t.routeSelection?[["Why this seller",e.jsx(H,{selection:t.routeSelection,at:t.startedAt},"w")]]:[],["First token",c(t.firstTokenMs)],["Speed",k(t.tokensPerSecond)],["Duration",t.finishedAt?c(t.finishedAt-t.startedAt):"—"],["Input tokens",i(t.inputTokens)],["Cached input",i(t.cachedInputTokens)],["Output tokens",i(t.outputTokens)],["Cost",e.jsx(b,{entry:t},"c")],...t.router?[["Routing fee",e.jsx(V,{entry:t},"f")]]:[],["Tag",e.jsx(l,{children:t.tag},"t")]]}),n.isLoading&&e.jsx(j,{rows:2}),n.error&&!o?e.jsx(y,{error:n.error,title:"Could not load the bodies"}):null,n.data&&e.jsx(Y,{detail:n.data})]})}function ie({filter:s,showKey:n=!0}){var m;const[t,o]=M.useState(null),a=K({queryKey:q.requests(s),queryFn:({pageParam:r})=>N.usage.requests({...s,before:r??void 0,limit:U}),initialPageParam:null,getNextPageParam:r=>r.nextBefore,refetchInterval:r=>{var p;return(p=r.state.data)!=null&&p.pages.some(F=>F.requests.some(P=>g(P,Date.now())==="pending"))?5e3:!1}});if(a.isLoading)return e.jsx(j,{rows:8});if(a.error)return e.jsx(y,{error:a.error,onRetry:()=>void a.refetch()});const B=((m=a.data)==null?void 0:m.pages.flatMap(r=>r.requests))??[];return e.jsxs(e.Fragment,{children:[e.jsx(Q,{label:"Request log",rows:B,rowKey:r=>r.tag,onRowClick:o,rowLabel:r=>`request ${r.tag}`,empty:e.jsx(w,{icon:e.jsx(I.logs,{size:18}),title:"No requests found",body:"Requests appear here as soon as a key is used. Check the filters if you expected some."}),columns:[{key:"time",header:"Time",render:r=>e.jsx("span",{className:"gc-nowrap",children:f(r.startedAt)})},...n?[{key:"key",header:"Key",secondary:!0,render:r=>r.keyLabel}]:[],{key:"model",header:"Model",render:r=>e.jsxs("span",{className:"gc-ellipsis",children:[r.model?e.jsx(T,{entry:r}):e.jsxs("span",{className:"gc-muted",children:[r.method," ",r.path]}),r.status!==null&&r.status>=400?e.jsxs("span",{className:"gc-narrow-only",children:[" ",h(r.status)]}):null]})},{key:"seller",header:"Seller",render:r=>r.sellerPeerId?e.jsx(R,{peerId:r.sellerPeerId}):"—"},{key:"status",header:"Status",secondary:!0,render:r=>e.jsx("span",{title:r.errorMessage??void 0,children:h(r.status)})},{key:"firstToken",header:"First token",align:"right",secondary:!0,optional:!0,render:r=>c(r.firstTokenMs)},{key:"speed",header:"Speed",align:"right",secondary:!0,optional:!0,render:r=>k(r.tokensPerSecond)},{key:"tokens",header:"Tokens",align:"right",secondary:!0,render:r=>`${i(r.inputTokens)} → ${i(r.outputTokens)}`},{key:"cost",header:"Cost",align:"right",render:r=>e.jsx(b,{entry:r})}]}),a.hasNextPage&&e.jsx("div",{className:"gc-load-more",children:e.jsx(A,{variant:"outline",size:"sm",disabled:a.isFetchingNextPage,onClick:()=>void a.fetchNextPage(),children:a.isFetchingNextPage?"Loading…":"Load older requests"})}),e.jsx(C,{isOpen:t!==null,onClose:()=>o(null),title:t?Z(t):"Request",subtitle:t?f(t.startedAt):void 0,eyebrow:"Request",children:t&&e.jsx(ee,{entry:t},t.tag)})]})}export{ie as R};
|