@trazum/core 3.0.1 → 3.0.2

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 (80) hide show
  1. package/README.md +1 -1
  2. package/dist/claude-model-pricing.d.ts +73 -0
  3. package/dist/claude-model-pricing.d.ts.map +1 -0
  4. package/dist/claude-model-pricing.js +208 -0
  5. package/dist/claude-model-pricing.js.map +1 -0
  6. package/dist/config-schema.d.ts +14 -1
  7. package/dist/config-schema.d.ts.map +1 -1
  8. package/dist/config-schema.js +24 -0
  9. package/dist/config-schema.js.map +1 -1
  10. package/dist/index.d.ts +13 -4
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +10 -2
  13. package/dist/index.js.map +1 -1
  14. package/dist/node.d.ts +1 -1
  15. package/dist/node.d.ts.map +1 -1
  16. package/dist/node.js +1 -1
  17. package/dist/node.js.map +1 -1
  18. package/dist/otlp.d.ts +103 -0
  19. package/dist/otlp.d.ts.map +1 -1
  20. package/dist/otlp.js +185 -0
  21. package/dist/otlp.js.map +1 -1
  22. package/dist/partner-model-id.d.ts +26 -0
  23. package/dist/partner-model-id.d.ts.map +1 -0
  24. package/dist/partner-model-id.js +60 -0
  25. package/dist/partner-model-id.js.map +1 -0
  26. package/dist/plan-edit.d.ts +99 -0
  27. package/dist/plan-edit.d.ts.map +1 -0
  28. package/dist/plan-edit.js +142 -0
  29. package/dist/plan-edit.js.map +1 -0
  30. package/dist/plan.d.ts +63 -2
  31. package/dist/plan.d.ts.map +1 -1
  32. package/dist/plan.js +55 -0
  33. package/dist/plan.js.map +1 -1
  34. package/dist/pricing.d.ts +19 -0
  35. package/dist/pricing.d.ts.map +1 -1
  36. package/dist/pricing.js +32 -0
  37. package/dist/pricing.js.map +1 -1
  38. package/dist/prometheus.d.ts +42 -0
  39. package/dist/prometheus.d.ts.map +1 -0
  40. package/dist/prometheus.js +112 -0
  41. package/dist/prometheus.js.map +1 -0
  42. package/dist/receipt.d.ts +2 -1
  43. package/dist/receipt.d.ts.map +1 -1
  44. package/dist/receipt.js +11 -1
  45. package/dist/receipt.js.map +1 -1
  46. package/dist/session-waste.d.ts +145 -0
  47. package/dist/session-waste.d.ts.map +1 -0
  48. package/dist/session-waste.js +489 -0
  49. package/dist/session-waste.js.map +1 -0
  50. package/dist/structure.js +3 -3
  51. package/dist/structure.js.map +1 -1
  52. package/dist/tokenizer.d.ts +9 -0
  53. package/dist/tokenizer.d.ts.map +1 -1
  54. package/dist/tokenizer.js +1 -1
  55. package/dist/tokenizer.js.map +1 -1
  56. package/dist/verify.d.ts +11 -1
  57. package/dist/verify.d.ts.map +1 -1
  58. package/dist/verify.js +54 -0
  59. package/dist/verify.js.map +1 -1
  60. package/dist/walk.d.ts +14 -0
  61. package/dist/walk.d.ts.map +1 -1
  62. package/dist/walk.js +35 -0
  63. package/dist/walk.js.map +1 -1
  64. package/package.json +1 -1
  65. package/src/claude-model-pricing.ts +245 -0
  66. package/src/config-schema.ts +44 -0
  67. package/src/index.ts +46 -4
  68. package/src/node.ts +1 -1
  69. package/src/otlp.ts +281 -0
  70. package/src/partner-model-id.ts +69 -0
  71. package/src/plan-edit.ts +180 -0
  72. package/src/plan.ts +104 -3
  73. package/src/pricing.ts +33 -0
  74. package/src/prometheus.ts +131 -0
  75. package/src/receipt.ts +16 -2
  76. package/src/session-waste.ts +570 -0
  77. package/src/structure.ts +3 -3
  78. package/src/tokenizer.ts +1 -1
  79. package/src/verify.ts +78 -2
  80. package/src/walk.ts +33 -0
package/src/plan.ts CHANGED
@@ -30,7 +30,51 @@ import { UNLABELLED, cacheEconomics } from './usage.js';
30
30
  import type { UsageProfileReport } from './usage.js';
31
31
  import type { BillLevers } from './levers.js';
32
32
 
33
- export type PlanActionKind = 'route' | 'batch' | 'route+batch' | 'fix-truncation' | 'fix-caching';
33
+ export type PlanActionKind = 'route' | 'batch' | 'route+batch' | 'fix-truncation' | 'fix-caching' | 'edit-file';
34
+
35
+ /**
36
+ * What an `edit-file` action does to the file, in the order it does it.
37
+ *
38
+ * `reorder` moves stable blocks ahead of the first placeholder
39
+ * (`reorderForCache`); `trim` runs the `safe` rules (`optimize`). Both are the
40
+ * deterministic transformations this repository already ships, and nothing
41
+ * else is a step: an edit a model wrote cannot be expressed here, which is
42
+ * the point (#796).
43
+ */
44
+ export type PlanEditStep = 'reorder' | 'trim';
45
+
46
+ /** Every step an edit may name, as a value, for the validator below. */
47
+ export const PLAN_EDIT_STEPS: readonly PlanEditStep[] = ['reorder', 'trim'];
48
+
49
+ /**
50
+ * An edit to one tracked file, recorded so it can be made again and checked.
51
+ *
52
+ * **The new text is not stored.** What is stored is the file the plan was
53
+ * made against (`beforeSha256`), what the steps turn it into
54
+ * (`afterSha256`), and what the steps were. Whoever applies the edit reads the
55
+ * file, checks it is the one the plan saw, runs the same steps, and checks the
56
+ * result is the one the plan promised. A plan file edited by hand to carry
57
+ * other text has nowhere to put it.
58
+ */
59
+ export interface PlanEdit {
60
+ /** The file, relative to the repository root, forward slashes. */
61
+ path: string;
62
+ /** Applied in this order. */
63
+ steps: PlanEditStep[];
64
+ /** The rule level `trim` runs at. Only `safe` is written or accepted. */
65
+ level: 'safe';
66
+ /** Rule ids `trim` leaves off, from the configuration that made the plan. */
67
+ disabledRules: string[];
68
+ /** `reorder`'s bar: the prefix it must reach to move anything, or 0. */
69
+ minPrefixTokens: number;
70
+ /** SHA-256 of the file's text as the plan read it, lowercase hex. */
71
+ beforeSha256: string;
72
+ /** SHA-256 of the text the steps produce from it, lowercase hex. */
73
+ afterSha256: string;
74
+ /** The file's tokens before and after, by the estimator: estimated, not measured. */
75
+ beforeTokens: number;
76
+ afterTokens: number;
77
+ }
34
78
 
35
79
  /**
36
80
  * What the log cannot confirm, as data rather than prose.
@@ -49,7 +93,12 @@ export type PlanAssumption =
49
93
  /** A max_tokens the answers fit inside removes the retry pair. */
50
94
  | { kind: 'max-tokens-fits' }
51
95
  /** The traffic pattern holds — a cache underwater on this log may pay on other traffic. */
52
- | { kind: 'traffic-pattern-holds' };
96
+ | { kind: 'traffic-pattern-holds' }
97
+ /**
98
+ * The file is what this workload sends. The configuration says so; the log
99
+ * records tokens, not which file they came from.
100
+ */
101
+ | { kind: 'file-is-what-label-sends'; path: string };
53
102
 
54
103
  export interface PlanAction {
55
104
  kind: PlanActionKind;
@@ -60,7 +109,8 @@ export interface PlanAction {
60
109
  * Projected saving per the log's own period, for route/batch — or null for
61
110
  * the measured-stake actions, whose money is in `stakeUsd` instead. Never
62
111
  * both: a projection and a measurement in one field is a number that is
63
- * neither.
112
+ * neither. An `edit-file` action carries neither: its figure is the
113
+ * workload's measured `detail.baseline`, which the edit is expected against.
64
114
  */
65
115
  savingUsd: number | null;
66
116
  /**
@@ -85,6 +135,8 @@ export interface PlanAction {
85
135
  * never be told from "the prediction was wrong".
86
136
  */
87
137
  baseline?: { calls: number; usd: number; inputPerCallTokens: number; outputPerCallTokens: number };
138
+ /** The edit, for `edit-file`. */
139
+ edit?: PlanEdit;
88
140
  };
89
141
  }
90
142
 
@@ -252,8 +304,50 @@ export const PLAN_ACTION_KINDS: readonly PlanActionKind[] = [
252
304
  'route+batch',
253
305
  'fix-truncation',
254
306
  'fix-caching',
307
+ 'edit-file',
255
308
  ];
256
309
 
310
+ const HEX64 = /^[0-9a-f]{64}$/;
311
+
312
+ /**
313
+ * Why an `edit-file` action's edit is not one, or null when it is.
314
+ *
315
+ * Stricter than the rest of the validator, on purpose: the path here is
316
+ * something a later step reads and writes, so a path that climbs out of the
317
+ * repository, starts at the root, or names git's own directory is refused
318
+ * before anything can act on it.
319
+ */
320
+ export function planEditProblem(raw: unknown): string | null {
321
+ if (typeof raw !== 'object' || raw === null || Array.isArray(raw)) return 'detail.edit is not an object';
322
+ const edit = raw as Record<string, unknown>;
323
+ const path = edit.path;
324
+ if (typeof path !== 'string' || path.length === 0 || path.length > 1024) return 'edit.path is not a path';
325
+ if (
326
+ path.startsWith('/') ||
327
+ path.includes('\\') ||
328
+ /^[A-Za-z]:/.test(path) ||
329
+ path.split('/').some((part) => part === '' || part === '.' || part === '..' || part.toLowerCase() === '.git') ||
330
+ /[\u0000-\u001f]/.test(path)
331
+ ) {
332
+ return 'edit.path is not a relative path inside the repository';
333
+ }
334
+ if (!Array.isArray(edit.steps) || edit.steps.length === 0 || !edit.steps.every((step) => PLAN_EDIT_STEPS.includes(step as PlanEditStep))) {
335
+ return `edit.steps is not a list of ${PLAN_EDIT_STEPS.join(', ')}`;
336
+ }
337
+ if (new Set(edit.steps).size !== edit.steps.length) return 'edit.steps names a step twice';
338
+ if (edit.level !== 'safe') return 'edit.level is not safe';
339
+ if (!Array.isArray(edit.disabledRules) || !edit.disabledRules.every((id) => typeof id === 'string')) {
340
+ return 'edit.disabledRules is not a list of rule ids';
341
+ }
342
+ if (typeof edit.minPrefixTokens !== 'number' || !Number.isFinite(edit.minPrefixTokens) || edit.minPrefixTokens < 0) {
343
+ return 'edit.minPrefixTokens is not a number of 0 or more';
344
+ }
345
+ if (typeof edit.beforeSha256 !== 'string' || !HEX64.test(edit.beforeSha256)) return 'edit.beforeSha256 is not a SHA-256';
346
+ if (typeof edit.afterSha256 !== 'string' || !HEX64.test(edit.afterSha256)) return 'edit.afterSha256 is not a SHA-256';
347
+ if (edit.beforeSha256 === edit.afterSha256) return 'edit changes nothing';
348
+ return null;
349
+ }
350
+
257
351
  /** Why a file is not a plan, in a shape a caller can render in its own words. */
258
352
  export type PlanParseFailure =
259
353
  | { kind: 'not-json' }
@@ -323,6 +417,13 @@ export function parsePlanDocument(text: string): PlanParseResult {
323
417
  why: { kind: 'action-malformed', index, because: `kind is not one of ${PLAN_ACTION_KINDS.join(', ')}` },
324
418
  };
325
419
  }
420
+ // An edit is the one action something later acts on rather than reads,
421
+ // so its detail is checked here, once, for every surface that parses.
422
+ if (action.kind === 'edit-file') {
423
+ const detail = action.detail as Record<string, unknown> | undefined;
424
+ const problem = planEditProblem(typeof detail === 'object' && detail !== null ? detail.edit : undefined);
425
+ if (problem !== null) return { ok: false, why: { kind: 'action-malformed', index, because: problem } };
426
+ }
326
427
  }
327
428
  return { ok: true, plan: doc as unknown as PlanDocument & { createdAt?: string } };
328
429
  }
package/src/pricing.ts CHANGED
@@ -213,6 +213,39 @@ export const PRICING_LAST_REVIEWED: string = Object.values(PROVIDER_REVIEWED).re
213
213
  (oldest, date) => (date < oldest ? date : oldest),
214
214
  );
215
215
 
216
+ /**
217
+ * The pages each provider's prices were read from on its `PROVIDER_REVIEWED`
218
+ * date, copied from the comment above that date and from nowhere else.
219
+ *
220
+ * Per provider, because that is how the catalogue records a review: a date
221
+ * per provider, and the pages read that day in prose above it. No model has
222
+ * a source of its own here, and none is implied. Kept as data so that the
223
+ * published dataset (`scripts/pricing-dataset.mjs`, #784) can put a page
224
+ * beside the date on every row without reading prose. Where the comment
225
+ * names an address that has since moved, this holds the one read on the
226
+ * date: Google's prices were read at aistudio.google.com on 2026-11-16, and
227
+ * Mistral's on 2026-11-05 at its inference page and three model cards, not
228
+ * at the `mistral.ai/pricing` that review began from in August.
229
+ *
230
+ * Moves with the date: a re-read that reads another page changes both.
231
+ * `provider-sources.test.js` fails on a provider without pages and on a page
232
+ * the comment above its date does not name.
233
+ */
234
+ export const PROVIDER_SOURCES: Readonly<Record<string, readonly string[]>> = Object.freeze({
235
+ anthropic: Object.freeze(['https://platform.claude.com/docs/en/about-claude/pricing']),
236
+ openai: Object.freeze(['https://developers.openai.com/api/docs/pricing']),
237
+ google: Object.freeze(['https://aistudio.google.com/docs/pricing']),
238
+ moonshot: Object.freeze(['https://platform.kimi.ai/docs/pricing/chat']),
239
+ deepseek: Object.freeze(['https://api-docs.deepseek.com/quick_start/pricing']),
240
+ xai: Object.freeze(['https://docs.x.ai/developers/models']),
241
+ mistral: Object.freeze([
242
+ 'https://mistral.ai/cloud/inference/',
243
+ 'https://mistral.ai/news/mistral-3/',
244
+ 'https://mistral.ai/news/mistral-small-4/',
245
+ 'https://mistral.ai/news/vibe-remote-agents-mistral-medium-3-5/',
246
+ ]),
247
+ });
248
+
216
249
  /** Cost multipliers relative to the input price. */
217
250
  /**
218
251
  * The defaults, which are Anthropic's numbers.
@@ -0,0 +1,131 @@
1
+ /**
2
+ * An OTLP metrics payload in the Prometheus text exposition format.
3
+ *
4
+ * Written from the payload `otlp.ts` builds rather than from the records a
5
+ * second time, so the two files cannot disagree: every sample here is a data
6
+ * point there, with the same value and the same attributes as labels. The bill's
7
+ * rules carry over with it: a cost sample says it is API-equivalent
8
+ * (`trazum_cost_basis="api-equivalent"`), what could not be priced is its own
9
+ * metric and in no cost sample, and a day still being measured is not a sample.
10
+ *
11
+ * **Nothing is pushed.** The text is written to a file, the shape the node
12
+ * exporter's textfile collector reads, so Prometheus scrapes it the way it
13
+ * scrapes everything else. Trazum holds no endpoint and no credential.
14
+ *
15
+ * **No timestamps.** A bill's point is one closed day, and its OTLP point is
16
+ * stamped at that day's first instant. Prometheus refuses a scraped sample that
17
+ * far in the past, so a sample here carries no timestamp: each day is its own
18
+ * series, told apart by its `trazum_day` label, and its value is that day's
19
+ * total. A chart sums by that label, as the Grafana dashboard in
20
+ * `docs/grafana/trazum-bill.json` does.
21
+ *
22
+ * The format (https://prometheus.io/docs/instrumenting/exposition_formats/):
23
+ * a `# HELP` and a `# TYPE` line once per metric, then one line per sample,
24
+ * `name{label="value",...} value`. Names and label names are
25
+ * `[a-zA-Z_][a-zA-Z0-9_]*`, so each `.` becomes `_`; a label value escapes `\`,
26
+ * `"` and a line break, and a help text escapes `\` and a line break.
27
+ */
28
+
29
+ import type { OtlpAttribute, OtlpPayload } from './otlp.js';
30
+
31
+ /** A metric or label name as Prometheus accepts it: dots and anything else outside the set become `_`. */
32
+ export function prometheusName(name: string): string {
33
+ const safe = name.replace(/[^a-zA-Z0-9_]/g, '_');
34
+ return /^[a-zA-Z_]/.test(safe) ? safe : `_${safe}`;
35
+ }
36
+
37
+ /** A metric's name with its unit, where the unit is a currency: `trazum.bill.cost` in USD is `trazum_bill_cost_usd`. */
38
+ function metricName(name: string, unit: string): string {
39
+ const base = prometheusName(name);
40
+ return unit === 'USD' && !base.endsWith('_usd') ? `${base}_usd` : base;
41
+ }
42
+
43
+ /** Whether a text is an instant exactly as `toISOString` writes one: read back and written again, it is the same text. */
44
+ function isInstant(text: string): boolean {
45
+ const at = Date.parse(text);
46
+ return Number.isFinite(at) && new Date(at).toISOString() === text;
47
+ }
48
+
49
+ /** A label value as the format reads it: `\`, `"` and a line break escaped. */
50
+ export const prometheusLabelValue = (value: string): string => value.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n');
51
+ const helpText = (value: string): string => value.replace(/\\/g, '\\\\').replace(/\n/g, '\\n');
52
+
53
+ /** An attribute's value as text, whichever of the three OTLP encodings it has. */
54
+ function attributeText(attribute: OtlpAttribute): string {
55
+ const value = attribute.value;
56
+ if ('stringValue' in value) return value.stringValue;
57
+ if ('intValue' in value) return value.intValue;
58
+ return String(value.doubleValue);
59
+ }
60
+
61
+ const labels = (attributes: readonly OtlpAttribute[]): string =>
62
+ attributes.length === 0 ? '' : `{${attributes.map((a) => `${prometheusName(a.key)}="${prometheusLabelValue(attributeText(a))}"`).join(',')}}`;
63
+
64
+ /** A number as Prometheus reads it: finite numbers as JavaScript writes them, the rest by name. */
65
+ function sampleValue(value: number | string): string {
66
+ if (typeof value === 'string') return value;
67
+ if (Number.isNaN(value)) return 'NaN';
68
+ if (!Number.isFinite(value)) return value > 0 ? '+Inf' : '-Inf';
69
+ return String(value);
70
+ }
71
+
72
+ /**
73
+ * The payload as Prometheus text. Each gauge is a gauge; the resource's numeric
74
+ * attributes (for the bill, what a day still being measured and what had no
75
+ * date held) are each a gauge of their own, an instant among its text
76
+ * attributes is a gauge in seconds, and the rest of its text attributes are
77
+ * the labels of one `<service>_info` sample of value 1, the convention for
78
+ * facts that are not numbers. Ends with a line break, as the format requires.
79
+ */
80
+ export function toPrometheusText(payload: OtlpPayload): string {
81
+ const out: string[] = [];
82
+ const [resourceMetrics] = payload.resourceMetrics;
83
+ const resource = resourceMetrics.resource.attributes;
84
+ const service = resource.find((a) => a.key === 'service.name');
85
+ const prefix = service === undefined ? 'otlp' : prometheusName(attributeText(service));
86
+
87
+ for (const metric of resourceMetrics.scopeMetrics[0].metrics) {
88
+ const name = metricName(metric.name, metric.unit);
89
+ out.push(`# HELP ${name} ${helpText(metric.description)}`, `# TYPE ${name} gauge`);
90
+ for (const point of metric.gauge.dataPoints) {
91
+ const value = point.asDouble ?? point.asInt;
92
+ if (value === undefined) continue;
93
+ out.push(`${name}${labels(point.attributes)} ${sampleValue(value)}`);
94
+ }
95
+ }
96
+
97
+ const numeric = resource.filter((a) => !('stringValue' in a.value));
98
+ for (const attribute of numeric) {
99
+ const name = prometheusName(attribute.key);
100
+ out.push(
101
+ `# HELP ${name} ${helpText(`The payload's resource attribute ${attribute.key}.`)}`,
102
+ `# TYPE ${name} gauge`,
103
+ `${name} ${sampleValue(attributeText(attribute))}`,
104
+ );
105
+ }
106
+ /*
107
+ An instant is a number, not a label: a label that changes on every write
108
+ starts a new series on every write, which Prometheus keeps until it ages
109
+ out. So `trazum.bill.measured_at` is `trazum_bill_measured_at_seconds`,
110
+ seconds since the epoch, and only text that stays the same for a day or
111
+ more (the open days) is a label.
112
+ */
113
+ const instants = resource.filter((a) => 'stringValue' in a.value && isInstant(a.value.stringValue));
114
+ for (const attribute of instants) {
115
+ const name = `${prometheusName(attribute.key)}_seconds`;
116
+ out.push(
117
+ `# HELP ${name} ${helpText(`The payload's resource attribute ${attribute.key}, in seconds since the epoch.`)}`,
118
+ `# TYPE ${name} gauge`,
119
+ `${name} ${sampleValue(Date.parse(attributeText(attribute)) / 1000)}`,
120
+ );
121
+ }
122
+ const text = resource.filter((a) => 'stringValue' in a.value && a.key !== 'service.name' && !instants.includes(a));
123
+ const info = `${prefix}_info`;
124
+ out.push(
125
+ `# HELP ${info} ${helpText("The payload's text resource attributes, as labels.")}`,
126
+ `# TYPE ${info} gauge`,
127
+ `${info}${labels(text)} 1`,
128
+ );
129
+
130
+ return `${out.join('\n')}\n`;
131
+ }
package/src/receipt.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { PROVIDER_REVIEWED, modelFrom } from './pricing.js';
2
+ import type { ModelPricing } from './types.js';
2
3
  import type { PricingCatalogue } from './pricing.js';
3
4
  import { UNLABELLED } from './usage.js';
4
5
  import type { UsageBreakdown, UsageProfileReport } from './usage.js';
@@ -86,7 +87,8 @@ export interface ReceiptPricing {
86
87
  outputPerMTok: number;
87
88
  /**
88
89
  * The date this provider's rates were last read off its own page, `null`
89
- * when the catalogue carries no date for that provider.
90
+ * when the catalogue carries no date for that provider. For a model a pricing
91
+ * overlay set or added, the overlay's date: its rates came from there.
90
92
  *
91
93
  * Per provider rather than per catalogue, because that is how the prices are
92
94
  * actually reviewed: looking at one page and finding nothing changed is not
@@ -343,6 +345,18 @@ export const RECEIPT_LINE_FIELDS: readonly string[] = Object.freeze(
343
345
  Object.keys(RECEIPT_LINE_FIELD_MAP),
344
346
  );
345
347
 
348
+ /**
349
+ * The date behind a line's rates. A row an overlay set or added was read on the
350
+ * overlay's date, not on the day the bundled table read the provider's page:
351
+ * contracted rates from `trazum model-pricing` (#856) carried the catalogue's
352
+ * date until then, which said the provider's page was read when the contract
353
+ * was. `reviewedForModels` already answered this way for a whole report.
354
+ */
355
+ const reviewedOnOf = (model: ModelPricing, catalogue: PricingCatalogue): string | null =>
356
+ catalogue.overriddenModels.includes(model.id) || catalogue.addedModels.includes(model.id)
357
+ ? catalogue.lastReviewed
358
+ : (PROVIDER_REVIEWED[model.provider ?? ''] ?? null);
359
+
346
360
  const lineFrom = (
347
361
  label: string,
348
362
  model: string,
@@ -383,7 +397,7 @@ const lineFrom = (
383
397
  provider: priced.provider ?? 'unknown',
384
398
  inputPerMTok: priced.inputPerMTok,
385
399
  outputPerMTok: priced.outputPerMTok,
386
- reviewedOn: PROVIDER_REVIEWED[priced.provider ?? ''] ?? null,
400
+ reviewedOn: reviewedOnOf(priced, catalogue),
387
401
  },
388
402
  /* Copied, never derived. Neither can be recovered from the aggregates
389
403
  above: a maximum is not a mean, and how many calls were silent about