refactor(plugins): decouple bundled plugin runtime loading

This commit is contained in:
Peter Steinberger
2026-03-29 09:08:06 +01:00
parent 1738d540f4
commit 8e0ab35b0e
582 changed files with 8057 additions and 22869 deletions

View File

@@ -1,11 +1,13 @@
import type { OpenClawConfig } from "../config/config.js";
import { loadBundledPluginPublicSurfaceModuleSync } from "./facade-runtime.js";
import {
parseChatTargetPrefixesOrThrow,
resolveServicePrefixedTarget,
type ParsedChatTarget,
} from "./imessage-targets.js";
// Narrow plugin-sdk surface for the bundled bluebubbles plugin.
// Keep this list additive and scoped to symbols used under extensions/bluebubbles.
// Narrow plugin-sdk surface for the bundled BlueBubbles plugin.
// Keep this list additive and scoped to the conversation-binding seam only.
type BlueBubblesService = "imessage" | "sms" | "auto";
@@ -13,6 +15,31 @@ type BlueBubblesTarget =
| ParsedChatTarget
| { kind: "handle"; to: string; service: BlueBubblesService };
export type BlueBubblesConversationBindingManager = {
stop: () => void;
};
type BlueBubblesFacadeModule = {
createBlueBubblesConversationBindingManager: (params: {
accountId?: string;
cfg: OpenClawConfig;
}) => BlueBubblesConversationBindingManager;
};
function loadBlueBubblesFacadeModule(): BlueBubblesFacadeModule {
return loadBundledPluginPublicSurfaceModuleSync<BlueBubblesFacadeModule>({
dirName: "bluebubbles",
artifactBasename: "api.js",
});
}
export function createBlueBubblesConversationBindingManager(params: {
accountId?: string;
cfg: OpenClawConfig;
}): BlueBubblesConversationBindingManager {
return loadBlueBubblesFacadeModule().createBlueBubblesConversationBindingManager(params);
}
const CHAT_ID_PREFIXES = ["chat_id:", "chatid:", "chat:"];
const CHAT_GUID_PREFIXES = ["chat_guid:", "chatguid:", "guid:"];
const CHAT_IDENTIFIER_PREFIXES = ["chat_identifier:", "chatidentifier:", "chatident:"];