2026-03-04 02:33:03 -05:00
|
|
|
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/matrix";
|
|
|
|
|
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk/matrix";
|
2026-03-02 19:32:47 +00:00
|
|
|
import { matrixPlugin } from "./src/channel.js";
|
2026-03-02 10:46:37 -07:00
|
|
|
import { ensureMatrixCryptoRuntime } from "./src/matrix/deps.js";
|
2026-01-18 02:51:42 +00:00
|
|
|
import { setMatrixRuntime } from "./src/runtime.js";
|
2026-01-15 08:29:17 +00:00
|
|
|
|
|
|
|
|
const plugin = {
|
|
|
|
|
id: "matrix",
|
|
|
|
|
name: "Matrix",
|
|
|
|
|
description: "Matrix channel plugin (matrix-js-sdk)",
|
2026-01-19 03:38:51 +00:00
|
|
|
configSchema: emptyPluginConfigSchema(),
|
2026-03-02 19:32:47 +00:00
|
|
|
register(api: OpenClawPluginApi) {
|
2026-01-18 02:51:42 +00:00
|
|
|
setMatrixRuntime(api.runtime);
|
2026-03-02 19:32:47 +00:00
|
|
|
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}`);
|
|
|
|
|
});
|
2026-01-15 08:29:17 +00:00
|
|
|
api.registerChannel({ plugin: matrixPlugin });
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default plugin;
|