@myagentroam/protocol 0.10.7 → 0.10.8

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.
@@ -0,0 +1,582 @@
1
+ import { z } from 'zod';
2
+ export declare const MODEL_USAGE_VERSION = 1;
3
+ export declare const MODEL_USAGE_RETENTION_MS: number;
4
+ export declare const MODEL_USAGE_OUTBOX_RETENTION_MS: number;
5
+ export declare const MODEL_USAGE_BATCH_LIMIT = 64;
6
+ export declare const MODEL_USAGE_BATCH_BYTES = 262144;
7
+ export declare const usageCountSchema: z.ZodString;
8
+ export declare const usageRunnerSchema: z.ZodEnum<["mar-agent", "codex", "claude-code", "opencode"]>;
9
+ export declare const usagePurposeSchema: z.ZodEnum<["conversation", "compact", "title", "other"]>;
10
+ export declare const modelUsageCapabilitySchema: z.ZodObject<{
11
+ apiVersion: z.ZodLiteral<1>;
12
+ }, "strict", z.ZodTypeAny, {
13
+ apiVersion: 1;
14
+ }, {
15
+ apiVersion: 1;
16
+ }>;
17
+ /** A non-executable assertion, signed and verified only by the Server. */
18
+ export declare const modelUsageGrantClaimsSchema: z.ZodObject<{
19
+ audience: z.ZodLiteral<"model-usage-v1">;
20
+ scopeId: z.ZodString;
21
+ nodeId: z.ZodString;
22
+ userId: z.ZodNumber;
23
+ mode: z.ZodEnum<["work", "conversation"]>;
24
+ issuedAt: z.ZodNumber;
25
+ expiresAt: z.ZodNumber;
26
+ }, "strict", z.ZodTypeAny, {
27
+ expiresAt: number;
28
+ nodeId: string;
29
+ audience: "model-usage-v1";
30
+ scopeId: string;
31
+ userId: number;
32
+ mode: "conversation" | "work";
33
+ issuedAt: number;
34
+ }, {
35
+ expiresAt: number;
36
+ nodeId: string;
37
+ audience: "model-usage-v1";
38
+ scopeId: string;
39
+ userId: number;
40
+ mode: "conversation" | "work";
41
+ issuedAt: number;
42
+ }>;
43
+ export declare const modelUsageGrantSchema: z.ZodObject<{
44
+ scopeId: z.ZodString;
45
+ token: z.ZodString;
46
+ }, "strict", z.ZodTypeAny, {
47
+ scopeId: string;
48
+ token: string;
49
+ }, {
50
+ scopeId: string;
51
+ token: string;
52
+ }>;
53
+ export type ModelUsageGrant = z.infer<typeof modelUsageGrantSchema>;
54
+ export type ModelUsageGrantClaims = z.infer<typeof modelUsageGrantClaimsSchema>;
55
+ export declare const modelUsageRecordSchema: z.ZodEffects<z.ZodObject<{
56
+ schemaVersion: z.ZodLiteral<1>;
57
+ recordId: z.ZodString;
58
+ requestId: z.ZodString;
59
+ revision: z.ZodNumber;
60
+ scopeId: z.ZodString;
61
+ runner: z.ZodEnum<["mar-agent", "codex", "claude-code", "opencode"]>;
62
+ sessionId: z.ZodString;
63
+ runId: z.ZodString;
64
+ modelConfigurationId: z.ZodOptional<z.ZodString>;
65
+ modelName: z.ZodOptional<z.ZodString>;
66
+ provider: z.ZodOptional<z.ZodString>;
67
+ requestedModel: z.ZodOptional<z.ZodString>;
68
+ actualModel: z.ZodOptional<z.ZodString>;
69
+ responseId: z.ZodOptional<z.ZodString>;
70
+ purpose: z.ZodEnum<["conversation", "compact", "title", "other"]>;
71
+ agentRole: z.ZodEnum<["root", "subagent"]>;
72
+ startedAt: z.ZodNumber;
73
+ endedAt: z.ZodOptional<z.ZodNumber>;
74
+ state: z.ZodEnum<["running", "succeeded", "failed", "cancelled", "interrupted"]>;
75
+ inputTokens: z.ZodOptional<z.ZodString>;
76
+ outputTokens: z.ZodOptional<z.ZodString>;
77
+ cacheReadTokens: z.ZodOptional<z.ZodString>;
78
+ cacheWriteTokens: z.ZodOptional<z.ZodString>;
79
+ reasoningTokens: z.ZodOptional<z.ZodString>;
80
+ coverage: z.ZodDefault<z.ZodEnum<["request", "partial"]>>;
81
+ }, "strict", z.ZodTypeAny, {
82
+ revision: number;
83
+ requestId: string;
84
+ purpose: "conversation" | "compact" | "title" | "other";
85
+ runId: string;
86
+ sessionId: string;
87
+ scopeId: string;
88
+ schemaVersion: 1;
89
+ recordId: string;
90
+ runner: "mar-agent" | "codex" | "claude-code" | "opencode";
91
+ agentRole: "root" | "subagent";
92
+ startedAt: number;
93
+ state: "running" | "succeeded" | "failed" | "cancelled" | "interrupted";
94
+ coverage: "request" | "partial";
95
+ modelConfigurationId?: string | undefined;
96
+ modelName?: string | undefined;
97
+ provider?: string | undefined;
98
+ requestedModel?: string | undefined;
99
+ actualModel?: string | undefined;
100
+ responseId?: string | undefined;
101
+ endedAt?: number | undefined;
102
+ inputTokens?: string | undefined;
103
+ outputTokens?: string | undefined;
104
+ cacheReadTokens?: string | undefined;
105
+ cacheWriteTokens?: string | undefined;
106
+ reasoningTokens?: string | undefined;
107
+ }, {
108
+ revision: number;
109
+ requestId: string;
110
+ purpose: "conversation" | "compact" | "title" | "other";
111
+ runId: string;
112
+ sessionId: string;
113
+ scopeId: string;
114
+ schemaVersion: 1;
115
+ recordId: string;
116
+ runner: "mar-agent" | "codex" | "claude-code" | "opencode";
117
+ agentRole: "root" | "subagent";
118
+ startedAt: number;
119
+ state: "running" | "succeeded" | "failed" | "cancelled" | "interrupted";
120
+ modelConfigurationId?: string | undefined;
121
+ modelName?: string | undefined;
122
+ provider?: string | undefined;
123
+ requestedModel?: string | undefined;
124
+ actualModel?: string | undefined;
125
+ responseId?: string | undefined;
126
+ endedAt?: number | undefined;
127
+ inputTokens?: string | undefined;
128
+ outputTokens?: string | undefined;
129
+ cacheReadTokens?: string | undefined;
130
+ cacheWriteTokens?: string | undefined;
131
+ reasoningTokens?: string | undefined;
132
+ coverage?: "request" | "partial" | undefined;
133
+ }>, {
134
+ revision: number;
135
+ requestId: string;
136
+ purpose: "conversation" | "compact" | "title" | "other";
137
+ runId: string;
138
+ sessionId: string;
139
+ scopeId: string;
140
+ schemaVersion: 1;
141
+ recordId: string;
142
+ runner: "mar-agent" | "codex" | "claude-code" | "opencode";
143
+ agentRole: "root" | "subagent";
144
+ startedAt: number;
145
+ state: "running" | "succeeded" | "failed" | "cancelled" | "interrupted";
146
+ coverage: "request" | "partial";
147
+ modelConfigurationId?: string | undefined;
148
+ modelName?: string | undefined;
149
+ provider?: string | undefined;
150
+ requestedModel?: string | undefined;
151
+ actualModel?: string | undefined;
152
+ responseId?: string | undefined;
153
+ endedAt?: number | undefined;
154
+ inputTokens?: string | undefined;
155
+ outputTokens?: string | undefined;
156
+ cacheReadTokens?: string | undefined;
157
+ cacheWriteTokens?: string | undefined;
158
+ reasoningTokens?: string | undefined;
159
+ }, {
160
+ revision: number;
161
+ requestId: string;
162
+ purpose: "conversation" | "compact" | "title" | "other";
163
+ runId: string;
164
+ sessionId: string;
165
+ scopeId: string;
166
+ schemaVersion: 1;
167
+ recordId: string;
168
+ runner: "mar-agent" | "codex" | "claude-code" | "opencode";
169
+ agentRole: "root" | "subagent";
170
+ startedAt: number;
171
+ state: "running" | "succeeded" | "failed" | "cancelled" | "interrupted";
172
+ modelConfigurationId?: string | undefined;
173
+ modelName?: string | undefined;
174
+ provider?: string | undefined;
175
+ requestedModel?: string | undefined;
176
+ actualModel?: string | undefined;
177
+ responseId?: string | undefined;
178
+ endedAt?: number | undefined;
179
+ inputTokens?: string | undefined;
180
+ outputTokens?: string | undefined;
181
+ cacheReadTokens?: string | undefined;
182
+ cacheWriteTokens?: string | undefined;
183
+ reasoningTokens?: string | undefined;
184
+ coverage?: "request" | "partial" | undefined;
185
+ }>;
186
+ export type ModelUsageRecord = z.infer<typeof modelUsageRecordSchema>;
187
+ export declare const modelUsageBatchSchema: z.ZodObject<{
188
+ apiVersion: z.ZodLiteral<1>;
189
+ entries: z.ZodArray<z.ZodObject<{
190
+ grant: z.ZodObject<{
191
+ scopeId: z.ZodString;
192
+ token: z.ZodString;
193
+ }, "strict", z.ZodTypeAny, {
194
+ scopeId: string;
195
+ token: string;
196
+ }, {
197
+ scopeId: string;
198
+ token: string;
199
+ }>;
200
+ record: z.ZodEffects<z.ZodObject<{
201
+ schemaVersion: z.ZodLiteral<1>;
202
+ recordId: z.ZodString;
203
+ requestId: z.ZodString;
204
+ revision: z.ZodNumber;
205
+ scopeId: z.ZodString;
206
+ runner: z.ZodEnum<["mar-agent", "codex", "claude-code", "opencode"]>;
207
+ sessionId: z.ZodString;
208
+ runId: z.ZodString;
209
+ modelConfigurationId: z.ZodOptional<z.ZodString>;
210
+ modelName: z.ZodOptional<z.ZodString>;
211
+ provider: z.ZodOptional<z.ZodString>;
212
+ requestedModel: z.ZodOptional<z.ZodString>;
213
+ actualModel: z.ZodOptional<z.ZodString>;
214
+ responseId: z.ZodOptional<z.ZodString>;
215
+ purpose: z.ZodEnum<["conversation", "compact", "title", "other"]>;
216
+ agentRole: z.ZodEnum<["root", "subagent"]>;
217
+ startedAt: z.ZodNumber;
218
+ endedAt: z.ZodOptional<z.ZodNumber>;
219
+ state: z.ZodEnum<["running", "succeeded", "failed", "cancelled", "interrupted"]>;
220
+ inputTokens: z.ZodOptional<z.ZodString>;
221
+ outputTokens: z.ZodOptional<z.ZodString>;
222
+ cacheReadTokens: z.ZodOptional<z.ZodString>;
223
+ cacheWriteTokens: z.ZodOptional<z.ZodString>;
224
+ reasoningTokens: z.ZodOptional<z.ZodString>;
225
+ coverage: z.ZodDefault<z.ZodEnum<["request", "partial"]>>;
226
+ }, "strict", z.ZodTypeAny, {
227
+ revision: number;
228
+ requestId: string;
229
+ purpose: "conversation" | "compact" | "title" | "other";
230
+ runId: string;
231
+ sessionId: string;
232
+ scopeId: string;
233
+ schemaVersion: 1;
234
+ recordId: string;
235
+ runner: "mar-agent" | "codex" | "claude-code" | "opencode";
236
+ agentRole: "root" | "subagent";
237
+ startedAt: number;
238
+ state: "running" | "succeeded" | "failed" | "cancelled" | "interrupted";
239
+ coverage: "request" | "partial";
240
+ modelConfigurationId?: string | undefined;
241
+ modelName?: string | undefined;
242
+ provider?: string | undefined;
243
+ requestedModel?: string | undefined;
244
+ actualModel?: string | undefined;
245
+ responseId?: string | undefined;
246
+ endedAt?: number | undefined;
247
+ inputTokens?: string | undefined;
248
+ outputTokens?: string | undefined;
249
+ cacheReadTokens?: string | undefined;
250
+ cacheWriteTokens?: string | undefined;
251
+ reasoningTokens?: string | undefined;
252
+ }, {
253
+ revision: number;
254
+ requestId: string;
255
+ purpose: "conversation" | "compact" | "title" | "other";
256
+ runId: string;
257
+ sessionId: string;
258
+ scopeId: string;
259
+ schemaVersion: 1;
260
+ recordId: string;
261
+ runner: "mar-agent" | "codex" | "claude-code" | "opencode";
262
+ agentRole: "root" | "subagent";
263
+ startedAt: number;
264
+ state: "running" | "succeeded" | "failed" | "cancelled" | "interrupted";
265
+ modelConfigurationId?: string | undefined;
266
+ modelName?: string | undefined;
267
+ provider?: string | undefined;
268
+ requestedModel?: string | undefined;
269
+ actualModel?: string | undefined;
270
+ responseId?: string | undefined;
271
+ endedAt?: number | undefined;
272
+ inputTokens?: string | undefined;
273
+ outputTokens?: string | undefined;
274
+ cacheReadTokens?: string | undefined;
275
+ cacheWriteTokens?: string | undefined;
276
+ reasoningTokens?: string | undefined;
277
+ coverage?: "request" | "partial" | undefined;
278
+ }>, {
279
+ revision: number;
280
+ requestId: string;
281
+ purpose: "conversation" | "compact" | "title" | "other";
282
+ runId: string;
283
+ sessionId: string;
284
+ scopeId: string;
285
+ schemaVersion: 1;
286
+ recordId: string;
287
+ runner: "mar-agent" | "codex" | "claude-code" | "opencode";
288
+ agentRole: "root" | "subagent";
289
+ startedAt: number;
290
+ state: "running" | "succeeded" | "failed" | "cancelled" | "interrupted";
291
+ coverage: "request" | "partial";
292
+ modelConfigurationId?: string | undefined;
293
+ modelName?: string | undefined;
294
+ provider?: string | undefined;
295
+ requestedModel?: string | undefined;
296
+ actualModel?: string | undefined;
297
+ responseId?: string | undefined;
298
+ endedAt?: number | undefined;
299
+ inputTokens?: string | undefined;
300
+ outputTokens?: string | undefined;
301
+ cacheReadTokens?: string | undefined;
302
+ cacheWriteTokens?: string | undefined;
303
+ reasoningTokens?: string | undefined;
304
+ }, {
305
+ revision: number;
306
+ requestId: string;
307
+ purpose: "conversation" | "compact" | "title" | "other";
308
+ runId: string;
309
+ sessionId: string;
310
+ scopeId: string;
311
+ schemaVersion: 1;
312
+ recordId: string;
313
+ runner: "mar-agent" | "codex" | "claude-code" | "opencode";
314
+ agentRole: "root" | "subagent";
315
+ startedAt: number;
316
+ state: "running" | "succeeded" | "failed" | "cancelled" | "interrupted";
317
+ modelConfigurationId?: string | undefined;
318
+ modelName?: string | undefined;
319
+ provider?: string | undefined;
320
+ requestedModel?: string | undefined;
321
+ actualModel?: string | undefined;
322
+ responseId?: string | undefined;
323
+ endedAt?: number | undefined;
324
+ inputTokens?: string | undefined;
325
+ outputTokens?: string | undefined;
326
+ cacheReadTokens?: string | undefined;
327
+ cacheWriteTokens?: string | undefined;
328
+ reasoningTokens?: string | undefined;
329
+ coverage?: "request" | "partial" | undefined;
330
+ }>;
331
+ }, "strict", z.ZodTypeAny, {
332
+ grant: {
333
+ scopeId: string;
334
+ token: string;
335
+ };
336
+ record: {
337
+ revision: number;
338
+ requestId: string;
339
+ purpose: "conversation" | "compact" | "title" | "other";
340
+ runId: string;
341
+ sessionId: string;
342
+ scopeId: string;
343
+ schemaVersion: 1;
344
+ recordId: string;
345
+ runner: "mar-agent" | "codex" | "claude-code" | "opencode";
346
+ agentRole: "root" | "subagent";
347
+ startedAt: number;
348
+ state: "running" | "succeeded" | "failed" | "cancelled" | "interrupted";
349
+ coverage: "request" | "partial";
350
+ modelConfigurationId?: string | undefined;
351
+ modelName?: string | undefined;
352
+ provider?: string | undefined;
353
+ requestedModel?: string | undefined;
354
+ actualModel?: string | undefined;
355
+ responseId?: string | undefined;
356
+ endedAt?: number | undefined;
357
+ inputTokens?: string | undefined;
358
+ outputTokens?: string | undefined;
359
+ cacheReadTokens?: string | undefined;
360
+ cacheWriteTokens?: string | undefined;
361
+ reasoningTokens?: string | undefined;
362
+ };
363
+ }, {
364
+ grant: {
365
+ scopeId: string;
366
+ token: string;
367
+ };
368
+ record: {
369
+ revision: number;
370
+ requestId: string;
371
+ purpose: "conversation" | "compact" | "title" | "other";
372
+ runId: string;
373
+ sessionId: string;
374
+ scopeId: string;
375
+ schemaVersion: 1;
376
+ recordId: string;
377
+ runner: "mar-agent" | "codex" | "claude-code" | "opencode";
378
+ agentRole: "root" | "subagent";
379
+ startedAt: number;
380
+ state: "running" | "succeeded" | "failed" | "cancelled" | "interrupted";
381
+ modelConfigurationId?: string | undefined;
382
+ modelName?: string | undefined;
383
+ provider?: string | undefined;
384
+ requestedModel?: string | undefined;
385
+ actualModel?: string | undefined;
386
+ responseId?: string | undefined;
387
+ endedAt?: number | undefined;
388
+ inputTokens?: string | undefined;
389
+ outputTokens?: string | undefined;
390
+ cacheReadTokens?: string | undefined;
391
+ cacheWriteTokens?: string | undefined;
392
+ reasoningTokens?: string | undefined;
393
+ coverage?: "request" | "partial" | undefined;
394
+ };
395
+ }>, "many">;
396
+ }, "strict", z.ZodTypeAny, {
397
+ entries: {
398
+ grant: {
399
+ scopeId: string;
400
+ token: string;
401
+ };
402
+ record: {
403
+ revision: number;
404
+ requestId: string;
405
+ purpose: "conversation" | "compact" | "title" | "other";
406
+ runId: string;
407
+ sessionId: string;
408
+ scopeId: string;
409
+ schemaVersion: 1;
410
+ recordId: string;
411
+ runner: "mar-agent" | "codex" | "claude-code" | "opencode";
412
+ agentRole: "root" | "subagent";
413
+ startedAt: number;
414
+ state: "running" | "succeeded" | "failed" | "cancelled" | "interrupted";
415
+ coverage: "request" | "partial";
416
+ modelConfigurationId?: string | undefined;
417
+ modelName?: string | undefined;
418
+ provider?: string | undefined;
419
+ requestedModel?: string | undefined;
420
+ actualModel?: string | undefined;
421
+ responseId?: string | undefined;
422
+ endedAt?: number | undefined;
423
+ inputTokens?: string | undefined;
424
+ outputTokens?: string | undefined;
425
+ cacheReadTokens?: string | undefined;
426
+ cacheWriteTokens?: string | undefined;
427
+ reasoningTokens?: string | undefined;
428
+ };
429
+ }[];
430
+ apiVersion: 1;
431
+ }, {
432
+ entries: {
433
+ grant: {
434
+ scopeId: string;
435
+ token: string;
436
+ };
437
+ record: {
438
+ revision: number;
439
+ requestId: string;
440
+ purpose: "conversation" | "compact" | "title" | "other";
441
+ runId: string;
442
+ sessionId: string;
443
+ scopeId: string;
444
+ schemaVersion: 1;
445
+ recordId: string;
446
+ runner: "mar-agent" | "codex" | "claude-code" | "opencode";
447
+ agentRole: "root" | "subagent";
448
+ startedAt: number;
449
+ state: "running" | "succeeded" | "failed" | "cancelled" | "interrupted";
450
+ modelConfigurationId?: string | undefined;
451
+ modelName?: string | undefined;
452
+ provider?: string | undefined;
453
+ requestedModel?: string | undefined;
454
+ actualModel?: string | undefined;
455
+ responseId?: string | undefined;
456
+ endedAt?: number | undefined;
457
+ inputTokens?: string | undefined;
458
+ outputTokens?: string | undefined;
459
+ cacheReadTokens?: string | undefined;
460
+ cacheWriteTokens?: string | undefined;
461
+ reasoningTokens?: string | undefined;
462
+ coverage?: "request" | "partial" | undefined;
463
+ };
464
+ }[];
465
+ apiVersion: 1;
466
+ }>;
467
+ export type ModelUsageBatch = z.infer<typeof modelUsageBatchSchema>;
468
+ export declare const modelUsageAckSchema: z.ZodObject<{
469
+ apiVersion: z.ZodLiteral<1>;
470
+ results: z.ZodArray<z.ZodObject<{
471
+ recordId: z.ZodString;
472
+ revision: z.ZodNumber;
473
+ status: z.ZodEnum<["accepted", "rejected"]>;
474
+ code: z.ZodOptional<z.ZodEnum<["USAGE_GRANT_INVALID", "USAGE_EXPIRED", "USAGE_USER_DELETED", "USAGE_CONFLICT", "USAGE_TIME_INVALID"]>>;
475
+ }, "strict", z.ZodTypeAny, {
476
+ status: "accepted" | "rejected";
477
+ revision: number;
478
+ recordId: string;
479
+ code?: "USAGE_GRANT_INVALID" | "USAGE_EXPIRED" | "USAGE_USER_DELETED" | "USAGE_CONFLICT" | "USAGE_TIME_INVALID" | undefined;
480
+ }, {
481
+ status: "accepted" | "rejected";
482
+ revision: number;
483
+ recordId: string;
484
+ code?: "USAGE_GRANT_INVALID" | "USAGE_EXPIRED" | "USAGE_USER_DELETED" | "USAGE_CONFLICT" | "USAGE_TIME_INVALID" | undefined;
485
+ }>, "many">;
486
+ }, "strict", z.ZodTypeAny, {
487
+ apiVersion: 1;
488
+ results: {
489
+ status: "accepted" | "rejected";
490
+ revision: number;
491
+ recordId: string;
492
+ code?: "USAGE_GRANT_INVALID" | "USAGE_EXPIRED" | "USAGE_USER_DELETED" | "USAGE_CONFLICT" | "USAGE_TIME_INVALID" | undefined;
493
+ }[];
494
+ }, {
495
+ apiVersion: 1;
496
+ results: {
497
+ status: "accepted" | "rejected";
498
+ revision: number;
499
+ recordId: string;
500
+ code?: "USAGE_GRANT_INVALID" | "USAGE_EXPIRED" | "USAGE_USER_DELETED" | "USAGE_CONFLICT" | "USAGE_TIME_INVALID" | undefined;
501
+ }[];
502
+ }>;
503
+ export type ModelUsageAck = z.infer<typeof modelUsageAckSchema>;
504
+ export declare const personalUsageQuerySchema: z.ZodEffects<z.ZodObject<{
505
+ from: z.ZodNumber;
506
+ to: z.ZodNumber;
507
+ timeZone: z.ZodEffects<z.ZodString, string, string>;
508
+ runner: z.ZodOptional<z.ZodEnum<["mar-agent", "codex", "claude-code", "opencode"]>>;
509
+ model: z.ZodOptional<z.ZodString>;
510
+ mode: z.ZodOptional<z.ZodEnum<["work", "conversation"]>>;
511
+ purpose: z.ZodOptional<z.ZodEnum<["conversation", "compact", "title", "other"]>>;
512
+ }, "strict", z.ZodTypeAny, {
513
+ from: number;
514
+ to: number;
515
+ timeZone: string;
516
+ purpose?: "conversation" | "compact" | "title" | "other" | undefined;
517
+ mode?: "conversation" | "work" | undefined;
518
+ runner?: "mar-agent" | "codex" | "claude-code" | "opencode" | undefined;
519
+ model?: string | undefined;
520
+ }, {
521
+ from: number;
522
+ to: number;
523
+ timeZone: string;
524
+ purpose?: "conversation" | "compact" | "title" | "other" | undefined;
525
+ mode?: "conversation" | "work" | undefined;
526
+ runner?: "mar-agent" | "codex" | "claude-code" | "opencode" | undefined;
527
+ model?: string | undefined;
528
+ }>, {
529
+ from: number;
530
+ to: number;
531
+ timeZone: string;
532
+ purpose?: "conversation" | "compact" | "title" | "other" | undefined;
533
+ mode?: "conversation" | "work" | undefined;
534
+ runner?: "mar-agent" | "codex" | "claude-code" | "opencode" | undefined;
535
+ model?: string | undefined;
536
+ }, {
537
+ from: number;
538
+ to: number;
539
+ timeZone: string;
540
+ purpose?: "conversation" | "compact" | "title" | "other" | undefined;
541
+ mode?: "conversation" | "work" | undefined;
542
+ runner?: "mar-agent" | "codex" | "claude-code" | "opencode" | undefined;
543
+ model?: string | undefined;
544
+ }>;
545
+ export type PersonalUsageQuery = z.infer<typeof personalUsageQuerySchema>;
546
+ export interface UsageTotals {
547
+ inputTokens: string;
548
+ outputTokens: string;
549
+ totalTokens: string;
550
+ requests: string;
551
+ completeRequests: string;
552
+ partialRequests: string;
553
+ unknownRequests: string;
554
+ }
555
+ export interface UsageGroup extends UsageTotals {
556
+ key: string;
557
+ label: string;
558
+ }
559
+ export interface PersonalUsageOverview {
560
+ asOf: number;
561
+ availableFrom: number;
562
+ firstRecordedAt: number | null;
563
+ lastReceivedAt: number | null;
564
+ last24Hours: UsageTotals;
565
+ last7Days: UsageTotals;
566
+ selected: UsageTotals;
567
+ buckets: (UsageTotals & {
568
+ from: number;
569
+ to: number;
570
+ })[];
571
+ runners: UsageGroup[];
572
+ models: UsageGroup[];
573
+ coverage: 'observed-only';
574
+ }
575
+ export interface PersonalUsageRecords {
576
+ records: (ModelUsageRecord & {
577
+ ledgerId: string;
578
+ mode: 'work' | 'conversation';
579
+ totalTokens: string | null;
580
+ })[];
581
+ nextCursor: string | null;
582
+ }