@trazum/cli 1.73.1 → 1.75.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.
@@ -0,0 +1,68 @@
1
+ /**
2
+ * The CLI's presentation layer — the 1.75 arc.
3
+ *
4
+ * Six painters, one measurer, one table renderer, one proportion bar, one
5
+ * heading rule. Everything here decorates figures the prose already states;
6
+ * the chapter-four guard strips the paint and asserts nothing was lost and
7
+ * nothing was hiding in it.
8
+ *
9
+ * Colour is on for a TTY unless `NO_COLOR` says otherwise, and on anywhere
10
+ * when `FORCE_COLOR=1` — the door the guard itself walks through, since a
11
+ * test that wants to see what colour does runs under a pipe. A plain pipe
12
+ * stays plain: every `trazum ... | grep` in somebody's script is owed the
13
+ * bytes their script was written against.
14
+ */
15
+ export declare const useColor: boolean;
16
+ export declare const c: {
17
+ bold: (s: string) => string;
18
+ dim: (s: string) => string;
19
+ green: (s: string) => string;
20
+ red: (s: string) => string;
21
+ yellow: (s: string) => string;
22
+ cyan: (s: string) => string;
23
+ };
24
+ /** The report's text column. Headings rule out to it; nothing else needs it. */
25
+ export declare const REPORT_WIDTH = 74;
26
+ /**
27
+ * A string's width as a terminal draws it — the ANSI codes not counted.
28
+ *
29
+ * Every hand-rolled `padStart` in the CLI miscounted the moment a painted
30
+ * cell reached it, which is why nothing painted ever sat in a column. All
31
+ * padding below measures through this.
32
+ */
33
+ export declare function visibleWidth(s: string): number;
34
+ export declare function padCell(s: string, width: number, align: 'left' | 'right'): string;
35
+ export interface TableColumn {
36
+ /** The header cell, already localized. Empty string for a headerless column. */
37
+ header: string;
38
+ align: 'left' | 'right';
39
+ }
40
+ /**
41
+ * The one table renderer, for the eleven layouts that each rebuilt it.
42
+ *
43
+ * Widths come from the content, headers print dimmed, and cells may arrive
44
+ * painted — the measurement ignores the paint. Returns lines; the caller
45
+ * owns the `console.log` and the indent, because some tables live inside a
46
+ * bullet and some at the margin.
47
+ */
48
+ export declare function table(columns: TableColumn[], rows: string[][], indent?: string): string[];
49
+ /**
50
+ * A share the line already states, readable from further away: `███░░░░░░░`.
51
+ *
52
+ * The bar is content, not paint — it prints in a pipe too, so the stripped
53
+ * and plain outputs stay byte-identical. It never carries information the
54
+ * text does not: the percentage beside it is the number, the bar is the
55
+ * glance. Clamped, because a share over 1 is the caller's bug and a bar
56
+ * wider than asked would make it the layout's.
57
+ */
58
+ export declare function bar(share: number, width?: number): string;
59
+ /**
60
+ * A section heading an eye can stop on: the text bold, the line completed
61
+ * with a dim rule out to the report's width.
62
+ *
63
+ * Adónde fue el dinero ─────────────────────────────────────────────
64
+ *
65
+ * The rule is content (it survives the strip); the weight is paint.
66
+ */
67
+ export declare function sectionHeading(text: string, width?: number): string;
68
+ //# sourceMappingURL=style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../src/style.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,eAAO,MAAM,QAAQ,SAAkF,CAAC;AAExG,eAAO,MAAM,CAAC;IACZ,IAAI,MAAM,MAAM;IAChB,GAAG,MAAM,MAAM;IACf,KAAK,MAAM,MAAM;IACjB,GAAG,MAAM,MAAM;IACf,MAAM,MAAM,MAAM;IAClB,IAAI,MAAM,MAAM;CACjB,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,YAAY,KAAK,CAAC;AAI/B;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAGjF;AAED,MAAM,WAAW,WAAW;IAC1B,gFAAgF;IAChF,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,SAAO,GAAG,MAAM,EAAE,CAiBvF;AAED;;;;;;;;GAQG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,MAAM,CAIrD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,SAAe,GAAG,MAAM,CAGzE"}
package/dist/style.js ADDED
@@ -0,0 +1,88 @@
1
+ /**
2
+ * The CLI's presentation layer — the 1.75 arc.
3
+ *
4
+ * Six painters, one measurer, one table renderer, one proportion bar, one
5
+ * heading rule. Everything here decorates figures the prose already states;
6
+ * the chapter-four guard strips the paint and asserts nothing was lost and
7
+ * nothing was hiding in it.
8
+ *
9
+ * Colour is on for a TTY unless `NO_COLOR` says otherwise, and on anywhere
10
+ * when `FORCE_COLOR=1` — the door the guard itself walks through, since a
11
+ * test that wants to see what colour does runs under a pipe. A plain pipe
12
+ * stays plain: every `trazum ... | grep` in somebody's script is owed the
13
+ * bytes their script was written against.
14
+ */
15
+ const forced = process.env.FORCE_COLOR === '1';
16
+ export const useColor = forced || (process.stdout.isTTY === true && process.env.NO_COLOR === undefined);
17
+ export const c = {
18
+ bold: (s) => (useColor ? `\u001b[1m${s}\u001b[22m` : s),
19
+ dim: (s) => (useColor ? `\u001b[2m${s}\u001b[22m` : s),
20
+ green: (s) => (useColor ? `\u001b[32m${s}\u001b[39m` : s),
21
+ red: (s) => (useColor ? `\u001b[31m${s}\u001b[39m` : s),
22
+ yellow: (s) => (useColor ? `\u001b[33m${s}\u001b[39m` : s),
23
+ cyan: (s) => (useColor ? `\u001b[36m${s}\u001b[39m` : s),
24
+ };
25
+ /** The report's text column. Headings rule out to it; nothing else needs it. */
26
+ export const REPORT_WIDTH = 74;
27
+ const ANSI = /\u001b\[[0-9;]*m/g;
28
+ /**
29
+ * A string's width as a terminal draws it — the ANSI codes not counted.
30
+ *
31
+ * Every hand-rolled `padStart` in the CLI miscounted the moment a painted
32
+ * cell reached it, which is why nothing painted ever sat in a column. All
33
+ * padding below measures through this.
34
+ */
35
+ export function visibleWidth(s) {
36
+ return s.replace(ANSI, '').length;
37
+ }
38
+ export function padCell(s, width, align) {
39
+ const gap = Math.max(0, width - visibleWidth(s));
40
+ return align === 'right' ? ' '.repeat(gap) + s : s + ' '.repeat(gap);
41
+ }
42
+ /**
43
+ * The one table renderer, for the eleven layouts that each rebuilt it.
44
+ *
45
+ * Widths come from the content, headers print dimmed, and cells may arrive
46
+ * painted — the measurement ignores the paint. Returns lines; the caller
47
+ * owns the `console.log` and the indent, because some tables live inside a
48
+ * bullet and some at the margin.
49
+ */
50
+ export function table(columns, rows, indent = ' ') {
51
+ const widths = columns.map((col, i) => Math.max(visibleWidth(col.header), ...rows.map((row) => visibleWidth(row[i] ?? ''))));
52
+ const lines = [];
53
+ if (columns.some((col) => col.header !== '')) {
54
+ lines.push(indent +
55
+ columns.map((col, i) => padCell(c.dim(col.header), widths[i] ?? 0, col.align)).join(' ').trimEnd());
56
+ }
57
+ for (const row of rows) {
58
+ lines.push(indent + columns.map((col, i) => padCell(row[i] ?? '', widths[i] ?? 0, col.align)).join(' ').trimEnd());
59
+ }
60
+ return lines;
61
+ }
62
+ /**
63
+ * A share the line already states, readable from further away: `███░░░░░░░`.
64
+ *
65
+ * The bar is content, not paint — it prints in a pipe too, so the stripped
66
+ * and plain outputs stay byte-identical. It never carries information the
67
+ * text does not: the percentage beside it is the number, the bar is the
68
+ * glance. Clamped, because a share over 1 is the caller's bug and a bar
69
+ * wider than asked would make it the layout's.
70
+ */
71
+ export function bar(share, width = 10) {
72
+ const clamped = Math.max(0, Math.min(1, share));
73
+ const filled = Math.round(clamped * width);
74
+ return c.cyan('█'.repeat(filled)) + c.dim('░'.repeat(width - filled));
75
+ }
76
+ /**
77
+ * A section heading an eye can stop on: the text bold, the line completed
78
+ * with a dim rule out to the report's width.
79
+ *
80
+ * Adónde fue el dinero ─────────────────────────────────────────────
81
+ *
82
+ * The rule is content (it survives the strip); the weight is paint.
83
+ */
84
+ export function sectionHeading(text, width = REPORT_WIDTH) {
85
+ const room = Math.max(0, width - visibleWidth(text) - 1);
86
+ return `${c.bold(text)} ${c.dim('─'.repeat(room))}`.trimEnd();
87
+ }
88
+ //# sourceMappingURL=style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.js","sourceRoot":"","sources":["../src/style.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,GAAG,CAAC;AAC/C,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC;AAExG,MAAM,CAAC,MAAM,CAAC,GAAG;IACf,IAAI,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,GAAG,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,KAAK,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IACjE,GAAG,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,MAAM,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAA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MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,KAAK,GAAG,YAAY;IAC/D,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACzD,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC;AAChE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trazum/cli",
3
- "version": "1.73.1",
3
+ "version": "1.75.0",
4
4
  "description": "Trazum CLI: find where your LLM bill goes, price every finding per month, and enforce token budgets in CI.",
5
5
  "license": "MIT",
6
6
  "author": "David Mu\u00f1oz Rey",
@@ -37,7 +37,7 @@
37
37
  "prepublishOnly": "npm run build && npm test"
38
38
  },
39
39
  "dependencies": {
40
- "@trazum/core": "1.73.1"
40
+ "@trazum/core": "1.75.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "^26.2.0",
package/src/i18n/en.ts CHANGED
@@ -61,6 +61,8 @@ ${bold('USAGE')}
61
61
  trazum position <usage.jsonl>
62
62
  trazum from-claude-code <file|dir> [--label <name>] [-o <file>]
63
63
  trazum from-otel <file|dir> [--label-from-service] [-o <file>]
64
+ trazum switch <usage.jsonl> --to <model> [--migration-usd <n>] [--cases <n>]
65
+ trazum ownrate --gpu-usd-hour <n> --tokens-per-second <n> [--utilization <0-1>]
64
66
  trazum pulse [--max-stale-hours <n>]
65
67
  trazum bench [--workload <id>] [--record <file>] [--against <file> --max-ratio <n>] [--json]
66
68
  trazum write [--answers <file>] [--json] [-o <file>]
@@ -138,6 +140,33 @@ ${bold('OPTIONS FOR write')}
138
140
  --calls <n> Calls per month, for the estimate.
139
141
  --avg-output <n> Average output tokens per call, for the estimate.
140
142
 
143
+ ${bold('OPTIONS FOR switch')}
144
+ --to <model> The candidate model, by catalogue id.
145
+ --migration-usd <n> What the migration itself would cost, declared
146
+ by you. Unlocks the break-even line.
147
+ --cases <n> How many evaluation cases you would run.
148
+ Unlocks the line pricing that evaluation.
149
+
150
+ The decision every what-if serves, priced: what this measured mix costs on
151
+ the candidate, the saving with its sign stated, and — with a declared
152
+ migration cost — the break-even as division on the measured past, days of
153
+ window attached, never a forecast. The evaluation the switch requires is
154
+ priced at this log's own mean call, two calls on the incumbent and one on
155
+ the candidate per case. What it refuses: any sentence about quality — that
156
+ verdict belongs to trazum route, and the report ends by printing it.
157
+
158
+ ${bold('OPTIONS FOR ownrate')}
159
+ --gpu-usd-hour <n> What an hour of your hardware costs you.
160
+ --tokens-per-second <n> Throughput you measured on your own serving.
161
+ --utilization <0-1> Fraction of the hour actually serving.
162
+ Defaults to 1.
163
+
164
+ Your self-hosted model's $/MTok, derived from your own two numbers —
165
+ division, nothing else: no amortisation, no energy model, no guessed
166
+ efficiency. Prints the figure and the pricing-overlay snippet to paste
167
+ into trazum.config.json, so the model you run yourself becomes a
168
+ first-class row in every report, priced by you and marked as such.
169
+
141
170
  ${bold('OPTIONS FOR from-otel')}
142
171
  --label-from-service Label each record with its span's service name,
143
172
  so a per-service bill falls out.
@@ -1625,6 +1654,47 @@ ${bold('EXAMPLES')}
1625
1654
  },
1626
1655
  },
1627
1656
 
1657
+ switchCmd: {
1658
+ noLog: () => 'Name a usage log: trazum switch <usage.jsonl> --to <model>',
1659
+ noTarget: () => 'Name the candidate: --to <model>. trazum models lists the catalogue.',
1660
+ unknownModel: (id) =>
1661
+ `The catalogue has no price for "${id}", and a comparison against a price nobody has is worse than none. trazum models lists what it knows; a pricing overlay adds what it does not.`,
1662
+ heading: (target) => `Switching this traffic to ${target}, measured`,
1663
+ saves: (current, target, saving) =>
1664
+ `${current} on this log becomes ${target} on the candidate — ${saving} less, on the same tokens.`,
1665
+ costs: (current, target, extra) =>
1666
+ `${current} on this log becomes ${target} on the candidate — ${extra} MORE. This switch loses money before quality is even asked.`,
1667
+ nothingMovable: () => 'Nothing here can move: every slice is already on the candidate or exceeds its context window.',
1668
+ movable: (calls, slices) => `${calls} call(s) across ${slices} slice(s) could move.`,
1669
+ overContext: (slices, usd) =>
1670
+ `${slices} slice(s) worth ${usd} cannot move — at least one call exceeds the candidate's context window. Their money is in none of the figures above.`,
1671
+ alreadyOnTarget: (calls, usd) => `${calls} call(s) worth ${usd} are already on the candidate.`,
1672
+ window: (days) => `Measured over ${days} day(s) of this log — every figure above is arithmetic on that window.`,
1673
+ noWindow: () => 'No record carries a timestamp, so this log has no measured rate.',
1674
+ breakEvenDays: (migration, days, measuredDays) =>
1675
+ `A declared migration cost of ${migration} is recovered after ~${days} day(s) at the saving measured over ${measuredDays} day(s). Division on the past — what next month does is next month's business.`,
1676
+ breakEvenNoSaving: (migration) =>
1677
+ `Break-even refused: the switch saves nothing, so the declared ${migration} has nothing to recover.`,
1678
+ breakEvenNoClock: (migration) =>
1679
+ `Break-even refused for ${migration}: no record carries a timestamp, so there is no measured rate to divide by.`,
1680
+ evalCost: (cases, total) =>
1681
+ `Knowing whether the candidate is good enough costs money too: ${cases} case(s) through trazum route is ~${total} at this log's own mean call (two calls on the incumbent, one on the candidate, per case).`,
1682
+ evalCostHint: () => 'Pass --cases <n> to price the evaluation the switch requires.',
1683
+ quality: (routeCommand) =>
1684
+ `Nothing above says whether the candidate can do the work. That is an evaluation, not arithmetic: ${routeCommand}`,
1685
+ },
1686
+
1687
+ ownrate: {
1688
+ missing: () =>
1689
+ 'Both numbers are yours to declare: trazum ownrate --gpu-usd-hour <n> --tokens-per-second <n> [--utilization <0-1>]',
1690
+ invalid: (flag) => `--${flag} must be a positive number (utilization: greater than 0, at most 1).`,
1691
+ result: (usdPerMTok, tokensPerSecond, gpuUsdPerHour, utilizationPct) =>
1692
+ `${usdPerMTok} per million tokens — ${gpuUsdPerHour}/hour over ${tokensPerSecond} tokens/second at ${utilizationPct}% serving.`,
1693
+ declared: () =>
1694
+ 'Derived from your declaration, honest only if the throughput was measured. Every report that prices this model will rest on these two numbers.',
1695
+ snippetHeading: () => 'Paste into trazum.config.json (the "pricing" overlay file):',
1696
+ },
1697
+
1628
1698
  fromOtel: {
1629
1699
  noPath: () => 'from-otel needs an OTLP file or directory: trazum from-otel spans.json',
1630
1700
  notFound: (path) => `${path}: not found`,
package/src/i18n/es.ts CHANGED
@@ -48,6 +48,8 @@ ${bold('USO')}
48
48
  trazum position <uso.jsonl>
49
49
  trazum from-claude-code <fichero|dir> [--label <nombre>] [-o <fichero>]
50
50
  trazum from-otel <fichero|dir> [--label-from-service] [-o <fichero>]
51
+ trazum switch <uso.jsonl> --to <modelo> [--migration-usd <n>] [--cases <n>]
52
+ trazum ownrate --gpu-usd-hour <n> --tokens-per-second <n> [--utilization <0-1>]
51
53
  trazum pulse [--max-stale-hours <n>]
52
54
  trazum bench [--workload <id>] [--record <fichero>] [--against <fichero> --max-ratio <n>] [--json]
53
55
  trazum write [--answers <fichero>] [--json] [-o <fichero>]
@@ -140,6 +142,34 @@ ${bold('OPCIONES DE position')}
140
142
  siete días, con un techo superado o con tasa cero: nunca un pronóstico, y
141
143
  ningún campo del documento nombra una fecha.
142
144
 
145
+ ${bold('OPCIONES DE switch')}
146
+ --to <modelo> El modelo candidato, por id del catálogo.
147
+ --migration-usd <n> Lo que costaría la migración en sí, declarado
148
+ por ti. Desbloquea la línea de break-even.
149
+ --cases <n> Cuántos casos de evaluación correrías.
150
+ Desbloquea la línea que tasa esa evaluación.
151
+
152
+ La decisión a la que sirve cada what-if, tasada: qué cuesta este mix medido
153
+ en el candidato, el ahorro con su signo dicho, y — con un coste de
154
+ migración declarado — el break-even como división sobre el pasado medido,
155
+ con los días de ventana adjuntos, nunca un pronóstico. La evaluación que el
156
+ cambio exige se tasa a la llamada media de este log: dos llamadas al
157
+ titular y una al candidato por caso. Lo que se niega a decir: nada sobre
158
+ calidad — ese veredicto es de trazum route, y el informe termina
159
+ imprimiéndolo.
160
+
161
+ ${bold('OPCIONES DE ownrate')}
162
+ --gpu-usd-hour <n> Lo que te cuesta una hora de tu hardware.
163
+ --tokens-per-second <n> Rendimiento que mediste en tu propio serving.
164
+ --utilization <0-1> Fracción de la hora realmente sirviendo.
165
+ Por defecto 1.
166
+
167
+ El $/MTok de tu modelo self-hosted, derivado de tus dos números — división
168
+ y nada más: sin amortización, sin modelo de energía, sin eficiencia
169
+ supuesta. Imprime la cifra y el snippet de overlay de precios para pegar
170
+ en trazum.config.json, de modo que el modelo que tú mismo sirves sea una
171
+ fila de primera en cada informe, tasado por ti y marcado como tal.
172
+
143
173
  ${bold('OPCIONES DE from-otel')}
144
174
  --label-from-service Etiqueta cada registro con el nombre de servicio
145
175
  de su span, para que salga una factura por
@@ -1642,6 +1672,47 @@ ${bold('EJEMPLOS')}
1642
1672
  },
1643
1673
  },
1644
1674
 
1675
+ switchCmd: {
1676
+ noLog: () => 'Nombra un log de uso: trazum switch <uso.jsonl> --to <modelo>',
1677
+ noTarget: () => 'Nombra el candidato: --to <modelo>. trazum models lista el catálogo.',
1678
+ unknownModel: (id) =>
1679
+ `El catálogo no tiene precio para «${id}», y una comparación contra un precio que nadie tiene es peor que ninguna. trazum models lista lo que conoce; un overlay de precios añade lo que no.`,
1680
+ heading: (target) => `Cambiar este tráfico a ${target}, medido`,
1681
+ saves: (current, target, saving) =>
1682
+ `${current} en este log se vuelven ${target} en el candidato — ${saving} menos, sobre los mismos tokens.`,
1683
+ costs: (current, target, extra) =>
1684
+ `${current} en este log se vuelven ${target} en el candidato — ${extra} MÁS. Este cambio pierde dinero antes siquiera de preguntar por la calidad.`,
1685
+ nothingMovable: () => 'Aquí no puede moverse nada: cada porción ya está en el candidato o excede su ventana de contexto.',
1686
+ movable: (calls, slices) => `${calls} llamada(s) en ${slices} porción(es) podrían moverse.`,
1687
+ overContext: (slices, usd) =>
1688
+ `${slices} porción(es) por valor de ${usd} no pueden moverse — al menos una llamada excede la ventana de contexto del candidato. Su dinero no está en ninguna cifra de arriba.`,
1689
+ alreadyOnTarget: (calls, usd) => `${calls} llamada(s) por valor de ${usd} ya están en el candidato.`,
1690
+ window: (days) => `Medido sobre ${days} día(s) de este log — cada cifra de arriba es aritmética sobre esa ventana.`,
1691
+ noWindow: () => 'Ningún registro lleva marca de tiempo, así que este log no tiene tasa medida.',
1692
+ breakEvenDays: (migration, days, measuredDays) =>
1693
+ `Un coste de migración declarado de ${migration} se recupera tras ~${days} día(s) al ahorro medido sobre ${measuredDays} día(s). División sobre el pasado — lo que haga el mes que viene es asunto del mes que viene.`,
1694
+ breakEvenNoSaving: (migration) =>
1695
+ `Break-even rechazado: el cambio no ahorra nada, así que los ${migration} declarados no tienen nada que recuperar.`,
1696
+ breakEvenNoClock: (migration) =>
1697
+ `Break-even rechazado para ${migration}: ningún registro lleva marca de tiempo, así que no hay tasa medida por la que dividir.`,
1698
+ evalCost: (cases, total) =>
1699
+ `Saber si el candidato vale también cuesta dinero: ${cases} caso(s) por trazum route son ~${total} a la llamada media de este log (dos llamadas al titular y una al candidato por caso).`,
1700
+ evalCostHint: () => 'Pasa --cases <n> para tasar la evaluación que el cambio exige.',
1701
+ quality: (routeCommand) =>
1702
+ `Nada de lo de arriba dice si el candidato puede hacer el trabajo. Eso es una evaluación, no aritmética: ${routeCommand}`,
1703
+ },
1704
+
1705
+ ownrate: {
1706
+ missing: () =>
1707
+ 'Los dos números los declaras tú: trazum ownrate --gpu-usd-hour <n> --tokens-per-second <n> [--utilization <0-1>]',
1708
+ invalid: (flag) => `--${flag} debe ser un número positivo (utilization: mayor que 0, como mucho 1).`,
1709
+ result: (usdPerMTok, tokensPerSecond, gpuUsdPerHour, utilizationPct) =>
1710
+ `${usdPerMTok} por millón de tokens — ${gpuUsdPerHour}/hora entre ${tokensPerSecond} tokens/segundo al ${utilizationPct}% de servicio.`,
1711
+ declared: () =>
1712
+ 'Derivado de tu declaración, honesto solo si el rendimiento se midió. Cada informe que tase este modelo descansará sobre estos dos números.',
1713
+ snippetHeading: () => 'Pega en trazum.config.json (el fichero de overlay «pricing»):',
1714
+ },
1715
+
1645
1716
  fromOtel: {
1646
1717
  noPath: () => 'from-otel necesita un archivo o directorio OTLP: trazum from-otel spans.json',
1647
1718
  notFound: (path) => `${path}: no existe`,
package/src/i18n/types.ts CHANGED
@@ -528,6 +528,41 @@ export interface CliMessages {
528
528
  * is the command's honesty: LLM spans converted, non-LLM spans skipped, and
529
529
  * how many carried no cache data (OTel has no TTL split to give).
530
530
  */
531
+ /**
532
+ * The 1.74 switching decision. Named `switchCmd` because the command is
533
+ * `switch`, which is a reserved word too load-bearing to fight in every
534
+ * file that touches this section.
535
+ */
536
+ switchCmd: {
537
+ noLog(): string;
538
+ noTarget(): string;
539
+ unknownModel(id: string): string;
540
+ heading(target: string): string;
541
+ saves(current: string, target: string, saving: string): string;
542
+ costs(current: string, target: string, extra: string): string;
543
+ nothingMovable(): string;
544
+ movable(calls: number, slices: number): string;
545
+ overContext(slices: number, usd: string): string;
546
+ alreadyOnTarget(calls: number, usd: string): string;
547
+ window(days: number): string;
548
+ noWindow(): string;
549
+ breakEvenDays(migration: string, days: number, measuredDays: number): string;
550
+ breakEvenNoSaving(migration: string): string;
551
+ breakEvenNoClock(migration: string): string;
552
+ evalCost(cases: number, total: string): string;
553
+ evalCostHint(): string;
554
+ /** The refusal every rendering ends on: quality is route's verdict. */
555
+ quality(routeCommand: string): string;
556
+ };
557
+
558
+ ownrate: {
559
+ missing(): string;
560
+ invalid(flag: string): string;
561
+ result(usdPerMTok: string, tokensPerSecond: number, gpuUsdPerHour: string, utilizationPct: number): string;
562
+ declared(): string;
563
+ snippetHeading(): string;
564
+ };
565
+
531
566
  fromOtel: {
532
567
  noPath(): string;
533
568
  notFound(path: string): string;