tokmon 0.12.0 → 0.12.1
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 +237 -148
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -988,14 +988,12 @@ function App({ interval: cliInterval }) {
|
|
|
988
988
|
resetView();
|
|
989
989
|
return;
|
|
990
990
|
}
|
|
991
|
-
if (input
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
setTab(1);
|
|
998
|
-
resetView();
|
|
991
|
+
if (input && /^[0-9]$/.test(input) && slots.length > 1) {
|
|
992
|
+
const target = slots[parseInt(input, 10)];
|
|
993
|
+
if (target) {
|
|
994
|
+
updateConfig((c) => ({ ...c, activeAccountId: target.id }));
|
|
995
|
+
resetView();
|
|
996
|
+
}
|
|
999
997
|
return;
|
|
1000
998
|
}
|
|
1001
999
|
if (tab === 1) {
|
|
@@ -1165,7 +1163,7 @@ function Footer({ hasAccounts }) {
|
|
|
1165
1163
|
/* @__PURE__ */ jsx(Text, { dimColor: true, children: " (" }),
|
|
1166
1164
|
/* @__PURE__ */ jsx(Text, { color: "cyan", children: "davidilie.com" }),
|
|
1167
1165
|
/* @__PURE__ */ jsx(Text, { dimColor: true, children: ") \xB7 s=settings " }),
|
|
1168
|
-
hasAccounts && /* @__PURE__ */ jsx(Text, { dimColor: true, children: "a/A=cycle
|
|
1166
|
+
hasAccounts && /* @__PURE__ */ jsx(Text, { dimColor: true, children: "0-9=jump a/A=cycle " }),
|
|
1169
1167
|
/* @__PURE__ */ jsx(Text, { dimColor: true, children: "q=quit" })
|
|
1170
1168
|
] });
|
|
1171
1169
|
}
|
|
@@ -1181,28 +1179,17 @@ function TabBar({ tabs, active, onSelect }) {
|
|
|
1181
1179
|
] }) }, t)) });
|
|
1182
1180
|
}
|
|
1183
1181
|
function AccountStrip({ slots, activeIdx, onSelect }) {
|
|
1184
|
-
return /* @__PURE__ */
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
" ",
|
|
1196
|
-
s.name,
|
|
1197
|
-
" "
|
|
1198
|
-
] })
|
|
1199
|
-
] }) : /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
|
|
1200
|
-
dot,
|
|
1201
|
-
" ",
|
|
1202
|
-
s.name
|
|
1203
|
-
] }) }, s.id ?? "__all__");
|
|
1204
|
-
})
|
|
1205
|
-
] });
|
|
1182
|
+
return /* @__PURE__ */ jsx(Box, { flexWrap: "wrap", children: slots.map((s, i) => {
|
|
1183
|
+
const active = i === activeIdx;
|
|
1184
|
+
const dot = s.id === null ? "\u2726" : "\u25CF";
|
|
1185
|
+
return /* @__PURE__ */ jsxs(ClickableBox, { onClick: () => onSelect(i), marginRight: 2, children: [
|
|
1186
|
+
/* @__PURE__ */ jsx(Text, { dimColor: !active, children: i }),
|
|
1187
|
+
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
1188
|
+
/* @__PURE__ */ jsx(Text, { color: s.color, bold: active, dimColor: !active, children: dot }),
|
|
1189
|
+
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
1190
|
+
active ? /* @__PURE__ */ jsx(Text, { bold: true, color: s.color, children: s.name }) : /* @__PURE__ */ jsx(Text, { dimColor: true, children: s.name })
|
|
1191
|
+
] }, s.id ?? "__all__");
|
|
1192
|
+
}) });
|
|
1206
1193
|
}
|
|
1207
1194
|
function ViewBar({ views, active, sort, onSelect }) {
|
|
1208
1195
|
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
@@ -1539,34 +1526,38 @@ function ColorField({ value, focused }) {
|
|
|
1539
1526
|
] });
|
|
1540
1527
|
}
|
|
1541
1528
|
function DashboardView({ slots, stats, compact }) {
|
|
1542
|
-
const slotKey = (
|
|
1543
|
-
|
|
1544
|
-
const
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
/* @__PURE__ */ jsx(
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1529
|
+
const slotKey = (s2) => s2.id ?? "__default__";
|
|
1530
|
+
if (compact) {
|
|
1531
|
+
const accountStats = slots.map((slot2) => ({ slot: slot2, s: stats.get(slotKey(slot2)) })).filter((x) => !!x.s?.dashboard);
|
|
1532
|
+
return /* @__PURE__ */ jsx(ComparisonView, { accountStats });
|
|
1533
|
+
}
|
|
1534
|
+
const slot = slots[0];
|
|
1535
|
+
const s = stats.get(slotKey(slot));
|
|
1536
|
+
if (!s?.dashboard) {
|
|
1537
|
+
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
1538
|
+
/* @__PURE__ */ jsxs(Text, { color: slot.color, bold: true, children: [
|
|
1539
|
+
"\u25CF ",
|
|
1540
|
+
slot.name,
|
|
1541
|
+
" "
|
|
1542
|
+
] }),
|
|
1543
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: "loading..." })
|
|
1544
|
+
] });
|
|
1545
|
+
}
|
|
1546
|
+
return /* @__PURE__ */ jsx(SoloAccountCard, { slot, dashboard: s.dashboard, billing: s.billing });
|
|
1547
|
+
}
|
|
1548
|
+
function bar(value, max, width) {
|
|
1549
|
+
if (max <= 0) return { filled: 0, empty: width };
|
|
1550
|
+
const filled = Math.max(0, Math.min(width, Math.round(value / max * width)));
|
|
1551
|
+
return { filled, empty: width - filled };
|
|
1552
|
+
}
|
|
1553
|
+
function SoloAccountCard({ slot, dashboard, billing }) {
|
|
1554
|
+
const maxCost = Math.max(dashboard.today.cost, dashboard.week.cost, dashboard.month.cost, 0.01);
|
|
1555
|
+
const maxTokens = Math.max(dashboard.today.tokens, dashboard.week.tokens, dashboard.month.tokens, 1);
|
|
1556
|
+
const rows = [
|
|
1557
|
+
{ label: "Today", s: dashboard.today },
|
|
1558
|
+
{ label: "This Week", s: dashboard.week },
|
|
1559
|
+
{ label: "This Month", s: dashboard.month }
|
|
1560
|
+
];
|
|
1570
1561
|
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
|
|
1571
1562
|
/* @__PURE__ */ jsxs(Box, { children: [
|
|
1572
1563
|
/* @__PURE__ */ jsxs(Text, { color: slot.color, bold: true, children: [
|
|
@@ -1574,81 +1565,199 @@ function AccountCard({ slot, dashboard, billing, compact }) {
|
|
|
1574
1565
|
slot.name
|
|
1575
1566
|
] }),
|
|
1576
1567
|
slot.id && /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
|
|
1577
|
-
"
|
|
1568
|
+
" ",
|
|
1578
1569
|
slot.id
|
|
1579
1570
|
] })
|
|
1580
1571
|
] }),
|
|
1581
|
-
/* @__PURE__ */ jsxs(
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
children:
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
/* @__PURE__ */ jsx(
|
|
1598
|
-
/* @__PURE__ */
|
|
1599
|
-
|
|
1600
|
-
/* @__PURE__ */ jsx(Box, {
|
|
1601
|
-
/* @__PURE__ */ jsxs(Box, { children: [
|
|
1602
|
-
/* @__PURE__ */ jsx(Box, { width: 14, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Burn rate" }) }),
|
|
1603
|
-
/* @__PURE__ */ jsx(Box, { width: 12, justifyContent: "flex-end", children: /* @__PURE__ */ jsx(Text, { color: "red", children: currency(dashboard.burnRate) }) }),
|
|
1604
|
-
/* @__PURE__ */ jsx(Text, { dimColor: true, children: "/hr" })
|
|
1605
|
-
] })
|
|
1606
|
-
] }),
|
|
1607
|
-
dashboard.burnRate > 0 && compact && /* @__PURE__ */ jsxs(Box, { children: [
|
|
1608
|
-
/* @__PURE__ */ jsx(Box, { width: 10, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Burn" }) }),
|
|
1609
|
-
/* @__PURE__ */ jsx(Text, { color: "red", children: currency(dashboard.burnRate) }),
|
|
1572
|
+
/* @__PURE__ */ jsxs(
|
|
1573
|
+
Box,
|
|
1574
|
+
{
|
|
1575
|
+
flexDirection: "column",
|
|
1576
|
+
marginTop: 1,
|
|
1577
|
+
paddingLeft: 1,
|
|
1578
|
+
borderStyle: "bold",
|
|
1579
|
+
borderColor: slot.color,
|
|
1580
|
+
borderRight: false,
|
|
1581
|
+
borderTop: false,
|
|
1582
|
+
borderBottom: false,
|
|
1583
|
+
children: [
|
|
1584
|
+
/* @__PURE__ */ jsx(Text, { bold: true, children: "Usage" }),
|
|
1585
|
+
/* @__PURE__ */ jsx(Box, { height: 1 }),
|
|
1586
|
+
rows.map((r) => /* @__PURE__ */ jsx(DualBarRow, { label: r.label, cost: r.s.cost, tokens: r.s.tokens, maxCost, maxTokens, color: slot.color }, r.label)),
|
|
1587
|
+
dashboard.burnRate > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1588
|
+
/* @__PURE__ */ jsx(Box, { height: 1 }),
|
|
1589
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
1590
|
+
/* @__PURE__ */ jsx(Box, { width: 14, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Burn rate" }) }),
|
|
1591
|
+
/* @__PURE__ */ jsx(Box, { width: 12, justifyContent: "flex-end", children: /* @__PURE__ */ jsx(Text, { color: "red", children: currency(dashboard.burnRate) }) }),
|
|
1610
1592
|
/* @__PURE__ */ jsx(Text, { dimColor: true, children: "/hr" })
|
|
1611
1593
|
] })
|
|
1612
|
-
]
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1594
|
+
] })
|
|
1595
|
+
]
|
|
1596
|
+
}
|
|
1597
|
+
),
|
|
1598
|
+
/* @__PURE__ */ jsx(Box, { height: 1 }),
|
|
1599
|
+
/* @__PURE__ */ jsxs(
|
|
1600
|
+
Box,
|
|
1601
|
+
{
|
|
1602
|
+
flexDirection: "column",
|
|
1603
|
+
paddingLeft: 1,
|
|
1604
|
+
borderStyle: "bold",
|
|
1605
|
+
borderColor: billing?.error ? "red" : "yellow",
|
|
1606
|
+
borderRight: false,
|
|
1607
|
+
borderTop: false,
|
|
1608
|
+
borderBottom: false,
|
|
1609
|
+
children: [
|
|
1610
|
+
/* @__PURE__ */ jsx(Text, { bold: true, children: "Rate Limits" }),
|
|
1611
|
+
/* @__PURE__ */ jsx(Box, { height: 1 }),
|
|
1612
|
+
billing?.error ? /* @__PURE__ */ jsx(Text, { color: "red", children: billing.error }) : billing?.session || billing?.weekly ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1613
|
+
billing.session && /* @__PURE__ */ jsx(LimitBar, { label: "Session", pct: billing.session.utilization, resets: billing.session.resetsAt }),
|
|
1614
|
+
billing.weekly && /* @__PURE__ */ jsx(LimitBar, { label: "Weekly", pct: billing.weekly.utilization, resets: billing.weekly.resetsAt }),
|
|
1615
|
+
billing.sonnet && /* @__PURE__ */ jsx(LimitBar, { label: "Sonnet", pct: billing.sonnet.utilization, resets: billing.sonnet.resetsAt }),
|
|
1616
|
+
billing.extraUsage && /* @__PURE__ */ jsxs(Box, { children: [
|
|
1617
|
+
/* @__PURE__ */ jsx(Box, { width: 10, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Extra" }) }),
|
|
1618
|
+
/* @__PURE__ */ jsxs(Text, { color: "yellow", children: [
|
|
1619
|
+
"$",
|
|
1620
|
+
billing.extraUsage.used.toFixed(2)
|
|
1621
|
+
] }),
|
|
1622
|
+
/* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
|
|
1623
|
+
" / $",
|
|
1624
|
+
billing.extraUsage.limit.toFixed(2),
|
|
1625
|
+
" limit"
|
|
1644
1626
|
] })
|
|
1645
|
-
] })
|
|
1646
|
-
]
|
|
1647
|
-
|
|
1648
|
-
|
|
1627
|
+
] })
|
|
1628
|
+
] }) : /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Fetching..." })
|
|
1629
|
+
]
|
|
1630
|
+
}
|
|
1631
|
+
)
|
|
1632
|
+
] });
|
|
1633
|
+
}
|
|
1634
|
+
function DualBarRow({
|
|
1635
|
+
label,
|
|
1636
|
+
cost,
|
|
1637
|
+
tokens: tokens2,
|
|
1638
|
+
maxCost,
|
|
1639
|
+
maxTokens,
|
|
1640
|
+
color
|
|
1641
|
+
}) {
|
|
1642
|
+
const W = 18;
|
|
1643
|
+
const c = bar(cost, maxCost, W);
|
|
1644
|
+
const t = bar(tokens2, maxTokens, W);
|
|
1645
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 0, children: [
|
|
1646
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
1647
|
+
/* @__PURE__ */ jsx(Box, { width: 12, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: label }) }),
|
|
1648
|
+
/* @__PURE__ */ jsx(Text, { color, children: "\u2588".repeat(c.filled) }),
|
|
1649
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2591".repeat(c.empty) }),
|
|
1650
|
+
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
1651
|
+
/* @__PURE__ */ jsx(Box, { width: 11, justifyContent: "flex-end", children: /* @__PURE__ */ jsx(Text, { bold: true, color: "yellow", children: currency(cost) }) })
|
|
1652
|
+
] }),
|
|
1653
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
1654
|
+
/* @__PURE__ */ jsx(Box, { width: 12, children: /* @__PURE__ */ jsx(Text, { children: " " }) }),
|
|
1655
|
+
/* @__PURE__ */ jsx(Text, { color, dimColor: true, children: "\u2593".repeat(t.filled) }),
|
|
1656
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2591".repeat(t.empty) }),
|
|
1657
|
+
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
1658
|
+
/* @__PURE__ */ jsx(Box, { width: 11, justifyContent: "flex-end", children: /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
|
|
1659
|
+
tokens(tokens2),
|
|
1660
|
+
" tk"
|
|
1661
|
+
] }) })
|
|
1662
|
+
] })
|
|
1663
|
+
] });
|
|
1664
|
+
}
|
|
1665
|
+
function ComparisonView({ accountStats }) {
|
|
1666
|
+
if (accountStats.length === 0) {
|
|
1667
|
+
return /* @__PURE__ */ jsx(Text, { dimColor: true, children: "No accounts loaded yet..." });
|
|
1668
|
+
}
|
|
1669
|
+
const periods = [
|
|
1670
|
+
{ key: "Today", pick: (d) => d.today },
|
|
1671
|
+
{ key: "This Week", pick: (d) => d.week },
|
|
1672
|
+
{ key: "This Month", pick: (d) => d.month }
|
|
1673
|
+
];
|
|
1674
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
|
|
1675
|
+
periods.map((p, i) => {
|
|
1676
|
+
const rows = accountStats.map(({ slot, s }) => ({
|
|
1677
|
+
slot,
|
|
1678
|
+
summary: p.pick(s.dashboard)
|
|
1679
|
+
}));
|
|
1680
|
+
const maxCost = Math.max(0.01, ...rows.map((r) => r.summary.cost));
|
|
1681
|
+
const maxTokens = Math.max(1, ...rows.map((r) => r.summary.tokens));
|
|
1682
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: i < periods.length - 1 ? 1 : 0, children: [
|
|
1683
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { bold: true, dimColor: true, children: p.key.toUpperCase() }) }),
|
|
1684
|
+
rows.map(({ slot, summary }) => /* @__PURE__ */ jsx(
|
|
1685
|
+
ComparisonRow,
|
|
1686
|
+
{
|
|
1687
|
+
slot,
|
|
1688
|
+
cost: summary.cost,
|
|
1689
|
+
tokens: summary.tokens,
|
|
1690
|
+
maxCost,
|
|
1691
|
+
maxTokens
|
|
1692
|
+
},
|
|
1693
|
+
slot.id ?? "__default__"
|
|
1694
|
+
))
|
|
1695
|
+
] }, p.key);
|
|
1696
|
+
}),
|
|
1697
|
+
/* @__PURE__ */ jsx(Box, { height: 1 }),
|
|
1698
|
+
/* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
|
|
1699
|
+
/* @__PURE__ */ jsx(Text, { bold: true, dimColor: true, children: "RATE LIMITS" }),
|
|
1700
|
+
accountStats.map(({ slot, s }) => /* @__PURE__ */ jsx(CompactLimitsRow, { slot, billing: s.billing }, slot.id ?? "__default__"))
|
|
1649
1701
|
] })
|
|
1650
1702
|
] });
|
|
1651
1703
|
}
|
|
1704
|
+
function ComparisonRow({
|
|
1705
|
+
slot,
|
|
1706
|
+
cost,
|
|
1707
|
+
tokens: tokens2,
|
|
1708
|
+
maxCost,
|
|
1709
|
+
maxTokens
|
|
1710
|
+
}) {
|
|
1711
|
+
const W = 22;
|
|
1712
|
+
const c = bar(cost, maxCost, W);
|
|
1713
|
+
const t = bar(tokens2, maxTokens, W);
|
|
1714
|
+
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
1715
|
+
/* @__PURE__ */ jsxs(Box, { width: 14, children: [
|
|
1716
|
+
/* @__PURE__ */ jsx(Text, { color: slot.color, children: "\u25CF " }),
|
|
1717
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: slot.name })
|
|
1718
|
+
] }),
|
|
1719
|
+
/* @__PURE__ */ jsx(Text, { color: slot.color, children: "\u2588".repeat(c.filled) }),
|
|
1720
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2591".repeat(c.empty) }),
|
|
1721
|
+
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
1722
|
+
/* @__PURE__ */ jsx(Box, { width: 10, justifyContent: "flex-end", children: /* @__PURE__ */ jsx(Text, { bold: true, color: "yellow", children: currency(cost) }) }),
|
|
1723
|
+
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
1724
|
+
/* @__PURE__ */ jsx(Text, { color: slot.color, dimColor: true, children: "\u2593".repeat(t.filled) }),
|
|
1725
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2591".repeat(t.empty) }),
|
|
1726
|
+
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
1727
|
+
/* @__PURE__ */ jsx(Box, { width: 10, justifyContent: "flex-end", children: /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
|
|
1728
|
+
tokens(tokens2),
|
|
1729
|
+
" tk"
|
|
1730
|
+
] }) })
|
|
1731
|
+
] });
|
|
1732
|
+
}
|
|
1733
|
+
function CompactLimitsRow({ slot, billing }) {
|
|
1734
|
+
if (billing?.error) {
|
|
1735
|
+
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
1736
|
+
/* @__PURE__ */ jsxs(Box, { width: 14, children: [
|
|
1737
|
+
/* @__PURE__ */ jsx(Text, { color: slot.color, children: "\u25CF " }),
|
|
1738
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: slot.name })
|
|
1739
|
+
] }),
|
|
1740
|
+
/* @__PURE__ */ jsx(Text, { color: "red", children: billing.error })
|
|
1741
|
+
] });
|
|
1742
|
+
}
|
|
1743
|
+
const fmtPct = (p) => p ? `${Math.round(p.utilization)}%` : "\u2014";
|
|
1744
|
+
const colorFor = (p) => {
|
|
1745
|
+
if (!p) return void 0;
|
|
1746
|
+
return p.utilization >= 80 ? "red" : p.utilization >= 50 ? "yellow" : "green";
|
|
1747
|
+
};
|
|
1748
|
+
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
1749
|
+
/* @__PURE__ */ jsxs(Box, { width: 14, children: [
|
|
1750
|
+
/* @__PURE__ */ jsx(Text, { color: slot.color, children: "\u25CF " }),
|
|
1751
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: slot.name })
|
|
1752
|
+
] }),
|
|
1753
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: "S " }),
|
|
1754
|
+
/* @__PURE__ */ jsx(Box, { width: 6, children: /* @__PURE__ */ jsx(Text, { bold: true, color: colorFor(billing?.session), children: fmtPct(billing?.session) }) }),
|
|
1755
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: "W " }),
|
|
1756
|
+
/* @__PURE__ */ jsx(Box, { width: 6, children: /* @__PURE__ */ jsx(Text, { bold: true, color: colorFor(billing?.weekly), children: fmtPct(billing?.weekly) }) }),
|
|
1757
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: "Sonnet " }),
|
|
1758
|
+
/* @__PURE__ */ jsx(Box, { width: 6, children: /* @__PURE__ */ jsx(Text, { bold: true, color: colorFor(billing?.sonnet), children: fmtPct(billing?.sonnet) }) })
|
|
1759
|
+
] });
|
|
1760
|
+
}
|
|
1652
1761
|
function PeakBadge({ peak }) {
|
|
1653
1762
|
const color = peak.state === "peak" ? "red" : "green";
|
|
1654
1763
|
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
@@ -1667,8 +1776,8 @@ function fmtMinutes(mins) {
|
|
|
1667
1776
|
const m = mins % 60;
|
|
1668
1777
|
return m === 0 ? `${h}h` : `${h}h ${m}m`;
|
|
1669
1778
|
}
|
|
1670
|
-
function LimitBar({ label, pct, resets
|
|
1671
|
-
const width =
|
|
1779
|
+
function LimitBar({ label, pct, resets }) {
|
|
1780
|
+
const width = 30;
|
|
1672
1781
|
const filled = Math.round(pct / 100 * width);
|
|
1673
1782
|
const color = pct >= 80 ? "red" : pct >= 50 ? "yellow" : "green";
|
|
1674
1783
|
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
@@ -1680,32 +1789,12 @@ function LimitBar({ label, pct, resets, compact }) {
|
|
|
1680
1789
|
Math.round(pct),
|
|
1681
1790
|
"%"
|
|
1682
1791
|
] }),
|
|
1683
|
-
|
|
1792
|
+
/* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
|
|
1684
1793
|
" resets ",
|
|
1685
1794
|
resets
|
|
1686
1795
|
] })
|
|
1687
1796
|
] });
|
|
1688
1797
|
}
|
|
1689
|
-
function SummaryRow({ label, summary, compact }) {
|
|
1690
|
-
if (compact) {
|
|
1691
|
-
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
1692
|
-
/* @__PURE__ */ jsx(Box, { width: 10, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: label }) }),
|
|
1693
|
-
/* @__PURE__ */ jsx(Box, { width: 10, justifyContent: "flex-end", children: /* @__PURE__ */ jsx(Text, { bold: true, color: "yellow", children: currency(summary.cost) }) }),
|
|
1694
|
-
/* @__PURE__ */ jsx(Box, { width: 14, justifyContent: "flex-end", children: /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
|
|
1695
|
-
tokens(summary.tokens),
|
|
1696
|
-
" tk"
|
|
1697
|
-
] }) })
|
|
1698
|
-
] });
|
|
1699
|
-
}
|
|
1700
|
-
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
1701
|
-
/* @__PURE__ */ jsx(Box, { width: 14, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: label }) }),
|
|
1702
|
-
/* @__PURE__ */ jsx(Box, { width: 12, justifyContent: "flex-end", children: /* @__PURE__ */ jsx(Text, { bold: true, color: "yellow", children: currency(summary.cost) }) }),
|
|
1703
|
-
/* @__PURE__ */ jsx(Box, { width: 18, justifyContent: "flex-end", children: /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
|
|
1704
|
-
tokens(summary.tokens),
|
|
1705
|
-
" tokens"
|
|
1706
|
-
] }) })
|
|
1707
|
-
] });
|
|
1708
|
-
}
|
|
1709
1798
|
function TableView({ rows: allRows, cursor, expanded, maxRows, cols, onRowClick }) {
|
|
1710
1799
|
const wide = cols > 90;
|
|
1711
1800
|
const base = wide ? { label: 12, input: 10, output: 10, cc: 14, cr: 12, total: 11, cost: 13 } : { label: 8, input: 7, output: 7, cc: 7, cr: 8, total: 0, cost: 11 };
|