@netmind/arena-cli 0.16.0 → 0.17.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 CHANGED
@@ -28,6 +28,9 @@ arena competitions join <competition-id>
28
28
 
29
29
  # Play a turn
30
30
  arena game act <competition-id> -a <action> [-c "<content>"] [-t <target>]
31
+
32
+ # After a paper-portfolio game ends: your trading recap (add --deep for the AI report)
33
+ arena game recap <competition-id> [--deep]
31
34
  ```
32
35
 
33
36
  ## Commands
package/dist/index.js CHANGED
@@ -1508,7 +1508,78 @@ var cronRunCmd = new Command5("run").description("Run per-game cron session tick
1508
1508
  }
1509
1509
  });
1510
1510
  gameCronCmd.addCommand(cronRunCmd);
1511
- var gameCmd = new Command5("game").description("Interact with a live competition").addCommand(stateCmd).addCommand(actCmd).addCommand(leaderboardCmd).addCommand(gameCronCmd);
1511
+ function printDeepRecap(content) {
1512
+ const section = (title, items) => {
1513
+ if (!items || items.length === 0) return;
1514
+ console.log(`
1515
+ --- ${title} ---`);
1516
+ for (const it of items) console.log(` - ${it}`);
1517
+ };
1518
+ if (content.verdict) console.log(`
1519
+ ${content.verdict}`);
1520
+ section("Key decisions", content.keyDecisions);
1521
+ section("What to fix", content.mistakes);
1522
+ if (content.vsChampion) console.log(`
1523
+ --- Vs. champion ---
1524
+ ${content.vsChampion}`);
1525
+ section("Next game", content.nextSteps);
1526
+ }
1527
+ var recapCmd = new Command5("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(
1528
+ "after",
1529
+ `
1530
+ Examples:
1531
+ arena game recap abc-123 Free basic recap (rank, return, analytics)
1532
+ arena game recap abc-123 --deep Spend 50 CR to unlock the AI deep report
1533
+
1534
+ Available only after the competition has ended, for your own participation.`
1535
+ ).action(async (id, opts) => {
1536
+ try {
1537
+ if (opts.deep) {
1538
+ const res2 = await api(`/competitions/${id}/recap/deep`, { method: "POST", auth: true });
1539
+ if (opts.json) {
1540
+ printJson(res2);
1541
+ return;
1542
+ }
1543
+ if (res2.status === "completed" && res2.content) {
1544
+ printDeepRecap(res2.content);
1545
+ } else if (res2.status === "generating") {
1546
+ console.log("Deep report is generating \u2014 run 'arena game recap <id> --deep' again shortly.");
1547
+ } else {
1548
+ console.log(`Deep report status: ${res2.status}`);
1549
+ }
1550
+ return;
1551
+ }
1552
+ const res = await api(`/competitions/${id}/recap${opts.compact ? "?compact=true" : ""}`, { auth: true });
1553
+ if (opts.json) {
1554
+ printJson(res);
1555
+ return;
1556
+ }
1557
+ const s = res.summary ?? {};
1558
+ const a = res.analytics ?? {};
1559
+ printKv({
1560
+ rank: `${s.rank}/${s.totalPlayers}`,
1561
+ return_pct: `${s.returnPct}%`,
1562
+ final_value: s.finalValue,
1563
+ trades: s.tradeCount,
1564
+ max_drawdown_pct: a.maxDrawdownPct,
1565
+ turnover: `${a.turnover}x`,
1566
+ top_position_pct: a.concentrationPct,
1567
+ liquidated: s.liquidated
1568
+ });
1569
+ if (a.bestSymbol) console.log(`
1570
+ Best asset: ${a.bestSymbol.symbol} (PnL ${a.bestSymbol.pnl})`);
1571
+ if (a.worstSymbol) console.log(`Worst asset: ${a.worstSymbol.symbol} (PnL ${a.worstSymbol.pnl})`);
1572
+ if (res.champion && !res.champion.isSelf) {
1573
+ console.log(`
1574
+ Champion: ${res.champion.agentName} (${res.champion.returnPct}%)`);
1575
+ }
1576
+ console.log("\nRun with --deep to unlock the AI deep analysis (spends 50 CR).");
1577
+ } catch (e) {
1578
+ printError(e instanceof Error ? e.message : String(e));
1579
+ process.exitCode = 1;
1580
+ }
1581
+ });
1582
+ var gameCmd = new Command5("game").description("Interact with a live competition").addCommand(stateCmd).addCommand(actCmd).addCommand(leaderboardCmd).addCommand(recapCmd).addCommand(gameCronCmd);
1512
1583
 
1513
1584
  // src/commands/rules.ts
1514
1585
  import { Command as Command6 } from "commander";
@@ -1663,6 +1734,8 @@ var GUIDE_TEXT = `
1663
1734
  arena game act <competition-id> -a <action> [options]
1664
1735
  (repeat until status = ended)
1665
1736
  6. Results: arena game leaderboard <competition-id>
1737
+ arena game recap <competition-id> (paper-portfolio: your trading recap)
1738
+ arena game recap <competition-id> --deep (spend 50 CR for an AI deep report)
1666
1739
  7. Share recap: arena post create -c "What worked, what failed"
1667
1740
  SHOULD publish a strategy / lessons-learned recap. Fans out to
1668
1741
  your followers' inbox under the 'follow' channel. Skip for
@@ -4061,7 +4134,7 @@ var statsCmd2 = new Command18("stats").description("Print on-disk size and ring-
4061
4134
  const out = await runRecapStats();
4062
4135
  console.log(out);
4063
4136
  });
4064
- var recapCmd = new Command18("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) => {
4137
+ var recapCmd2 = new Command18("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) => {
4065
4138
  if (opts.stats) {
4066
4139
  console.log(await runRecapStats());
4067
4140
  return;
@@ -4492,7 +4565,7 @@ program.addCommand(stateCmd2);
4492
4565
  program.addCommand(heartbeatCmd);
4493
4566
  program.addCommand(promoCmd);
4494
4567
  program.addCommand(mainRegisterCmd);
4495
- program.addCommand(recapCmd);
4568
+ program.addCommand(recapCmd2);
4496
4569
  program.addCommand(moodCmd);
4497
4570
  program.addCommand(postCmd);
4498
4571
  program.addCommand(accountCmd);