@arbidocs/react 0.5.148 → 0.5.149
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/artifacts/index.cjs +14 -14
- package/dist/calls/livekit/index.cjs +48 -48
- package/dist/{chunk-XBY4RLC6.cjs → chunk-ASL7H2TF.cjs} +4 -4
- package/dist/{chunk-XBY4RLC6.cjs.map → chunk-ASL7H2TF.cjs.map} +1 -1
- package/dist/{chunk-MJIXYLI4.cjs → chunk-GFX7LQGR.cjs} +66 -66
- package/dist/{chunk-MJIXYLI4.cjs.map → chunk-GFX7LQGR.cjs.map} +1 -1
- package/dist/{chunk-VBUEDJMK.cjs → chunk-MK5L56Z3.cjs} +57 -57
- package/dist/{chunk-VBUEDJMK.cjs.map → chunk-MK5L56Z3.cjs.map} +1 -1
- package/dist/{chunk-5FQB5F2F.cjs → chunk-P2DPOZBS.cjs} +5 -2
- package/dist/chunk-P2DPOZBS.cjs.map +1 -0
- package/dist/{chunk-ZFTWH6B6.cjs → chunk-VXFTVWEI.cjs} +44 -44
- package/dist/{chunk-ZFTWH6B6.cjs.map → chunk-VXFTVWEI.cjs.map} +1 -1
- package/dist/{chunk-VVPB7NKX.cjs → chunk-YNOKH4FX.cjs} +38 -38
- package/dist/{chunk-VVPB7NKX.cjs.map → chunk-YNOKH4FX.cjs.map} +1 -1
- package/dist/document-tools/core.cjs +98 -98
- package/dist/document-tools/core.d.ts +2 -2
- package/dist/document-tools/index.cjs +100 -100
- package/dist/document-tools/index.d.ts +1 -1
- package/dist/index.cjs +1414 -1382
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +300 -2
- package/dist/index.js +4 -0
- package/dist/index.js.map +2 -2
- package/dist/{query-keys.d-pgq-4jyZ.d.ts → query-keys.d-BZolSssa.d.ts} +3 -0
- package/dist/query-keys.js +3 -0
- package/dist/query-keys.js.map +2 -2
- package/dist/ui/index.cjs +13 -13
- package/dist/viewers/index.cjs +9 -9
- package/dist/workforce.js +32 -0
- package/dist/workforce.js.map +2 -2
- package/package.json +3 -3
- package/dist/chunk-5FQB5F2F.cjs.map +0 -1
package/dist/workforce.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/workforce.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Work, workflows, agents and skills: the mutation and read hooks behind an \"AI workforce\" screen.\n *\n * A conversation with a `status` is a task: it is listed by `useConversations` and changed through\n * `useUpdateConversation` and friends (which patch the list, see `conversation-list`). A workflow is the automation that creates them. Everything\n * sits on the SDK (`arbi.conversations`, `arbi.workflows`, `arbi.agents`, `arbi.agentConfig`,\n * `arbi.workspaces`, `arbi.assistant.listSkills`) and invalidates through {@link arbiQueryKeys}, so\n * `useConversations`, `useWorkflows`, `useAgents` and `useConfigs` refresh on their own after a\n * write. Mapping a form onto these requests (`TaskComposerValues` to a create-work or create-workflow\n * request, an agent form to a persona) is the pure part and lives next to the forms in\n * `@arbidocs/blocks/agents`.\n *\n * Requires an `ArbiHost` (with an `arbi`) and a React Query client above it.\n */\n\nimport { useEffect, useMemo, useRef } from 'react'\nimport { useMutation, useQuery, useQueryClient, type QueryClient } from '@tanstack/react-query'\nimport type {\n ActivityResponse,\n ConversationResponse,\n CreateWorkRequest,\n CreateWorkflowRequest,\n PlanWorkRequest,\n StepActionRequest,\n UpdateConversationRequest,\n UpdateWorkflowRequest,\n WorkflowResponse,\n WorkflowRunResponse,\n WorkflowRunHistoryResponse,\n} from '@arbidocs/sdk/browser'\nimport type { components } from '@arbidocs/client'\nimport { useArbi } from './useArbi'\nimport { useCurrentWorkspace } from './workspaces/current'\nimport { arbiMutationKeys, arbiQueryKeys, useConversations } from './hooks'\nimport {\n addConversationToList,\n invalidateConversationDetails,\n invalidateConversationLists,\n patchConversation,\n removeConversationFromLists,\n} from './conversation-list'\nimport { useArbiSessionState } from './session'\n\n/** An agent or deployment config: section name (`Agents`, `QueryLLM`, ...) to its parameters. */\nexport type AgentConfigSections = Record<string, Record<string, unknown>>\n\n// \u2500\u2500 Conversations as work \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * Whether a React Query key is the cached activity of a task (of `conversationId`, or any): the\n * {@link useConversationActivity} key, `['arbi', 'conversations', id, 'activity']`.\n */\nexport function isActivityKey(queryKey: readonly unknown[], conversationId?: string): boolean {\n const [scope, resource, id, leaf] = queryKey\n if (scope !== 'arbi' || resource !== 'conversations' || leaf !== 'activity') return false\n return !conversationId || id === conversationId\n}\n\n/** Re-read the activity of one task (or every cached one): after a run or a patch. */\nexport function invalidateConversationActivity(queryClient: QueryClient, conversationId?: string) {\n void queryClient.invalidateQueries({\n predicate: (q) => isActivityKey(q.queryKey, conversationId),\n })\n}\n\n/** How often to re-read the list while an agent is generating. */\nconst GENERATING_POLL_MS = 2500\n\n/**\n * One poll for the whole page. Several components read the list, and each running its own timer\n * meant N times the requests, each cancelling the last. Holders share a single timer that runs\n * while at least one of them needs it; the returned function lets go.\n */\nlet listPollHolders = 0\nlet listPollTimer: ReturnType<typeof setInterval> | undefined\nlet listPollRefetch: (() => unknown) | undefined\n\nfunction holdListPoll(refetch: () => unknown): () => void {\n listPollRefetch = refetch\n listPollHolders += 1\n if (listPollTimer === undefined) {\n listPollTimer = setInterval(() => void listPollRefetch?.(), GENERATING_POLL_MS)\n }\n return () => {\n listPollHolders -= 1\n if (listPollHolders === 0 && listPollTimer !== undefined) {\n clearInterval(listPollTimer)\n listPollTimer = undefined\n }\n }\n}\n\n/**\n * The open workspace's conversations, and among them its tasks: the ones that have a `status` (a\n * plain chat has none). One list serves both: a task is a conversation with a status.\n *\n * The list is seeded once and patched by writes, so a run that finishes server-side is picked up by\n * re-reading it while any task is generating. A task whose status or update time changed has a\n * stale history, which is re-read.\n */\nexport function useConversationItems() {\n // Not the id alone: it lands before the workspace is open, and the list is read once.\n const workspaceId = useArbiSessionState((s) => s.workspaceId)\n const open = useArbiSessionState((s) => s.workspaceStatus === 'open')\n const query = useConversations(workspaceId ?? undefined, { enabled: open })\n const { refetch } = query\n const all = query.data\n const tasks = useMemo(() => (all ?? []).filter((c) => c.status != null), [all])\n const queryClient = useQueryClient()\n const seen = useRef(new Map<string, string>())\n useEffect(() => {\n for (const t of tasks) {\n const stamp = `${t.status}|${t.updated_at ?? ''}`\n const before = seen.current.get(t.external_id)\n if (before !== undefined && before !== stamp) {\n invalidateConversationActivity(queryClient, t.external_id)\n }\n seen.current.set(t.external_id, stamp)\n }\n }, [tasks, queryClient])\n const generating = tasks.some((t) => t.in_progress || t.status === 'generating')\n useEffect(() => (generating ? holdListPoll(refetch) : undefined), [generating, refetch])\n return { conversations: all ?? [], tasks, isLoading: query.isLoading, refetch }\n}\n\n/** Whether the open conversation is shared (a thread with people in it), from the list. */\nexport function useConversationIsShared(): boolean {\n const id = useArbiSessionState((state) => state.conversationId)\n const { conversations } = useConversationItems()\n return conversations.find((conversation) => conversation.external_id === id)?.is_shared ?? false\n}\n\n/** The open workspace's tasks only: the conversations that have a `status`. */\nexport function useWorkItems() {\n const { tasks, isLoading, refetch } = useConversationItems()\n return { tasks, isLoading, refetch }\n}\n\n/**\n * The signed-in person's role in the open workspace (`owner`, `collaborator`, `guest`), or null when\n * they are not a member: their entry in the workspace's own member list.\n */\nexport function useWorkspaceRole() {\n return useCurrentWorkspace().role\n}\n\n/**\n * Whether the viewer edits the open workspace (owner or collaborator). A task or workflow they do\n * not own is always shared with them, and editors may then change it; guests only read. Sharing and\n * deleting stay with the row's owner, which the row itself says (`is_owner`).\n */\nexport function useCanEditShared(): boolean {\n const role = useWorkspaceRole()\n return role === 'owner' || role === 'collaborator'\n}\n\n/** Whether the viewer owns the open workspace: with an item's creator, the only one who shares or deletes it. */\nexport function useIsWorkspaceOwner(): boolean {\n return useWorkspaceRole() === 'owner'\n}\n\n/**\n * The run was accepted, but the thread it creates did not show up within the lookup. The task is\n * running, so starting it again would make a second one: look for its thread again with\n * `findThread(messageId)` instead.\n */\nexport class TaskThreadPendingError extends Error {\n constructor(readonly messageId: string) {\n super(\"The task has started, but its thread isn't ready yet.\")\n this.name = 'TaskThreadPendingError'\n }\n}\n\n/** Looking up the thread a just-accepted run is creating: how many tries, how far apart. */\nconst THREAD_LOOKUP_ATTEMPTS = 20\nconst THREAD_LOOKUP_DELAY_MS = 500\n\n/** A run that makes its thread a task, as the person asking (see `ThreadQuery` in blocks). */\nexport interface StartTaskQuery {\n input: string\n workspaceId: string\n docIds: string[]\n mentions?: Parameters<ReturnType<typeof useArbi>['assistant']['submit']>[1]['mentions']\n task?: Parameters<ReturnType<typeof useArbi>['assistant']['submit']>[1]['task']\n}\n\n/**\n * Run now: a background response whose `task` options make its thread a task (generating, then\n * open again). It runs as the person asking, so there is no stream to hold open: the response\n * carries the message id, from which the thread is found and the list re-read. A bad parent is\n * refused before anything is created. Resolves with the new thread's id; the run uses the chat's\n * model choice, else the person's last config.\n */\nexport function useStartTaskQuery() {\n const arbi = useArbi()\n const queryClient = useQueryClient()\n const chatModel = useArbiSessionState((s) => s.chatModel)\n const post = useMutation({\n mutationFn: (query: StartTaskQuery) => {\n const selectedConfig =\n chatModel ||\n queryClient\n .getQueriesData<{ last_config?: string }>({ queryKey: arbiQueryKeys.userSettings() })\n .map(([, settings]) => settings?.last_config)\n .find(Boolean)\n // The run goes to the workspace the query names (opened for this session if it is not the\n // current one), never to whichever workspace the session has open when it is sent.\n return arbi.assistant.submit(query.input, {\n workspaceId: query.workspaceId,\n docIds: query.docIds,\n fullContext: false,\n ...(selectedConfig ? { model: selectedConfig } : {}),\n ...(query.mentions !== undefined ? { mentions: query.mentions } : {}),\n ...(query.task !== undefined ? { task: query.task } : {}),\n })\n },\n })\n /**\n * The thread of a run, read from the run itself (`GET /v1/responses/{id}`, which answers while the\n * run is live): undefined while the run has not created it yet. Once the run has posted its\n * question the thread exists (its `arbi.user_message` event names it); a finished run's message is\n * stored with its thread. Asking for the message of a run still setting up would be a 404.\n */\n const threadOf = async (\n messageId: string,\n known?: string | null\n ): Promise<string | undefined> => {\n const response = await arbi.assistant.getResponse(messageId)\n const events = (response.metadata?.events ?? []) as {\n type?: string\n conversation_ext_id?: string\n }[]\n const posted = events.find((e) => e.type === 'arbi.user_message')?.conversation_ext_id\n if (posted) return posted\n if (response.status === 'queued' || response.status === 'in_progress') return undefined\n return known || (await arbi.conversations.getMessage(messageId)).conversation_ext_id\n }\n /** The thread a run is creating, looked up `attempts` times; null while it is not there yet. */\n const lookUpThread = async (\n messageId: string,\n attempts: number,\n known?: string | null\n ): Promise<{ conversationId: string } | null> => {\n let conversationId: string | undefined\n for (let attempt = 0; attempt < attempts && !conversationId; attempt += 1) {\n if (attempt > 0) await new Promise((r) => setTimeout(r, THREAD_LOOKUP_DELAY_MS))\n try {\n conversationId = await threadOf(messageId, known)\n } catch (error) {\n // A 404 is a run another server instance has not marked live yet; anything else (a\n // refusal) is not worth waiting on.\n if (!(error && typeof error === 'object' && 'status' in error && error.status === 404))\n throw error\n }\n }\n if (!conversationId) return null\n // The new task is not in the cached list yet: read it again.\n await invalidateConversationLists(queryClient)\n return { conversationId }\n }\n return {\n isPending: post.isPending,\n /** Look again for the thread of a run whose start threw {@link TaskThreadPendingError}. */\n findThread: (messageId: string) => lookUpThread(messageId, 1),\n start: async (query: StartTaskQuery): Promise<{ conversationId: string }> => {\n const accepted = await post.mutateAsync(query)\n const found = await lookUpThread(\n accepted.id,\n THREAD_LOOKUP_ATTEMPTS,\n accepted.conversation_ext_id\n )\n if (!found) throw new TaskThreadPendingError(accepted.id)\n return found\n },\n }\n}\n\n/**\n * Patch a conversation: rename it, share it or make it private (`shared`, owner only), or change\n * its work fields (description, due date, parent, `status` `todo | done`, plan).\n * The one write behind title edits, the share toggle and marking a task done.\n */\nexport function useUpdateConversation() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({\n conversationId,\n patch,\n }: {\n conversationId: string\n patch: UpdateConversationRequest\n }): Promise<ConversationResponse> => arbi.conversations.update(conversationId, patch),\n // The list takes the server's version of the row; what hangs off it is read again.\n onSuccess: (updated, { conversationId }) => {\n patchConversation(qc, conversationId, updated)\n return invalidateConversationDetails(qc, conversationId)\n },\n })\n}\n\n/** Delete a conversation (thread or task); it leaves every cached list at once. */\nexport function useDeleteConversation() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (conversationId: string) => arbi.conversations.delete(conversationId),\n onSuccess: (_res, conversationId) => removeConversationFromLists(qc, conversationId),\n })\n}\n\n/** The workspace a work call names: the one given, else the one open now (none: the SDK's). */\nfunction workWorkspace(arbi: ReturnType<typeof useArbi>, workspaceId?: string | null) {\n return workspaceId || (arbi.hasWorkspace ? arbi.getWorkspaceId() : undefined)\n}\n\n/**\n * Search the past conversation messages (keyword + semantic, grouped) of `workspaceId`, else of\n * the workspace open when it is sent.\n */\nexport function useConversationSearch(workspaceId?: string | null) {\n const arbi = useArbi()\n return useMutation({\n mutationFn: (body: components['schemas']['ConversationSearchRequest']) =>\n arbi.conversations.search(body, { workspaceId: workWorkspace(arbi, workspaceId) }),\n })\n}\n\n/**\n * Create a work item from a `CreateWorkRequest`: a plain to-do, or (with a prompt or skill) agent\n * work that starts at once. It is made in `options.workspaceId` (the page's), else in the workspace\n * open when it is sent; the request names it, and it joins that workspace's list. Resolves with the\n * created conversation.\n */\nexport function useCreateWork(options?: { workspaceId?: string | null }) {\n const arbi = useArbi()\n const qc = useQueryClient()\n const named = options?.workspaceId\n return useMutation({\n // The workspace is read once, when the request is sent: the request names it and the new work\n // joins that workspace's list, so one switched to while it is in flight neither receives it\n // nor lists it.\n mutationFn: async (body: CreateWorkRequest): Promise<ConversationResponse> => {\n const workspaceId = workWorkspace(arbi, named)\n const created = await arbi.conversations.createWork(body, { workspaceId })\n addConversationToList(qc, workspaceId ?? null, created)\n return created\n },\n })\n}\n\n/**\n * Run a work item now, or retry it. A run parked waiting for workspace access (a temporary\n * authorization tier) is granted a temporary, session-scoped key and run again, so the person\n * clicking Run authorizes it. Resolves with the updated conversation.\n */\nexport function useRunConversation() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (conversationId: string): Promise<ConversationResponse> =>\n arbi.conversations.runWithAuth(conversationId),\n // The server's version replaces the listed one; everything under the conversation is re-read.\n onSuccess: (updated) => {\n if (updated?.external_id) patchConversation(qc, updated.external_id, updated)\n return qc.invalidateQueries({ queryKey: arbiQueryKeys.allConversations() })\n },\n })\n}\n\n/**\n * Complete or skip a step of a workflow run (a form, an upload, a review's approval). The run then\n * starts its next agent step; the listed conversation is replaced and its activity re-read.\n */\nexport function useActOnStep() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({\n conversationId,\n body,\n }: {\n conversationId: string\n body: StepActionRequest\n }): Promise<ConversationResponse> => arbi.conversations.actOnStep(conversationId, body),\n // The server's version of the conversation replaces the listed one; its history is re-read.\n onSuccess: (updated) => {\n if (!updated?.external_id) return\n patchConversation(qc, updated.external_id, updated)\n invalidateConversationActivity(qc, updated.external_id)\n },\n })\n}\n\n/**\n * Draft an editable plan (goal and acceptance checklist) from an objective, for a task in\n * `workspaceId`, else in the workspace open when it is sent.\n */\nexport function usePlanWork(workspaceId?: string | null) {\n const arbi = useArbi()\n return useMutation({\n mutationFn: (body: PlanWorkRequest) =>\n arbi.conversations.plan(body, { workspaceId: workWorkspace(arbi, workspaceId) }),\n })\n}\n\n/**\n * The agent run-session key a parked run waits for the owner to allow (public key and email,\n * non-secret). Enabled only while the run is waiting; 404 otherwise.\n */\nexport function useConversationPendingAuth(\n conversationId: string | undefined,\n options?: { enabled?: boolean }\n) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.conversationPendingAuth(conversationId ?? ''),\n queryFn: () => arbi.conversations.pendingAuth(conversationId as string),\n enabled: (options?.enabled ?? true) && !!conversationId && arbi.isLoggedIn,\n retry: false,\n })\n}\n\n/**\n * A task's history, oldest first (created, run started, handed off, sent back, done, ...). Cached\n * under the conversations prefix, so every task write that invalidates the list refreshes it too.\n * Pass `live` while a run is generating to re-read it every few seconds.\n */\nexport function useConversationActivity(\n conversationId: string | undefined,\n options?: { enabled?: boolean; live?: boolean }\n) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.conversationActivity(conversationId ?? ''),\n queryFn: (): Promise<ActivityResponse[]> =>\n arbi.conversations.activity(conversationId as string),\n enabled: (options?.enabled ?? true) && !!conversationId && arbi.isLoggedIn,\n refetchInterval: options?.live ? 2500 : false,\n })\n}\n\n// \u2500\u2500 Workflows \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** The caller's workflows (their own, and the ones shared with the open workspace). */\nexport function useWorkflows(options?: { enabled?: boolean; live?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.workflows(),\n queryFn: (): Promise<WorkflowResponse[]> => arbi.workflows.list(),\n // A clock or event can fire while the list is open, without a write here.\n refetchInterval: options?.live ? 10_000 : false,\n enabled: (options?.enabled ?? true) && arbi.isLoggedIn,\n })\n}\n\n/** A workflow's runs, re-read every few seconds while shown (a run moves on by itself). */\nexport function useWorkflowRuns(workflowId: string | undefined) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.workflowRuns(workflowId ?? ''),\n queryFn: (): Promise<WorkflowRunHistoryResponse[]> => arbi.workflows.runs(workflowId as string),\n enabled: !!workflowId && arbi.isLoggedIn,\n refetchInterval: 3000,\n staleTime: 0,\n refetchOnMount: 'always',\n })\n}\n\n/** Refresh the workflow list now (e.g. after the assistant saved one from chat). */\nexport function useInvalidateWorkflows(): () => Promise<void> {\n const qc = useQueryClient()\n return () => qc.invalidateQueries({ queryKey: arbiQueryKeys.workflows() })\n}\n\n/** Create a workflow from a `CreateWorkflowRequest`. Resolves with the created workflow. */\nexport function useCreateWorkflow() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (body: CreateWorkflowRequest): Promise<WorkflowResponse> =>\n arbi.workflows.create(body),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.workflows() }),\n })\n}\n\n/** Patch a workflow: pause or resume it (`active`), share it, or change its trigger or action. */\nexport function useUpdateWorkflow() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({\n workflowId,\n patch,\n }: {\n workflowId: string\n patch: UpdateWorkflowRequest\n }): Promise<WorkflowResponse> => arbi.workflows.update(workflowId, patch),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.workflows() }),\n })\n}\n\nexport function useDeleteWorkflow() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (workflowId: string) => arbi.workflows.delete(workflowId),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.workflows() }),\n })\n}\n\n/**\n * Run a workflow now. Resolves with the conversation it created\n * (`conversation_ext_id`), which joins the conversation list.\n */\nexport function useRunWorkflow() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationKey: arbiMutationKeys.runWorkflow(),\n mutationFn: (workflowId: string): Promise<WorkflowRunResponse> =>\n arbi.workflows.run(workflowId),\n onSuccess: () =>\n Promise.all([\n qc.invalidateQueries({ queryKey: arbiQueryKeys.workflows() }),\n qc.invalidateQueries({ queryKey: arbiQueryKeys.allConversations() }),\n ]),\n })\n}\n\n// \u2500\u2500 Agents \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** Create an agent by name. The one-time `signing_private_key` is in the result. */\nexport function useCreateAgent() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (name: string) => arbi.agents.create(name),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.agents() }),\n })\n}\n\n/**\n * Generate an avatar for an owned agent from a prompt and set it as its picture. Resolves with the\n * agent (`picture` set); the agent list refreshes.\n */\nexport function useGenerateAgentAvatar() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({ agentExtId, prompt }: { agentExtId: string; prompt: string }) =>\n arbi.agents.generateAvatar(agentExtId, prompt),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.agents() }),\n })\n}\n\n/** The default and maximum lifetime of a temporary agent authorization (seconds). */\nexport function useAuthorizeLimits(options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.authorizeLimits(),\n queryFn: () => arbi.agents.authorizeLimits(),\n enabled: (options?.enabled ?? true) && arbi.isLoggedIn,\n })\n}\n\n/** The MCP tools registered on the deployment, for an agent's tool picker. */\nexport function useMcpTools(options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.mcpTools(),\n queryFn: () => arbi.health.mcpTools(),\n enabled: (options?.enabled ?? true) && arbi.isLoggedIn,\n })\n}\n\n/**\n * An agent's pinned config (persona, model, tool switches), or the library default config when\n * `agentExtId` is omitted: edit forms seed from the first, create forms from the second.\n */\nexport function useAgentConfig(agentExtId?: string, options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.agentConfig(agentExtId),\n queryFn: async () =>\n (agentExtId\n ? await arbi.agents.getConfig(agentExtId)\n : await arbi.agentConfig.get('default')) as AgentConfigSections | null,\n enabled: (options?.enabled ?? true) && arbi.isLoggedIn,\n })\n}\n\n/** The model names an agent may be pinned to. */\nexport function useAgentModels(options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.models(),\n queryFn: async () => (await arbi.agentConfig.getModels()).models.map((m) => m.model_name),\n enabled: (options?.enabled ?? true) && arbi.isLoggedIn,\n })\n}\n\nexport interface SaveAgentConfigVars {\n agentExtId: string\n /** Config title; defaults to `agent-<agentExtId>`. */\n title?: string\n /**\n * Parameters to set, per section, e.g. `{ Agents: { PERSONA: '...', WEB_SEARCH_ENABLED: true } }`.\n * Merged key by key over the agent's current config (or the default one for a new agent).\n */\n sections: AgentConfigSections\n}\n\n/** Pin a behaviour config to an agent: read its current config, merge `sections` over it, save. */\nexport function useSaveAgentConfig() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: async ({ agentExtId, title, sections }: SaveAgentConfigVars) => {\n const pinned = (await arbi.agents.getConfig(agentExtId)) as AgentConfigSections | null\n const base = pinned ?? ((await arbi.agentConfig.get('default')) as AgentConfigSections)\n const merged: AgentConfigSections = structuredClone(base)\n for (const [section, params] of Object.entries(sections)) {\n merged[section] = { ...(merged[section] ?? {}), ...params }\n }\n return arbi.agentConfig.save({\n ...merged,\n agent_ext_id: agentExtId,\n title: title ?? `agent-${agentExtId}`,\n } as never)\n },\n onSuccess: (_saved, { agentExtId }) =>\n Promise.all([\n qc.invalidateQueries({ queryKey: arbiQueryKeys.configs() }),\n qc.invalidateQueries({ queryKey: arbiQueryKeys.agentConfig(agentExtId) }),\n // The agent list shows the pinned persona/model, so it refreshes too.\n qc.invalidateQueries({ queryKey: arbiQueryKeys.agents() }),\n ]),\n })\n}\n\n/** The workspaces an agent can currently open (`permanent` tells standing from temporary). */\nexport function useAgentWorkspaces(\n agentExtId: string | undefined,\n options?: { enabled?: boolean }\n) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.agentWorkspaces(agentExtId ?? ''),\n queryFn: () => arbi.agents.listWorkspaces(agentExtId as string),\n enabled: (options?.enabled ?? true) && !!agentExtId && arbi.isLoggedIn,\n })\n}\n\n/** How an agent is given a workspace. */\nexport type AgentAccessMode =\n /** A standing member: the agent can open the workspace while the owner is away. */\n | { kind: 'standing' }\n /** A TTL'd, session-scoped key: gone when the run session ends. `ttlSeconds` omitted = default. */\n | { kind: 'temporary'; ttlSeconds?: number }\n\nexport interface GrantAgentAccessVars {\n agentExtId: string\n workspaceId: string\n /** Default `{ kind: 'standing' }`. */\n mode?: AgentAccessMode\n}\n\n/**\n * Give an agent access to a workspace you own. Standing access adds the agent as a member without\n * switching the open workspace; temporary access mints the agent's run session and deposits a\n * session-scoped key on it (the `session_pubkey_b64` path).\n */\nexport function useGrantAgentAccess() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: async ({\n agentExtId,\n workspaceId,\n mode = { kind: 'standing' },\n }: GrantAgentAccessVars) => {\n if (mode.kind === 'temporary') {\n return arbi.agents.grantTemporaryAccess(agentExtId, workspaceId, mode.ttlSeconds)\n }\n const agent = (await arbi.agents.list()).find((a) => a.external_id === agentExtId)\n if (!agent?.email) throw new Error(\"The agent's address is unknown.\")\n return arbi.workspaces.grantAccess({ workspaceId, emails: [agent.email] })\n },\n onSuccess: (_res, { agentExtId, mode }) => {\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.agentWorkspaces(agentExtId) })\n // Temporary access is a new run session: the session list shows it.\n if (mode?.kind === 'temporary')\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.sessions() })\n },\n })\n}\n\n/**\n * Take an agent out of a workspace (owner only). The workspace is named on the request (opened for\n * the session, not switched to), so the app's current workspace never changes.\n */\nexport function useRevokeAgentAccess() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({ agentExtId, workspaceId }: { agentExtId: string; workspaceId: string }) =>\n arbi.workspaces.removeUsers([agentExtId], { workspaceId }),\n onSuccess: (_res, { agentExtId }) =>\n qc.invalidateQueries({ queryKey: arbiQueryKeys.agentWorkspaces(agentExtId) }),\n })\n}\n\n// \u2500\u2500 Skills \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * The skills the user can run (own plus the shared marketplace), metadata only. Without a\n * deployment marketplace the server lists a workspace's skills, so the list is kept per workspace\n * and the request names the open one: a switch while it runs cannot answer for another.\n */\nexport function useSkills(options?: {\n enabled?: boolean\n includeHidden?: boolean\n live?: boolean\n}) {\n const arbi = useArbi()\n const workspaceId = arbi.hasWorkspace ? arbi.getWorkspaceId() : ''\n return useQuery({\n queryKey: arbiQueryKeys.skillList(workspaceId, options?.includeHidden ?? false),\n queryFn: () =>\n arbi.assistant.listSkills({\n includeHidden: options?.includeHidden,\n workspaceId: workspaceId || undefined,\n }),\n refetchInterval: options?.live ? 5000 : false,\n enabled: (options?.enabled ?? true) && arbi.isLoggedIn,\n staleTime: 30_000,\n })\n}\n\n/**\n * Upload skill files through the same document path as the main application. A skill is the\n * uploader's own (`mine`) unless an entry says `shared` (everyone's, as \"Share with everyone\" makes\n * it): saving a private skill again never publishes it.\n */\nexport function useUploadSkillFiles() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: async (\n entries: {\n folder: string\n fileName: string\n content: Blob\n shared?: boolean\n /** Explicit target, already open/primed on this session. Uses session-gated upload. */\n workspaceId?: string\n }[]\n ): Promise<{ doc_ext_ids?: string[] }[]> => {\n if (!entries.length) throw new Error('Choose at least one skill file.')\n for (const entry of entries) assertSkillFolder(entry.folder)\n const results = []\n for (const entry of entries) {\n const options = {\n folder: entry.folder,\n wpType: 'skill' as const,\n shared: entry.shared ?? false,\n }\n const result = entry.workspaceId\n ? await arbi.documents.upload(\n [new File([entry.content], entry.fileName, { type: entry.content.type })],\n { ...options, workspaceExtId: entry.workspaceId }\n )\n : await arbi.documents.uploadFile(entry.content, entry.fileName, options)\n throwOnSkipped(result)\n results.push(result)\n }\n return results\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.skills() }),\n })\n}\n\n/** A skill's files live under `skills/<slug>/`, never outside it. */\nfunction assertSkillFolder(folder: string) {\n if (\n !/^skills\\/[a-z0-9][a-z0-9_-]*(?:\\/[^/]+)*$/.test(folder) ||\n folder.split('/').some((segment) => segment === '..' || segment === '.')\n )\n throw new Error('Skill files need a folder under skills/<name>.')\n}\n\n/** Fail on files the server skipped (a name clash, a rejected type), naming each with its reason. */\nfunction throwOnSkipped(result: { skipped?: { file_name: string; reason: string }[] | null }) {\n if (result.skipped?.length)\n throw new Error(result.skipped.map((file) => `${file.file_name}: ${file.reason}`).join('; '))\n}\n\n/**\n * Save a SKILL.md as the user's own skill `slug` (`arbi.assistant.uploadSkill`): private unless\n * `shared`. Pass `shared: isSharedSkill(skill)` from `@arbidocs/sdk` when changing an existing\n * skill, so a shared one stays shared and nothing else is ever published by saving.\n */\nexport function useSaveSkill() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: async ({\n slug,\n markdown,\n shared,\n }: {\n slug: string\n markdown: string\n shared?: boolean\n }): Promise<{ doc_ext_ids?: string[] }> => {\n assertSkillFolder(`skills/${slug}`)\n const result = await arbi.assistant.uploadSkill(slug, markdown, { shared })\n throwOnSkipped(result)\n return result\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.skills() }),\n })\n}\n\n/**\n * A skill's main file (SKILL.md) as text, read on demand (a skill's detail or its editor), never\n * for the whole list.\n */\nexport function useSkillSource(docExtId: string | undefined, options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.skillSource(docExtId ?? ''),\n queryFn: async () => {\n const response = await arbi.documents.download(docExtId as string)\n if (!response.ok) throw new Error(`Could not read the skill (${response.status})`)\n return response.text()\n },\n enabled: (options?.enabled ?? true) && !!docExtId && arbi.isLoggedIn,\n staleTime: 5 * 60_000,\n })\n}\n\n/** Delete a skill: its main file (only its owner may). The skill list refreshes. */\nexport function useDeleteSkill() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (docExtId: string) => arbi.documents.delete([docExtId]),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.skills() }),\n })\n}\n\n/**\n * Share a skill with everyone (`global`) or make it the owner's again (`mine`): its main file's\n * `shared` flag, which the server carries to the skill's other files. A shared name must be unique\n * (409 when someone has shared one already).\n */\nexport function useSetSkillVisibility() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({ docExtId, visibility }: { docExtId: string; visibility: 'mine' | 'global' }) =>\n arbi.documents.update([{ external_id: docExtId, shared: visibility === 'global' }]),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.skills() }),\n })\n}\n\n/** Independent agent login status, polled while its controls are visible. */\nexport function useAgentSession(agentId: string | undefined, options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.agentSession(agentId ?? ''),\n queryFn: () => arbi.agents.getSession(agentId!),\n enabled: !!agentId && arbi.isLoggedIn && (options?.enabled ?? true),\n refetchInterval: 5000,\n })\n}\nexport function useAgentChats(agentId: string | undefined) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.agentChats(agentId ?? ''),\n queryFn: () => arbi.agents.listChats(agentId!),\n enabled: !!agentId && arbi.isLoggedIn,\n refetchInterval: 5000,\n })\n}\n/** Starting or closing an agent's login changes its session, workspaces and chats, and the user's sessions. */\nfunction refreshAgentSession(qc: ReturnType<typeof useQueryClient>, agentId: string) {\n return Promise.all(\n [\n arbiQueryKeys.agentSession(agentId),\n arbiQueryKeys.agentWorkspaces(agentId),\n arbiQueryKeys.agentChats(agentId),\n arbiQueryKeys.sessions(),\n ].map((queryKey) => qc.invalidateQueries({ queryKey }))\n )\n}\n\n/** Log an owned agent in on its own (optionally into a workspace). */\nexport function useStartAgentSession() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({ agentId, workspaceId }: { agentId: string; workspaceId?: string }) =>\n arbi.agents.startSession(agentId, workspaceId),\n onSuccess: (_session, { agentId }) => refreshAgentSession(qc, agentId),\n })\n}\n\n/** Log an owned agent out. */\nexport function useCloseAgentSession() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (agentId: string) => arbi.agents.closeSession(agentId),\n onSuccess: (_result, agentId) => refreshAgentSession(qc, agentId),\n })\n}\n"],
|
|
5
|
-
"mappings": "AAeA,SAAS,WAAW,SAAS,cAAc;AAC3C,SAAS,aAAa,UAAU,sBAAwC;AAexE,SAAS,eAAe;AACxB,SAAS,2BAA2B;AACpC,SAAS,kBAAkB,eAAe,wBAAwB;AAClE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,2BAA2B;AAW7B,SAAS,cAAc,UAA8B,gBAAkC;AAC5F,QAAM,CAAC,OAAO,UAAU,IAAI,IAAI,IAAI;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B;AACrC,QAAM,OAAO,QAAQ;AACrB,QAAM,KAAK,eAAe;AAC1B,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC,EAAE,SAAS,YAAY,MAClC,KAAK,OAAO,aAAa,SAAS,WAAW;AAAA,IAC/C,WAAW,CAAC,UAAU,EAAE,QAAQ,MAAM,oBAAoB,IAAI,OAAO;AAAA,EACvE,CAAC;AACH;AAGO,SAAS,uBAAuB;AACrC,QAAM,OAAO,QAAQ;AACrB,QAAM,KAAK,eAAe;AAC1B,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC,YAAoB,KAAK,OAAO,aAAa,OAAO;AAAA,IACjE,WAAW,CAAC,SAAS,YAAY,oBAAoB,IAAI,OAAO;AAAA,EAClE,CAAC;AACH;",
|
|
4
|
+
"sourcesContent": ["/**\n * Work, workflows, agents and skills: the mutation and read hooks behind an \"AI workforce\" screen.\n *\n * A conversation with a `status` is a task: it is listed by `useConversations` and changed through\n * `useUpdateConversation` and friends (which patch the list, see `conversation-list`). A workflow is the automation that creates them. Everything\n * sits on the SDK (`arbi.conversations`, `arbi.workflows`, `arbi.agents`, `arbi.agentConfig`,\n * `arbi.workspaces`, `arbi.assistant.listSkills`) and invalidates through {@link arbiQueryKeys}, so\n * `useConversations`, `useWorkflows`, `useAgents` and `useConfigs` refresh on their own after a\n * write. Mapping a form onto these requests (`TaskComposerValues` to a create-work or create-workflow\n * request, an agent form to a persona) is the pure part and lives next to the forms in\n * `@arbidocs/blocks/agents`.\n *\n * Requires an `ArbiHost` (with an `arbi`) and a React Query client above it.\n */\n\nimport { useEffect, useMemo, useRef } from 'react'\nimport { useMutation, useQuery, useQueryClient, type QueryClient } from '@tanstack/react-query'\nimport type {\n ActivityResponse,\n ConversationResponse,\n CreateWorkRequest,\n CreateWorkflowRequest,\n PlanWorkRequest,\n StepActionRequest,\n UpdateConversationRequest,\n UpdateWorkflowRequest,\n WorkflowResponse,\n WorkflowRunResponse,\n WorkflowRunHistoryResponse,\n} from '@arbidocs/sdk/browser'\nimport type { components } from '@arbidocs/client'\nimport { useArbi } from './useArbi'\nimport { useCurrentWorkspace } from './workspaces/current'\nimport { arbiMutationKeys, arbiQueryKeys, useConversations } from './hooks'\nimport {\n addConversationToList,\n invalidateConversationDetails,\n invalidateConversationLists,\n patchConversation,\n removeConversationFromLists,\n} from './conversation-list'\nimport { useArbiSessionState } from './session'\n\n/** An agent or deployment config: section name (`Agents`, `QueryLLM`, ...) to its parameters. */\nexport type AgentConfigSections = Record<string, Record<string, unknown>>\n\n// \u2500\u2500 Conversations as work \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * Whether a React Query key is the cached activity of a task (of `conversationId`, or any): the\n * {@link useConversationActivity} key, `['arbi', 'conversations', id, 'activity']`.\n */\nexport function isActivityKey(queryKey: readonly unknown[], conversationId?: string): boolean {\n const [scope, resource, id, leaf] = queryKey\n if (scope !== 'arbi' || resource !== 'conversations' || leaf !== 'activity') return false\n return !conversationId || id === conversationId\n}\n\n/** Re-read the activity of one task (or every cached one): after a run or a patch. */\nexport function invalidateConversationActivity(queryClient: QueryClient, conversationId?: string) {\n void queryClient.invalidateQueries({\n predicate: (q) => isActivityKey(q.queryKey, conversationId),\n })\n}\n\n/** How often to re-read the list while an agent is generating. */\nconst GENERATING_POLL_MS = 2500\n\n/**\n * One poll for the whole page. Several components read the list, and each running its own timer\n * meant N times the requests, each cancelling the last. Holders share a single timer that runs\n * while at least one of them needs it; the returned function lets go.\n */\nlet listPollHolders = 0\nlet listPollTimer: ReturnType<typeof setInterval> | undefined\nlet listPollRefetch: (() => unknown) | undefined\n\nfunction holdListPoll(refetch: () => unknown): () => void {\n listPollRefetch = refetch\n listPollHolders += 1\n if (listPollTimer === undefined) {\n listPollTimer = setInterval(() => void listPollRefetch?.(), GENERATING_POLL_MS)\n }\n return () => {\n listPollHolders -= 1\n if (listPollHolders === 0 && listPollTimer !== undefined) {\n clearInterval(listPollTimer)\n listPollTimer = undefined\n }\n }\n}\n\n/**\n * The open workspace's conversations, and among them its tasks: the ones that have a `status` (a\n * plain chat has none). One list serves both: a task is a conversation with a status.\n *\n * The list is seeded once and patched by writes, so a run that finishes server-side is picked up by\n * re-reading it while any task is generating. A task whose status or update time changed has a\n * stale history, which is re-read.\n */\nexport function useConversationItems() {\n // Not the id alone: it lands before the workspace is open, and the list is read once.\n const workspaceId = useArbiSessionState((s) => s.workspaceId)\n const open = useArbiSessionState((s) => s.workspaceStatus === 'open')\n const query = useConversations(workspaceId ?? undefined, { enabled: open })\n const { refetch } = query\n const all = query.data\n const tasks = useMemo(() => (all ?? []).filter((c) => c.status != null), [all])\n const queryClient = useQueryClient()\n const seen = useRef(new Map<string, string>())\n useEffect(() => {\n for (const t of tasks) {\n const stamp = `${t.status}|${t.updated_at ?? ''}`\n const before = seen.current.get(t.external_id)\n if (before !== undefined && before !== stamp) {\n invalidateConversationActivity(queryClient, t.external_id)\n }\n seen.current.set(t.external_id, stamp)\n }\n }, [tasks, queryClient])\n const generating = tasks.some((t) => t.in_progress || t.status === 'generating')\n useEffect(() => (generating ? holdListPoll(refetch) : undefined), [generating, refetch])\n return { conversations: all ?? [], tasks, isLoading: query.isLoading, refetch }\n}\n\n/** Whether the open conversation is shared (a thread with people in it), from the list. */\nexport function useConversationIsShared(): boolean {\n const id = useArbiSessionState((state) => state.conversationId)\n const { conversations } = useConversationItems()\n return conversations.find((conversation) => conversation.external_id === id)?.is_shared ?? false\n}\n\n/** The open workspace's tasks only: the conversations that have a `status`. */\nexport function useWorkItems() {\n const { tasks, isLoading, refetch } = useConversationItems()\n return { tasks, isLoading, refetch }\n}\n\n/**\n * The signed-in person's role in the open workspace (`owner`, `collaborator`, `guest`), or null when\n * they are not a member: their entry in the workspace's own member list.\n */\nexport function useWorkspaceRole() {\n return useCurrentWorkspace().role\n}\n\n/**\n * Whether the viewer edits the open workspace (owner or collaborator). A task or workflow they do\n * not own is always shared with them, and editors may then change it; guests only read. Sharing and\n * deleting stay with the row's owner, which the row itself says (`is_owner`).\n */\nexport function useCanEditShared(): boolean {\n const role = useWorkspaceRole()\n return role === 'owner' || role === 'collaborator'\n}\n\n/** Whether the viewer owns the open workspace: with an item's creator, the only one who shares or deletes it. */\nexport function useIsWorkspaceOwner(): boolean {\n return useWorkspaceRole() === 'owner'\n}\n\n/**\n * The run was accepted, but the thread it creates did not show up within the lookup. The task is\n * running, so starting it again would make a second one: look for its thread again with\n * `findThread(messageId)` instead.\n */\nexport class TaskThreadPendingError extends Error {\n constructor(readonly messageId: string) {\n super(\"The task has started, but its thread isn't ready yet.\")\n this.name = 'TaskThreadPendingError'\n }\n}\n\n/** Looking up the thread a just-accepted run is creating: how many tries, how far apart. */\nconst THREAD_LOOKUP_ATTEMPTS = 20\nconst THREAD_LOOKUP_DELAY_MS = 500\n\n/** A run that makes its thread a task, as the person asking (see `ThreadQuery` in blocks). */\nexport interface StartTaskQuery {\n input: string\n workspaceId: string\n docIds: string[]\n mentions?: Parameters<ReturnType<typeof useArbi>['assistant']['submit']>[1]['mentions']\n task?: Parameters<ReturnType<typeof useArbi>['assistant']['submit']>[1]['task']\n}\n\n/**\n * Run now: a background response whose `task` options make its thread a task (generating, then\n * open again). It runs as the person asking, so there is no stream to hold open: the response\n * carries the message id, from which the thread is found and the list re-read. A bad parent is\n * refused before anything is created. Resolves with the new thread's id; the run uses the chat's\n * model choice, else the person's last config.\n */\nexport function useStartTaskQuery() {\n const arbi = useArbi()\n const queryClient = useQueryClient()\n const chatModel = useArbiSessionState((s) => s.chatModel)\n const post = useMutation({\n mutationFn: (query: StartTaskQuery) => {\n const selectedConfig =\n chatModel ||\n queryClient\n .getQueriesData<{ last_config?: string }>({ queryKey: arbiQueryKeys.userSettings() })\n .map(([, settings]) => settings?.last_config)\n .find(Boolean)\n // The run goes to the workspace the query names (opened for this session if it is not the\n // current one), never to whichever workspace the session has open when it is sent.\n return arbi.assistant.submit(query.input, {\n workspaceId: query.workspaceId,\n docIds: query.docIds,\n fullContext: false,\n ...(selectedConfig ? { model: selectedConfig } : {}),\n ...(query.mentions !== undefined ? { mentions: query.mentions } : {}),\n ...(query.task !== undefined ? { task: query.task } : {}),\n })\n },\n })\n /**\n * The thread of a run, read from the run itself (`GET /v1/responses/{id}`, which answers while the\n * run is live): undefined while the run has not created it yet. Once the run has posted its\n * question the thread exists (its `arbi.user_message` event names it); a finished run's message is\n * stored with its thread. Asking for the message of a run still setting up would be a 404.\n */\n const threadOf = async (\n messageId: string,\n known?: string | null\n ): Promise<string | undefined> => {\n const response = await arbi.assistant.getResponse(messageId)\n const events = (response.metadata?.events ?? []) as {\n type?: string\n conversation_ext_id?: string\n }[]\n const posted = events.find((e) => e.type === 'arbi.user_message')?.conversation_ext_id\n if (posted) return posted\n if (response.status === 'queued' || response.status === 'in_progress') return undefined\n return known || (await arbi.conversations.getMessage(messageId)).conversation_ext_id\n }\n /** The thread a run is creating, looked up `attempts` times; null while it is not there yet. */\n const lookUpThread = async (\n messageId: string,\n attempts: number,\n known?: string | null\n ): Promise<{ conversationId: string } | null> => {\n let conversationId: string | undefined\n for (let attempt = 0; attempt < attempts && !conversationId; attempt += 1) {\n if (attempt > 0) await new Promise((r) => setTimeout(r, THREAD_LOOKUP_DELAY_MS))\n try {\n conversationId = await threadOf(messageId, known)\n } catch (error) {\n // A 404 is a run another server instance has not marked live yet; anything else (a\n // refusal) is not worth waiting on.\n if (!(error && typeof error === 'object' && 'status' in error && error.status === 404))\n throw error\n }\n }\n if (!conversationId) return null\n // The new task is not in the cached list yet: read it again.\n await invalidateConversationLists(queryClient)\n return { conversationId }\n }\n return {\n isPending: post.isPending,\n /** Look again for the thread of a run whose start threw {@link TaskThreadPendingError}. */\n findThread: (messageId: string) => lookUpThread(messageId, 1),\n start: async (query: StartTaskQuery): Promise<{ conversationId: string }> => {\n const accepted = await post.mutateAsync(query)\n const found = await lookUpThread(\n accepted.id,\n THREAD_LOOKUP_ATTEMPTS,\n accepted.conversation_ext_id\n )\n if (!found) throw new TaskThreadPendingError(accepted.id)\n return found\n },\n }\n}\n\n/**\n * Patch a conversation: rename it, share it or make it private (`shared`, owner only), or change\n * its work fields (description, due date, parent, `status` `todo | done`, plan).\n * The one write behind title edits, the share toggle and marking a task done.\n */\nexport function useUpdateConversation() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({\n conversationId,\n patch,\n }: {\n conversationId: string\n patch: UpdateConversationRequest\n }): Promise<ConversationResponse> => arbi.conversations.update(conversationId, patch),\n // The list takes the server's version of the row; what hangs off it is read again.\n onSuccess: (updated, { conversationId }) => {\n patchConversation(qc, conversationId, updated)\n return invalidateConversationDetails(qc, conversationId)\n },\n })\n}\n\n/** Delete a conversation (thread or task); it leaves every cached list at once. */\nexport function useDeleteConversation() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (conversationId: string) => arbi.conversations.delete(conversationId),\n onSuccess: (_res, conversationId) => removeConversationFromLists(qc, conversationId),\n })\n}\n\n/** The workspace a work call names: the one given, else the one open now (none: the SDK's). */\nfunction workWorkspace(arbi: ReturnType<typeof useArbi>, workspaceId?: string | null) {\n return workspaceId || (arbi.hasWorkspace ? arbi.getWorkspaceId() : undefined)\n}\n\n/**\n * Search the past conversation messages (keyword + semantic, grouped) of `workspaceId`, else of\n * the workspace open when it is sent.\n */\nexport function useConversationSearch(workspaceId?: string | null) {\n const arbi = useArbi()\n return useMutation({\n mutationFn: (body: components['schemas']['ConversationSearchRequest']) =>\n arbi.conversations.search(body, { workspaceId: workWorkspace(arbi, workspaceId) }),\n })\n}\n\n/**\n * Create a work item from a `CreateWorkRequest`: a plain to-do, or (with a prompt or skill) agent\n * work that starts at once. It is made in `options.workspaceId` (the page's), else in the workspace\n * open when it is sent; the request names it, and it joins that workspace's list. Resolves with the\n * created conversation.\n */\nexport function useCreateWork(options?: { workspaceId?: string | null }) {\n const arbi = useArbi()\n const qc = useQueryClient()\n const named = options?.workspaceId\n return useMutation({\n // The workspace is read once, when the request is sent: the request names it and the new work\n // joins that workspace's list, so one switched to while it is in flight neither receives it\n // nor lists it.\n mutationFn: async (body: CreateWorkRequest): Promise<ConversationResponse> => {\n const workspaceId = workWorkspace(arbi, named)\n const created = await arbi.conversations.createWork(body, { workspaceId })\n addConversationToList(qc, workspaceId ?? null, created)\n return created\n },\n })\n}\n\n/**\n * Start a saved workflow (`wfl-\u2026`) in a workspace (`workspaceId`, absent: the current one): the run\n * is a thread there with a copy of the workflow's steps. The workflow may live in another workspace\n * the person also belongs to (the skills workspace). The new thread joins that workspace's list.\n */\nexport function useStartWorkflow() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationKey: arbiMutationKeys.startWorkflow(),\n mutationFn: async ({\n workflowId,\n workspaceId,\n inputs,\n title,\n }: {\n workflowId: string\n workspaceId?: string | null\n inputs?: Record<string, unknown>\n title?: string\n }): Promise<ConversationResponse> => {\n const target = workWorkspace(arbi, workspaceId ?? undefined)\n const created = await arbi.workflows.start(workflowId, {\n workspaceId: target ?? undefined,\n inputs,\n title,\n })\n addConversationToList(qc, target ?? null, created)\n return created\n },\n })\n}\n\n/** One saved workflow with its steps (its own workspace's key deposited on the session to read them). */\nexport function useSavedWorkflow(workflowId: string | undefined, options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.workflow(workflowId ?? ''),\n queryFn: (): Promise<WorkflowResponse> => arbi.workflows.get(workflowId!),\n enabled: !!workflowId && (options?.enabled ?? true),\n })\n}\n\n/**\n * Run a work item now, or retry it. A run parked waiting for workspace access (a temporary\n * authorization tier) is granted a temporary, session-scoped key and run again, so the person\n * clicking Run authorizes it. Resolves with the updated conversation.\n */\nexport function useRunConversation() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (conversationId: string): Promise<ConversationResponse> =>\n arbi.conversations.runWithAuth(conversationId),\n // The server's version replaces the listed one; everything under the conversation is re-read.\n onSuccess: (updated) => {\n if (updated?.external_id) patchConversation(qc, updated.external_id, updated)\n return qc.invalidateQueries({ queryKey: arbiQueryKeys.allConversations() })\n },\n })\n}\n\n/**\n * Complete or skip a step of a workflow run (a form, an upload, a review's approval). The run then\n * starts its next agent step; the listed conversation is replaced and its activity re-read.\n */\nexport function useActOnStep() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({\n conversationId,\n body,\n }: {\n conversationId: string\n body: StepActionRequest\n }): Promise<ConversationResponse> => arbi.conversations.actOnStep(conversationId, body),\n // The server's version of the conversation replaces the listed one; its history is re-read.\n onSuccess: (updated) => {\n if (!updated?.external_id) return\n patchConversation(qc, updated.external_id, updated)\n invalidateConversationActivity(qc, updated.external_id)\n },\n })\n}\n\n/**\n * Draft an editable plan (goal and acceptance checklist) from an objective, for a task in\n * `workspaceId`, else in the workspace open when it is sent.\n */\nexport function usePlanWork(workspaceId?: string | null) {\n const arbi = useArbi()\n return useMutation({\n mutationFn: (body: PlanWorkRequest) =>\n arbi.conversations.plan(body, { workspaceId: workWorkspace(arbi, workspaceId) }),\n })\n}\n\n/**\n * The agent run-session key a parked run waits for the owner to allow (public key and email,\n * non-secret). Enabled only while the run is waiting; 404 otherwise.\n */\nexport function useConversationPendingAuth(\n conversationId: string | undefined,\n options?: { enabled?: boolean }\n) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.conversationPendingAuth(conversationId ?? ''),\n queryFn: () => arbi.conversations.pendingAuth(conversationId as string),\n enabled: (options?.enabled ?? true) && !!conversationId && arbi.isLoggedIn,\n retry: false,\n })\n}\n\n/**\n * A task's history, oldest first (created, run started, handed off, sent back, done, ...). Cached\n * under the conversations prefix, so every task write that invalidates the list refreshes it too.\n * Pass `live` while a run is generating to re-read it every few seconds.\n */\nexport function useConversationActivity(\n conversationId: string | undefined,\n options?: { enabled?: boolean; live?: boolean }\n) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.conversationActivity(conversationId ?? ''),\n queryFn: (): Promise<ActivityResponse[]> =>\n arbi.conversations.activity(conversationId as string),\n enabled: (options?.enabled ?? true) && !!conversationId && arbi.isLoggedIn,\n refetchInterval: options?.live ? 2500 : false,\n })\n}\n\n// \u2500\u2500 Workflows \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** The caller's workflows (their own, and the ones shared with the open workspace). */\nexport function useWorkflows(options?: { enabled?: boolean; live?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.workflows(),\n queryFn: (): Promise<WorkflowResponse[]> => arbi.workflows.list(),\n // A clock or event can fire while the list is open, without a write here.\n refetchInterval: options?.live ? 10_000 : false,\n enabled: (options?.enabled ?? true) && arbi.isLoggedIn,\n })\n}\n\n/** A workflow's runs, re-read every few seconds while shown (a run moves on by itself). */\nexport function useWorkflowRuns(workflowId: string | undefined) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.workflowRuns(workflowId ?? ''),\n queryFn: (): Promise<WorkflowRunHistoryResponse[]> => arbi.workflows.runs(workflowId as string),\n enabled: !!workflowId && arbi.isLoggedIn,\n refetchInterval: 3000,\n staleTime: 0,\n refetchOnMount: 'always',\n })\n}\n\n/** Refresh the workflow list now (e.g. after the assistant saved one from chat). */\nexport function useInvalidateWorkflows(): () => Promise<void> {\n const qc = useQueryClient()\n return () => qc.invalidateQueries({ queryKey: arbiQueryKeys.workflows() })\n}\n\n/** Create a workflow from a `CreateWorkflowRequest`. Resolves with the created workflow. */\nexport function useCreateWorkflow() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (body: CreateWorkflowRequest): Promise<WorkflowResponse> =>\n arbi.workflows.create(body),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.workflows() }),\n })\n}\n\n/** Patch a workflow: pause or resume it (`active`), share it, or change its trigger or action. */\nexport function useUpdateWorkflow() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({\n workflowId,\n patch,\n }: {\n workflowId: string\n patch: UpdateWorkflowRequest\n }): Promise<WorkflowResponse> => arbi.workflows.update(workflowId, patch),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.workflows() }),\n })\n}\n\nexport function useDeleteWorkflow() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (workflowId: string) => arbi.workflows.delete(workflowId),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.workflows() }),\n })\n}\n\n/**\n * Run a workflow now. Resolves with the conversation it created\n * (`conversation_ext_id`), which joins the conversation list.\n */\nexport function useRunWorkflow() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationKey: arbiMutationKeys.runWorkflow(),\n mutationFn: (workflowId: string): Promise<WorkflowRunResponse> =>\n arbi.workflows.run(workflowId),\n onSuccess: () =>\n Promise.all([\n qc.invalidateQueries({ queryKey: arbiQueryKeys.workflows() }),\n qc.invalidateQueries({ queryKey: arbiQueryKeys.allConversations() }),\n ]),\n })\n}\n\n// \u2500\u2500 Agents \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** Create an agent by name. The one-time `signing_private_key` is in the result. */\nexport function useCreateAgent() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (name: string) => arbi.agents.create(name),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.agents() }),\n })\n}\n\n/**\n * Generate an avatar for an owned agent from a prompt and set it as its picture. Resolves with the\n * agent (`picture` set); the agent list refreshes.\n */\nexport function useGenerateAgentAvatar() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({ agentExtId, prompt }: { agentExtId: string; prompt: string }) =>\n arbi.agents.generateAvatar(agentExtId, prompt),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.agents() }),\n })\n}\n\n/** The default and maximum lifetime of a temporary agent authorization (seconds). */\nexport function useAuthorizeLimits(options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.authorizeLimits(),\n queryFn: () => arbi.agents.authorizeLimits(),\n enabled: (options?.enabled ?? true) && arbi.isLoggedIn,\n })\n}\n\n/** The MCP tools registered on the deployment, for an agent's tool picker. */\nexport function useMcpTools(options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.mcpTools(),\n queryFn: () => arbi.health.mcpTools(),\n enabled: (options?.enabled ?? true) && arbi.isLoggedIn,\n })\n}\n\n/**\n * An agent's pinned config (persona, model, tool switches), or the library default config when\n * `agentExtId` is omitted: edit forms seed from the first, create forms from the second.\n */\nexport function useAgentConfig(agentExtId?: string, options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.agentConfig(agentExtId),\n queryFn: async () =>\n (agentExtId\n ? await arbi.agents.getConfig(agentExtId)\n : await arbi.agentConfig.get('default')) as AgentConfigSections | null,\n enabled: (options?.enabled ?? true) && arbi.isLoggedIn,\n })\n}\n\n/** The model names an agent may be pinned to. */\nexport function useAgentModels(options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.models(),\n queryFn: async () => (await arbi.agentConfig.getModels()).models.map((m) => m.model_name),\n enabled: (options?.enabled ?? true) && arbi.isLoggedIn,\n })\n}\n\nexport interface SaveAgentConfigVars {\n agentExtId: string\n /** Config title; defaults to `agent-<agentExtId>`. */\n title?: string\n /**\n * Parameters to set, per section, e.g. `{ Agents: { PERSONA: '...', WEB_SEARCH_ENABLED: true } }`.\n * Merged key by key over the agent's current config (or the default one for a new agent).\n */\n sections: AgentConfigSections\n}\n\n/** Pin a behaviour config to an agent: read its current config, merge `sections` over it, save. */\nexport function useSaveAgentConfig() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: async ({ agentExtId, title, sections }: SaveAgentConfigVars) => {\n const pinned = (await arbi.agents.getConfig(agentExtId)) as AgentConfigSections | null\n const base = pinned ?? ((await arbi.agentConfig.get('default')) as AgentConfigSections)\n const merged: AgentConfigSections = structuredClone(base)\n for (const [section, params] of Object.entries(sections)) {\n merged[section] = { ...(merged[section] ?? {}), ...params }\n }\n return arbi.agentConfig.save({\n ...merged,\n agent_ext_id: agentExtId,\n title: title ?? `agent-${agentExtId}`,\n } as never)\n },\n onSuccess: (_saved, { agentExtId }) =>\n Promise.all([\n qc.invalidateQueries({ queryKey: arbiQueryKeys.configs() }),\n qc.invalidateQueries({ queryKey: arbiQueryKeys.agentConfig(agentExtId) }),\n // The agent list shows the pinned persona/model, so it refreshes too.\n qc.invalidateQueries({ queryKey: arbiQueryKeys.agents() }),\n ]),\n })\n}\n\n/** The workspaces an agent can currently open (`permanent` tells standing from temporary). */\nexport function useAgentWorkspaces(\n agentExtId: string | undefined,\n options?: { enabled?: boolean }\n) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.agentWorkspaces(agentExtId ?? ''),\n queryFn: () => arbi.agents.listWorkspaces(agentExtId as string),\n enabled: (options?.enabled ?? true) && !!agentExtId && arbi.isLoggedIn,\n })\n}\n\n/** How an agent is given a workspace. */\nexport type AgentAccessMode =\n /** A standing member: the agent can open the workspace while the owner is away. */\n | { kind: 'standing' }\n /** A TTL'd, session-scoped key: gone when the run session ends. `ttlSeconds` omitted = default. */\n | { kind: 'temporary'; ttlSeconds?: number }\n\nexport interface GrantAgentAccessVars {\n agentExtId: string\n workspaceId: string\n /** Default `{ kind: 'standing' }`. */\n mode?: AgentAccessMode\n}\n\n/**\n * Give an agent access to a workspace you own. Standing access adds the agent as a member without\n * switching the open workspace; temporary access mints the agent's run session and deposits a\n * session-scoped key on it (the `session_pubkey_b64` path).\n */\nexport function useGrantAgentAccess() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: async ({\n agentExtId,\n workspaceId,\n mode = { kind: 'standing' },\n }: GrantAgentAccessVars) => {\n if (mode.kind === 'temporary') {\n return arbi.agents.grantTemporaryAccess(agentExtId, workspaceId, mode.ttlSeconds)\n }\n const agent = (await arbi.agents.list()).find((a) => a.external_id === agentExtId)\n if (!agent?.email) throw new Error(\"The agent's address is unknown.\")\n return arbi.workspaces.grantAccess({ workspaceId, emails: [agent.email] })\n },\n onSuccess: (_res, { agentExtId, mode }) => {\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.agentWorkspaces(agentExtId) })\n // Temporary access is a new run session: the session list shows it.\n if (mode?.kind === 'temporary')\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.sessions() })\n },\n })\n}\n\n/**\n * Take an agent out of a workspace (owner only). The workspace is named on the request (opened for\n * the session, not switched to), so the app's current workspace never changes.\n */\nexport function useRevokeAgentAccess() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({ agentExtId, workspaceId }: { agentExtId: string; workspaceId: string }) =>\n arbi.workspaces.removeUsers([agentExtId], { workspaceId }),\n onSuccess: (_res, { agentExtId }) =>\n qc.invalidateQueries({ queryKey: arbiQueryKeys.agentWorkspaces(agentExtId) }),\n })\n}\n\n// \u2500\u2500 Skills \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * The skills the user can run (own plus the shared marketplace), metadata only. Without a\n * deployment marketplace the server lists a workspace's skills, so the list is kept per workspace\n * and the request names the open one: a switch while it runs cannot answer for another.\n */\nexport function useSkills(options?: {\n enabled?: boolean\n includeHidden?: boolean\n live?: boolean\n}) {\n const arbi = useArbi()\n const workspaceId = arbi.hasWorkspace ? arbi.getWorkspaceId() : ''\n return useQuery({\n queryKey: arbiQueryKeys.skillList(workspaceId, options?.includeHidden ?? false),\n queryFn: () =>\n arbi.assistant.listSkills({\n includeHidden: options?.includeHidden,\n workspaceId: workspaceId || undefined,\n }),\n refetchInterval: options?.live ? 5000 : false,\n enabled: (options?.enabled ?? true) && arbi.isLoggedIn,\n staleTime: 30_000,\n })\n}\n\n/**\n * Upload skill files through the same document path as the main application. A skill is the\n * uploader's own (`mine`) unless an entry says `shared` (everyone's, as \"Share with everyone\" makes\n * it): saving a private skill again never publishes it.\n */\nexport function useUploadSkillFiles() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: async (\n entries: {\n folder: string\n fileName: string\n content: Blob\n shared?: boolean\n /** Explicit target, already open/primed on this session. Uses session-gated upload. */\n workspaceId?: string\n }[]\n ): Promise<{ doc_ext_ids?: string[] }[]> => {\n if (!entries.length) throw new Error('Choose at least one skill file.')\n for (const entry of entries) assertSkillFolder(entry.folder)\n const results = []\n for (const entry of entries) {\n const options = {\n folder: entry.folder,\n wpType: 'skill' as const,\n shared: entry.shared ?? false,\n }\n const result = entry.workspaceId\n ? await arbi.documents.upload(\n [new File([entry.content], entry.fileName, { type: entry.content.type })],\n { ...options, workspaceExtId: entry.workspaceId }\n )\n : await arbi.documents.uploadFile(entry.content, entry.fileName, options)\n throwOnSkipped(result)\n results.push(result)\n }\n return results\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.skills() }),\n })\n}\n\n/** A skill's files live under `skills/<slug>/`, never outside it. */\nfunction assertSkillFolder(folder: string) {\n if (\n !/^skills\\/[a-z0-9][a-z0-9_-]*(?:\\/[^/]+)*$/.test(folder) ||\n folder.split('/').some((segment) => segment === '..' || segment === '.')\n )\n throw new Error('Skill files need a folder under skills/<name>.')\n}\n\n/** Fail on files the server skipped (a name clash, a rejected type), naming each with its reason. */\nfunction throwOnSkipped(result: { skipped?: { file_name: string; reason: string }[] | null }) {\n if (result.skipped?.length)\n throw new Error(result.skipped.map((file) => `${file.file_name}: ${file.reason}`).join('; '))\n}\n\n/**\n * Save a SKILL.md as the user's own skill `slug` (`arbi.assistant.uploadSkill`): private unless\n * `shared`. Pass `shared: isSharedSkill(skill)` from `@arbidocs/sdk` when changing an existing\n * skill, so a shared one stays shared and nothing else is ever published by saving.\n */\nexport function useSaveSkill() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: async ({\n slug,\n markdown,\n shared,\n }: {\n slug: string\n markdown: string\n shared?: boolean\n }): Promise<{ doc_ext_ids?: string[] }> => {\n assertSkillFolder(`skills/${slug}`)\n const result = await arbi.assistant.uploadSkill(slug, markdown, { shared })\n throwOnSkipped(result)\n return result\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.skills() }),\n })\n}\n\n/**\n * A skill's main file (SKILL.md) as text, read on demand (a skill's detail or its editor), never\n * for the whole list.\n */\nexport function useSkillSource(docExtId: string | undefined, options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.skillSource(docExtId ?? ''),\n queryFn: async () => {\n const response = await arbi.documents.download(docExtId as string)\n if (!response.ok) throw new Error(`Could not read the skill (${response.status})`)\n return response.text()\n },\n enabled: (options?.enabled ?? true) && !!docExtId && arbi.isLoggedIn,\n staleTime: 5 * 60_000,\n })\n}\n\n/** Delete a skill: its main file (only its owner may). The skill list refreshes. */\nexport function useDeleteSkill() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (docExtId: string) => arbi.documents.delete([docExtId]),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.skills() }),\n })\n}\n\n/**\n * Share a skill with everyone (`global`) or make it the owner's again (`mine`): its main file's\n * `shared` flag, which the server carries to the skill's other files. A shared name must be unique\n * (409 when someone has shared one already).\n */\nexport function useSetSkillVisibility() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({ docExtId, visibility }: { docExtId: string; visibility: 'mine' | 'global' }) =>\n arbi.documents.update([{ external_id: docExtId, shared: visibility === 'global' }]),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.skills() }),\n })\n}\n\n/** Independent agent login status, polled while its controls are visible. */\nexport function useAgentSession(agentId: string | undefined, options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.agentSession(agentId ?? ''),\n queryFn: () => arbi.agents.getSession(agentId!),\n enabled: !!agentId && arbi.isLoggedIn && (options?.enabled ?? true),\n refetchInterval: 5000,\n })\n}\nexport function useAgentChats(agentId: string | undefined) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.agentChats(agentId ?? ''),\n queryFn: () => arbi.agents.listChats(agentId!),\n enabled: !!agentId && arbi.isLoggedIn,\n refetchInterval: 5000,\n })\n}\n/** Starting or closing an agent's login changes its session, workspaces and chats, and the user's sessions. */\nfunction refreshAgentSession(qc: ReturnType<typeof useQueryClient>, agentId: string) {\n return Promise.all(\n [\n arbiQueryKeys.agentSession(agentId),\n arbiQueryKeys.agentWorkspaces(agentId),\n arbiQueryKeys.agentChats(agentId),\n arbiQueryKeys.sessions(),\n ].map((queryKey) => qc.invalidateQueries({ queryKey }))\n )\n}\n\n/** Log an owned agent in on its own (optionally into a workspace). */\nexport function useStartAgentSession() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({ agentId, workspaceId }: { agentId: string; workspaceId?: string }) =>\n arbi.agents.startSession(agentId, workspaceId),\n onSuccess: (_session, { agentId }) => refreshAgentSession(qc, agentId),\n })\n}\n\n/** Log an owned agent out. */\nexport function useCloseAgentSession() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (agentId: string) => arbi.agents.closeSession(agentId),\n onSuccess: (_result, agentId) => refreshAgentSession(qc, agentId),\n })\n}\n"],
|
|
5
|
+
"mappings": "AAeA,SAAS,WAAW,SAAS,cAAc;AAC3C,SAAS,aAAa,UAAU,sBAAwC;AAexE,SAAS,eAAe;AACxB,SAAS,2BAA2B;AACpC,SAAS,kBAAkB,eAAe,wBAAwB;AAClE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,2BAA2B;AAW7B,SAAS,cAAc,UAA8B,gBAAkC;AAC5F,QAAM,CAAC,OAAO,UAAU,IAAI,IAAI,IAAI;AACpC,MAAI,UAAU,UAAU,aAAa,mBAAmB,SAAS,WAAY,QAAO;AACpF,SAAO,CAAC,kBAAkB,OAAO;AACnC;AAGO,SAAS,+BAA+B,aAA0B,gBAAyB;AAChG,OAAK,YAAY,kBAAkB;AAAA,IACjC,WAAW,CAAC,MAAM,cAAc,EAAE,UAAU,cAAc;AAAA,EAC5D,CAAC;AACH;AAGA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WAAW,WAAW,EAAE;AAAA,IAChD,SAAS,MAAM,KAAK,OAAO,UAAU,OAAQ;AAAA,IAC7C,SAAS,CAAC,CAAC,WAAW,KAAK;AAAA,IAC3B,iBAAiB;AAAA,EACnB,CAAC;AACH;AAEA,SAAS,oBAAoB,IAAuC,SAAiB;AACnF,SAAO,QAAQ;AAAA,IACb;AAAA,MACE,cAAc,aAAa,OAAO;AAAA,MAClC,cAAc,gBAAgB,OAAO;AAAA,MACrC,cAAc,WAAW,OAAO;AAAA,MAChC,cAAc,SAAS;AAAA,IACzB,EAAE,IAAI,CAAC,aAAa,GAAG,kBAAkB,EAAE,SAAS,CAAC,CAAC;AAAA,EACxD;AACF;AAGO,SAAS,uBAAuB;AACrC,QAAM,OAAO,QAAQ;AACrB,QAAM,KAAK,eAAe;AAC1B,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC,EAAE,SAAS,YAAY,MAClC,KAAK,OAAO,aAAa,SAAS,WAAW;AAAA,IAC/C,WAAW,CAAC,UAAU,EAAE,QAAQ,MAAM,oBAAoB,IAAI,OAAO;AAAA,EACvE,CAAC;AACH;AAGO,SAAS,uBAAuB;AACrC,QAAM,OAAO,QAAQ;AACrB,QAAM,KAAK,eAAe;AAC1B,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC,YAAoB,KAAK,OAAO,aAAa,OAAO;AAAA,IACjE,WAAW,CAAC,SAAS,YAAY,oBAAoB,IAAI,OAAO;AAAA,EAClE,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arbidocs/react",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.149",
|
|
4
4
|
"description": "React hooks and provider for the ARBI SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -117,8 +117,8 @@
|
|
|
117
117
|
"build-storybook": "storybook build"
|
|
118
118
|
},
|
|
119
119
|
"dependencies": {
|
|
120
|
-
"@arbidocs/client": "0.5.
|
|
121
|
-
"@arbidocs/sdk": "0.5.
|
|
120
|
+
"@arbidocs/client": "0.5.149",
|
|
121
|
+
"@arbidocs/sdk": "0.5.149",
|
|
122
122
|
"@didit-protocol/sdk-web": "0.4.0",
|
|
123
123
|
"@livekit/components-react": "2.9.24",
|
|
124
124
|
"@radix-ui/react-avatar": "^1.2.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/host/config.ts","../src/useArbi.ts","../src/query-keys.ts"],"names":["useContext","ArbiHostContext"],"mappings":";;;;;AA4HO,SAAS,WAAA,GAA8B;AAC5C,EAAA,OAAOA,iBAAWC,iCAAe,CAAA;AACnC;;;ACvHO,SAAS,OAAA,GAAgB;AAC9B,EAAA,MAAM,EAAE,IAAA,EAAK,GAAI,WAAA,EAAY;AAC7B,EAAA,IAAI,CAAC,IAAA,EAAM;AACT,IAAA,MAAM,IAAI,MAAM,0DAA0D,CAAA;AAAA,EAC5E;AACA,EAAA,OAAO,IAAA;AACT;AAOO,SAAS,mBAAA,GAA0C;AACxD,EAAA,OAAO,WAAA,EAAY,CAAE,IAAA,EAAM,mBAAA,EAAoB;AACjD;;;ACNO,IAAM,aAAA,GAAgB;AAAA,EAC3B,UAAA,EAAY,MAAM,CAAC,MAAA,EAAQ,YAAY,CAAA;AAAA,EACvC,WAAW,CAAC,EAAA,KAAe,CAAC,MAAA,EAAQ,aAAa,EAAE,CAAA;AAAA,EACnD,YAAA,EAAc,CAAC,EAAA,EAAY,MAAA,KAAoB,CAAC,MAAA,EAAQ,cAAA,EAAgB,IAAI,MAAM,CAAA;AAAA,EAClF,UAAA,EAAY,MAAM,CAAC,MAAA,EAAQ,YAAY,CAAA;AAAA;AAAA,EAEvC,iBAAA,EAAmB,MAAM,CAAC,MAAA,EAAQ,gBAAgB,CAAA;AAAA,EAClD,gBAAgB,CAAC,WAAA,KAAwB,CAAC,MAAA,EAAQ,k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A,EAAU,MAAM,CAAC,MAAA,EAAQ,QAAQ,UAAU,CAAA;AAAA;AAAA,EAE3C,YAAA,EAAc,CAAC,SAAA,EAA+B,OAAA,KAC5C,CAAC,MAAA,EAAQ,MAAA,EAAQ,eAAA,EAAiB,SAAA,EAAW,OAAO,CAAA;AAAA,EACtD,cAAA,EAAgB,CAAC,SAAA,EAAmB,SAAA,EAAmB,YAAA,KACrD,CAAC,MAAA,EAAQ,MAAA,EAAQ,iBAAA,EAAmB,SAAA,EAAW,SAAA,EAAW,YAAY;AAC1E;AAMO,IAAM,mBAAmB,CAC9B,WAAA,EACA,SACA,IAAA,KAEA,OAAA,KAAY,SACP,CAAC,MAAA,EAAQ,eAAA,EAAiB,WAAW,IACrC,CAAC,MAAA,EAAQ,iBAAiB,WAAA,EAAa,OAAA,EAAS,QAAQ,KAAK;AAG7D,SAAS,eAAA,CAAgB,UAA8B,MAAA,EAAqC;AACjG,EAAA,OAAO,MAAA,CAAO,MAAM,CAAC,IAAA,EAAM,MAAM,QAAA,CAAS,CAAC,MAAM,IAAI,CAAA;AACvD","file":"chunk-5FQB5F2F.cjs","sourcesContent":["/**\n * What a host hands the `@arbidocs/react` hooks, as one configuration (`<ArbiHost config>`). Every\n * field is optional: without one the hooks use their own default. `@arbidocs/blocks` extends it\n * with the blocks domains (environment, billing, viewer, …).\n *\n * A field whose value lives in the host's state is a hook (`use…`), called by the hooks and kits\n * that need it, so the configuration itself stays one stable object for the host's life.\n */\n\nimport { useContext } from 'react'\nimport type { Arbi } from '@arbidocs/sdk/browser'\nimport type { AccountClient } from '../account/client'\nimport type { CalendarSupport } from '../calendar/support'\nimport type { MeetingChatRef } from '../calls/meeting-chat'\nimport type { ActiveCall } from '../calls/session'\nimport type { ArbiChatHost } from '../chat/host'\nimport type { DocumentsSupport } from '../documents/support'\nimport type { MailClient } from '../mail/client'\nimport type { ArbiSessionStore } from '../session/store'\nimport type { DictateContextValue } from '../ui/DictateContext'\nimport type { EntityVocabulary } from '../entities/vocabulary'\nimport type { ArbiHostConnection } from './ArbiHost'\nimport type { ArbiFeatures } from './features'\nimport { ArbiHostContext } from './context'\nimport type { DashboardsHost } from '../datasets/registry'\n\n/** The mail client, and whether mail is on for the signed-in user. */\nexport interface MailHost {\n client: MailClient\n /**\n * Whether mail reads run (signed in and entitled), and the server session the mailbox is\n * unlocked for: unlocking runs again when it changes (`null`: none yet, nothing is unlocked).\n * Absent: on, for one session.\n */\n useStatus?: () => { enabled: boolean; sessionKey: string | null }\n /**\n * The mail waiting in this device's Outbox (written offline), by status, while `enabled` (Mail\n * switched on); the offline status counts it as waiting work. Absent: no Outbox.\n */\n useOutbox?: (enabled: boolean) => ReadonlyArray<{ status: string }>\n /** The Outbox's folder, opened through `openMail({ folder })`. */\n outboxFolder?: string\n}\n\n/** The account client of the settings kits, and whether account reads run (signed in). */\nexport interface AccountHost {\n client: AccountClient\n /** Absent: always. */\n useEnabled?: () => boolean\n}\n\n/** Where the call panel goes in the host's layout. */\nexport type CallSlotMode = 'docked' | 'main'\n\n/** What the calls need from the host: navigation and layout are the host's. */\nexport interface CallsHost {\n /**\n * Show a call's meeting chat: an end-to-end chat, or a workspace meeting thread. Absent: the\n * in-call \"Open meeting chat\" does nothing.\n */\n openMeetingChat?: (ref: MeetingChatRef) => void\n /**\n * Once connected, show the call's conversation (its chat and live transcript) beside the call.\n * Absent: nothing is shown.\n */\n showConversation?: (call: ActiveCall) => void | Promise<void>\n /**\n * The element whose box the shown call fills: the right-hand dock, or (a webinar's audience) the\n * main area. The host claims its slot while `shown` and calls `onLost` when another panel takes\n * it (the call then minimises). Absent: the call floats at the right edge.\n */\n useSlot?: (mode: CallSlotMode, shown: boolean, onLost: () => void) => HTMLElement | null\n}\n\nexport interface ArbiHostConfig {\n /**\n * The SDK on the signed-in session. A host with its own login passes one on its session\n * (`new Arbi({ url, session })`); a blocks-only site gets one from `defaultHost`. A new instance (a\n * new session, a newly opened workspace) re-renders every hook.\n */\n arbi?: Arbi\n /** The session state the kits share. Absent: an in-memory one per top-level host. */\n session?: ArbiSessionStore\n /** Live processing, uploads and the host's document actions. Absent: the package's own. */\n documents?: DocumentsSupport\n /** The calendar kept on this device and account OAuth. Absent: online only, the user's connectors. */\n calendar?: CalendarSupport\n /** Absent: mail on the `arbi` session. */\n mail?: MailHost\n /** Absent: the account on the `arbi` session. */\n account?: AccountHost\n /** Absent: calls open no meeting chat from the room. */\n calls?: CallsHost\n /**\n * The parts of the product the user switches on or off, and where each switch is kept (the user's\n * settings, or this device), read with `useFeature(name)`. The call UI also follows the `calls`\n * feature, on top of the server's calls config. Absent, or a feature not listed: on.\n */\n features?: ArbiFeatures\n /** Dictation for every `dictate` field. Absent: no mic button. */\n dictate?: DictateContextValue\n /** The sign-in layer of a blocks-only site (`defaultHost` in `@arbidocs/blocks/connect`). */\n connection?: ArbiHostConnection\n /** Where the chat engine's side effects go (documents shown, mail drafts, used-up quota). */\n chat?: ArbiChatHost\n /**\n * The site's words for the entities (`{ PROJECT: 'Matter' }`), read by every kit through\n * `getEntityLabel`. Absent: the registry's (\"Project\", \"Workspace\", \"Thread\", …).\n */\n vocabulary?: EntityVocabulary\n /**\n * What the site calls its assistant where people address it: the `@<name>` offered in a chat's\n * mention menu, the draft a shared thread starts with, and the name a message is routed to the\n * assistant on. Absent: \"ARBI\".\n */\n assistantName?: string\n /**\n * Charts and dashboards: more data sources (an external feed, a source relabelled in the site's\n * words). Pages themselves are the workspace's (`/v1/pages`). Absent: the built-in sources.\n */\n dashboards?: DashboardsHost\n}\n\n/** The host configuration in scope (`{}` outside an `<ArbiHost>`). */\nexport function useArbiHost(): ArbiHostConfig {\n return useContext(ArbiHostContext) as ArbiHostConfig\n}\n","/**\n * The `Arbi` of the host configuration (`<ArbiHost config={{ arbi }}>`).\n */\n\nimport type { Arbi } from '@arbidocs/sdk/browser'\nimport { useArbiHost } from './host/config'\n\nexport function useArbi(): Arbi {\n const { arbi } = useArbiHost()\n if (!arbi) {\n throw new Error('useArbi() needs an <ArbiHost> whose config has an `arbi`')\n }\n return arbi\n}\n\n/**\n * The deployment domain the user's keys are derived for, as the host's `Arbi` computes it\n * (`deploymentDomain`, else the API URL's hostname). `undefined` without one. The document tools\n * default their `deploymentDomain` (needed for e-signing) to it.\n */\nexport function useDeploymentDomain(): string | undefined {\n return useArbiHost().arbi?.getDeploymentDomain()\n}\n","/**\n * The one query-key factory of the ARBI front end: every React Query key and mutation key the\n * packages and the app use is built here, under `['arbi', …]`. Literal key arrays anywhere else\n * fail the `arbi/query-keys-from-factory` lint rule and `query-keys.guard.test.ts`, so a key can't\n * drift from the queries it names (a stale literal reads or invalidates nothing, silently).\n *\n * Dependency-free on purpose (types only): e2e helpers import it and pass keys into the page.\n */\n\nimport type {\n CalendarWindow,\n ListEventsParams,\n OverlayLayerName,\n RoomQuery,\n} from '@arbidocs/sdk/browser'\n\nexport const arbiQueryKeys = {\n fileShares: () => ['arbi', 'fileShares'] as const,\n fileShare: (id: string) => ['arbi', 'fileShare', id] as const,\n fileSharePdf: (id: string, status?: string) => ['arbi', 'fileSharePdf', id, status] as const,\n workspaces: () => ['arbi', 'workspaces'] as const,\n /** Every workspace's member list: what a workspace switch drops. */\n allWorkspaceUsers: () => ['arbi', 'workspaceUsers'] as const,\n workspaceUsers: (workspaceId: string) => ['arbi', 'workspaceUsers', workspaceId] as const,\n /** Every workspace's documents list: the prefix a write patches when it does not know the workspace. */\n allDocuments: () => ['arbi', 'documents'] as const,\n documents: (workspaceId: string) => ['arbi', 'documents', workspaceId] as const,\n /** One document (a viewer's); writes keep it current next to the list. */\n document: (docId: string) => ['arbi', 'document', docId] as const,\n documentsById: (docIds: string[]) =>\n ['arbi', 'documentsById', [...docIds].sort().join(',')] as const,\n /** Every workspace's near-duplicate pairs. */\n allSimilarDocuments: () => ['arbi', 'similarDocuments'] as const,\n similarDocuments: (workspaceId: string, threshold: number) =>\n ['arbi', 'similarDocuments', workspaceId, threshold] as const,\n /** Every version list: the prefix a new version invalidates. */\n allDocumentVersions: () => ['arbi', 'documentVersions'] as const,\n documentVersions: (docId: string) => ['arbi', 'documentVersions', docId] as const,\n conversations: (workspaceId: string) => ['arbi', 'conversations', workspaceId] as const,\n /** Every workspace's conversation list (and threads): the prefix a conversation write invalidates. */\n allConversations: () => ['arbi', 'conversations'] as const,\n /** A conversation's threads, under the conversations prefix (ids are unique across workspaces). */\n conversationThreads: (conversationId: string) =>\n ['arbi', 'conversations', conversationId, 'threads'] as const,\n /** One stored message with everything the server keeps on it (its trace and metadata). */\n messageDetails: (messageId: string) => ['arbi', 'messageDetails', messageId] as const,\n /** The backend's built-in slash commands. */\n assistantCommands: () => ['arbi', 'assistantCommands'] as const,\n /** Every workspace's tags (lists, tables and kinds): what a cross-workspace change refreshes. */\n allTags: () => ['arbi', 'tags'] as const,\n tags: (workspaceId: string) => ['arbi', 'tags', workspaceId] as const,\n /** Under the workspace's tags: the kinds' fields (refreshed with the tags). */\n tagKinds: (workspaceId: string) => ['arbi', 'tags', workspaceId, 'kinds'] as const,\n /** Every filtered list (a table of tags): what a tag write refreshes, the whole list aside. */\n tagLists: (workspaceId: string) => ['arbi', 'tags', workspaceId, 'list'] as const,\n /** Under the workspace's tags: a tag, doctag or fact write that invalidates `tags` refreshes it. */\n tagList: (workspaceId: string, query: string) =>\n ['arbi', 'tags', workspaceId, 'list', query] as const,\n /** A kind's fields, under the workspace's tags. */\n tagKind: (workspaceId: string, kind: string) =>\n ['arbi', 'tags', workspaceId, 'kind', kind] as const,\n /** A task's history, under the conversations prefix: every conversation write refreshes it. */\n conversationActivity: (conversationId: string) =>\n ['arbi', 'conversations', conversationId, 'activity'] as const,\n thumbnails: (docIds: string[]) => ['arbi', 'thumbnails', [...docIds].sort().join(',')] as const,\n /** Every stage of a document's parsed content. */\n parsedDocument: (docId: string) => ['arbi', 'parsedDoc', docId] as const,\n parsedDoc: (docId: string, stage: string) => ['arbi', 'parsedDoc', docId, stage] as const,\n agents: () => ['arbi', 'agents'] as const,\n sessions: () => ['arbi', 'sessions'] as const,\n health: () => ['arbi', 'health'] as const,\n workflows: () => ['arbi', 'workflows'] as const,\n /** Under `workflows()`: a workflow write or run refreshes its runs too. */\n workflowRuns: (workflowId: string) => ['arbi', 'workflows', workflowId, 'runs'] as const,\n /** Every workspace's facts: the prefix a fact write invalidates. */\n allFacts: () => ['arbi', 'facts'] as const,\n facts: (workspaceId: string) => ['arbi', 'facts', workspaceId] as const,\n configs: () => ['arbi', 'configs'] as const,\n activity: () => ['arbi', 'activity'] as const,\n /** Every transfer query (jobs, lists, plans): what a finished job refreshes. */\n allWorkspaceTransfers: () => ['arbi', 'workspaceTransfers'] as const,\n /** The caller's recent transfer jobs out of a workspace. */\n workspaceTransfers: (workspaceId: string) =>\n ['arbi', 'workspaceTransfers', 'list', workspaceId] as const,\n /** One transfer job's progress. */\n workspaceTransfer: (transferId: string) =>\n ['arbi', 'workspaceTransfers', 'job', transferId] as const,\n /** What a scope (serialised) would take in a workspace, for a mode. */\n workspaceTransferPlan: (workspaceId: string, scope: string, mode: string) =>\n ['arbi', 'workspaceTransfers', 'plan', workspaceId, scope, mode] as const,\n /**\n * A workspace's activity feed (all its pages), read `limit` entries a page (absent: the server's\n * default): each page size is its own entry, under the workspace's key.\n */\n workspaceActivity: (workspaceId: string, limit?: number) =>\n limit === undefined\n ? (['arbi', 'workspaceActivity', workspaceId] as const)\n : (['arbi', 'workspaceActivity', workspaceId, limit] as const),\n projects: () => ['arbi', 'projects'] as const,\n projectUsage: (projectExtId: string, monthsBack: number) =>\n ['arbi', 'projectUsage', projectExtId, monthsBack] as const,\n projectConversationUsage: (projectExtId: string, monthsBack: number) =>\n ['arbi', 'projectUsage', projectExtId, 'byConversation', monthsBack] as const,\n projectInvoices: (projectExtId: string) => ['arbi', 'projectInvoices', projectExtId] as const,\n /** The plans and add-ons on sale. */\n products: () => ['arbi', 'products'] as const,\n /** Prices of a purchase or a change (quotes, previews); nothing is bought. */\n billingQuotes: () => ['arbi', 'billingQuote'] as const,\n userUsageToday: () => ['arbi', 'userUsageToday'] as const,\n currentUser: () => ['arbi', 'currentUser'] as const,\n firmPool: () => ['arbi', 'firmPool'] as const,\n contacts: () => ['arbi', 'contacts'] as const,\n /** Every chat query (the list and each open thread). */\n chats: () => ['arbi', 'chats'] as const,\n /** My chats, raw (titles and last messages are ciphertext), most recently active first. */\n chatList: () => ['arbi', 'chats', 'list'] as const,\n /** One thread's loaded messages, decrypted, oldest first (`ChatThreadData`). */\n chatThread: (chatExtId: string) => ['arbi', 'chats', 'thread', chatExtId] as const,\n /** My own agent's progress on my last message to it (`agent_dm_status`), per agent. */\n agentDmStatus: (agentExtId: string) => ['arbi', 'chats', 'agentStatus', agentExtId] as const,\n /** The paid features this person may use (`/v1/user/entitlements`). */\n entitlements: () => ['arbi', 'entitlements'] as const,\n skills: () => ['arbi', 'skills'] as const,\n /** A skill's main file (SKILL.md), as text. */\n skillSource: (docExtId: string) => ['arbi', 'skills', 'source', docExtId] as const,\n /** An agent's pinned config; `undefined` = the library default config. */\n agentConfig: (agentExtId?: string) => ['arbi', 'agentConfig', agentExtId ?? 'default'] as const,\n agentWorkspaces: (agentExtId: string) => ['arbi', 'agentWorkspaces', agentExtId] as const,\n /** An agent's own login, polled while its controls are open. */\n agentSession: (agentExtId: string) => ['arbi', 'agentSession', agentExtId] as const,\n agentChats: (agentExtId: string) => ['arbi', 'agentChats', agentExtId] as const,\n authorizeLimits: () => ['arbi', 'authorizeLimits'] as const,\n mcpTools: () => ['arbi', 'mcpTools'] as const,\n models: () => ['arbi', 'models'] as const,\n availableModels: () => ['arbi', 'availableModels'] as const,\n /** The workspace Assistant's brief. */\n assistantBrief: (workspaceId: string) => ['arbi', 'assistantBrief', workspaceId] as const,\n /** Whether the workspace Assistant is waiting, working or idle. */\n assistantStatus: (workspaceId: string) => ['arbi', 'assistantStatus', workspaceId] as const,\n /** What the workspace Assistant did with each arrival. */\n assistantArrivals: (workspaceId: string) => ['arbi', 'assistantArrivals', workspaceId] as const,\n modelConnections: (userId?: string) => ['arbi', 'modelConnections', userId] as const,\n directModelUsage: (userId?: string) => ['arbi', 'directModelUsage', userId] as const,\n /** The signed-in user's own profile (name, picture, email). */\n profile: () => ['arbi', 'profile'] as const,\n identity: () => ['arbi', 'identity'] as const,\n /** The signed-in user's settings record (notification preferences, flags). */\n userSettings: () => ['arbi', 'userSettings'] as const,\n /** Every notification list: the prefix a delete, a read receipt or an arrival invalidates. */\n allSupportTickets: () => ['arbi', 'support'] as const,\n supportTickets: () => ['arbi', 'support', 'tickets'] as const,\n supportTicket: (id: number) => ['arbi', 'support', 'tickets', id] as const,\n allNotifications: () => ['arbi', 'notifications'] as const,\n /** The newest `limit` notifications, received and sent. */\n notifications: (limit: number) => ['arbi', 'notifications', limit] as const,\n /** The documents a workspace may use as its Word house template. */\n houseTemplateCandidates: (workspaceId: string) =>\n ['arbi', 'houseTemplateCandidates', workspaceId] as const,\n // ── Storage, archive ────────────────────────────────────────────────────────────────────────\n /** Every storage view (projects, items, names, Recently deleted): what a restore or delete refreshes. */\n storage: () => ['arbi', 'storage'] as const,\n /** What each project stores; no params: every such list. */\n storageProjects: (params?: object) =>\n params === undefined\n ? (['arbi', 'storage', 'projects'] as const)\n : (['arbi', 'storage', 'projects', params] as const),\n /** The largest items stored; no params: every such list. */\n storageItems: (params?: object) =>\n params === undefined\n ? (['arbi', 'storage', 'items'] as const)\n : (['arbi', 'storage', 'items', params] as const),\n /** Decrypted document names of storage items. */\n storageItemNames: (params?: object) =>\n params === undefined\n ? (['arbi', 'storage', 'names'] as const)\n : (['arbi', 'storage', 'names', params] as const),\n /** The deployment's storage day by day. */\n storageSnapshots: (params?: object) =>\n params === undefined\n ? (['arbi', 'storage', 'snapshots'] as const)\n : (['arbi', 'storage', 'snapshots', params] as const),\n /** A workspace's Recently deleted documents; no id: every workspace's. */\n workspaceTrash: (workspaceId?: string) =>\n workspaceId === undefined\n ? (['arbi', 'storage', 'workspaceTrash'] as const)\n : (['arbi', 'storage', 'workspaceTrash', workspaceId] as const),\n /** A workspace's archive state; no id: every workspace's. */\n workspaceArchive: (workspaceId?: string) =>\n workspaceId === undefined\n ? (['arbi', 'workspaceArchive'] as const)\n : (['arbi', 'workspaceArchive', workspaceId] as const),\n // ── Databases ───────────────────────────────────────────────────────────────────────────────\n // Every key below names its workspace right after its kind: a list read in one workspace is never\n // served, or overwritten, in another (the list is the session's open workspace on the server).\n /** Every database query of every workspace (what a write or a switch refreshes). */\n databases: () => ['arbi', 'databases'] as const,\n /** A workspace's databases; no id: every workspace's. */\n databaseList: (workspaceId?: string) =>\n workspaceId === undefined\n ? (['arbi', 'databases', 'list'] as const)\n : (['arbi', 'databases', 'list', workspaceId] as const),\n /** One database of a workspace; no workspace: every one read. */\n database: (workspaceId?: string, databaseId?: string) =>\n workspaceId === undefined\n ? (['arbi', 'databases', 'one'] as const)\n : (['arbi', 'databases', 'one', workspaceId, databaseId ?? ''] as const),\n /**\n * A database's rows (a search); no workspace: every database's, no params: every search of one.\n * `['arbi', 'databases', 'rows', workspaceId, databaseId, params]`.\n */\n databaseRows: (workspaceId?: string, databaseId?: string, params?: object) =>\n workspaceId === undefined\n ? (['arbi', 'databases', 'rows'] as const)\n : params === undefined\n ? (['arbi', 'databases', 'rows', workspaceId, databaseId ?? ''] as const)\n : (['arbi', 'databases', 'rows', workspaceId, databaseId ?? '', params] as const),\n /** A workspace's pages; no id: every workspace's. */\n pages: (workspaceId?: string) =>\n workspaceId === undefined\n ? (['arbi', 'pages'] as const)\n : (['arbi', 'pages', workspaceId] as const),\n /**\n * Saved table views a workspace's session sees: of one table (a database id or `documents`);\n * no target: every table's; no workspace: every workspace's.\n */\n tableViews: (workspaceId?: string, target?: string) =>\n workspaceId === undefined\n ? (['arbi', 'table-views'] as const)\n : target === undefined\n ? (['arbi', 'table-views', workspaceId] as const)\n : (['arbi', 'table-views', workspaceId, target] as const),\n /** A database's rows grouped and measured (a chart); no workspace: every database's. */\n databaseAggregate: (workspaceId?: string, databaseId?: string, request?: object) =>\n workspaceId === undefined\n ? (['arbi', 'databases', 'aggregate'] as const)\n : (['arbi', 'databases', 'aggregate', workspaceId, databaseId ?? '', request ?? {}] as const),\n // ── Configs, health ─────────────────────────────────────────────────────────────────────────\n /** Under `configs()`: the saved configuration versions. */\n configVersions: () => ['arbi', 'configs', 'versions'] as const,\n /** Under `configs()`: the JSON schema of every config model. */\n configSchema: () => ['arbi', 'configs', 'schema'] as const,\n /** Under `configs()`: one configuration. */\n config: (configId: string) => ['arbi', 'configs', 'one', configId] as const,\n /** The remote model providers' health. */\n remoteModels: () => ['arbi', 'remoteModels'] as const,\n // ── Conversations ───────────────────────────────────────────────────────────────────────────\n /** Under the conversations prefix: what a parked run waits for the owner to allow. */\n conversationPendingAuth: (conversationId: string) =>\n ['arbi', 'conversations', conversationId, 'pending-auth'] as const,\n // ── Document tools ──────────────────────────────────────────────────────────────────────────\n /** Signatures on a document (a version); no id: every document's. */\n documentSignatures: (docId?: string, version?: number | null) =>\n docId === undefined\n ? (['arbi', 'documentSignatures'] as const)\n : (['arbi', 'documentSignatures', docId, version ?? null] as const),\n /** The certificate of a signature reference. */\n signatureVerification: (reference: string) =>\n ['arbi', 'signatureVerification', reference] as const,\n /** Every signature request list: what a request write refreshes. */\n signatureRequests: () => ['arbi', 'signatureRequests'] as const,\n signatureRequestsForDocument: (docId: string) =>\n ['arbi', 'signatureRequests', 'document', docId] as const,\n /** Who may sign in a workspace; no id: every workspace's. */\n signatureCandidates: (workspaceId?: string) =>\n workspaceId === undefined\n ? (['arbi', 'signatureRequests', 'candidates'] as const)\n : (['arbi', 'signatureRequests', 'candidates', workspaceId] as const),\n /** The user's saved (informal) signature. */\n savedSignature: () => ['arbi', 'savedSignature'] as const,\n /** An html/react artifact's source. */\n artifactSource: (docId: string) => ['arbi', 'artifactSource', docId] as const,\n /** An artifact's text, under its parsed content (refreshed with it). */\n artifactText: (docId: string) => ['arbi', 'parsedDoc', docId, 'marker', 'artifact-text'] as const,\n /** An image document's bytes as an object URL. */\n assetImage: (docId: string) => ['arbi', 'assetImage', docId] as const,\n // ── Misc ────────────────────────────────────────────────────────────────────────────────────\n /** An agent config's model tier (the builder's badge). */\n agentConfigModel: (configId: string) => ['arbi', 'agentConfigModel', configId] as const,\n /** Under `billingQuotes()`: the price of a plan change. */\n billingPreview: (projectExtId: string, change: unknown) =>\n ['arbi', 'billingQuote', 'preview', projectExtId, change] as const,\n billingPlanQuote: (projectExtId: string | null, body: unknown) =>\n ['arbi', 'billingQuote', 'plan', projectExtId, body] as const,\n billingAddonQuote: (projectExtId: string, kind: string) =>\n ['arbi', 'billingQuote', 'addon', projectExtId, kind] as const,\n /** Under `contacts()`: a search of the people one can reach. */\n contactSearch: (term: string) => ['arbi', 'contacts', 'search', term] as const,\n /** Under the workspace's facts: a filtered list. */\n factList: (workspaceId: string, filter: unknown) =>\n ['arbi', 'facts', workspaceId, filter] as const,\n /**\n * Under `skills()`: a workspace's list, hidden ones included or not. Without a marketplace the\n * server lists the open workspace's skills, so the list is kept per workspace.\n */\n skillList: (workspaceId: string, includeHidden: boolean) =>\n ['arbi', 'skills', 'list', workspaceId, includeHidden] as const,\n /** Under the project's events: one kind, one page size. */\n projectEventList: (projectExtId: string, kind: string, limit: number | 'default') =>\n ['arbi', 'projects', projectExtId, 'events', kind, limit] as const,\n /** The documents pinned for offline reading on this device. */\n offlineDocuments: () => ['arbi', 'offlineDocuments'] as const,\n /** Notifications of one kind for a deployment's user (polled). */\n typedNotifications: (kind: string, apiUrl: string, userId: string | undefined) =>\n ['arbi', 'typedNotifications', kind, apiUrl, userId ?? ''] as const,\n}\n\n/**\n * Keys of the mutations a host may need to follow (its own caches outside these hooks), e.g. with\n * a `MutationCache` subscription: a workflow run creates a task in the host's own task list.\n */\nexport const arbiMutationKeys = {\n /** A member's role changed. */\n setWorkspaceMemberRoles: () => ['arbi', 'workspaces', 'roles'] as const,\n runWorkflow: () => ['arbi', 'workflows', 'run'] as const,\n updateTagKindSchema: () => ['arbi', 'tags', 'kinds', 'update'] as const,\n createTag: () => ['arbi', 'tags', 'create'] as const,\n updateTag: () => ['arbi', 'tags', 'update'] as const,\n deleteTag: () => ['arbi', 'tags', 'delete'] as const,\n extractEntities: () => ['arbi', 'tags', 'entities', 'extract'] as const,\n updateDocuments: () => ['arbi', 'documents', 'update'] as const,\n deleteDocuments: () => ['arbi', 'documents', 'delete'] as const,\n uploadDocuments: () => ['arbi', 'documents', 'upload'] as const,\n uploadUrls: () => ['arbi', 'documents', 'uploadUrls'] as const,\n assignDocTags: () => ['arbi', 'doctags', 'assign'] as const,\n removeDocTags: () => ['arbi', 'doctags', 'remove'] as const,\n updateDocTag: () => ['arbi', 'doctags', 'update'] as const,\n generateDocTags: () => ['arbi', 'doctags', 'generate'] as const,\n /** Members added to or removed from a workspace (leaving included). */\n workspaceMembership: () => ['arbi', 'workspaces', 'members'] as const,\n /** A chat turn being sent (the app's send pipeline). */\n sendMessage: () => ['arbi', 'conversations', 'send'] as const,\n}\n\n/**\n * Query keys of the calendar hooks, all under `['arbi', 'calendar']`. The calendar is the user's,\n * not a workspace's; only the overlays carry the open workspace.\n */\nexport const calendarQueryKeys = {\n all: () => ['arbi', 'calendar'] as const,\n settings: () => ['arbi', 'calendar', 'settings'] as const,\n calendars: () => ['arbi', 'calendar', 'calendars'] as const,\n /** Every event list: the prefix an event write invalidates. */\n events: () => ['arbi', 'calendar', 'events'] as const,\n eventList: (p: ListEventsParams) =>\n [\n 'arbi',\n 'calendar',\n 'events',\n { start: p.start, end: p.end, calendars: p.calendars?.join(',') ?? null },\n ] as const,\n /** Every single event read. */\n eventDetails: () => ['arbi', 'calendar', 'event'] as const,\n event: (id: string, recurrenceId?: string | null) =>\n ['arbi', 'calendar', 'event', id, recurrenceId ?? null] as const,\n shares: (calId: string) => ['arbi', 'calendar', 'shares', calId] as const,\n invitations: () => ['arbi', 'calendar', 'invitations'] as const,\n holidayCountries: () => ['arbi', 'calendar', 'holiday-countries'] as const,\n allRooms: () => ['arbi', 'calendar', 'rooms'] as const,\n rooms: (q: RoomQuery) => ['arbi', 'calendar', 'rooms', q] as const,\n freebusy: (attendees: string[], start: string, end: string) =>\n ['arbi', 'calendar', 'freebusy', attendees.join(','), start, end] as const,\n allLookups: () => ['arbi', 'calendar', 'lookup'] as const,\n lookup: (uid: string) => ['arbi', 'calendar', 'lookup', uid] as const,\n overlays: (workspaceId: string | null, w?: CalendarWindow, layers?: OverlayLayerName[]) =>\n [\n 'arbi',\n 'calendar',\n 'overlays',\n workspaceId,\n w ? { start: w.start, end: w.end, layers: layers?.join(',') } : null,\n ] as const,\n accounts: () => ['arbi', 'calendar', 'accounts'] as const,\n caldavProfiles: () => ['arbi', 'calendar', 'caldav-profiles'] as const,\n bookingPages: () => ['arbi', 'calendar', 'booking-pages'] as const,\n /** The offline outbox (writes made offline, not yet sent). */\n outbox: () => ['arbi', 'calendar', 'outbox'] as const,\n}\n\n/** Query keys of the call hooks, all under `['arbi', 'calls']`. Calls are the user's, not a workspace's. */\nexport const callQueryKeys = {\n all: () => ['arbi', 'calls'] as const,\n config: () => ['arbi', 'calls', 'config'] as const,\n call: (callExtId: string) => ['arbi', 'calls', 'call', callExtId] as const,\n /** Everything about a call's recordings: the prefix a recording event invalidates. */\n recordingsOf: (callExtId: string) => ['arbi', 'calls', 'recordings', callExtId] as const,\n recordings: (callExtId: string) => ['arbi', 'calls', 'recordings', callExtId, 'list'] as const,\n recording: (callExtId: string, recordingExtId: string) =>\n ['arbi', 'calls', 'recordings', callExtId, 'one', recordingExtId] as const,\n inviteLinks: (callExtId: string) => ['arbi', 'calls', 'invite-links', callExtId] as const,\n}\n\nexport const connectorQueryKeys = {\n all: () => ['arbi', 'connectors'] as const,\n catalog: () => ['arbi', 'connectors', 'catalog'] as const,\n mine: () => ['arbi', 'connectors', 'mine'] as const,\n mailboxFolders: (vendor: string) => ['arbi', 'connectors', 'folders', vendor] as const,\n mailboxSyncProgress: (vendor: string, workspaceExtId: string) =>\n ['arbi', 'connectors', 'sync-progress', vendor, workspaceExtId] as const,\n allMailboxSyncProgress: () => ['arbi', 'connectors', 'sync-progress'] as const,\n driveFolders: (vendor: string) => ['arbi', 'connectors', 'drive-folders', vendor] as const,\n driveFolderChildren: (vendor: string, itemId: string) =>\n ['arbi', 'connectors', 'drive-folder-children', vendor, itemId] as const,\n driveFolderDocCount: (vendor: string, itemId: string) =>\n ['arbi', 'connectors', 'drive-folder-doc-count', vendor, itemId] as const,\n driveSyncEstimate: (vendor: string) =>\n ['arbi', 'connectors', 'drive-sync-estimate', vendor] as const,\n driveSyncProgress: (vendor: string) =>\n ['arbi', 'connectors', 'drive-sync-progress', vendor] as const,\n allDriveSyncProgress: () => ['arbi', 'connectors', 'drive-sync-progress'] as const,\n slack: () => ['arbi', 'connectors', 'slack'] as const,\n}\n\nexport const mailQueryKeys = {\n all: () => ['arbi', 'mail'] as const,\n policy: () => ['arbi', 'mail', 'policy'] as const,\n accounts: () => ['arbi', 'mail', 'accounts'] as const,\n unlock: (accountId: string | undefined, sessionKey: string | null) =>\n ['arbi', 'mail', 'unlock', accountId, sessionKey ?? ''] as const,\n allFolders: () => ['arbi', 'mail', 'folders'] as const,\n folders: (accountId: string | undefined) => ['arbi', 'mail', 'folders', accountId] as const,\n allMessages: () => ['arbi', 'mail', 'messages'] as const,\n messages: (\n accountId: string | undefined,\n folderId: string | undefined,\n query: string,\n cursor: string | null\n ) => ['arbi', 'mail', 'messages', accountId, folderId, query, cursor] as const,\n message: (accountId: string | undefined, messageId: string | null | undefined) =>\n ['arbi', 'mail', 'message', accountId, messageId] as const,\n /** Every conversation list: the prefix a flag or move patches or refreshes. */\n allConversations: () => ['arbi', 'mail', 'conversations'] as const,\n conversations: (\n accountId: string | undefined,\n folderId: string | undefined,\n query: string,\n cursor: string | null\n ) => ['arbi', 'mail', 'conversations', accountId, folderId, query, cursor] as const,\n /** Every thread read of an account. */\n accountThreads: (accountId: string) => ['arbi', 'mail', 'thread', accountId] as const,\n thread: (\n accountId: string | undefined,\n threadId: string | null | undefined,\n folderId: string | undefined\n ) => ['arbi', 'mail', 'thread', accountId, threadId, folderId] as const,\n /** Where the ARBI mailbox files mail (folders and conversations, per workspace). */\n nativeFiling: () => ['arbi', 'mail', 'filing', 'native'] as const,\n /** Every filing lookup: refreshed after mail is added to a workspace or a rule is stopped. */\n allFiling: () => ['arbi', 'mail', 'filing'] as const,\n filing: (accountId: string | undefined, messageIds: string[], threadIds: string[]) =>\n ['arbi', 'mail', 'filing', accountId, messageIds.join(' '), threadIds.join(' ')] as const,\n /** The key the user's client keys older native mail with: outside the `['arbi', 'mail']` prefix, so\n * refreshing mail never fetches it again. */\n threadSecret: () => ['arbi', 'mail-thread-secret'] as const,\n /** The projects an email's AI work can be billed to. */\n projects: () => ['arbi', 'mail', 'projects'] as const,\n /** A saved draft prepared for editing. */\n draftCompose: (accountId: string | undefined, draftId: string | undefined) =>\n ['arbi', 'mail', 'draft-compose', accountId, draftId] as const,\n attachmentText: (accountId: string, messageId: string, attachmentId: string) =>\n ['arbi', 'mail', 'attachment-text', accountId, messageId, attachmentId] as const,\n}\n\n/** `pdf`: the document as a PDF; `original`: the stored file (an image, a recording, a sheet). */\nexport type DocumentBytesKind = 'pdf' | 'original'\n\n/** Every version and kind of a document's bytes: the prefix a new version invalidates. */\nexport const documentBytesKey = (\n documentRef: string,\n version?: number | null,\n kind?: DocumentBytesKind\n) =>\n version === undefined\n ? (['arbi', 'documentBytes', documentRef] as const)\n : (['arbi', 'documentBytes', documentRef, version, kind ?? 'pdf'] as const)\n\n/** Whether `queryKey` lies under `prefix` (a factory key): React Query's own prefix match. */\nexport function isUnderQueryKey(queryKey: readonly unknown[], prefix: readonly unknown[]): boolean {\n return prefix.every((part, i) => queryKey[i] === part)\n}\n"]}
|