feat: canonical workspace tab IDs with URL routing and draft agent tabs
Rewrite workspace tab management to use stable tab IDs (agent_, terminal_, draft_, file_) with dedicated /tab/[tabId] routes, replace separate file-tabs store with unified workspace-tabs store, support multiple concurrent draft agent tabs, and detect text files by content instead of extension allowlist. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
97f0f4b266
commit
73eabd2eea
@@ -3,6 +3,7 @@ import {
|
||||
parseHostAgentRouteFromPathname,
|
||||
parseHostWorkspaceAgentRouteFromPathname,
|
||||
parseHostWorkspaceRouteFromPathname,
|
||||
parseHostWorkspaceTabRouteFromPathname,
|
||||
} from "@/utils/host-routes";
|
||||
|
||||
const DRAFT_AGENT_ID = "__new_agent__";
|
||||
@@ -14,6 +15,19 @@ export function resolveSelectedOrRouteAgentKey(input: {
|
||||
if (input.selectedAgentId) {
|
||||
return input.selectedAgentId;
|
||||
}
|
||||
|
||||
const workspaceTabRoute = parseHostWorkspaceTabRouteFromPathname(input.pathname);
|
||||
if (workspaceTabRoute?.tabId) {
|
||||
const tabId = workspaceTabRoute.tabId;
|
||||
if (tabId.startsWith("agent_")) {
|
||||
const agentId = tabId.slice("agent_".length).trim();
|
||||
return agentId ? `${workspaceTabRoute.serverId}:${agentId}` : null;
|
||||
}
|
||||
if (tabId.startsWith("draft_")) {
|
||||
return `${workspaceTabRoute.serverId}:${DRAFT_AGENT_ID}`;
|
||||
}
|
||||
}
|
||||
|
||||
const route =
|
||||
parseHostWorkspaceAgentRouteFromPathname(input.pathname) ??
|
||||
parseHostAgentRouteFromPathname(input.pathname);
|
||||
|
||||
Reference in New Issue
Block a user