mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-21 10:16:44 +00:00
perf(qqbot): narrow tool discovery cold load (#90780)
* perf: narrow qqbot tool discovery load * fix(qqbot): load bridge entries through sidecars
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
// Narrow bridge entrypoint for qqbot registerFull composition.
|
||||
export { registerQQBotFull } from "./src/bridge/channel-entry.js";
|
||||
@@ -6,8 +6,19 @@ import {
|
||||
} from "openclaw/plugin-sdk/channel-entry-contract";
|
||||
|
||||
function registerQQBotFull(api: OpenClawPluginApi): void {
|
||||
if (api.registrationMode === "tool-discovery") {
|
||||
const registerTools = loadBundledEntryExportSync<(api: OpenClawPluginApi) => void>(
|
||||
import.meta.url,
|
||||
{
|
||||
specifier: "./tools-api.js",
|
||||
exportName: "registerQQBotTools",
|
||||
},
|
||||
);
|
||||
registerTools(api);
|
||||
return;
|
||||
}
|
||||
const register = loadBundledEntryExportSync<(api: OpenClawPluginApi) => void>(import.meta.url, {
|
||||
specifier: "./api.js",
|
||||
specifier: "./channel-entry-api.js",
|
||||
exportName: "registerQQBotFull",
|
||||
});
|
||||
register(api);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Qqbot plugin module implements channel behavior.
|
||||
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core";
|
||||
import { getAccessToken } from "../../engine/messaging/sender.js";
|
||||
import { ChannelApiSchema, executeChannelApi } from "../../engine/tools/channel-api.js";
|
||||
import type { ChannelApiParams } from "../../engine/tools/channel-api.js";
|
||||
import { listQQBotAccountIds, resolveQQBotAccount } from "../config.js";
|
||||
@@ -50,6 +49,7 @@ export function registerChannelTool(api: OpenClawPluginApi): void {
|
||||
"See the qqbot-channel skill for full endpoint details.",
|
||||
parameters: ChannelApiSchema,
|
||||
async execute(_toolCallId, params) {
|
||||
const { getAccessToken } = await import("../../engine/messaging/sender.js");
|
||||
const accessToken = await getAccessToken(account.appId, account.clientSecret);
|
||||
return executeChannelApi(params as ChannelApiParams, { accessToken });
|
||||
},
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
// Narrow tool-discovery entrypoint for qqbot tools.
|
||||
export { registerQQBotTools } from "./src/bridge/tools/index.js";
|
||||
@@ -58,12 +58,14 @@ describe("plugin npm runtime build planning", () => {
|
||||
const qqbotRuntimePlan = expectPluginNpmRuntimeBuildPlan(qqbotPlan);
|
||||
expect(qqbotRuntimePlan.entry).toEqual({
|
||||
api: path.join(repoRoot, "extensions", "qqbot", "api.ts"),
|
||||
"channel-entry-api": path.join(repoRoot, "extensions", "qqbot", "channel-entry-api.ts"),
|
||||
"channel-plugin-api": path.join(repoRoot, "extensions", "qqbot", "channel-plugin-api.ts"),
|
||||
index: path.join(repoRoot, "extensions", "qqbot", "index.ts"),
|
||||
"runtime-api": path.join(repoRoot, "extensions", "qqbot", "runtime-api.ts"),
|
||||
"secret-contract-api": path.join(repoRoot, "extensions", "qqbot", "secret-contract-api.ts"),
|
||||
"setup-entry": path.join(repoRoot, "extensions", "qqbot", "setup-entry.ts"),
|
||||
"setup-plugin-api": path.join(repoRoot, "extensions", "qqbot", "setup-plugin-api.ts"),
|
||||
"tools-api": path.join(repoRoot, "extensions", "qqbot", "tools-api.ts"),
|
||||
});
|
||||
expect(qqbotRuntimePlan.runtimeExtensions).toEqual(["./dist/index.js"]);
|
||||
expect(qqbotRuntimePlan.runtimeSetupEntry).toBe("./dist/setup-entry.js");
|
||||
|
||||
Reference in New Issue
Block a user