initial commit

This commit is contained in:
pi
2026-04-10 23:12:17 +01:00
commit d64e050fcc
34 changed files with 6954 additions and 0 deletions

33
src/runner.test.ts Normal file
View File

@@ -0,0 +1,33 @@
import test from "node:test";
import assert from "node:assert/strict";
import { createTmuxSingleRunner } from "./runner.ts";
test("createTmuxSingleRunner always kills the pane after monitor completion", async () => {
const killed: string[] = [];
const runSingleTask = createTmuxSingleRunner({
assertInsideTmux() {},
getCurrentWindowId: async () => "@1",
createArtifacts: async () => ({
metaPath: "/tmp/meta.json",
runId: "run-1",
eventsPath: "/tmp/events.jsonl",
resultPath: "/tmp/result.json",
sessionPath: "/tmp/child-session.jsonl",
stdoutPath: "/tmp/stdout.log",
stderrPath: "/tmp/stderr.log",
}),
buildWrapperCommand: () => "'node' '/wrapper.mjs' '/tmp/meta.json'",
createPane: async () => "%9",
monitorRun: async () => ({ finalText: "done", exitCode: 0 }),
killPane: async (paneId: string) => {
killed.push(paneId);
},
});
const result = await runSingleTask({ cwd: "/repo", meta: { task: "inspect auth" } as any });
assert.equal(result.paneId, "%9");
assert.equal(result.finalText, "done");
assert.deepEqual(killed, ["%9"]);
});