@haex-space/vault-sdk 2.6.7 → 2.7.1
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-CScVlK1m.d.ts → client-3B1iWut9.d.ts} +30 -2
- package/dist/{client-DvH4bGGw.d.mts → client-BUsw25aA.d.mts} +30 -2
- package/dist/index.d.mts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +77 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +77 -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 +67 -2
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +67 -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 +67 -2
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +67 -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 +67 -2
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +67 -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 +67 -2
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +67 -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-BUsw25aA.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-3B1iWut9.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
|
};
|
|
@@ -146,6 +148,8 @@ var FILESYSTEM_COMMANDS = {
|
|
|
146
148
|
rename: "extension_filesystem_rename",
|
|
147
149
|
/** Copy file or directory */
|
|
148
150
|
copy: "extension_filesystem_copy",
|
|
151
|
+
/** Get well-known system directory paths */
|
|
152
|
+
knownPaths: "extension_filesystem_known_paths",
|
|
149
153
|
// File watcher operations
|
|
150
154
|
/** Start watching a directory for changes */
|
|
151
155
|
watch: "extension_filesystem_watch",
|
|
@@ -595,6 +599,19 @@ var FilesystemAPI = class {
|
|
|
595
599
|
);
|
|
596
600
|
}
|
|
597
601
|
// ==========================================================================
|
|
602
|
+
// Known Paths (System Directories)
|
|
603
|
+
// ==========================================================================
|
|
604
|
+
/**
|
|
605
|
+
* Get well-known system directory paths (home, pictures, downloads, etc.)
|
|
606
|
+
* These paths are resolved via Tauri's PathResolver and are platform-aware.
|
|
607
|
+
* @returns Map of known path names to their absolute paths
|
|
608
|
+
*/
|
|
609
|
+
async knownPaths() {
|
|
610
|
+
return this.client.request(
|
|
611
|
+
FILESYSTEM_COMMANDS.knownPaths
|
|
612
|
+
);
|
|
613
|
+
}
|
|
614
|
+
// ==========================================================================
|
|
598
615
|
// File Watcher Operations
|
|
599
616
|
// ==========================================================================
|
|
600
617
|
/**
|
|
@@ -1459,6 +1476,24 @@ async function setupTauriEventListeners(ctx, log, onEvent, onContextChange) {
|
|
|
1459
1476
|
} catch (error) {
|
|
1460
1477
|
log("Failed to setup external request listener:", error);
|
|
1461
1478
|
}
|
|
1479
|
+
try {
|
|
1480
|
+
await listen(EXTERNAL_EVENTS.ACTION_REQUEST, (event) => {
|
|
1481
|
+
log("====== AI ACTION REQUEST RECEIVED ======");
|
|
1482
|
+
log("Payload:", JSON.stringify(event.payload));
|
|
1483
|
+
if (event.payload) {
|
|
1484
|
+
onEvent({
|
|
1485
|
+
type: EXTERNAL_EVENTS.ACTION_REQUEST,
|
|
1486
|
+
data: event.payload,
|
|
1487
|
+
timestamp: Date.now()
|
|
1488
|
+
});
|
|
1489
|
+
} else {
|
|
1490
|
+
log("AI action request event has no payload!");
|
|
1491
|
+
}
|
|
1492
|
+
});
|
|
1493
|
+
log("AI action request listener registered successfully");
|
|
1494
|
+
} catch (error) {
|
|
1495
|
+
log("Failed to setup AI action request listener:", error);
|
|
1496
|
+
}
|
|
1462
1497
|
log("Registering file change listener for:", HAEXTENSION_EVENTS.FILE_CHANGED);
|
|
1463
1498
|
try {
|
|
1464
1499
|
await listen(HAEXTENSION_EVENTS.FILE_CHANGED, (event) => {
|
|
@@ -1778,7 +1813,7 @@ function createMessageHandler(config, pendingRequests, extensionInfo, onEvent) {
|
|
|
1778
1813
|
}
|
|
1779
1814
|
};
|
|
1780
1815
|
}
|
|
1781
|
-
function processEvent(event, log, eventListeners, onContextChanged, onExternalRequest) {
|
|
1816
|
+
function processEvent(event, log, eventListeners, onContextChanged, onExternalRequest, onActionRequest) {
|
|
1782
1817
|
if (event.type === HAEXTENSION_EVENTS.CONTEXT_CHANGED) {
|
|
1783
1818
|
const contextEvent = event;
|
|
1784
1819
|
onContextChanged(contextEvent.data.context);
|
|
@@ -1789,6 +1824,13 @@ function processEvent(event, log, eventListeners, onContextChanged, onExternalRe
|
|
|
1789
1824
|
onExternalRequest(externalEvent);
|
|
1790
1825
|
return;
|
|
1791
1826
|
}
|
|
1827
|
+
if (event.type === EXTERNAL_EVENTS.ACTION_REQUEST) {
|
|
1828
|
+
const actionEvent = event;
|
|
1829
|
+
if (onActionRequest) {
|
|
1830
|
+
onActionRequest(actionEvent);
|
|
1831
|
+
}
|
|
1832
|
+
return;
|
|
1833
|
+
}
|
|
1792
1834
|
emitEvent(event, log, eventListeners);
|
|
1793
1835
|
}
|
|
1794
1836
|
function emitEvent(event, log, eventListeners) {
|
|
@@ -1925,6 +1967,12 @@ async function respondToExternalRequest(response, request) {
|
|
|
1925
1967
|
await request(EXTERNAL_BRIDGE_COMMANDS.respond, response);
|
|
1926
1968
|
}
|
|
1927
1969
|
|
|
1970
|
+
// src/commands/ai.ts
|
|
1971
|
+
var AI_COMMANDS = {
|
|
1972
|
+
/** Respond to an AI action request */
|
|
1973
|
+
actionRespond: "ai_action_respond"
|
|
1974
|
+
};
|
|
1975
|
+
|
|
1928
1976
|
// src/client.ts
|
|
1929
1977
|
var HaexVaultSdk = class {
|
|
1930
1978
|
constructor(config = {}) {
|
|
@@ -1946,6 +1994,12 @@ var HaexVaultSdk = class {
|
|
|
1946
1994
|
this.setupHook = null;
|
|
1947
1995
|
// Public APIs
|
|
1948
1996
|
this.orm = null;
|
|
1997
|
+
/** Unified action system - register handlers that work for both Bridge and AI requests */
|
|
1998
|
+
this.actions = {
|
|
1999
|
+
register: (action, handler) => {
|
|
2000
|
+
return this.onExternalRequest(action, handler);
|
|
2001
|
+
}
|
|
2002
|
+
};
|
|
1949
2003
|
this.config = {
|
|
1950
2004
|
debug: config.debug ?? false,
|
|
1951
2005
|
timeout: config.timeout ?? DEFAULT_TIMEOUT,
|
|
@@ -2235,12 +2289,23 @@ var HaexVaultSdk = class {
|
|
|
2235
2289
|
this._context = ctx;
|
|
2236
2290
|
this.notifySubscribersInternal();
|
|
2237
2291
|
},
|
|
2238
|
-
(extEvent) => this.handleExternalRequestInternal(extEvent.data)
|
|
2292
|
+
(extEvent) => this.handleExternalRequestInternal(extEvent.data),
|
|
2293
|
+
(actionEvent) => this.handleActionRequestInternal(actionEvent.data)
|
|
2239
2294
|
);
|
|
2240
2295
|
}
|
|
2241
2296
|
async handleExternalRequestInternal(request) {
|
|
2242
2297
|
await handleExternalRequest(request, this.externalRequestHandlers, this.respondToExternalRequest.bind(this), this.log.bind(this));
|
|
2243
2298
|
}
|
|
2299
|
+
async handleActionRequestInternal(request) {
|
|
2300
|
+
await handleExternalRequest(
|
|
2301
|
+
request,
|
|
2302
|
+
this.externalRequestHandlers,
|
|
2303
|
+
async (response) => {
|
|
2304
|
+
await this.request(AI_COMMANDS.actionRespond, response);
|
|
2305
|
+
},
|
|
2306
|
+
this.log.bind(this)
|
|
2307
|
+
);
|
|
2308
|
+
}
|
|
2244
2309
|
// ==========================================================================
|
|
2245
2310
|
// Private: Setup
|
|
2246
2311
|
// ==========================================================================
|