perf: speed up discord channel registration (#69791)

Merged via squash.

Prepared head SHA: 231d8763b4
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
Gustavo Madeira Santana
2026-04-21 15:48:08 -04:00
committed by GitHub
parent 895ac965da
commit 6b185e2849
5 changed files with 16 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ Docs: https://docs.openclaw.ai
- Matrix/startup: narrow Matrix runtime registration and defer setup/doctor surfaces so cold plugin registration spends about 1.8s less in `setChannelRuntime`. (#69782) Thanks @gumadeiras.
- QQBot: extract a self-contained `engine/` architecture with QR-code onboarding, native approval handling via `/bot-approve`, per-account isolated resource stacks and multi-account logger, credential backup/restore, shared `~/.openclaw/media` payload root, and unified API/bridge/gateway modules. (#67960) Thanks @cxyhhhhh.
- Telegram/plugin startup: load Telegram's bundled runtime setter through a narrow sidecar and let built sidecars use native loading before falling back to jiti, cutting the measured setup-runtime registration path by about 14s while preserving runtime API compatibility. (#69786) thanks @gumadeiras.
- Discord/plugin startup: load Discord's bundled runtime setter through a narrow sidecar so setup-runtime registration avoids the broad runtime barrel, cutting measured registration time by about 98% (18.5s to 0.44s) while preserving runtime API compatibility. (#69791) thanks @gumadeiras.
### Fixes

View File

@@ -19,7 +19,7 @@ export default defineBundledChannelEntry({
exportName: "discordPlugin",
},
runtime: {
specifier: "./runtime-api.js",
specifier: "./runtime-setter-api.js",
exportName: "setDiscordRuntime",
},
accountInspect: {

View File

@@ -0,0 +1,3 @@
// Keep bundled registration fast: runtime wiring only needs the store setter,
// while runtime-api.js remains the broad compatibility barrel.
export { setDiscordRuntime } from "./src/runtime.js";

View File

@@ -5,6 +5,7 @@
"dist/extensions/copilot-proxy/runtime-api.js",
"dist/extensions/diffs/runtime-api.js",
"dist/extensions/discord/runtime-api.js",
"dist/extensions/discord/runtime-setter-api.js",
"dist/extensions/feishu/runtime-api.js",
"dist/extensions/google/runtime-api.js",
"dist/extensions/googlechat/runtime-api.js",

View File

@@ -175,6 +175,16 @@ describe("bundled plugin metadata", () => {
});
});
it("keeps Discord's narrow runtime setter on the bundled runtime sidecar surface", () => {
const discord = listRepoBundledPluginMetadata().find((entry) => entry.dirName === "discord");
expectArtifactPresence(discord?.publicSurfaceArtifacts, {
contains: ["runtime-setter-api.js"],
});
expectArtifactPresence(discord?.runtimeSidecarArtifacts, {
contains: ["runtime-setter-api.js"],
});
});
it("loads tlon channel config metadata from the lightweight schema surface", () => {
expect(collectRepoBundledChannelConfigsForTest("tlon")?.tlon).toEqual(
expect.objectContaining({