1- import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers" ;
2- import { formatNormalizedAllowFromEntries } from "openclaw/plugin-sdk/allow-from" ;
3- import {
4- adaptScopedAccountAccessor ,
5- createScopedChannelConfigAdapter ,
6- createScopedDmSecurityResolver ,
7- } from "openclaw/plugin-sdk/channel-config-helpers" ;
1+ import { createScopedDmSecurityResolver } from "openclaw/plugin-sdk/channel-config-helpers" ;
82import { createAccountStatusSink } from "openclaw/plugin-sdk/channel-lifecycle" ;
93import { createPairingPrefixStripper } from "openclaw/plugin-sdk/channel-pairing" ;
104import {
@@ -25,15 +19,21 @@ import {
2519 resolveDefaultBlueBubblesAccountId ,
2620} from "./accounts.js" ;
2721import { bluebubblesMessageActions } from "./actions.js" ;
22+ import {
23+ bluebubblesCapabilities ,
24+ bluebubblesConfigAdapter ,
25+ bluebubblesConfigSchema ,
26+ bluebubblesMeta as meta ,
27+ bluebubblesReload ,
28+ describeBlueBubblesAccount ,
29+ } from "./channel-shared.js" ;
2830import type { BlueBubblesProbe } from "./channel.runtime.js" ;
29- import { BlueBubblesConfigSchema } from "./config-schema.js" ;
3031import {
3132 resolveBlueBubblesGroupRequireMention ,
3233 resolveBlueBubblesGroupToolPolicy ,
3334} from "./group-policy.js" ;
3435import type { ChannelAccountSnapshot , ChannelPlugin } from "./runtime-api.js" ;
3536import {
36- buildChannelConfigSchema ,
3737 buildProbeChannelStatusSummary ,
3838 collectBlueBubblesStatusIssues ,
3939 DEFAULT_ACCOUNT_ID ,
@@ -57,20 +57,6 @@ const loadBlueBubblesChannelRuntime = createLazyRuntimeNamedExport(
5757 "blueBubblesChannelRuntime" ,
5858) ;
5959
60- const bluebubblesConfigAdapter = createScopedChannelConfigAdapter < ResolvedBlueBubblesAccount > ( {
61- sectionKey : "bluebubbles" ,
62- listAccountIds : listBlueBubblesAccountIds ,
63- resolveAccount : adaptScopedAccountAccessor ( resolveBlueBubblesAccount ) ,
64- defaultAccountId : resolveDefaultBlueBubblesAccountId ,
65- clearBaseFields : [ "serverUrl" , "password" , "name" , "webhookPath" ] ,
66- resolveAllowFrom : ( account : ResolvedBlueBubblesAccount ) => account . config . allowFrom ,
67- formatAllowFrom : ( allowFrom ) =>
68- formatNormalizedAllowFromEntries ( {
69- allowFrom,
70- normalizeEntry : ( entry ) => normalizeBlueBubblesHandle ( entry . replace ( / ^ b l u e b u b b l e s : / i, "" ) ) ,
71- } ) ,
72- } ) ;
73-
7460const resolveBlueBubblesDmPolicy = createScopedDmSecurityResolver < ResolvedBlueBubblesAccount > ( {
7561 channelKey : "bluebubbles" ,
7662 resolvePolicy : ( account ) => account . config . dmPolicy ,
@@ -90,53 +76,23 @@ const collectBlueBubblesSecurityWarnings =
9076 mentionGated : false ,
9177 } ) ;
9278
93- const meta = {
94- id : "bluebubbles" ,
95- label : "BlueBubbles" ,
96- selectionLabel : "BlueBubbles (macOS app)" ,
97- detailLabel : "BlueBubbles" ,
98- docsPath : "/channels/bluebubbles" ,
99- docsLabel : "bluebubbles" ,
100- blurb : "iMessage via the BlueBubbles mac app + REST API." ,
101- systemImage : "bubble.left.and.text.bubble.right" ,
102- aliases : [ "bb" ] ,
103- order : 75 ,
104- preferOver : [ "imessage" ] ,
105- } ;
106-
10779export const bluebubblesPlugin : ChannelPlugin < ResolvedBlueBubblesAccount , BlueBubblesProbe > =
10880 createChatChannelPlugin < ResolvedBlueBubblesAccount , BlueBubblesProbe > ( {
10981 base : {
11082 id : "bluebubbles" ,
11183 meta,
112- capabilities : {
113- chatTypes : [ "direct" , "group" ] ,
114- media : true ,
115- reactions : true ,
116- edit : true ,
117- unsend : true ,
118- reply : true ,
119- effects : true ,
120- groupManagement : true ,
121- } ,
84+ capabilities : bluebubblesCapabilities ,
12285 groups : {
12386 resolveRequireMention : resolveBlueBubblesGroupRequireMention ,
12487 resolveToolPolicy : resolveBlueBubblesGroupToolPolicy ,
12588 } ,
126- reload : { configPrefixes : [ "channels.bluebubbles" ] } ,
127- configSchema : buildChannelConfigSchema ( BlueBubblesConfigSchema ) ,
89+ reload : bluebubblesReload ,
90+ configSchema : bluebubblesConfigSchema ,
12891 setupWizard : blueBubblesSetupWizard ,
12992 config : {
13093 ...bluebubblesConfigAdapter ,
13194 isConfigured : ( account ) => account . configured ,
132- describeAccount : ( account ) : ChannelAccountSnapshot =>
133- describeAccountSnapshot ( {
134- account,
135- configured : account . configured ,
136- extra : {
137- baseUrl : account . baseUrl ,
138- } ,
139- } ) ,
95+ describeAccount : ( account ) : ChannelAccountSnapshot => describeBlueBubblesAccount ( account ) ,
14096 } ,
14197 actions : bluebubblesMessageActions ,
14298 messaging : {
0 commit comments