gdharness 1.0.4 → 1.0.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/build/cli.js CHANGED
@@ -39645,8 +39645,7 @@ class GodotServer {
39645
39645
  this.logDebug(`announce wait ended after ${Date.now() - waitBegan}ms: ${endpoint === null ? "nothing announced" : `pid ${endpoint.pid} announced`}, editor asked ${editorAsks} times, last said ${lastSaid()}`);
39646
39646
  const going = this.currentRun();
39647
39647
  if (endpoint !== null && going !== null && going.announcedPid === undefined) {
39648
- going.announcedPid = endpoint.pid;
39649
- this.noteBootOf(going, endpoint);
39648
+ this.tie(going, endpoint);
39650
39649
  }
39651
39650
  return runtimeVerdict(endpoint, {
39652
39651
  addon: true,
@@ -39678,6 +39677,7 @@ class GodotServer {
39678
39677
  return;
39679
39678
  }
39680
39679
  const took = announcedAt - run.startedAt;
39680
+ this.logDebug(`boot of pid ${endpoint.pid} announced ${Math.round(took)}ms after the start of ${run.projectPath}`);
39681
39681
  if (took > 0 && took <= LONGEST_BOOT_NOTED_MS) {
39682
39682
  writeBootNote(run.projectPath, took);
39683
39683
  }
@@ -40002,16 +40002,16 @@ class GodotServer {
40002
40002
  return run.announcedPid;
40003
40003
  }
40004
40004
  const ours = this.announcedOfTheRunsProject(run, announced ?? runtimesAnnounced().running);
40005
- if (run.pid !== null && ours.some((one) => one.pid === run.pid)) {
40006
- run.announcedPid = run.pid;
40005
+ const own = ours.find((one) => one.pid === run.pid);
40006
+ if (own !== undefined) {
40007
+ this.tie(run, own);
40007
40008
  return run.announcedPid;
40008
40009
  }
40009
40010
  const before = run.announcedBefore ?? new Set;
40010
40011
  const candidates = ours.filter((one) => !before.has(one.pid) && this.isTheGameOf(run, one, run.projectPath));
40011
40012
  const theOne = candidates.length === 1 ? candidates[0] : undefined;
40012
40013
  if (theOne !== undefined) {
40013
- run.announcedPid = theOne.pid;
40014
- this.noteBootOf(run, theOne);
40014
+ this.tie(run, theOne);
40015
40015
  }
40016
40016
  return run.announcedPid;
40017
40017
  }
@@ -40049,7 +40049,7 @@ class GodotServer {
40049
40049
  if (tree === undefined) {
40050
40050
  return;
40051
40051
  }
40052
- return this.tieThroughTheTree(run, tree, new Set(ours.map((one) => one.pid)));
40052
+ return this.tieThroughTheTree(run, tree, ours);
40053
40053
  }
40054
40054
  async gameProcessOf(run) {
40055
40055
  if (run.gamePid !== undefined) {
@@ -40070,21 +40070,28 @@ class GodotServer {
40070
40070
  }
40071
40071
  return found;
40072
40072
  }
40073
- tieThroughTheTree(run, tree, games) {
40073
+ tieThroughTheTree(run, tree, announced) {
40074
40074
  const root = run.pid ?? (run.throughEditor ? this.godotBridge.getStatus().editorPid : undefined);
40075
40075
  if (root === undefined) {
40076
40076
  return;
40077
40077
  }
40078
- if (games.has(root)) {
40079
- run.announcedPid = root;
40080
- return root;
40078
+ const games = new Set(announced.map((one) => one.pid));
40079
+ const own = announced.find((one) => one.pid === root);
40080
+ if (own !== undefined) {
40081
+ this.tie(run, own);
40082
+ return own.pid;
40081
40083
  }
40082
- const nearest = descendantsIn(tree, root).filter((one) => games.has(one) && !gameBetween(tree, one, root, games));
40084
+ const under = new Set(descendantsIn(tree, root));
40085
+ const nearest = announced.filter((one) => under.has(one.pid) && !gameBetween(tree, one.pid, root, games));
40083
40086
  const theOne = nearest.length === 1 ? nearest[0] : undefined;
40084
40087
  if (theOne !== undefined) {
40085
- run.announcedPid = theOne;
40088
+ this.tie(run, theOne);
40086
40089
  }
40087
- return theOne;
40090
+ return theOne?.pid;
40091
+ }
40092
+ tie(run, endpoint) {
40093
+ run.announcedPid = endpoint.pid;
40094
+ this.noteBootOf(run, endpoint);
40088
40095
  }
40089
40096
  playedByOurEditor(endpoint, projectPath) {
40090
40097
  const editor = this.godotBridge.getStatus().editorPid;
@@ -40385,7 +40392,7 @@ class GodotServer {
40385
40392
  }
40386
40393
  const announced = this.announcedOfTheRunsProject(run, runtimesAnnounced().running);
40387
40394
  const games = new Set(announced.map((one) => one.pid));
40388
- const own = this.announcedPidOf(run, announced) ?? this.tieThroughTheTree(run, tree, games) ?? run.gamePid ?? this.gameByCommandLineIn(run, tree);
40395
+ const own = this.announcedPidOf(run, announced) ?? this.tieThroughTheTree(run, tree, announced) ?? run.gamePid ?? this.gameByCommandLineIn(run, tree);
40389
40396
  if (own !== undefined && run.announcedPid === undefined) {
40390
40397
  run.gamePid = own;
40391
40398
  }
package/build/index.js CHANGED
@@ -32383,8 +32383,7 @@ class GodotServer {
32383
32383
  this.logDebug(`announce wait ended after ${Date.now() - waitBegan}ms: ${endpoint === null ? "nothing announced" : `pid ${endpoint.pid} announced`}, editor asked ${editorAsks} times, last said ${lastSaid()}`);
32384
32384
  const going = this.currentRun();
32385
32385
  if (endpoint !== null && going !== null && going.announcedPid === undefined) {
32386
- going.announcedPid = endpoint.pid;
32387
- this.noteBootOf(going, endpoint);
32386
+ this.tie(going, endpoint);
32388
32387
  }
32389
32388
  return runtimeVerdict(endpoint, {
32390
32389
  addon: true,
@@ -32416,6 +32415,7 @@ class GodotServer {
32416
32415
  return;
32417
32416
  }
32418
32417
  const took = announcedAt - run.startedAt;
32418
+ this.logDebug(`boot of pid ${endpoint.pid} announced ${Math.round(took)}ms after the start of ${run.projectPath}`);
32419
32419
  if (took > 0 && took <= LONGEST_BOOT_NOTED_MS) {
32420
32420
  writeBootNote(run.projectPath, took);
32421
32421
  }
@@ -32740,16 +32740,16 @@ class GodotServer {
32740
32740
  return run.announcedPid;
32741
32741
  }
32742
32742
  const ours = this.announcedOfTheRunsProject(run, announced ?? runtimesAnnounced().running);
32743
- if (run.pid !== null && ours.some((one) => one.pid === run.pid)) {
32744
- run.announcedPid = run.pid;
32743
+ const own = ours.find((one) => one.pid === run.pid);
32744
+ if (own !== undefined) {
32745
+ this.tie(run, own);
32745
32746
  return run.announcedPid;
32746
32747
  }
32747
32748
  const before = run.announcedBefore ?? new Set;
32748
32749
  const candidates = ours.filter((one) => !before.has(one.pid) && this.isTheGameOf(run, one, run.projectPath));
32749
32750
  const theOne = candidates.length === 1 ? candidates[0] : undefined;
32750
32751
  if (theOne !== undefined) {
32751
- run.announcedPid = theOne.pid;
32752
- this.noteBootOf(run, theOne);
32752
+ this.tie(run, theOne);
32753
32753
  }
32754
32754
  return run.announcedPid;
32755
32755
  }
@@ -32787,7 +32787,7 @@ class GodotServer {
32787
32787
  if (tree === undefined) {
32788
32788
  return;
32789
32789
  }
32790
- return this.tieThroughTheTree(run, tree, new Set(ours.map((one) => one.pid)));
32790
+ return this.tieThroughTheTree(run, tree, ours);
32791
32791
  }
32792
32792
  async gameProcessOf(run) {
32793
32793
  if (run.gamePid !== undefined) {
@@ -32808,21 +32808,28 @@ class GodotServer {
32808
32808
  }
32809
32809
  return found;
32810
32810
  }
32811
- tieThroughTheTree(run, tree, games) {
32811
+ tieThroughTheTree(run, tree, announced) {
32812
32812
  const root = run.pid ?? (run.throughEditor ? this.godotBridge.getStatus().editorPid : undefined);
32813
32813
  if (root === undefined) {
32814
32814
  return;
32815
32815
  }
32816
- if (games.has(root)) {
32817
- run.announcedPid = root;
32818
- return root;
32816
+ const games = new Set(announced.map((one) => one.pid));
32817
+ const own = announced.find((one) => one.pid === root);
32818
+ if (own !== undefined) {
32819
+ this.tie(run, own);
32820
+ return own.pid;
32819
32821
  }
32820
- const nearest = descendantsIn(tree, root).filter((one) => games.has(one) && !gameBetween(tree, one, root, games));
32822
+ const under = new Set(descendantsIn(tree, root));
32823
+ const nearest = announced.filter((one) => under.has(one.pid) && !gameBetween(tree, one.pid, root, games));
32821
32824
  const theOne = nearest.length === 1 ? nearest[0] : undefined;
32822
32825
  if (theOne !== undefined) {
32823
- run.announcedPid = theOne;
32826
+ this.tie(run, theOne);
32824
32827
  }
32825
- return theOne;
32828
+ return theOne?.pid;
32829
+ }
32830
+ tie(run, endpoint) {
32831
+ run.announcedPid = endpoint.pid;
32832
+ this.noteBootOf(run, endpoint);
32826
32833
  }
32827
32834
  playedByOurEditor(endpoint, projectPath) {
32828
32835
  const editor = this.godotBridge.getStatus().editorPid;
@@ -33123,7 +33130,7 @@ class GodotServer {
33123
33130
  }
33124
33131
  const announced = this.announcedOfTheRunsProject(run, runtimesAnnounced().running);
33125
33132
  const games = new Set(announced.map((one) => one.pid));
33126
- const own = this.announcedPidOf(run, announced) ?? this.tieThroughTheTree(run, tree, games) ?? run.gamePid ?? this.gameByCommandLineIn(run, tree);
33133
+ const own = this.announcedPidOf(run, announced) ?? this.tieThroughTheTree(run, tree, announced) ?? run.gamePid ?? this.gameByCommandLineIn(run, tree);
33127
33134
  if (own !== undefined && run.announcedPid === undefined) {
33128
33135
  run.gamePid = own;
33129
33136
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdharness",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
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",