refactor: replace store-based keyboard action requests with direct dispatcher and simplify agent attention clearing
This commit is contained in:
@@ -1,37 +1,8 @@
|
||||
import {
|
||||
parseHostAgentRouteFromPathname,
|
||||
parseHostWorkspaceOpenIntentFromPathname,
|
||||
parseHostWorkspaceRouteFromPathname,
|
||||
} from "@/utils/host-routes";
|
||||
|
||||
export function resolveSelectedOrRouteAgentKey(input: {
|
||||
selectedAgentId?: string;
|
||||
pathname: string;
|
||||
}): string | null {
|
||||
if (input.selectedAgentId) {
|
||||
return input.selectedAgentId;
|
||||
}
|
||||
|
||||
const workspaceRoute = parseHostWorkspaceRouteFromPathname(input.pathname);
|
||||
const workspaceOpenIntent = parseHostWorkspaceOpenIntentFromPathname(input.pathname);
|
||||
if (workspaceRoute && workspaceOpenIntent) {
|
||||
if (workspaceOpenIntent.kind === "agent") {
|
||||
const agentId = workspaceOpenIntent.agentId.trim();
|
||||
return agentId ? `${workspaceRoute.serverId}:${agentId}` : null;
|
||||
}
|
||||
if (workspaceOpenIntent.kind === "draft") {
|
||||
const draftId = workspaceOpenIntent.draftId.trim();
|
||||
return draftId ? `${workspaceRoute.serverId}:${draftId}` : null;
|
||||
}
|
||||
}
|
||||
|
||||
const route = parseHostAgentRouteFromPathname(input.pathname);
|
||||
if (!route) {
|
||||
return null;
|
||||
}
|
||||
return `${route.serverId}:${route.agentId}`;
|
||||
}
|
||||
|
||||
export function canToggleFileExplorerShortcut(input: {
|
||||
selectedAgentId?: string;
|
||||
pathname: string;
|
||||
|
||||
Reference in New Issue
Block a user