2026-01-30 03:15:10 +01:00
|
|
|
import type { PluginRuntime } from "openclaw/plugin-sdk";
|
2026-01-18 03:17:30 +00:00
|
|
|
|
|
|
|
|
let runtime: PluginRuntime | null = null;
|
|
|
|
|
|
|
|
|
|
export function setBlueBubblesRuntime(next: PluginRuntime): void {
|
|
|
|
|
runtime = next;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-22 12:08:08 +01:00
|
|
|
export function clearBlueBubblesRuntime(): void {
|
|
|
|
|
runtime = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function tryGetBlueBubblesRuntime(): PluginRuntime | null {
|
|
|
|
|
return runtime;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-18 03:17:30 +00:00
|
|
|
export function getBlueBubblesRuntime(): PluginRuntime {
|
|
|
|
|
if (!runtime) {
|
|
|
|
|
throw new Error("BlueBubbles runtime not initialized");
|
|
|
|
|
}
|
|
|
|
|
return runtime;
|
|
|
|
|
}
|
2026-02-22 12:08:08 +01:00
|
|
|
|
|
|
|
|
export function warnBlueBubbles(message: string): void {
|
|
|
|
|
const formatted = `[bluebubbles] ${message}`;
|
|
|
|
|
const log = runtime?.log;
|
|
|
|
|
if (typeof log === "function") {
|
|
|
|
|
log(formatted);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
console.warn(formatted);
|
|
|
|
|
}
|