@arbidocs/sdk 0.4.31 → 0.4.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -105,3 +105,21 @@ For React apps, use `@arbidocs/react` instead — it wraps this SDK with hooks a
105
105
  - **Browser**: Any modern browser with Web Crypto API
106
106
  - **Node.js**: v18+ (install `fake-indexeddb`)
107
107
  - **TypeScript**: 5.0+ (optional)
108
+
109
+ ## Automations
110
+
111
+ The `workflows` namespace exposes create/get/list/update/delete/run and `listWorkflowRuns`. Triggers use schedules or notification types; every saved rule can also run immediately. A document action (`annotate_documents` or `email_documents`) returns an execution reference rather than a conversation. Its persisted history contains selected documents, run-label references, result metadata and failures; annotation answers remain document fields. Every execution has a WorkflowRuns record; chat actions also link to a conversation.
112
+
113
+ ```ts
114
+ import { workflows } from '@arbidocs/sdk'
115
+ const run = await workflows.runWorkflow(arbi, 'wfl-example')
116
+ if (run.error) throw new Error(run.error)
117
+ if (run.execution_id) {
118
+ const history = await workflows.listWorkflowRuns(arbi, 'wfl-example')
119
+ console.log(history)
120
+ }
121
+ ```
122
+
123
+ Document selectors can specify IDs, labels resolved at execution time, or `latest` documents since the previous successful run. Unattended document actions require an assistant with standing workspace access; creating a rule does not grant that access.
124
+
125
+ For latest-document digests, the first run covers the preceding 24 hours; later runs use the previous successful run cutoff. Failed delivery does not advance it. Emails contain document names and authenticated platform links, without attachments.
@@ -1259,6 +1259,7 @@ type AssistantMode = components['schemas']['AssistantMode'];
1259
1259
 
1260
1260
  /** The caller's conversations. A conversation with a `status` is also a task (work item). */
1261
1261
  declare function listConversations(arbi: ArbiClient): Promise<{
1262
+ label_ext_ids?: string[] | undefined;
1262
1263
  external_id: string;
1263
1264
  title: string | null;
1264
1265
  created_by_ext_id: string;
@@ -1267,6 +1268,16 @@ declare function listConversations(arbi: ArbiClient): Promise<{
1267
1268
  updated_at: string;
1268
1269
  is_shared: boolean;
1269
1270
  message_count: number;
1271
+ last_message_actor?: {
1272
+ external_id: string;
1273
+ given_name: string;
1274
+ family_name?: string | null | undefined;
1275
+ picture?: string | null | undefined;
1276
+ parent_ext_id?: string | null | undefined;
1277
+ } | null | undefined;
1278
+ last_message_ext_id?: string | null | undefined;
1279
+ last_message_role?: string | null | undefined;
1280
+ last_message_updated_at?: string | null | undefined;
1270
1281
  last_message_status?: string | null | undefined;
1271
1282
  assistant_mode: components["schemas"]["AssistantMode"];
1272
1283
  status?: (components["schemas"]["WorkStatus"] | null) | undefined;
@@ -1493,7 +1504,7 @@ declare function getConversationThreads(arbi: ArbiClient, conversationId: string
1493
1504
  declare function deleteConversation(arbi: ArbiClient, conversationId: string): Promise<{
1494
1505
  detail: string;
1495
1506
  }>;
1496
- declare function getMessage(arbi: ArbiClient, messageId: string): Promise<{
1507
+ declare function getMessage$1(arbi: ArbiClient, messageId: string): Promise<{
1497
1508
  role: "user" | "assistant" | "system";
1498
1509
  content: string;
1499
1510
  tools?: {
@@ -1861,13 +1872,12 @@ type conversations_PostMessageRequest = PostMessageRequest;
1861
1872
  declare const conversations_deleteConversation: typeof deleteConversation;
1862
1873
  declare const conversations_deleteMessage: typeof deleteMessage;
1863
1874
  declare const conversations_getConversationThreads: typeof getConversationThreads;
1864
- declare const conversations_getMessage: typeof getMessage;
1865
1875
  declare const conversations_importConversations: typeof importConversations;
1866
1876
  declare const conversations_listConversations: typeof listConversations;
1867
1877
  declare const conversations_postConversationMessage: typeof postConversationMessage;
1868
1878
  declare const conversations_updateConversationAssistantMode: typeof updateConversationAssistantMode;
1869
1879
  declare namespace conversations {
1870
- export { type conversations_AssistantMode as AssistantMode, type conversations_ConversationImportResponse as ConversationImportResponse, type conversations_MessageMention as MessageMention, type conversations_PostMessageRequest as PostMessageRequest, 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_postConversationMessage as postConversationMessage, conversations_updateConversationAssistantMode as updateConversationAssistantMode };
1880
+ export { type conversations_AssistantMode as AssistantMode, type conversations_ConversationImportResponse as ConversationImportResponse, type conversations_MessageMention as MessageMention, type conversations_PostMessageRequest as PostMessageRequest, conversations_deleteConversation as deleteConversation, conversations_deleteMessage as deleteMessage, conversations_getConversationThreads as getConversationThreads, getMessage$1 as getMessage, conversations_importConversations as importConversations, conversations_listConversations as listConversations, conversations_postConversationMessage as postConversationMessage, conversations_updateConversationAssistantMode as updateConversationAssistantMode };
1871
1881
  }
1872
1882
 
1873
1883
  /**
@@ -3036,7 +3046,7 @@ declare namespace work {
3036
3046
 
3037
3047
  /**
3038
3048
  * Workflows: "when this happens, run that skill". A trigger (clock or notification event), a
3039
- * skill/prompt with saved inputs, an active switch, shared or private. Each run creates a conversation.
3049
+ * action with saved inputs, an active switch, shared or private. Document actions run without a conversation.
3040
3050
  * Backend: `/v1/workflow` (docs/design/work-model.md).
3041
3051
  */
3042
3052
 
@@ -3044,6 +3054,9 @@ type WorkflowResponse = components['schemas']['WorkflowResponse'];
3044
3054
  type CreateWorkflowRequest = components['schemas']['CreateWorkflowRequest'];
3045
3055
  type UpdateWorkflowRequest = components['schemas']['UpdateWorkflowRequest'];
3046
3056
  type WorkflowRunResponse = components['schemas']['WorkflowRunResponse'];
3057
+ type DocumentAutomationAction = components['schemas']['DocumentAutomationAction'];
3058
+ type DocumentSelector = components['schemas']['DocumentSelector'];
3059
+ type WorkflowRunHistoryResponse = components['schemas']['WorkflowRunHistoryResponse'];
3047
3060
  /** The authorization tier of a workflow's runs. */
3048
3061
  type WorkflowAuthMode = components['schemas']['src__models__workflow__AuthMode'];
3049
3062
  declare function listWorkflows(arbi: ArbiClient): Promise<WorkflowResponse[]>;
@@ -3053,24 +3066,30 @@ declare function getWorkflow(arbi: ArbiClient, workflowId: string): Promise<Work
3053
3066
  declare function updateWorkflow(arbi: ArbiClient, workflowId: string, body: UpdateWorkflowRequest): Promise<WorkflowResponse>;
3054
3067
  declare function deleteWorkflow(arbi: ArbiClient, workflowId: string): Promise<void>;
3055
3068
  /**
3056
- * Run a workflow now: creates a conversation exactly as its trigger would. Resolves
3057
- * with the conversation it created (`conversation_ext_id`) and whether its run started.
3069
+ * Run the saved action now. Chat actions return a conversation; document actions
3070
+ * return an execution_id and action_type without creating a conversation.
3058
3071
  */
3059
3072
  declare function runWorkflow(arbi: ArbiClient, workflowId: string): Promise<WorkflowRunResponse>;
3073
+ /** Persisted document-action runs, including failures and their affected documents. */
3074
+ declare function listWorkflowRuns(arbi: ArbiClient, workflowId: string): Promise<WorkflowRunHistoryResponse[]>;
3060
3075
 
3061
3076
  type workflows_CreateWorkflowRequest = CreateWorkflowRequest;
3077
+ type workflows_DocumentAutomationAction = DocumentAutomationAction;
3078
+ type workflows_DocumentSelector = DocumentSelector;
3062
3079
  type workflows_UpdateWorkflowRequest = UpdateWorkflowRequest;
3063
3080
  type workflows_WorkflowAuthMode = WorkflowAuthMode;
3064
3081
  type workflows_WorkflowResponse = WorkflowResponse;
3082
+ type workflows_WorkflowRunHistoryResponse = WorkflowRunHistoryResponse;
3065
3083
  type workflows_WorkflowRunResponse = WorkflowRunResponse;
3066
3084
  declare const workflows_createWorkflow: typeof createWorkflow;
3067
3085
  declare const workflows_deleteWorkflow: typeof deleteWorkflow;
3068
3086
  declare const workflows_getWorkflow: typeof getWorkflow;
3087
+ declare const workflows_listWorkflowRuns: typeof listWorkflowRuns;
3069
3088
  declare const workflows_listWorkflows: typeof listWorkflows;
3070
3089
  declare const workflows_runWorkflow: typeof runWorkflow;
3071
3090
  declare const workflows_updateWorkflow: typeof updateWorkflow;
3072
3091
  declare namespace workflows {
3073
- export { type workflows_CreateWorkflowRequest as CreateWorkflowRequest, type workflows_UpdateWorkflowRequest as UpdateWorkflowRequest, type workflows_WorkflowAuthMode as WorkflowAuthMode, type workflows_WorkflowResponse as WorkflowResponse, type workflows_WorkflowRunResponse as WorkflowRunResponse, workflows_createWorkflow as createWorkflow, workflows_deleteWorkflow as deleteWorkflow, workflows_getWorkflow as getWorkflow, workflows_listWorkflows as listWorkflows, workflows_runWorkflow as runWorkflow, workflows_updateWorkflow as updateWorkflow };
3092
+ export { type workflows_CreateWorkflowRequest as CreateWorkflowRequest, type workflows_DocumentAutomationAction as DocumentAutomationAction, type workflows_DocumentSelector as DocumentSelector, type workflows_UpdateWorkflowRequest as UpdateWorkflowRequest, type workflows_WorkflowAuthMode as WorkflowAuthMode, type workflows_WorkflowResponse as WorkflowResponse, type workflows_WorkflowRunHistoryResponse as WorkflowRunHistoryResponse, type workflows_WorkflowRunResponse as WorkflowRunResponse, workflows_createWorkflow as createWorkflow, workflows_deleteWorkflow as deleteWorkflow, workflows_getWorkflow as getWorkflow, workflows_listWorkflowRuns as listWorkflowRuns, workflows_listWorkflows as listWorkflows, workflows_runWorkflow as runWorkflow, workflows_updateWorkflow as updateWorkflow };
3074
3093
  }
3075
3094
 
3076
3095
  /**
@@ -4040,6 +4059,7 @@ declare class Arbi {
4040
4059
  };
4041
4060
  readonly conversations: {
4042
4061
  list: () => Promise<{
4062
+ label_ext_ids?: string[] | undefined;
4043
4063
  external_id: string;
4044
4064
  title: string | null;
4045
4065
  created_by_ext_id: string;
@@ -4048,6 +4068,16 @@ declare class Arbi {
4048
4068
  updated_at: string;
4049
4069
  is_shared: boolean;
4050
4070
  message_count: number;
4071
+ last_message_actor?: {
4072
+ external_id: string;
4073
+ given_name: string;
4074
+ family_name?: string | null | undefined;
4075
+ picture?: string | null | undefined;
4076
+ parent_ext_id?: string | null | undefined;
4077
+ } | null | undefined;
4078
+ last_message_ext_id?: string | null | undefined;
4079
+ last_message_role?: string | null | undefined;
4080
+ last_message_updated_at?: string | null | undefined;
4051
4081
  last_message_status?: string | null | undefined;
4052
4082
  assistant_mode: components["schemas"]["AssistantMode"];
4053
4083
  status?: (components["schemas"]["WorkStatus"] | null) | undefined;
@@ -4270,6 +4300,7 @@ declare class Arbi {
4270
4300
  * behind rename, share and unshare.
4271
4301
  */
4272
4302
  update: (conversationId: string, body: UpdateConversationRequest) => Promise<{
4303
+ label_ext_ids?: string[];
4273
4304
  external_id: string;
4274
4305
  title: string | null;
4275
4306
  created_by_ext_id: string;
@@ -4278,6 +4309,10 @@ declare class Arbi {
4278
4309
  updated_at: string;
4279
4310
  is_shared: boolean;
4280
4311
  message_count: number;
4312
+ last_message_actor?: components["schemas"]["ConversationTurnActor"] | null;
4313
+ last_message_ext_id?: string | null;
4314
+ last_message_role?: string | null;
4315
+ last_message_updated_at?: string | null;
4281
4316
  last_message_status?: string | null;
4282
4317
  assistant_mode: components["schemas"]["AssistantMode"];
4283
4318
  status?: components["schemas"]["WorkStatus"] | null;
@@ -4307,6 +4342,7 @@ declare class Arbi {
4307
4342
  }>;
4308
4343
  /** Create a work item: a plain to-do, or (with a prompt / skill) agent work that starts now. */
4309
4344
  createWork: (body: CreateWorkRequest) => Promise<{
4345
+ label_ext_ids?: string[];
4310
4346
  external_id: string;
4311
4347
  title: string | null;
4312
4348
  created_by_ext_id: string;
@@ -4315,6 +4351,10 @@ declare class Arbi {
4315
4351
  updated_at: string;
4316
4352
  is_shared: boolean;
4317
4353
  message_count: number;
4354
+ last_message_actor?: components["schemas"]["ConversationTurnActor"] | null;
4355
+ last_message_ext_id?: string | null;
4356
+ last_message_role?: string | null;
4357
+ last_message_updated_at?: string | null;
4318
4358
  last_message_status?: string | null;
4319
4359
  assistant_mode: components["schemas"]["AssistantMode"];
4320
4360
  status?: components["schemas"]["WorkStatus"] | null;
@@ -4344,6 +4384,7 @@ declare class Arbi {
4344
4384
  }>;
4345
4385
  /** Run a work item now, or retry it. */
4346
4386
  run: (conversationId: string) => Promise<{
4387
+ label_ext_ids?: string[];
4347
4388
  external_id: string;
4348
4389
  title: string | null;
4349
4390
  created_by_ext_id: string;
@@ -4352,6 +4393,10 @@ declare class Arbi {
4352
4393
  updated_at: string;
4353
4394
  is_shared: boolean;
4354
4395
  message_count: number;
4396
+ last_message_actor?: components["schemas"]["ConversationTurnActor"] | null;
4397
+ last_message_ext_id?: string | null;
4398
+ last_message_role?: string | null;
4399
+ last_message_updated_at?: string | null;
4355
4400
  last_message_status?: string | null;
4356
4401
  assistant_mode: components["schemas"]["AssistantMode"];
4357
4402
  status?: components["schemas"]["WorkStatus"] | null;
@@ -4381,6 +4426,7 @@ declare class Arbi {
4381
4426
  }>;
4382
4427
  /** The sign-off person approves, or sends feedback back to the agent in the same thread. */
4383
4428
  review: (conversationId: string, body: ReviewWorkRequest) => Promise<{
4429
+ label_ext_ids?: string[];
4384
4430
  external_id: string;
4385
4431
  title: string | null;
4386
4432
  created_by_ext_id: string;
@@ -4389,6 +4435,10 @@ declare class Arbi {
4389
4435
  updated_at: string;
4390
4436
  is_shared: boolean;
4391
4437
  message_count: number;
4438
+ last_message_actor?: components["schemas"]["ConversationTurnActor"] | null;
4439
+ last_message_ext_id?: string | null;
4440
+ last_message_role?: string | null;
4441
+ last_message_updated_at?: string | null;
4392
4442
  last_message_status?: string | null;
4393
4443
  assistant_mode: components["schemas"]["AssistantMode"];
4394
4444
  status?: components["schemas"]["WorkStatus"] | null;
@@ -4418,6 +4468,7 @@ declare class Arbi {
4418
4468
  }>;
4419
4469
  /** Hand sign-off to another workspace member. */
4420
4470
  requestApproval: (conversationId: string, body: RequestApprovalRequest) => Promise<{
4471
+ label_ext_ids?: string[];
4421
4472
  external_id: string;
4422
4473
  title: string | null;
4423
4474
  created_by_ext_id: string;
@@ -4426,6 +4477,10 @@ declare class Arbi {
4426
4477
  updated_at: string;
4427
4478
  is_shared: boolean;
4428
4479
  message_count: number;
4480
+ last_message_actor?: components["schemas"]["ConversationTurnActor"] | null;
4481
+ last_message_ext_id?: string | null;
4482
+ last_message_role?: string | null;
4483
+ last_message_updated_at?: string | null;
4429
4484
  last_message_status?: string | null;
4430
4485
  assistant_mode: components["schemas"]["AssistantMode"];
4431
4486
  status?: components["schemas"]["WorkStatus"] | null;
@@ -4484,6 +4539,7 @@ declare class Arbi {
4484
4539
  * first call already running.
4485
4540
  */
4486
4541
  runWithAuth: (conversationId: string) => Promise<{
4542
+ label_ext_ids?: string[];
4487
4543
  external_id: string;
4488
4544
  title: string | null;
4489
4545
  created_by_ext_id: string;
@@ -4492,6 +4548,10 @@ declare class Arbi {
4492
4548
  updated_at: string;
4493
4549
  is_shared: boolean;
4494
4550
  message_count: number;
4551
+ last_message_actor?: components["schemas"]["ConversationTurnActor"] | null;
4552
+ last_message_ext_id?: string | null;
4553
+ last_message_role?: string | null;
4554
+ last_message_updated_at?: string | null;
4495
4555
  last_message_status?: string | null;
4496
4556
  assistant_mode: components["schemas"]["AssistantMode"];
4497
4557
  status?: components["schemas"]["WorkStatus"] | null;
@@ -6141,6 +6201,7 @@ declare class Arbi {
6141
6201
  } | null;
6142
6202
  after_conversation_ext_id?: string | null;
6143
6203
  on_demand: boolean;
6204
+ action?: components["schemas"]["DocumentAutomationAction"] | null;
6144
6205
  prompt: string;
6145
6206
  skill_ref?: string | null;
6146
6207
  skill_inputs?: {
@@ -6153,6 +6214,7 @@ declare class Arbi {
6153
6214
  fact_ext_id?: string | null;
6154
6215
  last_fired_at?: string | null;
6155
6216
  last_error?: string | null;
6217
+ last_run_status?: string | null;
6156
6218
  owner_ext_id?: string | null;
6157
6219
  is_owner: boolean;
6158
6220
  created_at: string;
@@ -6175,6 +6237,7 @@ declare class Arbi {
6175
6237
  } | null;
6176
6238
  after_conversation_ext_id?: string | null;
6177
6239
  on_demand: boolean;
6240
+ action?: components["schemas"]["DocumentAutomationAction"] | null;
6178
6241
  prompt: string;
6179
6242
  skill_ref?: string | null;
6180
6243
  skill_inputs?: {
@@ -6187,6 +6250,7 @@ declare class Arbi {
6187
6250
  fact_ext_id?: string | null;
6188
6251
  last_fired_at?: string | null;
6189
6252
  last_error?: string | null;
6253
+ last_run_status?: string | null;
6190
6254
  owner_ext_id?: string | null;
6191
6255
  is_owner: boolean;
6192
6256
  created_at: string;
@@ -6209,6 +6273,7 @@ declare class Arbi {
6209
6273
  } | null;
6210
6274
  after_conversation_ext_id?: string | null;
6211
6275
  on_demand: boolean;
6276
+ action?: components["schemas"]["DocumentAutomationAction"] | null;
6212
6277
  prompt: string;
6213
6278
  skill_ref?: string | null;
6214
6279
  skill_inputs?: {
@@ -6221,6 +6286,7 @@ declare class Arbi {
6221
6286
  fact_ext_id?: string | null;
6222
6287
  last_fired_at?: string | null;
6223
6288
  last_error?: string | null;
6289
+ last_run_status?: string | null;
6224
6290
  owner_ext_id?: string | null;
6225
6291
  is_owner: boolean;
6226
6292
  created_at: string;
@@ -6229,6 +6295,8 @@ declare class Arbi {
6229
6295
  delete: (workflowId: string) => Promise<void>;
6230
6296
  /** Fire a workflow now, as a test run. Resolves with the conversation it created and whether it started. */
6231
6297
  run: (workflowId: string) => Promise<{
6298
+ execution_id?: number | null;
6299
+ action_type?: string | null;
6232
6300
  conversation_ext_id?: string | null;
6233
6301
  started: boolean;
6234
6302
  error?: string | null;
@@ -7232,6 +7300,128 @@ declare namespace health {
7232
7300
  export { health_getHealth as getHealth, health_getHealthModels as getHealthModels, health_getMcpTools as getMcpTools, health_getRemoteModels as getRemoteModels };
7233
7301
  }
7234
7302
 
7303
+ /**
7304
+ * Mail operations over `/v1/mail`: the native ARBI inbox and any connected account.
7305
+ *
7306
+ * Every operation takes a {@link MailFetch}, so the same code runs in the browser (which already owns
7307
+ * token refresh) and in Node (`createMailFetch`). Types come from the generated schema.
7308
+ *
7309
+ * Native mail is sealed to the user. Reading it needs the keys unlocked in the current server session
7310
+ * first (`unlockNativeMail`); composing a draft does not, which is why an agent can draft for its
7311
+ * owner without ever holding the owner's keys.
7312
+ */
7313
+
7314
+ type Schemas = components['schemas'];
7315
+ type MailPolicy = Schemas['MailPolicyRead'];
7316
+ type MailAccount = Schemas['MailAccountRead'];
7317
+ type MailFolder = Required<Schemas['MailFolder']>;
7318
+ type MailAddress = Schemas['MailAddress'];
7319
+ type MailAddressInput = Pick<MailAddress, 'email'> & Partial<MailAddress>;
7320
+ type MailAttachment = Schemas['MailAttachment'];
7321
+ type MailMessage = Required<Schemas['MailMessage']>;
7322
+ type MailMessagePage = Omit<Required<Schemas['MailMessagePage']>, 'messages'> & {
7323
+ messages: MailMessage[];
7324
+ };
7325
+ type MailMessageUpdate = Schemas['MailMessageUpdate'];
7326
+ type MailCompose = Omit<Schemas['MailCompose'], 'to' | 'cc' | 'bcc'> & {
7327
+ to?: MailAddressInput[];
7328
+ cc?: MailAddressInput[];
7329
+ bcc?: MailAddressInput[];
7330
+ };
7331
+ type MailSend = MailCompose & {
7332
+ request_id: string;
7333
+ };
7334
+ type MailDraftSaved = Schemas['MailDraftSaved'];
7335
+ type MailSendResult = Schemas['MailSendResult'];
7336
+ /** The id of the user's own ARBI mailbox. For an agent it resolves to its owner's. */
7337
+ declare const NATIVE_ACCOUNT = "native";
7338
+ /** Fetch a path under `/v1/mail` with authentication; rejects on a non-2xx response. */
7339
+ type MailFetch = (path: string, init?: RequestInit) => Promise<Response>;
7340
+ /** A {@link MailFetch} for Node and scripts: bearer token, server errors surfaced as `ArbiApiError`. */
7341
+ declare function createMailFetch(auth: AuthHeaders): MailFetch;
7342
+ /** What this deployment allows: native mail, OAuth providers and approved mail servers. */
7343
+ declare function getMailPolicy(mail: MailFetch): Promise<MailPolicy>;
7344
+ declare function listMailAccounts(mail: MailFetch): Promise<MailAccount[]>;
7345
+ /** Claim `alias@<deployment domain>` as the user's native address. One per user. */
7346
+ declare function claimNativeAlias(mail: MailFetch, alias: string): Promise<string>;
7347
+ declare function listFolders(mail: MailFetch, accountId?: string): Promise<MailFolder[]>;
7348
+ interface ListMessagesOptions {
7349
+ accountId?: string;
7350
+ /** A folder `id` from {@link listFolders} (native: inbox, sent, drafts, archive, trash). */
7351
+ folderId: string;
7352
+ /** Free-text filter over subject, sender and recipients. */
7353
+ query?: string;
7354
+ /** The `next_cursor` of the previous page. */
7355
+ cursor?: string | null;
7356
+ limit?: number;
7357
+ }
7358
+ declare function listMessages(mail: MailFetch, options: ListMessagesOptions): Promise<MailMessagePage>;
7359
+ declare function getMessage(mail: MailFetch, messageId: string, accountId?: string): Promise<MailMessage>;
7360
+ /** The bytes of one attachment of a message. */
7361
+ declare function downloadAttachment(mail: MailFetch, messageId: string, attachmentId: string, accountId?: string): Promise<Uint8Array>;
7362
+ /** Mark read or unread, move to a folder, or send to Trash. */
7363
+ declare function updateMessage(mail: MailFetch, messageId: string, update: MailMessageUpdate, accountId?: string): Promise<void>;
7364
+ /**
7365
+ * Save a draft. In the native mailbox it lands in Drafts; an agent's draft lands in its owner's
7366
+ * Drafts, from the owner's address, labelled with the agent's name (`drafted_by`).
7367
+ */
7368
+ declare function saveDraft(mail: MailFetch, compose: MailCompose, accountId?: string): Promise<MailDraftSaved>;
7369
+ /**
7370
+ * Send a message. `request_id` makes the send idempotent: retrying the same request never sends
7371
+ * twice, and reusing it for a different message is refused.
7372
+ */
7373
+ declare function sendMessage(mail: MailFetch, message: Omit<MailSend, 'request_id'> & {
7374
+ request_id?: string;
7375
+ }, accountId?: string): Promise<MailSendResult>;
7376
+ interface NativeMailKeys {
7377
+ /** The user's Ed25519 secret key (64 bytes), from the login result. */
7378
+ signingPrivateKey: Uint8Array;
7379
+ /** The server session's public key, from the login result. */
7380
+ serverSessionKey: Uint8Array;
7381
+ }
7382
+ /**
7383
+ * Unlock the native inbox for this session: unwrap every message key with the user's private key and
7384
+ * re-seal it to the server session, which can then read mail on the user's behalf until it expires.
7385
+ * Call it again to unlock mail that arrived since.
7386
+ */
7387
+ declare function unlockNativeMail(mail: MailFetch, keys: NativeMailKeys): Promise<void>;
7388
+ /** Build an attachment from bytes. */
7389
+ declare function attachmentFromBytes(name: string, contentType: string, bytes: Uint8Array): MailAttachment;
7390
+
7391
+ type mail_ListMessagesOptions = ListMessagesOptions;
7392
+ type mail_MailAccount = MailAccount;
7393
+ type mail_MailAddress = MailAddress;
7394
+ type mail_MailAddressInput = MailAddressInput;
7395
+ type mail_MailAttachment = MailAttachment;
7396
+ type mail_MailCompose = MailCompose;
7397
+ type mail_MailDraftSaved = MailDraftSaved;
7398
+ type mail_MailFetch = MailFetch;
7399
+ type mail_MailFolder = MailFolder;
7400
+ type mail_MailMessage = MailMessage;
7401
+ type mail_MailMessagePage = MailMessagePage;
7402
+ type mail_MailMessageUpdate = MailMessageUpdate;
7403
+ type mail_MailPolicy = MailPolicy;
7404
+ type mail_MailSend = MailSend;
7405
+ type mail_MailSendResult = MailSendResult;
7406
+ declare const mail_NATIVE_ACCOUNT: typeof NATIVE_ACCOUNT;
7407
+ type mail_NativeMailKeys = NativeMailKeys;
7408
+ declare const mail_attachmentFromBytes: typeof attachmentFromBytes;
7409
+ declare const mail_claimNativeAlias: typeof claimNativeAlias;
7410
+ declare const mail_createMailFetch: typeof createMailFetch;
7411
+ declare const mail_downloadAttachment: typeof downloadAttachment;
7412
+ declare const mail_getMailPolicy: typeof getMailPolicy;
7413
+ declare const mail_getMessage: typeof getMessage;
7414
+ declare const mail_listFolders: typeof listFolders;
7415
+ declare const mail_listMailAccounts: typeof listMailAccounts;
7416
+ declare const mail_listMessages: typeof listMessages;
7417
+ declare const mail_saveDraft: typeof saveDraft;
7418
+ declare const mail_sendMessage: typeof sendMessage;
7419
+ declare const mail_unlockNativeMail: typeof unlockNativeMail;
7420
+ declare const mail_updateMessage: typeof updateMessage;
7421
+ declare namespace mail {
7422
+ export { type mail_ListMessagesOptions as ListMessagesOptions, type mail_MailAccount as MailAccount, type mail_MailAddress as MailAddress, type mail_MailAddressInput as MailAddressInput, type mail_MailAttachment as MailAttachment, type mail_MailCompose as MailCompose, type mail_MailDraftSaved as MailDraftSaved, type mail_MailFetch as MailFetch, type mail_MailFolder as MailFolder, type mail_MailMessage as MailMessage, type mail_MailMessagePage as MailMessagePage, type mail_MailMessageUpdate as MailMessageUpdate, type mail_MailPolicy as MailPolicy, type mail_MailSend as MailSend, type mail_MailSendResult as MailSendResult, mail_NATIVE_ACCOUNT as NATIVE_ACCOUNT, type mail_NativeMailKeys as NativeMailKeys, mail_attachmentFromBytes as attachmentFromBytes, mail_claimNativeAlias as claimNativeAlias, mail_createMailFetch as createMailFetch, mail_downloadAttachment as downloadAttachment, mail_getMailPolicy as getMailPolicy, mail_getMessage as getMessage, mail_listFolders as listFolders, mail_listMailAccounts as listMailAccounts, mail_listMessages as listMessages, mail_saveDraft as saveDraft, mail_sendMessage as sendMessage, mail_unlockNativeMail as unlockNativeMail, mail_updateMessage as updateMessage };
7423
+ }
7424
+
7235
7425
  /**
7236
7426
  * Project operations — list, create, update, delete, checkout, refresh, usage.
7237
7427
  */
@@ -7488,4 +7678,4 @@ declare namespace account {
7488
7678
  export { account_confirmEmailChange as confirmEmailChange, account_requestDeletion as requestDeletion, account_requestEmailChange as requestEmailChange };
7489
7679
  }
7490
7680
 
7491
- export { type QueryOptions as $, type ActivityKind as A, type DeferredInterjectionEvent as B, type ChatSession as C, DOC_TERMINAL_STATUSES as D, type DmCryptoContext as E, type DocNameMap as F, type DocumentListFields as G, type DocumentListOrder as H, type DocumentWaiter as I, type DocumentWaiterOptions as J, type FactResponse as K, type FactSearchRequest as L, type FactSearchResponse as M, type FormattedWsMessage as N, type ListAllOptions as O, type ListFactsOptions as P, type ListPaginatedOptions as Q, type MessageLevel as R, type MessageMetadataPayload$1 as S, type MessageQueuedEvent as T, type OutputTokensDetails as U, type ParsedSlashCommand as V, type PendingAuthResponse as W, type PlanWorkRequest as X, type ProbeAnswerEvent as Y, type ProjectInvoicesResponse as Z, type ProjectUsageResponse as _, type ActivityResponse as a, documents as a$, type ReconnectOptions as a0, type ReconnectableWsConnection as a1, type RequestApprovalRequest as a2, type ResolvedCitation as a3, type ResolvedRecipient as a4, type ResponseCompletedEvent as a5, type ResponseContentPartAddedEvent as a6, type ResponseCreatedEvent as a7, type ResponseFailedEvent as a8, type ResponseOutputItemAddedEvent as a9, type UserMessageEvent as aA, WebSocketAuthError as aB, type WorkStatus as aC, type WorkflowAuthMode as aD, type WorkflowResponse as aE, type WorkflowRunResponse as aF, type WorkspaceContext as aG, type WsConnection as aH, account as aI, agentconfig as aJ, agents as aK, assistant as aL, authenticatedFetch as aM, buildDocNameMap as aN, buildRetrievalChunkTool as aO, buildRetrievalFullContextTool as aP, buildRetrievalTocTool as aQ, connectWebSocket as aR, connectWithReconnect as aS, consumeSSEStream as aT, contacts as aU, conversations as aV, countCitations as aW, createAuthenticatedClient as aX, createDocumentWaiter as aY, dm as aZ, doctags as a_, type ResponseOutputItemDoneEvent as aa, type ResponseOutputTextDeltaEvent as ab, type ResponseOutputTextDoneEvent as ac, type ResponseUsage as ad, type ReviewWorkRequest as ae, type SSEEvent as af, type SSEStreamCallbacks as ag, type SSEStreamResult as ah, type SSEStreamStartData as ai, SUPPORTED_EXTENSIONS as aj, type SkillSummary as ak, type SkippedFile as al, type SubmitBackgroundQueryOptions as am, type TaskPlan as an, type TokenBudgetContext as ao, type UpdateConversationRequest as ap, type UpdateFactRequest as aq, type UpdateWorkflowRequest as ar, type UploadBatchResult as as, type UploadDirectOptions as at, type UploadDirectResult as au, type UploadOptions as av, type UploadResult as aw, type UserDailyUsageResponse as ax, type UserInfo as ay, type UserInputRequestEvent as az, type AgentControlStateEvent as b, facts as b0, files as b1, filterSkills as b2, formatAgentStepLabel as b3, formatFileSize as b4, formatItemLabel as b5, formatStreamSummary as b6, formatUserName as b7, formatWorkspaceChoices as b8, formatWsMessage as b9, summarizeCitations as bA, tags as bB, work as bC, workflows as bD, workspaces as bE, generateEncryptedWorkspaceKey as ba, generateNewWorkspaceKey as bb, getErrorCode as bc, getErrorMessage as bd, getRawWorkspaceKey as be, health as bf, parseSSEEvents as bg, parseSlashCommand as bh, parseSlashTokenInProgress as bi, performPasswordLogin as bj, performSigningKeyLogin as bk, performSsoDeviceFlowLogin as bl, profile as bm, projects as bn, requireData as bo, requireOk as bp, resolveAuth as bq, resolveCitations as br, resolveWorkspace as bs, responses as bt, selectWorkspace as bu, selectWorkspaceById as bv, sessions as bw, settings as bx, streamSSE as by, stripCitationMarkdown as bz, type AgentStepDeltaEvent as c, type AgentStepEvent as d, Arbi as e, ArbiApiError as f, ArbiError as g, type ArbiErrorEvent as h, type ArbiOptions as i, ArbiSessionExpiredError as j, type ArtifactEvent as k, type AuthContext as l, type AuthHeaders as m, type AuthMode as n, type AuthenticatedClient as o, type CitationSummary as p, type CliConfig as q, type CliCredentials as r, type CommandDescriptor as s, type ConfigStore as t, type ConnectOptions as u, type ConversationResponse as v, type CreateFactRequest as w, type CreateFactsRequest as x, type CreateWorkRequest as y, type CreateWorkflowRequest as z };
7681
+ export { type ProbeAnswerEvent as $, type ActivityKind as A, type DeferredInterjectionEvent as B, type ChatSession as C, DOC_TERMINAL_STATUSES as D, type DmCryptoContext as E, type DocNameMap as F, type DocumentAutomationAction as G, type DocumentListFields as H, type DocumentListOrder as I, type DocumentSelector as J, type DocumentWaiter as K, type DocumentWaiterOptions as L, type FactResponse as M, type FactSearchRequest as N, type FactSearchResponse as O, type FormattedWsMessage as P, type ListAllOptions as Q, type ListFactsOptions as R, type ListPaginatedOptions as S, type MailAttachment as T, type MessageLevel as U, type MessageMetadataPayload$1 as V, type MessageQueuedEvent as W, type OutputTokensDetails as X, type ParsedSlashCommand as Y, type PendingAuthResponse as Z, type PlanWorkRequest as _, type ActivityResponse as a, createAuthenticatedClient as a$, type ProjectInvoicesResponse as a0, type ProjectUsageResponse as a1, type QueryOptions as a2, type ReconnectOptions as a3, type ReconnectableWsConnection as a4, type RequestApprovalRequest as a5, type ResolvedCitation as a6, type ResolvedRecipient as a7, type ResponseCompletedEvent as a8, type ResponseContentPartAddedEvent as a9, type UserDailyUsageResponse as aA, type UserInfo as aB, type UserInputRequestEvent as aC, type UserMessageEvent as aD, WebSocketAuthError as aE, type WorkStatus as aF, type WorkflowAuthMode as aG, type WorkflowResponse as aH, type WorkflowRunHistoryResponse as aI, type WorkflowRunResponse as aJ, type WorkspaceContext as aK, type WsConnection as aL, account as aM, agentconfig as aN, agents as aO, assistant as aP, authenticatedFetch as aQ, buildDocNameMap as aR, buildRetrievalChunkTool as aS, buildRetrievalFullContextTool as aT, buildRetrievalTocTool as aU, connectWebSocket as aV, connectWithReconnect as aW, consumeSSEStream as aX, contacts as aY, conversations as aZ, countCitations as a_, type ResponseCreatedEvent as aa, type ResponseFailedEvent as ab, type ResponseOutputItemAddedEvent as ac, type ResponseOutputItemDoneEvent as ad, type ResponseOutputTextDeltaEvent as ae, type ResponseOutputTextDoneEvent as af, type ResponseUsage as ag, type ReviewWorkRequest as ah, type SSEEvent as ai, type SSEStreamCallbacks as aj, type SSEStreamResult as ak, type SSEStreamStartData as al, SUPPORTED_EXTENSIONS as am, type SkillSummary as an, type SkippedFile as ao, type SubmitBackgroundQueryOptions as ap, type TaskPlan as aq, type TokenBudgetContext as ar, type UpdateConversationRequest as as, type UpdateFactRequest as at, type UpdateWorkflowRequest as au, type UploadBatchResult as av, type UploadDirectOptions as aw, type UploadDirectResult as ax, type UploadOptions as ay, type UploadResult as az, type AgentControlStateEvent as b, createDocumentWaiter as b0, dm as b1, doctags as b2, documents as b3, facts as b4, files as b5, filterSkills as b6, formatAgentStepLabel as b7, formatFileSize as b8, formatItemLabel as b9, selectWorkspaceById as bA, sessions as bB, settings as bC, streamSSE as bD, stripCitationMarkdown as bE, summarizeCitations as bF, tags as bG, work as bH, workflows as bI, workspaces as bJ, formatStreamSummary as ba, formatUserName as bb, formatWorkspaceChoices as bc, formatWsMessage as bd, generateEncryptedWorkspaceKey as be, generateNewWorkspaceKey as bf, getErrorCode as bg, getErrorMessage as bh, getRawWorkspaceKey as bi, health as bj, mail as bk, parseSSEEvents as bl, parseSlashCommand as bm, parseSlashTokenInProgress as bn, performPasswordLogin as bo, performSigningKeyLogin as bp, performSsoDeviceFlowLogin as bq, profile as br, projects as bs, requireData as bt, requireOk as bu, resolveAuth as bv, resolveCitations as bw, resolveWorkspace as bx, responses as by, selectWorkspace as bz, type AgentStepDeltaEvent as c, type AgentStepEvent as d, Arbi as e, ArbiApiError as f, ArbiError as g, type ArbiErrorEvent as h, type ArbiOptions as i, ArbiSessionExpiredError as j, type ArtifactEvent as k, type AuthContext as l, type AuthHeaders as m, type AuthMode as n, type AuthenticatedClient as o, type CitationSummary as p, type CliConfig as q, type CliCredentials as r, type CommandDescriptor as s, type ConfigStore as t, type ConnectOptions as u, type ConversationResponse as v, type CreateFactRequest as w, type CreateFactsRequest as x, type CreateWorkRequest as y, type CreateWorkflowRequest as z };