@agent-finops/core 0.8.0 → 0.9.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.
Files changed (49) hide show
  1. package/README.md +5 -3
  2. package/dist/actionPlanner.d.ts +140 -0
  3. package/dist/actionPlanner.js +938 -0
  4. package/dist/actionVerification.d.ts +1240 -0
  5. package/dist/actionVerification.js +1028 -0
  6. package/dist/activitySnapshot.d.ts +101 -9
  7. package/dist/activitySnapshot.js +145 -6
  8. package/dist/activitySnapshotCache.d.ts +8 -1
  9. package/dist/activitySnapshotCache.js +103 -7
  10. package/dist/agentEconomicsReceipt.d.ts +58 -58
  11. package/dist/analyze.js +3 -1
  12. package/dist/cutList.js +1 -1
  13. package/dist/glance.d.ts +30 -2
  14. package/dist/glance.js +265 -84
  15. package/dist/index.d.ts +11 -2
  16. package/dist/index.js +10 -1
  17. package/dist/insights.js +3 -1
  18. package/dist/localAgentFormats/gemini.js +2 -2
  19. package/dist/localAgentFormats/registry.js +6 -2
  20. package/dist/localAgentFormats/runtimeRegistry.js +5 -2
  21. package/dist/localAgentFormats/types.d.ts +2 -1
  22. package/dist/localAgentLogs.d.ts +362 -3
  23. package/dist/localAgentLogs.js +1964 -165
  24. package/dist/modelPricing.d.ts +1 -1
  25. package/dist/modelPricing.js +4 -1
  26. package/dist/planMath.js +12 -7
  27. package/dist/projectEconomics.d.ts +617 -0
  28. package/dist/projectEconomics.js +620 -0
  29. package/dist/projectEconomicsBuilder.d.ts +89 -0
  30. package/dist/projectEconomicsBuilder.js +473 -0
  31. package/dist/projectIndexStore.d.ts +545 -0
  32. package/dist/projectIndexStore.js +606 -0
  33. package/dist/providerConnectors.d.ts +59 -1
  34. package/dist/providerConnectors.js +192 -12
  35. package/dist/qualitativeIndexCache.d.ts +494 -0
  36. package/dist/qualitativeIndexCache.js +930 -0
  37. package/dist/resultCard.d.ts +350 -0
  38. package/dist/resultCard.js +604 -0
  39. package/dist/runtimeCommands.d.ts +21 -0
  40. package/dist/runtimeCommands.js +27 -0
  41. package/dist/scanGuard.d.ts +3 -1
  42. package/dist/scanGuard.js +164 -4
  43. package/dist/schema.d.ts +31 -31
  44. package/dist/sessionVitals.d.ts +145 -0
  45. package/dist/sessionVitals.js +521 -0
  46. package/dist/sourceRegistry.js +90 -52
  47. package/dist/toolInvocations.d.ts +40 -1
  48. package/dist/toolInvocations.js +101 -20
  49. package/package.json +1 -1
@@ -2,8 +2,8 @@ import { z } from "zod";
2
2
  export declare const AGENT_ECONOMICS_RECEIPT_KIND: "aibill.agent_economics_receipt";
3
3
  export declare const AGENT_ECONOMICS_RECEIPT_V0_VERSION: "0.1.0";
4
4
  declare const financialEvidenceWithAmountSchema: z.ZodEnum<{
5
- verified: "verified";
6
5
  estimated: "estimated";
6
+ verified: "verified";
7
7
  detected_unverified: "detected_unverified";
8
8
  }>;
9
9
  export declare const receiptModeValues: readonly ["local", "connected", "mixed", "sample"];
@@ -25,10 +25,10 @@ export declare const receiptSourceKindSchema: z.ZodEnum<{
25
25
  export type ReceiptSourceKind = z.infer<typeof receiptSourceKindSchema>;
26
26
  export declare const receiptProvenanceOriginValues: readonly ["provider_reported", "locally_observed", "user_declared", "sample"];
27
27
  export declare const receiptProvenanceOriginSchema: z.ZodEnum<{
28
- sample: "sample";
29
28
  provider_reported: "provider_reported";
30
- locally_observed: "locally_observed";
31
29
  user_declared: "user_declared";
30
+ sample: "sample";
31
+ locally_observed: "locally_observed";
32
32
  }>;
33
33
  export type ReceiptProvenanceOrigin = z.infer<typeof receiptProvenanceOriginSchema>;
34
34
  export declare const receiptTransformationValues: readonly ["normalized", "aggregated", "api_rate_estimated"];
@@ -40,9 +40,9 @@ export declare const receiptTransformationSchema: z.ZodEnum<{
40
40
  export type ReceiptTransformation = z.infer<typeof receiptTransformationSchema>;
41
41
  export declare const receiptAccountingBasisValues: readonly ["provider_billed", "api_equivalent", "user_declared"];
42
42
  export declare const receiptAccountingBasisSchema: z.ZodEnum<{
43
- api_equivalent: "api_equivalent";
44
- provider_billed: "provider_billed";
45
43
  user_declared: "user_declared";
44
+ provider_billed: "provider_billed";
45
+ api_equivalent: "api_equivalent";
46
46
  }>;
47
47
  export type ReceiptAccountingBasis = z.infer<typeof receiptAccountingBasisSchema>;
48
48
  export declare const receiptMappingGapCodeValues: readonly ["cost_unsplit", "cost_unpriced", "model_unmapped", "provider_unmapped", "source_record_unmapped"];
@@ -124,10 +124,10 @@ export type ReceiptSourceRecordReference = z.infer<typeof receiptSourceRecordRef
124
124
  export declare function createReceiptSourceRecordReference(sourceId: string, sourceRecordId: string): ReceiptSourceRecordReference;
125
125
  export declare const receiptProvenanceSchema: z.ZodObject<{
126
126
  origin: z.ZodEnum<{
127
- sample: "sample";
128
127
  provider_reported: "provider_reported";
129
- locally_observed: "locally_observed";
130
128
  user_declared: "user_declared";
129
+ sample: "sample";
130
+ locally_observed: "locally_observed";
131
131
  }>;
132
132
  transformations: z.ZodArray<z.ZodEnum<{
133
133
  normalized: "normalized";
@@ -147,9 +147,9 @@ export declare const receiptTokenUsageLineSchema: z.ZodObject<{
147
147
  sourceId: z.ZodString;
148
148
  observedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
149
149
  granularity: z.ZodEnum<{
150
+ session: "session";
150
151
  call: "call";
151
152
  invocation: "invocation";
152
- session: "session";
153
153
  daily_aggregate: "daily_aggregate";
154
154
  usage_bucket: "usage_bucket";
155
155
  billing_bucket: "billing_bucket";
@@ -158,10 +158,10 @@ export declare const receiptTokenUsageLineSchema: z.ZodObject<{
158
158
  }>;
159
159
  provenance: z.ZodObject<{
160
160
  origin: z.ZodEnum<{
161
- sample: "sample";
162
161
  provider_reported: "provider_reported";
163
- locally_observed: "locally_observed";
164
162
  user_declared: "user_declared";
163
+ sample: "sample";
164
+ locally_observed: "locally_observed";
165
165
  }>;
166
166
  transformations: z.ZodArray<z.ZodEnum<{
167
167
  normalized: "normalized";
@@ -180,22 +180,22 @@ export declare const receiptFinancialCostLineSchema: z.ZodObject<{
180
180
  amountUsd: z.ZodPipe<z.ZodNumber, z.ZodTransform<number, number>>;
181
181
  currency: z.ZodLiteral<"USD">;
182
182
  accountingBasis: z.ZodEnum<{
183
- api_equivalent: "api_equivalent";
184
- provider_billed: "provider_billed";
185
183
  user_declared: "user_declared";
184
+ provider_billed: "provider_billed";
185
+ api_equivalent: "api_equivalent";
186
186
  }>;
187
187
  financialEvidence: z.ZodEnum<{
188
- verified: "verified";
189
188
  estimated: "estimated";
189
+ verified: "verified";
190
190
  detected_unverified: "detected_unverified";
191
191
  }>;
192
192
  id: z.ZodString;
193
193
  sourceId: z.ZodString;
194
194
  observedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
195
195
  granularity: z.ZodEnum<{
196
+ session: "session";
196
197
  call: "call";
197
198
  invocation: "invocation";
198
- session: "session";
199
199
  daily_aggregate: "daily_aggregate";
200
200
  usage_bucket: "usage_bucket";
201
201
  billing_bucket: "billing_bucket";
@@ -204,10 +204,10 @@ export declare const receiptFinancialCostLineSchema: z.ZodObject<{
204
204
  }>;
205
205
  provenance: z.ZodObject<{
206
206
  origin: z.ZodEnum<{
207
- sample: "sample";
208
207
  provider_reported: "provider_reported";
209
- locally_observed: "locally_observed";
210
208
  user_declared: "user_declared";
209
+ sample: "sample";
210
+ locally_observed: "locally_observed";
211
211
  }>;
212
212
  transformations: z.ZodArray<z.ZodEnum<{
213
213
  normalized: "normalized";
@@ -232,9 +232,9 @@ export declare const receiptLineSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
232
232
  sourceId: z.ZodString;
233
233
  observedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
234
234
  granularity: z.ZodEnum<{
235
+ session: "session";
235
236
  call: "call";
236
237
  invocation: "invocation";
237
- session: "session";
238
238
  daily_aggregate: "daily_aggregate";
239
239
  usage_bucket: "usage_bucket";
240
240
  billing_bucket: "billing_bucket";
@@ -243,10 +243,10 @@ export declare const receiptLineSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
243
243
  }>;
244
244
  provenance: z.ZodObject<{
245
245
  origin: z.ZodEnum<{
246
- sample: "sample";
247
246
  provider_reported: "provider_reported";
248
- locally_observed: "locally_observed";
249
247
  user_declared: "user_declared";
248
+ sample: "sample";
249
+ locally_observed: "locally_observed";
250
250
  }>;
251
251
  transformations: z.ZodArray<z.ZodEnum<{
252
252
  normalized: "normalized";
@@ -263,22 +263,22 @@ export declare const receiptLineSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
263
263
  amountUsd: z.ZodPipe<z.ZodNumber, z.ZodTransform<number, number>>;
264
264
  currency: z.ZodLiteral<"USD">;
265
265
  accountingBasis: z.ZodEnum<{
266
- api_equivalent: "api_equivalent";
267
- provider_billed: "provider_billed";
268
266
  user_declared: "user_declared";
267
+ provider_billed: "provider_billed";
268
+ api_equivalent: "api_equivalent";
269
269
  }>;
270
270
  financialEvidence: z.ZodEnum<{
271
- verified: "verified";
272
271
  estimated: "estimated";
272
+ verified: "verified";
273
273
  detected_unverified: "detected_unverified";
274
274
  }>;
275
275
  id: z.ZodString;
276
276
  sourceId: z.ZodString;
277
277
  observedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
278
278
  granularity: z.ZodEnum<{
279
+ session: "session";
279
280
  call: "call";
280
281
  invocation: "invocation";
281
- session: "session";
282
282
  daily_aggregate: "daily_aggregate";
283
283
  usage_bucket: "usage_bucket";
284
284
  billing_bucket: "billing_bucket";
@@ -287,10 +287,10 @@ export declare const receiptLineSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
287
287
  }>;
288
288
  provenance: z.ZodObject<{
289
289
  origin: z.ZodEnum<{
290
- sample: "sample";
291
290
  provider_reported: "provider_reported";
292
- locally_observed: "locally_observed";
293
291
  user_declared: "user_declared";
292
+ sample: "sample";
293
+ locally_observed: "locally_observed";
294
294
  }>;
295
295
  transformations: z.ZodArray<z.ZodEnum<{
296
296
  normalized: "normalized";
@@ -326,13 +326,13 @@ export declare const receiptMappingGapSchema: z.ZodPipe<z.ZodObject<{
326
326
  export type ReceiptMappingGap = z.infer<typeof receiptMappingGapSchema>;
327
327
  export declare const receiptCostTotalSchema: z.ZodObject<{
328
328
  accountingBasis: z.ZodEnum<{
329
- api_equivalent: "api_equivalent";
330
- provider_billed: "provider_billed";
331
329
  user_declared: "user_declared";
330
+ provider_billed: "provider_billed";
331
+ api_equivalent: "api_equivalent";
332
332
  }>;
333
333
  financialEvidence: z.ZodEnum<{
334
- verified: "verified";
335
334
  estimated: "estimated";
335
+ verified: "verified";
336
336
  detected_unverified: "detected_unverified";
337
337
  }>;
338
338
  currency: z.ZodLiteral<"USD">;
@@ -404,9 +404,9 @@ declare const receiptBodyObjectSchema: z.ZodObject<{
404
404
  sourceId: z.ZodString;
405
405
  observedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
406
406
  granularity: z.ZodEnum<{
407
+ session: "session";
407
408
  call: "call";
408
409
  invocation: "invocation";
409
- session: "session";
410
410
  daily_aggregate: "daily_aggregate";
411
411
  usage_bucket: "usage_bucket";
412
412
  billing_bucket: "billing_bucket";
@@ -415,10 +415,10 @@ declare const receiptBodyObjectSchema: z.ZodObject<{
415
415
  }>;
416
416
  provenance: z.ZodObject<{
417
417
  origin: z.ZodEnum<{
418
- sample: "sample";
419
418
  provider_reported: "provider_reported";
420
- locally_observed: "locally_observed";
421
419
  user_declared: "user_declared";
420
+ sample: "sample";
421
+ locally_observed: "locally_observed";
422
422
  }>;
423
423
  transformations: z.ZodArray<z.ZodEnum<{
424
424
  normalized: "normalized";
@@ -435,22 +435,22 @@ declare const receiptBodyObjectSchema: z.ZodObject<{
435
435
  amountUsd: z.ZodPipe<z.ZodNumber, z.ZodTransform<number, number>>;
436
436
  currency: z.ZodLiteral<"USD">;
437
437
  accountingBasis: z.ZodEnum<{
438
- api_equivalent: "api_equivalent";
439
- provider_billed: "provider_billed";
440
438
  user_declared: "user_declared";
439
+ provider_billed: "provider_billed";
440
+ api_equivalent: "api_equivalent";
441
441
  }>;
442
442
  financialEvidence: z.ZodEnum<{
443
- verified: "verified";
444
443
  estimated: "estimated";
444
+ verified: "verified";
445
445
  detected_unverified: "detected_unverified";
446
446
  }>;
447
447
  id: z.ZodString;
448
448
  sourceId: z.ZodString;
449
449
  observedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
450
450
  granularity: z.ZodEnum<{
451
+ session: "session";
451
452
  call: "call";
452
453
  invocation: "invocation";
453
- session: "session";
454
454
  daily_aggregate: "daily_aggregate";
455
455
  usage_bucket: "usage_bucket";
456
456
  billing_bucket: "billing_bucket";
@@ -459,10 +459,10 @@ declare const receiptBodyObjectSchema: z.ZodObject<{
459
459
  }>;
460
460
  provenance: z.ZodObject<{
461
461
  origin: z.ZodEnum<{
462
- sample: "sample";
463
462
  provider_reported: "provider_reported";
464
- locally_observed: "locally_observed";
465
463
  user_declared: "user_declared";
464
+ sample: "sample";
465
+ locally_observed: "locally_observed";
466
466
  }>;
467
467
  transformations: z.ZodArray<z.ZodEnum<{
468
468
  normalized: "normalized";
@@ -559,9 +559,9 @@ export declare const agentEconomicsReceiptV0DraftSchema: z.ZodObject<{
559
559
  sourceId: z.ZodString;
560
560
  observedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
561
561
  granularity: z.ZodEnum<{
562
+ session: "session";
562
563
  call: "call";
563
564
  invocation: "invocation";
564
- session: "session";
565
565
  daily_aggregate: "daily_aggregate";
566
566
  usage_bucket: "usage_bucket";
567
567
  billing_bucket: "billing_bucket";
@@ -570,10 +570,10 @@ export declare const agentEconomicsReceiptV0DraftSchema: z.ZodObject<{
570
570
  }>;
571
571
  provenance: z.ZodObject<{
572
572
  origin: z.ZodEnum<{
573
- sample: "sample";
574
573
  provider_reported: "provider_reported";
575
- locally_observed: "locally_observed";
576
574
  user_declared: "user_declared";
575
+ sample: "sample";
576
+ locally_observed: "locally_observed";
577
577
  }>;
578
578
  transformations: z.ZodArray<z.ZodEnum<{
579
579
  normalized: "normalized";
@@ -590,22 +590,22 @@ export declare const agentEconomicsReceiptV0DraftSchema: z.ZodObject<{
590
590
  amountUsd: z.ZodPipe<z.ZodNumber, z.ZodTransform<number, number>>;
591
591
  currency: z.ZodLiteral<"USD">;
592
592
  accountingBasis: z.ZodEnum<{
593
- api_equivalent: "api_equivalent";
594
- provider_billed: "provider_billed";
595
593
  user_declared: "user_declared";
594
+ provider_billed: "provider_billed";
595
+ api_equivalent: "api_equivalent";
596
596
  }>;
597
597
  financialEvidence: z.ZodEnum<{
598
- verified: "verified";
599
598
  estimated: "estimated";
599
+ verified: "verified";
600
600
  detected_unverified: "detected_unverified";
601
601
  }>;
602
602
  id: z.ZodString;
603
603
  sourceId: z.ZodString;
604
604
  observedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
605
605
  granularity: z.ZodEnum<{
606
+ session: "session";
606
607
  call: "call";
607
608
  invocation: "invocation";
608
- session: "session";
609
609
  daily_aggregate: "daily_aggregate";
610
610
  usage_bucket: "usage_bucket";
611
611
  billing_bucket: "billing_bucket";
@@ -614,10 +614,10 @@ export declare const agentEconomicsReceiptV0DraftSchema: z.ZodObject<{
614
614
  }>;
615
615
  provenance: z.ZodObject<{
616
616
  origin: z.ZodEnum<{
617
- sample: "sample";
618
617
  provider_reported: "provider_reported";
619
- locally_observed: "locally_observed";
620
618
  user_declared: "user_declared";
619
+ sample: "sample";
620
+ locally_observed: "locally_observed";
621
621
  }>;
622
622
  transformations: z.ZodArray<z.ZodEnum<{
623
623
  normalized: "normalized";
@@ -716,9 +716,9 @@ export declare const agentEconomicsReceiptV0Schema: z.ZodObject<{
716
716
  sourceId: z.ZodString;
717
717
  observedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
718
718
  granularity: z.ZodEnum<{
719
+ session: "session";
719
720
  call: "call";
720
721
  invocation: "invocation";
721
- session: "session";
722
722
  daily_aggregate: "daily_aggregate";
723
723
  usage_bucket: "usage_bucket";
724
724
  billing_bucket: "billing_bucket";
@@ -727,10 +727,10 @@ export declare const agentEconomicsReceiptV0Schema: z.ZodObject<{
727
727
  }>;
728
728
  provenance: z.ZodObject<{
729
729
  origin: z.ZodEnum<{
730
- sample: "sample";
731
730
  provider_reported: "provider_reported";
732
- locally_observed: "locally_observed";
733
731
  user_declared: "user_declared";
732
+ sample: "sample";
733
+ locally_observed: "locally_observed";
734
734
  }>;
735
735
  transformations: z.ZodArray<z.ZodEnum<{
736
736
  normalized: "normalized";
@@ -747,22 +747,22 @@ export declare const agentEconomicsReceiptV0Schema: z.ZodObject<{
747
747
  amountUsd: z.ZodPipe<z.ZodNumber, z.ZodTransform<number, number>>;
748
748
  currency: z.ZodLiteral<"USD">;
749
749
  accountingBasis: z.ZodEnum<{
750
- api_equivalent: "api_equivalent";
751
- provider_billed: "provider_billed";
752
750
  user_declared: "user_declared";
751
+ provider_billed: "provider_billed";
752
+ api_equivalent: "api_equivalent";
753
753
  }>;
754
754
  financialEvidence: z.ZodEnum<{
755
- verified: "verified";
756
755
  estimated: "estimated";
756
+ verified: "verified";
757
757
  detected_unverified: "detected_unverified";
758
758
  }>;
759
759
  id: z.ZodString;
760
760
  sourceId: z.ZodString;
761
761
  observedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
762
762
  granularity: z.ZodEnum<{
763
+ session: "session";
763
764
  call: "call";
764
765
  invocation: "invocation";
765
- session: "session";
766
766
  daily_aggregate: "daily_aggregate";
767
767
  usage_bucket: "usage_bucket";
768
768
  billing_bucket: "billing_bucket";
@@ -771,10 +771,10 @@ export declare const agentEconomicsReceiptV0Schema: z.ZodObject<{
771
771
  }>;
772
772
  provenance: z.ZodObject<{
773
773
  origin: z.ZodEnum<{
774
- sample: "sample";
775
774
  provider_reported: "provider_reported";
776
- locally_observed: "locally_observed";
777
775
  user_declared: "user_declared";
776
+ sample: "sample";
777
+ locally_observed: "locally_observed";
778
778
  }>;
779
779
  transformations: z.ZodArray<z.ZodEnum<{
780
780
  normalized: "normalized";
@@ -809,13 +809,13 @@ export declare const agentEconomicsReceiptV0Schema: z.ZodObject<{
809
809
  id: z.ZodString;
810
810
  costTotals: z.ZodArray<z.ZodObject<{
811
811
  accountingBasis: z.ZodEnum<{
812
- api_equivalent: "api_equivalent";
813
- provider_billed: "provider_billed";
814
812
  user_declared: "user_declared";
813
+ provider_billed: "provider_billed";
814
+ api_equivalent: "api_equivalent";
815
815
  }>;
816
816
  financialEvidence: z.ZodEnum<{
817
- verified: "verified";
818
817
  estimated: "estimated";
818
+ verified: "verified";
819
819
  detected_unverified: "detected_unverified";
820
820
  }>;
821
821
  currency: z.ZodLiteral<"USD">;
package/dist/analyze.js CHANGED
@@ -346,6 +346,8 @@ function roundRatio(value) {
346
346
  return Math.round(value * 10_000) / 10_000;
347
347
  }
348
348
  function roundMoney(value) {
349
- return Math.round(value * 100) / 100;
349
+ // Persist fractional-cent evidence instead of turning a real positive amount
350
+ // into numeric zero. Presentation layers decide whether to show `<$0.01`.
351
+ return Math.round(value * 10_000) / 10_000;
350
352
  }
351
353
  //# sourceMappingURL=analyze.js.map
package/dist/cutList.js CHANGED
@@ -332,6 +332,6 @@ function stableSuffix(value) {
332
332
  return (hash >>> 0).toString(36);
333
333
  }
334
334
  function roundMoney(value) {
335
- return Math.round(value * 100) / 100;
335
+ return Math.round(value * 10_000) / 10_000;
336
336
  }
337
337
  //# sourceMappingURL=cutList.js.map
package/dist/glance.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type LocalAgentActivity, type LocalAgentCall, type LocalAgentLogResult, type LocalAgentRateLimitWindow } from "./localAgentLogs.js";
2
2
  import type { DetectedPlan } from "./planDetection.js";
3
3
  import { type ContextHealthResult } from "./contextHealth.js";
4
+ import type { ActionVerificationProjectionV0 } from "./actionPlanner.js";
4
5
  export type GlanceSession = {
5
6
  status: "active" | "recent";
6
7
  agent: LocalAgentCall["agent"];
@@ -28,6 +29,8 @@ export type GlanceLimit = {
28
29
  observedAt: string;
29
30
  resetsAt: string;
30
31
  source: "transcript_reported";
32
+ /** Old transcript evidence remains visible but is never presented as live runway. */
33
+ freshness: "current" | "stale";
31
34
  projectedExhaustionAt: string | null;
32
35
  projectedToExhaustBeforeReset: boolean;
33
36
  projectionConfidence: "estimated";
@@ -115,6 +118,12 @@ export type GlanceProvenance = {
115
118
  execution: "copy_prompt";
116
119
  automaticExecution: false;
117
120
  };
121
+ tokenExperiment: {
122
+ source: "canonical_action_verification_projection" | "not_available";
123
+ calculation: "core_experiment_evaluator";
124
+ cohort: "matched_local_sessions";
125
+ automaticExecution: false;
126
+ };
118
127
  network: {
119
128
  uploaded: false;
120
129
  };
@@ -124,11 +133,17 @@ export type UsageGlanceSnapshot = {
124
133
  generatedAt: string;
125
134
  coverage: {
126
135
  filesParsed: number;
136
+ qualitative: {
137
+ status: "complete" | "partial" | "unknown";
138
+ selectedFiles: number;
139
+ readCompletely: number;
140
+ skippedForBudget: number;
141
+ };
127
142
  supportedTranscriptAgents: Array<LocalAgentCall["agent"]>;
128
143
  detectedAgents: Array<LocalAgentCall["agent"]>;
129
144
  rateLimitMetadata: Array<{
130
145
  agent: LocalAgentCall["agent"];
131
- status: "reported" | "not_reported_by_transcript" | "not_seen";
146
+ status: "reported" | "stale" | "not_reported_by_transcript" | "not_seen";
132
147
  windowsReported: Array<LocalAgentRateLimitWindow["kind"]>;
133
148
  }>;
134
149
  providerConnectionRequired: ["cursor", "github-copilot"];
@@ -139,8 +154,17 @@ export type UsageGlanceSnapshot = {
139
154
  limits: GlanceLimit[];
140
155
  focus: GlanceFocus | null;
141
156
  anomaly: GlanceAnomaly | null;
142
- sessionHealth: ContextHealthResult;
157
+ sessionHealth: ContextHealthResult & {
158
+ /** Same bounded qualitative-coverage contract returned by the CLI context view. */
159
+ qualitativeCoverage: UsageGlanceSnapshot["coverage"]["qualitative"];
160
+ };
143
161
  primaryAction: GlancePrimaryAction;
162
+ /**
163
+ * Compact, canonical read projection of one locally persisted token test.
164
+ * The experiment evaluator owns every count, percentage, and evidence label;
165
+ * Glance only carries this projection and never recalculates it.
166
+ */
167
+ tokenExperiment?: ActionVerificationProjectionV0;
144
168
  caveats: string[];
145
169
  };
146
170
  export type BuildUsageGlanceOptions = {
@@ -148,6 +172,8 @@ export type BuildUsageGlanceOptions = {
148
172
  activeWithinMinutes?: number;
149
173
  focusWindowDays?: number;
150
174
  filesParsed?: number;
175
+ /** Bounded qualitative/action coverage. Partial evidence cannot drive a global focus/action. */
176
+ qualitativeCoverage?: UsageGlanceSnapshot["coverage"]["qualitative"];
151
177
  detectedAgents?: Array<LocalAgentCall["agent"]>;
152
178
  /** Locally detected or explicitly declared subscription/API billing modes. */
153
179
  detectedPlans?: DetectedPlan[];
@@ -155,6 +181,8 @@ export type BuildUsageGlanceOptions = {
155
181
  limitCalls?: LocalAgentCall[];
156
182
  /** Canonical result shared with CLI/MCP. Falls back to session-only health. */
157
183
  contextHealth?: ContextHealthResult;
184
+ /** Must come from buildActionVerificationProjectionV0; Glance never evaluates it. */
185
+ actionVerificationProjection?: ActionVerificationProjectionV0;
158
186
  };
159
187
  /**
160
188
  * Build the read model used by the native Glance surface.