tokentracker-cli 0.96.3 → 0.97.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/dist/assets/{AchievementBadge-BX4iBBYM.js → AchievementBadge-BdvqY4Qb.js} +1 -1
- package/dashboard/dist/assets/{AchievementsPage-DRYRuCbh.js → AchievementsPage-CrqvRxnb.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-BM_JWWhJ.js → AchievementsSection-wyLAM9N7.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-DxoxXst2.js → BadgeDetailModal-CquST3dj.js} +1 -1
- package/dashboard/dist/assets/{BotAnimated-BVpFxG8u.js → BotAnimated-EXhdUHSg.js} +1 -1
- package/dashboard/dist/assets/{Card-BJJs701t.js → Card-Il2WWgOG.js} +1 -1
- package/dashboard/dist/assets/{ClawdAnimated-46wPZ_Tc.js → ClawdAnimated-DioF5wa-.js} +2 -2
- package/dashboard/dist/assets/{CommandPalette-B_zkc7IU.js → CommandPalette-CaDx06tM.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-M2k5rIf1.js → CommunityStatsModal-BbYWzM07.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-DBvOTcAQ.js → ConfirmModal-BHWQLUCM.js} +1 -1
- package/dashboard/dist/assets/{Controls-BCkjPMSH.js → Controls--LFhExZX.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-3bHhou09.js → DashboardPage-DuqJOpHL.js} +1 -1
- package/dashboard/dist/assets/{DevicePage-DFBUce8C.js → DevicePage-RKTirqz0.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-kvDd8h3V.js → DialogClose-DPFsTKmJ.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-DgaV8Gtk.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-DL5nvD31.js → DialogTitle-DolLpmFL.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-B-Bg6SEy.js → FadeIn-92GGNCPe.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-BExz0hh4.js → HeaderGithubStar-GfXudotT.js} +1 -1
- package/dashboard/dist/assets/{HoverTooltip-Dj5zemYT.js → HoverTooltip-n7gbPEsq.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-DN7FuJ_v.js → IpCheckPage-BaQOTbXi.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-9dKgSBRy.js → LandingPage-D3JcvxW_.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardAvatar-00V95XIg.js → LeaderboardAvatar-tVaWJXZ3.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-DkKfUt0Z.js → LeaderboardPage-NqHcStnk.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProfileModal-C9sIHBgN.js → LeaderboardProfileModal-DmvcCVS7.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-BAiLMsEb.js → LeaderboardProfilePage-VSv3IlzS.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-BuenTaHa.js → LimitsPage-CtxgT20z.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-CKhY27Lr.js → LocalOnlyNotice-O9o586G8.js} +1 -1
- package/dashboard/dist/assets/{LoginCard-BbvoBx5N.js → LoginCard-JCejigVu.js} +1 -1
- package/dashboard/dist/assets/{LoginModal-P7zIkBhO.js → LoginModal-CJ3g7tBc.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-Bo0bR26x.js → LoginPage-DPWzPywx.js} +1 -1
- package/dashboard/dist/assets/{PetPage-C6i9bSSl.js → PetPage-MSJ3jseK.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-h0gf36vg.js → PopoverPopup-nL3YOLPO.js} +1 -1
- package/dashboard/dist/assets/{ProviderIcon-Dm8fwPdj.js → ProviderIcon-C5RX_xPk.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-DvSJ8kg0.js → ResetPasswordPage-DW_NCwA_.js} +1 -1
- package/dashboard/dist/assets/{SegmentedControl-CP7oiGZE.js → SegmentedControl-CS6wQtck.js} +1 -1
- package/dashboard/dist/assets/{Select-iwP92x9C.js → Select-YqlqvbT5.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-DzljA15_.js → SelectItemText-BahqsiIc.js} +1 -1
- package/dashboard/dist/assets/{ServiceStatusPage-uD4D0Tid.js → ServiceStatusPage-DyhutLUy.js} +1 -1
- package/dashboard/dist/assets/{SessionsPage-Cmb1ssNP.js → SessionsPage-wbvi4EHi.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-D8ryg1Pv.js → SettingsPage-HGSwpV1O.js} +2 -2
- package/dashboard/dist/assets/SkillsPage-BbVT9oyh.js +1 -0
- package/dashboard/dist/assets/{TokenGalaxy-f2djrlUv.js → TokenGalaxy-Cej6MLu6.js} +1 -1
- package/dashboard/dist/assets/{ToolbarRootContext-CDxCPYLv.js → ToolbarRootContext-D9pPY73U.js} +1 -1
- package/dashboard/dist/assets/{TrendMonitor-C419X22G.js → TrendMonitor-BtBcCjx-.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-AYq__pOO.js → WidgetsPage-BSNl2WIL.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-Bsm9k5XI.js → WrappedPage-d5oiNV4T.js} +1 -1
- package/dashboard/dist/assets/{__vite-browser-external-BDkeh90N.js → __vite-browser-external-CjrP5KfC.js} +12 -12
- package/dashboard/dist/assets/{agent-logos-B6Vg-4_1.js → agent-logos-CCVzO3uU.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-DIQXwaOD.js → arrow-up-right-AKItXMyh.js} +1 -1
- package/dashboard/dist/assets/{check-CgD_bV39.js → check-BQw5n0V0.js} +1 -1
- package/dashboard/dist/assets/{composite-BIgEqWZD.js → composite-CWz1s64R.js} +1 -1
- package/dashboard/dist/assets/{copy-DlM1BHdp.js → copy-CF8XNmv3.js} +1 -1
- package/dashboard/dist/assets/{download-CQFG-VIY.js → download-BZvLU_hD.js} +1 -1
- package/dashboard/dist/assets/{external-link-BQyDqGxz.js → external-link-bZrcVkeE.js} +1 -1
- package/dashboard/dist/assets/{flame-BamzyXzF.js → flame-CMHolW1z.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-C4G-_xYt.js → format-tokens-Bs2YotMr.js} +1 -1
- package/dashboard/dist/assets/{icons-Ntscvl1a.js → icons-OKyij2y_.js} +1 -1
- package/dashboard/dist/assets/{index-DGxgsNoQ.js → index-C8nY1OaT.js} +1 -1
- package/dashboard/dist/assets/{index-FRIt5mlv.js → index-CN7xY7j_.js} +1 -1
- package/dashboard/dist/assets/{index-CUrcPqgp.js → index-DOwPCQx2.js} +1 -1
- package/dashboard/dist/assets/{info-CXytWcZi.js → info-CU7bMBhU.js} +1 -1
- package/dashboard/dist/assets/{link-2-Dexoo_jO.js → link-2-wwoUOujz.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-Cn0JHc8t.js → loader-circle-BK3Ltc-j.js} +1 -1
- package/dashboard/dist/assets/{maximize-2-DLh7gYuP.js → maximize-2-DIPnLqR8.js} +1 -1
- package/dashboard/dist/assets/{modifiers.esm-DOh_xtyt.js → modifiers.esm-D_aVVjx5.js} +1 -1
- package/dashboard/dist/assets/{monitor-smartphone-CpqS9Ior.js → monitor-smartphone-4NOM9BHb.js} +1 -1
- package/dashboard/dist/assets/{plus-bfQV7nyv.js → plus-JqSTJ28Y.js} +1 -1
- package/dashboard/dist/assets/{provider-display-Bf9pW06U.js → provider-display-CEFlg9ho.js} +1 -1
- package/dashboard/dist/assets/{react-BmFZKA_b.js → react-jS0-5kwE.js} +1 -1
- package/dashboard/dist/assets/{search-l3jJ2fzC.js → search-CbBetPN7.js} +1 -1
- package/dashboard/dist/assets/{skills-api-CWmLnaxn.js → skills-api-PwUMTdmV.js} +1 -1
- package/dashboard/dist/assets/{sortable.esm-DLgyXLHM.js → sortable.esm-BDdw7tkz.js} +1 -1
- package/dashboard/dist/assets/{store-JM-a8ElZ.js → store-CFdu9yv_.js} +1 -1
- package/dashboard/dist/assets/{terminal-6aY2Sn8P.js → terminal-Dh7Sh6IG.js} +1 -1
- package/dashboard/dist/assets/{trash-D5oon5pT.js → trash-B6_OaEVL.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-ZWUMFwzc.js → use-community-stats-D55oU9bu.js} +1 -1
- package/dashboard/dist/assets/{use-latest-request-guard-BDaXr4gK.js → use-latest-request-guard-BO89yQ3n.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-yXXToNIc.js → use-limits-display-prefs-C358N7B0.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-C6RG8N6c.js → use-ordered-list-B9ZYDS1K.js} +1 -1
- package/dashboard/dist/assets/use-reduced-motion-DWHVI51t.js +1 -0
- package/dashboard/dist/assets/{use-session-efficiency-pref-DpgZO_Lx.js → use-session-efficiency-pref-CwGRDyVq.js} +1 -1
- package/dashboard/dist/assets/{use-transform-D42P7jkd.js → use-transform-9S4Ruq_s.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-CV6puFwq.js → use-usage-limits-CpnM5V06.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-GWBmOrCR.js → useCurrency-BKJGW_4l.js} +1 -1
- package/dashboard/dist/assets/{useTokenFormat-Beybkb0v.js → useTokenFormat-CTB5svOB.js} +1 -1
- package/dashboard/dist/assets/{zap-CEq2616W.js → zap-DGdBuT6m.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/ip-check.html +1 -1
- package/dashboard/dist/leaderboard.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/src/lib/codex-rollout-parser.js +48 -1
- package/src/lib/codex-service-tier.js +49 -0
- package/src/lib/local-api.js +5 -0
- package/src/lib/pricing/curated-overrides.json +2 -1
- package/src/lib/pricing/index.js +61 -3
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/rollout.js +83 -2
- package/src/lib/session-analytics.js +11 -0
- package/src/lib/skills-manager.js +226 -30
- package/dashboard/dist/assets/DialogDescription-BMyOicfz.js +0 -1
- package/dashboard/dist/assets/SkillsPage-eXI09q03.js +0 -1
- package/dashboard/dist/assets/use-reduced-motion-BqDKim_3.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as c}from"./__vite-browser-external-
|
|
1
|
+
import{m as c}from"./__vite-browser-external-CjrP5KfC.js";const e=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],o=c("search",e);export{o as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{O as E,P as I,Q as R,S as $}from"./__vite-browser-external-
|
|
1
|
+
import{O as E,P as I,Q as R,S as $}from"./__vite-browser-external-CjrP5KfC.js";function s(e){return typeof e=="string"?e.trim():""}function g(e){return Array.isArray(e)?[...new Set(e.map(s).filter(Boolean))]:[]}function v(e){const t=s(e).replace(/\\/g,"/");if(!t||t.startsWith("/")||/^[A-Za-z]:\//.test(t))return"";const n=t.replace(/\/+$/g,"").split("/").filter(Boolean);return!n.length||n.some(r=>r==="."||r==="..")?"":n.join("/")}function C(e){const t=s(e).replace(/\\/g,"/");return!t||t.startsWith("/")||t.includes(":/")||/[A-Za-z]:\//.test(t)?"":t}function S(e){return s(e?.key)||s(e?.id)||`local:${s(e?.directory)}`}function L(e){return(Array.isArray(e)?e:[]).filter(t=>t?.scope!=="system").map(t=>{const n=v(t?.directory),r=C(S(t));if(!r||!n)return null;const i=t?.scope==="plugin"?"plugin":t?.managed?"managed":"local",o=v(t?.sourceName);return{key:r,name:s(t?.name)||n.split("/").pop()||"Skill",directory:n,targets:g(t?.targets),managed:t?.managed===!0,readOnly:t?.readOnly===!0,scope:i,...o?{sourceName:o}:{}}}).filter(t=>!!t)}function N(e){return{id:s(e?.id),name:s(e?.device_name)||s(e?.id),platform:s(e?.platform)||null,scannedAt:s(e?.scanned_at)||null}}function m(e,t){const n=Array.isArray(e.deviceSources)?e.deviceSources:[];return n.some(r=>r.id===t.id)?e:{...e,deviceSources:[...n,t]}}function q(e,t,n){const r=(Array.isArray(e)?e:[]).filter(o=>o?.scope!=="system").map(o=>({...o})),i=new Map;r.forEach((o,a)=>i.set(S(o).toLowerCase(),a));for(const o of Array.isArray(t?.devices)?t.devices:[]){const a=N(o);if(!(!a.id||a.id===n))for(const c of Array.isArray(o?.skills)?o.skills:[]){if(c?.scope==="system")continue;const u=S(c),p=s(c?.directory);if(!u||!p)continue;const h=u.toLowerCase(),k=g(c.targets),y=i.get(h);if(y!=null){const f=r[y];if(f.remote===!0&&f.inventoryOnly===!0){const A=[...new Set([...g(f.targets),...k])],j=Object.fromEntries(A.map(U=>[U,"synced"]));r[y]=m({...f,targets:A,targetStates:j},a)}else r[y]=m(f,a);continue}const w=k,_=Object.fromEntries(w.map(f=>[f,"synced"])),b=m({id:`remote:${encodeURIComponent(u)}`,key:u,name:s(c.name)||p.split(/[\\/]/).pop()||"Skill",directory:p,description:"",targets:w,targetStates:_,managed:!1,readOnly:!0,inventoryOnly:!0,remote:!0,scope:s(c.scope)||"local",sourceName:s(c.sourceName)||null},a);i.set(h,r.length),r.push(b)}}return r.sort((o,a)=>String(o.name||o.directory).localeCompare(String(a.name||a.directory))||String(o.id||o.key).localeCompare(String(a.id||a.key)))}const T="tokentracker-skills",P="tokentracker-account-skills",J=15e3;async function d(e){const t=new URL(`/functions/${T}`,window.location.origin);if(e)for(const[i,o]of Object.entries(e))o!=null&&o!==""&&t.searchParams.set(i,String(o));const n=await fetch(t.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),r=await n.json().catch(()=>null);if(!n.ok)throw new Error(r?.error||`Request failed with HTTP ${n.status}`);return r}async function l(e){const t=await $(),n=await fetch(`/functions/${T}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...t},cache:"no-store",body:JSON.stringify(e)}),r=await n.json().catch(()=>null);if(!n.ok||r?.ok===!1)throw new Error(r?.error||`Request failed with HTTP ${n.status}`);return r}function x(){return d({mode:"installed"})}function H(e={}){return d({mode:"discover",...e.force?{force:1}:{}})}function z(e,t=0,n=20){return d({mode:"search",q:e,offset:t,limit:n})}function B(){return d({mode:"repos"})}function M(e,t){return l({action:"install",skill:e,targets:t})}function D(e){return l({action:"update_all",ids:e})}function G(e){return l({action:"uninstall",id:e})}function Q(e){return l({action:"restore",id:e})}function W(e,t){return l({action:"set_targets",id:e,targets:t})}function Z(e,t){return l({action:"import_local",directory:e,targets:t})}function F(e,t){return l({action:"delete_local",directory:e,targets:t||[]})}function V(e){return l({action:"add_repo",repo:e})}function X(e,t){return l({action:"remove_repo",owner:e,name:t})}function Y(e={}){return d({mode:"popular",...e.force?{force:1}:{}})}function ee(e={}){return d({mode:"updates",...e.force?{force:1}:{}})}function te(e={}){return d({mode:"skill_usage",...e.force?{force:1}:{}})}async function O({accessToken:e,method:t="GET",body:n}){if(!e||!E(e))throw new Error("Skills sync requires sign-in");const r=I();if(!r)throw new Error("InsForge base URL not configured");const i={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${e}`},o=R();o&&(i.apikey=o);const a=new AbortController,c=setTimeout(()=>a.abort(),J);try{const u=await fetch(`${r.replace(/\/$/,"")}/functions/${P}`,{method:t,headers:i,cache:"no-store",signal:a.signal,...n==null?{}:{body:JSON.stringify(n)}}),p=await u.json().catch(()=>null);if(!u.ok)throw new Error(p?.error||`Request failed with HTTP ${u.status}`);return p}finally{clearTimeout(c)}}function ne(e){return O({accessToken:e})}function re({accessToken:e,deviceId:t,skills:n}){return O({accessToken:e,method:"POST",body:{device_id:t,skills:L(n)}})}export{ne as a,B as b,Y as c,H as d,ee as e,te as f,x as g,F as h,M as i,W as j,Z as k,D as l,q as m,X as n,V as o,re as p,Q as r,z as s,G as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as c,d as P,a2 as Oe}from"./__vite-browser-external-
|
|
1
|
+
import{r as c,d as P,a2 as Oe}from"./__vite-browser-external-CjrP5KfC.js";function Sn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const tt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function me(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function bt(e){return"nodeType"in e}function B(e){var t,n;return e?me(e)?e:bt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function wt(e){const{Document:t}=B(e);return e instanceof t}function Be(e){return me(e)?!1:e instanceof B(e).HTMLElement}function Wt(e){return e instanceof B(e).SVGElement}function ye(e){return e?me(e)?e.document:bt(e)?wt(e)?e:Be(e)||Wt(e)?e.ownerDocument:document:document:document}const Q=tt?c.useLayoutEffect:c.useEffect;function mt(e){const t=c.useRef(e);return Q(()=>{t.current=e}),c.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function En(){const e=c.useRef(null),t=c.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ke(e,t){t===void 0&&(t=[e]);const n=c.useRef(e);return Q(()=>{n.current!==e&&(n.current=e)},t),n}function Fe(e,t){const n=c.useRef();return c.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Je(e){const t=mt(e),n=c.useRef(null),r=c.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function ft(e){const t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}let ct={};function $e(e,t){return c.useMemo(()=>{if(t)return t;const n=ct[e]==null?0:ct[e]+1;return ct[e]=n,e+"-"+n},[e,t])}function Ht(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,s)=>{const a=Object.entries(s);for(const[l,u]of a){const f=i[l];f!=null&&(i[l]=f+e*u)}return i},{...t})}}const we=Ht(1),ze=Ht(-1);function In(e){return"clientX"in e&&"clientY"in e}function yt(e){if(!e)return!1;const{KeyboardEvent:t}=B(e.target);return t&&e instanceof t}function Mn(e){if(!e)return!1;const{TouchEvent:t}=B(e.target);return t&&e instanceof t}function ht(e){if(Mn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return In(e)?{x:e.clientX,y:e.clientY}:null}const _e=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[_e.Translate.toString(e),_e.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Tt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function An(e){return e.matches(Tt)?e:e.querySelector(Tt)}const On={display:"none"};function Tn(e){let{id:t,value:n}=e;return P.createElement("div",{id:t,style:On},n)}function Nn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return P.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function Ln(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Kt=c.createContext(null);function kn(e){const t=c.useContext(Kt);c.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function zn(){const[e]=c.useState(()=>new Set),t=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const Pn={draggable:`
|
|
2
2
|
To pick up a draggable item, press the space bar.
|
|
3
3
|
While dragging, use the arrow keys to move the item.
|
|
4
4
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as r}from"./__vite-browser-external-
|
|
1
|
+
import{E as r}from"./__vite-browser-external-CjrP5KfC.js";import{F as g}from"./composite-CWz1s64R.js";function a(e,n,u=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new g({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:n,syncOnly:!0,nested:u,onOpenChange:void 0}),floatingId:n,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:r,inactiveTriggerProps:r,popupProps:r}}const o=e=>e.triggerIdProp??e.activeTriggerId,t=e=>e.openProp??e.open,i=e=>(e.popupElement?.id??e.floatingId)||void 0;function p(e,n){return n!==void 0&&t(e)&&o(e)===n}function l(e,n){return p(e,n)?!0:n!==void 0&&t(e)&&o(e)==null&&e.triggerCount===1}const c={open:t,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:o,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:i,isTriggerActive:(e,n)=>n!==void 0&&o(e)===n,isOpenedByTrigger:(e,n)=>p(e,n),isMountedByTrigger:(e,n)=>n!==void 0&&o(e)===n&&e.mounted,triggerProps:(e,n)=>n?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,n)=>l(e,n)?i(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};export{a as c,c as p};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as e}from"./__vite-browser-external-
|
|
1
|
+
import{m as e}from"./__vite-browser-external-CjrP5KfC.js";const o=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],a=e("terminal",o);export{a as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as a}from"./__vite-browser-external-
|
|
1
|
+
import{m as a}from"./__vite-browser-external-CjrP5KfC.js";const t=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],o=a("trash",t);export{o as T};
|
package/dashboard/dist/assets/{use-community-stats-ZWUMFwzc.js → use-community-stats-D55oU9bu.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as p,g as N,b as M}from"./__vite-browser-external-
|
|
1
|
+
import{r as p,g as N,b as M}from"./__vite-browser-external-CjrP5KfC.js";const D=6e3,S=2500,E=100;function h(t,r){let o;const n=new Promise((a,i)=>{o=setTimeout(()=>i(new Error("landing stats timeout")),r)});return Promise.race([t,n]).finally(()=>{o!=null&&clearTimeout(o)})}const A=5*6e4,P=1440*6e4,k="tokentracker:community-stats:v2";let s=null;function C(t){const r=Number(t?.tokenFloor)||0,o=Number(t?.totalEntries)||0;return!(r>0)||!(o>0)?null:{tokenFloor:r,totalEntries:o,top:Array.isArray(t?.top)?t.top:[],topModels:Array.isArray(t?.topModels)?t.topModels:[],providers:Array.isArray(t?.providers)?t.providers:[],dailyGrowth:Array.isArray(t?.dailyGrowth)?t.dailyGrowth:[],tokenMix:Array.isArray(t?.tokenMix)?t.tokenMix:[],userDistribution:Array.isArray(t?.userDistribution)?t.userDistribution:[],platforms:Array.isArray(t?.platforms)?t.platforms:[],activeDevelopersTotal:Number(t?.activeDevelopersTotal)||0,activeDevelopers30d:Number(t?.activeDevelopers30d)||0,tokens30d:Number(t?.tokens30d)||0,tokenGrowthPct:t?.tokenGrowthPct!=null&&Number.isFinite(Number(t.tokenGrowthPct))?Number(t.tokenGrowthPct):null,developerGrowthPct:t?.developerGrowthPct!=null&&Number.isFinite(Number(t.developerGrowthPct))?Number(t.developerGrowthPct):null,generatedAt:typeof t?.generatedAt=="string"?t.generatedAt:null}}function G(){if(typeof window>"u"||!window.localStorage)return null;try{const t=JSON.parse(window.localStorage.getItem(k)||"null"),r=Number(t?.cachedAt)||0,o=C(t?.data),n=Date.now()-r;return!o||n<0||n>P?null:{data:o,isFresh:n<A}}catch{return null}}function I(t){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(k,JSON.stringify({cachedAt:Date.now(),data:t}))}catch{}}function F(){if(s&&Date.now()-s.at<A)return s.promise;const t=Promise.all([h(N({period:"total",limit:E,offset:0}),D),h(M(),S).catch(()=>null)]);return s={at:Date.now(),promise:t},t.catch(()=>{s?.promise===t&&(s=null)}),t}function O({enabled:t=!0}={}){const[r]=p.useState(()=>G()),[o,n]=p.useState(()=>r?{status:"ready",...r.data}:{status:"loading",tokenFloor:null,totalEntries:null,top:[]});return p.useEffect(()=>{if(!t||r?.isFresh)return;let a=!1,i=null,u=null;const y=async()=>{try{const[l,e]=await F();if(a)return;const c=Array.isArray(l?.entries)?l.entries:[],b=c.reduce((m,T)=>m+(Number(T?.total_tokens)||0),0),d=Number(e?.total_tokens)||0;d>0||(s=null);const w=Number(r?.data?.tokenFloor)||0,f=d>0?d:w>0?w:b;if(!c.length||!(f>0)){n(m=>({...m,status:"error"}));return}const g=Array.isArray(e?.top_models)?e.top_models:r?.data?.topModels||[],_={tokenFloor:f,totalEntries:Number(l?.total_entries)||c.length,top:c.slice(0,3),topModels:g,providers:Array.isArray(e?.providers)?e.providers:[],dailyGrowth:Array.isArray(e?.daily_growth)?e.daily_growth:[],tokenMix:Array.isArray(e?.token_mix)?e.token_mix:[],userDistribution:Array.isArray(e?.user_distribution)?e.user_distribution:[],platforms:Array.isArray(e?.platforms)?e.platforms:[],activeDevelopersTotal:Number(e?.active_developers_total)||0,activeDevelopers30d:Number(e?.active_developers_30d)||0,tokens30d:Number(e?.tokens_30d)||0,tokenGrowthPct:e?.token_growth_pct==null?null:Number(e.token_growth_pct),developerGrowthPct:e?.developer_growth_pct==null?null:Number(e.developer_growth_pct),generatedAt:typeof e?.generated_at=="string"?e.generated_at:null};n({status:"ready",..._}),d>0&&I(_)}catch{a||n(e=>e.status==="ready"?e:{...e,status:"error"})}};return typeof window<"u"&&"requestIdleCallback"in window?i=window.requestIdleCallback(y,{timeout:1500}):u=setTimeout(y,400),()=>{a=!0,i!=null&&typeof window.cancelIdleCallback=="function"&&window.cancelIdleCallback(i),u!=null&&clearTimeout(u)}},[t,r]),o}export{O as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as u}from"./__vite-browser-external-
|
|
1
|
+
import{r as u}from"./__vite-browser-external-CjrP5KfC.js";function f(r,e){return r.length===e.length&&r.every((t,n)=>Object.is(t,e[n]))}function a(r){const e=u.useRef(r),t=u.useRef(0),n=u.useRef(!0);return u.useLayoutEffect(()=>{f(e.current,r)||(e.current=r,t.current+=1)}),u.useEffect(()=>(n.current=!0,()=>{n.current=!1,t.current+=1}),[]),u.useCallback(()=>{const c=++t.current,s=e.current;return()=>n.current&&t.current===c&&e.current===s},[])}export{a as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a,r as c,J as N,K as B,M as F,N as H}from"./__vite-browser-external-
|
|
1
|
+
import{c as a,r as c,J as N,K as B,M as F,N as H}from"./__vite-browser-external-CjrP5KfC.js";const Q=["claude","codex","cursor","gemini","kimi","kiro","grok","copilot","antigravity","zcode","opencodeGo","commandCode","qoder","qoderCn","codingPlan","agentPlan","devin"],W={claude:"CLAUDE",codex:"CODEX",cursor:"CURSOR",gemini:"GEMINI",kimi:"KIMI",kiro:"KIRO",grok:"GROK",copilot:"COPILOT",antigravity:"ANTIGRAVITY",zcode:"ZCODE",opencodeGo:"OPENCODE",commandCode:"COMMAND-CODE",qoder:"QODER",qoderCn:"QODER-CN",codingPlan:"VOLCANO-ARK",agentPlan:"VOLCANO-ARK",devin:"DEVIN"};function fe(e){return W[e]||null}function me(e){switch(e){case"claude":return a("limits.provider.claude");case"codex":return a("limits.provider.codex");case"cursor":return a("limits.provider.cursor");case"gemini":return a("limits.provider.gemini");case"kimi":return a("limits.provider.kimi");case"kiro":return a("limits.provider.kiro");case"grok":return a("limits.provider.grok");case"copilot":return a("limits.provider.copilot");case"antigravity":return a("limits.provider.antigravity");case"zcode":return a("limits.provider.zcode");case"opencodeGo":return a("limits.provider.opencode_go");case"commandCode":return a("limits.provider.command_code");case"qoder":return a("limits.provider.qoder");case"qoderCn":return a("limits.provider.qoder_cn");case"codingPlan":return a("limits.provider.ark_coding_plan");case"agentPlan":return a("limits.provider.ark_agent_plan");case"devin":return a("limits.provider.devin");default:return String(e||"")}}const m=Q,E="tt.limits.providerOrder",I="tt.limits.providerVisibility",A="tt.limits.displayMode",D="tt.limits.showSubscriptions",O="tt.limits.updatedAt",C="limitsPreferences",X="limitsDisplayMode",Z="tt:limits-prefs-changed",w=Object.freeze({USED:"used",REMAINING:"remaining"}),g=new Set(Object.values(w)),_=new Set([E,I,A,D,O]);function h(){return[...m]}const $=new Set(["devin"]);function b(){return Object.fromEntries(m.map(e=>[e,!$.has(e)]))}function L(e){const r=[];if(Array.isArray(e))for(const o of e)m.includes(o)&&!r.includes(o)&&r.push(o);for(const o of m)r.includes(o)||r.push(o);return r}function P(e){const r=b();if(!e||typeof e!="object"||Array.isArray(e))return r;for(const o of m)typeof e[o]=="boolean"&&(r[o]=e[o]);return r}function ee(e){return g.has(e)?e:w.USED}function k(e){return typeof e=="boolean"?e:!0}function S(e){if(e!=null){if(typeof e=="number")return Number.isSafeInteger(e)?e:void 0;if(typeof e=="string"){const r=e.trim();if(r==="")return;const o=Number(r);return Number.isSafeInteger(o)?o:void 0}}}function y(e={}){const r=e&&typeof e=="object"?e:{};return{displayMode:ee(r.displayMode),providerOrder:L(r.providerOrder),providerVisibility:P(r.providerVisibility),showSubscriptions:k(r.showSubscriptions),updatedAt:S(r.updatedAt)}}function re(){if(typeof window>"u")return h();try{const e=window.localStorage.getItem(E);return L(e?JSON.parse(e):void 0)}catch{return h()}}function R(){if(typeof window>"u")return b();try{const e=window.localStorage.getItem(I);return P(e?JSON.parse(e):void 0)}catch{return b()}}function Se(e){return e===null||_.has(e)}function we(){return R().devin===!0}function te(){if(typeof window>"u")return w.USED;try{const e=window.localStorage.getItem(A);return g.has(e)?e:w.USED}catch{return w.USED}}function ie(){if(typeof window>"u")return!0;try{const e=window.localStorage.getItem(D);return e===null?!0:k(JSON.parse(e))}catch{return!0}}function ne(){if(!(typeof window>"u"))try{return S(window.localStorage.getItem(O))}catch{return}}function oe(){if(typeof window>"u")return!1;try{for(const e of _)if(window.localStorage.getItem(e)!==null)return!0}catch{return!1}return!1}function v(){return y({displayMode:te(),providerOrder:re(),providerVisibility:R(),showSubscriptions:ie(),updatedAt:ne()})}function se(e){if(typeof window>"u")return;const r=y(e);try{window.localStorage.setItem(E,JSON.stringify(r.providerOrder)),window.localStorage.setItem(I,JSON.stringify(r.providerVisibility)),window.localStorage.setItem(A,r.displayMode),window.localStorage.setItem(D,JSON.stringify(r.showSubscriptions)),r.updatedAt===void 0?window.localStorage.removeItem(O):window.localStorage.setItem(O,String(r.updatedAt))}catch(o){console.warn("[tokentracker] limits preferences localStorage write failed:",o)}}function de(e){const r=y(e);return{displayMode:r.displayMode,providerOrder:[...r.providerOrder],providerVisibility:{...r.providerVisibility},showSubscriptions:r.showSubscriptions,updatedAt:r.updatedAt??null}}function ae(...e){let r;for(const d of e){const l=S(d);l!==void 0&&(r=r===void 0?l:Math.max(r,l))}const o=Date.now();return r!==void 0&&o<=r?r+1:o}function ce(e,r){return e.length===r.length&&e.every((o,d)=>o===r[d])}function ue(e,r){return m.every(o=>e[o]===r[o])}function K(e,r){return e.displayMode===r.displayMode&&ce(e.providerOrder,r.providerOrder)&&ue(e.providerVisibility,r.providerVisibility)&&e.showSubscriptions===r.showSubscriptions}function le(e,r){return K(e,r)&&S(e.updatedAt)===S(r.updatedAt)}function V(e,r){const o=S(e.updatedAt),d=S(r.updatedAt);return o!==void 0&&(d===void 0||o>d)}function ye(){const[e,r]=c.useState(v),o=c.useRef(e),d=c.useCallback((i,t={})=>{const n=y(i);return o.current=n,r(n),t.writeLocal&&se(n),typeof window<"u"&&window.dispatchEvent(new CustomEvent(Z)),n},[]),l=c.useCallback(i=>{N()&&B(C,de(i))},[]),u=c.useCallback(i=>{const t=v(),n=V(t,o.current)?d(t):o.current,s=y(i(n));if(K(n,s))return;const p=ae(t.updatedAt,n.updatedAt),f=d({...s,updatedAt:p},{writeLocal:!0});l(f)},[d,l]),T=c.useCallback(i=>{g.has(i)&&u(t=>({...t,displayMode:i}))},[u]),x=c.useCallback(i=>{u(t=>({...t,showSubscriptions:!!i}))},[u]),M=c.useCallback(i=>{if(!g.has(i))return;const t=v();if(t.updatedAt!==void 0){d(t);return}d({...t,displayMode:i,updatedAt:void 0},{writeLocal:!0})},[d]);c.useEffect(()=>{if(!N())return;const i=F(t=>{const n=t?.[C];if(n&&typeof n=="object"){const s=y(n);if(!oe()){d(s,{writeLocal:!0});return}const p=v();if(V(s,p))d(s,{writeLocal:!0});else{const f=d(p);le(s,p)||l(f)}return}M(t?.[X])});return H(),i},[M,d,l]),c.useEffect(()=>{if(typeof window>"u")return;const i=t=>{(t.key===null||_.has(t.key))&&d(v())};return window.addEventListener("storage",i),()=>window.removeEventListener("storage",i)},[d]);const U=c.useCallback(i=>{m.includes(i)&&u(t=>({...t,providerVisibility:{...t.providerVisibility,[i]:!t.providerVisibility[i]}}))},[u]),Y=c.useCallback(i=>{u(t=>{const n=t.providerOrder.indexOf(i);if(n<=0)return t;const s=[...t.providerOrder];return[s[n-1],s[n]]=[s[n],s[n-1]],{...t,providerOrder:s}})},[u]),z=c.useCallback(i=>{u(t=>{const n=t.providerOrder.indexOf(i);if(n<0||n>=t.providerOrder.length-1)return t;const s=[...t.providerOrder];return[s[n],s[n+1]]=[s[n+1],s[n]],{...t,providerOrder:s}})},[u]),q=c.useCallback((i,t)=>{i!==t&&u(n=>{const s=n.providerOrder.indexOf(i),p=n.providerOrder.indexOf(t);if(s<0||p<0)return n;const f=[...n.providerOrder],[j]=f.splice(s,1);return f.splice(p,0,j),{...n,providerOrder:f}})},[u]),G=c.useCallback(()=>{u(()=>({displayMode:w.USED,providerOrder:h(),providerVisibility:b(),showSubscriptions:!0}))},[u]),J=c.useMemo(()=>e.providerOrder.filter(i=>e.providerVisibility[i]!==!1),[e.providerOrder,e.providerVisibility]);return{order:e.providerOrder,visibility:e.providerVisibility,displayMode:e.displayMode,showSubscriptions:e.showSubscriptions,setDisplayMode:T,setShowSubscriptions:x,visibleOrdered:J,toggle:U,moveUp:Y,moveDown:z,moveToward:q,reset:G}}export{Z as L,Se as a,w as b,Q as c,fe as d,we as i,me as l,ye as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as f}from"./__vite-browser-external-
|
|
1
|
+
import{r as f}from"./__vite-browser-external-CjrP5KfC.js";function O(t){if(typeof window>"u")return null;try{const n=window.localStorage.getItem(t);if(!n)return null;const i=JSON.parse(n);return Array.isArray(i)?i.filter(o=>typeof o=="string"):null}catch{return null}}function m(t,n){if(!(typeof window>"u"))try{window.localStorage.setItem(t,JSON.stringify(n))}catch{}}function S(t,n){if(!t)return n;const i=new Set(n),o=t.filter(u=>i.has(u)),c=n.filter(u=>!o.includes(u));return[...o,...c]}function p(t,n){const i=f.useMemo(()=>n.join("|"),[n]),[o,c]=f.useState(()=>S(O(t),n));f.useEffect(()=>{c(r=>{const e=S(r,n);return e.length===r.length&&e.every((l,d)=>l===r[d])?r:(m(t,e),e)})},[i,n,t]);const u=f.useCallback((r,e)=>{!r||!e||r===e||c(s=>{const l=s.indexOf(r),d=s.indexOf(e);if(l===-1||d===-1)return s;const w=s.slice(),[h]=w.splice(l,1);return w.splice(d,0,h),m(t,w),w})},[t]),a=f.useCallback(()=>{m(t,n),c(n)},[t,n]);return{order:o,reorder:u,reset:a}}export{p as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as o}from"./__vite-browser-external-CjrP5KfC.js";import{h as r,i as t,p as s}from"./react-jS0-5kwE.js";function i(){!r.current&&t();const[e]=o.useState(s.current);return e}export{i as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as u,r as n}from"./__vite-browser-external-
|
|
1
|
+
import{m as u,r as n}from"./__vite-browser-external-CjrP5KfC.js";const f=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],E=u("pencil",f),i="tt.qualityPerDollar.enabled";function l(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(i)==="1"}catch{return!1}}function y(){const[r,o]=n.useState(l);n.useEffect(()=>{if(typeof window>"u")return;const t=e=>{(e.key===null||e.key===i)&&o(l())};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[]);const a=n.useCallback(t=>{const e=!!t;o(e);try{window.localStorage.setItem(i,e?"1":"0")}catch{}},[]),s=n.useCallback(()=>a(!l()),[a]);return{enabled:r,setEnabled:a,toggle:s}}const d="tt.sessionEfficiency.enabled";function c(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(d)==="1"}catch{return!1}}function g(){const[r,o]=n.useState(c);n.useEffect(()=>{if(typeof window>"u")return;const t=e=>{(e.key===null||e.key===d)&&o(c())};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[]);const a=n.useCallback(t=>{const e=!!t;o(e);try{window.localStorage.setItem(d,e?"1":"0")}catch{}},[]),s=n.useCallback(()=>a(!c()),[a]);return{enabled:r,setEnabled:a,toggle:s}}export{E as P,g as a,y as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as y,u as l,e as A,M as p,b as h,f as C,g as V,j as u}from"./react-
|
|
1
|
+
import{d as y,u as l,e as A,M as p,b as h,f as C,g as V,j as u}from"./react-jS0-5kwE.js";import{r as f}from"./__vite-browser-external-CjrP5KfC.js";function x(...t){const e=!Array.isArray(t[0]),n=e?0:-1,o=t[0+n],s=t[1+n],c=t[2+n],r=t[3+n],a=y(s,c,r);return e?a(o):a}function E(t){const e=l(()=>A(t)),{isStatic:n}=f.useContext(p);if(n){const[,o]=f.useState(t);f.useEffect(()=>e.on("change",o),[])}return e}function m(t,e){const n=E(e()),o=()=>n.set(e());return o(),h(()=>{const s=()=>V.preRender(o,!1,!0),c=t.map(r=>r.on("change",s));return()=>{c.forEach(r=>r()),C(o)}}),n}function L(t){u.current=[],t();const e=m(u.current,t);return u.current=void 0,e}function g(t,e,n,o){if(typeof t=="function")return L(t);const c=typeof e=="function"?e:x(e,n,o),r=Array.isArray(t)?i(t,c):i([t],([d])=>c(d)),a=Array.isArray(t)?void 0:t.accelerate;return a&&!a.isTransformed&&typeof e!="function"&&Array.isArray(n)&&o?.clamp!==!1&&(r.accelerate={...a,times:e,keyframes:n,isTransformed:!0}),r}function i(t,e){const n=l(()=>[]);return m(t,()=>{n.length=0;const o=t.length;for(let s=0;s<o;s++)n[s]=t[s].get();return e(n)})}export{g as a,E as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{J as S,ab as x,r as d,c as N,ac as O,ad as A,ae as g}from"./__vite-browser-external-BDkeh90N.js";import{l as R,i as _,L as P,a as q}from"./use-limits-display-prefs-yXXToNIc.js";import{u as z}from"./use-latest-request-guard-BDaXr4gK.js";const F="native:notificationPermission";let M=null;function I(){return typeof window<"u"&&!!window.chrome?.webview}function L(){return S()?M||"unknown":I()?"granted":typeof Notification>"u"?"unsupported":Notification.permission}function j(e){if(typeof window>"u")return()=>{};const i=n=>{const w=n?.detail?.status;typeof w=="string"&&(M=w),e(L())};return window.addEventListener(F,i),e(L()),S()&&x({type:"getNotificationStatus"}),()=>window.removeEventListener(F,i)}async function T(){if(S()){x({type:"requestNotificationPermission"});return}I()||typeof Notification<"u"&&Notification.permission==="default"&&await Notification.requestPermission().catch(()=>"denied")}const v="tt.limitAlerts.enabled";function $(){try{return window.localStorage.getItem(v)==="1"}catch{return!1}}function te(){const[e,i]=d.useState($),[n,w]=d.useState("unknown");d.useEffect(()=>j(w),[]);const u=d.useCallback(async o=>{const r=!!o;r&&await T();try{window.localStorage.setItem(v,r?"1":"0")}catch{}i(r)},[]);return{enabled:e,setEnabled:u,permissionBlocked:n==="denied"}}function B(e,i){if(!(e>0))return null;const n=(e-i)/e;return Number.isFinite(n)?Math.min(Math.max(n,0),1):null}function G(e,i,n=.03){return e>i+n}function V(e){const i=Math.max(0,Math.floor(e)),n=Math.floor(i/3600);return n>24?`${Math.floor(n/24)}d`:n>0?`${n}h`:`${Math.floor(i/60)}m`}function J(e,i){if(typeof e.windowSeconds=="number")return e.windowSeconds;if(e.windowSecondsField&&i){const n=i[e.windowSecondsField];return typeof n=="number"&&n>0?n:null}return null}function U(e){return e==null?NaN:typeof e=="number"?e*1e3:Date.parse(e)}function H({usedPercent:e,windowSeconds:i,resetMs:n,mode:w,now:u=Date.now()}){const o=Math.min(Math.max(Number(e)||0,0),100)/100,r={pacePercent:null,paceOver:!1,expectedPercent:null,runsOutEta:null,projectedEnd:null};if(!(i>0)||!Number.isFinite(n))return r;const l=Math.max(0,(n-u)/1e3),a=B(i,l);if(a==null)return r;if(r.expectedPercent=Math.round(a*100),r.paceOver=G(o,a),o>=.05){const c=w==="remaining"?1-a:a;r.pacePercent=c*100}if(a>.02&&o>0){const c=i*a,m=o/c,f=o/a;f>=1&&m>0?r.runsOutEta=V((1-o)/m):r.projectedEnd=Math.round(Math.min(f,1)*100)}return r}const W={claude:{windows(e){const i=Array.isArray(e.weekly_scoped)?e.weekly_scoped.map(n=>({key:`scoped-${n.label}`,label:n.label,window:n,pctField:"utilization",resetField:"resets_at",windowSeconds:604800})):[];return[{key:"5h",labelKey:"limits.label.claude_5h",window:e.five_hour,pctField:"utilization",resetField:"resets_at",windowSeconds:5*3600},{key:"7d",labelKey:"limits.label.claude_7d",window:e.seven_day,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},{key:"opus",labelKey:"limits.label.claude_opus",window:e.seven_day_opus,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},...i]}},codex:{extra:"codex_meta",windows(e){return[{key:"5h",labelKey:"limits.label.codex_5h",window:e.primary_window,windowSecondsField:"limit_window_seconds"},{key:"7d",labelKey:"limits.label.codex_7d",window:e.secondary_window,windowSecondsField:"limit_window_seconds"},{key:"credits",labelKey:"limits.label.codex_credits",window:e.credit_window},{key:"spark-5h",labelKey:"limits.label.codex_spark_5h",window:e.spark_primary_window,windowSecondsField:"limit_window_seconds"},{key:"spark-7d",labelKey:"limits.label.codex_spark_7d",window:e.spark_secondary_window,windowSecondsField:"limit_window_seconds"}]}},cursor:{windows(e){return[{key:"plan",labelKey:"limits.label.cursor_plan",window:e.primary_window,windowSecondsField:"limit_window_seconds"},{key:"auto",labelKey:"limits.label.cursor_auto",window:e.secondary_window,windowSecondsField:"limit_window_seconds"},{key:"api",labelKey:"limits.label.cursor_api",window:e.tertiary_window,windowSecondsField:"limit_window_seconds"},{key:"grok-bot",labelKey:"limits.label.cursor_grok_bot",window:e.quaternary_window,windowSecondsField:"limit_window_seconds"}]}},gemini:{windows(e){return[{key:"pro",labelKey:"limits.label.gemini_pro",window:e.primary_window},{key:"flash",labelKey:"limits.label.gemini_flash",window:e.secondary_window},{key:"lite",labelKey:"limits.label.gemini_lite",window:e.tertiary_window}]}},kimi:{extra:"kimi_parallel",windows(e){return[{key:"weekly",labelKey:"limits.label.kimi_weekly",window:e.primary_window,windowSeconds:7*86400},{key:"5h",labelKey:"limits.label.kimi_5h",window:e.secondary_window,windowSeconds:5*3600},{key:"total",labelKey:"limits.label.kimi_total",window:e.tertiary_window}]}},kiro:{extra:"kiro_credits",windows(e){return[{key:"month",labelKey:"limits.label.kiro_month",window:e.primary_window},{key:"bonus",labelKey:"limits.label.kiro_bonus",window:e.secondary_window}]}},grok:{windows(e){const i=typeof e.period_type=="string"?e.period_type:null,n=i==="weekly"?"limits.label.grok_week":i==="daily"?"limits.label.grok_day":"limits.label.grok_month",w=i==="weekly"?7*86400:i==="daily"?86400:void 0;return[{key:i==="weekly"?"week":i==="daily"?"day":"month",labelKey:n,window:e.primary_window,windowSeconds:w},{key:"ondemand",labelKey:"limits.label.grok_ondemand",window:e.secondary_window}]}},antigravity:{windows(e){return[{key:"claude-weekly",labelKey:"limits.label.antigravity_claude_weekly",window:e.primary_window},{key:"claude-5h",labelKey:"limits.label.antigravity_claude_5h",window:e.secondary_window},{key:"gemini-weekly",labelKey:"limits.label.antigravity_gemini_weekly",window:e.tertiary_window},{key:"gemini-5h",labelKey:"limits.label.antigravity_gemini_5h",window:e.quaternary_window}]}},copilot:{extra:"copilot_otel",windows(e){return[{key:"premium",labelKey:"limits.label.copilot_premium",window:e.primary_window},{key:"chat",labelKey:"limits.label.copilot_chat",window:e.secondary_window}]}},zcode:{windows(e){return e.plan_kind==="coding-plan"?[{key:"5h",labelKey:"limits.label.zcode_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.zcode_weekly",window:e.secondary_window},{key:"tools",labelKey:"limits.label.zcode_tools",window:e.tertiary_window}]:[{key:"glm52",labelKey:"limits.label.zcode_glm52",window:e.primary_window},{key:"glm5t",labelKey:"limits.label.zcode_glm5t",window:e.secondary_window}]}},opencodeGo:{windows(e){return[{key:"5h",labelKey:"limits.label.opencode_go_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.opencode_go_weekly",window:e.secondary_window},{key:"monthly",labelKey:"limits.label.opencode_go_monthly",window:e.tertiary_window}]}},qoder:{windows(e){return[{key:"credits",labelKey:"limits.label.qoder_credits",window:e.primary_window},{key:"ultimate",labelKey:"limits.label.qoder_ultimate",window:e.secondary_window,timeKind:"expiry"}]}},qoderCn:{windows(e){return[{key:"credits",labelKey:"limits.label.qoder_cn_credits",window:e.primary_window},{key:"ultimate",labelKey:"limits.label.qoder_cn_ultimate",window:e.secondary_window,timeKind:"expiry"}]}},codingPlan:{windows(e){return[{key:"5h",labelKey:"limits.label.ark_coding_plan_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.ark_coding_plan_weekly",window:e.secondary_window},{key:"monthly",labelKey:"limits.label.ark_coding_plan_monthly",window:e.tertiary_window}]}},commandCode:{windows(e){return[{key:"5h",labelKey:"limits.label.command_code_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.command_code_weekly",window:e.secondary_window}]}},agentPlan:{windows(e){return[{key:"5h",labelKey:"limits.label.ark_agent_plan_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.ark_agent_plan_weekly",window:e.secondary_window},{key:"monthly",labelKey:"limits.label.ark_agent_plan_monthly",window:e.tertiary_window}]}},devin:{windows(e){return[{key:"daily",labelKey:"limits.label.devin_daily",window:e.primary_window,windowSecondsField:"limit_window_seconds"},{key:"weekly",labelKey:"limits.label.devin_weekly",window:e.secondary_window,windowSecondsField:"limit_window_seconds"}]}}},D="tt.limitAlerts.cycles.v1";function Y(){try{return JSON.parse(window.localStorage.getItem(D)||"{}")}catch{return{}}}function Q(e){try{window.localStorage.setItem(D,JSON.stringify(e))}catch{}}function X(e,{now:i=Date.now()}={}){const n=[],w=W;for(const[u,o]of Object.entries(e||{})){const r=w[u];if(!(!o?.configured||o.error||!r))for(const l of r.windows(o)){if(!l.window)continue;const a=Number(l.pctField==="utilization"?l.window.utilization:l.window.used_percent),c=l.resetField==="resets_at"?l.window.resets_at:l.window.reset_at,m=U(c),f=H({usedPercent:a,windowSeconds:J(l,l.window),resetMs:m,mode:"used",now:i});!f.runsOutEta||!f.paceOver||a<20||!(m>i)||n.push({id:`${u}:${l.key}:${m}`,providerId:u,windowKey:l.key,resetMs:m,usedPercent:a,runsOutEta:f.runsOutEta})}}return n}function Z(e){const i=Y(),n=X(e);for(const o of n){if(i[o.id])continue;const r=R(o.providerId),l=N("limits.alert.title",{provider:r}),a=N("limits.alert.body",{eta:o.runsOutEta,percent:Math.round(o.usedPercent)});let c=O({title:l,body:a,id:o.id});!c&&typeof Notification<"u"&&Notification.permission==="granted"&&(new Notification(l,{body:a,tag:o.id}),c=!0),c&&(i[o.id]=Date.now())}const w=Date.now()-864e5,u=Object.fromEntries(Object.entries(i).filter(([o,r])=>{const l=Number(o.split(":").at(-1));return Number.isFinite(l)?l>=w:Number(r)>=w}).slice(-100));return Q(u),n.length}function k(e,i){return!e||i||!e.devin||e.devin.configured===!1&&Object.keys(e.devin).length===1?e:{...e,devin:{configured:!1}}}function oe(e){const i=!!e?.initialState,[n,w]=d.useState(_),[u,o]=d.useState(()=>i?k(e?.initialState?.data??null,_()):null),[r,l]=d.useState(()=>i?e?.initialState?.error??null:null),[a,c]=d.useState(!i),m=!!e?.initialRefresh,f=!!e?.publishToPreloadCache,b=z([n]);d.useEffect(()=>{if(typeof window>"u")return;const s=()=>w(_()),t=y=>{q(y.key)&&s()};return window.addEventListener(P,s),window.addEventListener("storage",t),()=>{window.removeEventListener(P,s),window.removeEventListener("storage",t)}},[]),d.useEffect(()=>{if(!(!u||typeof window>"u"))try{window.localStorage.getItem(v)==="1"&&Z(u)}catch{}},[u]);const p=d.useCallback((s,t)=>{!f||!s||typeof s!="object"||A(k(s,_()),{source:t})},[f]),C=d.useCallback(async()=>{const s=b();try{const t=await g({refresh:!0,devinEnabled:_()});if(!s())return;const y=t&&typeof t=="object"?t:null;o(k(y,_())),l(null),c(!1),p(y,"manual-refresh")}catch(t){if(!s())return;l(t?.message||String(t)),c(!1)}},[b,p]),h=d.useCallback(async()=>{const s=b();try{const t=await g({devinEnabled:_()});if(!s())return;const y=t&&typeof t=="object"?t:null;o(k(y,_())),l(null),c(!1),p(y,"page-load")}catch(t){if(!s())return;l(t?.message||String(t)),c(!1)}},[b,p]);d.useEffect(()=>{if(typeof window>"u"||typeof document>"u")return;const s=15e3;let t=Date.now();const y=()=>{if(document.visibilityState!=="visible")return;const E=Date.now();E-t<s||(t=E,h())};return window.addEventListener("focus",y),document.addEventListener("visibilitychange",y),()=>{window.removeEventListener("focus",y),document.removeEventListener("visibilitychange",y)}},[h]);const K=d.useRef(n);return d.useEffect(()=>{K.current!==n&&(K.current=n,n||o(s=>k(s,!1)),h())},[n,h]),d.useEffect(()=>{if(i&&!m)return;const s=b();(async()=>{try{const t=await g({devinEnabled:_()});if(!s())return;const y=t&&typeof t=="object"?t:null;o(k(y,_())),l(null),p(y,"page-load")}catch(t){if(!s())return;l(t?.message||String(t))}finally{s()&&c(!1)}})()},[b,i,m,p]),{data:u,error:r,isLoading:a,refresh:C}}export{W as P,J as a,te as b,H as c,U as r,Z as s,oe as u};
|
|
1
|
+
import{J as S,ab as x,r as d,c as N,ac as O,ad as A,ae as g}from"./__vite-browser-external-CjrP5KfC.js";import{l as R,i as _,L as P,a as q}from"./use-limits-display-prefs-C358N7B0.js";import{u as z}from"./use-latest-request-guard-BO89yQ3n.js";const F="native:notificationPermission";let M=null;function I(){return typeof window<"u"&&!!window.chrome?.webview}function L(){return S()?M||"unknown":I()?"granted":typeof Notification>"u"?"unsupported":Notification.permission}function j(e){if(typeof window>"u")return()=>{};const i=n=>{const w=n?.detail?.status;typeof w=="string"&&(M=w),e(L())};return window.addEventListener(F,i),e(L()),S()&&x({type:"getNotificationStatus"}),()=>window.removeEventListener(F,i)}async function T(){if(S()){x({type:"requestNotificationPermission"});return}I()||typeof Notification<"u"&&Notification.permission==="default"&&await Notification.requestPermission().catch(()=>"denied")}const v="tt.limitAlerts.enabled";function $(){try{return window.localStorage.getItem(v)==="1"}catch{return!1}}function te(){const[e,i]=d.useState($),[n,w]=d.useState("unknown");d.useEffect(()=>j(w),[]);const u=d.useCallback(async o=>{const r=!!o;r&&await T();try{window.localStorage.setItem(v,r?"1":"0")}catch{}i(r)},[]);return{enabled:e,setEnabled:u,permissionBlocked:n==="denied"}}function B(e,i){if(!(e>0))return null;const n=(e-i)/e;return Number.isFinite(n)?Math.min(Math.max(n,0),1):null}function G(e,i,n=.03){return e>i+n}function V(e){const i=Math.max(0,Math.floor(e)),n=Math.floor(i/3600);return n>24?`${Math.floor(n/24)}d`:n>0?`${n}h`:`${Math.floor(i/60)}m`}function J(e,i){if(typeof e.windowSeconds=="number")return e.windowSeconds;if(e.windowSecondsField&&i){const n=i[e.windowSecondsField];return typeof n=="number"&&n>0?n:null}return null}function U(e){return e==null?NaN:typeof e=="number"?e*1e3:Date.parse(e)}function H({usedPercent:e,windowSeconds:i,resetMs:n,mode:w,now:u=Date.now()}){const o=Math.min(Math.max(Number(e)||0,0),100)/100,r={pacePercent:null,paceOver:!1,expectedPercent:null,runsOutEta:null,projectedEnd:null};if(!(i>0)||!Number.isFinite(n))return r;const l=Math.max(0,(n-u)/1e3),a=B(i,l);if(a==null)return r;if(r.expectedPercent=Math.round(a*100),r.paceOver=G(o,a),o>=.05){const c=w==="remaining"?1-a:a;r.pacePercent=c*100}if(a>.02&&o>0){const c=i*a,m=o/c,f=o/a;f>=1&&m>0?r.runsOutEta=V((1-o)/m):r.projectedEnd=Math.round(Math.min(f,1)*100)}return r}const W={claude:{windows(e){const i=Array.isArray(e.weekly_scoped)?e.weekly_scoped.map(n=>({key:`scoped-${n.label}`,label:n.label,window:n,pctField:"utilization",resetField:"resets_at",windowSeconds:604800})):[];return[{key:"5h",labelKey:"limits.label.claude_5h",window:e.five_hour,pctField:"utilization",resetField:"resets_at",windowSeconds:5*3600},{key:"7d",labelKey:"limits.label.claude_7d",window:e.seven_day,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},{key:"opus",labelKey:"limits.label.claude_opus",window:e.seven_day_opus,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},...i]}},codex:{extra:"codex_meta",windows(e){return[{key:"5h",labelKey:"limits.label.codex_5h",window:e.primary_window,windowSecondsField:"limit_window_seconds"},{key:"7d",labelKey:"limits.label.codex_7d",window:e.secondary_window,windowSecondsField:"limit_window_seconds"},{key:"credits",labelKey:"limits.label.codex_credits",window:e.credit_window},{key:"spark-5h",labelKey:"limits.label.codex_spark_5h",window:e.spark_primary_window,windowSecondsField:"limit_window_seconds"},{key:"spark-7d",labelKey:"limits.label.codex_spark_7d",window:e.spark_secondary_window,windowSecondsField:"limit_window_seconds"}]}},cursor:{windows(e){return[{key:"plan",labelKey:"limits.label.cursor_plan",window:e.primary_window,windowSecondsField:"limit_window_seconds"},{key:"auto",labelKey:"limits.label.cursor_auto",window:e.secondary_window,windowSecondsField:"limit_window_seconds"},{key:"api",labelKey:"limits.label.cursor_api",window:e.tertiary_window,windowSecondsField:"limit_window_seconds"},{key:"grok-bot",labelKey:"limits.label.cursor_grok_bot",window:e.quaternary_window,windowSecondsField:"limit_window_seconds"}]}},gemini:{windows(e){return[{key:"pro",labelKey:"limits.label.gemini_pro",window:e.primary_window},{key:"flash",labelKey:"limits.label.gemini_flash",window:e.secondary_window},{key:"lite",labelKey:"limits.label.gemini_lite",window:e.tertiary_window}]}},kimi:{extra:"kimi_parallel",windows(e){return[{key:"weekly",labelKey:"limits.label.kimi_weekly",window:e.primary_window,windowSeconds:7*86400},{key:"5h",labelKey:"limits.label.kimi_5h",window:e.secondary_window,windowSeconds:5*3600},{key:"total",labelKey:"limits.label.kimi_total",window:e.tertiary_window}]}},kiro:{extra:"kiro_credits",windows(e){return[{key:"month",labelKey:"limits.label.kiro_month",window:e.primary_window},{key:"bonus",labelKey:"limits.label.kiro_bonus",window:e.secondary_window}]}},grok:{windows(e){const i=typeof e.period_type=="string"?e.period_type:null,n=i==="weekly"?"limits.label.grok_week":i==="daily"?"limits.label.grok_day":"limits.label.grok_month",w=i==="weekly"?7*86400:i==="daily"?86400:void 0;return[{key:i==="weekly"?"week":i==="daily"?"day":"month",labelKey:n,window:e.primary_window,windowSeconds:w},{key:"ondemand",labelKey:"limits.label.grok_ondemand",window:e.secondary_window}]}},antigravity:{windows(e){return[{key:"claude-weekly",labelKey:"limits.label.antigravity_claude_weekly",window:e.primary_window},{key:"claude-5h",labelKey:"limits.label.antigravity_claude_5h",window:e.secondary_window},{key:"gemini-weekly",labelKey:"limits.label.antigravity_gemini_weekly",window:e.tertiary_window},{key:"gemini-5h",labelKey:"limits.label.antigravity_gemini_5h",window:e.quaternary_window}]}},copilot:{extra:"copilot_otel",windows(e){return[{key:"premium",labelKey:"limits.label.copilot_premium",window:e.primary_window},{key:"chat",labelKey:"limits.label.copilot_chat",window:e.secondary_window}]}},zcode:{windows(e){return e.plan_kind==="coding-plan"?[{key:"5h",labelKey:"limits.label.zcode_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.zcode_weekly",window:e.secondary_window},{key:"tools",labelKey:"limits.label.zcode_tools",window:e.tertiary_window}]:[{key:"glm52",labelKey:"limits.label.zcode_glm52",window:e.primary_window},{key:"glm5t",labelKey:"limits.label.zcode_glm5t",window:e.secondary_window}]}},opencodeGo:{windows(e){return[{key:"5h",labelKey:"limits.label.opencode_go_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.opencode_go_weekly",window:e.secondary_window},{key:"monthly",labelKey:"limits.label.opencode_go_monthly",window:e.tertiary_window}]}},qoder:{windows(e){return[{key:"credits",labelKey:"limits.label.qoder_credits",window:e.primary_window},{key:"ultimate",labelKey:"limits.label.qoder_ultimate",window:e.secondary_window,timeKind:"expiry"}]}},qoderCn:{windows(e){return[{key:"credits",labelKey:"limits.label.qoder_cn_credits",window:e.primary_window},{key:"ultimate",labelKey:"limits.label.qoder_cn_ultimate",window:e.secondary_window,timeKind:"expiry"}]}},codingPlan:{windows(e){return[{key:"5h",labelKey:"limits.label.ark_coding_plan_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.ark_coding_plan_weekly",window:e.secondary_window},{key:"monthly",labelKey:"limits.label.ark_coding_plan_monthly",window:e.tertiary_window}]}},commandCode:{windows(e){return[{key:"5h",labelKey:"limits.label.command_code_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.command_code_weekly",window:e.secondary_window}]}},agentPlan:{windows(e){return[{key:"5h",labelKey:"limits.label.ark_agent_plan_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.ark_agent_plan_weekly",window:e.secondary_window},{key:"monthly",labelKey:"limits.label.ark_agent_plan_monthly",window:e.tertiary_window}]}},devin:{windows(e){return[{key:"daily",labelKey:"limits.label.devin_daily",window:e.primary_window,windowSecondsField:"limit_window_seconds"},{key:"weekly",labelKey:"limits.label.devin_weekly",window:e.secondary_window,windowSecondsField:"limit_window_seconds"}]}}},D="tt.limitAlerts.cycles.v1";function Y(){try{return JSON.parse(window.localStorage.getItem(D)||"{}")}catch{return{}}}function Q(e){try{window.localStorage.setItem(D,JSON.stringify(e))}catch{}}function X(e,{now:i=Date.now()}={}){const n=[],w=W;for(const[u,o]of Object.entries(e||{})){const r=w[u];if(!(!o?.configured||o.error||!r))for(const l of r.windows(o)){if(!l.window)continue;const a=Number(l.pctField==="utilization"?l.window.utilization:l.window.used_percent),c=l.resetField==="resets_at"?l.window.resets_at:l.window.reset_at,m=U(c),f=H({usedPercent:a,windowSeconds:J(l,l.window),resetMs:m,mode:"used",now:i});!f.runsOutEta||!f.paceOver||a<20||!(m>i)||n.push({id:`${u}:${l.key}:${m}`,providerId:u,windowKey:l.key,resetMs:m,usedPercent:a,runsOutEta:f.runsOutEta})}}return n}function Z(e){const i=Y(),n=X(e);for(const o of n){if(i[o.id])continue;const r=R(o.providerId),l=N("limits.alert.title",{provider:r}),a=N("limits.alert.body",{eta:o.runsOutEta,percent:Math.round(o.usedPercent)});let c=O({title:l,body:a,id:o.id});!c&&typeof Notification<"u"&&Notification.permission==="granted"&&(new Notification(l,{body:a,tag:o.id}),c=!0),c&&(i[o.id]=Date.now())}const w=Date.now()-864e5,u=Object.fromEntries(Object.entries(i).filter(([o,r])=>{const l=Number(o.split(":").at(-1));return Number.isFinite(l)?l>=w:Number(r)>=w}).slice(-100));return Q(u),n.length}function k(e,i){return!e||i||!e.devin||e.devin.configured===!1&&Object.keys(e.devin).length===1?e:{...e,devin:{configured:!1}}}function oe(e){const i=!!e?.initialState,[n,w]=d.useState(_),[u,o]=d.useState(()=>i?k(e?.initialState?.data??null,_()):null),[r,l]=d.useState(()=>i?e?.initialState?.error??null:null),[a,c]=d.useState(!i),m=!!e?.initialRefresh,f=!!e?.publishToPreloadCache,b=z([n]);d.useEffect(()=>{if(typeof window>"u")return;const s=()=>w(_()),t=y=>{q(y.key)&&s()};return window.addEventListener(P,s),window.addEventListener("storage",t),()=>{window.removeEventListener(P,s),window.removeEventListener("storage",t)}},[]),d.useEffect(()=>{if(!(!u||typeof window>"u"))try{window.localStorage.getItem(v)==="1"&&Z(u)}catch{}},[u]);const p=d.useCallback((s,t)=>{!f||!s||typeof s!="object"||A(k(s,_()),{source:t})},[f]),C=d.useCallback(async()=>{const s=b();try{const t=await g({refresh:!0,devinEnabled:_()});if(!s())return;const y=t&&typeof t=="object"?t:null;o(k(y,_())),l(null),c(!1),p(y,"manual-refresh")}catch(t){if(!s())return;l(t?.message||String(t)),c(!1)}},[b,p]),h=d.useCallback(async()=>{const s=b();try{const t=await g({devinEnabled:_()});if(!s())return;const y=t&&typeof t=="object"?t:null;o(k(y,_())),l(null),c(!1),p(y,"page-load")}catch(t){if(!s())return;l(t?.message||String(t)),c(!1)}},[b,p]);d.useEffect(()=>{if(typeof window>"u"||typeof document>"u")return;const s=15e3;let t=Date.now();const y=()=>{if(document.visibilityState!=="visible")return;const E=Date.now();E-t<s||(t=E,h())};return window.addEventListener("focus",y),document.addEventListener("visibilitychange",y),()=>{window.removeEventListener("focus",y),document.removeEventListener("visibilitychange",y)}},[h]);const K=d.useRef(n);return d.useEffect(()=>{K.current!==n&&(K.current=n,n||o(s=>k(s,!1)),h())},[n,h]),d.useEffect(()=>{if(i&&!m)return;const s=b();(async()=>{try{const t=await g({devinEnabled:_()});if(!s())return;const y=t&&typeof t=="object"?t:null;o(k(y,_())),l(null),p(y,"page-load")}catch(t){if(!s())return;l(t?.message||String(t))}finally{s()&&c(!1)}})()},[b,i,m,p]),{data:u,error:r,isLoading:a,refresh:C}}export{W as P,J as a,te as b,H as c,U as r,Z as s,oe as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,C as t,D as r,q as c}from"./__vite-browser-external-
|
|
1
|
+
import{r as e,C as t,D as r,q as c}from"./__vite-browser-external-CjrP5KfC.js";const s=Object.freeze({currency:c,rate:1,symbol:"$",rates:{...r},rateSource:"default",rateFetchedAt:null,setCurrency:()=>{}});function a(){return e.useContext(t)??s}export{a as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,T as r,n,o as a,p as s}from"./__vite-browser-external-
|
|
1
|
+
import{r as e,T as r,n,o as a,p as s}from"./__vite-browser-external-CjrP5KfC.js";const T=Object.freeze({mode:n.COMPACT,setMode:()=>{},formatTokens:(o,t={})=>s(o,t),formatTokensTooltip:(o,t={})=>a(o,t)});function f(){return e.useContext(r)??T}export{f as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as a}from"./__vite-browser-external-
|
|
1
|
+
import{m as a}from"./__vite-browser-external-CjrP5KfC.js";const o=[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z",key:"1v7up4"}]],e=a("zap",o);export{e as Z};
|
|
@@ -268,7 +268,7 @@
|
|
|
268
268
|
]
|
|
269
269
|
}
|
|
270
270
|
</script>
|
|
271
|
-
<script type="module" crossorigin src="/assets/__vite-browser-external-
|
|
271
|
+
<script type="module" crossorigin src="/assets/__vite-browser-external-CjrP5KfC.js"></script>
|
|
272
272
|
<link rel="stylesheet" crossorigin href="/assets/__vite-browser-external-5P7me0Qq.css">
|
|
273
273
|
</head>
|
|
274
274
|
<body>
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
]
|
|
166
166
|
}
|
|
167
167
|
</script>
|
|
168
|
-
<script type="module" crossorigin src="/assets/__vite-browser-external-
|
|
168
|
+
<script type="module" crossorigin src="/assets/__vite-browser-external-CjrP5KfC.js"></script>
|
|
169
169
|
<link rel="stylesheet" crossorigin href="/assets/__vite-browser-external-5P7me0Qq.css">
|
|
170
170
|
</head>
|
|
171
171
|
<body>
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
]
|
|
137
137
|
}
|
|
138
138
|
</script>
|
|
139
|
-
<script type="module" crossorigin src="/assets/__vite-browser-external-
|
|
139
|
+
<script type="module" crossorigin src="/assets/__vite-browser-external-CjrP5KfC.js"></script>
|
|
140
140
|
<link rel="stylesheet" crossorigin href="/assets/__vite-browser-external-5P7me0Qq.css">
|
|
141
141
|
</head>
|
|
142
142
|
<body>
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"description": "Shareable Token Tracker dashboard snapshot."
|
|
76
76
|
}
|
|
77
77
|
</script>
|
|
78
|
-
<script type="module" crossorigin src="/assets/__vite-browser-external-
|
|
78
|
+
<script type="module" crossorigin src="/assets/__vite-browser-external-CjrP5KfC.js"></script>
|
|
79
79
|
<link rel="stylesheet" crossorigin href="/assets/__vite-browser-external-5P7me0Qq.css">
|
|
80
80
|
</head>
|
|
81
81
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tokentracker-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.97.1",
|
|
4
4
|
"description": "Local-first AI coding token usage and cost tracker for 38 tools, with a dashboard, desktop pet, widgets, achievements, and native macOS/Windows apps.",
|
|
5
5
|
"main": "src/cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -30,6 +30,7 @@ const {
|
|
|
30
30
|
currentCodexModel,
|
|
31
31
|
snapshotCodexModelAttributionState,
|
|
32
32
|
} = require("./codex-model-attribution");
|
|
33
|
+
const { readCodexServiceTier, isPriorityServiceTier } = require("./codex-service-tier");
|
|
33
34
|
|
|
34
35
|
const DISCOVERY_FULL_AUDIT_INTERVAL_MS = 60 * 1000;
|
|
35
36
|
const MAX_DISCOVERY_INVENTORIES = 32;
|
|
@@ -592,6 +593,11 @@ async function parseCodexRolloutFile(filePath, {
|
|
|
592
593
|
const modelAttributionState = createCodexModelAttributionState(
|
|
593
594
|
isResuming ? resumeState.modelAttributionState || { model } : {},
|
|
594
595
|
);
|
|
596
|
+
// Codex writes thread_settings_applied immediately before the turn_context of
|
|
597
|
+
// the turn it applies to, and token_count rows carry no turn id, so each one
|
|
598
|
+
// belongs to the most recent preceding tier record. Sessions that never emit
|
|
599
|
+
// the event (most CLI sessions) stay null and are billed at Standard.
|
|
600
|
+
let serviceTier = isResuming ? resumeState.serviceTier || null : null;
|
|
595
601
|
let provider = isResuming ? resumeState.provider || null : null;
|
|
596
602
|
let cliVersion = isResuming ? resumeState.cliVersion || null : null;
|
|
597
603
|
let forkedFromId = isResuming ? resumeState.forkedFromId || null : null;
|
|
@@ -650,9 +656,20 @@ async function parseCodexRolloutFile(filePath, {
|
|
|
650
656
|
long_context_cache_creation_input_tokens: 0,
|
|
651
657
|
long_context_output_tokens: 0,
|
|
652
658
|
long_context_reasoning_output_tokens: 0,
|
|
659
|
+
priority_input_tokens: 0,
|
|
660
|
+
priority_cached_input_tokens: 0,
|
|
661
|
+
priority_cache_creation_input_tokens: 0,
|
|
662
|
+
priority_output_tokens: 0,
|
|
663
|
+
priority_reasoning_output_tokens: 0,
|
|
664
|
+
priority_long_context_input_tokens: 0,
|
|
665
|
+
priority_long_context_cached_input_tokens: 0,
|
|
666
|
+
priority_long_context_cache_creation_input_tokens: 0,
|
|
667
|
+
priority_long_context_output_tokens: 0,
|
|
668
|
+
priority_long_context_reasoning_output_tokens: 0,
|
|
653
669
|
usage_events: 0,
|
|
654
670
|
rerouted_usage_events: 0,
|
|
655
671
|
long_context_usage_events: 0,
|
|
672
|
+
priority_usage_events: 0,
|
|
656
673
|
selected_models: new Set(),
|
|
657
674
|
reroute_reasons: new Set(),
|
|
658
675
|
};
|
|
@@ -672,7 +689,9 @@ async function parseCodexRolloutFile(filePath, {
|
|
|
672
689
|
// OpenAI applies the long-context tier to the whole request when its raw
|
|
673
690
|
// (cache-inclusive) input exceeds 272K tokens. Preserve the exact subset
|
|
674
691
|
// so pricing can be recomputed later without rescanning private logs.
|
|
675
|
-
|
|
692
|
+
const isLongContext =
|
|
693
|
+
Number(rawRequestUsage?.input_tokens || 0) > OPENAI_LONG_CONTEXT_INPUT_THRESHOLD;
|
|
694
|
+
if (isLongContext) {
|
|
676
695
|
row.long_context_usage_events += 1;
|
|
677
696
|
row.long_context_input_tokens += delta.input_tokens;
|
|
678
697
|
row.long_context_cached_input_tokens += delta.cached_input_tokens;
|
|
@@ -680,6 +699,27 @@ async function parseCodexRolloutFile(filePath, {
|
|
|
680
699
|
row.long_context_output_tokens += delta.output_tokens;
|
|
681
700
|
row.long_context_reasoning_output_tokens += delta.reasoning_output_tokens;
|
|
682
701
|
}
|
|
702
|
+
// Astra Fast bills at a flat multiple of whichever context tier the request
|
|
703
|
+
// was on, so the priority premium multiplies the long-context premium
|
|
704
|
+
// instead of replacing it. The two subsets alone cannot say how much usage
|
|
705
|
+
// was on BOTH, so record the intersection explicitly — otherwise a long
|
|
706
|
+
// Fast request prices at 3x Standard input where it should be 4x.
|
|
707
|
+
if (isPriorityServiceTier(serviceTier)) {
|
|
708
|
+
row.priority_usage_events += 1;
|
|
709
|
+
row.priority_input_tokens += delta.input_tokens;
|
|
710
|
+
row.priority_cached_input_tokens += delta.cached_input_tokens;
|
|
711
|
+
row.priority_cache_creation_input_tokens += delta.cache_creation_input_tokens;
|
|
712
|
+
row.priority_output_tokens += delta.output_tokens;
|
|
713
|
+
row.priority_reasoning_output_tokens += delta.reasoning_output_tokens;
|
|
714
|
+
if (isLongContext) {
|
|
715
|
+
row.priority_long_context_input_tokens += delta.input_tokens;
|
|
716
|
+
row.priority_long_context_cached_input_tokens += delta.cached_input_tokens;
|
|
717
|
+
row.priority_long_context_cache_creation_input_tokens +=
|
|
718
|
+
delta.cache_creation_input_tokens;
|
|
719
|
+
row.priority_long_context_output_tokens += delta.output_tokens;
|
|
720
|
+
row.priority_long_context_reasoning_output_tokens += delta.reasoning_output_tokens;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
683
723
|
}
|
|
684
724
|
|
|
685
725
|
function ensureTool(name) {
|
|
@@ -936,6 +976,12 @@ async function parseCodexRolloutFile(filePath, {
|
|
|
936
976
|
}
|
|
937
977
|
}
|
|
938
978
|
|
|
979
|
+
const appliedServiceTier = readCodexServiceTier(obj);
|
|
980
|
+
if (appliedServiceTier) {
|
|
981
|
+
serviceTier = appliedServiceTier;
|
|
982
|
+
continue;
|
|
983
|
+
}
|
|
984
|
+
|
|
939
985
|
if (obj.type === "turn_context") {
|
|
940
986
|
const p = obj.payload || {};
|
|
941
987
|
if (typeof p.cwd === "string") cwd = p.cwd;
|
|
@@ -1020,6 +1066,7 @@ async function parseCodexRolloutFile(filePath, {
|
|
|
1020
1066
|
cwd,
|
|
1021
1067
|
model,
|
|
1022
1068
|
modelAttributionState: snapshotCodexModelAttributionState(modelAttributionState),
|
|
1069
|
+
serviceTier,
|
|
1023
1070
|
provider,
|
|
1024
1071
|
cliVersion,
|
|
1025
1072
|
forkedFromId,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Codex service-tier attribution.
|
|
2
|
+
//
|
|
3
|
+
// The request tier is NOT on the token_count rows. Codex emits it as its own
|
|
4
|
+
// rollout record — `type: "event_msg"`, `payload.type:
|
|
5
|
+
// "thread_settings_applied"`, `payload.thread_settings.service_tier` — written
|
|
6
|
+
// immediately before the `turn_context` of the turn it applies to. A session's
|
|
7
|
+
// first turn has no such record, and CLI-originated sessions
|
|
8
|
+
// (originator codex_cli_rs / codex-tui) often have none at all: on a 1213-file
|
|
9
|
+
// local corpus only 167 files carried the event, covering 25% of token_count
|
|
10
|
+
// events.
|
|
11
|
+
//
|
|
12
|
+
// Attribution rule, and the only one the log shape permits: a token_count row
|
|
13
|
+
// belongs to the most recent preceding thread_settings_applied. With no
|
|
14
|
+
// preceding record the tier is unknown, and unknown is never guessed — it is
|
|
15
|
+
// billed at Standard, exactly as before this file existed.
|
|
16
|
+
|
|
17
|
+
"use strict";
|
|
18
|
+
|
|
19
|
+
// Cheap line prefilter for parsers that avoid JSON.parse on most records.
|
|
20
|
+
const CODEX_SERVICE_TIER_MARKER = '"thread_settings_applied"';
|
|
21
|
+
|
|
22
|
+
// Observed values on the local corpus are "default" (814) and "priority" (58).
|
|
23
|
+
// "priority" is what the CLI writes for what OpenAI's price table and the Codex
|
|
24
|
+
// UI both call Fast; accept the product-facing spelling too so a future rename
|
|
25
|
+
// does not silently fall back to Standard.
|
|
26
|
+
const PRIORITY_SERVICE_TIERS = new Set(["priority", "fast"]);
|
|
27
|
+
|
|
28
|
+
function readCodexServiceTier(obj) {
|
|
29
|
+
if (!obj || obj.type !== "event_msg") return null;
|
|
30
|
+
const payload = obj.payload;
|
|
31
|
+
if (!payload || typeof payload !== "object") return null;
|
|
32
|
+
if (payload.type !== "thread_settings_applied") return null;
|
|
33
|
+
const settings = payload.thread_settings;
|
|
34
|
+
if (!settings || typeof settings !== "object") return null;
|
|
35
|
+
const tier = settings.service_tier;
|
|
36
|
+
if (typeof tier !== "string" || !tier.trim()) return null;
|
|
37
|
+
return tier.trim().toLowerCase();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function isPriorityServiceTier(tier) {
|
|
41
|
+
return typeof tier === "string" && PRIORITY_SERVICE_TIERS.has(tier);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = {
|
|
45
|
+
CODEX_SERVICE_TIER_MARKER,
|
|
46
|
+
PRIORITY_SERVICE_TIERS,
|
|
47
|
+
readCodexServiceTier,
|
|
48
|
+
isPriorityServiceTier,
|
|
49
|
+
};
|
package/src/lib/local-api.js
CHANGED
|
@@ -3160,6 +3160,11 @@ function createLocalApiHandler({ queuePath }) {
|
|
|
3160
3160
|
json(res, { ok: true, skill: await skills.installSkill(body.skill, body.targets || ["claude", "codex"]) });
|
|
3161
3161
|
return true;
|
|
3162
3162
|
}
|
|
3163
|
+
if (action === "update_all") {
|
|
3164
|
+
// Partial success is normal, so this reports per-skill rather than failing.
|
|
3165
|
+
json(res, { ok: true, ...(await skills.updateSkills(Array.isArray(body.ids) ? body.ids : [])) });
|
|
3166
|
+
return true;
|
|
3167
|
+
}
|
|
3163
3168
|
if (action === "uninstall") {
|
|
3164
3169
|
json(res, { ok: true, ...(skills.uninstallSkill(body.id) || {}) });
|
|
3165
3170
|
return true;
|
|
@@ -53,7 +53,8 @@
|
|
|
53
53
|
"output": 50,
|
|
54
54
|
"cache_read": 1,
|
|
55
55
|
"cache_write": 12.5,
|
|
56
|
-
"
|
|
56
|
+
"priority_multiplier": 2,
|
|
57
|
+
"note": "Official Standard USD/MTok rates verified 2026-09-07: https://developers.openai.com/api/docs/models/gpt-6-astra. Requests above 272K input tokens use 2x input/cache and 1.5x output rates; computeRowCost applies this only to observed long-context request subsets. priority_multiplier is the Fast tier, whose published table (20/2/25/100 short, 40/4/50/150 long, verified 2026-09-12) is exactly 2x the Standard rate of the same context tier — it multiplies, it does not replace, the long-context premium. The 2.5x figure in the Codex speed docs is a subscription-credit rate and must not be used here. computeRowCost applies it only to observed priority request subsets; usage whose service tier the logs never recorded stays Standard. Cloud aggregates use Standard short-context estimates because they do not retain per-request context or service tier. Reasoning-effort suffixes use the same base rates."
|
|
57
58
|
},
|
|
58
59
|
"gpt-5.6-sol": {
|
|
59
60
|
"input": 4,
|
package/src/lib/pricing/index.js
CHANGED
|
@@ -211,12 +211,23 @@ function computeRowCost(row) {
|
|
|
211
211
|
const model = String(row?.model || "").toLowerCase();
|
|
212
212
|
const usesOpenAILongContextTier =
|
|
213
213
|
model === "gpt-5.6" || model.includes("gpt-5.6-sol") || model.includes("gpt-6-astra");
|
|
214
|
-
|
|
214
|
+
// Only models whose curated entry carries an explicit Fast/priority rate get
|
|
215
|
+
// the tier premium. The other OpenAI tiers have no published priority price,
|
|
216
|
+
// and inventing one is worse than reporting Standard.
|
|
217
|
+
const priorityMultiplier = Number(pricing.priority_multiplier);
|
|
218
|
+
const hasPriorityRates = Number.isFinite(priorityMultiplier) && priorityMultiplier > 1;
|
|
219
|
+
if (!usesOpenAILongContextTier && !hasPriorityRates) return baseCost;
|
|
215
220
|
|
|
216
221
|
const bounded = (value, total) => Math.min(
|
|
217
222
|
Math.max(0, Number(value) || 0),
|
|
218
223
|
Math.max(0, Number(total) || 0),
|
|
219
224
|
);
|
|
225
|
+
// Both premium families below read "observed subset" columns: how much of the
|
|
226
|
+
// row's own token columns came from requests with a given property. They are
|
|
227
|
+
// annotations, never addends — total_tokens stays the sum of the base columns
|
|
228
|
+
// whether or not they are present, and a legacy row that omits them prices
|
|
229
|
+
// exactly as it did before.
|
|
230
|
+
//
|
|
220
231
|
// The parser records only usage from requests whose cache-inclusive input
|
|
221
232
|
// exceeded 272K. OpenAI prices the whole such request at 2x input and 1.5x
|
|
222
233
|
// output, so add the premium over the standard-rate base exactly once.
|
|
@@ -230,14 +241,61 @@ function computeRowCost(row) {
|
|
|
230
241
|
const longReasoning = reasoningIncludedInOutput
|
|
231
242
|
? 0
|
|
232
243
|
: bounded(row.long_context_reasoning_output_tokens, row.reasoning_output_tokens);
|
|
233
|
-
const longContextPremium = (
|
|
244
|
+
const longContextPremium = usesOpenAILongContextTier ? (
|
|
234
245
|
longInput * (pricing.input || 0) +
|
|
235
246
|
longCached * (pricing.cache_read || 0) +
|
|
236
247
|
longCacheWrite * (pricing.cache_write || 0) +
|
|
237
248
|
0.5 * longOutput * (pricing.output || 0) +
|
|
238
249
|
0.5 * longReasoning * (pricing.output || 0)
|
|
250
|
+
) / 1_000_000 : 0;
|
|
251
|
+
|
|
252
|
+
if (!hasPriorityRates) return baseCost + longContextPremium;
|
|
253
|
+
|
|
254
|
+
// Astra Fast is a flat multiple of whichever context tier the request was on
|
|
255
|
+
// (short 10/1/12.5/50 -> 20/2/25/100; long 20/2/25/75 -> 40/4/50/150), so the
|
|
256
|
+
// tier multiplier and the long-context premium are orthogonal: a request that
|
|
257
|
+
// is both bills at the LONG rate times the multiplier, not standard times the
|
|
258
|
+
// multiplier. That needs the intersection, which is why the parser records
|
|
259
|
+
// priority_long_context_* alongside priority_*; without it (queue rows, which
|
|
260
|
+
// carry no context-length subset at all) the overlap is 0 and the premium
|
|
261
|
+
// falls back to the short-context multiple, matching the row's own base.
|
|
262
|
+
const priorityInput = bounded(row.priority_input_tokens, row.input_tokens);
|
|
263
|
+
const priorityCached = bounded(row.priority_cached_input_tokens, row.cached_input_tokens);
|
|
264
|
+
const priorityCacheWrite = bounded(
|
|
265
|
+
row.priority_cache_creation_input_tokens,
|
|
266
|
+
row.cache_creation_input_tokens,
|
|
267
|
+
);
|
|
268
|
+
const priorityOutput = bounded(row.priority_output_tokens, row.output_tokens);
|
|
269
|
+
const priorityReasoning = reasoningIncludedInOutput
|
|
270
|
+
? 0
|
|
271
|
+
: bounded(row.priority_reasoning_output_tokens, row.reasoning_output_tokens);
|
|
272
|
+
const priorityBase = (
|
|
273
|
+
priorityInput * (pricing.input || 0) +
|
|
274
|
+
priorityCached * (pricing.cache_read || 0) +
|
|
275
|
+
priorityCacheWrite * (pricing.cache_write || 0) +
|
|
276
|
+
priorityOutput * (pricing.output || 0) +
|
|
277
|
+
priorityReasoning * (pricing.output || 0)
|
|
239
278
|
) / 1_000_000;
|
|
240
|
-
|
|
279
|
+
|
|
280
|
+
const priorityLong = usesOpenAILongContextTier ? (
|
|
281
|
+
bounded(row.priority_long_context_input_tokens, Math.min(priorityInput, longInput)) *
|
|
282
|
+
(pricing.input || 0) +
|
|
283
|
+
bounded(row.priority_long_context_cached_input_tokens, Math.min(priorityCached, longCached)) *
|
|
284
|
+
(pricing.cache_read || 0) +
|
|
285
|
+
bounded(
|
|
286
|
+
row.priority_long_context_cache_creation_input_tokens,
|
|
287
|
+
Math.min(priorityCacheWrite, longCacheWrite),
|
|
288
|
+
) * (pricing.cache_write || 0) +
|
|
289
|
+
0.5 * bounded(row.priority_long_context_output_tokens, Math.min(priorityOutput, longOutput)) *
|
|
290
|
+
(pricing.output || 0) +
|
|
291
|
+
0.5 * bounded(
|
|
292
|
+
row.priority_long_context_reasoning_output_tokens,
|
|
293
|
+
Math.min(priorityReasoning, longReasoning),
|
|
294
|
+
) * (pricing.output || 0)
|
|
295
|
+
) / 1_000_000 : 0;
|
|
296
|
+
|
|
297
|
+
const priorityPremium = (priorityMultiplier - 1) * (priorityBase + priorityLong);
|
|
298
|
+
return baseCost + longContextPremium + priorityPremium;
|
|
241
299
|
}
|
|
242
300
|
|
|
243
301
|
// Backwards-compatible MODEL_PRICING export. Test at
|