@@ -29,14 +29,6 @@ type ChannelPresenceOptions = {
2929 discovery ?: PluginDiscoveryResult ;
3030 includePersistedAuthState ?: boolean ;
3131 ambientEnvTriggers ?: AmbientEnvTriggerPolicy ;
32- persistedAuthStateProbe ?: {
33- listChannelIds : ( ) => readonly string [ ] ;
34- hasState : ( params : {
35- channelId : string ;
36- cfg : OpenClawConfig ;
37- env : NodeJS . ProcessEnv ;
38- } ) => boolean ;
39- } ;
4032} ;
4133
4234/** Source that made a channel look potentially configured. */
@@ -85,31 +77,6 @@ function hasPersistedChannelState(env: NodeJS.ProcessEnv): boolean {
8577 return fs . existsSync ( resolveStateDir ( env , os . homedir ) ) ;
8678}
8779
88- function listPersistedAuthStateChannelIds ( options : ChannelPresenceOptions ) : readonly string [ ] {
89- return (
90- options . persistedAuthStateProbe ?. listChannelIds ( ) ??
91- listBundledChannelIdsWithPersistedAuthState ( options . discovery )
92- ) ;
93- }
94-
95- function hasPersistedAuthState ( params : {
96- channelId : string ;
97- cfg : OpenClawConfig ;
98- env : NodeJS . ProcessEnv ;
99- options : ChannelPresenceOptions ;
100- } ) : boolean {
101- const override = params . options . persistedAuthStateProbe ;
102- if ( override ) {
103- return override . hasState ( params ) ;
104- }
105- return hasBundledChannelPersistedAuthState ( {
106- channelId : params . channelId ,
107- cfg : params . cfg ,
108- env : params . env ,
109- discovery : params . options . discovery ,
110- } ) ;
111- }
112-
11380/** Lists channel ids detected from config, env vars, or persisted auth state. */
11481export function listPotentialConfiguredChannelIds (
11582 cfg : OpenClawConfig ,
@@ -131,7 +98,6 @@ export function listPotentialConfiguredChannelPresenceSignals(
13198) : ChannelPresenceSignal [ ] {
13299 const signals : ChannelPresenceSignal [ ] = [ ] ;
133100 const seenSignals = new Set < string > ( ) ;
134- const configuredChannelIds = new Set < string > ( ) ;
135101 const addSignal = ( rawChannelId : string , source : ChannelPresenceSignalSource ) => {
136102 const channelId = rawChannelId . trim ( ) ;
137103 if ( ! channelId || isChannelConfigMetadataKey ( channelId ) ) {
@@ -142,7 +108,6 @@ export function listPotentialConfiguredChannelPresenceSignals(
142108 return ;
143109 }
144110 seenSignals . add ( key ) ;
145- configuredChannelIds . add ( channelId ) ;
146111 signals . push ( { channelId, source } ) ;
147112 } ;
148113 const channelIds = options . channelIds ?? listBundledChannelIds ( env , options . discovery ) ;
@@ -192,12 +157,19 @@ export function listPotentialConfiguredChannelPresenceSignals(
192157 if ( options . includePersistedAuthState !== false && hasPersistedChannelState ( env ) ) {
193158 // Persisted auth can make a channel usable even when config/env is empty, but only probe it
194159 // when the state directory exists to keep startup/status checks cheap.
195- for ( const channelId of listPersistedAuthStateChannelIds ( options ) ) {
196- if ( hasPersistedAuthState ( { channelId, cfg, env, options } ) ) {
160+ for ( const channelId of listBundledChannelIdsWithPersistedAuthState ( options . discovery ) ) {
161+ if (
162+ hasBundledChannelPersistedAuthState ( {
163+ channelId,
164+ cfg,
165+ env,
166+ discovery : options . discovery ,
167+ } )
168+ ) {
197169 addSignal ( channelId , "persisted-auth" ) ;
198170 }
199171 }
200172 }
201173
202- return signals . filter ( ( signal ) => configuredChannelIds . has ( signal . channelId ) ) ;
174+ return signals ;
203175}
0 commit comments