Show optimistic chat for new workspaces

This commit is contained in:
Mohamed Boudra
2026-05-25 21:26:31 +07:00
parent d271597ee8
commit 30a8bffc24
11 changed files with 452 additions and 140 deletions
@@ -1354,6 +1354,56 @@ describe("workspace-layout-store actions", () => {
expect(findPaneById(layout.root, "main")?.focusedTabId).toBe("agent_agent-1");
});
it("reconcileTabs preserves a draft-origin agent tab id when there is no duplicate", () => {
const workspaceKey = createWorkspaceKey();
workspaceLayoutStore.setState((state) => ({
...state,
layoutByWorkspace: {
...state.layoutByWorkspace,
[workspaceKey]: {
root: {
kind: "pane",
pane: {
id: "main",
tabIds: ["draft-agent"],
focusedTabId: "draft-agent",
tabs: [
{
tabId: "draft-agent",
target: { kind: "agent", agentId: "agent-1" },
createdAt: 1,
},
],
} as SplitPane,
},
focusedPaneId: "main",
},
},
}));
workspaceLayoutStore.getState().reconcileTabs(workspaceKey, {
agentsHydrated: true,
terminalsHydrated: true,
activeAgentIds: ["agent-1"],
autoOpenAgentIds: ["agent-1"],
knownAgentIds: ["agent-1"],
standaloneTerminalIds: [],
hasActivePendingDraftCreate: false,
});
const layout = workspaceLayoutStore.getState().layoutByWorkspace[workspaceKey];
expect(collectAllTabs(layout.root)).toEqual([
{
tabId: "draft-agent",
target: { kind: "agent", agentId: "agent-1" },
createdAt: 1,
},
]);
expect(findPaneById(layout.root, "main")?.focusedTabId).toBe("draft-agent");
});
it("reconcileTabs does not re-add locally hidden agent tabs", () => {
const workspaceKey = createWorkspaceKey();