import { SessionStorageProvider, ArbiClient, LoginResult, components, WebSocketServerMessage, WsAuthResultMessage, WsTaskUpdateMessage, KeyPair } from '@arbidocs/client'; /** * Core error types and throwing error utilities. * * Unlike CLI helpers which call process.exit(1), these throw typed errors * that consumers (CLI, TUI) can catch and handle in their own way. */ declare class ArbiError extends Error { constructor(message: string); } declare class ArbiApiError extends ArbiError { readonly apiError?: unknown; constructor(message: string, apiError?: unknown); } /** * Check API response and throw on error. Returns narrowed non-null data. */ declare function requireData(result: { data?: T; error?: unknown; }, message: string): T; /** * Check API response for delete/void operations (no data expected). */ declare function requireOk(result: { error?: unknown; }, message: string): void; /** * Extract a human-readable message from an unknown error value. * Centralises the `err instanceof Error ? err.message : String(err)` pattern. * * Unwraps `.cause` chains to surface the root error — critical for Node.js * fetch errors where TypeError("fetch failed") wraps the real cause * (ECONNREFUSED, UNABLE_TO_VERIFY_LEAF_SIGNATURE, etc.). */ declare function getErrorMessage(err: unknown): string; /** * Extract the Node.js error code (e.g. 'ECONNREFUSED', 'ENOTFOUND') from an * error or its cause chain. Returns undefined if no code is found. */ declare function getErrorCode(err: unknown): string | undefined; /** * Authenticated fetch utility — eliminates repeated raw-fetch boilerplate * in operations that can't use the typed SDK client (streaming, multipart, etc.). */ interface AuthHeaders { baseUrl: string; accessToken: string; } interface AuthFetchOptions extends AuthHeaders { /** URL path relative to baseUrl (e.g. '/v1/document/upload'). */ path: string; method?: string; body?: string | FormData | ArrayBuffer | ReadableStream | Blob | null; /** Extra headers to merge in. */ headers?: Record; } /** * Make an authenticated fetch request with standard error handling. * Automatically sets Authorization header. Workspace keys are stored * server-side on the session — no client-side header needed. * Throws on non-ok responses with a human-readable message including server error details. */ declare function authenticatedFetch(options: AuthFetchOptions): Promise; /** * Configuration types — shared between browser and Node.js environments. * * This file has NO Node.js dependencies and is safe for browser bundling. */ interface CliConfig { baseUrl: string; deploymentDomain: string; selectedWorkspaceId?: string; autoUpdate?: boolean; notifications?: boolean; verbose?: boolean; watch?: boolean; /** Default orchestrator for `arbi agent connect` (e.g. "claude") */ orchestrator?: string; } interface CliCredentials { email: string; /** User's external ID (``usr-*`` or ``agt-*``). Needed by features * that key on user identity (DM crypto, contact resolution, etc.). * Set on every login from the API's response; required by * ``buildAuthFromCache`` to restore the session client-side * without a server round-trip. */ userExtId?: string; signingPrivateKeyBase64: string; serverSessionKeyBase64: string; /** Cached access token for the live server session. Valid as long as * ``tokenTimestamp`` is within ``TOKEN_MAX_AGE_MS``. */ accessToken?: string; /** ISO timestamp when ``accessToken`` was issued. Used for client-side * TTL — the server enforces JWT exp independently. */ tokenTimestamp?: string; /** * Workspaces whose keys are already deposited on the current server * session — i.e. the keys of ``session.workspaces`` in the backend's * Redis entry. Client-side mirror so we can skip a redundant `/open` * round-trip when we've already deposited a workspace's key during * this session's lifetime. * * Both grant types end up in this set: * - **Permanent** — first `/open` for the workspace POSTs the * wrapped_key and the server adds it to ``session.workspaces``. * - **Session-only** (PA agents, temporary shares) — the backend * pre-deposits via ``store_workspace_key_for_session_pubkey``, * then the client's `/open` is just a metadata fetch. * * Cleared on every event that invalidates the session: fresh login, * auto-relogin on 401, logout. The new session starts with an empty * ``session.workspaces`` server-side, so this client mirror must * start empty too. */ openedWorkspaces?: string[]; /** Auth0 SSO token — needed for session recovery of SSO users */ ssoToken?: string; /** Parent user ext_id — set for persistent agent accounts */ parentExtId?: string; } interface ChatSession { /** Last assistant message ID — used as previous_response_id for follow-ups */ lastMessageExtId: string | null; /** Conversation external ID — used to restore chat history on restart */ conversationExtId: string | null; /** Workspace ID where the conversation started — used to detect workspace changes */ workspaceId: string | null; } interface ConfigStore { getConfig(): CliConfig | null; saveConfig(config: CliConfig): void; updateConfig(updates: Partial): void; requireConfig(): CliConfig; getCredentials(): CliCredentials | null; saveCredentials(creds: CliCredentials): void; deleteCredentials(): void; requireCredentials(): CliCredentials; getChatSession(): ChatSession; saveChatSession(session: ChatSession): void; updateChatSession(updates: Partial): void; clearChatSession(): void; /** Persist last response metadata for citation browsing (optional). */ saveLastMetadata?(metadata: unknown): void; /** Load last response metadata for citation browsing (optional). */ loadLastMetadata?(): unknown | null; /** * Optional adapter that exposes the stored signing/session keys to * the auto-relogin middleware in `@arbidocs/client`. Implementations * that omit this leave 401 retry disabled (the middleware falls back * to its built-in IndexedDB adapter, which only works in browsers). */ getSessionStorageProvider?(): SessionStorageProvider; } /** * Parameterized authentication functions. * * Unlike CLI's client.ts, these take explicit params instead of reading from disk. * This allows both CLI and TUI to use them with their own config sources. */ interface AuthenticatedClient { arbi: ArbiClient; loginResult: LoginResult; } interface AuthContext { arbi: ArbiClient; loginResult: LoginResult; config: CliConfig; } interface WorkspaceContext extends AuthContext { workspaceId: string; accessToken: string; } /** Minimal workspace shape required by formatWorkspaceChoices. */ interface WorkspaceForChoice { name: string; external_id: string; shared_document_count: number; private_document_count: number; } /** * Format a list of workspaces into prompt-friendly choices. * Returns `{ name, value, description }` objects suitable for @inquirer/prompts * or any similar select component. */ declare function formatWorkspaceChoices(wsList: WorkspaceForChoice[]): Array<{ name: string; value: string; description: string; }>; /** * Create an SDK client, init sodium, and log in with stored signing key. * Returns the client + login result (which includes serverSessionKey). */ declare function createAuthenticatedClient(config: CliConfig, creds: CliCredentials, store: ConfigStore): Promise; /** * Interactive (password-based) login flow. * * Creates an SDK client, initializes sodium, authenticates with email/password, * and persists the derived credentials to the config store. * * Use this for CLI/TUI login commands. For session recovery from stored keys, * use createAuthenticatedClient() instead. */ declare function performPasswordLogin(config: CliConfig, email: string, password: string, store: ConfigStore): Promise; /** * Signing-key-based login flow (for agent recovery). * * Authenticates using a raw Ed25519 signing key instead of a password. * Used when an agent needs to re-login using a recovery key. */ declare function performSigningKeyLogin(config: CliConfig, email: string, signingPrivateKeyBase64: string, store: ConfigStore): Promise; /** * SSO device-flow login (RFC 8628). * * Fetches SSO config from the deployment, initiates the device authorization * flow with Auth0, waits for the user to authorize in a browser, then logs * in to the ARBI deployment using the Auth0 JWT. */ declare function performSsoDeviceFlowLogin(config: CliConfig, email: string, password: string, store: ConfigStore, callbacks?: { onUserCode?: (userCode: string, verificationUri: string) => void; onPoll?: (elapsedMs: number) => void; }): Promise; /** * Decrypt wrapped workspace key and generate the encrypted workspace key header. * Returns the encrypted key string for use with /open. */ declare function selectWorkspace(arbi: ArbiClient, workspaceId: string, wrappedKey: string, serverSessionKey: Uint8Array, signingPrivateKeyBase64: string): Promise; /** * Generate an encrypted workspace key for the given workspace. * Used for operations that need a key for a workspace other than the current one * (e.g., copy documents to a target workspace). */ declare function generateEncryptedWorkspaceKey(arbi: ArbiClient, wrappedKey: string, serverSessionKey: Uint8Array, signingPrivateKeyBase64: string): Promise; /** * Generate a random workspace key encrypted with the session public key. * Used when creating new workspaces. */ declare function generateNewWorkspaceKey(arbi: ArbiClient, serverSessionKey: Uint8Array): Promise; /** * Unwrap the raw 32-byte workspace key for direct client-side encryption. * * Unlike ``selectWorkspace`` (which returns the session-sealed wrapper for use * with ``/open``), this returns the plaintext key so the caller can feed it * into SecretBox ``encryptFile`` / ``createContentHash`` for the direct-upload * flow. * * The caller is responsible for keeping the returned key in memory only — * never log, persist, or transmit it over the wire. */ declare function getRawWorkspaceKey(arbi: ArbiClient, workspaceId: string, signingPrivateKeyBase64: string): Promise; declare function selectWorkspaceById(arbi: ArbiClient, workspaceId: string, serverSessionKey: Uint8Array, signingPrivateKeyBase64: string): Promise<{ external_id: string; name: string; wrapped_key: string | null; /** The session-sealed workspace key — `null` for session-only grants */ sealed_key: string | null; }>; /** * Authenticate and return the SDK client + config. * * Fast path: reuse the live server session via cached accessToken. * Slow path: fresh ``loginWithKey`` (mints a new session, clears * ``openedWorkspaces``). */ declare function resolveAuth(store: ConfigStore): Promise; /** * Authenticate, ensure the workspace's key is deposited on the current * server session, and return everything callers need. * * Decisions are independent: * 1. **Session aliveness** — reuse the live session if its accessToken * is within TTL; otherwise fresh login. (Fresh login = new session * = ``openedWorkspaces`` reset to ``[]``.) * 2. **Workspace deposit** — if ``workspaceId`` already appears in * ``creds.openedWorkspaces``, the server's session already holds * its key; no ``/open`` needed. Otherwise call ``/open`` once and * append to the set. * * Splitting these matters: previously the cache was gated on * ``creds.workspaceId === workspaceId``, so any switch between * workspaces forced a re-login. That orphaned PA-agent session * deposits and broke ``arbi docs`` for them. Now switching workspaces * within a live session just adds another entry to * ``openedWorkspaces`` — no re-login, no orphaned deposits. */ declare function resolveWorkspace(store: ConfigStore, workspaceOpt?: string): Promise; /** * SSE event types — re-exported from the auto-generated OpenAPI schema. * * Consumers should import these from '@arbidocs/sdk' (or '/browser') * rather than reaching into '@arbidocs/client' directly. */ type ResponseCreatedEvent = components['schemas']['ResponseCreatedEvent']; type ResponseCompletedEvent = components['schemas']['ResponseCompletedEvent']; type ResponseFailedEvent = components['schemas']['ResponseFailedEvent']; type ResponseOutputTextDeltaEvent = components['schemas']['ResponseOutputTextDeltaEvent']; type ResponseOutputTextDoneEvent = components['schemas']['ResponseOutputTextDoneEvent']; type ResponseOutputItemAddedEvent = components['schemas']['ResponseOutputItemAddedEvent']; type ResponseOutputItemDoneEvent = components['schemas']['ResponseOutputItemDoneEvent']; type ResponseContentPartAddedEvent = components['schemas']['ResponseContentPartAddedEvent']; type AgentStepEvent = components['schemas']['AgentStepEvent']; type AgentStepDeltaEvent = components['schemas']['AgentStepDeltaEvent']; type UserInputRequestEvent = components['schemas']['UserInputRequestEvent']; type ProbeAnswerEvent = components['schemas']['ProbeAnswerEvent']; type DeferredInterjectionEvent = components['schemas']['DeferredInterjectionEvent']; type AgentControlStateEvent = components['schemas']['AgentControlStateEvent']; type ArtifactEvent = components['schemas']['ArtifactEvent']; type UserMessageEvent = components['schemas']['UserMessageEvent']; type MessageQueuedEvent = components['schemas']['MessageQueuedEvent']; type MessageMetadataPayload$1 = components['schemas']['MessageMetadataPayload']; type ArbiErrorEvent = components['schemas']['ArbiErrorEvent']; type ResponseUsage = components['schemas']['ResponseUsage']; type OutputTokensDetails = components['schemas']['OutputTokensDetails']; type TokenBudgetContext = components['schemas']['TokenBudgetContext']; /** Convenience type — what onStreamStart callbacks receive. */ type SSEStreamStartData = { assistant_message_ext_id: string; }; /** * Server-Sent Events (SSE) parsing utilities. * * Extracted from CLI ask.ts for shared use by CLI and TUI. */ interface SSEEvent { event: string; data: string; } /** * A document-name lookup: `doc_ext_id` → human file name. Pass this to * `formatAgentStepLabel` so steps that target a specific document * ("Reading document", "Getting table of contents") render the real * file name instead of an opaque `doc-xxxxxxxx` id. Callers build it * from the workspace document list they already fetch before querying. */ type DocNameMap = Record; /** * Build a `DocNameMap` from a workspace document list. * * Every client that renders steps needs this map and was building it with * the same loop over `documents.listDocuments()`. It lives here so callers * inherit it with the formatter that consumes it, rather than each keeping * a copy that can drift. Documents missing an id or file name are skipped — * an unresolved ref renders as its raw id, which `resolveDocRefs` already * handles. */ declare function buildDocNameMap(docs: ReadonlyArray<{ external_id?: unknown; file_name?: unknown; }>): DocNameMap; /** * Format an AgentStepEvent into a human-readable label. * * Uses backend-provided `label` field when available, falling back to * tool name or step name for old persisted events. Pass `docNames` to * resolve document-scoped steps to their file name. * * Priority: * 1. `focus` — the agent's descriptive sentence about what it's doing * 2. `label` — backend-provided display label (with doc name + pages * appended when the step targets one document) * 3. For `tool_progress` — detail label + optional message * 4. Lifecycle fallback (planning, evaluation, etc.) * 5. Tool name from detail * 6. Fallback to step name or empty string * * The `goal` step's backend label is "Thinking…" (the bare "Goal" told * a user nothing); the fallback map covers older events that omit it. */ /** * Human label for a Responses output_item (function_call / reasoning / message). * Reads the backend-owned arbi extension: the agent's focus when present, else * the label. The backend owns all wording — the SDK never invents it. */ declare function formatItemLabel(item: { type?: string; name?: string; arbi?: { label?: string; focus?: string; }; }, docNames?: DocNameMap): string; declare function formatAgentStepLabel(step: AgentStepEvent, docNames?: DocNameMap): string; /** * Parse SSE events from a chunk of text, combining with a buffer * of incomplete data from previous chunks. * * Returns parsed events and any remaining incomplete data. */ declare function parseSSEEvents(chunk: string, buffer: string): { events: SSEEvent[]; remaining: string; }; /** * Callbacks for streaming SSE events. All callbacks are optional — * omitted callbacks simply ignore that event type. */ interface SSEStreamCallbacks { onStreamStart?: (data: SSEStreamStartData) => void; onToken?: (content: string) => void; /** Answer/narration text delta with its message item id, so the client can * attribute each burst to the right message (narration vs the answer). */ onOutputTextDelta?: (data: { item_id: string; delta: string; }) => void; /** Live reasoning/thinking-token deltas (raw channel). Usually surfaced only in message details. */ onReasoningDelta?: (delta: string) => void; onTextDone?: (text: string) => void; onOutputItemAdded?: (data: ResponseOutputItemAddedEvent) => void; onOutputItemDone?: (data: ResponseOutputItemDoneEvent) => void; /** A function_call item's JSON arguments streaming in. */ onFunctionCallArgumentsDelta?: (data: { item_id: string; delta: string; }) => void; onContentPartAdded?: (data: ResponseContentPartAddedEvent) => void; onError?: (message: string) => void; /** * Fired when the server emits a structured `arbi.error` event mid-stream. * Backend uses this for quota-exceeded errors so clients can render an * upgrade modal without losing the surrounding stream context. */ onArbiError?: (event: ArbiErrorEvent) => void; onMessageQueued?: (data: MessageQueuedEvent) => void; onUserMessage?: (data: UserMessageEvent) => void; onMetadata?: (data: MessageMetadataPayload$1) => void; onUserInputRequest?: (data: UserInputRequestEvent) => void; /** Out-of-band status probe answer ("how's it going?") — transient, never persisted. */ onProbeAnswer?: (data: ProbeAnswerEvent) => void; /** * Steering that arrived after the agent had committed to its answer — too late * to steer this turn. The consumer submits `message` as a NEW turn. */ onDeferredInterjection?: (data: DeferredInterjectionEvent) => void; /** Server-confirmed run-control state (paused / running). */ onAgentControlState?: (data: AgentControlStateEvent) => void; onArtifact?: (data: ArtifactEvent) => void; onElapsedTime?: (t: number) => void; onUsage?: (usage: ResponseUsage) => void; /** Final per-turn token/credit budget snapshot from response.completed. */ onContextUpdate?: (context: TokenBudgetContext) => void; onComplete?: () => void; } /** * Result returned after the SSE stream is fully consumed. */ interface SSEStreamResult { text: string; assistantMessageExtId: string | null; agentSteps: string[]; /** Total number of tool calls across all agent steps. */ toolCallCount: number; errors: string[]; userMessage: UserMessageEvent | null; metadata: MessageMetadataPayload$1 | null; artifacts: ArtifactEvent[]; usage: ResponseUsage | null; /** Token budget context snapshot from response.completed. */ context: TokenBudgetContext | null; } /** * Stream SSE events from a Response, invoking callbacks as events arrive. * * This is the primary streaming function — use it when you need real-time * event handling (CLI streaming to stdout, TUI rendering, etc.). * * Also accumulates the full response and returns it, so callers can use * both the streaming callbacks and the final result. */ declare function streamSSE(response: Response, callbacks?: SSEStreamCallbacks): Promise; /** * Format a human-readable summary line from a completed SSE stream result. * * Returns a string like: * "3 steps (2 tool calls) · 1,234 tokens · 500/8,000 context · 12.40/50 credits · 2.5s" * (the credits segment is omitted when the workspace has no turn credit budget configured) * * Returns empty string if there's nothing to report. */ declare function formatStreamSummary(result: SSEStreamResult, elapsedTime?: number | null): string; /** * Consume an entire SSE stream without streaming callbacks. * Convenience alias for `streamSSE(response)`. */ declare const consumeSSEStream: typeof streamSSE; /** * WebSocket connection manager. * * Uses Node.js native WebSocket (available in Node 22+). * Authenticates via SDK helpers, routes typed messages to the consumer. */ /** * Thrown when a WebSocket connection is rejected for authentication reasons * (the server returned `auth_result { success: false }`, or no token was * available to send). The reconnect loop uses this to decide whether to * re-authenticate before the next attempt, versus treating the failure as a * transient network drop. */ declare class WebSocketAuthError extends Error { constructor(reason: string); } interface WsConnection { close: () => void; } interface ConnectOptions { baseUrl: string; accessToken: string; onMessage: (msg: WebSocketServerMessage) => void; onClose?: (code: number, reason: string) => void; /** * Called once the server accepts auth (`auth_result { success: true }`). The * full message is passed so callers can read fields like `new_messages`. The * auth handshake itself is owned by the transport — this is a notification. */ onAuthenticated?: (msg: WsAuthResultMessage) => void; } interface ReconnectOptions extends ConnectOptions { /** * Max consecutive reconnect attempts after a drop before giving up and * calling `onReconnectFailed`. Pass `Infinity` for an unattended daemon that * must keep trying indefinitely (backoff still caps at {@link MAX_BACKOFF_MS}). * Default 10. */ maxRetries?: number; initialDelayMs?: number; /** * Resolve the access token before each (re)connect attempt. Defaults to the * static `accessToken`. Provide this so a token refreshed elsewhere (e.g. by * auto-relogin on a REST 401) is picked up on reconnect instead of reusing a * stale token captured when the listener first started. */ getAccessToken?: () => string | null | Promise; /** * Re-authenticate when a reconnect attempt is rejected for auth reasons * (expired/invalid token — see {@link WebSocketAuthError}). Should refresh the * token in whatever store `getAccessToken` reads from; the return value is * ignored. Best-effort: errors are swallowed and normal backoff continues. */ refreshAuth?: () => Promise; onReconnecting?: (attempt: number, maxRetries: number) => void; onReconnected?: () => void; onReconnectFailed?: () => void; /** * Decide whether to reconnect after a given close. Return `false` to stop — * e.g. a server-initiated single-session eviction (code 1008), where * reconnecting would just get kicked again. Default: always reconnect. */ shouldReconnect?: (code: number, reason: string) => boolean; } interface ReconnectableWsConnection { close: () => void; } /** * Open a WebSocket, authenticate, and start routing messages. * * Resolves after a successful `auth_result`, rejects on auth failure or timeout. * Subsequent messages are dispatched to `onMessage`. */ declare function connectWebSocket(options: ConnectOptions): Promise; /** * Connect WebSocket with automatic reconnection on disconnect. * * The initial connection is auth-symmetric with the reconnect loop: if the first * attempt is rejected for auth reasons and `refreshAuth` is provided, it re-logs * in and retries once with the fresh token before throwing. Any other failure — * or a still-failing retry — throws to the caller. * After successful auth, disconnects trigger exponential backoff reconnection: * - a fresh token is resolved before every attempt (see `getAccessToken`), so a * token rotated elsewhere is picked up rather than reusing a stale one; * - an attempt rejected for auth reasons triggers `refreshAuth` (re-login) so * the next attempt uses a new token; * - retries continue up to `maxRetries` (pass `Infinity` for a daemon that must * never give up). Only after exhausting a finite limit is `onReconnectFailed` * called. * * Call close() on the returned handle to stop reconnection attempts. */ declare function connectWithReconnect(options: ReconnectOptions): Promise; /** * Document statuses that mean processing is finished (success or otherwise). * * Anything in this set should cause `--watch` loops to stop tracking the doc: * - `completed` — happy path, content extracted and indexed * - `failed` — processing errored * - `empty` — parser found no extractable content (e.g. blank scan) * - `low-content` — parser extracted only 1-2 chunks (minimal content) * - `skipped` — server skipped (duplicate, unsupported, quota, etc.) * * Treating anything else as terminal will leave watchers hung when the parser * legitimately bails out on degenerate input (we hit this on the bench script * with random-byte PDFs, where ~1 in 6 docs ended at `empty`). */ declare const DOC_TERMINAL_STATUSES: ReadonlySet; interface DocumentWaiterOptions { /** Base URL of the ARBI server (e.g. "https://app.arbi.city"). */ baseUrl: string; /** JWT access token for WebSocket authentication. */ accessToken: string; /** Optional callback invoked for every task_update on tracked documents. */ onStatus?: (msg: WsTaskUpdateMessage) => void; } interface DocumentWaiter { /** Register document IDs to track. Can be called multiple times. */ addDocIds(ids: string[]): void; /** Block until all tracked documents reach terminal status. */ waitUntilDone(timeoutMs?: number): Promise>; /** Close the WebSocket without waiting. */ close(): void; } /** * Open a WebSocket and start collecting document status events. * * Call this BEFORE uploading so no events are missed. Then call `addDocIds()` * once you know the IDs, and `waitUntilDone()` to block until all reach a * terminal status (completed, failed, or skipped). * * Mirrors the backend SDK's `ArbiWebSocket.wait_for_docs()` pattern. * * @example * ```ts * const waiter = createDocumentWaiter({ baseUrl, accessToken }) * const result = await uploadDocuments(...) * waiter.addDocIds(result.doc_ext_ids) * const statuses = await waiter.waitUntilDone(120_000) * ``` */ declare function createDocumentWaiter(options: DocumentWaiterOptions): DocumentWaiter; type MessageLevel = 'info' | 'success' | 'error' | 'warning'; interface FormattedWsMessage { text: string; level: MessageLevel; } /** * Format a WebSocket message into display text + severity level. * Shared by TUI (toasts) and CLI (stderr lines) — single source of truth. */ declare function formatWsMessage(msg: WebSocketServerMessage): FormattedWsMessage; /** * Shared formatting utilities. */ /** * Converts file size in bytes to human-readable format. * * @param bytes File size in bytes * @param fallback String to return for null/undefined values (default: 'N/A') * @returns Formatted string (e.g., "1.5 MB", "250 KB") */ declare function formatFileSize(bytes: number | null | undefined, fallback?: string): string; /** Minimal user shape used for display formatting. */ type UserInfo = { external_id?: string; email?: string; given_name?: string; family_name?: string | null; }; /** * Format a user's display name from given_name + family_name. * Returns empty string if no name parts are available. */ declare function formatUserName(user: UserInfo | null | undefined): string; /** * Citation resolution utilities — shared by CLI and TUI. * * Parses citation data from SSE metadata (`MessageMetadataPayload`) and * resolves chunk references into displayable citation summaries and passages. * * Citation data flow: * 1. `tools.model_citations.tool_responses` maps citation number → CitationData * (contains chunk_ids, statement, offsets) * 2. `tools.retrieval_chunk.tool_responses` and `tools.retrieval_full_context.tool_responses` * map document file name → Chunk[] (contains content and metadata) * 3. This module joins those two data sets to produce resolved citations. */ type MessageMetadataPayload = components['schemas']['MessageMetadataPayload']; type CitationData = components['schemas']['CitationData']; type Chunk$1 = components['schemas']['Chunk']; /** A fully resolved citation with its source chunks. */ interface ResolvedCitation { /** Citation number as a string (e.g. "1", "2") */ citationNum: string; /** Raw citation data from model_citations */ citationData: CitationData; /** Resolved chunks matching the citation's chunk_ids */ chunks: Chunk$1[]; } /** A compact citation summary for display in lists. */ interface CitationSummary { citationNum: string; statement: string; docTitle: string; pageNumber: number | null; chunkCount: number; } /** * Resolve all citations from SSE metadata into full citation objects. * * Reads `tools.model_citations.tool_responses` for citation→chunk_id mappings, * then builds a chunk lookup from `retrieval_chunk` and `retrieval_full_context` * tool responses to resolve each chunk_id to its full Chunk object. * * Returns citations sorted by citation number (ascending). */ declare function resolveCitations(metadata: MessageMetadataPayload | null): ResolvedCitation[]; /** * Produce compact summaries for display in citation lists. * Uses the first chunk of each citation for doc title and page number. */ declare function summarizeCitations(resolved: ResolvedCitation[]): CitationSummary[]; /** * Count the number of citations in metadata. * Returns 0 if metadata is null or has no citations. */ declare function countCitations(metadata: MessageMetadataPayload | null): number; /** * Convert citation markdown to plain text with superscript-style numbers. * Replaces `[text](#cite-N)` with `text[N]`. */ declare function stripCitationMarkdown(text: string): string; /** * Document operations — browser-safe functions. * * For Node.js file system operations (uploadLocalFile, uploadDirectory, uploadZip), * import from './documents-node.js' instead. */ type DocUpdateRequest$1 = components['schemas']['DocUpdateRequest']; type DocResponse = components['schemas']['DocResponse']; /** * Ordering for paginated document listing. * * - `id_asc` — walk by primary key (default). Stable, matches legacy behavior. * - `created_desc` — newest-first. Uses a warm index; preferred for progressive * loaders that want the most-recently-added docs in the first page. * * These values are derived from the backend schema docs for the `order` query * param on `GET /v1/document/list`. The schema types the param as `string` to * allow future additions without a breaking schema change, so we define the * narrow union here in the SDK. */ type DocumentListOrder = 'id_asc' | 'created_desc'; /** * Response shape for paginated document listing. * * - `full` (default) — returns full `DocResponse` with decrypted `doc_metadata` * and joined `doctags`. Same as the legacy single-shot endpoint. * - `lite` — skips the doctags JOIN and `doc_metadata` decrypt. Returned docs * will have `doctags: []` and `doc_metadata: null`. Use this for listing * large workspaces and fetch full per-doc data on demand via * `GET /v1/document/` when a specific doc is opened. * * These values are derived from the backend schema docs for the `fields` query * param on `GET /v1/document/list`. The schema types the param as `string`. */ type DocumentListFields = 'full' | 'lite'; /** * Options for paginated document listing. */ interface ListPaginatedOptions { /** * Number of documents per page (applies to every page after the first). * @default 5000 */ pageSize?: number; /** * Size of the first page only. When set, the initial request uses this * smaller limit so the caller can render something on screen before the * full `pageSize`-sized pages stream in. Subsequent pages fall back to * `pageSize`. When unset, every page uses `pageSize`. */ firstPageSize?: number; /** * Sort order for pagination. * @default 'id_asc' */ order?: DocumentListOrder; /** * Response shape. Use `'lite'` to skip doctags and doc_metadata decrypt. * When `fields: 'lite'`, returned docs have `doctags: []` and `doc_metadata: null`. * Fetch full per-doc data on demand when a specific doc is opened. * @default 'full' */ fields?: DocumentListFields; /** * AbortSignal to cancel iteration mid-stream. */ signal?: AbortSignal; /** * Number of pages kept in flight concurrently. A higher value hides more * backend + network latency between pages but increases peak backend load * and memory for not-yet-consumed pages. Clamped to `[1, MAX_PAGES]`. * @default 1 */ lookahead?: number; } /** * Options for `listAll` — collects all pages into a single array. */ interface ListAllOptions extends Omit { signal?: AbortSignal; } /** Hard cap on pages to guard against runaway loops on misbehaving backends. */ declare const MAX_PAGES = 400; /** File extensions supported for document upload. */ declare const SUPPORTED_EXTENSIONS: Set; /** * Normalize a folder path for storage. Preserves Unicode characters, spaces, * and other filesystem-valid characters faithfully for e-discovery. * * Only strips control characters and trims leading/trailing whitespace. * Normalizes path separators (backslash → forward slash) and collapses * consecutive slashes. */ declare function sanitizeFolderPath(folderPath: string): string; interface UploadOptions { folder?: string; configExtId?: string; /** Work-product type for the uploaded doc — ``source`` (default), * ``skill``, ``memory``, ``artifact``. Skills must be uploaded with * ``wp_type='skill'`` AND in a ``skills/`` folder so the * backend's ``SkillManager`` recognises them. */ wpType?: 'source' | 'skill' | 'memory' | 'artifact' | 'webpage'; } interface SkippedFile { file_name: string; reason: string; } interface UploadResult { doc_ext_ids?: string[]; batch_id?: string | null; skipped?: SkippedFile[]; } interface UploadBatchResult { doc_ext_ids: string[]; skipped: SkippedFile[]; folders: Map; } declare function listDocuments(arbi: ArbiClient): Promise<{ external_id: string; workspace_ext_id: string; file_name?: string | null | undefined; status?: string | null | undefined; error_message?: string | null | undefined; failed_stage?: string | null | undefined; n_pages?: number | null | undefined; n_chunks?: number | null | undefined; tokens?: number | null | undefined; file_type?: string | null | undefined; file_size?: number | null | undefined; storage_type?: string | null | undefined; storage_uri?: string | null | undefined; content_hash?: string | null | undefined; shared?: boolean | null | undefined; re_ocred?: boolean | null | undefined; config_ext_id?: string | null | undefined; parent_ext_id?: string | null | undefined; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; wp_type?: string | null | undefined; folder?: string | null | undefined; sender?: string | null | undefined; doctags: { note?: string | null | undefined; citations?: { passages: { chunk_id: string; doc_ext_id?: string | null | undefined; page?: number | null | undefined; }[]; } | null | undefined; external_id: string; doc_ext_id: string; tag_ext_id: string; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; }[]; doc_metadata?: { doc_nature?: string | null | undefined; doc_author?: string | null | undefined; doc_subject?: string | null | undefined; doc_date?: string | null | undefined; title?: string | null | undefined; } | null | undefined; }[]>; /** * Async iterator that yields pages of documents with a configurable lookahead. * * Uses `limit`/`offset` pagination. A FIFO queue of up to `lookahead` requests * is kept in flight: as soon as a page is awaited off the queue the next * request is enqueued, so the backend is continuously working on the next * page while the consumer processes the current one. The default of 1 keeps * one page in flight at a time (classic sequential pagination). Raise it when * you want to pipeline — each extra slot adds one more concurrent backend * scan and one more not-yet-consumed page held in memory. * * Pair `firstPageSize` with a larger `pageSize` when you need the initial * page on screen fast: e.g. `firstPageSize: 500, pageSize: 2000` renders the * first 500 rows in a fifth of the time of a single 2500-row request, then * streams in 2000-row pages after. * * Iteration stops at the first short page (length < `pageSize`) — in-flight * requests past that point are discarded. `MAX_PAGES` is a hard cap on the * number of requests issued. * * @example * ```ts * for await (const page of listPaginated(arbi, { pageSize: 5000, order: 'created_desc', fields: 'lite' })) { * // page: DocResponse[] — render incrementally as pages arrive * } * ``` * * @param arbi - Authenticated ArbiClient * @param options - Pagination options (pageSize, order, fields, signal, lookahead) * @yields Pages of documents until the backend returns a short page or signal is aborted */ declare function listPaginated(arbi: ArbiClient, options?: ListPaginatedOptions): AsyncGenerator; /** * Collect all workspace documents into a single array using sequential pagination. * * Uses `listPaginated` internally. Warns if `MAX_PAGES` is hit. * * **Note:** When `fields: 'lite'` is passed, returned docs have `doctags: []` * and `doc_metadata: null`. Fetch full per-doc data on demand when a specific * doc is opened. * * @example * ```ts * const docs = await listAll(arbi, { fields: 'lite', order: 'created_desc' }) * ``` */ declare function listAll(arbi: ArbiClient, options?: ListAllOptions): Promise; declare function getDocuments(arbi: ArbiClient, externalIds: string[]): Promise<{ external_id: string; workspace_ext_id: string; file_name?: string | null | undefined; status?: string | null | undefined; error_message?: string | null | undefined; failed_stage?: string | null | undefined; n_pages?: number | null | undefined; n_chunks?: number | null | undefined; tokens?: number | null | undefined; file_type?: string | null | undefined; file_size?: number | null | undefined; storage_type?: string | null | undefined; storage_uri?: string | null | undefined; content_hash?: string | null | undefined; shared?: boolean | null | undefined; re_ocred?: boolean | null | undefined; config_ext_id?: string | null | undefined; parent_ext_id?: string | null | undefined; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; wp_type?: string | null | undefined; folder?: string | null | undefined; sender?: string | null | undefined; doctags: { note?: string | null | undefined; citations?: { passages: { chunk_id: string; doc_ext_id?: string | null | undefined; page?: number | null | undefined; }[]; } | null | undefined; external_id: string; doc_ext_id: string; tag_ext_id: string; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; }[]; doc_metadata?: { doc_nature?: string | null | undefined; doc_author?: string | null | undefined; doc_subject?: string | null | undefined; doc_date?: string | null | undefined; title?: string | null | undefined; } | null | undefined; }[]>; declare function deleteDocuments(arbi: ArbiClient, externalIds: string[]): Promise; declare function updateDocuments(arbi: ArbiClient, documents: DocUpdateRequest$1[]): Promise<{ external_id: string; workspace_ext_id: string; file_name?: string | null | undefined; status?: string | null | undefined; error_message?: string | null | undefined; failed_stage?: string | null | undefined; n_pages?: number | null | undefined; n_chunks?: number | null | undefined; tokens?: number | null | undefined; file_type?: string | null | undefined; file_size?: number | null | undefined; storage_type?: string | null | undefined; storage_uri?: string | null | undefined; content_hash?: string | null | undefined; shared?: boolean | null | undefined; re_ocred?: boolean | null | undefined; config_ext_id?: string | null | undefined; parent_ext_id?: string | null | undefined; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; wp_type?: string | null | undefined; folder?: string | null | undefined; sender?: string | null | undefined; doctags: { note?: string | null | undefined; citations?: { passages: { chunk_id: string; doc_ext_id?: string | null | undefined; page?: number | null | undefined; }[]; } | null | undefined; external_id: string; doc_ext_id: string; tag_ext_id: string; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; }[]; doc_metadata?: { doc_nature?: string | null | undefined; doc_author?: string | null | undefined; doc_subject?: string | null | undefined; doc_date?: string | null | undefined; title?: string | null | undefined; } | null | undefined; }[]>; /** * Kick off a URL-based document ingestion. The active workspace is resolved * server-side from the open session — there is no ``workspace_ext_id`` query * param on this endpoint. */ declare function uploadUrl(arbi: ArbiClient, urls: string[], shared?: boolean): Promise<{ doc_ext_ids?: string[] | undefined; batch_id?: string | null | undefined; skipped?: { file_name: string; reason: string; }[] | undefined; }>; /** * Get parsed document content. */ declare function getParsedContent(auth: AuthHeaders, docId: string, stage: string): Promise>; /** * Batch-fetch first-page thumbnails for many documents in one request. * * Returns a map of document external id → `data:image/webp;base64` URI, or * `null` when a document has no thumbnail (media, not yet generated, or not * accessible to the caller). Purpose-built for a gallery grid that loads a whole * window of tiles in a single call rather than one request per document. */ declare function getThumbnails(auth: AuthHeaders, docIds: string[]): Promise>; /** * Upload a file. Uses raw fetch for multipart upload. The active workspace is * resolved server-side from the open session. */ declare function uploadFile$1(auth: AuthHeaders, fileData: Blob, fileName: string, options?: UploadOptions): Promise; /** * Upload multiple files in a single FormData request with an optional folder * parameter. Workspace is resolved from the session, same as ``uploadFile``. */ declare function uploadFiles(auth: AuthHeaders, files: Array<{ data: Blob; name: string; }>, options?: UploadOptions): Promise; /** * Download a document. Returns the response for the caller to handle. */ declare function downloadDocument(auth: AuthHeaders, docId: string): Promise; /** * One file prepared for the direct upload flow. The caller supplies raw, * pre-encryption bytes and a basename; the helper handles hashing + SecretBox * encryption + transport. */ interface DirectUploadFile { name: string; /** Raw file bytes (pre-encryption). */ data: Uint8Array; /** MIME type (e.g. ``application/pdf``). Optional — server will guess from name if omitted. */ contentType?: string; } interface UploadDirectOptions { shared?: boolean; folder?: string; configExtId?: string; parentExtId?: string; wpType?: string; tagExtId?: string; /** Expiry for presigned PUT URLs, in seconds. Defaults to server default (1h). */ presignExpiresIn?: number; /** * Fired as each file's ciphertext is uploaded. In the browser this yields * byte-level progress (XMLHttpRequest upload.progress); in Node this fires * once per file with `loaded === total` after each PUT completes. * * - `fileIndex` indexes into the `files` array passed to the helper. * - `fileName` is the corresponding `DirectUploadFile.name`. * - `loaded` / `total` are bytes of the *ciphertext* (= raw + 40). */ onBytesProgress?: (progress: DirectUploadProgress) => void; } interface DirectUploadProgress { fileIndex: number; fileName: string; loaded: number; total: number; } interface UploadDirectResult { /** Doc ext IDs that were committed and will process through the parse pipeline. */ doc_ext_ids: string[]; /** * Files that were not uploaded — either rejected at init (unsupported, * empty, duplicate, quota_exceeded) or reported back by the commit step * (no PUT landed, unknown ext id). Same shape as the legacy multipart * ``skipped`` list so callers can treat them uniformly. */ skipped: SkippedFile[]; } /** * Structural subset of ``ArbiClient`` that ``uploadDocumentsDirect`` actually * uses. The helper only needs the openapi-fetch client, so consumers that don't * have a full ``ArbiClient`` (e.g. the React frontend, which wires openapi-fetch * through its own middleware) can pass ``{ fetch }`` directly without a cast. */ type DirectUploadClient = Pick; /** * Minimal extension → MIME mapping to avoid a `mime-types` dep. * * Browser callers don't usually need this — a File's `.type` is already * populated by the browser — but CLI/Node callers construct Blobs from raw * bytes and must set the MIME explicitly, otherwise multipart parts land as * `application/octet-stream`. Exported for both consumers so the mapping * lives in one place. */ declare function mimeFromName(name: string): string | undefined; /** * Upload files via the direct-to-MinIO flow (SecretBox on the client, * presigned PUT to nginx→MinIO, then commit). * * Three phases: * 1. ``POST /v1/document/upload-init`` — declare files, receive presigned PUT * URLs for every ``uploading`` slot. Duplicate / unsupported / empty / * quota slots are surfaced as ``skipped`` in the result. * 2. ``PUT {upload_url}`` — encrypt each file with ``workspaceKey`` and PUT * the ciphertext directly to MinIO via the public ``/arbi-files/`` route. * arbi-app is not in the byte path. * 3. ``POST /v1/document/upload-commit`` — HEAD-verify objects landed and * flip rows to ``queued``. Failures here are also reported as skipped * (not thrown) so a partial-upload error for one file doesn't lose the * doc ids for the rest. * * The helper is browser-safe — it only touches ``Uint8Array`` / ``fetch``. Node * callers that want to upload files from disk should use the wrapper in * ``documents-node`` which reads ``fs`` into the ``data`` field. */ declare function uploadDocumentsDirect(arbi: DirectUploadClient, workspaceKey: Uint8Array, files: DirectUploadFile[], options?: UploadDirectOptions): Promise; type documents_DirectUploadClient = DirectUploadClient; type documents_DirectUploadFile = DirectUploadFile; type documents_DirectUploadProgress = DirectUploadProgress; type documents_DocumentListFields = DocumentListFields; type documents_DocumentListOrder = DocumentListOrder; type documents_ListAllOptions = ListAllOptions; type documents_ListPaginatedOptions = ListPaginatedOptions; declare const documents_MAX_PAGES: typeof MAX_PAGES; declare const documents_SUPPORTED_EXTENSIONS: typeof SUPPORTED_EXTENSIONS; type documents_SkippedFile = SkippedFile; type documents_UploadBatchResult = UploadBatchResult; type documents_UploadDirectOptions = UploadDirectOptions; type documents_UploadDirectResult = UploadDirectResult; type documents_UploadOptions = UploadOptions; type documents_UploadResult = UploadResult; declare const documents_deleteDocuments: typeof deleteDocuments; declare const documents_downloadDocument: typeof downloadDocument; declare const documents_getDocuments: typeof getDocuments; declare const documents_getParsedContent: typeof getParsedContent; declare const documents_getThumbnails: typeof getThumbnails; declare const documents_listAll: typeof listAll; declare const documents_listDocuments: typeof listDocuments; declare const documents_listPaginated: typeof listPaginated; declare const documents_mimeFromName: typeof mimeFromName; declare const documents_sanitizeFolderPath: typeof sanitizeFolderPath; declare const documents_updateDocuments: typeof updateDocuments; declare const documents_uploadDocumentsDirect: typeof uploadDocumentsDirect; declare const documents_uploadFiles: typeof uploadFiles; declare const documents_uploadUrl: typeof uploadUrl; declare namespace documents { export { type documents_DirectUploadClient as DirectUploadClient, type documents_DirectUploadFile as DirectUploadFile, type documents_DirectUploadProgress as DirectUploadProgress, type documents_DocumentListFields as DocumentListFields, type documents_DocumentListOrder as DocumentListOrder, type documents_ListAllOptions as ListAllOptions, type documents_ListPaginatedOptions as ListPaginatedOptions, documents_MAX_PAGES as MAX_PAGES, documents_SUPPORTED_EXTENSIONS as SUPPORTED_EXTENSIONS, type documents_SkippedFile as SkippedFile, type documents_UploadBatchResult as UploadBatchResult, type documents_UploadDirectOptions as UploadDirectOptions, type documents_UploadDirectResult as UploadDirectResult, type documents_UploadOptions as UploadOptions, type documents_UploadResult as UploadResult, documents_deleteDocuments as deleteDocuments, documents_downloadDocument as downloadDocument, documents_getDocuments as getDocuments, documents_getParsedContent as getParsedContent, documents_getThumbnails as getThumbnails, documents_listAll as listAll, documents_listDocuments as listDocuments, documents_listPaginated as listPaginated, documents_mimeFromName as mimeFromName, documents_sanitizeFolderPath as sanitizeFolderPath, documents_updateDocuments as updateDocuments, documents_uploadDocumentsDirect as uploadDocumentsDirect, uploadFile$1 as uploadFile, documents_uploadFiles as uploadFiles, documents_uploadUrl as uploadUrl }; } /** * Assistant operations — retrieve (search-only) and query (with LLM). * * retrieve: Uses the typed SDK route POST /v1/assistant/retrieve. * Returns matching chunks without LLM generation. * * queryAssistant: Returns the raw Response for SSE streaming. * Uses raw fetch because the SDK client doesn't support streaming responses. */ declare function buildRetrievalChunkTool(docIds: string[], searchMode?: 'semantic' | 'keyword' | 'hybrid'): components['schemas']['RetrievalChunkTool']; declare function buildRetrievalFullContextTool(docIds: string[]): components['schemas']['RetrievalFullContextTool']; declare function buildRetrievalTocTool(docIds: string[]): components['schemas']['RetrievalTOCTool']; interface RetrieveOptions { arbi: ArbiClient; workspaceId: string; query: string; docIds: string[]; searchMode?: 'semantic' | 'keyword' | 'hybrid'; fullContextDocIds?: string[]; tocDocIds?: string[]; model?: string; } interface ChunkMetadata { doc_ext_id?: string | null; doc_title?: string | null; chunk_ext_id: string; chunk_pg_idx: number; chunk_doc_idx: number; page_number: number; score?: number | null; rerank_score?: number | null; tokens?: number | null; created_at: string; heading: boolean; } interface Chunk { metadata: ChunkMetadata; content: string; } interface RetrieveResult { retrieval_chunk?: { tool_responses: Record; }; retrieval_full_context?: { tool_responses: Record; }; retrieval_toc?: { tool_responses: Record[]>; }; } /** * Search documents and return matching chunks without LLM generation. * Uses the typed SDK route POST /v1/assistant/retrieve. */ declare function retrieve(options: RetrieveOptions): Promise; interface AssistantQueryOptions extends AuthHeaders { workspaceId: string; question: string; docIds: string[]; previousResponseId?: string | null; model?: string; } /** * Send a query to the RAG assistant. Returns the raw Response * so the caller can stream or buffer as needed. * * Uses raw fetch (not the SDK client) because we need the streaming * Response body — the SDK client consumes the body to parse JSON. */ declare function queryAssistant(options: AssistantQueryOptions): Promise; /** * Interject into a running agent turn with input — answer its ask_user question, * or (as raw text) send a steering interjection or a run-control command * (`/pause`, `/resume`, `/report`). The backend classifies the text; the * assistant_message_ext_id identifies which streaming turn to interject into. */ declare function respondToAgent(arbi: ArbiClient, assistantMessageExtId: string, answer: string): Promise; /** A single user-invocable skill as exposed by ``GET /v1/assistant/skills``. * Re-exported with the schema-generated shape so callers don't have to * reach into ``components['schemas']`` themselves. */ type SkillSummary = components['schemas']['SkillSummaryResponse']; /** * List the skills the caller can invoke in the active workspace. * * Powers slash-command autocomplete in the TUI, CLI, and React UI. * Returns lightweight metadata only (name, description, args hint) — * never the SKILL.md body. To read the body, fetch the document via * ``getParsedContent(authHeaders, doc_ext_id, 'content')``. * * Scoped to the workspace the caller has open (the backend uses the * session's ``active_workspace``); cross-workspace listing isn't * supported because each workspace has its own encryption key. * * @param includeHidden When ``true``, returns skills with * ``user-invocable: false`` in their frontmatter. Off by default — * those are typically agent-only or in-progress skills that * shouldn't surface in slash menus. */ declare function listSkills(arbi: ArbiClient, options?: { includeHidden?: boolean; }): Promise; /** A built-in slash command as exposed by ``GET /v1/assistant/commands``. * These are shipped commands (``/image``, ``/compact``, …) from the backend * command registry — distinct from dynamic user-authored skills. */ type CommandDescriptor = components['schemas']['CommandDescriptorResponse']; /** * List the built-in slash commands the caller can invoke (``/image``, * ``/compact``, ``/goal``, ``/pa``, …), respecting per-user gates * (``show_pa_mode`` / ``GOALS_ENABLED``). * * These come from the backend command registry — the single source of truth * shared with the dispatcher — so clients no longer hardcode the list. Merge * with {@link listSkills} to build a complete slash menu (built-ins + dynamic * user-authored skills). */ declare function listCommands(arbi: ArbiClient): Promise; /** Parsed slash-command shape, regardless of frontend. */ interface ParsedSlashCommand { /** The lowercased token immediately after ``/``. */ slug: string; /** Everything after the first whitespace, untrimmed. ``""`` when the * user hasn't typed any arguments yet. */ args: string; } /** * Parse a *submitted* slash command (or anything that walks like one). * * Permissive about whitespace: leading whitespace is tolerated so * pasted snippets like `` /summarize foo`` still parse. The slug * grammar matches the backend's ``SkillManager._slug`` output (alnum * + underscore + dash), which is also what the autocomplete menus * surface, so there's exactly one definition of "valid slug." * * Returns ``null`` if the input doesn't start with ``/``. * * Use this in **dispatchers** (TUI command-registry) and **pre-flight * hint** paths where you want to react to any in-progress or * submitted slash command. For the narrower "user is typing a slug * with no args yet" UX, use ``parseSlashTokenInProgress``. */ declare function parseSlashCommand(input: string): ParsedSlashCommand | null; /** * Parse a slash-command **in progress** — the buffer is just * ``/`` with no committed arguments yet (no space after the * slug). This is the trigger condition for the autocomplete menu: * the moment the user types a space, the slug is "committed" and the * menu should hide so further keystrokes form the arguments. * * Empty token is allowed (a bare ``/``) so the menu opens immediately * and lists everything — same UX as Slack/Discord. */ declare function parseSlashTokenInProgress(buffer: string): string | null; /** * Filter a list of skill summaries by a typed query and sort by * relevance: prefix matches first, then substring matches, alphabetic * within each bucket. Pinned slugs (the user's favourites — surfaced * by the React library modal) float to the very top. * * Pure function — same logic used by the React popover, the TUI * autocomplete, and the CLI. Pulling it out of the React component * means a change to the matching rules lands in one place. */ declare function filterSkills(items: ReadonlyArray, query: string, pinned?: ReadonlyArray): T[]; type assistant_AssistantQueryOptions = AssistantQueryOptions; type assistant_Chunk = Chunk; type assistant_ChunkMetadata = ChunkMetadata; type assistant_CommandDescriptor = CommandDescriptor; type assistant_ParsedSlashCommand = ParsedSlashCommand; type assistant_RetrieveOptions = RetrieveOptions; type assistant_RetrieveResult = RetrieveResult; type assistant_SkillSummary = SkillSummary; declare const assistant_buildRetrievalChunkTool: typeof buildRetrievalChunkTool; declare const assistant_buildRetrievalFullContextTool: typeof buildRetrievalFullContextTool; declare const assistant_buildRetrievalTocTool: typeof buildRetrievalTocTool; declare const assistant_filterSkills: typeof filterSkills; declare const assistant_listCommands: typeof listCommands; declare const assistant_listSkills: typeof listSkills; declare const assistant_parseSlashCommand: typeof parseSlashCommand; declare const assistant_parseSlashTokenInProgress: typeof parseSlashTokenInProgress; declare const assistant_queryAssistant: typeof queryAssistant; declare const assistant_respondToAgent: typeof respondToAgent; declare const assistant_retrieve: typeof retrieve; declare namespace assistant { export { type assistant_AssistantQueryOptions as AssistantQueryOptions, type assistant_Chunk as Chunk, type assistant_ChunkMetadata as ChunkMetadata, type assistant_CommandDescriptor as CommandDescriptor, type assistant_ParsedSlashCommand as ParsedSlashCommand, type assistant_RetrieveOptions as RetrieveOptions, type assistant_RetrieveResult as RetrieveResult, type assistant_SkillSummary as SkillSummary, assistant_buildRetrievalChunkTool as buildRetrievalChunkTool, assistant_buildRetrievalFullContextTool as buildRetrievalFullContextTool, assistant_buildRetrievalTocTool as buildRetrievalTocTool, assistant_filterSkills as filterSkills, assistant_listCommands as listCommands, assistant_listSkills as listSkills, assistant_parseSlashCommand as parseSlashCommand, assistant_parseSlashTokenInProgress as parseSlashTokenInProgress, assistant_queryAssistant as queryAssistant, assistant_respondToAgent as respondToAgent, assistant_retrieve as retrieve }; } /** * Contact operations — list, add, remove. */ declare function listContacts(arbi: ArbiClient): Promise<{ external_id?: string | null | undefined; email: string; user?: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; } | null | undefined; status: "invitation_pending" | "invitation_expired" | "registered" | "failed"; created_at: string; shared_workspace_ext_id?: string | null | undefined; outcome?: ("invited" | "reinvited" | "not_resent_still_pending" | "contact_added" | "already_contact" | "failed") | null | undefined; outcome_detail?: string | null | undefined; }[]>; declare function addContacts(arbi: ArbiClient, emails: string[]): Promise<{ external_id?: string | null | undefined; email: string; user?: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; } | null | undefined; status: "invitation_pending" | "invitation_expired" | "registered" | "failed"; created_at: string; shared_workspace_ext_id?: string | null | undefined; outcome?: ("invited" | "reinvited" | "not_resent_still_pending" | "contact_added" | "already_contact" | "failed") | null | undefined; outcome_detail?: string | null | undefined; }[]>; declare function removeContacts(arbi: ArbiClient, contactIds: string[]): Promise; /** * Group contacts by registration status. * Returns registered contacts and pending (not yet registered) contacts. */ declare function groupContactsByStatus(contactList: T[]): { registered: T[]; pending: T[]; }; declare const contacts_addContacts: typeof addContacts; declare const contacts_groupContactsByStatus: typeof groupContactsByStatus; declare const contacts_listContacts: typeof listContacts; declare const contacts_removeContacts: typeof removeContacts; declare namespace contacts { export { contacts_addContacts as addContacts, contacts_groupContactsByStatus as groupContactsByStatus, contacts_listContacts as listContacts, contacts_removeContacts as removeContacts }; } /** * Direct message / notification operations — list, send, mark read, delete. * * All message content is E2E encrypted using ECDH (X25519 + XSalsa20-Poly1305). * Encryption keys are derived from the user's Ed25519 signing keypair. */ type NotificationResponse = components['schemas']['NotificationResponse']; /** A resolved DM recipient: their external_id + curve25519 public key. */ interface ResolvedRecipient { extId: string; pubKey: string; } /** * Everything needed to encrypt/decrypt DMs. * Derive once per session, pass to all DM operations. */ interface DmCryptoContext { /** User's X25519 encryption keypair (derived from Ed25519 signing key) */ encryptionKeypair: KeyPair; /** User's own external_id (to determine send vs receive direction) */ userExtId: string; } /** * Create a DM crypto context from a signing private key. * * @param arbi - ArbiClient instance (provides crypto utilities) * @param signingPrivateKeyBytes - Ed25519 signing private key (64 bytes) * @param userExtId - Current user's external_id */ declare function createDmCryptoContext(arbi: ArbiClient, signingPrivateKeyBytes: Uint8Array, userExtId: string): DmCryptoContext; /** * Encrypt a plaintext message for a recipient. * * @param arbi - ArbiClient instance * @param plaintext - Message content to encrypt * @param recipientEncryptionPubKeyBase64 - Recipient's X25519 public key (base64) * @param senderEncryptionSecretKey - Sender's X25519 secret key (Uint8Array) * @returns Base64-encoded ciphertext (nonce prepended) */ declare function encryptDmContent(arbi: ArbiClient, plaintext: string, recipientEncryptionPubKeyBase64: string, senderEncryptionSecretKey: Uint8Array): Promise; /** * Decrypt an encrypted notification message. * * Uses the sender/recipient public keys embedded in NotificationResponse * to determine the "other party" for ECDH decryption. * * @param arbi - ArbiClient instance * @param notification - The notification with encrypted content * @param crypto - DM crypto context for the current user * @returns Decrypted plaintext, or null if content is empty * @throws Error if decryption fails (wrong keys or tampered message) */ declare function decryptDmContent(arbi: ArbiClient, notification: NotificationResponse, crypto: DmCryptoContext): Promise; /** * Decrypt a batch of notifications, replacing content in-place. * Failed decryptions get content set to '[Decryption failed]'. * * @returns New array with decrypted content */ declare function decryptDmBatch(arbi: ArbiClient, notifications: NotificationResponse[], crypto: DmCryptoContext): Promise; /** * List DMs (raw — content is encrypted ciphertext). */ declare function listDMs(arbi: ArbiClient): Promise<{ type: components["schemas"]["NotificationType"]; external_id: string; sender: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; recipient: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; workspace_ext_id?: string | null | undefined; content?: string | null | undefined; conversation_ext_id?: string | null | undefined; task_ext_id?: string | null | undefined; read: boolean; created_at: string; updated_at: string; }[]>; /** * List and decrypt DMs in one call. */ declare function listDecryptedDMs(arbi: ArbiClient, crypto: DmCryptoContext): Promise<{ type: components["schemas"]["NotificationType"]; external_id: string; sender: components["schemas"]["UserResponse"]; recipient: components["schemas"]["UserResponse"]; workspace_ext_id?: string | null; content?: string | null; conversation_ext_id?: string | null; task_ext_id?: string | null; read: boolean; created_at: string; updated_at: string; }[]>; /** * List the current user's durable activity feed, newest first. * * Activity notifications are backend-originated, to-self log lines (recipient == * sender == the acting user) that are always read — they never appear in the * normal DM/notification feed or the unread badge. Reading them requires the * explicit `type=activity` filter, which this helper always sets. */ declare function listActivity(arbi: ArbiClient, options?: { limit?: number; offset?: number; }): Promise<{ type: components["schemas"]["NotificationType"]; external_id: string; sender: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; recipient: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; workspace_ext_id?: string | null | undefined; content?: string | null | undefined; conversation_ext_id?: string | null | undefined; task_ext_id?: string | null | undefined; read: boolean; created_at: string; updated_at: string; }[]>; /** * Resolve a recipient reference (email OR `usr-`/`agt-` external_id) into the * `{ extId, pubKey }` an encrypted send needs. Walks three directories in order * — contacts, parent-owned agents, current-workspace members — and stops at the * first hit with a usable curve25519 public key. Returns `null` when nothing * matches so callers can surface a recovery hint. * * This is the single resolution path shared by the app, the CLI and seeding — * no consumer should re-implement directory lookups. */ declare function resolveRecipient(arbi: ArbiClient, ref: string): Promise; /** * Send an E2E encrypted DM. * * Encrypts plaintext content for each recipient using their public key. * Requires recipient public keys — fetch via contacts or user lookup first. * * Returns the created notifications with their content as **plaintext**, not * ciphertext — matching what `listDecryptedDMs` returns. The sender supplied the * text, so it is handed straight back: a caller must never have to re-fetch and * re-decrypt its own ciphertext just to render the message it has just sent. * * @param arbi - ArbiClient instance * @param messages - Array of { recipient_ext_id, content (plaintext), recipient_encryption_public_key } * @param crypto - DM crypto context for the sender */ declare function sendEncryptedDM(arbi: ArbiClient, messages: Array<{ recipient_ext_id: string; content: string; recipient_encryption_public_key: string; }>, crypto: DmCryptoContext): Promise; /** * Ask another user to grant you workspace access. * * Creates a `workspace_access_request` notification. The `content` is an * opaque base64 blob, E2E-encrypted with the requester↔recipient shared key * (same scheme as a DM), carrying the requester's live session public key * (`sessionPubkeyB64`) so the recipient can mint a temporary, session-scoped * grant, plus an optional note. * * `workspaceExtId` is optional and only meaningful for API/SDK/CLI callers who * already know a workspace id (obtained out-of-band); omit it and the recipient * picks the workspace. */ declare function requestWorkspaceAccess(arbi: ArbiClient, params: { recipientExtId: string; recipientEncryptionPublicKey: string; sessionPubkeyB64: string; note?: string; workspaceExtId?: string; }, crypto: DmCryptoContext): Promise<{ type: components["schemas"]["NotificationType"]; external_id: string; sender: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; recipient: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; workspace_ext_id?: string | null | undefined; content?: string | null | undefined; conversation_ext_id?: string | null | undefined; task_ext_id?: string | null | undefined; read: boolean; created_at: string; updated_at: string; }>; /** * Send a plaintext DM (no encryption). * @deprecated Use sendEncryptedDM instead. */ declare function sendDM(arbi: ArbiClient, messages: Array<{ recipient_ext_id: string; content: string; }>): Promise<{ type: components["schemas"]["NotificationType"]; external_id: string; sender: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; recipient: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; workspace_ext_id?: string | null | undefined; content?: string | null | undefined; conversation_ext_id?: string | null | undefined; task_ext_id?: string | null | undefined; read: boolean; created_at: string; updated_at: string; }[]>; declare function markRead(arbi: ArbiClient, messageIds: string[]): Promise<{ type: components["schemas"]["NotificationType"]; external_id: string; sender: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; recipient: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; workspace_ext_id?: string | null | undefined; content?: string | null | undefined; conversation_ext_id?: string | null | undefined; task_ext_id?: string | null | undefined; read: boolean; created_at: string; updated_at: string; }[]>; declare function deleteDMs(arbi: ArbiClient, messageIds: string[]): Promise; type dm_DmCryptoContext = DmCryptoContext; type dm_ResolvedRecipient = ResolvedRecipient; declare const dm_createDmCryptoContext: typeof createDmCryptoContext; declare const dm_decryptDmBatch: typeof decryptDmBatch; declare const dm_decryptDmContent: typeof decryptDmContent; declare const dm_deleteDMs: typeof deleteDMs; declare const dm_encryptDmContent: typeof encryptDmContent; declare const dm_listActivity: typeof listActivity; declare const dm_listDMs: typeof listDMs; declare const dm_listDecryptedDMs: typeof listDecryptedDMs; declare const dm_markRead: typeof markRead; declare const dm_requestWorkspaceAccess: typeof requestWorkspaceAccess; declare const dm_resolveRecipient: typeof resolveRecipient; declare const dm_sendDM: typeof sendDM; declare const dm_sendEncryptedDM: typeof sendEncryptedDM; declare namespace dm { export { type dm_DmCryptoContext as DmCryptoContext, type dm_ResolvedRecipient as ResolvedRecipient, dm_createDmCryptoContext as createDmCryptoContext, dm_decryptDmBatch as decryptDmBatch, dm_decryptDmContent as decryptDmContent, dm_deleteDMs as deleteDMs, dm_encryptDmContent as encryptDmContent, dm_listActivity as listActivity, dm_listDMs as listDMs, dm_listDecryptedDMs as listDecryptedDMs, dm_markRead as markRead, dm_requestWorkspaceAccess as requestWorkspaceAccess, dm_resolveRecipient as resolveRecipient, dm_sendDM as sendDM, dm_sendEncryptedDM as sendEncryptedDM }; } /** * File operations — OpenAI-compatible Files API (list, get, delete, upload, content). */ type FileObject = components['schemas']['FileObject']; type FileDeleteResponse = components['schemas']['FileDeleteResponse']; type FileListResponse = components['schemas']['FileListResponse']; interface ListFilesOptions { purpose?: string | null; limit?: number; order?: string; after?: string | null; } declare function listFiles(arbi: ArbiClient, options?: ListFilesOptions): Promise<{ object: string; data: { id: string; object: string; bytes: number; created_at: number; filename: string; purpose: string; status: string; expires_at?: number | null | undefined; status_details?: string | null | undefined; }[]; has_more: boolean; first_id?: string | null | undefined; last_id?: string | null | undefined; }>; declare function getFile(arbi: ArbiClient, fileId: string): Promise<{ id: string; object: string; bytes: number; created_at: number; filename: string; purpose: string; status: string; expires_at?: number | null | undefined; status_details?: string | null | undefined; }>; declare function deleteFile(arbi: ArbiClient, fileId: string): Promise<{ id: string; object: string; deleted: boolean; }>; /** * Upload a file via the OpenAI-compatible Files API. * Uses raw fetch for multipart upload. */ declare function uploadFile(auth: AuthHeaders, fileData: Blob, fileName: string, purpose?: string): Promise; /** * Get file content (binary). Returns the raw Response for the caller to handle. */ declare function getFileContent(auth: AuthHeaders, fileId: string): Promise; type files_FileDeleteResponse = FileDeleteResponse; type files_FileListResponse = FileListResponse; type files_FileObject = FileObject; type files_ListFilesOptions = ListFilesOptions; declare const files_deleteFile: typeof deleteFile; declare const files_getFile: typeof getFile; declare const files_getFileContent: typeof getFileContent; declare const files_listFiles: typeof listFiles; declare const files_uploadFile: typeof uploadFile; declare namespace files { export { type files_FileDeleteResponse as FileDeleteResponse, type files_FileListResponse as FileListResponse, type files_FileObject as FileObject, type files_ListFilesOptions as ListFilesOptions, files_deleteFile as deleteFile, files_getFile as getFile, files_getFileContent as getFileContent, files_listFiles as listFiles, files_uploadFile as uploadFile }; } /** * Scheduled agent tasks — one-time, recurring (RFC-5545 rrule) or event-triggered * jobs whose action is a reminder, an agent prompt, or a skill run. * Backend: `/v1/tasks` (src/api/v1/routers/tasks.py). */ type TaskResponse = components['schemas']['TaskResponse']; type CreateTaskRequest = components['schemas']['CreateTaskRequest']; type UpdateTaskRequest = components['schemas']['UpdateTaskRequest']; /** List the caller's scheduled tasks (newest first). */ declare function listTasks(arbi: ArbiClient): Promise; /** Create a scheduled task. `name` is required; supply trigger + action fields. */ declare function createTask(arbi: ArbiClient, body: CreateTaskRequest): Promise; declare function getTask(arbi: ArbiClient, taskId: string): Promise; /** Update a task — including `status` to pause/resume (`active` | `paused`). */ declare function updateTask(arbi: ArbiClient, taskId: string, body: UpdateTaskRequest): Promise; declare function deleteTask(arbi: ArbiClient, taskId: string): Promise; /** Fire a task immediately without advancing its schedule. */ declare function runTask(arbi: ArbiClient, taskId: string): Promise; type tasks_CreateTaskRequest = CreateTaskRequest; type tasks_TaskResponse = TaskResponse; type tasks_UpdateTaskRequest = UpdateTaskRequest; declare const tasks_createTask: typeof createTask; declare const tasks_deleteTask: typeof deleteTask; declare const tasks_getTask: typeof getTask; declare const tasks_listTasks: typeof listTasks; declare const tasks_runTask: typeof runTask; declare const tasks_updateTask: typeof updateTask; declare namespace tasks { export { type tasks_CreateTaskRequest as CreateTaskRequest, type tasks_TaskResponse as TaskResponse, type tasks_UpdateTaskRequest as UpdateTaskRequest, tasks_createTask as createTask, tasks_deleteTask as deleteTask, tasks_getTask as getTask, tasks_listTasks as listTasks, tasks_runTask as runTask, tasks_updateTask as updateTask }; } /** * Workspace note — per-workspace encrypted knowledge notes with citations. * The firm's practice profile / house style / precedent knowhow lives here and is * read by grounded agents. All endpoints require an OPEN workspace. * Backend: `/v1/facts` (src/api/v1/routers/notes.py). */ type FactResponse = components['schemas']['FactResponse']; type CreateFactRequest = components['schemas']['CreateFactRequest']; type UpdateFactRequest = components['schemas']['UpdateFactRequest']; type FactSearchRequest = components['schemas']['FactSearchRequest']; type FactSearchResponse = components['schemas']['FactSearchResponse']; /** Create a note. `content` is required; `shared` makes it workspace-wide. */ declare function createFact(arbi: ArbiClient, body: CreateFactRequest): Promise; /** List the open workspace's notes (newest first). */ /** * List notes. Passing a date range — or `datedOnly` — turns this into the * TIMELINE: only dated notes, ordered by when they happened rather than when * they were written. Each bound is read at its own precision and widened * outward, so `to: '2019'` runs through 31 December. * * The range selects by overlap, so a note spanning all of 2019 shows up in a * one-month window it covers. */ declare function listFacts(arbi: ArbiClient, options?: { pinnedOnly?: boolean; from?: string; to?: string; datedOnly?: boolean; }): Promise; /** Semantic/keyword/hybrid search across the workspace's notes. */ declare function searchFacts(arbi: ArbiClient, body: FactSearchRequest): Promise; declare function updateFact(arbi: ArbiClient, factId: string, body: UpdateFactRequest): Promise; declare function deleteFact(arbi: ArbiClient, factId: string): Promise; /** * Set a one-off reminder on a dated note. Give `remindAt` for an explicit time, * or `leadMinutes` to fire that long before the note's date; with neither it * fires when the note's span starts. A reminder whose time has already passed * is rejected rather than silently never firing. */ declare function remindFact(arbi: ArbiClient, factId: string, options?: { remindAt?: string; leadMinutes?: number; }): Promise; type facts_CreateFactRequest = CreateFactRequest; type facts_FactResponse = FactResponse; type facts_FactSearchRequest = FactSearchRequest; type facts_FactSearchResponse = FactSearchResponse; type facts_UpdateFactRequest = UpdateFactRequest; declare const facts_createFact: typeof createFact; declare const facts_deleteFact: typeof deleteFact; declare const facts_listFacts: typeof listFacts; declare const facts_remindFact: typeof remindFact; declare const facts_searchFacts: typeof searchFacts; declare const facts_updateFact: typeof updateFact; declare namespace facts { export { type facts_CreateFactRequest as CreateFactRequest, type facts_FactResponse as FactResponse, type facts_FactSearchRequest as FactSearchRequest, type facts_FactSearchResponse as FactSearchResponse, type facts_UpdateFactRequest as UpdateFactRequest, facts_createFact as createFact, facts_deleteFact as deleteFact, facts_listFacts as listFacts, facts_remindFact as remindFact, facts_searchFacts as searchFacts, facts_updateFact as updateFact }; } type DocUpdateRequest = components['schemas']['DocUpdateRequest']; type WorkspaceUpdateRequest$1 = components['schemas']['WorkspaceUpdateRequest']; type UpdateTagRequest$1 = components['schemas']['UpdateTagRequest']; type TagFormat = components['schemas']['TagFormat']; type CitationSources$1 = components['schemas']['CitationSources']; type UserSettingsUpdate$1 = components['schemas']['UserSettingsUpdate']; type ConfigUpdateData$1 = components['schemas']['ConfigUpdateData']; interface ArbiOptions { /** Backend API URL (e.g. 'https://arbi.mycompany.com') */ url: string; /** Deployment domain for key derivation. Defaults to hostname of url. */ deploymentDomain?: string; /** Include credentials (cookies) in requests. Default: 'omit' for SDK consumers. */ credentials?: 'include' | 'omit' | 'same-origin'; } interface QueryOptions { /** Document IDs to search against */ docIds: string[]; /** Previous response ID for follow-up questions */ previousResponseId?: string | null; /** Model to use for generation */ model?: string; /** Called for each streaming token */ onToken?: (content: string) => void; /** Called when stream starts */ onStreamStart?: (data: SSEStreamStartData) => void; /** Called for each agent step */ onOutputItemDone?: (data: ResponseOutputItemDoneEvent) => void; /** Called on stream error */ onError?: (message: string) => void; /** Called when a user message event is received */ onUserMessage?: (data: UserMessageEvent) => void; /** Called when message metadata is received */ onMetadata?: (data: MessageMetadataPayload$1) => void; /** Called when the agent requests user input */ onUserInputRequest?: (data: UserInputRequestEvent) => void; /** Called when an artifact event is received */ onArtifact?: (data: ArtifactEvent) => void; /** Called when backend elapsed time is received */ onElapsedTime?: (t: number) => void; /** Called when stream completes */ onComplete?: () => void; } declare class Arbi { private client; private loginResult; private currentWorkspaceId; private dmCryptoContext; private readonly options; constructor(options: ArbiOptions); /** Initialize the SDK client and sodium crypto. Called automatically by login(). */ init(): Promise; /** * Request a verification email for registration. * The user will receive an email with a 3-word verification code. */ requestVerification(email: string): Promise; /** * Register a new account using the verification code received by email. */ register(params: { email: string; password: string; verificationCode: string; firstName?: string; lastName?: string; }): Promise; /** * Log in with email and password. * Initializes the SDK client if not already done. */ login(email: string, password: string): Promise; /** * Recover a session using a stored signing private key (base64). * Useful for session recovery without re-entering the password. */ loginWithKey(email: string, signingPrivateKeyBase64: string): Promise; /** * Select a workspace by ID. Fetches the workspace list, finds the matching * workspace, decrypts the wrapped key, and sets up auth headers. */ selectWorkspace(workspaceId: string): Promise; /** Log out and clear internal state. */ logout(): Promise; /** Get the underlying ArbiClient (throws if not initialized). */ getClient(): ArbiClient; /** Get the current workspace ID (throws if none selected). */ getWorkspaceId(): string; /** Check if the user is logged in. */ get isLoggedIn(): boolean; /** Check if a workspace is selected. */ get hasWorkspace(): boolean; /** * Live connection info for opening a raw transport (e.g. a WebSocket). * * Reads the access token from the session on each call, so a token refreshed * elsewhere is reflected on the next (re)connect. Returns `null` when there is * no client/token yet (not logged in) rather than throwing, so callers can * poll for readiness instead of guarding against exceptions. */ getConnectionInfo(): { baseUrl: string; accessToken: string; } | null; private getAuthHeaders; readonly projects: { list: () => Promise<{ external_id: string; name: string; created_by: string; packs: number; subscription: string; created_at: string; quotas: { storage_gb: { used: number; limit: number; }; ai_credits: { used: number; limit: number; }; collaborators: { used: number; limit: number; }; budget_reset_at?: number | null | undefined; }; daily_cap_per_user?: number | null | undefined; price_id?: string | null | undefined; plan?: string | null | undefined; amount?: number | null | undefined; currency?: string | null | undefined; current_period_end?: number | null | undefined; cancel_at_period_end?: boolean | null | undefined; portal_url?: string | null | undefined; }[]>; create: (name: string) => Promise<{ external_id: string; name: string; created_by: string; packs: number; subscription: string; created_at: string; quotas: { storage_gb: { used: number; limit: number; }; ai_credits: { used: number; limit: number; }; collaborators: { used: number; limit: number; }; budget_reset_at?: number | null | undefined; }; daily_cap_per_user?: number | null | undefined; price_id?: string | null | undefined; plan?: string | null | undefined; amount?: number | null | undefined; currency?: string | null | undefined; current_period_end?: number | null | undefined; cancel_at_period_end?: boolean | null | undefined; portal_url?: string | null | undefined; }>; refresh: (projectExtId: string) => Promise<{ external_id: string; name: string; created_by: string; packs: number; subscription: string; created_at: string; quotas: { storage_gb: { used: number; limit: number; }; ai_credits: { used: number; limit: number; }; collaborators: { used: number; limit: number; }; budget_reset_at?: number | null | undefined; }; daily_cap_per_user?: number | null | undefined; price_id?: string | null | undefined; plan?: string | null | undefined; amount?: number | null | undefined; currency?: string | null | undefined; current_period_end?: number | null | undefined; cancel_at_period_end?: boolean | null | undefined; portal_url?: string | null | undefined; }>; /** AI usage + spend breakdown for a project's billing period. */ usage: (projectExtId: string, monthsBack?: number) => Promise<{ project_ext_id: string; period_start: string; period_end: string; total_spend: number; total_tokens: number; total_requests: number; daily: components["schemas"]["DailyUsage"][]; model_groups: { [key: string]: components["schemas"]["ModelGroupUsage"]; }; by_workspace: { [key: string]: components["schemas"]["TagBreakdown"]; }; by_user: { [key: string]: components["schemas"]["TagBreakdown"]; }; by_feature: { [key: string]: components["schemas"]["TagBreakdown"]; }; invoice_pdf?: string | null; }>; /** Stripe invoices for a project's subscription. */ invoices: (projectExtId: string) => Promise<{ project_ext_id: string; invoices: components["schemas"]["ProjectInvoice"][]; }>; }; readonly user: { /** * The authenticated user's identity from the current session * (`external_id`, plus `email` when the session carries one), established at * login. Returns `null` when not logged in. This is the canonical "who am I" * accessor — DM direction and ownership checks read it instead of re-deriving * identity per call. * * The external_id alone decides identity. A session without an email (e.g. an * agent, or a key-restored session) is still a known user, so `email` is * nullable rather than gating the whole identity: an ownership check must * never silently fail open just because the email is missing. */ identity: () => { externalId: string; email: string | null; } | null; /** Today's deployment-wide credit spend for the current user. */ usageToday: () => Promise<{ credits_used: number; }>; }; readonly workspaces: { list: () => Promise<{ external_id: string; name: string; description: string | null; is_public: boolean; workspace_type: components["schemas"]["WorkspaceType"]; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; wrapped_key?: string | null | undefined; is_member: boolean; shared_conversation_count: number; private_conversation_count: number; shared_document_count: number; private_document_count: number; user_files_mb: number; users: { user: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; role: components["schemas"]["WorkspaceRole"]; joined_at: string; conversation_count: number; document_count: number; files_mb: number; agent_ext_id?: string | null | undefined; is_temporary: boolean; }[]; project_ext_id?: string | null | undefined; project_name?: string | null | undefined; project_subscription?: string | null | undefined; project_owner_ext_id?: string | null | undefined; }[]>; create: (name: string, projectExtId: string, description?: string | null, isPublic?: boolean) => Promise<{ external_id: string; name: string; description: string | null; is_public: boolean; workspace_type: components["schemas"]["WorkspaceType"]; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; wrapped_key?: string | null | undefined; is_member: boolean; shared_conversation_count: number; private_conversation_count: number; shared_document_count: number; private_document_count: number; user_files_mb: number; users: { user: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; role: components["schemas"]["WorkspaceRole"]; joined_at: string; conversation_count: number; document_count: number; files_mb: number; agent_ext_id?: string | null | undefined; is_temporary: boolean; }[]; project_ext_id?: string | null | undefined; project_name?: string | null | undefined; project_subscription?: string | null | undefined; project_owner_ext_id?: string | null | undefined; }>; delete: (workspaceIds: string[]) => Promise; update: (body: WorkspaceUpdateRequest$1) => Promise<{ external_id: string; name: string; description: string | null; is_public: boolean; workspace_type: components["schemas"]["WorkspaceType"]; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; wrapped_key?: string | null | undefined; is_member: boolean; shared_conversation_count: number; private_conversation_count: number; shared_document_count: number; private_document_count: number; user_files_mb: number; users: { user: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; role: components["schemas"]["WorkspaceRole"]; joined_at: string; conversation_count: number; document_count: number; files_mb: number; agent_ext_id?: string | null | undefined; is_temporary: boolean; }[]; project_ext_id?: string | null | undefined; project_name?: string | null | undefined; project_subscription?: string | null | undefined; project_owner_ext_id?: string | null | undefined; }>; listUsers: () => Promise<{ user: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; role: components["schemas"]["WorkspaceRole"]; joined_at: string; conversation_count: number; document_count: number; files_mb: number; agent_ext_id?: string | null | undefined; is_temporary: boolean; }[]>; addUsers: (emails: string[], role?: "owner" | "collaborator" | "guest") => Promise<{ user: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; role: components["schemas"]["WorkspaceRole"]; joined_at: string; conversation_count: number; document_count: number; files_mb: number; agent_ext_id?: string | null | undefined; is_temporary: boolean; }[]>; removeUsers: (userIds: string[]) => Promise; setUserRole: (userIds: string[], role: "owner" | "collaborator" | "guest") => Promise<{ user: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; role: components["schemas"]["WorkspaceRole"]; joined_at: string; conversation_count: number; document_count: number; files_mb: number; agent_ext_id?: string | null | undefined; is_temporary: boolean; }[]>; /** * Ask another user to grant you workspace access. Builds the E2E-encrypted * request `content` (carrying this session's public key for a temporary * grant) and posts it. `workspaceExtId` is optional — pass it only when you * already know the target workspace id (obtained out-of-band). */ requestAccess: (params: { recipientExtId: string; recipientEncryptionPublicKey: string; note?: string; workspaceExtId?: string; }) => Promise<{ type: components["schemas"]["NotificationType"]; external_id: string; sender: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; recipient: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; workspace_ext_id?: string | null | undefined; content?: string | null | undefined; conversation_ext_id?: string | null | undefined; task_ext_id?: string | null | undefined; read: boolean; created_at: string; updated_at: string; }>; copyDocuments: (targetWorkspaceId: string, docIds: string[], targetWorkspaceKey: string) => Promise<{ detail: string; documents_copied: number; items_copied: number; copied_by_kind: { [x: string]: number; }; results: { source_doc_ext_id: string; success: boolean; new_doc_ext_id?: string | null | undefined; error?: string | null | undefined; kind: components["schemas"]["CopyItemKind"]; warning?: string | null | undefined; }[]; }>; }; readonly documents: { list: () => Promise<{ external_id: string; workspace_ext_id: string; file_name?: string | null | undefined; status?: string | null | undefined; error_message?: string | null | undefined; failed_stage?: string | null | undefined; n_pages?: number | null | undefined; n_chunks?: number | null | undefined; tokens?: number | null | undefined; file_type?: string | null | undefined; file_size?: number | null | undefined; storage_type?: string | null | undefined; storage_uri?: string | null | undefined; content_hash?: string | null | undefined; shared?: boolean | null | undefined; re_ocred?: boolean | null | undefined; config_ext_id?: string | null | undefined; parent_ext_id?: string | null | undefined; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; wp_type?: string | null | undefined; folder?: string | null | undefined; sender?: string | null | undefined; doctags: { note?: string | null | undefined; citations?: { passages: { chunk_id: string; doc_ext_id?: string | null | undefined; page?: number | null | undefined; }[]; } | null | undefined; external_id: string; doc_ext_id: string; tag_ext_id: string; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; }[]; doc_metadata?: { doc_nature?: string | null | undefined; doc_author?: string | null | undefined; doc_subject?: string | null | undefined; doc_date?: string | null | undefined; title?: string | null | undefined; } | null | undefined; }[]>; /** * Async iterator that yields pages of documents sequentially. * Use this for large workspaces to stream output as pages arrive. * * @example * ```ts * for await (const page of arbi.documents.listPaginated({ pageSize: 5000, order: 'created_desc', fields: 'lite' })) { * // page: DocResponse[] — render incrementally * } * ``` */ listPaginated: (options?: ListPaginatedOptions) => AsyncGenerator<{ external_id: string; workspace_ext_id: string; file_name?: string | null; status?: string | null; error_message?: string | null; failed_stage?: string | null; n_pages?: number | null; n_chunks?: number | null; tokens?: number | null; file_type?: string | null; file_size?: number | null; storage_type?: string | null; storage_uri?: string | null; content_hash?: string | null; shared?: boolean | null; re_ocred?: boolean | null; config_ext_id?: string | null; parent_ext_id?: string | null; created_by_ext_id: string; updated_by_ext_id?: string | null; created_at: string; updated_at: string; wp_type?: string | null; folder?: string | null; sender?: string | null; doctags: components["schemas"]["DocTagResponse"][]; doc_metadata?: components["schemas"]["DocMetadata"] | null; }[], any, any>; /** * Collect all workspace documents into a single array using sequential pagination. * * **Note:** When `fields: 'lite'` is passed, returned docs have `doctags: []` * and `doc_metadata: null`. Fetch full per-doc data on demand when a specific * doc is opened. */ listAll: (options?: ListAllOptions) => Promise<{ external_id: string; workspace_ext_id: string; file_name?: string | null; status?: string | null; error_message?: string | null; failed_stage?: string | null; n_pages?: number | null; n_chunks?: number | null; tokens?: number | null; file_type?: string | null; file_size?: number | null; storage_type?: string | null; storage_uri?: string | null; content_hash?: string | null; shared?: boolean | null; re_ocred?: boolean | null; config_ext_id?: string | null; parent_ext_id?: string | null; created_by_ext_id: string; updated_by_ext_id?: string | null; created_at: string; updated_at: string; wp_type?: string | null; folder?: string | null; sender?: string | null; doctags: components["schemas"]["DocTagResponse"][]; doc_metadata?: components["schemas"]["DocMetadata"] | null; }[]>; get: (externalIds: string[]) => Promise<{ external_id: string; workspace_ext_id: string; file_name?: string | null | undefined; status?: string | null | undefined; error_message?: string | null | undefined; failed_stage?: string | null | undefined; n_pages?: number | null | undefined; n_chunks?: number | null | undefined; tokens?: number | null | undefined; file_type?: string | null | undefined; file_size?: number | null | undefined; storage_type?: string | null | undefined; storage_uri?: string | null | undefined; content_hash?: string | null | undefined; shared?: boolean | null | undefined; re_ocred?: boolean | null | undefined; config_ext_id?: string | null | undefined; parent_ext_id?: string | null | undefined; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; wp_type?: string | null | undefined; folder?: string | null | undefined; sender?: string | null | undefined; doctags: { note?: string | null | undefined; citations?: { passages: { chunk_id: string; doc_ext_id?: string | null | undefined; page?: number | null | undefined; }[]; } | null | undefined; external_id: string; doc_ext_id: string; tag_ext_id: string; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; }[]; doc_metadata?: { doc_nature?: string | null | undefined; doc_author?: string | null | undefined; doc_subject?: string | null | undefined; doc_date?: string | null | undefined; title?: string | null | undefined; } | null | undefined; }[]>; delete: (externalIds: string[]) => Promise; update: (documents: DocUpdateRequest[]) => Promise<{ external_id: string; workspace_ext_id: string; file_name?: string | null | undefined; status?: string | null | undefined; error_message?: string | null | undefined; failed_stage?: string | null | undefined; n_pages?: number | null | undefined; n_chunks?: number | null | undefined; tokens?: number | null | undefined; file_type?: string | null | undefined; file_size?: number | null | undefined; storage_type?: string | null | undefined; storage_uri?: string | null | undefined; content_hash?: string | null | undefined; shared?: boolean | null | undefined; re_ocred?: boolean | null | undefined; config_ext_id?: string | null | undefined; parent_ext_id?: string | null | undefined; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; wp_type?: string | null | undefined; folder?: string | null | undefined; sender?: string | null | undefined; doctags: { note?: string | null | undefined; citations?: { passages: { chunk_id: string; doc_ext_id?: string | null | undefined; page?: number | null | undefined; }[]; } | null | undefined; external_id: string; doc_ext_id: string; tag_ext_id: string; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; }[]; doc_metadata?: { doc_nature?: string | null | undefined; doc_author?: string | null | undefined; doc_subject?: string | null | undefined; doc_date?: string | null | undefined; title?: string | null | undefined; } | null | undefined; }[]>; uploadUrl: (urls: string[], shared?: boolean) => Promise<{ doc_ext_ids?: string[] | undefined; batch_id?: string | null | undefined; skipped?: { file_name: string; reason: string; }[] | undefined; }>; uploadFile: (fileData: Blob, fileName: string, options?: { folder?: string; }) => Promise; download: (docId: string) => Promise; getParsedContent: (docId: string, stage: string) => Promise>; getThumbnails: (docIds: string[]) => Promise>; }; readonly conversations: { list: () => Promise<{ external_id: string; title: string | null; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; is_shared: boolean; message_count: number; last_message_status?: string | null | undefined; }[]>; getThreads: (conversationId: string) => Promise<{ conversation_ext_id: string; threads: { leaf_message_ext_id: string; history: { role: "user" | "assistant" | "system"; content: string; tools?: { [x: string]: { name: "model_citation"; description: string; tool_responses: { [x: string]: { chunk_ids: string[]; scores: number[]; statement: string; offset_start: number; offset_end: number; }; }; } | { name: "retrieval_chunk"; description: string; tool_args: { doc_ext_ids: string[]; search_mode?: ("semantic" | "keyword" | "hybrid") | null | undefined; }; tool_responses: { [x: string]: { metadata: { workspace_ext_id?: string | null | undefined; doc_ext_id?: string | null | undefined; doc_title?: string | null | undefined; chunk_id?: string | null | undefined; chunk_ext_id: string; chunk_pg_idx: number; chunk_doc_idx: number; page_number: number; score?: number | null | undefined; rerank_score?: number | null | undefined; tokens?: number | null | undefined; created_at: string; heading: boolean; bbox?: number[] | null | undefined; element_type?: string | null | undefined; heading_level?: number | null | undefined; }; content: string; }[]; }; } | { name: "retrieval_full_context"; description: string; tool_args: { doc_ext_ids: string[]; from_ref?: string | null | undefined; to_ref?: string | null | undefined; }; tool_responses: { [x: string]: { metadata: { workspace_ext_id?: string | null | undefined; doc_ext_id?: string | null | undefined; doc_title?: string | null | undefined; chunk_id?: string | null | undefined; chunk_ext_id: string; chunk_pg_idx: number; chunk_doc_idx: number; page_number: number; score?: number | null | undefined; rerank_score?: number | null | undefined; tokens?: number | null | undefined; created_at: string; heading: boolean; bbox?: number[] | null | undefined; element_type?: string | null | undefined; heading_level?: number | null | undefined; }; content: string; }[]; }; } | { name: "retrieval_toc"; description: string; tool_args: { doc_ext_ids: string[]; }; tool_responses: { [x: string]: { [x: string]: unknown; }[]; }; } | { name: "trace"; description: string; trace_id?: string | null | undefined; start_time?: number | null | undefined; duration_seconds?: number | null | undefined; steps: { [x: string]: unknown; }[]; } | { name: "compaction"; description: string; tool_args: { source_conversation_ext_id?: string | null | undefined; source_leaf_message_ext_id?: string | null | undefined; messages_summarized?: number | null | undefined; tokens_above?: number | null | undefined; tokens_summary?: number | null | undefined; model_used?: string | null | undefined; }; tool_responses: { [x: string]: string; }; } | { name: "personal_agent"; description: string; tool_args: { task: string; }; tool_responses: { [x: string]: unknown; }; } | { name: "stream_events"; events: { [x: string]: unknown; }[]; } | { name: "memory"; description: string; tool_responses: { written: string[]; superseded: string[]; }; } | { name: "goal"; description: string; record: { [x: string]: unknown; }; } | { name: "image_generation"; description: string; tool_args: { aspect_ratio?: string | null | undefined; }; tool_responses: { [x: string]: unknown; }; }; } | undefined; config_ext_id?: string | null | undefined; shared: boolean; tokens: number; status: string; external_id: string; created_at: string; created_by_ext_id: string; conversation_ext_id: string; parent_message_ext_id?: string | null | undefined; }[]; }[]; }>; delete: (conversationId: string) => Promise<{ detail: string; }>; share: (conversationId: string) => Promise<{ detail: string; }>; updateTitle: (conversationId: string, title: string) => Promise<{ detail: string; title: string; }>; getMessage: (messageId: string) => Promise<{ role: "user" | "assistant" | "system"; content: string; tools?: { [x: string]: { name: "model_citation"; description: string; tool_responses: { [x: string]: { chunk_ids: string[]; scores: number[]; statement: string; offset_start: number; offset_end: number; }; }; } | { name: "retrieval_chunk"; description: string; tool_args: { doc_ext_ids: string[]; search_mode?: ("semantic" | "keyword" | "hybrid") | null | undefined; }; tool_responses: { [x: string]: { metadata: { workspace_ext_id?: string | null | undefined; doc_ext_id?: string | null | undefined; doc_title?: string | null | undefined; chunk_id?: string | null | undefined; chunk_ext_id: string; chunk_pg_idx: number; chunk_doc_idx: number; page_number: number; score?: number | null | undefined; rerank_score?: number | null | undefined; tokens?: number | null | undefined; created_at: string; heading: boolean; bbox?: number[] | null | undefined; element_type?: string | null | undefined; heading_level?: number | null | undefined; }; content: string; }[]; }; } | { name: "retrieval_full_context"; description: string; tool_args: { doc_ext_ids: string[]; from_ref?: string | null | undefined; to_ref?: string | null | undefined; }; tool_responses: { [x: string]: { metadata: { workspace_ext_id?: string | null | undefined; doc_ext_id?: string | null | undefined; doc_title?: string | null | undefined; chunk_id?: string | null | undefined; chunk_ext_id: string; chunk_pg_idx: number; chunk_doc_idx: number; page_number: number; score?: number | null | undefined; rerank_score?: number | null | undefined; tokens?: number | null | undefined; created_at: string; heading: boolean; bbox?: number[] | null | undefined; element_type?: string | null | undefined; heading_level?: number | null | undefined; }; content: string; }[]; }; } | { name: "retrieval_toc"; description: string; tool_args: { doc_ext_ids: string[]; }; tool_responses: { [x: string]: { [x: string]: unknown; }[]; }; } | { name: "trace"; description: string; trace_id?: string | null | undefined; start_time?: number | null | undefined; duration_seconds?: number | null | undefined; steps: { [x: string]: unknown; }[]; } | { name: "compaction"; description: string; tool_args: { source_conversation_ext_id?: string | null | undefined; source_leaf_message_ext_id?: string | null | undefined; messages_summarized?: number | null | undefined; tokens_above?: number | null | undefined; tokens_summary?: number | null | undefined; model_used?: string | null | undefined; }; tool_responses: { [x: string]: string; }; } | { name: "personal_agent"; description: string; tool_args: { task: string; }; tool_responses: { [x: string]: unknown; }; } | { name: "stream_events"; events: { [x: string]: unknown; }[]; } | { name: "memory"; description: string; tool_responses: { written: string[]; superseded: string[]; }; } | { name: "goal"; description: string; record: { [x: string]: unknown; }; } | { name: "image_generation"; description: string; tool_args: { aspect_ratio?: string | null | undefined; }; tool_responses: { [x: string]: unknown; }; }; } | undefined; config_ext_id?: string | null | undefined; shared: boolean; tokens: number; status: string; external_id: string; created_at: string; created_by_ext_id: string; conversation_ext_id: string; parent_message_ext_id?: string | null | undefined; }>; deleteMessage: (messageId: string) => Promise<{ detail: string; }>; }; readonly assistant: { /** * Send a question to the RAG assistant with streaming support. * Returns the accumulated result after the stream completes. */ query: (question: string, options: QueryOptions) => Promise; /** * Respond to an agent's question during a human-in-the-loop workflow. */ respond: (assistantMessageExtId: string, answer: string) => Promise; /** * Search documents without LLM generation (retrieval only). */ retrieve: (query: string, docIds: string[], options?: { searchMode?: "semantic" | "keyword" | "hybrid"; fullContextDocIds?: string[]; tocDocIds?: string[]; model?: string; }) => Promise; }; readonly tags: { list: () => Promise<{ external_id: string; workspace_ext_id: string; name: string; instruction?: string | null | undefined; tag_type: { type: "checkbox" | "text" | "number" | "select" | "search" | "date"; options: string[]; }; shared: boolean; parent_ext_id?: string | null | undefined; doctag_count: number; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; }[]>; create: (options: { name: string; workspaceId?: string; tagType?: TagFormat; instruction?: string | null; shared?: boolean; }) => Promise<{ external_id: string; workspace_ext_id: string; name: string; instruction?: string | null | undefined; tag_type: { type: "checkbox" | "text" | "number" | "select" | "search" | "date"; options: string[]; }; shared: boolean; parent_ext_id?: string | null | undefined; doctag_count: number; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; }>; delete: (tagId: string) => Promise<{ detail: string; }>; update: (tagId: string, body: UpdateTagRequest$1) => Promise<{ external_id: string; workspace_ext_id: string; name: string; instruction?: string | null | undefined; tag_type: { type: "checkbox" | "text" | "number" | "select" | "search" | "date"; options: string[]; }; shared: boolean; parent_ext_id?: string | null | undefined; doctag_count: number; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; }>; }; readonly doctags: { assign: (tagId: string, docIds: string[], note?: string | null) => Promise<{ note?: string | null | undefined; citations?: { passages: { chunk_id: string; doc_ext_id?: string | null | undefined; page?: number | null | undefined; }[]; } | null | undefined; external_id: string; doc_ext_id: string; tag_ext_id: string; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; }[]>; remove: (tagId: string, docIds: string[]) => Promise; update: (tagId: string, docId: string, updates: { note?: string | null; citations?: CitationSources$1 | null; }) => Promise<{ note?: string | null | undefined; citations?: { passages: { chunk_id: string; doc_ext_id?: string | null | undefined; page?: number | null | undefined; }[]; } | null | undefined; external_id: string; doc_ext_id: string; tag_ext_id: string; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; }>; generate: (tagIds: string[], docIds: string[]) => Promise<{ doc_ext_ids: string[]; tag_ext_ids: string[]; }>; }; readonly contacts: { list: () => Promise<{ external_id?: string | null | undefined; email: string; user?: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; } | null | undefined; status: "invitation_pending" | "invitation_expired" | "registered" | "failed"; created_at: string; shared_workspace_ext_id?: string | null | undefined; outcome?: ("invited" | "reinvited" | "not_resent_still_pending" | "contact_added" | "already_contact" | "failed") | null | undefined; outcome_detail?: string | null | undefined; }[]>; add: (emails: string[]) => Promise<{ external_id?: string | null | undefined; email: string; user?: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; } | null | undefined; status: "invitation_pending" | "invitation_expired" | "registered" | "failed"; created_at: string; shared_workspace_ext_id?: string | null | undefined; outcome?: ("invited" | "reinvited" | "not_resent_still_pending" | "contact_added" | "already_contact" | "failed") | null | undefined; outcome_detail?: string | null | undefined; }[]>; remove: (contactIds: string[]) => Promise; groupByStatus: typeof groupContactsByStatus; }; /** * Build (and cache) the DM crypto context for the current session. * * Derives the user's curve25519 keypair from their signing key and pairs it * with their external_id — everything `list()`/`send()` need to encrypt and * decrypt. Cached for the session and cleared on logout. Consumers never touch * this: it's an internal of the `dm` surface. * * The key comes from the live login result first, exactly as `selectWorkspace` * sources it, and only then from persisted storage (which is what restores a * session on reload). Reading storage first would make DMs the one feature that * breaks whenever persistence is unavailable — `saveSession` deliberately * no-ops without Web Crypto (a non-secure origin, tracking prevention, an * embedded widget), so a perfectly authenticated user with a working workspace * would be told they are "not authenticated" the moment they opened Messages. */ private requireDmCrypto; readonly dm: { /** * List direct messages, newest first, with content already **decrypted**. * (A message that can't be decrypted comes back as `[Decryption failed]`.) */ list: () => Promise<{ type: components["schemas"]["NotificationType"]; external_id: string; sender: components["schemas"]["UserResponse"]; recipient: components["schemas"]["UserResponse"]; workspace_ext_id?: string | null; content?: string | null; conversation_ext_id?: string | null; task_ext_id?: string | null; read: boolean; created_at: string; updated_at: string; }[]>; /** * Send an E2E-encrypted DM to a recipient (email or `usr-`/`agt-` id). * Resolves the recipient's public key and encrypts internally — the caller * passes plaintext and never handles keys or ciphertext. */ send: (recipient: string, text: string) => Promise<{ type: components["schemas"]["NotificationType"]; external_id: string; sender: components["schemas"]["UserResponse"]; recipient: components["schemas"]["UserResponse"]; workspace_ext_id?: string | null; content?: string | null; conversation_ext_id?: string | null; task_ext_id?: string | null; read: boolean; created_at: string; updated_at: string; }[]>; /** * Send to a recipient whose external_id + public key are already known * (e.g. from a message's `sender`), skipping directory resolution. */ sendTo: (recipientExtId: string, recipientPublicKey: string, text: string) => Promise<{ type: components["schemas"]["NotificationType"]; external_id: string; sender: components["schemas"]["UserResponse"]; recipient: components["schemas"]["UserResponse"]; workspace_ext_id?: string | null; content?: string | null; conversation_ext_id?: string | null; task_ext_id?: string | null; read: boolean; created_at: string; updated_at: string; }[]>; /** Resolve a recipient reference to `{ extId, pubKey }` (contacts → agents → workspace). */ resolveRecipient: (recipient: string) => Promise; markRead: (messageIds: string[]) => Promise<{ type: components["schemas"]["NotificationType"]; external_id: string; sender: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; recipient: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; workspace_ext_id?: string | null | undefined; content?: string | null | undefined; conversation_ext_id?: string | null | undefined; task_ext_id?: string | null | undefined; read: boolean; created_at: string; updated_at: string; }[]>; delete: (messageIds: string[]) => Promise; /** List the current user's durable activity feed (never unread; excluded from DMs). */ listActivity: (options?: { limit?: number; offset?: number; }) => Promise<{ type: components["schemas"]["NotificationType"]; external_id: string; sender: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; recipient: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; workspace_ext_id?: string | null | undefined; content?: string | null | undefined; conversation_ext_id?: string | null | undefined; task_ext_id?: string | null | undefined; read: boolean; created_at: string; updated_at: string; }[]>; }; readonly settings: { get: () => Promise<{ [x: string]: unknown; subscription?: { status: string; } | null | undefined; last_workspace?: string | null | undefined; last_config?: string | null | undefined; pinned_workspaces: string[]; pinned_templates: string[]; pinned_skills: string[]; tableviews: { workspace: string; name: string; columns: string[]; column_widths?: { [x: string]: number; } | null | undefined; tile_size?: number | null | undefined; row_height?: number | null | undefined; }[]; developer: boolean; show_document_navigator: boolean; show_thread_visualization: boolean; show_security_settings: boolean; show_invite_tab: boolean; show_help_page: boolean; show_templates: boolean; show_skills: boolean; show_pa_mode: boolean; show_conversation_search: boolean; show_agent_sessions: boolean; show_mcp_connectors: boolean; show_connector_microsoft: boolean; show_connector_sharepoint: boolean; show_connector_google: boolean; show_connector_imanage: boolean; show_appearance: boolean; show_file_explorer: boolean; show_hints: boolean; show_tasks: boolean; show_agent_builder: boolean; dismissed_tips?: string[] | undefined; use_s3_direct_upload: boolean; hide_online_status: boolean; muted_users: string[]; email_notifications?: { messages: boolean; workspace_added: boolean; workspace_access_request: boolean; contact_accepted: boolean; referral_reward: boolean; product_updates: boolean; } | undefined; premium_model?: string | null | undefined; picture?: string | null | undefined; extra_discount?: { [x: string]: unknown; } | null | undefined; }>; update: (body: UserSettingsUpdate$1) => Promise; }; readonly agentConfig: { list: () => Promise<{ versions: { external_id: string; title: string | null; created_at: string; }[]; }>; get: (configId: string) => Promise<{ Agents: { ENABLED: boolean; HUMAN_IN_THE_LOOP: boolean; WEB_SEARCH_ENABLED: boolean; RUN_CODE_ENABLED: boolean; MCP_TOOLS: string[]; PLANNING_ENABLED: boolean; DEEP_RESEARCH_ENABLED: boolean; SUBAGENTS_ENABLED: boolean; SUGGESTED_QUERIES: boolean; ARTIFACTS_ENABLED: boolean; IMAGE_ENABLED: boolean; VISION_ENABLED: boolean; CONVERSATION_SEARCH_ENABLED: boolean; PERSONAL_AGENT: boolean; FACTS_ENABLED: boolean; PERSIST_LEARNINGS: boolean; SKILLS_ENABLED: boolean; SKILL_CREATION: boolean; WORKSPACE_TOOLS_ENABLED: boolean; REMOTE_CONTROL_ENABLED: boolean; ENABLED_SKILLS?: string[] | null | undefined; MEMORY_CREATION: boolean; GOALS_ENABLED: boolean; GOAL_MAX_OUTER_LOOPS: number; PERSONA: string; AGENT_MODEL_NAME: string; AGENT_API_TYPE: "local" | "remote"; LLM_AGENT_TEMPERATURE: number; AGENT_MAX_TOKENS: number; ENABLE_THINKING: boolean; AGENT_STRICT_TOOL_CALLS: boolean; AGENT_MAX_ITERATIONS: number; AGENT_TURN_CREDIT_BUDGET: number; AGENT_MAX_PARALLEL_TOOL_CALLS: number; AGENT_MAX_TOTAL_TOOL_CALLS: number; AGENT_MAX_RUN_TOKENS: number; AGENT_MAX_SUBAGENT_SPAWNS: number; AGENT_HISTORY_CHAR_THRESHOLD: number; AGENT_SYSTEM_PROMPT: string; }; QueryLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; MAX_TOKEN_SIZE_TO_ANSWER: number; TEMPERATURE: number; MAX_TOKENS: number; }; ReviewLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; TEMPERATURE: number; MAX_TOKENS: number; MAX_TOKEN_SIZE_TO_ANSWER: number; }; EvaluatorLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; TEMPERATURE: number; MAX_TOKENS: number; MAX_TOKEN_SIZE_TO_ANSWER: number; MAX_CHUNKS_PER_EVAL_CALL: number; MAX_CONCURRENT_EVAL_BATCHES: number; EVAL_BATCH_TIMEOUT_S: number; }; TitleLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; MAX_TOKEN_SIZE_TO_ANSWER: number; TEMPERATURE: number; MAX_TOKENS: number; }; SummariseLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; TEMPERATURE: number; MAX_TOKENS: number; MAX_TOKEN_SIZE_TO_ANSWER: number; COMPACTION_THRESHOLD_TOKENS: number; COMPACTION_KEEP_RECENT: number; }; DoctagLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; MAX_TOKEN_CONTEXT_TO_ANSWER: number; TEMPERATURE: number; MAX_TOKENS: number; MAX_CONCURRENT_DOCS: number; AUTO_RENAME: boolean; AUTO_RENAME_INSTRUCTION: string; DEFAULT_METADATA_TAGS?: { name: string; instruction?: string | null | undefined; tag_type?: { type: "checkbox" | "text" | "number" | "select" | "search" | "date"; options: string[]; } | undefined; }[] | undefined; }; MemoryLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; TEMPERATURE: number; MAX_TOKENS: number; MAX_TOKEN_CONTEXT: number; MAX_CONCURRENT: number; }; PlanningLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; TEMPERATURE: number; MAX_TOKENS: number; MAX_TOKEN_SIZE_TO_ANSWER: number; APPROVAL_TIMEOUT: number; }; FilterPlanLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; TEMPERATURE: number; MAX_TOKENS: number; }; VisionLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; TEMPERATURE: number; MAX_TOKENS: number; MAX_PAGES_PER_CALL: number; IMAGE_MAX_DIMENSION: number; }; ImageGen: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; TEMPERATURE: number; }; CodeAgent: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; TEMPERATURE: number; MAX_TOKENS: number; }; ModelCitation: { SIM_THREASHOLD: number; MIN_CHAR_SIZE_TO_ANSWER: number; MAX_NUMB_CITATIONS: number; CITATION_INSTRUCTION: string; }; WebSearch: { SAVE_SOURCES: boolean; }; RunCode: { IMAGE: string; TIMEOUT_SECONDS: number; MEMORY_LIMIT: string; NETWORK: string; }; Retriever: { agent?: { MIN_RETRIEVAL_SIM_SCORE: number; KEYWORD_MIN_TERM_OVERLAP_RATIO: number; MAX_DISTINCT_DOCUMENTS: number; MAX_TOTAL_CHUNKS_TO_RETRIEVE: number; GROUP_SIZE: number; SEARCH_MODE: components["schemas"]["SearchMode"]; HYBRID_PREFETCH_LIMIT: number; HYBRID_DENSE_WEIGHT: number; HYBRID_SPARSE_WEIGHT: number; } | undefined; smart_search?: { MIN_RETRIEVAL_SIM_SCORE: number; KEYWORD_MIN_TERM_OVERLAP_RATIO: number; MAX_DISTINCT_DOCUMENTS: number; MAX_TOTAL_CHUNKS_TO_RETRIEVE: number; GROUP_SIZE: number; SEARCH_MODE: components["schemas"]["SearchMode"]; HYBRID_PREFETCH_LIMIT: number; HYBRID_DENSE_WEIGHT: number; HYBRID_SPARSE_WEIGHT: number; } | undefined; }; Reranker: { agent?: { MIN_SCORE: number; MAX_NUMB_OF_CHUNKS: number; } | undefined; smart_search?: { MIN_SCORE: number; MAX_NUMB_OF_CHUNKS: number; } | undefined; MAX_CONCURRENT_REQUESTS: number; MODEL_NAME: string; API_TYPE: "local" | "remote"; RETRIEVAL_INSTRUCTION: string; }; Parser: { SKIP_DUPLICATES: boolean; }; Chunker: { MAX_CHUNK_TOKENS: number; TOKENIZER_NAME: string; }; Embedder: { MODEL_NAME: string; API_TYPE: "local" | "remote"; BATCH_SIZE: number; MAX_CONCURRENT_REQUESTS: number; DOCUMENT_PREFIX: string; QUERY_PREFIX: string; }; KeywordEmbedder: { DIMENSION_SPACE: number; FILTER_STOPWORDS: boolean; BM25_K1: number; BM25_B: number; BM25_AVGDL: number; CJK_NGRAM_SIZE: number; NORMALIZE_TRADITIONAL_TO_SIMPLIFIED: boolean; }; } | { Agents: { ENABLED: boolean; HUMAN_IN_THE_LOOP: boolean; WEB_SEARCH_ENABLED: boolean; RUN_CODE_ENABLED: boolean; MCP_TOOLS: string[]; PLANNING_ENABLED: boolean; DEEP_RESEARCH_ENABLED: boolean; SUBAGENTS_ENABLED: boolean; SUGGESTED_QUERIES: boolean; ARTIFACTS_ENABLED: boolean; IMAGE_ENABLED: boolean; VISION_ENABLED: boolean; CONVERSATION_SEARCH_ENABLED: boolean; FACTS_ENABLED: boolean; PERSIST_LEARNINGS: boolean; SKILLS_ENABLED: boolean; WORKSPACE_TOOLS_ENABLED: boolean; REMOTE_CONTROL_ENABLED: boolean; ENABLED_SKILLS?: string[] | null | undefined; GOALS_ENABLED: boolean; GOAL_MAX_OUTER_LOOPS: number; PERSONA: string; AGENT_MODEL_NAME: string; ENABLE_THINKING: boolean; AGENT_MAX_ITERATIONS: number; AGENT_TURN_CREDIT_BUDGET: number; }; DoctagLLM: { AUTO_RENAME: boolean; AUTO_RENAME_INSTRUCTION: string; DEFAULT_METADATA_TAGS?: { name: string; instruction?: string | null | undefined; tag_type?: { type: "checkbox" | "text" | "number" | "select" | "search" | "date"; options: string[]; } | undefined; }[] | undefined; }; Parser: { SKIP_DUPLICATES: boolean; }; }>; save: (body: ConfigUpdateData$1) => Promise<{ external_id: string; title: string | null; created_at: string; }>; delete: (configId: string) => Promise<{ detail: string; }>; getSchema: () => Promise; getModels: () => Promise<{ models: { model_name: string; api_type: string; tags?: string[] | null | undefined; max_input_tokens?: number | null | undefined; max_output_tokens?: number | null | undefined; input_cost_per_token?: number | null | undefined; output_cost_per_token?: number | null | undefined; provider?: string | null | undefined; mode?: string | null | undefined; supports_vision?: boolean | null | undefined; supports_reasoning?: boolean | null | undefined; supports_function_calling?: boolean | null | undefined; supports_response_schema?: boolean | null | undefined; }[]; premium_default?: string | null | undefined; }>; }; readonly health: { check: () => Promise<{ status: string; backend_git_hash?: string | null | undefined; frontend_docker_version?: string | null | undefined; services: { name: string; status: string; detail?: string | null | undefined; service_info?: { [x: string]: unknown; } | null | undefined; }[]; models_health?: { application: string; models: { model: string; status: string; detail?: string | null | undefined; }[]; } | null | undefined; available_models: string[]; }>; models: () => Promise<{ models: { model_name: string; api_type: string; tags?: string[] | null | undefined; max_input_tokens?: number | null | undefined; max_output_tokens?: number | null | undefined; input_cost_per_token?: number | null | undefined; output_cost_per_token?: number | null | undefined; provider?: string | null | undefined; mode?: string | null | undefined; supports_vision?: boolean | null | undefined; supports_reasoning?: boolean | null | undefined; supports_function_calling?: boolean | null | undefined; supports_response_schema?: boolean | null | undefined; }[]; premium_default?: string | null | undefined; }>; remoteModels: () => Promise<{ application: string; models: { model: string; status: string; detail?: string | null | undefined; }[]; }>; mcpTools: () => Promise<{ tools: { name: string; description: string; server_name: string; }[]; }>; }; readonly files: { list: (options?: ListFilesOptions) => Promise<{ object: string; data: { id: string; object: string; bytes: number; created_at: number; filename: string; purpose: string; status: string; expires_at?: number | null | undefined; status_details?: string | null | undefined; }[]; has_more: boolean; first_id?: string | null | undefined; last_id?: string | null | undefined; }>; get: (fileId: string) => Promise<{ id: string; object: string; bytes: number; created_at: number; filename: string; purpose: string; status: string; expires_at?: number | null | undefined; status_details?: string | null | undefined; }>; delete: (fileId: string) => Promise<{ id: string; object: string; deleted: boolean; }>; upload: (fileData: Blob, fileName: string, purpose?: string) => Promise<{ id: string; object: string; bytes: number; created_at: number; filename: string; purpose: string; status: string; expires_at?: number | null; status_details?: string | null; }>; getContent: (fileId: string) => Promise; }; readonly agents: { list: () => Promise<{ external_id: string; parent_ext_id?: string | null; email: string; given_name: string; family_name?: string | null; picture?: string | null; encryption_public_key: string; is_sso: boolean; }[]>; create: (name: string) => Promise<{ external_id: string; parent_ext_id?: string | null; email: string; given_name: string; family_name?: string | null; picture?: string | null; encryption_public_key: string; is_sso: boolean; signing_private_key: string; }>; getConfig: (agentExtId: string) => Promise<{ Agents: { ENABLED: boolean; HUMAN_IN_THE_LOOP: boolean; WEB_SEARCH_ENABLED: boolean; RUN_CODE_ENABLED: boolean; MCP_TOOLS: string[]; PLANNING_ENABLED: boolean; DEEP_RESEARCH_ENABLED: boolean; SUBAGENTS_ENABLED: boolean; SUGGESTED_QUERIES: boolean; ARTIFACTS_ENABLED: boolean; IMAGE_ENABLED: boolean; VISION_ENABLED: boolean; CONVERSATION_SEARCH_ENABLED: boolean; PERSONAL_AGENT: boolean; FACTS_ENABLED: boolean; PERSIST_LEARNINGS: boolean; SKILLS_ENABLED: boolean; SKILL_CREATION: boolean; WORKSPACE_TOOLS_ENABLED: boolean; REMOTE_CONTROL_ENABLED: boolean; ENABLED_SKILLS?: string[] | null | undefined; MEMORY_CREATION: boolean; GOALS_ENABLED: boolean; GOAL_MAX_OUTER_LOOPS: number; PERSONA: string; AGENT_MODEL_NAME: string; AGENT_API_TYPE: "local" | "remote"; LLM_AGENT_TEMPERATURE: number; AGENT_MAX_TOKENS: number; ENABLE_THINKING: boolean; AGENT_STRICT_TOOL_CALLS: boolean; AGENT_MAX_ITERATIONS: number; AGENT_TURN_CREDIT_BUDGET: number; AGENT_MAX_PARALLEL_TOOL_CALLS: number; AGENT_MAX_TOTAL_TOOL_CALLS: number; AGENT_MAX_RUN_TOKENS: number; AGENT_MAX_SUBAGENT_SPAWNS: number; AGENT_HISTORY_CHAR_THRESHOLD: number; AGENT_SYSTEM_PROMPT: string; }; QueryLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; MAX_TOKEN_SIZE_TO_ANSWER: number; TEMPERATURE: number; MAX_TOKENS: number; }; ReviewLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; TEMPERATURE: number; MAX_TOKENS: number; MAX_TOKEN_SIZE_TO_ANSWER: number; }; EvaluatorLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; TEMPERATURE: number; MAX_TOKENS: number; MAX_TOKEN_SIZE_TO_ANSWER: number; MAX_CHUNKS_PER_EVAL_CALL: number; MAX_CONCURRENT_EVAL_BATCHES: number; EVAL_BATCH_TIMEOUT_S: number; }; TitleLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; MAX_TOKEN_SIZE_TO_ANSWER: number; TEMPERATURE: number; MAX_TOKENS: number; }; SummariseLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; TEMPERATURE: number; MAX_TOKENS: number; MAX_TOKEN_SIZE_TO_ANSWER: number; COMPACTION_THRESHOLD_TOKENS: number; COMPACTION_KEEP_RECENT: number; }; DoctagLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; MAX_TOKEN_CONTEXT_TO_ANSWER: number; TEMPERATURE: number; MAX_TOKENS: number; MAX_CONCURRENT_DOCS: number; AUTO_RENAME: boolean; AUTO_RENAME_INSTRUCTION: string; DEFAULT_METADATA_TAGS?: { name: string; instruction?: string | null | undefined; tag_type?: { type: "checkbox" | "text" | "number" | "select" | "search" | "date"; options: string[]; } | undefined; }[] | undefined; }; MemoryLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; TEMPERATURE: number; MAX_TOKENS: number; MAX_TOKEN_CONTEXT: number; MAX_CONCURRENT: number; }; PlanningLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; TEMPERATURE: number; MAX_TOKENS: number; MAX_TOKEN_SIZE_TO_ANSWER: number; APPROVAL_TIMEOUT: number; }; FilterPlanLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; TEMPERATURE: number; MAX_TOKENS: number; }; VisionLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; TEMPERATURE: number; MAX_TOKENS: number; MAX_PAGES_PER_CALL: number; IMAGE_MAX_DIMENSION: number; }; ImageGen: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; TEMPERATURE: number; }; CodeAgent: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; TEMPERATURE: number; MAX_TOKENS: number; }; ModelCitation: { SIM_THREASHOLD: number; MIN_CHAR_SIZE_TO_ANSWER: number; MAX_NUMB_CITATIONS: number; CITATION_INSTRUCTION: string; }; WebSearch: { SAVE_SOURCES: boolean; }; RunCode: { IMAGE: string; TIMEOUT_SECONDS: number; MEMORY_LIMIT: string; NETWORK: string; }; Retriever: { agent?: { MIN_RETRIEVAL_SIM_SCORE: number; KEYWORD_MIN_TERM_OVERLAP_RATIO: number; MAX_DISTINCT_DOCUMENTS: number; MAX_TOTAL_CHUNKS_TO_RETRIEVE: number; GROUP_SIZE: number; SEARCH_MODE: components["schemas"]["SearchMode"]; HYBRID_PREFETCH_LIMIT: number; HYBRID_DENSE_WEIGHT: number; HYBRID_SPARSE_WEIGHT: number; } | undefined; smart_search?: { MIN_RETRIEVAL_SIM_SCORE: number; KEYWORD_MIN_TERM_OVERLAP_RATIO: number; MAX_DISTINCT_DOCUMENTS: number; MAX_TOTAL_CHUNKS_TO_RETRIEVE: number; GROUP_SIZE: number; SEARCH_MODE: components["schemas"]["SearchMode"]; HYBRID_PREFETCH_LIMIT: number; HYBRID_DENSE_WEIGHT: number; HYBRID_SPARSE_WEIGHT: number; } | undefined; }; Reranker: { agent?: { MIN_SCORE: number; MAX_NUMB_OF_CHUNKS: number; } | undefined; smart_search?: { MIN_SCORE: number; MAX_NUMB_OF_CHUNKS: number; } | undefined; MAX_CONCURRENT_REQUESTS: number; MODEL_NAME: string; API_TYPE: "local" | "remote"; RETRIEVAL_INSTRUCTION: string; }; Parser: { SKIP_DUPLICATES: boolean; }; Chunker: { MAX_CHUNK_TOKENS: number; TOKENIZER_NAME: string; }; Embedder: { MODEL_NAME: string; API_TYPE: "local" | "remote"; BATCH_SIZE: number; MAX_CONCURRENT_REQUESTS: number; DOCUMENT_PREFIX: string; QUERY_PREFIX: string; }; KeywordEmbedder: { DIMENSION_SPACE: number; FILTER_STOPWORDS: boolean; BM25_K1: number; BM25_B: number; BM25_AVGDL: number; CJK_NGRAM_SIZE: number; NORMALIZE_TRADITIONAL_TO_SIMPLIFIED: boolean; }; } | { Agents: { ENABLED: boolean; HUMAN_IN_THE_LOOP: boolean; WEB_SEARCH_ENABLED: boolean; RUN_CODE_ENABLED: boolean; MCP_TOOLS: string[]; PLANNING_ENABLED: boolean; DEEP_RESEARCH_ENABLED: boolean; SUBAGENTS_ENABLED: boolean; SUGGESTED_QUERIES: boolean; ARTIFACTS_ENABLED: boolean; IMAGE_ENABLED: boolean; VISION_ENABLED: boolean; CONVERSATION_SEARCH_ENABLED: boolean; FACTS_ENABLED: boolean; PERSIST_LEARNINGS: boolean; SKILLS_ENABLED: boolean; WORKSPACE_TOOLS_ENABLED: boolean; REMOTE_CONTROL_ENABLED: boolean; ENABLED_SKILLS?: string[] | null | undefined; GOALS_ENABLED: boolean; GOAL_MAX_OUTER_LOOPS: number; PERSONA: string; AGENT_MODEL_NAME: string; ENABLE_THINKING: boolean; AGENT_MAX_ITERATIONS: number; AGENT_TURN_CREDIT_BUDGET: number; }; DoctagLLM: { AUTO_RENAME: boolean; AUTO_RENAME_INSTRUCTION: string; DEFAULT_METADATA_TAGS?: { name: string; instruction?: string | null | undefined; tag_type?: { type: "checkbox" | "text" | "number" | "select" | "search" | "date"; options: string[]; } | undefined; }[] | undefined; }; Parser: { SKIP_DUPLICATES: boolean; }; }>; listWorkspaces: (agentExtId: string) => Promise<{ workspace_ext_id: string; name: string; role: components["schemas"]["WorkspaceRole"]; joined_at: string; }[]>; delete: (agentExtIds: string[]) => Promise<{ [x: string]: unknown; }>; }; readonly tasks: { list: () => Promise<{ external_id: string; name: string; trigger_type: string; rrule: string | null; run_at: string | null; timezone: string; event_kind: string | null; action_type: string; prompt: string; skill_ref: string | null; status: string; next_run_at: string | null; last_run_at: string | null; last_error: string | null; in_progress: boolean; active_run_id: string | null; agent_session: string | null; active_response_id?: string | null; active_conversation_ext_id?: string | null; run_started_at: string | null; notify_on_complete: boolean; auth_mode: components["schemas"]["AuthMode"]; pending_auth_request_id?: string | null; pending_auth_session_pubkey?: string | null; pending_auth_agent_email?: string | null; created_by_kind: string; workspace_ext_id?: string | null; agent_ext_id?: string | null; task_plan?: components["schemas"]["TaskPlan"] | null; is_goal_task: boolean; goal_state?: { [key: string]: unknown; } | null; created_at: string; updated_at: string; }[]>; create: (body: CreateTaskRequest) => Promise<{ external_id: string; name: string; trigger_type: string; rrule: string | null; run_at: string | null; timezone: string; event_kind: string | null; action_type: string; prompt: string; skill_ref: string | null; status: string; next_run_at: string | null; last_run_at: string | null; last_error: string | null; in_progress: boolean; active_run_id: string | null; agent_session: string | null; active_response_id?: string | null; active_conversation_ext_id?: string | null; run_started_at: string | null; notify_on_complete: boolean; auth_mode: components["schemas"]["AuthMode"]; pending_auth_request_id?: string | null; pending_auth_session_pubkey?: string | null; pending_auth_agent_email?: string | null; created_by_kind: string; workspace_ext_id?: string | null; agent_ext_id?: string | null; task_plan?: components["schemas"]["TaskPlan"] | null; is_goal_task: boolean; goal_state?: { [key: string]: unknown; } | null; created_at: string; updated_at: string; }>; get: (taskId: string) => Promise<{ external_id: string; name: string; trigger_type: string; rrule: string | null; run_at: string | null; timezone: string; event_kind: string | null; action_type: string; prompt: string; skill_ref: string | null; status: string; next_run_at: string | null; last_run_at: string | null; last_error: string | null; in_progress: boolean; active_run_id: string | null; agent_session: string | null; active_response_id?: string | null; active_conversation_ext_id?: string | null; run_started_at: string | null; notify_on_complete: boolean; auth_mode: components["schemas"]["AuthMode"]; pending_auth_request_id?: string | null; pending_auth_session_pubkey?: string | null; pending_auth_agent_email?: string | null; created_by_kind: string; workspace_ext_id?: string | null; agent_ext_id?: string | null; task_plan?: components["schemas"]["TaskPlan"] | null; is_goal_task: boolean; goal_state?: { [key: string]: unknown; } | null; created_at: string; updated_at: string; }>; update: (taskId: string, body: UpdateTaskRequest) => Promise<{ external_id: string; name: string; trigger_type: string; rrule: string | null; run_at: string | null; timezone: string; event_kind: string | null; action_type: string; prompt: string; skill_ref: string | null; status: string; next_run_at: string | null; last_run_at: string | null; last_error: string | null; in_progress: boolean; active_run_id: string | null; agent_session: string | null; active_response_id?: string | null; active_conversation_ext_id?: string | null; run_started_at: string | null; notify_on_complete: boolean; auth_mode: components["schemas"]["AuthMode"]; pending_auth_request_id?: string | null; pending_auth_session_pubkey?: string | null; pending_auth_agent_email?: string | null; created_by_kind: string; workspace_ext_id?: string | null; agent_ext_id?: string | null; task_plan?: components["schemas"]["TaskPlan"] | null; is_goal_task: boolean; goal_state?: { [key: string]: unknown; } | null; created_at: string; updated_at: string; }>; delete: (taskId: string) => Promise; run: (taskId: string) => Promise<{ external_id: string; name: string; trigger_type: string; rrule: string | null; run_at: string | null; timezone: string; event_kind: string | null; action_type: string; prompt: string; skill_ref: string | null; status: string; next_run_at: string | null; last_run_at: string | null; last_error: string | null; in_progress: boolean; active_run_id: string | null; agent_session: string | null; active_response_id?: string | null; active_conversation_ext_id?: string | null; run_started_at: string | null; notify_on_complete: boolean; auth_mode: components["schemas"]["AuthMode"]; pending_auth_request_id?: string | null; pending_auth_session_pubkey?: string | null; pending_auth_agent_email?: string | null; created_by_kind: string; workspace_ext_id?: string | null; agent_ext_id?: string | null; task_plan?: components["schemas"]["TaskPlan"] | null; is_goal_task: boolean; goal_state?: { [key: string]: unknown; } | null; created_at: string; updated_at: string; }>; }; readonly facts: { create: (body: CreateFactRequest) => Promise<{ text: string; citations?: components["schemas"]["CitationSources"] | null; external_id: string; workspace_ext_id: string; pinned: boolean; shared: boolean; confirmed: boolean; date_start?: string | null; date_end?: string | null; timezone?: string | null; reminder_task_ext_ids: string[]; tags: components["schemas"]["FactTagResponse"][]; created_by_ext_id: string; created_at: string; updated_at: string; }>; /** Pass `from`/`to`/`datedOnly` for the timeline view — dated notes only, * ordered by when they happened. */ list: (options?: { pinnedOnly?: boolean; from?: string; to?: string; datedOnly?: boolean; }) => Promise<{ text: string; citations?: components["schemas"]["CitationSources"] | null; external_id: string; workspace_ext_id: string; pinned: boolean; shared: boolean; confirmed: boolean; date_start?: string | null; date_end?: string | null; timezone?: string | null; reminder_task_ext_ids: string[]; tags: components["schemas"]["FactTagResponse"][]; created_by_ext_id: string; created_at: string; updated_at: string; }[]>; search: (body: FactSearchRequest) => Promise<{ facts: components["schemas"]["FactSearchHit"][]; }>; update: (factId: string, body: UpdateFactRequest) => Promise<{ text: string; citations?: components["schemas"]["CitationSources"] | null; external_id: string; workspace_ext_id: string; pinned: boolean; shared: boolean; confirmed: boolean; date_start?: string | null; date_end?: string | null; timezone?: string | null; reminder_task_ext_ids: string[]; tags: components["schemas"]["FactTagResponse"][]; created_by_ext_id: string; created_at: string; updated_at: string; }>; delete: (factId: string) => Promise; /** One-off reminder on a dated note: an explicit `remindAt`, or * `leadMinutes` before its date. */ remind: (factId: string, options?: { remindAt?: string; leadMinutes?: number; }) => Promise<{ text: string; citations?: components["schemas"]["CitationSources"] | null; external_id: string; workspace_ext_id: string; pinned: boolean; shared: boolean; confirmed: boolean; date_start?: string | null; date_end?: string | null; timezone?: string | null; reminder_task_ext_ids: string[]; tags: components["schemas"]["FactTagResponse"][]; created_by_ext_id: string; created_at: string; updated_at: string; }>; }; readonly sessions: { list: () => Promise<{ session_id: string; external_id?: string | null; name?: string | null; ip_address?: string | null; active_workspace?: string | null; workspaces: string[]; status: string; ttl: number; }[]>; }; private requireClient; private requireLogin; private requireWorkspace; } /** * Workspace operations — list, create, delete, update, users, copy. */ type WorkspaceUpdateRequest = components['schemas']['WorkspaceUpdateRequest']; declare function listWorkspaces(arbi: ArbiClient): Promise<{ external_id: string; name: string; description: string | null; is_public: boolean; workspace_type: components["schemas"]["WorkspaceType"]; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; wrapped_key?: string | null | undefined; is_member: boolean; shared_conversation_count: number; private_conversation_count: number; shared_document_count: number; private_document_count: number; user_files_mb: number; users: { user: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; role: components["schemas"]["WorkspaceRole"]; joined_at: string; conversation_count: number; document_count: number; files_mb: number; agent_ext_id?: string | null | undefined; is_temporary: boolean; }[]; project_ext_id?: string | null | undefined; project_name?: string | null | undefined; project_subscription?: string | null | undefined; project_owner_ext_id?: string | null | undefined; }[]>; /** * Create a workspace with a pre-encrypted workspace key. * * The caller must generate a random 32-byte key, encrypt it with the session * public key (SealedBox via `sealKeyForSession`), and pass it here. * Use `Arbi.workspaces.create()` for automatic key generation. */ declare function createWorkspace(arbi: ArbiClient, name: string, encryptedWorkspaceKey: string, projectExtId: string, description?: string | null, isPublic?: boolean): Promise<{ external_id: string; name: string; description: string | null; is_public: boolean; workspace_type: components["schemas"]["WorkspaceType"]; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; wrapped_key?: string | null | undefined; is_member: boolean; shared_conversation_count: number; private_conversation_count: number; shared_document_count: number; private_document_count: number; user_files_mb: number; users: { user: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; role: components["schemas"]["WorkspaceRole"]; joined_at: string; conversation_count: number; document_count: number; files_mb: number; agent_ext_id?: string | null | undefined; is_temporary: boolean; }[]; project_ext_id?: string | null | undefined; project_name?: string | null | undefined; project_subscription?: string | null | undefined; project_owner_ext_id?: string | null | undefined; }>; declare function deleteWorkspaces(arbi: ArbiClient, workspaceIds: string[]): Promise; declare function updateWorkspace(arbi: ArbiClient, body: WorkspaceUpdateRequest): Promise<{ external_id: string; name: string; description: string | null; is_public: boolean; workspace_type: components["schemas"]["WorkspaceType"]; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; wrapped_key?: string | null | undefined; is_member: boolean; shared_conversation_count: number; private_conversation_count: number; shared_document_count: number; private_document_count: number; user_files_mb: number; users: { user: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; role: components["schemas"]["WorkspaceRole"]; joined_at: string; conversation_count: number; document_count: number; files_mb: number; agent_ext_id?: string | null | undefined; is_temporary: boolean; }[]; project_ext_id?: string | null | undefined; project_name?: string | null | undefined; project_subscription?: string | null | undefined; project_owner_ext_id?: string | null | undefined; }>; declare function listWorkspaceUsers(arbi: ArbiClient): Promise<{ user: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; role: components["schemas"]["WorkspaceRole"]; joined_at: string; conversation_count: number; document_count: number; files_mb: number; agent_ext_id?: string | null | undefined; is_temporary: boolean; }[]>; declare function addWorkspaceUsers(arbi: ArbiClient, emails: string[], role?: 'owner' | 'collaborator' | 'guest'): Promise<{ user: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; role: components["schemas"]["WorkspaceRole"]; joined_at: string; conversation_count: number; document_count: number; files_mb: number; agent_ext_id?: string | null | undefined; is_temporary: boolean; }[]>; declare function removeWorkspaceUsers(arbi: ArbiClient, userIds: string[]): Promise; declare function setUserRole(arbi: ArbiClient, userIds: string[], role: 'owner' | 'collaborator' | 'guest'): Promise<{ user: { external_id: string; parent_ext_id?: string | null | undefined; email: string; given_name: string; family_name?: string | null | undefined; picture?: string | null | undefined; encryption_public_key: string; is_sso: boolean; }; role: components["schemas"]["WorkspaceRole"]; joined_at: string; conversation_count: number; document_count: number; files_mb: number; agent_ext_id?: string | null | undefined; is_temporary: boolean; }[]>; declare function copyDocuments(arbi: ArbiClient, targetWorkspaceId: string, docIds: string[], targetWorkspaceKey: string): Promise<{ detail: string; documents_copied: number; items_copied: number; copied_by_kind: { [x: string]: number; }; results: { source_doc_ext_id: string; success: boolean; new_doc_ext_id?: string | null | undefined; error?: string | null | undefined; kind: components["schemas"]["CopyItemKind"]; warning?: string | null | undefined; }[]; }>; declare const workspaces_addWorkspaceUsers: typeof addWorkspaceUsers; declare const workspaces_copyDocuments: typeof copyDocuments; declare const workspaces_createWorkspace: typeof createWorkspace; declare const workspaces_deleteWorkspaces: typeof deleteWorkspaces; declare const workspaces_listWorkspaceUsers: typeof listWorkspaceUsers; declare const workspaces_listWorkspaces: typeof listWorkspaces; declare const workspaces_removeWorkspaceUsers: typeof removeWorkspaceUsers; declare const workspaces_setUserRole: typeof setUserRole; declare const workspaces_updateWorkspace: typeof updateWorkspace; declare namespace workspaces { export { workspaces_addWorkspaceUsers as addWorkspaceUsers, workspaces_copyDocuments as copyDocuments, workspaces_createWorkspace as createWorkspace, workspaces_deleteWorkspaces as deleteWorkspaces, workspaces_listWorkspaceUsers as listWorkspaceUsers, workspaces_listWorkspaces as listWorkspaces, workspaces_removeWorkspaceUsers as removeWorkspaceUsers, workspaces_setUserRole as setUserRole, workspaces_updateWorkspace as updateWorkspace }; } /** * Tag operations — list, create, delete, update. */ type UpdateTagRequest = components['schemas']['UpdateTagRequest']; declare function listTags(arbi: ArbiClient): Promise<{ external_id: string; workspace_ext_id: string; name: string; instruction?: string | null | undefined; tag_type: { type: "checkbox" | "text" | "number" | "select" | "search" | "date"; options: string[]; }; shared: boolean; parent_ext_id?: string | null | undefined; doctag_count: number; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; }[]>; declare function createTag(arbi: ArbiClient, options: { name: string; workspaceId?: string; tagType?: components['schemas']['TagFormat']; instruction?: string | null; shared?: boolean; }): Promise<{ external_id: string; workspace_ext_id: string; name: string; instruction?: string | null | undefined; tag_type: { type: "checkbox" | "text" | "number" | "select" | "search" | "date"; options: string[]; }; shared: boolean; parent_ext_id?: string | null | undefined; doctag_count: number; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; }>; declare function deleteTag(arbi: ArbiClient, tagId: string): Promise<{ detail: string; }>; declare function updateTag(arbi: ArbiClient, tagId: string, body: UpdateTagRequest): Promise<{ external_id: string; workspace_ext_id: string; name: string; instruction?: string | null | undefined; tag_type: { type: "checkbox" | "text" | "number" | "select" | "search" | "date"; options: string[]; }; shared: boolean; parent_ext_id?: string | null | undefined; doctag_count: number; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; }>; declare const tags_createTag: typeof createTag; declare const tags_deleteTag: typeof deleteTag; declare const tags_listTags: typeof listTags; declare const tags_updateTag: typeof updateTag; declare namespace tags { export { tags_createTag as createTag, tags_deleteTag as deleteTag, tags_listTags as listTags, tags_updateTag as updateTag }; } /** * Conversation operations — list, threads, delete, share, title, messages, import. */ type ConversationImportResponse = components['schemas']['ConversationImportResponse']; declare function listConversations(arbi: ArbiClient): Promise<{ external_id: string; title: string | null; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; is_shared: boolean; message_count: number; last_message_status?: string | null | undefined; }[]>; /** * Import a conversation export into the active workspace. * * Accepts a ChatGPT data export (`conversations.json`), an OpenClaw session log, or a * Claude Code transcript (`.jsonl`); `source='auto'` lets the server detect the format. * Uses raw multipart fetch (the typed client can't express file uploads), mirroring * `files.uploadFile`. The active workspace + cipher are resolved server-side from the * session, so no extra header is needed. */ declare function importConversations(auth: AuthHeaders, fileData: Blob, fileName: string, source?: string): Promise; declare function getConversationThreads(arbi: ArbiClient, conversationId: string): Promise<{ conversation_ext_id: string; threads: { leaf_message_ext_id: string; history: { role: "user" | "assistant" | "system"; content: string; tools?: { [x: string]: { name: "model_citation"; description: string; tool_responses: { [x: string]: { chunk_ids: string[]; scores: number[]; statement: string; offset_start: number; offset_end: number; }; }; } | { name: "retrieval_chunk"; description: string; tool_args: { doc_ext_ids: string[]; search_mode?: ("semantic" | "keyword" | "hybrid") | null | undefined; }; tool_responses: { [x: string]: { metadata: { workspace_ext_id?: string | null | undefined; doc_ext_id?: string | null | undefined; doc_title?: string | null | undefined; chunk_id?: string | null | undefined; chunk_ext_id: string; chunk_pg_idx: number; chunk_doc_idx: number; page_number: number; score?: number | null | undefined; rerank_score?: number | null | undefined; tokens?: number | null | undefined; created_at: string; heading: boolean; bbox?: number[] | null | undefined; element_type?: string | null | undefined; heading_level?: number | null | undefined; }; content: string; }[]; }; } | { name: "retrieval_full_context"; description: string; tool_args: { doc_ext_ids: string[]; from_ref?: string | null | undefined; to_ref?: string | null | undefined; }; tool_responses: { [x: string]: { metadata: { workspace_ext_id?: string | null | undefined; doc_ext_id?: string | null | undefined; doc_title?: string | null | undefined; chunk_id?: string | null | undefined; chunk_ext_id: string; chunk_pg_idx: number; chunk_doc_idx: number; page_number: number; score?: number | null | undefined; rerank_score?: number | null | undefined; tokens?: number | null | undefined; created_at: string; heading: boolean; bbox?: number[] | null | undefined; element_type?: string | null | undefined; heading_level?: number | null | undefined; }; content: string; }[]; }; } | { name: "retrieval_toc"; description: string; tool_args: { doc_ext_ids: string[]; }; tool_responses: { [x: string]: { [x: string]: unknown; }[]; }; } | { name: "trace"; description: string; trace_id?: string | null | undefined; start_time?: number | null | undefined; duration_seconds?: number | null | undefined; steps: { [x: string]: unknown; }[]; } | { name: "compaction"; description: string; tool_args: { source_conversation_ext_id?: string | null | undefined; source_leaf_message_ext_id?: string | null | undefined; messages_summarized?: number | null | undefined; tokens_above?: number | null | undefined; tokens_summary?: number | null | undefined; model_used?: string | null | undefined; }; tool_responses: { [x: string]: string; }; } | { name: "personal_agent"; description: string; tool_args: { task: string; }; tool_responses: { [x: string]: unknown; }; } | { name: "stream_events"; events: { [x: string]: unknown; }[]; } | { name: "memory"; description: string; tool_responses: { written: string[]; superseded: string[]; }; } | { name: "goal"; description: string; record: { [x: string]: unknown; }; } | { name: "image_generation"; description: string; tool_args: { aspect_ratio?: string | null | undefined; }; tool_responses: { [x: string]: unknown; }; }; } | undefined; config_ext_id?: string | null | undefined; shared: boolean; tokens: number; status: string; external_id: string; created_at: string; created_by_ext_id: string; conversation_ext_id: string; parent_message_ext_id?: string | null | undefined; }[]; }[]; }>; declare function deleteConversation(arbi: ArbiClient, conversationId: string): Promise<{ detail: string; }>; declare function shareConversation(arbi: ArbiClient, conversationId: string): Promise<{ detail: string; }>; declare function updateConversationTitle(arbi: ArbiClient, conversationId: string, title: string): Promise<{ detail: string; title: string; }>; declare function getMessage(arbi: ArbiClient, messageId: string): Promise<{ role: "user" | "assistant" | "system"; content: string; tools?: { [x: string]: { name: "model_citation"; description: string; tool_responses: { [x: string]: { chunk_ids: string[]; scores: number[]; statement: string; offset_start: number; offset_end: number; }; }; } | { name: "retrieval_chunk"; description: string; tool_args: { doc_ext_ids: string[]; search_mode?: ("semantic" | "keyword" | "hybrid") | null | undefined; }; tool_responses: { [x: string]: { metadata: { workspace_ext_id?: string | null | undefined; doc_ext_id?: string | null | undefined; doc_title?: string | null | undefined; chunk_id?: string | null | undefined; chunk_ext_id: string; chunk_pg_idx: number; chunk_doc_idx: number; page_number: number; score?: number | null | undefined; rerank_score?: number | null | undefined; tokens?: number | null | undefined; created_at: string; heading: boolean; bbox?: number[] | null | undefined; element_type?: string | null | undefined; heading_level?: number | null | undefined; }; content: string; }[]; }; } | { name: "retrieval_full_context"; description: string; tool_args: { doc_ext_ids: string[]; from_ref?: string | null | undefined; to_ref?: string | null | undefined; }; tool_responses: { [x: string]: { metadata: { workspace_ext_id?: string | null | undefined; doc_ext_id?: string | null | undefined; doc_title?: string | null | undefined; chunk_id?: string | null | undefined; chunk_ext_id: string; chunk_pg_idx: number; chunk_doc_idx: number; page_number: number; score?: number | null | undefined; rerank_score?: number | null | undefined; tokens?: number | null | undefined; created_at: string; heading: boolean; bbox?: number[] | null | undefined; element_type?: string | null | undefined; heading_level?: number | null | undefined; }; content: string; }[]; }; } | { name: "retrieval_toc"; description: string; tool_args: { doc_ext_ids: string[]; }; tool_responses: { [x: string]: { [x: string]: unknown; }[]; }; } | { name: "trace"; description: string; trace_id?: string | null | undefined; start_time?: number | null | undefined; duration_seconds?: number | null | undefined; steps: { [x: string]: unknown; }[]; } | { name: "compaction"; description: string; tool_args: { source_conversation_ext_id?: string | null | undefined; source_leaf_message_ext_id?: string | null | undefined; messages_summarized?: number | null | undefined; tokens_above?: number | null | undefined; tokens_summary?: number | null | undefined; model_used?: string | null | undefined; }; tool_responses: { [x: string]: string; }; } | { name: "personal_agent"; description: string; tool_args: { task: string; }; tool_responses: { [x: string]: unknown; }; } | { name: "stream_events"; events: { [x: string]: unknown; }[]; } | { name: "memory"; description: string; tool_responses: { written: string[]; superseded: string[]; }; } | { name: "goal"; description: string; record: { [x: string]: unknown; }; } | { name: "image_generation"; description: string; tool_args: { aspect_ratio?: string | null | undefined; }; tool_responses: { [x: string]: unknown; }; }; } | undefined; config_ext_id?: string | null | undefined; shared: boolean; tokens: number; status: string; external_id: string; created_at: string; created_by_ext_id: string; conversation_ext_id: string; parent_message_ext_id?: string | null | undefined; }>; declare function deleteMessage(arbi: ArbiClient, messageId: string): Promise<{ detail: string; }>; type conversations_ConversationImportResponse = ConversationImportResponse; declare const conversations_deleteConversation: typeof deleteConversation; declare const conversations_deleteMessage: typeof deleteMessage; declare const conversations_getConversationThreads: typeof getConversationThreads; declare const conversations_getMessage: typeof getMessage; declare const conversations_importConversations: typeof importConversations; declare const conversations_listConversations: typeof listConversations; declare const conversations_shareConversation: typeof shareConversation; declare const conversations_updateConversationTitle: typeof updateConversationTitle; declare namespace conversations { export { type conversations_ConversationImportResponse as ConversationImportResponse, conversations_deleteConversation as deleteConversation, conversations_deleteMessage as deleteMessage, conversations_getConversationThreads as getConversationThreads, conversations_getMessage as getMessage, conversations_importConversations as importConversations, conversations_listConversations as listConversations, conversations_shareConversation as shareConversation, conversations_updateConversationTitle as updateConversationTitle }; } /** * Document-tag (doctag) operations — assign, remove, generate. */ type CitationSources = components['schemas']['CitationSources']; declare function assignDocTags(arbi: ArbiClient, tagId: string, docIds: string[], note?: string | null): Promise<{ note?: string | null | undefined; citations?: { passages: { chunk_id: string; doc_ext_id?: string | null | undefined; page?: number | null | undefined; }[]; } | null | undefined; external_id: string; doc_ext_id: string; tag_ext_id: string; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; }[]>; declare function removeDocTags(arbi: ArbiClient, tagId: string, docIds: string[]): Promise; declare function updateDocTag(arbi: ArbiClient, tagId: string, docId: string, updates: { note?: string | null; citations?: CitationSources | null; }): Promise<{ note?: string | null | undefined; citations?: { passages: { chunk_id: string; doc_ext_id?: string | null | undefined; page?: number | null | undefined; }[]; } | null | undefined; external_id: string; doc_ext_id: string; tag_ext_id: string; created_by_ext_id: string; updated_by_ext_id?: string | null | undefined; created_at: string; updated_at: string; }>; declare function generateDocTags(arbi: ArbiClient, tagIds: string[], docIds: string[], options?: { overwrite?: boolean; }): Promise<{ doc_ext_ids: string[]; tag_ext_ids: string[]; }>; declare const doctags_assignDocTags: typeof assignDocTags; declare const doctags_generateDocTags: typeof generateDocTags; declare const doctags_removeDocTags: typeof removeDocTags; declare const doctags_updateDocTag: typeof updateDocTag; declare namespace doctags { export { doctags_assignDocTags as assignDocTags, doctags_generateDocTags as generateDocTags, doctags_removeDocTags as removeDocTags, doctags_updateDocTag as updateDocTag }; } /** * User settings operations — get, update. */ type UserSettingsUpdate = components['schemas']['UserSettingsUpdate']; declare function getSettings(arbi: ArbiClient): Promise<{ [x: string]: unknown; subscription?: { status: string; } | null | undefined; last_workspace?: string | null | undefined; last_config?: string | null | undefined; pinned_workspaces: string[]; pinned_templates: string[]; pinned_skills: string[]; tableviews: { workspace: string; name: string; columns: string[]; column_widths?: { [x: string]: number; } | null | undefined; tile_size?: number | null | undefined; row_height?: number | null | undefined; }[]; developer: boolean; show_document_navigator: boolean; show_thread_visualization: boolean; show_security_settings: boolean; show_invite_tab: boolean; show_help_page: boolean; show_templates: boolean; show_skills: boolean; show_pa_mode: boolean; show_conversation_search: boolean; show_agent_sessions: boolean; show_mcp_connectors: boolean; show_connector_microsoft: boolean; show_connector_sharepoint: boolean; show_connector_google: boolean; show_connector_imanage: boolean; show_appearance: boolean; show_file_explorer: boolean; show_hints: boolean; show_tasks: boolean; show_agent_builder: boolean; dismissed_tips?: string[] | undefined; use_s3_direct_upload: boolean; hide_online_status: boolean; muted_users: string[]; email_notifications?: { messages: boolean; workspace_added: boolean; workspace_access_request: boolean; contact_accepted: boolean; referral_reward: boolean; product_updates: boolean; } | undefined; premium_model?: string | null | undefined; picture?: string | null | undefined; extra_discount?: { [x: string]: unknown; } | null | undefined; }>; declare function updateSettings(arbi: ArbiClient, body: UserSettingsUpdate): Promise; declare const settings_getSettings: typeof getSettings; declare const settings_updateSettings: typeof updateSettings; declare namespace settings { export { settings_getSettings as getSettings, settings_updateSettings as updateSettings }; } /** * Agent configuration operations — list, get, save, delete, schema, models. */ type ConfigUpdateData = components['schemas']['ConfigUpdateData']; declare function listConfigs(arbi: ArbiClient): Promise<{ versions: { external_id: string; title: string | null; created_at: string; }[]; }>; declare function getConfig(arbi: ArbiClient, configId: string): Promise<{ Agents: { ENABLED: boolean; HUMAN_IN_THE_LOOP: boolean; WEB_SEARCH_ENABLED: boolean; RUN_CODE_ENABLED: boolean; MCP_TOOLS: string[]; PLANNING_ENABLED: boolean; DEEP_RESEARCH_ENABLED: boolean; SUBAGENTS_ENABLED: boolean; SUGGESTED_QUERIES: boolean; ARTIFACTS_ENABLED: boolean; IMAGE_ENABLED: boolean; VISION_ENABLED: boolean; CONVERSATION_SEARCH_ENABLED: boolean; PERSONAL_AGENT: boolean; FACTS_ENABLED: boolean; PERSIST_LEARNINGS: boolean; SKILLS_ENABLED: boolean; SKILL_CREATION: boolean; WORKSPACE_TOOLS_ENABLED: boolean; REMOTE_CONTROL_ENABLED: boolean; ENABLED_SKILLS?: string[] | null | undefined; MEMORY_CREATION: boolean; GOALS_ENABLED: boolean; GOAL_MAX_OUTER_LOOPS: number; PERSONA: string; AGENT_MODEL_NAME: string; AGENT_API_TYPE: "local" | "remote"; LLM_AGENT_TEMPERATURE: number; AGENT_MAX_TOKENS: number; ENABLE_THINKING: boolean; AGENT_STRICT_TOOL_CALLS: boolean; AGENT_MAX_ITERATIONS: number; AGENT_TURN_CREDIT_BUDGET: number; AGENT_MAX_PARALLEL_TOOL_CALLS: number; AGENT_MAX_TOTAL_TOOL_CALLS: number; AGENT_MAX_RUN_TOKENS: number; AGENT_MAX_SUBAGENT_SPAWNS: number; AGENT_HISTORY_CHAR_THRESHOLD: number; AGENT_SYSTEM_PROMPT: string; }; QueryLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; MAX_TOKEN_SIZE_TO_ANSWER: number; TEMPERATURE: number; MAX_TOKENS: number; }; ReviewLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; TEMPERATURE: number; MAX_TOKENS: number; MAX_TOKEN_SIZE_TO_ANSWER: number; }; EvaluatorLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; TEMPERATURE: number; MAX_TOKENS: number; MAX_TOKEN_SIZE_TO_ANSWER: number; MAX_CHUNKS_PER_EVAL_CALL: number; MAX_CONCURRENT_EVAL_BATCHES: number; EVAL_BATCH_TIMEOUT_S: number; }; TitleLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; MAX_TOKEN_SIZE_TO_ANSWER: number; TEMPERATURE: number; MAX_TOKENS: number; }; SummariseLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; TEMPERATURE: number; MAX_TOKENS: number; MAX_TOKEN_SIZE_TO_ANSWER: number; COMPACTION_THRESHOLD_TOKENS: number; COMPACTION_KEEP_RECENT: number; }; DoctagLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; MAX_TOKEN_CONTEXT_TO_ANSWER: number; TEMPERATURE: number; MAX_TOKENS: number; MAX_CONCURRENT_DOCS: number; AUTO_RENAME: boolean; AUTO_RENAME_INSTRUCTION: string; DEFAULT_METADATA_TAGS?: { name: string; instruction?: string | null | undefined; tag_type?: { type: "checkbox" | "text" | "number" | "select" | "search" | "date"; options: string[]; } | undefined; }[] | undefined; }; MemoryLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; TEMPERATURE: number; MAX_TOKENS: number; MAX_TOKEN_CONTEXT: number; MAX_CONCURRENT: number; }; PlanningLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; TEMPERATURE: number; MAX_TOKENS: number; MAX_TOKEN_SIZE_TO_ANSWER: number; APPROVAL_TIMEOUT: number; }; FilterPlanLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; TEMPERATURE: number; MAX_TOKENS: number; }; VisionLLM: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; TEMPERATURE: number; MAX_TOKENS: number; MAX_PAGES_PER_CALL: number; IMAGE_MAX_DIMENSION: number; }; ImageGen: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; TEMPERATURE: number; }; CodeAgent: { API_TYPE: "local" | "remote"; ENABLE_THINKING: boolean; MODEL_NAME: string; SYSTEM_INSTRUCTION: string; TEMPERATURE: number; MAX_TOKENS: number; }; ModelCitation: { SIM_THREASHOLD: number; MIN_CHAR_SIZE_TO_ANSWER: number; MAX_NUMB_CITATIONS: number; CITATION_INSTRUCTION: string; }; WebSearch: { SAVE_SOURCES: boolean; }; RunCode: { IMAGE: string; TIMEOUT_SECONDS: number; MEMORY_LIMIT: string; NETWORK: string; }; Retriever: { agent?: { MIN_RETRIEVAL_SIM_SCORE: number; KEYWORD_MIN_TERM_OVERLAP_RATIO: number; MAX_DISTINCT_DOCUMENTS: number; MAX_TOTAL_CHUNKS_TO_RETRIEVE: number; GROUP_SIZE: number; SEARCH_MODE: components["schemas"]["SearchMode"]; HYBRID_PREFETCH_LIMIT: number; HYBRID_DENSE_WEIGHT: number; HYBRID_SPARSE_WEIGHT: number; } | undefined; smart_search?: { MIN_RETRIEVAL_SIM_SCORE: number; KEYWORD_MIN_TERM_OVERLAP_RATIO: number; MAX_DISTINCT_DOCUMENTS: number; MAX_TOTAL_CHUNKS_TO_RETRIEVE: number; GROUP_SIZE: number; SEARCH_MODE: components["schemas"]["SearchMode"]; HYBRID_PREFETCH_LIMIT: number; HYBRID_DENSE_WEIGHT: number; HYBRID_SPARSE_WEIGHT: number; } | undefined; }; Reranker: { agent?: { MIN_SCORE: number; MAX_NUMB_OF_CHUNKS: number; } | undefined; smart_search?: { MIN_SCORE: number; MAX_NUMB_OF_CHUNKS: number; } | undefined; MAX_CONCURRENT_REQUESTS: number; MODEL_NAME: string; API_TYPE: "local" | "remote"; RETRIEVAL_INSTRUCTION: string; }; Parser: { SKIP_DUPLICATES: boolean; }; Chunker: { MAX_CHUNK_TOKENS: number; TOKENIZER_NAME: string; }; Embedder: { MODEL_NAME: string; API_TYPE: "local" | "remote"; BATCH_SIZE: number; MAX_CONCURRENT_REQUESTS: number; DOCUMENT_PREFIX: string; QUERY_PREFIX: string; }; KeywordEmbedder: { DIMENSION_SPACE: number; FILTER_STOPWORDS: boolean; BM25_K1: number; BM25_B: number; BM25_AVGDL: number; CJK_NGRAM_SIZE: number; NORMALIZE_TRADITIONAL_TO_SIMPLIFIED: boolean; }; } | { Agents: { ENABLED: boolean; HUMAN_IN_THE_LOOP: boolean; WEB_SEARCH_ENABLED: boolean; RUN_CODE_ENABLED: boolean; MCP_TOOLS: string[]; PLANNING_ENABLED: boolean; DEEP_RESEARCH_ENABLED: boolean; SUBAGENTS_ENABLED: boolean; SUGGESTED_QUERIES: boolean; ARTIFACTS_ENABLED: boolean; IMAGE_ENABLED: boolean; VISION_ENABLED: boolean; CONVERSATION_SEARCH_ENABLED: boolean; FACTS_ENABLED: boolean; PERSIST_LEARNINGS: boolean; SKILLS_ENABLED: boolean; WORKSPACE_TOOLS_ENABLED: boolean; REMOTE_CONTROL_ENABLED: boolean; ENABLED_SKILLS?: string[] | null | undefined; GOALS_ENABLED: boolean; GOAL_MAX_OUTER_LOOPS: number; PERSONA: string; AGENT_MODEL_NAME: string; ENABLE_THINKING: boolean; AGENT_MAX_ITERATIONS: number; AGENT_TURN_CREDIT_BUDGET: number; }; DoctagLLM: { AUTO_RENAME: boolean; AUTO_RENAME_INSTRUCTION: string; DEFAULT_METADATA_TAGS?: { name: string; instruction?: string | null | undefined; tag_type?: { type: "checkbox" | "text" | "number" | "select" | "search" | "date"; options: string[]; } | undefined; }[] | undefined; }; Parser: { SKIP_DUPLICATES: boolean; }; }>; declare function saveConfig(arbi: ArbiClient, body: ConfigUpdateData): Promise<{ external_id: string; title: string | null; created_at: string; }>; declare function deleteConfig(arbi: ArbiClient, configId: string): Promise<{ detail: string; }>; declare function getSchema(arbi: ArbiClient): Promise; declare function getModels(arbi: ArbiClient): Promise<{ models: { model_name: string; api_type: string; tags?: string[] | null | undefined; max_input_tokens?: number | null | undefined; max_output_tokens?: number | null | undefined; input_cost_per_token?: number | null | undefined; output_cost_per_token?: number | null | undefined; provider?: string | null | undefined; mode?: string | null | undefined; supports_vision?: boolean | null | undefined; supports_reasoning?: boolean | null | undefined; supports_function_calling?: boolean | null | undefined; supports_response_schema?: boolean | null | undefined; }[]; premium_default?: string | null | undefined; }>; declare const agentconfig_deleteConfig: typeof deleteConfig; declare const agentconfig_getConfig: typeof getConfig; declare const agentconfig_getModels: typeof getModels; declare const agentconfig_getSchema: typeof getSchema; declare const agentconfig_listConfigs: typeof listConfigs; declare const agentconfig_saveConfig: typeof saveConfig; declare namespace agentconfig { export { agentconfig_deleteConfig as deleteConfig, agentconfig_getConfig as getConfig, agentconfig_getModels as getModels, agentconfig_getSchema as getSchema, agentconfig_listConfigs as listConfigs, agentconfig_saveConfig as saveConfig }; } /** * Health and model operations. */ declare function getHealth(arbi: ArbiClient): Promise<{ status: string; backend_git_hash?: string | null | undefined; frontend_docker_version?: string | null | undefined; services: { name: string; status: string; detail?: string | null | undefined; service_info?: { [x: string]: unknown; } | null | undefined; }[]; models_health?: { application: string; models: { model: string; status: string; detail?: string | null | undefined; }[]; } | null | undefined; available_models: string[]; }>; declare function getHealthModels(arbi: ArbiClient): Promise<{ models: { model_name: string; api_type: string; tags?: string[] | null | undefined; max_input_tokens?: number | null | undefined; max_output_tokens?: number | null | undefined; input_cost_per_token?: number | null | undefined; output_cost_per_token?: number | null | undefined; provider?: string | null | undefined; mode?: string | null | undefined; supports_vision?: boolean | null | undefined; supports_reasoning?: boolean | null | undefined; supports_function_calling?: boolean | null | undefined; supports_response_schema?: boolean | null | undefined; }[]; premium_default?: string | null | undefined; }>; declare function getRemoteModels(arbi: ArbiClient): Promise<{ application: string; models: { model: string; status: string; detail?: string | null | undefined; }[]; }>; declare function getMcpTools(arbi: ArbiClient): Promise<{ tools: { name: string; description: string; server_name: string; }[]; }>; declare const health_getHealth: typeof getHealth; declare const health_getHealthModels: typeof getHealthModels; declare const health_getMcpTools: typeof getMcpTools; declare const health_getRemoteModels: typeof getRemoteModels; declare namespace health { export { health_getHealth as getHealth, health_getHealthModels as getHealthModels, health_getMcpTools as getMcpTools, health_getRemoteModels as getRemoteModels }; } /** * Responses operations — background query submission and retrieval. * * submitBackgroundQuery: POST /v1/responses with background=true → 202 with task ID. * getResponse: GET /v1/responses/{responseId} → current status + output. * extractResponseText: Walk response output and join text content. */ type ResponsesAPIResponse = components['schemas']['ResponsesAPIResponse']; interface SubmitBackgroundQueryOptions extends AuthHeaders { workspaceId: string; question: string; docIds: string[]; previousResponseId?: string | null; model?: string; } /** * Submit a query for background processing. * Returns immediately with a response ID and "queued" status. */ declare function submitBackgroundQuery(options: SubmitBackgroundQueryOptions): Promise; /** * Fetch the current state of a response by ID. * Returns progressive status, output, usage, and metadata. */ declare function getResponse(auth: AuthHeaders, responseId: string): Promise; /** * Walk response output messages and join all output_text content. * Pure function, no I/O. */ declare function extractResponseText(response: ResponsesAPIResponse): string; type responses_SubmitBackgroundQueryOptions = SubmitBackgroundQueryOptions; declare const responses_extractResponseText: typeof extractResponseText; declare const responses_getResponse: typeof getResponse; declare const responses_submitBackgroundQuery: typeof submitBackgroundQuery; declare namespace responses { export { type responses_SubmitBackgroundQueryOptions as SubmitBackgroundQueryOptions, responses_extractResponseText as extractResponseText, responses_getResponse as getResponse, responses_submitBackgroundQuery as submitBackgroundQuery }; } /** * Project operations — list, create, update, delete, checkout, refresh, usage. */ type ProjectUsageResponse = components['schemas']['ProjectUsageResponse']; type ProjectInvoicesResponse = components['schemas']['ProjectInvoicesResponse']; type UserDailyUsageResponse = components['schemas']['UserDailyUsageResponse']; type ProjectUpdateRequest = components['schemas']['ProjectUpdateRequest']; declare function listProjects(arbi: ArbiClient): Promise<{ external_id: string; name: string; created_by: string; packs: number; subscription: string; created_at: string; quotas: { storage_gb: { used: number; limit: number; }; ai_credits: { used: number; limit: number; }; collaborators: { used: number; limit: number; }; budget_reset_at?: number | null | undefined; }; daily_cap_per_user?: number | null | undefined; price_id?: string | null | undefined; plan?: string | null | undefined; amount?: number | null | undefined; currency?: string | null | undefined; current_period_end?: number | null | undefined; cancel_at_period_end?: boolean | null | undefined; portal_url?: string | null | undefined; }[]>; declare function createProject(arbi: ArbiClient, name: string): Promise<{ external_id: string; name: string; created_by: string; packs: number; subscription: string; created_at: string; quotas: { storage_gb: { used: number; limit: number; }; ai_credits: { used: number; limit: number; }; collaborators: { used: number; limit: number; }; budget_reset_at?: number | null | undefined; }; daily_cap_per_user?: number | null | undefined; price_id?: string | null | undefined; plan?: string | null | undefined; amount?: number | null | undefined; currency?: string | null | undefined; current_period_end?: number | null | undefined; cancel_at_period_end?: boolean | null | undefined; portal_url?: string | null | undefined; }>; /** Update a project's mutable fields (e.g. `name`, `daily_cap_per_user`). */ declare function updateProject(arbi: ArbiClient, projectExtId: string, body: ProjectUpdateRequest): Promise<{ external_id: string; name: string; created_by: string; packs: number; subscription: string; created_at: string; quotas: { storage_gb: { used: number; limit: number; }; ai_credits: { used: number; limit: number; }; collaborators: { used: number; limit: number; }; budget_reset_at?: number | null | undefined; }; daily_cap_per_user?: number | null | undefined; price_id?: string | null | undefined; plan?: string | null | undefined; amount?: number | null | undefined; currency?: string | null | undefined; current_period_end?: number | null | undefined; cancel_at_period_end?: boolean | null | undefined; portal_url?: string | null | undefined; }>; /** Rename a project. Convenience wrapper over {@link updateProject}. */ declare function renameProject(arbi: ArbiClient, projectExtId: string, name: string): Promise<{ external_id: string; name: string; created_by: string; packs: number; subscription: string; created_at: string; quotas: { storage_gb: { used: number; limit: number; }; ai_credits: { used: number; limit: number; }; collaborators: { used: number; limit: number; }; budget_reset_at?: number | null | undefined; }; daily_cap_per_user?: number | null | undefined; price_id?: string | null | undefined; plan?: string | null | undefined; amount?: number | null | undefined; currency?: string | null | undefined; current_period_end?: number | null | undefined; cancel_at_period_end?: boolean | null | undefined; portal_url?: string | null | undefined; }>; declare function deleteProject(arbi: ArbiClient, projectExtId: string): Promise; declare function refreshProject(arbi: ArbiClient, projectExtId: string): Promise<{ external_id: string; name: string; created_by: string; packs: number; subscription: string; created_at: string; quotas: { storage_gb: { used: number; limit: number; }; ai_credits: { used: number; limit: number; }; collaborators: { used: number; limit: number; }; budget_reset_at?: number | null | undefined; }; daily_cap_per_user?: number | null | undefined; price_id?: string | null | undefined; plan?: string | null | undefined; amount?: number | null | undefined; currency?: string | null | undefined; current_period_end?: number | null | undefined; cancel_at_period_end?: boolean | null | undefined; portal_url?: string | null | undefined; }>; /** * AI usage + spend breakdown for a project's billing period. `monthsBack` * selects the period: 0 (default) = current, 1 = previous month, etc. */ declare function getProjectUsage(arbi: ArbiClient, projectExtId: string, monthsBack?: number): Promise; /** List the Stripe invoices for a project's subscription. */ declare function getProjectInvoices(arbi: ArbiClient, projectExtId: string): Promise; /** * Today's deployment-wide credit spend for the current user — the number the * per-user daily cap is enforced against. Pair with a project's * `daily_cap_per_user` to render a "credits today" indicator. */ declare function getUserUsageToday(arbi: ArbiClient): Promise; type projects_ProjectInvoicesResponse = ProjectInvoicesResponse; type projects_ProjectUpdateRequest = ProjectUpdateRequest; type projects_ProjectUsageResponse = ProjectUsageResponse; type projects_UserDailyUsageResponse = UserDailyUsageResponse; declare const projects_createProject: typeof createProject; declare const projects_deleteProject: typeof deleteProject; declare const projects_getProjectInvoices: typeof getProjectInvoices; declare const projects_getProjectUsage: typeof getProjectUsage; declare const projects_getUserUsageToday: typeof getUserUsageToday; declare const projects_listProjects: typeof listProjects; declare const projects_refreshProject: typeof refreshProject; declare const projects_renameProject: typeof renameProject; declare const projects_updateProject: typeof updateProject; declare namespace projects { export { type projects_ProjectInvoicesResponse as ProjectInvoicesResponse, type projects_ProjectUpdateRequest as ProjectUpdateRequest, type projects_ProjectUsageResponse as ProjectUsageResponse, type projects_UserDailyUsageResponse as UserDailyUsageResponse, projects_createProject as createProject, projects_deleteProject as deleteProject, projects_getProjectInvoices as getProjectInvoices, projects_getProjectUsage as getProjectUsage, projects_getUserUsageToday as getUserUsageToday, projects_listProjects as listProjects, projects_refreshProject as refreshProject, projects_renameProject as renameProject, projects_updateProject as updateProject }; } export { type ResponseOutputItemDoneEvent as $, type AgentControlStateEvent as A, type FactSearchRequest as B, type ChatSession as C, DOC_TERMINAL_STATUSES as D, type FactSearchResponse as E, type FactResponse as F, type FormattedWsMessage as G, type ListPaginatedOptions as H, type MessageMetadataPayload$1 as I, type MessageQueuedEvent as J, type ProbeAnswerEvent as K, type ListAllOptions as L, type MessageLevel as M, type ProjectInvoicesResponse as N, type OutputTokensDetails as O, type ParsedSlashCommand as P, type ProjectUsageResponse as Q, type QueryOptions as R, type ReconnectOptions as S, type ReconnectableWsConnection as T, type ResolvedCitation as U, type ResolvedRecipient as V, type ResponseCompletedEvent as W, type ResponseContentPartAddedEvent as X, type ResponseCreatedEvent as Y, type ResponseFailedEvent as Z, type ResponseOutputItemAddedEvent as _, type AgentStepDeltaEvent as a, performPasswordLogin as a$, type ResponseOutputTextDeltaEvent as a0, type ResponseOutputTextDoneEvent as a1, type ResponseUsage as a2, type SSEEvent as a3, type SSEStreamCallbacks as a4, type SSEStreamResult as a5, type SSEStreamStartData as a6, SUPPORTED_EXTENSIONS as a7, type SkillSummary as a8, type SkippedFile as a9, contacts as aA, conversations as aB, countCitations as aC, createAuthenticatedClient as aD, createDocumentWaiter as aE, dm as aF, doctags as aG, documents as aH, facts as aI, files as aJ, filterSkills as aK, formatAgentStepLabel as aL, formatFileSize as aM, formatItemLabel as aN, formatStreamSummary as aO, formatUserName as aP, formatWorkspaceChoices as aQ, formatWsMessage as aR, generateEncryptedWorkspaceKey as aS, generateNewWorkspaceKey as aT, getErrorCode as aU, getErrorMessage as aV, getRawWorkspaceKey as aW, health as aX, parseSSEEvents as aY, parseSlashCommand as aZ, parseSlashTokenInProgress as a_, type TaskResponse as aa, type TokenBudgetContext as ab, type UpdateFactRequest as ac, type UpdateTaskRequest as ad, type UploadBatchResult as ae, type UploadDirectOptions as af, type UploadDirectResult as ag, type UploadOptions as ah, type UploadResult as ai, type UserDailyUsageResponse as aj, type UserInfo as ak, type UserInputRequestEvent as al, type UserMessageEvent as am, WebSocketAuthError as an, type WorkspaceContext as ao, type WsConnection as ap, agentconfig as aq, assistant as ar, authenticatedFetch as as, buildDocNameMap as at, buildRetrievalChunkTool as au, buildRetrievalFullContextTool as av, buildRetrievalTocTool as aw, connectWebSocket as ax, connectWithReconnect as ay, consumeSSEStream as az, type AgentStepEvent as b, performSigningKeyLogin as b0, performSsoDeviceFlowLogin as b1, projects as b2, requireData as b3, requireOk as b4, resolveAuth as b5, resolveCitations as b6, resolveWorkspace as b7, responses as b8, selectWorkspace as b9, selectWorkspaceById as ba, settings as bb, streamSSE as bc, stripCitationMarkdown as bd, summarizeCitations as be, tags as bf, tasks as bg, workspaces as bh, Arbi as c, ArbiApiError as d, ArbiError as e, type ArbiErrorEvent as f, type ArbiOptions as g, type ArtifactEvent as h, type AuthContext as i, type AuthHeaders as j, type AuthenticatedClient as k, type CitationSummary as l, type CliConfig as m, type CliCredentials as n, type CommandDescriptor as o, type ConfigStore as p, type ConnectOptions as q, type CreateFactRequest as r, type CreateTaskRequest as s, type DeferredInterjectionEvent as t, type DmCryptoContext as u, type DocNameMap as v, type DocumentListFields as w, type DocumentListOrder as x, type DocumentWaiter as y, type DocumentWaiterOptions as z };