@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
@@ -0,0 +1,1240 @@
1
+ import { z } from "zod";
2
+ export declare const WASTE_FINDING_V0_KIND: "aibill.waste_finding";
3
+ export declare const WASTE_FINDING_V0_VERSION: "0.1.0";
4
+ export declare const TOKEN_REDUCTION_EXPERIMENT_V0_KIND: "aibill.token_reduction_experiment";
5
+ export declare const TOKEN_REDUCTION_EXPERIMENT_V0_VERSION: "0.1.0";
6
+ export declare const MAX_WASTE_FINDING_EVIDENCE_REFS_V0 = 256;
7
+ export declare const MAX_TOKEN_EXPERIMENT_SESSIONS_PER_PHASE_V0 = 256;
8
+ export declare const wasteFindingTypeValues: readonly ["configured_not_observed", "repeated_context_read", "compaction_pressure", "high_context_relative_to_baseline", "cumulative_context_exposure"];
9
+ export type WasteFindingType = typeof wasteFindingTypeValues[number];
10
+ export declare const wasteCandidateActionValues: readonly ["inspect_scope", "lazy_load", "disable", "remove", "start_fresh", "reduce_repeated_reads", "trim_context"];
11
+ export type WasteCandidateAction = typeof wasteCandidateActionValues[number];
12
+ export declare const wasteFindingCaveatValues: readonly ["signal_not_cause", "no_cash_claim", "missing_outcome_evidence"];
13
+ export type WasteFindingCaveat = typeof wasteFindingCaveatValues[number];
14
+ export declare const actionVerificationEvidenceValues: readonly ["verified", "observed", "calculated", "user_declared", "modeled", "missing"];
15
+ export declare const actionVerificationEvidenceSchema: z.ZodEnum<{
16
+ verified: "verified";
17
+ missing: "missing";
18
+ observed: "observed";
19
+ calculated: "calculated";
20
+ user_declared: "user_declared";
21
+ modeled: "modeled";
22
+ }>;
23
+ export type ActionVerificationEvidence = z.infer<typeof actionVerificationEvidenceSchema>;
24
+ export declare const tokenExperimentLifecycleValues: readonly ["draft", "baseline_ready", "applied", "collecting", "complete", "rolled_back", "invalidated"];
25
+ export type TokenExperimentLifecycle = typeof tokenExperimentLifecycleValues[number];
26
+ export declare const tokenExperimentResultValues: readonly ["not_evaluated", "collecting", "measured_token_reduction", "no_measured_change", "regressed", "inconclusive"];
27
+ export type TokenExperimentResult = typeof tokenExperimentResultValues[number];
28
+ export declare const tokenExperimentExclusionReasonValues: readonly ["duplicate_session", "reused_across_phases", "intervention_not_applied", "crosses_intervention_boundary", "wrong_side_of_intervention", "missing_total_tokens", "inconsistent_total_tokens", "agent_mismatch", "provider_mismatch", "model_mismatch", "project_mismatch", "session_type_mismatch", "work_type_mismatch", "missing_work_unit", "source_version_mismatch"];
29
+ export type TokenExperimentExclusionReason = typeof tokenExperimentExclusionReasonValues[number];
30
+ declare const wasteFindingBodySchema: z.ZodObject<{
31
+ kind: z.ZodLiteral<"aibill.waste_finding">;
32
+ schemaVersion: z.ZodLiteral<"0.1.0">;
33
+ generatedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
34
+ window: z.ZodObject<{
35
+ start: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
36
+ end: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
37
+ }, z.core.$strict>;
38
+ findingType: z.ZodEnum<{
39
+ configured_not_observed: "configured_not_observed";
40
+ repeated_context_read: "repeated_context_read";
41
+ compaction_pressure: "compaction_pressure";
42
+ high_context_relative_to_baseline: "high_context_relative_to_baseline";
43
+ cumulative_context_exposure: "cumulative_context_exposure";
44
+ }>;
45
+ objective: z.ZodObject<{
46
+ metric: z.ZodLiteral<"total_tokens_per_matched_session">;
47
+ direction: z.ZodLiteral<"reduce">;
48
+ guard: z.ZodLiteral<"user_declared_quality_must_hold">;
49
+ }, z.core.$strict>;
50
+ caveats: z.ZodArray<z.ZodEnum<{
51
+ signal_not_cause: "signal_not_cause";
52
+ no_cash_claim: "no_cash_claim";
53
+ missing_outcome_evidence: "missing_outcome_evidence";
54
+ }>>;
55
+ candidateAction: z.ZodObject<{
56
+ kind: z.ZodEnum<{
57
+ start_fresh: "start_fresh";
58
+ inspect_scope: "inspect_scope";
59
+ lazy_load: "lazy_load";
60
+ disable: "disable";
61
+ remove: "remove";
62
+ reduce_repeated_reads: "reduce_repeated_reads";
63
+ trim_context: "trim_context";
64
+ }>;
65
+ provider: z.ZodString;
66
+ surface: z.ZodEnum<{
67
+ local_agent_configuration: "local_agent_configuration";
68
+ session_workflow: "session_workflow";
69
+ provider_workload_configuration: "provider_workload_configuration";
70
+ }>;
71
+ reversible: z.ZodLiteral<true>;
72
+ canaryRequired: z.ZodLiteral<true>;
73
+ rollbackRequired: z.ZodLiteral<true>;
74
+ }, z.core.$strict>;
75
+ target: z.ZodObject<{
76
+ kind: z.ZodEnum<{
77
+ session: "session";
78
+ repeated_read_file: "repeated_read_file";
79
+ configured_item: "configured_item";
80
+ }>;
81
+ ref: z.ZodString;
82
+ }, z.core.$strict>;
83
+ scope: z.ZodObject<{
84
+ agent: z.ZodString;
85
+ provider: z.ZodString;
86
+ model: z.ZodOptional<z.ZodString>;
87
+ projectRef: z.ZodOptional<z.ZodString>;
88
+ }, z.core.$strict>;
89
+ source: z.ZodObject<{
90
+ id: z.ZodString;
91
+ validationCoverage: z.ZodEnum<{
92
+ live_verified: "live_verified";
93
+ fixture_verified: "fixture_verified";
94
+ untested: "untested";
95
+ failed: "failed";
96
+ }>;
97
+ freshness: z.ZodEnum<{
98
+ fresh: "fresh";
99
+ stale: "stale";
100
+ not_checked: "not_checked";
101
+ }>;
102
+ }, z.core.$strict>;
103
+ metric: z.ZodObject<{
104
+ name: z.ZodEnum<{
105
+ total_tokens: "total_tokens";
106
+ input_context_tokens: "input_context_tokens";
107
+ compaction_events: "compaction_events";
108
+ repeated_read_events: "repeated_read_events";
109
+ configured_items: "configured_items";
110
+ }>;
111
+ unit: z.ZodEnum<{
112
+ items: "items";
113
+ tokens: "tokens";
114
+ events: "events";
115
+ ratio: "ratio";
116
+ }>;
117
+ value: z.ZodNullable<z.ZodNumber>;
118
+ sampleCount: z.ZodNumber;
119
+ evidence: z.ZodEnum<{
120
+ missing: "missing";
121
+ observed: "observed";
122
+ calculated: "calculated";
123
+ }>;
124
+ }, z.core.$strict>;
125
+ evidenceRefs: z.ZodArray<z.ZodString>;
126
+ causalStatus: z.ZodLiteral<"unproven">;
127
+ actionability: z.ZodLiteral<"inspect_only">;
128
+ approvalRequired: z.ZodLiteral<true>;
129
+ }, z.core.$strict>;
130
+ export type WasteFindingV0DraftInput = z.input<typeof wasteFindingBodySchema>;
131
+ declare const wasteFindingObjectSchema: z.ZodObject<{
132
+ kind: z.ZodLiteral<"aibill.waste_finding">;
133
+ schemaVersion: z.ZodLiteral<"0.1.0">;
134
+ generatedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
135
+ window: z.ZodObject<{
136
+ start: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
137
+ end: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
138
+ }, z.core.$strict>;
139
+ findingType: z.ZodEnum<{
140
+ configured_not_observed: "configured_not_observed";
141
+ repeated_context_read: "repeated_context_read";
142
+ compaction_pressure: "compaction_pressure";
143
+ high_context_relative_to_baseline: "high_context_relative_to_baseline";
144
+ cumulative_context_exposure: "cumulative_context_exposure";
145
+ }>;
146
+ objective: z.ZodObject<{
147
+ metric: z.ZodLiteral<"total_tokens_per_matched_session">;
148
+ direction: z.ZodLiteral<"reduce">;
149
+ guard: z.ZodLiteral<"user_declared_quality_must_hold">;
150
+ }, z.core.$strict>;
151
+ caveats: z.ZodArray<z.ZodEnum<{
152
+ signal_not_cause: "signal_not_cause";
153
+ no_cash_claim: "no_cash_claim";
154
+ missing_outcome_evidence: "missing_outcome_evidence";
155
+ }>>;
156
+ candidateAction: z.ZodObject<{
157
+ kind: z.ZodEnum<{
158
+ start_fresh: "start_fresh";
159
+ inspect_scope: "inspect_scope";
160
+ lazy_load: "lazy_load";
161
+ disable: "disable";
162
+ remove: "remove";
163
+ reduce_repeated_reads: "reduce_repeated_reads";
164
+ trim_context: "trim_context";
165
+ }>;
166
+ provider: z.ZodString;
167
+ surface: z.ZodEnum<{
168
+ local_agent_configuration: "local_agent_configuration";
169
+ session_workflow: "session_workflow";
170
+ provider_workload_configuration: "provider_workload_configuration";
171
+ }>;
172
+ reversible: z.ZodLiteral<true>;
173
+ canaryRequired: z.ZodLiteral<true>;
174
+ rollbackRequired: z.ZodLiteral<true>;
175
+ }, z.core.$strict>;
176
+ target: z.ZodObject<{
177
+ kind: z.ZodEnum<{
178
+ session: "session";
179
+ repeated_read_file: "repeated_read_file";
180
+ configured_item: "configured_item";
181
+ }>;
182
+ ref: z.ZodString;
183
+ }, z.core.$strict>;
184
+ scope: z.ZodObject<{
185
+ agent: z.ZodString;
186
+ provider: z.ZodString;
187
+ model: z.ZodOptional<z.ZodString>;
188
+ projectRef: z.ZodOptional<z.ZodString>;
189
+ }, z.core.$strict>;
190
+ source: z.ZodObject<{
191
+ id: z.ZodString;
192
+ validationCoverage: z.ZodEnum<{
193
+ live_verified: "live_verified";
194
+ fixture_verified: "fixture_verified";
195
+ untested: "untested";
196
+ failed: "failed";
197
+ }>;
198
+ freshness: z.ZodEnum<{
199
+ fresh: "fresh";
200
+ stale: "stale";
201
+ not_checked: "not_checked";
202
+ }>;
203
+ }, z.core.$strict>;
204
+ metric: z.ZodObject<{
205
+ name: z.ZodEnum<{
206
+ total_tokens: "total_tokens";
207
+ input_context_tokens: "input_context_tokens";
208
+ compaction_events: "compaction_events";
209
+ repeated_read_events: "repeated_read_events";
210
+ configured_items: "configured_items";
211
+ }>;
212
+ unit: z.ZodEnum<{
213
+ items: "items";
214
+ tokens: "tokens";
215
+ events: "events";
216
+ ratio: "ratio";
217
+ }>;
218
+ value: z.ZodNullable<z.ZodNumber>;
219
+ sampleCount: z.ZodNumber;
220
+ evidence: z.ZodEnum<{
221
+ missing: "missing";
222
+ observed: "observed";
223
+ calculated: "calculated";
224
+ }>;
225
+ }, z.core.$strict>;
226
+ evidenceRefs: z.ZodArray<z.ZodString>;
227
+ causalStatus: z.ZodLiteral<"unproven">;
228
+ actionability: z.ZodLiteral<"inspect_only">;
229
+ approvalRequired: z.ZodLiteral<true>;
230
+ id: z.ZodString;
231
+ candidateKey: z.ZodString;
232
+ }, z.core.$strict>;
233
+ export type WasteFindingV0 = z.infer<typeof wasteFindingObjectSchema>;
234
+ declare const tokenSessionSchema: z.ZodObject<{
235
+ sessionRef: z.ZodString;
236
+ startedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
237
+ endedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
238
+ agent: z.ZodString;
239
+ provider: z.ZodString;
240
+ model: z.ZodString;
241
+ projectRef: z.ZodOptional<z.ZodString>;
242
+ sessionType: z.ZodEnum<{
243
+ subagent: "subagent";
244
+ unknown: "unknown";
245
+ parent: "parent";
246
+ }>;
247
+ workTypeRef: z.ZodOptional<z.ZodString>;
248
+ workUnitRef: z.ZodOptional<z.ZodString>;
249
+ workUnitEvidence: z.ZodOptional<z.ZodEnum<{
250
+ verified: "verified";
251
+ observed: "observed";
252
+ user_declared: "user_declared";
253
+ }>>;
254
+ sourceVersionRef: z.ZodOptional<z.ZodString>;
255
+ sourceValidationCoverage: z.ZodEnum<{
256
+ live_verified: "live_verified";
257
+ fixture_verified: "fixture_verified";
258
+ untested: "untested";
259
+ failed: "failed";
260
+ }>;
261
+ tokens: z.ZodObject<{
262
+ uncachedInputTokens: z.ZodNullable<z.ZodNumber>;
263
+ cacheReadTokens: z.ZodNullable<z.ZodNumber>;
264
+ cacheWriteTokens: z.ZodNullable<z.ZodNumber>;
265
+ toolTokens: z.ZodNullable<z.ZodNumber>;
266
+ outputTokens: z.ZodNullable<z.ZodNumber>;
267
+ thoughtTokens: z.ZodNullable<z.ZodNumber>;
268
+ calculatedTotalTokens: z.ZodNullable<z.ZodNumber>;
269
+ reportedTotalTokens: z.ZodNullable<z.ZodNumber>;
270
+ componentEvidence: z.ZodObject<{
271
+ uncachedInputTokens: z.ZodEnum<{
272
+ observed: "observed";
273
+ not_separately_reported: "not_separately_reported";
274
+ }>;
275
+ cacheReadTokens: z.ZodEnum<{
276
+ observed: "observed";
277
+ not_separately_reported: "not_separately_reported";
278
+ }>;
279
+ cacheWriteTokens: z.ZodEnum<{
280
+ observed: "observed";
281
+ not_separately_reported: "not_separately_reported";
282
+ partial: "partial";
283
+ }>;
284
+ toolTokens: z.ZodEnum<{
285
+ observed: "observed";
286
+ not_separately_reported: "not_separately_reported";
287
+ }>;
288
+ outputTokens: z.ZodEnum<{
289
+ observed: "observed";
290
+ not_separately_reported: "not_separately_reported";
291
+ }>;
292
+ thoughtTokens: z.ZodEnum<{
293
+ observed: "observed";
294
+ not_separately_reported: "not_separately_reported";
295
+ }>;
296
+ calculatedTotalTokens: z.ZodEnum<{
297
+ missing: "missing";
298
+ calculated_complete: "calculated_complete";
299
+ calculated_partial: "calculated_partial";
300
+ }>;
301
+ reportedTotalTokens: z.ZodEnum<{
302
+ provider_reported: "provider_reported";
303
+ not_reported: "not_reported";
304
+ }>;
305
+ }, z.core.$strict>;
306
+ }, z.core.$strict>;
307
+ quality: z.ZodObject<{
308
+ status: z.ZodEnum<{
309
+ missing: "missing";
310
+ failed: "failed";
311
+ passed: "passed";
312
+ }>;
313
+ evidence: z.ZodEnum<{
314
+ verified: "verified";
315
+ missing: "missing";
316
+ observed: "observed";
317
+ user_declared: "user_declared";
318
+ }>;
319
+ evidenceRef: z.ZodOptional<z.ZodString>;
320
+ }, z.core.$strict>;
321
+ }, z.core.$strict>;
322
+ export type TokenExperimentSessionV0 = z.infer<typeof tokenSessionSchema>;
323
+ export type TokenExperimentSessionV0Input = z.input<typeof tokenSessionSchema>;
324
+ declare const experimentBodySchema: z.ZodObject<{
325
+ kind: z.ZodLiteral<"aibill.token_reduction_experiment">;
326
+ schemaVersion: z.ZodLiteral<"0.1.0">;
327
+ createdAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
328
+ finding: z.ZodObject<{
329
+ kind: z.ZodLiteral<"aibill.waste_finding">;
330
+ schemaVersion: z.ZodLiteral<"0.1.0">;
331
+ generatedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
332
+ window: z.ZodObject<{
333
+ start: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
334
+ end: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
335
+ }, z.core.$strict>;
336
+ findingType: z.ZodEnum<{
337
+ configured_not_observed: "configured_not_observed";
338
+ repeated_context_read: "repeated_context_read";
339
+ compaction_pressure: "compaction_pressure";
340
+ high_context_relative_to_baseline: "high_context_relative_to_baseline";
341
+ cumulative_context_exposure: "cumulative_context_exposure";
342
+ }>;
343
+ objective: z.ZodObject<{
344
+ metric: z.ZodLiteral<"total_tokens_per_matched_session">;
345
+ direction: z.ZodLiteral<"reduce">;
346
+ guard: z.ZodLiteral<"user_declared_quality_must_hold">;
347
+ }, z.core.$strict>;
348
+ caveats: z.ZodArray<z.ZodEnum<{
349
+ signal_not_cause: "signal_not_cause";
350
+ no_cash_claim: "no_cash_claim";
351
+ missing_outcome_evidence: "missing_outcome_evidence";
352
+ }>>;
353
+ candidateAction: z.ZodObject<{
354
+ kind: z.ZodEnum<{
355
+ start_fresh: "start_fresh";
356
+ inspect_scope: "inspect_scope";
357
+ lazy_load: "lazy_load";
358
+ disable: "disable";
359
+ remove: "remove";
360
+ reduce_repeated_reads: "reduce_repeated_reads";
361
+ trim_context: "trim_context";
362
+ }>;
363
+ provider: z.ZodString;
364
+ surface: z.ZodEnum<{
365
+ local_agent_configuration: "local_agent_configuration";
366
+ session_workflow: "session_workflow";
367
+ provider_workload_configuration: "provider_workload_configuration";
368
+ }>;
369
+ reversible: z.ZodLiteral<true>;
370
+ canaryRequired: z.ZodLiteral<true>;
371
+ rollbackRequired: z.ZodLiteral<true>;
372
+ }, z.core.$strict>;
373
+ target: z.ZodObject<{
374
+ kind: z.ZodEnum<{
375
+ session: "session";
376
+ repeated_read_file: "repeated_read_file";
377
+ configured_item: "configured_item";
378
+ }>;
379
+ ref: z.ZodString;
380
+ }, z.core.$strict>;
381
+ scope: z.ZodObject<{
382
+ agent: z.ZodString;
383
+ provider: z.ZodString;
384
+ model: z.ZodOptional<z.ZodString>;
385
+ projectRef: z.ZodOptional<z.ZodString>;
386
+ }, z.core.$strict>;
387
+ source: z.ZodObject<{
388
+ id: z.ZodString;
389
+ validationCoverage: z.ZodEnum<{
390
+ live_verified: "live_verified";
391
+ fixture_verified: "fixture_verified";
392
+ untested: "untested";
393
+ failed: "failed";
394
+ }>;
395
+ freshness: z.ZodEnum<{
396
+ fresh: "fresh";
397
+ stale: "stale";
398
+ not_checked: "not_checked";
399
+ }>;
400
+ }, z.core.$strict>;
401
+ metric: z.ZodObject<{
402
+ name: z.ZodEnum<{
403
+ total_tokens: "total_tokens";
404
+ input_context_tokens: "input_context_tokens";
405
+ compaction_events: "compaction_events";
406
+ repeated_read_events: "repeated_read_events";
407
+ configured_items: "configured_items";
408
+ }>;
409
+ unit: z.ZodEnum<{
410
+ items: "items";
411
+ tokens: "tokens";
412
+ events: "events";
413
+ ratio: "ratio";
414
+ }>;
415
+ value: z.ZodNullable<z.ZodNumber>;
416
+ sampleCount: z.ZodNumber;
417
+ evidence: z.ZodEnum<{
418
+ missing: "missing";
419
+ observed: "observed";
420
+ calculated: "calculated";
421
+ }>;
422
+ }, z.core.$strict>;
423
+ evidenceRefs: z.ZodArray<z.ZodString>;
424
+ causalStatus: z.ZodLiteral<"unproven">;
425
+ actionability: z.ZodLiteral<"inspect_only">;
426
+ approvalRequired: z.ZodLiteral<true>;
427
+ id: z.ZodString;
428
+ candidateKey: z.ZodString;
429
+ }, z.core.$strict>;
430
+ cohort: z.ZodObject<{
431
+ agent: z.ZodString;
432
+ provider: z.ZodString;
433
+ model: z.ZodString;
434
+ projectRef: z.ZodString;
435
+ sessionType: z.ZodEnum<{
436
+ subagent: "subagent";
437
+ parent: "parent";
438
+ }>;
439
+ workTypeRef: z.ZodString;
440
+ workTypeEvidence: z.ZodEnum<{
441
+ verified: "verified";
442
+ observed: "observed";
443
+ user_declared: "user_declared";
444
+ }>;
445
+ sourceVersionRef: z.ZodOptional<z.ZodString>;
446
+ }, z.core.$strict>;
447
+ matchingPolicy: z.ZodObject<{
448
+ basis: z.ZodEnum<{
449
+ session_cohort: "session_cohort";
450
+ accepted_work_unit: "accepted_work_unit";
451
+ }>;
452
+ minimumBaselineSessions: z.ZodDefault<z.ZodNumber>;
453
+ minimumPostSessions: z.ZodDefault<z.ZodNumber>;
454
+ requireExactSourceVersion: z.ZodDefault<z.ZodBoolean>;
455
+ }, z.core.$strict>;
456
+ qualityGuard: z.ZodObject<{
457
+ required: z.ZodLiteral<true>;
458
+ minimumEvidence: z.ZodEnum<{
459
+ verified: "verified";
460
+ observed: "observed";
461
+ user_declared: "user_declared";
462
+ }>;
463
+ rollbackOnRegression: z.ZodLiteral<true>;
464
+ }, z.core.$strict>;
465
+ baselineSessions: z.ZodArray<z.ZodObject<{
466
+ sessionRef: z.ZodString;
467
+ startedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
468
+ endedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
469
+ agent: z.ZodString;
470
+ provider: z.ZodString;
471
+ model: z.ZodString;
472
+ projectRef: z.ZodOptional<z.ZodString>;
473
+ sessionType: z.ZodEnum<{
474
+ subagent: "subagent";
475
+ unknown: "unknown";
476
+ parent: "parent";
477
+ }>;
478
+ workTypeRef: z.ZodOptional<z.ZodString>;
479
+ workUnitRef: z.ZodOptional<z.ZodString>;
480
+ workUnitEvidence: z.ZodOptional<z.ZodEnum<{
481
+ verified: "verified";
482
+ observed: "observed";
483
+ user_declared: "user_declared";
484
+ }>>;
485
+ sourceVersionRef: z.ZodOptional<z.ZodString>;
486
+ sourceValidationCoverage: z.ZodEnum<{
487
+ live_verified: "live_verified";
488
+ fixture_verified: "fixture_verified";
489
+ untested: "untested";
490
+ failed: "failed";
491
+ }>;
492
+ tokens: z.ZodObject<{
493
+ uncachedInputTokens: z.ZodNullable<z.ZodNumber>;
494
+ cacheReadTokens: z.ZodNullable<z.ZodNumber>;
495
+ cacheWriteTokens: z.ZodNullable<z.ZodNumber>;
496
+ toolTokens: z.ZodNullable<z.ZodNumber>;
497
+ outputTokens: z.ZodNullable<z.ZodNumber>;
498
+ thoughtTokens: z.ZodNullable<z.ZodNumber>;
499
+ calculatedTotalTokens: z.ZodNullable<z.ZodNumber>;
500
+ reportedTotalTokens: z.ZodNullable<z.ZodNumber>;
501
+ componentEvidence: z.ZodObject<{
502
+ uncachedInputTokens: z.ZodEnum<{
503
+ observed: "observed";
504
+ not_separately_reported: "not_separately_reported";
505
+ }>;
506
+ cacheReadTokens: z.ZodEnum<{
507
+ observed: "observed";
508
+ not_separately_reported: "not_separately_reported";
509
+ }>;
510
+ cacheWriteTokens: z.ZodEnum<{
511
+ observed: "observed";
512
+ not_separately_reported: "not_separately_reported";
513
+ partial: "partial";
514
+ }>;
515
+ toolTokens: z.ZodEnum<{
516
+ observed: "observed";
517
+ not_separately_reported: "not_separately_reported";
518
+ }>;
519
+ outputTokens: z.ZodEnum<{
520
+ observed: "observed";
521
+ not_separately_reported: "not_separately_reported";
522
+ }>;
523
+ thoughtTokens: z.ZodEnum<{
524
+ observed: "observed";
525
+ not_separately_reported: "not_separately_reported";
526
+ }>;
527
+ calculatedTotalTokens: z.ZodEnum<{
528
+ missing: "missing";
529
+ calculated_complete: "calculated_complete";
530
+ calculated_partial: "calculated_partial";
531
+ }>;
532
+ reportedTotalTokens: z.ZodEnum<{
533
+ provider_reported: "provider_reported";
534
+ not_reported: "not_reported";
535
+ }>;
536
+ }, z.core.$strict>;
537
+ }, z.core.$strict>;
538
+ quality: z.ZodObject<{
539
+ status: z.ZodEnum<{
540
+ missing: "missing";
541
+ failed: "failed";
542
+ passed: "passed";
543
+ }>;
544
+ evidence: z.ZodEnum<{
545
+ verified: "verified";
546
+ missing: "missing";
547
+ observed: "observed";
548
+ user_declared: "user_declared";
549
+ }>;
550
+ evidenceRef: z.ZodOptional<z.ZodString>;
551
+ }, z.core.$strict>;
552
+ }, z.core.$strict>>;
553
+ intervention: z.ZodObject<{
554
+ approval: z.ZodObject<{
555
+ status: z.ZodEnum<{
556
+ pending: "pending";
557
+ explicit: "explicit";
558
+ }>;
559
+ evidence: z.ZodEnum<{
560
+ verified: "verified";
561
+ missing: "missing";
562
+ user_declared: "user_declared";
563
+ }>;
564
+ approvedAt: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
565
+ approvalRef: z.ZodOptional<z.ZodString>;
566
+ }, z.core.$strict>;
567
+ appliedAt: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
568
+ changeRef: z.ZodOptional<z.ZodString>;
569
+ rollbackRef: z.ZodOptional<z.ZodString>;
570
+ canary: z.ZodOptional<z.ZodObject<{
571
+ status: z.ZodEnum<{
572
+ missing: "missing";
573
+ failed: "failed";
574
+ passed: "passed";
575
+ }>;
576
+ evidence: z.ZodEnum<{
577
+ verified: "verified";
578
+ missing: "missing";
579
+ observed: "observed";
580
+ user_declared: "user_declared";
581
+ }>;
582
+ evidenceRef: z.ZodOptional<z.ZodString>;
583
+ }, z.core.$strict>>;
584
+ rolledBackAt: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
585
+ }, z.core.$strict>;
586
+ postSessions: z.ZodArray<z.ZodObject<{
587
+ sessionRef: z.ZodString;
588
+ startedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
589
+ endedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
590
+ agent: z.ZodString;
591
+ provider: z.ZodString;
592
+ model: z.ZodString;
593
+ projectRef: z.ZodOptional<z.ZodString>;
594
+ sessionType: z.ZodEnum<{
595
+ subagent: "subagent";
596
+ unknown: "unknown";
597
+ parent: "parent";
598
+ }>;
599
+ workTypeRef: z.ZodOptional<z.ZodString>;
600
+ workUnitRef: z.ZodOptional<z.ZodString>;
601
+ workUnitEvidence: z.ZodOptional<z.ZodEnum<{
602
+ verified: "verified";
603
+ observed: "observed";
604
+ user_declared: "user_declared";
605
+ }>>;
606
+ sourceVersionRef: z.ZodOptional<z.ZodString>;
607
+ sourceValidationCoverage: z.ZodEnum<{
608
+ live_verified: "live_verified";
609
+ fixture_verified: "fixture_verified";
610
+ untested: "untested";
611
+ failed: "failed";
612
+ }>;
613
+ tokens: z.ZodObject<{
614
+ uncachedInputTokens: z.ZodNullable<z.ZodNumber>;
615
+ cacheReadTokens: z.ZodNullable<z.ZodNumber>;
616
+ cacheWriteTokens: z.ZodNullable<z.ZodNumber>;
617
+ toolTokens: z.ZodNullable<z.ZodNumber>;
618
+ outputTokens: z.ZodNullable<z.ZodNumber>;
619
+ thoughtTokens: z.ZodNullable<z.ZodNumber>;
620
+ calculatedTotalTokens: z.ZodNullable<z.ZodNumber>;
621
+ reportedTotalTokens: z.ZodNullable<z.ZodNumber>;
622
+ componentEvidence: z.ZodObject<{
623
+ uncachedInputTokens: z.ZodEnum<{
624
+ observed: "observed";
625
+ not_separately_reported: "not_separately_reported";
626
+ }>;
627
+ cacheReadTokens: z.ZodEnum<{
628
+ observed: "observed";
629
+ not_separately_reported: "not_separately_reported";
630
+ }>;
631
+ cacheWriteTokens: z.ZodEnum<{
632
+ observed: "observed";
633
+ not_separately_reported: "not_separately_reported";
634
+ partial: "partial";
635
+ }>;
636
+ toolTokens: z.ZodEnum<{
637
+ observed: "observed";
638
+ not_separately_reported: "not_separately_reported";
639
+ }>;
640
+ outputTokens: z.ZodEnum<{
641
+ observed: "observed";
642
+ not_separately_reported: "not_separately_reported";
643
+ }>;
644
+ thoughtTokens: z.ZodEnum<{
645
+ observed: "observed";
646
+ not_separately_reported: "not_separately_reported";
647
+ }>;
648
+ calculatedTotalTokens: z.ZodEnum<{
649
+ missing: "missing";
650
+ calculated_complete: "calculated_complete";
651
+ calculated_partial: "calculated_partial";
652
+ }>;
653
+ reportedTotalTokens: z.ZodEnum<{
654
+ provider_reported: "provider_reported";
655
+ not_reported: "not_reported";
656
+ }>;
657
+ }, z.core.$strict>;
658
+ }, z.core.$strict>;
659
+ quality: z.ZodObject<{
660
+ status: z.ZodEnum<{
661
+ missing: "missing";
662
+ failed: "failed";
663
+ passed: "passed";
664
+ }>;
665
+ evidence: z.ZodEnum<{
666
+ verified: "verified";
667
+ missing: "missing";
668
+ observed: "observed";
669
+ user_declared: "user_declared";
670
+ }>;
671
+ evidenceRef: z.ZodOptional<z.ZodString>;
672
+ }, z.core.$strict>;
673
+ }, z.core.$strict>>;
674
+ invalidation: z.ZodOptional<z.ZodObject<{
675
+ reason: z.ZodEnum<{
676
+ manual: "manual";
677
+ scope_changed: "scope_changed";
678
+ source_semantics_changed: "source_semantics_changed";
679
+ concurrent_change: "concurrent_change";
680
+ }>;
681
+ invalidatedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
682
+ }, z.core.$strict>>;
683
+ }, z.core.$strict>;
684
+ export type TokenReductionExperimentV0DraftInput = z.input<typeof experimentBodySchema>;
685
+ declare const evaluationSchema: z.ZodObject<{
686
+ status: z.ZodEnum<{
687
+ collecting: "collecting";
688
+ not_evaluated: "not_evaluated";
689
+ measured_token_reduction: "measured_token_reduction";
690
+ no_measured_change: "no_measured_change";
691
+ regressed: "regressed";
692
+ inconclusive: "inconclusive";
693
+ }>;
694
+ metricEvidence: z.ZodEnum<{
695
+ missing: "missing";
696
+ calculated: "calculated";
697
+ }>;
698
+ matchingEvidence: z.ZodEnum<{
699
+ verified: "verified";
700
+ missing: "missing";
701
+ observed: "observed";
702
+ user_declared: "user_declared";
703
+ }>;
704
+ qualityStatus: z.ZodEnum<{
705
+ regressed: "regressed";
706
+ held: "held";
707
+ insufficient: "insufficient";
708
+ }>;
709
+ qualityEvidence: z.ZodEnum<{
710
+ verified: "verified";
711
+ missing: "missing";
712
+ observed: "observed";
713
+ user_declared: "user_declared";
714
+ }>;
715
+ baseline: z.ZodObject<{
716
+ includedSessions: z.ZodNumber;
717
+ medianTotalTokens: z.ZodNullable<z.ZodNumber>;
718
+ componentMedians: z.ZodObject<{
719
+ uncachedInputTokens: z.ZodNullable<z.ZodNumber>;
720
+ cacheReadTokens: z.ZodNullable<z.ZodNumber>;
721
+ cacheWriteTokens: z.ZodNullable<z.ZodNumber>;
722
+ toolTokens: z.ZodNullable<z.ZodNumber>;
723
+ outputTokens: z.ZodNullable<z.ZodNumber>;
724
+ thoughtTokens: z.ZodNullable<z.ZodNumber>;
725
+ }, z.core.$strict>;
726
+ }, z.core.$strict>;
727
+ postChange: z.ZodObject<{
728
+ includedSessions: z.ZodNumber;
729
+ medianTotalTokens: z.ZodNullable<z.ZodNumber>;
730
+ componentMedians: z.ZodObject<{
731
+ uncachedInputTokens: z.ZodNullable<z.ZodNumber>;
732
+ cacheReadTokens: z.ZodNullable<z.ZodNumber>;
733
+ cacheWriteTokens: z.ZodNullable<z.ZodNumber>;
734
+ toolTokens: z.ZodNullable<z.ZodNumber>;
735
+ outputTokens: z.ZodNullable<z.ZodNumber>;
736
+ thoughtTokens: z.ZodNullable<z.ZodNumber>;
737
+ }, z.core.$strict>;
738
+ }, z.core.$strict>;
739
+ reductionPercent: z.ZodNullable<z.ZodNumber>;
740
+ exclusions: z.ZodArray<z.ZodObject<{
741
+ phase: z.ZodEnum<{
742
+ baseline: "baseline";
743
+ post_change: "post_change";
744
+ }>;
745
+ sessionRef: z.ZodString;
746
+ reasons: z.ZodArray<z.ZodEnum<{
747
+ duplicate_session: "duplicate_session";
748
+ reused_across_phases: "reused_across_phases";
749
+ intervention_not_applied: "intervention_not_applied";
750
+ crosses_intervention_boundary: "crosses_intervention_boundary";
751
+ wrong_side_of_intervention: "wrong_side_of_intervention";
752
+ missing_total_tokens: "missing_total_tokens";
753
+ inconsistent_total_tokens: "inconsistent_total_tokens";
754
+ agent_mismatch: "agent_mismatch";
755
+ provider_mismatch: "provider_mismatch";
756
+ model_mismatch: "model_mismatch";
757
+ project_mismatch: "project_mismatch";
758
+ session_type_mismatch: "session_type_mismatch";
759
+ work_type_mismatch: "work_type_mismatch";
760
+ missing_work_unit: "missing_work_unit";
761
+ source_version_mismatch: "source_version_mismatch";
762
+ }>>;
763
+ }, z.core.$strict>>;
764
+ rollbackRecommended: z.ZodBoolean;
765
+ }, z.core.$strict>;
766
+ declare const experimentObjectSchema: z.ZodObject<{
767
+ kind: z.ZodLiteral<"aibill.token_reduction_experiment">;
768
+ schemaVersion: z.ZodLiteral<"0.1.0">;
769
+ createdAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
770
+ finding: z.ZodObject<{
771
+ kind: z.ZodLiteral<"aibill.waste_finding">;
772
+ schemaVersion: z.ZodLiteral<"0.1.0">;
773
+ generatedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
774
+ window: z.ZodObject<{
775
+ start: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
776
+ end: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
777
+ }, z.core.$strict>;
778
+ findingType: z.ZodEnum<{
779
+ configured_not_observed: "configured_not_observed";
780
+ repeated_context_read: "repeated_context_read";
781
+ compaction_pressure: "compaction_pressure";
782
+ high_context_relative_to_baseline: "high_context_relative_to_baseline";
783
+ cumulative_context_exposure: "cumulative_context_exposure";
784
+ }>;
785
+ objective: z.ZodObject<{
786
+ metric: z.ZodLiteral<"total_tokens_per_matched_session">;
787
+ direction: z.ZodLiteral<"reduce">;
788
+ guard: z.ZodLiteral<"user_declared_quality_must_hold">;
789
+ }, z.core.$strict>;
790
+ caveats: z.ZodArray<z.ZodEnum<{
791
+ signal_not_cause: "signal_not_cause";
792
+ no_cash_claim: "no_cash_claim";
793
+ missing_outcome_evidence: "missing_outcome_evidence";
794
+ }>>;
795
+ candidateAction: z.ZodObject<{
796
+ kind: z.ZodEnum<{
797
+ start_fresh: "start_fresh";
798
+ inspect_scope: "inspect_scope";
799
+ lazy_load: "lazy_load";
800
+ disable: "disable";
801
+ remove: "remove";
802
+ reduce_repeated_reads: "reduce_repeated_reads";
803
+ trim_context: "trim_context";
804
+ }>;
805
+ provider: z.ZodString;
806
+ surface: z.ZodEnum<{
807
+ local_agent_configuration: "local_agent_configuration";
808
+ session_workflow: "session_workflow";
809
+ provider_workload_configuration: "provider_workload_configuration";
810
+ }>;
811
+ reversible: z.ZodLiteral<true>;
812
+ canaryRequired: z.ZodLiteral<true>;
813
+ rollbackRequired: z.ZodLiteral<true>;
814
+ }, z.core.$strict>;
815
+ target: z.ZodObject<{
816
+ kind: z.ZodEnum<{
817
+ session: "session";
818
+ repeated_read_file: "repeated_read_file";
819
+ configured_item: "configured_item";
820
+ }>;
821
+ ref: z.ZodString;
822
+ }, z.core.$strict>;
823
+ scope: z.ZodObject<{
824
+ agent: z.ZodString;
825
+ provider: z.ZodString;
826
+ model: z.ZodOptional<z.ZodString>;
827
+ projectRef: z.ZodOptional<z.ZodString>;
828
+ }, z.core.$strict>;
829
+ source: z.ZodObject<{
830
+ id: z.ZodString;
831
+ validationCoverage: z.ZodEnum<{
832
+ live_verified: "live_verified";
833
+ fixture_verified: "fixture_verified";
834
+ untested: "untested";
835
+ failed: "failed";
836
+ }>;
837
+ freshness: z.ZodEnum<{
838
+ fresh: "fresh";
839
+ stale: "stale";
840
+ not_checked: "not_checked";
841
+ }>;
842
+ }, z.core.$strict>;
843
+ metric: z.ZodObject<{
844
+ name: z.ZodEnum<{
845
+ total_tokens: "total_tokens";
846
+ input_context_tokens: "input_context_tokens";
847
+ compaction_events: "compaction_events";
848
+ repeated_read_events: "repeated_read_events";
849
+ configured_items: "configured_items";
850
+ }>;
851
+ unit: z.ZodEnum<{
852
+ items: "items";
853
+ tokens: "tokens";
854
+ events: "events";
855
+ ratio: "ratio";
856
+ }>;
857
+ value: z.ZodNullable<z.ZodNumber>;
858
+ sampleCount: z.ZodNumber;
859
+ evidence: z.ZodEnum<{
860
+ missing: "missing";
861
+ observed: "observed";
862
+ calculated: "calculated";
863
+ }>;
864
+ }, z.core.$strict>;
865
+ evidenceRefs: z.ZodArray<z.ZodString>;
866
+ causalStatus: z.ZodLiteral<"unproven">;
867
+ actionability: z.ZodLiteral<"inspect_only">;
868
+ approvalRequired: z.ZodLiteral<true>;
869
+ id: z.ZodString;
870
+ candidateKey: z.ZodString;
871
+ }, z.core.$strict>;
872
+ cohort: z.ZodObject<{
873
+ agent: z.ZodString;
874
+ provider: z.ZodString;
875
+ model: z.ZodString;
876
+ projectRef: z.ZodString;
877
+ sessionType: z.ZodEnum<{
878
+ subagent: "subagent";
879
+ parent: "parent";
880
+ }>;
881
+ workTypeRef: z.ZodString;
882
+ workTypeEvidence: z.ZodEnum<{
883
+ verified: "verified";
884
+ observed: "observed";
885
+ user_declared: "user_declared";
886
+ }>;
887
+ sourceVersionRef: z.ZodOptional<z.ZodString>;
888
+ }, z.core.$strict>;
889
+ matchingPolicy: z.ZodObject<{
890
+ basis: z.ZodEnum<{
891
+ session_cohort: "session_cohort";
892
+ accepted_work_unit: "accepted_work_unit";
893
+ }>;
894
+ minimumBaselineSessions: z.ZodDefault<z.ZodNumber>;
895
+ minimumPostSessions: z.ZodDefault<z.ZodNumber>;
896
+ requireExactSourceVersion: z.ZodDefault<z.ZodBoolean>;
897
+ }, z.core.$strict>;
898
+ qualityGuard: z.ZodObject<{
899
+ required: z.ZodLiteral<true>;
900
+ minimumEvidence: z.ZodEnum<{
901
+ verified: "verified";
902
+ observed: "observed";
903
+ user_declared: "user_declared";
904
+ }>;
905
+ rollbackOnRegression: z.ZodLiteral<true>;
906
+ }, z.core.$strict>;
907
+ baselineSessions: z.ZodArray<z.ZodObject<{
908
+ sessionRef: z.ZodString;
909
+ startedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
910
+ endedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
911
+ agent: z.ZodString;
912
+ provider: z.ZodString;
913
+ model: z.ZodString;
914
+ projectRef: z.ZodOptional<z.ZodString>;
915
+ sessionType: z.ZodEnum<{
916
+ subagent: "subagent";
917
+ unknown: "unknown";
918
+ parent: "parent";
919
+ }>;
920
+ workTypeRef: z.ZodOptional<z.ZodString>;
921
+ workUnitRef: z.ZodOptional<z.ZodString>;
922
+ workUnitEvidence: z.ZodOptional<z.ZodEnum<{
923
+ verified: "verified";
924
+ observed: "observed";
925
+ user_declared: "user_declared";
926
+ }>>;
927
+ sourceVersionRef: z.ZodOptional<z.ZodString>;
928
+ sourceValidationCoverage: z.ZodEnum<{
929
+ live_verified: "live_verified";
930
+ fixture_verified: "fixture_verified";
931
+ untested: "untested";
932
+ failed: "failed";
933
+ }>;
934
+ tokens: z.ZodObject<{
935
+ uncachedInputTokens: z.ZodNullable<z.ZodNumber>;
936
+ cacheReadTokens: z.ZodNullable<z.ZodNumber>;
937
+ cacheWriteTokens: z.ZodNullable<z.ZodNumber>;
938
+ toolTokens: z.ZodNullable<z.ZodNumber>;
939
+ outputTokens: z.ZodNullable<z.ZodNumber>;
940
+ thoughtTokens: z.ZodNullable<z.ZodNumber>;
941
+ calculatedTotalTokens: z.ZodNullable<z.ZodNumber>;
942
+ reportedTotalTokens: z.ZodNullable<z.ZodNumber>;
943
+ componentEvidence: z.ZodObject<{
944
+ uncachedInputTokens: z.ZodEnum<{
945
+ observed: "observed";
946
+ not_separately_reported: "not_separately_reported";
947
+ }>;
948
+ cacheReadTokens: z.ZodEnum<{
949
+ observed: "observed";
950
+ not_separately_reported: "not_separately_reported";
951
+ }>;
952
+ cacheWriteTokens: z.ZodEnum<{
953
+ observed: "observed";
954
+ not_separately_reported: "not_separately_reported";
955
+ partial: "partial";
956
+ }>;
957
+ toolTokens: z.ZodEnum<{
958
+ observed: "observed";
959
+ not_separately_reported: "not_separately_reported";
960
+ }>;
961
+ outputTokens: z.ZodEnum<{
962
+ observed: "observed";
963
+ not_separately_reported: "not_separately_reported";
964
+ }>;
965
+ thoughtTokens: z.ZodEnum<{
966
+ observed: "observed";
967
+ not_separately_reported: "not_separately_reported";
968
+ }>;
969
+ calculatedTotalTokens: z.ZodEnum<{
970
+ missing: "missing";
971
+ calculated_complete: "calculated_complete";
972
+ calculated_partial: "calculated_partial";
973
+ }>;
974
+ reportedTotalTokens: z.ZodEnum<{
975
+ provider_reported: "provider_reported";
976
+ not_reported: "not_reported";
977
+ }>;
978
+ }, z.core.$strict>;
979
+ }, z.core.$strict>;
980
+ quality: z.ZodObject<{
981
+ status: z.ZodEnum<{
982
+ missing: "missing";
983
+ failed: "failed";
984
+ passed: "passed";
985
+ }>;
986
+ evidence: z.ZodEnum<{
987
+ verified: "verified";
988
+ missing: "missing";
989
+ observed: "observed";
990
+ user_declared: "user_declared";
991
+ }>;
992
+ evidenceRef: z.ZodOptional<z.ZodString>;
993
+ }, z.core.$strict>;
994
+ }, z.core.$strict>>;
995
+ intervention: z.ZodObject<{
996
+ approval: z.ZodObject<{
997
+ status: z.ZodEnum<{
998
+ pending: "pending";
999
+ explicit: "explicit";
1000
+ }>;
1001
+ evidence: z.ZodEnum<{
1002
+ verified: "verified";
1003
+ missing: "missing";
1004
+ user_declared: "user_declared";
1005
+ }>;
1006
+ approvedAt: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1007
+ approvalRef: z.ZodOptional<z.ZodString>;
1008
+ }, z.core.$strict>;
1009
+ appliedAt: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1010
+ changeRef: z.ZodOptional<z.ZodString>;
1011
+ rollbackRef: z.ZodOptional<z.ZodString>;
1012
+ canary: z.ZodOptional<z.ZodObject<{
1013
+ status: z.ZodEnum<{
1014
+ missing: "missing";
1015
+ failed: "failed";
1016
+ passed: "passed";
1017
+ }>;
1018
+ evidence: z.ZodEnum<{
1019
+ verified: "verified";
1020
+ missing: "missing";
1021
+ observed: "observed";
1022
+ user_declared: "user_declared";
1023
+ }>;
1024
+ evidenceRef: z.ZodOptional<z.ZodString>;
1025
+ }, z.core.$strict>>;
1026
+ rolledBackAt: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1027
+ }, z.core.$strict>;
1028
+ postSessions: z.ZodArray<z.ZodObject<{
1029
+ sessionRef: z.ZodString;
1030
+ startedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
1031
+ endedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
1032
+ agent: z.ZodString;
1033
+ provider: z.ZodString;
1034
+ model: z.ZodString;
1035
+ projectRef: z.ZodOptional<z.ZodString>;
1036
+ sessionType: z.ZodEnum<{
1037
+ subagent: "subagent";
1038
+ unknown: "unknown";
1039
+ parent: "parent";
1040
+ }>;
1041
+ workTypeRef: z.ZodOptional<z.ZodString>;
1042
+ workUnitRef: z.ZodOptional<z.ZodString>;
1043
+ workUnitEvidence: z.ZodOptional<z.ZodEnum<{
1044
+ verified: "verified";
1045
+ observed: "observed";
1046
+ user_declared: "user_declared";
1047
+ }>>;
1048
+ sourceVersionRef: z.ZodOptional<z.ZodString>;
1049
+ sourceValidationCoverage: z.ZodEnum<{
1050
+ live_verified: "live_verified";
1051
+ fixture_verified: "fixture_verified";
1052
+ untested: "untested";
1053
+ failed: "failed";
1054
+ }>;
1055
+ tokens: z.ZodObject<{
1056
+ uncachedInputTokens: z.ZodNullable<z.ZodNumber>;
1057
+ cacheReadTokens: z.ZodNullable<z.ZodNumber>;
1058
+ cacheWriteTokens: z.ZodNullable<z.ZodNumber>;
1059
+ toolTokens: z.ZodNullable<z.ZodNumber>;
1060
+ outputTokens: z.ZodNullable<z.ZodNumber>;
1061
+ thoughtTokens: z.ZodNullable<z.ZodNumber>;
1062
+ calculatedTotalTokens: z.ZodNullable<z.ZodNumber>;
1063
+ reportedTotalTokens: z.ZodNullable<z.ZodNumber>;
1064
+ componentEvidence: z.ZodObject<{
1065
+ uncachedInputTokens: z.ZodEnum<{
1066
+ observed: "observed";
1067
+ not_separately_reported: "not_separately_reported";
1068
+ }>;
1069
+ cacheReadTokens: z.ZodEnum<{
1070
+ observed: "observed";
1071
+ not_separately_reported: "not_separately_reported";
1072
+ }>;
1073
+ cacheWriteTokens: z.ZodEnum<{
1074
+ observed: "observed";
1075
+ not_separately_reported: "not_separately_reported";
1076
+ partial: "partial";
1077
+ }>;
1078
+ toolTokens: z.ZodEnum<{
1079
+ observed: "observed";
1080
+ not_separately_reported: "not_separately_reported";
1081
+ }>;
1082
+ outputTokens: z.ZodEnum<{
1083
+ observed: "observed";
1084
+ not_separately_reported: "not_separately_reported";
1085
+ }>;
1086
+ thoughtTokens: z.ZodEnum<{
1087
+ observed: "observed";
1088
+ not_separately_reported: "not_separately_reported";
1089
+ }>;
1090
+ calculatedTotalTokens: z.ZodEnum<{
1091
+ missing: "missing";
1092
+ calculated_complete: "calculated_complete";
1093
+ calculated_partial: "calculated_partial";
1094
+ }>;
1095
+ reportedTotalTokens: z.ZodEnum<{
1096
+ provider_reported: "provider_reported";
1097
+ not_reported: "not_reported";
1098
+ }>;
1099
+ }, z.core.$strict>;
1100
+ }, z.core.$strict>;
1101
+ quality: z.ZodObject<{
1102
+ status: z.ZodEnum<{
1103
+ missing: "missing";
1104
+ failed: "failed";
1105
+ passed: "passed";
1106
+ }>;
1107
+ evidence: z.ZodEnum<{
1108
+ verified: "verified";
1109
+ missing: "missing";
1110
+ observed: "observed";
1111
+ user_declared: "user_declared";
1112
+ }>;
1113
+ evidenceRef: z.ZodOptional<z.ZodString>;
1114
+ }, z.core.$strict>;
1115
+ }, z.core.$strict>>;
1116
+ invalidation: z.ZodOptional<z.ZodObject<{
1117
+ reason: z.ZodEnum<{
1118
+ manual: "manual";
1119
+ scope_changed: "scope_changed";
1120
+ source_semantics_changed: "source_semantics_changed";
1121
+ concurrent_change: "concurrent_change";
1122
+ }>;
1123
+ invalidatedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
1124
+ }, z.core.$strict>>;
1125
+ id: z.ZodString;
1126
+ revisionId: z.ZodString;
1127
+ lifecycle: z.ZodEnum<{
1128
+ complete: "complete";
1129
+ draft: "draft";
1130
+ baseline_ready: "baseline_ready";
1131
+ applied: "applied";
1132
+ collecting: "collecting";
1133
+ rolled_back: "rolled_back";
1134
+ invalidated: "invalidated";
1135
+ }>;
1136
+ evaluation: z.ZodObject<{
1137
+ status: z.ZodEnum<{
1138
+ collecting: "collecting";
1139
+ not_evaluated: "not_evaluated";
1140
+ measured_token_reduction: "measured_token_reduction";
1141
+ no_measured_change: "no_measured_change";
1142
+ regressed: "regressed";
1143
+ inconclusive: "inconclusive";
1144
+ }>;
1145
+ metricEvidence: z.ZodEnum<{
1146
+ missing: "missing";
1147
+ calculated: "calculated";
1148
+ }>;
1149
+ matchingEvidence: z.ZodEnum<{
1150
+ verified: "verified";
1151
+ missing: "missing";
1152
+ observed: "observed";
1153
+ user_declared: "user_declared";
1154
+ }>;
1155
+ qualityStatus: z.ZodEnum<{
1156
+ regressed: "regressed";
1157
+ held: "held";
1158
+ insufficient: "insufficient";
1159
+ }>;
1160
+ qualityEvidence: z.ZodEnum<{
1161
+ verified: "verified";
1162
+ missing: "missing";
1163
+ observed: "observed";
1164
+ user_declared: "user_declared";
1165
+ }>;
1166
+ baseline: z.ZodObject<{
1167
+ includedSessions: z.ZodNumber;
1168
+ medianTotalTokens: z.ZodNullable<z.ZodNumber>;
1169
+ componentMedians: z.ZodObject<{
1170
+ uncachedInputTokens: z.ZodNullable<z.ZodNumber>;
1171
+ cacheReadTokens: z.ZodNullable<z.ZodNumber>;
1172
+ cacheWriteTokens: z.ZodNullable<z.ZodNumber>;
1173
+ toolTokens: z.ZodNullable<z.ZodNumber>;
1174
+ outputTokens: z.ZodNullable<z.ZodNumber>;
1175
+ thoughtTokens: z.ZodNullable<z.ZodNumber>;
1176
+ }, z.core.$strict>;
1177
+ }, z.core.$strict>;
1178
+ postChange: z.ZodObject<{
1179
+ includedSessions: z.ZodNumber;
1180
+ medianTotalTokens: z.ZodNullable<z.ZodNumber>;
1181
+ componentMedians: z.ZodObject<{
1182
+ uncachedInputTokens: z.ZodNullable<z.ZodNumber>;
1183
+ cacheReadTokens: z.ZodNullable<z.ZodNumber>;
1184
+ cacheWriteTokens: z.ZodNullable<z.ZodNumber>;
1185
+ toolTokens: z.ZodNullable<z.ZodNumber>;
1186
+ outputTokens: z.ZodNullable<z.ZodNumber>;
1187
+ thoughtTokens: z.ZodNullable<z.ZodNumber>;
1188
+ }, z.core.$strict>;
1189
+ }, z.core.$strict>;
1190
+ reductionPercent: z.ZodNullable<z.ZodNumber>;
1191
+ exclusions: z.ZodArray<z.ZodObject<{
1192
+ phase: z.ZodEnum<{
1193
+ baseline: "baseline";
1194
+ post_change: "post_change";
1195
+ }>;
1196
+ sessionRef: z.ZodString;
1197
+ reasons: z.ZodArray<z.ZodEnum<{
1198
+ duplicate_session: "duplicate_session";
1199
+ reused_across_phases: "reused_across_phases";
1200
+ intervention_not_applied: "intervention_not_applied";
1201
+ crosses_intervention_boundary: "crosses_intervention_boundary";
1202
+ wrong_side_of_intervention: "wrong_side_of_intervention";
1203
+ missing_total_tokens: "missing_total_tokens";
1204
+ inconsistent_total_tokens: "inconsistent_total_tokens";
1205
+ agent_mismatch: "agent_mismatch";
1206
+ provider_mismatch: "provider_mismatch";
1207
+ model_mismatch: "model_mismatch";
1208
+ project_mismatch: "project_mismatch";
1209
+ session_type_mismatch: "session_type_mismatch";
1210
+ work_type_mismatch: "work_type_mismatch";
1211
+ missing_work_unit: "missing_work_unit";
1212
+ source_version_mismatch: "source_version_mismatch";
1213
+ }>>;
1214
+ }, z.core.$strict>>;
1215
+ rollbackRecommended: z.ZodBoolean;
1216
+ }, z.core.$strict>;
1217
+ }, z.core.$strict>;
1218
+ export type TokenReductionEvaluationV0 = z.infer<typeof evaluationSchema>;
1219
+ export type TokenReductionExperimentV0 = z.infer<typeof experimentObjectSchema>;
1220
+ /**
1221
+ * Hash a source-native value into the only reference form accepted by action
1222
+ * verification contracts. The original value is never returned or persisted.
1223
+ */
1224
+ export declare function createActionVerificationReference(namespace: string, sourceNativeValue: string): string;
1225
+ /** Create a canonical, content-addressed waste finding with no raw paths or prose. */
1226
+ export declare function createWasteFindingV0(input: WasteFindingV0DraftInput): WasteFindingV0;
1227
+ /** Parse a serialized finding and reject a stale or forged content digest. */
1228
+ export declare function parseWasteFindingV0(value: unknown): WasteFindingV0;
1229
+ /**
1230
+ * Build or advance one experiment. Evaluation is pure: every lifecycle label,
1231
+ * median, exclusion, percentage, and rollback recommendation is derived from
1232
+ * the supplied immutable evidence.
1233
+ */
1234
+ export declare function createTokenReductionExperimentV0(input: TokenReductionExperimentV0DraftInput): TokenReductionExperimentV0;
1235
+ /** Parse and recompute an experiment, rejecting tampered derived fields. */
1236
+ export declare function parseTokenReductionExperimentV0(value: unknown): TokenReductionExperimentV0;
1237
+ /** Pure evaluator for callers that already have a validated experiment body. */
1238
+ export declare function evaluateTokenReductionExperimentV0(input: TokenReductionExperimentV0DraftInput): Pick<TokenReductionExperimentV0, "lifecycle" | "evaluation">;
1239
+ export {};
1240
+ //# sourceMappingURL=actionVerification.d.ts.map