@hackerrank/astra-cli 0.1.4 → 0.1.5

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
@@ -228,7 +228,7 @@ credits — that's a quota issue, not a bug.
228
228
  whatever runs already exist on disk, then exit
229
229
  -C, --cwd <path> Working directory for commands (default: cwd)
230
230
  -o, --output <path> Also write trajectory JSON here (autonomous mode)
231
- -s, --steps <n> Step limit (default: 40)
231
+ -s, --steps <n> Turn limit (unset = no limit)
232
232
  -w, --wall <seconds> Wall-clock limit (default: 0 = none)
233
233
  --timeout <seconds> Per-command timeout (default: 60)
234
234
  --max-output <n> Max chars of command output kept (default: 16000)
@@ -237,7 +237,7 @@ credits — that's a quota issue, not a bug.
237
237
  --resume <id> Resume a saved session
238
238
  --sessions List saved sessions and exit
239
239
  -y, --yolo Auto-run commands (always on in autonomous mode)
240
- -q, --quiet Do not stream steps (autonomous mode)
240
+ -q, --quiet Do not stream turns (autonomous mode)
241
241
  -h, --help Show help
242
242
  ```
243
243
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hackerrank/astra-cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Minimal zero-dependency AI coding agent for the HackerRank AI Gateway.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/agent.js CHANGED
@@ -38,7 +38,7 @@ export class Agent {
38
38
  this.model = model;
39
39
  this.env = env;
40
40
  this.mode = opts.mode === "interactive" ? "interactive" : "autonomous";
41
- this.stepLimit = opts.stepLimit ?? 40;
41
+ this.stepLimit = opts.stepLimit ?? 0;
42
42
  this.wallTimeLimitSeconds = opts.wallTimeLimitSeconds ?? 0;
43
43
  this.maxConsecutiveFormatErrors = opts.maxConsecutiveFormatErrors ?? 3;
44
44
  this.outputPath = opts.outputPath ?? null;
package/src/bench.js CHANGED
@@ -282,7 +282,7 @@ export async function runCell({
282
282
  taskFile,
283
283
  projectMetadata,
284
284
  root,
285
- steps = 40,
285
+ steps = 0,
286
286
  wall = 0,
287
287
  timeout = 60,
288
288
  maxOutputChars = 16000,
package/src/cli.js CHANGED
@@ -45,7 +45,7 @@
45
45
  * --bench-root <dir> Root folder for bench runs (default: ./bench)
46
46
  * -C, --cwd <path> Working directory for commands (default: cwd)
47
47
  * -o, --output <path> Also write trajectory JSON here (bench mode)
48
- * -s, --steps <n> Step limit (default: 40)
48
+ * -s, --steps <n> Turn limit (unset = no limit)
49
49
  * -w, --wall <seconds> Wall-clock limit (default: 0 = none)
50
50
  * --timeout <seconds> Per-command timeout (default: 60)
51
51
  * --max-output <n> Max chars of command output kept (default: 16000)
@@ -55,7 +55,7 @@
55
55
  * --sessions List saved sessions and exit
56
56
  * -y, --yolo Auto-run commands without confirmation
57
57
  * (always on in bench mode)
58
- * -q, --quiet Do not stream steps (bench mode)
58
+ * -q, --quiet Do not stream turns (bench mode)
59
59
  * -h, --help Show this help
60
60
  *
61
61
  * API key resolution (first hit wins):
@@ -113,7 +113,7 @@ function reasoningKwargs(level) {
113
113
  }
114
114
 
115
115
  function parseArgs(argv) {
116
- const args = { steps: 40, wall: 0, timeout: 60, quiet: false, "max-output": 16000, _provided: new Set() };
116
+ const args = { steps: 0, wall: 0, timeout: 60, quiet: false, "max-output": 16000, _provided: new Set() };
117
117
  const alias = {
118
118
  "-m": "model", "--model": "model",
119
119
  "-t": "task", "--task": "task",
@@ -419,11 +419,15 @@ async function main() {
419
419
  if (benchRun) {
420
420
  console.error(
421
421
  `\x1b[2m[astra] bench · ${benchRun.slug}/${benchRun.runId} ` +
422
- `· model=${modelId}${reasoning ? ` reasoning=${reasoning}` : ""} steps<=${args.steps}\x1b[0m`
422
+ `· model=${modelId}${reasoning ? ` reasoning=${reasoning}` : ""}` +
423
+ `${Number(args.steps) > 0 ? ` turns<=${args.steps}` : ""}\x1b[0m`
423
424
  );
424
425
  console.error(`\x1b[2m[astra] workspace -> ${benchRun.workspace}\x1b[0m`);
425
426
  } else {
426
- console.error(`\x1b[2m[astra] bench · model=${modelId} cwd=${cmdCwd} steps<=${args.steps}\x1b[0m`);
427
+ console.error(
428
+ `\x1b[2m[astra] bench · model=${modelId} cwd=${cmdCwd}` +
429
+ `${Number(args.steps) > 0 ? ` turns<=${args.steps}` : ""}\x1b[0m`
430
+ );
427
431
  }
428
432
  }
429
433
 
@@ -451,7 +455,7 @@ async function main() {
451
455
  const pt = model.totalPromptTokens;
452
456
  const ct = model.totalCompletionTokens;
453
457
  console.error(
454
- `\n\x1b[1m[astra] exit=${result.exit_status} steps=${agent.nSteps} calls=${model.nCalls}\x1b[0m`
458
+ `\n\x1b[1m[astra] exit=${result.exit_status} turns=${agent.nSteps}\x1b[0m`
455
459
  );
456
460
  console.error(
457
461
  `\x1b[1m[astra] tokens: prompt=${fmt(pt)} completion=${fmt(ct)} total=${fmt(pt + ct)} ` +
@@ -576,7 +580,7 @@ async function runBenchMatrix({ args, apiKey, models, reasonings, repeat, task,
576
580
  const status = r.error ? `model_error: ${r.error.split("\n")[0]}` : r.status;
577
581
  console.error(
578
582
  ` ${mark} ${String(r.model).padEnd(20)} ${String(r.reasoning).padEnd(8)} ` +
579
- `${String(status).padEnd(16)} ${String(r.steps).padStart(3)} steps · ` +
583
+ `${String(status).padEnd(16)} ${String(r.steps).padStart(3)} turns · ` +
580
584
  `${fmt(r.total_tokens)} tok · ${fmtUsd(r.cost_usd)}` +
581
585
  `${r.cost_source === "estimated" ? "~" : ""}`
582
586
  );
@@ -620,7 +624,7 @@ function printLeaderboard(board) {
620
624
  board.sort((a, b) => b.completion_rate - a.completion_rate || a.avg_steps - b.avg_steps);
621
625
  console.error(
622
626
  `\n\x1b[1m${"model".padEnd(20)} ${"reason".padEnd(8)} ${"complete".padEnd(8)} ` +
623
- `${"steps".padStart(6)} ${"tokens".padStart(9)} ${"cost".padStart(9)} source\x1b[0m`
627
+ `${"turns".padStart(6)} ${"tokens".padStart(9)} ${"cost".padStart(9)} source\x1b[0m`
624
628
  );
625
629
  for (const g of board) {
626
630
  const completed = `${g.completed}/${g.runs}`;
@@ -665,23 +669,22 @@ function printSessions() {
665
669
 
666
670
  function printEvent(msg) {
667
671
  // Bench mode keeps output compact: skip the verbose system/user/assistant
668
- // message bodies (per-step progress is shown by printStep). Only surface a
672
+ // message bodies (per-turn progress is shown by printStep). Only surface a
669
673
  // non-empty terminal exit event so the run's submission is still visible.
670
674
  if (msg.role !== "exit" || !msg.content?.trim()) return;
671
675
  console.error(`\x1b[35m--- SUBMISSION ---\x1b[0m\n${msg.content}\n`);
672
676
  }
673
677
 
674
- /** Compact per-step status line with exact token usage from the API. */
678
+ /** Compact per-turn status line with exact token usage from the API. */
675
679
  function printStep(s) {
676
- const limit = s.stepLimit > 0 ? `/${s.stepLimit}` : "";
677
680
  const cached = s.usage.cached_tokens ? ` (cached ${fmt(s.usage.cached_tokens)})` : "";
678
681
  const cost = s.costUsd != null
679
- ? ` · ${fmtUsd(s.costUsd)}${s.costKind === "estimated" ? "~" : ""}`
682
+ ? ` ${fmtUsd(s.costUsd)}${s.costKind === "estimated" ? "~" : ""}`
680
683
  : "";
681
684
  console.error(
682
- `\x1b[36m[astra] step ${s.step}${limit} · call ${s.nCalls} · ` +
683
- `↑${fmt(s.usage.prompt_tokens)} ↓${fmt(s.usage.completion_tokens)} tok · ` +
684
- `ctx ${fmt(s.contextTokens)}${cached}${cost} · ${s.elapsedSeconds.toFixed(1)}s\x1b[0m`
685
+ `\x1b[36m[astra] turn ${s.step} ` +
686
+ `↑${fmt(s.usage.prompt_tokens)} ↓${fmt(s.usage.completion_tokens)} tok ` +
687
+ `ctx ${fmt(s.contextTokens)}${cached}${cost} ${s.elapsedSeconds.toFixed(1)}s\x1b[0m`
685
688
  );
686
689
  }
687
690
 
package/src/project.js CHANGED
@@ -14,7 +14,7 @@ const DEFAULT_BENCH = {
14
14
  models: [],
15
15
  reasoning: [""],
16
16
  repeat: 1,
17
- steps: 40,
17
+ steps: 0,
18
18
  wall_seconds: 0,
19
19
  command_timeout_seconds: 60,
20
20
  };
@@ -169,7 +169,7 @@ export function loadProject(projectPath) {
169
169
  models: stringArray(bench.models, "bench.models", DEFAULT_BENCH.models),
170
170
  reasoning: stringArray(bench.reasoning, "bench.reasoning", DEFAULT_BENCH.reasoning),
171
171
  repeat: positiveInteger(bench.repeat, "bench.repeat", DEFAULT_BENCH.repeat),
172
- steps: positiveInteger(bench.steps, "bench.steps", DEFAULT_BENCH.steps),
172
+ steps: positiveInteger(bench.steps, "bench.steps", DEFAULT_BENCH.steps, { allowZero: true }),
173
173
  wall: positiveInteger(bench.wall_seconds, "bench.wall_seconds", DEFAULT_BENCH.wall_seconds, { allowZero: true }),
174
174
  timeout: positiveInteger(bench.command_timeout_seconds, "bench.command_timeout_seconds", DEFAULT_BENCH.command_timeout_seconds),
175
175
  },