tokmon 0.11.0 → 0.11.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/dist/cli.js +11 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -482,6 +482,9 @@ function formatReset(iso) {
|
|
|
482
482
|
|
|
483
483
|
// src/format.ts
|
|
484
484
|
function currency(value) {
|
|
485
|
+
if (value >= 1e4) {
|
|
486
|
+
return `$${value.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
487
|
+
}
|
|
485
488
|
return `$${value.toFixed(2)}`;
|
|
486
489
|
}
|
|
487
490
|
function tokens(value) {
|
|
@@ -841,7 +844,7 @@ function App({ interval: cliInterval }) {
|
|
|
841
844
|
cursor,
|
|
842
845
|
expanded,
|
|
843
846
|
maxRows: rows - 12,
|
|
844
|
-
|
|
847
|
+
cols,
|
|
845
848
|
onRowClick: (idx) => {
|
|
846
849
|
if (idx === cursor) setExpanded((e) => e === idx ? -1 : idx);
|
|
847
850
|
else setCursor(idx);
|
|
@@ -1087,8 +1090,13 @@ function SummaryRow({ label, summary }) {
|
|
|
1087
1090
|
] }) })
|
|
1088
1091
|
] });
|
|
1089
1092
|
}
|
|
1090
|
-
function TableView({ rows: allRows, cursor, expanded, maxRows,
|
|
1091
|
-
const
|
|
1093
|
+
function TableView({ rows: allRows, cursor, expanded, maxRows, cols, onRowClick }) {
|
|
1094
|
+
const wide = cols > 90;
|
|
1095
|
+
const base = wide ? { label: 12, input: 10, output: 10, cc: 10, cr: 11, total: 11, cost: 13 } : { label: 8, input: 7, output: 7, cc: 7, cr: 8, total: 0, cost: 11 };
|
|
1096
|
+
const fixed = base.label + base.input + base.output + base.cc + base.cr + base.total + base.cost;
|
|
1097
|
+
const minModels = wide ? 22 : 14;
|
|
1098
|
+
const available = cols - fixed - 6;
|
|
1099
|
+
const W = { ...base, models: Math.max(minModels, available) };
|
|
1092
1100
|
const lineW = W.label + W.models + W.input + W.output + W.cc + W.cr + W.total + W.cost;
|
|
1093
1101
|
const totals = { input: 0, output: 0, cacheCreate: 0, cacheRead: 0, cost: 0 };
|
|
1094
1102
|
for (const r of allRows) {
|