pi-herdr-subagents 0.1.2 → 0.1.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.
- package/package.json +1 -1
- package/pi-extension/subagents/herdr.ts +15 -6
- package/test/test.ts +16 -0
package/package.json
CHANGED
|
@@ -114,18 +114,26 @@ function getHerdrCurrentPaneInfo(): {
|
|
|
114
114
|
return { pane_id: paneId, tab_id: tabId, workspace_id: workspaceId };
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
// instead of ever-narrower splits of the parent pane.
|
|
120
|
-
const output = herdrExec([
|
|
117
|
+
function buildTabCreateArgs(name: string, cwd: string, workspaceId: string): string[] {
|
|
118
|
+
return [
|
|
121
119
|
"tab",
|
|
122
120
|
"create",
|
|
121
|
+
"--workspace",
|
|
122
|
+
workspaceId,
|
|
123
123
|
"--label",
|
|
124
124
|
name,
|
|
125
125
|
"--cwd",
|
|
126
|
-
|
|
126
|
+
cwd,
|
|
127
127
|
"--no-focus",
|
|
128
|
-
]
|
|
128
|
+
];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function createHerdrSurface(name: string): string {
|
|
132
|
+
// Create a new tab per subagent so parallel spawns each get a full tab
|
|
133
|
+
// instead of ever-narrower splits of the parent pane. Target the current
|
|
134
|
+
// workspace explicitly because Herdr's implicit default may be another space.
|
|
135
|
+
const { workspace_id: workspaceId } = getHerdrCurrentPaneInfo();
|
|
136
|
+
const output = herdrExec(buildTabCreateArgs(name, process.cwd(), workspaceId));
|
|
129
137
|
const paneId = extractHerdrRootPaneId(output, "tab create");
|
|
130
138
|
try {
|
|
131
139
|
herdrExec(["pane", "rename", paneId, name]);
|
|
@@ -260,6 +268,7 @@ export function renameHerdrWorkspace(title: string): void {
|
|
|
260
268
|
}
|
|
261
269
|
|
|
262
270
|
export const __herdrTest__ = {
|
|
271
|
+
buildTabCreateArgs,
|
|
263
272
|
parseHerdrJson,
|
|
264
273
|
extractHerdrPaneId,
|
|
265
274
|
extractHerdrRootPaneId,
|
package/test/test.ts
CHANGED
|
@@ -2752,6 +2752,22 @@ describe("herdr.ts", () => {
|
|
|
2752
2752
|
});
|
|
2753
2753
|
});
|
|
2754
2754
|
|
|
2755
|
+
describe("herdr command construction", () => {
|
|
2756
|
+
it("targets the current workspace when creating a subagent tab", () => {
|
|
2757
|
+
assert.deepEqual(__herdrTest__.buildTabCreateArgs("reviewer", "/repo", "workspace-2"), [
|
|
2758
|
+
"tab",
|
|
2759
|
+
"create",
|
|
2760
|
+
"--workspace",
|
|
2761
|
+
"workspace-2",
|
|
2762
|
+
"--label",
|
|
2763
|
+
"reviewer",
|
|
2764
|
+
"--cwd",
|
|
2765
|
+
"/repo",
|
|
2766
|
+
"--no-focus",
|
|
2767
|
+
]);
|
|
2768
|
+
});
|
|
2769
|
+
});
|
|
2770
|
+
|
|
2755
2771
|
describe("herdr response parsing", () => {
|
|
2756
2772
|
it("extracts pane id from a pane split response", () => {
|
|
2757
2773
|
const output = JSON.stringify({
|