tokentracker-cli 1.1.4 → 1.1.5
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/README.md +15 -0
- package/dashboard/dist/assets/{AchievementBadge-BGA-HT_B.js → AchievementBadge-ClUmGxBJ.js} +1 -1
- package/dashboard/dist/assets/{AchievementsPage-CtRh5AjH.js → AchievementsPage-BB0DFE3m.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-BarRcKaN.js → AchievementsSection-BMCSk63s.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-Bg0BDAN2.js → BadgeDetailModal-DzJtvuKO.js} +1 -1
- package/dashboard/dist/assets/{BotAnimated-By9J3-dn.js → BotAnimated-BviEasW4.js} +1 -1
- package/dashboard/dist/assets/{Card-CIoJYi2j.js → Card-BoHr-wLc.js} +1 -1
- package/dashboard/dist/assets/{ClawdAnimated-Dkvc2xe8.js → ClawdAnimated-Bwm8BfqY.js} +2 -2
- package/dashboard/dist/assets/{CommandPalette-BssDtHRl.js → CommandPalette-Rb0Gfcg9.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-CQrgLlDb.js → CommunityStatsModal-Ck7R7Q-d.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-C3hBPgYc.js → ConfirmModal-52Fu9wOi.js} +1 -1
- package/dashboard/dist/assets/{Controls-BSW6a1HS.js → Controls-YlGr187A.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-Dhv7fejy.js → DashboardPage-BRim2Rt6.js} +1 -1
- package/dashboard/dist/assets/{DevicePage-D5eZn0wo.js → DevicePage-3mmhzfgd.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-BltQpaJo.js → DialogClose-D1KfBYUS.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-BhWwQSSg.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-CVddcRPZ.js → DialogTitle-DKye2nJK.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-goPv73MT.js → FadeIn-mJp_ZFst.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-BDBrrkzt.js → HeaderGithubStar-B2R_aqp9.js} +1 -1
- package/dashboard/dist/assets/{HoverTooltip-qyMezXOs.js → HoverTooltip-ElY02914.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-Ces8JIPb.js → IpCheckPage-CNzPUe3x.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-B2TmLGno.js → LandingPage-L25-CxXg.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardAvatar-CVVRoNua.js → LeaderboardAvatar-BT7x5wAP.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-xtt-bOY8.js → LeaderboardPage-bPce9gOU.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProfileModal-BM4d_I_r.js → LeaderboardProfileModal-DPrFGAp6.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-BWqhFLQX.js → LeaderboardProfilePage-j2D1pwYO.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-BZL4Pcl8.js → LimitsPage-CSED1kBx.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-D4gnOEJj.js → LocalOnlyNotice-D6OERWez.js} +1 -1
- package/dashboard/dist/assets/{LoginCard-CB17FQ5w.js → LoginCard-HgmRdIn8.js} +1 -1
- package/dashboard/dist/assets/{LoginModal-BI-O1rH4.js → LoginModal-BSlEmKOV.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-DnGzsvJ4.js → LoginPage-HQAhowvh.js} +1 -1
- package/dashboard/dist/assets/{PetPage-NRnIKMaJ.js → PetPage-DnbYfu-z.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-DHoK6UJZ.js → PopoverPopup-DnyVdfB8.js} +1 -1
- package/dashboard/dist/assets/{ProviderIcon-BTkdx9o2.js → ProviderIcon-D8kgkZlR.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-C6K0w318.js → ResetPasswordPage-ChtXGykP.js} +1 -1
- package/dashboard/dist/assets/{SegmentedControl-gEoWioBE.js → SegmentedControl-dHUpXqFk.js} +1 -1
- package/dashboard/dist/assets/{Select-CI-qtEYu.js → Select-C0tpjNiq.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-q-yhzzjw.js → SelectItemText-C3G_w14k.js} +1 -1
- package/dashboard/dist/assets/{ServiceStatusPage-C4xD1CEe.js → ServiceStatusPage-D6x4e1r8.js} +1 -1
- package/dashboard/dist/assets/{SessionsPage-CS0Yun2z.js → SessionsPage-DZH1QMWd.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-GVY_ktz4.js → SettingsPage-DGmDb2R4.js} +2 -2
- package/dashboard/dist/assets/{SkillsPage-COPRL95O.js → SkillsPage-ChloCHPa.js} +1 -1
- package/dashboard/dist/assets/{TokenGalaxy-Czi0Ic48.js → TokenGalaxy-DOC9wlkv.js} +1 -1
- package/dashboard/dist/assets/{ToolbarRootContext-BZkTiBJB.js → ToolbarRootContext-BB_d-qdY.js} +1 -1
- package/dashboard/dist/assets/{TrendMonitor-CnIsuxV-.js → TrendMonitor-DVVzYdc7.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-OdX_Fsul.js → WidgetsPage-DHVSyU0i.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-h9N63-F8.js → WrappedPage-BDi28nRt.js} +1 -1
- package/dashboard/dist/assets/{__vite-browser-external-BFNWaGsk.js → __vite-browser-external-Bnc5aBhq.js} +2 -2
- package/dashboard/dist/assets/{agent-logos-BDiPxrST.js → agent-logos-BiGvZiLq.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-DtFQUeJG.js → arrow-up-right-SvD82rok.js} +1 -1
- package/dashboard/dist/assets/{check-C35onaNL.js → check-jL5XErEW.js} +1 -1
- package/dashboard/dist/assets/{composite-qxBzts0W.js → composite-DM6geXPA.js} +1 -1
- package/dashboard/dist/assets/{copy-D_D71TLc.js → copy-Dy_GIzj2.js} +1 -1
- package/dashboard/dist/assets/{download-DMQI2hQe.js → download-BW_FS7nX.js} +1 -1
- package/dashboard/dist/assets/{external-link-CemM4dWf.js → external-link-2RIovvCT.js} +1 -1
- package/dashboard/dist/assets/{flame-CIvk0SP5.js → flame-CIRJIxxA.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-D3JSvcFl.js → format-tokens-CT8ahEK4.js} +1 -1
- package/dashboard/dist/assets/{icons-Ccf5W0AL.js → icons-7J1WD0C-.js} +1 -1
- package/dashboard/dist/assets/{index-C8Wri_HI.js → index-D3iSSyYr.js} +1 -1
- package/dashboard/dist/assets/{index-CFXmD_KX.js → index-Ddb2A6Mx.js} +1 -1
- package/dashboard/dist/assets/{index-Brd2evyz.js → index-_vJl6sF7.js} +1 -1
- package/dashboard/dist/assets/{info-CafrKEG8.js → info-BjVWcOOC.js} +1 -1
- package/dashboard/dist/assets/{link-2-Ds-9Nzlp.js → link-2-CyRWnHWE.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-DA4I55-V.js → loader-circle-DUpG5zah.js} +1 -1
- package/dashboard/dist/assets/{maximize-2-CjMPt5kU.js → maximize-2-BVGCRkFZ.js} +1 -1
- package/dashboard/dist/assets/{modifiers.esm-DIxTS09h.js → modifiers.esm-CZI7rED4.js} +1 -1
- package/dashboard/dist/assets/{monitor-smartphone-IZpIOxn3.js → monitor-smartphone-DfBtd01T.js} +1 -1
- package/dashboard/dist/assets/{plus-vbLFNs70.js → plus-CvbLCvjV.js} +1 -1
- package/dashboard/dist/assets/{provider-display-BAu_UIfV.js → provider-display-DC46GLrv.js} +1 -1
- package/dashboard/dist/assets/{react-Djb4VGKb.js → react-mYr3J8Vw.js} +1 -1
- package/dashboard/dist/assets/{search-Ct6LY9Ke.js → search-CFaS1rSj.js} +1 -1
- package/dashboard/dist/assets/{skills-api-BnGI2gEp.js → skills-api-B1N6seFa.js} +1 -1
- package/dashboard/dist/assets/{sortable.esm-CjCGd6g5.js → sortable.esm-BE2GiQaC.js} +1 -1
- package/dashboard/dist/assets/{store-CBxkOqRe.js → store-DwBbExah.js} +1 -1
- package/dashboard/dist/assets/{terminal-Dlpdp5Az.js → terminal-Bl2BuO9x.js} +1 -1
- package/dashboard/dist/assets/{trash-pxUSKv66.js → trash-D8beb27Y.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-tHaixRIw.js → use-community-stats-DJG1DsXR.js} +1 -1
- package/dashboard/dist/assets/{use-latest-request-guard-Cs44WPfL.js → use-latest-request-guard-DYK8iyOM.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-Dw56PXWy.js → use-limits-display-prefs-BGmcFVX3.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-DpLx8oLV.js → use-ordered-list-Cqia_VIq.js} +1 -1
- package/dashboard/dist/assets/use-reduced-motion-CmCk9Sb5.js +1 -0
- package/dashboard/dist/assets/{use-session-efficiency-pref-BN3FtBvr.js → use-session-efficiency-pref-Mj3OeVGZ.js} +1 -1
- package/dashboard/dist/assets/{use-transform-C4nTGgzb.js → use-transform-D4BQIBHx.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-Dmwdc1yo.js → use-usage-limits-BFrO7Mtq.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-DSc3A_Ih.js → useCurrency-CYJavR2h.js} +1 -1
- package/dashboard/dist/assets/{useTokenFormat-BHjcMgm8.js → useTokenFormat-CKruI7SP.js} +1 -1
- package/dashboard/dist/assets/{zap-BE8i_wu2.js → zap-a82fG76c.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/commands/status.js +57 -2
- package/src/commands/sync.js +90 -11
- package/src/lib/codex-context-breakdown.js +3 -1
- package/src/lib/diagnostics.js +20 -1
- package/src/lib/doctor.js +30 -0
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/scan-roots.js +277 -0
- package/src/lib/session-analytics.js +98 -16
- package/dashboard/dist/assets/DialogDescription-Cof52Icj.js +0 -1
- package/dashboard/dist/assets/use-reduced-motion-DrlJ9X6p.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as c}from"./__vite-browser-external-
|
|
1
|
+
import{m as c}from"./__vite-browser-external-Bnc5aBhq.js";const e={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};e.node;const o=c(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-Bnc5aBhq.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,a3 as Oe}from"./__vite-browser-external-
|
|
1
|
+
import{r as c,d as P,a3 as Oe}from"./__vite-browser-external-Bnc5aBhq.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-Bnc5aBhq.js";import{F as g}from"./composite-DM6geXPA.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 a}from"./__vite-browser-external-
|
|
1
|
+
import{m as a}from"./__vite-browser-external-Bnc5aBhq.js";const e={name:"terminal",size:24,node:[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]};e.node;const o=a(e);export{o as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as e}from"./__vite-browser-external-
|
|
1
|
+
import{m as e}from"./__vite-browser-external-Bnc5aBhq.js";const a={name:"trash",size:24,node:[["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"}]],aliases:["trash-2"]};a.node;const o=e(a);export{o as T};
|
package/dashboard/dist/assets/{use-community-stats-tHaixRIw.js → use-community-stats-DJG1DsXR.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-Bnc5aBhq.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-Bnc5aBhq.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-Bnc5aBhq.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-Bnc5aBhq.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-Bnc5aBhq.js";import{h as r,i as t,p as s}from"./react-mYr3J8Vw.js";function i(){!r.current&&t();const[e]=o.useState(s.current);return e}export{i as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as f,r as n}from"./__vite-browser-external-
|
|
1
|
+
import{m as f,r as n}from"./__vite-browser-external-Bnc5aBhq.js";const u={name:"pencil",size:24,node:[["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"}]]};u.node;const E=f(u),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-mYr3J8Vw.js";import{r as f}from"./__vite-browser-external-Bnc5aBhq.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,ac as x,r as w,c as N,ad as C,ae as O,af as g}from"./__vite-browser-external-BFNWaGsk.js";import{l as R,i as _,L as P,a as q}from"./use-limits-display-prefs-Dw56PXWy.js";import{u as z}from"./use-latest-request-guard-Cs44WPfL.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 n=i=>{const a=i?.detail?.status;typeof a=="string"&&(M=a),e(L())};return window.addEventListener(F,n),e(L()),S()&&x({type:"getNotificationStatus"}),()=>window.removeEventListener(F,n)}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,n]=w.useState($),[i,a]=w.useState("unknown");w.useEffect(()=>j(a),[]);const y=w.useCallback(async o=>{const r=!!o;r&&await T();try{window.localStorage.setItem(v,r?"1":"0")}catch{}n(r)},[]);return{enabled:e,setEnabled:y,permissionBlocked:i==="denied"}}function B(e,n){if(!(e>0))return null;const i=(e-n)/e;return Number.isFinite(i)?Math.min(Math.max(i,0),1):null}function G(e,n,i=.03){return e>n+i}function V(e){const n=Math.max(0,Math.floor(e)),i=Math.floor(n/3600);return i>24?`${Math.floor(i/24)}d`:i>0?`${i}h`:`${Math.floor(n/60)}m`}function J(e,n){if(typeof e.windowSeconds=="number")return e.windowSeconds;if(e.windowSecondsField&&n){const i=n[e.windowSecondsField];return typeof i=="number"&&i>0?i:null}return null}function U(e){return e==null?NaN:typeof e=="number"?e*1e3:Date.parse(e)}function H({usedPercent:e,windowSeconds:n,resetMs:i,mode:a,now:y=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(!(n>0)||!Number.isFinite(i))return r;const l=Math.max(0,(i-y)/1e3),d=B(n,l);if(d==null)return r;if(r.expectedPercent=Math.round(d*100),r.paceOver=G(o,d),o>0){const c=a==="remaining"?1-d:d;r.pacePercent=c*100}if(d>.02&&o>0){const c=n*d,m=o/c,f=o/d;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 n=Array.isArray(e.weekly_scoped)?e.weekly_scoped.map(i=>({key:`scoped-${i.label}`,label:i.label,window:i,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},...n]}},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 n=typeof e.period_type=="string"?e.period_type:null,i=n==="weekly"?"limits.label.grok_week":n==="daily"?"limits.label.grok_day":"limits.label.grok_month",a=n==="weekly"?7*86400:n==="daily"?86400:void 0;return[{key:n==="weekly"?"week":n==="daily"?"day":"month",labelKey:i,window:e.primary_window,windowSeconds:a},{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){if(e.plan_kind==="coding-plan")return[{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}];const n=Array.isArray(e.buckets)?e.buckets.filter(i=>i?.label&&i.window):[];return n.length?n.map((i,a)=>({key:`bucket-${i.entitlement_id||a}`,label:i.label,window:i.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:n=Date.now()}={}){const i=[],a=W;for(const[y,o]of Object.entries(e||{})){const r=a[y];if(!(!o?.configured||o.error||!r))for(const l of r.windows(o)){if(!l.window)continue;const d=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:d,windowSeconds:J(l,l.window),resetMs:m,mode:"used",now:n});!f.runsOutEta||!f.paceOver||d<20||!(m>n)||i.push({id:`${y}:${l.key}:${m}`,providerId:y,windowKey:l.key,resetMs:m,usedPercent:d,runsOutEta:f.runsOutEta})}}return i}function Z(e){const n=Y(),i=X(e);for(const o of i){if(n[o.id])continue;const r=R(o.providerId),l=N("limits.alert.title",{provider:r}),d=N("limits.alert.body",{eta:o.runsOutEta,percent:Math.round(o.usedPercent)});let c=C({title:l,body:d,id:o.id});!c&&typeof Notification<"u"&&Notification.permission==="granted"&&(new Notification(l,{body:d,tag:o.id}),c=!0),c&&(n[o.id]=Date.now())}const a=Date.now()-864e5,y=Object.fromEntries(Object.entries(n).filter(([o,r])=>{const l=Number(o.split(":").at(-1));return Number.isFinite(l)?l>=a:Number(r)>=a}).slice(-100));return Q(y),i.length}function k(e,n){return!e||n||!e.devin||e.devin.configured===!1&&Object.keys(e.devin).length===1?e:{...e,devin:{configured:!1}}}function oe(e){const n=!!e?.initialState,[i,a]=w.useState(_),[y,o]=w.useState(()=>n?k(e?.initialState?.data??null,_()):null),[r,l]=w.useState(()=>n?e?.initialState?.error??null:null),[d,c]=w.useState(!n),m=!!e?.initialRefresh,f=!!e?.publishToPreloadCache,b=z([i]);w.useEffect(()=>{if(typeof window>"u")return;const s=()=>a(_()),t=u=>{q(u.key)&&s()};return window.addEventListener(P,s),window.addEventListener("storage",t),()=>{window.removeEventListener(P,s),window.removeEventListener("storage",t)}},[]),w.useEffect(()=>{if(!(!y||typeof window>"u"))try{window.localStorage.getItem(v)==="1"&&Z(y)}catch{}},[y]);const p=w.useCallback((s,t)=>{!f||!s||typeof s!="object"||O(k(s,_()),{source:t})},[f]),A=w.useCallback(async()=>{const s=b();try{const t=await g({refresh:!0,devinEnabled:_()});if(!s())return;const u=t&&typeof t=="object"?t:null;o(k(u,_())),l(null),c(!1),p(u,"manual-refresh")}catch(t){if(!s())return;l(t?.message||String(t)),c(!1)}},[b,p]),h=w.useCallback(async()=>{const s=b();try{const t=await g({devinEnabled:_()});if(!s())return;const u=t&&typeof t=="object"?t:null;o(k(u,_())),l(null),c(!1),p(u,"page-load")}catch(t){if(!s())return;l(t?.message||String(t)),c(!1)}},[b,p]);w.useEffect(()=>{if(typeof window>"u"||typeof document>"u")return;const s=15e3;let t=Date.now();const u=()=>{if(document.visibilityState!=="visible")return;const E=Date.now();E-t<s||(t=E,h())};return window.addEventListener("focus",u),document.addEventListener("visibilitychange",u),()=>{window.removeEventListener("focus",u),document.removeEventListener("visibilitychange",u)}},[h]);const K=w.useRef(i);return w.useEffect(()=>{K.current!==i&&(K.current=i,i||o(s=>k(s,!1)),h())},[i,h]),w.useEffect(()=>{if(n&&!m)return;const s=b();(async()=>{try{const t=await g({devinEnabled:_()});if(!s())return;const u=t&&typeof t=="object"?t:null;o(k(u,_())),l(null),p(u,"page-load")}catch(t){if(!s())return;l(t?.message||String(t))}finally{s()&&c(!1)}})()},[b,n,m,p]),{data:y,error:r,isLoading:d,refresh:A}}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,ac as x,r as w,c as N,ad as C,ae as O,af as g}from"./__vite-browser-external-Bnc5aBhq.js";import{l as R,i as _,L as P,a as q}from"./use-limits-display-prefs-BGmcFVX3.js";import{u as z}from"./use-latest-request-guard-DYK8iyOM.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 n=i=>{const a=i?.detail?.status;typeof a=="string"&&(M=a),e(L())};return window.addEventListener(F,n),e(L()),S()&&x({type:"getNotificationStatus"}),()=>window.removeEventListener(F,n)}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,n]=w.useState($),[i,a]=w.useState("unknown");w.useEffect(()=>j(a),[]);const y=w.useCallback(async o=>{const r=!!o;r&&await T();try{window.localStorage.setItem(v,r?"1":"0")}catch{}n(r)},[]);return{enabled:e,setEnabled:y,permissionBlocked:i==="denied"}}function B(e,n){if(!(e>0))return null;const i=(e-n)/e;return Number.isFinite(i)?Math.min(Math.max(i,0),1):null}function G(e,n,i=.03){return e>n+i}function V(e){const n=Math.max(0,Math.floor(e)),i=Math.floor(n/3600);return i>24?`${Math.floor(i/24)}d`:i>0?`${i}h`:`${Math.floor(n/60)}m`}function J(e,n){if(typeof e.windowSeconds=="number")return e.windowSeconds;if(e.windowSecondsField&&n){const i=n[e.windowSecondsField];return typeof i=="number"&&i>0?i:null}return null}function U(e){return e==null?NaN:typeof e=="number"?e*1e3:Date.parse(e)}function H({usedPercent:e,windowSeconds:n,resetMs:i,mode:a,now:y=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(!(n>0)||!Number.isFinite(i))return r;const l=Math.max(0,(i-y)/1e3),d=B(n,l);if(d==null)return r;if(r.expectedPercent=Math.round(d*100),r.paceOver=G(o,d),o>0){const c=a==="remaining"?1-d:d;r.pacePercent=c*100}if(d>.02&&o>0){const c=n*d,m=o/c,f=o/d;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 n=Array.isArray(e.weekly_scoped)?e.weekly_scoped.map(i=>({key:`scoped-${i.label}`,label:i.label,window:i,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},...n]}},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 n=typeof e.period_type=="string"?e.period_type:null,i=n==="weekly"?"limits.label.grok_week":n==="daily"?"limits.label.grok_day":"limits.label.grok_month",a=n==="weekly"?7*86400:n==="daily"?86400:void 0;return[{key:n==="weekly"?"week":n==="daily"?"day":"month",labelKey:i,window:e.primary_window,windowSeconds:a},{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){if(e.plan_kind==="coding-plan")return[{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}];const n=Array.isArray(e.buckets)?e.buckets.filter(i=>i?.label&&i.window):[];return n.length?n.map((i,a)=>({key:`bucket-${i.entitlement_id||a}`,label:i.label,window:i.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:n=Date.now()}={}){const i=[],a=W;for(const[y,o]of Object.entries(e||{})){const r=a[y];if(!(!o?.configured||o.error||!r))for(const l of r.windows(o)){if(!l.window)continue;const d=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:d,windowSeconds:J(l,l.window),resetMs:m,mode:"used",now:n});!f.runsOutEta||!f.paceOver||d<20||!(m>n)||i.push({id:`${y}:${l.key}:${m}`,providerId:y,windowKey:l.key,resetMs:m,usedPercent:d,runsOutEta:f.runsOutEta})}}return i}function Z(e){const n=Y(),i=X(e);for(const o of i){if(n[o.id])continue;const r=R(o.providerId),l=N("limits.alert.title",{provider:r}),d=N("limits.alert.body",{eta:o.runsOutEta,percent:Math.round(o.usedPercent)});let c=C({title:l,body:d,id:o.id});!c&&typeof Notification<"u"&&Notification.permission==="granted"&&(new Notification(l,{body:d,tag:o.id}),c=!0),c&&(n[o.id]=Date.now())}const a=Date.now()-864e5,y=Object.fromEntries(Object.entries(n).filter(([o,r])=>{const l=Number(o.split(":").at(-1));return Number.isFinite(l)?l>=a:Number(r)>=a}).slice(-100));return Q(y),i.length}function k(e,n){return!e||n||!e.devin||e.devin.configured===!1&&Object.keys(e.devin).length===1?e:{...e,devin:{configured:!1}}}function oe(e){const n=!!e?.initialState,[i,a]=w.useState(_),[y,o]=w.useState(()=>n?k(e?.initialState?.data??null,_()):null),[r,l]=w.useState(()=>n?e?.initialState?.error??null:null),[d,c]=w.useState(!n),m=!!e?.initialRefresh,f=!!e?.publishToPreloadCache,b=z([i]);w.useEffect(()=>{if(typeof window>"u")return;const s=()=>a(_()),t=u=>{q(u.key)&&s()};return window.addEventListener(P,s),window.addEventListener("storage",t),()=>{window.removeEventListener(P,s),window.removeEventListener("storage",t)}},[]),w.useEffect(()=>{if(!(!y||typeof window>"u"))try{window.localStorage.getItem(v)==="1"&&Z(y)}catch{}},[y]);const p=w.useCallback((s,t)=>{!f||!s||typeof s!="object"||O(k(s,_()),{source:t})},[f]),A=w.useCallback(async()=>{const s=b();try{const t=await g({refresh:!0,devinEnabled:_()});if(!s())return;const u=t&&typeof t=="object"?t:null;o(k(u,_())),l(null),c(!1),p(u,"manual-refresh")}catch(t){if(!s())return;l(t?.message||String(t)),c(!1)}},[b,p]),h=w.useCallback(async()=>{const s=b();try{const t=await g({devinEnabled:_()});if(!s())return;const u=t&&typeof t=="object"?t:null;o(k(u,_())),l(null),c(!1),p(u,"page-load")}catch(t){if(!s())return;l(t?.message||String(t)),c(!1)}},[b,p]);w.useEffect(()=>{if(typeof window>"u"||typeof document>"u")return;const s=15e3;let t=Date.now();const u=()=>{if(document.visibilityState!=="visible")return;const E=Date.now();E-t<s||(t=E,h())};return window.addEventListener("focus",u),document.addEventListener("visibilitychange",u),()=>{window.removeEventListener("focus",u),document.removeEventListener("visibilitychange",u)}},[h]);const K=w.useRef(i);return w.useEffect(()=>{K.current!==i&&(K.current=i,i||o(s=>k(s,!1)),h())},[i,h]),w.useEffect(()=>{if(n&&!m)return;const s=b();(async()=>{try{const t=await g({devinEnabled:_()});if(!s())return;const u=t&&typeof t=="object"?t:null;o(k(u,_())),l(null),p(u,"page-load")}catch(t){if(!s())return;l(t?.message||String(t))}finally{s()&&c(!1)}})()},[b,n,m,p]),{data:y,error:r,isLoading:d,refresh:A}}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-Bnc5aBhq.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-Bnc5aBhq.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 e}from"./__vite-browser-external-
|
|
1
|
+
import{m as e}from"./__vite-browser-external-Bnc5aBhq.js";const a={name:"zap",size:24,node:[["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"}]]};a.node;const n=e(a);export{n as Z};
|
|
@@ -273,7 +273,7 @@
|
|
|
273
273
|
]
|
|
274
274
|
}
|
|
275
275
|
</script>
|
|
276
|
-
<script type="module" crossorigin src="/assets/__vite-browser-external-
|
|
276
|
+
<script type="module" crossorigin src="/assets/__vite-browser-external-Bnc5aBhq.js"></script>
|
|
277
277
|
<link rel="stylesheet" crossorigin href="/assets/__vite-browser-external-Bg0J-a5P.css">
|
|
278
278
|
</head>
|
|
279
279
|
<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-Bnc5aBhq.js"></script>
|
|
169
169
|
<link rel="stylesheet" crossorigin href="/assets/__vite-browser-external-Bg0J-a5P.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-Bnc5aBhq.js"></script>
|
|
140
140
|
<link rel="stylesheet" crossorigin href="/assets/__vite-browser-external-Bg0J-a5P.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-Bnc5aBhq.js"></script>
|
|
79
79
|
<link rel="stylesheet" crossorigin href="/assets/__vite-browser-external-Bg0J-a5P.css">
|
|
80
80
|
</head>
|
|
81
81
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tokentracker-cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "Local-first AI coding token usage and cost tracker for 43 tools, with a dashboard, desktop pet, widgets, achievements, and native macOS/Windows apps.",
|
|
5
5
|
"main": "src/cli.js",
|
|
6
6
|
"bin": {
|
package/src/commands/status.js
CHANGED
|
@@ -116,6 +116,13 @@ const {
|
|
|
116
116
|
const wsl = require("../lib/wsl-probe");
|
|
117
117
|
const { getWslMode, isInvalidWslMode, shouldProbeWsl, discoverWslHome } = wsl;
|
|
118
118
|
const { resolveInstallPaths, resolveZcodeNativeDbPath, resolveMimoNativeDbPath } = require("../lib/install-resolver");
|
|
119
|
+
const {
|
|
120
|
+
describeScanRootOrigin,
|
|
121
|
+
describeScanRootState,
|
|
122
|
+
hasAnyScanChild,
|
|
123
|
+
resolveEnvRoot,
|
|
124
|
+
resolveScanRoots,
|
|
125
|
+
} = require("../lib/scan-roots");
|
|
119
126
|
const { probeGrokHookState, resolveGrokHome } = require("../lib/grok-hook");
|
|
120
127
|
const { probeOmpHookState } = require("../lib/omp-hook");
|
|
121
128
|
|
|
@@ -197,7 +204,9 @@ async function cmdStatus(argv = []) {
|
|
|
197
204
|
const uploadThrottlePath = path.join(trackerDir, "upload.throttle.json");
|
|
198
205
|
const autoRetryPath = path.join(trackerDir, "auto.retry.json");
|
|
199
206
|
const syncSkipPath = path.join(trackerDir, "sync.skip.json");
|
|
200
|
-
|
|
207
|
+
// Normalized like sync (a relative CODEX_HOME is anchored to home, not cwd)
|
|
208
|
+
// so status lists exactly the root sync walks.
|
|
209
|
+
const codexHome = resolveEnvRoot("codex", { env: process.env, home }) || path.join(home, ".codex");
|
|
201
210
|
const codexConfigPath = path.join(codexHome, "config.toml");
|
|
202
211
|
const acodeHome = process.env.TOKENTRACKER_ACODE_HOME || path.join(home, ".acode");
|
|
203
212
|
const acodeConfigPath = path.join(acodeHome, "config.toml");
|
|
@@ -229,6 +238,33 @@ async function cmdStatus(argv = []) {
|
|
|
229
238
|
const geminiHookCommand = buildGeminiHookCommand(notifyPath);
|
|
230
239
|
|
|
231
240
|
const config = await readJson(configPath);
|
|
241
|
+
// Extra scan roots (#657): CODEX_HOME / CLAUDE_CONFIG_DIR of this process
|
|
242
|
+
// plus config.scanRoots, resolved exactly as sync does, so status lists every
|
|
243
|
+
// root sync walks — this is the output users paste when usage looks wrong.
|
|
244
|
+
const scanRoots = resolveScanRoots({
|
|
245
|
+
home,
|
|
246
|
+
env: process.env,
|
|
247
|
+
config,
|
|
248
|
+
base: { codex: [codexHome], claude: [path.join(home, ".claude")] },
|
|
249
|
+
});
|
|
250
|
+
const extraScanRoots = [];
|
|
251
|
+
for (const provider of ["codex", "claude"]) {
|
|
252
|
+
for (const entry of scanRoots[provider]) {
|
|
253
|
+
if (entry.origin === "native") continue;
|
|
254
|
+
extraScanRoots.push({
|
|
255
|
+
provider,
|
|
256
|
+
origin: describeScanRootOrigin(entry, provider),
|
|
257
|
+
path: entry.path,
|
|
258
|
+
exists: entry.exists,
|
|
259
|
+
error: entry.error || null,
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
const describeExtraScanRoot = (root) =>
|
|
264
|
+
`${root.provider} ${root.origin}: ${root.path}${describeScanRootState(root)}`;
|
|
265
|
+
const scanRootsLine = extraScanRoots.length > 0
|
|
266
|
+
? `- Extra scan roots: ${extraScanRoots.map(describeExtraScanRoot).join(" | ")}`
|
|
267
|
+
: null;
|
|
232
268
|
const { cursors } = await readCursorStateSummary({ trackerDir, cursorsPath });
|
|
233
269
|
const codexRecordOnlyWarning = formatRecordOnlyWarning(countRecordOnlyFiles(cursors));
|
|
234
270
|
const queueState = (await readJson(queueStatePath)) || { offset: 0 };
|
|
@@ -419,6 +455,10 @@ async function cmdStatus(argv = []) {
|
|
|
419
455
|
? wsl.discoverWslHome(".claude")
|
|
420
456
|
: null;
|
|
421
457
|
if (wslClaudeHomeStatus) claudeHomesStatus.push({ dir: wslClaudeHomeStatus, label: "WSL" });
|
|
458
|
+
for (const entry of scanRoots.claude) {
|
|
459
|
+
if (entry.origin === "native" || !entry.exists) continue;
|
|
460
|
+
claudeHomesStatus.push({ dir: entry.path, label: describeScanRootOrigin(entry, "claude") });
|
|
461
|
+
}
|
|
422
462
|
for (const { dir, label } of claudeHomesStatus) {
|
|
423
463
|
const projects = path.join(dir, "projects");
|
|
424
464
|
try {
|
|
@@ -657,7 +697,7 @@ async function cmdStatus(argv = []) {
|
|
|
657
697
|
// users are asked to paste when Codex usage looks wrong, so it must list
|
|
658
698
|
// every root sync actually walks — and no empty shell sync would skip.
|
|
659
699
|
const codexPaths = resolveInstallPaths({
|
|
660
|
-
nativeValue:
|
|
700
|
+
nativeValue: codexHome,
|
|
661
701
|
wslDir: ".codex",
|
|
662
702
|
requireAnyChild: ["sessions", "archived_sessions"],
|
|
663
703
|
union: true,
|
|
@@ -665,6 +705,11 @@ async function cmdStatus(argv = []) {
|
|
|
665
705
|
// Both children, matching requireAnyChild above: an install holding only
|
|
666
706
|
// archived_sessions/ is counted by sync and must not read as "not detected".
|
|
667
707
|
const codexActive = formatResolvedPaths(codexPaths, ["sessions", "archived_sessions"]);
|
|
708
|
+
for (const entry of scanRoots.codex) {
|
|
709
|
+
if (entry.origin === "native" || !entry.exists) continue;
|
|
710
|
+
if (!hasAnyScanChild(entry.path, ["sessions", "archived_sessions"])) continue;
|
|
711
|
+
codexActive.push(`${describeScanRootOrigin(entry, "codex")}: ${entry.path}`);
|
|
712
|
+
}
|
|
668
713
|
const codexInstalledStatus = codexActive.length > 0;
|
|
669
714
|
|
|
670
715
|
const acodePaths = resolveInstallPaths({
|
|
@@ -983,6 +1028,10 @@ async function cmdStatus(argv = []) {
|
|
|
983
1028
|
last_upload_error: lastUploadError || null,
|
|
984
1029
|
last_sync_skipped: syncSkip?.at ? syncSkip : null,
|
|
985
1030
|
auto_retry: autoRetry || null,
|
|
1031
|
+
// Extra scan roots (#657): CODEX_HOME / CLAUDE_CONFIG_DIR of this process
|
|
1032
|
+
// plus config.scanRoots; `exists` false + `error` null means absent,
|
|
1033
|
+
// `error` set means present but unreadable.
|
|
1034
|
+
extra_scan_roots: extraScanRoots,
|
|
986
1035
|
hooks: {
|
|
987
1036
|
codex_notify: notifyConfigured,
|
|
988
1037
|
acode_notify: acodeConfigured,
|
|
@@ -1198,6 +1247,7 @@ async function cmdStatus(argv = []) {
|
|
|
1198
1247
|
lastUploadError ? `- Last upload error: ${lastUploadError}` : null,
|
|
1199
1248
|
syncSkipLine,
|
|
1200
1249
|
autoRetryLine,
|
|
1250
|
+
scanRootsLine,
|
|
1201
1251
|
`- Codex notify: ${notifyConfigured ? JSON.stringify(codexNotify) : "unset"}`,
|
|
1202
1252
|
`- AStudio notify: ${acodeConfigured ? JSON.stringify(acodeNotify) : "unset"}`,
|
|
1203
1253
|
`- Every Code notify: ${everyCodeConfigured ? JSON.stringify(everyCodeNotify) : "unset"}`,
|
|
@@ -1525,6 +1575,11 @@ function renderLightTable(summary) {
|
|
|
1525
1575
|
push(`Hook · ${name}`, state ? "set" : "unset");
|
|
1526
1576
|
}
|
|
1527
1577
|
|
|
1578
|
+
for (const root of summary.extra_scan_roots || []) {
|
|
1579
|
+
const state = root.exists ? "" : (root.error ? ` (unreadable: ${root.error})` : " (missing)");
|
|
1580
|
+
push(`Scan root · ${root.provider}`, `${root.origin}: ${root.path}${state}`);
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1528
1583
|
for (const [name, info] of Object.entries(summary.providers || {})) {
|
|
1529
1584
|
const detail = [];
|
|
1530
1585
|
if (typeof info.installed === "boolean") detail.push(info.installed ? "installed" : "not installed");
|
package/src/commands/sync.js
CHANGED
|
@@ -172,6 +172,14 @@ const {
|
|
|
172
172
|
openCursorStore,
|
|
173
173
|
} = require("../lib/cursor-store");
|
|
174
174
|
const { resolveTrackerPaths } = require("../lib/tracker-paths");
|
|
175
|
+
const {
|
|
176
|
+
appendUniqueDirs,
|
|
177
|
+
extraScanRootPaths,
|
|
178
|
+
hasAnyScanChild,
|
|
179
|
+
resolveEnvRoot,
|
|
180
|
+
resolveScanRoots,
|
|
181
|
+
scanRootDirState,
|
|
182
|
+
} = require("../lib/scan-roots");
|
|
175
183
|
const { resolveRuntimeConfig, isLegacyInsforgeBaseUrl } = require("../lib/runtime-config");
|
|
176
184
|
const { extractTokenCount } = require("../lib/codex-rollout-parser");
|
|
177
185
|
const {
|
|
@@ -601,7 +609,24 @@ async function cmdSync(argv, context = {}) {
|
|
|
601
609
|
persistedAnonKey: config.anonKey,
|
|
602
610
|
};
|
|
603
611
|
}
|
|
604
|
-
|
|
612
|
+
// Scan roots (#657). Every producer — hook-fired sync, native background
|
|
613
|
+
// refresh, CLI — must derive the SAME root list, and the cursor store's
|
|
614
|
+
// codexRoots must come from that list: a rollout under a root the store
|
|
615
|
+
// does not know is filed in core.json instead of its per-day shard, so two
|
|
616
|
+
// producers with different roots never see each other's cursor and re-parse
|
|
617
|
+
// the file from byte 0 on every alternation (#639). CODEX_HOME keeps its
|
|
618
|
+
// existing meaning (replaces ~/.codex for this process) but is normalized
|
|
619
|
+
// once by resolveEnvRoot — a relative value is anchored to home, not cwd —
|
|
620
|
+
// and that single value feeds discovery AND the cursor store below.
|
|
621
|
+
// config.scanRoots adds roots for every process.
|
|
622
|
+
const codexNativeValue = resolveEnvRoot("codex", { env: process.env, home }) || path.join(home, ".codex");
|
|
623
|
+
const scanRoots = resolveScanRoots({
|
|
624
|
+
home,
|
|
625
|
+
env: process.env,
|
|
626
|
+
config,
|
|
627
|
+
base: { codex: [codexNativeValue], claude: [path.join(home, ".claude")] },
|
|
628
|
+
});
|
|
629
|
+
const codexCursorRoots = scanRoots.codex.map((entry) => entry.path);
|
|
605
630
|
const cursorStore = await openCursorStore({
|
|
606
631
|
trackerDir,
|
|
607
632
|
cursorsPath,
|
|
@@ -643,7 +668,16 @@ async function cmdSync(argv, context = {}) {
|
|
|
643
668
|
claudeInstallHomes.push(claudeNativeHome);
|
|
644
669
|
}
|
|
645
670
|
if (wslClaudeHome) claudeInstallHomes.push(wslClaudeHome);
|
|
646
|
-
|
|
671
|
+
// Extra Claude roots (#657): CLAUDE_CONFIG_DIR of the spawning process and
|
|
672
|
+
// config.scanRoots.claude, additive to the homes above so coverage does not
|
|
673
|
+
// depend on which process spawned this sync. Deduped by realpath at the
|
|
674
|
+
// projects/ level: two profiles may symlink one projects/ dir, and reading
|
|
675
|
+
// it under both spellings would double-parse every file, leaving
|
|
676
|
+
// correctness to the bounded claudeHashes layer.
|
|
677
|
+
const claudeProjectsDirs = appendUniqueDirs(
|
|
678
|
+
claudeInstallHomes.map((h) => path.join(h, "projects")),
|
|
679
|
+
extraScanRootPaths(scanRoots.claude).map((h) => path.join(h, "projects")),
|
|
680
|
+
);
|
|
647
681
|
const xdgDataHome = process.env.XDG_DATA_HOME || path.join(home, ".local", "share");
|
|
648
682
|
const kiloHome = process.env.KILO_HOME || path.join(xdgDataHome, "kilo");
|
|
649
683
|
|
|
@@ -700,7 +734,6 @@ async function cmdSync(argv, context = {}) {
|
|
|
700
734
|
|
|
701
735
|
const sources = [];
|
|
702
736
|
if (sourceAllowed("codex")) {
|
|
703
|
-
const codexNativeValue = process.env.CODEX_HOME || path.join(home, ".codex");
|
|
704
737
|
// resolveInstallPaths stays the single authority for wsl-first /
|
|
705
738
|
// native-first / wsl-only / native-only / both selection; requireAnyChild
|
|
706
739
|
// makes it validate that a candidate actually holds sessions/ or
|
|
@@ -740,6 +773,17 @@ async function cmdSync(argv, context = {}) {
|
|
|
740
773
|
sources.push({ source: "codex", sessionsDir: path.join(codexPaths.wsl, "archived_sessions"), deep: true });
|
|
741
774
|
}
|
|
742
775
|
}
|
|
776
|
+
// Extra Codex roots (#657) from config.scanRoots.codex. Same populated-
|
|
777
|
+
// root rule as requireAnyChild above so an empty shell dir is not walked;
|
|
778
|
+
// the day-inventory cache is keyed by day directory, so sharing it across
|
|
779
|
+
// roots is safe.
|
|
780
|
+
for (const extraRoot of extraScanRootPaths(scanRoots.codex)) {
|
|
781
|
+
if (!hasAnyScanChild(extraRoot, ["sessions", "archived_sessions"])) continue;
|
|
782
|
+
sources.push({ source: "codex", sessionsDir: path.join(extraRoot, "sessions"), inventoryCacheKey: "codexDayInventoryCache" });
|
|
783
|
+
if (!isBackgroundLightweightSync || backgroundCodexUsageRepair) {
|
|
784
|
+
sources.push({ source: "codex", sessionsDir: path.join(extraRoot, "archived_sessions"), deep: true });
|
|
785
|
+
}
|
|
786
|
+
}
|
|
743
787
|
}
|
|
744
788
|
if (sourceAllowed("acode")) {
|
|
745
789
|
const acodeNativeValue =
|
|
@@ -1067,14 +1111,49 @@ async function cmdSync(argv, context = {}) {
|
|
|
1067
1111
|
}
|
|
1068
1112
|
if (isFullSourceScan) {
|
|
1069
1113
|
await reincludeClaudeMemObserverFiles({ cursors, claudeFiles, queuePath, queueStatePath });
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1114
|
+
// The ground-truth repair rebuilds every Claude queue row from the roots
|
|
1115
|
+
// it is given. A configured root that is absent or unreadable right now
|
|
1116
|
+
// (unmounted volume, permissions) may still hold history that an earlier
|
|
1117
|
+
// scoped sync queued, so rebuilding without it would erase that history.
|
|
1118
|
+
// The same applies one level down: listClaudeProjectFiles turns a read
|
|
1119
|
+
// error on projects/ into an empty listing, so an unreadable projects/
|
|
1120
|
+
// would let the repair run against nothing and mark itself complete. An
|
|
1121
|
+
// ABSENT projects/ is fine for a NEW root (a profile with no sessions
|
|
1122
|
+
// yet) but not for one the cursor store shows has supplied files before:
|
|
1123
|
+
// then the directory vanished and rebuilding without it would erase its
|
|
1124
|
+
// history. Defer in both cases: the migration key stays unset and the
|
|
1125
|
+
// repair runs on a later full scan once the root is back. Ordinary
|
|
1126
|
+
// scanning still proceeds.
|
|
1127
|
+
const cursorFilePaths = Object.keys(cursors.files || {});
|
|
1128
|
+
const rootPreviouslySuppliedFiles = (rootPath) => {
|
|
1129
|
+
const prefix = path.join(rootPath, "projects") + path.sep;
|
|
1130
|
+
return cursorFilePaths.some((filePath) => filePath.startsWith(prefix));
|
|
1131
|
+
};
|
|
1132
|
+
const unavailableClaudeRoots = scanRoots.claude
|
|
1133
|
+
.filter((entry) => {
|
|
1134
|
+
if (entry.origin === "native") return false;
|
|
1135
|
+
if (!entry.exists) return true;
|
|
1136
|
+
const projectsState = scanRootDirState(path.join(entry.path, "projects"));
|
|
1137
|
+
if (projectsState.error !== null) return true;
|
|
1138
|
+
return !projectsState.exists && rootPreviouslySuppliedFiles(entry.path);
|
|
1139
|
+
})
|
|
1140
|
+
.map((entry) => entry.path);
|
|
1141
|
+
if (unavailableClaudeRoots.length > 0) {
|
|
1142
|
+
if (!opts.auto) {
|
|
1143
|
+
process.stderr.write(
|
|
1144
|
+
`Claude ground-truth repair deferred: configured scan root(s) unavailable: ${unavailableClaudeRoots.join(", ")}\n`,
|
|
1145
|
+
);
|
|
1146
|
+
}
|
|
1147
|
+
} else {
|
|
1148
|
+
await repairClaudeQueueFromGroundTruth({
|
|
1149
|
+
cursors,
|
|
1150
|
+
queuePath,
|
|
1151
|
+
queueStatePath,
|
|
1152
|
+
projectQueuePath,
|
|
1153
|
+
projectQueueStatePath,
|
|
1154
|
+
rootDirs: claudeProjectsDirs,
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
1078
1157
|
}
|
|
1079
1158
|
let claudeResult = { filesProcessed: 0, eventsAggregated: 0, bucketsQueued: 0 };
|
|
1080
1159
|
if (claudeFiles.length > 0) {
|
|
@@ -15,6 +15,8 @@ const fs = require("node:fs");
|
|
|
15
15
|
const os = require("node:os");
|
|
16
16
|
const path = require("node:path");
|
|
17
17
|
|
|
18
|
+
const { resolveEnvRoot } = require("./scan-roots");
|
|
19
|
+
|
|
18
20
|
const {
|
|
19
21
|
emptyTotals,
|
|
20
22
|
addInto,
|
|
@@ -396,7 +398,7 @@ async function computeCodexContextBreakdown({
|
|
|
396
398
|
toKey = range?.to || null;
|
|
397
399
|
}
|
|
398
400
|
|
|
399
|
-
const codexHome = process.env.
|
|
401
|
+
const codexHome = resolveEnvRoot("codex", { env: process.env, home: os.homedir() }) || path.join(os.homedir(), ".codex");
|
|
400
402
|
const roots = codexDir
|
|
401
403
|
? [codexDir]
|
|
402
404
|
: [path.join(codexHome, "sessions"), path.join(codexHome, "archived_sessions")];
|