@mastra/react 1.14.1-alpha.0 → 1.14.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/agents/index.cjs +23 -12
- package/dist/hooks/agents/index.cjs.map +1 -1
- package/dist/hooks/agents/index.js +23 -12
- package/dist/hooks/agents/index.js.map +1 -1
- package/dist/hooks/agents/use-agent-skills.d.ts +7 -0
- package/dist/hooks/agents/use-agent-skills.d.ts.map +1 -1
- package/dist/hooks/agents/use-agent-workspace.d.ts +7 -0
- package/dist/hooks/agents/use-agent-workspace.d.ts.map +1 -1
- package/dist/hooks/agents/use-agent.d.ts +3 -2
- package/dist/hooks/agents/use-agent.d.ts.map +1 -1
- package/dist/hooks/agents/use-agents.d.ts.map +1 -1
- package/dist/hooks/agents/use-stored-agents.d.ts +28 -0
- package/dist/hooks/agents/use-stored-agents.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -697,15 +697,16 @@ function useAgentWorkspace({ agentId, requestContext, queryOptions } = {}) {
|
|
|
697
697
|
/**
|
|
698
698
|
* Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.
|
|
699
699
|
*/
|
|
700
|
-
const useAgent = ({ agentId, requestContext, queryOptions } = {}) => {
|
|
700
|
+
const useAgent = ({ agentId, version, requestContext, queryOptions } = {}) => {
|
|
701
701
|
const client = require_mastra_client_context.useMastraClient();
|
|
702
702
|
return (0, _tanstack_react_query.useQuery)({
|
|
703
703
|
queryKey: [
|
|
704
704
|
"agent",
|
|
705
705
|
agentId,
|
|
706
|
+
version,
|
|
706
707
|
requestContext
|
|
707
708
|
],
|
|
708
|
-
queryFn: () => agentId ? client.getAgent(agentId).details(requestContext) : null,
|
|
709
|
+
queryFn: () => agentId ? client.getAgent(agentId, version).details(requestContext) : null,
|
|
709
710
|
retry: false,
|
|
710
711
|
...queryOptions
|
|
711
712
|
});
|
|
@@ -746,29 +747,39 @@ const useUpdateAgentModel = ({ agentId, queryOptions }) => {
|
|
|
746
747
|
const useReorderModelList = ({ agentId, queryOptions }) => {
|
|
747
748
|
const client = require_mastra_client_context.useMastraClient();
|
|
748
749
|
const queryClient = (0, _tanstack_react_query.useQueryClient)();
|
|
750
|
+
const { onSuccess, onError, ...mutationOptions } = queryOptions ?? {};
|
|
749
751
|
return (0, _tanstack_react_query.useMutation)({
|
|
750
752
|
mutationFn: async (payload) => client.getAgent(agentId).reorderModelList(payload),
|
|
751
|
-
|
|
753
|
+
...mutationOptions,
|
|
754
|
+
onSuccess: (...args) => {
|
|
752
755
|
queryClient.invalidateQueries({ queryKey: ["agent", agentId] });
|
|
756
|
+
queryClient.invalidateQueries({ queryKey: ["agent-versions", agentId] });
|
|
757
|
+
queryClient.invalidateQueries({ queryKey: ["stored-agent", agentId] });
|
|
758
|
+
return onSuccess?.(...args);
|
|
753
759
|
},
|
|
754
|
-
onError: (
|
|
755
|
-
console.error("Error reordering model list",
|
|
756
|
-
|
|
757
|
-
|
|
760
|
+
onError: (...args) => {
|
|
761
|
+
console.error("Error reordering model list", args[0]);
|
|
762
|
+
return onError?.(...args);
|
|
763
|
+
}
|
|
758
764
|
});
|
|
759
765
|
};
|
|
760
766
|
const useUpdateModelInModelList = ({ agentId, queryOptions }) => {
|
|
761
767
|
const client = require_mastra_client_context.useMastraClient();
|
|
762
768
|
const queryClient = (0, _tanstack_react_query.useQueryClient)();
|
|
769
|
+
const { onSuccess, onError, ...mutationOptions } = queryOptions ?? {};
|
|
763
770
|
return (0, _tanstack_react_query.useMutation)({
|
|
764
771
|
mutationFn: async (payload) => client.getAgent(agentId).updateModelInModelList(payload),
|
|
765
|
-
|
|
772
|
+
...mutationOptions,
|
|
773
|
+
onSuccess: (...args) => {
|
|
766
774
|
queryClient.invalidateQueries({ queryKey: ["agent", agentId] });
|
|
775
|
+
queryClient.invalidateQueries({ queryKey: ["agent-versions", agentId] });
|
|
776
|
+
queryClient.invalidateQueries({ queryKey: ["stored-agent", agentId] });
|
|
777
|
+
return onSuccess?.(...args);
|
|
767
778
|
},
|
|
768
|
-
onError: (
|
|
769
|
-
console.error("Error updating model in model list",
|
|
770
|
-
|
|
771
|
-
|
|
779
|
+
onError: (...args) => {
|
|
780
|
+
console.error("Error updating model in model list", args[0]);
|
|
781
|
+
return onError?.(...args);
|
|
782
|
+
}
|
|
772
783
|
});
|
|
773
784
|
};
|
|
774
785
|
const useResetAgentModel = ({ agentId, queryOptions }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["useMastraClient","useInfiniteQuery","skipToken","useMastraClient","useQuery","useMastraClient","useState","useRef","useMemo","useCallback","useQuery","useMastraClient","useQuery","useMastraClient","useQuery","useQueryClient","useMutation","useMastraClient","useQueryClient","useMemo","useMutation","useMastraClient","useQuery","skipToken","useQueryClient","useMutation","useMastraClient","useState","useRef","useCallback","useMastraClient","useQueryClient","useMemo","useMutation","useMastraClient","useQuery","useMastraClient","useQuery","useMastraClient","useQuery","useQueryClient","useMutation","useMastraClient","useMutation","useMastraClient","useQuery","useMastraClient","useQuery","useMastraClient","useQuery","useQueryClient","useMutation","useMastraClient","useMutation","RequestContext"],"sources":["../../../src/hooks/agents/use-agent-messages.ts","../../../src/hooks/agents/use-agent-plan.ts","../../../src/hooks/agents/use-background-tasks.ts","../../../src/hooks/agents/use-browser-session-probe.ts","../../../src/hooks/agents/is-model-not-allowed.ts","../../../src/hooks/agents/use-stored-agents.ts","../../../src/hooks/agents/use-agent-skills.ts","../../../src/hooks/agents/use-agent-versions.ts","../../../src/hooks/agents/use-agent-working-memory.ts","../../../src/hooks/agents/use-agent-workspace.ts","../../../src/hooks/agents/use-agent.ts","../../../src/hooks/agents/use-agents-model-providers.ts","../../../src/hooks/agents/use-agents.ts","../../../src/hooks/agents/use-close-browser.ts","../../../src/hooks/agents/use-preview-instructions.ts","../../../src/hooks/agents/use-stored-skills.ts","../../../src/hooks/agents/use-channels.ts","../../../src/hooks/agents/use-execute-agent-tool.ts"],"sourcesContent":["import type { MastraClient } from '@mastra/client-js';\nimport type { MastraDBMessage } from '@mastra/core/agent/message-list';\nimport { skipToken, useInfiniteQuery } from '@tanstack/react-query';\nimport type { InfiniteData, QueryKey } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraInfiniteQueryOptions } from '../shared/query-options';\n\ntype AgentMessagesPage = Awaited<ReturnType<MastraClient['listThreadMessages']>>;\n\ntype AgentMessagesData = InfiniteData<AgentMessagesPage, string> & { messages: MastraDBMessage[] };\n\nexport interface UseAgentMessagesProps<TData = AgentMessagesData> {\n threadId?: string;\n agentId: string;\n memory: boolean;\n requestContext?: Record<string, any>;\n queryOptions?: MastraInfiniteQueryOptions<AgentMessagesPage, TData, QueryKey, string>;\n}\n\nconst PER_PAGE = 40;\n\nconst NEWEST_PAGE = '';\n\nconst createdAtMs = (message: MastraDBMessage) => new Date(message.createdAt).getTime();\n\nconst byCreatedAt = (a: MastraDBMessage, b: MastraDBMessage) => createdAtMs(a) - createdAtMs(b);\n\nexport const useAgentMessages = <TData = AgentMessagesData>({\n threadId,\n agentId,\n memory,\n requestContext,\n queryOptions,\n}: UseAgentMessagesProps<TData>) => {\n const client = useMastraClient();\n\n return useInfiniteQuery({\n queryKey: ['memory', 'messages', threadId, agentId, requestContext],\n initialPageParam: NEWEST_PAGE,\n queryFn:\n memory && threadId\n ? ({ pageParam: olderThan }) =>\n client.listThreadMessages(threadId, {\n agentId,\n requestContext,\n includeSystemReminders: true,\n perPage: PER_PAGE,\n orderBy: { field: 'createdAt', direction: 'DESC' },\n // Inclusive bound: messages sharing the oldest createdAt of the previous page\n // may have been cut off by perPage, so re-ask for them and dedupe by id below.\n filter: olderThan ? { dateRange: { end: new Date(olderThan) } } : undefined,\n })\n : skipToken,\n getNextPageParam: (lastPage, _allPages, lastPageParam) => {\n if (!lastPage.hasMore || lastPage.messages.length === 0) return undefined;\n const next = new Date(Math.min(...lastPage.messages.map(createdAtMs))).toISOString();\n // A full page of same-timestamp messages would re-request itself forever.\n return next === lastPageParam ? undefined : next;\n },\n select: (data): TData => {\n const seen = new Set<string>();\n const messages = data.pages\n .flatMap(page => page.messages)\n .filter(message => {\n if (seen.has(message.id)) return false;\n seen.add(message.id);\n return true;\n })\n .sort(byCreatedAt);\n return { ...data, messages } as AgentMessagesData as TData;\n },\n staleTime: 0,\n gcTime: 0,\n retry: false,\n refetchOnWindowFocus: false,\n ...queryOptions,\n });\n};\n","import type { MastraClient } from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\ntype AgentPlanResponse = Awaited<ReturnType<ReturnType<MastraClient['getAgent']>['readPlan']>>;\n\ninterface UseAgentPlanOptions<TData> {\n agentId: string;\n path: string;\n agentVersionId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<AgentPlanResponse, TData>;\n}\n\nexport function useAgentPlan<TData = AgentPlanResponse>({\n agentId,\n path,\n agentVersionId,\n requestContext,\n queryOptions,\n}: UseAgentPlanOptions<TData>): UseQueryResult<TData, Error> {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['agent-plan', agentId, agentVersionId, path, requestContext],\n queryFn: () => {\n const agent = agentVersionId ? client.getAgent(agentId, { versionId: agentVersionId }) : client.getAgent(agentId);\n return agent.readPlan(path, requestContext);\n },\n retry: false,\n ...queryOptions,\n });\n}\n","import type { MastraClient, StreamBackgroundTasksParams } from '@mastra/client-js';\nimport type { BackgroundTaskStatus } from '@mastra/core/background-tasks';\nimport type { AgentChunkType } from '@mastra/core/stream';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\ntype BackgroundTaskStreamReader = ReturnType<Awaited<ReturnType<MastraClient['streamBackgroundTasks']>>['getReader']>;\n\nexport interface BackgroundTaskEvent {\n taskId: string;\n toolName: string;\n toolCallId: string;\n agentId: string;\n runId: string;\n result?: unknown;\n error?: { message: string; stack?: string };\n status: BackgroundTaskStatus;\n args: Record<string, unknown>;\n suspendPayload?: unknown;\n}\n\nexport interface UseBackgroundTaskStreamOptions extends StreamBackgroundTasksParams {\n /** Whether the stream is active. Default: true */\n enabled?: boolean;\n}\n\nexport interface UseBackgroundTaskStreamReturn {\n /** Map of taskId → latest event data */\n tasks: Record<string, BackgroundTaskEvent>;\n /** Whether the stream is currently connected */\n isConnected: boolean;\n /** Any connection error */\n error: Error | null;\n /** Manually disconnect the stream */\n disconnect: () => void;\n /** Manually reconnect the stream */\n reconnect: () => void;\n /** List of running tasks */\n runningTasks: BackgroundTaskEvent[];\n /** List of completed tasks */\n completedTasks: BackgroundTaskEvent[];\n /** List of failed tasks */\n failedTasks: BackgroundTaskEvent[];\n /** Clear completed and failed tasks */\n clearCompletedAndFailedTasks: () => void;\n}\n\n/**\n * Streams background task events via SSE and accumulates them in a map keyed by taskId.\n *\n * Each incoming event (task.completed / task.failed) is stored in state so the UI\n * can react to completions — e.g., show a toast, update a badge, or display results.\n *\n * @example\n * ```tsx\n * const { tasks, isConnected, completedTasks } = useBackgroundTaskStream({ agentId: 'crypto-agent' });\n *\n * // Show a badge with completed count\n * const completedCount = completedTasks.length;\n * ```\n */\n\ntype EventType = Extract<\n AgentChunkType,\n {\n type:\n | 'background-task-running'\n | 'background-task-completed'\n | 'background-task-failed'\n | 'background-task-cancelled'\n | 'background-task-output'\n | 'background-task-suspended'\n | 'background-task-resumed';\n }\n>;\n\nconst EVENT_STATUS_MAP: Record<EventType['type'], BackgroundTaskStatus> = {\n 'background-task-running': 'running',\n 'background-task-output': 'running',\n 'background-task-completed': 'completed',\n 'background-task-failed': 'failed',\n 'background-task-cancelled': 'cancelled',\n 'background-task-suspended': 'suspended',\n 'background-task-resumed': 'running',\n};\n\nexport function useBackgroundTaskStream(options: UseBackgroundTaskStreamOptions = {}): UseBackgroundTaskStreamReturn {\n const { enabled = true, agentId, runId, threadId, resourceId, taskId } = options;\n const client = useMastraClient();\n\n const [tasks, setTasks] = useState<Record<string, BackgroundTaskEvent>>({});\n const [isConnected, setIsConnected] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n const abortRef = useRef<AbortController | null>(null);\n const readerRef = useRef<BackgroundTaskStreamReader | null>(null);\n const connectSeqRef = useRef(0);\n\n const runningTasks = useMemo(() => {\n return Object.values(tasks).filter(task => task.status === 'running');\n }, [tasks]);\n\n const completedTasks = useMemo(() => {\n return Object.values(tasks).filter(task => task.status === 'completed');\n }, [tasks]);\n\n const failedTasks = useMemo(() => {\n return Object.values(tasks).filter(task => task.status === 'failed');\n }, [tasks]);\n\n const cleanup = useCallback(() => {\n readerRef.current?.cancel().catch(() => {});\n readerRef.current = null;\n abortRef.current?.abort();\n abortRef.current = null;\n setIsConnected(false);\n }, []);\n\n const connect = useCallback(async () => {\n const seq = ++connectSeqRef.current;\n cleanup();\n setError(null);\n\n const controller = new AbortController();\n abortRef.current = controller;\n\n try {\n const stream = await client.streamBackgroundTasks({ agentId, runId, threadId, resourceId, taskId });\n\n if (!stream) {\n setError(new Error('Stream connection failed'));\n return;\n }\n\n if (seq === connectSeqRef.current) {\n setIsConnected(true);\n }\n\n // Get a reader from the ReadableStream and store it in ref\n const reader = stream.getReader();\n readerRef.current = reader;\n\n while (!controller.signal.aborted) {\n const { done, value } = await reader.read();\n if (done) break;\n\n const event = value as EventType;\n if (event.type !== 'background-task-output') {\n setTasks(prev => ({\n ...prev,\n [event.payload.taskId]: {\n ...prev[event.payload.taskId],\n ...event.payload,\n status: EVENT_STATUS_MAP[event.type],\n args:\n ('args' in event.payload ? event.payload.args : undefined) ?? prev[event.payload.taskId]?.args ?? {},\n },\n }));\n }\n }\n } catch (err: any) {\n if (err?.name !== 'AbortError') {\n if (seq === connectSeqRef.current) {\n setError(err instanceof Error ? err : new Error(String(err)));\n }\n }\n } finally {\n if (seq === connectSeqRef.current) {\n setIsConnected(false);\n }\n }\n }, [client, agentId, runId, threadId, resourceId, taskId, cleanup]);\n\n useEffect(() => {\n if (!enabled) {\n cleanup();\n return;\n }\n\n void connect();\n return cleanup;\n }, [enabled, connect, cleanup]);\n\n const disconnect = useCallback(() => {\n cleanup();\n }, [cleanup]);\n\n const reconnect = useCallback(() => {\n void connect();\n }, [connect]);\n\n const clearCompletedAndFailedTasks = () => {\n setTasks(prev => {\n const newTasks = { ...prev };\n Object.values(newTasks).forEach(task => {\n if (\n task.status === 'completed' ||\n task.status === 'failed' ||\n task.status === 'cancelled' ||\n task.status === 'timed_out'\n ) {\n delete newTasks[task.taskId];\n }\n });\n return newTasks;\n });\n };\n\n return {\n tasks,\n isConnected,\n error,\n disconnect,\n reconnect,\n runningTasks,\n completedTasks,\n failedTasks,\n clearCompletedAndFailedTasks,\n };\n}\n\ntype BackgroundTaskResponse = Awaited<ReturnType<MastraClient['getBackgroundTask']>>;\n\nexport const useGetBackgroundTaskById = <TData = BackgroundTaskResponse>({\n backgroundTaskId,\n queryOptions,\n}: {\n backgroundTaskId: string;\n queryOptions?: MastraQueryOptions<BackgroundTaskResponse, TData>;\n}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n return useQuery({\n queryKey: ['background-task', backgroundTaskId],\n queryFn: () => client.getBackgroundTask(backgroundTaskId),\n ...queryOptions,\n });\n};\n","import type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\nexport interface BrowserSessionProbe {\n hasSession: boolean;\n screencastAvailable: boolean;\n}\n\ninterface UseBrowserSessionProbeOptions<TData> {\n agentId?: string;\n threadId?: string;\n /** TanStack overrides spread last, e.g. `{ enabled: false }` for agents without browser tools. */\n queryOptions?: MastraQueryOptions<BrowserSessionProbe, TData>;\n}\n\nexport const browserSessionProbeQueryKey = (agentId?: string, threadId?: string) =>\n ['browser-session-probe', agentId, threadId] as const;\n\nconst LEGACY_FALLBACK: BrowserSessionProbe = { hasSession: true, screencastAvailable: true };\n\nconst isNotFoundError = (error: unknown): boolean => {\n if (!error || typeof error !== 'object') return false;\n if ('status' in error && (error as { status: unknown }).status === 404) return true;\n if ('statusCode' in error && (error as { statusCode: unknown }).statusCode === 404) return true;\n return false;\n};\n\n/**\n * Query hook that probes the server for the agent's browser session state.\n *\n * Used by {@link BrowserSessionProvider} to decide whether to open a screencast\n * WebSocket. The probe avoids two failure modes:\n *\n * 1. `screencastAvailable: false` — the server doesn't have `ws` / `@hono/node-ws`\n * installed (or the route was never registered). Opening a WS would fail and\n * trigger a reconnect loop.\n * 2. `hasSession: false` — no active browser session for this thread yet. Opening\n * a WS would succeed but sit idle, holding resources for no reason.\n *\n * When the endpoint itself returns 404 (older server that predates this probe),\n * the hook assumes screencast is available and a session is active so behavior\n * matches the legacy unconditional connect.\n *\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport function useBrowserSessionProbe<TData = BrowserSessionProbe>({\n agentId,\n threadId,\n queryOptions,\n}: UseBrowserSessionProbeOptions<TData>): UseQueryResult<TData, Error> {\n const client = useMastraClient();\n\n return useQuery<BrowserSessionProbe, Error, TData>({\n queryKey: browserSessionProbeQueryKey(agentId, threadId),\n queryFn: async () => {\n if (!agentId) {\n return { hasSession: false, screencastAvailable: false };\n }\n\n try {\n return await client.getAgent(agentId).browserSession(threadId);\n } catch (error) {\n if (isNotFoundError(error)) {\n // Older server without the probe endpoint — fall back to legacy behavior.\n return LEGACY_FALLBACK;\n }\n throw error;\n }\n },\n // No polling: the probe fires once on mount, on window focus, and is\n // updated via `setQueriesData` from `tool-fallback.tsx` when a browser\n // tool call transitions. This avoids idle 5s polls and lets the probe\n // flip to `hasSession: true` the instant a tool call is seen.\n refetchOnWindowFocus: true,\n staleTime: 0,\n retry: 1,\n ...queryOptions,\n });\n}\n","/**\n * The wire-level error code the server emits on a 422 when a model is blocked\n * by the admin's builder policy. Kept as a local literal so the browser bundle\n * never imports server-only agent-builder EE code.\n */\nconst MODEL_NOT_ALLOWED_CODE = 'MODEL_NOT_ALLOWED';\n\nexport interface ModelNotAllowedDetails {\n message: string;\n attempted?: { provider?: string; modelId?: string };\n offendingLabel?: string;\n}\n\n/**\n * Detects HTTP 422 + MODEL_NOT_ALLOWED responses thrown by `MastraClientError`\n * (or any error carrying `status` + `body.error.code`). Returns the parsed\n * details when matched, or `null` otherwise.\n */\nexport function isModelNotAllowedError(err: unknown): ModelNotAllowedDetails | null {\n if (!err || typeof err !== 'object') return null;\n const candidate = err as { status?: number; body?: unknown; message?: string };\n if (candidate.status !== 422) return null;\n const body = candidate.body as { error?: { code?: unknown } } | undefined;\n const code = body?.error?.code;\n if (code !== MODEL_NOT_ALLOWED_CODE) return null;\n const errorBody = body!.error as {\n message?: string;\n attempted?: { provider?: string; modelId?: string };\n offendingLabel?: string;\n };\n return {\n message: errorBody.message || candidate.message || 'Model not allowed by admin policy',\n attempted: errorBody.attempted,\n offendingLabel: errorBody.offendingLabel,\n };\n}\n","import type {\n CreateStoredAgentParams,\n UpdateStoredAgentParams,\n ListStoredAgentsParams,\n StoredAgentResponse,\n ListStoredAgentsResponse,\n StoredAgentDependentsResponse,\n DeleteStoredAgentResponse,\n} from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions, MastraQueryOptions } from '../shared/query-options';\nimport { isModelNotAllowedError } from './is-model-not-allowed';\n\nexport const useStoredAgents = <TData = ListStoredAgentsResponse>({\n queryOptions,\n ...params\n}: ListStoredAgentsParams & {\n queryOptions?: MastraQueryOptions<ListStoredAgentsResponse, TData>;\n} = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n const listParams = Object.keys(params).length > 0 ? params : undefined;\n\n return useQuery({\n queryKey: ['stored-agents', listParams],\n queryFn: () => client.listStoredAgents(listParams),\n ...queryOptions,\n });\n};\n\n/**\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useStoredAgent = <TData = StoredAgentResponse | null>({\n agentId,\n status,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n status?: 'draft' | 'published';\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<StoredAgentResponse | null, TData>;\n} = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['stored-agent', agentId, status, requestContext],\n queryFn: async () => {\n if (!agentId) return null;\n try {\n return await client.getStoredAgent(agentId).details(requestContext, { status });\n } catch (error) {\n // 404 is expected for code-only agents that haven't been stored yet\n if (error && typeof error === 'object' && 'status' in error && (error as { status: number }).status === 404) {\n return null;\n }\n throw error;\n }\n },\n retry: false,\n ...queryOptions,\n });\n};\n\nexport type StoredAgent = StoredAgentResponse;\n\n/**\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useStoredAgentDependents = <TData = StoredAgentDependentsResponse>({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<StoredAgentDependentsResponse, TData>;\n} = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['stored-agent-dependents', agentId, requestContext],\n queryFn: () => client.getStoredAgent(agentId!).dependents(requestContext),\n retry: false,\n ...queryOptions,\n });\n};\n\nexport const useStoredAgentMutations = ({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: {\n createStoredAgent?: MastraMutationOptions<StoredAgentResponse, CreateStoredAgentParams>;\n updateStoredAgent?: MastraMutationOptions<StoredAgentResponse, UpdateStoredAgentParams>;\n deleteStoredAgent?: MastraMutationOptions<DeleteStoredAgentResponse, void>;\n };\n} = {}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n // If the server rejects with HTTP 422 + MODEL_NOT_ALLOWED the admin policy\n // has likely changed under us — refresh the cached settings so the UI\n // re-renders against the latest server truth.\n const invalidateBuilderSettingsOnPolicyReject = (err: unknown) => {\n if (isModelNotAllowedError(err)) {\n void queryClient.invalidateQueries({ queryKey: ['builder-settings'] });\n }\n };\n\n const createMutation = useMutation({\n mutationFn: (params: CreateStoredAgentParams) => client.createStoredAgent(params),\n onSuccess: created => {\n // Prime the per-agent details cache with the response so the next page\n // (the edit page) can render the agent on first paint without a refetch.\n // The starter relies on this to immediately mount the conversation panel\n // and dispatch the user's initial message.\n queryClient.setQueryData(['stored-agent', created.id, 'draft', requestContext], created);\n queryClient.setQueryData(['stored-agent', created.id, undefined, requestContext], created);\n // Invalidate both stored-agents list and the merged agents list\n void queryClient.invalidateQueries({ queryKey: ['stored-agents'] });\n void queryClient.invalidateQueries({ queryKey: ['agents'] });\n // Invalidate the merged agent details so the freshly-created id resolves\n // instead of staying stuck on the initial `null` from the 404 lookup.\n void queryClient.invalidateQueries({ queryKey: ['agent', created.id] });\n },\n onError: invalidateBuilderSettingsOnPolicyReject,\n ...queryOptions?.createStoredAgent,\n });\n\n const updateMutation = useMutation({\n mutationFn: (params: UpdateStoredAgentParams) => {\n if (!agentId) throw new Error('agentId is required for update');\n return client.getStoredAgent(agentId).update(params, requestContext);\n },\n onSuccess: () => {\n // Invalidate lists\n void queryClient.invalidateQueries({ queryKey: ['stored-agents'] });\n void queryClient.invalidateQueries({ queryKey: ['agents'] });\n // Invalidate specific agent details\n if (agentId) {\n void queryClient.invalidateQueries({ queryKey: ['stored-agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n }\n },\n onError: invalidateBuilderSettingsOnPolicyReject,\n ...queryOptions?.updateStoredAgent,\n });\n\n const deleteMutation = useMutation({\n mutationFn: () => {\n if (!agentId) throw new Error('agentId is required for delete');\n return client.getStoredAgent(agentId).delete(requestContext);\n },\n onSuccess: () => {\n // Invalidate lists so the agents list page refetches without the deleted entry\n void queryClient.invalidateQueries({ queryKey: ['stored-agents'] });\n void queryClient.invalidateQueries({ queryKey: ['agents'] });\n // Drop the deleted entity from the cache so active observers don't refetch a 404\n if (agentId) {\n queryClient.removeQueries({ queryKey: ['stored-agent', agentId] });\n queryClient.removeQueries({ queryKey: ['agent', agentId] });\n }\n },\n ...queryOptions?.deleteStoredAgent,\n });\n\n return {\n createStoredAgent: createMutation,\n updateStoredAgent: updateMutation,\n deleteStoredAgent: deleteMutation,\n };\n};\n","import type { StoredAgentResponse, StoredAgentSkillConfig, UpdateStoredAgentParams } from '@mastra/client-js';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { useMemo } from 'react';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions } from '../shared/query-options';\nimport { useStoredAgent } from './use-stored-agents';\n\n/**\n * Hook to read and mutate the skills config for a stored agent.\n *\n * The skills field is `Record<string, StoredAgentSkillConfig>` on the agent\n * snapshot. Each key is a stored skill ID and the value holds per-skill\n * overrides (description, instructions, pin, strategy).\n */\nexport function useAgentSkills({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: {\n updateSkills?: MastraMutationOptions<StoredAgentResponse, Record<string, StoredAgentSkillConfig> | undefined>;\n };\n} = {}) {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n const { data: agent } = useStoredAgent({ agentId, status: 'draft', queryOptions: { enabled: Boolean(agentId) } });\n\n const skills = useMemo((): Record<string, StoredAgentSkillConfig> => {\n if (!agent?.skills) return {};\n // Handle conditional field: if it's an array of variants, merge values\n if (Array.isArray(agent.skills)) {\n const merged: Record<string, StoredAgentSkillConfig> = {};\n for (const variant of agent.skills) {\n Object.assign(merged, variant.value);\n }\n return merged;\n }\n return agent.skills as Record<string, StoredAgentSkillConfig>;\n }, [agent?.skills]);\n\n const updateSkills = useMutation({\n mutationFn: (newSkills: Record<string, StoredAgentSkillConfig> | undefined) => {\n if (!agentId) throw new Error('agentId is required');\n const params: UpdateStoredAgentParams = { skills: newSkills };\n return client.getStoredAgent(agentId).update(params, requestContext);\n },\n onSuccess: () => {\n if (agentId) {\n void queryClient.invalidateQueries({ queryKey: ['stored-agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n }\n },\n ...queryOptions?.updateSkills,\n });\n\n return { skills, updateSkills };\n}\n","import type {\n ListAgentVersionsParams,\n CreateAgentVersionParams,\n ListAgentVersionsResponse,\n AgentVersionResponse,\n CompareVersionsResponse,\n ActivateAgentVersionResponse,\n DeleteAgentVersionResponse,\n} from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery, useMutation, useQueryClient, skipToken } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions, MastraQueryOptions } from '../shared/query-options';\n\nexport type { ListAgentVersionsParams, CreateAgentVersionParams };\n\ntype UseAgentVersionsParams<TData = ListAgentVersionsResponse> = {\n agentId?: string;\n params?: ListAgentVersionsParams;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<ListAgentVersionsResponse, TData>;\n};\n\n/**\n * Hook to list versions of a stored agent\n *\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useAgentVersions = <TData = ListAgentVersionsResponse>({\n agentId,\n params,\n requestContext,\n queryOptions,\n}: UseAgentVersionsParams<TData>): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery<ListAgentVersionsResponse, Error, TData>({\n queryKey: ['agent-versions', agentId, params, requestContext],\n queryFn: agentId ? () => client.getStoredAgent(agentId).listVersions(params, requestContext) : skipToken,\n ...queryOptions,\n });\n};\n\n/**\n * Hook to get a single version of a stored agent\n *\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useAgentVersion = <TData = AgentVersionResponse>({\n agentId,\n versionId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n versionId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<AgentVersionResponse, TData>;\n}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery<AgentVersionResponse, Error, TData>({\n queryKey: ['agent-version', agentId, versionId, requestContext],\n queryFn: () => client.getStoredAgent(agentId).getVersion(versionId, requestContext),\n ...queryOptions,\n });\n};\n\n/**\n * Hook to create a new version of a stored agent\n */\nexport const useCreateAgentVersion = ({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraMutationOptions<AgentVersionResponse, CreateAgentVersionParams | undefined>;\n}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<AgentVersionResponse, Error, CreateAgentVersionParams | undefined>({\n mutationFn: (params?: CreateAgentVersionParams) =>\n client.getStoredAgent(agentId).createVersion(params, requestContext),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n ...queryOptions,\n });\n};\n\n/**\n * Hook to activate a specific version of a stored agent\n */\nexport const useActivateAgentVersion = ({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraMutationOptions<ActivateAgentVersionResponse, string>;\n}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<ActivateAgentVersionResponse, Error, string>({\n mutationFn: (versionId: string) => client.getStoredAgent(agentId).activateVersion(versionId, requestContext),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n ...queryOptions,\n });\n};\n\n/**\n * Hook to restore a specific version of a stored agent (creates a new version from an old one)\n */\nexport const useRestoreAgentVersion = ({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraMutationOptions<AgentVersionResponse, string>;\n}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<AgentVersionResponse, Error, string>({\n mutationFn: (versionId: string) => client.getStoredAgent(agentId).restoreVersion(versionId, requestContext),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n ...queryOptions,\n });\n};\n\n/**\n * Hook to delete a specific version of a stored agent\n */\nexport const useDeleteAgentVersion = ({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraMutationOptions<DeleteAgentVersionResponse, string>;\n}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<DeleteAgentVersionResponse, Error, string>({\n mutationFn: (versionId: string) => client.getStoredAgent(agentId).deleteVersion(versionId, requestContext),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n },\n ...queryOptions,\n });\n};\n\n/**\n * Hook to compare two versions of a stored agent\n *\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useCompareAgentVersions = <TData = CompareVersionsResponse>({\n agentId,\n fromVersionId,\n toVersionId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n fromVersionId: string;\n toVersionId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<CompareVersionsResponse, TData>;\n}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery<CompareVersionsResponse, Error, TData>({\n queryKey: ['agent-versions-compare', agentId, fromVersionId, toVersionId, requestContext],\n queryFn: () => client.getStoredAgent(agentId).compareVersions(fromVersionId, toVersionId, requestContext),\n ...queryOptions,\n });\n};\n","import { useState, useEffect, useCallback, useRef } from 'react';\nimport { useMastraClient } from '../../mastra-client-context';\n\nfunction parseJsonString(jsonString: string): any {\n try {\n return JSON.stringify(JSON.parse(jsonString), null, 2);\n } catch {\n return jsonString;\n }\n}\n\nexport function useAgentWorkingMemory(\n agentId: string,\n threadId: string,\n resourceId: string,\n requestContext?: Record<string, any>,\n) {\n const client = useMastraClient();\n const [threadExists, setThreadExists] = useState(false);\n const [workingMemoryData, setWorkingMemoryData] = useState<string | null>(null);\n const [workingMemorySource, setWorkingMemorySource] = useState<'thread' | 'resource'>('thread');\n const [workingMemoryFormat, setWorkingMemoryFormat] = useState<'json' | 'markdown'>('markdown');\n const [isLoading, setIsLoading] = useState(true);\n const [isUpdating, setIsUpdating] = useState(false);\n const latestRequest = useRef(0);\n\n const refetch = useCallback(async () => {\n const requestId = ++latestRequest.current;\n setIsLoading(true);\n try {\n if (!agentId || !threadId) {\n setWorkingMemoryData(null);\n setIsLoading(false);\n return;\n }\n const res = await client.getWorkingMemory({ agentId, threadId, resourceId, requestContext });\n if (requestId !== latestRequest.current) return;\n const { workingMemory, source, workingMemoryTemplate, threadExists } = res as {\n workingMemory: string | null;\n source: 'thread' | 'resource';\n workingMemoryTemplate: { content: string; format: 'json' | 'markdown' };\n threadExists: boolean;\n };\n setThreadExists(threadExists);\n setWorkingMemoryData(workingMemory);\n setWorkingMemorySource(source);\n setWorkingMemoryFormat(workingMemoryTemplate?.format || 'markdown');\n if (workingMemoryTemplate?.format === 'json') {\n let dataToSet = '';\n if (workingMemory) {\n dataToSet = parseJsonString(workingMemory);\n } else if (workingMemoryTemplate?.content) {\n dataToSet = parseJsonString(workingMemoryTemplate.content);\n } else {\n dataToSet = '';\n }\n setWorkingMemoryData(dataToSet);\n } else {\n setWorkingMemoryData(workingMemory || workingMemoryTemplate?.content || '');\n }\n } catch (error) {\n if (requestId !== latestRequest.current) return;\n setWorkingMemoryData(null);\n console.error('Error fetching working memory', error);\n } finally {\n if (requestId === latestRequest.current) setIsLoading(false);\n }\n }, [agentId, threadId, resourceId, client, requestContext]);\n\n useEffect(() => {\n void refetch();\n }, [refetch]);\n\n const updateWorkingMemory = async (newMemory: string) => {\n setIsUpdating(true);\n try {\n if (workingMemoryFormat === 'json') {\n try {\n JSON.parse(newMemory);\n } catch {\n throw new Error('Invalid JSON working memory');\n }\n }\n await client.updateWorkingMemory({ agentId, threadId, workingMemory: newMemory, resourceId, requestContext });\n void refetch();\n } catch (error) {\n console.error('Error updating working memory', error);\n throw error;\n } finally {\n setIsUpdating(false);\n }\n };\n\n return {\n threadExists,\n workingMemoryData,\n workingMemorySource,\n workingMemoryFormat,\n isLoading,\n isUpdating,\n refetch,\n updateWorkingMemory,\n };\n}\n","import type { StoredAgentResponse, StoredWorkspaceRef, UpdateStoredAgentParams } from '@mastra/client-js';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { useMemo } from 'react';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions } from '../shared/query-options';\nimport { useStoredAgent } from './use-stored-agents';\n\n/**\n * Hook to read and mutate the workspace reference for a stored agent.\n *\n * The workspace ref is part of the agent snapshot config and can be:\n * - `{ type: 'id', workspaceId }` — references a stored workspace by ID\n * - `{ type: 'inline', config }` — inline workspace config\n * - `undefined` — no workspace assigned\n */\nexport function useAgentWorkspace({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: {\n updateWorkspace?: MastraMutationOptions<StoredAgentResponse, StoredWorkspaceRef | undefined>;\n };\n} = {}) {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n const { data: agent } = useStoredAgent({ agentId, status: 'draft', queryOptions: { enabled: Boolean(agentId) } });\n\n const workspace = useMemo((): StoredWorkspaceRef | undefined => {\n if (!agent?.workspace) return undefined;\n // Handle conditional field: if it's an array of variants, take the first value\n if (Array.isArray(agent.workspace)) {\n return agent.workspace[0]?.value as StoredWorkspaceRef | undefined;\n }\n return agent.workspace as StoredWorkspaceRef;\n }, [agent?.workspace]);\n\n const updateWorkspace = useMutation({\n mutationFn: (ref: StoredWorkspaceRef | undefined) => {\n if (!agentId) throw new Error('agentId is required');\n const params: UpdateStoredAgentParams = { workspace: ref };\n return client.getStoredAgent(agentId).update(params, requestContext);\n },\n onSuccess: () => {\n if (agentId) {\n void queryClient.invalidateQueries({ queryKey: ['stored-agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n }\n },\n ...queryOptions?.updateWorkspace,\n });\n\n return { workspace, updateWorkspace };\n}\n","import type { GetAgentResponse } from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\n/**\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useAgent = <TData = GetAgentResponse | null>({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<GetAgentResponse | null, TData>;\n} = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['agent', agentId, requestContext],\n queryFn: () => (agentId ? client.getAgent(agentId).details(requestContext) : null),\n retry: false,\n ...queryOptions,\n });\n};\n","import type { MastraClient } from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\ntype AgentsModelProvidersResponse = Awaited<ReturnType<MastraClient['listAgentsModelProviders']>>;\n\nexport const useAgentsModelProviders = <TData = AgentsModelProvidersResponse>({\n queryOptions,\n}: { queryOptions?: MastraQueryOptions<AgentsModelProvidersResponse, TData> } = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['agents-model-providers'],\n queryFn: () => client.listAgentsModelProviders(),\n retry: false,\n ...queryOptions,\n });\n};\n","import type {\n MastraClient,\n ReorderModelListParams,\n UpdateModelInModelListParams,\n UpdateModelParams,\n} from '@mastra/client-js';\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport type { UseMutationResult, UseQueryResult } from '@tanstack/react-query';\n\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions, MastraQueryOptions } from '../shared/query-options';\n\ntype Agent = ReturnType<MastraClient['getAgent']>;\ntype ListAgentsResponse = Awaited<ReturnType<MastraClient['listAgents']>>;\nexport type ModelUpdateResponse = Awaited<ReturnType<Agent['updateModel']>>;\n\nexport const useAgents = <TData = ListAgentsResponse>({\n requestContext,\n queryOptions,\n}: {\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<ListAgentsResponse, TData>;\n} = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['agents', requestContext],\n queryFn: () => client.listAgents(requestContext),\n ...queryOptions,\n });\n};\n\nexport const useUpdateAgentModel = ({\n agentId,\n queryOptions,\n}: {\n agentId: string;\n queryOptions?: MastraMutationOptions<ModelUpdateResponse, UpdateModelParams>;\n}): UseMutationResult<ModelUpdateResponse, Error, UpdateModelParams> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async (payload: UpdateModelParams) => client.getAgent(agentId).updateModel(payload),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n onError: err => {\n console.error('Error updating model', err);\n },\n ...queryOptions,\n });\n};\n\nexport const useReorderModelList = ({\n agentId,\n queryOptions,\n}: {\n agentId: string;\n queryOptions?: MastraMutationOptions<ModelUpdateResponse, ReorderModelListParams>;\n}): UseMutationResult<ModelUpdateResponse, Error, ReorderModelListParams> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async (payload: ReorderModelListParams) => client.getAgent(agentId).reorderModelList(payload),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n onError: err => {\n console.error('Error reordering model list', err);\n },\n ...queryOptions,\n });\n};\n\nexport const useUpdateModelInModelList = ({\n agentId,\n queryOptions,\n}: {\n agentId: string;\n queryOptions?: MastraMutationOptions<ModelUpdateResponse, UpdateModelInModelListParams>;\n}): UseMutationResult<ModelUpdateResponse, Error, UpdateModelInModelListParams> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async (payload: UpdateModelInModelListParams) =>\n client.getAgent(agentId).updateModelInModelList(payload),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n onError: err => {\n console.error('Error updating model in model list', err);\n },\n ...queryOptions,\n });\n};\n\nexport const useResetAgentModel = ({\n agentId,\n queryOptions,\n}: {\n agentId: string;\n queryOptions?: MastraMutationOptions<ModelUpdateResponse, void>;\n}): UseMutationResult<ModelUpdateResponse, Error, void> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async () => client.getAgent(agentId).resetModel(),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n onError: err => {\n console.error('Error resetting model', err);\n },\n ...queryOptions,\n });\n};\n","import { useMutation } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions } from '../shared/query-options';\n\ninterface CloseBrowserParams {\n agentId: string;\n threadId?: string;\n}\n\n/**\n * Mutation hook for closing an agent's browser session.\n */\nexport function useCloseBrowser({\n queryOptions,\n}: { queryOptions?: MastraMutationOptions<{ success: boolean }, CloseBrowserParams> } = {}) {\n const client = useMastraClient();\n\n return useMutation<{ success: boolean }, Error, CloseBrowserParams>({\n mutationFn: ({ agentId, threadId }) => client.getAgent(agentId).closeBrowser(threadId),\n onError: err => {\n console.error('[useCloseBrowser] Error closing browser:', err);\n },\n ...queryOptions,\n });\n}\n","import type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\ninterface ApiInstructionBlock {\n type: string;\n content?: string;\n id?: string;\n /** Form-format ref blocks use `promptBlockId` instead of `id` */\n promptBlockId?: string;\n rules?: unknown;\n}\n\n/**\n * Normalize blocks to API format.\n * Form-format ref blocks have `{ type: 'prompt_block_ref', promptBlockId }`,\n * while API-format blocks have `{ type: 'prompt_block_ref', id }`.\n */\nfunction toApiBlocks(blocks: ApiInstructionBlock[]) {\n return blocks.map(block => {\n if (block.type === 'prompt_block_ref') {\n // Form-format blocks have `promptBlockId` (the storage ID) and `id` (form-internal UUID).\n // API-format blocks have `id` (the storage ID). Prefer promptBlockId when present.\n return { type: 'prompt_block_ref' as const, id: block.promptBlockId ?? block.id, rules: block.rules };\n }\n return { type: block.type, content: block.content, rules: block.rules };\n });\n}\n\n/**\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport function usePreviewInstructions<TData = string>({\n blocks,\n requestContext,\n queryOptions,\n}: {\n blocks: ApiInstructionBlock[] | undefined;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<string, TData>;\n}): UseQueryResult<TData, Error> {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['preview-instructions', blocks, requestContext],\n queryFn: async () => {\n if (!blocks || blocks.length === 0) return '';\n\n const response = await client.request<{ result: string }>('/stored/agents/preview-instructions', {\n method: 'POST',\n body: { blocks: toApiBlocks(blocks), context: requestContext },\n });\n\n return response.result;\n },\n ...queryOptions,\n });\n}\n","import type { MastraClient } from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\n\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\nexport type ListStoredSkillsResponse = Awaited<ReturnType<MastraClient['listStoredSkills']>>;\n\nexport function useStoredSkills<TData = ListStoredSkillsResponse>({\n queryOptions,\n}: { queryOptions?: MastraQueryOptions<ListStoredSkillsResponse, TData> } = {}): UseQueryResult<TData, Error> {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['stored-skills'],\n queryFn: () => client.listStoredSkills(),\n ...queryOptions,\n });\n}\n","import type { ChannelPlatformInfo, ChannelInstallationInfo, ChannelConnectResult } from '@mastra/client-js';\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport type { UseMutationResult, UseQueryResult } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions, MastraQueryOptions } from '../shared/query-options';\n\nexport type { ChannelPlatformInfo, ChannelInstallationInfo, ChannelConnectResult };\n\nexport const useChannelPlatforms = <TData = ChannelPlatformInfo[]>({\n queryOptions,\n}: { queryOptions?: MastraQueryOptions<ChannelPlatformInfo[], TData> } = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery<ChannelPlatformInfo[], Error, TData>({\n queryKey: ['channels', 'platforms'],\n queryFn: () => client.channels.listPlatforms(),\n staleTime: 60 * 1000,\n retry: false,\n ...queryOptions,\n });\n};\n\n/**\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useChannelInstallations = <TData = ChannelInstallationInfo[]>({\n platform,\n agentId,\n queryOptions,\n}: {\n platform: string;\n agentId: string;\n queryOptions?: MastraQueryOptions<ChannelInstallationInfo[], TData>;\n}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery<ChannelInstallationInfo[], Error, TData>({\n queryKey: ['channels', 'installations', platform, agentId],\n queryFn: () => client.channels.listInstallations(platform, agentId),\n staleTime: 10 * 1000,\n retry: false,\n ...queryOptions,\n });\n};\n\n/**\n * Reconcile an agent's installation with platform state — activates a pending\n * installation whose connect flow completed out-of-band (e.g. a Discord bot\n * invite finished in another tab). Resolves null on platforms without\n * reconciliation. Call it deliberately (e.g. on window focus while a connect\n * is in flight) — it is a write, not a read.\n */\nexport const useReconcileChannelInstallation = ({\n platform,\n queryOptions,\n}: {\n platform: string;\n queryOptions?: MastraMutationOptions<ChannelInstallationInfo | null, string>;\n}): UseMutationResult<ChannelInstallationInfo | null, Error, string> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<ChannelInstallationInfo | null, Error, string>({\n mutationFn: agentId => client.channels.reconcileInstallation(platform, agentId),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['channels', 'installations', platform] });\n },\n ...queryOptions,\n });\n};\n\nexport const useConnectChannel = ({\n platform,\n queryOptions,\n}: {\n platform: string;\n queryOptions?: MastraMutationOptions<ChannelConnectResult, { agentId: string; options?: Record<string, unknown> }>;\n}): UseMutationResult<ChannelConnectResult, Error, { agentId: string; options?: Record<string, unknown> }> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<ChannelConnectResult, Error, { agentId: string; options?: Record<string, unknown> }>({\n mutationFn: ({ agentId, options }) =>\n client.channels.connect(platform, agentId, {\n ...options,\n // Tell the server to redirect back here after OAuth\n redirectUrl: window.location.href,\n }),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['channels', 'installations', platform] });\n },\n ...queryOptions,\n });\n};\n\nexport const useDisconnectChannel = ({\n platform,\n queryOptions,\n}: {\n platform: string;\n queryOptions?: MastraMutationOptions<{ success: boolean }, string>;\n}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<{ success: boolean }, Error, string>({\n mutationFn: agentId => client.channels.disconnect(platform, agentId),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['channels', 'installations', platform] });\n },\n ...queryOptions,\n });\n};\n","import type { MastraClient } from '@mastra/client-js';\nimport { RequestContext } from '@mastra/core/di';\nimport { useMutation } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions } from '../shared/query-options';\n\ntype ExecuteAgentToolResponse = Awaited<ReturnType<ReturnType<MastraClient['getAgent']>['executeTool']>>;\n\nexport interface ExecuteToolInput {\n agentId: string;\n toolId: string;\n input: any;\n playgroundRequestContext?: Record<string, any>;\n}\n\nexport const useExecuteAgentTool = ({\n queryOptions,\n}: { queryOptions?: MastraMutationOptions<ExecuteAgentToolResponse, ExecuteToolInput> } = {}) => {\n const client = useMastraClient();\n return useMutation({\n mutationFn: async ({ agentId, toolId, input, playgroundRequestContext }: ExecuteToolInput) => {\n const requestContext = new RequestContext();\n Object.entries(playgroundRequestContext ?? {}).forEach(([key, value]) => {\n requestContext.set(key, value);\n });\n return client.getAgent(agentId).executeTool(toolId, { data: input, requestContext });\n },\n ...queryOptions,\n });\n};\n"],"mappings":";;;;;;AAmBA,MAAM,WAAW;AAEjB,MAAM,cAAc;AAEpB,MAAM,eAAe,YAA6B,IAAI,KAAK,QAAQ,SAAS,CAAC,CAAC,QAAQ;AAEtF,MAAM,eAAe,GAAoB,MAAuB,YAAY,CAAC,IAAI,YAAY,CAAC;AAE9F,MAAa,oBAA+C,EAC1D,UACA,SACA,QACA,gBACA,mBACkC;CAClC,MAAM,SAASA,8BAAAA,gBAAgB;CAE/B,QAAA,GAAOC,sBAAAA,iBAAAA,CAAiB;EACtB,UAAU;GAAC;GAAU;GAAY;GAAU;GAAS;EAAc;EAClE,kBAAkB;EAClB,SACE,UAAU,YACL,EAAE,WAAW,gBACZ,OAAO,mBAAmB,UAAU;GAClC;GACA;GACA,wBAAwB;GACxB,SAAS;GACT,SAAS;IAAE,OAAO;IAAa,WAAW;GAAO;GAGjD,QAAQ,YAAY,EAAE,WAAW,EAAE,KAAK,IAAI,KAAK,SAAS,EAAE,EAAE,IAAI,KAAA;EACpE,CAAC,IACHC,sBAAAA;EACN,mBAAmB,UAAU,WAAW,kBAAkB;GACxD,IAAI,CAAC,SAAS,WAAW,SAAS,SAAS,WAAW,GAAG,OAAO,KAAA;GAChE,MAAM,OAAO,IAAI,KAAK,KAAK,IAAI,GAAG,SAAS,SAAS,IAAI,WAAW,CAAC,CAAC,CA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iBACwF,CAAC,MAAM;CAC/F,MAAM,SAASC,8BAAAA,gBAAgB;CAC/B,QAAA,GAAOC,sBAAAA,YAAAA,CAAY;EACjB,YAAY,OAAO,EAAE,SAAS,QAAQ,OAAO,+BAAiD;GAC5F,MAAM,iBAAiB,IAAIC,gBAAAA,eAAe;GAC1C,OAAO,QAAQ,4BAA4B,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;IACvE,eAAe,IAAI,KAAK,KAAK;GAC/B,CAAC;GACD,OAAO,OAAO,SAAS,OAAO,CAAC,CAAC,YAAY,QAAQ;IAAE,MAAM;IAAO;GAAe,CAAC;EACrF;EACA,GAAG;CACL,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["useMastraClient","useInfiniteQuery","skipToken","useMastraClient","useQuery","useMastraClient","useState","useRef","useMemo","useCallback","useQuery","useMastraClient","useQuery","useMastraClient","useQuery","useQueryClient","useMutation","useMastraClient","useQueryClient","useMemo","useMutation","useMastraClient","useQuery","skipToken","useQueryClient","useMutation","useMastraClient","useState","useRef","useCallback","useMastraClient","useQueryClient","useMemo","useMutation","useMastraClient","useQuery","useMastraClient","useQuery","useMastraClient","useQuery","useQueryClient","useMutation","useMastraClient","useMutation","useMastraClient","useQuery","useMastraClient","useQuery","useMastraClient","useQuery","useQueryClient","useMutation","useMastraClient","useMutation","RequestContext"],"sources":["../../../src/hooks/agents/use-agent-messages.ts","../../../src/hooks/agents/use-agent-plan.ts","../../../src/hooks/agents/use-background-tasks.ts","../../../src/hooks/agents/use-browser-session-probe.ts","../../../src/hooks/agents/is-model-not-allowed.ts","../../../src/hooks/agents/use-stored-agents.ts","../../../src/hooks/agents/use-agent-skills.ts","../../../src/hooks/agents/use-agent-versions.ts","../../../src/hooks/agents/use-agent-working-memory.ts","../../../src/hooks/agents/use-agent-workspace.ts","../../../src/hooks/agents/use-agent.ts","../../../src/hooks/agents/use-agents-model-providers.ts","../../../src/hooks/agents/use-agents.ts","../../../src/hooks/agents/use-close-browser.ts","../../../src/hooks/agents/use-preview-instructions.ts","../../../src/hooks/agents/use-stored-skills.ts","../../../src/hooks/agents/use-channels.ts","../../../src/hooks/agents/use-execute-agent-tool.ts"],"sourcesContent":["import type { MastraClient } from '@mastra/client-js';\nimport type { MastraDBMessage } from '@mastra/core/agent/message-list';\nimport { skipToken, useInfiniteQuery } from '@tanstack/react-query';\nimport type { InfiniteData, QueryKey } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraInfiniteQueryOptions } from '../shared/query-options';\n\ntype AgentMessagesPage = Awaited<ReturnType<MastraClient['listThreadMessages']>>;\n\ntype AgentMessagesData = InfiniteData<AgentMessagesPage, string> & { messages: MastraDBMessage[] };\n\nexport interface UseAgentMessagesProps<TData = AgentMessagesData> {\n threadId?: string;\n agentId: string;\n memory: boolean;\n requestContext?: Record<string, any>;\n queryOptions?: MastraInfiniteQueryOptions<AgentMessagesPage, TData, QueryKey, string>;\n}\n\nconst PER_PAGE = 40;\n\nconst NEWEST_PAGE = '';\n\nconst createdAtMs = (message: MastraDBMessage) => new Date(message.createdAt).getTime();\n\nconst byCreatedAt = (a: MastraDBMessage, b: MastraDBMessage) => createdAtMs(a) - createdAtMs(b);\n\nexport const useAgentMessages = <TData = AgentMessagesData>({\n threadId,\n agentId,\n memory,\n requestContext,\n queryOptions,\n}: UseAgentMessagesProps<TData>) => {\n const client = useMastraClient();\n\n return useInfiniteQuery({\n queryKey: ['memory', 'messages', threadId, agentId, requestContext],\n initialPageParam: NEWEST_PAGE,\n queryFn:\n memory && threadId\n ? ({ pageParam: olderThan }) =>\n client.listThreadMessages(threadId, {\n agentId,\n requestContext,\n includeSystemReminders: true,\n perPage: PER_PAGE,\n orderBy: { field: 'createdAt', direction: 'DESC' },\n // Inclusive bound: messages sharing the oldest createdAt of the previous page\n // may have been cut off by perPage, so re-ask for them and dedupe by id below.\n filter: olderThan ? { dateRange: { end: new Date(olderThan) } } : undefined,\n })\n : skipToken,\n getNextPageParam: (lastPage, _allPages, lastPageParam) => {\n if (!lastPage.hasMore || lastPage.messages.length === 0) return undefined;\n const next = new Date(Math.min(...lastPage.messages.map(createdAtMs))).toISOString();\n // A full page of same-timestamp messages would re-request itself forever.\n return next === lastPageParam ? undefined : next;\n },\n select: (data): TData => {\n const seen = new Set<string>();\n const messages = data.pages\n .flatMap(page => page.messages)\n .filter(message => {\n if (seen.has(message.id)) return false;\n seen.add(message.id);\n return true;\n })\n .sort(byCreatedAt);\n return { ...data, messages } as AgentMessagesData as TData;\n },\n staleTime: 0,\n gcTime: 0,\n retry: false,\n refetchOnWindowFocus: false,\n ...queryOptions,\n });\n};\n","import type { MastraClient } from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\ntype AgentPlanResponse = Awaited<ReturnType<ReturnType<MastraClient['getAgent']>['readPlan']>>;\n\ninterface UseAgentPlanOptions<TData> {\n agentId: string;\n path: string;\n agentVersionId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<AgentPlanResponse, TData>;\n}\n\nexport function useAgentPlan<TData = AgentPlanResponse>({\n agentId,\n path,\n agentVersionId,\n requestContext,\n queryOptions,\n}: UseAgentPlanOptions<TData>): UseQueryResult<TData, Error> {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['agent-plan', agentId, agentVersionId, path, requestContext],\n queryFn: () => {\n const agent = agentVersionId ? client.getAgent(agentId, { versionId: agentVersionId }) : client.getAgent(agentId);\n return agent.readPlan(path, requestContext);\n },\n retry: false,\n ...queryOptions,\n });\n}\n","import type { MastraClient, StreamBackgroundTasksParams } from '@mastra/client-js';\nimport type { BackgroundTaskStatus } from '@mastra/core/background-tasks';\nimport type { AgentChunkType } from '@mastra/core/stream';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\ntype BackgroundTaskStreamReader = ReturnType<Awaited<ReturnType<MastraClient['streamBackgroundTasks']>>['getReader']>;\n\nexport interface BackgroundTaskEvent {\n taskId: string;\n toolName: string;\n toolCallId: string;\n agentId: string;\n runId: string;\n result?: unknown;\n error?: { message: string; stack?: string };\n status: BackgroundTaskStatus;\n args: Record<string, unknown>;\n suspendPayload?: unknown;\n}\n\nexport interface UseBackgroundTaskStreamOptions extends StreamBackgroundTasksParams {\n /** Whether the stream is active. Default: true */\n enabled?: boolean;\n}\n\nexport interface UseBackgroundTaskStreamReturn {\n /** Map of taskId → latest event data */\n tasks: Record<string, BackgroundTaskEvent>;\n /** Whether the stream is currently connected */\n isConnected: boolean;\n /** Any connection error */\n error: Error | null;\n /** Manually disconnect the stream */\n disconnect: () => void;\n /** Manually reconnect the stream */\n reconnect: () => void;\n /** List of running tasks */\n runningTasks: BackgroundTaskEvent[];\n /** List of completed tasks */\n completedTasks: BackgroundTaskEvent[];\n /** List of failed tasks */\n failedTasks: BackgroundTaskEvent[];\n /** Clear completed and failed tasks */\n clearCompletedAndFailedTasks: () => void;\n}\n\n/**\n * Streams background task events via SSE and accumulates them in a map keyed by taskId.\n *\n * Each incoming event (task.completed / task.failed) is stored in state so the UI\n * can react to completions — e.g., show a toast, update a badge, or display results.\n *\n * @example\n * ```tsx\n * const { tasks, isConnected, completedTasks } = useBackgroundTaskStream({ agentId: 'crypto-agent' });\n *\n * // Show a badge with completed count\n * const completedCount = completedTasks.length;\n * ```\n */\n\ntype EventType = Extract<\n AgentChunkType,\n {\n type:\n | 'background-task-running'\n | 'background-task-completed'\n | 'background-task-failed'\n | 'background-task-cancelled'\n | 'background-task-output'\n | 'background-task-suspended'\n | 'background-task-resumed';\n }\n>;\n\nconst EVENT_STATUS_MAP: Record<EventType['type'], BackgroundTaskStatus> = {\n 'background-task-running': 'running',\n 'background-task-output': 'running',\n 'background-task-completed': 'completed',\n 'background-task-failed': 'failed',\n 'background-task-cancelled': 'cancelled',\n 'background-task-suspended': 'suspended',\n 'background-task-resumed': 'running',\n};\n\nexport function useBackgroundTaskStream(options: UseBackgroundTaskStreamOptions = {}): UseBackgroundTaskStreamReturn {\n const { enabled = true, agentId, runId, threadId, resourceId, taskId } = options;\n const client = useMastraClient();\n\n const [tasks, setTasks] = useState<Record<string, BackgroundTaskEvent>>({});\n const [isConnected, setIsConnected] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n const abortRef = useRef<AbortController | null>(null);\n const readerRef = useRef<BackgroundTaskStreamReader | null>(null);\n const connectSeqRef = useRef(0);\n\n const runningTasks = useMemo(() => {\n return Object.values(tasks).filter(task => task.status === 'running');\n }, [tasks]);\n\n const completedTasks = useMemo(() => {\n return Object.values(tasks).filter(task => task.status === 'completed');\n }, [tasks]);\n\n const failedTasks = useMemo(() => {\n return Object.values(tasks).filter(task => task.status === 'failed');\n }, [tasks]);\n\n const cleanup = useCallback(() => {\n readerRef.current?.cancel().catch(() => {});\n readerRef.current = null;\n abortRef.current?.abort();\n abortRef.current = null;\n setIsConnected(false);\n }, []);\n\n const connect = useCallback(async () => {\n const seq = ++connectSeqRef.current;\n cleanup();\n setError(null);\n\n const controller = new AbortController();\n abortRef.current = controller;\n\n try {\n const stream = await client.streamBackgroundTasks({ agentId, runId, threadId, resourceId, taskId });\n\n if (!stream) {\n setError(new Error('Stream connection failed'));\n return;\n }\n\n if (seq === connectSeqRef.current) {\n setIsConnected(true);\n }\n\n // Get a reader from the ReadableStream and store it in ref\n const reader = stream.getReader();\n readerRef.current = reader;\n\n while (!controller.signal.aborted) {\n const { done, value } = await reader.read();\n if (done) break;\n\n const event = value as EventType;\n if (event.type !== 'background-task-output') {\n setTasks(prev => ({\n ...prev,\n [event.payload.taskId]: {\n ...prev[event.payload.taskId],\n ...event.payload,\n status: EVENT_STATUS_MAP[event.type],\n args:\n ('args' in event.payload ? event.payload.args : undefined) ?? prev[event.payload.taskId]?.args ?? {},\n },\n }));\n }\n }\n } catch (err: any) {\n if (err?.name !== 'AbortError') {\n if (seq === connectSeqRef.current) {\n setError(err instanceof Error ? err : new Error(String(err)));\n }\n }\n } finally {\n if (seq === connectSeqRef.current) {\n setIsConnected(false);\n }\n }\n }, [client, agentId, runId, threadId, resourceId, taskId, cleanup]);\n\n useEffect(() => {\n if (!enabled) {\n cleanup();\n return;\n }\n\n void connect();\n return cleanup;\n }, [enabled, connect, cleanup]);\n\n const disconnect = useCallback(() => {\n cleanup();\n }, [cleanup]);\n\n const reconnect = useCallback(() => {\n void connect();\n }, [connect]);\n\n const clearCompletedAndFailedTasks = () => {\n setTasks(prev => {\n const newTasks = { ...prev };\n Object.values(newTasks).forEach(task => {\n if (\n task.status === 'completed' ||\n task.status === 'failed' ||\n task.status === 'cancelled' ||\n task.status === 'timed_out'\n ) {\n delete newTasks[task.taskId];\n }\n });\n return newTasks;\n });\n };\n\n return {\n tasks,\n isConnected,\n error,\n disconnect,\n reconnect,\n runningTasks,\n completedTasks,\n failedTasks,\n clearCompletedAndFailedTasks,\n };\n}\n\ntype BackgroundTaskResponse = Awaited<ReturnType<MastraClient['getBackgroundTask']>>;\n\nexport const useGetBackgroundTaskById = <TData = BackgroundTaskResponse>({\n backgroundTaskId,\n queryOptions,\n}: {\n backgroundTaskId: string;\n queryOptions?: MastraQueryOptions<BackgroundTaskResponse, TData>;\n}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n return useQuery({\n queryKey: ['background-task', backgroundTaskId],\n queryFn: () => client.getBackgroundTask(backgroundTaskId),\n ...queryOptions,\n });\n};\n","import type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\nexport interface BrowserSessionProbe {\n hasSession: boolean;\n screencastAvailable: boolean;\n}\n\ninterface UseBrowserSessionProbeOptions<TData> {\n agentId?: string;\n threadId?: string;\n /** TanStack overrides spread last, e.g. `{ enabled: false }` for agents without browser tools. */\n queryOptions?: MastraQueryOptions<BrowserSessionProbe, TData>;\n}\n\nexport const browserSessionProbeQueryKey = (agentId?: string, threadId?: string) =>\n ['browser-session-probe', agentId, threadId] as const;\n\nconst LEGACY_FALLBACK: BrowserSessionProbe = { hasSession: true, screencastAvailable: true };\n\nconst isNotFoundError = (error: unknown): boolean => {\n if (!error || typeof error !== 'object') return false;\n if ('status' in error && (error as { status: unknown }).status === 404) return true;\n if ('statusCode' in error && (error as { statusCode: unknown }).statusCode === 404) return true;\n return false;\n};\n\n/**\n * Query hook that probes the server for the agent's browser session state.\n *\n * Used by {@link BrowserSessionProvider} to decide whether to open a screencast\n * WebSocket. The probe avoids two failure modes:\n *\n * 1. `screencastAvailable: false` — the server doesn't have `ws` / `@hono/node-ws`\n * installed (or the route was never registered). Opening a WS would fail and\n * trigger a reconnect loop.\n * 2. `hasSession: false` — no active browser session for this thread yet. Opening\n * a WS would succeed but sit idle, holding resources for no reason.\n *\n * When the endpoint itself returns 404 (older server that predates this probe),\n * the hook assumes screencast is available and a session is active so behavior\n * matches the legacy unconditional connect.\n *\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport function useBrowserSessionProbe<TData = BrowserSessionProbe>({\n agentId,\n threadId,\n queryOptions,\n}: UseBrowserSessionProbeOptions<TData>): UseQueryResult<TData, Error> {\n const client = useMastraClient();\n\n return useQuery<BrowserSessionProbe, Error, TData>({\n queryKey: browserSessionProbeQueryKey(agentId, threadId),\n queryFn: async () => {\n if (!agentId) {\n return { hasSession: false, screencastAvailable: false };\n }\n\n try {\n return await client.getAgent(agentId).browserSession(threadId);\n } catch (error) {\n if (isNotFoundError(error)) {\n // Older server without the probe endpoint — fall back to legacy behavior.\n return LEGACY_FALLBACK;\n }\n throw error;\n }\n },\n // No polling: the probe fires once on mount, on window focus, and is\n // updated via `setQueriesData` from `tool-fallback.tsx` when a browser\n // tool call transitions. This avoids idle 5s polls and lets the probe\n // flip to `hasSession: true` the instant a tool call is seen.\n refetchOnWindowFocus: true,\n staleTime: 0,\n retry: 1,\n ...queryOptions,\n });\n}\n","/**\n * The wire-level error code the server emits on a 422 when a model is blocked\n * by the admin's builder policy. Kept as a local literal so the browser bundle\n * never imports server-only agent-builder EE code.\n */\nconst MODEL_NOT_ALLOWED_CODE = 'MODEL_NOT_ALLOWED';\n\nexport interface ModelNotAllowedDetails {\n message: string;\n attempted?: { provider?: string; modelId?: string };\n offendingLabel?: string;\n}\n\n/**\n * Detects HTTP 422 + MODEL_NOT_ALLOWED responses thrown by `MastraClientError`\n * (or any error carrying `status` + `body.error.code`). Returns the parsed\n * details when matched, or `null` otherwise.\n */\nexport function isModelNotAllowedError(err: unknown): ModelNotAllowedDetails | null {\n if (!err || typeof err !== 'object') return null;\n const candidate = err as { status?: number; body?: unknown; message?: string };\n if (candidate.status !== 422) return null;\n const body = candidate.body as { error?: { code?: unknown } } | undefined;\n const code = body?.error?.code;\n if (code !== MODEL_NOT_ALLOWED_CODE) return null;\n const errorBody = body!.error as {\n message?: string;\n attempted?: { provider?: string; modelId?: string };\n offendingLabel?: string;\n };\n return {\n message: errorBody.message || candidate.message || 'Model not allowed by admin policy',\n attempted: errorBody.attempted,\n offendingLabel: errorBody.offendingLabel,\n };\n}\n","import type {\n CreateStoredAgentParams,\n UpdateStoredAgentParams,\n ListStoredAgentsParams,\n StoredAgentResponse,\n ListStoredAgentsResponse,\n StoredAgentDependentsResponse,\n DeleteStoredAgentResponse,\n} from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions, MastraQueryOptions } from '../shared/query-options';\nimport { isModelNotAllowedError } from './is-model-not-allowed';\n\nexport const useStoredAgents = <TData = ListStoredAgentsResponse>({\n queryOptions,\n ...params\n}: ListStoredAgentsParams & {\n queryOptions?: MastraQueryOptions<ListStoredAgentsResponse, TData>;\n} = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n const listParams = Object.keys(params).length > 0 ? params : undefined;\n\n return useQuery({\n queryKey: ['stored-agents', listParams],\n queryFn: () => client.listStoredAgents(listParams),\n ...queryOptions,\n });\n};\n\n/**\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useStoredAgent = <TData = StoredAgentResponse | null>({\n agentId,\n status,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n status?: 'draft' | 'published';\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<StoredAgentResponse | null, TData>;\n} = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['stored-agent', agentId, status, requestContext],\n queryFn: async () => {\n if (!agentId) return null;\n try {\n return await client.getStoredAgent(agentId).details(requestContext, { status });\n } catch (error) {\n // 404 is expected for code-only agents that haven't been stored yet\n if (error && typeof error === 'object' && 'status' in error && (error as { status: number }).status === 404) {\n return null;\n }\n throw error;\n }\n },\n retry: false,\n ...queryOptions,\n });\n};\n\nexport type StoredAgent = StoredAgentResponse;\n\n/**\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useStoredAgentDependents = <TData = StoredAgentDependentsResponse>({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<StoredAgentDependentsResponse, TData>;\n} = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['stored-agent-dependents', agentId, requestContext],\n queryFn: () => client.getStoredAgent(agentId!).dependents(requestContext),\n retry: false,\n ...queryOptions,\n });\n};\n\nexport const useStoredAgentMutations = ({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: {\n createStoredAgent?: MastraMutationOptions<StoredAgentResponse, CreateStoredAgentParams>;\n updateStoredAgent?: MastraMutationOptions<StoredAgentResponse, UpdateStoredAgentParams>;\n deleteStoredAgent?: MastraMutationOptions<DeleteStoredAgentResponse, void>;\n };\n} = {}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n // If the server rejects with HTTP 422 + MODEL_NOT_ALLOWED the admin policy\n // has likely changed under us — refresh the cached settings so the UI\n // re-renders against the latest server truth.\n const invalidateBuilderSettingsOnPolicyReject = (err: unknown) => {\n if (isModelNotAllowedError(err)) {\n void queryClient.invalidateQueries({ queryKey: ['builder-settings'] });\n }\n };\n\n const createMutation = useMutation({\n mutationFn: (params: CreateStoredAgentParams) => client.createStoredAgent(params),\n onSuccess: created => {\n // Prime the per-agent details cache with the response so the next page\n // (the edit page) can render the agent on first paint without a refetch.\n // The starter relies on this to immediately mount the conversation panel\n // and dispatch the user's initial message.\n queryClient.setQueryData(['stored-agent', created.id, 'draft', requestContext], created);\n queryClient.setQueryData(['stored-agent', created.id, undefined, requestContext], created);\n // Invalidate both stored-agents list and the merged agents list\n void queryClient.invalidateQueries({ queryKey: ['stored-agents'] });\n void queryClient.invalidateQueries({ queryKey: ['agents'] });\n // Invalidate the merged agent details so the freshly-created id resolves\n // instead of staying stuck on the initial `null` from the 404 lookup.\n void queryClient.invalidateQueries({ queryKey: ['agent', created.id] });\n },\n onError: invalidateBuilderSettingsOnPolicyReject,\n ...queryOptions?.createStoredAgent,\n });\n\n const updateMutation = useMutation({\n mutationFn: (params: UpdateStoredAgentParams) => {\n if (!agentId) throw new Error('agentId is required for update');\n return client.getStoredAgent(agentId).update(params, requestContext);\n },\n onSuccess: () => {\n // Invalidate lists\n void queryClient.invalidateQueries({ queryKey: ['stored-agents'] });\n void queryClient.invalidateQueries({ queryKey: ['agents'] });\n // Invalidate specific agent details\n if (agentId) {\n void queryClient.invalidateQueries({ queryKey: ['stored-agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n }\n },\n onError: invalidateBuilderSettingsOnPolicyReject,\n ...queryOptions?.updateStoredAgent,\n });\n\n const deleteMutation = useMutation({\n mutationFn: () => {\n if (!agentId) throw new Error('agentId is required for delete');\n return client.getStoredAgent(agentId).delete(requestContext);\n },\n onSuccess: () => {\n // Invalidate lists so the agents list page refetches without the deleted entry\n void queryClient.invalidateQueries({ queryKey: ['stored-agents'] });\n void queryClient.invalidateQueries({ queryKey: ['agents'] });\n // Drop the deleted entity from the cache so active observers don't refetch a 404\n if (agentId) {\n queryClient.removeQueries({ queryKey: ['stored-agent', agentId] });\n queryClient.removeQueries({ queryKey: ['agent', agentId] });\n }\n },\n ...queryOptions?.deleteStoredAgent,\n });\n\n return {\n createStoredAgent: createMutation,\n updateStoredAgent: updateMutation,\n deleteStoredAgent: deleteMutation,\n };\n};\n","import type { StoredAgentResponse, StoredAgentSkillConfig, UpdateStoredAgentParams } from '@mastra/client-js';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { useMemo } from 'react';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions } from '../shared/query-options';\nimport { useStoredAgent } from './use-stored-agents';\n\n/**\n * Hook to read and mutate the skills config for a stored agent.\n *\n * The skills field is `Record<string, StoredAgentSkillConfig>` on the agent\n * snapshot. Each key is a stored skill ID and the value holds per-skill\n * overrides (description, instructions, pin, strategy).\n */\nexport function useAgentSkills({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: {\n updateSkills?: MastraMutationOptions<StoredAgentResponse, Record<string, StoredAgentSkillConfig> | undefined>;\n };\n} = {}) {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n const { data: agent } = useStoredAgent({ agentId, status: 'draft', queryOptions: { enabled: Boolean(agentId) } });\n\n const skills = useMemo((): Record<string, StoredAgentSkillConfig> => {\n if (!agent?.skills) return {};\n // Handle conditional field: if it's an array of variants, merge values\n if (Array.isArray(agent.skills)) {\n const merged: Record<string, StoredAgentSkillConfig> = {};\n for (const variant of agent.skills) {\n Object.assign(merged, variant.value);\n }\n return merged;\n }\n return agent.skills as Record<string, StoredAgentSkillConfig>;\n }, [agent?.skills]);\n\n const updateSkills = useMutation({\n mutationFn: (newSkills: Record<string, StoredAgentSkillConfig> | undefined) => {\n if (!agentId) throw new Error('agentId is required');\n const params: UpdateStoredAgentParams = { skills: newSkills };\n return client.getStoredAgent(agentId).update(params, requestContext);\n },\n onSuccess: () => {\n if (agentId) {\n void queryClient.invalidateQueries({ queryKey: ['stored-agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n }\n },\n ...queryOptions?.updateSkills,\n });\n\n return { skills, updateSkills };\n}\n","import type {\n ListAgentVersionsParams,\n CreateAgentVersionParams,\n ListAgentVersionsResponse,\n AgentVersionResponse,\n CompareVersionsResponse,\n ActivateAgentVersionResponse,\n DeleteAgentVersionResponse,\n} from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery, useMutation, useQueryClient, skipToken } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions, MastraQueryOptions } from '../shared/query-options';\n\nexport type { ListAgentVersionsParams, CreateAgentVersionParams };\n\ntype UseAgentVersionsParams<TData = ListAgentVersionsResponse> = {\n agentId?: string;\n params?: ListAgentVersionsParams;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<ListAgentVersionsResponse, TData>;\n};\n\n/**\n * Hook to list versions of a stored agent\n *\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useAgentVersions = <TData = ListAgentVersionsResponse>({\n agentId,\n params,\n requestContext,\n queryOptions,\n}: UseAgentVersionsParams<TData>): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery<ListAgentVersionsResponse, Error, TData>({\n queryKey: ['agent-versions', agentId, params, requestContext],\n queryFn: agentId ? () => client.getStoredAgent(agentId).listVersions(params, requestContext) : skipToken,\n ...queryOptions,\n });\n};\n\n/**\n * Hook to get a single version of a stored agent\n *\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useAgentVersion = <TData = AgentVersionResponse>({\n agentId,\n versionId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n versionId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<AgentVersionResponse, TData>;\n}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery<AgentVersionResponse, Error, TData>({\n queryKey: ['agent-version', agentId, versionId, requestContext],\n queryFn: () => client.getStoredAgent(agentId).getVersion(versionId, requestContext),\n ...queryOptions,\n });\n};\n\n/**\n * Hook to create a new version of a stored agent\n */\nexport const useCreateAgentVersion = ({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraMutationOptions<AgentVersionResponse, CreateAgentVersionParams | undefined>;\n}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<AgentVersionResponse, Error, CreateAgentVersionParams | undefined>({\n mutationFn: (params?: CreateAgentVersionParams) =>\n client.getStoredAgent(agentId).createVersion(params, requestContext),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n ...queryOptions,\n });\n};\n\n/**\n * Hook to activate a specific version of a stored agent\n */\nexport const useActivateAgentVersion = ({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraMutationOptions<ActivateAgentVersionResponse, string>;\n}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<ActivateAgentVersionResponse, Error, string>({\n mutationFn: (versionId: string) => client.getStoredAgent(agentId).activateVersion(versionId, requestContext),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n ...queryOptions,\n });\n};\n\n/**\n * Hook to restore a specific version of a stored agent (creates a new version from an old one)\n */\nexport const useRestoreAgentVersion = ({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraMutationOptions<AgentVersionResponse, string>;\n}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<AgentVersionResponse, Error, string>({\n mutationFn: (versionId: string) => client.getStoredAgent(agentId).restoreVersion(versionId, requestContext),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n ...queryOptions,\n });\n};\n\n/**\n * Hook to delete a specific version of a stored agent\n */\nexport const useDeleteAgentVersion = ({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraMutationOptions<DeleteAgentVersionResponse, string>;\n}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<DeleteAgentVersionResponse, Error, string>({\n mutationFn: (versionId: string) => client.getStoredAgent(agentId).deleteVersion(versionId, requestContext),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n },\n ...queryOptions,\n });\n};\n\n/**\n * Hook to compare two versions of a stored agent\n *\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useCompareAgentVersions = <TData = CompareVersionsResponse>({\n agentId,\n fromVersionId,\n toVersionId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n fromVersionId: string;\n toVersionId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<CompareVersionsResponse, TData>;\n}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery<CompareVersionsResponse, Error, TData>({\n queryKey: ['agent-versions-compare', agentId, fromVersionId, toVersionId, requestContext],\n queryFn: () => client.getStoredAgent(agentId).compareVersions(fromVersionId, toVersionId, requestContext),\n ...queryOptions,\n });\n};\n","import { useState, useEffect, useCallback, useRef } from 'react';\nimport { useMastraClient } from '../../mastra-client-context';\n\nfunction parseJsonString(jsonString: string): any {\n try {\n return JSON.stringify(JSON.parse(jsonString), null, 2);\n } catch {\n return jsonString;\n }\n}\n\nexport function useAgentWorkingMemory(\n agentId: string,\n threadId: string,\n resourceId: string,\n requestContext?: Record<string, any>,\n) {\n const client = useMastraClient();\n const [threadExists, setThreadExists] = useState(false);\n const [workingMemoryData, setWorkingMemoryData] = useState<string | null>(null);\n const [workingMemorySource, setWorkingMemorySource] = useState<'thread' | 'resource'>('thread');\n const [workingMemoryFormat, setWorkingMemoryFormat] = useState<'json' | 'markdown'>('markdown');\n const [isLoading, setIsLoading] = useState(true);\n const [isUpdating, setIsUpdating] = useState(false);\n const latestRequest = useRef(0);\n\n const refetch = useCallback(async () => {\n const requestId = ++latestRequest.current;\n setIsLoading(true);\n try {\n if (!agentId || !threadId) {\n setWorkingMemoryData(null);\n setIsLoading(false);\n return;\n }\n const res = await client.getWorkingMemory({ agentId, threadId, resourceId, requestContext });\n if (requestId !== latestRequest.current) return;\n const { workingMemory, source, workingMemoryTemplate, threadExists } = res as {\n workingMemory: string | null;\n source: 'thread' | 'resource';\n workingMemoryTemplate: { content: string; format: 'json' | 'markdown' };\n threadExists: boolean;\n };\n setThreadExists(threadExists);\n setWorkingMemoryData(workingMemory);\n setWorkingMemorySource(source);\n setWorkingMemoryFormat(workingMemoryTemplate?.format || 'markdown');\n if (workingMemoryTemplate?.format === 'json') {\n let dataToSet = '';\n if (workingMemory) {\n dataToSet = parseJsonString(workingMemory);\n } else if (workingMemoryTemplate?.content) {\n dataToSet = parseJsonString(workingMemoryTemplate.content);\n } else {\n dataToSet = '';\n }\n setWorkingMemoryData(dataToSet);\n } else {\n setWorkingMemoryData(workingMemory || workingMemoryTemplate?.content || '');\n }\n } catch (error) {\n if (requestId !== latestRequest.current) return;\n setWorkingMemoryData(null);\n console.error('Error fetching working memory', error);\n } finally {\n if (requestId === latestRequest.current) setIsLoading(false);\n }\n }, [agentId, threadId, resourceId, client, requestContext]);\n\n useEffect(() => {\n void refetch();\n }, [refetch]);\n\n const updateWorkingMemory = async (newMemory: string) => {\n setIsUpdating(true);\n try {\n if (workingMemoryFormat === 'json') {\n try {\n JSON.parse(newMemory);\n } catch {\n throw new Error('Invalid JSON working memory');\n }\n }\n await client.updateWorkingMemory({ agentId, threadId, workingMemory: newMemory, resourceId, requestContext });\n void refetch();\n } catch (error) {\n console.error('Error updating working memory', error);\n throw error;\n } finally {\n setIsUpdating(false);\n }\n };\n\n return {\n threadExists,\n workingMemoryData,\n workingMemorySource,\n workingMemoryFormat,\n isLoading,\n isUpdating,\n refetch,\n updateWorkingMemory,\n };\n}\n","import type { StoredAgentResponse, StoredWorkspaceRef, UpdateStoredAgentParams } from '@mastra/client-js';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { useMemo } from 'react';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions } from '../shared/query-options';\nimport { useStoredAgent } from './use-stored-agents';\n\n/**\n * Hook to read and mutate the workspace reference for a stored agent.\n *\n * The workspace ref is part of the agent snapshot config and can be:\n * - `{ type: 'id', workspaceId }` — references a stored workspace by ID\n * - `{ type: 'inline', config }` — inline workspace config\n * - `undefined` — no workspace assigned\n */\nexport function useAgentWorkspace({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: {\n updateWorkspace?: MastraMutationOptions<StoredAgentResponse, StoredWorkspaceRef | undefined>;\n };\n} = {}) {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n const { data: agent } = useStoredAgent({ agentId, status: 'draft', queryOptions: { enabled: Boolean(agentId) } });\n\n const workspace = useMemo((): StoredWorkspaceRef | undefined => {\n if (!agent?.workspace) return undefined;\n // Handle conditional field: if it's an array of variants, take the first value\n if (Array.isArray(agent.workspace)) {\n return agent.workspace[0]?.value as StoredWorkspaceRef | undefined;\n }\n return agent.workspace as StoredWorkspaceRef;\n }, [agent?.workspace]);\n\n const updateWorkspace = useMutation({\n mutationFn: (ref: StoredWorkspaceRef | undefined) => {\n if (!agentId) throw new Error('agentId is required');\n const params: UpdateStoredAgentParams = { workspace: ref };\n return client.getStoredAgent(agentId).update(params, requestContext);\n },\n onSuccess: () => {\n if (agentId) {\n void queryClient.invalidateQueries({ queryKey: ['stored-agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n }\n },\n ...queryOptions?.updateWorkspace,\n });\n\n return { workspace, updateWorkspace };\n}\n","import type { AgentVersionIdentifier, GetAgentResponse } from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\n/**\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useAgent = <TData = GetAgentResponse | null>({\n agentId,\n version,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n version?: AgentVersionIdentifier;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<GetAgentResponse | null, TData>;\n} = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['agent', agentId, version, requestContext],\n queryFn: () => (agentId ? client.getAgent(agentId, version).details(requestContext) : null),\n retry: false,\n ...queryOptions,\n });\n};\n","import type { MastraClient } from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\ntype AgentsModelProvidersResponse = Awaited<ReturnType<MastraClient['listAgentsModelProviders']>>;\n\nexport const useAgentsModelProviders = <TData = AgentsModelProvidersResponse>({\n queryOptions,\n}: { queryOptions?: MastraQueryOptions<AgentsModelProvidersResponse, TData> } = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['agents-model-providers'],\n queryFn: () => client.listAgentsModelProviders(),\n retry: false,\n ...queryOptions,\n });\n};\n","import type {\n MastraClient,\n ReorderModelListParams,\n UpdateModelInModelListParams,\n UpdateModelParams,\n} from '@mastra/client-js';\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport type { UseMutationResult, UseQueryResult } from '@tanstack/react-query';\n\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions, MastraQueryOptions } from '../shared/query-options';\n\ntype Agent = ReturnType<MastraClient['getAgent']>;\ntype ListAgentsResponse = Awaited<ReturnType<MastraClient['listAgents']>>;\nexport type ModelUpdateResponse = Awaited<ReturnType<Agent['updateModel']>>;\n\nexport const useAgents = <TData = ListAgentsResponse>({\n requestContext,\n queryOptions,\n}: {\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<ListAgentsResponse, TData>;\n} = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['agents', requestContext],\n queryFn: () => client.listAgents(requestContext),\n ...queryOptions,\n });\n};\n\nexport const useUpdateAgentModel = ({\n agentId,\n queryOptions,\n}: {\n agentId: string;\n queryOptions?: MastraMutationOptions<ModelUpdateResponse, UpdateModelParams>;\n}): UseMutationResult<ModelUpdateResponse, Error, UpdateModelParams> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async (payload: UpdateModelParams) => client.getAgent(agentId).updateModel(payload),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n onError: err => {\n console.error('Error updating model', err);\n },\n ...queryOptions,\n });\n};\n\nexport const useReorderModelList = ({\n agentId,\n queryOptions,\n}: {\n agentId: string;\n queryOptions?: MastraMutationOptions<ModelUpdateResponse, ReorderModelListParams>;\n}): UseMutationResult<ModelUpdateResponse, Error, ReorderModelListParams> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n const { onSuccess, onError, ...mutationOptions } = queryOptions ?? {};\n\n return useMutation({\n mutationFn: async (payload: ReorderModelListParams) => client.getAgent(agentId).reorderModelList(payload),\n ...mutationOptions,\n onSuccess: (...args) => {\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['stored-agent', agentId] });\n return onSuccess?.(...args);\n },\n onError: (...args) => {\n console.error('Error reordering model list', args[0]);\n return onError?.(...args);\n },\n });\n};\n\nexport const useUpdateModelInModelList = ({\n agentId,\n queryOptions,\n}: {\n agentId: string;\n queryOptions?: MastraMutationOptions<ModelUpdateResponse, UpdateModelInModelListParams>;\n}): UseMutationResult<ModelUpdateResponse, Error, UpdateModelInModelListParams> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n const { onSuccess, onError, ...mutationOptions } = queryOptions ?? {};\n\n return useMutation({\n mutationFn: async (payload: UpdateModelInModelListParams) =>\n client.getAgent(agentId).updateModelInModelList(payload),\n ...mutationOptions,\n onSuccess: (...args) => {\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['stored-agent', agentId] });\n return onSuccess?.(...args);\n },\n onError: (...args) => {\n console.error('Error updating model in model list', args[0]);\n return onError?.(...args);\n },\n });\n};\n\nexport const useResetAgentModel = ({\n agentId,\n queryOptions,\n}: {\n agentId: string;\n queryOptions?: MastraMutationOptions<ModelUpdateResponse, void>;\n}): UseMutationResult<ModelUpdateResponse, Error, void> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async () => client.getAgent(agentId).resetModel(),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n onError: err => {\n console.error('Error resetting model', err);\n },\n ...queryOptions,\n });\n};\n","import { useMutation } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions } from '../shared/query-options';\n\ninterface CloseBrowserParams {\n agentId: string;\n threadId?: string;\n}\n\n/**\n * Mutation hook for closing an agent's browser session.\n */\nexport function useCloseBrowser({\n queryOptions,\n}: { queryOptions?: MastraMutationOptions<{ success: boolean }, CloseBrowserParams> } = {}) {\n const client = useMastraClient();\n\n return useMutation<{ success: boolean }, Error, CloseBrowserParams>({\n mutationFn: ({ agentId, threadId }) => client.getAgent(agentId).closeBrowser(threadId),\n onError: err => {\n console.error('[useCloseBrowser] Error closing browser:', err);\n },\n ...queryOptions,\n });\n}\n","import type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\ninterface ApiInstructionBlock {\n type: string;\n content?: string;\n id?: string;\n /** Form-format ref blocks use `promptBlockId` instead of `id` */\n promptBlockId?: string;\n rules?: unknown;\n}\n\n/**\n * Normalize blocks to API format.\n * Form-format ref blocks have `{ type: 'prompt_block_ref', promptBlockId }`,\n * while API-format blocks have `{ type: 'prompt_block_ref', id }`.\n */\nfunction toApiBlocks(blocks: ApiInstructionBlock[]) {\n return blocks.map(block => {\n if (block.type === 'prompt_block_ref') {\n // Form-format blocks have `promptBlockId` (the storage ID) and `id` (form-internal UUID).\n // API-format blocks have `id` (the storage ID). Prefer promptBlockId when present.\n return { type: 'prompt_block_ref' as const, id: block.promptBlockId ?? block.id, rules: block.rules };\n }\n return { type: block.type, content: block.content, rules: block.rules };\n });\n}\n\n/**\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport function usePreviewInstructions<TData = string>({\n blocks,\n requestContext,\n queryOptions,\n}: {\n blocks: ApiInstructionBlock[] | undefined;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<string, TData>;\n}): UseQueryResult<TData, Error> {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['preview-instructions', blocks, requestContext],\n queryFn: async () => {\n if (!blocks || blocks.length === 0) return '';\n\n const response = await client.request<{ result: string }>('/stored/agents/preview-instructions', {\n method: 'POST',\n body: { blocks: toApiBlocks(blocks), context: requestContext },\n });\n\n return response.result;\n },\n ...queryOptions,\n });\n}\n","import type { MastraClient } from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\n\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\nexport type ListStoredSkillsResponse = Awaited<ReturnType<MastraClient['listStoredSkills']>>;\n\nexport function useStoredSkills<TData = ListStoredSkillsResponse>({\n queryOptions,\n}: { queryOptions?: MastraQueryOptions<ListStoredSkillsResponse, TData> } = {}): UseQueryResult<TData, Error> {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['stored-skills'],\n queryFn: () => client.listStoredSkills(),\n ...queryOptions,\n });\n}\n","import type { ChannelPlatformInfo, ChannelInstallationInfo, ChannelConnectResult } from '@mastra/client-js';\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport type { UseMutationResult, UseQueryResult } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions, MastraQueryOptions } from '../shared/query-options';\n\nexport type { ChannelPlatformInfo, ChannelInstallationInfo, ChannelConnectResult };\n\nexport const useChannelPlatforms = <TData = ChannelPlatformInfo[]>({\n queryOptions,\n}: { queryOptions?: MastraQueryOptions<ChannelPlatformInfo[], TData> } = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery<ChannelPlatformInfo[], Error, TData>({\n queryKey: ['channels', 'platforms'],\n queryFn: () => client.channels.listPlatforms(),\n staleTime: 60 * 1000,\n retry: false,\n ...queryOptions,\n });\n};\n\n/**\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useChannelInstallations = <TData = ChannelInstallationInfo[]>({\n platform,\n agentId,\n queryOptions,\n}: {\n platform: string;\n agentId: string;\n queryOptions?: MastraQueryOptions<ChannelInstallationInfo[], TData>;\n}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery<ChannelInstallationInfo[], Error, TData>({\n queryKey: ['channels', 'installations', platform, agentId],\n queryFn: () => client.channels.listInstallations(platform, agentId),\n staleTime: 10 * 1000,\n retry: false,\n ...queryOptions,\n });\n};\n\n/**\n * Reconcile an agent's installation with platform state — activates a pending\n * installation whose connect flow completed out-of-band (e.g. a Discord bot\n * invite finished in another tab). Resolves null on platforms without\n * reconciliation. Call it deliberately (e.g. on window focus while a connect\n * is in flight) — it is a write, not a read.\n */\nexport const useReconcileChannelInstallation = ({\n platform,\n queryOptions,\n}: {\n platform: string;\n queryOptions?: MastraMutationOptions<ChannelInstallationInfo | null, string>;\n}): UseMutationResult<ChannelInstallationInfo | null, Error, string> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<ChannelInstallationInfo | null, Error, string>({\n mutationFn: agentId => client.channels.reconcileInstallation(platform, agentId),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['channels', 'installations', platform] });\n },\n ...queryOptions,\n });\n};\n\nexport const useConnectChannel = ({\n platform,\n queryOptions,\n}: {\n platform: string;\n queryOptions?: MastraMutationOptions<ChannelConnectResult, { agentId: string; options?: Record<string, unknown> }>;\n}): UseMutationResult<ChannelConnectResult, Error, { agentId: string; options?: Record<string, unknown> }> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<ChannelConnectResult, Error, { agentId: string; options?: Record<string, unknown> }>({\n mutationFn: ({ agentId, options }) =>\n client.channels.connect(platform, agentId, {\n ...options,\n // Tell the server to redirect back here after OAuth\n redirectUrl: window.location.href,\n }),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['channels', 'installations', platform] });\n },\n ...queryOptions,\n });\n};\n\nexport const useDisconnectChannel = ({\n platform,\n queryOptions,\n}: {\n platform: string;\n queryOptions?: MastraMutationOptions<{ success: boolean }, string>;\n}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<{ success: boolean }, Error, string>({\n mutationFn: agentId => client.channels.disconnect(platform, agentId),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['channels', 'installations', platform] });\n },\n ...queryOptions,\n });\n};\n","import type { MastraClient } from '@mastra/client-js';\nimport { RequestContext } from '@mastra/core/di';\nimport { useMutation } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions } from '../shared/query-options';\n\ntype ExecuteAgentToolResponse = Awaited<ReturnType<ReturnType<MastraClient['getAgent']>['executeTool']>>;\n\nexport interface ExecuteToolInput {\n agentId: string;\n toolId: string;\n input: any;\n playgroundRequestContext?: Record<string, any>;\n}\n\nexport const useExecuteAgentTool = ({\n queryOptions,\n}: { queryOptions?: MastraMutationOptions<ExecuteAgentToolResponse, ExecuteToolInput> } = {}) => {\n const client = useMastraClient();\n return useMutation({\n mutationFn: async ({ agentId, toolId, input, playgroundRequestContext }: ExecuteToolInput) => {\n const requestContext = new RequestContext();\n Object.entries(playgroundRequestContext ?? {}).forEach(([key, value]) => {\n requestContext.set(key, value);\n });\n return client.getAgent(agentId).executeTool(toolId, { data: input, requestContext });\n },\n ...queryOptions,\n });\n};\n"],"mappings":";;;;;;AAmBA,MAAM,WAAW;AAEjB,MAAM,cAAc;AAEpB,MAAM,eAAe,YAA6B,IAAI,KAAK,QAAQ,SAAS,CAAC,CAAC,QAAQ;AAEtF,MAAM,eAAe,GAAoB,MAAuB,YAAY,CAAC,IAAI,YAAY,CAAC;AAE9F,MAAa,oBAA+C,EAC1D,UACA,SACA,QACA,gBACA,mBACkC;CAClC,MAAM,SAASA,8BAAAA,gBAAgB;CAE/B,QAAA,GAAOC,sBAAA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OAAO,+BAAiD;GAC5F,MAAM,iBAAiB,IAAIC,gBAAAA,eAAe;GAC1C,OAAO,QAAQ,4BAA4B,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;IACvE,eAAe,IAAI,KAAK,KAAK;GAC/B,CAAC;GACD,OAAO,OAAO,SAAS,OAAO,CAAC,CAAC,YAAY,QAAQ;IAAE,MAAM;IAAO;GAAe,CAAC;EACrF;EACA,GAAG;CACL,CAAC;AACH"}
|
|
@@ -696,15 +696,16 @@ function useAgentWorkspace({ agentId, requestContext, queryOptions } = {}) {
|
|
|
696
696
|
/**
|
|
697
697
|
* Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.
|
|
698
698
|
*/
|
|
699
|
-
const useAgent = ({ agentId, requestContext, queryOptions } = {}) => {
|
|
699
|
+
const useAgent = ({ agentId, version, requestContext, queryOptions } = {}) => {
|
|
700
700
|
const client = useMastraClient();
|
|
701
701
|
return useQuery({
|
|
702
702
|
queryKey: [
|
|
703
703
|
"agent",
|
|
704
704
|
agentId,
|
|
705
|
+
version,
|
|
705
706
|
requestContext
|
|
706
707
|
],
|
|
707
|
-
queryFn: () => agentId ? client.getAgent(agentId).details(requestContext) : null,
|
|
708
|
+
queryFn: () => agentId ? client.getAgent(agentId, version).details(requestContext) : null,
|
|
708
709
|
retry: false,
|
|
709
710
|
...queryOptions
|
|
710
711
|
});
|
|
@@ -745,29 +746,39 @@ const useUpdateAgentModel = ({ agentId, queryOptions }) => {
|
|
|
745
746
|
const useReorderModelList = ({ agentId, queryOptions }) => {
|
|
746
747
|
const client = useMastraClient();
|
|
747
748
|
const queryClient = useQueryClient();
|
|
749
|
+
const { onSuccess, onError, ...mutationOptions } = queryOptions ?? {};
|
|
748
750
|
return useMutation({
|
|
749
751
|
mutationFn: async (payload) => client.getAgent(agentId).reorderModelList(payload),
|
|
750
|
-
|
|
752
|
+
...mutationOptions,
|
|
753
|
+
onSuccess: (...args) => {
|
|
751
754
|
queryClient.invalidateQueries({ queryKey: ["agent", agentId] });
|
|
755
|
+
queryClient.invalidateQueries({ queryKey: ["agent-versions", agentId] });
|
|
756
|
+
queryClient.invalidateQueries({ queryKey: ["stored-agent", agentId] });
|
|
757
|
+
return onSuccess?.(...args);
|
|
752
758
|
},
|
|
753
|
-
onError: (
|
|
754
|
-
console.error("Error reordering model list",
|
|
755
|
-
|
|
756
|
-
|
|
759
|
+
onError: (...args) => {
|
|
760
|
+
console.error("Error reordering model list", args[0]);
|
|
761
|
+
return onError?.(...args);
|
|
762
|
+
}
|
|
757
763
|
});
|
|
758
764
|
};
|
|
759
765
|
const useUpdateModelInModelList = ({ agentId, queryOptions }) => {
|
|
760
766
|
const client = useMastraClient();
|
|
761
767
|
const queryClient = useQueryClient();
|
|
768
|
+
const { onSuccess, onError, ...mutationOptions } = queryOptions ?? {};
|
|
762
769
|
return useMutation({
|
|
763
770
|
mutationFn: async (payload) => client.getAgent(agentId).updateModelInModelList(payload),
|
|
764
|
-
|
|
771
|
+
...mutationOptions,
|
|
772
|
+
onSuccess: (...args) => {
|
|
765
773
|
queryClient.invalidateQueries({ queryKey: ["agent", agentId] });
|
|
774
|
+
queryClient.invalidateQueries({ queryKey: ["agent-versions", agentId] });
|
|
775
|
+
queryClient.invalidateQueries({ queryKey: ["stored-agent", agentId] });
|
|
776
|
+
return onSuccess?.(...args);
|
|
766
777
|
},
|
|
767
|
-
onError: (
|
|
768
|
-
console.error("Error updating model in model list",
|
|
769
|
-
|
|
770
|
-
|
|
778
|
+
onError: (...args) => {
|
|
779
|
+
console.error("Error updating model in model list", args[0]);
|
|
780
|
+
return onError?.(...args);
|
|
781
|
+
}
|
|
771
782
|
});
|
|
772
783
|
};
|
|
773
784
|
const useResetAgentModel = ({ agentId, queryOptions }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/agents/use-agent-messages.ts","../../../src/hooks/agents/use-agent-plan.ts","../../../src/hooks/agents/use-background-tasks.ts","../../../src/hooks/agents/use-browser-session-probe.ts","../../../src/hooks/agents/is-model-not-allowed.ts","../../../src/hooks/agents/use-stored-agents.ts","../../../src/hooks/agents/use-agent-skills.ts","../../../src/hooks/agents/use-agent-versions.ts","../../../src/hooks/agents/use-agent-working-memory.ts","../../../src/hooks/agents/use-agent-workspace.ts","../../../src/hooks/agents/use-agent.ts","../../../src/hooks/agents/use-agents-model-providers.ts","../../../src/hooks/agents/use-agents.ts","../../../src/hooks/agents/use-close-browser.ts","../../../src/hooks/agents/use-preview-instructions.ts","../../../src/hooks/agents/use-stored-skills.ts","../../../src/hooks/agents/use-channels.ts","../../../src/hooks/agents/use-execute-agent-tool.ts"],"sourcesContent":["import type { MastraClient } from '@mastra/client-js';\nimport type { MastraDBMessage } from '@mastra/core/agent/message-list';\nimport { skipToken, useInfiniteQuery } from '@tanstack/react-query';\nimport type { InfiniteData, QueryKey } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraInfiniteQueryOptions } from '../shared/query-options';\n\ntype AgentMessagesPage = Awaited<ReturnType<MastraClient['listThreadMessages']>>;\n\ntype AgentMessagesData = InfiniteData<AgentMessagesPage, string> & { messages: MastraDBMessage[] };\n\nexport interface UseAgentMessagesProps<TData = AgentMessagesData> {\n threadId?: string;\n agentId: string;\n memory: boolean;\n requestContext?: Record<string, any>;\n queryOptions?: MastraInfiniteQueryOptions<AgentMessagesPage, TData, QueryKey, string>;\n}\n\nconst PER_PAGE = 40;\n\nconst NEWEST_PAGE = '';\n\nconst createdAtMs = (message: MastraDBMessage) => new Date(message.createdAt).getTime();\n\nconst byCreatedAt = (a: MastraDBMessage, b: MastraDBMessage) => createdAtMs(a) - createdAtMs(b);\n\nexport const useAgentMessages = <TData = AgentMessagesData>({\n threadId,\n agentId,\n memory,\n requestContext,\n queryOptions,\n}: UseAgentMessagesProps<TData>) => {\n const client = useMastraClient();\n\n return useInfiniteQuery({\n queryKey: ['memory', 'messages', threadId, agentId, requestContext],\n initialPageParam: NEWEST_PAGE,\n queryFn:\n memory && threadId\n ? ({ pageParam: olderThan }) =>\n client.listThreadMessages(threadId, {\n agentId,\n requestContext,\n includeSystemReminders: true,\n perPage: PER_PAGE,\n orderBy: { field: 'createdAt', direction: 'DESC' },\n // Inclusive bound: messages sharing the oldest createdAt of the previous page\n // may have been cut off by perPage, so re-ask for them and dedupe by id below.\n filter: olderThan ? { dateRange: { end: new Date(olderThan) } } : undefined,\n })\n : skipToken,\n getNextPageParam: (lastPage, _allPages, lastPageParam) => {\n if (!lastPage.hasMore || lastPage.messages.length === 0) return undefined;\n const next = new Date(Math.min(...lastPage.messages.map(createdAtMs))).toISOString();\n // A full page of same-timestamp messages would re-request itself forever.\n return next === lastPageParam ? undefined : next;\n },\n select: (data): TData => {\n const seen = new Set<string>();\n const messages = data.pages\n .flatMap(page => page.messages)\n .filter(message => {\n if (seen.has(message.id)) return false;\n seen.add(message.id);\n return true;\n })\n .sort(byCreatedAt);\n return { ...data, messages } as AgentMessagesData as TData;\n },\n staleTime: 0,\n gcTime: 0,\n retry: false,\n refetchOnWindowFocus: false,\n ...queryOptions,\n });\n};\n","import type { MastraClient } from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\ntype AgentPlanResponse = Awaited<ReturnType<ReturnType<MastraClient['getAgent']>['readPlan']>>;\n\ninterface UseAgentPlanOptions<TData> {\n agentId: string;\n path: string;\n agentVersionId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<AgentPlanResponse, TData>;\n}\n\nexport function useAgentPlan<TData = AgentPlanResponse>({\n agentId,\n path,\n agentVersionId,\n requestContext,\n queryOptions,\n}: UseAgentPlanOptions<TData>): UseQueryResult<TData, Error> {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['agent-plan', agentId, agentVersionId, path, requestContext],\n queryFn: () => {\n const agent = agentVersionId ? client.getAgent(agentId, { versionId: agentVersionId }) : client.getAgent(agentId);\n return agent.readPlan(path, requestContext);\n },\n retry: false,\n ...queryOptions,\n });\n}\n","import type { MastraClient, StreamBackgroundTasksParams } from '@mastra/client-js';\nimport type { BackgroundTaskStatus } from '@mastra/core/background-tasks';\nimport type { AgentChunkType } from '@mastra/core/stream';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\ntype BackgroundTaskStreamReader = ReturnType<Awaited<ReturnType<MastraClient['streamBackgroundTasks']>>['getReader']>;\n\nexport interface BackgroundTaskEvent {\n taskId: string;\n toolName: string;\n toolCallId: string;\n agentId: string;\n runId: string;\n result?: unknown;\n error?: { message: string; stack?: string };\n status: BackgroundTaskStatus;\n args: Record<string, unknown>;\n suspendPayload?: unknown;\n}\n\nexport interface UseBackgroundTaskStreamOptions extends StreamBackgroundTasksParams {\n /** Whether the stream is active. Default: true */\n enabled?: boolean;\n}\n\nexport interface UseBackgroundTaskStreamReturn {\n /** Map of taskId → latest event data */\n tasks: Record<string, BackgroundTaskEvent>;\n /** Whether the stream is currently connected */\n isConnected: boolean;\n /** Any connection error */\n error: Error | null;\n /** Manually disconnect the stream */\n disconnect: () => void;\n /** Manually reconnect the stream */\n reconnect: () => void;\n /** List of running tasks */\n runningTasks: BackgroundTaskEvent[];\n /** List of completed tasks */\n completedTasks: BackgroundTaskEvent[];\n /** List of failed tasks */\n failedTasks: BackgroundTaskEvent[];\n /** Clear completed and failed tasks */\n clearCompletedAndFailedTasks: () => void;\n}\n\n/**\n * Streams background task events via SSE and accumulates them in a map keyed by taskId.\n *\n * Each incoming event (task.completed / task.failed) is stored in state so the UI\n * can react to completions — e.g., show a toast, update a badge, or display results.\n *\n * @example\n * ```tsx\n * const { tasks, isConnected, completedTasks } = useBackgroundTaskStream({ agentId: 'crypto-agent' });\n *\n * // Show a badge with completed count\n * const completedCount = completedTasks.length;\n * ```\n */\n\ntype EventType = Extract<\n AgentChunkType,\n {\n type:\n | 'background-task-running'\n | 'background-task-completed'\n | 'background-task-failed'\n | 'background-task-cancelled'\n | 'background-task-output'\n | 'background-task-suspended'\n | 'background-task-resumed';\n }\n>;\n\nconst EVENT_STATUS_MAP: Record<EventType['type'], BackgroundTaskStatus> = {\n 'background-task-running': 'running',\n 'background-task-output': 'running',\n 'background-task-completed': 'completed',\n 'background-task-failed': 'failed',\n 'background-task-cancelled': 'cancelled',\n 'background-task-suspended': 'suspended',\n 'background-task-resumed': 'running',\n};\n\nexport function useBackgroundTaskStream(options: UseBackgroundTaskStreamOptions = {}): UseBackgroundTaskStreamReturn {\n const { enabled = true, agentId, runId, threadId, resourceId, taskId } = options;\n const client = useMastraClient();\n\n const [tasks, setTasks] = useState<Record<string, BackgroundTaskEvent>>({});\n const [isConnected, setIsConnected] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n const abortRef = useRef<AbortController | null>(null);\n const readerRef = useRef<BackgroundTaskStreamReader | null>(null);\n const connectSeqRef = useRef(0);\n\n const runningTasks = useMemo(() => {\n return Object.values(tasks).filter(task => task.status === 'running');\n }, [tasks]);\n\n const completedTasks = useMemo(() => {\n return Object.values(tasks).filter(task => task.status === 'completed');\n }, [tasks]);\n\n const failedTasks = useMemo(() => {\n return Object.values(tasks).filter(task => task.status === 'failed');\n }, [tasks]);\n\n const cleanup = useCallback(() => {\n readerRef.current?.cancel().catch(() => {});\n readerRef.current = null;\n abortRef.current?.abort();\n abortRef.current = null;\n setIsConnected(false);\n }, []);\n\n const connect = useCallback(async () => {\n const seq = ++connectSeqRef.current;\n cleanup();\n setError(null);\n\n const controller = new AbortController();\n abortRef.current = controller;\n\n try {\n const stream = await client.streamBackgroundTasks({ agentId, runId, threadId, resourceId, taskId });\n\n if (!stream) {\n setError(new Error('Stream connection failed'));\n return;\n }\n\n if (seq === connectSeqRef.current) {\n setIsConnected(true);\n }\n\n // Get a reader from the ReadableStream and store it in ref\n const reader = stream.getReader();\n readerRef.current = reader;\n\n while (!controller.signal.aborted) {\n const { done, value } = await reader.read();\n if (done) break;\n\n const event = value as EventType;\n if (event.type !== 'background-task-output') {\n setTasks(prev => ({\n ...prev,\n [event.payload.taskId]: {\n ...prev[event.payload.taskId],\n ...event.payload,\n status: EVENT_STATUS_MAP[event.type],\n args:\n ('args' in event.payload ? event.payload.args : undefined) ?? prev[event.payload.taskId]?.args ?? {},\n },\n }));\n }\n }\n } catch (err: any) {\n if (err?.name !== 'AbortError') {\n if (seq === connectSeqRef.current) {\n setError(err instanceof Error ? err : new Error(String(err)));\n }\n }\n } finally {\n if (seq === connectSeqRef.current) {\n setIsConnected(false);\n }\n }\n }, [client, agentId, runId, threadId, resourceId, taskId, cleanup]);\n\n useEffect(() => {\n if (!enabled) {\n cleanup();\n return;\n }\n\n void connect();\n return cleanup;\n }, [enabled, connect, cleanup]);\n\n const disconnect = useCallback(() => {\n cleanup();\n }, [cleanup]);\n\n const reconnect = useCallback(() => {\n void connect();\n }, [connect]);\n\n const clearCompletedAndFailedTasks = () => {\n setTasks(prev => {\n const newTasks = { ...prev };\n Object.values(newTasks).forEach(task => {\n if (\n task.status === 'completed' ||\n task.status === 'failed' ||\n task.status === 'cancelled' ||\n task.status === 'timed_out'\n ) {\n delete newTasks[task.taskId];\n }\n });\n return newTasks;\n });\n };\n\n return {\n tasks,\n isConnected,\n error,\n disconnect,\n reconnect,\n runningTasks,\n completedTasks,\n failedTasks,\n clearCompletedAndFailedTasks,\n };\n}\n\ntype BackgroundTaskResponse = Awaited<ReturnType<MastraClient['getBackgroundTask']>>;\n\nexport const useGetBackgroundTaskById = <TData = BackgroundTaskResponse>({\n backgroundTaskId,\n queryOptions,\n}: {\n backgroundTaskId: string;\n queryOptions?: MastraQueryOptions<BackgroundTaskResponse, TData>;\n}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n return useQuery({\n queryKey: ['background-task', backgroundTaskId],\n queryFn: () => client.getBackgroundTask(backgroundTaskId),\n ...queryOptions,\n });\n};\n","import type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\nexport interface BrowserSessionProbe {\n hasSession: boolean;\n screencastAvailable: boolean;\n}\n\ninterface UseBrowserSessionProbeOptions<TData> {\n agentId?: string;\n threadId?: string;\n /** TanStack overrides spread last, e.g. `{ enabled: false }` for agents without browser tools. */\n queryOptions?: MastraQueryOptions<BrowserSessionProbe, TData>;\n}\n\nexport const browserSessionProbeQueryKey = (agentId?: string, threadId?: string) =>\n ['browser-session-probe', agentId, threadId] as const;\n\nconst LEGACY_FALLBACK: BrowserSessionProbe = { hasSession: true, screencastAvailable: true };\n\nconst isNotFoundError = (error: unknown): boolean => {\n if (!error || typeof error !== 'object') return false;\n if ('status' in error && (error as { status: unknown }).status === 404) return true;\n if ('statusCode' in error && (error as { statusCode: unknown }).statusCode === 404) return true;\n return false;\n};\n\n/**\n * Query hook that probes the server for the agent's browser session state.\n *\n * Used by {@link BrowserSessionProvider} to decide whether to open a screencast\n * WebSocket. The probe avoids two failure modes:\n *\n * 1. `screencastAvailable: false` — the server doesn't have `ws` / `@hono/node-ws`\n * installed (or the route was never registered). Opening a WS would fail and\n * trigger a reconnect loop.\n * 2. `hasSession: false` — no active browser session for this thread yet. Opening\n * a WS would succeed but sit idle, holding resources for no reason.\n *\n * When the endpoint itself returns 404 (older server that predates this probe),\n * the hook assumes screencast is available and a session is active so behavior\n * matches the legacy unconditional connect.\n *\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport function useBrowserSessionProbe<TData = BrowserSessionProbe>({\n agentId,\n threadId,\n queryOptions,\n}: UseBrowserSessionProbeOptions<TData>): UseQueryResult<TData, Error> {\n const client = useMastraClient();\n\n return useQuery<BrowserSessionProbe, Error, TData>({\n queryKey: browserSessionProbeQueryKey(agentId, threadId),\n queryFn: async () => {\n if (!agentId) {\n return { hasSession: false, screencastAvailable: false };\n }\n\n try {\n return await client.getAgent(agentId).browserSession(threadId);\n } catch (error) {\n if (isNotFoundError(error)) {\n // Older server without the probe endpoint — fall back to legacy behavior.\n return LEGACY_FALLBACK;\n }\n throw error;\n }\n },\n // No polling: the probe fires once on mount, on window focus, and is\n // updated via `setQueriesData` from `tool-fallback.tsx` when a browser\n // tool call transitions. This avoids idle 5s polls and lets the probe\n // flip to `hasSession: true` the instant a tool call is seen.\n refetchOnWindowFocus: true,\n staleTime: 0,\n retry: 1,\n ...queryOptions,\n });\n}\n","/**\n * The wire-level error code the server emits on a 422 when a model is blocked\n * by the admin's builder policy. Kept as a local literal so the browser bundle\n * never imports server-only agent-builder EE code.\n */\nconst MODEL_NOT_ALLOWED_CODE = 'MODEL_NOT_ALLOWED';\n\nexport interface ModelNotAllowedDetails {\n message: string;\n attempted?: { provider?: string; modelId?: string };\n offendingLabel?: string;\n}\n\n/**\n * Detects HTTP 422 + MODEL_NOT_ALLOWED responses thrown by `MastraClientError`\n * (or any error carrying `status` + `body.error.code`). Returns the parsed\n * details when matched, or `null` otherwise.\n */\nexport function isModelNotAllowedError(err: unknown): ModelNotAllowedDetails | null {\n if (!err || typeof err !== 'object') return null;\n const candidate = err as { status?: number; body?: unknown; message?: string };\n if (candidate.status !== 422) return null;\n const body = candidate.body as { error?: { code?: unknown } } | undefined;\n const code = body?.error?.code;\n if (code !== MODEL_NOT_ALLOWED_CODE) return null;\n const errorBody = body!.error as {\n message?: string;\n attempted?: { provider?: string; modelId?: string };\n offendingLabel?: string;\n };\n return {\n message: errorBody.message || candidate.message || 'Model not allowed by admin policy',\n attempted: errorBody.attempted,\n offendingLabel: errorBody.offendingLabel,\n };\n}\n","import type {\n CreateStoredAgentParams,\n UpdateStoredAgentParams,\n ListStoredAgentsParams,\n StoredAgentResponse,\n ListStoredAgentsResponse,\n StoredAgentDependentsResponse,\n DeleteStoredAgentResponse,\n} from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions, MastraQueryOptions } from '../shared/query-options';\nimport { isModelNotAllowedError } from './is-model-not-allowed';\n\nexport const useStoredAgents = <TData = ListStoredAgentsResponse>({\n queryOptions,\n ...params\n}: ListStoredAgentsParams & {\n queryOptions?: MastraQueryOptions<ListStoredAgentsResponse, TData>;\n} = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n const listParams = Object.keys(params).length > 0 ? params : undefined;\n\n return useQuery({\n queryKey: ['stored-agents', listParams],\n queryFn: () => client.listStoredAgents(listParams),\n ...queryOptions,\n });\n};\n\n/**\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useStoredAgent = <TData = StoredAgentResponse | null>({\n agentId,\n status,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n status?: 'draft' | 'published';\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<StoredAgentResponse | null, TData>;\n} = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['stored-agent', agentId, status, requestContext],\n queryFn: async () => {\n if (!agentId) return null;\n try {\n return await client.getStoredAgent(agentId).details(requestContext, { status });\n } catch (error) {\n // 404 is expected for code-only agents that haven't been stored yet\n if (error && typeof error === 'object' && 'status' in error && (error as { status: number }).status === 404) {\n return null;\n }\n throw error;\n }\n },\n retry: false,\n ...queryOptions,\n });\n};\n\nexport type StoredAgent = StoredAgentResponse;\n\n/**\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useStoredAgentDependents = <TData = StoredAgentDependentsResponse>({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<StoredAgentDependentsResponse, TData>;\n} = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['stored-agent-dependents', agentId, requestContext],\n queryFn: () => client.getStoredAgent(agentId!).dependents(requestContext),\n retry: false,\n ...queryOptions,\n });\n};\n\nexport const useStoredAgentMutations = ({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: {\n createStoredAgent?: MastraMutationOptions<StoredAgentResponse, CreateStoredAgentParams>;\n updateStoredAgent?: MastraMutationOptions<StoredAgentResponse, UpdateStoredAgentParams>;\n deleteStoredAgent?: MastraMutationOptions<DeleteStoredAgentResponse, void>;\n };\n} = {}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n // If the server rejects with HTTP 422 + MODEL_NOT_ALLOWED the admin policy\n // has likely changed under us — refresh the cached settings so the UI\n // re-renders against the latest server truth.\n const invalidateBuilderSettingsOnPolicyReject = (err: unknown) => {\n if (isModelNotAllowedError(err)) {\n void queryClient.invalidateQueries({ queryKey: ['builder-settings'] });\n }\n };\n\n const createMutation = useMutation({\n mutationFn: (params: CreateStoredAgentParams) => client.createStoredAgent(params),\n onSuccess: created => {\n // Prime the per-agent details cache with the response so the next page\n // (the edit page) can render the agent on first paint without a refetch.\n // The starter relies on this to immediately mount the conversation panel\n // and dispatch the user's initial message.\n queryClient.setQueryData(['stored-agent', created.id, 'draft', requestContext], created);\n queryClient.setQueryData(['stored-agent', created.id, undefined, requestContext], created);\n // Invalidate both stored-agents list and the merged agents list\n void queryClient.invalidateQueries({ queryKey: ['stored-agents'] });\n void queryClient.invalidateQueries({ queryKey: ['agents'] });\n // Invalidate the merged agent details so the freshly-created id resolves\n // instead of staying stuck on the initial `null` from the 404 lookup.\n void queryClient.invalidateQueries({ queryKey: ['agent', created.id] });\n },\n onError: invalidateBuilderSettingsOnPolicyReject,\n ...queryOptions?.createStoredAgent,\n });\n\n const updateMutation = useMutation({\n mutationFn: (params: UpdateStoredAgentParams) => {\n if (!agentId) throw new Error('agentId is required for update');\n return client.getStoredAgent(agentId).update(params, requestContext);\n },\n onSuccess: () => {\n // Invalidate lists\n void queryClient.invalidateQueries({ queryKey: ['stored-agents'] });\n void queryClient.invalidateQueries({ queryKey: ['agents'] });\n // Invalidate specific agent details\n if (agentId) {\n void queryClient.invalidateQueries({ queryKey: ['stored-agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n }\n },\n onError: invalidateBuilderSettingsOnPolicyReject,\n ...queryOptions?.updateStoredAgent,\n });\n\n const deleteMutation = useMutation({\n mutationFn: () => {\n if (!agentId) throw new Error('agentId is required for delete');\n return client.getStoredAgent(agentId).delete(requestContext);\n },\n onSuccess: () => {\n // Invalidate lists so the agents list page refetches without the deleted entry\n void queryClient.invalidateQueries({ queryKey: ['stored-agents'] });\n void queryClient.invalidateQueries({ queryKey: ['agents'] });\n // Drop the deleted entity from the cache so active observers don't refetch a 404\n if (agentId) {\n queryClient.removeQueries({ queryKey: ['stored-agent', agentId] });\n queryClient.removeQueries({ queryKey: ['agent', agentId] });\n }\n },\n ...queryOptions?.deleteStoredAgent,\n });\n\n return {\n createStoredAgent: createMutation,\n updateStoredAgent: updateMutation,\n deleteStoredAgent: deleteMutation,\n };\n};\n","import type { StoredAgentResponse, StoredAgentSkillConfig, UpdateStoredAgentParams } from '@mastra/client-js';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { useMemo } from 'react';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions } from '../shared/query-options';\nimport { useStoredAgent } from './use-stored-agents';\n\n/**\n * Hook to read and mutate the skills config for a stored agent.\n *\n * The skills field is `Record<string, StoredAgentSkillConfig>` on the agent\n * snapshot. Each key is a stored skill ID and the value holds per-skill\n * overrides (description, instructions, pin, strategy).\n */\nexport function useAgentSkills({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: {\n updateSkills?: MastraMutationOptions<StoredAgentResponse, Record<string, StoredAgentSkillConfig> | undefined>;\n };\n} = {}) {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n const { data: agent } = useStoredAgent({ agentId, status: 'draft', queryOptions: { enabled: Boolean(agentId) } });\n\n const skills = useMemo((): Record<string, StoredAgentSkillConfig> => {\n if (!agent?.skills) return {};\n // Handle conditional field: if it's an array of variants, merge values\n if (Array.isArray(agent.skills)) {\n const merged: Record<string, StoredAgentSkillConfig> = {};\n for (const variant of agent.skills) {\n Object.assign(merged, variant.value);\n }\n return merged;\n }\n return agent.skills as Record<string, StoredAgentSkillConfig>;\n }, [agent?.skills]);\n\n const updateSkills = useMutation({\n mutationFn: (newSkills: Record<string, StoredAgentSkillConfig> | undefined) => {\n if (!agentId) throw new Error('agentId is required');\n const params: UpdateStoredAgentParams = { skills: newSkills };\n return client.getStoredAgent(agentId).update(params, requestContext);\n },\n onSuccess: () => {\n if (agentId) {\n void queryClient.invalidateQueries({ queryKey: ['stored-agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n }\n },\n ...queryOptions?.updateSkills,\n });\n\n return { skills, updateSkills };\n}\n","import type {\n ListAgentVersionsParams,\n CreateAgentVersionParams,\n ListAgentVersionsResponse,\n AgentVersionResponse,\n CompareVersionsResponse,\n ActivateAgentVersionResponse,\n DeleteAgentVersionResponse,\n} from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery, useMutation, useQueryClient, skipToken } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions, MastraQueryOptions } from '../shared/query-options';\n\nexport type { ListAgentVersionsParams, CreateAgentVersionParams };\n\ntype UseAgentVersionsParams<TData = ListAgentVersionsResponse> = {\n agentId?: string;\n params?: ListAgentVersionsParams;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<ListAgentVersionsResponse, TData>;\n};\n\n/**\n * Hook to list versions of a stored agent\n *\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useAgentVersions = <TData = ListAgentVersionsResponse>({\n agentId,\n params,\n requestContext,\n queryOptions,\n}: UseAgentVersionsParams<TData>): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery<ListAgentVersionsResponse, Error, TData>({\n queryKey: ['agent-versions', agentId, params, requestContext],\n queryFn: agentId ? () => client.getStoredAgent(agentId).listVersions(params, requestContext) : skipToken,\n ...queryOptions,\n });\n};\n\n/**\n * Hook to get a single version of a stored agent\n *\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useAgentVersion = <TData = AgentVersionResponse>({\n agentId,\n versionId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n versionId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<AgentVersionResponse, TData>;\n}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery<AgentVersionResponse, Error, TData>({\n queryKey: ['agent-version', agentId, versionId, requestContext],\n queryFn: () => client.getStoredAgent(agentId).getVersion(versionId, requestContext),\n ...queryOptions,\n });\n};\n\n/**\n * Hook to create a new version of a stored agent\n */\nexport const useCreateAgentVersion = ({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraMutationOptions<AgentVersionResponse, CreateAgentVersionParams | undefined>;\n}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<AgentVersionResponse, Error, CreateAgentVersionParams | undefined>({\n mutationFn: (params?: CreateAgentVersionParams) =>\n client.getStoredAgent(agentId).createVersion(params, requestContext),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n ...queryOptions,\n });\n};\n\n/**\n * Hook to activate a specific version of a stored agent\n */\nexport const useActivateAgentVersion = ({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraMutationOptions<ActivateAgentVersionResponse, string>;\n}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<ActivateAgentVersionResponse, Error, string>({\n mutationFn: (versionId: string) => client.getStoredAgent(agentId).activateVersion(versionId, requestContext),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n ...queryOptions,\n });\n};\n\n/**\n * Hook to restore a specific version of a stored agent (creates a new version from an old one)\n */\nexport const useRestoreAgentVersion = ({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraMutationOptions<AgentVersionResponse, string>;\n}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<AgentVersionResponse, Error, string>({\n mutationFn: (versionId: string) => client.getStoredAgent(agentId).restoreVersion(versionId, requestContext),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n ...queryOptions,\n });\n};\n\n/**\n * Hook to delete a specific version of a stored agent\n */\nexport const useDeleteAgentVersion = ({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraMutationOptions<DeleteAgentVersionResponse, string>;\n}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<DeleteAgentVersionResponse, Error, string>({\n mutationFn: (versionId: string) => client.getStoredAgent(agentId).deleteVersion(versionId, requestContext),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n },\n ...queryOptions,\n });\n};\n\n/**\n * Hook to compare two versions of a stored agent\n *\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useCompareAgentVersions = <TData = CompareVersionsResponse>({\n agentId,\n fromVersionId,\n toVersionId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n fromVersionId: string;\n toVersionId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<CompareVersionsResponse, TData>;\n}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery<CompareVersionsResponse, Error, TData>({\n queryKey: ['agent-versions-compare', agentId, fromVersionId, toVersionId, requestContext],\n queryFn: () => client.getStoredAgent(agentId).compareVersions(fromVersionId, toVersionId, requestContext),\n ...queryOptions,\n });\n};\n","import { useState, useEffect, useCallback, useRef } from 'react';\nimport { useMastraClient } from '../../mastra-client-context';\n\nfunction parseJsonString(jsonString: string): any {\n try {\n return JSON.stringify(JSON.parse(jsonString), null, 2);\n } catch {\n return jsonString;\n }\n}\n\nexport function useAgentWorkingMemory(\n agentId: string,\n threadId: string,\n resourceId: string,\n requestContext?: Record<string, any>,\n) {\n const client = useMastraClient();\n const [threadExists, setThreadExists] = useState(false);\n const [workingMemoryData, setWorkingMemoryData] = useState<string | null>(null);\n const [workingMemorySource, setWorkingMemorySource] = useState<'thread' | 'resource'>('thread');\n const [workingMemoryFormat, setWorkingMemoryFormat] = useState<'json' | 'markdown'>('markdown');\n const [isLoading, setIsLoading] = useState(true);\n const [isUpdating, setIsUpdating] = useState(false);\n const latestRequest = useRef(0);\n\n const refetch = useCallback(async () => {\n const requestId = ++latestRequest.current;\n setIsLoading(true);\n try {\n if (!agentId || !threadId) {\n setWorkingMemoryData(null);\n setIsLoading(false);\n return;\n }\n const res = await client.getWorkingMemory({ agentId, threadId, resourceId, requestContext });\n if (requestId !== latestRequest.current) return;\n const { workingMemory, source, workingMemoryTemplate, threadExists } = res as {\n workingMemory: string | null;\n source: 'thread' | 'resource';\n workingMemoryTemplate: { content: string; format: 'json' | 'markdown' };\n threadExists: boolean;\n };\n setThreadExists(threadExists);\n setWorkingMemoryData(workingMemory);\n setWorkingMemorySource(source);\n setWorkingMemoryFormat(workingMemoryTemplate?.format || 'markdown');\n if (workingMemoryTemplate?.format === 'json') {\n let dataToSet = '';\n if (workingMemory) {\n dataToSet = parseJsonString(workingMemory);\n } else if (workingMemoryTemplate?.content) {\n dataToSet = parseJsonString(workingMemoryTemplate.content);\n } else {\n dataToSet = '';\n }\n setWorkingMemoryData(dataToSet);\n } else {\n setWorkingMemoryData(workingMemory || workingMemoryTemplate?.content || '');\n }\n } catch (error) {\n if (requestId !== latestRequest.current) return;\n setWorkingMemoryData(null);\n console.error('Error fetching working memory', error);\n } finally {\n if (requestId === latestRequest.current) setIsLoading(false);\n }\n }, [agentId, threadId, resourceId, client, requestContext]);\n\n useEffect(() => {\n void refetch();\n }, [refetch]);\n\n const updateWorkingMemory = async (newMemory: string) => {\n setIsUpdating(true);\n try {\n if (workingMemoryFormat === 'json') {\n try {\n JSON.parse(newMemory);\n } catch {\n throw new Error('Invalid JSON working memory');\n }\n }\n await client.updateWorkingMemory({ agentId, threadId, workingMemory: newMemory, resourceId, requestContext });\n void refetch();\n } catch (error) {\n console.error('Error updating working memory', error);\n throw error;\n } finally {\n setIsUpdating(false);\n }\n };\n\n return {\n threadExists,\n workingMemoryData,\n workingMemorySource,\n workingMemoryFormat,\n isLoading,\n isUpdating,\n refetch,\n updateWorkingMemory,\n };\n}\n","import type { StoredAgentResponse, StoredWorkspaceRef, UpdateStoredAgentParams } from '@mastra/client-js';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { useMemo } from 'react';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions } from '../shared/query-options';\nimport { useStoredAgent } from './use-stored-agents';\n\n/**\n * Hook to read and mutate the workspace reference for a stored agent.\n *\n * The workspace ref is part of the agent snapshot config and can be:\n * - `{ type: 'id', workspaceId }` — references a stored workspace by ID\n * - `{ type: 'inline', config }` — inline workspace config\n * - `undefined` — no workspace assigned\n */\nexport function useAgentWorkspace({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: {\n updateWorkspace?: MastraMutationOptions<StoredAgentResponse, StoredWorkspaceRef | undefined>;\n };\n} = {}) {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n const { data: agent } = useStoredAgent({ agentId, status: 'draft', queryOptions: { enabled: Boolean(agentId) } });\n\n const workspace = useMemo((): StoredWorkspaceRef | undefined => {\n if (!agent?.workspace) return undefined;\n // Handle conditional field: if it's an array of variants, take the first value\n if (Array.isArray(agent.workspace)) {\n return agent.workspace[0]?.value as StoredWorkspaceRef | undefined;\n }\n return agent.workspace as StoredWorkspaceRef;\n }, [agent?.workspace]);\n\n const updateWorkspace = useMutation({\n mutationFn: (ref: StoredWorkspaceRef | undefined) => {\n if (!agentId) throw new Error('agentId is required');\n const params: UpdateStoredAgentParams = { workspace: ref };\n return client.getStoredAgent(agentId).update(params, requestContext);\n },\n onSuccess: () => {\n if (agentId) {\n void queryClient.invalidateQueries({ queryKey: ['stored-agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n }\n },\n ...queryOptions?.updateWorkspace,\n });\n\n return { workspace, updateWorkspace };\n}\n","import type { GetAgentResponse } from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\n/**\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useAgent = <TData = GetAgentResponse | null>({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<GetAgentResponse | null, TData>;\n} = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['agent', agentId, requestContext],\n queryFn: () => (agentId ? client.getAgent(agentId).details(requestContext) : null),\n retry: false,\n ...queryOptions,\n });\n};\n","import type { MastraClient } from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\ntype AgentsModelProvidersResponse = Awaited<ReturnType<MastraClient['listAgentsModelProviders']>>;\n\nexport const useAgentsModelProviders = <TData = AgentsModelProvidersResponse>({\n queryOptions,\n}: { queryOptions?: MastraQueryOptions<AgentsModelProvidersResponse, TData> } = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['agents-model-providers'],\n queryFn: () => client.listAgentsModelProviders(),\n retry: false,\n ...queryOptions,\n });\n};\n","import type {\n MastraClient,\n ReorderModelListParams,\n UpdateModelInModelListParams,\n UpdateModelParams,\n} from '@mastra/client-js';\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport type { UseMutationResult, UseQueryResult } from '@tanstack/react-query';\n\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions, MastraQueryOptions } from '../shared/query-options';\n\ntype Agent = ReturnType<MastraClient['getAgent']>;\ntype ListAgentsResponse = Awaited<ReturnType<MastraClient['listAgents']>>;\nexport type ModelUpdateResponse = Awaited<ReturnType<Agent['updateModel']>>;\n\nexport const useAgents = <TData = ListAgentsResponse>({\n requestContext,\n queryOptions,\n}: {\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<ListAgentsResponse, TData>;\n} = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['agents', requestContext],\n queryFn: () => client.listAgents(requestContext),\n ...queryOptions,\n });\n};\n\nexport const useUpdateAgentModel = ({\n agentId,\n queryOptions,\n}: {\n agentId: string;\n queryOptions?: MastraMutationOptions<ModelUpdateResponse, UpdateModelParams>;\n}): UseMutationResult<ModelUpdateResponse, Error, UpdateModelParams> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async (payload: UpdateModelParams) => client.getAgent(agentId).updateModel(payload),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n onError: err => {\n console.error('Error updating model', err);\n },\n ...queryOptions,\n });\n};\n\nexport const useReorderModelList = ({\n agentId,\n queryOptions,\n}: {\n agentId: string;\n queryOptions?: MastraMutationOptions<ModelUpdateResponse, ReorderModelListParams>;\n}): UseMutationResult<ModelUpdateResponse, Error, ReorderModelListParams> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async (payload: ReorderModelListParams) => client.getAgent(agentId).reorderModelList(payload),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n onError: err => {\n console.error('Error reordering model list', err);\n },\n ...queryOptions,\n });\n};\n\nexport const useUpdateModelInModelList = ({\n agentId,\n queryOptions,\n}: {\n agentId: string;\n queryOptions?: MastraMutationOptions<ModelUpdateResponse, UpdateModelInModelListParams>;\n}): UseMutationResult<ModelUpdateResponse, Error, UpdateModelInModelListParams> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async (payload: UpdateModelInModelListParams) =>\n client.getAgent(agentId).updateModelInModelList(payload),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n onError: err => {\n console.error('Error updating model in model list', err);\n },\n ...queryOptions,\n });\n};\n\nexport const useResetAgentModel = ({\n agentId,\n queryOptions,\n}: {\n agentId: string;\n queryOptions?: MastraMutationOptions<ModelUpdateResponse, void>;\n}): UseMutationResult<ModelUpdateResponse, Error, void> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async () => client.getAgent(agentId).resetModel(),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n onError: err => {\n console.error('Error resetting model', err);\n },\n ...queryOptions,\n });\n};\n","import { useMutation } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions } from '../shared/query-options';\n\ninterface CloseBrowserParams {\n agentId: string;\n threadId?: string;\n}\n\n/**\n * Mutation hook for closing an agent's browser session.\n */\nexport function useCloseBrowser({\n queryOptions,\n}: { queryOptions?: MastraMutationOptions<{ success: boolean }, CloseBrowserParams> } = {}) {\n const client = useMastraClient();\n\n return useMutation<{ success: boolean }, Error, CloseBrowserParams>({\n mutationFn: ({ agentId, threadId }) => client.getAgent(agentId).closeBrowser(threadId),\n onError: err => {\n console.error('[useCloseBrowser] Error closing browser:', err);\n },\n ...queryOptions,\n });\n}\n","import type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\ninterface ApiInstructionBlock {\n type: string;\n content?: string;\n id?: string;\n /** Form-format ref blocks use `promptBlockId` instead of `id` */\n promptBlockId?: string;\n rules?: unknown;\n}\n\n/**\n * Normalize blocks to API format.\n * Form-format ref blocks have `{ type: 'prompt_block_ref', promptBlockId }`,\n * while API-format blocks have `{ type: 'prompt_block_ref', id }`.\n */\nfunction toApiBlocks(blocks: ApiInstructionBlock[]) {\n return blocks.map(block => {\n if (block.type === 'prompt_block_ref') {\n // Form-format blocks have `promptBlockId` (the storage ID) and `id` (form-internal UUID).\n // API-format blocks have `id` (the storage ID). Prefer promptBlockId when present.\n return { type: 'prompt_block_ref' as const, id: block.promptBlockId ?? block.id, rules: block.rules };\n }\n return { type: block.type, content: block.content, rules: block.rules };\n });\n}\n\n/**\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport function usePreviewInstructions<TData = string>({\n blocks,\n requestContext,\n queryOptions,\n}: {\n blocks: ApiInstructionBlock[] | undefined;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<string, TData>;\n}): UseQueryResult<TData, Error> {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['preview-instructions', blocks, requestContext],\n queryFn: async () => {\n if (!blocks || blocks.length === 0) return '';\n\n const response = await client.request<{ result: string }>('/stored/agents/preview-instructions', {\n method: 'POST',\n body: { blocks: toApiBlocks(blocks), context: requestContext },\n });\n\n return response.result;\n },\n ...queryOptions,\n });\n}\n","import type { MastraClient } from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\n\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\nexport type ListStoredSkillsResponse = Awaited<ReturnType<MastraClient['listStoredSkills']>>;\n\nexport function useStoredSkills<TData = ListStoredSkillsResponse>({\n queryOptions,\n}: { queryOptions?: MastraQueryOptions<ListStoredSkillsResponse, TData> } = {}): UseQueryResult<TData, Error> {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['stored-skills'],\n queryFn: () => client.listStoredSkills(),\n ...queryOptions,\n });\n}\n","import type { ChannelPlatformInfo, ChannelInstallationInfo, ChannelConnectResult } from '@mastra/client-js';\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport type { UseMutationResult, UseQueryResult } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions, MastraQueryOptions } from '../shared/query-options';\n\nexport type { ChannelPlatformInfo, ChannelInstallationInfo, ChannelConnectResult };\n\nexport const useChannelPlatforms = <TData = ChannelPlatformInfo[]>({\n queryOptions,\n}: { queryOptions?: MastraQueryOptions<ChannelPlatformInfo[], TData> } = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery<ChannelPlatformInfo[], Error, TData>({\n queryKey: ['channels', 'platforms'],\n queryFn: () => client.channels.listPlatforms(),\n staleTime: 60 * 1000,\n retry: false,\n ...queryOptions,\n });\n};\n\n/**\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useChannelInstallations = <TData = ChannelInstallationInfo[]>({\n platform,\n agentId,\n queryOptions,\n}: {\n platform: string;\n agentId: string;\n queryOptions?: MastraQueryOptions<ChannelInstallationInfo[], TData>;\n}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery<ChannelInstallationInfo[], Error, TData>({\n queryKey: ['channels', 'installations', platform, agentId],\n queryFn: () => client.channels.listInstallations(platform, agentId),\n staleTime: 10 * 1000,\n retry: false,\n ...queryOptions,\n });\n};\n\n/**\n * Reconcile an agent's installation with platform state — activates a pending\n * installation whose connect flow completed out-of-band (e.g. a Discord bot\n * invite finished in another tab). Resolves null on platforms without\n * reconciliation. Call it deliberately (e.g. on window focus while a connect\n * is in flight) — it is a write, not a read.\n */\nexport const useReconcileChannelInstallation = ({\n platform,\n queryOptions,\n}: {\n platform: string;\n queryOptions?: MastraMutationOptions<ChannelInstallationInfo | null, string>;\n}): UseMutationResult<ChannelInstallationInfo | null, Error, string> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<ChannelInstallationInfo | null, Error, string>({\n mutationFn: agentId => client.channels.reconcileInstallation(platform, agentId),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['channels', 'installations', platform] });\n },\n ...queryOptions,\n });\n};\n\nexport const useConnectChannel = ({\n platform,\n queryOptions,\n}: {\n platform: string;\n queryOptions?: MastraMutationOptions<ChannelConnectResult, { agentId: string; options?: Record<string, unknown> }>;\n}): UseMutationResult<ChannelConnectResult, Error, { agentId: string; options?: Record<string, unknown> }> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<ChannelConnectResult, Error, { agentId: string; options?: Record<string, unknown> }>({\n mutationFn: ({ agentId, options }) =>\n client.channels.connect(platform, agentId, {\n ...options,\n // Tell the server to redirect back here after OAuth\n redirectUrl: window.location.href,\n }),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['channels', 'installations', platform] });\n },\n ...queryOptions,\n });\n};\n\nexport const useDisconnectChannel = ({\n platform,\n queryOptions,\n}: {\n platform: string;\n queryOptions?: MastraMutationOptions<{ success: boolean }, string>;\n}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<{ success: boolean }, Error, string>({\n mutationFn: agentId => client.channels.disconnect(platform, agentId),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['channels', 'installations', platform] });\n },\n ...queryOptions,\n });\n};\n","import type { MastraClient } from '@mastra/client-js';\nimport { RequestContext } from '@mastra/core/di';\nimport { useMutation } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions } from '../shared/query-options';\n\ntype ExecuteAgentToolResponse = Awaited<ReturnType<ReturnType<MastraClient['getAgent']>['executeTool']>>;\n\nexport interface ExecuteToolInput {\n agentId: string;\n toolId: string;\n input: any;\n playgroundRequestContext?: Record<string, any>;\n}\n\nexport const useExecuteAgentTool = ({\n queryOptions,\n}: { queryOptions?: MastraMutationOptions<ExecuteAgentToolResponse, ExecuteToolInput> } = {}) => {\n const client = useMastraClient();\n return useMutation({\n mutationFn: async ({ agentId, toolId, input, playgroundRequestContext }: ExecuteToolInput) => {\n const requestContext = new RequestContext();\n Object.entries(playgroundRequestContext ?? {}).forEach(([key, value]) => {\n requestContext.set(key, value);\n });\n return client.getAgent(agentId).executeTool(toolId, { data: input, requestContext });\n },\n ...queryOptions,\n });\n};\n"],"mappings":";;;;;AAmBA,MAAM,WAAW;AAEjB,MAAM,cAAc;AAEpB,MAAM,eAAe,YAA6B,IAAI,KAAK,QAAQ,SAAS,CAAC,CAAC,QAAQ;AAEtF,MAAM,eAAe,GAAoB,MAAuB,YAAY,CAAC,IAAI,YAAY,CAAC;AAE9F,MAAa,oBAA+C,EAC1D,UACA,SACA,QACA,gBACA,mBACkC;CAClC,MAAM,SAAS,gBAAgB;CAE/B,OAAO,iBAAiB;EACtB,UAAU;GAAC;GAAU;GAAY;GAAU;GAAS;EAAc;EAClE,kBAAkB;EAClB,SACE,UAAU,YACL,EAAE,WAAW,gBACZ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SAAS,OAAO,CAAC,CAAC,YAAY,QAAQ;IAAE,MAAM;IAAO;GAAe,CAAC;EACrF;EACA,GAAG;CACL,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/agents/use-agent-messages.ts","../../../src/hooks/agents/use-agent-plan.ts","../../../src/hooks/agents/use-background-tasks.ts","../../../src/hooks/agents/use-browser-session-probe.ts","../../../src/hooks/agents/is-model-not-allowed.ts","../../../src/hooks/agents/use-stored-agents.ts","../../../src/hooks/agents/use-agent-skills.ts","../../../src/hooks/agents/use-agent-versions.ts","../../../src/hooks/agents/use-agent-working-memory.ts","../../../src/hooks/agents/use-agent-workspace.ts","../../../src/hooks/agents/use-agent.ts","../../../src/hooks/agents/use-agents-model-providers.ts","../../../src/hooks/agents/use-agents.ts","../../../src/hooks/agents/use-close-browser.ts","../../../src/hooks/agents/use-preview-instructions.ts","../../../src/hooks/agents/use-stored-skills.ts","../../../src/hooks/agents/use-channels.ts","../../../src/hooks/agents/use-execute-agent-tool.ts"],"sourcesContent":["import type { MastraClient } from '@mastra/client-js';\nimport type { MastraDBMessage } from '@mastra/core/agent/message-list';\nimport { skipToken, useInfiniteQuery } from '@tanstack/react-query';\nimport type { InfiniteData, QueryKey } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraInfiniteQueryOptions } from '../shared/query-options';\n\ntype AgentMessagesPage = Awaited<ReturnType<MastraClient['listThreadMessages']>>;\n\ntype AgentMessagesData = InfiniteData<AgentMessagesPage, string> & { messages: MastraDBMessage[] };\n\nexport interface UseAgentMessagesProps<TData = AgentMessagesData> {\n threadId?: string;\n agentId: string;\n memory: boolean;\n requestContext?: Record<string, any>;\n queryOptions?: MastraInfiniteQueryOptions<AgentMessagesPage, TData, QueryKey, string>;\n}\n\nconst PER_PAGE = 40;\n\nconst NEWEST_PAGE = '';\n\nconst createdAtMs = (message: MastraDBMessage) => new Date(message.createdAt).getTime();\n\nconst byCreatedAt = (a: MastraDBMessage, b: MastraDBMessage) => createdAtMs(a) - createdAtMs(b);\n\nexport const useAgentMessages = <TData = AgentMessagesData>({\n threadId,\n agentId,\n memory,\n requestContext,\n queryOptions,\n}: UseAgentMessagesProps<TData>) => {\n const client = useMastraClient();\n\n return useInfiniteQuery({\n queryKey: ['memory', 'messages', threadId, agentId, requestContext],\n initialPageParam: NEWEST_PAGE,\n queryFn:\n memory && threadId\n ? ({ pageParam: olderThan }) =>\n client.listThreadMessages(threadId, {\n agentId,\n requestContext,\n includeSystemReminders: true,\n perPage: PER_PAGE,\n orderBy: { field: 'createdAt', direction: 'DESC' },\n // Inclusive bound: messages sharing the oldest createdAt of the previous page\n // may have been cut off by perPage, so re-ask for them and dedupe by id below.\n filter: olderThan ? { dateRange: { end: new Date(olderThan) } } : undefined,\n })\n : skipToken,\n getNextPageParam: (lastPage, _allPages, lastPageParam) => {\n if (!lastPage.hasMore || lastPage.messages.length === 0) return undefined;\n const next = new Date(Math.min(...lastPage.messages.map(createdAtMs))).toISOString();\n // A full page of same-timestamp messages would re-request itself forever.\n return next === lastPageParam ? undefined : next;\n },\n select: (data): TData => {\n const seen = new Set<string>();\n const messages = data.pages\n .flatMap(page => page.messages)\n .filter(message => {\n if (seen.has(message.id)) return false;\n seen.add(message.id);\n return true;\n })\n .sort(byCreatedAt);\n return { ...data, messages } as AgentMessagesData as TData;\n },\n staleTime: 0,\n gcTime: 0,\n retry: false,\n refetchOnWindowFocus: false,\n ...queryOptions,\n });\n};\n","import type { MastraClient } from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\ntype AgentPlanResponse = Awaited<ReturnType<ReturnType<MastraClient['getAgent']>['readPlan']>>;\n\ninterface UseAgentPlanOptions<TData> {\n agentId: string;\n path: string;\n agentVersionId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<AgentPlanResponse, TData>;\n}\n\nexport function useAgentPlan<TData = AgentPlanResponse>({\n agentId,\n path,\n agentVersionId,\n requestContext,\n queryOptions,\n}: UseAgentPlanOptions<TData>): UseQueryResult<TData, Error> {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['agent-plan', agentId, agentVersionId, path, requestContext],\n queryFn: () => {\n const agent = agentVersionId ? client.getAgent(agentId, { versionId: agentVersionId }) : client.getAgent(agentId);\n return agent.readPlan(path, requestContext);\n },\n retry: false,\n ...queryOptions,\n });\n}\n","import type { MastraClient, StreamBackgroundTasksParams } from '@mastra/client-js';\nimport type { BackgroundTaskStatus } from '@mastra/core/background-tasks';\nimport type { AgentChunkType } from '@mastra/core/stream';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\ntype BackgroundTaskStreamReader = ReturnType<Awaited<ReturnType<MastraClient['streamBackgroundTasks']>>['getReader']>;\n\nexport interface BackgroundTaskEvent {\n taskId: string;\n toolName: string;\n toolCallId: string;\n agentId: string;\n runId: string;\n result?: unknown;\n error?: { message: string; stack?: string };\n status: BackgroundTaskStatus;\n args: Record<string, unknown>;\n suspendPayload?: unknown;\n}\n\nexport interface UseBackgroundTaskStreamOptions extends StreamBackgroundTasksParams {\n /** Whether the stream is active. Default: true */\n enabled?: boolean;\n}\n\nexport interface UseBackgroundTaskStreamReturn {\n /** Map of taskId → latest event data */\n tasks: Record<string, BackgroundTaskEvent>;\n /** Whether the stream is currently connected */\n isConnected: boolean;\n /** Any connection error */\n error: Error | null;\n /** Manually disconnect the stream */\n disconnect: () => void;\n /** Manually reconnect the stream */\n reconnect: () => void;\n /** List of running tasks */\n runningTasks: BackgroundTaskEvent[];\n /** List of completed tasks */\n completedTasks: BackgroundTaskEvent[];\n /** List of failed tasks */\n failedTasks: BackgroundTaskEvent[];\n /** Clear completed and failed tasks */\n clearCompletedAndFailedTasks: () => void;\n}\n\n/**\n * Streams background task events via SSE and accumulates them in a map keyed by taskId.\n *\n * Each incoming event (task.completed / task.failed) is stored in state so the UI\n * can react to completions — e.g., show a toast, update a badge, or display results.\n *\n * @example\n * ```tsx\n * const { tasks, isConnected, completedTasks } = useBackgroundTaskStream({ agentId: 'crypto-agent' });\n *\n * // Show a badge with completed count\n * const completedCount = completedTasks.length;\n * ```\n */\n\ntype EventType = Extract<\n AgentChunkType,\n {\n type:\n | 'background-task-running'\n | 'background-task-completed'\n | 'background-task-failed'\n | 'background-task-cancelled'\n | 'background-task-output'\n | 'background-task-suspended'\n | 'background-task-resumed';\n }\n>;\n\nconst EVENT_STATUS_MAP: Record<EventType['type'], BackgroundTaskStatus> = {\n 'background-task-running': 'running',\n 'background-task-output': 'running',\n 'background-task-completed': 'completed',\n 'background-task-failed': 'failed',\n 'background-task-cancelled': 'cancelled',\n 'background-task-suspended': 'suspended',\n 'background-task-resumed': 'running',\n};\n\nexport function useBackgroundTaskStream(options: UseBackgroundTaskStreamOptions = {}): UseBackgroundTaskStreamReturn {\n const { enabled = true, agentId, runId, threadId, resourceId, taskId } = options;\n const client = useMastraClient();\n\n const [tasks, setTasks] = useState<Record<string, BackgroundTaskEvent>>({});\n const [isConnected, setIsConnected] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n const abortRef = useRef<AbortController | null>(null);\n const readerRef = useRef<BackgroundTaskStreamReader | null>(null);\n const connectSeqRef = useRef(0);\n\n const runningTasks = useMemo(() => {\n return Object.values(tasks).filter(task => task.status === 'running');\n }, [tasks]);\n\n const completedTasks = useMemo(() => {\n return Object.values(tasks).filter(task => task.status === 'completed');\n }, [tasks]);\n\n const failedTasks = useMemo(() => {\n return Object.values(tasks).filter(task => task.status === 'failed');\n }, [tasks]);\n\n const cleanup = useCallback(() => {\n readerRef.current?.cancel().catch(() => {});\n readerRef.current = null;\n abortRef.current?.abort();\n abortRef.current = null;\n setIsConnected(false);\n }, []);\n\n const connect = useCallback(async () => {\n const seq = ++connectSeqRef.current;\n cleanup();\n setError(null);\n\n const controller = new AbortController();\n abortRef.current = controller;\n\n try {\n const stream = await client.streamBackgroundTasks({ agentId, runId, threadId, resourceId, taskId });\n\n if (!stream) {\n setError(new Error('Stream connection failed'));\n return;\n }\n\n if (seq === connectSeqRef.current) {\n setIsConnected(true);\n }\n\n // Get a reader from the ReadableStream and store it in ref\n const reader = stream.getReader();\n readerRef.current = reader;\n\n while (!controller.signal.aborted) {\n const { done, value } = await reader.read();\n if (done) break;\n\n const event = value as EventType;\n if (event.type !== 'background-task-output') {\n setTasks(prev => ({\n ...prev,\n [event.payload.taskId]: {\n ...prev[event.payload.taskId],\n ...event.payload,\n status: EVENT_STATUS_MAP[event.type],\n args:\n ('args' in event.payload ? event.payload.args : undefined) ?? prev[event.payload.taskId]?.args ?? {},\n },\n }));\n }\n }\n } catch (err: any) {\n if (err?.name !== 'AbortError') {\n if (seq === connectSeqRef.current) {\n setError(err instanceof Error ? err : new Error(String(err)));\n }\n }\n } finally {\n if (seq === connectSeqRef.current) {\n setIsConnected(false);\n }\n }\n }, [client, agentId, runId, threadId, resourceId, taskId, cleanup]);\n\n useEffect(() => {\n if (!enabled) {\n cleanup();\n return;\n }\n\n void connect();\n return cleanup;\n }, [enabled, connect, cleanup]);\n\n const disconnect = useCallback(() => {\n cleanup();\n }, [cleanup]);\n\n const reconnect = useCallback(() => {\n void connect();\n }, [connect]);\n\n const clearCompletedAndFailedTasks = () => {\n setTasks(prev => {\n const newTasks = { ...prev };\n Object.values(newTasks).forEach(task => {\n if (\n task.status === 'completed' ||\n task.status === 'failed' ||\n task.status === 'cancelled' ||\n task.status === 'timed_out'\n ) {\n delete newTasks[task.taskId];\n }\n });\n return newTasks;\n });\n };\n\n return {\n tasks,\n isConnected,\n error,\n disconnect,\n reconnect,\n runningTasks,\n completedTasks,\n failedTasks,\n clearCompletedAndFailedTasks,\n };\n}\n\ntype BackgroundTaskResponse = Awaited<ReturnType<MastraClient['getBackgroundTask']>>;\n\nexport const useGetBackgroundTaskById = <TData = BackgroundTaskResponse>({\n backgroundTaskId,\n queryOptions,\n}: {\n backgroundTaskId: string;\n queryOptions?: MastraQueryOptions<BackgroundTaskResponse, TData>;\n}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n return useQuery({\n queryKey: ['background-task', backgroundTaskId],\n queryFn: () => client.getBackgroundTask(backgroundTaskId),\n ...queryOptions,\n });\n};\n","import type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\nexport interface BrowserSessionProbe {\n hasSession: boolean;\n screencastAvailable: boolean;\n}\n\ninterface UseBrowserSessionProbeOptions<TData> {\n agentId?: string;\n threadId?: string;\n /** TanStack overrides spread last, e.g. `{ enabled: false }` for agents without browser tools. */\n queryOptions?: MastraQueryOptions<BrowserSessionProbe, TData>;\n}\n\nexport const browserSessionProbeQueryKey = (agentId?: string, threadId?: string) =>\n ['browser-session-probe', agentId, threadId] as const;\n\nconst LEGACY_FALLBACK: BrowserSessionProbe = { hasSession: true, screencastAvailable: true };\n\nconst isNotFoundError = (error: unknown): boolean => {\n if (!error || typeof error !== 'object') return false;\n if ('status' in error && (error as { status: unknown }).status === 404) return true;\n if ('statusCode' in error && (error as { statusCode: unknown }).statusCode === 404) return true;\n return false;\n};\n\n/**\n * Query hook that probes the server for the agent's browser session state.\n *\n * Used by {@link BrowserSessionProvider} to decide whether to open a screencast\n * WebSocket. The probe avoids two failure modes:\n *\n * 1. `screencastAvailable: false` — the server doesn't have `ws` / `@hono/node-ws`\n * installed (or the route was never registered). Opening a WS would fail and\n * trigger a reconnect loop.\n * 2. `hasSession: false` — no active browser session for this thread yet. Opening\n * a WS would succeed but sit idle, holding resources for no reason.\n *\n * When the endpoint itself returns 404 (older server that predates this probe),\n * the hook assumes screencast is available and a session is active so behavior\n * matches the legacy unconditional connect.\n *\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport function useBrowserSessionProbe<TData = BrowserSessionProbe>({\n agentId,\n threadId,\n queryOptions,\n}: UseBrowserSessionProbeOptions<TData>): UseQueryResult<TData, Error> {\n const client = useMastraClient();\n\n return useQuery<BrowserSessionProbe, Error, TData>({\n queryKey: browserSessionProbeQueryKey(agentId, threadId),\n queryFn: async () => {\n if (!agentId) {\n return { hasSession: false, screencastAvailable: false };\n }\n\n try {\n return await client.getAgent(agentId).browserSession(threadId);\n } catch (error) {\n if (isNotFoundError(error)) {\n // Older server without the probe endpoint — fall back to legacy behavior.\n return LEGACY_FALLBACK;\n }\n throw error;\n }\n },\n // No polling: the probe fires once on mount, on window focus, and is\n // updated via `setQueriesData` from `tool-fallback.tsx` when a browser\n // tool call transitions. This avoids idle 5s polls and lets the probe\n // flip to `hasSession: true` the instant a tool call is seen.\n refetchOnWindowFocus: true,\n staleTime: 0,\n retry: 1,\n ...queryOptions,\n });\n}\n","/**\n * The wire-level error code the server emits on a 422 when a model is blocked\n * by the admin's builder policy. Kept as a local literal so the browser bundle\n * never imports server-only agent-builder EE code.\n */\nconst MODEL_NOT_ALLOWED_CODE = 'MODEL_NOT_ALLOWED';\n\nexport interface ModelNotAllowedDetails {\n message: string;\n attempted?: { provider?: string; modelId?: string };\n offendingLabel?: string;\n}\n\n/**\n * Detects HTTP 422 + MODEL_NOT_ALLOWED responses thrown by `MastraClientError`\n * (or any error carrying `status` + `body.error.code`). Returns the parsed\n * details when matched, or `null` otherwise.\n */\nexport function isModelNotAllowedError(err: unknown): ModelNotAllowedDetails | null {\n if (!err || typeof err !== 'object') return null;\n const candidate = err as { status?: number; body?: unknown; message?: string };\n if (candidate.status !== 422) return null;\n const body = candidate.body as { error?: { code?: unknown } } | undefined;\n const code = body?.error?.code;\n if (code !== MODEL_NOT_ALLOWED_CODE) return null;\n const errorBody = body!.error as {\n message?: string;\n attempted?: { provider?: string; modelId?: string };\n offendingLabel?: string;\n };\n return {\n message: errorBody.message || candidate.message || 'Model not allowed by admin policy',\n attempted: errorBody.attempted,\n offendingLabel: errorBody.offendingLabel,\n };\n}\n","import type {\n CreateStoredAgentParams,\n UpdateStoredAgentParams,\n ListStoredAgentsParams,\n StoredAgentResponse,\n ListStoredAgentsResponse,\n StoredAgentDependentsResponse,\n DeleteStoredAgentResponse,\n} from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions, MastraQueryOptions } from '../shared/query-options';\nimport { isModelNotAllowedError } from './is-model-not-allowed';\n\nexport const useStoredAgents = <TData = ListStoredAgentsResponse>({\n queryOptions,\n ...params\n}: ListStoredAgentsParams & {\n queryOptions?: MastraQueryOptions<ListStoredAgentsResponse, TData>;\n} = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n const listParams = Object.keys(params).length > 0 ? params : undefined;\n\n return useQuery({\n queryKey: ['stored-agents', listParams],\n queryFn: () => client.listStoredAgents(listParams),\n ...queryOptions,\n });\n};\n\n/**\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useStoredAgent = <TData = StoredAgentResponse | null>({\n agentId,\n status,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n status?: 'draft' | 'published';\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<StoredAgentResponse | null, TData>;\n} = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['stored-agent', agentId, status, requestContext],\n queryFn: async () => {\n if (!agentId) return null;\n try {\n return await client.getStoredAgent(agentId).details(requestContext, { status });\n } catch (error) {\n // 404 is expected for code-only agents that haven't been stored yet\n if (error && typeof error === 'object' && 'status' in error && (error as { status: number }).status === 404) {\n return null;\n }\n throw error;\n }\n },\n retry: false,\n ...queryOptions,\n });\n};\n\nexport type StoredAgent = StoredAgentResponse;\n\n/**\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useStoredAgentDependents = <TData = StoredAgentDependentsResponse>({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<StoredAgentDependentsResponse, TData>;\n} = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['stored-agent-dependents', agentId, requestContext],\n queryFn: () => client.getStoredAgent(agentId!).dependents(requestContext),\n retry: false,\n ...queryOptions,\n });\n};\n\nexport const useStoredAgentMutations = ({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: {\n createStoredAgent?: MastraMutationOptions<StoredAgentResponse, CreateStoredAgentParams>;\n updateStoredAgent?: MastraMutationOptions<StoredAgentResponse, UpdateStoredAgentParams>;\n deleteStoredAgent?: MastraMutationOptions<DeleteStoredAgentResponse, void>;\n };\n} = {}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n // If the server rejects with HTTP 422 + MODEL_NOT_ALLOWED the admin policy\n // has likely changed under us — refresh the cached settings so the UI\n // re-renders against the latest server truth.\n const invalidateBuilderSettingsOnPolicyReject = (err: unknown) => {\n if (isModelNotAllowedError(err)) {\n void queryClient.invalidateQueries({ queryKey: ['builder-settings'] });\n }\n };\n\n const createMutation = useMutation({\n mutationFn: (params: CreateStoredAgentParams) => client.createStoredAgent(params),\n onSuccess: created => {\n // Prime the per-agent details cache with the response so the next page\n // (the edit page) can render the agent on first paint without a refetch.\n // The starter relies on this to immediately mount the conversation panel\n // and dispatch the user's initial message.\n queryClient.setQueryData(['stored-agent', created.id, 'draft', requestContext], created);\n queryClient.setQueryData(['stored-agent', created.id, undefined, requestContext], created);\n // Invalidate both stored-agents list and the merged agents list\n void queryClient.invalidateQueries({ queryKey: ['stored-agents'] });\n void queryClient.invalidateQueries({ queryKey: ['agents'] });\n // Invalidate the merged agent details so the freshly-created id resolves\n // instead of staying stuck on the initial `null` from the 404 lookup.\n void queryClient.invalidateQueries({ queryKey: ['agent', created.id] });\n },\n onError: invalidateBuilderSettingsOnPolicyReject,\n ...queryOptions?.createStoredAgent,\n });\n\n const updateMutation = useMutation({\n mutationFn: (params: UpdateStoredAgentParams) => {\n if (!agentId) throw new Error('agentId is required for update');\n return client.getStoredAgent(agentId).update(params, requestContext);\n },\n onSuccess: () => {\n // Invalidate lists\n void queryClient.invalidateQueries({ queryKey: ['stored-agents'] });\n void queryClient.invalidateQueries({ queryKey: ['agents'] });\n // Invalidate specific agent details\n if (agentId) {\n void queryClient.invalidateQueries({ queryKey: ['stored-agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n }\n },\n onError: invalidateBuilderSettingsOnPolicyReject,\n ...queryOptions?.updateStoredAgent,\n });\n\n const deleteMutation = useMutation({\n mutationFn: () => {\n if (!agentId) throw new Error('agentId is required for delete');\n return client.getStoredAgent(agentId).delete(requestContext);\n },\n onSuccess: () => {\n // Invalidate lists so the agents list page refetches without the deleted entry\n void queryClient.invalidateQueries({ queryKey: ['stored-agents'] });\n void queryClient.invalidateQueries({ queryKey: ['agents'] });\n // Drop the deleted entity from the cache so active observers don't refetch a 404\n if (agentId) {\n queryClient.removeQueries({ queryKey: ['stored-agent', agentId] });\n queryClient.removeQueries({ queryKey: ['agent', agentId] });\n }\n },\n ...queryOptions?.deleteStoredAgent,\n });\n\n return {\n createStoredAgent: createMutation,\n updateStoredAgent: updateMutation,\n deleteStoredAgent: deleteMutation,\n };\n};\n","import type { StoredAgentResponse, StoredAgentSkillConfig, UpdateStoredAgentParams } from '@mastra/client-js';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { useMemo } from 'react';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions } from '../shared/query-options';\nimport { useStoredAgent } from './use-stored-agents';\n\n/**\n * Hook to read and mutate the skills config for a stored agent.\n *\n * The skills field is `Record<string, StoredAgentSkillConfig>` on the agent\n * snapshot. Each key is a stored skill ID and the value holds per-skill\n * overrides (description, instructions, pin, strategy).\n */\nexport function useAgentSkills({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: {\n updateSkills?: MastraMutationOptions<StoredAgentResponse, Record<string, StoredAgentSkillConfig> | undefined>;\n };\n} = {}) {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n const { data: agent } = useStoredAgent({ agentId, status: 'draft', queryOptions: { enabled: Boolean(agentId) } });\n\n const skills = useMemo((): Record<string, StoredAgentSkillConfig> => {\n if (!agent?.skills) return {};\n // Handle conditional field: if it's an array of variants, merge values\n if (Array.isArray(agent.skills)) {\n const merged: Record<string, StoredAgentSkillConfig> = {};\n for (const variant of agent.skills) {\n Object.assign(merged, variant.value);\n }\n return merged;\n }\n return agent.skills as Record<string, StoredAgentSkillConfig>;\n }, [agent?.skills]);\n\n const updateSkills = useMutation({\n mutationFn: (newSkills: Record<string, StoredAgentSkillConfig> | undefined) => {\n if (!agentId) throw new Error('agentId is required');\n const params: UpdateStoredAgentParams = { skills: newSkills };\n return client.getStoredAgent(agentId).update(params, requestContext);\n },\n onSuccess: () => {\n if (agentId) {\n void queryClient.invalidateQueries({ queryKey: ['stored-agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n }\n },\n ...queryOptions?.updateSkills,\n });\n\n return { skills, updateSkills };\n}\n","import type {\n ListAgentVersionsParams,\n CreateAgentVersionParams,\n ListAgentVersionsResponse,\n AgentVersionResponse,\n CompareVersionsResponse,\n ActivateAgentVersionResponse,\n DeleteAgentVersionResponse,\n} from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery, useMutation, useQueryClient, skipToken } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions, MastraQueryOptions } from '../shared/query-options';\n\nexport type { ListAgentVersionsParams, CreateAgentVersionParams };\n\ntype UseAgentVersionsParams<TData = ListAgentVersionsResponse> = {\n agentId?: string;\n params?: ListAgentVersionsParams;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<ListAgentVersionsResponse, TData>;\n};\n\n/**\n * Hook to list versions of a stored agent\n *\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useAgentVersions = <TData = ListAgentVersionsResponse>({\n agentId,\n params,\n requestContext,\n queryOptions,\n}: UseAgentVersionsParams<TData>): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery<ListAgentVersionsResponse, Error, TData>({\n queryKey: ['agent-versions', agentId, params, requestContext],\n queryFn: agentId ? () => client.getStoredAgent(agentId).listVersions(params, requestContext) : skipToken,\n ...queryOptions,\n });\n};\n\n/**\n * Hook to get a single version of a stored agent\n *\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useAgentVersion = <TData = AgentVersionResponse>({\n agentId,\n versionId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n versionId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<AgentVersionResponse, TData>;\n}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery<AgentVersionResponse, Error, TData>({\n queryKey: ['agent-version', agentId, versionId, requestContext],\n queryFn: () => client.getStoredAgent(agentId).getVersion(versionId, requestContext),\n ...queryOptions,\n });\n};\n\n/**\n * Hook to create a new version of a stored agent\n */\nexport const useCreateAgentVersion = ({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraMutationOptions<AgentVersionResponse, CreateAgentVersionParams | undefined>;\n}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<AgentVersionResponse, Error, CreateAgentVersionParams | undefined>({\n mutationFn: (params?: CreateAgentVersionParams) =>\n client.getStoredAgent(agentId).createVersion(params, requestContext),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n ...queryOptions,\n });\n};\n\n/**\n * Hook to activate a specific version of a stored agent\n */\nexport const useActivateAgentVersion = ({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraMutationOptions<ActivateAgentVersionResponse, string>;\n}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<ActivateAgentVersionResponse, Error, string>({\n mutationFn: (versionId: string) => client.getStoredAgent(agentId).activateVersion(versionId, requestContext),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n ...queryOptions,\n });\n};\n\n/**\n * Hook to restore a specific version of a stored agent (creates a new version from an old one)\n */\nexport const useRestoreAgentVersion = ({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraMutationOptions<AgentVersionResponse, string>;\n}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<AgentVersionResponse, Error, string>({\n mutationFn: (versionId: string) => client.getStoredAgent(agentId).restoreVersion(versionId, requestContext),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n ...queryOptions,\n });\n};\n\n/**\n * Hook to delete a specific version of a stored agent\n */\nexport const useDeleteAgentVersion = ({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraMutationOptions<DeleteAgentVersionResponse, string>;\n}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<DeleteAgentVersionResponse, Error, string>({\n mutationFn: (versionId: string) => client.getStoredAgent(agentId).deleteVersion(versionId, requestContext),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n },\n ...queryOptions,\n });\n};\n\n/**\n * Hook to compare two versions of a stored agent\n *\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useCompareAgentVersions = <TData = CompareVersionsResponse>({\n agentId,\n fromVersionId,\n toVersionId,\n requestContext,\n queryOptions,\n}: {\n agentId: string;\n fromVersionId: string;\n toVersionId: string;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<CompareVersionsResponse, TData>;\n}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery<CompareVersionsResponse, Error, TData>({\n queryKey: ['agent-versions-compare', agentId, fromVersionId, toVersionId, requestContext],\n queryFn: () => client.getStoredAgent(agentId).compareVersions(fromVersionId, toVersionId, requestContext),\n ...queryOptions,\n });\n};\n","import { useState, useEffect, useCallback, useRef } from 'react';\nimport { useMastraClient } from '../../mastra-client-context';\n\nfunction parseJsonString(jsonString: string): any {\n try {\n return JSON.stringify(JSON.parse(jsonString), null, 2);\n } catch {\n return jsonString;\n }\n}\n\nexport function useAgentWorkingMemory(\n agentId: string,\n threadId: string,\n resourceId: string,\n requestContext?: Record<string, any>,\n) {\n const client = useMastraClient();\n const [threadExists, setThreadExists] = useState(false);\n const [workingMemoryData, setWorkingMemoryData] = useState<string | null>(null);\n const [workingMemorySource, setWorkingMemorySource] = useState<'thread' | 'resource'>('thread');\n const [workingMemoryFormat, setWorkingMemoryFormat] = useState<'json' | 'markdown'>('markdown');\n const [isLoading, setIsLoading] = useState(true);\n const [isUpdating, setIsUpdating] = useState(false);\n const latestRequest = useRef(0);\n\n const refetch = useCallback(async () => {\n const requestId = ++latestRequest.current;\n setIsLoading(true);\n try {\n if (!agentId || !threadId) {\n setWorkingMemoryData(null);\n setIsLoading(false);\n return;\n }\n const res = await client.getWorkingMemory({ agentId, threadId, resourceId, requestContext });\n if (requestId !== latestRequest.current) return;\n const { workingMemory, source, workingMemoryTemplate, threadExists } = res as {\n workingMemory: string | null;\n source: 'thread' | 'resource';\n workingMemoryTemplate: { content: string; format: 'json' | 'markdown' };\n threadExists: boolean;\n };\n setThreadExists(threadExists);\n setWorkingMemoryData(workingMemory);\n setWorkingMemorySource(source);\n setWorkingMemoryFormat(workingMemoryTemplate?.format || 'markdown');\n if (workingMemoryTemplate?.format === 'json') {\n let dataToSet = '';\n if (workingMemory) {\n dataToSet = parseJsonString(workingMemory);\n } else if (workingMemoryTemplate?.content) {\n dataToSet = parseJsonString(workingMemoryTemplate.content);\n } else {\n dataToSet = '';\n }\n setWorkingMemoryData(dataToSet);\n } else {\n setWorkingMemoryData(workingMemory || workingMemoryTemplate?.content || '');\n }\n } catch (error) {\n if (requestId !== latestRequest.current) return;\n setWorkingMemoryData(null);\n console.error('Error fetching working memory', error);\n } finally {\n if (requestId === latestRequest.current) setIsLoading(false);\n }\n }, [agentId, threadId, resourceId, client, requestContext]);\n\n useEffect(() => {\n void refetch();\n }, [refetch]);\n\n const updateWorkingMemory = async (newMemory: string) => {\n setIsUpdating(true);\n try {\n if (workingMemoryFormat === 'json') {\n try {\n JSON.parse(newMemory);\n } catch {\n throw new Error('Invalid JSON working memory');\n }\n }\n await client.updateWorkingMemory({ agentId, threadId, workingMemory: newMemory, resourceId, requestContext });\n void refetch();\n } catch (error) {\n console.error('Error updating working memory', error);\n throw error;\n } finally {\n setIsUpdating(false);\n }\n };\n\n return {\n threadExists,\n workingMemoryData,\n workingMemorySource,\n workingMemoryFormat,\n isLoading,\n isUpdating,\n refetch,\n updateWorkingMemory,\n };\n}\n","import type { StoredAgentResponse, StoredWorkspaceRef, UpdateStoredAgentParams } from '@mastra/client-js';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { useMemo } from 'react';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions } from '../shared/query-options';\nimport { useStoredAgent } from './use-stored-agents';\n\n/**\n * Hook to read and mutate the workspace reference for a stored agent.\n *\n * The workspace ref is part of the agent snapshot config and can be:\n * - `{ type: 'id', workspaceId }` — references a stored workspace by ID\n * - `{ type: 'inline', config }` — inline workspace config\n * - `undefined` — no workspace assigned\n */\nexport function useAgentWorkspace({\n agentId,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n requestContext?: Record<string, any>;\n queryOptions?: {\n updateWorkspace?: MastraMutationOptions<StoredAgentResponse, StoredWorkspaceRef | undefined>;\n };\n} = {}) {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n const { data: agent } = useStoredAgent({ agentId, status: 'draft', queryOptions: { enabled: Boolean(agentId) } });\n\n const workspace = useMemo((): StoredWorkspaceRef | undefined => {\n if (!agent?.workspace) return undefined;\n // Handle conditional field: if it's an array of variants, take the first value\n if (Array.isArray(agent.workspace)) {\n return agent.workspace[0]?.value as StoredWorkspaceRef | undefined;\n }\n return agent.workspace as StoredWorkspaceRef;\n }, [agent?.workspace]);\n\n const updateWorkspace = useMutation({\n mutationFn: (ref: StoredWorkspaceRef | undefined) => {\n if (!agentId) throw new Error('agentId is required');\n const params: UpdateStoredAgentParams = { workspace: ref };\n return client.getStoredAgent(agentId).update(params, requestContext);\n },\n onSuccess: () => {\n if (agentId) {\n void queryClient.invalidateQueries({ queryKey: ['stored-agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n }\n },\n ...queryOptions?.updateWorkspace,\n });\n\n return { workspace, updateWorkspace };\n}\n","import type { AgentVersionIdentifier, GetAgentResponse } from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\n/**\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useAgent = <TData = GetAgentResponse | null>({\n agentId,\n version,\n requestContext,\n queryOptions,\n}: {\n agentId?: string;\n version?: AgentVersionIdentifier;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<GetAgentResponse | null, TData>;\n} = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['agent', agentId, version, requestContext],\n queryFn: () => (agentId ? client.getAgent(agentId, version).details(requestContext) : null),\n retry: false,\n ...queryOptions,\n });\n};\n","import type { MastraClient } from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\ntype AgentsModelProvidersResponse = Awaited<ReturnType<MastraClient['listAgentsModelProviders']>>;\n\nexport const useAgentsModelProviders = <TData = AgentsModelProvidersResponse>({\n queryOptions,\n}: { queryOptions?: MastraQueryOptions<AgentsModelProvidersResponse, TData> } = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['agents-model-providers'],\n queryFn: () => client.listAgentsModelProviders(),\n retry: false,\n ...queryOptions,\n });\n};\n","import type {\n MastraClient,\n ReorderModelListParams,\n UpdateModelInModelListParams,\n UpdateModelParams,\n} from '@mastra/client-js';\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport type { UseMutationResult, UseQueryResult } from '@tanstack/react-query';\n\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions, MastraQueryOptions } from '../shared/query-options';\n\ntype Agent = ReturnType<MastraClient['getAgent']>;\ntype ListAgentsResponse = Awaited<ReturnType<MastraClient['listAgents']>>;\nexport type ModelUpdateResponse = Awaited<ReturnType<Agent['updateModel']>>;\n\nexport const useAgents = <TData = ListAgentsResponse>({\n requestContext,\n queryOptions,\n}: {\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<ListAgentsResponse, TData>;\n} = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['agents', requestContext],\n queryFn: () => client.listAgents(requestContext),\n ...queryOptions,\n });\n};\n\nexport const useUpdateAgentModel = ({\n agentId,\n queryOptions,\n}: {\n agentId: string;\n queryOptions?: MastraMutationOptions<ModelUpdateResponse, UpdateModelParams>;\n}): UseMutationResult<ModelUpdateResponse, Error, UpdateModelParams> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async (payload: UpdateModelParams) => client.getAgent(agentId).updateModel(payload),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n onError: err => {\n console.error('Error updating model', err);\n },\n ...queryOptions,\n });\n};\n\nexport const useReorderModelList = ({\n agentId,\n queryOptions,\n}: {\n agentId: string;\n queryOptions?: MastraMutationOptions<ModelUpdateResponse, ReorderModelListParams>;\n}): UseMutationResult<ModelUpdateResponse, Error, ReorderModelListParams> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n const { onSuccess, onError, ...mutationOptions } = queryOptions ?? {};\n\n return useMutation({\n mutationFn: async (payload: ReorderModelListParams) => client.getAgent(agentId).reorderModelList(payload),\n ...mutationOptions,\n onSuccess: (...args) => {\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['stored-agent', agentId] });\n return onSuccess?.(...args);\n },\n onError: (...args) => {\n console.error('Error reordering model list', args[0]);\n return onError?.(...args);\n },\n });\n};\n\nexport const useUpdateModelInModelList = ({\n agentId,\n queryOptions,\n}: {\n agentId: string;\n queryOptions?: MastraMutationOptions<ModelUpdateResponse, UpdateModelInModelListParams>;\n}): UseMutationResult<ModelUpdateResponse, Error, UpdateModelInModelListParams> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n const { onSuccess, onError, ...mutationOptions } = queryOptions ?? {};\n\n return useMutation({\n mutationFn: async (payload: UpdateModelInModelListParams) =>\n client.getAgent(agentId).updateModelInModelList(payload),\n ...mutationOptions,\n onSuccess: (...args) => {\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['agent-versions', agentId] });\n void queryClient.invalidateQueries({ queryKey: ['stored-agent', agentId] });\n return onSuccess?.(...args);\n },\n onError: (...args) => {\n console.error('Error updating model in model list', args[0]);\n return onError?.(...args);\n },\n });\n};\n\nexport const useResetAgentModel = ({\n agentId,\n queryOptions,\n}: {\n agentId: string;\n queryOptions?: MastraMutationOptions<ModelUpdateResponse, void>;\n}): UseMutationResult<ModelUpdateResponse, Error, void> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async () => client.getAgent(agentId).resetModel(),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['agent', agentId] });\n },\n onError: err => {\n console.error('Error resetting model', err);\n },\n ...queryOptions,\n });\n};\n","import { useMutation } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions } from '../shared/query-options';\n\ninterface CloseBrowserParams {\n agentId: string;\n threadId?: string;\n}\n\n/**\n * Mutation hook for closing an agent's browser session.\n */\nexport function useCloseBrowser({\n queryOptions,\n}: { queryOptions?: MastraMutationOptions<{ success: boolean }, CloseBrowserParams> } = {}) {\n const client = useMastraClient();\n\n return useMutation<{ success: boolean }, Error, CloseBrowserParams>({\n mutationFn: ({ agentId, threadId }) => client.getAgent(agentId).closeBrowser(threadId),\n onError: err => {\n console.error('[useCloseBrowser] Error closing browser:', err);\n },\n ...queryOptions,\n });\n}\n","import type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\ninterface ApiInstructionBlock {\n type: string;\n content?: string;\n id?: string;\n /** Form-format ref blocks use `promptBlockId` instead of `id` */\n promptBlockId?: string;\n rules?: unknown;\n}\n\n/**\n * Normalize blocks to API format.\n * Form-format ref blocks have `{ type: 'prompt_block_ref', promptBlockId }`,\n * while API-format blocks have `{ type: 'prompt_block_ref', id }`.\n */\nfunction toApiBlocks(blocks: ApiInstructionBlock[]) {\n return blocks.map(block => {\n if (block.type === 'prompt_block_ref') {\n // Form-format blocks have `promptBlockId` (the storage ID) and `id` (form-internal UUID).\n // API-format blocks have `id` (the storage ID). Prefer promptBlockId when present.\n return { type: 'prompt_block_ref' as const, id: block.promptBlockId ?? block.id, rules: block.rules };\n }\n return { type: block.type, content: block.content, rules: block.rules };\n });\n}\n\n/**\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport function usePreviewInstructions<TData = string>({\n blocks,\n requestContext,\n queryOptions,\n}: {\n blocks: ApiInstructionBlock[] | undefined;\n requestContext?: Record<string, any>;\n queryOptions?: MastraQueryOptions<string, TData>;\n}): UseQueryResult<TData, Error> {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['preview-instructions', blocks, requestContext],\n queryFn: async () => {\n if (!blocks || blocks.length === 0) return '';\n\n const response = await client.request<{ result: string }>('/stored/agents/preview-instructions', {\n method: 'POST',\n body: { blocks: toApiBlocks(blocks), context: requestContext },\n });\n\n return response.result;\n },\n ...queryOptions,\n });\n}\n","import type { MastraClient } from '@mastra/client-js';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\n\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraQueryOptions } from '../shared/query-options';\n\nexport type ListStoredSkillsResponse = Awaited<ReturnType<MastraClient['listStoredSkills']>>;\n\nexport function useStoredSkills<TData = ListStoredSkillsResponse>({\n queryOptions,\n}: { queryOptions?: MastraQueryOptions<ListStoredSkillsResponse, TData> } = {}): UseQueryResult<TData, Error> {\n const client = useMastraClient();\n\n return useQuery({\n queryKey: ['stored-skills'],\n queryFn: () => client.listStoredSkills(),\n ...queryOptions,\n });\n}\n","import type { ChannelPlatformInfo, ChannelInstallationInfo, ChannelConnectResult } from '@mastra/client-js';\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport type { UseMutationResult, UseQueryResult } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions, MastraQueryOptions } from '../shared/query-options';\n\nexport type { ChannelPlatformInfo, ChannelInstallationInfo, ChannelConnectResult };\n\nexport const useChannelPlatforms = <TData = ChannelPlatformInfo[]>({\n queryOptions,\n}: { queryOptions?: MastraQueryOptions<ChannelPlatformInfo[], TData> } = {}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery<ChannelPlatformInfo[], Error, TData>({\n queryKey: ['channels', 'platforms'],\n queryFn: () => client.channels.listPlatforms(),\n staleTime: 60 * 1000,\n retry: false,\n ...queryOptions,\n });\n};\n\n/**\n * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.\n */\nexport const useChannelInstallations = <TData = ChannelInstallationInfo[]>({\n platform,\n agentId,\n queryOptions,\n}: {\n platform: string;\n agentId: string;\n queryOptions?: MastraQueryOptions<ChannelInstallationInfo[], TData>;\n}): UseQueryResult<TData, Error> => {\n const client = useMastraClient();\n\n return useQuery<ChannelInstallationInfo[], Error, TData>({\n queryKey: ['channels', 'installations', platform, agentId],\n queryFn: () => client.channels.listInstallations(platform, agentId),\n staleTime: 10 * 1000,\n retry: false,\n ...queryOptions,\n });\n};\n\n/**\n * Reconcile an agent's installation with platform state — activates a pending\n * installation whose connect flow completed out-of-band (e.g. a Discord bot\n * invite finished in another tab). Resolves null on platforms without\n * reconciliation. Call it deliberately (e.g. on window focus while a connect\n * is in flight) — it is a write, not a read.\n */\nexport const useReconcileChannelInstallation = ({\n platform,\n queryOptions,\n}: {\n platform: string;\n queryOptions?: MastraMutationOptions<ChannelInstallationInfo | null, string>;\n}): UseMutationResult<ChannelInstallationInfo | null, Error, string> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<ChannelInstallationInfo | null, Error, string>({\n mutationFn: agentId => client.channels.reconcileInstallation(platform, agentId),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['channels', 'installations', platform] });\n },\n ...queryOptions,\n });\n};\n\nexport const useConnectChannel = ({\n platform,\n queryOptions,\n}: {\n platform: string;\n queryOptions?: MastraMutationOptions<ChannelConnectResult, { agentId: string; options?: Record<string, unknown> }>;\n}): UseMutationResult<ChannelConnectResult, Error, { agentId: string; options?: Record<string, unknown> }> => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<ChannelConnectResult, Error, { agentId: string; options?: Record<string, unknown> }>({\n mutationFn: ({ agentId, options }) =>\n client.channels.connect(platform, agentId, {\n ...options,\n // Tell the server to redirect back here after OAuth\n redirectUrl: window.location.href,\n }),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['channels', 'installations', platform] });\n },\n ...queryOptions,\n });\n};\n\nexport const useDisconnectChannel = ({\n platform,\n queryOptions,\n}: {\n platform: string;\n queryOptions?: MastraMutationOptions<{ success: boolean }, string>;\n}) => {\n const client = useMastraClient();\n const queryClient = useQueryClient();\n\n return useMutation<{ success: boolean }, Error, string>({\n mutationFn: agentId => client.channels.disconnect(platform, agentId),\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: ['channels', 'installations', platform] });\n },\n ...queryOptions,\n });\n};\n","import type { MastraClient } from '@mastra/client-js';\nimport { RequestContext } from '@mastra/core/di';\nimport { useMutation } from '@tanstack/react-query';\nimport { useMastraClient } from '../../mastra-client-context';\nimport type { MastraMutationOptions } from '../shared/query-options';\n\ntype ExecuteAgentToolResponse = Awaited<ReturnType<ReturnType<MastraClient['getAgent']>['executeTool']>>;\n\nexport interface ExecuteToolInput {\n agentId: string;\n toolId: string;\n input: any;\n playgroundRequestContext?: Record<string, any>;\n}\n\nexport const useExecuteAgentTool = ({\n queryOptions,\n}: { queryOptions?: MastraMutationOptions<ExecuteAgentToolResponse, ExecuteToolInput> } = {}) => {\n const client = useMastraClient();\n return useMutation({\n mutationFn: async ({ agentId, toolId, input, playgroundRequestContext }: ExecuteToolInput) => {\n const requestContext = new RequestContext();\n Object.entries(playgroundRequestContext ?? {}).forEach(([key, value]) => {\n requestContext.set(key, value);\n });\n return client.getAgent(agentId).executeTool(toolId, { data: input, requestContext });\n },\n ...queryOptions,\n });\n};\n"],"mappings":";;;;;AAmBA,MAAM,WAAW;AAEjB,MAAM,cAAc;AAEpB,MAAM,eAAe,YAA6B,IAAI,KAAK,QAAQ,SAAS,CAAC,CAAC,QAAQ;AAEtF,MAAM,eAAe,GAAoB,MAAuB,YAAY,CAAC,IAAI,YAAY,CAAC;AAE9F,MAAa,oBAA+C,EAC1D,UACA,SACA,QACA,gBACA,mBACkC;CAClC,MAAM,SAAS,gBAAgB;CAE/B,OAAO,iBAAiB;EACtB,UAAU;GAAC;GAAU;GAAY;GAAU;GAAS;EAAc;EAClE,kBAAkB;EAClB,SACE,UAAU,YACL,EAAE,WAAW,gBACZ,OAAO,mBAAmB,UAAU;GAClC;GACA;GACA,wBAAwB;GACxB,SAAS;GACT,SAAS;IAAE,OAAO;IAAa,WAAW;GAAO;GAGjD,QAAQ,YAAY,EAAE,WAAW,EAAE,KAAK,IAAI,KAAK,SAAS,EAAE,EAAE,IAAI,KAAA;EACpE,CAAC,IACH;EACN,mBAAmB,UAAU,WAAW,kBAAkB;GACxD,IAAI,CAAC,SAAS,WAAW,SAAS,SAAS,WAAW,GAAG,OAAO,KAAA;GAChE,MAAM,OAAO,IAAI,KAAK,KAAK,IAAI,GAAG,SAAS,SAAS,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,YAAY;GAEnF,OAAO,SAAS,gBAAgB,KAAA,IAAY;EAC9C;EACA,SAAS,SAAgB;GACvB,MAAM,uBAAO,IAAI,IAAY;GAC7B,MAAM,WAAW,KAAK,MACnB,SAAQ,SAAQ,KAAK,QAAQ,CAAC,CAC9B,QAAO,YAAW;IACjB,IAAI,KAAK,IAAI,QAAQ,EAAE,GAAG,OA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AO;GAAe,CAAC;EACrF;EACA,GAAG;CACL,CAAC;AACH"}
|
|
@@ -123,6 +123,13 @@ export declare function useAgentSkills({ agentId, requestContext, queryOptions,
|
|
|
123
123
|
})[];
|
|
124
124
|
} | undefined;
|
|
125
125
|
}[];
|
|
126
|
+
modelList?: {
|
|
127
|
+
id: string;
|
|
128
|
+
provider: string;
|
|
129
|
+
modelId: string;
|
|
130
|
+
enabled: boolean;
|
|
131
|
+
maxRetries: number;
|
|
132
|
+
}[] | undefined;
|
|
126
133
|
tools?: ({
|
|
127
134
|
[key: string]: {
|
|
128
135
|
description?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-agent-skills.d.ts","sourceRoot":"","sources":["../../../src/hooks/agents/use-agent-skills.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,sBAAsB,EAA2B,MAAM,mBAAmB,CAAC;AAI9G,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGrE;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,cAAc,EACd,YAAY,GACb,GAAE;IACD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,YAAY,CAAC,EAAE;QACb,YAAY,CAAC,EAAE,qBAAqB,CAAC,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,GAAG,SAAS,CAAC,CAAC;KAC/G,CAAC;CACE
|
|
1
|
+
{"version":3,"file":"use-agent-skills.d.ts","sourceRoot":"","sources":["../../../src/hooks/agents/use-agent-skills.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,sBAAsB,EAA2B,MAAM,mBAAmB,CAAC;AAI9G,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGrE;;;;;;GAMG;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCL"}
|
|
@@ -124,6 +124,13 @@ export declare function useAgentWorkspace({ agentId, requestContext, queryOption
|
|
|
124
124
|
})[];
|
|
125
125
|
} | undefined;
|
|
126
126
|
}[];
|
|
127
|
+
modelList?: {
|
|
128
|
+
id: string;
|
|
129
|
+
provider: string;
|
|
130
|
+
modelId: string;
|
|
131
|
+
enabled: boolean;
|
|
132
|
+
maxRetries: number;
|
|
133
|
+
}[] | undefined;
|
|
127
134
|
tools?: ({
|
|
128
135
|
[key: string]: {
|
|
129
136
|
description?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-agent-workspace.d.ts","sourceRoot":"","sources":["../../../src/hooks/agents/use-agent-workspace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAA2B,MAAM,mBAAmB,CAAC;AAI1G,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGrE;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,cAAc,EACd,YAAY,GACb,GAAE;IACD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,YAAY,CAAC,EAAE;QACb,eAAe,CAAC,EAAE,qBAAqB,CAAC,mBAAmB,EAAE,kBAAkB,GAAG,SAAS,CAAC,CAAC;KAC9F,CAAC;CACE
|
|
1
|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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCL"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { GetAgentResponse } from '@mastra/client-js';
|
|
1
|
+
import type { AgentVersionIdentifier, GetAgentResponse } from '@mastra/client-js';
|
|
2
2
|
import type { UseQueryResult } from '@tanstack/react-query';
|
|
3
3
|
import type { MastraQueryOptions } from '../shared/query-options.js';
|
|
4
4
|
/**
|
|
5
5
|
* Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.
|
|
6
6
|
*/
|
|
7
|
-
export declare const useAgent: <TData = GetAgentResponse | null>({ agentId, requestContext, queryOptions, }?: {
|
|
7
|
+
export declare const useAgent: <TData = GetAgentResponse | null>({ agentId, version, requestContext, queryOptions, }?: {
|
|
8
8
|
agentId?: string;
|
|
9
|
+
version?: AgentVersionIdentifier;
|
|
9
10
|
requestContext?: Record<string, any>;
|
|
10
11
|
queryOptions?: MastraQueryOptions<GetAgentResponse | null, TData>;
|
|
11
12
|
}) => UseQueryResult<TData, Error>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-agent.d.ts","sourceRoot":"","sources":["../../../src/hooks/agents/use-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"use-agent.d.ts","sourceRoot":"","sources":["../../../src/hooks/agents/use-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE;;GAEG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,GAAG,gBAAgB,GAAG,IAAI,wDAKrD;IACD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,YAAY,CAAC,EAAE,kBAAkB,CAAC,gBAAgB,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC;CACnE,KAAQ,cAAc,CAAC,KAAK,EAAE,KAAK,CASnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-agents.d.ts","sourceRoot":"","sources":["../../../src/hooks/agents/use-agents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACtB,4BAA4B,EAC5B,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG/E,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAEzF,KAAK,KAAK,GAAG,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC;AAClD,KAAK,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,YAAY,CAAC,CAA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AI,CAcrD,CAAC"}
|
|
@@ -139,6 +139,13 @@ export declare const useStoredAgentMutations: ({ agentId, requestContext, queryO
|
|
|
139
139
|
})[];
|
|
140
140
|
} | undefined;
|
|
141
141
|
}[];
|
|
142
|
+
modelList?: {
|
|
143
|
+
id: string;
|
|
144
|
+
provider: string;
|
|
145
|
+
modelId: string;
|
|
146
|
+
enabled: boolean;
|
|
147
|
+
maxRetries: number;
|
|
148
|
+
}[] | undefined;
|
|
142
149
|
tools?: ({
|
|
143
150
|
[key: string]: {
|
|
144
151
|
description?: string | undefined;
|
|
@@ -2151,6 +2158,13 @@ export declare const useStoredAgentMutations: ({ agentId, requestContext, queryO
|
|
|
2151
2158
|
})[];
|
|
2152
2159
|
} | undefined;
|
|
2153
2160
|
}[]) | undefined;
|
|
2161
|
+
modelList?: {
|
|
2162
|
+
id: string;
|
|
2163
|
+
provider: string;
|
|
2164
|
+
modelId: string;
|
|
2165
|
+
enabled: boolean;
|
|
2166
|
+
maxRetries: number;
|
|
2167
|
+
}[] | undefined;
|
|
2154
2168
|
tools?: ({
|
|
2155
2169
|
value: {
|
|
2156
2170
|
[key: string]: {
|
|
@@ -4175,6 +4189,13 @@ export declare const useStoredAgentMutations: ({ agentId, requestContext, queryO
|
|
|
4175
4189
|
})[];
|
|
4176
4190
|
} | undefined;
|
|
4177
4191
|
}[];
|
|
4192
|
+
modelList?: {
|
|
4193
|
+
id: string;
|
|
4194
|
+
provider: string;
|
|
4195
|
+
modelId: string;
|
|
4196
|
+
enabled: boolean;
|
|
4197
|
+
maxRetries: number;
|
|
4198
|
+
}[] | undefined;
|
|
4178
4199
|
tools?: ({
|
|
4179
4200
|
[key: string]: {
|
|
4180
4201
|
description?: string | undefined;
|
|
@@ -6185,6 +6206,13 @@ export declare const useStoredAgentMutations: ({ agentId, requestContext, queryO
|
|
|
6185
6206
|
provider: string;
|
|
6186
6207
|
name: string;
|
|
6187
6208
|
}) | undefined;
|
|
6209
|
+
modelList?: ({
|
|
6210
|
+
id: string;
|
|
6211
|
+
provider: string;
|
|
6212
|
+
modelId: string;
|
|
6213
|
+
enabled: boolean;
|
|
6214
|
+
maxRetries: number;
|
|
6215
|
+
}[] | undefined) | undefined;
|
|
6188
6216
|
tools?: (({
|
|
6189
6217
|
value: {
|
|
6190
6218
|
[key: string]: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-stored-agents.d.ts","sourceRoot":"","sources":["../../../src/hooks/agents/use-stored-agents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,6BAA6B,EAC7B,yBAAyB,EAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAGzF,eAAO,MAAM,eAAe,GAAI,KAAK,GAAG,wBAAwB,gCAG7D,sBAAsB,GAAG;IAC1B,YAAY,CAAC,EAAE,kBAAkB,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;CACpE,KAAQ,cAAc,CAAC,KAAK,EAAE,KAAK,CASnC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,KAAK,GAAG,mBAAmB,GAAG,IAAI,uDAK9D;IACD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,YAAY,CAAC,EAAE,kBAAkB,CAAC,mBAAmB,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC;CACtE,KAAQ,cAAc,CAAC,KAAK,EAAE,KAAK,CAoBnC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAE9C;;GAEG;AACH,eA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|
3
|
+
"version": "1.14.1-alpha.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/mastra-ai/mastra.git",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"lucide-react": "^1.61.0",
|
|
70
70
|
"shiki": "^1.29.2",
|
|
71
71
|
"tailwind-merge": "^3.7.0",
|
|
72
|
-
"@mastra/client-js": "1.59.0-alpha.
|
|
72
|
+
"@mastra/client-js": "1.59.0-alpha.2"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"@mastra/core": ">=1.67.0-0 <2.0.0-0",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"zod": "^4.6.7",
|
|
103
103
|
"@internal/lint": "0.0.147",
|
|
104
104
|
"@internal/types-builder": "0.0.122",
|
|
105
|
-
"@mastra/core": "1.82.0-alpha.
|
|
105
|
+
"@mastra/core": "1.82.0-alpha.2"
|
|
106
106
|
},
|
|
107
107
|
"engines": {
|
|
108
108
|
"node": ">=22.13.0"
|