liangzimixin 0.2.10 → 0.2.12

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
@@ -17462,6 +17462,12 @@ var AccountConfigSchema = external_exports.object({
17462
17462
  * 生产环境: https://cmsp.zdxlz.com:8552
17463
17463
  */
17464
17464
  "quantum-url": external_exports.string().url().optional().default("https://cmsp.zdxlz.com:8552"),
17465
+ /**
17466
+ * 🟡 环境开关 — 切换 API 环境
17467
+ * production: 线上环境 (https://imtwo.zdxlz.com/open-apis/v1)
17468
+ * test: 联调环境 (https://mxpre.zdxlz.com:1443/open-apis/v1)
17469
+ */
17470
+ env: external_exports.enum(["production", "test"]).optional().default("production"),
17465
17471
  /**
17466
17472
  * 🟡 Bot 自己的用户 ID — 用于 anti-loop 检查
17467
17473
  * 如果不填,需要通过其他 API 在运行时获取。
@@ -17475,6 +17481,7 @@ var AccountConfigSchema = external_exports.object({
17475
17481
  quantumAppSecret: raw["quantum-appSecret"],
17476
17482
  pin: raw.pin,
17477
17483
  quantumUrl: raw["quantum-url"],
17484
+ env: raw.env,
17478
17485
  botUserId: raw.botUserId
17479
17486
  }));
17480
17487
  var DEFAULT_INTERNAL_CONFIG = {
@@ -17493,7 +17500,7 @@ var DEFAULT_INTERNAL_CONFIG = {
17493
17500
  }
17494
17501
  },
17495
17502
  auth: {
17496
- serverUrl: process.env.LZMX_AUTH_URL || "https://imtwo.zdxlz.com/open-apis/v1",
17503
+ serverUrl: process.env.LZMX_AUTH_URL || "https://mxpre.zdxlz.com:1443/open-apis/v1",
17497
17504
  refreshAheadMs: 3e5
17498
17505
  },
17499
17506
  crypto: {
@@ -17513,8 +17520,14 @@ var DEFAULT_INTERNAL_CONFIG = {
17513
17520
  allowPrivateNetwork: false
17514
17521
  }
17515
17522
  };
17523
+ var ENV_URL_MAP = {
17524
+ production: "https://imtwo.zdxlz.com/open-apis/v1",
17525
+ test: "https://mxpre.zdxlz.com:1443/open-apis/v1"
17526
+ };
17516
17527
  function buildPluginConfig(accountConfig, internalOverrides) {
17517
17528
  const internal = { ...DEFAULT_INTERNAL_CONFIG, ...internalOverrides };
17529
+ const serverUrl = process.env.LZMX_AUTH_URL || ENV_URL_MAP[accountConfig.env] || ENV_URL_MAP.production;
17530
+ internal.auth = { ...internal.auth, serverUrl };
17518
17531
  return {
17519
17532
  ...internal,
17520
17533
  credentials: accountConfig
@@ -18866,8 +18879,6 @@ var quantumImPlugin = {
18866
18879
  };
18867
18880
 
18868
18881
  // src/crypto/quantun-plug-adapter.ts
18869
- var import_node_module = require("module");
18870
- var import_meta = {};
18871
18882
  var log14 = createLogger("crypto/quantun-plug-adapter");
18872
18883
  var SM4_MODE = {
18873
18884
  ECB_NOPADDING: 1,
@@ -18876,26 +18887,17 @@ var SM4_MODE = {
18876
18887
  CBC_PKCS7PADDING: 4
18877
18888
  };
18878
18889
  var DEFAULT_ENCRYPT_MODE = SM4_MODE.CBC_PKCS7PADDING;
18879
- var require2 = (0, import_node_module.createRequire)(
18880
- typeof __filename !== "undefined" ? __filename : import_meta.url
18881
- );
18882
18890
  var quantunPlug = null;
18883
- try {
18884
- quantunPlug = require2("./sdk/index.min.cjs");
18885
- log14.info("Quantum SDK loaded from sdk/index.min.cjs");
18886
- } catch (err) {
18887
- const msg = err instanceof Error ? err.message : String(err);
18888
- log14.warn("Quantum SDK missing, only passthrough mode will work:", msg);
18889
- }
18891
+ log14.info("Quantum SDK loading disabled \u2014 passthrough mode only");
18890
18892
  var quantun_plug_adapter_default = quantunPlug;
18891
18893
 
18892
18894
  // src/crypto/quantum-config-writer.ts
18893
18895
  var import_node_fs = require("fs");
18894
18896
  var import_node_path = require("path");
18895
18897
  var import_node_url = require("url");
18896
- var import_meta2 = {};
18898
+ var import_meta = {};
18897
18899
  var log15 = createLogger("crypto/quantum-config-writer");
18898
- var currentDir = typeof __dirname !== "undefined" ? __dirname : (0, import_node_path.dirname)((0, import_node_url.fileURLToPath)(import_meta2.url));
18900
+ var currentDir = typeof __dirname !== "undefined" ? __dirname : (0, import_node_path.dirname)((0, import_node_url.fileURLToPath)(import_meta.url));
18899
18901
  var QUANTUM_JSON_PATH = (0, import_node_path.join)(currentDir, "sdk", "quantum.json");
18900
18902
  function writeQuantumConfig(credentials) {
18901
18903
  const sdkConfig = {
package/dist/index.d.cts CHANGED
@@ -23,6 +23,10 @@ declare const AccountConfigSchema: z.ZodPipe<z.ZodObject<{
23
23
  'quantum-appSecret': z.ZodString;
24
24
  pin: z.ZodString;
25
25
  'quantum-url': z.ZodDefault<z.ZodOptional<z.ZodString>>;
26
+ env: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
27
+ production: "production";
28
+ test: "test";
29
+ }>>>;
26
30
  botUserId: z.ZodOptional<z.ZodString>;
27
31
  }, z.core.$strip>, z.ZodTransform<{
28
32
  appId: string;
@@ -32,6 +36,7 @@ declare const AccountConfigSchema: z.ZodPipe<z.ZodObject<{
32
36
  quantumAppSecret: string;
33
37
  pin: string;
34
38
  quantumUrl: string;
39
+ env: "production" | "test";
35
40
  botUserId: string | undefined;
36
41
  }, {
37
42
  appId: string;
@@ -41,6 +46,7 @@ declare const AccountConfigSchema: z.ZodPipe<z.ZodObject<{
41
46
  'quantum-appSecret': string;
42
47
  pin: string;
43
48
  'quantum-url': string;
49
+ env: "production" | "test";
44
50
  botUserId?: string | undefined;
45
51
  }>>;
46
52
  type AccountConfig = z.output<typeof AccountConfigSchema>;
@@ -117,12 +123,6 @@ interface PluginConfig extends InternalConfig {
117
123
  /** 用户凭据(从 openclaw.json 解析并转换后的结果) */
118
124
  credentials: AccountConfig;
119
125
  }
120
- /**
121
- * 合并用户配置与内部配置,生成完整的运行时配置。
122
- *
123
- * @param accountConfig - 已解析的用户账户配置
124
- * @param internalOverrides - 可选的内部配置覆盖(用于测试或特殊部署)
125
- */
126
126
  declare function buildPluginConfig(accountConfig: AccountConfig, internalOverrides?: Partial<InternalConfig>): PluginConfig;
127
127
 
128
128
  /**
@@ -18018,6 +18018,12 @@ var AccountConfigSchema = external_exports.object({
18018
18018
  * 生产环境: https://cmsp.zdxlz.com:8552
18019
18019
  */
18020
18020
  "quantum-url": external_exports.string().url().optional().default("https://cmsp.zdxlz.com:8552"),
18021
+ /**
18022
+ * 🟡 环境开关 — 切换 API 环境
18023
+ * production: 线上环境 (https://imtwo.zdxlz.com/open-apis/v1)
18024
+ * test: 联调环境 (https://mxpre.zdxlz.com:1443/open-apis/v1)
18025
+ */
18026
+ env: external_exports.enum(["production", "test"]).optional().default("production"),
18021
18027
  /**
18022
18028
  * 🟡 Bot 自己的用户 ID — 用于 anti-loop 检查
18023
18029
  * 如果不填,需要通过其他 API 在运行时获取。
@@ -18031,6 +18037,7 @@ var AccountConfigSchema = external_exports.object({
18031
18037
  quantumAppSecret: raw["quantum-appSecret"],
18032
18038
  pin: raw.pin,
18033
18039
  quantumUrl: raw["quantum-url"],
18040
+ env: raw.env,
18034
18041
  botUserId: raw.botUserId
18035
18042
  }));
18036
18043
  var DEFAULT_INTERNAL_CONFIG = {
@@ -18049,7 +18056,7 @@ var DEFAULT_INTERNAL_CONFIG = {
18049
18056
  }
18050
18057
  },
18051
18058
  auth: {
18052
- serverUrl: process.env.LZMX_AUTH_URL || "https://imtwo.zdxlz.com/open-apis/v1",
18059
+ serverUrl: process.env.LZMX_AUTH_URL || "https://mxpre.zdxlz.com:1443/open-apis/v1",
18053
18060
  refreshAheadMs: 3e5
18054
18061
  },
18055
18062
  crypto: {
@@ -18069,8 +18076,14 @@ var DEFAULT_INTERNAL_CONFIG = {
18069
18076
  allowPrivateNetwork: false
18070
18077
  }
18071
18078
  };
18079
+ var ENV_URL_MAP = {
18080
+ production: "https://imtwo.zdxlz.com/open-apis/v1",
18081
+ test: "https://mxpre.zdxlz.com:1443/open-apis/v1"
18082
+ };
18072
18083
  function buildPluginConfig(accountConfig, internalOverrides) {
18073
18084
  const internal = { ...DEFAULT_INTERNAL_CONFIG, ...internalOverrides };
18085
+ const serverUrl = process.env.LZMX_AUTH_URL || ENV_URL_MAP[accountConfig.env] || ENV_URL_MAP.production;
18086
+ internal.auth = { ...internal.auth, serverUrl };
18074
18087
  return {
18075
18088
  ...internal,
18076
18089
  credentials: accountConfig
@@ -18078,8 +18091,6 @@ function buildPluginConfig(accountConfig, internalOverrides) {
18078
18091
  }
18079
18092
 
18080
18093
  // src/crypto/quantun-plug-adapter.ts
18081
- var import_node_module = require("module");
18082
- var import_meta = {};
18083
18094
  var log5 = createLogger("crypto/quantun-plug-adapter");
18084
18095
  var SM4_MODE = {
18085
18096
  ECB_NOPADDING: 1,
@@ -18088,26 +18099,17 @@ var SM4_MODE = {
18088
18099
  CBC_PKCS7PADDING: 4
18089
18100
  };
18090
18101
  var DEFAULT_ENCRYPT_MODE = SM4_MODE.CBC_PKCS7PADDING;
18091
- var require2 = (0, import_node_module.createRequire)(
18092
- typeof __filename !== "undefined" ? __filename : import_meta.url
18093
- );
18094
18102
  var quantunPlug = null;
18095
- try {
18096
- quantunPlug = require2("./sdk/index.min.cjs");
18097
- log5.info("Quantum SDK loaded from sdk/index.min.cjs");
18098
- } catch (err) {
18099
- const msg = err instanceof Error ? err.message : String(err);
18100
- log5.warn("Quantum SDK missing, only passthrough mode will work:", msg);
18101
- }
18103
+ log5.info("Quantum SDK loading disabled \u2014 passthrough mode only");
18102
18104
  var quantun_plug_adapter_default = quantunPlug;
18103
18105
 
18104
18106
  // src/crypto/quantum-config-writer.ts
18105
18107
  var import_node_fs = require("fs");
18106
18108
  var import_node_path = require("path");
18107
18109
  var import_node_url = require("url");
18108
- var import_meta2 = {};
18110
+ var import_meta = {};
18109
18111
  var log6 = createLogger("crypto/quantum-config-writer");
18110
- var currentDir = typeof __dirname !== "undefined" ? __dirname : (0, import_node_path.dirname)((0, import_node_url.fileURLToPath)(import_meta2.url));
18112
+ var currentDir = typeof __dirname !== "undefined" ? __dirname : (0, import_node_path.dirname)((0, import_node_url.fileURLToPath)(import_meta.url));
18111
18113
  var QUANTUM_JSON_PATH = (0, import_node_path.join)(currentDir, "sdk", "quantum.json");
18112
18114
  function writeQuantumConfig(credentials) {
18113
18115
  const sdkConfig = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "liangzimixin",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "description": "Quantum-encrypted IM channel plugin for OpenClaw",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",