chore: land multi-daemon rollout

This commit is contained in:
Mohamed Boudra
2025-11-26 08:47:49 +00:00
parent 4ab79b1a50
commit 59967aad87
18 changed files with 758 additions and 259 deletions
+14 -1
View File
@@ -28,15 +28,24 @@ export function getSessionForServer(
type UseDaemonSessionOptions = {
suppressUnavailableAlert?: boolean;
allowUnavailable?: boolean;
};
export function useDaemonSession(
serverId?: string,
options?: UseDaemonSessionOptions & { allowUnavailable?: false }
): SessionContextValue;
export function useDaemonSession(
serverId: string | undefined,
options: UseDaemonSessionOptions & { allowUnavailable: true }
): SessionContextValue | null;
export function useDaemonSession(serverId?: string, options?: UseDaemonSessionOptions) {
const activeSession = useSession();
const sessionDirectory = useSessionDirectory();
const { connectionStates } = useDaemonConnections();
const alertedDaemonsRef = useRef<Set<string>>(new Set());
const loggedDaemonsRef = useRef<Set<string>>(new Set());
const { suppressUnavailableAlert = false } = options ?? {};
const { suppressUnavailableAlert = false, allowUnavailable = false } = options ?? {};
const targetServerId = serverId ?? activeSession.serverId;
const isActiveSession = targetServerId === activeSession.serverId;
@@ -64,6 +73,10 @@ export function useDaemonSession(serverId?: string, options?: UseDaemonSessionOp
loggedDaemonsRef.current.add(targetServerId);
console.warn(`[useDaemonSession] Session unavailable for daemon "${label}" (${status}).`);
}
if (allowUnavailable) {
return null;
}
}
throw error;
}