gdharness 1.2.24 → 1.2.26

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/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
- public static int Run(string desktop, string commandLine, string pidFile, bool noActivate, string stopFile) {
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, null, ref startup, out started)) {
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",
@@ -383,7 +386,10 @@ var ENGINE_FLAGS = Object.freeze({
383
386
  "--fixed-fps": "number",
384
387
  "--max-fps": "number",
385
388
  "--resolution": "size",
386
- "--write-movie": "file"
389
+ "--write-movie": "file",
390
+ "--rendering-driver": "driver",
391
+ "--rendering-method": "method",
392
+ "--accessibility": "accessibility"
387
393
  });
388
394
  var SET_BY_ARGUMENT = Object.freeze({
389
395
  "--headless": "headless",
@@ -1331,13 +1337,14 @@ class ProfileListener {
1331
1337
  }
1332
1338
 
1333
1339
  // src/keeper.ts
1334
- async function startDirectly(spec, output, hidden, detached = true, errors = output) {
1340
+ async function startDirectly(spec, output, hidden, detached = true, errors = output, directory = process.cwd()) {
1335
1341
  return await new Promise((resolve) => {
1336
1342
  const child = spawn(spec.command, [...spec.args], {
1337
1343
  stdio: ["ignore", output, errors],
1338
1344
  detached,
1339
1345
  windowsHide: hidden,
1340
- env: withChanges(process.env, spec.envChanges)
1346
+ env: withChanges(process.env, spec.envChanges),
1347
+ cwd: directory
1341
1348
  });
1342
1349
  child.once("error", (error) => {
1343
1350
  resolve({ error: error.message });
@@ -1353,14 +1360,14 @@ async function startThroughHelper(spec, output, stopFile) {
1353
1360
  const errorFile = join5(scratch, "error");
1354
1361
  const where = spec.desktop === undefined ? "without activation" : `on the ${spec.desktop} desktop`;
1355
1362
  try {
1356
- const wrapper = throughHelper(spec, spec.command, spec.args, {
1363
+ const wrapper = throughHelper({ ...spec, directory: process.cwd() }, spec.command, spec.args, {
1357
1364
  spec: join5(scratch, "spec.json"),
1358
1365
  pid: pidFile,
1359
1366
  error: errorFile,
1360
1367
  stop: stopFile
1361
1368
  });
1362
1369
  const envChanges = spec.desktop === undefined ? spec.envChanges : { ...spec.envChanges, [DESKTOP_VARIABLE]: spec.desktop };
1363
- const started = await startDirectly({ ...spec, command: wrapper.command, args: wrapper.args, envChanges }, output, true, false, "ignore");
1370
+ const started = await startDirectly({ ...spec, command: wrapper.command, args: wrapper.args, envChanges }, output, true, false, "ignore", tmpdir4());
1364
1371
  if ("error" in started) {
1365
1372
  return started;
1366
1373
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdharness",
3
- "version": "1.2.24",
3
+ "version": "1.2.26",
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",