@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as nuxt_app from 'nuxt/app';
|
|
2
2
|
import { ShallowRef } from 'vue';
|
|
3
|
-
import { H as HaexVaultSdk } from '../client-
|
|
4
|
-
import { A as ApplicationContext } from '../types-
|
|
3
|
+
import { H as HaexVaultSdk } from '../client-COvneDz1.mjs';
|
|
4
|
+
import { A as ApplicationContext } from '../types-DmCSegdY.mjs';
|
|
5
5
|
import 'drizzle-orm/sqlite-proxy';
|
|
6
6
|
|
|
7
7
|
declare const _default: nuxt_app.Plugin<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as nuxt_app from 'nuxt/app';
|
|
2
2
|
import { ShallowRef } from 'vue';
|
|
3
|
-
import { H as HaexVaultSdk } from '../client-
|
|
4
|
-
import { A as ApplicationContext } from '../types-
|
|
3
|
+
import { H as HaexVaultSdk } from '../client-DQbCPz57.js';
|
|
4
|
+
import { A as ApplicationContext } from '../types-DmCSegdY.js';
|
|
5
5
|
import 'drizzle-orm/sqlite-proxy';
|
|
6
6
|
|
|
7
7
|
declare const _default: nuxt_app.Plugin<{
|
|
@@ -20,6 +20,8 @@ var HAEXTENSION_EVENTS = {
|
|
|
20
20
|
var EXTERNAL_EVENTS = {
|
|
21
21
|
/** External request from authorized client */
|
|
22
22
|
REQUEST: "haextension:external:request",
|
|
23
|
+
/** AI action request (tool calls from AI assistant) */
|
|
24
|
+
ACTION_REQUEST: "haextension:action:request",
|
|
23
25
|
/** New external client requesting authorization */
|
|
24
26
|
AUTHORIZATION_REQUEST: "external:authorization-request"
|
|
25
27
|
};
|
|
@@ -1459,6 +1461,24 @@ async function setupTauriEventListeners(ctx, log, onEvent, onContextChange) {
|
|
|
1459
1461
|
} catch (error) {
|
|
1460
1462
|
log("Failed to setup external request listener:", error);
|
|
1461
1463
|
}
|
|
1464
|
+
try {
|
|
1465
|
+
await listen(EXTERNAL_EVENTS.ACTION_REQUEST, (event) => {
|
|
1466
|
+
log("====== AI ACTION REQUEST RECEIVED ======");
|
|
1467
|
+
log("Payload:", JSON.stringify(event.payload));
|
|
1468
|
+
if (event.payload) {
|
|
1469
|
+
onEvent({
|
|
1470
|
+
type: EXTERNAL_EVENTS.ACTION_REQUEST,
|
|
1471
|
+
data: event.payload,
|
|
1472
|
+
timestamp: Date.now()
|
|
1473
|
+
});
|
|
1474
|
+
} else {
|
|
1475
|
+
log("AI action request event has no payload!");
|
|
1476
|
+
}
|
|
1477
|
+
});
|
|
1478
|
+
log("AI action request listener registered successfully");
|
|
1479
|
+
} catch (error) {
|
|
1480
|
+
log("Failed to setup AI action request listener:", error);
|
|
1481
|
+
}
|
|
1462
1482
|
log("Registering file change listener for:", HAEXTENSION_EVENTS.FILE_CHANGED);
|
|
1463
1483
|
try {
|
|
1464
1484
|
await listen(HAEXTENSION_EVENTS.FILE_CHANGED, (event) => {
|
|
@@ -1778,7 +1798,7 @@ function createMessageHandler(config, pendingRequests, extensionInfo, onEvent) {
|
|
|
1778
1798
|
}
|
|
1779
1799
|
};
|
|
1780
1800
|
}
|
|
1781
|
-
function processEvent(event, log, eventListeners, onContextChanged, onExternalRequest) {
|
|
1801
|
+
function processEvent(event, log, eventListeners, onContextChanged, onExternalRequest, onActionRequest) {
|
|
1782
1802
|
if (event.type === HAEXTENSION_EVENTS.CONTEXT_CHANGED) {
|
|
1783
1803
|
const contextEvent = event;
|
|
1784
1804
|
onContextChanged(contextEvent.data.context);
|
|
@@ -1789,6 +1809,13 @@ function processEvent(event, log, eventListeners, onContextChanged, onExternalRe
|
|
|
1789
1809
|
onExternalRequest(externalEvent);
|
|
1790
1810
|
return;
|
|
1791
1811
|
}
|
|
1812
|
+
if (event.type === EXTERNAL_EVENTS.ACTION_REQUEST) {
|
|
1813
|
+
const actionEvent = event;
|
|
1814
|
+
if (onActionRequest) {
|
|
1815
|
+
onActionRequest(actionEvent);
|
|
1816
|
+
}
|
|
1817
|
+
return;
|
|
1818
|
+
}
|
|
1792
1819
|
emitEvent(event, log, eventListeners);
|
|
1793
1820
|
}
|
|
1794
1821
|
function emitEvent(event, log, eventListeners) {
|
|
@@ -1925,6 +1952,12 @@ async function respondToExternalRequest(response, request) {
|
|
|
1925
1952
|
await request(EXTERNAL_BRIDGE_COMMANDS.respond, response);
|
|
1926
1953
|
}
|
|
1927
1954
|
|
|
1955
|
+
// src/commands/ai.ts
|
|
1956
|
+
var AI_COMMANDS = {
|
|
1957
|
+
/** Respond to an AI action request */
|
|
1958
|
+
actionRespond: "ai_action_respond"
|
|
1959
|
+
};
|
|
1960
|
+
|
|
1928
1961
|
// src/client.ts
|
|
1929
1962
|
var HaexVaultSdk = class {
|
|
1930
1963
|
constructor(config = {}) {
|
|
@@ -1946,6 +1979,12 @@ var HaexVaultSdk = class {
|
|
|
1946
1979
|
this.setupHook = null;
|
|
1947
1980
|
// Public APIs
|
|
1948
1981
|
this.orm = null;
|
|
1982
|
+
/** Unified action system - register handlers that work for both Bridge and AI requests */
|
|
1983
|
+
this.actions = {
|
|
1984
|
+
register: (action, handler) => {
|
|
1985
|
+
return this.onExternalRequest(action, handler);
|
|
1986
|
+
}
|
|
1987
|
+
};
|
|
1949
1988
|
this.config = {
|
|
1950
1989
|
debug: config.debug ?? false,
|
|
1951
1990
|
timeout: config.timeout ?? DEFAULT_TIMEOUT,
|
|
@@ -2235,12 +2274,23 @@ var HaexVaultSdk = class {
|
|
|
2235
2274
|
this._context = ctx;
|
|
2236
2275
|
this.notifySubscribersInternal();
|
|
2237
2276
|
},
|
|
2238
|
-
(extEvent) => this.handleExternalRequestInternal(extEvent.data)
|
|
2277
|
+
(extEvent) => this.handleExternalRequestInternal(extEvent.data),
|
|
2278
|
+
(actionEvent) => this.handleActionRequestInternal(actionEvent.data)
|
|
2239
2279
|
);
|
|
2240
2280
|
}
|
|
2241
2281
|
async handleExternalRequestInternal(request) {
|
|
2242
2282
|
await handleExternalRequest(request, this.externalRequestHandlers, this.respondToExternalRequest.bind(this), this.log.bind(this));
|
|
2243
2283
|
}
|
|
2284
|
+
async handleActionRequestInternal(request) {
|
|
2285
|
+
await handleExternalRequest(
|
|
2286
|
+
request,
|
|
2287
|
+
this.externalRequestHandlers,
|
|
2288
|
+
async (response) => {
|
|
2289
|
+
await this.request(AI_COMMANDS.actionRespond, response);
|
|
2290
|
+
},
|
|
2291
|
+
this.log.bind(this)
|
|
2292
|
+
);
|
|
2293
|
+
}
|
|
2244
2294
|
// ==========================================================================
|
|
2245
2295
|
// Private: Setup
|
|
2246
2296
|
// ==========================================================================
|