@haex-space/vault-sdk 4.0.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 (42) hide show
  1. package/dist/cli/index.mjs.map +1 -1
  2. package/dist/{client-C6pEREPM.d.ts → client-CD5QZi7F.d.ts} +29 -10
  3. package/dist/{client-GdCi-m2s.d.mts → client-Cx4ZyQFL.d.mts} +29 -10
  4. package/dist/index.d.mts +9 -6
  5. package/dist/index.d.ts +9 -6
  6. package/dist/index.js +57 -13
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs +56 -12
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/node.d.mts +1 -1
  11. package/dist/node.d.ts +1 -1
  12. package/dist/node.mjs +1 -1
  13. package/dist/node.mjs.map +1 -1
  14. package/dist/nuxt.js +1 -1
  15. package/dist/nuxt.js.map +1 -1
  16. package/dist/react.d.mts +2 -2
  17. package/dist/react.d.ts +2 -2
  18. package/dist/react.js +57 -13
  19. package/dist/react.js.map +1 -1
  20. package/dist/react.mjs +56 -12
  21. package/dist/react.mjs.map +1 -1
  22. package/dist/runtime/nuxt.plugin.client.d.mts +2 -2
  23. package/dist/runtime/nuxt.plugin.client.d.ts +2 -2
  24. package/dist/runtime/nuxt.plugin.client.js +55 -11
  25. package/dist/runtime/nuxt.plugin.client.js.map +1 -1
  26. package/dist/runtime/nuxt.plugin.client.mjs +55 -11
  27. package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
  28. package/dist/svelte.d.mts +2 -2
  29. package/dist/svelte.d.ts +2 -2
  30. package/dist/svelte.js +57 -13
  31. package/dist/svelte.js.map +1 -1
  32. package/dist/svelte.mjs +56 -12
  33. package/dist/svelte.mjs.map +1 -1
  34. package/dist/{types-Ba4G6ZpC.d.mts → types-BwFKGH70.d.mts} +1 -1
  35. package/dist/{types-Ba4G6ZpC.d.ts → types-BwFKGH70.d.ts} +1 -1
  36. package/dist/vue.d.mts +2 -2
  37. package/dist/vue.d.ts +2 -2
  38. package/dist/vue.js +57 -13
  39. package/dist/vue.js.map +1 -1
  40. package/dist/vue.mjs +56 -12
  41. package/dist/vue.mjs.map +1 -1
  42. package/package.json +2 -2
package/dist/svelte.mjs CHANGED
@@ -8,7 +8,7 @@ var __esm = (fn, res) => function __init() {
8
8
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
9
  };
10
10
  var init_esm_shims = __esm({
11
- "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"() {
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/esm_shims.js"() {
12
12
  }
13
13
  });
14
14
 
@@ -716,6 +716,8 @@ var SHELL_COMMANDS = {
716
716
  create: "extension_shell_create",
717
717
  /** Write data to a shell session's stdin */
718
718
  write: "extension_shell_write",
719
+ /** Acknowledge `shell:output` events handed on (backpressure; sent by the SDK itself) */
720
+ ack: "extension_shell_ack",
719
721
  /** Resize a shell session's terminal */
720
722
  resize: "extension_shell_resize",
721
723
  /** Close a shell session */
@@ -758,9 +760,9 @@ var MAIL_COMMANDS = {
758
760
  sendMessage: "extension_mail_send_message",
759
761
  /** Build RFC822 bytes without sending (for Drafts via APPEND) */
760
762
  buildRfc822: "extension_mail_build_rfc822",
761
- /** Start (or replace) a background poll watch for an account/mailbox */
763
+ /** Start (or replace) a background new-mail watch for an account/mailbox */
762
764
  startWatch: "extension_mail_start_watch",
763
- /** Stop a background poll watch */
765
+ /** Stop a background new-mail watch */
764
766
  stopWatch: "extension_mail_stop_watch"
765
767
  };
766
768
 
@@ -1658,9 +1660,44 @@ var SpacesAPI = class {
1658
1660
 
1659
1661
  // src/api/shell.ts
1660
1662
  init_esm_shims();
1663
+ var NOT_SUPPORTED = 8e3;
1664
+ function isUnsupported(error) {
1665
+ if (error?.code === NOT_SUPPORTED) return true;
1666
+ return typeof error === "string" && /\bcommand (\S+ )?not found\b/i.test(error);
1667
+ }
1661
1668
  var ShellAPI = class {
1662
1669
  constructor(sdk) {
1663
1670
  this.sdk = sdk;
1671
+ /** `shell:output` events per session handed on but not yet acknowledged. */
1672
+ this.unacknowledged = /* @__PURE__ */ new Map();
1673
+ this.flushScheduled = false;
1674
+ /** The host does not know `extension_shell_ack` (it reads output without backpressure). */
1675
+ this.ackUnsupported = false;
1676
+ this.sdk.on(SHELL_EVENTS.OUTPUT, (event) => this.acknowledge(event));
1677
+ }
1678
+ /**
1679
+ * Backpressure: the host keeps reading a shell's output only while this frame has few
1680
+ * events open, so a shell that writes fast waits instead of flooding the page. The SDK
1681
+ * acknowledges every event once the listeners have had it, in one request per session and
1682
+ * task.
1683
+ */
1684
+ acknowledge(event) {
1685
+ const sessionId = event.data?.sessionId;
1686
+ if (this.ackUnsupported || typeof sessionId !== "string") return;
1687
+ this.unacknowledged.set(sessionId, (this.unacknowledged.get(sessionId) ?? 0) + 1);
1688
+ if (this.flushScheduled) return;
1689
+ this.flushScheduled = true;
1690
+ queueMicrotask(() => this.flushAcknowledgements());
1691
+ }
1692
+ flushAcknowledgements() {
1693
+ this.flushScheduled = false;
1694
+ const counts = [...this.unacknowledged];
1695
+ this.unacknowledged.clear();
1696
+ for (const [sessionId, count] of counts) {
1697
+ this.sdk.request(SHELL_COMMANDS.ack, { sessionId, count }).catch((error) => {
1698
+ if (isUnsupported(error)) this.ackUnsupported = true;
1699
+ });
1700
+ }
1664
1701
  }
1665
1702
  /**
1666
1703
  * List available shell environments on the host system.
@@ -1878,22 +1915,29 @@ var MailAPI = class {
1878
1915
  });
1879
1916
  }
1880
1917
  /**
1881
- * Start (or replace) a background poll watch for `accountId`/`mailboxName`.
1882
- * The host resolves credentials itself from `accountId` — no `ImapConfig`
1883
- * is passed in. Requires `mail` permission with action `poll` on the
1884
- * account's IMAP host (prompted on first call, same as `fetch`/`send`).
1918
+ * Start (or replace) a background watch for `accountId`/`mailboxName`.
1919
+ * Requires `mail` permission with action `poll` on the account's IMAP
1920
+ * host (`imap.host` when passed; prompted on first call, same as
1921
+ * `fetch`/`send`).
1922
+ *
1923
+ * Pass the account's `imap` config, as for every other mail call: the host
1924
+ * keeps the credentials in memory for as long as the watch runs and never
1925
+ * stores them. Hosts that wait with IMAP IDLE are told about new mail by the
1926
+ * server; `intervalSeconds` (clamped host-side to [30, 3600]) is the polling
1927
+ * interval for servers without IDLE. Listen for results via `onNewMessages`.
1885
1928
  *
1886
- * `intervalSeconds` is clamped host-side to [30, 3600]. Listen for
1887
- * results via `onNewMessages`.
1929
+ * `imap` is optional for hosts that resolve the credentials themselves from
1930
+ * `accountId`; holzi requires it.
1888
1931
  */
1889
- async startWatchingAsync(accountId, mailboxName, intervalSeconds) {
1932
+ async startWatchingAsync(accountId, mailboxName, intervalSeconds, imap) {
1890
1933
  return this.client.request(MAIL_COMMANDS.startWatch, {
1891
1934
  accountId,
1892
1935
  mailboxName,
1893
- intervalSeconds
1936
+ intervalSeconds,
1937
+ imap
1894
1938
  });
1895
1939
  }
1896
- /** Stop a background poll watch previously started with `startWatchingAsync`. */
1940
+ /** Stop a background watch previously started with `startWatchingAsync`. */
1897
1941
  async stopWatchingAsync(accountId, mailboxName) {
1898
1942
  return this.client.request(MAIL_COMMANDS.stopWatch, {
1899
1943
  accountId,