feat: store workspace preferences and drafts locally

This commit is contained in:
2026-08-04 05:28:13 +02:00
parent 6c09adc05e
commit cee4cfa63d
8 changed files with 537 additions and 21 deletions
+30
View File
@@ -125,6 +125,10 @@ test("footer shows cumulative k-token counters after workspace and context gauge
workspace: "psd", provider: "zai", model: "glm-5.2", thinking: "medium",
})),
http.get("http://localhost:8787/workspaces", () => HttpResponse.json([{ name: "psd" }])),
http.get("http://localhost:8787/workspaces/psd", () => HttpResponse.json({
workspace: { llm_policy: { allowed: ["zai/glm-5.2"] } },
revision: { id: "psd", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot", state: "operational" },
})),
http.get("http://localhost:8787/models", () => HttpResponse.json({
models: [{ provider: "zai", id: "glm-5.2", name: "GLM-5.2", reasoning: true }],
})),
@@ -151,6 +155,32 @@ test("footer shows cumulative k-token counters after workspace and context gauge
expect(thinking.compareDocumentPosition(gauge) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
});
test("footer limits model choices to the selected workspace policy", async () => {
server.use(
http.get("http://localhost:8787/settings", () => HttpResponse.json({
workspace: "psd-clinical", provider: "zai", model: "glm-5.2", thinking: "medium",
})),
http.get("http://localhost:8787/workspaces", () => HttpResponse.json([{
id: "psd-clinical", name: "psd-clinical", file: "psd-clinical.yaml", displayName: "PSD Clinical",
revision: { id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot", state: "operational" },
}])),
http.get("http://localhost:8787/workspaces/psd-clinical", () => HttpResponse.json({
workspace: { llm_policy: { allowed: ["zai/glm-5.2"] } },
revision: { id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot", state: "operational" },
})),
http.get("http://localhost:8787/models", () => HttpResponse.json({ models: [
{ provider: "zai", id: "glm-5.2", name: "GLM-5.2", reasoning: true },
{ provider: "deepseek", id: "deepseek-v4-pro", name: "DeepSeek V4 Pro", reasoning: true },
] })),
);
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
render(<QueryClientProvider client={client}><ComposerFooter /></QueryClientProvider>);
const selector = await screen.findByRole("combobox", { name: "Model" });
await waitFor(() => expect(selector).toHaveTextContent("GLM-5.2"));
await waitFor(() => expect(selector).not.toHaveTextContent("DeepSeek V4 Pro"));
});
test("pulses the stop dot only while the harness is working", () => {
const { rerender } = render(<SteerInput sessionId="s1" working />);
const dot = () =>