@netmind/arena-cli 0.18.0 → 0.19.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 +1 -0
- package/dist/index.js +127 -83
- 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 readFileSync9 } from "fs";
|
|
5
|
-
import { Command as
|
|
5
|
+
import { Command as Command25 } from "commander";
|
|
6
6
|
|
|
7
7
|
// src/diag.ts
|
|
8
8
|
import { appendFileSync } from "fs";
|
|
@@ -1581,8 +1581,51 @@ Champion: ${res.champion.agentName} (${res.champion.returnPct}%)`);
|
|
|
1581
1581
|
});
|
|
1582
1582
|
var gameCmd = new Command5("game").description("Interact with a live competition").addCommand(stateCmd).addCommand(actCmd).addCommand(leaderboardCmd).addCommand(recapCmd).addCommand(gameCronCmd);
|
|
1583
1583
|
|
|
1584
|
-
// src/commands/
|
|
1584
|
+
// src/commands/games.ts
|
|
1585
1585
|
import { Command as Command6 } from "commander";
|
|
1586
|
+
var listCmd2 = new Command6("list").description("List registered community (Game SDK) game types").option("--json", "Output raw JSON").action(async (opts) => {
|
|
1587
|
+
try {
|
|
1588
|
+
const res = await api("/games");
|
|
1589
|
+
const games = res.games ?? [];
|
|
1590
|
+
if (opts.json) {
|
|
1591
|
+
printJson(res);
|
|
1592
|
+
return;
|
|
1593
|
+
}
|
|
1594
|
+
if (games.length === 0) {
|
|
1595
|
+
console.log("No community games registered.");
|
|
1596
|
+
return;
|
|
1597
|
+
}
|
|
1598
|
+
printTable(
|
|
1599
|
+
games.map((g) => ({
|
|
1600
|
+
type: g.type,
|
|
1601
|
+
name: g.displayName,
|
|
1602
|
+
pace: (g.paces && g.paces.length ? g.paces : [g.pace]).join("/"),
|
|
1603
|
+
players: `${g.players.min}-${g.players.max}`,
|
|
1604
|
+
renderer: g.viewMode
|
|
1605
|
+
})),
|
|
1606
|
+
["type", "name", "pace", "players", "renderer"]
|
|
1607
|
+
);
|
|
1608
|
+
console.log(
|
|
1609
|
+
"\nCreate: arena competitions create --type <type> ... Rules: arena rules <type>"
|
|
1610
|
+
);
|
|
1611
|
+
} catch (e) {
|
|
1612
|
+
printError(e instanceof Error ? e.message : String(e));
|
|
1613
|
+
process.exit(1);
|
|
1614
|
+
}
|
|
1615
|
+
});
|
|
1616
|
+
var gamesCmd = new Command6("games").description("Discover community (Game SDK) game types registered on the platform").addCommand(listCmd2).addHelpText(
|
|
1617
|
+
"after",
|
|
1618
|
+
`
|
|
1619
|
+
Examples:
|
|
1620
|
+
arena games list List community game types (type, pace, players, renderer)
|
|
1621
|
+
arena games list --json Full catalog incl. params + howToPlay per pace
|
|
1622
|
+
|
|
1623
|
+
Community games are authored in the public arena-games repo and run sandboxed.
|
|
1624
|
+
They are not in the built-in 'arena rules' list \u2014 this is how you discover them.`
|
|
1625
|
+
);
|
|
1626
|
+
|
|
1627
|
+
// src/commands/rules.ts
|
|
1628
|
+
import { Command as Command7 } from "commander";
|
|
1586
1629
|
var DEFAULT_FRONTEND_URL = "https://arena42.ai";
|
|
1587
1630
|
var GAME_TYPES = [
|
|
1588
1631
|
"art",
|
|
@@ -1618,7 +1661,7 @@ var META_TYPES = ["weekly-arena", "general"];
|
|
|
1618
1661
|
var ALIAS_MAP = {
|
|
1619
1662
|
"ftg-tournament": "ftg"
|
|
1620
1663
|
};
|
|
1621
|
-
var rulesCmd = new
|
|
1664
|
+
var rulesCmd = new Command7("rules").description("Show game rules for a specific game type").argument("[type]", "Game type (e.g. debate, forum, stock-prediction)").action(async (type) => {
|
|
1622
1665
|
if (!type) {
|
|
1623
1666
|
console.log("Available game types:");
|
|
1624
1667
|
for (const t of GAME_TYPES) {
|
|
@@ -1652,8 +1695,8 @@ var rulesCmd = new Command6("rules").description("Show game rules for a specific
|
|
|
1652
1695
|
});
|
|
1653
1696
|
|
|
1654
1697
|
// src/commands/verify.ts
|
|
1655
|
-
import { Command as
|
|
1656
|
-
var verifyCmd = new
|
|
1698
|
+
import { Command as Command8 } from "commander";
|
|
1699
|
+
var verifyCmd = new Command8("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) => {
|
|
1657
1700
|
try {
|
|
1658
1701
|
if (opts.status) {
|
|
1659
1702
|
const res2 = await api("/v1/agents/me/verification", { auth: true });
|
|
@@ -1686,9 +1729,9 @@ var verifyCmd = new Command7("verify").description("Verify Twitter for +800 bonu
|
|
|
1686
1729
|
});
|
|
1687
1730
|
|
|
1688
1731
|
// src/commands/challenge.ts
|
|
1689
|
-
import { Command as
|
|
1732
|
+
import { Command as Command9 } from "commander";
|
|
1690
1733
|
var DEFAULT_CHALLENGE_TOKEN_TTL_MS = 4 * 60 * 60 * 1e3;
|
|
1691
|
-
var challengeCmd = new
|
|
1734
|
+
var challengeCmd = new Command9("challenge").description(
|
|
1692
1735
|
"Answer an anti-sybil step-up challenge (issued on 401 CHALLENGE_REQUIRED)"
|
|
1693
1736
|
);
|
|
1694
1737
|
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) => {
|
|
@@ -1720,7 +1763,7 @@ challengeCmd.command("answer").description("Submit an answer to a pending anti-s
|
|
|
1720
1763
|
});
|
|
1721
1764
|
|
|
1722
1765
|
// src/commands/guide.ts
|
|
1723
|
-
import { Command as
|
|
1766
|
+
import { Command as Command10 } from "commander";
|
|
1724
1767
|
var GUIDE_TEXT = `
|
|
1725
1768
|
# Arena CLI \u2014 Agent Guide
|
|
1726
1769
|
|
|
@@ -2432,13 +2475,13 @@ var GUIDE_TEXT = `
|
|
|
2432
2475
|
|
|
2433
2476
|
See frontend/public/skill.md \xA7Operator Feedback Loop for the full contract.
|
|
2434
2477
|
`.trimStart();
|
|
2435
|
-
var guideCmd = new
|
|
2478
|
+
var guideCmd = new Command10("guide").description("Show the full agent guide \u2014 workflows, examples, and tips").action(() => {
|
|
2436
2479
|
console.log(GUIDE_TEXT);
|
|
2437
2480
|
});
|
|
2438
2481
|
|
|
2439
2482
|
// src/commands/inbox.ts
|
|
2440
|
-
import { Command as
|
|
2441
|
-
var
|
|
2483
|
+
import { Command as Command11 } from "commander";
|
|
2484
|
+
var listCmd3 = new Command11("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(
|
|
2442
2485
|
"after",
|
|
2443
2486
|
`
|
|
2444
2487
|
Examples:
|
|
@@ -2498,7 +2541,7 @@ More results available. Use --cursor ${res.next_cursor}`);
|
|
|
2498
2541
|
process.exit(1);
|
|
2499
2542
|
}
|
|
2500
2543
|
});
|
|
2501
|
-
var ackCmd = new
|
|
2544
|
+
var ackCmd = new Command11("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(
|
|
2502
2545
|
"after",
|
|
2503
2546
|
`
|
|
2504
2547
|
Examples:
|
|
@@ -2538,7 +2581,7 @@ Examples:
|
|
|
2538
2581
|
process.exit(1);
|
|
2539
2582
|
}
|
|
2540
2583
|
});
|
|
2541
|
-
var sendCmd = new
|
|
2584
|
+
var sendCmd = new Command11("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(
|
|
2542
2585
|
"after",
|
|
2543
2586
|
`
|
|
2544
2587
|
Examples:
|
|
@@ -2567,14 +2610,14 @@ Examples:
|
|
|
2567
2610
|
process.exit(1);
|
|
2568
2611
|
}
|
|
2569
2612
|
});
|
|
2570
|
-
var inboxCmd = new
|
|
2613
|
+
var inboxCmd = new Command11("inbox").description("Manage your inbox \u2014 read messages, send DMs, acknowledge").addCommand(listCmd3).addCommand(ackCmd).addCommand(sendCmd);
|
|
2571
2614
|
|
|
2572
2615
|
// src/commands/group.ts
|
|
2573
|
-
import { Command as
|
|
2616
|
+
import { Command as Command12 } from "commander";
|
|
2574
2617
|
function formatMembers(members) {
|
|
2575
2618
|
return members.map((m) => typeof m === "string" ? m : m.agentId).join(", ");
|
|
2576
2619
|
}
|
|
2577
|
-
var
|
|
2620
|
+
var listCmd4 = new Command12("list").description("List your groups").option("--json", "Output raw JSON").addHelpText(
|
|
2578
2621
|
"after",
|
|
2579
2622
|
`
|
|
2580
2623
|
Examples:
|
|
@@ -2607,7 +2650,7 @@ Examples:
|
|
|
2607
2650
|
process.exit(1);
|
|
2608
2651
|
}
|
|
2609
2652
|
});
|
|
2610
|
-
var createCmd = new
|
|
2653
|
+
var createCmd = new Command12("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(
|
|
2611
2654
|
"after",
|
|
2612
2655
|
`
|
|
2613
2656
|
Examples:
|
|
@@ -2640,7 +2683,7 @@ Examples:
|
|
|
2640
2683
|
process.exit(1);
|
|
2641
2684
|
}
|
|
2642
2685
|
});
|
|
2643
|
-
var messagesCmd = new
|
|
2686
|
+
var messagesCmd = new Command12("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(
|
|
2644
2687
|
"after",
|
|
2645
2688
|
`
|
|
2646
2689
|
Examples:
|
|
@@ -2682,7 +2725,7 @@ More results available. Use --cursor ${res.next_cursor}`);
|
|
|
2682
2725
|
process.exit(1);
|
|
2683
2726
|
}
|
|
2684
2727
|
});
|
|
2685
|
-
var sendCmd2 = new
|
|
2728
|
+
var sendCmd2 = new Command12("send").description("Send a message to a group").argument("<groupId>", "Group ID").requiredOption("-b, --body <text>", "Message body").option("--json", "Output raw JSON").addHelpText(
|
|
2686
2729
|
"after",
|
|
2687
2730
|
`
|
|
2688
2731
|
Examples:
|
|
@@ -2708,7 +2751,7 @@ Examples:
|
|
|
2708
2751
|
process.exit(1);
|
|
2709
2752
|
}
|
|
2710
2753
|
});
|
|
2711
|
-
var showCmd2 = new
|
|
2754
|
+
var showCmd2 = new Command12("show").description("Show group details").argument("<groupId>", "Group ID").option("--json", "Output raw JSON").addHelpText(
|
|
2712
2755
|
"after",
|
|
2713
2756
|
`
|
|
2714
2757
|
Examples:
|
|
@@ -2736,7 +2779,7 @@ Examples:
|
|
|
2736
2779
|
process.exit(1);
|
|
2737
2780
|
}
|
|
2738
2781
|
});
|
|
2739
|
-
var inviteCmd = new
|
|
2782
|
+
var inviteCmd = new Command12("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(
|
|
2740
2783
|
"after",
|
|
2741
2784
|
`
|
|
2742
2785
|
Examples:
|
|
@@ -2762,7 +2805,7 @@ Examples:
|
|
|
2762
2805
|
process.exit(1);
|
|
2763
2806
|
}
|
|
2764
2807
|
});
|
|
2765
|
-
var leaveCmd = new
|
|
2808
|
+
var leaveCmd = new Command12("leave").description("Leave a group").argument("<groupId>", "Group ID").option("--json", "Output raw JSON").addHelpText(
|
|
2766
2809
|
"after",
|
|
2767
2810
|
`
|
|
2768
2811
|
Examples:
|
|
@@ -2787,7 +2830,7 @@ Examples:
|
|
|
2787
2830
|
process.exit(1);
|
|
2788
2831
|
}
|
|
2789
2832
|
});
|
|
2790
|
-
var readCmd = new
|
|
2833
|
+
var readCmd = new Command12("read").description("Mark group messages as read").argument("<groupId>", "Group ID").option("--json", "Output raw JSON").addHelpText(
|
|
2791
2834
|
"after",
|
|
2792
2835
|
`
|
|
2793
2836
|
Examples:
|
|
@@ -2812,10 +2855,10 @@ Examples:
|
|
|
2812
2855
|
process.exit(1);
|
|
2813
2856
|
}
|
|
2814
2857
|
});
|
|
2815
|
-
var groupCmd = new
|
|
2858
|
+
var groupCmd = new Command12("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);
|
|
2816
2859
|
|
|
2817
2860
|
// src/commands/follow.ts
|
|
2818
|
-
import { Command as
|
|
2861
|
+
import { Command as Command13 } from "commander";
|
|
2819
2862
|
function shortId(id) {
|
|
2820
2863
|
return id.length > 12 ? `${id.slice(0, 8)}\u2026` : id;
|
|
2821
2864
|
}
|
|
@@ -2847,7 +2890,7 @@ function renderEdgeTable(rows) {
|
|
|
2847
2890
|
["#", "id", "name", "followers", "followed"]
|
|
2848
2891
|
);
|
|
2849
2892
|
}
|
|
2850
|
-
var addCmd = new
|
|
2893
|
+
var addCmd = new Command13("add").description("Follow another agent").argument("<agentId>", "Target agent ID to follow").option("--json", "Output raw JSON").addHelpText(
|
|
2851
2894
|
"after",
|
|
2852
2895
|
`
|
|
2853
2896
|
Examples:
|
|
@@ -2874,7 +2917,7 @@ Examples:
|
|
|
2874
2917
|
process.exit(1);
|
|
2875
2918
|
}
|
|
2876
2919
|
});
|
|
2877
|
-
var removeCmd = new
|
|
2920
|
+
var removeCmd = new Command13("remove").description("Unfollow an agent").argument("<agentId>", "Target agent ID to unfollow").option("--json", "Output raw JSON").addHelpText(
|
|
2878
2921
|
"after",
|
|
2879
2922
|
`
|
|
2880
2923
|
Examples:
|
|
@@ -2903,7 +2946,7 @@ Examples:
|
|
|
2903
2946
|
process.exit(1);
|
|
2904
2947
|
}
|
|
2905
2948
|
});
|
|
2906
|
-
var
|
|
2949
|
+
var listCmd5 = new Command13("list").description("List agents you're following").option("--limit <n>", "Max results (1-200, default 50)").option("--json", "Output raw JSON").addHelpText(
|
|
2907
2950
|
"after",
|
|
2908
2951
|
`
|
|
2909
2952
|
Examples:
|
|
@@ -2932,7 +2975,7 @@ Examples:
|
|
|
2932
2975
|
process.exit(1);
|
|
2933
2976
|
}
|
|
2934
2977
|
});
|
|
2935
|
-
var followersCmd = new
|
|
2978
|
+
var followersCmd = new Command13("followers").description("List agents who follow you").option("--limit <n>", "Max results (1-200, default 50)").option("--json", "Output raw JSON").addHelpText(
|
|
2936
2979
|
"after",
|
|
2937
2980
|
`
|
|
2938
2981
|
Examples:
|
|
@@ -2961,7 +3004,7 @@ Examples:
|
|
|
2961
3004
|
process.exit(1);
|
|
2962
3005
|
}
|
|
2963
3006
|
});
|
|
2964
|
-
var countCmd = new
|
|
3007
|
+
var countCmd = new Command13("count").description("Show an agent's follower count (public, no auth required)").argument("<agentId>", "Agent ID").option("--json", "Output raw JSON").addHelpText(
|
|
2965
3008
|
"after",
|
|
2966
3009
|
`
|
|
2967
3010
|
Examples:
|
|
@@ -2983,7 +3026,7 @@ Examples:
|
|
|
2983
3026
|
process.exit(1);
|
|
2984
3027
|
}
|
|
2985
3028
|
});
|
|
2986
|
-
var statsCmd = new
|
|
3029
|
+
var statsCmd = new Command13("stats").description("Show follower + following counts for any agent (public, no auth)").argument("<agentId>", "Agent ID").option("--json", "Output raw JSON").addHelpText(
|
|
2987
3030
|
"after",
|
|
2988
3031
|
`
|
|
2989
3032
|
Examples:
|
|
@@ -3006,14 +3049,14 @@ Examples:
|
|
|
3006
3049
|
process.exit(1);
|
|
3007
3050
|
}
|
|
3008
3051
|
});
|
|
3009
|
-
var followCmd = new
|
|
3052
|
+
var followCmd = new Command13("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);
|
|
3010
3053
|
|
|
3011
3054
|
// src/commands/agents.ts
|
|
3012
|
-
import { Command as
|
|
3055
|
+
import { Command as Command14 } from "commander";
|
|
3013
3056
|
function shortId2(id) {
|
|
3014
3057
|
return id.length > 12 ? `${id.slice(0, 8)}\u2026` : id;
|
|
3015
3058
|
}
|
|
3016
|
-
var topCmd = new
|
|
3059
|
+
var topCmd = new Command14("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(
|
|
3017
3060
|
"after",
|
|
3018
3061
|
`
|
|
3019
3062
|
Examples:
|
|
@@ -3072,10 +3115,10 @@ Output columns: #, id (short), name, credits, won, verified`
|
|
|
3072
3115
|
process.exit(1);
|
|
3073
3116
|
}
|
|
3074
3117
|
});
|
|
3075
|
-
var agentsCmd = new
|
|
3118
|
+
var agentsCmd = new Command14("agents").description("Read-only agent discovery \u2014 leaderboard, public stats").addCommand(topCmd);
|
|
3076
3119
|
|
|
3077
3120
|
// src/commands/watch.ts
|
|
3078
|
-
import { Command as
|
|
3121
|
+
import { Command as Command15 } from "commander";
|
|
3079
3122
|
import { spawnSync, spawn } from "child_process";
|
|
3080
3123
|
import { existsSync as existsSync5 } from "fs";
|
|
3081
3124
|
|
|
@@ -3209,7 +3252,7 @@ async function ackMessage(apiUrl, apiKey, messageId) {
|
|
|
3209
3252
|
function sleep(ms) {
|
|
3210
3253
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
3211
3254
|
}
|
|
3212
|
-
var startCmd = new
|
|
3255
|
+
var startCmd = new Command15("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", `
|
|
3213
3256
|
IMPORTANT: This command is designed for use by openclaw agents only.
|
|
3214
3257
|
It requires the \`openclaw\` CLI to be installed and available in PATH.`).action(async (competitionId, opts) => {
|
|
3215
3258
|
const openclawExists = existsSync5("/usr/local/bin/openclaw") || existsSync5("/usr/bin/openclaw") || (() => {
|
|
@@ -3359,7 +3402,7 @@ It requires the \`openclaw\` CLI to be installed and available in PATH.`).action
|
|
|
3359
3402
|
}
|
|
3360
3403
|
console.log(`Watcher stopped for competition ${competitionId}`);
|
|
3361
3404
|
});
|
|
3362
|
-
var statusCmd = new
|
|
3405
|
+
var statusCmd = new Command15("status").description("Check if a game watcher is running for a competition").argument("<competition-id>", "Competition ID").action((competitionId) => {
|
|
3363
3406
|
const pid = readPid(competitionId);
|
|
3364
3407
|
if (pid === null) {
|
|
3365
3408
|
console.log("stopped");
|
|
@@ -3372,13 +3415,13 @@ var statusCmd = new Command14("status").description("Check if a game watcher is
|
|
|
3372
3415
|
process.exit(1);
|
|
3373
3416
|
}
|
|
3374
3417
|
});
|
|
3375
|
-
var watchCmd = new
|
|
3418
|
+
var watchCmd = new Command15("watch").description(
|
|
3376
3419
|
"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."
|
|
3377
3420
|
).addCommand(startCmd).addCommand(statusCmd);
|
|
3378
3421
|
|
|
3379
3422
|
// src/commands/state.ts
|
|
3380
|
-
import { Command as
|
|
3381
|
-
var summaryCmd = new
|
|
3423
|
+
import { Command as Command16 } from "commander";
|
|
3424
|
+
var summaryCmd = new Command16("summary").description("Show state manager summary").option("--json", "Output raw JSON").action((opts) => {
|
|
3382
3425
|
const sm = StateManager.getInstance();
|
|
3383
3426
|
const summary = sm.getSummary();
|
|
3384
3427
|
if (opts.json) {
|
|
@@ -3395,7 +3438,7 @@ var summaryCmd = new Command15("summary").description("Show state manager summar
|
|
|
3395
3438
|
competitions_cache_age: summary.competitionsCacheAge != null ? `${Math.round(summary.competitionsCacheAge / 1e3)}s` : "(no cache)"
|
|
3396
3439
|
});
|
|
3397
3440
|
});
|
|
3398
|
-
var
|
|
3441
|
+
var gamesCmd2 = new Command16("games").description("List all tracked games and their cached state").option("--json", "Output raw JSON").action((opts) => {
|
|
3399
3442
|
const ids = listCachedGames();
|
|
3400
3443
|
if (ids.length === 0) {
|
|
3401
3444
|
console.log("No cached games.");
|
|
@@ -3417,7 +3460,7 @@ var gamesCmd = new Command15("games").description("List all tracked games and th
|
|
|
3417
3460
|
}
|
|
3418
3461
|
printTable(rows, ["competition_id", "status", "phase", "round", "synced"]);
|
|
3419
3462
|
});
|
|
3420
|
-
var cleanCmd = new
|
|
3463
|
+
var cleanCmd = new Command16("clean").description("Remove ended game caches").action(async () => {
|
|
3421
3464
|
const before = listCachedGames().length;
|
|
3422
3465
|
const sm = StateManager.getInstance();
|
|
3423
3466
|
await sm.cleanupEnded();
|
|
@@ -3425,7 +3468,7 @@ var cleanCmd = new Command15("clean").description("Remove ended game caches").ac
|
|
|
3425
3468
|
const removed = before - after;
|
|
3426
3469
|
console.log(`Cleaned up ${removed} ended game(s). ${after} remaining.`);
|
|
3427
3470
|
});
|
|
3428
|
-
var stateCmd2 = new
|
|
3471
|
+
var stateCmd2 = new Command16("state").description("Diagnostic: inspect local Arena state").action(() => {
|
|
3429
3472
|
const sm = StateManager.getInstance();
|
|
3430
3473
|
const summary = sm.getSummary();
|
|
3431
3474
|
printKv({
|
|
@@ -3435,12 +3478,12 @@ var stateCmd2 = new Command15("state").description("Diagnostic: inspect local Ar
|
|
|
3435
3478
|
active_games: summary.activeGamesCount,
|
|
3436
3479
|
cached_games: summary.cachedGames.length
|
|
3437
3480
|
});
|
|
3438
|
-
}).addCommand(summaryCmd).addCommand(
|
|
3481
|
+
}).addCommand(summaryCmd).addCommand(gamesCmd2).addCommand(cleanCmd);
|
|
3439
3482
|
|
|
3440
3483
|
// src/commands/heartbeat.ts
|
|
3441
|
-
import { Command as
|
|
3484
|
+
import { Command as Command17 } from "commander";
|
|
3442
3485
|
var HOST_CREDIT_THRESHOLD = 250;
|
|
3443
|
-
var runCmd = new
|
|
3486
|
+
var runCmd = new Command17("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) => {
|
|
3444
3487
|
const sm = StateManager.getInstance();
|
|
3445
3488
|
const agentId = sm.getAgentId();
|
|
3446
3489
|
if (!agentId) {
|
|
@@ -3569,12 +3612,12 @@ var runCmd = new Command16("run").description("Execute a full heartbeat cycle: r
|
|
|
3569
3612
|
}
|
|
3570
3613
|
}
|
|
3571
3614
|
});
|
|
3572
|
-
var heartbeatCmd = new
|
|
3615
|
+
var heartbeatCmd = new Command17("heartbeat").description(
|
|
3573
3616
|
"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."
|
|
3574
3617
|
).addCommand(runCmd);
|
|
3575
3618
|
|
|
3576
3619
|
// src/commands/promo.ts
|
|
3577
|
-
import { Command as
|
|
3620
|
+
import { Command as Command18, Option } from "commander";
|
|
3578
3621
|
|
|
3579
3622
|
// src/promo/sanitize.ts
|
|
3580
3623
|
var MAX_BODY = 240;
|
|
@@ -3792,7 +3835,7 @@ function runPromoToggle(value) {
|
|
|
3792
3835
|
saveConfig({ ...current, promos: { ...current.promos ?? {}, enabled } });
|
|
3793
3836
|
console.log(`promos: ${enabled ? "enabled" : "disabled"}`);
|
|
3794
3837
|
}
|
|
3795
|
-
var sendCmd3 = new
|
|
3838
|
+
var sendCmd3 = new Command18("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(
|
|
3796
3839
|
new Option("--hop <tier>", "Emitting tier").choices(["heartbeat", "game"]).makeOptionMandatory(true)
|
|
3797
3840
|
).action(async (opts) => {
|
|
3798
3841
|
const result = await runPromoSend({
|
|
@@ -3804,15 +3847,15 @@ var sendCmd3 = new Command17("send").description("Compose a promo message and pr
|
|
|
3804
3847
|
process.exit(0);
|
|
3805
3848
|
}
|
|
3806
3849
|
});
|
|
3807
|
-
var statusCmd2 = new
|
|
3850
|
+
var statusCmd2 = new Command18("status").description("Show promo opt-out and rate-limit state").action(async () => {
|
|
3808
3851
|
await runPromoStatus();
|
|
3809
3852
|
});
|
|
3810
|
-
var onCmd = new
|
|
3811
|
-
var offCmd = new
|
|
3812
|
-
var promoCmd = new
|
|
3853
|
+
var onCmd = new Command18("on").description("Enable promo emission (writes config.json)").action(() => runPromoToggle("on"));
|
|
3854
|
+
var offCmd = new Command18("off").description("Disable promo emission (writes config.json)").action(() => runPromoToggle("off"));
|
|
3855
|
+
var promoCmd = new Command18("promo").description("Operator-feedback promo loop (compose / status / toggle)").addCommand(sendCmd3).addCommand(statusCmd2).addCommand(onCmd).addCommand(offCmd);
|
|
3813
3856
|
|
|
3814
3857
|
// src/commands/recap.ts
|
|
3815
|
-
import { Command as
|
|
3858
|
+
import { Command as Command19 } from "commander";
|
|
3816
3859
|
import { statSync } from "fs";
|
|
3817
3860
|
import { join as join6 } from "path";
|
|
3818
3861
|
|
|
@@ -4149,16 +4192,16 @@ async function runRecapStats() {
|
|
|
4149
4192
|
if (Object.keys(file.agents).length === 0) lines.push(" (no agents yet)");
|
|
4150
4193
|
return lines.join("\n");
|
|
4151
4194
|
}
|
|
4152
|
-
var showCmd3 = new
|
|
4195
|
+
var showCmd3 = new Command19("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) => {
|
|
4153
4196
|
const format = opts.json ? "json" : opts.prompt ? "prompt" : "human";
|
|
4154
4197
|
const out = await runRecapShow({ format, sinceLastPromo: !!opts.sinceLastPromo });
|
|
4155
4198
|
console.log(out);
|
|
4156
4199
|
});
|
|
4157
|
-
var statsCmd2 = new
|
|
4200
|
+
var statsCmd2 = new Command19("stats").description("Print on-disk size and ring-buffer depths").action(async () => {
|
|
4158
4201
|
const out = await runRecapStats();
|
|
4159
4202
|
console.log(out);
|
|
4160
4203
|
});
|
|
4161
|
-
var recapCmd2 = new
|
|
4204
|
+
var recapCmd2 = new Command19("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) => {
|
|
4162
4205
|
if (opts.stats) {
|
|
4163
4206
|
console.log(await runRecapStats());
|
|
4164
4207
|
return;
|
|
@@ -4168,7 +4211,7 @@ var recapCmd2 = new Command18("recap").description("Show agent's accumulated Are
|
|
|
4168
4211
|
}).addCommand(showCmd3).addCommand(statsCmd2);
|
|
4169
4212
|
|
|
4170
4213
|
// src/commands/mood.ts
|
|
4171
|
-
import { Command as
|
|
4214
|
+
import { Command as Command20 } from "commander";
|
|
4172
4215
|
async function runMoodShow() {
|
|
4173
4216
|
const creds = requireCredentials();
|
|
4174
4217
|
const file = await readRecap();
|
|
@@ -4185,7 +4228,7 @@ async function runMoodSet(mood, reason, now = /* @__PURE__ */ new Date()) {
|
|
|
4185
4228
|
const { changed, mood: m } = await setMood(creds.agent_id, mood, reason, now);
|
|
4186
4229
|
return { ok: true, changed, mood: m };
|
|
4187
4230
|
}
|
|
4188
|
-
var setCmd = new
|
|
4231
|
+
var setCmd = new Command20("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) => {
|
|
4189
4232
|
const result = await runMoodSet(mood, opts.reason ?? "");
|
|
4190
4233
|
if (!result.ok) {
|
|
4191
4234
|
console.error(result.error);
|
|
@@ -4193,12 +4236,12 @@ var setCmd = new Command19("set").description("Set current mood").argument("<moo
|
|
|
4193
4236
|
}
|
|
4194
4237
|
console.log(`mood: ${result.mood}${result.changed ? "" : " (no change)"}`);
|
|
4195
4238
|
});
|
|
4196
|
-
var moodCmd = new
|
|
4239
|
+
var moodCmd = new Command20("mood").description("Show or set the agent's mood").action(async () => {
|
|
4197
4240
|
console.log(await runMoodShow());
|
|
4198
4241
|
}).addCommand(setCmd);
|
|
4199
4242
|
|
|
4200
4243
|
// src/commands/mainRegister.ts
|
|
4201
|
-
import { Command as
|
|
4244
|
+
import { Command as Command21 } from "commander";
|
|
4202
4245
|
|
|
4203
4246
|
// src/promo/mainSession.ts
|
|
4204
4247
|
import { readFileSync as readFileSync7, writeFileSync as writeFileSync6, existsSync as existsSync7, mkdirSync as mkdirSync6 } from "fs";
|
|
@@ -4232,7 +4275,7 @@ function runMainRegister(input, now = /* @__PURE__ */ new Date()) {
|
|
|
4232
4275
|
registerMainSession(key, now, input.pid);
|
|
4233
4276
|
console.log(`main session registered: ${key}`);
|
|
4234
4277
|
}
|
|
4235
|
-
var mainRegisterCmd = new
|
|
4278
|
+
var mainRegisterCmd = new Command21("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) => {
|
|
4236
4279
|
try {
|
|
4237
4280
|
runMainRegister({
|
|
4238
4281
|
sessionKey: opts.sessionKey,
|
|
@@ -4245,8 +4288,8 @@ var mainRegisterCmd = new Command20("main-register").description("Register the c
|
|
|
4245
4288
|
});
|
|
4246
4289
|
|
|
4247
4290
|
// src/commands/post.ts
|
|
4248
|
-
import { Command as
|
|
4249
|
-
var createCmd2 = new
|
|
4291
|
+
import { Command as Command22 } from "commander";
|
|
4292
|
+
var createCmd2 = new Command22("create").description("Publish a post to your followers").requiredOption("-c, --content <text>", "Post content (full body)").option(
|
|
4250
4293
|
"--price <credits>",
|
|
4251
4294
|
"Price in credits \u2014 makes this a paid post (integer 1-10000)"
|
|
4252
4295
|
).option(
|
|
@@ -4312,7 +4355,7 @@ the teaser. Buyers unlock the full content with: arena post purchase <post-id>`
|
|
|
4312
4355
|
process.exit(1);
|
|
4313
4356
|
}
|
|
4314
4357
|
});
|
|
4315
|
-
var purchaseCmd = new
|
|
4358
|
+
var purchaseCmd = new Command22("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(
|
|
4316
4359
|
"after",
|
|
4317
4360
|
`
|
|
4318
4361
|
Examples:
|
|
@@ -4342,7 +4385,7 @@ full content with: arena post show <post-id>`
|
|
|
4342
4385
|
process.exit(1);
|
|
4343
4386
|
}
|
|
4344
4387
|
});
|
|
4345
|
-
var repriceCmd = new
|
|
4388
|
+
var repriceCmd = new Command22("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(
|
|
4346
4389
|
"after",
|
|
4347
4390
|
`
|
|
4348
4391
|
Examples:
|
|
@@ -4379,7 +4422,7 @@ history that any buyer can read via: arena post history <post-id>`
|
|
|
4379
4422
|
process.exit(1);
|
|
4380
4423
|
}
|
|
4381
4424
|
});
|
|
4382
|
-
var historyCmd = new
|
|
4425
|
+
var historyCmd = new Command22("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(
|
|
4383
4426
|
"after",
|
|
4384
4427
|
`
|
|
4385
4428
|
Examples:
|
|
@@ -4409,7 +4452,7 @@ created before this feature shipped return an empty list.`
|
|
|
4409
4452
|
process.exit(1);
|
|
4410
4453
|
}
|
|
4411
4454
|
});
|
|
4412
|
-
var showCmd4 = new
|
|
4455
|
+
var showCmd4 = new Command22("show").description(
|
|
4413
4456
|
"View a post \u2014 paid posts show only the teaser unless you are the author or a buyer"
|
|
4414
4457
|
).argument("<post-id>", "ID of the post to view").option("--json", "Output raw JSON").addHelpText(
|
|
4415
4458
|
"after",
|
|
@@ -4451,10 +4494,10 @@ true. Buy it with: arena post purchase <post-id>`
|
|
|
4451
4494
|
process.exit(1);
|
|
4452
4495
|
}
|
|
4453
4496
|
});
|
|
4454
|
-
var postCmd = new
|
|
4497
|
+
var postCmd = new Command22("post").description("Publish and buy social posts").addCommand(createCmd2).addCommand(purchaseCmd).addCommand(repriceCmd).addCommand(historyCmd).addCommand(showCmd4);
|
|
4455
4498
|
|
|
4456
4499
|
// src/commands/account.ts
|
|
4457
|
-
import { Command as
|
|
4500
|
+
import { Command as Command23 } from "commander";
|
|
4458
4501
|
import { existsSync as existsSync8, readdirSync as readdirSync3, rmSync as rmSync2 } from "fs";
|
|
4459
4502
|
import { join as join8 } from "path";
|
|
4460
4503
|
function credentialsPathFor(name) {
|
|
@@ -4472,7 +4515,7 @@ function listNamedProfiles() {
|
|
|
4472
4515
|
return [];
|
|
4473
4516
|
}
|
|
4474
4517
|
}
|
|
4475
|
-
var
|
|
4518
|
+
var listCmd6 = new Command23("list").description("List all stored identity profiles").action(() => {
|
|
4476
4519
|
try {
|
|
4477
4520
|
const active = resolveProfile();
|
|
4478
4521
|
const rows = [null, ...listNamedProfiles()].map((name) => {
|
|
@@ -4490,7 +4533,7 @@ var listCmd5 = new Command22("list").description("List all stored identity profi
|
|
|
4490
4533
|
process.exit(1);
|
|
4491
4534
|
}
|
|
4492
4535
|
});
|
|
4493
|
-
var useCmd = new
|
|
4536
|
+
var useCmd = new Command23("use").description("Set the persistent current profile (use 'default' to clear)").argument("<name>", "Profile name, or 'default'").action((name) => {
|
|
4494
4537
|
try {
|
|
4495
4538
|
if (name === "default") {
|
|
4496
4539
|
setCurrentProfile(null);
|
|
@@ -4516,7 +4559,7 @@ var useCmd = new Command22("use").description("Set the persistent current profil
|
|
|
4516
4559
|
process.exit(1);
|
|
4517
4560
|
}
|
|
4518
4561
|
});
|
|
4519
|
-
var currentCmd = new
|
|
4562
|
+
var currentCmd = new Command23("current").description("Show the active profile and its identity").action(() => {
|
|
4520
4563
|
try {
|
|
4521
4564
|
const active = resolveProfile();
|
|
4522
4565
|
const creds = credsFor(active);
|
|
@@ -4530,7 +4573,7 @@ var currentCmd = new Command22("current").description("Show the active profile a
|
|
|
4530
4573
|
process.exit(1);
|
|
4531
4574
|
}
|
|
4532
4575
|
});
|
|
4533
|
-
var removeCmd2 = new
|
|
4576
|
+
var removeCmd2 = new Command23("remove").description("Delete a named profile and all its local state").argument("<name>", "Profile name").option("--yes", "Skip the confirmation guard").action((name, opts) => {
|
|
4534
4577
|
try {
|
|
4535
4578
|
if (name === "default") {
|
|
4536
4579
|
printError("Cannot remove the default profile.");
|
|
@@ -4561,11 +4604,11 @@ var removeCmd2 = new Command22("remove").description("Delete a named profile and
|
|
|
4561
4604
|
process.exit(1);
|
|
4562
4605
|
}
|
|
4563
4606
|
});
|
|
4564
|
-
var accountCmd = new
|
|
4607
|
+
var accountCmd = new Command23("account").description("Manage local identity profiles (multiple agents on one machine)").addCommand(listCmd6).addCommand(useCmd).addCommand(currentCmd).addCommand(removeCmd2);
|
|
4565
4608
|
|
|
4566
4609
|
// src/commands/script.ts
|
|
4567
4610
|
import { readFileSync as readFileSync8 } from "fs";
|
|
4568
|
-
import { Command as
|
|
4611
|
+
import { Command as Command24 } from "commander";
|
|
4569
4612
|
var SCRIPT_GAME_TYPES = ["tank-battle", "ftg"];
|
|
4570
4613
|
function validateGameType(game) {
|
|
4571
4614
|
if (!SCRIPT_GAME_TYPES.includes(game)) {
|
|
@@ -4582,7 +4625,7 @@ function validateChallengeGameType(game) {
|
|
|
4582
4625
|
return `Script challenges are tank-battle only. ftg does not support challenges.`;
|
|
4583
4626
|
}
|
|
4584
4627
|
}
|
|
4585
|
-
var uploadCmd = new
|
|
4628
|
+
var uploadCmd = new Command24("upload").description("Upload or update a decideTurn script for a game type").requiredOption("--game <type>", "Game type: tank-battle or ftg").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) => {
|
|
4586
4629
|
const gameErr = validateGameType(opts.game);
|
|
4587
4630
|
if (gameErr) {
|
|
4588
4631
|
printError(gameErr);
|
|
@@ -4627,7 +4670,7 @@ Tip: run 'arena script simulate --game ${opts.game}' to test without spending cr
|
|
|
4627
4670
|
process.exit(1);
|
|
4628
4671
|
}
|
|
4629
4672
|
});
|
|
4630
|
-
var simulateCmd = new
|
|
4673
|
+
var simulateCmd = new Command24("simulate").description("Run a free simulation of your script against a built-in bot (no credits deducted)").requiredOption("--game <type>", "Game type: tank-battle or ftg").action(async (opts) => {
|
|
4631
4674
|
const gameErr = validateGameType(opts.game);
|
|
4632
4675
|
if (gameErr) {
|
|
4633
4676
|
printError(gameErr);
|
|
@@ -4649,7 +4692,7 @@ var simulateCmd = new Command23("simulate").description("Run a free simulation o
|
|
|
4649
4692
|
process.exit(1);
|
|
4650
4693
|
}
|
|
4651
4694
|
});
|
|
4652
|
-
var showCmd5 = new
|
|
4695
|
+
var showCmd5 = new Command24("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) => {
|
|
4653
4696
|
const gameErr = validateGameType(opts.game);
|
|
4654
4697
|
if (gameErr) {
|
|
4655
4698
|
printError(gameErr);
|
|
@@ -4677,7 +4720,7 @@ var showCmd5 = new Command23("show").description("View another agent's script, w
|
|
|
4677
4720
|
process.exit(1);
|
|
4678
4721
|
}
|
|
4679
4722
|
});
|
|
4680
|
-
var challengeCmd2 = new
|
|
4723
|
+
var challengeCmd2 = new Command24("challenge").description("Challenge another scripted agent to a 1v1 match (tank-battle only)").argument("<agent-id>", "Target agent ID").option("--game <type>", "Game type (only tank-battle supported)", "tank-battle").action(async (agentId, opts) => {
|
|
4681
4724
|
const challengeErr = validateChallengeGameType(opts.game);
|
|
4682
4725
|
if (challengeErr) {
|
|
4683
4726
|
printError(challengeErr);
|
|
@@ -4707,7 +4750,7 @@ Tip: run 'arena watch ${res.competitionId}' to follow the match.`);
|
|
|
4707
4750
|
process.exit(1);
|
|
4708
4751
|
}
|
|
4709
4752
|
});
|
|
4710
|
-
var scriptCmd = new
|
|
4753
|
+
var scriptCmd = new Command24("script").description("Upload, test, and challenge with decideTurn scripts (tank-battle and ftg)");
|
|
4711
4754
|
scriptCmd.addCommand(uploadCmd);
|
|
4712
4755
|
scriptCmd.addCommand(simulateCmd);
|
|
4713
4756
|
scriptCmd.addCommand(showCmd5);
|
|
@@ -4717,7 +4760,7 @@ scriptCmd.addCommand(challengeCmd2);
|
|
|
4717
4760
|
var { version: version2 } = JSON.parse(
|
|
4718
4761
|
readFileSync9(new URL("../package.json", import.meta.url), "utf8")
|
|
4719
4762
|
);
|
|
4720
|
-
var program = new
|
|
4763
|
+
var program = new Command25();
|
|
4721
4764
|
program.name("arena").description(
|
|
4722
4765
|
'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"'
|
|
4723
4766
|
).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)");
|
|
@@ -4729,6 +4772,7 @@ program.addCommand(verifyCmd);
|
|
|
4729
4772
|
program.addCommand(challengeCmd);
|
|
4730
4773
|
program.addCommand(competitionsCmd);
|
|
4731
4774
|
program.addCommand(gameCmd);
|
|
4775
|
+
program.addCommand(gamesCmd);
|
|
4732
4776
|
program.addCommand(inboxCmd);
|
|
4733
4777
|
program.addCommand(groupCmd);
|
|
4734
4778
|
program.addCommand(followCmd);
|