@cxyhhhhh/openclaw-qqbot 2.0.0-dev.202607101321 → 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 +103 -89
- package/dist/index.cjs.map +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +2 -2
- package/skills/qqbot-group/SKILL.md +75 -0
- package/skills/qqbot-group/references/api_reference.md +94 -0
- package/src/dispatch/body-assembler.ts +2 -2
- package/src/gateway/middleware-setup.ts +17 -11
package/dist/index.cjs
CHANGED
|
@@ -5087,11 +5087,11 @@ var import_node_os = __toESM(require("os"), 1);
|
|
|
5087
5087
|
// src/outbound/outbound-service.ts
|
|
5088
5088
|
var path3 = __toESM(require("path"), 1);
|
|
5089
5089
|
|
|
5090
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
5090
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/QQBot.js
|
|
5091
5091
|
var fs3 = __toESM(require("fs"), 1);
|
|
5092
5092
|
var path = __toESM(require("path"), 1);
|
|
5093
5093
|
|
|
5094
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
5094
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/types.js
|
|
5095
5095
|
function resolvePolicy(ctx, path22, explicit, defaultValue) {
|
|
5096
5096
|
if (explicit !== void 0 && explicit !== null) {
|
|
5097
5097
|
return explicit;
|
|
@@ -5167,7 +5167,7 @@ function createMiddlewareContext(params) {
|
|
|
5167
5167
|
return ctx;
|
|
5168
5168
|
}
|
|
5169
5169
|
|
|
5170
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
5170
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/types.js
|
|
5171
5171
|
var ApiError = class extends Error {
|
|
5172
5172
|
httpStatus;
|
|
5173
5173
|
path;
|
|
@@ -5200,7 +5200,7 @@ var StreamContentType = {
|
|
|
5200
5200
|
MARKDOWN: "markdown"
|
|
5201
5201
|
};
|
|
5202
5202
|
|
|
5203
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
5203
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/format.js
|
|
5204
5204
|
function formatErrorMessage(err) {
|
|
5205
5205
|
if (err instanceof Error) {
|
|
5206
5206
|
let formatted = err.message || err.name || "Error";
|
|
@@ -5247,7 +5247,7 @@ function formatFileSize(bytes) {
|
|
|
5247
5247
|
return `${(bytes / 1024 / 1024 / 1024).toFixed(2)} GB`;
|
|
5248
5248
|
}
|
|
5249
5249
|
|
|
5250
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
5250
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/api-client.js
|
|
5251
5251
|
var DEFAULT_BASE_URL = "https://api.sgroup.qq.com";
|
|
5252
5252
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
5253
5253
|
var FILE_UPLOAD_TIMEOUT_MS = 12e4;
|
|
@@ -5342,12 +5342,12 @@ var ApiClient = class {
|
|
|
5342
5342
|
}
|
|
5343
5343
|
};
|
|
5344
5344
|
|
|
5345
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
5345
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/media-chunked.js
|
|
5346
5346
|
var crypto = __toESM(require("crypto"), 1);
|
|
5347
5347
|
var fs = __toESM(require("fs"), 1);
|
|
5348
5348
|
var https = __toESM(require("https"), 1);
|
|
5349
5349
|
|
|
5350
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
5350
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/retry.js
|
|
5351
5351
|
async function withRetry(fn, policy, persistentPolicy, logger) {
|
|
5352
5352
|
let lastError = null;
|
|
5353
5353
|
for (let attempt = 0; attempt <= policy.maxRetries; attempt++) {
|
|
@@ -5439,7 +5439,7 @@ function buildPartFinishPersistentPolicy(retryTimeoutMs, retryableCodes = PART_F
|
|
|
5439
5439
|
var PART_FINISH_RETRYABLE_CODES = /* @__PURE__ */ new Set([40093001]);
|
|
5440
5440
|
var UPLOAD_PREPARE_FALLBACK_CODE = 40093002;
|
|
5441
5441
|
|
|
5442
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
5442
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/routes.js
|
|
5443
5443
|
function messagePath(scope, targetId) {
|
|
5444
5444
|
return scope === "c2c" ? `/v2/users/${targetId}/messages` : `/v2/groups/${targetId}/messages`;
|
|
5445
5445
|
}
|
|
@@ -5476,7 +5476,7 @@ function getNextMsgSeq(_msgId) {
|
|
|
5476
5476
|
return (timePart ^ random) % 65536;
|
|
5477
5477
|
}
|
|
5478
5478
|
|
|
5479
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
5479
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/media-chunked.js
|
|
5480
5480
|
var UploadDailyLimitExceededError = class extends Error {
|
|
5481
5481
|
filePath;
|
|
5482
5482
|
fileSize;
|
|
@@ -5738,8 +5738,32 @@ function sleep2(ms) {
|
|
|
5738
5738
|
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
5739
5739
|
}
|
|
5740
5740
|
|
|
5741
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
5741
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/media.js
|
|
5742
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
|
+
}
|
|
5743
5767
|
var MediaApi = class {
|
|
5744
5768
|
client;
|
|
5745
5769
|
tokenManager;
|
|
@@ -5771,6 +5795,10 @@ var MediaApi = class {
|
|
|
5771
5795
|
const buf = await fs2.promises.readFile(opts.localPath);
|
|
5772
5796
|
fileData = buf.toString("base64");
|
|
5773
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
|
+
}
|
|
5774
5802
|
if (fileData && this.cache) {
|
|
5775
5803
|
const hash = this.cache.computeHash(fileData);
|
|
5776
5804
|
const cached = this.cache.get(hash, scope, targetId, fileType);
|
|
@@ -5819,7 +5847,7 @@ var MediaApi = class {
|
|
|
5819
5847
|
}
|
|
5820
5848
|
};
|
|
5821
5849
|
|
|
5822
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
5850
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/messages.js
|
|
5823
5851
|
var MessageApi = class {
|
|
5824
5852
|
client;
|
|
5825
5853
|
tokenManager;
|
|
@@ -6007,7 +6035,7 @@ var MessageApi = class {
|
|
|
6007
6035
|
}
|
|
6008
6036
|
};
|
|
6009
6037
|
|
|
6010
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
6038
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/api/token.js
|
|
6011
6039
|
var DEFAULT_TOKEN_BASE_URL = "https://bots.qq.com";
|
|
6012
6040
|
var TOKEN_PATH = "/app/getAppAccessToken";
|
|
6013
6041
|
var TokenManager = class {
|
|
@@ -6194,7 +6222,7 @@ var import_websocket = __toESM(require_websocket(), 1);
|
|
|
6194
6222
|
var import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
6195
6223
|
var wrapper_default = import_websocket.default;
|
|
6196
6224
|
|
|
6197
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
6225
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/codec.js
|
|
6198
6226
|
function decodeGatewayMessageData(data) {
|
|
6199
6227
|
if (typeof data === "string") {
|
|
6200
6228
|
return data;
|
|
@@ -6221,7 +6249,7 @@ function readOptionalMessageSceneExt(event) {
|
|
|
6221
6249
|
return scene?.ext;
|
|
6222
6250
|
}
|
|
6223
6251
|
|
|
6224
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
6252
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/constants.js
|
|
6225
6253
|
var INTENTS = {
|
|
6226
6254
|
GUILDS: 1 << 0,
|
|
6227
6255
|
GUILD_MEMBERS: 1 << 1,
|
|
@@ -6294,7 +6322,7 @@ var GatewayEvent = {
|
|
|
6294
6322
|
MESSAGE_REACTION_REMOVE: "MESSAGE_REACTION_REMOVE"
|
|
6295
6323
|
};
|
|
6296
6324
|
|
|
6297
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
6325
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/event-dispatcher.js
|
|
6298
6326
|
var REF_INDEX_KEY = "msg_idx";
|
|
6299
6327
|
function parseRefIndices(ext, msgType, msgElements) {
|
|
6300
6328
|
let refMsgIdx;
|
|
@@ -6435,7 +6463,7 @@ function dispatchEvent(eventType, data, _accountId, _log) {
|
|
|
6435
6463
|
return { action: "raw", type: eventType, data };
|
|
6436
6464
|
}
|
|
6437
6465
|
|
|
6438
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
6466
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/reconnect.js
|
|
6439
6467
|
var ReconnectState = class {
|
|
6440
6468
|
accountId;
|
|
6441
6469
|
log;
|
|
@@ -6546,7 +6574,7 @@ var ReconnectState = class {
|
|
|
6546
6574
|
}
|
|
6547
6575
|
};
|
|
6548
6576
|
|
|
6549
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
6577
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/gateway/gateway-connection.js
|
|
6550
6578
|
var GatewayConnection = class {
|
|
6551
6579
|
isAborted = false;
|
|
6552
6580
|
currentWs = null;
|
|
@@ -6804,7 +6832,7 @@ function previewPayload(data) {
|
|
|
6804
6832
|
}
|
|
6805
6833
|
}
|
|
6806
6834
|
|
|
6807
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
6835
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/transport/webhook-verify.js
|
|
6808
6836
|
var crypto2 = __toESM(require("crypto"), 1);
|
|
6809
6837
|
function deriveSeed(botSecret) {
|
|
6810
6838
|
let seed = botSecret;
|
|
@@ -6856,7 +6884,7 @@ function signValidationResponse(params) {
|
|
|
6856
6884
|
};
|
|
6857
6885
|
}
|
|
6858
6886
|
|
|
6859
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
6887
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/transport/webhook-server-node.js
|
|
6860
6888
|
var http = __toESM(require("http"), 1);
|
|
6861
6889
|
var NodeHttpWebhookServer = class {
|
|
6862
6890
|
server = null;
|
|
@@ -6904,7 +6932,7 @@ var NodeHttpWebhookServer = class {
|
|
|
6904
6932
|
}
|
|
6905
6933
|
};
|
|
6906
6934
|
|
|
6907
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
6935
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/transport/webhook.js
|
|
6908
6936
|
var OP_DISPATCH = 0;
|
|
6909
6937
|
var OP_HTTP_CALLBACK_ACK = 12;
|
|
6910
6938
|
var OP_VALIDATION = 13;
|
|
@@ -7048,25 +7076,7 @@ function getHeader(headers, key) {
|
|
|
7048
7076
|
return val;
|
|
7049
7077
|
}
|
|
7050
7078
|
|
|
7051
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
7052
|
-
var MAX_UPLOAD_SIZE = 20 * 1024 * 1024;
|
|
7053
|
-
var CHUNKED_UPLOAD_MAX_SIZE = 100 * 1024 * 1024;
|
|
7054
|
-
var LARGE_FILE_THRESHOLD = 5 * 1024 * 1024;
|
|
7055
|
-
var MEDIA_FILE_TYPE_INFO = {
|
|
7056
|
-
[MediaFileType.IMAGE]: { maxSize: 30 * 1024 * 1024, name: "image" },
|
|
7057
|
-
[MediaFileType.VIDEO]: { maxSize: 100 * 1024 * 1024, name: "video" },
|
|
7058
|
-
[MediaFileType.VOICE]: { maxSize: 20 * 1024 * 1024, name: "voice" },
|
|
7059
|
-
[MediaFileType.FILE]: { maxSize: 100 * 1024 * 1024, name: "file" }
|
|
7060
|
-
};
|
|
7061
|
-
function sanitizeFileName(name) {
|
|
7062
|
-
if (!name) {
|
|
7063
|
-
return "file";
|
|
7064
|
-
}
|
|
7065
|
-
const cleaned = name.replace(/[\\/:*?"<>|]/g, "_").replace(/[\u0000-\u001f\u007f]/g, "").replace(/\s+/g, " ").trim();
|
|
7066
|
-
return cleaned || "file";
|
|
7067
|
-
}
|
|
7068
|
-
|
|
7069
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101142/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
|
|
7070
7080
|
var crypto3 = __toESM(require("crypto"), 1);
|
|
7071
7081
|
var MAX_CACHE_SIZE = 500;
|
|
7072
7082
|
function computeFileHash(data) {
|
|
@@ -7131,7 +7141,7 @@ var UploadCache = class {
|
|
|
7131
7141
|
}
|
|
7132
7142
|
};
|
|
7133
7143
|
|
|
7134
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
7144
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/streaming.js
|
|
7135
7145
|
var DEFAULT_THROTTLE_MS = 500;
|
|
7136
7146
|
var MIN_THROTTLE_MS = 300;
|
|
7137
7147
|
var MAX_FLUSH_RETRIES = 3;
|
|
@@ -7299,7 +7309,7 @@ var StreamSession = class {
|
|
|
7299
7309
|
}
|
|
7300
7310
|
};
|
|
7301
7311
|
|
|
7302
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
7312
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/QQBot.js
|
|
7303
7313
|
var MsgType = {
|
|
7304
7314
|
/** Plain text. */
|
|
7305
7315
|
TEXT: 0,
|
|
@@ -7987,7 +7997,7 @@ var QQBot = class {
|
|
|
7987
7997
|
}
|
|
7988
7998
|
};
|
|
7989
7999
|
|
|
7990
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8000
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/message-filter.js
|
|
7991
8001
|
function messageFilter(options = {}) {
|
|
7992
8002
|
const skipSelfEcho = options.skipSelfEcho ?? true;
|
|
7993
8003
|
const dedupOpts = options.dedup !== false ? { windowMs: 5e3, maxSize: 1e3, ...options.dedup ?? {} } : null;
|
|
@@ -8025,7 +8035,7 @@ function messageFilter(options = {}) {
|
|
|
8025
8035
|
};
|
|
8026
8036
|
}
|
|
8027
8037
|
|
|
8028
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8038
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/content-sanitizer.js
|
|
8029
8039
|
function contentSanitizer(options = {}) {
|
|
8030
8040
|
const { stripBotMention = true, stripAllMentions = false, collapseWhitespace = false, parseFaceTags: parseFaceTags2 = false, transform } = options;
|
|
8031
8041
|
return async (ctx, next) => {
|
|
@@ -8120,7 +8130,7 @@ function faceToEmoji(id) {
|
|
|
8120
8130
|
return map[id];
|
|
8121
8131
|
}
|
|
8122
8132
|
|
|
8123
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8133
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/rate-limiter.js
|
|
8124
8134
|
var SlidingWindow = class {
|
|
8125
8135
|
buckets = /* @__PURE__ */ new Map();
|
|
8126
8136
|
max;
|
|
@@ -8174,7 +8184,7 @@ function rateLimiter(options = {}) {
|
|
|
8174
8184
|
};
|
|
8175
8185
|
}
|
|
8176
8186
|
|
|
8177
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8187
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/concurrency-guard.js
|
|
8178
8188
|
function concurrencyGuard(options = {}) {
|
|
8179
8189
|
const strategy = options.strategy ?? "queue";
|
|
8180
8190
|
const maxQueue = options.maxQueue ?? 3;
|
|
@@ -8409,7 +8419,7 @@ function concurrencyGuard(options = {}) {
|
|
|
8409
8419
|
return guard;
|
|
8410
8420
|
}
|
|
8411
8421
|
|
|
8412
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8422
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/mention-gate.js
|
|
8413
8423
|
function detectMentionInContent(content, appId) {
|
|
8414
8424
|
if (!content || !appId)
|
|
8415
8425
|
return false;
|
|
@@ -8465,7 +8475,7 @@ function mentionGate(options = {}) {
|
|
|
8465
8475
|
};
|
|
8466
8476
|
}
|
|
8467
8477
|
|
|
8468
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8478
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/quote-ref.js
|
|
8469
8479
|
var MemoryRefIndexStore = class {
|
|
8470
8480
|
map = /* @__PURE__ */ new Map();
|
|
8471
8481
|
maxSize;
|
|
@@ -8583,7 +8593,7 @@ function buildText(content, attachments) {
|
|
|
8583
8593
|
return parts.join("\n") || "[empty message]";
|
|
8584
8594
|
}
|
|
8585
8595
|
|
|
8586
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8596
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/envelope-formatter.js
|
|
8587
8597
|
function envelopeFormatter(options = {}) {
|
|
8588
8598
|
const { historyLimit = 5, includeQuote = true, includeSender = true, format } = options;
|
|
8589
8599
|
return async (ctx, next) => {
|
|
@@ -8655,7 +8665,7 @@ ${parts.join("\n")}
|
|
|
8655
8665
|
return sections.join("\n\n");
|
|
8656
8666
|
}
|
|
8657
8667
|
|
|
8658
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8668
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/slash-command.js
|
|
8659
8669
|
function slashCommand(options = {}) {
|
|
8660
8670
|
const prefixes = options.prefixes ?? ["/"];
|
|
8661
8671
|
const catchErrors = options.catchErrors ?? true;
|
|
@@ -8718,8 +8728,9 @@ function slashCommand(options = {}) {
|
|
|
8718
8728
|
}
|
|
8719
8729
|
const cleaned = content.replace(/<@!?[^>]+>\s*/g, "").trim();
|
|
8720
8730
|
if (ctx.message.kind === "group") {
|
|
8721
|
-
const
|
|
8722
|
-
|
|
8731
|
+
const msg = ctx.message;
|
|
8732
|
+
const wasMentioned = msg.rawEventType === "GROUP_AT_MESSAGE_CREATE" || msg.mentions?.some((m3) => m3.is_you);
|
|
8733
|
+
if (!wasMentioned) {
|
|
8723
8734
|
await next();
|
|
8724
8735
|
return;
|
|
8725
8736
|
}
|
|
@@ -8807,7 +8818,7 @@ async function sendCommandResult(ctx, result) {
|
|
|
8807
8818
|
}
|
|
8808
8819
|
}
|
|
8809
8820
|
|
|
8810
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8821
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/history-buffer.js
|
|
8811
8822
|
var MemoryHistoryStore = class {
|
|
8812
8823
|
buffers = /* @__PURE__ */ new Map();
|
|
8813
8824
|
append(groupKey, entry, limit) {
|
|
@@ -8872,7 +8883,7 @@ function historyBuffer(options = {}) {
|
|
|
8872
8883
|
return m3;
|
|
8873
8884
|
}
|
|
8874
8885
|
|
|
8875
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8886
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/typing-indicator.js
|
|
8876
8887
|
var DEFAULT_DURATION_SEC = 60;
|
|
8877
8888
|
var DEFAULT_KEEPALIVE_INTERVAL_MS = 5e4;
|
|
8878
8889
|
function typingIndicator(options = {}) {
|
|
@@ -8909,7 +8920,7 @@ function typingIndicator(options = {}) {
|
|
|
8909
8920
|
};
|
|
8910
8921
|
}
|
|
8911
8922
|
|
|
8912
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8923
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/middleware/error-handler.js
|
|
8913
8924
|
var DEFAULT_FORMAT = (err) => {
|
|
8914
8925
|
if (err instanceof ApiError) {
|
|
8915
8926
|
if (err.bizMessage)
|
|
@@ -8947,7 +8958,7 @@ function errorHandler(options = {}) {
|
|
|
8947
8958
|
};
|
|
8948
8959
|
}
|
|
8949
8960
|
|
|
8950
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
8961
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/storage/kv-store.js
|
|
8951
8962
|
var import_node_fs = __toESM(require("fs"), 1);
|
|
8952
8963
|
var import_node_path = __toESM(require("path"), 1);
|
|
8953
8964
|
var FileKVStore = class {
|
|
@@ -9057,7 +9068,7 @@ var FileKVStore = class {
|
|
|
9057
9068
|
}
|
|
9058
9069
|
};
|
|
9059
9070
|
|
|
9060
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
9071
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/storage/session-adapter.js
|
|
9061
9072
|
function kvSessionPersistence(opts) {
|
|
9062
9073
|
const prefix = opts.prefix ?? "qqbot:session:";
|
|
9063
9074
|
const key = `${prefix}${opts.accountId}`;
|
|
@@ -9284,7 +9295,7 @@ var import_node_path2 = __toESM(require("path"), 1);
|
|
|
9284
9295
|
var import_node_fs2 = __toESM(require("fs"), 1);
|
|
9285
9296
|
var _cachedOpenclawVersion;
|
|
9286
9297
|
function getPackageVersion() {
|
|
9287
|
-
return true ? "2.0.0-dev.
|
|
9298
|
+
return true ? "2.0.0-dev.202607101541" : "unknown";
|
|
9288
9299
|
}
|
|
9289
9300
|
function getOpenclawVersion(runtimeVersion) {
|
|
9290
9301
|
if (_cachedOpenclawVersion) return _cachedOpenclawVersion;
|
|
@@ -11505,10 +11516,10 @@ function buildCommandList(account, opts) {
|
|
|
11505
11516
|
// src/middleware/attachment.ts
|
|
11506
11517
|
var path17 = __toESM(require("path"), 1);
|
|
11507
11518
|
|
|
11508
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
11519
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/reply-limiter.js
|
|
11509
11520
|
var DEFAULT_TTL_MS = 60 * 60 * 1e3;
|
|
11510
11521
|
|
|
11511
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
11522
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/media-tags.js
|
|
11512
11523
|
var VALID_TAGS = ["qqimg", "qqvoice", "qqvideo", "qqfile", "qqmedia"];
|
|
11513
11524
|
var TAG_ALIASES = {
|
|
11514
11525
|
qq_img: "qqimg",
|
|
@@ -11557,30 +11568,30 @@ var SELF_CLOSING_TAG_REGEX = new RegExp("`?" + LEFT_BRACKET + "\\s*(" + TAG_NAME
|
|
|
11557
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");
|
|
11558
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");
|
|
11559
11570
|
|
|
11560
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
11571
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/ref-index-store.js
|
|
11561
11572
|
var import_node_fs6 = __toESM(require("fs"), 1);
|
|
11562
11573
|
var DEFAULT_TTL_MS2 = 7 * 24 * 60 * 60 * 1e3;
|
|
11563
11574
|
|
|
11564
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
11575
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/session-store.js
|
|
11565
11576
|
var import_node_fs7 = __toESM(require("fs"), 1);
|
|
11566
11577
|
var import_node_path7 = __toESM(require("path"), 1);
|
|
11567
11578
|
var DEFAULT_EXPIRE_MS = 5 * 60 * 1e3;
|
|
11568
11579
|
|
|
11569
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
11580
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/text-parsing.js
|
|
11570
11581
|
var MAX_FACE_EXT_BYTES = 64 * 1024;
|
|
11571
11582
|
|
|
11572
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
11583
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/media-source.js
|
|
11573
11584
|
var fs14 = __toESM(require("fs"), 1);
|
|
11574
11585
|
|
|
11575
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
11586
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/image-size.js
|
|
11576
11587
|
var import_node_buffer = require("buffer");
|
|
11577
11588
|
|
|
11578
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
11589
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/ffmpeg.js
|
|
11579
11590
|
var import_node_child_process = require("child_process");
|
|
11580
11591
|
var fs15 = __toESM(require("fs"), 1);
|
|
11581
11592
|
var path13 = __toESM(require("path"), 1);
|
|
11582
11593
|
|
|
11583
|
-
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.
|
|
11594
|
+
// node_modules/.pnpm/@cxyhhhhh+qqbot-nodejs@1.0.2-dev.202607101530/node_modules/@cxyhhhhh/qqbot-nodejs/dist/protocol/utils/audio.js
|
|
11584
11595
|
var import_node_child_process2 = require("child_process");
|
|
11585
11596
|
var fs16 = __toESM(require("fs"), 1);
|
|
11586
11597
|
var path14 = __toESM(require("path"), 1);
|
|
@@ -12219,7 +12230,7 @@ function isNonEmpty(x) {
|
|
|
12219
12230
|
}
|
|
12220
12231
|
function buildAgentBody(input) {
|
|
12221
12232
|
const { userContent, base, isGroup, wasMentioned, history } = input;
|
|
12222
|
-
if (userContent.startsWith("/")) {
|
|
12233
|
+
if (userContent.trim().startsWith("/")) {
|
|
12223
12234
|
return userContent;
|
|
12224
12235
|
}
|
|
12225
12236
|
if (isGroup && wasMentioned && history && history.length > 0) {
|
|
@@ -12386,6 +12397,25 @@ async function checkPairingMode(ctx, next, opts) {
|
|
|
12386
12397
|
}
|
|
12387
12398
|
}
|
|
12388
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
|
+
|
|
12389
12419
|
// src/gateway/middleware-setup.ts
|
|
12390
12420
|
function setupMiddlewares(bot, account, opts) {
|
|
12391
12421
|
bot.use(errorHandler());
|
|
@@ -12404,8 +12434,13 @@ function setupMiddlewares(bot, account, opts) {
|
|
|
12404
12434
|
getRuntime: opts.getRuntime
|
|
12405
12435
|
}));
|
|
12406
12436
|
bot.use(mentionGate());
|
|
12407
|
-
bot.use(contentSanitizer({
|
|
12437
|
+
bot.use(contentSanitizer({
|
|
12438
|
+
parseFaceTags: true,
|
|
12439
|
+
transform: (content, ctx) => stripMentionText(content, ctx.message.mentions)
|
|
12440
|
+
}));
|
|
12408
12441
|
bot.use(rateLimiter());
|
|
12442
|
+
const slash = slashCommand({ commands: buildCommandList(account, { getRuntime: opts.getRuntime }) });
|
|
12443
|
+
bot.use(slash.middleware);
|
|
12409
12444
|
bot.use(concurrencyGuard({
|
|
12410
12445
|
strategy: "merge",
|
|
12411
12446
|
maxQueue: 50,
|
|
@@ -12438,8 +12473,6 @@ function setupMiddlewares(bot, account, opts) {
|
|
|
12438
12473
|
return assembled.agentBody;
|
|
12439
12474
|
}
|
|
12440
12475
|
}));
|
|
12441
|
-
const slash = slashCommand({ commands: buildCommandList(account, { getRuntime: opts.getRuntime }) });
|
|
12442
|
-
bot.use(slash.middleware);
|
|
12443
12476
|
}
|
|
12444
12477
|
|
|
12445
12478
|
// src/dispatch/envelope-builder.ts
|
|
@@ -14455,25 +14488,6 @@ var qqbotOnboardingAdapter = {
|
|
|
14455
14488
|
}
|
|
14456
14489
|
};
|
|
14457
14490
|
|
|
14458
|
-
// src/utils/mention.ts
|
|
14459
|
-
function stripMentionText(text, mentions) {
|
|
14460
|
-
if (!text || !mentions?.length) return text;
|
|
14461
|
-
let cleaned = text;
|
|
14462
|
-
for (const m3 of mentions) {
|
|
14463
|
-
const openid = m3.member_openid ?? m3.id ?? m3.user_openid;
|
|
14464
|
-
if (!openid) continue;
|
|
14465
|
-
if (m3.is_you) {
|
|
14466
|
-
cleaned = cleaned.replace(new RegExp(`<@!?${openid}>`, "g"), "").trim();
|
|
14467
|
-
} else {
|
|
14468
|
-
const displayName = m3.nickname ?? m3.username;
|
|
14469
|
-
if (displayName) {
|
|
14470
|
-
cleaned = cleaned.replace(new RegExp(`<@!?${openid}>`, "g"), `@${displayName}`);
|
|
14471
|
-
}
|
|
14472
|
-
}
|
|
14473
|
-
}
|
|
14474
|
-
return cleaned;
|
|
14475
|
-
}
|
|
14476
|
-
|
|
14477
14491
|
// src/channel.ts
|
|
14478
14492
|
var TEXT_CHUNK_LIMIT2 = 5e3;
|
|
14479
14493
|
var GFM_TABLE_DATA_RE = /^\|.+\|.*\|/;
|