@pi-archimedes/subagent 1.7.0 → 1.7.1

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/spawn.ts +20 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-archimedes/subagent",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "type": "module",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -11,7 +11,7 @@
11
11
  ],
12
12
  "main": "./src/index.ts",
13
13
  "dependencies": {
14
- "@pi-archimedes/core": "1.7.0"
14
+ "@pi-archimedes/core": "1.7.1"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "@earendil-works/pi-ai": ">=0.1.0",
package/src/spawn.ts CHANGED
@@ -208,14 +208,27 @@ export function spawnSubagent(options: SpawnOptions): ChildProcess {
208
208
  // The task is the final positional argument
209
209
  args.push(options.task);
210
210
 
211
- const child = spawn(piBinary, args, {
212
- cwd: options.cwd || process.cwd(),
213
- env: {
214
- ...process.env,
215
- PI_SUBAGENT_SOCKET: socketPath,
211
+ // On Windows, spawn `node <resolved-js-path>` instead of the raw binary.
212
+ // The resolved path is a .js file which cannot be spawned directly on Windows.
213
+ // Using process.execPath avoids shell: true (no escaping risks, kill() works).
214
+ const isWindowsResolved = process.platform === "win32" && piBinary !== "pi";
215
+
216
+ const child = spawn(
217
+ isWindowsResolved ? process.execPath : piBinary,
218
+ [
219
+ ...(isWindowsResolved ? [piBinary] : []),
220
+ ...args,
221
+ ],
222
+ {
223
+ cwd: options.cwd || process.cwd(),
224
+ env: {
225
+ ...process.env,
226
+ PI_SUBAGENT_SOCKET: socketPath,
227
+ },
228
+ stdio: ["ignore", "pipe", "pipe"],
229
+ windowsHide: true,
216
230
  },
217
- stdio: ["ignore", "pipe", "pipe"],
218
- });
231
+ );
219
232
 
220
233
  // Clean up socket server when child exits
221
234
  child.on("exit", cleanupSocket);