agent-dag 1.33.24 → 1.33.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/bin/agent-dag.js CHANGED
@@ -26,6 +26,7 @@ import { spawn } from "node:child_process";
26
26
  import { connect } from "node:net";
27
27
  import { dirname, join } from "node:path";
28
28
  import { fileURLToPath } from "node:url";
29
+ import { spawnSpec } from "../src/server/exec.mjs";
29
30
  import { installedVersion, npxRestartSpec } from "../src/server/self-update.mjs";
30
31
 
31
32
  // Chosen because they mean nothing else here: the worker exits 0 normally and
@@ -36,7 +37,8 @@ const BIN_DIR = dirname(fileURLToPath(import.meta.url));
36
37
  const WORKER = join(BIN_DIR, "deck.js");
37
38
  const PKG_ROOT = dirname(BIN_DIR);
38
39
 
39
- // npx is a .cmd shim on Windows, which spawn can only launch through a shell.
40
+ // npx is a .cmd shim on Windows, which spawn can only launch through cmd.exe
41
+ // spawnSpec is how, with the arguments quoted rather than pasted together.
40
42
  const NPX = process.platform === "win32" ? "npx.cmd" : "npx";
41
43
  const VERSION = installedVersion(PKG_ROOT) ?? "?";
42
44
 
@@ -141,7 +143,14 @@ function launchNpx() {
141
143
  args.push("--no-open");
142
144
 
143
145
  process.stdout.write(`\n ↻ fetching ${spec}…\n`);
144
- const started = spawn(NPX, args, { stdio: "inherit", shell: process.platform === "win32" });
146
+ // Not `shell: true`. Everything after the spec is the user's own argv, and
147
+ // Node would paste it into one command line unquoted: `--workspace C:\Users\
148
+ // John Smith\proj` would reach the new deck as two arguments, the second one
149
+ // silently dropped by its parser — an upgraded deck watching the wrong
150
+ // directory. spawnSpec routes npx.cmd through cmd.exe with every argument
151
+ // quoted, and is a plain spawn everywhere else.
152
+ const { file, args: argv, opts } = spawnSpec(NPX, args);
153
+ const started = spawn(file, argv, { stdio: "inherit", ...opts });
145
154
  child = started;
146
155
 
147
156
  // Whether the replacement ever got as far as serving. An npx that cannot