@jerryliang122/openclaw-qqbot 1.0.4 → 1.0.5

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
@@ -8501,7 +8501,7 @@ var init_outbound_service = __esm({
8501
8501
 
8502
8502
  // src/utils/pkg-version.ts
8503
8503
  function getPackageVersion() {
8504
- return true ? "1.0.4" : "unknown";
8504
+ return true ? "1.0.5" : "unknown";
8505
8505
  }
8506
8506
  function getOpenclawVersion(runtimeVersion) {
8507
8507
  return runtimeVersion && runtimeVersion !== "unknown" ? runtimeVersion : "unknown";
@@ -14747,8 +14747,13 @@ var StreamingController = class {
14747
14747
  session = null;
14748
14748
  /** QQ 已接受的最新文本 — 单源真理 */
14749
14749
  lastAcceptedFull = "";
14750
- /** 已成功发送的分片数(降级:=0 则走静态消息兜底) */
14750
+ /** 已成功发送的分片数(降级:=0 且无外部投递则走静态消息兜底) */
14751
14751
  sentChunkCount = 0;
14752
+ /**
14753
+ * 标记:内容已通过非流式通道成功投递(如 ask_user 按钮卡片)。
14754
+ * 置 true 后 handleFinalize 不再走 fallback 路径,避免框架误报 outcome=error。
14755
+ */
14756
+ _deliveredExternally = false;
14752
14757
  /** 同步标志:收到第一个 onPartialReply 即置 true(不等 async 完成) */
14753
14758
  _hasStarted = false;
14754
14759
  /** 串行队列 */
@@ -14781,7 +14786,14 @@ var StreamingController = class {
14781
14786
  return this.phase === "done" || this.phase === "failed";
14782
14787
  }
14783
14788
  get shouldFallbackToStatic() {
14784
- return this.isTerminal && this.sentChunkCount === 0;
14789
+ return this.isTerminal && this.sentChunkCount === 0 && !this._deliveredExternally;
14790
+ }
14791
+ /**
14792
+ * 告知控制器内容已通过外部通道投递(如 ask_user 卡片)。
14793
+ * 后续 finalize() 不会走 fallback 路径,框架不会误报 outcome=error。
14794
+ */
14795
+ markDeliveredExternally() {
14796
+ this._deliveredExternally = true;
14785
14797
  }
14786
14798
  // ── 入口 ──
14787
14799
  onPartialReply(text) {
@@ -14883,6 +14895,8 @@ var StreamingController = class {
14883
14895
  }
14884
14896
  } else if (this.sentChunkCount > 0 && this.lastAcceptedFull) {
14885
14897
  this.transition("failed", "finalize:no_sendstatic");
14898
+ } else if (this._deliveredExternally) {
14899
+ this.transition("done", "finalize");
14886
14900
  } else {
14887
14901
  this.transition("done", "finalize:fallback");
14888
14902
  }
@@ -14894,8 +14908,8 @@ var StreamingController = class {
14894
14908
  this.deps.log?.info(`stream done chunks=${this.sentChunkCount} chars=${this.lastAcceptedFull.length}`);
14895
14909
  return;
14896
14910
  }
14897
- if (this.sentChunkCount > 0) {
14898
- this.transition("done", "finalize:no_session");
14911
+ if (this.sentChunkCount > 0 || this._deliveredExternally) {
14912
+ this.transition("done", this.sentChunkCount > 0 ? "finalize:no_session" : "finalize");
14899
14913
  } else {
14900
14914
  this.transition("done", "finalize:fallback");
14901
14915
  }
@@ -15129,6 +15143,7 @@ async function dispatchToOpenClaw(ctx, msg, account, runtime2, log5) {
15129
15143
  try {
15130
15144
  await bot.sendTextWithKeyboard(replyTarget, text, keyboard);
15131
15145
  outboundSendOk++;
15146
+ streamingController?.markDeliveredExternally();
15132
15147
  dlog?.debug(`[question] sent ask_user with keyboard questionId=${questionId} options=${optionValues.length}`);
15133
15148
  return;
15134
15149
  } catch (err) {
@@ -15154,6 +15169,7 @@ async function dispatchToOpenClaw(ctx, msg, account, runtime2, log5) {
15154
15169
  await bot.sendTextWithKeyboard(replyTarget, cardText, keyboard);
15155
15170
  outboundSendOk++;
15156
15171
  }
15172
+ streamingController?.markDeliveredExternally();
15157
15173
  dlog?.debug(`[question] sent multi-question ask_user questionId=${questionId} questions=${questions.length}`);
15158
15174
  return;
15159
15175
  } catch (err) {