@arbidocs/sdk 0.3.11 → 0.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3230 @@
1
+ import * as _arbidocs_client from '@arbidocs/client';
2
+ import { ArbiClient, LoginResult, components, WebSocketServerMessage, WsTaskUpdateMessage } from '@arbidocs/client';
3
+
4
+ /**
5
+ * Core error types and throwing error utilities.
6
+ *
7
+ * Unlike CLI helpers which call process.exit(1), these throw typed errors
8
+ * that consumers (CLI, TUI) can catch and handle in their own way.
9
+ */
10
+ declare class ArbiError extends Error {
11
+ constructor(message: string);
12
+ }
13
+ declare class ArbiApiError extends ArbiError {
14
+ readonly apiError?: unknown;
15
+ constructor(message: string, apiError?: unknown);
16
+ }
17
+ /**
18
+ * Check API response and throw on error. Returns narrowed non-null data.
19
+ */
20
+ declare function requireData<T>(result: {
21
+ data?: T;
22
+ error?: unknown;
23
+ }, message: string): T;
24
+ /**
25
+ * Check API response for delete/void operations (no data expected).
26
+ */
27
+ declare function requireOk(result: {
28
+ error?: unknown;
29
+ }, message: string): void;
30
+ /**
31
+ * Extract a human-readable message from an unknown error value.
32
+ * Centralises the `err instanceof Error ? err.message : String(err)` pattern.
33
+ *
34
+ * Unwraps `.cause` chains to surface the root error — critical for Node.js
35
+ * fetch errors where TypeError("fetch failed") wraps the real cause
36
+ * (ECONNREFUSED, UNABLE_TO_VERIFY_LEAF_SIGNATURE, etc.).
37
+ */
38
+ declare function getErrorMessage(err: unknown): string;
39
+ /**
40
+ * Extract the Node.js error code (e.g. 'ECONNREFUSED', 'ENOTFOUND') from an
41
+ * error or its cause chain. Returns undefined if no code is found.
42
+ */
43
+ declare function getErrorCode(err: unknown): string | undefined;
44
+
45
+ /**
46
+ * Authenticated fetch utility — eliminates repeated raw-fetch boilerplate
47
+ * in operations that can't use the typed SDK client (streaming, multipart, etc.).
48
+ */
49
+ interface AuthHeaders {
50
+ baseUrl: string;
51
+ accessToken: string;
52
+ workspaceKeyHeader: string;
53
+ }
54
+ interface AuthFetchOptions extends AuthHeaders {
55
+ /** URL path relative to baseUrl (e.g. '/v1/document/upload'). */
56
+ path: string;
57
+ method?: string;
58
+ body?: string | FormData | ArrayBuffer | ReadableStream | Blob | null;
59
+ /** Extra headers to merge in. */
60
+ headers?: Record<string, string>;
61
+ }
62
+ /**
63
+ * Make an authenticated fetch request with standard error handling.
64
+ * Automatically sets Authorization + workspace-key headers.
65
+ * Throws on non-ok responses with a human-readable message including server error details.
66
+ */
67
+ declare function authenticatedFetch(options: AuthFetchOptions): Promise<Response>;
68
+
69
+ /**
70
+ * Configuration types — shared between browser and Node.js environments.
71
+ *
72
+ * This file has NO Node.js dependencies and is safe for browser bundling.
73
+ */
74
+ interface CliConfig {
75
+ baseUrl: string;
76
+ deploymentDomain: string;
77
+ selectedWorkspaceId?: string;
78
+ autoUpdate?: boolean;
79
+ notifications?: boolean;
80
+ verbose?: boolean;
81
+ watch?: boolean;
82
+ }
83
+ interface CliCredentials {
84
+ email: string;
85
+ signingPrivateKeyBase64: string;
86
+ serverSessionKeyBase64: string;
87
+ /** Cached workspace-scoped JWT from last successful resolveWorkspace() */
88
+ accessToken?: string;
89
+ /** Cached workspace key header from last successful resolveWorkspace() */
90
+ workspaceKeyHeader?: string;
91
+ /** Workspace ID the cached token was issued for */
92
+ workspaceId?: string;
93
+ /** ISO timestamp when the token was cached */
94
+ tokenTimestamp?: string;
95
+ }
96
+ interface ChatSession {
97
+ /** Last assistant message ID — used as previous_response_id for follow-ups */
98
+ lastMessageExtId: string | null;
99
+ /** Conversation external ID — used to restore chat history on restart */
100
+ conversationExtId: string | null;
101
+ /** Workspace ID where the conversation started — used to detect workspace changes */
102
+ workspaceId: string | null;
103
+ }
104
+ interface ConfigStore {
105
+ getConfig(): CliConfig | null;
106
+ saveConfig(config: CliConfig): void;
107
+ updateConfig(updates: Partial<CliConfig>): void;
108
+ requireConfig(): CliConfig;
109
+ getCredentials(): CliCredentials | null;
110
+ saveCredentials(creds: CliCredentials): void;
111
+ deleteCredentials(): void;
112
+ requireCredentials(): CliCredentials;
113
+ getChatSession(): ChatSession;
114
+ saveChatSession(session: ChatSession): void;
115
+ updateChatSession(updates: Partial<ChatSession>): void;
116
+ clearChatSession(): void;
117
+ }
118
+
119
+ /**
120
+ * Parameterized authentication functions.
121
+ *
122
+ * Unlike CLI's client.ts, these take explicit params instead of reading from disk.
123
+ * This allows both CLI and TUI to use them with their own config sources.
124
+ */
125
+
126
+ interface AuthenticatedClient {
127
+ arbi: ArbiClient;
128
+ loginResult: LoginResult;
129
+ }
130
+ interface AuthContext {
131
+ arbi: ArbiClient;
132
+ loginResult: LoginResult;
133
+ config: CliConfig;
134
+ }
135
+ interface WorkspaceContext extends AuthContext {
136
+ workspaceId: string;
137
+ accessToken: string;
138
+ workspaceKeyHeader: string;
139
+ }
140
+ /** Minimal workspace shape required by formatWorkspaceChoices. */
141
+ interface WorkspaceForChoice {
142
+ name: string;
143
+ external_id: string;
144
+ shared_document_count: number;
145
+ private_document_count: number;
146
+ }
147
+ /**
148
+ * Format a list of workspaces into prompt-friendly choices.
149
+ * Returns `{ name, value, description }` objects suitable for @inquirer/prompts
150
+ * or any similar select component.
151
+ */
152
+ declare function formatWorkspaceChoices(wsList: WorkspaceForChoice[]): Array<{
153
+ name: string;
154
+ value: string;
155
+ description: string;
156
+ }>;
157
+ /**
158
+ * Create an SDK client, init sodium, and log in with stored signing key.
159
+ * Returns the client + login result (which includes serverSessionKey).
160
+ */
161
+ declare function createAuthenticatedClient(config: CliConfig, creds: CliCredentials, store: ConfigStore): Promise<AuthenticatedClient>;
162
+ /**
163
+ * Interactive (password-based) login flow.
164
+ *
165
+ * Creates an SDK client, initializes sodium, authenticates with email/password,
166
+ * and persists the derived credentials to the config store.
167
+ *
168
+ * Use this for CLI/TUI login commands. For session recovery from stored keys,
169
+ * use createAuthenticatedClient() instead.
170
+ */
171
+ declare function performPasswordLogin(config: CliConfig, email: string, password: string, store: ConfigStore): Promise<AuthContext>;
172
+ /**
173
+ * Decrypt wrapped workspace key and set it as the active workspace header.
174
+ */
175
+ declare function selectWorkspace(arbi: ArbiClient, workspaceId: string, wrappedKey: string, serverSessionKey: Uint8Array, signingPrivateKeyBase64: string): Promise<void>;
176
+ /**
177
+ * Generate an encrypted workspace key for the given workspace.
178
+ * Used for operations that need a key for a workspace other than the current one
179
+ * (e.g., copy documents to a target workspace).
180
+ */
181
+ declare function generateEncryptedWorkspaceKey(arbi: ArbiClient, wrappedKey: string, serverSessionKey: Uint8Array, signingPrivateKeyBase64: string): Promise<string>;
182
+ /**
183
+ * Find a workspace by ID in the user's workspace list, select it, and return workspace info.
184
+ */
185
+ declare function selectWorkspaceById(arbi: ArbiClient, workspaceId: string, serverSessionKey: Uint8Array, signingPrivateKeyBase64: string): Promise<{
186
+ external_id: string;
187
+ name: string;
188
+ wrapped_key: string;
189
+ }>;
190
+ /**
191
+ * Authenticate and return the SDK client + config.
192
+ * Throws ArbiError instead of calling process.exit.
193
+ */
194
+ declare function resolveAuth(store: ConfigStore): Promise<AuthContext>;
195
+ /**
196
+ * Authenticate, resolve workspace, and set up headers.
197
+ * Uses cached JWT when available for the same workspace and not expired.
198
+ * Throws ArbiError instead of calling process.exit.
199
+ */
200
+ declare function resolveWorkspace(store: ConfigStore, workspaceOpt?: string): Promise<WorkspaceContext>;
201
+
202
+ /**
203
+ * SSE event types — re-exported from the auto-generated OpenAPI schema.
204
+ *
205
+ * Consumers should import these from '@arbidocs/sdk' (or '/browser')
206
+ * rather than reaching into '@arbidocs/client' directly.
207
+ */
208
+
209
+ type ResponseCreatedEvent = components['schemas']['ResponseCreatedEvent'];
210
+ type ResponseCompletedEvent = components['schemas']['ResponseCompletedEvent'];
211
+ type ResponseFailedEvent = components['schemas']['ResponseFailedEvent'];
212
+ type ResponseOutputTextDeltaEvent = components['schemas']['ResponseOutputTextDeltaEvent'];
213
+ type ResponseOutputTextDoneEvent = components['schemas']['ResponseOutputTextDoneEvent'];
214
+ type ResponseOutputItemAddedEvent = components['schemas']['ResponseOutputItemAddedEvent'];
215
+ type ResponseOutputItemDoneEvent = components['schemas']['ResponseOutputItemDoneEvent'];
216
+ type ResponseContentPartAddedEvent = components['schemas']['ResponseContentPartAddedEvent'];
217
+ type AgentStepEvent = components['schemas']['AgentStepEvent'];
218
+ type UserInputRequestEvent = components['schemas']['UserInputRequestEvent'];
219
+ type ArtifactEvent = components['schemas']['ArtifactEvent'];
220
+ type UserMessageEvent = components['schemas']['UserMessageEvent'];
221
+ type MessageMetadataPayload = components['schemas']['MessageMetadataPayload'];
222
+ type ResponseUsage = components['schemas']['ResponseUsage'];
223
+ type OutputTokensDetails = components['schemas']['OutputTokensDetails'];
224
+ type TokenBudgetContext = components['schemas']['TokenBudgetContext'];
225
+ /** Convenience type — what onStreamStart callbacks receive. */
226
+ type SSEStreamStartData = {
227
+ assistant_message_ext_id: string;
228
+ };
229
+
230
+ /**
231
+ * Server-Sent Events (SSE) parsing utilities.
232
+ *
233
+ * Extracted from CLI ask.ts for shared use by CLI and TUI.
234
+ */
235
+
236
+ interface SSEEvent {
237
+ event: string;
238
+ data: string;
239
+ }
240
+ declare const TOOL_LABELS: Record<string, string>;
241
+ declare const LIFECYCLE_LABELS: Record<string, string>;
242
+ /**
243
+ * Format an AgentStepEvent into a human-readable label.
244
+ *
245
+ * Priority:
246
+ * 1. `focus` — the agent's descriptive sentence about what it's doing
247
+ * 2. For `tool_progress` — tool-specific label + optional message
248
+ * 3. Lifecycle label (planning, evaluation, etc.)
249
+ * 4. Tool name from detail
250
+ * 5. Fallback to step name or empty string
251
+ */
252
+ declare function formatAgentStepLabel(step: AgentStepEvent): string;
253
+ /**
254
+ * Parse SSE events from a chunk of text, combining with a buffer
255
+ * of incomplete data from previous chunks.
256
+ *
257
+ * Returns parsed events and any remaining incomplete data.
258
+ */
259
+ declare function parseSSEEvents(chunk: string, buffer: string): {
260
+ events: SSEEvent[];
261
+ remaining: string;
262
+ };
263
+ /**
264
+ * Callbacks for streaming SSE events. All callbacks are optional —
265
+ * omitted callbacks simply ignore that event type.
266
+ */
267
+ interface SSEStreamCallbacks {
268
+ onStreamStart?: (data: SSEStreamStartData) => void;
269
+ onToken?: (content: string) => void;
270
+ onTextDone?: (text: string) => void;
271
+ onOutputItemAdded?: (data: ResponseOutputItemAddedEvent) => void;
272
+ onOutputItemDone?: (data: ResponseOutputItemDoneEvent) => void;
273
+ onContentPartAdded?: (data: ResponseContentPartAddedEvent) => void;
274
+ onAgentStep?: (data: AgentStepEvent) => void;
275
+ onError?: (message: string) => void;
276
+ onUserMessage?: (data: UserMessageEvent) => void;
277
+ onMetadata?: (data: MessageMetadataPayload) => void;
278
+ onUserInputRequest?: (data: UserInputRequestEvent) => void;
279
+ onArtifact?: (data: ArtifactEvent) => void;
280
+ onElapsedTime?: (t: number) => void;
281
+ onUsage?: (usage: ResponseUsage) => void;
282
+ onComplete?: () => void;
283
+ }
284
+ /**
285
+ * Result returned after the SSE stream is fully consumed.
286
+ */
287
+ interface SSEStreamResult {
288
+ text: string;
289
+ assistantMessageExtId: string | null;
290
+ agentSteps: string[];
291
+ /** Total number of tool calls across all agent steps. */
292
+ toolCallCount: number;
293
+ errors: string[];
294
+ userMessage: UserMessageEvent | null;
295
+ metadata: MessageMetadataPayload | null;
296
+ artifacts: ArtifactEvent[];
297
+ usage: ResponseUsage | null;
298
+ /** Token budget context snapshot from response.completed. */
299
+ context: TokenBudgetContext | null;
300
+ }
301
+ /**
302
+ * Stream SSE events from a Response, invoking callbacks as events arrive.
303
+ *
304
+ * This is the primary streaming function — use it when you need real-time
305
+ * event handling (CLI streaming to stdout, TUI rendering, etc.).
306
+ *
307
+ * Also accumulates the full response and returns it, so callers can use
308
+ * both the streaming callbacks and the final result.
309
+ */
310
+ declare function streamSSE(response: Response, callbacks?: SSEStreamCallbacks): Promise<SSEStreamResult>;
311
+ /**
312
+ * Consume an entire SSE stream without streaming callbacks.
313
+ * Convenience alias for `streamSSE(response)`.
314
+ */
315
+ declare const consumeSSEStream: typeof streamSSE;
316
+
317
+ /**
318
+ * WebSocket connection manager.
319
+ *
320
+ * Uses Node.js native WebSocket (available in Node 22+).
321
+ * Authenticates via SDK helpers, routes typed messages to the consumer.
322
+ */
323
+
324
+ interface WsConnection {
325
+ close: () => void;
326
+ }
327
+ interface ConnectOptions {
328
+ baseUrl: string;
329
+ accessToken: string;
330
+ onMessage: (msg: WebSocketServerMessage) => void;
331
+ onClose?: (code: number, reason: string) => void;
332
+ }
333
+ interface ReconnectOptions extends ConnectOptions {
334
+ maxRetries?: number;
335
+ initialDelayMs?: number;
336
+ onReconnecting?: (attempt: number, maxRetries: number) => void;
337
+ onReconnected?: () => void;
338
+ onReconnectFailed?: () => void;
339
+ }
340
+ interface ReconnectableWsConnection {
341
+ close: () => void;
342
+ }
343
+ /**
344
+ * Open a WebSocket, authenticate, and start routing messages.
345
+ *
346
+ * Resolves after a successful `auth_result`, rejects on auth failure or timeout.
347
+ * Subsequent messages are dispatched to `onMessage`.
348
+ */
349
+ declare function connectWebSocket(options: ConnectOptions): Promise<WsConnection>;
350
+ /**
351
+ * Connect WebSocket with automatic reconnection on disconnect.
352
+ *
353
+ * Initial connection throws on failure (same as connectWebSocket).
354
+ * After successful auth, disconnects trigger exponential backoff reconnection.
355
+ * Call close() on the returned handle to stop reconnection attempts.
356
+ */
357
+ declare function connectWithReconnect(options: ReconnectOptions): Promise<ReconnectableWsConnection>;
358
+ interface DocumentWaiterOptions {
359
+ /** Base URL of the ARBI server (e.g. "https://app.arbi.city"). */
360
+ baseUrl: string;
361
+ /** JWT access token for WebSocket authentication. */
362
+ accessToken: string;
363
+ /** Optional callback invoked for every task_update on tracked documents. */
364
+ onStatus?: (msg: WsTaskUpdateMessage) => void;
365
+ }
366
+ interface DocumentWaiter {
367
+ /** Register document IDs to track. Can be called multiple times. */
368
+ addDocIds(ids: string[]): void;
369
+ /** Block until all tracked documents reach terminal status. */
370
+ waitUntilDone(timeoutMs?: number): Promise<Map<string, string>>;
371
+ /** Close the WebSocket without waiting. */
372
+ close(): void;
373
+ }
374
+ /**
375
+ * Open a WebSocket and start collecting document status events.
376
+ *
377
+ * Call this BEFORE uploading so no events are missed. Then call `addDocIds()`
378
+ * once you know the IDs, and `waitUntilDone()` to block until all reach a
379
+ * terminal status (completed, failed, or skipped).
380
+ *
381
+ * Mirrors the backend SDK's `ArbiWebSocket.wait_for_docs()` pattern.
382
+ *
383
+ * @example
384
+ * ```ts
385
+ * const waiter = createDocumentWaiter({ baseUrl, accessToken })
386
+ * const result = await uploadDocuments(...)
387
+ * waiter.addDocIds(result.doc_ext_ids)
388
+ * const statuses = await waiter.waitUntilDone(120_000)
389
+ * ```
390
+ */
391
+ declare function createDocumentWaiter(options: DocumentWaiterOptions): DocumentWaiter;
392
+ type MessageLevel = 'info' | 'success' | 'error' | 'warning';
393
+ interface FormattedWsMessage {
394
+ text: string;
395
+ level: MessageLevel;
396
+ }
397
+ /**
398
+ * Format a WebSocket message into display text + severity level.
399
+ * Shared by TUI (toasts) and CLI (stderr lines) — single source of truth.
400
+ */
401
+ declare function formatWsMessage(msg: WebSocketServerMessage): FormattedWsMessage;
402
+
403
+ /**
404
+ * Shared formatting utilities.
405
+ */
406
+ /**
407
+ * Converts file size in bytes to human-readable format.
408
+ *
409
+ * @param bytes File size in bytes
410
+ * @param fallback String to return for null/undefined values (default: 'N/A')
411
+ * @returns Formatted string (e.g., "1.5 MB", "250 KB")
412
+ */
413
+ declare function formatFileSize(bytes: number | null | undefined, fallback?: string): string;
414
+ /** Minimal user shape used for display formatting. */
415
+ type UserInfo = {
416
+ external_id?: string;
417
+ email?: string;
418
+ given_name?: string;
419
+ family_name?: string;
420
+ };
421
+ /**
422
+ * Format a user's display name from given_name + family_name.
423
+ * Returns empty string if no name parts are available.
424
+ */
425
+ declare function formatUserName(user: UserInfo | null | undefined): string;
426
+
427
+ /**
428
+ * Document operations — browser-safe functions.
429
+ *
430
+ * For Node.js file system operations (uploadLocalFile, uploadDirectory, uploadZip),
431
+ * import from './documents-node.js' instead.
432
+ */
433
+
434
+ type DocUpdateRequest$1 = components['schemas']['DocUpdateRequest'];
435
+ /** File extensions supported for document upload. */
436
+ declare const SUPPORTED_EXTENSIONS: Set<string>;
437
+ /**
438
+ * Sanitize a folder path to only contain characters allowed by the backend
439
+ * pattern `^[a-zA-Z0-9_\-\/]*$`. Replaces disallowed characters with `_` and
440
+ * collapses consecutive underscores.
441
+ */
442
+ declare function sanitizeFolderPath(folderPath: string): string;
443
+ interface UploadOptions {
444
+ folder?: string;
445
+ }
446
+ interface UploadResult {
447
+ doc_ext_ids: string[];
448
+ duplicates?: string[];
449
+ }
450
+ interface UploadBatchResult {
451
+ doc_ext_ids: string[];
452
+ duplicates: string[];
453
+ folders: Map<string, {
454
+ fileCount: number;
455
+ doc_ext_ids: string[];
456
+ duplicates: string[];
457
+ }>;
458
+ }
459
+ declare function listDocuments(arbi: ArbiClient): Promise<{
460
+ external_id: string;
461
+ workspace_ext_id: string;
462
+ file_name?: string | null | undefined;
463
+ status?: string | null | undefined;
464
+ n_pages?: number | null | undefined;
465
+ n_chunks?: number | null | undefined;
466
+ tokens?: number | null | undefined;
467
+ file_type?: string | null | undefined;
468
+ file_size?: number | null | undefined;
469
+ storage_type?: string | null | undefined;
470
+ storage_uri?: string | null | undefined;
471
+ content_hash?: string | null | undefined;
472
+ shared?: boolean | null | undefined;
473
+ re_ocred?: boolean | null | undefined;
474
+ config_ext_id?: string | null | undefined;
475
+ parent_ext_id?: string | null | undefined;
476
+ created_by_ext_id: string;
477
+ updated_by_ext_id?: string | null | undefined;
478
+ created_at: string;
479
+ updated_at: string;
480
+ wp_type?: string | null | undefined;
481
+ folder?: string | null | undefined;
482
+ doctags: {
483
+ doc_ext_id: string;
484
+ tag_ext_id: string;
485
+ note?: string | null | undefined;
486
+ citations?: {
487
+ [x: string]: {
488
+ chunk_ids: string[];
489
+ scores: number[];
490
+ statement: string;
491
+ offset_start: number;
492
+ offset_end: number;
493
+ };
494
+ } | null | undefined;
495
+ created_by_ext_id: string;
496
+ updated_by_ext_id?: string | null | undefined;
497
+ created_at: string;
498
+ updated_at: string;
499
+ }[];
500
+ doc_metadata?: {
501
+ doc_nature?: string | null | undefined;
502
+ doc_author?: string | null | undefined;
503
+ doc_subject?: string | null | undefined;
504
+ doc_date?: string | null | undefined;
505
+ title?: string | null | undefined;
506
+ } | null | undefined;
507
+ }[]>;
508
+ declare function getDocuments(arbi: ArbiClient, externalIds: string[]): Promise<{
509
+ external_id: string;
510
+ workspace_ext_id: string;
511
+ file_name?: string | null | undefined;
512
+ status?: string | null | undefined;
513
+ n_pages?: number | null | undefined;
514
+ n_chunks?: number | null | undefined;
515
+ tokens?: number | null | undefined;
516
+ file_type?: string | null | undefined;
517
+ file_size?: number | null | undefined;
518
+ storage_type?: string | null | undefined;
519
+ storage_uri?: string | null | undefined;
520
+ content_hash?: string | null | undefined;
521
+ shared?: boolean | null | undefined;
522
+ re_ocred?: boolean | null | undefined;
523
+ config_ext_id?: string | null | undefined;
524
+ parent_ext_id?: string | null | undefined;
525
+ created_by_ext_id: string;
526
+ updated_by_ext_id?: string | null | undefined;
527
+ created_at: string;
528
+ updated_at: string;
529
+ wp_type?: string | null | undefined;
530
+ folder?: string | null | undefined;
531
+ doctags: {
532
+ doc_ext_id: string;
533
+ tag_ext_id: string;
534
+ note?: string | null | undefined;
535
+ citations?: {
536
+ [x: string]: {
537
+ chunk_ids: string[];
538
+ scores: number[];
539
+ statement: string;
540
+ offset_start: number;
541
+ offset_end: number;
542
+ };
543
+ } | null | undefined;
544
+ created_by_ext_id: string;
545
+ updated_by_ext_id?: string | null | undefined;
546
+ created_at: string;
547
+ updated_at: string;
548
+ }[];
549
+ doc_metadata?: {
550
+ doc_nature?: string | null | undefined;
551
+ doc_author?: string | null | undefined;
552
+ doc_subject?: string | null | undefined;
553
+ doc_date?: string | null | undefined;
554
+ title?: string | null | undefined;
555
+ } | null | undefined;
556
+ }[]>;
557
+ declare function deleteDocuments(arbi: ArbiClient, externalIds: string[]): Promise<void>;
558
+ declare function updateDocuments(arbi: ArbiClient, documents: DocUpdateRequest$1[]): Promise<{
559
+ external_id: string;
560
+ workspace_ext_id: string;
561
+ file_name?: string | null | undefined;
562
+ status?: string | null | undefined;
563
+ n_pages?: number | null | undefined;
564
+ n_chunks?: number | null | undefined;
565
+ tokens?: number | null | undefined;
566
+ file_type?: string | null | undefined;
567
+ file_size?: number | null | undefined;
568
+ storage_type?: string | null | undefined;
569
+ storage_uri?: string | null | undefined;
570
+ content_hash?: string | null | undefined;
571
+ shared?: boolean | null | undefined;
572
+ re_ocred?: boolean | null | undefined;
573
+ config_ext_id?: string | null | undefined;
574
+ parent_ext_id?: string | null | undefined;
575
+ created_by_ext_id: string;
576
+ updated_by_ext_id?: string | null | undefined;
577
+ created_at: string;
578
+ updated_at: string;
579
+ wp_type?: string | null | undefined;
580
+ folder?: string | null | undefined;
581
+ doctags: {
582
+ doc_ext_id: string;
583
+ tag_ext_id: string;
584
+ note?: string | null | undefined;
585
+ citations?: {
586
+ [x: string]: {
587
+ chunk_ids: string[];
588
+ scores: number[];
589
+ statement: string;
590
+ offset_start: number;
591
+ offset_end: number;
592
+ };
593
+ } | null | undefined;
594
+ created_by_ext_id: string;
595
+ updated_by_ext_id?: string | null | undefined;
596
+ created_at: string;
597
+ updated_at: string;
598
+ }[];
599
+ doc_metadata?: {
600
+ doc_nature?: string | null | undefined;
601
+ doc_author?: string | null | undefined;
602
+ doc_subject?: string | null | undefined;
603
+ doc_date?: string | null | undefined;
604
+ title?: string | null | undefined;
605
+ } | null | undefined;
606
+ }[]>;
607
+ declare function uploadUrl(arbi: ArbiClient, urls: string[], workspaceId: string, shared?: boolean): Promise<{
608
+ doc_ext_ids: string[];
609
+ duplicates?: string[] | undefined;
610
+ }>;
611
+ /**
612
+ * Get parsed document content.
613
+ */
614
+ declare function getParsedContent(auth: AuthHeaders, docId: string, stage: string): Promise<Record<string, unknown>>;
615
+ /**
616
+ * Upload a file to a workspace. Uses raw fetch for multipart upload.
617
+ */
618
+ declare function uploadFile$1(auth: AuthHeaders, workspaceId: string, fileData: Blob, fileName: string, options?: UploadOptions): Promise<UploadResult>;
619
+ /**
620
+ * Upload multiple files in a single FormData request with an optional folder parameter.
621
+ */
622
+ declare function uploadFiles(auth: AuthHeaders, workspaceId: string, files: Array<{
623
+ data: Blob;
624
+ name: string;
625
+ }>, options?: UploadOptions): Promise<UploadResult>;
626
+ /**
627
+ * Download a document. Returns the response for the caller to handle.
628
+ */
629
+ declare function downloadDocument(auth: AuthHeaders, docId: string): Promise<Response>;
630
+
631
+ declare const documents_SUPPORTED_EXTENSIONS: typeof SUPPORTED_EXTENSIONS;
632
+ type documents_UploadBatchResult = UploadBatchResult;
633
+ type documents_UploadOptions = UploadOptions;
634
+ type documents_UploadResult = UploadResult;
635
+ declare const documents_deleteDocuments: typeof deleteDocuments;
636
+ declare const documents_downloadDocument: typeof downloadDocument;
637
+ declare const documents_getDocuments: typeof getDocuments;
638
+ declare const documents_getParsedContent: typeof getParsedContent;
639
+ declare const documents_listDocuments: typeof listDocuments;
640
+ declare const documents_sanitizeFolderPath: typeof sanitizeFolderPath;
641
+ declare const documents_updateDocuments: typeof updateDocuments;
642
+ declare const documents_uploadFiles: typeof uploadFiles;
643
+ declare const documents_uploadUrl: typeof uploadUrl;
644
+ declare namespace documents {
645
+ export { documents_SUPPORTED_EXTENSIONS as SUPPORTED_EXTENSIONS, type documents_UploadBatchResult as UploadBatchResult, 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_listDocuments as listDocuments, documents_sanitizeFolderPath as sanitizeFolderPath, documents_updateDocuments as updateDocuments, uploadFile$1 as uploadFile, documents_uploadFiles as uploadFiles, documents_uploadUrl as uploadUrl };
646
+ }
647
+
648
+ /**
649
+ * Assistant operations — retrieve (search-only) and query (with LLM).
650
+ *
651
+ * retrieve: Uses the typed SDK route POST /v1/assistant/retrieve.
652
+ * Returns matching chunks without LLM generation.
653
+ *
654
+ * queryAssistant: Returns the raw Response for SSE streaming.
655
+ * Uses raw fetch because the SDK client doesn't support streaming responses.
656
+ */
657
+
658
+ declare function buildRetrievalChunkTool(docIds: string[], searchMode?: 'semantic' | 'keyword' | 'hybrid'): components['schemas']['RetrievalChunkTool'];
659
+ declare function buildRetrievalFullContextTool(docIds: string[]): components['schemas']['RetrievalFullContextTool'];
660
+ declare function buildRetrievalTocTool(docIds: string[]): components['schemas']['RetrievalTOCTool'];
661
+ interface RetrieveOptions {
662
+ arbi: ArbiClient;
663
+ workspaceId: string;
664
+ query: string;
665
+ docIds: string[];
666
+ searchMode?: 'semantic' | 'keyword' | 'hybrid';
667
+ fullContextDocIds?: string[];
668
+ tocDocIds?: string[];
669
+ model?: string;
670
+ }
671
+ interface ChunkMetadata {
672
+ doc_ext_id?: string | null;
673
+ doc_title?: string | null;
674
+ chunk_ext_id: string;
675
+ chunk_pg_idx: number;
676
+ chunk_doc_idx: number;
677
+ page_number: number;
678
+ score?: number | null;
679
+ rerank_score?: number | null;
680
+ tokens?: number | null;
681
+ created_at: string;
682
+ heading: boolean;
683
+ }
684
+ interface Chunk {
685
+ metadata: ChunkMetadata;
686
+ content: string;
687
+ }
688
+ interface RetrieveResult {
689
+ retrieval_chunk?: {
690
+ tool_responses: Record<string, Chunk[]>;
691
+ };
692
+ retrieval_full_context?: {
693
+ tool_responses: Record<string, Chunk[]>;
694
+ };
695
+ retrieval_toc?: {
696
+ tool_responses: Record<string, Record<string, unknown>[]>;
697
+ };
698
+ }
699
+ /**
700
+ * Search documents and return matching chunks without LLM generation.
701
+ * Uses the typed SDK route POST /v1/assistant/retrieve.
702
+ */
703
+ declare function retrieve(options: RetrieveOptions): Promise<RetrieveResult>;
704
+ interface AssistantQueryOptions extends AuthHeaders {
705
+ workspaceId: string;
706
+ question: string;
707
+ docIds: string[];
708
+ previousResponseId?: string | null;
709
+ model?: string;
710
+ }
711
+ /**
712
+ * Send a query to the RAG assistant. Returns the raw Response
713
+ * so the caller can stream or buffer as needed.
714
+ *
715
+ * Uses raw fetch (not the SDK client) because we need the streaming
716
+ * Response body — the SDK client consumes the body to parse JSON.
717
+ */
718
+ declare function queryAssistant(options: AssistantQueryOptions): Promise<Response>;
719
+ /**
720
+ * Respond to an agent's question during a human-in-the-loop workflow.
721
+ * The assistant_message_ext_id identifies which agent message to answer.
722
+ */
723
+ declare function respondToAgent(arbi: ArbiClient, assistantMessageExtId: string, answer: string): Promise<unknown>;
724
+
725
+ type assistant_AssistantQueryOptions = AssistantQueryOptions;
726
+ type assistant_Chunk = Chunk;
727
+ type assistant_ChunkMetadata = ChunkMetadata;
728
+ type assistant_RetrieveOptions = RetrieveOptions;
729
+ type assistant_RetrieveResult = RetrieveResult;
730
+ declare const assistant_buildRetrievalChunkTool: typeof buildRetrievalChunkTool;
731
+ declare const assistant_buildRetrievalFullContextTool: typeof buildRetrievalFullContextTool;
732
+ declare const assistant_buildRetrievalTocTool: typeof buildRetrievalTocTool;
733
+ declare const assistant_queryAssistant: typeof queryAssistant;
734
+ declare const assistant_respondToAgent: typeof respondToAgent;
735
+ declare const assistant_retrieve: typeof retrieve;
736
+ declare namespace assistant {
737
+ export { type assistant_AssistantQueryOptions as AssistantQueryOptions, type assistant_Chunk as Chunk, type assistant_ChunkMetadata as ChunkMetadata, type assistant_RetrieveOptions as RetrieveOptions, type assistant_RetrieveResult as RetrieveResult, assistant_buildRetrievalChunkTool as buildRetrievalChunkTool, assistant_buildRetrievalFullContextTool as buildRetrievalFullContextTool, assistant_buildRetrievalTocTool as buildRetrievalTocTool, assistant_queryAssistant as queryAssistant, assistant_respondToAgent as respondToAgent, assistant_retrieve as retrieve };
738
+ }
739
+
740
+ /**
741
+ * Contact operations — list, add, remove.
742
+ */
743
+
744
+ declare function listContacts(arbi: ArbiClient): Promise<{
745
+ external_id: string;
746
+ email: string;
747
+ user?: {
748
+ external_id: string;
749
+ email: string;
750
+ given_name: string;
751
+ family_name: string;
752
+ picture?: string | null | undefined;
753
+ encryption_public_key: string;
754
+ } | null | undefined;
755
+ status: "invitation_pending" | "invitation_expired" | "registered";
756
+ created_at: string;
757
+ }[]>;
758
+ declare function addContacts(arbi: ArbiClient, emails: string[]): Promise<{
759
+ external_id: string;
760
+ email: string;
761
+ user?: {
762
+ external_id: string;
763
+ email: string;
764
+ given_name: string;
765
+ family_name: string;
766
+ picture?: string | null | undefined;
767
+ encryption_public_key: string;
768
+ } | null | undefined;
769
+ status: "invitation_pending" | "invitation_expired" | "registered";
770
+ created_at: string;
771
+ }[]>;
772
+ declare function removeContacts(arbi: ArbiClient, contactIds: string[]): Promise<void>;
773
+ /**
774
+ * Group contacts by registration status.
775
+ * Returns registered contacts and pending (not yet registered) contacts.
776
+ */
777
+ declare function groupContactsByStatus<T extends {
778
+ status: string;
779
+ }>(contactList: T[]): {
780
+ registered: T[];
781
+ pending: T[];
782
+ };
783
+
784
+ declare const contacts_addContacts: typeof addContacts;
785
+ declare const contacts_groupContactsByStatus: typeof groupContactsByStatus;
786
+ declare const contacts_listContacts: typeof listContacts;
787
+ declare const contacts_removeContacts: typeof removeContacts;
788
+ declare namespace contacts {
789
+ export { contacts_addContacts as addContacts, contacts_groupContactsByStatus as groupContactsByStatus, contacts_listContacts as listContacts, contacts_removeContacts as removeContacts };
790
+ }
791
+
792
+ /**
793
+ * File operations — OpenAI-compatible Files API (list, get, delete, upload, content).
794
+ */
795
+
796
+ type FileObject = components['schemas']['FileObject'];
797
+ type FileDeleteResponse = components['schemas']['FileDeleteResponse'];
798
+ type FileListResponse = components['schemas']['FileListResponse'];
799
+
800
+ interface ListFilesOptions {
801
+ purpose?: string | null;
802
+ limit?: number;
803
+ order?: string;
804
+ after?: string | null;
805
+ }
806
+ declare function listFiles(arbi: ArbiClient, options?: ListFilesOptions): Promise<{
807
+ object: string;
808
+ data: {
809
+ id: string;
810
+ object: string;
811
+ bytes: number;
812
+ created_at: number;
813
+ filename: string;
814
+ purpose: string;
815
+ status: string;
816
+ expires_at?: number | null | undefined;
817
+ status_details?: string | null | undefined;
818
+ }[];
819
+ has_more: boolean;
820
+ first_id?: string | null | undefined;
821
+ last_id?: string | null | undefined;
822
+ }>;
823
+ declare function getFile(arbi: ArbiClient, fileId: string): Promise<{
824
+ id: string;
825
+ object: string;
826
+ bytes: number;
827
+ created_at: number;
828
+ filename: string;
829
+ purpose: string;
830
+ status: string;
831
+ expires_at?: number | null | undefined;
832
+ status_details?: string | null | undefined;
833
+ }>;
834
+ declare function deleteFile(arbi: ArbiClient, fileId: string): Promise<{
835
+ id: string;
836
+ object: string;
837
+ deleted: boolean;
838
+ }>;
839
+ /**
840
+ * Upload a file via the OpenAI-compatible Files API.
841
+ * Uses raw fetch for multipart upload.
842
+ */
843
+ declare function uploadFile(auth: AuthHeaders, fileData: Blob, fileName: string, purpose?: string): Promise<FileObject>;
844
+ /**
845
+ * Get file content (binary). Returns the raw Response for the caller to handle.
846
+ */
847
+ declare function getFileContent(auth: AuthHeaders, fileId: string): Promise<Response>;
848
+
849
+ type files_FileDeleteResponse = FileDeleteResponse;
850
+ type files_FileListResponse = FileListResponse;
851
+ type files_FileObject = FileObject;
852
+ type files_ListFilesOptions = ListFilesOptions;
853
+ declare const files_deleteFile: typeof deleteFile;
854
+ declare const files_getFile: typeof getFile;
855
+ declare const files_getFileContent: typeof getFileContent;
856
+ declare const files_listFiles: typeof listFiles;
857
+ declare const files_uploadFile: typeof uploadFile;
858
+ declare namespace files {
859
+ 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 };
860
+ }
861
+
862
+ /**
863
+ * High-level convenience class that wraps the full ARBI stack into a simple API.
864
+ *
865
+ * Handles SDK client creation, sodium initialization, authentication,
866
+ * workspace key decryption, and delegates to all operations modules.
867
+ *
868
+ * Usage:
869
+ * const arbi = new Arbi({ url: 'https://arbi.mycompany.com' })
870
+ * await arbi.login('user@example.com', 'password')
871
+ * const workspaces = await arbi.workspaces.list()
872
+ * await arbi.selectWorkspace(workspaces[0].external_id)
873
+ * const docs = await arbi.documents.list()
874
+ */
875
+
876
+ type DocUpdateRequest = components['schemas']['DocUpdateRequest'];
877
+ type WorkspaceUpdateRequest$1 = components['schemas']['WorkspaceUpdateRequest'];
878
+ type UpdateTagRequest$1 = components['schemas']['UpdateTagRequest'];
879
+ type TagFormat = components['schemas']['TagFormat'];
880
+ type CitationData$1 = components['schemas']['CitationData'];
881
+ type UserSettingsUpdate$1 = components['schemas']['UserSettingsUpdate'];
882
+ type ConfigUpdateData$1 = components['schemas']['ConfigUpdateData'];
883
+
884
+ interface ArbiOptions {
885
+ /** Backend API URL (e.g. 'https://arbi.mycompany.com') */
886
+ url: string;
887
+ /** Deployment domain for key derivation. Defaults to hostname of url. */
888
+ deploymentDomain?: string;
889
+ /** Include credentials (cookies) in requests. Default: 'omit' for SDK consumers. */
890
+ credentials?: 'include' | 'omit' | 'same-origin';
891
+ }
892
+ interface QueryOptions {
893
+ /** Document IDs to search against */
894
+ docIds: string[];
895
+ /** Previous response ID for follow-up questions */
896
+ previousResponseId?: string | null;
897
+ /** Model to use for generation */
898
+ model?: string;
899
+ /** Called for each streaming token */
900
+ onToken?: (content: string) => void;
901
+ /** Called when stream starts */
902
+ onStreamStart?: (data: SSEStreamStartData) => void;
903
+ /** Called for each agent step */
904
+ onAgentStep?: (data: AgentStepEvent) => void;
905
+ /** Called on stream error */
906
+ onError?: (message: string) => void;
907
+ /** Called when a user message event is received */
908
+ onUserMessage?: (data: UserMessageEvent) => void;
909
+ /** Called when message metadata is received */
910
+ onMetadata?: (data: MessageMetadataPayload) => void;
911
+ /** Called when the agent requests user input */
912
+ onUserInputRequest?: (data: UserInputRequestEvent) => void;
913
+ /** Called when an artifact event is received */
914
+ onArtifact?: (data: ArtifactEvent) => void;
915
+ /** Called when backend elapsed time is received */
916
+ onElapsedTime?: (t: number) => void;
917
+ /** Called when stream completes */
918
+ onComplete?: () => void;
919
+ }
920
+ declare class Arbi {
921
+ private client;
922
+ private loginResult;
923
+ private currentWorkspaceId;
924
+ private readonly options;
925
+ constructor(options: ArbiOptions);
926
+ /** Initialize the SDK client and sodium crypto. Called automatically by login(). */
927
+ init(): Promise<ArbiClient>;
928
+ /**
929
+ * Request a verification email for registration.
930
+ * The user will receive an email with a 3-word verification code.
931
+ */
932
+ requestVerification(email: string): Promise<void>;
933
+ /**
934
+ * Register a new account using the verification code received by email.
935
+ */
936
+ register(params: {
937
+ email: string;
938
+ password: string;
939
+ verificationCode: string;
940
+ firstName?: string;
941
+ lastName?: string;
942
+ }): Promise<void>;
943
+ /**
944
+ * Log in with email and password.
945
+ * Initializes the SDK client if not already done.
946
+ */
947
+ login(email: string, password: string): Promise<void>;
948
+ /**
949
+ * Recover a session using a stored signing private key (base64).
950
+ * Useful for session recovery without re-entering the password.
951
+ */
952
+ loginWithKey(email: string, signingPrivateKeyBase64: string): Promise<void>;
953
+ /**
954
+ * Select a workspace by ID. Fetches the workspace list, finds the matching
955
+ * workspace, decrypts the wrapped key, and sets up auth headers.
956
+ */
957
+ selectWorkspace(workspaceId: string): Promise<void>;
958
+ /** Log out and clear internal state. */
959
+ logout(): Promise<void>;
960
+ /** Get the underlying ArbiClient (throws if not initialized). */
961
+ getClient(): ArbiClient;
962
+ /** Get the current workspace ID (throws if none selected). */
963
+ getWorkspaceId(): string;
964
+ /** Check if the user is logged in. */
965
+ get isLoggedIn(): boolean;
966
+ /** Check if a workspace is selected. */
967
+ get hasWorkspace(): boolean;
968
+ private getAuthHeaders;
969
+ readonly workspaces: {
970
+ list: () => Promise<{
971
+ external_id: string;
972
+ name: string;
973
+ description: string | null;
974
+ is_public: boolean;
975
+ created_by_ext_id: string;
976
+ updated_by_ext_id?: string | null | undefined;
977
+ created_at: string;
978
+ updated_at: string;
979
+ wrapped_key?: string | null | undefined;
980
+ shared_conversation_count: number;
981
+ private_conversation_count: number;
982
+ shared_document_count: number;
983
+ private_document_count: number;
984
+ user_files_mb: number;
985
+ users: {
986
+ user: {
987
+ external_id: string;
988
+ email: string;
989
+ given_name: string;
990
+ family_name: string;
991
+ picture?: string | null | undefined;
992
+ encryption_public_key: string;
993
+ };
994
+ role: components["schemas"]["WorkspaceRole"];
995
+ joined_at: string;
996
+ conversation_count: number;
997
+ document_count: number;
998
+ }[];
999
+ }[]>;
1000
+ create: (name: string, description?: string | null, isPublic?: boolean) => Promise<{
1001
+ external_id: string;
1002
+ name: string;
1003
+ description: string | null;
1004
+ is_public: boolean;
1005
+ created_by_ext_id: string;
1006
+ updated_by_ext_id?: string | null | undefined;
1007
+ created_at: string;
1008
+ updated_at: string;
1009
+ wrapped_key?: string | null | undefined;
1010
+ shared_conversation_count: number;
1011
+ private_conversation_count: number;
1012
+ shared_document_count: number;
1013
+ private_document_count: number;
1014
+ user_files_mb: number;
1015
+ users: {
1016
+ user: {
1017
+ external_id: string;
1018
+ email: string;
1019
+ given_name: string;
1020
+ family_name: string;
1021
+ picture?: string | null | undefined;
1022
+ encryption_public_key: string;
1023
+ };
1024
+ role: components["schemas"]["WorkspaceRole"];
1025
+ joined_at: string;
1026
+ conversation_count: number;
1027
+ document_count: number;
1028
+ }[];
1029
+ }>;
1030
+ delete: (workspaceIds: string[]) => Promise<void>;
1031
+ update: (body: WorkspaceUpdateRequest$1) => Promise<{
1032
+ external_id: string;
1033
+ name: string;
1034
+ description: string | null;
1035
+ is_public: boolean;
1036
+ created_by_ext_id: string;
1037
+ updated_by_ext_id?: string | null | undefined;
1038
+ created_at: string;
1039
+ updated_at: string;
1040
+ wrapped_key?: string | null | undefined;
1041
+ shared_conversation_count: number;
1042
+ private_conversation_count: number;
1043
+ shared_document_count: number;
1044
+ private_document_count: number;
1045
+ user_files_mb: number;
1046
+ users: {
1047
+ user: {
1048
+ external_id: string;
1049
+ email: string;
1050
+ given_name: string;
1051
+ family_name: string;
1052
+ picture?: string | null | undefined;
1053
+ encryption_public_key: string;
1054
+ };
1055
+ role: components["schemas"]["WorkspaceRole"];
1056
+ joined_at: string;
1057
+ conversation_count: number;
1058
+ document_count: number;
1059
+ }[];
1060
+ }>;
1061
+ listUsers: () => Promise<{
1062
+ user: {
1063
+ external_id: string;
1064
+ email: string;
1065
+ given_name: string;
1066
+ family_name: string;
1067
+ picture?: string | null | undefined;
1068
+ encryption_public_key: string;
1069
+ };
1070
+ role: components["schemas"]["WorkspaceRole"];
1071
+ joined_at: string;
1072
+ conversation_count: number;
1073
+ document_count: number;
1074
+ }[]>;
1075
+ addUsers: (emails: string[], role?: "owner" | "collaborator" | "guest") => Promise<{
1076
+ user: {
1077
+ external_id: string;
1078
+ email: string;
1079
+ given_name: string;
1080
+ family_name: string;
1081
+ picture?: string | null | undefined;
1082
+ encryption_public_key: string;
1083
+ };
1084
+ role: components["schemas"]["WorkspaceRole"];
1085
+ joined_at: string;
1086
+ conversation_count: number;
1087
+ document_count: number;
1088
+ }[]>;
1089
+ removeUsers: (userIds: string[]) => Promise<void>;
1090
+ setUserRole: (userIds: string[], role: "owner" | "collaborator" | "guest") => Promise<{
1091
+ user: {
1092
+ external_id: string;
1093
+ email: string;
1094
+ given_name: string;
1095
+ family_name: string;
1096
+ picture?: string | null | undefined;
1097
+ encryption_public_key: string;
1098
+ };
1099
+ role: components["schemas"]["WorkspaceRole"];
1100
+ joined_at: string;
1101
+ conversation_count: number;
1102
+ document_count: number;
1103
+ }[]>;
1104
+ copyDocuments: (targetWorkspaceId: string, docIds: string[], targetWorkspaceKey: string) => Promise<{
1105
+ detail: string;
1106
+ documents_copied: number;
1107
+ results: {
1108
+ source_doc_ext_id: string;
1109
+ success: boolean;
1110
+ new_doc_ext_id?: string | null | undefined;
1111
+ error?: string | null | undefined;
1112
+ }[];
1113
+ }>;
1114
+ };
1115
+ readonly documents: {
1116
+ list: () => Promise<{
1117
+ external_id: string;
1118
+ workspace_ext_id: string;
1119
+ file_name?: string | null | undefined;
1120
+ status?: string | null | undefined;
1121
+ n_pages?: number | null | undefined;
1122
+ n_chunks?: number | null | undefined;
1123
+ tokens?: number | null | undefined;
1124
+ file_type?: string | null | undefined;
1125
+ file_size?: number | null | undefined;
1126
+ storage_type?: string | null | undefined;
1127
+ storage_uri?: string | null | undefined;
1128
+ content_hash?: string | null | undefined;
1129
+ shared?: boolean | null | undefined;
1130
+ re_ocred?: boolean | null | undefined;
1131
+ config_ext_id?: string | null | undefined;
1132
+ parent_ext_id?: string | null | undefined;
1133
+ created_by_ext_id: string;
1134
+ updated_by_ext_id?: string | null | undefined;
1135
+ created_at: string;
1136
+ updated_at: string;
1137
+ wp_type?: string | null | undefined;
1138
+ folder?: string | null | undefined;
1139
+ doctags: {
1140
+ doc_ext_id: string;
1141
+ tag_ext_id: string;
1142
+ note?: string | null | undefined;
1143
+ citations?: {
1144
+ [x: string]: {
1145
+ chunk_ids: string[];
1146
+ scores: number[];
1147
+ statement: string;
1148
+ offset_start: number;
1149
+ offset_end: number;
1150
+ };
1151
+ } | null | undefined;
1152
+ created_by_ext_id: string;
1153
+ updated_by_ext_id?: string | null | undefined;
1154
+ created_at: string;
1155
+ updated_at: string;
1156
+ }[];
1157
+ doc_metadata?: {
1158
+ doc_nature?: string | null | undefined;
1159
+ doc_author?: string | null | undefined;
1160
+ doc_subject?: string | null | undefined;
1161
+ doc_date?: string | null | undefined;
1162
+ title?: string | null | undefined;
1163
+ } | null | undefined;
1164
+ }[]>;
1165
+ get: (externalIds: string[]) => Promise<{
1166
+ external_id: string;
1167
+ workspace_ext_id: string;
1168
+ file_name?: string | null | undefined;
1169
+ status?: string | null | undefined;
1170
+ n_pages?: number | null | undefined;
1171
+ n_chunks?: number | null | undefined;
1172
+ tokens?: number | null | undefined;
1173
+ file_type?: string | null | undefined;
1174
+ file_size?: number | null | undefined;
1175
+ storage_type?: string | null | undefined;
1176
+ storage_uri?: string | null | undefined;
1177
+ content_hash?: string | null | undefined;
1178
+ shared?: boolean | null | undefined;
1179
+ re_ocred?: boolean | null | undefined;
1180
+ config_ext_id?: string | null | undefined;
1181
+ parent_ext_id?: string | null | undefined;
1182
+ created_by_ext_id: string;
1183
+ updated_by_ext_id?: string | null | undefined;
1184
+ created_at: string;
1185
+ updated_at: string;
1186
+ wp_type?: string | null | undefined;
1187
+ folder?: string | null | undefined;
1188
+ doctags: {
1189
+ doc_ext_id: string;
1190
+ tag_ext_id: string;
1191
+ note?: string | null | undefined;
1192
+ citations?: {
1193
+ [x: string]: {
1194
+ chunk_ids: string[];
1195
+ scores: number[];
1196
+ statement: string;
1197
+ offset_start: number;
1198
+ offset_end: number;
1199
+ };
1200
+ } | null | undefined;
1201
+ created_by_ext_id: string;
1202
+ updated_by_ext_id?: string | null | undefined;
1203
+ created_at: string;
1204
+ updated_at: string;
1205
+ }[];
1206
+ doc_metadata?: {
1207
+ doc_nature?: string | null | undefined;
1208
+ doc_author?: string | null | undefined;
1209
+ doc_subject?: string | null | undefined;
1210
+ doc_date?: string | null | undefined;
1211
+ title?: string | null | undefined;
1212
+ } | null | undefined;
1213
+ }[]>;
1214
+ delete: (externalIds: string[]) => Promise<void>;
1215
+ update: (documents: DocUpdateRequest[]) => Promise<{
1216
+ external_id: string;
1217
+ workspace_ext_id: string;
1218
+ file_name?: string | null | undefined;
1219
+ status?: string | null | undefined;
1220
+ n_pages?: number | null | undefined;
1221
+ n_chunks?: number | null | undefined;
1222
+ tokens?: number | null | undefined;
1223
+ file_type?: string | null | undefined;
1224
+ file_size?: number | null | undefined;
1225
+ storage_type?: string | null | undefined;
1226
+ storage_uri?: string | null | undefined;
1227
+ content_hash?: string | null | undefined;
1228
+ shared?: boolean | null | undefined;
1229
+ re_ocred?: boolean | null | undefined;
1230
+ config_ext_id?: string | null | undefined;
1231
+ parent_ext_id?: string | null | undefined;
1232
+ created_by_ext_id: string;
1233
+ updated_by_ext_id?: string | null | undefined;
1234
+ created_at: string;
1235
+ updated_at: string;
1236
+ wp_type?: string | null | undefined;
1237
+ folder?: string | null | undefined;
1238
+ doctags: {
1239
+ doc_ext_id: string;
1240
+ tag_ext_id: string;
1241
+ note?: string | null | undefined;
1242
+ citations?: {
1243
+ [x: string]: {
1244
+ chunk_ids: string[];
1245
+ scores: number[];
1246
+ statement: string;
1247
+ offset_start: number;
1248
+ offset_end: number;
1249
+ };
1250
+ } | null | undefined;
1251
+ created_by_ext_id: string;
1252
+ updated_by_ext_id?: string | null | undefined;
1253
+ created_at: string;
1254
+ updated_at: string;
1255
+ }[];
1256
+ doc_metadata?: {
1257
+ doc_nature?: string | null | undefined;
1258
+ doc_author?: string | null | undefined;
1259
+ doc_subject?: string | null | undefined;
1260
+ doc_date?: string | null | undefined;
1261
+ title?: string | null | undefined;
1262
+ } | null | undefined;
1263
+ }[]>;
1264
+ uploadUrl: (urls: string[], shared?: boolean, workspaceId?: string) => Promise<{
1265
+ doc_ext_ids: string[];
1266
+ duplicates?: string[] | undefined;
1267
+ }>;
1268
+ uploadFile: (fileData: Blob, fileName: string, options?: {
1269
+ workspaceId?: string;
1270
+ folder?: string;
1271
+ }) => Promise<UploadResult>;
1272
+ download: (docId: string) => Promise<Response>;
1273
+ getParsedContent: (docId: string, stage: string) => Promise<Record<string, unknown>>;
1274
+ };
1275
+ readonly conversations: {
1276
+ list: () => Promise<{
1277
+ external_id: string;
1278
+ title: string | null;
1279
+ created_by_ext_id: string;
1280
+ updated_by_ext_id?: string | null | undefined;
1281
+ created_at: string;
1282
+ updated_at: string;
1283
+ is_shared: boolean;
1284
+ message_count: number;
1285
+ }[]>;
1286
+ getThreads: (conversationId: string) => Promise<{
1287
+ conversation_ext_id: string;
1288
+ threads: {
1289
+ leaf_message_ext_id: string;
1290
+ history: {
1291
+ role: "user" | "assistant" | "system";
1292
+ content: string;
1293
+ tools?: {
1294
+ [x: string]: {
1295
+ name: "model_citation";
1296
+ description: string;
1297
+ tool_responses: {
1298
+ [x: string]: {
1299
+ chunk_ids: string[];
1300
+ scores: number[];
1301
+ statement: string;
1302
+ offset_start: number;
1303
+ offset_end: number;
1304
+ };
1305
+ };
1306
+ } | {
1307
+ name: "retrieval_chunk";
1308
+ description: string;
1309
+ tool_args: {
1310
+ doc_ext_ids: string[];
1311
+ search_mode?: ("semantic" | "keyword" | "hybrid") | null | undefined;
1312
+ };
1313
+ tool_responses: {
1314
+ [x: string]: {
1315
+ metadata: {
1316
+ workspace_ext_id?: string | null | undefined;
1317
+ doc_ext_id?: string | null | undefined;
1318
+ doc_title?: string | null | undefined;
1319
+ chunk_id?: string | null | undefined;
1320
+ chunk_ext_id: string;
1321
+ chunk_pg_idx: number;
1322
+ chunk_doc_idx: number;
1323
+ page_number: number;
1324
+ score?: number | null | undefined;
1325
+ rerank_score?: number | null | undefined;
1326
+ tokens?: number | null | undefined;
1327
+ created_at: string;
1328
+ heading: boolean;
1329
+ bbox?: number[] | null | undefined;
1330
+ element_type?: string | null | undefined;
1331
+ heading_level?: number | null | undefined;
1332
+ };
1333
+ content: string;
1334
+ }[];
1335
+ };
1336
+ } | {
1337
+ name: "retrieval_full_context";
1338
+ description: string;
1339
+ tool_args: {
1340
+ doc_ext_ids: string[];
1341
+ from_ref?: string | null | undefined;
1342
+ to_ref?: string | null | undefined;
1343
+ };
1344
+ tool_responses: {
1345
+ [x: string]: {
1346
+ metadata: {
1347
+ workspace_ext_id?: string | null | undefined;
1348
+ doc_ext_id?: string | null | undefined;
1349
+ doc_title?: string | null | undefined;
1350
+ chunk_id?: string | null | undefined;
1351
+ chunk_ext_id: string;
1352
+ chunk_pg_idx: number;
1353
+ chunk_doc_idx: number;
1354
+ page_number: number;
1355
+ score?: number | null | undefined;
1356
+ rerank_score?: number | null | undefined;
1357
+ tokens?: number | null | undefined;
1358
+ created_at: string;
1359
+ heading: boolean;
1360
+ bbox?: number[] | null | undefined;
1361
+ element_type?: string | null | undefined;
1362
+ heading_level?: number | null | undefined;
1363
+ };
1364
+ content: string;
1365
+ }[];
1366
+ };
1367
+ } | {
1368
+ name: "retrieval_toc";
1369
+ description: string;
1370
+ tool_args: {
1371
+ doc_ext_ids: string[];
1372
+ };
1373
+ tool_responses: {
1374
+ [x: string]: {
1375
+ [x: string]: unknown;
1376
+ }[];
1377
+ };
1378
+ } | {
1379
+ name: "trace";
1380
+ description: string;
1381
+ trace_id?: string | null | undefined;
1382
+ start_time?: number | null | undefined;
1383
+ duration_seconds?: number | null | undefined;
1384
+ steps: {
1385
+ [x: string]: unknown;
1386
+ }[];
1387
+ } | {
1388
+ name: "compaction";
1389
+ description: string;
1390
+ tool_args: {
1391
+ source_conversation_ext_id: string;
1392
+ source_leaf_message_ext_id: string;
1393
+ };
1394
+ tool_responses: {
1395
+ [x: string]: string;
1396
+ };
1397
+ } | {
1398
+ name: "personal_agent";
1399
+ description: string;
1400
+ tool_args: {
1401
+ task: string;
1402
+ };
1403
+ tool_responses: {
1404
+ [x: string]: unknown;
1405
+ };
1406
+ } | {
1407
+ name: "stream_events";
1408
+ events: {
1409
+ [x: string]: unknown;
1410
+ }[];
1411
+ };
1412
+ } | undefined;
1413
+ config_ext_id?: string | null | undefined;
1414
+ shared: boolean;
1415
+ tokens: number;
1416
+ external_id: string;
1417
+ created_at: string;
1418
+ created_by_ext_id: string;
1419
+ conversation_ext_id: string;
1420
+ parent_message_ext_id?: string | null | undefined;
1421
+ }[];
1422
+ }[];
1423
+ }>;
1424
+ delete: (conversationId: string) => Promise<{
1425
+ detail: string;
1426
+ }>;
1427
+ share: (conversationId: string) => Promise<{
1428
+ detail: string;
1429
+ }>;
1430
+ updateTitle: (conversationId: string, title: string) => Promise<{
1431
+ detail: string;
1432
+ title: string;
1433
+ }>;
1434
+ getMessage: (messageId: string) => Promise<{
1435
+ role: "user" | "assistant" | "system";
1436
+ content: string;
1437
+ tools?: {
1438
+ [x: string]: {
1439
+ name: "model_citation";
1440
+ description: string;
1441
+ tool_responses: {
1442
+ [x: string]: {
1443
+ chunk_ids: string[];
1444
+ scores: number[];
1445
+ statement: string;
1446
+ offset_start: number;
1447
+ offset_end: number;
1448
+ };
1449
+ };
1450
+ } | {
1451
+ name: "retrieval_chunk";
1452
+ description: string;
1453
+ tool_args: {
1454
+ doc_ext_ids: string[];
1455
+ search_mode?: ("semantic" | "keyword" | "hybrid") | null | undefined;
1456
+ };
1457
+ tool_responses: {
1458
+ [x: string]: {
1459
+ metadata: {
1460
+ workspace_ext_id?: string | null | undefined;
1461
+ doc_ext_id?: string | null | undefined;
1462
+ doc_title?: string | null | undefined;
1463
+ chunk_id?: string | null | undefined;
1464
+ chunk_ext_id: string;
1465
+ chunk_pg_idx: number;
1466
+ chunk_doc_idx: number;
1467
+ page_number: number;
1468
+ score?: number | null | undefined;
1469
+ rerank_score?: number | null | undefined;
1470
+ tokens?: number | null | undefined;
1471
+ created_at: string;
1472
+ heading: boolean;
1473
+ bbox?: number[] | null | undefined;
1474
+ element_type?: string | null | undefined;
1475
+ heading_level?: number | null | undefined;
1476
+ };
1477
+ content: string;
1478
+ }[];
1479
+ };
1480
+ } | {
1481
+ name: "retrieval_full_context";
1482
+ description: string;
1483
+ tool_args: {
1484
+ doc_ext_ids: string[];
1485
+ from_ref?: string | null | undefined;
1486
+ to_ref?: string | null | undefined;
1487
+ };
1488
+ tool_responses: {
1489
+ [x: string]: {
1490
+ metadata: {
1491
+ workspace_ext_id?: string | null | undefined;
1492
+ doc_ext_id?: string | null | undefined;
1493
+ doc_title?: string | null | undefined;
1494
+ chunk_id?: string | null | undefined;
1495
+ chunk_ext_id: string;
1496
+ chunk_pg_idx: number;
1497
+ chunk_doc_idx: number;
1498
+ page_number: number;
1499
+ score?: number | null | undefined;
1500
+ rerank_score?: number | null | undefined;
1501
+ tokens?: number | null | undefined;
1502
+ created_at: string;
1503
+ heading: boolean;
1504
+ bbox?: number[] | null | undefined;
1505
+ element_type?: string | null | undefined;
1506
+ heading_level?: number | null | undefined;
1507
+ };
1508
+ content: string;
1509
+ }[];
1510
+ };
1511
+ } | {
1512
+ name: "retrieval_toc";
1513
+ description: string;
1514
+ tool_args: {
1515
+ doc_ext_ids: string[];
1516
+ };
1517
+ tool_responses: {
1518
+ [x: string]: {
1519
+ [x: string]: unknown;
1520
+ }[];
1521
+ };
1522
+ } | {
1523
+ name: "trace";
1524
+ description: string;
1525
+ trace_id?: string | null | undefined;
1526
+ start_time?: number | null | undefined;
1527
+ duration_seconds?: number | null | undefined;
1528
+ steps: {
1529
+ [x: string]: unknown;
1530
+ }[];
1531
+ } | {
1532
+ name: "compaction";
1533
+ description: string;
1534
+ tool_args: {
1535
+ source_conversation_ext_id: string;
1536
+ source_leaf_message_ext_id: string;
1537
+ };
1538
+ tool_responses: {
1539
+ [x: string]: string;
1540
+ };
1541
+ } | {
1542
+ name: "personal_agent";
1543
+ description: string;
1544
+ tool_args: {
1545
+ task: string;
1546
+ };
1547
+ tool_responses: {
1548
+ [x: string]: unknown;
1549
+ };
1550
+ } | {
1551
+ name: "stream_events";
1552
+ events: {
1553
+ [x: string]: unknown;
1554
+ }[];
1555
+ };
1556
+ } | undefined;
1557
+ config_ext_id?: string | null | undefined;
1558
+ shared: boolean;
1559
+ tokens: number;
1560
+ external_id: string;
1561
+ created_at: string;
1562
+ created_by_ext_id: string;
1563
+ conversation_ext_id: string;
1564
+ parent_message_ext_id?: string | null | undefined;
1565
+ }>;
1566
+ deleteMessage: (messageId: string) => Promise<{
1567
+ detail: string;
1568
+ }>;
1569
+ };
1570
+ readonly assistant: {
1571
+ /**
1572
+ * Send a question to the RAG assistant with streaming support.
1573
+ * Returns the accumulated result after the stream completes.
1574
+ */
1575
+ query: (question: string, options: QueryOptions) => Promise<SSEStreamResult>;
1576
+ /**
1577
+ * Respond to an agent's question during a human-in-the-loop workflow.
1578
+ */
1579
+ respond: (assistantMessageExtId: string, answer: string) => Promise<unknown>;
1580
+ /**
1581
+ * Search documents without LLM generation (retrieval only).
1582
+ */
1583
+ retrieve: (query: string, docIds: string[], options?: {
1584
+ searchMode?: "semantic" | "keyword" | "hybrid";
1585
+ fullContextDocIds?: string[];
1586
+ tocDocIds?: string[];
1587
+ model?: string;
1588
+ }) => Promise<RetrieveResult>;
1589
+ };
1590
+ readonly tags: {
1591
+ list: () => Promise<{
1592
+ external_id: string;
1593
+ workspace_ext_id: string;
1594
+ name: string;
1595
+ instruction?: string | null | undefined;
1596
+ tag_type: {
1597
+ type: "checkbox" | "text" | "number" | "select" | "search" | "date";
1598
+ options: string[];
1599
+ };
1600
+ shared: boolean;
1601
+ parent_ext_id?: string | null | undefined;
1602
+ doctag_count: number;
1603
+ created_by_ext_id: string;
1604
+ updated_by_ext_id?: string | null | undefined;
1605
+ created_at: string;
1606
+ updated_at: string;
1607
+ }[]>;
1608
+ create: (options: {
1609
+ name: string;
1610
+ workspaceId?: string;
1611
+ tagType?: TagFormat;
1612
+ instruction?: string | null;
1613
+ shared?: boolean;
1614
+ }) => Promise<{
1615
+ external_id: string;
1616
+ workspace_ext_id: string;
1617
+ name: string;
1618
+ instruction?: string | null | undefined;
1619
+ tag_type: {
1620
+ type: "checkbox" | "text" | "number" | "select" | "search" | "date";
1621
+ options: string[];
1622
+ };
1623
+ shared: boolean;
1624
+ parent_ext_id?: string | null | undefined;
1625
+ doctag_count: number;
1626
+ created_by_ext_id: string;
1627
+ updated_by_ext_id?: string | null | undefined;
1628
+ created_at: string;
1629
+ updated_at: string;
1630
+ }>;
1631
+ delete: (tagId: string) => Promise<{
1632
+ detail: string;
1633
+ }>;
1634
+ update: (tagId: string, body: UpdateTagRequest$1) => Promise<{
1635
+ external_id: string;
1636
+ workspace_ext_id: string;
1637
+ name: string;
1638
+ instruction?: string | null | undefined;
1639
+ tag_type: {
1640
+ type: "checkbox" | "text" | "number" | "select" | "search" | "date";
1641
+ options: string[];
1642
+ };
1643
+ shared: boolean;
1644
+ parent_ext_id?: string | null | undefined;
1645
+ doctag_count: number;
1646
+ created_by_ext_id: string;
1647
+ updated_by_ext_id?: string | null | undefined;
1648
+ created_at: string;
1649
+ updated_at: string;
1650
+ }>;
1651
+ };
1652
+ readonly doctags: {
1653
+ assign: (tagId: string, docIds: string[], note?: string | null) => Promise<{
1654
+ doc_ext_id: string;
1655
+ tag_ext_id: string;
1656
+ note?: string | null | undefined;
1657
+ citations?: {
1658
+ [x: string]: {
1659
+ chunk_ids: string[];
1660
+ scores: number[];
1661
+ statement: string;
1662
+ offset_start: number;
1663
+ offset_end: number;
1664
+ };
1665
+ } | null | undefined;
1666
+ created_by_ext_id: string;
1667
+ updated_by_ext_id?: string | null | undefined;
1668
+ created_at: string;
1669
+ updated_at: string;
1670
+ }[]>;
1671
+ remove: (tagId: string, docIds: string[]) => Promise<void>;
1672
+ update: (tagId: string, docId: string, updates: {
1673
+ note?: string | null;
1674
+ citations?: Record<string, CitationData$1> | null;
1675
+ }) => Promise<{
1676
+ doc_ext_id: string;
1677
+ tag_ext_id: string;
1678
+ note?: string | null | undefined;
1679
+ citations?: {
1680
+ [x: string]: {
1681
+ chunk_ids: string[];
1682
+ scores: number[];
1683
+ statement: string;
1684
+ offset_start: number;
1685
+ offset_end: number;
1686
+ };
1687
+ } | null | undefined;
1688
+ created_by_ext_id: string;
1689
+ updated_by_ext_id?: string | null | undefined;
1690
+ created_at: string;
1691
+ updated_at: string;
1692
+ }>;
1693
+ generate: (tagIds: string[], docIds: string[]) => Promise<{
1694
+ doc_ext_ids: string[];
1695
+ tag_ext_ids: string[];
1696
+ }>;
1697
+ };
1698
+ readonly contacts: {
1699
+ list: () => Promise<{
1700
+ external_id: string;
1701
+ email: string;
1702
+ user?: {
1703
+ external_id: string;
1704
+ email: string;
1705
+ given_name: string;
1706
+ family_name: string;
1707
+ picture?: string | null | undefined;
1708
+ encryption_public_key: string;
1709
+ } | null | undefined;
1710
+ status: "invitation_pending" | "invitation_expired" | "registered";
1711
+ created_at: string;
1712
+ }[]>;
1713
+ add: (emails: string[]) => Promise<{
1714
+ external_id: string;
1715
+ email: string;
1716
+ user?: {
1717
+ external_id: string;
1718
+ email: string;
1719
+ given_name: string;
1720
+ family_name: string;
1721
+ picture?: string | null | undefined;
1722
+ encryption_public_key: string;
1723
+ } | null | undefined;
1724
+ status: "invitation_pending" | "invitation_expired" | "registered";
1725
+ created_at: string;
1726
+ }[]>;
1727
+ remove: (contactIds: string[]) => Promise<void>;
1728
+ groupByStatus: typeof groupContactsByStatus;
1729
+ };
1730
+ readonly dm: {
1731
+ list: () => Promise<{
1732
+ type: components["schemas"]["NotificationType"];
1733
+ external_id: string;
1734
+ sender: {
1735
+ external_id: string;
1736
+ email: string;
1737
+ given_name: string;
1738
+ family_name: string;
1739
+ picture?: string | null | undefined;
1740
+ encryption_public_key: string;
1741
+ };
1742
+ recipient: {
1743
+ external_id: string;
1744
+ email: string;
1745
+ given_name: string;
1746
+ family_name: string;
1747
+ picture?: string | null | undefined;
1748
+ encryption_public_key: string;
1749
+ };
1750
+ workspace_ext_id?: string | null | undefined;
1751
+ content?: string | null | undefined;
1752
+ read: boolean;
1753
+ created_at: string;
1754
+ updated_at: string;
1755
+ }[]>;
1756
+ send: (messages: Array<{
1757
+ recipient_ext_id: string;
1758
+ content: string;
1759
+ }>) => Promise<{
1760
+ type: components["schemas"]["NotificationType"];
1761
+ external_id: string;
1762
+ sender: {
1763
+ external_id: string;
1764
+ email: string;
1765
+ given_name: string;
1766
+ family_name: string;
1767
+ picture?: string | null | undefined;
1768
+ encryption_public_key: string;
1769
+ };
1770
+ recipient: {
1771
+ external_id: string;
1772
+ email: string;
1773
+ given_name: string;
1774
+ family_name: string;
1775
+ picture?: string | null | undefined;
1776
+ encryption_public_key: string;
1777
+ };
1778
+ workspace_ext_id?: string | null | undefined;
1779
+ content?: string | null | undefined;
1780
+ read: boolean;
1781
+ created_at: string;
1782
+ updated_at: string;
1783
+ }[]>;
1784
+ markRead: (messageIds: string[]) => Promise<{
1785
+ type: components["schemas"]["NotificationType"];
1786
+ external_id: string;
1787
+ sender: {
1788
+ external_id: string;
1789
+ email: string;
1790
+ given_name: string;
1791
+ family_name: string;
1792
+ picture?: string | null | undefined;
1793
+ encryption_public_key: string;
1794
+ };
1795
+ recipient: {
1796
+ external_id: string;
1797
+ email: string;
1798
+ given_name: string;
1799
+ family_name: string;
1800
+ picture?: string | null | undefined;
1801
+ encryption_public_key: string;
1802
+ };
1803
+ workspace_ext_id?: string | null | undefined;
1804
+ content?: string | null | undefined;
1805
+ read: boolean;
1806
+ created_at: string;
1807
+ updated_at: string;
1808
+ }[]>;
1809
+ delete: (messageIds: string[]) => Promise<void>;
1810
+ };
1811
+ readonly settings: {
1812
+ get: () => Promise<{
1813
+ [x: string]: unknown;
1814
+ subscription?: {
1815
+ status: string;
1816
+ trial_expires?: number | null | undefined;
1817
+ } | null | undefined;
1818
+ last_workspace?: string | null | undefined;
1819
+ pinned_workspaces: string[];
1820
+ pinned_templates: string[];
1821
+ tableviews: {
1822
+ workspace: string;
1823
+ name: string;
1824
+ columns: string[];
1825
+ }[];
1826
+ developer: boolean;
1827
+ show_document_navigator: boolean;
1828
+ show_thread_visualization: boolean;
1829
+ show_smart_search: boolean;
1830
+ show_security_settings: boolean;
1831
+ show_invite_tab: boolean;
1832
+ show_help_page: boolean;
1833
+ show_templates: boolean;
1834
+ show_pa_mode: boolean;
1835
+ hide_online_status: boolean;
1836
+ muted_users: string[];
1837
+ }>;
1838
+ update: (body: UserSettingsUpdate$1) => Promise<void>;
1839
+ };
1840
+ readonly agentConfig: {
1841
+ list: () => Promise<{
1842
+ versions: {
1843
+ external_id: string;
1844
+ title: string | null;
1845
+ created_at: string;
1846
+ }[];
1847
+ }>;
1848
+ get: (configId: string) => Promise<{
1849
+ Agents: {
1850
+ ENABLED: boolean;
1851
+ HUMAN_IN_THE_LOOP: boolean;
1852
+ WEB_SEARCH?: {
1853
+ ENABLED: boolean;
1854
+ SAVE_SOURCES: boolean;
1855
+ } | undefined;
1856
+ RUN_CODE?: {
1857
+ ENABLED: boolean;
1858
+ IMAGE: string;
1859
+ TIMEOUT_SECONDS: number;
1860
+ MEMORY_LIMIT: string;
1861
+ NETWORK: string;
1862
+ } | undefined;
1863
+ MCP_TOOLS: string[];
1864
+ PLANNING_ENABLED: boolean;
1865
+ SUGGESTED_QUERIES: boolean;
1866
+ ARTIFACTS_ENABLED: boolean;
1867
+ VISION_ENABLED: boolean;
1868
+ DOC_INDEX_COMPACT_THRESHOLD: number;
1869
+ DOC_INDEX_SKIP_THRESHOLD: number;
1870
+ PERSONAL_AGENT: boolean;
1871
+ MEMORY_ENABLED: boolean;
1872
+ SKILLS_ENABLED: boolean;
1873
+ SKILL_CREATION: boolean;
1874
+ REVIEW_ENABLED: boolean;
1875
+ PERSONA: string;
1876
+ AGENT_MODEL_NAME: string;
1877
+ AGENT_API_TYPE: "local" | "remote";
1878
+ LLM_AGENT_TEMPERATURE: number;
1879
+ AGENT_MAX_TOKENS: number;
1880
+ AGENT_MAX_ITERATIONS: number;
1881
+ MAX_PASSAGE_PAGES: number;
1882
+ AGENT_HISTORY_CHAR_THRESHOLD: number;
1883
+ AGENT_SYSTEM_PROMPT: string;
1884
+ };
1885
+ QueryLLM: {
1886
+ API_TYPE: "local" | "remote";
1887
+ MODEL_NAME: string;
1888
+ SYSTEM_INSTRUCTION: string;
1889
+ MAX_CHAR_SIZE_TO_ANSWER: number;
1890
+ TEMPERATURE: number;
1891
+ MAX_TOKENS: number;
1892
+ };
1893
+ ReviewLLM: {
1894
+ API_TYPE: "local" | "remote";
1895
+ MODEL_NAME: string;
1896
+ SYSTEM_INSTRUCTION: string;
1897
+ TEMPERATURE: number;
1898
+ MAX_TOKENS: number;
1899
+ MAX_CHAR_SIZE_TO_ANSWER: number;
1900
+ };
1901
+ EvaluatorLLM: {
1902
+ API_TYPE: "local" | "remote";
1903
+ MODEL_NAME: string;
1904
+ SYSTEM_INSTRUCTION: string;
1905
+ TEMPERATURE: number;
1906
+ MAX_TOKENS: number;
1907
+ MAX_CHAR_SIZE_TO_ANSWER: number;
1908
+ };
1909
+ TitleLLM: {
1910
+ API_TYPE: "local" | "remote";
1911
+ MODEL_NAME: string;
1912
+ SYSTEM_INSTRUCTION: string;
1913
+ MAX_CHAR_SIZE_TO_ANSWER: number;
1914
+ TEMPERATURE: number;
1915
+ MAX_TOKENS: number;
1916
+ };
1917
+ SummariseLLM: {
1918
+ API_TYPE: "local" | "remote";
1919
+ MODEL_NAME: string;
1920
+ SYSTEM_INSTRUCTION: string;
1921
+ TEMPERATURE: number;
1922
+ MAX_TOKENS: number;
1923
+ MAX_CHAR_SIZE_TO_ANSWER: number;
1924
+ COMPACTION_THRESHOLD_TOKENS: number;
1925
+ COMPACTION_KEEP_RECENT: number;
1926
+ };
1927
+ DoctagLLM: {
1928
+ API_TYPE: "local" | "remote";
1929
+ MODEL_NAME: string;
1930
+ SYSTEM_INSTRUCTION: string;
1931
+ MAX_CHAR_CONTEXT_TO_ANSWER: number;
1932
+ TEMPERATURE: number;
1933
+ MAX_TOKENS: number;
1934
+ MAX_CONCURRENT_DOCS: number;
1935
+ DEFAULT_METADATA_TAGS: {
1936
+ name: string;
1937
+ instruction?: string | null | undefined;
1938
+ tag_type?: {
1939
+ type: "checkbox" | "text" | "number" | "select" | "search" | "date";
1940
+ options: string[];
1941
+ } | undefined;
1942
+ }[];
1943
+ };
1944
+ MemoryLLM: {
1945
+ API_TYPE: "local" | "remote";
1946
+ MODEL_NAME: string;
1947
+ SYSTEM_INSTRUCTION: string;
1948
+ TEMPERATURE: number;
1949
+ MAX_TOKENS: number;
1950
+ MAX_CHAR_CONTEXT: number;
1951
+ MAX_CONCURRENT: number;
1952
+ };
1953
+ PlanningLLM: {
1954
+ API_TYPE: "local" | "remote";
1955
+ MODEL_NAME: string;
1956
+ SYSTEM_INSTRUCTION: string;
1957
+ TEMPERATURE: number;
1958
+ MAX_TOKENS: number;
1959
+ MAX_CHAR_SIZE_TO_ANSWER: number;
1960
+ APPROVAL_TIMEOUT: number;
1961
+ };
1962
+ VisionLLM: {
1963
+ API_TYPE: "local" | "remote";
1964
+ MODEL_NAME: string;
1965
+ TEMPERATURE: number;
1966
+ MAX_TOKENS: number;
1967
+ MAX_PAGES_PER_CALL: number;
1968
+ IMAGE_MAX_DIMENSION: number;
1969
+ };
1970
+ CodeAgent: {
1971
+ API_TYPE: "local" | "remote";
1972
+ MODEL_NAME: string;
1973
+ SYSTEM_INSTRUCTION: string;
1974
+ TEMPERATURE: number;
1975
+ MAX_TOKENS: number;
1976
+ MAX_ITERATIONS: number;
1977
+ };
1978
+ ModelCitation: {
1979
+ SIM_THREASHOLD: number;
1980
+ MIN_CHAR_SIZE_TO_ANSWER: number;
1981
+ MAX_NUMB_CITATIONS: number;
1982
+ };
1983
+ Retriever: {
1984
+ MIN_RETRIEVAL_SIM_SCORE: number;
1985
+ MAX_DISTINCT_DOCUMENTS: number;
1986
+ MAX_TOTAL_CHUNKS_TO_RETRIEVE: number;
1987
+ GROUP_SIZE: number;
1988
+ SEARCH_MODE: components["schemas"]["SearchMode"];
1989
+ HYBRID_DENSE_WEIGHT: number;
1990
+ HYBRID_SPARSE_WEIGHT: number;
1991
+ HYBRID_RERANKER_WEIGHT: number;
1992
+ };
1993
+ Reranker: {
1994
+ MIN_SCORE: number;
1995
+ MAX_NUMB_OF_CHUNKS: number;
1996
+ MAX_CONCURRENT_REQUESTS: number;
1997
+ MODEL_NAME: string;
1998
+ API_TYPE: "local" | "remote";
1999
+ };
2000
+ Parser: {
2001
+ SKIP_DUPLICATES: boolean;
2002
+ };
2003
+ Chunker: {
2004
+ MAX_CHUNK_TOKENS: number;
2005
+ TOKENIZER_TYPE: "tiktoken" | "huggingface";
2006
+ TOKENIZER_NAME: string;
2007
+ };
2008
+ Embedder: {
2009
+ MODEL_NAME: string;
2010
+ API_TYPE: "local" | "remote";
2011
+ BATCH_SIZE: number;
2012
+ MAX_CONCURRENT_REQUESTS: number;
2013
+ DOCUMENT_PREFIX: string;
2014
+ QUERY_PREFIX: string;
2015
+ };
2016
+ KeywordEmbedder: {
2017
+ DIMENSION_SPACE: number;
2018
+ FILTER_STOPWORDS: boolean;
2019
+ BM25_K1: number;
2020
+ BM25_B: number;
2021
+ BM25_AVGDL: number;
2022
+ };
2023
+ } | {
2024
+ Agents: {
2025
+ [x: string]: string | boolean;
2026
+ };
2027
+ }>;
2028
+ save: (body: ConfigUpdateData$1) => Promise<{
2029
+ external_id: string;
2030
+ title: string | null;
2031
+ created_at: string;
2032
+ }>;
2033
+ delete: (configId: string) => Promise<{
2034
+ detail: string;
2035
+ }>;
2036
+ getSchema: () => Promise<unknown>;
2037
+ getModels: () => Promise<{
2038
+ models: {
2039
+ model_name: string;
2040
+ api_type: string;
2041
+ tags?: string[] | null | undefined;
2042
+ max_input_tokens?: number | null | undefined;
2043
+ max_output_tokens?: number | null | undefined;
2044
+ input_cost_per_token?: number | null | undefined;
2045
+ output_cost_per_token?: number | null | undefined;
2046
+ provider?: string | null | undefined;
2047
+ mode?: string | null | undefined;
2048
+ supports_vision?: boolean | null | undefined;
2049
+ supports_reasoning?: boolean | null | undefined;
2050
+ supports_function_calling?: boolean | null | undefined;
2051
+ supports_response_schema?: boolean | null | undefined;
2052
+ }[];
2053
+ }>;
2054
+ };
2055
+ readonly health: {
2056
+ check: () => Promise<{
2057
+ status: string;
2058
+ backend_git_hash?: string | null | undefined;
2059
+ frontend_docker_version?: string | null | undefined;
2060
+ services: {
2061
+ name: string;
2062
+ status: string;
2063
+ detail?: string | null | undefined;
2064
+ service_info?: {
2065
+ [x: string]: unknown;
2066
+ } | null | undefined;
2067
+ }[];
2068
+ models_health?: {
2069
+ application: string;
2070
+ models: {
2071
+ model: string;
2072
+ status: string;
2073
+ detail?: string | null | undefined;
2074
+ }[];
2075
+ } | null | undefined;
2076
+ available_models: string[];
2077
+ }>;
2078
+ models: () => Promise<{
2079
+ models: {
2080
+ model_name: string;
2081
+ api_type: string;
2082
+ tags?: string[] | null | undefined;
2083
+ max_input_tokens?: number | null | undefined;
2084
+ max_output_tokens?: number | null | undefined;
2085
+ input_cost_per_token?: number | null | undefined;
2086
+ output_cost_per_token?: number | null | undefined;
2087
+ provider?: string | null | undefined;
2088
+ mode?: string | null | undefined;
2089
+ supports_vision?: boolean | null | undefined;
2090
+ supports_reasoning?: boolean | null | undefined;
2091
+ supports_function_calling?: boolean | null | undefined;
2092
+ supports_response_schema?: boolean | null | undefined;
2093
+ }[];
2094
+ }>;
2095
+ remoteModels: () => Promise<{
2096
+ application: string;
2097
+ models: {
2098
+ model: string;
2099
+ status: string;
2100
+ detail?: string | null | undefined;
2101
+ }[];
2102
+ }>;
2103
+ mcpTools: () => Promise<{
2104
+ tools: {
2105
+ name: string;
2106
+ description: string;
2107
+ server_name: string;
2108
+ }[];
2109
+ }>;
2110
+ };
2111
+ readonly files: {
2112
+ list: (options?: ListFilesOptions) => Promise<{
2113
+ object: string;
2114
+ data: {
2115
+ id: string;
2116
+ object: string;
2117
+ bytes: number;
2118
+ created_at: number;
2119
+ filename: string;
2120
+ purpose: string;
2121
+ status: string;
2122
+ expires_at?: number | null | undefined;
2123
+ status_details?: string | null | undefined;
2124
+ }[];
2125
+ has_more: boolean;
2126
+ first_id?: string | null | undefined;
2127
+ last_id?: string | null | undefined;
2128
+ }>;
2129
+ get: (fileId: string) => Promise<{
2130
+ id: string;
2131
+ object: string;
2132
+ bytes: number;
2133
+ created_at: number;
2134
+ filename: string;
2135
+ purpose: string;
2136
+ status: string;
2137
+ expires_at?: number | null | undefined;
2138
+ status_details?: string | null | undefined;
2139
+ }>;
2140
+ delete: (fileId: string) => Promise<{
2141
+ id: string;
2142
+ object: string;
2143
+ deleted: boolean;
2144
+ }>;
2145
+ upload: (fileData: Blob, fileName: string, purpose?: string) => Promise<{
2146
+ id: string;
2147
+ object: string;
2148
+ bytes: number;
2149
+ created_at: number;
2150
+ filename: string;
2151
+ purpose: string;
2152
+ status: string;
2153
+ expires_at?: number | null;
2154
+ status_details?: string | null;
2155
+ }>;
2156
+ getContent: (fileId: string) => Promise<Response>;
2157
+ };
2158
+ private requireClient;
2159
+ private requireLogin;
2160
+ private requireWorkspace;
2161
+ }
2162
+
2163
+ /**
2164
+ * Workspace operations — list, create, delete, update, users, copy.
2165
+ */
2166
+
2167
+ type WorkspaceUpdateRequest = components['schemas']['WorkspaceUpdateRequest'];
2168
+ declare function listWorkspaces(arbi: ArbiClient): Promise<{
2169
+ external_id: string;
2170
+ name: string;
2171
+ description: string | null;
2172
+ is_public: boolean;
2173
+ created_by_ext_id: string;
2174
+ updated_by_ext_id?: string | null | undefined;
2175
+ created_at: string;
2176
+ updated_at: string;
2177
+ wrapped_key?: string | null | undefined;
2178
+ shared_conversation_count: number;
2179
+ private_conversation_count: number;
2180
+ shared_document_count: number;
2181
+ private_document_count: number;
2182
+ user_files_mb: number;
2183
+ users: {
2184
+ user: {
2185
+ external_id: string;
2186
+ email: string;
2187
+ given_name: string;
2188
+ family_name: string;
2189
+ picture?: string | null | undefined;
2190
+ encryption_public_key: string;
2191
+ };
2192
+ role: components["schemas"]["WorkspaceRole"];
2193
+ joined_at: string;
2194
+ conversation_count: number;
2195
+ document_count: number;
2196
+ }[];
2197
+ }[]>;
2198
+ declare function createWorkspace(arbi: ArbiClient, name: string, description?: string | null, isPublic?: boolean): Promise<{
2199
+ external_id: string;
2200
+ name: string;
2201
+ description: string | null;
2202
+ is_public: boolean;
2203
+ created_by_ext_id: string;
2204
+ updated_by_ext_id?: string | null | undefined;
2205
+ created_at: string;
2206
+ updated_at: string;
2207
+ wrapped_key?: string | null | undefined;
2208
+ shared_conversation_count: number;
2209
+ private_conversation_count: number;
2210
+ shared_document_count: number;
2211
+ private_document_count: number;
2212
+ user_files_mb: number;
2213
+ users: {
2214
+ user: {
2215
+ external_id: string;
2216
+ email: string;
2217
+ given_name: string;
2218
+ family_name: string;
2219
+ picture?: string | null | undefined;
2220
+ encryption_public_key: string;
2221
+ };
2222
+ role: components["schemas"]["WorkspaceRole"];
2223
+ joined_at: string;
2224
+ conversation_count: number;
2225
+ document_count: number;
2226
+ }[];
2227
+ }>;
2228
+ declare function deleteWorkspaces(arbi: ArbiClient, workspaceIds: string[]): Promise<void>;
2229
+ declare function updateWorkspace(arbi: ArbiClient, body: WorkspaceUpdateRequest): Promise<{
2230
+ external_id: string;
2231
+ name: string;
2232
+ description: string | null;
2233
+ is_public: boolean;
2234
+ created_by_ext_id: string;
2235
+ updated_by_ext_id?: string | null | undefined;
2236
+ created_at: string;
2237
+ updated_at: string;
2238
+ wrapped_key?: string | null | undefined;
2239
+ shared_conversation_count: number;
2240
+ private_conversation_count: number;
2241
+ shared_document_count: number;
2242
+ private_document_count: number;
2243
+ user_files_mb: number;
2244
+ users: {
2245
+ user: {
2246
+ external_id: string;
2247
+ email: string;
2248
+ given_name: string;
2249
+ family_name: string;
2250
+ picture?: string | null | undefined;
2251
+ encryption_public_key: string;
2252
+ };
2253
+ role: components["schemas"]["WorkspaceRole"];
2254
+ joined_at: string;
2255
+ conversation_count: number;
2256
+ document_count: number;
2257
+ }[];
2258
+ }>;
2259
+ declare function listWorkspaceUsers(arbi: ArbiClient): Promise<{
2260
+ user: {
2261
+ external_id: string;
2262
+ email: string;
2263
+ given_name: string;
2264
+ family_name: string;
2265
+ picture?: string | null | undefined;
2266
+ encryption_public_key: string;
2267
+ };
2268
+ role: components["schemas"]["WorkspaceRole"];
2269
+ joined_at: string;
2270
+ conversation_count: number;
2271
+ document_count: number;
2272
+ }[]>;
2273
+ declare function addWorkspaceUsers(arbi: ArbiClient, emails: string[], role?: 'owner' | 'collaborator' | 'guest'): Promise<{
2274
+ user: {
2275
+ external_id: string;
2276
+ email: string;
2277
+ given_name: string;
2278
+ family_name: string;
2279
+ picture?: string | null | undefined;
2280
+ encryption_public_key: string;
2281
+ };
2282
+ role: components["schemas"]["WorkspaceRole"];
2283
+ joined_at: string;
2284
+ conversation_count: number;
2285
+ document_count: number;
2286
+ }[]>;
2287
+ declare function removeWorkspaceUsers(arbi: ArbiClient, userIds: string[]): Promise<void>;
2288
+ declare function setUserRole(arbi: ArbiClient, userIds: string[], role: 'owner' | 'collaborator' | 'guest'): Promise<{
2289
+ user: {
2290
+ external_id: string;
2291
+ email: string;
2292
+ given_name: string;
2293
+ family_name: string;
2294
+ picture?: string | null | undefined;
2295
+ encryption_public_key: string;
2296
+ };
2297
+ role: components["schemas"]["WorkspaceRole"];
2298
+ joined_at: string;
2299
+ conversation_count: number;
2300
+ document_count: number;
2301
+ }[]>;
2302
+ declare function copyDocuments(arbi: ArbiClient, targetWorkspaceId: string, docIds: string[], targetWorkspaceKey: string): Promise<{
2303
+ detail: string;
2304
+ documents_copied: number;
2305
+ results: {
2306
+ source_doc_ext_id: string;
2307
+ success: boolean;
2308
+ new_doc_ext_id?: string | null | undefined;
2309
+ error?: string | null | undefined;
2310
+ }[];
2311
+ }>;
2312
+
2313
+ declare const workspaces_addWorkspaceUsers: typeof addWorkspaceUsers;
2314
+ declare const workspaces_copyDocuments: typeof copyDocuments;
2315
+ declare const workspaces_createWorkspace: typeof createWorkspace;
2316
+ declare const workspaces_deleteWorkspaces: typeof deleteWorkspaces;
2317
+ declare const workspaces_listWorkspaceUsers: typeof listWorkspaceUsers;
2318
+ declare const workspaces_listWorkspaces: typeof listWorkspaces;
2319
+ declare const workspaces_removeWorkspaceUsers: typeof removeWorkspaceUsers;
2320
+ declare const workspaces_setUserRole: typeof setUserRole;
2321
+ declare const workspaces_updateWorkspace: typeof updateWorkspace;
2322
+ declare namespace workspaces {
2323
+ 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 };
2324
+ }
2325
+
2326
+ /**
2327
+ * Tag operations — list, create, delete, update.
2328
+ */
2329
+
2330
+ type UpdateTagRequest = components['schemas']['UpdateTagRequest'];
2331
+ declare function listTags(arbi: ArbiClient): Promise<{
2332
+ external_id: string;
2333
+ workspace_ext_id: string;
2334
+ name: string;
2335
+ instruction?: string | null | undefined;
2336
+ tag_type: {
2337
+ type: "checkbox" | "text" | "number" | "select" | "search" | "date";
2338
+ options: string[];
2339
+ };
2340
+ shared: boolean;
2341
+ parent_ext_id?: string | null | undefined;
2342
+ doctag_count: number;
2343
+ created_by_ext_id: string;
2344
+ updated_by_ext_id?: string | null | undefined;
2345
+ created_at: string;
2346
+ updated_at: string;
2347
+ }[]>;
2348
+ declare function createTag(arbi: ArbiClient, options: {
2349
+ name: string;
2350
+ workspaceId?: string;
2351
+ tagType?: components['schemas']['TagFormat'];
2352
+ instruction?: string | null;
2353
+ shared?: boolean;
2354
+ }): Promise<{
2355
+ external_id: string;
2356
+ workspace_ext_id: string;
2357
+ name: string;
2358
+ instruction?: string | null | undefined;
2359
+ tag_type: {
2360
+ type: "checkbox" | "text" | "number" | "select" | "search" | "date";
2361
+ options: string[];
2362
+ };
2363
+ shared: boolean;
2364
+ parent_ext_id?: string | null | undefined;
2365
+ doctag_count: number;
2366
+ created_by_ext_id: string;
2367
+ updated_by_ext_id?: string | null | undefined;
2368
+ created_at: string;
2369
+ updated_at: string;
2370
+ }>;
2371
+ declare function deleteTag(arbi: ArbiClient, tagId: string): Promise<{
2372
+ detail: string;
2373
+ }>;
2374
+ declare function updateTag(arbi: ArbiClient, tagId: string, body: UpdateTagRequest): Promise<{
2375
+ external_id: string;
2376
+ workspace_ext_id: string;
2377
+ name: string;
2378
+ instruction?: string | null | undefined;
2379
+ tag_type: {
2380
+ type: "checkbox" | "text" | "number" | "select" | "search" | "date";
2381
+ options: string[];
2382
+ };
2383
+ shared: boolean;
2384
+ parent_ext_id?: string | null | undefined;
2385
+ doctag_count: number;
2386
+ created_by_ext_id: string;
2387
+ updated_by_ext_id?: string | null | undefined;
2388
+ created_at: string;
2389
+ updated_at: string;
2390
+ }>;
2391
+
2392
+ declare const tags_createTag: typeof createTag;
2393
+ declare const tags_deleteTag: typeof deleteTag;
2394
+ declare const tags_listTags: typeof listTags;
2395
+ declare const tags_updateTag: typeof updateTag;
2396
+ declare namespace tags {
2397
+ export { tags_createTag as createTag, tags_deleteTag as deleteTag, tags_listTags as listTags, tags_updateTag as updateTag };
2398
+ }
2399
+
2400
+ /**
2401
+ * Conversation operations — list, threads, delete, share, title, messages.
2402
+ */
2403
+
2404
+ declare function listConversations(arbi: ArbiClient): Promise<{
2405
+ external_id: string;
2406
+ title: string | null;
2407
+ created_by_ext_id: string;
2408
+ updated_by_ext_id?: string | null | undefined;
2409
+ created_at: string;
2410
+ updated_at: string;
2411
+ is_shared: boolean;
2412
+ message_count: number;
2413
+ }[]>;
2414
+ declare function getConversationThreads(arbi: ArbiClient, conversationId: string): Promise<{
2415
+ conversation_ext_id: string;
2416
+ threads: {
2417
+ leaf_message_ext_id: string;
2418
+ history: {
2419
+ role: "user" | "assistant" | "system";
2420
+ content: string;
2421
+ tools?: {
2422
+ [x: string]: {
2423
+ name: "model_citation";
2424
+ description: string;
2425
+ tool_responses: {
2426
+ [x: string]: {
2427
+ chunk_ids: string[];
2428
+ scores: number[];
2429
+ statement: string;
2430
+ offset_start: number;
2431
+ offset_end: number;
2432
+ };
2433
+ };
2434
+ } | {
2435
+ name: "retrieval_chunk";
2436
+ description: string;
2437
+ tool_args: {
2438
+ doc_ext_ids: string[];
2439
+ search_mode?: ("semantic" | "keyword" | "hybrid") | null | undefined;
2440
+ };
2441
+ tool_responses: {
2442
+ [x: string]: {
2443
+ metadata: {
2444
+ workspace_ext_id?: string | null | undefined;
2445
+ doc_ext_id?: string | null | undefined;
2446
+ doc_title?: string | null | undefined;
2447
+ chunk_id?: string | null | undefined;
2448
+ chunk_ext_id: string;
2449
+ chunk_pg_idx: number;
2450
+ chunk_doc_idx: number;
2451
+ page_number: number;
2452
+ score?: number | null | undefined;
2453
+ rerank_score?: number | null | undefined;
2454
+ tokens?: number | null | undefined;
2455
+ created_at: string;
2456
+ heading: boolean;
2457
+ bbox?: number[] | null | undefined;
2458
+ element_type?: string | null | undefined;
2459
+ heading_level?: number | null | undefined;
2460
+ };
2461
+ content: string;
2462
+ }[];
2463
+ };
2464
+ } | {
2465
+ name: "retrieval_full_context";
2466
+ description: string;
2467
+ tool_args: {
2468
+ doc_ext_ids: string[];
2469
+ from_ref?: string | null | undefined;
2470
+ to_ref?: string | null | undefined;
2471
+ };
2472
+ tool_responses: {
2473
+ [x: string]: {
2474
+ metadata: {
2475
+ workspace_ext_id?: string | null | undefined;
2476
+ doc_ext_id?: string | null | undefined;
2477
+ doc_title?: string | null | undefined;
2478
+ chunk_id?: string | null | undefined;
2479
+ chunk_ext_id: string;
2480
+ chunk_pg_idx: number;
2481
+ chunk_doc_idx: number;
2482
+ page_number: number;
2483
+ score?: number | null | undefined;
2484
+ rerank_score?: number | null | undefined;
2485
+ tokens?: number | null | undefined;
2486
+ created_at: string;
2487
+ heading: boolean;
2488
+ bbox?: number[] | null | undefined;
2489
+ element_type?: string | null | undefined;
2490
+ heading_level?: number | null | undefined;
2491
+ };
2492
+ content: string;
2493
+ }[];
2494
+ };
2495
+ } | {
2496
+ name: "retrieval_toc";
2497
+ description: string;
2498
+ tool_args: {
2499
+ doc_ext_ids: string[];
2500
+ };
2501
+ tool_responses: {
2502
+ [x: string]: {
2503
+ [x: string]: unknown;
2504
+ }[];
2505
+ };
2506
+ } | {
2507
+ name: "trace";
2508
+ description: string;
2509
+ trace_id?: string | null | undefined;
2510
+ start_time?: number | null | undefined;
2511
+ duration_seconds?: number | null | undefined;
2512
+ steps: {
2513
+ [x: string]: unknown;
2514
+ }[];
2515
+ } | {
2516
+ name: "compaction";
2517
+ description: string;
2518
+ tool_args: {
2519
+ source_conversation_ext_id: string;
2520
+ source_leaf_message_ext_id: string;
2521
+ };
2522
+ tool_responses: {
2523
+ [x: string]: string;
2524
+ };
2525
+ } | {
2526
+ name: "personal_agent";
2527
+ description: string;
2528
+ tool_args: {
2529
+ task: string;
2530
+ };
2531
+ tool_responses: {
2532
+ [x: string]: unknown;
2533
+ };
2534
+ } | {
2535
+ name: "stream_events";
2536
+ events: {
2537
+ [x: string]: unknown;
2538
+ }[];
2539
+ };
2540
+ } | undefined;
2541
+ config_ext_id?: string | null | undefined;
2542
+ shared: boolean;
2543
+ tokens: number;
2544
+ external_id: string;
2545
+ created_at: string;
2546
+ created_by_ext_id: string;
2547
+ conversation_ext_id: string;
2548
+ parent_message_ext_id?: string | null | undefined;
2549
+ }[];
2550
+ }[];
2551
+ }>;
2552
+ declare function deleteConversation(arbi: ArbiClient, conversationId: string): Promise<{
2553
+ detail: string;
2554
+ }>;
2555
+ declare function shareConversation(arbi: ArbiClient, conversationId: string): Promise<{
2556
+ detail: string;
2557
+ }>;
2558
+ declare function updateConversationTitle(arbi: ArbiClient, conversationId: string, title: string): Promise<{
2559
+ detail: string;
2560
+ title: string;
2561
+ }>;
2562
+ declare function getMessage(arbi: ArbiClient, messageId: string): Promise<{
2563
+ role: "user" | "assistant" | "system";
2564
+ content: string;
2565
+ tools?: {
2566
+ [x: string]: {
2567
+ name: "model_citation";
2568
+ description: string;
2569
+ tool_responses: {
2570
+ [x: string]: {
2571
+ chunk_ids: string[];
2572
+ scores: number[];
2573
+ statement: string;
2574
+ offset_start: number;
2575
+ offset_end: number;
2576
+ };
2577
+ };
2578
+ } | {
2579
+ name: "retrieval_chunk";
2580
+ description: string;
2581
+ tool_args: {
2582
+ doc_ext_ids: string[];
2583
+ search_mode?: ("semantic" | "keyword" | "hybrid") | null | undefined;
2584
+ };
2585
+ tool_responses: {
2586
+ [x: string]: {
2587
+ metadata: {
2588
+ workspace_ext_id?: string | null | undefined;
2589
+ doc_ext_id?: string | null | undefined;
2590
+ doc_title?: string | null | undefined;
2591
+ chunk_id?: string | null | undefined;
2592
+ chunk_ext_id: string;
2593
+ chunk_pg_idx: number;
2594
+ chunk_doc_idx: number;
2595
+ page_number: number;
2596
+ score?: number | null | undefined;
2597
+ rerank_score?: number | null | undefined;
2598
+ tokens?: number | null | undefined;
2599
+ created_at: string;
2600
+ heading: boolean;
2601
+ bbox?: number[] | null | undefined;
2602
+ element_type?: string | null | undefined;
2603
+ heading_level?: number | null | undefined;
2604
+ };
2605
+ content: string;
2606
+ }[];
2607
+ };
2608
+ } | {
2609
+ name: "retrieval_full_context";
2610
+ description: string;
2611
+ tool_args: {
2612
+ doc_ext_ids: string[];
2613
+ from_ref?: string | null | undefined;
2614
+ to_ref?: string | null | undefined;
2615
+ };
2616
+ tool_responses: {
2617
+ [x: string]: {
2618
+ metadata: {
2619
+ workspace_ext_id?: string | null | undefined;
2620
+ doc_ext_id?: string | null | undefined;
2621
+ doc_title?: string | null | undefined;
2622
+ chunk_id?: string | null | undefined;
2623
+ chunk_ext_id: string;
2624
+ chunk_pg_idx: number;
2625
+ chunk_doc_idx: number;
2626
+ page_number: number;
2627
+ score?: number | null | undefined;
2628
+ rerank_score?: number | null | undefined;
2629
+ tokens?: number | null | undefined;
2630
+ created_at: string;
2631
+ heading: boolean;
2632
+ bbox?: number[] | null | undefined;
2633
+ element_type?: string | null | undefined;
2634
+ heading_level?: number | null | undefined;
2635
+ };
2636
+ content: string;
2637
+ }[];
2638
+ };
2639
+ } | {
2640
+ name: "retrieval_toc";
2641
+ description: string;
2642
+ tool_args: {
2643
+ doc_ext_ids: string[];
2644
+ };
2645
+ tool_responses: {
2646
+ [x: string]: {
2647
+ [x: string]: unknown;
2648
+ }[];
2649
+ };
2650
+ } | {
2651
+ name: "trace";
2652
+ description: string;
2653
+ trace_id?: string | null | undefined;
2654
+ start_time?: number | null | undefined;
2655
+ duration_seconds?: number | null | undefined;
2656
+ steps: {
2657
+ [x: string]: unknown;
2658
+ }[];
2659
+ } | {
2660
+ name: "compaction";
2661
+ description: string;
2662
+ tool_args: {
2663
+ source_conversation_ext_id: string;
2664
+ source_leaf_message_ext_id: string;
2665
+ };
2666
+ tool_responses: {
2667
+ [x: string]: string;
2668
+ };
2669
+ } | {
2670
+ name: "personal_agent";
2671
+ description: string;
2672
+ tool_args: {
2673
+ task: string;
2674
+ };
2675
+ tool_responses: {
2676
+ [x: string]: unknown;
2677
+ };
2678
+ } | {
2679
+ name: "stream_events";
2680
+ events: {
2681
+ [x: string]: unknown;
2682
+ }[];
2683
+ };
2684
+ } | undefined;
2685
+ config_ext_id?: string | null | undefined;
2686
+ shared: boolean;
2687
+ tokens: number;
2688
+ external_id: string;
2689
+ created_at: string;
2690
+ created_by_ext_id: string;
2691
+ conversation_ext_id: string;
2692
+ parent_message_ext_id?: string | null | undefined;
2693
+ }>;
2694
+ declare function deleteMessage(arbi: ArbiClient, messageId: string): Promise<{
2695
+ detail: string;
2696
+ }>;
2697
+
2698
+ declare const conversations_deleteConversation: typeof deleteConversation;
2699
+ declare const conversations_deleteMessage: typeof deleteMessage;
2700
+ declare const conversations_getConversationThreads: typeof getConversationThreads;
2701
+ declare const conversations_getMessage: typeof getMessage;
2702
+ declare const conversations_listConversations: typeof listConversations;
2703
+ declare const conversations_shareConversation: typeof shareConversation;
2704
+ declare const conversations_updateConversationTitle: typeof updateConversationTitle;
2705
+ declare namespace conversations {
2706
+ export { conversations_deleteConversation as deleteConversation, conversations_deleteMessage as deleteMessage, conversations_getConversationThreads as getConversationThreads, conversations_getMessage as getMessage, conversations_listConversations as listConversations, conversations_shareConversation as shareConversation, conversations_updateConversationTitle as updateConversationTitle };
2707
+ }
2708
+
2709
+ /**
2710
+ * Document-tag (doctag) operations — assign, remove, generate.
2711
+ */
2712
+
2713
+ type CitationData = components['schemas']['CitationData'];
2714
+ declare function assignDocTags(arbi: ArbiClient, tagId: string, docIds: string[], note?: string | null): Promise<{
2715
+ doc_ext_id: string;
2716
+ tag_ext_id: string;
2717
+ note?: string | null | undefined;
2718
+ citations?: {
2719
+ [x: string]: {
2720
+ chunk_ids: string[];
2721
+ scores: number[];
2722
+ statement: string;
2723
+ offset_start: number;
2724
+ offset_end: number;
2725
+ };
2726
+ } | null | undefined;
2727
+ created_by_ext_id: string;
2728
+ updated_by_ext_id?: string | null | undefined;
2729
+ created_at: string;
2730
+ updated_at: string;
2731
+ }[]>;
2732
+ declare function removeDocTags(arbi: ArbiClient, tagId: string, docIds: string[]): Promise<void>;
2733
+ declare function updateDocTag(arbi: ArbiClient, tagId: string, docId: string, updates: {
2734
+ note?: string | null;
2735
+ citations?: Record<string, CitationData> | null;
2736
+ }): Promise<{
2737
+ doc_ext_id: string;
2738
+ tag_ext_id: string;
2739
+ note?: string | null | undefined;
2740
+ citations?: {
2741
+ [x: string]: {
2742
+ chunk_ids: string[];
2743
+ scores: number[];
2744
+ statement: string;
2745
+ offset_start: number;
2746
+ offset_end: number;
2747
+ };
2748
+ } | null | undefined;
2749
+ created_by_ext_id: string;
2750
+ updated_by_ext_id?: string | null | undefined;
2751
+ created_at: string;
2752
+ updated_at: string;
2753
+ }>;
2754
+ declare function generateDocTags(arbi: ArbiClient, tagIds: string[], docIds: string[]): Promise<{
2755
+ doc_ext_ids: string[];
2756
+ tag_ext_ids: string[];
2757
+ }>;
2758
+
2759
+ declare const doctags_assignDocTags: typeof assignDocTags;
2760
+ declare const doctags_generateDocTags: typeof generateDocTags;
2761
+ declare const doctags_removeDocTags: typeof removeDocTags;
2762
+ declare const doctags_updateDocTag: typeof updateDocTag;
2763
+ declare namespace doctags {
2764
+ export { doctags_assignDocTags as assignDocTags, doctags_generateDocTags as generateDocTags, doctags_removeDocTags as removeDocTags, doctags_updateDocTag as updateDocTag };
2765
+ }
2766
+
2767
+ declare function listDMs(arbi: ArbiClient): Promise<{
2768
+ type: _arbidocs_client.components["schemas"]["NotificationType"];
2769
+ external_id: string;
2770
+ sender: {
2771
+ external_id: string;
2772
+ email: string;
2773
+ given_name: string;
2774
+ family_name: string;
2775
+ picture?: string | null | undefined;
2776
+ encryption_public_key: string;
2777
+ };
2778
+ recipient: {
2779
+ external_id: string;
2780
+ email: string;
2781
+ given_name: string;
2782
+ family_name: string;
2783
+ picture?: string | null | undefined;
2784
+ encryption_public_key: string;
2785
+ };
2786
+ workspace_ext_id?: string | null | undefined;
2787
+ content?: string | null | undefined;
2788
+ read: boolean;
2789
+ created_at: string;
2790
+ updated_at: string;
2791
+ }[]>;
2792
+ declare function sendDM(arbi: ArbiClient, messages: Array<{
2793
+ recipient_ext_id: string;
2794
+ content: string;
2795
+ }>): Promise<{
2796
+ type: _arbidocs_client.components["schemas"]["NotificationType"];
2797
+ external_id: string;
2798
+ sender: {
2799
+ external_id: string;
2800
+ email: string;
2801
+ given_name: string;
2802
+ family_name: string;
2803
+ picture?: string | null | undefined;
2804
+ encryption_public_key: string;
2805
+ };
2806
+ recipient: {
2807
+ external_id: string;
2808
+ email: string;
2809
+ given_name: string;
2810
+ family_name: string;
2811
+ picture?: string | null | undefined;
2812
+ encryption_public_key: string;
2813
+ };
2814
+ workspace_ext_id?: string | null | undefined;
2815
+ content?: string | null | undefined;
2816
+ read: boolean;
2817
+ created_at: string;
2818
+ updated_at: string;
2819
+ }[]>;
2820
+ declare function markRead(arbi: ArbiClient, messageIds: string[]): Promise<{
2821
+ type: _arbidocs_client.components["schemas"]["NotificationType"];
2822
+ external_id: string;
2823
+ sender: {
2824
+ external_id: string;
2825
+ email: string;
2826
+ given_name: string;
2827
+ family_name: string;
2828
+ picture?: string | null | undefined;
2829
+ encryption_public_key: string;
2830
+ };
2831
+ recipient: {
2832
+ external_id: string;
2833
+ email: string;
2834
+ given_name: string;
2835
+ family_name: string;
2836
+ picture?: string | null | undefined;
2837
+ encryption_public_key: string;
2838
+ };
2839
+ workspace_ext_id?: string | null | undefined;
2840
+ content?: string | null | undefined;
2841
+ read: boolean;
2842
+ created_at: string;
2843
+ updated_at: string;
2844
+ }[]>;
2845
+ declare function deleteDMs(arbi: ArbiClient, messageIds: string[]): Promise<void>;
2846
+
2847
+ declare const dm_deleteDMs: typeof deleteDMs;
2848
+ declare const dm_listDMs: typeof listDMs;
2849
+ declare const dm_markRead: typeof markRead;
2850
+ declare const dm_sendDM: typeof sendDM;
2851
+ declare namespace dm {
2852
+ export { dm_deleteDMs as deleteDMs, dm_listDMs as listDMs, dm_markRead as markRead, dm_sendDM as sendDM };
2853
+ }
2854
+
2855
+ /**
2856
+ * User settings operations — get, update.
2857
+ */
2858
+
2859
+ type UserSettingsUpdate = components['schemas']['UserSettingsUpdate'];
2860
+ declare function getSettings(arbi: ArbiClient): Promise<{
2861
+ [x: string]: unknown;
2862
+ subscription?: {
2863
+ status: string;
2864
+ trial_expires?: number | null | undefined;
2865
+ } | null | undefined;
2866
+ last_workspace?: string | null | undefined;
2867
+ pinned_workspaces: string[];
2868
+ pinned_templates: string[];
2869
+ tableviews: {
2870
+ workspace: string;
2871
+ name: string;
2872
+ columns: string[];
2873
+ }[];
2874
+ developer: boolean;
2875
+ show_document_navigator: boolean;
2876
+ show_thread_visualization: boolean;
2877
+ show_smart_search: boolean;
2878
+ show_security_settings: boolean;
2879
+ show_invite_tab: boolean;
2880
+ show_help_page: boolean;
2881
+ show_templates: boolean;
2882
+ show_pa_mode: boolean;
2883
+ hide_online_status: boolean;
2884
+ muted_users: string[];
2885
+ }>;
2886
+ declare function updateSettings(arbi: ArbiClient, body: UserSettingsUpdate): Promise<void>;
2887
+
2888
+ declare const settings_getSettings: typeof getSettings;
2889
+ declare const settings_updateSettings: typeof updateSettings;
2890
+ declare namespace settings {
2891
+ export { settings_getSettings as getSettings, settings_updateSettings as updateSettings };
2892
+ }
2893
+
2894
+ /**
2895
+ * Agent configuration operations — list, get, save, delete, schema, models.
2896
+ */
2897
+
2898
+ type ConfigUpdateData = components['schemas']['ConfigUpdateData'];
2899
+ declare function listConfigs(arbi: ArbiClient): Promise<{
2900
+ versions: {
2901
+ external_id: string;
2902
+ title: string | null;
2903
+ created_at: string;
2904
+ }[];
2905
+ }>;
2906
+ declare function getConfig(arbi: ArbiClient, configId: string): Promise<{
2907
+ Agents: {
2908
+ ENABLED: boolean;
2909
+ HUMAN_IN_THE_LOOP: boolean;
2910
+ WEB_SEARCH?: {
2911
+ ENABLED: boolean;
2912
+ SAVE_SOURCES: boolean;
2913
+ } | undefined;
2914
+ RUN_CODE?: {
2915
+ ENABLED: boolean;
2916
+ IMAGE: string;
2917
+ TIMEOUT_SECONDS: number;
2918
+ MEMORY_LIMIT: string;
2919
+ NETWORK: string;
2920
+ } | undefined;
2921
+ MCP_TOOLS: string[];
2922
+ PLANNING_ENABLED: boolean;
2923
+ SUGGESTED_QUERIES: boolean;
2924
+ ARTIFACTS_ENABLED: boolean;
2925
+ VISION_ENABLED: boolean;
2926
+ DOC_INDEX_COMPACT_THRESHOLD: number;
2927
+ DOC_INDEX_SKIP_THRESHOLD: number;
2928
+ PERSONAL_AGENT: boolean;
2929
+ MEMORY_ENABLED: boolean;
2930
+ SKILLS_ENABLED: boolean;
2931
+ SKILL_CREATION: boolean;
2932
+ REVIEW_ENABLED: boolean;
2933
+ PERSONA: string;
2934
+ AGENT_MODEL_NAME: string;
2935
+ AGENT_API_TYPE: "local" | "remote";
2936
+ LLM_AGENT_TEMPERATURE: number;
2937
+ AGENT_MAX_TOKENS: number;
2938
+ AGENT_MAX_ITERATIONS: number;
2939
+ MAX_PASSAGE_PAGES: number;
2940
+ AGENT_HISTORY_CHAR_THRESHOLD: number;
2941
+ AGENT_SYSTEM_PROMPT: string;
2942
+ };
2943
+ QueryLLM: {
2944
+ API_TYPE: "local" | "remote";
2945
+ MODEL_NAME: string;
2946
+ SYSTEM_INSTRUCTION: string;
2947
+ MAX_CHAR_SIZE_TO_ANSWER: number;
2948
+ TEMPERATURE: number;
2949
+ MAX_TOKENS: number;
2950
+ };
2951
+ ReviewLLM: {
2952
+ API_TYPE: "local" | "remote";
2953
+ MODEL_NAME: string;
2954
+ SYSTEM_INSTRUCTION: string;
2955
+ TEMPERATURE: number;
2956
+ MAX_TOKENS: number;
2957
+ MAX_CHAR_SIZE_TO_ANSWER: number;
2958
+ };
2959
+ EvaluatorLLM: {
2960
+ API_TYPE: "local" | "remote";
2961
+ MODEL_NAME: string;
2962
+ SYSTEM_INSTRUCTION: string;
2963
+ TEMPERATURE: number;
2964
+ MAX_TOKENS: number;
2965
+ MAX_CHAR_SIZE_TO_ANSWER: number;
2966
+ };
2967
+ TitleLLM: {
2968
+ API_TYPE: "local" | "remote";
2969
+ MODEL_NAME: string;
2970
+ SYSTEM_INSTRUCTION: string;
2971
+ MAX_CHAR_SIZE_TO_ANSWER: number;
2972
+ TEMPERATURE: number;
2973
+ MAX_TOKENS: number;
2974
+ };
2975
+ SummariseLLM: {
2976
+ API_TYPE: "local" | "remote";
2977
+ MODEL_NAME: string;
2978
+ SYSTEM_INSTRUCTION: string;
2979
+ TEMPERATURE: number;
2980
+ MAX_TOKENS: number;
2981
+ MAX_CHAR_SIZE_TO_ANSWER: number;
2982
+ COMPACTION_THRESHOLD_TOKENS: number;
2983
+ COMPACTION_KEEP_RECENT: number;
2984
+ };
2985
+ DoctagLLM: {
2986
+ API_TYPE: "local" | "remote";
2987
+ MODEL_NAME: string;
2988
+ SYSTEM_INSTRUCTION: string;
2989
+ MAX_CHAR_CONTEXT_TO_ANSWER: number;
2990
+ TEMPERATURE: number;
2991
+ MAX_TOKENS: number;
2992
+ MAX_CONCURRENT_DOCS: number;
2993
+ DEFAULT_METADATA_TAGS: {
2994
+ name: string;
2995
+ instruction?: string | null | undefined;
2996
+ tag_type?: {
2997
+ type: "checkbox" | "text" | "number" | "select" | "search" | "date";
2998
+ options: string[];
2999
+ } | undefined;
3000
+ }[];
3001
+ };
3002
+ MemoryLLM: {
3003
+ API_TYPE: "local" | "remote";
3004
+ MODEL_NAME: string;
3005
+ SYSTEM_INSTRUCTION: string;
3006
+ TEMPERATURE: number;
3007
+ MAX_TOKENS: number;
3008
+ MAX_CHAR_CONTEXT: number;
3009
+ MAX_CONCURRENT: number;
3010
+ };
3011
+ PlanningLLM: {
3012
+ API_TYPE: "local" | "remote";
3013
+ MODEL_NAME: string;
3014
+ SYSTEM_INSTRUCTION: string;
3015
+ TEMPERATURE: number;
3016
+ MAX_TOKENS: number;
3017
+ MAX_CHAR_SIZE_TO_ANSWER: number;
3018
+ APPROVAL_TIMEOUT: number;
3019
+ };
3020
+ VisionLLM: {
3021
+ API_TYPE: "local" | "remote";
3022
+ MODEL_NAME: string;
3023
+ TEMPERATURE: number;
3024
+ MAX_TOKENS: number;
3025
+ MAX_PAGES_PER_CALL: number;
3026
+ IMAGE_MAX_DIMENSION: number;
3027
+ };
3028
+ CodeAgent: {
3029
+ API_TYPE: "local" | "remote";
3030
+ MODEL_NAME: string;
3031
+ SYSTEM_INSTRUCTION: string;
3032
+ TEMPERATURE: number;
3033
+ MAX_TOKENS: number;
3034
+ MAX_ITERATIONS: number;
3035
+ };
3036
+ ModelCitation: {
3037
+ SIM_THREASHOLD: number;
3038
+ MIN_CHAR_SIZE_TO_ANSWER: number;
3039
+ MAX_NUMB_CITATIONS: number;
3040
+ };
3041
+ Retriever: {
3042
+ MIN_RETRIEVAL_SIM_SCORE: number;
3043
+ MAX_DISTINCT_DOCUMENTS: number;
3044
+ MAX_TOTAL_CHUNKS_TO_RETRIEVE: number;
3045
+ GROUP_SIZE: number;
3046
+ SEARCH_MODE: components["schemas"]["SearchMode"];
3047
+ HYBRID_DENSE_WEIGHT: number;
3048
+ HYBRID_SPARSE_WEIGHT: number;
3049
+ HYBRID_RERANKER_WEIGHT: number;
3050
+ };
3051
+ Reranker: {
3052
+ MIN_SCORE: number;
3053
+ MAX_NUMB_OF_CHUNKS: number;
3054
+ MAX_CONCURRENT_REQUESTS: number;
3055
+ MODEL_NAME: string;
3056
+ API_TYPE: "local" | "remote";
3057
+ };
3058
+ Parser: {
3059
+ SKIP_DUPLICATES: boolean;
3060
+ };
3061
+ Chunker: {
3062
+ MAX_CHUNK_TOKENS: number;
3063
+ TOKENIZER_TYPE: "tiktoken" | "huggingface";
3064
+ TOKENIZER_NAME: string;
3065
+ };
3066
+ Embedder: {
3067
+ MODEL_NAME: string;
3068
+ API_TYPE: "local" | "remote";
3069
+ BATCH_SIZE: number;
3070
+ MAX_CONCURRENT_REQUESTS: number;
3071
+ DOCUMENT_PREFIX: string;
3072
+ QUERY_PREFIX: string;
3073
+ };
3074
+ KeywordEmbedder: {
3075
+ DIMENSION_SPACE: number;
3076
+ FILTER_STOPWORDS: boolean;
3077
+ BM25_K1: number;
3078
+ BM25_B: number;
3079
+ BM25_AVGDL: number;
3080
+ };
3081
+ } | {
3082
+ Agents: {
3083
+ [x: string]: string | boolean;
3084
+ };
3085
+ }>;
3086
+ declare function saveConfig(arbi: ArbiClient, body: ConfigUpdateData): Promise<{
3087
+ external_id: string;
3088
+ title: string | null;
3089
+ created_at: string;
3090
+ }>;
3091
+ declare function deleteConfig(arbi: ArbiClient, configId: string): Promise<{
3092
+ detail: string;
3093
+ }>;
3094
+ declare function getSchema(arbi: ArbiClient): Promise<unknown>;
3095
+ declare function getModels(arbi: ArbiClient): Promise<{
3096
+ models: {
3097
+ model_name: string;
3098
+ api_type: string;
3099
+ tags?: string[] | null | undefined;
3100
+ max_input_tokens?: number | null | undefined;
3101
+ max_output_tokens?: number | null | undefined;
3102
+ input_cost_per_token?: number | null | undefined;
3103
+ output_cost_per_token?: number | null | undefined;
3104
+ provider?: string | null | undefined;
3105
+ mode?: string | null | undefined;
3106
+ supports_vision?: boolean | null | undefined;
3107
+ supports_reasoning?: boolean | null | undefined;
3108
+ supports_function_calling?: boolean | null | undefined;
3109
+ supports_response_schema?: boolean | null | undefined;
3110
+ }[];
3111
+ }>;
3112
+
3113
+ declare const agentconfig_deleteConfig: typeof deleteConfig;
3114
+ declare const agentconfig_getConfig: typeof getConfig;
3115
+ declare const agentconfig_getModels: typeof getModels;
3116
+ declare const agentconfig_getSchema: typeof getSchema;
3117
+ declare const agentconfig_listConfigs: typeof listConfigs;
3118
+ declare const agentconfig_saveConfig: typeof saveConfig;
3119
+ declare namespace agentconfig {
3120
+ 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 };
3121
+ }
3122
+
3123
+ /**
3124
+ * Health and model operations.
3125
+ */
3126
+
3127
+ declare function getHealth(arbi: ArbiClient): Promise<{
3128
+ status: string;
3129
+ backend_git_hash?: string | null | undefined;
3130
+ frontend_docker_version?: string | null | undefined;
3131
+ services: {
3132
+ name: string;
3133
+ status: string;
3134
+ detail?: string | null | undefined;
3135
+ service_info?: {
3136
+ [x: string]: unknown;
3137
+ } | null | undefined;
3138
+ }[];
3139
+ models_health?: {
3140
+ application: string;
3141
+ models: {
3142
+ model: string;
3143
+ status: string;
3144
+ detail?: string | null | undefined;
3145
+ }[];
3146
+ } | null | undefined;
3147
+ available_models: string[];
3148
+ }>;
3149
+ declare function getHealthModels(arbi: ArbiClient): Promise<{
3150
+ models: {
3151
+ model_name: string;
3152
+ api_type: string;
3153
+ tags?: string[] | null | undefined;
3154
+ max_input_tokens?: number | null | undefined;
3155
+ max_output_tokens?: number | null | undefined;
3156
+ input_cost_per_token?: number | null | undefined;
3157
+ output_cost_per_token?: number | null | undefined;
3158
+ provider?: string | null | undefined;
3159
+ mode?: string | null | undefined;
3160
+ supports_vision?: boolean | null | undefined;
3161
+ supports_reasoning?: boolean | null | undefined;
3162
+ supports_function_calling?: boolean | null | undefined;
3163
+ supports_response_schema?: boolean | null | undefined;
3164
+ }[];
3165
+ }>;
3166
+ declare function getRemoteModels(arbi: ArbiClient): Promise<{
3167
+ application: string;
3168
+ models: {
3169
+ model: string;
3170
+ status: string;
3171
+ detail?: string | null | undefined;
3172
+ }[];
3173
+ }>;
3174
+ declare function getMcpTools(arbi: ArbiClient): Promise<{
3175
+ tools: {
3176
+ name: string;
3177
+ description: string;
3178
+ server_name: string;
3179
+ }[];
3180
+ }>;
3181
+
3182
+ declare const health_getHealth: typeof getHealth;
3183
+ declare const health_getHealthModels: typeof getHealthModels;
3184
+ declare const health_getMcpTools: typeof getMcpTools;
3185
+ declare const health_getRemoteModels: typeof getRemoteModels;
3186
+ declare namespace health {
3187
+ export { health_getHealth as getHealth, health_getHealthModels as getHealthModels, health_getMcpTools as getMcpTools, health_getRemoteModels as getRemoteModels };
3188
+ }
3189
+
3190
+ /**
3191
+ * Responses operations — background query submission and retrieval.
3192
+ *
3193
+ * submitBackgroundQuery: POST /v1/responses with background=true → 202 with task ID.
3194
+ * getResponse: GET /v1/responses/{responseId} → current status + output.
3195
+ * extractResponseText: Walk response output and join text content.
3196
+ */
3197
+
3198
+ type ResponsesAPIResponse = components['schemas']['ResponsesAPIResponse'];
3199
+ interface SubmitBackgroundQueryOptions extends AuthHeaders {
3200
+ workspaceId: string;
3201
+ question: string;
3202
+ docIds: string[];
3203
+ previousResponseId?: string | null;
3204
+ model?: string;
3205
+ }
3206
+ /**
3207
+ * Submit a query for background processing.
3208
+ * Returns immediately with a response ID and "queued" status.
3209
+ */
3210
+ declare function submitBackgroundQuery(options: SubmitBackgroundQueryOptions): Promise<ResponsesAPIResponse>;
3211
+ /**
3212
+ * Fetch the current state of a response by ID.
3213
+ * Returns progressive status, output, usage, and metadata.
3214
+ */
3215
+ declare function getResponse(auth: AuthHeaders, responseId: string): Promise<ResponsesAPIResponse>;
3216
+ /**
3217
+ * Walk response output messages and join all output_text content.
3218
+ * Pure function, no I/O.
3219
+ */
3220
+ declare function extractResponseText(response: ResponsesAPIResponse): string;
3221
+
3222
+ type responses_SubmitBackgroundQueryOptions = SubmitBackgroundQueryOptions;
3223
+ declare const responses_extractResponseText: typeof extractResponseText;
3224
+ declare const responses_getResponse: typeof getResponse;
3225
+ declare const responses_submitBackgroundQuery: typeof submitBackgroundQuery;
3226
+ declare namespace responses {
3227
+ export { type responses_SubmitBackgroundQueryOptions as SubmitBackgroundQueryOptions, responses_extractResponseText as extractResponseText, responses_getResponse as getResponse, responses_submitBackgroundQuery as submitBackgroundQuery };
3228
+ }
3229
+
3230
+ export { connectWithReconnect as $, type AuthHeaders as A, type SSEStreamCallbacks as B, type ConfigStore as C, type DocumentWaiter as D, type SSEStreamResult as E, type FormattedWsMessage as F, type SSEStreamStartData as G, type UserInfo as H, type UserInputRequestEvent as I, type UserMessageEvent as J, type WsConnection as K, LIFECYCLE_LABELS as L, type MessageLevel as M, agentconfig as N, type OutputTokensDetails as O, assistant as P, type QueryOptions as Q, type ReconnectOptions as R, type SSEEvent as S, TOOL_LABELS as T, type UploadBatchResult as U, authenticatedFetch as V, type WorkspaceContext as W, buildRetrievalChunkTool as X, buildRetrievalFullContextTool as Y, buildRetrievalTocTool as Z, connectWebSocket as _, type CliConfig as a, consumeSSEStream as a0, contacts as a1, conversations as a2, createAuthenticatedClient as a3, createDocumentWaiter as a4, dm as a5, doctags as a6, documents as a7, files as a8, formatAgentStepLabel as a9, formatFileSize as aa, formatUserName as ab, formatWorkspaceChoices as ac, formatWsMessage as ad, generateEncryptedWorkspaceKey as ae, getErrorCode as af, getErrorMessage as ag, health as ah, parseSSEEvents as ai, performPasswordLogin as aj, requireData as ak, requireOk as al, resolveAuth as am, resolveWorkspace as an, responses as ao, selectWorkspace as ap, selectWorkspaceById as aq, settings as ar, streamSSE as as, tags as at, workspaces as au, type CliCredentials as b, type ChatSession as c, type UploadOptions as d, type UploadResult as e, type AgentStepEvent as f, Arbi as g, ArbiApiError as h, ArbiError as i, type ArbiOptions as j, type ArtifactEvent as k, type AuthContext as l, type AuthenticatedClient as m, type ConnectOptions as n, type DocumentWaiterOptions as o, type MessageMetadataPayload as p, type ReconnectableWsConnection as q, type ResponseCompletedEvent as r, type ResponseContentPartAddedEvent as s, type ResponseCreatedEvent as t, type ResponseFailedEvent as u, type ResponseOutputItemAddedEvent as v, type ResponseOutputItemDoneEvent as w, type ResponseOutputTextDeltaEvent as x, type ResponseOutputTextDoneEvent as y, type ResponseUsage as z };