liangzimixin 0.3.59 → 0.3.61
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 +27 -4
- package/dist/index.d.cts +4 -0
- package/dist/setup-entry.cjs +27 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -17556,7 +17556,7 @@ var DEFAULT_INTERNAL_CONFIG = {
|
|
|
17556
17556
|
},
|
|
17557
17557
|
metrics: {
|
|
17558
17558
|
enabled: true,
|
|
17559
|
-
logIntervalMs:
|
|
17559
|
+
logIntervalMs: 3e5
|
|
17560
17560
|
}
|
|
17561
17561
|
};
|
|
17562
17562
|
function buildPluginConfig(accountConfig, internalOverrides) {
|
|
@@ -19696,6 +19696,7 @@ var quantumImPlugin = {
|
|
|
19696
19696
|
setTokenManagerGetter(() => instance.tokenManager);
|
|
19697
19697
|
setPluginConfigGetter(() => instance.config);
|
|
19698
19698
|
log16.info(`liangzimixin[${ctx.accountId}] started \u2713`);
|
|
19699
|
+
log16.info("\u{1F389} \u6B22\u8FCE\u4F7F\u7528\u91CF\u5B50\u5BC6\u4FE1\u9F99\u867E\uFF0C\u60A8\u5DF2\u6210\u529F\u8FDE\u63A5\u667A\u80FD\u52A9\u7406");
|
|
19699
19700
|
await new Promise((resolve3) => {
|
|
19700
19701
|
if (ctx.abortSignal?.aborted) {
|
|
19701
19702
|
resolve3();
|
|
@@ -19767,6 +19768,8 @@ function createQuantumPlug() {
|
|
|
19767
19768
|
return {
|
|
19768
19769
|
async init() {
|
|
19769
19770
|
const s = loadSdk();
|
|
19771
|
+
const sdkLogDir = (0, import_node_path.resolve)(__dirname, "quantum-sdk", "log");
|
|
19772
|
+
(0, import_node_fs.mkdirSync)(sdkLogDir, { recursive: true });
|
|
19770
19773
|
await s.init();
|
|
19771
19774
|
log17.info("Quantum SDK initialized \u2713");
|
|
19772
19775
|
},
|
|
@@ -20785,6 +20788,8 @@ var MessagePipe = class _MessagePipe {
|
|
|
20785
20788
|
quantumAccount;
|
|
20786
20789
|
/** 消息加密模式 */
|
|
20787
20790
|
encryptionMode;
|
|
20791
|
+
/** CryptoEngine 是否处于 passthrough 模式 (crypto 初始化失败或未启用) */
|
|
20792
|
+
cryptoIsPassthrough;
|
|
20788
20793
|
/** 入站并发控制信号量 */
|
|
20789
20794
|
inboundSemaphore;
|
|
20790
20795
|
/** 出站速率限制器 */
|
|
@@ -20797,6 +20802,7 @@ var MessagePipe = class _MessagePipe {
|
|
|
20797
20802
|
this.messageServiceBaseUrl = deps.messageServiceBaseUrl;
|
|
20798
20803
|
this.quantumAccount = deps.quantumAccount;
|
|
20799
20804
|
this.encryptionMode = deps.encryptionMode;
|
|
20805
|
+
this.cryptoIsPassthrough = deps.cryptoIsPassthrough ?? false;
|
|
20800
20806
|
this.inboundSemaphore = new Semaphore({
|
|
20801
20807
|
maxConcurrency: deps.maxInboundConcurrency ?? 5,
|
|
20802
20808
|
maxWaiting: deps.maxWaitingQueue ?? 15
|
|
@@ -21165,6 +21171,17 @@ var MessagePipe = class _MessagePipe {
|
|
|
21165
21171
|
await this.sendHintMessage(callbackData, HINT_NO_QUANTUM_ACCOUNT);
|
|
21166
21172
|
return;
|
|
21167
21173
|
}
|
|
21174
|
+
if (this.cryptoIsPassthrough) {
|
|
21175
|
+
log25.error("\u26A0\uFE0F quantum_only: CryptoEngine \u5904\u4E8E passthrough \u6A21\u5F0F\uFF0C\u65E0\u6CD5\u89E3\u5BC6\u6D88\u606F", {
|
|
21176
|
+
msgUid: callbackData.msgUid,
|
|
21177
|
+
reason: "crypto init failed, engine degraded to passthrough"
|
|
21178
|
+
});
|
|
21179
|
+
await this.sendHintMessage(
|
|
21180
|
+
callbackData,
|
|
21181
|
+
"\u26A0\uFE0F \u91CF\u5B50\u52A0\u5BC6\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u65E0\u6CD5\u5904\u7406\u52A0\u5BC6\u6D88\u606F\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\u6216\u8054\u7CFB\u7BA1\u7406\u5458\u3002"
|
|
21182
|
+
);
|
|
21183
|
+
return;
|
|
21184
|
+
}
|
|
21168
21185
|
if (!isEncrypted) {
|
|
21169
21186
|
log25.info("\u26A0\uFE0F quantum_only: \u6536\u5230\u660E\u6587\u6D88\u606F\uFF0C\u62D2\u7EDD\u5904\u7406", { msgUid: callbackData.msgUid });
|
|
21170
21187
|
await this.sendHintMessage(callbackData, HINT_PLAINTEXT_NOT_SUPPORTED);
|
|
@@ -21181,9 +21198,14 @@ var MessagePipe = class _MessagePipe {
|
|
|
21181
21198
|
}
|
|
21182
21199
|
} else {
|
|
21183
21200
|
if (isEncrypted) {
|
|
21184
|
-
if (!this.quantumAccount) {
|
|
21185
|
-
|
|
21186
|
-
|
|
21201
|
+
if (!this.quantumAccount || this.cryptoIsPassthrough) {
|
|
21202
|
+
const reason = !this.quantumAccount ? "\u672A\u914D\u7F6E quantumAccount" : "CryptoEngine \u5904\u4E8E passthrough \u6A21\u5F0F (crypto \u521D\u59CB\u5316\u5931\u8D25)";
|
|
21203
|
+
log25.warn("\u26A0\uFE0F quantum_and_plain: \u65E0\u6CD5\u89E3\u5BC6\u52A0\u5BC6\u6D88\u606F", {
|
|
21204
|
+
msgUid: callbackData.msgUid,
|
|
21205
|
+
reason
|
|
21206
|
+
});
|
|
21207
|
+
const hintText = this.cryptoIsPassthrough ? "\u26A0\uFE0F \u91CF\u5B50\u52A0\u5BC6\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u65E0\u6CD5\u89E3\u5BC6\u52A0\u5BC6\u6D88\u606F\u3002\u8BF7\u53D1\u9001\u660E\u6587\u6D88\u606F\uFF0C\u6216\u7A0D\u540E\u91CD\u8BD5\u3002" : HINT_NO_QUANTUM_ACCOUNT;
|
|
21208
|
+
await this.sendHintMessage(callbackData, hintText);
|
|
21187
21209
|
return;
|
|
21188
21210
|
}
|
|
21189
21211
|
try {
|
|
@@ -21913,6 +21935,7 @@ async function startPlugin(accountConfig, internalOverrides) {
|
|
|
21913
21935
|
messageServiceBaseUrl: config2.message.messageServiceBaseUrl,
|
|
21914
21936
|
quantumAccount: accountConfig.quantumAccount,
|
|
21915
21937
|
encryptionMode: accountConfig.encryptionMode,
|
|
21938
|
+
cryptoIsPassthrough: cryptoEngine.isPassthrough(),
|
|
21916
21939
|
maxInboundConcurrency: config2.transport.maxInboundConcurrency,
|
|
21917
21940
|
maxWaitingQueue: config2.transport.maxWaitingQueue,
|
|
21918
21941
|
rateLimitPerSecond: config2.message.rateLimitPerSecond,
|
package/dist/index.d.cts
CHANGED
|
@@ -865,6 +865,8 @@ declare class MessagePipe {
|
|
|
865
865
|
private readonly quantumAccount?;
|
|
866
866
|
/** 消息加密模式 */
|
|
867
867
|
private readonly encryptionMode;
|
|
868
|
+
/** CryptoEngine 是否处于 passthrough 模式 (crypto 初始化失败或未启用) */
|
|
869
|
+
private readonly cryptoIsPassthrough;
|
|
868
870
|
/** 入站并发控制信号量 */
|
|
869
871
|
private readonly inboundSemaphore;
|
|
870
872
|
/** 出站速率限制器 */
|
|
@@ -881,6 +883,8 @@ declare class MessagePipe {
|
|
|
881
883
|
quantumAccount?: string;
|
|
882
884
|
/** 消息加密模式 */
|
|
883
885
|
encryptionMode: 'quantum_only' | 'quantum_and_plain';
|
|
886
|
+
/** CryptoEngine 是否处于 passthrough 模式 — 由 index.ts 初始化时传入 */
|
|
887
|
+
cryptoIsPassthrough?: boolean;
|
|
884
888
|
/** 入站最大并发处理数 */
|
|
885
889
|
maxInboundConcurrency?: number;
|
|
886
890
|
/** 入站等待队列上限 */
|
package/dist/setup-entry.cjs
CHANGED
|
@@ -18680,7 +18680,7 @@ var DEFAULT_INTERNAL_CONFIG = {
|
|
|
18680
18680
|
},
|
|
18681
18681
|
metrics: {
|
|
18682
18682
|
enabled: true,
|
|
18683
|
-
logIntervalMs:
|
|
18683
|
+
logIntervalMs: 3e5
|
|
18684
18684
|
}
|
|
18685
18685
|
};
|
|
18686
18686
|
function buildPluginConfig(accountConfig, internalOverrides) {
|
|
@@ -18750,6 +18750,8 @@ function createQuantumPlug() {
|
|
|
18750
18750
|
return {
|
|
18751
18751
|
async init() {
|
|
18752
18752
|
const s = loadSdk();
|
|
18753
|
+
const sdkLogDir = (0, import_node_path.resolve)(__dirname, "quantum-sdk", "log");
|
|
18754
|
+
(0, import_node_fs.mkdirSync)(sdkLogDir, { recursive: true });
|
|
18753
18755
|
await s.init();
|
|
18754
18756
|
log8.info("Quantum SDK initialized \u2713");
|
|
18755
18757
|
},
|
|
@@ -19768,6 +19770,8 @@ var MessagePipe = class _MessagePipe {
|
|
|
19768
19770
|
quantumAccount;
|
|
19769
19771
|
/** 消息加密模式 */
|
|
19770
19772
|
encryptionMode;
|
|
19773
|
+
/** CryptoEngine 是否处于 passthrough 模式 (crypto 初始化失败或未启用) */
|
|
19774
|
+
cryptoIsPassthrough;
|
|
19771
19775
|
/** 入站并发控制信号量 */
|
|
19772
19776
|
inboundSemaphore;
|
|
19773
19777
|
/** 出站速率限制器 */
|
|
@@ -19780,6 +19784,7 @@ var MessagePipe = class _MessagePipe {
|
|
|
19780
19784
|
this.messageServiceBaseUrl = deps.messageServiceBaseUrl;
|
|
19781
19785
|
this.quantumAccount = deps.quantumAccount;
|
|
19782
19786
|
this.encryptionMode = deps.encryptionMode;
|
|
19787
|
+
this.cryptoIsPassthrough = deps.cryptoIsPassthrough ?? false;
|
|
19783
19788
|
this.inboundSemaphore = new Semaphore({
|
|
19784
19789
|
maxConcurrency: deps.maxInboundConcurrency ?? 5,
|
|
19785
19790
|
maxWaiting: deps.maxWaitingQueue ?? 15
|
|
@@ -20148,6 +20153,17 @@ var MessagePipe = class _MessagePipe {
|
|
|
20148
20153
|
await this.sendHintMessage(callbackData, HINT_NO_QUANTUM_ACCOUNT);
|
|
20149
20154
|
return;
|
|
20150
20155
|
}
|
|
20156
|
+
if (this.cryptoIsPassthrough) {
|
|
20157
|
+
log16.error("\u26A0\uFE0F quantum_only: CryptoEngine \u5904\u4E8E passthrough \u6A21\u5F0F\uFF0C\u65E0\u6CD5\u89E3\u5BC6\u6D88\u606F", {
|
|
20158
|
+
msgUid: callbackData.msgUid,
|
|
20159
|
+
reason: "crypto init failed, engine degraded to passthrough"
|
|
20160
|
+
});
|
|
20161
|
+
await this.sendHintMessage(
|
|
20162
|
+
callbackData,
|
|
20163
|
+
"\u26A0\uFE0F \u91CF\u5B50\u52A0\u5BC6\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u65E0\u6CD5\u5904\u7406\u52A0\u5BC6\u6D88\u606F\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\u6216\u8054\u7CFB\u7BA1\u7406\u5458\u3002"
|
|
20164
|
+
);
|
|
20165
|
+
return;
|
|
20166
|
+
}
|
|
20151
20167
|
if (!isEncrypted) {
|
|
20152
20168
|
log16.info("\u26A0\uFE0F quantum_only: \u6536\u5230\u660E\u6587\u6D88\u606F\uFF0C\u62D2\u7EDD\u5904\u7406", { msgUid: callbackData.msgUid });
|
|
20153
20169
|
await this.sendHintMessage(callbackData, HINT_PLAINTEXT_NOT_SUPPORTED);
|
|
@@ -20164,9 +20180,14 @@ var MessagePipe = class _MessagePipe {
|
|
|
20164
20180
|
}
|
|
20165
20181
|
} else {
|
|
20166
20182
|
if (isEncrypted) {
|
|
20167
|
-
if (!this.quantumAccount) {
|
|
20168
|
-
|
|
20169
|
-
|
|
20183
|
+
if (!this.quantumAccount || this.cryptoIsPassthrough) {
|
|
20184
|
+
const reason = !this.quantumAccount ? "\u672A\u914D\u7F6E quantumAccount" : "CryptoEngine \u5904\u4E8E passthrough \u6A21\u5F0F (crypto \u521D\u59CB\u5316\u5931\u8D25)";
|
|
20185
|
+
log16.warn("\u26A0\uFE0F quantum_and_plain: \u65E0\u6CD5\u89E3\u5BC6\u52A0\u5BC6\u6D88\u606F", {
|
|
20186
|
+
msgUid: callbackData.msgUid,
|
|
20187
|
+
reason
|
|
20188
|
+
});
|
|
20189
|
+
const hintText = this.cryptoIsPassthrough ? "\u26A0\uFE0F \u91CF\u5B50\u52A0\u5BC6\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u65E0\u6CD5\u89E3\u5BC6\u52A0\u5BC6\u6D88\u606F\u3002\u8BF7\u53D1\u9001\u660E\u6587\u6D88\u606F\uFF0C\u6216\u7A0D\u540E\u91CD\u8BD5\u3002" : HINT_NO_QUANTUM_ACCOUNT;
|
|
20190
|
+
await this.sendHintMessage(callbackData, hintText);
|
|
20170
20191
|
return;
|
|
20171
20192
|
}
|
|
20172
20193
|
try {
|
|
@@ -20973,6 +20994,7 @@ async function startPlugin(accountConfig, internalOverrides) {
|
|
|
20973
20994
|
messageServiceBaseUrl: config2.message.messageServiceBaseUrl,
|
|
20974
20995
|
quantumAccount: accountConfig.quantumAccount,
|
|
20975
20996
|
encryptionMode: accountConfig.encryptionMode,
|
|
20997
|
+
cryptoIsPassthrough: cryptoEngine.isPassthrough(),
|
|
20976
20998
|
maxInboundConcurrency: config2.transport.maxInboundConcurrency,
|
|
20977
20999
|
maxWaitingQueue: config2.transport.maxWaitingQueue,
|
|
20978
21000
|
rateLimitPerSecond: config2.message.rateLimitPerSecond,
|
|
@@ -21904,6 +21926,7 @@ var quantumImPlugin = {
|
|
|
21904
21926
|
setTokenManagerGetter(() => instance.tokenManager);
|
|
21905
21927
|
setPluginConfigGetter(() => instance.config);
|
|
21906
21928
|
log29.info(`liangzimixin[${ctx.accountId}] started \u2713`);
|
|
21929
|
+
log29.info("\u{1F389} \u6B22\u8FCE\u4F7F\u7528\u91CF\u5B50\u5BC6\u4FE1\u9F99\u867E\uFF0C\u60A8\u5DF2\u6210\u529F\u8FDE\u63A5\u667A\u80FD\u52A9\u7406");
|
|
21907
21930
|
await new Promise((resolve3) => {
|
|
21908
21931
|
if (ctx.abortSignal?.aborted) {
|
|
21909
21932
|
resolve3();
|