@arbidocs/react 0.5.198 → 0.5.200
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/document-tools/core.d.ts +2 -2
- package/dist/document-tools/index.d.ts +2 -2
- package/dist/{file-shares.d-DyS7nSIy.d.ts → file-shares.d-D4L8gago.d.ts} +3 -0
- package/dist/index.cjs +21 -0
- package/dist/index.cjs.map +1 -1
- package/dist/{index.d-BWfM5sah.d.ts → index.d-EQ3JdYWy.d.ts} +3 -3
- package/dist/index.d.ts +96 -5
- package/dist/index.js +4 -0
- package/dist/index.js.map +2 -2
- package/dist/ui/index.d.ts +1 -1
- package/dist/workforce.js +21 -0
- package/dist/workforce.js.map +2 -2
- package/package.json +3 -3
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 * 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 // The server answers this list from the caller's open workspace (400 \"No active workspace\" with none open,\n // which is the normal state right after sign-in), so it is not asked before one is; the status read\n // re-renders the hook when a workspace opens or switches.\n useArbiSessionState((s) => s.workspaceStatus)\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 && workspaceId !== '',\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,UA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|
|
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\n/** Authorize a timed workflow's assistant for a fixed time (`accessSeconds`; default the workflow's own length). */\nexport function useAuthorizeWorkflow() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({\n workflowId,\n accessSeconds,\n }: {\n workflowId: string\n accessSeconds?: number\n }): Promise<WorkflowResponse> => arbi.workflows.authorize(workflowId, accessSeconds),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.workflows() }),\n })\n}\n\n/** End a timed workflow's authorization now. */\nexport function useDeauthorizeWorkflow() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (workflowId: string): Promise<WorkflowResponse> =>\n arbi.workflows.deauthorize(workflowId),\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 // The server answers this list from the caller's open workspace (400 \"No active workspace\" with none open,\n // which is the normal state right after sign-in), so it is not asked before one is; the status read\n // re-renders the hook when a workspace opens or switches.\n useArbiSessionState((s) => s.workspaceStatus)\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 && workspaceId !== '',\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,CAA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AAK,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.200",
|
|
4
4
|
"description": "React hooks and provider for the ARBI SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -122,8 +122,8 @@
|
|
|
122
122
|
"build-storybook": "storybook build"
|
|
123
123
|
},
|
|
124
124
|
"dependencies": {
|
|
125
|
-
"@arbidocs/client": "0.5.
|
|
126
|
-
"@arbidocs/sdk": "0.5.
|
|
125
|
+
"@arbidocs/client": "0.5.200",
|
|
126
|
+
"@arbidocs/sdk": "0.5.200",
|
|
127
127
|
"@didit-protocol/sdk-web": "0.4.0",
|
|
128
128
|
"@livekit/components-react": "2.9.24",
|
|
129
129
|
"@radix-ui/react-avatar": "^1.2.0",
|