feat: add workspace-aware notification routing and clean up agent screen header

This commit is contained in:
Mohamed Boudra
2026-03-04 10:37:43 +07:00
parent 3c066f5dd9
commit 6de7756952
8 changed files with 73 additions and 417 deletions
@@ -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) {