@antseed/gateway-console 0.1.9 → 0.1.10
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 +1 -0
- package/dist/assets/{Audit-tBcMBtG2.js → Audit-C-dFTX_u.js} +1 -1
- package/dist/assets/{ChainGate-bxLjo_3b.js → ChainGate-In51TI2h.js} +1 -1
- package/dist/assets/{ChannelClose-C0Y19KzJ.js → ChannelClose-D8CcISX0.js} +1 -1
- package/dist/assets/{Charts-CHTi7z3n.js → Charts-doK0mDVf.js} +1 -1
- package/dist/assets/{Chat-C1AfYZwW.js → Chat-CaImcsH1.js} +34 -34
- package/dist/assets/{ConnectWallet-fHEv854J.js → ConnectWallet-DQ0PC6SO.js} +1 -1
- package/dist/assets/{DataTable-CCEZoIzX.js → DataTable-BTwj5g1m.js} +1 -1
- package/dist/assets/{KeyHolder-DSLJe1Wc.js → KeyHolder-D90Uu-Jv.js} +1 -1
- package/dist/assets/Keys-B5LppZtn.js +1 -0
- package/dist/assets/Logs-Dw4sZ9lo.js +1 -0
- package/dist/assets/Members-CnaHKFut.js +1 -0
- package/dist/assets/{Migrate-TGloMMad.js → Migrate-BQYY5ty3.js} +1 -1
- package/dist/assets/Models-zIuHewdV.js +1 -0
- package/dist/assets/{OperatorActions-DPQvd1zg.js → OperatorActions-DrRpfDBV.js} +1 -1
- package/dist/assets/{OperatorGateAlert-CEK2vyQ9.js → OperatorGateAlert-D92zhyXC.js} +1 -1
- package/dist/assets/{Overview-CPoqW_Mi.js → Overview-CJmp6b7M.js} +1 -1
- package/dist/assets/{PeerPicker-w_ZaksUm.js → PeerPicker-BJfjL7Dy.js} +1 -1
- package/dist/assets/PolicyEditor-BpoV34ra.js +1 -0
- package/dist/assets/{PolicyField-BbDSVgcK.js → PolicyField-CfRYcr_J.js} +1 -1
- package/dist/assets/Presets-c1J4UwX0.js +4 -0
- package/dist/assets/Providers-B0LuYcAw.js +1 -0
- package/dist/assets/RequestLog-D2YGgG1C.js +1 -0
- package/dist/assets/{Rewards-D9omoUfP.js → Rewards-DNNxx3NO.js} +2 -2
- package/dist/assets/{RewardsClaim-CWJBaJEv.js → RewardsClaim-nstcyJvi.js} +1 -1
- package/dist/assets/Routing-B79eDIZL.js +1 -0
- package/dist/assets/{Segmented-D_Yun-tG.js → Segmented-BelxPFkk.js} +1 -1
- package/dist/assets/{SelectField-D3qPiNQz.js → SelectField-BWyF8Ku8.js} +1 -1
- package/dist/assets/{Settings-Bo654hg3.js → Settings-Cws5Z--R.js} +2 -2
- package/dist/assets/{Staking-HKOLSr5r.js → Staking-DHwoflHG.js} +1 -1
- package/dist/assets/{StakingDashboard-BHU6EJ_h.js → StakingDashboard-DtOKTmys.js} +1 -1
- package/dist/assets/Switch-BwBYBnSS.js +1 -0
- package/dist/assets/{Tabs-DmkE9BPd.js → Tabs-yVL4Cd6z.js} +1 -1
- package/dist/assets/{TextAreaField-RZPCzhKZ.js → TextAreaField-B6jcl4RR.js} +1 -1
- package/dist/assets/{UsageByModel-nhGKdBi8.js → UsageByModel-DhTF-c1H.js} +1 -1
- package/dist/assets/{Wallet-jy4q5mLQ.js → Wallet-QXhhg_E-.js} +3 -3
- package/dist/assets/{WalletConfirm-dV_LWLAS.js → WalletConfirm-CgWBuaMN.js} +1 -1
- package/dist/assets/{WalletFunding-B3t7wm--.js → WalletFunding-Ydd9gD2t.js} +1 -1
- package/dist/assets/{WalletSignIn-BTt56Pbi.js → WalletSignIn-DvVSFW4u.js} +1 -1
- package/dist/assets/Workspaces-DuxGwCQ2.js +1 -0
- package/dist/assets/{add-BWOpvuwn.js → add-ChFb9YAz.js} +1 -1
- package/dist/assets/{all-wallets-Dzo5pBZj.js → all-wallets-rdNweGUd.js} +1 -1
- package/dist/assets/{app-store-D7NT8p3m.js → app-store-s294A1qn.js} +1 -1
- package/dist/assets/{apple-DZKBu-O0.js → apple-Cs8Kx1eO.js} +1 -1
- package/dist/assets/{arrow-bottom-CL8pk1cz.js → arrow-bottom-BMmCEQIa.js} +1 -1
- package/dist/assets/{arrow-bottom-circle-CfYYPCEB.js → arrow-bottom-circle-CThmnDp3.js} +1 -1
- package/dist/assets/{arrow-left-DVKw3BfQ.js → arrow-left-BJxgCTi0.js} +1 -1
- package/dist/assets/{arrow-right-LIBetaMw.js → arrow-right-CnLYkBsH.js} +1 -1
- package/dist/assets/{arrow-top-Bdq-JU1Z.js → arrow-top-Dc0DLP-U.js} +1 -1
- package/dist/assets/{bank-BYRxGjPq.js → bank-CSWOYeMW.js} +1 -1
- package/dist/assets/{basic-CZ6XfWue.js → basic-BHdv4O5I.js} +1 -1
- package/dist/assets/{browser-4mXAG82s.js → browser-mp33aPgo.js} +1 -1
- package/dist/assets/{bundle-full-BIYMHvS6.js → bundle-full-CDQ5iC5h.js} +1 -1
- package/dist/assets/{card-CHQPd736.js → card-BcVuRQiM.js} +1 -1
- package/dist/assets/{ccip-CDMxOoDo.js → ccip-O1XLvWon.js} +1 -1
- package/dist/assets/{checkmark-8o_U76Ey.js → checkmark-CQVJIWW1.js} +1 -1
- package/dist/assets/{checkmark-bold-DLi4Gcn_.js → checkmark-bold-DDU5XQfq.js} +1 -1
- package/dist/assets/{chevron-bottom-DmX6fEDV.js → chevron-bottom-Bqi9FW2q.js} +1 -1
- package/dist/assets/{chevron-left-AyKJMTQa.js → chevron-left-Vd5st0yB.js} +1 -1
- package/dist/assets/{chevron-right-DQ8e2bPT.js → chevron-right-BVwFrlss.js} +1 -1
- package/dist/assets/{chevron-top-B5o-6za5.js → chevron-top-D5dQ2xFn.js} +1 -1
- package/dist/assets/{chrome-store-BSncx9O2.js → chrome-store-C9C4k8IO.js} +1 -1
- package/dist/assets/{clock-DBlIwqMs.js → clock-Cuvc7bNo.js} +1 -1
- package/dist/assets/{close-CGfPRgam.js → close-fW1pJ13b.js} +1 -1
- package/dist/assets/{code-block-B9znTLtr.js → code-block-Djv3iQ0G.js} +2 -2
- package/dist/assets/{coinPlaceholder-BUSXHM7f.js → coinPlaceholder-CKymvNA8.js} +1 -1
- package/dist/assets/{compass-WMx9aHQn.js → compass-D3h_6fr8.js} +1 -1
- package/dist/assets/{copy-4QWyzVbB.js → copy-CNGN_cOz.js} +1 -1
- package/dist/assets/{core-4C0uPyns.js → core-LDeQm5nv.js} +3 -3
- package/dist/assets/cursor-CTNYpsWo.js +3 -0
- package/dist/assets/{cursor-transparent-BaithBa8.js → cursor-transparent-BblOfv3t.js} +1 -1
- package/dist/assets/{desktop-pj3LdQx_.js → desktop-gpVOlZ1-.js} +1 -1
- package/dist/assets/{disconnect-cmEUajMk.js → disconnect-C_phPN0_.js} +1 -1
- package/dist/assets/{discord-BYVJX-t1.js → discord-Dk_2Plhc.js} +1 -1
- package/dist/assets/{en_US-Y4ZOVFV4-BZ-715IV.js → en_US-Y4ZOVFV4-CmhP8GU2.js} +4 -4
- package/dist/assets/{etherscan-BdQaeBLV.js → etherscan-Cyrh-2Lr.js} +1 -1
- package/dist/assets/{exclamation-triangle-B5R8OH8o.js → exclamation-triangle-SeeDwZ6A.js} +1 -1
- package/dist/assets/{extension-DrkCTDz1.js → extension-e_11O0GI.js} +1 -1
- package/dist/assets/{external-link-CZIsXhQB.js → external-link-Dl0AqCn3.js} +1 -1
- package/dist/assets/{facebook-B8mGiKom.js → facebook-Cp_-Axbh.js} +1 -1
- package/dist/assets/{farcaster-BlEPprye.js → farcaster-Zwu26KYL.js} +1 -1
- package/dist/assets/{filters-QpslZY8t.js → filters-CdkpWvgi.js} +1 -1
- package/dist/assets/{github-3U8av1u0.js → github-DuPUePDJ.js} +1 -1
- package/dist/assets/{google-DuIQFQyG.js → google-DlKW7Gx7.js} +1 -1
- package/dist/assets/{help-circle-BKX8azWY.js → help-circle-19xLhjPt.js} +1 -1
- package/dist/assets/highlighted-body-KQOG7T2V-D7DB9nBd.js +1 -0
- package/dist/assets/{id-DoN-p9_h.js → id-B4PjxpL6.js} +1 -1
- package/dist/assets/{image-DnOVeCbR.js → image-CHz8w95r.js} +1 -1
- package/dist/assets/{index-A9482YJO.js → index-BYZ6CM-r.js} +1 -1
- package/dist/assets/{index-BPmBiG1M.js → index-CAflmCbT.js} +3 -3
- package/dist/assets/{index-DeVTk1EB.js → index-CZbdRW9K.js} +1 -1
- package/dist/assets/index-CfhMI0GY.css +1 -0
- package/dist/assets/{index-B25V3jQV.js → index-CgyFWy7G.js} +1 -1
- package/dist/assets/index-DIcymBxc.js +91 -0
- package/dist/assets/{index.es-C1jtws71.js → index.es-0kjt2ETS.js} +3 -3
- package/dist/assets/{info-CdmGz8ET.js → info-CFnwPck_.js} +1 -1
- package/dist/assets/{info-circle-C6CmWEn4.js → info-circle-DNYjRzmq.js} +1 -1
- package/dist/assets/{lightbulb-BAyNXoa1.js → lightbulb-DPrYcwVp.js} +1 -1
- package/dist/assets/{limits-DjiKmaDB.js → limits-D8_oE0N-.js} +1 -1
- package/dist/assets/{mail-CiF1vNhi.js → mail-Do_T12XQ.js} +1 -1
- package/dist/assets/{mermaid-MCJ5UELQ-nKICVXNz.js → mermaid-MCJ5UELQ-Cr83KTfF.js} +3 -3
- package/dist/assets/{metamask-sdk-DkF2jP-o.js → metamask-sdk-CHSvqgLD.js} +1 -1
- package/dist/assets/{mobile-C1sek6EE.js → mobile-2wdwD-gm.js} +1 -1
- package/dist/assets/models-CLos5_p0.js +1 -0
- package/dist/assets/{more-Dg3gTue9.js → more-CugjlKbm.js} +1 -1
- package/dist/assets/{network-placeholder-DjgO487Z.js → network-placeholder-D0CvRN9Z.js} +1 -1
- package/dist/assets/{nftPlaceholder-CJQkl27U.js → nftPlaceholder-CjCtJ3VF.js} +1 -1
- package/dist/assets/{off-CH17X0ZN.js → off-CjwzxGqC.js} +1 -1
- package/dist/assets/{play-store-CQuK3mcO.js → play-store-ts_mM-L7.js} +1 -1
- package/dist/assets/{plus-pEvbyOXN.js → plus-CayVcA5r.js} +1 -1
- package/dist/assets/{qr-code-Cl8u00kF.js → qr-code-BJFXX7Ga.js} +1 -1
- package/dist/assets/{recycle-horizontal-C2j4VihN.js → recycle-horizontal-Dxd_xbuW.js} +1 -1
- package/dist/assets/{refresh-DiGzIXYL.js → refresh-2tSMiCzO.js} +1 -1
- package/dist/assets/{reown-logo-lnPAI4aT.js → reown-logo-C3tg9yiK.js} +1 -1
- package/dist/assets/{search-yadtJ599.js → search-By38_AjN.js} +1 -1
- package/dist/assets/{send-C3NLDzpo.js → send-DhLEHc2T.js} +1 -1
- package/dist/assets/{sendTransaction-qrdT91Tm.js → sendTransaction-CqpP3CZj.js} +1 -1
- package/dist/assets/stored-CFfx95Ep.js +1 -0
- package/dist/assets/{swapHorizontal-C3NCkGQo.js → swapHorizontal-BSy_Qzqy.js} +1 -1
- package/dist/assets/{swapHorizontalBold-BZwhavke.js → swapHorizontalBold-B4pOkOa-.js} +1 -1
- package/dist/assets/{swapHorizontalMedium-Cmnd2nih.js → swapHorizontalMedium-BbDDLHs6.js} +1 -1
- package/dist/assets/{swapHorizontalRoundedBold-gSkn4e0W.js → swapHorizontalRoundedBold-MzTdSarg.js} +1 -1
- package/dist/assets/{swapVertical-B3cp9dIz.js → swapVertical-D0uKM7wm.js} +1 -1
- package/dist/assets/{telegram-CCcfHXb2.js → telegram-Q_WwsPzx.js} +1 -1
- package/dist/assets/{three-dots-Dn7VO-lq.js → three-dots-Cpl_X23E.js} +1 -1
- package/dist/assets/{twitch-C46oL1KF.js → twitch-B7x-eAo9.js} +1 -1
- package/dist/assets/{twitterIcon-CAkiEmDS.js → twitterIcon-BRMMjDzW.js} +1 -1
- package/dist/assets/usage-DktoZRc8.js +1 -0
- package/dist/assets/{useInfiniteQuery-Dwl-oWNd.js → useInfiniteQuery-NenQ5Num.js} +1 -1
- package/dist/assets/{useTx-CT2tKEAI.js → useTx-WkiDSW_A.js} +1 -1
- package/dist/assets/{verify-jbEYtj7t.js → verify-BxTMhyZY.js} +1 -1
- package/dist/assets/{verify-filled-CtFkkLAN.js → verify-filled-CaKhO-hp.js} +1 -1
- package/dist/assets/{w3m-modal-Drzo9R1s.js → w3m-modal-DZ2_0Ukm.js} +1 -1
- package/dist/assets/{waitForCallsStatus-CU9lZ8Vj.js → waitForCallsStatus-CtriTPoz.js} +1 -1
- package/dist/assets/{wallet-B11Hl0Lf.js → wallet-BeZF3I-Z.js} +1 -1
- package/dist/assets/{wallet-placeholder-DwLspbFR.js → wallet-placeholder-BDvuTJ6r.js} +1 -1
- package/dist/assets/{walletconnect-3aC0SnNJ.js → walletconnect-U8tnyg6m.js} +1 -1
- package/dist/assets/{warning-circle-DuqXAhpW.js → warning-circle-Dg69jmuZ.js} +1 -1
- package/dist/assets/{writeContract-m5SoBxcM.js → writeContract-DrAWt0yz.js} +1 -1
- package/dist/assets/{x-DTeu3B0J.js → x-CJ-uWPue.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/Activity-DrhhsiYE.js +0 -1
- package/dist/assets/Disclosure-BitAjv2r.js +0 -1
- package/dist/assets/Keys-C22oAYzQ.js +0 -1
- package/dist/assets/Logs-DHuR0CKc.js +0 -1
- package/dist/assets/Members-ZyqdMsMd.js +0 -1
- package/dist/assets/Models-CM4ay6RE.js +0 -1
- package/dist/assets/PolicyEditor-BOjadRE8.js +0 -1
- package/dist/assets/Presets-9x2m9R-f.js +0 -4
- package/dist/assets/Providers-CqYXx8xK.js +0 -1
- package/dist/assets/RequestLog-39L0RtJc.js +0 -1
- package/dist/assets/Routing-4gxa6VdE.js +0 -1
- package/dist/assets/Switch-BmFsXcr8.js +0 -1
- package/dist/assets/Workspaces-mfw5erSQ.js +0 -1
- package/dist/assets/cursor-C_vrGLpb.js +0 -3
- package/dist/assets/highlighted-body-KQOG7T2V-9-ocLujg.js +0 -1
- package/dist/assets/index-BpFwvYMF.js +0 -91
- package/dist/assets/index-C9evdHF9.css +0 -1
- package/dist/assets/models-CJU4tPJk.js +0 -1
- package/dist/assets/usage-yuqGLybi.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a4 as E,a5 as C,a6 as N,a7 as v,a8 as P,G as F,a9 as k,c as O,a1 as p,u as j,aa as B,w as H}from"./en_US-Y4ZOVFV4-
|
|
1
|
+
import{a4 as E,a5 as C,a6 as N,a7 as v,a8 as P,G as F,a9 as k,c as O,a1 as p,u as j,aa as B,w as H}from"./en_US-Y4ZOVFV4-CmhP8GU2.js";import{bo as $,c6 as G,j as y,ah as S,r as m,c7 as q,aO as L}from"./index-DIcymBxc.js";import{w as U}from"./writeContract-DrAWt0yz.js";async function J(e,t){const{abi:n,chainId:r,connector:s,...a}=t;let c;t.account?c=t.account:c=(await E(e,{assertChainId:!1,chainId:r,connector:s})).account;const o=e.getClient({chainId:r}),f=C(o,N,"simulateContract"),{result:h,request:u}=await f({...a,abi:n,account:c});return{chainId:o.chain.id,result:h,request:{...u,chainId:r}}}async function z(e,t){const{chainId:n,timeout:r=0,...s}=t,a=e.getClient({chainId:n}),o=await C(a,v,"waitForTransactionReceipt")({...s,timeout:r});if(o.status==="reverted"){const f=C(a,P,"getTransaction"),{from:h,...u}=await f({hash:o.transactionHash}),w=await C(a,F,"call")({...u,account:h,data:u.input,gasPrice:u.type!=="eip1559"?u.gasPrice:void 0,maxFeePerGas:u.type==="eip1559"?u.maxFeePerGas:void 0,maxPriorityFeePerGas:u.type==="eip1559"?u.maxPriorityFeePerGas:void 0}),A=w!=null&&w.data?k(`0x${w.data.substring(138)}`):"unknown reason";throw new Error(A)}return{...o,chainId:a.chain.id}}async function D(e,t){const{account:n,chainId:r,connector:s,...a}=t;let c;return typeof n=="object"&&(n==null?void 0:n.type)==="local"?c=e.getClient({chainId:r}):c=await E(e,{account:n??void 0,assertChainId:!1,chainId:r,connector:s}),await C(c,U,"writeContract")({...a,...n?{account:n}:{},chain:r?{id:r}:null})}function M(e){return{mutationFn(t){return D(e,t)},mutationKey:["writeContract"]}}function Q(e={}){const{mutation:t}=e,n=O(e),r=M(n),{mutate:s,mutateAsync:a,...c}=$({...t,...r});return{...c,writeContract:s,writeContractAsync:a}}const X=p(["function getOperator(address buyer) view returns (address)","function getOperatorNonce(address buyer) view returns (uint256)","function setOperator(address buyer, address operator, uint256 nonce, bytes buyerSig)","function transferOperator(address buyer, address newOperator)","function withdraw(address buyer, uint256 amount)","error NotAuthorized()","error InvalidAmount()","error InvalidAddress()","error InsufficientBalance()","error InvalidSignature()","error InvalidNonce()","error OperatorAlreadySet()"]),Z=p(["function claimBuyerReward(address buyer, uint256 epoch)","error NotRewardRecipient()","error RewardRecipientUnavailable()"]),tt=p(["function channels(bytes32 channelId) view returns (address buyer, address seller, uint128 deposit, uint128 settled, bytes32 metadataHash, uint256 deadline, uint256 settledAt, uint256 closeRequestedAt, uint8 status)","function requestClose(bytes32 channelId)","function withdraw(bytes32 channelId)","error ChannelNotActive()","error NotAuthorized()","error CloseAlreadyRequested()","error CloseNotReady()"]),et=p(["function claimBuyerEmissions(address buyer, uint256[] epochs)","error NotAuthorized()","error EpochNotFinalized()"]);function nt({chain:e,runner:t,done:n="Confirmed on chain."}){const r=t.lastHash?G(e,t.lastHash):null,s=r&&y.jsx("a",{className:"gc-link",href:r,target:"_blank",rel:"noopener noreferrer",children:"View transaction"});return y.jsxs(y.Fragment,{children:[t.status&&y.jsxs(S,{tone:"info",children:[t.status," ",t.running&&t.lastHash&&s]}),t.error&&y.jsxs(S,{tone:"danger",children:[t.error," ",!t.running&&s]}),!t.running&&!t.error&&t.confirmed&&y.jsxs(S,{tone:"success",children:[n," ",s]})]})}function at(e){const t=O(),{chainId:n}=j(),{switchChainAsync:r}=B(),[s,a]=m.useState(null),[c,o]=m.useState(null),[f,h]=m.useState(null),[u,g]=m.useState(null),[w,A]=m.useState(!1);async function T(_,l={}){var x,I,R;let b=null;A(!0),o(null),g(null),h(null);try{n!==e&&(a("Switch network in your wallet…"),await r({chainId:e}));for(const i of _){i.check&&(a(`${i.label}: checking…`),await i.check()),a(`${i.label}: confirm in your wallet…`);const d=await i.send();if(b=d,h(d),a(`${i.label}: waiting for confirmation…`),(await z(t,{hash:d,chainId:e})).status!=="success")throw new Error(`${i.label} reverted on chain.`)}return a(null),g(b),b}catch(i){a(null);const d=q(i);return d?(o(d.message),d.refresh&&((x=l.onStale)==null||x.call(l))):i instanceof L?(o(i.message),i.refresh&&((I=l.onStale)==null||I.call(l))):(o(H(i)),b&&((R=l.onStale)==null||R.call(l))),null}finally{A(!1)}}return{run:T,running:w,status:s,setStatus:a,error:c,lastHash:f,confirmed:u,wrongChain:n!==void 0&&n!==e,setError:o}}export{tt as C,X as D,et as L,nt as T,Z as U,Q as a,J as s,at as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{w as l}from"./core-
|
|
1
|
+
import{w as l}from"./core-LDeQm5nv.js";import"./index-DIcymBxc.js";import"./index.es-0kjt2ETS.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CmhP8GU2.js";import"./clsx-B-dksMZM.js";import"./index-BhwNCc8y.js";const p=l`<svg fill="none" viewBox="0 0 28 28">
|
|
2
2
|
<path
|
|
3
3
|
fill="currentColor"
|
|
4
4
|
fill-rule="evenodd"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{w as l}from"./core-
|
|
1
|
+
import{w as l}from"./core-LDeQm5nv.js";import"./index-DIcymBxc.js";import"./index.es-0kjt2ETS.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CmhP8GU2.js";import"./clsx-B-dksMZM.js";import"./index-BhwNCc8y.js";const c=l`<svg fill="none" viewBox="0 0 14 14">
|
|
2
2
|
<path
|
|
3
3
|
fill="currentColor"
|
|
4
4
|
fill-rule="evenodd"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as ve,s as fe,b as ge,p as be,M as g,S as se,R as l,i as v,r as P,c as f,d as a,A as K,e as ce,f as le,C as m,g as Y,h as ye,j as S,E as ie,O as E,k as q,l as oe,m as T,n as H,T as xe,o as Ce,q as ke,t as Se}from"./core-
|
|
1
|
+
import{a as ve,s as fe,b as ge,p as be,M as g,S as se,R as l,i as v,r as P,c as f,d as a,A as K,e as ce,f as le,C as m,g as Y,h as ye,j as S,E as ie,O as E,k as q,l as oe,m as T,n as H,T as xe,o as Ce,q as ke,t as Se}from"./core-LDeQm5nv.js";import{c as u,n as w,r as d,o as F,U as We}from"./index-CAflmCbT.js";import"./index-DIcymBxc.js";import"./index.es-0kjt2ETS.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CmhP8GU2.js";import"./clsx-B-dksMZM.js";import"./index-BhwNCc8y.js";const p=be({message:"",open:!1,triggerRect:{width:0,height:0,top:0,left:0},variant:"shade"}),Re={state:p,subscribe(r){return ge(p,()=>r(p))},subscribeKey(r,e){return fe(p,r,e)},showTooltip({message:r,triggerRect:e,variant:t}){p.open=!0,p.message=r,p.triggerRect=e,p.variant=t},hide(){p.open=!1,p.message="",p.triggerRect={width:0,height:0,top:0,left:0}}},O=ve(Re),de={isUnsupportedChainView(){return l.state.view==="UnsupportedChain"||l.state.view==="SwitchNetwork"&&l.state.history.includes("UnsupportedChain")},async safeClose(){if(this.isUnsupportedChainView()){g.shake();return}if(await se.isSIWXCloseDisabled()){g.shake();return}g.close()}},$e=v`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
border-radius: clamp(0px, var(--wui-border-radius-l), 44px);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{K as y,e as _,m as I,U as O,B as C,M as R,N as x,v as q,p as S,O as L,P as E,Q as B,R as N,A as P,g as T,k as j,S as D,D as M,y as z,T as U,V as W,X as $,Y as H}from"./en_US-Y4ZOVFV4-
|
|
1
|
+
import{K as y,e as _,m as I,U as O,B as C,M as R,N as x,v as q,p as S,O as L,P as E,Q as B,R as N,A as P,g as T,k as j,S as D,D as M,y as z,T as U,V as W,X as $,Y as H}from"./en_US-Y4ZOVFV4-CmhP8GU2.js";import{s as G}from"./sendTransaction-CqpP3CZj.js";const k="0x5792579257925792579257925792579257925792579257925792579257925792",A=y(0,{size:32});async function J(s,a){var g;const{account:l=s.account,chain:p=s.chain,experimental_fallback:m,experimental_fallbackDelay:d=32,forceAtomic:c=!1,id:r,version:w="2.0.0"}=a,h=l?S(l):null;let t=a.capabilities;s.dataSuffix&&!((g=a.capabilities)!=null&&g.dataSuffix)&&(typeof s.dataSuffix=="string"?t={...a.capabilities,dataSuffix:{value:s.dataSuffix,optional:!0}}:t={...a.capabilities,dataSuffix:{value:s.dataSuffix.value,...s.dataSuffix.required?{}:{optional:!0}}});const b=a.calls.map(u=>{const e=u,i=e.abi?_({abi:e.abi,functionName:e.functionName,args:e.args}):e.data;return{data:e.dataSuffix&&i?I([i,e.dataSuffix]):i,to:e.to,value:e.value?y(e.value):void 0}});try{const u=await s.request({method:"wallet_sendCalls",params:[{atomicRequired:c,calls:b,capabilities:t,chainId:y(p.id),from:h==null?void 0:h.address,id:r,version:w}]},{retryCount:0});return typeof u=="string"?{id:u}:u}catch(u){const e=u;if(m&&(e.name==="MethodNotFoundRpcError"||e.name==="MethodNotSupportedRpcError"||e.name==="UnknownRpcError"||e.details.toLowerCase().includes("does not exist / is not available")||e.details.toLowerCase().includes("missing or invalid. request()")||e.details.toLowerCase().includes("did not match any variant of untagged enum")||e.details.toLowerCase().includes("account upgraded to unsupported contract")||e.details.toLowerCase().includes("eip-7702 not supported")||e.details.toLowerCase().includes("unsupported wc_ method")||e.details.toLowerCase().includes("feature toggled misconfigured")||e.details.toLowerCase().includes("jsonrpcengine: response has no error or result for request"))){if(t&&Object.values(t).some(f=>!f.optional)){const f="non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`.";throw new O(new C(f,{details:f}))}if(c&&b.length>1){const n="`forceAtomic` is not supported on fallback to `eth_sendTransaction`.";throw new R(new C(n,{details:n}))}const i=[];for(const n of b){const f=G(s,{account:h,chain:p,data:n.data,to:n.to,value:n.value?x(n.value):void 0});i.push(f),d>0&&await new Promise(F=>setTimeout(F,d))}const o=await Promise.allSettled(i);if(o.every(n=>n.status==="rejected"))throw o[0].reason;const v=o.map(n=>n.status==="fulfilled"?n.value:A);return{id:I([...v,y(p.id,{size:32}),k])}}throw q(u,{...a,account:h,chain:a.chain})}}async function K(s,a){async function l(t){if(t.endsWith(k.slice(2))){const g=B(N(t,-64,-32)),u=N(t,0,-64).slice(2).match(/.{1,64}/g),e=await Promise.all(u.map(o=>A.slice(2)!==o?s.request({method:"eth_getTransactionReceipt",params:[`0x${o}`]},{dedupe:!0}):void 0)),i=e.some(o=>o===null)?100:e.every(o=>(o==null?void 0:o.status)==="0x1")?200:e.every(o=>(o==null?void 0:o.status)==="0x0")?500:600;return{atomic:!1,chainId:E(g),receipts:e.filter(Boolean),status:i,version:"2.0.0"}}return s.request({method:"wallet_getCallsStatus",params:[t]})}const{atomic:p=!1,chainId:m,receipts:d,version:c="2.0.0",...r}=await l(a.id),[w,h]=(()=>{const t=r.status;return t>=100&&t<200?["pending",t]:t>=200&&t<300?["success",t]:t>=300&&t<700?["failure",t]:t==="CONFIRMED"?["success",200]:t==="PENDING"?["pending",100]:[void 0,t]})();return{...r,atomic:p,chainId:m?E(m):void 0,receipts:(d==null?void 0:d.map(t=>({...t,blockNumber:x(t.blockNumber),gasUsed:x(t.gasUsed),status:L[t.status]})))??[],statusCode:h,status:w,version:c}}async function Z(s,a){var w;const{account:l=s.account,chainId:p,nonce:m}=a;if(!l)throw new P({docsPath:"/docs/eip7702/prepareAuthorization"});const d=S(l),c=(()=>{if(a.executor)return a.executor==="self"?a.executor:S(a.executor)})(),r={address:a.contractAddress??a.address,chainId:p,nonce:m};return typeof r.chainId>"u"&&(r.chainId=((w=s.chain)==null?void 0:w.id)??await T(s,j,"getChainId")({})),typeof r.nonce>"u"&&(r.nonce=await T(s,D,"getTransactionCount")({address:d.address,blockTag:"pending"}),(c==="self"||c!=null&&c.address&&M(c.address,d.address))&&(r.nonce+=1)),r}class Q extends C{constructor(a){super(`Call bundle failed with status: ${a.statusCode}`,{name:"BundleFailedError"}),Object.defineProperty(this,"result",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.result=a}}async function tt(s,a){const{id:l,pollingInterval:p=s.pollingInterval,status:m=({statusCode:i})=>i===200||i>=300,retryCount:d=4,retryDelay:c=({count:i})=>~~(1<<i)*200,timeout:r=6e4,throwOnFailure:w=!1}=a,h=z(["waitForCallsStatus",s.uid,l]),{promise:t,resolve:b,reject:g}=U();let u;const e=W(h,{resolve:b,reject:g},i=>{const o=$(async()=>{const v=n=>{clearTimeout(u),o(),n(),e()};try{const n=await H(async()=>{const f=await T(s,K,"getCallsStatus")({id:l});if(w&&f.status==="failure")throw new Q(f);return f},{retryCount:d,delay:c});if(!m(n))return;v(()=>i.resolve(n))}catch(n){v(()=>i.reject(n))}},{interval:p,emitOnBegin:!0});return o});return u=r?setTimeout(()=>{e(),clearTimeout(u),g(new V({id:l}))},r):void 0,await t}class V extends C{constructor({id:a}){super(`Timed out while waiting for call bundle with id "${a}" to be confirmed.`,{name:"WaitForCallsStatusTimeoutError"})}}export{K as g,Z as p,J as s,tt as w};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{w as o}from"./core-
|
|
1
|
+
import{w as o}from"./core-LDeQm5nv.js";import"./index-DIcymBxc.js";import"./index.es-0kjt2ETS.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CmhP8GU2.js";import"./clsx-B-dksMZM.js";import"./index-BhwNCc8y.js";const m=o`<svg fill="none" viewBox="0 0 20 20">
|
|
2
2
|
<path
|
|
3
3
|
fill="currentColor"
|
|
4
4
|
fill-rule="evenodd"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{w as a}from"./core-
|
|
1
|
+
import{w as a}from"./core-LDeQm5nv.js";import"./index-DIcymBxc.js";import"./index.es-0kjt2ETS.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CmhP8GU2.js";import"./clsx-B-dksMZM.js";import"./index-BhwNCc8y.js";const c=a`
|
|
2
2
|
<svg fill="none" viewBox="0 0 48 44">
|
|
3
3
|
<path
|
|
4
4
|
style="fill: var(--wui-color-bg-300);"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{w as l}from"./core-
|
|
1
|
+
import{w as l}from"./core-LDeQm5nv.js";import"./index-DIcymBxc.js";import"./index.es-0kjt2ETS.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CmhP8GU2.js";import"./clsx-B-dksMZM.js";import"./index-BhwNCc8y.js";const r=l`<svg fill="none" viewBox="0 0 96 67">
|
|
2
2
|
<path
|
|
3
3
|
fill="currentColor"
|
|
4
4
|
d="M25.32 18.8a32.56 32.56 0 0 1 45.36 0l1.5 1.47c.63.62.63 1.61 0 2.22l-5.15 5.05c-.31.3-.82.3-1.14 0l-2.07-2.03a22.71 22.71 0 0 0-31.64 0l-2.22 2.18c-.31.3-.82.3-1.14 0l-5.15-5.05a1.55 1.55 0 0 1 0-2.22l1.65-1.62Zm56.02 10.44 4.59 4.5c.63.6.63 1.6 0 2.21l-20.7 20.26c-.62.61-1.63.61-2.26 0L48.28 41.83a.4.4 0 0 0-.56 0L33.03 56.21c-.63.61-1.64.61-2.27 0L10.07 35.95a1.55 1.55 0 0 1 0-2.22l4.59-4.5a1.63 1.63 0 0 1 2.27 0L31.6 43.63a.4.4 0 0 0 .57 0l14.69-14.38a1.63 1.63 0 0 1 2.26 0l14.69 14.38a.4.4 0 0 0 .57 0l14.68-14.38a1.63 1.63 0 0 1 2.27 0Z"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{w as r}from"./core-
|
|
1
|
+
import{w as r}from"./core-LDeQm5nv.js";import"./index-DIcymBxc.js";import"./index.es-0kjt2ETS.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CmhP8GU2.js";import"./clsx-B-dksMZM.js";import"./index-BhwNCc8y.js";const n=r`<svg fill="none" viewBox="0 0 20 20">
|
|
2
2
|
<path
|
|
3
3
|
fill="currentColor"
|
|
4
4
|
d="M11 6.67a1 1 0 1 0-2 0v2.66a1 1 0 0 0 2 0V6.67ZM10 14.5a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as g,e as l,g as y,d as A,p as C}from"./en_US-Y4ZOVFV4-
|
|
1
|
+
import{A as g,e as l,g as y,d as A,p as C}from"./en_US-Y4ZOVFV4-CmhP8GU2.js";import{s as E}from"./sendTransaction-CqpP3CZj.js";async function a(n,r){return a.internal(n,E,"sendTransaction",r)}(function(n){async function r(c,u,f,w){const{abi:s,account:o=c.account,address:e,args:i,functionName:d,...p}=w;if(typeof o>"u")throw new g({docsPath:"/docs/contract/writeContract"});const t=o?C(o):null,h=l({abi:s,args:i,functionName:d});try{return await y(c,u,f)({data:h,to:e,account:t,...p})}catch(m){throw A(m,{abi:s,address:e,args:i,docsPath:"/docs/contract/writeContract",functionName:d,sender:t==null?void 0:t.address})}}n.internal=r})(a||(a={}));export{a as w};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{w as l}from"./core-
|
|
1
|
+
import{w as l}from"./core-LDeQm5nv.js";import"./index-DIcymBxc.js";import"./index.es-0kjt2ETS.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CmhP8GU2.js";import"./clsx-B-dksMZM.js";import"./index-BhwNCc8y.js";const r=l`<svg fill="none" viewBox="0 0 41 40">
|
|
2
2
|
<g clip-path="url(#a)">
|
|
3
3
|
<path fill="#000" d="M.8 0h40v40H.8z" />
|
|
4
4
|
<path
|
package/dist/index.html
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
<meta name="referrer" content="no-referrer" />
|
|
8
8
|
<title>Antseed Console</title>
|
|
9
9
|
<link rel="icon" type="image/svg+xml" href="/console/assets/antseed-mark-3TDLhfuw.svg" />
|
|
10
|
-
<script type="module" crossorigin src="/console/assets/index-
|
|
11
|
-
<link rel="stylesheet" crossorigin href="/console/assets/index-
|
|
10
|
+
<script type="module" crossorigin src="/console/assets/index-DIcymBxc.js"></script>
|
|
11
|
+
<link rel="stylesheet" crossorigin href="/console/assets/index-CfhMI0GY.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|
|
14
14
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as L,a as Q,r as l,b as W,i as $,c as H,d as J,e as w,j as s,P as X,B as C,I,f as h,S as m,g as R,h as b,k as o,l as N,Q as Y,m as Z,E as _,n as ee,q as B}from"./index-BpFwvYMF.js";import{U as se,M as ae,c as te}from"./UsageByModel-nhGKdBi8.js";import{p as re}from"./PeerPicker-w_ZaksUm.js";import{r as le,R as oe,g as M}from"./usage-yuqGLybi.js";import{S as V}from"./Segmented-D_Yun-tG.js";import{S as k}from"./SelectField-D3qPiNQz.js";import{D as ne}from"./DataTable-CCEZoIzX.js";import"./Charts-CHTi7z3n.js";import"./roving-DkptacxO.js";const E=[{value:"model",label:"Model"},{value:"key",label:"Key"},{value:"peer",label:"Seller"},{value:"user",label:"End user"},{value:"member",label:"Member",admin:!0},{value:"workspace",label:"Workspace",org:!0},{value:"day",label:"Day"}];function he(){var q;const{viewer:v,workspace:x}=L(),n=Q(),[i,F]=l.useState("30d"),[r,z]=l.useState("model"),A=W(),f=a=>r!=="peer"?M(a):a.group?re(A.data,a.group):"No seller (not served)",[d,U]=l.useState("spend"),[c,j]=l.useState(""),[p,S]=l.useState(""),g=$(v),y=l.useMemo(()=>Date.now(),[i]),K=le(i,y),u={...n,key:c||void 0,member:p||n.member,from:K,to:y},D=H({workspace:x.id,member:n.member}),G=J(x.id,g),P=w({queryKey:B.usage({...u,groupBy:"day"}),queryFn:()=>h.usage.report({...u,groupBy:"day"})}),O=w({queryKey:B.usage({...u,groupBy:r}),queryFn:()=>h.usage.report({...u,groupBy:r})}),t=(q=P.data)==null?void 0:q.totals;return s.jsxs("div",{className:"gc-page",children:[s.jsx(X,{title:"Activity",description:"Spend and token usage over time.",actions:s.jsx(C,{variant:"outline",size:"sm",href:h.usage.exportUrl({...u,groupBy:r}),download:!0,leadingIcon:s.jsx(I.download,{size:14}),children:"Export CSV"})}),s.jsxs("div",{className:"gc-toolbar",children:[s.jsx(V,{label:"Time range",value:i,onChange:F,options:oe.map(a=>({value:a.id,label:a.label}))}),s.jsx(k,{size:"sm","aria-label":"Filter by key",value:c,onChange:j,options:[{value:"",label:"All keys"},...(D.data??[]).map(a=>({value:a.id,label:a.label}))]}),g&&s.jsx(k,{size:"sm","aria-label":"Filter by member",value:p,onChange:S,options:[{value:"",label:"All members"},...(G.data??[]).map(({member:a})=>({value:a.id,label:a.label}))]}),(c||p)&&s.jsx(C,{variant:"ghost",size:"sm",onClick:()=>{j(""),S("")},children:"Clear filters"})]}),s.jsxs("div",{className:"gc-grid gc-grid--4",children:[s.jsx(m,{label:"Spend",value:t?R(t.spent):"…"}),s.jsx(m,{label:"Requests",value:t?b(t.requests):"…",sub:t?`${b(t.failedRequests)} failed`:void 0}),s.jsx(m,{label:"Input tokens",value:t?o(t.inputTokens):"…",sub:t?`${o(t.cachedInputTokens)} cached`:void 0}),s.jsx(m,{label:"Output tokens",value:t?o(t.outputTokens):"…"})]}),s.jsx(N,{title:d==="tokens"?"Tokens by type":"Usage by model",description:te(d,i),actions:s.jsx(V,{label:"Chart metric",value:d,onChange:U,options:ae}),children:s.jsx(se,{filter:{...n,key:c||void 0,member:p||n.member},range:i,now:y,metric:d})}),s.jsx(N,{title:"Breakdown",flush:!0,actions:s.jsx(k,{size:"sm","aria-label":"Group by",value:r,onChange:a=>z(a),options:E.filter(a=>(!a.admin||g)&&(!a.org||ee(v))).map(a=>({value:a.value,label:`By ${a.label.toLowerCase()}`}))}),children:s.jsx(Y,{query:O,children:a=>{var T;return s.jsx(ne,{label:"Usage breakdown",rows:a.groups,rowKey:e=>e.group,initialSort:{key:"spent",direction:"desc"},empty:s.jsx(_,{icon:s.jsx(I.activity,{size:18}),title:"No usage in this range",body:"Requests made with this workspace's keys show up here."}),columns:[{key:"label",header:((T=E.find(e=>e.value===r))==null?void 0:T.label)??"Group",render:e=>s.jsx("span",{className:"gc-ellipsis",title:r==="peer"?e.group:M(e),children:f(e)}),sortValue:e=>f(e)},{key:"requests",header:"Requests",align:"right",render:e=>b(e.requests),sortValue:e=>e.requests},{key:"failed",header:"Failed",align:"right",secondary:!0,render:e=>b(e.failedRequests),sortValue:e=>e.failedRequests},{key:"input",header:"Input",align:"right",secondary:!0,render:e=>o(e.inputTokens),sortValue:e=>e.inputTokens},{key:"cached",header:"Cached",align:"right",secondary:!0,render:e=>o(e.cachedInputTokens),sortValue:e=>e.cachedInputTokens},{key:"output",header:"Output",align:"right",secondary:!0,render:e=>o(e.outputTokens),sortValue:e=>e.outputTokens},{key:"spent",header:"Spend",align:"right",render:e=>R(e.spent),sortValue:e=>Z(e.spent)}]})}})})]})}export{he as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./index-BpFwvYMF.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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aC as ke,r as m,a$ as je,b0 as fe,j as s,C as ne,b1 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,b2 as Ee,z as ue,b3 as X,A as me,g as ye,m as Te,at as Re,E as Z,b4 as pe,D as De,q as F,f as C,v,au as J,e as Ie,b5 as Me,b6 as Ke,b7 as Ue,b8 as ee,o as Fe,X as _e}from"./index-BpFwvYMF.js";import{u as se,a as Oe,P as Ye}from"./PolicyField-BbDSVgcK.js";import{T as Be}from"./Tabs-DmkE9BPd.js";import{l as te,d as ae,L as $e}from"./limits-DjiKmaDB.js";import{t as qe}from"./dates-Pi3-Ywng.js";import{r as ze,e as We}from"./usage-yuqGLybi.js";import{S as he}from"./Switch-BmFsXcr8.js";import{D as Ve,u as He,P as Qe}from"./DataTable-CCEZoIzX.js";import{b as Ge}from"./Charts-CHTi7z3n.js";import{S as Xe}from"./SelectField-D3qPiNQz.js";import"./PolicyEditor-BOjadRE8.js";import"./PeerPicker-w_ZaksUm.js";import"./Segmented-D_Yun-tG.js";import"./roving-DkptacxO.js";import"./Disclosure-BitAjv2r.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=ze(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:We(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(_e,{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($e,{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 z;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)??""),[x,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(qe((e==null?void 0:e.expiresAt)??null)),[g,E]=m.useState((e==null?void 0:e.topupEnabled)??!1),[n,b]=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),be=Ke(y.id,a),_=((e==null?void 0:e.buyerIdentity)??((z=be.data)==null?void 0:z.buyerIdentity))==="default",O=de(y.id,a&&!e),R=Oe(),[Y,B]=m.useState(null),D=p.admin,$=e?p.owner&&(p.layered||!p.admin):!p.admin,T=e!==null&&p.layered;let q=null;T&&(q=p.admin?"Your restrictions as the key owner":"Your restrictions");const ge=e?"Save":"Create key",xe=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,W=D?w.build():null,V=$?t.build():null,H=ae(x),Q=ae(L);if(e){const f=Ue(p,e,{label:h.trim(),expiresAt:u,topupEnabled:g,adminLimits:H,adminPolicy:W,ownerLimits:Q,ownerPolicy:V}),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?H:Q,routingPolicy:p.admin?W:V,topupEnabled:p.admin?g:!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&&O.data&&s.jsx(Xe,{label:"Owner",value:n,onChange:b,options:O.data.map(({member:u})=>({value:u.id,label:u.id===i.member.id?`${u.label} (you)`:u.label}))}),D&&s.jsx(oe,{title:T?"Workspace admin restrictions":null,idPrefix:"key-limit",limits:x,onLimitsChange:P,limitsNote:"UTC periods; weeks start Monday. The workspace and member budgets apply too.",policy:w}),!D&&T&&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."}),$&&s.jsx(oe,{title:q,idPrefix:"key-owner-limit",limits:L,onLimitsChange:N,limitsNote:xe,policy:t}),T&&!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:g,onChange:E,disabled:_&&!g,label:"Allow top-ups",description:_?"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…":ge})]}),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=He(i,as,`${d}|${o}`);return s.jsxs(s.Fragment,{children:[y(a.items,i.length===0&&e.length>0),s.jsx(Qe,{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,x]=m.useState(null),[P,L]=m.useState(!1),[N,j]=m.useState(""),A=Pe(c),g=ie({mutationFn:async({kind:n,key:b})=>{n==="rotate"?h(await C.keys.rotate(b.id)):await C.keys.revoke(b.id)},onSuccess:()=>x(null),invalidate:[F.group("keys")],toast:(n,{kind:b})=>b==="revoke"?"Key revoked":null}),E=n=>{var b,w;return n.ownerMemberId?n.ownerMemberId===l.member.id?"You":((w=(b=d.data)==null?void 0:b.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:E,render:(b,w)=>s.jsx(Ve,{label:"API keys",rows:b,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:()=>x({kind:"rotate",key:t})},{label:"Revoke",tone:"danger",onSelect:()=>x({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(Ee,{name:t.label,hint:t.hint})},{key:"owner",header:"Owner",secondary:!0,render:E},{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=>Te(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:g.isPending,error:g.error,onClose:()=>{x(null),g.reset()},onConfirm:()=>k&&g.mutate(k),...os(k)})]})}export{js as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,a as D,c as E,j as e,P as I,B as y,I as U,f as q,T as p,l as M}from"./index-BpFwvYMF.js";import{R as B}from"./RequestLog-39L0RtJc.js";import{f as C}from"./dates-Pi3-Ywng.js";import{S as T}from"./SelectField-D3qPiNQz.js";import"./useInfiniteQuery-Dwl-oWNd.js";import"./PeerPicker-w_ZaksUm.js";import"./usage-yuqGLybi.js";import"./DataTable-CCEZoIzX.js";function F(a,o=300){const[l,r]=s.useState(a);return s.useEffect(()=>{const i=window.setTimeout(()=>r(a),o);return()=>window.clearTimeout(i)},[a,o]),l}function V(){const a=D(),[o,l]=s.useState(""),[r,i]=s.useState(""),[n,h]=s.useState(""),[v,b]=s.useState(""),[c,g]=s.useState(""),[d,x]=s.useState(""),k=E(a),f=F(r.trim()),S=F(v.trim()),u=C(c,"start"),m=C(d,"end"),w=u!==void 0&&m!==void 0&&u>m,j=s.useMemo(()=>({...a,key:o||void 0,model:f||void 0,status:n||void 0,q:S||void 0,from:u,to:m}),[a.workspace,a.member,o,f,n,S,u,m]),z=!!(o||r||n||v||c||d);return e.jsxs("div",{className:"gc-page",children:[e.jsx(I,{title:"Logs",description:"Every request through this workspace's keys.",actions:e.jsx(y,{variant:"outline",size:"sm",href:q.usage.exportUrl(j),download:!0,leadingIcon:e.jsx(U.download,{size:14}),children:"Export CSV"})}),e.jsxs("div",{className:"gc-toolbar",children:[e.jsx(p,{size:"sm",type:"search","aria-label":"Search requests",placeholder:"Search model, key, end user or error",value:v,onChange:t=>b(t.target.value),className:"gc-toolbar__grow"}),e.jsx(T,{size:"sm","aria-label":"Filter by key",value:o,onChange:l,options:[{value:"",label:"All keys"},...(k.data??[]).map(t=>({value:t.id,label:t.label}))]}),e.jsx(p,{size:"sm","aria-label":"Filter by model",placeholder:"Model",value:r,onChange:t=>i(t.target.value)}),e.jsx(T,{size:"sm","aria-label":"Filter by status",value:n,onChange:h,options:[{value:"",label:"Any status"},{value:"success",label:"Succeeded"},{value:"error",label:"Failed"}]}),e.jsx(p,{size:"sm",type:"date","aria-label":"From date (UTC)",title:"From (UTC)",value:c,max:d||void 0,onChange:t=>g(t.target.value)}),e.jsx(p,{size:"sm",type:"date","aria-label":"To date (UTC)",title:"To (UTC)",value:d,min:c||void 0,onChange:t=>x(t.target.value),error:w?"Ends before it starts":void 0}),z&&e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>{l(""),i(""),h(""),b(""),g(""),x("")},children:"Clear filters"})]}),e.jsx(M,{flush:!0,children:e.jsx(B,{filter:j})})]})}export{V as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as W,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,b9 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,aF as be,v as D,au as se,ba as ne,bb as he,at as J,T as I,ah as X,o as ie,b1 as pe,aN as ve}from"./index-BpFwvYMF.js";import{u as xe,a as je,P as ye}from"./PolicyField-BbDSVgcK.js";import{l as ke,d as fe,L as we}from"./limits-DjiKmaDB.js";import{D as Y}from"./DataTable-CCEZoIzX.js";import{S as M}from"./SelectField-D3qPiNQz.js";import"./PolicyEditor-BOjadRE8.js";import"./PeerPicker-w_ZaksUm.js";import"./Segmented-D_Yun-tG.js";import"./roving-DkptacxO.js";import"./Switch-BmFsXcr8.js";import"./Disclosure-BitAjv2r.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")],K=[...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}=W(),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:K}),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}=W(),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}=W(),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:K});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}=W(),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:K,toast:"Removed from workspace"}),S=N({mutationFn:l=>w.workspaces.setMember(t.id,l,"member"),onSuccess:()=>j(""),invalidate:K,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 +0,0 @@
|
|
|
1
|
-
import{be as E,r as m,j as e,bf as V,Y as $,bg as R,O as C,R as U,bh as O,bi as _,bj as z,L as D,E as f,I as M,P as K,T as Y,y as I,l as q,Q,bk as G,M as b,h as H,bl as v,bm as T,bn as S,bo as X,aN as N,v as x,X as J,B as W,aw as Z,ax as ee,w as L,k as se}from"./index-BpFwvYMF.js";import{T as te,a as ae}from"./Tabs-DmkE9BPd.js";import{m as ne,f as le,M as P,S as ie,a as re,T as k,C as oe,P as w,b as ce,V as de,p as ue}from"./models-CJU4tPJk.js";import{S as A}from"./SelectField-D3qPiNQz.js";import{S as pe}from"./Switch-BmFsXcr8.js";import{D as he}from"./DataTable-CCEZoIzX.js";import"./roving-DkptacxO.js";function ge({model:s,format:n,id:o="gc-api-call",unsupported:i}){const p=E(),[h,r]=m.useState("curl");if(!n)return e.jsx("p",{className:"gc-fineprint",children:i??"The gateway does not serve this model through its API."});const a=V(p,s,n),d=a.find(c=>c.id===h)??a[0];return e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsx(te,{id:o,label:"Request examples",value:d.id,onChange:r,className:"gc-connect-tabs",tabs:a.map(c=>({id:c.id,label:c.label}))}),e.jsx(ae,{tabsId:o,tab:d.id,children:e.jsx($,{code:d.code,label:d.label})}),e.jsxs("p",{className:"gc-fineprint",children:["Set ",e.jsx("code",{children:R})," to one of your API keys first. ",e.jsx(C,{to:"keys",children:"API keys"})]})]})}function xe(s){return s===null?"—":String(Math.round(s))}function B(s){return s===null?"—":se(s)}function F(s){return s.fullTeeSellers>0?"end-to-end":s.offers.some(n=>n.teeScope==="seller-node")?"seller-node":null}function me({model:s}){return e.jsxs("div",{className:"gc-badges",children:[s.free&&e.jsx(x,{tone:"success",children:"Free"}),e.jsx(k,{tee:s.teeSellers>0,scope:F(s)})]})}function y(s){return s.displayName??L(s.peerId,8,4)}function Ie(){const s=U(),n=O(s.rest),o=_(),[i,p]=m.useState({search:"",type:"",free:!1}),h=m.useMemo(()=>ne(o.data),[o.data]),r=m.useMemo(()=>n?le(o.data,n):null,[o.data,n]),a=z(),d=(l,t)=>p(u=>({...u,[l]:t})),c=n===null?null:{eyebrow:"Model",title:(r==null?void 0:r.name)??n,body:o.isLoading?e.jsx(D,{rows:6}):r?e.jsx(je,{model:r},r.id):e.jsx(f,{icon:e.jsx(M.models,{size:18}),title:"Model not found",body:`No provider on the network offers ${n} right now.`})},j=e.jsx(q,{flush:!0,children:e.jsx(Q,{query:o,rows:8,children:l=>e.jsx(he,{label:"Models",rows:re(l,i),rowKey:t=>t.id,selectedKey:(r==null?void 0:r.id)??null,onRowClick:t=>I(T("models",t.id)),rowLabel:t=>t.name,actions:t=>[{label:"Copy model id",onSelect:()=>void a(t.id)}],initialSort:{key:"sellers",direction:"desc"},empty:e.jsx(f,{icon:e.jsx(M.models,{size:18}),title:l.length?"No models match these filters":"No models found yet",body:l.length?void 0:"The buyer is still discovering the network. Check back in a minute."}),columns:[{key:"model",header:"Model",sortValue:t=>t.name.toLowerCase(),render:t=>e.jsxs("div",{className:"gc-cell-lines",children:[e.jsx("div",{className:"gc-strong gc-ellipsis",title:t.id,children:t.name}),t.name!==t.id&&e.jsx("div",{className:"gc-muted gc-ellipsis",children:e.jsx(b,{children:t.id})}),e.jsx(me,{model:t})]}),after:t=>e.jsx(G,{value:t.id,label:`Copy model id ${t.id}`})},{key:"type",header:"Type",secondary:!0,sortValue:t=>t.type,render:t=>e.jsx("span",{className:"gc-muted",children:P[t.type]})},{key:"sellers",header:"Providers",align:"right",sortValue:t=>t.sellers,render:t=>H(t.sellers)},{key:"input",header:"Input $/M",align:"right",sortValue:t=>{var u;return((u=t.inputUsdPerMillion)==null?void 0:u.min)??null},render:t=>v(t.inputUsdPerMillion)},{key:"output",header:"Output $/M",align:"right",secondary:!0,sortValue:t=>{var u;return((u=t.outputUsdPerMillion)==null?void 0:u.min)??null},render:t=>v(t.outputUsdPerMillion)},{key:"context",header:"Context",align:"right",secondary:!0,optional:!0,sortValue:t=>t.contextLength,render:t=>B(t.contextLength)}]})})});return e.jsxs("div",{className:"gc-page",children:[e.jsx(K,{title:"Models",description:"Every model on the network. Open one to see its providers, copy a model id and get a ready-to-run API call."}),e.jsxs("div",{className:"gc-toolbar",children:[e.jsx(Y,{size:"sm",type:"search","aria-label":"Search models",placeholder:"Search model or alias",value:i.search,onChange:l=>d("search",l.target.value)}),h.length>1&&e.jsx(A,{size:"sm","aria-label":"Filter by type",value:i.type,onChange:l=>d("type",l),options:[{value:"",label:"All types"},...h.map(l=>({value:l,label:P[l]}))]}),e.jsx(pe,{checked:i.free,onChange:l=>d("free",l),label:"Free"})]}),e.jsx(ie,{list:j,panel:c,onClose:()=>I("models"),closeLabel:"Close model"})]})}function g(s){return`${s.peerId}:${s.serviceId}`}function je({model:s}){const[n,o]=m.useState(""),i=s.offers.find(a=>g(a)===n)??null,p=i?S(i.peerId,i.serviceId):s.id,h=X(s.type,i),r=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(b,{title:s.id,children:s.id}),e.jsx(N,{iconOnly:!0,value:s.id,label:"Copy model id"})]}),e.jsx(x,{children:P[s.type]}),s.free&&e.jsx(x,{tone:"success",children:"Free"}),e.jsx(k,{tee:s.teeSellers>0,scope:F(s)})]}),e.jsx(J,{items:[["Context",B(s.contextLength)],["Capabilities",s.capabilities.length?e.jsx("span",{className:"gc-badges",children:s.capabilities.map(a=>e.jsx(x,{children:oe[a]},a))}):"—"],["Aliases",s.aliases.length?e.jsx(b,{children:s.aliases.join(", ")}):"—"],...r?[]:[["Input $/M",v(s.inputUsdPerMillion)],["Output $/M",v(s.outputUsdPerMillion)]]]})]}),e.jsx(w,{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 j;const d=S(a.peerId,a.serviceId),c=n===g(a);return e.jsx(ce,{selected:c,title:e.jsx(C,{to:T("providers",a.peerId),children:y(a)}),meta:e.jsxs(e.Fragment,{children:[e.jsx("span",{children:ue(a)}),e.jsxs("span",{children:["Trust ",xe(a.trustScore)]}),a.firstTokenMsP50!==null&&e.jsxs("span",{children:[Z(a.firstTokenMsP50)," first token"]}),a.tokensPerSecondP50!==null&&e.jsx("span",{children:ee(a.tokensPerSecondP50)}),a.serviceId!==s.id&&e.jsx(b,{children:a.serviceId})]}),badges:(((j=a.verificationLinks)==null?void 0:j.length)||a.tee||a.free)&&e.jsxs("div",{className:"gc-badges",children:[e.jsx(de,{links:a.verificationLinks}),e.jsx(k,{tee:a.tee,scope:a.teeScope}),a.free&&e.jsx(x,{tone:"success",children:"Free"})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(N,{iconOnly:!0,value:d,label:`Copy ${y(a)}'s model id (peer@model)`}),e.jsx(W,{size:"sm",variant:c?"outline":"ghost","aria-pressed":c,title:"Use this provider in the API call below",onClick:()=>o(c?"":g(a)),children:c?"Pinned":"Pin"})]})},g(a))})})}),e.jsxs(w,{title:"API call",actions:s.offers.length>0&&e.jsx(A,{size:"sm","aria-label":"Route the call",value:n,onChange:o,options:[{value:"",label:"Best provider (automatic)"},...s.offers.map(a=>({value:g(a),label:y(a)}))]}),children:[e.jsx("p",{className:"gc-fineprint",children:i?e.jsxs(e.Fragment,{children:["Pinned to ",y(i)," with ",e.jsx("code",{children:L(p,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(ge,{id:"gc-model-call",model:p,format:h,unsupported:`${P[s.type]} models are not served through the gateway's /v1 API.`})]})]})}export{Ie as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as y,a3 as G,a4 as J,a5 as K,a6 as B,u as X,a7 as Z,j as e,a8 as ee,a9 as se,aa as le,ab as A,B as j,ac as ie,ad as F,T as z,D as ne,ae as E,I as ae,af as te,ag as re,ah as ce,ai as oe,aj as de,ak as me,al as he}from"./index-BpFwvYMF.js";import{P as k,C as ue}from"./PeerPicker-w_ZaksUm.js";import{S}from"./SelectField-D3qPiNQz.js";import{S as v}from"./Segmented-D_Yun-tG.js";import{S as T}from"./Switch-BmFsXcr8.js";import{D as R}from"./Disclosure-BitAjv2r.js";function pe({draft:l,parent:d,above:t,peers:c,lists:m}){const n=y.useMemo(()=>{if(!c||c.length===0)return null;let h;try{h=te(l,m)}catch{return null}return{matched:re(B(d,h),c,m).length,total:c.length}},[l,d,c,m]);return n?n.matched===0?e.jsxs(ce,{tone:"warning",title:"No seller matches this policy",children:["With ",t?`${t} and `:"","these settings, none of the ",n.total," sellers this gateway sees can serve a request. Requests will fail until you loosen it."]}):e.jsxs("p",{className:"gc-muted","aria-live":"polite",children:["Matches ",n.matched," of ",n.total," sellers",t?` after ${t}`:"","."]}):null}function Ne({value:l,onChange:d,peers:t,lists:c,showTemplates:m=!0,parent:n,disabled:h}){const[x,b]=y.useState(""),[o,p]=y.useState(null),a=(s,r)=>d({...l,[s]:r}),N=G(t),I=c.map(s=>({value:s.id,label:`${s.name} (${s.peerIds.length})`})),g=J(K().data),i=y.useMemo(()=>g||n?B(g,n):null,[g,n]),D=g&&n?"the buyer config and the levels above":g?"the buyer config":n?"the levels above":"",w=s=>(g==null?void 0:g[s])!==void 0&&g[s]===(i==null?void 0:i[s])?"The buyer config":"The levels above",{viewer:W}=X(),Y=Z("settings",W)?e.jsx("a",{className:"gc-link",href:se("settings?tab=buyer"),onClick:ee("settings?tab=buyer"),children:"Change"}):null,O=s=>w(s)==="The buyer config"?Y:null,H=le(t)||l.minReputation!==""||(i==null?void 0:i.minReputation)!==void 0;function q(s){var $;let r;if(s==="own"){const C=c.find(Q=>Q.id===x);if(!C)return;r={allowMode:"only",allowedPeerIds:[],allowedListIds:[C.id]}}else r=oe(de(s));const u=me(l,r),f=(($=A.find(C=>C.id===s))==null?void 0:$.label)??s;u.length>0?p({label:f,template:r,conflicts:u}):d(E(l,r))}function P(s,r){a("routes",l.routes.map((u,f)=>f===s?r:u))}const M=[l.maxInputUsdPerMillion,l.maxOutputUsdPerMillion,l.maxCachedInputUsdPerMillion,l.maxImageUsdPerImage].filter(s=>s.trim()!=="").length,_=(s,r)=>e.jsx(z,{size:"sm",className:"gc-num",label:r,inputMode:"decimal",value:l[s],placeholder:(i==null?void 0:i[s])!==void 0?`≤ ${he(i[s])} above`:"No cap",onChange:u=>a(s,u.target.value)}),L=e.jsxs(e.Fragment,{children:[e.jsx(pe,{draft:l,parent:i,above:D,peers:t,lists:c}),m&&!h&&e.jsxs("div",{className:"gc-policy__templates",children:[e.jsx("span",{className:"gc-muted",children:"Start from"}),A.filter(s=>s.id!=="own").map(s=>e.jsx(j,{size:"sm",variant:"outline",title:s.description,onClick:()=>q(s.id),children:s.label},s.id)),c.length>0&&e.jsxs("span",{className:"gc-inline",children:[e.jsx(S,{size:"sm","aria-label":"Peer list for Own peers only",value:x,onChange:b,options:[{value:"",label:"Own peer list…"},...I]}),e.jsx(j,{size:"sm",variant:"outline",disabled:!x,onClick:()=>q("own"),children:"Use"})]}),e.jsx(j,{size:"sm",variant:"link",className:"gc-policy__clear",onClick:()=>d(ie()),children:"Clear policy"})]}),e.jsxs("div",{className:"gc-policy__cols",children:[e.jsxs("section",{className:"gc-policy__section",children:[e.jsx("h3",{children:"Sellers"}),e.jsx(v,{label:"Which sellers may serve",value:l.allowMode,onChange:s=>a("allowMode",s),options:[{value:"any",label:"Any seller"},{value:"only",label:"Only these"}]}),l.allowMode==="only"&&e.jsxs(e.Fragment,{children:[e.jsx(k,{label:"Allowed sellers",value:l.allowedPeerIds,onChange:s=>a("allowedPeerIds",s),peers:t}),e.jsx(V,{label:"Allowed peer lists",lists:c,value:l.allowedListIds,onChange:s=>a("allowedListIds",s)}),l.allowedPeerIds.length===0&&l.allowedListIds.length===0&&e.jsx("p",{className:"gc-warn",children:"An empty allow list means no seller can serve."})]}),e.jsx(k,{label:"Blocked sellers",value:l.blockedPeerIds,onChange:s=>a("blockedPeerIds",s),peers:t}),e.jsx(V,{label:"Blocked peer lists",lists:c,value:l.blockedListIds,onChange:s=>a("blockedListIds",s)})]}),e.jsxs("section",{className:"gc-policy__section",children:[e.jsx("h3",{children:"Quality and ranking"}),e.jsx(U,{label:"Minimum trust score",value:l.minTrustScore,onChange:s=>a("minTrustScore",s),floor:i==null?void 0:i.minTrustScore,floorSource:w("minTrustScore"),floorAction:O("minTrustScore")}),e.jsxs("div",{className:"gc-policy__switches",children:[e.jsx(T,{checked:l.requireTee||!!(i!=null&&i.requireTee),disabled:!!(i!=null&&i.requireTee),onChange:s=>a("requireTee",s),label:"TEE sellers only"}),e.jsx(T,{checked:l.requireVerified||!!(i!=null&&i.requireVerified),disabled:!!(i!=null&&i.requireVerified),onChange:s=>a("requireVerified",s),label:"Verified sellers only"})]}),((i==null?void 0:i.requireTee)||(i==null?void 0:i.requireVerified))&&e.jsxs("span",{className:"as-field__hint",children:[i.requireTee&&i.requireVerified?"TEE and verified sellers are":i.requireTee?"TEE sellers are":"Verified sellers are"," already required above."]}),e.jsxs("div",{className:"gc-policy__pair",children:[e.jsx(S,{size:"sm",label:"Sort by",value:l.sort,onChange:s=>a("sort",s),options:[{value:"",label:"Inherit"},...Object.keys(F).map(s=>({value:s,label:F[s]}))]}),e.jsx(S,{size:"sm",label:"Free sellers first",value:l.preferFreePeers,onChange:s=>a("preferFreePeers",s),options:[{value:"inherit",label:"Inherit"},{value:"yes",label:"Yes"},{value:"no",label:"No"}]})]}),e.jsx(v,{label:"Which models may be used",value:l.modelsMode,onChange:s=>a("modelsMode",s),options:[{value:"any",label:"Any model"},{value:"only",label:"Only these models"}]}),l.modelsMode==="only"&&e.jsx(ue,{label:"Allowed models",value:l.allowedModels,onChange:s=>a("allowedModels",s),suggestions:N,placeholder:"Model id"})]})]}),e.jsxs("div",{className:"gc-policy__advanced",children:[e.jsx(R,{title:"Price caps",summary:M?`${M} set`:"None",defaultOpen:h&&M>0,children:e.jsxs("div",{className:"gc-policy__caps",children:[_("maxInputUsdPerMillion","Input $/M"),_("maxOutputUsdPerMillion","Output $/M"),_("maxCachedInputUsdPerMillion","Cached input $/M"),_("maxImageUsdPerImage","$ per image")]})}),e.jsxs(R,{title:"Fallback chains",summary:l.routes.length?`${l.routes.length} chain${l.routes.length===1?"":"s"}`:"None",defaultOpen:h&&l.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."}),l.routes.map((s,r)=>e.jsxs("div",{className:"gc-route",children:[e.jsxs("div",{className:"gc-inline",children:[e.jsx(z,{size:"sm",label:"Model",list:"gc-policy-models",value:s.model,placeholder:"Model id",onChange:u=>P(r,{...s,model:u.target.value})}),e.jsx(T,{checked:s.strict,onChange:u=>P(r,{...s,strict:u}),label:"Strict"}),e.jsx(j,{variant:"ghost",size:"sm",onClick:()=>a("routes",l.routes.filter((u,f)=>f!==r)),children:"Remove"})]}),e.jsx(k,{label:"Sellers, in order",ordered:!0,value:s.peerIds,onChange:u=>P(r,{...s,peerIds:u}),peers:t})]},r)),e.jsx("datalist",{id:"gc-policy-models",children:N.map(s=>e.jsx("option",{value:s},s))}),e.jsx("div",{children:e.jsx(j,{variant:"outline",size:"sm",onClick:()=>a("routes",[...l.routes,{model:"",peerIds:[],strict:!1}]),children:"Add fallback chain"})})]}),H&&e.jsx(R,{title:"Reputation",summary:l.minReputation!==""?`≥ ${l.minReputation}`:(i==null?void 0:i.minReputation)!==void 0?`Inherit (≥ ${i.minReputation})`:"Inherit",defaultOpen:h&&l.minReputation!=="",children:e.jsx(U,{label:"Minimum reputation",value:l.minReputation,onChange:s=>a("minReputation",s),floor:i==null?void 0:i.minReputation,floorSource:w("minReputation"),floorAction:O("minReputation")})})]}),e.jsx(ne,{isOpen:o!==null,tone:"primary",title:`Apply “${(o==null?void 0:o.label)??""}”?`,confirmLabel:"Replace and apply",body:e.jsxs(e.Fragment,{children:["This template changes settings you already set: ",e.jsx("strong",{children:o==null?void 0:o.conflicts.join(", ")}),". Your other settings stay."]}),onClose:()=>p(null),onConfirm:()=>{o&&d(E(l,o.template)),p(null)}})]});return h?e.jsx("fieldset",{className:"gc-policy gc-policy--readonly",disabled:!0,children:L}):e.jsx("div",{className:"gc-policy",children:L})}function U({label:l,value:d,onChange:t,clearable:c=!0,hint:m,floor:n,floorSource:h="The levels above",floorAction:x}){const b=y.useId(),o=d!=="",p=n!==void 0&&n>0,a=p&&o&&Number(d)<=n,N=a?String(n):o?d:p?`${n} inherited`:"Inherit";return e.jsxs("div",{className:"gc-slider",children:[e.jsxs("div",{className:"gc-slider__head",children:[e.jsx("span",{className:"as-field__label",id:b,children:l}),e.jsx("span",{className:o?"gc-slider__value":"gc-slider__value gc-slider__value--inherit",children:N})]}),e.jsxs("div",{className:"gc-inline",children:[e.jsx("input",{type:"range",min:0,max:100,step:5,value:o?Math.max(Number(d),p?n:0):p?n:0,"aria-labelledby":b,onChange:I=>t(String(Math.max(Number(I.target.value),p?n:0)))}),c&&o&&e.jsx(j,{variant:"ghost",size:"sm",onClick:()=>t(""),children:"Clear"})]}),p&&(o&&!a?e.jsxs("span",{className:"as-field__hint",children:[h," requires ≥ ",n,". Only a higher value narrows it."]}):e.jsxs("span",{className:"as-field__hint gc-override",children:[e.jsx(ae.lock,{size:12})," Locked at ",n," by ",h.replace(/^The /,"the "),".",x?e.jsxs(e.Fragment,{children:[" ",x]}):null]})),m&&e.jsx("span",{className:"as-field__hint",children:m})]})}function V({label:l,lists:d,value:t,onChange:c}){return d.length===0?null:e.jsxs("fieldset",{className:"gc-checks",children:[e.jsx("legend",{className:"as-field__label",children:l}),d.map(m=>e.jsxs("label",{className:"gc-check",children:[e.jsx("input",{type:"checkbox",checked:t.includes(m.id),onChange:n=>c(n.target.checked?[...t,m.id]:t.filter(h=>h!==m.id))}),m.name," ",e.jsxs("span",{className:"gc-muted",children:["(",m.peerIds.length,")"]})]},m.id))]})}export{Ne as P,U as S};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{u as A,i as J,bp as B,r as n,t as E,j as e,P as $,B as y,I as k,l as L,Q as R,M as Q,aN 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,a3 as _,o as X,q as O,f as v}from"./index-BpFwvYMF.js";import{u as Y,a as Z,P as ee}from"./PolicyField-BbDSVgcK.js";import{D as se}from"./DataTable-CCEZoIzX.js";import{S as re}from"./SelectField-D3qPiNQz.js";import{T as N}from"./TextAreaField-RZPCzhKZ.js";import"./PolicyEditor-BOjadRE8.js";import"./PeerPicker-w_ZaksUm.js";import"./Segmented-D_Yun-tG.js";import"./roving-DkptacxO.js";import"./Switch-BmFsXcr8.js";import"./Disclosure-BitAjv2r.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?v.presets.update(s.id,r,f):v.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(y,{variant:"ghost",onClick:()=>m(),children:"Cancel"}),e.jsx(y,{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=>v.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(y,{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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bY as Ke,ay as pe,b4 as Ge,u as Z,a as fe,F as Qe,G as Ye,n as we,i as ye,r as p,U as He,c as be,e as Je,bZ as We,bx as Ze,$ as q,b_ as Xe,b$ as es,f as A,aF as ss,j as s,C as X,ah as Q,o as ee,B as k,L as ve,A as ts,bs as rs,t as ke,q as xe,l as je,Q as Pe,E as W,I as U,D as ns,T as V,w as F,M as Se,aN as Ce,v as L,at as as,bW as N,aw as Ie,ax as Ne,h as $e,Z as os,bn as Ae,c0 as Fe,be as ls,bp as is,c1 as cs,Y as ds,bg as us,O as ms,R as hs,bh as gs,b as ps,a3 as fs,aa as ws,bj as ys,bk as bs,bl as ce,bq as vs,y as de,bm as ks,P as xs}from"./index-BpFwvYMF.js";import{p as Y,P as js}from"./PeerPicker-w_ZaksUm.js";import{S as $}from"./SelectField-D3qPiNQz.js";import{D as Le}from"./DataTable-CCEZoIzX.js";import{V as Te,T as Me,P as De,b as Ps,p as Ss,S as Cs}from"./models-CJU4tPJk.js";import{f as Is}from"./ants-B38m9Phv.js";import{PresetForm as Ns}from"./Presets-9x2m9R-f.js";import{T as $s,a as As}from"./Tabs-DmkE9BPd.js";import{S as H}from"./Switch-BmFsXcr8.js";import"./PolicyField-BbDSVgcK.js";import"./PolicyEditor-BOjadRE8.js";import"./Segmented-D_Yun-tG.js";import"./roving-DkptacxO.js";import"./Disclosure-BitAjv2r.js";import"./TextAreaField-RZPCzhKZ.js";function Ee(e,t="admin"){return t==="owner"&&Ge(e)?"ownerRoutingPolicy":"routingPolicy"}async function Oe(e,t){const r=(await e.keys.list({workspace:t.workspaceId})).find(a=>a.id===t.keyId);if(!r)throw new Error("That key no longer exists.");return r}async function Re(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(a=>a.id===t.memberId);if(!r)throw new Error("That member no longer exists.");return r.routingPolicy}case"key":{const r=await Oe(e,t);return r[Ee(r,t.layer)]??null}}}async function Fs(e,t,r,a){const o=a!=null&&a.confirmEmpty||a!=null&&a.acceptNarrowed?[a]:[];switch(t.kind){case"gateway":await e.network.setGatewayPolicy(r??{},...o);return;case"workspace-org":await e.workspaces.update(t.workspaceId,{orgRoutingPolicy:r},...o);return;case"workspace":await e.workspaces.update(t.workspaceId,{routingPolicy:r},...o);return;case"member":await e.members.update(t.memberId,{routingPolicy:r},...o);return;case"key":{const i=t.layer==="owner"?Ee(await Oe(e,t),"owner"):"routingPolicy";await e.keys.update(t.keyId,{[i]:r},...o);return}}}const ue=e=>JSON.stringify(e??{},Object.keys(e??{}).sort());async function Ls(e,t,r,a,o,i){const m=await Re(e,t),c=Ke(m,r,a,o),g=ue(m)!==ue(c)||JSON.stringify(m??{})!==JSON.stringify(c);return g&&await Fs(e,t,c,i),{before:m,after:c,changed:g}}function Ts(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 Ms={allow:"Allowed",block:"Blocked",prefer:"Preferred"};function Ds(e){const{action:t,name:r,scopeLabel:a,changed:o,model:i,preview:m,peerId:c}=e,g=Ms[t],f=t==="prefer"?`already first for ${i}`:`already ${g.toLowerCase()}`,l=o?`${g} ${r} ${t==="prefer"?`for ${i} `:""}on ${a}`:`${r} was ${f} on ${a}; nothing changed`;if(!m)return t==="block"?{tone:o?"success":"info",text:`${l}.`}:{tone:"info",text:`${l}. ${e.previewError?`Could not check whether it can serve: ${e.previewError}`:"Could not check whether it can serve."}`};const u=m.candidates.find(b=>pe(b.peerId,c));if(t==="block")return u!=null&&u.eligible?{tone:"warning",text:`${l}, but the route preview still lists it as eligible for ${i}. Reload and check the policy.`}:{tone:o?"success":"info",text:`${l}.`};if(!m.modelAllowed)return{tone:"warning",text:`${l}, but ${i} is not an allowed model here, so it still cannot serve it.`};if(!u)return{tone:"info",text:`${l}. It does not offer ${i} right now, so the preview cannot show its rank.`};if(!u.eligible){const b=u.reasons.length?u.reasons.join("; "):"another level excludes it";return{tone:"warning",text:`${l}, but it still cannot serve ${i} here: ${b}.`}}return t==="prefer"&&u.rank!==null&&u.rank>1?{tone:"warning",text:`${l}, but it ranks #${u.rank} for ${i}: a fallback chain on another level comes first.`}:{tone:o?"success":"info",text:`${l}.${u.rank?` It ranks #${u.rank} for ${i}.`:""}`}}function Es(e,t,r,a){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:a?"admin":"owner"}:null}function Os(e){return e.canForce?"Not allowed above":e.tone==="warning"?"Check the result":"Done"}function Rs({fetching:e,error:t,ready:r,policy:a}){return e?s.jsx(ve,{rows:1}):t?s.jsx(ee,{error:t,title:"Could not load this scope's policy"}):r?s.jsxs("p",{className:"gc-muted",children:["Current policy: ",ts(a)]}):null}const me={allow:{title:"Allow seller",verb:"Allow"},block:{title:"Block seller",verb:"Block"},prefer:{title:"Prefer seller",verb:"Prefer"}};function Be({peer:e,action:t,onClose:r,peers:a}){var te,re,ne,ae;const{viewer:o,workspace:i,me:m}=Z(),c=fe(),g=Qe(),f=Ye(),l=we(o),u=ye(o),b=[...l?[{value:"gateway",label:"Gateway default (everyone)"}]:[],...l?[{value:"workspace-org",label:`${i.name}: organization policy`}]:[],...u?[{value:"workspace",label:`${i.name}: workspace policy`}]:[],...l?[{value:"member",label:"A member"}]:[],{value:"key",label:"An API key"}],[y,h]=p.useState(b[0].value),[n,v]=p.useState(""),[x,E]=p.useState(""),O=He(y==="member"),R=be(c,y==="key");p.useEffect(()=>{v("")},[y]),p.useEffect(()=>{var d;E(((d=e==null?void 0:e.services[0])==null?void 0:d.service)??"")},[e]);const w=(R.data??[]).filter(d=>d.status==="active"&&(u||d.ownerMemberId===m.member.id)),j=Es(y,n,i.id,u),[C,M]=p.useState(null);p.useEffect(()=>{M(null)},[y,n,e]);const B=Je({queryKey:["routing","scope-policy",j],queryFn:()=>Re(A,j),enabled:j!==null&&e!==null,staleTime:0}),z=j!==null&&B.isSuccess&&(t!=="prefer"||x!==""),I=B.data??null,Ue=t==="allow"&&z&&!(I!=null&&I.allowedPeerIds)&&!(I!=null&&I.allowedPeerLists),Ve=t==="block"&&z&&e!==null&&We(I,e.peerId);let D=((te=b.find(d=>d.value===y))==null?void 0:te.label.replace(/^A[n]? /,"the "))??"this scope";y==="key"&&(D=`key “${((re=w.find(d=>d.id===n))==null?void 0:re.label)??n}”`),y==="member"&&(D=`member “${((ae=(ne=O.data)==null?void 0:ne.find(d=>d.id===n))==null?void 0:ae.label)??n}”`);const P=Ze({mutationFn:async(d={})=>{var ie;if(!e||!j)return null;const S=x||((ie=e.services[0])==null?void 0:ie.service)||"",{changed:G}=await Ls(A,j,t,e.peerId,x||void 0,d);let oe=null,le=null;if(S)try{oe=await A.network.routePreview(Ts(j,S,i.id))}catch(_e){le=ss(_e)}return Ds({action:t,name:Y(a,e.peerId),scopeLabel:D,changed:G,model:S,preview:oe,peerId:e.peerId,previewError:le})},onSuccess:d=>{for(const S of es)g.invalidateQueries({queryKey:[S]});d&&(d.tone==="success"?(f(d.text),r()):M(d))},onError:d=>{const S=e?Y(a,e.peerId):"this seller";if(q(d,"narrowed"))M({tone:"warning",canForce:!0,text:`Nothing changed yet. The levels above ${D} do not allow ${S}, so saving this would not let it serve. ${Xe(d.details).join(" ")}`.trim()});else if(q(d,"empty_allow_list")){const G=t==="block"?`Blocking ${S}`:`Allowing only ${S}`;M({tone:"warning",text:`Nothing changed. ${G} on ${D} 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.`})}}}),K=e?Y(a,e.peerId):"";return s.jsx(X,{isOpen:e!==null,onClose:r,title:me[t].title,subtitle:K,children:s.jsxs("div",{className:"gc-stack",children:[s.jsx($,{label:"Apply to",value:y,onChange:d=>h(d),options:b}),y==="member"&&s.jsx($,{label:"Member",value:n,onChange:v,options:[{value:"",label:"Choose a member"},...(O.data??[]).filter(d=>d.status!=="disabled").map(d=>({value:d.id,label:d.label}))]}),y==="key"&&s.jsx($,{label:"Key",value:n,onChange:v,options:[{value:"",label:w.length?"Choose a key":"No keys you can edit"},...w.map(d=>({value:d.id,label:d.label}))]}),t==="prefer"&&e&&s.jsx($,{label:"For model",value:x,onChange:E,options:e.services.map(d=>({value:d.service,label:d.service})),hint:"The seller goes first in this model's fallback chain."}),s.jsx(Rs,{fetching:B.isFetching,error:B.error,ready:z,policy:I}),Ue&&s.jsxs(Q,{tone:"warning",children:["This scope has no allow list yet. Allowing ",K," creates one, so only allowed sellers can serve it."]}),Ve&&s.jsxs(Q,{tone:"warning",title:"This is the only allowed seller",children:["Blocking ",K," 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."}),y==="key"&&!u&&s.jsx("p",{className:"gc-muted",children:"This changes your own restrictions on the key. Restrictions a workspace admin set still apply."}),P.error&&!q(P.error,"narrowed")&&!q(P.error,"empty_allow_list")?s.jsx(ee,{error:P.error,title:"Could not update the policy"}):null,C?s.jsxs(s.Fragment,{children:[s.jsx(Q,{tone:C.tone,title:Os(C),children:C.text}),s.jsxs("div",{className:"gc-actions",children:[C.canForce&&s.jsx(k,{variant:"ghost",disabled:P.isPending,onClick:()=>{M(null),P.mutate({acceptNarrowed:!0})},children:"Save it anyway"}),s.jsx(k,{onClick:r,children:C.canForce?"Cancel":"Done"})]})]}):s.jsxs("div",{className:"gc-actions",children:[s.jsx(k,{variant:"ghost",onClick:r,children:"Cancel"}),s.jsx(k,{variant:t==="block"?"danger":"primary",disabled:!z||P.isPending,onClick:()=>P.mutate({}),children:P.isPending?"Saving…":me[t].verb})]})]})})}function Bs({initial:e,peers:t,onDone:r}){const[a,o]=p.useState((e==null?void 0:e.name)??""),[i,m]=p.useState((e==null?void 0:e.description)??""),[c,g]=p.useState((e==null?void 0:e.peerIds)??[]),f=ke({mutationFn:()=>{const l={name:a.trim(),description:i.trim()||null,peerIds:c};return e?A.network.updatePeerList(e.id,l):A.network.createPeerList(l)},onSuccess:r,invalidate:[xe.peerLists]});return s.jsxs("form",{className:"gc-stack",onSubmit:l=>{l.preventDefault(),f.mutate()},children:[s.jsx(V,{label:"Name",required:!0,placeholder:"e.g. Our own sellers",value:a,onChange:l=>o(l.target.value)}),s.jsx(V,{label:"Description",value:i,onChange:l=>m(l.target.value)}),s.jsx(js,{label:"Sellers",value:c,onChange:g,peers:t}),s.jsx("p",{className:"gc-fineprint",children:"Policies refer to a list by name, so editing it changes every policy that uses it."}),f.error?s.jsx(ee,{error:f.error,title:"Could not save the list"}):null,s.jsxs("div",{className:"gc-actions",children:[s.jsx(k,{variant:"ghost",onClick:r,children:"Cancel"}),s.jsx(k,{type:"submit",disabled:f.isPending||!a.trim(),children:f.isPending?"Saving…":"Save list"})]})]})}function zs({peers:e}){const{viewer:t}=Z(),r=we(t),a=rs(),[o,i]=p.useState(null),[m,c]=p.useState(null),g=ke({mutationFn:f=>A.network.removePeerList(f.id),onSuccess:()=>c(null),invalidate:[xe.peerLists]});return s.jsxs(je,{flush:!0,title:"Peer lists",description:"Named groups of sellers to allow or block in one step.",actions:r&&s.jsx(k,{size:"sm",variant:"outline",leadingIcon:s.jsx(U.plus,{size:14}),onClick:()=>i("new"),children:"New list"}),children:[s.jsx(Pe,{query:a,children:f=>s.jsx(Le,{label:"Peer lists",rows:f,rowKey:l=>l.id,rowLabel:l=>l.name,actions:l=>r?[{label:"Edit",onSelect:()=>i(l)},{label:"Delete",tone:"danger",onSelect:()=>c(l)}]:[],empty:s.jsx(W,{icon:s.jsx(U.network,{size:18}),title:"No peer lists",body:"Group sellers you trust, or ones you run yourself."}),columns:[{key:"name",header:"Name",render:l=>s.jsx("span",{className:"gc-strong",children:l.name})},{key:"desc",header:"Description",secondary:!0,render:l=>s.jsx("span",{className:"gc-muted",children:l.description??"—"})},{key:"count",header:"Sellers",align:"right",render:l=>l.peerIds.length}]})}),s.jsx(X,{isOpen:o!==null,onClose:()=>i(null),title:o==="new"?"New peer list":"Edit peer list",size:"lg",children:o!==null&&s.jsx(Bs,{initial:o==="new"?null:o,peers:e,onDone:()=>i(null)})}),s.jsx(ns,{isOpen:m!==null,busy:g.isPending,error:g.error,onClose:()=>c(null),onConfirm:()=>m&&g.mutate(m),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 ze(e,t){return t?e.services.filter(r=>r.service===t):e.services}function _(e,t,r=""){const a=ze(e,r).map(o=>o[t]).filter(o=>o!==null);return a.length?{min:Math.min(...a),max:Math.max(...a)}:null}function qs(e,t=""){var r;return((r=_(e,"inputUsdPerMillion",t))==null?void 0:r.min)??null}function Us(e,t=""){var r;return((r=_(e,"outputUsdPerMillion",t))==null?void 0:r.min)??null}function se(e,t=""){return ze(e,t).some(r=>r.inputUsdPerMillion===0&&(r.outputUsdPerMillion??0)===0)}function Vs(e,t){const r=t.search.trim().toLowerCase();return e.filter(a=>{var o;return!(r&&!a.peerId.toLowerCase().includes(r)&&!(a.displayName??"").toLowerCase().includes(r)&&!a.services.some(i=>i.service.toLowerCase().includes(r))||t.model&&!a.services.some(i=>i.service===t.model)||t.tee&&!a.tee||t.linked&&!((o=a.verificationLinks)!=null&&o.length)||t.free&&!se(a,t.model))})}const qe={"openai-chat-completions":"Chat completions","openai-responses":"Responses","anthropic-messages":"Messages","openai-images":"Images"};function he(e){return e===null?"—":String(Math.round(e))}function J(e){return e.displayName??F(e.peerId,8,4)}function T(e){return`${e.provider}:${e.service}`}function _s({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(Se,{title:e.peerId,children:F(e.peerId,6,4)}),s.jsx(Ce,{iconOnly:!0,value:e.peerId,label:"Copy peer id"})]}),s.jsx(Te,{links:e.verificationLinks}),s.jsx(Me,{tee:e.tee,scope:e.teeScope}),se(e,"")&&s.jsx(L,{tone:"success",children:"Free"}),e.washFlagged&&s.jsx(L,{tone:"danger",children:"Flagged"}),t&&s.jsx(L,{tone:"warning",children:"Cooling down"}),s.jsxs("span",{className:"gc-muted",children:["Last seen ",as(e.lastSeen)]})]})}function Ks({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(N,{label:"Trust score",value:he(e.trustScore)}),t&&s.jsx(N,{label:"Reputation",value:he(e.reputationScore)}),s.jsx(N,{label:"Stake",value:e.stakeAnts?Is(e.stakeAnts):"—"}),s.jsx(N,{label:"Network usage share",value:e.usageShareBps===null?"—":`${(e.usageShareBps/100).toFixed(2)}%`}),s.jsx(N,{label:"First token p50 (this gateway)",value:Ie(e.firstTokenMsP50)}),s.jsx(N,{label:"Speed p50 (this gateway)",value:Ne(e.tokensPerSecondP50)}),s.jsx(N,{label:"Requests, 24h (this gateway)",value:$e(e.requests24h)}),s.jsx(N,{label:"Failure streak",value:r?`${e.health.failureStreak}, cooling down until ${os(e.health.coolingDownUntil)}`:String(e.health.failureStreak)})]})}function Gs({peer:e,selected:t,onSelect:r}){const[a,o]=p.useState(""),i=a.trim().toLowerCase(),m=e.services.filter(c=>!i||c.service.toLowerCase().includes(i));return s.jsx(De,{title:`Models (${e.services.length})`,actions:e.services.length>6&&s.jsx(V,{size:"sm",type:"search","aria-label":"Search this provider's models",placeholder:"Search models",value:a,onChange:c=>o(c.target.value)}),children:m.length===0?s.jsx("p",{className:"gc-fineprint",children:i?"No models match.":"This provider lists no models."}):s.jsx("ul",{className:"gc-panel-rows","aria-label":"Models and prices",children:m.map(c=>{const g=t!==null&&T(t)===T(c);return s.jsx(Ps,{selected:g,title:s.jsx("span",{className:"gc-strong",children:c.service}),meta:s.jsxs(s.Fragment,{children:[s.jsx("span",{children:Ss(c)}),s.jsx("span",{children:qe[Fe(c)]})]}),actions:s.jsxs(s.Fragment,{children:[s.jsx(Ce,{iconOnly:!0,value:Ae(e.peerId,c.service),label:`Copy ${c.service} pinned to this provider (peer@model)`}),s.jsx(k,{size:"sm",variant:g?"outline":"ghost","aria-pressed":g,title:"Show the API call for this model",onClick:()=>r(c),children:"API call"})]})},T(c))})})})}function Qs({peer:e,service:t,onSelect:r}){var R;const{workspace:a,viewer:o}=Z(),i=fe(),m=ls(),c=be(i),g=is(a.id),[f,l]=p.useState("curl"),[u,b]=p.useState(!1),y=Fe(t),h=Ae(e.peerId,t.service),n=((R=g.data)==null?void 0:R.find(w=>w.model===h))??null,v=cs(m,e.peerId,t.service,y,n?`@preset/${n.slug}`:null),x=v.find(w=>w.id===f)??v[0],E=(c.data??[]).some(w=>w.status==="active"),O=ye(o);return s.jsxs(De,{title:"API call",actions:e.services.length>1&&s.jsx($,{size:"sm","aria-label":"Model",value:T(t),onChange:w=>{const j=e.services.find(C=>T(C)===w);j&&r(j)},options:e.services.map(w=>({value:T(w),label:w.service}))}),children:[s.jsxs("p",{className:"gc-fineprint",children:["Pinned to this provider with ",s.jsx("code",{children:F(h,10,12)}),"."]}),s.jsx($s,{id:"gc-connect",label:"Ways to connect",value:x.id,onChange:l,className:"gc-connect-tabs",tabs:v.map(w=>({id:w.id,label:w.label}))}),s.jsxs(As,{tabsId:"gc-connect",tab:x.id,className:"gc-stack",children:[x.id==="codex"&&s.jsxs("div",{className:"gc-summary-row",children:[s.jsx("p",{className:"gc-fineprint gc-summary-row__text",children:n?s.jsxs(s.Fragment,{children:["Uses the preset ",s.jsxs("code",{children:["@preset/",n.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."})}),!n&&O&&s.jsx(k,{size:"sm",variant:"outline",onClick:()=>b(!0),children:"Create preset for this model"})]}),x.id==="claude-code"&&y!=="anthropic-messages"&&s.jsxs("p",{className:"gc-fineprint",children:["This model speaks ",qe[y],"; the gateway translates Claude Code's requests for it."]}),s.jsx(ds,{code:x.code,label:`${t.service} · ${x.label}`})]}),s.jsxs("p",{className:"gc-fineprint",children:["Set ",s.jsx("code",{children:us})," to one of your API keys first."," ",c.data&&!E&&s.jsx(ms,{to:"keys",children:"Create an API key"})]}),s.jsx(X,{isOpen:u,onClose:()=>b(!1),size:"lg",title:"New preset",children:u&&s.jsx(Ns,{initial:null,prefill:{name:t.service,model:h},onDone:w=>{b(!1),w&&l("codex")}})})]})}function Ys({peer:e,peers:t,showReputation:r}){const[a,o]=p.useState(null),[i,m]=p.useState(null),c=p.useRef(null),g=i??e.services[0]??null,f=l=>{var u;m(l),(u=c.current)==null||u.scrollIntoView({behavior:"smooth",block:"start"})};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"gc-stack",children:[s.jsx(_s,{peer:e}),s.jsxs("div",{className:"gc-panel-actions",children:[s.jsx(k,{size:"sm",variant:"outline",onClick:()=>o("allow"),children:"Allow"}),s.jsx(k,{size:"sm",variant:"outline",onClick:()=>o("prefer"),children:"Prefer"}),s.jsx(k,{size:"sm",variant:"danger",onClick:()=>o("block"),children:"Block"})]}),s.jsx(Ks,{peer:e,showReputation:r})]}),s.jsx(Gs,{peer:e,selected:g,onSelect:f}),g&&s.jsx("div",{ref:c,className:"gc-scroll-target",children:s.jsx(Qs,{peer:e,service:g,onSelect:m})}),a&&s.jsx(Be,{peer:e,action:a,peers:t,onClose:()=>o(null)})]})}function ge(e){return e===null?"—":String(Math.round(e))}function Hs({peer:e,model:t}){const r=(e.health.coolingDownUntil??0)>Date.now();return s.jsxs("div",{className:"gc-badges",children:[s.jsx(Me,{tee:e.tee,scope:e.teeScope}),se(e,t)&&s.jsx(L,{tone:"success",children:"Free"}),e.washFlagged&&s.jsx(L,{tone:"danger",children:"Flagged"}),r&&s.jsx(L,{tone:"warning",children:"Cooling down"})]})}function ut(){const e=hs(),t=gs(e.rest),r=ps(),a=p.useMemo(()=>{var h;return t?((h=r.data)==null?void 0:h.find(n=>pe(n.peerId,t)))??null:null},[r.data,t]),[o,i]=p.useState({search:"",model:"",tee:!1,linked:!1,free:!1}),[m,c]=p.useState(null),g=p.useMemo(()=>fs(r.data),[r.data]),f=ws(r.data),l=ys(),u=(h,n)=>i(v=>({...v,[h]:n})),b=t===null?null:{eyebrow:"Provider",title:a?J(a):F(t,8,6),body:r.isLoading?s.jsx(ve,{rows:6}):a?s.jsx(Ys,{peer:a,peers:r.data,showReputation:f},a.peerId):s.jsx(W,{icon:s.jsx(U.providers,{size:18}),title:"Provider not found",body:`This gateway does not see ${F(t,8,6)} right now.`})},y=s.jsxs("div",{className:"gc-page",children:[s.jsx(je,{flush:!0,children:s.jsx(Pe,{query:r,rows:8,children:h=>s.jsx(Le,{label:"Providers",rows:Vs(h,o),rowKey:n=>n.peerId,selectedKey:(a==null?void 0:a.peerId)??null,onRowClick:n=>de(ks("providers",n.peerId)),rowLabel:n=>J(n),actions:n=>[o.model!==""&&vs(l,n.peerId,o.model),{label:"Allow…",onSelect:()=>c({peer:n,kind:"allow"})},{label:"Prefer…",onSelect:()=>c({peer:n,kind:"prefer"})},{label:"Block…",tone:"danger",onSelect:()=>c({peer:n,kind:"block"})}],initialSort:{key:"trust",direction:"desc"},empty:s.jsx(W,{icon:s.jsx(U.providers,{size:18}),title:h.length?"No providers match these filters":"No providers found yet",body:h.length?void 0:"The buyer is still discovering the network. Check back in a minute."}),columns:[{key:"name",header:"Provider",sortValue:n=>n.displayName??n.peerId,render:n=>s.jsxs("div",{className:"gc-cell-lines",children:[s.jsx("div",{className:"gc-strong gc-ellipsis",title:n.displayName??n.peerId,children:J(n)}),n.displayName&&s.jsx("div",{className:"gc-muted gc-ellipsis",children:s.jsx(Se,{title:n.peerId,children:F(n.peerId,6,4)})}),s.jsx(Hs,{peer:n,model:o.model})]}),after:n=>s.jsx(bs,{value:n.peerId,label:`Copy peer id ${n.peerId}`})},{key:"identity",header:"Domain / GitHub",secondary:!0,render:n=>{var v;return(v=n.verificationLinks)!=null&&v.length?s.jsx(Te,{links:n.verificationLinks}):s.jsx("span",{className:"gc-muted",children:"—"})}},{key:"models",header:"Models",secondary:!0,optional:!0,render:n=>s.jsx("span",{className:"gc-muted",children:n.services.length})},{key:"input",header:"Input $/M",align:"right",sortValue:n=>qs(n,o.model),render:n=>ce(_(n,"inputUsdPerMillion",o.model))},{key:"output",header:"Output $/M",align:"right",secondary:!0,sortValue:n=>Us(n,o.model),render:n=>ce(_(n,"outputUsdPerMillion",o.model))},{key:"trust",header:"Trust",align:"right",sortValue:n=>n.trustScore,render:n=>ge(n.trustScore)},...f?[{key:"reputation",header:"Reputation",align:"right",secondary:!0,optional:!0,sortValue:n=>n.reputationScore,render:n=>ge(n.reputationScore)}]:[],{key:"firstToken",header:"First token",align:"right",secondary:!0,optional:!0,sortValue:n=>n.firstTokenMsP50,render:n=>Ie(n.firstTokenMsP50)},{key:"speed",header:"Speed",align:"right",secondary:!0,optional:!0,sortValue:n=>n.tokensPerSecondP50,render:n=>Ne(n.tokensPerSecondP50)},{key:"usage",header:"Your 24h",align:"right",secondary:!0,sortValue:n=>n.requests24h,render:n=>$e(n.requests24h)}]})})}),s.jsx(zs,{peers:r.data})]});return s.jsxs("div",{className:"gc-page",children:[s.jsx(xs,{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(V,{size:"sm",type:"search","aria-label":"Search providers",placeholder:"Search name, peer id or model",value:o.search,onChange:h=>u("search",h.target.value)}),s.jsx($,{size:"sm","aria-label":"Filter by model",value:o.model,onChange:h=>u("model",h),options:[{value:"",label:"All models"},...g.map(h=>({value:h,label:h}))]}),s.jsx(H,{checked:o.linked,onChange:h=>u("linked",h),label:"Domain or GitHub"}),s.jsx(H,{checked:o.tee,onChange:h=>u("tee",h),label:"TEE"}),s.jsx(H,{checked:o.free,onChange:h=>u("free",h),label:"Free"})]}),s.jsx(Cs,{list:y,panel:b,onClose:()=>de("providers"),closeLabel:"Close provider"}),m&&s.jsx(Be,{peer:m.peer,action:m.kind,peers:r.data,onClose:()=>c(null)})]})}export{ut as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as P,j as e,L as x,o as y,Z as m,aw as l,ax as j,h as i,E as T,I as w,B as C,W as I,f as k,q,v as d,b as L,M as u,g as p,e as A,$ as F,ah as M,X as D,Y as E}from"./index-BpFwvYMF.js";import{u as K}from"./useInfiniteQuery-Dwl-oWNd.js";import{p as O}from"./PeerPicker-w_ZaksUm.js";import{f as N}from"./usage-yuqGLybi.js";import{D as $}from"./DataTable-CCEZoIzX.js";const _=50;function c(t){return t===null?e.jsx(d,{tone:"info",children:"In flight"}):t<400?e.jsx(d,{tone:"success",children:t}):t<500?e.jsx(d,{tone:"warning",children:t}):e.jsx(d,{tone:"danger",children:t})}function b({entry:t}){const n=N(t,Date.now());return n==="video-charged"?e.jsx("span",{className:"gc-muted",title:"Charged on the request that downloaded this video",children:p(t.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:p(t.spent)})}function v({peerId:t,full:n=!1}){const r=L(),o=O(r.data,t);return n?e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsx("span",{children:o}),e.jsx(u,{children:t})]}):e.jsx("span",{className:"gc-ellipsis",title:t,children:o})}function z(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function f({title:t,body:n}){return e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsx("div",{className:"as-field__label",children:t}),e.jsx(E,{code:z(n)})]})}function J({detail:t}){return!t.requestBody&&!t.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:[t.requestBody&&e.jsx(f,{title:"Request body",body:t.requestBody}),t.responseBody&&e.jsx(f,{title:"Response body",body:t.responseBody})]})}function Q({entry:t}){const n=A({queryKey:q.request(t.tag),queryFn:()=>k.usage.request(t.tag),retry:!1,staleTime:6e4}),r=n.data??t,o=F(n.error)&&n.error.status===404;return e.jsxs(e.Fragment,{children:[r.errorCode||r.errorMessage?e.jsx(M,{tone:"danger",title:r.errorCode??"Request failed",children:r.errorMessage??"No message was returned."}):null,e.jsx(D,{items:[["Status",c(r.status)],["Request",e.jsxs(u,{children:[r.method," ",r.path]},"p")],["Model",r.model??"—"],["Key",r.keyLabel],["End user",r.endUser??"—"],["Seller",r.sellerPeerId?e.jsx(v,{peerId:r.sellerPeerId,full:!0},"s"):"—"],["First token",l(r.firstTokenMs)],["Speed",j(r.tokensPerSecond)],["Duration",r.finishedAt?l(r.finishedAt-r.startedAt):"—"],["Input tokens",i(r.inputTokens)],["Cached input",i(r.cachedInputTokens)],["Output tokens",i(r.outputTokens)],["Cost",e.jsx(b,{entry:r},"c")],["Tag",e.jsx(u,{children:r.tag},"t")]]}),n.isLoading&&e.jsx(x,{rows:2}),n.error&&!o?e.jsx(y,{error:n.error,title:"Could not load the bodies"}):null,n.data&&e.jsx(J,{detail:n.data})]})}function X({filter:t,showKey:n=!0}){var h;const[r,o]=P.useState(null),a=K({queryKey:q.requests(t),queryFn:({pageParam:s})=>k.usage.requests({...t,before:s??void 0,limit:_}),initialPageParam:null,getNextPageParam:s=>s.nextBefore,refetchInterval:s=>{var g;return(g=s.state.data)!=null&&g.pages.some(B=>B.requests.some(R=>N(R,Date.now())==="pending"))?5e3:!1}});if(a.isLoading)return e.jsx(x,{rows:8});if(a.error)return e.jsx(y,{error:a.error,onRetry:()=>void a.refetch()});const S=((h=a.data)==null?void 0:h.pages.flatMap(s=>s.requests))??[];return e.jsxs(e.Fragment,{children:[e.jsx($,{label:"Request log",rows:S,rowKey:s=>s.tag,onRowClick:o,rowLabel:s=>`request ${s.tag}`,empty:e.jsx(T,{icon:e.jsx(w.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:s=>e.jsx("span",{className:"gc-nowrap",children:m(s.startedAt)})},...n?[{key:"key",header:"Key",secondary:!0,render:s=>s.keyLabel}]:[],{key:"model",header:"Model",render:s=>e.jsxs("span",{className:"gc-ellipsis",children:[s.model??e.jsxs("span",{className:"gc-muted",children:[s.method," ",s.path]}),s.status!==null&&s.status>=400?e.jsxs("span",{className:"gc-narrow-only",children:[" ",c(s.status)]}):null]})},{key:"seller",header:"Seller",render:s=>s.sellerPeerId?e.jsx(v,{peerId:s.sellerPeerId}):"—"},{key:"status",header:"Status",secondary:!0,render:s=>e.jsx("span",{title:s.errorMessage??void 0,children:c(s.status)})},{key:"firstToken",header:"First token",align:"right",secondary:!0,optional:!0,render:s=>l(s.firstTokenMs)},{key:"speed",header:"Speed",align:"right",secondary:!0,optional:!0,render:s=>j(s.tokensPerSecond)},{key:"tokens",header:"Tokens",align:"right",secondary:!0,render:s=>`${i(s.inputTokens)} → ${i(s.outputTokens)}`},{key:"cost",header:"Cost",align:"right",render:s=>e.jsx(b,{entry:s})}]}),a.hasNextPage&&e.jsx("div",{className:"gc-load-more",children:e.jsx(C,{variant:"outline",size:"sm",disabled:a.isFetchingNextPage,onClick:()=>void a.fetchNextPage(),children:a.isFetchingNextPage?"Loading…":"Load older requests"})}),e.jsx(I,{isOpen:r!==null,onClose:()=>o(null),title:(r==null?void 0:r.model)??"Request",subtitle:r?m(r.startedAt):void 0,eyebrow:"Request",children:r&&e.jsx(Q,{entry:r},r.tag)})]})}export{X as R};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as C,a as se,b as O,a3 as ae,n as $,r as u,c as te,d as re,bp as ie,e as ne,j as e,l as D,T as le,B as b,L as G,o as z,bj as oe,ah as q,A as N,v as A,al as K,E as ce,bq as de,f as T,q as W,P as ue,a5 as pe,br as ge,F as V,bs as H,b6 as ye,bt as X,bu as M,a6 as _,bv as Q,i as me,G as he,bw as R,bx as we,af as fe,b8 as ve,C as xe}from"./index-BpFwvYMF.js";import{b as Z,a as je,d as be}from"./PolicyField-BbDSVgcK.js";import{P as ke}from"./PolicyEditor-BOjadRE8.js";import{p as U}from"./PeerPicker-w_ZaksUm.js";import{S as Y}from"./SelectField-D3qPiNQz.js";import{D as Pe}from"./DataTable-CCEZoIzX.js";import{T as Se,a as Ne}from"./Tabs-DmkE9BPd.js";import"./Segmented-D_Yun-tG.js";import"./roving-DkptacxO.js";import"./Switch-BmFsXcr8.js";import"./Disclosure-BitAjv2r.js";function P({level:a,children:t,result:i}){return e.jsxs("div",{className:i?"gc-source gc-source--result":"gc-source",children:[e.jsx("div",{className:"gc-source__level",children:a}),e.jsx("div",{className:"gc-source__policy",children:t})]})}function Ce(a,t,i,n){return a==="key"?(t??[]).filter(r=>r.status==="active").map(r=>({value:r.id,label:r.label})):a==="member"?(i??[]).map(({member:r})=>({value:r.id,label:r.label})):a==="preset"?(n??[]).map(r=>({value:r.slug,label:r.name})):[]}function Le(){const{workspace:a,viewer:t}=C(),i=se(),n=O(),r=ae(n.data),p=$(t),[s,c]=u.useState("workspace"),[l,g]=u.useState(""),[y,w]=u.useState(""),[f,v]=u.useState(null),m=te(i,s==="key"),d=re(a.id,s==="member"),L=ie(a.id,s==="preset"),h=ne({queryKey:W.routePreview(f??{}),queryFn:()=>T.network.routePreview(f),enabled:f!==null}),j=Ce(s,m.data,d.data,L.data);function x(){const o={model:y.trim(),workspace:a.id};s!=="workspace"&&l&&(o[s]=l),v(o)}return e.jsxs(D,{title:"Route preview",description:"See which sellers a request would go to, and why.",children:[e.jsxs("form",{className:"gc-toolbar",onSubmit:o=>{o.preventDefault(),x()},children:[e.jsx(Y,{size:"sm","aria-label":"Preview for",value:s,onChange:o=>{c(o),g("")},options:[{value:"workspace",label:`Workspace: ${a.name}`},{value:"key",label:"A key"},...p?[{value:"member",label:"A member"}]:[],{value:"preset",label:"A preset"}]}),s!=="workspace"&&e.jsx(Y,{size:"sm","aria-label":`Choose a ${s}`,value:l,onChange:g,options:[{value:"",label:`Choose a ${s}`},...j]}),e.jsx(le,{size:"sm","aria-label":"Model",placeholder:"Model id",list:"gc-preview-models",value:y,onChange:o=>w(o.target.value)}),e.jsx("datalist",{id:"gc-preview-models",children:r.map(o=>e.jsx("option",{value:o},o))}),e.jsx(b,{type:"submit",size:"sm",disabled:!y.trim()||s!=="workspace"&&!l,children:"Preview"})]}),h.isFetching&&e.jsx(G,{rows:4}),h.error?e.jsx(z,{error:h.error}):null,h.data&&!h.isFetching&&e.jsx(Re,{preview:h.data})]})}const Ee={buyer:"Buyer",gateway:"Gateway","workspace-org":"Workspace (org policy)",workspace:"Workspace",member:"Member",key:"Key (admin)","key-owner":"Key (owner)",preset:"Preset"};function Me(a){return a.policy!==null?N(a.policy):e.jsx("span",{className:"gc-muted",children:a.level==="buyer"?"No hard limits":"Inherits"})}function Re({preview:a}){const{me:t}=C(),i=O(),n=oe(),r=a.candidates.filter(s=>s.eligible).length,p=s=>{var c;return s.id?s.level==="workspace"||s.level==="workspace-org"?((c=t.workspaces.find(l=>l.workspace.id===s.id))==null?void 0:c.workspace.name)??s.id:s.id:null};return e.jsxs("div",{className:"gc-stack",children:[!a.modelAllowed&&e.jsxs(q,{tone:"danger",title:"Model not allowed",children:["The policy does not allow ",a.model,". Requests for it get a 403."]}),e.jsxs("div",{className:"gc-sources",children:[a.sources.map((s,c)=>e.jsx(P,{level:e.jsxs(e.Fragment,{children:[Ee[s.level],p(s)?e.jsxs("span",{className:"gc-muted",children:[" · ",p(s)]}):null]}),children:Me(s)},`${s.level}-${c}`)),e.jsx(P,{level:"Effective",result:!0,children:N(a.policy)})]}),e.jsxs("p",{className:"gc-muted",children:[r," of ",a.candidates.length," sellers eligible."]}),r===0&&a.candidates.length>0&&e.jsxs(q,{tone:"warning",title:"No eligible seller",children:["Requests for ",a.model," fail with this policy. The reasons below show what excludes each seller."]}),e.jsx(Pe,{label:"Candidates",rows:[...a.candidates].sort((s,c)=>(s.rank??1e9)-(c.rank??1e9)),rowKey:s=>s.peerId,rowLabel:s=>s.displayName??U(i.data,s.peerId),actions:s=>[de(n,s.peerId,a.model)],empty:e.jsx(ce,{title:"No seller offers this model"}),columns:[{key:"rank",header:"#",render:s=>s.rank??"—",width:"3rem"},{key:"seller",header:"Seller",render:s=>s.displayName??U(i.data,s.peerId)},{key:"eligible",header:"Eligible",render:s=>s.eligible?e.jsx(A,{tone:"success",children:"Yes"}):e.jsx(A,{tone:"neutral",children:"No"})},{key:"reasons",header:"Why",render:s=>e.jsx("span",{className:"gc-muted",children:s.reasons.join(" · ")||"—"})},{key:"input",header:"Input $/M",align:"right",secondary:!0,render:s=>K(s.inputUsdPerMillion)},{key:"output",header:"Output $/M",align:"right",secondary:!0,render:s=>K(s.outputUsdPerMillion)},{key:"trust",header:"Trust",align:"right",secondary:!0,render:s=>s.trustScore===null?"—":Math.round(s.trustScore)}]})]})}const S={gateway:{title:"Gateway default",description:()=>"Applies to every request through this gateway. Workspaces, members, keys and presets can only narrow it."},org:{title:"Organization policy",description:a=>`Set by organization admins for ${a}. Workspace admins can only narrow it.`},workspace:{title:"Workspace policy",description:a=>`Set by ${a}'s admins, on top of the gateway default and the organization policy.`}},B=(a,t)=>JSON.stringify(a)===JSON.stringify(t);function qe(a,t){if(!a)return e.jsx(A,{children:"Read only"});if(t)return e.jsx(A,{tone:"warning",children:"Unsaved changes"})}function I({layer:a,source:t,parent:i,canEdit:n,onSave:r}){const{workspace:p}=C(),s=he(),c=O(),l=H(),g=je(),[y,w]=u.useState(()=>R(t)),[f,v]=u.useState(()=>R(t)),[m,d]=u.useState(null),[L,h]=u.useState(!1),j=u.useMemo(()=>R(t),[t]),x=!B(y,f);u.useEffect(()=>{B(j,f)||(!x||B(j,y)?(w(j),v(j),d(null)):d(j))},[j]);const o=we({mutationFn:async()=>{const k=fe(y,l.data??null);return await g.save([k],ee=>r(k,ee))===ve?null:k},onSuccess:k=>{if(!k)return;const F=R(k);w(F),v(F),d(null),h(!1),s(`${S[a].title} saved`)}}),E=be(y,l.data??null);return e.jsxs(D,{title:S[a].title,description:S[a].description(p.name),actions:qe(n,x),children:[e.jsxs("div",{className:"gc-policy-row",children:[e.jsxs("div",{className:"gc-policy-row__text",children:[e.jsx(Z,{policy:x?E.policy:t,invalid:x&&E.error!==null}),x&&e.jsx("span",{className:"gc-fineprint",children:"Showing your unsaved edits."})]}),e.jsx(b,{size:"sm",variant:"outline",onClick:()=>h(!0),children:n?"Edit":"View"})]}),m&&n&&!L&&e.jsx(q,{tone:"warning",title:"Changed elsewhere",children:"Someone saved this policy while you were editing it. Open it to reload theirs or keep yours."}),e.jsx(xe,{isOpen:L,onClose:()=>h(!1),size:"xl",title:S[a].title,subtitle:S[a].description(p.name),footer:n?e.jsxs(e.Fragment,{children:[E.error&&e.jsx("span",{className:"gc-warn gc-footer-note",children:E.error}),e.jsx(b,{variant:"ghost",disabled:!x,onClick:()=>{w(f),d(null)},children:"Discard changes"}),e.jsx(b,{disabled:o.isPending||!x,onClick:()=>o.mutate(),children:o.isPending?"Saving…":"Save policy"})]}):e.jsx(b,{variant:"outline",onClick:()=>h(!1),children:"Close"}),children:e.jsxs("div",{className:"gc-stack",children:[m&&n&&e.jsx(q,{tone:"warning",title:"Changed elsewhere",action:e.jsxs("div",{className:"gc-inline gc-inline--wrap",children:[e.jsx(b,{size:"sm",variant:"outline",onClick:()=>{w(m),v(m),d(null)},children:"Reload"}),e.jsx(b,{size:"sm",variant:"ghost",onClick:()=>{v(m),d(null)},children:"Keep editing"})]}),children:"Someone saved this policy while you were editing it. Reload to see their version (your edits are dropped), or keep editing and save to replace it."}),o.error?e.jsx(z,{error:o.error,title:"Could not save"}):null,e.jsx(ke,{value:y,onChange:w,peers:c.data,lists:l.data??[],parent:i,disabled:!n})]})}),g.dialog]})}function Ae(){const a=V(),t=X();return t.isLoading?e.jsx(G,{rows:6}):t.error?e.jsx(z,{error:t.error,onRetry:()=>void t.refetch()}):e.jsx(I,{layer:"gateway",source:t.data??null,parent:null,canEdit:!0,onSave:async(i,n)=>{await T.network.setGatewayPolicy(i,n),await a.invalidateQueries({queryKey:W.group("routing")})}})}function J(){var f,v;const{workspace:a,viewer:t}=C(),i=V(),n=H(),r=ye(a.id),p=X(),s=n.data??[],c=p.data?M(p.data,s):null,l=((f=r.data)==null?void 0:f.orgRoutingPolicy)??null,g=((v=r.data)==null?void 0:v.routingPolicy)??null,y=u.useMemo(()=>_(c,l&&M(l,s),g&&M(g,s)),[c,l,g,s]);if(r.isLoading)return e.jsx(G,{rows:6});if(r.error)return e.jsx(z,{error:r.error,onRetry:()=>void r.refetch()});const w=async()=>{await i.invalidateQueries({queryKey:W.group("workspaces")}),await i.invalidateQueries({queryKey:W.group("routing")})};return e.jsxs("div",{className:"gc-stack",children:[e.jsx(D,{title:"Effective for this workspace",description:"What keys in this workspace get before member, key and preset policies narrow it further.",children:e.jsxs("div",{className:"gc-sources",children:[e.jsx(P,{level:"Gateway default",children:N(p.data)}),e.jsx(P,{level:"Organization",children:N(l)}),e.jsx(P,{level:"Workspace",children:N(g)}),e.jsx(P,{level:"Effective",result:!0,children:e.jsx(Z,{policy:y})})]})}),e.jsx(I,{layer:"org",source:l,parent:c,canEdit:$(t),onSave:async(m,d)=>{await T.workspaces.update(a.id,{orgRoutingPolicy:Q(m)},d),await w()}}),e.jsx(I,{layer:"workspace",source:g,parent:_(c,l&&M(l,s)),canEdit:me(t),onSave:async(m,d)=>{await T.workspaces.update(a.id,{routingPolicy:Q(m)},d),await w()}})]})}function Te(){const a=pe();if(!a.data)return null;const t=ge(a.data);return e.jsxs("p",{className:"gc-fineprint",children:["Buyer config, which every policy here can only narrow: ",t.length>0?t.join(" · "):"none","."]})}function We(){const{viewer:a}=C(),t=$(a),[i,n]=u.useState(t?"gateway":"workspace");return t?e.jsxs(e.Fragment,{children:[e.jsx(Se,{id:"gc-routing-level",label:"Policy level",value:i,onChange:n,tabs:[{id:"gateway",label:"Gateway default"},{id:"workspace",label:"This workspace"}]}),e.jsx(Ne,{tabsId:"gc-routing-level",tab:i,children:i==="gateway"?e.jsx(Ae,{}):e.jsx(J,{})})]}):e.jsx(J,{})}function Ue(){return e.jsxs("div",{className:"gc-page",children:[e.jsx(ue,{title:"Routing",description:"Which sellers serve your requests and how they are ranked. Each level can only narrow the one above."}),e.jsx(Te,{}),e.jsx(We,{}),e.jsx(Le,{})]})}export{Ue as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,j as s}from"./index-BpFwvYMF.js";function _({checked:a,onChange:r,label:l,description:t,disabled:n,className:o}){const c=e.useId(),i=e.useId();return s.jsxs("div",{className:["as-switch",o].filter(Boolean).join(" "),children:[s.jsx("button",{id:c,type:"button",role:"switch","aria-checked":a,"aria-describedby":t?i:void 0,disabled:n,className:a?"as-switch__track as-switch__track--on":"as-switch__track",onClick:()=>r(!a),children:s.jsx("span",{className:"as-switch__thumb"})}),s.jsxs("label",{htmlFor:c,className:"as-switch__text",children:[s.jsx("span",{className:"as-switch__label",children:l}),t&&s.jsx("span",{id:i,className:"as-switch__desc",children:t})]})]})}export{_ as S};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as S,n as W,p as L,s as I,r as p,t as A,j as s,P as O,B as b,I as z,l as B,Q as F,v as w,M as C,w as N,x as M,y as D,z as E,A as T,C as q,D as V,q as f,f as v,T as P,o as R}from"./index-BpFwvYMF.js";import{u as K,a as Q,P as _}from"./PolicyField-BbDSVgcK.js";import{l as G,d as H,L as U}from"./limits-DjiKmaDB.js";import{D as J}from"./DataTable-CCEZoIzX.js";import"./PolicyEditor-BOjadRE8.js";import"./PeerPicker-w_ZaksUm.js";import"./SelectField-D3qPiNQz.js";import"./Segmented-D_Yun-tG.js";import"./roving-DkptacxO.js";import"./Switch-BmFsXcr8.js";import"./Disclosure-BitAjv2r.js";function X({initial:r,onDone:d}){const{viewer:g}=S(),h=W(g),[i,k]=p.useState((r==null?void 0:r.name)??""),[y,x]=p.useState(G(r==null?void 0:r.limits)),[m,c]=p.useState(""),n=K(r==null?void 0:r.routingPolicy),o=Q(),l=A({mutationFn:()=>{const t={name:i.trim(),limits:H(y),routingPolicy:n.build()};return o.save([t.routingPolicy],e=>{if(r){const{limits:a,...j}=t;return v.workspaces.update(r.id,h?{...j,limits:a}:j,e)}return v.workspaces.create(m.trim()?{...t,buyerIdentity:m.trim()}:t,e)})},onSuccess:d,invalidate:[f.group("workspaces"),f.me],toast:r?"Workspace saved":"Workspace created"}),u=r?"Save":"Create workspace";return s.jsxs("form",{className:"gc-stack",onSubmit:t=>{t.preventDefault(),l.mutate()},children:[s.jsx(P,{label:"Name",required:!0,value:i,onChange:t=>k(t.target.value)}),!r&&s.jsx(P,{label:"Buyer identity (optional)",value:m,onChange:t=>c(t.target.value),hint:"Leave blank to create a new wallet for this workspace. Enter an existing identity name to reuse its wallet."}),h?s.jsxs("div",{children:[s.jsx("div",{className:"as-field__label gc-label-row",children:"Workspace budgets (USD)"}),s.jsx(U,{idPrefix:"ws-limit",value:y,onChange:x})]}):s.jsxs("p",{className:"gc-muted",children:["Budgets: ",E(r==null?void 0:r.limits),". Organization admins set them."]}),s.jsx(_,{draft:n.draft,setDraft:n.setDraft}),l.error?s.jsx(R,{error:l.error,title:"Could not save"}):null,s.jsxs("div",{className:"gc-actions",children:[s.jsx(b,{variant:"ghost",onClick:d,children:"Cancel"}),s.jsx(b,{type:"submit",disabled:l.isPending||!i.trim(),children:l.isPending?"Saving…":u})]}),o.dialog]})}function ie(){const{viewer:r,setWorkspaceId:d,workspace:g,me:h}=S(),i=W(r),k=t=>i||h.workspaces.some(e=>e.workspace.id===t.id&&e.role==="admin"),y=L(),x=I(),m=t=>{var e;return(e=x.data)==null?void 0:e.find(a=>a.workspaceId===t.id)},[c,n]=p.useState(null),[o,l]=p.useState(null),u=A({mutationFn:t=>v.workspaces.remove(t.id),onSuccess:()=>l(null),invalidate:[f.group("workspaces"),f.me]});return s.jsxs("div",{className:"gc-page",children:[s.jsx(O,{title:"Workspaces",description:"Each workspace has its own wallet, budgets, routing policy, members and keys.",actions:i&&s.jsx(b,{variant:"brand",leadingIcon:s.jsx(z.plus,{size:14}),onClick:()=>n("new"),children:"New workspace"})}),s.jsx(B,{flush:!0,children:s.jsx(F,{query:y,children:t=>s.jsx(J,{label:"Workspaces",rows:t,rowKey:e=>e.id,rowLabel:e=>e.name,onRowClick:e=>k(e)&&n(e),actions:e=>[e.id!==g.id&&{label:"Open",onSelect:()=>d(e.id)},{label:"Members",onSelect:()=>{d(e.id),D("members")}},k(e)&&{label:"Edit",onSelect:()=>n(e)},i&&!e.isDefault&&{label:"Delete",tone:"danger",onSelect:()=>l(e)}],columns:[{key:"name",header:"Name",sortValue:e=>e.name,render:e=>s.jsxs("span",{className:"gc-strong",children:[e.name," ",e.isDefault&&s.jsx(w,{children:"Default"})," ",e.id===g.id&&s.jsx(w,{tone:"info",children:"Open"})]})},{key:"wallet",header:"Wallet",secondary:!0,render:e=>e.walletAddress?s.jsx(C,{title:e.walletAddress,children:N(e.walletAddress)}):s.jsx("span",{className:"gc-muted",children:e.buyerIdentity})},{key:"operator",header:"Authorized wallet",secondary:!0,render:e=>{const a=m(e);return a?a.relation===null?s.jsx("span",{className:"gc-muted",title:"The wallet or the chain could not be read",children:"unknown"}):M(a)?s.jsxs("span",{className:"gc-inline",children:[s.jsx(w,{tone:"warning",children:"Not set"}),a.canAuthorize&&s.jsx(b,{variant:"link",size:"sm",onClick:j=>{j.stopPropagation(),d(e.id),D("wallet")},children:"Authorize"})]}):a.relation==="self"?s.jsx("span",{className:"gc-muted",children:"Workspace wallet"}):s.jsx(C,{title:a.operator??void 0,children:N(a.operator)}):s.jsx("span",{className:"gc-muted",children:x.isLoading?"…":"—"})}},{key:"members",header:"Members",align:"right",secondary:!0,sortValue:e=>e.memberCount,render:e=>e.memberCount},{key:"keys",header:"Keys",align:"right",sortValue:e=>e.keyCount,render:e=>e.keyCount},{key:"limits",header:"Budgets",secondary:!0,optional:!0,render:e=>s.jsx("span",{className:"gc-muted",children:E(e.limits)})},{key:"policy",header:"Routing",secondary:!0,optional:!0,render:e=>s.jsx("span",{className:"gc-muted",children:T(e.routingPolicy)})}]})})}),s.jsx(q,{isOpen:c!==null,onClose:()=>n(null),size:"lg",title:c==="new"?"New workspace":"Edit workspace",children:c!==null&&s.jsx(X,{initial:c==="new"?null:c,onDone:()=>n(null)})}),s.jsx(V,{isOpen:o!==null,busy:u.isPending,error:u.error,onClose:()=>{l(null),u.reset()},onConfirm:()=>o&&u.mutate(o),title:"Delete this workspace?",confirmLabel:"Delete workspace",body:s.jsxs(s.Fragment,{children:["Deleting ",s.jsx("strong",{children:o==null?void 0:o.name})," is only possible once it has no active keys and no balance. Withdraw funds and revoke keys first."]})})]})}export{ie as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{w as o}from"./core-4C0uPyns.js";import"./index-BpFwvYMF.js";import"./index.es-C1jtws71.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-BZ-715IV.js";import"./clsx-B-dksMZM.js";import"./index-BhwNCc8y.js";const n=o` <svg fill="none" viewBox="0 0 13 4">
|
|
2
|
-
<path fill="currentColor" d="M.5 0h12L8.9 3.13a3.76 3.76 0 0 1-4.8 0L.5 0Z" />
|
|
3
|
-
</svg>`;export{n as cursorSvg};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as d,F as H,a as N}from"./mermaid-MCJ5UELQ-nKICVXNz.js";import{r as s,j}from"./index-BpFwvYMF.js";import"./bundle-full-BIYMHvS6.js";import"./clsx-B-dksMZM.js";import"./Chat-C1AfYZwW.js";var C=({code:i,isIncomplete:o=!1,language:e,maxHeight:u,raw:t,className:g,startLine:c,lineNumbers:h,...p})=>{let{shikiTheme:m}=s.useContext(d),r=H(),[x,a]=s.useState(t);return s.useEffect(()=>{if(!r){a(t);return}let l=!0,n=r.highlight({code:i,isIncomplete:o,language:e,themes:m},f=>{l&&a(f)});return n&&a(n),()=>{l=!1}},[i,o,e,m,r,t]),j.jsx(N,{className:g,language:e,lineNumbers:h,maxHeight:u,result:x,startLine:c,...p})};export{C as HighlightedCodeBlockBody};
|