Skip to content

Commit ebabf50

Browse files
authored
perf(qqbot): narrow tool discovery cold load (#90780)
* perf: narrow qqbot tool discovery load * fix(qqbot): load bridge entries through sidecars
1 parent 1de4a3e commit ebabf50

5 files changed

Lines changed: 19 additions & 2 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Narrow bridge entrypoint for qqbot registerFull composition.
2+
export { registerQQBotFull } from "./src/bridge/channel-entry.js";

extensions/qqbot/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,19 @@ import {
66
} from "openclaw/plugin-sdk/channel-entry-contract";
77

88
function registerQQBotFull(api: OpenClawPluginApi): void {
9+
if (api.registrationMode === "tool-discovery") {
10+
const registerTools = loadBundledEntryExportSync<(api: OpenClawPluginApi) => void>(
11+
import.meta.url,
12+
{
13+
specifier: "./tools-api.js",
14+
exportName: "registerQQBotTools",
15+
},
16+
);
17+
registerTools(api);
18+
return;
19+
}
920
const register = loadBundledEntryExportSync<(api: OpenClawPluginApi) => void>(import.meta.url, {
10-
specifier: "./api.js",
21+
specifier: "./channel-entry-api.js",
1122
exportName: "registerQQBotFull",
1223
});
1324
register(api);

extensions/qqbot/src/bridge/tools/channel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Qqbot plugin module implements channel behavior.
22
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core";
3-
import { getAccessToken } from "../../engine/messaging/sender.js";
43
import { ChannelApiSchema, executeChannelApi } from "../../engine/tools/channel-api.js";
54
import type { ChannelApiParams } from "../../engine/tools/channel-api.js";
65
import { listQQBotAccountIds, resolveQQBotAccount } from "../config.js";
@@ -50,6 +49,7 @@ export function registerChannelTool(api: OpenClawPluginApi): void {
5049
"See the qqbot-channel skill for full endpoint details.",
5150
parameters: ChannelApiSchema,
5251
async execute(_toolCallId, params) {
52+
const { getAccessToken } = await import("../../engine/messaging/sender.js");
5353
const accessToken = await getAccessToken(account.appId, account.clientSecret);
5454
return executeChannelApi(params as ChannelApiParams, { accessToken });
5555
},

extensions/qqbot/tools-api.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Narrow tool-discovery entrypoint for qqbot tools.
2+
export { registerQQBotTools } from "./src/bridge/tools/index.js";

test/plugin-npm-runtime-build.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,14 @@ describe("plugin npm runtime build planning", () => {
5858
const qqbotRuntimePlan = expectPluginNpmRuntimeBuildPlan(qqbotPlan);
5959
expect(qqbotRuntimePlan.entry).toEqual({
6060
api: path.join(repoRoot, "extensions", "qqbot", "api.ts"),
61+
"channel-entry-api": path.join(repoRoot, "extensions", "qqbot", "channel-entry-api.ts"),
6162
"channel-plugin-api": path.join(repoRoot, "extensions", "qqbot", "channel-plugin-api.ts"),
6263
index: path.join(repoRoot, "extensions", "qqbot", "index.ts"),
6364
"runtime-api": path.join(repoRoot, "extensions", "qqbot", "runtime-api.ts"),
6465
"secret-contract-api": path.join(repoRoot, "extensions", "qqbot", "secret-contract-api.ts"),
6566
"setup-entry": path.join(repoRoot, "extensions", "qqbot", "setup-entry.ts"),
6667
"setup-plugin-api": path.join(repoRoot, "extensions", "qqbot", "setup-plugin-api.ts"),
68+
"tools-api": path.join(repoRoot, "extensions", "qqbot", "tools-api.ts"),
6769
});
6870
expect(qqbotRuntimePlan.runtimeExtensions).toEqual(["./dist/index.js"]);
6971
expect(qqbotRuntimePlan.runtimeSetupEntry).toBe("./dist/setup-entry.js");

0 commit comments

Comments
 (0)