mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-04 22:02:16 +02:00
feat: updated agent harness
This commit is contained in:
parent
9ec9b64348
commit
31a372bb84
139 changed files with 12583 additions and 1111 deletions
19
surfsense_web/atoms/agent/action-log-sheet.atom.ts
Normal file
19
surfsense_web/atoms/agent/action-log-sheet.atom.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { atom } from "jotai";
|
||||
|
||||
interface ActionLogSheetState {
|
||||
open: boolean;
|
||||
threadId: number | null;
|
||||
}
|
||||
|
||||
export const actionLogSheetAtom = atom<ActionLogSheetState>({
|
||||
open: false,
|
||||
threadId: null,
|
||||
});
|
||||
|
||||
export const openActionLogSheetAtom = atom(null, (_get, set, threadId: number) => {
|
||||
set(actionLogSheetAtom, { open: true, threadId });
|
||||
});
|
||||
|
||||
export const closeActionLogSheetAtom = atom(null, (_get, set) => {
|
||||
set(actionLogSheetAtom, { open: false, threadId: null });
|
||||
});
|
||||
17
surfsense_web/atoms/agent/agent-flags-query.atom.ts
Normal file
17
surfsense_web/atoms/agent/agent-flags-query.atom.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { atomWithQuery } from "jotai-tanstack-query";
|
||||
import { agentFlagsApiService } from "@/lib/apis/agent-flags-api.service";
|
||||
import { getBearerToken } from "@/lib/auth-utils";
|
||||
|
||||
export const AGENT_FLAGS_QUERY_KEY = ["agent", "flags"] as const;
|
||||
|
||||
/**
|
||||
* Reads the backend agent feature flags. Cached for the lifetime of the
|
||||
* page (flags only change on backend restart) so we can drive UI gating
|
||||
* without re-hitting the API.
|
||||
*/
|
||||
export const agentFlagsAtom = atomWithQuery(() => ({
|
||||
queryKey: AGENT_FLAGS_QUERY_KEY,
|
||||
staleTime: 10 * 60 * 1000,
|
||||
enabled: !!getBearerToken(),
|
||||
queryFn: () => agentFlagsApiService.get(),
|
||||
}));
|
||||
Loading…
Add table
Add a link
Reference in a new issue