quotacap 0.0.57 → 0.0.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +1 -1
  2. package/dist/adapters/muse.d.ts +1 -1
  3. package/dist/adapters/muse.js +5 -3
  4. package/dist/advisory/engine.js +9 -5
  5. package/dist/advisory/snapshot.js +10 -11
  6. package/dist/cli/advise.d.ts +1 -1
  7. package/dist/cli/advise.js +9 -4
  8. package/dist/cli/models.js +2 -2
  9. package/dist/cli/status.js +2 -2
  10. package/dist/format/markdown.d.ts +1 -1
  11. package/dist/format/markdown.js +11 -8
  12. package/dist/format/rate-limit-wait.d.ts +38 -0
  13. package/dist/format/rate-limit-wait.js +86 -0
  14. package/dist/format/rows.d.ts +46 -6
  15. package/dist/format/rows.js +50 -42
  16. package/dist/format/terminal.d.ts +1 -1
  17. package/dist/format/terminal.js +28 -14
  18. package/dist/format/time.d.ts +19 -0
  19. package/dist/format/time.js +69 -0
  20. package/dist/mcp/server.d.ts +25 -5
  21. package/dist/mcp/server.js +38 -4
  22. package/dist/store/quotas.d.ts +7 -2
  23. package/dist/store/quotas.js +94 -15
  24. package/dist/version.js +1 -1
  25. package/dist/web/src/components/AdviceDrawer.d.ts +3 -1
  26. package/dist/web/src/components/AdviceDrawer.js +25 -4
  27. package/dist/web/src/components/ClosedWeeks.d.ts +4 -1
  28. package/dist/web/src/components/ClosedWeeks.js +17 -5
  29. package/dist/web/src/components/PaceBar.d.ts +26 -25
  30. package/dist/web/src/components/PaceBar.js +57 -119
  31. package/dist/web/src/components/PacingLegend.js +9 -8
  32. package/dist/web/src/components/ProviderCard.js +2 -1
  33. package/dist/web/src/components/ProviderDrawer.d.ts +9 -2
  34. package/dist/web/src/components/ProviderDrawer.js +38 -27
  35. package/dist/web/src/components/ProviderRow.js +2 -1
  36. package/dist/web/src/components/RateLimitNote.d.ts +7 -0
  37. package/dist/web/src/components/RateLimitNote.js +11 -0
  38. package/dist/web/src/components/Recommendation.d.ts +4 -3
  39. package/dist/web/src/components/Recommendation.js +11 -7
  40. package/dist/web/src/components/ResetRail.d.ts +2 -0
  41. package/dist/web/src/components/ResetRail.js +15 -5
  42. package/dist/web/src/components/WindowsRow.d.ts +2 -2
  43. package/dist/web/src/components/WindowsRow.js +3 -13
  44. package/dist/web/src/components/settings/ProvidersPanel.d.ts +3 -2
  45. package/dist/web/src/components/settings/ProvidersPanel.js +4 -1
  46. package/dist/web/src/pages/Onboarding.js +1 -1
  47. package/dist/web/src/state.d.ts +5 -0
  48. package/dist/web/src/state.js +18 -0
  49. package/dist/webAssets.js +1 -1
  50. package/dist/webHtml.js +1 -1
  51. package/package.json +1 -1
  52. package/web/dist/assets/index-DQ2jUHo6.js +13 -0
  53. package/web/dist/assets/index-DSNVHbgI.css +1 -0
  54. package/web/dist/index.html +2 -2
  55. package/web/dist/assets/index-BFBVZ1r_.js +0 -13
  56. package/web/dist/assets/index-Co33DTl5.css +0 -1
@@ -1,9 +1,24 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useRef } from "react";
3
3
  import { quotaResetsAt, quotaUsedPct, timeLeft } from "./PaceBar.js";
4
+ import { clockText } from "../../../src/format/time.js";
4
5
  import { ProviderIcon, providerTint } from "./ProviderIcon.js";
5
6
  import { lanesFor } from "./Recommendation.js";
6
7
  import { CopyButton } from "./CopyButton.js";
8
+ /** Names the rate the forecast is priced at, matching the engine's blend inputs. */
9
+ export function forecastBasisWords(advisory) {
10
+ if (!advisory)
11
+ return "forecast pace";
12
+ const recent = advisory.recentRate ?? null;
13
+ const baseline = advisory.baselineRate ?? null;
14
+ if (recent !== null && baseline !== null)
15
+ return "24h pace blended with history";
16
+ if (recent !== null || advisory.paceSource === "recent")
17
+ return "24h pace";
18
+ if (advisory.paceSource === "window-average")
19
+ return "window-average pace";
20
+ return "forecast pace";
21
+ }
7
22
  export function AdviceDrawer({ open, recommendation, providers, asOf, onClose, onSelectProvider, }) {
8
23
  const dialogRef = useRef(null);
9
24
  const previouslyFocused = useRef(null);
@@ -55,7 +70,7 @@ export function AdviceDrawer({ open, recommendation, providers, asOf, onClose, o
55
70
  : null;
56
71
  // A monthly-bound pick's leftover is unusable until the month resets, so
57
72
  // the weekly expiry sentence would restate issue 109; show the reason.
58
- const monthlyBound = recommendation.bindingWindow === "monthly";
73
+ const monthlyBound = recommendation.bindingWindow === "monthly" || pick?.advisory?.bindingWindow === "monthly";
59
74
  const waste = monthlyBound
60
75
  ? null
61
76
  : recommendation.wastePct !== null
@@ -65,14 +80,20 @@ export function AdviceDrawer({ open, recommendation, providers, asOf, onClose, o
65
80
  : null;
66
81
  const pickReset = pick ? quotaResetsAt(pick) : null;
67
82
  const left = pickReset ? timeLeft(pickReset, asOfMs) : null;
68
- const basis = pick?.advisory?.paceSource === "window-average" ? "window-average pace" : "current 24h pace";
83
+ const pickClock = clockText(pickReset, asOfMs);
84
+ const basis = forecastBasisWords(pick?.advisory);
69
85
  const othersMore = useMore.filter((a) => a.provider !== pickId);
70
86
  const titleId = "advice-drawer-title";
71
- return (_jsxs(_Fragment, { children: [_jsx("div", { "data-testid": "advice-scrim", className: "scrim is-open", "aria-hidden": "true", onClick: onClose }), _jsxs("aside", { ref: dialogRef, tabIndex: -1, "data-testid": "advice-drawer", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, className: "drawer is-open", onClick: (e) => e.stopPropagation(), children: [_jsxs("div", { className: "drawer-head", children: [_jsx("span", { className: "picon rec-picon", "aria-hidden": "true", children: _jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("path", { d: "m12 3-1.9 5.8a2 2 0 0 1-1.3 1.3L3 12l5.8 1.9a2 2 0 0 1 1.3 1.3L12 21l1.9-5.8a2 2 0 0 1 1.3-1.3L21 12l-5.8-1.9a2 2 0 0 1-1.3-1.3z" }) }) }), _jsxs("div", { style: { flex: 1 }, children: [_jsx("h2", { id: titleId, children: "Quota Advice & Pacing" }), _jsx("span", { className: "sub", children: "Which quota to burn next, and why" })] }), _jsx("button", { className: "drawer-close", type: "button", "aria-label": "Close advice", onClick: onClose, children: _jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", "aria-hidden": "true", children: _jsx("path", { d: "M6 6l12 12M18 6L6 18" }) }) })] }), _jsxs("div", { className: "dsec", children: [_jsx("h3", { children: "Recommended for next session" }), pick && pickName ? (_jsxs("div", { className: "advice-card", style: { marginTop: 8 }, children: [_jsxs("div", { className: "advice-card-main", children: [_jsxs("div", { className: "advice-card-lead", children: [_jsx("span", { className: "sq", style: providerTint(pick.id), children: _jsx(ProviderIcon, { id: pick.id, title: pickName, size: 16 }) }), _jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [_jsx("span", { className: "name", children: pickName }), _jsxs("span", { className: "recommended-badge", children: [_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "m12 3-1.9 5.8a2 2 0 0 1-1.3 1.3L3 12l5.8 1.9a2 2 0 0 1 1.3 1.3L12 21l1.9-5.8a2 2 0 0 1 1.3-1.3L21 12l-5.8-1.9a2 2 0 0 1-1.3-1.3z" }) }), "Recommended"] })] })] }), waste !== null && left && (_jsxs("div", { className: "advice-card-stats", children: [_jsxs("b", { children: [waste, "%"] }), " unused quota expires in ", _jsx("b", { children: left })] }))] }), _jsx("p", { className: "advice-card-body", children: remaining !== null && left && !monthlyBound ? (_jsxs(_Fragment, { children: [_jsx("b", { children: pickName }), " has ", remaining, "% quota remaining with ", left, " to reset, forecast at the ", basis, "."] })) : (recommendation.reason) }), onSelectProvider && (_jsx("div", { children: _jsxs("button", { type: "button", className: "goto-link", onClick: () => onSelectProvider(pick.id), children: ["View ", pickName, " details \u2192"] }) }))] })) : (_jsx("p", { className: "advice-card-body", children: recommendation.reason }))] }), _jsxs("div", { className: "dsec", children: [_jsx("h3", { children: "Fleet Pacing Breakdown" }), _jsxs("dl", { className: "lane-group", children: [_jsxs("dt", { className: "um", children: [_jsx("span", { "aria-hidden": "true", children: "\u2191" }), " Use more"] }), _jsx("dd", { children: othersMore.length
87
+ return (_jsxs(_Fragment, { children: [_jsx("div", { "data-testid": "advice-scrim", className: "scrim is-open", "aria-hidden": "true", onClick: onClose }), _jsxs("aside", { ref: dialogRef, tabIndex: -1, "data-testid": "advice-drawer", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, className: "drawer is-open", onClick: (e) => e.stopPropagation(), children: [_jsxs("div", { className: "drawer-head", children: [_jsx("span", { className: "picon rec-picon", "aria-hidden": "true", children: _jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("path", { d: "m12 3-1.9 5.8a2 2 0 0 1-1.3 1.3L3 12l5.8 1.9a2 2 0 0 1 1.3 1.3L12 21l1.9-5.8a2 2 0 0 1 1.3-1.3L21 12l-5.8-1.9a2 2 0 0 1-1.3-1.3z" }) }) }), _jsxs("div", { style: { flex: 1 }, children: [_jsx("h2", { id: titleId, children: "Quota Advice & Pacing" }), _jsx("span", { className: "sub", children: "Which quota to burn next, and why" })] }), _jsx("button", { className: "drawer-close", type: "button", "aria-label": "Close advice", onClick: onClose, children: _jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", "aria-hidden": "true", children: _jsx("path", { d: "M6 6l12 12M18 6L6 18" }) }) })] }), _jsxs("div", { className: "dsec", children: [_jsx("h3", { children: "Recommended for next session" }), pick && pickName ? (_jsxs("div", { className: "advice-card", style: { marginTop: 8 }, children: [_jsxs("div", { className: "advice-card-main", children: [_jsxs("div", { className: "advice-card-lead", children: [_jsx("span", { className: "sq", style: providerTint(pick.id), children: _jsx(ProviderIcon, { id: pick.id, title: pickName, size: 16 }) }), _jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [_jsx("span", { className: "name", children: pickName }), _jsxs("span", { className: "recommended-badge", children: [_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "m12 3-1.9 5.8a2 2 0 0 1-1.3 1.3L3 12l5.8 1.9a2 2 0 0 1 1.3 1.3L12 21l1.9-5.8a2 2 0 0 1 1.3-1.3L21 12l-5.8-1.9a2 2 0 0 1-1.3-1.3z" }) }), "Recommended"] })] })] }), waste !== null && left && (_jsxs("div", { className: "advice-card-stats", children: [_jsxs("b", { children: [waste, "%"] }), " unused at reset", pickClock ? _jsxs(_Fragment, { children: [" (", _jsx("b", { children: pickClock }), ")"] }) : null] }))] }), _jsx("p", { className: "advice-card-body", children: remaining !== null && left && !monthlyBound ? (_jsxs(_Fragment, { children: [_jsx("b", { children: pickName }), " has ", remaining, "% quota remaining with ", left, " to reset, forecast at the ", basis, "."] })) : (recommendation.reason) }), onSelectProvider && (_jsx("div", { children: _jsxs("button", { type: "button", className: "goto-link", onClick: () => onSelectProvider(pick.id), children: ["View ", pickName, " details \u2192"] }) }))] })) : (_jsx("p", { className: "advice-card-body", children: recommendation.reason }))] }), _jsxs("div", { className: "dsec", children: [_jsx("h3", { children: "Fleet Pacing Breakdown" }), _jsxs("dl", { className: "lane-group", children: [_jsxs("dt", { className: "um", children: [_jsx("span", { "aria-hidden": "true", children: "\u2191" }), " Use more"] }), _jsx("dd", { children: othersMore.length
72
88
  ? othersMore.map((a) => {
73
89
  const p = providers.find((x) => x.id === a.provider);
74
90
  const name = p?.displayName ?? a.provider;
75
- const unused = a.wastePct !== null ? `${Math.round(a.wastePct)}% unused` : null;
91
+ // A month-bound row reads the month, like its card.
92
+ const unused = a.bindingWindow === "monthly"
93
+ ? `${Math.round(a.bindingRemaining)}% of month left`
94
+ : a.wastePct !== null
95
+ ? `${Math.round(a.wastePct)}% unused at reset`
96
+ : null;
76
97
  const resetIso = p ? quotaResetsAt(p) : null;
77
98
  const t = resetIso ? timeLeft(resetIso, asOfMs) : null;
78
99
  const meta = [unused, t ? `resets in ${t}` : null].filter(Boolean).join(" · ");
@@ -5,12 +5,15 @@ export declare function lastClose(provider: {
5
5
  }): WindowCloseView | null;
6
6
  export declare function closeDateLabel(resetsAt: string | null): string | null;
7
7
  export declare function closeIsStale(c: WindowCloseView): boolean;
8
+ /** Milliseconds the provider reset ahead of schedule, or null for an on-schedule close. */
9
+ export declare function closeResetEarlyMs(c: WindowCloseView): number | null;
8
10
  export declare function closeSampleStamp(sampledAt: string): string | null;
9
11
  export declare function closeResetStamp(resetsAt: string): string | null;
10
12
  /** Bar chart of closed quota windows, oldest left. The solid segment is
11
13
  * used at close, the hatched cap is the stored leftover; a cap under 3% is
12
14
  * label-only. One bar per real close, never a placeholder. Stale samples
13
- * name their earliness on the label; exact stamps stay in the tooltip. */
15
+ * name their earliness on the label; a provider's early reset is dated when
16
+ * it was seen and named as a reset; exact stamps stay in the tooltip. */
14
17
  export declare function ClosedWeeks({ closes, windowName, }: {
15
18
  closes: WindowCloseView[];
16
19
  windowName?: "Weekly" | "Monthly";
@@ -1,6 +1,8 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { format } from "date-fns";
3
3
  const STALE_EARLY_MS = 15 * 60 * 1000;
4
+ // A drop seen this long before the scheduled reset means the provider reset early.
5
+ const EARLY_RESET_MS = 60 * 60 * 1000;
4
6
  export function lastClose(provider) {
5
7
  const closes = provider.lastCloses;
6
8
  return Array.isArray(closes) && closes.length > 0 ? closes[0] : null;
@@ -22,6 +24,13 @@ export function closeIsStale(c) {
22
24
  return true;
23
25
  return resetMs - sampledMs > STALE_EARLY_MS;
24
26
  }
27
+ /** Milliseconds the provider reset ahead of schedule, or null for an on-schedule close. */
28
+ export function closeResetEarlyMs(c) {
29
+ if (c.resetsAtEstimated || !c.resetsAt)
30
+ return null;
31
+ const early = Date.parse(c.resetsAt) - Date.parse(c.detectedAt);
32
+ return Number.isFinite(early) && early > EARLY_RESET_MS ? early : null;
33
+ }
25
34
  export function closeSampleStamp(sampledAt) {
26
35
  const ms = Date.parse(sampledAt);
27
36
  if (!Number.isFinite(ms))
@@ -63,16 +72,18 @@ function earlyWords(ms) {
63
72
  /** Bar chart of closed quota windows, oldest left. The solid segment is
64
73
  * used at close, the hatched cap is the stored leftover; a cap under 3% is
65
74
  * label-only. One bar per real close, never a placeholder. Stale samples
66
- * name their earliness on the label; exact stamps stay in the tooltip. */
75
+ * name their earliness on the label; a provider's early reset is dated when
76
+ * it was seen and named as a reset; exact stamps stay in the tooltip. */
67
77
  export function ClosedWeeks({ closes, windowName, }) {
68
78
  if (!Array.isArray(closes) || closes.length === 0)
69
79
  return null;
70
80
  const cells = [...closes].reverse();
71
- const labels = cells.map((c) => closeDateLabel(c.resetsAt));
81
+ const labels = cells.map((c) => closeDateLabel(closeResetEarlyMs(c) !== null ? c.detectedAt : c.resetsAt));
72
82
  return (_jsxs("section", { className: "dsec", "aria-label": "History", children: [windowName ? (_jsxs("div", { className: "burn-head", children: [_jsx("h3", { children: "History" }), _jsxs("span", { className: "burn-win", children: [windowName, " quota window"] })] })) : (_jsx("h3", { children: "History" })), _jsxs("div", { className: "hchart", "data-testid": "closed-weeks", children: [_jsx("div", { className: "hgrid", children: _jsx("span", { children: "100%" }) }), cells.map((c, i) => {
73
83
  const used = Math.min(100, Math.max(0, c.usedPct));
74
84
  const leftover = Math.min(100, Math.max(0, c.leftoverPct));
75
- const stale = closeIsStale(c);
85
+ const resetEarlyMs = closeResetEarlyMs(c);
86
+ const stale = resetEarlyMs === null && closeIsStale(c);
76
87
  const sampled = closeSampleStamp(c.sampledAt);
77
88
  const reset = c.resetsAt ? closeResetStamp(c.resetsAt) : null;
78
89
  const earlyMs = c.resetsAt ? Date.parse(c.resetsAt) - Date.parse(c.sampledAt) : NaN;
@@ -80,11 +91,12 @@ export function ClosedWeeks({ closes, windowName, }) {
80
91
  const title = [
81
92
  `${c.usedPct}% used`,
82
93
  `${c.leftoverPct}% leftover`,
83
- reset ? `reset ${reset}${est}` : "reset unknown",
94
+ resetEarlyMs !== null ? "provider reset early" : null,
95
+ reset ? `${resetEarlyMs !== null ? "scheduled reset" : "reset"} ${reset}${est}` : "reset unknown",
84
96
  stale && sampled ? `last reading ${sampled}` : null,
85
97
  ]
86
98
  .filter(Boolean)
87
99
  .join(", ");
88
- return (_jsxs("div", { className: "hcol", title: title, children: [_jsx("div", { className: "hbars", children: _jsxs("div", { className: "hbar", children: [leftover >= 3 && _jsx("span", { className: "hatch", style: { height: `${leftover}%` } }), _jsx("span", { className: "solid", style: { height: `${used}%` } })] }) }), _jsxs("div", { className: "hlab", children: [labels[i] ?? "date unknown", _jsxs("b", { children: [c.leftoverPct, "% leftover", est] }), stale && Number.isFinite(earlyMs) && earlyMs > 0 && _jsxs(_Fragment, { children: ["read ", earlyCompact(earlyMs), " early"] })] })] }, `${c.detectedAt}-${c.sampledAt}`));
100
+ return (_jsxs("div", { className: "hcol", title: title, children: [_jsx("div", { className: "hbars", children: _jsxs("div", { className: "hbar", children: [leftover >= 3 && _jsx("span", { className: "hatch", style: { height: `${leftover}%` } }), _jsx("span", { className: "solid", style: { height: `${used}%` } })] }) }), _jsxs("div", { className: "hlab", children: [labels[i] ?? "date unknown", _jsxs("b", { children: [c.leftoverPct, "% leftover", est] }), resetEarlyMs !== null && _jsxs(_Fragment, { children: ["reset ", earlyCompact(resetEarlyMs), " early"] }), stale && Number.isFinite(earlyMs) && earlyMs > 0 && _jsxs(_Fragment, { children: ["read ", earlyCompact(earlyMs), " early"] })] })] }, `${c.detectedAt}-${c.sampledAt}`));
89
101
  })] })] }));
90
102
  }
@@ -1,12 +1,10 @@
1
1
  import React from "react";
2
2
  import type { ExclusionReason, ProviderView } from "../state.js";
3
- export type PaceBadge = "Not reporting" | "Cap risk" | "Watch" | "Behind pace" | "Ahead of pace" | "On track" | "Measuring" | "Monthly exhausted" | "Quota exhausted";
3
+ import { type StateWord } from "../../../src/format/rows.js";
4
+ export type PaceBadge = StateWord;
4
5
  /**
5
- * Pace-state badge from the mapping table. Exclusion always wins; a blocked
6
- * month next; otherwise status "at risk" wins, then "watch", then "unknown";
7
- * on-track rows ahead of cumulative elapsed time read Ahead of pace,
8
- * except a finish inside the horizon tube, which stays On track;
9
- * otherwise urgency decides. No client thresholds.
6
+ * Pace-state badge: the CLI's state word, from the one mapping table in
7
+ * src/format/rows.ts, so the dashboard and the CLI never word a row apart.
10
8
  */
11
9
  export declare function paceBadge(provider: ProviderView): PaceBadge;
12
10
  /**
@@ -92,7 +90,7 @@ export declare function PaceStats({ provider, asOf }: {
92
90
  /** Hover explanations shared by cards and rows. Plain words, no jargon. */
93
91
  export declare const PACE_TIPS: {
94
92
  readonly avg: "Window average — quota used ÷ days elapsed. Your overall pace this window.";
95
- readonly recent: "Burn over the last 24 hours. Forecasts use this rate when recent readings exist.";
93
+ readonly recent: "Burn over the last 24 hours. Forecasts blend this rate with your history.";
96
94
  readonly ideal: "The even pace that lands exactly on 100% at reset: remaining ÷ days left.";
97
95
  };
98
96
  export interface PaceLine {
@@ -116,27 +114,20 @@ export declare function paceLines(advisory: {
116
114
  /** Plain-words reason shown beside "Not reporting". Null when the badge says it all. */
117
115
  export declare function exclusionDetail(reason: ExclusionReason): string | null;
118
116
  export declare function isEstimated(provider: ProviderView): boolean;
119
- /** Weekday plus 24h clock, e.g. "Thu 21:00". Null when unparseable. */
120
- export declare function resetClock(resetsAt: string, locale?: string): string | null;
121
- /** Weekday, calendar date and 24h clock, e.g. "Thu Oct 22 23:05". Monthly
122
- * resets sit weeks out, where resetClock's weekday-only reading ("Thu 23:05")
123
- * scans as this coming Thursday. Null when unparseable. */
124
- export declare function resetDateClock(resetsAt: string, locale?: string): string | null;
125
- /** Short weekday plus calendar date in the locked English copy, e.g.
126
- * "Tue Sep 15". Mirrors dayOf in src/format/rows.ts, including its pinned
127
- * en-US locale, so the CLI and the dashboard word the same sentence
128
- * identically on any machine. */
117
+ /** Weekday plus 24h clock, e.g. "Thu 21:00": the shared clock's within-a-week form. Null when unparseable. */
118
+ export declare function resetClock(resetsAt: string): string | null;
119
+ /** Weekday, calendar date and 24h clock, e.g. "Thu 22 Oct 23:05": the shared
120
+ * clock's dated form. Monthly resets sit weeks out, where the weekday alone
121
+ * ("Thu 23:05") scans as this coming Thursday. Null when unparseable. */
122
+ export declare function resetDateClock(resetsAt: string): string | null;
123
+ /** Short weekday plus calendar date, e.g. "Tue 15 Sep". Same helper as the
124
+ * CLI's dayOf in src/format/rows.ts, so both word the sentence identically. */
129
125
  export declare function resetDay(iso: string | undefined): string;
130
- /** "6d 12h" style time left from server timestamps. Null when unparseable. */
126
+ /** "6d 12h" style time left from server timestamps, floored. Null when unparseable or passed. */
131
127
  export declare function timeLeft(resetsAt: string, asOfMs: number): string | null;
132
- /**
133
- * Days-to-duration formatter mirroring timeLeft: under 1h `Xm`, under 48h
134
- * `Xh Ym`, at 48h+ `Xd Xh`. Hours in the days branch round to the nearest
135
- * hour so 2.4d reads "2d 10h".
136
- */
128
+ /** Fractional days in the same floored form as timeLeft. */
137
129
  export declare function daysToDuration(days: number): string;
138
130
  export declare const formatDurationDays: typeof daysToDuration;
139
- export declare const durationFromDays: typeof daysToDuration;
140
131
  /**
141
132
  * Reset rendering for a row. Estimated resets carry "(est.)"; reset-passed
142
133
  * rows await a fresh window; invalid rows carry a row-level note.
@@ -194,7 +185,7 @@ export interface PaceHeadline {
194
185
  export declare function isQuotaExhaustedBeforeReset(provider: ProviderView, asOfMs?: number): boolean;
195
186
  /**
196
187
  * Headline forecast shared by the card bar and the drawer quota row:
197
- * "expires unused" wording when a waste hatch applies, otherwise the
188
+ * "unused at reset" wording when a waste hatch applies, otherwise the
198
189
  * one-line forecast. Null when there is nothing to forecast.
199
190
  */
200
191
  export declare function paceHeadline(provider: ProviderView, asOfMs?: number): PaceHeadline | null;
@@ -207,5 +198,15 @@ export declare function PaceBar({ provider, asOf, showHeadline, }: {
207
198
  asOf: string;
208
199
  showHeadline?: boolean;
209
200
  }): React.JSX.Element;
201
+ /**
202
+ * The shared waste sentence against the quota reset, e.g. "16% unused at
203
+ * reset (Fri 13:14)". The clock form is judged from the reading's own time,
204
+ * as the CLI judges it from its clock, so both pick the same form.
205
+ */
206
+ export declare function unusedLine(provider: ProviderView, wastePct: number): string;
207
+ /** Shared with src/format/rows.ts so the CLI and the dashboard agree. */
208
+ export declare const LANDS_NEAR_FULL = "Lands near 100% at reset";
209
+ /** On track by forecast, yet the faster 24h pace spends the remainder (waste 0). */
210
+ export declare const NO_SPARE = "No spare quota at 24h pace";
210
211
  /** One-line forecast from server fields. Unknown pace shows no rate or waste. */
211
212
  export declare function forecastLine(provider: ProviderView): string | null;
@@ -1,46 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ageDuration } from "../state.js";
3
+ import { stateWord } from "../../../src/format/rows.js";
4
+ import { clockText, dayText, durationFromDays, durationText, unusedAtReset } from "../../../src/format/time.js";
3
5
  /**
4
- * Pace-state badge from the mapping table. Exclusion always wins; a blocked
5
- * month next; otherwise status "at risk" wins, then "watch", then "unknown";
6
- * on-track rows ahead of cumulative elapsed time read Ahead of pace,
7
- * except a finish inside the horizon tube, which stays On track;
8
- * otherwise urgency decides. No client thresholds.
6
+ * Pace-state badge: the CLI's state word, from the one mapping table in
7
+ * src/format/rows.ts, so the dashboard and the CLI never word a row apart.
9
8
  */
10
9
  export function paceBadge(provider) {
11
- if (provider.exclusionReason !== null)
12
- return "Not reporting";
13
- const advisory = provider.advisory;
14
- if (!advisory)
15
- return "Not reporting";
16
- if (advisory.bindingWindow === "monthly" && advisory.bindingRemaining === 0)
17
- return "Monthly exhausted";
18
- const quotaUsed = quotaUsedPct(provider);
19
- const isExhausted = (typeof advisory.bindingRemaining === "number" && advisory.bindingRemaining <= 0) ||
20
- (typeof advisory.remaining === "number" && advisory.remaining <= 0) ||
21
- (quotaUsed !== null && quotaUsed >= 100);
22
- if (isExhausted)
23
- return "Quota exhausted";
24
- if (advisory.status === "at risk")
25
- return "Cap risk";
26
- if (advisory.status === "watch")
27
- return "Watch";
28
- if (advisory.status === "unknown")
29
- return "Measuring";
30
- if (advisory.status === "on track" && advisory.closeToReset === true)
31
- return "On track";
32
- if (advisory.aheadOfElapsed === true)
33
- return "Ahead of pace";
34
- switch (advisory.urgency) {
35
- case "burn now":
36
- case "use soon":
37
- case "save":
38
- return "Behind pace";
39
- case "slow down":
40
- return "Ahead of pace";
41
- case "on track":
42
- return "On track";
43
- }
10
+ return stateWord(provider);
44
11
  }
45
12
  /**
46
13
  * Quota-window resolution. The advisory `bindingWindow` names the window
@@ -114,6 +81,11 @@ export function quotaElapsedPct(provider, asOfMs) {
114
81
  return null;
115
82
  return Math.min(100, Math.max(0, ((asOfMs - startMs) / (resetMs - startMs)) * 100));
116
83
  }
84
+ /** True when the quota window has nothing left: the ideal pace is then meaningless. */
85
+ function paceExhausted(advisory) {
86
+ return ((typeof advisory.remaining === "number" && advisory.remaining <= 0) ||
87
+ (typeof advisory.bindingRemaining === "number" && advisory.bindingRemaining <= 0));
88
+ }
117
89
  /** Even pace that lands on 100% at the quota reset: binding remaining ÷ binding days left. */
118
90
  export function quotaIdealRate(advisory) {
119
91
  if (advisory.bindingWindow === "monthly" &&
@@ -203,7 +175,8 @@ export function PaceStats({ provider, asOf }) {
203
175
  // is not tracked), so a monthly-bound grid reads "—" there.
204
176
  const avg = quotaAvgPace(provider, asOfMs);
205
177
  const pace = paceCells(provider.advisory);
206
- const ideal = advisory ? `${quotaIdealRate(advisory).toFixed(1)}%/day` : "—";
178
+ // A used-up quota has no pace to aim for until it resets.
179
+ const ideal = advisory && !paceExhausted(advisory) ? `${quotaIdealRate(advisory).toFixed(1)}%/day` : "—";
207
180
  const resetIso = quotaResetsAt(provider);
208
181
  const resetsIn = resetIso ? timeLeft(resetIso, asOfMs) : null;
209
182
  return (_jsxs("div", { className: "pstats", children: [_jsxs("div", { title: PACE_TIPS.avg, children: [_jsx("span", { className: "l", children: "Avg pace" }), _jsx("span", { className: "v", children: avg !== null ? `${avg.toFixed(1)}%/day` : "—" })] }), _jsxs("div", { title: PACE_TIPS.recent, children: [_jsx("span", { className: "l", children: "24h pace" }), _jsx("span", { className: "v", children: monthly ? "—" : pace.recent })] }), _jsxs("div", { title: PACE_TIPS.ideal, children: [_jsx("span", { className: "l", children: "Ideal pace" }), _jsx("span", { className: "v", children: ideal })] }), _jsxs("div", { children: [_jsx("span", { className: "l", children: "Resets in" }), _jsx("span", { className: "v", children: resetsIn ? `${resetsIn}${quotaResetEstimated(provider) ? " (est.)" : ""}` : resetCountdown(provider, asOfMs) })] })] }));
@@ -211,7 +184,7 @@ export function PaceStats({ provider, asOf }) {
211
184
  /** Hover explanations shared by cards and rows. Plain words, no jargon. */
212
185
  export const PACE_TIPS = {
213
186
  avg: "Window average — quota used ÷ days elapsed. Your overall pace this window.",
214
- recent: "Burn over the last 24 hours. Forecasts use this rate when recent readings exist.",
187
+ recent: "Burn over the last 24 hours. Forecasts blend this rate with your history.",
215
188
  ideal: "The even pace that lands exactly on 100% at reset: remaining ÷ days left.",
216
189
  };
217
190
  /** Table-row pace stack: one labeled line per known pace plus the needed
@@ -231,7 +204,8 @@ export function paceLines(advisory, provider, asOfMs) {
231
204
  lines.push({ label: "Avg", value: `${avg.toFixed(1)}%/day`, tip: PACE_TIPS.avg });
232
205
  if (!monthly && recent !== null)
233
206
  lines.push({ label: "24h", value: `${recent.toFixed(1)}%/day`, tip: PACE_TIPS.recent });
234
- lines.push({ label: "Ideal", value: `${ideal.toFixed(1)}%/day`, tip: PACE_TIPS.ideal });
207
+ if (!paceExhausted(advisory))
208
+ lines.push({ label: "Ideal", value: `${ideal.toFixed(1)}%/day`, tip: PACE_TIPS.ideal });
235
209
  return lines;
236
210
  }
237
211
  /** Plain-words reason shown beside "Not reporting". Null when the badge says it all. */
@@ -253,46 +227,23 @@ export function exclusionDetail(reason) {
253
227
  export function isEstimated(provider) {
254
228
  return provider.evidence.includes("estimated-reset");
255
229
  }
256
- /** Weekday plus 24h clock, e.g. "Thu 21:00". Null when unparseable. */
257
- export function resetClock(resetsAt, locale) {
258
- const ms = Date.parse(resetsAt);
259
- if (!Number.isFinite(ms))
260
- return null;
261
- const when = new Date(ms);
262
- const day = when.toLocaleDateString(locale, { weekday: "short" });
263
- const time = when.toLocaleTimeString(locale, {
264
- hour: "2-digit",
265
- minute: "2-digit",
266
- hour12: false,
267
- });
268
- return `${day} ${time}`;
269
- }
270
- /** Weekday, calendar date and 24h clock, e.g. "Thu Oct 22 23:05". Monthly
271
- * resets sit weeks out, where resetClock's weekday-only reading ("Thu 23:05")
272
- * scans as this coming Thursday. Null when unparseable. */
273
- export function resetDateClock(resetsAt, locale) {
230
+ /** Weekday plus 24h clock, e.g. "Thu 21:00": the shared clock's within-a-week form. Null when unparseable. */
231
+ export function resetClock(resetsAt) {
274
232
  const ms = Date.parse(resetsAt);
275
- if (!Number.isFinite(ms))
276
- return null;
277
- const when = new Date(ms);
278
- const day = when.toLocaleDateString(locale, { weekday: "short" });
279
- const date = when.toLocaleDateString(locale, { day: "numeric", month: "short" });
280
- const time = when.toLocaleTimeString(locale, {
281
- hour: "2-digit",
282
- minute: "2-digit",
283
- hour12: false,
284
- });
285
- return `${day} ${date} ${time}`;
286
- }
287
- /** Short weekday plus calendar date in the locked English copy, e.g.
288
- * "Tue Sep 15". Mirrors dayOf in src/format/rows.ts, including its pinned
289
- * en-US locale, so the CLI and the dashboard word the same sentence
290
- * identically on any machine. */
233
+ return Number.isFinite(ms) ? clockText(resetsAt, ms) : null;
234
+ }
235
+ /** Weekday, calendar date and 24h clock, e.g. "Thu 22 Oct 23:05": the shared
236
+ * clock's dated form. Monthly resets sit weeks out, where the weekday alone
237
+ * ("Thu 23:05") scans as this coming Thursday. Null when unparseable. */
238
+ export function resetDateClock(resetsAt) {
239
+ return clockText(resetsAt);
240
+ }
241
+ /** Short weekday plus calendar date, e.g. "Tue 15 Sep". Same helper as the
242
+ * CLI's dayOf in src/format/rows.ts, so both word the sentence identically. */
291
243
  export function resetDay(iso) {
292
- const when = new Date(iso ?? "");
293
- return `${when.toLocaleDateString("en-US", { weekday: "short" })} ${when.toLocaleDateString("en-US", { day: "numeric", month: "short" })}`;
244
+ return dayText(iso);
294
245
  }
295
- /** "6d 12h" style time left from server timestamps. Null when unparseable. */
246
+ /** "6d 12h" style time left from server timestamps, floored. Null when unparseable or passed. */
296
247
  export function timeLeft(resetsAt, asOfMs) {
297
248
  const resetMs = Date.parse(resetsAt);
298
249
  if (!Number.isFinite(resetMs) || !Number.isFinite(asOfMs))
@@ -300,43 +251,13 @@ export function timeLeft(resetsAt, asOfMs) {
300
251
  const diffMs = resetMs - asOfMs;
301
252
  if (diffMs <= 0)
302
253
  return null;
303
- const totalMinutes = Math.floor(diffMs / 60_000);
304
- const days = Math.floor(totalMinutes / (24 * 60));
305
- const hours = Math.floor((totalMinutes % (24 * 60)) / 60);
306
- const minutes = totalMinutes % 60;
307
- if (days >= 1)
308
- return `${days}d ${hours}h`;
309
- if (hours >= 1)
310
- return `${hours}h ${minutes}m`;
311
- return `${Math.max(1, minutes)}m`;
254
+ return durationText(diffMs);
312
255
  }
313
- /**
314
- * Days-to-duration formatter mirroring timeLeft: under 1h `Xm`, under 48h
315
- * `Xh Ym`, at 48h+ `Xd Xh`. Hours in the days branch round to the nearest
316
- * hour so 2.4d reads "2d 10h".
317
- */
256
+ /** Fractional days in the same floored form as timeLeft. */
318
257
  export function daysToDuration(days) {
319
- if (!Number.isFinite(days) || days <= 0)
320
- return "0m";
321
- const totalMinutes = Math.round(days * 24 * 60);
322
- if (totalMinutes < 60)
323
- return `${Math.max(1, totalMinutes)}m`;
324
- if (totalMinutes < 48 * 60) {
325
- const hours = Math.floor(totalMinutes / 60);
326
- const minutes = totalMinutes % 60;
327
- return `${hours}h ${minutes}m`;
328
- }
329
- let d = Math.floor(totalMinutes / (24 * 60));
330
- const remainderMinutes = totalMinutes - d * 24 * 60;
331
- let h = Math.round(remainderMinutes / 60);
332
- if (h === 24) {
333
- d += 1;
334
- h = 0;
335
- }
336
- return `${d}d ${h}h`;
258
+ return durationFromDays(days);
337
259
  }
338
260
  export const formatDurationDays = daysToDuration;
339
- export const durationFromDays = daysToDuration;
340
261
  /**
341
262
  * Reset rendering for a row. Estimated resets carry "(est.)"; reset-passed
342
263
  * rows await a fresh window; invalid rows carry a row-level note.
@@ -544,7 +465,7 @@ export function isQuotaExhaustedBeforeReset(provider, asOfMs) {
544
465
  }
545
466
  /**
546
467
  * Headline forecast shared by the card bar and the drawer quota row:
547
- * "expires unused" wording when a waste hatch applies, otherwise the
468
+ * "unused at reset" wording when a waste hatch applies, otherwise the
548
469
  * one-line forecast. Null when there is nothing to forecast.
549
470
  */
550
471
  export function paceHeadline(provider, asOfMs) {
@@ -561,7 +482,7 @@ export function paceHeadline(provider, asOfMs) {
561
482
  hatch: false,
562
483
  };
563
484
  }
564
- const text = hatch && badge === "Behind pace" ? `${Math.round(wastePct)}% expires unused` : forecastLine(provider);
485
+ const text = hatch && badge === "Behind pace" ? unusedLine(provider, wastePct) : forecastLine(provider);
565
486
  if (!text)
566
487
  return null;
567
488
  const kind = monthlyBinds
@@ -601,6 +522,19 @@ export function PaceBar({ provider, asOf, showHeadline = true, }) {
601
522
  left: `${elapsedPct}%`,
602
523
  } }))] }), _jsxs("div", { className: "tfoot", children: [_jsx("span", { children: "start" }), _jsx("span", { children: elapsedPct !== null ? `Time elapsed: ${Math.round(elapsedPct)}%` : "" }), _jsx("span", { children: "reset" })] })] }));
603
524
  }
525
+ /**
526
+ * The shared waste sentence against the quota reset, e.g. "16% unused at
527
+ * reset (Fri 13:14)". The clock form is judged from the reading's own time,
528
+ * as the CLI judges it from its clock, so both pick the same form.
529
+ */
530
+ export function unusedLine(provider, wastePct) {
531
+ const fetched = provider.quota?.fetchedAt ? Date.parse(provider.quota.fetchedAt) : NaN;
532
+ return unusedAtReset(wastePct, quotaResetsAt(provider), Number.isFinite(fetched) ? fetched : undefined);
533
+ }
534
+ /** Shared with src/format/rows.ts so the CLI and the dashboard agree. */
535
+ export const LANDS_NEAR_FULL = "Lands near 100% at reset";
536
+ /** On track by forecast, yet the faster 24h pace spends the remainder (waste 0). */
537
+ export const NO_SPARE = "No spare quota at 24h pace";
604
538
  /** One-line forecast from server fields. Unknown pace shows no rate or waste. */
605
539
  export function forecastLine(provider) {
606
540
  if (provider.exclusionReason === "not-reporting" || !provider.quota)
@@ -634,16 +568,20 @@ export function forecastLine(provider) {
634
568
  }
635
569
  if (advisory.status === "at risk") {
636
570
  return advisory.daysToExhaust !== null && Number.isFinite(advisory.daysToExhaust)
637
- ? `Cap risk · exhausts in ${daysToDuration(advisory.daysToExhaust)} at current pace`
638
- : "Cap risk at current pace";
571
+ ? `Cap risk · exhausts in ${daysToDuration(advisory.daysToExhaust)} at forecast pace`
572
+ : "Cap risk at forecast pace";
639
573
  }
640
574
  if (advisory.status === "watch") {
641
575
  return advisory.daysToExhaust !== null && Number.isFinite(advisory.daysToExhaust)
642
- ? `Watch · exhausts in ${daysToDuration(advisory.daysToExhaust)} at current pace`
643
- : "Watch at current pace";
576
+ ? `Watch · exhausts in ${daysToDuration(advisory.daysToExhaust)} at forecast pace`
577
+ : "Watch at forecast pace";
644
578
  }
645
- if (advisory.wastePct !== null) {
646
- return `${Math.round(advisory.wastePct)}% waste in ${daysToDuration(advisory.daysLeft)}`;
579
+ if (advisory.closeToReset === true)
580
+ return LANDS_NEAR_FULL;
581
+ if (advisory.wastePct !== null && Math.round(advisory.wastePct) >= 1) {
582
+ return unusedLine(provider, advisory.wastePct);
647
583
  }
584
+ if (advisory.wastePct !== null)
585
+ return NO_SPARE;
648
586
  return "On track.";
649
587
  }
@@ -1,14 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useRef, useState } from "react";
3
+ // What each badge means. Actions belong to the Use more / Ease off lanes.
3
4
  const STATES = [
4
- { label: "On track", cls: "pace-ontrack", meaning: "Burning at a rate the window sustains" },
5
- { label: "Behind pace", cls: "pace-behind", meaning: "Burning slow; risk of unused quota waste" },
6
- { label: "Ahead of pace", cls: "pace-ahead", meaning: "Burning faster than time; monitor usage" },
7
- { label: "Cap risk", cls: "pace-cap", meaning: "Will hit cap before reset window closes" },
8
- { label: "Quota exhausted", cls: "pace-cap", meaning: "Quota is 100% consumed until next reset" },
9
- { label: "Watch", cls: "pace-watch", meaning: "Pace points at the cap, but position or the reset clock is uncertain" },
10
- { label: "Measuring", cls: "pace-out", meaning: "Not enough data yet; pace appears after 6h" },
11
- { label: "Not reporting", cls: "pace-out", meaning: "No usable reading; excluded from ranking" },
5
+ { label: "On track", cls: "pace-ontrack", meaning: "The forecast lands at or near 100% at reset" },
6
+ { label: "Behind pace", cls: "pace-behind", meaning: "The forecast leaves quota unused at reset" },
7
+ { label: "Ahead of pace", cls: "pace-ahead", meaning: "More used than time elapsed; the forecast still reaches reset" },
8
+ { label: "Cap risk", cls: "pace-cap", meaning: "The forecast runs out well before reset, and usage is ahead of time" },
9
+ { label: "Quota exhausted", cls: "pace-cap", meaning: "Quota is 100% used until the next reset" },
10
+ { label: "Watch", cls: "pace-watch", meaning: "The forecast runs out near or before reset, or the reset time is estimated" },
11
+ { label: "Measuring", cls: "pace-out", meaning: "Under 6 hours of readings; no forecast yet" },
12
+ { label: "Not reporting", cls: "pace-out", meaning: "No usable reading; left out of the advice" },
12
13
  ];
13
14
  export function PacingLegend() {
14
15
  const [open, setOpen] = useState(false);
@@ -4,6 +4,7 @@ import { Badge, PaceBar, PaceStats, isMonthlyBound, quotaResetEstimated, quotaRe
4
4
  import { ProviderIcon, providerTint } from "./ProviderIcon.js";
5
5
  import { lastClose } from "./ClosedWeeks.js";
6
6
  import { WindowsRow } from "./WindowsRow.js";
7
+ import { RateLimitNote } from "./RateLimitNote.js";
7
8
  function resetsDate(provider) {
8
9
  const resetIso = quotaResetsAt(provider);
9
10
  if (!resetIso)
@@ -24,5 +25,5 @@ export function ProviderCard({ provider, recommended, asOf, onSelect, }) {
24
25
  e.preventDefault();
25
26
  onSelect(provider.id);
26
27
  }
27
- }, className: `pcard ${recommended ? "is-recommended is-top-pick" : ""}`, children: [_jsxs("div", { className: "pcard-head", children: [_jsx("span", { className: "picon", style: providerTint(provider.id), "aria-hidden": "true", children: _jsx(ProviderIcon, { id: provider.id, title: name }) }), _jsxs("div", { className: "who", children: [_jsxs("b", { children: [name, recommended && (_jsx("span", { className: "rec-icon", title: "Recommended for next session", role: "img", "aria-label": "recommended", children: _jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "m12 3-1.9 5.8a2 2 0 0 1-1.3 1.3L3 12l5.8 1.9a2 2 0 0 1 1.3 1.3L12 21l1.9-5.8a2 2 0 0 1 1.3-1.3L21 12l-5.8-1.9a2 2 0 0 1-1.3-1.3z" }) }) }))] }), updated && _jsxs("span", { className: "src", children: ["Updated ", updated, " ago"] })] }), _jsx(Badge, { provider: provider })] }), _jsxs("div", { className: "pcard-body", children: [_jsx(PaceBar, { provider: provider, asOf: asOf }), _jsx(WindowsRow, { provider: provider, asOf: asOf, variant: "card" }), _jsx(PaceStats, { provider: provider, asOf: asOf })] }), _jsxs("div", { className: "pcard-foot", children: [_jsxs("div", { className: "foot-meta", children: [_jsx("span", { children: resetsDate(provider) ?? resetCountdown(provider, asOfMs) }), last && (_jsxs("span", { className: "last-week", children: ["Last ", isMonthlyBound(provider) ? "month" : "week", " ", last.leftoverPct, "% leftover", last.resetsAtEstimated ? " (est.)" : ""] }))] }), _jsx("span", { className: "rowbtn", "aria-hidden": "true", children: "Inspect" })] })] }));
28
+ }, className: `pcard ${recommended ? "is-recommended is-top-pick" : ""}`, children: [_jsxs("div", { className: "pcard-head", children: [_jsx("span", { className: "picon", style: providerTint(provider.id), "aria-hidden": "true", children: _jsx(ProviderIcon, { id: provider.id, title: name }) }), _jsxs("div", { className: "who", children: [_jsxs("b", { children: [name, recommended && (_jsx("span", { className: "rec-icon", title: "Recommended for next session", role: "img", "aria-label": "recommended", children: _jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "m12 3-1.9 5.8a2 2 0 0 1-1.3 1.3L3 12l5.8 1.9a2 2 0 0 1 1.3 1.3L12 21l1.9-5.8a2 2 0 0 1 1.3-1.3L21 12l-5.8-1.9a2 2 0 0 1-1.3-1.3z" }) }) }))] }), updated && _jsxs("span", { className: "src", children: ["Updated ", updated, " ago"] })] }), _jsx(Badge, { provider: provider })] }), _jsxs("div", { className: "pcard-body", children: [_jsx(PaceBar, { provider: provider, asOf: asOf }), _jsx(RateLimitNote, { provider: provider, asOf: asOf }), _jsx(WindowsRow, { provider: provider, asOf: asOf, variant: "card" }), _jsx(PaceStats, { provider: provider, asOf: asOf })] }), _jsxs("div", { className: "pcard-foot", children: [_jsxs("div", { className: "foot-meta", children: [_jsx("span", { children: resetsDate(provider) ?? resetCountdown(provider, asOfMs) }), last && (_jsxs("span", { className: "last-week", children: ["Last ", isMonthlyBound(provider) ? "month" : "week", " ", last.leftoverPct, "% leftover", last.resetsAtEstimated ? " (est.)" : ""] }))] }), _jsx("span", { className: "rowbtn", "aria-hidden": "true", children: "Inspect" })] })] }));
28
29
  }
@@ -38,6 +38,13 @@ export declare function failureWords(category: FailureCategory): string | null;
38
38
  export declare function drawerModel(provider: ProviderView): DrawerModel;
39
39
  export declare function sourceLabel(source: string | undefined | null): string;
40
40
  export declare function paceBasis(provider: ProviderView, asOfMs?: number): string;
41
+ /**
42
+ * The rate the verdict and waste are priced at, named once so "forecast
43
+ * pace" in the copy points at a visible figure. Null unless both inputs of
44
+ * the blend exist: with one input the forecast equals a figure already
45
+ * shown in the grid.
46
+ */
47
+ export declare function forecastBasis(provider: ProviderView): string | null;
41
48
  export declare function credentialLabel(provider: ProviderView): string;
42
49
  export declare function resetStamp(provider: ProviderView): string | null;
43
50
  export declare function resetUnderline(provider: ProviderView, asOfMs: number): string | null;
@@ -85,7 +92,7 @@ export interface Verdict {
85
92
  }
86
93
  /**
87
94
  * Drawer verdict band from lane, binding window, and forecast fields.
88
- * Precedence: excluded or monthly-exhausted, monthly-bound, use-more lane,
95
+ * Precedence: excluded or monthly-exhausted, capped, monthly-bound, use-more lane,
89
96
  * ease-off lane or at-risk/watch status, otherwise on track.
90
97
  */
91
98
  export declare function verdictFor(provider: ProviderView, asOfMs?: number): Verdict;
@@ -97,7 +104,7 @@ export declare function submitProviderRename(id: string, rawDraft: string, renam
97
104
  /**
98
105
  * Compact forecast for a drawer limit line. The verdict band and Pace
99
106
  * section carry the full pace story, so the row keeps only the outcome:
100
- * status words and "at current pace" are dropped, and a status-only
107
+ * status words and "at forecast pace" are dropped, and a status-only
101
108
  * headline with no figure is left to the verdict.
102
109
  */
103
110
  export declare function compactLimitForecast(provider: ProviderView): PaceHeadline | null;