@cxyhhhhh/openclaw-qqbot 2.0.0-dev.202607092101 → 2.0.0-dev.202607101541

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
@@ -4826,6 +4826,7 @@ __export(index_exports, {
4826
4826
  resolveHistoryLimit: () => resolveHistoryLimit,
4827
4827
  resolveIgnoreOtherMentions: () => resolveIgnoreOtherMentions,
4828
4828
  resolveMentionPatterns: () => resolveMentionPatterns,
4829
+ resolveProcessingTimeoutMs: () => resolveProcessingTimeoutMs,
4829
4830
  resolveQQBotAccount: () => resolveQQBotAccount,
4830
4831
  resolveRequireMention: () => resolveRequireMention,
4831
4832
  resolveToolPolicy: () => resolveToolPolicy,
@@ -4878,6 +4879,7 @@ function evaluateMatchedGroupAccessForPolicy(params) {
4878
4879
  }
4879
4880
  var DEFAULT_GROUP_POLICY = "open";
4880
4881
  var DEFAULT_GROUP_HISTORY_LIMIT = 20;
4882
+ var DEFAULT_PROCESSING_TIMEOUT_MS = 0;
4881
4883
  var DEFAULT_GROUP_CONFIG = {
4882
4884
  requireMention: true,
4883
4885
  ignoreOtherMentions: false,
@@ -4982,6 +4984,17 @@ function resolveUserAgentSuffix(cfg) {
4982
4984
  const qqbot = cfg.channels?.qqbot;
4983
4985
  return qqbot?.userAgentSuffix ? String(qqbot.userAgentSuffix).trim() : "";
4984
4986
  }
4987
+ function resolveProcessingTimeoutMs(accountConfig) {
4988
+ if (accountConfig?.processingTimeoutMs !== void 0) {
4989
+ return accountConfig.processingTimeoutMs;
4990
+ }
4991
+ const env = process.env.OPENCLAW_PROCESSING_TIMEOUT_MS;
4992
+ if (env) {
4993
+ const v = Number(env);
4994
+ if (!Number.isNaN(v) && v >= 0) return v;
4995
+ }
4996
+ return DEFAULT_PROCESSING_TIMEOUT_MS;
4997
+ }
4985
4998
  function resolveQQBotAccount(cfg, accountId) {
4986
4999
  const resolvedAccountId = accountId ?? resolveDefaultQQBotAccountId(cfg);
4987
5000
  const qqbot = cfg.channels?.qqbot;
@@ -5023,6 +5036,7 @@ function resolveQQBotAccount(cfg, accountId) {
5023
5036
  systemPrompt: accountConfig.systemPrompt,
5024
5037
  markdownSupport: accountConfig.markdownSupport !== false,
5025
5038
  userAgentSuffix: resolveUserAgentSuffix(cfg),
5039
+ processingTimeoutMs: resolveProcessingTimeoutMs(accountConfig),
5026
5040
  config: accountConfig
5027
5041
  };
5028
5042
  }
@@ -5073,11 +5087,11 @@ var import_node_os = __toESM(require("os"), 1);
5073
5087
  // src/outbound/outbound-service.ts
5074
5088
  var path3 = __toESM(require("path"), 1);
5075
5089
 
5076
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/QQBot.js
5090
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/QQBot.js
5077
5091
  var fs3 = __toESM(require("fs"), 1);
5078
5092
  var path = __toESM(require("path"), 1);
5079
5093
 
5080
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/types.js
5094
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/types.js
5081
5095
  function resolvePolicy(ctx, path22, explicit, defaultValue) {
5082
5096
  if (explicit !== void 0 && explicit !== null) {
5083
5097
  return explicit;
@@ -5153,7 +5167,7 @@ function createMiddlewareContext(params) {
5153
5167
  return ctx;
5154
5168
  }
5155
5169
 
5156
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/types.js
5170
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/types.js
5157
5171
  var ApiError = class extends Error {
5158
5172
  httpStatus;
5159
5173
  path;
@@ -5186,7 +5200,7 @@ var StreamContentType = {
5186
5200
  MARKDOWN: "markdown"
5187
5201
  };
5188
5202
 
5189
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/format.js
5203
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/format.js
5190
5204
  function formatErrorMessage(err) {
5191
5205
  if (err instanceof Error) {
5192
5206
  let formatted = err.message || err.name || "Error";
@@ -5233,7 +5247,7 @@ function formatFileSize(bytes) {
5233
5247
  return `${(bytes / 1024 / 1024 / 1024).toFixed(2)} GB`;
5234
5248
  }
5235
5249
 
5236
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/api-client.js
5250
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/api-client.js
5237
5251
  var DEFAULT_BASE_URL = "https://api.sgroup.qq.com";
5238
5252
  var DEFAULT_TIMEOUT_MS = 3e4;
5239
5253
  var FILE_UPLOAD_TIMEOUT_MS = 12e4;
@@ -5328,12 +5342,12 @@ var ApiClient = class {
5328
5342
  }
5329
5343
  };
5330
5344
 
5331
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/media-chunked.js
5345
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/media-chunked.js
5332
5346
  var crypto = __toESM(require("crypto"), 1);
5333
5347
  var fs = __toESM(require("fs"), 1);
5334
5348
  var https = __toESM(require("https"), 1);
5335
5349
 
5336
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/retry.js
5350
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/retry.js
5337
5351
  async function withRetry(fn, policy, persistentPolicy, logger) {
5338
5352
  let lastError = null;
5339
5353
  for (let attempt = 0; attempt <= policy.maxRetries; attempt++) {
@@ -5425,7 +5439,7 @@ function buildPartFinishPersistentPolicy(retryTimeoutMs, retryableCodes = PART_F
5425
5439
  var PART_FINISH_RETRYABLE_CODES = /* @__PURE__ */ new Set([40093001]);
5426
5440
  var UPLOAD_PREPARE_FALLBACK_CODE = 40093002;
5427
5441
 
5428
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/routes.js
5442
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/routes.js
5429
5443
  function messagePath(scope, targetId) {
5430
5444
  return scope === "c2c" ? `/v2/users/${targetId}/messages` : `/v2/groups/${targetId}/messages`;
5431
5445
  }
@@ -5462,7 +5476,7 @@ function getNextMsgSeq(_msgId) {
5462
5476
  return (timePart ^ random) % 65536;
5463
5477
  }
5464
5478
 
5465
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/media-chunked.js
5479
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/media-chunked.js
5466
5480
  var UploadDailyLimitExceededError = class extends Error {
5467
5481
  filePath;
5468
5482
  fileSize;
@@ -5694,7 +5708,10 @@ async function putToPresignedUrl(presignedUrl, data, partIndex, totalParts, logg
5694
5708
  } catch (err) {
5695
5709
  lastError = err instanceof Error ? err : new Error(String(err));
5696
5710
  const code = err.code ?? "none";
5697
- const causeMsg = err?.cause?.message ?? "none";
5711
+ const causeMsg = (() => {
5712
+ const c = err instanceof Error ? err.cause : void 0;
5713
+ return c instanceof Error ? c.message : "none";
5714
+ })();
5698
5715
  if (lastError.name === "AbortError") {
5699
5716
  lastError = new Error(`Part ${partIndex}/${totalParts} upload timeout after ${PART_UPLOAD_TIMEOUT_MS}ms`);
5700
5717
  }
@@ -5721,8 +5738,32 @@ function sleep2(ms) {
5721
5738
  return new Promise((resolve2) => setTimeout(resolve2, ms));
5722
5739
  }
5723
5740
 
5724
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/media.js
5741
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/media.js
5725
5742
  var fs2 = __toESM(require("fs"), 1);
5743
+
5744
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/file-utils.js
5745
+ var MAX_UPLOAD_SIZE = 20 * 1024 * 1024;
5746
+ var CHUNKED_UPLOAD_MAX_SIZE = 100 * 1024 * 1024;
5747
+ var LARGE_FILE_THRESHOLD = 5 * 1024 * 1024;
5748
+ var MEDIA_FILE_TYPE_INFO = {
5749
+ [MediaFileType.IMAGE]: { maxSize: 30 * 1024 * 1024, name: "image" },
5750
+ [MediaFileType.VIDEO]: { maxSize: 100 * 1024 * 1024, name: "video" },
5751
+ [MediaFileType.VOICE]: { maxSize: 20 * 1024 * 1024, name: "voice" },
5752
+ [MediaFileType.FILE]: { maxSize: 100 * 1024 * 1024, name: "file" }
5753
+ };
5754
+ function sanitizeFileName(name) {
5755
+ if (!name) {
5756
+ return "file";
5757
+ }
5758
+ const cleaned = name.replace(/[\\/:*?"<>|]/g, "_").replace(/[\u0000-\u001f\u007f]/g, "").replace(/\s+/g, " ").trim();
5759
+ return cleaned || "file";
5760
+ }
5761
+
5762
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/media.js
5763
+ var MAX_BASE64_CHECK_SIZE = Math.ceil(MAX_UPLOAD_SIZE * 1.4);
5764
+ function formatUploadSize() {
5765
+ return formatFileSize(MAX_UPLOAD_SIZE);
5766
+ }
5726
5767
  var MediaApi = class {
5727
5768
  client;
5728
5769
  tokenManager;
@@ -5754,6 +5795,10 @@ var MediaApi = class {
5754
5795
  const buf = await fs2.promises.readFile(opts.localPath);
5755
5796
  fileData = buf.toString("base64");
5756
5797
  }
5798
+ if (fileData && fileData.length > MAX_BASE64_CHECK_SIZE) {
5799
+ const sizeMB = (fileData.length / (1024 * 1024)).toFixed(1);
5800
+ throw new Error(`fileData too large (${sizeMB}MB decoded); QQ Bot single upload limit is ${formatUploadSize()}`);
5801
+ }
5757
5802
  if (fileData && this.cache) {
5758
5803
  const hash = this.cache.computeHash(fileData);
5759
5804
  const cached = this.cache.get(hash, scope, targetId, fileType);
@@ -5802,7 +5847,7 @@ var MediaApi = class {
5802
5847
  }
5803
5848
  };
5804
5849
 
5805
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/messages.js
5850
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/messages.js
5806
5851
  var MessageApi = class {
5807
5852
  client;
5808
5853
  tokenManager;
@@ -5990,7 +6035,7 @@ var MessageApi = class {
5990
6035
  }
5991
6036
  };
5992
6037
 
5993
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/token.js
6038
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/token.js
5994
6039
  var DEFAULT_TOKEN_BASE_URL = "https://bots.qq.com";
5995
6040
  var TOKEN_PATH = "/app/getAppAccessToken";
5996
6041
  var TokenManager = class {
@@ -6177,7 +6222,7 @@ var import_websocket = __toESM(require_websocket(), 1);
6177
6222
  var import_websocket_server = __toESM(require_websocket_server(), 1);
6178
6223
  var wrapper_default = import_websocket.default;
6179
6224
 
6180
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/codec.js
6225
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/codec.js
6181
6226
  function decodeGatewayMessageData(data) {
6182
6227
  if (typeof data === "string") {
6183
6228
  return data;
@@ -6204,7 +6249,7 @@ function readOptionalMessageSceneExt(event) {
6204
6249
  return scene?.ext;
6205
6250
  }
6206
6251
 
6207
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/constants.js
6252
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/constants.js
6208
6253
  var INTENTS = {
6209
6254
  GUILDS: 1 << 0,
6210
6255
  GUILD_MEMBERS: 1 << 1,
@@ -6277,7 +6322,7 @@ var GatewayEvent = {
6277
6322
  MESSAGE_REACTION_REMOVE: "MESSAGE_REACTION_REMOVE"
6278
6323
  };
6279
6324
 
6280
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/event-dispatcher.js
6325
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/event-dispatcher.js
6281
6326
  var REF_INDEX_KEY = "msg_idx";
6282
6327
  function parseRefIndices(ext, msgType, msgElements) {
6283
6328
  let refMsgIdx;
@@ -6418,7 +6463,7 @@ function dispatchEvent(eventType, data, _accountId, _log) {
6418
6463
  return { action: "raw", type: eventType, data };
6419
6464
  }
6420
6465
 
6421
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/reconnect.js
6466
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/reconnect.js
6422
6467
  var ReconnectState = class {
6423
6468
  accountId;
6424
6469
  log;
@@ -6529,7 +6574,7 @@ var ReconnectState = class {
6529
6574
  }
6530
6575
  };
6531
6576
 
6532
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/gateway-connection.js
6577
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/gateway-connection.js
6533
6578
  var GatewayConnection = class {
6534
6579
  isAborted = false;
6535
6580
  currentWs = null;
@@ -6787,7 +6832,7 @@ function previewPayload(data) {
6787
6832
  }
6788
6833
  }
6789
6834
 
6790
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/transport/webhook-verify.js
6835
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/transport/webhook-verify.js
6791
6836
  var crypto2 = __toESM(require("crypto"), 1);
6792
6837
  function deriveSeed(botSecret) {
6793
6838
  let seed = botSecret;
@@ -6839,7 +6884,7 @@ function signValidationResponse(params) {
6839
6884
  };
6840
6885
  }
6841
6886
 
6842
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/transport/webhook-server-node.js
6887
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/transport/webhook-server-node.js
6843
6888
  var http = __toESM(require("http"), 1);
6844
6889
  var NodeHttpWebhookServer = class {
6845
6890
  server = null;
@@ -6887,7 +6932,7 @@ var NodeHttpWebhookServer = class {
6887
6932
  }
6888
6933
  };
6889
6934
 
6890
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/transport/webhook.js
6935
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/transport/webhook.js
6891
6936
  var OP_DISPATCH = 0;
6892
6937
  var OP_HTTP_CALLBACK_ACK = 12;
6893
6938
  var OP_VALIDATION = 13;
@@ -7031,25 +7076,7 @@ function getHeader(headers, key) {
7031
7076
  return val;
7032
7077
  }
7033
7078
 
7034
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/file-utils.js
7035
- var MAX_UPLOAD_SIZE = 20 * 1024 * 1024;
7036
- var CHUNKED_UPLOAD_MAX_SIZE = 100 * 1024 * 1024;
7037
- var LARGE_FILE_THRESHOLD = 5 * 1024 * 1024;
7038
- var MEDIA_FILE_TYPE_INFO = {
7039
- [MediaFileType.IMAGE]: { maxSize: 30 * 1024 * 1024, name: "image" },
7040
- [MediaFileType.VIDEO]: { maxSize: 100 * 1024 * 1024, name: "video" },
7041
- [MediaFileType.VOICE]: { maxSize: 20 * 1024 * 1024, name: "voice" },
7042
- [MediaFileType.FILE]: { maxSize: 100 * 1024 * 1024, name: "file" }
7043
- };
7044
- function sanitizeFileName(name) {
7045
- if (!name) {
7046
- return "file";
7047
- }
7048
- const cleaned = name.replace(/[\\/:*?"<>|]/g, "_").replace(/[\u0000-\u001f\u007f]/g, "").replace(/\s+/g, " ").trim();
7049
- return cleaned || "file";
7050
- }
7051
-
7052
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/upload-cache.js
7079
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/upload-cache.js
7053
7080
  var crypto3 = __toESM(require("crypto"), 1);
7054
7081
  var MAX_CACHE_SIZE = 500;
7055
7082
  function computeFileHash(data) {
@@ -7114,7 +7141,7 @@ var UploadCache = class {
7114
7141
  }
7115
7142
  };
7116
7143
 
7117
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/streaming.js
7144
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/streaming.js
7118
7145
  var DEFAULT_THROTTLE_MS = 500;
7119
7146
  var MIN_THROTTLE_MS = 300;
7120
7147
  var MAX_FLUSH_RETRIES = 3;
@@ -7282,7 +7309,7 @@ var StreamSession = class {
7282
7309
  }
7283
7310
  };
7284
7311
 
7285
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/QQBot.js
7312
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/QQBot.js
7286
7313
  var MsgType = {
7287
7314
  /** Plain text. */
7288
7315
  TEXT: 0,
@@ -7970,7 +7997,7 @@ var QQBot = class {
7970
7997
  }
7971
7998
  };
7972
7999
 
7973
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/message-filter.js
8000
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/message-filter.js
7974
8001
  function messageFilter(options = {}) {
7975
8002
  const skipSelfEcho = options.skipSelfEcho ?? true;
7976
8003
  const dedupOpts = options.dedup !== false ? { windowMs: 5e3, maxSize: 1e3, ...options.dedup ?? {} } : null;
@@ -8008,7 +8035,7 @@ function messageFilter(options = {}) {
8008
8035
  };
8009
8036
  }
8010
8037
 
8011
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/content-sanitizer.js
8038
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/content-sanitizer.js
8012
8039
  function contentSanitizer(options = {}) {
8013
8040
  const { stripBotMention = true, stripAllMentions = false, collapseWhitespace = false, parseFaceTags: parseFaceTags2 = false, transform } = options;
8014
8041
  return async (ctx, next) => {
@@ -8103,7 +8130,7 @@ function faceToEmoji(id) {
8103
8130
  return map[id];
8104
8131
  }
8105
8132
 
8106
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/rate-limiter.js
8133
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/rate-limiter.js
8107
8134
  var SlidingWindow = class {
8108
8135
  buckets = /* @__PURE__ */ new Map();
8109
8136
  max;
@@ -8157,11 +8184,11 @@ function rateLimiter(options = {}) {
8157
8184
  };
8158
8185
  }
8159
8186
 
8160
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/concurrency-guard.js
8187
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/concurrency-guard.js
8161
8188
  function concurrencyGuard(options = {}) {
8162
8189
  const strategy = options.strategy ?? "queue";
8163
8190
  const maxQueue = options.maxQueue ?? 3;
8164
- const { onDrop, onMerge, onDispatch, urgentPredicate } = options;
8191
+ const { onDrop, onMerge, onDispatch, urgentPredicate, maxProcessingMs } = options;
8165
8192
  const locks = /* @__PURE__ */ new Map();
8166
8193
  function getState(key) {
8167
8194
  let s = locks.get(key);
@@ -8191,9 +8218,31 @@ function concurrencyGuard(options = {}) {
8191
8218
  state.mergeBuffer = [];
8192
8219
  state.mergeWaiters = [];
8193
8220
  }
8221
+ let timedOut = false;
8222
+ let timeoutId;
8223
+ if (maxProcessingMs && maxProcessingMs > 0) {
8224
+ timeoutId = setTimeout(() => {
8225
+ timedOut = true;
8226
+ ctx.log.warn?.(`[concurrency] aborting active chain ${key} after ${maxProcessingMs}ms`);
8227
+ ctx.abort("concurrency:processing-timeout");
8228
+ state.busy = false;
8229
+ state.activeCtx = void 0;
8230
+ if (strategy === "merge") {
8231
+ drainMergeBuffer(key, state, ctx).catch(() => {
8232
+ });
8233
+ } else {
8234
+ drainQueue(key);
8235
+ }
8236
+ cleanupState(key);
8237
+ }, maxProcessingMs);
8238
+ }
8194
8239
  try {
8195
8240
  await next();
8196
8241
  } finally {
8242
+ if (timeoutId)
8243
+ clearTimeout(timeoutId);
8244
+ if (timedOut)
8245
+ return;
8197
8246
  state.activeCtx = void 0;
8198
8247
  if (strategy === "merge") {
8199
8248
  await drainMergeBuffer(key, state, ctx);
@@ -8370,7 +8419,7 @@ function concurrencyGuard(options = {}) {
8370
8419
  return guard;
8371
8420
  }
8372
8421
 
8373
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/mention-gate.js
8422
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/mention-gate.js
8374
8423
  function detectMentionInContent(content, appId) {
8375
8424
  if (!content || !appId)
8376
8425
  return false;
@@ -8426,7 +8475,7 @@ function mentionGate(options = {}) {
8426
8475
  };
8427
8476
  }
8428
8477
 
8429
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/quote-ref.js
8478
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/quote-ref.js
8430
8479
  var MemoryRefIndexStore = class {
8431
8480
  map = /* @__PURE__ */ new Map();
8432
8481
  maxSize;
@@ -8544,7 +8593,7 @@ function buildText(content, attachments) {
8544
8593
  return parts.join("\n") || "[empty message]";
8545
8594
  }
8546
8595
 
8547
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/envelope-formatter.js
8596
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/envelope-formatter.js
8548
8597
  function envelopeFormatter(options = {}) {
8549
8598
  const { historyLimit = 5, includeQuote = true, includeSender = true, format } = options;
8550
8599
  return async (ctx, next) => {
@@ -8616,7 +8665,7 @@ ${parts.join("\n")}
8616
8665
  return sections.join("\n\n");
8617
8666
  }
8618
8667
 
8619
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/slash-command.js
8668
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/slash-command.js
8620
8669
  function slashCommand(options = {}) {
8621
8670
  const prefixes = options.prefixes ?? ["/"];
8622
8671
  const catchErrors = options.catchErrors ?? true;
@@ -8679,8 +8728,9 @@ function slashCommand(options = {}) {
8679
8728
  }
8680
8729
  const cleaned = content.replace(/<@!?[^>]+>\s*/g, "").trim();
8681
8730
  if (ctx.message.kind === "group") {
8682
- const mentions = ctx.message.mentions;
8683
- if (!mentions?.some((m3) => m3.is_you)) {
8731
+ const msg = ctx.message;
8732
+ const wasMentioned = msg.rawEventType === "GROUP_AT_MESSAGE_CREATE" || msg.mentions?.some((m3) => m3.is_you);
8733
+ if (!wasMentioned) {
8684
8734
  await next();
8685
8735
  return;
8686
8736
  }
@@ -8768,7 +8818,7 @@ async function sendCommandResult(ctx, result) {
8768
8818
  }
8769
8819
  }
8770
8820
 
8771
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/history-buffer.js
8821
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/history-buffer.js
8772
8822
  var MemoryHistoryStore = class {
8773
8823
  buffers = /* @__PURE__ */ new Map();
8774
8824
  append(groupKey, entry, limit) {
@@ -8833,7 +8883,7 @@ function historyBuffer(options = {}) {
8833
8883
  return m3;
8834
8884
  }
8835
8885
 
8836
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/typing-indicator.js
8886
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/typing-indicator.js
8837
8887
  var DEFAULT_DURATION_SEC = 60;
8838
8888
  var DEFAULT_KEEPALIVE_INTERVAL_MS = 5e4;
8839
8889
  function typingIndicator(options = {}) {
@@ -8870,7 +8920,7 @@ function typingIndicator(options = {}) {
8870
8920
  };
8871
8921
  }
8872
8922
 
8873
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/error-handler.js
8923
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/error-handler.js
8874
8924
  var DEFAULT_FORMAT = (err) => {
8875
8925
  if (err instanceof ApiError) {
8876
8926
  if (err.bizMessage)
@@ -8908,7 +8958,7 @@ function errorHandler(options = {}) {
8908
8958
  };
8909
8959
  }
8910
8960
 
8911
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/storage/kv-store.js
8961
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/storage/kv-store.js
8912
8962
  var import_node_fs = __toESM(require("fs"), 1);
8913
8963
  var import_node_path = __toESM(require("path"), 1);
8914
8964
  var FileKVStore = class {
@@ -9018,7 +9068,7 @@ var FileKVStore = class {
9018
9068
  }
9019
9069
  };
9020
9070
 
9021
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/storage/session-adapter.js
9071
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/storage/session-adapter.js
9022
9072
  function kvSessionPersistence(opts) {
9023
9073
  const prefix = opts.prefix ?? "qqbot:session:";
9024
9074
  const key = `${prefix}${opts.accountId}`;
@@ -9245,7 +9295,7 @@ var import_node_path2 = __toESM(require("path"), 1);
9245
9295
  var import_node_fs2 = __toESM(require("fs"), 1);
9246
9296
  var _cachedOpenclawVersion;
9247
9297
  function getPackageVersion() {
9248
- return true ? "2.0.0-dev.202607092101" : "unknown";
9298
+ return true ? "2.0.0-dev.202607101541" : "unknown";
9249
9299
  }
9250
9300
  function getOpenclawVersion(runtimeVersion) {
9251
9301
  if (_cachedOpenclawVersion) return _cachedOpenclawVersion;
@@ -9854,6 +9904,27 @@ function isReservedAddr(ip) {
9854
9904
  return false;
9855
9905
  }
9856
9906
  var ALLOWED_SCHEMES = /* @__PURE__ */ new Set(["http:", "https:"]);
9907
+ var QQ_TRUSTED_DOMAINS = /* @__PURE__ */ new Set([
9908
+ // QQ Bot API
9909
+ "api.sgroup.qq.com",
9910
+ "sandbox.api.sgroup.qq.com",
9911
+ // QQ Bot Token
9912
+ "bots.qq.com",
9913
+ // QQ 多媒体上传/下载
9914
+ "multimedia.nt.qq.com.cn",
9915
+ "multimedia.nt.qq.com",
9916
+ // QQ 群文件
9917
+ "grouppro.grouppro.qq.com"
9918
+ ]);
9919
+ function isQQTrustedDomain(hostname) {
9920
+ if (QQ_TRUSTED_DOMAINS.has(hostname)) return true;
9921
+ const dot = hostname.indexOf(".");
9922
+ if (dot > 0) {
9923
+ const parent = hostname.slice(dot + 1);
9924
+ return QQ_TRUSTED_DOMAINS.has(parent);
9925
+ }
9926
+ return false;
9927
+ }
9857
9928
  async function validateRemoteUrl(raw) {
9858
9929
  const url = new URL(raw);
9859
9930
  if (!ALLOWED_SCHEMES.has(url.protocol)) {
@@ -9862,6 +9933,7 @@ async function validateRemoteUrl(raw) {
9862
9933
  );
9863
9934
  }
9864
9935
  const host = url.hostname.replace(/^\[|\]$/g, "");
9936
+ if (isQQTrustedDomain(host)) return;
9865
9937
  if (import_node_net.default.isIP(host)) {
9866
9938
  assertPublicAddr(host, raw);
9867
9939
  return;
@@ -11444,10 +11516,10 @@ function buildCommandList(account, opts) {
11444
11516
  // src/middleware/attachment.ts
11445
11517
  var path17 = __toESM(require("path"), 1);
11446
11518
 
11447
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/reply-limiter.js
11519
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/reply-limiter.js
11448
11520
  var DEFAULT_TTL_MS = 60 * 60 * 1e3;
11449
11521
 
11450
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/media-tags.js
11522
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/media-tags.js
11451
11523
  var VALID_TAGS = ["qqimg", "qqvoice", "qqvideo", "qqfile", "qqmedia"];
11452
11524
  var TAG_ALIASES = {
11453
11525
  qq_img: "qqimg",
@@ -11496,30 +11568,30 @@ var SELF_CLOSING_TAG_REGEX = new RegExp("`?" + LEFT_BRACKET + "\\s*(" + TAG_NAME
11496
11568
  var FUZZY_MEDIA_TAG_REGEX = new RegExp("`?" + LEFT_BRACKET + "\\s*(" + TAG_NAME_PATTERN + ")\\s*" + RIGHT_BRACKET + `["']?\\s*([^<\uFF1C<\uFF1E>"'\`]+?)\\s*["']?` + LEFT_BRACKET + "\\s*/?\\s*(?:" + TAG_NAME_PATTERN + ")\\s*" + RIGHT_BRACKET + "`?", "gi");
11497
11569
  var MULTILINE_TAG_CLEANUP = new RegExp("(" + LEFT_BRACKET + "\\s*(?:" + TAG_NAME_PATTERN + ")\\s*" + RIGHT_BRACKET + ")([\\s\\S]*?)(" + LEFT_BRACKET + "\\s*/?\\s*(?:" + TAG_NAME_PATTERN + ")\\s*" + RIGHT_BRACKET + ")", "gi");
11498
11570
 
11499
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/ref-index-store.js
11571
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/ref-index-store.js
11500
11572
  var import_node_fs6 = __toESM(require("fs"), 1);
11501
11573
  var DEFAULT_TTL_MS2 = 7 * 24 * 60 * 60 * 1e3;
11502
11574
 
11503
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/session-store.js
11575
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/session-store.js
11504
11576
  var import_node_fs7 = __toESM(require("fs"), 1);
11505
11577
  var import_node_path7 = __toESM(require("path"), 1);
11506
11578
  var DEFAULT_EXPIRE_MS = 5 * 60 * 1e3;
11507
11579
 
11508
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/text-parsing.js
11580
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/text-parsing.js
11509
11581
  var MAX_FACE_EXT_BYTES = 64 * 1024;
11510
11582
 
11511
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/media-source.js
11583
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/media-source.js
11512
11584
  var fs14 = __toESM(require("fs"), 1);
11513
11585
 
11514
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/image-size.js
11586
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/image-size.js
11515
11587
  var import_node_buffer = require("buffer");
11516
11588
 
11517
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/ffmpeg.js
11589
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/ffmpeg.js
11518
11590
  var import_node_child_process = require("child_process");
11519
11591
  var fs15 = __toESM(require("fs"), 1);
11520
11592
  var path13 = __toESM(require("path"), 1);
11521
11593
 
11522
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607092059/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/audio.js
11594
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/audio.js
11523
11595
  var import_node_child_process2 = require("child_process");
11524
11596
  var fs16 = __toESM(require("fs"), 1);
11525
11597
  var path14 = __toESM(require("path"), 1);
@@ -12158,7 +12230,7 @@ function isNonEmpty(x) {
12158
12230
  }
12159
12231
  function buildAgentBody(input) {
12160
12232
  const { userContent, base, isGroup, wasMentioned, history } = input;
12161
- if (userContent.startsWith("/")) {
12233
+ if (userContent.trim().startsWith("/")) {
12162
12234
  return userContent;
12163
12235
  }
12164
12236
  if (isGroup && wasMentioned && history && history.length > 0) {
@@ -12325,6 +12397,25 @@ async function checkPairingMode(ctx, next, opts) {
12325
12397
  }
12326
12398
  }
12327
12399
 
12400
+ // src/utils/mention.ts
12401
+ function stripMentionText(text, mentions) {
12402
+ if (!text || !mentions?.length) return text;
12403
+ let cleaned = text;
12404
+ for (const m3 of mentions) {
12405
+ const openid = m3.member_openid ?? m3.id ?? m3.user_openid;
12406
+ if (!openid) continue;
12407
+ if (m3.is_you) {
12408
+ cleaned = cleaned.replace(new RegExp(`<@!?${openid}>`, "g"), "").trim();
12409
+ } else {
12410
+ const displayName = m3.nickname ?? m3.username;
12411
+ if (displayName) {
12412
+ cleaned = cleaned.replace(new RegExp(`<@!?${openid}>`, "g"), `@${displayName}`);
12413
+ }
12414
+ }
12415
+ }
12416
+ return cleaned;
12417
+ }
12418
+
12328
12419
  // src/gateway/middleware-setup.ts
12329
12420
  function setupMiddlewares(bot, account, opts) {
12330
12421
  bot.use(errorHandler());
@@ -12343,11 +12434,17 @@ function setupMiddlewares(bot, account, opts) {
12343
12434
  getRuntime: opts.getRuntime
12344
12435
  }));
12345
12436
  bot.use(mentionGate());
12346
- bot.use(contentSanitizer({ parseFaceTags: true }));
12437
+ bot.use(contentSanitizer({
12438
+ parseFaceTags: true,
12439
+ transform: (content, ctx) => stripMentionText(content, ctx.message.mentions)
12440
+ }));
12347
12441
  bot.use(rateLimiter());
12442
+ const slash = slashCommand({ commands: buildCommandList(account, { getRuntime: opts.getRuntime }) });
12443
+ bot.use(slash.middleware);
12348
12444
  bot.use(concurrencyGuard({
12349
12445
  strategy: "merge",
12350
12446
  maxQueue: 50,
12447
+ maxProcessingMs: account.processingTimeoutMs,
12351
12448
  /** 紧急指令(/stop)跳过排队,立即处理 */
12352
12449
  urgentPredicate: (ctx) => {
12353
12450
  return (ctx.message.content ?? "").trim() === "/stop";
@@ -12376,8 +12473,6 @@ function setupMiddlewares(bot, account, opts) {
12376
12473
  return assembled.agentBody;
12377
12474
  }
12378
12475
  }));
12379
- const slash = slashCommand({ commands: buildCommandList(account, { getRuntime: opts.getRuntime }) });
12380
- bot.use(slash.middleware);
12381
12476
  }
12382
12477
 
12383
12478
  // src/dispatch/envelope-builder.ts
@@ -12926,13 +13021,14 @@ async function dispatchToOpenClaw(ctx, msg, account, runtime2, log4) {
12926
13021
  await deliverReply(payload, info, deliverCtx);
12927
13022
  }
12928
13023
  },
12929
- ...streamingController ? {
12930
- replyOptions: {
13024
+ replyOptions: {
13025
+ abortSignal: ctx.signal,
13026
+ ...streamingController ? {
12931
13027
  onPartialReply: async (p2) => {
12932
13028
  if (p2.text) await streamingController.onPartialReply(p2.text);
12933
13029
  }
12934
- }
12935
- } : {}
13030
+ } : {}
13031
+ }
12936
13032
  });
12937
13033
  if (streamingController && !streamingController.isTerminal) {
12938
13034
  await streamingController.finalize();
@@ -13048,6 +13144,7 @@ async function dispatchToOpenClaw(ctx, msg, account, runtime2, log4) {
13048
13144
  }
13049
13145
  },
13050
13146
  replyOptions: {
13147
+ abortSignal: ctx.signal,
13051
13148
  runId: envelope.messageId,
13052
13149
  ...streamingController ? {
13053
13150
  onPartialReply: async (p2) => {
@@ -14391,25 +14488,6 @@ var qqbotOnboardingAdapter = {
14391
14488
  }
14392
14489
  };
14393
14490
 
14394
- // src/utils/mention.ts
14395
- function stripMentionText(text, mentions) {
14396
- if (!text || !mentions?.length) return text;
14397
- let cleaned = text;
14398
- for (const m3 of mentions) {
14399
- const openid = m3.member_openid ?? m3.id ?? m3.user_openid;
14400
- if (!openid) continue;
14401
- if (m3.is_you) {
14402
- cleaned = cleaned.replace(new RegExp(`<@!?${openid}>`, "g"), "").trim();
14403
- } else {
14404
- const displayName = m3.nickname ?? m3.username;
14405
- if (displayName) {
14406
- cleaned = cleaned.replace(new RegExp(`<@!?${openid}>`, "g"), `@${displayName}`);
14407
- }
14408
- }
14409
- }
14410
- return cleaned;
14411
- }
14412
-
14413
14491
  // src/channel.ts
14414
14492
  var TEXT_CHUNK_LIMIT2 = 5e3;
14415
14493
  var GFM_TABLE_DATA_RE = /^\|.+\|.*\|/;
@@ -15022,7 +15100,7 @@ function verifyRuntimeContract(rt) {
15022
15100
  log3.error(`BROKEN \u2014 missing: ${missing.join(", ")}`);
15023
15101
  }
15024
15102
  if (degraded.length) {
15025
- log3.warn(`degraded: ${degraded.join(", ")}`);
15103
+ log3.debug(`degraded: ${degraded.join(", ")}`);
15026
15104
  }
15027
15105
  return { ok: missing.length === 0, version, missing, degraded };
15028
15106
  }
@@ -15101,6 +15179,7 @@ var index_default = plugin;
15101
15179
  resolveHistoryLimit,
15102
15180
  resolveIgnoreOtherMentions,
15103
15181
  resolveMentionPatterns,
15182
+ resolveProcessingTimeoutMs,
15104
15183
  resolveQQBotAccount,
15105
15184
  resolveRequireMention,
15106
15185
  resolveToolPolicy,