@trazum/core 1.50.2 → 1.50.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,234 @@
1
+ /**
2
+ * In the path of the call, and still only able to say yes or no.
3
+ *
4
+ * 1.44 gave a local service that *answers* and 1.45 gave an agent a guard it
5
+ * may consult and ignore. Advice an implementation can skip is advice a budget
6
+ * cannot rely on, and a connector that pulls usage after the fact always
7
+ * reports the runaway after it ran. Standing in the path fixes both: usage is
8
+ * measured at the moment of the call, and a refusal is a refusal.
9
+ *
10
+ * It also makes this the most dangerous module in the product, and the two
11
+ * rules below are the whole design.
12
+ *
13
+ * ## It refuses; it never substitutes
14
+ *
15
+ * A call over budget is **rejected**, with a machine-readable reason and the
16
+ * cheaper alternative named. Silently swapping the model, trimming the prompt
17
+ * or downgrading a request in flight is the one behaviour this product must
18
+ * never have. The caller asked for something specific; a proxy that quietly
19
+ * answers a different question is worse than one that fails, because the
20
+ * failure is visible and the substitution is not.
21
+ *
22
+ * That is enforced in the *type*, not in a comment. A `GatewayDecision` is
23
+ * either `forward` — carrying nothing the caller did not send — or `refuse`,
24
+ * carrying no body at all. There is no shape in which this module hands back a
25
+ * modified request, so no future edit can add one without changing a type that
26
+ * every caller and every test reads.
27
+ *
28
+ * Substitution exists only as an operator's configured, logged decision, and
29
+ * even then it is a *different kind*: `substitute` names what changed and why,
30
+ * and every call that took it is marked so no later report treats it as the
31
+ * call the caller made.
32
+ *
33
+ * ## Failure is a decision made in advance
34
+ *
35
+ * When the gateway cannot tell — no budget, nothing measured, an unpriced
36
+ * model — somebody has to have already decided what happens. **Fail-open** and
37
+ * **fail-closed** are both defensible: one keeps the product working and lets
38
+ * the bill run, the other stops the bill and takes the product down with it.
39
+ * There is deliberately no default. A proxy that picks silently has made the
40
+ * most consequential decision in somebody's architecture on their behalf.
41
+ *
42
+ * ## Nothing about the payload is recorded
43
+ *
44
+ * Prompt and completion pass through. The store has held aggregates since
45
+ * 1.42 and standing in the path changes nothing about that: this module never
46
+ * receives the body text at all — it is handed a *description* of the call,
47
+ * and the shape of its inputs is what makes the promise checkable.
48
+ */
49
+ import { effectivePricing, multipliersFor } from './pricing.js';
50
+ export const FAILURE_POLICIES = ['fail-open', 'fail-closed'];
51
+ /** What this call costs at a model's rates, or null when it cannot be priced. */
52
+ function priceCall(model, call, on) {
53
+ if (model === undefined || call.inputTokens === null)
54
+ return null;
55
+ const rates = effectivePricing(model, on);
56
+ const output = call.maxOutputTokens ?? 0;
57
+ return (call.inputTokens / 1_000_000) * rates.inputPerMTok + (output / 1_000_000) * rates.outputPerMTok;
58
+ }
59
+ /**
60
+ * Cheaper models of the same provider that this call fits inside.
61
+ *
62
+ * Same rule as the spend guard's: a model the prompt does not fit in is not a
63
+ * cheaper way to make the call, it is a way not to make it.
64
+ */
65
+ function alternativesFor(model, call, catalogue, on) {
66
+ const mine = priceCall(model, call, on);
67
+ if (mine === null)
68
+ return [];
69
+ const out = [];
70
+ const here = effectivePricing(model, on);
71
+ for (const candidate of catalogue.byId.values()) {
72
+ if (candidate.id === model.id || candidate.provider !== model.provider)
73
+ continue;
74
+ const there = effectivePricing(candidate, on);
75
+ if (there.inputPerMTok >= here.inputPerMTok)
76
+ continue;
77
+ if (call.inputTokens !== null && candidate.contextWindow < call.inputTokens)
78
+ continue;
79
+ const routed = priceCall(candidate, call, on);
80
+ if (routed === null)
81
+ continue;
82
+ out.push({
83
+ kind: 'route',
84
+ model: { id: candidate.id, displayName: candidate.displayName },
85
+ savingUsd: mine - routed,
86
+ assumes: [{ kind: 'model-capability', model: candidate.displayName }],
87
+ });
88
+ }
89
+ /**
90
+ * The batch lever is offered on a refusal and **never as a substitution**.
91
+ *
92
+ * Moving a synchronous call onto a batch window changes when the answer
93
+ * arrives, which is a change to what the caller asked for. It belongs in the
94
+ * list of things a human might do, not in anything the proxy can do.
95
+ */
96
+ const batch = multipliersFor(model).batch;
97
+ if (batch !== null) {
98
+ out.push({ kind: 'batch', model: null, savingUsd: mine - mine * batch, assumes: [{ kind: 'batch-window' }] });
99
+ }
100
+ return out.sort((a, b) => b.savingUsd - a.savingUsd);
101
+ }
102
+ function whyCannotTell(standing, priced) {
103
+ if (standing === null)
104
+ return 'no-budget';
105
+ if (standing.consumedUsd === 0 && standing.provenance !== 'measured')
106
+ return 'nothing-measured';
107
+ return priced === null ? 'model-unpriced' : null;
108
+ }
109
+ /**
110
+ * Yes, no, or the operator's pre-made decision — for one call.
111
+ *
112
+ * Pure, so the rule that matters most (this never rewrites a request) is
113
+ * checkable without a socket, and so the proxy around it has nothing to do but
114
+ * move bytes.
115
+ */
116
+ export function gatewayDecision(call, standing, options) {
117
+ const { catalogue, policy, on = new Date() } = options;
118
+ const model = catalogue.byId.get(call.model);
119
+ const estimatedUsd = priceCall(model, call, on);
120
+ const cause = whyCannotTell(standing, estimatedUsd);
121
+ if (cause !== null) {
122
+ /**
123
+ * Cannot judge. The operator decided this in advance, and a substitution
124
+ * is **not** consulted here: swapping a model because a *budget* could not
125
+ * be read would be answering a different question for a reason that has
126
+ * nothing to do with the caller's request.
127
+ */
128
+ if (policy.onCannotTell === 'fail-open') {
129
+ return { kind: 'forward', estimatedUsd, unjudged: cause };
130
+ }
131
+ return {
132
+ kind: 'refuse',
133
+ reason: 'cannot-tell-and-closed',
134
+ cause,
135
+ restsOn: null,
136
+ standing,
137
+ estimatedUsd,
138
+ alternatives: [],
139
+ because: becauseCannotTell(cause),
140
+ };
141
+ }
142
+ // `cause === null` guarantees both of these, and the compiler does not know
143
+ // it — narrowed here rather than asserted, so a change to `whyCannotTell`
144
+ // that stopped guaranteeing them fails the build instead of the request.
145
+ if (standing === null || estimatedUsd === null || model === undefined) {
146
+ return { kind: 'forward', estimatedUsd, unjudged: 'no-budget' };
147
+ }
148
+ const already = standing.consumedUsd > standing.limitUsd;
149
+ const wouldCross = standing.consumedUsd + estimatedUsd > standing.limitUsd;
150
+ if (!already && !wouldCross) {
151
+ return { kind: 'forward', estimatedUsd, unjudged: null };
152
+ }
153
+ const configured = policy.substitute?.[call.model];
154
+ const target = configured === undefined ? undefined : catalogue.byId.get(configured.to);
155
+ if (configured !== undefined && target !== undefined) {
156
+ return {
157
+ kind: 'substitute',
158
+ to: { id: target.id, displayName: target.displayName },
159
+ configuredReason: configured.reason,
160
+ estimatedUsd: priceCall(target, call, on),
161
+ markedInStore: true,
162
+ };
163
+ }
164
+ return {
165
+ kind: 'refuse',
166
+ reason: already ? 'budget-exhausted' : 'call-would-cross',
167
+ cause: null,
168
+ // The two halves, named — the rule since 1.44. An exhausted budget needs
169
+ // no estimate of this call; a crossing does, and says so.
170
+ restsOn: already ? 'measured' : 'measured+estimated',
171
+ standing,
172
+ estimatedUsd,
173
+ alternatives: alternativesFor(model, call, catalogue, on),
174
+ because: already
175
+ ? 'The budget for this period is already spent, measured.'
176
+ : 'This call would take the budget past its limit, on an estimate of this call.',
177
+ };
178
+ }
179
+ function becauseCannotTell(cause) {
180
+ return cause === 'no-budget'
181
+ ? 'No budget is configured, so there is nothing to judge this against, and this gateway is configured to fail closed.'
182
+ : cause === 'nothing-measured'
183
+ ? 'Nothing has been measured for this period, so how much of the budget is gone is unknown, and this gateway is configured to fail closed.'
184
+ : 'This model is not in the price catalogue, so the call cannot be priced, and this gateway is configured to fail closed.';
185
+ }
186
+ /**
187
+ * The tokens a provider's own response reports, from the response body.
188
+ *
189
+ * This is the reason the gateway measures better than a connector: the counts
190
+ * are the provider's, arriving with the answer, before any export exists.
191
+ *
192
+ * Returns null rather than zero when the body carries no usage. A response
193
+ * whose usage could not be read is a call whose cost is unknown, and a zero
194
+ * would make the period's total quietly too low — the flattering direction.
195
+ */
196
+ export function usageFromResponse(provider, body) {
197
+ if (typeof body !== 'object' || body === null || Array.isArray(body))
198
+ return null;
199
+ const usage = body.usage;
200
+ if (typeof usage !== 'object' || usage === null || Array.isArray(usage))
201
+ return null;
202
+ const u = usage;
203
+ const num = (value) => (typeof value === 'number' && Number.isFinite(value) ? value : 0);
204
+ if (provider === 'anthropic') {
205
+ if (typeof u.input_tokens !== 'number' && typeof u.output_tokens !== 'number')
206
+ return null;
207
+ return {
208
+ inputTokens: num(u.input_tokens),
209
+ outputTokens: num(u.output_tokens),
210
+ cacheReadTokens: num(u.cache_read_input_tokens),
211
+ cacheWriteTokens: num(u.cache_creation_input_tokens),
212
+ };
213
+ }
214
+ if (provider === 'openai') {
215
+ if (typeof u.prompt_tokens !== 'number' && typeof u.completion_tokens !== 'number')
216
+ return null;
217
+ const details = u.prompt_tokens_details;
218
+ const cached = typeof details === 'object' && details !== null
219
+ ? num(details.cached_tokens)
220
+ : 0;
221
+ return {
222
+ // `prompt_tokens` includes the cached ones, so they are subtracted
223
+ // before the fresh input is reported — counting them twice would put
224
+ // the period's total above the invoice, and in the flattering
225
+ // direction. Same correction the connector has made since 1.41.
226
+ inputTokens: Math.max(0, num(u.prompt_tokens) - cached),
227
+ outputTokens: num(u.completion_tokens),
228
+ cacheReadTokens: cached,
229
+ cacheWriteTokens: 0,
230
+ };
231
+ }
232
+ return null;
233
+ }
234
+ //# sourceMappingURL=gateway.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gateway.js","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAGH,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAahE,MAAM,CAAC,MAAM,gBAAgB,GAA6B,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;AAiHvF,iFAAiF;AACjF,SAAS,SAAS,CAChB,KAA+B,EAC/B,IAAiB,EACjB,EAAQ;IAER,IAAI,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAClE,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,I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AC;YACzD,CAAC,CAAC,CAAC,CAAC;QACR,OAAO;YACL,mEAAmE;YACnE,qEAAqE;YACrE,8DAA8D;YAC9D,gEAAgE;YAChE,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,MAAM,CAAC;YACvD,YAAY,EAAE,GAAG,CAAC,CAAC,CAAC,iBAAiB,CAAC;YACtC,eAAe,EAAE,MAAM;YACvB,gBAAgB,EAAE,CAAC;SACpB,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
package/dist/index.d.ts CHANGED
@@ -18,6 +18,10 @@ export type { PlanParseFailure, PlanParseResult } from './plan.js';
18
18
  export type { PlanAction, PlanActionKind, PlanAssumption, PlanDocument } from './plan.js';
19
19
  export { verifyPlan } from './verify.js';
20
20
  export { buildHistory, storedReportFrom, MIN_RUN } from './history.js';
21
+ export { outcomeReport, judgeOutcome, OUTCOME_UNLOCKS } from './outcome.js';
22
+ export type { OutcomeCoverage, OutcomeReport, OutcomeSlice, OutcomeTally, OutcomeUnlock, OutcomeVerdict, OutcomeVocabulary, } from './outcome.js';
23
+ export { gatewayDecision, usageFromResponse, FAILURE_POLICIES } from './gateway.js';
24
+ export type { CannotTellCause, FailurePolicy, GatewayAlternative, GatewayCall, GatewayDecision, GatewayOptions, GatewayPolicy, GatewayStanding, RefuseReason, } from './gateway.js';
21
25
  export { conform } from './conform.js';
22
26
  export type { ConformOptions, ConformanceProblem, ConformanceReport, ContractName, } from './conform.js';
23
27
  export { budgetPositions, monthOf, MAX_UNMEASURED_NAMED } from './budget.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC/F,OAAO,EACL,UAAU,EACV,cA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aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACzF,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGjF,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACjE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGxF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,aAAa,GACd,MAAM,cAAc,CAAC;AAKtB,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAKzD,OAAO,EACL,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,SAAS,EACT,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -21,6 +21,8 @@ export { assignSources, fleetRollup } from './fleet.js';
21
21
  export { buildPlan, planLabelName, parsePlanDocument, PLAN_ACTION_KINDS } from './plan.js';
22
22
  export { verifyPlan } from './verify.js';
23
23
  export { buildHistory, storedReportFrom, MIN_RUN } from './history.js';
24
+ export { outcomeReport, judgeOutcome, OUTCOME_UNLOCKS } from './outcome.js';
25
+ export { gatewayDecision, usageFromResponse, FAILURE_POLICIES } from './gateway.js';
24
26
  export { conform } from './conform.js';
25
27
  export { budgetPositions, monthOf, MAX_UNMEASURED_NAMED } from './budget.js';
26
28
  export { waiverHistory, waiverDay, isWaiverUse } from './waivers.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC/F,OAAO,EACL,UAAU,EACV,cAAc,EACd,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,QAAQ,GACT,MAAM,YAAY,CAAC;AAWpB,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAClF,gFAAgF;AAChF,4EAA4E;AAC5E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEtF,2EAA2E;AAC3E,+EAA+E;AAC/E,8EAA8E;AAC9E,0EAA0E;AAC1E,yCAAyC;AACzC,4EAA4E;AAC5E,qDAAqD;AACrD,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EACxB,6BAA6B,EAC7B,YAAY,GACb,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACpG,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAG3F,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EA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,6EAA6E;AAC7E,2DAA2D;AAC3D,OAAO,EACL,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,SAAS,EACT,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,144 @@
1
+ /**
2
+ * The counterpart every figure in this product has been missing.
3
+ *
4
+ * Everything Trazum reports is a cost. It can say a workload got forty per cent
5
+ * cheaper and cannot say whether it stopped working — a denominator with no
6
+ * numerator, since the beginning. The missing field is not something this tool
7
+ * can compute. It is something only the caller knows.
8
+ *
9
+ * ## Recorded, never inferred
10
+ *
11
+ * The whole module rests on one refusal. **No absence of complaint counts as
12
+ * success. No short conversation counts as resolution. No retry counts as
13
+ * failure on its own.** Every one of those is a plausible-looking heuristic
14
+ * that would turn a guess into a metric, and a metric somebody would then
15
+ * optimise against — which is how a tool ends up rewarding conversations that
16
+ * end early because the user gave up.
17
+ *
18
+ * Where nothing was recorded, the report says so and names what recording one
19
+ * would unlock. That is the `fieldCoverage` discipline from 1.19, applied to
20
+ * the question that matters most.
21
+ *
22
+ * ## The vocabulary is declared, not guessed
23
+ *
24
+ * `resolved`, `escalated`, `deflected`, `abandoned`, `thumbs-down` — every
25
+ * product has its own words, and **which of them count as success is a product
26
+ * judgement this tool has no standing to make**. A tool that decided
27
+ * `escalated` was a failure would be wrong at every company where escalation is
28
+ * the correct, designed outcome for a whole class of request.
29
+ *
30
+ * So the config names the values and names which are successes. An outcome in
31
+ * the log that the config never declared is **named as undeclared**, not
32
+ * quietly bucketed into one side or the other — a typo in an exporter should
33
+ * show up as a typo, not as a shift in the success rate.
34
+ *
35
+ * ## The privacy line does not move
36
+ *
37
+ * An outcome is a small enumerated value. The store keeps it the way it has
38
+ * kept everything since 1.42: aggregated, never alongside content.
39
+ */
40
+ /** What the config declares. Both halves are required; see the module note. */
41
+ export interface OutcomeVocabulary {
42
+ /** Every value this product records. Anything else in a log is undeclared. */
43
+ values: string[];
44
+ /**
45
+ * Which of them count as success.
46
+ *
47
+ * A subset of `values`, and it may be empty — a vocabulary that records only
48
+ * failures is a legitimate thing to declare, and it still gives a rate this
49
+ * tool can report against a cost.
50
+ */
51
+ success: string[];
52
+ }
53
+ export type OutcomeVerdict = 'success' | 'other' | 'undeclared';
54
+ /**
55
+ * How a single recorded value is judged. Three outcomes, never two.
56
+ *
57
+ * `other` is a declared value that is not a success. `undeclared` is a value
58
+ * nobody wrote down — which is a data-quality finding and not a result, and is
59
+ * reported as one.
60
+ */
61
+ export declare function judgeOutcome(value: string | null, vocabulary: OutcomeVocabulary): OutcomeVerdict | null;
62
+ /** One value, and what it cost. */
63
+ export interface OutcomeSlice {
64
+ value: string;
65
+ verdict: OutcomeVerdict;
66
+ calls: number;
67
+ usd: number;
68
+ }
69
+ export interface OutcomeCoverage {
70
+ /** Records that carried an outcome at all. */
71
+ recorded: number;
72
+ /** Every record that parsed — the denominator. */
73
+ parsed: number;
74
+ /**
75
+ * Spend on calls that carried no outcome.
76
+ *
77
+ * The figure that decides whether a success rate means anything. A rate
78
+ * computed over eight per cent of the bill is a rate about eight per cent of
79
+ * the bill, and printing it beside the total without this number is how a
80
+ * sample becomes a claim about the whole.
81
+ */
82
+ unrecordedUsd: number;
83
+ }
84
+ export interface OutcomeReport {
85
+ /** Per recorded value, dearest first. Empty when nothing was recorded. */
86
+ slices: OutcomeSlice[];
87
+ coverage: OutcomeCoverage;
88
+ /**
89
+ * Values found in the log that the config never declared, with what they
90
+ * cost. Named rather than bucketed: a typo in an exporter should surface as
91
+ * a typo and not as a shift in the success rate.
92
+ */
93
+ undeclared: OutcomeSlice[];
94
+ /**
95
+ * The success rate **by spend**, or null when it cannot honestly be stated.
96
+ *
97
+ * By spend rather than by call, because this product's whole subject is
98
+ * money: a success rate weighted by call count says one thing while the
99
+ * expensive half of the traffic fails, and the two figures diverge exactly
100
+ * when it matters.
101
+ *
102
+ * Null has one meaning and it is not zero: nothing was recorded. A rate of
103
+ * zero is a real, terrible measurement, and a tool that spells "nobody told
104
+ * me" the same way has destroyed the difference between them.
105
+ */
106
+ successShareOfRecordedUsd: number | null;
107
+ /**
108
+ * Why there is no rate, when there is none. A refusal never arrives bare.
109
+ */
110
+ noRate: 'nothing-recorded' | 'no-success-values-declared' | null;
111
+ }
112
+ /**
113
+ * What was recorded, before anybody judged it.
114
+ *
115
+ * Deliberately split from the report: `profileUsage` produces this while it
116
+ * reads a log, knowing nothing about which values mean success, and the
117
+ * judgement happens where the config is. Measurement and product judgement are
118
+ * different jobs and this is the seam between them.
119
+ *
120
+ * It is also an **aggregate**, never a list of records — the same shape the
121
+ * store has kept since 1.42. Counting outcomes never means keeping calls.
122
+ */
123
+ export interface OutcomeTally {
124
+ /** Per recorded value: how many calls carried it and what they cost. */
125
+ byValue: Array<{
126
+ value: string;
127
+ calls: number;
128
+ usd: number;
129
+ }>;
130
+ recorded: number;
131
+ parsed: number;
132
+ unrecordedUsd: number;
133
+ }
134
+ export declare function outcomeReport(tally: OutcomeTally, vocabulary: OutcomeVocabulary | null): OutcomeReport;
135
+ /**
136
+ * What recording an outcome would unlock, for a report that has none.
137
+ *
138
+ * Named rather than implied. "No outcome recorded" on its own reads as a
139
+ * missing feature; the point is that one small enumerated field turns every
140
+ * cost figure in this product into a cost *per* something.
141
+ */
142
+ export declare const OUTCOME_UNLOCKS: readonly ['cost-per-outcome', 'success-rate-by-spend', 'cheaper-and-still-working'];
143
+ export type OutcomeUnlock = (typeof OUTCOME_UNLOCKS)[number];
144
+ //# sourceMappingURL=outcome.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../src/outcome.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,+EAA+E;AAC/E,MAAM,WAAW,iBAAiB;IAChC,8EAA8E;IAC9E,MAAM,EA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B,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,iBAAiB,GAAG,IAAI,GACnC,aAAa,CAsDf;AAED;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,YAC1B,kBAAkB,EAClB,uBAAuB,EACvB,2BAA2B,CACnB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * The counterpart every figure in this product has been missing.
3
+ *
4
+ * Everything Trazum reports is a cost. It can say a workload got forty per cent
5
+ * cheaper and cannot say whether it stopped working — a denominator with no
6
+ * numerator, since the beginning. The missing field is not something this tool
7
+ * can compute. It is something only the caller knows.
8
+ *
9
+ * ## Recorded, never inferred
10
+ *
11
+ * The whole module rests on one refusal. **No absence of complaint counts as
12
+ * success. No short conversation counts as resolution. No retry counts as
13
+ * failure on its own.** Every one of those is a plausible-looking heuristic
14
+ * that would turn a guess into a metric, and a metric somebody would then
15
+ * optimise against — which is how a tool ends up rewarding conversations that
16
+ * end early because the user gave up.
17
+ *
18
+ * Where nothing was recorded, the report says so and names what recording one
19
+ * would unlock. That is the `fieldCoverage` discipline from 1.19, applied to
20
+ * the question that matters most.
21
+ *
22
+ * ## The vocabulary is declared, not guessed
23
+ *
24
+ * `resolved`, `escalated`, `deflected`, `abandoned`, `thumbs-down` — every
25
+ * product has its own words, and **which of them count as success is a product
26
+ * judgement this tool has no standing to make**. A tool that decided
27
+ * `escalated` was a failure would be wrong at every company where escalation is
28
+ * the correct, designed outcome for a whole class of request.
29
+ *
30
+ * So the config names the values and names which are successes. An outcome in
31
+ * the log that the config never declared is **named as undeclared**, not
32
+ * quietly bucketed into one side or the other — a typo in an exporter should
33
+ * show up as a typo, not as a shift in the success rate.
34
+ *
35
+ * ## The privacy line does not move
36
+ *
37
+ * An outcome is a small enumerated value. The store keeps it the way it has
38
+ * kept everything since 1.42: aggregated, never alongside content.
39
+ */
40
+ /**
41
+ * How a single recorded value is judged. Three outcomes, never two.
42
+ *
43
+ * `other` is a declared value that is not a success. `undeclared` is a value
44
+ * nobody wrote down — which is a data-quality finding and not a result, and is
45
+ * reported as one.
46
+ */
47
+ export function judgeOutcome(value, vocabulary) {
48
+ if (value === null)
49
+ return null;
50
+ if (!vocabulary.values.includes(value))
51
+ return 'undeclared';
52
+ return vocabulary.success.includes(value) ? 'success' : 'other';
53
+ }
54
+ export function outcomeReport(tally, vocabulary) {
55
+ const coverage = {
56
+ recorded: tally.recorded,
57
+ parsed: tally.parsed,
58
+ unrecordedUsd: tally.unrecordedUsd,
59
+ };
60
+ /**
61
+ * With no vocabulary declared, every recorded value is `undeclared`.
62
+ *
63
+ * That is the honest reading rather than an inconvenience: somebody has been
64
+ * writing outcomes into a log the config never described, so this tool knows
65
+ * what happened and not what any of it means. It reports the values and their
66
+ * cost, and declines the rate.
67
+ */
68
+ const declared = vocabulary ?? { values: [], success: [] };
69
+ const all = [...tally.byValue]
70
+ .map((entry) => ({
71
+ value: entry.value,
72
+ verdict: judgeOutcome(entry.value, declared),
73
+ calls: entry.calls,
74
+ usd: entry.usd,
75
+ }))
76
+ .sort((a, b) => b.usd - a.usd);
77
+ const slices = all.filter((slice) => slice.verdict !== 'undeclared');
78
+ const undeclared = all.filter((slice) => slice.verdict === 'undeclared');
79
+ /**
80
+ * The rate's denominator is **declared, recorded spend** — not the whole
81
+ * bill, and not every recorded value.
82
+ *
83
+ * Undeclared values are left out of both halves rather than counted as
84
+ * failures. A misspelled `resolvd` is a broken exporter, and folding it into
85
+ * the failure side would report a product regression that never happened —
86
+ * the direction that gets somebody paged at four in the morning.
87
+ */
88
+ const declaredUsd = slices.reduce((sum, slice) => sum + slice.usd, 0);
89
+ const successUsd = slices
90
+ .filter((slice) => slice.verdict === 'success')
91
+ .reduce((sum, slice) => sum + slice.usd, 0);
92
+ let successShareOfRecordedUsd = null;
93
+ let noRate = null;
94
+ if (declared.success.length === 0) {
95
+ noRate = 'no-success-values-declared';
96
+ }
97
+ else if (declaredUsd <= 0) {
98
+ noRate = 'nothing-recorded';
99
+ }
100
+ else {
101
+ successShareOfRecordedUsd = successUsd / declaredUsd;
102
+ }
103
+ return { slices, coverage, undeclared, successShareOfRecordedUsd, noRate };
104
+ }
105
+ /**
106
+ * What recording an outcome would unlock, for a report that has none.
107
+ *
108
+ * Named rather than implied. "No outcome recorded" on its own reads as a
109
+ * missing feature; the point is that one small enumerated field turns every
110
+ * cost figure in this product into a cost *per* something.
111
+ */
112
+ export const OUTCOME_UNLOCKS = [
113
+ 'cost-per-outcome',
114
+ 'success-rate-by-spend',
115
+ 'cheaper-and-still-working',
116
+ ];
117
+ //# sourceMappingURL=outcome.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outcome.js","sourceRoot":"","sources":["../src/outcome.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAkBH;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,KAAoB,EAAE,UAA6B;IAC9E,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,YAAY,CAAC;IAC5D,OAAO,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;AAClE,CAAC;AA0ED,MAAM,UAAU,aAAa,CAC3B,KAAmB,EACnB,UAAoC;IAEpC,MAAM,QAAQ,GAAoB;QAChC,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,aAAa,EAAE,KAAK,CAAC,aAAa;KACnC,CAAC;IAEF;;;;;;;OAOG;IACH,MAAM,QAAQ,GAAG,UAAU,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;I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