@haex-space/vault-sdk 3.6.0 → 4.0.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-DnCZ3KyI.d.mts → client-C6pEREPM.d.ts} +63 -3
  7. package/dist/{client-uuhuCPDu.d.ts → client-GdCi-m2s.d.mts} +63 -3
  8. package/dist/haex_bundle_bg.wasm +0 -0
  9. package/dist/index.d.mts +14 -59
  10. package/dist/index.d.ts +14 -59
  11. package/dist/index.js +139 -105
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +158 -123
  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 +146 -7
  28. package/dist/react.js.map +1 -1
  29. package/dist/react.mjs +166 -27
  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 +54 -7
  34. package/dist/runtime/nuxt.plugin.client.js.map +1 -1
  35. package/dist/runtime/nuxt.plugin.client.mjs +54 -7
  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 +146 -7
  40. package/dist/svelte.js.map +1 -1
  41. package/dist/svelte.mjs +166 -27
  42. package/dist/svelte.mjs.map +1 -1
  43. package/dist/{types-DQZCRfC-.d.mts → types-Ba4G6ZpC.d.mts} +10 -2
  44. package/dist/{types-DQZCRfC-.d.ts → types-Ba4G6ZpC.d.ts} +10 -2
  45. package/dist/vue.d.mts +2 -2
  46. package/dist/vue.d.ts +2 -2
  47. package/dist/vue.js +146 -7
  48. package/dist/vue.js.map +1 -1
  49. package/dist/vue.mjs +166 -27
  50. package/dist/vue.mjs.map +1 -1
  51. package/package.json +8 -6
package/dist/index.mjs CHANGED
@@ -1,3 +1,5 @@
1
+ import 'path';
2
+ import 'url';
1
3
  import { drizzle } from 'drizzle-orm/sqlite-proxy';
2
4
 
3
5
  var __defProp = Object.defineProperty;
@@ -9,6 +11,10 @@ var __export = (target, all) => {
9
11
  for (var name in all)
10
12
  __defProp(target, name, { get: all[name], enumerable: true });
11
13
  };
14
+ var init_esm_shims = __esm({
15
+ "node_modules/.pnpm/tsup@8.5.1_jiti@2.7.0_postcss@8.5.28_typescript@6.0.3_yaml@2.9.0/node_modules/tsup/assets/esm_shims.js"() {
16
+ }
17
+ });
12
18
 
13
19
  // src/crypto/vaultKey.ts
14
20
  async function deriveKeyFromPassword(password, salt) {
@@ -227,6 +233,7 @@ function base64ToArrayBuffer(base64) {
227
233
  var PBKDF2_ITERATIONS, KEY_LENGTH, ALGORITHM;
228
234
  var init_vaultKey = __esm({
229
235
  "src/crypto/vaultKey.ts"() {
236
+ init_esm_shims();
230
237
  PBKDF2_ITERATIONS = 6e5;
231
238
  KEY_LENGTH = 256;
232
239
  ALGORITHM = "AES-GCM";
@@ -310,13 +317,21 @@ async function decryptPrivateKeyAsync(encryptedPrivateKey, nonce, salt, password
310
317
  var SIGNING_ALGO, KEY_AGREEMENT_ALGO;
311
318
  var init_userKeypair = __esm({
312
319
  "src/crypto/userKeypair.ts"() {
320
+ init_esm_shims();
313
321
  init_vaultKey();
314
322
  SIGNING_ALGO = { name: "Ed25519" };
315
323
  KEY_AGREEMENT_ALGO = { name: "X25519" };
316
324
  }
317
325
  });
318
326
 
327
+ // src/index.ts
328
+ init_esm_shims();
329
+
330
+ // src/polyfills/index.ts
331
+ init_esm_shims();
332
+
319
333
  // src/polyfills/localStorage.ts
334
+ init_esm_shims();
320
335
  function installLocalStoragePolyfill() {
321
336
  if (typeof window === "undefined") {
322
337
  return;
@@ -411,6 +426,7 @@ function installSessionStoragePolyfill() {
411
426
  }
412
427
 
413
428
  // src/polyfills/cookies.ts
429
+ init_esm_shims();
414
430
  function installCookiePolyfill() {
415
431
  if (typeof window === "undefined" || typeof document === "undefined") {
416
432
  return;
@@ -471,6 +487,7 @@ function installCookiePolyfill() {
471
487
  }
472
488
 
473
489
  // src/polyfills/history.ts
490
+ init_esm_shims();
474
491
  function installHistoryPolyfill() {
475
492
  if (typeof window === "undefined" || typeof history === "undefined") {
476
493
  return;
@@ -534,7 +551,11 @@ function installHistoryPolyfill() {
534
551
  }
535
552
  }
536
553
 
554
+ // src/polyfills/debug.ts
555
+ init_esm_shims();
556
+
537
557
  // src/messages.ts
558
+ init_esm_shims();
538
559
  var HAEXSPACE_MESSAGE_TYPES = {
539
560
  /** Debug message for development/troubleshooting */
540
561
  DEBUG: "haexspace:debug",
@@ -579,6 +600,7 @@ function installDebugDiagnostics() {
579
600
  }
580
601
 
581
602
  // src/polyfills/baseTag.ts
603
+ init_esm_shims();
582
604
  function installBaseTag() {
583
605
  if (typeof window === "undefined" || typeof document === "undefined") {
584
606
  return;
@@ -620,6 +642,7 @@ function installBaseTag() {
620
642
  }
621
643
 
622
644
  // src/polyfills/consoleForwarding.ts
645
+ init_esm_shims();
623
646
  var originalConsole = {
624
647
  log: console.log,
625
648
  info: console.info,
@@ -700,7 +723,14 @@ if (typeof window !== "undefined") {
700
723
  installPolyfills();
701
724
  }
702
725
 
726
+ // src/client.ts
727
+ init_esm_shims();
728
+
729
+ // src/types.ts
730
+ init_esm_shims();
731
+
703
732
  // src/events.ts
733
+ init_esm_shims();
704
734
  var HAEXTENSION_EVENTS = {
705
735
  /** Context (theme, locale, platform) has changed */
706
736
  CONTEXT_CHANGED: "haextension:context:changed",
@@ -815,7 +845,17 @@ var HaexVaultSdkError = class extends Error {
815
845
  }
816
846
  };
817
847
 
848
+ // src/api/storage.ts
849
+ init_esm_shims();
850
+
851
+ // src/commands.ts
852
+ init_esm_shims();
853
+
854
+ // src/commands/index.ts
855
+ init_esm_shims();
856
+
818
857
  // src/commands/database.ts
858
+ init_esm_shims();
819
859
  var DATABASE_COMMANDS = {
820
860
  /** Execute a SELECT query */
821
861
  query: "extension_database_query",
@@ -828,6 +868,7 @@ var DATABASE_COMMANDS = {
828
868
  };
829
869
 
830
870
  // src/commands/permissions.ts
871
+ init_esm_shims();
831
872
  var PERMISSIONS_COMMANDS = {
832
873
  /** Check web/fetch permission */
833
874
  checkWeb: "extension_permissions_check_web",
@@ -838,6 +879,7 @@ var PERMISSIONS_COMMANDS = {
838
879
  };
839
880
 
840
881
  // src/commands/web.ts
882
+ init_esm_shims();
841
883
  var WEB_COMMANDS = {
842
884
  /** Open URL in external browser */
843
885
  open: "extension_web_open",
@@ -846,6 +888,7 @@ var WEB_COMMANDS = {
846
888
  };
847
889
 
848
890
  // src/commands/webStorage.ts
891
+ init_esm_shims();
849
892
  var WEB_STORAGE_COMMANDS = {
850
893
  /** Get item from storage */
851
894
  getItem: "extension_web_storage_get_item",
@@ -860,6 +903,7 @@ var WEB_STORAGE_COMMANDS = {
860
903
  };
861
904
 
862
905
  // src/commands/filesystem.ts
906
+ init_esm_shims();
863
907
  var FILESYSTEM_COMMANDS = {
864
908
  // Dialog commands
865
909
  /** Show save file dialog */
@@ -903,6 +947,7 @@ var FILESYSTEM_COMMANDS = {
903
947
  };
904
948
 
905
949
  // src/commands/externalBridge.ts
950
+ init_esm_shims();
906
951
  var EXTERNAL_BRIDGE_COMMANDS = {
907
952
  // Response handling (called by extensions)
908
953
  /** Respond to an external request */
@@ -942,6 +987,7 @@ var EXTERNAL_BRIDGE_COMMANDS = {
942
987
  };
943
988
 
944
989
  // src/commands/extension.ts
990
+ init_esm_shims();
945
991
  var EXTENSION_COMMANDS = {
946
992
  /** Get extension info (manifest, id, etc.) */
947
993
  getInfo: "extension_get_info",
@@ -956,10 +1002,15 @@ var EXTENSION_COMMANDS = {
956
1002
  /** Filter sync tables by extension permissions (returns filtered map) */
957
1003
  filterSyncTables: "extension_filter_sync_tables",
958
1004
  /** Emit sync tables to webviews (host-only, desktop only) */
959
- emitSyncTables: "extension_emit_sync_tables"
1005
+ emitSyncTables: "extension_emit_sync_tables",
1006
+ /** Ask the host to mark (or unmark) this extension's own tab as wanting attention */
1007
+ tabAttention: "extension_tab_attention",
1008
+ /** Ask the user to confirm, in a dialog the host draws over this extension's tab */
1009
+ dialogConfirm: "extension_dialog_confirm"
960
1010
  };
961
1011
 
962
1012
  // src/commands/remoteStorage.ts
1013
+ init_esm_shims();
963
1014
  var REMOTE_STORAGE_COMMANDS = {
964
1015
  // Backend Management
965
1016
  /** List all storage backends */
@@ -984,6 +1035,7 @@ var REMOTE_STORAGE_COMMANDS = {
984
1035
  };
985
1036
 
986
1037
  // src/commands/localsend.ts
1038
+ init_esm_shims();
987
1039
  var LOCALSEND_COMMANDS = {
988
1040
  // Initialization
989
1041
  /** Initialize LocalSend (generate identity, etc.) */
@@ -1030,6 +1082,7 @@ var LOCALSEND_COMMANDS = {
1030
1082
  };
1031
1083
 
1032
1084
  // src/commands/spaces.ts
1085
+ init_esm_shims();
1033
1086
  var SPACE_COMMANDS = {
1034
1087
  /** Bulk assign rows to spaces */
1035
1088
  assign: "extension_space_assign",
@@ -1037,6 +1090,8 @@ var SPACE_COMMANDS = {
1037
1090
  unassign: "extension_space_unassign",
1038
1091
  /** Get space assignments for a table */
1039
1092
  getAssignments: "extension_space_get_assignments",
1093
+ /** Get members of a shared space */
1094
+ getMembers: "extension_space_get_members",
1040
1095
  /** List all spaces the user is a member of (with decrypted names) */
1041
1096
  list: "extension_space_list",
1042
1097
  /** Create a new shared space */
@@ -1046,6 +1101,7 @@ var SPACE_COMMANDS = {
1046
1101
  };
1047
1102
 
1048
1103
  // src/commands/shell.ts
1104
+ init_esm_shims();
1049
1105
  var SHELL_COMMANDS = {
1050
1106
  /** List available shell environments (no permission required) */
1051
1107
  listAvailable: "extension_shell_list_available",
@@ -1060,6 +1116,7 @@ var SHELL_COMMANDS = {
1060
1116
  };
1061
1117
 
1062
1118
  // src/commands/passwords.ts
1119
+ init_esm_shims();
1063
1120
  var PASSWORD_COMMANDS = {
1064
1121
  /** List items (no secrets) within the extension's tag scope */
1065
1122
  list: "extension_password_list",
@@ -1074,6 +1131,7 @@ var PASSWORD_COMMANDS = {
1074
1131
  };
1075
1132
 
1076
1133
  // src/commands/mail.ts
1134
+ init_esm_shims();
1077
1135
  var MAIL_COMMANDS = {
1078
1136
  /** LIST mailboxes + optional STATUS counts */
1079
1137
  listMailboxes: "extension_mail_list_mailboxes",
@@ -1100,6 +1158,7 @@ var MAIL_COMMANDS = {
1100
1158
  };
1101
1159
 
1102
1160
  // src/commands/notifications.ts
1161
+ init_esm_shims();
1103
1162
  var NOTIFICATION_COMMANDS = {
1104
1163
  /** Show an OS notification. Returns the assigned notification id. */
1105
1164
  show: "extension_notifications_show",
@@ -1148,6 +1207,7 @@ var StorageAPI = class {
1148
1207
  };
1149
1208
 
1150
1209
  // src/api/database.ts
1210
+ init_esm_shims();
1151
1211
  function quoteIdent(identifier) {
1152
1212
  if (identifier.startsWith('"') && identifier.endsWith('"')) {
1153
1213
  return identifier;
@@ -1247,6 +1307,7 @@ var DatabaseAPI = class {
1247
1307
  };
1248
1308
 
1249
1309
  // src/api/filesystem.ts
1310
+ init_esm_shims();
1250
1311
  init_vaultKey();
1251
1312
  var KnownPath = /* @__PURE__ */ ((KnownPath2) => {
1252
1313
  KnownPath2["Home"] = "home";
@@ -1322,10 +1383,10 @@ var FilesystemAPI = class {
1322
1383
  * @param path Absolute path to the file
1323
1384
  * @returns File contents as Uint8Array
1324
1385
  */
1325
- async readFile(path) {
1386
+ async readFile(path2) {
1326
1387
  const base64 = await this.client.request(
1327
1388
  FILESYSTEM_COMMANDS.readFile,
1328
- { path }
1389
+ { path: path2 }
1329
1390
  );
1330
1391
  return base64ToArrayBuffer(base64);
1331
1392
  }
@@ -1334,11 +1395,11 @@ var FilesystemAPI = class {
1334
1395
  * @param path Absolute path to the file
1335
1396
  * @param data File contents as Uint8Array
1336
1397
  */
1337
- async writeFile(path, data) {
1398
+ async writeFile(path2, data) {
1338
1399
  const base64 = arrayBufferToBase64(data);
1339
1400
  await this.client.request(
1340
1401
  FILESYSTEM_COMMANDS.writeFile,
1341
- { path, data: base64 }
1402
+ { path: path2, data: base64 }
1342
1403
  );
1343
1404
  }
1344
1405
  /**
@@ -1346,20 +1407,20 @@ var FilesystemAPI = class {
1346
1407
  * @param path Absolute path to the directory
1347
1408
  * @returns Array of directory entries
1348
1409
  */
1349
- async readDir(path) {
1410
+ async readDir(path2) {
1350
1411
  return this.client.request(
1351
1412
  FILESYSTEM_COMMANDS.readDir,
1352
- { path }
1413
+ { path: path2 }
1353
1414
  );
1354
1415
  }
1355
1416
  /**
1356
1417
  * Create a directory (and parent directories if needed)
1357
1418
  * @param path Absolute path to create
1358
1419
  */
1359
- async mkdir(path) {
1420
+ async mkdir(path2) {
1360
1421
  await this.client.request(
1361
1422
  FILESYSTEM_COMMANDS.mkdir,
1362
- { path }
1423
+ { path: path2 }
1363
1424
  );
1364
1425
  }
1365
1426
  /**
@@ -1367,10 +1428,10 @@ var FilesystemAPI = class {
1367
1428
  * @param path Absolute path to remove
1368
1429
  * @param recursive If true, remove directories recursively
1369
1430
  */
1370
- async remove(path, recursive = false) {
1431
+ async remove(path2, recursive = false) {
1371
1432
  await this.client.request(
1372
1433
  FILESYSTEM_COMMANDS.remove,
1373
- { path, recursive }
1434
+ { path: path2, recursive }
1374
1435
  );
1375
1436
  }
1376
1437
  /**
@@ -1378,10 +1439,10 @@ var FilesystemAPI = class {
1378
1439
  * @param path Absolute path to check
1379
1440
  * @returns True if the path exists
1380
1441
  */
1381
- async exists(path) {
1442
+ async exists(path2) {
1382
1443
  return this.client.request(
1383
1444
  FILESYSTEM_COMMANDS.exists,
1384
- { path }
1445
+ { path: path2 }
1385
1446
  );
1386
1447
  }
1387
1448
  /**
@@ -1389,10 +1450,10 @@ var FilesystemAPI = class {
1389
1450
  * @param path Absolute path
1390
1451
  * @returns File metadata
1391
1452
  */
1392
- async stat(path) {
1453
+ async stat(path2) {
1393
1454
  return this.client.request(
1394
1455
  FILESYSTEM_COMMANDS.stat,
1395
- { path }
1456
+ { path: path2 }
1396
1457
  );
1397
1458
  }
1398
1459
  /**
@@ -1461,10 +1522,10 @@ var FilesystemAPI = class {
1461
1522
  * @param ruleId Unique identifier for this watch (e.g., sync rule ID)
1462
1523
  * @param path Absolute path to the directory to watch
1463
1524
  */
1464
- async watch(ruleId, path) {
1525
+ async watch(ruleId, path2) {
1465
1526
  await this.client.request(
1466
1527
  FILESYSTEM_COMMANDS.watch,
1467
- { ruleId, path }
1528
+ { ruleId, path: path2 }
1468
1529
  );
1469
1530
  }
1470
1531
  /**
@@ -1491,6 +1552,7 @@ var FilesystemAPI = class {
1491
1552
  };
1492
1553
 
1493
1554
  // src/api/web.ts
1555
+ init_esm_shims();
1494
1556
  var WebAPI = class {
1495
1557
  constructor(client) {
1496
1558
  this.client = client;
@@ -1604,6 +1666,7 @@ var WebAPI = class {
1604
1666
  };
1605
1667
 
1606
1668
  // src/api/permissions.ts
1669
+ init_esm_shims();
1607
1670
  var PermissionsAPI = class {
1608
1671
  constructor(client) {
1609
1672
  this.client = client;
@@ -1645,11 +1708,11 @@ var PermissionsAPI = class {
1645
1708
  * @param operation The operation type ("read" or "write")
1646
1709
  * @returns Promise<boolean> indicating if permission is granted
1647
1710
  */
1648
- async checkFilesystemAsync(path, operation) {
1711
+ async checkFilesystemAsync(path2, operation) {
1649
1712
  const response = await this.client.request(
1650
1713
  PERMISSIONS_COMMANDS.checkFilesystem,
1651
1714
  {
1652
- path,
1715
+ path: path2,
1653
1716
  operation
1654
1717
  }
1655
1718
  );
@@ -1658,6 +1721,7 @@ var PermissionsAPI = class {
1658
1721
  };
1659
1722
 
1660
1723
  // src/api/remoteStorage.ts
1724
+ init_esm_shims();
1661
1725
  init_vaultKey();
1662
1726
  var RemoteStorageAPI = class {
1663
1727
  constructor(client) {
@@ -1768,6 +1832,7 @@ var BackendManagement = class {
1768
1832
  };
1769
1833
 
1770
1834
  // src/api/localsend.ts
1835
+ init_esm_shims();
1771
1836
  var LOCALSEND_EVENTS = {
1772
1837
  /** New device discovered */
1773
1838
  deviceDiscovered: "localsend:device-discovered",
@@ -1939,6 +2004,7 @@ var LocalSendAPI = class {
1939
2004
  };
1940
2005
 
1941
2006
  // src/api/spaces.ts
2007
+ init_esm_shims();
1942
2008
  var SpacesAPI = class {
1943
2009
  constructor(client) {
1944
2010
  this.client = client;
@@ -2001,9 +2067,17 @@ var SpacesAPI = class {
2001
2067
  async listSpacesAsync() {
2002
2068
  return this.client.request(SPACE_COMMANDS.list);
2003
2069
  }
2070
+ /**
2071
+ * List members of a shared space (DID + label), flagging the current user.
2072
+ * Used to resolve assignment authors to names and to detect own vs shared-in content.
2073
+ */
2074
+ async getMembersAsync(spaceId) {
2075
+ return this.client.request(SPACE_COMMANDS.getMembers, { spaceId });
2076
+ }
2004
2077
  };
2005
2078
 
2006
2079
  // src/api/shell.ts
2080
+ init_esm_shims();
2007
2081
  var ShellAPI = class {
2008
2082
  constructor(sdk) {
2009
2083
  this.sdk = sdk;
@@ -2075,6 +2149,7 @@ var ShellAPI = class {
2075
2149
  };
2076
2150
 
2077
2151
  // src/api/passwords.ts
2152
+ init_esm_shims();
2078
2153
  var PasswordsAPI = class {
2079
2154
  constructor(client) {
2080
2155
  this.client = client;
@@ -2120,6 +2195,7 @@ var PasswordsAPI = class {
2120
2195
  };
2121
2196
 
2122
2197
  // src/api/mail.ts
2198
+ init_esm_shims();
2123
2199
  var MailAPI = class {
2124
2200
  constructor(client) {
2125
2201
  this.client = client;
@@ -2259,6 +2335,7 @@ var MailAPI = class {
2259
2335
  };
2260
2336
 
2261
2337
  // src/api/notifications.ts
2338
+ init_esm_shims();
2262
2339
  var NotificationsAPI = class {
2263
2340
  constructor(client) {
2264
2341
  this.client = client;
@@ -2290,7 +2367,36 @@ var NotificationsAPI = class {
2290
2367
  }
2291
2368
  };
2292
2369
 
2370
+ // src/api/tab.ts
2371
+ init_esm_shims();
2372
+ var TabAPI = class {
2373
+ constructor(client) {
2374
+ this.client = client;
2375
+ }
2376
+ /**
2377
+ * Mark the tab as wanting the user's attention (`true`), e.g. for unread
2378
+ * content, or clear the mark (`false`).
2379
+ */
2380
+ async requestAttention(active) {
2381
+ await this.client.request(EXTENSION_COMMANDS.tabAttention, { active });
2382
+ }
2383
+ };
2384
+
2385
+ // src/api/dialog.ts
2386
+ init_esm_shims();
2387
+ var DialogAPI = class {
2388
+ constructor(client) {
2389
+ this.client = client;
2390
+ }
2391
+ /** Asks the user; resolves `true` for confirm, `false` for cancel or when the dialog is closed. */
2392
+ async confirm(options) {
2393
+ const answer = await this.client.request(EXTENSION_COMMANDS.dialogConfirm, { ...options }, { timeout: null });
2394
+ return answer === true;
2395
+ }
2396
+ };
2397
+
2293
2398
  // src/client/tableName.ts
2399
+ init_esm_shims();
2294
2400
  function validatePublicKey(publicKey) {
2295
2401
  if (!publicKey || typeof publicKey !== "string" || publicKey.trim() === "") {
2296
2402
  throw new HaexVaultSdkError(
@@ -2376,6 +2482,7 @@ function parseTableName(fullTableName) {
2376
2482
  }
2377
2483
 
2378
2484
  // src/client/init.ts
2485
+ init_esm_shims();
2379
2486
  var PORT_HANDSHAKE_TIMEOUT_MS = 1e4;
2380
2487
  function getCurrentWebviewLabel() {
2381
2488
  const internals = window.__TAURI_INTERNALS__;
@@ -2467,8 +2574,8 @@ async function setupTauriEventListeners(ctx, log, onEvent, onContextChange) {
2467
2574
  data: { tables: payload.tables }
2468
2575
  }));
2469
2576
  await forwardEvent(listen, log, onEvent, listenOptions, HAEXTENSION_EVENTS.FILE_CHANGED, (payload) => {
2470
- const { ruleId, changeType, path } = payload;
2471
- return { ruleId, changeType, path };
2577
+ const { ruleId, changeType, path: path2 } = payload;
2578
+ return { ruleId, changeType, path: path2 };
2472
2579
  });
2473
2580
  await forwardEvent(listen, log, onEvent, listenOptions, SHELL_EVENTS.OUTPUT, (payload) => {
2474
2581
  const { sessionId, data } = payload;
@@ -2524,6 +2631,10 @@ function waitForHostPortAsync(log) {
2524
2631
  const handler = (event) => {
2525
2632
  const type = event.data?.type;
2526
2633
  if (type !== HAEXSPACE_MESSAGE_TYPES.PORT_INIT) return;
2634
+ if (event.source !== window.parent) {
2635
+ log("PORT_INIT from a window other than the parent \u2014 ignoring");
2636
+ return;
2637
+ }
2527
2638
  const port = event.ports[0];
2528
2639
  if (!port) {
2529
2640
  log("PORT_INIT received but event.ports is empty \u2014 ignoring");
@@ -2557,10 +2668,11 @@ postMessage error: ${e}`);
2557
2668
  }
2558
2669
 
2559
2670
  // src/client/transport.ts
2671
+ init_esm_shims();
2560
2672
  function generateRequestId(counter) {
2561
2673
  return `req_${counter}`;
2562
2674
  }
2563
- function sendPostMessage(method, params, requestId, config, extensionInfo, pendingRequests, port) {
2675
+ function sendPostMessage(method, params, requestId, config, extensionInfo, pendingRequests, port, timeoutMs = config.timeout) {
2564
2676
  if (!port) {
2565
2677
  return Promise.reject(
2566
2678
  new HaexVaultSdkError(
@@ -2575,14 +2687,14 @@ function sendPostMessage(method, params, requestId, config, extensionInfo, pendi
2575
2687
  timestamp: Date.now()
2576
2688
  };
2577
2689
  return new Promise((resolve, reject) => {
2578
- const timeout = setTimeout(() => {
2690
+ const timeout = timeoutMs === null ? void 0 : setTimeout(() => {
2579
2691
  pendingRequests.delete(requestId);
2580
2692
  reject(
2581
2693
  new HaexVaultSdkError("TIMEOUT" /* TIMEOUT */, "errors.timeout", {
2582
- timeout: config.timeout
2694
+ timeout: timeoutMs
2583
2695
  })
2584
2696
  );
2585
- }, config.timeout);
2697
+ }, timeoutMs);
2586
2698
  pendingRequests.set(requestId, { resolve, reject, timeout });
2587
2699
  if (config.debug) {
2588
2700
  console.log("[SDK Debug] ========== Sending Request ==========");
@@ -2608,6 +2720,7 @@ async function sendInvoke(method, params, config, _log) {
2608
2720
  }
2609
2721
 
2610
2722
  // src/client/events.ts
2723
+ init_esm_shims();
2611
2724
  function createMessageHandler(config, pendingRequests, extensionInfo, onEvent) {
2612
2725
  return (event) => {
2613
2726
  if (config.debug) {
@@ -2707,6 +2820,9 @@ function removeEventListener(eventType, callback, eventListeners) {
2707
2820
  function notifySubscribers(subscribers) {
2708
2821
  subscribers.forEach((callback) => callback());
2709
2822
  }
2823
+
2824
+ // src/client/database.ts
2825
+ init_esm_shims();
2710
2826
  function createDrizzleInstance(schema, extensionInfo, request, log) {
2711
2827
  if (!extensionInfo) {
2712
2828
  throw new HaexVaultSdkError(
@@ -2775,6 +2891,7 @@ async function executeRaw(sql, params, request) {
2775
2891
  }
2776
2892
 
2777
2893
  // src/client/external.ts
2894
+ init_esm_shims();
2778
2895
  function registerExternalHandler(action, handler, handlers, log) {
2779
2896
  handlers.set(action, handler);
2780
2897
  log(`[ExternalRequest] Registered handler for action: ${action}`);
@@ -2816,12 +2933,14 @@ async function respondToExternalRequest(response, request) {
2816
2933
  }
2817
2934
 
2818
2935
  // src/commands/ai.ts
2936
+ init_esm_shims();
2819
2937
  var AI_COMMANDS = {
2820
2938
  /** Respond to an AI action request */
2821
2939
  actionRespond: "ai_action_respond"
2822
2940
  };
2823
2941
 
2824
2942
  // src/client/permissionRetry.ts
2943
+ init_esm_shims();
2825
2944
  var PERMISSION_DECISION_TIMEOUT_MS = 5 * 60 * 1e3;
2826
2945
  var MAX_PERMISSION_RETRIES = 3;
2827
2946
  function permissionKey(resourceType, action, target) {
@@ -2935,6 +3054,8 @@ var HaexVaultSdk = class {
2935
3054
  this.passwords = new PasswordsAPI(this);
2936
3055
  this.mail = new MailAPI(this);
2937
3056
  this.notifications = new NotificationsAPI(this);
3057
+ this.tab = new TabAPI(this);
3058
+ this.dialog = new DialogAPI(this);
2938
3059
  installConsoleForwarding(this.config.debug);
2939
3060
  this.on(HAEXTENSION_EVENTS.PERMISSION_RESOLVED, (event) => {
2940
3061
  const data = event.data;
@@ -3090,7 +3211,7 @@ var HaexVaultSdk = class {
3090
3211
  // ==========================================================================
3091
3212
  // Communication
3092
3213
  // ==========================================================================
3093
- async request(method, params) {
3214
+ async request(method, params, options) {
3094
3215
  const resolvedParams = params ?? {};
3095
3216
  const send = () => {
3096
3217
  if (this.isNativeWindow && hasTauri()) {
@@ -3109,7 +3230,8 @@ var HaexVaultSdk = class {
3109
3230
  this.config,
3110
3231
  this._extensionInfo,
3111
3232
  this.pendingRequests,
3112
- this.hostPort
3233
+ this.hostPort,
3234
+ options?.timeout
3113
3235
  );
3114
3236
  };
3115
3237
  return withPermissionRetry(send, this.permissionWaiters, this.log.bind(this));
@@ -3287,6 +3409,7 @@ var HaexVaultSdk = class {
3287
3409
  };
3288
3410
 
3289
3411
  // src/types/external.ts
3412
+ init_esm_shims();
3290
3413
  var ExternalConnectionState = /* @__PURE__ */ ((ExternalConnectionState2) => {
3291
3414
  ExternalConnectionState2["DISCONNECTED"] = "disconnected";
3292
3415
  ExternalConnectionState2["CONNECTING"] = "connecting";
@@ -3314,107 +3437,15 @@ function canExternalClientSendRequests(state) {
3314
3437
  return state === "paired" /* PAIRED */;
3315
3438
  }
3316
3439
 
3317
- // src/crypto/verify.ts
3318
- function sortObjectKeysRecursively(obj) {
3319
- if (typeof obj !== "object" || obj === null) {
3320
- return obj;
3321
- }
3322
- if (Array.isArray(obj)) {
3323
- return obj.map((item) => sortObjectKeysRecursively(item));
3324
- }
3325
- return Object.keys(obj).sort().reduce((result, key) => {
3326
- result[key] = sortObjectKeysRecursively(obj[key]);
3327
- return result;
3328
- }, {});
3329
- }
3330
- function hexToBytes(hex) {
3331
- const bytes = new Uint8Array(hex.length / 2);
3332
- for (let i = 0; i < hex.length; i += 2) {
3333
- bytes[i / 2] = parseInt(hex.slice(i, i + 2), 16);
3334
- }
3335
- return bytes.buffer;
3336
- }
3337
- async function verifyExtensionSignature(files, manifest) {
3338
- try {
3339
- if (typeof crypto === "undefined" || !crypto.subtle) {
3340
- return { valid: false, error: "WebCrypto API not available" };
3341
- }
3342
- const { publicKey: publicKeyHex, signature: signatureHex } = manifest;
3343
- if (!publicKeyHex) {
3344
- return { valid: false, error: "Missing publicKey in manifest" };
3345
- }
3346
- if (!signatureHex) {
3347
- return { valid: false, error: "Missing signature in manifest" };
3348
- }
3349
- if (!/^[0-9a-fA-F]+$/.test(publicKeyHex)) {
3350
- return { valid: false, error: "Invalid publicKey format (must be hex)" };
3351
- }
3352
- if (!/^[0-9a-fA-F]+$/.test(signatureHex)) {
3353
- return { valid: false, error: "Invalid signature format (must be hex)" };
3354
- }
3355
- const publicKeyBuffer = hexToBytes(publicKeyHex);
3356
- let publicKey;
3357
- try {
3358
- publicKey = await crypto.subtle.importKey(
3359
- "raw",
3360
- publicKeyBuffer,
3361
- { name: "Ed25519", namedCurve: "Ed25519" },
3362
- false,
3363
- ["verify"]
3364
- );
3365
- } catch (err) {
3366
- return {
3367
- valid: false,
3368
- error: `Failed to import public key: ${err instanceof Error ? err.message : "Ed25519 may not be supported in this browser"}`
3369
- };
3370
- }
3371
- const manifestForHashing = sortObjectKeysRecursively({
3372
- ...manifest,
3373
- signature: ""
3374
- });
3375
- const manifestJson = JSON.stringify(manifestForHashing, null, 2);
3376
- const manifestBytes = new TextEncoder().encode(manifestJson);
3377
- const filesForHashing = files.map((file) => {
3378
- if (file.path === "haextension/manifest.json") {
3379
- return { path: file.path, content: manifestBytes };
3380
- }
3381
- return file;
3382
- });
3383
- filesForHashing.sort((a, b) => {
3384
- if (a.path < b.path) return -1;
3385
- if (a.path > b.path) return 1;
3386
- return 0;
3387
- });
3388
- const totalLength = filesForHashing.reduce((sum, f) => sum + f.content.length, 0);
3389
- const combined = new Uint8Array(totalLength);
3390
- let offset = 0;
3391
- for (const file of filesForHashing) {
3392
- combined.set(file.content, offset);
3393
- offset += file.content.length;
3394
- }
3395
- const hashBuffer = await crypto.subtle.digest("SHA-256", combined);
3396
- const signatureBuffer = hexToBytes(signatureHex);
3397
- const isValid = await crypto.subtle.verify(
3398
- "Ed25519",
3399
- publicKey,
3400
- signatureBuffer,
3401
- hashBuffer
3402
- );
3403
- return { valid: isValid };
3404
- } catch (err) {
3405
- console.error("Signature verification error:", err);
3406
- return {
3407
- valid: false,
3408
- error: err instanceof Error ? err.message : "Unknown verification error"
3409
- };
3410
- }
3411
- }
3440
+ // src/types/spaces.ts
3441
+ init_esm_shims();
3412
3442
 
3413
3443
  // src/index.ts
3414
3444
  init_vaultKey();
3415
3445
  init_userKeypair();
3416
3446
 
3417
3447
  // src/crypto/didKey.ts
3448
+ init_esm_shims();
3418
3449
  init_userKeypair();
3419
3450
  init_vaultKey();
3420
3451
  var BASE58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
@@ -3513,6 +3544,7 @@ async function generateIdentityAsync() {
3513
3544
  }
3514
3545
 
3515
3546
  // src/crypto/spaceKey.ts
3547
+ init_esm_shims();
3516
3548
  init_userKeypair();
3517
3549
  init_vaultKey();
3518
3550
  function generateSpaceKey() {
@@ -3603,6 +3635,7 @@ async function decryptSpaceNameAsync(spaceKey, encryptedName, nameNonce) {
3603
3635
  }
3604
3636
 
3605
3637
  // src/crypto/claims.ts
3638
+ init_esm_shims();
3606
3639
  init_userKeypair();
3607
3640
  async function signClaimPresentationAsync(did, publicKeyBase64, claims, privateKeyBase64) {
3608
3641
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
@@ -3639,6 +3672,7 @@ async function verifyClaimPresentationAsync(presentation) {
3639
3672
  }
3640
3673
 
3641
3674
  // src/crypto/recordSigning.ts
3675
+ init_esm_shims();
3642
3676
  init_userKeypair();
3643
3677
  init_vaultKey();
3644
3678
  function canonicalize(record) {
@@ -3703,6 +3737,7 @@ async function verifySpaceChallengeAsync(spaceId, timestamp, signatureBase64, pu
3703
3737
  }
3704
3738
 
3705
3739
  // src/crypto/passkey.ts
3740
+ init_esm_shims();
3706
3741
  init_vaultKey();
3707
3742
  function toArrayBuffer(data) {
3708
3743
  if (data instanceof ArrayBuffer) {
@@ -3873,6 +3908,6 @@ function createHaexVaultSdk(config = {}) {
3873
3908
  return new HaexVaultSdk(config);
3874
3909
  }
3875
3910
 
3876
- export { COSE_ALGORITHM, DEFAULT_TIMEOUT, DatabaseAPI, EXTERNAL_EVENTS, ErrorCode, ExternalConnectionErrorCode, ExternalConnectionState, FilesystemAPI, HAEXSPACE_MESSAGE_TYPES, HAEXTENSION_EVENTS, HaexVaultSdk, HaexVaultSdkError, KEY_AGREEMENT_ALGO, KnownPath, LOCALSEND_EVENTS, LocalSendAPI, MAIL_COMMANDS, MAIL_EVENTS, MailAPI, NOTIFICATION_COMMANDS, NOTIFICATION_EVENTS, NotificationsAPI, PASSWORD_COMMANDS, PasswordsAPI, PermissionErrorCode, PermissionStatus, PermissionsAPI, RemoteStorageAPI, SHELL_EVENTS, SIGNING_ALGO, SPACE_COMMANDS, ShellAPI, SpacesAPI, TABLE_SEPARATOR, TAURI_COMMANDS, WebAPI, arrayBufferToBase64, base58btcDecode, base58btcEncode, base64ToArrayBuffer, canExternalClientSendRequests, createHaexVaultSdk, decryptCrdtData, decryptPrivateKeyAsync, decryptSpaceNameAsync, decryptString, decryptVaultKey, decryptVaultName, decryptWithPrivateKeyAsync, deriveKeyFromPassword, didKeyToPublicKeyAsync, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceNameAsync, encryptString, encryptVaultKey, encryptWithPublicKeyAsync, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generateIdentityAsync, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, getTableName, hexToBytes, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, isExternalClientConnected, isPermissionDeniedError, isPermissionError, isPermissionPromptError, publicKeyToDidKeyAsync, signClaimPresentationAsync, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyClaimPresentationAsync, verifyExtensionSignature, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
3911
+ export { COSE_ALGORITHM, DEFAULT_TIMEOUT, DatabaseAPI, DialogAPI, EXTERNAL_EVENTS, ErrorCode, ExternalConnectionErrorCode, ExternalConnectionState, FilesystemAPI, HAEXSPACE_MESSAGE_TYPES, HAEXTENSION_EVENTS, HaexVaultSdk, HaexVaultSdkError, KEY_AGREEMENT_ALGO, KnownPath, LOCALSEND_EVENTS, LocalSendAPI, MAIL_COMMANDS, MAIL_EVENTS, MailAPI, NOTIFICATION_COMMANDS, NOTIFICATION_EVENTS, NotificationsAPI, PASSWORD_COMMANDS, PasswordsAPI, PermissionErrorCode, PermissionStatus, PermissionsAPI, RemoteStorageAPI, SHELL_EVENTS, SIGNING_ALGO, SPACE_COMMANDS, ShellAPI, SpacesAPI, TABLE_SEPARATOR, TAURI_COMMANDS, TabAPI, WebAPI, arrayBufferToBase64, base58btcDecode, base58btcEncode, base64ToArrayBuffer, canExternalClientSendRequests, createHaexVaultSdk, decryptCrdtData, decryptPrivateKeyAsync, decryptSpaceNameAsync, decryptString, decryptVaultKey, decryptVaultName, decryptWithPrivateKeyAsync, deriveKeyFromPassword, didKeyToPublicKeyAsync, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceNameAsync, encryptString, encryptVaultKey, encryptWithPublicKeyAsync, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generateIdentityAsync, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, getTableName, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, isExternalClientConnected, isPermissionDeniedError, isPermissionError, isPermissionPromptError, publicKeyToDidKeyAsync, signClaimPresentationAsync, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, unwrapKey, verifyClaimPresentationAsync, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
3877
3912
  //# sourceMappingURL=index.mjs.map
3878
3913
  //# sourceMappingURL=index.mjs.map