@trazum/cli 1.26.0 → 1.28.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/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +13 -3
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +13 -3
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/types.d.ts +26 -0
- package/dist/i18n/types.d.ts.map +1 -1
- package/dist/index.js +79 -4
- package/dist/index.js.map +1 -1
- package/dist/markdown.d.ts +7 -1
- package/dist/markdown.d.ts.map +1 -1
- package/dist/markdown.js +52 -1
- package/dist/markdown.js.map +1 -1
- package/package.json +2 -2
- package/src/i18n/en.ts +19 -3
- package/src/i18n/es.ts +19 -3
- package/src/i18n/types.ts +41 -0
- package/src/index.ts +93 -3
- package/src/markdown.ts +69 -2
package/src/markdown.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type {
|
|
|
10
10
|
} from '@trazum/core';
|
|
11
11
|
import { TTL_1H_MS, UNLABELLED, formatSignedUsd, formatUsd, getMessages, getModel, sharesOf } from '@trazum/core';
|
|
12
12
|
import { dayOf, formatGap, median, spanDays } from './time.js';
|
|
13
|
-
import type { AgainstDriver, BillLevers, CacheEconomics, RepriceReport, UsageProfileReport } from '@trazum/core';
|
|
13
|
+
import type { AgainstDriver, BillLevers, CacheEconomics, ContextPressure, RepriceReport, UsageProfileReport } from '@trazum/core';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Markdown for the places a pull request is actually read.
|
|
@@ -750,6 +750,12 @@ export interface ProfileMarkdownInput {
|
|
|
750
750
|
* disagree about what a move would cost, and this is a rendering.
|
|
751
751
|
*/
|
|
752
752
|
whatIf?: RepriceReport | null;
|
|
753
|
+
/**
|
|
754
|
+
* The largest call against each model's window, computed once in the CLI —
|
|
755
|
+
* like `whatIf` — because the ratio's denominator lives in the (possibly
|
|
756
|
+
* overlaid) catalogue and a summary must not re-derive it differently.
|
|
757
|
+
*/
|
|
758
|
+
pressure?: ContextPressure[];
|
|
753
759
|
against?: {
|
|
754
760
|
previousTotalUsd: number;
|
|
755
761
|
previousCalls: number;
|
|
@@ -777,7 +783,7 @@ export interface ProfileMarkdownInput {
|
|
|
777
783
|
* reading CI instead of machines.
|
|
778
784
|
*/
|
|
779
785
|
export function renderProfileMarkdown(input: ProfileMarkdownInput): string {
|
|
780
|
-
const { report, levers, cache, t, window, stalePricing, against, whatIf } = input;
|
|
786
|
+
const { report, levers, cache, t, window, stalePricing, against, whatIf, pressure = [] } = input;
|
|
781
787
|
const n = (value: number): string => value.toLocaleString(t.numberLocale);
|
|
782
788
|
const pct = (share: number): string => `${(share * 100).toFixed(1)}%`;
|
|
783
789
|
const shares = sharesOf(report.total);
|
|
@@ -895,6 +901,67 @@ export function renderProfileMarkdown(input: ProfileMarkdownInput): string {
|
|
|
895
901
|
lines.push(`_${mdText(t.profile.leverPromptCeiling(formatUsd(levers.promptCeilingUsd), pct(levers.promptCeilingShare)))}_`);
|
|
896
902
|
lines.push('');
|
|
897
903
|
|
|
904
|
+
/**
|
|
905
|
+
* The retry bill of truncation — loud in a summary, because the fix (a
|
|
906
|
+
* max_tokens the answers fit in) is a one-line PR of its own.
|
|
907
|
+
*/
|
|
908
|
+
for (const row of report.truncationRetries.slice(0, 3)) {
|
|
909
|
+
lines.push(
|
|
910
|
+
`> ⚠️ ${mdText(t.profile.truncationRetryLine(showLabel(row.label), row.modelName, n(row.retried), n(row.truncatedCalls), n(Math.round(row.withinMs / 1000)), formatUsd(row.wastedUsd), formatUsd(row.retryUsd)))}`,
|
|
911
|
+
);
|
|
912
|
+
lines.push('');
|
|
913
|
+
}
|
|
914
|
+
if (report.truncationRetries.length > 0) {
|
|
915
|
+
lines.push(`_${mdText(t.profile.truncationRetryNote())}_`);
|
|
916
|
+
lines.push('');
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
/**
|
|
920
|
+
* The mix moving inside the log — same fifteen-point threshold as the
|
|
921
|
+
* terminal, because two surfaces disagreeing about "moved" is a second
|
|
922
|
+
* opinion nobody asked for.
|
|
923
|
+
*/
|
|
924
|
+
if (report.modelMixDrift !== null) {
|
|
925
|
+
const moved = report.modelMixDrift.models.filter(
|
|
926
|
+
(m) => Math.abs(m.lastShare - m.firstShare) >= 0.15,
|
|
927
|
+
);
|
|
928
|
+
if (moved.length > 0) {
|
|
929
|
+
lines.push(`#### ${t.profile.mixDriftHeading()}`);
|
|
930
|
+
lines.push('');
|
|
931
|
+
for (const m of moved.slice(0, 3)) {
|
|
932
|
+
lines.push(
|
|
933
|
+
`> ⚠️ ${mdText(t.profile.mixDriftLine(m.model, pct(m.firstShare), pct(m.lastShare), n(report.modelMixDrift.firstDays), n(report.modelMixDrift.lastDays), formatUsd(m.lastUsd)))}`,
|
|
934
|
+
);
|
|
935
|
+
lines.push('');
|
|
936
|
+
}
|
|
937
|
+
lines.push(`_${mdText(t.profile.mixDriftNote())}_`);
|
|
938
|
+
lines.push('');
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
/**
|
|
943
|
+
* The ceiling in sight — loud in a summary from 85%, because the reader of
|
|
944
|
+
* a PR comment is exactly the person who can cap the retrieval today.
|
|
945
|
+
*/
|
|
946
|
+
{
|
|
947
|
+
const pressures = pressure;
|
|
948
|
+
if (pressures.length > 0) {
|
|
949
|
+
lines.push(`#### ${t.profile.pressureHeading()}`);
|
|
950
|
+
lines.push('');
|
|
951
|
+
for (const row of pressures.slice(0, 3)) {
|
|
952
|
+
const sentence = mdText(
|
|
953
|
+
t.profile.pressureLine(showLabel(row.label), row.modelName, n(row.maxCallInputTokens), n(row.contextWindow), pct(row.share)),
|
|
954
|
+
);
|
|
955
|
+
lines.push(row.share >= 0.85 ? `> ⚠️ ${sentence}` : `- ${sentence}`);
|
|
956
|
+
if (row.share >= 0.85) lines.push('');
|
|
957
|
+
}
|
|
958
|
+
if (pressures.some((row) => row.share >= 0.85)) {
|
|
959
|
+
lines.push(`_${mdText(t.profile.pressureAdvice())}_`);
|
|
960
|
+
}
|
|
961
|
+
lines.push('');
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
|
|
898
965
|
/**
|
|
899
966
|
* The same request sent again — money that bought nothing the call before
|
|
900
967
|
* it had not already paid for. Loud in a summary, and hedged in the same
|