refactor: bundle lazy runtime surfaces

This commit is contained in:
Peter Steinberger 2026-03-17 00:00:05 -07:00
parent 0d776c87c3
commit 3dec814fda
No known key found for this signature in database
35 changed files with 887 additions and 554 deletions

View File

@ -1,13 +1,101 @@
export { sendBlueBubblesAttachment } from "./attachments.js";
export {
addBlueBubblesParticipant,
editBlueBubblesMessage,
leaveBlueBubblesChat,
removeBlueBubblesParticipant,
renameBlueBubblesChat,
setGroupIconBlueBubbles,
unsendBlueBubblesMessage,
import { sendBlueBubblesAttachment as sendBlueBubblesAttachmentImpl } from "./attachments.js";
import {
addBlueBubblesParticipant as addBlueBubblesParticipantImpl,
editBlueBubblesMessage as editBlueBubblesMessageImpl,
leaveBlueBubblesChat as leaveBlueBubblesChatImpl,
removeBlueBubblesParticipant as removeBlueBubblesParticipantImpl,
renameBlueBubblesChat as renameBlueBubblesChatImpl,
setGroupIconBlueBubbles as setGroupIconBlueBubblesImpl,
unsendBlueBubblesMessage as unsendBlueBubblesMessageImpl,
} from "./chat.js";
export { resolveBlueBubblesMessageId } from "./monitor.js";
export { sendBlueBubblesReaction } from "./reactions.js";
export { resolveChatGuidForTarget, sendMessageBlueBubbles } from "./send.js";
import { resolveBlueBubblesMessageId as resolveBlueBubblesMessageIdImpl } from "./monitor.js";
import { sendBlueBubblesReaction as sendBlueBubblesReactionImpl } from "./reactions.js";
import {
resolveChatGuidForTarget as resolveChatGuidForTargetImpl,
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);
}

View File

@ -1,6 +1,57 @@
export { sendBlueBubblesMedia } from "./media-send.js";
export { resolveBlueBubblesMessageId } from "./monitor.js";
export { monitorBlueBubblesProvider, resolveWebhookPathFromConfig } from "./monitor.js";
export { type BlueBubblesProbe, probeBlueBubbles } from "./probe.js";
export { sendMessageBlueBubbles } from "./send.js";
export { blueBubblesSetupWizard } from "./setup-surface.js";
import { sendBlueBubblesMedia as sendBlueBubblesMediaImpl } from "./media-send.js";
import {
monitorBlueBubblesProvider as monitorBlueBubblesProviderImpl,
resolveBlueBubblesMessageId as resolveBlueBubblesMessageIdImpl,
resolveWebhookPathFromConfig as resolveWebhookPathFromConfigImpl,
} 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 };

View File

@ -1 +1,5 @@
export { discordSetupWizard } from "./setup-surface.js";
import { discordSetupWizard as discordSetupWizardImpl } from "./setup-surface.js";
type DiscordSetupWizard = typeof import("./setup-surface.js").discordSetupWizard;
export const discordSetupWizard: DiscordSetupWizard = { ...discordSetupWizardImpl };

View File

@ -100,15 +100,9 @@ async function resolveDiscordGroupAllowlist(params: {
});
}
<<<<<<< HEAD
export const discordSetupWizard: ChannelSetupWizard = createDiscordSetupWizardBase({
promptAllowFrom: promptDiscordAllowFrom,
resolveGroupAllowlist: async ({ cfg, accountId, credentialValues, entries }) =>
await resolveDiscordGroupAllowlist({
cfg,
accountId,
credentialValues,
entries,
}),
resolveAllowFromEntries: async ({ cfg, accountId, credentialValues, entries }) =>
await resolveDiscordAllowFromEntries({
token:
@ -116,4 +110,11 @@ export const discordSetupWizard: ChannelSetupWizard = createDiscordSetupWizardBa
(typeof credentialValues.token === "string" ? credentialValues.token : ""),
entries,
}),
resolveGroupAllowlist: async ({ cfg, accountId, credentialValues, entries }) =>
await resolveDiscordGroupAllowlist({
cfg,
accountId,
credentialValues,
entries,
}),
});

View File

@ -1 +1,8 @@
export { DiscordVoiceManager, DiscordVoiceReadyListener } from "./manager.js";
import {
DiscordVoiceManager as DiscordVoiceManagerImpl,
DiscordVoiceReadyListener as DiscordVoiceReadyListenerImpl,
} from "./manager.js";
export class DiscordVoiceManager extends DiscordVoiceManagerImpl {}
export class DiscordVoiceReadyListener extends DiscordVoiceReadyListenerImpl {}

View File

@ -1,7 +1,129 @@
export { listFeishuDirectoryGroupsLive, listFeishuDirectoryPeersLive } from "./directory.js";
export { feishuOutbound } from "./outbound.js";
export { createPinFeishu, listPinsFeishu, removePinFeishu } from "./pins.js";
export { probeFeishu } from "./probe.js";
export { addReactionFeishu, listReactionsFeishu, removeReactionFeishu } from "./reactions.js";
export { getChatInfo, getChatMembers, getFeishuMemberInfo } from "./chat.js";
export { editMessageFeishu, getMessageFeishu, sendCardFeishu, sendMessageFeishu } from "./send.js";
import {
getChatInfo as getChatInfoImpl,
getChatMembers as getChatMembersImpl,
getFeishuMemberInfo as getFeishuMemberInfoImpl,
} from "./chat.js";
import {
listFeishuDirectoryGroupsLive as listFeishuDirectoryGroupsLiveImpl,
listFeishuDirectoryPeersLive as listFeishuDirectoryPeersLiveImpl,
} from "./directory.js";
import { feishuOutbound as feishuOutboundImpl } from "./outbound.js";
import {
createPinFeishu as createPinFeishuImpl,
listPinsFeishu as listPinsFeishuImpl,
removePinFeishu as removePinFeishuImpl,
} from "./pins.js";
import { probeFeishu as probeFeishuImpl } from "./probe.js";
import {
addReactionFeishu as addReactionFeishuImpl,
listReactionsFeishu as listReactionsFeishuImpl,
removeReactionFeishu as removeReactionFeishuImpl,
} from "./reactions.js";
import {
editMessageFeishu as editMessageFeishuImpl,
getMessageFeishu as getMessageFeishuImpl,
sendCardFeishu as sendCardFeishuImpl,
sendMessageFeishu as sendMessageFeishuImpl,
} from "./send.js";
type ListFeishuDirectoryGroupsLive = typeof import("./directory.js").listFeishuDirectoryGroupsLive;
type ListFeishuDirectoryPeersLive = typeof import("./directory.js").listFeishuDirectoryPeersLive;
type FeishuOutbound = typeof import("./outbound.js").feishuOutbound;
type CreatePinFeishu = typeof import("./pins.js").createPinFeishu;
type ListPinsFeishu = typeof import("./pins.js").listPinsFeishu;
type RemovePinFeishu = typeof import("./pins.js").removePinFeishu;
type ProbeFeishu = typeof import("./probe.js").probeFeishu;
type AddReactionFeishu = typeof import("./reactions.js").addReactionFeishu;
type ListReactionsFeishu = typeof import("./reactions.js").listReactionsFeishu;
type RemoveReactionFeishu = typeof import("./reactions.js").removeReactionFeishu;
type GetChatInfo = typeof import("./chat.js").getChatInfo;
type GetChatMembers = typeof import("./chat.js").getChatMembers;
type GetFeishuMemberInfo = typeof import("./chat.js").getFeishuMemberInfo;
type EditMessageFeishu = typeof import("./send.js").editMessageFeishu;
type GetMessageFeishu = typeof import("./send.js").getMessageFeishu;
type SendCardFeishu = typeof import("./send.js").sendCardFeishu;
type SendMessageFeishu = typeof import("./send.js").sendMessageFeishu;
export function listFeishuDirectoryGroupsLive(
...args: Parameters<ListFeishuDirectoryGroupsLive>
): ReturnType<ListFeishuDirectoryGroupsLive> {
return listFeishuDirectoryGroupsLiveImpl(...args);
}
export function listFeishuDirectoryPeersLive(
...args: Parameters<ListFeishuDirectoryPeersLive>
): ReturnType<ListFeishuDirectoryPeersLive> {
return listFeishuDirectoryPeersLiveImpl(...args);
}
export const feishuOutbound: FeishuOutbound = { ...feishuOutboundImpl };
export function createPinFeishu(...args: Parameters<CreatePinFeishu>): ReturnType<CreatePinFeishu> {
return createPinFeishuImpl(...args);
}
export function listPinsFeishu(...args: Parameters<ListPinsFeishu>): ReturnType<ListPinsFeishu> {
return listPinsFeishuImpl(...args);
}
export function removePinFeishu(...args: Parameters<RemovePinFeishu>): ReturnType<RemovePinFeishu> {
return removePinFeishuImpl(...args);
}
export function probeFeishu(...args: Parameters<ProbeFeishu>): ReturnType<ProbeFeishu> {
return probeFeishuImpl(...args);
}
export function addReactionFeishu(
...args: Parameters<AddReactionFeishu>
): ReturnType<AddReactionFeishu> {
return addReactionFeishuImpl(...args);
}
export function listReactionsFeishu(
...args: Parameters<ListReactionsFeishu>
): ReturnType<ListReactionsFeishu> {
return listReactionsFeishuImpl(...args);
}
export function removeReactionFeishu(
...args: Parameters<RemoveReactionFeishu>
): ReturnType<RemoveReactionFeishu> {
return removeReactionFeishuImpl(...args);
}
export function getChatInfo(...args: Parameters<GetChatInfo>): ReturnType<GetChatInfo> {
return getChatInfoImpl(...args);
}
export function getChatMembers(...args: Parameters<GetChatMembers>): ReturnType<GetChatMembers> {
return getChatMembersImpl(...args);
}
export function getFeishuMemberInfo(
...args: Parameters<GetFeishuMemberInfo>
): ReturnType<GetFeishuMemberInfo> {
return getFeishuMemberInfoImpl(...args);
}
export function editMessageFeishu(
...args: Parameters<EditMessageFeishu>
): ReturnType<EditMessageFeishu> {
return editMessageFeishuImpl(...args);
}
export function getMessageFeishu(
...args: Parameters<GetMessageFeishu>
): ReturnType<GetMessageFeishu> {
return getMessageFeishuImpl(...args);
}
export function sendCardFeishu(...args: Parameters<SendCardFeishu>): ReturnType<SendCardFeishu> {
return sendCardFeishuImpl(...args);
}
export function sendMessageFeishu(
...args: Parameters<SendMessageFeishu>
): ReturnType<SendMessageFeishu> {
return sendMessageFeishuImpl(...args);
}

View File

@ -1,2 +1,43 @@
export { probeGoogleChat, sendGoogleChatMessage, uploadGoogleChatAttachment } from "./api.js";
export { resolveGoogleChatWebhookPath, startGoogleChatMonitor } from "./monitor.js";
import {
probeGoogleChat as probeGoogleChatImpl,
sendGoogleChatMessage as sendGoogleChatMessageImpl,
uploadGoogleChatAttachment as uploadGoogleChatAttachmentImpl,
} from "./api.js";
import {
resolveGoogleChatWebhookPath as resolveGoogleChatWebhookPathImpl,
startGoogleChatMonitor as startGoogleChatMonitorImpl,
} from "./monitor.js";
type ProbeGoogleChat = typeof import("./api.js").probeGoogleChat;
type SendGoogleChatMessage = typeof import("./api.js").sendGoogleChatMessage;
type UploadGoogleChatAttachment = typeof import("./api.js").uploadGoogleChatAttachment;
type ResolveGoogleChatWebhookPath = typeof import("./monitor.js").resolveGoogleChatWebhookPath;
type StartGoogleChatMonitor = typeof import("./monitor.js").startGoogleChatMonitor;
export function probeGoogleChat(...args: Parameters<ProbeGoogleChat>): ReturnType<ProbeGoogleChat> {
return probeGoogleChatImpl(...args);
}
export function sendGoogleChatMessage(
...args: Parameters<SendGoogleChatMessage>
): ReturnType<SendGoogleChatMessage> {
return sendGoogleChatMessageImpl(...args);
}
export function uploadGoogleChatAttachment(
...args: Parameters<UploadGoogleChatAttachment>
): ReturnType<UploadGoogleChatAttachment> {
return uploadGoogleChatAttachmentImpl(...args);
}
export function resolveGoogleChatWebhookPath(
...args: Parameters<ResolveGoogleChatWebhookPath>
): ReturnType<ResolveGoogleChatWebhookPath> {
return resolveGoogleChatWebhookPathImpl(...args);
}
export function startGoogleChatMonitor(
...args: Parameters<StartGoogleChatMonitor>
): ReturnType<StartGoogleChatMonitor> {
return startGoogleChatMonitorImpl(...args);
}

View File

@ -1,6 +1,55 @@
export { listMatrixDirectoryGroupsLive, listMatrixDirectoryPeersLive } from "./directory-live.js";
export { resolveMatrixAuth } from "./matrix/client.js";
export { probeMatrix } from "./matrix/probe.js";
export { sendMessageMatrix } from "./matrix/send.js";
export { resolveMatrixTargets } from "./resolve-targets.js";
export { matrixOutbound } from "./outbound.js";
import {
listMatrixDirectoryGroupsLive as listMatrixDirectoryGroupsLiveImpl,
listMatrixDirectoryPeersLive as listMatrixDirectoryPeersLiveImpl,
} from "./directory-live.js";
import { resolveMatrixAuth as resolveMatrixAuthImpl } from "./matrix/client.js";
import { probeMatrix as probeMatrixImpl } from "./matrix/probe.js";
import { sendMessageMatrix as sendMessageMatrixImpl } from "./matrix/send.js";
import { matrixOutbound as matrixOutboundImpl } from "./outbound.js";
import { resolveMatrixTargets as resolveMatrixTargetsImpl } from "./resolve-targets.js";
type ListMatrixDirectoryGroupsLive =
typeof import("./directory-live.js").listMatrixDirectoryGroupsLive;
type ListMatrixDirectoryPeersLive =
typeof import("./directory-live.js").listMatrixDirectoryPeersLive;
type ResolveMatrixAuth = typeof import("./matrix/client.js").resolveMatrixAuth;
type ProbeMatrix = typeof import("./matrix/probe.js").probeMatrix;
type SendMessageMatrix = typeof import("./matrix/send.js").sendMessageMatrix;
type ResolveMatrixTargets = typeof import("./resolve-targets.js").resolveMatrixTargets;
type MatrixOutbound = typeof import("./outbound.js").matrixOutbound;
export function listMatrixDirectoryGroupsLive(
...args: Parameters<ListMatrixDirectoryGroupsLive>
): ReturnType<ListMatrixDirectoryGroupsLive> {
return listMatrixDirectoryGroupsLiveImpl(...args);
}
export function listMatrixDirectoryPeersLive(
...args: Parameters<ListMatrixDirectoryPeersLive>
): ReturnType<ListMatrixDirectoryPeersLive> {
return listMatrixDirectoryPeersLiveImpl(...args);
}
export function resolveMatrixAuth(
...args: Parameters<ResolveMatrixAuth>
): ReturnType<ResolveMatrixAuth> {
return resolveMatrixAuthImpl(...args);
}
export function probeMatrix(...args: Parameters<ProbeMatrix>): ReturnType<ProbeMatrix> {
return probeMatrixImpl(...args);
}
export function sendMessageMatrix(
...args: Parameters<SendMessageMatrix>
): ReturnType<SendMessageMatrix> {
return sendMessageMatrixImpl(...args);
}
export function resolveMatrixTargets(
...args: Parameters<ResolveMatrixTargets>
): ReturnType<ResolveMatrixTargets> {
return resolveMatrixTargetsImpl(...args);
}
export const matrixOutbound: MatrixOutbound = { ...matrixOutboundImpl };

View File

@ -1,4 +1,49 @@
export { listMSTeamsDirectoryGroupsLive, listMSTeamsDirectoryPeersLive } from "./directory-live.js";
export { msteamsOutbound } from "./outbound.js";
export { probeMSTeams } from "./probe.js";
export { sendAdaptiveCardMSTeams, sendMessageMSTeams } from "./send.js";
import {
listMSTeamsDirectoryGroupsLive as listMSTeamsDirectoryGroupsLiveImpl,
listMSTeamsDirectoryPeersLive as listMSTeamsDirectoryPeersLiveImpl,
} from "./directory-live.js";
import { msteamsOutbound as msteamsOutboundImpl } from "./outbound.js";
import { probeMSTeams as probeMSTeamsImpl } from "./probe.js";
import {
sendAdaptiveCardMSTeams as sendAdaptiveCardMSTeamsImpl,
sendMessageMSTeams as sendMessageMSTeamsImpl,
} from "./send.js";
type ListMSTeamsDirectoryGroupsLive =
typeof import("./directory-live.js").listMSTeamsDirectoryGroupsLive;
type ListMSTeamsDirectoryPeersLive =
typeof import("./directory-live.js").listMSTeamsDirectoryPeersLive;
type MSTeamsOutbound = typeof import("./outbound.js").msteamsOutbound;
type ProbeMSTeams = typeof import("./probe.js").probeMSTeams;
type SendAdaptiveCardMSTeams = typeof import("./send.js").sendAdaptiveCardMSTeams;
type SendMessageMSTeams = typeof import("./send.js").sendMessageMSTeams;
export function listMSTeamsDirectoryGroupsLive(
...args: Parameters<ListMSTeamsDirectoryGroupsLive>
): ReturnType<ListMSTeamsDirectoryGroupsLive> {
return listMSTeamsDirectoryGroupsLiveImpl(...args);
}
export function listMSTeamsDirectoryPeersLive(
...args: Parameters<ListMSTeamsDirectoryPeersLive>
): ReturnType<ListMSTeamsDirectoryPeersLive> {
return listMSTeamsDirectoryPeersLiveImpl(...args);
}
export const msteamsOutbound: MSTeamsOutbound = { ...msteamsOutboundImpl };
export function probeMSTeams(...args: Parameters<ProbeMSTeams>): ReturnType<ProbeMSTeams> {
return probeMSTeamsImpl(...args);
}
export function sendAdaptiveCardMSTeams(
...args: Parameters<SendAdaptiveCardMSTeams>
): ReturnType<SendAdaptiveCardMSTeams> {
return sendAdaptiveCardMSTeamsImpl(...args);
}
export function sendMessageMSTeams(
...args: Parameters<SendMessageMSTeams>
): ReturnType<SendMessageMSTeams> {
return sendMessageMSTeamsImpl(...args);
}

View File

@ -1 +1,5 @@
export { signalSetupWizard } from "./setup-surface.js";
import { signalSetupWizard as signalSetupWizardImpl } from "./setup-surface.js";
type SignalSetupWizard = typeof import("./setup-surface.js").signalSetupWizard;
export const signalSetupWizard: SignalSetupWizard = { ...signalSetupWizardImpl };

View File

@ -1 +1,5 @@
export { slackSetupWizard } from "./setup-surface.js";
import { slackSetupWizard as slackSetupWizardImpl } from "./setup-surface.js";
type SlackSetupWizard = typeof import("./setup-surface.js").slackSetupWizard;
export const slackSetupWizard: SlackSetupWizard = { ...slackSetupWizardImpl };

View File

@ -25,6 +25,7 @@ import {
type ChannelPlugin,
type OpenClawConfig,
} from "openclaw/plugin-sdk/slack";
import type { SlackActionContext } from "../../../src/agents/tools/slack-actions.js";
import { createSlackActions } from "../../../src/channels/plugins/slack.actions.js";
import { buildPassiveProbedChannelStatusSummary } from "../../shared/channel-status-summary.js";
import {
@ -489,9 +490,7 @@ export const slackPlugin: ChannelPlugin<ResolvedSlackAccount> = {
await getSlackRuntime().channel.slack.handleSlackAction(
action,
cfg as OpenClawConfig,
toolContext as Parameters<
ReturnType<typeof getSlackRuntime>["channel"]["slack"]["handleSlackAction"]
>[2],
toolContext as SlackActionContext | undefined,
),
}),
setup: slackSetupAdapter,

View File

@ -1,18 +1,73 @@
export { getActiveWebListener } from "./active-listener.js";
export {
getWebAuthAgeMs,
logWebSelfId,
logoutWeb,
readWebSelfId,
webAuthExists,
} from "./auth-store.js";
export { loginWeb } from "./login.js";
export { startWebLoginWithQr, waitForWebLogin } from "./login-qr.js";
export { whatsappSetupWizard } from "./setup-surface.js";
import { monitorWebChannel as monitorWebChannelImpl } from "openclaw/plugin-sdk/whatsapp";
import { getActiveWebListener as getActiveWebListenerImpl } from "./active-listener.js";
import {
getWebAuthAgeMs as getWebAuthAgeMsImpl,
logWebSelfId as logWebSelfIdImpl,
logoutWeb as logoutWebImpl,
readWebSelfId as readWebSelfIdImpl,
webAuthExists as webAuthExistsImpl,
} from "./auth-store.js";
import {
startWebLoginWithQr as startWebLoginWithQrImpl,
waitForWebLogin as waitForWebLoginImpl,
} from "./login-qr.js";
import { loginWeb as loginWebImpl } from "./login.js";
import { whatsappSetupWizard as whatsappSetupWizardImpl } from "./setup-surface.js";
type GetActiveWebListener = typeof import("./active-listener.js").getActiveWebListener;
type GetWebAuthAgeMs = typeof import("./auth-store.js").getWebAuthAgeMs;
type LogWebSelfId = typeof import("./auth-store.js").logWebSelfId;
type LogoutWeb = typeof import("./auth-store.js").logoutWeb;
type ReadWebSelfId = typeof import("./auth-store.js").readWebSelfId;
type WebAuthExists = typeof import("./auth-store.js").webAuthExists;
type LoginWeb = typeof import("./login.js").loginWeb;
type StartWebLoginWithQr = typeof import("./login-qr.js").startWebLoginWithQr;
type WaitForWebLogin = typeof import("./login-qr.js").waitForWebLogin;
type WhatsAppSetupWizard = typeof import("./setup-surface.js").whatsappSetupWizard;
type MonitorWebChannel = typeof import("openclaw/plugin-sdk/whatsapp").monitorWebChannel;
export function getActiveWebListener(
...args: Parameters<GetActiveWebListener>
): ReturnType<GetActiveWebListener> {
return getActiveWebListenerImpl(...args);
}
export function getWebAuthAgeMs(...args: Parameters<GetWebAuthAgeMs>): ReturnType<GetWebAuthAgeMs> {
return getWebAuthAgeMsImpl(...args);
}
export function logWebSelfId(...args: Parameters<LogWebSelfId>): ReturnType<LogWebSelfId> {
return logWebSelfIdImpl(...args);
}
export function logoutWeb(...args: Parameters<LogoutWeb>): ReturnType<LogoutWeb> {
return logoutWebImpl(...args);
}
export function readWebSelfId(...args: Parameters<ReadWebSelfId>): ReturnType<ReadWebSelfId> {
return readWebSelfIdImpl(...args);
}
export function webAuthExists(...args: Parameters<WebAuthExists>): ReturnType<WebAuthExists> {
return webAuthExistsImpl(...args);
}
export function loginWeb(...args: Parameters<LoginWeb>): ReturnType<LoginWeb> {
return loginWebImpl(...args);
}
export function startWebLoginWithQr(
...args: Parameters<StartWebLoginWithQr>
): ReturnType<StartWebLoginWithQr> {
return startWebLoginWithQrImpl(...args);
}
export function waitForWebLogin(...args: Parameters<WaitForWebLogin>): ReturnType<WaitForWebLogin> {
return waitForWebLoginImpl(...args);
}
export const whatsappSetupWizard: WhatsAppSetupWizard = { ...whatsappSetupWizardImpl };
export async function monitorWebChannel(
...args: Parameters<MonitorWebChannel>
): ReturnType<MonitorWebChannel> {

View File

@ -1 +1,7 @@
export { sendMessageZalo } from "./send.js";
import { sendMessageZalo as sendMessageZaloImpl } from "./send.js";
type SendMessageZalo = typeof import("./send.js").sendMessageZalo;
export function sendMessageZalo(...args: Parameters<SendMessageZalo>): ReturnType<SendMessageZalo> {
return sendMessageZaloImpl(...args);
}

View File

@ -21,32 +21,32 @@ const sendFns = vi.hoisted(() => ({
vi.mock("./send-runtime/whatsapp.js", () => {
moduleLoads.whatsapp();
return { sendMessageWhatsApp: sendFns.whatsapp };
return { runtimeSend: { sendMessage: sendFns.whatsapp } };
});
vi.mock("./send-runtime/telegram.js", () => {
moduleLoads.telegram();
return { sendMessageTelegram: sendFns.telegram };
return { runtimeSend: { sendMessage: sendFns.telegram } };
});
vi.mock("./send-runtime/discord.js", () => {
moduleLoads.discord();
return { sendMessageDiscord: sendFns.discord };
return { runtimeSend: { sendMessage: sendFns.discord } };
});
vi.mock("./send-runtime/slack.js", () => {
moduleLoads.slack();
return { sendMessageSlack: sendFns.slack };
return { runtimeSend: { sendMessage: sendFns.slack } };
});
vi.mock("./send-runtime/signal.js", () => {
moduleLoads.signal();
return { sendMessageSignal: sendFns.signal };
return { runtimeSend: { sendMessage: sendFns.signal } };
});
vi.mock("./send-runtime/imessage.js", () => {
moduleLoads.imessage();
return { sendMessageIMessage: sendFns.imessage };
return { runtimeSend: { sendMessage: sendFns.imessage } };
});
describe("createDefaultDeps", () => {

View File

@ -6,9 +6,15 @@ import { createOutboundSendDepsFromCliSource } from "./outbound-send-mapping.js"
* Values are proxy functions that dynamically import the real module on first use.
*/
export type CliDeps = { [channelId: string]: unknown };
type RuntimeSend = {
sendMessage: (...args: unknown[]) => Promise<unknown>;
};
type RuntimeSendModule = {
runtimeSend: RuntimeSend;
};
// Per-channel module caches for lazy loading.
const senderCache = new Map<string, Promise<Record<string, unknown>>>();
const senderCache = new Map<string, Promise<RuntimeSend>>();
/**
* Create a lazy-loading send function proxy for a channel.
@ -16,18 +22,16 @@ const senderCache = new Map<string, Promise<Record<string, unknown>>>();
*/
function createLazySender(
channelId: string,
loader: () => Promise<Record<string, unknown>>,
exportName: string,
loader: () => Promise<RuntimeSendModule>,
): (...args: unknown[]) => Promise<unknown> {
return async (...args: unknown[]) => {
let cached = senderCache.get(channelId);
if (!cached) {
cached = loader();
cached = loader().then(({ runtimeSend }) => runtimeSend);
senderCache.set(channelId, cached);
}
const mod = await cached;
const fn = mod[exportName] as (...a: unknown[]) => Promise<unknown>;
return await fn(...args);
const runtimeSend = await cached;
return await runtimeSend.sendMessage(...args);
};
}
@ -35,33 +39,27 @@ export function createDefaultDeps(): CliDeps {
return {
whatsapp: createLazySender(
"whatsapp",
() => import("./send-runtime/whatsapp.js") as Promise<Record<string, unknown>>,
"sendMessageWhatsApp",
() => import("./send-runtime/whatsapp.js") as Promise<RuntimeSendModule>,
),
telegram: createLazySender(
"telegram",
() => import("./send-runtime/telegram.js") as Promise<Record<string, unknown>>,
"sendMessageTelegram",
() => import("./send-runtime/telegram.js") as Promise<RuntimeSendModule>,
),
discord: createLazySender(
"discord",
() => import("./send-runtime/discord.js") as Promise<Record<string, unknown>>,
"sendMessageDiscord",
() => import("./send-runtime/discord.js") as Promise<RuntimeSendModule>,
),
slack: createLazySender(
"slack",
() => import("./send-runtime/slack.js") as Promise<Record<string, unknown>>,
"sendMessageSlack",
() => import("./send-runtime/slack.js") as Promise<RuntimeSendModule>,
),
signal: createLazySender(
"signal",
() => import("./send-runtime/signal.js") as Promise<Record<string, unknown>>,
"sendMessageSignal",
() => import("./send-runtime/signal.js") as Promise<RuntimeSendModule>,
),
imessage: createLazySender(
"imessage",
() => import("./send-runtime/imessage.js") as Promise<Record<string, unknown>>,
"sendMessageIMessage",
() => import("./send-runtime/imessage.js") as Promise<RuntimeSendModule>,
),
};
}

View File

@ -1,9 +1,9 @@
import { sendMessageDiscord as sendMessageDiscordImpl } from "../../plugin-sdk/discord.js";
type SendMessageDiscord = typeof import("../../plugin-sdk/discord.js").sendMessageDiscord;
type RuntimeSend = {
sendMessage: typeof import("../../plugin-sdk/discord.js").sendMessageDiscord;
};
export async function sendMessageDiscord(
...args: Parameters<SendMessageDiscord>
): ReturnType<SendMessageDiscord> {
return await sendMessageDiscordImpl(...args);
}
export const runtimeSend = {
sendMessage: sendMessageDiscordImpl,
} satisfies RuntimeSend;

View File

@ -1,9 +1,9 @@
import { sendMessageIMessage as sendMessageIMessageImpl } from "../../plugin-sdk/imessage.js";
type SendMessageIMessage = typeof import("../../plugin-sdk/imessage.js").sendMessageIMessage;
type RuntimeSend = {
sendMessage: typeof import("../../plugin-sdk/imessage.js").sendMessageIMessage;
};
export async function sendMessageIMessage(
...args: Parameters<SendMessageIMessage>
): ReturnType<SendMessageIMessage> {
return await sendMessageIMessageImpl(...args);
}
export const runtimeSend = {
sendMessage: sendMessageIMessageImpl,
} satisfies RuntimeSend;

View File

@ -1,9 +1,9 @@
import { sendMessageSignal as sendMessageSignalImpl } from "../../plugin-sdk/signal.js";
type SendMessageSignal = typeof import("../../plugin-sdk/signal.js").sendMessageSignal;
type RuntimeSend = {
sendMessage: typeof import("../../plugin-sdk/signal.js").sendMessageSignal;
};
export async function sendMessageSignal(
...args: Parameters<SendMessageSignal>
): ReturnType<SendMessageSignal> {
return await sendMessageSignalImpl(...args);
}
export const runtimeSend = {
sendMessage: sendMessageSignalImpl,
} satisfies RuntimeSend;

View File

@ -1,9 +1,9 @@
import { sendMessageSlack as sendMessageSlackImpl } from "../../plugin-sdk/slack.js";
type SendMessageSlack = typeof import("../../plugin-sdk/slack.js").sendMessageSlack;
type RuntimeSend = {
sendMessage: typeof import("../../plugin-sdk/slack.js").sendMessageSlack;
};
export async function sendMessageSlack(
...args: Parameters<SendMessageSlack>
): ReturnType<SendMessageSlack> {
return await sendMessageSlackImpl(...args);
}
export const runtimeSend = {
sendMessage: sendMessageSlackImpl,
} satisfies RuntimeSend;

View File

@ -1,9 +1,9 @@
import { sendMessageTelegram as sendMessageTelegramImpl } from "../../plugin-sdk/telegram.js";
type SendMessageTelegram = typeof import("../../plugin-sdk/telegram.js").sendMessageTelegram;
type RuntimeSend = {
sendMessage: typeof import("../../plugin-sdk/telegram.js").sendMessageTelegram;
};
export async function sendMessageTelegram(
...args: Parameters<SendMessageTelegram>
): ReturnType<SendMessageTelegram> {
return await sendMessageTelegramImpl(...args);
}
export const runtimeSend = {
sendMessage: sendMessageTelegramImpl,
} satisfies RuntimeSend;

View File

@ -1,9 +1,9 @@
import { sendMessageWhatsApp as sendMessageWhatsAppImpl } from "../../plugin-sdk/whatsapp.js";
type SendMessageWhatsApp = typeof import("../../plugin-sdk/whatsapp.js").sendMessageWhatsApp;
type RuntimeSend = {
sendMessage: typeof import("../../plugin-sdk/whatsapp.js").sendMessageWhatsApp;
};
export async function sendMessageWhatsApp(
...args: Parameters<SendMessageWhatsApp>
): ReturnType<SendMessageWhatsApp> {
return await sendMessageWhatsAppImpl(...args);
}
export const runtimeSend = {
sendMessage: sendMessageWhatsAppImpl,
} satisfies RuntimeSend;

View File

@ -1,2 +1,34 @@
export { getTailnetHostname } from "../infra/tailscale.js";
export { getMemorySearchManager } from "../memory/index.js";
import type { OpenClawConfig } from "../config/config.js";
import { getTailnetHostname } from "../infra/tailscale.js";
import { getMemorySearchManager as getMemorySearchManagerImpl } from "../memory/index.js";
import type { MemoryProviderStatus } from "../memory/types.js";
export { getTailnetHostname };
type StatusMemoryManager = {
probeVectorAvailability(): Promise<void>;
status(): MemoryProviderStatus;
close?(): Promise<void>;
};
export async function getMemorySearchManager(params: {
cfg: OpenClawConfig;
agentId: string;
purpose: "status";
}): Promise<{ manager: StatusMemoryManager | null }> {
const { manager } = await getMemorySearchManagerImpl(params);
if (!manager) {
return { manager: null };
}
return {
manager: {
async probeVectorAvailability() {
await manager.probeVectorAvailability();
},
status() {
return manager.status();
},
close: manager.close ? async () => await manager.close?.() : undefined,
},
};
}

View File

@ -21,7 +21,7 @@ describe("schema.shared", () => {
it("treats branch schemas as having children", () => {
expect(
schemaHasChildren({
oneOf: [{ type: "string" }, { properties: { token: { type: "string" } } }],
oneOf: [{}, { properties: { token: {} } }],
}),
).toBe(true);
});

View File

@ -1,5 +1,4 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { clearRuntimeAuthProfileStoreSnapshots } from "../../agents/auth-profiles/store.js";
import {
createAuthTestLifecycle,
createExitThrowingRuntime,
@ -7,7 +6,8 @@ import {
readAuthProfilesForAgent,
requireOpenClawAgentDir,
setupAuthTestEnv,
} from "../../commands/test-wizard-helpers.js";
} from "../../../test/helpers/auth-wizard.js";
import { clearRuntimeAuthProfileStoreSnapshots } from "../../agents/auth-profiles/store.js";
import { applyAuthChoiceLoadedPluginProvider } from "../../plugins/provider-auth-choice.js";
import { buildProviderPluginMethodChoice } from "../provider-wizard.js";
import { requireProviderContractProvider, uniqueProviderContractProviders } from "./registry.js";
@ -27,7 +27,6 @@ const resolveProviderPluginChoiceMock = vi.hoisted(() => vi.fn<ResolveProviderPl
const runProviderModelSelectedHookMock = vi.hoisted(() =>
vi.fn<RunProviderModelSelectedHook>(async () => {}),
);
const resolvePreferredProviderPluginProvidersMock = vi.hoisted(() => vi.fn());
vi.mock("../../../extensions/qwen-portal-auth/oauth.js", () => ({
loginQwenPortalOAuth: loginQwenPortalOAuthMock,
@ -43,15 +42,6 @@ vi.mock("../../plugins/provider-auth-choice.runtime.js", () => ({
runProviderModelSelectedHook: runProviderModelSelectedHookMock,
}));
vi.mock("../../plugins/providers.js", async () => {
const actual = await vi.importActual<object>("../../plugins/providers.js");
return {
...actual,
resolvePluginProviders: (...args: unknown[]) =>
resolvePreferredProviderPluginProvidersMock(...args),
};
});
const { resolvePreferredProviderForAuthChoice } =
await import("../../plugins/provider-auth-choice-preference.js");
@ -84,8 +74,24 @@ describe("provider auth-choice contract", () => {
}
beforeEach(() => {
resolvePreferredProviderPluginProvidersMock.mockReset();
resolvePreferredProviderPluginProvidersMock.mockReturnValue(uniqueProviderContractProviders);
resolvePluginProvidersMock.mockReset();
resolvePluginProvidersMock.mockReturnValue(uniqueProviderContractProviders);
resolveProviderPluginChoiceMock.mockReset();
resolveProviderPluginChoiceMock.mockImplementation(({ providers, choice }) => {
const provider = providers.find((entry) =>
entry.auth.some(
(method) => buildProviderPluginMethodChoice(entry.id, method.id) === choice,
),
);
if (!provider) {
return null;
}
const method =
provider.auth.find(
(entry) => buildProviderPluginMethodChoice(provider.id, entry.id) === choice,
) ?? null;
return method ? { provider, method } : null;
});
});
afterEach(async () => {
@ -117,18 +123,18 @@ describe("provider auth-choice contract", () => {
});
for (const scenario of pluginFallbackScenarios) {
resolvePreferredProviderPluginProvidersMock.mockClear();
resolvePluginProvidersMock.mockClear();
await expect(
resolvePreferredProviderForAuthChoice({ choice: scenario.authChoice }),
).resolves.toBe(scenario.expectedProvider);
expect(resolvePreferredProviderPluginProvidersMock).toHaveBeenCalled();
expect(resolvePluginProvidersMock).toHaveBeenCalled();
}
resolvePreferredProviderPluginProvidersMock.mockClear();
resolvePluginProvidersMock.mockClear();
await expect(resolvePreferredProviderForAuthChoice({ choice: "unknown" })).resolves.toBe(
undefined,
);
expect(resolvePreferredProviderPluginProvidersMock).toHaveBeenCalled();
expect(resolvePluginProvidersMock).toHaveBeenCalled();
});
it("applies qwen portal auth choices through the shared plugin-provider path", async () => {

View File

@ -518,7 +518,7 @@ describe("provider runtime contract", () => {
});
it("falls back to legacy pi auth tokens for usage auth", async () => {
const provider = requireProvider("zai");
const provider = requireProviderContractProvider("zai");
const home = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-zai-contract-"));
await fs.mkdir(path.join(home, ".pi", "agent"), { recursive: true });
await fs.writeFile(

View File

@ -19,132 +19,48 @@ import {
sendTypingDiscord as sendTypingDiscordImpl,
unpinMessageDiscord as unpinMessageDiscordImpl,
} from "../../../extensions/discord/src/send.js";
import type { PluginRuntimeChannel } from "./types-channel.js";
type AuditDiscordChannelPermissions =
typeof import("../../../extensions/discord/src/audit.js").auditDiscordChannelPermissions;
type ListDiscordDirectoryGroupsLive =
typeof import("../../../extensions/discord/src/directory-live.js").listDiscordDirectoryGroupsLive;
type ListDiscordDirectoryPeersLive =
typeof import("../../../extensions/discord/src/directory-live.js").listDiscordDirectoryPeersLive;
type MonitorDiscordProvider =
typeof import("../../../extensions/discord/src/monitor.js").monitorDiscordProvider;
type ProbeDiscord = typeof import("../../../extensions/discord/src/probe.js").probeDiscord;
type ResolveDiscordChannelAllowlist =
typeof import("../../../extensions/discord/src/resolve-channels.js").resolveDiscordChannelAllowlist;
type ResolveDiscordUserAllowlist =
typeof import("../../../extensions/discord/src/resolve-users.js").resolveDiscordUserAllowlist;
type CreateThreadDiscord =
typeof import("../../../extensions/discord/src/send.js").createThreadDiscord;
type DeleteMessageDiscord =
typeof import("../../../extensions/discord/src/send.js").deleteMessageDiscord;
type EditChannelDiscord =
typeof import("../../../extensions/discord/src/send.js").editChannelDiscord;
type EditMessageDiscord =
typeof import("../../../extensions/discord/src/send.js").editMessageDiscord;
type PinMessageDiscord = typeof import("../../../extensions/discord/src/send.js").pinMessageDiscord;
type SendDiscordComponentMessage =
typeof import("../../../extensions/discord/src/send.js").sendDiscordComponentMessage;
type SendMessageDiscord =
typeof import("../../../extensions/discord/src/send.js").sendMessageDiscord;
type SendPollDiscord = typeof import("../../../extensions/discord/src/send.js").sendPollDiscord;
type SendTypingDiscord = typeof import("../../../extensions/discord/src/send.js").sendTypingDiscord;
type UnpinMessageDiscord =
typeof import("../../../extensions/discord/src/send.js").unpinMessageDiscord;
type RuntimeDiscordOps = Pick<
PluginRuntimeChannel["discord"],
| "auditChannelPermissions"
| "listDirectoryGroupsLive"
| "listDirectoryPeersLive"
| "probeDiscord"
| "resolveChannelAllowlist"
| "resolveUserAllowlist"
| "sendComponentMessage"
| "sendMessageDiscord"
| "sendPollDiscord"
| "monitorDiscordProvider"
> & {
typing: Pick<PluginRuntimeChannel["discord"]["typing"], "pulse">;
conversationActions: Pick<
PluginRuntimeChannel["discord"]["conversationActions"],
"editMessage" | "deleteMessage" | "pinMessage" | "unpinMessage" | "createThread" | "editChannel"
>;
};
export function auditDiscordChannelPermissions(
...args: Parameters<AuditDiscordChannelPermissions>
): ReturnType<AuditDiscordChannelPermissions> {
return auditDiscordChannelPermissionsImpl(...args);
}
export function listDiscordDirectoryGroupsLive(
...args: Parameters<ListDiscordDirectoryGroupsLive>
): ReturnType<ListDiscordDirectoryGroupsLive> {
return listDiscordDirectoryGroupsLiveImpl(...args);
}
export function listDiscordDirectoryPeersLive(
...args: Parameters<ListDiscordDirectoryPeersLive>
): ReturnType<ListDiscordDirectoryPeersLive> {
return listDiscordDirectoryPeersLiveImpl(...args);
}
export function monitorDiscordProvider(
...args: Parameters<MonitorDiscordProvider>
): ReturnType<MonitorDiscordProvider> {
return monitorDiscordProviderImpl(...args);
}
export function probeDiscord(...args: Parameters<ProbeDiscord>): ReturnType<ProbeDiscord> {
return probeDiscordImpl(...args);
}
export function resolveDiscordChannelAllowlist(
...args: Parameters<ResolveDiscordChannelAllowlist>
): ReturnType<ResolveDiscordChannelAllowlist> {
return resolveDiscordChannelAllowlistImpl(...args);
}
export function resolveDiscordUserAllowlist(
...args: Parameters<ResolveDiscordUserAllowlist>
): ReturnType<ResolveDiscordUserAllowlist> {
return resolveDiscordUserAllowlistImpl(...args);
}
export function createThreadDiscord(
...args: Parameters<CreateThreadDiscord>
): ReturnType<CreateThreadDiscord> {
return createThreadDiscordImpl(...args);
}
export function deleteMessageDiscord(
...args: Parameters<DeleteMessageDiscord>
): ReturnType<DeleteMessageDiscord> {
return deleteMessageDiscordImpl(...args);
}
export function editChannelDiscord(
...args: Parameters<EditChannelDiscord>
): ReturnType<EditChannelDiscord> {
return editChannelDiscordImpl(...args);
}
export function editMessageDiscord(
...args: Parameters<EditMessageDiscord>
): ReturnType<EditMessageDiscord> {
return editMessageDiscordImpl(...args);
}
export function pinMessageDiscord(
...args: Parameters<PinMessageDiscord>
): ReturnType<PinMessageDiscord> {
return pinMessageDiscordImpl(...args);
}
export function sendDiscordComponentMessage(
...args: Parameters<SendDiscordComponentMessage>
): ReturnType<SendDiscordComponentMessage> {
return sendDiscordComponentMessageImpl(...args);
}
export function sendMessageDiscord(
...args: Parameters<SendMessageDiscord>
): ReturnType<SendMessageDiscord> {
return sendMessageDiscordImpl(...args);
}
export function sendPollDiscord(...args: Parameters<SendPollDiscord>): ReturnType<SendPollDiscord> {
return sendPollDiscordImpl(...args);
}
export function sendTypingDiscord(
...args: Parameters<SendTypingDiscord>
): ReturnType<SendTypingDiscord> {
return sendTypingDiscordImpl(...args);
}
export function unpinMessageDiscord(
...args: Parameters<UnpinMessageDiscord>
): ReturnType<UnpinMessageDiscord> {
return unpinMessageDiscordImpl(...args);
}
export const runtimeDiscordOps = {
auditChannelPermissions: auditDiscordChannelPermissionsImpl,
listDirectoryGroupsLive: listDiscordDirectoryGroupsLiveImpl,
listDirectoryPeersLive: listDiscordDirectoryPeersLiveImpl,
probeDiscord: probeDiscordImpl,
resolveChannelAllowlist: resolveDiscordChannelAllowlistImpl,
resolveUserAllowlist: resolveDiscordUserAllowlistImpl,
sendComponentMessage: sendDiscordComponentMessageImpl,
sendMessageDiscord: sendMessageDiscordImpl,
sendPollDiscord: sendPollDiscordImpl,
monitorDiscordProvider: monitorDiscordProviderImpl,
typing: {
pulse: sendTypingDiscordImpl,
},
conversationActions: {
editMessage: editMessageDiscordImpl,
deleteMessage: deleteMessageDiscordImpl,
pinMessage: pinMessageDiscordImpl,
unpinMessage: unpinMessageDiscordImpl,
createThread: createThreadDiscordImpl,
editChannel: editChannelDiscordImpl,
},
} satisfies RuntimeDiscordOps;

View File

@ -12,116 +12,119 @@ import {
import { createDiscordTypingLease } from "./runtime-discord-typing.js";
import type { PluginRuntimeChannel } from "./types-channel.js";
let runtimeDiscordOpsPromise: Promise<typeof import("./runtime-discord-ops.runtime.js")> | null =
null;
type RuntimeDiscordOps = typeof import("./runtime-discord-ops.runtime.js").runtimeDiscordOps;
let runtimeDiscordOpsPromise: Promise<RuntimeDiscordOps> | null = null;
function loadRuntimeDiscordOps() {
runtimeDiscordOpsPromise ??= import("./runtime-discord-ops.runtime.js");
runtimeDiscordOpsPromise ??= import("./runtime-discord-ops.runtime.js").then(
({ runtimeDiscordOps }) => runtimeDiscordOps,
);
return runtimeDiscordOpsPromise;
}
const auditChannelPermissionsLazy: PluginRuntimeChannel["discord"]["auditChannelPermissions"] =
async (...args) => {
const { auditDiscordChannelPermissions } = await loadRuntimeDiscordOps();
return auditDiscordChannelPermissions(...args);
const runtimeDiscordOps = await loadRuntimeDiscordOps();
return runtimeDiscordOps.auditChannelPermissions(...args);
};
const listDirectoryGroupsLiveLazy: PluginRuntimeChannel["discord"]["listDirectoryGroupsLive"] =
async (...args) => {
const { listDiscordDirectoryGroupsLive } = await loadRuntimeDiscordOps();
return listDiscordDirectoryGroupsLive(...args);
const runtimeDiscordOps = await loadRuntimeDiscordOps();
return runtimeDiscordOps.listDirectoryGroupsLive(...args);
};
const listDirectoryPeersLiveLazy: PluginRuntimeChannel["discord"]["listDirectoryPeersLive"] =
async (...args) => {
const { listDiscordDirectoryPeersLive } = await loadRuntimeDiscordOps();
return listDiscordDirectoryPeersLive(...args);
const runtimeDiscordOps = await loadRuntimeDiscordOps();
return runtimeDiscordOps.listDirectoryPeersLive(...args);
};
const probeDiscordLazy: PluginRuntimeChannel["discord"]["probeDiscord"] = async (...args) => {
const { probeDiscord } = await loadRuntimeDiscordOps();
return probeDiscord(...args);
const runtimeDiscordOps = await loadRuntimeDiscordOps();
return runtimeDiscordOps.probeDiscord(...args);
};
const resolveChannelAllowlistLazy: PluginRuntimeChannel["discord"]["resolveChannelAllowlist"] =
async (...args) => {
const { resolveDiscordChannelAllowlist } = await loadRuntimeDiscordOps();
return resolveDiscordChannelAllowlist(...args);
const runtimeDiscordOps = await loadRuntimeDiscordOps();
return runtimeDiscordOps.resolveChannelAllowlist(...args);
};
const resolveUserAllowlistLazy: PluginRuntimeChannel["discord"]["resolveUserAllowlist"] = async (
...args
) => {
const { resolveDiscordUserAllowlist } = await loadRuntimeDiscordOps();
return resolveDiscordUserAllowlist(...args);
const runtimeDiscordOps = await loadRuntimeDiscordOps();
return runtimeDiscordOps.resolveUserAllowlist(...args);
};
const sendComponentMessageLazy: PluginRuntimeChannel["discord"]["sendComponentMessage"] = async (
...args
) => {
const { sendDiscordComponentMessage } = await loadRuntimeDiscordOps();
return sendDiscordComponentMessage(...args);
const runtimeDiscordOps = await loadRuntimeDiscordOps();
return runtimeDiscordOps.sendComponentMessage(...args);
};
const sendMessageDiscordLazy: PluginRuntimeChannel["discord"]["sendMessageDiscord"] = async (
...args
) => {
const { sendMessageDiscord } = await loadRuntimeDiscordOps();
return sendMessageDiscord(...args);
const runtimeDiscordOps = await loadRuntimeDiscordOps();
return runtimeDiscordOps.sendMessageDiscord(...args);
};
const sendPollDiscordLazy: PluginRuntimeChannel["discord"]["sendPollDiscord"] = async (...args) => {
const { sendPollDiscord } = await loadRuntimeDiscordOps();
return sendPollDiscord(...args);
const runtimeDiscordOps = await loadRuntimeDiscordOps();
return runtimeDiscordOps.sendPollDiscord(...args);
};
const monitorDiscordProviderLazy: PluginRuntimeChannel["discord"]["monitorDiscordProvider"] =
async (...args) => {
const { monitorDiscordProvider } = await loadRuntimeDiscordOps();
return monitorDiscordProvider(...args);
const runtimeDiscordOps = await loadRuntimeDiscordOps();
return runtimeDiscordOps.monitorDiscordProvider(...args);
};
const sendTypingDiscordLazy: PluginRuntimeChannel["discord"]["typing"]["pulse"] = async (
...args
) => {
const { sendTypingDiscord } = await loadRuntimeDiscordOps();
return sendTypingDiscord(...args);
const runtimeDiscordOps = await loadRuntimeDiscordOps();
return runtimeDiscordOps.typing.pulse(...args);
};
const editMessageDiscordLazy: PluginRuntimeChannel["discord"]["conversationActions"]["editMessage"] =
async (...args) => {
const { editMessageDiscord } = await loadRuntimeDiscordOps();
return editMessageDiscord(...args);
const runtimeDiscordOps = await loadRuntimeDiscordOps();
return runtimeDiscordOps.conversationActions.editMessage(...args);
};
const deleteMessageDiscordLazy: PluginRuntimeChannel["discord"]["conversationActions"]["deleteMessage"] =
async (...args) => {
const { deleteMessageDiscord } = await loadRuntimeDiscordOps();
return deleteMessageDiscord(...args);
const runtimeDiscordOps = await loadRuntimeDiscordOps();
return runtimeDiscordOps.conversationActions.deleteMessage(...args);
};
const pinMessageDiscordLazy: PluginRuntimeChannel["discord"]["conversationActions"]["pinMessage"] =
async (...args) => {
const { pinMessageDiscord } = await loadRuntimeDiscordOps();
return pinMessageDiscord(...args);
const runtimeDiscordOps = await loadRuntimeDiscordOps();
return runtimeDiscordOps.conversationActions.pinMessage(...args);
};
const unpinMessageDiscordLazy: PluginRuntimeChannel["discord"]["conversationActions"]["unpinMessage"] =
async (...args) => {
const { unpinMessageDiscord } = await loadRuntimeDiscordOps();
return unpinMessageDiscord(...args);
const runtimeDiscordOps = await loadRuntimeDiscordOps();
return runtimeDiscordOps.conversationActions.unpinMessage(...args);
};
const createThreadDiscordLazy: PluginRuntimeChannel["discord"]["conversationActions"]["createThread"] =
async (...args) => {
const { createThreadDiscord } = await loadRuntimeDiscordOps();
return createThreadDiscord(...args);
const runtimeDiscordOps = await loadRuntimeDiscordOps();
return runtimeDiscordOps.conversationActions.createThread(...args);
};
const editChannelDiscordLazy: PluginRuntimeChannel["discord"]["conversationActions"]["editChannel"] =
async (...args) => {
const { editChannelDiscord } = await loadRuntimeDiscordOps();
return editChannelDiscord(...args);
const runtimeDiscordOps = await loadRuntimeDiscordOps();
return runtimeDiscordOps.conversationActions.editChannel(...args);
};
export function createRuntimeDiscord(): PluginRuntimeChannel["discord"] {

View File

@ -8,63 +8,27 @@ import { resolveSlackChannelAllowlist as resolveSlackChannelAllowlistImpl } from
import { resolveSlackUserAllowlist as resolveSlackUserAllowlistImpl } from "../../../extensions/slack/src/resolve-users.js";
import { sendMessageSlack as sendMessageSlackImpl } from "../../../extensions/slack/src/send.js";
import { handleSlackAction as handleSlackActionImpl } from "../../agents/tools/slack-actions.js";
import type { PluginRuntimeChannel } from "./types-channel.js";
type ListSlackDirectoryGroupsLive =
typeof import("../../../extensions/slack/src/directory-live.js").listSlackDirectoryGroupsLive;
type ListSlackDirectoryPeersLive =
typeof import("../../../extensions/slack/src/directory-live.js").listSlackDirectoryPeersLive;
type MonitorSlackProvider =
typeof import("../../../extensions/slack/src/index.js").monitorSlackProvider;
type ProbeSlack = typeof import("../../../extensions/slack/src/probe.js").probeSlack;
type ResolveSlackChannelAllowlist =
typeof import("../../../extensions/slack/src/resolve-channels.js").resolveSlackChannelAllowlist;
type ResolveSlackUserAllowlist =
typeof import("../../../extensions/slack/src/resolve-users.js").resolveSlackUserAllowlist;
type SendMessageSlack = typeof import("../../../extensions/slack/src/send.js").sendMessageSlack;
type HandleSlackAction = typeof import("../../agents/tools/slack-actions.js").handleSlackAction;
type RuntimeSlackOps = Pick<
PluginRuntimeChannel["slack"],
| "listDirectoryGroupsLive"
| "listDirectoryPeersLive"
| "probeSlack"
| "resolveChannelAllowlist"
| "resolveUserAllowlist"
| "sendMessageSlack"
| "monitorSlackProvider"
| "handleSlackAction"
>;
export function listSlackDirectoryGroupsLive(
...args: Parameters<ListSlackDirectoryGroupsLive>
): ReturnType<ListSlackDirectoryGroupsLive> {
return listSlackDirectoryGroupsLiveImpl(...args);
}
export function listSlackDirectoryPeersLive(
...args: Parameters<ListSlackDirectoryPeersLive>
): ReturnType<ListSlackDirectoryPeersLive> {
return listSlackDirectoryPeersLiveImpl(...args);
}
export function monitorSlackProvider(
...args: Parameters<MonitorSlackProvider>
): ReturnType<MonitorSlackProvider> {
return monitorSlackProviderImpl(...args);
}
export function probeSlack(...args: Parameters<ProbeSlack>): ReturnType<ProbeSlack> {
return probeSlackImpl(...args);
}
export function resolveSlackChannelAllowlist(
...args: Parameters<ResolveSlackChannelAllowlist>
): ReturnType<ResolveSlackChannelAllowlist> {
return resolveSlackChannelAllowlistImpl(...args);
}
export function resolveSlackUserAllowlist(
...args: Parameters<ResolveSlackUserAllowlist>
): ReturnType<ResolveSlackUserAllowlist> {
return resolveSlackUserAllowlistImpl(...args);
}
export function sendMessageSlack(
...args: Parameters<SendMessageSlack>
): ReturnType<SendMessageSlack> {
return sendMessageSlackImpl(...args);
}
export function handleSlackAction(
...args: Parameters<HandleSlackAction>
): ReturnType<HandleSlackAction> {
return handleSlackActionImpl(...args);
}
export const runtimeSlackOps = {
listDirectoryGroupsLive: listSlackDirectoryGroupsLiveImpl,
listDirectoryPeersLive: listSlackDirectoryPeersLiveImpl,
probeSlack: probeSlackImpl,
resolveChannelAllowlist: resolveSlackChannelAllowlistImpl,
resolveUserAllowlist: resolveSlackUserAllowlistImpl,
sendMessageSlack: sendMessageSlackImpl,
monitorSlackProvider: monitorSlackProviderImpl,
handleSlackAction: handleSlackActionImpl,
} satisfies RuntimeSlackOps;

View File

@ -1,60 +1,64 @@
import type { PluginRuntimeChannel } from "./types-channel.js";
let runtimeSlackOpsPromise: Promise<typeof import("./runtime-slack-ops.runtime.js")> | null = null;
type RuntimeSlackOps = typeof import("./runtime-slack-ops.runtime.js").runtimeSlackOps;
let runtimeSlackOpsPromise: Promise<RuntimeSlackOps> | null = null;
function loadRuntimeSlackOps() {
runtimeSlackOpsPromise ??= import("./runtime-slack-ops.runtime.js");
runtimeSlackOpsPromise ??= import("./runtime-slack-ops.runtime.js").then(
({ runtimeSlackOps }) => runtimeSlackOps,
);
return runtimeSlackOpsPromise;
}
const listDirectoryGroupsLiveLazy: PluginRuntimeChannel["slack"]["listDirectoryGroupsLive"] =
async (...args) => {
const { listSlackDirectoryGroupsLive } = await loadRuntimeSlackOps();
return listSlackDirectoryGroupsLive(...args);
const runtimeSlackOps = await loadRuntimeSlackOps();
return runtimeSlackOps.listDirectoryGroupsLive(...args);
};
const listDirectoryPeersLiveLazy: PluginRuntimeChannel["slack"]["listDirectoryPeersLive"] = async (
...args
) => {
const { listSlackDirectoryPeersLive } = await loadRuntimeSlackOps();
return listSlackDirectoryPeersLive(...args);
const runtimeSlackOps = await loadRuntimeSlackOps();
return runtimeSlackOps.listDirectoryPeersLive(...args);
};
const probeSlackLazy: PluginRuntimeChannel["slack"]["probeSlack"] = async (...args) => {
const { probeSlack } = await loadRuntimeSlackOps();
return probeSlack(...args);
const runtimeSlackOps = await loadRuntimeSlackOps();
return runtimeSlackOps.probeSlack(...args);
};
const resolveChannelAllowlistLazy: PluginRuntimeChannel["slack"]["resolveChannelAllowlist"] =
async (...args) => {
const { resolveSlackChannelAllowlist } = await loadRuntimeSlackOps();
return resolveSlackChannelAllowlist(...args);
const runtimeSlackOps = await loadRuntimeSlackOps();
return runtimeSlackOps.resolveChannelAllowlist(...args);
};
const resolveUserAllowlistLazy: PluginRuntimeChannel["slack"]["resolveUserAllowlist"] = async (
...args
) => {
const { resolveSlackUserAllowlist } = await loadRuntimeSlackOps();
return resolveSlackUserAllowlist(...args);
const runtimeSlackOps = await loadRuntimeSlackOps();
return runtimeSlackOps.resolveUserAllowlist(...args);
};
const sendMessageSlackLazy: PluginRuntimeChannel["slack"]["sendMessageSlack"] = async (...args) => {
const { sendMessageSlack } = await loadRuntimeSlackOps();
return sendMessageSlack(...args);
const runtimeSlackOps = await loadRuntimeSlackOps();
return runtimeSlackOps.sendMessageSlack(...args);
};
const monitorSlackProviderLazy: PluginRuntimeChannel["slack"]["monitorSlackProvider"] = async (
...args
) => {
const { monitorSlackProvider } = await loadRuntimeSlackOps();
return monitorSlackProvider(...args);
const runtimeSlackOps = await loadRuntimeSlackOps();
return runtimeSlackOps.monitorSlackProvider(...args);
};
const handleSlackActionLazy: PluginRuntimeChannel["slack"]["handleSlackAction"] = async (
...args
) => {
const { handleSlackAction } = await loadRuntimeSlackOps();
return handleSlackAction(...args);
const runtimeSlackOps = await loadRuntimeSlackOps();
return runtimeSlackOps.handleSlackAction(...args);
};
export function createRuntimeSlack(): PluginRuntimeChannel["slack"] {

View File

@ -1,7 +1,4 @@
import {
auditTelegramGroupMembership as auditTelegramGroupMembershipImpl,
collectTelegramUnmentionedGroupIds as collectTelegramUnmentionedGroupIdsImpl,
} from "../../../extensions/telegram/src/audit.js";
import { auditTelegramGroupMembership as auditTelegramGroupMembershipImpl } from "../../../extensions/telegram/src/audit.js";
import { monitorTelegramProvider as monitorTelegramProviderImpl } from "../../../extensions/telegram/src/monitor.js";
import { probeTelegram as probeTelegramImpl } from "../../../extensions/telegram/src/probe.js";
import {
@ -15,113 +12,43 @@ import {
sendTypingTelegram as sendTypingTelegramImpl,
unpinMessageTelegram as unpinMessageTelegramImpl,
} from "../../../extensions/telegram/src/send.js";
import { resolveTelegramToken as resolveTelegramTokenImpl } from "../../../extensions/telegram/src/token.js";
import type { PluginRuntimeChannel } from "./types-channel.js";
type AuditTelegramGroupMembership =
typeof import("../../../extensions/telegram/src/audit.js").auditTelegramGroupMembership;
type CollectTelegramUnmentionedGroupIds =
typeof import("../../../extensions/telegram/src/audit.js").collectTelegramUnmentionedGroupIds;
type MonitorTelegramProvider =
typeof import("../../../extensions/telegram/src/monitor.js").monitorTelegramProvider;
type ProbeTelegram = typeof import("../../../extensions/telegram/src/probe.js").probeTelegram;
type DeleteMessageTelegram =
typeof import("../../../extensions/telegram/src/send.js").deleteMessageTelegram;
type EditMessageReplyMarkupTelegram =
typeof import("../../../extensions/telegram/src/send.js").editMessageReplyMarkupTelegram;
type EditMessageTelegram =
typeof import("../../../extensions/telegram/src/send.js").editMessageTelegram;
type PinMessageTelegram =
typeof import("../../../extensions/telegram/src/send.js").pinMessageTelegram;
type RenameForumTopicTelegram =
typeof import("../../../extensions/telegram/src/send.js").renameForumTopicTelegram;
type SendMessageTelegram =
typeof import("../../../extensions/telegram/src/send.js").sendMessageTelegram;
type SendPollTelegram = typeof import("../../../extensions/telegram/src/send.js").sendPollTelegram;
type SendTypingTelegram =
typeof import("../../../extensions/telegram/src/send.js").sendTypingTelegram;
type UnpinMessageTelegram =
typeof import("../../../extensions/telegram/src/send.js").unpinMessageTelegram;
type ResolveTelegramToken =
typeof import("../../../extensions/telegram/src/token.js").resolveTelegramToken;
type RuntimeTelegramOps = Pick<
PluginRuntimeChannel["telegram"],
| "auditGroupMembership"
| "probeTelegram"
| "sendMessageTelegram"
| "sendPollTelegram"
| "monitorTelegramProvider"
> & {
typing: Pick<PluginRuntimeChannel["telegram"]["typing"], "pulse">;
conversationActions: Pick<
PluginRuntimeChannel["telegram"]["conversationActions"],
| "editMessage"
| "editReplyMarkup"
| "deleteMessage"
| "renameTopic"
| "pinMessage"
| "unpinMessage"
>;
};
export function auditTelegramGroupMembership(
...args: Parameters<AuditTelegramGroupMembership>
): ReturnType<AuditTelegramGroupMembership> {
return auditTelegramGroupMembershipImpl(...args);
}
export function collectTelegramUnmentionedGroupIds(
...args: Parameters<CollectTelegramUnmentionedGroupIds>
): ReturnType<CollectTelegramUnmentionedGroupIds> {
return collectTelegramUnmentionedGroupIdsImpl(...args);
}
export function monitorTelegramProvider(
...args: Parameters<MonitorTelegramProvider>
): ReturnType<MonitorTelegramProvider> {
return monitorTelegramProviderImpl(...args);
}
export function probeTelegram(...args: Parameters<ProbeTelegram>): ReturnType<ProbeTelegram> {
return probeTelegramImpl(...args);
}
export function deleteMessageTelegram(
...args: Parameters<DeleteMessageTelegram>
): ReturnType<DeleteMessageTelegram> {
return deleteMessageTelegramImpl(...args);
}
export function editMessageReplyMarkupTelegram(
...args: Parameters<EditMessageReplyMarkupTelegram>
): ReturnType<EditMessageReplyMarkupTelegram> {
return editMessageReplyMarkupTelegramImpl(...args);
}
export function editMessageTelegram(
...args: Parameters<EditMessageTelegram>
): ReturnType<EditMessageTelegram> {
return editMessageTelegramImpl(...args);
}
export function pinMessageTelegram(
...args: Parameters<PinMessageTelegram>
): ReturnType<PinMessageTelegram> {
return pinMessageTelegramImpl(...args);
}
export function renameForumTopicTelegram(
...args: Parameters<RenameForumTopicTelegram>
): ReturnType<RenameForumTopicTelegram> {
return renameForumTopicTelegramImpl(...args);
}
export function sendMessageTelegram(
...args: Parameters<SendMessageTelegram>
): ReturnType<SendMessageTelegram> {
return sendMessageTelegramImpl(...args);
}
export function sendPollTelegram(
...args: Parameters<SendPollTelegram>
): ReturnType<SendPollTelegram> {
return sendPollTelegramImpl(...args);
}
export function sendTypingTelegram(
...args: Parameters<SendTypingTelegram>
): ReturnType<SendTypingTelegram> {
return sendTypingTelegramImpl(...args);
}
export function unpinMessageTelegram(
...args: Parameters<UnpinMessageTelegram>
): ReturnType<UnpinMessageTelegram> {
return unpinMessageTelegramImpl(...args);
}
export function resolveTelegramToken(
...args: Parameters<ResolveTelegramToken>
): ReturnType<ResolveTelegramToken> {
return resolveTelegramTokenImpl(...args);
}
export const runtimeTelegramOps = {
auditGroupMembership: auditTelegramGroupMembershipImpl,
probeTelegram: probeTelegramImpl,
sendMessageTelegram: sendMessageTelegramImpl,
sendPollTelegram: sendPollTelegramImpl,
monitorTelegramProvider: monitorTelegramProviderImpl,
typing: {
pulse: sendTypingTelegramImpl,
},
conversationActions: {
editMessage: editMessageTelegramImpl,
editReplyMarkup: editMessageReplyMarkupTelegramImpl,
deleteMessage: deleteMessageTelegramImpl,
renameTopic: renameForumTopicTelegramImpl,
pinMessage: pinMessageTelegramImpl,
unpinMessage: unpinMessageTelegramImpl,
},
} satisfies RuntimeTelegramOps;

View File

@ -8,87 +8,90 @@ import { resolveTelegramToken } from "../../../extensions/telegram/src/token.js"
import { createTelegramTypingLease } from "./runtime-telegram-typing.js";
import type { PluginRuntimeChannel } from "./types-channel.js";
let runtimeTelegramOpsPromise: Promise<typeof import("./runtime-telegram-ops.runtime.js")> | null =
null;
type RuntimeTelegramOps = typeof import("./runtime-telegram-ops.runtime.js").runtimeTelegramOps;
let runtimeTelegramOpsPromise: Promise<RuntimeTelegramOps> | null = null;
function loadRuntimeTelegramOps() {
runtimeTelegramOpsPromise ??= import("./runtime-telegram-ops.runtime.js");
runtimeTelegramOpsPromise ??= import("./runtime-telegram-ops.runtime.js").then(
({ runtimeTelegramOps }) => runtimeTelegramOps,
);
return runtimeTelegramOpsPromise;
}
const auditGroupMembershipLazy: PluginRuntimeChannel["telegram"]["auditGroupMembership"] = async (
...args
) => {
const { auditTelegramGroupMembership } = await loadRuntimeTelegramOps();
return auditTelegramGroupMembership(...args);
const runtimeTelegramOps = await loadRuntimeTelegramOps();
return runtimeTelegramOps.auditGroupMembership(...args);
};
const probeTelegramLazy: PluginRuntimeChannel["telegram"]["probeTelegram"] = async (...args) => {
const { probeTelegram } = await loadRuntimeTelegramOps();
return probeTelegram(...args);
const runtimeTelegramOps = await loadRuntimeTelegramOps();
return runtimeTelegramOps.probeTelegram(...args);
};
const sendMessageTelegramLazy: PluginRuntimeChannel["telegram"]["sendMessageTelegram"] = async (
...args
) => {
const { sendMessageTelegram } = await loadRuntimeTelegramOps();
return sendMessageTelegram(...args);
const runtimeTelegramOps = await loadRuntimeTelegramOps();
return runtimeTelegramOps.sendMessageTelegram(...args);
};
const sendPollTelegramLazy: PluginRuntimeChannel["telegram"]["sendPollTelegram"] = async (
...args
) => {
const { sendPollTelegram } = await loadRuntimeTelegramOps();
return sendPollTelegram(...args);
const runtimeTelegramOps = await loadRuntimeTelegramOps();
return runtimeTelegramOps.sendPollTelegram(...args);
};
const monitorTelegramProviderLazy: PluginRuntimeChannel["telegram"]["monitorTelegramProvider"] =
async (...args) => {
const { monitorTelegramProvider } = await loadRuntimeTelegramOps();
return monitorTelegramProvider(...args);
const runtimeTelegramOps = await loadRuntimeTelegramOps();
return runtimeTelegramOps.monitorTelegramProvider(...args);
};
const sendTypingTelegramLazy: PluginRuntimeChannel["telegram"]["typing"]["pulse"] = async (
...args
) => {
const { sendTypingTelegram } = await loadRuntimeTelegramOps();
return sendTypingTelegram(...args);
const runtimeTelegramOps = await loadRuntimeTelegramOps();
return runtimeTelegramOps.typing.pulse(...args);
};
const editMessageTelegramLazy: PluginRuntimeChannel["telegram"]["conversationActions"]["editMessage"] =
async (...args) => {
const { editMessageTelegram } = await loadRuntimeTelegramOps();
return editMessageTelegram(...args);
const runtimeTelegramOps = await loadRuntimeTelegramOps();
return runtimeTelegramOps.conversationActions.editMessage(...args);
};
const editMessageReplyMarkupTelegramLazy: PluginRuntimeChannel["telegram"]["conversationActions"]["editReplyMarkup"] =
async (...args) => {
const { editMessageReplyMarkupTelegram } = await loadRuntimeTelegramOps();
return editMessageReplyMarkupTelegram(...args);
const runtimeTelegramOps = await loadRuntimeTelegramOps();
return runtimeTelegramOps.conversationActions.editReplyMarkup(...args);
};
const deleteMessageTelegramLazy: PluginRuntimeChannel["telegram"]["conversationActions"]["deleteMessage"] =
async (...args) => {
const { deleteMessageTelegram } = await loadRuntimeTelegramOps();
return deleteMessageTelegram(...args);
const runtimeTelegramOps = await loadRuntimeTelegramOps();
return runtimeTelegramOps.conversationActions.deleteMessage(...args);
};
const renameForumTopicTelegramLazy: PluginRuntimeChannel["telegram"]["conversationActions"]["renameTopic"] =
async (...args) => {
const { renameForumTopicTelegram } = await loadRuntimeTelegramOps();
return renameForumTopicTelegram(...args);
const runtimeTelegramOps = await loadRuntimeTelegramOps();
return runtimeTelegramOps.conversationActions.renameTopic(...args);
};
const pinMessageTelegramLazy: PluginRuntimeChannel["telegram"]["conversationActions"]["pinMessage"] =
async (...args) => {
const { pinMessageTelegram } = await loadRuntimeTelegramOps();
return pinMessageTelegram(...args);
const runtimeTelegramOps = await loadRuntimeTelegramOps();
return runtimeTelegramOps.conversationActions.pinMessage(...args);
};
const unpinMessageTelegramLazy: PluginRuntimeChannel["telegram"]["conversationActions"]["unpinMessage"] =
async (...args) => {
const { unpinMessageTelegram } = await loadRuntimeTelegramOps();
return unpinMessageTelegram(...args);
const runtimeTelegramOps = await loadRuntimeTelegramOps();
return runtimeTelegramOps.conversationActions.unpinMessage(...args);
};
export function createRuntimeTelegram(): PluginRuntimeChannel["telegram"] {

View File

@ -1,7 +1,8 @@
import { loginWeb as loginWebImpl } from "../../../extensions/whatsapp/src/login.js";
import type { PluginRuntime } from "./types.js";
type LoginWeb = typeof import("../../../extensions/whatsapp/src/login.js").loginWeb;
type RuntimeWhatsAppLogin = Pick<PluginRuntime["channel"]["whatsapp"], "loginWeb">;
export function loginWeb(...args: Parameters<LoginWeb>): ReturnType<LoginWeb> {
return loginWebImpl(...args);
}
export const runtimeWhatsAppLogin = {
loginWeb: loginWebImpl,
} satisfies RuntimeWhatsAppLogin;

View File

@ -2,19 +2,14 @@ import {
sendMessageWhatsApp as sendMessageWhatsAppImpl,
sendPollWhatsApp as sendPollWhatsAppImpl,
} from "../../../extensions/whatsapp/src/send.js";
import type { PluginRuntime } from "./types.js";
type SendMessageWhatsApp =
typeof import("../../../extensions/whatsapp/src/send.js").sendMessageWhatsApp;
type SendPollWhatsApp = typeof import("../../../extensions/whatsapp/src/send.js").sendPollWhatsApp;
type RuntimeWhatsAppOutbound = Pick<
PluginRuntime["channel"]["whatsapp"],
"sendMessageWhatsApp" | "sendPollWhatsApp"
>;
export function sendMessageWhatsApp(
...args: Parameters<SendMessageWhatsApp>
): ReturnType<SendMessageWhatsApp> {
return sendMessageWhatsAppImpl(...args);
}
export function sendPollWhatsApp(
...args: Parameters<SendPollWhatsApp>
): ReturnType<SendPollWhatsApp> {
return sendPollWhatsAppImpl(...args);
}
export const runtimeWhatsAppOutbound = {
sendMessageWhatsApp: sendMessageWhatsAppImpl,
sendPollWhatsApp: sendPollWhatsAppImpl,
} satisfies RuntimeWhatsAppOutbound;

View File

@ -9,23 +9,28 @@ import {
import { createRuntimeWhatsAppLoginTool } from "./runtime-whatsapp-login-tool.js";
import type { PluginRuntime } from "./types.js";
type RuntimeWhatsAppOutbound =
typeof import("./runtime-whatsapp-outbound.runtime.js").runtimeWhatsAppOutbound;
type RuntimeWhatsAppLogin =
typeof import("./runtime-whatsapp-login.runtime.js").runtimeWhatsAppLogin;
const sendMessageWhatsAppLazy: PluginRuntime["channel"]["whatsapp"]["sendMessageWhatsApp"] = async (
...args
) => {
const { sendMessageWhatsApp } = await loadWebOutbound();
return sendMessageWhatsApp(...args);
const runtimeWhatsAppOutbound = await loadWebOutbound();
return runtimeWhatsAppOutbound.sendMessageWhatsApp(...args);
};
const sendPollWhatsAppLazy: PluginRuntime["channel"]["whatsapp"]["sendPollWhatsApp"] = async (
...args
) => {
const { sendPollWhatsApp } = await loadWebOutbound();
return sendPollWhatsApp(...args);
const runtimeWhatsAppOutbound = await loadWebOutbound();
return runtimeWhatsAppOutbound.sendPollWhatsApp(...args);
};
const loginWebLazy: PluginRuntime["channel"]["whatsapp"]["loginWeb"] = async (...args) => {
const { loginWeb } = await loadWebLogin();
return loginWeb(...args);
const runtimeWhatsAppLogin = await loadWebLogin();
return runtimeWhatsAppLogin.loginWeb(...args);
};
const startWebLoginWithQrLazy: PluginRuntime["channel"]["whatsapp"]["startWebLoginWithQr"] = async (
@ -59,20 +64,23 @@ let webLoginQrPromise: Promise<
typeof import("../../../extensions/whatsapp/src/login-qr.js")
> | null = null;
let webChannelPromise: Promise<typeof import("../../channels/web/index.js")> | null = null;
let webOutboundPromise: Promise<typeof import("./runtime-whatsapp-outbound.runtime.js")> | null =
null;
let webLoginPromise: Promise<typeof import("./runtime-whatsapp-login.runtime.js")> | null = null;
let webOutboundPromise: Promise<RuntimeWhatsAppOutbound> | null = null;
let webLoginPromise: Promise<RuntimeWhatsAppLogin> | null = null;
let whatsappActionsPromise: Promise<
typeof import("../../agents/tools/whatsapp-actions.js")
> | null = null;
function loadWebOutbound() {
webOutboundPromise ??= import("./runtime-whatsapp-outbound.runtime.js");
webOutboundPromise ??= import("./runtime-whatsapp-outbound.runtime.js").then(
({ runtimeWhatsAppOutbound }) => runtimeWhatsAppOutbound,
);
return webOutboundPromise;
}
function loadWebLogin() {
webLoginPromise ??= import("./runtime-whatsapp-login.runtime.js");
webLoginPromise ??= import("./runtime-whatsapp-login.runtime.js").then(
({ runtimeWhatsAppLogin }) => runtimeWhatsAppLogin,
);
return webLoginPromise;
}