gdharness 1.2.23 → 1.2.25
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 +527 -178
- package/build/godot/addons/gdharness_editor/serialisation.gd +29 -0
- package/build/godot/addons/gdharness_runtime/runtime_changes.gd +24 -4
- package/build/godot/addons/gdharness_runtime/runtime_values.gd +5 -0
- package/build/godot/addons/gdharness_runtime/serialisation.gd +29 -0
- package/build/godot/operations/godot_operations.gd +7 -0
- package/build/godot/operations/serialisation.gd +29 -0
- package/build/index.js +538 -193
- package/build/keeper.js +14 -9
- package/package.json +1 -1
package/build/keeper.js
CHANGED
|
@@ -105,8 +105,10 @@ public static class GdharnessDesktop {
|
|
|
105
105
|
// what a program's first ShowWindow does whatever it asks for when the start names a show state,
|
|
106
106
|
// and the foreground is held while it starts, since Godot also asks for it outright. The process
|
|
107
107
|
// is ended through the handle held here once stopFile appears, which is how a keeper ends a game
|
|
108
|
-
// it did not start itself: a handle names one process, where a pid can name the next one too.
|
|
109
|
-
|
|
108
|
+
// it did not start itself: a handle names one process, where a pid can name the next one too. The
|
|
109
|
+
// process starts in directory rather than in this one's, which is a temporary directory: Windows
|
|
110
|
+
// PowerShell saves its module cache relative to where it runs when the profile does not resolve.
|
|
111
|
+
public static int Run(string desktop, string commandLine, string pidFile, bool noActivate, string stopFile, string directory) {
|
|
110
112
|
StartupInfo startup = new StartupInfo();
|
|
111
113
|
startup.cb = Marshal.SizeOf(typeof(StartupInfo));
|
|
112
114
|
if (desktop.Length > 0) {
|
|
@@ -129,7 +131,7 @@ public static class GdharnessDesktop {
|
|
|
129
131
|
LockSetForegroundWindow(LockForeground);
|
|
130
132
|
}
|
|
131
133
|
try {
|
|
132
|
-
if (!CreateProcessW(null, new StringBuilder(commandLine), IntPtr.Zero, IntPtr.Zero, true, DetachedProcess, IntPtr.Zero,
|
|
134
|
+
if (!CreateProcessW(null, new StringBuilder(commandLine), IntPtr.Zero, IntPtr.Zero, true, DetachedProcess, IntPtr.Zero, directory, ref startup, out started)) {
|
|
133
135
|
throw new Win32Exception(Marshal.GetLastWin32Error(), "CreateProcessW " + commandLine);
|
|
134
136
|
}
|
|
135
137
|
File.WriteAllText(pidFile, started.processId.ToString());
|
|
@@ -186,6 +188,7 @@ function throughHelper(how, command, args, files) {
|
|
|
186
188
|
commandLine: windowsCommandLine(command, args),
|
|
187
189
|
pidFile: files.pid,
|
|
188
190
|
stopFile: files.stop,
|
|
191
|
+
directory: how.directory,
|
|
189
192
|
source: SOURCE,
|
|
190
193
|
digest: createHash("sha256").update(SOURCE).digest("hex").slice(0, 16)
|
|
191
194
|
};
|
|
@@ -202,7 +205,7 @@ function throughHelper(how, command, args, files) {
|
|
|
202
205
|
" try { Move-Item -LiteralPath $partial -Destination $assembly } catch { Remove-Item -LiteralPath $partial -ErrorAction SilentlyContinue }",
|
|
203
206
|
" }",
|
|
204
207
|
" Add-Type -LiteralPath $assembly",
|
|
205
|
-
" $code = [GdharnessDesktop]::Run($spec.desktop, $spec.commandLine, $spec.pidFile, [bool]$spec.noActivate, $spec.stopFile)",
|
|
208
|
+
" $code = [GdharnessDesktop]::Run($spec.desktop, $spec.commandLine, $spec.pidFile, [bool]$spec.noActivate, $spec.stopFile, $spec.directory)",
|
|
206
209
|
"} catch {",
|
|
207
210
|
` [IO.File]::WriteAllText(${literal(files.error)}, $_.Exception.Message)`,
|
|
208
211
|
" exit 1",
|
|
@@ -382,7 +385,8 @@ var ENGINE_FLAGS = Object.freeze({
|
|
|
382
385
|
"--time-scale": "number",
|
|
383
386
|
"--fixed-fps": "number",
|
|
384
387
|
"--max-fps": "number",
|
|
385
|
-
"--resolution": "size"
|
|
388
|
+
"--resolution": "size",
|
|
389
|
+
"--write-movie": "file"
|
|
386
390
|
});
|
|
387
391
|
var SET_BY_ARGUMENT = Object.freeze({
|
|
388
392
|
"--headless": "headless",
|
|
@@ -1330,13 +1334,14 @@ class ProfileListener {
|
|
|
1330
1334
|
}
|
|
1331
1335
|
|
|
1332
1336
|
// src/keeper.ts
|
|
1333
|
-
async function startDirectly(spec, output, hidden, detached = true, errors = output) {
|
|
1337
|
+
async function startDirectly(spec, output, hidden, detached = true, errors = output, directory = process.cwd()) {
|
|
1334
1338
|
return await new Promise((resolve) => {
|
|
1335
1339
|
const child = spawn(spec.command, [...spec.args], {
|
|
1336
1340
|
stdio: ["ignore", output, errors],
|
|
1337
1341
|
detached,
|
|
1338
1342
|
windowsHide: hidden,
|
|
1339
|
-
env: withChanges(process.env, spec.envChanges)
|
|
1343
|
+
env: withChanges(process.env, spec.envChanges),
|
|
1344
|
+
cwd: directory
|
|
1340
1345
|
});
|
|
1341
1346
|
child.once("error", (error) => {
|
|
1342
1347
|
resolve({ error: error.message });
|
|
@@ -1352,14 +1357,14 @@ async function startThroughHelper(spec, output, stopFile) {
|
|
|
1352
1357
|
const errorFile = join5(scratch, "error");
|
|
1353
1358
|
const where = spec.desktop === undefined ? "without activation" : `on the ${spec.desktop} desktop`;
|
|
1354
1359
|
try {
|
|
1355
|
-
const wrapper = throughHelper(spec, spec.command, spec.args, {
|
|
1360
|
+
const wrapper = throughHelper({ ...spec, directory: process.cwd() }, spec.command, spec.args, {
|
|
1356
1361
|
spec: join5(scratch, "spec.json"),
|
|
1357
1362
|
pid: pidFile,
|
|
1358
1363
|
error: errorFile,
|
|
1359
1364
|
stop: stopFile
|
|
1360
1365
|
});
|
|
1361
1366
|
const envChanges = spec.desktop === undefined ? spec.envChanges : { ...spec.envChanges, [DESKTOP_VARIABLE]: spec.desktop };
|
|
1362
|
-
const started = await startDirectly({ ...spec, command: wrapper.command, args: wrapper.args, envChanges }, output, true, false, "ignore");
|
|
1367
|
+
const started = await startDirectly({ ...spec, command: wrapper.command, args: wrapper.args, envChanges }, output, true, false, "ignore", tmpdir4());
|
|
1363
1368
|
if ("error" in started) {
|
|
1364
1369
|
return started;
|
|
1365
1370
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gdharness",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.25",
|
|
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",
|