liangzimixin 0.3.39 → 0.3.40

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/index.cjs CHANGED
@@ -17569,7 +17569,7 @@ var import_plugin_sdk3 = require("openclaw/plugin-sdk");
17569
17569
 
17570
17570
  // src/file/media.ts
17571
17571
  var path = __toESM(require("path"), 1);
17572
- var fs = __toESM(require("fs"), 1);
17572
+ var fs = __toESM(require("fs/promises"), 1);
17573
17573
 
17574
17574
  // src/types.ts
17575
17575
  var EncryptionStrategy = /* @__PURE__ */ ((EncryptionStrategy2) => {
@@ -17827,8 +17827,8 @@ async function uploadMedia(params) {
17827
17827
  if (Buffer.isBuffer(file2)) {
17828
17828
  buffer = file2;
17829
17829
  } else {
17830
- const { readFile: readFile2 } = await import("fs/promises");
17831
- buffer = await readFile2(file2);
17830
+ const { readFile: readFile3 } = await import("fs/promises");
17831
+ buffer = await readFile3(file2);
17832
17832
  }
17833
17833
  const maxBytes = maxFileSizeMb * 1024 * 1024;
17834
17834
  if (buffer.length > maxBytes) {
@@ -18042,7 +18042,7 @@ async function resolveAndUploadMedia(params) {
18042
18042
  const filePath = mediaUrl.startsWith("file://") ? mediaUrl.slice(7) : mediaUrl;
18043
18043
  log3.info("media:source=local", { filePath });
18044
18044
  validateLocalPath(filePath, allowedLocalRoots);
18045
- buffer = fs.readFileSync(filePath);
18045
+ buffer = await fs.readFile(filePath);
18046
18046
  if (!params.fileName) {
18047
18047
  fileName = path.basename(filePath);
18048
18048
  }
@@ -20870,15 +20870,22 @@ async function startPlugin(accountConfig, internalOverrides) {
20870
20870
  log25.info("Config built \u2713", { pluginId: config2.pluginId });
20871
20871
  let cryptoEngine;
20872
20872
  if (config2.crypto.enabled && accountConfig.quantumAccount) {
20873
- cryptoEngine = new CryptoEngine(
20874
- {
20875
- appId: accountConfig.appId,
20876
- quantumAccount: accountConfig.quantumAccount
20877
- },
20878
- config2.env
20879
- );
20880
- await cryptoEngine.init();
20881
- log25.info("Crypto initialized \u2713");
20873
+ try {
20874
+ cryptoEngine = new CryptoEngine(
20875
+ {
20876
+ appId: accountConfig.appId,
20877
+ quantumAccount: accountConfig.quantumAccount
20878
+ },
20879
+ config2.env
20880
+ );
20881
+ await cryptoEngine.init();
20882
+ log25.info("Crypto initialized \u2713");
20883
+ } catch (err) {
20884
+ log25.warn("Crypto init failed, falling back to passthrough mode", {
20885
+ error: err instanceof Error ? err.message : String(err)
20886
+ });
20887
+ cryptoEngine = CryptoEngine.createPassthrough();
20888
+ }
20882
20889
  } else {
20883
20890
  cryptoEngine = CryptoEngine.createPassthrough();
20884
20891
  const reason = !config2.crypto.enabled ? "disabled by config" : "quantumAccount not provided";
@@ -3658,7 +3658,7 @@ var import_plugin_sdk3 = require("openclaw/plugin-sdk");
3658
3658
 
3659
3659
  // src/file/media.ts
3660
3660
  var path = __toESM(require("path"), 1);
3661
- var fs = __toESM(require("fs"), 1);
3661
+ var fs = __toESM(require("fs/promises"), 1);
3662
3662
 
3663
3663
  // src/types.ts
3664
3664
  var FileServiceError = class extends Error {
@@ -3922,8 +3922,8 @@ async function uploadMedia(params) {
3922
3922
  if (Buffer.isBuffer(file2)) {
3923
3923
  buffer = file2;
3924
3924
  } else {
3925
- const { readFile: readFile2 } = await import("fs/promises");
3926
- buffer = await readFile2(file2);
3925
+ const { readFile: readFile3 } = await import("fs/promises");
3926
+ buffer = await readFile3(file2);
3927
3927
  }
3928
3928
  const maxBytes = maxFileSizeMb * 1024 * 1024;
3929
3929
  if (buffer.length > maxBytes) {
@@ -4137,7 +4137,7 @@ async function resolveAndUploadMedia(params) {
4137
4137
  const filePath = mediaUrl.startsWith("file://") ? mediaUrl.slice(7) : mediaUrl;
4138
4138
  log3.info("media:source=local", { filePath });
4139
4139
  validateLocalPath(filePath, allowedLocalRoots);
4140
- buffer = fs.readFileSync(filePath);
4140
+ buffer = await fs.readFile(filePath);
4141
4141
  if (!params.fileName) {
4142
4142
  fileName = path.basename(filePath);
4143
4143
  }
@@ -19999,15 +19999,22 @@ async function startPlugin(accountConfig, internalOverrides) {
19999
19999
  log16.info("Config built \u2713", { pluginId: config2.pluginId });
20000
20000
  let cryptoEngine;
20001
20001
  if (config2.crypto.enabled && accountConfig.quantumAccount) {
20002
- cryptoEngine = new CryptoEngine(
20003
- {
20004
- appId: accountConfig.appId,
20005
- quantumAccount: accountConfig.quantumAccount
20006
- },
20007
- config2.env
20008
- );
20009
- await cryptoEngine.init();
20010
- log16.info("Crypto initialized \u2713");
20002
+ try {
20003
+ cryptoEngine = new CryptoEngine(
20004
+ {
20005
+ appId: accountConfig.appId,
20006
+ quantumAccount: accountConfig.quantumAccount
20007
+ },
20008
+ config2.env
20009
+ );
20010
+ await cryptoEngine.init();
20011
+ log16.info("Crypto initialized \u2713");
20012
+ } catch (err) {
20013
+ log16.warn("Crypto init failed, falling back to passthrough mode", {
20014
+ error: err instanceof Error ? err.message : String(err)
20015
+ });
20016
+ cryptoEngine = CryptoEngine.createPassthrough();
20017
+ }
20011
20018
  } else {
20012
20019
  cryptoEngine = CryptoEngine.createPassthrough();
20013
20020
  const reason = !config2.crypto.enabled ? "disabled by config" : "quantumAccount not provided";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "liangzimixin",
3
- "version": "0.3.39",
3
+ "version": "0.3.40",
4
4
  "description": "Quantum-encrypted IM channel plugin for OpenClaw",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",