gdharness 1.3.48 → 1.3.49

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.
@@ -113,6 +113,41 @@ static func engine_constants(target: Object, property: String) -> Dictionary:
113
113
  return values
114
114
 
115
115
 
116
+ ## The number [param word] names as a constant of the global enum the property [param declared] of
117
+ ## [param target] holds, such as VERTICAL_ALIGNMENT_BOTTOM, or null when it names none. ClassDB
118
+ ## lists no global enum and Expression reads no global constant, so a word spelt from the enum's
119
+ ## name and a value the hint gives is compiled, and taken only when the engine reads it as that
120
+ ## value: ORIENTATION_VERTICAL is spelt so and is not a constant, which is HORIZONTAL or VERTICAL.
121
+ static func _global_constant(target: Object, declared: Dictionary, word: String) -> Variant:
122
+ var engine_class: String = target.get_class()
123
+ var setter: String = str(
124
+ ClassDB.class_get_property_setter(engine_class, str(declared.get("name", "")))
125
+ )
126
+ var named: String = ""
127
+ for method: Dictionary in ClassDB.class_get_method_list(engine_class):
128
+ var arguments: Array = method.get("args", [])
129
+ if str(method.get("name", "")) == setter and not arguments.is_empty():
130
+ var value_argument: Dictionary = arguments[-1]
131
+ named = str(value_argument.get("class_name", ""))
132
+ break
133
+ if named.is_empty() or "." in named:
134
+ return null
135
+ var wanted: String = word.strip_edges().to_upper()
136
+ var hinted: Dictionary = enum_values(str(declared.get("hint_string", "")))
137
+ for value_word: String in hinted:
138
+ var constant: String = (
139
+ named.to_snake_case().to_upper() + "_" + value_word.to_upper().replace(" ", "_")
140
+ )
141
+ if constant != wanted:
142
+ continue
143
+ var reader: GDScript = GDScript.new()
144
+ reader.source_code = "extends RefCounted\nconst READ = %s\n" % constant
145
+ if (reader.reload() == OK
146
+ and reader.get_script_constant_map().get("READ") == hinted[value_word]):
147
+ return hinted[value_word]
148
+ return null
149
+
150
+
116
151
  ## [param word] as the number of the value the enum property [param declared] of [param target]
117
152
  ## names by it, as [true, number], or [false, why] naming the values, with [param holder] naming the
118
153
  ## target in the refusal. [false, ""] for a word that is a number, which converts as one.
@@ -132,6 +167,8 @@ static func enum_by_name(
132
167
  if chosen == null:
133
168
  constants = engine_constants(target, property)
134
169
  chosen = enum_named(constants, word)
170
+ if chosen == null and constants.is_empty():
171
+ chosen = _global_constant(target, declared, word)
135
172
  if chosen != null:
136
173
  return [true, chosen]
137
174
  if word.strip_edges().is_valid_int():
@@ -118,7 +118,7 @@ func cannot_hold(
118
118
  if not GdhSerialisation.acceptable(value, expected_type):
119
119
  var shape: String = "%s.%s is %s and the value given is %s, which cannot become one."
120
120
  var remedy: String = GdhShapes.remedy(value, expected_type)
121
- return shape % [holder, property, held, _kind(value)] + remedy + cost
121
+ return shape % [holder, property, held, GdhShapes.kind(value)] + remedy + cost
122
122
 
123
123
  # And the same question of each element, because a list is accepted for a packed or typed array
124
124
  # whatever is in it: a polygon written as [{"x": 1}] passes the check above and lands as one
@@ -132,7 +132,12 @@ func cannot_hold(
132
132
  if not GdhSerialisation.acceptable(items[index], element):
133
133
  var shape: String = "%s.%s is %s and item %d of the list given is %s, not %s."
134
134
  var named: Array = [
135
- holder, property, held, index, _kind(items[index]), type_string(element),
135
+ holder,
136
+ property,
137
+ held,
138
+ index,
139
+ GdhShapes.kind(items[index]),
140
+ type_string(element),
136
141
  ]
137
142
  return shape % named + GdhShapes.remedy(items[index], element) + cost
138
143
  # A list of polygons is a list of lists of points, and each point is read as one too.
@@ -151,7 +156,7 @@ func cannot_hold(
151
156
  type_string(inner),
152
157
  at,
153
158
  index,
154
- _kind(points[at]),
159
+ GdhShapes.kind(points[at]),
155
160
  type_string(inner),
156
161
  ]
157
162
  return nested % said + GdhShapes.remedy(points[at], inner) + cost
@@ -173,14 +178,6 @@ func cannot_hold(
173
178
  return ""
174
179
 
175
180
 
176
- ## What [param value] is, as a refusal names it. A number arrives from JSON as a float whether or
177
- ## not it has a fraction, so [1, 2] given for a list of words was called a list of floats.
178
- static func _kind(value: Variant) -> String:
179
- if value is int or value is float:
180
- return "a number"
181
- return type_string(typeof(value))
182
-
183
-
184
181
  ## Writes each of [param properties] onto [param target], stopping at the first it cannot write and
185
182
  ## answering with why, or "" when every one of them went on and holds what was given.
186
183
  ##
@@ -234,6 +234,15 @@ static func packed_from(items: Array, type: int, fit: Callable) -> Variant:
234
234
  return type_convert(built, type)
235
235
 
236
236
 
237
+ ## What [param value] is, as a refusal names it. A number arrives from JSON as a float whether or
238
+ ## not it has a fraction, so [1, 2] given for a list of words was called a list of floats, and 5
239
+ ## given for a Vector2 was called a float.
240
+ static func kind(value: Variant) -> String:
241
+ if value is int or value is float:
242
+ return "a number"
243
+ return type_string(typeof(value))
244
+
245
+
237
246
  ## The sentences a refusal of [param value] where a [param type] goes ends with: which of its keys
238
247
  ## kept it from being read as one, and how one is written. Empty for a type not built from fields.
239
248
  ##
package/build/keeper.js CHANGED
@@ -7412,6 +7412,7 @@ import {
7412
7412
  closeSync as closeSync2,
7413
7413
  mkdirSync,
7414
7414
  openSync as openSync2,
7415
+ readdirSync,
7415
7416
  readFileSync as readFileSync4,
7416
7417
  rmSync as rmSync3,
7417
7418
  statSync as statSync3,
@@ -8104,6 +8105,9 @@ var GDUNIT_EXITS = new Map([
8104
8105
  [105, "gdUnit4's code for scripts that did not compile"]
8105
8106
  ]);
8106
8107
  var GODOT_EXITS = new Set([1, 255]);
8108
+ var QUEUE_OVERFLOW_FRAMES = new Map([
8109
+ ["ed1daf0bf001b61586d9930840f2f1394092c079", ["main+3e1082a", "main+3e0f4aa"]]
8110
+ ]);
8107
8111
 
8108
8112
  // src/windows-ask.ts
8109
8113
  import { tmpdir as tmpdir2 } from "node:os";
@@ -8905,7 +8909,7 @@ var IMPORTABLE = new Set(IMPORTABLE_EXTENSIONS);
8905
8909
  var hashes = new Map;
8906
8910
 
8907
8911
  // src/scratch.ts
8908
- import { existsSync as existsSync2, mkdtempSync as mkdtempSync2, readdirSync, rmSync as rmSync4 } from "node:fs";
8912
+ import { existsSync as existsSync2, mkdtempSync as mkdtempSync2, readdirSync as readdirSync2, rmSync as rmSync4 } from "node:fs";
8909
8913
  import { tmpdir as tmpdir3 } from "node:os";
8910
8914
  import { join as join4 } from "node:path";
8911
8915
  import process6 from "node:process";
@@ -9913,7 +9917,7 @@ function readLaunched(printed) {
9913
9917
 
9914
9918
  // src/run-record.ts
9915
9919
  import { createHash as createHash2 } from "node:crypto";
9916
- import { mkdirSync as mkdirSync2, openSync as openSync3, readdirSync as readdirSync2, readFileSync as readFileSync7, rmSync as rmSync6, statSync as statSync4 } from "node:fs";
9920
+ import { mkdirSync as mkdirSync2, openSync as openSync3, readdirSync as readdirSync3, readFileSync as readFileSync7, rmSync as rmSync6, statSync as statSync4 } from "node:fs";
9917
9921
  import { basename as basename4, join as join9, resolve as resolve4 } from "node:path";
9918
9922
 
9919
9923
  // src/runtime-client.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdharness",
3
- "version": "1.3.48",
3
+ "version": "1.3.49",
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",