@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.
- package/README.md +4 -0
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +56 -0
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +57 -0
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/types.d.ts +33 -0
- package/dist/i18n/types.d.ts.map +1 -1
- package/dist/index.js +214 -79
- package/dist/index.js.map +1 -1
- package/dist/style.d.ts +68 -0
- package/dist/style.d.ts.map +1 -0
- package/dist/style.js +88 -0
- package/dist/style.js.map +1 -0
- package/package.json +2 -2
- package/src/i18n/en.ts +70 -0
- package/src/i18n/es.ts +71 -0
- package/src/i18n/types.ts +35 -0
- package/src/index.ts +219 -85
- package/src/style.ts +108 -0
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { createInterface } from 'node:readline/promises';
|
|
|
6
6
|
import { dirname, join, resolve as resolvePath } from 'node:path';
|
|
7
7
|
import { fileURLToPath } from 'node:url';
|
|
8
8
|
import { gunzipSync } from 'node:zlib';
|
|
9
|
-
import { CONTRACT_NAMES, contractSchema, applyRewrites, BASELINE_FILENAME, BASELINE_VERSION, breaches, cacheableMinimum, analyzeCachePrefix, billLevers, bucketedCacheEconomics, bucketedProfile, buildHistory, buildPlan, connectorFor, CONNECTORS, normalizeAnthropicUsage, normalizeOpenAIUsage, bucketsFromRecords, evaluateWatch, firedKey, pruneRecords, recordsFromBuckets, storeInventory, storedReportFrom, verifyPlan, cacheEconomics, cacheHitRate, contextPressure, comparePrompts, compareToBaseline, computeSavings, bandGoverns, countTokensAnthropic, DEFAULT_USAGE, budgetPositions, conform, BREAK_EVEN_BAND, allocate, annualRecord, replayCommitment, coversTheTerm, runExperiment, qualityGate, semanticPassCost, verifySemanticProposals, SEMANTIC_SYSTEM_PROMPT, ladderPosition, validateLadder, outcomeReport, rankPerOutcome, FAILURE_POLICIES, detectFromSource, matchLocale, parsePlanDocument, waiverDay, waiverHistory, proposeInit, MIN_RATE_DAYS, parseConfig, coverageDrift, driversBetween, explainGateFailure, assignSources, fleetRollup, rollUp, heartbeats, ruleYield, labelCoverage, measuredUsage, gateMargin, GATE_MARGIN_TIGHT, estimateTokens, evaluate, extractPrompts, findExamples, formatBaseline, formatSignedUsd, formatUsd, getMessages, getModel, hasMarker, LOCALES, MAX_BASELINE_BYTES, matchGlob, MAX_INPUT_CHARS, moneyIsComparable, mostSpecificMatch, assemble, interview, nearestName, slot, SLOT_IDS, optimize, parseBaseline, PHRASE_LANGUAGES, detectTextLanguage, dictionaryStanding, languagesWithStanding, indexUsage, parseUsageLine, plannedCalls, claudeCodeRecords, otelRecords, positionAt, positionReport, profilePrompt, profileToCsv, profileUsage, promptId, providerFromEnv, pruneExamples, refineWithLlm, rejectionText, reorderForCache, repriceProfile, reviewAgeDays, reviewExamples, RULES, sharedPrefixes, sharesOf, SOURCE_EXTENSIONS, suggestRewrites, toOtlpMetrics, toPromptfoo, TTL_1H_MS, UNLABELLED, withExactTokenCounts, } from '@trazum/core';
|
|
9
|
+
import { CONTRACT_NAMES, contractSchema, applyRewrites, BASELINE_FILENAME, BASELINE_VERSION, breaches, cacheableMinimum, analyzeCachePrefix, billLevers, bucketedCacheEconomics, bucketedProfile, buildHistory, buildPlan, connectorFor, CONNECTORS, normalizeAnthropicUsage, normalizeOpenAIUsage, bucketsFromRecords, evaluateWatch, firedKey, pruneRecords, recordsFromBuckets, storeInventory, storedReportFrom, verifyPlan, cacheEconomics, cacheHitRate, contextPressure, comparePrompts, compareToBaseline, computeSavings, bandGoverns, countTokensAnthropic, DEFAULT_USAGE, budgetPositions, conform, BREAK_EVEN_BAND, allocate, annualRecord, replayCommitment, coversTheTerm, runExperiment, qualityGate, semanticPassCost, verifySemanticProposals, SEMANTIC_SYSTEM_PROMPT, ladderPosition, validateLadder, outcomeReport, rankPerOutcome, FAILURE_POLICIES, detectFromSource, matchLocale, parsePlanDocument, waiverDay, waiverHistory, proposeInit, MIN_RATE_DAYS, parseConfig, coverageDrift, driversBetween, explainGateFailure, assignSources, fleetRollup, rollUp, heartbeats, ruleYield, labelCoverage, measuredUsage, gateMargin, GATE_MARGIN_TIGHT, estimateTokens, evaluate, extractPrompts, findExamples, formatBaseline, formatSignedUsd, formatUsd, getMessages, getModel, hasMarker, LOCALES, MAX_BASELINE_BYTES, matchGlob, MAX_INPUT_CHARS, moneyIsComparable, mostSpecificMatch, assemble, interview, nearestName, slot, SLOT_IDS, optimize, parseBaseline, PHRASE_LANGUAGES, detectTextLanguage, dictionaryStanding, languagesWithStanding, indexUsage, parseUsageLine, plannedCalls, claudeCodeRecords, otelRecords, ownRate, positionAt, positionReport, profilePrompt, profileToCsv, profileUsage, promptId, providerFromEnv, pruneExamples, refineWithLlm, rejectionText, reorderForCache, repriceProfile, switchAnalysis, reviewAgeDays, reviewExamples, RULES, sharedPrefixes, sharesOf, SOURCE_EXTENSIONS, suggestRewrites, toOtlpMetrics, toPromptfoo, TTL_1H_MS, UNLABELLED, withExactTokenCounts, } from '@trazum/core';
|
|
10
10
|
import { cacheDir, cacheStats, cachingProvider, clearCache } from './suggest-cache.js';
|
|
11
11
|
import { dayOf, formatGap, median, spanDays } from './time.js';
|
|
12
12
|
// Everything that reads the filesystem, on its own entry point so the web
|
|
@@ -25,15 +25,11 @@ import { renderPositionHtml, renderProfileHtml, renderRollupHtml } from './html.
|
|
|
25
25
|
// --------------------------------------------------------------------------
|
|
26
26
|
// Presentation
|
|
27
27
|
// --------------------------------------------------------------------------
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
red: (s) => (useColor ? `\u001b[31m${s}\u001b[39m` : s),
|
|
34
|
-
yellow: (s) => (useColor ? `\u001b[33m${s}\u001b[39m` : s),
|
|
35
|
-
cyan: (s) => (useColor ? `\u001b[36m${s}\u001b[39m` : s),
|
|
36
|
-
};
|
|
28
|
+
// The painters, the ANSI-aware measurer, the one table renderer, the
|
|
29
|
+
// proportion bar and the heading rule — the 1.75 style module. The guard in
|
|
30
|
+
// style.test.js holds the contract: stripped colour output is byte-identical
|
|
31
|
+
// to plain output, and a pipe stays plain.
|
|
32
|
+
import { bar, c, sectionHeading, table } from './style.js';
|
|
37
33
|
const VALUE_FLAGS = new Set([
|
|
38
34
|
'answers',
|
|
39
35
|
'calls',
|
|
@@ -101,6 +97,12 @@ const VALUE_FLAGS = new Set([
|
|
|
101
97
|
'prompt',
|
|
102
98
|
'out',
|
|
103
99
|
'o',
|
|
100
|
+
'to',
|
|
101
|
+
'migration-usd',
|
|
102
|
+
'cases',
|
|
103
|
+
'gpu-usd-hour',
|
|
104
|
+
'tokens-per-second',
|
|
105
|
+
'utilization',
|
|
104
106
|
]);
|
|
105
107
|
function parseArgs(argv, t) {
|
|
106
108
|
const flags = new Map();
|
|
@@ -379,6 +381,8 @@ const COMMAND_FLAGS = {
|
|
|
379
381
|
position: ['json', 'html-out', 'pricing', 'pricing-live'],
|
|
380
382
|
'from-claude-code': ['label', 'label-from-project', 'out', 'o'],
|
|
381
383
|
'from-otel': ['label-from-service', 'out', 'o'],
|
|
384
|
+
switch: ['to', 'migration-usd', 'cases'],
|
|
385
|
+
ownrate: ['gpu-usd-hour', 'tokens-per-second', 'utilization'],
|
|
382
386
|
pulse: ['json', 'max-stale-hours'],
|
|
383
387
|
bench: ['workload', 'json', 'record', 'against', 'max-ratio'],
|
|
384
388
|
write: ['answers', 'json', 'out', 'o', 'calls', 'avg-output'],
|
|
@@ -589,7 +593,7 @@ measured = null) {
|
|
|
589
593
|
// above already told them nothing changed.
|
|
590
594
|
if (reorder !== null && (reorder.moved.length > 0 || reorder.declined.length > 0)) {
|
|
591
595
|
console.log();
|
|
592
|
-
console.log(
|
|
596
|
+
console.log(sectionHeading(t.report.reorderHeading()));
|
|
593
597
|
if (reorder.moved.length === 0) {
|
|
594
598
|
console.log(` ${c.dim(t.report.reorderNothing())}`);
|
|
595
599
|
}
|
|
@@ -824,7 +828,7 @@ namedScenario = false) {
|
|
|
824
828
|
const model = getModel(result.usage.model);
|
|
825
829
|
const saved = result.tokensBefore - result.tokensAfter;
|
|
826
830
|
console.log();
|
|
827
|
-
console.log(
|
|
831
|
+
console.log(sectionHeading(t.report.tokensOnlyHeading(host.displayName)));
|
|
828
832
|
// Only claim the host bills by subscription when it does. Forced with the
|
|
829
833
|
// flag on GitHub Actions, the first version said "GitHub Actions bills by
|
|
830
834
|
// subscription", which is simply false.
|
|
@@ -1208,7 +1212,7 @@ function renderInit(proposal, ctx) {
|
|
|
1208
1212
|
const { t } = ctx;
|
|
1209
1213
|
const n = (value) => value.toLocaleString(t.numberLocale);
|
|
1210
1214
|
console.log();
|
|
1211
|
-
console.log(
|
|
1215
|
+
console.log(sectionHeading(t.init.heading()));
|
|
1212
1216
|
console.log();
|
|
1213
1217
|
// 1. Where this is running.
|
|
1214
1218
|
console.log(` ${t.init.host(ctx.host.displayName)}`);
|
|
@@ -1233,7 +1237,7 @@ function renderInit(proposal, ctx) {
|
|
|
1233
1237
|
}
|
|
1234
1238
|
console.log();
|
|
1235
1239
|
// 4. What the config would say, and what it will not.
|
|
1236
|
-
console.log(
|
|
1240
|
+
console.log(sectionHeading(t.init.configHeading()));
|
|
1237
1241
|
if (proposal.justified.length === 0) {
|
|
1238
1242
|
console.log(` ${c.dim(t.init.nothingJustified())}`);
|
|
1239
1243
|
}
|
|
@@ -1249,7 +1253,7 @@ function renderInit(proposal, ctx) {
|
|
|
1249
1253
|
}
|
|
1250
1254
|
console.log();
|
|
1251
1255
|
// 5. The single most valuable thing found — arithmetic first.
|
|
1252
|
-
console.log(
|
|
1256
|
+
console.log(sectionHeading(t.init.findingHeading()));
|
|
1253
1257
|
if (proposal.headline === null) {
|
|
1254
1258
|
console.log(` ${c.dim(t.init.noFinding(proposal.noHeadline ?? 'nothing-measured'))}`);
|
|
1255
1259
|
console.log();
|
|
@@ -1604,7 +1608,7 @@ async function commandConform(args, t) {
|
|
|
1604
1608
|
}
|
|
1605
1609
|
if (report.unavailable.length > 0) {
|
|
1606
1610
|
console.log();
|
|
1607
|
-
console.log(
|
|
1611
|
+
console.log(sectionHeading(t.conform.unavailableHeading()));
|
|
1608
1612
|
for (const gap of report.unavailable) {
|
|
1609
1613
|
console.log(` ${c.dim(wrap(t.conform.unavailable(gap.finding, gap.because, gap.unlockedBy), 74, ' '))}`);
|
|
1610
1614
|
}
|
|
@@ -1718,7 +1722,7 @@ async function commandRollup(args, t) {
|
|
|
1718
1722
|
console.log(` ${c.dim(wrap(t.rollup.claimedSpan(day(document.claimedSpan.fromMs), day(document.claimedSpan.toMs - 1), document.claimedSpan.contributors), 72, ' '))}`);
|
|
1719
1723
|
}
|
|
1720
1724
|
console.log();
|
|
1721
|
-
console.log(
|
|
1725
|
+
console.log(sectionHeading(t.rollup.contributorsHeading()));
|
|
1722
1726
|
for (const contributor of document.contributors) {
|
|
1723
1727
|
console.log(` ${t.rollup.contributor(contributor.name, formatUsd(contributor.totalUsd), contributor.calls, contributor.spanDays === null ? null : Math.round(contributor.spanDays))}${contributor.via === null ? '' : ` ${c.dim(t.rollup.via(contributor.via))}`}`);
|
|
1724
1728
|
/**
|
|
@@ -1758,7 +1762,7 @@ async function commandRollup(args, t) {
|
|
|
1758
1762
|
}
|
|
1759
1763
|
if (document.rejected.length > 0) {
|
|
1760
1764
|
console.log();
|
|
1761
|
-
console.log(
|
|
1765
|
+
console.log(sectionHeading(t.rollup.rejectedHeading()));
|
|
1762
1766
|
for (const rejection of document.rejected) {
|
|
1763
1767
|
// The roll-up it arrived through, when it came through one: a rejection
|
|
1764
1768
|
// whose origin got lost is a machine nobody knows to go and fix.
|
|
@@ -1782,14 +1786,14 @@ async function commandRollup(args, t) {
|
|
|
1782
1786
|
}
|
|
1783
1787
|
if (document.byLabel.length > 0) {
|
|
1784
1788
|
console.log();
|
|
1785
|
-
console.log(
|
|
1789
|
+
console.log(sectionHeading(t.rollup.byLabelHeading()));
|
|
1786
1790
|
for (const row of document.byLabel.slice(0, 8)) {
|
|
1787
1791
|
console.log(` ${t.rollup.labelRow(row.label, formatUsd(row.breakdown.totalUsd), row.breakdown.calls)}`);
|
|
1788
1792
|
}
|
|
1789
1793
|
}
|
|
1790
1794
|
if (document.notMerged.length > 0) {
|
|
1791
1795
|
console.log();
|
|
1792
|
-
console.log(
|
|
1796
|
+
console.log(sectionHeading(t.rollup.notMergedHeading()));
|
|
1793
1797
|
for (const finding of document.notMerged) {
|
|
1794
1798
|
console.log(` ${wrap(t.rollup.notMerged(finding.finding, finding.because), 72, ' ')}`);
|
|
1795
1799
|
if (finding.presentIn.length > 0) {
|
|
@@ -1799,7 +1803,7 @@ async function commandRollup(args, t) {
|
|
|
1799
1803
|
}
|
|
1800
1804
|
if (document.cannotSay.length > 0) {
|
|
1801
1805
|
console.log();
|
|
1802
|
-
console.log(
|
|
1806
|
+
console.log(sectionHeading(t.rollup.cannotSayHeading()));
|
|
1803
1807
|
for (const caveat of document.cannotSay) {
|
|
1804
1808
|
console.log(` ${c.dim(wrap(t.rollup.caveat(caveat), 72, ' '))}`);
|
|
1805
1809
|
}
|
|
@@ -2081,6 +2085,137 @@ async function commandFromClaudeCode(args, t) {
|
|
|
2081
2085
|
* standardised the TTL split). Prompt content, trace ids and every other span
|
|
2082
2086
|
* attribute stay in the span; a fixture greps the whole output to prove it.
|
|
2083
2087
|
*/
|
|
2088
|
+
/**
|
|
2089
|
+
* `trazum switch` — the forty-first command, from the 1.74 plan: the decision
|
|
2090
|
+
* every what-if serves, priced. Rests on `switchAnalysis`, which rests on
|
|
2091
|
+
* `repriceProfile`, so over-context slices and cache minimums keep their
|
|
2092
|
+
* honesty. Ends, always, on the refusal: quality is `trazum route`'s verdict.
|
|
2093
|
+
*/
|
|
2094
|
+
async function commandSwitch(args, pricing, t) {
|
|
2095
|
+
const file = args.positional[0];
|
|
2096
|
+
if (file === undefined)
|
|
2097
|
+
throw new Error(t.switchCmd.noLog());
|
|
2098
|
+
const target = stringFlag(args, 'to');
|
|
2099
|
+
if (target === undefined)
|
|
2100
|
+
throw new Error(t.switchCmd.noTarget());
|
|
2101
|
+
// Optional numbers: absent stays absent — a defaulted migration cost or
|
|
2102
|
+
// case count would be an invented one.
|
|
2103
|
+
const optional = (name) => {
|
|
2104
|
+
const raw = stringFlag(args, name);
|
|
2105
|
+
if (raw === undefined)
|
|
2106
|
+
return undefined;
|
|
2107
|
+
const value = Number(raw);
|
|
2108
|
+
if (!Number.isFinite(value) || value < 0)
|
|
2109
|
+
throw new Error(t.errors.mustBeNonNegative(name, raw));
|
|
2110
|
+
return value;
|
|
2111
|
+
};
|
|
2112
|
+
const migrationUsd = optional('migration-usd');
|
|
2113
|
+
const cases = optional('cases');
|
|
2114
|
+
const text = await readUsageLog(file, t);
|
|
2115
|
+
const report = profileUsage(text, { catalogue: pricing });
|
|
2116
|
+
const analysis = switchAnalysis(report, target, {
|
|
2117
|
+
catalogue: pricing,
|
|
2118
|
+
...(migrationUsd !== undefined ? { migrationUsd } : {}),
|
|
2119
|
+
...(cases !== undefined ? { evalCases: cases } : {}),
|
|
2120
|
+
});
|
|
2121
|
+
if (analysis === null)
|
|
2122
|
+
throw new Error(t.switchCmd.unknownModel(target));
|
|
2123
|
+
const { reprice, savingUsd, measuredDays, breakEven, evalCost } = analysis;
|
|
2124
|
+
console.log();
|
|
2125
|
+
console.log(sectionHeading(t.switchCmd.heading(reprice.target.displayName)));
|
|
2126
|
+
if (reprice.slices.length === 0) {
|
|
2127
|
+
console.log(` ${wrap(t.switchCmd.nothingMovable(), 74, ' ')}`);
|
|
2128
|
+
}
|
|
2129
|
+
else {
|
|
2130
|
+
const line = savingUsd >= 0
|
|
2131
|
+
? t.switchCmd.saves(formatUsd(reprice.currentUsd), formatUsd(reprice.targetUsd), formatUsd(savingUsd))
|
|
2132
|
+
: t.switchCmd.costs(formatUsd(reprice.currentUsd), formatUsd(reprice.targetUsd), formatUsd(-savingUsd));
|
|
2133
|
+
console.log(` ${savingUsd >= 0 ? c.green('->') : c.red('->')} ${wrap(line, 72, ' ')}`);
|
|
2134
|
+
const movableCalls = reprice.slices.reduce((sum, slice) => sum + slice.calls, 0);
|
|
2135
|
+
console.log(` ${wrap(t.switchCmd.movable(movableCalls, reprice.slices.length), 74, ' ')}`);
|
|
2136
|
+
}
|
|
2137
|
+
if (reprice.overContext.length > 0) {
|
|
2138
|
+
const usd = reprice.overContext.reduce((sum, slice) => sum + slice.currentUsd, 0);
|
|
2139
|
+
console.log(` ${c.yellow('!')} ${wrap(t.switchCmd.overContext(reprice.overContext.length, formatUsd(usd)), 72, ' ')}`);
|
|
2140
|
+
}
|
|
2141
|
+
if (reprice.alreadyOnTarget.calls > 0) {
|
|
2142
|
+
console.log(` ${wrap(t.switchCmd.alreadyOnTarget(reprice.alreadyOnTarget.calls, formatUsd(reprice.alreadyOnTarget.usd)), 74, ' ')}`);
|
|
2143
|
+
}
|
|
2144
|
+
console.log(` ${wrap(measuredDays !== null ? t.switchCmd.window(measuredDays) : t.switchCmd.noWindow(), 74, ' ')}`);
|
|
2145
|
+
if (breakEven !== null) {
|
|
2146
|
+
const sentence = 'days' in breakEven
|
|
2147
|
+
? t.switchCmd.breakEvenDays(formatUsd(breakEven.migrationUsd), Math.ceil(breakEven.days), measuredDays ?? 0)
|
|
2148
|
+
: breakEven.refused === 'no-saving'
|
|
2149
|
+
? t.switchCmd.breakEvenNoSaving(formatUsd(breakEven.migrationUsd))
|
|
2150
|
+
: t.switchCmd.breakEvenNoClock(formatUsd(breakEven.migrationUsd));
|
|
2151
|
+
console.log(` ${wrap(sentence, 74, ' ')}`);
|
|
2152
|
+
}
|
|
2153
|
+
if (evalCost !== null) {
|
|
2154
|
+
console.log(` ${wrap(t.switchCmd.evalCost(evalCost.cases, formatUsd(evalCost.totalUsd)), 74, ' ')}`);
|
|
2155
|
+
}
|
|
2156
|
+
else if (reprice.slices.length > 0) {
|
|
2157
|
+
console.log(` ${c.dim(wrap(t.switchCmd.evalCostHint(), 74, ' '))}`);
|
|
2158
|
+
}
|
|
2159
|
+
console.log();
|
|
2160
|
+
console.log(` ${wrap(t.switchCmd.quality(`trazum route ${file} --prompt-file <prompt> --cases <cases> --yes`), 74, ' ')}`);
|
|
2161
|
+
}
|
|
2162
|
+
/**
|
|
2163
|
+
* `trazum ownrate` — the forty-second: a self-hosted model's $/MTok, derived
|
|
2164
|
+
* from the operator's own declared numbers, with the overlay snippet ready to
|
|
2165
|
+
* paste. Division and a label, nothing modelled.
|
|
2166
|
+
*/
|
|
2167
|
+
function commandOwnrate(args, t) {
|
|
2168
|
+
const optional = (name) => {
|
|
2169
|
+
const raw = stringFlag(args, name);
|
|
2170
|
+
if (raw === undefined)
|
|
2171
|
+
return undefined;
|
|
2172
|
+
const value = Number(raw);
|
|
2173
|
+
if (!Number.isFinite(value))
|
|
2174
|
+
throw new Error(t.ownrate.invalid(name));
|
|
2175
|
+
return value;
|
|
2176
|
+
};
|
|
2177
|
+
const gpuUsdPerHour = optional('gpu-usd-hour');
|
|
2178
|
+
const tokensPerSecond = optional('tokens-per-second');
|
|
2179
|
+
const utilization = optional('utilization');
|
|
2180
|
+
if (gpuUsdPerHour === undefined || tokensPerSecond === undefined)
|
|
2181
|
+
throw new Error(t.ownrate.missing());
|
|
2182
|
+
if (!(gpuUsdPerHour > 0))
|
|
2183
|
+
throw new Error(t.ownrate.invalid('gpu-usd-hour'));
|
|
2184
|
+
if (!(tokensPerSecond > 0))
|
|
2185
|
+
throw new Error(t.ownrate.invalid('tokens-per-second'));
|
|
2186
|
+
if (utilization !== undefined && !(utilization > 0 && utilization <= 1))
|
|
2187
|
+
throw new Error(t.ownrate.invalid('utilization'));
|
|
2188
|
+
const { usdPerMTok } = ownRate({
|
|
2189
|
+
gpuUsdPerHour,
|
|
2190
|
+
tokensPerSecond,
|
|
2191
|
+
...(utilization !== undefined ? { utilization } : {}),
|
|
2192
|
+
});
|
|
2193
|
+
const pct = Math.round((utilization ?? 1) * 100);
|
|
2194
|
+
console.log();
|
|
2195
|
+
console.log(` ${wrap(t.ownrate.result(formatUsd(usdPerMTok), tokensPerSecond, formatUsd(gpuUsdPerHour), pct), 74, ' ')}`);
|
|
2196
|
+
console.log(` ${c.dim(wrap(t.ownrate.declared(), 74, ' '))}`);
|
|
2197
|
+
console.log();
|
|
2198
|
+
console.log(` ${t.ownrate.snippetHeading()}`);
|
|
2199
|
+
// Complete on purpose: the overlay parser refuses a new model with fields
|
|
2200
|
+
// missing, and a snippet that does not paste is worse than none. The
|
|
2201
|
+
// honest values for what a self-hosted model has not measured are the
|
|
2202
|
+
// catalogue's own unknowns, never a guess.
|
|
2203
|
+
const snippet = {
|
|
2204
|
+
lastReviewed: new Date().toISOString().slice(0, 10),
|
|
2205
|
+
models: {
|
|
2206
|
+
'my-self-hosted-model': {
|
|
2207
|
+
displayName: 'My self-hosted model',
|
|
2208
|
+
inputPerMTok: Number(usdPerMTok.toFixed(4)),
|
|
2209
|
+
outputPerMTok: Number(usdPerMTok.toFixed(4)),
|
|
2210
|
+
contextWindow: 32768,
|
|
2211
|
+
cacheMinTokens: null,
|
|
2212
|
+
tier: 'unknown',
|
|
2213
|
+
capability: 'unknown',
|
|
2214
|
+
},
|
|
2215
|
+
},
|
|
2216
|
+
};
|
|
2217
|
+
console.log(JSON.stringify(snippet, null, 2));
|
|
2218
|
+
}
|
|
2084
2219
|
async function commandFromOtel(args, t) {
|
|
2085
2220
|
const target = args.positional[0];
|
|
2086
2221
|
if (target === undefined)
|
|
@@ -2181,7 +2316,7 @@ async function commandPosition(args, config, pricing, t) {
|
|
|
2181
2316
|
? t.position.scopeDay()
|
|
2182
2317
|
: t.position.scopeLabel(position.label ?? '');
|
|
2183
2318
|
console.log();
|
|
2184
|
-
console.log(
|
|
2319
|
+
console.log(sectionHeading(t.position.heading(document.month.id)));
|
|
2185
2320
|
for (const position of document.positions) {
|
|
2186
2321
|
const name = scopeName(position);
|
|
2187
2322
|
if (position.verdict === 'cannot-tell') {
|
|
@@ -2250,7 +2385,7 @@ async function commandPulse(args, t) {
|
|
|
2250
2385
|
}
|
|
2251
2386
|
const when = (ms) => new Date(ms).toISOString().replace('T', ' ').slice(0, 16);
|
|
2252
2387
|
console.log();
|
|
2253
|
-
console.log(
|
|
2388
|
+
console.log(sectionHeading(t.pulse.heading()));
|
|
2254
2389
|
for (const heartbeat of report.beats) {
|
|
2255
2390
|
const name = t.pulse.kind(heartbeat.kind);
|
|
2256
2391
|
if (heartbeat.lastMs === null) {
|
|
@@ -2504,7 +2639,7 @@ function printBenchTable(measurements, t, machine) {
|
|
|
2504
2639
|
const mb = (bytes) => `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
2505
2640
|
const idWidth = Math.max(...measurements.map((m) => m.id.length), t.bench.colWorkload().length);
|
|
2506
2641
|
console.log();
|
|
2507
|
-
console.log(
|
|
2642
|
+
console.log(sectionHeading(t.bench.heading()));
|
|
2508
2643
|
if (machine !== undefined) {
|
|
2509
2644
|
console.log(` ${c.dim(t.bench.machine(machine.node, machine.platform, machine.cpus, machine.cpuModel))}`);
|
|
2510
2645
|
}
|
|
@@ -2697,10 +2832,10 @@ function commandFeedback(t) {
|
|
|
2697
2832
|
].join('\n');
|
|
2698
2833
|
const url = `${FEEDBACK_REPO}/issues/new?body=${encodeURIComponent(body)}`;
|
|
2699
2834
|
console.log();
|
|
2700
|
-
console.log(
|
|
2835
|
+
console.log(sectionHeading(t.feedback.heading()));
|
|
2701
2836
|
console.log(` ${c.dim(wrap(t.feedback.sendsNothing(), 74, ' '))}`);
|
|
2702
2837
|
console.log();
|
|
2703
|
-
console.log(
|
|
2838
|
+
console.log(sectionHeading(t.feedback.whereHeading()));
|
|
2704
2839
|
console.log(` ${t.feedback.wrongOptimisation()}`);
|
|
2705
2840
|
console.log(` ${c.dim(`${FEEDBACK_REPO}/issues/new?template=wrong_optimisation.yml`)}`);
|
|
2706
2841
|
console.log(` ${t.feedback.bug()}`);
|
|
@@ -2710,12 +2845,12 @@ function commandFeedback(t) {
|
|
|
2710
2845
|
console.log(` ${t.feedback.security()}`);
|
|
2711
2846
|
console.log(` ${c.dim(`${FEEDBACK_REPO}/security/advisories/new`)}`);
|
|
2712
2847
|
console.log();
|
|
2713
|
-
console.log(
|
|
2848
|
+
console.log(sectionHeading(t.feedback.environmentHeading()));
|
|
2714
2849
|
for (const line of environment)
|
|
2715
2850
|
console.log(` ${line}`);
|
|
2716
2851
|
console.log(` ${c.dim(wrap(t.feedback.environmentOnly(), 74, ' '))}`);
|
|
2717
2852
|
console.log();
|
|
2718
|
-
console.log(
|
|
2853
|
+
console.log(sectionHeading(t.feedback.linkHeading()));
|
|
2719
2854
|
console.log(` ${url}`);
|
|
2720
2855
|
console.log();
|
|
2721
2856
|
}
|
|
@@ -2876,7 +3011,7 @@ async function commandLadder(args, config, pricing, t) {
|
|
|
2876
3011
|
const n = (value) => value.toLocaleString(t.numberLocale);
|
|
2877
3012
|
const pct = (value) => `${(value * 100).toFixed(1)}%`;
|
|
2878
3013
|
console.log();
|
|
2879
|
-
console.log(
|
|
3014
|
+
console.log(sectionHeading(t.ladder.heading()));
|
|
2880
3015
|
if (Object.keys(ladders).length === 0) {
|
|
2881
3016
|
console.log(` ${c.dim(wrap(t.ladder.noLadders(), 74, ' '))}`);
|
|
2882
3017
|
console.log();
|
|
@@ -2996,7 +3131,7 @@ async function commandExperiment(args, config, pricing, t) {
|
|
|
2996
3131
|
};
|
|
2997
3132
|
const result = runExperiment({ arms: [aName, bName], minOutcomesPerArm }, { a: armOf(aName), b: armOf(bName) }, config.outcomes ?? null);
|
|
2998
3133
|
console.log();
|
|
2999
|
-
console.log(
|
|
3134
|
+
console.log(sectionHeading(t.experiment.heading(aName, bName)));
|
|
3000
3135
|
console.log();
|
|
3001
3136
|
for (const side of [result.a, result.b]) {
|
|
3002
3137
|
console.log(` ${t.experiment.arm(side.name, side.rate === null ? '—' : pct(side.rate), n(side.successes), n(side.recorded), side.interval === null ? '—' : `[${pct(side.interval.low)}, ${pct(side.interval.high)}]`)}`);
|
|
@@ -3093,7 +3228,7 @@ async function commandQuality(args, config, pricing, t) {
|
|
|
3093
3228
|
const pct = (value) => `${(value * 100).toFixed(1)}%`;
|
|
3094
3229
|
const n = (value) => value.toLocaleString(t.numberLocale);
|
|
3095
3230
|
console.log();
|
|
3096
|
-
console.log(
|
|
3231
|
+
console.log(sectionHeading(t.quality.heading(label)));
|
|
3097
3232
|
console.log(` ${c.dim(wrap(t.quality.notRandomised(), 74, ' '))}`);
|
|
3098
3233
|
console.log();
|
|
3099
3234
|
console.log(` ${t.quality.sides(result.before.rate === null ? '—' : pct(result.before.rate), result.after.rate === null ? '—' : pct(result.after.rate), n(result.outcomes.before), n(result.outcomes.after))}`);
|
|
@@ -3169,7 +3304,7 @@ async function commandSemantic(args, config, pricing, t) {
|
|
|
3169
3304
|
const cost = semanticPassCost(prompt, rates);
|
|
3170
3305
|
const n = (value) => value.toLocaleString(t.numberLocale);
|
|
3171
3306
|
console.log();
|
|
3172
|
-
console.log(
|
|
3307
|
+
console.log(sectionHeading(t.semantic.heading(args.positional[0] ?? '-')));
|
|
3173
3308
|
console.log();
|
|
3174
3309
|
console.log(` ${wrap(t.semantic.willCost(formatUsd(cost.usd), n(cost.inputTokens), n(cost.outputTokens), model.displayName), 74, ' ')}`);
|
|
3175
3310
|
if (!boolFlag(args, 'yes')) {
|
|
@@ -3255,7 +3390,7 @@ async function commandOwners(args, config, pricing, t) {
|
|
|
3255
3390
|
if (path === undefined)
|
|
3256
3391
|
throw new Error(t.errors.missingInputFile());
|
|
3257
3392
|
console.log();
|
|
3258
|
-
console.log(
|
|
3393
|
+
console.log(sectionHeading(t.owners.heading()));
|
|
3259
3394
|
if (config.owners === undefined) {
|
|
3260
3395
|
console.log(` ${c.dim(wrap(t.owners.noOwners(), 74, ' '))}`);
|
|
3261
3396
|
console.log();
|
|
@@ -3411,7 +3546,7 @@ async function commandCommitment(args, config, pricing, t) {
|
|
|
3411
3546
|
const n = (value) => value.toLocaleString(t.numberLocale);
|
|
3412
3547
|
const pct = (value) => `${(value * 100).toFixed(0)}%`;
|
|
3413
3548
|
console.log();
|
|
3414
|
-
console.log(
|
|
3549
|
+
console.log(sectionHeading(t.commitment.heading(formatUsd(floor), pct(discount), n(months))));
|
|
3415
3550
|
console.log(` ${c.dim(wrap(t.commitment.asIf(), 74, ' '))}`);
|
|
3416
3551
|
console.log();
|
|
3417
3552
|
if (replay.unknown !== null) {
|
|
@@ -3545,7 +3680,7 @@ async function commandReport(args, config, pricing, t) {
|
|
|
3545
3680
|
}
|
|
3546
3681
|
const n = (value) => value.toLocaleString(t.numberLocale);
|
|
3547
3682
|
console.log();
|
|
3548
|
-
console.log(
|
|
3683
|
+
console.log(sectionHeading(t.annual.heading(year)));
|
|
3549
3684
|
console.log();
|
|
3550
3685
|
console.log(` ${t.annual.spent(formatUsd(record.totalUsd), n(record.totalCalls), n(record.months.length))}`);
|
|
3551
3686
|
if (record.missingMonths.length > 0) {
|
|
@@ -3585,7 +3720,7 @@ function commandModels(t, pricing) {
|
|
|
3585
3720
|
const n = (value) => value.toLocaleString(t.numberLocale);
|
|
3586
3721
|
const col = t.models.columns;
|
|
3587
3722
|
console.log();
|
|
3588
|
-
console.log(
|
|
3723
|
+
console.log(sectionHeading(`${t.models.title()}${t.models.unit()}`));
|
|
3589
3724
|
console.log(c.dim(t.models.reviewedOn(pricing.lastReviewed, reviewAgeDays(pricing.lastReviewed, new Date()))));
|
|
3590
3725
|
console.log();
|
|
3591
3726
|
const rows = pricing.models.map((m) => ({
|
|
@@ -3597,20 +3732,14 @@ function commandModels(t, pricing) {
|
|
|
3597
3732
|
// "caches from the first token" — and it is the wrong one.
|
|
3598
3733
|
cache: m.cacheMinTokens === null ? '—' : n(m.cacheMinTokens),
|
|
3599
3734
|
}));
|
|
3600
|
-
const
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
`${col.output.padStart(widths.output)} ${col.context.padStart(widths.context)} ` +
|
|
3609
|
-
`${col.cacheMin.padStart(widths.cache)}`));
|
|
3610
|
-
for (const row of rows) {
|
|
3611
|
-
console.log(` ${row.id.padEnd(widths.id)} ${row.input.padStart(widths.input)} ` +
|
|
3612
|
-
`${row.output.padStart(widths.output)} ${row.context.padStart(widths.context)} ` +
|
|
3613
|
-
`${row.cache.padStart(widths.cache)}`);
|
|
3735
|
+
for (const line of table([
|
|
3736
|
+
{ header: col.model, align: 'left' },
|
|
3737
|
+
{ header: col.input, align: 'right' },
|
|
3738
|
+
{ header: col.output, align: 'right' },
|
|
3739
|
+
{ header: col.context, align: 'right' },
|
|
3740
|
+
{ header: col.cacheMin, align: 'right' },
|
|
3741
|
+
], rows.map((row) => [row.id, row.input, row.output, row.context, row.cache]))) {
|
|
3742
|
+
console.log(line);
|
|
3614
3743
|
}
|
|
3615
3744
|
console.log();
|
|
3616
3745
|
console.log(c.dim(t.models.promoNote()));
|
|
@@ -3623,7 +3752,7 @@ function commandRules(t, locale) {
|
|
|
3623
3752
|
// never drift apart.
|
|
3624
3753
|
const copy = getMessages(locale).rules;
|
|
3625
3754
|
console.log();
|
|
3626
|
-
console.log(
|
|
3755
|
+
console.log(sectionHeading(t.rules.title()));
|
|
3627
3756
|
console.log(c.dim(t.rules.disableHint()));
|
|
3628
3757
|
console.log();
|
|
3629
3758
|
for (const rule of RULES) {
|
|
@@ -3692,7 +3821,7 @@ async function commandRulesMeasure(args, config, pricing, t) {
|
|
|
3692
3821
|
}
|
|
3693
3822
|
const n = (value) => value.toLocaleString(t.numberLocale);
|
|
3694
3823
|
console.log();
|
|
3695
|
-
console.log(
|
|
3824
|
+
console.log(sectionHeading(t.rules.measureHeading(root, report.prompts, level)));
|
|
3696
3825
|
console.log(` ${c.dim(t.rules.measureTotals(n(report.tokensBefore), n(report.tokensSaved), n(report.floor)))}`);
|
|
3697
3826
|
console.log();
|
|
3698
3827
|
for (const rule of report.rules) {
|
|
@@ -3822,7 +3951,7 @@ async function commandOptimize(args, config, pricing, t, locale) {
|
|
|
3822
3951
|
}
|
|
3823
3952
|
rows.sort((a, b) => b.savingUsd - a.savingUsd);
|
|
3824
3953
|
const n = (value) => value.toLocaleString(t.numberLocale);
|
|
3825
|
-
console.log(
|
|
3954
|
+
console.log(sectionHeading(t.report.allLabelsHeading(n(rows.length))));
|
|
3826
3955
|
for (const row of rows) {
|
|
3827
3956
|
const saving = row.periodOnly
|
|
3828
3957
|
? t.report.allLabelsRowPeriod(formatUsd(row.savingUsd))
|
|
@@ -4347,7 +4476,7 @@ async function checkEmbedded(path, extraction, budget, args, counter, level, t,
|
|
|
4347
4476
|
return;
|
|
4348
4477
|
}
|
|
4349
4478
|
console.log();
|
|
4350
|
-
console.log(
|
|
4479
|
+
console.log(sectionHeading(t.check.embeddedHeading(path, extraction.prompts.length)));
|
|
4351
4480
|
for (const verdict of verdicts) {
|
|
4352
4481
|
const over = isOverBudget(verdict);
|
|
4353
4482
|
const label = over ? c.red(t.check.failedLabel()) : c.green(t.check.okLabel());
|
|
@@ -4784,7 +4913,7 @@ function renderBudget(report, t, n) {
|
|
|
4784
4913
|
return;
|
|
4785
4914
|
}
|
|
4786
4915
|
console.log();
|
|
4787
|
-
console.log(
|
|
4916
|
+
console.log(sectionHeading(t.store.budgetHeading(standing.period.id)));
|
|
4788
4917
|
if (standing.coverage === 'none') {
|
|
4789
4918
|
// Nothing measured is never rendered as nothing spent. A dead store and a
|
|
4790
4919
|
// quiet month produce the same zero, and only one of them is good news.
|
|
@@ -5413,7 +5542,7 @@ async function commandPlan(args, pricing, t) {
|
|
|
5413
5542
|
console.log(JSON.stringify(stamped, null, 2));
|
|
5414
5543
|
return;
|
|
5415
5544
|
}
|
|
5416
|
-
console.log(
|
|
5545
|
+
console.log(sectionHeading(t.plan.heading(n(actions.length), formatUsd(plan.totalUsd))));
|
|
5417
5546
|
console.log(` ${wrap(t.plan.totals(formatUsd(stamped.projectedSavingUsd), formatUsd(stamped.measuredStakeUsd)), 74, ' ')}`);
|
|
5418
5547
|
if (plan.span === null) {
|
|
5419
5548
|
console.log(` ${c.dim(wrap(t.plan.noClock(), 74, ' '))}`);
|
|
@@ -5635,7 +5764,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
5635
5764
|
}, (key, value) => (value instanceof Map ? undefined : value), 2));
|
|
5636
5765
|
}
|
|
5637
5766
|
else {
|
|
5638
|
-
console.log(
|
|
5767
|
+
console.log(sectionHeading(t.profile.fleetHeading(n(rollup.sources.length), formatUsd(rollup.totalUsd), t.profile.calls(rollup.calls))));
|
|
5639
5768
|
for (const row of rollup.sources) {
|
|
5640
5769
|
const span = row.spanDays === null ? t.profile.fleetNoClock() : t.profile.fleetSpan(row.spanDays.toFixed(1));
|
|
5641
5770
|
console.log(` ${t.profile.fleetRow(row.name, formatUsd(row.usd), pct(row.share), t.profile.calls(row.calls), span)}`);
|
|
@@ -5702,7 +5831,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
5702
5831
|
}
|
|
5703
5832
|
const cov = report.fieldCoverage;
|
|
5704
5833
|
const parsed = cov.parsed;
|
|
5705
|
-
console.log(
|
|
5834
|
+
console.log(sectionHeading(t.profile.dryRunHeading()));
|
|
5706
5835
|
console.log(` ${wrap(t.profile.dryRunParsed(n(parsed), n(report.skippedLines.length)), 74, ' ')}`);
|
|
5707
5836
|
if (report.unpricedModels.length > 0) {
|
|
5708
5837
|
console.log(` ${c.yellow('!')} ${wrap(t.profile.dryRunUnpriced(report.unpricedModels.join(', ')), 74, ' ')}`);
|
|
@@ -6418,7 +6547,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
6418
6547
|
[t.profile.partOutput(), report.total.outputUsd, shares.output, report.total.outputTokens],
|
|
6419
6548
|
];
|
|
6420
6549
|
console.log();
|
|
6421
|
-
console.log(
|
|
6550
|
+
console.log(sectionHeading(t.profile.heading()));
|
|
6422
6551
|
console.log(` ${t.profile.spent(t.profile.calls(report.total.calls), formatUsd(report.total.totalUsd))}`);
|
|
6423
6552
|
/**
|
|
6424
6553
|
* The period, when the log carries a clock — stated, never extrapolated. A
|
|
@@ -6473,7 +6602,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
6473
6602
|
// Every part, including the zero ones. A row missing because it was zero reads
|
|
6474
6603
|
// as a row somebody forgot, and "you are not caching at all" is a finding.
|
|
6475
6604
|
for (const [name, usd, share, tokens] of parts) {
|
|
6476
|
-
console.log(` ${
|
|
6605
|
+
console.log(` ${bar(share)} ${t.profile.part(name, formatUsd(usd), pct(share), n(tokens))}`);
|
|
6477
6606
|
}
|
|
6478
6607
|
/**
|
|
6479
6608
|
* The line the command exists for: which part of the bill to argue with.
|
|
@@ -6878,7 +7007,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
6878
7007
|
*/
|
|
6879
7008
|
const levers = billLevers(report, { catalogue: pricing });
|
|
6880
7009
|
console.log();
|
|
6881
|
-
console.log(
|
|
7010
|
+
console.log(sectionHeading(t.profile.leversHeading()));
|
|
6882
7011
|
/**
|
|
6883
7012
|
* Every lever below describes a mixture when nothing carries a label.
|
|
6884
7013
|
*
|
|
@@ -6941,7 +7070,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
6941
7070
|
*/
|
|
6942
7071
|
if (whatIf !== null) {
|
|
6943
7072
|
console.log();
|
|
6944
|
-
console.log(
|
|
7073
|
+
console.log(sectionHeading(t.profile.whatIfHeading(whatIf.target.displayName)));
|
|
6945
7074
|
console.log(` ${c.dim(wrap(t.profile.whatIfAssumption(), 74, ' '))}`);
|
|
6946
7075
|
console.log();
|
|
6947
7076
|
if (whatIf.slices.length === 0) {
|
|
@@ -7010,7 +7139,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7010
7139
|
*/
|
|
7011
7140
|
if (report.conversations.length > 0) {
|
|
7012
7141
|
console.log();
|
|
7013
|
-
console.log(
|
|
7142
|
+
console.log(sectionHeading(t.profile.historyHeading()));
|
|
7014
7143
|
for (const growth of report.conversations.slice(0, 3)) {
|
|
7015
7144
|
const label = growth.label === UNLABELLED ? t.profile.unlabelled() : growth.label;
|
|
7016
7145
|
console.log();
|
|
@@ -7025,7 +7154,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7025
7154
|
* on the line most likely to be the biggest.
|
|
7026
7155
|
*/
|
|
7027
7156
|
console.log();
|
|
7028
|
-
console.log(
|
|
7157
|
+
console.log(sectionHeading(t.profile.historyHeading()));
|
|
7029
7158
|
console.log(` ${c.dim(wrap(t.profile.historyNoSessions(), 74, ' '))}`);
|
|
7030
7159
|
}
|
|
7031
7160
|
/**
|
|
@@ -7042,7 +7171,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7042
7171
|
*/
|
|
7043
7172
|
if (report.outputShapes.length > 0) {
|
|
7044
7173
|
console.log();
|
|
7045
|
-
console.log(
|
|
7174
|
+
console.log(sectionHeading(t.profile.outputShapeHeading()));
|
|
7046
7175
|
for (const shape of report.outputShapes.slice(0, 3)) {
|
|
7047
7176
|
const label = shape.label === UNLABELLED ? t.profile.unlabelled() : shape.label;
|
|
7048
7177
|
const isTail = shape.heavyCallShare < 0.25;
|
|
@@ -7082,7 +7211,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7082
7211
|
*/
|
|
7083
7212
|
if (report.inputShapes.length > 0) {
|
|
7084
7213
|
console.log();
|
|
7085
|
-
console.log(
|
|
7214
|
+
console.log(sectionHeading(t.profile.inputShapeHeading()));
|
|
7086
7215
|
for (const shape of report.inputShapes.slice(0, 3)) {
|
|
7087
7216
|
const label = shape.label === UNLABELLED ? t.profile.unlabelled() : shape.label;
|
|
7088
7217
|
console.log();
|
|
@@ -7129,7 +7258,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7129
7258
|
{
|
|
7130
7259
|
if (pressures.length > 0) {
|
|
7131
7260
|
console.log();
|
|
7132
|
-
console.log(
|
|
7261
|
+
console.log(sectionHeading(t.profile.pressureHeading()));
|
|
7133
7262
|
for (const row of pressures.slice(0, 3)) {
|
|
7134
7263
|
const label = row.label === UNLABELLED ? t.profile.unlabelled() : row.label;
|
|
7135
7264
|
const line = t.profile.pressureLine(label, row.modelName, n(row.maxCallInputTokens), n(row.contextWindow), pct(row.share));
|
|
@@ -7153,7 +7282,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7153
7282
|
const moved = report.modelMixDrift.models.filter((m) => Math.abs(m.lastShare - m.firstShare) >= 0.15);
|
|
7154
7283
|
if (moved.length > 0) {
|
|
7155
7284
|
console.log();
|
|
7156
|
-
console.log(
|
|
7285
|
+
console.log(sectionHeading(t.profile.mixDriftHeading()));
|
|
7157
7286
|
for (const m of moved.slice(0, 3)) {
|
|
7158
7287
|
console.log();
|
|
7159
7288
|
console.log(` ${c.yellow('!')} ${c.bold(wrap(t.profile.mixDriftLine(m.model, pct(m.firstShare), pct(m.lastShare), n(report.modelMixDrift.firstDays), n(report.modelMixDrift.lastDays), formatUsd(m.lastUsd)), 74, ' '))}`);
|
|
@@ -7173,7 +7302,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7173
7302
|
*/
|
|
7174
7303
|
if (report.repeatedTurns.length > 0) {
|
|
7175
7304
|
console.log();
|
|
7176
|
-
console.log(
|
|
7305
|
+
console.log(sectionHeading(t.profile.repeatsHeading()));
|
|
7177
7306
|
for (const row of report.repeatedTurns.slice(0, 3)) {
|
|
7178
7307
|
const label = row.label === UNLABELLED ? t.profile.unlabelled() : row.label;
|
|
7179
7308
|
console.log();
|
|
@@ -7256,7 +7385,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7256
7385
|
*/
|
|
7257
7386
|
if (previous !== null) {
|
|
7258
7387
|
console.log();
|
|
7259
|
-
console.log(
|
|
7388
|
+
console.log(sectionHeading(t.profile.againstHeading()));
|
|
7260
7389
|
if (previous.total.calls === 0) {
|
|
7261
7390
|
console.log(` ${c.dim(wrap(t.profile.againstNothingPriced(), 74, ' '))}`);
|
|
7262
7391
|
}
|
|
@@ -7349,10 +7478,10 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7349
7478
|
if (rows.length <= 1)
|
|
7350
7479
|
continue; // One row is the total again, said twice.
|
|
7351
7480
|
console.log();
|
|
7352
|
-
console.log(
|
|
7481
|
+
console.log(sectionHeading(heading));
|
|
7353
7482
|
for (const [name, breakdown] of rows) {
|
|
7354
7483
|
const share = report.total.totalUsd > 0 ? breakdown.totalUsd / report.total.totalUsd : 0;
|
|
7355
|
-
console.log(` ${t.profile.row(name, formatUsd(breakdown.totalUsd), pct(share), t.profile.calls(breakdown.calls))}`);
|
|
7484
|
+
console.log(` ${bar(share)} ${t.profile.row(name, formatUsd(breakdown.totalUsd), pct(share), t.profile.calls(breakdown.calls))}`);
|
|
7356
7485
|
}
|
|
7357
7486
|
}
|
|
7358
7487
|
/**
|
|
@@ -7384,7 +7513,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7384
7513
|
const outcomes = outcomeReport(report.outcomeTally, config.outcomes ?? null);
|
|
7385
7514
|
if (outcomes.coverage.recorded > 0) {
|
|
7386
7515
|
console.log();
|
|
7387
|
-
console.log(
|
|
7516
|
+
console.log(sectionHeading(t.profile.outcomeHeading()));
|
|
7388
7517
|
const col = t.profile.outcomeColumns;
|
|
7389
7518
|
const rows = [...outcomes.slices, ...outcomes.undeclared].map((slice) => ({
|
|
7390
7519
|
value: slice.value,
|
|
@@ -7441,7 +7570,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7441
7570
|
})), config.outcomes ?? null);
|
|
7442
7571
|
if (ranking.byCall.length > 0) {
|
|
7443
7572
|
console.log();
|
|
7444
|
-
console.log(
|
|
7573
|
+
console.log(sectionHeading(t.profile.perOutcomeHeading()));
|
|
7445
7574
|
const pcol = t.profile.perOutcomeColumns;
|
|
7446
7575
|
const prows = ranking.byCall.map((slice) => ({
|
|
7447
7576
|
key: slice.key,
|
|
@@ -7508,7 +7637,7 @@ async function commandProfile(args, config, configDir, pricing, t) {
|
|
|
7508
7637
|
}
|
|
7509
7638
|
if (missing.length > 0) {
|
|
7510
7639
|
console.log();
|
|
7511
|
-
console.log(
|
|
7640
|
+
console.log(sectionHeading(t.profile.coverageHeading()));
|
|
7512
7641
|
for (const line of missing)
|
|
7513
7642
|
console.log(` ${c.dim(wrap(line, 74, ' '))}`);
|
|
7514
7643
|
}
|
|
@@ -7987,7 +8116,7 @@ async function checkDirectory(root, args, flagBudget, config, counter, level, t,
|
|
|
7987
8116
|
const tokenWidth = Math.max(...verdicts.map((v) => n(v.tokens).length));
|
|
7988
8117
|
const budgetWidth = Math.max(0, ...verdicts.map((v) => (v.maxTokens === null ? 0 : n(v.maxTokens).length)));
|
|
7989
8118
|
console.log();
|
|
7990
|
-
console.log(
|
|
8119
|
+
console.log(sectionHeading(t.check.directoryHeading(root, verdicts.length)));
|
|
7991
8120
|
console.log();
|
|
7992
8121
|
for (const verdict of verdicts) {
|
|
7993
8122
|
const tokens = n(verdict.tokens).padStart(tokenWidth);
|
|
@@ -8109,7 +8238,7 @@ async function commandPrune(args, t) {
|
|
|
8109
8238
|
}
|
|
8110
8239
|
const pct = (value) => `${(value * 100).toFixed(0)}%`;
|
|
8111
8240
|
console.log();
|
|
8112
|
-
console.log(
|
|
8241
|
+
console.log(sectionHeading(t.prune.heading(provider.model)));
|
|
8113
8242
|
console.log(` ${c.dim(t.prune.selfAgreement(pct(report.selfAgreement)))}`);
|
|
8114
8243
|
console.log();
|
|
8115
8244
|
for (const contribution of report.contributions) {
|
|
@@ -8184,7 +8313,7 @@ async function commandEval(args, config, t, locale) {
|
|
|
8184
8313
|
}
|
|
8185
8314
|
const pct = (value) => `${(value * 100).toFixed(0)}%`;
|
|
8186
8315
|
console.log();
|
|
8187
|
-
console.log(
|
|
8316
|
+
console.log(sectionHeading(t.eval.heading()));
|
|
8188
8317
|
console.log(` ${t.eval.selfAgreement(pct(report.selfAgreement))}`);
|
|
8189
8318
|
console.log(` ${t.eval.crossAgreement(pct(report.crossAgreement))}`);
|
|
8190
8319
|
console.log();
|
|
@@ -8340,7 +8469,7 @@ function printComparison(comparison, beforePath, afterPath, optimized, t) {
|
|
|
8340
8469
|
const paint = grew ? c.red : comparison.tokenDelta < 0 ? c.green : c.dim;
|
|
8341
8470
|
const signed = (value) => `${value > 0 ? '+' : ''}${n(value)}`;
|
|
8342
8471
|
console.log();
|
|
8343
|
-
console.log(
|
|
8472
|
+
console.log(sectionHeading(t.diff.heading(beforePath, afterPath)));
|
|
8344
8473
|
if (optimized)
|
|
8345
8474
|
console.log(c.dim(` ${t.diff.measuringOptimised()}`));
|
|
8346
8475
|
console.log();
|
|
@@ -8973,6 +9102,12 @@ async function main() {
|
|
|
8973
9102
|
case 'from-otel':
|
|
8974
9103
|
await commandFromOtel(args, t);
|
|
8975
9104
|
break;
|
|
9105
|
+
case 'switch':
|
|
9106
|
+
await commandSwitch(args, pricing, t);
|
|
9107
|
+
break;
|
|
9108
|
+
case 'ownrate':
|
|
9109
|
+
commandOwnrate(args, t);
|
|
9110
|
+
break;
|
|
8976
9111
|
case 'pulse':
|
|
8977
9112
|
await commandPulse(args, t);
|
|
8978
9113
|
break;
|