test: finish pi-subagents rename and regression cleanup
This commit is contained in:
2
index.ts
2
index.ts
@@ -39,7 +39,7 @@ export default function subagentsExtension(pi: ExtensionAPI) {
|
|||||||
|
|
||||||
const tmuxRunner = createTmuxSingleRunner({
|
const tmuxRunner = createTmuxSingleRunner({
|
||||||
assertInsideTmux() {
|
assertInsideTmux() {
|
||||||
if (!isInsideTmux()) throw new Error("tmux-backed subagents require pi to be running inside tmux.");
|
if (!isInsideTmux()) throw new Error('tmux runner requires pi to be running inside tmux.');
|
||||||
},
|
},
|
||||||
async getCurrentWindowId() {
|
async getCurrentWindowId() {
|
||||||
const result = await pi.exec("tmux", buildCurrentWindowArgs());
|
const result = await pi.exec("tmux", buildCurrentWindowArgs());
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "pi-tmux-subagent",
|
"name": "pi-subagents",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "pi-tmux-subagent",
|
"name": "pi-subagents",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@mariozechner/pi-agent-core": "^0.66.1",
|
"@mariozechner/pi-agent-core": "^0.66.1",
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { BUILTIN_AGENTS } from "./builtin-agents.ts";
|
|||||||
import { discoverAgents } from "./agents.ts";
|
import { discoverAgents } from "./agents.ts";
|
||||||
|
|
||||||
test("discoverAgents returns built-ins and lets user markdown override by name", async () => {
|
test("discoverAgents returns built-ins and lets user markdown override by name", async () => {
|
||||||
const root = await mkdtemp(join(tmpdir(), "tmux-subagent-agents-"));
|
const root = await mkdtemp(join(tmpdir(), "pi-subagents-agents-"));
|
||||||
const agentDir = join(root, "agent-home");
|
const agentDir = join(root, "agent-home");
|
||||||
const userAgentsDir = join(agentDir, "agents");
|
const userAgentsDir = join(agentDir, "agents");
|
||||||
await mkdir(userAgentsDir, { recursive: true });
|
await mkdir(userAgentsDir, { recursive: true });
|
||||||
@@ -30,7 +30,7 @@ test("discoverAgents returns built-ins and lets user markdown override by name",
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("discoverAgents lets project agents override user agents when scope is both", async () => {
|
test("discoverAgents lets project agents override user agents when scope is both", async () => {
|
||||||
const root = await mkdtemp(join(tmpdir(), "tmux-subagent-agents-"));
|
const root = await mkdtemp(join(tmpdir(), "pi-subagents-agents-"));
|
||||||
const repo = join(root, "repo");
|
const repo = join(root, "repo");
|
||||||
const agentDir = join(root, "agent-home");
|
const agentDir = join(root, "agent-home");
|
||||||
const userAgentsDir = join(agentDir, "agents");
|
const userAgentsDir = join(agentDir, "agents");
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { tmpdir } from "node:os";
|
|||||||
import { createRunArtifacts } from "./artifacts.ts";
|
import { createRunArtifacts } from "./artifacts.ts";
|
||||||
|
|
||||||
test("createRunArtifacts writes metadata and reserves stable artifact paths", async () => {
|
test("createRunArtifacts writes metadata and reserves stable artifact paths", async () => {
|
||||||
const cwd = await mkdtemp(join(tmpdir(), "tmux-subagent-run-"));
|
const cwd = await mkdtemp(join(tmpdir(), "pi-subagents-run-"));
|
||||||
|
|
||||||
const artifacts = await createRunArtifacts(cwd, {
|
const artifacts = await createRunArtifacts(cwd, {
|
||||||
runId: "run-1",
|
runId: "run-1",
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { tmpdir } from "node:os";
|
|||||||
import { monitorRun } from "./monitor.ts";
|
import { monitorRun } from "./monitor.ts";
|
||||||
|
|
||||||
test("monitorRun streams normalized events and resolves when result.json appears", async () => {
|
test("monitorRun streams normalized events and resolves when result.json appears", async () => {
|
||||||
const dir = await mkdtemp(join(tmpdir(), "tmux-subagent-monitor-"));
|
const dir = await mkdtemp(join(tmpdir(), "pi-subagents-monitor-"));
|
||||||
const eventsPath = join(dir, "events.jsonl");
|
const eventsPath = join(dir, "events.jsonl");
|
||||||
const resultPath = join(dir, "result.json");
|
const resultPath = join(dir, "result.json");
|
||||||
await writeFile(eventsPath, "", "utf8");
|
await writeFile(eventsPath, "", "utf8");
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ test("createTmuxSingleRunner always kills the pane after monitor completion", as
|
|||||||
test("createTmuxSingleRunner surfaces explicit tmux precondition errors", async () => {
|
test("createTmuxSingleRunner surfaces explicit tmux precondition errors", async () => {
|
||||||
const runSingleTask = createTmuxSingleRunner({
|
const runSingleTask = createTmuxSingleRunner({
|
||||||
assertInsideTmux() {
|
assertInsideTmux() {
|
||||||
throw new Error("tmux-backed subagents require pi to be running inside tmux.");
|
throw new Error("tmux runner requires pi to be running inside tmux.");
|
||||||
},
|
},
|
||||||
getCurrentWindowId: async () => "@1",
|
getCurrentWindowId: async () => "@1",
|
||||||
createArtifacts: async () => ({
|
createArtifacts: async () => ({
|
||||||
@@ -55,6 +55,6 @@ test("createTmuxSingleRunner surfaces explicit tmux precondition errors", async
|
|||||||
|
|
||||||
await assert.rejects(
|
await assert.rejects(
|
||||||
() => runSingleTask({ cwd: "/repo", meta: { task: "inspect auth" } as any }),
|
() => runSingleTask({ cwd: "/repo", meta: { task: "inspect auth" } as any }),
|
||||||
/tmux-backed subagents require pi to be running inside tmux/,
|
/tmux runner requires pi to be running inside tmux/,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ test("isInsideTmux reads the TMUX environment variable", () => {
|
|||||||
test("buildWrapperShellCommand single-quotes paths safely", () => {
|
test("buildWrapperShellCommand single-quotes paths safely", () => {
|
||||||
const command = buildWrapperShellCommand({
|
const command = buildWrapperShellCommand({
|
||||||
nodePath: "/usr/local/bin/node",
|
nodePath: "/usr/local/bin/node",
|
||||||
wrapperPath: "/repo/tmux-subagent/src/wrapper/cli.mjs",
|
wrapperPath: "/repo/subagents/src/wrapper/cli.mjs",
|
||||||
metaPath: "/repo/.pi/subagents/runs/run-1/meta.json",
|
metaPath: "/repo/.pi/subagents/runs/run-1/meta.json",
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
command,
|
command,
|
||||||
"'/usr/local/bin/node' '/repo/tmux-subagent/src/wrapper/cli.mjs' '/repo/.pi/subagents/runs/run-1/meta.json'",
|
"'/usr/local/bin/node' '/repo/subagents/src/wrapper/cli.mjs' '/repo/.pi/subagents/runs/run-1/meta.json'",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user