@compaction/cli 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.
Files changed (143) hide show
  1. package/LICENSE +663 -0
  2. package/README.md +319 -0
  3. package/dist/cli/commands/adapter.d.ts +2 -0
  4. package/dist/cli/commands/adapter.js +49 -0
  5. package/dist/cli/commands/aggregate.d.ts +2 -0
  6. package/dist/cli/commands/aggregate.js +60 -0
  7. package/dist/cli/commands/analyze.d.ts +2 -0
  8. package/dist/cli/commands/analyze.js +55 -0
  9. package/dist/cli/commands/apply-context.d.ts +12 -0
  10. package/dist/cli/commands/apply-context.js +80 -0
  11. package/dist/cli/commands/apply.d.ts +2 -0
  12. package/dist/cli/commands/apply.js +65 -0
  13. package/dist/cli/commands/approve.d.ts +2 -0
  14. package/dist/cli/commands/approve.js +55 -0
  15. package/dist/cli/commands/audit.d.ts +2 -0
  16. package/dist/cli/commands/audit.js +63 -0
  17. package/dist/cli/commands/billing-delta.d.ts +2 -0
  18. package/dist/cli/commands/billing-delta.js +246 -0
  19. package/dist/cli/commands/capture-claude-code.d.ts +19 -0
  20. package/dist/cli/commands/capture-claude-code.js +198 -0
  21. package/dist/cli/commands/capture-provider-usage.d.ts +35 -0
  22. package/dist/cli/commands/capture-provider-usage.js +113 -0
  23. package/dist/cli/commands/capture.d.ts +2 -0
  24. package/dist/cli/commands/capture.js +76 -0
  25. package/dist/cli/commands/compact.d.ts +2 -0
  26. package/dist/cli/commands/compact.js +206 -0
  27. package/dist/cli/commands/eval.d.ts +2 -0
  28. package/dist/cli/commands/eval.js +66 -0
  29. package/dist/cli/commands/export-session-seed.d.ts +11 -0
  30. package/dist/cli/commands/export-session-seed.js +42 -0
  31. package/dist/cli/commands/feedback.d.ts +2 -0
  32. package/dist/cli/commands/feedback.js +233 -0
  33. package/dist/cli/commands/import.d.ts +2 -0
  34. package/dist/cli/commands/import.js +60 -0
  35. package/dist/cli/commands/init.d.ts +2 -0
  36. package/dist/cli/commands/init.js +216 -0
  37. package/dist/cli/commands/integrations.d.ts +2 -0
  38. package/dist/cli/commands/integrations.js +29 -0
  39. package/dist/cli/commands/launch-treatment-session.d.ts +14 -0
  40. package/dist/cli/commands/launch-treatment-session.js +50 -0
  41. package/dist/cli/commands/optimize.d.ts +2 -0
  42. package/dist/cli/commands/optimize.js +33 -0
  43. package/dist/cli/commands/recommend.d.ts +4 -0
  44. package/dist/cli/commands/recommend.js +66 -0
  45. package/dist/cli/commands/review.d.ts +2 -0
  46. package/dist/cli/commands/review.js +60 -0
  47. package/dist/cli/commands/run.d.ts +2 -0
  48. package/dist/cli/commands/run.js +49 -0
  49. package/dist/cli/commands/spend.d.ts +2 -0
  50. package/dist/cli/commands/spend.js +24 -0
  51. package/dist/cli/commands/summary.d.ts +2 -0
  52. package/dist/cli/commands/summary.js +19 -0
  53. package/dist/cli/engine-degrade.d.ts +40 -0
  54. package/dist/cli/engine-degrade.js +59 -0
  55. package/dist/cli/index.d.ts +2 -0
  56. package/dist/cli/index.js +59 -0
  57. package/dist/core/adapter-validation.d.ts +32 -0
  58. package/dist/core/adapter-validation.js +185 -0
  59. package/dist/core/adapters/claude-code-adapter.d.ts +51 -0
  60. package/dist/core/adapters/claude-code-adapter.js +539 -0
  61. package/dist/core/adapters/claude-code-discovery.d.ts +40 -0
  62. package/dist/core/adapters/claude-code-discovery.js +100 -0
  63. package/dist/core/aggregate-format.d.ts +62 -0
  64. package/dist/core/aggregate-format.js +349 -0
  65. package/dist/core/api-client/client.d.ts +43 -0
  66. package/dist/core/api-client/client.js +143 -0
  67. package/dist/core/api-client/config.d.ts +36 -0
  68. package/dist/core/api-client/config.js +44 -0
  69. package/dist/core/api-client/index.d.ts +13 -0
  70. package/dist/core/api-client/index.js +14 -0
  71. package/dist/core/api-client/payload.d.ts +93 -0
  72. package/dist/core/api-client/payload.js +180 -0
  73. package/dist/core/api-client/types.d.ts +95 -0
  74. package/dist/core/api-client/types.js +21 -0
  75. package/dist/core/artifact-writer.d.ts +2 -0
  76. package/dist/core/artifact-writer.js +14 -0
  77. package/dist/core/audit-report.d.ts +91 -0
  78. package/dist/core/audit-report.js +422 -0
  79. package/dist/core/billing-delta/billing-delta-record.d.ts +290 -0
  80. package/dist/core/billing-delta/billing-delta-record.js +394 -0
  81. package/dist/core/capture-adapter.d.ts +74 -0
  82. package/dist/core/capture-adapter.js +2 -0
  83. package/dist/core/command-runner.d.ts +29 -0
  84. package/dist/core/command-runner.js +96 -0
  85. package/dist/core/content-hash.d.ts +1 -0
  86. package/dist/core/content-hash.js +5 -0
  87. package/dist/core/cost-calculator.d.ts +6 -0
  88. package/dist/core/cost-calculator.js +20 -0
  89. package/dist/core/feedback-bundle.d.ts +159 -0
  90. package/dist/core/feedback-bundle.js +406 -0
  91. package/dist/core/openai-agents-capture.d.ts +66 -0
  92. package/dist/core/openai-agents-capture.js +475 -0
  93. package/dist/core/policy-types.d.ts +85 -0
  94. package/dist/core/policy-types.js +29 -0
  95. package/dist/core/pricing.d.ts +23 -0
  96. package/dist/core/pricing.js +55 -0
  97. package/dist/core/provider-usage/credential-redaction.d.ts +23 -0
  98. package/dist/core/provider-usage/credential-redaction.js +60 -0
  99. package/dist/core/provider-usage/provider-usage-adapter.d.ts +65 -0
  100. package/dist/core/provider-usage/provider-usage-adapter.js +147 -0
  101. package/dist/core/provider-usage/provider-usage-client.d.ts +89 -0
  102. package/dist/core/provider-usage/provider-usage-client.js +96 -0
  103. package/dist/core/report-generator.d.ts +7 -0
  104. package/dist/core/report-generator.js +275 -0
  105. package/dist/core/run-aggregator.d.ts +50 -0
  106. package/dist/core/run-aggregator.js +251 -0
  107. package/dist/core/run-labels.d.ts +52 -0
  108. package/dist/core/run-labels.js +80 -0
  109. package/dist/core/run-trace-converter.d.ts +3 -0
  110. package/dist/core/run-trace-converter.js +94 -0
  111. package/dist/core/safety-report.d.ts +52 -0
  112. package/dist/core/safety-report.js +440 -0
  113. package/dist/core/savings.d.ts +22 -0
  114. package/dist/core/savings.js +36 -0
  115. package/dist/core/session-aggregate.d.ts +211 -0
  116. package/dist/core/session-aggregate.js +490 -0
  117. package/dist/core/skill-injection-detector.d.ts +51 -0
  118. package/dist/core/skill-injection-detector.js +146 -0
  119. package/dist/core/spend-attribution.d.ts +169 -0
  120. package/dist/core/spend-attribution.js +611 -0
  121. package/dist/core/standalone-capsule-provenance.d.ts +4 -0
  122. package/dist/core/standalone-capsule-provenance.js +62 -0
  123. package/dist/core/state-capsule.d.ts +3 -0
  124. package/dist/core/state-capsule.js +147 -0
  125. package/dist/core/token-accounting.d.ts +62 -0
  126. package/dist/core/token-accounting.js +81 -0
  127. package/dist/core/token-estimator.d.ts +3 -0
  128. package/dist/core/token-estimator.js +18 -0
  129. package/dist/core/trace-adapters.d.ts +53 -0
  130. package/dist/core/trace-adapters.js +714 -0
  131. package/dist/core/trace-fingerprint.d.ts +79 -0
  132. package/dist/core/trace-fingerprint.js +102 -0
  133. package/dist/core/trace-intake.d.ts +41 -0
  134. package/dist/core/trace-intake.js +164 -0
  135. package/dist/core/trace-parser.d.ts +203 -0
  136. package/dist/core/trace-parser.js +143 -0
  137. package/dist/core/types.d.ts +238 -0
  138. package/dist/core/types.js +2 -0
  139. package/dist/core/usage-metadata.d.ts +51 -0
  140. package/dist/core/usage-metadata.js +122 -0
  141. package/dist/core/waste-detector.d.ts +8 -0
  142. package/dist/core/waste-detector.js +58 -0
  143. package/package.json +90 -0
@@ -0,0 +1,290 @@
1
+ /**
2
+ * Billing-delta measurement record — operator-run A/B protocol (local-first).
3
+ *
4
+ * Implements Alternative 1 / §3 of docs/design/billing-delta-loop.md (the accepted
5
+ * methodology direction): a LOCAL, OPERATOR-RUN measurement record. The OPERATOR
6
+ * performs the real workflow runs themselves (control arm = original context;
7
+ * treatment arm = apply-context-approved compacted context), reads the billed costs
8
+ * from THEIR OWN provider console / billing export, and ENTERS them. This module
9
+ * records runs with provenance, computes per-arm statistics and the delta of means,
10
+ * applies the accepted methodology's honesty rubric, and emits a caveated verdict.
11
+ *
12
+ * HARD HONESTY RAILS (see the accepted doc §2.4, §1(a)-(e), Risks):
13
+ * - This module makes NO provider call, reads NO credential, has NO network access.
14
+ * - Operator-entered figures are labeled `operator_entered: true`. The tool CANNOT
15
+ * verify them against the provider.
16
+ * - The tool NEVER emits the phrase "billing-confirmed savings" as a claim and NEVER
17
+ * sets `billing_confirmed: true`. This is NOT a Tier-3 claim. `ValueProof` is
18
+ * untouched (its `billing_confirmed_savings.claimed` stays false).
19
+ * - The strongest verdict is a "measured, caveated delta on N runs of ONE workflow
20
+ * under recorded conditions" — explicitly NOT a general savings claim.
21
+ * - Aggregate cost figures only (LOW sensitivity). NO prompt/completion content is
22
+ * stored anywhere in the record.
23
+ */
24
+ export declare const BILLING_DELTA_RECORD_ROOT = ".compaction/billing-delta";
25
+ export declare const BILLING_DELTA_RECORD_SCHEMA: "billing-delta.measurement-record.v1";
26
+ export declare const BILLING_DELTA_REPORT_SCHEMA: "billing-delta.report.v1";
27
+ /** The two A/B arms. Control = original (un-compacted) context. Treatment = apply-context-approved compacted context. */
28
+ export type BillingDeltaArm = "control" | "treatment";
29
+ /**
30
+ * Machine-readable privacy posture, self-documenting in the artifact the LOW /
31
+ * aggregate-only classification from docs/design/billing-delta-loop.md (previously
32
+ * stated only in the command banner and the design doc). Literal types: these facts
33
+ * are structural properties of the substrate, not per-record choices.
34
+ */
35
+ export interface BillingDeltaPrivacyPosture {
36
+ /** Maps to the design doc's LOW sensitivity classification. */
37
+ sensitivity: "low";
38
+ /** Aggregate billed-cost figures only — never prompt/completion content. */
39
+ aggregate_cost_only: true;
40
+ /** All billing figures are operator-entered; the tool reads nothing from a provider. */
41
+ operator_entered_figures: true;
42
+ /** The record is a local file; the tool makes no provider call and has no network access. */
43
+ local_only: true;
44
+ }
45
+ export declare const BILLING_DELTA_PRIVACY_POSTURE: BillingDeltaPrivacyPosture;
46
+ /** The documented decision criterion. Named in every report. */
47
+ export declare const BILLING_DELTA_CRITERION: string;
48
+ /** The standard-error multiplier used to form the conservative interval. Documented and fixed (no over-engineered statistics). */
49
+ export declare const BILLING_DELTA_INTERVAL_K = 2;
50
+ /** Verbatim-ish anecdote note required by the accepted doc (§2.4: "a single A/B run is an anecdote, not proof"). */
51
+ export declare const BILLING_DELTA_ANECDOTE_NOTE = "A single A/B pair is an anecdote, not proof: N=1 per arm cannot distinguish a compaction effect from run-to-run noise.";
52
+ /** Provenance link to an apply-context approval record (the treatment context provenance), recorded by path + hash. */
53
+ export interface TreatmentApprovalLink {
54
+ /** Path to the apply-approval-record JSON emitted by `compaction apply-context --approve-in-workflow-use`. */
55
+ apply_approval_record_path: string;
56
+ /** sha256 of the apply-approval-record file contents, captured at add-run time. */
57
+ apply_approval_record_sha256: string;
58
+ }
59
+ /** One operator-entered run on one arm. Aggregate cost only — NO prompt/completion content. */
60
+ export interface BillingDeltaRun {
61
+ run_id: string;
62
+ arm: BillingDeltaArm;
63
+ /** Operator-entered billed cost read from THEIR provider console/billing export. */
64
+ billed_cost: number;
65
+ currency: string;
66
+ /**
67
+ * The tool cannot verify this figure against the provider. ALWAYS true on every run:
68
+ * these are operator-entered, not provider-verified by this tool.
69
+ */
70
+ operator_entered: true;
71
+ /** Optional provider-reported usage the operator has on hand (aggregate token counts only — no content). */
72
+ provider_reported_usage?: {
73
+ input_tokens?: number;
74
+ output_tokens?: number;
75
+ total_tokens?: number;
76
+ };
77
+ /** ISO 8601 timestamp the operator recorded for the run. */
78
+ run_timestamp: string;
79
+ /** Free-text operator notes / confounders (e.g. cache state, retries, model version drift). Aggregate, non-content. */
80
+ notes?: string;
81
+ /** For treatment runs: optional provenance link to the apply-approval record (the compacted-context provenance). */
82
+ treatment_approval_link?: TreatmentApprovalLink;
83
+ }
84
+ /** Fixed conditions pinned at init time — requirement (a): the workflow/run identity contract. */
85
+ export interface BillingDeltaFixedConditions {
86
+ /** Model identifier (e.g. provider model name). */
87
+ model: string;
88
+ /** Pinned model version where the provider exposes it; "unknown" if not pinned. */
89
+ model_version: string;
90
+ /** Plain description of the fixed input/task (NOT the content itself — a description). */
91
+ input_description: string;
92
+ /** Time/pricing window the arms were run in (free text, e.g. "2026-06-11 within one billing window"). */
93
+ window: string;
94
+ }
95
+ /** The measurement record persisted under .compaction/billing-delta/. */
96
+ export interface BillingDeltaMeasurementRecord {
97
+ schema: typeof BILLING_DELTA_RECORD_SCHEMA;
98
+ measurement_id: string;
99
+ created_at: string;
100
+ /** Operator-chosen workflow id. */
101
+ workflow_id: string;
102
+ /** Plain-language workflow description. */
103
+ workflow_description: string;
104
+ fixed_conditions: BillingDeltaFixedConditions;
105
+ /**
106
+ * Optional link to the apply-approval record from `apply-context` (the treatment context
107
+ * provenance). Recorded by path + hash. Mirrors the per-run treatment_approval_link but at
108
+ * the record level for the whole measurement.
109
+ */
110
+ apply_approval_link?: TreatmentApprovalLink;
111
+ runs: BillingDeltaRun[];
112
+ /**
113
+ * Machine-readable privacy posture (additive; same schema version). Optional because
114
+ * records written before the field existed honestly lack it — absence means "written
115
+ * pre-field", not a different posture.
116
+ */
117
+ privacy_posture?: BillingDeltaPrivacyPosture;
118
+ /** All figures are operator-entered; the tool performs no provider interaction. */
119
+ operator_entered: true;
120
+ /** This record is NOT a Tier-3 billing-confirmed claim. Stays false. */
121
+ billing_confirmed: false;
122
+ /** The tool makes no provider call and holds no credential. */
123
+ tool_makes_provider_call: false;
124
+ }
125
+ export type BillingDeltaVerdict = "insufficient_data" | "inconclusive" | "measured_caveated_delta";
126
+ export interface ArmStatistics {
127
+ arm: BillingDeltaArm;
128
+ n: number;
129
+ /** null when n === 0. */
130
+ mean: number | null;
131
+ min: number | null;
132
+ max: number | null;
133
+ /** Sample standard deviation (n-1 denominator); null when n < 2. */
134
+ sample_sd: number | null;
135
+ }
136
+ /**
137
+ * Claim-level labels for the token-delta section. Token-level, provider-reported — never a
138
+ * billing claim. The label is selected by the ACTUAL sign/status of the token delta so it
139
+ * never calls a non-reduction a "reduction" (an overclaim by mislabel): a negative input
140
+ * delta means the treatment context GREW (an INCREASE), zero means NO CHANGE, and the
141
+ * insufficient/suppressed statuses have no computed delta at all. Every variant preserves the
142
+ * "NOT billing-confirmed savings" disclaimer and makes no savings claim.
143
+ */
144
+ export declare const BILLING_DELTA_TOKEN_DELTA_LABELS: {
145
+ /** Genuine reduction: treatment used fewer input tokens than control (positive input delta). */
146
+ readonly reduction: "provider-reported token reduction (workflow-scoped) — NOT billing-confirmed savings";
147
+ /** Increase: treatment used MORE input tokens than control (negative input delta). Not a saving. */
148
+ readonly increase: "provider-reported token INCREASE (workflow-scoped) — NOT a saving; NOT billing-confirmed savings";
149
+ /** No change: the input token delta is exactly zero. */
150
+ readonly no_change: "provider-reported token delta: no change (workflow-scoped) — NOT billing-confirmed savings";
151
+ /** Not computed: insufficient token data or deltas suppressed by a failed task. */
152
+ readonly not_computed: "provider-reported token delta not computed (workflow-scoped) — NOT billing-confirmed savings";
153
+ };
154
+ export type BillingDeltaTokenDeltaLabel = (typeof BILLING_DELTA_TOKEN_DELTA_LABELS)[keyof typeof BILLING_DELTA_TOKEN_DELTA_LABELS];
155
+ /** Per-arm token statistics from the runs' provider_reported_usage fields (operator-entered from API responses). */
156
+ export interface TokenArmStatistics {
157
+ arm: BillingDeltaArm;
158
+ /** Runs in this arm that carried provider-reported input_tokens. */
159
+ n_with_tokens: number;
160
+ /** Distinct input_tokens values observed (input is deterministic for a fixed context+prompt; >1 distinct value is surfaced, not averaged away). */
161
+ input_tokens_distinct: number[];
162
+ /** True when every recorded input_tokens in the arm is identical. */
163
+ input_deterministic: boolean;
164
+ mean_input_tokens: number | null;
165
+ mean_output_tokens: number | null;
166
+ output_min: number | null;
167
+ output_max: number | null;
168
+ }
169
+ export type TokenDeltaStatus = "computed" | "insufficient_token_data" | "suppressed_task_failure";
170
+ /**
171
+ * Select the sign/status-accurate claim label. Reduction is used ONLY when the input delta is
172
+ * genuinely positive (treatment used fewer tokens); a negative delta is an increase, zero is no
173
+ * change, and a null delta (insufficient/suppressed status) is "not computed". This never
174
+ * strengthens a claim — it only makes the existing label honest for the actual sign/status.
175
+ */
176
+ export declare function selectTokenDeltaLabel(status: TokenDeltaStatus, inputTokenDelta: number | null): BillingDeltaTokenDeltaLabel;
177
+ /** Task-quality flags parsed from run notes ("task: ok" / "task: failed"). */
178
+ export interface TokenDeltaTaskQuality {
179
+ control: string[];
180
+ treatment: string[];
181
+ any_failed: boolean;
182
+ }
183
+ /**
184
+ * Provider-reported token-delta section. Token counts come from the provider's own API
185
+ * response usage metadata (operator-entered per run); the cost delta is a price-table
186
+ * ESTIMATE applied to those token deltas — never a billed figure. This section makes
187
+ * NO billing-confirmed claim and does not affect the billed-cost verdict/criterion.
188
+ */
189
+ export interface BillingDeltaTokenDelta {
190
+ /** Sign/status-accurate label (see selectTokenDeltaLabel): reduction ONLY for a genuine reduction. */
191
+ claim_label: BillingDeltaTokenDeltaLabel;
192
+ status: TokenDeltaStatus;
193
+ control: TokenArmStatistics;
194
+ treatment: TokenArmStatistics;
195
+ /** control mean input - treatment mean input. Positive = treatment used fewer input tokens. */
196
+ input_token_delta: number | null;
197
+ /** input_token_delta / control mean input. */
198
+ input_token_delta_pct: number | null;
199
+ /** control mean output - treatment mean output (noisy — read with the per-arm spread). */
200
+ output_token_delta: number | null;
201
+ /** Price-table ESTIMATE applied to the token deltas. null when the model is not in the price table. */
202
+ estimated_cost_delta: {
203
+ amount_usd: number;
204
+ cost_source: "price_table_estimate";
205
+ note: string;
206
+ } | null;
207
+ task_quality: TokenDeltaTaskQuality;
208
+ notes: string[];
209
+ /** Never a Tier-3 claim. */
210
+ billing_confirmed: false;
211
+ }
212
+ export interface BillingDeltaReport {
213
+ schema: typeof BILLING_DELTA_REPORT_SCHEMA;
214
+ measurement_id: string;
215
+ workflow_id: string;
216
+ generated_at: string;
217
+ currency: string | null;
218
+ fixed_conditions: BillingDeltaFixedConditions;
219
+ control: ArmStatistics;
220
+ treatment: ArmStatistics;
221
+ /** control_mean - treatment_mean (positive = treatment cheaper = a saving). null when an arm is empty. */
222
+ mean_delta: number | null;
223
+ /** Standard error of the delta of means. null when either arm has n < 2. */
224
+ delta_standard_error: number | null;
225
+ /** Conservative interval [mean_delta - k*SE, mean_delta + k*SE]. null when SE is null. */
226
+ delta_interval: {
227
+ lower: number;
228
+ upper: number;
229
+ } | null;
230
+ /** True only when the interval is computable AND excludes zero. */
231
+ delta_interval_excludes_zero: boolean;
232
+ /** The named, documented decision criterion. */
233
+ criterion: string;
234
+ verdict: BillingDeltaVerdict;
235
+ /** Notes attached to the verdict (e.g. the anecdote note for insufficient_data). */
236
+ verdict_notes: string[];
237
+ /** The measured workflow/conditions ONLY — never a general claim. */
238
+ claim_scope: string;
239
+ /** This is NOT a general savings claim. */
240
+ not_a_general_claim: true;
241
+ /** This record is NOT a Tier-3 billing-confirmed claim. Stays false. */
242
+ billing_confirmed: false;
243
+ /** All input figures are operator-entered; the tool did no provider interaction. */
244
+ operator_entered: true;
245
+ /** Confounders the operator recorded across the runs (notes), surfaced for honesty. */
246
+ confounders: string[];
247
+ /** Plain-language caveat block — always present. */
248
+ caveats: string[];
249
+ /** Treatment-run provenance links recorded (path + hash), surfaced for provenance. */
250
+ treatment_provenance_links: TreatmentApprovalLink[];
251
+ /** Provider-reported token-delta section (token-level; never a billing claim; does not affect the verdict). */
252
+ token_delta: BillingDeltaTokenDelta;
253
+ }
254
+ export interface InitMeasurementInput {
255
+ workflowId: string;
256
+ workflowDescription: string;
257
+ model: string;
258
+ modelVersion?: string;
259
+ inputDescription: string;
260
+ window: string;
261
+ measurementId?: string;
262
+ generatedAt: string;
263
+ applyApprovalRecordPath?: string;
264
+ applyApprovalRecordContent?: string;
265
+ }
266
+ export declare function buildTreatmentApprovalLink(path: string, fileContent: string): TreatmentApprovalLink;
267
+ export declare function initMeasurementRecord(input: InitMeasurementInput): BillingDeltaMeasurementRecord;
268
+ export interface AddRunInput {
269
+ arm: BillingDeltaArm;
270
+ billedCost: number;
271
+ currency: string;
272
+ runTimestamp: string;
273
+ notes?: string;
274
+ providerReportedUsage?: {
275
+ input_tokens?: number;
276
+ output_tokens?: number;
277
+ total_tokens?: number;
278
+ };
279
+ treatmentApprovalRecordPath?: string;
280
+ treatmentApprovalRecordContent?: string;
281
+ runId?: string;
282
+ }
283
+ export declare function addRun(record: BillingDeltaMeasurementRecord, input: AddRunInput): BillingDeltaMeasurementRecord;
284
+ /**
285
+ * Compute the provider-reported token-delta section. Input tokens are deterministic for a
286
+ * fixed context+prompt, so one tokened run per arm pins the input delta exactly; the
287
+ * billed-cost verdict and its N>=3 criterion are unaffected by this section.
288
+ */
289
+ export declare function computeTokenDelta(record: BillingDeltaMeasurementRecord): BillingDeltaTokenDelta;
290
+ export declare function computeReport(record: BillingDeltaMeasurementRecord, generatedAt: string): BillingDeltaReport;