@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
|
@@ -29,6 +29,8 @@ type HaextensionEvent = typeof HAEXTENSION_EVENTS[keyof typeof HAEXTENSION_EVENT
|
|
|
29
29
|
declare const EXTERNAL_EVENTS: {
|
|
30
30
|
/** External request from authorized client */
|
|
31
31
|
readonly REQUEST: "haextension:external:request";
|
|
32
|
+
/** AI action request (tool calls from AI assistant) */
|
|
33
|
+
readonly ACTION_REQUEST: "haextension:action:request";
|
|
32
34
|
/** New external client requesting authorization */
|
|
33
35
|
readonly AUTHORIZATION_REQUEST: "external:authorization-request";
|
|
34
36
|
};
|
|
@@ -29,6 +29,8 @@ type HaextensionEvent = typeof HAEXTENSION_EVENTS[keyof typeof HAEXTENSION_EVENT
|
|
|
29
29
|
declare const EXTERNAL_EVENTS: {
|
|
30
30
|
/** External request from authorized client */
|
|
31
31
|
readonly REQUEST: "haextension:external:request";
|
|
32
|
+
/** AI action request (tool calls from AI assistant) */
|
|
33
|
+
readonly ACTION_REQUEST: "haextension:action:request";
|
|
32
34
|
/** New external client requesting authorization */
|
|
33
35
|
readonly AUTHORIZATION_REQUEST: "external:authorization-request";
|
|
34
36
|
};
|
package/dist/vue.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { H as HaexVaultSdk, S as StorageAPI } from './client-
|
|
1
|
+
import { H as HaexVaultSdk, S as StorageAPI } from './client-COvneDz1.mjs';
|
|
2
2
|
import * as drizzle_orm_sqlite_proxy from 'drizzle-orm/sqlite-proxy';
|
|
3
3
|
import { Ref } from 'vue';
|
|
4
|
-
import { H as HaexHubConfig } from './types-
|
|
4
|
+
import { H as HaexHubConfig } from './types-DmCSegdY.mjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Vue 3 composable for HaexVault SDK
|
package/dist/vue.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { H as HaexVaultSdk, S as StorageAPI } from './client-
|
|
1
|
+
import { H as HaexVaultSdk, S as StorageAPI } from './client-DQbCPz57.js';
|
|
2
2
|
import * as drizzle_orm_sqlite_proxy from 'drizzle-orm/sqlite-proxy';
|
|
3
3
|
import { Ref } from 'vue';
|
|
4
|
-
import { H as HaexHubConfig } from './types-
|
|
4
|
+
import { H as HaexHubConfig } from './types-DmCSegdY.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Vue 3 composable for HaexVault SDK
|
package/dist/vue.js
CHANGED
|
@@ -386,6 +386,8 @@ var HAEXTENSION_EVENTS = {
|
|
|
386
386
|
var EXTERNAL_EVENTS = {
|
|
387
387
|
/** External request from authorized client */
|
|
388
388
|
REQUEST: "haextension:external:request",
|
|
389
|
+
/** AI action request (tool calls from AI assistant) */
|
|
390
|
+
ACTION_REQUEST: "haextension:action:request",
|
|
389
391
|
/** New external client requesting authorization */
|
|
390
392
|
AUTHORIZATION_REQUEST: "external:authorization-request"
|
|
391
393
|
};
|
|
@@ -1726,6 +1728,24 @@ async function setupTauriEventListeners(ctx, log, onEvent, onContextChange) {
|
|
|
1726
1728
|
} catch (error) {
|
|
1727
1729
|
log("Failed to setup external request listener:", error);
|
|
1728
1730
|
}
|
|
1731
|
+
try {
|
|
1732
|
+
await listen(EXTERNAL_EVENTS.ACTION_REQUEST, (event) => {
|
|
1733
|
+
log("====== AI ACTION REQUEST RECEIVED ======");
|
|
1734
|
+
log("Payload:", JSON.stringify(event.payload));
|
|
1735
|
+
if (event.payload) {
|
|
1736
|
+
onEvent({
|
|
1737
|
+
type: EXTERNAL_EVENTS.ACTION_REQUEST,
|
|
1738
|
+
data: event.payload,
|
|
1739
|
+
timestamp: Date.now()
|
|
1740
|
+
});
|
|
1741
|
+
} else {
|
|
1742
|
+
log("AI action request event has no payload!");
|
|
1743
|
+
}
|
|
1744
|
+
});
|
|
1745
|
+
log("AI action request listener registered successfully");
|
|
1746
|
+
} catch (error) {
|
|
1747
|
+
log("Failed to setup AI action request listener:", error);
|
|
1748
|
+
}
|
|
1729
1749
|
log("Registering file change listener for:", HAEXTENSION_EVENTS.FILE_CHANGED);
|
|
1730
1750
|
try {
|
|
1731
1751
|
await listen(HAEXTENSION_EVENTS.FILE_CHANGED, (event) => {
|
|
@@ -2045,7 +2065,7 @@ function createMessageHandler(config, pendingRequests, extensionInfo2, onEvent)
|
|
|
2045
2065
|
}
|
|
2046
2066
|
};
|
|
2047
2067
|
}
|
|
2048
|
-
function processEvent(event, log, eventListeners, onContextChanged, onExternalRequest) {
|
|
2068
|
+
function processEvent(event, log, eventListeners, onContextChanged, onExternalRequest, onActionRequest) {
|
|
2049
2069
|
if (event.type === HAEXTENSION_EVENTS.CONTEXT_CHANGED) {
|
|
2050
2070
|
const contextEvent = event;
|
|
2051
2071
|
onContextChanged(contextEvent.data.context);
|
|
@@ -2056,6 +2076,13 @@ function processEvent(event, log, eventListeners, onContextChanged, onExternalRe
|
|
|
2056
2076
|
onExternalRequest(externalEvent);
|
|
2057
2077
|
return;
|
|
2058
2078
|
}
|
|
2079
|
+
if (event.type === EXTERNAL_EVENTS.ACTION_REQUEST) {
|
|
2080
|
+
const actionEvent = event;
|
|
2081
|
+
if (onActionRequest) {
|
|
2082
|
+
onActionRequest(actionEvent);
|
|
2083
|
+
}
|
|
2084
|
+
return;
|
|
2085
|
+
}
|
|
2059
2086
|
emitEvent(event, log, eventListeners);
|
|
2060
2087
|
}
|
|
2061
2088
|
function emitEvent(event, log, eventListeners) {
|
|
@@ -2192,6 +2219,12 @@ async function respondToExternalRequest(response, request) {
|
|
|
2192
2219
|
await request(EXTERNAL_BRIDGE_COMMANDS.respond, response);
|
|
2193
2220
|
}
|
|
2194
2221
|
|
|
2222
|
+
// src/commands/ai.ts
|
|
2223
|
+
var AI_COMMANDS = {
|
|
2224
|
+
/** Respond to an AI action request */
|
|
2225
|
+
actionRespond: "ai_action_respond"
|
|
2226
|
+
};
|
|
2227
|
+
|
|
2195
2228
|
// src/client.ts
|
|
2196
2229
|
var HaexVaultSdk = class {
|
|
2197
2230
|
constructor(config = {}) {
|
|
@@ -2213,6 +2246,12 @@ var HaexVaultSdk = class {
|
|
|
2213
2246
|
this.setupHook = null;
|
|
2214
2247
|
// Public APIs
|
|
2215
2248
|
this.orm = null;
|
|
2249
|
+
/** Unified action system - register handlers that work for both Bridge and AI requests */
|
|
2250
|
+
this.actions = {
|
|
2251
|
+
register: (action, handler) => {
|
|
2252
|
+
return this.onExternalRequest(action, handler);
|
|
2253
|
+
}
|
|
2254
|
+
};
|
|
2216
2255
|
this.config = {
|
|
2217
2256
|
debug: config.debug ?? false,
|
|
2218
2257
|
timeout: config.timeout ?? DEFAULT_TIMEOUT,
|
|
@@ -2502,12 +2541,23 @@ var HaexVaultSdk = class {
|
|
|
2502
2541
|
this._context = ctx;
|
|
2503
2542
|
this.notifySubscribersInternal();
|
|
2504
2543
|
},
|
|
2505
|
-
(extEvent) => this.handleExternalRequestInternal(extEvent.data)
|
|
2544
|
+
(extEvent) => this.handleExternalRequestInternal(extEvent.data),
|
|
2545
|
+
(actionEvent) => this.handleActionRequestInternal(actionEvent.data)
|
|
2506
2546
|
);
|
|
2507
2547
|
}
|
|
2508
2548
|
async handleExternalRequestInternal(request) {
|
|
2509
2549
|
await handleExternalRequest(request, this.externalRequestHandlers, this.respondToExternalRequest.bind(this), this.log.bind(this));
|
|
2510
2550
|
}
|
|
2551
|
+
async handleActionRequestInternal(request) {
|
|
2552
|
+
await handleExternalRequest(
|
|
2553
|
+
request,
|
|
2554
|
+
this.externalRequestHandlers,
|
|
2555
|
+
async (response) => {
|
|
2556
|
+
await this.request(AI_COMMANDS.actionRespond, response);
|
|
2557
|
+
},
|
|
2558
|
+
this.log.bind(this)
|
|
2559
|
+
);
|
|
2560
|
+
}
|
|
2511
2561
|
// ==========================================================================
|
|
2512
2562
|
// Private: Setup
|
|
2513
2563
|
// ==========================================================================
|