@haex-space/vault-sdk 3.7.0 → 4.1.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 (51) hide show
  1. package/README.md +51 -19
  2. package/dist/cli/index.js +437 -355
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/cli/index.mjs +428 -339
  5. package/dist/cli/index.mjs.map +1 -1
  6. package/dist/{client-DH4Km77u.d.ts → client-CD5QZi7F.d.ts} +76 -12
  7. package/dist/{client-Dn4AbXbT.d.mts → client-Cx4ZyQFL.d.mts} +76 -12
  8. package/dist/haex_bundle_bg.wasm +0 -0
  9. package/dist/index.d.mts +16 -61
  10. package/dist/index.d.ts +16 -61
  11. package/dist/index.js +185 -116
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +204 -134
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/node.d.mts +53 -2
  16. package/dist/node.d.ts +53 -2
  17. package/dist/node.js +319 -2
  18. package/dist/node.js.map +1 -1
  19. package/dist/node.mjs +320 -5
  20. package/dist/node.mjs.map +1 -1
  21. package/dist/nuxt.js +7 -5
  22. package/dist/nuxt.js.map +1 -1
  23. package/dist/nuxt.mjs +3 -2
  24. package/dist/nuxt.mjs.map +1 -1
  25. package/dist/react.d.mts +2 -2
  26. package/dist/react.d.ts +2 -2
  27. package/dist/react.js +192 -18
  28. package/dist/react.js.map +1 -1
  29. package/dist/react.mjs +212 -38
  30. package/dist/react.mjs.map +1 -1
  31. package/dist/runtime/nuxt.plugin.client.d.mts +2 -2
  32. package/dist/runtime/nuxt.plugin.client.d.ts +2 -2
  33. package/dist/runtime/nuxt.plugin.client.js +100 -18
  34. package/dist/runtime/nuxt.plugin.client.js.map +1 -1
  35. package/dist/runtime/nuxt.plugin.client.mjs +100 -18
  36. package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
  37. package/dist/svelte.d.mts +2 -2
  38. package/dist/svelte.d.ts +2 -2
  39. package/dist/svelte.js +192 -18
  40. package/dist/svelte.js.map +1 -1
  41. package/dist/svelte.mjs +212 -38
  42. package/dist/svelte.mjs.map +1 -1
  43. package/dist/{types-DQZCRfC-.d.mts → types-BwFKGH70.d.mts} +11 -3
  44. package/dist/{types-DQZCRfC-.d.ts → types-BwFKGH70.d.ts} +11 -3
  45. package/dist/vue.d.mts +2 -2
  46. package/dist/vue.d.ts +2 -2
  47. package/dist/vue.js +192 -18
  48. package/dist/vue.js.map +1 -1
  49. package/dist/vue.mjs +212 -38
  50. package/dist/vue.mjs.map +1 -1
  51. package/package.json +9 -7
package/dist/react.js CHANGED
@@ -8,6 +8,12 @@ var __esm = (fn, res) => function __init() {
8
8
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
9
  };
10
10
 
11
+ // node_modules/.pnpm/tsup@8.5.1_jiti@2.7.0_postcss@8.5.29_typescript@6.0.3_yaml@2.9.0/node_modules/tsup/assets/cjs_shims.js
12
+ var init_cjs_shims = __esm({
13
+ "node_modules/.pnpm/tsup@8.5.1_jiti@2.7.0_postcss@8.5.29_typescript@6.0.3_yaml@2.9.0/node_modules/tsup/assets/cjs_shims.js"() {
14
+ }
15
+ });
16
+
11
17
  // src/crypto/vaultKey.ts
12
18
  function arrayBufferToBase64(buffer) {
13
19
  const bytes = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
@@ -36,17 +42,29 @@ function base64ToArrayBuffer(base64) {
36
42
  }
37
43
  var init_vaultKey = __esm({
38
44
  "src/crypto/vaultKey.ts"() {
45
+ init_cjs_shims();
39
46
  }
40
47
  });
41
48
 
42
49
  // src/crypto/userKeypair.ts
43
50
  var init_userKeypair = __esm({
44
51
  "src/crypto/userKeypair.ts"() {
52
+ init_cjs_shims();
45
53
  init_vaultKey();
46
54
  }
47
55
  });
48
56
 
57
+ // src/react.ts
58
+ init_cjs_shims();
59
+
60
+ // src/index.ts
61
+ init_cjs_shims();
62
+
63
+ // src/polyfills/index.ts
64
+ init_cjs_shims();
65
+
49
66
  // src/polyfills/localStorage.ts
67
+ init_cjs_shims();
50
68
  function installLocalStoragePolyfill() {
51
69
  if (typeof window === "undefined") {
52
70
  return;
@@ -141,6 +159,7 @@ function installSessionStoragePolyfill() {
141
159
  }
142
160
 
143
161
  // src/polyfills/cookies.ts
162
+ init_cjs_shims();
144
163
  function installCookiePolyfill() {
145
164
  if (typeof window === "undefined" || typeof document === "undefined") {
146
165
  return;
@@ -201,6 +220,7 @@ function installCookiePolyfill() {
201
220
  }
202
221
 
203
222
  // src/polyfills/history.ts
223
+ init_cjs_shims();
204
224
  function installHistoryPolyfill() {
205
225
  if (typeof window === "undefined" || typeof history === "undefined") {
206
226
  return;
@@ -264,7 +284,11 @@ function installHistoryPolyfill() {
264
284
  }
265
285
  }
266
286
 
287
+ // src/polyfills/debug.ts
288
+ init_cjs_shims();
289
+
267
290
  // src/messages.ts
291
+ init_cjs_shims();
268
292
  var HAEXSPACE_MESSAGE_TYPES = {
269
293
  /** Debug message for development/troubleshooting */
270
294
  DEBUG: "haexspace:debug",
@@ -308,7 +332,11 @@ function installDebugDiagnostics() {
308
332
  }
309
333
  }
310
334
 
335
+ // src/polyfills/baseTag.ts
336
+ init_cjs_shims();
337
+
311
338
  // src/polyfills/consoleForwarding.ts
339
+ init_cjs_shims();
312
340
  var originalConsole = {
313
341
  log: console.log,
314
342
  info: console.info,
@@ -389,7 +417,14 @@ if (typeof window !== "undefined") {
389
417
  installPolyfills();
390
418
  }
391
419
 
420
+ // src/client.ts
421
+ init_cjs_shims();
422
+
423
+ // src/types.ts
424
+ init_cjs_shims();
425
+
392
426
  // src/events.ts
427
+ init_cjs_shims();
393
428
  var HAEXTENSION_EVENTS = {
394
429
  /** Context (theme, locale, platform) has changed */
395
430
  CONTEXT_CHANGED: "haextension:context:changed",
@@ -467,7 +502,17 @@ var HaexVaultSdkError = class extends Error {
467
502
  }
468
503
  };
469
504
 
505
+ // src/api/storage.ts
506
+ init_cjs_shims();
507
+
508
+ // src/commands.ts
509
+ init_cjs_shims();
510
+
511
+ // src/commands/index.ts
512
+ init_cjs_shims();
513
+
470
514
  // src/commands/database.ts
515
+ init_cjs_shims();
471
516
  var DATABASE_COMMANDS = {
472
517
  /** Execute a SELECT query */
473
518
  query: "extension_database_query",
@@ -480,6 +525,7 @@ var DATABASE_COMMANDS = {
480
525
  };
481
526
 
482
527
  // src/commands/permissions.ts
528
+ init_cjs_shims();
483
529
  var PERMISSIONS_COMMANDS = {
484
530
  /** Check web/fetch permission */
485
531
  checkWeb: "extension_permissions_check_web",
@@ -490,6 +536,7 @@ var PERMISSIONS_COMMANDS = {
490
536
  };
491
537
 
492
538
  // src/commands/web.ts
539
+ init_cjs_shims();
493
540
  var WEB_COMMANDS = {
494
541
  /** Open URL in external browser */
495
542
  open: "extension_web_open",
@@ -498,6 +545,7 @@ var WEB_COMMANDS = {
498
545
  };
499
546
 
500
547
  // src/commands/webStorage.ts
548
+ init_cjs_shims();
501
549
  var WEB_STORAGE_COMMANDS = {
502
550
  /** Get item from storage */
503
551
  getItem: "extension_web_storage_get_item",
@@ -512,6 +560,7 @@ var WEB_STORAGE_COMMANDS = {
512
560
  };
513
561
 
514
562
  // src/commands/filesystem.ts
563
+ init_cjs_shims();
515
564
  var FILESYSTEM_COMMANDS = {
516
565
  // Dialog commands
517
566
  /** Show save file dialog */
@@ -555,19 +604,27 @@ var FILESYSTEM_COMMANDS = {
555
604
  };
556
605
 
557
606
  // src/commands/externalBridge.ts
607
+ init_cjs_shims();
558
608
  var EXTERNAL_BRIDGE_COMMANDS = {
559
609
  // Response handling (called by extensions)
560
610
  /** Respond to an external request */
561
611
  respond: "external_bridge_respond"};
562
612
 
563
613
  // src/commands/extension.ts
614
+ init_cjs_shims();
564
615
  var EXTENSION_COMMANDS = {
565
616
  /** Get extension info (manifest, id, etc.) */
566
617
  getInfo: "extension_get_info",
567
618
  /** Get application context (theme, locale, etc.) */
568
- getContext: "extension_context_get"};
619
+ getContext: "extension_context_get",
620
+ /** Ask the host to mark (or unmark) this extension's own tab as wanting attention */
621
+ tabAttention: "extension_tab_attention",
622
+ /** Ask the user to confirm, in a dialog the host draws over this extension's tab */
623
+ dialogConfirm: "extension_dialog_confirm"
624
+ };
569
625
 
570
626
  // src/commands/remoteStorage.ts
627
+ init_cjs_shims();
571
628
  var REMOTE_STORAGE_COMMANDS = {
572
629
  // Backend Management
573
630
  /** List all storage backends */
@@ -592,6 +649,7 @@ var REMOTE_STORAGE_COMMANDS = {
592
649
  };
593
650
 
594
651
  // src/commands/localsend.ts
652
+ init_cjs_shims();
595
653
  var LOCALSEND_COMMANDS = {
596
654
  // Initialization
597
655
  /** Initialize LocalSend (generate identity, etc.) */
@@ -638,6 +696,7 @@ var LOCALSEND_COMMANDS = {
638
696
  };
639
697
 
640
698
  // src/commands/spaces.ts
699
+ init_cjs_shims();
641
700
  var SPACE_COMMANDS = {
642
701
  /** Bulk assign rows to spaces */
643
702
  assign: "extension_space_assign",
@@ -651,6 +710,7 @@ var SPACE_COMMANDS = {
651
710
  list: "extension_space_list"};
652
711
 
653
712
  // src/commands/shell.ts
713
+ init_cjs_shims();
654
714
  var SHELL_COMMANDS = {
655
715
  /** List available shell environments (no permission required) */
656
716
  listAvailable: "extension_shell_list_available",
@@ -658,6 +718,8 @@ var SHELL_COMMANDS = {
658
718
  create: "extension_shell_create",
659
719
  /** Write data to a shell session's stdin */
660
720
  write: "extension_shell_write",
721
+ /** Acknowledge `shell:output` events handed on (backpressure; sent by the SDK itself) */
722
+ ack: "extension_shell_ack",
661
723
  /** Resize a shell session's terminal */
662
724
  resize: "extension_shell_resize",
663
725
  /** Close a shell session */
@@ -665,6 +727,7 @@ var SHELL_COMMANDS = {
665
727
  };
666
728
 
667
729
  // src/commands/passwords.ts
730
+ init_cjs_shims();
668
731
  var PASSWORD_COMMANDS = {
669
732
  /** List items (no secrets) within the extension's tag scope */
670
733
  list: "extension_password_list",
@@ -679,6 +742,7 @@ var PASSWORD_COMMANDS = {
679
742
  };
680
743
 
681
744
  // src/commands/mail.ts
745
+ init_cjs_shims();
682
746
  var MAIL_COMMANDS = {
683
747
  /** LIST mailboxes + optional STATUS counts */
684
748
  listMailboxes: "extension_mail_list_mailboxes",
@@ -698,13 +762,14 @@ var MAIL_COMMANDS = {
698
762
  sendMessage: "extension_mail_send_message",
699
763
  /** Build RFC822 bytes without sending (for Drafts via APPEND) */
700
764
  buildRfc822: "extension_mail_build_rfc822",
701
- /** Start (or replace) a background poll watch for an account/mailbox */
765
+ /** Start (or replace) a background new-mail watch for an account/mailbox */
702
766
  startWatch: "extension_mail_start_watch",
703
- /** Stop a background poll watch */
767
+ /** Stop a background new-mail watch */
704
768
  stopWatch: "extension_mail_stop_watch"
705
769
  };
706
770
 
707
771
  // src/commands/notifications.ts
772
+ init_cjs_shims();
708
773
  var NOTIFICATION_COMMANDS = {
709
774
  /** Show an OS notification. Returns the assigned notification id. */
710
775
  show: "extension_notifications_show",
@@ -735,6 +800,7 @@ var StorageAPI = class {
735
800
  };
736
801
 
737
802
  // src/api/database.ts
803
+ init_cjs_shims();
738
804
  function quoteIdent(identifier) {
739
805
  if (identifier.startsWith('"') && identifier.endsWith('"')) {
740
806
  return identifier;
@@ -834,6 +900,7 @@ var DatabaseAPI = class {
834
900
  };
835
901
 
836
902
  // src/api/filesystem.ts
903
+ init_cjs_shims();
837
904
  init_vaultKey();
838
905
  var FilesystemAPI = class {
839
906
  constructor(client) {
@@ -1069,6 +1136,7 @@ var FilesystemAPI = class {
1069
1136
  };
1070
1137
 
1071
1138
  // src/api/web.ts
1139
+ init_cjs_shims();
1072
1140
  var WebAPI = class {
1073
1141
  constructor(client) {
1074
1142
  this.client = client;
@@ -1182,6 +1250,7 @@ var WebAPI = class {
1182
1250
  };
1183
1251
 
1184
1252
  // src/api/permissions.ts
1253
+ init_cjs_shims();
1185
1254
  var PermissionsAPI = class {
1186
1255
  constructor(client) {
1187
1256
  this.client = client;
@@ -1236,6 +1305,7 @@ var PermissionsAPI = class {
1236
1305
  };
1237
1306
 
1238
1307
  // src/api/remoteStorage.ts
1308
+ init_cjs_shims();
1239
1309
  init_vaultKey();
1240
1310
  var RemoteStorageAPI = class {
1241
1311
  constructor(client) {
@@ -1346,6 +1416,7 @@ var BackendManagement = class {
1346
1416
  };
1347
1417
 
1348
1418
  // src/api/localsend.ts
1419
+ init_cjs_shims();
1349
1420
  var LOCALSEND_EVENTS = {
1350
1421
  /** New device discovered */
1351
1422
  deviceDiscovered: "localsend:device-discovered",
@@ -1517,6 +1588,7 @@ var LocalSendAPI = class {
1517
1588
  };
1518
1589
 
1519
1590
  // src/api/spaces.ts
1591
+ init_cjs_shims();
1520
1592
  var SpacesAPI = class {
1521
1593
  constructor(client) {
1522
1594
  this.client = client;
@@ -1589,9 +1661,45 @@ var SpacesAPI = class {
1589
1661
  };
1590
1662
 
1591
1663
  // src/api/shell.ts
1664
+ init_cjs_shims();
1665
+ var NOT_SUPPORTED = 8e3;
1666
+ function isUnsupported(error) {
1667
+ if (error?.code === NOT_SUPPORTED) return true;
1668
+ return typeof error === "string" && /\bcommand (\S+ )?not found\b/i.test(error);
1669
+ }
1592
1670
  var ShellAPI = class {
1593
1671
  constructor(sdk) {
1594
1672
  this.sdk = sdk;
1673
+ /** `shell:output` events per session handed on but not yet acknowledged. */
1674
+ this.unacknowledged = /* @__PURE__ */ new Map();
1675
+ this.flushScheduled = false;
1676
+ /** The host does not know `extension_shell_ack` (it reads output without backpressure). */
1677
+ this.ackUnsupported = false;
1678
+ this.sdk.on(SHELL_EVENTS.OUTPUT, (event) => this.acknowledge(event));
1679
+ }
1680
+ /**
1681
+ * Backpressure: the host keeps reading a shell's output only while this frame has few
1682
+ * events open, so a shell that writes fast waits instead of flooding the page. The SDK
1683
+ * acknowledges every event once the listeners have had it, in one request per session and
1684
+ * task.
1685
+ */
1686
+ acknowledge(event) {
1687
+ const sessionId = event.data?.sessionId;
1688
+ if (this.ackUnsupported || typeof sessionId !== "string") return;
1689
+ this.unacknowledged.set(sessionId, (this.unacknowledged.get(sessionId) ?? 0) + 1);
1690
+ if (this.flushScheduled) return;
1691
+ this.flushScheduled = true;
1692
+ queueMicrotask(() => this.flushAcknowledgements());
1693
+ }
1694
+ flushAcknowledgements() {
1695
+ this.flushScheduled = false;
1696
+ const counts = [...this.unacknowledged];
1697
+ this.unacknowledged.clear();
1698
+ for (const [sessionId, count] of counts) {
1699
+ this.sdk.request(SHELL_COMMANDS.ack, { sessionId, count }).catch((error) => {
1700
+ if (isUnsupported(error)) this.ackUnsupported = true;
1701
+ });
1702
+ }
1595
1703
  }
1596
1704
  /**
1597
1705
  * List available shell environments on the host system.
@@ -1660,6 +1768,7 @@ var ShellAPI = class {
1660
1768
  };
1661
1769
 
1662
1770
  // src/api/passwords.ts
1771
+ init_cjs_shims();
1663
1772
  var PasswordsAPI = class {
1664
1773
  constructor(client) {
1665
1774
  this.client = client;
@@ -1705,6 +1814,7 @@ var PasswordsAPI = class {
1705
1814
  };
1706
1815
 
1707
1816
  // src/api/mail.ts
1817
+ init_cjs_shims();
1708
1818
  var MailAPI = class {
1709
1819
  constructor(client) {
1710
1820
  this.client = client;
@@ -1807,22 +1917,29 @@ var MailAPI = class {
1807
1917
  });
1808
1918
  }
1809
1919
  /**
1810
- * Start (or replace) a background poll watch for `accountId`/`mailboxName`.
1811
- * The host resolves credentials itself from `accountId` — no `ImapConfig`
1812
- * is passed in. Requires `mail` permission with action `poll` on the
1813
- * account's IMAP host (prompted on first call, same as `fetch`/`send`).
1920
+ * Start (or replace) a background watch for `accountId`/`mailboxName`.
1921
+ * Requires `mail` permission with action `poll` on the account's IMAP
1922
+ * host (`imap.host` when passed; prompted on first call, same as
1923
+ * `fetch`/`send`).
1924
+ *
1925
+ * Pass the account's `imap` config, as for every other mail call: the host
1926
+ * keeps the credentials in memory for as long as the watch runs and never
1927
+ * stores them. Hosts that wait with IMAP IDLE are told about new mail by the
1928
+ * server; `intervalSeconds` (clamped host-side to [30, 3600]) is the polling
1929
+ * interval for servers without IDLE. Listen for results via `onNewMessages`.
1814
1930
  *
1815
- * `intervalSeconds` is clamped host-side to [30, 3600]. Listen for
1816
- * results via `onNewMessages`.
1931
+ * `imap` is optional for hosts that resolve the credentials themselves from
1932
+ * `accountId`; holzi requires it.
1817
1933
  */
1818
- async startWatchingAsync(accountId, mailboxName, intervalSeconds) {
1934
+ async startWatchingAsync(accountId, mailboxName, intervalSeconds, imap) {
1819
1935
  return this.client.request(MAIL_COMMANDS.startWatch, {
1820
1936
  accountId,
1821
1937
  mailboxName,
1822
- intervalSeconds
1938
+ intervalSeconds,
1939
+ imap
1823
1940
  });
1824
1941
  }
1825
- /** Stop a background poll watch previously started with `startWatchingAsync`. */
1942
+ /** Stop a background watch previously started with `startWatchingAsync`. */
1826
1943
  async stopWatchingAsync(accountId, mailboxName) {
1827
1944
  return this.client.request(MAIL_COMMANDS.stopWatch, {
1828
1945
  accountId,
@@ -1844,6 +1961,7 @@ var MailAPI = class {
1844
1961
  };
1845
1962
 
1846
1963
  // src/api/notifications.ts
1964
+ init_cjs_shims();
1847
1965
  var NotificationsAPI = class {
1848
1966
  constructor(client) {
1849
1967
  this.client = client;
@@ -1875,7 +1993,36 @@ var NotificationsAPI = class {
1875
1993
  }
1876
1994
  };
1877
1995
 
1996
+ // src/api/tab.ts
1997
+ init_cjs_shims();
1998
+ var TabAPI = class {
1999
+ constructor(client) {
2000
+ this.client = client;
2001
+ }
2002
+ /**
2003
+ * Mark the tab as wanting the user's attention (`true`), e.g. for unread
2004
+ * content, or clear the mark (`false`).
2005
+ */
2006
+ async requestAttention(active) {
2007
+ await this.client.request(EXTENSION_COMMANDS.tabAttention, { active });
2008
+ }
2009
+ };
2010
+
2011
+ // src/api/dialog.ts
2012
+ init_cjs_shims();
2013
+ var DialogAPI = class {
2014
+ constructor(client) {
2015
+ this.client = client;
2016
+ }
2017
+ /** Asks the user; resolves `true` for confirm, `false` for cancel or when the dialog is closed. */
2018
+ async confirm(options) {
2019
+ const answer = await this.client.request(EXTENSION_COMMANDS.dialogConfirm, { ...options }, { timeout: null });
2020
+ return answer === true;
2021
+ }
2022
+ };
2023
+
1878
2024
  // src/client/tableName.ts
2025
+ init_cjs_shims();
1879
2026
  function validatePublicKey(publicKey) {
1880
2027
  if (!publicKey || typeof publicKey !== "string" || publicKey.trim() === "") {
1881
2028
  throw new HaexVaultSdkError(
@@ -1961,6 +2108,7 @@ function parseTableName(fullTableName) {
1961
2108
  }
1962
2109
 
1963
2110
  // src/client/init.ts
2111
+ init_cjs_shims();
1964
2112
  var PORT_HANDSHAKE_TIMEOUT_MS = 1e4;
1965
2113
  function getCurrentWebviewLabel() {
1966
2114
  const internals = window.__TAURI_INTERNALS__;
@@ -2109,6 +2257,10 @@ function waitForHostPortAsync(log) {
2109
2257
  const handler = (event) => {
2110
2258
  const type = event.data?.type;
2111
2259
  if (type !== HAEXSPACE_MESSAGE_TYPES.PORT_INIT) return;
2260
+ if (event.source !== window.parent) {
2261
+ log("PORT_INIT from a window other than the parent \u2014 ignoring");
2262
+ return;
2263
+ }
2112
2264
  const port = event.ports[0];
2113
2265
  if (!port) {
2114
2266
  log("PORT_INIT received but event.ports is empty \u2014 ignoring");
@@ -2142,10 +2294,11 @@ postMessage error: ${e}`);
2142
2294
  }
2143
2295
 
2144
2296
  // src/client/transport.ts
2297
+ init_cjs_shims();
2145
2298
  function generateRequestId(counter) {
2146
2299
  return `req_${counter}`;
2147
2300
  }
2148
- function sendPostMessage(method, params, requestId, config, extensionInfo, pendingRequests, port) {
2301
+ function sendPostMessage(method, params, requestId, config, extensionInfo, pendingRequests, port, timeoutMs = config.timeout) {
2149
2302
  if (!port) {
2150
2303
  return Promise.reject(
2151
2304
  new HaexVaultSdkError(
@@ -2160,14 +2313,14 @@ function sendPostMessage(method, params, requestId, config, extensionInfo, pendi
2160
2313
  timestamp: Date.now()
2161
2314
  };
2162
2315
  return new Promise((resolve, reject) => {
2163
- const timeout = setTimeout(() => {
2316
+ const timeout = timeoutMs === null ? void 0 : setTimeout(() => {
2164
2317
  pendingRequests.delete(requestId);
2165
2318
  reject(
2166
2319
  new HaexVaultSdkError("TIMEOUT" /* TIMEOUT */, "errors.timeout", {
2167
- timeout: config.timeout
2320
+ timeout: timeoutMs
2168
2321
  })
2169
2322
  );
2170
- }, config.timeout);
2323
+ }, timeoutMs);
2171
2324
  pendingRequests.set(requestId, { resolve, reject, timeout });
2172
2325
  if (config.debug) {
2173
2326
  console.log("[SDK Debug] ========== Sending Request ==========");
@@ -2193,6 +2346,7 @@ async function sendInvoke(method, params, config, _log) {
2193
2346
  }
2194
2347
 
2195
2348
  // src/client/events.ts
2349
+ init_cjs_shims();
2196
2350
  function createMessageHandler(config, pendingRequests, extensionInfo, onEvent) {
2197
2351
  return (event) => {
2198
2352
  if (config.debug) {
@@ -2292,6 +2446,9 @@ function removeEventListener(eventType, callback, eventListeners) {
2292
2446
  function notifySubscribers(subscribers) {
2293
2447
  subscribers.forEach((callback) => callback());
2294
2448
  }
2449
+
2450
+ // src/client/database.ts
2451
+ init_cjs_shims();
2295
2452
  function createDrizzleInstance(schema, extensionInfo, request, log) {
2296
2453
  if (!extensionInfo) {
2297
2454
  throw new HaexVaultSdkError(
@@ -2360,6 +2517,7 @@ async function executeRaw(sql, params, request) {
2360
2517
  }
2361
2518
 
2362
2519
  // src/client/external.ts
2520
+ init_cjs_shims();
2363
2521
  function registerExternalHandler(action, handler, handlers, log) {
2364
2522
  handlers.set(action, handler);
2365
2523
  log(`[ExternalRequest] Registered handler for action: ${action}`);
@@ -2401,12 +2559,14 @@ async function respondToExternalRequest(response, request) {
2401
2559
  }
2402
2560
 
2403
2561
  // src/commands/ai.ts
2562
+ init_cjs_shims();
2404
2563
  var AI_COMMANDS = {
2405
2564
  /** Respond to an AI action request */
2406
2565
  actionRespond: "ai_action_respond"
2407
2566
  };
2408
2567
 
2409
2568
  // src/client/permissionRetry.ts
2569
+ init_cjs_shims();
2410
2570
  var PERMISSION_DECISION_TIMEOUT_MS = 5 * 60 * 1e3;
2411
2571
  var MAX_PERMISSION_RETRIES = 3;
2412
2572
  function permissionKey(resourceType, action, target) {
@@ -2520,6 +2680,8 @@ var HaexVaultSdk = class {
2520
2680
  this.passwords = new PasswordsAPI(this);
2521
2681
  this.mail = new MailAPI(this);
2522
2682
  this.notifications = new NotificationsAPI(this);
2683
+ this.tab = new TabAPI(this);
2684
+ this.dialog = new DialogAPI(this);
2523
2685
  installConsoleForwarding(this.config.debug);
2524
2686
  this.on(HAEXTENSION_EVENTS.PERMISSION_RESOLVED, (event) => {
2525
2687
  const data = event.data;
@@ -2675,7 +2837,7 @@ var HaexVaultSdk = class {
2675
2837
  // ==========================================================================
2676
2838
  // Communication
2677
2839
  // ==========================================================================
2678
- async request(method, params) {
2840
+ async request(method, params, options) {
2679
2841
  const resolvedParams = params ?? {};
2680
2842
  const send = () => {
2681
2843
  if (this.isNativeWindow && hasTauri()) {
@@ -2694,7 +2856,8 @@ var HaexVaultSdk = class {
2694
2856
  this.config,
2695
2857
  this._extensionInfo,
2696
2858
  this.pendingRequests,
2697
- this.hostPort
2859
+ this.hostPort,
2860
+ options?.timeout
2698
2861
  );
2699
2862
  };
2700
2863
  return withPermissionRetry(send, this.permissionWaiters, this.log.bind(this));
@@ -2871,26 +3034,37 @@ var HaexVaultSdk = class {
2871
3034
  }
2872
3035
  };
2873
3036
 
3037
+ // src/types/external.ts
3038
+ init_cjs_shims();
3039
+
3040
+ // src/types/spaces.ts
3041
+ init_cjs_shims();
3042
+
2874
3043
  // src/index.ts
2875
3044
  init_vaultKey();
2876
3045
  init_userKeypair();
2877
3046
 
2878
3047
  // src/crypto/didKey.ts
3048
+ init_cjs_shims();
2879
3049
  init_userKeypair();
2880
3050
  init_vaultKey();
2881
3051
 
2882
3052
  // src/crypto/spaceKey.ts
3053
+ init_cjs_shims();
2883
3054
  init_userKeypair();
2884
3055
  init_vaultKey();
2885
3056
 
2886
3057
  // src/crypto/claims.ts
3058
+ init_cjs_shims();
2887
3059
  init_userKeypair();
2888
3060
 
2889
3061
  // src/crypto/recordSigning.ts
3062
+ init_cjs_shims();
2890
3063
  init_userKeypair();
2891
3064
  init_vaultKey();
2892
3065
 
2893
3066
  // src/crypto/passkey.ts
3067
+ init_cjs_shims();
2894
3068
  init_vaultKey();
2895
3069
 
2896
3070
  // src/index.ts