@mauricode/token-derby 2.12.1 → 2.12.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/bin.js +73 -47
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -26,19 +26,10 @@ import TextInput from "ink-text-input";
|
|
|
26
26
|
|
|
27
27
|
// ../shared/dist/models.js
|
|
28
28
|
var MODEL_KEYS = ["claude", "codex", "gemini"];
|
|
29
|
-
var SECONDARY_WEIGHT = 0.
|
|
29
|
+
var SECONDARY_WEIGHT = 0.5;
|
|
30
30
|
function isModelKey(v) {
|
|
31
31
|
return typeof v === "string" && MODEL_KEYS.includes(v);
|
|
32
32
|
}
|
|
33
|
-
function weightFor(primary, key) {
|
|
34
|
-
return key === primary ? 1 : SECONDARY_WEIGHT;
|
|
35
|
-
}
|
|
36
|
-
function weightedTotal(primary, perSource) {
|
|
37
|
-
let total = 0;
|
|
38
|
-
for (const key of MODEL_KEYS)
|
|
39
|
-
total += perSource[key] * weightFor(primary, key);
|
|
40
|
-
return total;
|
|
41
|
-
}
|
|
42
33
|
|
|
43
34
|
// ../shared/dist/constants.js
|
|
44
35
|
var CLI_VERSION_HEADER = "x-cli-version";
|
|
@@ -208,6 +199,59 @@ var HATS = [
|
|
|
208
199
|
// ../shared/dist/series-transform.js
|
|
209
200
|
var PACE_WINDOW_MS = 15 * 6e4;
|
|
210
201
|
|
|
202
|
+
// ../shared/dist/sprite-grid.js
|
|
203
|
+
var ROWS = [
|
|
204
|
+
"................................",
|
|
205
|
+
"................................",
|
|
206
|
+
"..........................MMM...",
|
|
207
|
+
"..........................MMM...",
|
|
208
|
+
".........................MBBEBB.",
|
|
209
|
+
".........................MBBEBB.",
|
|
210
|
+
"........................MBBBBBBB",
|
|
211
|
+
"........................MBBBBBBB",
|
|
212
|
+
"..................MMMMMMMBBB....",
|
|
213
|
+
"..................MMMMMMMBBB....",
|
|
214
|
+
"....BBBBBBBBSSSSSSMMBBBBBB......",
|
|
215
|
+
"...BBBBBBBBBSSSSSSMMBBBBBB......",
|
|
216
|
+
".TTBBBBBBBBBSSSSSSBBBBBBBB......",
|
|
217
|
+
".TTBBBBBBBBBSSSSSSBBBBBBBB......",
|
|
218
|
+
"TTTBBBBBBBBBBBBBBBBBBBBBBB......",
|
|
219
|
+
"TTTBBBBBBBBBBBBBBBBBBBBB........",
|
|
220
|
+
"...BBB.BBB.....BBB.BBB..........",
|
|
221
|
+
"...BBB.BBB.....BBB.BBB..........",
|
|
222
|
+
"....BB..BB......BB..BB..........",
|
|
223
|
+
"....BB..BB......BB..BB..........",
|
|
224
|
+
"....BB..BB......BB..BB..........",
|
|
225
|
+
"....BB..BB......BB..BB..........",
|
|
226
|
+
"....BB..BB......BB..BB..........",
|
|
227
|
+
"...HHH.HHH.....HHH.HHH.........."
|
|
228
|
+
];
|
|
229
|
+
var GRID = ROWS.map((row, y) => {
|
|
230
|
+
if (row.length !== 32)
|
|
231
|
+
throw new Error(`sprite row ${y} has length ${row.length}, expected 32`);
|
|
232
|
+
return [...row].map((c) => toTag(c, y));
|
|
233
|
+
});
|
|
234
|
+
function toTag(c, y) {
|
|
235
|
+
switch (c) {
|
|
236
|
+
case "B":
|
|
237
|
+
return "B";
|
|
238
|
+
case "M":
|
|
239
|
+
return "M";
|
|
240
|
+
case "T":
|
|
241
|
+
return "T";
|
|
242
|
+
case "S":
|
|
243
|
+
return "S";
|
|
244
|
+
case "H":
|
|
245
|
+
return "H";
|
|
246
|
+
case "E":
|
|
247
|
+
return "B";
|
|
248
|
+
case ".":
|
|
249
|
+
return null;
|
|
250
|
+
default:
|
|
251
|
+
throw new Error(`unknown sprite char '${c}' at y=${y}`);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
211
255
|
// src/ui/HorseSprite.tsx
|
|
212
256
|
import { Box, Text } from "ink";
|
|
213
257
|
|
|
@@ -258,10 +302,10 @@ function parse(rows, width, height) {
|
|
|
258
302
|
if (row.length !== width) {
|
|
259
303
|
throw new Error(`sprite row ${y} has length ${row.length}, expected ${width}`);
|
|
260
304
|
}
|
|
261
|
-
return [...row].map((c) =>
|
|
305
|
+
return [...row].map((c) => toTag2(c));
|
|
262
306
|
});
|
|
263
307
|
}
|
|
264
|
-
function
|
|
308
|
+
function toTag2(c) {
|
|
265
309
|
switch (c) {
|
|
266
310
|
case "B":
|
|
267
311
|
return "B";
|
|
@@ -743,8 +787,8 @@ var HEARTBEAT_RETRY_DELAYS_MS = [1e3, 2e3, 4e3, 8e3, 15e3];
|
|
|
743
787
|
// src/version.ts
|
|
744
788
|
import { createRequire } from "module";
|
|
745
789
|
function readVersion() {
|
|
746
|
-
if ("2.12.
|
|
747
|
-
return "2.12.
|
|
790
|
+
if ("2.12.2".length > 0) {
|
|
791
|
+
return "2.12.2";
|
|
748
792
|
}
|
|
749
793
|
try {
|
|
750
794
|
const req = createRequire(import.meta.url);
|
|
@@ -1343,7 +1387,7 @@ function PrimaryPicker({ onPick }) {
|
|
|
1343
1387
|
else if (key.return) onPick(MODEL_KEYS[i]);
|
|
1344
1388
|
});
|
|
1345
1389
|
return /* @__PURE__ */ jsxs4(Box6, { flexDirection: "column", children: [
|
|
1346
|
-
/* @__PURE__ */ jsx6(Text6, { bold: true, children: "Pick your primary model for this race (counts 1:1; the others count at
|
|
1390
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: "Pick your primary model for this race (counts 1:1; the others count at 50%)." }),
|
|
1347
1391
|
/* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "This is locked for the whole race \u2014 you can't change it, even by rejoining." }),
|
|
1348
1392
|
MODEL_KEYS.map((m, idx) => /* @__PURE__ */ jsxs4(Text6, { color: idx === i ? "cyan" : void 0, children: [
|
|
1349
1393
|
idx === i ? "\u276F " : " ",
|
|
@@ -1372,20 +1416,20 @@ import { Box as Box8, Text as Text8, useApp } from "ink";
|
|
|
1372
1416
|
import { Box as Box7, Text as Text7 } from "ink";
|
|
1373
1417
|
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1374
1418
|
var MODEL_LABELS = { claude: "Claude", codex: "Codex", gemini: "Gemini" };
|
|
1375
|
-
function
|
|
1376
|
-
const { primaryModel
|
|
1377
|
-
const
|
|
1378
|
-
return /* @__PURE__ */
|
|
1379
|
-
|
|
1380
|
-
MODEL_KEYS.map((m) => /* @__PURE__ */ jsxs5(Text7, { children: [
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
] });
|
|
1419
|
+
function ModelList(props) {
|
|
1420
|
+
const { primaryModel } = props;
|
|
1421
|
+
const secondaryTag = ` (${Math.round(SECONDARY_WEIGHT * 100)}%)`;
|
|
1422
|
+
return /* @__PURE__ */ jsx7(Box7, { marginTop: 1, children: /* @__PURE__ */ jsxs5(Text7, { children: [
|
|
1423
|
+
"Models: ",
|
|
1424
|
+
MODEL_KEYS.map((m, i) => /* @__PURE__ */ jsxs5(Text7, { children: [
|
|
1425
|
+
i > 0 ? " \xB7 " : "",
|
|
1426
|
+
MODEL_LABELS[m],
|
|
1427
|
+
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: m === primaryModel ? " (primary)" : secondaryTag })
|
|
1428
|
+
] }, m))
|
|
1429
|
+
] }) });
|
|
1386
1430
|
}
|
|
1387
1431
|
function StatusScreen(props) {
|
|
1388
|
-
const { race, ownHorseId, ownHorseName, ownColors, ownUserName, lastHeartbeatAgoSec, lastHeartbeatOk, stalled, stallReason, primaryModel
|
|
1432
|
+
const { race, ownHorseId, ownHorseName, ownColors, ownUserName, lastHeartbeatAgoSec, lastHeartbeatOk, stalled, stallReason, primaryModel } = props;
|
|
1389
1433
|
if (!race) {
|
|
1390
1434
|
return /* @__PURE__ */ jsx7(Box7, { flexDirection: "column", children: /* @__PURE__ */ jsx7(Text7, { children: "Joining race\u2026" }) });
|
|
1391
1435
|
}
|
|
@@ -1465,15 +1509,7 @@ function StatusScreen(props) {
|
|
|
1465
1509
|
". Your race continues."
|
|
1466
1510
|
] })
|
|
1467
1511
|
] }),
|
|
1468
|
-
primaryModel &&
|
|
1469
|
-
TokenBreakdown,
|
|
1470
|
-
{
|
|
1471
|
-
primaryModel,
|
|
1472
|
-
perSource,
|
|
1473
|
-
raceScore: own?.current_tokens ?? weightedTotal(primaryModel, perSource),
|
|
1474
|
-
primaryCapped
|
|
1475
|
-
}
|
|
1476
|
-
),
|
|
1512
|
+
primaryModel && /* @__PURE__ */ jsx7(ModelList, { primaryModel }),
|
|
1477
1513
|
/* @__PURE__ */ jsx7(Box7, { marginTop: 1, children: /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Press Ctrl+C to crash out of the race." }) })
|
|
1478
1514
|
] });
|
|
1479
1515
|
}
|
|
@@ -1958,8 +1994,6 @@ function RunRace({ active, initialState, pendingMode, ownUserName }) {
|
|
|
1958
1994
|
const ctrl = useRef(new AbortController());
|
|
1959
1995
|
const [stalled, setStalled] = useState5(false);
|
|
1960
1996
|
const [stallReason, setStallReason] = useState5(null);
|
|
1961
|
-
const baselineRef = useRef(initialState.acked);
|
|
1962
|
-
const [perSource, setPerSource] = useState5({ claude: 0, codex: 0, gemini: 0 });
|
|
1963
1997
|
useEffect2(() => {
|
|
1964
1998
|
const t = setInterval(() => setTickNow(/* @__PURE__ */ new Date()), 1e3);
|
|
1965
1999
|
return () => clearInterval(t);
|
|
@@ -1989,12 +2023,6 @@ function RunRace({ active, initialState, pendingMode, ownUserName }) {
|
|
|
1989
2023
|
if (pendingRef.current && !isStall(reading)) tracker.reprime();
|
|
1990
2024
|
setStalled(tracker.stalled);
|
|
1991
2025
|
setStallReason(tracker.stalled ? tracker.stallReason : null);
|
|
1992
|
-
const since = tracker.secondarySinceJoin(baselineRef.current);
|
|
1993
|
-
const ps = { claude: 0, codex: 0, gemini: 0 };
|
|
1994
|
-
for (const k of MODEL_KEYS) {
|
|
1995
|
-
ps[k] = k === active.primary_model ? tracker.primaryCounted() : since[k];
|
|
1996
|
-
}
|
|
1997
|
-
setPerSource(ps);
|
|
1998
2026
|
return tracker.nextBeat();
|
|
1999
2027
|
},
|
|
2000
2028
|
sendBeat: async (snapshot) => {
|
|
@@ -2062,9 +2090,7 @@ function RunRace({ active, initialState, pendingMode, ownUserName }) {
|
|
|
2062
2090
|
lastHeartbeatOk: lastHbOk,
|
|
2063
2091
|
stalled,
|
|
2064
2092
|
stallReason,
|
|
2065
|
-
primaryModel: active.primary_model
|
|
2066
|
-
perSource,
|
|
2067
|
-
primaryCapped: primaryConversationCap(active.primary_top5 ?? false) !== Infinity
|
|
2093
|
+
primaryModel: active.primary_model
|
|
2068
2094
|
}
|
|
2069
2095
|
),
|
|
2070
2096
|
achievements.length > 0 && /* @__PURE__ */ jsxs6(Box8, { flexDirection: "column", marginTop: 1, children: [
|