feat(app): open composer subagent tabs in the explorer pane
Tapping a subagent or provider subagent from the composer track now opens its tab in the explorer companion pane when desktop split panes are active, keeping the parent agent visible in the primary pane. Mobile and compact layouts continue using single-pane tab navigation, and cross-workspace subagents continue routing to their own workspace.
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
} from "@/workspace-tabs/agent-visibility";
|
||||
import { buildWorkspaceTabPersistenceKey } from "@/workspace-tabs/model";
|
||||
import { selectSubagentsForParent } from "@/subagents/select";
|
||||
import { findPaneById, findPaneContainingTab } from "./workspace-layout-actions";
|
||||
import { useWorkspaceLayoutStore } from "./workspace-layout-store";
|
||||
import { useSessionStore, type Agent } from "./session-store";
|
||||
|
||||
@@ -251,4 +252,63 @@ describe("workspace subagents integration", () => {
|
||||
).map((row) => row.id),
|
||||
).toEqual([child.id]);
|
||||
});
|
||||
|
||||
it("opens a subagent in the explorer pane when focused", () => {
|
||||
const workspaceKey = buildWorkspaceTabPersistenceKey({
|
||||
serverId: SERVER_ID,
|
||||
workspaceId: WORKSPACE_ID,
|
||||
});
|
||||
expect(workspaceKey).toBeTruthy();
|
||||
|
||||
const parent = makeAgent({
|
||||
id: "parent-agent",
|
||||
title: "Parent agent",
|
||||
});
|
||||
const child = makeAgent({
|
||||
id: "child-agent",
|
||||
parentAgentId: parent.id,
|
||||
title: "Child agent",
|
||||
});
|
||||
|
||||
initializeAgents([parent, child]);
|
||||
reconcileWorkspaceTabs(workspaceKey!, deriveVisibilityFromSession());
|
||||
|
||||
const store = useWorkspaceLayoutStore.getState();
|
||||
const tabId = store.openTabInExplorerPaneFocused(workspaceKey!, {
|
||||
target: { kind: "agent", agentId: child.id },
|
||||
parentTabId: `agent_${parent.id}`,
|
||||
});
|
||||
|
||||
const state = useWorkspaceLayoutStore.getState();
|
||||
const layout = state.layoutByWorkspace[workspaceKey!];
|
||||
const explorerPaneId = state.explorerPaneIdByWorkspace[workspaceKey!];
|
||||
|
||||
expect(explorerPaneId).toBeTruthy();
|
||||
expect(findPaneContainingTab(layout.root, tabId!)?.id).toBe(explorerPaneId);
|
||||
expect(findPaneById(layout.root, explorerPaneId!)?.hidden).toBeUndefined();
|
||||
expect(layout.focusedPaneId).toBe(explorerPaneId);
|
||||
});
|
||||
|
||||
it("opens a provider subagent in the explorer pane when focused", () => {
|
||||
const workspaceKey = buildWorkspaceTabPersistenceKey({
|
||||
serverId: SERVER_ID,
|
||||
workspaceId: WORKSPACE_ID,
|
||||
});
|
||||
expect(workspaceKey).toBeTruthy();
|
||||
|
||||
const store = useWorkspaceLayoutStore.getState();
|
||||
const tabId = store.openTabInExplorerPaneFocused(workspaceKey!, {
|
||||
target: { kind: "provider_subagent", parentAgentId: "parent-agent", subagentId: "task-1" },
|
||||
parentTabId: "agent_parent-agent",
|
||||
});
|
||||
|
||||
const state = useWorkspaceLayoutStore.getState();
|
||||
const layout = state.layoutByWorkspace[workspaceKey!];
|
||||
const explorerPaneId = state.explorerPaneIdByWorkspace[workspaceKey!];
|
||||
|
||||
expect(explorerPaneId).toBeTruthy();
|
||||
expect(findPaneContainingTab(layout.root, tabId!)?.id).toBe(explorerPaneId);
|
||||
expect(findPaneById(layout.root, explorerPaneId!)?.hidden).toBeUndefined();
|
||||
expect(layout.focusedPaneId).toBe(explorerPaneId);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user