@haex-space/vault-sdk 3.1.0 → 3.2.0

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.
Files changed (45) hide show
  1. package/dist/{client-C0DPNG62.d.mts → client-GeColu97.d.mts} +263 -2
  2. package/dist/{client-B_B6rLIw.d.ts → client-z1jTcuQE.d.ts} +263 -2
  3. package/dist/index.d.mts +76 -6
  4. package/dist/index.d.ts +76 -6
  5. package/dist/index.js +212 -24
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +209 -25
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/node.d.mts +1 -1
  10. package/dist/node.d.ts +1 -1
  11. package/dist/nuxt.js +16 -6
  12. package/dist/nuxt.js.map +1 -1
  13. package/dist/nuxt.mjs +16 -6
  14. package/dist/nuxt.mjs.map +1 -1
  15. package/dist/react.d.mts +2 -2
  16. package/dist/react.d.ts +2 -2
  17. package/dist/react.js +205 -23
  18. package/dist/react.js.map +1 -1
  19. package/dist/react.mjs +205 -23
  20. package/dist/react.mjs.map +1 -1
  21. package/dist/runtime/nuxt.plugin.client.d.mts +2 -2
  22. package/dist/runtime/nuxt.plugin.client.d.ts +2 -2
  23. package/dist/runtime/nuxt.plugin.client.js +205 -27
  24. package/dist/runtime/nuxt.plugin.client.js.map +1 -1
  25. package/dist/runtime/nuxt.plugin.client.mjs +205 -27
  26. package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
  27. package/dist/svelte.d.mts +2 -2
  28. package/dist/svelte.d.ts +2 -2
  29. package/dist/svelte.js +205 -23
  30. package/dist/svelte.js.map +1 -1
  31. package/dist/svelte.mjs +205 -23
  32. package/dist/svelte.mjs.map +1 -1
  33. package/dist/{types-DmCSegdY.d.mts → types-CDMBvvjl.d.mts} +2 -0
  34. package/dist/{types-DmCSegdY.d.ts → types-CDMBvvjl.d.ts} +2 -0
  35. package/dist/vite.js +15 -5
  36. package/dist/vite.js.map +1 -1
  37. package/dist/vite.mjs +15 -5
  38. package/dist/vite.mjs.map +1 -1
  39. package/dist/vue.d.mts +2 -2
  40. package/dist/vue.d.ts +2 -2
  41. package/dist/vue.js +205 -23
  42. package/dist/vue.js.map +1 -1
  43. package/dist/vue.mjs +205 -23
  44. package/dist/vue.mjs.map +1 -1
  45. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { b as HaexHubEvent, c as EXTERNAL_EVENTS, D as DatabaseQueryResult, M as Migration, d as MigrationResult, W as WebRequestOptions, e as WebResponse, f as EventCallback, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, g as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult } from './types-DmCSegdY.mjs';
1
+ import { b as HaexHubEvent, c as EXTERNAL_EVENTS, D as DatabaseQueryResult, M as Migration, d as MigrationResult, W as WebRequestOptions, e as WebResponse, f as EventCallback, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, g as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult } from './types-CDMBvvjl.mjs';
2
2
  import { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
3
3
 
4
4
  /**
@@ -1187,6 +1187,264 @@ declare class ShellAPI {
1187
1187
  offExit(callback: EventCallback): void;
1188
1188
  }
1189
1189
 
1190
+ /**
1191
+ * Types for the core passwords vault.
1192
+ *
1193
+ * Mirrors the Rust types in `src-tauri/src/passwords/commands.rs`. The
1194
+ * extension's view is scoped by the `passwords` permission's `target`
1195
+ * field — items outside the granted tag scope are not visible.
1196
+ */
1197
+ interface PasswordKeyValue {
1198
+ id: string;
1199
+ key?: string;
1200
+ value?: string;
1201
+ }
1202
+ /** Lean view returned by `list` — no secret fields. */
1203
+ interface PasswordItemSummary {
1204
+ id: string;
1205
+ title?: string;
1206
+ username?: string;
1207
+ url?: string;
1208
+ icon?: string;
1209
+ color?: string;
1210
+ tags: string[];
1211
+ createdAt?: string;
1212
+ updatedAt?: string;
1213
+ }
1214
+ /** Full item with secrets, returned by `read`. */
1215
+ interface PasswordItemFull {
1216
+ id: string;
1217
+ title?: string;
1218
+ username?: string;
1219
+ password?: string;
1220
+ note?: string;
1221
+ icon?: string;
1222
+ color?: string;
1223
+ url?: string;
1224
+ otpSecret?: string;
1225
+ otpDigits?: number;
1226
+ otpPeriod?: number;
1227
+ otpAlgorithm?: string;
1228
+ /** Maps canonical field names to autofill aliases. */
1229
+ autofillAliases?: Record<string, string[]>;
1230
+ tags: string[];
1231
+ keyValues: PasswordKeyValue[];
1232
+ expiresAt?: string;
1233
+ createdAt?: string;
1234
+ updatedAt?: string;
1235
+ }
1236
+ interface PasswordKeyValueInput {
1237
+ key?: string;
1238
+ value?: string;
1239
+ }
1240
+ /** Input for `create` and `update`. `tags` must contain >=1 in scope. */
1241
+ interface PasswordInput {
1242
+ title?: string;
1243
+ username?: string;
1244
+ password?: string;
1245
+ note?: string;
1246
+ icon?: string;
1247
+ color?: string;
1248
+ url?: string;
1249
+ otpSecret?: string;
1250
+ otpDigits?: number;
1251
+ otpPeriod?: number;
1252
+ otpAlgorithm?: string;
1253
+ autofillAliases?: Record<string, string[]>;
1254
+ expiresAt?: string;
1255
+ tags: string[];
1256
+ keyValues?: PasswordKeyValueInput[];
1257
+ }
1258
+
1259
+ /**
1260
+ * Access to the core passwords vault, scoped by the extension's
1261
+ * `passwords` permissions (target = tag or "*").
1262
+ */
1263
+ declare class PasswordsAPI {
1264
+ private client;
1265
+ constructor(client: HaexVaultSdk);
1266
+ /** List items in scope — summaries only, no secrets. */
1267
+ listAsync(): Promise<PasswordItemSummary[]>;
1268
+ /** Read a single item by id with full secrets. */
1269
+ readAsync(itemId: string): Promise<PasswordItemFull>;
1270
+ /**
1271
+ * Create a new password item. `input.tags` must contain at least one
1272
+ * tag within the extension's permission scope, otherwise the write
1273
+ * is rejected as a security violation.
1274
+ *
1275
+ * Returns the new item id.
1276
+ */
1277
+ createAsync(input: PasswordInput): Promise<string>;
1278
+ /**
1279
+ * Update an existing item. The item must already be in scope, and
1280
+ * the new tag set must keep at least one tag in scope (extensions
1281
+ * cannot orphan an item out of their own reach).
1282
+ */
1283
+ updateAsync(itemId: string, input: PasswordInput): Promise<void>;
1284
+ /** Delete an item by id. Item must be in scope. */
1285
+ deleteAsync(itemId: string): Promise<void>;
1286
+ }
1287
+
1288
+ /**
1289
+ * Mail types — IMAP fetch + SMTP send.
1290
+ *
1291
+ * Mirrors the Rust types in `src-tauri/src/mail/types.rs`. Permission
1292
+ * is scoped by the `mail` resource type with `target` = mail-server
1293
+ * hostname (subdomain match supported, so target="gmail.com" matches
1294
+ * "imap.gmail.com" and "smtp.gmail.com").
1295
+ */
1296
+ type ConnectionSecurity = "tls" | "startTls" | "none";
1297
+ interface ImapConfig {
1298
+ host: string;
1299
+ port: number;
1300
+ security: ConnectionSecurity;
1301
+ username: string;
1302
+ password: string;
1303
+ }
1304
+ interface SmtpConfig {
1305
+ host: string;
1306
+ port: number;
1307
+ security: ConnectionSecurity;
1308
+ username: string;
1309
+ password: string;
1310
+ }
1311
+ /** A mail account. SMTP is optional (fetch-only is valid). */
1312
+ interface MailAccount {
1313
+ id: string;
1314
+ imap: ImapConfig;
1315
+ smtp?: SmtpConfig;
1316
+ }
1317
+ interface MailAddress {
1318
+ name?: string;
1319
+ email: string;
1320
+ }
1321
+ interface MailboxInfo {
1322
+ name: string;
1323
+ delimiter?: string;
1324
+ flags: string[];
1325
+ exists?: number;
1326
+ unseen?: number;
1327
+ uidValidity?: number;
1328
+ uidNext?: number;
1329
+ }
1330
+ interface MessageEnvelope {
1331
+ uid: number;
1332
+ flags: string[];
1333
+ /** Server-side internal date as Unix timestamp (seconds). */
1334
+ internalDate?: number;
1335
+ subject?: string;
1336
+ from: MailAddress[];
1337
+ to: MailAddress[];
1338
+ cc: MailAddress[];
1339
+ messageId?: string;
1340
+ inReplyTo?: string;
1341
+ references: string[];
1342
+ size?: number;
1343
+ }
1344
+ interface Attachment {
1345
+ partIndex: number;
1346
+ filename?: string;
1347
+ contentType: string;
1348
+ size: number;
1349
+ contentId?: string;
1350
+ isInline: boolean;
1351
+ }
1352
+ interface MailMessage {
1353
+ envelope: MessageEnvelope;
1354
+ bodyText?: string;
1355
+ bodyHtml?: string;
1356
+ attachments: Attachment[];
1357
+ }
1358
+ /** Selector for fetch operations. */
1359
+ type FetchRange = {
1360
+ type: "latest";
1361
+ count: number;
1362
+ } | {
1363
+ type: "uidRange";
1364
+ start: number;
1365
+ end: number;
1366
+ } | {
1367
+ type: "uidList";
1368
+ uids: number[];
1369
+ };
1370
+ interface OutgoingAttachment {
1371
+ filename: string;
1372
+ contentType: string;
1373
+ /** Base64-encoded bytes (standard alphabet, with padding). */
1374
+ data: string;
1375
+ /** If set, the part is marked inline and referenced via `cid:` in HTML. */
1376
+ contentId?: string;
1377
+ }
1378
+ interface OutgoingMessage {
1379
+ from: MailAddress;
1380
+ to: MailAddress[];
1381
+ cc?: MailAddress[];
1382
+ bcc?: MailAddress[];
1383
+ replyTo?: MailAddress;
1384
+ subject: string;
1385
+ bodyText?: string;
1386
+ bodyHtml?: string;
1387
+ attachments?: OutgoingAttachment[];
1388
+ /** Message-ID being replied to. Sets `In-Reply-To` header. */
1389
+ inReplyTo?: string;
1390
+ /** Threading chain. Sets `References` header. */
1391
+ references?: string[];
1392
+ }
1393
+
1394
+ /**
1395
+ * Mail operations through the host vault.
1396
+ *
1397
+ * Permission model:
1398
+ * - All IMAP operations require `mail` permission with action `fetch`
1399
+ * on `imap.host`.
1400
+ * - SMTP send requires `mail` permission with action `send` on `smtp.host`.
1401
+ * - target="gmail.com" matches "imap.gmail.com" / "smtp.gmail.com".
1402
+ *
1403
+ * Credentials live with the caller (typically loaded from
1404
+ * `client.passwords` and passed in per call). The SDK never persists
1405
+ * credentials.
1406
+ */
1407
+ declare class MailAPI {
1408
+ private client;
1409
+ constructor(client: HaexVaultSdk);
1410
+ /**
1411
+ * LIST mailboxes for an IMAP account. Pass `includeStatus=true` for
1412
+ * EXISTS/UNSEEN/UIDVALIDITY/UIDNEXT per box (one extra round-trip
1413
+ * per mailbox — fine for typical accounts, expensive for large
1414
+ * trees).
1415
+ */
1416
+ listMailboxesAsync(imap: ImapConfig, options?: {
1417
+ reference?: string;
1418
+ pattern?: string;
1419
+ includeStatus?: boolean;
1420
+ }): Promise<MailboxInfo[]>;
1421
+ /** Fetch lightweight envelopes for a mailbox + range (for list views). */
1422
+ fetchEnvelopesAsync(imap: ImapConfig, mailbox: string, range: FetchRange): Promise<MessageEnvelope[]>;
1423
+ /** Fetch a full message (envelope + body + attachment metadata) by UID. */
1424
+ fetchMessageAsync(imap: ImapConfig, mailbox: string, uid: number): Promise<MailMessage>;
1425
+ /**
1426
+ * Set or unset IMAP flags. Use `flags=["\\Seen"]` + `add=true` to
1427
+ * mark messages as read; `add=false` removes the flag(s).
1428
+ */
1429
+ setFlagsAsync(imap: ImapConfig, mailbox: string, uids: number[], flags: string[], add: boolean): Promise<void>;
1430
+ /** Move messages between mailboxes. Falls back to COPY+EXPUNGE on servers without MOVE. */
1431
+ moveMessagesAsync(imap: ImapConfig, sourceMailbox: string, destinationMailbox: string, uids: number[]): Promise<void>;
1432
+ /**
1433
+ * APPEND a base64-encoded RFC822 message into a mailbox. Combine
1434
+ * with `buildRfc822Async` to save drafts, or with the bytes returned
1435
+ * after `sendMessageAsync` to mirror the sent copy into "Sent".
1436
+ */
1437
+ appendMessageAsync(imap: ImapConfig, mailbox: string, rfc822Base64: string, flags?: string[]): Promise<void>;
1438
+ /** Send a message via SMTP. Returns the assigned Message-ID (no angle brackets). */
1439
+ sendMessageAsync(smtp: SmtpConfig, message: OutgoingMessage): Promise<string>;
1440
+ /**
1441
+ * Build RFC822 bytes for a message without sending — useful for
1442
+ * drafts that get APPENDed to a "Drafts" folder. Permission-wise
1443
+ * this is a fetch operation (no SMTP host involved).
1444
+ */
1445
+ buildRfc822Async(imapHost: string, message: OutgoingMessage): Promise<string>;
1446
+ }
1447
+
1190
1448
  /**
1191
1449
  * HaexVault Client
1192
1450
  *
@@ -1216,6 +1474,7 @@ declare class HaexVaultSdk {
1216
1474
  private hostPort;
1217
1475
  private readyPromise;
1218
1476
  private resolveReady;
1477
+ private rejectReady;
1219
1478
  private setupPromise;
1220
1479
  private setupHook;
1221
1480
  orm: SqliteRemoteDatabase<Record<string, unknown>> | null;
@@ -1228,6 +1487,8 @@ declare class HaexVaultSdk {
1228
1487
  readonly localsend: LocalSendAPI;
1229
1488
  readonly spaces: SpacesAPI;
1230
1489
  readonly shell: ShellAPI;
1490
+ readonly passwords: PasswordsAPI;
1491
+ readonly mail: MailAPI;
1231
1492
  /** Unified action system - register handlers that work for both Bridge and AI requests */
1232
1493
  readonly actions: {
1233
1494
  register: (action: string, handler: ExternalRequestHandler) => (() => void);
@@ -1276,4 +1537,4 @@ declare class HaexVaultSdk {
1276
1537
  private log;
1277
1538
  }
1278
1539
 
1279
- export { type SpaceKeyGrantInfo as $, type AuthorizedClient as A, type BlockedClient as B, type RequestedExtension as C, DatabaseAPI as D, type ExternalAuthDecision as E, type FileStat as F, type SelectFileOptions as G, HaexVaultSdk as H, type SelectFolderOptions as I, type ServerInfo as J, KnownPath as K, LOCALSEND_EVENTS as L, type ServerStatus as M, type SessionAuthorization as N, type SharedSpace as O, type PendingAuthorization as P, ShellAPI as Q, RemoteStorageAPI as R, StorageAPI as S, type ShellCreateOptions as T, type UpdateBackendRequest as U, type ShellCreateResponse as V, type ShellExitEvent as W, type ShellOutputEvent as X, type SpaceAccessTokenInfo as Y, type SpaceAssignment as Z, type SpaceInvite as _, type DecryptedSpace as a, type SpaceMemberInfo as a0, SpacesAPI as a1, type SyncBackendInfo as a2, type TransferDirection as a3, type TransferProgress as a4, type TransferState as a5, WebAPI as a6, canExternalClientSendRequests as a7, isExternalClientConnected as a8, type Device as b, type DeviceInfo as c, type DeviceType as d, type DirEntry as e, type ExternalConnection as f, ExternalConnectionErrorCode as g, ExternalConnectionState as h, type ExternalRequest as i, type ExternalRequestEvent as j, type ExternalRequestHandler as k, type ExternalRequestPayload as l, type ExternalResponse as m, FilesystemAPI as n, type KnownPaths as o, LocalSendAPI as p, type LocalSendEvent as q, type FileInfo as r, type LocalSendSettings as s, type PendingTransfer as t, PermissionsAPI as u, type AddBackendRequest as v, type S3Config as w, type S3PublicConfig as x, type StorageBackendInfo as y, type StorageObjectInfo as z };
1540
+ export { type StorageBackendInfo as $, type AuthorizedClient as A, type BlockedClient as B, type ConnectionSecurity as C, DatabaseAPI as D, type ExternalAuthDecision as E, type FileStat as F, type OutgoingMessage as G, HaexVaultSdk as H, type ImapConfig as I, type PasswordItemFull as J, KnownPath as K, LOCALSEND_EVENTS as L, MailAPI as M, type PasswordItemSummary as N, type OutgoingAttachment as O, type PasswordInput as P, type PasswordKeyValue as Q, type PasswordKeyValueInput as R, StorageAPI as S, PasswordsAPI as T, type PendingAuthorization as U, type PendingTransfer as V, PermissionsAPI as W, type AddBackendRequest as X, type S3Config as Y, type S3PublicConfig as Z, RemoteStorageAPI as _, type DecryptedSpace as a, type StorageObjectInfo as a0, type UpdateBackendRequest as a1, type RequestedExtension as a2, type SelectFileOptions as a3, type SelectFolderOptions as a4, type ServerInfo as a5, type ServerStatus as a6, type SessionAuthorization as a7, type SharedSpace as a8, ShellAPI as a9, type ShellCreateOptions as aa, type ShellCreateResponse as ab, type ShellExitEvent as ac, type ShellOutputEvent as ad, type SmtpConfig as ae, type SpaceAccessTokenInfo as af, type SpaceAssignment as ag, type SpaceInvite as ah, type SpaceKeyGrantInfo as ai, type SpaceMemberInfo as aj, SpacesAPI as ak, type SyncBackendInfo as al, type TransferDirection as am, type TransferProgress as an, type TransferState as ao, WebAPI as ap, canExternalClientSendRequests as aq, isExternalClientConnected as ar, type Device as b, type DeviceInfo as c, type DeviceType as d, type DirEntry as e, type ExternalConnection as f, ExternalConnectionErrorCode as g, ExternalConnectionState as h, type ExternalRequest as i, type ExternalRequestEvent as j, type ExternalRequestHandler as k, type ExternalRequestPayload as l, type ExternalResponse as m, FilesystemAPI as n, type KnownPaths as o, LocalSendAPI as p, type LocalSendEvent as q, type FileInfo as r, type LocalSendSettings as s, type MailAccount as t, type MailAddress as u, type Attachment as v, type FetchRange as w, type MailMessage as x, type MailboxInfo as y, type MessageEnvelope as z };
@@ -1,4 +1,4 @@
1
- import { b as HaexHubEvent, c as EXTERNAL_EVENTS, D as DatabaseQueryResult, M as Migration, d as MigrationResult, W as WebRequestOptions, e as WebResponse, f as EventCallback, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, g as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult } from './types-DmCSegdY.js';
1
+ import { b as HaexHubEvent, c as EXTERNAL_EVENTS, D as DatabaseQueryResult, M as Migration, d as MigrationResult, W as WebRequestOptions, e as WebResponse, f as EventCallback, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, g as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult } from './types-CDMBvvjl.js';
2
2
  import { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
3
3
 
4
4
  /**
@@ -1187,6 +1187,264 @@ declare class ShellAPI {
1187
1187
  offExit(callback: EventCallback): void;
1188
1188
  }
1189
1189
 
1190
+ /**
1191
+ * Types for the core passwords vault.
1192
+ *
1193
+ * Mirrors the Rust types in `src-tauri/src/passwords/commands.rs`. The
1194
+ * extension's view is scoped by the `passwords` permission's `target`
1195
+ * field — items outside the granted tag scope are not visible.
1196
+ */
1197
+ interface PasswordKeyValue {
1198
+ id: string;
1199
+ key?: string;
1200
+ value?: string;
1201
+ }
1202
+ /** Lean view returned by `list` — no secret fields. */
1203
+ interface PasswordItemSummary {
1204
+ id: string;
1205
+ title?: string;
1206
+ username?: string;
1207
+ url?: string;
1208
+ icon?: string;
1209
+ color?: string;
1210
+ tags: string[];
1211
+ createdAt?: string;
1212
+ updatedAt?: string;
1213
+ }
1214
+ /** Full item with secrets, returned by `read`. */
1215
+ interface PasswordItemFull {
1216
+ id: string;
1217
+ title?: string;
1218
+ username?: string;
1219
+ password?: string;
1220
+ note?: string;
1221
+ icon?: string;
1222
+ color?: string;
1223
+ url?: string;
1224
+ otpSecret?: string;
1225
+ otpDigits?: number;
1226
+ otpPeriod?: number;
1227
+ otpAlgorithm?: string;
1228
+ /** Maps canonical field names to autofill aliases. */
1229
+ autofillAliases?: Record<string, string[]>;
1230
+ tags: string[];
1231
+ keyValues: PasswordKeyValue[];
1232
+ expiresAt?: string;
1233
+ createdAt?: string;
1234
+ updatedAt?: string;
1235
+ }
1236
+ interface PasswordKeyValueInput {
1237
+ key?: string;
1238
+ value?: string;
1239
+ }
1240
+ /** Input for `create` and `update`. `tags` must contain >=1 in scope. */
1241
+ interface PasswordInput {
1242
+ title?: string;
1243
+ username?: string;
1244
+ password?: string;
1245
+ note?: string;
1246
+ icon?: string;
1247
+ color?: string;
1248
+ url?: string;
1249
+ otpSecret?: string;
1250
+ otpDigits?: number;
1251
+ otpPeriod?: number;
1252
+ otpAlgorithm?: string;
1253
+ autofillAliases?: Record<string, string[]>;
1254
+ expiresAt?: string;
1255
+ tags: string[];
1256
+ keyValues?: PasswordKeyValueInput[];
1257
+ }
1258
+
1259
+ /**
1260
+ * Access to the core passwords vault, scoped by the extension's
1261
+ * `passwords` permissions (target = tag or "*").
1262
+ */
1263
+ declare class PasswordsAPI {
1264
+ private client;
1265
+ constructor(client: HaexVaultSdk);
1266
+ /** List items in scope — summaries only, no secrets. */
1267
+ listAsync(): Promise<PasswordItemSummary[]>;
1268
+ /** Read a single item by id with full secrets. */
1269
+ readAsync(itemId: string): Promise<PasswordItemFull>;
1270
+ /**
1271
+ * Create a new password item. `input.tags` must contain at least one
1272
+ * tag within the extension's permission scope, otherwise the write
1273
+ * is rejected as a security violation.
1274
+ *
1275
+ * Returns the new item id.
1276
+ */
1277
+ createAsync(input: PasswordInput): Promise<string>;
1278
+ /**
1279
+ * Update an existing item. The item must already be in scope, and
1280
+ * the new tag set must keep at least one tag in scope (extensions
1281
+ * cannot orphan an item out of their own reach).
1282
+ */
1283
+ updateAsync(itemId: string, input: PasswordInput): Promise<void>;
1284
+ /** Delete an item by id. Item must be in scope. */
1285
+ deleteAsync(itemId: string): Promise<void>;
1286
+ }
1287
+
1288
+ /**
1289
+ * Mail types — IMAP fetch + SMTP send.
1290
+ *
1291
+ * Mirrors the Rust types in `src-tauri/src/mail/types.rs`. Permission
1292
+ * is scoped by the `mail` resource type with `target` = mail-server
1293
+ * hostname (subdomain match supported, so target="gmail.com" matches
1294
+ * "imap.gmail.com" and "smtp.gmail.com").
1295
+ */
1296
+ type ConnectionSecurity = "tls" | "startTls" | "none";
1297
+ interface ImapConfig {
1298
+ host: string;
1299
+ port: number;
1300
+ security: ConnectionSecurity;
1301
+ username: string;
1302
+ password: string;
1303
+ }
1304
+ interface SmtpConfig {
1305
+ host: string;
1306
+ port: number;
1307
+ security: ConnectionSecurity;
1308
+ username: string;
1309
+ password: string;
1310
+ }
1311
+ /** A mail account. SMTP is optional (fetch-only is valid). */
1312
+ interface MailAccount {
1313
+ id: string;
1314
+ imap: ImapConfig;
1315
+ smtp?: SmtpConfig;
1316
+ }
1317
+ interface MailAddress {
1318
+ name?: string;
1319
+ email: string;
1320
+ }
1321
+ interface MailboxInfo {
1322
+ name: string;
1323
+ delimiter?: string;
1324
+ flags: string[];
1325
+ exists?: number;
1326
+ unseen?: number;
1327
+ uidValidity?: number;
1328
+ uidNext?: number;
1329
+ }
1330
+ interface MessageEnvelope {
1331
+ uid: number;
1332
+ flags: string[];
1333
+ /** Server-side internal date as Unix timestamp (seconds). */
1334
+ internalDate?: number;
1335
+ subject?: string;
1336
+ from: MailAddress[];
1337
+ to: MailAddress[];
1338
+ cc: MailAddress[];
1339
+ messageId?: string;
1340
+ inReplyTo?: string;
1341
+ references: string[];
1342
+ size?: number;
1343
+ }
1344
+ interface Attachment {
1345
+ partIndex: number;
1346
+ filename?: string;
1347
+ contentType: string;
1348
+ size: number;
1349
+ contentId?: string;
1350
+ isInline: boolean;
1351
+ }
1352
+ interface MailMessage {
1353
+ envelope: MessageEnvelope;
1354
+ bodyText?: string;
1355
+ bodyHtml?: string;
1356
+ attachments: Attachment[];
1357
+ }
1358
+ /** Selector for fetch operations. */
1359
+ type FetchRange = {
1360
+ type: "latest";
1361
+ count: number;
1362
+ } | {
1363
+ type: "uidRange";
1364
+ start: number;
1365
+ end: number;
1366
+ } | {
1367
+ type: "uidList";
1368
+ uids: number[];
1369
+ };
1370
+ interface OutgoingAttachment {
1371
+ filename: string;
1372
+ contentType: string;
1373
+ /** Base64-encoded bytes (standard alphabet, with padding). */
1374
+ data: string;
1375
+ /** If set, the part is marked inline and referenced via `cid:` in HTML. */
1376
+ contentId?: string;
1377
+ }
1378
+ interface OutgoingMessage {
1379
+ from: MailAddress;
1380
+ to: MailAddress[];
1381
+ cc?: MailAddress[];
1382
+ bcc?: MailAddress[];
1383
+ replyTo?: MailAddress;
1384
+ subject: string;
1385
+ bodyText?: string;
1386
+ bodyHtml?: string;
1387
+ attachments?: OutgoingAttachment[];
1388
+ /** Message-ID being replied to. Sets `In-Reply-To` header. */
1389
+ inReplyTo?: string;
1390
+ /** Threading chain. Sets `References` header. */
1391
+ references?: string[];
1392
+ }
1393
+
1394
+ /**
1395
+ * Mail operations through the host vault.
1396
+ *
1397
+ * Permission model:
1398
+ * - All IMAP operations require `mail` permission with action `fetch`
1399
+ * on `imap.host`.
1400
+ * - SMTP send requires `mail` permission with action `send` on `smtp.host`.
1401
+ * - target="gmail.com" matches "imap.gmail.com" / "smtp.gmail.com".
1402
+ *
1403
+ * Credentials live with the caller (typically loaded from
1404
+ * `client.passwords` and passed in per call). The SDK never persists
1405
+ * credentials.
1406
+ */
1407
+ declare class MailAPI {
1408
+ private client;
1409
+ constructor(client: HaexVaultSdk);
1410
+ /**
1411
+ * LIST mailboxes for an IMAP account. Pass `includeStatus=true` for
1412
+ * EXISTS/UNSEEN/UIDVALIDITY/UIDNEXT per box (one extra round-trip
1413
+ * per mailbox — fine for typical accounts, expensive for large
1414
+ * trees).
1415
+ */
1416
+ listMailboxesAsync(imap: ImapConfig, options?: {
1417
+ reference?: string;
1418
+ pattern?: string;
1419
+ includeStatus?: boolean;
1420
+ }): Promise<MailboxInfo[]>;
1421
+ /** Fetch lightweight envelopes for a mailbox + range (for list views). */
1422
+ fetchEnvelopesAsync(imap: ImapConfig, mailbox: string, range: FetchRange): Promise<MessageEnvelope[]>;
1423
+ /** Fetch a full message (envelope + body + attachment metadata) by UID. */
1424
+ fetchMessageAsync(imap: ImapConfig, mailbox: string, uid: number): Promise<MailMessage>;
1425
+ /**
1426
+ * Set or unset IMAP flags. Use `flags=["\\Seen"]` + `add=true` to
1427
+ * mark messages as read; `add=false` removes the flag(s).
1428
+ */
1429
+ setFlagsAsync(imap: ImapConfig, mailbox: string, uids: number[], flags: string[], add: boolean): Promise<void>;
1430
+ /** Move messages between mailboxes. Falls back to COPY+EXPUNGE on servers without MOVE. */
1431
+ moveMessagesAsync(imap: ImapConfig, sourceMailbox: string, destinationMailbox: string, uids: number[]): Promise<void>;
1432
+ /**
1433
+ * APPEND a base64-encoded RFC822 message into a mailbox. Combine
1434
+ * with `buildRfc822Async` to save drafts, or with the bytes returned
1435
+ * after `sendMessageAsync` to mirror the sent copy into "Sent".
1436
+ */
1437
+ appendMessageAsync(imap: ImapConfig, mailbox: string, rfc822Base64: string, flags?: string[]): Promise<void>;
1438
+ /** Send a message via SMTP. Returns the assigned Message-ID (no angle brackets). */
1439
+ sendMessageAsync(smtp: SmtpConfig, message: OutgoingMessage): Promise<string>;
1440
+ /**
1441
+ * Build RFC822 bytes for a message without sending — useful for
1442
+ * drafts that get APPENDed to a "Drafts" folder. Permission-wise
1443
+ * this is a fetch operation (no SMTP host involved).
1444
+ */
1445
+ buildRfc822Async(imapHost: string, message: OutgoingMessage): Promise<string>;
1446
+ }
1447
+
1190
1448
  /**
1191
1449
  * HaexVault Client
1192
1450
  *
@@ -1216,6 +1474,7 @@ declare class HaexVaultSdk {
1216
1474
  private hostPort;
1217
1475
  private readyPromise;
1218
1476
  private resolveReady;
1477
+ private rejectReady;
1219
1478
  private setupPromise;
1220
1479
  private setupHook;
1221
1480
  orm: SqliteRemoteDatabase<Record<string, unknown>> | null;
@@ -1228,6 +1487,8 @@ declare class HaexVaultSdk {
1228
1487
  readonly localsend: LocalSendAPI;
1229
1488
  readonly spaces: SpacesAPI;
1230
1489
  readonly shell: ShellAPI;
1490
+ readonly passwords: PasswordsAPI;
1491
+ readonly mail: MailAPI;
1231
1492
  /** Unified action system - register handlers that work for both Bridge and AI requests */
1232
1493
  readonly actions: {
1233
1494
  register: (action: string, handler: ExternalRequestHandler) => (() => void);
@@ -1276,4 +1537,4 @@ declare class HaexVaultSdk {
1276
1537
  private log;
1277
1538
  }
1278
1539
 
1279
- export { type SpaceKeyGrantInfo as $, type AuthorizedClient as A, type BlockedClient as B, type RequestedExtension as C, DatabaseAPI as D, type ExternalAuthDecision as E, type FileStat as F, type SelectFileOptions as G, HaexVaultSdk as H, type SelectFolderOptions as I, type ServerInfo as J, KnownPath as K, LOCALSEND_EVENTS as L, type ServerStatus as M, type SessionAuthorization as N, type SharedSpace as O, type PendingAuthorization as P, ShellAPI as Q, RemoteStorageAPI as R, StorageAPI as S, type ShellCreateOptions as T, type UpdateBackendRequest as U, type ShellCreateResponse as V, type ShellExitEvent as W, type ShellOutputEvent as X, type SpaceAccessTokenInfo as Y, type SpaceAssignment as Z, type SpaceInvite as _, type DecryptedSpace as a, type SpaceMemberInfo as a0, SpacesAPI as a1, type SyncBackendInfo as a2, type TransferDirection as a3, type TransferProgress as a4, type TransferState as a5, WebAPI as a6, canExternalClientSendRequests as a7, isExternalClientConnected as a8, type Device as b, type DeviceInfo as c, type DeviceType as d, type DirEntry as e, type ExternalConnection as f, ExternalConnectionErrorCode as g, ExternalConnectionState as h, type ExternalRequest as i, type ExternalRequestEvent as j, type ExternalRequestHandler as k, type ExternalRequestPayload as l, type ExternalResponse as m, FilesystemAPI as n, type KnownPaths as o, LocalSendAPI as p, type LocalSendEvent as q, type FileInfo as r, type LocalSendSettings as s, type PendingTransfer as t, PermissionsAPI as u, type AddBackendRequest as v, type S3Config as w, type S3PublicConfig as x, type StorageBackendInfo as y, type StorageObjectInfo as z };
1540
+ export { type StorageBackendInfo as $, type AuthorizedClient as A, type BlockedClient as B, type ConnectionSecurity as C, DatabaseAPI as D, type ExternalAuthDecision as E, type FileStat as F, type OutgoingMessage as G, HaexVaultSdk as H, type ImapConfig as I, type PasswordItemFull as J, KnownPath as K, LOCALSEND_EVENTS as L, MailAPI as M, type PasswordItemSummary as N, type OutgoingAttachment as O, type PasswordInput as P, type PasswordKeyValue as Q, type PasswordKeyValueInput as R, StorageAPI as S, PasswordsAPI as T, type PendingAuthorization as U, type PendingTransfer as V, PermissionsAPI as W, type AddBackendRequest as X, type S3Config as Y, type S3PublicConfig as Z, RemoteStorageAPI as _, type DecryptedSpace as a, type StorageObjectInfo as a0, type UpdateBackendRequest as a1, type RequestedExtension as a2, type SelectFileOptions as a3, type SelectFolderOptions as a4, type ServerInfo as a5, type ServerStatus as a6, type SessionAuthorization as a7, type SharedSpace as a8, ShellAPI as a9, type ShellCreateOptions as aa, type ShellCreateResponse as ab, type ShellExitEvent as ac, type ShellOutputEvent as ad, type SmtpConfig as ae, type SpaceAccessTokenInfo as af, type SpaceAssignment as ag, type SpaceInvite as ah, type SpaceKeyGrantInfo as ai, type SpaceMemberInfo as aj, SpacesAPI as ak, type SyncBackendInfo as al, type TransferDirection as am, type TransferProgress as an, type TransferState as ao, WebAPI as ap, canExternalClientSendRequests as aq, isExternalClientConnected as ar, type Device as b, type DeviceInfo as c, type DeviceType as d, type DirEntry as e, type ExternalConnection as f, ExternalConnectionErrorCode as g, ExternalConnectionState as h, type ExternalRequest as i, type ExternalRequestEvent as j, type ExternalRequestHandler as k, type ExternalRequestPayload as l, type ExternalResponse as m, FilesystemAPI as n, type KnownPaths as o, LocalSendAPI as p, type LocalSendEvent as q, type FileInfo as r, type LocalSendSettings as s, type MailAccount as t, type MailAddress as u, type Attachment as v, type FetchRange as w, type MailMessage as x, type MailboxInfo as y, type MessageEnvelope as z };