@haex-space/vault-sdk 5.0.0 → 5.2.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/README.md +29 -0
- package/dist/{client-DXHXxcgw.d.mts → client-CgngeKPm.d.ts} +42 -3
- package/dist/{client-EtzmMEnK.d.ts → client-HdPYJ_9t.d.mts} +42 -3
- package/dist/haex_bundle_bg.wasm +0 -0
- package/dist/index.d.mts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +53 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -2
- package/dist/index.mjs.map +1 -1
- package/dist/node.d.mts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +51 -1
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +51 -1
- package/dist/react.mjs.map +1 -1
- package/dist/runtime/nuxt.plugin.client.js +50 -1
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +50 -1
- package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
- package/dist/svelte.d.mts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/svelte.js +51 -1
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +51 -1
- package/dist/svelte.mjs.map +1 -1
- package/dist/{types-BZVkX0Wf.d.mts → types-CNxDNQgb.d.mts} +17 -2
- package/dist/{types-BZVkX0Wf.d.ts → types-CNxDNQgb.d.ts} +17 -2
- package/dist/vue.d.mts +1 -1
- package/dist/vue.d.ts +1 -1
- package/dist/vue.js +51 -1
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +51 -1
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/dist/svelte.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as StorageAPI } from './client-
|
|
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 { Readable } from 'svelte/store';
|
package/dist/svelte.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as StorageAPI } from './client-
|
|
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 { Readable } from 'svelte/store';
|
package/dist/svelte.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)
|