liangzimixin 0.2.12 → 0.2.14
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 +20 -24
- package/dist/index.d.cts +6 -6
- package/dist/setup-entry.cjs +19 -23
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -17462,12 +17462,6 @@ 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"),
|
|
17471
17465
|
/**
|
|
17472
17466
|
* 🟡 Bot 自己的用户 ID — 用于 anti-loop 检查
|
|
17473
17467
|
* 如果不填,需要通过其他 API 在运行时获取。
|
|
@@ -17481,7 +17475,6 @@ var AccountConfigSchema = external_exports.object({
|
|
|
17481
17475
|
quantumAppSecret: raw["quantum-appSecret"],
|
|
17482
17476
|
pin: raw.pin,
|
|
17483
17477
|
quantumUrl: raw["quantum-url"],
|
|
17484
|
-
env: raw.env,
|
|
17485
17478
|
botUserId: raw.botUserId
|
|
17486
17479
|
}));
|
|
17487
17480
|
var DEFAULT_INTERNAL_CONFIG = {
|
|
@@ -17500,11 +17493,11 @@ var DEFAULT_INTERNAL_CONFIG = {
|
|
|
17500
17493
|
}
|
|
17501
17494
|
},
|
|
17502
17495
|
auth: {
|
|
17503
|
-
serverUrl: process.env.LZMX_AUTH_URL || "https://
|
|
17496
|
+
serverUrl: process.env.LZMX_AUTH_URL || "https://imtwo.zdxlz.com/open-apis/v1",
|
|
17504
17497
|
refreshAheadMs: 3e5
|
|
17505
17498
|
},
|
|
17506
17499
|
crypto: {
|
|
17507
|
-
enabled:
|
|
17500
|
+
enabled: true,
|
|
17508
17501
|
keySource: "env",
|
|
17509
17502
|
envKey: "QUANTUM_ENCRYPTION_KEY"
|
|
17510
17503
|
},
|
|
@@ -17520,14 +17513,8 @@ var DEFAULT_INTERNAL_CONFIG = {
|
|
|
17520
17513
|
allowPrivateNetwork: false
|
|
17521
17514
|
}
|
|
17522
17515
|
};
|
|
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
|
-
};
|
|
17527
17516
|
function buildPluginConfig(accountConfig, internalOverrides) {
|
|
17528
17517
|
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 };
|
|
17531
17518
|
return {
|
|
17532
17519
|
...internal,
|
|
17533
17520
|
credentials: accountConfig
|
|
@@ -18879,6 +18866,8 @@ var quantumImPlugin = {
|
|
|
18879
18866
|
};
|
|
18880
18867
|
|
|
18881
18868
|
// src/crypto/quantun-plug-adapter.ts
|
|
18869
|
+
var import_node_module = require("module");
|
|
18870
|
+
var import_meta = {};
|
|
18882
18871
|
var log14 = createLogger("crypto/quantun-plug-adapter");
|
|
18883
18872
|
var SM4_MODE = {
|
|
18884
18873
|
ECB_NOPADDING: 1,
|
|
@@ -18887,18 +18876,28 @@ var SM4_MODE = {
|
|
|
18887
18876
|
CBC_PKCS7PADDING: 4
|
|
18888
18877
|
};
|
|
18889
18878
|
var DEFAULT_ENCRYPT_MODE = SM4_MODE.CBC_PKCS7PADDING;
|
|
18879
|
+
var require2 = (0, import_node_module.createRequire)(import_meta.url);
|
|
18890
18880
|
var quantunPlug = null;
|
|
18891
|
-
|
|
18881
|
+
try {
|
|
18882
|
+
quantunPlug = require2("./sdk/index.min.cjs");
|
|
18883
|
+
log14.info("Quantum SDK loaded from sdk/index.min.cjs");
|
|
18884
|
+
} catch (err) {
|
|
18885
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
18886
|
+
log14.warn("Quantum SDK missing, only passthrough mode will work:", msg);
|
|
18887
|
+
}
|
|
18892
18888
|
var quantun_plug_adapter_default = quantunPlug;
|
|
18893
18889
|
|
|
18894
18890
|
// src/crypto/quantum-config-writer.ts
|
|
18895
18891
|
var import_node_fs = require("fs");
|
|
18896
18892
|
var import_node_path = require("path");
|
|
18897
18893
|
var import_node_url = require("url");
|
|
18898
|
-
var
|
|
18894
|
+
var import_meta2 = {};
|
|
18899
18895
|
var log15 = createLogger("crypto/quantum-config-writer");
|
|
18900
|
-
var
|
|
18901
|
-
|
|
18896
|
+
var QUANTUM_JSON_PATH = (0, import_node_path.join)(
|
|
18897
|
+
(0, import_node_path.dirname)((0, import_node_url.fileURLToPath)(import_meta2.url)),
|
|
18898
|
+
"sdk",
|
|
18899
|
+
"quantum.json"
|
|
18900
|
+
);
|
|
18902
18901
|
function writeQuantumConfig(credentials) {
|
|
18903
18902
|
const sdkConfig = {
|
|
18904
18903
|
account: credentials.quantumAccount,
|
|
@@ -18972,10 +18971,7 @@ var CryptoEngine = class _CryptoEngine {
|
|
|
18972
18971
|
return;
|
|
18973
18972
|
}
|
|
18974
18973
|
if (!this.plug) {
|
|
18975
|
-
|
|
18976
|
-
this.passthrough = true;
|
|
18977
|
-
this.initialized = true;
|
|
18978
|
-
return;
|
|
18974
|
+
throw new Error("Quantum encryption SDK is missing. Cannot initialize in encryption mode (check dist/index.min.cjs).");
|
|
18979
18975
|
}
|
|
18980
18976
|
if (this.credentials) {
|
|
18981
18977
|
writeQuantumConfig(this.credentials);
|
|
@@ -20509,7 +20505,7 @@ async function startPlugin(accountConfig, internalOverrides) {
|
|
|
20509
20505
|
};
|
|
20510
20506
|
}
|
|
20511
20507
|
var plugin = {
|
|
20512
|
-
id:
|
|
20508
|
+
id: PLUGIN_ID,
|
|
20513
20509
|
name: "\u91CF\u5B50\u5BC6\u4FE1",
|
|
20514
20510
|
description: "Quantum-encrypted IM channel plugin",
|
|
20515
20511
|
register(api) {
|
package/dist/index.d.cts
CHANGED
|
@@ -23,10 +23,6 @@ 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
|
-
}>>>;
|
|
30
26
|
botUserId: z.ZodOptional<z.ZodString>;
|
|
31
27
|
}, z.core.$strip>, z.ZodTransform<{
|
|
32
28
|
appId: string;
|
|
@@ -36,7 +32,6 @@ declare const AccountConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
36
32
|
quantumAppSecret: string;
|
|
37
33
|
pin: string;
|
|
38
34
|
quantumUrl: string;
|
|
39
|
-
env: "production" | "test";
|
|
40
35
|
botUserId: string | undefined;
|
|
41
36
|
}, {
|
|
42
37
|
appId: string;
|
|
@@ -46,7 +41,6 @@ declare const AccountConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
46
41
|
'quantum-appSecret': string;
|
|
47
42
|
pin: string;
|
|
48
43
|
'quantum-url': string;
|
|
49
|
-
env: "production" | "test";
|
|
50
44
|
botUserId?: string | undefined;
|
|
51
45
|
}>>;
|
|
52
46
|
type AccountConfig = z.output<typeof AccountConfigSchema>;
|
|
@@ -123,6 +117,12 @@ interface PluginConfig extends InternalConfig {
|
|
|
123
117
|
/** 用户凭据(从 openclaw.json 解析并转换后的结果) */
|
|
124
118
|
credentials: AccountConfig;
|
|
125
119
|
}
|
|
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
|
/**
|
package/dist/setup-entry.cjs
CHANGED
|
@@ -18018,12 +18018,6 @@ 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"),
|
|
18027
18021
|
/**
|
|
18028
18022
|
* 🟡 Bot 自己的用户 ID — 用于 anti-loop 检查
|
|
18029
18023
|
* 如果不填,需要通过其他 API 在运行时获取。
|
|
@@ -18037,7 +18031,6 @@ var AccountConfigSchema = external_exports.object({
|
|
|
18037
18031
|
quantumAppSecret: raw["quantum-appSecret"],
|
|
18038
18032
|
pin: raw.pin,
|
|
18039
18033
|
quantumUrl: raw["quantum-url"],
|
|
18040
|
-
env: raw.env,
|
|
18041
18034
|
botUserId: raw.botUserId
|
|
18042
18035
|
}));
|
|
18043
18036
|
var DEFAULT_INTERNAL_CONFIG = {
|
|
@@ -18056,11 +18049,11 @@ var DEFAULT_INTERNAL_CONFIG = {
|
|
|
18056
18049
|
}
|
|
18057
18050
|
},
|
|
18058
18051
|
auth: {
|
|
18059
|
-
serverUrl: process.env.LZMX_AUTH_URL || "https://
|
|
18052
|
+
serverUrl: process.env.LZMX_AUTH_URL || "https://imtwo.zdxlz.com/open-apis/v1",
|
|
18060
18053
|
refreshAheadMs: 3e5
|
|
18061
18054
|
},
|
|
18062
18055
|
crypto: {
|
|
18063
|
-
enabled:
|
|
18056
|
+
enabled: true,
|
|
18064
18057
|
keySource: "env",
|
|
18065
18058
|
envKey: "QUANTUM_ENCRYPTION_KEY"
|
|
18066
18059
|
},
|
|
@@ -18076,14 +18069,8 @@ var DEFAULT_INTERNAL_CONFIG = {
|
|
|
18076
18069
|
allowPrivateNetwork: false
|
|
18077
18070
|
}
|
|
18078
18071
|
};
|
|
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
|
-
};
|
|
18083
18072
|
function buildPluginConfig(accountConfig, internalOverrides) {
|
|
18084
18073
|
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 };
|
|
18087
18074
|
return {
|
|
18088
18075
|
...internal,
|
|
18089
18076
|
credentials: accountConfig
|
|
@@ -18091,6 +18078,8 @@ function buildPluginConfig(accountConfig, internalOverrides) {
|
|
|
18091
18078
|
}
|
|
18092
18079
|
|
|
18093
18080
|
// src/crypto/quantun-plug-adapter.ts
|
|
18081
|
+
var import_node_module = require("module");
|
|
18082
|
+
var import_meta = {};
|
|
18094
18083
|
var log5 = createLogger("crypto/quantun-plug-adapter");
|
|
18095
18084
|
var SM4_MODE = {
|
|
18096
18085
|
ECB_NOPADDING: 1,
|
|
@@ -18099,18 +18088,28 @@ var SM4_MODE = {
|
|
|
18099
18088
|
CBC_PKCS7PADDING: 4
|
|
18100
18089
|
};
|
|
18101
18090
|
var DEFAULT_ENCRYPT_MODE = SM4_MODE.CBC_PKCS7PADDING;
|
|
18091
|
+
var require2 = (0, import_node_module.createRequire)(import_meta.url);
|
|
18102
18092
|
var quantunPlug = null;
|
|
18103
|
-
|
|
18093
|
+
try {
|
|
18094
|
+
quantunPlug = require2("./sdk/index.min.cjs");
|
|
18095
|
+
log5.info("Quantum SDK loaded from sdk/index.min.cjs");
|
|
18096
|
+
} catch (err) {
|
|
18097
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
18098
|
+
log5.warn("Quantum SDK missing, only passthrough mode will work:", msg);
|
|
18099
|
+
}
|
|
18104
18100
|
var quantun_plug_adapter_default = quantunPlug;
|
|
18105
18101
|
|
|
18106
18102
|
// src/crypto/quantum-config-writer.ts
|
|
18107
18103
|
var import_node_fs = require("fs");
|
|
18108
18104
|
var import_node_path = require("path");
|
|
18109
18105
|
var import_node_url = require("url");
|
|
18110
|
-
var
|
|
18106
|
+
var import_meta2 = {};
|
|
18111
18107
|
var log6 = createLogger("crypto/quantum-config-writer");
|
|
18112
|
-
var
|
|
18113
|
-
|
|
18108
|
+
var QUANTUM_JSON_PATH = (0, import_node_path.join)(
|
|
18109
|
+
(0, import_node_path.dirname)((0, import_node_url.fileURLToPath)(import_meta2.url)),
|
|
18110
|
+
"sdk",
|
|
18111
|
+
"quantum.json"
|
|
18112
|
+
);
|
|
18114
18113
|
function writeQuantumConfig(credentials) {
|
|
18115
18114
|
const sdkConfig = {
|
|
18116
18115
|
account: credentials.quantumAccount,
|
|
@@ -18184,10 +18183,7 @@ var CryptoEngine = class _CryptoEngine {
|
|
|
18184
18183
|
return;
|
|
18185
18184
|
}
|
|
18186
18185
|
if (!this.plug) {
|
|
18187
|
-
|
|
18188
|
-
this.passthrough = true;
|
|
18189
|
-
this.initialized = true;
|
|
18190
|
-
return;
|
|
18186
|
+
throw new Error("Quantum encryption SDK is missing. Cannot initialize in encryption mode (check dist/index.min.cjs).");
|
|
18191
18187
|
}
|
|
18192
18188
|
if (this.credentials) {
|
|
18193
18189
|
writeQuantumConfig(this.credentials);
|