@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.
@@ -35,6 +35,14 @@ declare const NOTIFICATION_EVENTS: {
35
35
  readonly CLICK: "haextension:notification:click";
36
36
  };
37
37
  type NotificationEvent = typeof NOTIFICATION_EVENTS[keyof typeof NOTIFICATION_EVENTS];
38
+ /**
39
+ * Events of the openers (`client.openers`, holzi spec 063).
40
+ */
41
+ declare const OPENER_EVENTS: {
42
+ /** A request waits for this extension: take it with `client.openers.take()`. The event carries no content. */
43
+ readonly REQUEST: "opener-request";
44
+ };
45
+ type OpenerEvent = typeof OPENER_EVENTS[keyof typeof OPENER_EVENTS];
38
46
  /**
39
47
  * Events of model jobs (`models.runAsync`, holzi spec 055).
40
48
  */
@@ -453,6 +461,13 @@ interface ExtensionManifest {
453
461
  i18n?: Record<string, ManifestI18nEntry> | null;
454
462
  /** Tools the extension offers to the agent of its host (holzi spec 018). */
455
463
  tools?: ManifestTool[] | null;
464
+ /**
465
+ * The kinds of link the extension takes over from its host (holzi spec 063), for example
466
+ * `"mail.compose"`: the host offers the extension where a person writes an e-mail. At most 8 entries,
467
+ * each of the form `word.word` in lower case, at most 32 characters. A kind a host does not know is
468
+ * ignored. Registering grants no access.
469
+ */
470
+ openers?: string[] | null;
456
471
  }
457
472
  interface HaexHubConfig {
458
473
  debug?: boolean;
@@ -534,5 +549,5 @@ declare class HaexVaultSdkError extends Error {
534
549
  };
535
550
  }
536
551
 
537
- export { HostErrorCode as B, MAIL_EVENTS as G, MODEL_JOB_EVENTS as J, NOTIFICATION_EVENTS as T, PEERS_EVENTS as V, PermissionErrorCode as _, PermissionStatus as a0, SHELL_EVENTS as a1, TABLE_SEPARATOR as a6, getTableName as a7, isPermissionDeniedError as a8, isPermissionError as a9, isPermissionPromptError as aa, EXTERNAL_EVENTS as c, DEFAULT_TIMEOUT as j, ErrorCode as p, HAEXTENSION_EVENTS as v, HaexVaultSdkError as y };
538
- export type { PermissionPromptError as $, ApplicationContext as A, ClaimRequirement as C, DatabaseQueryResult as D, ExtensionInfo as E, FileChangeEvent as F, HaexHubConfig as H, IdentityClaim as I, MailEvent as K, ManifestI18nEntry as L, Migration as M, ManifestTool as N, ManifestToolEffect as O, PermissionResponse as P, ModelJobEvent as Q, RequestOptions as R, SearchResult as S, NotificationEvent as U, WebRequestOptions as W, PeersEvent as X, PermissionDeniedError as Y, PermissionErrorBase as Z, ExtensionManifest as a, SearchQuery as a2, SearchRequestEvent as a3, ShellEvent as a4, SyncTablesUpdatedEvent as a5, HaexHubEvent as b, MigrationResult as d, WebResponse as e, EventCallback as f, DatabasePermissionRequest as g, SignedClaimPresentation as h, ContextChangedEvent as i, DatabaseColumnInfo as k, DatabaseExecuteParams as l, DatabasePermission as m, DatabaseQueryParams as n, DatabaseTableInfo as o, ExtensionRuntimeMode as q, ExternalEvent as r, FileChangePayload as s, FileChangeType as t, FilteredSyncTablesResult as u, HaexHubRequest as w, HaexHubResponse as x, HaextensionEvent as z };
552
+ export { HostErrorCode as B, MAIL_EVENTS as G, MODEL_JOB_EVENTS as J, NOTIFICATION_EVENTS as T, OPENER_EVENTS as V, PEERS_EVENTS as Y, PermissionErrorCode as a0, PermissionStatus as a2, SHELL_EVENTS as a3, TABLE_SEPARATOR as a8, getTableName as a9, isPermissionDeniedError as aa, isPermissionError as ab, isPermissionPromptError as ac, EXTERNAL_EVENTS as c, DEFAULT_TIMEOUT as j, ErrorCode as p, HAEXTENSION_EVENTS as v, HaexVaultSdkError as y };
553
+ export type { PermissionErrorBase as $, ApplicationContext as A, ClaimRequirement as C, DatabaseQueryResult as D, ExtensionInfo as E, FileChangeEvent as F, HaexHubConfig as H, IdentityClaim as I, MailEvent as K, ManifestI18nEntry as L, Migration as M, ManifestTool as N, ManifestToolEffect as O, PermissionResponse as P, ModelJobEvent as Q, RequestOptions as R, SearchResult as S, NotificationEvent as U, WebRequestOptions as W, OpenerEvent as X, PeersEvent as Z, PermissionDeniedError as _, ExtensionManifest as a, PermissionPromptError as a1, SearchQuery as a4, SearchRequestEvent as a5, ShellEvent as a6, SyncTablesUpdatedEvent as a7, HaexHubEvent as b, MigrationResult as d, WebResponse as e, EventCallback as f, DatabasePermissionRequest as g, SignedClaimPresentation as h, ContextChangedEvent as i, DatabaseColumnInfo as k, DatabaseExecuteParams as l, DatabasePermission as m, DatabaseQueryParams as n, DatabaseTableInfo as o, ExtensionRuntimeMode as q, ExternalEvent as r, FileChangePayload as s, FileChangeType as t, FilteredSyncTablesResult as u, HaexHubRequest as w, HaexHubResponse as x, HaextensionEvent as z };
@@ -35,6 +35,14 @@ declare const NOTIFICATION_EVENTS: {
35
35
  readonly CLICK: "haextension:notification:click";
36
36
  };
37
37
  type NotificationEvent = typeof NOTIFICATION_EVENTS[keyof typeof NOTIFICATION_EVENTS];
38
+ /**
39
+ * Events of the openers (`client.openers`, holzi spec 063).
40
+ */
41
+ declare const OPENER_EVENTS: {
42
+ /** A request waits for this extension: take it with `client.openers.take()`. The event carries no content. */
43
+ readonly REQUEST: "opener-request";
44
+ };
45
+ type OpenerEvent = typeof OPENER_EVENTS[keyof typeof OPENER_EVENTS];
38
46
  /**
39
47
  * Events of model jobs (`models.runAsync`, holzi spec 055).
40
48
  */
@@ -453,6 +461,13 @@ interface ExtensionManifest {
453
461
  i18n?: Record<string, ManifestI18nEntry> | null;
454
462
  /** Tools the extension offers to the agent of its host (holzi spec 018). */
455
463
  tools?: ManifestTool[] | null;
464
+ /**
465
+ * The kinds of link the extension takes over from its host (holzi spec 063), for example
466
+ * `"mail.compose"`: the host offers the extension where a person writes an e-mail. At most 8 entries,
467
+ * each of the form `word.word` in lower case, at most 32 characters. A kind a host does not know is
468
+ * ignored. Registering grants no access.
469
+ */
470
+ openers?: string[] | null;
456
471
  }
457
472
  interface HaexHubConfig {
458
473
  debug?: boolean;
@@ -534,5 +549,5 @@ declare class HaexVaultSdkError extends Error {
534
549
  };
535
550
  }
536
551
 
537
- export { HostErrorCode as B, MAIL_EVENTS as G, MODEL_JOB_EVENTS as J, NOTIFICATION_EVENTS as T, PEERS_EVENTS as V, PermissionErrorCode as _, PermissionStatus as a0, SHELL_EVENTS as a1, TABLE_SEPARATOR as a6, getTableName as a7, isPermissionDeniedError as a8, isPermissionError as a9, isPermissionPromptError as aa, EXTERNAL_EVENTS as c, DEFAULT_TIMEOUT as j, ErrorCode as p, HAEXTENSION_EVENTS as v, HaexVaultSdkError as y };
538
- export type { PermissionPromptError as $, ApplicationContext as A, ClaimRequirement as C, DatabaseQueryResult as D, ExtensionInfo as E, FileChangeEvent as F, HaexHubConfig as H, IdentityClaim as I, MailEvent as K, ManifestI18nEntry as L, Migration as M, ManifestTool as N, ManifestToolEffect as O, PermissionResponse as P, ModelJobEvent as Q, RequestOptions as R, SearchResult as S, NotificationEvent as U, WebRequestOptions as W, PeersEvent as X, PermissionDeniedError as Y, PermissionErrorBase as Z, ExtensionManifest as a, SearchQuery as a2, SearchRequestEvent as a3, ShellEvent as a4, SyncTablesUpdatedEvent as a5, HaexHubEvent as b, MigrationResult as d, WebResponse as e, EventCallback as f, DatabasePermissionRequest as g, SignedClaimPresentation as h, ContextChangedEvent as i, DatabaseColumnInfo as k, DatabaseExecuteParams as l, DatabasePermission as m, DatabaseQueryParams as n, DatabaseTableInfo as o, ExtensionRuntimeMode as q, ExternalEvent as r, FileChangePayload as s, FileChangeType as t, FilteredSyncTablesResult as u, HaexHubRequest as w, HaexHubResponse as x, HaextensionEvent as z };
552
+ export { HostErrorCode as B, MAIL_EVENTS as G, MODEL_JOB_EVENTS as J, NOTIFICATION_EVENTS as T, OPENER_EVENTS as V, PEERS_EVENTS as Y, PermissionErrorCode as a0, PermissionStatus as a2, SHELL_EVENTS as a3, TABLE_SEPARATOR as a8, getTableName as a9, isPermissionDeniedError as aa, isPermissionError as ab, isPermissionPromptError as ac, EXTERNAL_EVENTS as c, DEFAULT_TIMEOUT as j, ErrorCode as p, HAEXTENSION_EVENTS as v, HaexVaultSdkError as y };
553
+ export type { PermissionErrorBase as $, ApplicationContext as A, ClaimRequirement as C, DatabaseQueryResult as D, ExtensionInfo as E, FileChangeEvent as F, HaexHubConfig as H, IdentityClaim as I, MailEvent as K, ManifestI18nEntry as L, Migration as M, ManifestTool as N, ManifestToolEffect as O, PermissionResponse as P, ModelJobEvent as Q, RequestOptions as R, SearchResult as S, NotificationEvent as U, WebRequestOptions as W, OpenerEvent as X, PeersEvent as Z, PermissionDeniedError as _, ExtensionManifest as a, PermissionPromptError as a1, SearchQuery as a4, SearchRequestEvent as a5, ShellEvent as a6, SyncTablesUpdatedEvent as a7, HaexHubEvent as b, MigrationResult as d, WebResponse as e, EventCallback as f, DatabasePermissionRequest as g, SignedClaimPresentation as h, ContextChangedEvent as i, DatabaseColumnInfo as k, DatabaseExecuteParams as l, DatabasePermission as m, DatabaseQueryParams as n, DatabaseTableInfo as o, ExtensionRuntimeMode as q, ExternalEvent as r, FileChangePayload as s, FileChangeType as t, FilteredSyncTablesResult as u, HaexHubRequest as w, HaexHubResponse as x, HaextensionEvent as z };
package/dist/vue.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 { Ref } from 'vue';
package/dist/vue.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 { Ref } from 'vue';
package/dist/vue.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)