pipane 0.1.3 → 0.1.4
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.
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { WebSocket } from "ws";
|
|
13
13
|
import { copyFile } from "node:fs/promises";
|
|
14
|
+
import { existsSync } from "node:fs";
|
|
14
15
|
import path from "node:path";
|
|
15
16
|
import { URL } from "node:url";
|
|
16
17
|
import { getAgentDir } from "@mariozechner/pi-coding-agent";
|
|
@@ -559,7 +560,8 @@ export class WsHandler {
|
|
|
559
560
|
const newFilename = `${timestamp}_${newId}.jsonl`;
|
|
560
561
|
const newSessionPath = path.join(sessionsDir, newFilename);
|
|
561
562
|
await copyFile(sessionPath, newSessionPath);
|
|
562
|
-
const
|
|
563
|
+
const forkCwd = getSessionCwd(sessionPath);
|
|
564
|
+
const cwd = (forkCwd && existsSync(forkCwd)) ? forkCwd : this.defaultCwd;
|
|
563
565
|
const proc = await this.acquireProcess(cwd);
|
|
564
566
|
await this.pool.waitForReady(proc);
|
|
565
567
|
this.busyProcesses.add(proc);
|
|
@@ -632,7 +634,8 @@ export class WsHandler {
|
|
|
632
634
|
const existing = this.lifecycle.getAttachedProcess(sessionPath);
|
|
633
635
|
if (existing)
|
|
634
636
|
return existing;
|
|
635
|
-
const
|
|
637
|
+
const sessionCwd = getSessionCwd(sessionPath);
|
|
638
|
+
const cwd = (sessionCwd && existsSync(sessionCwd)) ? sessionCwd : this.defaultCwd;
|
|
636
639
|
const proc = await this.acquireProcess(cwd);
|
|
637
640
|
this.busyProcesses.add(proc);
|
|
638
641
|
this.lifecycle.attach(sessionPath, proc);
|
package/package.json
CHANGED