liangzimixin 0.3.63 → 0.3.65

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
@@ -19192,24 +19192,56 @@ var InboundPipeline = class {
19192
19192
  command: context.text.trim()
19193
19193
  });
19194
19194
  const cmdPayload = buildInboundPayload(msg, { text: context.text }, this.deps.pluginConfig);
19195
+ log15.info("\u{1F50D} [DEBUG] cmdPayload \u5173\u952E\u5B57\u6BB5", {
19196
+ messageId: msg.messageId,
19197
+ CommandAuthorized: cmdPayload.CommandAuthorized ?? "\u26A0\uFE0F \u672A\u8BBE\u7F6E",
19198
+ CommandBody: String(cmdPayload.CommandBody ?? "").slice(0, 100),
19199
+ RawBody: String(cmdPayload.RawBody ?? "").slice(0, 100),
19200
+ SessionKey: cmdPayload.SessionKey,
19201
+ AccountId: cmdPayload.AccountId,
19202
+ Surface: cmdPayload.Surface,
19203
+ Provider: cmdPayload.Provider,
19204
+ From: cmdPayload.From,
19205
+ To: cmdPayload.To,
19206
+ ChatType: cmdPayload.ChatType,
19207
+ payloadKeys: Object.keys(cmdPayload)
19208
+ });
19195
19209
  const cmdCtx = core.channel.reply.finalizeInboundContext(cmdPayload);
19210
+ log15.info("\u{1F50D} [DEBUG] cmdCtx (finalizeInboundContext \u4E4B\u540E)", {
19211
+ messageId: msg.messageId,
19212
+ CommandAuthorized: cmdCtx.CommandAuthorized ?? "\u26A0\uFE0F \u672A\u8BBE\u7F6E",
19213
+ CommandBody: String(cmdCtx.CommandBody ?? "").slice(0, 100),
19214
+ SessionKey: cmdCtx.SessionKey,
19215
+ ctxKeys: Object.keys(cmdCtx)
19216
+ });
19196
19217
  const cmdSkipEncrypt = this.deps.pluginConfig.credentials.encryptionMode === "quantum_only" ? false : true;
19197
19218
  let deliverCalled = false;
19198
- await core.channel.reply.dispatchReplyWithBufferedBlockDispatcher({
19219
+ let deliverCallCount = 0;
19220
+ log15.info("\u{1F680} [DEBUG] \u5F00\u59CB dispatchReplyWithBufferedBlockDispatcher", {
19221
+ messageId: msg.messageId,
19222
+ command: context.text.trim()
19223
+ });
19224
+ const dispatchResult = await core.channel.reply.dispatchReplyWithBufferedBlockDispatcher({
19199
19225
  ctx: cmdCtx,
19200
19226
  cfg: this.deps.sdkConfig,
19201
19227
  dispatcherOptions: {
19202
19228
  deliver: async (payload2) => {
19229
+ deliverCallCount++;
19203
19230
  deliverCalled = true;
19204
19231
  log15.info("\u{1F527} \u547D\u4EE4 deliver \u56DE\u8C03\u6536\u5230", {
19205
19232
  messageId: msg.messageId,
19233
+ callIndex: deliverCallCount,
19206
19234
  hasText: Boolean(payload2.text),
19207
19235
  textLength: payload2.text?.length ?? 0,
19208
- textPreview: (payload2.text ?? "").slice(0, 200),
19209
- payloadKeys: Object.keys(payload2)
19236
+ textPreview: (payload2.text ?? "").slice(0, 500),
19237
+ payloadKeys: Object.keys(payload2),
19238
+ fullPayload: JSON.stringify(payload2).slice(0, 1e3)
19210
19239
  });
19211
19240
  const text = (payload2.text ?? "").trim();
19212
- if (!text) return;
19241
+ if (!text) {
19242
+ log15.warn("\u26A0\uFE0F deliver \u6536\u5230\u7A7A\u6587\u672C\uFF0C\u8DF3\u8FC7\u53D1\u9001", { messageId: msg.messageId });
19243
+ return;
19244
+ }
19213
19245
  await this.deps.messagePipe.sendMessage({
19214
19246
  chatId: msg.chatId,
19215
19247
  senderId: msg.senderId,
@@ -19218,12 +19250,31 @@ var InboundPipeline = class {
19218
19250
  skipEncrypt: cmdSkipEncrypt
19219
19251
  });
19220
19252
  },
19221
- onError: (err) => {
19222
- log15.error("\u274C \u547D\u4EE4\u56DE\u590D\u53D1\u9001\u5931\u8D25", { error: String(err) });
19253
+ onSkip: (payload2, info) => {
19254
+ log15.warn("\u23ED\uFE0F [DEBUG] dispatcher onSkip", {
19255
+ messageId: msg.messageId,
19256
+ reason: info?.reason,
19257
+ payload: JSON.stringify(payload2).slice(0, 300)
19258
+ });
19259
+ },
19260
+ onError: (err, info) => {
19261
+ log15.error("\u274C \u547D\u4EE4\u56DE\u590D\u9519\u8BEF", {
19262
+ messageId: msg.messageId,
19263
+ error: String(err),
19264
+ errorStack: err?.stack?.slice(0, 500),
19265
+ kind: info?.kind
19266
+ });
19223
19267
  }
19224
19268
  },
19225
19269
  replyOptions: {}
19226
19270
  });
19271
+ log15.info("\u{1F3C1} [DEBUG] dispatchReplyWithBufferedBlockDispatcher \u5B8C\u6210", {
19272
+ messageId: msg.messageId,
19273
+ command: context.text.trim(),
19274
+ deliverCalled,
19275
+ deliverCallCount,
19276
+ dispatchResult: JSON.stringify(dispatchResult ?? null).slice(0, 500)
19277
+ });
19227
19278
  if (!deliverCalled) {
19228
19279
  const command = context.text.trim();
19229
19280
  const fallbackMessages = {
@@ -19494,29 +19545,7 @@ var quantumImOnboarding = {
19494
19545
  ].join("\n"),
19495
19546
  "\u91CF\u5B50\u5BC6\u4FE1 \u2014 \u51ED\u636E\u914D\u7F6E"
19496
19547
  );
19497
- const encryptionModeChoice = await prompter.select({
19498
- message: "\u8BF7\u9009\u62E9\u6D88\u606F\u4EA4\u4E92\u65B9\u5F0F",
19499
- options: [
19500
- { value: "quantum_only", label: "\u4EC5\u91CF\u5B50\u52A0\u5BC6\u6D88\u606F" },
19501
- { value: "quantum_and_plain", label: "\u91CF\u5B50\u52A0\u5BC6+\u666E\u901A\u6D88\u606F" }
19502
- ],
19503
- initialValue: existing.encryptionMode ?? "quantum_and_plain"
19504
- });
19505
- let quantumAccount = "";
19506
- if (encryptionModeChoice === "quantum_only") {
19507
- quantumAccount = await prompter.text({
19508
- message: "quantumAccount\uFF08\u82E5\u91CF\u5B50\u52A0\u5BC6\u7981\u7528\uFF0C\u5219\u7559\u7A7A\uFF09",
19509
- placeholder: "\u5982: 17100001111",
19510
- initialValue: existing.quantumAccount ?? void 0,
19511
- validate: required2
19512
- });
19513
- } else {
19514
- quantumAccount = await prompter.text({
19515
- message: "\u91CF\u5B50\u8D26\u6237\u6807\u8BC6\uFF08\u53EF\u9009\uFF0C\u4E0D\u586B\u5219\u4EC5\u652F\u6301\u660E\u6587\uFF09",
19516
- placeholder: "\u5982: 17100001111",
19517
- initialValue: existing.quantumAccount ?? void 0
19518
- });
19519
- }
19548
+ const encryptionModeChoice = existing.encryptionMode || "quantum_and_plain";
19520
19549
  const appId = await prompter.text({
19521
19550
  message: "\u5E94\u7528 ID (appId)",
19522
19551
  initialValue: existing.appId ?? void 0,
@@ -19527,6 +19556,11 @@ var quantumImOnboarding = {
19527
19556
  initialValue: existing.appSecret ?? void 0,
19528
19557
  validate: required2
19529
19558
  });
19559
+ const quantumAccount = await prompter.text({
19560
+ message: "\u91CF\u5B50\u8D26\u6237\u6807\u8BC6\uFF08\u53EF\u9009\uFF0C\u4E0D\u586B\u5219\u4EC5\u652F\u6301\u660E\u6587\uFF09",
19561
+ placeholder: "\u5982: 17100001111",
19562
+ initialValue: existing.quantumAccount ?? void 0
19563
+ });
19530
19564
  const channels = cfg.channels ?? {};
19531
19565
  const channelCfg = channels[CHANNEL_ID] ?? {};
19532
19566
  const accounts = channelCfg.accounts ?? {};
@@ -21490,24 +21490,56 @@ var InboundPipeline = class {
21490
21490
  command: context.text.trim()
21491
21491
  });
21492
21492
  const cmdPayload = buildInboundPayload(msg, { text: context.text }, this.deps.pluginConfig);
21493
+ log28.info("\u{1F50D} [DEBUG] cmdPayload \u5173\u952E\u5B57\u6BB5", {
21494
+ messageId: msg.messageId,
21495
+ CommandAuthorized: cmdPayload.CommandAuthorized ?? "\u26A0\uFE0F \u672A\u8BBE\u7F6E",
21496
+ CommandBody: String(cmdPayload.CommandBody ?? "").slice(0, 100),
21497
+ RawBody: String(cmdPayload.RawBody ?? "").slice(0, 100),
21498
+ SessionKey: cmdPayload.SessionKey,
21499
+ AccountId: cmdPayload.AccountId,
21500
+ Surface: cmdPayload.Surface,
21501
+ Provider: cmdPayload.Provider,
21502
+ From: cmdPayload.From,
21503
+ To: cmdPayload.To,
21504
+ ChatType: cmdPayload.ChatType,
21505
+ payloadKeys: Object.keys(cmdPayload)
21506
+ });
21493
21507
  const cmdCtx = core.channel.reply.finalizeInboundContext(cmdPayload);
21508
+ log28.info("\u{1F50D} [DEBUG] cmdCtx (finalizeInboundContext \u4E4B\u540E)", {
21509
+ messageId: msg.messageId,
21510
+ CommandAuthorized: cmdCtx.CommandAuthorized ?? "\u26A0\uFE0F \u672A\u8BBE\u7F6E",
21511
+ CommandBody: String(cmdCtx.CommandBody ?? "").slice(0, 100),
21512
+ SessionKey: cmdCtx.SessionKey,
21513
+ ctxKeys: Object.keys(cmdCtx)
21514
+ });
21494
21515
  const cmdSkipEncrypt = this.deps.pluginConfig.credentials.encryptionMode === "quantum_only" ? false : true;
21495
21516
  let deliverCalled = false;
21496
- await core.channel.reply.dispatchReplyWithBufferedBlockDispatcher({
21517
+ let deliverCallCount = 0;
21518
+ log28.info("\u{1F680} [DEBUG] \u5F00\u59CB dispatchReplyWithBufferedBlockDispatcher", {
21519
+ messageId: msg.messageId,
21520
+ command: context.text.trim()
21521
+ });
21522
+ const dispatchResult = await core.channel.reply.dispatchReplyWithBufferedBlockDispatcher({
21497
21523
  ctx: cmdCtx,
21498
21524
  cfg: this.deps.sdkConfig,
21499
21525
  dispatcherOptions: {
21500
21526
  deliver: async (payload2) => {
21527
+ deliverCallCount++;
21501
21528
  deliverCalled = true;
21502
21529
  log28.info("\u{1F527} \u547D\u4EE4 deliver \u56DE\u8C03\u6536\u5230", {
21503
21530
  messageId: msg.messageId,
21531
+ callIndex: deliverCallCount,
21504
21532
  hasText: Boolean(payload2.text),
21505
21533
  textLength: payload2.text?.length ?? 0,
21506
- textPreview: (payload2.text ?? "").slice(0, 200),
21507
- payloadKeys: Object.keys(payload2)
21534
+ textPreview: (payload2.text ?? "").slice(0, 500),
21535
+ payloadKeys: Object.keys(payload2),
21536
+ fullPayload: JSON.stringify(payload2).slice(0, 1e3)
21508
21537
  });
21509
21538
  const text = (payload2.text ?? "").trim();
21510
- if (!text) return;
21539
+ if (!text) {
21540
+ log28.warn("\u26A0\uFE0F deliver \u6536\u5230\u7A7A\u6587\u672C\uFF0C\u8DF3\u8FC7\u53D1\u9001", { messageId: msg.messageId });
21541
+ return;
21542
+ }
21511
21543
  await this.deps.messagePipe.sendMessage({
21512
21544
  chatId: msg.chatId,
21513
21545
  senderId: msg.senderId,
@@ -21516,12 +21548,31 @@ var InboundPipeline = class {
21516
21548
  skipEncrypt: cmdSkipEncrypt
21517
21549
  });
21518
21550
  },
21519
- onError: (err) => {
21520
- log28.error("\u274C \u547D\u4EE4\u56DE\u590D\u53D1\u9001\u5931\u8D25", { error: String(err) });
21551
+ onSkip: (payload2, info) => {
21552
+ log28.warn("\u23ED\uFE0F [DEBUG] dispatcher onSkip", {
21553
+ messageId: msg.messageId,
21554
+ reason: info?.reason,
21555
+ payload: JSON.stringify(payload2).slice(0, 300)
21556
+ });
21557
+ },
21558
+ onError: (err, info) => {
21559
+ log28.error("\u274C \u547D\u4EE4\u56DE\u590D\u9519\u8BEF", {
21560
+ messageId: msg.messageId,
21561
+ error: String(err),
21562
+ errorStack: err?.stack?.slice(0, 500),
21563
+ kind: info?.kind
21564
+ });
21521
21565
  }
21522
21566
  },
21523
21567
  replyOptions: {}
21524
21568
  });
21569
+ log28.info("\u{1F3C1} [DEBUG] dispatchReplyWithBufferedBlockDispatcher \u5B8C\u6210", {
21570
+ messageId: msg.messageId,
21571
+ command: context.text.trim(),
21572
+ deliverCalled,
21573
+ deliverCallCount,
21574
+ dispatchResult: JSON.stringify(dispatchResult ?? null).slice(0, 500)
21575
+ });
21525
21576
  if (!deliverCalled) {
21526
21577
  const command = context.text.trim();
21527
21578
  const fallbackMessages = {
@@ -21724,29 +21775,7 @@ var quantumImOnboarding = {
21724
21775
  ].join("\n"),
21725
21776
  "\u91CF\u5B50\u5BC6\u4FE1 \u2014 \u51ED\u636E\u914D\u7F6E"
21726
21777
  );
21727
- const encryptionModeChoice = await prompter.select({
21728
- message: "\u8BF7\u9009\u62E9\u6D88\u606F\u4EA4\u4E92\u65B9\u5F0F",
21729
- options: [
21730
- { value: "quantum_only", label: "\u4EC5\u91CF\u5B50\u52A0\u5BC6\u6D88\u606F" },
21731
- { value: "quantum_and_plain", label: "\u91CF\u5B50\u52A0\u5BC6+\u666E\u901A\u6D88\u606F" }
21732
- ],
21733
- initialValue: existing.encryptionMode ?? "quantum_and_plain"
21734
- });
21735
- let quantumAccount = "";
21736
- if (encryptionModeChoice === "quantum_only") {
21737
- quantumAccount = await prompter.text({
21738
- message: "quantumAccount\uFF08\u82E5\u91CF\u5B50\u52A0\u5BC6\u7981\u7528\uFF0C\u5219\u7559\u7A7A\uFF09",
21739
- placeholder: "\u5982: 17100001111",
21740
- initialValue: existing.quantumAccount ?? void 0,
21741
- validate: required2
21742
- });
21743
- } else {
21744
- quantumAccount = await prompter.text({
21745
- message: "\u91CF\u5B50\u8D26\u6237\u6807\u8BC6\uFF08\u53EF\u9009\uFF0C\u4E0D\u586B\u5219\u4EC5\u652F\u6301\u660E\u6587\uFF09",
21746
- placeholder: "\u5982: 17100001111",
21747
- initialValue: existing.quantumAccount ?? void 0
21748
- });
21749
- }
21778
+ const encryptionModeChoice = existing.encryptionMode || "quantum_and_plain";
21750
21779
  const appId = await prompter.text({
21751
21780
  message: "\u5E94\u7528 ID (appId)",
21752
21781
  initialValue: existing.appId ?? void 0,
@@ -21757,6 +21786,11 @@ var quantumImOnboarding = {
21757
21786
  initialValue: existing.appSecret ?? void 0,
21758
21787
  validate: required2
21759
21788
  });
21789
+ const quantumAccount = await prompter.text({
21790
+ message: "\u91CF\u5B50\u8D26\u6237\u6807\u8BC6\uFF08\u53EF\u9009\uFF0C\u4E0D\u586B\u5219\u4EC5\u652F\u6301\u660E\u6587\uFF09",
21791
+ placeholder: "\u5982: 17100001111",
21792
+ initialValue: existing.quantumAccount ?? void 0
21793
+ });
21760
21794
  const channels = cfg.channels ?? {};
21761
21795
  const channelCfg = channels[CHANNEL_ID] ?? {};
21762
21796
  const accounts = channelCfg.accounts ?? {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "liangzimixin",
3
- "version": "0.3.63",
3
+ "version": "0.3.65",
4
4
  "description": "Quantum-encrypted IM channel plugin for OpenClaw",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",