feat: add server session queue clearing

This commit is contained in:
Federico Jaramillo Martinez
2026-07-14 00:24:14 +02:00
parent 9c62613fb6
commit a1f749cdb6
21 changed files with 735 additions and 23 deletions
@@ -28,6 +28,17 @@ describe("machine-scoped session proxy routes", () => {
expect(daemon.requests).toEqual([{ method: "GET", path: "/sessions?cwd=/repo", body: undefined }]);
});
it("forwards queue-clear mutations and their status through the session daemon", async () => {
const status = { sessionId: "session-1", pendingMessageCount: 0, queuedMessages: [] };
daemon.respondWith({ statusCode: 200, headers: { "content-type": "application/json" }, body: JSON.stringify(status) });
const response = await app.inject({ method: "POST", url: "/api/machines/local/sessions/session-1/queue/clear", payload: { cwd: "/repo" } });
expect(response.statusCode).toBe(200);
expect(response.json()).toEqual(status);
expect(daemon.requests).toEqual([{ method: "POST", path: "/sessions/session-1/queue/clear", body: { cwd: "/repo" } }]);
});
it("strips the machine prefix before forwarding auth requests", async () => {
const response = await app.inject({ method: "POST", url: "/api/machines/local/auth/api-key", payload: { providerId: "p", key: "k" } });