fix(frontend): track playback completion and meaningful inactivity

This commit is contained in:
2026-10-07 09:27:54 -03:00
parent ff32c6a605
commit 09bf6ece00
8 changed files with 173 additions and 10 deletions
@@ -247,4 +247,18 @@ describe("voice application lifecycle", () => {
expect(client.close).toHaveBeenCalledOnce();
expect(controller.getSnapshot().status).toBe("closed");
});
it("does not count native processing or an external answer request as user inactivity", async () => {
const client = await start();
client.emit("status", "processing");
await vi.advanceTimersByTimeAsync(60000);
expect(client.close).not.toHaveBeenCalled();
client.emit("transcript", { id: "u1", role: "user", text: "Consulta lenta", partial: false });
client.emit("status", "listening");
await vi.advanceTimersByTimeAsync(60000);
expect(client.close).not.toHaveBeenCalled();
expect(controller.getSnapshot().status).toBe("processing");
pendingReasoning?.(new Response(JSON.stringify({ answer: "Respuesta" })));
await vi.advanceTimersByTimeAsync(1);
expect(controller.getSnapshot().status).toBe("listening");
});
});