@henryqw/pi-herdr-clone 0.2.6 → 0.2.8
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/extensions/clone-tab.ts +22 -23
- package/package.json +2 -2
package/extensions/clone-tab.ts
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
createHerdrClient,
|
|
14
14
|
herdrCommandFailure,
|
|
15
|
-
|
|
15
|
+
startPiAgent,
|
|
16
16
|
withWorktreeLock,
|
|
17
17
|
type HerdrClient,
|
|
18
18
|
type HerdrExecResult,
|
|
@@ -129,14 +129,12 @@ async function createBranchedClone(
|
|
|
129
129
|
const createdClone = session.createBranchedSession(source.leafId);
|
|
130
130
|
if (!createdClone) throw new Error("Pi did not create a persisted clone session file.");
|
|
131
131
|
const cloneFile = resolve(createdClone);
|
|
132
|
-
let cloneStat;
|
|
133
132
|
try {
|
|
134
|
-
|
|
133
|
+
if ((await stat(cloneFile)).isFile()) return cloneFile;
|
|
135
134
|
} catch (error) {
|
|
136
135
|
throw new Error(`Pi clone session file was not created: ${cloneFile}`, { cause: error });
|
|
137
136
|
}
|
|
138
|
-
|
|
139
|
-
return cloneFile;
|
|
137
|
+
throw new Error(`Pi clone session path is not a file: ${cloneFile}`);
|
|
140
138
|
}
|
|
141
139
|
|
|
142
140
|
// A worktree layout plugin (e.g. herdr-plus) can start its own agent in a new
|
|
@@ -201,24 +199,25 @@ async function launchCloneAgent(
|
|
|
201
199
|
): Promise<string> {
|
|
202
200
|
const agentName = `clone-${randomUUID().replaceAll("-", "").slice(0, 24)}`;
|
|
203
201
|
try {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
202
|
+
const result = await startPiAgent(herdr, {
|
|
203
|
+
name: agentName,
|
|
204
|
+
pane: rootPaneId,
|
|
205
|
+
args: ["--session", cloneFile],
|
|
206
|
+
options: { cwd: ctx.cwd },
|
|
207
|
+
onPaneBusy: onPaneBusy
|
|
208
|
+
? async () => {
|
|
209
|
+
const next = await onPaneBusy!();
|
|
210
|
+
rootPaneId = next.rootPaneId;
|
|
211
|
+
retained = next.retained;
|
|
212
|
+
return rootPaneId;
|
|
213
|
+
}
|
|
214
|
+
: undefined,
|
|
215
|
+
});
|
|
216
|
+
if (result.code === 0 && !result.killed) return agentName;
|
|
217
|
+
const startArgs = [
|
|
218
|
+
"agent", "start", agentName, "--kind", "pi", "--pane", rootPaneId, "--", "--session", cloneFile,
|
|
219
|
+
];
|
|
220
|
+
throw new Error(herdrCommandFailure(startArgs, result));
|
|
222
221
|
} catch (error) {
|
|
223
222
|
throw new Error(
|
|
224
223
|
`Clone launch could not be confirmed after starting agent ${agentName}; retained ${retained}: ${errorMessage(error)}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@henryqw/pi-herdr-clone",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "Clone the current Pi conversation path into a new Herdr tab.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@earendil-works/pi-coding-agent": "^0.84.2"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@henryqw/pi-herdr": "^0.
|
|
31
|
+
"@henryqw/pi-herdr": "^0.4.0"
|
|
32
32
|
},
|
|
33
33
|
"repository": {
|
|
34
34
|
"type": "git",
|