@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
|
@@ -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-BUsw25aA.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-3B1iWut9.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
|
};
|
|
@@ -512,6 +514,8 @@ var FILESYSTEM_COMMANDS = {
|
|
|
512
514
|
rename: "extension_filesystem_rename",
|
|
513
515
|
/** Copy file or directory */
|
|
514
516
|
copy: "extension_filesystem_copy",
|
|
517
|
+
/** Get well-known system directory paths */
|
|
518
|
+
knownPaths: "extension_filesystem_known_paths",
|
|
515
519
|
// File watcher operations
|
|
516
520
|
/** Start watching a directory for changes */
|
|
517
521
|
watch: "extension_filesystem_watch",
|
|
@@ -935,6 +939,19 @@ var FilesystemAPI = class {
|
|
|
935
939
|
);
|
|
936
940
|
}
|
|
937
941
|
// ==========================================================================
|
|
942
|
+
// Known Paths (System Directories)
|
|
943
|
+
// ==========================================================================
|
|
944
|
+
/**
|
|
945
|
+
* Get well-known system directory paths (home, pictures, downloads, etc.)
|
|
946
|
+
* These paths are resolved via Tauri's PathResolver and are platform-aware.
|
|
947
|
+
* @returns Map of known path names to their absolute paths
|
|
948
|
+
*/
|
|
949
|
+
async knownPaths() {
|
|
950
|
+
return this.client.request(
|
|
951
|
+
FILESYSTEM_COMMANDS.knownPaths
|
|
952
|
+
);
|
|
953
|
+
}
|
|
954
|
+
// ==========================================================================
|
|
938
955
|
// File Watcher Operations
|
|
939
956
|
// ==========================================================================
|
|
940
957
|
/**
|
|
@@ -1726,6 +1743,24 @@ async function setupTauriEventListeners(ctx, log, onEvent, onContextChange) {
|
|
|
1726
1743
|
} catch (error) {
|
|
1727
1744
|
log("Failed to setup external request listener:", error);
|
|
1728
1745
|
}
|
|
1746
|
+
try {
|
|
1747
|
+
await listen(EXTERNAL_EVENTS.ACTION_REQUEST, (event) => {
|
|
1748
|
+
log("====== AI ACTION REQUEST RECEIVED ======");
|
|
1749
|
+
log("Payload:", JSON.stringify(event.payload));
|
|
1750
|
+
if (event.payload) {
|
|
1751
|
+
onEvent({
|
|
1752
|
+
type: EXTERNAL_EVENTS.ACTION_REQUEST,
|
|
1753
|
+
data: event.payload,
|
|
1754
|
+
timestamp: Date.now()
|
|
1755
|
+
});
|
|
1756
|
+
} else {
|
|
1757
|
+
log("AI action request event has no payload!");
|
|
1758
|
+
}
|
|
1759
|
+
});
|
|
1760
|
+
log("AI action request listener registered successfully");
|
|
1761
|
+
} catch (error) {
|
|
1762
|
+
log("Failed to setup AI action request listener:", error);
|
|
1763
|
+
}
|
|
1729
1764
|
log("Registering file change listener for:", HAEXTENSION_EVENTS.FILE_CHANGED);
|
|
1730
1765
|
try {
|
|
1731
1766
|
await listen(HAEXTENSION_EVENTS.FILE_CHANGED, (event) => {
|
|
@@ -2045,7 +2080,7 @@ function createMessageHandler(config, pendingRequests, extensionInfo2, onEvent)
|
|
|
2045
2080
|
}
|
|
2046
2081
|
};
|
|
2047
2082
|
}
|
|
2048
|
-
function processEvent(event, log, eventListeners, onContextChanged, onExternalRequest) {
|
|
2083
|
+
function processEvent(event, log, eventListeners, onContextChanged, onExternalRequest, onActionRequest) {
|
|
2049
2084
|
if (event.type === HAEXTENSION_EVENTS.CONTEXT_CHANGED) {
|
|
2050
2085
|
const contextEvent = event;
|
|
2051
2086
|
onContextChanged(contextEvent.data.context);
|
|
@@ -2056,6 +2091,13 @@ function processEvent(event, log, eventListeners, onContextChanged, onExternalRe
|
|
|
2056
2091
|
onExternalRequest(externalEvent);
|
|
2057
2092
|
return;
|
|
2058
2093
|
}
|
|
2094
|
+
if (event.type === EXTERNAL_EVENTS.ACTION_REQUEST) {
|
|
2095
|
+
const actionEvent = event;
|
|
2096
|
+
if (onActionRequest) {
|
|
2097
|
+
onActionRequest(actionEvent);
|
|
2098
|
+
}
|
|
2099
|
+
return;
|
|
2100
|
+
}
|
|
2059
2101
|
emitEvent(event, log, eventListeners);
|
|
2060
2102
|
}
|
|
2061
2103
|
function emitEvent(event, log, eventListeners) {
|
|
@@ -2192,6 +2234,12 @@ async function respondToExternalRequest(response, request) {
|
|
|
2192
2234
|
await request(EXTERNAL_BRIDGE_COMMANDS.respond, response);
|
|
2193
2235
|
}
|
|
2194
2236
|
|
|
2237
|
+
// src/commands/ai.ts
|
|
2238
|
+
var AI_COMMANDS = {
|
|
2239
|
+
/** Respond to an AI action request */
|
|
2240
|
+
actionRespond: "ai_action_respond"
|
|
2241
|
+
};
|
|
2242
|
+
|
|
2195
2243
|
// src/client.ts
|
|
2196
2244
|
var HaexVaultSdk = class {
|
|
2197
2245
|
constructor(config = {}) {
|
|
@@ -2213,6 +2261,12 @@ var HaexVaultSdk = class {
|
|
|
2213
2261
|
this.setupHook = null;
|
|
2214
2262
|
// Public APIs
|
|
2215
2263
|
this.orm = null;
|
|
2264
|
+
/** Unified action system - register handlers that work for both Bridge and AI requests */
|
|
2265
|
+
this.actions = {
|
|
2266
|
+
register: (action, handler) => {
|
|
2267
|
+
return this.onExternalRequest(action, handler);
|
|
2268
|
+
}
|
|
2269
|
+
};
|
|
2216
2270
|
this.config = {
|
|
2217
2271
|
debug: config.debug ?? false,
|
|
2218
2272
|
timeout: config.timeout ?? DEFAULT_TIMEOUT,
|
|
@@ -2502,12 +2556,23 @@ var HaexVaultSdk = class {
|
|
|
2502
2556
|
this._context = ctx;
|
|
2503
2557
|
this.notifySubscribersInternal();
|
|
2504
2558
|
},
|
|
2505
|
-
(extEvent) => this.handleExternalRequestInternal(extEvent.data)
|
|
2559
|
+
(extEvent) => this.handleExternalRequestInternal(extEvent.data),
|
|
2560
|
+
(actionEvent) => this.handleActionRequestInternal(actionEvent.data)
|
|
2506
2561
|
);
|
|
2507
2562
|
}
|
|
2508
2563
|
async handleExternalRequestInternal(request) {
|
|
2509
2564
|
await handleExternalRequest(request, this.externalRequestHandlers, this.respondToExternalRequest.bind(this), this.log.bind(this));
|
|
2510
2565
|
}
|
|
2566
|
+
async handleActionRequestInternal(request) {
|
|
2567
|
+
await handleExternalRequest(
|
|
2568
|
+
request,
|
|
2569
|
+
this.externalRequestHandlers,
|
|
2570
|
+
async (response) => {
|
|
2571
|
+
await this.request(AI_COMMANDS.actionRespond, response);
|
|
2572
|
+
},
|
|
2573
|
+
this.log.bind(this)
|
|
2574
|
+
);
|
|
2575
|
+
}
|
|
2511
2576
|
// ==========================================================================
|
|
2512
2577
|
// Private: Setup
|
|
2513
2578
|
// ==========================================================================
|