@brainbase-labs/cli 0.25.0-eng1209.5 → 0.25.0-eng1209.6

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.
Files changed (2) hide show
  1. package/dist/index.js +42 -16
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -36008,7 +36008,7 @@ function padStart(s, n) {
36008
36008
  // package.json
36009
36009
  var package_default = {
36010
36010
  name: "@brainbase-labs/cli",
36011
- version: "0.25.0-eng1209.5",
36011
+ version: "0.25.0-eng1209.6",
36012
36012
  description: "Pack, share, and install agent templates across harnesses (Claude Code, Codex, ...).",
36013
36013
  type: "module",
36014
36014
  bin: {
@@ -78882,6 +78882,19 @@ class BenchmarkPhaseError extends Error {
78882
78882
  this.name = "BenchmarkPhaseError";
78883
78883
  }
78884
78884
  }
78885
+
78886
+ class BenchmarkCommandExecutionError extends BenchmarkPhaseError {
78887
+ stdout;
78888
+ stderr;
78889
+ durationMs;
78890
+ constructor(code, message, stdout, stderr, durationMs) {
78891
+ super(code, message);
78892
+ this.stdout = stdout;
78893
+ this.stderr = stderr;
78894
+ this.durationMs = durationMs;
78895
+ this.name = "BenchmarkCommandExecutionError";
78896
+ }
78897
+ }
78885
78898
  var ZIP_EOCD_SIGNATURE = 101010256;
78886
78899
  var ZIP_CENTRAL_SIGNATURE = 33639248;
78887
78900
  var ZIP_LOCAL_SIGNATURE = 67324752;
@@ -79985,7 +79998,8 @@ async function runCommand(command, root, spec, context, additions = {}) {
79985
79998
  const remainingMs = context.deadline - Date.now();
79986
79999
  if (remainingMs <= 0)
79987
80000
  throw new BenchmarkPhaseError("phase_timeout", "phase budget expired");
79988
- const timeoutMs2 = Math.min(command.timeout_ms ?? remainingMs, remainingMs);
80001
+ const reachesPhaseDeadline = command.timeout_ms === undefined || command.timeout_ms >= remainingMs;
80002
+ const timeoutMs2 = reachesPhaseDeadline ? remainingMs : command.timeout_ms;
79989
80003
  const started = Date.now();
79990
80004
  return await new Promise((resolve, reject2) => {
79991
80005
  const child = spawn4(command.argv[0], command.argv.slice(1), {
@@ -80022,10 +80036,14 @@ async function runCommand(command, root, spec, context, additions = {}) {
80022
80036
  child.stdout?.on("data", (chunk2) => capture(stdout, chunk2));
80023
80037
  child.stderr?.on("data", (chunk2) => capture(stderr, chunk2));
80024
80038
  child.on("error", (error2) => {
80025
- fail(new BenchmarkPhaseError("command_start_failed", `failed to start ${command.id}: ${error2.message}`));
80039
+ fail(new BenchmarkCommandExecutionError("command_start_failed", `failed to start ${command.id}: ${error2.message}`, Buffer.concat(stdout), Buffer.concat(stderr), Date.now() - started));
80026
80040
  });
80027
80041
  timer = setTimeout(() => {
80028
- fail(new BenchmarkPhaseError("command_timeout", `command timed out: ${command.id}`));
80042
+ if (reachesPhaseDeadline) {
80043
+ fail(new BenchmarkPhaseError("phase_timeout", "phase budget expired"));
80044
+ return;
80045
+ }
80046
+ fail(new BenchmarkCommandExecutionError("command_timeout", `command timed out: ${command.id}`, Buffer.concat(stdout), Buffer.concat(stderr), Date.now() - started));
80029
80047
  }, timeoutMs2);
80030
80048
  child.on("close", (code, signal) => {
80031
80049
  if (settled)
@@ -80033,7 +80051,7 @@ async function runCommand(command, root, spec, context, additions = {}) {
80033
80051
  settled = true;
80034
80052
  clearTimeout(timer);
80035
80053
  if (code === null) {
80036
- reject2(new BenchmarkPhaseError("command_terminated", `command was terminated by ${signal ?? "an unknown signal"}: ${command.id}`));
80054
+ reject2(new BenchmarkCommandExecutionError("command_terminated", `command was terminated by ${signal ?? "an unknown signal"}: ${command.id}`, Buffer.concat(stdout), Buffer.concat(stderr), Date.now() - started));
80037
80055
  return;
80038
80056
  }
80039
80057
  resolve({
@@ -80867,7 +80885,6 @@ async function executeEvaluate(spec, context) {
80867
80885
  for (const evaluator of executionOrder) {
80868
80886
  assertBudget(context);
80869
80887
  const started = Date.now();
80870
- let requiredResultError;
80871
80888
  try {
80872
80889
  const evaluated = await evaluateOne(evaluator, spec, manifest, finalOutput.buffer.toString("utf8"), trajectory, { finalOutputPath, trajectoryPath }, context);
80873
80890
  assertBudget(context);
@@ -80881,13 +80898,14 @@ async function executeEvaluate(spec, context) {
80881
80898
  outputs.push(evaluated.stderr);
80882
80899
  context.outputs.push(evaluated.stderr);
80883
80900
  }
80884
- if (evaluated.status === "errored" && evaluator.required) {
80885
- const errorCode = typeof evaluated.details?.error_code === "string" ? evaluated.details.error_code : "evaluator_execution_failed";
80886
- const errorMessage2 = typeof evaluated.details?.error_message === "string" ? evaluated.details.error_message : "required evaluator execution failed";
80887
- requiredResultError = new BenchmarkPhaseError(errorCode, errorMessage2);
80888
- }
80889
80901
  } catch (error2) {
80890
80902
  const normalized = stableError(error2);
80903
+ let stdout;
80904
+ let stderr;
80905
+ if (error2 instanceof BenchmarkCommandExecutionError) {
80906
+ stdout = await writeLog(spec.logs_root, `${evaluator.id}.stdout.log`, error2.stdout, spec);
80907
+ stderr = await writeLog(spec.logs_root, `${evaluator.id}.stderr.log`, error2.stderr, spec);
80908
+ }
80891
80909
  const errored = {
80892
80910
  id: evaluator.id,
80893
80911
  type: evaluator.type,
@@ -80897,20 +80915,28 @@ async function executeEvaluate(spec, context) {
80897
80915
  verdict: null,
80898
80916
  engine: "brainbase-cli",
80899
80917
  engine_version: VERSION,
80900
- duration_ms: Date.now() - started,
80918
+ duration_ms: error2 instanceof BenchmarkCommandExecutionError ? error2.durationMs : Date.now() - started,
80901
80919
  details: {
80902
80920
  error_code: normalized?.code ?? "phase_failed",
80903
80921
  error_message: normalized?.message ?? "evaluator execution failed"
80904
- }
80922
+ },
80923
+ ...stdout ? { stdout } : {},
80924
+ ...stderr ? { stderr } : {}
80905
80925
  };
80906
80926
  evaluators.push(errored);
80907
80927
  context.evaluators.push(errored);
80908
- if (evaluator.required)
80928
+ if (stdout) {
80929
+ outputs.push(stdout);
80930
+ context.outputs.push(stdout);
80931
+ }
80932
+ if (stderr) {
80933
+ outputs.push(stderr);
80934
+ context.outputs.push(stderr);
80935
+ }
80936
+ if (!(error2 instanceof BenchmarkCommandExecutionError))
80909
80937
  throw error2;
80910
80938
  assertBudget(context);
80911
80939
  }
80912
- if (requiredResultError)
80913
- throw requiredResultError;
80914
80940
  if (evaluator.type === "sandbox_command") {
80915
80941
  assertEvaluateOutputBudget(spec, context);
80916
80942
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainbase-labs/cli",
3
- "version": "0.25.0-eng1209.5",
3
+ "version": "0.25.0-eng1209.6",
4
4
  "description": "Pack, share, and install agent templates across harnesses (Claude Code, Codex, ...).",
5
5
  "type": "module",
6
6
  "bin": {