diff --git a/extensions/bluebubbles/src/channel.ts b/extensions/bluebubbles/src/channel.ts index c51710bd077..9c5cebe6c85 100644 --- a/extensions/bluebubbles/src/channel.ts +++ b/extensions/bluebubbles/src/channel.ts @@ -6,10 +6,7 @@ import { createScopedDmSecurityResolver, } from "openclaw/plugin-sdk/channel-config-helpers"; import { createAccountStatusSink } from "openclaw/plugin-sdk/channel-lifecycle"; -import { - createPairingPrefixStripper, - createTextPairingAdapter, -} from "openclaw/plugin-sdk/channel-pairing"; +import { createPairingPrefixStripper } from "openclaw/plugin-sdk/channel-pairing"; import { createOpenGroupPolicyRestrictSendersWarningCollector, projectWarningCollector, @@ -300,21 +297,23 @@ export const bluebubblesPlugin: ChannelPlugin = crea hasRepliedRef, }), }, - pairing: createTextPairingAdapter({ - idLabel: "bluebubblesSenderId", - message: PAIRING_APPROVED_MESSAGE, - normalizeAllowEntry: createPairingPrefixStripper( - /^bluebubbles:/i, - normalizeBlueBubblesHandle, - ), - notify: async ({ cfg, id, message }) => { - await ( - await loadBlueBubblesChannelRuntime() - ).sendMessageBlueBubbles(id, message, { - cfg: cfg, - }); + pairing: { + text: { + idLabel: "bluebubblesSenderId", + message: PAIRING_APPROVED_MESSAGE, + normalizeAllowEntry: createPairingPrefixStripper( + /^bluebubbles:/i, + normalizeBlueBubblesHandle, + ), + notify: async ({ cfg, id, message }) => { + await ( + await loadBlueBubblesChannelRuntime() + ).sendMessageBlueBubbles(id, message, { + cfg: cfg, + }); + }, }, - }), + }, outbound: { base: { deliveryMode: "direct", diff --git a/extensions/irc/src/channel.ts b/extensions/irc/src/channel.ts index 4280dad5508..90f99893eb4 100644 --- a/extensions/irc/src/channel.ts +++ b/extensions/irc/src/channel.ts @@ -5,7 +5,6 @@ import { createScopedChannelConfigAdapter, createScopedDmSecurityResolver, } from "openclaw/plugin-sdk/channel-config-helpers"; -import { createTextPairingAdapter } from "openclaw/plugin-sdk/channel-pairing"; import { composeWarningCollectors, createAllowlistProviderOpenWarningCollector, @@ -313,18 +312,20 @@ export const ircPlugin: ChannelPlugin = createChat }, }, }, - pairing: createTextPairingAdapter({ - idLabel: "ircUser", - message: PAIRING_APPROVED_MESSAGE, - normalizeAllowEntry: (entry) => normalizeIrcAllowEntry(entry), - notify: async ({ id, message }) => { - const target = normalizePairingTarget(id); - if (!target) { - throw new Error(`invalid IRC pairing id: ${id}`); - } - await sendMessageIrc(target, message); + pairing: { + text: { + idLabel: "ircUser", + message: PAIRING_APPROVED_MESSAGE, + normalizeAllowEntry: (entry) => normalizeIrcAllowEntry(entry), + notify: async ({ id, message }) => { + const target = normalizePairingTarget(id); + if (!target) { + throw new Error(`invalid IRC pairing id: ${id}`); + } + await sendMessageIrc(target, message); + }, }, - }), + }, security: { resolveDmPolicy: resolveIrcDmPolicy, collectWarnings: collectIrcSecurityWarnings, diff --git a/extensions/line/src/channel.ts b/extensions/line/src/channel.ts index 046eae5147c..6883aaf691b 100644 --- a/extensions/line/src/channel.ts +++ b/extensions/line/src/channel.ts @@ -1,7 +1,4 @@ -import { - createPairingPrefixStripper, - createTextPairingAdapter, -} from "openclaw/plugin-sdk/channel-pairing"; +import { createPairingPrefixStripper } from "openclaw/plugin-sdk/channel-pairing"; import { createRestrictSendersChannelSecurity } from "openclaw/plugin-sdk/channel-policy"; import { createAttachedChannelResultAdapter, @@ -283,22 +280,24 @@ export const linePlugin: ChannelPlugin = createChatChannelP ], }, }, - pairing: createTextPairingAdapter({ - idLabel: "lineUserId", - message: "OpenClaw: your access has been approved.", - // LINE IDs are case-sensitive; only strip prefix variants (line: / line:user:). - normalizeAllowEntry: createPairingPrefixStripper(/^line:(?:user:)?/i), - notify: async ({ cfg, id, message }) => { - const line = getLineRuntime().channel.line; - const account = line.resolveLineAccount({ cfg }); - if (!account.channelAccessToken) { - throw new Error("LINE channel access token not configured"); - } - await line.pushMessageLine(id, message, { - channelAccessToken: account.channelAccessToken, - }); + pairing: { + text: { + idLabel: "lineUserId", + message: "OpenClaw: your access has been approved.", + // LINE IDs are case-sensitive; only strip prefix variants (line: / line:user:). + normalizeAllowEntry: createPairingPrefixStripper(/^line:(?:user:)?/i), + notify: async ({ cfg, id, message }) => { + const line = getLineRuntime().channel.line; + const account = line.resolveLineAccount({ cfg }); + if (!account.channelAccessToken) { + throw new Error("LINE channel access token not configured"); + } + await line.pushMessageLine(id, message, { + channelAccessToken: account.channelAccessToken, + }); + }, }, - }), + }, security: lineSecurityAdapter, outbound: { deliveryMode: "direct", diff --git a/extensions/zalouser/src/channel.ts b/extensions/zalouser/src/channel.ts index d762627b288..24f2ee531a0 100644 --- a/extensions/zalouser/src/channel.ts +++ b/extensions/zalouser/src/channel.ts @@ -1,9 +1,6 @@ import { createScopedDmSecurityResolver } from "openclaw/plugin-sdk/channel-config-helpers"; import { createAccountStatusSink } from "openclaw/plugin-sdk/channel-lifecycle"; -import { - createPairingPrefixStripper, - createTextPairingAdapter, -} from "openclaw/plugin-sdk/channel-pairing"; +import { createPairingPrefixStripper } from "openclaw/plugin-sdk/channel-pairing"; import { createEmptyChannelResult, createRawChannelSendResultAdapter, @@ -498,21 +495,23 @@ export const zalouserPlugin: ChannelPlugin { - const account = resolveZalouserAccountSync({ cfg: cfg }); - const authenticated = await checkZcaAuthenticated(account.profile); - if (!authenticated) { - throw new Error("Zalouser not authenticated"); - } - await sendMessageZalouser(id, message, { - profile: account.profile, - }); + pairing: { + text: { + idLabel: "zalouserUserId", + message: "Your pairing request has been approved.", + normalizeAllowEntry: createPairingPrefixStripper(/^(zalouser|zlu):/i), + notify: async ({ cfg, id, message }) => { + const account = resolveZalouserAccountSync({ cfg: cfg }); + const authenticated = await checkZcaAuthenticated(account.profile); + if (!authenticated) { + throw new Error("Zalouser not authenticated"); + } + await sendMessageZalouser(id, message, { + profile: account.profile, + }); + }, }, - }), + }, outbound: { deliveryMode: "direct", chunker: (text, limit) => getZalouserRuntime().channel.text.chunkMarkdownText(text, limit),