@pi-harness/pi-harness 0.1.89 → 0.1.90
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/apps/web/dist/assets/{index-9WCj0TsV.js → index-BHsP1uCF.js} +1 -1
- package/apps/web/dist/index.html +1 -1
- package/apps/web/package.json +1 -1
- package/node_modules/@pi-harness/api-gateway/dist/index.d.ts.map +1 -1
- package/node_modules/@pi-harness/api-gateway/dist/index.js +5 -1
- package/node_modules/@pi-harness/api-gateway/dist/index.js.map +1 -1
- package/node_modules/@pi-harness/api-gateway/package.json +1 -1
- package/node_modules/@pi-harness/cli/package.json +1 -1
- package/node_modules/@pi-harness/host-webserver/package.json +1 -1
- package/node_modules/@pi-harness/web-app/package.json +1 -1
- package/package.json +6 -6
- package/packages/api-gateway/dist/index.d.ts.map +1 -1
- package/packages/api-gateway/dist/index.js +5 -1
- package/packages/api-gateway/dist/index.js.map +1 -1
- package/packages/api-gateway/package.json +1 -1
- package/packages/api-gateway/src/index.ts +4 -1
- package/packages/api-gateway/test/index.test.ts +43 -0
- package/packages/bundle-web-app/package.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/host-webserver/package.json +1 -1
|
@@ -3762,6 +3762,49 @@ describe("API gateway plugin", () => {
|
|
|
3762
3762
|
expect(JSON.parse(await readFile(join(sessionDir, ".pi-harness-session-meta.json"), "utf8"))).toEqual({});
|
|
3763
3763
|
});
|
|
3764
3764
|
|
|
3765
|
+
test("deletes an empty active session whose JSONL file has not been persisted yet", async () => {
|
|
3766
|
+
const context = new Context();
|
|
3767
|
+
contexts.push(context);
|
|
3768
|
+
const directory = await mkdtemp(join(tmpdir(), "pi-harness-api-empty-session-delete-"));
|
|
3769
|
+
temporaryDirectories.push(directory);
|
|
3770
|
+
const sessionDir = join(directory, "sessions");
|
|
3771
|
+
await mkdir(sessionDir);
|
|
3772
|
+
await context.plugin(webServerPlugin, { host: "127.0.0.1", port: 0 });
|
|
3773
|
+
const target = join(sessionDir, "2026-08-30T00-00-00-000Z_empty.jsonl");
|
|
3774
|
+
const manager = SessionManager.create("/tmp", sessionDir);
|
|
3775
|
+
let activePath: string | undefined = target;
|
|
3776
|
+
const session = {
|
|
3777
|
+
sessionId: "empty-session",
|
|
3778
|
+
get sessionFile() {
|
|
3779
|
+
return activePath;
|
|
3780
|
+
},
|
|
3781
|
+
messages: [],
|
|
3782
|
+
isStreaming: false,
|
|
3783
|
+
sessionManager: manager,
|
|
3784
|
+
extensionRunner: { setUIContext() {} },
|
|
3785
|
+
subscribe: () => () => {},
|
|
3786
|
+
};
|
|
3787
|
+
const sessionRuntime = {
|
|
3788
|
+
newSession() {
|
|
3789
|
+
activePath = undefined;
|
|
3790
|
+
return Promise.resolve({ cancelled: false });
|
|
3791
|
+
},
|
|
3792
|
+
};
|
|
3793
|
+
context.provide("piRuntime", { session, sessionRuntime, prompt: () => Promise.resolve() } as never);
|
|
3794
|
+
context.provide("piModels", { model: { provider: "test", id: "model" } } as never);
|
|
3795
|
+
context.provide("piHarnessLaunch", { cwd: "/tmp", agentDir: "/tmp/agent", args: [], requestExit() {} });
|
|
3796
|
+
await context.plugin(apiPlugin);
|
|
3797
|
+
|
|
3798
|
+
const response = await fetch(context.webServer.url + "/api/session/delete", {
|
|
3799
|
+
method: "POST",
|
|
3800
|
+
headers: { "content-type": "application/json" },
|
|
3801
|
+
body: JSON.stringify({ path: target, confirm: true }),
|
|
3802
|
+
});
|
|
3803
|
+
expect(response.status).toBe(200);
|
|
3804
|
+
await expect(response.json()).resolves.toMatchObject({ deleted: true, path: target });
|
|
3805
|
+
await expect(stat(target)).rejects.toMatchObject({ code: "ENOENT" });
|
|
3806
|
+
});
|
|
3807
|
+
|
|
3765
3808
|
test("keeps batch deletion going past a failing session and persists the metadata it did remove", async () => {
|
|
3766
3809
|
const context = new Context();
|
|
3767
3810
|
contexts.push(context);
|