@linxiraos/pi-stats 1.4.10 → 1.4.11

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
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.4.11] - 2026-11-06
4
+
5
+ ### Added
6
+
7
+ - `getUsageHistory(days)` and the `getModelDailyActivity` / `getModelHourlyActivity` rollup reads: per-day totals, per-day per-model totals and today's per-hour per-model totals from the existing `messages` + `message_rollup` tables, with a local-calendar cutoff derived from SQLite itself.
8
+
3
9
  ## [1.4.10] - 2026-11-05
4
10
 
5
11
  - Released as part of Zeta 1.4.10; no package-specific user-visible changes.
@@ -5,6 +5,50 @@ This generated, self-contained aggregate accompanies Zeta release artifacts.
5
5
  It does not replace package-level license files. First-party licensing grants
6
6
  no rights in third-party code, fonts, data, or marks identified below.
7
7
 
8
+ ZETA IS A FORK AND REDISTRIBUTION
9
+ =================================
10
+
11
+ Zeta is a downstream distribution of oh-my-pi (OMP), and it also contains forks
12
+ of OMP Web, OMP Studio and TermIDE. Upstream copyright notices stay with their
13
+ files and are not restated here. This section states, for every forked or
14
+ vendored application tree, where it came from, what Zeta changed, and why.
15
+ Upstream URLs are the ones configured in `.git/config`; the per-tree deviation
16
+ ledgers are authoritative for details.
17
+
18
+ Forked application trees:
19
+
20
+ | Path | Upstream | Snapshot | License | What Zeta changed |
21
+ |---|---|---|---|---|
22
+ | `packages/ main/ crates/ python/ lsp/ sdk/ types/ skills/` | oh-my-pi (OMP), https://github.com/can1357/oh-my-pi | integrated through tag `v18.15.0` (`document/upstream-sync.md`) | see upstream files | product name, paths, command names and env prefixes; branded assets; internal identifiers renamed to `__zeta*` |
23
+ | `web-ui/` | OMP Web, https://github.com/17380936778/omp-web | frozen snapshot + manual cherry-picks (`document/upstream-sync.md`) | see upstream files | gateway transport, theme token bridge, page routing |
24
+ | `web-app/` (`src/studio`, `src/vendor/*`) | OMP Studio 0.1.17, https://github.com/the-snowpear/omp-studio | `0.1.17`, ported into the product renderer | MIT | maintained by Zeta now: the host contract is reimplemented in `studio-host` (pair/CSRF/query/command/events), the renderer was rebranded (`zeta-studio` wire name, Zeta links/fixtures), and Zeta adds windowed transcripts, precompressed static serving, the plugin registry, and the usage dashboard |
25
+ | `termide/` | TermIDE, https://github.com/termide/termide | tag `0.46.0` = `a027ca788cd4c9d24f060cdcd3195ca2e475617b` | MIT | deviations listed in `termide/VENDOR.md` (28 entries) |
26
+ | `editor/npm/*` (`@linxiraos/editor*`) | TermIDE `panel-editor` | same tree as `termide/` | MIT | built as the editor-only bin `termide-editor` (`editor/npm/editor/VENDOR.md`) |
27
+ | `plugins/official/*` | per plugin | per plugin | per plugin | each directory carries `plugin.json`, README with source, and its license |
28
+
29
+ Why the fork renames things at all: the upstream licenses and the product
30
+ identity both require that a downstream distribution not present itself as the
31
+ upstream. Renames therefore cover the product name, command names
32
+ (`zetawork` / `zetacode` / `zetaide`), the `zeta://` scheme, the npm scope
33
+ `@linxiraos/*`, and release asset names (`zeta-cli-*`). User-visible
34
+ configuration keeps accepting the legacy names during the transition, so an
35
+ existing installation does not silently break.
36
+
37
+ Brand and assets:
38
+
39
+ * Product marks — name, logos, app icons, wordmarks, splash art — are Zeta's own
40
+ and are not redistributed from any upstream. Upstream marks are not shipped.
41
+ * Assets that do come from an upstream are enumerated in the per-tree ledgers
42
+ above; each keeps its upstream license notice in place.
43
+
44
+ Frozen counterpart constants (interoperability, not branding):
45
+
46
+ * Stencil OIDC `client-id "omp"`, its issuer and scopes; `catalog.stencil.so`;
47
+ `docs.stencil.so/tern/protocol/`; `my.omp.sh` as the collaboration relay
48
+ constant; the `__omp_judgment_images` upload key. These are wire-compatible
49
+ identifiers Zeta must keep, listed here so that a brand sweep does not break
50
+ them.
51
+
8
52
  PYTHON DEPENDENCY DISTRIBUTION ROLE
9
53
  ===================================
10
54
 
@@ -385,6 +429,62 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
385
429
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
386
430
  SOFTWARE.
387
431
 
432
+ -------------------------------------------------------------------------------
433
+ web-app/src/studio + web-app/src/vendor/* + web-ui/components/studio +
434
+ web-ui/styles/studio + web-ui/lib/studio-protocol
435
+
436
+ Ported UI surface and protocol types from OMP Studio 0.1.17 (MIT).
437
+
438
+ - `web-ui/components/studio/` and `web-ui/styles/studio/` are derived from the
439
+ OMP Studio renderer (`apps/renderer/src`).
440
+ - `web-ui/lib/studio-protocol/` vendors the type and validation surface of
441
+ `@omp-studio/client-contract` and `@omp-studio/studio-protocol` (78 files, no
442
+ runtime dependency), so the ported renderer keeps its own read models.
443
+ - `web-ui/lib/studio-client/` is Zeta's own implementation of the
444
+ `StudioClient` interface over the Zeta gateway; it is not derived from
445
+ `@omp-studio/client`.
446
+
447
+ The data plumbing, transport and packaging are Zeta's own and are not part of
448
+ that derivation.
449
+
450
+ Copyright (c) 2026 snowpear and OMP Studio contributors
451
+ Copyright (c) 2026 Linxira-OS and Zeta contributors (Zeta modifications and additions)
452
+
453
+ Local modifications: the product renderer moved to `web-app/` (Vite 7) with
454
+ its own node project, and the host contract is Zeta's `studio-host` rather than
455
+ Studio's server. `@omp-studio/client-contract` and
456
+ `@omp-studio/studio-protocol` imports were rewritten to the vendored copies in
457
+ both trees; `@omp-studio/client` is replaced by `web-ui/lib/studio-client` (the
458
+ frozen snapshot) and by the host-backed transport in `web-app/`. The wire
459
+ protocol name is `zeta-studio`, the desktop bridge global is
460
+ `zetaStudioChrome`, Studio's design tokens were rebound to Zeta's theme alias
461
+ layer (`--studio-*` → `--zeta-alias-*`), and surfaces with no Zeta backend were
462
+ dropped rather than ported. Zeta-only additions: windowed transcript
463
+ pagination, precompressed static assets, the real plugin registry, the usage
464
+ dashboard, and the brand sweep. The MIT notice above covers the unmodified
465
+ upstream portions; Zeta's changes are additionally under
466
+ `Copyright (c) 2026 Linxira-OS and Zeta contributors`.
467
+
468
+ MIT License
469
+
470
+ Permission is hereby granted, free of charge, to any person obtaining a copy
471
+ of this software and associated documentation files (the "Software"), to deal
472
+ in the Software without restriction, including without limitation the rights
473
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
474
+ copies of the Software, and to permit persons to whom the Software is
475
+ furnished to do so, subject to the following conditions:
476
+
477
+ The above copyright notice and this permission notice shall be included in all
478
+ copies or substantial portions of the Software.
479
+
480
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
481
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
482
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
483
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
484
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
485
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
486
+ SOFTWARE.
487
+
388
488
  -------------------------------------------------------------------------------
389
489
  packages/coding-agent/src/export/html/vendor/NOTICE
390
490
 
@@ -1,6 +1,6 @@
1
1
  import { Database } from "bun:sqlite";
2
2
  import { type ParseSessionResult, type SessionParserState } from "./parser.js";
3
- import type { AssistantTextStats, DailyActivityPoint, FrustrationCounts, MessageStats, MessageStatsInput, ModelSideCounts, ModelSideTimeSeriesPoint, ToolCallStats, ToolResultLink, UserMessageLink, UserMessageStats } from "./types.js";
3
+ import type { AssistantTextStats, DailyActivityPoint, FrustrationCounts, MessageStats, MessageStatsInput, ModelDailyActivityPoint, ModelHourlyActivityPoint, ModelSideCounts, ModelSideTimeSeriesPoint, ToolCallStats, ToolResultLink, UserMessageLink, UserMessageStats } from "./types.js";
4
4
  /**
5
5
  * Predicate counting one stored request as "unpriced" — the public rate card
6
6
  * has no charge for it, so its zero is unknown spend rather than free usage.
@@ -104,7 +104,35 @@ export declare function getMessageById(id: number): MessageStats | null;
104
104
  * {@link getProviderHourlyBurn}. Reads the hourly rollup, falling back to the
105
105
  * raw rows while its rebuild backlog is too large for exact reads.
106
106
  */
107
- export declare function getDailyActivity(days?: number): Promise<DailyActivityPoint[]>;
107
+ export declare function getDailyActivity(days?: number, now?: number): Promise<DailyActivityPoint[]>;
108
+ /**
109
+ * Lookback for the Studio home usage card. It renders a calendar-year heatmap
110
+ * plus a year-to-date model legend, so the window has to reach back past
111
+ * January 1st even in late December (the TUI heatmap reads 371 days for the
112
+ * same reason; 400 keeps a month of slack).
113
+ */
114
+ export declare const USAGE_HISTORY_DAYS = 400;
115
+ /** Everything the Studio home usage card reads from the stats DB. */
116
+ export interface UsageHistory {
117
+ /** Per-day totals for the last {@link USAGE_HISTORY_DAYS} days, oldest first. */
118
+ days: DailyActivityPoint[];
119
+ /** Per-day per-model totals over the same window, oldest day first. */
120
+ byModelDay: ModelDailyActivityPoint[];
121
+ /** Per-model totals for each local hour of `now`'s day. */
122
+ todayByHour: ModelHourlyActivityPoint[];
123
+ }
124
+ /**
125
+ * Read the Studio home card's usage history in one call: the daily totals the
126
+ * TUI heatmap already uses, the same window split per model, and today's
127
+ * per-model hourly series. One `initDb` per call; every read goes through the
128
+ * rollup union, so no session transcript is re-parsed here.
129
+ *
130
+ * "Today" starts on the stats database's own local calendar, not the JS clock:
131
+ * the hour buckets come from SQLite's `localtime`, and the two clocks can
132
+ * disagree (a process launched under a `TZ` the C library ignores — Bun's test
133
+ * runner is one), which would slide the strip off the day it summarizes.
134
+ */
135
+ export declare function getUsageHistory(now?: number, days?: number): Promise<UsageHistory>;
108
136
  /**
109
137
  * Settle every full-session backfill after a successful sync pass.
110
138
  */
@@ -25,7 +25,7 @@
25
25
  * (an hour of data is small and indexed by timestamp).
26
26
  */
27
27
  import type { Database } from "bun:sqlite";
28
- import type { AgentTypeStats, AggregatedStats, CostTimeSeriesPoint, DailyActivityPoint, FolderStats, ModelPerformancePoint, ModelStats, ModelTimeSeriesPoint, ProviderAggregate, ProviderHourlyPoint, ProviderTimeSeriesPoint, TimeSeriesPoint, ToolModelStats, ToolTimeSeriesPoint, ToolUsageStats } from "./types.js";
28
+ import type { AgentTypeStats, AggregatedStats, CostTimeSeriesPoint, DailyActivityPoint, FolderStats, ModelDailyActivityPoint, ModelHourlyActivityPoint, ModelPerformancePoint, ModelStats, ModelTimeSeriesPoint, ProviderAggregate, ProviderHourlyPoint, ProviderTimeSeriesPoint, TimeSeriesPoint, ToolModelStats, ToolTimeSeriesPoint, ToolUsageStats } from "./types.js";
29
29
  /**
30
30
  * Create (or rebuild after a version bump) the rollup tables and the triggers
31
31
  * that mark hours dirty. Called from `initDb` after the raw tables exist.
@@ -95,6 +95,21 @@ export declare function getProviderHourlyBurn(cutoff?: number | null): ProviderH
95
95
  * aggregate the raw rows instead.
96
96
  */
97
97
  export declare function getDailyActivityFromRollup(cutoff: number): DailyActivityPoint[] | null;
98
+ /**
99
+ * Per-model token totals per local day since `cutoff`, oldest day first. Same
100
+ * exactness rules as every range read (clean rollup hours plus raw rows for the
101
+ * partial hour and dirty hours), so a live ingest shows up before its hour is
102
+ * re-rolled. Hourly buckets are attributed by their start, so a half-hour UTC
103
+ * offset can move up to 30 minutes of burn onto the neighbouring day — the same
104
+ * caveat {@link getProviderHourlyBurn} documents for local hours.
105
+ */
106
+ export declare function getModelDailyActivity(cutoff?: number | null): ModelDailyActivityPoint[];
107
+ /**
108
+ * Per-model token totals per local hour of day (`0`–`23`) since `cutoff`. Used
109
+ * with today's local midnight so the result is today's hourly series. Same
110
+ * attribution caveat as {@link getProviderHourlyBurn}.
111
+ */
112
+ export declare function getModelHourlyActivity(cutoff?: number | null): ModelHourlyActivityPoint[];
98
113
  /** Tokens/cost per bucket per provider. */
99
114
  export declare function getProviderTimeSeries({ cutoff, bucketMs }: RangeWindow): ProviderTimeSeriesPoint[];
100
115
  /** Per-transcript-file rollup for the Traces session list. */
@@ -141,6 +141,30 @@ export interface DailyActivityPoint {
141
141
  /** Total tokens (input + output + cache) for the day. */
142
142
  totalTokens: number;
143
143
  }
144
+ /**
145
+ * One local calendar day of token usage for one model, for the Studio home
146
+ * card's per-model heatmap. Days with no usage are absent, not zeroed.
147
+ */
148
+ export interface ModelDailyActivityPoint {
149
+ /** Local calendar date, `YYYY-MM-DD`. */
150
+ day: string;
151
+ /** Model id as recorded on the assistant turn. */
152
+ model: string;
153
+ /** Total tokens (input + output + cache) for the day. */
154
+ totalTokens: number;
155
+ }
156
+ /**
157
+ * Per-model token usage for one local hour of the day, for the Studio home
158
+ * card's "today" view.
159
+ */
160
+ export interface ModelHourlyActivityPoint {
161
+ /** Local hour of day, `0`–`23`. */
162
+ hour: number;
163
+ /** Model id as recorded on the assistant turn. */
164
+ model: string;
165
+ /** Total tokens (input + output + cache) for the hour. */
166
+ totalTokens: number;
167
+ }
144
168
  /**
145
169
  * Overall dashboard stats.
146
170
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@linxiraos/pi-stats",
4
- "version": "1.4.10",
4
+ "version": "1.4.11",
5
5
  "description": "Local observability dashboard for omp AI usage statistics",
6
6
  "homepage": "https://linxira-os.github.io/zeta/",
7
7
  "author": "Linxira-OS",
@@ -39,9 +39,9 @@
39
39
  "fmt": "oxfmt --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts'"
40
40
  },
41
41
  "dependencies": {
42
- "@linxiraos/pi-ai": "1.4.10",
43
- "@linxiraos/pi-catalog": "1.4.10",
44
- "@linxiraos/pi-utils": "1.4.10",
42
+ "@linxiraos/pi-ai": "1.4.11",
43
+ "@linxiraos/pi-catalog": "1.4.11",
44
+ "@linxiraos/pi-utils": "1.4.11",
45
45
  "lucide-react": "^1.24.0",
46
46
  "react": "19.2.7",
47
47
  "react-dom": "19.2.7"
package/src/db.ts CHANGED
@@ -13,7 +13,12 @@ import type { ModelCost } from "@linxiraos/pi-catalog/types";
13
13
  import { getConfigRootDir, getStatsDbPath, VERSION } from "@linxiraos/pi-utils";
14
14
  import { ChunkedInsert } from "./chunked-insert";
15
15
  import { classifyAgentType, type ParseSessionResult, type SessionParserState } from "./parser";
16
- import { ensureRollupSchema, getDailyActivityFromRollup } from "./rollup";
16
+ import {
17
+ ensureRollupSchema,
18
+ getDailyActivityFromRollup,
19
+ getModelDailyActivity,
20
+ getModelHourlyActivity,
21
+ } from "./rollup";
17
22
  import type {
18
23
  AgentType,
19
24
  AssistantTextStats,
@@ -21,6 +26,8 @@ import type {
21
26
  FrustrationCounts,
22
27
  MessageStats,
23
28
  MessageStatsInput,
29
+ ModelDailyActivityPoint,
30
+ ModelHourlyActivityPoint,
24
31
  ModelSideCounts,
25
32
  ModelSideTimeSeriesPoint,
26
33
  ToolCallStats,
@@ -1172,9 +1179,9 @@ export function getMessageById(id: number): MessageStats | null {
1172
1179
  * {@link getProviderHourlyBurn}. Reads the hourly rollup, falling back to the
1173
1180
  * raw rows while its rebuild backlog is too large for exact reads.
1174
1181
  */
1175
- export async function getDailyActivity(days = 371): Promise<DailyActivityPoint[]> {
1182
+ export async function getDailyActivity(days = 371, now = Date.now()): Promise<DailyActivityPoint[]> {
1176
1183
  const database = await initDb();
1177
- const cutoff = Date.now() - days * 24 * 60 * 60 * 1000;
1184
+ const cutoff = now - days * 24 * 60 * 60 * 1000;
1178
1185
  const rolled = getDailyActivityFromRollup(cutoff);
1179
1186
  if (rolled) return rolled;
1180
1187
  const stmt = database.query(`
@@ -1202,6 +1209,48 @@ export async function getDailyActivity(days = 371): Promise<DailyActivityPoint[]
1202
1209
  }));
1203
1210
  }
1204
1211
 
1212
+ /**
1213
+ * Lookback for the Studio home usage card. It renders a calendar-year heatmap
1214
+ * plus a year-to-date model legend, so the window has to reach back past
1215
+ * January 1st even in late December (the TUI heatmap reads 371 days for the
1216
+ * same reason; 400 keeps a month of slack).
1217
+ */
1218
+ export const USAGE_HISTORY_DAYS = 400;
1219
+
1220
+ /** Everything the Studio home usage card reads from the stats DB. */
1221
+ export interface UsageHistory {
1222
+ /** Per-day totals for the last {@link USAGE_HISTORY_DAYS} days, oldest first. */
1223
+ days: DailyActivityPoint[];
1224
+ /** Per-day per-model totals over the same window, oldest day first. */
1225
+ byModelDay: ModelDailyActivityPoint[];
1226
+ /** Per-model totals for each local hour of `now`'s day. */
1227
+ todayByHour: ModelHourlyActivityPoint[];
1228
+ }
1229
+
1230
+ /**
1231
+ * Read the Studio home card's usage history in one call: the daily totals the
1232
+ * TUI heatmap already uses, the same window split per model, and today's
1233
+ * per-model hourly series. One `initDb` per call; every read goes through the
1234
+ * rollup union, so no session transcript is re-parsed here.
1235
+ *
1236
+ * "Today" starts on the stats database's own local calendar, not the JS clock:
1237
+ * the hour buckets come from SQLite's `localtime`, and the two clocks can
1238
+ * disagree (a process launched under a `TZ` the C library ignores — Bun's test
1239
+ * runner is one), which would slide the strip off the day it summarizes.
1240
+ */
1241
+ export async function getUsageHistory(now = Date.now(), days = USAGE_HISTORY_DAYS): Promise<UsageHistory> {
1242
+ const database = await initDb();
1243
+ const cutoff = now - days * 24 * 60 * 60 * 1000;
1244
+ const today = database
1245
+ .query(`SELECT unixepoch(date(? / 1000, 'unixepoch', 'localtime'), 'utc') * 1000 AS start`)
1246
+ .get(now) as { start: number };
1247
+ return {
1248
+ days: await getDailyActivity(days, now),
1249
+ byModelDay: getModelDailyActivity(cutoff),
1250
+ todayByHour: getModelHourlyActivity(today.start),
1251
+ };
1252
+ }
1253
+
1205
1254
  /**
1206
1255
  * Reset `file_offsets` (and any existing `user_messages` rows) so the next
1207
1256
  * successful sync re-parses every session and re-derives behavioral metrics.
package/src/rollup.ts CHANGED
@@ -34,6 +34,8 @@ import type {
34
34
  CostTimeSeriesPoint,
35
35
  DailyActivityPoint,
36
36
  FolderStats,
37
+ ModelDailyActivityPoint,
38
+ ModelHourlyActivityPoint,
37
39
  ModelPerformancePoint,
38
40
  ModelStats,
39
41
  ModelTimeSeriesPoint,
@@ -825,6 +827,37 @@ export function getDailyActivityFromRollup(cutoff: number): DailyActivityPoint[]
825
827
  ).map(row => ({ day: row.day, cost: row.cost, requests: row.requests, totalTokens: row.total_tokens ?? 0 }));
826
828
  }
827
829
 
830
+ /**
831
+ * Per-model token totals per local day since `cutoff`, oldest day first. Same
832
+ * exactness rules as every range read (clean rollup hours plus raw rows for the
833
+ * partial hour and dirty hours), so a live ingest shows up before its hour is
834
+ * re-rolled. Hourly buckets are attributed by their start, so a half-hour UTC
835
+ * offset can move up to 30 minutes of burn onto the neighbouring day — the same
836
+ * caveat {@link getProviderHourlyBurn} documents for local hours.
837
+ */
838
+ export function getModelDailyActivity(cutoff: number | null = null): ModelDailyActivityPoint[] {
839
+ return queryMessages<{ day: string; model: string; total_tokens: number | null }>(
840
+ { cutoff },
841
+ `date(f.bucket / 1000, 'unixepoch', 'localtime') AS day, f.model AS model,
842
+ SUM(f.total_tokens) AS total_tokens`,
843
+ "GROUP BY day, f.model ORDER BY day, f.model",
844
+ ).map(row => ({ day: row.day, model: row.model, totalTokens: row.total_tokens ?? 0 }));
845
+ }
846
+
847
+ /**
848
+ * Per-model token totals per local hour of day (`0`–`23`) since `cutoff`. Used
849
+ * with today's local midnight so the result is today's hourly series. Same
850
+ * attribution caveat as {@link getProviderHourlyBurn}.
851
+ */
852
+ export function getModelHourlyActivity(cutoff: number | null = null): ModelHourlyActivityPoint[] {
853
+ return queryMessages<{ model: string; hour: number; total_tokens: number | null }>(
854
+ { cutoff },
855
+ `f.model AS model, CAST(strftime('%H', f.bucket / 1000, 'unixepoch', 'localtime') AS INTEGER) AS hour,
856
+ SUM(f.total_tokens) AS total_tokens`,
857
+ "GROUP BY f.model, hour ORDER BY hour, f.model",
858
+ ).map(row => ({ hour: row.hour, model: row.model, totalTokens: row.total_tokens ?? 0 }));
859
+ }
860
+
828
861
  /** Tokens/cost per bucket per provider. */
829
862
  export function getProviderTimeSeries({ cutoff, bucketMs }: RangeWindow): ProviderTimeSeriesPoint[] {
830
863
  return queryMessages<{
@@ -150,6 +150,32 @@ export interface DailyActivityPoint {
150
150
  totalTokens: number;
151
151
  }
152
152
 
153
+ /**
154
+ * One local calendar day of token usage for one model, for the Studio home
155
+ * card's per-model heatmap. Days with no usage are absent, not zeroed.
156
+ */
157
+ export interface ModelDailyActivityPoint {
158
+ /** Local calendar date, `YYYY-MM-DD`. */
159
+ day: string;
160
+ /** Model id as recorded on the assistant turn. */
161
+ model: string;
162
+ /** Total tokens (input + output + cache) for the day. */
163
+ totalTokens: number;
164
+ }
165
+
166
+ /**
167
+ * Per-model token usage for one local hour of the day, for the Studio home
168
+ * card's "today" view.
169
+ */
170
+ export interface ModelHourlyActivityPoint {
171
+ /** Local hour of day, `0`–`23`. */
172
+ hour: number;
173
+ /** Model id as recorded on the assistant turn. */
174
+ model: string;
175
+ /** Total tokens (input + output + cache) for the hour. */
176
+ totalTokens: number;
177
+ }
178
+
153
179
  /**
154
180
  * Overall dashboard stats.
155
181
  */