@haex-space/vault-sdk 2.6.5 → 2.7.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/{client-BzH5VGzL.d.ts → client-COvneDz1.d.mts} +14 -3
- package/dist/{client-B1X-GsnG.d.mts → client-DQbCPz57.d.ts} +14 -3
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +61 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -3
- 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 +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +52 -2
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +52 -2
- package/dist/react.mjs.map +1 -1
- package/dist/runtime/nuxt.plugin.client.d.mts +2 -2
- package/dist/runtime/nuxt.plugin.client.d.ts +2 -2
- package/dist/runtime/nuxt.plugin.client.js +52 -2
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +52 -2
- package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
- package/dist/svelte.d.mts +2 -2
- package/dist/svelte.d.ts +2 -2
- package/dist/svelte.js +52 -2
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +52 -2
- package/dist/svelte.mjs.map +1 -1
- package/dist/{types-B1O6KckK.d.mts → types-DmCSegdY.d.mts} +2 -0
- package/dist/{types-B1O6KckK.d.ts → types-DmCSegdY.d.ts} +2 -0
- package/dist/vue.d.mts +2 -2
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js +52 -2
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +52 -2
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -682,6 +682,8 @@ var HAEXTENSION_EVENTS = {
|
|
|
682
682
|
var EXTERNAL_EVENTS = {
|
|
683
683
|
/** External request from authorized client */
|
|
684
684
|
REQUEST: "haextension:external:request",
|
|
685
|
+
/** AI action request (tool calls from AI assistant) */
|
|
686
|
+
ACTION_REQUEST: "haextension:action:request",
|
|
685
687
|
/** New external client requesting authorization */
|
|
686
688
|
AUTHORIZATION_REQUEST: "external:authorization-request"
|
|
687
689
|
};
|
|
@@ -2118,6 +2120,24 @@ async function setupTauriEventListeners(ctx, log, onEvent, onContextChange) {
|
|
|
2118
2120
|
} catch (error) {
|
|
2119
2121
|
log("Failed to setup external request listener:", error);
|
|
2120
2122
|
}
|
|
2123
|
+
try {
|
|
2124
|
+
await listen(EXTERNAL_EVENTS.ACTION_REQUEST, (event) => {
|
|
2125
|
+
log("====== AI ACTION REQUEST RECEIVED ======");
|
|
2126
|
+
log("Payload:", JSON.stringify(event.payload));
|
|
2127
|
+
if (event.payload) {
|
|
2128
|
+
onEvent({
|
|
2129
|
+
type: EXTERNAL_EVENTS.ACTION_REQUEST,
|
|
2130
|
+
data: event.payload,
|
|
2131
|
+
timestamp: Date.now()
|
|
2132
|
+
});
|
|
2133
|
+
} else {
|
|
2134
|
+
log("AI action request event has no payload!");
|
|
2135
|
+
}
|
|
2136
|
+
});
|
|
2137
|
+
log("AI action request listener registered successfully");
|
|
2138
|
+
} catch (error) {
|
|
2139
|
+
log("Failed to setup AI action request listener:", error);
|
|
2140
|
+
}
|
|
2121
2141
|
log("Registering file change listener for:", HAEXTENSION_EVENTS.FILE_CHANGED);
|
|
2122
2142
|
try {
|
|
2123
2143
|
await listen(HAEXTENSION_EVENTS.FILE_CHANGED, (event) => {
|
|
@@ -2437,7 +2457,7 @@ function createMessageHandler(config, pendingRequests, extensionInfo, onEvent) {
|
|
|
2437
2457
|
}
|
|
2438
2458
|
};
|
|
2439
2459
|
}
|
|
2440
|
-
function processEvent(event, log, eventListeners, onContextChanged, onExternalRequest) {
|
|
2460
|
+
function processEvent(event, log, eventListeners, onContextChanged, onExternalRequest, onActionRequest) {
|
|
2441
2461
|
if (event.type === HAEXTENSION_EVENTS.CONTEXT_CHANGED) {
|
|
2442
2462
|
const contextEvent = event;
|
|
2443
2463
|
onContextChanged(contextEvent.data.context);
|
|
@@ -2448,6 +2468,13 @@ function processEvent(event, log, eventListeners, onContextChanged, onExternalRe
|
|
|
2448
2468
|
onExternalRequest(externalEvent);
|
|
2449
2469
|
return;
|
|
2450
2470
|
}
|
|
2471
|
+
if (event.type === EXTERNAL_EVENTS.ACTION_REQUEST) {
|
|
2472
|
+
const actionEvent = event;
|
|
2473
|
+
if (onActionRequest) {
|
|
2474
|
+
onActionRequest(actionEvent);
|
|
2475
|
+
}
|
|
2476
|
+
return;
|
|
2477
|
+
}
|
|
2451
2478
|
emitEvent(event, log, eventListeners);
|
|
2452
2479
|
}
|
|
2453
2480
|
function emitEvent(event, log, eventListeners) {
|
|
@@ -2584,6 +2611,12 @@ async function respondToExternalRequest(response, request) {
|
|
|
2584
2611
|
await request(EXTERNAL_BRIDGE_COMMANDS.respond, response);
|
|
2585
2612
|
}
|
|
2586
2613
|
|
|
2614
|
+
// src/commands/ai.ts
|
|
2615
|
+
var AI_COMMANDS = {
|
|
2616
|
+
/** Respond to an AI action request */
|
|
2617
|
+
actionRespond: "ai_action_respond"
|
|
2618
|
+
};
|
|
2619
|
+
|
|
2587
2620
|
// src/client.ts
|
|
2588
2621
|
var HaexVaultSdk = class {
|
|
2589
2622
|
constructor(config = {}) {
|
|
@@ -2605,6 +2638,12 @@ var HaexVaultSdk = class {
|
|
|
2605
2638
|
this.setupHook = null;
|
|
2606
2639
|
// Public APIs
|
|
2607
2640
|
this.orm = null;
|
|
2641
|
+
/** Unified action system - register handlers that work for both Bridge and AI requests */
|
|
2642
|
+
this.actions = {
|
|
2643
|
+
register: (action, handler) => {
|
|
2644
|
+
return this.onExternalRequest(action, handler);
|
|
2645
|
+
}
|
|
2646
|
+
};
|
|
2608
2647
|
this.config = {
|
|
2609
2648
|
debug: config.debug ?? false,
|
|
2610
2649
|
timeout: config.timeout ?? DEFAULT_TIMEOUT,
|
|
@@ -2894,12 +2933,23 @@ var HaexVaultSdk = class {
|
|
|
2894
2933
|
this._context = ctx;
|
|
2895
2934
|
this.notifySubscribersInternal();
|
|
2896
2935
|
},
|
|
2897
|
-
(extEvent) => this.handleExternalRequestInternal(extEvent.data)
|
|
2936
|
+
(extEvent) => this.handleExternalRequestInternal(extEvent.data),
|
|
2937
|
+
(actionEvent) => this.handleActionRequestInternal(actionEvent.data)
|
|
2898
2938
|
);
|
|
2899
2939
|
}
|
|
2900
2940
|
async handleExternalRequestInternal(request) {
|
|
2901
2941
|
await handleExternalRequest(request, this.externalRequestHandlers, this.respondToExternalRequest.bind(this), this.log.bind(this));
|
|
2902
2942
|
}
|
|
2943
|
+
async handleActionRequestInternal(request) {
|
|
2944
|
+
await handleExternalRequest(
|
|
2945
|
+
request,
|
|
2946
|
+
this.externalRequestHandlers,
|
|
2947
|
+
async (response) => {
|
|
2948
|
+
await this.request(AI_COMMANDS.actionRespond, response);
|
|
2949
|
+
},
|
|
2950
|
+
this.log.bind(this)
|
|
2951
|
+
);
|
|
2952
|
+
}
|
|
2903
2953
|
// ==========================================================================
|
|
2904
2954
|
// Private: Setup
|
|
2905
2955
|
// ==========================================================================
|
|
@@ -2957,6 +3007,14 @@ function canExternalClientSendRequests(state) {
|
|
|
2957
3007
|
return state === "paired" /* PAIRED */;
|
|
2958
3008
|
}
|
|
2959
3009
|
|
|
3010
|
+
// src/types/spaces.ts
|
|
3011
|
+
var SpaceRoles = {
|
|
3012
|
+
OWNER: "owner",
|
|
3013
|
+
ADMIN: "admin",
|
|
3014
|
+
MEMBER: "member",
|
|
3015
|
+
READER: "reader"
|
|
3016
|
+
};
|
|
3017
|
+
|
|
2960
3018
|
// src/crypto/verify.ts
|
|
2961
3019
|
function sortObjectKeysRecursively(obj) {
|
|
2962
3020
|
if (typeof obj !== "object" || obj === null) {
|
|
@@ -3574,6 +3632,6 @@ function createHaexVaultSdk(config = {}) {
|
|
|
3574
3632
|
return new HaexVaultSdk(config);
|
|
3575
3633
|
}
|
|
3576
3634
|
|
|
3577
|
-
export { COSE_ALGORITHM, DEFAULT_TIMEOUT, DatabaseAPI, EXTERNAL_EVENTS, ErrorCode, ExternalConnectionErrorCode, ExternalConnectionState, FilesystemAPI, HAEXSPACE_MESSAGE_TYPES, HAEXTENSION_EVENTS, HaexVaultSdk, HaexVaultSdkError, KEY_AGREEMENT_ALGO, LOCALSEND_EVENTS, LocalSendAPI, 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 };
|
|
3635
|
+
export { COSE_ALGORITHM, DEFAULT_TIMEOUT, DatabaseAPI, EXTERNAL_EVENTS, ErrorCode, ExternalConnectionErrorCode, ExternalConnectionState, FilesystemAPI, HAEXSPACE_MESSAGE_TYPES, HAEXTENSION_EVENTS, HaexVaultSdk, HaexVaultSdkError, KEY_AGREEMENT_ALGO, LOCALSEND_EVENTS, LocalSendAPI, PermissionErrorCode, PermissionStatus, PermissionsAPI, RemoteStorageAPI, SHELL_EVENTS, SIGNING_ALGO, SPACE_COMMANDS, ShellAPI, SpaceRoles, 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 };
|
|
3578
3636
|
//# sourceMappingURL=index.mjs.map
|
|
3579
3637
|
//# sourceMappingURL=index.mjs.map
|