import { p as ConfigStore, m as CliConfig, n as CliCredentials, C as ChatSession, a9 as SkippedFile, ai as UploadResult, j as AuthHeaders, ae as UploadBatchResult, ah as UploadOptions, af as UploadDirectOptions, ag as UploadDirectResult, a7 as SUPPORTED_EXTENSIONS, u as DmCryptoContext } from './browser-C-XYO6U8.js'; export { b as AgentStepEvent, c as Arbi, d as ArbiApiError, e as ArbiError, g as ArbiOptions, h as ArtifactEvent, i as AuthContext, k as AuthenticatedClient, l as CitationSummary, o as CommandDescriptor, q as ConnectOptions, D as DOC_TERMINAL_STATUSES, v as DocNameMap, w as DocumentListFields, x as DocumentListOrder, y as DocumentWaiter, z as DocumentWaiterOptions, G as FormattedWsMessage, L as ListAllOptions, H as ListPaginatedOptions, M as MessageLevel, I as MessageMetadataPayload, J as MessageQueuedEvent, O as OutputTokensDetails, P as ParsedSlashCommand, N as ProjectInvoicesResponse, Q as ProjectUsageResponse, R as QueryOptions, S as ReconnectOptions, T as ReconnectableWsConnection, U as ResolvedCitation, V as ResolvedRecipient, W as ResponseCompletedEvent, X as ResponseContentPartAddedEvent, Y as ResponseCreatedEvent, Z as ResponseFailedEvent, _ as ResponseOutputItemAddedEvent, $ as ResponseOutputItemDoneEvent, a0 as ResponseOutputTextDeltaEvent, a1 as ResponseOutputTextDoneEvent, a2 as ResponseUsage, a3 as SSEEvent, a4 as SSEStreamCallbacks, a5 as SSEStreamResult, a6 as SSEStreamStartData, a8 as SkillSummary, ab as TokenBudgetContext, aj as UserDailyUsageResponse, ak as UserInfo, al as UserInputRequestEvent, am as UserMessageEvent, an as WebSocketAuthError, ao as WorkspaceContext, ap as WsConnection, aq as agentconfig, ar as assistant, as as authenticatedFetch, at as buildDocNameMap, au as buildRetrievalChunkTool, av as buildRetrievalFullContextTool, aw as buildRetrievalTocTool, ax as connectWebSocket, ay as connectWithReconnect, az as consumeSSEStream, aA as contacts, aB as conversations, aC as countCitations, aD as createAuthenticatedClient, aE as createDocumentWaiter, aF as dm, aG as doctags, aH as documents, aI as facts, aJ as files, aK as filterSkills, aL as formatAgentStepLabel, aM as formatFileSize, aN as formatItemLabel, aO as formatStreamSummary, aP as formatUserName, aQ as formatWorkspaceChoices, aR as formatWsMessage, aS as generateEncryptedWorkspaceKey, aT as generateNewWorkspaceKey, aU as getErrorCode, aV as getErrorMessage, aW as getRawWorkspaceKey, aX as health, aY as parseSSEEvents, aZ as parseSlashCommand, a_ as parseSlashTokenInProgress, a$ as performPasswordLogin, b0 as performSigningKeyLogin, b1 as performSsoDeviceFlowLogin, b2 as projects, b3 as requireData, b4 as requireOk, b5 as resolveAuth, b6 as resolveCitations, b7 as resolveWorkspace, b8 as responses, b9 as selectWorkspace, ba as selectWorkspaceById, bb as settings, bc as streamSSE, bd as stripCitationMarkdown, be as summarizeCitations, bf as tags, bg as tasks, bh as workspaces } from './browser-C-XYO6U8.js'; import { SessionStorageProvider, ArbiClient, components } from '@arbidocs/client'; /** * Configuration persistence — file-based implementation for Node.js environments. * * Browser consumers should import from './config-types.ts' directly. */ declare class FileConfigStore implements ConfigStore { private readonly configDir; private readonly configFile; private readonly credentialsFile; private readonly sessionFile; private readonly metadataFile; constructor(configDir?: string); private ensureConfigDir; private writeSecureFile; private readJsonFile; getConfig(): CliConfig | null; saveConfig(config: CliConfig): void; updateConfig(updates: Partial): void; requireConfig(): CliConfig; getCredentials(): CliCredentials | null; saveCredentials(creds: CliCredentials): void; deleteCredentials(): void; requireCredentials(): CliCredentials; /** * Returns a SessionStorageProvider backed by this store's * credentials file. Used to wire the auto-relogin middleware in * `@arbidocs/client` to the Node-side file store — without this, the * middleware falls back to IndexedDB which does not exist in Node * and re-login on 401 silently gives up. * * `getSession` reads the stored signing/server-session keys and * decodes them to the raw byte form the relogin handler expects. * `saveSession` writes a refreshed server session key back to the * credentials file on successful re-login so the next CLI * invocation picks it up. */ getSessionStorageProvider(): SessionStorageProvider; getChatSession(): ChatSession; saveChatSession(session: ChatSession): void; updateChatSession(updates: Partial): void; clearChatSession(): void; saveLastMetadata(metadata: unknown): void; loadLastMetadata(): unknown | null; /** * Try to resolve config from multiple sources, in priority order: * * 1. Existing `~/.arbi/config.json` (highest priority) * 2. `ARBI_SERVER_URL` environment variable * 3. `.env` file in `searchDir` → read `VITE_DEPLOYMENT_DOMAIN` * 4. `public/config.json` in `searchDir` → read `deployment.domain` * 5. Default to `https://localhost` * * Returns `{ config, source }` where source describes where the config came from. * Saves auto-detected config to disk so subsequent calls use the fast path. */ resolveConfigWithFallbacks(searchDir?: string): { config: CliConfig; source: string; }; /** * Read VITE_DEPLOYMENT_DOMAIN from a .env file. */ private readDotEnvDomain; /** * Read deployment.domain from a public/config.json file. */ private readPublicConfigDomain; } /** * OAuth 2.0 Device Authorization Grant (RFC 8628) for Auth0. * * Enables headless CLI login: the user authorizes in a browser while the CLI polls for a token. */ interface SsoConfig { ssoEnabled: boolean; domain: string; clientId: string; audience: string; } interface DeviceCodeResponse { device_code: string; user_code: string; verification_uri: string; verification_uri_complete: string; expires_in: number; interval: number; } declare class DeviceFlowError extends Error { constructor(message: string); } declare class DeviceFlowExpired extends DeviceFlowError { constructor(); } declare class DeviceFlowAccessDenied extends DeviceFlowError { constructor(); } /** * Fetch SSO configuration from the ARBI deployment. */ declare function fetchSsoConfig(baseUrl: string): Promise; /** * Request a device code from Auth0. * * POST https://{domain}/oauth/device/code */ declare function requestDeviceCode(domain: string, clientId: string, audience?: string, scope?: string): Promise; /** * Poll Auth0 token endpoint until the user authorizes (or the code expires). * * Returns the Auth0 access_token (JWT). */ declare function pollForToken(domain: string, clientId: string, deviceCode: string, interval: number, expiresIn: number, onPoll?: (elapsedMs: number) => void): Promise; type deviceFlow_DeviceCodeResponse = DeviceCodeResponse; type deviceFlow_DeviceFlowAccessDenied = DeviceFlowAccessDenied; declare const deviceFlow_DeviceFlowAccessDenied: typeof DeviceFlowAccessDenied; type deviceFlow_DeviceFlowError = DeviceFlowError; declare const deviceFlow_DeviceFlowError: typeof DeviceFlowError; type deviceFlow_DeviceFlowExpired = DeviceFlowExpired; declare const deviceFlow_DeviceFlowExpired: typeof DeviceFlowExpired; type deviceFlow_SsoConfig = SsoConfig; declare const deviceFlow_fetchSsoConfig: typeof fetchSsoConfig; declare const deviceFlow_pollForToken: typeof pollForToken; declare const deviceFlow_requestDeviceCode: typeof requestDeviceCode; declare namespace deviceFlow { export { type deviceFlow_DeviceCodeResponse as DeviceCodeResponse, deviceFlow_DeviceFlowAccessDenied as DeviceFlowAccessDenied, deviceFlow_DeviceFlowError as DeviceFlowError, deviceFlow_DeviceFlowExpired as DeviceFlowExpired, type deviceFlow_SsoConfig as SsoConfig, deviceFlow_fetchSsoConfig as fetchSsoConfig, deviceFlow_pollForToken as pollForToken, deviceFlow_requestDeviceCode as requestDeviceCode }; } /** * Document operations — Node.js file system operations. * * These functions require Node.js built-ins (fs, path) and are not browser-safe. * Browser consumers should use the Blob-based uploadFile/uploadFiles from './documents.js'. */ /** Archive extensions that can be extracted via the system `7z` command. */ declare const ARCHIVE_EXTENSIONS: Set; interface UploadProgress { /** Current batch number (1-based). */ batch: number; /** Total number of batches. */ totalBatches: number; /** Folder being uploaded. */ folder: string; /** Number of files in this batch. */ filesInBatch: number; /** Cumulative files uploaded so far (including this batch). */ filesUploaded: number; /** Total files to upload. */ totalFiles: number; } interface UploadDirectoryOptions { /** Called before each batch is sent. */ onBatchStart?: (progress: UploadProgress) => void; /** Called after each batch completes. */ onBatchComplete?: (progress: UploadProgress & { result: UploadResult; }) => void; /** Config ext_id to pass to each upload batch (e.g. for SKIP_DUPLICATES). */ configExtId?: string; } /** * Upload a local file by path. Handles readFileSync + basename + Blob + uploadFile. * Convenience wrapper for CLI/TUI consumers that work with file system paths. * * Workspace context is derived server-side from the open session (the caller's * JWT + most recent ``/workspace/{id}/open`` call), so no workspace id is sent. */ declare function uploadLocalFile(auth: AuthHeaders, filePath: string, options?: UploadOptions): Promise; /** * Upload a flat list of local files via the direct-to-MinIO flow. * * This is the Node-side convenience wrapper around ``uploadDocumentsDirect`` * for CLI/TUI consumers that work with filesystem paths. It reads each file * fully into memory and delegates to the browser-safe helper for hashing, * encryption, and transport. * * Callers are responsible for supplying the raw 32-byte workspace key. In * the CLI this is unwrapped lazily from the stored signing key + workspace * ``wrapped_key``; see ``getRawWorkspaceKey`` in ``auth.ts``. */ declare function uploadLocalFilesDirect(arbi: ArbiClient, workspaceKey: Uint8Array, filePaths: string[], options?: UploadDirectOptions): Promise; /** * Options for the direct-upload directory/zip/archive helpers. Mirrors the * legacy ``UploadDirectoryOptions`` so CLI consumers can switch between the * two flows without rewiring their progress callbacks. ``configExtId`` is * forwarded to ``uploadDocumentsDirect`` for SKIP_DUPLICATES support. */ interface UploadDirectoryDirectOptions { onBatchStart?: (progress: UploadProgress) => void; onBatchComplete?: (progress: UploadProgress & { result: { doc_ext_ids?: string[]; skipped?: SkippedFile[]; }; }) => void; configExtId?: string; } /** * Walk a directory, group supported files by their relative subfolder (with * the directory basename as the root), and upload each group via the * direct-to-MinIO flow. */ declare function uploadLocalDirectoryDirect(arbi: ArbiClient, workspaceKey: Uint8Array, dirPath: string, options?: UploadDirectoryDirectOptions): Promise; /** * Extract a zip archive in memory, group supported entries by their internal * folder structure, and upload each group via the direct-to-MinIO flow. Uses * jszip via dynamic import so the dep is optional at load time. Mirrors the * single-root detection behavior of ``uploadZip``. */ declare function uploadLocalZipDirect(arbi: ArbiClient, workspaceKey: Uint8Array, zipPath: string, options?: UploadDirectoryDirectOptions): Promise; /** * Upload a 7z/rar archive via the direct-to-MinIO flow. Shells out to the * system ``7z`` binary to extract to a temporary directory, then delegates * to ``uploadLocalDirectoryDirect``. The temp directory is removed on exit. */ declare function uploadLocalArchiveDirect(arbi: ArbiClient, workspaceKey: Uint8Array, archivePath: string, options?: UploadDirectoryDirectOptions): Promise; /** * Upload all supported files from a directory, preserving folder structure. * Files are grouped by their relative folder path, then each group is split * into batches of UPLOAD_BATCH_SIZE to avoid overwhelming the backend. */ declare function uploadDirectory(auth: AuthHeaders, dirPath: string, options?: UploadDirectoryOptions): Promise; /** * Upload files from a zip archive, preserving internal folder structure. * Uses jszip via dynamic import so the dependency is optional at load time. * Files are uploaded in batches of UPLOAD_BATCH_SIZE per folder. */ declare function uploadZip(auth: AuthHeaders, zipPath: string, options?: UploadDirectoryOptions): Promise; /** * Terminal status for a single file after `uploadManifest` processes it. * * - `uploaded` — new document created on the backend * - `duplicate` — server reported it as a duplicate of an existing doc * - `rejected` — server refused (unsupported on server, too large, etc.) * or caller-side validation failed (file missing, wrong type, * oversized, read error) * - `error` — transport / unexpected failure, safe to retry * - `skipped` — caller-side skip without an attempt (unsupported extension, * already completed in a previous run, etc.) */ type FileStatus = 'uploaded' | 'duplicate' | 'rejected' | 'error' | 'skipped'; /** Per-file outcome emitted by `uploadManifest`. */ interface FileOutcome { /** The caller-supplied path (as passed into `uploadManifest`). */ path: string; /** The sanitized folder used for the backend `folder` query param. */ folder: string; /** File size at resolution time, in bytes. */ sizeBytes: number; /** Terminal status for this file. */ status: FileStatus; /** Backend doc ext id, populated on `uploaded` and `duplicate`. */ docId?: string; /** Free-form reason, populated on any non-`uploaded` status. */ reason?: string; /** 1-indexed upload attempt that produced this outcome. 0 for caller-side. */ attempt: number; /** Backend batch id, when known. */ batchId?: string | null; } interface UploadManifestProgress { done: number; total: number; bytesDone: number; bytesTotal: number; } interface UploadManifestOptions { /** * Root directory used to derive the `folder` query param for each file. * If omitted, the longest common parent directory of all inputs is used. */ rootDir?: string; /** Config ext id to pass with each batch (e.g. SKIP_DUPLICATES config). */ configExtId?: string; /** Max upload attempts for transient errors. Default 3. */ maxRetries?: number; /** * Called once for every input path with its terminal outcome, in input * order. Awaited, so callers can flush audit logs synchronously before * the next file is processed. */ onFile?: (outcome: FileOutcome) => void | Promise; /** Called after each batch completes (or aborts). */ onProgress?: (progress: UploadManifestProgress) => void; /** Stop processing further files on first `error` outcome. */ failFast?: boolean; /** Abort signal. Remaining files are emitted as `error` with reason `aborted`. */ signal?: AbortSignal; } interface UploadManifestSummary { total: number; uploaded: number; duplicate: number; rejected: number; error: number; skipped: number; } interface UploadManifestResult { outcomes: FileOutcome[]; summary: UploadManifestSummary; } /** * Upload an explicit list of file paths with a per-file audit trail. * * This is the eDiscovery-grade primitive: every caller-supplied path produces * exactly one `FileOutcome`, emitted via `onFile` in input order, so the * caller can stream the outcomes to a JSONL log / CSV / state file with no * ambiguity about which input got which doc id. * * Per-file mapping is recovered from the backend's lumped * `{doc_ext_ids[], skipped[]}` response as follows: * * 1. Files are grouped by their parent folder (relative to `rootDir` or * the longest common parent of all inputs). Within one filesystem * folder, basenames are guaranteed unique, which is what makes the * reconciliation below safe. * 2. Each folder is chunked into batches of UPLOAD_BATCH_SIZE. * 3. After each batch request: any basename in `skipped[]` maps back to * its input path by basename lookup; the remaining survivors are * matched positionally against `doc_ext_ids[]`. * * If the backend's response length disagrees with the survivor count, all * survivors are emitted as `error` so the caller can retry. */ declare function uploadManifest(auth: AuthHeaders, paths: string[], options?: UploadManifestOptions): Promise; /** * Recursively walk a directory and return all absolute paths of files whose * extension is in SUPPORTED_EXTENSIONS. Useful for turning a directory input * into a flat manifest before calling `uploadManifest`. */ declare function walkSupportedFiles(dirPath: string): string[]; /** * Upload files from a 7z/rar archive, preserving internal folder structure. * Uses the system `7z` command to extract to a temp directory, then delegates * to `uploadDirectory`. Requires p7zip / 7z to be installed on the system. * Supports: .7z, .rar (anything `7z x` can handle). */ declare function uploadArchive(auth: AuthHeaders, archivePath: string, options?: UploadDirectoryOptions): Promise; declare const documentsNode_ARCHIVE_EXTENSIONS: typeof ARCHIVE_EXTENSIONS; type documentsNode_FileOutcome = FileOutcome; type documentsNode_FileStatus = FileStatus; declare const documentsNode_SUPPORTED_EXTENSIONS: typeof SUPPORTED_EXTENSIONS; type documentsNode_UploadDirectoryDirectOptions = UploadDirectoryDirectOptions; type documentsNode_UploadDirectoryOptions = UploadDirectoryOptions; type documentsNode_UploadManifestOptions = UploadManifestOptions; type documentsNode_UploadManifestProgress = UploadManifestProgress; type documentsNode_UploadManifestResult = UploadManifestResult; type documentsNode_UploadManifestSummary = UploadManifestSummary; type documentsNode_UploadProgress = UploadProgress; declare const documentsNode_uploadArchive: typeof uploadArchive; declare const documentsNode_uploadDirectory: typeof uploadDirectory; declare const documentsNode_uploadLocalArchiveDirect: typeof uploadLocalArchiveDirect; declare const documentsNode_uploadLocalDirectoryDirect: typeof uploadLocalDirectoryDirect; declare const documentsNode_uploadLocalFile: typeof uploadLocalFile; declare const documentsNode_uploadLocalFilesDirect: typeof uploadLocalFilesDirect; declare const documentsNode_uploadLocalZipDirect: typeof uploadLocalZipDirect; declare const documentsNode_uploadManifest: typeof uploadManifest; declare const documentsNode_uploadZip: typeof uploadZip; declare const documentsNode_walkSupportedFiles: typeof walkSupportedFiles; declare namespace documentsNode { export { documentsNode_ARCHIVE_EXTENSIONS as ARCHIVE_EXTENSIONS, type documentsNode_FileOutcome as FileOutcome, type documentsNode_FileStatus as FileStatus, documentsNode_SUPPORTED_EXTENSIONS as SUPPORTED_EXTENSIONS, type documentsNode_UploadDirectoryDirectOptions as UploadDirectoryDirectOptions, type documentsNode_UploadDirectoryOptions as UploadDirectoryOptions, type documentsNode_UploadManifestOptions as UploadManifestOptions, type documentsNode_UploadManifestProgress as UploadManifestProgress, type documentsNode_UploadManifestResult as UploadManifestResult, type documentsNode_UploadManifestSummary as UploadManifestSummary, type documentsNode_UploadProgress as UploadProgress, documentsNode_uploadArchive as uploadArchive, documentsNode_uploadDirectory as uploadDirectory, documentsNode_uploadLocalArchiveDirect as uploadLocalArchiveDirect, documentsNode_uploadLocalDirectoryDirect as uploadLocalDirectoryDirect, documentsNode_uploadLocalFile as uploadLocalFile, documentsNode_uploadLocalFilesDirect as uploadLocalFilesDirect, documentsNode_uploadLocalZipDirect as uploadLocalZipDirect, documentsNode_uploadManifest as uploadManifest, documentsNode_uploadZip as uploadZip, documentsNode_walkSupportedFiles as walkSupportedFiles }; } /** * Agent operations — create, list, delete persistent agents, and read an agent's * pinned config / workspace memberships. An agent is a real `agt-` user the server * logs in on behalf of when a DM, email or scheduled task wakes it. */ type UserResponse = components['schemas']['UserResponse']; type CreateAgentResponse = components['schemas']['CreateAgentResponse']; type AgentWorkspaceResponse = components['schemas']['AgentWorkspaceResponse']; declare function listAgents(arbi: ArbiClient): Promise; /** * Create a persistent agent. Only `name` is accepted (alphanumeric, `_`/`-`). * The keypair is server-generated; `signing_private_key` is returned ONCE. * Pin a behaviour by saving a config with this agent's `agent_ext_id`. */ declare function createAgent(arbi: ArbiClient, name: string): Promise; /** Read an agent's pinned configuration (its `settings.last_config`). */ declare function getAgentConfig(arbi: ArbiClient, 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; }; }>; /** List the workspaces an agent is a member of. */ declare function listAgentWorkspaces(arbi: ArbiClient, agentExtId: string): Promise; declare function deleteAgents(arbi: ArbiClient, agentExtIds: string[]): Promise<{ [x: string]: unknown; }>; declare const agents_createAgent: typeof createAgent; declare const agents_deleteAgents: typeof deleteAgents; declare const agents_getAgentConfig: typeof getAgentConfig; declare const agents_listAgentWorkspaces: typeof listAgentWorkspaces; declare const agents_listAgents: typeof listAgents; declare namespace agents { export { agents_createAgent as createAgent, agents_deleteAgents as deleteAgents, agents_getAgentConfig as getAgentConfig, agents_listAgentWorkspaces as listAgentWorkspaces, agents_listAgents as listAgents }; } /** * Session operations — list active sessions. */ type SessionInfoResponse = components['schemas']['SessionInfoResponse']; /** * List all active sessions for the current user. * Agents see only their own session. */ declare function listSessions(arbi: ArbiClient): Promise; declare const sessions_listSessions: typeof listSessions; declare namespace sessions { export { sessions_listSessions as listSessions }; } /** * User profile operations — the current user's display identity. */ type UpdateProfileRequest = components['schemas']['UpdateProfileRequest']; /** * Update the signed-in user's profile. Fields are optional — pass only what * changes (e.g. `given_name`, `family_name`, `picture`). */ declare function updateProfile(arbi: ArbiClient, body: UpdateProfileRequest): Promise<{ given_name: string; family_name?: string | null | undefined; email: string; picture?: string | null | undefined; }>; type profile_UpdateProfileRequest = UpdateProfileRequest; declare const profile_updateProfile: typeof updateProfile; declare namespace profile { export { type profile_UpdateProfileRequest as UpdateProfileRequest, profile_updateProfile as updateProfile }; } /** * Orchestrator interface for `arbi listen`. * * An orchestrator is an external agent that receives prompts and returns responses. * ARBI acts as the transport layer (encrypted DMs); the orchestrator does the thinking. */ interface Orchestrator { /** Human-readable name (e.g. "claude", "openclaw") */ readonly name: string; /** * Send a prompt to the orchestrator and collect the response. * * @param prompt - The decrypted DM content to process * @param context - Optional metadata about the message * @returns The orchestrator's text response */ prompt(prompt: string, context?: PromptContext): Promise; /** Clean up resources (kill child processes, close connections, etc.) */ close?(): Promise; } interface PromptContext { /** Sender's external_id */ senderExtId?: string; /** Sender's email */ senderEmail?: string; /** Workspace context (if any) */ workspaceId?: string; } /** * Claude Code integration. * * Spawns `claude -p --output-format text` as a child process for each prompt. * The prompt is passed as a CLI argument (not stdin). * * Conversation continuity: first prompt uses --session-id to create a session, * subsequent prompts use --resume to continue it. The session ID is derived * from the agent's ext_id so it's stable across restarts. * * The ARBI SKILL.md is injected via --append-system-prompt so Claude knows * which CLI commands are available. */ interface ClaudeOrchestratorOptions { /** Path to the claude CLI binary (defaults to "claude") */ binaryPath?: string; /** ARBI session identifier — used to maintain Claude conversation continuity */ sessionId: string; /** Additional CLI flags (e.g. ["--model", "opus"]) */ extraArgs?: string[]; /** Timeout in ms per prompt (defaults to 300_000 = 5 min) */ timeoutMs?: number; /** Override SKILL.md content (defaults to loading from arbi-cli package) */ skillPrompt?: string; } declare class ClaudeOrchestrator implements Orchestrator { readonly name = "claude"; private readonly binaryPath; private readonly extraArgs; private readonly timeoutMs; private readonly claudeSessionId; private readonly skillPrompt; private sessionStarted; constructor(options: ClaudeOrchestratorOptions); prompt(prompt: string): Promise; private spawnClaude; close(): Promise; } /** * OpenClaw integration. * * Spawns `openclaw agent --agent --message --json` as a child * process for each prompt. The gateway handles routing, model selection, and * session memory. * * Session isolation: uses `--session-id` to keep conversations separate per * ARBI user. The OpenClaw agent id (e.g. "arbi") is created once during * `arbi connect --agent openclaw` via `openclaw agents add`. * * The ARBI SKILL.md is installed as BOOTSTRAP.md in the agent's workspace * during setup, so the agent always has context about arbi commands. */ interface OpenClawOrchestratorOptions { /** Path to the openclaw CLI binary (defaults to "openclaw") */ binaryPath?: string; /** ARBI session identifier — used for OpenClaw session isolation */ sessionId: string; /** OpenClaw agent id (defaults to "arbi") */ agentId?: string; /** Timeout in ms per prompt (defaults to 300_000 = 5 min) */ timeoutMs?: number; /** * Override the HOME env for the spawned openclaw subprocess. Set this in * multi-tenant deployments where ``arbi listen`` runs with a per-agent * HOME (for its own .arbi config) but openclaw should still resolve its * gateway config from the shared real ``/home/`` — symlinks back * to the global ``.openclaw`` are rejected by openclaw's exec sandbox, * so a direct env override is the right escape hatch. */ spawnHome?: string; } declare class OpenClawOrchestrator implements Orchestrator { readonly name = "openclaw"; private readonly binaryPath; private readonly agentId; private readonly sessionKey; private readonly timeoutMs; private readonly spawnHome?; constructor(options: OpenClawOrchestratorOptions); prompt(prompt: string): Promise; close(): Promise; private spawnOpenClaw; } /** * DM Listener Loop. * * Connects to the WebSocket, listens for incoming DMs, decrypts them, * routes to an orchestrator, encrypts the reply, and sends it back. * * Only processes messages from the agent's parent user (owner). */ interface DmListenerOptions { /** Authenticated ArbiClient instance. The WebSocket token and re-login are * both derived from this — it must already hold a valid session. */ arbi: ArbiClient; /** Base URL of the ARBI server */ baseUrl: string; /** DM crypto context for encrypt/decrypt */ crypto: DmCryptoContext; /** Orchestrator to route prompts to */ orchestrator: Orchestrator; /** Parent user ext_id — only process messages from this sender */ parentExtId: string; /** Called when a log-worthy event happens (verbose output) */ onLog?: (message: string) => void; /** Called when an error occurs during processing */ onError?: (message: string, error?: unknown) => void; } interface DmListener { /** Stop listening and clean up */ close(): void; } /** * Start listening for DMs and routing them to the orchestrator. * * Connects via WebSocket with auto-reconnect. For each incoming DM: * 1. Filters to parent user only * 2. Decrypts the message * 3. Sends plaintext to orchestrator.prompt() * 4. Encrypts the response * 5. Sends encrypted reply via DM */ declare function startDmListener(options: DmListenerOptions): Promise; /** * Listen module — integration interface, implementations, and DM listener loop. */ type index_ClaudeOrchestrator = ClaudeOrchestrator; declare const index_ClaudeOrchestrator: typeof ClaudeOrchestrator; type index_ClaudeOrchestratorOptions = ClaudeOrchestratorOptions; type index_DmListener = DmListener; type index_DmListenerOptions = DmListenerOptions; type index_OpenClawOrchestrator = OpenClawOrchestrator; declare const index_OpenClawOrchestrator: typeof OpenClawOrchestrator; type index_OpenClawOrchestratorOptions = OpenClawOrchestratorOptions; type index_Orchestrator = Orchestrator; type index_PromptContext = PromptContext; declare const index_startDmListener: typeof startDmListener; declare namespace index { export { index_ClaudeOrchestrator as ClaudeOrchestrator, type index_ClaudeOrchestratorOptions as ClaudeOrchestratorOptions, type index_DmListener as DmListener, type index_DmListenerOptions as DmListenerOptions, index_OpenClawOrchestrator as OpenClawOrchestrator, type index_OpenClawOrchestratorOptions as OpenClawOrchestratorOptions, type index_Orchestrator as Orchestrator, type index_PromptContext as PromptContext, index_startDmListener as startDmListener }; } export { AuthHeaders, ChatSession, ClaudeOrchestrator, type ClaudeOrchestratorOptions, CliConfig, CliCredentials, ConfigStore, DmCryptoContext, type DmListener, type DmListenerOptions, FileConfigStore, OpenClawOrchestrator, type OpenClawOrchestratorOptions, type Orchestrator, type PromptContext, agents, deviceFlow, documentsNode, index as listen, profile, sessions, startDmListener };