@haex-space/vault-sdk 4.10.0 → 5.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.
package/dist/node.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { H as HaextensionConfig, g as getExtensionDir, r as readHaextensionConfig } from './config-P_6DqTHl.mjs';
2
- import { a as ExtensionManifest } from './types-BZVkX0Wf.mjs';
2
+ import { a as ExtensionManifest } from './types-CNxDNQgb.mjs';
3
3
 
4
4
  interface ReadManifestOptions {
5
5
  /** Root directory of the project */
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { H as HaextensionConfig, g as getExtensionDir, r as readHaextensionConfig } from './config-P_6DqTHl.js';
2
- import { a as ExtensionManifest } from './types-BZVkX0Wf.js';
2
+ import { a as ExtensionManifest } from './types-CNxDNQgb.js';
3
3
 
4
4
  interface ReadManifestOptions {
5
5
  /** Root directory of the project */
package/dist/react.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { S as StorageAPI } from './client-DTxLSJrk.mjs';
1
+ import { S as StorageAPI } from './client-HdPYJ_9t.mjs';
2
2
  import { HaexVaultSdk } from './index.mjs';
3
3
  import * as drizzle_orm_sqlite_proxy from 'drizzle-orm/sqlite-proxy';
4
4
  import { HaexHubConfig, ExtensionInfo, ApplicationContext } from './index.mjs';
package/dist/react.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { S as StorageAPI } from './client-s0eCQoWA.js';
1
+ import { S as StorageAPI } from './client-CgngeKPm.js';
2
2
  import { HaexVaultSdk } from './index.js';
3
3
  import * as drizzle_orm_sqlite_proxy from 'drizzle-orm/sqlite-proxy';
4
4
  import { HaexHubConfig, ExtensionInfo, ApplicationContext } from './index.js';
package/dist/react.js CHANGED
@@ -455,6 +455,10 @@ var NOTIFICATION_EVENTS = {
455
455
  /** A click on one of this extension's notifications (body or action button). */
456
456
  CLICK: "haextension:notification:click"
457
457
  };
458
+ var OPENER_EVENTS = {
459
+ /** A request waits for this extension: take it with `client.openers.take()`. The event carries no content. */
460
+ REQUEST: "opener-request"
461
+ };
458
462
  var MODEL_JOB_EVENTS = {
459
463
  /** A job of this frame ended: completed, failed or cancelled. */
460
464
  COMPLETED: "haextension:model-job:completed"
@@ -648,7 +652,9 @@ var EXTENSION_COMMANDS = {
648
652
  /** Ask the host to mark (or unmark) this extension's own tab as wanting attention */
649
653
  tabAttention: "extension_tab_attention",
650
654
  /** Ask the user to confirm, in a dialog the host draws over this extension's tab */
651
- dialogConfirm: "extension_dialog_confirm"
655
+ dialogConfirm: "extension_dialog_confirm",
656
+ /** Take the request the user gave this extension (holzi spec 063): `null` or `{ action, mail }` */
657
+ openerTake: "extension_opener_take"
652
658
  };
653
659
 
654
660
  // src/commands/remoteStorage.ts
@@ -2545,6 +2551,49 @@ var DialogAPI = class {
2545
2551
  }
2546
2552
  };
2547
2553
 
2554
+ // src/api/openers.ts
2555
+ init_cjs_shims();
2556
+ var OpenersAPI = class {
2557
+ constructor(client) {
2558
+ this.client = client;
2559
+ }
2560
+ /**
2561
+ * Takes the request that waits for this extension, or `null` when none does (it expired after
2562
+ * 15 seconds, was taken already, or the extension did not register for the kind). Call it once when
2563
+ * the extension starts: a frame that the choice itself opened misses the event.
2564
+ */
2565
+ async take() {
2566
+ await this.client.ready();
2567
+ const request = await this.client.request(EXTENSION_COMMANDS.openerTake, {});
2568
+ return request ?? null;
2569
+ }
2570
+ /**
2571
+ * Calls `handler` with each request that arrives while the extension is open; the SDK takes it
2572
+ * for you. Errors while taking a request go to `onError`, or to the SDK console log when omitted.
2573
+ * Returns an unsubscribe function.
2574
+ */
2575
+ onRequest(handler, onError) {
2576
+ let active = true;
2577
+ const wrapped = () => {
2578
+ void this.take().then(
2579
+ (request) => {
2580
+ if (active && request) handler(request);
2581
+ },
2582
+ (error) => {
2583
+ if (!active) return;
2584
+ if (onError) onError(error);
2585
+ else console.error("[HaexVault SDK] Failed to take opener request:", error);
2586
+ }
2587
+ );
2588
+ };
2589
+ this.client.on(OPENER_EVENTS.REQUEST, wrapped);
2590
+ return () => {
2591
+ active = false;
2592
+ this.client.off(OPENER_EVENTS.REQUEST, wrapped);
2593
+ };
2594
+ }
2595
+ };
2596
+
2548
2597
  // src/api/tools/index.ts
2549
2598
  init_cjs_shims();
2550
2599
 
@@ -3420,6 +3469,7 @@ var HaexVaultSdk = class {
3420
3469
  this.notifications = new NotificationsAPI(this);
3421
3470
  this.tab = new TabAPI(this);
3422
3471
  this.dialog = new DialogAPI(this);
3472
+ this.openers = new OpenersAPI(this);
3423
3473
  this.tools = new ToolsAPI({
3424
3474
  manifest: () => this.config.manifest,
3425
3475
  send: (message) => this.sendMcpMessage(message)