import type { AnalyticsEntry } from './analytics-types.js'; /** * Version 2 is the first analytics contract that proves a savings claim from * two materialized MCP payloads. Earlier rows are retained for audit, but are * not evidence that context was avoided. * * Version 3 adds the other half of the product's claim: not "this payload got * smaller on its way out" but "you did not have to read the file at all". That * baseline was never recorded before, because the only party who knew it was * the tool, and a tool's own figure is not evidence -- measured across the * benched fleet, every tool that stated its own saving stated a number that * was not what it sent, by up to 70 points and sometimes with the wrong sign. * Under version 3 the recorder reads the named input and counts it itself. * * Version 4 admits the two cases the recorder provably cannot reach from the * caller's arguments: a tool handed code inline, and a tool given only a * directory to resolve a file out of. For those the before is DECLARED by the * tool and the after is still measured here, so the row is credited under its * own class and never merges with a row where both halves were measured. The * set of ways a row can earn a credit changed, so the stamp moved with it -- * a version 3 reader seeing a declared row would otherwise have no way to know * that such a row was possible. */ export declare const SAVINGS_MEASUREMENT_SCHEMA_VERSION = 4; export type SavingsClassification = 'verified-transport-reduction' | 'verified-transport-expansion-debit' | 'verified-input-displacement' | 'declared-input-displacement' | 'observed-return-only' | 'unverified-reported'; /** * What a tool is permitted to name as the baseline it displaced. * * A UNION RATHER THAN FREE TEXT, and checked on the way in, so a stored row * always says what was counted to get its before. * * RE-EXPORTED FROM THE PRODUCING SIDE RATHER THAN RESTATED. This was a second * copy of the same five strings, and a sixth added next to the producer would * have been accepted by every tool and then refused by this check -- a * declaration that classified as unverified for no reason a reader could see. */ export declare const DECLARED_BASELINE_SOURCES: readonly string[]; export declare function classifySavings(entry: AnalyticsEntry): SavingsClassification; export declare function isVerifiedSavingsEntry(entry: AnalyticsEntry): boolean; export declare function isVerifiedExpansionDebit(entry: AnalyticsEntry): boolean; /** Signed contribution to net MCP transport avoided. */ export declare function verifiedTransportDelta(entry: AnalyticsEntry): number; /** * Tokens the caller did not spend because a tool answered instead of handing * them the file -- measured on both sides by the recorder. * * KEPT APART FROM THE TRANSPORT DELTA ON PURPOSE. The two count different * avoidances: one is payload a tool would have put on the wire anyway and the * disclosure layer trimmed, the other is a file read that never happened. A * caller that wants one total adds them deliberately; nothing adds them by * accident through a function whose name says "transport". */ export declare function verifiedInputDisplacement(entry: AnalyticsEntry): number; /** * Tokens a tool DECLARED it displaced, with only the reply measured here. * * KEPT APART FROM `verifiedInputDisplacement` ON PURPOSE, and not merely for * tidiness: the two have different evidence behind them. One was counted twice * by the same counter; the other was counted once here and once by the tool, * and across this fleet a tool's own figure was wrong by up to 70 points and * sometimes with the wrong sign. The declaration survives because it carries no * arithmetic -- it names a before and nothing else -- but it is still a weaker * row, and a reader is entitled to see which of the two a total came from. */ export declare function declaredInputDisplacement(entry: AnalyticsEntry): number; export declare function hasObservedReturnedContext(entry: AnalyticsEntry): boolean; export declare function reportedSavings(entry: AnalyticsEntry): number; //# sourceMappingURL=savings-classification.d.ts.map