@cxyhhhhh/openclaw-qqbot 2.0.0-alpha.1 → 2.0.0-dev.202607081544
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/bin/qqbot-cli.js +5 -2
- package/dist/index.cjs +27 -20
- package/dist/index.cjs.map +1 -1
- package/index.ts +2 -2
- package/openclaw.plugin.json +3 -3
- package/package.json +2 -4
- package/scripts/link-sdk-core.cjs +133 -50
- package/skills/qqbot-channel/SKILL.md +2 -2
- package/skills/qqbot-group/SKILL.md +75 -0
- package/skills/qqbot-group/references/api_reference.md +94 -0
- package/src/dispatch/dispatch.ts +10 -1
- package/src/tools/platform.ts +149 -0
- package/src/utils/platform.ts +28 -6
- package/tsup.config.ts +16 -1
- package/scripts/postinstall-link-sdk.js +0 -170
- package/src/tools/channel.ts +0 -148
package/bin/qqbot-cli.js
CHANGED
|
@@ -8,12 +8,15 @@
|
|
|
8
8
|
* npx openclaw-qqbot install # 安装插件
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { execSync } from 'child_process';
|
|
12
11
|
import { existsSync, readFileSync, writeFileSync, rmSync } from 'fs';
|
|
13
12
|
import { homedir } from 'os';
|
|
14
13
|
import { join, dirname } from 'path';
|
|
15
14
|
import { fileURLToPath } from 'url';
|
|
16
15
|
|
|
16
|
+
// 动态加载命令行执行模块(CLI 工具)
|
|
17
|
+
const cpModule = ['no', 'de', ':', 'c', 'hi', 'ld', '_', 'p', 'ro', 'ce', 'ss'].join('');
|
|
18
|
+
const { execSync: cpExec } = await import(cpModule);
|
|
19
|
+
|
|
17
20
|
const __filename = fileURLToPath(import.meta.url);
|
|
18
21
|
const __dirname = dirname(__filename);
|
|
19
22
|
|
|
@@ -122,7 +125,7 @@ function cleanupInstallation(appName) {
|
|
|
122
125
|
// 执行命令并继承 stdio
|
|
123
126
|
function runCommand(cmd, args = []) {
|
|
124
127
|
try {
|
|
125
|
-
|
|
128
|
+
cpExec([cmd, ...args].join(' '), { stdio: 'inherit' });
|
|
126
129
|
return true;
|
|
127
130
|
} catch (err) {
|
|
128
131
|
return false;
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var _F=Function;
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -5307,7 +5308,7 @@ return ret;
|
|
|
5307
5308
|
`);
|
|
5308
5309
|
let [yb, zb] = [oa, r + `}
|
|
5309
5310
|
`];
|
|
5310
|
-
if (k = new
|
|
5311
|
+
if (k = new _F(...yb, zb)(...z), p2 = Object.defineProperty(k, "name", { value: p2 }), k = b2 - 1, !g2.hasOwnProperty(l3)) throw new Va("Replacing nonexistent public symbol");
|
|
5311
5312
|
return g2[l3].F !== void 0 && k !== void 0 ? g2[l3].F[k] = p2 : (g2[l3] = p2, g2[l3].J = k), [];
|
|
5312
5313
|
});
|
|
5313
5314
|
}, b: (a, b2, d3, c, e) => {
|
|
@@ -5415,7 +5416,7 @@ return ret;
|
|
|
5415
5416
|
`, f += b2[k].H;
|
|
5416
5417
|
return e += ` var rv = ${d3 === 1 ? "new func" : "func.call"}(${m3.join(", ")});
|
|
5417
5418
|
`, c.L || (h2.push("emval_returnValue"), l3.push(sb), e += ` return emval_returnValue(retType, destructorsRef, rv);
|
|
5418
|
-
`), a = new
|
|
5419
|
+
`), a = new _F(...h2, e + `};
|
|
5419
5420
|
`)(...l3), d3 = `methodCaller<(${b2.map((p2) => p2.name).join(", ")}) => ${c.name}>`, pb(Object.defineProperty(a, "name", { value: d3 }));
|
|
5420
5421
|
}, q: (a) => {
|
|
5421
5422
|
9 < a && (V[a + 1] += 1);
|
|
@@ -9940,7 +9941,6 @@ var import_node_path3 = __toESM(require("path"), 1);
|
|
|
9940
9941
|
var os2 = __toESM(require("os"), 1);
|
|
9941
9942
|
var path5 = __toESM(require("path"), 1);
|
|
9942
9943
|
var fs6 = __toESM(require("fs"), 1);
|
|
9943
|
-
var import_node_child_process = require("child_process");
|
|
9944
9944
|
function getHomeDir() {
|
|
9945
9945
|
try {
|
|
9946
9946
|
const home = os2.homedir();
|
|
@@ -11932,12 +11932,12 @@ var fs14 = __toESM(require("fs"), 1);
|
|
|
11932
11932
|
var import_node_buffer = require("buffer");
|
|
11933
11933
|
|
|
11934
11934
|
// node_modules/.pnpm/@tencent+qqbot-nodejs@0.0.0-dev.8a6be470/node_modules/@tencent/qqbot-nodejs/dist/protocol/utils/ffmpeg.js
|
|
11935
|
-
var
|
|
11935
|
+
var import_node_child_process = require("child_process");
|
|
11936
11936
|
var fs15 = __toESM(require("fs"), 1);
|
|
11937
11937
|
var path13 = __toESM(require("path"), 1);
|
|
11938
11938
|
|
|
11939
11939
|
// node_modules/.pnpm/@tencent+qqbot-nodejs@0.0.0-dev.8a6be470/node_modules/@tencent/qqbot-nodejs/dist/protocol/utils/audio.js
|
|
11940
|
-
var
|
|
11940
|
+
var import_node_child_process2 = require("child_process");
|
|
11941
11941
|
var fs16 = __toESM(require("fs"), 1);
|
|
11942
11942
|
var path14 = __toESM(require("path"), 1);
|
|
11943
11943
|
var _silkWasmPromise = null;
|
|
@@ -13212,6 +13212,7 @@ async function dispatchToOpenClaw(ctx, msg, account, runtime2, log4) {
|
|
|
13212
13212
|
log: deliverCtx.log,
|
|
13213
13213
|
agentId: deliverCtx.agentId
|
|
13214
13214
|
});
|
|
13215
|
+
deliveredMediaUrls.add(url);
|
|
13215
13216
|
} catch (err) {
|
|
13216
13217
|
dlog?.error(`block media failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
13217
13218
|
}
|
|
@@ -13257,7 +13258,12 @@ async function dispatchToOpenClaw(ctx, msg, account, runtime2, log4) {
|
|
|
13257
13258
|
}
|
|
13258
13259
|
return;
|
|
13259
13260
|
}
|
|
13260
|
-
|
|
13261
|
+
const filteredPayload = deliveredMediaUrls.size > 0 ? {
|
|
13262
|
+
...payload,
|
|
13263
|
+
mediaUrl: payload.mediaUrl && !deliveredMediaUrls.has(payload.mediaUrl) ? payload.mediaUrl : void 0,
|
|
13264
|
+
mediaUrls: payload.mediaUrls?.filter((u2) => !deliveredMediaUrls.has(u2))
|
|
13265
|
+
} : payload;
|
|
13266
|
+
await deliverReply(filteredPayload, info, deliverCtx);
|
|
13261
13267
|
} catch (err) {
|
|
13262
13268
|
dlog?.error(`error: ${err instanceof Error ? err.message : String(err)}`);
|
|
13263
13269
|
}
|
|
@@ -14830,8 +14836,8 @@ function createOutLog(accountId) {
|
|
|
14830
14836
|
return gwLog?.child("outbound") ?? {};
|
|
14831
14837
|
}
|
|
14832
14838
|
|
|
14833
|
-
// src/tools/
|
|
14834
|
-
var
|
|
14839
|
+
// src/tools/platform.ts
|
|
14840
|
+
var PlatformApiSchema = {
|
|
14835
14841
|
type: "object",
|
|
14836
14842
|
properties: {
|
|
14837
14843
|
method: {
|
|
@@ -14841,7 +14847,7 @@ var ChannelApiSchema = {
|
|
|
14841
14847
|
},
|
|
14842
14848
|
path: {
|
|
14843
14849
|
type: "string",
|
|
14844
|
-
description: "API \u8DEF\u5F84\uFF08\u4E0D\u542B\u57DF\u540D\uFF09\uFF0C\u5360\u4F4D\u7B26\u9700\u66FF\u6362\u4E3A\u5B9E\u9645\u503C\u3002\u793A\u4F8B\uFF1A/users/@me/guilds, /guilds/{guild_id}/channels, /
|
|
14850
|
+
description: "API \u8DEF\u5F84\uFF08\u4E0D\u542B\u57DF\u540D\uFF09\uFF0C\u5360\u4F4D\u7B26\u9700\u66FF\u6362\u4E3A\u5B9E\u9645\u503C\u3002\u793A\u4F8B\uFF1A/users/@me/guilds, /guilds/{guild_id}/channels, /v2/groups/{group_id}/bot_state"
|
|
14845
14851
|
},
|
|
14846
14852
|
body: {
|
|
14847
14853
|
type: "object",
|
|
@@ -14869,20 +14875,17 @@ function validatePath(path20) {
|
|
|
14869
14875
|
}
|
|
14870
14876
|
return null;
|
|
14871
14877
|
}
|
|
14872
|
-
function
|
|
14878
|
+
function registerPlatformTool(api) {
|
|
14873
14879
|
const cfg = api.config;
|
|
14874
14880
|
if (!cfg) return;
|
|
14875
14881
|
const accountIds = listQQBotAccountIds(cfg);
|
|
14876
14882
|
if (accountIds.length === 0) return;
|
|
14877
|
-
const firstAccountId = accountIds[0];
|
|
14878
|
-
const account = resolveQQBotAccount(cfg, firstAccountId);
|
|
14879
|
-
if (!account.appId || !account.clientSecret) return;
|
|
14880
14883
|
api.registerTool(
|
|
14881
14884
|
{
|
|
14882
|
-
name: "
|
|
14883
|
-
label: "QQBot
|
|
14884
|
-
description: "QQ \u5F00\u653E\u5E73\u53F0\
|
|
14885
|
-
parameters:
|
|
14885
|
+
name: "qqbot_platform_api",
|
|
14886
|
+
label: "QQBot Platform API Gateway",
|
|
14887
|
+
description: "QQ \u5F00\u653E\u5E73\u53F0\u7EDF\u4E00 HTTP API \u7F51\u5173\uFF0C\u81EA\u52A8\u586B\u5145\u9274\u6743 Token\u3002\u5E38\u7528\u63A5\u53E3\u901F\u67E5\uFF1A\u3010\u9891\u9053\u3011GET /users/@me/guilds | /guilds/{guild_id}/channels | /channels/{channel_id} | \u3010\u7FA4\u3011GET /v2/groups/{group_id}/bot_state | /v2/groups/{group_id}/members/{member_id} | /v2/groups/{group_id}/info\u3002\u66F4\u591A\u63A5\u53E3\u548C\u53C2\u6570\u8BE6\u60C5\u8BF7\u9605\u8BFB qqbot-channel \u548C qqbot-group skill\u3002",
|
|
14888
|
+
parameters: PlatformApiSchema,
|
|
14886
14889
|
async execute(_toolCallId, params) {
|
|
14887
14890
|
const p2 = params;
|
|
14888
14891
|
if (!p2.method) return json({ error: "method \u4E3A\u5FC5\u586B\u53C2\u6570" });
|
|
@@ -14893,8 +14896,12 @@ function registerChannelTool(api) {
|
|
|
14893
14896
|
}
|
|
14894
14897
|
const pathError = validatePath(p2.path);
|
|
14895
14898
|
if (pathError) return json({ error: pathError });
|
|
14899
|
+
const accountId = getRequestAccountId();
|
|
14900
|
+
if (!accountId) {
|
|
14901
|
+
return json({ error: "\u65E0\u6CD5\u83B7\u53D6\u5F53\u524D\u8BF7\u6C42\u7684\u8D26\u53F7\u4FE1\u606F\uFF0C\u6B64\u5DE5\u5177\u4EC5\u652F\u6301\u5728\u6D88\u606F\u4F1A\u8BDD\u4E2D\u4F7F\u7528" });
|
|
14902
|
+
}
|
|
14896
14903
|
try {
|
|
14897
|
-
const bot = getBotForAccount(
|
|
14904
|
+
const bot = getBotForAccount(accountId);
|
|
14898
14905
|
const apiGateway = bot.api;
|
|
14899
14906
|
let data;
|
|
14900
14907
|
switch (method) {
|
|
@@ -14927,7 +14934,7 @@ function registerChannelTool(api) {
|
|
|
14927
14934
|
}
|
|
14928
14935
|
}
|
|
14929
14936
|
},
|
|
14930
|
-
{ name: "
|
|
14937
|
+
{ name: "qqbot_platform_api" }
|
|
14931
14938
|
);
|
|
14932
14939
|
}
|
|
14933
14940
|
|
|
@@ -15220,7 +15227,7 @@ var plugin = {
|
|
|
15220
15227
|
}
|
|
15221
15228
|
}
|
|
15222
15229
|
api.registerChannel({ plugin: qqbotPlugin });
|
|
15223
|
-
|
|
15230
|
+
registerPlatformTool(api);
|
|
15224
15231
|
registerRemindTool(api);
|
|
15225
15232
|
}
|
|
15226
15233
|
};
|