@phosphorco/bb-thread-metrics 0.0.0-stage → 0.1.0

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,940 @@
1
+ import { z } from 'zod';
2
+ export type { UsageVector } from '@phosphorco/bb-usage-algebra/vector';
3
+ export declare const LIMITS: Readonly<{
4
+ threadIds: 200;
5
+ seriesPoints: 288;
6
+ detailRows: 200;
7
+ inputBytes: 65536;
8
+ outputBytes: 2097152;
9
+ describeBytes: 16384;
10
+ candidates: 128;
11
+ listedPlugins: 10000;
12
+ concurrency: 4;
13
+ callMs: 2000;
14
+ discoveryMs: 5000;
15
+ familyEdges: 50000;
16
+ familyMembers: 10000;
17
+ familyDepth: 256;
18
+ }>;
19
+ export declare const METRIC_BUCKET_MS = 300000;
20
+ /** Retained last-N fixed buckets; lifetime time rows still obey seven-day retention. */
21
+ export declare function retainedWindowStart(asOf: number, window: z.infer<typeof windowSchema>): number;
22
+ export declare const METHODS: Readonly<{
23
+ describe: "threadMetricsDescribe";
24
+ read: "threadMetricsReadV1";
25
+ detail: "threadMetricsDetailV1";
26
+ }>;
27
+ export declare const windowSchema: z.ZodEnum<{
28
+ m20: "m20";
29
+ h24: "h24";
30
+ d7: "d7";
31
+ lifetime: "lifetime";
32
+ }>;
33
+ export declare const coverageSchema: z.ZodEnum<{
34
+ complete: "complete";
35
+ partial: "partial";
36
+ unknown: "unknown";
37
+ }>;
38
+ export declare const coverageReasonSchema: z.ZodEnum<{
39
+ "source-gap": "source-gap";
40
+ "root-unattested": "root-unattested";
41
+ "history-unavailable": "history-unavailable";
42
+ "member-cap": "member-cap";
43
+ "depth-cap": "depth-cap";
44
+ "edge-cap": "edge-cap";
45
+ "missing-thread": "missing-thread";
46
+ unpriced: "unpriced";
47
+ retention: "retention";
48
+ "row-cap": "row-cap";
49
+ pagination: "pagination";
50
+ "population-incomplete": "population-incomplete";
51
+ }>;
52
+ export declare const approximationSchema: z.ZodObject<{
53
+ approximate: z.ZodBoolean;
54
+ reasons: z.ZodArray<z.ZodEnum<{
55
+ "source-gap": "source-gap";
56
+ "closest-model": "closest-model";
57
+ "provider-default": "provider-default";
58
+ "model-attribution": "model-attribution";
59
+ "bucket-boundary": "bucket-boundary";
60
+ "missing-price": "missing-price";
61
+ }>>;
62
+ rates: z.ZodOptional<z.ZodArray<z.ZodObject<{
63
+ providerId: z.ZodString;
64
+ modelId: z.ZodString;
65
+ rateId: z.ZodNullable<z.ZodString>;
66
+ basis: z.ZodEnum<{
67
+ unpriced: "unpriced";
68
+ "closest-model": "closest-model";
69
+ "provider-default": "provider-default";
70
+ matched: "matched";
71
+ }>;
72
+ }, z.core.$strip>>>;
73
+ }, z.core.$strip>;
74
+ export declare const ranksSchema: z.ZodObject<{
75
+ m20: z.ZodNullable<z.ZodNumber>;
76
+ h24: z.ZodNullable<z.ZodNumber>;
77
+ d7: z.ZodNullable<z.ZodNumber>;
78
+ }, z.core.$strip>;
79
+ export declare const rankPopulationSchema: z.ZodObject<{
80
+ m20: z.ZodObject<{
81
+ asOf: z.ZodNumber;
82
+ count: z.ZodNumber;
83
+ coverage: z.ZodEnum<{
84
+ complete: "complete";
85
+ partial: "partial";
86
+ unknown: "unknown";
87
+ }>;
88
+ }, z.core.$strip>;
89
+ h24: z.ZodObject<{
90
+ asOf: z.ZodNumber;
91
+ count: z.ZodNumber;
92
+ coverage: z.ZodEnum<{
93
+ complete: "complete";
94
+ partial: "partial";
95
+ unknown: "unknown";
96
+ }>;
97
+ }, z.core.$strip>;
98
+ d7: z.ZodObject<{
99
+ asOf: z.ZodNumber;
100
+ count: z.ZodNumber;
101
+ coverage: z.ZodEnum<{
102
+ complete: "complete";
103
+ partial: "partial";
104
+ unknown: "unknown";
105
+ }>;
106
+ }, z.core.$strip>;
107
+ }, z.core.$strip>;
108
+ export declare const windowValueSchema: z.ZodObject<{
109
+ tokens: z.ZodObject<{
110
+ inputUncached: z.ZodNumber;
111
+ cacheRead: z.ZodNumber;
112
+ cacheWrite: z.ZodNumber;
113
+ output: z.ZodNumber;
114
+ }, z.core.$strip>;
115
+ amount: z.ZodNullable<z.ZodNumber>;
116
+ }, z.core.$strip>;
117
+ export declare const windowsSchema: z.ZodObject<{
118
+ m20: z.ZodObject<{
119
+ tokens: z.ZodObject<{
120
+ inputUncached: z.ZodNumber;
121
+ cacheRead: z.ZodNumber;
122
+ cacheWrite: z.ZodNumber;
123
+ output: z.ZodNumber;
124
+ }, z.core.$strip>;
125
+ amount: z.ZodNullable<z.ZodNumber>;
126
+ }, z.core.$strip>;
127
+ h24: z.ZodObject<{
128
+ tokens: z.ZodObject<{
129
+ inputUncached: z.ZodNumber;
130
+ cacheRead: z.ZodNumber;
131
+ cacheWrite: z.ZodNumber;
132
+ output: z.ZodNumber;
133
+ }, z.core.$strip>;
134
+ amount: z.ZodNullable<z.ZodNumber>;
135
+ }, z.core.$strip>;
136
+ d7: z.ZodObject<{
137
+ tokens: z.ZodObject<{
138
+ inputUncached: z.ZodNumber;
139
+ cacheRead: z.ZodNumber;
140
+ cacheWrite: z.ZodNumber;
141
+ output: z.ZodNumber;
142
+ }, z.core.$strip>;
143
+ amount: z.ZodNullable<z.ZodNumber>;
144
+ }, z.core.$strip>;
145
+ lifetime: z.ZodObject<{
146
+ tokens: z.ZodObject<{
147
+ inputUncached: z.ZodNumber;
148
+ cacheRead: z.ZodNumber;
149
+ cacheWrite: z.ZodNumber;
150
+ output: z.ZodNumber;
151
+ }, z.core.$strip>;
152
+ amount: z.ZodNullable<z.ZodNumber>;
153
+ }, z.core.$strip>;
154
+ }, z.core.$strip>;
155
+ export declare const bucketSchema: z.ZodObject<{
156
+ start: z.ZodNumber;
157
+ amount: z.ZodNullable<z.ZodNumber>;
158
+ }, z.core.$strip>;
159
+ export declare const summaryRowSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
160
+ changed: z.ZodLiteral<true>;
161
+ windows: z.ZodObject<{
162
+ m20: z.ZodObject<{
163
+ tokens: z.ZodObject<{
164
+ inputUncached: z.ZodNumber;
165
+ cacheRead: z.ZodNumber;
166
+ cacheWrite: z.ZodNumber;
167
+ output: z.ZodNumber;
168
+ }, z.core.$strip>;
169
+ amount: z.ZodNullable<z.ZodNumber>;
170
+ }, z.core.$strip>;
171
+ h24: z.ZodObject<{
172
+ tokens: z.ZodObject<{
173
+ inputUncached: z.ZodNumber;
174
+ cacheRead: z.ZodNumber;
175
+ cacheWrite: z.ZodNumber;
176
+ output: z.ZodNumber;
177
+ }, z.core.$strip>;
178
+ amount: z.ZodNullable<z.ZodNumber>;
179
+ }, z.core.$strip>;
180
+ d7: z.ZodObject<{
181
+ tokens: z.ZodObject<{
182
+ inputUncached: z.ZodNumber;
183
+ cacheRead: z.ZodNumber;
184
+ cacheWrite: z.ZodNumber;
185
+ output: z.ZodNumber;
186
+ }, z.core.$strip>;
187
+ amount: z.ZodNullable<z.ZodNumber>;
188
+ }, z.core.$strip>;
189
+ lifetime: z.ZodObject<{
190
+ tokens: z.ZodObject<{
191
+ inputUncached: z.ZodNumber;
192
+ cacheRead: z.ZodNumber;
193
+ cacheWrite: z.ZodNumber;
194
+ output: z.ZodNumber;
195
+ }, z.core.$strip>;
196
+ amount: z.ZodNullable<z.ZodNumber>;
197
+ }, z.core.$strip>;
198
+ }, z.core.$strip>;
199
+ buckets: z.ZodOptional<z.ZodArray<z.ZodObject<{
200
+ start: z.ZodNumber;
201
+ amount: z.ZodNullable<z.ZodNumber>;
202
+ }, z.core.$strip>>>;
203
+ threadId: z.ZodString;
204
+ scope: z.ZodEnum<{
205
+ own: "own";
206
+ family: "family";
207
+ }>;
208
+ memberCount: z.ZodNumber;
209
+ coverage: z.ZodEnum<{
210
+ complete: "complete";
211
+ partial: "partial";
212
+ unknown: "unknown";
213
+ }>;
214
+ coverageReasons: z.ZodArray<z.ZodEnum<{
215
+ "source-gap": "source-gap";
216
+ "root-unattested": "root-unattested";
217
+ "history-unavailable": "history-unavailable";
218
+ "member-cap": "member-cap";
219
+ "depth-cap": "depth-cap";
220
+ "edge-cap": "edge-cap";
221
+ "missing-thread": "missing-thread";
222
+ unpriced: "unpriced";
223
+ retention: "retention";
224
+ "row-cap": "row-cap";
225
+ pagination: "pagination";
226
+ "population-incomplete": "population-incomplete";
227
+ }>>;
228
+ excluded: z.ZodOptional<z.ZodNumber>;
229
+ asOf: z.ZodNumber;
230
+ revision: z.ZodString;
231
+ priceVersion: z.ZodString;
232
+ currency: z.ZodLiteral<"USD">;
233
+ estimated: z.ZodLiteral<true>;
234
+ approximation: z.ZodObject<{
235
+ approximate: z.ZodBoolean;
236
+ reasons: z.ZodArray<z.ZodEnum<{
237
+ "source-gap": "source-gap";
238
+ "closest-model": "closest-model";
239
+ "provider-default": "provider-default";
240
+ "model-attribution": "model-attribution";
241
+ "bucket-boundary": "bucket-boundary";
242
+ "missing-price": "missing-price";
243
+ }>>;
244
+ rates: z.ZodOptional<z.ZodArray<z.ZodObject<{
245
+ providerId: z.ZodString;
246
+ modelId: z.ZodString;
247
+ rateId: z.ZodNullable<z.ZodString>;
248
+ basis: z.ZodEnum<{
249
+ unpriced: "unpriced";
250
+ "closest-model": "closest-model";
251
+ "provider-default": "provider-default";
252
+ matched: "matched";
253
+ }>;
254
+ }, z.core.$strip>>>;
255
+ }, z.core.$strip>;
256
+ ranks: z.ZodObject<{
257
+ m20: z.ZodNullable<z.ZodNumber>;
258
+ h24: z.ZodNullable<z.ZodNumber>;
259
+ d7: z.ZodNullable<z.ZodNumber>;
260
+ }, z.core.$strip>;
261
+ rankPopulation: z.ZodObject<{
262
+ m20: z.ZodObject<{
263
+ asOf: z.ZodNumber;
264
+ count: z.ZodNumber;
265
+ coverage: z.ZodEnum<{
266
+ complete: "complete";
267
+ partial: "partial";
268
+ unknown: "unknown";
269
+ }>;
270
+ }, z.core.$strip>;
271
+ h24: z.ZodObject<{
272
+ asOf: z.ZodNumber;
273
+ count: z.ZodNumber;
274
+ coverage: z.ZodEnum<{
275
+ complete: "complete";
276
+ partial: "partial";
277
+ unknown: "unknown";
278
+ }>;
279
+ }, z.core.$strip>;
280
+ d7: z.ZodObject<{
281
+ asOf: z.ZodNumber;
282
+ count: z.ZodNumber;
283
+ coverage: z.ZodEnum<{
284
+ complete: "complete";
285
+ partial: "partial";
286
+ unknown: "unknown";
287
+ }>;
288
+ }, z.core.$strip>;
289
+ }, z.core.$strip>;
290
+ reported: z.ZodOptional<z.ZodObject<{
291
+ amount: z.ZodNumber;
292
+ currency: z.ZodString;
293
+ asOf: z.ZodNumber;
294
+ }, z.core.$strip>>;
295
+ }, z.core.$strip>, z.ZodObject<{
296
+ changed: z.ZodLiteral<false>;
297
+ windows: z.ZodOptional<z.ZodNever>;
298
+ buckets: z.ZodOptional<z.ZodNever>;
299
+ threadId: z.ZodString;
300
+ scope: z.ZodEnum<{
301
+ own: "own";
302
+ family: "family";
303
+ }>;
304
+ memberCount: z.ZodNumber;
305
+ coverage: z.ZodEnum<{
306
+ complete: "complete";
307
+ partial: "partial";
308
+ unknown: "unknown";
309
+ }>;
310
+ coverageReasons: z.ZodArray<z.ZodEnum<{
311
+ "source-gap": "source-gap";
312
+ "root-unattested": "root-unattested";
313
+ "history-unavailable": "history-unavailable";
314
+ "member-cap": "member-cap";
315
+ "depth-cap": "depth-cap";
316
+ "edge-cap": "edge-cap";
317
+ "missing-thread": "missing-thread";
318
+ unpriced: "unpriced";
319
+ retention: "retention";
320
+ "row-cap": "row-cap";
321
+ pagination: "pagination";
322
+ "population-incomplete": "population-incomplete";
323
+ }>>;
324
+ excluded: z.ZodOptional<z.ZodNumber>;
325
+ asOf: z.ZodNumber;
326
+ revision: z.ZodString;
327
+ priceVersion: z.ZodString;
328
+ currency: z.ZodLiteral<"USD">;
329
+ estimated: z.ZodLiteral<true>;
330
+ approximation: z.ZodObject<{
331
+ approximate: z.ZodBoolean;
332
+ reasons: z.ZodArray<z.ZodEnum<{
333
+ "source-gap": "source-gap";
334
+ "closest-model": "closest-model";
335
+ "provider-default": "provider-default";
336
+ "model-attribution": "model-attribution";
337
+ "bucket-boundary": "bucket-boundary";
338
+ "missing-price": "missing-price";
339
+ }>>;
340
+ rates: z.ZodOptional<z.ZodArray<z.ZodObject<{
341
+ providerId: z.ZodString;
342
+ modelId: z.ZodString;
343
+ rateId: z.ZodNullable<z.ZodString>;
344
+ basis: z.ZodEnum<{
345
+ unpriced: "unpriced";
346
+ "closest-model": "closest-model";
347
+ "provider-default": "provider-default";
348
+ matched: "matched";
349
+ }>;
350
+ }, z.core.$strip>>>;
351
+ }, z.core.$strip>;
352
+ ranks: z.ZodObject<{
353
+ m20: z.ZodNullable<z.ZodNumber>;
354
+ h24: z.ZodNullable<z.ZodNumber>;
355
+ d7: z.ZodNullable<z.ZodNumber>;
356
+ }, z.core.$strip>;
357
+ rankPopulation: z.ZodObject<{
358
+ m20: z.ZodObject<{
359
+ asOf: z.ZodNumber;
360
+ count: z.ZodNumber;
361
+ coverage: z.ZodEnum<{
362
+ complete: "complete";
363
+ partial: "partial";
364
+ unknown: "unknown";
365
+ }>;
366
+ }, z.core.$strip>;
367
+ h24: z.ZodObject<{
368
+ asOf: z.ZodNumber;
369
+ count: z.ZodNumber;
370
+ coverage: z.ZodEnum<{
371
+ complete: "complete";
372
+ partial: "partial";
373
+ unknown: "unknown";
374
+ }>;
375
+ }, z.core.$strip>;
376
+ d7: z.ZodObject<{
377
+ asOf: z.ZodNumber;
378
+ count: z.ZodNumber;
379
+ coverage: z.ZodEnum<{
380
+ complete: "complete";
381
+ partial: "partial";
382
+ unknown: "unknown";
383
+ }>;
384
+ }, z.core.$strip>;
385
+ }, z.core.$strip>;
386
+ reported: z.ZodOptional<z.ZodObject<{
387
+ amount: z.ZodNumber;
388
+ currency: z.ZodString;
389
+ asOf: z.ZodNumber;
390
+ }, z.core.$strip>>;
391
+ }, z.core.$strip>], "changed">;
392
+ export declare const readInputSchema: z.ZodObject<{
393
+ threadIds: z.ZodArray<z.ZodString>;
394
+ scope: z.ZodEnum<{
395
+ own: "own";
396
+ family: "family";
397
+ }>;
398
+ includeArchived: z.ZodOptional<z.ZodBoolean>;
399
+ knownRevisions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
400
+ series: z.ZodOptional<z.ZodObject<{
401
+ activeThreadId: z.ZodString;
402
+ maxPoints: z.ZodNumber;
403
+ }, z.core.$strict>>;
404
+ }, z.core.$strict>;
405
+ export declare const readResultSchema: z.ZodObject<{
406
+ version: z.ZodLiteral<1>;
407
+ rows: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
408
+ changed: z.ZodLiteral<true>;
409
+ windows: z.ZodObject<{
410
+ m20: z.ZodObject<{
411
+ tokens: z.ZodObject<{
412
+ inputUncached: z.ZodNumber;
413
+ cacheRead: z.ZodNumber;
414
+ cacheWrite: z.ZodNumber;
415
+ output: z.ZodNumber;
416
+ }, z.core.$strip>;
417
+ amount: z.ZodNullable<z.ZodNumber>;
418
+ }, z.core.$strip>;
419
+ h24: z.ZodObject<{
420
+ tokens: z.ZodObject<{
421
+ inputUncached: z.ZodNumber;
422
+ cacheRead: z.ZodNumber;
423
+ cacheWrite: z.ZodNumber;
424
+ output: z.ZodNumber;
425
+ }, z.core.$strip>;
426
+ amount: z.ZodNullable<z.ZodNumber>;
427
+ }, z.core.$strip>;
428
+ d7: z.ZodObject<{
429
+ tokens: z.ZodObject<{
430
+ inputUncached: z.ZodNumber;
431
+ cacheRead: z.ZodNumber;
432
+ cacheWrite: z.ZodNumber;
433
+ output: z.ZodNumber;
434
+ }, z.core.$strip>;
435
+ amount: z.ZodNullable<z.ZodNumber>;
436
+ }, z.core.$strip>;
437
+ lifetime: z.ZodObject<{
438
+ tokens: z.ZodObject<{
439
+ inputUncached: z.ZodNumber;
440
+ cacheRead: z.ZodNumber;
441
+ cacheWrite: z.ZodNumber;
442
+ output: z.ZodNumber;
443
+ }, z.core.$strip>;
444
+ amount: z.ZodNullable<z.ZodNumber>;
445
+ }, z.core.$strip>;
446
+ }, z.core.$strip>;
447
+ buckets: z.ZodOptional<z.ZodArray<z.ZodObject<{
448
+ start: z.ZodNumber;
449
+ amount: z.ZodNullable<z.ZodNumber>;
450
+ }, z.core.$strip>>>;
451
+ threadId: z.ZodString;
452
+ scope: z.ZodEnum<{
453
+ own: "own";
454
+ family: "family";
455
+ }>;
456
+ memberCount: z.ZodNumber;
457
+ coverage: z.ZodEnum<{
458
+ complete: "complete";
459
+ partial: "partial";
460
+ unknown: "unknown";
461
+ }>;
462
+ coverageReasons: z.ZodArray<z.ZodEnum<{
463
+ "source-gap": "source-gap";
464
+ "root-unattested": "root-unattested";
465
+ "history-unavailable": "history-unavailable";
466
+ "member-cap": "member-cap";
467
+ "depth-cap": "depth-cap";
468
+ "edge-cap": "edge-cap";
469
+ "missing-thread": "missing-thread";
470
+ unpriced: "unpriced";
471
+ retention: "retention";
472
+ "row-cap": "row-cap";
473
+ pagination: "pagination";
474
+ "population-incomplete": "population-incomplete";
475
+ }>>;
476
+ excluded: z.ZodOptional<z.ZodNumber>;
477
+ asOf: z.ZodNumber;
478
+ revision: z.ZodString;
479
+ priceVersion: z.ZodString;
480
+ currency: z.ZodLiteral<"USD">;
481
+ estimated: z.ZodLiteral<true>;
482
+ approximation: z.ZodObject<{
483
+ approximate: z.ZodBoolean;
484
+ reasons: z.ZodArray<z.ZodEnum<{
485
+ "source-gap": "source-gap";
486
+ "closest-model": "closest-model";
487
+ "provider-default": "provider-default";
488
+ "model-attribution": "model-attribution";
489
+ "bucket-boundary": "bucket-boundary";
490
+ "missing-price": "missing-price";
491
+ }>>;
492
+ rates: z.ZodOptional<z.ZodArray<z.ZodObject<{
493
+ providerId: z.ZodString;
494
+ modelId: z.ZodString;
495
+ rateId: z.ZodNullable<z.ZodString>;
496
+ basis: z.ZodEnum<{
497
+ unpriced: "unpriced";
498
+ "closest-model": "closest-model";
499
+ "provider-default": "provider-default";
500
+ matched: "matched";
501
+ }>;
502
+ }, z.core.$strip>>>;
503
+ }, z.core.$strip>;
504
+ ranks: z.ZodObject<{
505
+ m20: z.ZodNullable<z.ZodNumber>;
506
+ h24: z.ZodNullable<z.ZodNumber>;
507
+ d7: z.ZodNullable<z.ZodNumber>;
508
+ }, z.core.$strip>;
509
+ rankPopulation: z.ZodObject<{
510
+ m20: z.ZodObject<{
511
+ asOf: z.ZodNumber;
512
+ count: z.ZodNumber;
513
+ coverage: z.ZodEnum<{
514
+ complete: "complete";
515
+ partial: "partial";
516
+ unknown: "unknown";
517
+ }>;
518
+ }, z.core.$strip>;
519
+ h24: z.ZodObject<{
520
+ asOf: z.ZodNumber;
521
+ count: z.ZodNumber;
522
+ coverage: z.ZodEnum<{
523
+ complete: "complete";
524
+ partial: "partial";
525
+ unknown: "unknown";
526
+ }>;
527
+ }, z.core.$strip>;
528
+ d7: z.ZodObject<{
529
+ asOf: z.ZodNumber;
530
+ count: z.ZodNumber;
531
+ coverage: z.ZodEnum<{
532
+ complete: "complete";
533
+ partial: "partial";
534
+ unknown: "unknown";
535
+ }>;
536
+ }, z.core.$strip>;
537
+ }, z.core.$strip>;
538
+ reported: z.ZodOptional<z.ZodObject<{
539
+ amount: z.ZodNumber;
540
+ currency: z.ZodString;
541
+ asOf: z.ZodNumber;
542
+ }, z.core.$strip>>;
543
+ }, z.core.$strip>, z.ZodObject<{
544
+ changed: z.ZodLiteral<false>;
545
+ windows: z.ZodOptional<z.ZodNever>;
546
+ buckets: z.ZodOptional<z.ZodNever>;
547
+ threadId: z.ZodString;
548
+ scope: z.ZodEnum<{
549
+ own: "own";
550
+ family: "family";
551
+ }>;
552
+ memberCount: z.ZodNumber;
553
+ coverage: z.ZodEnum<{
554
+ complete: "complete";
555
+ partial: "partial";
556
+ unknown: "unknown";
557
+ }>;
558
+ coverageReasons: z.ZodArray<z.ZodEnum<{
559
+ "source-gap": "source-gap";
560
+ "root-unattested": "root-unattested";
561
+ "history-unavailable": "history-unavailable";
562
+ "member-cap": "member-cap";
563
+ "depth-cap": "depth-cap";
564
+ "edge-cap": "edge-cap";
565
+ "missing-thread": "missing-thread";
566
+ unpriced: "unpriced";
567
+ retention: "retention";
568
+ "row-cap": "row-cap";
569
+ pagination: "pagination";
570
+ "population-incomplete": "population-incomplete";
571
+ }>>;
572
+ excluded: z.ZodOptional<z.ZodNumber>;
573
+ asOf: z.ZodNumber;
574
+ revision: z.ZodString;
575
+ priceVersion: z.ZodString;
576
+ currency: z.ZodLiteral<"USD">;
577
+ estimated: z.ZodLiteral<true>;
578
+ approximation: z.ZodObject<{
579
+ approximate: z.ZodBoolean;
580
+ reasons: z.ZodArray<z.ZodEnum<{
581
+ "source-gap": "source-gap";
582
+ "closest-model": "closest-model";
583
+ "provider-default": "provider-default";
584
+ "model-attribution": "model-attribution";
585
+ "bucket-boundary": "bucket-boundary";
586
+ "missing-price": "missing-price";
587
+ }>>;
588
+ rates: z.ZodOptional<z.ZodArray<z.ZodObject<{
589
+ providerId: z.ZodString;
590
+ modelId: z.ZodString;
591
+ rateId: z.ZodNullable<z.ZodString>;
592
+ basis: z.ZodEnum<{
593
+ unpriced: "unpriced";
594
+ "closest-model": "closest-model";
595
+ "provider-default": "provider-default";
596
+ matched: "matched";
597
+ }>;
598
+ }, z.core.$strip>>>;
599
+ }, z.core.$strip>;
600
+ ranks: z.ZodObject<{
601
+ m20: z.ZodNullable<z.ZodNumber>;
602
+ h24: z.ZodNullable<z.ZodNumber>;
603
+ d7: z.ZodNullable<z.ZodNumber>;
604
+ }, z.core.$strip>;
605
+ rankPopulation: z.ZodObject<{
606
+ m20: z.ZodObject<{
607
+ asOf: z.ZodNumber;
608
+ count: z.ZodNumber;
609
+ coverage: z.ZodEnum<{
610
+ complete: "complete";
611
+ partial: "partial";
612
+ unknown: "unknown";
613
+ }>;
614
+ }, z.core.$strip>;
615
+ h24: z.ZodObject<{
616
+ asOf: z.ZodNumber;
617
+ count: z.ZodNumber;
618
+ coverage: z.ZodEnum<{
619
+ complete: "complete";
620
+ partial: "partial";
621
+ unknown: "unknown";
622
+ }>;
623
+ }, z.core.$strip>;
624
+ d7: z.ZodObject<{
625
+ asOf: z.ZodNumber;
626
+ count: z.ZodNumber;
627
+ coverage: z.ZodEnum<{
628
+ complete: "complete";
629
+ partial: "partial";
630
+ unknown: "unknown";
631
+ }>;
632
+ }, z.core.$strip>;
633
+ }, z.core.$strip>;
634
+ reported: z.ZodOptional<z.ZodObject<{
635
+ amount: z.ZodNumber;
636
+ currency: z.ZodString;
637
+ asOf: z.ZodNumber;
638
+ }, z.core.$strip>>;
639
+ }, z.core.$strip>], "changed">>;
640
+ }, z.core.$strip>;
641
+ export declare const detailInputSchema: z.ZodObject<{
642
+ threadId: z.ZodString;
643
+ scope: z.ZodEnum<{
644
+ own: "own";
645
+ family: "family";
646
+ }>;
647
+ includeArchived: z.ZodOptional<z.ZodBoolean>;
648
+ axis: z.ZodEnum<{
649
+ model: "model";
650
+ time: "time";
651
+ }>;
652
+ window: z.ZodEnum<{
653
+ m20: "m20";
654
+ h24: "h24";
655
+ d7: "d7";
656
+ lifetime: "lifetime";
657
+ }>;
658
+ cursor: z.ZodOptional<z.ZodString>;
659
+ limit: z.ZodOptional<z.ZodNumber>;
660
+ }, z.core.$strict>;
661
+ export declare const detailRowSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
662
+ axis: z.ZodLiteral<"model">;
663
+ providerId: z.ZodString;
664
+ modelId: z.ZodString;
665
+ amount: z.ZodNullable<z.ZodNumber>;
666
+ tokens: z.ZodObject<{
667
+ inputUncached: z.ZodNumber;
668
+ cacheRead: z.ZodNumber;
669
+ cacheWrite: z.ZodNumber;
670
+ output: z.ZodNumber;
671
+ }, z.core.$strip>;
672
+ approximation: z.ZodObject<{
673
+ approximate: z.ZodBoolean;
674
+ reasons: z.ZodArray<z.ZodEnum<{
675
+ "source-gap": "source-gap";
676
+ "closest-model": "closest-model";
677
+ "provider-default": "provider-default";
678
+ "model-attribution": "model-attribution";
679
+ "bucket-boundary": "bucket-boundary";
680
+ "missing-price": "missing-price";
681
+ }>>;
682
+ rates: z.ZodOptional<z.ZodArray<z.ZodObject<{
683
+ providerId: z.ZodString;
684
+ modelId: z.ZodString;
685
+ rateId: z.ZodNullable<z.ZodString>;
686
+ basis: z.ZodEnum<{
687
+ unpriced: "unpriced";
688
+ "closest-model": "closest-model";
689
+ "provider-default": "provider-default";
690
+ matched: "matched";
691
+ }>;
692
+ }, z.core.$strip>>>;
693
+ }, z.core.$strip>;
694
+ }, z.core.$strip>, z.ZodObject<{
695
+ axis: z.ZodLiteral<"time">;
696
+ start: z.ZodNumber;
697
+ end: z.ZodNumber;
698
+ amount: z.ZodNullable<z.ZodNumber>;
699
+ tokens: z.ZodObject<{
700
+ inputUncached: z.ZodNumber;
701
+ cacheRead: z.ZodNumber;
702
+ cacheWrite: z.ZodNumber;
703
+ output: z.ZodNumber;
704
+ }, z.core.$strip>;
705
+ approximation: z.ZodObject<{
706
+ approximate: z.ZodBoolean;
707
+ reasons: z.ZodArray<z.ZodEnum<{
708
+ "source-gap": "source-gap";
709
+ "closest-model": "closest-model";
710
+ "provider-default": "provider-default";
711
+ "model-attribution": "model-attribution";
712
+ "bucket-boundary": "bucket-boundary";
713
+ "missing-price": "missing-price";
714
+ }>>;
715
+ rates: z.ZodOptional<z.ZodArray<z.ZodObject<{
716
+ providerId: z.ZodString;
717
+ modelId: z.ZodString;
718
+ rateId: z.ZodNullable<z.ZodString>;
719
+ basis: z.ZodEnum<{
720
+ unpriced: "unpriced";
721
+ "closest-model": "closest-model";
722
+ "provider-default": "provider-default";
723
+ matched: "matched";
724
+ }>;
725
+ }, z.core.$strip>>>;
726
+ }, z.core.$strip>;
727
+ }, z.core.$strip>], "axis">;
728
+ export declare const detailResultSchema: z.ZodObject<{
729
+ version: z.ZodLiteral<1>;
730
+ threadId: z.ZodString;
731
+ scope: z.ZodEnum<{
732
+ own: "own";
733
+ family: "family";
734
+ }>;
735
+ axis: z.ZodEnum<{
736
+ model: "model";
737
+ time: "time";
738
+ }>;
739
+ window: z.ZodEnum<{
740
+ m20: "m20";
741
+ h24: "h24";
742
+ d7: "d7";
743
+ lifetime: "lifetime";
744
+ }>;
745
+ asOf: z.ZodNumber;
746
+ revision: z.ZodString;
747
+ priceVersion: z.ZodString;
748
+ currency: z.ZodLiteral<"USD">;
749
+ estimated: z.ZodLiteral<true>;
750
+ coverage: z.ZodEnum<{
751
+ complete: "complete";
752
+ partial: "partial";
753
+ unknown: "unknown";
754
+ }>;
755
+ coverageReasons: z.ZodArray<z.ZodEnum<{
756
+ "source-gap": "source-gap";
757
+ "root-unattested": "root-unattested";
758
+ "history-unavailable": "history-unavailable";
759
+ "member-cap": "member-cap";
760
+ "depth-cap": "depth-cap";
761
+ "edge-cap": "edge-cap";
762
+ "missing-thread": "missing-thread";
763
+ unpriced: "unpriced";
764
+ retention: "retention";
765
+ "row-cap": "row-cap";
766
+ pagination: "pagination";
767
+ "population-incomplete": "population-incomplete";
768
+ }>>;
769
+ excluded: z.ZodOptional<z.ZodNumber>;
770
+ approximation: z.ZodObject<{
771
+ approximate: z.ZodBoolean;
772
+ reasons: z.ZodArray<z.ZodEnum<{
773
+ "source-gap": "source-gap";
774
+ "closest-model": "closest-model";
775
+ "provider-default": "provider-default";
776
+ "model-attribution": "model-attribution";
777
+ "bucket-boundary": "bucket-boundary";
778
+ "missing-price": "missing-price";
779
+ }>>;
780
+ rates: z.ZodOptional<z.ZodArray<z.ZodObject<{
781
+ providerId: z.ZodString;
782
+ modelId: z.ZodString;
783
+ rateId: z.ZodNullable<z.ZodString>;
784
+ basis: z.ZodEnum<{
785
+ unpriced: "unpriced";
786
+ "closest-model": "closest-model";
787
+ "provider-default": "provider-default";
788
+ matched: "matched";
789
+ }>;
790
+ }, z.core.$strip>>>;
791
+ }, z.core.$strip>;
792
+ total: z.ZodObject<{
793
+ tokens: z.ZodObject<{
794
+ inputUncached: z.ZodNumber;
795
+ cacheRead: z.ZodNumber;
796
+ cacheWrite: z.ZodNumber;
797
+ output: z.ZodNumber;
798
+ }, z.core.$strip>;
799
+ amount: z.ZodNullable<z.ZodNumber>;
800
+ }, z.core.$strip>;
801
+ rows: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
802
+ axis: z.ZodLiteral<"model">;
803
+ providerId: z.ZodString;
804
+ modelId: z.ZodString;
805
+ amount: z.ZodNullable<z.ZodNumber>;
806
+ tokens: z.ZodObject<{
807
+ inputUncached: z.ZodNumber;
808
+ cacheRead: z.ZodNumber;
809
+ cacheWrite: z.ZodNumber;
810
+ output: z.ZodNumber;
811
+ }, z.core.$strip>;
812
+ approximation: z.ZodObject<{
813
+ approximate: z.ZodBoolean;
814
+ reasons: z.ZodArray<z.ZodEnum<{
815
+ "source-gap": "source-gap";
816
+ "closest-model": "closest-model";
817
+ "provider-default": "provider-default";
818
+ "model-attribution": "model-attribution";
819
+ "bucket-boundary": "bucket-boundary";
820
+ "missing-price": "missing-price";
821
+ }>>;
822
+ rates: z.ZodOptional<z.ZodArray<z.ZodObject<{
823
+ providerId: z.ZodString;
824
+ modelId: z.ZodString;
825
+ rateId: z.ZodNullable<z.ZodString>;
826
+ basis: z.ZodEnum<{
827
+ unpriced: "unpriced";
828
+ "closest-model": "closest-model";
829
+ "provider-default": "provider-default";
830
+ matched: "matched";
831
+ }>;
832
+ }, z.core.$strip>>>;
833
+ }, z.core.$strip>;
834
+ }, z.core.$strip>, z.ZodObject<{
835
+ axis: z.ZodLiteral<"time">;
836
+ start: z.ZodNumber;
837
+ end: z.ZodNumber;
838
+ amount: z.ZodNullable<z.ZodNumber>;
839
+ tokens: z.ZodObject<{
840
+ inputUncached: z.ZodNumber;
841
+ cacheRead: z.ZodNumber;
842
+ cacheWrite: z.ZodNumber;
843
+ output: z.ZodNumber;
844
+ }, z.core.$strip>;
845
+ approximation: z.ZodObject<{
846
+ approximate: z.ZodBoolean;
847
+ reasons: z.ZodArray<z.ZodEnum<{
848
+ "source-gap": "source-gap";
849
+ "closest-model": "closest-model";
850
+ "provider-default": "provider-default";
851
+ "model-attribution": "model-attribution";
852
+ "bucket-boundary": "bucket-boundary";
853
+ "missing-price": "missing-price";
854
+ }>>;
855
+ rates: z.ZodOptional<z.ZodArray<z.ZodObject<{
856
+ providerId: z.ZodString;
857
+ modelId: z.ZodString;
858
+ rateId: z.ZodNullable<z.ZodString>;
859
+ basis: z.ZodEnum<{
860
+ unpriced: "unpriced";
861
+ "closest-model": "closest-model";
862
+ "provider-default": "provider-default";
863
+ matched: "matched";
864
+ }>;
865
+ }, z.core.$strip>>>;
866
+ }, z.core.$strip>;
867
+ }, z.core.$strip>], "axis">>;
868
+ nextCursor: z.ZodOptional<z.ZodString>;
869
+ }, z.core.$strip>;
870
+ export declare const describeInputSchema: z.ZodObject<{}, z.core.$strict>;
871
+ export declare const describeEnvelopeSchema: z.ZodObject<{
872
+ protocol: z.ZodLiteral<"bb-thread-metrics">;
873
+ versions: z.ZodArray<z.ZodNumber>;
874
+ }, z.core.$loose>;
875
+ export declare const capabilitiesSchema: z.ZodObject<{
876
+ summary: z.ZodLiteral<true>;
877
+ series: z.ZodBoolean;
878
+ detail: z.ZodBoolean;
879
+ }, z.core.$strip>;
880
+ export declare const describeV1Schema: z.ZodObject<{
881
+ protocol: z.ZodLiteral<"bb-thread-metrics">;
882
+ versions: z.ZodArray<z.ZodNumber>;
883
+ capabilities: z.ZodObject<{
884
+ summary: z.ZodLiteral<true>;
885
+ series: z.ZodBoolean;
886
+ detail: z.ZodBoolean;
887
+ }, z.core.$strip>;
888
+ }, z.core.$loose>;
889
+ export type ReadInput = z.infer<typeof readInputSchema>;
890
+ export type ReadResult = z.infer<typeof readResultSchema>;
891
+ export type SummaryRow = z.infer<typeof summaryRowSchema>;
892
+ export type DetailInput = z.infer<typeof detailInputSchema>;
893
+ export type DetailResult = z.infer<typeof detailResultSchema>;
894
+ export type Capabilities = z.infer<typeof capabilitiesSchema>;
895
+ export type Ranks = z.infer<typeof ranksSchema>;
896
+ export type CoverageReason = z.infer<typeof coverageReasonSchema>;
897
+ export declare function parseBounded<T>(schema: z.ZodType<T>, value: unknown, maxBytes: number): T;
898
+ export declare function negotiateVersion(value: unknown): {
899
+ kind: 'ready';
900
+ version: 1;
901
+ capabilities: Capabilities;
902
+ } | {
903
+ kind: 'incompatible';
904
+ };
905
+ /** Host population must use the same scope/archive policy as the numerator. */
906
+ export declare function dollarPercentiles(population: readonly {
907
+ threadId: string;
908
+ amount: number | null;
909
+ }[]): Map<string, number | null>;
910
+ export declare function heat(ranks: Ranks, gates?: {
911
+ m20: number;
912
+ h24: number;
913
+ d7: number;
914
+ }): 'on-fire' | 'hot' | 'heavy' | null;
915
+ export interface ThreadEdge {
916
+ threadId: string;
917
+ parentThreadId?: string | null;
918
+ lifecycleOwnerThreadId?: string | null;
919
+ hidden?: boolean;
920
+ archived?: boolean;
921
+ deleted?: boolean;
922
+ }
923
+ export interface FamilyPolicy {
924
+ includeArchived?: boolean;
925
+ maxMembers?: number;
926
+ maxDepth?: number;
927
+ maxEdges?: number;
928
+ sourceCoverage?: 'complete' | 'partial' | 'unknown';
929
+ }
930
+ export interface FamilyResult {
931
+ members: string[];
932
+ coverage: 'complete' | 'partial' | 'unknown';
933
+ coverageReasons: CoverageReason[];
934
+ excluded?: number;
935
+ }
936
+ export declare function familyClosure(edges: readonly ThreadEdge[], roots: readonly string[], policy?: FamilyPolicy): FamilyResult;
937
+ export declare function validateReadResult(input: ReadInput, value: unknown): ReadResult;
938
+ export declare function validateDetailResult(input: DetailInput, value: unknown): DetailResult;
939
+ export type OwnerErrorKind = 'absent' | 'disabled' | 'timeout' | 'aborted' | 'malformed' | 'failed';
940
+ export declare function classifyOwnerError(error: unknown): OwnerErrorKind;