File size: 950 Bytes
7c5ed63 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | import { useQuery } from '@tanstack/react-query';
import { api } from '../api';
/** Background tasks for a session (process / agent / question), with
* `output.log` size metadata per task. */
export function useTasks(sessionId: string | undefined) {
return useQuery({
queryKey: ['tasks', sessionId] as const,
queryFn: () => api.getTasks(sessionId!),
enabled: !!sessionId,
});
}
/** Cron jobs scheduled within a session. */
export function useCron(sessionId: string | undefined) {
return useQuery({
queryKey: ['cron', sessionId] as const,
queryFn: () => api.getCron(sessionId!),
enabled: !!sessionId,
});
}
/** Parsed diagnostic log for a session (session or global). */
export function useLogs(sessionId: string | undefined, which: 'session' | 'global') {
return useQuery({
queryKey: ['logs', sessionId, which] as const,
queryFn: () => api.getLogs(sessionId!, which),
enabled: !!sessionId,
});
}
|