Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions desktop/src/features/agents/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,17 @@ function invalidateManagedAgentQueriesInBackground(
);
}

export function useAcpRuntimesQuery() {
export function useAcpRuntimesQuery(options?: { enabled?: boolean }) {
return useQuery({
enabled: options?.enabled ?? true,
queryKey: acpRuntimesQueryKey,
queryFn: discoverAcpRuntimes,
staleTime: 60_000,
});
}

export function useAvailableAcpRuntimes() {
const query = useAcpRuntimesQuery();
export function useAvailableAcpRuntimes(options?: { enabled?: boolean }) {
const query = useAcpRuntimesQuery(options);
const available = React.useMemo(
() =>
(query.data ?? []).filter(
Expand All @@ -155,8 +156,9 @@ export function useInstallAcpRuntimeMutation() {
});
}

export function useBackendProvidersQuery() {
export function useBackendProvidersQuery(options?: { enabled?: boolean }) {
return useQuery({
enabled: options?.enabled ?? true,
queryKey: backendProvidersQueryKey,
queryFn: discoverBackendProviders,
staleTime: 30_000,
Expand All @@ -175,11 +177,13 @@ export function usePersonasQuery() {
export function useManagedAgentPrereqsQuery(
acpCommand: string,
mcpCommand: string,
options?: { enabled?: boolean },
) {
const normalizedAcpCommand = acpCommand.trim();
const normalizedMcpCommand = mcpCommand.trim();

return useQuery({
enabled: options?.enabled ?? true,
queryKey: [
...managedAgentPrereqsQueryKey,
normalizedAcpCommand,
Expand Down
Loading
Loading