feat(chat): persistance bornee du brouillon custom chat par projet/layout (#182)

This commit is contained in:
2026-08-11 16:24:20 +02:00
parent 25ad44a3d9
commit 94b4ce7e5f
23 changed files with 1552 additions and 70 deletions

View File

@ -253,6 +253,33 @@ describe("TauriAgentGateway invoke payloads", () => {
expect(out.effect.kind).toBe("cleanConversation");
});
it("wraps chat draft persistence commands with the project/layout/node scope", async () => {
const gateway = new TauriAgentGateway();
const scope = {
projectId: "proj-1",
layoutId: "layout-1",
nodeId: "node-1",
};
invoke.mockResolvedValueOnce({ text: "hello", updatedAtMs: 42 });
await expect(gateway.readChatDraft(scope)).resolves.toEqual({
text: "hello",
updatedAtMs: 42,
});
await gateway.saveChatDraft(scope, "edited");
await gateway.clearChatDraft(scope);
expect(invoke).toHaveBeenNthCalledWith(1, "read_chat_draft", {
request: scope,
});
expect(invoke).toHaveBeenNthCalledWith(2, "save_chat_draft", {
request: { ...scope, text: "edited" },
});
expect(invoke).toHaveBeenNthCalledWith(3, "clear_chat_draft", {
request: scope,
});
});
it("launchAgentChat returns a handle only when launch_agent confirms cellKind chat", async () => {
invoke.mockResolvedValueOnce({
sessionId: "chat-session-1",