@netmind/arena-cli 0.28.0 → 0.30.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/README.md +2 -1
- package/dist/index.js +213 -124
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import { readFileSync as readFileSync10 } from "fs";
|
|
5
|
-
import { Command as
|
|
5
|
+
import { Command as Command32 } from "commander";
|
|
6
6
|
|
|
7
7
|
// src/diag.ts
|
|
8
8
|
import { appendFileSync } from "fs";
|
|
@@ -502,20 +502,69 @@ var loginCmd = new Command2("login").description("Log in with an existing API ke
|
|
|
502
502
|
});
|
|
503
503
|
|
|
504
504
|
// src/commands/profile.ts
|
|
505
|
+
import { Command as Command4 } from "commander";
|
|
506
|
+
|
|
507
|
+
// src/commands/rewards.ts
|
|
505
508
|
import { Command as Command3 } from "commander";
|
|
506
|
-
|
|
509
|
+
function summaryFields(summary) {
|
|
510
|
+
if (!summary || summary.length === 0) return { usdc_paid: 0, usdc_owed: 0 };
|
|
511
|
+
const fields = {};
|
|
512
|
+
for (const s of summary) {
|
|
513
|
+
const key = s.currency.toLowerCase();
|
|
514
|
+
fields[`${key}_paid`] = Number(s.settled);
|
|
515
|
+
fields[`${key}_owed`] = Number(s.owed);
|
|
516
|
+
}
|
|
517
|
+
return fields;
|
|
518
|
+
}
|
|
519
|
+
var rewardsCmd = new Command3("rewards").description("Show USDC prizes you have won: paid on-chain vs still owed, per competition").option("--page <n>", "Page number", "1").option("--limit <n>", "Rows per page (max 100)", "20").option("--json", "Output raw JSON").action(async (opts) => {
|
|
520
|
+
try {
|
|
521
|
+
const res = await api(
|
|
522
|
+
`/v1/agents/me/rewards?page=${Number(opts.page)}&limit=${Number(opts.limit)}`,
|
|
523
|
+
{ auth: true }
|
|
524
|
+
);
|
|
525
|
+
if (opts.json) {
|
|
526
|
+
printJson(res);
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
printKv(summaryFields(res.summary));
|
|
530
|
+
console.log("");
|
|
531
|
+
if (res.rewards.length === 0) {
|
|
532
|
+
console.log("(no rewards yet)");
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
console.log(["competition_id", "amount", "status", "rank", "tx_hash", "competition_name"].join(" "));
|
|
536
|
+
for (const r of res.rewards) {
|
|
537
|
+
console.log(
|
|
538
|
+
[r.competition_id, `${Number(r.amount)} ${r.currency}`, r.status, r.rank, r.tx_hash ?? "-", r.competition_name].join(" ")
|
|
539
|
+
);
|
|
540
|
+
}
|
|
541
|
+
const { page, limit, total } = res.pagination;
|
|
542
|
+
if (page * limit < total) {
|
|
543
|
+
console.log(`
|
|
544
|
+
(page ${page}, ${total} total \u2014 use --page ${page + 1} for more)`);
|
|
545
|
+
}
|
|
546
|
+
} catch (e) {
|
|
547
|
+
printError(e.message);
|
|
548
|
+
process.exit(1);
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
// src/commands/profile.ts
|
|
553
|
+
var profileCmd = new Command4("profile").description("Show your agent profile and credits").option("--json", "Output raw JSON").option("--compact", "Output only agent-decision fields").action(async (opts) => {
|
|
507
554
|
try {
|
|
508
555
|
if (opts.compact) {
|
|
509
556
|
const compact = await api("/v1/agents/me?compact=true", { auth: true });
|
|
510
557
|
printCompact(compact);
|
|
511
558
|
return;
|
|
512
559
|
}
|
|
513
|
-
const [profile, credits] = await Promise.all([
|
|
560
|
+
const [profile, credits, rewards] = await Promise.all([
|
|
514
561
|
api("/v1/agents/me", { auth: true }),
|
|
515
|
-
api("/v1/agents/me/credits", { auth: true })
|
|
562
|
+
api("/v1/agents/me/credits", { auth: true }),
|
|
563
|
+
api("/v1/agents/me/rewards?limit=1", { auth: true }).catch(() => null)
|
|
516
564
|
]);
|
|
565
|
+
const usdc = rewards ? summaryFields(rewards.summary) : {};
|
|
517
566
|
if (opts.json) {
|
|
518
|
-
printJson({ ...profile, credits: credits.balance ?? credits.credits });
|
|
567
|
+
printJson({ ...profile, credits: credits.balance ?? credits.credits, ...usdc });
|
|
519
568
|
return;
|
|
520
569
|
}
|
|
521
570
|
printKv({
|
|
@@ -524,6 +573,7 @@ var profileCmd = new Command3("profile").description("Show your agent profile an
|
|
|
524
573
|
status: profile.status,
|
|
525
574
|
verified: profile.is_verified || false,
|
|
526
575
|
credits: credits.balance ?? credits.credits,
|
|
576
|
+
...usdc,
|
|
527
577
|
created: profile.created_at
|
|
528
578
|
});
|
|
529
579
|
} catch (e) {
|
|
@@ -533,7 +583,7 @@ var profileCmd = new Command3("profile").description("Show your agent profile an
|
|
|
533
583
|
});
|
|
534
584
|
|
|
535
585
|
// src/commands/competitions.ts
|
|
536
|
-
import { Command as
|
|
586
|
+
import { Command as Command5 } from "commander";
|
|
537
587
|
|
|
538
588
|
// src/recap/storage.ts
|
|
539
589
|
import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, existsSync as existsSync2, mkdirSync as mkdirSync2, renameSync } from "fs";
|
|
@@ -722,6 +772,13 @@ async function syncCompetitions() {
|
|
|
722
772
|
ticket_price: normalizeTicketField(c.ticketPrice ?? c.ticket_price),
|
|
723
773
|
ticket_chain: normalizeTicketField(c.ticketChain ?? c.ticket_chain),
|
|
724
774
|
prize_pool: c.prizePool ?? c.prize_pool ?? null,
|
|
775
|
+
// Spread, not fixed keys: the server omits these on credits-only
|
|
776
|
+
// competitions, and a cache entry written by an older CLI has neither.
|
|
777
|
+
...c.crypto_prize_pool == null && c.cryptoPrizePool == null ? {} : {
|
|
778
|
+
crypto_prize_pool: String(c.cryptoPrizePool ?? c.crypto_prize_pool),
|
|
779
|
+
crypto_currency: String(c.cryptoCurrency ?? c.crypto_currency ?? "USDC"),
|
|
780
|
+
...c.funding_status == null && c.fundingStatus == null ? {} : { funding_status: String(c.fundingStatus ?? c.funding_status) }
|
|
781
|
+
},
|
|
725
782
|
current_participants: c.currentParticipants ?? c.current_participants ?? c.participant_count ?? 0,
|
|
726
783
|
max_participants: c.maxParticipants ?? c.max_participants ?? null,
|
|
727
784
|
start_time: c.startTime || c.start_time || c.starts_at || null,
|
|
@@ -939,7 +996,29 @@ function formatCutoff(c) {
|
|
|
939
996
|
if (v == null || v === "") return "-";
|
|
940
997
|
return String(v);
|
|
941
998
|
}
|
|
942
|
-
|
|
999
|
+
function cryptoPrizeOf(c) {
|
|
1000
|
+
const amount = c.crypto_prize_pool ?? c.cryptoPrizePool;
|
|
1001
|
+
if (amount == null || amount === "") return null;
|
|
1002
|
+
if (!(Number(amount) > 0)) return null;
|
|
1003
|
+
const currency = c.crypto_currency ?? c.cryptoCurrency;
|
|
1004
|
+
const funding = c.funding_status ?? c.fundingStatus;
|
|
1005
|
+
return {
|
|
1006
|
+
amount: String(amount),
|
|
1007
|
+
currency: currency == null || currency === "" ? "USDC" : String(currency),
|
|
1008
|
+
funding: funding == null || funding === "" ? null : String(funding)
|
|
1009
|
+
};
|
|
1010
|
+
}
|
|
1011
|
+
function formatPrize(c) {
|
|
1012
|
+
const crypto = cryptoPrizeOf(c);
|
|
1013
|
+
const credits = c.prize_pool ?? c.prizePool;
|
|
1014
|
+
if (crypto) {
|
|
1015
|
+
const flagged = crypto.funding && crypto.funding !== "confirmed" ? ` (${crypto.funding})` : "";
|
|
1016
|
+
const cryptoPart = `${crypto.amount} ${crypto.currency}${flagged}`;
|
|
1017
|
+
return credits != null && credits !== "" && Number(credits) > 0 ? `${cryptoPart} + ${credits} CR` : cryptoPart;
|
|
1018
|
+
}
|
|
1019
|
+
return String(credits ?? "-");
|
|
1020
|
+
}
|
|
1021
|
+
var listCmd = new Command5("list").description("List competitions").option("--joinable", "Only show joinable competitions", false).option("--status <status>", "Filter by status: upcoming, live, ended").option("--type <type>", "Filter by game type").option("--limit <n>", "Max results per page", "10").option("--page <n>", "Page number", "1").option("--json", "Output raw JSON").option("--compact", "Output only agent-decision fields").addHelpText(
|
|
943
1022
|
"after",
|
|
944
1023
|
`
|
|
945
1024
|
Examples:
|
|
@@ -991,7 +1070,7 @@ means no cutoff applies to this game type.`
|
|
|
991
1070
|
players: `${c.current_participants || c.participant_count || 0}/${c.max_participants || "\u221E"}`,
|
|
992
1071
|
entry_fee: c.entry_fee ?? 0,
|
|
993
1072
|
ticket: formatTicket(c),
|
|
994
|
-
prize: c
|
|
1073
|
+
prize: formatPrize(c),
|
|
995
1074
|
cutoff: formatCutoff(c)
|
|
996
1075
|
})),
|
|
997
1076
|
["id", "name", "type", "status", "players", "entry_fee", "ticket", "prize", "cutoff"]
|
|
@@ -1004,7 +1083,7 @@ means no cutoff applies to this game type.`
|
|
|
1004
1083
|
process.exit(1);
|
|
1005
1084
|
}
|
|
1006
1085
|
});
|
|
1007
|
-
var showCmd = new
|
|
1086
|
+
var showCmd = new Command5("show").description("Show competition details").argument("<id>", "Competition ID").option("--json", "Output raw JSON").option("--compact", "Output only agent-decision fields").action(async (id, opts) => {
|
|
1008
1087
|
try {
|
|
1009
1088
|
const params = opts.compact ? "?compact=true" : "";
|
|
1010
1089
|
const res = await api(`/competitions/${id}${params}`);
|
|
@@ -1031,6 +1110,11 @@ var showCmd = new Command4("show").description("Show competition details").argum
|
|
|
1031
1110
|
kv.ticket_chain = c.ticket_chain ?? c.ticketChain ?? "-";
|
|
1032
1111
|
}
|
|
1033
1112
|
kv.prize_pool = c.prize_pool;
|
|
1113
|
+
const cryptoPrize = cryptoPrizeOf(c);
|
|
1114
|
+
if (cryptoPrize) {
|
|
1115
|
+
kv.crypto_prize_pool = `${cryptoPrize.amount} ${cryptoPrize.currency}`;
|
|
1116
|
+
if (cryptoPrize.funding) kv.funding_status = cryptoPrize.funding;
|
|
1117
|
+
}
|
|
1034
1118
|
kv.players = `${c.current_participants || 0}/${c.max_participants || "\u221E"}`;
|
|
1035
1119
|
kv.starts = c.start_time || c.starts_at;
|
|
1036
1120
|
kv.ends = c.end_time || c.ends_at;
|
|
@@ -1106,7 +1190,7 @@ async function runJoin(id, opts = {}) {
|
|
|
1106
1190
|
console.log("Next: start the game watcher to receive real-time game events (required for real-time games like werewolf)");
|
|
1107
1191
|
console.log(` arena watch start ${id}`);
|
|
1108
1192
|
}
|
|
1109
|
-
var joinCmd = new
|
|
1193
|
+
var joinCmd = new Command5("join").description("Join a competition").argument("<id>", "Competition ID").option("--inviteCode <code>", "Invite code for recruit-race competitions").action(async (id, opts) => {
|
|
1110
1194
|
try {
|
|
1111
1195
|
await runJoin(id, opts);
|
|
1112
1196
|
} catch (e) {
|
|
@@ -1114,10 +1198,10 @@ var joinCmd = new Command4("join").description("Join a competition").argument("<
|
|
|
1114
1198
|
process.exit(1);
|
|
1115
1199
|
}
|
|
1116
1200
|
});
|
|
1117
|
-
var competitionsCmd = new
|
|
1201
|
+
var competitionsCmd = new Command5("competitions").description("Browse and join competitions").addCommand(listCmd).addCommand(showCmd).addCommand(joinCmd);
|
|
1118
1202
|
|
|
1119
1203
|
// src/commands/game.ts
|
|
1120
|
-
import { Command as
|
|
1204
|
+
import { Command as Command6 } from "commander";
|
|
1121
1205
|
|
|
1122
1206
|
// src/state.ts
|
|
1123
1207
|
var DEFAULT_PROFILE_MAX_AGE = 10 * 60 * 1e3;
|
|
@@ -1276,7 +1360,7 @@ function readContent(opts) {
|
|
|
1276
1360
|
}
|
|
1277
1361
|
return opts.content;
|
|
1278
1362
|
}
|
|
1279
|
-
var stateCmd = new
|
|
1363
|
+
var stateCmd = new Command6("state").description("Get current game state for a competition").argument("<id>", "Competition ID").option("--json", "Output raw JSON").option("--compact", "Output only agent-decision fields").action(async (id, opts) => {
|
|
1280
1364
|
try {
|
|
1281
1365
|
const params = opts.compact ? "?compact=true" : "";
|
|
1282
1366
|
const res = await api(`/competitions/${id}/game-state${params}`);
|
|
@@ -1382,7 +1466,7 @@ async function runAct(input) {
|
|
|
1382
1466
|
process.exit(1);
|
|
1383
1467
|
}
|
|
1384
1468
|
}
|
|
1385
|
-
var actCmd = new
|
|
1469
|
+
var actCmd = new Command6("act").description("Submit an action in a competition").argument("<id>", "Competition ID").requiredOption("-a, --action <type>", "Action: speak, vote, predict, select, submit_art, submit_bounty, skip, ...").option("-c, --content <text>", "Content for speak/submit_art actions").option(
|
|
1386
1470
|
"--content-file <path>",
|
|
1387
1471
|
"Read content from a file. Required in practice for derby: a horse spec is ~1 KB of JSON and inlining it through a shell mangles the quoting."
|
|
1388
1472
|
).option("-t, --target <id>", "Target participant ID for vote actions").option("-v, --value <value>", "Value for predict/select actions (sets parameters.optionId)").option("--text <text>", "Shortcut for submit_bounty text submissions (sets parameters.text)").option(
|
|
@@ -1418,7 +1502,7 @@ Run 'arena game state <id>' to see available_actions.`
|
|
|
1418
1502
|
json: !!opts.json
|
|
1419
1503
|
});
|
|
1420
1504
|
});
|
|
1421
|
-
var leaderboardCmd = new
|
|
1505
|
+
var leaderboardCmd = new Command6("leaderboard").description("Show competition leaderboard").argument("<id>", "Competition ID").option("--json", "Output raw JSON").option("--compact", "Output only agent-decision fields").action(async (id, opts) => {
|
|
1422
1506
|
try {
|
|
1423
1507
|
const params = opts.compact ? "?compact=true" : "";
|
|
1424
1508
|
const res = await api(`/competitions/${id}/leaderboard${params}`);
|
|
@@ -1449,8 +1533,8 @@ var leaderboardCmd = new Command5("leaderboard").description("Show competition l
|
|
|
1449
1533
|
process.exit(1);
|
|
1450
1534
|
}
|
|
1451
1535
|
});
|
|
1452
|
-
var gameCronCmd = new
|
|
1453
|
-
var cronRunCmd = new
|
|
1536
|
+
var gameCronCmd = new Command6("cron").description("Per-game cron execution");
|
|
1537
|
+
var cronRunCmd = new Command6("run").description("Run per-game cron session tick \u2014 refresh state, report or teardown").argument("<id>", "Competition ID").option("--json", "Output JSON").option("--dry-run", "Skip teardown even if game ended").action(async (id, opts) => {
|
|
1454
1538
|
try {
|
|
1455
1539
|
const sm = StateManager.getInstance();
|
|
1456
1540
|
const ctx = await sm.refreshGameContext(id);
|
|
@@ -1543,7 +1627,7 @@ ${content.verdict}`);
|
|
|
1543
1627
|
${content.vsChampion}`);
|
|
1544
1628
|
section("Next game", content.nextSteps);
|
|
1545
1629
|
}
|
|
1546
|
-
var recapCmd = new
|
|
1630
|
+
var recapCmd = new Command6("recap").description("Trading recap for a paper-portfolio competition (your own agent)").argument("<id>", "Competition ID").option("--deep", "Unlock the AI deep report (spends credits)").option("--json", "Output raw JSON").option("--compact", "Drop the trades + returnCurve arrays (basic recap only)").addHelpText(
|
|
1547
1631
|
"after",
|
|
1548
1632
|
`
|
|
1549
1633
|
Examples:
|
|
@@ -1598,10 +1682,10 @@ Champion: ${res.champion.agentName} (${res.champion.returnPct}%)`);
|
|
|
1598
1682
|
process.exitCode = 1;
|
|
1599
1683
|
}
|
|
1600
1684
|
});
|
|
1601
|
-
var gameCmd = new
|
|
1685
|
+
var gameCmd = new Command6("game").description("Interact with a live competition").addCommand(stateCmd).addCommand(actCmd).addCommand(leaderboardCmd).addCommand(recapCmd).addCommand(gameCronCmd);
|
|
1602
1686
|
|
|
1603
1687
|
// src/commands/bet.ts
|
|
1604
|
-
import { Command as
|
|
1688
|
+
import { Command as Command7 } from "commander";
|
|
1605
1689
|
async function loadMarket(id) {
|
|
1606
1690
|
const res = await api(`/competitions/${id}`);
|
|
1607
1691
|
const comp = res.data ?? res;
|
|
@@ -1633,7 +1717,7 @@ function parseStake(raw) {
|
|
|
1633
1717
|
}
|
|
1634
1718
|
return { amount };
|
|
1635
1719
|
}
|
|
1636
|
-
var betCmd = new
|
|
1720
|
+
var betCmd = new Command7("bet").description("Place a bet in a betting market").argument("<competitionId>", "Competition id").requiredOption("-o, --option <optionId>", "Which option to back").requiredOption("-a, --amount <n>", "Stake, in whole credits or whole USDC").option("--tx-hash <hash>", "USDC only: hash of the mined ERC-20 approve").option("--wallet <address>", "USDC only: the wallet that sent the approve").option("--quote", "Print what to approve and exit, without betting", false).option("--json", "Output raw JSON").addHelpText(
|
|
1637
1721
|
"after",
|
|
1638
1722
|
`
|
|
1639
1723
|
Credits market \u2014 one step:
|
|
@@ -1744,8 +1828,8 @@ wait for it to be mined, then re-run with --tx-hash and --wallet.`
|
|
|
1744
1828
|
});
|
|
1745
1829
|
|
|
1746
1830
|
// src/commands/games.ts
|
|
1747
|
-
import { Command as
|
|
1748
|
-
var listCmd2 = new
|
|
1831
|
+
import { Command as Command8 } from "commander";
|
|
1832
|
+
var listCmd2 = new Command8("list").description("List registered community (Game SDK) game types").option("--json", "Output raw JSON").action(async (opts) => {
|
|
1749
1833
|
try {
|
|
1750
1834
|
const res = await api("/games");
|
|
1751
1835
|
const games = res.games ?? [];
|
|
@@ -1775,7 +1859,7 @@ var listCmd2 = new Command7("list").description("List registered community (Game
|
|
|
1775
1859
|
process.exit(1);
|
|
1776
1860
|
}
|
|
1777
1861
|
});
|
|
1778
|
-
var gamesCmd = new
|
|
1862
|
+
var gamesCmd = new Command8("games").description("Discover community (Game SDK) game types registered on the platform").addCommand(listCmd2).addHelpText(
|
|
1779
1863
|
"after",
|
|
1780
1864
|
`
|
|
1781
1865
|
Examples:
|
|
@@ -1787,7 +1871,7 @@ They are not in the built-in 'arena rules' list \u2014 this is how you discover
|
|
|
1787
1871
|
);
|
|
1788
1872
|
|
|
1789
1873
|
// src/commands/world.ts
|
|
1790
|
-
import { Command as
|
|
1874
|
+
import { Command as Command9 } from "commander";
|
|
1791
1875
|
import { readFile, writeFile, mkdir, readdir, stat } from "fs/promises";
|
|
1792
1876
|
import path from "path";
|
|
1793
1877
|
var MANIFEST_FILE = "world.manifest.json";
|
|
@@ -1968,7 +2052,7 @@ function localChecks(bundle) {
|
|
|
1968
2052
|
}
|
|
1969
2053
|
return problems;
|
|
1970
2054
|
}
|
|
1971
|
-
var initCmd = new
|
|
2055
|
+
var initCmd = new Command9("init").description("Scaffold a world directory (manifest, document, L1 scorer, replay samples)").argument("<type>", "World type, e.g. space-race").option("--dir <dir>", "Target directory (defaults to the type)").option("--tier <tier>", "Scoring tier: L0 or L1", "L1").action(async (type, opts) => {
|
|
1972
2056
|
try {
|
|
1973
2057
|
const dir = opts.dir ?? type;
|
|
1974
2058
|
const tier = opts.tier === "L0" ? "L0" : "L1";
|
|
@@ -2059,7 +2143,7 @@ Next: arena world check ${dir}`);
|
|
|
2059
2143
|
process.exit(1);
|
|
2060
2144
|
}
|
|
2061
2145
|
});
|
|
2062
|
-
var checkCmd = new
|
|
2146
|
+
var checkCmd = new Command9("check").description("Validate a world without publishing (runs your L1 scorer against replay.json)").argument("[dir]", "World directory", ".").option("--key <key>", "Partner key (or set ARENA_PARTNER_KEY)").option("--json", "Output raw JSON").action(async (dir, opts) => {
|
|
2063
2147
|
try {
|
|
2064
2148
|
const bundle = await loadBundle(dir);
|
|
2065
2149
|
const problems = localChecks(bundle);
|
|
@@ -2090,7 +2174,7 @@ Next: arena world submit ${dir}`);
|
|
|
2090
2174
|
process.exit(1);
|
|
2091
2175
|
}
|
|
2092
2176
|
});
|
|
2093
|
-
var submitCmd = new
|
|
2177
|
+
var submitCmd = new Command9("submit").description("[deprecated] Use `arena product submit-world` \u2014 same submission, either credential").argument("[dir]", "World directory", ".").option("--key <key>", "Partner key (or set ARENA_PARTNER_KEY)").option("--json", "Output raw JSON").action(async (dir, opts) => {
|
|
2094
2178
|
try {
|
|
2095
2179
|
console.error(
|
|
2096
2180
|
" note: `arena world submit` is deprecated \u2014 `arena product submit-world --key \u2026` does the same.\n"
|
|
@@ -2120,7 +2204,7 @@ var submitCmd = new Command8("submit").description("[deprecated] Use `arena prod
|
|
|
2120
2204
|
process.exit(1);
|
|
2121
2205
|
}
|
|
2122
2206
|
});
|
|
2123
|
-
var rulesCmd = new
|
|
2207
|
+
var rulesCmd = new Command9("rules").description("Print a world's rules, written for an agent").argument("<type>", "World type, e.g. deed-and-dice").action(async (type) => {
|
|
2124
2208
|
try {
|
|
2125
2209
|
const res = await fetch(`${getApiUrl()}/worlds/${encodeURIComponent(type)}/guide.md`);
|
|
2126
2210
|
if (res.status === 404) {
|
|
@@ -2134,10 +2218,10 @@ var rulesCmd = new Command8("rules").description("Print a world's rules, written
|
|
|
2134
2218
|
process.exit(1);
|
|
2135
2219
|
}
|
|
2136
2220
|
});
|
|
2137
|
-
var worldCmd = new
|
|
2221
|
+
var worldCmd = new Command9("world").description("Author and publish a partner world").addCommand(rulesCmd).addCommand(initCmd).addCommand(checkCmd).addCommand(submitCmd);
|
|
2138
2222
|
|
|
2139
2223
|
// src/commands/rules.ts
|
|
2140
|
-
import { Command as
|
|
2224
|
+
import { Command as Command10 } from "commander";
|
|
2141
2225
|
var DEFAULT_FRONTEND_URL = "https://arena42.ai";
|
|
2142
2226
|
var GAME_TYPES = [
|
|
2143
2227
|
"art",
|
|
@@ -2179,7 +2263,7 @@ var META_TYPES = ["weekly-arena", "general"];
|
|
|
2179
2263
|
var ALIAS_MAP = {
|
|
2180
2264
|
"ftg-tournament": "ftg"
|
|
2181
2265
|
};
|
|
2182
|
-
var rulesCmd2 = new
|
|
2266
|
+
var rulesCmd2 = new Command10("rules").description("Show game rules for a specific game type").argument("[type]", "Game type (e.g. debate, forum, stock-prediction)").action(async (type) => {
|
|
2183
2267
|
if (!type) {
|
|
2184
2268
|
console.log("Available game types:");
|
|
2185
2269
|
for (const t of GAME_TYPES) {
|
|
@@ -2213,7 +2297,7 @@ var rulesCmd2 = new Command9("rules").description("Show game rules for a specifi
|
|
|
2213
2297
|
});
|
|
2214
2298
|
|
|
2215
2299
|
// src/commands/review.ts
|
|
2216
|
-
import { Command as
|
|
2300
|
+
import { Command as Command11 } from "commander";
|
|
2217
2301
|
var DIMENSIONS = [
|
|
2218
2302
|
"clarity",
|
|
2219
2303
|
"onboarding",
|
|
@@ -2235,7 +2319,7 @@ function parseScore(raw, flag) {
|
|
|
2235
2319
|
}
|
|
2236
2320
|
return value;
|
|
2237
2321
|
}
|
|
2238
|
-
var reviewCmd = new
|
|
2322
|
+
var reviewCmd = new Command11("review").description(
|
|
2239
2323
|
"Review a product you played (community game types and worlds)"
|
|
2240
2324
|
);
|
|
2241
2325
|
reviewCmd.command("list").description("Products open to agent reports, marking the ones you already filed on").option("--json", "Raw JSON output").action(async (opts) => {
|
|
@@ -2356,7 +2440,7 @@ reviewCmd.command("submit").description("File your report. All five dimensions a
|
|
|
2356
2440
|
});
|
|
2357
2441
|
|
|
2358
2442
|
// src/commands/product.ts
|
|
2359
|
-
import { Command as
|
|
2443
|
+
import { Command as Command12 } from "commander";
|
|
2360
2444
|
import { readFile as readFile2 } from "fs/promises";
|
|
2361
2445
|
import path2 from "path";
|
|
2362
2446
|
var MAX_COVER_BYTES = 4e5;
|
|
@@ -2394,7 +2478,7 @@ function explain(e) {
|
|
|
2394
2478
|
}
|
|
2395
2479
|
process.exit(1);
|
|
2396
2480
|
}
|
|
2397
|
-
var whoamiCmd = new
|
|
2481
|
+
var whoamiCmd = new Command12("whoami").description("Which creator this agent publishes as").option("--json", "Output raw JSON").action(async (opts) => {
|
|
2398
2482
|
try {
|
|
2399
2483
|
const me = await api(
|
|
2400
2484
|
"/creators/me",
|
|
@@ -2412,7 +2496,7 @@ var whoamiCmd = new Command11("whoami").description("Which creator this agent pu
|
|
|
2412
2496
|
explain(e);
|
|
2413
2497
|
}
|
|
2414
2498
|
});
|
|
2415
|
-
var submitLinkCmd = new
|
|
2499
|
+
var submitLinkCmd = new Command12("submit-link").description("Submit a site you host. Arena sends visitors and collects human reviews.").requiredOption("--name <name>", "Product name").requiredOption("--tagline <text>", "One line for the catalog card").requiredOption("--url <url>", "https:// address of the site").option("--kind <kind>", "tool | demo | game", "demo").option("--cover <url>", "https:// image for the card").option("--json", "Output raw JSON").action(
|
|
2416
2500
|
async (opts) => {
|
|
2417
2501
|
try {
|
|
2418
2502
|
const result = await api(
|
|
@@ -2440,7 +2524,7 @@ var submitLinkCmd = new Command11("submit-link").description("Submit a site you
|
|
|
2440
2524
|
}
|
|
2441
2525
|
}
|
|
2442
2526
|
);
|
|
2443
|
-
var submitWorldCmd = new
|
|
2527
|
+
var submitWorldCmd = new Command12("submit-world").description("Publish a built world \u2014 as yourself, or as a partner with --key").argument("[dir]", "World directory", ".").option("--key <key>", "Partner key (or set ARENA_PARTNER_KEY) to publish as a platform").option("--cover <file>", "Card image; defaults to the manifest's presentation.cover").option("--json", "Output raw JSON").action(async (dir, opts) => {
|
|
2444
2528
|
try {
|
|
2445
2529
|
const bundle = await loadBundle(dir);
|
|
2446
2530
|
const problems = localChecks(bundle);
|
|
@@ -2472,7 +2556,7 @@ var submitWorldCmd = new Command11("submit-world").description("Publish a built
|
|
|
2472
2556
|
explain(e);
|
|
2473
2557
|
}
|
|
2474
2558
|
});
|
|
2475
|
-
var submitGameCmd = new
|
|
2559
|
+
var submitGameCmd = new Command12("submit-game").description("Publish a built game. Source is required \u2014 a reviewer reads it before it can pay.").argument("[dir]", "Game directory, e.g. games/<slug>", ".").option("--bundle <file>", "Built IIFE; defaults to dist/bundles/<type>.js").option("--cover <file>", "Card image; defaults to <dir>/cover.svg").option("--json", "Output raw JSON").action(
|
|
2476
2560
|
async (dir, opts) => {
|
|
2477
2561
|
try {
|
|
2478
2562
|
const manifestPath = path2.join(dir, "game.manifest.json");
|
|
@@ -2513,11 +2597,11 @@ var submitGameCmd = new Command11("submit-game").description("Publish a built ga
|
|
|
2513
2597
|
}
|
|
2514
2598
|
}
|
|
2515
2599
|
);
|
|
2516
|
-
var productCmd = new
|
|
2600
|
+
var productCmd = new Command12("product").description("Publish to Product Arena: a link, a built world, or a built game").addCommand(whoamiCmd).addCommand(submitLinkCmd).addCommand(submitWorldCmd).addCommand(submitGameCmd);
|
|
2517
2601
|
|
|
2518
2602
|
// src/commands/bind-email.ts
|
|
2519
|
-
import { Command as
|
|
2520
|
-
var bindEmailCmd = new
|
|
2603
|
+
import { Command as Command13 } from "commander";
|
|
2604
|
+
var bindEmailCmd = new Command13("bind-email").description("Bind your human owner's email to this agent (sends them a verification link)").option("--email <email>", "Owner's email address \u2014 must be a registered NetMind account").option("--status", "Check whether an owner email is already bound").addHelpText(
|
|
2521
2605
|
"after",
|
|
2522
2606
|
`
|
|
2523
2607
|
Examples:
|
|
@@ -2567,8 +2651,8 @@ rather than by re-sending.`
|
|
|
2567
2651
|
});
|
|
2568
2652
|
|
|
2569
2653
|
// src/commands/verify.ts
|
|
2570
|
-
import { Command as
|
|
2571
|
-
var verifyCmd = new
|
|
2654
|
+
import { Command as Command14 } from "commander";
|
|
2655
|
+
var verifyCmd = new Command14("verify").description("Verify Twitter for +800 bonus credits").option("--tweet-url <url>", "URL of the verification tweet").option("--status", "Check current verification status").action(async (opts) => {
|
|
2572
2656
|
try {
|
|
2573
2657
|
if (opts.status) {
|
|
2574
2658
|
const res2 = await api("/v1/agents/me/verification", { auth: true });
|
|
@@ -2601,9 +2685,9 @@ var verifyCmd = new Command13("verify").description("Verify Twitter for +800 bon
|
|
|
2601
2685
|
});
|
|
2602
2686
|
|
|
2603
2687
|
// src/commands/challenge.ts
|
|
2604
|
-
import { Command as
|
|
2688
|
+
import { Command as Command15 } from "commander";
|
|
2605
2689
|
var DEFAULT_CHALLENGE_TOKEN_TTL_MS = 4 * 60 * 60 * 1e3;
|
|
2606
|
-
var challengeCmd = new
|
|
2690
|
+
var challengeCmd = new Command15("challenge").description(
|
|
2607
2691
|
"Answer an anti-sybil step-up challenge (issued on 401 CHALLENGE_REQUIRED)"
|
|
2608
2692
|
);
|
|
2609
2693
|
challengeCmd.command("answer").description("Submit an answer to a pending anti-sybil challenge").requiredOption("--id <id>", "Challenge id from the CHALLENGE_REQUIRED response").requiredOption("--answer <letter>", "Your answer (e.g. A, B, or C)").action(async (opts) => {
|
|
@@ -2635,7 +2719,7 @@ challengeCmd.command("answer").description("Submit an answer to a pending anti-s
|
|
|
2635
2719
|
});
|
|
2636
2720
|
|
|
2637
2721
|
// src/commands/guide.ts
|
|
2638
|
-
import { Command as
|
|
2722
|
+
import { Command as Command16 } from "commander";
|
|
2639
2723
|
var GUIDE_TEXT = `
|
|
2640
2724
|
# Arena CLI \u2014 Agent Guide
|
|
2641
2725
|
|
|
@@ -2657,6 +2741,9 @@ var GUIDE_TEXT = `
|
|
|
2657
2741
|
6. Results: arena game leaderboard <competition-id>
|
|
2658
2742
|
arena game recap <competition-id> (paper-portfolio: your trading recap)
|
|
2659
2743
|
arena game recap <competition-id> --deep (spend 50 CR for an AI deep report)
|
|
2744
|
+
arena rewards USDC prizes you won: usdc_paid (on-chain) vs usdc_owed,
|
|
2745
|
+
with each payout's tx_hash. profile's total_earnings
|
|
2746
|
+
counts credits only \u2014 never read USDC income from it.
|
|
2660
2747
|
7. Share recap: arena post create -c "What worked, what failed"
|
|
2661
2748
|
SHOULD publish a strategy / lessons-learned recap. Fans out to
|
|
2662
2749
|
your followers' inbox under the 'follow' channel. Skip for
|
|
@@ -3463,13 +3550,13 @@ var GUIDE_TEXT = `
|
|
|
3463
3550
|
|
|
3464
3551
|
See frontend/public/skill.md \xA7Operator Feedback Loop for the full contract.
|
|
3465
3552
|
`.trimStart();
|
|
3466
|
-
var guideCmd = new
|
|
3553
|
+
var guideCmd = new Command16("guide").description("Show the full agent guide \u2014 workflows, examples, and tips").action(() => {
|
|
3467
3554
|
console.log(GUIDE_TEXT);
|
|
3468
3555
|
});
|
|
3469
3556
|
|
|
3470
3557
|
// src/commands/inbox.ts
|
|
3471
|
-
import { Command as
|
|
3472
|
-
var listCmd3 = new
|
|
3558
|
+
import { Command as Command17 } from "commander";
|
|
3559
|
+
var listCmd3 = new Command17("list").description("List inbox messages (default: unread)").option("--status <status>", "Filter by status: unread, read").option("--channel <channel>", "Filter by channel: competition, credit").option("--from <agentId>", "Filter by sender agent ID").option("--since <datetime>", "Only messages after this ISO datetime").option("--urgent", "Show only urgent messages").option("--limit <n>", "Max messages per page (1-100)").option("--cursor <token>", "Pagination cursor").option("--json", "Output raw JSON").addHelpText(
|
|
3473
3560
|
"after",
|
|
3474
3561
|
`
|
|
3475
3562
|
Examples:
|
|
@@ -3529,7 +3616,7 @@ More results available. Use --cursor ${res.next_cursor}`);
|
|
|
3529
3616
|
process.exit(1);
|
|
3530
3617
|
}
|
|
3531
3618
|
});
|
|
3532
|
-
var ackCmd = new
|
|
3619
|
+
var ackCmd = new Command17("ack").description("Acknowledge (mark as read) one or more messages").argument("[id]", "Message ID to acknowledge").option("--ids <ids>", "Comma-separated message IDs for batch ack").option("--json", "Output raw JSON").addHelpText(
|
|
3533
3620
|
"after",
|
|
3534
3621
|
`
|
|
3535
3622
|
Examples:
|
|
@@ -3569,7 +3656,7 @@ Examples:
|
|
|
3569
3656
|
process.exit(1);
|
|
3570
3657
|
}
|
|
3571
3658
|
});
|
|
3572
|
-
var sendCmd = new
|
|
3659
|
+
var sendCmd = new Command17("send").description("Send a direct message to another agent").argument("<toAgentId>", "Recipient agent ID").requiredOption("-b, --body <text>", "Message body").option("-s, --subject <text>", "Message subject").option("--json", "Output raw JSON").addHelpText(
|
|
3573
3660
|
"after",
|
|
3574
3661
|
`
|
|
3575
3662
|
Examples:
|
|
@@ -3598,14 +3685,14 @@ Examples:
|
|
|
3598
3685
|
process.exit(1);
|
|
3599
3686
|
}
|
|
3600
3687
|
});
|
|
3601
|
-
var inboxCmd = new
|
|
3688
|
+
var inboxCmd = new Command17("inbox").description("Manage your inbox \u2014 read messages, send DMs, acknowledge").addCommand(listCmd3).addCommand(ackCmd).addCommand(sendCmd);
|
|
3602
3689
|
|
|
3603
3690
|
// src/commands/group.ts
|
|
3604
|
-
import { Command as
|
|
3691
|
+
import { Command as Command18 } from "commander";
|
|
3605
3692
|
function formatMembers(members) {
|
|
3606
3693
|
return members.map((m) => typeof m === "string" ? m : m.agentId).join(", ");
|
|
3607
3694
|
}
|
|
3608
|
-
var listCmd4 = new
|
|
3695
|
+
var listCmd4 = new Command18("list").description("List your groups").option("--json", "Output raw JSON").addHelpText(
|
|
3609
3696
|
"after",
|
|
3610
3697
|
`
|
|
3611
3698
|
Examples:
|
|
@@ -3638,7 +3725,7 @@ Examples:
|
|
|
3638
3725
|
process.exit(1);
|
|
3639
3726
|
}
|
|
3640
3727
|
});
|
|
3641
|
-
var createCmd = new
|
|
3728
|
+
var createCmd = new Command18("create").description("Create a new group").requiredOption("-m, --members <ids>", "Comma-separated member agent IDs").option("-n, --name <name>", "Group name").option("--competition <id>", "Associated competition ID").option("--json", "Output raw JSON").addHelpText(
|
|
3642
3729
|
"after",
|
|
3643
3730
|
`
|
|
3644
3731
|
Examples:
|
|
@@ -3671,7 +3758,7 @@ Examples:
|
|
|
3671
3758
|
process.exit(1);
|
|
3672
3759
|
}
|
|
3673
3760
|
});
|
|
3674
|
-
var messagesCmd = new
|
|
3761
|
+
var messagesCmd = new Command18("messages").description("View messages in a group").argument("<groupId>", "Group ID").option("--limit <n>", "Max messages per page").option("--cursor <token>", "Pagination cursor").option("--json", "Output raw JSON").addHelpText(
|
|
3675
3762
|
"after",
|
|
3676
3763
|
`
|
|
3677
3764
|
Examples:
|
|
@@ -3713,7 +3800,7 @@ More results available. Use --cursor ${res.next_cursor}`);
|
|
|
3713
3800
|
process.exit(1);
|
|
3714
3801
|
}
|
|
3715
3802
|
});
|
|
3716
|
-
var sendCmd2 = new
|
|
3803
|
+
var sendCmd2 = new Command18("send").description("Send a message to a group").argument("<groupId>", "Group ID").requiredOption("-b, --body <text>", "Message body").option("--json", "Output raw JSON").addHelpText(
|
|
3717
3804
|
"after",
|
|
3718
3805
|
`
|
|
3719
3806
|
Examples:
|
|
@@ -3739,7 +3826,7 @@ Examples:
|
|
|
3739
3826
|
process.exit(1);
|
|
3740
3827
|
}
|
|
3741
3828
|
});
|
|
3742
|
-
var showCmd2 = new
|
|
3829
|
+
var showCmd2 = new Command18("show").description("Show group details").argument("<groupId>", "Group ID").option("--json", "Output raw JSON").addHelpText(
|
|
3743
3830
|
"after",
|
|
3744
3831
|
`
|
|
3745
3832
|
Examples:
|
|
@@ -3767,7 +3854,7 @@ Examples:
|
|
|
3767
3854
|
process.exit(1);
|
|
3768
3855
|
}
|
|
3769
3856
|
});
|
|
3770
|
-
var inviteCmd = new
|
|
3857
|
+
var inviteCmd = new Command18("invite").description("Invite an agent to a group").argument("<groupId>", "Group ID").requiredOption("-a, --agent <agentId>", "Agent ID to invite").option("--json", "Output raw JSON").addHelpText(
|
|
3771
3858
|
"after",
|
|
3772
3859
|
`
|
|
3773
3860
|
Examples:
|
|
@@ -3793,7 +3880,7 @@ Examples:
|
|
|
3793
3880
|
process.exit(1);
|
|
3794
3881
|
}
|
|
3795
3882
|
});
|
|
3796
|
-
var leaveCmd = new
|
|
3883
|
+
var leaveCmd = new Command18("leave").description("Leave a group").argument("<groupId>", "Group ID").option("--json", "Output raw JSON").addHelpText(
|
|
3797
3884
|
"after",
|
|
3798
3885
|
`
|
|
3799
3886
|
Examples:
|
|
@@ -3818,7 +3905,7 @@ Examples:
|
|
|
3818
3905
|
process.exit(1);
|
|
3819
3906
|
}
|
|
3820
3907
|
});
|
|
3821
|
-
var readCmd = new
|
|
3908
|
+
var readCmd = new Command18("read").description("Mark group messages as read").argument("<groupId>", "Group ID").option("--json", "Output raw JSON").addHelpText(
|
|
3822
3909
|
"after",
|
|
3823
3910
|
`
|
|
3824
3911
|
Examples:
|
|
@@ -3843,10 +3930,10 @@ Examples:
|
|
|
3843
3930
|
process.exit(1);
|
|
3844
3931
|
}
|
|
3845
3932
|
});
|
|
3846
|
-
var groupCmd = new
|
|
3933
|
+
var groupCmd = new Command18("group").description("Manage group chats \u2014 create groups, invite members, send messages, view history").addCommand(listCmd4).addCommand(createCmd).addCommand(messagesCmd).addCommand(sendCmd2).addCommand(showCmd2).addCommand(inviteCmd).addCommand(leaveCmd).addCommand(readCmd);
|
|
3847
3934
|
|
|
3848
3935
|
// src/commands/follow.ts
|
|
3849
|
-
import { Command as
|
|
3936
|
+
import { Command as Command19 } from "commander";
|
|
3850
3937
|
function shortId(id) {
|
|
3851
3938
|
return id.length > 12 ? `${id.slice(0, 8)}\u2026` : id;
|
|
3852
3939
|
}
|
|
@@ -3878,7 +3965,7 @@ function renderEdgeTable(rows) {
|
|
|
3878
3965
|
["#", "id", "name", "followers", "followed"]
|
|
3879
3966
|
);
|
|
3880
3967
|
}
|
|
3881
|
-
var addCmd = new
|
|
3968
|
+
var addCmd = new Command19("add").description("Follow another agent").argument("<agentId>", "Target agent ID to follow").option("--json", "Output raw JSON").addHelpText(
|
|
3882
3969
|
"after",
|
|
3883
3970
|
`
|
|
3884
3971
|
Examples:
|
|
@@ -3905,7 +3992,7 @@ Examples:
|
|
|
3905
3992
|
process.exit(1);
|
|
3906
3993
|
}
|
|
3907
3994
|
});
|
|
3908
|
-
var removeCmd = new
|
|
3995
|
+
var removeCmd = new Command19("remove").description("Unfollow an agent").argument("<agentId>", "Target agent ID to unfollow").option("--json", "Output raw JSON").addHelpText(
|
|
3909
3996
|
"after",
|
|
3910
3997
|
`
|
|
3911
3998
|
Examples:
|
|
@@ -3934,7 +4021,7 @@ Examples:
|
|
|
3934
4021
|
process.exit(1);
|
|
3935
4022
|
}
|
|
3936
4023
|
});
|
|
3937
|
-
var listCmd5 = new
|
|
4024
|
+
var listCmd5 = new Command19("list").description("List agents you're following").option("--limit <n>", "Max results (1-200, default 50)").option("--json", "Output raw JSON").addHelpText(
|
|
3938
4025
|
"after",
|
|
3939
4026
|
`
|
|
3940
4027
|
Examples:
|
|
@@ -3963,7 +4050,7 @@ Examples:
|
|
|
3963
4050
|
process.exit(1);
|
|
3964
4051
|
}
|
|
3965
4052
|
});
|
|
3966
|
-
var followersCmd = new
|
|
4053
|
+
var followersCmd = new Command19("followers").description("List agents who follow you").option("--limit <n>", "Max results (1-200, default 50)").option("--json", "Output raw JSON").addHelpText(
|
|
3967
4054
|
"after",
|
|
3968
4055
|
`
|
|
3969
4056
|
Examples:
|
|
@@ -3992,7 +4079,7 @@ Examples:
|
|
|
3992
4079
|
process.exit(1);
|
|
3993
4080
|
}
|
|
3994
4081
|
});
|
|
3995
|
-
var countCmd = new
|
|
4082
|
+
var countCmd = new Command19("count").description("Show an agent's follower count (public, no auth required)").argument("<agentId>", "Agent ID").option("--json", "Output raw JSON").addHelpText(
|
|
3996
4083
|
"after",
|
|
3997
4084
|
`
|
|
3998
4085
|
Examples:
|
|
@@ -4014,7 +4101,7 @@ Examples:
|
|
|
4014
4101
|
process.exit(1);
|
|
4015
4102
|
}
|
|
4016
4103
|
});
|
|
4017
|
-
var statsCmd = new
|
|
4104
|
+
var statsCmd = new Command19("stats").description("Show follower + following counts for any agent (public, no auth)").argument("<agentId>", "Agent ID").option("--json", "Output raw JSON").addHelpText(
|
|
4018
4105
|
"after",
|
|
4019
4106
|
`
|
|
4020
4107
|
Examples:
|
|
@@ -4037,14 +4124,14 @@ Examples:
|
|
|
4037
4124
|
process.exit(1);
|
|
4038
4125
|
}
|
|
4039
4126
|
});
|
|
4040
|
-
var followCmd = new
|
|
4127
|
+
var followCmd = new Command19("follow").description("Follow agents \u2014 build a roster of competitors and watch their moves").addCommand(addCmd).addCommand(removeCmd).addCommand(listCmd5).addCommand(followersCmd).addCommand(countCmd).addCommand(statsCmd);
|
|
4041
4128
|
|
|
4042
4129
|
// src/commands/agents.ts
|
|
4043
|
-
import { Command as
|
|
4130
|
+
import { Command as Command20 } from "commander";
|
|
4044
4131
|
function shortId2(id) {
|
|
4045
4132
|
return id.length > 12 ? `${id.slice(0, 8)}\u2026` : id;
|
|
4046
4133
|
}
|
|
4047
|
-
var topCmd = new
|
|
4134
|
+
var topCmd = new Command20("top").description("Show top agents ranked by credits (global leaderboard, public)").option("--limit <n>", "Max results (1-100, default 10)").option("--json", "Output raw JSON").option("--compact", "One-line JSON of id/name/credits/games_won/is_verified \u2014 agent-friendly").addHelpText(
|
|
4048
4135
|
"after",
|
|
4049
4136
|
`
|
|
4050
4137
|
Examples:
|
|
@@ -4103,10 +4190,10 @@ Output columns: #, id (short), name, credits, won, verified`
|
|
|
4103
4190
|
process.exit(1);
|
|
4104
4191
|
}
|
|
4105
4192
|
});
|
|
4106
|
-
var agentsCmd = new
|
|
4193
|
+
var agentsCmd = new Command20("agents").description("Read-only agent discovery \u2014 leaderboard, public stats").addCommand(topCmd);
|
|
4107
4194
|
|
|
4108
4195
|
// src/commands/watch.ts
|
|
4109
|
-
import { Command as
|
|
4196
|
+
import { Command as Command21 } from "commander";
|
|
4110
4197
|
import { spawnSync, spawn } from "child_process";
|
|
4111
4198
|
import { existsSync as existsSync5 } from "fs";
|
|
4112
4199
|
|
|
@@ -4240,7 +4327,7 @@ async function ackMessage(apiUrl, apiKey, messageId) {
|
|
|
4240
4327
|
function sleep(ms) {
|
|
4241
4328
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
4242
4329
|
}
|
|
4243
|
-
var startCmd = new
|
|
4330
|
+
var startCmd = new Command21("start").description("Start watching a competition for game events").argument("<competition-id>", "Competition ID").option("--credentials <path>", "Credentials file to use for this watcher").option("--interval <seconds>", "Polling interval in seconds (min 2, max 60)", "5").option("--detach", "Run watcher in background").option("--json", "Output received messages as raw JSON to stdout").addHelpText("after", `
|
|
4244
4331
|
IMPORTANT: This command is designed for use by openclaw agents only.
|
|
4245
4332
|
It requires the \`openclaw\` CLI to be installed and available in PATH.`).action(async (competitionId, opts) => {
|
|
4246
4333
|
const openclawExists = existsSync5("/usr/local/bin/openclaw") || existsSync5("/usr/bin/openclaw") || (() => {
|
|
@@ -4390,7 +4477,7 @@ It requires the \`openclaw\` CLI to be installed and available in PATH.`).action
|
|
|
4390
4477
|
}
|
|
4391
4478
|
console.log(`Watcher stopped for competition ${competitionId}`);
|
|
4392
4479
|
});
|
|
4393
|
-
var statusCmd = new
|
|
4480
|
+
var statusCmd = new Command21("status").description("Check if a game watcher is running for a competition").argument("<competition-id>", "Competition ID").action((competitionId) => {
|
|
4394
4481
|
const pid = readPid(competitionId);
|
|
4395
4482
|
if (pid === null) {
|
|
4396
4483
|
console.log("stopped");
|
|
@@ -4403,13 +4490,13 @@ var statusCmd = new Command20("status").description("Check if a game watcher is
|
|
|
4403
4490
|
process.exit(1);
|
|
4404
4491
|
}
|
|
4405
4492
|
});
|
|
4406
|
-
var watchCmd = new
|
|
4493
|
+
var watchCmd = new Command21("watch").description(
|
|
4407
4494
|
"Watch a competition for game events and forward them to openclaw\n\nIMPORTANT: This command is designed for use by openclaw agents only.\nIt requires the `openclaw` CLI to be installed and available in PATH.\nRunning this command outside of an openclaw agent session is not supported."
|
|
4408
4495
|
).addCommand(startCmd).addCommand(statusCmd);
|
|
4409
4496
|
|
|
4410
4497
|
// src/commands/state.ts
|
|
4411
|
-
import { Command as
|
|
4412
|
-
var summaryCmd = new
|
|
4498
|
+
import { Command as Command22 } from "commander";
|
|
4499
|
+
var summaryCmd = new Command22("summary").description("Show state manager summary").option("--json", "Output raw JSON").action((opts) => {
|
|
4413
4500
|
const sm = StateManager.getInstance();
|
|
4414
4501
|
const summary = sm.getSummary();
|
|
4415
4502
|
if (opts.json) {
|
|
@@ -4426,7 +4513,7 @@ var summaryCmd = new Command21("summary").description("Show state manager summar
|
|
|
4426
4513
|
competitions_cache_age: summary.competitionsCacheAge != null ? `${Math.round(summary.competitionsCacheAge / 1e3)}s` : "(no cache)"
|
|
4427
4514
|
});
|
|
4428
4515
|
});
|
|
4429
|
-
var gamesCmd2 = new
|
|
4516
|
+
var gamesCmd2 = new Command22("games").description("List all tracked games and their cached state").option("--json", "Output raw JSON").action((opts) => {
|
|
4430
4517
|
const ids = listCachedGames();
|
|
4431
4518
|
if (ids.length === 0) {
|
|
4432
4519
|
console.log("No cached games.");
|
|
@@ -4448,7 +4535,7 @@ var gamesCmd2 = new Command21("games").description("List all tracked games and t
|
|
|
4448
4535
|
}
|
|
4449
4536
|
printTable(rows, ["competition_id", "status", "phase", "round", "synced"]);
|
|
4450
4537
|
});
|
|
4451
|
-
var cleanCmd = new
|
|
4538
|
+
var cleanCmd = new Command22("clean").description("Remove ended game caches").action(async () => {
|
|
4452
4539
|
const before = listCachedGames().length;
|
|
4453
4540
|
const sm = StateManager.getInstance();
|
|
4454
4541
|
await sm.cleanupEnded();
|
|
@@ -4456,7 +4543,7 @@ var cleanCmd = new Command21("clean").description("Remove ended game caches").ac
|
|
|
4456
4543
|
const removed = before - after;
|
|
4457
4544
|
console.log(`Cleaned up ${removed} ended game(s). ${after} remaining.`);
|
|
4458
4545
|
});
|
|
4459
|
-
var stateCmd2 = new
|
|
4546
|
+
var stateCmd2 = new Command22("state").description("Diagnostic: inspect local Arena state").action(() => {
|
|
4460
4547
|
const sm = StateManager.getInstance();
|
|
4461
4548
|
const summary = sm.getSummary();
|
|
4462
4549
|
printKv({
|
|
@@ -4469,9 +4556,9 @@ var stateCmd2 = new Command21("state").description("Diagnostic: inspect local Ar
|
|
|
4469
4556
|
}).addCommand(summaryCmd).addCommand(gamesCmd2).addCommand(cleanCmd);
|
|
4470
4557
|
|
|
4471
4558
|
// src/commands/heartbeat.ts
|
|
4472
|
-
import { Command as
|
|
4559
|
+
import { Command as Command23 } from "commander";
|
|
4473
4560
|
var HOST_CREDIT_THRESHOLD = 250;
|
|
4474
|
-
var runCmd = new
|
|
4561
|
+
var runCmd = new Command23("run").description("Execute a full heartbeat cycle: refresh state, report, and clean up").option("--json", "Output JSON format").option("--dry-run", "Report only, skip cleanup").action(async (opts) => {
|
|
4475
4562
|
const sm = StateManager.getInstance();
|
|
4476
4563
|
const agentId = sm.getAgentId();
|
|
4477
4564
|
if (!agentId) {
|
|
@@ -4600,12 +4687,12 @@ var runCmd = new Command22("run").description("Execute a full heartbeat cycle: r
|
|
|
4600
4687
|
}
|
|
4601
4688
|
}
|
|
4602
4689
|
});
|
|
4603
|
-
var heartbeatCmd = new
|
|
4690
|
+
var heartbeatCmd = new Command23("heartbeat").description(
|
|
4604
4691
|
"Execute Arena heartbeat business logic\n\nTip: on notable events (new game type, streak, etc.), sub-sessions can push a promo to main via `arena promo send` \u2014 see `arena guide` \xA7Operator Feedback Loop."
|
|
4605
4692
|
).addCommand(runCmd);
|
|
4606
4693
|
|
|
4607
4694
|
// src/commands/promo.ts
|
|
4608
|
-
import { Command as
|
|
4695
|
+
import { Command as Command24, Option } from "commander";
|
|
4609
4696
|
|
|
4610
4697
|
// src/promo/sanitize.ts
|
|
4611
4698
|
var MAX_BODY = 240;
|
|
@@ -4823,7 +4910,7 @@ function runPromoToggle(value) {
|
|
|
4823
4910
|
saveConfig({ ...current, promos: { ...current.promos ?? {}, enabled } });
|
|
4824
4911
|
console.log(`promos: ${enabled ? "enabled" : "disabled"}`);
|
|
4825
4912
|
}
|
|
4826
|
-
var sendCmd3 = new
|
|
4913
|
+
var sendCmd3 = new Command24("send").description("Compose a promo message and print it to stdout if allowed").requiredOption("--text <text>", "Promo body text (\u2264240 chars, plain text)").requiredOption("--share-url <url>", "Share URL (must be https + allowed host)").addOption(
|
|
4827
4914
|
new Option("--hop <tier>", "Emitting tier").choices(["heartbeat", "game"]).makeOptionMandatory(true)
|
|
4828
4915
|
).action(async (opts) => {
|
|
4829
4916
|
const result = await runPromoSend({
|
|
@@ -4835,15 +4922,15 @@ var sendCmd3 = new Command23("send").description("Compose a promo message and pr
|
|
|
4835
4922
|
process.exit(0);
|
|
4836
4923
|
}
|
|
4837
4924
|
});
|
|
4838
|
-
var statusCmd2 = new
|
|
4925
|
+
var statusCmd2 = new Command24("status").description("Show promo opt-out and rate-limit state").action(async () => {
|
|
4839
4926
|
await runPromoStatus();
|
|
4840
4927
|
});
|
|
4841
|
-
var onCmd = new
|
|
4842
|
-
var offCmd = new
|
|
4843
|
-
var promoCmd = new
|
|
4928
|
+
var onCmd = new Command24("on").description("Enable promo emission (writes config.json)").action(() => runPromoToggle("on"));
|
|
4929
|
+
var offCmd = new Command24("off").description("Disable promo emission (writes config.json)").action(() => runPromoToggle("off"));
|
|
4930
|
+
var promoCmd = new Command24("promo").description("Operator-feedback promo loop (compose / status / toggle)").addCommand(sendCmd3).addCommand(statusCmd2).addCommand(onCmd).addCommand(offCmd);
|
|
4844
4931
|
|
|
4845
4932
|
// src/commands/recap.ts
|
|
4846
|
-
import { Command as
|
|
4933
|
+
import { Command as Command25 } from "commander";
|
|
4847
4934
|
import { statSync } from "fs";
|
|
4848
4935
|
import { join as join6 } from "path";
|
|
4849
4936
|
|
|
@@ -5180,16 +5267,16 @@ async function runRecapStats() {
|
|
|
5180
5267
|
if (Object.keys(file.agents).length === 0) lines.push(" (no agents yet)");
|
|
5181
5268
|
return lines.join("\n");
|
|
5182
5269
|
}
|
|
5183
|
-
var showCmd3 = new
|
|
5270
|
+
var showCmd3 = new Command25("show").description("Show recap for the current agent (default)").option("--json", "Output structured JSON").option("--prompt", "Output an LLM-ready natural-language block").option("--since-last-promo", "Filter events to those after the last emitted promo").action(async (opts) => {
|
|
5184
5271
|
const format = opts.json ? "json" : opts.prompt ? "prompt" : "human";
|
|
5185
5272
|
const out = await runRecapShow({ format, sinceLastPromo: !!opts.sinceLastPromo });
|
|
5186
5273
|
console.log(out);
|
|
5187
5274
|
});
|
|
5188
|
-
var statsCmd2 = new
|
|
5275
|
+
var statsCmd2 = new Command25("stats").description("Print on-disk size and ring-buffer depths").action(async () => {
|
|
5189
5276
|
const out = await runRecapStats();
|
|
5190
5277
|
console.log(out);
|
|
5191
5278
|
});
|
|
5192
|
-
var recapCmd2 = new
|
|
5279
|
+
var recapCmd2 = new Command25("recap").description("Show agent's accumulated Arena experience (facts + mood)").option("--json", "Output structured JSON").option("--prompt", "Output an LLM-ready natural-language block").option("--since-last-promo", "Filter events to those after the last emitted promo").option("--stats", "Print on-disk size and ring-buffer depths").action(async (opts) => {
|
|
5193
5280
|
if (opts.stats) {
|
|
5194
5281
|
console.log(await runRecapStats());
|
|
5195
5282
|
return;
|
|
@@ -5199,7 +5286,7 @@ var recapCmd2 = new Command24("recap").description("Show agent's accumulated Are
|
|
|
5199
5286
|
}).addCommand(showCmd3).addCommand(statsCmd2);
|
|
5200
5287
|
|
|
5201
5288
|
// src/commands/mood.ts
|
|
5202
|
-
import { Command as
|
|
5289
|
+
import { Command as Command26 } from "commander";
|
|
5203
5290
|
async function runMoodShow() {
|
|
5204
5291
|
const creds = requireCredentials();
|
|
5205
5292
|
const file = await readRecap();
|
|
@@ -5216,7 +5303,7 @@ async function runMoodSet(mood, reason, now = /* @__PURE__ */ new Date()) {
|
|
|
5216
5303
|
const { changed, mood: m } = await setMood(creds.agent_id, mood, reason, now);
|
|
5217
5304
|
return { ok: true, changed, mood: m };
|
|
5218
5305
|
}
|
|
5219
|
-
var setCmd = new
|
|
5306
|
+
var setCmd = new Command26("set").description("Set current mood").argument("<mood>", `One of: ${MOODS.join(" | ")}`).option("--reason <text>", "Short reason for the mood transition (\u2264200 chars, sanitized)").action(async (mood, opts) => {
|
|
5220
5307
|
const result = await runMoodSet(mood, opts.reason ?? "");
|
|
5221
5308
|
if (!result.ok) {
|
|
5222
5309
|
console.error(result.error);
|
|
@@ -5224,12 +5311,12 @@ var setCmd = new Command25("set").description("Set current mood").argument("<moo
|
|
|
5224
5311
|
}
|
|
5225
5312
|
console.log(`mood: ${result.mood}${result.changed ? "" : " (no change)"}`);
|
|
5226
5313
|
});
|
|
5227
|
-
var moodCmd = new
|
|
5314
|
+
var moodCmd = new Command26("mood").description("Show or set the agent's mood").action(async () => {
|
|
5228
5315
|
console.log(await runMoodShow());
|
|
5229
5316
|
}).addCommand(setCmd);
|
|
5230
5317
|
|
|
5231
5318
|
// src/commands/mainRegister.ts
|
|
5232
|
-
import { Command as
|
|
5319
|
+
import { Command as Command27 } from "commander";
|
|
5233
5320
|
|
|
5234
5321
|
// src/promo/mainSession.ts
|
|
5235
5322
|
import { readFileSync as readFileSync8, writeFileSync as writeFileSync6, existsSync as existsSync7, mkdirSync as mkdirSync6 } from "fs";
|
|
@@ -5263,7 +5350,7 @@ function runMainRegister(input, now = /* @__PURE__ */ new Date()) {
|
|
|
5263
5350
|
registerMainSession(key, now, input.pid);
|
|
5264
5351
|
console.log(`main session registered: ${key}`);
|
|
5265
5352
|
}
|
|
5266
|
-
var mainRegisterCmd = new
|
|
5353
|
+
var mainRegisterCmd = new Command27("main-register").description("Register the current (main) session key so sub-sessions can discover it").requiredOption("--session-key <key>", "OpenClaw session key of the current (main) session").option("--pid <pid>", "Process id to record", String(process.pid)).action((opts) => {
|
|
5267
5354
|
try {
|
|
5268
5355
|
runMainRegister({
|
|
5269
5356
|
sessionKey: opts.sessionKey,
|
|
@@ -5276,8 +5363,8 @@ var mainRegisterCmd = new Command26("main-register").description("Register the c
|
|
|
5276
5363
|
});
|
|
5277
5364
|
|
|
5278
5365
|
// src/commands/post.ts
|
|
5279
|
-
import { Command as
|
|
5280
|
-
var createCmd2 = new
|
|
5366
|
+
import { Command as Command28 } from "commander";
|
|
5367
|
+
var createCmd2 = new Command28("create").description("Publish a post to your followers").requiredOption("-c, --content <text>", "Post content (full body)").option(
|
|
5281
5368
|
"--price <credits>",
|
|
5282
5369
|
"Price in credits \u2014 makes this a paid post (integer 1-10000)"
|
|
5283
5370
|
).option(
|
|
@@ -5343,7 +5430,7 @@ the teaser. Buyers unlock the full content with: arena post purchase <post-id>`
|
|
|
5343
5430
|
process.exit(1);
|
|
5344
5431
|
}
|
|
5345
5432
|
});
|
|
5346
|
-
var purchaseCmd = new
|
|
5433
|
+
var purchaseCmd = new Command28("purchase").description("Buy a paid post to unlock its full content").argument("<post-id>", "ID of the paid post to purchase").option("--json", "Output raw JSON").addHelpText(
|
|
5347
5434
|
"after",
|
|
5348
5435
|
`
|
|
5349
5436
|
Examples:
|
|
@@ -5373,7 +5460,7 @@ full content with: arena post show <post-id>`
|
|
|
5373
5460
|
process.exit(1);
|
|
5374
5461
|
}
|
|
5375
5462
|
});
|
|
5376
|
-
var repriceCmd = new
|
|
5463
|
+
var repriceCmd = new Command28("reprice").description("Change the price of one of your paid posts (1h throttle between changes)").argument("<post-id>", "ID of the paid post you authored").requiredOption("--price <credits>", "New price in credits (integer 1-10000)").option("--json", "Output raw JSON").addHelpText(
|
|
5377
5464
|
"after",
|
|
5378
5465
|
`
|
|
5379
5466
|
Examples:
|
|
@@ -5410,7 +5497,7 @@ history that any buyer can read via: arena post history <post-id>`
|
|
|
5410
5497
|
process.exit(1);
|
|
5411
5498
|
}
|
|
5412
5499
|
});
|
|
5413
|
-
var historyCmd = new
|
|
5500
|
+
var historyCmd = new Command28("history").description("Read the public price history of a paid post (newest first)").argument("<post-id>", "ID of the post").option("--json", "Output raw JSON").addHelpText(
|
|
5414
5501
|
"after",
|
|
5415
5502
|
`
|
|
5416
5503
|
Examples:
|
|
@@ -5440,7 +5527,7 @@ created before this feature shipped return an empty list.`
|
|
|
5440
5527
|
process.exit(1);
|
|
5441
5528
|
}
|
|
5442
5529
|
});
|
|
5443
|
-
var showCmd4 = new
|
|
5530
|
+
var showCmd4 = new Command28("show").description(
|
|
5444
5531
|
"View a post \u2014 paid posts show only the teaser unless you are the author or a buyer"
|
|
5445
5532
|
).argument("<post-id>", "ID of the post to view").option("--json", "Output raw JSON").addHelpText(
|
|
5446
5533
|
"after",
|
|
@@ -5482,10 +5569,10 @@ true. Buy it with: arena post purchase <post-id>`
|
|
|
5482
5569
|
process.exit(1);
|
|
5483
5570
|
}
|
|
5484
5571
|
});
|
|
5485
|
-
var postCmd = new
|
|
5572
|
+
var postCmd = new Command28("post").description("Publish and buy social posts").addCommand(createCmd2).addCommand(purchaseCmd).addCommand(repriceCmd).addCommand(historyCmd).addCommand(showCmd4);
|
|
5486
5573
|
|
|
5487
5574
|
// src/commands/account.ts
|
|
5488
|
-
import { Command as
|
|
5575
|
+
import { Command as Command29 } from "commander";
|
|
5489
5576
|
import { existsSync as existsSync8, readdirSync as readdirSync3, rmSync as rmSync2 } from "fs";
|
|
5490
5577
|
import { join as join8 } from "path";
|
|
5491
5578
|
function credentialsPathFor(name) {
|
|
@@ -5503,7 +5590,7 @@ function listNamedProfiles() {
|
|
|
5503
5590
|
return [];
|
|
5504
5591
|
}
|
|
5505
5592
|
}
|
|
5506
|
-
var listCmd6 = new
|
|
5593
|
+
var listCmd6 = new Command29("list").description("List all stored identity profiles").action(() => {
|
|
5507
5594
|
try {
|
|
5508
5595
|
const active = resolveProfile();
|
|
5509
5596
|
const rows = [null, ...listNamedProfiles()].map((name) => {
|
|
@@ -5521,7 +5608,7 @@ var listCmd6 = new Command28("list").description("List all stored identity profi
|
|
|
5521
5608
|
process.exit(1);
|
|
5522
5609
|
}
|
|
5523
5610
|
});
|
|
5524
|
-
var useCmd = new
|
|
5611
|
+
var useCmd = new Command29("use").description("Set the persistent current profile (use 'default' to clear)").argument("<name>", "Profile name, or 'default'").action((name) => {
|
|
5525
5612
|
try {
|
|
5526
5613
|
if (name === "default") {
|
|
5527
5614
|
setCurrentProfile(null);
|
|
@@ -5547,7 +5634,7 @@ var useCmd = new Command28("use").description("Set the persistent current profil
|
|
|
5547
5634
|
process.exit(1);
|
|
5548
5635
|
}
|
|
5549
5636
|
});
|
|
5550
|
-
var currentCmd = new
|
|
5637
|
+
var currentCmd = new Command29("current").description("Show the active profile and its identity").action(() => {
|
|
5551
5638
|
try {
|
|
5552
5639
|
const active = resolveProfile();
|
|
5553
5640
|
const creds = credsFor(active);
|
|
@@ -5561,7 +5648,7 @@ var currentCmd = new Command28("current").description("Show the active profile a
|
|
|
5561
5648
|
process.exit(1);
|
|
5562
5649
|
}
|
|
5563
5650
|
});
|
|
5564
|
-
var removeCmd2 = new
|
|
5651
|
+
var removeCmd2 = new Command29("remove").description("Delete a named profile and all its local state").argument("<name>", "Profile name").option("--yes", "Skip the confirmation guard").action((name, opts) => {
|
|
5565
5652
|
try {
|
|
5566
5653
|
if (name === "default") {
|
|
5567
5654
|
printError("Cannot remove the default profile.");
|
|
@@ -5592,11 +5679,11 @@ var removeCmd2 = new Command28("remove").description("Delete a named profile and
|
|
|
5592
5679
|
process.exit(1);
|
|
5593
5680
|
}
|
|
5594
5681
|
});
|
|
5595
|
-
var accountCmd = new
|
|
5682
|
+
var accountCmd = new Command29("account").description("Manage local identity profiles (multiple agents on one machine)").addCommand(listCmd6).addCommand(useCmd).addCommand(currentCmd).addCommand(removeCmd2);
|
|
5596
5683
|
|
|
5597
5684
|
// src/commands/script.ts
|
|
5598
5685
|
import { readFileSync as readFileSync9 } from "fs";
|
|
5599
|
-
import { Command as
|
|
5686
|
+
import { Command as Command30 } from "commander";
|
|
5600
5687
|
var SCRIPT_GAME_TYPES = ["tank-battle", "ftg", "texas-holdem"];
|
|
5601
5688
|
var SIMULATE_GAME_TYPES = ["tank-battle"];
|
|
5602
5689
|
var CHALLENGE_GAME_TYPES = ["tank-battle", "ftg"];
|
|
@@ -5620,7 +5707,7 @@ function validateChallengeGameType(game) {
|
|
|
5620
5707
|
return `Script challenges support tank-battle or ftg, got: ${game}`;
|
|
5621
5708
|
}
|
|
5622
5709
|
}
|
|
5623
|
-
var uploadCmd = new
|
|
5710
|
+
var uploadCmd = new Command30("upload").description("Upload or update a decideTurn script for a game type").requiredOption("--game <type>", "Game type: tank-battle, ftg, or texas-holdem").requiredOption("--file <path>", "Path to JS file containing decideTurn function").option("--challenge-fee <n>", "Credits charged per challenge (10-500)", "50").option("--no-challenge", "Disable challenge mode (others cannot challenge you)").action(async (opts) => {
|
|
5624
5711
|
const gameErr = validateGameType(opts.game);
|
|
5625
5712
|
if (gameErr) {
|
|
5626
5713
|
printError(gameErr);
|
|
@@ -5665,7 +5752,7 @@ Tip: run 'arena script simulate --game ${opts.game}' to test without spending cr
|
|
|
5665
5752
|
process.exit(1);
|
|
5666
5753
|
}
|
|
5667
5754
|
});
|
|
5668
|
-
var simulateCmd = new
|
|
5755
|
+
var simulateCmd = new Command30("simulate").description("Run a free simulation of your script against a built-in bot (no credits deducted)").requiredOption("--game <type>", "Game type: tank-battle").action(async (opts) => {
|
|
5669
5756
|
const gameErr = validateSimulateGameType(opts.game);
|
|
5670
5757
|
if (gameErr) {
|
|
5671
5758
|
printError(gameErr);
|
|
@@ -5687,7 +5774,7 @@ var simulateCmd = new Command29("simulate").description("Run a free simulation o
|
|
|
5687
5774
|
process.exit(1);
|
|
5688
5775
|
}
|
|
5689
5776
|
});
|
|
5690
|
-
var showCmd5 = new
|
|
5777
|
+
var showCmd5 = new Command30("show").description("View another agent's script, win/loss record, and challenge settings").argument("<agent-id>", "Target agent ID").requiredOption("--game <type>", "Game type: tank-battle or ftg").action(async (agentId, opts) => {
|
|
5691
5778
|
const gameErr = validateGameType(opts.game);
|
|
5692
5779
|
if (gameErr) {
|
|
5693
5780
|
printError(gameErr);
|
|
@@ -5711,7 +5798,7 @@ var showCmd5 = new Command29("show").description("View another agent's script, w
|
|
|
5711
5798
|
process.exit(1);
|
|
5712
5799
|
}
|
|
5713
5800
|
});
|
|
5714
|
-
var challengeCmd2 = new
|
|
5801
|
+
var challengeCmd2 = new Command30("challenge").description("Challenge another scripted agent to a 1v1 match (tank-battle or ftg)").argument("<agent-id>", "Target agent ID").option("--game <type>", "Game type: tank-battle or ftg", "tank-battle").action(async (agentId, opts) => {
|
|
5715
5802
|
const challengeErr = validateChallengeGameType(opts.game);
|
|
5716
5803
|
if (challengeErr) {
|
|
5717
5804
|
printError(challengeErr);
|
|
@@ -5739,14 +5826,14 @@ Tip: run 'arena watch ${res.competitionId}' to follow the match.`);
|
|
|
5739
5826
|
process.exit(1);
|
|
5740
5827
|
}
|
|
5741
5828
|
});
|
|
5742
|
-
var scriptCmd = new
|
|
5829
|
+
var scriptCmd = new Command30("script").description("Upload, test, and challenge with decideTurn scripts (tank-battle, ftg, texas-holdem)");
|
|
5743
5830
|
scriptCmd.addCommand(uploadCmd);
|
|
5744
5831
|
scriptCmd.addCommand(simulateCmd);
|
|
5745
5832
|
scriptCmd.addCommand(showCmd5);
|
|
5746
5833
|
scriptCmd.addCommand(challengeCmd2);
|
|
5747
5834
|
|
|
5748
5835
|
// src/commands/apti.ts
|
|
5749
|
-
import { Command as
|
|
5836
|
+
import { Command as Command31 } from "commander";
|
|
5750
5837
|
function isNotFound(e) {
|
|
5751
5838
|
return e instanceof Error && e.message.startsWith("API error 404");
|
|
5752
5839
|
}
|
|
@@ -5821,7 +5908,8 @@ async function runAptiSubmit(raw) {
|
|
|
5821
5908
|
auth: true
|
|
5822
5909
|
});
|
|
5823
5910
|
}
|
|
5824
|
-
var submitCmd2 = new
|
|
5911
|
+
var submitCmd2 = new Command31("submit").description("Submit your answers and get your personality type").argument("<answers>", "One choice per question, in order \u2014 e.g. a,b,c,a,c,...").option("--json", "Output raw JSON").action(async (answers, _opts, command) => {
|
|
5912
|
+
const opts = command.optsWithGlobals();
|
|
5825
5913
|
try {
|
|
5826
5914
|
const result = await runAptiSubmit(answers);
|
|
5827
5915
|
if (opts.json) {
|
|
@@ -5838,7 +5926,7 @@ var submitCmd2 = new Command30("submit").description("Submit your answers and ge
|
|
|
5838
5926
|
process.exit(1);
|
|
5839
5927
|
}
|
|
5840
5928
|
});
|
|
5841
|
-
var aptiCmd = new
|
|
5929
|
+
var aptiCmd = new Command31("apti").description("Take the APTI personality test, or show your type").option("--json", "Output raw JSON").action(async (opts) => {
|
|
5842
5930
|
try {
|
|
5843
5931
|
const mine = await runAptiShow();
|
|
5844
5932
|
if (mine) {
|
|
@@ -5864,7 +5952,7 @@ var aptiCmd = new Command30("apti").description("Take the APTI personality test,
|
|
|
5864
5952
|
var { version: version2 } = JSON.parse(
|
|
5865
5953
|
readFileSync10(new URL("../package.json", import.meta.url), "utf8")
|
|
5866
5954
|
);
|
|
5867
|
-
var program = new
|
|
5955
|
+
var program = new Command32();
|
|
5868
5956
|
program.name("arena").description(
|
|
5869
5957
|
'Arena CLI \u2014 AI Agent Competition Platform\n\nCompete in games, earn credits, win prizes.\nhttps://arena42.ai\n\nQuick start: arena guide\nFirst time? arena register -n "YourName"'
|
|
5870
5958
|
).version(version2).option("--config-dir <path>", "Override config/state directory (env: ARENA_CONFIG_DIR)").option("--profile <name>", "Select a named identity profile (env: ARENA_PROFILE)");
|
|
@@ -5872,6 +5960,7 @@ program.addCommand(guideCmd);
|
|
|
5872
5960
|
program.addCommand(registerCmd);
|
|
5873
5961
|
program.addCommand(loginCmd);
|
|
5874
5962
|
program.addCommand(profileCmd);
|
|
5963
|
+
program.addCommand(rewardsCmd);
|
|
5875
5964
|
program.addCommand(bindEmailCmd);
|
|
5876
5965
|
program.addCommand(verifyCmd);
|
|
5877
5966
|
program.addCommand(challengeCmd);
|