gdharness 1.3.26 → 1.3.27

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/build/cli.js +37 -13
  2. package/package.json +1 -1
package/build/cli.js CHANGED
@@ -10915,6 +10915,7 @@ function readRun(printed) {
10915
10915
  executed,
10916
10916
  unloadable,
10917
10917
  stoppedIn,
10918
+ running: last === null ? null : { suite: last.path, during },
10918
10919
  leftOut,
10919
10920
  engineVersion,
10920
10921
  orphansLeft
@@ -11395,7 +11396,7 @@ async function inTurns(items, at, run) {
11395
11396
  function heldToCores(cores, command, args, platform = process6.platform) {
11396
11397
  return cores === null || platform !== "linux" ? { command, args: [...args] } : { command: "taskset", args: ["-c", `0-${String(cores - 1)}`, command, ...args] };
11397
11398
  }
11398
- async function watchedEngine(launch, args, directory, log, silenceSeconds) {
11399
+ async function watchedEngine(launch, args, directory, log, silenceSeconds, silenceIn) {
11399
11400
  const user = join7(directory, "user");
11400
11401
  const env = { ...process6.env, APPDATA: user, XDG_DATA_HOME: user };
11401
11402
  const output = openSync2(log, "w");
@@ -11468,6 +11469,7 @@ async function watchedEngine(launch, args, directory, log, silenceSeconds) {
11468
11469
  const started = Date.now();
11469
11470
  let lastGrowth = started;
11470
11471
  let text = "";
11472
+ let allowed = { size: -1, seconds: silenceSeconds };
11471
11473
  while (!finished.now) {
11472
11474
  await delay2(LOOK_MS);
11473
11475
  const deadline = launch.deadlineSeconds;
@@ -11488,9 +11490,18 @@ async function watchedEngine(launch, args, directory, log, silenceSeconds) {
11488
11490
  stop();
11489
11491
  }
11490
11492
  } else if (ended === null && Date.now() - lastGrowth > silenceSeconds * 1000) {
11491
- const stoppedIn = readRun(text).stoppedIn;
11493
+ if (allowed.size !== size) {
11494
+ allowed = {
11495
+ size,
11496
+ seconds: silenceIn === undefined ? silenceSeconds : Math.max(silenceSeconds, silenceIn(readRun(text)))
11497
+ };
11498
+ }
11499
+ if (Date.now() - lastGrowth <= allowed.seconds * 1000) {
11500
+ continue;
11501
+ }
11502
+ const { stoppedIn } = readRun(text);
11492
11503
  const unstarted = helper !== null && !existsSync5(helper.pid) ? `, and it never started ${helper.how}: ${helperStep(helper.step)}` : "";
11493
- ended = `the engine printed nothing for ${String(silenceSeconds)} s${stoppedIn === null ? "" : ` while running ${stoppedIn}`}, so it was ended${unstarted}`;
11504
+ ended = `the engine printed nothing for ${String(allowed.seconds)} s${stoppedIn === null ? "" : ` while running ${stoppedIn}`}, so it was ended${unstarted}`;
11494
11505
  stop();
11495
11506
  }
11496
11507
  }
@@ -58366,7 +58377,23 @@ function getLocalVersion() {
58366
58377
 
58367
58378
  // src/suite-run.ts
58368
58379
  var SLOWEST_NAMED = 5;
58369
- var SILENCE_TIMES_SLOWEST = 4;
58380
+ var SILENCE_TIMES_TAKEN = 4;
58381
+ function silenceWhile(running, times, floorSeconds) {
58382
+ const time = running === null ? undefined : times[running.suite];
58383
+ if (running === null || time === undefined) {
58384
+ return floorSeconds;
58385
+ }
58386
+ let taken;
58387
+ if (running.during === null || running.during === "before") {
58388
+ const cases = Object.values(time.cases).reduce((sum, seconds) => sum + seconds, 0);
58389
+ taken = Math.max(0, time.seconds - cases);
58390
+ } else {
58391
+ const func = funcOf(running.during);
58392
+ const row = rowOf(running.during);
58393
+ taken = (row === null ? undefined : time.rows?.[func]?.[row]) ?? time.cases[func];
58394
+ }
58395
+ return Math.max(floorSeconds, SILENCE_TIMES_TAKEN * (taken ?? 0));
58396
+ }
58370
58397
  var VALUED2 = new Set([
58371
58398
  "--engines",
58372
58399
  "--slots",
@@ -58660,12 +58687,12 @@ ${existsSync23(path) ? readFileSync22(path, "latin1") : "missing"}`)
58660
58687
  console.log(`Dealt out row by row, since ${byRows.length === 1 ? "it" : "each"} took more than ${String(SPLIT_PAST_SECONDS)} s last time: ${named(byRows)}.`);
58661
58688
  }
58662
58689
  const lanes = [...new Set(plans.map((plan) => plan.lane))].map((lane) => plans.flatMap((plan, index) => plan.lane === lane ? [{ plan, index }] : []));
58663
- let ran = (await inTurns(lanes, room.engines, (lane) => runLane(launch, lane, units))).flat().sort((a, b) => a.index - b.index);
58690
+ let ran = (await inTurns(lanes, room.engines, (lane) => runLane(launch, lane, times))).flat().sort((a, b) => a.index - b.index);
58664
58691
  if (ran.some((engine) => engine.verdict.starved) && ran.some((engine) => !engine.verdict.passed)) {
58665
58692
  console.log("An engine ran out of memory, so every engine that failed runs again, one at a time.");
58666
58693
  const again = [];
58667
58694
  for (const engine of ran) {
58668
- again.push(engine.verdict.passed ? engine : await runEngine2(launch, engine.plan, engine.index, units, "again"));
58695
+ again.push(engine.verdict.passed ? engine : await runEngine2(launch, engine.plan, engine.index, times, "again"));
58669
58696
  }
58670
58697
  ran = again;
58671
58698
  }
@@ -58756,19 +58783,19 @@ async function importProject(launch) {
58756
58783
  launch.slots.release(lock);
58757
58784
  }
58758
58785
  }
58759
- async function runLane(launch, lane, units) {
58786
+ async function runLane(launch, lane, times) {
58760
58787
  const lock = await launch.slots.take();
58761
58788
  try {
58762
58789
  const ran = [];
58763
58790
  for (const { plan, index } of lane) {
58764
- ran.push(await runEngine2(launch, plan, index, units, "", lock));
58791
+ ran.push(await runEngine2(launch, plan, index, times, "", lock));
58765
58792
  }
58766
58793
  return ran;
58767
58794
  } finally {
58768
58795
  launch.slots.release(lock);
58769
58796
  }
58770
58797
  }
58771
- async function runEngine2(launch, plan, index, units, again = "", slot = null) {
58798
+ async function runEngine2(launch, plan, index, times, again = "", slot = null) {
58772
58799
  const directory = join27(launch.runDirectory, `engine-${String(index)}${again === "" ? "" : `-${again}`}`);
58773
58800
  mkdirSync10(join27(directory, "user"), { recursive: true });
58774
58801
  const suitesFile = join27(directory, "suites.txt");
@@ -58816,15 +58843,12 @@ async function runEngine2(launch, plan, index, units, again = "", slot = null) {
58816
58843
  "--expected-out",
58817
58844
  expectedFile
58818
58845
  ];
58819
- const held = new Set(plan.suites.map((suite) => suite.path));
58820
- const slowest = Math.max(0, ...units.filter((unit) => held.has(unit.suite)).map((unit) => unit.cost));
58821
- const silence = Math.max(launch.silenceFloorSeconds, SILENCE_TIMES_SLOWEST * slowest);
58822
58846
  const log = join27(directory, "engine.log");
58823
58847
  const lock = slot ?? await launch.slots.take();
58824
58848
  const began = Date.now();
58825
58849
  let end;
58826
58850
  try {
58827
- end = await watchedEngine(launch, args, directory, log, silence);
58851
+ end = await watchedEngine(launch, args, directory, log, launch.silenceFloorSeconds, (printed) => silenceWhile(printed.running, times, launch.silenceFloorSeconds));
58828
58852
  } finally {
58829
58853
  if (slot === null) {
58830
58854
  launch.slots.release(lock);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdharness",
3
- "version": "1.3.26",
3
+ "version": "1.3.27",
4
4
  "mcpName": "io.github.Aureliolo/gdharness",
5
5
  "description": "A harness for driving a Godot 4 project from an agent: editor addons, a runtime bridge into the running game, an MCP server in front of them, and a CLI that installs and diagnoses the Godot side.",
6
6
  "type": "module",