feat: add Pi management interface

This commit is contained in:
2026-08-05 05:53:28 +02:00
parent 4422568f61
commit 7a8bcacbfe
6 changed files with 606 additions and 10 deletions
@@ -80,6 +80,35 @@ test("regular users load only their sessions and never see administrator control
expect(screen.queryByText(/administrator view/i)).not.toBeInTheDocument();
});
test("opens Pi management from the session rail without replacing session controls", async () => {
const user = userEvent.setup();
server.use(
http.get("/api/me", () => HttpResponse.json({ issuer: "portal", subject: "alice", displayName: "Alice", isAdmin: false })),
http.get("/api/sessions", () => HttpResponse.json(LIST)),
http.get("/api/health/dwh", () => HttpResponse.json({ ok: true, detail: "ok" })),
http.get("/api/settings", () => HttpResponse.json({})),
http.get("/api/workspaces", () => HttpResponse.json([])),
http.get("/api/models", () => HttpResponse.json([])),
http.get("/api/pi-management/status", () => HttpResponse.json({
version: "0.80.3", ready: true,
config: { provider: "zai", model: "glm-5.2", reasoning: "medium" },
checkedAt: "2026-08-05T10:00:00.000Z",
})),
http.get("/api/pi-management/options", () => HttpResponse.json({
providers: ["zai"], models: [{ provider: "zai", id: "glm-5.2" }],
reasoning: ["low", "medium", "high"], checkedAt: "2026-08-05T10:00:00.000Z",
})),
);
wrap();
expect(await screen.findByText("Attiva uno")).toBeVisible();
await user.click(screen.getByRole("button", { name: "Pi management" }));
expect(await screen.findByRole("heading", { name: "Pi management" })).toBeVisible();
const shell = document.querySelector('[data-testid="app-shell"]');
expect(shell).toHaveTextContent("Workspace management");
expect(shell).toHaveTextContent("Active sessions");
});
test("administrators can explicitly switch to all sessions and see owners", async () => {
let scope = "";
server.use(