@ashlr/hub 3.9.0 → 3.9.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/CHANGELOG.md +13 -0
- package/dist/build-identity.json +2 -2
- package/dist/core/resources/claude-account-usage.d.ts +19 -0
- package/dist/core/resources/claude-account-usage.js +22 -1
- package/dist/core/resources/claude-account-usage.js.map +1 -1
- package/dist/core/verse/accounts.d.ts +6 -5
- package/dist/core/verse/accounts.js +9 -8
- package/dist/core/verse/accounts.js.map +1 -1
- package/dist/core/web/public/next/assets/{App-XURmiAAp.js → App-D2P1AJiD.js} +2 -2
- package/dist/core/web/public/next/assets/{App-XURmiAAp.js.map → App-D2P1AJiD.js.map} +1 -1
- package/dist/core/web/public/next/assets/{ApprovalsSection-BriUzoZc.js → ApprovalsSection-Dq66NMfx.js} +2 -2
- package/dist/core/web/public/next/assets/{ApprovalsSection-BriUzoZc.js.map → ApprovalsSection-Dq66NMfx.js.map} +1 -1
- package/dist/core/web/public/next/assets/{AutonomySection-C4GBsQVc.js → AutonomySection-DyxpeR5I.js} +2 -2
- package/dist/core/web/public/next/assets/{AutonomySection-C4GBsQVc.js.map → AutonomySection-DyxpeR5I.js.map} +1 -1
- package/dist/core/web/public/next/assets/{ChatSection-hlgPBRco.js → ChatSection-bzwFdbdw.js} +2 -2
- package/dist/core/web/public/next/assets/{ChatSection-hlgPBRco.js.map → ChatSection-bzwFdbdw.js.map} +1 -1
- package/dist/core/web/public/next/assets/{ConfirmDialog-BdQYI-Ng.js → ConfirmDialog-DkR0z5_a.js} +2 -2
- package/dist/core/web/public/next/assets/{ConfirmDialog-BdQYI-Ng.js.map → ConfirmDialog-DkR0z5_a.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Dialog-BxdIfmFH.js → Dialog-CIjlQZqc.js} +2 -2
- package/dist/core/web/public/next/assets/{Dialog-BxdIfmFH.js.map → Dialog-CIjlQZqc.js.map} +1 -1
- package/dist/core/web/public/next/assets/{DiffViewer-DmeRWuc4.js → DiffViewer-BjQZAm5L.js} +2 -2
- package/dist/core/web/public/next/assets/{DiffViewer-DmeRWuc4.js.map → DiffViewer-BjQZAm5L.js.map} +1 -1
- package/dist/core/web/public/next/assets/{McpSection-q34T7Tho.js → McpSection-D2FySMy3.js} +2 -2
- package/dist/core/web/public/next/assets/{McpSection-q34T7Tho.js.map → McpSection-D2FySMy3.js.map} +1 -1
- package/dist/core/web/public/next/assets/{MutationTokenDialog-CFAkwOEt.js → MutationTokenDialog-QBPrD1UE.js} +2 -2
- package/dist/core/web/public/next/assets/{MutationTokenDialog-CFAkwOEt.js.map → MutationTokenDialog-QBPrD1UE.js.map} +1 -1
- package/dist/core/web/public/next/assets/{ResourcePoolConsoleApp-DHc8GFOY.js → ResourcePoolConsoleApp-Dzq9Ufq_.js} +2 -2
- package/dist/core/web/public/next/assets/{ResourcePoolConsoleApp-DHc8GFOY.js.map → ResourcePoolConsoleApp-Dzq9Ufq_.js.map} +1 -1
- package/dist/core/web/public/next/assets/{RouteErrorBoundary-ZL9F4qUn.js → RouteErrorBoundary-Chd-wt6w.js} +2 -2
- package/dist/core/web/public/next/assets/{RouteErrorBoundary-ZL9F4qUn.js.map → RouteErrorBoundary-Chd-wt6w.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Segmented-DbRjVye3.js → Segmented-DhGh7Y1s.js} +2 -2
- package/dist/core/web/public/next/assets/{Segmented-DbRjVye3.js.map → Segmented-DhGh7Y1s.js.map} +1 -1
- package/dist/core/web/public/next/assets/{SettingsSection-nJGGGYqv.js → SettingsSection-Bqimu_Mg.js} +2 -2
- package/dist/core/web/public/next/assets/{SettingsSection-nJGGGYqv.js.map → SettingsSection-Bqimu_Mg.js.map} +1 -1
- package/dist/core/web/public/next/assets/{UniverseConsoleApp-6GJydgo4.js → UniverseConsoleApp-DzAyrE-A.js} +2 -2
- package/dist/core/web/public/next/assets/{UniverseConsoleApp-6GJydgo4.js.map → UniverseConsoleApp-DzAyrE-A.js.map} +1 -1
- package/dist/core/web/public/next/assets/{UniverseView-DLDtNYL8.js → UniverseView-BGl3DRV7.js} +2 -2
- package/dist/core/web/public/next/assets/{UniverseView-DLDtNYL8.js.map → UniverseView-BGl3DRV7.js.map} +1 -1
- package/dist/core/web/public/next/assets/{UsageSection-Cf9d9iFH.js → UsageSection-PaaJ1L90.js} +2 -2
- package/dist/core/web/public/next/assets/{UsageSection-Cf9d9iFH.js.map → UsageSection-PaaJ1L90.js.map} +1 -1
- package/dist/core/web/public/next/assets/{VerseConsoleApp-y0uOHixd.js → VerseConsoleApp-DYH7ottg.js} +3 -3
- package/dist/core/web/public/next/assets/{VerseConsoleApp-y0uOHixd.js.map → VerseConsoleApp-DYH7ottg.js.map} +1 -1
- package/dist/core/web/public/next/assets/{charts-CVooqJWN.js → charts-CnMDT08S.js} +2 -2
- package/dist/core/web/public/next/assets/{charts-CVooqJWN.js.map → charts-CnMDT08S.js.map} +1 -1
- package/dist/core/web/public/next/assets/{context-model-Bqv8DVuH.js → context-model-DTvb2uZy.js} +2 -2
- package/dist/core/web/public/next/assets/{context-model-Bqv8DVuH.js.map → context-model-DTvb2uZy.js.map} +1 -1
- package/dist/core/web/public/next/assets/{global-eaY9GyX3.js → global-F2K14nNo.js} +2 -2
- package/dist/core/web/public/next/assets/{global-eaY9GyX3.js.map → global-F2K14nNo.js.map} +1 -1
- package/dist/core/web/public/next/assets/{icons-vex8rclC.js → icons-B2fa40k6.js} +2 -2
- package/dist/core/web/public/next/assets/{icons-vex8rclC.js.map → icons-B2fa40k6.js.map} +1 -1
- package/dist/core/web/public/next/assets/{index-D2Eik-zt.js → index-DO9a5IaB.js} +3 -3
- package/dist/core/web/public/next/assets/{index-D2Eik-zt.js.map → index-DO9a5IaB.js.map} +1 -1
- package/dist/core/web/public/next/assets/{queries-bAYU0VNy.js → queries-BdSsWYSu.js} +2 -2
- package/dist/core/web/public/next/assets/{queries-bAYU0VNy.js.map → queries-BdSsWYSu.js.map} +1 -1
- package/dist/core/web/public/next/assets/{use-guarded-action-C7QrP7Yp.js → use-guarded-action-BrlIU0jJ.js} +2 -2
- package/dist/core/web/public/next/assets/{use-guarded-action-C7QrP7Yp.js.map → use-guarded-action-BrlIU0jJ.js.map} +1 -1
- package/dist/core/web/public/next/assets/{verse-model-TfDk9cky.js → verse-model-GWqHIjMG.js} +2 -2
- package/dist/core/web/public/next/assets/{verse-model-TfDk9cky.js.map → verse-model-GWqHIjMG.js.map} +1 -1
- package/dist/core/web/public/next/assets/{workspace-model-CHol5RVp.js → workspace-model-4yzB--1h.js} +2 -2
- package/dist/core/web/public/next/assets/{workspace-model-CHol5RVp.js.map → workspace-model-4yzB--1h.js.map} +1 -1
- package/dist/core/web/public/next/index.html +1 -1
- package/dist/release-dependency-inventory.json +1 -1
- package/package.json +1 -1
package/dist/core/web/public/next/assets/{UsageSection-Cf9d9iFH.js → UsageSection-PaaJ1L90.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,n as t,o as n}from"./index-D2Eik-zt.js";import{b as r,i,p as a,r as o,s,v as c,y as l}from"./global-eaY9GyX3.js";import{i as u}from"./RouteErrorBoundary-ZL9F4qUn.js";import{r as ee}from"./queries-bAYU0VNy.js";import{a as d,c as f,d as p,f as m,i as h,l as g,n as _,o as v,r as y,s as b,t as x,u as S}from"./charts-CVooqJWN.js";import{A as te,D as ne,E as C,O as re,T as ie,_ as ae,j as oe,k as se,w as ce}from"./VerseConsoleApp-y0uOHixd.js";import{f as le}from"./format-BNYWGJat.js";import{f as ue}from"./fleet-model-ClBbQ0Uj.js";import{n as w}from"./verse-model-TfDk9cky.js";import{S as de,d as fe,k as T}from"./context-model-Bqv8DVuH.js";var E=n(e(),1),D={claude:`var(--engine-claude, #c96442)`,codex:`var(--engine-codex, #10a37f)`,grok:`var(--engine-grok, #6b7280)`,local:`var(--engine-local, #7c5cff)`},O={claude:`Claude publishes no local utilization signal, so there is no window percentage to read. Ashlr deliberately never throttles this seat on a guess.`,grok:`Grok is absent from the per-engine usage snapshot, so this fallback roster has no window data for it. Its real state comes from the per-account probe.`},k=`The only figure available is derived from the dispatch ledger against a configured cap, not from the subscription itself. It is shown under Dispatch limits.`,A=`Local models have no subscription and no quota window — only whether the runtime is up.`,pe={"account-observation":`from this account’s observed windows`,"subscription-tracker":`from the subscription tracker`};function j(e){return{sourceState:`unknown`,complete:!1,reason:e}}function M(e){return e>=90?`danger`:e>=80?`warn`:`ok`}function N(e){return Number.isFinite(e)?Math.max(0,Math.min(100,e)):0}function P(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function F(e,t,n){return{kind:`measured`,source:e,scope:t,windows:n}}function I(e){return{kind:`unknown`,reason:O[e]??`No subscription window reading is reported for this engine.`}}function me(e){let{engine:t,seat:n,subscription:r,frontier:i,engineSeatCount:a=1}=e;if(t===`local`)return{kind:`not-applicable`,reason:A};let o=(n?.health.windows??[]).filter(e=>typeof e.usedPercent==`number`&&Number.isFinite(e.usedPercent));if(o.length>0)return F(`account-observation`,`account`,o.map(e=>{let t=N(e.usedPercent),n=e.resetsAt?Date.parse(e.resetsAt):NaN;return{id:e.id,label:e.id,usedPct:t,resetsAt:Number.isNaN(n)?null:Math.round(n/1e3),tone:M(t)}}));if(r&&r.hasData&&r.windows.length>0)return F(`subscription-tracker`,a>1?`engine`:`account`,r.windows.map((e,t)=>{let n=N(e.usedPercent);return{id:`${e.label}-${t}`,label:e.label,usedPct:n,resetsAt:P(e.resetsAt),tone:M(n)}}));if(r&&!r.hasData)return I(t);if(i&&i.subscriptionWindow.state!==`unknown`){if(i.limit===void 0){let e=N(i.subscriptionWindow.usedPct);return F(`subscription-tracker`,a>1?`engine`:`account`,[{id:i.subscriptionWindow.windowLabel??`window`,label:i.subscriptionWindow.windowLabel??`window`,usedPct:e,resetsAt:P(i.subscriptionWindow.resetsAt),tone:M(e)}])}return{kind:`unknown`,reason:k}}return I(t)}function he(e){if(!e)return null;let t=(e.byProvider??[]).map(e=>({provider:e.provider,tier:e.tier,tokens:e.tokens,costUsd:e.costUsd,sharePct:e.sharePct})),n=(e,n)=>t.filter(t=>t.tier===e).reduce((e,t)=>e+(t[n]||0),0);return{window:e.window,totalTokens:e.totalTokens,totalCostUsd:e.totalCostUsd,localSavingsUsd:e.localSavingsUsd,localTokens:n(`local`,`tokens`),cloudTokens:n(`cloud`,`tokens`),localCostUsd:n(`local`,`costUsd`),cloudCostUsd:n(`cloud`,`costUsd`),byProvider:[...t].sort((e,t)=>t.tokens-e.tokens),empty:t.length===0&&e.totalTokens===0}}function ge(e,t){let n=[],r=new Set;for(let t of e??[]){let e=`${t.backend}:${t.window}`;r.add(e);let i=t.max>0?N(t.used/t.max*100):null;n.push({id:e,backend:t.backend,window:t.window,max:t.max,used:t.used,standing:t.standing,usedPct:i,configuredOnly:!1})}for(let e of t??[]){let t=`${e.engine}:${e.window}`;r.has(t)||(r.add(t),n.push({id:t,backend:e.engine,window:e.window,max:e.max,used:null,standing:`unknown`,usedPct:null,configuredOnly:!0}))}return n.sort((e,t)=>e.backend.localeCompare(t.backend)||e.window.localeCompare(t.window))}var L=`No per-day series is available: the sources this view reads carry aggregate spend only, not a dated history.`;function _e(e){if(!e)return{available:!1,reason:L};if(e.sourceQuality?.sourceState!==`healthy`)return{available:!1,reason:`No per-day series: the daemon ledger is ${e.sourceQuality?.sourceState??`unavailable`}${e.sourceQuality?.reason?` (${e.sourceQuality.reason})`:``}.`};let t=e.ticks;if(!t||t.length===0)return{available:!1,reason:L};let n=new Map;for(let e of t){let t=Date.parse(e.ts);if(Number.isNaN(t))continue;let r=new Date(t).toISOString().slice(0,10);n.set(r,(n.get(r)??0)+(Number.isFinite(e.spentUsd)?e.spentUsd:0))}if(n.size<2)return{available:!1,reason:`No per-day series: only ${n.size} day${n.size===1?``:`s`} of daemon ticks is retained, which is not a trend.`};let r=[...n.keys()].sort(),i=r[0],a=r[r.length-1],o=[];for(let e=Date.parse(`${i}T00:00:00Z`);e<=Date.parse(`${a}T00:00:00Z`);e+=864e5){let t=new Date(e).toISOString().slice(0,10);o.push({day:t,usd:n.has(t)?n.get(t):null})}return{available:!0,days:o,tickCount:t.length,caveat:`From the last ${t.length} recorded daemon ticks. The tick ledger is capped and records the autonomous loop only — interactive chat turns are not in it, and a gap is a day with no retained tick, not a measured zero.`}}var R={available:!1,reason:null,dailyBudgetUsd:null,subscriptionMaxPercent:null,todaySpentUsd:null,todaySpentDate:null,foundryLimits:[]};function z(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function B(e,t){if(!e)return null;for(let n of t){let t=e[n];if(typeof t==`number`&&Number.isFinite(t))return t}return null}function ve(e,t=null){let n=z(e);if(!n)return{...R,reason:t};let r=z(n.caps)??n,i=z(n.daemon),a=z(n.spend),o=[],s=r.foundryLimits;if(Array.isArray(s))for(let e of s){let t=z(e);if(!t)continue;let n=typeof t.engine==`string`?t.engine:null,r=B(t,[`max`]);n!==null&&r!==null&&o.push({engine:n,window:typeof t.window==`string`?t.window:`1d`,max:r})}return{available:!0,reason:t,dailyBudgetUsd:B(r,[`dailyBudgetUsd`]),subscriptionMaxPercent:B(r,[`subscriptionMaxPercent`]),todaySpentUsd:a?B(a,[`todayUsd`]):B(n,[`todaySpentUsd`,`todaySpendUsd`,`spendTodayUsd`])??B(i,[`todaySpentUsd`]),todaySpentDate:a&&typeof a.todayDate==`string`?a.todayDate:null,foundryLimits:o}}function ye(e){return{...R,reason:e}}var V={section:`_section_1aa17_11`,header:`_header_1aa17_20`,headerTitle:`_headerTitle_1aa17_33`,headerMeta:`_headerMeta_1aa17_41`,ghostButton:`_ghostButton_1aa17_50`,scroll:`_scroll_1aa17_67`,panel:`_panel_1aa17_75`,panelHead:`_panelHead_1aa17_83`,panelTitle:`_panelTitle_1aa17_95`,panelNote:`_panelNote_1aa17_104`,muted:`_muted_1aa17_111`,noteList:`_noteList_1aa17_124`,num:`_num_1aa17_135`,tiles:`_tiles_1aa17_142`,cards:`_cards_1aa17_150`,card:`_card_1aa17_150`,cardHead:`_cardHead_1aa17_177`,cardLabel:`_cardLabel_1aa17_185`,cardMeta:`_cardMeta_1aa17_196`,cardFigures:`_cardFigures_1aa17_206`,figure:`_figure_1aa17_215`,figureLabel:`_figureLabel_1aa17_222`,figureValue:`_figureValue_1aa17_230`,windows:`_windows_1aa17_239`,windowHead:`_windowHead_1aa17_246`,windowPct:`_windowPct_1aa17_256`,windowReset:`_windowReset_1aa17_262`,track:`_track_1aa17_275`,fill:`_fill_1aa17_283`,unknownRule:`_unknownRule_1aa17_311`,signalRow:`_signalRow_1aa17_318`,reason:`_reason_1aa17_325`,sourceLine:`_sourceLine_1aa17_333`,split:`_split_1aa17_348`,splitRow:`_splitRow_1aa17_355`,splitBar:`_splitBar_1aa17_364`,splitFill:`_splitFill_1aa17_371`,limitList:`_limitList_1aa17_377`,limitRow:`_limitRow_1aa17_382`,limitName:`_limitName_1aa17_395`,limitWindow:`_limitWindow_1aa17_404`,limitValue:`_limitValue_1aa17_409`,verdictDetail:`_verdictDetail_1aa17_425`,bindingLabel:`_bindingLabel_1aa17_433`,windowBlock:`_windowBlock_1aa17_443`,windowBlockLead:`_windowBlockLead_1aa17_452`,windowFlag:`_windowFlag_1aa17_465`,creditsRow:`_creditsRow_1aa17_473`,actionBlock:`_actionBlock_1aa17_488`,command:`_command_1aa17_494`,commandInline:`_commandInline_1aa17_495`,negative:`_negative_1aa17_510`,segmented:`_segmented_1aa17_516`,segment:`_segment_1aa17_516`,charts:`_charts_1aa17_558`,tableScroll:`_tableScroll_1aa17_570`,stateBlock:`_stateBlock_1aa17_578`,stateTitle:`_stateTitle_1aa17_586`,stateBody:`_stateBody_1aa17_595`,stateActions:`_stateActions_1aa17_601`,skeletonGrid:`_skeletonGrid_1aa17_605`,capacity:`_capacity_1aa17_660`,capacityHeadline:`_capacityHeadline_1aa17_665`,chips:`_chips_1aa17_680`,chip:`_chip_1aa17_680`,chipLabel:`_chipLabel_1aa17_727`,chipState:`_chipState_1aa17_737`,chipPct:`_chipPct_1aa17_757`,capacityFacts:`_capacityFacts_1aa17_763`,capacityFact:`_capacityFact_1aa17_763`,capacityMuted:`_capacityMuted_1aa17_777`,proseResets:`_proseResets_1aa17_783`,visuallyHidden:`_visuallyHidden_1aa17_787`,cardTrigger:`_cardTrigger_1aa17_807`,cardChevron:`_cardChevron_1aa17_823`,detail:`_detail_1aa17_848`,detailHead:`_detailHead_1aa17_856`,detailTitle:`_detailTitle_1aa17_863`,detailGrid:`_detailGrid_1aa17_871`,detailColumn:`_detailColumn_1aa17_878`,evidenceList:`_evidenceList_1aa17_882`,evidenceRow:`_evidenceRow_1aa17_889`,evidenceValue:`_evidenceValue_1aa17_896`,figureTile:`_figureTile_1aa17_907`,figureBig:`_figureBig_1aa17_918`,figureCaption:`_figureCaption_1aa17_926`,panelActions:`_panelActions_1aa17_934`,placement:`_placement_1aa17_947`,placementBar:`_placementBar_1aa17_954`,placementGpu:`_placementGpu_1aa17_964`,placementCpu:`_placementCpu_1aa17_965`,placementText:`_placementText_1aa17_971`,staleNotice:`_staleNotice_1aa17_984`,staleFlag:`_staleFlag_1aa17_998`},H=t();function U({view:e,ariaPrefix:t,prominent:n=!1}){let r=`${t} ${e.label}`;if(e.limitReached)return(0,H.jsxs)(`div`,{className:n?V.windowBlockLead:V.windowBlock,children:[(0,H.jsxs)(`div`,{className:V.windowHead,children:[(0,H.jsx)(`span`,{children:e.label}),(0,H.jsx)(`span`,{className:V.windowFlag,children:`limit reached`})]}),(0,H.jsx)(`div`,{className:V.track,"data-tone":`danger`,role:`img`,"aria-label":`${r}: the provider flagged this window as rate-limited, so no percentage is shown`,children:(0,H.jsx)(`div`,{className:V.fill,style:{width:`100%`}})}),e.resetText?(0,H.jsx)(`p`,{className:V.windowReset,children:e.resetText}):null]});if(e.usedPct===null)return(0,H.jsxs)(`div`,{className:n?V.windowBlockLead:V.windowBlock,children:[(0,H.jsxs)(`div`,{className:V.windowHead,children:[(0,H.jsx)(`span`,{children:e.label}),(0,H.jsx)(u,{quality:j(`No percentage was reported for this window.`),label:r,children:null})]}),(0,H.jsx)(`hr`,{className:V.unknownRule,"aria-hidden":`true`})]});let i=Math.round(e.usedPct);return(0,H.jsxs)(`div`,{className:n?V.windowBlockLead:V.windowBlock,children:[(0,H.jsxs)(`div`,{className:V.windowHead,children:[(0,H.jsx)(`span`,{children:e.label}),(0,H.jsxs)(`span`,{className:V.windowPct,children:[i,`%`]})]}),(0,H.jsx)(`div`,{className:V.track,"data-tone":e.tone,role:`meter`,"aria-label":`${r} used`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i,"aria-valuetext":`${i}% used${e.resetText?`, ${e.resetText}`:``}`,children:(0,H.jsx)(`div`,{className:V.fill,style:{width:`${i}%`}})}),e.resetText?(0,H.jsx)(`p`,{className:V.windowReset,children:e.resetText}):null]})}var be={available:`success`,credits:`success`,tight:`warning`,exhausted:`danger`,"signed-out":`warning`,"probe-unsupported":`warning`,unknown:`unknown`};function xe({credits:e}){if(!e)return null;let t=e.unlimited?`unlimited`:e.balance===null?null:e.balanceValue===null?e.balance:e.balanceValue.toLocaleString(`en-US`,{maximumFractionDigits:2});return(0,H.jsxs)(`div`,{className:V.creditsRow,children:[(0,H.jsx)(`span`,{className:V.figureLabel,children:`Credits`}),(0,H.jsx)(`span`,{className:V.num,title:e.balance??void 0,children:t??`not reported`}),(0,H.jsx)(`p`,{className:V.reason,children:`Credits are a separate pool from the window above — a fully used window does not stop a spendable balance from being spent. The provider gives a bare number, not a currency, so it is shown as reported.`})]})}function Se({card:e,onOpen:t,expanded:n=!1,triggerId:r,detailId:i}){let o={"--engine-color":e.color},s=e.verdict.state===`signed-out`,c=t!==void 0&&e.hasDetail,l=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:V.cardLabel,children:e.label}),(0,H.jsx)(a,{status:e.verdict.state,tone:be[e.verdict.state],children:e.verdict.headline})]});return(0,H.jsxs)(`article`,{className:V.card,style:o,"aria-label":`${e.label} usage`,"data-selected":n?`true`:void 0,children:[c?(0,H.jsxs)(`button`,{type:`button`,id:r,className:`${V.cardHead} ${V.cardTrigger}`,"aria-expanded":n,...i?{"aria-controls":i}:{},onClick:()=>t(e.id),children:[l,(0,H.jsx)(`span`,{className:V.cardChevron,"aria-hidden":`true`,children:n?`−`:`+`})]}):(0,H.jsx)(`div`,{className:V.cardHead,children:l}),(0,H.jsxs)(`div`,{className:V.cardMeta,children:[(0,H.jsx)(`span`,{children:w[e.engine]}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,H.jsx)(`span`,{children:e.plan?`${e.plan} plan`:`plan not reported`})]}),(0,H.jsx)(`p`,{className:V.verdictDetail,children:e.verdict.detail}),e.verdict.code?(0,H.jsxs)(`p`,{className:V.sourceLine,children:[`Probe reason `,(0,H.jsx)(`code`,{className:V.commandInline,children:e.verdict.code})]}):null,e.binding?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:V.bindingLabel,children:`Binding constraint`}),(0,H.jsx)(U,{view:e.binding,ariaPrefix:e.label,prominent:!0})]}):null,e.others.length>0?(0,H.jsx)(`div`,{className:V.windows,children:e.others.map(t=>(0,H.jsx)(U,{view:t,ariaPrefix:e.label},t.id))}):null,(0,H.jsx)(xe,{credits:e.credits}),s?(0,H.jsx)(`div`,{className:V.actionBlock,children:e.reconnectCommand?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:V.figureLabel,children:`Reconnect`}),(0,H.jsx)(`code`,{className:V.command,children:e.reconnectCommand})]}):(0,H.jsxs)(`p`,{className:V.reason,children:[`Sign this account back in through its own provider CLI under its pinned profile. Ashlr does not print that invocation here, because the pinned-profile launcher path is never allowed onto a surface. `,(0,H.jsx)(`code`,{className:V.commandInline,children:`ashlr resources`}),` `,`shows the connection state once it is back.`]})}):null,e.sourceNote?(0,H.jsx)(`p`,{className:V.sourceLine,children:e.sourceNote}):null]})}var Ce={available:`success`,credits:`success`,tight:`warning`,exhausted:`danger`,"signed-out":`warning`,"probe-unsupported":`warning`,unknown:`unknown`},we=`No per-account history is retained by any source this view reads: the accounts route is a point-in-time snapshot and the usage series carries no per-account breakdown. A trend is not drawn from one reading.`;function W(e,t){return e===null?`The source behind this card reports no health verdict at all.`:e===`unknown`?t===`claude`?`Health reads unknown, which is how this provider always reads — the probe has no health channel for it. It is not a fault.`:`Health reads unknown: the monitor took no verdict on this account.`:`Monitor health: ${e}.`}function G({label:e,children:t}){return(0,H.jsxs)(`div`,{className:V.evidenceRow,children:[(0,H.jsx)(`dt`,{className:V.figureLabel,children:e}),(0,H.jsx)(`dd`,{className:V.evidenceValue,children:t})]})}function Te({card:e,onClose:t,headingId:n}){let{evidence:r}=e,i=e.credits,o=(0,E.useRef)(null);return(0,E.useEffect)(()=>{o.current?.focus()},[e.id]),(0,H.jsxs)(`section`,{className:V.detail,"aria-labelledby":n,children:[(0,H.jsxs)(`div`,{className:V.detailHead,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h4`,{id:n,ref:o,tabIndex:-1,className:V.detailTitle,children:e.label}),(0,H.jsxs)(`div`,{className:V.cardMeta,children:[(0,H.jsx)(`span`,{children:w[e.engine]}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,H.jsx)(`span`,{children:e.plan?`${e.plan} plan`:`plan not reported`}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,H.jsx)(a,{status:e.verdict.state,tone:Ce[e.verdict.state],children:e.verdict.headline})]})]}),(0,H.jsx)(`button`,{type:`button`,className:V.ghostButton,onClick:t,children:`Close`})]}),(0,H.jsx)(`p`,{className:V.verdictDetail,children:e.verdict.detail}),(0,H.jsxs)(`div`,{className:V.detailGrid,children:[(0,H.jsxs)(`div`,{className:V.detailColumn,children:[(0,H.jsxs)(`span`,{className:V.figureLabel,children:[`All windows (`,e.allWindows.length,`)`]}),e.allWindows.length===0?(0,H.jsx)(`p`,{className:V.reason,children:`This account reported no windows at all. That is an absent reading, not a set of windows at zero.`}):(0,H.jsx)(`div`,{className:V.windows,children:e.allWindows.map((t,n)=>(0,H.jsx)(U,{view:t,ariaPrefix:e.label,prominent:n===0},t.id))}),e.allWindows.some(e=>!e.measured)?(0,H.jsx)(`p`,{className:V.reason,children:`At least one window above carries a provider FLAG rather than a measurement, so no percentage is printed for it. A flagged limit and a measured 100% are different facts.`}):null]}),(0,H.jsxs)(`div`,{className:V.detailColumn,children:[(0,H.jsx)(`span`,{className:V.figureLabel,children:`Probe evidence`}),(0,H.jsxs)(`dl`,{className:V.evidenceList,children:[(0,H.jsx)(G,{label:`Connection`,children:r.state}),(0,H.jsx)(G,{label:`Authentication`,children:r.authentication}),(0,H.jsx)(G,{label:`Health`,children:W(r.health,e.engine)}),(0,H.jsx)(G,{label:`Observed`,children:r.observedAt===null?(0,H.jsx)(`span`,{className:V.capacityMuted,children:`no observation timestamp was reported`}):(0,H.jsx)(`span`,{className:V.num,children:new Date(r.observedAt).toLocaleString()})}),(0,H.jsx)(G,{label:`Probe reason`,children:r.reasonCode===null?(0,H.jsx)(`span`,{className:V.capacityMuted,children:`none reported`}):(0,H.jsx)(`code`,{className:V.commandInline,children:r.reasonCode})}),r.unsupported?(0,H.jsxs)(G,{label:`Version pin`,children:[(0,H.jsx)(`code`,{className:V.commandInline,children:r.unsupported.code}),r.unsupported.pinnedVersion?(0,H.jsxs)(H.Fragment,{children:[` `,`pinned to `,(0,H.jsx)(`span`,{className:V.num,children:r.unsupported.pinnedVersion}),`. A one-line constant bump, not an outage.`]}):null]}):null]}),i?(0,H.jsxs)(`div`,{className:V.creditsRow,children:[(0,H.jsx)(`span`,{className:V.figureLabel,children:`Credits`}),(0,H.jsx)(`span`,{className:V.num,title:i.balance??void 0,children:i.unlimited?`unlimited`:i.balanceValue===null?i.balance??`not reported`:i.balanceValue.toLocaleString(`en-US`,{maximumFractionDigits:2})}),(0,H.jsx)(`p`,{className:V.reason,children:`A separate pool from every window above. The provider gives a bare number, not a currency, so it is shown as reported.`})]}):null,r.notes.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:V.figureLabel,children:`Provider notes`}),(0,H.jsx)(`ul`,{className:V.noteList,children:r.notes.map(e=>(0,H.jsx)(`li`,{className:V.capacityMuted,children:e},e))})]}):null]})]}),(0,H.jsx)(`p`,{className:V.sourceLine,children:we})]})}var Ee={available:`ready`,credits:`ready`,tight:`tight`,exhausted:`blocked`,"signed-out":`blocked`,"probe-unsupported":`blocked`,unknown:`unread`};function K(e,t,n){return e===1?t:n}function De(e){let{ready:t,tight:n,blocked:r,unread:i,total:a,local:o}=e;if(a===0)return`No seats are reported at all. This is an empty roster, not a set of seats at zero.`;let s=o===null?``:o.reachable&&o.residentCount>0?` ${o.residentCount} local ${K(o.residentCount,`model is`,`models are`)} resident and answer with no load delay.`:o.reachable&&o.agenticCount>0?` No local model is resident, but ${o.agenticCount} installed ${K(o.agenticCount,`one can`,`ones can`)} drive a session after a load.`:o.reachable?` No local model is resident.`:` The local runtime did not answer, so local capacity is unknown.`,c=i===0?``:` ${i} ${K(i,`seat has`,`seats have`)} no reading at all — unread, not exhausted.`;return t>0?`${t} of ${a} ${K(a,`seat is`,`seats are`)} usable right now.${c}${s}`:n>0?`No seat is clear: ${n} ${K(n,`is`,`are`)} running tight and ${r} ${K(r,`is`,`are`)} blocked.${c}${s}`:r>0?`No cloud seat reports headroom — ${r} blocked.${c}${s}`:`No seat reported a usable window.${c}${s}`}function Oe(e){let t=e.binding;return{id:e.id,label:e.label,kind:`account`,color:e.color,cls:Ee[e.verdict.state],headline:e.verdict.headline,usedPct:t&&t.measured&&!t.limitReached?t.usedPct:null,measured:t!==null&&t.measured&&!t.limitReached}}function ke(e){return{id:`local`,label:`Local`,kind:`local`,color:e.color,cls:Ee[e.verdict.state],headline:e.verdict.headline,usedPct:e.usedPct,measured:e.usedPct!==null}}function Ae(e,t){let n=[],r=[],i=new Set;for(let a of e)for(let e of a.windows){if(e.resetsAt!==null){let r=Date.parse(e.resetsAt);if(!Number.isNaN(r)){let i=r-t;n.push({seatLabel:a.label,windowLabel:e.label,atMs:r,inMs:i,overdue:i<=0});continue}}if(e.resetText!==null){let t=`${a.label}|${e.label}|${e.resetText}`;if(i.has(t))continue;i.add(t),r.push({seatLabel:a.label,windowLabel:e.label,text:e.resetText})}}return{instants:n,prose:r}}function je(e){let t=e.filter(e=>!e.overdue);return t.length>0?t.reduce((e,t)=>t.inMs<e.inMs?t:e):e.length===0?null:e.reduce((e,t)=>t.atMs>e.atMs?t:e)}function Me(e,t){let n=e.filter(e=>e.atMs>t);return n.length>0?n.reduce((e,t)=>t.atMs<e.atMs?t:e):e.length===0?null:e.reduce((e,t)=>t.atMs>e.atMs?t:e)}function Ne(e,t){if(e===null&&t===null)return null;let n=e?.residentBytes??t?.residentBytes??null,r=e?.memoryBudgetBytes??t?.memoryBudgetBytes??null;return{reachable:t?.reachable??e?.verdict.state!==`unknown`,residentCount:e?.residentCount??t?.rows.filter(e=>e.resident).length??0,installedCount:e?.installedCount??t?.rows.length??0,agenticCount:t?.agenticCount??0,unknownToolCount:t?.unknownToolCount??0,residentBytes:n,memoryBudgetBytes:r,headroomBytes:n!==null&&r!==null?Math.max(0,r-n):null,freeMemoryBytes:t?.freeMemoryBytes??null,usedPct:e?.usedPct??t?.memoryUsedPct??null}}function Pe(e){let t=e.nowMs??Date.now(),n=e.cards.map(Oe);e.localCard&&n.push(ke(e.localCard));let r=e=>n.filter(t=>t.cls===e).length,i=r(`ready`),a=r(`tight`),o=r(`blocked`),s=r(`unread`),{instants:c,prose:l}=Ae(e.cards.map(e=>({label:e.label,windows:e.allWindows})),t),u=Ne(e.localCard,e.localView);return{seats:n,ready:i,tight:a,blocked:o,unread:s,total:n.length,resets:c,nextReset:je(c),proseResets:l,local:u,headline:De({ready:i,tight:a,blocked:o,unread:s,total:n.length,local:u}),noCapacity:n.length>0&&i===0&&a===0&&s<n.length}}function Fe(e){if(!Number.isFinite(e))return`—`;if(e<=0)return`overdue`;let t=Math.floor(e/1e3),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60);return n>0?`${n}d ${r}h`:r>0?`${r}h ${i}m`:i>0?`${i}m`:`${t}s`}function Ie(e){return e===null?`unknown`:e.includes(`tools`)?`supported`:`unsupported`}function Le(e,t){return e===null?t!==null&&t.length===0?`unknown`:Ie(t):e?`supported`:`unsupported`}function Re(e,t){let n=e.expiresAt?Date.parse(e.expiresAt):NaN,r=e.gpuPercent??(e.sizeBytes!==null&&e.sizeBytes>0&&e.sizeVramBytes!==null?Math.max(0,Math.min(100,e.sizeVramBytes/e.sizeBytes*100)):null);return{name:e.name,runtime:e.runtime,resident:e.loaded,placement:e.placement,memoryPct:e.loaded?e.memoryPercent:null,family:e.family,sizeBytes:e.sizeBytes,sizeVramBytes:e.sizeVramBytes,gpuPct:r,expiresInMs:e.loaded&&!Number.isNaN(n)?n-t:null,expiresAtMs:e.loaded&&!Number.isNaN(n)?n:null,parameterSize:e.parameterSize,quantization:e.quantization,nativeContext:e.nativeContext,configuredContext:e.configuredContext,contextTruncated:e.nativeContext!==null&&e.configuredContext!==null&&e.configuredContext<e.nativeContext,tools:Le(e.supportsTools,e.capabilities)}}function ze(e){let t=e.filter(e=>e.stale);if(t.length===0)return{stale:!1,staleForMs:null,runtimes:[]};let n=t.map(e=>e.staleForMs).filter(e=>e!==null);return{stale:!0,staleForMs:n.length===0?null:Math.max(...n),runtimes:t.map(e=>e.runtime)}}function Be(e){if(e===null||!Number.isFinite(e)||e<0)return`an unreported interval`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return r===0?`${n}m`:`${n}m ${r}s`}function Ve(e,t=Date.now()){if(!e)return null;let n=e.models.map(e=>Re(e,t)).sort((e,t)=>Number(t.resident)-Number(e.resident)||e.name.localeCompare(t.name)),r=n.filter(e=>e.resident),i=r.some(e=>e.sizeBytes===null)?null:r.reduce((e,t)=>e+(t.sizeBytes??0),0),a=e.memoryBudgetBytes;return{reachable:e.reachable,reason:e.reason,rows:n,residentBytes:i,memoryBudgetBytes:a,memoryUsedPct:i!==null&&a!==null&&a>0?Math.max(0,Math.min(100,i/a*100)):null,freeMemoryBytes:e.freeMemoryBytes,runtimes:e.runtimes,notes:e.notes,agenticCount:n.filter(e=>e.tools===`supported`).length,nonAgenticCount:n.filter(e=>e.tools===`unsupported`).length,unknownToolCount:n.filter(e=>e.tools===`unknown`).length}}function q(e){if(e===null||!Number.isFinite(e))return`—`;let t=e/1024**3;if(t>=10)return`${t.toFixed(0)} GB`;if(t>=1)return`${t.toFixed(1)} GB`;let n=e/1024**2;return`${Math.round(n)} MB`}function He(e){if(e===null||!Number.isFinite(e))return`—`;if(e<=0)return`expired`;let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}h ${r}m`:r>0?`${r}m ${i}s`:`${i}s`}function J(e){return e===null||!Number.isFinite(e)?`—`:e>=1024?`${Math.round(e/1024)}k`:String(e)}var Ue={ready:`usable`,tight:`tight`,blocked:`blocked`,unread:`no reading`};function We(e,t=3e4){let[n,r]=(0,E.useState)(()=>Date.now());return(0,E.useEffect)(()=>{if(!e)return;let n=setInterval(()=>r(Date.now()),t);return()=>clearInterval(n)},[e,t]),n}function Ge({seat:e,selected:t,onSelect:n}){let r={"--engine-color":e.color},i=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:V.chipLabel,children:e.label}),(0,H.jsx)(`span`,{className:V.chipState,children:Ue[e.cls]}),e.usedPct===null?null:(0,H.jsxs)(`span`,{className:V.chipPct,children:[Math.round(e.usedPct),`%`]})]});return n===null?(0,H.jsx)(`span`,{className:V.chip,style:r,"data-capacity":e.cls,children:i}):(0,H.jsx)(`button`,{type:`button`,className:V.chip,style:r,"data-capacity":e.cls,"aria-pressed":t,onClick:()=>n(e.id),children:i})}function Ke({overview:e,selectedId:t,onSelectSeat:n}){let r=We(e.resets.length>0),i=(0,E.useMemo)(()=>Me(e.resets,r),[e.resets,r]),a=i===null?0:i.atMs-r,o=a<=0,s=e.local;return(0,H.jsxs)(`section`,{className:V.capacity,"aria-labelledby":`verse-capacity-heading`,children:[(0,H.jsx)(`h3`,{id:`verse-capacity-heading`,className:V.visuallyHidden,children:`Capacity right now`}),(0,H.jsx)(`p`,{className:V.capacityHeadline,"data-empty":e.noCapacity?`true`:void 0,children:e.headline}),e.seats.length>0?(0,H.jsx)(`div`,{className:V.chips,role:`list`,"aria-label":`Seat capacity`,children:e.seats.map(e=>(0,H.jsx)(`span`,{role:`listitem`,children:(0,H.jsx)(Ge,{seat:e,selected:t===e.id,onSelect:e.kind===`account`?n:null})},e.id))}):null,(0,H.jsxs)(`dl`,{className:V.capacityFacts,children:[(0,H.jsxs)(`div`,{className:V.capacityFact,children:[(0,H.jsx)(`dt`,{className:V.figureLabel,children:`Nearest reset`}),(0,H.jsx)(`dd`,{children:i===null?(0,H.jsx)(`span`,{className:V.capacityMuted,children:`No seat reported a dated reset. That is an absent timestamp, not "never".`}):o?(0,H.jsxs)(`span`,{className:V.capacityMuted,children:[(0,H.jsx)(`span`,{className:V.num,children:i.seatLabel}),` · `,i.windowLabel,` was due to reset at `,new Date(i.atMs).toLocaleString(),` — this reading predates the rollover.`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:V.num,children:Fe(a)}),` `,(0,H.jsxs)(`span`,{className:V.capacityMuted,children:[`· `,i.seatLabel,` `,i.windowLabel,`, at`,` `,new Date(i.atMs).toLocaleString()]})]})})]}),(0,H.jsxs)(`div`,{className:V.capacityFact,children:[(0,H.jsx)(`dt`,{className:V.figureLabel,children:`Local headroom`}),(0,H.jsx)(`dd`,{children:s===null?(0,H.jsx)(`span`,{className:V.capacityMuted,children:`No local source answered.`}):s.reachable?s.headroomBytes===null?(0,H.jsx)(`span`,{className:V.capacityMuted,children:`Either the resident total or the machine budget was not reported, so headroom cannot be computed.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:V.num,children:q(s.headroomBytes)}),` `,(0,H.jsxs)(`span`,{className:V.capacityMuted,children:[`free of `,q(s.memoryBudgetBytes),` · `,s.residentCount,` resident,`,` `,s.installedCount,` installed`]})]}):(0,H.jsx)(`span`,{className:V.capacityMuted,children:`The local runtime did not answer this probe, so headroom is unknown — not zero, and not full.`})})]}),(0,H.jsxs)(`div`,{className:V.capacityFact,children:[(0,H.jsx)(`dt`,{className:V.figureLabel,children:`Agentic locally`}),(0,H.jsx)(`dd`,{children:s===null||!s.reachable?(0,H.jsx)(`span`,{className:V.capacityMuted,children:`unknown`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:V.num,children:s.agenticCount}),` `,(0,H.jsxs)(`span`,{className:V.capacityMuted,children:[`of `,s.installedCount,` installed models can drive a session`,s.unknownToolCount>0?`; ${s.unknownToolCount} did not report a capability list`:``]})]})})]})]}),e.proseResets.length>0?(0,H.jsxs)(`div`,{className:V.proseResets,children:[(0,H.jsx)(`span`,{className:V.figureLabel,children:`Resets reported as text`}),(0,H.jsx)(`ul`,{className:V.noteList,children:e.proseResets.map(e=>(0,H.jsxs)(`li`,{className:V.capacityMuted,children:[e.seatLabel,` · `,e.windowLabel,` — `,e.text]},`${e.seatLabel}-${e.windowLabel}-${e.text}`))}),(0,H.jsx)(`p`,{className:V.capacityMuted,children:`These providers publish a sentence rather than a timestamp, so it is shown exactly as given and never turned into a countdown.`})]}):null]})}function qe(e){let t=e.fullest;if(t===null)return`—`;let n=`${t.exact?``:`≤`}${T(t.tokens)}`;return t.window===null?n:`${n} / ${T(t.window)} · ${d(t.tokens/t.window)}`}var Je=[{key:`seat`,label:`Seat`,render:e=>(0,H.jsxs)(H.Fragment,{children:[e.label,(0,H.jsxs)(`span`,{className:V.limitWindow,children:[` · ${w[e.engine]}`,e.retired?` · no longer connected`:``]})]})},{key:`chats`,label:`Chats`,numeric:!0,render:e=>y(e.sessions)},{key:`turns`,label:`Turns`,numeric:!0,render:e=>y(e.turns)},{key:`prompt`,label:`Prompt tokens`,numeric:!0,render:e=>T(e.promptTokens)},{key:`hit`,label:`Cache hit`,numeric:!0,render:e=>e.cacheHitRatio===null?e.promptTokens>0?`none reported`:`—`:fe(e.cacheHitRatio)},{key:`compactions`,label:`Compactions`,numeric:!0,render:e=>y(e.compactions)},{key:`expansive`,label:`Expansive chats`,numeric:!0,render:e=>y(e.expansiveSessions)},{key:`fullest`,label:`Fullest context`,numeric:!0,render:e=>qe(e)}];function Ye({rows:e,unavailableReason:t}){return(0,H.jsxs)(`section`,{className:V.panel,"aria-labelledby":`verse-usage-efficiency`,children:[(0,H.jsxs)(`div`,{className:V.panelHead,children:[(0,H.jsx)(`h3`,{id:`verse-usage-efficiency`,className:V.panelTitle,children:`Context efficiency`}),(0,H.jsx)(`p`,{className:V.panelNote,children:`Per seat, across every chat on this machine. Cache hit is the share of prompt tokens served from the provider's cache — the higher it is, the less each turn re-reads at full price. Compactions are the CLI summarizing a context that outgrew its budget.`})]}),t===null?e.length===0?(0,H.jsx)(`p`,{className:V.muted,children:`No chats yet, so there is nothing to measure — this is an empty history, not a seat at 0%.`}):(0,H.jsx)(`div`,{className:V.tableScroll,children:(0,H.jsx)(x,{caption:`Context efficiency per seat: chats, turns, prompt tokens, cache-hit ratio, compactions, expansive chats and the fullest context`,columns:Je,rows:[...e],rowKey:e=>e.seatId})}):(0,H.jsx)(`p`,{className:V.muted,children:t}),(0,H.jsx)(`p`,{className:V.sourceLine,children:`Computed in this browser from each chat's recorded totals — no extra request, no spend. “None reported” means the provider reported no cache activity, not a 0% hit rate; a figure marked ≤ is an upper bound. Compactions are counted from Verse 3.9 on; earlier ones were not recorded.`})]})}function Xe(e){switch(e){case`ok`:return`success`;case`warn`:return`warning`;case`over`:return`danger`;case`unlimited`:return`neutral`;default:return`unknown`}}function Ze({rows:e,capsNote:t}){return(0,H.jsxs)(`section`,{className:V.panel,"aria-labelledby":`verse-usage-limits`,children:[(0,H.jsxs)(`div`,{className:V.panelHead,children:[(0,H.jsx)(`h3`,{id:`verse-usage-limits`,className:V.panelTitle,children:`Dispatch limits`}),(0,H.jsx)(`p`,{className:V.panelNote,children:`Calls recorded in the dispatch ledger against each configured foundry cap. This is not subscription utilization.`})]}),t?(0,H.jsx)(`p`,{className:V.muted,children:t}):null,e.length===0?(0,H.jsx)(`p`,{className:V.muted,children:`No foundry limits are configured, so dispatches are uncapped on this machine. Nothing here is being throttled.`}):(0,H.jsx)(`div`,{className:V.limitList,children:e.map(e=>(0,H.jsxs)(`div`,{className:V.limitRow,children:[(0,H.jsxs)(`span`,{className:V.limitName,children:[e.backend,(0,H.jsxs)(`span`,{className:V.limitWindow,children:[`per `,e.window]}),(0,H.jsx)(a,{status:e.standing,tone:Xe(e.standing),children:e.standing===`unknown`?`no reading`:e.standing})]}),e.usedPct===null?(0,H.jsx)(`hr`,{className:V.unknownRule,"aria-hidden":`true`}):(0,H.jsx)(`div`,{className:V.track,"data-tone":e.usedPct>=100?`danger`:e.usedPct>=80?`warn`:`ok`,role:`meter`,"aria-label":`${e.backend} dispatches against its ${e.window} cap`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(e.usedPct),children:(0,H.jsx)(`div`,{className:V.fill,style:{width:`${Math.round(e.usedPct)}%`}})}),(0,H.jsx)(`span`,{className:V.limitValue,children:e.used===null?`configured ${y(e.max)}`:`${y(e.used)} / ${y(e.max)}`})]},e.id))})]})}var Qe=`Cost is ESTIMATED from a static price table in this repo, not billed. It will not match a provider invoice.`,$e=`Codex reports cacheRead and cacheWrite as a hardcoded 0 upstream, so any window containing Codex traffic understates cache activity — its cache economics are not comparable to Claude’s.`,et=`A flat heuristic of $3 per 1M local tokens, not a quote and not a measured price.`,tt=`Fewer than two days in this window carry a rollup row, which is not a trend.`,nt=`The daily rollup carries no per-engine or local/cloud columns, and the only tier split available is a single aggregate with no dates on it. Apportioning the daily totals by that aggregate’s ratio would invent a shape nobody measured, so no per-day split is drawn — the aggregate below is the real figure.`;function rt(e){return Date.parse(`${e}T00:00:00Z`)}function it(e,t){return e.reduce((e,n)=>e+(t(n)===null?0:1),0)}function Y(e,t){return e.map(e=>({x:rt(e.day),y:t(e)}))}function at(e){return e.reduce((e,t)=>({tokensIn:e.tokensIn+t.tokensIn,tokensOut:e.tokensOut+t.tokensOut,estCostUsd:e.estCostUsd+t.estCostUsd,sessions:e.sessions+t.sessions,dayCount:e.dayCount+1}),{tokensIn:0,tokensOut:0,estCostUsd:0,sessions:0,dayCount:0})}function ot(e){return e?e.days.length<2?{available:!1,reason:tt}:{available:!0,days:e.days,series:[{id:`tokensIn`,label:`Tokens in`,points:Y(e.days,e=>e.tokensIn)},{id:`tokensOut`,label:`Tokens out`,points:Y(e.days,e=>e.tokensOut)}]}:{available:!1,reason:`No usage series has been loaded.`}}function st(e){return e?e.days.length<2?{available:!1,reason:tt}:{available:!0,days:e.days,series:[{id:`estCostUsd`,label:`Estimated spend`,points:Y(e.days,e=>e.estCostUsd)}]}:{available:!1,reason:`No usage series has been loaded.`}}function ct(e){if(!e)return{available:!1,reason:`No usage series has been loaded.`};let t=it(e.days,e=>e.cacheHitRate);return t===0?{available:!1,reason:`No day in this window reported a cache hit rate, so there is nothing to plot. This is an absent signal, not a 0% hit rate.`}:t<2?{available:!1,reason:`Only ${t} day in this window reported a cache hit rate, which is not a trend.`}:{available:!0,days:e.days,series:[{id:`cacheHitRate`,label:`Cache hit rate`,points:Y(e.days,e=>e.cacheHitRate)}]}}function lt(e){return e?it(e.days,e=>e.cacheRead)+it(e.days,e=>e.cacheWrite)===0?{available:!1,reason:`No day in this window reported cache read or write tokens, so there is nothing to plot. This is an absent signal, not zero cache activity.`}:e.days.length<2?{available:!1,reason:tt}:{available:!0,days:e.days,series:[{id:`cacheRead`,label:`Cache read`,points:Y(e.days,e=>e.cacheRead)},{id:`cacheWrite`,label:`Cache write`,points:Y(e.days,e=>e.cacheWrite)}]}:{available:!1,reason:`No usage series has been loaded.`}}function ut(e){if(e.length===0)return{tokensInPerDay:null,tokensOutPerDay:null,estCostUsdPerDay:null,peakCostDay:null};let t=at(e),n=e.reduce((e,t)=>t.estCostUsd>e.estCostUsd?t:e);return{tokensInPerDay:t.tokensIn/e.length,tokensOutPerDay:t.tokensOut/e.length,estCostUsdPerDay:t.estCostUsd/e.length,peakCostDay:{day:n.day,usd:n.estCostUsd}}}function X(e,t){if(!(!e||e.days.length<2))return e.days.map(t)}var Z={"7d":`Last 7 days`,"30d":`Last 30 days`},dt=S(0),ft=S(1),pt=[{key:`provider`,label:`Provider`,render:e=>e.provider},{key:`tier`,label:`Tier`,render:e=>e.tier},{key:`tokens`,label:`Tokens`,numeric:!0,render:e=>y(e.tokens)},{key:`cost`,label:`Cost`,numeric:!0,render:e=>b(e.costUsd)},{key:`share`,label:`Share`,numeric:!0,render:e=>`${Math.round(e.sharePct)}%`}];function mt({label:e,tokens:t,total:n,color:r}){let i=n>0?Math.round(t/n*100):0;return(0,H.jsxs)(`div`,{className:V.splitRow,children:[(0,H.jsx)(`span`,{children:e}),(0,H.jsx)(`div`,{className:V.splitBar,role:`meter`,"aria-label":`${e} share of tokens`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i,children:(0,H.jsx)(`div`,{className:V.splitFill,style:{width:`${i}%`,"--split-color":r}})}),(0,H.jsxs)(`span`,{className:V.num,children:[y(t),` · `,i,`%`]})]})}function ht({split:e,savingsNote:t}){let n=e.localTokens+e.cloudTokens,r=e.byProvider.map(e=>({label:e.provider,value:e.tokens}));return(0,H.jsxs)(`section`,{className:V.panel,"aria-labelledby":`verse-usage-split`,children:[(0,H.jsx)(`div`,{className:V.panelHead,children:(0,H.jsxs)(`h3`,{id:`verse-usage-split`,className:V.panelTitle,children:[`Local vs cloud · `,e.window]})}),(0,H.jsxs)(`div`,{className:V.tiles,children:[(0,H.jsx)(_,{label:`Not spent (ran locally)`,value:(0,H.jsx)(`span`,{className:V.num,children:b(e.localSavingsUsd)}),caption:`Estimated cloud list price of the ${e.window} local tokens. ${t??`A heuristic, not a quote.`}`}),(0,H.jsx)(_,{label:`Estimated cloud spend · ${e.window}`,value:(0,H.jsx)(`span`,{className:V.num,children:b(e.cloudCostUsd)}),caption:Qe}),(0,H.jsx)(_,{label:`Tokens · ${e.window}`,value:(0,H.jsx)(`span`,{className:V.num,children:y(e.totalTokens)}),caption:`Local and cloud combined`})]}),e.empty?(0,H.jsx)(`p`,{className:V.muted,style:{marginTop:`var(--space-4)`},children:`No provider activity recorded in this window.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:V.split,style:{marginTop:`var(--space-4)`},children:[(0,H.jsx)(mt,{label:`Local`,tokens:e.localTokens,total:n,color:dt}),(0,H.jsx)(mt,{label:`Cloud`,tokens:e.cloudTokens,total:n,color:ft})]}),(0,H.jsx)(p,{items:[{label:`Local`,color:dt,kind:`swatch`},{label:`Cloud`,color:ft,kind:`swatch`}]}),(0,H.jsx)(m,{title:`Tokens by provider`,description:`Share of the ${e.window} window`,empty:r.length===0,emptyMessage:`No provider rows in this window.`,table:(0,H.jsx)(x,{caption:`Tokens and cost by provider`,columns:pt,rows:e.byProvider,rowKey:e=>e.provider}),children:(0,H.jsx)(f,{data:r,orientation:`horizontal`,height:Math.max(120,r.length*34),formatValue:e=>y(e),ariaLabel:`Tokens by provider over the ${e.window} window`})})]})]})}var gt={available:`success`,credits:`success`,tight:`warning`,exhausted:`danger`,"signed-out":`warning`,"probe-unsupported":`warning`,unknown:`unknown`},_t=S(0),vt=S(5);function yt(e,t=5e3){let[n,r]=(0,E.useState)(()=>Date.now());return(0,E.useEffect)(()=>{if(!e)return;let n=setInterval(()=>r(Date.now()),t);return()=>clearInterval(n)},[e,t]),n}function bt({row:e}){let t=e.resident?e.expiresAtMs:null,n=yt(t!==null);return t===null?`—`:He(t-n)}function xt({row:e}){return e.tools===`unknown`?(0,H.jsx)(u,{quality:j(`The runtime did not report a capability list for this model.`),label:`${e.name} tool support`,children:null}):e.tools===`supported`?(0,H.jsx)(a,{status:`agentic`,tone:`success`,children:`tools`}):(0,H.jsx)(a,{status:`no-tools`,tone:`danger`,children:`no tools`})}function St({row:e}){if(e.sizeBytes===null)return(0,H.jsx)(`span`,{children:`—`});let t=e.resident?`Resident size reported by the runtime.`:`On-disk size; this model is not resident, so it is using no memory.`;return(0,H.jsxs)(`span`,{title:t,children:[q(e.sizeBytes),e.resident&&e.memoryPct!==null?` · ${Math.round(e.memoryPct)}% of machine`:``]})}function Ct({row:e}){if(!e.resident)return(0,H.jsx)(`span`,{className:V.capacityMuted,children:`not resident`});if(e.gpuPct===null)return(0,H.jsx)(u,{quality:j(`The runtime reported no VRAM split for this resident model.`),label:`${e.name} placement`,children:null});let t=Math.round(e.gpuPct);return(0,H.jsxs)(`span`,{className:V.placement,children:[(0,H.jsxs)(`span`,{className:V.placementBar,role:`img`,"aria-label":`${e.name}: ${t}% of resident bytes on GPU, ${100-t}% on CPU`,children:[(0,H.jsx)(`span`,{className:V.placementGpu,style:{width:`${t}%`,"--split-color":_t}}),(0,H.jsx)(`span`,{className:V.placementCpu,style:{width:`${100-t}%`,"--split-color":vt}})]}),(0,H.jsx)(`span`,{className:V.placementText,children:e.placement===`unknown`?`${t}% GPU`:`${e.placement} · ${t}% GPU`})]})}function wt({row:e}){return e.nativeContext===null&&e.configuredContext===null?(0,H.jsx)(`span`,{children:`—`}):e.contextTruncated?(0,H.jsx)(`span`,{title:`Native context is ${J(e.nativeContext)}; Ashlr runs this seat at ${J(e.configuredContext)}.`,children:`${J(e.configuredContext)} of ${J(e.nativeContext)}`}):(0,H.jsx)(`span`,{children:J(e.nativeContext??e.configuredContext)})}var Tt=[{key:`name`,label:`Model`,render:e=>e.name},{key:`state`,label:`State`,render:e=>e.resident?(0,H.jsx)(a,{status:`resident`,tone:`success`,children:`resident`}):(0,H.jsx)(a,{status:`installed`,tone:`neutral`,children:`installed`})},{key:`tools`,label:`Agentic`,render:e=>(0,H.jsx)(xt,{row:e})},{key:`size`,label:`Size`,numeric:!0,render:e=>(0,H.jsx)(St,{row:e})},{key:`placement`,label:`Placement`,render:e=>(0,H.jsx)(Ct,{row:e})},{key:`params`,label:`Params`,numeric:!0,render:e=>e.parameterSize??`—`},{key:`quant`,label:`Quant`,render:e=>e.quantization??`—`},{key:`context`,label:`Context`,numeric:!0,render:e=>(0,H.jsx)(wt,{row:e})},{key:`keepalive`,label:`Keep-alive`,numeric:!0,render:e=>(0,H.jsx)(bt,{row:e})}];function Et({staleness:e}){return e.stale?(0,H.jsxs)(`p`,{className:V.staleNotice,role:`status`,children:[(0,H.jsx)(`span`,{className:V.staleFlag,children:`last known-good`}),` Every local figure below is the last known-good reading from `,Be(e.staleForMs),` ago`,e.runtimes.length>0?` (${e.runtimes.join(`, `)})`:``,`, not a fresh probe: the runtime did not answer in time and the server kept the previous report rather than erasing it.`]}):null}function Dt({card:e,staleness:t}){let n={"--engine-color":e.color},r=e.usedPct===null?null:Math.round(e.usedPct);return(0,H.jsxs)(`article`,{className:V.card,style:n,"aria-label":`Local usage`,children:[(0,H.jsxs)(`div`,{className:V.cardHead,children:[(0,H.jsx)(`span`,{className:V.cardLabel,children:`Local`}),(0,H.jsx)(a,{status:e.verdict.state,tone:gt[e.verdict.state],children:e.verdict.headline})]}),(0,H.jsxs)(`div`,{className:V.cardMeta,children:[(0,H.jsx)(`span`,{children:`Ollama`}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,H.jsx)(`span`,{children:`no subscription, no quota, no bill`})]}),t?.stale?(0,H.jsx)(Et,{staleness:t}):null,(0,H.jsx)(`p`,{className:V.verdictDetail,children:e.verdict.detail}),e.verdict.code?(0,H.jsxs)(`p`,{className:V.sourceLine,children:[`Probe reason `,(0,H.jsx)(`code`,{className:V.commandInline,children:e.verdict.code})]}):null,(0,H.jsx)(`span`,{className:V.bindingLabel,children:`Memory budget`}),r===null?(0,H.jsxs)(`div`,{className:V.windowBlockLead,children:[(0,H.jsxs)(`div`,{className:V.windowHead,children:[(0,H.jsx)(`span`,{children:`Resident against machine memory`}),(0,H.jsx)(u,{quality:j(`Either the resident size or the machine memory budget was not reported, so no share can be computed.`),label:`local memory budget`,children:null})]}),(0,H.jsx)(`hr`,{className:V.unknownRule,"aria-hidden":`true`})]}):(0,H.jsxs)(`div`,{className:V.windowBlockLead,children:[(0,H.jsxs)(`div`,{className:V.windowHead,children:[(0,H.jsx)(`span`,{children:`Resident against machine memory`}),(0,H.jsxs)(`span`,{className:V.windowPct,children:[r,`%`]})]}),(0,H.jsx)(`div`,{className:V.track,"data-tone":e.tone,role:`meter`,"aria-label":`Local resident models against machine memory budget`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r,"aria-valuetext":`${q(e.residentBytes)} of ${q(e.memoryBudgetBytes)} resident`,children:(0,H.jsx)(`div`,{className:V.fill,style:{width:`${r}%`}})}),(0,H.jsxs)(`p`,{className:V.windowReset,children:[q(e.residentBytes),` of `,q(e.memoryBudgetBytes)]})]}),(0,H.jsxs)(`p`,{className:V.sourceLine,children:[e.residentCount,` resident · `,e.installedCount,` installed`]})]})}function Ot({serving:e}){if(e===void 0)return(0,H.jsx)(`p`,{className:V.sourceLine,children:`Residency is not concurrency. How many local agents can run at once is decided by the serving runtime, not by these models — a resident model can still be served to one agent at a time. The serving runtime and its real slot count are in Autonomy.`});let t=ue(e);return(0,H.jsxs)(`p`,{className:V.sourceLine,children:[(0,H.jsxs)(`strong`,{children:[t.headline,`.`]}),` `,t.detail]})}function kt({view:e,serving:t}){let[n,r]=(0,E.useState)(!1),i=(0,E.useMemo)(()=>ze(e?.runtimes??[]),[e]),a=(0,E.useMemo)(()=>n?(e?.rows??[]).filter(e=>e.tools!==`unsupported`):e?.rows??[],[e,n]),o=(0,E.useMemo)(()=>a.filter(e=>e.resident&&e.sizeBytes!==null),[a]);return(0,H.jsxs)(`section`,{className:V.panel,"aria-labelledby":`verse-usage-local`,children:[(0,H.jsxs)(`div`,{className:V.panelHead,children:[(0,H.jsx)(`h3`,{id:`verse-usage-local`,className:V.panelTitle,children:`Local availability`}),(0,H.jsx)(`p`,{className:V.panelNote,children:`Resident models answer immediately. A model without tool support cannot drive an agentic session at all, however much memory is free.`})]}),(0,H.jsx)(Ot,{serving:t}),(0,H.jsx)(Et,{staleness:i}),e===null?(0,H.jsx)(`p`,{className:V.muted,children:`No local-model source answered, so neither resident nor installed models can be listed. This is a missing source, not an empty machine.`}):e.reachable?e.rows.length===0?(0,H.jsx)(`p`,{className:V.muted,children:`The local runtime answered and reports no installed models. Pull one to give Ashlr a local seat.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:V.tiles,children:[(0,H.jsx)(Q,{label:`Resident now`,value:String(e.rows.filter(e=>e.resident).length),caption:e.residentBytes===null?`At least one resident model reported no size, so the total is withheld rather than understated.`:`${q(e.residentBytes)} in memory`}),(0,H.jsx)(Q,{label:`Installed`,value:String(e.rows.length),caption:`On disk; the first turn on one of these pays a load`}),(0,H.jsx)(Q,{label:`Can drive a session`,value:String(e.agenticCount),caption:e.unknownToolCount>0?`${e.nonAgenticCount} cannot; ${e.unknownToolCount} did not report a capability list`:`${e.nonAgenticCount} cannot drive one`}),(0,H.jsx)(Q,{label:`Machine memory`,value:e.memoryBudgetBytes===null?`unknown`:q(e.memoryBudgetBytes),caption:e.freeMemoryBytes===null?`The machine reported no free-memory figure.`:`${q(e.freeMemoryBytes)} reported free by the OS`})]}),(0,H.jsxs)(`div`,{className:V.panelActions,children:[(0,H.jsx)(`button`,{type:`button`,className:V.segment,"aria-pressed":n,onClick:()=>r(e=>!e),children:`Hide models that cannot drive a session`}),e.nonAgenticCount>0?(0,H.jsxs)(`span`,{className:V.capacityMuted,children:[e.nonAgenticCount,` of `,e.rows.length,` installed models cannot drive an agentic session.`]}):null]}),(0,H.jsx)(`div`,{className:V.tableScroll,children:(0,H.jsx)(x,{caption:`Local models: residency, tool support, size, placement, parameters, quantization, context and keep-alive`,columns:Tt,rows:a,rowKey:e=>`${e.runtime??`runtime`}:${e.name}`})}),(0,H.jsx)(`div`,{className:V.charts,children:(0,H.jsx)(m,{title:`Resident memory by model`,description:`What is actually in memory right now`,caveat:`Only models the runtime reports as resident WITH a size appear here. An installed model occupies no memory and is not a bar at zero.`,empty:o.length===0,emptyMessage:`Nothing is resident, so there is no memory in use to chart. That is an idle machine, not a zero reading.`,table:(0,H.jsx)(x,{caption:`Resident size per model`,columns:[{key:`name`,label:`Model`,render:e=>e.name},{key:`size`,label:`Resident`,numeric:!0,render:e=>q(e.sizeBytes)}],rows:o,rowKey:e=>e.name}),children:(0,H.jsx)(f,{data:o.map(e=>({label:e.name,value:e.sizeBytes})),orientation:`horizontal`,height:Math.max(120,o.length*34),formatValue:e=>q(e),ariaLabel:`Resident memory by local model`})})}),e.runtimes.length>0?(0,H.jsx)(`ul`,{className:V.noteList,children:e.runtimes.map(e=>(0,H.jsxs)(`li`,{className:V.capacityMuted,children:[e.runtime,`:`,` `,e.reachable?`${e.modelCount} model${e.modelCount===1?``:`s`} reported`:`did not answer`,e.stale?` · retained reading, ${Be(e.staleForMs)} old`:``,e.reason?` · `:``,e.reason?(0,H.jsx)(`code`,{className:V.commandInline,children:e.reason}):null]},e.runtime))}):null,e.notes.length>0?(0,H.jsx)(`ul`,{className:V.noteList,children:e.notes.map(e=>(0,H.jsx)(`li`,{className:V.capacityMuted,children:e},e))}):null,(0,H.jsxs)(`p`,{className:V.sourceLine,children:[`Sizes and the GPU share come from the runtime's own resident report; a model with no reported VRAM split shows no placement bar rather than being drawn as fully on GPU.`,` `,y(e.rows.length),` models installed.`]})]}):(0,H.jsxs)(`p`,{className:V.muted,children:[`No local runtime answered this probe, so nothing about local models can be read. That is an unanswered probe, not a report that no models are installed.`,e.reason?(0,H.jsxs)(H.Fragment,{children:[` `,`Probe reason `,(0,H.jsx)(`code`,{className:V.commandInline,children:e.reason}),`.`]}):null]})]})}function Q({label:e,value:t,caption:n}){return(0,H.jsxs)(`div`,{className:V.figureTile,children:[(0,H.jsx)(`span`,{className:V.figureLabel,children:e}),(0,H.jsx)(`span`,{className:V.figureBig,children:t}),(0,H.jsx)(`span`,{className:V.figureCaption,children:n})]})}var At=[`7d`,`30d`],jt=[{key:`day`,label:`Day`,render:e=>h(e.day)},{key:`in`,label:`Tokens in`,numeric:!0,render:e=>y(e.tokensIn)},{key:`out`,label:`Tokens out`,numeric:!0,render:e=>y(e.tokensOut)},{key:`sessions`,label:`Sessions`,numeric:!0,render:e=>y(e.sessions)}],Mt=[{key:`day`,label:`Day`,render:e=>h(e.day)},{key:`cost`,label:`Estimated spend`,numeric:!0,render:e=>b(e.estCostUsd)}],Nt=[{key:`day`,label:`Day`,render:e=>h(e.day)},{key:`read`,label:`Cache read`,numeric:!0,render:e=>e.cacheRead===null?`not reported`:y(e.cacheRead)},{key:`write`,label:`Cache write`,numeric:!0,render:e=>e.cacheWrite===null?`not reported`:y(e.cacheWrite)}],Pt=[{key:`day`,label:`Day`,render:e=>h(e.day)},{key:`rate`,label:`Cache hit rate`,numeric:!0,render:e=>e.cacheHitRate===null?`not reported`:d(e.cacheHitRate)},{key:`read`,label:`Cache read`,numeric:!0,render:e=>e.cacheRead===null?`not reported`:y(e.cacheRead)}];function Ft({series:e,window:t,onWindowChange:n,unavailableReason:r,loading:i}){let a=e?at(e.days):null,o=e?ut(e.days):null,s=ot(e),c=st(e),l=ct(e),u=lt(e);return(0,H.jsxs)(`section`,{className:V.panel,"aria-labelledby":`verse-usage-series`,children:[(0,H.jsxs)(`div`,{className:V.panelHead,children:[(0,H.jsx)(`h3`,{id:`verse-usage-series`,className:V.panelTitle,children:`Token output and spend`}),(0,H.jsx)(`div`,{className:V.segmented,role:`group`,"aria-label":`Series window`,children:At.map(e=>(0,H.jsx)(`button`,{type:`button`,className:V.segment,"aria-pressed":e===t,onClick:()=>n(e),children:e},e))})]}),r?(0,H.jsxs)(`p`,{className:V.muted,children:[r,` No token or spend series can be drawn, and none is invented in its place.`]}):i&&e===null?(0,H.jsxs)(`p`,{className:V.muted,"aria-busy":`true`,children:[`Loading the `,Z[t].toLowerCase(),` rollup…`]}):e===null||e.days.length===0?(0,H.jsxs)(`p`,{className:V.muted,children:[`The rollup for `,Z[t].toLowerCase(),` came back with no days in it. That is an empty window, not a zero.`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:V.tiles,children:[(0,H.jsx)(_,{label:`Tokens in · ${t}`,value:(0,H.jsx)(`span`,{className:V.num,children:y(a?.tokensIn??0)}),caption:`Across ${a?.dayCount??0} recorded days`,trend:X(e,e=>e.tokensIn),trendLabel:`Tokens in per day`}),(0,H.jsx)(_,{label:`Tokens out · ${t}`,value:(0,H.jsx)(`span`,{className:V.num,children:y(a?.tokensOut??0)}),caption:`What the models actually produced`,trend:X(e,e=>e.tokensOut),trendLabel:`Tokens out per day`}),(0,H.jsx)(_,{label:`Estimated spend · ${t}`,value:(0,H.jsx)(`span`,{className:V.num,children:b(a?.estCostUsd??0)}),caption:`Estimated from a static price table — not billed`,trend:X(e,e=>e.estCostUsd),trendLabel:`Estimated spend per day`}),(0,H.jsx)(_,{label:`Sessions · ${t}`,value:(0,H.jsx)(`span`,{className:V.num,children:y(a?.sessions??0)}),caption:`Rollup rows, not billed calls`,trend:X(e,e=>e.sessions),trendLabel:`Sessions per day`}),(0,H.jsx)(_,{label:`Estimated spend per active day`,value:(0,H.jsx)(`span`,{className:V.num,children:o?.estCostUsdPerDay===null||o===null?`unknown`:b(o.estCostUsdPerDay)}),caption:`Across the ${a?.dayCount??0} days that carry a rollup row — not the ${t} calendar span`}),(0,H.jsx)(_,{label:`Heaviest day`,value:(0,H.jsx)(`span`,{className:V.num,children:o?.peakCostDay?b(o.peakCostDay.usd):`unknown`}),caption:o?.peakCostDay?`${h(o.peakCostDay.day)} — estimated, not billed`:`No day in this window carries a cost row.`})]}),(0,H.jsxs)(`div`,{className:V.charts,children:[(0,H.jsx)(m,{title:`Tokens per day`,description:Z[t],empty:!s.available,emptyMessage:s.available?``:s.reason,table:(0,H.jsx)(x,{caption:`Tokens in and out per day`,columns:jt,rows:e.days,rowKey:e=>e.day}),children:s.available?(0,H.jsx)(g,{series:s.series,formatX:e=>v(e),formatY:e=>y(e),ariaLabel:`Tokens in and out per day over ${Z[t].toLowerCase()}`}):null}),(0,H.jsx)(m,{title:`Estimated spend per day`,description:Z[t],caveat:Qe,empty:!c.available,emptyMessage:c.available?``:c.reason,table:(0,H.jsx)(x,{caption:`Estimated spend per day`,columns:Mt,rows:e.days,rowKey:e=>e.day}),children:c.available?(0,H.jsx)(g,{series:c.series,area:!0,formatX:e=>v(e),formatY:e=>b(e),ariaLabel:`Estimated spend per day over ${Z[t].toLowerCase()}`}):null}),(0,H.jsx)(m,{title:`Cache hit rate`,description:Z[t],caveat:$e,empty:!l.available,emptyMessage:l.available?``:l.reason,table:l.available?(0,H.jsx)(x,{caption:`Cache hit rate per day`,columns:Pt,rows:e.days,rowKey:e=>e.day}):void 0,children:l.available?(0,H.jsx)(g,{series:l.series,formatX:e=>v(e),formatY:e=>d(e),ariaLabel:`Cache hit rate per day over ${Z[t].toLowerCase()}`}):null}),(0,H.jsx)(m,{title:`Cache read and write tokens`,description:Z[t],caveat:$e,empty:!u.available,emptyMessage:u.available?``:u.reason,table:u.available?(0,H.jsx)(x,{caption:`Cache read and write tokens per day`,columns:Nt,rows:e.days,rowKey:e=>e.day}):void 0,children:u.available?(0,H.jsx)(g,{series:u.series,formatX:e=>v(e),formatY:e=>y(e),ariaLabel:`Cache read and write tokens per day over ${Z[t].toLowerCase()}`}):null}),(0,H.jsx)(m,{title:`Local vs cloud per day`,description:Z[t],empty:!0,emptyMessage:nt,children:null})]}),e.caveats.length>0?(0,H.jsx)(`ul`,{className:V.noteList,children:e.caveats.map(e=>(0,H.jsx)(`li`,{className:V.capacityMuted,children:e},e))}):null]})]})}var It=[{key:`day`,label:`Day`,render:e=>h(e.day)},{key:`usd`,label:`Spend`,numeric:!0,render:e=>e.usd===null?`no tick retained`:b(e.usd)}];function Lt({series:e,todaySpentUsd:t,todaySpentDate:n,dailyBudgetUsd:r,showSeries:i=!0}){let a=n!==null&&!le(n),o=a?null:t,s=a?`Nothing recorded today — the last ledger day is ${n}`:r===null?`Configured daily budget unavailable`:r===0?`Daily budget is 0 — the loop is stopped`:`of a ${b(r)} daily budget`;return(0,H.jsxs)(`section`,{className:V.panel,"aria-labelledby":`verse-usage-spend`,children:[(0,H.jsx)(`div`,{className:V.panelHead,children:(0,H.jsx)(`h3`,{id:`verse-usage-spend`,className:V.panelTitle,children:`Spend`})}),(0,H.jsx)(`div`,{className:V.tiles,children:(0,H.jsx)(_,{label:`Spend today`,value:(0,H.jsx)(`span`,{className:V.num,children:o===null?`unknown`:b(o)}),caption:s})}),i?(0,H.jsx)(`div`,{style:{marginTop:`var(--space-4)`},children:e.available?(0,H.jsx)(m,{title:`Spend per day`,description:`Autonomous loop, from the daemon tick ledger`,caveat:e.caveat,table:(0,H.jsx)(x,{caption:`Spend per day from the daemon tick ledger`,columns:It,rows:e.days,rowKey:e=>e.day}),children:(0,H.jsx)(g,{series:[{id:`spend`,label:`Spend`,points:e.days.map(e=>({x:Date.parse(`${e.day}T00:00:00Z`),y:e.usd}))}],area:!0,formatX:e=>v(e),formatY:e=>b(e),ariaLabel:`Autonomous loop spend per day`})}):(0,H.jsx)(m,{title:`Spend per day`,empty:!0,emptyMessage:e.reason,children:null})}):(0,H.jsx)(`p`,{className:V.sourceLine,children:`Per-day spend is charted above from the full usage rollup. The daemon tick ledger is not drawn again here.`})]})}var Rt={five_hour:`Session · rolling 5h`,seven_day:`Week · all models`,seven_day_sonnet:`Week · Sonnet`,seven_day_opus:`Week · Opus`,seven_day_fable:`Week · Fable`,codex:`Week · Codex`,primary:`Primary window`,secondary:`Secondary window`};function zt(e){if(e.label)return e.label;let t=Rt[e.id];if(t)return t;let n=/^seven_day_(.+)$/.exec(e.id);return n?`Week · ${n[1]}`:e.id}function Bt(e){let t=e.resetDescription??e.resetsAt;return{id:e.id,label:zt(e),usedPct:e.limitReached?null:e.usedPercent,tone:e.limitReached?`danger`:e.usedPercent===null?`ok`:M(e.usedPercent),resetText:t,resetsAt:e.resetsAt,limitReached:e.limitReached,measured:e.measured}}function Vt(e){let t=e.windows,n=t.find(e=>e.limitReached);if(n)return n;let r=t.filter(e=>e.usedPercent!==null),i=r.length===0?null:r.reduce((e,t)=>(t.usedPercent??0)>(e.usedPercent??0)?t:e),a=e.binding;if(a){let e=t.find(e=>e.id===a.id)??null;if(e&&(a.limitReached||e.limitReached||i===null||(a.usedPercent??-1)>=(i.usedPercent??-1)))return e}return i}var Ht={"connection-monitor-stopped":"Native polling stopped after a metadata sample could not confirm its process cleanup, so these readings are frozen and no new ones are being taken. Restarting `ashlr verse` begins a new collection generation.","collector-unavailable":`This server is not collecting native metadata, so nothing here is a live reading.`,"collector-not-running":`No account collector is running in this server, so these cards fall back to whatever shared evidence exists.`,"collector-owned":"Another collector (`ashlr resource-console`) owns the exclusive metadata lease, so Verse is reading its shared evidence rather than probing.","collector-start-failed":`The metadata collectors could not be started in this server, so no probe has run.`,"connection-polling-paused":`Native polling is paused because no client has asked for account data recently; it resumes on the next request.`,"connection-not-checked":`No probe has run for this account yet in this server.`,"connection-probe-unavailable":`The probe for this account did not return a usable result, so there is no measurement to show.`,"accounts-pool-unavailable":`This accounts root has no readable pool or bindings, so there is nothing to probe.`,"accounts-collection-not-configured":`Native account collection is not configured for this accounts root.`,"usage-version-unsupported":`The usage probe is pinned to a specific provider build and failed closed on the installed one. That is a version pin, not an outage.`,"usage-account-changed":`The account behind this profile changed between two reads, so the reading was discarded rather than attributed to the wrong account.`,"probe-account-unavailable":`The pinned profile answered but carries no usable account identity — it is not authenticated.`,"probe-account-unsupported":`The pinned profile is authenticated by a method this probe does not accept, so no reading was taken.`,"probe-account-changed":`The account behind this pinned profile changed mid-probe, so the reading was discarded.`,"probe-account-hint-mismatch":`The pinned profile is signed in as a different account than this seat expects.`,"probe-native-unavailable":`The provider CLI for this pinned profile could not be run, so no reading was taken.`,"probe-native-exit-failed":`The provider CLI for this pinned profile exited without a usable result.`,"probe-provider-error":`The provider CLI returned an error instead of account metadata.`,"probe-protocol-unsupported":`The installed provider CLI does not speak the metadata protocol this probe requires.`,"probe-quota-invalid":`The provider returned a quota shape this probe does not recognise, so nothing was accepted as a reading.`,"probe-timed-out":`The metadata probe for this account timed out before it returned anything.`};function Ut(e,t){return e===null?t:Ht[e]??t}var Wt={available:0,credits:1,tight:2,exhausted:3,"signed-out":4,"probe-unsupported":5,unknown:6},Gt=80,Kt=100;function qt(e){return e?e.unlimited?!0:e.hasCredits?e.balanceValue!==null&&e.balanceValue>0:!1:!1}function Jt(e){return e.unlimited?`credits are unlimited on this plan`:`a credit balance of ${e.balance??`an unreported amount`} is still spendable`}function Yt(e,t){if(e.authentication===`signed-out`||e.state===`signed-out`)return{state:`signed-out`,headline:`Signed out`,detail:Ut(e.reason,`The probe reached this account’s pinned profile but it is not authenticated, so there is nothing to measure.`),code:e.reason};if(e.unsupported)return{state:`probe-unsupported`,headline:`Probe version-pinned`,detail:`The usage probe failed closed with ${e.unsupported.code}${e.unsupported.pinnedVersion?`; it is pinned to ${e.unsupported.pinnedVersion}`:``}. This is a version pin, not an outage — no window can be read until the pin is bumped.`,code:e.unsupported.code};let n=qt(e.credits);if(t===null||t.usedPercent===null&&!t.limitReached)return n&&e.credits?{state:`credits`,headline:`Usable on credits`,detail:`No window reading reached this surface, but ${Jt(e.credits)}.`,code:e.reason}:{state:`unknown`,headline:`No reading`,detail:Ut(e.reason,`No window percentage reached this surface for this account, so nothing here is a measurement.`),code:e.reason};let r=t.usedPercent,i=t.limitReached||r!==null&&r>=Kt,a=zt(t);return i?n&&e.credits?{state:`credits`,headline:`Usable on credits`,detail:`${a} is ${t.limitReached?`reported as limit reached`:`fully used`}, but ${Jt(e.credits)} — credits are independent of the window, so this account is not blocked.`,code:null}:{state:`exhausted`,headline:t.limitReached?`Limit reached`:`Window exhausted`,detail:t.limitReached?`The provider flagged ${a} as rate-limited. That flag is a denial, not a measurement, so no percentage is shown.`:`${a} is at ${Math.round(r)}% — it is the binding constraint on this account.`,code:null}:r>=Gt?{state:`tight`,headline:`Running tight`,detail:`${a} is the binding constraint at ${Math.round(r)}%.`,code:null}:{state:`available`,headline:`Usable now`,detail:`${a} is the binding constraint at ${Math.round(r)}%.`,code:null}}function Xt(e,t=null){let n=Vt(e),r=Yt(e,n),i=e.provider,a=e.windows.filter(e=>e.id!==n?.id).map(Bt),o=n?Bt(n):null,s={state:e.state,authentication:e.authentication,health:e.health,reasonCode:e.reason,observedAt:e.observedAt,notes:e.notes,unsupported:e.unsupported};return{id:e.id,label:e.label,engine:i,color:D[i],plan:e.planType,verdict:r,allWindows:o?[o,...a]:a,evidence:s,hasDetail:e.windows.length>0||e.notes.length>0||e.credits!==null||e.reason!==null,binding:o,others:a,credits:e.credits,reconnectCommand:e.reconnectCommand,observedAt:e.observedAt,rank:Wt[r.state],sourceNote:t}}function Zt(e){if(!e)return[];let t=new Set;for(let n of e.accounts)for(let e of n.notes)t.add(e);return[...t]}function Qt(e){return e?e.accounts.map(e=>Xt(e)).sort((e,t)=>e.rank-t.rank||e.label.localeCompare(t.label)):[]}function $t(e){if(!e)return null;let t=e.models.filter(e=>e.loaded),n=e.reachable?t.length===0?0:t.some(e=>e.sizeBytes===null)?null:t.reduce((e,t)=>e+(t.sizeBytes??0),0):null,r=e.memoryBudgetBytes,i=n!==null&&r!==null&&r>0?Math.max(0,Math.min(100,n/r*100)):null,a=e.reachable?t.length>0?{state:`available`,headline:`Resident now`,detail:`${t.length} model${t.length===1?``:`s`} already in memory — no load delay, no quota, no bill.`,code:null}:e.models.length>0?{state:`tight`,headline:`Installed, not loaded`,detail:`${e.models.length} model${e.models.length===1?` is`:`s are`} installed but nothing is resident, so the first turn pays a load.`,code:null}:{state:`unknown`,headline:`No models installed`,detail:`The runtime is reachable but reports no installed models.`,code:null}:{state:`unknown`,headline:`Runtime unreachable`,detail:`No local runtime answered, so neither resident nor installed models can be listed. This is an unanswered probe, not a report that the machine is empty.`,code:e.reason};return{residentCount:t.length,installedCount:e.models.length,residentBytes:n,memoryBudgetBytes:r,usedPct:i,tone:i===null?`ok`:M(i),verdict:a,color:D.local,rank:Wt[a.state]}}var en=`Per-account probes are unavailable on this server, so these cards are derived from the seat roster and the per-engine snapshots.`;function tn(e){let{seat:t,control:n,frontier:r,engineSeatCount:i}=e;if(t.engine===`local`)return null;let a=n?.subscriptionUsage?.find(e=>String(e.engine)===t.engine),o=r?.engines.find(e=>String(e.engine)===t.engine),s=me({engine:t.engine,seat:t,subscription:a,frontier:o,engineSeatCount:i}),c=s.kind===`measured`?s.windows.map(e=>({id:e.id,label:e.label,usedPercent:e.usedPct,resetsAt:e.resetsAt===null?null:new Date(e.resetsAt*1e3).toISOString(),resetDescription:null,limitReached:!1,measured:!0})):[];return{account:{id:t.id,label:t.label,provider:t.engine,state:s.kind===`measured`?`observed`:`unavailable`,authentication:`unknown`,health:null,planType:a?.plan??null,observedAt:t.health.observedAt,windows:c,binding:null,credits:null,reason:s.kind===`measured`?null:s.reason,unsupported:null,reconnectCommand:null,notes:[]},sourceNote:s.kind===`measured`?`${pe[s.source]}${s.scope===`engine`?` · engine-wide, shared by every account on this engine`:``}`:null}}function nn(e){let t=e.bootstrap?.seats??[],n=new Map;for(let e of t)n.set(e.engine,(n.get(e.engine)??0)+1);return t.map(t=>tn({seat:t,control:e.control,frontier:e.frontier,engineSeatCount:n.get(t.engine)??1})).filter(e=>e!==null).map(e=>Xt(e.account,e.sourceNote)).sort((e,t)=>e.rank-t.rank||e.label.localeCompare(t.label))}function $(e){return e instanceof s&&e.status===401}function rn({title:e,body:t,action:n}){return(0,H.jsxs)(`div`,{className:V.stateBlock,role:`status`,children:[(0,H.jsx)(`p`,{className:V.stateTitle,children:e}),(0,H.jsx)(`p`,{className:V.stateBody,children:t}),n?(0,H.jsx)(`div`,{className:V.stateActions,children:n}):null]})}var an=3e4,on={gridColumn:`1 / -1`};function sn(e,t){(0,E.useEffect)(()=>{let n=null,r=()=>{n!==null&&clearInterval(n),n=null},i=()=>{let i=typeof document>`u`||document.visibilityState===`visible`;i&&n===null?n=setInterval(e,t):i||r()};return i(),document.addEventListener(`visibilitychange`,i),()=>{document.removeEventListener(`visibilitychange`,i),r()}},[e,t])}function cn(){let[e,t]=(0,E.useState)(`7d`),[n,a]=(0,E.useState)(null),s=c(C),u=c(re),f=c(ie(e)),p=c(ce),m=c(ee),h=c(ne),g=c(ae),v=r(C),y=r(re),b=r(ie(e)),x=r(ce),S=r(ee),le=r(ne),ue=r(ae),w=l(C),fe=l(re);sn(w,an),sn(fe,an);let T=()=>{v(),y(),b(),x(),S(),le(),ue()},D=(0,E.useMemo)(()=>s.data?.available?se(s.data.raw):null,[s.data]),O=(0,E.useMemo)(()=>u.data?.available?te(u.data.raw):null,[u.data]),k=(0,E.useMemo)(()=>f.data?.available?oe(f.data.raw,e):null,[f.data,e]),A=(0,E.useMemo)(()=>h.data?h.data.available?ve(h.data.raw,h.data.reason):ye(h.data.reason??`Configured caps unavailable.`):ye(`Configured caps not loaded yet.`),[h.data]),pe=D===null,j=(0,E.useMemo)(()=>D?Qt(D):nn({bootstrap:g.data,control:m.data,frontier:p.data}),[D,g.data,m.data,p.data]),M=(0,E.useMemo)(()=>Ve(O),[O]),N=(0,E.useMemo)(()=>$t(O),[O]),P=(0,E.useMemo)(()=>Zt(D),[D]),F=(0,E.useMemo)(()=>{let e=j.map(e=>({key:e.id,rank:e.rank,label:e.label,kind:`account`,card:e}));return N&&e.push({key:`local`,rank:N.rank,label:`Local`,kind:`local`,card:N}),e.sort((e,t)=>e.rank-t.rank||e.label.localeCompare(t.label))},[j,N]),I=(0,E.useMemo)(()=>Pe({cards:j,localCard:N,localView:M}),[j,N,M]),me=(0,E.useMemo)(()=>ze(M?.runtimes??[]),[M]),L=e=>{a(t=>t===e?null:e)},R=(0,E.useCallback)(()=>{let e=n;a(null),e!==null&&typeof document<`u`&&document.getElementById(`verse-account-trigger-${e}`)?.focus()},[n]),z=(0,E.useMemo)(()=>de(g.data?.sessions??[],g.data?.seats??[]),[g.data]),B=g.data?null:g.status===`error`?`The chat list could not be read${g.error?.message?` (${g.error.message})`:``}, so efficiency cannot be computed.`:`Reading the chat list…`,U=(0,E.useMemo)(()=>he(m.data?.usage),[m.data]),be=(0,E.useMemo)(()=>ge(m.data?.limits,A.foundryLimits),[m.data,A.foundryLimits]),xe=(0,E.useMemo)(()=>_e(m.data?.daemonObservation),[m.data]),Ce=A.available?A.todaySpentUsd:m.data?.daemon.todaySpentUsd??null,we=A.available?A.todaySpentDate:null,W=$(s.error)||$(u.error)||$(f.error)||$(p.error)||$(m.error)||$(g.error),G=!W&&p.status===`error`&&m.status===`error`&&p.data===void 0&&m.data===void 0,Ee=!W&&!G&&s.data===void 0&&p.data===void 0&&m.data===void 0&&(s.status===`loading`||s.status===`idle`||p.status===`loading`||m.status===`loading`||p.status===`idle`||m.status===`idle`),K=s.status===`refreshing`||p.status===`refreshing`||m.status===`refreshing`,De=D?.sampledAt??p.data?.generatedAt??m.data?.ts??null;return(0,H.jsxs)(`section`,{className:V.section,"aria-label":`Usage`,children:[(0,H.jsxs)(`header`,{className:V.header,"data-app-region":`drag`,children:[(0,H.jsx)(`h2`,{className:V.headerTitle,children:`Usage`}),(0,H.jsxs)(`div`,{className:V.headerMeta,children:[De?(0,H.jsxs)(`span`,{children:[K?`refreshing · `:``,`as of `,new Date(De).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})]}):null,(0,H.jsx)(`button`,{type:`button`,className:V.ghostButton,onClick:T,children:`Refresh`})]})]}),(0,H.jsx)(`div`,{className:V.scroll,children:W?(0,H.jsx)(rn,{title:`Read session expired`,body:`Usage data needs an authenticated read session. Unlock the console with the read token ashlr verse printed, then refresh.`,action:(0,H.jsx)(`button`,{type:`button`,className:V.ghostButton,onClick:T,children:`Try again`})}):G?(0,H.jsx)(rn,{title:`Usage sources unreachable`,body:`Neither /api/usage nor /api/control answered. ${m.error?.message??p.error?.message??``}`.trim(),action:(0,H.jsx)(`button`,{type:`button`,className:V.ghostButton,onClick:T,children:`Retry`})}):Ee?(0,H.jsxs)(`div`,{"aria-busy":`true`,children:[(0,H.jsx)(i,{width:`30%`}),(0,H.jsx)(`div`,{className:V.skeletonGrid,style:{marginTop:`var(--space-4)`},children:(0,H.jsx)(o,{count:5})})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Ke,{overview:I,selectedId:n,onSelectSeat:L}),(0,H.jsxs)(`section`,{className:V.panel,"aria-labelledby":`verse-usage-accounts`,children:[(0,H.jsxs)(`div`,{className:V.panelHead,children:[(0,H.jsx)(`h3`,{id:`verse-usage-accounts`,className:V.panelTitle,children:`Accounts`}),(0,H.jsx)(`p`,{className:V.panelNote,children:`Ordered by what you can use right now. Each card leads with its binding constraint — the window with the highest used percent, because that is what blocks work.`})]}),pe&&s.data&&!s.data.available?(0,H.jsxs)(`p`,{className:V.muted,children:[s.data.reason,` `,en]}):null,D?.collectorNote?(0,H.jsx)(`p`,{className:V.muted,children:D.collectorNote}):null,P.length>0?(0,H.jsx)(`ul`,{className:V.noteList,children:P.map(e=>(0,H.jsx)(`li`,{className:V.muted,children:e},e))}):null,j.length===0&&N===null?(0,H.jsx)(`p`,{className:V.muted,children:`No accounts and no local runtime were reported. Connect an account or start Ollama, then refresh — this is an empty roster, not a set of accounts at zero.`}):(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(`div`,{className:V.cards,children:F.map(e=>{if(e.kind!==`account`)return(0,H.jsx)(Dt,{card:e.card,staleness:me},e.key);let t=n===e.key;return(0,H.jsxs)(E.Fragment,{children:[(0,H.jsx)(Se,{card:e.card,onOpen:L,expanded:t,triggerId:`verse-account-trigger-${e.key}`,detailId:`verse-account-detail-${e.key}`}),t?(0,H.jsx)(`div`,{id:`verse-account-detail-${e.key}`,style:on,children:(0,H.jsx)(Te,{card:e.card,headingId:`verse-account-heading-${e.key}`,onClose:R})}):null]},e.key)})})})]}),(0,H.jsx)(kt,{view:M}),(0,H.jsx)(Ft,{series:k,window:e,onWindowChange:t,unavailableReason:f.data&&!f.data.available?f.data.reason:null,loading:f.status===`loading`||f.status===`idle`}),(0,H.jsx)(Ye,{rows:z,unavailableReason:B}),U?(0,H.jsx)(ht,{split:U,savingsNote:et}):(0,H.jsxs)(`section`,{className:V.panel,"aria-labelledby":`verse-usage-split-missing`,children:[(0,H.jsx)(`div`,{className:V.panelHead,children:(0,H.jsx)(`h3`,{id:`verse-usage-split-missing`,className:V.panelTitle,children:`Local vs cloud`})}),(0,H.jsx)(`div`,{className:V.tiles,children:(0,H.jsx)(_,{label:`Not spent (ran locally)`,value:(0,H.jsx)(`span`,{className:V.num,children:`unknown`}),caption:`/api/control did not answer, so the split is unavailable`})})]}),(0,H.jsx)(Ze,{rows:be,capsNote:A.available?null:A.reason}),(0,H.jsx)(Lt,{series:xe,todaySpentUsd:Ce,todaySpentDate:we,dailyBudgetUsd:A.dailyBudgetUsd,showSeries:k===null}),A.available&&A.subscriptionMaxPercent!==null?(0,H.jsxs)(`p`,{className:V.muted,children:[`Subscription throttle threshold is`,` `,(0,H.jsx)(`span`,{className:V.num,children:d(A.subscriptionMaxPercent/100)}),`. It only applies to engines that publish a real window reading — no seat is ever throttled on a guess.`]}):null]})})]})}export{cn as UsageSection};
|
|
2
|
-
//# sourceMappingURL=UsageSection-
|
|
1
|
+
import{a as e,n as t,o as n}from"./index-DO9a5IaB.js";import{b as r,i,p as a,r as o,s,v as c,y as l}from"./global-F2K14nNo.js";import{i as u}from"./RouteErrorBoundary-Chd-wt6w.js";import{r as ee}from"./queries-BdSsWYSu.js";import{a as d,c as f,d as p,f as m,i as h,l as g,n as _,o as v,r as y,s as b,t as x,u as S}from"./charts-CnMDT08S.js";import{A as te,D as ne,E as C,O as re,T as ie,_ as ae,j as oe,k as se,w as ce}from"./VerseConsoleApp-DYH7ottg.js";import{f as le}from"./format-BNYWGJat.js";import{f as ue}from"./fleet-model-ClBbQ0Uj.js";import{n as w}from"./verse-model-GWqHIjMG.js";import{S as de,d as fe,k as T}from"./context-model-DTvb2uZy.js";var E=n(e(),1),D={claude:`var(--engine-claude, #c96442)`,codex:`var(--engine-codex, #10a37f)`,grok:`var(--engine-grok, #6b7280)`,local:`var(--engine-local, #7c5cff)`},O={claude:`Claude publishes no local utilization signal, so there is no window percentage to read. Ashlr deliberately never throttles this seat on a guess.`,grok:`Grok is absent from the per-engine usage snapshot, so this fallback roster has no window data for it. Its real state comes from the per-account probe.`},k=`The only figure available is derived from the dispatch ledger against a configured cap, not from the subscription itself. It is shown under Dispatch limits.`,A=`Local models have no subscription and no quota window — only whether the runtime is up.`,pe={"account-observation":`from this account’s observed windows`,"subscription-tracker":`from the subscription tracker`};function j(e){return{sourceState:`unknown`,complete:!1,reason:e}}function M(e){return e>=90?`danger`:e>=80?`warn`:`ok`}function N(e){return Number.isFinite(e)?Math.max(0,Math.min(100,e)):0}function P(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function F(e,t,n){return{kind:`measured`,source:e,scope:t,windows:n}}function I(e){return{kind:`unknown`,reason:O[e]??`No subscription window reading is reported for this engine.`}}function me(e){let{engine:t,seat:n,subscription:r,frontier:i,engineSeatCount:a=1}=e;if(t===`local`)return{kind:`not-applicable`,reason:A};let o=(n?.health.windows??[]).filter(e=>typeof e.usedPercent==`number`&&Number.isFinite(e.usedPercent));if(o.length>0)return F(`account-observation`,`account`,o.map(e=>{let t=N(e.usedPercent),n=e.resetsAt?Date.parse(e.resetsAt):NaN;return{id:e.id,label:e.id,usedPct:t,resetsAt:Number.isNaN(n)?null:Math.round(n/1e3),tone:M(t)}}));if(r&&r.hasData&&r.windows.length>0)return F(`subscription-tracker`,a>1?`engine`:`account`,r.windows.map((e,t)=>{let n=N(e.usedPercent);return{id:`${e.label}-${t}`,label:e.label,usedPct:n,resetsAt:P(e.resetsAt),tone:M(n)}}));if(r&&!r.hasData)return I(t);if(i&&i.subscriptionWindow.state!==`unknown`){if(i.limit===void 0){let e=N(i.subscriptionWindow.usedPct);return F(`subscription-tracker`,a>1?`engine`:`account`,[{id:i.subscriptionWindow.windowLabel??`window`,label:i.subscriptionWindow.windowLabel??`window`,usedPct:e,resetsAt:P(i.subscriptionWindow.resetsAt),tone:M(e)}])}return{kind:`unknown`,reason:k}}return I(t)}function he(e){if(!e)return null;let t=(e.byProvider??[]).map(e=>({provider:e.provider,tier:e.tier,tokens:e.tokens,costUsd:e.costUsd,sharePct:e.sharePct})),n=(e,n)=>t.filter(t=>t.tier===e).reduce((e,t)=>e+(t[n]||0),0);return{window:e.window,totalTokens:e.totalTokens,totalCostUsd:e.totalCostUsd,localSavingsUsd:e.localSavingsUsd,localTokens:n(`local`,`tokens`),cloudTokens:n(`cloud`,`tokens`),localCostUsd:n(`local`,`costUsd`),cloudCostUsd:n(`cloud`,`costUsd`),byProvider:[...t].sort((e,t)=>t.tokens-e.tokens),empty:t.length===0&&e.totalTokens===0}}function ge(e,t){let n=[],r=new Set;for(let t of e??[]){let e=`${t.backend}:${t.window}`;r.add(e);let i=t.max>0?N(t.used/t.max*100):null;n.push({id:e,backend:t.backend,window:t.window,max:t.max,used:t.used,standing:t.standing,usedPct:i,configuredOnly:!1})}for(let e of t??[]){let t=`${e.engine}:${e.window}`;r.has(t)||(r.add(t),n.push({id:t,backend:e.engine,window:e.window,max:e.max,used:null,standing:`unknown`,usedPct:null,configuredOnly:!0}))}return n.sort((e,t)=>e.backend.localeCompare(t.backend)||e.window.localeCompare(t.window))}var L=`No per-day series is available: the sources this view reads carry aggregate spend only, not a dated history.`;function _e(e){if(!e)return{available:!1,reason:L};if(e.sourceQuality?.sourceState!==`healthy`)return{available:!1,reason:`No per-day series: the daemon ledger is ${e.sourceQuality?.sourceState??`unavailable`}${e.sourceQuality?.reason?` (${e.sourceQuality.reason})`:``}.`};let t=e.ticks;if(!t||t.length===0)return{available:!1,reason:L};let n=new Map;for(let e of t){let t=Date.parse(e.ts);if(Number.isNaN(t))continue;let r=new Date(t).toISOString().slice(0,10);n.set(r,(n.get(r)??0)+(Number.isFinite(e.spentUsd)?e.spentUsd:0))}if(n.size<2)return{available:!1,reason:`No per-day series: only ${n.size} day${n.size===1?``:`s`} of daemon ticks is retained, which is not a trend.`};let r=[...n.keys()].sort(),i=r[0],a=r[r.length-1],o=[];for(let e=Date.parse(`${i}T00:00:00Z`);e<=Date.parse(`${a}T00:00:00Z`);e+=864e5){let t=new Date(e).toISOString().slice(0,10);o.push({day:t,usd:n.has(t)?n.get(t):null})}return{available:!0,days:o,tickCount:t.length,caveat:`From the last ${t.length} recorded daemon ticks. The tick ledger is capped and records the autonomous loop only — interactive chat turns are not in it, and a gap is a day with no retained tick, not a measured zero.`}}var R={available:!1,reason:null,dailyBudgetUsd:null,subscriptionMaxPercent:null,todaySpentUsd:null,todaySpentDate:null,foundryLimits:[]};function z(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function B(e,t){if(!e)return null;for(let n of t){let t=e[n];if(typeof t==`number`&&Number.isFinite(t))return t}return null}function ve(e,t=null){let n=z(e);if(!n)return{...R,reason:t};let r=z(n.caps)??n,i=z(n.daemon),a=z(n.spend),o=[],s=r.foundryLimits;if(Array.isArray(s))for(let e of s){let t=z(e);if(!t)continue;let n=typeof t.engine==`string`?t.engine:null,r=B(t,[`max`]);n!==null&&r!==null&&o.push({engine:n,window:typeof t.window==`string`?t.window:`1d`,max:r})}return{available:!0,reason:t,dailyBudgetUsd:B(r,[`dailyBudgetUsd`]),subscriptionMaxPercent:B(r,[`subscriptionMaxPercent`]),todaySpentUsd:a?B(a,[`todayUsd`]):B(n,[`todaySpentUsd`,`todaySpendUsd`,`spendTodayUsd`])??B(i,[`todaySpentUsd`]),todaySpentDate:a&&typeof a.todayDate==`string`?a.todayDate:null,foundryLimits:o}}function ye(e){return{...R,reason:e}}var V={section:`_section_1aa17_11`,header:`_header_1aa17_20`,headerTitle:`_headerTitle_1aa17_33`,headerMeta:`_headerMeta_1aa17_41`,ghostButton:`_ghostButton_1aa17_50`,scroll:`_scroll_1aa17_67`,panel:`_panel_1aa17_75`,panelHead:`_panelHead_1aa17_83`,panelTitle:`_panelTitle_1aa17_95`,panelNote:`_panelNote_1aa17_104`,muted:`_muted_1aa17_111`,noteList:`_noteList_1aa17_124`,num:`_num_1aa17_135`,tiles:`_tiles_1aa17_142`,cards:`_cards_1aa17_150`,card:`_card_1aa17_150`,cardHead:`_cardHead_1aa17_177`,cardLabel:`_cardLabel_1aa17_185`,cardMeta:`_cardMeta_1aa17_196`,cardFigures:`_cardFigures_1aa17_206`,figure:`_figure_1aa17_215`,figureLabel:`_figureLabel_1aa17_222`,figureValue:`_figureValue_1aa17_230`,windows:`_windows_1aa17_239`,windowHead:`_windowHead_1aa17_246`,windowPct:`_windowPct_1aa17_256`,windowReset:`_windowReset_1aa17_262`,track:`_track_1aa17_275`,fill:`_fill_1aa17_283`,unknownRule:`_unknownRule_1aa17_311`,signalRow:`_signalRow_1aa17_318`,reason:`_reason_1aa17_325`,sourceLine:`_sourceLine_1aa17_333`,split:`_split_1aa17_348`,splitRow:`_splitRow_1aa17_355`,splitBar:`_splitBar_1aa17_364`,splitFill:`_splitFill_1aa17_371`,limitList:`_limitList_1aa17_377`,limitRow:`_limitRow_1aa17_382`,limitName:`_limitName_1aa17_395`,limitWindow:`_limitWindow_1aa17_404`,limitValue:`_limitValue_1aa17_409`,verdictDetail:`_verdictDetail_1aa17_425`,bindingLabel:`_bindingLabel_1aa17_433`,windowBlock:`_windowBlock_1aa17_443`,windowBlockLead:`_windowBlockLead_1aa17_452`,windowFlag:`_windowFlag_1aa17_465`,creditsRow:`_creditsRow_1aa17_473`,actionBlock:`_actionBlock_1aa17_488`,command:`_command_1aa17_494`,commandInline:`_commandInline_1aa17_495`,negative:`_negative_1aa17_510`,segmented:`_segmented_1aa17_516`,segment:`_segment_1aa17_516`,charts:`_charts_1aa17_558`,tableScroll:`_tableScroll_1aa17_570`,stateBlock:`_stateBlock_1aa17_578`,stateTitle:`_stateTitle_1aa17_586`,stateBody:`_stateBody_1aa17_595`,stateActions:`_stateActions_1aa17_601`,skeletonGrid:`_skeletonGrid_1aa17_605`,capacity:`_capacity_1aa17_660`,capacityHeadline:`_capacityHeadline_1aa17_665`,chips:`_chips_1aa17_680`,chip:`_chip_1aa17_680`,chipLabel:`_chipLabel_1aa17_727`,chipState:`_chipState_1aa17_737`,chipPct:`_chipPct_1aa17_757`,capacityFacts:`_capacityFacts_1aa17_763`,capacityFact:`_capacityFact_1aa17_763`,capacityMuted:`_capacityMuted_1aa17_777`,proseResets:`_proseResets_1aa17_783`,visuallyHidden:`_visuallyHidden_1aa17_787`,cardTrigger:`_cardTrigger_1aa17_807`,cardChevron:`_cardChevron_1aa17_823`,detail:`_detail_1aa17_848`,detailHead:`_detailHead_1aa17_856`,detailTitle:`_detailTitle_1aa17_863`,detailGrid:`_detailGrid_1aa17_871`,detailColumn:`_detailColumn_1aa17_878`,evidenceList:`_evidenceList_1aa17_882`,evidenceRow:`_evidenceRow_1aa17_889`,evidenceValue:`_evidenceValue_1aa17_896`,figureTile:`_figureTile_1aa17_907`,figureBig:`_figureBig_1aa17_918`,figureCaption:`_figureCaption_1aa17_926`,panelActions:`_panelActions_1aa17_934`,placement:`_placement_1aa17_947`,placementBar:`_placementBar_1aa17_954`,placementGpu:`_placementGpu_1aa17_964`,placementCpu:`_placementCpu_1aa17_965`,placementText:`_placementText_1aa17_971`,staleNotice:`_staleNotice_1aa17_984`,staleFlag:`_staleFlag_1aa17_998`},H=t();function U({view:e,ariaPrefix:t,prominent:n=!1}){let r=`${t} ${e.label}`;if(e.limitReached)return(0,H.jsxs)(`div`,{className:n?V.windowBlockLead:V.windowBlock,children:[(0,H.jsxs)(`div`,{className:V.windowHead,children:[(0,H.jsx)(`span`,{children:e.label}),(0,H.jsx)(`span`,{className:V.windowFlag,children:`limit reached`})]}),(0,H.jsx)(`div`,{className:V.track,"data-tone":`danger`,role:`img`,"aria-label":`${r}: the provider flagged this window as rate-limited, so no percentage is shown`,children:(0,H.jsx)(`div`,{className:V.fill,style:{width:`100%`}})}),e.resetText?(0,H.jsx)(`p`,{className:V.windowReset,children:e.resetText}):null]});if(e.usedPct===null)return(0,H.jsxs)(`div`,{className:n?V.windowBlockLead:V.windowBlock,children:[(0,H.jsxs)(`div`,{className:V.windowHead,children:[(0,H.jsx)(`span`,{children:e.label}),(0,H.jsx)(u,{quality:j(`No percentage was reported for this window.`),label:r,children:null})]}),(0,H.jsx)(`hr`,{className:V.unknownRule,"aria-hidden":`true`})]});let i=Math.round(e.usedPct);return(0,H.jsxs)(`div`,{className:n?V.windowBlockLead:V.windowBlock,children:[(0,H.jsxs)(`div`,{className:V.windowHead,children:[(0,H.jsx)(`span`,{children:e.label}),(0,H.jsxs)(`span`,{className:V.windowPct,children:[i,`%`]})]}),(0,H.jsx)(`div`,{className:V.track,"data-tone":e.tone,role:`meter`,"aria-label":`${r} used`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i,"aria-valuetext":`${i}% used${e.resetText?`, ${e.resetText}`:``}`,children:(0,H.jsx)(`div`,{className:V.fill,style:{width:`${i}%`}})}),e.resetText?(0,H.jsx)(`p`,{className:V.windowReset,children:e.resetText}):null]})}var be={available:`success`,credits:`success`,tight:`warning`,exhausted:`danger`,"signed-out":`warning`,"probe-unsupported":`warning`,unknown:`unknown`};function xe({credits:e}){if(!e)return null;let t=e.unlimited?`unlimited`:e.balance===null?null:e.balanceValue===null?e.balance:e.balanceValue.toLocaleString(`en-US`,{maximumFractionDigits:2});return(0,H.jsxs)(`div`,{className:V.creditsRow,children:[(0,H.jsx)(`span`,{className:V.figureLabel,children:`Credits`}),(0,H.jsx)(`span`,{className:V.num,title:e.balance??void 0,children:t??`not reported`}),(0,H.jsx)(`p`,{className:V.reason,children:`Credits are a separate pool from the window above — a fully used window does not stop a spendable balance from being spent. The provider gives a bare number, not a currency, so it is shown as reported.`})]})}function Se({card:e,onOpen:t,expanded:n=!1,triggerId:r,detailId:i}){let o={"--engine-color":e.color},s=e.verdict.state===`signed-out`,c=t!==void 0&&e.hasDetail,l=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:V.cardLabel,children:e.label}),(0,H.jsx)(a,{status:e.verdict.state,tone:be[e.verdict.state],children:e.verdict.headline})]});return(0,H.jsxs)(`article`,{className:V.card,style:o,"aria-label":`${e.label} usage`,"data-selected":n?`true`:void 0,children:[c?(0,H.jsxs)(`button`,{type:`button`,id:r,className:`${V.cardHead} ${V.cardTrigger}`,"aria-expanded":n,...i?{"aria-controls":i}:{},onClick:()=>t(e.id),children:[l,(0,H.jsx)(`span`,{className:V.cardChevron,"aria-hidden":`true`,children:n?`−`:`+`})]}):(0,H.jsx)(`div`,{className:V.cardHead,children:l}),(0,H.jsxs)(`div`,{className:V.cardMeta,children:[(0,H.jsx)(`span`,{children:w[e.engine]}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,H.jsx)(`span`,{children:e.plan?`${e.plan} plan`:`plan not reported`})]}),(0,H.jsx)(`p`,{className:V.verdictDetail,children:e.verdict.detail}),e.verdict.code?(0,H.jsxs)(`p`,{className:V.sourceLine,children:[`Probe reason `,(0,H.jsx)(`code`,{className:V.commandInline,children:e.verdict.code})]}):null,e.binding?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:V.bindingLabel,children:`Binding constraint`}),(0,H.jsx)(U,{view:e.binding,ariaPrefix:e.label,prominent:!0})]}):null,e.others.length>0?(0,H.jsx)(`div`,{className:V.windows,children:e.others.map(t=>(0,H.jsx)(U,{view:t,ariaPrefix:e.label},t.id))}):null,(0,H.jsx)(xe,{credits:e.credits}),s?(0,H.jsx)(`div`,{className:V.actionBlock,children:e.reconnectCommand?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:V.figureLabel,children:`Reconnect`}),(0,H.jsx)(`code`,{className:V.command,children:e.reconnectCommand})]}):(0,H.jsxs)(`p`,{className:V.reason,children:[`Sign this account back in through its own provider CLI under its pinned profile. Ashlr does not print that invocation here, because the pinned-profile launcher path is never allowed onto a surface. `,(0,H.jsx)(`code`,{className:V.commandInline,children:`ashlr resources`}),` `,`shows the connection state once it is back.`]})}):null,e.sourceNote?(0,H.jsx)(`p`,{className:V.sourceLine,children:e.sourceNote}):null]})}var Ce={available:`success`,credits:`success`,tight:`warning`,exhausted:`danger`,"signed-out":`warning`,"probe-unsupported":`warning`,unknown:`unknown`},we=`No per-account history is retained by any source this view reads: the accounts route is a point-in-time snapshot and the usage series carries no per-account breakdown. A trend is not drawn from one reading.`;function W(e,t){return e===null?`The source behind this card reports no health verdict at all.`:e===`unknown`?t===`claude`?`Health reads unknown, which is how this provider always reads — the probe has no health channel for it. It is not a fault.`:`Health reads unknown: the monitor took no verdict on this account.`:`Monitor health: ${e}.`}function G({label:e,children:t}){return(0,H.jsxs)(`div`,{className:V.evidenceRow,children:[(0,H.jsx)(`dt`,{className:V.figureLabel,children:e}),(0,H.jsx)(`dd`,{className:V.evidenceValue,children:t})]})}function Te({card:e,onClose:t,headingId:n}){let{evidence:r}=e,i=e.credits,o=(0,E.useRef)(null);return(0,E.useEffect)(()=>{o.current?.focus()},[e.id]),(0,H.jsxs)(`section`,{className:V.detail,"aria-labelledby":n,children:[(0,H.jsxs)(`div`,{className:V.detailHead,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h4`,{id:n,ref:o,tabIndex:-1,className:V.detailTitle,children:e.label}),(0,H.jsxs)(`div`,{className:V.cardMeta,children:[(0,H.jsx)(`span`,{children:w[e.engine]}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,H.jsx)(`span`,{children:e.plan?`${e.plan} plan`:`plan not reported`}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,H.jsx)(a,{status:e.verdict.state,tone:Ce[e.verdict.state],children:e.verdict.headline})]})]}),(0,H.jsx)(`button`,{type:`button`,className:V.ghostButton,onClick:t,children:`Close`})]}),(0,H.jsx)(`p`,{className:V.verdictDetail,children:e.verdict.detail}),(0,H.jsxs)(`div`,{className:V.detailGrid,children:[(0,H.jsxs)(`div`,{className:V.detailColumn,children:[(0,H.jsxs)(`span`,{className:V.figureLabel,children:[`All windows (`,e.allWindows.length,`)`]}),e.allWindows.length===0?(0,H.jsx)(`p`,{className:V.reason,children:`This account reported no windows at all. That is an absent reading, not a set of windows at zero.`}):(0,H.jsx)(`div`,{className:V.windows,children:e.allWindows.map((t,n)=>(0,H.jsx)(U,{view:t,ariaPrefix:e.label,prominent:n===0},t.id))}),e.allWindows.some(e=>!e.measured)?(0,H.jsx)(`p`,{className:V.reason,children:`At least one window above carries a provider FLAG rather than a measurement, so no percentage is printed for it. A flagged limit and a measured 100% are different facts.`}):null]}),(0,H.jsxs)(`div`,{className:V.detailColumn,children:[(0,H.jsx)(`span`,{className:V.figureLabel,children:`Probe evidence`}),(0,H.jsxs)(`dl`,{className:V.evidenceList,children:[(0,H.jsx)(G,{label:`Connection`,children:r.state}),(0,H.jsx)(G,{label:`Authentication`,children:r.authentication}),(0,H.jsx)(G,{label:`Health`,children:W(r.health,e.engine)}),(0,H.jsx)(G,{label:`Observed`,children:r.observedAt===null?(0,H.jsx)(`span`,{className:V.capacityMuted,children:`no observation timestamp was reported`}):(0,H.jsx)(`span`,{className:V.num,children:new Date(r.observedAt).toLocaleString()})}),(0,H.jsx)(G,{label:`Probe reason`,children:r.reasonCode===null?(0,H.jsx)(`span`,{className:V.capacityMuted,children:`none reported`}):(0,H.jsx)(`code`,{className:V.commandInline,children:r.reasonCode})}),r.unsupported?(0,H.jsxs)(G,{label:`Version pin`,children:[(0,H.jsx)(`code`,{className:V.commandInline,children:r.unsupported.code}),r.unsupported.pinnedVersion?(0,H.jsxs)(H.Fragment,{children:[` `,`pinned to `,(0,H.jsx)(`span`,{className:V.num,children:r.unsupported.pinnedVersion}),`. A one-line constant bump, not an outage.`]}):null]}):null]}),i?(0,H.jsxs)(`div`,{className:V.creditsRow,children:[(0,H.jsx)(`span`,{className:V.figureLabel,children:`Credits`}),(0,H.jsx)(`span`,{className:V.num,title:i.balance??void 0,children:i.unlimited?`unlimited`:i.balanceValue===null?i.balance??`not reported`:i.balanceValue.toLocaleString(`en-US`,{maximumFractionDigits:2})}),(0,H.jsx)(`p`,{className:V.reason,children:`A separate pool from every window above. The provider gives a bare number, not a currency, so it is shown as reported.`})]}):null,r.notes.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:V.figureLabel,children:`Provider notes`}),(0,H.jsx)(`ul`,{className:V.noteList,children:r.notes.map(e=>(0,H.jsx)(`li`,{className:V.capacityMuted,children:e},e))})]}):null]})]}),(0,H.jsx)(`p`,{className:V.sourceLine,children:we})]})}var Ee={available:`ready`,credits:`ready`,tight:`tight`,exhausted:`blocked`,"signed-out":`blocked`,"probe-unsupported":`blocked`,unknown:`unread`};function K(e,t,n){return e===1?t:n}function De(e){let{ready:t,tight:n,blocked:r,unread:i,total:a,local:o}=e;if(a===0)return`No seats are reported at all. This is an empty roster, not a set of seats at zero.`;let s=o===null?``:o.reachable&&o.residentCount>0?` ${o.residentCount} local ${K(o.residentCount,`model is`,`models are`)} resident and answer with no load delay.`:o.reachable&&o.agenticCount>0?` No local model is resident, but ${o.agenticCount} installed ${K(o.agenticCount,`one can`,`ones can`)} drive a session after a load.`:o.reachable?` No local model is resident.`:` The local runtime did not answer, so local capacity is unknown.`,c=i===0?``:` ${i} ${K(i,`seat has`,`seats have`)} no reading at all — unread, not exhausted.`;return t>0?`${t} of ${a} ${K(a,`seat is`,`seats are`)} usable right now.${c}${s}`:n>0?`No seat is clear: ${n} ${K(n,`is`,`are`)} running tight and ${r} ${K(r,`is`,`are`)} blocked.${c}${s}`:r>0?`No cloud seat reports headroom — ${r} blocked.${c}${s}`:`No seat reported a usable window.${c}${s}`}function Oe(e){let t=e.binding;return{id:e.id,label:e.label,kind:`account`,color:e.color,cls:Ee[e.verdict.state],headline:e.verdict.headline,usedPct:t&&t.measured&&!t.limitReached?t.usedPct:null,measured:t!==null&&t.measured&&!t.limitReached}}function ke(e){return{id:`local`,label:`Local`,kind:`local`,color:e.color,cls:Ee[e.verdict.state],headline:e.verdict.headline,usedPct:e.usedPct,measured:e.usedPct!==null}}function Ae(e,t){let n=[],r=[],i=new Set;for(let a of e)for(let e of a.windows){if(e.resetsAt!==null){let r=Date.parse(e.resetsAt);if(!Number.isNaN(r)){let i=r-t;n.push({seatLabel:a.label,windowLabel:e.label,atMs:r,inMs:i,overdue:i<=0});continue}}if(e.resetText!==null){let t=`${a.label}|${e.label}|${e.resetText}`;if(i.has(t))continue;i.add(t),r.push({seatLabel:a.label,windowLabel:e.label,text:e.resetText})}}return{instants:n,prose:r}}function je(e){let t=e.filter(e=>!e.overdue);return t.length>0?t.reduce((e,t)=>t.inMs<e.inMs?t:e):e.length===0?null:e.reduce((e,t)=>t.atMs>e.atMs?t:e)}function Me(e,t){let n=e.filter(e=>e.atMs>t);return n.length>0?n.reduce((e,t)=>t.atMs<e.atMs?t:e):e.length===0?null:e.reduce((e,t)=>t.atMs>e.atMs?t:e)}function Ne(e,t){if(e===null&&t===null)return null;let n=e?.residentBytes??t?.residentBytes??null,r=e?.memoryBudgetBytes??t?.memoryBudgetBytes??null;return{reachable:t?.reachable??e?.verdict.state!==`unknown`,residentCount:e?.residentCount??t?.rows.filter(e=>e.resident).length??0,installedCount:e?.installedCount??t?.rows.length??0,agenticCount:t?.agenticCount??0,unknownToolCount:t?.unknownToolCount??0,residentBytes:n,memoryBudgetBytes:r,headroomBytes:n!==null&&r!==null?Math.max(0,r-n):null,freeMemoryBytes:t?.freeMemoryBytes??null,usedPct:e?.usedPct??t?.memoryUsedPct??null}}function Pe(e){let t=e.nowMs??Date.now(),n=e.cards.map(Oe);e.localCard&&n.push(ke(e.localCard));let r=e=>n.filter(t=>t.cls===e).length,i=r(`ready`),a=r(`tight`),o=r(`blocked`),s=r(`unread`),{instants:c,prose:l}=Ae(e.cards.map(e=>({label:e.label,windows:e.allWindows})),t),u=Ne(e.localCard,e.localView);return{seats:n,ready:i,tight:a,blocked:o,unread:s,total:n.length,resets:c,nextReset:je(c),proseResets:l,local:u,headline:De({ready:i,tight:a,blocked:o,unread:s,total:n.length,local:u}),noCapacity:n.length>0&&i===0&&a===0&&s<n.length}}function Fe(e){if(!Number.isFinite(e))return`—`;if(e<=0)return`overdue`;let t=Math.floor(e/1e3),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60);return n>0?`${n}d ${r}h`:r>0?`${r}h ${i}m`:i>0?`${i}m`:`${t}s`}function Ie(e){return e===null?`unknown`:e.includes(`tools`)?`supported`:`unsupported`}function Le(e,t){return e===null?t!==null&&t.length===0?`unknown`:Ie(t):e?`supported`:`unsupported`}function Re(e,t){let n=e.expiresAt?Date.parse(e.expiresAt):NaN,r=e.gpuPercent??(e.sizeBytes!==null&&e.sizeBytes>0&&e.sizeVramBytes!==null?Math.max(0,Math.min(100,e.sizeVramBytes/e.sizeBytes*100)):null);return{name:e.name,runtime:e.runtime,resident:e.loaded,placement:e.placement,memoryPct:e.loaded?e.memoryPercent:null,family:e.family,sizeBytes:e.sizeBytes,sizeVramBytes:e.sizeVramBytes,gpuPct:r,expiresInMs:e.loaded&&!Number.isNaN(n)?n-t:null,expiresAtMs:e.loaded&&!Number.isNaN(n)?n:null,parameterSize:e.parameterSize,quantization:e.quantization,nativeContext:e.nativeContext,configuredContext:e.configuredContext,contextTruncated:e.nativeContext!==null&&e.configuredContext!==null&&e.configuredContext<e.nativeContext,tools:Le(e.supportsTools,e.capabilities)}}function ze(e){let t=e.filter(e=>e.stale);if(t.length===0)return{stale:!1,staleForMs:null,runtimes:[]};let n=t.map(e=>e.staleForMs).filter(e=>e!==null);return{stale:!0,staleForMs:n.length===0?null:Math.max(...n),runtimes:t.map(e=>e.runtime)}}function Be(e){if(e===null||!Number.isFinite(e)||e<0)return`an unreported interval`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return r===0?`${n}m`:`${n}m ${r}s`}function Ve(e,t=Date.now()){if(!e)return null;let n=e.models.map(e=>Re(e,t)).sort((e,t)=>Number(t.resident)-Number(e.resident)||e.name.localeCompare(t.name)),r=n.filter(e=>e.resident),i=r.some(e=>e.sizeBytes===null)?null:r.reduce((e,t)=>e+(t.sizeBytes??0),0),a=e.memoryBudgetBytes;return{reachable:e.reachable,reason:e.reason,rows:n,residentBytes:i,memoryBudgetBytes:a,memoryUsedPct:i!==null&&a!==null&&a>0?Math.max(0,Math.min(100,i/a*100)):null,freeMemoryBytes:e.freeMemoryBytes,runtimes:e.runtimes,notes:e.notes,agenticCount:n.filter(e=>e.tools===`supported`).length,nonAgenticCount:n.filter(e=>e.tools===`unsupported`).length,unknownToolCount:n.filter(e=>e.tools===`unknown`).length}}function q(e){if(e===null||!Number.isFinite(e))return`—`;let t=e/1024**3;if(t>=10)return`${t.toFixed(0)} GB`;if(t>=1)return`${t.toFixed(1)} GB`;let n=e/1024**2;return`${Math.round(n)} MB`}function He(e){if(e===null||!Number.isFinite(e))return`—`;if(e<=0)return`expired`;let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}h ${r}m`:r>0?`${r}m ${i}s`:`${i}s`}function J(e){return e===null||!Number.isFinite(e)?`—`:e>=1024?`${Math.round(e/1024)}k`:String(e)}var Ue={ready:`usable`,tight:`tight`,blocked:`blocked`,unread:`no reading`};function We(e,t=3e4){let[n,r]=(0,E.useState)(()=>Date.now());return(0,E.useEffect)(()=>{if(!e)return;let n=setInterval(()=>r(Date.now()),t);return()=>clearInterval(n)},[e,t]),n}function Ge({seat:e,selected:t,onSelect:n}){let r={"--engine-color":e.color},i=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:V.chipLabel,children:e.label}),(0,H.jsx)(`span`,{className:V.chipState,children:Ue[e.cls]}),e.usedPct===null?null:(0,H.jsxs)(`span`,{className:V.chipPct,children:[Math.round(e.usedPct),`%`]})]});return n===null?(0,H.jsx)(`span`,{className:V.chip,style:r,"data-capacity":e.cls,children:i}):(0,H.jsx)(`button`,{type:`button`,className:V.chip,style:r,"data-capacity":e.cls,"aria-pressed":t,onClick:()=>n(e.id),children:i})}function Ke({overview:e,selectedId:t,onSelectSeat:n}){let r=We(e.resets.length>0),i=(0,E.useMemo)(()=>Me(e.resets,r),[e.resets,r]),a=i===null?0:i.atMs-r,o=a<=0,s=e.local;return(0,H.jsxs)(`section`,{className:V.capacity,"aria-labelledby":`verse-capacity-heading`,children:[(0,H.jsx)(`h3`,{id:`verse-capacity-heading`,className:V.visuallyHidden,children:`Capacity right now`}),(0,H.jsx)(`p`,{className:V.capacityHeadline,"data-empty":e.noCapacity?`true`:void 0,children:e.headline}),e.seats.length>0?(0,H.jsx)(`div`,{className:V.chips,role:`list`,"aria-label":`Seat capacity`,children:e.seats.map(e=>(0,H.jsx)(`span`,{role:`listitem`,children:(0,H.jsx)(Ge,{seat:e,selected:t===e.id,onSelect:e.kind===`account`?n:null})},e.id))}):null,(0,H.jsxs)(`dl`,{className:V.capacityFacts,children:[(0,H.jsxs)(`div`,{className:V.capacityFact,children:[(0,H.jsx)(`dt`,{className:V.figureLabel,children:`Nearest reset`}),(0,H.jsx)(`dd`,{children:i===null?(0,H.jsx)(`span`,{className:V.capacityMuted,children:`No seat reported a dated reset. That is an absent timestamp, not "never".`}):o?(0,H.jsxs)(`span`,{className:V.capacityMuted,children:[(0,H.jsx)(`span`,{className:V.num,children:i.seatLabel}),` · `,i.windowLabel,` was due to reset at `,new Date(i.atMs).toLocaleString(),` — this reading predates the rollover.`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:V.num,children:Fe(a)}),` `,(0,H.jsxs)(`span`,{className:V.capacityMuted,children:[`· `,i.seatLabel,` `,i.windowLabel,`, at`,` `,new Date(i.atMs).toLocaleString()]})]})})]}),(0,H.jsxs)(`div`,{className:V.capacityFact,children:[(0,H.jsx)(`dt`,{className:V.figureLabel,children:`Local headroom`}),(0,H.jsx)(`dd`,{children:s===null?(0,H.jsx)(`span`,{className:V.capacityMuted,children:`No local source answered.`}):s.reachable?s.headroomBytes===null?(0,H.jsx)(`span`,{className:V.capacityMuted,children:`Either the resident total or the machine budget was not reported, so headroom cannot be computed.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:V.num,children:q(s.headroomBytes)}),` `,(0,H.jsxs)(`span`,{className:V.capacityMuted,children:[`free of `,q(s.memoryBudgetBytes),` · `,s.residentCount,` resident,`,` `,s.installedCount,` installed`]})]}):(0,H.jsx)(`span`,{className:V.capacityMuted,children:`The local runtime did not answer this probe, so headroom is unknown — not zero, and not full.`})})]}),(0,H.jsxs)(`div`,{className:V.capacityFact,children:[(0,H.jsx)(`dt`,{className:V.figureLabel,children:`Agentic locally`}),(0,H.jsx)(`dd`,{children:s===null||!s.reachable?(0,H.jsx)(`span`,{className:V.capacityMuted,children:`unknown`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:V.num,children:s.agenticCount}),` `,(0,H.jsxs)(`span`,{className:V.capacityMuted,children:[`of `,s.installedCount,` installed models can drive a session`,s.unknownToolCount>0?`; ${s.unknownToolCount} did not report a capability list`:``]})]})})]})]}),e.proseResets.length>0?(0,H.jsxs)(`div`,{className:V.proseResets,children:[(0,H.jsx)(`span`,{className:V.figureLabel,children:`Resets reported as text`}),(0,H.jsx)(`ul`,{className:V.noteList,children:e.proseResets.map(e=>(0,H.jsxs)(`li`,{className:V.capacityMuted,children:[e.seatLabel,` · `,e.windowLabel,` — `,e.text]},`${e.seatLabel}-${e.windowLabel}-${e.text}`))}),(0,H.jsx)(`p`,{className:V.capacityMuted,children:`These providers publish a sentence rather than a timestamp, so it is shown exactly as given and never turned into a countdown.`})]}):null]})}function qe(e){let t=e.fullest;if(t===null)return`—`;let n=`${t.exact?``:`≤`}${T(t.tokens)}`;return t.window===null?n:`${n} / ${T(t.window)} · ${d(t.tokens/t.window)}`}var Je=[{key:`seat`,label:`Seat`,render:e=>(0,H.jsxs)(H.Fragment,{children:[e.label,(0,H.jsxs)(`span`,{className:V.limitWindow,children:[` · ${w[e.engine]}`,e.retired?` · no longer connected`:``]})]})},{key:`chats`,label:`Chats`,numeric:!0,render:e=>y(e.sessions)},{key:`turns`,label:`Turns`,numeric:!0,render:e=>y(e.turns)},{key:`prompt`,label:`Prompt tokens`,numeric:!0,render:e=>T(e.promptTokens)},{key:`hit`,label:`Cache hit`,numeric:!0,render:e=>e.cacheHitRatio===null?e.promptTokens>0?`none reported`:`—`:fe(e.cacheHitRatio)},{key:`compactions`,label:`Compactions`,numeric:!0,render:e=>y(e.compactions)},{key:`expansive`,label:`Expansive chats`,numeric:!0,render:e=>y(e.expansiveSessions)},{key:`fullest`,label:`Fullest context`,numeric:!0,render:e=>qe(e)}];function Ye({rows:e,unavailableReason:t}){return(0,H.jsxs)(`section`,{className:V.panel,"aria-labelledby":`verse-usage-efficiency`,children:[(0,H.jsxs)(`div`,{className:V.panelHead,children:[(0,H.jsx)(`h3`,{id:`verse-usage-efficiency`,className:V.panelTitle,children:`Context efficiency`}),(0,H.jsx)(`p`,{className:V.panelNote,children:`Per seat, across every chat on this machine. Cache hit is the share of prompt tokens served from the provider's cache — the higher it is, the less each turn re-reads at full price. Compactions are the CLI summarizing a context that outgrew its budget.`})]}),t===null?e.length===0?(0,H.jsx)(`p`,{className:V.muted,children:`No chats yet, so there is nothing to measure — this is an empty history, not a seat at 0%.`}):(0,H.jsx)(`div`,{className:V.tableScroll,children:(0,H.jsx)(x,{caption:`Context efficiency per seat: chats, turns, prompt tokens, cache-hit ratio, compactions, expansive chats and the fullest context`,columns:Je,rows:[...e],rowKey:e=>e.seatId})}):(0,H.jsx)(`p`,{className:V.muted,children:t}),(0,H.jsx)(`p`,{className:V.sourceLine,children:`Computed in this browser from each chat's recorded totals — no extra request, no spend. “None reported” means the provider reported no cache activity, not a 0% hit rate; a figure marked ≤ is an upper bound. Compactions are counted from Verse 3.9 on; earlier ones were not recorded.`})]})}function Xe(e){switch(e){case`ok`:return`success`;case`warn`:return`warning`;case`over`:return`danger`;case`unlimited`:return`neutral`;default:return`unknown`}}function Ze({rows:e,capsNote:t}){return(0,H.jsxs)(`section`,{className:V.panel,"aria-labelledby":`verse-usage-limits`,children:[(0,H.jsxs)(`div`,{className:V.panelHead,children:[(0,H.jsx)(`h3`,{id:`verse-usage-limits`,className:V.panelTitle,children:`Dispatch limits`}),(0,H.jsx)(`p`,{className:V.panelNote,children:`Calls recorded in the dispatch ledger against each configured foundry cap. This is not subscription utilization.`})]}),t?(0,H.jsx)(`p`,{className:V.muted,children:t}):null,e.length===0?(0,H.jsx)(`p`,{className:V.muted,children:`No foundry limits are configured, so dispatches are uncapped on this machine. Nothing here is being throttled.`}):(0,H.jsx)(`div`,{className:V.limitList,children:e.map(e=>(0,H.jsxs)(`div`,{className:V.limitRow,children:[(0,H.jsxs)(`span`,{className:V.limitName,children:[e.backend,(0,H.jsxs)(`span`,{className:V.limitWindow,children:[`per `,e.window]}),(0,H.jsx)(a,{status:e.standing,tone:Xe(e.standing),children:e.standing===`unknown`?`no reading`:e.standing})]}),e.usedPct===null?(0,H.jsx)(`hr`,{className:V.unknownRule,"aria-hidden":`true`}):(0,H.jsx)(`div`,{className:V.track,"data-tone":e.usedPct>=100?`danger`:e.usedPct>=80?`warn`:`ok`,role:`meter`,"aria-label":`${e.backend} dispatches against its ${e.window} cap`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(e.usedPct),children:(0,H.jsx)(`div`,{className:V.fill,style:{width:`${Math.round(e.usedPct)}%`}})}),(0,H.jsx)(`span`,{className:V.limitValue,children:e.used===null?`configured ${y(e.max)}`:`${y(e.used)} / ${y(e.max)}`})]},e.id))})]})}var Qe=`Cost is ESTIMATED from a static price table in this repo, not billed. It will not match a provider invoice.`,$e=`Codex reports cacheRead and cacheWrite as a hardcoded 0 upstream, so any window containing Codex traffic understates cache activity — its cache economics are not comparable to Claude’s.`,et=`A flat heuristic of $3 per 1M local tokens, not a quote and not a measured price.`,tt=`Fewer than two days in this window carry a rollup row, which is not a trend.`,nt=`The daily rollup carries no per-engine or local/cloud columns, and the only tier split available is a single aggregate with no dates on it. Apportioning the daily totals by that aggregate’s ratio would invent a shape nobody measured, so no per-day split is drawn — the aggregate below is the real figure.`;function rt(e){return Date.parse(`${e}T00:00:00Z`)}function it(e,t){return e.reduce((e,n)=>e+(t(n)===null?0:1),0)}function Y(e,t){return e.map(e=>({x:rt(e.day),y:t(e)}))}function at(e){return e.reduce((e,t)=>({tokensIn:e.tokensIn+t.tokensIn,tokensOut:e.tokensOut+t.tokensOut,estCostUsd:e.estCostUsd+t.estCostUsd,sessions:e.sessions+t.sessions,dayCount:e.dayCount+1}),{tokensIn:0,tokensOut:0,estCostUsd:0,sessions:0,dayCount:0})}function ot(e){return e?e.days.length<2?{available:!1,reason:tt}:{available:!0,days:e.days,series:[{id:`tokensIn`,label:`Tokens in`,points:Y(e.days,e=>e.tokensIn)},{id:`tokensOut`,label:`Tokens out`,points:Y(e.days,e=>e.tokensOut)}]}:{available:!1,reason:`No usage series has been loaded.`}}function st(e){return e?e.days.length<2?{available:!1,reason:tt}:{available:!0,days:e.days,series:[{id:`estCostUsd`,label:`Estimated spend`,points:Y(e.days,e=>e.estCostUsd)}]}:{available:!1,reason:`No usage series has been loaded.`}}function ct(e){if(!e)return{available:!1,reason:`No usage series has been loaded.`};let t=it(e.days,e=>e.cacheHitRate);return t===0?{available:!1,reason:`No day in this window reported a cache hit rate, so there is nothing to plot. This is an absent signal, not a 0% hit rate.`}:t<2?{available:!1,reason:`Only ${t} day in this window reported a cache hit rate, which is not a trend.`}:{available:!0,days:e.days,series:[{id:`cacheHitRate`,label:`Cache hit rate`,points:Y(e.days,e=>e.cacheHitRate)}]}}function lt(e){return e?it(e.days,e=>e.cacheRead)+it(e.days,e=>e.cacheWrite)===0?{available:!1,reason:`No day in this window reported cache read or write tokens, so there is nothing to plot. This is an absent signal, not zero cache activity.`}:e.days.length<2?{available:!1,reason:tt}:{available:!0,days:e.days,series:[{id:`cacheRead`,label:`Cache read`,points:Y(e.days,e=>e.cacheRead)},{id:`cacheWrite`,label:`Cache write`,points:Y(e.days,e=>e.cacheWrite)}]}:{available:!1,reason:`No usage series has been loaded.`}}function ut(e){if(e.length===0)return{tokensInPerDay:null,tokensOutPerDay:null,estCostUsdPerDay:null,peakCostDay:null};let t=at(e),n=e.reduce((e,t)=>t.estCostUsd>e.estCostUsd?t:e);return{tokensInPerDay:t.tokensIn/e.length,tokensOutPerDay:t.tokensOut/e.length,estCostUsdPerDay:t.estCostUsd/e.length,peakCostDay:{day:n.day,usd:n.estCostUsd}}}function X(e,t){if(!(!e||e.days.length<2))return e.days.map(t)}var Z={"7d":`Last 7 days`,"30d":`Last 30 days`},dt=S(0),ft=S(1),pt=[{key:`provider`,label:`Provider`,render:e=>e.provider},{key:`tier`,label:`Tier`,render:e=>e.tier},{key:`tokens`,label:`Tokens`,numeric:!0,render:e=>y(e.tokens)},{key:`cost`,label:`Cost`,numeric:!0,render:e=>b(e.costUsd)},{key:`share`,label:`Share`,numeric:!0,render:e=>`${Math.round(e.sharePct)}%`}];function mt({label:e,tokens:t,total:n,color:r}){let i=n>0?Math.round(t/n*100):0;return(0,H.jsxs)(`div`,{className:V.splitRow,children:[(0,H.jsx)(`span`,{children:e}),(0,H.jsx)(`div`,{className:V.splitBar,role:`meter`,"aria-label":`${e} share of tokens`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i,children:(0,H.jsx)(`div`,{className:V.splitFill,style:{width:`${i}%`,"--split-color":r}})}),(0,H.jsxs)(`span`,{className:V.num,children:[y(t),` · `,i,`%`]})]})}function ht({split:e,savingsNote:t}){let n=e.localTokens+e.cloudTokens,r=e.byProvider.map(e=>({label:e.provider,value:e.tokens}));return(0,H.jsxs)(`section`,{className:V.panel,"aria-labelledby":`verse-usage-split`,children:[(0,H.jsx)(`div`,{className:V.panelHead,children:(0,H.jsxs)(`h3`,{id:`verse-usage-split`,className:V.panelTitle,children:[`Local vs cloud · `,e.window]})}),(0,H.jsxs)(`div`,{className:V.tiles,children:[(0,H.jsx)(_,{label:`Not spent (ran locally)`,value:(0,H.jsx)(`span`,{className:V.num,children:b(e.localSavingsUsd)}),caption:`Estimated cloud list price of the ${e.window} local tokens. ${t??`A heuristic, not a quote.`}`}),(0,H.jsx)(_,{label:`Estimated cloud spend · ${e.window}`,value:(0,H.jsx)(`span`,{className:V.num,children:b(e.cloudCostUsd)}),caption:Qe}),(0,H.jsx)(_,{label:`Tokens · ${e.window}`,value:(0,H.jsx)(`span`,{className:V.num,children:y(e.totalTokens)}),caption:`Local and cloud combined`})]}),e.empty?(0,H.jsx)(`p`,{className:V.muted,style:{marginTop:`var(--space-4)`},children:`No provider activity recorded in this window.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:V.split,style:{marginTop:`var(--space-4)`},children:[(0,H.jsx)(mt,{label:`Local`,tokens:e.localTokens,total:n,color:dt}),(0,H.jsx)(mt,{label:`Cloud`,tokens:e.cloudTokens,total:n,color:ft})]}),(0,H.jsx)(p,{items:[{label:`Local`,color:dt,kind:`swatch`},{label:`Cloud`,color:ft,kind:`swatch`}]}),(0,H.jsx)(m,{title:`Tokens by provider`,description:`Share of the ${e.window} window`,empty:r.length===0,emptyMessage:`No provider rows in this window.`,table:(0,H.jsx)(x,{caption:`Tokens and cost by provider`,columns:pt,rows:e.byProvider,rowKey:e=>e.provider}),children:(0,H.jsx)(f,{data:r,orientation:`horizontal`,height:Math.max(120,r.length*34),formatValue:e=>y(e),ariaLabel:`Tokens by provider over the ${e.window} window`})})]})]})}var gt={available:`success`,credits:`success`,tight:`warning`,exhausted:`danger`,"signed-out":`warning`,"probe-unsupported":`warning`,unknown:`unknown`},_t=S(0),vt=S(5);function yt(e,t=5e3){let[n,r]=(0,E.useState)(()=>Date.now());return(0,E.useEffect)(()=>{if(!e)return;let n=setInterval(()=>r(Date.now()),t);return()=>clearInterval(n)},[e,t]),n}function bt({row:e}){let t=e.resident?e.expiresAtMs:null,n=yt(t!==null);return t===null?`—`:He(t-n)}function xt({row:e}){return e.tools===`unknown`?(0,H.jsx)(u,{quality:j(`The runtime did not report a capability list for this model.`),label:`${e.name} tool support`,children:null}):e.tools===`supported`?(0,H.jsx)(a,{status:`agentic`,tone:`success`,children:`tools`}):(0,H.jsx)(a,{status:`no-tools`,tone:`danger`,children:`no tools`})}function St({row:e}){if(e.sizeBytes===null)return(0,H.jsx)(`span`,{children:`—`});let t=e.resident?`Resident size reported by the runtime.`:`On-disk size; this model is not resident, so it is using no memory.`;return(0,H.jsxs)(`span`,{title:t,children:[q(e.sizeBytes),e.resident&&e.memoryPct!==null?` · ${Math.round(e.memoryPct)}% of machine`:``]})}function Ct({row:e}){if(!e.resident)return(0,H.jsx)(`span`,{className:V.capacityMuted,children:`not resident`});if(e.gpuPct===null)return(0,H.jsx)(u,{quality:j(`The runtime reported no VRAM split for this resident model.`),label:`${e.name} placement`,children:null});let t=Math.round(e.gpuPct);return(0,H.jsxs)(`span`,{className:V.placement,children:[(0,H.jsxs)(`span`,{className:V.placementBar,role:`img`,"aria-label":`${e.name}: ${t}% of resident bytes on GPU, ${100-t}% on CPU`,children:[(0,H.jsx)(`span`,{className:V.placementGpu,style:{width:`${t}%`,"--split-color":_t}}),(0,H.jsx)(`span`,{className:V.placementCpu,style:{width:`${100-t}%`,"--split-color":vt}})]}),(0,H.jsx)(`span`,{className:V.placementText,children:e.placement===`unknown`?`${t}% GPU`:`${e.placement} · ${t}% GPU`})]})}function wt({row:e}){return e.nativeContext===null&&e.configuredContext===null?(0,H.jsx)(`span`,{children:`—`}):e.contextTruncated?(0,H.jsx)(`span`,{title:`Native context is ${J(e.nativeContext)}; Ashlr runs this seat at ${J(e.configuredContext)}.`,children:`${J(e.configuredContext)} of ${J(e.nativeContext)}`}):(0,H.jsx)(`span`,{children:J(e.nativeContext??e.configuredContext)})}var Tt=[{key:`name`,label:`Model`,render:e=>e.name},{key:`state`,label:`State`,render:e=>e.resident?(0,H.jsx)(a,{status:`resident`,tone:`success`,children:`resident`}):(0,H.jsx)(a,{status:`installed`,tone:`neutral`,children:`installed`})},{key:`tools`,label:`Agentic`,render:e=>(0,H.jsx)(xt,{row:e})},{key:`size`,label:`Size`,numeric:!0,render:e=>(0,H.jsx)(St,{row:e})},{key:`placement`,label:`Placement`,render:e=>(0,H.jsx)(Ct,{row:e})},{key:`params`,label:`Params`,numeric:!0,render:e=>e.parameterSize??`—`},{key:`quant`,label:`Quant`,render:e=>e.quantization??`—`},{key:`context`,label:`Context`,numeric:!0,render:e=>(0,H.jsx)(wt,{row:e})},{key:`keepalive`,label:`Keep-alive`,numeric:!0,render:e=>(0,H.jsx)(bt,{row:e})}];function Et({staleness:e}){return e.stale?(0,H.jsxs)(`p`,{className:V.staleNotice,role:`status`,children:[(0,H.jsx)(`span`,{className:V.staleFlag,children:`last known-good`}),` Every local figure below is the last known-good reading from `,Be(e.staleForMs),` ago`,e.runtimes.length>0?` (${e.runtimes.join(`, `)})`:``,`, not a fresh probe: the runtime did not answer in time and the server kept the previous report rather than erasing it.`]}):null}function Dt({card:e,staleness:t}){let n={"--engine-color":e.color},r=e.usedPct===null?null:Math.round(e.usedPct);return(0,H.jsxs)(`article`,{className:V.card,style:n,"aria-label":`Local usage`,children:[(0,H.jsxs)(`div`,{className:V.cardHead,children:[(0,H.jsx)(`span`,{className:V.cardLabel,children:`Local`}),(0,H.jsx)(a,{status:e.verdict.state,tone:gt[e.verdict.state],children:e.verdict.headline})]}),(0,H.jsxs)(`div`,{className:V.cardMeta,children:[(0,H.jsx)(`span`,{children:`Ollama`}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,H.jsx)(`span`,{children:`no subscription, no quota, no bill`})]}),t?.stale?(0,H.jsx)(Et,{staleness:t}):null,(0,H.jsx)(`p`,{className:V.verdictDetail,children:e.verdict.detail}),e.verdict.code?(0,H.jsxs)(`p`,{className:V.sourceLine,children:[`Probe reason `,(0,H.jsx)(`code`,{className:V.commandInline,children:e.verdict.code})]}):null,(0,H.jsx)(`span`,{className:V.bindingLabel,children:`Memory budget`}),r===null?(0,H.jsxs)(`div`,{className:V.windowBlockLead,children:[(0,H.jsxs)(`div`,{className:V.windowHead,children:[(0,H.jsx)(`span`,{children:`Resident against machine memory`}),(0,H.jsx)(u,{quality:j(`Either the resident size or the machine memory budget was not reported, so no share can be computed.`),label:`local memory budget`,children:null})]}),(0,H.jsx)(`hr`,{className:V.unknownRule,"aria-hidden":`true`})]}):(0,H.jsxs)(`div`,{className:V.windowBlockLead,children:[(0,H.jsxs)(`div`,{className:V.windowHead,children:[(0,H.jsx)(`span`,{children:`Resident against machine memory`}),(0,H.jsxs)(`span`,{className:V.windowPct,children:[r,`%`]})]}),(0,H.jsx)(`div`,{className:V.track,"data-tone":e.tone,role:`meter`,"aria-label":`Local resident models against machine memory budget`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r,"aria-valuetext":`${q(e.residentBytes)} of ${q(e.memoryBudgetBytes)} resident`,children:(0,H.jsx)(`div`,{className:V.fill,style:{width:`${r}%`}})}),(0,H.jsxs)(`p`,{className:V.windowReset,children:[q(e.residentBytes),` of `,q(e.memoryBudgetBytes)]})]}),(0,H.jsxs)(`p`,{className:V.sourceLine,children:[e.residentCount,` resident · `,e.installedCount,` installed`]})]})}function Ot({serving:e}){if(e===void 0)return(0,H.jsx)(`p`,{className:V.sourceLine,children:`Residency is not concurrency. How many local agents can run at once is decided by the serving runtime, not by these models — a resident model can still be served to one agent at a time. The serving runtime and its real slot count are in Autonomy.`});let t=ue(e);return(0,H.jsxs)(`p`,{className:V.sourceLine,children:[(0,H.jsxs)(`strong`,{children:[t.headline,`.`]}),` `,t.detail]})}function kt({view:e,serving:t}){let[n,r]=(0,E.useState)(!1),i=(0,E.useMemo)(()=>ze(e?.runtimes??[]),[e]),a=(0,E.useMemo)(()=>n?(e?.rows??[]).filter(e=>e.tools!==`unsupported`):e?.rows??[],[e,n]),o=(0,E.useMemo)(()=>a.filter(e=>e.resident&&e.sizeBytes!==null),[a]);return(0,H.jsxs)(`section`,{className:V.panel,"aria-labelledby":`verse-usage-local`,children:[(0,H.jsxs)(`div`,{className:V.panelHead,children:[(0,H.jsx)(`h3`,{id:`verse-usage-local`,className:V.panelTitle,children:`Local availability`}),(0,H.jsx)(`p`,{className:V.panelNote,children:`Resident models answer immediately. A model without tool support cannot drive an agentic session at all, however much memory is free.`})]}),(0,H.jsx)(Ot,{serving:t}),(0,H.jsx)(Et,{staleness:i}),e===null?(0,H.jsx)(`p`,{className:V.muted,children:`No local-model source answered, so neither resident nor installed models can be listed. This is a missing source, not an empty machine.`}):e.reachable?e.rows.length===0?(0,H.jsx)(`p`,{className:V.muted,children:`The local runtime answered and reports no installed models. Pull one to give Ashlr a local seat.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:V.tiles,children:[(0,H.jsx)(Q,{label:`Resident now`,value:String(e.rows.filter(e=>e.resident).length),caption:e.residentBytes===null?`At least one resident model reported no size, so the total is withheld rather than understated.`:`${q(e.residentBytes)} in memory`}),(0,H.jsx)(Q,{label:`Installed`,value:String(e.rows.length),caption:`On disk; the first turn on one of these pays a load`}),(0,H.jsx)(Q,{label:`Can drive a session`,value:String(e.agenticCount),caption:e.unknownToolCount>0?`${e.nonAgenticCount} cannot; ${e.unknownToolCount} did not report a capability list`:`${e.nonAgenticCount} cannot drive one`}),(0,H.jsx)(Q,{label:`Machine memory`,value:e.memoryBudgetBytes===null?`unknown`:q(e.memoryBudgetBytes),caption:e.freeMemoryBytes===null?`The machine reported no free-memory figure.`:`${q(e.freeMemoryBytes)} reported free by the OS`})]}),(0,H.jsxs)(`div`,{className:V.panelActions,children:[(0,H.jsx)(`button`,{type:`button`,className:V.segment,"aria-pressed":n,onClick:()=>r(e=>!e),children:`Hide models that cannot drive a session`}),e.nonAgenticCount>0?(0,H.jsxs)(`span`,{className:V.capacityMuted,children:[e.nonAgenticCount,` of `,e.rows.length,` installed models cannot drive an agentic session.`]}):null]}),(0,H.jsx)(`div`,{className:V.tableScroll,children:(0,H.jsx)(x,{caption:`Local models: residency, tool support, size, placement, parameters, quantization, context and keep-alive`,columns:Tt,rows:a,rowKey:e=>`${e.runtime??`runtime`}:${e.name}`})}),(0,H.jsx)(`div`,{className:V.charts,children:(0,H.jsx)(m,{title:`Resident memory by model`,description:`What is actually in memory right now`,caveat:`Only models the runtime reports as resident WITH a size appear here. An installed model occupies no memory and is not a bar at zero.`,empty:o.length===0,emptyMessage:`Nothing is resident, so there is no memory in use to chart. That is an idle machine, not a zero reading.`,table:(0,H.jsx)(x,{caption:`Resident size per model`,columns:[{key:`name`,label:`Model`,render:e=>e.name},{key:`size`,label:`Resident`,numeric:!0,render:e=>q(e.sizeBytes)}],rows:o,rowKey:e=>e.name}),children:(0,H.jsx)(f,{data:o.map(e=>({label:e.name,value:e.sizeBytes})),orientation:`horizontal`,height:Math.max(120,o.length*34),formatValue:e=>q(e),ariaLabel:`Resident memory by local model`})})}),e.runtimes.length>0?(0,H.jsx)(`ul`,{className:V.noteList,children:e.runtimes.map(e=>(0,H.jsxs)(`li`,{className:V.capacityMuted,children:[e.runtime,`:`,` `,e.reachable?`${e.modelCount} model${e.modelCount===1?``:`s`} reported`:`did not answer`,e.stale?` · retained reading, ${Be(e.staleForMs)} old`:``,e.reason?` · `:``,e.reason?(0,H.jsx)(`code`,{className:V.commandInline,children:e.reason}):null]},e.runtime))}):null,e.notes.length>0?(0,H.jsx)(`ul`,{className:V.noteList,children:e.notes.map(e=>(0,H.jsx)(`li`,{className:V.capacityMuted,children:e},e))}):null,(0,H.jsxs)(`p`,{className:V.sourceLine,children:[`Sizes and the GPU share come from the runtime's own resident report; a model with no reported VRAM split shows no placement bar rather than being drawn as fully on GPU.`,` `,y(e.rows.length),` models installed.`]})]}):(0,H.jsxs)(`p`,{className:V.muted,children:[`No local runtime answered this probe, so nothing about local models can be read. That is an unanswered probe, not a report that no models are installed.`,e.reason?(0,H.jsxs)(H.Fragment,{children:[` `,`Probe reason `,(0,H.jsx)(`code`,{className:V.commandInline,children:e.reason}),`.`]}):null]})]})}function Q({label:e,value:t,caption:n}){return(0,H.jsxs)(`div`,{className:V.figureTile,children:[(0,H.jsx)(`span`,{className:V.figureLabel,children:e}),(0,H.jsx)(`span`,{className:V.figureBig,children:t}),(0,H.jsx)(`span`,{className:V.figureCaption,children:n})]})}var At=[`7d`,`30d`],jt=[{key:`day`,label:`Day`,render:e=>h(e.day)},{key:`in`,label:`Tokens in`,numeric:!0,render:e=>y(e.tokensIn)},{key:`out`,label:`Tokens out`,numeric:!0,render:e=>y(e.tokensOut)},{key:`sessions`,label:`Sessions`,numeric:!0,render:e=>y(e.sessions)}],Mt=[{key:`day`,label:`Day`,render:e=>h(e.day)},{key:`cost`,label:`Estimated spend`,numeric:!0,render:e=>b(e.estCostUsd)}],Nt=[{key:`day`,label:`Day`,render:e=>h(e.day)},{key:`read`,label:`Cache read`,numeric:!0,render:e=>e.cacheRead===null?`not reported`:y(e.cacheRead)},{key:`write`,label:`Cache write`,numeric:!0,render:e=>e.cacheWrite===null?`not reported`:y(e.cacheWrite)}],Pt=[{key:`day`,label:`Day`,render:e=>h(e.day)},{key:`rate`,label:`Cache hit rate`,numeric:!0,render:e=>e.cacheHitRate===null?`not reported`:d(e.cacheHitRate)},{key:`read`,label:`Cache read`,numeric:!0,render:e=>e.cacheRead===null?`not reported`:y(e.cacheRead)}];function Ft({series:e,window:t,onWindowChange:n,unavailableReason:r,loading:i}){let a=e?at(e.days):null,o=e?ut(e.days):null,s=ot(e),c=st(e),l=ct(e),u=lt(e);return(0,H.jsxs)(`section`,{className:V.panel,"aria-labelledby":`verse-usage-series`,children:[(0,H.jsxs)(`div`,{className:V.panelHead,children:[(0,H.jsx)(`h3`,{id:`verse-usage-series`,className:V.panelTitle,children:`Token output and spend`}),(0,H.jsx)(`div`,{className:V.segmented,role:`group`,"aria-label":`Series window`,children:At.map(e=>(0,H.jsx)(`button`,{type:`button`,className:V.segment,"aria-pressed":e===t,onClick:()=>n(e),children:e},e))})]}),r?(0,H.jsxs)(`p`,{className:V.muted,children:[r,` No token or spend series can be drawn, and none is invented in its place.`]}):i&&e===null?(0,H.jsxs)(`p`,{className:V.muted,"aria-busy":`true`,children:[`Loading the `,Z[t].toLowerCase(),` rollup…`]}):e===null||e.days.length===0?(0,H.jsxs)(`p`,{className:V.muted,children:[`The rollup for `,Z[t].toLowerCase(),` came back with no days in it. That is an empty window, not a zero.`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:V.tiles,children:[(0,H.jsx)(_,{label:`Tokens in · ${t}`,value:(0,H.jsx)(`span`,{className:V.num,children:y(a?.tokensIn??0)}),caption:`Across ${a?.dayCount??0} recorded days`,trend:X(e,e=>e.tokensIn),trendLabel:`Tokens in per day`}),(0,H.jsx)(_,{label:`Tokens out · ${t}`,value:(0,H.jsx)(`span`,{className:V.num,children:y(a?.tokensOut??0)}),caption:`What the models actually produced`,trend:X(e,e=>e.tokensOut),trendLabel:`Tokens out per day`}),(0,H.jsx)(_,{label:`Estimated spend · ${t}`,value:(0,H.jsx)(`span`,{className:V.num,children:b(a?.estCostUsd??0)}),caption:`Estimated from a static price table — not billed`,trend:X(e,e=>e.estCostUsd),trendLabel:`Estimated spend per day`}),(0,H.jsx)(_,{label:`Sessions · ${t}`,value:(0,H.jsx)(`span`,{className:V.num,children:y(a?.sessions??0)}),caption:`Rollup rows, not billed calls`,trend:X(e,e=>e.sessions),trendLabel:`Sessions per day`}),(0,H.jsx)(_,{label:`Estimated spend per active day`,value:(0,H.jsx)(`span`,{className:V.num,children:o?.estCostUsdPerDay===null||o===null?`unknown`:b(o.estCostUsdPerDay)}),caption:`Across the ${a?.dayCount??0} days that carry a rollup row — not the ${t} calendar span`}),(0,H.jsx)(_,{label:`Heaviest day`,value:(0,H.jsx)(`span`,{className:V.num,children:o?.peakCostDay?b(o.peakCostDay.usd):`unknown`}),caption:o?.peakCostDay?`${h(o.peakCostDay.day)} — estimated, not billed`:`No day in this window carries a cost row.`})]}),(0,H.jsxs)(`div`,{className:V.charts,children:[(0,H.jsx)(m,{title:`Tokens per day`,description:Z[t],empty:!s.available,emptyMessage:s.available?``:s.reason,table:(0,H.jsx)(x,{caption:`Tokens in and out per day`,columns:jt,rows:e.days,rowKey:e=>e.day}),children:s.available?(0,H.jsx)(g,{series:s.series,formatX:e=>v(e),formatY:e=>y(e),ariaLabel:`Tokens in and out per day over ${Z[t].toLowerCase()}`}):null}),(0,H.jsx)(m,{title:`Estimated spend per day`,description:Z[t],caveat:Qe,empty:!c.available,emptyMessage:c.available?``:c.reason,table:(0,H.jsx)(x,{caption:`Estimated spend per day`,columns:Mt,rows:e.days,rowKey:e=>e.day}),children:c.available?(0,H.jsx)(g,{series:c.series,area:!0,formatX:e=>v(e),formatY:e=>b(e),ariaLabel:`Estimated spend per day over ${Z[t].toLowerCase()}`}):null}),(0,H.jsx)(m,{title:`Cache hit rate`,description:Z[t],caveat:$e,empty:!l.available,emptyMessage:l.available?``:l.reason,table:l.available?(0,H.jsx)(x,{caption:`Cache hit rate per day`,columns:Pt,rows:e.days,rowKey:e=>e.day}):void 0,children:l.available?(0,H.jsx)(g,{series:l.series,formatX:e=>v(e),formatY:e=>d(e),ariaLabel:`Cache hit rate per day over ${Z[t].toLowerCase()}`}):null}),(0,H.jsx)(m,{title:`Cache read and write tokens`,description:Z[t],caveat:$e,empty:!u.available,emptyMessage:u.available?``:u.reason,table:u.available?(0,H.jsx)(x,{caption:`Cache read and write tokens per day`,columns:Nt,rows:e.days,rowKey:e=>e.day}):void 0,children:u.available?(0,H.jsx)(g,{series:u.series,formatX:e=>v(e),formatY:e=>y(e),ariaLabel:`Cache read and write tokens per day over ${Z[t].toLowerCase()}`}):null}),(0,H.jsx)(m,{title:`Local vs cloud per day`,description:Z[t],empty:!0,emptyMessage:nt,children:null})]}),e.caveats.length>0?(0,H.jsx)(`ul`,{className:V.noteList,children:e.caveats.map(e=>(0,H.jsx)(`li`,{className:V.capacityMuted,children:e},e))}):null]})]})}var It=[{key:`day`,label:`Day`,render:e=>h(e.day)},{key:`usd`,label:`Spend`,numeric:!0,render:e=>e.usd===null?`no tick retained`:b(e.usd)}];function Lt({series:e,todaySpentUsd:t,todaySpentDate:n,dailyBudgetUsd:r,showSeries:i=!0}){let a=n!==null&&!le(n),o=a?null:t,s=a?`Nothing recorded today — the last ledger day is ${n}`:r===null?`Configured daily budget unavailable`:r===0?`Daily budget is 0 — the loop is stopped`:`of a ${b(r)} daily budget`;return(0,H.jsxs)(`section`,{className:V.panel,"aria-labelledby":`verse-usage-spend`,children:[(0,H.jsx)(`div`,{className:V.panelHead,children:(0,H.jsx)(`h3`,{id:`verse-usage-spend`,className:V.panelTitle,children:`Spend`})}),(0,H.jsx)(`div`,{className:V.tiles,children:(0,H.jsx)(_,{label:`Spend today`,value:(0,H.jsx)(`span`,{className:V.num,children:o===null?`unknown`:b(o)}),caption:s})}),i?(0,H.jsx)(`div`,{style:{marginTop:`var(--space-4)`},children:e.available?(0,H.jsx)(m,{title:`Spend per day`,description:`Autonomous loop, from the daemon tick ledger`,caveat:e.caveat,table:(0,H.jsx)(x,{caption:`Spend per day from the daemon tick ledger`,columns:It,rows:e.days,rowKey:e=>e.day}),children:(0,H.jsx)(g,{series:[{id:`spend`,label:`Spend`,points:e.days.map(e=>({x:Date.parse(`${e.day}T00:00:00Z`),y:e.usd}))}],area:!0,formatX:e=>v(e),formatY:e=>b(e),ariaLabel:`Autonomous loop spend per day`})}):(0,H.jsx)(m,{title:`Spend per day`,empty:!0,emptyMessage:e.reason,children:null})}):(0,H.jsx)(`p`,{className:V.sourceLine,children:`Per-day spend is charted above from the full usage rollup. The daemon tick ledger is not drawn again here.`})]})}var Rt={five_hour:`Session · rolling 5h`,seven_day:`Week · all models`,seven_day_sonnet:`Week · Sonnet`,seven_day_opus:`Week · Opus`,seven_day_fable:`Week · Fable`,codex:`Week · Codex`,primary:`Primary window`,secondary:`Secondary window`};function zt(e){if(e.label)return e.label;let t=Rt[e.id];if(t)return t;let n=/^seven_day_(.+)$/.exec(e.id);return n?`Week · ${n[1]}`:e.id}function Bt(e){let t=e.resetDescription??e.resetsAt;return{id:e.id,label:zt(e),usedPct:e.limitReached?null:e.usedPercent,tone:e.limitReached?`danger`:e.usedPercent===null?`ok`:M(e.usedPercent),resetText:t,resetsAt:e.resetsAt,limitReached:e.limitReached,measured:e.measured}}function Vt(e){let t=e.windows,n=t.find(e=>e.limitReached);if(n)return n;let r=t.filter(e=>e.usedPercent!==null),i=r.length===0?null:r.reduce((e,t)=>(t.usedPercent??0)>(e.usedPercent??0)?t:e),a=e.binding;if(a){let e=t.find(e=>e.id===a.id)??null;if(e&&(a.limitReached||e.limitReached||i===null||(a.usedPercent??-1)>=(i.usedPercent??-1)))return e}return i}var Ht={"connection-monitor-stopped":"Native polling stopped after a metadata sample could not confirm its process cleanup, so these readings are frozen and no new ones are being taken. Restarting `ashlr verse` begins a new collection generation.","collector-unavailable":`This server is not collecting native metadata, so nothing here is a live reading.`,"collector-not-running":`No account collector is running in this server, so these cards fall back to whatever shared evidence exists.`,"collector-owned":"Another collector (`ashlr resource-console`) owns the exclusive metadata lease, so Verse is reading its shared evidence rather than probing.","collector-start-failed":`The metadata collectors could not be started in this server, so no probe has run.`,"connection-polling-paused":`Native polling is paused because no client has asked for account data recently; it resumes on the next request.`,"connection-not-checked":`No probe has run for this account yet in this server.`,"connection-probe-unavailable":`The probe for this account did not return a usable result, so there is no measurement to show.`,"accounts-pool-unavailable":`This accounts root has no readable pool or bindings, so there is nothing to probe.`,"accounts-collection-not-configured":`Native account collection is not configured for this accounts root.`,"usage-version-unsupported":`The usage probe is pinned to a specific provider build and failed closed on the installed one. That is a version pin, not an outage.`,"usage-account-changed":`The account behind this profile changed between two reads, so the reading was discarded rather than attributed to the wrong account.`,"probe-account-unavailable":`The pinned profile answered but carries no usable account identity — it is not authenticated.`,"probe-account-unsupported":`The pinned profile is authenticated by a method this probe does not accept, so no reading was taken.`,"probe-account-changed":`The account behind this pinned profile changed mid-probe, so the reading was discarded.`,"probe-account-hint-mismatch":`The pinned profile is signed in as a different account than this seat expects.`,"probe-native-unavailable":`The provider CLI for this pinned profile could not be run, so no reading was taken.`,"probe-native-exit-failed":`The provider CLI for this pinned profile exited without a usable result.`,"probe-provider-error":`The provider CLI returned an error instead of account metadata.`,"probe-protocol-unsupported":`The installed provider CLI does not speak the metadata protocol this probe requires.`,"probe-quota-invalid":`The provider returned a quota shape this probe does not recognise, so nothing was accepted as a reading.`,"probe-timed-out":`The metadata probe for this account timed out before it returned anything.`};function Ut(e,t){return e===null?t:Ht[e]??t}var Wt={available:0,credits:1,tight:2,exhausted:3,"signed-out":4,"probe-unsupported":5,unknown:6},Gt=80,Kt=100;function qt(e){return e?e.unlimited?!0:e.hasCredits?e.balanceValue!==null&&e.balanceValue>0:!1:!1}function Jt(e){return e.unlimited?`credits are unlimited on this plan`:`a credit balance of ${e.balance??`an unreported amount`} is still spendable`}function Yt(e,t){if(e.authentication===`signed-out`||e.state===`signed-out`)return{state:`signed-out`,headline:`Signed out`,detail:Ut(e.reason,`The probe reached this account’s pinned profile but it is not authenticated, so there is nothing to measure.`),code:e.reason};if(e.unsupported)return{state:`probe-unsupported`,headline:`Probe version-pinned`,detail:`The usage probe failed closed with ${e.unsupported.code}${e.unsupported.pinnedVersion?`; it is pinned to ${e.unsupported.pinnedVersion}`:``}. This is a version pin, not an outage — no window can be read until the pin is bumped.`,code:e.unsupported.code};let n=qt(e.credits);if(t===null||t.usedPercent===null&&!t.limitReached)return n&&e.credits?{state:`credits`,headline:`Usable on credits`,detail:`No window reading reached this surface, but ${Jt(e.credits)}.`,code:e.reason}:{state:`unknown`,headline:`No reading`,detail:Ut(e.reason,`No window percentage reached this surface for this account, so nothing here is a measurement.`),code:e.reason};let r=t.usedPercent,i=t.limitReached||r!==null&&r>=Kt,a=zt(t);return i?n&&e.credits?{state:`credits`,headline:`Usable on credits`,detail:`${a} is ${t.limitReached?`reported as limit reached`:`fully used`}, but ${Jt(e.credits)} — credits are independent of the window, so this account is not blocked.`,code:null}:{state:`exhausted`,headline:t.limitReached?`Limit reached`:`Window exhausted`,detail:t.limitReached?`The provider flagged ${a} as rate-limited. That flag is a denial, not a measurement, so no percentage is shown.`:`${a} is at ${Math.round(r)}% — it is the binding constraint on this account.`,code:null}:r>=Gt?{state:`tight`,headline:`Running tight`,detail:`${a} is the binding constraint at ${Math.round(r)}%.`,code:null}:{state:`available`,headline:`Usable now`,detail:`${a} is the binding constraint at ${Math.round(r)}%.`,code:null}}function Xt(e,t=null){let n=Vt(e),r=Yt(e,n),i=e.provider,a=e.windows.filter(e=>e.id!==n?.id).map(Bt),o=n?Bt(n):null,s={state:e.state,authentication:e.authentication,health:e.health,reasonCode:e.reason,observedAt:e.observedAt,notes:e.notes,unsupported:e.unsupported};return{id:e.id,label:e.label,engine:i,color:D[i],plan:e.planType,verdict:r,allWindows:o?[o,...a]:a,evidence:s,hasDetail:e.windows.length>0||e.notes.length>0||e.credits!==null||e.reason!==null,binding:o,others:a,credits:e.credits,reconnectCommand:e.reconnectCommand,observedAt:e.observedAt,rank:Wt[r.state],sourceNote:t}}function Zt(e){if(!e)return[];let t=new Set;for(let n of e.accounts)for(let e of n.notes)t.add(e);return[...t]}function Qt(e){return e?e.accounts.map(e=>Xt(e)).sort((e,t)=>e.rank-t.rank||e.label.localeCompare(t.label)):[]}function $t(e){if(!e)return null;let t=e.models.filter(e=>e.loaded),n=e.reachable?t.length===0?0:t.some(e=>e.sizeBytes===null)?null:t.reduce((e,t)=>e+(t.sizeBytes??0),0):null,r=e.memoryBudgetBytes,i=n!==null&&r!==null&&r>0?Math.max(0,Math.min(100,n/r*100)):null,a=e.reachable?t.length>0?{state:`available`,headline:`Resident now`,detail:`${t.length} model${t.length===1?``:`s`} already in memory — no load delay, no quota, no bill.`,code:null}:e.models.length>0?{state:`tight`,headline:`Installed, not loaded`,detail:`${e.models.length} model${e.models.length===1?` is`:`s are`} installed but nothing is resident, so the first turn pays a load.`,code:null}:{state:`unknown`,headline:`No models installed`,detail:`The runtime is reachable but reports no installed models.`,code:null}:{state:`unknown`,headline:`Runtime unreachable`,detail:`No local runtime answered, so neither resident nor installed models can be listed. This is an unanswered probe, not a report that the machine is empty.`,code:e.reason};return{residentCount:t.length,installedCount:e.models.length,residentBytes:n,memoryBudgetBytes:r,usedPct:i,tone:i===null?`ok`:M(i),verdict:a,color:D.local,rank:Wt[a.state]}}var en=`Per-account probes are unavailable on this server, so these cards are derived from the seat roster and the per-engine snapshots.`;function tn(e){let{seat:t,control:n,frontier:r,engineSeatCount:i}=e;if(t.engine===`local`)return null;let a=n?.subscriptionUsage?.find(e=>String(e.engine)===t.engine),o=r?.engines.find(e=>String(e.engine)===t.engine),s=me({engine:t.engine,seat:t,subscription:a,frontier:o,engineSeatCount:i}),c=s.kind===`measured`?s.windows.map(e=>({id:e.id,label:e.label,usedPercent:e.usedPct,resetsAt:e.resetsAt===null?null:new Date(e.resetsAt*1e3).toISOString(),resetDescription:null,limitReached:!1,measured:!0})):[];return{account:{id:t.id,label:t.label,provider:t.engine,state:s.kind===`measured`?`observed`:`unavailable`,authentication:`unknown`,health:null,planType:a?.plan??null,observedAt:t.health.observedAt,windows:c,binding:null,credits:null,reason:s.kind===`measured`?null:s.reason,unsupported:null,reconnectCommand:null,notes:[]},sourceNote:s.kind===`measured`?`${pe[s.source]}${s.scope===`engine`?` · engine-wide, shared by every account on this engine`:``}`:null}}function nn(e){let t=e.bootstrap?.seats??[],n=new Map;for(let e of t)n.set(e.engine,(n.get(e.engine)??0)+1);return t.map(t=>tn({seat:t,control:e.control,frontier:e.frontier,engineSeatCount:n.get(t.engine)??1})).filter(e=>e!==null).map(e=>Xt(e.account,e.sourceNote)).sort((e,t)=>e.rank-t.rank||e.label.localeCompare(t.label))}function $(e){return e instanceof s&&e.status===401}function rn({title:e,body:t,action:n}){return(0,H.jsxs)(`div`,{className:V.stateBlock,role:`status`,children:[(0,H.jsx)(`p`,{className:V.stateTitle,children:e}),(0,H.jsx)(`p`,{className:V.stateBody,children:t}),n?(0,H.jsx)(`div`,{className:V.stateActions,children:n}):null]})}var an=3e4,on={gridColumn:`1 / -1`};function sn(e,t){(0,E.useEffect)(()=>{let n=null,r=()=>{n!==null&&clearInterval(n),n=null},i=()=>{let i=typeof document>`u`||document.visibilityState===`visible`;i&&n===null?n=setInterval(e,t):i||r()};return i(),document.addEventListener(`visibilitychange`,i),()=>{document.removeEventListener(`visibilitychange`,i),r()}},[e,t])}function cn(){let[e,t]=(0,E.useState)(`7d`),[n,a]=(0,E.useState)(null),s=c(C),u=c(re),f=c(ie(e)),p=c(ce),m=c(ee),h=c(ne),g=c(ae),v=r(C),y=r(re),b=r(ie(e)),x=r(ce),S=r(ee),le=r(ne),ue=r(ae),w=l(C),fe=l(re);sn(w,an),sn(fe,an);let T=()=>{v(),y(),b(),x(),S(),le(),ue()},D=(0,E.useMemo)(()=>s.data?.available?se(s.data.raw):null,[s.data]),O=(0,E.useMemo)(()=>u.data?.available?te(u.data.raw):null,[u.data]),k=(0,E.useMemo)(()=>f.data?.available?oe(f.data.raw,e):null,[f.data,e]),A=(0,E.useMemo)(()=>h.data?h.data.available?ve(h.data.raw,h.data.reason):ye(h.data.reason??`Configured caps unavailable.`):ye(`Configured caps not loaded yet.`),[h.data]),pe=D===null,j=(0,E.useMemo)(()=>D?Qt(D):nn({bootstrap:g.data,control:m.data,frontier:p.data}),[D,g.data,m.data,p.data]),M=(0,E.useMemo)(()=>Ve(O),[O]),N=(0,E.useMemo)(()=>$t(O),[O]),P=(0,E.useMemo)(()=>Zt(D),[D]),F=(0,E.useMemo)(()=>{let e=j.map(e=>({key:e.id,rank:e.rank,label:e.label,kind:`account`,card:e}));return N&&e.push({key:`local`,rank:N.rank,label:`Local`,kind:`local`,card:N}),e.sort((e,t)=>e.rank-t.rank||e.label.localeCompare(t.label))},[j,N]),I=(0,E.useMemo)(()=>Pe({cards:j,localCard:N,localView:M}),[j,N,M]),me=(0,E.useMemo)(()=>ze(M?.runtimes??[]),[M]),L=e=>{a(t=>t===e?null:e)},R=(0,E.useCallback)(()=>{let e=n;a(null),e!==null&&typeof document<`u`&&document.getElementById(`verse-account-trigger-${e}`)?.focus()},[n]),z=(0,E.useMemo)(()=>de(g.data?.sessions??[],g.data?.seats??[]),[g.data]),B=g.data?null:g.status===`error`?`The chat list could not be read${g.error?.message?` (${g.error.message})`:``}, so efficiency cannot be computed.`:`Reading the chat list…`,U=(0,E.useMemo)(()=>he(m.data?.usage),[m.data]),be=(0,E.useMemo)(()=>ge(m.data?.limits,A.foundryLimits),[m.data,A.foundryLimits]),xe=(0,E.useMemo)(()=>_e(m.data?.daemonObservation),[m.data]),Ce=A.available?A.todaySpentUsd:m.data?.daemon.todaySpentUsd??null,we=A.available?A.todaySpentDate:null,W=$(s.error)||$(u.error)||$(f.error)||$(p.error)||$(m.error)||$(g.error),G=!W&&p.status===`error`&&m.status===`error`&&p.data===void 0&&m.data===void 0,Ee=!W&&!G&&s.data===void 0&&p.data===void 0&&m.data===void 0&&(s.status===`loading`||s.status===`idle`||p.status===`loading`||m.status===`loading`||p.status===`idle`||m.status===`idle`),K=s.status===`refreshing`||p.status===`refreshing`||m.status===`refreshing`,De=D?.sampledAt??p.data?.generatedAt??m.data?.ts??null;return(0,H.jsxs)(`section`,{className:V.section,"aria-label":`Usage`,children:[(0,H.jsxs)(`header`,{className:V.header,"data-app-region":`drag`,children:[(0,H.jsx)(`h2`,{className:V.headerTitle,children:`Usage`}),(0,H.jsxs)(`div`,{className:V.headerMeta,children:[De?(0,H.jsxs)(`span`,{children:[K?`refreshing · `:``,`as of `,new Date(De).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})]}):null,(0,H.jsx)(`button`,{type:`button`,className:V.ghostButton,onClick:T,children:`Refresh`})]})]}),(0,H.jsx)(`div`,{className:V.scroll,children:W?(0,H.jsx)(rn,{title:`Read session expired`,body:`Usage data needs an authenticated read session. Unlock the console with the read token ashlr verse printed, then refresh.`,action:(0,H.jsx)(`button`,{type:`button`,className:V.ghostButton,onClick:T,children:`Try again`})}):G?(0,H.jsx)(rn,{title:`Usage sources unreachable`,body:`Neither /api/usage nor /api/control answered. ${m.error?.message??p.error?.message??``}`.trim(),action:(0,H.jsx)(`button`,{type:`button`,className:V.ghostButton,onClick:T,children:`Retry`})}):Ee?(0,H.jsxs)(`div`,{"aria-busy":`true`,children:[(0,H.jsx)(i,{width:`30%`}),(0,H.jsx)(`div`,{className:V.skeletonGrid,style:{marginTop:`var(--space-4)`},children:(0,H.jsx)(o,{count:5})})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Ke,{overview:I,selectedId:n,onSelectSeat:L}),(0,H.jsxs)(`section`,{className:V.panel,"aria-labelledby":`verse-usage-accounts`,children:[(0,H.jsxs)(`div`,{className:V.panelHead,children:[(0,H.jsx)(`h3`,{id:`verse-usage-accounts`,className:V.panelTitle,children:`Accounts`}),(0,H.jsx)(`p`,{className:V.panelNote,children:`Ordered by what you can use right now. Each card leads with its binding constraint — the window with the highest used percent, because that is what blocks work.`})]}),pe&&s.data&&!s.data.available?(0,H.jsxs)(`p`,{className:V.muted,children:[s.data.reason,` `,en]}):null,D?.collectorNote?(0,H.jsx)(`p`,{className:V.muted,children:D.collectorNote}):null,P.length>0?(0,H.jsx)(`ul`,{className:V.noteList,children:P.map(e=>(0,H.jsx)(`li`,{className:V.muted,children:e},e))}):null,j.length===0&&N===null?(0,H.jsx)(`p`,{className:V.muted,children:`No accounts and no local runtime were reported. Connect an account or start Ollama, then refresh — this is an empty roster, not a set of accounts at zero.`}):(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(`div`,{className:V.cards,children:F.map(e=>{if(e.kind!==`account`)return(0,H.jsx)(Dt,{card:e.card,staleness:me},e.key);let t=n===e.key;return(0,H.jsxs)(E.Fragment,{children:[(0,H.jsx)(Se,{card:e.card,onOpen:L,expanded:t,triggerId:`verse-account-trigger-${e.key}`,detailId:`verse-account-detail-${e.key}`}),t?(0,H.jsx)(`div`,{id:`verse-account-detail-${e.key}`,style:on,children:(0,H.jsx)(Te,{card:e.card,headingId:`verse-account-heading-${e.key}`,onClose:R})}):null]},e.key)})})})]}),(0,H.jsx)(kt,{view:M}),(0,H.jsx)(Ft,{series:k,window:e,onWindowChange:t,unavailableReason:f.data&&!f.data.available?f.data.reason:null,loading:f.status===`loading`||f.status===`idle`}),(0,H.jsx)(Ye,{rows:z,unavailableReason:B}),U?(0,H.jsx)(ht,{split:U,savingsNote:et}):(0,H.jsxs)(`section`,{className:V.panel,"aria-labelledby":`verse-usage-split-missing`,children:[(0,H.jsx)(`div`,{className:V.panelHead,children:(0,H.jsx)(`h3`,{id:`verse-usage-split-missing`,className:V.panelTitle,children:`Local vs cloud`})}),(0,H.jsx)(`div`,{className:V.tiles,children:(0,H.jsx)(_,{label:`Not spent (ran locally)`,value:(0,H.jsx)(`span`,{className:V.num,children:`unknown`}),caption:`/api/control did not answer, so the split is unavailable`})})]}),(0,H.jsx)(Ze,{rows:be,capsNote:A.available?null:A.reason}),(0,H.jsx)(Lt,{series:xe,todaySpentUsd:Ce,todaySpentDate:we,dailyBudgetUsd:A.dailyBudgetUsd,showSeries:k===null}),A.available&&A.subscriptionMaxPercent!==null?(0,H.jsxs)(`p`,{className:V.muted,children:[`Subscription throttle threshold is`,` `,(0,H.jsx)(`span`,{className:V.num,children:d(A.subscriptionMaxPercent/100)}),`. It only applies to engines that publish a real window reading — no seat is ever throttled on a guess.`]}):null]})})]})}export{cn as UsageSection};
|
|
2
|
+
//# sourceMappingURL=UsageSection-PaaJ1L90.js.map
|