gdharness 1.3.62 → 1.3.63

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
@@ -18139,7 +18139,7 @@ function annotationsOf(spec) {
18139
18139
  openWorldHint: false
18140
18140
  };
18141
18141
  }
18142
- var PROJECT_INFO_SECTIONS, PROJECT_PATH, RUNNING_PROJECT_PATH, RUNNING_PID, SCENE_PATH, WITHOUT_AN_EDITOR = "The call goes through the editor when one serves the project. With none, a headless engine runs the editor's own tool and the answer says so under writtenBy, or readBy for a read. That engine runs every script of the file, where the editor runs only tool scripts, so what a script changes as the file loads or as a property is set is put back before anything is saved, and a file where that cannot be done, such as a scene whose script does not compile, is refused and nothing is written. Each file the written one refers to is named by its uid, as the editor names it, except a file the project's uid cache has no uid for yet (one made since the project was last scanned), which is named by path and listed under namedByPath with the call that scans it. A running editor of the project that has not yet reached this server is waited for.", ALSO_SAVED = "A scene is saved as the engine holds it once the file has loaded, and one property can set others as it loads, as anchors_preset gives a centred Control both its grow directions, so a scene not last saved by an editor can gain, change or lose lines the call did not ask for, on any node the file held, the one it names among them: alsoSaved lists each as {node, property, was, saved}, was left out where the file set nothing and saved where it now sets nothing. What a set itself moved on its node is under alsoChanged rather than here, and neither a node the call adds nor the format lines (header uid, load_steps, unique_id) are listed. The scene loads as it did. Only its text changed.", IMPORTED_FIRST = "importedFirst names the files whose import was behind them on disk, such as a picture changed since it was imported or one never imported, which were imported before the run through project_import reimport, so the run reads them as they are now. importedFirst is left out when every import was current. notImportedFirst lists, as project_import reimport does, any it could not import, and importNote says that the run reads those as they were. The import gives every script without a .uid sidecar one, as the editor's scan does, writing it beside the script in the project, and uidsWrittenFirst names those scripts. The files inside an addon are counted per addon rather than named, under importedInAddons and uidsWrittenInAddons. importTookMs is how long the import took. That time is outside the run's own time limit, so a call that imported can take that much longer than the limit it was given.", WHOLE_NUMBERS = 'A whole number of 2^53 or more, such as a 64-bit seed or a resource uid, is written as its digits, {"_type": "int", "value": "9007199254740993"}, the form a read answers with: a JSON number that large can arrive as a neighbour of the one sent, so sent as a number it is refused.', SCRIPT_PATH, RESOURCE_FILE = 'File inside the project, such as "sprites/hero.png" or "materials/steel.tres".', EXPORT_PLATFORMS, RESOURCE_PATH, NODE_PATH, PROPERTIES, XY, ANIMATION_TRACK, SCRIPT_MODIFICATIONS, INPUT_EVENTS, TILESET_SOURCES, TILEMAP_CELLS, COLOUR2, TOOL_SPECS, SPECS_BY_NAME;
18142
+ var PROJECT_INFO_SECTIONS, PROJECT_PATH, RUNNING_PROJECT_PATH, RUNNING_PID, SCENE_PATH, WITHOUT_AN_EDITOR = "The call goes through the editor when one serves the project. With none, a headless engine runs the editor's own tool. The answer's writtenBy (readBy for a read) names the editor or the engine. That engine runs every script of the file, where the editor runs only tool scripts, so what a script changes as the file loads or as a property is set is put back before anything is saved, and a file where that cannot be done, such as a scene whose script does not compile, is refused and nothing is written. Each file the written one refers to is named by its uid, as the editor names it, except a file the project's uid cache has no uid for yet (one made since the project was last scanned), which is named by path and listed under namedByPath with the call that scans it. A running editor of the project that has not yet reached this server is waited for.", ALSO_SAVED = "A scene is saved as the engine holds it once the file has loaded, and one property can set others as it loads, as anchors_preset gives a centred Control both its grow directions, so a scene not last saved by an editor can gain, change or lose lines the call did not ask for, on any node the file held, the one it names among them: alsoSaved lists each as {node, property, was, saved}, was left out where the file set nothing and saved where it now sets nothing. What a set itself moved on its node is under alsoChanged rather than here, and neither a node the call adds nor the format lines (header uid, load_steps, unique_id) are listed. The scene loads as it did. Only its text changed.", IMPORTED_FIRST = "importedFirst names the files whose import was behind them on disk, such as a picture changed since it was imported or one never imported, which were imported before the run through project_import reimport, so the run reads them as they are now. importedFirst is left out when every import was current. notImportedFirst lists, as project_import reimport does, any it could not import, and importNote says that the run reads those as they were. The import gives every script without a .uid sidecar one, as the editor's scan does, writing it beside the script in the project, and uidsWrittenFirst names those scripts. The files inside an addon are counted per addon rather than named, under importedInAddons and uidsWrittenInAddons. importTookMs is how long the import took. That time is outside the run's own time limit, so a call that imported can take that much longer than the limit it was given.", WHOLE_NUMBERS = 'A whole number of 2^53 or more, such as a 64-bit seed or a resource uid, is written as its digits, {"_type": "int", "value": "9007199254740993"}, the form a read answers with: a JSON number that large can arrive as a neighbour of the one sent, so sent as a number it is refused.', SCRIPT_PATH, RESOURCE_FILE = 'File inside the project, such as "sprites/hero.png" or "materials/steel.tres".', EXPORT_PLATFORMS, RESOURCE_PATH, NODE_PATH, PROPERTIES, XY, ANIMATION_TRACK, SCRIPT_MODIFICATIONS, INPUT_EVENTS, TILESET_SOURCES, TILEMAP_CELLS, COLOUR2, TOOL_SPECS, SPECS_BY_NAME;
18143
18143
  var init_tool_definitions = __esm(() => {
18144
18144
  init_launch();
18145
18145
  PROJECT_INFO_SECTIONS = [
@@ -52755,6 +52755,23 @@ class GodotServer {
52755
52755
  jsonTextResponse(payload) {
52756
52756
  return { content: [{ type: "text", text: answerJson(payload) }] };
52757
52757
  }
52758
+ byTheEditor(answered, effect) {
52759
+ const [first, ...rest] = answered.content;
52760
+ if (answered.isError === true || first?.type !== "text") {
52761
+ return answered;
52762
+ }
52763
+ let payload;
52764
+ try {
52765
+ payload = JSON.parse(first.text);
52766
+ } catch {
52767
+ return answered;
52768
+ }
52769
+ if (!isRecord(payload)) {
52770
+ return answered;
52771
+ }
52772
+ const said = effect === "reads" ? { readBy: "the editor" } : { writtenBy: "the editor" };
52773
+ return { ...answered, content: [{ type: "text", text: answerJson({ ...payload, ...said }) }, ...rest] };
52774
+ }
52758
52775
  async run() {
52759
52776
  this.noteTheStart();
52760
52777
  const located = await this.locator.find();
@@ -59346,7 +59363,7 @@ ${error.text}`;
59346
59363
  const projectPath = project.value.path;
59347
59364
  await this.waitForTheEditorOpenedHere(args, []);
59348
59365
  if (this.editorHasOpen(projectPath)) {
59349
- return await throughTheEditor();
59366
+ return this.byTheEditor(await throughTheEditor(), "reads");
59350
59367
  }
59351
59368
  const where = resolveWithinProject(projectPath, readNonEmptyString(args, pathKey) ?? "");
59352
59369
  if (!where.ok) {
@@ -59384,7 +59401,7 @@ ${error.text}`;
59384
59401
  if (answered.isError === true && declaredButUncached(projectPath, typeName) !== null) {
59385
59402
  answered.content.push({ type: "text", text: uncachedClassNote([typeName]) });
59386
59403
  }
59387
- return answered;
59404
+ return this.byTheEditor(answered, effect);
59388
59405
  }
59389
59406
  if (effect === "writes") {
59390
59407
  if (waited !== null) {
@@ -140,8 +140,9 @@ static func _global_constant(target: Object, declared: Dictionary, word: String)
140
140
  )
141
141
  if constant != wanted:
142
142
  continue
143
+ # Typed, because a project that makes untyped declarations errors compiles this line too.
143
144
  var reader: GDScript = GDScript.new()
144
- reader.source_code = "extends RefCounted\nconst READ = %s\n" % constant
145
+ reader.source_code = "extends RefCounted\nconst READ: int = %s\n" % constant
145
146
  if (reader.reload() == OK
146
147
  and reader.get_script_constant_map().get("READ") == hinted[value_word]):
147
148
  return hinted[value_word]
@@ -140,8 +140,9 @@ static func _global_constant(target: Object, declared: Dictionary, word: String)
140
140
  )
141
141
  if constant != wanted:
142
142
  continue
143
+ # Typed, because a project that makes untyped declarations errors compiles this line too.
143
144
  var reader: GDScript = GDScript.new()
144
- reader.source_code = "extends RefCounted\nconst READ = %s\n" % constant
145
+ reader.source_code = "extends RefCounted\nconst READ: int = %s\n" % constant
145
146
  if (reader.reload() == OK
146
147
  and reader.get_script_constant_map().get("READ") == hinted[value_word]):
147
148
  return hinted[value_word]
@@ -140,8 +140,9 @@ static func _global_constant(target: Object, declared: Dictionary, word: String)
140
140
  )
141
141
  if constant != wanted:
142
142
  continue
143
+ # Typed, because a project that makes untyped declarations errors compiles this line too.
143
144
  var reader: GDScript = GDScript.new()
144
- reader.source_code = "extends RefCounted\nconst READ = %s\n" % constant
145
+ reader.source_code = "extends RefCounted\nconst READ: int = %s\n" % constant
145
146
  if (reader.reload() == OK
146
147
  and reader.get_script_constant_map().get("READ") == hinted[value_word]):
147
148
  return hinted[value_word]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdharness",
3
- "version": "1.3.62",
3
+ "version": "1.3.63",
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",