@cxyhhhhh/openclaw-qqbot 2.0.0-dev.202607091957 → 2.0.0-dev.202607101321

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
@@ -31,9 +31,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
31
  ));
32
32
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
33
 
34
- // node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/constants.js
34
+ // node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/constants.js
35
35
  var require_constants = __commonJS({
36
- "node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/constants.js"(exports2, module2) {
36
+ "node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/constants.js"(exports2, module2) {
37
37
  "use strict";
38
38
  var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
39
39
  var hasBlob = typeof Blob !== "undefined";
@@ -54,9 +54,9 @@ var require_constants = __commonJS({
54
54
  }
55
55
  });
56
56
 
57
- // node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/buffer-util.js
57
+ // node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/buffer-util.js
58
58
  var require_buffer_util = __commonJS({
59
- "node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/buffer-util.js"(exports2, module2) {
59
+ "node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/buffer-util.js"(exports2, module2) {
60
60
  "use strict";
61
61
  var { EMPTY_BUFFER } = require_constants();
62
62
  var FastBuffer = Buffer[Symbol.species];
@@ -129,9 +129,9 @@ var require_buffer_util = __commonJS({
129
129
  }
130
130
  });
131
131
 
132
- // node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/limiter.js
132
+ // node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/limiter.js
133
133
  var require_limiter = __commonJS({
134
- "node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/limiter.js"(exports2, module2) {
134
+ "node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/limiter.js"(exports2, module2) {
135
135
  "use strict";
136
136
  var kDone = /* @__PURE__ */ Symbol("kDone");
137
137
  var kRun = /* @__PURE__ */ Symbol("kRun");
@@ -179,9 +179,9 @@ var require_limiter = __commonJS({
179
179
  }
180
180
  });
181
181
 
182
- // node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/permessage-deflate.js
182
+ // node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/permessage-deflate.js
183
183
  var require_permessage_deflate = __commonJS({
184
- "node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/permessage-deflate.js"(exports2, module2) {
184
+ "node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/permessage-deflate.js"(exports2, module2) {
185
185
  "use strict";
186
186
  var zlib = require("zlib");
187
187
  var bufferUtil = require_buffer_util();
@@ -562,9 +562,9 @@ var require_permessage_deflate = __commonJS({
562
562
  }
563
563
  });
564
564
 
565
- // node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/validation.js
565
+ // node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/validation.js
566
566
  var require_validation = __commonJS({
567
- "node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/validation.js"(exports2, module2) {
567
+ "node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/validation.js"(exports2, module2) {
568
568
  "use strict";
569
569
  var { isUtf8 } = require("buffer");
570
570
  var { hasBlob } = require_constants();
@@ -763,9 +763,9 @@ var require_validation = __commonJS({
763
763
  }
764
764
  });
765
765
 
766
- // node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/receiver.js
766
+ // node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/receiver.js
767
767
  var require_receiver = __commonJS({
768
- "node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/receiver.js"(exports2, module2) {
768
+ "node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/receiver.js"(exports2, module2) {
769
769
  "use strict";
770
770
  var { Writable } = require("stream");
771
771
  var PerMessageDeflate2 = require_permessage_deflate();
@@ -798,6 +798,10 @@ var require_receiver = __commonJS({
798
798
  * extensions
799
799
  * @param {Boolean} [options.isServer=false] Specifies whether to operate in
800
800
  * client or server mode
801
+ * @param {Number} [options.maxBufferedChunks=0] The maximum number of
802
+ * buffered data chunks
803
+ * @param {Number} [options.maxFragments=0] The maximum number of message
804
+ * fragments
801
805
  * @param {Number} [options.maxPayload=0] The maximum allowed message length
802
806
  * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
803
807
  * not to skip UTF-8 validation for text and close messages
@@ -808,6 +812,8 @@ var require_receiver = __commonJS({
808
812
  this._binaryType = options.binaryType || BINARY_TYPES[0];
809
813
  this._extensions = options.extensions || {};
810
814
  this._isServer = !!options.isServer;
815
+ this._maxBufferedChunks = options.maxBufferedChunks | 0;
816
+ this._maxFragments = options.maxFragments | 0;
811
817
  this._maxPayload = options.maxPayload | 0;
812
818
  this._skipUTF8Validation = !!options.skipUTF8Validation;
813
819
  this[kWebSocket] = void 0;
@@ -837,6 +843,18 @@ var require_receiver = __commonJS({
837
843
  */
838
844
  _write(chunk, encoding, cb) {
839
845
  if (this._opcode === 8 && this._state == GET_INFO) return cb();
846
+ if (this._maxBufferedChunks > 0 && this._buffers.length >= this._maxBufferedChunks) {
847
+ cb(
848
+ this.createError(
849
+ RangeError,
850
+ "Too many buffered chunks",
851
+ false,
852
+ 1008,
853
+ "WS_ERR_TOO_MANY_BUFFERED_PARTS"
854
+ )
855
+ );
856
+ return;
857
+ }
840
858
  this._bufferedBytes += chunk.length;
841
859
  this._buffers.push(chunk);
842
860
  this.startLoop(cb);
@@ -1166,6 +1184,17 @@ var require_receiver = __commonJS({
1166
1184
  return;
1167
1185
  }
1168
1186
  if (data.length) {
1187
+ if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
1188
+ const error = this.createError(
1189
+ RangeError,
1190
+ "Too many message fragments",
1191
+ false,
1192
+ 1008,
1193
+ "WS_ERR_TOO_MANY_BUFFERED_PARTS"
1194
+ );
1195
+ cb(error);
1196
+ return;
1197
+ }
1169
1198
  this._messageLength = this._totalPayloadLength;
1170
1199
  this._fragments.push(data);
1171
1200
  }
@@ -1195,6 +1224,17 @@ var require_receiver = __commonJS({
1195
1224
  cb(error);
1196
1225
  return;
1197
1226
  }
1227
+ if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
1228
+ const error = this.createError(
1229
+ RangeError,
1230
+ "Too many message fragments",
1231
+ false,
1232
+ 1008,
1233
+ "WS_ERR_TOO_MANY_BUFFERED_PARTS"
1234
+ );
1235
+ cb(error);
1236
+ return;
1237
+ }
1198
1238
  this._fragments.push(buf);
1199
1239
  }
1200
1240
  this.dataMessage(cb);
@@ -1355,9 +1395,9 @@ var require_receiver = __commonJS({
1355
1395
  }
1356
1396
  });
1357
1397
 
1358
- // node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/sender.js
1398
+ // node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/sender.js
1359
1399
  var require_sender = __commonJS({
1360
- "node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/sender.js"(exports2, module2) {
1400
+ "node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/sender.js"(exports2, module2) {
1361
1401
  "use strict";
1362
1402
  var { Duplex } = require("stream");
1363
1403
  var { randomFillSync } = require("crypto");
@@ -1848,9 +1888,9 @@ var require_sender = __commonJS({
1848
1888
  }
1849
1889
  });
1850
1890
 
1851
- // node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/event-target.js
1891
+ // node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/event-target.js
1852
1892
  var require_event_target = __commonJS({
1853
- "node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/event-target.js"(exports2, module2) {
1893
+ "node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/event-target.js"(exports2, module2) {
1854
1894
  "use strict";
1855
1895
  var { kForOnEventAttribute, kListener } = require_constants();
1856
1896
  var kCode = /* @__PURE__ */ Symbol("kCode");
@@ -2077,9 +2117,9 @@ var require_event_target = __commonJS({
2077
2117
  }
2078
2118
  });
2079
2119
 
2080
- // node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/extension.js
2120
+ // node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/extension.js
2081
2121
  var require_extension = __commonJS({
2082
- "node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/extension.js"(exports2, module2) {
2122
+ "node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/extension.js"(exports2, module2) {
2083
2123
  "use strict";
2084
2124
  var { tokenChars } = require_validation();
2085
2125
  function push(dest, name, elem) {
@@ -2230,9 +2270,9 @@ var require_extension = __commonJS({
2230
2270
  }
2231
2271
  });
2232
2272
 
2233
- // node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/websocket.js
2273
+ // node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/websocket.js
2234
2274
  var require_websocket = __commonJS({
2235
- "node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/websocket.js"(exports2, module2) {
2275
+ "node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/websocket.js"(exports2, module2) {
2236
2276
  "use strict";
2237
2277
  var EventEmitter = require("events");
2238
2278
  var https3 = require("https");
@@ -2401,6 +2441,10 @@ var require_websocket = __commonJS({
2401
2441
  * multiple times in the same tick
2402
2442
  * @param {Function} [options.generateMask] The function used to generate the
2403
2443
  * masking key
2444
+ * @param {Number} [options.maxBufferedChunks=0] The maximum number of
2445
+ * buffered data chunks
2446
+ * @param {Number} [options.maxFragments=0] The maximum number of message
2447
+ * fragments
2404
2448
  * @param {Number} [options.maxPayload=0] The maximum allowed message size
2405
2449
  * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
2406
2450
  * not to skip UTF-8 validation for text and close messages
@@ -2412,6 +2456,8 @@ var require_websocket = __commonJS({
2412
2456
  binaryType: this.binaryType,
2413
2457
  extensions: this._extensions,
2414
2458
  isServer: this._isServer,
2459
+ maxBufferedChunks: options.maxBufferedChunks,
2460
+ maxFragments: options.maxFragments,
2415
2461
  maxPayload: options.maxPayload,
2416
2462
  skipUTF8Validation: options.skipUTF8Validation
2417
2463
  });
@@ -2711,6 +2757,8 @@ var require_websocket = __commonJS({
2711
2757
  autoPong: true,
2712
2758
  closeTimeout: CLOSE_TIMEOUT,
2713
2759
  protocolVersion: protocolVersions[1],
2760
+ maxBufferedChunks: 1024 * 1024,
2761
+ maxFragments: 128 * 1024,
2714
2762
  maxPayload: 100 * 1024 * 1024,
2715
2763
  skipUTF8Validation: false,
2716
2764
  perMessageDeflate: true,
@@ -2953,6 +3001,8 @@ var require_websocket = __commonJS({
2953
3001
  websocket.setSocket(socket, head, {
2954
3002
  allowSynchronousEvents: opts.allowSynchronousEvents,
2955
3003
  generateMask: opts.generateMask,
3004
+ maxBufferedChunks: opts.maxBufferedChunks,
3005
+ maxFragments: opts.maxFragments,
2956
3006
  maxPayload: opts.maxPayload,
2957
3007
  skipUTF8Validation: opts.skipUTF8Validation
2958
3008
  });
@@ -3116,9 +3166,9 @@ var require_websocket = __commonJS({
3116
3166
  }
3117
3167
  });
3118
3168
 
3119
- // node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/stream.js
3169
+ // node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/stream.js
3120
3170
  var require_stream = __commonJS({
3121
- "node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/stream.js"(exports2, module2) {
3171
+ "node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/stream.js"(exports2, module2) {
3122
3172
  "use strict";
3123
3173
  var WebSocket2 = require_websocket();
3124
3174
  var { Duplex } = require("stream");
@@ -3214,9 +3264,9 @@ var require_stream = __commonJS({
3214
3264
  }
3215
3265
  });
3216
3266
 
3217
- // node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/subprotocol.js
3267
+ // node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/subprotocol.js
3218
3268
  var require_subprotocol = __commonJS({
3219
- "node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/subprotocol.js"(exports2, module2) {
3269
+ "node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/subprotocol.js"(exports2, module2) {
3220
3270
  "use strict";
3221
3271
  var { tokenChars } = require_validation();
3222
3272
  function parse(header) {
@@ -3259,9 +3309,9 @@ var require_subprotocol = __commonJS({
3259
3309
  }
3260
3310
  });
3261
3311
 
3262
- // node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/websocket-server.js
3312
+ // node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/websocket-server.js
3263
3313
  var require_websocket_server = __commonJS({
3264
- "node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/websocket-server.js"(exports2, module2) {
3314
+ "node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/websocket-server.js"(exports2, module2) {
3265
3315
  "use strict";
3266
3316
  var EventEmitter = require("events");
3267
3317
  var http2 = require("http");
@@ -3295,6 +3345,10 @@ var require_websocket_server = __commonJS({
3295
3345
  * called
3296
3346
  * @param {Function} [options.handleProtocols] A hook to handle protocols
3297
3347
  * @param {String} [options.host] The hostname where to bind the server
3348
+ * @param {Number} [options.maxBufferedChunks=1048576] The maximum number of
3349
+ * buffered data chunks
3350
+ * @param {Number} [options.maxFragments=131072] The maximum number of message
3351
+ * fragments
3298
3352
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
3299
3353
  * size
3300
3354
  * @param {Boolean} [options.noServer=false] Enable no server mode
@@ -3316,6 +3370,8 @@ var require_websocket_server = __commonJS({
3316
3370
  options = {
3317
3371
  allowSynchronousEvents: true,
3318
3372
  autoPong: true,
3373
+ maxBufferedChunks: 1024 * 1024,
3374
+ maxFragments: 128 * 1024,
3319
3375
  maxPayload: 100 * 1024 * 1024,
3320
3376
  skipUTF8Validation: false,
3321
3377
  perMessageDeflate: false,
@@ -3595,6 +3651,8 @@ var require_websocket_server = __commonJS({
3595
3651
  socket.removeListener("error", socketOnError);
3596
3652
  ws.setSocket(socket, head, {
3597
3653
  allowSynchronousEvents: this.options.allowSynchronousEvents,
3654
+ maxBufferedChunks: this.options.maxBufferedChunks,
3655
+ maxFragments: this.options.maxFragments,
3598
3656
  maxPayload: this.options.maxPayload,
3599
3657
  skipUTF8Validation: this.options.skipUTF8Validation
3600
3658
  });
@@ -4768,6 +4826,7 @@ __export(index_exports, {
4768
4826
  resolveHistoryLimit: () => resolveHistoryLimit,
4769
4827
  resolveIgnoreOtherMentions: () => resolveIgnoreOtherMentions,
4770
4828
  resolveMentionPatterns: () => resolveMentionPatterns,
4829
+ resolveProcessingTimeoutMs: () => resolveProcessingTimeoutMs,
4771
4830
  resolveQQBotAccount: () => resolveQQBotAccount,
4772
4831
  resolveRequireMention: () => resolveRequireMention,
4773
4832
  resolveToolPolicy: () => resolveToolPolicy,
@@ -4820,6 +4879,7 @@ function evaluateMatchedGroupAccessForPolicy(params) {
4820
4879
  }
4821
4880
  var DEFAULT_GROUP_POLICY = "open";
4822
4881
  var DEFAULT_GROUP_HISTORY_LIMIT = 20;
4882
+ var DEFAULT_PROCESSING_TIMEOUT_MS = 0;
4823
4883
  var DEFAULT_GROUP_CONFIG = {
4824
4884
  requireMention: true,
4825
4885
  ignoreOtherMentions: false,
@@ -4924,6 +4984,17 @@ function resolveUserAgentSuffix(cfg) {
4924
4984
  const qqbot = cfg.channels?.qqbot;
4925
4985
  return qqbot?.userAgentSuffix ? String(qqbot.userAgentSuffix).trim() : "";
4926
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
+ }
4927
4998
  function resolveQQBotAccount(cfg, accountId) {
4928
4999
  const resolvedAccountId = accountId ?? resolveDefaultQQBotAccountId(cfg);
4929
5000
  const qqbot = cfg.channels?.qqbot;
@@ -4965,6 +5036,7 @@ function resolveQQBotAccount(cfg, accountId) {
4965
5036
  systemPrompt: accountConfig.systemPrompt,
4966
5037
  markdownSupport: accountConfig.markdownSupport !== false,
4967
5038
  userAgentSuffix: resolveUserAgentSuffix(cfg),
5039
+ processingTimeoutMs: resolveProcessingTimeoutMs(accountConfig),
4968
5040
  config: accountConfig
4969
5041
  };
4970
5042
  }
@@ -5015,11 +5087,11 @@ var import_node_os = __toESM(require("os"), 1);
5015
5087
  // src/outbound/outbound-service.ts
5016
5088
  var path3 = __toESM(require("path"), 1);
5017
5089
 
5018
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/QQBot.js
5090
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/QQBot.js
5019
5091
  var fs3 = __toESM(require("fs"), 1);
5020
5092
  var path = __toESM(require("path"), 1);
5021
5093
 
5022
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/types.js
5094
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/types.js
5023
5095
  function resolvePolicy(ctx, path22, explicit, defaultValue) {
5024
5096
  if (explicit !== void 0 && explicit !== null) {
5025
5097
  return explicit;
@@ -5095,7 +5167,7 @@ function createMiddlewareContext(params) {
5095
5167
  return ctx;
5096
5168
  }
5097
5169
 
5098
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/types.js
5170
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/types.js
5099
5171
  var ApiError = class extends Error {
5100
5172
  httpStatus;
5101
5173
  path;
@@ -5128,7 +5200,7 @@ var StreamContentType = {
5128
5200
  MARKDOWN: "markdown"
5129
5201
  };
5130
5202
 
5131
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/format.js
5203
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/format.js
5132
5204
  function formatErrorMessage(err) {
5133
5205
  if (err instanceof Error) {
5134
5206
  let formatted = err.message || err.name || "Error";
@@ -5175,7 +5247,7 @@ function formatFileSize(bytes) {
5175
5247
  return `${(bytes / 1024 / 1024 / 1024).toFixed(2)} GB`;
5176
5248
  }
5177
5249
 
5178
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/api-client.js
5250
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/api-client.js
5179
5251
  var DEFAULT_BASE_URL = "https://api.sgroup.qq.com";
5180
5252
  var DEFAULT_TIMEOUT_MS = 3e4;
5181
5253
  var FILE_UPLOAD_TIMEOUT_MS = 12e4;
@@ -5270,12 +5342,12 @@ var ApiClient = class {
5270
5342
  }
5271
5343
  };
5272
5344
 
5273
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/media-chunked.js
5345
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/media-chunked.js
5274
5346
  var crypto = __toESM(require("crypto"), 1);
5275
5347
  var fs = __toESM(require("fs"), 1);
5276
5348
  var https = __toESM(require("https"), 1);
5277
5349
 
5278
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/retry.js
5350
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/retry.js
5279
5351
  async function withRetry(fn, policy, persistentPolicy, logger) {
5280
5352
  let lastError = null;
5281
5353
  for (let attempt = 0; attempt <= policy.maxRetries; attempt++) {
@@ -5367,7 +5439,7 @@ function buildPartFinishPersistentPolicy(retryTimeoutMs, retryableCodes = PART_F
5367
5439
  var PART_FINISH_RETRYABLE_CODES = /* @__PURE__ */ new Set([40093001]);
5368
5440
  var UPLOAD_PREPARE_FALLBACK_CODE = 40093002;
5369
5441
 
5370
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/routes.js
5442
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/routes.js
5371
5443
  function messagePath(scope, targetId) {
5372
5444
  return scope === "c2c" ? `/v2/users/${targetId}/messages` : `/v2/groups/${targetId}/messages`;
5373
5445
  }
@@ -5404,7 +5476,7 @@ function getNextMsgSeq(_msgId) {
5404
5476
  return (timePart ^ random) % 65536;
5405
5477
  }
5406
5478
 
5407
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/media-chunked.js
5479
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/media-chunked.js
5408
5480
  var UploadDailyLimitExceededError = class extends Error {
5409
5481
  filePath;
5410
5482
  fileSize;
@@ -5636,7 +5708,10 @@ async function putToPresignedUrl(presignedUrl, data, partIndex, totalParts, logg
5636
5708
  } catch (err) {
5637
5709
  lastError = err instanceof Error ? err : new Error(String(err));
5638
5710
  const code = err.code ?? "none";
5639
- 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
+ })();
5640
5715
  if (lastError.name === "AbortError") {
5641
5716
  lastError = new Error(`Part ${partIndex}/${totalParts} upload timeout after ${PART_UPLOAD_TIMEOUT_MS}ms`);
5642
5717
  }
@@ -5663,7 +5738,7 @@ function sleep2(ms) {
5663
5738
  return new Promise((resolve2) => setTimeout(resolve2, ms));
5664
5739
  }
5665
5740
 
5666
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/media.js
5741
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/media.js
5667
5742
  var fs2 = __toESM(require("fs"), 1);
5668
5743
  var MediaApi = class {
5669
5744
  client;
@@ -5744,7 +5819,7 @@ var MediaApi = class {
5744
5819
  }
5745
5820
  };
5746
5821
 
5747
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/messages.js
5822
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/messages.js
5748
5823
  var MessageApi = class {
5749
5824
  client;
5750
5825
  tokenManager;
@@ -5932,7 +6007,7 @@ var MessageApi = class {
5932
6007
  }
5933
6008
  };
5934
6009
 
5935
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/token.js
6010
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/token.js
5936
6011
  var DEFAULT_TOKEN_BASE_URL = "https://bots.qq.com";
5937
6012
  var TOKEN_PATH = "/app/getAppAccessToken";
5938
6013
  var TokenManager = class {
@@ -6108,7 +6183,7 @@ var TokenManager = class {
6108
6183
  }
6109
6184
  };
6110
6185
 
6111
- // node_modules/.pnpm/ws@8.20.1/node_modules/ws/wrapper.mjs
6186
+ // node_modules/.pnpm/ws@8.21.0/node_modules/ws/wrapper.mjs
6112
6187
  var import_stream = __toESM(require_stream(), 1);
6113
6188
  var import_extension = __toESM(require_extension(), 1);
6114
6189
  var import_permessage_deflate = __toESM(require_permessage_deflate(), 1);
@@ -6119,7 +6194,7 @@ var import_websocket = __toESM(require_websocket(), 1);
6119
6194
  var import_websocket_server = __toESM(require_websocket_server(), 1);
6120
6195
  var wrapper_default = import_websocket.default;
6121
6196
 
6122
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/codec.js
6197
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/codec.js
6123
6198
  function decodeGatewayMessageData(data) {
6124
6199
  if (typeof data === "string") {
6125
6200
  return data;
@@ -6146,7 +6221,7 @@ function readOptionalMessageSceneExt(event) {
6146
6221
  return scene?.ext;
6147
6222
  }
6148
6223
 
6149
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/constants.js
6224
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/constants.js
6150
6225
  var INTENTS = {
6151
6226
  GUILDS: 1 << 0,
6152
6227
  GUILD_MEMBERS: 1 << 1,
@@ -6219,7 +6294,7 @@ var GatewayEvent = {
6219
6294
  MESSAGE_REACTION_REMOVE: "MESSAGE_REACTION_REMOVE"
6220
6295
  };
6221
6296
 
6222
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/event-dispatcher.js
6297
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/event-dispatcher.js
6223
6298
  var REF_INDEX_KEY = "msg_idx";
6224
6299
  function parseRefIndices(ext, msgType, msgElements) {
6225
6300
  let refMsgIdx;
@@ -6360,7 +6435,7 @@ function dispatchEvent(eventType, data, _accountId, _log) {
6360
6435
  return { action: "raw", type: eventType, data };
6361
6436
  }
6362
6437
 
6363
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/reconnect.js
6438
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/reconnect.js
6364
6439
  var ReconnectState = class {
6365
6440
  accountId;
6366
6441
  log;
@@ -6471,7 +6546,7 @@ var ReconnectState = class {
6471
6546
  }
6472
6547
  };
6473
6548
 
6474
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/gateway-connection.js
6549
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/gateway-connection.js
6475
6550
  var GatewayConnection = class {
6476
6551
  isAborted = false;
6477
6552
  currentWs = null;
@@ -6729,7 +6804,7 @@ function previewPayload(data) {
6729
6804
  }
6730
6805
  }
6731
6806
 
6732
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/transport/webhook-verify.js
6807
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/transport/webhook-verify.js
6733
6808
  var crypto2 = __toESM(require("crypto"), 1);
6734
6809
  function deriveSeed(botSecret) {
6735
6810
  let seed = botSecret;
@@ -6781,7 +6856,7 @@ function signValidationResponse(params) {
6781
6856
  };
6782
6857
  }
6783
6858
 
6784
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/transport/webhook-server-node.js
6859
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/transport/webhook-server-node.js
6785
6860
  var http = __toESM(require("http"), 1);
6786
6861
  var NodeHttpWebhookServer = class {
6787
6862
  server = null;
@@ -6829,7 +6904,7 @@ var NodeHttpWebhookServer = class {
6829
6904
  }
6830
6905
  };
6831
6906
 
6832
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/transport/webhook.js
6907
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/transport/webhook.js
6833
6908
  var OP_DISPATCH = 0;
6834
6909
  var OP_HTTP_CALLBACK_ACK = 12;
6835
6910
  var OP_VALIDATION = 13;
@@ -6973,7 +7048,7 @@ function getHeader(headers, key) {
6973
7048
  return val;
6974
7049
  }
6975
7050
 
6976
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/file-utils.js
7051
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/file-utils.js
6977
7052
  var MAX_UPLOAD_SIZE = 20 * 1024 * 1024;
6978
7053
  var CHUNKED_UPLOAD_MAX_SIZE = 100 * 1024 * 1024;
6979
7054
  var LARGE_FILE_THRESHOLD = 5 * 1024 * 1024;
@@ -6991,7 +7066,7 @@ function sanitizeFileName(name) {
6991
7066
  return cleaned || "file";
6992
7067
  }
6993
7068
 
6994
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/upload-cache.js
7069
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/upload-cache.js
6995
7070
  var crypto3 = __toESM(require("crypto"), 1);
6996
7071
  var MAX_CACHE_SIZE = 500;
6997
7072
  function computeFileHash(data) {
@@ -7056,7 +7131,7 @@ var UploadCache = class {
7056
7131
  }
7057
7132
  };
7058
7133
 
7059
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/streaming.js
7134
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/streaming.js
7060
7135
  var DEFAULT_THROTTLE_MS = 500;
7061
7136
  var MIN_THROTTLE_MS = 300;
7062
7137
  var MAX_FLUSH_RETRIES = 3;
@@ -7224,7 +7299,7 @@ var StreamSession = class {
7224
7299
  }
7225
7300
  };
7226
7301
 
7227
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/QQBot.js
7302
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/QQBot.js
7228
7303
  var MsgType = {
7229
7304
  /** Plain text. */
7230
7305
  TEXT: 0,
@@ -7912,7 +7987,7 @@ var QQBot = class {
7912
7987
  }
7913
7988
  };
7914
7989
 
7915
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/message-filter.js
7990
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/message-filter.js
7916
7991
  function messageFilter(options = {}) {
7917
7992
  const skipSelfEcho = options.skipSelfEcho ?? true;
7918
7993
  const dedupOpts = options.dedup !== false ? { windowMs: 5e3, maxSize: 1e3, ...options.dedup ?? {} } : null;
@@ -7950,7 +8025,7 @@ function messageFilter(options = {}) {
7950
8025
  };
7951
8026
  }
7952
8027
 
7953
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/content-sanitizer.js
8028
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/content-sanitizer.js
7954
8029
  function contentSanitizer(options = {}) {
7955
8030
  const { stripBotMention = true, stripAllMentions = false, collapseWhitespace = false, parseFaceTags: parseFaceTags2 = false, transform } = options;
7956
8031
  return async (ctx, next) => {
@@ -8045,7 +8120,7 @@ function faceToEmoji(id) {
8045
8120
  return map[id];
8046
8121
  }
8047
8122
 
8048
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/rate-limiter.js
8123
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/rate-limiter.js
8049
8124
  var SlidingWindow = class {
8050
8125
  buckets = /* @__PURE__ */ new Map();
8051
8126
  max;
@@ -8099,11 +8174,11 @@ function rateLimiter(options = {}) {
8099
8174
  };
8100
8175
  }
8101
8176
 
8102
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/concurrency-guard.js
8177
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/concurrency-guard.js
8103
8178
  function concurrencyGuard(options = {}) {
8104
8179
  const strategy = options.strategy ?? "queue";
8105
8180
  const maxQueue = options.maxQueue ?? 3;
8106
- const { onDrop, onMerge, onDispatch } = options;
8181
+ const { onDrop, onMerge, onDispatch, urgentPredicate, maxProcessingMs } = options;
8107
8182
  const locks = /* @__PURE__ */ new Map();
8108
8183
  function getState(key) {
8109
8184
  let s = locks.get(key);
@@ -8133,9 +8208,31 @@ function concurrencyGuard(options = {}) {
8133
8208
  state.mergeBuffer = [];
8134
8209
  state.mergeWaiters = [];
8135
8210
  }
8211
+ let timedOut = false;
8212
+ let timeoutId;
8213
+ if (maxProcessingMs && maxProcessingMs > 0) {
8214
+ timeoutId = setTimeout(() => {
8215
+ timedOut = true;
8216
+ ctx.log.warn?.(`[concurrency] aborting active chain ${key} after ${maxProcessingMs}ms`);
8217
+ ctx.abort("concurrency:processing-timeout");
8218
+ state.busy = false;
8219
+ state.activeCtx = void 0;
8220
+ if (strategy === "merge") {
8221
+ drainMergeBuffer(key, state, ctx).catch(() => {
8222
+ });
8223
+ } else {
8224
+ drainQueue(key);
8225
+ }
8226
+ cleanupState(key);
8227
+ }, maxProcessingMs);
8228
+ }
8136
8229
  try {
8137
8230
  await next();
8138
8231
  } finally {
8232
+ if (timeoutId)
8233
+ clearTimeout(timeoutId);
8234
+ if (timedOut)
8235
+ return;
8139
8236
  state.activeCtx = void 0;
8140
8237
  if (strategy === "merge") {
8141
8238
  await drainMergeBuffer(key, state, ctx);
@@ -8156,6 +8253,15 @@ function concurrencyGuard(options = {}) {
8156
8253
  state.mergeBuffer = [];
8157
8254
  state.mergeWaiters = [];
8158
8255
  }
8256
+ if (urgentPredicate?.(ctx)) {
8257
+ ctx.log.debug?.(`[concurrency:merge] urgent for ${key}`);
8258
+ for (const w2 of state.mergeWaiters)
8259
+ w2.resolve();
8260
+ state.mergeBuffer.length = 0;
8261
+ state.mergeWaiters.length = 0;
8262
+ await next();
8263
+ return;
8264
+ }
8159
8265
  if (state.mergeBuffer.length >= maxQueue) {
8160
8266
  ctx.log.debug?.(`[concurrency:merge] buffer full (${maxQueue}), drop for ${key}`);
8161
8267
  await onDrop?.(ctx);
@@ -8303,7 +8409,7 @@ function concurrencyGuard(options = {}) {
8303
8409
  return guard;
8304
8410
  }
8305
8411
 
8306
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/mention-gate.js
8412
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/mention-gate.js
8307
8413
  function detectMentionInContent(content, appId) {
8308
8414
  if (!content || !appId)
8309
8415
  return false;
@@ -8359,7 +8465,7 @@ function mentionGate(options = {}) {
8359
8465
  };
8360
8466
  }
8361
8467
 
8362
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/quote-ref.js
8468
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/quote-ref.js
8363
8469
  var MemoryRefIndexStore = class {
8364
8470
  map = /* @__PURE__ */ new Map();
8365
8471
  maxSize;
@@ -8477,7 +8583,7 @@ function buildText(content, attachments) {
8477
8583
  return parts.join("\n") || "[empty message]";
8478
8584
  }
8479
8585
 
8480
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/envelope-formatter.js
8586
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/envelope-formatter.js
8481
8587
  function envelopeFormatter(options = {}) {
8482
8588
  const { historyLimit = 5, includeQuote = true, includeSender = true, format } = options;
8483
8589
  return async (ctx, next) => {
@@ -8549,7 +8655,7 @@ ${parts.join("\n")}
8549
8655
  return sections.join("\n\n");
8550
8656
  }
8551
8657
 
8552
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/slash-command.js
8658
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/slash-command.js
8553
8659
  function slashCommand(options = {}) {
8554
8660
  const prefixes = options.prefixes ?? ["/"];
8555
8661
  const catchErrors = options.catchErrors ?? true;
@@ -8701,7 +8807,7 @@ async function sendCommandResult(ctx, result) {
8701
8807
  }
8702
8808
  }
8703
8809
 
8704
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/history-buffer.js
8810
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/history-buffer.js
8705
8811
  var MemoryHistoryStore = class {
8706
8812
  buffers = /* @__PURE__ */ new Map();
8707
8813
  append(groupKey, entry, limit) {
@@ -8766,7 +8872,7 @@ function historyBuffer(options = {}) {
8766
8872
  return m3;
8767
8873
  }
8768
8874
 
8769
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/typing-indicator.js
8875
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/typing-indicator.js
8770
8876
  var DEFAULT_DURATION_SEC = 60;
8771
8877
  var DEFAULT_KEEPALIVE_INTERVAL_MS = 5e4;
8772
8878
  function typingIndicator(options = {}) {
@@ -8803,7 +8909,7 @@ function typingIndicator(options = {}) {
8803
8909
  };
8804
8910
  }
8805
8911
 
8806
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/error-handler.js
8912
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/error-handler.js
8807
8913
  var DEFAULT_FORMAT = (err) => {
8808
8914
  if (err instanceof ApiError) {
8809
8915
  if (err.bizMessage)
@@ -8841,7 +8947,7 @@ function errorHandler(options = {}) {
8841
8947
  };
8842
8948
  }
8843
8949
 
8844
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/storage/kv-store.js
8950
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/storage/kv-store.js
8845
8951
  var import_node_fs = __toESM(require("fs"), 1);
8846
8952
  var import_node_path = __toESM(require("path"), 1);
8847
8953
  var FileKVStore = class {
@@ -8951,7 +9057,7 @@ var FileKVStore = class {
8951
9057
  }
8952
9058
  };
8953
9059
 
8954
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/storage/session-adapter.js
9060
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/storage/session-adapter.js
8955
9061
  function kvSessionPersistence(opts) {
8956
9062
  const prefix = opts.prefix ?? "qqbot:session:";
8957
9063
  const key = `${prefix}${opts.accountId}`;
@@ -9178,7 +9284,7 @@ var import_node_path2 = __toESM(require("path"), 1);
9178
9284
  var import_node_fs2 = __toESM(require("fs"), 1);
9179
9285
  var _cachedOpenclawVersion;
9180
9286
  function getPackageVersion() {
9181
- return true ? "2.0.0-dev.202607091957" : "unknown";
9287
+ return true ? "2.0.0-dev.202607101321" : "unknown";
9182
9288
  }
9183
9289
  function getOpenclawVersion(runtimeVersion) {
9184
9290
  if (_cachedOpenclawVersion) return _cachedOpenclawVersion;
@@ -9787,6 +9893,27 @@ function isReservedAddr(ip) {
9787
9893
  return false;
9788
9894
  }
9789
9895
  var ALLOWED_SCHEMES = /* @__PURE__ */ new Set(["http:", "https:"]);
9896
+ var QQ_TRUSTED_DOMAINS = /* @__PURE__ */ new Set([
9897
+ // QQ Bot API
9898
+ "api.sgroup.qq.com",
9899
+ "sandbox.api.sgroup.qq.com",
9900
+ // QQ Bot Token
9901
+ "bots.qq.com",
9902
+ // QQ 多媒体上传/下载
9903
+ "multimedia.nt.qq.com.cn",
9904
+ "multimedia.nt.qq.com",
9905
+ // QQ 群文件
9906
+ "grouppro.grouppro.qq.com"
9907
+ ]);
9908
+ function isQQTrustedDomain(hostname) {
9909
+ if (QQ_TRUSTED_DOMAINS.has(hostname)) return true;
9910
+ const dot = hostname.indexOf(".");
9911
+ if (dot > 0) {
9912
+ const parent = hostname.slice(dot + 1);
9913
+ return QQ_TRUSTED_DOMAINS.has(parent);
9914
+ }
9915
+ return false;
9916
+ }
9790
9917
  async function validateRemoteUrl(raw) {
9791
9918
  const url = new URL(raw);
9792
9919
  if (!ALLOWED_SCHEMES.has(url.protocol)) {
@@ -9795,6 +9922,7 @@ async function validateRemoteUrl(raw) {
9795
9922
  );
9796
9923
  }
9797
9924
  const host = url.hostname.replace(/^\[|\]$/g, "");
9925
+ if (isQQTrustedDomain(host)) return;
9798
9926
  if (import_node_net.default.isIP(host)) {
9799
9927
  assertPublicAddr(host, raw);
9800
9928
  return;
@@ -11377,10 +11505,10 @@ function buildCommandList(account, opts) {
11377
11505
  // src/middleware/attachment.ts
11378
11506
  var path17 = __toESM(require("path"), 1);
11379
11507
 
11380
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/reply-limiter.js
11508
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/reply-limiter.js
11381
11509
  var DEFAULT_TTL_MS = 60 * 60 * 1e3;
11382
11510
 
11383
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/media-tags.js
11511
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/media-tags.js
11384
11512
  var VALID_TAGS = ["qqimg", "qqvoice", "qqvideo", "qqfile", "qqmedia"];
11385
11513
  var TAG_ALIASES = {
11386
11514
  qq_img: "qqimg",
@@ -11429,30 +11557,30 @@ var SELF_CLOSING_TAG_REGEX = new RegExp("`?" + LEFT_BRACKET + "\\s*(" + TAG_NAME
11429
11557
  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");
11430
11558
  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");
11431
11559
 
11432
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/ref-index-store.js
11560
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/ref-index-store.js
11433
11561
  var import_node_fs6 = __toESM(require("fs"), 1);
11434
11562
  var DEFAULT_TTL_MS2 = 7 * 24 * 60 * 60 * 1e3;
11435
11563
 
11436
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/session-store.js
11564
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/session-store.js
11437
11565
  var import_node_fs7 = __toESM(require("fs"), 1);
11438
11566
  var import_node_path7 = __toESM(require("path"), 1);
11439
11567
  var DEFAULT_EXPIRE_MS = 5 * 60 * 1e3;
11440
11568
 
11441
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/text-parsing.js
11569
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/text-parsing.js
11442
11570
  var MAX_FACE_EXT_BYTES = 64 * 1024;
11443
11571
 
11444
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/media-source.js
11572
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/media-source.js
11445
11573
  var fs14 = __toESM(require("fs"), 1);
11446
11574
 
11447
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/image-size.js
11575
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/image-size.js
11448
11576
  var import_node_buffer = require("buffer");
11449
11577
 
11450
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/ffmpeg.js
11578
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/ffmpeg.js
11451
11579
  var import_node_child_process = require("child_process");
11452
11580
  var fs15 = __toESM(require("fs"), 1);
11453
11581
  var path13 = __toESM(require("path"), 1);
11454
11582
 
11455
- // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607081646/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/audio.js
11583
+ // node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/audio.js
11456
11584
  var import_node_child_process2 = require("child_process");
11457
11585
  var fs16 = __toESM(require("fs"), 1);
11458
11586
  var path14 = __toESM(require("path"), 1);
@@ -12281,6 +12409,11 @@ function setupMiddlewares(bot, account, opts) {
12281
12409
  bot.use(concurrencyGuard({
12282
12410
  strategy: "merge",
12283
12411
  maxQueue: 50,
12412
+ maxProcessingMs: account.processingTimeoutMs,
12413
+ /** 紧急指令(/stop)跳过排队,立即处理 */
12414
+ urgentPredicate: (ctx) => {
12415
+ return (ctx.message.content ?? "").trim() === "/stop";
12416
+ },
12284
12417
  onMerge: (buffered) => {
12285
12418
  const last = buffered[buffered.length - 1];
12286
12419
  if (buffered.length === 1) return last;
@@ -12855,13 +12988,14 @@ async function dispatchToOpenClaw(ctx, msg, account, runtime2, log4) {
12855
12988
  await deliverReply(payload, info, deliverCtx);
12856
12989
  }
12857
12990
  },
12858
- ...streamingController ? {
12859
- replyOptions: {
12991
+ replyOptions: {
12992
+ abortSignal: ctx.signal,
12993
+ ...streamingController ? {
12860
12994
  onPartialReply: async (p2) => {
12861
12995
  if (p2.text) await streamingController.onPartialReply(p2.text);
12862
12996
  }
12863
- }
12864
- } : {}
12997
+ } : {}
12998
+ }
12865
12999
  });
12866
13000
  if (streamingController && !streamingController.isTerminal) {
12867
13001
  await streamingController.finalize();
@@ -12977,6 +13111,7 @@ async function dispatchToOpenClaw(ctx, msg, account, runtime2, log4) {
12977
13111
  }
12978
13112
  },
12979
13113
  replyOptions: {
13114
+ abortSignal: ctx.signal,
12980
13115
  runId: envelope.messageId,
12981
13116
  ...streamingController ? {
12982
13117
  onPartialReply: async (p2) => {
@@ -14951,7 +15086,7 @@ function verifyRuntimeContract(rt) {
14951
15086
  log3.error(`BROKEN \u2014 missing: ${missing.join(", ")}`);
14952
15087
  }
14953
15088
  if (degraded.length) {
14954
- log3.warn(`degraded: ${degraded.join(", ")}`);
15089
+ log3.debug(`degraded: ${degraded.join(", ")}`);
14955
15090
  }
14956
15091
  return { ok: missing.length === 0, version, missing, degraded };
14957
15092
  }
@@ -15030,6 +15165,7 @@ var index_default = plugin;
15030
15165
  resolveHistoryLimit,
15031
15166
  resolveIgnoreOtherMentions,
15032
15167
  resolveMentionPatterns,
15168
+ resolveProcessingTimeoutMs,
15033
15169
  resolveQQBotAccount,
15034
15170
  resolveRequireMention,
15035
15171
  resolveToolPolicy,