@oh-my-pi/omp-stats 18.10.4 → 18.11.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 CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [18.11.0] - 2026-10-14
6
+
7
+ ### Fixed
8
+
9
+ - Providers → Subscription windows no longer mixes Codex 5-hour and 7-day quotas across plans: Team and weekly-only (ProLite) accounts now share the 7-day row, the 5-hour row counts only accounts that have one, and labels no longer flip with whichever account reported last ([#15664](https://github.com/can1357/oh-my-pi/issues/15664))
10
+
5
11
  ## [18.10.4] - 2026-10-13
6
12
 
7
13
  ### Fixed
@@ -409,7 +409,7 @@ export interface UsageWindowSeries {
409
409
  accountKey: string;
410
410
  /** Email/account id when known, else the stable account key. */
411
411
  accountLabel: string;
412
- /** Groups the same limit window across accounts (the provider limit id). */
412
+ /** Groups the same limit window across accounts: the limit id, or quota family + window for positional Codex slots. */
413
413
  windowKey: string;
414
414
  /** Human label of the limit (distinguishes same-duration windows). */
415
415
  windowLabel: string;
@@ -422,7 +422,7 @@ export interface UsageWindowSeries {
422
422
  */
423
423
  export interface ProviderWindowInsight {
424
424
  provider: string;
425
- /** Groups the same limit window across accounts (the provider limit id). */
425
+ /** Groups the same limit window across accounts: the limit id, or quota family + window for positional Codex slots. */
426
426
  windowKey: string;
427
427
  /** Human label of the limit (distinguishes same-duration windows). */
428
428
  windowLabel: string;
@@ -57,10 +57,12 @@ export declare function sumFleetTokens(clients: ClientUsageClientSummary[]): Map
57
57
  /**
58
58
  * Derive utilization series and per-window insights from raw snapshots.
59
59
  *
60
- * Windows are grouped by `(provider, limitId)` — never by display label.
61
- * Distinct limits can share a duration label (Anthropic's overall and
62
- * model-scoped 7-day windows, Codex's base and Spark weeklies); merging them
63
- * interleaves unrelated fractions per account and wildly inflates consumption.
60
+ * Windows are grouped by `(provider, windowKeyOf(row))` — never by display
61
+ * label alone. Distinct limits can share a duration label (Anthropic's overall
62
+ * and model-scoped 7-day windows, Codex's base and Spark weeklies); merging
63
+ * them interleaves unrelated fractions per account and wildly inflates
64
+ * consumption. Conversely, one window reported under different positional
65
+ * slots by different accounts must merge (see {@link windowKeyOf}).
64
66
  *
65
67
  * `tokensByProvider` supplies each provider's token burn over the same time
66
68
  * range (fleet-wide broker client reports when available, else local message
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/omp-stats",
4
- "version": "18.10.4",
4
+ "version": "18.11.1",
5
5
  "description": "Local observability dashboard for omp AI usage statistics",
6
6
  "homepage": "https://omp.sh",
7
7
  "author": {
@@ -42,9 +42,9 @@
42
42
  "fmt": "oxfmt --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts'"
43
43
  },
44
44
  "dependencies": {
45
- "@oh-my-pi/pi-ai": "18.10.4",
46
- "@oh-my-pi/pi-catalog": "18.10.4",
47
- "@oh-my-pi/pi-utils": "18.10.4",
45
+ "@oh-my-pi/pi-ai": "18.11.1",
46
+ "@oh-my-pi/pi-catalog": "18.11.1",
47
+ "@oh-my-pi/pi-utils": "18.11.1",
48
48
  "lucide-react": "^1.24.0",
49
49
  "react": "19.2.7",
50
50
  "react-dom": "19.2.7"
@@ -438,7 +438,7 @@ export interface UsageWindowSeries {
438
438
  accountKey: string;
439
439
  /** Email/account id when known, else the stable account key. */
440
440
  accountLabel: string;
441
- /** Groups the same limit window across accounts (the provider limit id). */
441
+ /** Groups the same limit window across accounts: the limit id, or quota family + window for positional Codex slots. */
442
442
  windowKey: string;
443
443
  /** Human label of the limit (distinguishes same-duration windows). */
444
444
  windowLabel: string;
@@ -452,7 +452,7 @@ export interface UsageWindowSeries {
452
452
  */
453
453
  export interface ProviderWindowInsight {
454
454
  provider: string;
455
- /** Groups the same limit window across accounts (the provider limit id). */
455
+ /** Groups the same limit window across accounts: the limit id, or quota family + window for positional Codex slots. */
456
456
  windowKey: string;
457
457
  /** Human label of the limit (distinguishes same-duration windows). */
458
458
  windowLabel: string;
@@ -241,13 +241,33 @@ function windowDisplayLabel(row: UsageSnapshotRow): string {
241
241
  return `${label} · ${windowLabel}`;
242
242
  }
243
243
 
244
+ /** Trailing limit-id segment naming the report slot a window arrived in, not the quota itself. */
245
+ const POSITIONAL_SLOT = /:(?:primary|secondary)$/;
246
+
247
+ /**
248
+ * Cross-account identity of one limit window: usually the limit id. Positional
249
+ * ids (Codex's `openai-codex:primary`) name a slot, not a window — a Team plan
250
+ * reports its 5-hour window as `primary` and its 7-day one as `secondary`,
251
+ * while a weekly-only plan reports its 7-day window as `primary`. For those,
252
+ * the quota family (the id minus the slot) plus the recorded window label is
253
+ * the identity, so both plans' weeklies share a group while Spark's
254
+ * (`openai-codex:spark:*`) stays apart. A row without a window label keeps its
255
+ * raw id rather than having its window guessed from the slot.
256
+ */
257
+ function windowKeyOf(row: UsageSnapshotRow): string {
258
+ if (!row.windowLabel || !POSITIONAL_SLOT.test(row.limitId)) return row.limitId;
259
+ return `${row.limitId.replace(POSITIONAL_SLOT, "")}:${row.windowLabel}`;
260
+ }
261
+
244
262
  /**
245
263
  * Derive utilization series and per-window insights from raw snapshots.
246
264
  *
247
- * Windows are grouped by `(provider, limitId)` — never by display label.
248
- * Distinct limits can share a duration label (Anthropic's overall and
249
- * model-scoped 7-day windows, Codex's base and Spark weeklies); merging them
250
- * interleaves unrelated fractions per account and wildly inflates consumption.
265
+ * Windows are grouped by `(provider, windowKeyOf(row))` — never by display
266
+ * label alone. Distinct limits can share a duration label (Anthropic's overall
267
+ * and model-scoped 7-day windows, Codex's base and Spark weeklies); merging
268
+ * them interleaves unrelated fractions per account and wildly inflates
269
+ * consumption. Conversely, one window reported under different positional
270
+ * slots by different accounts must merge (see {@link windowKeyOf}).
251
271
  *
252
272
  * `tokensByProvider` supplies each provider's token burn over the same time
253
273
  * range (fleet-wide broker client reports when available, else local message
@@ -262,12 +282,13 @@ export function computeUsageWindowStats(
262
282
  ): UsageWindowStats {
263
283
  const groups = new Map<string, WindowGroup>();
264
284
  for (const row of rows) {
265
- const groupKey = `${row.provider}\u0000${row.limitId}`;
285
+ const windowKey = windowKeyOf(row);
286
+ const groupKey = `${row.provider}\u0000${windowKey}`;
266
287
  let group = groups.get(groupKey);
267
288
  if (!group) {
268
289
  group = {
269
290
  provider: row.provider,
270
- windowKey: row.limitId,
291
+ windowKey,
271
292
  windowLabel: windowDisplayLabel(row),
272
293
  accounts: new Map(),
273
294
  };