@digitalforgestudios/openclaw-sulcus 3.5.2 → 3.5.3

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.
Files changed (2) hide show
  1. package/index.ts +33 -38
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -770,53 +770,48 @@ const sulcusPlugin = {
770
770
  // ── Load hooks config (config-driven dispatch) ──
771
771
  const hooksConfig = loadHooksConfig(api.pluginConfig);
772
772
 
773
- // ── Load native dylibs ──
774
- const nativeLoader = new NativeLibLoader(storeLibPath, vectorsLibPath);
775
- nativeLoader.init(api.logger);
776
-
777
- // ── Load WASM module ──
773
+ // ── Backend init: cloud-first, then local ──
778
774
  let sulcusMem: any = null;
779
775
  let backendMode = "unavailable";
776
+ const nativeLoader = new NativeLibLoader(storeLibPath, vectorsLibPath);
780
777
 
781
- if (nativeLoader.loaded) {
782
- const wasmJsPath = resolve(wasmDir, "sulcus_wasm.js");
783
- if (existsSync(wasmJsPath)) {
784
- try {
785
- const { SulcusMem, on_init } = require(wasmJsPath);
786
- // on_init sets up WASM internals (panic hooks etc.)
787
- if (typeof on_init === "function") on_init();
788
-
789
- const queryFn = nativeLoader.makeQueryFn();
790
- const embedFn = nativeLoader.makeEmbedFn();
791
- sulcusMem = SulcusMem.create(queryFn, embedFn);
792
- backendMode = "wasm";
793
- api.logger.info(`sulcus: SulcusMem created via WASM (wasm: ${wasmJsPath})`);
794
- } catch (e: any) {
795
- api.logger.warn(`sulcus: WASM load failed: ${e.message}`);
796
- backendMode = "unavailable";
797
- }
798
- } else {
799
- api.logger.warn(`sulcus: WASM module not found at ${wasmJsPath}`);
778
+ // Priority 1: Cloud mode — if serverUrl + apiKey are configured, use HTTP.
779
+ // No local dylibs needed. This is the path for cloud-only users.
780
+ if (serverUrl && apiKey) {
781
+ try {
782
+ const cloudClient = new SulcusCloudClient(serverUrl, apiKey);
783
+ sulcusMem = cloudClient;
784
+ backendMode = "cloud";
785
+ api.logger.info(`sulcus: using cloud backend (server: ${serverUrl})`);
786
+ } catch (e: any) {
787
+ api.logger.warn(`sulcus: cloud client init failed: ${e.message}`);
800
788
  }
801
- } else {
802
- api.logger.warn(`sulcus: native libs unavailable — ${nativeLoader.error}`);
803
789
  }
804
790
 
805
- // ── Cloud HTTP fallback ──
806
- // Activates only when local WASM/native libs are unavailable AND
807
- // serverUrl + apiKey are configured. Zero external dependencies.
791
+ // Priority 2: Local WASM+native — if cloud isn't configured or failed,
792
+ // try loading native dylibs + WASM module for fully local operation.
808
793
  if (sulcusMem === null) {
809
- if (serverUrl && apiKey) {
810
- try {
811
- const cloudClient = new SulcusCloudClient(serverUrl, apiKey);
812
- sulcusMem = cloudClient;
813
- backendMode = "cloud";
814
- api.logger.info(`sulcus: using cloud backend (server: ${serverUrl})`);
815
- } catch (e: any) {
816
- api.logger.warn(`sulcus: cloud client init failed: ${e.message}`);
794
+ nativeLoader.init(api.logger);
795
+ if (nativeLoader.loaded) {
796
+ const wasmJsPath = resolve(wasmDir, "sulcus_wasm.js");
797
+ if (existsSync(wasmJsPath)) {
798
+ try {
799
+ const { SulcusMem, on_init } = require(wasmJsPath);
800
+ if (typeof on_init === "function") on_init();
801
+
802
+ const queryFn = nativeLoader.makeQueryFn();
803
+ const embedFn = nativeLoader.makeEmbedFn();
804
+ sulcusMem = SulcusMem.create(queryFn, embedFn);
805
+ backendMode = "wasm";
806
+ api.logger.info(`sulcus: SulcusMem created via WASM (wasm: ${wasmJsPath})`);
807
+ } catch (e: any) {
808
+ api.logger.warn(`sulcus: WASM load failed: ${e.message}`);
809
+ }
810
+ } else {
811
+ api.logger.warn(`sulcus: WASM module not found at ${wasmJsPath}`);
817
812
  }
818
813
  } else {
819
- api.logger.info(`sulcus: no cloud fallbackserverUrl: ${serverUrl ? "set" : "missing"}, apiKey: ${apiKey ? "set" : "missing"}`);
814
+ api.logger.info(`sulcus: local mode skipped — ${nativeLoader.error || "dylibs not found"}`);
820
815
  }
821
816
  }
822
817
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalforgestudios/openclaw-sulcus",
3
- "version": "3.5.2",
3
+ "version": "3.5.3",
4
4
  "description": "Sulcus — reactive, thermodynamic memory plugin for OpenClaw. Opt-in persistent memory with heat-based decay, semantic search, and cross-agent sync. Auto-recall and auto-capture disabled by default.",
5
5
  "keywords": [
6
6
  "openclaw",