@cxyhhhhh/openclaw-qqbot 2.0.0-dev.202607092101 → 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 +119 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +5 -5
- package/src/adapter/contract.ts +1 -1
- package/src/config.ts +23 -0
- package/src/dispatch/dispatch.ts +8 -6
- package/src/gateway/middleware-setup.ts +2 -0
- package/src/outbound/cron-scheduler.ts +4 -3
- package/src/types.ts +16 -0
- package/src/utils/ssrf-guard.ts +32 -2
- package/skills/qqbot-group/SKILL.md +0 -75
- package/skills/qqbot-group/references/api_reference.md +0 -94
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.
|
|
5090
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/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.
|
|
5094
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/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.
|
|
5170
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/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.
|
|
5203
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/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.
|
|
5250
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/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.
|
|
5345
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/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.
|
|
5350
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/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.
|
|
5442
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/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.
|
|
5479
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/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 =
|
|
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,7 +5738,7 @@ 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.
|
|
5741
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/media.js
|
|
5725
5742
|
var fs2 = __toESM(require("fs"), 1);
|
|
5726
5743
|
var MediaApi = class {
|
|
5727
5744
|
client;
|
|
@@ -5802,7 +5819,7 @@ var MediaApi = class {
|
|
|
5802
5819
|
}
|
|
5803
5820
|
};
|
|
5804
5821
|
|
|
5805
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
5822
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/messages.js
|
|
5806
5823
|
var MessageApi = class {
|
|
5807
5824
|
client;
|
|
5808
5825
|
tokenManager;
|
|
@@ -5990,7 +6007,7 @@ var MessageApi = class {
|
|
|
5990
6007
|
}
|
|
5991
6008
|
};
|
|
5992
6009
|
|
|
5993
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
6010
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/token.js
|
|
5994
6011
|
var DEFAULT_TOKEN_BASE_URL = "https://bots.qq.com";
|
|
5995
6012
|
var TOKEN_PATH = "/app/getAppAccessToken";
|
|
5996
6013
|
var TokenManager = class {
|
|
@@ -6177,7 +6194,7 @@ var import_websocket = __toESM(require_websocket(), 1);
|
|
|
6177
6194
|
var import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
6178
6195
|
var wrapper_default = import_websocket.default;
|
|
6179
6196
|
|
|
6180
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
6197
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/codec.js
|
|
6181
6198
|
function decodeGatewayMessageData(data) {
|
|
6182
6199
|
if (typeof data === "string") {
|
|
6183
6200
|
return data;
|
|
@@ -6204,7 +6221,7 @@ function readOptionalMessageSceneExt(event) {
|
|
|
6204
6221
|
return scene?.ext;
|
|
6205
6222
|
}
|
|
6206
6223
|
|
|
6207
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
6224
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/constants.js
|
|
6208
6225
|
var INTENTS = {
|
|
6209
6226
|
GUILDS: 1 << 0,
|
|
6210
6227
|
GUILD_MEMBERS: 1 << 1,
|
|
@@ -6277,7 +6294,7 @@ var GatewayEvent = {
|
|
|
6277
6294
|
MESSAGE_REACTION_REMOVE: "MESSAGE_REACTION_REMOVE"
|
|
6278
6295
|
};
|
|
6279
6296
|
|
|
6280
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
6297
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/event-dispatcher.js
|
|
6281
6298
|
var REF_INDEX_KEY = "msg_idx";
|
|
6282
6299
|
function parseRefIndices(ext, msgType, msgElements) {
|
|
6283
6300
|
let refMsgIdx;
|
|
@@ -6418,7 +6435,7 @@ function dispatchEvent(eventType, data, _accountId, _log) {
|
|
|
6418
6435
|
return { action: "raw", type: eventType, data };
|
|
6419
6436
|
}
|
|
6420
6437
|
|
|
6421
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
6438
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/reconnect.js
|
|
6422
6439
|
var ReconnectState = class {
|
|
6423
6440
|
accountId;
|
|
6424
6441
|
log;
|
|
@@ -6529,7 +6546,7 @@ var ReconnectState = class {
|
|
|
6529
6546
|
}
|
|
6530
6547
|
};
|
|
6531
6548
|
|
|
6532
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
6549
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/gateway-connection.js
|
|
6533
6550
|
var GatewayConnection = class {
|
|
6534
6551
|
isAborted = false;
|
|
6535
6552
|
currentWs = null;
|
|
@@ -6787,7 +6804,7 @@ function previewPayload(data) {
|
|
|
6787
6804
|
}
|
|
6788
6805
|
}
|
|
6789
6806
|
|
|
6790
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
6807
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/transport/webhook-verify.js
|
|
6791
6808
|
var crypto2 = __toESM(require("crypto"), 1);
|
|
6792
6809
|
function deriveSeed(botSecret) {
|
|
6793
6810
|
let seed = botSecret;
|
|
@@ -6839,7 +6856,7 @@ function signValidationResponse(params) {
|
|
|
6839
6856
|
};
|
|
6840
6857
|
}
|
|
6841
6858
|
|
|
6842
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
6859
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/transport/webhook-server-node.js
|
|
6843
6860
|
var http = __toESM(require("http"), 1);
|
|
6844
6861
|
var NodeHttpWebhookServer = class {
|
|
6845
6862
|
server = null;
|
|
@@ -6887,7 +6904,7 @@ var NodeHttpWebhookServer = class {
|
|
|
6887
6904
|
}
|
|
6888
6905
|
};
|
|
6889
6906
|
|
|
6890
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
6907
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/transport/webhook.js
|
|
6891
6908
|
var OP_DISPATCH = 0;
|
|
6892
6909
|
var OP_HTTP_CALLBACK_ACK = 12;
|
|
6893
6910
|
var OP_VALIDATION = 13;
|
|
@@ -7031,7 +7048,7 @@ function getHeader(headers, key) {
|
|
|
7031
7048
|
return val;
|
|
7032
7049
|
}
|
|
7033
7050
|
|
|
7034
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
7051
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/file-utils.js
|
|
7035
7052
|
var MAX_UPLOAD_SIZE = 20 * 1024 * 1024;
|
|
7036
7053
|
var CHUNKED_UPLOAD_MAX_SIZE = 100 * 1024 * 1024;
|
|
7037
7054
|
var LARGE_FILE_THRESHOLD = 5 * 1024 * 1024;
|
|
@@ -7049,7 +7066,7 @@ function sanitizeFileName(name) {
|
|
|
7049
7066
|
return cleaned || "file";
|
|
7050
7067
|
}
|
|
7051
7068
|
|
|
7052
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
7069
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/upload-cache.js
|
|
7053
7070
|
var crypto3 = __toESM(require("crypto"), 1);
|
|
7054
7071
|
var MAX_CACHE_SIZE = 500;
|
|
7055
7072
|
function computeFileHash(data) {
|
|
@@ -7114,7 +7131,7 @@ var UploadCache = class {
|
|
|
7114
7131
|
}
|
|
7115
7132
|
};
|
|
7116
7133
|
|
|
7117
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
7134
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/streaming.js
|
|
7118
7135
|
var DEFAULT_THROTTLE_MS = 500;
|
|
7119
7136
|
var MIN_THROTTLE_MS = 300;
|
|
7120
7137
|
var MAX_FLUSH_RETRIES = 3;
|
|
@@ -7282,7 +7299,7 @@ var StreamSession = class {
|
|
|
7282
7299
|
}
|
|
7283
7300
|
};
|
|
7284
7301
|
|
|
7285
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
7302
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/QQBot.js
|
|
7286
7303
|
var MsgType = {
|
|
7287
7304
|
/** Plain text. */
|
|
7288
7305
|
TEXT: 0,
|
|
@@ -7970,7 +7987,7 @@ var QQBot = class {
|
|
|
7970
7987
|
}
|
|
7971
7988
|
};
|
|
7972
7989
|
|
|
7973
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
7990
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/message-filter.js
|
|
7974
7991
|
function messageFilter(options = {}) {
|
|
7975
7992
|
const skipSelfEcho = options.skipSelfEcho ?? true;
|
|
7976
7993
|
const dedupOpts = options.dedup !== false ? { windowMs: 5e3, maxSize: 1e3, ...options.dedup ?? {} } : null;
|
|
@@ -8008,7 +8025,7 @@ function messageFilter(options = {}) {
|
|
|
8008
8025
|
};
|
|
8009
8026
|
}
|
|
8010
8027
|
|
|
8011
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8028
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/content-sanitizer.js
|
|
8012
8029
|
function contentSanitizer(options = {}) {
|
|
8013
8030
|
const { stripBotMention = true, stripAllMentions = false, collapseWhitespace = false, parseFaceTags: parseFaceTags2 = false, transform } = options;
|
|
8014
8031
|
return async (ctx, next) => {
|
|
@@ -8103,7 +8120,7 @@ function faceToEmoji(id) {
|
|
|
8103
8120
|
return map[id];
|
|
8104
8121
|
}
|
|
8105
8122
|
|
|
8106
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8123
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/rate-limiter.js
|
|
8107
8124
|
var SlidingWindow = class {
|
|
8108
8125
|
buckets = /* @__PURE__ */ new Map();
|
|
8109
8126
|
max;
|
|
@@ -8157,11 +8174,11 @@ function rateLimiter(options = {}) {
|
|
|
8157
8174
|
};
|
|
8158
8175
|
}
|
|
8159
8176
|
|
|
8160
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8177
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/concurrency-guard.js
|
|
8161
8178
|
function concurrencyGuard(options = {}) {
|
|
8162
8179
|
const strategy = options.strategy ?? "queue";
|
|
8163
8180
|
const maxQueue = options.maxQueue ?? 3;
|
|
8164
|
-
const { onDrop, onMerge, onDispatch, urgentPredicate } = options;
|
|
8181
|
+
const { onDrop, onMerge, onDispatch, urgentPredicate, maxProcessingMs } = options;
|
|
8165
8182
|
const locks = /* @__PURE__ */ new Map();
|
|
8166
8183
|
function getState(key) {
|
|
8167
8184
|
let s = locks.get(key);
|
|
@@ -8191,9 +8208,31 @@ function concurrencyGuard(options = {}) {
|
|
|
8191
8208
|
state.mergeBuffer = [];
|
|
8192
8209
|
state.mergeWaiters = [];
|
|
8193
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
|
+
}
|
|
8194
8229
|
try {
|
|
8195
8230
|
await next();
|
|
8196
8231
|
} finally {
|
|
8232
|
+
if (timeoutId)
|
|
8233
|
+
clearTimeout(timeoutId);
|
|
8234
|
+
if (timedOut)
|
|
8235
|
+
return;
|
|
8197
8236
|
state.activeCtx = void 0;
|
|
8198
8237
|
if (strategy === "merge") {
|
|
8199
8238
|
await drainMergeBuffer(key, state, ctx);
|
|
@@ -8370,7 +8409,7 @@ function concurrencyGuard(options = {}) {
|
|
|
8370
8409
|
return guard;
|
|
8371
8410
|
}
|
|
8372
8411
|
|
|
8373
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8412
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/mention-gate.js
|
|
8374
8413
|
function detectMentionInContent(content, appId) {
|
|
8375
8414
|
if (!content || !appId)
|
|
8376
8415
|
return false;
|
|
@@ -8426,7 +8465,7 @@ function mentionGate(options = {}) {
|
|
|
8426
8465
|
};
|
|
8427
8466
|
}
|
|
8428
8467
|
|
|
8429
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8468
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/quote-ref.js
|
|
8430
8469
|
var MemoryRefIndexStore = class {
|
|
8431
8470
|
map = /* @__PURE__ */ new Map();
|
|
8432
8471
|
maxSize;
|
|
@@ -8544,7 +8583,7 @@ function buildText(content, attachments) {
|
|
|
8544
8583
|
return parts.join("\n") || "[empty message]";
|
|
8545
8584
|
}
|
|
8546
8585
|
|
|
8547
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8586
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/envelope-formatter.js
|
|
8548
8587
|
function envelopeFormatter(options = {}) {
|
|
8549
8588
|
const { historyLimit = 5, includeQuote = true, includeSender = true, format } = options;
|
|
8550
8589
|
return async (ctx, next) => {
|
|
@@ -8616,7 +8655,7 @@ ${parts.join("\n")}
|
|
|
8616
8655
|
return sections.join("\n\n");
|
|
8617
8656
|
}
|
|
8618
8657
|
|
|
8619
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8658
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/slash-command.js
|
|
8620
8659
|
function slashCommand(options = {}) {
|
|
8621
8660
|
const prefixes = options.prefixes ?? ["/"];
|
|
8622
8661
|
const catchErrors = options.catchErrors ?? true;
|
|
@@ -8768,7 +8807,7 @@ async function sendCommandResult(ctx, result) {
|
|
|
8768
8807
|
}
|
|
8769
8808
|
}
|
|
8770
8809
|
|
|
8771
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8810
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/history-buffer.js
|
|
8772
8811
|
var MemoryHistoryStore = class {
|
|
8773
8812
|
buffers = /* @__PURE__ */ new Map();
|
|
8774
8813
|
append(groupKey, entry, limit) {
|
|
@@ -8833,7 +8872,7 @@ function historyBuffer(options = {}) {
|
|
|
8833
8872
|
return m3;
|
|
8834
8873
|
}
|
|
8835
8874
|
|
|
8836
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8875
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/typing-indicator.js
|
|
8837
8876
|
var DEFAULT_DURATION_SEC = 60;
|
|
8838
8877
|
var DEFAULT_KEEPALIVE_INTERVAL_MS = 5e4;
|
|
8839
8878
|
function typingIndicator(options = {}) {
|
|
@@ -8870,7 +8909,7 @@ function typingIndicator(options = {}) {
|
|
|
8870
8909
|
};
|
|
8871
8910
|
}
|
|
8872
8911
|
|
|
8873
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8912
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/error-handler.js
|
|
8874
8913
|
var DEFAULT_FORMAT = (err) => {
|
|
8875
8914
|
if (err instanceof ApiError) {
|
|
8876
8915
|
if (err.bizMessage)
|
|
@@ -8908,7 +8947,7 @@ function errorHandler(options = {}) {
|
|
|
8908
8947
|
};
|
|
8909
8948
|
}
|
|
8910
8949
|
|
|
8911
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8950
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/storage/kv-store.js
|
|
8912
8951
|
var import_node_fs = __toESM(require("fs"), 1);
|
|
8913
8952
|
var import_node_path = __toESM(require("path"), 1);
|
|
8914
8953
|
var FileKVStore = class {
|
|
@@ -9018,7 +9057,7 @@ var FileKVStore = class {
|
|
|
9018
9057
|
}
|
|
9019
9058
|
};
|
|
9020
9059
|
|
|
9021
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
9060
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/storage/session-adapter.js
|
|
9022
9061
|
function kvSessionPersistence(opts) {
|
|
9023
9062
|
const prefix = opts.prefix ?? "qqbot:session:";
|
|
9024
9063
|
const key = `${prefix}${opts.accountId}`;
|
|
@@ -9245,7 +9284,7 @@ var import_node_path2 = __toESM(require("path"), 1);
|
|
|
9245
9284
|
var import_node_fs2 = __toESM(require("fs"), 1);
|
|
9246
9285
|
var _cachedOpenclawVersion;
|
|
9247
9286
|
function getPackageVersion() {
|
|
9248
|
-
return true ? "2.0.0-dev.
|
|
9287
|
+
return true ? "2.0.0-dev.202607101321" : "unknown";
|
|
9249
9288
|
}
|
|
9250
9289
|
function getOpenclawVersion(runtimeVersion) {
|
|
9251
9290
|
if (_cachedOpenclawVersion) return _cachedOpenclawVersion;
|
|
@@ -9854,6 +9893,27 @@ function isReservedAddr(ip) {
|
|
|
9854
9893
|
return false;
|
|
9855
9894
|
}
|
|
9856
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
|
+
}
|
|
9857
9917
|
async function validateRemoteUrl(raw) {
|
|
9858
9918
|
const url = new URL(raw);
|
|
9859
9919
|
if (!ALLOWED_SCHEMES.has(url.protocol)) {
|
|
@@ -9862,6 +9922,7 @@ async function validateRemoteUrl(raw) {
|
|
|
9862
9922
|
);
|
|
9863
9923
|
}
|
|
9864
9924
|
const host = url.hostname.replace(/^\[|\]$/g, "");
|
|
9925
|
+
if (isQQTrustedDomain(host)) return;
|
|
9865
9926
|
if (import_node_net.default.isIP(host)) {
|
|
9866
9927
|
assertPublicAddr(host, raw);
|
|
9867
9928
|
return;
|
|
@@ -11444,10 +11505,10 @@ function buildCommandList(account, opts) {
|
|
|
11444
11505
|
// src/middleware/attachment.ts
|
|
11445
11506
|
var path17 = __toESM(require("path"), 1);
|
|
11446
11507
|
|
|
11447
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
11508
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/reply-limiter.js
|
|
11448
11509
|
var DEFAULT_TTL_MS = 60 * 60 * 1e3;
|
|
11449
11510
|
|
|
11450
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
11511
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/media-tags.js
|
|
11451
11512
|
var VALID_TAGS = ["qqimg", "qqvoice", "qqvideo", "qqfile", "qqmedia"];
|
|
11452
11513
|
var TAG_ALIASES = {
|
|
11453
11514
|
qq_img: "qqimg",
|
|
@@ -11496,30 +11557,30 @@ var SELF_CLOSING_TAG_REGEX = new RegExp("`?" + LEFT_BRACKET + "\\s*(" + TAG_NAME
|
|
|
11496
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");
|
|
11497
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");
|
|
11498
11559
|
|
|
11499
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
11560
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/ref-index-store.js
|
|
11500
11561
|
var import_node_fs6 = __toESM(require("fs"), 1);
|
|
11501
11562
|
var DEFAULT_TTL_MS2 = 7 * 24 * 60 * 60 * 1e3;
|
|
11502
11563
|
|
|
11503
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
11564
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/session-store.js
|
|
11504
11565
|
var import_node_fs7 = __toESM(require("fs"), 1);
|
|
11505
11566
|
var import_node_path7 = __toESM(require("path"), 1);
|
|
11506
11567
|
var DEFAULT_EXPIRE_MS = 5 * 60 * 1e3;
|
|
11507
11568
|
|
|
11508
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
11569
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/text-parsing.js
|
|
11509
11570
|
var MAX_FACE_EXT_BYTES = 64 * 1024;
|
|
11510
11571
|
|
|
11511
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
11572
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/media-source.js
|
|
11512
11573
|
var fs14 = __toESM(require("fs"), 1);
|
|
11513
11574
|
|
|
11514
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
11575
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/image-size.js
|
|
11515
11576
|
var import_node_buffer = require("buffer");
|
|
11516
11577
|
|
|
11517
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
11578
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/ffmpeg.js
|
|
11518
11579
|
var import_node_child_process = require("child_process");
|
|
11519
11580
|
var fs15 = __toESM(require("fs"), 1);
|
|
11520
11581
|
var path13 = __toESM(require("path"), 1);
|
|
11521
11582
|
|
|
11522
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
11583
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/audio.js
|
|
11523
11584
|
var import_node_child_process2 = require("child_process");
|
|
11524
11585
|
var fs16 = __toESM(require("fs"), 1);
|
|
11525
11586
|
var path14 = __toESM(require("path"), 1);
|
|
@@ -12348,6 +12409,7 @@ function setupMiddlewares(bot, account, opts) {
|
|
|
12348
12409
|
bot.use(concurrencyGuard({
|
|
12349
12410
|
strategy: "merge",
|
|
12350
12411
|
maxQueue: 50,
|
|
12412
|
+
maxProcessingMs: account.processingTimeoutMs,
|
|
12351
12413
|
/** 紧急指令(/stop)跳过排队,立即处理 */
|
|
12352
12414
|
urgentPredicate: (ctx) => {
|
|
12353
12415
|
return (ctx.message.content ?? "").trim() === "/stop";
|
|
@@ -12926,13 +12988,14 @@ async function dispatchToOpenClaw(ctx, msg, account, runtime2, log4) {
|
|
|
12926
12988
|
await deliverReply(payload, info, deliverCtx);
|
|
12927
12989
|
}
|
|
12928
12990
|
},
|
|
12929
|
-
|
|
12930
|
-
|
|
12991
|
+
replyOptions: {
|
|
12992
|
+
abortSignal: ctx.signal,
|
|
12993
|
+
...streamingController ? {
|
|
12931
12994
|
onPartialReply: async (p2) => {
|
|
12932
12995
|
if (p2.text) await streamingController.onPartialReply(p2.text);
|
|
12933
12996
|
}
|
|
12934
|
-
}
|
|
12935
|
-
}
|
|
12997
|
+
} : {}
|
|
12998
|
+
}
|
|
12936
12999
|
});
|
|
12937
13000
|
if (streamingController && !streamingController.isTerminal) {
|
|
12938
13001
|
await streamingController.finalize();
|
|
@@ -13048,6 +13111,7 @@ async function dispatchToOpenClaw(ctx, msg, account, runtime2, log4) {
|
|
|
13048
13111
|
}
|
|
13049
13112
|
},
|
|
13050
13113
|
replyOptions: {
|
|
13114
|
+
abortSignal: ctx.signal,
|
|
13051
13115
|
runId: envelope.messageId,
|
|
13052
13116
|
...streamingController ? {
|
|
13053
13117
|
onPartialReply: async (p2) => {
|
|
@@ -15022,7 +15086,7 @@ function verifyRuntimeContract(rt) {
|
|
|
15022
15086
|
log3.error(`BROKEN \u2014 missing: ${missing.join(", ")}`);
|
|
15023
15087
|
}
|
|
15024
15088
|
if (degraded.length) {
|
|
15025
|
-
log3.
|
|
15089
|
+
log3.debug(`degraded: ${degraded.join(", ")}`);
|
|
15026
15090
|
}
|
|
15027
15091
|
return { ok: missing.length === 0, version, missing, degraded };
|
|
15028
15092
|
}
|
|
@@ -15101,6 +15165,7 @@ var index_default = plugin;
|
|
|
15101
15165
|
resolveHistoryLimit,
|
|
15102
15166
|
resolveIgnoreOtherMentions,
|
|
15103
15167
|
resolveMentionPatterns,
|
|
15168
|
+
resolveProcessingTimeoutMs,
|
|
15104
15169
|
resolveQQBotAccount,
|
|
15105
15170
|
resolveRequireMention,
|
|
15106
15171
|
resolveToolPolicy,
|