feat: add workspace-aware notification routing and clean up agent screen header
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
buildHostDraftRoute,
|
||||
buildHostAgentDetailRoute,
|
||||
buildHostWorkspaceAgentTabRoute,
|
||||
} from "@/utils/host-routes";
|
||||
|
||||
type NotificationData = Record<string, unknown> | null | undefined;
|
||||
@@ -20,16 +21,23 @@ function readNonEmptyString(
|
||||
export function resolveNotificationTarget(data: NotificationData): {
|
||||
serverId: string | null;
|
||||
agentId: string | null;
|
||||
workspaceId: string | null;
|
||||
} {
|
||||
return {
|
||||
serverId: readNonEmptyString(data, "serverId"),
|
||||
agentId: readNonEmptyString(data, "agentId"),
|
||||
workspaceId:
|
||||
readNonEmptyString(data, "workspaceId") ??
|
||||
readNonEmptyString(data, "cwd"),
|
||||
};
|
||||
}
|
||||
|
||||
export function buildNotificationRoute(data: NotificationData): string {
|
||||
const { serverId, agentId } = resolveNotificationTarget(data);
|
||||
const { serverId, agentId, workspaceId } = resolveNotificationTarget(data);
|
||||
if (serverId && agentId) {
|
||||
if (workspaceId) {
|
||||
return buildHostWorkspaceAgentTabRoute(serverId, workspaceId, agentId);
|
||||
}
|
||||
return buildHostAgentDetailRoute(serverId, agentId);
|
||||
}
|
||||
if (serverId) {
|
||||
|
||||
Reference in New Issue
Block a user