@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/node.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { H as HaextensionConfig, g as getExtensionDir, r as readHaextensionConfig } from './config-D_HXjsEV.mjs';
2
- import { E as ExtensionManifest } from './types-B1O6KckK.mjs';
2
+ import { E as ExtensionManifest } from './types-DmCSegdY.mjs';
3
3
 
4
4
  interface ReadManifestOptions {
5
5
  /** Root directory of the project */
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { H as HaextensionConfig, g as getExtensionDir, r as readHaextensionConfig } from './config-D_HXjsEV.js';
2
- import { E as ExtensionManifest } from './types-B1O6KckK.js';
2
+ import { E as ExtensionManifest } from './types-DmCSegdY.js';
3
3
 
4
4
  interface ReadManifestOptions {
5
5
  /** Root directory of the project */
package/dist/react.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { H as HaexVaultSdk, S as StorageAPI } from './client-B1X-GsnG.mjs';
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
- import { H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext } from './types-B1O6KckK.mjs';
3
+ import { H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext } from './types-DmCSegdY.mjs';
4
4
 
5
5
  /**
6
6
  * React hook for HaexVault SDK
package/dist/react.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { H as HaexVaultSdk, S as StorageAPI } from './client-BzH5VGzL.js';
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
- import { H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext } from './types-B1O6KckK.js';
3
+ import { H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext } from './types-DmCSegdY.js';
4
4
 
5
5
  /**
6
6
  * React hook for HaexVault SDK
package/dist/react.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, extensionInfo, 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
  // ==========================================================================