Merge branch 'main' into read-electron-migration-skills
# Conflicts: # packages/app/src/app/_layout.tsx # packages/app/src/components/left-sidebar.tsx
This commit is contained in:
@@ -1734,17 +1734,13 @@ export function useHostRuntimeSnapshot(
|
||||
);
|
||||
}
|
||||
|
||||
export function useHostRuntimeSession(serverId: string): {
|
||||
snapshot: HostRuntimeSnapshot | null;
|
||||
client: DaemonClient | null;
|
||||
isConnected: boolean;
|
||||
} {
|
||||
const snapshot = useHostRuntimeSnapshot(serverId);
|
||||
return {
|
||||
snapshot,
|
||||
client: snapshot?.client ?? null,
|
||||
isConnected: isHostRuntimeConnected(snapshot),
|
||||
};
|
||||
export function useHostRuntimeClient(serverId: string): DaemonClient | null {
|
||||
const store = getHostRuntimeStore();
|
||||
return useSyncExternalStore(
|
||||
(onStoreChange) => store.subscribe(serverId, onStoreChange),
|
||||
() => store.getSnapshot(serverId)?.client ?? null,
|
||||
() => store.getSnapshot(serverId)?.client ?? null
|
||||
);
|
||||
}
|
||||
|
||||
export function useHostRuntimeIsConnected(serverId: string): boolean {
|
||||
@@ -1756,6 +1752,46 @@ export function useHostRuntimeIsConnected(serverId: string): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
export function useHostRuntimeConnectionStatus(
|
||||
serverId: string
|
||||
): HostRuntimeConnectionStatus {
|
||||
const store = getHostRuntimeStore();
|
||||
return useSyncExternalStore(
|
||||
(onStoreChange) => store.subscribe(serverId, onStoreChange),
|
||||
() => store.getSnapshot(serverId)?.connectionStatus ?? "connecting",
|
||||
() => store.getSnapshot(serverId)?.connectionStatus ?? "connecting"
|
||||
);
|
||||
}
|
||||
|
||||
export function useHostRuntimeLastError(serverId: string): string | null {
|
||||
const store = getHostRuntimeStore();
|
||||
return useSyncExternalStore(
|
||||
(onStoreChange) => store.subscribe(serverId, onStoreChange),
|
||||
() => store.getSnapshot(serverId)?.lastError ?? null,
|
||||
() => store.getSnapshot(serverId)?.lastError ?? null
|
||||
);
|
||||
}
|
||||
|
||||
export function useHostRuntimeAgentDirectoryStatus(
|
||||
serverId: string
|
||||
): HostRuntimeAgentDirectoryStatus {
|
||||
const store = getHostRuntimeStore();
|
||||
return useSyncExternalStore(
|
||||
(onStoreChange) => store.subscribe(serverId, onStoreChange),
|
||||
() => store.getSnapshot(serverId)?.agentDirectoryStatus ?? "idle",
|
||||
() => store.getSnapshot(serverId)?.agentDirectoryStatus ?? "idle"
|
||||
);
|
||||
}
|
||||
|
||||
export function useHostRuntimeIsDirectoryLoading(serverId: string): boolean {
|
||||
const store = getHostRuntimeStore();
|
||||
return useSyncExternalStore(
|
||||
(onStoreChange) => store.subscribe(serverId, onStoreChange),
|
||||
() => isHostRuntimeDirectoryLoading(store.getSnapshot(serverId)),
|
||||
() => isHostRuntimeDirectoryLoading(store.getSnapshot(serverId))
|
||||
);
|
||||
}
|
||||
|
||||
export function useHosts(): HostProfile[] {
|
||||
const store = getHostRuntimeStore();
|
||||
return useSyncExternalStore(
|
||||
|
||||
Reference in New Issue
Block a user