gdharness 1.3.34 → 1.3.35

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 +63 -3
  2. package/package.json +1 -1
package/build/cli.js CHANGED
@@ -11712,7 +11712,16 @@ var init_whole_file = __esm(() => {
11712
11712
  });
11713
11713
 
11714
11714
  // src/engine-slots.ts
11715
- import { closeSync as closeSync3, mkdirSync as mkdirSync3, openSync as openSync3, readFileSync as readFileSync7, rmSync as rmSync6, statSync as statSync6, writeSync as writeSync2 } from "node:fs";
11715
+ import {
11716
+ closeSync as closeSync3,
11717
+ mkdirSync as mkdirSync3,
11718
+ openSync as openSync3,
11719
+ readFileSync as readFileSync7,
11720
+ rmSync as rmSync6,
11721
+ statSync as statSync6,
11722
+ watch,
11723
+ writeSync as writeSync2
11724
+ } from "node:fs";
11716
11725
  import { availableParallelism as availableParallelism2, homedir as homedir2 } from "node:os";
11717
11726
  import { join as join8, resolve as resolve4 } from "node:path";
11718
11727
  import process7 from "node:process";
@@ -11746,6 +11755,51 @@ function machineSlots(asked = {
11746
11755
  function nonEmpty(value) {
11747
11756
  return value === undefined || value === "" ? undefined : value;
11748
11757
  }
11758
+
11759
+ class FolderChanges {
11760
+ changed = false;
11761
+ wake = null;
11762
+ watcher;
11763
+ constructor(directory) {
11764
+ let watcher = null;
11765
+ try {
11766
+ watcher = watch(directory, () => {
11767
+ this.changed = true;
11768
+ this.wake?.();
11769
+ });
11770
+ watcher.on("error", () => {
11771
+ watcher?.close();
11772
+ });
11773
+ } catch {
11774
+ watcher = null;
11775
+ }
11776
+ this.watcher = watcher;
11777
+ }
11778
+ async next(lookMs, settleMs, signal) {
11779
+ if (!this.changed) {
11780
+ await new Promise((resolve) => {
11781
+ const done = () => {
11782
+ clearTimeout(timer);
11783
+ this.wake = null;
11784
+ signal?.removeEventListener("abort", done);
11785
+ resolve();
11786
+ };
11787
+ const timer = setTimeout(done, lookMs);
11788
+ this.wake = done;
11789
+ signal?.addEventListener("abort", done, { once: true });
11790
+ });
11791
+ }
11792
+ if (this.changed && signal?.aborted !== true) {
11793
+ await delay3(settleMs, undefined, signal === undefined ? {} : { signal }).catch(() => {
11794
+ return;
11795
+ });
11796
+ }
11797
+ this.changed = false;
11798
+ }
11799
+ close() {
11800
+ this.watcher?.close();
11801
+ }
11802
+ }
11749
11803
  function holderOf(content) {
11750
11804
  try {
11751
11805
  const parsed = JSON.parse(content);
@@ -11794,6 +11848,7 @@ class EngineSlots {
11794
11848
  const began = Date.now();
11795
11849
  let said = Number.NEGATIVE_INFINITY;
11796
11850
  let mark;
11851
+ let changes;
11797
11852
  try {
11798
11853
  for (;; ) {
11799
11854
  signal?.throwIfAborted();
@@ -11812,9 +11867,14 @@ class EngineSlots {
11812
11867
  this.saidAt = now;
11813
11868
  this.say(slotWaitSaid(now - began, this.count, this.directory));
11814
11869
  }
11815
- await delay3(SLOT_WAIT_MS, undefined, signal === undefined ? {} : { signal });
11870
+ if (changes === undefined) {
11871
+ changes = new FolderChanges(this.directory);
11872
+ continue;
11873
+ }
11874
+ await changes.next(SLOT_LOOK_MS, SLOT_SETTLE_MS, signal);
11816
11875
  }
11817
11876
  } finally {
11877
+ changes?.close();
11818
11878
  if (mark !== undefined && this.marks.delete(mark)) {
11819
11879
  removeWhole(mark);
11820
11880
  }
@@ -11964,7 +12024,7 @@ async function inASlot(body) {
11964
12024
  held.release();
11965
12025
  }
11966
12026
  }
11967
- var SLOTS_VARIABLE = "GODOT_ENGINE_SLOTS", SLOT_COUNT_VARIABLE = "GODOT_ENGINE_SLOT_COUNT", PROCESSORS_A_SLOT = 5, START_TOLERANCE_MS = 2000, UNWRITTEN_MS = 1e4, SLOT_WAIT_MS = 50, WAIT_SAID_MS = 20000, COMMAND_WAIT_SAID_MS = 2000, START_READ_MS = 1e4, WAITING_FOLDER = "waiting", waitsMarked = 0, ours, saidTo;
12027
+ var SLOTS_VARIABLE = "GODOT_ENGINE_SLOTS", SLOT_COUNT_VARIABLE = "GODOT_ENGINE_SLOT_COUNT", PROCESSORS_A_SLOT = 5, START_TOLERANCE_MS = 2000, UNWRITTEN_MS = 1e4, SLOT_LOOK_MS = 1000, SLOT_SETTLE_MS = 50, WAIT_SAID_MS = 20000, COMMAND_WAIT_SAID_MS = 2000, START_READ_MS = 1e4, WAITING_FOLDER = "waiting", waitsMarked = 0, ours, saidTo;
11968
12028
  var init_engine_slots = __esm(() => {
11969
12029
  init_alive();
11970
12030
  init_call_signal();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdharness",
3
- "version": "1.3.34",
3
+ "version": "1.3.35",
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",