feat(domain,application,infrastructure,backend,web-server,app-tauri,frontend): persistance et reprise des conversations de CLI custom par agent — index durable <projet>/.ideai/conversations/custom-index.json borné aux conversations non vides par agent (conversation_id logique, titre dérivé de la première invite, created/updated_at_ms), port CustomConversationIndex + adaptateur FsCustomConversationIndex, persistence des messages utilisateur et finals agent dans le log de conversation existant, DTO/commandes app-tauri et routes web-server pour lister/rouvrir, CustomAgentChatView: ouverture par défaut sur une nouvelle conversation, menu reprise d'une conversation passée ou nouvelle conversation, replay de l'historique sauvegardé (user+finals) à la réouverture, affichage normal des nouveaux messages après reprise, /clean ouvre une nouvelle conversation, aucune entrée créée si la conversation courante est vide, injection de l'historique dans le contexte agent différée au premier nouveau message après reprise — #363 (QA verte: git diff --check, cargo fmt --all -- --check, cargo tests ciblés infrastructure/application/web-server/app-tauri/backend, npm run typecheck, tests frontend ciblés et CustomAgentChatView, npm run build)
This commit is contained in:
@ -481,7 +481,7 @@ describe("LayoutGrid custom agent CLI (#147)", () => {
|
||||
expect(screen.queryByText(/déjà actif dans une autre cellule/)).toBeNull();
|
||||
});
|
||||
|
||||
it("restores a custom CLI transcript when returning with a conversation id but no session (#217)", async () => {
|
||||
it("starts a fresh custom CLI conversation when returning without a live session (#363)", async () => {
|
||||
const layout = new MockLayoutGateway();
|
||||
const agent = new MockAgentGateway();
|
||||
const profileGateway = new MockProfileGateway();
|
||||
@ -506,15 +506,13 @@ describe("LayoutGrid custom agent CLI (#147)", () => {
|
||||
});
|
||||
window.localStorage.setItem(`idea.agent-cell-mode.p1.${leafId}`, "custom");
|
||||
const launchChat = vi.spyOn(agent, "launchAgentChat").mockResolvedValue({
|
||||
sessionId: "chat-resumed",
|
||||
sessionId: "chat-fresh",
|
||||
cellKind: "chat" as const,
|
||||
assignedConversationId: "conversation-fresh",
|
||||
});
|
||||
const reattachChat = vi.spyOn(agent, "reattachAgentChat").mockResolvedValue({
|
||||
sessionId: "chat-resumed",
|
||||
scrollback: [
|
||||
{ kind: "userPrompt", text: "known prompt" },
|
||||
{ kind: "final", content: "known answer" },
|
||||
],
|
||||
sessionId: "chat-fresh",
|
||||
scrollback: [],
|
||||
});
|
||||
|
||||
renderGrid({
|
||||
@ -525,25 +523,25 @@ describe("LayoutGrid custom agent CLI (#147)", () => {
|
||||
system,
|
||||
} as unknown as Gateways);
|
||||
|
||||
expect(await screen.findByText("known answer")).toBeTruthy();
|
||||
expect(screen.getByText("known prompt")).toBeTruthy();
|
||||
expect(await screen.findByText("Nouvelle conversation")).toBeTruthy();
|
||||
expect(screen.queryByText("known prompt")).toBeNull();
|
||||
expect(launchChat).toHaveBeenCalledWith(
|
||||
"p1",
|
||||
created.id,
|
||||
expect.objectContaining({
|
||||
nodeId: leafId,
|
||||
conversationId: "conversation-known",
|
||||
conversationId: undefined,
|
||||
}),
|
||||
);
|
||||
expect(reattachChat).toHaveBeenCalledWith("chat-resumed", expect.any(Function));
|
||||
expect(reattachChat).toHaveBeenCalledWith("chat-fresh", expect.any(Function));
|
||||
await waitFor(async () => {
|
||||
const updated = await layout.loadLayout("p1");
|
||||
const leaf = leaves(updated)[0];
|
||||
expect(leaf.conversationId).toBe("conversation-known");
|
||||
expect(leaf.session).toBe("chat-resumed");
|
||||
expect(leaf.conversationId).toBe("conversation-fresh");
|
||||
expect(leaf.session).toBe("chat-fresh");
|
||||
});
|
||||
expect(screen.queryByText("Envoyez un message pour démarrer la conversation structurée."))
|
||||
.toBeNull();
|
||||
expect(screen.getByText("Envoyez un message pour démarrer la conversation structurée."))
|
||||
.toBeTruthy();
|
||||
});
|
||||
|
||||
it("relaunches a stopped custom CLI agent from scratch (#197)", async () => {
|
||||
|
||||
Reference in New Issue
Block a user