Fork assistant turns into new drafts (#1788)
* feat(chat): fork assistant turns into new drafts Builds chat-history attachments on the daemon and routes them into draft composers so users can continue an assistant turn in an existing workspace tab or New Workspace. * fix(chat): clean up fork draft handling * fix(chat): address fork draft review feedback * fix(server): build fork context from bounded timeline * fix(app): restore assistant turn footer in streams * fix(app): preserve fork draft setup * fix(app): tighten assistant fork footers * fix(app): lock active fork draft handoff * fix(app): preserve attachment-only draft retries * fix(app): unify composer attachment scopes * fix(app): align chat history attachment labels * fix(app): centralize attachment pill content * fix(app): trim fork context for workspace naming
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import { useCreateFlowStore } from "./create-flow-store";
|
||||
import { isActiveCreateFlowForDraft, useCreateFlowStore } from "./create-flow-store";
|
||||
|
||||
describe("create-flow-store", () => {
|
||||
beforeEach(() => {
|
||||
@@ -88,4 +88,40 @@ describe("create-flow-store", () => {
|
||||
|
||||
expect(useCreateFlowStore.getState().pendingByDraftId["draft-1"]).toBeUndefined();
|
||||
});
|
||||
|
||||
it("matches only active pending create flows for a draft and server", () => {
|
||||
useCreateFlowStore.getState().setPending({
|
||||
draftId: "draft-1",
|
||||
serverId: "server-1",
|
||||
agentId: null,
|
||||
clientMessageId: "msg-1",
|
||||
text: "hello",
|
||||
timestamp: Date.now(),
|
||||
});
|
||||
const pending = useCreateFlowStore.getState().pendingByDraftId["draft-1"];
|
||||
|
||||
expect(
|
||||
isActiveCreateFlowForDraft({
|
||||
pending,
|
||||
serverId: "server-1",
|
||||
draftId: " draft-1 ",
|
||||
}),
|
||||
).toBe(true);
|
||||
expect(
|
||||
isActiveCreateFlowForDraft({
|
||||
pending,
|
||||
serverId: "server-2",
|
||||
draftId: "draft-1",
|
||||
}),
|
||||
).toBe(false);
|
||||
|
||||
useCreateFlowStore.getState().markLifecycle({ draftId: "draft-1", lifecycle: "sent" });
|
||||
expect(
|
||||
isActiveCreateFlowForDraft({
|
||||
pending: useCreateFlowStore.getState().pendingByDraftId["draft-1"],
|
||||
serverId: "server-1",
|
||||
draftId: "draft-1",
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user