mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 13:20:22 +00:00
refactor: consolidate lazy runtime surfaces
This commit is contained in:
@@ -15,87 +15,17 @@ import {
|
||||
sendMessageBlueBubbles as sendMessageBlueBubblesImpl,
|
||||
} from "./send.js";
|
||||
|
||||
type SendBlueBubblesAttachment = typeof import("./attachments.js").sendBlueBubblesAttachment;
|
||||
type AddBlueBubblesParticipant = typeof import("./chat.js").addBlueBubblesParticipant;
|
||||
type EditBlueBubblesMessage = typeof import("./chat.js").editBlueBubblesMessage;
|
||||
type LeaveBlueBubblesChat = typeof import("./chat.js").leaveBlueBubblesChat;
|
||||
type RemoveBlueBubblesParticipant = typeof import("./chat.js").removeBlueBubblesParticipant;
|
||||
type RenameBlueBubblesChat = typeof import("./chat.js").renameBlueBubblesChat;
|
||||
type SetGroupIconBlueBubbles = typeof import("./chat.js").setGroupIconBlueBubbles;
|
||||
type UnsendBlueBubblesMessage = typeof import("./chat.js").unsendBlueBubblesMessage;
|
||||
type ResolveBlueBubblesMessageId = typeof import("./monitor.js").resolveBlueBubblesMessageId;
|
||||
type SendBlueBubblesReaction = typeof import("./reactions.js").sendBlueBubblesReaction;
|
||||
type ResolveChatGuidForTarget = typeof import("./send.js").resolveChatGuidForTarget;
|
||||
type SendMessageBlueBubbles = typeof import("./send.js").sendMessageBlueBubbles;
|
||||
|
||||
export function sendBlueBubblesAttachment(
|
||||
...args: Parameters<SendBlueBubblesAttachment>
|
||||
): ReturnType<SendBlueBubblesAttachment> {
|
||||
return sendBlueBubblesAttachmentImpl(...args);
|
||||
}
|
||||
|
||||
export function addBlueBubblesParticipant(
|
||||
...args: Parameters<AddBlueBubblesParticipant>
|
||||
): ReturnType<AddBlueBubblesParticipant> {
|
||||
return addBlueBubblesParticipantImpl(...args);
|
||||
}
|
||||
|
||||
export function editBlueBubblesMessage(
|
||||
...args: Parameters<EditBlueBubblesMessage>
|
||||
): ReturnType<EditBlueBubblesMessage> {
|
||||
return editBlueBubblesMessageImpl(...args);
|
||||
}
|
||||
|
||||
export function leaveBlueBubblesChat(
|
||||
...args: Parameters<LeaveBlueBubblesChat>
|
||||
): ReturnType<LeaveBlueBubblesChat> {
|
||||
return leaveBlueBubblesChatImpl(...args);
|
||||
}
|
||||
|
||||
export function removeBlueBubblesParticipant(
|
||||
...args: Parameters<RemoveBlueBubblesParticipant>
|
||||
): ReturnType<RemoveBlueBubblesParticipant> {
|
||||
return removeBlueBubblesParticipantImpl(...args);
|
||||
}
|
||||
|
||||
export function renameBlueBubblesChat(
|
||||
...args: Parameters<RenameBlueBubblesChat>
|
||||
): ReturnType<RenameBlueBubblesChat> {
|
||||
return renameBlueBubblesChatImpl(...args);
|
||||
}
|
||||
|
||||
export function setGroupIconBlueBubbles(
|
||||
...args: Parameters<SetGroupIconBlueBubbles>
|
||||
): ReturnType<SetGroupIconBlueBubbles> {
|
||||
return setGroupIconBlueBubblesImpl(...args);
|
||||
}
|
||||
|
||||
export function unsendBlueBubblesMessage(
|
||||
...args: Parameters<UnsendBlueBubblesMessage>
|
||||
): ReturnType<UnsendBlueBubblesMessage> {
|
||||
return unsendBlueBubblesMessageImpl(...args);
|
||||
}
|
||||
|
||||
export function resolveBlueBubblesMessageId(
|
||||
...args: Parameters<ResolveBlueBubblesMessageId>
|
||||
): ReturnType<ResolveBlueBubblesMessageId> {
|
||||
return resolveBlueBubblesMessageIdImpl(...args);
|
||||
}
|
||||
|
||||
export function sendBlueBubblesReaction(
|
||||
...args: Parameters<SendBlueBubblesReaction>
|
||||
): ReturnType<SendBlueBubblesReaction> {
|
||||
return sendBlueBubblesReactionImpl(...args);
|
||||
}
|
||||
|
||||
export function resolveChatGuidForTarget(
|
||||
...args: Parameters<ResolveChatGuidForTarget>
|
||||
): ReturnType<ResolveChatGuidForTarget> {
|
||||
return resolveChatGuidForTargetImpl(...args);
|
||||
}
|
||||
|
||||
export function sendMessageBlueBubbles(
|
||||
...args: Parameters<SendMessageBlueBubbles>
|
||||
): ReturnType<SendMessageBlueBubbles> {
|
||||
return sendMessageBlueBubblesImpl(...args);
|
||||
}
|
||||
export const blueBubblesActionsRuntime = {
|
||||
sendBlueBubblesAttachment: sendBlueBubblesAttachmentImpl,
|
||||
addBlueBubblesParticipant: addBlueBubblesParticipantImpl,
|
||||
editBlueBubblesMessage: editBlueBubblesMessageImpl,
|
||||
leaveBlueBubblesChat: leaveBlueBubblesChatImpl,
|
||||
removeBlueBubblesParticipant: removeBlueBubblesParticipantImpl,
|
||||
renameBlueBubblesChat: renameBlueBubblesChatImpl,
|
||||
setGroupIconBlueBubbles: setGroupIconBlueBubblesImpl,
|
||||
unsendBlueBubblesMessage: unsendBlueBubblesMessageImpl,
|
||||
resolveBlueBubblesMessageId: resolveBlueBubblesMessageIdImpl,
|
||||
sendBlueBubblesReaction: sendBlueBubblesReactionImpl,
|
||||
resolveChatGuidForTarget: resolveChatGuidForTargetImpl,
|
||||
sendMessageBlueBubbles: sendMessageBlueBubblesImpl,
|
||||
};
|
||||
|
||||
@@ -11,18 +11,19 @@ import {
|
||||
type ChannelMessageActionAdapter,
|
||||
type ChannelMessageActionName,
|
||||
} from "openclaw/plugin-sdk/bluebubbles";
|
||||
import { createLazyRuntimeSurface } from "../../../src/shared/lazy-runtime.js";
|
||||
import { resolveBlueBubblesAccount } from "./accounts.js";
|
||||
import { getCachedBlueBubblesPrivateApiStatus, isMacOS26OrHigher } from "./probe.js";
|
||||
import { normalizeSecretInputString } from "./secret-input.js";
|
||||
import { normalizeBlueBubblesHandle, parseBlueBubblesTarget } from "./targets.js";
|
||||
import type { BlueBubblesSendTarget } from "./types.js";
|
||||
|
||||
let actionsRuntimePromise: Promise<typeof import("./actions.runtime.js")> | null = null;
|
||||
type BlueBubblesActionsRuntime = typeof import("./actions.runtime.js").blueBubblesActionsRuntime;
|
||||
|
||||
function loadBlueBubblesActionsRuntime() {
|
||||
actionsRuntimePromise ??= import("./actions.runtime.js");
|
||||
return actionsRuntimePromise;
|
||||
}
|
||||
const loadBlueBubblesActionsRuntime = createLazyRuntimeSurface(
|
||||
() => import("./actions.runtime.js"),
|
||||
({ blueBubblesActionsRuntime }) => blueBubblesActionsRuntime,
|
||||
);
|
||||
|
||||
const providerId = "bluebubbles";
|
||||
|
||||
|
||||
@@ -6,52 +6,14 @@ import {
|
||||
} from "./monitor.js";
|
||||
import { probeBlueBubbles as probeBlueBubblesImpl } from "./probe.js";
|
||||
import { sendMessageBlueBubbles as sendMessageBlueBubblesImpl } from "./send.js";
|
||||
import { blueBubblesSetupWizard as blueBubblesSetupWizardImpl } from "./setup-surface.js";
|
||||
|
||||
export type { BlueBubblesProbe } from "./probe.js";
|
||||
|
||||
type SendBlueBubblesMedia = typeof import("./media-send.js").sendBlueBubblesMedia;
|
||||
type ResolveBlueBubblesMessageId = typeof import("./monitor.js").resolveBlueBubblesMessageId;
|
||||
type MonitorBlueBubblesProvider = typeof import("./monitor.js").monitorBlueBubblesProvider;
|
||||
type ResolveWebhookPathFromConfig = typeof import("./monitor.js").resolveWebhookPathFromConfig;
|
||||
type ProbeBlueBubbles = typeof import("./probe.js").probeBlueBubbles;
|
||||
type SendMessageBlueBubbles = typeof import("./send.js").sendMessageBlueBubbles;
|
||||
type BlueBubblesSetupWizard = typeof import("./setup-surface.js").blueBubblesSetupWizard;
|
||||
|
||||
export function sendBlueBubblesMedia(
|
||||
...args: Parameters<SendBlueBubblesMedia>
|
||||
): ReturnType<SendBlueBubblesMedia> {
|
||||
return sendBlueBubblesMediaImpl(...args);
|
||||
}
|
||||
|
||||
export function resolveBlueBubblesMessageId(
|
||||
...args: Parameters<ResolveBlueBubblesMessageId>
|
||||
): ReturnType<ResolveBlueBubblesMessageId> {
|
||||
return resolveBlueBubblesMessageIdImpl(...args);
|
||||
}
|
||||
|
||||
export function monitorBlueBubblesProvider(
|
||||
...args: Parameters<MonitorBlueBubblesProvider>
|
||||
): ReturnType<MonitorBlueBubblesProvider> {
|
||||
return monitorBlueBubblesProviderImpl(...args);
|
||||
}
|
||||
|
||||
export function resolveWebhookPathFromConfig(
|
||||
...args: Parameters<ResolveWebhookPathFromConfig>
|
||||
): ReturnType<ResolveWebhookPathFromConfig> {
|
||||
return resolveWebhookPathFromConfigImpl(...args);
|
||||
}
|
||||
|
||||
export function probeBlueBubbles(
|
||||
...args: Parameters<ProbeBlueBubbles>
|
||||
): ReturnType<ProbeBlueBubbles> {
|
||||
return probeBlueBubblesImpl(...args);
|
||||
}
|
||||
|
||||
export function sendMessageBlueBubbles(
|
||||
...args: Parameters<SendMessageBlueBubbles>
|
||||
): ReturnType<SendMessageBlueBubbles> {
|
||||
return sendMessageBlueBubblesImpl(...args);
|
||||
}
|
||||
|
||||
export const blueBubblesSetupWizard: BlueBubblesSetupWizard = { ...blueBubblesSetupWizardImpl };
|
||||
export const blueBubblesChannelRuntime = {
|
||||
sendBlueBubblesMedia: sendBlueBubblesMediaImpl,
|
||||
resolveBlueBubblesMessageId: resolveBlueBubblesMessageIdImpl,
|
||||
monitorBlueBubblesProvider: monitorBlueBubblesProviderImpl,
|
||||
resolveWebhookPathFromConfig: resolveWebhookPathFromConfigImpl,
|
||||
probeBlueBubbles: probeBlueBubblesImpl,
|
||||
sendMessageBlueBubbles: sendMessageBlueBubblesImpl,
|
||||
};
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
buildAccountScopedDmSecurityPolicy,
|
||||
collectOpenGroupPolicyRestrictSendersWarnings,
|
||||
} from "openclaw/plugin-sdk/channel-policy";
|
||||
import { createLazyRuntimeSurface } from "../../../src/shared/lazy-runtime.js";
|
||||
import {
|
||||
listBlueBubblesAccountIds,
|
||||
type ResolvedBlueBubblesAccount,
|
||||
@@ -37,12 +38,12 @@ import {
|
||||
parseBlueBubblesTarget,
|
||||
} from "./targets.js";
|
||||
|
||||
let blueBubblesChannelRuntimePromise: Promise<typeof import("./channel.runtime.js")> | null = null;
|
||||
type BlueBubblesChannelRuntime = typeof import("./channel.runtime.js").blueBubblesChannelRuntime;
|
||||
|
||||
function loadBlueBubblesChannelRuntime() {
|
||||
blueBubblesChannelRuntimePromise ??= import("./channel.runtime.js");
|
||||
return blueBubblesChannelRuntimePromise;
|
||||
}
|
||||
const loadBlueBubblesChannelRuntime = createLazyRuntimeSurface(
|
||||
() => import("./channel.runtime.js"),
|
||||
({ blueBubblesChannelRuntime }) => blueBubblesChannelRuntime,
|
||||
);
|
||||
|
||||
const meta = {
|
||||
id: "bluebubbles",
|
||||
|
||||
Reference in New Issue
Block a user