@trazum/cli 2.5.1 → 2.5.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.
- package/README.md +75 -6
- package/dist/filter.d.ts +2 -0
- package/dist/filter.d.ts.map +1 -0
- package/dist/filter.js +151 -0
- package/dist/filter.js.map +1 -0
- package/dist/gateway-server.d.ts +2 -0
- package/dist/gateway-server.d.ts.map +1 -1
- package/dist/gateway-server.js +49 -9
- package/dist/gateway-server.js.map +1 -1
- package/dist/gateway-spend.d.ts +32 -0
- package/dist/gateway-spend.d.ts.map +1 -0
- package/dist/gateway-spend.js +116 -0
- package/dist/gateway-spend.js.map +1 -0
- package/dist/html.d.ts.map +1 -1
- package/dist/html.js +22 -1
- package/dist/html.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +29 -3
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +29 -3
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/types.d.ts +13 -1
- package/dist/i18n/types.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +118 -61
- package/dist/index.js.map +1 -1
- package/dist/markdown.d.ts.map +1 -1
- package/dist/markdown.js +19 -1
- package/dist/markdown.js.map +1 -1
- package/dist/pdf.d.ts.map +1 -1
- package/dist/pdf.js +38 -1
- package/dist/pdf.js.map +1 -1
- package/dist/serve-savings-schema.d.ts +65 -0
- package/dist/serve-savings-schema.d.ts.map +1 -0
- package/dist/serve-savings-schema.js +54 -0
- package/dist/serve-savings-schema.js.map +1 -0
- package/dist/serve-savings.d.ts +55 -0
- package/dist/serve-savings.d.ts.map +1 -0
- package/dist/serve-savings.js +144 -0
- package/dist/serve-savings.js.map +1 -0
- package/dist/serve-schema.d.ts +536 -0
- package/dist/serve-schema.d.ts.map +1 -0
- package/dist/serve-schema.js +143 -0
- package/dist/serve-schema.js.map +1 -0
- package/dist/serve.d.ts.map +1 -1
- package/dist/serve.js +30 -5
- package/dist/serve.js.map +1 -1
- package/package.json +2 -2
- package/src/filter.ts +114 -0
- package/src/gateway-server.ts +46 -10
- package/src/gateway-spend.ts +120 -0
- package/src/html.ts +25 -1
- package/src/i18n/en.ts +31 -4
- package/src/i18n/es.ts +31 -4
- package/src/i18n/types.ts +14 -1
- package/src/index.ts +108 -63
- package/src/markdown.ts +20 -1
- package/src/pdf.ts +36 -1
- package/src/serve-savings-schema.ts +53 -0
- package/src/serve-savings.ts +140 -0
- package/src/serve-schema.ts +147 -0
- package/src/serve.ts +31 -5
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { indexUsage, parseUsageLine, usageFromResponse } from '@trazum/core';
|
|
2
|
+
import type { GatewayCall, GatewayDecision, GatewayStanding, MeasuredPosition, PricingCatalogue } from '@trazum/core';
|
|
3
|
+
|
|
4
|
+
type GatewayUsage = NonNullable<ReturnType<typeof usageFromResponse>>;
|
|
5
|
+
|
|
6
|
+
type Admitted = Exclude<GatewayDecision, { kind: 'refuse' }>;
|
|
7
|
+
const DAY_MS = 86_400_000;
|
|
8
|
+
const empty = (): MeasuredPosition => ({ dayUsd: null, sessionUsd: null, labelUsd: null });
|
|
9
|
+
|
|
10
|
+
/** Process-local additions to a startup snapshot. Reservations are never measured spend. */
|
|
11
|
+
export class GatewaySpend {
|
|
12
|
+
private usd = 0;
|
|
13
|
+
private unknown = false;
|
|
14
|
+
private days = new Map<number, number>();
|
|
15
|
+
private labels = new Map<string, number>();
|
|
16
|
+
private sessions = new Map<string, number>();
|
|
17
|
+
private pending = new Map<symbol, { call: GatewayCall; usd: number | null }>();
|
|
18
|
+
private started = Date.now();
|
|
19
|
+
|
|
20
|
+
constructor(private catalogue: PricingCatalogue) {}
|
|
21
|
+
|
|
22
|
+
standing(base: GatewayStanding | null): GatewayStanding | null {
|
|
23
|
+
// A new month's imported balance is unknown until the operator reloads it.
|
|
24
|
+
const start = new Date(this.started);
|
|
25
|
+
const now = new Date();
|
|
26
|
+
if (this.unknown || start.getUTCMonth() !== now.getUTCMonth() || start.getUTCFullYear() !== now.getUTCFullYear()) return null;
|
|
27
|
+
return base === null ? null : { ...base, consumedUsd: base.consumedUsd + this.usd };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
position(base: MeasuredPosition, call: GatewayCall): MeasuredPosition {
|
|
31
|
+
if (this.unknown) return empty();
|
|
32
|
+
const day = Math.floor(Date.now() / DAY_MS) * DAY_MS;
|
|
33
|
+
const add = (base: number | null, delta: number): number | null => base === null ? null : base + delta;
|
|
34
|
+
// Do not carry yesterday's spend into today's daily allowance.
|
|
35
|
+
const dayBase = base.dayWindow && base.dayWindow.toMs <= day ? 0 : base.dayUsd;
|
|
36
|
+
return {
|
|
37
|
+
...base,
|
|
38
|
+
dayUsd: add(dayBase, this.days.get(day) ?? 0),
|
|
39
|
+
dayWindow: dayBase === null ? null : { fromMs: day, toMs: day + DAY_MS },
|
|
40
|
+
labelUsd: add(base.labelUsd, call.label === null ? 0 : this.labels.get(call.label) ?? 0),
|
|
41
|
+
sessionUsd: add(base.sessionUsd, call.session === null ? 0 : this.sessions.get(call.session) ?? 0),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Synchronous check + reservation: no await can admit two calls against the same remainder. */
|
|
46
|
+
reserve(call: GatewayCall, decision: Admitted, standing: GatewayStanding | null, failClosed: boolean):
|
|
47
|
+
{ ticket: symbol; refusal?: never } | { ticket?: never; refusal: Record<string, unknown> } {
|
|
48
|
+
const pending = [...this.pending.values()];
|
|
49
|
+
const unknown = pending.some((entry) => entry.usd === null);
|
|
50
|
+
const estimate = decision.estimatedUsd;
|
|
51
|
+
const unbounded = estimate === null || !Number.isFinite(estimate) || estimate < 0 ||
|
|
52
|
+
call.maxOutputTokens === null || !Number.isFinite(call.maxOutputTokens) || call.maxOutputTokens < 0;
|
|
53
|
+
const sum = (matches: (entry: typeof pending[number]) => boolean): number =>
|
|
54
|
+
pending.filter(matches).reduce((total, entry) => total + (entry.usd ?? 0), 0);
|
|
55
|
+
const reservedUsd = sum(() => true);
|
|
56
|
+
// Configured substitution explicitly permits continued spending past the monthly cap.
|
|
57
|
+
const globalOver = decision.kind !== 'substitute' && standing !== null && estimate !== null &&
|
|
58
|
+
standing.consumedUsd + reservedUsd + estimate > standing.limitUsd;
|
|
59
|
+
const scopeOver = decision.policy.judgements.some((entry) => {
|
|
60
|
+
if (entry.waived !== null || entry.measuredUsd === null || estimate === null) return false;
|
|
61
|
+
const reserved = sum((pending) => entry.scope === 'day' ||
|
|
62
|
+
(entry.scope === 'label' ? pending.call.label === call.label : pending.call.session === call.session));
|
|
63
|
+
return entry.measuredUsd + reserved + estimate > entry.limitUsd;
|
|
64
|
+
});
|
|
65
|
+
if (((unknown || unbounded) && failClosed) || globalOver || scopeOver) {
|
|
66
|
+
return { refusal: {
|
|
67
|
+
schemaVersion: 1,
|
|
68
|
+
error: { type: 'trazum_budget_refusal', message: unbounded
|
|
69
|
+
? 'This call has no bounded cost; provide a valid output-token limit before spending.'
|
|
70
|
+
: unknown
|
|
71
|
+
? 'An in-flight call has no bounded cost; wait for its usage before spending again.'
|
|
72
|
+
: 'In-flight calls have reserved the remaining budget.' },
|
|
73
|
+
reason: unbounded ? 'call-unbounded' : unknown ? 'in-flight-unmeasured' : 'budget-reserved',
|
|
74
|
+
standing, reservedUsd, estimatedUsd: estimate, policy: decision.policy,
|
|
75
|
+
} };
|
|
76
|
+
}
|
|
77
|
+
const ticket = Symbol();
|
|
78
|
+
this.pending.set(ticket, { call, usd: unbounded ? null : estimate });
|
|
79
|
+
return { ticket };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
settle(ticket: symbol, model: string, usage: GatewayUsage | null): void {
|
|
83
|
+
const pending = this.pending.get(ticket);
|
|
84
|
+
if (pending === undefined) return;
|
|
85
|
+
this.pending.delete(ticket);
|
|
86
|
+
const writesKnown = usage !== null && (usage.cacheWriteTokens === 0 ||
|
|
87
|
+
(usage.cacheWrite5mTokens !== undefined && usage.cacheWrite1hTokens !== undefined &&
|
|
88
|
+
usage.cacheWrite5mTokens + usage.cacheWrite1hTokens === usage.cacheWriteTokens));
|
|
89
|
+
if (usage === null || !writesKnown ||
|
|
90
|
+
Object.values(usage).some((value) => !Number.isFinite(value) || value < 0)) {
|
|
91
|
+
// A flat write count has no TTL. Assuming 5m undercharges a 1h write.
|
|
92
|
+
this.unknown = true;
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const now = Date.now();
|
|
96
|
+
const record = parseUsageLine(JSON.stringify({
|
|
97
|
+
model, ts: new Date(now).toISOString(),
|
|
98
|
+
input_tokens: usage.inputTokens, output_tokens: usage.outputTokens,
|
|
99
|
+
cache_read_input_tokens: usage.cacheReadTokens,
|
|
100
|
+
cache_creation_input_tokens: usage.cacheWriteTokens,
|
|
101
|
+
cache_creation: {
|
|
102
|
+
ephemeral_5m_input_tokens: usage.cacheWrite5mTokens ?? 0,
|
|
103
|
+
ephemeral_1h_input_tokens: usage.cacheWrite1hTokens ?? 0,
|
|
104
|
+
},
|
|
105
|
+
}));
|
|
106
|
+
const index = record === null ? null : indexUsage([record], { catalogue: this.catalogue, on: new Date(now) });
|
|
107
|
+
if (index === null || index.unpriced > 0 || index.dayUsd === null) {
|
|
108
|
+
this.unknown = true;
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const usd = index.dayUsd;
|
|
112
|
+
this.usd += usd;
|
|
113
|
+
const day = Math.floor(now / DAY_MS) * DAY_MS;
|
|
114
|
+
this.days.set(day, (this.days.get(day) ?? 0) + usd);
|
|
115
|
+
if (pending.call.label !== null) this.labels.set(pending.call.label, (this.labels.get(pending.call.label) ?? 0) + usd);
|
|
116
|
+
if (pending.call.session !== null) this.sessions.set(pending.call.session, (this.sessions.get(pending.call.session) ?? 0) + usd);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
release(ticket: symbol): void { this.pending.delete(ticket); }
|
|
120
|
+
}
|
package/src/html.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UNLABELLED, formatUsd, sharesOf } from '@trazum/core';
|
|
1
|
+
import { UNLABELLED, formatUsd, sharesOf, spendByMonth } from '@trazum/core';
|
|
2
2
|
import type { PositionDocument, RollupDocument, UsageBreakdown } from '@trazum/core';
|
|
3
3
|
import type { CliMessages } from './i18n/index.js';
|
|
4
4
|
import { tierCeilingCaveat } from './markdown.js';
|
|
@@ -187,6 +187,30 @@ export function renderProfileHtml(input: ProfileMarkdownInput): string {
|
|
|
187
187
|
),
|
|
188
188
|
);
|
|
189
189
|
|
|
190
|
+
/*
|
|
191
|
+
* By month, once the report spans two: a document handed to whoever pays
|
|
192
|
+
* for a year of use answers which month cost what. Every month, oldest
|
|
193
|
+
* first, since a page has room the terminal's twelve rows do not; and the
|
|
194
|
+
* part with no clock said under it, so the rows do not add up short of the
|
|
195
|
+
* total in silence.
|
|
196
|
+
*/
|
|
197
|
+
const { months, undated } = spendByMonth(report);
|
|
198
|
+
if (months.length >= 2) {
|
|
199
|
+
parts.push(`<h2>${esc(t.html.byMonthHeading())}</h2>`);
|
|
200
|
+
const body = months
|
|
201
|
+
.map(({ month, calls, usd }) => {
|
|
202
|
+
const share = report.total.totalUsd > 0 ? pct(usd / report.total.totalUsd) : '—';
|
|
203
|
+
return `<tr><td>${esc(month)}</td><td class="n">${n(calls)}</td><td class="n">${esc(formatUsd(usd))}</td><td class="n">${share}</td></tr>`;
|
|
204
|
+
})
|
|
205
|
+
.join('\n');
|
|
206
|
+
parts.push(
|
|
207
|
+
`<table><thead><tr><th>${esc(t.bill.colMonth())}</th><th class="n">${esc(t.html.colCalls())}</th><th class="n">USD</th><th class="n">%</th></tr></thead><tbody>\n${body}\n</tbody></table>`,
|
|
208
|
+
);
|
|
209
|
+
if (undated.calls > 0) {
|
|
210
|
+
parts.push(`<p class="muted">${esc(t.bill.monthsUndated(undated.calls, formatUsd(undated.usd)))}</p>`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
190
214
|
// The findings, as the sentences the terminal already says — the copy is
|
|
191
215
|
// the product's, not this file's, so the two surfaces cannot drift apart.
|
|
192
216
|
const findings: string[] = [];
|
package/src/i18n/en.ts
CHANGED
|
@@ -63,6 +63,7 @@ ${bold('USAGE')}
|
|
|
63
63
|
trazum bill [<file|dir>...] [--label <name>] [--no-label-from-project] [--receipt|--table] [--stamp] [-o <file>]
|
|
64
64
|
[--since <when>] [--until <when>] [--pdf-out|--html-out|--markdown-out|--csv-out <file>]
|
|
65
65
|
trazum from-claude-code <file|dir> [--label <name>] [-o <file>]
|
|
66
|
+
trazum from-codex <file|dir> [--label <name>] [-o <file>]
|
|
66
67
|
trazum from-otel <file|dir> [--label-from-service] [-o <file>]
|
|
67
68
|
trazum from-litellm <file|dir> [-o <file>]
|
|
68
69
|
trazum from-anthropic <usage.json> [--label <name>] [--label-by-workspace <file>] [-o <file>]
|
|
@@ -87,6 +88,7 @@ ${bold('USAGE')}
|
|
|
87
88
|
trazum owners <log>
|
|
88
89
|
trazum ladder <log>
|
|
89
90
|
trazum feedback
|
|
91
|
+
trazum filter compact|restore|instructions [--recovery-dir <directory>]
|
|
90
92
|
trazum --version
|
|
91
93
|
|
|
92
94
|
${bold('OPTIONS FOR init')}
|
|
@@ -305,6 +307,15 @@ ${bold('OPTIONS FOR from-otel')}
|
|
|
305
307
|
verdicts read "cannot tell" rather than a guessed one. Non-LLM spans are
|
|
306
308
|
counted and skipped, said on stderr.
|
|
307
309
|
|
|
310
|
+
${bold('OPTIONS FOR from-codex')}
|
|
311
|
+
--label <name> Stamp every record with one label.
|
|
312
|
+
-o, --out <file> Write normalized usage instead of stdout.
|
|
313
|
+
|
|
314
|
+
Read an explicit Codex rollout file or directory, locally. Corroborated
|
|
315
|
+
counters only: replayed snapshots collapse, ambiguous usage is excluded.
|
|
316
|
+
Conversion gaps are reported on stderr. Prices are API equivalents,
|
|
317
|
+
never your subscription invoice. Prompt content is discarded.
|
|
318
|
+
|
|
308
319
|
${bold('OPTIONS FOR from-claude-code')}
|
|
309
320
|
--label <name> Stamp every record with one label.
|
|
310
321
|
--label-from-project Label each record with its transcript's project
|
|
@@ -417,6 +428,10 @@ ${bold('OPTIONS FOR rules')}
|
|
|
417
428
|
"Inert" is always said about the corpus. A rule that finds nothing in these
|
|
418
429
|
files has not been shown to find nothing anywhere.
|
|
419
430
|
|
|
431
|
+
${bold('OPTIONS FOR filter')}
|
|
432
|
+
--recovery-dir <directory> Private recovery directory; required for compact/restore.
|
|
433
|
+
Run trazum filter --help for the opt-in stdin log-filter workflow.
|
|
434
|
+
|
|
420
435
|
${bold('OPTIONS FOR feedback')}
|
|
421
436
|
(none)
|
|
422
437
|
|
|
@@ -1311,7 +1326,7 @@ ${bold('EXAMPLES')}
|
|
|
1311
1326
|
diff: () => 'Diff',
|
|
1312
1327
|
tokensOnlyHeading: (host) => `What this buys on ${host}`,
|
|
1313
1328
|
tokensOnlyWhy: (host) =>
|
|
1314
|
-
`${host}
|
|
1329
|
+
`${host} identifies the tool, not your payment mode. Tokens are shown by default; invoice savings are unknown.`,
|
|
1315
1330
|
tokensOnlyAsked: () => 'Costs hidden because you asked for tokens only.',
|
|
1316
1331
|
// `tokens` arrives already formatted for the locale, so the singular is
|
|
1317
1332
|
// decided on the string rather than on a number that is no longer here.
|
|
@@ -1892,6 +1907,17 @@ ${bold('EXAMPLES')}
|
|
|
1892
1907
|
nothingToBill: () => 'Nothing in this log could be priced, so the receipt has no lines.',
|
|
1893
1908
|
},
|
|
1894
1909
|
|
|
1910
|
+
fromCodex: {
|
|
1911
|
+
noPath: () => 'from-codex needs an explicit rollout file or directory: trazum from-codex ./sessions',
|
|
1912
|
+
notFound: (path) => `Cannot read ${path}`,
|
|
1913
|
+
noFiles: (path) => `No JSONL rollout files in ${path}`,
|
|
1914
|
+
noUsage: () => 'No attributable Codex usage. Inspect the named gaps; no zero-cost log was written.',
|
|
1915
|
+
summary: (files, records, duplicates) => `${files} Codex file(s), ${records} corroborated usage record(s), ${duplicates} repeated snapshot(s) collapsed.`,
|
|
1916
|
+
gaps: (missingModel, unsupported, unparseable) => `Codex gaps: ${missingModel} without model context, ${unsupported} unsupported or uncorroborated snapshots, ${unparseable} unreadable lines. These are not zero-cost calls.`,
|
|
1917
|
+
caveat: () => 'Codex telemetry is priced at catalogue API rates, not your subscription invoice. Restored totals, counter resets and ambiguous deltas are excluded, not guessed.',
|
|
1918
|
+
written: (file) => `Wrote normalized usage to ${file}`,
|
|
1919
|
+
},
|
|
1920
|
+
|
|
1895
1921
|
fromOtel: {
|
|
1896
1922
|
noPath: () => 'from-otel needs an OTLP file or directory: trazum from-otel spans.json',
|
|
1897
1923
|
notFound: (path) => `${path}: not found`,
|
|
@@ -2056,7 +2082,7 @@ ${bold('EXAMPLES')}
|
|
|
2056
2082
|
pricingLiveHint: (count) =>
|
|
2057
2083
|
`${count} unpriced model id(s) carry a provider prefix, the way OpenRouter and LiteLLM name models, and the bundled catalogue does not carry those. Run again with --pricing-live to price OpenRouter's slugs from its own list.`,
|
|
2058
2084
|
apiEquivalent: () =>
|
|
2059
|
-
'Claude Code transcripts are priced at
|
|
2085
|
+
'Claude Code and Codex transcripts are priced at catalogue API rates. On a subscription you paid the plan, not this API-equivalent estimate; missing telemetry and custom rates can change the result.',
|
|
2060
2086
|
prefixedKnown: (ids) =>
|
|
2061
2087
|
`${ids}: the model after the slash is priced here under its own name. The prefix is not stripped for you, because the same model through a router can bill differently. If those calls went straight to the provider, log the model without the prefix.`,
|
|
2062
2088
|
windowMatchesNothing: (from, to) =>
|
|
@@ -2249,6 +2275,7 @@ ${bold('EXAMPLES')}
|
|
|
2249
2275
|
noSessions: () => 'No record carried a session, so conversation growth and per-conversation costs are not in this report.',
|
|
2250
2276
|
byLabelHeading: () => 'By workload',
|
|
2251
2277
|
byModelHeading: () => 'By model',
|
|
2278
|
+
byMonthHeading: () => 'By month',
|
|
2252
2279
|
findingsHeading: () => 'What would move this bill',
|
|
2253
2280
|
colLabel: () => 'workload',
|
|
2254
2281
|
colModel: () => 'model',
|
|
@@ -2308,8 +2335,8 @@ ${bold('EXAMPLES')}
|
|
|
2308
2335
|
|
|
2309
2336
|
where: {
|
|
2310
2337
|
hostHeading: () => 'Running inside',
|
|
2311
|
-
|
|
2312
|
-
`${host}
|
|
2338
|
+
billingUnknown: (host) =>
|
|
2339
|
+
`${host} identifies the execution host only. Payment mode is unknown; token prices do not establish invoice savings.`,
|
|
2313
2340
|
noTarget: () => 'Pass a source file to see which provider its prompts are sent to.',
|
|
2314
2341
|
sourceHeading: (path) => `Prompts in ${path} go to`,
|
|
2315
2342
|
conflict: () => 'Cannot tell: the file names more than one provider.',
|
package/src/i18n/es.ts
CHANGED
|
@@ -50,6 +50,7 @@ ${bold('USO')}
|
|
|
50
50
|
trazum bill [<fichero|dir>...] [--label <nombre>] [--no-label-from-project] [--receipt|--table] [--stamp] [-o <fichero>]
|
|
51
51
|
[--since <cuándo>] [--until <cuándo>] [--pdf-out|--html-out|--markdown-out|--csv-out <fichero>]
|
|
52
52
|
trazum from-claude-code <fichero|dir> [--label <nombre>] [-o <fichero>]
|
|
53
|
+
trazum from-codex <fichero|dir> [--label <nombre>] [-o <fichero>]
|
|
53
54
|
trazum from-otel <fichero|dir> [--label-from-service] [-o <fichero>]
|
|
54
55
|
trazum from-litellm <fichero|dir> [-o <fichero>]
|
|
55
56
|
trazum from-anthropic <usage.json> [--label <name>] [--label-by-workspace <file>] [-o <file>]
|
|
@@ -74,6 +75,7 @@ ${bold('USO')}
|
|
|
74
75
|
trazum owners <log>
|
|
75
76
|
trazum ladder <log>
|
|
76
77
|
trazum feedback
|
|
78
|
+
trazum filter compact|restore|instructions [--recovery-dir <directory>]
|
|
77
79
|
trazum --version
|
|
78
80
|
|
|
79
81
|
${bold('OPCIONES DE init')}
|
|
@@ -344,6 +346,15 @@ ${bold('OPCIONES DE from-otel')}
|
|
|
344
346
|
puede saber" en vez de uno inventado. Los spans que no son de LLM se cuentan
|
|
345
347
|
y se omiten, dicho en stderr.
|
|
346
348
|
|
|
349
|
+
${bold('OPCIONES DE from-codex')}
|
|
350
|
+
--label <nombre> Marca cada registro con una etiqueta.
|
|
351
|
+
-o, --out <fichero> Escribe el uso normalizado en vez de stdout.
|
|
352
|
+
|
|
353
|
+
Lee un archivo o directorio de Codex indicado explícitamente, en local.
|
|
354
|
+
Solo contadores corroborados: colapsa duplicados y excluye uso ambiguo.
|
|
355
|
+
Los huecos se indican en stderr. Los precios son equivalentes API,
|
|
356
|
+
nunca tu factura de suscripción. El contenido de prompts se descarta.
|
|
357
|
+
|
|
347
358
|
${bold('OPCIONES DE from-claude-code')}
|
|
348
359
|
--label <nombre> Marca cada registro con una etiqueta.
|
|
349
360
|
--label-from-project Etiqueta cada registro con el nombre del
|
|
@@ -421,6 +432,10 @@ ${bold('OPCIONES DE rules')}
|
|
|
421
432
|
"Inerte" se dice siempre sobre el corpus. Una regla que no encuentra nada en
|
|
422
433
|
estos ficheros no ha demostrado no encontrar nada en ninguna parte.
|
|
423
434
|
|
|
435
|
+
${bold('OPCIONES DE filter')}
|
|
436
|
+
--recovery-dir <directorio> Directorio privado; obligatorio para compact/restore.
|
|
437
|
+
trazum filter --help explica el filtro opcional (ayuda en inglés).
|
|
438
|
+
|
|
424
439
|
${bold('OPCIONES DE feedback')}
|
|
425
440
|
(ninguna)
|
|
426
441
|
|
|
@@ -1353,7 +1368,7 @@ ${bold('EJEMPLOS')}
|
|
|
1353
1368
|
diff: () => 'Diff',
|
|
1354
1369
|
tokensOnlyHeading: (host) => `Qué ganas con esto en ${host}`,
|
|
1355
1370
|
tokensOnlyWhy: (host) =>
|
|
1356
|
-
`${host}
|
|
1371
|
+
`${host} identifica la herramienta, no tu forma de pago. Se muestran tokens por defecto; el ahorro en factura es desconocido.`,
|
|
1357
1372
|
tokensOnlyAsked: () => 'Costes ocultos porque has pedido solo tokens.',
|
|
1358
1373
|
tokensSaved: (tokens) =>
|
|
1359
1374
|
`${tokens} token${tokens === '1' ? '' : 's'} de vuelta, en cada llamada.`,
|
|
@@ -1921,6 +1936,17 @@ ${bold('EJEMPLOS')}
|
|
|
1921
1936
|
nothingToBill: () => 'Nada de este log se pudo precificar, así que el recibo no tiene líneas.',
|
|
1922
1937
|
},
|
|
1923
1938
|
|
|
1939
|
+
fromCodex: {
|
|
1940
|
+
noPath: () => 'from-codex necesita una ruta explícita: trazum from-codex ./sesiones',
|
|
1941
|
+
notFound: (path) => `No se puede leer ${path}`,
|
|
1942
|
+
noFiles: (path) => `No hay archivos JSONL en ${path}`,
|
|
1943
|
+
noUsage: () => 'No hay uso de Codex atribuible. Revisa los huecos indicados; no se escribió un registro de coste cero.',
|
|
1944
|
+
summary: (files, records, duplicates) => `${files} archivo(s) Codex, ${records} registro(s) corroborados, ${duplicates} instantáneas repetidas descartadas.`,
|
|
1945
|
+
gaps: (missingModel, unsupported, unparseable) => `Huecos Codex: ${missingModel} sin contexto de modelo, ${unsupported} instantáneas no admitidas o sin corroborar, ${unparseable} líneas ilegibles. No son llamadas de coste cero.`,
|
|
1946
|
+
caveat: () => 'La telemetría Codex se valora a tarifas API del catálogo, no como factura de suscripción. Totales restaurados, reinicios y deltas ambiguos quedan excluidos.',
|
|
1947
|
+
written: (file) => `Registro normalizado escrito en ${file}`,
|
|
1948
|
+
},
|
|
1949
|
+
|
|
1924
1950
|
fromOtel: {
|
|
1925
1951
|
noPath: () => 'from-otel necesita un archivo o directorio OTLP: trazum from-otel spans.json',
|
|
1926
1952
|
notFound: (path) => `${path}: no existe`,
|
|
@@ -2085,7 +2111,7 @@ ${bold('EJEMPLOS')}
|
|
|
2085
2111
|
pricingLiveHint: (count) =>
|
|
2086
2112
|
`${count} id(s) de modelo sin precio llevan prefijo de proveedor, como nombran los modelos OpenRouter y LiteLLM, y el catálogo incluido no los trae. Vuelve a ejecutar con --pricing-live para cobrar los slugs de OpenRouter desde su propia lista.`,
|
|
2087
2113
|
apiEquivalent: () =>
|
|
2088
|
-
'Las
|
|
2114
|
+
'Las sesiones de Claude Code y Codex se valoran a tarifas API del catálogo. Si pagas una suscripción, pagaste el plan, no esta estimación equivalente; los datos ausentes y las tarifas propias pueden cambiar el resultado.',
|
|
2089
2115
|
prefixedKnown: (ids) =>
|
|
2090
2116
|
`${ids}: el modelo tras la barra tiene precio aquí con su propio nombre. El prefijo no se quita por ti, porque el mismo modelo a través de un router puede facturarse distinto. Si esas llamadas fueron directas al proveedor, registra el modelo sin el prefijo.`,
|
|
2091
2117
|
windowMatchesNothing: (from, to) =>
|
|
@@ -2279,6 +2305,7 @@ ${bold('EJEMPLOS')}
|
|
|
2279
2305
|
noSessions: () => 'Ningún registro traía sesión, así que el crecimiento de conversación y los costes por conversación no están en este informe.',
|
|
2280
2306
|
byLabelHeading: () => 'Por carga de trabajo',
|
|
2281
2307
|
byModelHeading: () => 'Por modelo',
|
|
2308
|
+
byMonthHeading: () => 'Por mes',
|
|
2282
2309
|
findingsHeading: () => 'Qué movería esta factura',
|
|
2283
2310
|
colLabel: () => 'carga',
|
|
2284
2311
|
colModel: () => 'modelo',
|
|
@@ -2338,8 +2365,8 @@ ${bold('EJEMPLOS')}
|
|
|
2338
2365
|
|
|
2339
2366
|
where: {
|
|
2340
2367
|
hostHeading: () => 'Ejecutándose dentro de',
|
|
2341
|
-
|
|
2342
|
-
`${host}
|
|
2368
|
+
billingUnknown: (host) =>
|
|
2369
|
+
`${host} solo identifica el entorno de ejecución. La forma de pago es desconocida; los precios por token no demuestran ahorro en factura.`,
|
|
2343
2370
|
noTarget: () => 'Pasa un fichero fuente para ver a qué proveedor van sus prompts.',
|
|
2344
2371
|
sourceHeading: (path) => `Los prompts de ${path} van a`,
|
|
2345
2372
|
conflict: () => 'No se puede saber: el fichero nombra más de un proveedor.',
|
package/src/i18n/types.ts
CHANGED
|
@@ -625,6 +625,17 @@ export interface CliMessages {
|
|
|
625
625
|
nothingToBill(): string;
|
|
626
626
|
};
|
|
627
627
|
|
|
628
|
+
fromCodex: {
|
|
629
|
+
noPath(): string;
|
|
630
|
+
notFound(path: string): string;
|
|
631
|
+
noFiles(path: string): string;
|
|
632
|
+
noUsage(): string;
|
|
633
|
+
summary(files: number, records: number, duplicates: number): string;
|
|
634
|
+
gaps(missingModel: number, unsupported: number, unparseable: number): string;
|
|
635
|
+
caveat(): string;
|
|
636
|
+
written(file: string): string;
|
|
637
|
+
};
|
|
638
|
+
|
|
628
639
|
fromOtel: {
|
|
629
640
|
noPath(): string;
|
|
630
641
|
notFound(path: string): string;
|
|
@@ -926,6 +937,8 @@ export interface CliMessages {
|
|
|
926
937
|
noSessions(): string;
|
|
927
938
|
byLabelHeading(): string;
|
|
928
939
|
byModelHeading(): string;
|
|
940
|
+
/** Shown once a report spans two calendar months; the column is `bill.colMonth`. */
|
|
941
|
+
byMonthHeading(): string;
|
|
929
942
|
findingsHeading(): string;
|
|
930
943
|
colLabel(): string;
|
|
931
944
|
colModel(): string;
|
|
@@ -977,7 +990,7 @@ export interface CliMessages {
|
|
|
977
990
|
|
|
978
991
|
where: {
|
|
979
992
|
hostHeading(): string;
|
|
980
|
-
|
|
993
|
+
billingUnknown(host: string): string;
|
|
981
994
|
noTarget(): string;
|
|
982
995
|
sourceHeading(path: string): string;
|
|
983
996
|
conflict(): string;
|