@arbidocs/sdk 0.3.115 → 0.3.117

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.
@@ -1417,226 +1417,562 @@ declare namespace contacts {
1417
1417
  }
1418
1418
 
1419
1419
  /**
1420
- * File operations — OpenAI-compatible Files API (list, get, delete, upload, content).
1420
+ * Direct message / notification operations — list, send, mark read, delete.
1421
+ *
1422
+ * All message content is E2E encrypted using ECDH (X25519 + XSalsa20-Poly1305).
1423
+ * Encryption keys are derived from the user's Ed25519 signing keypair.
1421
1424
  */
1422
1425
 
1423
- type FileObject = components['schemas']['FileObject'];
1424
- type FileDeleteResponse = components['schemas']['FileDeleteResponse'];
1425
- type FileListResponse = components['schemas']['FileListResponse'];
1426
-
1427
- interface ListFilesOptions {
1428
- purpose?: string | null;
1429
- limit?: number;
1430
- order?: string;
1431
- after?: string | null;
1426
+ type NotificationResponse = components['schemas']['NotificationResponse'];
1427
+ /** A resolved DM recipient: their external_id + curve25519 public key. */
1428
+ interface ResolvedRecipient {
1429
+ extId: string;
1430
+ pubKey: string;
1432
1431
  }
1433
- declare function listFiles(arbi: ArbiClient, options?: ListFilesOptions): Promise<{
1434
- object: string;
1435
- data: {
1436
- id: string;
1437
- object: string;
1438
- bytes: number;
1439
- created_at: number;
1440
- filename: string;
1441
- purpose: string;
1442
- status: string;
1443
- expires_at?: number | null | undefined;
1444
- status_details?: string | null | undefined;
1445
- }[];
1446
- has_more: boolean;
1447
- first_id?: string | null | undefined;
1448
- last_id?: string | null | undefined;
1449
- }>;
1450
- declare function getFile(arbi: ArbiClient, fileId: string): Promise<{
1451
- id: string;
1452
- object: string;
1453
- bytes: number;
1454
- created_at: number;
1455
- filename: string;
1456
- purpose: string;
1457
- status: string;
1458
- expires_at?: number | null | undefined;
1459
- status_details?: string | null | undefined;
1460
- }>;
1461
- declare function deleteFile(arbi: ArbiClient, fileId: string): Promise<{
1462
- id: string;
1463
- object: string;
1464
- deleted: boolean;
1465
- }>;
1466
1432
  /**
1467
- * Upload a file via the OpenAI-compatible Files API.
1468
- * Uses raw fetch for multipart upload.
1469
- */
1470
- declare function uploadFile(auth: AuthHeaders, fileData: Blob, fileName: string, purpose?: string): Promise<FileObject>;
1471
- /**
1472
- * Get file content (binary). Returns the raw Response for the caller to handle.
1433
+ * Everything needed to encrypt/decrypt DMs.
1434
+ * Derive once per session, pass to all DM operations.
1473
1435
  */
1474
- declare function getFileContent(auth: AuthHeaders, fileId: string): Promise<Response>;
1475
-
1476
- type files_FileDeleteResponse = FileDeleteResponse;
1477
- type files_FileListResponse = FileListResponse;
1478
- type files_FileObject = FileObject;
1479
- type files_ListFilesOptions = ListFilesOptions;
1480
- declare const files_deleteFile: typeof deleteFile;
1481
- declare const files_getFile: typeof getFile;
1482
- declare const files_getFileContent: typeof getFileContent;
1483
- declare const files_listFiles: typeof listFiles;
1484
- declare const files_uploadFile: typeof uploadFile;
1485
- declare namespace files {
1486
- 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 };
1436
+ interface DmCryptoContext {
1437
+ /** User's X25519 encryption keypair (derived from Ed25519 signing key) */
1438
+ encryptionKeypair: KeyPair;
1439
+ /** User's own external_id (to determine send vs receive direction) */
1440
+ userExtId: string;
1487
1441
  }
1488
-
1489
1442
  /**
1490
- * Scheduled agent tasks — one-time, recurring (RFC-5545 rrule) or event-triggered
1491
- * jobs whose action is a reminder, an agent prompt, or a skill run.
1492
- * Backend: `/v1/tasks` (src/api/v1/routers/tasks.py).
1443
+ * Create a DM crypto context from a signing private key.
1444
+ *
1445
+ * @param arbi - ArbiClient instance (provides crypto utilities)
1446
+ * @param signingPrivateKeyBytes - Ed25519 signing private key (64 bytes)
1447
+ * @param userExtId - Current user's external_id
1493
1448
  */
1494
-
1495
- type TaskResponse = components['schemas']['TaskResponse'];
1496
- type CreateTaskRequest = components['schemas']['CreateTaskRequest'];
1497
- type UpdateTaskRequest = components['schemas']['UpdateTaskRequest'];
1498
- /** List the caller's scheduled tasks (newest first). */
1499
- declare function listTasks(arbi: ArbiClient): Promise<TaskResponse[]>;
1500
- /** Create a scheduled task. `name` is required; supply trigger + action fields. */
1501
- declare function createTask(arbi: ArbiClient, body: CreateTaskRequest): Promise<TaskResponse>;
1502
- declare function getTask(arbi: ArbiClient, taskId: string): Promise<TaskResponse>;
1503
- /** Update a task — including `status` to pause/resume (`active` | `paused`). */
1504
- declare function updateTask(arbi: ArbiClient, taskId: string, body: UpdateTaskRequest): Promise<TaskResponse>;
1505
- declare function deleteTask(arbi: ArbiClient, taskId: string): Promise<void>;
1506
- /** Fire a task immediately without advancing its schedule. */
1507
- declare function runTask(arbi: ArbiClient, taskId: string): Promise<TaskResponse>;
1508
-
1509
- type tasks_CreateTaskRequest = CreateTaskRequest;
1510
- type tasks_TaskResponse = TaskResponse;
1511
- type tasks_UpdateTaskRequest = UpdateTaskRequest;
1512
- declare const tasks_createTask: typeof createTask;
1513
- declare const tasks_deleteTask: typeof deleteTask;
1514
- declare const tasks_getTask: typeof getTask;
1515
- declare const tasks_listTasks: typeof listTasks;
1516
- declare const tasks_runTask: typeof runTask;
1517
- declare const tasks_updateTask: typeof updateTask;
1518
- declare namespace tasks {
1519
- export { type tasks_CreateTaskRequest as CreateTaskRequest, type tasks_TaskResponse as TaskResponse, type tasks_UpdateTaskRequest as UpdateTaskRequest, tasks_createTask as createTask, tasks_deleteTask as deleteTask, tasks_getTask as getTask, tasks_listTasks as listTasks, tasks_runTask as runTask, tasks_updateTask as updateTask };
1520
- }
1521
-
1449
+ declare function createDmCryptoContext(arbi: ArbiClient, signingPrivateKeyBytes: Uint8Array, userExtId: string): DmCryptoContext;
1522
1450
  /**
1523
- * Workspace memory — per-workspace encrypted knowledge notes with citations.
1524
- * The firm's practice profile / house style / precedent knowhow lives here and is
1525
- * read by grounded agents. All endpoints require an OPEN workspace.
1526
- * Backend: `/v1/memory` (src/api/v1/routers/memory.py).
1451
+ * Encrypt a plaintext message for a recipient.
1452
+ *
1453
+ * @param arbi - ArbiClient instance
1454
+ * @param plaintext - Message content to encrypt
1455
+ * @param recipientEncryptionPubKeyBase64 - Recipient's X25519 public key (base64)
1456
+ * @param senderEncryptionSecretKey - Sender's X25519 secret key (Uint8Array)
1457
+ * @returns Base64-encoded ciphertext (nonce prepended)
1527
1458
  */
1528
-
1529
- type MemoryResponse = components['schemas']['MemoryResponse'];
1530
- type CreateMemoryRequest = components['schemas']['CreateMemoryRequest'];
1531
- type UpdateMemoryRequest = components['schemas']['UpdateMemoryRequest'];
1532
- type MemorySearchRequest = components['schemas']['MemorySearchRequest'];
1533
- type MemorySearchResponse = components['schemas']['MemorySearchResponse'];
1534
- /** Create a memory. `content` is required; `shared` makes it workspace-wide. */
1535
- declare function createMemory(arbi: ArbiClient, body: CreateMemoryRequest): Promise<MemoryResponse>;
1536
- /** List the open workspace's memories (newest first). */
1537
- declare function listMemories(arbi: ArbiClient, options?: {
1538
- pinnedOnly?: boolean;
1539
- }): Promise<MemoryResponse[]>;
1540
- /** Semantic/keyword/hybrid search across the workspace's memories. */
1541
- declare function searchMemories(arbi: ArbiClient, body: MemorySearchRequest): Promise<MemorySearchResponse>;
1542
- declare function updateMemory(arbi: ArbiClient, memoryId: string, body: UpdateMemoryRequest): Promise<MemoryResponse>;
1543
- declare function deleteMemory(arbi: ArbiClient, memoryId: string): Promise<void>;
1544
-
1545
- type memory_CreateMemoryRequest = CreateMemoryRequest;
1546
- type memory_MemoryResponse = MemoryResponse;
1547
- type memory_MemorySearchRequest = MemorySearchRequest;
1548
- type memory_MemorySearchResponse = MemorySearchResponse;
1549
- type memory_UpdateMemoryRequest = UpdateMemoryRequest;
1550
- declare const memory_createMemory: typeof createMemory;
1551
- declare const memory_deleteMemory: typeof deleteMemory;
1552
- declare const memory_listMemories: typeof listMemories;
1553
- declare const memory_searchMemories: typeof searchMemories;
1554
- declare const memory_updateMemory: typeof updateMemory;
1555
- declare namespace memory {
1556
- export { type memory_CreateMemoryRequest as CreateMemoryRequest, type memory_MemoryResponse as MemoryResponse, type memory_MemorySearchRequest as MemorySearchRequest, type memory_MemorySearchResponse as MemorySearchResponse, type memory_UpdateMemoryRequest as UpdateMemoryRequest, memory_createMemory as createMemory, memory_deleteMemory as deleteMemory, memory_listMemories as listMemories, memory_searchMemories as searchMemories, memory_updateMemory as updateMemory };
1557
- }
1558
-
1459
+ declare function encryptDmContent(arbi: ArbiClient, plaintext: string, recipientEncryptionPubKeyBase64: string, senderEncryptionSecretKey: Uint8Array): Promise<string>;
1559
1460
  /**
1560
- * High-level convenience class that wraps the full ARBI stack into a simple API.
1461
+ * Decrypt an encrypted notification message.
1561
1462
  *
1562
- * Handles SDK client creation, sodium initialization, authentication,
1563
- * workspace key decryption, and delegates to all operations modules.
1463
+ * Uses the sender/recipient public keys embedded in NotificationResponse
1464
+ * to determine the "other party" for ECDH decryption.
1564
1465
  *
1565
- * Usage:
1566
- * const arbi = new Arbi({ url: 'https://arbi.mycompany.com' })
1567
- * await arbi.login('user@example.com', 'password')
1568
- * const workspaces = await arbi.workspaces.list()
1569
- * await arbi.selectWorkspace(workspaces[0].external_id)
1570
- * const docs = await arbi.documents.list()
1466
+ * @param arbi - ArbiClient instance
1467
+ * @param notification - The notification with encrypted content
1468
+ * @param crypto - DM crypto context for the current user
1469
+ * @returns Decrypted plaintext, or null if content is empty
1470
+ * @throws Error if decryption fails (wrong keys or tampered message)
1571
1471
  */
1572
-
1573
- type DocUpdateRequest = components['schemas']['DocUpdateRequest'];
1574
- type WorkspaceUpdateRequest$1 = components['schemas']['WorkspaceUpdateRequest'];
1575
- type UpdateTagRequest$1 = components['schemas']['UpdateTagRequest'];
1576
- type TagFormat = components['schemas']['TagFormat'];
1577
- type CitationData$1 = components['schemas']['CitationData'];
1578
- type UserSettingsUpdate$1 = components['schemas']['UserSettingsUpdate'];
1579
- type ConfigUpdateData$1 = components['schemas']['ConfigUpdateData'];
1580
-
1581
- interface ArbiOptions {
1582
- /** Backend API URL (e.g. 'https://arbi.mycompany.com') */
1583
- url: string;
1584
- /** Deployment domain for key derivation. Defaults to hostname of url. */
1585
- deploymentDomain?: string;
1586
- /** Include credentials (cookies) in requests. Default: 'omit' for SDK consumers. */
1587
- credentials?: 'include' | 'omit' | 'same-origin';
1588
- }
1589
- interface QueryOptions {
1590
- /** Document IDs to search against */
1591
- docIds: string[];
1592
- /** Previous response ID for follow-up questions */
1593
- previousResponseId?: string | null;
1594
- /** Model to use for generation */
1595
- model?: string;
1596
- /** Called for each streaming token */
1597
- onToken?: (content: string) => void;
1598
- /** Called when stream starts */
1599
- onStreamStart?: (data: SSEStreamStartData) => void;
1600
- /** Called for each agent step */
1601
- onAgentStep?: (data: AgentStepEvent) => void;
1602
- /** Called on stream error */
1603
- onError?: (message: string) => void;
1604
- /** Called when a user message event is received */
1605
- onUserMessage?: (data: UserMessageEvent) => void;
1606
- /** Called when message metadata is received */
1607
- onMetadata?: (data: MessageMetadataPayload$1) => void;
1608
- /** Called when the agent requests user input */
1609
- onUserInputRequest?: (data: UserInputRequestEvent) => void;
1610
- /** Called when an artifact event is received */
1611
- onArtifact?: (data: ArtifactEvent) => void;
1612
- /** Called when backend elapsed time is received */
1613
- onElapsedTime?: (t: number) => void;
1614
- /** Called when stream completes */
1615
- onComplete?: () => void;
1616
- }
1617
- declare class Arbi {
1618
- private client;
1619
- private loginResult;
1620
- private currentWorkspaceId;
1621
- private readonly options;
1622
- constructor(options: ArbiOptions);
1623
- /** Initialize the SDK client and sodium crypto. Called automatically by login(). */
1624
- init(): Promise<ArbiClient>;
1625
- /**
1626
- * Request a verification email for registration.
1627
- * The user will receive an email with a 3-word verification code.
1628
- */
1629
- requestVerification(email: string): Promise<void>;
1630
- /**
1631
- * Register a new account using the verification code received by email.
1632
- */
1633
- register(params: {
1472
+ declare function decryptDmContent(arbi: ArbiClient, notification: NotificationResponse, crypto: DmCryptoContext): Promise<string | null>;
1473
+ /**
1474
+ * Decrypt a batch of notifications, replacing content in-place.
1475
+ * Failed decryptions get content set to '[Decryption failed]'.
1476
+ *
1477
+ * @returns New array with decrypted content
1478
+ */
1479
+ declare function decryptDmBatch(arbi: ArbiClient, notifications: NotificationResponse[], crypto: DmCryptoContext): Promise<NotificationResponse[]>;
1480
+ /**
1481
+ * List DMs (raw — content is encrypted ciphertext).
1482
+ */
1483
+ declare function listDMs(arbi: ArbiClient): Promise<{
1484
+ type: components["schemas"]["NotificationType"];
1485
+ external_id: string;
1486
+ sender: {
1487
+ external_id: string;
1488
+ parent_ext_id?: string | null | undefined;
1634
1489
  email: string;
1635
- password: string;
1636
- verificationCode: string;
1637
- firstName?: string;
1638
- lastName?: string;
1639
- }): Promise<void>;
1490
+ given_name: string;
1491
+ family_name?: string | null | undefined;
1492
+ picture?: string | null | undefined;
1493
+ encryption_public_key: string;
1494
+ is_sso: boolean;
1495
+ };
1496
+ recipient: {
1497
+ external_id: string;
1498
+ parent_ext_id?: string | null | undefined;
1499
+ email: string;
1500
+ given_name: string;
1501
+ family_name?: string | null | undefined;
1502
+ picture?: string | null | undefined;
1503
+ encryption_public_key: string;
1504
+ is_sso: boolean;
1505
+ };
1506
+ workspace_ext_id?: string | null | undefined;
1507
+ content?: string | null | undefined;
1508
+ read: boolean;
1509
+ created_at: string;
1510
+ updated_at: string;
1511
+ }[]>;
1512
+ /**
1513
+ * List and decrypt DMs in one call.
1514
+ */
1515
+ declare function listDecryptedDMs(arbi: ArbiClient, crypto: DmCryptoContext): Promise<{
1516
+ type: components["schemas"]["NotificationType"];
1517
+ external_id: string;
1518
+ sender: components["schemas"]["UserResponse"];
1519
+ recipient: components["schemas"]["UserResponse"];
1520
+ workspace_ext_id?: string | null;
1521
+ content?: string | null;
1522
+ read: boolean;
1523
+ created_at: string;
1524
+ updated_at: string;
1525
+ }[]>;
1526
+ /**
1527
+ * List the current user's durable activity feed, newest first.
1528
+ *
1529
+ * Activity notifications are backend-originated, to-self log lines (recipient ==
1530
+ * sender == the acting user) that are always read — they never appear in the
1531
+ * normal DM/notification feed or the unread badge. Reading them requires the
1532
+ * explicit `type=activity` filter, which this helper always sets.
1533
+ */
1534
+ declare function listActivity(arbi: ArbiClient, options?: {
1535
+ limit?: number;
1536
+ offset?: number;
1537
+ }): Promise<{
1538
+ type: components["schemas"]["NotificationType"];
1539
+ external_id: string;
1540
+ sender: {
1541
+ external_id: string;
1542
+ parent_ext_id?: string | null | undefined;
1543
+ email: string;
1544
+ given_name: string;
1545
+ family_name?: string | null | undefined;
1546
+ picture?: string | null | undefined;
1547
+ encryption_public_key: string;
1548
+ is_sso: boolean;
1549
+ };
1550
+ recipient: {
1551
+ external_id: string;
1552
+ parent_ext_id?: string | null | undefined;
1553
+ email: string;
1554
+ given_name: string;
1555
+ family_name?: string | null | undefined;
1556
+ picture?: string | null | undefined;
1557
+ encryption_public_key: string;
1558
+ is_sso: boolean;
1559
+ };
1560
+ workspace_ext_id?: string | null | undefined;
1561
+ content?: string | null | undefined;
1562
+ read: boolean;
1563
+ created_at: string;
1564
+ updated_at: string;
1565
+ }[]>;
1566
+ /**
1567
+ * Resolve a recipient reference (email OR `usr-`/`agt-` external_id) into the
1568
+ * `{ extId, pubKey }` an encrypted send needs. Walks three directories in order
1569
+ * — contacts, parent-owned agents, current-workspace members — and stops at the
1570
+ * first hit with a usable curve25519 public key. Returns `null` when nothing
1571
+ * matches so callers can surface a recovery hint.
1572
+ *
1573
+ * This is the single resolution path shared by the app, the CLI and seeding —
1574
+ * no consumer should re-implement directory lookups.
1575
+ */
1576
+ declare function resolveRecipient(arbi: ArbiClient, ref: string): Promise<ResolvedRecipient | null>;
1577
+ /**
1578
+ * Send an E2E encrypted DM.
1579
+ *
1580
+ * Encrypts plaintext content for each recipient using their public key.
1581
+ * Requires recipient public keys — fetch via contacts or user lookup first.
1582
+ *
1583
+ * @param arbi - ArbiClient instance
1584
+ * @param messages - Array of { recipient_ext_id, content (plaintext), recipient_encryption_public_key }
1585
+ * @param crypto - DM crypto context for the sender
1586
+ */
1587
+ declare function sendEncryptedDM(arbi: ArbiClient, messages: Array<{
1588
+ recipient_ext_id: string;
1589
+ content: string;
1590
+ recipient_encryption_public_key: string;
1591
+ }>, crypto: DmCryptoContext): Promise<{
1592
+ type: components["schemas"]["NotificationType"];
1593
+ external_id: string;
1594
+ sender: {
1595
+ external_id: string;
1596
+ parent_ext_id?: string | null | undefined;
1597
+ email: string;
1598
+ given_name: string;
1599
+ family_name?: string | null | undefined;
1600
+ picture?: string | null | undefined;
1601
+ encryption_public_key: string;
1602
+ is_sso: boolean;
1603
+ };
1604
+ recipient: {
1605
+ external_id: string;
1606
+ parent_ext_id?: string | null | undefined;
1607
+ email: string;
1608
+ given_name: string;
1609
+ family_name?: string | null | undefined;
1610
+ picture?: string | null | undefined;
1611
+ encryption_public_key: string;
1612
+ is_sso: boolean;
1613
+ };
1614
+ workspace_ext_id?: string | null | undefined;
1615
+ content?: string | null | undefined;
1616
+ read: boolean;
1617
+ created_at: string;
1618
+ updated_at: string;
1619
+ }[]>;
1620
+ /**
1621
+ * Ask another user to grant you workspace access.
1622
+ *
1623
+ * Creates a `workspace_access_request` notification. The `content` is an
1624
+ * opaque base64 blob, E2E-encrypted with the requester↔recipient shared key
1625
+ * (same scheme as a DM), carrying the requester's live session public key
1626
+ * (`sessionPubkeyB64`) so the recipient can mint a temporary, session-scoped
1627
+ * grant, plus an optional note.
1628
+ *
1629
+ * `workspaceExtId` is optional and only meaningful for API/SDK/CLI callers who
1630
+ * already know a workspace id (obtained out-of-band); omit it and the recipient
1631
+ * picks the workspace.
1632
+ */
1633
+ declare function requestWorkspaceAccess(arbi: ArbiClient, params: {
1634
+ recipientExtId: string;
1635
+ recipientEncryptionPublicKey: string;
1636
+ sessionPubkeyB64: string;
1637
+ note?: string;
1638
+ workspaceExtId?: string;
1639
+ }, crypto: DmCryptoContext): Promise<{
1640
+ type: components["schemas"]["NotificationType"];
1641
+ external_id: string;
1642
+ sender: {
1643
+ external_id: string;
1644
+ parent_ext_id?: string | null | undefined;
1645
+ email: string;
1646
+ given_name: string;
1647
+ family_name?: string | null | undefined;
1648
+ picture?: string | null | undefined;
1649
+ encryption_public_key: string;
1650
+ is_sso: boolean;
1651
+ };
1652
+ recipient: {
1653
+ external_id: string;
1654
+ parent_ext_id?: string | null | undefined;
1655
+ email: string;
1656
+ given_name: string;
1657
+ family_name?: string | null | undefined;
1658
+ picture?: string | null | undefined;
1659
+ encryption_public_key: string;
1660
+ is_sso: boolean;
1661
+ };
1662
+ workspace_ext_id?: string | null | undefined;
1663
+ content?: string | null | undefined;
1664
+ read: boolean;
1665
+ created_at: string;
1666
+ updated_at: string;
1667
+ }>;
1668
+ /**
1669
+ * Send a plaintext DM (no encryption).
1670
+ * @deprecated Use sendEncryptedDM instead.
1671
+ */
1672
+ declare function sendDM(arbi: ArbiClient, messages: Array<{
1673
+ recipient_ext_id: string;
1674
+ content: string;
1675
+ }>): Promise<{
1676
+ type: components["schemas"]["NotificationType"];
1677
+ external_id: string;
1678
+ sender: {
1679
+ external_id: string;
1680
+ parent_ext_id?: string | null | undefined;
1681
+ email: string;
1682
+ given_name: string;
1683
+ family_name?: string | null | undefined;
1684
+ picture?: string | null | undefined;
1685
+ encryption_public_key: string;
1686
+ is_sso: boolean;
1687
+ };
1688
+ recipient: {
1689
+ external_id: string;
1690
+ parent_ext_id?: string | null | undefined;
1691
+ email: string;
1692
+ given_name: string;
1693
+ family_name?: string | null | undefined;
1694
+ picture?: string | null | undefined;
1695
+ encryption_public_key: string;
1696
+ is_sso: boolean;
1697
+ };
1698
+ workspace_ext_id?: string | null | undefined;
1699
+ content?: string | null | undefined;
1700
+ read: boolean;
1701
+ created_at: string;
1702
+ updated_at: string;
1703
+ }[]>;
1704
+ declare function markRead(arbi: ArbiClient, messageIds: string[]): Promise<{
1705
+ type: components["schemas"]["NotificationType"];
1706
+ external_id: string;
1707
+ sender: {
1708
+ external_id: string;
1709
+ parent_ext_id?: string | null | undefined;
1710
+ email: string;
1711
+ given_name: string;
1712
+ family_name?: string | null | undefined;
1713
+ picture?: string | null | undefined;
1714
+ encryption_public_key: string;
1715
+ is_sso: boolean;
1716
+ };
1717
+ recipient: {
1718
+ external_id: string;
1719
+ parent_ext_id?: string | null | undefined;
1720
+ email: string;
1721
+ given_name: string;
1722
+ family_name?: string | null | undefined;
1723
+ picture?: string | null | undefined;
1724
+ encryption_public_key: string;
1725
+ is_sso: boolean;
1726
+ };
1727
+ workspace_ext_id?: string | null | undefined;
1728
+ content?: string | null | undefined;
1729
+ read: boolean;
1730
+ created_at: string;
1731
+ updated_at: string;
1732
+ }[]>;
1733
+ declare function deleteDMs(arbi: ArbiClient, messageIds: string[]): Promise<void>;
1734
+
1735
+ type dm_DmCryptoContext = DmCryptoContext;
1736
+ type dm_ResolvedRecipient = ResolvedRecipient;
1737
+ declare const dm_createDmCryptoContext: typeof createDmCryptoContext;
1738
+ declare const dm_decryptDmBatch: typeof decryptDmBatch;
1739
+ declare const dm_decryptDmContent: typeof decryptDmContent;
1740
+ declare const dm_deleteDMs: typeof deleteDMs;
1741
+ declare const dm_encryptDmContent: typeof encryptDmContent;
1742
+ declare const dm_listActivity: typeof listActivity;
1743
+ declare const dm_listDMs: typeof listDMs;
1744
+ declare const dm_listDecryptedDMs: typeof listDecryptedDMs;
1745
+ declare const dm_markRead: typeof markRead;
1746
+ declare const dm_requestWorkspaceAccess: typeof requestWorkspaceAccess;
1747
+ declare const dm_resolveRecipient: typeof resolveRecipient;
1748
+ declare const dm_sendDM: typeof sendDM;
1749
+ declare const dm_sendEncryptedDM: typeof sendEncryptedDM;
1750
+ declare namespace dm {
1751
+ export { type dm_DmCryptoContext as DmCryptoContext, type dm_ResolvedRecipient as ResolvedRecipient, dm_createDmCryptoContext as createDmCryptoContext, dm_decryptDmBatch as decryptDmBatch, dm_decryptDmContent as decryptDmContent, dm_deleteDMs as deleteDMs, dm_encryptDmContent as encryptDmContent, dm_listActivity as listActivity, dm_listDMs as listDMs, dm_listDecryptedDMs as listDecryptedDMs, dm_markRead as markRead, dm_requestWorkspaceAccess as requestWorkspaceAccess, dm_resolveRecipient as resolveRecipient, dm_sendDM as sendDM, dm_sendEncryptedDM as sendEncryptedDM };
1752
+ }
1753
+
1754
+ /**
1755
+ * File operations — OpenAI-compatible Files API (list, get, delete, upload, content).
1756
+ */
1757
+
1758
+ type FileObject = components['schemas']['FileObject'];
1759
+ type FileDeleteResponse = components['schemas']['FileDeleteResponse'];
1760
+ type FileListResponse = components['schemas']['FileListResponse'];
1761
+
1762
+ interface ListFilesOptions {
1763
+ purpose?: string | null;
1764
+ limit?: number;
1765
+ order?: string;
1766
+ after?: string | null;
1767
+ }
1768
+ declare function listFiles(arbi: ArbiClient, options?: ListFilesOptions): Promise<{
1769
+ object: string;
1770
+ data: {
1771
+ id: string;
1772
+ object: string;
1773
+ bytes: number;
1774
+ created_at: number;
1775
+ filename: string;
1776
+ purpose: string;
1777
+ status: string;
1778
+ expires_at?: number | null | undefined;
1779
+ status_details?: string | null | undefined;
1780
+ }[];
1781
+ has_more: boolean;
1782
+ first_id?: string | null | undefined;
1783
+ last_id?: string | null | undefined;
1784
+ }>;
1785
+ declare function getFile(arbi: ArbiClient, fileId: string): Promise<{
1786
+ id: string;
1787
+ object: string;
1788
+ bytes: number;
1789
+ created_at: number;
1790
+ filename: string;
1791
+ purpose: string;
1792
+ status: string;
1793
+ expires_at?: number | null | undefined;
1794
+ status_details?: string | null | undefined;
1795
+ }>;
1796
+ declare function deleteFile(arbi: ArbiClient, fileId: string): Promise<{
1797
+ id: string;
1798
+ object: string;
1799
+ deleted: boolean;
1800
+ }>;
1801
+ /**
1802
+ * Upload a file via the OpenAI-compatible Files API.
1803
+ * Uses raw fetch for multipart upload.
1804
+ */
1805
+ declare function uploadFile(auth: AuthHeaders, fileData: Blob, fileName: string, purpose?: string): Promise<FileObject>;
1806
+ /**
1807
+ * Get file content (binary). Returns the raw Response for the caller to handle.
1808
+ */
1809
+ declare function getFileContent(auth: AuthHeaders, fileId: string): Promise<Response>;
1810
+
1811
+ type files_FileDeleteResponse = FileDeleteResponse;
1812
+ type files_FileListResponse = FileListResponse;
1813
+ type files_FileObject = FileObject;
1814
+ type files_ListFilesOptions = ListFilesOptions;
1815
+ declare const files_deleteFile: typeof deleteFile;
1816
+ declare const files_getFile: typeof getFile;
1817
+ declare const files_getFileContent: typeof getFileContent;
1818
+ declare const files_listFiles: typeof listFiles;
1819
+ declare const files_uploadFile: typeof uploadFile;
1820
+ declare namespace files {
1821
+ 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 };
1822
+ }
1823
+
1824
+ /**
1825
+ * Scheduled agent tasks — one-time, recurring (RFC-5545 rrule) or event-triggered
1826
+ * jobs whose action is a reminder, an agent prompt, or a skill run.
1827
+ * Backend: `/v1/tasks` (src/api/v1/routers/tasks.py).
1828
+ */
1829
+
1830
+ type TaskResponse = components['schemas']['TaskResponse'];
1831
+ type CreateTaskRequest = components['schemas']['CreateTaskRequest'];
1832
+ type UpdateTaskRequest = components['schemas']['UpdateTaskRequest'];
1833
+ /** List the caller's scheduled tasks (newest first). */
1834
+ declare function listTasks(arbi: ArbiClient): Promise<TaskResponse[]>;
1835
+ /** Create a scheduled task. `name` is required; supply trigger + action fields. */
1836
+ declare function createTask(arbi: ArbiClient, body: CreateTaskRequest): Promise<TaskResponse>;
1837
+ declare function getTask(arbi: ArbiClient, taskId: string): Promise<TaskResponse>;
1838
+ /** Update a task — including `status` to pause/resume (`active` | `paused`). */
1839
+ declare function updateTask(arbi: ArbiClient, taskId: string, body: UpdateTaskRequest): Promise<TaskResponse>;
1840
+ declare function deleteTask(arbi: ArbiClient, taskId: string): Promise<void>;
1841
+ /** Fire a task immediately without advancing its schedule. */
1842
+ declare function runTask(arbi: ArbiClient, taskId: string): Promise<TaskResponse>;
1843
+
1844
+ type tasks_CreateTaskRequest = CreateTaskRequest;
1845
+ type tasks_TaskResponse = TaskResponse;
1846
+ type tasks_UpdateTaskRequest = UpdateTaskRequest;
1847
+ declare const tasks_createTask: typeof createTask;
1848
+ declare const tasks_deleteTask: typeof deleteTask;
1849
+ declare const tasks_getTask: typeof getTask;
1850
+ declare const tasks_listTasks: typeof listTasks;
1851
+ declare const tasks_runTask: typeof runTask;
1852
+ declare const tasks_updateTask: typeof updateTask;
1853
+ declare namespace tasks {
1854
+ export { type tasks_CreateTaskRequest as CreateTaskRequest, type tasks_TaskResponse as TaskResponse, type tasks_UpdateTaskRequest as UpdateTaskRequest, tasks_createTask as createTask, tasks_deleteTask as deleteTask, tasks_getTask as getTask, tasks_listTasks as listTasks, tasks_runTask as runTask, tasks_updateTask as updateTask };
1855
+ }
1856
+
1857
+ /**
1858
+ * Workspace memory — per-workspace encrypted knowledge notes with citations.
1859
+ * The firm's practice profile / house style / precedent knowhow lives here and is
1860
+ * read by grounded agents. All endpoints require an OPEN workspace.
1861
+ * Backend: `/v1/memory` (src/api/v1/routers/memory.py).
1862
+ */
1863
+
1864
+ type MemoryResponse = components['schemas']['MemoryResponse'];
1865
+ type CreateMemoryRequest = components['schemas']['CreateMemoryRequest'];
1866
+ type UpdateMemoryRequest = components['schemas']['UpdateMemoryRequest'];
1867
+ type MemorySearchRequest = components['schemas']['MemorySearchRequest'];
1868
+ type MemorySearchResponse = components['schemas']['MemorySearchResponse'];
1869
+ /** Create a memory. `content` is required; `shared` makes it workspace-wide. */
1870
+ declare function createMemory(arbi: ArbiClient, body: CreateMemoryRequest): Promise<MemoryResponse>;
1871
+ /** List the open workspace's memories (newest first). */
1872
+ declare function listMemories(arbi: ArbiClient, options?: {
1873
+ pinnedOnly?: boolean;
1874
+ }): Promise<MemoryResponse[]>;
1875
+ /** Semantic/keyword/hybrid search across the workspace's memories. */
1876
+ declare function searchMemories(arbi: ArbiClient, body: MemorySearchRequest): Promise<MemorySearchResponse>;
1877
+ declare function updateMemory(arbi: ArbiClient, memoryId: string, body: UpdateMemoryRequest): Promise<MemoryResponse>;
1878
+ declare function deleteMemory(arbi: ArbiClient, memoryId: string): Promise<void>;
1879
+
1880
+ type memory_CreateMemoryRequest = CreateMemoryRequest;
1881
+ type memory_MemoryResponse = MemoryResponse;
1882
+ type memory_MemorySearchRequest = MemorySearchRequest;
1883
+ type memory_MemorySearchResponse = MemorySearchResponse;
1884
+ type memory_UpdateMemoryRequest = UpdateMemoryRequest;
1885
+ declare const memory_createMemory: typeof createMemory;
1886
+ declare const memory_deleteMemory: typeof deleteMemory;
1887
+ declare const memory_listMemories: typeof listMemories;
1888
+ declare const memory_searchMemories: typeof searchMemories;
1889
+ declare const memory_updateMemory: typeof updateMemory;
1890
+ declare namespace memory {
1891
+ export { type memory_CreateMemoryRequest as CreateMemoryRequest, type memory_MemoryResponse as MemoryResponse, type memory_MemorySearchRequest as MemorySearchRequest, type memory_MemorySearchResponse as MemorySearchResponse, type memory_UpdateMemoryRequest as UpdateMemoryRequest, memory_createMemory as createMemory, memory_deleteMemory as deleteMemory, memory_listMemories as listMemories, memory_searchMemories as searchMemories, memory_updateMemory as updateMemory };
1892
+ }
1893
+
1894
+ /**
1895
+ * High-level convenience class that wraps the full ARBI stack into a simple API.
1896
+ *
1897
+ * Handles SDK client creation, sodium initialization, authentication,
1898
+ * workspace key decryption, and delegates to all operations modules.
1899
+ *
1900
+ * Usage:
1901
+ * const arbi = new Arbi({ url: 'https://arbi.mycompany.com' })
1902
+ * await arbi.login('user@example.com', 'password')
1903
+ * const workspaces = await arbi.workspaces.list()
1904
+ * await arbi.selectWorkspace(workspaces[0].external_id)
1905
+ * const docs = await arbi.documents.list()
1906
+ */
1907
+
1908
+ type DocUpdateRequest = components['schemas']['DocUpdateRequest'];
1909
+ type WorkspaceUpdateRequest$1 = components['schemas']['WorkspaceUpdateRequest'];
1910
+ type UpdateTagRequest$1 = components['schemas']['UpdateTagRequest'];
1911
+ type TagFormat = components['schemas']['TagFormat'];
1912
+ type CitationData$1 = components['schemas']['CitationData'];
1913
+ type UserSettingsUpdate$1 = components['schemas']['UserSettingsUpdate'];
1914
+ type ConfigUpdateData$1 = components['schemas']['ConfigUpdateData'];
1915
+
1916
+ interface ArbiOptions {
1917
+ /** Backend API URL (e.g. 'https://arbi.mycompany.com') */
1918
+ url: string;
1919
+ /** Deployment domain for key derivation. Defaults to hostname of url. */
1920
+ deploymentDomain?: string;
1921
+ /** Include credentials (cookies) in requests. Default: 'omit' for SDK consumers. */
1922
+ credentials?: 'include' | 'omit' | 'same-origin';
1923
+ }
1924
+ interface QueryOptions {
1925
+ /** Document IDs to search against */
1926
+ docIds: string[];
1927
+ /** Previous response ID for follow-up questions */
1928
+ previousResponseId?: string | null;
1929
+ /** Model to use for generation */
1930
+ model?: string;
1931
+ /** Called for each streaming token */
1932
+ onToken?: (content: string) => void;
1933
+ /** Called when stream starts */
1934
+ onStreamStart?: (data: SSEStreamStartData) => void;
1935
+ /** Called for each agent step */
1936
+ onAgentStep?: (data: AgentStepEvent) => void;
1937
+ /** Called on stream error */
1938
+ onError?: (message: string) => void;
1939
+ /** Called when a user message event is received */
1940
+ onUserMessage?: (data: UserMessageEvent) => void;
1941
+ /** Called when message metadata is received */
1942
+ onMetadata?: (data: MessageMetadataPayload$1) => void;
1943
+ /** Called when the agent requests user input */
1944
+ onUserInputRequest?: (data: UserInputRequestEvent) => void;
1945
+ /** Called when an artifact event is received */
1946
+ onArtifact?: (data: ArtifactEvent) => void;
1947
+ /** Called when backend elapsed time is received */
1948
+ onElapsedTime?: (t: number) => void;
1949
+ /** Called when stream completes */
1950
+ onComplete?: () => void;
1951
+ }
1952
+ declare class Arbi {
1953
+ private client;
1954
+ private loginResult;
1955
+ private currentWorkspaceId;
1956
+ private dmCryptoContext;
1957
+ private readonly options;
1958
+ constructor(options: ArbiOptions);
1959
+ /** Initialize the SDK client and sodium crypto. Called automatically by login(). */
1960
+ init(): Promise<ArbiClient>;
1961
+ /**
1962
+ * Request a verification email for registration.
1963
+ * The user will receive an email with a 3-word verification code.
1964
+ */
1965
+ requestVerification(email: string): Promise<void>;
1966
+ /**
1967
+ * Register a new account using the verification code received by email.
1968
+ */
1969
+ register(params: {
1970
+ email: string;
1971
+ password: string;
1972
+ verificationCode: string;
1973
+ firstName?: string;
1974
+ lastName?: string;
1975
+ }): Promise<void>;
1640
1976
  /**
1641
1977
  * Log in with email and password.
1642
1978
  * Initializes the SDK client if not already done.
@@ -1769,6 +2105,50 @@ declare class Arbi {
1769
2105
  cancel_at_period_end?: boolean | null | undefined;
1770
2106
  portal_url?: string | null | undefined;
1771
2107
  }>;
2108
+ /** AI usage + spend breakdown for a project's billing period. */
2109
+ usage: (projectExtId: string, monthsBack?: number) => Promise<{
2110
+ project_ext_id: string;
2111
+ period_start: string;
2112
+ period_end: string;
2113
+ total_spend: number;
2114
+ total_tokens: number;
2115
+ total_requests: number;
2116
+ daily: components["schemas"]["DailyUsage"][];
2117
+ model_groups: {
2118
+ [key: string]: components["schemas"]["ModelGroupUsage"];
2119
+ };
2120
+ by_workspace: {
2121
+ [key: string]: components["schemas"]["TagBreakdown"];
2122
+ };
2123
+ by_user: {
2124
+ [key: string]: components["schemas"]["TagBreakdown"];
2125
+ };
2126
+ by_feature: {
2127
+ [key: string]: components["schemas"]["TagBreakdown"];
2128
+ };
2129
+ invoice_pdf?: string | null;
2130
+ }>;
2131
+ /** Stripe invoices for a project's subscription. */
2132
+ invoices: (projectExtId: string) => Promise<{
2133
+ project_ext_id: string;
2134
+ invoices: components["schemas"]["ProjectInvoice"][];
2135
+ }>;
2136
+ };
2137
+ readonly user: {
2138
+ /**
2139
+ * The authenticated user's identity from the current session
2140
+ * (`external_id` + `email`), established at login. Returns `null` when not
2141
+ * logged in. This is the canonical "who am I" accessor — DM direction and
2142
+ * ownership checks read it instead of re-deriving identity per call.
2143
+ */
2144
+ identity: () => {
2145
+ externalId: string;
2146
+ email: string;
2147
+ } | null;
2148
+ /** Today's deployment-wide credit spend for the current user. */
2149
+ usageToday: () => Promise<{
2150
+ credits_used: number;
2151
+ }>;
1772
2152
  };
1773
2153
  readonly workspaces: {
1774
2154
  list: () => Promise<{
@@ -2003,6 +2383,17 @@ declare class Arbi {
2003
2383
  error?: string | null | undefined;
2004
2384
  }[];
2005
2385
  }>;
2386
+ /**
2387
+ * The last-generated document-derived chronology (key case events / dates).
2388
+ * Defaults to the currently open workspace when no id is passed.
2389
+ */
2390
+ chronology: (workspaceId?: string) => Promise<{
2391
+ events?: {
2392
+ [key: string]: unknown;
2393
+ }[] | null;
2394
+ generated_at?: string | null;
2395
+ doc_count?: number | null;
2396
+ }>;
2006
2397
  };
2007
2398
  readonly documents: {
2008
2399
  list: () => Promise<{
@@ -2699,8 +3090,73 @@ declare class Arbi {
2699
3090
  readonly contacts: {
2700
3091
  list: () => Promise<{
2701
3092
  external_id: string;
2702
- email: string;
2703
- user?: {
3093
+ email: string;
3094
+ user?: {
3095
+ external_id: string;
3096
+ parent_ext_id?: string | null | undefined;
3097
+ email: string;
3098
+ given_name: string;
3099
+ family_name?: string | null | undefined;
3100
+ picture?: string | null | undefined;
3101
+ encryption_public_key: string;
3102
+ is_sso: boolean;
3103
+ } | null | undefined;
3104
+ status: "invitation_pending" | "invitation_expired" | "registered";
3105
+ created_at: string;
3106
+ }[]>;
3107
+ add: (emails: string[]) => Promise<{
3108
+ external_id: string;
3109
+ email: string;
3110
+ user?: {
3111
+ external_id: string;
3112
+ parent_ext_id?: string | null | undefined;
3113
+ email: string;
3114
+ given_name: string;
3115
+ family_name?: string | null | undefined;
3116
+ picture?: string | null | undefined;
3117
+ encryption_public_key: string;
3118
+ is_sso: boolean;
3119
+ } | null | undefined;
3120
+ status: "invitation_pending" | "invitation_expired" | "registered";
3121
+ created_at: string;
3122
+ }[]>;
3123
+ remove: (contactIds: string[]) => Promise<void>;
3124
+ groupByStatus: typeof groupContactsByStatus;
3125
+ };
3126
+ /**
3127
+ * Build (and cache) the DM crypto context for the current session.
3128
+ *
3129
+ * Derives the user's curve25519 keypair from the stored signing key and pairs
3130
+ * it with their external_id — everything `list()`/`send()` need to encrypt and
3131
+ * decrypt. Cached for the session and cleared on logout. Consumers never touch
3132
+ * this: it's an internal of the `dm` surface.
3133
+ */
3134
+ private requireDmCrypto;
3135
+ readonly dm: {
3136
+ /**
3137
+ * List direct messages, newest first, with content already **decrypted**.
3138
+ * (A message that can't be decrypted comes back as `[Decryption failed]`.)
3139
+ */
3140
+ list: () => Promise<{
3141
+ type: components["schemas"]["NotificationType"];
3142
+ external_id: string;
3143
+ sender: components["schemas"]["UserResponse"];
3144
+ recipient: components["schemas"]["UserResponse"];
3145
+ workspace_ext_id?: string | null;
3146
+ content?: string | null;
3147
+ read: boolean;
3148
+ created_at: string;
3149
+ updated_at: string;
3150
+ }[]>;
3151
+ /**
3152
+ * Send an E2E-encrypted DM to a recipient (email or `usr-`/`agt-` id).
3153
+ * Resolves the recipient's public key and encrypts internally — the caller
3154
+ * passes plaintext and never handles keys or ciphertext.
3155
+ */
3156
+ send: (recipient: string, text: string) => Promise<{
3157
+ type: components["schemas"]["NotificationType"];
3158
+ external_id: string;
3159
+ sender: {
2704
3160
  external_id: string;
2705
3161
  parent_ext_id?: string | null | undefined;
2706
3162
  email: string;
@@ -2709,14 +3165,8 @@ declare class Arbi {
2709
3165
  picture?: string | null | undefined;
2710
3166
  encryption_public_key: string;
2711
3167
  is_sso: boolean;
2712
- } | null | undefined;
2713
- status: "invitation_pending" | "invitation_expired" | "registered";
2714
- created_at: string;
2715
- }[]>;
2716
- add: (emails: string[]) => Promise<{
2717
- external_id: string;
2718
- email: string;
2719
- user?: {
3168
+ };
3169
+ recipient: {
2720
3170
  external_id: string;
2721
3171
  parent_ext_id?: string | null | undefined;
2722
3172
  email: string;
@@ -2725,15 +3175,18 @@ declare class Arbi {
2725
3175
  picture?: string | null | undefined;
2726
3176
  encryption_public_key: string;
2727
3177
  is_sso: boolean;
2728
- } | null | undefined;
2729
- status: "invitation_pending" | "invitation_expired" | "registered";
3178
+ };
3179
+ workspace_ext_id?: string | null | undefined;
3180
+ content?: string | null | undefined;
3181
+ read: boolean;
2730
3182
  created_at: string;
3183
+ updated_at: string;
2731
3184
  }[]>;
2732
- remove: (contactIds: string[]) => Promise<void>;
2733
- groupByStatus: typeof groupContactsByStatus;
2734
- };
2735
- readonly dm: {
2736
- list: () => Promise<{
3185
+ /**
3186
+ * Send to a recipient whose external_id + public key are already known
3187
+ * (e.g. from a message's `sender`), skipping directory resolution.
3188
+ */
3189
+ sendTo: (recipientExtId: string, recipientPublicKey: string, text: string) => Promise<{
2737
3190
  type: components["schemas"]["NotificationType"];
2738
3191
  external_id: string;
2739
3192
  sender: {
@@ -2762,10 +3215,9 @@ declare class Arbi {
2762
3215
  created_at: string;
2763
3216
  updated_at: string;
2764
3217
  }[]>;
2765
- send: (messages: Array<{
2766
- recipient_ext_id: string;
2767
- content: string;
2768
- }>) => Promise<{
3218
+ /** Resolve a recipient reference to `{ extId, pubKey }` (contacts → agents → workspace). */
3219
+ resolveRecipient: (recipient: string) => Promise<ResolvedRecipient | null>;
3220
+ markRead: (messageIds: string[]) => Promise<{
2769
3221
  type: components["schemas"]["NotificationType"];
2770
3222
  external_id: string;
2771
3223
  sender: {
@@ -2794,7 +3246,12 @@ declare class Arbi {
2794
3246
  created_at: string;
2795
3247
  updated_at: string;
2796
3248
  }[]>;
2797
- markRead: (messageIds: string[]) => Promise<{
3249
+ delete: (messageIds: string[]) => Promise<void>;
3250
+ /** List the current user's durable activity feed (never unread; excluded from DMs). */
3251
+ listActivity: (options?: {
3252
+ limit?: number;
3253
+ offset?: number;
3254
+ }) => Promise<{
2798
3255
  type: components["schemas"]["NotificationType"];
2799
3256
  external_id: string;
2800
3257
  sender: {
@@ -2823,7 +3280,6 @@ declare class Arbi {
2823
3280
  created_at: string;
2824
3281
  updated_at: string;
2825
3282
  }[]>;
2826
- delete: (messageIds: string[]) => Promise<void>;
2827
3283
  };
2828
3284
  readonly settings: {
2829
3285
  get: () => Promise<{
@@ -3811,6 +4267,7 @@ declare class Arbi {
3811
4267
  */
3812
4268
 
3813
4269
  type WorkspaceUpdateRequest = components['schemas']['WorkspaceUpdateRequest'];
4270
+ type WorkspaceChronologyOut = components['schemas']['WorkspaceChronologyOut'];
3814
4271
  declare function listWorkspaces(arbi: ArbiClient): Promise<{
3815
4272
  external_id: string;
3816
4273
  name: string;
@@ -4000,6 +4457,11 @@ declare function setUserRole(arbi: ArbiClient, userIds: string[], role: 'owner'
4000
4457
  agent_ext_id?: string | null | undefined;
4001
4458
  is_temporary: boolean;
4002
4459
  }[]>;
4460
+ /**
4461
+ * Return the last-generated document-derived chronology (key case events /
4462
+ * dates) for a workspace. Fields are all-null when none has been generated yet.
4463
+ */
4464
+ declare function getWorkspaceChronology(arbi: ArbiClient, workspaceId: string): Promise<WorkspaceChronologyOut>;
4003
4465
  declare function copyDocuments(arbi: ArbiClient, targetWorkspaceId: string, docIds: string[], targetWorkspaceKey: string): Promise<{
4004
4466
  detail: string;
4005
4467
  documents_copied: number;
@@ -4011,17 +4473,19 @@ declare function copyDocuments(arbi: ArbiClient, targetWorkspaceId: string, docI
4011
4473
  }[];
4012
4474
  }>;
4013
4475
 
4476
+ type workspaces_WorkspaceChronologyOut = WorkspaceChronologyOut;
4014
4477
  declare const workspaces_addWorkspaceUsers: typeof addWorkspaceUsers;
4015
4478
  declare const workspaces_copyDocuments: typeof copyDocuments;
4016
4479
  declare const workspaces_createWorkspace: typeof createWorkspace;
4017
4480
  declare const workspaces_deleteWorkspaces: typeof deleteWorkspaces;
4481
+ declare const workspaces_getWorkspaceChronology: typeof getWorkspaceChronology;
4018
4482
  declare const workspaces_listWorkspaceUsers: typeof listWorkspaceUsers;
4019
4483
  declare const workspaces_listWorkspaces: typeof listWorkspaces;
4020
4484
  declare const workspaces_removeWorkspaceUsers: typeof removeWorkspaceUsers;
4021
4485
  declare const workspaces_setUserRole: typeof setUserRole;
4022
4486
  declare const workspaces_updateWorkspace: typeof updateWorkspace;
4023
4487
  declare namespace workspaces {
4024
- 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 };
4488
+ export { type workspaces_WorkspaceChronologyOut as WorkspaceChronologyOut, workspaces_addWorkspaceUsers as addWorkspaceUsers, workspaces_copyDocuments as copyDocuments, workspaces_createWorkspace as createWorkspace, workspaces_deleteWorkspaces as deleteWorkspaces, workspaces_getWorkspaceChronology as getWorkspaceChronology, workspaces_listWorkspaceUsers as listWorkspaceUsers, workspaces_listWorkspaces as listWorkspaces, workspaces_removeWorkspaceUsers as removeWorkspaceUsers, workspaces_setUserRole as setUserRole, workspaces_updateWorkspace as updateWorkspace };
4025
4489
  }
4026
4490
 
4027
4491
  /**
@@ -4281,503 +4745,227 @@ declare function deleteConversation(arbi: ArbiClient, conversationId: string): P
4281
4745
  declare function shareConversation(arbi: ArbiClient, conversationId: string): Promise<{
4282
4746
  detail: string;
4283
4747
  }>;
4284
- declare function updateConversationTitle(arbi: ArbiClient, conversationId: string, title: string): Promise<{
4285
- detail: string;
4286
- title: string;
4287
- }>;
4288
- declare function getMessage(arbi: ArbiClient, messageId: string): Promise<{
4289
- role: "user" | "assistant" | "system";
4290
- content: string;
4291
- tools?: {
4292
- [x: string]: {
4293
- name: "model_citation";
4294
- description: string;
4295
- tool_responses: {
4296
- [x: string]: {
4297
- chunk_ids: string[];
4298
- scores: number[];
4299
- statement: string;
4300
- offset_start: number;
4301
- offset_end: number;
4302
- };
4303
- };
4304
- } | {
4305
- name: "retrieval_chunk";
4306
- description: string;
4307
- tool_args: {
4308
- doc_ext_ids: string[];
4309
- search_mode?: ("semantic" | "keyword" | "hybrid") | null | undefined;
4310
- };
4311
- tool_responses: {
4312
- [x: string]: {
4313
- metadata: {
4314
- workspace_ext_id?: string | null | undefined;
4315
- doc_ext_id?: string | null | undefined;
4316
- doc_title?: string | null | undefined;
4317
- chunk_id?: string | null | undefined;
4318
- chunk_ext_id: string;
4319
- chunk_pg_idx: number;
4320
- chunk_doc_idx: number;
4321
- page_number: number;
4322
- score?: number | null | undefined;
4323
- rerank_score?: number | null | undefined;
4324
- tokens?: number | null | undefined;
4325
- created_at: string;
4326
- heading: boolean;
4327
- bbox?: number[] | null | undefined;
4328
- element_type?: string | null | undefined;
4329
- heading_level?: number | null | undefined;
4330
- };
4331
- content: string;
4332
- }[];
4333
- };
4334
- } | {
4335
- name: "retrieval_full_context";
4336
- description: string;
4337
- tool_args: {
4338
- doc_ext_ids: string[];
4339
- from_ref?: string | null | undefined;
4340
- to_ref?: string | null | undefined;
4341
- };
4342
- tool_responses: {
4343
- [x: string]: {
4344
- metadata: {
4345
- workspace_ext_id?: string | null | undefined;
4346
- doc_ext_id?: string | null | undefined;
4347
- doc_title?: string | null | undefined;
4348
- chunk_id?: string | null | undefined;
4349
- chunk_ext_id: string;
4350
- chunk_pg_idx: number;
4351
- chunk_doc_idx: number;
4352
- page_number: number;
4353
- score?: number | null | undefined;
4354
- rerank_score?: number | null | undefined;
4355
- tokens?: number | null | undefined;
4356
- created_at: string;
4357
- heading: boolean;
4358
- bbox?: number[] | null | undefined;
4359
- element_type?: string | null | undefined;
4360
- heading_level?: number | null | undefined;
4361
- };
4362
- content: string;
4363
- }[];
4364
- };
4365
- } | {
4366
- name: "retrieval_toc";
4367
- description: string;
4368
- tool_args: {
4369
- doc_ext_ids: string[];
4370
- };
4371
- tool_responses: {
4372
- [x: string]: {
4373
- [x: string]: unknown;
4374
- }[];
4375
- };
4376
- } | {
4377
- name: "trace";
4378
- description: string;
4379
- trace_id?: string | null | undefined;
4380
- start_time?: number | null | undefined;
4381
- duration_seconds?: number | null | undefined;
4382
- steps: {
4383
- [x: string]: unknown;
4384
- }[];
4385
- } | {
4386
- name: "compaction";
4387
- description: string;
4388
- tool_args: {
4389
- source_conversation_ext_id?: string | null | undefined;
4390
- source_leaf_message_ext_id?: string | null | undefined;
4391
- messages_summarized?: number | null | undefined;
4392
- tokens_above?: number | null | undefined;
4393
- tokens_summary?: number | null | undefined;
4394
- model_used?: string | null | undefined;
4395
- };
4396
- tool_responses: {
4397
- [x: string]: string;
4398
- };
4399
- } | {
4400
- name: "personal_agent";
4401
- description: string;
4402
- tool_args: {
4403
- task: string;
4404
- };
4405
- tool_responses: {
4406
- [x: string]: unknown;
4407
- };
4408
- } | {
4409
- name: "stream_events";
4410
- events: {
4411
- [x: string]: unknown;
4412
- }[];
4413
- } | {
4414
- name: "memory";
4415
- description: string;
4416
- tool_responses: {
4417
- written: string[];
4418
- superseded: string[];
4419
- };
4420
- };
4421
- } | undefined;
4422
- config_ext_id?: string | null | undefined;
4423
- shared: boolean;
4424
- tokens: number;
4425
- status: string;
4426
- external_id: string;
4427
- created_at: string;
4428
- created_by_ext_id: string;
4429
- conversation_ext_id: string;
4430
- parent_message_ext_id?: string | null | undefined;
4431
- }>;
4432
- declare function deleteMessage(arbi: ArbiClient, messageId: string): Promise<{
4433
- detail: string;
4434
- }>;
4435
-
4436
- type conversations_ConversationImportResponse = ConversationImportResponse;
4437
- declare const conversations_deleteConversation: typeof deleteConversation;
4438
- declare const conversations_deleteMessage: typeof deleteMessage;
4439
- declare const conversations_getConversationThreads: typeof getConversationThreads;
4440
- declare const conversations_getMessage: typeof getMessage;
4441
- declare const conversations_importConversations: typeof importConversations;
4442
- declare const conversations_listConversations: typeof listConversations;
4443
- declare const conversations_shareConversation: typeof shareConversation;
4444
- declare const conversations_updateConversationTitle: typeof updateConversationTitle;
4445
- declare namespace conversations {
4446
- export { type conversations_ConversationImportResponse as ConversationImportResponse, conversations_deleteConversation as deleteConversation, conversations_deleteMessage as deleteMessage, conversations_getConversationThreads as getConversationThreads, conversations_getMessage as getMessage, conversations_importConversations as importConversations, conversations_listConversations as listConversations, conversations_shareConversation as shareConversation, conversations_updateConversationTitle as updateConversationTitle };
4447
- }
4448
-
4449
- /**
4450
- * Document-tag (doctag) operations — assign, remove, generate.
4451
- */
4452
-
4453
- type CitationData = components['schemas']['CitationData'];
4454
- declare function assignDocTags(arbi: ArbiClient, tagId: string, docIds: string[], note?: string | null): Promise<{
4455
- doc_ext_id: string;
4456
- tag_ext_id: string;
4457
- note?: string | null | undefined;
4458
- citations?: {
4459
- [x: string]: {
4460
- chunk_ids: string[];
4461
- scores: number[];
4462
- statement: string;
4463
- offset_start: number;
4464
- offset_end: number;
4465
- };
4466
- } | null | undefined;
4467
- created_by_ext_id: string;
4468
- updated_by_ext_id?: string | null | undefined;
4469
- created_at: string;
4470
- updated_at: string;
4471
- }[]>;
4472
- declare function removeDocTags(arbi: ArbiClient, tagId: string, docIds: string[]): Promise<void>;
4473
- declare function updateDocTag(arbi: ArbiClient, tagId: string, docId: string, updates: {
4474
- note?: string | null;
4475
- citations?: Record<string, CitationData> | null;
4476
- }): Promise<{
4477
- doc_ext_id: string;
4478
- tag_ext_id: string;
4479
- note?: string | null | undefined;
4480
- citations?: {
4481
- [x: string]: {
4482
- chunk_ids: string[];
4483
- scores: number[];
4484
- statement: string;
4485
- offset_start: number;
4486
- offset_end: number;
4487
- };
4488
- } | null | undefined;
4489
- created_by_ext_id: string;
4490
- updated_by_ext_id?: string | null | undefined;
4491
- created_at: string;
4492
- updated_at: string;
4493
- }>;
4494
- declare function generateDocTags(arbi: ArbiClient, tagIds: string[], docIds: string[]): Promise<{
4495
- doc_ext_ids: string[];
4496
- tag_ext_ids: string[];
4748
+ declare function updateConversationTitle(arbi: ArbiClient, conversationId: string, title: string): Promise<{
4749
+ detail: string;
4750
+ title: string;
4497
4751
  }>;
4498
-
4499
- declare const doctags_assignDocTags: typeof assignDocTags;
4500
- declare const doctags_generateDocTags: typeof generateDocTags;
4501
- declare const doctags_removeDocTags: typeof removeDocTags;
4502
- declare const doctags_updateDocTag: typeof updateDocTag;
4503
- declare namespace doctags {
4504
- export { doctags_assignDocTags as assignDocTags, doctags_generateDocTags as generateDocTags, doctags_removeDocTags as removeDocTags, doctags_updateDocTag as updateDocTag };
4505
- }
4506
-
4507
- /**
4508
- * Direct message / notification operations — list, send, mark read, delete.
4509
- *
4510
- * All message content is E2E encrypted using ECDH (X25519 + XSalsa20-Poly1305).
4511
- * Encryption keys are derived from the user's Ed25519 signing keypair.
4512
- */
4513
-
4514
- type NotificationResponse = components['schemas']['NotificationResponse'];
4515
- /**
4516
- * Everything needed to encrypt/decrypt DMs.
4517
- * Derive once per session, pass to all DM operations.
4518
- */
4519
- interface DmCryptoContext {
4520
- /** User's X25519 encryption keypair (derived from Ed25519 signing key) */
4521
- encryptionKeypair: KeyPair;
4522
- /** User's own external_id (to determine send vs receive direction) */
4523
- userExtId: string;
4524
- }
4525
- /**
4526
- * Create a DM crypto context from a signing private key.
4527
- *
4528
- * @param arbi - ArbiClient instance (provides crypto utilities)
4529
- * @param signingPrivateKeyBytes - Ed25519 signing private key (64 bytes)
4530
- * @param userExtId - Current user's external_id
4531
- */
4532
- declare function createDmCryptoContext(arbi: ArbiClient, signingPrivateKeyBytes: Uint8Array, userExtId: string): DmCryptoContext;
4533
- /**
4534
- * Encrypt a plaintext message for a recipient.
4535
- *
4536
- * @param arbi - ArbiClient instance
4537
- * @param plaintext - Message content to encrypt
4538
- * @param recipientEncryptionPubKeyBase64 - Recipient's X25519 public key (base64)
4539
- * @param senderEncryptionSecretKey - Sender's X25519 secret key (Uint8Array)
4540
- * @returns Base64-encoded ciphertext (nonce prepended)
4541
- */
4542
- declare function encryptDmContent(arbi: ArbiClient, plaintext: string, recipientEncryptionPubKeyBase64: string, senderEncryptionSecretKey: Uint8Array): Promise<string>;
4543
- /**
4544
- * Decrypt an encrypted notification message.
4545
- *
4546
- * Uses the sender/recipient public keys embedded in NotificationResponse
4547
- * to determine the "other party" for ECDH decryption.
4548
- *
4549
- * @param arbi - ArbiClient instance
4550
- * @param notification - The notification with encrypted content
4551
- * @param crypto - DM crypto context for the current user
4552
- * @returns Decrypted plaintext, or null if content is empty
4553
- * @throws Error if decryption fails (wrong keys or tampered message)
4554
- */
4555
- declare function decryptDmContent(arbi: ArbiClient, notification: NotificationResponse, crypto: DmCryptoContext): Promise<string | null>;
4556
- /**
4557
- * Decrypt a batch of notifications, replacing content in-place.
4558
- * Failed decryptions get content set to '[Decryption failed]'.
4559
- *
4560
- * @returns New array with decrypted content
4561
- */
4562
- declare function decryptDmBatch(arbi: ArbiClient, notifications: NotificationResponse[], crypto: DmCryptoContext): Promise<NotificationResponse[]>;
4563
- /**
4564
- * List DMs (raw — content is encrypted ciphertext).
4565
- */
4566
- declare function listDMs(arbi: ArbiClient): Promise<{
4567
- type: components["schemas"]["NotificationType"];
4568
- external_id: string;
4569
- sender: {
4570
- external_id: string;
4571
- parent_ext_id?: string | null | undefined;
4572
- email: string;
4573
- given_name: string;
4574
- family_name?: string | null | undefined;
4575
- picture?: string | null | undefined;
4576
- encryption_public_key: string;
4577
- is_sso: boolean;
4578
- };
4579
- recipient: {
4580
- external_id: string;
4581
- parent_ext_id?: string | null | undefined;
4582
- email: string;
4583
- given_name: string;
4584
- family_name?: string | null | undefined;
4585
- picture?: string | null | undefined;
4586
- encryption_public_key: string;
4587
- is_sso: boolean;
4588
- };
4589
- workspace_ext_id?: string | null | undefined;
4590
- content?: string | null | undefined;
4591
- read: boolean;
4592
- created_at: string;
4593
- updated_at: string;
4594
- }[]>;
4595
- /**
4596
- * List and decrypt DMs in one call.
4597
- */
4598
- declare function listDecryptedDMs(arbi: ArbiClient, crypto: DmCryptoContext): Promise<{
4599
- type: components["schemas"]["NotificationType"];
4600
- external_id: string;
4601
- sender: components["schemas"]["UserResponse"];
4602
- recipient: components["schemas"]["UserResponse"];
4603
- workspace_ext_id?: string | null;
4604
- content?: string | null;
4605
- read: boolean;
4606
- created_at: string;
4607
- updated_at: string;
4608
- }[]>;
4609
- /**
4610
- * Send an E2E encrypted DM.
4611
- *
4612
- * Encrypts plaintext content for each recipient using their public key.
4613
- * Requires recipient public keys — fetch via contacts or user lookup first.
4614
- *
4615
- * @param arbi - ArbiClient instance
4616
- * @param messages - Array of { recipient_ext_id, content (plaintext), recipient_encryption_public_key }
4617
- * @param crypto - DM crypto context for the sender
4618
- */
4619
- declare function sendEncryptedDM(arbi: ArbiClient, messages: Array<{
4620
- recipient_ext_id: string;
4752
+ declare function getMessage(arbi: ArbiClient, messageId: string): Promise<{
4753
+ role: "user" | "assistant" | "system";
4621
4754
  content: string;
4622
- recipient_encryption_public_key: string;
4623
- }>, crypto: DmCryptoContext): Promise<{
4624
- type: components["schemas"]["NotificationType"];
4625
- external_id: string;
4626
- sender: {
4627
- external_id: string;
4628
- parent_ext_id?: string | null | undefined;
4629
- email: string;
4630
- given_name: string;
4631
- family_name?: string | null | undefined;
4632
- picture?: string | null | undefined;
4633
- encryption_public_key: string;
4634
- is_sso: boolean;
4635
- };
4636
- recipient: {
4637
- external_id: string;
4638
- parent_ext_id?: string | null | undefined;
4639
- email: string;
4640
- given_name: string;
4641
- family_name?: string | null | undefined;
4642
- picture?: string | null | undefined;
4643
- encryption_public_key: string;
4644
- is_sso: boolean;
4645
- };
4646
- workspace_ext_id?: string | null | undefined;
4647
- content?: string | null | undefined;
4648
- read: boolean;
4649
- created_at: string;
4650
- updated_at: string;
4651
- }[]>;
4652
- /**
4653
- * Ask another user to grant you workspace access.
4654
- *
4655
- * Creates a `workspace_access_request` notification. The `content` is an
4656
- * opaque base64 blob, E2E-encrypted with the requester↔recipient shared key
4657
- * (same scheme as a DM), carrying the requester's live session public key
4658
- * (`sessionPubkeyB64`) so the recipient can mint a temporary, session-scoped
4659
- * grant, plus an optional note.
4660
- *
4661
- * `workspaceExtId` is optional and only meaningful for API/SDK/CLI callers who
4662
- * already know a workspace id (obtained out-of-band); omit it and the recipient
4663
- * picks the workspace.
4664
- */
4665
- declare function requestWorkspaceAccess(arbi: ArbiClient, params: {
4666
- recipientExtId: string;
4667
- recipientEncryptionPublicKey: string;
4668
- sessionPubkeyB64: string;
4669
- note?: string;
4670
- workspaceExtId?: string;
4671
- }, crypto: DmCryptoContext): Promise<{
4672
- type: components["schemas"]["NotificationType"];
4755
+ tools?: {
4756
+ [x: string]: {
4757
+ name: "model_citation";
4758
+ description: string;
4759
+ tool_responses: {
4760
+ [x: string]: {
4761
+ chunk_ids: string[];
4762
+ scores: number[];
4763
+ statement: string;
4764
+ offset_start: number;
4765
+ offset_end: number;
4766
+ };
4767
+ };
4768
+ } | {
4769
+ name: "retrieval_chunk";
4770
+ description: string;
4771
+ tool_args: {
4772
+ doc_ext_ids: string[];
4773
+ search_mode?: ("semantic" | "keyword" | "hybrid") | null | undefined;
4774
+ };
4775
+ tool_responses: {
4776
+ [x: string]: {
4777
+ metadata: {
4778
+ workspace_ext_id?: string | null | undefined;
4779
+ doc_ext_id?: string | null | undefined;
4780
+ doc_title?: string | null | undefined;
4781
+ chunk_id?: string | null | undefined;
4782
+ chunk_ext_id: string;
4783
+ chunk_pg_idx: number;
4784
+ chunk_doc_idx: number;
4785
+ page_number: number;
4786
+ score?: number | null | undefined;
4787
+ rerank_score?: number | null | undefined;
4788
+ tokens?: number | null | undefined;
4789
+ created_at: string;
4790
+ heading: boolean;
4791
+ bbox?: number[] | null | undefined;
4792
+ element_type?: string | null | undefined;
4793
+ heading_level?: number | null | undefined;
4794
+ };
4795
+ content: string;
4796
+ }[];
4797
+ };
4798
+ } | {
4799
+ name: "retrieval_full_context";
4800
+ description: string;
4801
+ tool_args: {
4802
+ doc_ext_ids: string[];
4803
+ from_ref?: string | null | undefined;
4804
+ to_ref?: string | null | undefined;
4805
+ };
4806
+ tool_responses: {
4807
+ [x: string]: {
4808
+ metadata: {
4809
+ workspace_ext_id?: string | null | undefined;
4810
+ doc_ext_id?: string | null | undefined;
4811
+ doc_title?: string | null | undefined;
4812
+ chunk_id?: string | null | undefined;
4813
+ chunk_ext_id: string;
4814
+ chunk_pg_idx: number;
4815
+ chunk_doc_idx: number;
4816
+ page_number: number;
4817
+ score?: number | null | undefined;
4818
+ rerank_score?: number | null | undefined;
4819
+ tokens?: number | null | undefined;
4820
+ created_at: string;
4821
+ heading: boolean;
4822
+ bbox?: number[] | null | undefined;
4823
+ element_type?: string | null | undefined;
4824
+ heading_level?: number | null | undefined;
4825
+ };
4826
+ content: string;
4827
+ }[];
4828
+ };
4829
+ } | {
4830
+ name: "retrieval_toc";
4831
+ description: string;
4832
+ tool_args: {
4833
+ doc_ext_ids: string[];
4834
+ };
4835
+ tool_responses: {
4836
+ [x: string]: {
4837
+ [x: string]: unknown;
4838
+ }[];
4839
+ };
4840
+ } | {
4841
+ name: "trace";
4842
+ description: string;
4843
+ trace_id?: string | null | undefined;
4844
+ start_time?: number | null | undefined;
4845
+ duration_seconds?: number | null | undefined;
4846
+ steps: {
4847
+ [x: string]: unknown;
4848
+ }[];
4849
+ } | {
4850
+ name: "compaction";
4851
+ description: string;
4852
+ tool_args: {
4853
+ source_conversation_ext_id?: string | null | undefined;
4854
+ source_leaf_message_ext_id?: string | null | undefined;
4855
+ messages_summarized?: number | null | undefined;
4856
+ tokens_above?: number | null | undefined;
4857
+ tokens_summary?: number | null | undefined;
4858
+ model_used?: string | null | undefined;
4859
+ };
4860
+ tool_responses: {
4861
+ [x: string]: string;
4862
+ };
4863
+ } | {
4864
+ name: "personal_agent";
4865
+ description: string;
4866
+ tool_args: {
4867
+ task: string;
4868
+ };
4869
+ tool_responses: {
4870
+ [x: string]: unknown;
4871
+ };
4872
+ } | {
4873
+ name: "stream_events";
4874
+ events: {
4875
+ [x: string]: unknown;
4876
+ }[];
4877
+ } | {
4878
+ name: "memory";
4879
+ description: string;
4880
+ tool_responses: {
4881
+ written: string[];
4882
+ superseded: string[];
4883
+ };
4884
+ };
4885
+ } | undefined;
4886
+ config_ext_id?: string | null | undefined;
4887
+ shared: boolean;
4888
+ tokens: number;
4889
+ status: string;
4673
4890
  external_id: string;
4674
- sender: {
4675
- external_id: string;
4676
- parent_ext_id?: string | null | undefined;
4677
- email: string;
4678
- given_name: string;
4679
- family_name?: string | null | undefined;
4680
- picture?: string | null | undefined;
4681
- encryption_public_key: string;
4682
- is_sso: boolean;
4683
- };
4684
- recipient: {
4685
- external_id: string;
4686
- parent_ext_id?: string | null | undefined;
4687
- email: string;
4688
- given_name: string;
4689
- family_name?: string | null | undefined;
4690
- picture?: string | null | undefined;
4691
- encryption_public_key: string;
4692
- is_sso: boolean;
4693
- };
4694
- workspace_ext_id?: string | null | undefined;
4695
- content?: string | null | undefined;
4696
- read: boolean;
4697
4891
  created_at: string;
4698
- updated_at: string;
4892
+ created_by_ext_id: string;
4893
+ conversation_ext_id: string;
4894
+ parent_message_ext_id?: string | null | undefined;
4895
+ }>;
4896
+ declare function deleteMessage(arbi: ArbiClient, messageId: string): Promise<{
4897
+ detail: string;
4699
4898
  }>;
4899
+
4900
+ type conversations_ConversationImportResponse = ConversationImportResponse;
4901
+ declare const conversations_deleteConversation: typeof deleteConversation;
4902
+ declare const conversations_deleteMessage: typeof deleteMessage;
4903
+ declare const conversations_getConversationThreads: typeof getConversationThreads;
4904
+ declare const conversations_getMessage: typeof getMessage;
4905
+ declare const conversations_importConversations: typeof importConversations;
4906
+ declare const conversations_listConversations: typeof listConversations;
4907
+ declare const conversations_shareConversation: typeof shareConversation;
4908
+ declare const conversations_updateConversationTitle: typeof updateConversationTitle;
4909
+ declare namespace conversations {
4910
+ export { type conversations_ConversationImportResponse as ConversationImportResponse, conversations_deleteConversation as deleteConversation, conversations_deleteMessage as deleteMessage, conversations_getConversationThreads as getConversationThreads, conversations_getMessage as getMessage, conversations_importConversations as importConversations, conversations_listConversations as listConversations, conversations_shareConversation as shareConversation, conversations_updateConversationTitle as updateConversationTitle };
4911
+ }
4912
+
4700
4913
  /**
4701
- * Send a plaintext DM (no encryption).
4702
- * @deprecated Use sendEncryptedDM instead.
4914
+ * Document-tag (doctag) operations — assign, remove, generate.
4703
4915
  */
4704
- declare function sendDM(arbi: ArbiClient, messages: Array<{
4705
- recipient_ext_id: string;
4706
- content: string;
4707
- }>): Promise<{
4708
- type: components["schemas"]["NotificationType"];
4709
- external_id: string;
4710
- sender: {
4711
- external_id: string;
4712
- parent_ext_id?: string | null | undefined;
4713
- email: string;
4714
- given_name: string;
4715
- family_name?: string | null | undefined;
4716
- picture?: string | null | undefined;
4717
- encryption_public_key: string;
4718
- is_sso: boolean;
4719
- };
4720
- recipient: {
4721
- external_id: string;
4722
- parent_ext_id?: string | null | undefined;
4723
- email: string;
4724
- given_name: string;
4725
- family_name?: string | null | undefined;
4726
- picture?: string | null | undefined;
4727
- encryption_public_key: string;
4728
- is_sso: boolean;
4729
- };
4730
- workspace_ext_id?: string | null | undefined;
4731
- content?: string | null | undefined;
4732
- read: boolean;
4916
+
4917
+ type CitationData = components['schemas']['CitationData'];
4918
+ declare function assignDocTags(arbi: ArbiClient, tagId: string, docIds: string[], note?: string | null): Promise<{
4919
+ doc_ext_id: string;
4920
+ tag_ext_id: string;
4921
+ note?: string | null | undefined;
4922
+ citations?: {
4923
+ [x: string]: {
4924
+ chunk_ids: string[];
4925
+ scores: number[];
4926
+ statement: string;
4927
+ offset_start: number;
4928
+ offset_end: number;
4929
+ };
4930
+ } | null | undefined;
4931
+ created_by_ext_id: string;
4932
+ updated_by_ext_id?: string | null | undefined;
4733
4933
  created_at: string;
4734
4934
  updated_at: string;
4735
4935
  }[]>;
4736
- declare function markRead(arbi: ArbiClient, messageIds: string[]): Promise<{
4737
- type: components["schemas"]["NotificationType"];
4738
- external_id: string;
4739
- sender: {
4740
- external_id: string;
4741
- parent_ext_id?: string | null | undefined;
4742
- email: string;
4743
- given_name: string;
4744
- family_name?: string | null | undefined;
4745
- picture?: string | null | undefined;
4746
- encryption_public_key: string;
4747
- is_sso: boolean;
4748
- };
4749
- recipient: {
4750
- external_id: string;
4751
- parent_ext_id?: string | null | undefined;
4752
- email: string;
4753
- given_name: string;
4754
- family_name?: string | null | undefined;
4755
- picture?: string | null | undefined;
4756
- encryption_public_key: string;
4757
- is_sso: boolean;
4758
- };
4759
- workspace_ext_id?: string | null | undefined;
4760
- content?: string | null | undefined;
4761
- read: boolean;
4936
+ declare function removeDocTags(arbi: ArbiClient, tagId: string, docIds: string[]): Promise<void>;
4937
+ declare function updateDocTag(arbi: ArbiClient, tagId: string, docId: string, updates: {
4938
+ note?: string | null;
4939
+ citations?: Record<string, CitationData> | null;
4940
+ }): Promise<{
4941
+ doc_ext_id: string;
4942
+ tag_ext_id: string;
4943
+ note?: string | null | undefined;
4944
+ citations?: {
4945
+ [x: string]: {
4946
+ chunk_ids: string[];
4947
+ scores: number[];
4948
+ statement: string;
4949
+ offset_start: number;
4950
+ offset_end: number;
4951
+ };
4952
+ } | null | undefined;
4953
+ created_by_ext_id: string;
4954
+ updated_by_ext_id?: string | null | undefined;
4762
4955
  created_at: string;
4763
4956
  updated_at: string;
4764
- }[]>;
4765
- declare function deleteDMs(arbi: ArbiClient, messageIds: string[]): Promise<void>;
4957
+ }>;
4958
+ declare function generateDocTags(arbi: ArbiClient, tagIds: string[], docIds: string[]): Promise<{
4959
+ doc_ext_ids: string[];
4960
+ tag_ext_ids: string[];
4961
+ }>;
4766
4962
 
4767
- type dm_DmCryptoContext = DmCryptoContext;
4768
- declare const dm_createDmCryptoContext: typeof createDmCryptoContext;
4769
- declare const dm_decryptDmBatch: typeof decryptDmBatch;
4770
- declare const dm_decryptDmContent: typeof decryptDmContent;
4771
- declare const dm_deleteDMs: typeof deleteDMs;
4772
- declare const dm_encryptDmContent: typeof encryptDmContent;
4773
- declare const dm_listDMs: typeof listDMs;
4774
- declare const dm_listDecryptedDMs: typeof listDecryptedDMs;
4775
- declare const dm_markRead: typeof markRead;
4776
- declare const dm_requestWorkspaceAccess: typeof requestWorkspaceAccess;
4777
- declare const dm_sendDM: typeof sendDM;
4778
- declare const dm_sendEncryptedDM: typeof sendEncryptedDM;
4779
- declare namespace dm {
4780
- export { type dm_DmCryptoContext as DmCryptoContext, dm_createDmCryptoContext as createDmCryptoContext, dm_decryptDmBatch as decryptDmBatch, dm_decryptDmContent as decryptDmContent, dm_deleteDMs as deleteDMs, dm_encryptDmContent as encryptDmContent, dm_listDMs as listDMs, dm_listDecryptedDMs as listDecryptedDMs, dm_markRead as markRead, dm_requestWorkspaceAccess as requestWorkspaceAccess, dm_sendDM as sendDM, dm_sendEncryptedDM as sendEncryptedDM };
4963
+ declare const doctags_assignDocTags: typeof assignDocTags;
4964
+ declare const doctags_generateDocTags: typeof generateDocTags;
4965
+ declare const doctags_removeDocTags: typeof removeDocTags;
4966
+ declare const doctags_updateDocTag: typeof updateDocTag;
4967
+ declare namespace doctags {
4968
+ export { doctags_assignDocTags as assignDocTags, doctags_generateDocTags as generateDocTags, doctags_removeDocTags as removeDocTags, doctags_updateDocTag as updateDocTag };
4781
4969
  }
4782
4970
 
4783
4971
  /**
@@ -5280,4 +5468,131 @@ declare namespace responses {
5280
5468
  export { type responses_SubmitBackgroundQueryOptions as SubmitBackgroundQueryOptions, responses_extractResponseText as extractResponseText, responses_getResponse as getResponse, responses_submitBackgroundQuery as submitBackgroundQuery };
5281
5469
  }
5282
5470
 
5283
- export { type SSEStreamResult as $, type AgentStepDeltaEvent as A, type MemorySearchResponse as B, type ChatSession as C, DOC_TERMINAL_STATUSES as D, type MessageLevel as E, type FormattedWsMessage as F, type MessageMetadataPayload$1 as G, type MessageQueuedEvent as H, type ReconnectableWsConnection as I, type ResolvedCitation as J, type ResponseCompletedEvent as K, type ListAllOptions as L, type MemoryResponse as M, type ResponseContentPartAddedEvent as N, type OutputTokensDetails as O, type ParsedSlashCommand as P, type QueryOptions as Q, type ReconnectOptions as R, type ResponseCreatedEvent as S, type ResponseFailedEvent as T, type ResponseOutputItemAddedEvent as U, type ResponseOutputItemDoneEvent as V, type ResponseOutputTextDeltaEvent as W, type ResponseOutputTextDoneEvent as X, type ResponseUsage as Y, type SSEEvent as Z, type SSEStreamCallbacks as _, type AgentStepEvent as a, selectWorkspaceById as a$, type SSEStreamStartData as a0, SUPPORTED_EXTENSIONS as a1, type SkillSummary as a2, type SkippedFile as a3, type TaskResponse as a4, type UpdateMemoryRequest as a5, type UpdateTaskRequest as a6, type UploadBatchResult as a7, type UploadDirectOptions as a8, type UploadDirectResult as a9, filterSkills as aA, formatAgentStepLabel as aB, formatFileSize as aC, formatStreamSummary as aD, formatUserName as aE, formatWorkspaceChoices as aF, formatWsMessage as aG, generateEncryptedWorkspaceKey as aH, generateNewWorkspaceKey as aI, getErrorCode as aJ, getErrorMessage as aK, getRawWorkspaceKey as aL, health as aM, memory as aN, parseSSEEvents as aO, parseSlashCommand as aP, parseSlashTokenInProgress as aQ, performPasswordLogin as aR, performSigningKeyLogin as aS, performSsoDeviceFlowLogin as aT, requireData as aU, requireOk as aV, resolveAuth as aW, resolveCitations as aX, resolveWorkspace as aY, responses as aZ, selectWorkspace as a_, type UploadOptions as aa, type UploadResult as ab, type UserInfo as ac, type UserInputRequestEvent as ad, type UserMessageEvent as ae, WebSocketAuthError as af, type WorkspaceContext as ag, type WsConnection as ah, agentconfig as ai, assistant as aj, authenticatedFetch as ak, buildRetrievalChunkTool as al, buildRetrievalFullContextTool as am, buildRetrievalTocTool as an, connectWebSocket as ao, connectWithReconnect as ap, consumeSSEStream as aq, contacts as ar, conversations as as, countCitations as at, createAuthenticatedClient as au, createDocumentWaiter as av, dm as aw, doctags as ax, documents as ay, files as az, Arbi as b, settings as b0, streamSSE as b1, stripCitationMarkdown as b2, summarizeCitations as b3, tags as b4, tasks as b5, workspaces as b6, ArbiApiError as c, ArbiError as d, type ArbiErrorEvent as e, type ArbiOptions as f, type ArtifactEvent as g, type AuthContext as h, type AuthHeaders as i, type AuthenticatedClient as j, type CitationSummary as k, type CliConfig as l, type CliCredentials as m, type CommandDescriptor as n, type ConfigStore as o, type ConnectOptions as p, type CreateMemoryRequest as q, type CreateTaskRequest as r, type DmCryptoContext as s, type DocNameMap as t, type DocumentListFields as u, type DocumentListOrder as v, type DocumentWaiter as w, type DocumentWaiterOptions as x, type ListPaginatedOptions as y, type MemorySearchRequest as z };
5471
+ /**
5472
+ * Project operations — list, create, update, delete, checkout, refresh, usage.
5473
+ */
5474
+
5475
+ type ProjectUsageResponse = components['schemas']['ProjectUsageResponse'];
5476
+ type ProjectInvoicesResponse = components['schemas']['ProjectInvoicesResponse'];
5477
+ type UserDailyUsageResponse = components['schemas']['UserDailyUsageResponse'];
5478
+ declare function listProjects(arbi: ArbiClient): Promise<{
5479
+ external_id: string;
5480
+ name: string;
5481
+ created_by: string;
5482
+ packs: number;
5483
+ subscription: string;
5484
+ created_at: string;
5485
+ quotas: {
5486
+ storage_gb: {
5487
+ used: number;
5488
+ limit: number;
5489
+ };
5490
+ ai_credits: {
5491
+ used: number;
5492
+ limit: number;
5493
+ };
5494
+ collaborators: {
5495
+ used: number;
5496
+ limit: number;
5497
+ };
5498
+ budget_reset_at?: number | null | undefined;
5499
+ };
5500
+ daily_cap_per_user?: number | null | undefined;
5501
+ price_id?: string | null | undefined;
5502
+ plan?: string | null | undefined;
5503
+ amount?: number | null | undefined;
5504
+ currency?: string | null | undefined;
5505
+ current_period_end?: number | null | undefined;
5506
+ cancel_at_period_end?: boolean | null | undefined;
5507
+ portal_url?: string | null | undefined;
5508
+ }[]>;
5509
+ declare function createProject(arbi: ArbiClient, name: string): Promise<{
5510
+ external_id: string;
5511
+ name: string;
5512
+ created_by: string;
5513
+ packs: number;
5514
+ subscription: string;
5515
+ created_at: string;
5516
+ quotas: {
5517
+ storage_gb: {
5518
+ used: number;
5519
+ limit: number;
5520
+ };
5521
+ ai_credits: {
5522
+ used: number;
5523
+ limit: number;
5524
+ };
5525
+ collaborators: {
5526
+ used: number;
5527
+ limit: number;
5528
+ };
5529
+ budget_reset_at?: number | null | undefined;
5530
+ };
5531
+ daily_cap_per_user?: number | null | undefined;
5532
+ price_id?: string | null | undefined;
5533
+ plan?: string | null | undefined;
5534
+ amount?: number | null | undefined;
5535
+ currency?: string | null | undefined;
5536
+ current_period_end?: number | null | undefined;
5537
+ cancel_at_period_end?: boolean | null | undefined;
5538
+ portal_url?: string | null | undefined;
5539
+ }>;
5540
+ declare function refreshProject(arbi: ArbiClient, projectExtId: string): Promise<{
5541
+ external_id: string;
5542
+ name: string;
5543
+ created_by: string;
5544
+ packs: number;
5545
+ subscription: string;
5546
+ created_at: string;
5547
+ quotas: {
5548
+ storage_gb: {
5549
+ used: number;
5550
+ limit: number;
5551
+ };
5552
+ ai_credits: {
5553
+ used: number;
5554
+ limit: number;
5555
+ };
5556
+ collaborators: {
5557
+ used: number;
5558
+ limit: number;
5559
+ };
5560
+ budget_reset_at?: number | null | undefined;
5561
+ };
5562
+ daily_cap_per_user?: number | null | undefined;
5563
+ price_id?: string | null | undefined;
5564
+ plan?: string | null | undefined;
5565
+ amount?: number | null | undefined;
5566
+ currency?: string | null | undefined;
5567
+ current_period_end?: number | null | undefined;
5568
+ cancel_at_period_end?: boolean | null | undefined;
5569
+ portal_url?: string | null | undefined;
5570
+ }>;
5571
+ /**
5572
+ * AI usage + spend breakdown for a project's billing period. `monthsBack`
5573
+ * selects the period: 0 (default) = current, 1 = previous month, etc.
5574
+ */
5575
+ declare function getProjectUsage(arbi: ArbiClient, projectExtId: string, monthsBack?: number): Promise<ProjectUsageResponse>;
5576
+ /** List the Stripe invoices for a project's subscription. */
5577
+ declare function getProjectInvoices(arbi: ArbiClient, projectExtId: string): Promise<ProjectInvoicesResponse>;
5578
+ /**
5579
+ * Today's deployment-wide credit spend for the current user — the number the
5580
+ * per-user daily cap is enforced against. Pair with a project's
5581
+ * `daily_cap_per_user` to render a "credits today" indicator.
5582
+ */
5583
+ declare function getUserUsageToday(arbi: ArbiClient): Promise<UserDailyUsageResponse>;
5584
+
5585
+ type projects_ProjectInvoicesResponse = ProjectInvoicesResponse;
5586
+ type projects_ProjectUsageResponse = ProjectUsageResponse;
5587
+ type projects_UserDailyUsageResponse = UserDailyUsageResponse;
5588
+ declare const projects_createProject: typeof createProject;
5589
+ declare const projects_getProjectInvoices: typeof getProjectInvoices;
5590
+ declare const projects_getProjectUsage: typeof getProjectUsage;
5591
+ declare const projects_getUserUsageToday: typeof getUserUsageToday;
5592
+ declare const projects_listProjects: typeof listProjects;
5593
+ declare const projects_refreshProject: typeof refreshProject;
5594
+ declare namespace projects {
5595
+ export { type projects_ProjectInvoicesResponse as ProjectInvoicesResponse, type projects_ProjectUsageResponse as ProjectUsageResponse, type projects_UserDailyUsageResponse as UserDailyUsageResponse, projects_createProject as createProject, projects_getProjectInvoices as getProjectInvoices, projects_getProjectUsage as getProjectUsage, projects_getUserUsageToday as getUserUsageToday, projects_listProjects as listProjects, projects_refreshProject as refreshProject };
5596
+ }
5597
+
5598
+ export { type ResponseUsage as $, type AgentStepDeltaEvent as A, type MemorySearchResponse as B, type ChatSession as C, DOC_TERMINAL_STATUSES as D, type MessageLevel as E, type FormattedWsMessage as F, type MessageMetadataPayload$1 as G, type MessageQueuedEvent as H, type ProjectInvoicesResponse as I, type ProjectUsageResponse as J, type ReconnectableWsConnection as K, type ListAllOptions as L, type MemoryResponse as M, type ResolvedCitation as N, type OutputTokensDetails as O, type ParsedSlashCommand as P, type QueryOptions as Q, type ReconnectOptions as R, type ResolvedRecipient as S, type ResponseCompletedEvent as T, type ResponseContentPartAddedEvent as U, type ResponseCreatedEvent as V, type ResponseFailedEvent as W, type ResponseOutputItemAddedEvent as X, type ResponseOutputItemDoneEvent as Y, type ResponseOutputTextDeltaEvent as Z, type ResponseOutputTextDoneEvent as _, type AgentStepEvent as a, requireOk as a$, type SSEEvent as a0, type SSEStreamCallbacks as a1, type SSEStreamResult as a2, type SSEStreamStartData as a3, SUPPORTED_EXTENSIONS as a4, type SkillSummary as a5, type SkippedFile as a6, type TaskResponse as a7, type UpdateMemoryRequest as a8, type UpdateTaskRequest as a9, createDocumentWaiter as aA, dm as aB, doctags as aC, documents as aD, files as aE, filterSkills as aF, formatAgentStepLabel as aG, formatFileSize as aH, formatStreamSummary as aI, formatUserName as aJ, formatWorkspaceChoices as aK, formatWsMessage as aL, generateEncryptedWorkspaceKey as aM, generateNewWorkspaceKey as aN, getErrorCode as aO, getErrorMessage as aP, getRawWorkspaceKey as aQ, health as aR, memory as aS, parseSSEEvents as aT, parseSlashCommand as aU, parseSlashTokenInProgress as aV, performPasswordLogin as aW, performSigningKeyLogin as aX, performSsoDeviceFlowLogin as aY, projects as aZ, requireData as a_, type UploadBatchResult as aa, type UploadDirectOptions as ab, type UploadDirectResult as ac, type UploadOptions as ad, type UploadResult as ae, type UserDailyUsageResponse as af, type UserInfo as ag, type UserInputRequestEvent as ah, type UserMessageEvent as ai, WebSocketAuthError as aj, type WorkspaceChronologyOut as ak, type WorkspaceContext as al, type WsConnection as am, agentconfig as an, assistant as ao, authenticatedFetch as ap, buildRetrievalChunkTool as aq, buildRetrievalFullContextTool as ar, buildRetrievalTocTool as as, connectWebSocket as at, connectWithReconnect as au, consumeSSEStream as av, contacts as aw, conversations as ax, countCitations as ay, createAuthenticatedClient as az, Arbi as b, resolveAuth as b0, resolveCitations as b1, resolveWorkspace as b2, responses as b3, selectWorkspace as b4, selectWorkspaceById as b5, settings as b6, streamSSE as b7, stripCitationMarkdown as b8, summarizeCitations as b9, tags as ba, tasks as bb, workspaces as bc, ArbiApiError as c, ArbiError as d, type ArbiErrorEvent as e, type ArbiOptions as f, type ArtifactEvent as g, type AuthContext as h, type AuthHeaders as i, type AuthenticatedClient as j, type CitationSummary as k, type CliConfig as l, type CliCredentials as m, type CommandDescriptor as n, type ConfigStore as o, type ConnectOptions as p, type CreateMemoryRequest as q, type CreateTaskRequest as r, type DmCryptoContext as s, type DocNameMap as t, type DocumentListFields as u, type DocumentListOrder as v, type DocumentWaiter as w, type DocumentWaiterOptions as x, type ListPaginatedOptions as y, type MemorySearchRequest as z };