@netmind/arena-cli 0.34.0 → 0.34.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -346,11 +346,11 @@ async function api(path3, opts = {}) {
346
346
  if (body !== void 0) {
347
347
  headers["Content-Type"] = "application/json";
348
348
  }
349
- if (auth) {
350
- const creds = loadCredentials();
351
- if (!creds) {
352
- throw new Error("Not logged in. Run `arena register` or `arena login` first.");
353
- }
349
+ const creds = auth ? loadCredentials() : null;
350
+ if (auth === true && !creds) {
351
+ throw new Error("Not logged in. Run `arena register` or `arena login` first.");
352
+ }
353
+ if (creds) {
354
354
  headers["Authorization"] = `Bearer ${creds.api_key}`;
355
355
  const challengeToken = loadChallengeToken(creds.agent_id);
356
356
  if (challengeToken) {
@@ -827,7 +827,7 @@ function saveCompetitionsCache(cache) {
827
827
  writeJson(paths().COMPETITIONS_CACHE_FILE, cache);
828
828
  }
829
829
  async function syncCompetitions() {
830
- const res = await api("/competitions?joinable=true&limit=50&compact=true");
830
+ const res = await api("/competitions?joinable=true&limit=50&compact=true", { auth: "optional" });
831
831
  const items = res.competitions || res.data || res;
832
832
  const competitions = (Array.isArray(items) ? items : []).map((c) => ({
833
833
  id: c.id,
@@ -1124,7 +1124,7 @@ means no cutoff applies to this game type.`
1124
1124
  params.set("limit", opts.limit);
1125
1125
  params.set("page", opts.page);
1126
1126
  if (opts.compact) params.set("compact", "true");
1127
- const res = await api(`/competitions?${params}`);
1127
+ const res = await api(`/competitions?${params}`, { auth: "optional" });
1128
1128
  const items = res.competitions || res.data || res;
1129
1129
  const pagination = res.pagination;
1130
1130
  if (opts.json) {
@@ -1164,7 +1164,7 @@ means no cutoff applies to this game type.`
1164
1164
  var showCmd = new Command6("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) => {
1165
1165
  try {
1166
1166
  const params = opts.compact ? "?compact=true" : "";
1167
- const res = await api(`/competitions/${id}${params}`);
1167
+ const res = await api(`/competitions/${id}${params}`, { auth: "optional" });
1168
1168
  if (opts.json) {
1169
1169
  printJson(res);
1170
1170
  return;
@@ -1447,7 +1447,7 @@ function readContent(opts) {
1447
1447
  var stateCmd = new Command7("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) => {
1448
1448
  try {
1449
1449
  const params = opts.compact ? "?compact=true" : "";
1450
- const res = await api(`/competitions/${id}/game-state${params}`);
1450
+ const res = await api(`/competitions/${id}/game-state${params}`, { auth: "optional" });
1451
1451
  try {
1452
1452
  StateManager.getInstance().trackGame(id, res.name || res.competition_name || id, res.type || res.game_type || "unknown");
1453
1453
  } catch {
@@ -1589,7 +1589,7 @@ Run 'arena game state <id>' to see available_actions.`
1589
1589
  var leaderboardCmd = new Command7("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) => {
1590
1590
  try {
1591
1591
  const params = opts.compact ? "?compact=true" : "";
1592
- const res = await api(`/competitions/${id}/leaderboard${params}`);
1592
+ const res = await api(`/competitions/${id}/leaderboard${params}`, { auth: "optional" });
1593
1593
  if (opts.json) {
1594
1594
  printJson(res);
1595
1595
  return;