@mauricode/token-derby 2.12.3 → 2.12.4

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 CHANGED
@@ -11,7 +11,7 @@ Token Derby runs on the **real** output tokens your Claude Code produces — tha
11
11
  ## Install
12
12
 
13
13
  ```bash
14
- npm i -g @mauricode/token-derby
14
+ npm i -g @mauricode/token-derby@latest
15
15
  ```
16
16
 
17
17
  Requires Node 20+.
package/dist/bin.js CHANGED
@@ -788,8 +788,8 @@ var HEARTBEAT_RETRY_DELAYS_MS = [1e3, 2e3, 4e3, 8e3, 15e3];
788
788
  // src/version.ts
789
789
  import { createRequire } from "module";
790
790
  function readVersion() {
791
- if ("2.12.3".length > 0) {
792
- return "2.12.3";
791
+ if ("2.12.4".length > 0) {
792
+ return "2.12.4";
793
793
  }
794
794
  try {
795
795
  const req = createRequire(import.meta.url);
@@ -1415,7 +1415,7 @@ import { Box as Box8, Text as Text8, useApp } from "ink";
1415
1415
 
1416
1416
  // src/ui/StatusScreen.tsx
1417
1417
  import { Box as Box7, Text as Text7 } from "ink";
1418
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1418
+ import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1419
1419
  var MODEL_LABELS = { claude: "Claude", codex: "Codex", gemini: "Gemini" };
1420
1420
  function ModelList(props) {
1421
1421
  const { primaryModel } = props;
@@ -1439,6 +1439,30 @@ function StatusScreen(props) {
1439
1439
  const elapsedPct = elapsed(race);
1440
1440
  const timeLeft = formatDuration(race.time_left_seconds);
1441
1441
  const lvl = levelInfo((own?.xp ?? 0) + (own?.live_xp ?? 0));
1442
+ const divisionField = own?.division === void 0 ? [] : race.horses.filter((h) => h.division === own.division);
1443
+ const divisionRank = own ? divisionField.indexOf(own) + 1 : 0;
1444
+ const showDivision = (race.league_division_names?.length ?? 0) > 0 && divisionRank > 0;
1445
+ const rows = [
1446
+ { label: "Tokens (race):", value: String(own?.current_tokens ?? 0) },
1447
+ { label: "Position:", value: `${own?.rank ?? "\u2014"} of ${race.horses.length}` },
1448
+ ...showDivision ? [{ label: "Position (Division):", value: `${divisionRank} of ${divisionField.length}` }] : [],
1449
+ { label: "Leader:", value: leaderText(leader) },
1450
+ ...showDivision ? [{ label: "Leader (Division):", value: leaderText(divisionField[0]) }] : [],
1451
+ { label: "Race elapsed:", value: `${(elapsedPct * 100).toFixed(0)}% ${bar(elapsedPct, 20)}` },
1452
+ { label: "Time left:", value: timeLeft },
1453
+ {
1454
+ label: "XP:",
1455
+ value: lvl.next_level_xp === null ? `${lvl.xp} (max level) ${bar(1, 20)}` : `${lvl.xp_into_level}/${lvl.xp_for_level} \u2192 Lvl. ${lvl.level + 1} ${bar(lvl.progress, 20)}`
1456
+ },
1457
+ {
1458
+ label: "Last heartbeat:",
1459
+ value: /* @__PURE__ */ jsxs5(Fragment2, { children: [
1460
+ lastHeartbeatAgoSec === null ? "\u2014" : `${lastHeartbeatAgoSec}s ago`,
1461
+ " ",
1462
+ /* @__PURE__ */ jsx7(Text7, { color: lastHeartbeatOk ? "green" : "yellow", children: lastHeartbeatOk ? "\u2713" : "\u26A0" })
1463
+ ] })
1464
+ }
1465
+ ];
1442
1466
  return /* @__PURE__ */ jsxs5(Box7, { flexDirection: "column", borderStyle: "round", paddingX: 1, children: [
1443
1467
  /* @__PURE__ */ jsxs5(Text7, { children: [
1444
1468
  "\u{1F3C7} TOKEN DERBY \u2500\u2500\u2500 ",
@@ -1470,40 +1494,7 @@ function StatusScreen(props) {
1470
1494
  ] })
1471
1495
  ] }),
1472
1496
  /* @__PURE__ */ jsxs5(Box7, { flexDirection: "column", marginTop: 1, children: [
1473
- /* @__PURE__ */ jsxs5(Text7, { children: [
1474
- "Tokens (race): ",
1475
- own?.current_tokens ?? 0
1476
- ] }),
1477
- /* @__PURE__ */ jsxs5(Text7, { children: [
1478
- "Position: ",
1479
- own?.rank ?? "\u2014",
1480
- " of ",
1481
- race.horses.length
1482
- ] }),
1483
- /* @__PURE__ */ jsxs5(Text7, { children: [
1484
- "Leader: ",
1485
- leader ? `${leader.name}${leader.user_name ? ` (${leader.user_name})` : ""} \u2014 ${leader.current_tokens}` : "\u2014"
1486
- ] }),
1487
- /* @__PURE__ */ jsxs5(Text7, { children: [
1488
- "Race elapsed: ",
1489
- (elapsedPct * 100).toFixed(0),
1490
- "% ",
1491
- bar(elapsedPct, 20)
1492
- ] }),
1493
- /* @__PURE__ */ jsxs5(Text7, { children: [
1494
- "Time left: ",
1495
- timeLeft
1496
- ] }),
1497
- /* @__PURE__ */ jsxs5(Text7, { children: [
1498
- "XP: ",
1499
- lvl.next_level_xp === null ? `${lvl.xp} (max level) ${bar(1, 20)}` : `${lvl.xp_into_level}/${lvl.xp_for_level} \u2192 Lvl. ${lvl.level + 1} ${bar(lvl.progress, 20)}`
1500
- ] }),
1501
- /* @__PURE__ */ jsxs5(Text7, { children: [
1502
- "Last heartbeat: ",
1503
- lastHeartbeatAgoSec === null ? "\u2014" : `${lastHeartbeatAgoSec}s ago`,
1504
- " ",
1505
- /* @__PURE__ */ jsx7(Text7, { color: lastHeartbeatOk ? "green" : "yellow", children: lastHeartbeatOk ? "\u2713" : "\u26A0" })
1506
- ] }),
1497
+ /* @__PURE__ */ jsx7(StatLines, { rows }),
1507
1498
  stalled && /* @__PURE__ */ jsxs5(Text7, { color: "yellow", children: [
1508
1499
  "\u26A0 ",
1509
1500
  stallReason ?? "Can't read token usage",
@@ -1514,6 +1505,17 @@ function StatusScreen(props) {
1514
1505
  /* @__PURE__ */ jsx7(Box7, { marginTop: 1, children: /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Press Ctrl+C to crash out of the race." }) })
1515
1506
  ] });
1516
1507
  }
1508
+ function StatLines(props) {
1509
+ const width = Math.max(...props.rows.map((r) => r.label.length)) + 1;
1510
+ return /* @__PURE__ */ jsx7(Fragment2, { children: props.rows.map((r) => /* @__PURE__ */ jsxs5(Text7, { children: [
1511
+ r.label.padEnd(width),
1512
+ r.value
1513
+ ] }, r.label)) });
1514
+ }
1515
+ function leaderText(h) {
1516
+ if (!h) return "\u2014";
1517
+ return `${h.name}${h.user_name ? ` (${h.user_name})` : ""} \u2014 ${h.current_tokens}`;
1518
+ }
1517
1519
  function elapsed(race) {
1518
1520
  const start = new Date(race.start_time).getTime();
1519
1521
  const end = new Date(race.end_time).getTime();