fix(matrix): keep plugin register sync while bootstrapping crypto runtime (#31989)

This commit is contained in:
Peter Steinberger
2026-03-02 19:32:47 +00:00
parent 66c1da45d4
commit fcec2e364d

View File

@@ -1,5 +1,6 @@
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
import { matrixPlugin } from "./src/channel.js";
import { ensureMatrixCryptoRuntime } from "./src/matrix/deps.js";
import { setMatrixRuntime } from "./src/runtime.js";
@@ -8,10 +9,12 @@ const plugin = {
name: "Matrix",
description: "Matrix channel plugin (matrix-js-sdk)",
configSchema: emptyPluginConfigSchema(),
async register(api: OpenClawPluginApi) {
register(api: OpenClawPluginApi) {
setMatrixRuntime(api.runtime);
await ensureMatrixCryptoRuntime();
const { matrixPlugin } = await import("./src/channel.js");
void ensureMatrixCryptoRuntime({ log: api.logger.info }).catch((err) => {
const message = err instanceof Error ? err.message : String(err);
api.logger.warn?.(`matrix: crypto runtime bootstrap failed: ${message}`);
});
api.registerChannel({ plugin: matrixPlugin });
},
};