@antseed/gateway-console 0.1.11 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/dist/assets/{Activity-UaQeZdKk.js → Activity-BcXN_DqV.js} +1 -1
  2. package/dist/assets/Audit-nk0K4aQy.js +1 -0
  3. package/dist/assets/{BrandIcon-dTKznfCA.js → BrandIcon-6gq42Dg-.js} +1 -1
  4. package/dist/assets/{ChainGate-DpChfDOP.js → ChainGate-Do1wYOPQ.js} +1 -1
  5. package/dist/assets/{ChannelClose-DpNV5MqB.js → ChannelClose-CdHUKMFm.js} +1 -1
  6. package/dist/assets/{Charts-C65ZE2xP.js → Charts-BMsoEfDr.js} +1 -1
  7. package/dist/assets/{Chat-BbM_y6mh.js → Chat-C4DsUQG-.js} +3 -3
  8. package/dist/assets/{ConnectWallet-CLv0c-JB.js → ConnectWallet-BYdqZipy.js} +1 -1
  9. package/dist/assets/{DataTable-BkJdorEh.js → DataTable-BCgVRqY6.js} +1 -1
  10. package/dist/assets/{Disclosure-DMLE7rCw.js → Disclosure-CQMtWM0M.js} +1 -1
  11. package/dist/assets/{KeyHolder-Cjko0nrs.js → KeyHolder-JK1zjm4r.js} +1 -1
  12. package/dist/assets/{Keys-DLKN6Sna.js → Keys-BndDLQdj.js} +1 -1
  13. package/dist/assets/{Logs-DIPNoSb8.js → Logs-DfacvRY6.js} +1 -1
  14. package/dist/assets/{Members-CgP9OTz9.js → Members-pSSyfBFp.js} +1 -1
  15. package/dist/assets/{Migrate-DDHZ-rux.js → Migrate-Bqnu-HEP.js} +1 -1
  16. package/dist/assets/{ModelDetails-CkDNU2Px.js → ModelDetails-Sgq3MjfG.js} +1 -1
  17. package/dist/assets/{Models-DXbiNymT.js → Models-C6QzCAh4.js} +1 -1
  18. package/dist/assets/{OperatorActions-BuEpaCiH.js → OperatorActions-DWX4uK6I.js} +1 -1
  19. package/dist/assets/{OperatorGateAlert-grMRoFdV.js → OperatorGateAlert-cpvsO9yT.js} +1 -1
  20. package/dist/assets/{Overview-BU9HCltc.js → Overview-C4Bu8z8u.js} +1 -1
  21. package/dist/assets/{PeerPicker-CfsXTUyK.js → PeerPicker-CcMSXxY3.js} +1 -1
  22. package/dist/assets/PolicyEditor-COREmE0O.js +1 -0
  23. package/dist/assets/PolicyField-ldIq_Yw-.js +1 -0
  24. package/dist/assets/{Presets-szQETQLM.js → Presets-DFKw93HK.js} +2 -2
  25. package/dist/assets/Providers-D_0V31og.js +1 -0
  26. package/dist/assets/{RequestLog-DJl6FJhq.js → RequestLog-ChzJA1hM.js} +1 -1
  27. package/dist/assets/{Rewards-BOfJumNk.js → Rewards-Cgw7r3bc.js} +2 -2
  28. package/dist/assets/{RewardsClaim-DHvgMfZ4.js → RewardsClaim-Df0QQMHb.js} +1 -1
  29. package/dist/assets/Routing-KpWxzlwc.js +1 -0
  30. package/dist/assets/{Segmented-D3e0aBDU.js → Segmented-DYnoemT9.js} +1 -1
  31. package/dist/assets/{SelectField-Cl4acfcI.js → SelectField-m1sMIgMa.js} +1 -1
  32. package/dist/assets/Settings-D2MkmqAU.js +7 -0
  33. package/dist/assets/{SidePanel-D0rNElh3.js → SidePanel-BFQArkoa.js} +1 -1
  34. package/dist/assets/{Staking-1D2HNu5P.js → Staking-2rSdK2Ob.js} +1 -1
  35. package/dist/assets/{StakingDashboard-C5Ib_AUs.js → StakingDashboard-DvLxJ1j4.js} +1 -1
  36. package/dist/assets/{Switch-B2AEvyu7.js → Switch-Db8Sm64J.js} +1 -1
  37. package/dist/assets/{Tabs-Cv10NtDy.js → Tabs-CCabxVNK.js} +1 -1
  38. package/dist/assets/{TextAreaField-Dbr655cs.js → TextAreaField-BCi-qMua.js} +1 -1
  39. package/dist/assets/{UsageByModel-BfvCLwo9.js → UsageByModel-Fb68pvpD.js} +1 -1
  40. package/dist/assets/{VerificationLinks-CERoRvCR.js → VerificationLinks-CWyl6ZEp.js} +1 -1
  41. package/dist/assets/{Wallet-CVS_hzu0.js → Wallet-BVuVEAB5.js} +7 -7
  42. package/dist/assets/{WalletConfirm-C8Kazsh7.js → WalletConfirm-Bs7CFRaa.js} +1 -1
  43. package/dist/assets/{WalletFunding-BbhXB813.js → WalletFunding-w9MlXB0t.js} +1 -1
  44. package/dist/assets/{WalletSignIn-Tzs38aME.js → WalletSignIn-CFxQjhbw.js} +1 -1
  45. package/dist/assets/{Workspaces-DGgrOEZk.js → Workspaces-DktyLm08.js} +1 -1
  46. package/dist/assets/{add-CdcnAnIQ.js → add-CWU7ACA6.js} +1 -1
  47. package/dist/assets/{all-wallets-CaMIS0WH.js → all-wallets-C7xN3fay.js} +1 -1
  48. package/dist/assets/{app-store-BJlWsf36.js → app-store-C9LYdcrl.js} +1 -1
  49. package/dist/assets/{apple-sOU-w3fg.js → apple-DyeheYaR.js} +1 -1
  50. package/dist/assets/{arrow-bottom-CTOfZJ7E.js → arrow-bottom-C-Ld0QTs.js} +1 -1
  51. package/dist/assets/{arrow-bottom-circle-B6IrOSiK.js → arrow-bottom-circle-CBZDZ8Ab.js} +1 -1
  52. package/dist/assets/{arrow-left-D0Qm9EWX.js → arrow-left-DpJrY7yH.js} +1 -1
  53. package/dist/assets/{arrow-right-XMSWQLiv.js → arrow-right-C12AYUbo.js} +1 -1
  54. package/dist/assets/{arrow-top-Bym-ayRK.js → arrow-top-DTpoR1JD.js} +1 -1
  55. package/dist/assets/{bank-NJF8WYDR.js → bank-Ce19qcX5.js} +1 -1
  56. package/dist/assets/{basic-bO70Xvle.js → basic-xSJded8g.js} +1 -1
  57. package/dist/assets/{browser-ucjw1tpv.js → browser-efLjW-nE.js} +1 -1
  58. package/dist/assets/{bundle-full-idGWmtvy.js → bundle-full-Bo_XusKG.js} +1 -1
  59. package/dist/assets/{card-DcpyI2qX.js → card-C5hP1T57.js} +1 -1
  60. package/dist/assets/{ccip-DBXxv0FH.js → ccip-B61TPyfu.js} +1 -1
  61. package/dist/assets/{checkmark-RFLSeCgj.js → checkmark-D6TDn2nt.js} +1 -1
  62. package/dist/assets/{checkmark-bold-Dl1q9Kby.js → checkmark-bold-D6Dl_7lL.js} +1 -1
  63. package/dist/assets/{chevron-bottom-ilycsYd4.js → chevron-bottom-BN93pLQ-.js} +1 -1
  64. package/dist/assets/{chevron-left-DFK2Xbq1.js → chevron-left-BRtPfxLq.js} +1 -1
  65. package/dist/assets/{chevron-right-Ew8XV9m9.js → chevron-right-q6ckJ6mb.js} +1 -1
  66. package/dist/assets/{chevron-top-CxoXH2-q.js → chevron-top-C1AX5sm6.js} +1 -1
  67. package/dist/assets/{chrome-store-ClmhY3B0.js → chrome-store-Bo_BoLHJ.js} +1 -1
  68. package/dist/assets/{clock-CCiukNBf.js → clock-BhAO_7G0.js} +1 -1
  69. package/dist/assets/{close-B0KBYbXe.js → close-BtzdVDHu.js} +1 -1
  70. package/dist/assets/{code-block-DxUcjw4S.js → code-block-DqMh9vFo.js} +1 -1
  71. package/dist/assets/{coinPlaceholder-D2ugxr3r.js → coinPlaceholder-Di1b8fYJ.js} +1 -1
  72. package/dist/assets/{compass-CutyEYmW.js → compass-C10lNmou.js} +1 -1
  73. package/dist/assets/{copy-CJ0RBt1e.js → copy-B5e38uFc.js} +1 -1
  74. package/dist/assets/{core-BCJdIbrO.js → core-B0f6zAPS.js} +3 -3
  75. package/dist/assets/{cursor-transparent-BQ_jwSfb.js → cursor-transparent-DzGICXfN.js} +1 -1
  76. package/dist/assets/cursor-zACYQT2t.js +3 -0
  77. package/dist/assets/{desktop-CsfFLaEs.js → desktop-DSb6a3DL.js} +1 -1
  78. package/dist/assets/{disconnect-B62slDXp.js → disconnect-DRzHq1ok.js} +1 -1
  79. package/dist/assets/{discord-B8GwtWtL.js → discord-c_RQc3fB.js} +1 -1
  80. package/dist/assets/{en_US-Y4ZOVFV4-sKQksBWU.js → en_US-Y4ZOVFV4-Bkc-z49M.js} +4 -4
  81. package/dist/assets/{etherscan-BT9zhNhd.js → etherscan-CQGvGKJu.js} +1 -1
  82. package/dist/assets/{exclamation-triangle-BSoPK6uq.js → exclamation-triangle-CPWxzsHw.js} +1 -1
  83. package/dist/assets/{extension-CQxJq6bp.js → extension-ytWXOqXr.js} +1 -1
  84. package/dist/assets/{external-link-BnfAKGN2.js → external-link-BYoSE2u3.js} +1 -1
  85. package/dist/assets/{facebook-DiAqdu4i.js → facebook-CMBv0nnN.js} +1 -1
  86. package/dist/assets/{farcaster-B1y2in5M.js → farcaster-CJmfWTQP.js} +1 -1
  87. package/dist/assets/{filters-BkVUp9NW.js → filters-DEiNVvyn.js} +1 -1
  88. package/dist/assets/{github-IRwi-GM-.js → github-CdMwJkf8.js} +1 -1
  89. package/dist/assets/{google-k2ysL2bi.js → google-CHI5gfH8.js} +1 -1
  90. package/dist/assets/{help-circle-DLj9trmu.js → help-circle-dA36a8fM.js} +1 -1
  91. package/dist/assets/highlighted-body-KQOG7T2V-BFlyrf-z.js +1 -0
  92. package/dist/assets/{id-BY4HWjv7.js → id-Dm0-1g1D.js} +1 -1
  93. package/dist/assets/{image-BtUeZe1t.js → image-BL3ODVX_.js} +1 -1
  94. package/dist/assets/{index-DYK1gWhP.css → index-BAcoKUeC.css} +1 -1
  95. package/dist/assets/{index-DiB9Y59V.js → index-BRgGxCKs.js} +3 -3
  96. package/dist/assets/{index-Cmb-H95F.js → index-BXzZZOmS.js} +1 -1
  97. package/dist/assets/{index-BXwAwVaO.js → index-CHeO_lLD.js} +1 -1
  98. package/dist/assets/{index-DsRX2D_O.js → index-D1OXThJP.js} +1 -1
  99. package/dist/assets/{index-cESr4Zze.js → index-DPXW_JSn.js} +10 -10
  100. package/dist/assets/{index.es-DP9EmOYi.js → index.es-XdMmjy3e.js} +3 -3
  101. package/dist/assets/{info-BaKj81_D.js → info-BbBzpLWs.js} +1 -1
  102. package/dist/assets/{info-circle-ecoA_B_t.js → info-circle-CKgnYdF-.js} +1 -1
  103. package/dist/assets/{lightbulb-DGQG-WWk.js → lightbulb-B6Xv9kMK.js} +1 -1
  104. package/dist/assets/{limits-D2JvFgaN.js → limits-uCwhqY-O.js} +1 -1
  105. package/dist/assets/{mail-BvEbsX3q.js → mail-BdCMypwE.js} +1 -1
  106. package/dist/assets/{mermaid-MCJ5UELQ-B8uOykea.js → mermaid-MCJ5UELQ-BaHsArCB.js} +3 -3
  107. package/dist/assets/{metamask-sdk-BYmYI1f3.js → metamask-sdk-BL7QLxcU.js} +1 -1
  108. package/dist/assets/{mobile-CwlM4JMX.js → mobile-F_82dhUb.js} +1 -1
  109. package/dist/assets/{more-CT36TpLm.js → more-CtMTtAsM.js} +1 -1
  110. package/dist/assets/{network-placeholder-DG1Vvm-U.js → network-placeholder-BRs4Lylz.js} +1 -1
  111. package/dist/assets/{nftPlaceholder-D6USOn7p.js → nftPlaceholder-DONTHyad.js} +1 -1
  112. package/dist/assets/{off-BNSO7pY1.js → off-Bwru40fy.js} +1 -1
  113. package/dist/assets/{play-store-PUfM0qU0.js → play-store-CDeNquGq.js} +1 -1
  114. package/dist/assets/{plus-C8fnGfp3.js → plus-EcrYfJFM.js} +1 -1
  115. package/dist/assets/{qr-code-CjdrQ0pR.js → qr-code-CF-SIZQq.js} +1 -1
  116. package/dist/assets/{recycle-horizontal-BMxBgeB4.js → recycle-horizontal-CQAPujmy.js} +1 -1
  117. package/dist/assets/{refresh-C2D196Fq.js → refresh-BErGEy2b.js} +1 -1
  118. package/dist/assets/{reown-logo-CLN2ORKJ.js → reown-logo-Ge2o4AAI.js} +1 -1
  119. package/dist/assets/{search-C9voC8dq.js → search-Ca88O9BA.js} +1 -1
  120. package/dist/assets/selection-BV37SUs_.js +1 -0
  121. package/dist/assets/{send-BAxcrGbA.js → send-VS1TUwft.js} +1 -1
  122. package/dist/assets/{sendTransaction-Cmz5eiPq.js → sendTransaction-k8aDYfd4.js} +1 -1
  123. package/dist/assets/stored-e0tX90bC.js +1 -0
  124. package/dist/assets/{swapHorizontal-CHCTyoP7.js → swapHorizontal-UNJ9wJ3Z.js} +1 -1
  125. package/dist/assets/{swapHorizontalBold-LQsONWBk.js → swapHorizontalBold-eQTpC4fd.js} +1 -1
  126. package/dist/assets/{swapHorizontalMedium-BxrBEjrx.js → swapHorizontalMedium-DaFWQu14.js} +1 -1
  127. package/dist/assets/{swapHorizontalRoundedBold-CEHDoSv1.js → swapHorizontalRoundedBold-BbRZUmJZ.js} +1 -1
  128. package/dist/assets/{swapVertical-DMylrYB1.js → swapVertical-CrZ6Be2R.js} +1 -1
  129. package/dist/assets/{telegram-BhVfpln1.js → telegram-CDAYT0ej.js} +1 -1
  130. package/dist/assets/{three-dots-nkXRRS-E.js → three-dots-CK__4w5S.js} +1 -1
  131. package/dist/assets/{twitch-CYroZH_7.js → twitch-BS50nSpU.js} +1 -1
  132. package/dist/assets/{twitterIcon-DpHUqlyA.js → twitterIcon-BtVx5zJI.js} +1 -1
  133. package/dist/assets/{usage-8BBeTlF-.js → usage-DQGKL0DJ.js} +1 -1
  134. package/dist/assets/{useInfiniteQuery-zD1WIYBy.js → useInfiniteQuery-CAj47QRO.js} +1 -1
  135. package/dist/assets/{useTx-DsLsc5bB.js → useTx-DzRlz7Ez.js} +1 -1
  136. package/dist/assets/{verify-filled-EsNi41IB.js → verify-filled-E4LyUumx.js} +1 -1
  137. package/dist/assets/{verify-DARDbLiQ.js → verify-hRAQBjoS.js} +1 -1
  138. package/dist/assets/{w3m-modal-CIUN4uxE.js → w3m-modal-CLSVKDRP.js} +1 -1
  139. package/dist/assets/{waitForCallsStatus-DlpsNYx1.js → waitForCallsStatus-C51Vv8Tt.js} +1 -1
  140. package/dist/assets/{wallet-B2vgeP1E.js → wallet-D-TGx4VA.js} +1 -1
  141. package/dist/assets/{wallet-placeholder-DQsissb3.js → wallet-placeholder-SjwHckDA.js} +1 -1
  142. package/dist/assets/{walletconnect-DylNgC0Z.js → walletconnect-7nuI2nwG.js} +1 -1
  143. package/dist/assets/{warning-circle-CVEgsVb4.js → warning-circle-BI2BfSeD.js} +1 -1
  144. package/dist/assets/{writeContract-Cqg_OlRQ.js → writeContract-CaMlmKcK.js} +1 -1
  145. package/dist/assets/{x-DSURRh6S.js → x-DoGk7CZD.js} +1 -1
  146. package/dist/index.html +2 -2
  147. package/package.json +1 -1
  148. package/dist/assets/Audit-Cd26xOlL.js +0 -1
  149. package/dist/assets/PolicyEditor-ptFDJhFh.js +0 -1
  150. package/dist/assets/PolicyField-CHhm50jF.js +0 -1
  151. package/dist/assets/Providers-B6xbFeNU.js +0 -1
  152. package/dist/assets/Routing-DFuhPfzU.js +0 -1
  153. package/dist/assets/Settings--0bbw1dn.js +0 -7
  154. package/dist/assets/cursor-Bg_hT9DN.js +0 -3
  155. package/dist/assets/highlighted-body-KQOG7T2V-CJM-VU3I.js +0 -1
  156. package/dist/assets/selection-HN8SZ52c.js +0 -1
  157. package/dist/assets/stored-CETnaQtE.js +0 -1
@@ -0,0 +1 @@
1
+ import{j as e,r as f,I as M,u as q,n as G,be as me,t as Y,q as Q,f as O,l as he,Q as pe,E as ge,C as E,D as K,B as P,b_ as J,M as fe,w as X,T as C,o as xe,b4 as b,b$ as y,bh as je,b6 as be,bi as ye,bf as Pe,bj as Z,bL as Ne,bM as ve,bN as we,c0 as D,c1 as A,c2 as V,bn as Ie,bw as ke,af as Se,c3 as Me,c4 as Ce,c5 as _e,c6 as $e}from"./index-DPXW_JSn.js";import{p as ee,P as S,C as Te}from"./PeerPicker-CcMSXxY3.js";import{D as Le}from"./DataTable-BCgVRqY6.js";import{S as $}from"./SelectField-m1sMIgMa.js";import{S as B}from"./Segmented-DYnoemT9.js";import{S as T}from"./Switch-Db8Sm64J.js";import{D as Oe}from"./Disclosure-CQMtWM0M.js";const qe="https://antseed.com/docs/reputation";function Ee({label:s,children:r}){const[n,l]=f.useState(!1),a=f.useId();return e.jsxs("span",{className:n?"gc-tip gc-tip--open":"gc-tip",onMouseLeave:()=>l(!1),children:[e.jsx("button",{type:"button",className:"gc-tip__button","aria-label":s,"aria-describedby":a,onClick:()=>l(i=>!i),onBlur:()=>l(!1),children:e.jsx(M.info,{size:14})}),e.jsx("span",{role:"tooltip",id:a,className:"gc-tip__bubble",children:r})]})}function Ue(){return e.jsxs(Ee,{label:"What is the trust score?",children:[e.jsx("span",{className:"gc-tip__title",children:"Trust score, 0 to 100"}),"Your buyer works it out for each seller from records it can check: service history (up to 50), usage last week (20), staked ANTS (10) and a verified GitHub or domain (20), plus 5 for a free model. Proven wash traders score 0."," ",e.jsx("a",{href:qe,target:"_blank",rel:"noreferrer",children:"How it works"})]})}function Fe(s){return r=>{r.preventDefault(),r.stopPropagation(),s()}}function se({initial:s,peers:r,onDone:n}){const[l,a]=f.useState((s==null?void 0:s.name)??""),[i,o]=f.useState((s==null?void 0:s.description)??""),[h,p]=f.useState((s==null?void 0:s.peerIds)??[]),m=Y({mutationFn:()=>{const u={name:l.trim(),description:i.trim()||null,peerIds:h};return s?O.network.updatePeerList(s.id,u):O.network.createPeerList(u)},onSuccess:n,invalidate:[Q.peerLists]});return e.jsxs("form",{className:"gc-stack",onSubmit:Fe(()=>m.mutate()),children:[e.jsx(C,{label:"Name",required:!0,placeholder:"e.g. Our own sellers",value:l,onChange:u=>a(u.target.value)}),e.jsx(C,{label:"Description",value:i,onChange:u=>o(u.target.value)}),e.jsx(S,{label:"Sellers",value:h,onChange:p,peers:r}),e.jsx("p",{className:"gc-fineprint",children:"Policies refer to a list by name, so editing it changes every policy that uses it."}),m.error?e.jsx(xe,{error:m.error,title:"Could not save the list"}):null,e.jsxs("div",{className:"gc-actions",children:[e.jsx(P,{variant:"ghost",onClick:n,children:"Cancel"}),e.jsx(P,{type:"submit",disabled:m.isPending||!l.trim(),children:m.isPending?"Saving…":"Save list"})]})]})}const le="Named groups of sellers that routing rules allow or block in one step. Editing a list changes every rule that uses it.";function Re(s,r){const n=s.peerIds.map(l=>ee(r,l));return n.length<=4?n.join(", "):`${n.slice(0,4).join(", ")} and ${n.length-4} more`}function ze({peers:s,inDialog:r=!1}){const{viewer:n}=q(),l=G(n),a=me(),[i,o]=f.useState(null),[h,p]=f.useState(null),m=Y({mutationFn:u=>O.network.removePeerList(u.id),onSuccess:()=>p(null),invalidate:[Q.peerLists]});return e.jsxs(he,{flush:!r,title:r?void 0:"Seller lists",description:r?void 0:`${le}${l?"":" Organization admins edit them."}`,actions:l&&e.jsx(P,{size:"sm",variant:"outline",leadingIcon:e.jsx(M.plus,{size:14}),onClick:()=>o("new"),children:"New list"}),children:[e.jsx(pe,{query:a,children:u=>e.jsx(Le,{label:"Seller lists",rows:u,rowKey:c=>c.id,rowLabel:c=>c.name,actions:c=>l?[{label:"Edit",onSelect:()=>o(c)},{label:"Delete",tone:"danger",onSelect:()=>p(c)}]:[],empty:e.jsx(ge,{icon:e.jsx(M.network,{size:18}),title:"No seller lists",body:"Group sellers you trust, or ones you run yourself, then allow or block the whole group in a routing rule."}),columns:[{key:"name",header:"Name",render:c=>e.jsx("span",{className:"gc-strong",children:e.jsx(te,{list:c,peers:s})})},{key:"sellers",header:"Sellers",render:c=>e.jsx("span",{className:"gc-muted",children:c.peerIds.length?Re(c,s):"Empty"})},{key:"count",header:"Count",align:"right",secondary:!0,render:c=>c.peerIds.length},{key:"desc",header:"Description",secondary:!0,optional:!0,render:c=>e.jsx("span",{className:"gc-muted",children:c.description??"—"})}]})}),e.jsx(E,{isOpen:i!==null,onClose:()=>o(null),title:i==="new"?"New seller list":"Edit seller list",size:"lg",children:i!==null&&e.jsx(se,{initial:i==="new"?null:i,peers:s,onDone:()=>o(null)})}),e.jsx(K,{isOpen:h!==null,busy:m.isPending,error:m.error,onClose:()=>p(null),onConfirm:()=>h&&m.mutate(h),title:"Delete this list?",confirmLabel:"Delete",body:"Policies refer to lists by reference: once deleted, the list adds no sellers to them. An allow list made only of deleted lists lets no seller serve."})]})}function De({peers:s,label:r="Manage seller lists"}){const[n,l]=f.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx(P,{variant:"link",size:"sm",onClick:()=>l(!0),children:r}),J.createPortal(e.jsx(E,{isOpen:n,onClose:()=>l(!1),title:"Seller lists",subtitle:le,size:"lg",children:e.jsx(ze,{peers:s,inDialog:!0})}),document.body)]})}function te({list:s,peers:r}){const{viewer:n}=q(),l=G(n),[a,i]=f.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"gc-link-button",title:l?`Edit the “${s.name}” list`:`See the “${s.name}” list`,onClick:()=>i(!0),children:s.name}),J.createPortal(e.jsx(E,{isOpen:a,onClose:()=>i(!1),title:l?"Edit seller list":s.name,size:"lg",subtitle:l?void 0:`${s.peerIds.length} seller${s.peerIds.length===1?"":"s"}. Organization admins edit seller lists.`,children:l?e.jsx(se,{initial:s,peers:r,onDone:()=>i(!1)}):s.peerIds.length?e.jsx("ul",{className:"gc-plain-list",children:s.peerIds.map(o=>e.jsxs("li",{children:[ee(r,o)," ",e.jsx(fe,{children:X(o,6,4)})]},o))}):e.jsx("p",{className:"gc-muted",children:"No sellers yet."})}),document.body)]})}function L(s,r,n=3){const l=s.map(a=>{var i;return((i=r==null?void 0:r.find(o=>y(o.peerId)===y(a)))==null?void 0:i.displayName)??X(a,8,4)});return l.length<=n?l.join(", "):`${l.slice(0,n).join(", ")} and ${l.length-n} more`}function W(s,r){return(s??[]).map(n=>{const l=r.find(a=>a.id===n);return l?`the “${l.name}” seller list (${l.peerIds.length})`:"a deleted seller list"}).join(", ")}function Ae(s,r,n=[]){var o,h,p,m;if(!s)return[];const l=s,a=[];if(l.allowedModels&&a.push(l.allowedModels.length===0?"No model is allowed.":`Only these models: ${l.allowedModels.join(", ")}.`),l.allowedPeerIds||l.allowedPeerLists){const u=[(o=l.allowedPeerIds)!=null&&o.length?L(l.allowedPeerIds,r):"",W(l.allowedPeerLists,n)].filter(Boolean);a.push(u.length?`Only these sellers: ${u.join(", ")}.`:"No seller is allowed.")}if((h=l.blockedPeerIds)!=null&&h.length||(p=l.blockedPeerLists)!=null&&p.length){const u=[(m=l.blockedPeerIds)!=null&&m.length?L(l.blockedPeerIds,r):"",W(l.blockedPeerLists,n)].filter(Boolean);a.push(`Never uses ${u.join(", ")}.`)}l.requireTee&&a.push("Only sellers running in a TEE."),l.requireVerified&&a.push("Only sellers with a verified domain or GitHub account."),l.minTrustScore!==void 0&&a.push(`Only sellers with trust ${l.minTrustScore} or more.`),l.minReputation!==void 0&&a.push(`Only sellers with reputation ${l.minReputation} or more.`);const i=[l.maxInputUsdPerMillion!==void 0?`${b(l.maxInputUsdPerMillion)}/M input`:null,l.maxOutputUsdPerMillion!==void 0?`${b(l.maxOutputUsdPerMillion)}/M output`:null,l.maxCachedInputUsdPerMillion!==void 0?`${b(l.maxCachedInputUsdPerMillion)}/M cached input`:null,l.maxImageUsdPerImage!==void 0?`$${l.maxImageUsdPerImage} per image`:null].filter(u=>u!==null);i.length&&a.push(`Pays at most ${i.join(", ")}.`);for(const[u,c]of Object.entries(l.modelRoutes??{}))a.push(`For ${u}: tries ${L(c.peerIds,r,4).replace(/, ([^,]*)$/,", then $1")} first${c.strict?", and no other seller":""}.`);return l.sort==="price"?a.push("Ranks the cheapest seller first."):l.sort==="latency"?a.push("Ranks the fastest seller first."):l.sort==="trust"&&a.push("Ranks the most trusted seller first."),l.preferFreePeers&&a.push("Free sellers first."),a}function Ve(s,r,n,l){var o,h;const a=y(r.peerId);if((o=s.blockedPeerIds)!=null&&o.some(p=>y(p)===a))return"blocks it";if(s.allowedPeerIds&&!s.allowedPeerIds.some(p=>y(p)===a))return"does not allow it";if(s.requireTee&&n&&!n.tee)return"requires a TEE";if(s.requireVerified&&n&&!n.verified)return"requires a verified seller";if(s.minTrustScore!==void 0&&(r.trustScore??0)<s.minTrustScore)return`requires trust ${s.minTrustScore}+ (it has ${Math.round(r.trustScore??0)})`;if(s.minReputation!==void 0&&n&&(n.reputationScore??0)<s.minReputation)return`requires reputation ${s.minReputation}+`;if(s.maxInputUsdPerMillion!==void 0&&r.inputUsdPerMillion!==null&&r.inputUsdPerMillion>s.maxInputUsdPerMillion)return`caps input at ${b(s.maxInputUsdPerMillion)}/M (it asks ${b(r.inputUsdPerMillion)})`;if(s.maxOutputUsdPerMillion!==void 0&&r.outputUsdPerMillion!==null&&r.outputUsdPerMillion>s.maxOutputUsdPerMillion)return`caps output at ${b(s.maxOutputUsdPerMillion)}/M (it asks ${b(r.outputUsdPerMillion)})`;const i=(h=s.modelRoutes)==null?void 0:h[l];return i!=null&&i.strict&&!i.peerIds.some(p=>y(p)===a)?"only allows its route for this model":null}function Be(s,r,n,l=[]){if(r.eligible)return[];const a=n==null?void 0:n.find(i=>y(i.peerId)===y(r.peerId));return s.sources.flatMap(i=>{if(!i.policy)return[];const o=Ve(je(i.policy,l),r,a,s.model);return o?[{level:i.level,levelId:i.id,rule:o}]:[]})}function es(s,r,n=[]){const l=new Map;for(const a of(s==null?void 0:s.candidates)??[])for(const i of new Set(Be(s,a,r,n).map(o=>o.level)))l.set(i,(l.get(i)??0)+1);return l}function We({draft:s,parent:r,above:n,peers:l,lists:a}){const i=f.useMemo(()=>{try{return Ie(s,a)}catch{return null}},[s,a]),o=f.useMemo(()=>!i||!l||l.length===0?null:{matched:ke(Z(r,i),l,a).length,total:l.length},[i,r,l,a]),h=i?Ae(i,l,a):[];return e.jsxs("section",{className:"gc-policy__summary","aria-live":"polite",children:[e.jsxs("div",{className:"gc-policy__summary-head",children:[e.jsx("span",{className:"gc-strong",children:"What this level does"}),o&&o.matched>0&&e.jsxs("span",{className:"gc-muted",children:[o.matched," of ",o.total," sellers can serve",n?` after ${n}`:""]})]}),h.length?e.jsx("ul",{className:"gc-funnel__rules",children:h.map(p=>e.jsx("li",{children:p},p))}):e.jsx("p",{className:"gc-funnel__none",children:"Nothing of its own yet: it passes on everything above."}),o&&o.matched===0&&e.jsxs(Se,{tone:"warning",title:"No seller matches this policy",children:["With ",n?`${n} and `:"","these settings, none of the ",o.total," sellers this gateway sees can serve a request. Requests will fail until you loosen it."]})]})}function w({title:s,help:r,children:n}){return e.jsxs("section",{className:"gc-policy__group",children:[e.jsxs("div",{className:"gc-policy__group-head",children:[e.jsx("h3",{children:s}),e.jsx("p",{className:"gc-fineprint",children:r})]}),e.jsx("div",{className:"gc-policy__group-body",children:n})]})}function ss({value:s,onChange:r,peers:n,lists:l,showTemplates:a=!0,parent:i,disabled:o}){const[h,p]=f.useState(""),[m,u]=f.useState(null),c=(t,x)=>r({...s,[t]:x}),v=be(n),j=ye(Pe().data),d=f.useMemo(()=>j||i?Z(j,i):null,[j,i]),ne=j&&i?"the buyer config and the levels above":j?"the buyer config":i?"the levels above":"",U=t=>(j==null?void 0:j[t])!==void 0&&j[t]===(d==null?void 0:d[t])?"The buyer config":"The levels above",{viewer:re}=q(),ie=Ne("settings",re)?e.jsx("a",{className:"gc-link",href:we("settings?tab=buyer"),onClick:ve("settings?tab=buyer"),children:"Change"}):null,ae=t=>U(t)==="The buyer config"?ie:null;function F(t,x=h){var z;let g;if(t==="own"){const k=l.find(ue=>ue.id===x);if(!k)return;g={allowMode:"only",allowedPeerIds:[],allowedListIds:[k.id]}}else g=Ce(_e(t));const N=$e(s,g),de=((z=D.find(k=>k.id===t))==null?void 0:z.label)??t;N.length>0?u({label:de,template:g,conflicts:N}):r(V(s,g))}function _(t,x){c("routes",s.routes.map((g,N)=>N===t?x:g))}const I=(t,x)=>e.jsx(C,{size:"sm",className:"gc-num",label:x,inputMode:"decimal",value:s[t],placeholder:(d==null?void 0:d[t])!==void 0?`≤ ${b(d[t])} above`:"No cap",onChange:g=>c(t,g.target.value)}),oe="",ce=t=>{if(t==="clear")return r(Me());if(t.startsWith("list:"))return p(t.slice(5)),F("own",t.slice(5));t&&F(t)},R=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"gc-policy__top",children:[e.jsx(We,{draft:s,parent:d,above:ne,peers:n,lists:l}),a&&!o&&e.jsx($,{size:"sm","aria-label":"Start from a template",value:oe,onChange:ce,options:[{value:"",label:"Start from…"},...D.filter(t=>t.id!=="own").map(t=>({value:t.id,label:`${t.label}: ${t.description}`})),...l.map(t=>({value:`list:${t.id}`,label:`Only the “${t.name}” list (${t.peerIds.length})`})),{value:"clear",label:"Clear every setting"}]})]}),e.jsxs(w,{title:"Sellers",help:e.jsxs(e.Fragment,{children:["Who may serve requests. Blocked sellers never serve. ",e.jsx(De,{peers:n})]}),children:[e.jsx(B,{label:"Which sellers may serve",value:s.allowMode,onChange:t=>c("allowMode",t),options:[{value:"any",label:"Any seller"},{value:"only",label:"Only these"}]}),s.allowMode==="only"&&e.jsxs(e.Fragment,{children:[e.jsx(H,{label:"Seller lists",lists:l,value:s.allowedListIds,onChange:t=>c("allowedListIds",t),peers:n}),e.jsx(S,{label:l.length?"And these sellers":"Allowed sellers",value:s.allowedPeerIds,onChange:t=>c("allowedPeerIds",t),peers:n}),s.allowedPeerIds.length===0&&s.allowedListIds.length===0&&e.jsx("p",{className:"gc-warn",children:"An empty allow list means no seller can serve."})]}),e.jsx(S,{label:"Never use",value:s.blockedPeerIds,onChange:t=>c("blockedPeerIds",t),peers:n}),e.jsx(H,{label:"Never use these lists",lists:l,value:s.blockedListIds,onChange:t=>c("blockedListIds",t),peers:n})]}),e.jsxs(w,{title:"Quality",help:"How trusted a seller must be, and what it must run, to serve.",children:[e.jsx(He,{label:"Minimum trust score",info:e.jsx(Ue,{}),value:s.minTrustScore,onChange:t=>c("minTrustScore",t),floor:d==null?void 0:d.minTrustScore,floorSource:U("minTrustScore"),floorAction:ae("minTrustScore")}),s.minReputation!==""&&e.jsxs("p",{className:"gc-fineprint",children:["This policy also asks for reputation ",s.minReputation," or more, an older score the trust score replaces."," ",e.jsx(P,{variant:"link",size:"sm",onClick:()=>c("minReputation",""),children:"Remove it"})]}),e.jsxs("div",{className:"gc-policy__switches",children:[e.jsx(T,{checked:s.requireTee||!!(d!=null&&d.requireTee),disabled:!!(d!=null&&d.requireTee),onChange:t=>c("requireTee",t),label:"TEE sellers only"}),e.jsx(T,{checked:s.requireVerified||!!(d!=null&&d.requireVerified),disabled:!!(d!=null&&d.requireVerified),onChange:t=>c("requireVerified",t),label:"Verified sellers only"})]}),((d==null?void 0:d.requireTee)||(d==null?void 0:d.requireVerified))&&e.jsxs("span",{className:"as-field__hint",children:[d.requireTee&&d.requireVerified?"TEE and verified sellers are":d.requireTee?"TEE sellers are":"Verified sellers are"," already required above."]})]}),e.jsx(w,{title:"Price limits",help:"Sellers asking more are skipped. Leave a field empty for no limit.",children:e.jsxs("div",{className:"gc-policy__caps",children:[I("maxInputUsdPerMillion","Input $/M"),I("maxOutputUsdPerMillion","Output $/M"),I("maxCachedInputUsdPerMillion","Cached input $/M"),I("maxImageUsdPerImage","$ per image")]})}),e.jsxs(w,{title:"Models",help:"Requests for any other model are refused.",children:[e.jsx(B,{label:"Which models may be used",value:s.modelsMode,onChange:t=>c("modelsMode",t),options:[{value:"any",label:"Any model"},{value:"only",label:"Only these models"}]}),s.modelsMode==="only"&&e.jsx(Te,{label:"Allowed models",value:s.allowedModels,onChange:t=>c("allowedModels",t),suggestions:v,placeholder:"Model id"})]}),e.jsxs(w,{title:"Ranking",help:"The order the allowed sellers are tried in. Inherit keeps automatic routing, which ranks by expected cost and success rate.",children:[e.jsxs("div",{className:"gc-policy__pair",children:[e.jsx($,{size:"sm",label:"Sort by",value:s.sort,onChange:t=>c("sort",t),options:[{value:"",label:"Inherit"},...Object.keys(A).map(t=>({value:t,label:A[t]}))]}),e.jsx($,{size:"sm",label:"Free sellers first",value:s.preferFreePeers,onChange:t=>c("preferFreePeers",t),options:[{value:"inherit",label:"Inherit"},{value:"yes",label:"Yes"},{value:"no",label:"No"}]})]}),e.jsxs(Oe,{title:"Fallback chains",summary:s.routes.length?`${s.routes.length} chain${s.routes.length===1?"":"s"}`:"None",defaultOpen:s.routes.length>0,children:[e.jsx("p",{className:"gc-fineprint",children:"Sellers to try first for a model, in order. After the chain, normal ranking continues unless the chain is strict."}),s.routes.map((t,x)=>e.jsxs("div",{className:"gc-route",children:[e.jsxs("div",{className:"gc-inline",children:[e.jsx(C,{size:"sm",label:"Model",list:"gc-policy-models",value:t.model,placeholder:"Model id",onChange:g=>_(x,{...t,model:g.target.value})}),e.jsx(T,{checked:t.strict,onChange:g=>_(x,{...t,strict:g}),label:"Strict"}),e.jsx(P,{variant:"ghost",size:"sm",onClick:()=>c("routes",s.routes.filter((g,N)=>N!==x)),children:"Remove"})]}),e.jsx(S,{label:"Sellers, in order",ordered:!0,value:t.peerIds,onChange:g=>_(x,{...t,peerIds:g}),peers:n})]},x)),e.jsx("datalist",{id:"gc-policy-models",children:v.map(t=>e.jsx("option",{value:t},t))}),e.jsx("div",{children:e.jsx(P,{variant:"outline",size:"sm",onClick:()=>c("routes",[...s.routes,{model:"",peerIds:[],strict:!1}]),children:"Add fallback chain"})})]})]}),e.jsx(K,{isOpen:m!==null,tone:"primary",title:`Apply “${(m==null?void 0:m.label)??""}”?`,confirmLabel:"Replace and apply",body:e.jsxs(e.Fragment,{children:["This template changes settings you already set: ",e.jsx("strong",{children:m==null?void 0:m.conflicts.join(", ")}),". Your other settings stay."]}),onClose:()=>u(null),onConfirm:()=>{m&&r(V(s,m.template)),u(null)}})]});return o?e.jsx("fieldset",{className:"gc-policy gc-policy--readonly",disabled:!0,children:R}):e.jsx("div",{className:"gc-policy",children:R})}function He({label:s,info:r,value:n,onChange:l,clearable:a=!0,hint:i,floor:o,floorSource:h="The levels above",floorAction:p}){const m=f.useId(),u=n!=="",c=o!==void 0&&o>0,v=c&&u&&Number(n)<=o,j=v?String(o):u?n:c?`${o} inherited`:"Inherit";return e.jsxs("div",{className:"gc-slider",children:[e.jsxs("div",{className:"gc-slider__head",children:[e.jsxs("span",{className:"gc-info-label",children:[e.jsx("span",{className:"as-field__label",id:m,children:s}),r]}),e.jsx("span",{className:u?"gc-slider__value":"gc-slider__value gc-slider__value--inherit",children:j})]}),e.jsxs("div",{className:"gc-inline",children:[e.jsx("input",{type:"range",min:0,max:100,step:5,value:u?Math.max(Number(n),c?o:0):c?o:0,"aria-labelledby":m,onChange:d=>l(String(Math.max(Number(d.target.value),c?o:0)))}),a&&u&&e.jsx(P,{variant:"ghost",size:"sm",onClick:()=>l(""),children:"Clear"})]}),c&&(u&&!v?e.jsxs("span",{className:"as-field__hint",children:[h," requires ≥ ",o,". Only a higher value narrows it."]}):e.jsxs("span",{className:"as-field__hint gc-override",children:[e.jsx(M.lock,{size:12})," Locked at ",o," by ",h.replace(/^The /,"the "),".",p?e.jsxs(e.Fragment,{children:[" ",p]}):null]})),i&&e.jsx("span",{className:"as-field__hint",children:i})]})}function H({label:s,lists:r,value:n,onChange:l,peers:a}){return r.length===0?null:e.jsxs("fieldset",{className:"gc-checks",children:[e.jsx("legend",{className:"as-field__label",children:s}),r.map(i=>e.jsxs("span",{className:"gc-check",children:[e.jsx("input",{type:"checkbox","aria-label":`${s}: ${i.name}`,checked:n.includes(i.id),onChange:o=>l(o.target.checked?[...n,i.id]:n.filter(h=>h!==i.id))}),e.jsx(te,{list:i,peers:a})," ",e.jsxs("span",{className:"gc-muted",children:["(",i.peerIds.length,")"]})]},i.id))]})}export{ze as P,He as S,Ue as T,es as a,ss as b,De as c,Be as e,Ae as p};
@@ -0,0 +1 @@
1
+ import{be as p,r as d,j as e,D as m,bo as x,bp as b,bq as v,v as j,bl as y,bk as w,bn as f,b as C,B as h,C as k}from"./index-DPXW_JSn.js";import{b as S}from"./PolicyEditor-COREmE0O.js";function B(){const a=p(),[s,n]=d.useState(null),l=d.useRef(null),r=t=>new Promise(u=>{l.current=u,n(t)}),o=t=>{var u;n(null),(u=l.current)==null||u.call(l,t),l.current=null},i=(t,u)=>x(t.some(g=>b(g,a.data??null)),u,r),c=(s==null?void 0:s.kind)==="narrowed"?e.jsx(m,{isOpen:!0,tone:"primary",title:"The levels above allow less",confirmLabel:"Save anyway",cancelLabel:"Go back",onClose:()=>o(!1),onConfirm:()=>o(!0),body:e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsx("span",{children:"Part of this change has no effect, because a workspace, member or admin restriction above it is tighter. Saving stores it as you entered it; only what the levels above allow applies."}),s.lines.length>0&&e.jsx("ul",{className:"gc-list",children:s.lines.map(t=>e.jsx("li",{children:t},t))})]})}):e.jsx(m,{isOpen:(s==null?void 0:s.kind)==="empty",tone:"danger",title:"Save an empty allow list?",confirmLabel:"Save anyway",cancelLabel:"Go back",onClose:()=>o(!1),onConfirm:()=>o(!0),body:e.jsxs(e.Fragment,{children:["With this allow list ",e.jsx("strong",{children:"no seller can serve"})," requests here (it names no seller, or none the levels above allow), so they fail until you change it. To let any seller serve, choose “Any seller” instead."]})});return{save:i,dialog:c}}function P({policy:a,invalid:s,empty:n="Inherits everything"}){if(s)return e.jsx("span",{className:"gc-warn",children:"Has an invalid setting; open it to fix."});const l=v(a);return l.length===0?e.jsx("span",{className:"gc-muted",children:n}):e.jsx("span",{className:"gc-chiprow",children:l.map(r=>e.jsx(j,{children:r},r))})}function D(a){const[s,n]=d.useState(()=>y(a)),l=p();return{draft:s,setDraft:n,reset:r=>n(y(r)),build:()=>w(f(s,l.data??null))}}function N(a,s){try{return{policy:f(a,s),error:null}}catch(n){return{policy:null,error:n instanceof Error?n.message:String(n)}}}function O({draft:a,setDraft:s,title:n="Routing policy"}){const l=C(),r=p(),[o,i]=d.useState(null),c=N(a,r.data??null),t=()=>{o&&s(o),i(null)};return e.jsxs("div",{className:"gc-policy-row",children:[e.jsxs("div",{className:"gc-policy-row__text",children:[e.jsx("span",{className:"as-field__label",children:n}),e.jsx(P,{policy:c.policy,invalid:c.error!==null})]}),e.jsx(h,{size:"sm",variant:"outline",onClick:()=>i(a),children:"Edit"}),e.jsx(k,{isOpen:o!==null,onClose:()=>i(null),size:"xl",title:n,subtitle:"Blank settings inherit from the level above, which this can only narrow. Saved with the form.",footer:e.jsxs(e.Fragment,{children:[c.error&&e.jsx("span",{className:"gc-warn gc-footer-note",children:c.error}),e.jsx(h,{variant:"ghost",onClick:t,children:"Cancel"}),e.jsx(h,{onClick:()=>i(null),children:"Done"})]}),children:e.jsx(S,{value:a,onChange:s,peers:l.data,lists:r.data??[]})})]})}export{O as P,B as a,N as d,D as u};
@@ -1,4 +1,4 @@
1
- import{u as A,i as J,bm 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-cESr4Zze.js";import{u as Y,a as Z,P as ee}from"./PolicyField-CHhm50jF.js";import{D as se}from"./DataTable-BkJdorEh.js";import{S as re}from"./SelectField-Cl4acfcI.js";import{T as N}from"./TextAreaField-Dbr655cs.js";import"./PolicyEditor-ptFDJhFh.js";import"./PeerPicker-CfsXTUyK.js";import"./Segmented-D3e0aBDU.js";import"./roving-DkptacxO.js";import"./Switch-B2AEvyu7.js";import"./Disclosure-DMLE7rCw.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:`{
1
+ import{u as A,i as J,b5 as B,r as n,t as E,j as e,P as $,B as v,I as k,l as L,Q as R,M as Q,av as U,v as C,A as V,E as W,n as F,C as G,D as H,b as K,T as j,b6 as _,o as X,q as O,f as y}from"./index-DPXW_JSn.js";import{u as Y,a as Z,P as ee}from"./PolicyField-ldIq_Yw-.js";import{D as se}from"./DataTable-BCgVRqY6.js";import{S as re}from"./SelectField-m1sMIgMa.js";import{T as N}from"./TextAreaField-BCi-qMua.js";import"./PolicyEditor-COREmE0O.js";import"./PeerPicker-CcMSXxY3.js";import"./Segmented-DYnoemT9.js";import"./roving-DkptacxO.js";import"./Switch-Db8Sm64J.js";import"./Disclosure-CQMtWM0M.js";function D(s){return s.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)}function te(s){return/^[a-z0-9][a-z0-9-]{0,47}$/.test(s)}function ae(s){if(!s.trim())return{};let a;try{a=JSON.parse(s)}catch{throw new Error("Parameters must be valid JSON.")}if(!a||typeof a!="object"||Array.isArray(a))throw new Error('Parameters must be a JSON object, like {"temperature": 0.2}.');return a}function oe({initial:s,prefill:a,onDone:m}){const{workspace:p,viewer:c}=A(),u=K(),[o,g]=n.useState((s==null?void 0:s.name)??(a==null?void 0:a.name)??""),[l,d]=n.useState((s==null?void 0:s.slug)??(a?D(a.name):"")),[t,q]=n.useState(!!s),[h,I]=n.useState((s==null?void 0:s.model)??(a==null?void 0:a.model)??""),[b,M]=n.useState(s?s.workspaceId??"":p.id),[S,T]=n.useState((s==null?void 0:s.systemPrompt)??""),[w,z]=n.useState(s&&Object.keys(s.params).length?JSON.stringify(s.params,null,2):""),x=Y(s==null?void 0:s.routingPolicy),P=Z(),i=E({mutationFn:()=>{if(!te(l))throw new Error("Slug must be lowercase letters, numbers and dashes.");const r={name:o.trim(),slug:l,model:h.trim(),workspaceId:b||null,systemPrompt:S.trim()||null,params:ae(w),routingPolicy:x.build()};return P.save([r.routingPolicy],f=>s?y.presets.update(s.id,r,f):y.presets.create(r,f))},onSuccess:r=>m(r),invalidate:[O.group("presets")],toast:"Preset saved"});return e.jsxs("form",{className:"gc-stack",onSubmit:r=>{r.preventDefault(),i.mutate()},children:[e.jsxs("div",{className:"gc-grid gc-grid--2",children:[e.jsx(j,{label:"Name",required:!0,value:o,onChange:r=>{g(r.target.value),t||d(D(r.target.value))}}),e.jsx(j,{label:"Slug",required:!0,value:l,onChange:r=>{q(!0),d(r.target.value)},hint:e.jsxs(e.Fragment,{children:["Called as ",e.jsxs("code",{children:["@preset/",l||"slug"]})]})})]}),e.jsxs("div",{className:"gc-grid gc-grid--2",children:[e.jsx(j,{label:"Model",required:!0,list:"gc-preset-models",value:h,onChange:r=>I(r.target.value)}),e.jsx("datalist",{id:"gc-preset-models",children:_(u.data).map(r=>e.jsx("option",{value:r},r))}),e.jsx(re,{label:"Available in",value:b,onChange:M,options:[{value:p.id,label:`${p.name} workspace`},...F(c)?[{value:"",label:"All workspaces"}]:[]]})]}),e.jsx(N,{label:"System prompt",rows:4,value:S,onChange:r=>T(r.target.value),hint:"Added before the client's messages."}),e.jsx(N,{label:"Parameters (JSON)",rows:4,mono:!0,value:w,placeholder:`{
2
2
  "temperature": 0.2,
3
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};
4
+ }`,onChange:r=>z(r.target.value),hint:"Defaults merged under the client's own parameters."}),e.jsx(ee,{draft:x.draft,setDraft:x.setDraft}),i.error?e.jsx(X,{error:i.error,title:"Could not save the preset"}):null,e.jsxs("div",{className:"gc-actions",children:[e.jsx(v,{variant:"ghost",onClick:()=>m(),children:"Cancel"}),e.jsx(v,{type:"submit",disabled:i.isPending||!o.trim()||!h.trim(),children:i.isPending?"Saving…":"Save preset"})]}),P.dialog]})}function je(){const{workspace:s,viewer:a}=A(),m=J(a),p=B(s.id),[c,u]=n.useState(null),[o,g]=n.useState(null),l=E({mutationFn:d=>y.presets.remove(d.id),onSuccess:()=>g(null),invalidate:[O.group("presets")]});return e.jsxs("div",{className:"gc-page",children:[e.jsx($,{title:"Presets",description:e.jsxs(e.Fragment,{children:["A saved model, prompt, parameters and routing. Use one by sending ",e.jsx("code",{children:'"model": "@preset/<slug>"'}),"."]}),actions:m&&e.jsx(v,{variant:"brand",leadingIcon:e.jsx(k.plus,{size:14}),onClick:()=>u("new"),children:"New preset"})}),e.jsx(L,{flush:!0,children:e.jsx(R,{query:p,children:d=>e.jsx(se,{label:"Presets",rows:d,rowKey:t=>t.id,rowLabel:t=>t.name,actions:t=>m&&(t.workspaceId||F(a))?[{label:"Edit",onSelect:()=>u(t)},{label:"Delete",tone:"danger",onSelect:()=>g(t)}]:[],empty:e.jsx(W,{icon:e.jsx(k.presets,{size:18}),title:"No presets yet",body:"Presets let every client share one tuned setup without changing code."}),columns:[{key:"name",header:"Name",render:t=>e.jsx("span",{className:"gc-strong",children:t.name})},{key:"usage",header:"Use as model",render:t=>e.jsxs("span",{className:"gc-inline gc-inline--wrap",children:[e.jsxs(Q,{children:["@preset/",t.slug]}),e.jsx(U,{value:`@preset/${t.slug}`})]})},{key:"model",header:"Model",secondary:!0,render:t=>t.model},{key:"scope",header:"Scope",secondary:!0,render:t=>t.workspaceId?e.jsx(C,{children:"Workspace"}):e.jsx(C,{tone:"info",children:"All workspaces"})},{key:"policy",header:"Routing",secondary:!0,optional:!0,render:t=>e.jsx("span",{className:"gc-muted",children:V(t.routingPolicy)})}]})})}),e.jsx(G,{isOpen:c!==null,onClose:()=>u(null),size:"lg",title:c==="new"?"New preset":"Edit preset",children:c!==null&&e.jsx(oe,{initial:c==="new"?null:c,onDone:()=>u(null)})}),e.jsx(H,{isOpen:o!==null,busy:l.isPending,error:l.error,onClose:()=>g(null),onConfirm:()=>o&&l.mutate(o),title:"Delete this preset?",confirmLabel:"Delete preset",body:e.jsxs(e.Fragment,{children:["Requests that use ",e.jsxs("code",{children:["@preset/",o==null?void 0:o.slug]})," will fail."]})})]})}export{oe as PresetForm,je as default};
@@ -0,0 +1 @@
1
+ import{bS as Ue,ag as me,aP as Ve,u as H,a as he,F as _e,G as ze,n as qe,i as ge,r as y,U as Ke,c as fe,e as Ge,bT as Qe,bm as Ye,$ as U,bU as He,bV as Je,f as q,an as We,j as s,C as we,af as K,o as pe,B as P,L as ye,A as Ze,w as A,M as be,av as ve,v as F,aa as Xe,bQ as I,ad as ke,ae as xe,h as je,Z as es,b0 as Pe,bW as Se,T as Ce,aZ as ss,b5 as ts,bX as as,Y as rs,a$ as ns,O as Ie,R as os,br as ls,b as is,b6 as cs,bY as ds,bu as us,E as re,I as ne,l as ms,Q as hs,bv as gs,b2 as oe,bZ as fs,y as le,b3 as ws,bL as ps,P as ys}from"./index-DPXW_JSn.js";import{p as G}from"./PeerPicker-CcMSXxY3.js";import{S as N}from"./SelectField-m1sMIgMa.js";import{V as $e,T as Ne}from"./VerificationLinks-CWyl6ZEp.js";import{P as Ae,a as bs,p as vs,S as ks}from"./SidePanel-BFQArkoa.js";import{c as xs}from"./PolicyEditor-COREmE0O.js";import{f as js}from"./ants-B38m9Phv.js";import{PresetForm as Ps}from"./Presets-DFKw93HK.js";import{T as Ss,a as Cs}from"./Tabs-CCabxVNK.js";import{D as Is}from"./DataTable-BCgVRqY6.js";import{S as Q}from"./Switch-Db8Sm64J.js";import"./Segmented-DYnoemT9.js";import"./roving-DkptacxO.js";import"./Disclosure-CQMtWM0M.js";import"./PolicyField-ldIq_Yw-.js";import"./TextAreaField-BCi-qMua.js";function Fe(e,t="admin"){return t==="owner"&&Ve(e)?"ownerRoutingPolicy":"routingPolicy"}async function Te(e,t){const r=(await e.keys.list({workspace:t.workspaceId})).find(n=>n.id===t.keyId);if(!r)throw new Error("That key no longer exists.");return r}async function Me(e,t){switch(t.kind){case"gateway":return e.network.gatewayPolicy();case"workspace-org":return(await e.workspaces.get(t.workspaceId)).orgRoutingPolicy;case"workspace":return(await e.workspaces.get(t.workspaceId)).routingPolicy;case"member":{const r=(await e.members.list()).find(n=>n.id===t.memberId);if(!r)throw new Error("That member no longer exists.");return r.routingPolicy}case"key":{const r=await Te(e,t);return r[Fe(r,t.layer)]??null}}}async function $s(e,t,r,n){const l=n!=null&&n.confirmEmpty||n!=null&&n.acceptNarrowed?[n]:[];switch(t.kind){case"gateway":await e.network.setGatewayPolicy(r??{},...l);return;case"workspace-org":await e.workspaces.update(t.workspaceId,{orgRoutingPolicy:r},...l);return;case"workspace":await e.workspaces.update(t.workspaceId,{routingPolicy:r},...l);return;case"member":await e.members.update(t.memberId,{routingPolicy:r},...l);return;case"key":{const o=t.layer==="owner"?Fe(await Te(e,t),"owner"):"routingPolicy";await e.keys.update(t.keyId,{[o]:r},...l);return}}}const ie=e=>JSON.stringify(e??{},Object.keys(e??{}).sort());async function Ns(e,t,r,n,l,o){const g=await Me(e,t),d=Ue(g,r,n,l),m=ie(g)!==ie(d)||JSON.stringify(g??{})!==JSON.stringify(d);return m&&await $s(e,t,d,o),{before:g,after:d,changed:m}}function As(e,t,r){return e.kind==="key"?{model:t,key:e.keyId,workspace:e.workspaceId}:e.kind==="member"?{model:t,member:e.memberId,workspace:r}:e.kind==="gateway"?{model:t,workspace:r}:{model:t,workspace:e.workspaceId}}const Fs={allow:"Allowed",block:"Blocked",prefer:"Preferred"};function Ts(e){const{action:t,name:r,scopeLabel:n,changed:l,model:o,preview:g,peerId:d}=e,m=Fs[t],k=t==="prefer"?`already first for ${o}`:`already ${m.toLowerCase()}`,h=l?`${m} ${r} ${t==="prefer"?`for ${o} `:""}on ${n}`:`${r} was ${k} on ${n}; nothing changed`;if(!g)return t==="block"?{tone:l?"success":"info",text:`${h}.`}:{tone:"info",text:`${h}. ${e.previewError?`Could not check whether it can serve: ${e.previewError}`:"Could not check whether it can serve."}`};const u=g.candidates.find(p=>me(p.peerId,d));if(t==="block")return u!=null&&u.eligible?{tone:"warning",text:`${h}, but the route preview still lists it as eligible for ${o}. Reload and check the policy.`}:{tone:l?"success":"info",text:`${h}.`};if(!g.modelAllowed)return{tone:"warning",text:`${h}, but ${o} is not an allowed model here, so it still cannot serve it.`};if(!u)return{tone:"info",text:`${h}. It does not offer ${o} right now, so the preview cannot show its rank.`};if(!u.eligible){const p=u.reasons.length?u.reasons.join("; "):"another level excludes it";return{tone:"warning",text:`${h}, but it still cannot serve ${o} here: ${p}.`}}return t==="prefer"&&u.rank!==null&&u.rank>1?{tone:"warning",text:`${h}, but it ranks #${u.rank} for ${o}: a fallback chain on another level comes first.`}:{tone:l?"success":"info",text:`${h}.${u.rank?` It ranks #${u.rank} for ${o}.`:""}`}}function Ms(e,t,r,n){return e==="gateway"?{kind:e}:e==="workspace"||e==="workspace-org"?{kind:e,workspaceId:r}:t?e==="member"?{kind:e,memberId:t}:{kind:"key",keyId:t,workspaceId:r,layer:n?"admin":"owner"}:null}function Ls(e){return e.canForce?"Not allowed above":e.tone==="warning"?"Check the result":"Done"}function Rs({fetching:e,error:t,ready:r,policy:n}){return e?s.jsx(ye,{rows:1}):t?s.jsx(pe,{error:t,title:"Could not load this scope's policy"}):r?s.jsxs("p",{className:"gc-muted",children:["Current policy: ",Ze(n)]}):null}const ce={allow:{title:"Allow seller",verb:"Allow"},block:{title:"Block seller",verb:"Block"},prefer:{title:"Prefer seller",verb:"Prefer"}};function Le({peer:e,action:t,onClose:r,peers:n}){var W,Z,X,ee;const{viewer:l,workspace:o,me:g}=H(),d=he(),m=_e(),k=ze(),h=qe(l),u=ge(l),p=[...h?[{value:"gateway",label:"Gateway default (everyone)"}]:[],...h?[{value:"workspace-org",label:`${o.name}: organization policy`}]:[],...u?[{value:"workspace",label:`${o.name}: workspace policy`}]:[],...h?[{value:"member",label:"A member"}]:[],{value:"key",label:"An API key"}],[w,$]=y.useState(p[0].value),[i,a]=y.useState(""),[b,R]=y.useState(""),B=Ke(w==="member"),E=fe(d,w==="key");y.useEffect(()=>{a("")},[w]),y.useEffect(()=>{var c;R(((c=e==null?void 0:e.services[0])==null?void 0:c.service)??"")},[e]);const f=(E.data??[]).filter(c=>c.status==="active"&&(u||c.ownerMemberId===g.member.id)),v=Ms(w,i,o.id,u),[S,M]=y.useState(null);y.useEffect(()=>{M(null)},[w,i,e]);const O=Ge({queryKey:["routing","scope-policy",v],queryFn:()=>Me(q,v),enabled:v!==null&&e!==null,staleTime:0}),D=v!==null&&O.isSuccess&&(t!=="prefer"||b!==""),C=O.data??null,Ee=t==="allow"&&D&&!(C!=null&&C.allowedPeerIds)&&!(C!=null&&C.allowedPeerLists),Oe=t==="block"&&D&&e!==null&&Qe(C,e.peerId);let L=((W=p.find(c=>c.value===w))==null?void 0:W.label.replace(/^A[n]? /,"the "))??"this scope";w==="key"&&(L=`key “${((Z=f.find(c=>c.id===i))==null?void 0:Z.label)??i}”`),w==="member"&&(L=`member “${((ee=(X=B.data)==null?void 0:X.find(c=>c.id===i))==null?void 0:ee.label)??i}”`);const x=Ye({mutationFn:async(c={})=>{var ae;if(!e||!v)return null;const j=b||((ae=e.services[0])==null?void 0:ae.service)||"",{changed:z}=await Ns(q,v,t,e.peerId,b||void 0,c);let se=null,te=null;if(j)try{se=await q.network.routePreview(As(v,j,o.id))}catch(De){te=We(De)}return Ts({action:t,name:G(n,e.peerId),scopeLabel:L,changed:z,model:j,preview:se,peerId:e.peerId,previewError:te})},onSuccess:c=>{for(const j of Je)m.invalidateQueries({queryKey:[j]});c&&(c.tone==="success"?(k(c.text),r()):M(c))},onError:c=>{const j=e?G(n,e.peerId):"this seller";if(U(c,"narrowed"))M({tone:"warning",canForce:!0,text:`Nothing changed yet. The levels above ${L} do not allow ${j}, so saving this would not let it serve. ${He(c.details).join(" ")}`.trim()});else if(U(c,"empty_allow_list")){const z=t==="block"?`Blocking ${j}`:`Allowing only ${j}`;M({tone:"warning",text:`Nothing changed. ${z} on ${L} would leave no seller that the levels above allow, so requests would fail. Change the policy on the Routing page if you really want that.`})}}}),_=e?G(n,e.peerId):"";return s.jsx(we,{isOpen:e!==null,onClose:r,title:ce[t].title,subtitle:_,children:s.jsxs("div",{className:"gc-stack",children:[s.jsx(N,{label:"Apply to",value:w,onChange:c=>$(c),options:p}),w==="member"&&s.jsx(N,{label:"Member",value:i,onChange:a,options:[{value:"",label:"Choose a member"},...(B.data??[]).filter(c=>c.status!=="disabled").map(c=>({value:c.id,label:c.label}))]}),w==="key"&&s.jsx(N,{label:"Key",value:i,onChange:a,options:[{value:"",label:f.length?"Choose a key":"No keys you can edit"},...f.map(c=>({value:c.id,label:c.label}))]}),t==="prefer"&&e&&s.jsx(N,{label:"For model",value:b,onChange:R,options:e.services.map(c=>({value:c.service,label:c.service})),hint:"The seller goes first in this model's fallback chain."}),s.jsx(Rs,{fetching:O.isFetching,error:O.error,ready:D,policy:C}),Ee&&s.jsxs(K,{tone:"warning",children:["This scope has no allow list yet. Allowing ",_," creates one, so only allowed sellers can serve it."]}),Oe&&s.jsxs(K,{tone:"warning",title:"This is the only allowed seller",children:["Blocking ",_," empties this scope's allow list, so the allow list is removed: any seller that is not blocked may serve it again."]}),t==="block"&&s.jsx("p",{className:"gc-muted",children:"Blocked sellers never serve this scope or anything under it."}),w==="key"&&!u&&s.jsx("p",{className:"gc-muted",children:"This changes your own restrictions on the key. Restrictions a workspace admin set still apply."}),x.error&&!U(x.error,"narrowed")&&!U(x.error,"empty_allow_list")?s.jsx(pe,{error:x.error,title:"Could not update the policy"}):null,S?s.jsxs(s.Fragment,{children:[s.jsx(K,{tone:S.tone,title:Ls(S),children:S.text}),s.jsxs("div",{className:"gc-actions",children:[S.canForce&&s.jsx(P,{variant:"ghost",disabled:x.isPending,onClick:()=>{M(null),x.mutate({acceptNarrowed:!0})},children:"Save it anyway"}),s.jsx(P,{onClick:r,children:S.canForce?"Cancel":"Done"})]})]}):s.jsxs("div",{className:"gc-actions",children:[s.jsx(P,{variant:"ghost",onClick:r,children:"Cancel"}),s.jsx(P,{variant:t==="block"?"danger":"primary",disabled:!D||x.isPending,onClick:()=>x.mutate({}),children:x.isPending?"Saving…":ce[t].verb})]})]})})}function Re(e,t){return t?e.services.filter(r=>r.service===t):e.services}function V(e,t,r=""){const n=Re(e,r).map(l=>l[t]).filter(l=>l!==null);return n.length?{min:Math.min(...n),max:Math.max(...n)}:null}function Bs(e,t=""){var r;return((r=V(e,"inputUsdPerMillion",t))==null?void 0:r.min)??null}function Es(e,t=""){var r;return((r=V(e,"outputUsdPerMillion",t))==null?void 0:r.min)??null}function J(e,t=""){return Re(e,t).some(r=>r.inputUsdPerMillion===0&&(r.outputUsdPerMillion??0)===0)}function Os(e,t){const r=t.search.trim().toLowerCase();return e.filter(n=>{var l;return!(r&&!n.peerId.toLowerCase().includes(r)&&!(n.displayName??"").toLowerCase().includes(r)&&!n.services.some(o=>o.service.toLowerCase().includes(r))||t.model&&!n.services.some(o=>o.service===t.model)||t.tee&&!n.tee||t.linked&&!((l=n.verificationLinks)!=null&&l.length)||t.free&&!J(n,t.model))})}const Be={"openai-chat-completions":"Chat completions","openai-responses":"Responses","anthropic-messages":"Messages","openai-images":"Images"};function de(e){return e===null?"—":String(Math.round(e))}function Y(e){return e.displayName??A(e.peerId,8,4)}function T(e){return`${e.provider}:${e.service}`}function Ds({peer:e}){const t=(e.health.coolingDownUntil??0)>Date.now();return s.jsxs("span",{className:"gc-seller__meta",children:[s.jsxs("span",{className:"gc-peer-id",children:[s.jsx(be,{title:e.peerId,children:A(e.peerId,6,4)}),s.jsx(ve,{iconOnly:!0,value:e.peerId,label:"Copy peer id"})]}),s.jsx($e,{links:e.verificationLinks}),s.jsx(Ne,{tee:e.tee,scope:e.teeScope}),J(e,"")&&s.jsx(F,{tone:"success",children:"Free"}),e.washFlagged&&s.jsx(F,{tone:"danger",children:"Flagged"}),t&&s.jsx(F,{tone:"warning",children:"Cooling down"}),s.jsxs("span",{className:"gc-muted",children:["Last seen ",Xe(e.lastSeen)]})]})}function Us({peer:e,showReputation:t}){const r=(e.health.coolingDownUntil??0)>Date.now();return s.jsxs("div",{className:"gc-grid gc-grid--2 gc-figures gc-panel-figures",children:[s.jsx(I,{label:"Trust score",value:de(e.trustScore)}),t&&s.jsx(I,{label:"Reputation",value:de(e.reputationScore)}),s.jsx(I,{label:"Stake",value:e.stakeAnts?js(e.stakeAnts):"—"}),s.jsx(I,{label:"Network usage share",value:e.usageShareBps===null?"—":`${(e.usageShareBps/100).toFixed(2)}%`}),s.jsx(I,{label:"First token p50 (this gateway)",value:ke(e.firstTokenMsP50)}),s.jsx(I,{label:"Speed p50 (this gateway)",value:xe(e.tokensPerSecondP50)}),s.jsx(I,{label:"Requests, 24h (this gateway)",value:je(e.requests24h)}),s.jsx(I,{label:"Failure streak",value:r?`${e.health.failureStreak}, cooling down until ${es(e.health.coolingDownUntil)}`:String(e.health.failureStreak)})]})}function Vs({peer:e,selected:t,onSelect:r}){const[n,l]=y.useState(""),o=n.trim().toLowerCase(),g=e.services.filter(d=>!o||d.service.toLowerCase().includes(o));return s.jsx(Ae,{title:`Models (${e.services.length})`,actions:e.services.length>6&&s.jsx(Ce,{size:"sm",type:"search","aria-label":"Search this provider's models",placeholder:"Search models",value:n,onChange:d=>l(d.target.value)}),children:g.length===0?s.jsx("p",{className:"gc-fineprint",children:o?"No models match.":"This provider lists no models."}):s.jsx("ul",{className:"gc-panel-rows","aria-label":"Models and prices",children:g.map(d=>{const m=t!==null&&T(t)===T(d);return s.jsx(bs,{selected:m,title:s.jsx("span",{className:"gc-strong",children:d.service}),meta:s.jsxs(s.Fragment,{children:[s.jsx("span",{children:vs(d)}),s.jsx("span",{children:Be[Se(d)]})]}),actions:s.jsxs(s.Fragment,{children:[s.jsx(ve,{iconOnly:!0,value:Pe(e.peerId,d.service),label:`Copy ${d.service} pinned to this provider (peer@model)`}),s.jsx(P,{size:"sm",variant:m?"outline":"ghost","aria-pressed":m,title:"Show the API call for this model",onClick:()=>r(d),children:"API call"})]})},T(d))})})})}function _s({peer:e,service:t,onSelect:r}){var E;const{workspace:n,viewer:l}=H(),o=he(),g=ss(),d=fe(o),m=ts(n.id),[k,h]=y.useState("curl"),[u,p]=y.useState(!1),w=Se(t),$=Pe(e.peerId,t.service),i=((E=m.data)==null?void 0:E.find(f=>f.model===$))??null,a=as(g,e.peerId,t.service,w,i?`@preset/${i.slug}`:null),b=a.find(f=>f.id===k)??a[0],R=(d.data??[]).some(f=>f.status==="active"),B=ge(l);return s.jsxs(Ae,{title:"API call",actions:e.services.length>1&&s.jsx(N,{size:"sm","aria-label":"Model",value:T(t),onChange:f=>{const v=e.services.find(S=>T(S)===f);v&&r(v)},options:e.services.map(f=>({value:T(f),label:f.service}))}),children:[s.jsxs("p",{className:"gc-fineprint",children:["Pinned to this provider with ",s.jsx("code",{children:A($,10,12)}),"."]}),s.jsx(Ss,{id:"gc-connect",label:"Ways to connect",value:b.id,onChange:h,className:"gc-connect-tabs",tabs:a.map(f=>({id:f.id,label:f.label}))}),s.jsxs(Cs,{tabsId:"gc-connect",tab:b.id,className:"gc-stack",children:[b.id==="codex"&&s.jsxs("div",{className:"gc-summary-row",children:[s.jsx("p",{className:"gc-fineprint gc-summary-row__text",children:i?s.jsxs(s.Fragment,{children:["Uses the preset ",s.jsxs("code",{children:["@preset/",i.slug]})," for this model. Codex needs a preset: with a raw GPT model name it switches to a tool format some sellers drop."]}):s.jsx(s.Fragment,{children:"Codex needs a preset, not a raw model name: with a GPT model name it switches to a tool format some sellers drop. Create one for this model, then use its slug."})}),!i&&B&&s.jsx(P,{size:"sm",variant:"outline",onClick:()=>p(!0),children:"Create preset for this model"})]}),b.id==="claude-code"&&w!=="anthropic-messages"&&s.jsxs("p",{className:"gc-fineprint",children:["This model speaks ",Be[w],"; the gateway translates Claude Code's requests for it."]}),s.jsx(rs,{code:b.code,label:`${t.service} · ${b.label}`})]}),s.jsxs("p",{className:"gc-fineprint",children:["Set ",s.jsx("code",{children:ns})," to one of your API keys first."," ",d.data&&!R&&s.jsx(Ie,{to:"keys",children:"Create an API key"})]}),s.jsx(we,{isOpen:u,onClose:()=>p(!1),size:"lg",title:"New preset",children:u&&s.jsx(Ps,{initial:null,prefill:{name:t.service,model:$},onDone:f=>{p(!1),f&&h("codex")}})})]})}function zs({peer:e,peers:t,showReputation:r}){const[n,l]=y.useState(null),[o,g]=y.useState(null),d=y.useRef(null),m=o??e.services[0]??null,k=h=>{var u;g(h),(u=d.current)==null||u.scrollIntoView({behavior:"smooth",block:"start"})};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"gc-stack",children:[s.jsx(Ds,{peer:e}),s.jsxs("div",{className:"gc-panel-actions",children:[s.jsx(P,{size:"sm",variant:"outline",onClick:()=>l("allow"),children:"Allow"}),s.jsx(P,{size:"sm",variant:"outline",onClick:()=>l("prefer"),children:"Prefer"}),s.jsx(P,{size:"sm",variant:"danger",onClick:()=>l("block"),children:"Block"})]}),s.jsx(Us,{peer:e,showReputation:r})]}),s.jsx(Vs,{peer:e,selected:m,onSelect:k}),m&&s.jsx("div",{ref:d,className:"gc-scroll-target",children:s.jsx(_s,{peer:e,service:m,onSelect:g})}),n&&s.jsx(Le,{peer:e,action:n,peers:t,onClose:()=>l(null)})]})}function ue(e){return e===null?"—":String(Math.round(e))}function qs({peer:e,model:t}){const r=(e.health.coolingDownUntil??0)>Date.now();return s.jsxs("div",{className:"gc-badges",children:[s.jsx(Ne,{tee:e.tee,scope:e.teeScope}),J(e,t)&&s.jsx(F,{tone:"success",children:"Free"}),e.washFlagged&&s.jsx(F,{tone:"danger",children:"Flagged"}),r&&s.jsx(F,{tone:"warning",children:"Cooling down"})]})}function lt(){const{viewer:e}=H(),t=os(),r=ls(t.rest),n=is(),l=y.useMemo(()=>{var i;return r?((i=n.data)==null?void 0:i.find(a=>me(a.peerId,r)))??null:null},[n.data,r]),[o,g]=y.useState({search:"",model:"",tee:!1,linked:!1,free:!1}),[d,m]=y.useState(null),k=y.useMemo(()=>cs(n.data),[n.data]),h=ds(n.data),u=us(),p=(i,a)=>g(b=>({...b,[i]:a})),w=r===null?null:{eyebrow:"Provider",title:l?Y(l):A(r,8,6),body:n.isLoading?s.jsx(ye,{rows:6}):l?s.jsx(zs,{peer:l,peers:n.data,showReputation:h},l.peerId):s.jsx(re,{icon:s.jsx(ne.providers,{size:18}),title:"Provider not found",body:`This gateway does not see ${A(r,8,6)} right now.`})},$=s.jsxs("div",{className:"gc-page",children:[s.jsx(ms,{flush:!0,children:s.jsx(hs,{query:n,rows:8,children:i=>s.jsx(Is,{label:"Providers",rows:Os(i,o),rowKey:a=>a.peerId,selectedKey:(l==null?void 0:l.peerId)??null,onRowClick:a=>le(ws("providers",a.peerId)),rowLabel:a=>Y(a),actions:a=>[o.model!==""&&fs(u,a.peerId,o.model),{label:"Allow…",onSelect:()=>m({peer:a,kind:"allow"})},{label:"Prefer…",onSelect:()=>m({peer:a,kind:"prefer"})},{label:"Block…",tone:"danger",onSelect:()=>m({peer:a,kind:"block"})}],initialSort:{key:"trust",direction:"desc"},empty:s.jsx(re,{icon:s.jsx(ne.providers,{size:18}),title:i.length?"No providers match these filters":"No providers found yet",body:i.length?void 0:"The buyer is still discovering the network. Check back in a minute."}),columns:[{key:"name",header:"Provider",sortValue:a=>a.displayName??a.peerId,render:a=>s.jsxs("div",{className:"gc-cell-lines",children:[s.jsx("div",{className:"gc-strong gc-ellipsis",title:a.displayName??a.peerId,children:Y(a)}),a.displayName&&s.jsx("div",{className:"gc-muted gc-ellipsis",children:s.jsx(be,{title:a.peerId,children:A(a.peerId,6,4)})}),s.jsx(qs,{peer:a,model:o.model})]}),after:a=>s.jsx(gs,{value:a.peerId,label:`Copy peer id ${a.peerId}`})},{key:"identity",header:"Domain / GitHub",secondary:!0,render:a=>{var b;return(b=a.verificationLinks)!=null&&b.length?s.jsx($e,{links:a.verificationLinks}):s.jsx("span",{className:"gc-muted",children:"—"})}},{key:"models",header:"Models",secondary:!0,optional:!0,render:a=>s.jsx("span",{className:"gc-muted",children:a.services.length})},{key:"input",header:"Input $/M",align:"right",sortValue:a=>Bs(a,o.model),render:a=>oe(V(a,"inputUsdPerMillion",o.model))},{key:"output",header:"Output $/M",align:"right",secondary:!0,sortValue:a=>Es(a,o.model),render:a=>oe(V(a,"outputUsdPerMillion",o.model))},{key:"trust",header:"Trust",align:"right",sortValue:a=>a.trustScore,render:a=>ue(a.trustScore)},...h?[{key:"reputation",header:"Reputation",align:"right",secondary:!0,optional:!0,sortValue:a=>a.reputationScore,render:a=>ue(a.reputationScore)}]:[],{key:"firstToken",header:"First token",align:"right",secondary:!0,optional:!0,sortValue:a=>a.firstTokenMsP50,render:a=>ke(a.firstTokenMsP50)},{key:"speed",header:"Speed",align:"right",secondary:!0,optional:!0,sortValue:a=>a.tokensPerSecondP50,render:a=>xe(a.tokensPerSecondP50)},{key:"usage",header:"Your 24h",align:"right",secondary:!0,sortValue:a=>a.requests24h,render:a=>je(a.requests24h)}]})})}),s.jsxs("p",{className:"gc-fineprint",children:["Seller lists group sellers that routing rules allow or block together:"," ",ps("routing",e)?s.jsx(Ie,{to:"routing",children:"Routing → Seller lists"}):s.jsx(xs,{peers:n.data,label:"See seller lists"}),"."]})]});return s.jsxs("div",{className:"gc-page",children:[s.jsx(ys,{title:"Providers",description:"Providers on the network this gateway can route to. Open one to copy its models and an API call, or allow, block or prefer it for any scope."}),s.jsxs("div",{className:"gc-toolbar",children:[s.jsx(Ce,{size:"sm",type:"search","aria-label":"Search providers",placeholder:"Search name, peer id or model",value:o.search,onChange:i=>p("search",i.target.value)}),s.jsx(N,{size:"sm","aria-label":"Filter by model",value:o.model,onChange:i=>p("model",i),options:[{value:"",label:"All models"},...k.map(i=>({value:i,label:i}))]}),s.jsx(Q,{checked:o.linked,onChange:i=>p("linked",i),label:"Domain or GitHub"}),s.jsx(Q,{checked:o.tee,onChange:i=>p("tee",i),label:"TEE"}),s.jsx(Q,{checked:o.free,onChange:i=>p("free",i),label:"Free"})]}),s.jsx(ks,{list:$,panel:w,onClose:()=>le("providers"),closeLabel:"Close provider"}),d&&s.jsx(Le,{peer:d.peer,action:d.kind,peers:n.data,onClose:()=>m(null)})]})}export{lt as default};
@@ -1 +1 @@
1
- import{r as w,j as e,L as j,o as y,Z as x,aw as c,ax as k,h as i,E as M,I,B as A,W as C,f as N,q,v as d,b as v,M as l,g as u,e as L,$ as D,ah as E,X as $,Y as O}from"./index-cESr4Zze.js";import{u as K}from"./useInfiniteQuery-zD1WIYBy.js";import{p as S}from"./PeerPicker-CfsXTUyK.js";import{f as g,h as W}from"./usage-8BBeTlF-.js";import{h as _,p as z,s as J}from"./selection-HN8SZ52c.js";import{D as Q}from"./DataTable-BkJdorEh.js";const U=50;function h(s){return s===null?e.jsx(d,{tone:"info",children:"In flight"}):s<400?e.jsx(d,{tone:"success",children:s}):s<500?e.jsx(d,{tone:"warning",children:s}):e.jsx(d,{tone:"danger",children:s})}function b({entry:s}){const n=g(s,Date.now());return n==="video-charged"?e.jsx("span",{className:"gc-muted",title:"Charged on the request that downloaded this video",children:u(s.video.charged)}):n==="on-delivery"?e.jsx("span",{className:"gc-muted",title:"A video is charged when its finished file is downloaded",children:"on delivery"}):n==="not-charged"?e.jsx("span",{className:"gc-muted",title:"A video status check is not charged",children:"—"}):n==="free"?e.jsx("span",{className:"gc-muted",title:"Served by a free seller: $0",children:"Free"}):n==="pending"?e.jsx("span",{className:"gc-muted",title:"The buyer reports spend a moment after the response",children:"pending"}):n==="not-recorded"?e.jsx("span",{className:"gc-muted",title:"No spend was reported for this request: the buyer lost it",children:"not recorded"}):e.jsx(e.Fragment,{children:u(s.spent)})}function R({peerId:s,full:n=!1}){const t=v(),o=S(t.data,s);return n?e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsx("span",{children:o}),e.jsx(l,{children:s})]}):e.jsx("span",{className:"gc-ellipsis",title:s,children:o})}function T({entry:s}){return s.servedModel?e.jsxs(e.Fragment,{children:[s.model??"—"," ",e.jsxs("span",{className:"gc-muted",children:["→ ",s.servedModel]})]}):e.jsx(e.Fragment,{children:s.model??"—"})}function Z(s){const n=s.model??"Request";return s.servedModel?`${n} → ${s.servedModel}`:n}function G({router:s,status:n}){const t=v();return e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsx("span",{children:S(t.data,s.peerId)}),e.jsx(l,{children:s.peerId}),e.jsxs("span",{className:"gc-muted",children:[s.service?`${s.service} · `:"",W(s.rank,n)]})]})}function V({entry:s}){if(s.routingSpent)return e.jsx(e.Fragment,{children:u(s.routingSpent)});const n=g(s,Date.now());return n==="pending"?e.jsx("span",{className:"gc-muted",children:"pending"}):n==="spent"||n==="free"?e.jsx("span",{className:"gc-muted",title:"The router reported no charge for this ranking",children:"Free"}):e.jsx("span",{className:"gc-muted",children:"—"})}function X(s){try{return JSON.stringify(JSON.parse(s),null,2)}catch{return s}}function f({title:s,body:n}){return e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsx("div",{className:"as-field__label",children:s}),e.jsx(O,{code:X(n)})]})}function Y({detail:s}){return!s.requestBody&&!s.responseBody?e.jsx("p",{className:"gc-fineprint",children:"Bodies are not stored for this request. Turn on content logging under Settings → Observability to keep them."}):e.jsxs(e.Fragment,{children:[s.requestBody&&e.jsx(f,{title:"Request body",body:s.requestBody}),s.responseBody&&e.jsx(f,{title:"Response body",body:s.responseBody})]})}function H({selection:s,at:n}){const t=_(s,n);return e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsx("span",{children:z(s)}),e.jsxs("span",{className:"gc-muted",children:["At the time: ",J(s).join(" · ")]}),t&&e.jsx("span",{className:"gc-muted",children:t})]})}function ee({entry:s}){const n=L({queryKey:q.request(s.tag),queryFn:()=>N.usage.request(s.tag),retry:!1,staleTime:6e4}),t=n.data??s,o=D(n.error)&&n.error.status===404;return e.jsxs(e.Fragment,{children:[t.errorCode||t.errorMessage?e.jsx(E,{tone:"danger",title:t.errorCode??"Request failed",children:t.errorMessage??"No message was returned."}):null,e.jsx($,{items:[["Status",h(t.status)],["Request",e.jsxs(l,{children:[t.method," ",t.path]},"p")],["Model",e.jsx(T,{entry:t},"m")],["Key",t.keyLabel],["End user",t.endUser??"—"],...t.router?[["Router",e.jsx(G,{router:t.router,status:t.status},"r")]]:[],["Seller",t.sellerPeerId?e.jsx(R,{peerId:t.sellerPeerId,full:!0},"s"):"—"],...t.routeSelection?[["Why this seller",e.jsx(H,{selection:t.routeSelection,at:t.startedAt},"w")]]:[],["First token",c(t.firstTokenMs)],["Speed",k(t.tokensPerSecond)],["Duration",t.finishedAt?c(t.finishedAt-t.startedAt):"—"],["Input tokens",i(t.inputTokens)],["Cached input",i(t.cachedInputTokens)],["Output tokens",i(t.outputTokens)],["Cost",e.jsx(b,{entry:t},"c")],...t.router?[["Routing fee",e.jsx(V,{entry:t},"f")]]:[],["Tag",e.jsx(l,{children:t.tag},"t")]]}),n.isLoading&&e.jsx(j,{rows:2}),n.error&&!o?e.jsx(y,{error:n.error,title:"Could not load the bodies"}):null,n.data&&e.jsx(Y,{detail:n.data})]})}function ie({filter:s,showKey:n=!0}){var m;const[t,o]=w.useState(null),a=K({queryKey:q.requests(s),queryFn:({pageParam:r})=>N.usage.requests({...s,before:r??void 0,limit:U}),initialPageParam:null,getNextPageParam:r=>r.nextBefore,refetchInterval:r=>{var p;return(p=r.state.data)!=null&&p.pages.some(F=>F.requests.some(P=>g(P,Date.now())==="pending"))?5e3:!1}});if(a.isLoading)return e.jsx(j,{rows:8});if(a.error)return e.jsx(y,{error:a.error,onRetry:()=>void a.refetch()});const B=((m=a.data)==null?void 0:m.pages.flatMap(r=>r.requests))??[];return e.jsxs(e.Fragment,{children:[e.jsx(Q,{label:"Request log",rows:B,rowKey:r=>r.tag,onRowClick:o,rowLabel:r=>`request ${r.tag}`,empty:e.jsx(M,{icon:e.jsx(I.logs,{size:18}),title:"No requests found",body:"Requests appear here as soon as a key is used. Check the filters if you expected some."}),columns:[{key:"time",header:"Time",render:r=>e.jsx("span",{className:"gc-nowrap",children:x(r.startedAt)})},...n?[{key:"key",header:"Key",secondary:!0,render:r=>r.keyLabel}]:[],{key:"model",header:"Model",render:r=>e.jsxs("span",{className:"gc-ellipsis",children:[r.model?e.jsx(T,{entry:r}):e.jsxs("span",{className:"gc-muted",children:[r.method," ",r.path]}),r.status!==null&&r.status>=400?e.jsxs("span",{className:"gc-narrow-only",children:[" ",h(r.status)]}):null]})},{key:"seller",header:"Seller",render:r=>r.sellerPeerId?e.jsx(R,{peerId:r.sellerPeerId}):"—"},{key:"status",header:"Status",secondary:!0,render:r=>e.jsx("span",{title:r.errorMessage??void 0,children:h(r.status)})},{key:"firstToken",header:"First token",align:"right",secondary:!0,optional:!0,render:r=>c(r.firstTokenMs)},{key:"speed",header:"Speed",align:"right",secondary:!0,optional:!0,render:r=>k(r.tokensPerSecond)},{key:"tokens",header:"Tokens",align:"right",secondary:!0,render:r=>`${i(r.inputTokens)} → ${i(r.outputTokens)}`},{key:"cost",header:"Cost",align:"right",render:r=>e.jsx(b,{entry:r})}]}),a.hasNextPage&&e.jsx("div",{className:"gc-load-more",children:e.jsx(A,{variant:"outline",size:"sm",disabled:a.isFetchingNextPage,onClick:()=>void a.fetchNextPage(),children:a.isFetchingNextPage?"Loading…":"Load older requests"})}),e.jsx(C,{isOpen:t!==null,onClose:()=>o(null),title:t?Z(t):"Request",subtitle:t?x(t.startedAt):void 0,eyebrow:"Request",children:t&&e.jsx(ee,{entry:t},t.tag)})]})}export{ie as R};
1
+ import{r as M,j as e,L as j,o as y,Z as f,ad as c,ae as k,h as i,E as w,I,B as A,W as C,f as N,q,v as d,b as v,M as l,g as u,e as L,$ as D,af as E,X as $,Y as O}from"./index-DPXW_JSn.js";import{u as K}from"./useInfiniteQuery-CAj47QRO.js";import{p as S}from"./PeerPicker-CcMSXxY3.js";import{f as g,h as W}from"./usage-DQGKL0DJ.js";import{h as _,p as z,s as J}from"./selection-BV37SUs_.js";import{D as Q}from"./DataTable-BCgVRqY6.js";const U=50;function h(s){return s===null?e.jsx(d,{tone:"info",children:"In flight"}):s<400?e.jsx(d,{tone:"success",children:s}):s<500?e.jsx(d,{tone:"warning",children:s}):e.jsx(d,{tone:"danger",children:s})}function b({entry:s}){const n=g(s,Date.now());return n==="video-charged"?e.jsx("span",{className:"gc-muted",title:"Charged on the request that downloaded this video",children:u(s.video.charged)}):n==="on-delivery"?e.jsx("span",{className:"gc-muted",title:"A video is charged when its finished file is downloaded",children:"on delivery"}):n==="not-charged"?e.jsx("span",{className:"gc-muted",title:"A video status check is not charged",children:"—"}):n==="free"?e.jsx("span",{className:"gc-muted",title:"Served by a free seller: $0",children:"Free"}):n==="pending"?e.jsx("span",{className:"gc-muted",title:"The buyer reports spend a moment after the response",children:"pending"}):n==="not-recorded"?e.jsx("span",{className:"gc-muted",title:"No spend was reported for this request: the buyer lost it",children:"not recorded"}):e.jsx(e.Fragment,{children:u(s.spent)})}function R({peerId:s,full:n=!1}){const t=v(),o=S(t.data,s);return n?e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsx("span",{children:o}),e.jsx(l,{children:s})]}):e.jsx("span",{className:"gc-ellipsis",title:s,children:o})}function T({entry:s}){return s.servedModel?e.jsxs(e.Fragment,{children:[s.model??"—"," ",e.jsxs("span",{className:"gc-muted",children:["→ ",s.servedModel]})]}):e.jsx(e.Fragment,{children:s.model??"—"})}function Z(s){const n=s.model??"Request";return s.servedModel?`${n} → ${s.servedModel}`:n}function G({router:s,status:n}){const t=v();return e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsx("span",{children:S(t.data,s.peerId)}),e.jsx(l,{children:s.peerId}),e.jsxs("span",{className:"gc-muted",children:[s.service?`${s.service} · `:"",W(s.rank,n)]})]})}function V({entry:s}){if(s.routingSpent)return e.jsx(e.Fragment,{children:u(s.routingSpent)});const n=g(s,Date.now());return n==="pending"?e.jsx("span",{className:"gc-muted",children:"pending"}):n==="spent"||n==="free"?e.jsx("span",{className:"gc-muted",title:"The router reported no charge for this ranking",children:"Free"}):e.jsx("span",{className:"gc-muted",children:"—"})}function X(s){try{return JSON.stringify(JSON.parse(s),null,2)}catch{return s}}function x({title:s,body:n}){return e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsx("div",{className:"as-field__label",children:s}),e.jsx(O,{code:X(n)})]})}function Y({detail:s}){return!s.requestBody&&!s.responseBody?e.jsx("p",{className:"gc-fineprint",children:"Bodies are not stored for this request. Turn on content logging under Settings → Observability to keep them."}):e.jsxs(e.Fragment,{children:[s.requestBody&&e.jsx(x,{title:"Request body",body:s.requestBody}),s.responseBody&&e.jsx(x,{title:"Response body",body:s.responseBody})]})}function H({selection:s,at:n}){const t=_(s,n);return e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsx("span",{children:z(s)}),e.jsxs("span",{className:"gc-muted",children:["At the time: ",J(s).join(" · ")]}),t&&e.jsx("span",{className:"gc-muted",children:t})]})}function ee({entry:s}){const n=L({queryKey:q.request(s.tag),queryFn:()=>N.usage.request(s.tag),retry:!1,staleTime:6e4}),t=n.data??s,o=D(n.error)&&n.error.status===404;return e.jsxs(e.Fragment,{children:[t.errorCode||t.errorMessage?e.jsx(E,{tone:"danger",title:t.errorCode??"Request failed",children:t.errorMessage??"No message was returned."}):null,e.jsx($,{items:[["Status",h(t.status)],["Request",e.jsxs(l,{children:[t.method," ",t.path]},"p")],["Model",e.jsx(T,{entry:t},"m")],["Key",t.keyLabel],["End user",t.endUser??"—"],...t.router?[["Router",e.jsx(G,{router:t.router,status:t.status},"r")]]:[],["Seller",t.sellerPeerId?e.jsx(R,{peerId:t.sellerPeerId,full:!0},"s"):"—"],...t.routeSelection?[["Why this seller",e.jsx(H,{selection:t.routeSelection,at:t.startedAt},"w")]]:[],["First token",c(t.firstTokenMs)],["Speed",k(t.tokensPerSecond)],["Duration",t.finishedAt?c(t.finishedAt-t.startedAt):"—"],["Input tokens",i(t.inputTokens)],["Cached input",i(t.cachedInputTokens)],["Output tokens",i(t.outputTokens)],["Cost",e.jsx(b,{entry:t},"c")],...t.router?[["Routing fee",e.jsx(V,{entry:t},"f")]]:[],["Tag",e.jsx(l,{children:t.tag},"t")]]}),n.isLoading&&e.jsx(j,{rows:2}),n.error&&!o?e.jsx(y,{error:n.error,title:"Could not load the bodies"}):null,n.data&&e.jsx(Y,{detail:n.data})]})}function ie({filter:s,showKey:n=!0}){var m;const[t,o]=M.useState(null),a=K({queryKey:q.requests(s),queryFn:({pageParam:r})=>N.usage.requests({...s,before:r??void 0,limit:U}),initialPageParam:null,getNextPageParam:r=>r.nextBefore,refetchInterval:r=>{var p;return(p=r.state.data)!=null&&p.pages.some(F=>F.requests.some(P=>g(P,Date.now())==="pending"))?5e3:!1}});if(a.isLoading)return e.jsx(j,{rows:8});if(a.error)return e.jsx(y,{error:a.error,onRetry:()=>void a.refetch()});const B=((m=a.data)==null?void 0:m.pages.flatMap(r=>r.requests))??[];return e.jsxs(e.Fragment,{children:[e.jsx(Q,{label:"Request log",rows:B,rowKey:r=>r.tag,onRowClick:o,rowLabel:r=>`request ${r.tag}`,empty:e.jsx(w,{icon:e.jsx(I.logs,{size:18}),title:"No requests found",body:"Requests appear here as soon as a key is used. Check the filters if you expected some."}),columns:[{key:"time",header:"Time",render:r=>e.jsx("span",{className:"gc-nowrap",children:f(r.startedAt)})},...n?[{key:"key",header:"Key",secondary:!0,render:r=>r.keyLabel}]:[],{key:"model",header:"Model",render:r=>e.jsxs("span",{className:"gc-ellipsis",children:[r.model?e.jsx(T,{entry:r}):e.jsxs("span",{className:"gc-muted",children:[r.method," ",r.path]}),r.status!==null&&r.status>=400?e.jsxs("span",{className:"gc-narrow-only",children:[" ",h(r.status)]}):null]})},{key:"seller",header:"Seller",render:r=>r.sellerPeerId?e.jsx(R,{peerId:r.sellerPeerId}):"—"},{key:"status",header:"Status",secondary:!0,render:r=>e.jsx("span",{title:r.errorMessage??void 0,children:h(r.status)})},{key:"firstToken",header:"First token",align:"right",secondary:!0,optional:!0,render:r=>c(r.firstTokenMs)},{key:"speed",header:"Speed",align:"right",secondary:!0,optional:!0,render:r=>k(r.tokensPerSecond)},{key:"tokens",header:"Tokens",align:"right",secondary:!0,render:r=>`${i(r.inputTokens)} → ${i(r.outputTokens)}`},{key:"cost",header:"Cost",align:"right",render:r=>e.jsx(b,{entry:r})}]}),a.hasNextPage&&e.jsx("div",{className:"gc-load-more",children:e.jsx(A,{variant:"outline",size:"sm",disabled:a.isFetchingNextPage,onClick:()=>void a.fetchNextPage(),children:a.isFetchingNextPage?"Loading…":"Load older requests"})}),e.jsx(C,{isOpen:t!==null,onClose:()=>o(null),title:t?Z(t):"Request",subtitle:t?f(t.startedAt):void 0,eyebrow:"Request",children:t&&e.jsx(ee,{entry:t},t.tag)})]})}export{ie as R};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RewardsClaim-DHvgMfZ4.js","assets/index-cESr4Zze.js","assets/index-DYK1gWhP.css","assets/ants-B38m9Phv.js","assets/useTx-DsLsc5bB.js","assets/en_US-Y4ZOVFV4-sKQksBWU.js","assets/clsx-B-dksMZM.js","assets/index-BhwNCc8y.js","assets/en_US-Y4ZOVFV4-CcVPgXVa.css","assets/writeContract-Cqg_OlRQ.js","assets/sendTransaction-Cmz5eiPq.js","assets/ConnectWallet-CLv0c-JB.js","assets/OperatorGateAlert-grMRoFdV.js","assets/StakingDashboard-C5Ib_AUs.js","assets/waitForCallsStatus-DlpsNYx1.js","assets/ChainGate-DpChfDOP.js","assets/StakingDashboard-CJbBUUQE.css"])))=>i.map(i=>d[i]);
2
- import{u as _,F as R,G as N,e as z,q as w,H as E,J as F,r as o,j as e,P as T,Q as D,K as P,S as d,N as t,M as q,w as c,l as h,O as p,B as I,C as O,L as x,v as j,E as K,I as L,_ as k,f as Q}from"./index-cESr4Zze.js";import{C as M}from"./ChainGate-DpChfDOP.js";import{f as n,a as y}from"./ants-B38m9Phv.js";import{D as $}from"./DataTable-BkJdorEh.js";const B=o.lazy(()=>k(()=>import("./RewardsClaim-DHvgMfZ4.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))),G=o.lazy(()=>k(()=>import("./StakingDashboard-C5Ib_AUs.js").then(r=>r.b),__vite__mapDeps([13,1,2,5,6,7,8,10,14,9,15,16])).then(r=>({default:r.StakingDashboard}))),H=["rewards"];function X(){const{workspace:r}=_(),S=R(),b=N(),f=z({queryKey:w.rewards(r.id),queryFn:()=>Q.wallet.rewards(r.id)}),u=E(),m=F(r.id),[A,i]=o.useState(!1);return e.jsxs("div",{className:"gc-page",children:[e.jsx(T,{title:"Rewards",description:"ANTS earned by this workspace's usage and by your staking."}),e.jsx(D,{query:f,rows:3,children:l=>{var g;const C=m.data?m.data.operator:l.operator,a={...l,operator:C};return e.jsxs(e.Fragment,{children:[e.jsx(P,{stale:l.stale}),e.jsxs("div",{className:"gc-grid gc-grid--3",children:[e.jsx(d,{label:"Ready to claim",value:n(a.pendingAnts)}),e.jsx(d,{label:"From the legacy program",value:n(((g=a.legacy)==null?void 0:g.pendingAnts)??"0"),sub:a.legacy?"Claimed together with the rest":void 0}),e.jsx(d,{label:"Authorized wallet",value:t(a.operator)?e.jsx(q,{title:a.operator,children:c(a.operator)}):"Not set"})]}),e.jsx(h,{children:e.jsxs("div",{className:"gc-summary-row",children:[e.jsxs("div",{className:"gc-summary-row__text",children:[e.jsx("span",{className:"gc-strong",children:y(a.pendingAnts)?`${n(a.pendingAnts)} ready to claim`:"Nothing to claim yet"}),e.jsxs("span",{className:"gc-fineprint",children:[t(a.operator)?e.jsxs(e.Fragment,{children:["Claimed ANTS go to the authorized wallet ",c(a.operator),", which signs the claim."]}):e.jsxs(e.Fragment,{children:["Only the authorized wallet can claim, and none is set. Authorize one on ",e.jsx(p,{to:"wallet",children:"Wallet & Funding"}),"."]}),y(a.pendingAnts)&&t(a.operator)?e.jsxs(e.Fragment,{children:[" Or stake them into a seller pool on ",e.jsx(p,{to:"staking",children:"Staking"}),"."]}):null]})]}),e.jsx(I,{size:"sm",variant:"outline",disabled:!t(a.operator),onClick:()=>i(!0),children:"Claim rewards"})]})}),e.jsx(O,{isOpen:A,onClose:()=>i(!1),title:"Claim rewards",subtitle:`${n(a.pendingAnts)} ready. Sent to the authorized wallet${t(a.operator)?` ${c(a.operator)}`:""}.`,children:e.jsx(M,{chain:u.data,error:u.error,children:s=>e.jsx(o.Suspense,{fallback:e.jsx(x,{rows:2}),children:e.jsx(B,{rewards:a,chain:s,onDone:()=>{b("Rewards claimed"),i(!1),S.invalidateQueries({queryKey:w.rewards(r.id)})}})})})}),e.jsx(h,{flush:!0,title:"Current program by epoch",description:"Rewards accrue at each epoch boundary from this workspace's paid usage.",children:e.jsx($,{label:"Reward epochs",rows:[...a.epochs].sort((s,v)=>v.epoch-s.epoch),rowKey:s=>String(s.epoch),empty:e.jsx(K,{icon:e.jsx(L.rewards,{size:18}),title:"No rewards yet",body:"Rewards accrue per epoch as this workspace's keys are used."}),columns:[{key:"epoch",header:"Epoch",render:s=>s.epoch},{key:"amount",header:"Amount",align:"right",render:s=>n(s.pendingAnts)},{key:"state",header:"Status",render:s=>s.claimed?e.jsx(j,{tone:"success",children:"Claimed"}):e.jsx(j,{tone:"warning",children:"Unclaimed"})}]})})]})}}),e.jsx(h,{title:"Staking rewards",description:e.jsxs(e.Fragment,{children:["ANTS earned by your staked positions, claimed or restaked with the wallet that holds them. Manage positions on ",e.jsx(p,{to:"staking",children:"Staking"}),"."]}),children:e.jsx(o.Suspense,{fallback:e.jsx(x,{rows:2}),children:e.jsx(G,{pages:H,buyerRewards:!1})})})]})}export{X as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RewardsClaim-Df0QQMHb.js","assets/index-DPXW_JSn.js","assets/index-BAcoKUeC.css","assets/ants-B38m9Phv.js","assets/useTx-DzRlz7Ez.js","assets/en_US-Y4ZOVFV4-Bkc-z49M.js","assets/clsx-B-dksMZM.js","assets/index-BhwNCc8y.js","assets/en_US-Y4ZOVFV4-CcVPgXVa.css","assets/writeContract-CaMlmKcK.js","assets/sendTransaction-k8aDYfd4.js","assets/ConnectWallet-BYdqZipy.js","assets/OperatorGateAlert-cpvsO9yT.js","assets/StakingDashboard-DvLxJ1j4.js","assets/waitForCallsStatus-C51Vv8Tt.js","assets/ChainGate-Do1wYOPQ.js","assets/StakingDashboard-CJbBUUQE.css"])))=>i.map(i=>d[i]);
2
+ import{u as _,F as R,G as N,e as z,q as w,H as E,J as F,r as o,j as e,P as T,Q as D,K as P,S as d,N as t,M as q,w as c,l as h,O as p,B as I,C as O,L as x,v as j,E as K,I as L,_ as k,f as Q}from"./index-DPXW_JSn.js";import{C as M}from"./ChainGate-Do1wYOPQ.js";import{f as n,a as y}from"./ants-B38m9Phv.js";import{D as $}from"./DataTable-BCgVRqY6.js";const B=o.lazy(()=>k(()=>import("./RewardsClaim-Df0QQMHb.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))),G=o.lazy(()=>k(()=>import("./StakingDashboard-DvLxJ1j4.js").then(r=>r.b),__vite__mapDeps([13,1,2,5,6,7,8,10,14,9,15,16])).then(r=>({default:r.StakingDashboard}))),H=["rewards"];function X(){const{workspace:r}=_(),S=R(),b=N(),f=z({queryKey:w.rewards(r.id),queryFn:()=>Q.wallet.rewards(r.id)}),u=E(),m=F(r.id),[A,i]=o.useState(!1);return e.jsxs("div",{className:"gc-page",children:[e.jsx(T,{title:"Rewards",description:"ANTS earned by this workspace's usage and by your staking."}),e.jsx(D,{query:f,rows:3,children:l=>{var g;const C=m.data?m.data.operator:l.operator,a={...l,operator:C};return e.jsxs(e.Fragment,{children:[e.jsx(P,{stale:l.stale}),e.jsxs("div",{className:"gc-grid gc-grid--3",children:[e.jsx(d,{label:"Ready to claim",value:n(a.pendingAnts)}),e.jsx(d,{label:"From the legacy program",value:n(((g=a.legacy)==null?void 0:g.pendingAnts)??"0"),sub:a.legacy?"Claimed together with the rest":void 0}),e.jsx(d,{label:"Authorized wallet",value:t(a.operator)?e.jsx(q,{title:a.operator,children:c(a.operator)}):"Not set"})]}),e.jsx(h,{children:e.jsxs("div",{className:"gc-summary-row",children:[e.jsxs("div",{className:"gc-summary-row__text",children:[e.jsx("span",{className:"gc-strong",children:y(a.pendingAnts)?`${n(a.pendingAnts)} ready to claim`:"Nothing to claim yet"}),e.jsxs("span",{className:"gc-fineprint",children:[t(a.operator)?e.jsxs(e.Fragment,{children:["Claimed ANTS go to the authorized wallet ",c(a.operator),", which signs the claim."]}):e.jsxs(e.Fragment,{children:["Only the authorized wallet can claim, and none is set. Authorize one on ",e.jsx(p,{to:"wallet",children:"Wallet & Funding"}),"."]}),y(a.pendingAnts)&&t(a.operator)?e.jsxs(e.Fragment,{children:[" Or stake them into a seller pool on ",e.jsx(p,{to:"staking",children:"Staking"}),"."]}):null]})]}),e.jsx(I,{size:"sm",variant:"outline",disabled:!t(a.operator),onClick:()=>i(!0),children:"Claim rewards"})]})}),e.jsx(O,{isOpen:A,onClose:()=>i(!1),title:"Claim rewards",subtitle:`${n(a.pendingAnts)} ready. Sent to the authorized wallet${t(a.operator)?` ${c(a.operator)}`:""}.`,children:e.jsx(M,{chain:u.data,error:u.error,children:s=>e.jsx(o.Suspense,{fallback:e.jsx(x,{rows:2}),children:e.jsx(B,{rewards:a,chain:s,onDone:()=>{b("Rewards claimed"),i(!1),S.invalidateQueries({queryKey:w.rewards(r.id)})}})})})}),e.jsx(h,{flush:!0,title:"Current program by epoch",description:"Rewards accrue at each epoch boundary from this workspace's paid usage.",children:e.jsx($,{label:"Reward epochs",rows:[...a.epochs].sort((s,v)=>v.epoch-s.epoch),rowKey:s=>String(s.epoch),empty:e.jsx(K,{icon:e.jsx(L.rewards,{size:18}),title:"No rewards yet",body:"Rewards accrue per epoch as this workspace's keys are used."}),columns:[{key:"epoch",header:"Epoch",render:s=>s.epoch},{key:"amount",header:"Amount",align:"right",render:s=>n(s.pendingAnts)},{key:"state",header:"Status",render:s=>s.claimed?e.jsx(j,{tone:"success",children:"Claimed"}):e.jsx(j,{tone:"warning",children:"Unclaimed"})}]})})]})}}),e.jsx(h,{title:"Staking rewards",description:e.jsxs(e.Fragment,{children:["ANTS earned by your staked positions, claimed or restaked with the wallet that holds them. Manage positions on ",e.jsx(p,{to:"staking",children:"Staking"}),"."]}),children:e.jsx(o.Suspense,{fallback:e.jsx(x,{rows:2}),children:e.jsx(G,{pages:H,buyerRewards:!1})})})]})}export{X as default};
@@ -1 +1 @@
1
- import{j as e,u as R,J as B,aH as N,aI as w,ah as E,aJ as b,w as k,B as O}from"./index-cESr4Zze.js";import{a as I}from"./ants-B38m9Phv.js";import{u as S,a as T,T as v,U as x,s as C,L as A}from"./useTx-DsLsc5bB.js";import{a as _}from"./ConnectWallet-CLv0c-JB.js";import{O as W}from"./OperatorGateAlert-grMRoFdV.js";import{W as G,u as L,c as P}from"./en_US-Y4ZOVFV4-sKQksBWU.js";import"./writeContract-Cqg_OlRQ.js";import"./sendTransaction-Cmz5eiPq.js";import"./clsx-B-dksMZM.js";import"./index-BhwNCc8y.js";function U(a,s){return a?"Claiming…":s===0?"Nothing to claim":s===1?"Claim":`Claim (${s} transactions)`}function J({rewards:a,chain:s,onDone:j}){const{address:c}=L(),u=P(),{workspace:h}=R(),p=B(h.id),{refresh:y}=N(h.id),i=S(s.chainId),{writeContractAsync:g}=T(),d=w(s,"usageRewards"),f=a.epochs.filter(t=>!t.claimed&&I(t.pendingAnts)),o=a.legacy&&I(a.legacy.pendingAnts)?a.legacy:null,l=f.length+(o?1:0);if(!d)return e.jsx(E,{tone:"warning",children:"The gateway did not report the usage rewards contract address."});const m=b(p.data,c,"claim rewards");return m.ok?e.jsxs("div",{className:"gc-stack",children:[e.jsxs("p",{className:"gc-fineprint",children:["The ANTS go to ",k(m.operator),", the connected authorized wallet."]}),e.jsx(v,{chain:s,runner:i,done:"Rewards claimed."}),e.jsx(O,{disabled:i.running||l===0,onClick:async()=>{const t=f.map(n=>{const r=[a.address,BigInt(n.epoch)];return{label:`Claim epoch ${n.epoch}`,check:()=>C(u,{account:c,address:d,abi:x,functionName:"claimBuyerReward",args:r,chainId:s.chainId}),send:()=>g({address:d,abi:x,functionName:"claimBuyerReward",args:r,chainId:s.chainId})}});if(o){const n=[a.address,o.epochs.map(BigInt)],r=o.contract;t.push({label:"Claim legacy emissions",check:()=>C(u,{account:c,address:r,abi:A,functionName:"claimBuyerEmissions",args:n,chainId:s.chainId}),send:()=>g({address:r,abi:A,functionName:"claimBuyerEmissions",args:n,chainId:s.chainId})})}await i.run(t,{onStale:()=>void y().catch(()=>{})})&&j()},children:U(i.running,l)}),l>1&&e.jsx("p",{className:"gc-fineprint",children:"Each current-program epoch is its own transaction; legacy emissions are one more."})]}):e.jsx(W,{gate:m,state:p.data,connected:c})}function X(a){return e.jsx(G,{chain:a.chain,children:e.jsxs("div",{className:"gc-stack",children:[e.jsx(_,{}),e.jsx(J,{...a})]})})}export{X as default};
1
+ import{j as e,u as R,J as B,ap as N,aq as w,af as E,ar as b,w as k,B as O}from"./index-DPXW_JSn.js";import{a as I}from"./ants-B38m9Phv.js";import{u as S,a as T,T as v,U as x,s as C,L as A}from"./useTx-DzRlz7Ez.js";import{a as _}from"./ConnectWallet-BYdqZipy.js";import{O as W}from"./OperatorGateAlert-cpvsO9yT.js";import{W as G,u as L,c as P}from"./en_US-Y4ZOVFV4-Bkc-z49M.js";import"./writeContract-CaMlmKcK.js";import"./sendTransaction-k8aDYfd4.js";import"./clsx-B-dksMZM.js";import"./index-BhwNCc8y.js";function U(a,s){return a?"Claiming…":s===0?"Nothing to claim":s===1?"Claim":`Claim (${s} transactions)`}function Y({rewards:a,chain:s,onDone:j}){const{address:c}=L(),u=P(),{workspace:h}=R(),p=B(h.id),{refresh:y}=N(h.id),i=S(s.chainId),{writeContractAsync:g}=T(),d=w(s,"usageRewards"),f=a.epochs.filter(t=>!t.claimed&&I(t.pendingAnts)),o=a.legacy&&I(a.legacy.pendingAnts)?a.legacy:null,l=f.length+(o?1:0);if(!d)return e.jsx(E,{tone:"warning",children:"The gateway did not report the usage rewards contract address."});const m=b(p.data,c,"claim rewards");return m.ok?e.jsxs("div",{className:"gc-stack",children:[e.jsxs("p",{className:"gc-fineprint",children:["The ANTS go to ",k(m.operator),", the connected authorized wallet."]}),e.jsx(v,{chain:s,runner:i,done:"Rewards claimed."}),e.jsx(O,{disabled:i.running||l===0,onClick:async()=>{const t=f.map(n=>{const r=[a.address,BigInt(n.epoch)];return{label:`Claim epoch ${n.epoch}`,check:()=>C(u,{account:c,address:d,abi:x,functionName:"claimBuyerReward",args:r,chainId:s.chainId}),send:()=>g({address:d,abi:x,functionName:"claimBuyerReward",args:r,chainId:s.chainId})}});if(o){const n=[a.address,o.epochs.map(BigInt)],r=o.contract;t.push({label:"Claim legacy emissions",check:()=>C(u,{account:c,address:r,abi:A,functionName:"claimBuyerEmissions",args:n,chainId:s.chainId}),send:()=>g({address:r,abi:A,functionName:"claimBuyerEmissions",args:n,chainId:s.chainId})})}await i.run(t,{onStale:()=>void y().catch(()=>{})})&&j()},children:U(i.running,l)}),l>1&&e.jsx("p",{className:"gc-fineprint",children:"Each current-program epoch is its own transaction; legacy emissions are one more."})]}):e.jsx(W,{gate:m,state:p.data,connected:c})}function X(a){return e.jsx(G,{chain:a.chain,children:e.jsxs("div",{className:"gc-stack",children:[e.jsx(_,{}),e.jsx(Y,{...a})]})})}export{X as default};
@@ -0,0 +1 @@
1
+ import{r as f,j as e,B as N,I as D,C as H,T as ue,L as ae,E as ne,b2 as he,v as T,u as K,a as re,bc as oe,bd as ie,b as B,be as J,c as le,d as pe,b5 as ce,n as $,o as A,af as Y,e as ge,P as me,F as ye,bf as fe,bg as xe,aR as we,bh as E,bi as je,bj as V,l as X,O as I,f as q,q as z,bk as Z,i as ve,G as ke,bl as M,bm as be,bn as Ce,aT as Se}from"./index-DPXW_JSn.js";import{a as _e,d as Ne}from"./PolicyField-ldIq_Yw-.js";import{e as Pe,P as Le,a as Fe,p as U,b as Re}from"./PolicyEditor-COREmE0O.js";import{M as Ee}from"./SidePanel-BFQArkoa.js";import{B as ee}from"./BrandIcon-6gq42Dg-.js";import{S as Me,l as $e,s as qe}from"./stored-e0tX90bC.js";import{S as se}from"./SelectField-m1sMIgMa.js";import"./PeerPicker-CcMSXxY3.js";import"./DataTable-BCgVRqY6.js";import"./Segmented-DYnoemT9.js";import"./roving-DkptacxO.js";import"./Switch-Db8Sm64J.js";import"./Disclosure-CQMtWM0M.js";import"./selection-BV37SUs_.js";function ze(t,r){if(!r)return!0;const a=r.toLowerCase();return[t.id,t.name,...t.aliases,...t.tags].some(c=>c.toLowerCase().includes(a))}function Oe({models:t,loading:r,value:a,onChange:c,favorites:n=[],label:l="Model"}){const[k,x]=f.useState(!1),[h,p]=f.useState(""),u=(t==null?void 0:t.find(s=>s.id===a))??null,w=f.useMemo(()=>new Set(n.map(s=>s.toLowerCase())),[n]),o=f.useMemo(()=>[...t??[]].filter(s=>ze(s,h.trim())).sort((s,g)=>Number(w.has(g.id.toLowerCase()))-Number(w.has(s.id.toLowerCase()))||g.offers.length-s.offers.length||s.name.localeCompare(g.name)),[t,h,w]),m=s=>{c(s),x(!1),p("")};return e.jsxs(e.Fragment,{children:[e.jsxs(N,{variant:"outline",size:"sm",className:"gc-model-chooser","aria-label":`${l}: ${(u==null?void 0:u.name)??a??"none"}`,onClick:()=>x(!0),children:[e.jsx("span",{className:"gc-model-chooser__mark","aria-hidden":"true",children:u?e.jsx(ee,{name:u.id,hints:[u.name],size:16}):e.jsx(D.models,{size:15})}),e.jsx("span",{className:"gc-ellipsis",children:(u==null?void 0:u.name)??a??"Choose a model"}),e.jsx("span",{className:"gc-model-chooser__caret","aria-hidden":"true",children:e.jsx(D.down,{size:14})})]}),e.jsx(H,{isOpen:k,onClose:()=>x(!1),title:"Choose a model",size:"md",children:e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsx(ue,{size:"sm",type:"search",autoFocus:!0,"aria-label":"Search models",placeholder:"Search by name, id or tag",value:h,onChange:s=>p(s.target.value),onKeyDown:s=>{s.key==="Enter"&&o[0]&&m(o[0].id)}}),r?e.jsx(ae,{rows:5}):o.length===0?e.jsx(ne,{title:"No model matches"}):e.jsx("ul",{className:"gc-choice-list","aria-label":"Models",children:o.map(s=>e.jsx("li",{children:e.jsxs("button",{type:"button",className:s.id===a?"gc-choice gc-choice--on":"gc-choice",onClick:()=>m(s.id),children:[e.jsx(ee,{name:s.id,hints:[s.name],size:18}),e.jsxs("span",{className:"gc-choice__main",children:[e.jsxs("span",{className:"gc-choice__title",children:[s.name,w.has(s.id.toLowerCase())&&e.jsx(D.starFilled,{size:12})]}),e.jsxs("span",{className:"gc-choice__meta",children:[s.name!==s.id&&e.jsx("code",{children:s.id}),e.jsx("span",{children:Ee[s.type]}),e.jsxs("span",{children:[s.offers.length," provider",s.offers.length===1?"":"s"]}),s.inputUsdPerMillion&&e.jsxs("span",{children:[he(s.inputUsdPerMillion),"/M in"]})]})]}),s.free&&e.jsx(T,{tone:"success",children:"Free"})]})},s.id))})]})})]})}const de={buyer:"Buyer config",gateway:"Gateway default","workspace-org":"Organization policy",workspace:"Workspace policy",member:"Member policy",key:"Key policy (admin)","key-owner":"Key policy (owner)",preset:"Preset"};function Te(t,r,a,c){return t==="key"?(r??[]).filter(n=>n.status==="active").map(n=>({value:n.id,label:n.label})):t==="member"?(a??[]).map(({member:n})=>({value:n.id,label:n.label})):t==="preset"?(c??[]).map(n=>({value:n.slug,label:n.name})):[]}function Ae(t,r){return!t.model||t.target!=="workspace"&&!t.targetId?null:{model:t.model,workspace:r,...t.target!=="workspace"?{[t.target]:t.targetId}:{}}}function Ke({exclusions:t}){return t.length===0?null:e.jsx("span",{className:"gc-fineprint",children:t.map((r,a)=>e.jsxs("span",{children:[a>0?"; ":"",e.jsx("strong",{children:de[r.level]})," ",r.rule]},`${r.level}-${a}`))})}function Be({state:t,onChange:r,preview:a}){const{workspace:c,viewer:n}=K(),l=re(),k=oe(),x=ie(),h=B(),p=J(),u=le(l,t.target==="key"),w=pe(c.id,t.target==="member"),o=ce(c.id,t.target==="preset"),m=Te(t.target,u.data,w.data,o.data),s=a.data,g=(s==null?void 0:s.candidates.filter(i=>i.eligible).length)??0,y=s&&!s.modelAllowed?s.sources.filter(i=>{var v;return((v=i.policy)==null?void 0:v.allowedModels)&&!i.policy.allowedModels.some(j=>j.toLowerCase()===s.model.toLowerCase())}):[];return e.jsxs("div",{className:"gc-stack",children:[e.jsxs("div",{className:"gc-toolbar",children:[e.jsx(Oe,{models:k.data,loading:k.isLoading,value:t.model,favorites:x.data,onChange:i=>r({...t,model:i})}),e.jsx(se,{size:"sm","aria-label":"Request from",value:t.target,onChange:i=>r({...t,target:i,targetId:""}),options:[{value:"workspace",label:`From workspace ${c.name}`},{value:"key",label:"From a key"},...$(n)?[{value:"member",label:"From a member"}]:[],{value:"preset",label:"With a preset"}]}),t.target!=="workspace"&&e.jsx(se,{size:"sm","aria-label":`Choose a ${t.target}`,value:t.targetId,onChange:i=>r({...t,targetId:i}),options:[{value:"",label:`Choose a ${t.target}`},...m]})]}),a.error?e.jsx(A,{error:a.error}):null,!t.model&&e.jsx(ne,{title:"Pick a model",body:"The preview shows the sellers a request for it would use."}),s&&!s.modelAllowed&&e.jsx(Y,{tone:"danger",title:`${s.model} is not allowed`,children:y.length?e.jsxs(e.Fragment,{children:[y.map(i=>de[i.level]).join(" and ")," only allow",y.length===1?"s":""," ",y[0].policy.allowedModels.join(", ")||"no model",". Requests for ",s.model," get a 403."]}):e.jsxs(e.Fragment,{children:["Requests for ",s.model," get a 403."]})}),s&&s.modelAllowed&&e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsxs("p",{className:"gc-try__summary",children:[e.jsxs(T,{tone:g>0?"success":"warning",children:[g," of ",s.candidates.length]})," ",g>0?`sellers can serve ${s.model}.`:`No seller can serve ${s.model} with these rules.`]}),e.jsx(Me,{title:"Sellers, in the order they are tried",preview:s,loading:a.isFetching&&!s,skippedOpen:!0,explainSkipped:i=>e.jsx(Ke,{exclusions:Pe(s,i,h.data,p.data??[])})})]})]})}const F={gateway:{title:"Gateway default",description:()=>"Set by organization admins. Applies to every request through this gateway."},org:{title:"Organization policy",description:t=>`Set by organization admins for the ${t} workspace. Workspace admins cannot loosen it.`},workspace:{title:"Workspace policy",description:t=>`Set by ${t}'s admins for their own keys.`}},Q=(t,r)=>JSON.stringify(t)===JSON.stringify(r);function O({index:t,title:r,who:a,sentences:c,empty:n="No rules of its own.",impact:l,badge:k,action:x,result:h}){return e.jsxs("li",{className:h?"gc-funnel__step gc-funnel__step--result":"gc-funnel__step",children:[e.jsx("span",{className:"gc-funnel__index","aria-hidden":"true",children:t}),e.jsxs("div",{className:"gc-funnel__body",children:[e.jsxs("div",{className:"gc-funnel__head",children:[e.jsx("span",{className:"gc-funnel__title",children:r}),k,x&&e.jsx("span",{className:"gc-funnel__action",children:x})]}),e.jsx("div",{className:"gc-fineprint",children:a}),c.length>0?e.jsx("ul",{className:"gc-funnel__rules",children:c.map(p=>e.jsx("li",{children:p},p))}):e.jsx("p",{className:"gc-funnel__none",children:n}),l&&e.jsx("p",{className:l.excluded>0?"gc-funnel__impact gc-funnel__impact--on":"gc-funnel__impact",children:l.excluded>0?`Keeps ${l.excluded} of ${l.total} seller${l.total===1?"":"s"} of ${l.model} out.`:`Keeps no seller of ${l.model} out.`})]})]})}function G({index:t,layer:r,source:a,parent:c,canEdit:n,impact:l,onSave:k}){const{workspace:x}=K(),h=ke(),p=B(),u=J(),w=_e(),[o,m]=f.useState(()=>M(a)),[s,g]=f.useState(()=>M(a)),[y,i]=f.useState(null),[v,j]=f.useState(!1),S=f.useMemo(()=>M(a),[a]),b=!Q(o,s);f.useEffect(()=>{Q(S,s)||(!b||Q(S,o)?(m(S),g(S),i(null)):i(S))},[S]);const _=be({mutationFn:async()=>{const d=Ce(o,u.data??null);return await w.save([d],W=>k(d,W))===Se?null:d},onSuccess:d=>{if(!d)return;const C=M(d);m(C),g(C),i(null),j(!1),h(`${F[r].title} saved`)}}),P=Ne(o,u.data??null),R=b?P.policy:a,L=!a||Object.keys(a).length===0;return e.jsxs(e.Fragment,{children:[e.jsx(O,{index:t,title:F[r].title,who:F[r].description(x.name),sentences:b&&P.error?[]:U(R,p.data,u.data??[]),empty:b&&P.error?"Has an invalid setting; open it to fix.":"No rules of its own: passes on everything above.",impact:l,badge:b?e.jsx(T,{tone:"warning",children:"Unsaved changes"}):n?void 0:e.jsx(T,{children:"Read only"}),action:e.jsx(N,{size:"sm",variant:n&&L?"outline":"ghost",onClick:()=>j(!0),children:n?L?"Add rules":"Edit":"View"})}),y&&n&&!v&&e.jsx("li",{className:"gc-funnel__note",children:e.jsx(Y,{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(H,{isOpen:v,onClose:()=>j(!1),size:"xl",title:F[r].title,subtitle:F[r].description(x.name),footer:n?e.jsxs(e.Fragment,{children:[P.error&&e.jsx("span",{className:"gc-warn gc-footer-note",children:P.error}),e.jsx(N,{variant:"ghost",disabled:!b,onClick:()=>{m(s),i(null)},children:"Discard changes"}),e.jsx(N,{disabled:_.isPending||!b,onClick:()=>_.mutate(),children:_.isPending?"Saving…":"Save policy"})]}):e.jsx(N,{variant:"outline",onClick:()=>j(!1),children:"Close"}),children:e.jsxs("div",{className:"gc-stack",children:[y&&n&&e.jsx(Y,{tone:"warning",title:"Changed elsewhere",action:e.jsxs("div",{className:"gc-inline gc-inline--wrap",children:[e.jsx(N,{size:"sm",variant:"outline",onClick:()=>{m(y),g(y),i(null)},children:"Reload"}),e.jsx(N,{size:"sm",variant:"ghost",onClick:()=>{g(y),i(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."}),_.error?e.jsx(A,{error:_.error,title:"Could not save"}):null,e.jsx(Re,{value:o,onChange:m,peers:p.data,lists:u.data??[],parent:c,disabled:!n})]})}),w.dialog]})}function We({preview:t}){var R,L;const{workspace:r,viewer:a}=K(),c=ye(),n=re(),l=B(),k=J(),x=fe(),h=xe(),p=we(r.id),u=le(n),w=ce(r.id),o=k.data??[],m=h.data?E(h.data,o):null,s=((R=p.data)==null?void 0:R.orgRoutingPolicy)??null,g=((L=p.data)==null?void 0:L.routingPolicy)??null,y=f.useMemo(()=>je(x.data),[x.data]),i=f.useMemo(()=>V(y,m,s&&E(s,o),g&&E(g,o)),[y,m,s,g,o]),v=f.useMemo(()=>Fe(t,l.data,o),[t,l.data,o]),j=(...d)=>t&&t.modelAllowed?{model:t.model,total:t.candidates.length,excluded:d.reduce((C,W)=>C+(v.get(W)??0),0)}:null;if(h.isLoading||p.isLoading)return e.jsx(X,{title:"Rules that apply",children:e.jsx(ae,{rows:6})});if(h.error)return e.jsx(A,{error:h.error,onRetry:()=>void h.refetch()});if(p.error)return e.jsx(A,{error:p.error,onRetry:()=>void p.refetch()});const S=async()=>{await c.invalidateQueries({queryKey:z.group("workspaces")}),await c.invalidateQueries({queryKey:z.group("routing")})},b=(u.data??[]).filter(d=>d.status==="active"&&d.routingPolicy).length,_=(w.data??[]).filter(d=>d.routingPolicy).length,P=[b?`${b} key${b===1?" has its":"s have their"} own rules.`:null,_?`${_} preset${_===1?" has":"s have"} rules.`:null].filter(d=>d!==null);return e.jsx(X,{title:"Rules that apply",description:"A request passes every level, top to bottom. Each level can only narrow the ones above it, never loosen them.",children:e.jsxs("ol",{className:"gc-funnel",children:[e.jsx(O,{index:1,title:"Buyer config",who:e.jsxs(e.Fragment,{children:["The buyer's own limits",$(a)?e.jsxs(e.Fragment,{children:[", set under ",e.jsx(I,{to:"settings",children:"Settings"})]}):"",". Everything below can only narrow them."]}),sentences:U(y,l.data,o),empty:"No limits.",impact:j("buyer")}),e.jsx(G,{index:2,layer:"gateway",source:h.data??null,parent:y,canEdit:$(a),impact:j("gateway"),onSave:async(d,C)=>{await q.network.setGatewayPolicy(d,C),await c.invalidateQueries({queryKey:z.group("routing")})}}),e.jsx(G,{index:3,layer:"org",source:s,parent:m,canEdit:$(a),impact:j("workspace-org"),onSave:async(d,C)=>{await q.workspaces.update(r.id,{orgRoutingPolicy:Z(d)},C),await S()}}),e.jsx(G,{index:4,layer:"workspace",source:g,parent:V(m,s&&E(s,o)),canEdit:ve(a),impact:j("workspace"),onSave:async(d,C)=>{await q.workspaces.update(r.id,{routingPolicy:Z(d)},C),await S()}}),e.jsx(O,{index:5,title:"Members, keys and presets",who:e.jsxs(e.Fragment,{children:["Can narrow the rules further for one member, one key or one preset: see ",e.jsx(I,{to:"keys",children:"Keys"})," and ",e.jsx(I,{to:"presets",children:"Presets"}),"."]}),sentences:P,empty:"None in this workspace narrows it.",impact:j("member","key","key-owner","preset")}),e.jsx(O,{index:"=",result:!0,title:`Effective for ${r.name}`,who:"What every key in this workspace gets before its own rules.",sentences:U(i,l.data,o),empty:"No rules: every seller the network offers."})]})})}const te="antseed-console-routing:try";function as(){var m;const{workspace:t}=K(),r=B(),a=oe(),c=ie(),[n,l]=f.useState(()=>({target:"workspace",targetId:"",model:$e(te,null)}));f.useEffect(()=>{qe(te,n.model)},[n.model]),f.useEffect(()=>{var y,i;if(n.model||!((y=a.data)!=null&&y.length))return;const s=(i=c.data)==null?void 0:i.find(v=>a.data.some(j=>j.id===v)),g=[...a.data].filter(v=>v.type==="text").sort((v,j)=>j.offers.length-v.offers.length)[0]??a.data[0];l(v=>({...v,model:s??g.id}))},[a.data,c.data,n.model]);const[k,x]=f.useState(!1),[h,p]=f.useState(!1),u=()=>{p(!0),x(!0)},w=h?Ae(n,t.id):null,o=ge({queryKey:z.routePreview(w??{}),queryFn:()=>q.network.routePreview(w),enabled:w!==null,staleTime:15e3});return e.jsxs("div",{className:"gc-page",children:[e.jsx(me,{title:"Routing",description:"The rules that decide which sellers serve your requests. Try a request to see where one for a model goes, and why.",actions:e.jsx(N,{variant:"brand",onClick:u,children:"Try a request"})}),e.jsx(We,{preview:w&&((m=o.data)==null?void 0:m.model)===n.model?o.data:void 0}),e.jsx(Le,{peers:r.data}),e.jsx(H,{isOpen:k,onClose:()=>x(!1),size:"xl",title:"Try a request",subtitle:"Pick a model to see which sellers a request goes to, in what order, and what keeps the others out.",children:e.jsx(Be,{state:n,onChange:l,preview:{data:w?o.data:void 0,isFetching:o.isFetching,error:o.error}})})]})}export{as as default};
@@ -1 +1 @@
1
- import{j as m}from"./index-cESr4Zze.js";import{r as f,f as g}from"./roving-DkptacxO.js";function _({value:l,onChange:n,options:a,label:u,className:c}){const o=Math.max(0,a.findIndex(e=>e.value===l));return m.jsx("div",{className:["as-segmented",c].filter(Boolean).join(" "),role:"radiogroup","aria-label":u,children:a.map((e,d)=>{const i=e.value===l;return m.jsx("button",{type:"button",role:"radio","aria-checked":i,tabIndex:d===o?0:-1,disabled:e.disabled,className:i?"as-segmented__item as-segmented__item--on":"as-segmented__item",onClick:()=>n(e.value),onKeyDown:t=>{const r=f(t,d,a.length);if(r===null)return;t.preventDefault();const s=a[r];!s||s.disabled||(n(s.value),g(t,r,".as-segmented__item"))},children:e.label},e.value)})})}export{_ as S};
1
+ import{j as m}from"./index-DPXW_JSn.js";import{r as f,f as g}from"./roving-DkptacxO.js";function _({value:l,onChange:n,options:a,label:u,className:c}){const o=Math.max(0,a.findIndex(e=>e.value===l));return m.jsx("div",{className:["as-segmented",c].filter(Boolean).join(" "),role:"radiogroup","aria-label":u,children:a.map((e,d)=>{const i=e.value===l;return m.jsx("button",{type:"button",role:"radio","aria-checked":i,tabIndex:d===o?0:-1,disabled:e.disabled,className:i?"as-segmented__item as-segmented__item--on":"as-segmented__item",onClick:()=>n(e.value),onKeyDown:t=>{const r=f(t,d,a.length);if(r===null)return;t.preventDefault();const s=a[r];!s||s.disabled||(n(s.value),g(t,r,".as-segmented__item"))},children:e.label},e.value)})})}export{_ as S};
@@ -1 +1 @@
1
- import{r as j,j as e,a0 as o,a1 as h,a2 as f}from"./index-cESr4Zze.js";function b({label:a,hint:d,error:t,options:c,onChange:r,className:i,id:n,size:u,...x}){const m=j.useId(),l=n??m;return e.jsxs("label",{className:f(i,u),htmlFor:l,children:[a&&e.jsx("span",{className:"as-field__label",children:a}),e.jsx("select",{id:l,className:o("as-field__select"),onChange:s=>r(s.target.value),...x,children:c.map(s=>e.jsx("option",{value:s.value,disabled:s.disabled,children:s.label},s.value))}),e.jsx(h,{error:t,hint:d})]})}export{b as S};
1
+ import{r as j,j as e,a0 as o,a1 as h,a2 as f}from"./index-DPXW_JSn.js";function b({label:a,hint:d,error:t,options:c,onChange:r,className:i,id:n,size:u,...x}){const m=j.useId(),l=n??m;return e.jsxs("label",{className:f(i,u),htmlFor:l,children:[a&&e.jsx("span",{className:"as-field__label",children:a}),e.jsx("select",{id:l,className:o("as-field__select"),onChange:s=>r(s.target.value),...x,children:c.map(s=>e.jsx("option",{value:s.value,disabled:s.disabled,children:s.label},s.value))}),e.jsx(h,{error:t,hint:d})]})}export{b as S};
@@ -0,0 +1,7 @@
1
+ import{F as te,G as se,b as he,be as ge,r as d,bm as re,q as T,f as E,bw as xe,bj as ve,b4 as H,g as be,j as t,af as $,B as v,T as O,o as D,D as ne,e as fe,P as ye,bx as je,Q as z,ak as Se,l as F,X as ae,M as we,v as M,u as ke,V as Pe,t as K,aN as Re,ab as Q,aW as Ne,aa as Ce,E as Me,I as W,C as G,aM as Ie,$ as Te}from"./index-DPXW_JSn.js";import{S as Ue,T as qe}from"./PolicyEditor-COREmE0O.js";import{P as J}from"./PeerPicker-CcMSXxY3.js";import{S as Oe}from"./Segmented-DYnoemT9.js";import{S as I}from"./Switch-Db8Sm64J.js";import{D as A}from"./Disclosure-CQMtWM0M.js";import{T as ie}from"./TextAreaField-BCi-qMua.js";import{T as Ee,a as Fe}from"./Tabs-CCabxVNK.js";import{D as Ae}from"./DataTable-BCgVRqY6.js";import{S as B}from"./SelectField-m1sMIgMa.js";import"./roving-DkptacxO.js";function $e(e){return Object.entries(e).map(([s,r])=>`${s}: ${r}`).join(`
2
+ `)}function De(e){const s={};for(const[r,n]of e.split(`
3
+ `).entries()){if(!n.trim())continue;const c=n.indexOf(":");if(c<=0)throw new Error(`Line ${r+1}: use "Name: value".`);const u=n.slice(0,c).trim();if(!/^[A-Za-z0-9!#$%&'*+.^_`|~-]+$/.test(u))throw new Error(`Line ${r+1}: "${u}" is not a valid header name.`);s[u]=n.slice(c+1).trim()}return s}const le="••••";function _e(e){return e.split(`
4
+ `).map(s=>{const r=s.indexOf(":");return r>0&&s.slice(r+1).trim()===le?s.slice(0,r).trim():null}).filter(s=>!!s)}function Y(e){return e.split(`
5
+ `).map(s=>{const r=s.indexOf(":");return r>0&&s.slice(r+1).trim()===le?`${s.slice(0,r)}: `:s}).join(`
6
+ `)}function Le(e,s){if(!e||!s)return!1;try{return new URL(e).origin!==new URL(s).origin}catch{return e!==s}}function Be(e){const s={},r=(n,c,u)=>{const a=e[n].trim();if(a===""){c&&(s[n]="Required.");return}const h=Number(a);!Number.isFinite(h)||h<0?s[n]="Use a number of 0 or more.":u!==void 0&&h>u&&(s[n]=`At most ${u}.`)};return r("input",!0),r("output",!0),r("cached",!1),r("reputation",!0,100),s}function w(e,s={}){const r=e.trim();if(r==="")return s.required?"Required.":void 0;const n=Number(r),c=s.min??0;if(!Number.isFinite(n))return"Use a number.";if(s.integer&&!Number.isInteger(n))return"Use a whole number.";if(n<c)return`Use ${c} or more.`;if(s.max!==void 0&&n>s.max)return`At most ${s.max}.`}function V(e){return e.split(/[\n,]/).map(s=>s.trim()).filter(Boolean)}function X(e){const s=e.find(r=>!/^(?:0x)?[0-9a-f]{40}$/i.test(r));return s?`"${s}" is not a 40-character hex seller id.`:void 0}function Z(e){const s=e.find(r=>!/^https?:\/\/\S+$/.test(r));return s?`"${s}" is not an http(s) URL.`:void 0}function oe(e,s){return e.some(r=>r===s||s.startsWith(`${r}.`)||r.startsWith(`${s}.`))}function Ve(){return t.jsxs("span",{className:"gc-override",children:[t.jsx("span",{className:"gc-attention","aria-hidden":"true"}),"Overridden by the buyer's environment or start flags"]})}function ee(e){const s=e.routingPreferences,r=n=>n===null?"":String(n);return{allowMode:s.allowedPeerIds.length>0?"only":"any",allowedPeerIds:[...s.allowedPeerIds],blockedPeerIds:[...s.blockedPeerIds],minTrustScore:String(s.minTrustScore),minReputation:String(e.minPeerReputation),preferFree:s.preferFreePeers,softInputCap:String(s.maxInputUsdPerMillion),maxInput:String(e.maxPricing.inputUsdPerMillion),maxOutput:String(e.maxPricing.outputUsdPerMillion),maxCached:r(e.maxPricing.cachedInputUsdPerMillion),verify:e.verifier.enabled,requireVerified:e.verifier.require,verifiers:e.verifier.prefer.join(", "),sampleRate:r(e.evidence.sampleRate),maxSampleBytes:r(e.evidence.maxSampleBytes),autoSweep:e.payments.autoSweep,maxPerRequest:String(e.payments.maxPerRequestUsdc),maxReserve:String(e.payments.maxReserveUsdc),rpcUrl:e.payments.rpcUrl??"",fallbackRpcUrls:e.payments.fallbackRpcUrls.join(`
7
+ `),peerRefreshMs:String(e.network.peerRefreshIntervalMs),metadataTimeoutMs:String(e.network.metadataFetchTimeoutMs),requestTimeoutMs:String(e.network.requestTimeoutMs),maxStreamMs:String(e.network.maxStreamDurationMs),perServiceMetadata:!e.network.disableMetadataV2Services}}function ze(e){const s=Be({input:e.maxInput,output:e.maxOutput,cached:e.maxCached,reputation:e.minReputation}),r={maxInput:s.input,maxOutput:s.output,maxCached:s.cached,softInputCap:w(e.softInputCap,{required:!0}),allowedPeerIds:e.allowMode==="only"?X(e.allowedPeerIds):void 0,blockedPeerIds:X(e.blockedPeerIds),sampleRate:w(e.sampleRate,{max:1}),maxSampleBytes:w(e.maxSampleBytes,{min:1,integer:!0}),maxPerRequest:w(e.maxPerRequest,{required:!0,min:1e-6}),maxReserve:w(e.maxReserve,{required:!0,min:1e-6}),rpcUrl:e.rpcUrl.trim()?Z([e.rpcUrl.trim()]):void 0,fallbackRpcUrls:Z(V(e.fallbackRpcUrls)),peerRefreshMs:w(e.peerRefreshMs,{required:!0,min:1e3,integer:!0}),metadataTimeoutMs:w(e.metadataTimeoutMs,{required:!0,min:100,integer:!0}),requestTimeoutMs:w(e.requestTimeoutMs,{required:!0,min:1,integer:!0}),maxStreamMs:w(e.maxStreamMs,{required:!0,min:1,integer:!0})};return Object.fromEntries(Object.entries(r).filter(([,n])=>n))}function He(e){const s=r=>r.trim()?Number(r):null;return{routingPreferences:{minTrustScore:Number(e.minTrustScore),maxInputUsdPerMillion:Number(e.softInputCap),preferFreePeers:e.preferFree,allowedPeerIds:e.allowMode==="only"?e.allowedPeerIds:[],blockedPeerIds:e.blockedPeerIds},maxPricing:{inputUsdPerMillion:Number(e.maxInput),outputUsdPerMillion:Number(e.maxOutput),cachedInputUsdPerMillion:s(e.maxCached)},minPeerReputation:Number(e.minReputation),verifier:{enabled:e.verify,require:e.verify&&e.requireVerified,prefer:e.verify?V(e.verifiers):[]},evidence:{sampleRate:s(e.sampleRate),maxSampleBytes:s(e.maxSampleBytes)},payments:{autoSweep:e.autoSweep,maxPerRequestUsdc:Number(e.maxPerRequest),maxReserveUsdc:Number(e.maxReserve),rpcUrl:e.rpcUrl.trim()||null,fallbackRpcUrls:V(e.fallbackRpcUrls)},network:{peerRefreshIntervalMs:Number(e.peerRefreshMs),metadataFetchTimeoutMs:Number(e.metadataTimeoutMs),requestTimeoutMs:Number(e.requestTimeoutMs),maxStreamDurationMs:Number(e.maxStreamMs),disableMetadataV2Services:!e.perServiceMetadata}}}const Ke=["allowMode","allowedPeerIds","blockedPeerIds","minTrustScore","preferFree","softInputCap"];function L(e,s){return Object.keys(s).filter(r=>JSON.stringify(e[r])!==JSON.stringify(s[r]))}function Qe(e){const s=r=>r.trim()&&Number.isFinite(Number(r))?Number(r):void 0;return{...e.allowMode==="only"&&e.allowedPeerIds.length>0?{allowedPeerIds:e.allowedPeerIds}:{},...e.blockedPeerIds.length>0?{blockedPeerIds:e.blockedPeerIds}:{},...s(e.minTrustScore)?{minTrustScore:s(e.minTrustScore)}:{},...s(e.minReputation)?{minReputation:s(e.minReputation)}:{},...s(e.maxInput)!==void 0?{maxInputUsdPerMillion:s(e.maxInput)}:{},...s(e.maxOutput)!==void 0?{maxOutputUsdPerMillion:s(e.maxOutput)}:{},...s(e.maxCached)!==void 0?{maxCachedInputUsdPerMillion:s(e.maxCached)}:{}}}function We({buyer:e}){const s=te(),r=se(),n=he(),c=ge(),u=d.useMemo(()=>ee(e),[e]),[a,h]=d.useState(u),[k,P]=d.useState(u),[b,j]=d.useState(null),[f,p]=d.useState(!1),[S,g]=d.useState(!1),l=(i,R)=>h(N=>({...N,[i]:R})),m=i=>{h(i),P(i),j(null)},o=ze(a),U=L(k,a);d.useEffect(()=>{L(k,u).length!==0&&(U.length===0||L(u,a).length===0?m(u):j(u))},[u]);const _=U.some(i=>!Ke.includes(i)),C=i=>oe(e.overrides,i)?t.jsx(Ve,{}):void 0,ce=(i,R)=>C(i)??R,y=re({mutationFn:()=>E.settings.updateBuyer(He(a)),onSuccess:i=>{const{restartRequired:R,...N}=i;s.setQueryData(T.settings,N),m(ee(N.buyer)),s.invalidateQueries({queryKey:T.buyerLimits}),p(!1),g(R===!0),r(_?R?"Saved. Restart the buyer to apply them.":"Saved. The buyer is restarting.":"Saved. The buyer applies these at once.")}}),q=d.useMemo(()=>!n.data||n.data.length===0?null:{matched:xe(ve(Qe(a)),n.data,c.data??[]).length,total:n.data.length},[a,n.data,c.data]),ue=`${H(Number(a.maxInput))} in · ${H(Number(a.maxOutput))} out`,de=a.verify?a.requireVerified?"Required":"On":"Off",me=`${a.autoSweep?"Auto-sweep on":"Auto-sweep off"} · ${be(Number(a.maxPerRequest))} per request`,x=(i,R,N={})=>t.jsx(O,{size:"sm",className:N.className??"gc-num",label:R,inputMode:"decimal",placeholder:N.placeholder,value:a[i],error:o[i],hint:N.hint,onChange:pe=>l(i,pe.target.value)});return t.jsxs("div",{className:"gc-stack",children:[t.jsxs("div",{className:"gc-policy",children:[q&&(q.matched===0?t.jsxs($,{tone:"warning",title:"No seller matches these settings",children:["None of the ",q.total," sellers this gateway sees passes them, so every request will fail."]}):t.jsxs("p",{className:"gc-muted","aria-live":"polite",children:["Matches ",q.matched," of ",q.total," sellers. Every key can only narrow this."]})),t.jsxs("div",{className:"gc-policy__cols",children:[t.jsxs("section",{className:"gc-policy__section",children:[t.jsx("h3",{children:"Sellers"}),t.jsx(Oe,{label:"Which sellers may serve",value:a.allowMode,onChange:i=>l("allowMode",i),options:[{value:"any",label:"Any seller"},{value:"only",label:"Only these"}]}),a.allowMode==="only"&&t.jsxs(t.Fragment,{children:[t.jsx(J,{label:"Allowed sellers",value:a.allowedPeerIds,onChange:i=>l("allowedPeerIds",i),peers:n.data}),o.allowedPeerIds&&t.jsx("p",{className:"gc-warn",children:o.allowedPeerIds}),a.allowedPeerIds.length===0&&t.jsx("p",{className:"gc-fineprint",children:"With no sellers listed, any seller may serve."})]}),t.jsx(J,{label:"Blocked sellers",value:a.blockedPeerIds,onChange:i=>l("blockedPeerIds",i),peers:n.data}),o.blockedPeerIds&&t.jsx("p",{className:"gc-warn",children:o.blockedPeerIds}),t.jsx("p",{className:"gc-fineprint",children:"Blocked here means blocked for every key."})]}),t.jsxs("section",{className:"gc-policy__section",children:[t.jsx("h3",{children:"Quality and ranking"}),t.jsx(Ue,{label:"Minimum trust score",info:t.jsx(qe,{}),clearable:!1,value:a.minTrustScore,onChange:i=>l("minTrustScore",i),hint:"Keys can raise it, not lower it."}),a.minReputation!=="0"&&a.minReputation!==""&&t.jsxs("p",{className:"gc-fineprint",children:["The buyer also asks for reputation ",a.minReputation," or more, an older score the trust score replaces."," ",t.jsx(v,{variant:"link",size:"sm",onClick:()=>l("minReputation","0"),children:"Remove it"})]}),t.jsx("div",{className:"gc-policy__switches",children:t.jsx(I,{checked:a.preferFree,onChange:i=>l("preferFree",i),label:"Free sellers first"})}),x("softInputCap","Soft input price limit $/M",{hint:"Pricier sellers rank lower; none is excluded.",className:"gc-num gc-num--wide"})]})]}),t.jsxs("div",{className:"gc-policy__advanced",children:[t.jsxs(A,{title:"Price caps",summary:ue,children:[t.jsx("p",{className:"gc-fineprint",children:"Hard limits for every request, pinned sellers included."}),t.jsxs("div",{className:"gc-policy__caps",children:[x("maxInput","Input $/M",{hint:C("maxPricing.inputUsdPerMillion")}),x("maxOutput","Output $/M",{hint:C("maxPricing.outputUsdPerMillion")}),x("maxCached","Cached input $/M",{placeholder:"Same as input"})]})]}),t.jsxs(A,{title:"Verification",summary:de,children:[C("verifier"),t.jsxs("div",{className:"gc-policy__switches",children:[t.jsx(I,{checked:a.verify,onChange:i=>l("verify",i),label:"Verify sellers"}),t.jsx(I,{checked:a.verify&&a.requireVerified,disabled:!a.verify,onChange:i=>l("requireVerified",i),label:"Require verification"})]}),t.jsx(O,{size:"sm",label:"Verifiers",value:a.verifiers,disabled:!a.verify,placeholder:"Seller's trusted default",hint:"Ordered, comma-separated verifier ids, e.g. TEE attestation.",onChange:i=>l("verifiers",i.target.value)}),t.jsxs("div",{className:"gc-policy__caps",children:[x("sampleRate","Evidence sample rate",{placeholder:"Default",hint:"Share of responses kept, 0 to 1."}),x("maxSampleBytes","Largest sample (bytes)",{placeholder:"Default",className:"gc-num gc-num--wide"})]})]}),t.jsxs(A,{title:"Payments",summary:me,children:[t.jsx(I,{checked:a.autoSweep,onChange:i=>l("autoSweep",i),label:"Sweep deposits automatically",description:"Move USDC that arrives in the workspace wallets into their deposits."}),t.jsxs("div",{className:"gc-policy__caps",children:[x("maxPerRequest","Max per request (USDC)",{className:"gc-num gc-num--wide"}),x("maxReserve","Max channel reserve (USDC)",{className:"gc-num gc-num--wide"})]}),t.jsx(O,{size:"sm",label:"Base RPC URL",value:a.rpcUrl,error:o.rpcUrl,placeholder:"Chain default",hint:ce("payments.rpcUrl","Your own endpoint avoids public rate limits. Saved URLs show without their path; leave them as they are to keep them."),onChange:i=>l("rpcUrl",i.target.value)}),t.jsx(ie,{label:"Fallback RPC URLs",rows:2,mono:!0,value:a.fallbackRpcUrls,error:o.fallbackRpcUrls,hint:"One per line, tried in order.",onChange:i=>l("fallbackRpcUrls",i.target.value)})]}),t.jsxs(A,{title:"Network and timeouts",summary:`Refresh ${Math.round(Number(a.peerRefreshMs)/1e3)} s`,children:[t.jsxs("div",{className:"gc-policy__caps",children:[x("peerRefreshMs","Peer refresh (ms)",{className:"gc-num gc-num--wide"}),x("metadataTimeoutMs","Metadata timeout (ms)",{className:"gc-num gc-num--wide",hint:C("network.metadataFetchTimeoutMs")}),x("requestTimeoutMs","Response start timeout (ms)",{className:"gc-num gc-num--wide"}),x("maxStreamMs","Longest stream (ms)",{className:"gc-num gc-num--wide",hint:C("network.maxStreamDurationMs")})]}),t.jsx(I,{checked:a.perServiceMetadata,onChange:i=>l("perServiceMetadata",i),label:"Per-service attribution in signed metadata",description:C("network.disableMetadataV2Services")??"Tells sellers which service each request used."})]})]})]}),S&&t.jsxs($,{tone:"warning",title:"Restart the buyer to apply",children:["Saved, but this buyer was not restarted automatically. Restart it (for example ",t.jsx("code",{children:"systemctl restart antseed-buyer"}),", or stop and start ",t.jsx("code",{children:"antseed buyer start"}),") to use the new settings."]}),b&&t.jsx($,{tone:"warning",title:"Changed elsewhere",action:t.jsxs("div",{className:"gc-inline gc-inline--wrap",children:[t.jsx(v,{size:"sm",variant:"outline",onClick:()=>m(b),children:"Reload"}),t.jsx(v,{size:"sm",variant:"ghost",onClick:()=>{P(b),j(null)},children:"Keep editing"})]}),children:"Someone saved the buyer settings while you were editing them. Reload to see their version (your edits are dropped), or keep editing and save to replace it."}),!f&&y.error?t.jsx(D,{error:y.error,title:"Could not save"}):null,t.jsxs("div",{className:"gc-actions",children:[t.jsx("span",{className:"gc-fineprint gc-actions__note",children:U.length===0?"No changes.":_?"Saving restarts the buyer.":"Applies at once, without a restart."}),t.jsx(v,{variant:"ghost",disabled:U.length===0||y.isPending,onClick:()=>m(b??k),children:"Reset"}),t.jsx(v,{disabled:U.length===0||Object.keys(o).length>0||y.isPending,onClick:()=>_?p(!0):y.mutate(),children:y.isPending?"Saving…":"Save"})]}),t.jsx(ne,{isOpen:f,busy:y.isPending,error:y.error,onClose:()=>{p(!1),y.reset()},onConfirm:()=>y.mutate(),title:"Restart the buyer?",confirmLabel:"Save and restart",tone:"primary",body:"These changes need a buyer restart. Requests in flight finish first; new requests wait a few seconds while it reconnects."})]})}const Ge=["general","buyer","observability","tokens","auth"];function Je(){const e=Se();return t.jsx(F,{title:"Gateway",children:t.jsx(z,{query:e,children:s=>t.jsx(ae,{items:[["Public URL",s.publicUrl?t.jsx(we,{children:s.publicUrl},"u"):t.jsx("span",{className:"gc-muted",children:"Not set. Clients use this console's address."})],["Buyer",s.buyer.reachable?t.jsx(M,{tone:"success",children:"Connected"},"b"):t.jsx(M,{tone:"danger",children:"Unreachable"},"b")],["Sellers seen",String(s.buyer.peers)],["Spend feed",s.spendFeed],["USDC top-ups (x402)",s.x402?"On":"Off"]]})})})}function Ye({settings:e}){const s=e.buyer;return t.jsx(F,{title:"Buyer",description:t.jsxs(t.Fragment,{children:["The top of every routing policy: workspaces, members, keys and presets can only narrow it. Saved to the config file of the buyer on port ",s.proxyPort,oe(s.overrides,"proxyPort")?" (set by its start flags)":"","."]}),children:t.jsx(We,{buyer:s})})}function Xe({settings:e}){const s=te(),r=se(),n=e.observability,[c,u]=d.useState(n.otlpEndpoint??""),[a,h]=d.useState($e(n.otlpHeaders)),[k,P]=d.useState(n.logContent),[b,j]=d.useState(n.retentionDays===null?"":String(n.retentionDays)),f=c.trim()&&!/^https?:\/\/\S+$/.test(c.trim())?"Use an http:// or https:// URL.":void 0,p=Le(n.otlpEndpoint,c.trim()||null)?_e(a):[],S=p.length?`Enter the value of ${p.join(", ")} again: saved values are not sent to a new endpoint.`:void 0,g=re({mutationFn:()=>{if(f)throw new Error(f);if(S)throw new Error(S);const l=b===""?null:Number(b);return E.settings.setObservability({otlpEndpoint:c.trim()||null,otlpHeaders:De(a),logContent:k,retentionDays:l})},onSuccess:l=>{const{restartRequired:m,...o}=l;s.setQueryData(T.settings,o),r(m?"Observability saved. Restart the gateway to apply it.":"Observability saved")},onError:l=>{Te(l,"otlp_headers_required")&&h(Y(a))}});return t.jsx(F,{title:"Observability",description:"Send one OpenTelemetry trace per request, and choose what the request log keeps.",children:t.jsxs("form",{className:"gc-stack",onSubmit:l=>{l.preventDefault(),g.mutate()},children:[t.jsx(O,{label:"OTLP/HTTP endpoint",placeholder:"https://otel.example.com/v1/traces",value:c,error:f,onChange:l=>u(l.target.value)}),t.jsx(ie,{label:"Headers",rows:3,mono:!0,placeholder:"Authorization: Bearer …",value:a,onChange:l=>h(l.target.value),error:S,hint:"One per line, as Name: value. Saved values show as ••••; leave them as they are to keep them (for the same endpoint only)."}),p.length>0&&t.jsx("div",{children:t.jsx(v,{size:"sm",variant:"outline",onClick:()=>h(Y(a)),children:"Clear saved values to re-enter them"})}),t.jsx(I,{checked:k,onChange:P,label:"Store request and response bodies",description:"Off by default. Bodies can contain personal data; only turn this on if you need it."}),t.jsx(B,{label:"Keep the request log for",value:b,onChange:j,options:[{value:"7",label:"7 days"},{value:"30",label:"30 days"},{value:"90",label:"90 days"},{value:"365",label:"1 year"},{value:"",label:"Forever"}]}),g.error?t.jsx(D,{error:g.error,title:"Could not save"}):null,t.jsx("div",{className:"gc-actions",children:t.jsx(v,{type:"submit",disabled:g.isPending,children:g.isPending?"Saving…":"Save"})})]})})}function Ze(){const{me:e}=ke(),s=e.member.orgRole==="owner",r=Pe(),[n,c]=d.useState(!1),[u,a]=d.useState(""),[h,k]=d.useState("read"),[P,b]=d.useState("90"),[j,f]=d.useState(null),[p,S]=d.useState(null),g=K({mutationFn:()=>E.adminTokens.create(u.trim(),h,P==="never"?null:Number(P)),onSuccess:m=>{c(!1),a(""),f(m.secret)},invalidate:[T.adminTokens]}),l=K({mutationFn:m=>E.adminTokens.revoke(m.id),onSuccess:()=>S(null),invalidate:[T.adminTokens]});return t.jsxs(F,{flush:!0,title:"Management tokens",description:t.jsxs(t.Fragment,{children:["For scripts and CI. Send as ",t.jsx("code",{children:"Authorization: Bearer …"})," to ",t.jsx("code",{children:"/console/api"}),"."]}),actions:t.jsx(v,{size:"sm",leadingIcon:t.jsx(W.plus,{size:14}),onClick:()=>c(!0),children:"New token"}),children:[t.jsx(z,{query:r,children:m=>t.jsx(Ae,{label:"Management tokens",rows:m,rowKey:o=>o.id,rowLabel:o=>o.label,actions:o=>[{label:"Revoke",tone:"danger",onSelect:()=>S(o)}],empty:t.jsx(Me,{icon:t.jsx(W.keys,{size:18}),title:"No management tokens"}),columns:[{key:"label",header:"Name",render:o=>t.jsx(Re,{name:o.label,hint:o.hint})},{key:"scope",header:"Scope",render:o=>o.scope==="admin"?t.jsx(M,{tone:"warning",children:"Admin"}):t.jsx(M,{children:"Read only"})},{key:"created",header:"Created",secondary:!0,optional:!0,render:o=>Q(o.createdAt)},{key:"expires",header:"Expires",secondary:!0,render:o=>t.jsx(Ne,{at:o.expiresAt,format:Q})},{key:"used",header:"Last used",secondary:!0,optional:!0,render:o=>Ce(o.lastUsedAt)}]})}),t.jsx(G,{isOpen:n,onClose:()=>c(!1),title:"New management token",children:t.jsxs("form",{className:"gc-stack",onSubmit:m=>{m.preventDefault(),g.mutate()},children:[t.jsx(O,{label:"Name",required:!0,value:u,onChange:m=>a(m.target.value),placeholder:"e.g. Terraform"}),t.jsx(B,{label:"Scope",value:h,onChange:m=>k(m),options:[{value:"read",label:"Read only (GET requests)"},{value:"admin",label:"Admin (everything an org admin can do)"}]}),t.jsx(B,{label:"Expires after",value:P,onChange:b,options:[{value:"30",label:"30 days"},{value:"90",label:"90 days"},{value:"365",label:"1 year"},...s?[{value:"never",label:"Never"}]:[]],hint:"Short-lived tokens limit the damage if one leaks."}),g.error?t.jsx(D,{error:g.error,title:"Could not create the token"}):null,t.jsxs("div",{className:"gc-actions",children:[t.jsx(v,{variant:"ghost",onClick:()=>c(!1),children:"Cancel"}),t.jsx(v,{type:"submit",disabled:g.isPending||!u.trim(),children:"Create token"})]})]})}),t.jsx(G,{isOpen:j!==null,onClose:()=>f(null),title:"Token created",children:j&&t.jsxs("div",{className:"gc-stack",children:[t.jsx(Ie,{secret:j}),t.jsx("div",{className:"gc-actions",children:t.jsx(v,{onClick:()=>f(null),children:"Done"})})]})}),t.jsx(ne,{isOpen:p!==null,busy:l.isPending,error:l.error,onClose:()=>S(null),onConfirm:()=>p&&l.mutate(p),title:"Revoke this token?",confirmLabel:"Revoke",body:`Anything using ${(p==null?void 0:p.label)??"this token"} loses access immediately.`})]})}function et({settings:e}){const s=e.auth,r=n=>n?t.jsx(M,{tone:"success",children:"On"}):t.jsx(M,{children:"Off"});return t.jsx(F,{title:"Sign-in methods",description:"Configured on the gateway host with environment variables. Read only here.",children:t.jsxs("div",{className:"gc-stack",children:[t.jsx(ae,{items:[["Passkeys",r(s.passkey)],["Wallet (Sign-In with Ethereum)",r(s.wallet)],["OpenID Connect",s.oidc?t.jsx(M,{tone:"success",children:s.oidc.label},"o"):r(!1)],["Cloudflare Access",r(s.cloudflareAccess)],["API key view for key holders",r(s.apiKeyLogin)]]}),t.jsx($,{tone:"info",title:"Using your own identity provider",children:"Set the OpenID Connect issuer, client id and secret in the gateway's environment and restart it, or put the console behind Cloudflare Access and enable trusted Access headers. The gateway docs list the exact variables. Antseed runs no sign-in service of its own."})]})})}function tt({tab:e,settings:s}){return e==="buyer"?t.jsx(Ye,{settings:s}):e==="observability"?t.jsx(Xe,{settings:s}):t.jsx(et,{settings:s})}function pt(){const[e,s]=d.useState(()=>{const n=new URLSearchParams(window.location.search).get("tab");return Ge.includes(n)?n:"general"}),r=fe({queryKey:T.settings,queryFn:E.settings.get});return d.useEffect(()=>{var n;(n=window.scrollTo)==null||n.call(window,0,0)},[e]),t.jsxs("div",{className:"gc-page",children:[t.jsx(ye,{title:"Settings"}),t.jsx(Ee,{id:"gc-settings",label:"Settings sections",value:e,onChange:s,tabs:[{id:"general",label:"General"},{id:"buyer",label:"Buyer"},{id:"observability",label:"Observability"},{id:"tokens",label:"Management tokens"},{id:"auth",label:"Sign-in"}]}),t.jsxs(Fe,{tabsId:"gc-settings",tab:e,className:"gc-stack",children:[e==="general"&&t.jsxs(t.Fragment,{children:[t.jsx(Je,{}),t.jsx(je,{})]}),e==="tokens"&&t.jsx(Ze,{}),(e==="buyer"||e==="observability"||e==="auth")&&t.jsx(z,{query:r,children:n=>t.jsx(tt,{tab:e,settings:n})}),r.error&&e==="general"?t.jsx(D,{error:r.error}):null]})]})}export{pt as default};
@@ -1 +1 @@
1
- import{bk as c,al as l,r as o,j as n,W as u}from"./index-cESr4Zze.js";const m={text:"Text",image:"Image",video:"Video",decision:"Decision"},g={toolUse:"Tool use",reasoning:"Reasoning",structuredOutput:"Structured output",vision:"Vision"};function p(i,s){const t=s.trim().toLowerCase(),r=i??[];return r.find(a=>a.id.toLowerCase()===t)??r.find(a=>a.aliases.some(e=>e.toLowerCase()===t))??null}function f(i){if(i.usdPerImage)return i.usdPerImage.max===0?"Free":`${c(i.usdPerImage)} per image`;const{inputUsdPerMillion:s,outputUsdPerMillion:t}=i;return s===null&&t===null?i.free?"Free":"No price advertised":(s??0)===0&&(t??0)===0?"Free":`${l(s)} in · ${l(t)} out /M`}function x({list:i,panel:s,onClose:t,closeLabel:r="Close panel"}){const a=o.useRef(null);s&&(a.current=s);const e=s??a.current;return n.jsxs(n.Fragment,{children:[i,n.jsx(u,{isOpen:s!==null,onClose:t,closeLabel:r,className:"gc-side-panel",title:(e==null?void 0:e.title)??"",subtitle:e==null?void 0:e.subtitle,eyebrow:e==null?void 0:e.eyebrow,actions:e==null?void 0:e.actions,children:e==null?void 0:e.body})]})}function _({title:i,actions:s,children:t}){return n.jsxs("section",{className:"gc-panel-section",children:[n.jsxs("div",{className:"gc-panel-section__head",children:[n.jsx("h3",{className:"gc-panel-section__title",children:i}),s&&n.jsx("div",{className:"gc-panel-section__actions",children:s})]}),t]})}function j({title:i,meta:s,badges:t,actions:r,selected:a}){return n.jsxs("li",{className:a?"gc-panel-row gc-panel-row--on":"gc-panel-row",children:[n.jsxs("div",{className:"gc-panel-row__main",children:[n.jsx("div",{className:"gc-panel-row__title",children:i}),s&&n.jsx("div",{className:"gc-panel-row__meta",children:s}),t]}),r&&n.jsx("div",{className:"gc-panel-row__actions",children:r})]})}export{g as C,m as M,_ as P,x as S,j as a,p as f,f as p};
1
+ import{b2 as c,b4 as l,r as o,j as n,W as u}from"./index-DPXW_JSn.js";const m={text:"Text",image:"Image",video:"Video",decision:"Decision"},g={toolUse:"Tool use",reasoning:"Reasoning",structuredOutput:"Structured output",vision:"Vision"};function p(i,s){const t=s.trim().toLowerCase(),a=i??[];return a.find(r=>r.id.toLowerCase()===t)??a.find(r=>r.aliases.some(e=>e.toLowerCase()===t))??null}function f(i){if(i.usdPerImage)return i.usdPerImage.max===0?"Free":`${c(i.usdPerImage)} per image`;const{inputUsdPerMillion:s,outputUsdPerMillion:t}=i;return s===null&&t===null?i.free?"Free":"No price advertised":(s??0)===0&&(t??0)===0?"Free":`${l(s)} in · ${l(t)} out /M`}function x({list:i,panel:s,onClose:t,closeLabel:a="Close panel"}){const r=o.useRef(null);s&&(r.current=s);const e=s??r.current;return n.jsxs(n.Fragment,{children:[i,n.jsx(u,{isOpen:s!==null,onClose:t,closeLabel:a,className:"gc-side-panel",title:(e==null?void 0:e.title)??"",subtitle:e==null?void 0:e.subtitle,eyebrow:e==null?void 0:e.eyebrow,actions:e==null?void 0:e.actions,children:e==null?void 0:e.body})]})}function _({title:i,actions:s,children:t}){return n.jsxs("section",{className:"gc-panel-section",children:[n.jsxs("div",{className:"gc-panel-section__head",children:[n.jsx("h3",{className:"gc-panel-section__title",children:i}),s&&n.jsx("div",{className:"gc-panel-section__actions",children:s})]}),t]})}function j({title:i,meta:s,badges:t,actions:a,selected:r}){return n.jsxs("li",{className:r?"gc-panel-row gc-panel-row--on":"gc-panel-row",children:[n.jsxs("div",{className:"gc-panel-row__main",children:[n.jsx("div",{className:"gc-panel-row__title",children:i}),s&&n.jsx("div",{className:"gc-panel-row__meta",children:s}),t]}),a&&n.jsx("div",{className:"gc-panel-row__actions",children:a})]})}export{g as C,m as M,_ as P,x as S,j as a,p as f,f as p};
@@ -1 +1 @@
1
- import{R as r,j as s,P as d,O as l,y as p}from"./index-cESr4Zze.js";import{S as m,P as g,a as c,N as S}from"./StakingDashboard-C5Ib_AUs.js";import{T as b,a as k}from"./Tabs-Cv10NtDy.js";import"./en_US-Y4ZOVFV4-sKQksBWU.js";import"./clsx-B-dksMZM.js";import"./index-BhwNCc8y.js";import"./sendTransaction-Cmz5eiPq.js";import"./waitForCallsStatus-DlpsNYx1.js";import"./writeContract-Cqg_OlRQ.js";import"./ChainGate-DpChfDOP.js";import"./roving-DkptacxO.js";const u=new Map(S.flatMap(a=>a.items.map(t=>[t.id,t.label]))),i=g.filter(a=>c[a]==="staking").map(a=>({id:a,label:u.get(a)??a})),x=i.map(a=>a.id),o="gc-staking";function L(){var n;const a=r(),t=((n=i.find(e=>e.id===a.rest[0]))==null?void 0:n.id)??i[0].id;return s.jsxs("div",{className:"gc-page",children:[s.jsx(d,{title:"Staking",description:s.jsxs(s.Fragment,{children:["Stake ANTS into seller pools and manage your positions, signed with your wallet. Staking rewards are on ",s.jsx(l,{to:"rewards",children:"Rewards"}),"."]})}),s.jsx(b,{id:o,label:"Staking",value:t,onChange:e=>p(`staking/${e}`),tabs:i}),s.jsx(k,{tabsId:o,tab:t,children:s.jsx(m,{pages:x,buyerRewards:!0})})]})}export{L as default};
1
+ import{R as r,j as s,P as d,O as l,y as p}from"./index-DPXW_JSn.js";import{S as m,P as g,a as c,N as S}from"./StakingDashboard-DvLxJ1j4.js";import{T as b,a as k}from"./Tabs-CCabxVNK.js";import"./en_US-Y4ZOVFV4-Bkc-z49M.js";import"./clsx-B-dksMZM.js";import"./index-BhwNCc8y.js";import"./sendTransaction-k8aDYfd4.js";import"./waitForCallsStatus-C51Vv8Tt.js";import"./writeContract-CaMlmKcK.js";import"./ChainGate-Do1wYOPQ.js";import"./roving-DkptacxO.js";const u=new Map(S.flatMap(a=>a.items.map(t=>[t.id,t.label]))),i=g.filter(a=>c[a]==="staking").map(a=>({id:a,label:u.get(a)??a})),x=i.map(a=>a.id),o="gc-staking";function L(){var n;const a=r(),t=((n=i.find(e=>e.id===a.rest[0]))==null?void 0:n.id)??i[0].id;return s.jsxs("div",{className:"gc-page",children:[s.jsx(d,{title:"Staking",description:s.jsxs(s.Fragment,{children:["Stake ANTS into seller pools and manage your positions, signed with your wallet. Staking rewards are on ",s.jsx(l,{to:"rewards",children:"Rewards"}),"."]})}),s.jsx(b,{id:o,label:"Staking",value:t,onChange:e=>p(`staking/${e}`),tabs:i}),s.jsx(k,{tabsId:o,tab:t,children:s.jsx(m,{pages:x,buyerRewards:!0})})]})}export{L as default};