@pi-archimedes/subagent 1.3.2 → 1.3.3

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 +11 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-archimedes/subagent",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
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.3.2"
14
+ "@pi-archimedes/core": "1.3.3"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "@earendil-works/pi-ai": ">=0.1.0",
package/src/spawn.ts CHANGED
@@ -78,8 +78,13 @@ function resolvePiBinary(): string {
78
78
  * Returns the socket path and a cleanup function.
79
79
  */
80
80
  function startAskSocketServer(agentName: string): { socketPath: string; cleanup: () => void } {
81
- // Keep the socket path short Linux limit is 108 chars.
82
- const socketPath = path.join(os.tmpdir(), `pi-ask-${randomUUID().slice(0, 8)}.sock`);
81
+ // Use named pipes on Windows, Unix domain sockets elsewhere.
82
+ // Linux socket path limit is 108 chars — keep it short.
83
+ const id = randomUUID().slice(0, 8);
84
+ const socketPath =
85
+ process.platform === "win32"
86
+ ? `\\\\.\\pipe\\pi-ask-${id}`
87
+ : path.join(os.tmpdir(), `pi-ask-${id}.sock`);
83
88
 
84
89
  // Map of pending ask requests: requestId → write-back callback
85
90
  const pending = new Map<string, (response: unknown) => void>();
@@ -150,7 +155,10 @@ function startAskSocketServer(agentName: string): { socketPath: string; cleanup:
150
155
  const cleanup = () => {
151
156
  unsubResponse();
152
157
  server.close();
153
- try { fs.unlinkSync(socketPath); } catch { /* already gone */ }
158
+ // Named pipes on Windows are cleaned up automatically; only unlink on Unix
159
+ if (process.platform !== "win32") {
160
+ try { fs.unlinkSync(socketPath); } catch { /* already gone */ }
161
+ }
154
162
  };
155
163
 
156
164
  return { socketPath, cleanup };